-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
3 lines (3 loc) · 83.2 KB
/
Copy pathapp.js
File metadata and controls
3 lines (3 loc) · 83.2 KB
1
2
3
var it=new TextDecoder("windows-1252",{fatal:!1}),st=new TextDecoder("utf-16le",{fatal:!1});function at(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.slice(0))}var N=class{constructor(t){Object.defineProperty(this,"view",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.bytes=t instanceof Uint8Array?t:new Uint8Array(t),this.view=new DataView(this.bytes.buffer,this.bytes.byteOffset,this.bytes.byteLength)}get length(){return this.bytes.byteLength}ensure(t,n){if(t<0||n<0||t+n>this.bytes.byteLength)throw new RangeError(`Out of bounds read: offset=${t} length=${n} size=${this.bytes.byteLength}`)}u8(t){return this.ensure(t,1),this.view.getUint8(t)}i16(t){return this.ensure(t,2),this.view.getInt16(t,!0)}u16(t){return this.ensure(t,2),this.view.getUint16(t,!0)}i32(t){return this.ensure(t,4),this.view.getInt32(t,!0)}u32(t){return this.ensure(t,4),this.view.getUint32(t,!0)}u64(t){return this.ensure(t,8),this.view.getBigUint64(t,!0)}bytesAt(t,n){return this.ensure(t,n),this.bytes.subarray(t,t+n)}slice(t,n){return this.bytesAt(t,n)}latin1(t,n){return it.decode(this.bytesAt(t,n))}utf16(t,n){return st.decode(this.bytesAt(t,n))}nullTerminatedUtf16(t,n){let r=this.utf16(t,n),o=r.indexOf("\0");return o>=0?r.slice(0,o):r}nullTerminatedLatin1(t,n){let r=this.latin1(t,n),o=r.indexOf("\0");return o>=0?r.slice(0,o):r}};function $e(e,t,n){return Math.min(n,Math.max(t,e))}function ae(e){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="";for(let r=0;r<e.length;r+=3){let o=e[r]??0,i=e[r+1]??0,a=e[r+2]??0,s=o<<16|i<<8|a;n+=t[s>>18&63],n+=t[s>>12&63],n+=r+1<e.length?t[s>>6&63]:"=",n+=r+2<e.length?t[s&63]:"="}return n}function ct(e){return it.decode(e)}function ve(e){return st.decode(e)}var te=new TextDecoder("utf-8"),dt=new WeakMap;function V(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function P(e,t,n){return new RegExp(`<${t}[^>]*\\b${n}="([^"]+)"`,"i").exec(e)?.[1]}function ce(e,t){return new RegExp(`<${t}(?:\\s[^>]*)?>([\\s\\S]*?)<\\/${t}>`,"i").exec(e)?.[1]}function de(e,t){return(new RegExp(`<${t}(?:\\s[^>]*)?>[\\s\\S]*?<\\/${t}>`,"i").exec(e)??new RegExp(`<${t}(?:\\s[^>]*)?\\s*\\/>`,"i").exec(e))?.[0]}function rn(e,t){return new RegExp(`<${t}(?:\\s[^>]*)?\\s*\\/>`,"i").test(e)}function Z(e){return e/9525}function _(e){return e<=0?0:e>=1?1:e}function on(e){let t=e.r/255,n=e.g/255,r=e.b/255,o=Math.max(t,n,r),i=Math.min(t,n,r),a=0,s=0,c=(o+i)/2;if(o!==i){let d=o-i;switch(s=c>.5?d/(2-o-i):d/(o+i),o){case t:a=(n-r)/d+(n<r?6:0);break;case n:a=(r-t)/d+2;break;default:a=(t-n)/d+4;break}a/=6}return{h:a,s,l:c}}function je(e,t,n){let r=n;return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function sn(e,t,n,r=1){let o=n,i=n,a=n;if(t!==0){let u=n<.5?n*(1+t):n+t-n*t,f=2*n-u;o=je(f,u,e+1/3),i=je(f,u,e),a=je(f,u,e-1/3)}let s=Math.round(o*255),c=Math.round(i*255),d=Math.round(a*255);return{r:s,g:c,b:d,a:_(r),hex:`#${[s,c,d].map(u=>u.toString(16).padStart(2,"0")).join("")}`,source:"rgb"}}function Te(e,t=1){let n=e.trim(),r=Number.parseInt(n.slice(0,2),16),o=Number.parseInt(n.slice(2,4),16),i=Number.parseInt(n.slice(4,6),16);return{r,g:o,b:i,a:_(t),hex:`#${n.toLowerCase()}`,source:"rgb"}}function an(e){switch(e){case"bg1":case"lt1":return 0;case"tx1":case"dk1":return 1;case"bg2":case"lt2":return 2;case"tx2":case"dk2":return 3;case"accent1":return 4;case"accent2":return 5;case"accent3":return 6;case"accent4":return 7;default:return}}function cn(e,t){let n=an(e);if(n!==void 0){let r=t.find(o=>o.index===n)?.color;if(r){let o={r:r.r,g:r.g,b:r.b,hex:r.hex,source:"scheme",schemeIndex:n};return r.a!==void 0&&(o.a=r.a),o}}return Te(e==="accent5"?"6c63ff":e==="accent6"?"00c2a8":"808080")}function lt(e,t){let n=e.a??1,r=P(t,"a:alpha","val");r&&(n*=Number.parseInt(r,10)/1e5);let{h:o,s:i,l:a}=on(e),s=a,c=P(t,"a:lumMod","val");c&&(s*=Number.parseInt(c,10)/1e5);let d=P(t,"a:lumOff","val");d&&(s+=Number.parseInt(d,10)/1e5);let l=P(t,"a:shade","val");l&&(s*=Number.parseInt(l,10)/1e5);let u=P(t,"a:tint","val");if(u){let f=Number.parseInt(u,10)/1e5;s=s+(1-s)*f}return sn(o,i,_(s),n)}function Pe(e,t){let n=/<a:srgbClr[^>]*val="([0-9A-Fa-f]{6})"[^>]*>([\s\S]*?)<\/a:srgbClr>/i.exec(e)??/<a:srgbClr[^>]*val="([0-9A-Fa-f]{6})"[^>]*\s*\/?>/i.exec(e);if(n){let o=Te(n[1]);return lt(o,n[0])}let r=/<a:schemeClr[^>]*val="([^"]+)"[^>]*>([\s\S]*?)<\/a:schemeClr>/i.exec(e)??/<a:schemeClr[^>]*val="([^"]+)"[^>]*\s*\/?>/i.exec(e);if(r){let o=cn(r[1],t);return lt(o,r[0])}}function dn(e,t){let n=[],r=/<a:gs[^>]*pos="(\d+)"[^>]*>([\s\S]*?)<\/a:gs>/gi,o=r.exec(e);for(;o;){let i=Number.parseInt(o[1],10)/1e5,a=Pe(o[2],t);a&&n.push({position:i,color:a,opacity:_(a.a??1)}),o=r.exec(e)}return n.sort((i,a)=>i.position-a.position)}function We(e,t){if(rn(e,"a:noFill"))return{kind:"none"};let n=ce(e,"a:solidFill");if(n){let o=Pe(n,t);if(o)return{kind:"solid",color:o,opacity:_(o.a??1)}}let r=ce(e,"a:gradFill");if(r){let o=dn(r,t),i=P(r,"a:path","path"),a=P(r,"a:lin","ang");return{kind:"gradient",gradientShape:i==="circle"?"circle":"linear",gradientAngle:a?Number.parseInt(a,10)/6e4:0,gradientStops:o}}}function ln(e,t){let n=de(e,"a:outerShdw");if(!n)return;let r=Pe(n,t);if(!r)return;let o=/\bblurRad="(-?\d+)"/i.exec(n)?.[1],i=/\bdist="(-?\d+)"/i.exec(n)?.[1],a=/\bdir="(-?\d+)"/i.exec(n)?.[1];return{color:r,blurPx:o?Z(Number.parseInt(o,10)):0,distancePx:i?Z(Number.parseInt(i,10)):0,angle:a?Number.parseInt(a,10)/6e4:0}}function un(e){if(!e||!/<a:preciseEffectOffsets\b/i.test(e))return;let t=a=>{let s=new RegExp(`<a:${a}\b[^>]*\bn="(-?d+)"`,"i").exec(e);return s?Z(Number.parseInt(s[1],10)):0},n=t("l"),r=t("t"),o=t("r"),i=t("b");if(!(n===0&&r===0&&o===0&&i===0))return{leftPx:Math.max(0,-n),topPx:Math.max(0,-r),rightPx:Math.max(0,o),bottomPx:Math.max(0,i)}}function fn(e,t){let n=de(e,"a:xfrm")??"",r=P(n,"a:off","x"),o=P(n,"a:off","y"),i=P(n,"a:ext","cx"),a=P(n,"a:ext","cy");if(!r||!o||!i||!a)return;let s=Z(Number.parseInt(i,10)),c=Z(Number.parseInt(a,10));if(!(s>0)||!(c>0))return;let d={xPx:Z(Number.parseInt(r,10)),yPx:Z(Number.parseInt(o,10)),widthPx:s,heightPx:c},l=un(t);return l&&(d.effectPadding=l),d}function pn(e,t){let n=/<a:ln\b([^>]*)>([\s\S]*?)<\/a:ln>/i.exec(e);if(!n)return{kind:"none"};let r=n[1]??"",o=n[2]??"",i=We(o,t)??{kind:"none"},a=/\bw="(\d+)"/i.exec(r)?.[1],s=/\bcap="([^"]+)"/i.exec(r)?.[1],c={...i};a&&(c.widthPx=Z(Number.parseInt(a,10))),s==="rnd"?c.lineCap="round":s==="sq"?c.lineCap="square":c.lineCap="butt";let d=P(o,"a:headEnd","type");d&&(c.headEnd=d);let l=P(o,"a:tailEnd","type");return l&&(c.tailEnd=l),c}function mn(e){let t={},n=/<a:gd[^>]*name="([^"]+)"[^>]*fmla="val ([^"]+)"[^>]*\s*\/?>/gi,r=n.exec(e);for(;r;)t[r[1]]=Number.parseInt(r[2],10),r=n.exec(e);return t}function hn(e){let t=[],n=/<a:(moveTo|lnTo|cubicBezTo)(?:\b[^>]*)?>([\s\S]*?)<\/a:\1>|<a:close\s*\/>/gi,r=n.exec(e);for(;r;){if(r[0].startsWith("<a:close")){t.push({type:"Z"}),r=n.exec(e);continue}let o=r[1],a=[...(r[2]??"").matchAll(/<a:pt[^>]*x="([^"]+)"[^>]*y="([^"]+)"[^>]*\s*\/?>/gi)].map(s=>({x:Number.parseInt(s[1],10),y:Number.parseInt(s[2],10)}));(o==="moveTo"||o==="lnTo")&&a[0]?t.push({type:o==="moveTo"?"M":"L",x:a[0].x,y:a[0].y}):o==="cubicBezTo"&&a.length>=3&&t.push({type:"C",x1:a[0].x,y1:a[0].y,x2:a[1].x,y2:a[1].y,x:a[2].x,y:a[2].y}),r=n.exec(e)}return t}function pt(e){let t=ce(e,"a:pathLst")??e,n=[],r=/<a:path\b([^>]*)>([\s\S]*?)<\/a:path>/gi,o=r.exec(t);for(;o;){let i=o[1]??"",a=o[2]??"",s=Math.max(1,Number.parseInt(/\bw="(\d+)"/i.exec(i)?.[1]??"1",10)),c=Math.max(1,Number.parseInt(/\bh="(\d+)"/i.exec(i)?.[1]??"1",10)),d=hn(a);d.length>0&&n.push({sourceWidth:s,sourceHeight:c,commands:d}),o=r.exec(t)}return n}function mt(e,t,n){let r=t/e.sourceWidth,o=n/e.sourceHeight;return e.commands.map(i=>{switch(i.type){case"M":return`M ${i.x*r} ${i.y*o}`;case"L":return`L ${i.x*r} ${i.y*o}`;case"C":return`C ${i.x1*r} ${i.y1*o} ${i.x2*r} ${i.y2*o} ${i.x*r} ${i.y*o}`;default:return"Z"}}).join(" ")}function gn(e,t,n,r){if(e==="roundRect")return _((t.adj??2500)/1e5)*Math.min(n,r);if(e==="round2SameRect"){let o=Math.max(t.adj1??5e4,t.adj2??0)/1e5;return _(o)*Math.min(n,r)/2}return 0}function Ue(e,t,n,r){let o=ce(e,"p:spPr");if(!o)return null;let i=P(o,"a:prstGeom","prst"),a=pt(de(o,"a:custGeom")??"");if(!i&&a.length===0)return null;let s=P(o,"a:xfrm","rot"),c=s?Number.parseInt(s,10)/6e4:void 0,d=pn(o,t),l=o.replace(/<a:ln\b[\s\S]*?<\/a:ln>/i,""),u=We(l,t)??{kind:"none"},f=mn(o),p={kind:n,fill:u,line:d};i!==void 0&&(p.preset=i),c!==void 0&&(p.rotation=c);let g=fn(o,r);g&&(p.frame=g);let b=ln(o,t);if(b&&(p.outerShadow=b),a.length>0&&(p.customPaths=a),(i==="roundRect"||i==="round2SameRect")&&(p.roundness=gn(i,f,1,1)),i==="arc"){let y=f.adj1,B=f.adj2;y!==void 0&&B!==void 0&&(p.arc={startAngle:y/6e4,endAngle:B/6e4})}return p}function xn(e,t){if(!/<p:background\b/i.test(e))return null;let n=ce(e,"p:bgPr"),r=n?We(n,t):void 0;if(!r){let o=de(e,"p:bgRef");if(o){let i=Pe(o,t);i&&(r={kind:"solid",color:i,opacity:_(i.a??1)})}}return{kind:"background",fill:r??{kind:"none"},line:{kind:"none"}}}function yn(e){let t=e.toLowerCase();return t.endsWith(".png")?"image/png":t.endsWith(".gif")?"image/gif":t.endsWith(".bmp")||t.endsWith(".dib")?"image/bmp":t.endsWith(".webp")?"image/webp":"image/jpeg"}function ut(e){let t=e.replace(/\\/g,"/").split("/"),n=[];return t.forEach(r=>{if(!(!r||r===".")){if(r===".."){n.pop();return}n.push(r)}}),n.join("/")}function bn(e,t){if(t.startsWith("/"))return ut(t);let n=e.split("/");return n.pop(),ut([...n,t].join("/"))}async function wn(e){if(typeof DecompressionStream<"u")try{let o=new Uint8Array(e),i=new Blob([o]).stream().pipeThrough(new DecompressionStream("deflate-raw")),a=await new Response(i).arrayBuffer();return new Uint8Array(a)}catch{}let r=(await new Function("specifier","return import(specifier)")("node:zlib")).inflateRawSync(e);return r instanceof Uint8Array?r:new Uint8Array(r)}async function kn(e){let t=new Map,n=0;for(;n+30<=e.length&&(e[n]|e[n+1]<<8|e[n+2]<<16|e[n+3]<<24)===67324752;){let o=e[n+8]|e[n+9]<<8,i=e[n+18]|e[n+19]<<8|e[n+20]<<16|e[n+21]<<24,a=e[n+26]|e[n+27]<<8,s=e[n+28]|e[n+29]<<8,c=n+30,d=c+a,l=d+s,u=te.decode(e.slice(c,d)),f=l,p=f+i;if(p>e.length)break;let g=e.slice(f,p);o===0?t.set(u,g):o===8&&t.set(u,await wn(g)),n=p}return t}function Sn(e,t){let n=/<Relationship[^>]*Id="([^"]+)"[^>]*Target="([^"]+)"[^>]*\/?>(?:<\/Relationship>)?/gi,r=n.exec(e);for(;r;){if(r[1]===t)return r[2];r=n.exec(e)}}function $n(e,t,n,r){let o=Ue(e,n,"picture",r);if(!o)return null;let i=P(e,"a:blip","r:embed"),a;if(i){let l=t.get("drs/_rels/picturexml.xml.rels"),u=l?te.decode(l):"",f=Sn(u,i);if(f){let p=bn("drs/picturexml.xml",f),g=t.get(p);g&&(a=`data:${yn(p)};base64,${ae(g)}`)}}let s=de(e,"a:srcRect")??"",c=pt(de(ce(e,"p:spPr")??"","a:custGeom")??""),d={cropLeft:Number.parseInt(P(s,"a:srcRect","l")??"0",10)/1e5,cropTop:Number.parseInt(P(s,"a:srcRect","t")??"0",10)/1e5,cropRight:Number.parseInt(P(s,"a:srcRect","r")??"0",10)/1e5,cropBottom:Number.parseInt(P(s,"a:srcRect","b")??"0",10)/1e5,clipPaths:c};return a!==void 0&&(d.dataUri=a),o.picture=d,o}async function vn(e,t){let n=await kn(e),r=n.get("drs/downrev.xml"),o=r?te.decode(r):void 0,i=n.get("drs/shapexml.xml");if(i){let d=te.decode(i),l=xn(d,t);if(l)return l}let a=n.get("drs/picturexml.xml");if(a)return $n(te.decode(a),n,t,o);let s=n.get("drs/connectorxml.xml");if(s)return Ue(te.decode(s),t,"connector",o);let c=n.get("drs/shapexml.xml");return c?Ue(te.decode(c),t,"shape",o):null}async function Cn(e,t){if(!e.metroBlob)return null;let n=dt.get(e.metroBlob.bytes);return n||(n=vn(e.metroBlob.bytes,t),dt.set(e.metroBlob.bytes,n)),n}function ge(e,t){let n=t??e?.a??1;return`${_(n)}`}function ht(e){return e?.hex??"#000000"}function gt(e,t=0,n){let r=(t-90)*Math.PI/180,o=Math.cos(r)*.5,i=Math.sin(r)*.5,a=.5-o,s=.5-i,c=.5+o,d=.5+i;return[`<linearGradient id="${V(e)}" x1="${a}" y1="${s}" x2="${c}" y2="${d}">`,...n.map(l=>`<stop offset="${l.position*100}%" stop-color="${l.color.hex}" stop-opacity="${ge(l.color,l.opacity)}"/>`),"</linearGradient>"].join("")}function Tn(e,t){return[`<radialGradient id="${V(e)}" cx="50%" cy="50%" r="50%">`,...t.map(n=>`<stop offset="${n.position*100}%" stop-color="${n.color.hex}" stop-opacity="${ge(n.color,n.opacity)}"/>`),"</radialGradient>"].join("")}function Pn(e,t){if(t.kind==="none")return{defs:"",fill:"none"};if(t.kind==="solid")return{defs:"",fill:ht(t.color),fillOpacity:ge(t.color,t.opacity)};let n=t.gradientStops??[];if(n.length===0)return{defs:"",fill:"none"};let r=`${e}-fill`;return{defs:t.gradientShape==="circle"?Tn(r,n):gt(r,t.gradientAngle,n),fill:`url(#${r})`}}function In(e,t){let n=Math.max(.5,t.widthPx??1),r=t.lineCap??"round";if(t.kind==="none")return{defs:"",stroke:"none",strokeWidth:n,lineCap:r};if(t.kind==="solid")return{defs:"",stroke:ht(t.color),strokeOpacity:ge(t.color,t.opacity),strokeWidth:n,lineCap:r};let o=t.gradientStops??[];if(o.length===0)return{defs:"",stroke:"none",strokeWidth:n,lineCap:r};let i=`${e}-stroke`;return{defs:gt(i,t.gradientAngle,o),stroke:`url(#${i})`,strokeWidth:n,lineCap:r}}function An(e,t,n,r){let o=e/2,i=t/2,a=o,s=i,c=g=>{let b=g*Math.PI/180;return{x:a+o*Math.cos(b),y:s+i*Math.sin(b)}},d=c(n),l=c(r),u=(r-n+540)%360-180;u===-180&&(u=180);let f=Math.abs(u)>180?1:0,p=u>=0?1:0;return`M ${d.x} ${d.y} A ${o} ${i} 0 ${f} ${p} ${l.x} ${l.y}`}function Bn(e,t){let n=e/2,r=t/2,o=e/2,i=t/2;return`M ${o-n} ${i} A ${n} ${r} 0 1 0 ${o+n} ${i} A ${n} ${r} 0 1 0 ${o-n} ${i} Z`}function Ce(e,t,n,r,o=0){return`<rect x="0" y="0" width="${e}" height="${t}"${o>0?` rx="${o}" ry="${o}"`:""} fill="${n.fill}"${n.fillOpacity?` fill-opacity="${n.fillOpacity}"`:""} stroke="${r.stroke}"${r.strokeOpacity?` stroke-opacity="${r.strokeOpacity}"`:""} stroke-width="${r.strokeWidth}" stroke-linecap="${V(r.lineCap)}"/>`}function ft(e,t,n,r,o){return e.map(i=>`<path d="${mt(i,t,n)}" fill="${r.fill}"${r.fillOpacity?` fill-opacity="${r.fillOpacity}"`:""} stroke="${o.stroke}"${o.strokeOpacity?` stroke-opacity="${o.strokeOpacity}"`:""} stroke-width="${o.strokeWidth}" stroke-linecap="${V(o.lineCap)}"/>`).join("")}function En(e,t,n,r){let o=e.picture;if(!o?.dataUri)return{defs:[]};let i=[],a;o.clipPaths.length>0&&(a=`${r}-clip`,i.push(`<clipPath id="${a}">${o.clipPaths.map(g=>`<path d="${mt(g,t,n)}"/>`).join("")}</clipPath>`));let s=Math.max(1e-4,1-o.cropLeft-o.cropRight),c=Math.max(1e-4,1-o.cropTop-o.cropBottom),d=t/s,l=n/c,u=-(o.cropLeft*d),f=-(o.cropTop*l),p=`<image href="${o.dataUri}" x="${u}" y="${f}" width="${d}" height="${l}" preserveAspectRatio="none"${a?` clip-path="url(#${a})"`:""}/>`;return{defs:i,geometry:p}}function ee(e){return e.kind==="none"?!1:e.kind==="solid"?(e.opacity??e.color?.a??1)>0:(e.gradientStops??[]).some(t=>(t.opacity??t.color.a??1)>0)}function Ln(e){return e.kind==="picture"?!!e.picture?.dataUri:e.kind==="background"||(e.customPaths?.length??0)>0?ee(e.fill)||ee(e.line):e.preset==="line"||e.preset==="arc"?ee(e.line):ee(e.fill)||ee(e.line)}function Mn(e,t,n){let r=e.frame?.widthPx??t,o=e.frame?.heightPx??n,i=e.frame?.effectPadding?.leftPx??0,a=e.frame?.effectPadding?.topPx??0,s=e.frame?.effectPadding?.rightPx??0,c=e.frame?.effectPadding?.bottomPx??0,d=Math.max(r+i+s,t),l=Math.max(o+a+c,n),u=i+Math.max(0,(d-(r+i+s))/2),f=a+Math.max(0,(l-(o+a+c))/2);return{viewWidth:d,viewHeight:l,geometryWidth:r,geometryHeight:o,offsetX:u,offsetY:f}}function Rn(e,t){let n=t.angle*Math.PI/180,r=Math.cos(n)*t.distancePx,o=Math.sin(n)*t.distancePx,i=Math.max(.01,t.blurPx/2);return`<filter id="${V(e)}" x="-80%" y="-80%" width="260%" height="260%"><feDropShadow dx="${r}" dy="${o}" stdDeviation="${i}" flood-color="${t.color.hex}" flood-opacity="${ge(t.color)}"/></filter>`}async function xt(e,t,n,r){if(!e.metroBlob)return;let o=await Cn(e,r);if(!o)return;let i=Mn(o,t,n),a=i.geometryWidth,s=i.geometryHeight;if(!(a>0)||!(s>0)||!Ln(o))return;let c=[],d=Pn(`ppt-shape-${e.id}`,o.fill),l=In(`ppt-shape-${e.id}`,o.line);d.defs&&c.push(d.defs),l.defs&&c.push(l.defs);let u;o.outerShadow&&(u=`ppt-shape-${e.id}-outer-shadow`,c.push(Rn(u,o.outerShadow)));let f="";if(o.kind==="picture"){let y=En(o,a,s,`ppt-shape-${e.id}`);if(c.push(...y.defs),f=y.geometry??"",!f)return}else if(o.customPaths&&o.customPaths.length>0&&!o.preset)f=ft(o.customPaths,a,s,d,l);else switch(o.preset){case void 0:o.kind==="background"&&(f=Ce(a,s,d,l,0));break;case"rect":f=Ce(a,s,d,l,0);break;case"roundRect":{let y=Math.max(2,(o.roundness??.04)*Math.min(a,s));f=Ce(a,s,d,l,y);break}case"round2SameRect":{let y=Math.max(2,(o.roundness??.5)*Math.min(a,s));f=Ce(a,s,d,l,y);break}case"ellipse":f=`<ellipse cx="${a/2}" cy="${s/2}" rx="${a/2}" ry="${s/2}" fill="${d.fill}"${d.fillOpacity?` fill-opacity="${d.fillOpacity}"`:""} stroke="${l.stroke}"${l.strokeOpacity?` stroke-opacity="${l.strokeOpacity}"`:""} stroke-width="${l.strokeWidth}" stroke-linecap="${V(l.lineCap)}"/>`;break;case"line":f=`<line x1="0" y1="${s/2}" x2="${a}" y2="${s/2}" stroke="${l.stroke}"${l.strokeOpacity?` stroke-opacity="${l.strokeOpacity}"`:""} stroke-width="${l.strokeWidth}" stroke-linecap="${V(l.lineCap)}"/>`;break;case"arc":o.arc&&(f=`<path d="${An(a,s,o.arc.startAngle,o.arc.endAngle)}" fill="none" stroke="${l.stroke}"${l.strokeOpacity?` stroke-opacity="${l.strokeOpacity}"`:""} stroke-width="${l.strokeWidth}" stroke-linecap="${V(l.lineCap)}"/>`);break;case"donut":{let y=Bn(a,s),B=a*.56,F=s*.56,G=(a-B)/2,j=(s-F)/2,E=B/2,M=F/2,x=G+E,k=j+M,$=`M ${x-E} ${k} A ${E} ${M} 0 1 0 ${x+E} ${k} A ${E} ${M} 0 1 0 ${x-E} ${k} Z`;f=`<path d="${y} ${$}" fill="${d.fill}"${d.fillOpacity?` fill-opacity="${d.fillOpacity}"`:""} fill-rule="evenodd" stroke="${l.stroke}"${l.strokeOpacity?` stroke-opacity="${l.strokeOpacity}"`:""} stroke-width="${l.strokeWidth}"/>`;break}case"mathMultiply":{let y=o.line.kind==="none"?{stroke:d.fill==="none"?"#000000":d.fill,strokeOpacity:d.fillOpacity,strokeWidth:Math.max(2,Math.min(a,s)*.08),lineCap:"round"}:l;f=[`<line x1="${a*.22}" y1="${s*.22}" x2="${a*.78}" y2="${s*.78}" stroke="${y.stroke}"${y.strokeOpacity?` stroke-opacity="${y.strokeOpacity}"`:""} stroke-width="${y.strokeWidth}" stroke-linecap="${V(y.lineCap)}"/>`,`<line x1="${a*.78}" y1="${s*.22}" x2="${a*.22}" y2="${s*.78}" stroke="${y.stroke}"${y.strokeOpacity?` stroke-opacity="${y.strokeOpacity}"`:""} stroke-width="${y.strokeWidth}" stroke-linecap="${V(y.lineCap)}"/>`].join("");break}default:o.customPaths&&o.customPaths.length>0&&(f=ft(o.customPaths,a,s,d,l));break}if(!f)return;let p=u?`<g filter="url(#${u})">${f}</g>`:f;(i.offsetX!==0||i.offsetY!==0)&&(p=`<g transform="translate(${i.offsetX} ${i.offsetY})">${p}</g>`);let g=o.rotation??e.rotation??0;g!==0&&(p=`<g transform="rotate(${g} ${i.offsetX+a/2} ${i.offsetY+s/2})">${p}</g>`);let b=o.frame?{...o.frame,xPx:o.frame.xPx-(o.frame.effectPadding?.leftPx??0),yPx:o.frame.yPx-(o.frame.effectPadding?.topPx??0),widthPx:i.viewWidth,heightPx:i.viewHeight}:void 0;return{svg:[`<svg class="ppt-viewer-metro" viewBox="0 0 ${i.viewWidth} ${i.viewHeight}" aria-hidden="true" focusable="false" preserveAspectRatio="none" style="width:100%;height:100%;display:block;overflow:visible">`,c.length>0?`<defs>${c.join("")}</defs>`:"",p,"</svg>"].join(""),...b?{frame:b}:{}}}var Ge=6,On=9525,Fn=new Set(["drs/shapexml.xml","drs/picturexml.xml","drs/connectorxml.xml"]),Ve=new WeakMap;function kt(e,t,n){return Math.min(n,Math.max(t,e))}function _e(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function re(e){return Object.entries(e).filter(([,t])=>t!=null&&t!==!1&&t!=="").map(([t,n])=>`${t}:${String(n)}`).join(";")}function xe(...e){return e.filter(t=>t&&t.length>0).join(";")}function I(e){if(e!==void 0)return e/Ge}function Ie(e){if(e!==void 0)return e/On}function zn(e,t){if(t!==void 0)return e.fonts.find(n=>n.index===t)?.name}function Hn(e){if(e){if(e.base64)return`data:${e.mimeType};base64,${e.base64}`;if(e.data)return`data:${e.mimeType};base64,${ae(e.data)}`}}function Nn(e){let t=e.metroBlob?.bytes;if(!t)return!1;let n=Ve.get(t);if(n!==void 0)return n;let r=0;for(;r+30<=t.length&&(t[r]|t[r+1]<<8|t[r+2]<<16|t[r+3]<<24)===67324752;){let i=t[r+18]|t[r+19]<<8|t[r+20]<<16|t[r+21]<<24,a=t[r+26]|t[r+27]<<8,s=t[r+28]|t[r+29]<<8,c=r+30,d=c+a,l=new TextDecoder().decode(t.slice(c,d));if(Fn.has(l))return Ve.set(t,!0),!0;r=d+s+i}return Ve.set(t,!1),!1}function ne(e,t=1){if(!e)return;let n=kt((e.a??1)*t,0,1);return n>=.999?e.hex:`rgba(${e.r},${e.g},${e.b},${n.toFixed(4).replace(/0+$/g,"").replace(/\.$/,"")})`}function Dn(e,t,n){return`${ne(t,n??1)??t.hex} ${Math.round(e*100)}%`}function St(e,t=!0){let n=[];return e.flipH&&n.push("scaleX(-1)"),e.flipV&&n.push("scaleY(-1)"),t&&e.rotation&&n.push(`rotate(${e.rotation}deg)`),n.length>0?n.join(" "):void 0}function jn(e){if(!e||e.kind==="none")return{background:void 0,"background-color":void 0};if(e.kind==="solid")return{"background-color":ne(e.color,e.opacity??1)};let t=e.gradientStops??[];if(t.length===0)return{"background-color":ne(e.color,e.opacity??1)};let n=t.map(o=>Dn(o.position,o.color,(o.opacity??1)*(e.opacity??1))).join(", ");return{background:e.gradientShape==="circle"?`radial-gradient(ellipse at center, ${n})`:`linear-gradient(${e.gradientAngle??0}deg, ${n})`}}function Un(e){return!e.line||e.line.kind==="none"?{border:void 0}:{border:`${Math.max(.5,e.line.width??1)}px solid ${ne(e.line.color,e.line.opacity??1)??"#000"}`}}function D(e,t=e.bounds,n=!0,r){let o=I(t?.x),i=I(t?.y),a=I(t?.width),s=I(t?.height),c=St(e,n);return re({position:"absolute",left:o!==void 0?`${o}px`:void 0,top:i!==void 0?`${i}px`:void 0,width:a!==void 0?`${a}px`:void 0,height:s!==void 0?`${s}px`:void 0,"z-index":r??(e.isBackground?0:e.zIndex+100),transform:c,"transform-origin":c?"center center":void 0,overflow:"visible","box-sizing":"border-box"})}function $t(e,t){let n=St(e,!1);return re({position:"absolute",left:`${t.xPx}px`,top:`${t.yPx}px`,width:`${t.widthPx}px`,height:`${t.heightPx}px`,"z-index":e.isBackground?0:e.zIndex+100,transform:n,"transform-origin":n?"center center":void 0,overflow:"visible","box-sizing":"border-box"})}function Wn(e,t){return t?$t(e,t):D(e)}function vt(e){return e.typeName==="ellipse"}function Vn(e){return e.typeName==="roundRect"}function ye(e){let t=vt(e)||Vn(e)?"9999px":void 0;return re({...jn(e.fill),...Un(e),"border-radius":t})}function Gn(e,t,n){let r=I(e.leftMargin)??0,o=I(e.indent)??0;return re({margin:"0","margin-top":n===0?"0":`${Math.max(0,t*.22)}px`,"margin-left":r?`${r}px`:void 0,"text-indent":o?`${o}px`:void 0,"text-align":e.alignment,"line-height":1.15})}function Xe(e){if(!e.text||!e.bounds)return{baseFontPx:16,treatAsDisplayTitle:!1};let t=Math.max(12,I(e.bounds.width)??12),n=Math.max(12,I(e.bounds.height)??12),r=e.text.paragraphs.filter(b=>b.text.trim().length>0),o=Math.max(1,r.length),i=r.map(b=>b.text.replace(/\s+/g,"")),a=Math.max(1,...i.map(b=>b.length)),s=i.join("").match(/[\u3040-\u30ff\u3400-\u9fff\uf900-\ufaff]/g)?.length??0,c=i.join("").length,d=c>0&&s/c>.4?1.55:1.1,l=Math.max(0,...r.flatMap(b=>b.runs.map(y=>(y.style.fontSize??0)*4/3))),u=t/Math.max(1.4,a*d),f=n/Math.max(1.3,o*1.3),p=Math.max(12,Math.min(u,f)),g=o>1&&n>=120&&l>0&&l<24;return{baseFontPx:p,treatAsDisplayTitle:g}}function Ct(e,t){let n=Xe(e);return e.text&&n.treatAsDisplayTitle?t===0?n.baseFontPx:Math.max(18,n.baseFontPx*.52):n.baseFontPx}function _n(e,t,n,r,o){let i=zn(e,t.fontIndex??t.ansiFontIndex??t.asianFontIndex),a=t.fontSize!==void 0?t.fontSize*4/3:void 0,c=Xe(r).treatAsDisplayTitle?Ct(r,o):Math.max(10,a??n);return re({"font-family":i?`'${i.replace(/'/g,"\\'")}'`:"'Microsoft YaHei','PingFang SC','Hiragino Sans GB','Noto Sans CJK SC','Arial',sans-serif","font-size":`${c}px`,"font-weight":t.bold?"700":void 0,"font-style":t.italic?"italic":void 0,"text-decoration":t.underline?"underline":t.strike?"line-through":void 0,color:t.color?.hex,"text-shadow":t.shadow?"1px 1px 2px rgba(0,0,0,.25)":void 0,"vertical-align":t.superscript&&t.superscript>0?"super":void 0})}function yt(e,t,n,r){if(!e.text)return"";let o=e.text.paragraphs.map((f,p)=>{let g=f.style.bullet?.enabled?`${_e(f.style.bullet.char??"•")} `:"",b=Ct(e,p),y=f.runs.map(B=>`<span style="${_n(t,B.style,b,e,p)}">${_e(B.text)}</span>`).join("");return`<p style="${Gn(f.style,b,p)}">${g}${y||" "}</p>`}).join(""),i=Xe(e),a=Ie(e.textBox?.leftInset)??(i.treatAsDisplayTitle?8:6),s=Ie(e.textBox?.topInset)??(i.treatAsDisplayTitle?8:4),c=Ie(e.textBox?.rightInset)??(i.treatAsDisplayTitle?8:6),d=Ie(e.textBox?.bottomInset)??(i.treatAsDisplayTitle?8:4),l=e.textBox?.anchorText,u=l===1?"center":l!==void 0&&l>=2?"flex-end":"flex-start";return`<div class="ppt-viewer-text" style="${xe(Wn(e,r),n?ye(e):void 0,re({color:"#111827",display:"flex","flex-direction":"column","justify-content":u,padding:`${s}px ${c}px ${d}px ${a}px`,"box-sizing":"border-box",overflow:"hidden"}))}">${o}</div>`}function Xn(e){let t=e.kind==="picture"?e.picture:void 0,n=Hn(t);return n?`<div class="ppt-viewer-picture" style="${xe(D(e),ye(e),"overflow:hidden")}"><img src="${n}" alt="" style="width:100%;height:100%;object-fit:cover;display:block"/></div>`:`<div class="ppt-viewer-picture ppt-viewer-picture--placeholder" style="${xe(D(e),ye(e),"display:flex","align-items:center","justify-content:center","font-size:12px","color:#667085","background:#f6f7f9")}">${_e(t?.type??e.typeName)}</div>`}function Ae(e,t){if(!e||e.kind==="none")return{defs:"",fill:"none"};if(e.kind==="solid")return{defs:"",fill:ne(e.color,e.opacity??1)??"none"};let n=e.gradientStops??[];if(n.length===0)return{defs:"",fill:ne(e.color,e.opacity??1)??"none"};let r=n.map(i=>`<stop offset="${Math.round(i.position*100)}%" stop-color="${i.color.hex}" stop-opacity="${kt((i.opacity??1)*(e.opacity??1),0,1)}"/>`).join("");return{defs:`<defs>${e.gradientShape==="circle"?`<radialGradient id="${t}" cx="50%" cy="50%" r="50%">${r}</radialGradient>`:`<linearGradient id="${t}" gradientTransform="rotate(${e.gradientAngle??0})">${r}</linearGradient>`}</defs>`,fill:`url(#${t})`}}function be(e){return!e.line||e.line.kind==="none"?{stroke:"none",strokeWidth:0}:{stroke:ne(e.line.color,e.line.opacity??1)??"none",strokeWidth:Math.max(.5,e.line.width??1)}}function qn(e){let t=e.bounds??{x:0,y:0,width:0,height:0},n={...t,width:Math.max(t.width,Ge),height:Math.max(t.height,Ge)},r=Math.max(1,I(n.width)??1),o=Math.max(1,I(n.height)??1),{stroke:i,strokeWidth:a}=be(e),s=0,c=o,d=r,l=0;return(I(t.height)??0)<=1&&(I(t.width)??0)>1?(s=0,c=o/2,d=r,l=o/2):(I(t.width)??0)<=1&&(I(t.height)??0)>1&&(s=r/2,c=0,d=r/2,l=o),`<div class="ppt-viewer-line" style="${D(e,n)}"><svg viewBox="0 0 ${r} ${o}" preserveAspectRatio="none" style="width:100%;height:100%;display:block;overflow:visible"><line x1="${s}" y1="${c}" x2="${d}" y2="${l}" stroke="${i}" stroke-width="${a}" stroke-linecap="round"/></svg></div>`}function Zn(e){let t=Math.max(1,I(e.bounds?.width)??1),n=Math.max(1,I(e.bounds?.height)??1),r=Ae(e.fill,`ppt-fill-${e.id}`),o=be(e);return`<div class="ppt-viewer-shape" style="${D(e)}"><svg viewBox="0 0 ${t} ${n}" preserveAspectRatio="none" style="width:100%;height:100%;display:block;overflow:visible">${r.defs}<ellipse cx="${t/2}" cy="${n/2}" rx="${t/2}" ry="${n/2}" fill="${r.fill}" stroke="${o.stroke}" stroke-width="${o.strokeWidth}"/></svg></div>`}function Yn(e){if(e.vertices.length===0||e.segments.length===0)return;let t=e.vertices.map(u=>u.x),n=e.vertices.map(u=>u.y),r=e.adjustLeft??Math.min(...t),o=e.adjustTop??Math.min(...n),i=e.adjustRight??Math.max(...t),a=e.adjustBottom??Math.max(...n),s=0,c=[];for(let u of e.segments)if(u.command==="moveTo"){let f=e.vertices[s];if(!f)break;s+=1,c.push(`M ${f.x} ${f.y}`)}else if(u.command==="lineTo"){let f=e.vertices[s];if(!f)break;s+=1,c.push(`L ${f.x} ${f.y}`)}else if(u.command==="curveTo"){let f=e.vertices[s],p=e.vertices[s+1],g=e.vertices[s+2];if(!f||!p||!g)break;s+=3,c.push(`C ${f.x} ${f.y} ${p.x} ${p.y} ${g.x} ${g.y}`)}else if(u.command==="close")c.push("Z");else if(u.command==="end")break;if(c.length===0)return;let d=Math.max(1,i-r),l=Math.max(1,a-o);return{d:c.join(" "),viewBox:`${r} ${o} ${d} ${l}`}}function Jn(e){let t=e.customGeometry;if(!t)return"";let n=Yn(t);if(!n)return"";let r=Ae(e.fill,`ppt-fill-${e.id}`),o=be(e);return`<div class="ppt-viewer-shape" style="${D(e)}"><svg viewBox="${n.viewBox}" preserveAspectRatio="none" style="width:100%;height:100%;display:block;overflow:visible">${r.defs}<path d="${n.d}" fill="${r.fill}" fill-rule="evenodd" stroke="${o.stroke}" stroke-width="${o.strokeWidth}"/></svg></div>`}function Kn(e){let t=Ae(e.fill,`ppt-fill-${e.id}`),n=be(e);return`<div class="ppt-viewer-shape" style="${D(e)}"><svg viewBox="0 0 100 100" preserveAspectRatio="none" style="width:100%;height:100%;display:block;overflow:visible">${t.defs}<polygon points="0,18 40,18 100,50 40,82 0,82 42,50" fill="${t.fill}" stroke="${n.stroke}" stroke-width="${n.strokeWidth}"/></svg></div>`}function Qn(e){let t=Ae(e.fill,`ppt-fill-${e.id}`),n=be(e);return`<div class="ppt-viewer-shape" style="${D(e)}"><svg viewBox="0 0 100 100" preserveAspectRatio="none" style="width:100%;height:100%;display:block;overflow:visible">${t.defs}<polygon points="50,0 100,100 0,100" fill="${t.fill}" stroke="${n.stroke}" stroke-width="${n.strokeWidth}"/></svg></div>`}function bt(e){return(!e.fill||e.fill.kind==="none")&&(!e.line||e.line.kind==="none")&&!e.customGeometry?"":e.isBackground?`<div class="ppt-viewer-shape ppt-viewer-shape--background" style="${xe(D(e),ye(e))}"></div>`:e.customGeometry?Jn(e):e.typeName==="line"?qn(e):e.typeName==="chevron"?Kn(e):e.typeName==="triangle"?Qn(e):vt(e)?Zn(e):`<div class="ppt-viewer-shape" style="${xe(D(e),ye(e))}"></div>`}function Tt(e,t){let n=e.masterRef?.masterPersistIdRef;if(n===void 0)return t.masters[0];let r=t.masters.find(o=>o.persistId===n);if(r)return r;if((n&2147483648)!==0){let o=n&2147483647;return t.masters[o]??t.masters[0]}return t.masters[0]}function er(e,t){return e.colorScheme.length>0?e.colorScheme:Tt(e,t)?.colorScheme??[]}async function Pt(e,t,n){let r=I(e.bounds?.width),o=I(e.bounds?.height),i=Nn(e),a=r&&o?await xt(e,r,o,n):void 0,s=a?.svg,c=a?.frame?$t(e,a.frame):D(e,e.bounds,!1);if(e.kind==="group"){let d=await Promise.all(e.children.map(u=>Pt(u,t,n)));return`${s?`<div class="ppt-viewer-shape ppt-viewer-shape--metro" style="${c}">${s}</div>`:e.metroBlob&&!i?"":bt(e)}${d.join("")}`}if(s){let d=`<div class="ppt-viewer-shape ppt-viewer-shape--metro" style="${c}">${s}</div>`;return e.text?`${d}${yt(e,t,!1,a?.frame)}`:d}if(e.kind==="picture"){let d=e.picture;if(e.metroBlob&&!i&&!d?.data&&!d?.base64)return""}return e.metroBlob&&!i&&!e.text&&e.kind!=="picture"&&!e.isBackground?"":e.kind==="picture"?Xn(e):e.text?yt(e,t,!0,a?.frame):bt(e)}function tr(e){return{width:I(e.metadata.slideSize.width)??960,height:I(e.metadata.slideSize.height)??540}}function wt(e){let t=[],n=[];return e.forEach(r=>{r.isBackground?t.push(r):n.push(r)}),{backgrounds:t,foregrounds:n}}function nr(e,t){let n=Tt(e,t),r=n?wt(n.shapes):{backgrounds:[],foregrounds:[]},o=wt(e.shapes);return{backgrounds:[...r.backgrounds,...o.backgrounds],foregrounds:[...r.foregrounds,...o.foregrounds]}}async function rr(e,t){let n=tr(t),r=er(e,t),o=nr(e,t),i=await Promise.all([...o.backgrounds,...o.foregrounds].map(s=>Pt(s,t,r))),a=o.backgrounds.length>0?"transparent":"#ffffff";return[`<section class="ppt-viewer-slide" data-slide-index="${e.index}" style="${re({width:`${n.width}px`,height:`${n.height}px`,position:"relative",background:a})}">`,i.join(""),"</section>"].join("")}function or(){return[".ppt-viewer{color-scheme:light;display:flex;flex-direction:column;gap:20px;align-items:flex-start;padding:16px;background:#f3f4f7;color:#1f2937;box-sizing:border-box}",".ppt-viewer,.ppt-viewer *{box-sizing:border-box}",".ppt-viewer-slide{background:transparent;border:1px solid #e4e7ec;border-radius:12px;box-shadow:0 10px 28px rgba(15,23,42,.08),0 2px 8px rgba(15,23,42,.06);overflow:hidden}",".ppt-viewer-slide p{margin:0;white-space:pre-wrap;word-break:break-word}",".ppt-viewer-text{color:inherit}",".ppt-viewer-picture img{max-width:100%;max-height:100%}",".ppt-viewer-picture--placeholder{color:#667085;background:#f5f7fa}",".ppt-viewer-metro{pointer-events:none}"].join("")}async function It(e,t={}){let n=t.className??"ppt-viewer",r=await Promise.all(e.slides.map(async o=>{let i=await rr(o,e);return o.html=i,i}));return e.html=`${t.emitStyleTag===!1?"":`<style>${or()}</style>`}<div class="${n}">${r.join("")}</div>`,e.html}var ir=new Uint8Array([208,207,17,224,161,177,26,225]);function sr(e,t){if(e.length<t.length)return!1;for(let n=0;n<t.length;n+=1)if(e[n]!==t[n])return!1;return!0}function ar(e){switch(e){case 0:return"empty";case 1:return"storage";case 2:return"stream";case 3:return"lockbytes";case 4:return"property";case 5:return"root";default:return"empty"}}function cr(e){let t=Number(e);if(!Number.isSafeInteger(t))throw new Error(`CFB stream too large for safe integer conversion: ${e.toString()}`);return t}function le(e,t){return(t+1)*e.sectorSize}function Be(e,t){if(t===4294967294||t===4294967295)return[];let n=[],r=new Set,o=t;for(;o!==4294967294&&o!==4294967295;){if(o<0||o>=e.length)throw new Error(`Invalid FAT sector index ${o}`);if(r.has(o))throw new Error(`Loop detected while walking CFB sector chain at sector ${o}`);r.add(o),n.push(o),o=e[o]??4294967294}return n}function At(e){let t=at(e),n=new N(t);if(n.ensure(0,512),!sr(n.slice(0,8),ir))throw new Error("Invalid compound file signature");let r=n.u16(26),o=n.u16(24),i=n.u16(30),a=n.u16(32),s={majorVersion:r,minorVersion:o,sectorShift:i,miniSectorShift:a,numDirectorySectors:n.u32(40),numFatSectors:n.u32(44),firstDirectorySector:n.u32(48),miniStreamCutoffSize:n.u32(56),firstMiniFatSector:n.u32(60),numMiniFatSectors:n.u32(64),firstDifatSector:n.u32(68),numDifatSectors:n.u32(72),sectorSize:1<<i,miniSectorSize:1<<a},c=[];for(let x=0;x<109;x+=1){let k=n.u32(76+x*4);k!==4294967295&&c.push(k)}let d=s.firstDifatSector;for(let x=0;x<s.numDifatSectors&&d!==4294967294;x+=1){let k=le(s,d);for(let $=0;$<s.sectorSize/4-1;$+=1){let S=n.u32(k+$*4);S!==4294967295&&c.push(S)}d=n.u32(k+s.sectorSize-4)}let l=[];for(let x of c.slice(0,s.numFatSectors)){let k=le(s,x);for(let $=0;$<s.sectorSize/4;$+=1)l.push(n.u32(k+$*4))}let u=Be(l,s.firstDirectorySector),f=new Uint8Array(u.length*s.sectorSize);u.forEach((x,k)=>{let $=le(s,x);f.set(n.bytesAt($,s.sectorSize),k*s.sectorSize)});let p=new N(f),g=[];for(let x=0;x+128<=p.length;x+=128){let k=p.u16(x+64),$=Math.max(0,Math.min(k-2,64)),S=p.nullTerminatedUtf16(x,$),z=ar(p.u8(x+66)),T={id:g.length,name:S,type:z,colorFlag:p.u8(x+67),leftSiblingId:p.u32(x+68),rightSiblingId:p.u32(x+72),childId:p.u32(x+76),startSector:p.u32(x+116),size:cr(p.u64(x+120))};g.push(T)}let b=g.find(x=>x.type==="root");if(!b)throw new Error("Compound file does not contain a root entry");let y=Be(l,b.startSector),B=new Uint8Array(y.length*s.sectorSize);y.forEach((x,k)=>{let $=le(s,x);B.set(n.bytesAt($,s.sectorSize),k*s.sectorSize)});let F=[];Be(l,s.firstMiniFatSector).forEach(x=>{let k=le(s,x);for(let $=0;$<s.sectorSize/4;$+=1)F.push(n.u32(k+$*4))});function j(x){let k=Be(l,x.startSector),$=new Uint8Array(k.length*s.sectorSize);return k.forEach((S,z)=>{let T=le(s,S);$.set(n.bytesAt(T,s.sectorSize),z*s.sectorSize)}),$.subarray(0,x.size)}function E(x){let k=[],$=new Set,S=x.startSector;for(;S!==4294967294&&S!==4294967295;){if(S<0||S>=F.length)throw new Error(`Invalid mini FAT sector index ${S}`);if($.has(S))throw new Error(`Loop detected while walking mini FAT chain at sector ${S}`);$.add(S);let J=S*s.miniSectorSize;k.push(B.subarray(J,J+s.miniSectorSize)),S=F[S]??4294967294}let z=k.length*s.miniSectorSize,T=new Uint8Array(z),O=0;for(let J of k)T.set(J,O),O+=J.length;return T.subarray(0,x.size)}let M=new Map;return g.forEach(x=>{x.name&&M.set(x.name,x)}),{header:s,entries:g,getEntry(x){return M.get(x)},readStream(x){let k=M.get(x);if(!k)throw new Error(`Stream not found: ${x}`);if(k.type!=="stream")throw new Error(`Entry is not a stream: ${x}`);return k.size<s.miniStreamCutoffSize?E(k):j(k)}}}function Bt(e){let t=new N(e),n=t.u32(8),r=t.u32(12),o=t.u32(16),i=t.u16(20),a=t.u16(22),s=t.u8(24),c=t.u8(25),d=t.u16(26),l=t.nullTerminatedLatin1(28,i),u=28+i,f=t.u32(u),p=u+4,g=Math.min(i*2,Math.max(0,t.length-p)),b=g>0?t.nullTerminatedUtf16(p,g):void 0,y={size:n,headerToken:r,offsetToCurrentEdit:o,lenUserName:i,docFileVersion:a,majorVersion:s,minorVersion:c,unused:d,ansiUserName:l,relVersion:f};return b&&b.length>0&&(y.unicodeUserName=b),y}function Et(e,t){e.currentUser=t.unicodeUserName??t.ansiUserName,e.docFileVersion=t.docFileVersion,e.majorVersion=t.majorVersion,e.minorVersion=t.minorVersion,e.headerToken=t.headerToken}var dr={1e3:"Document",1001:"DocumentAtom",1002:"EndDocument",1006:"Slide",1007:"SlideAtom",1008:"Notes",1009:"NotesAtom",1010:"Environment",1011:"SlidePersistAtom",1015:"SSlideLayoutAtom",1016:"MainMaster",1017:"SSSlideInfoAtom",1018:"SlideViewInfo",1019:"GuideAtom",1020:"ViewInfo",1021:"ViewInfoAtom",1022:"SlideViewInfoAtom",1023:"VBAInfo",1024:"VBAInfoAtom",1025:"SSDocInfoAtom",1026:"Summary",1030:"DocRoutingSlip",1031:"OutlineViewInfo",1032:"SorterViewInfo",1033:"ExObjList",1034:"ExObjListAtom",1035:"PPDrawingGroup",1036:"PPDrawing",1040:"NamedShows",1041:"NamedShow",1042:"NamedShowSlides",1044:"SheetProperties",1052:"CompositeMasterId",1054:"RoundTripContentMasterInfo12",1055:"RoundTripShapeId12",1056:"RoundTripHFPlaceholder12",1058:"RoundTripContentMasterId",1059:"RoundTripOArtTextStyles12",1062:"RoundTripShapeCheckSumForCustomLayouts12",1063:"RoundTripNotesMasterTextStyles12",1064:"RoundTripCustomTableStyles12",2e3:"List",2005:"FontCollection",2019:"BookmarkCollection",2020:"SoundCollection",2021:"SoundCollAtom",2022:"Sound",2023:"SoundData",2025:"BookmarkSeedAtom",2032:"ColorSchemeAtom",3009:"ExObjRefAtom",3011:"OEPlaceholderAtom",3024:"GPopublicintAtom",3031:"GRatioAtom",3998:"OutlineTextRefAtom",3999:"TextHeaderAtom",4e3:"TextCharsAtom",4001:"StyleTextPropAtom",4002:"MasterTextPropAtom",4003:"TxMasterStyleAtom",4004:"TxCFStyleAtom",4005:"TxPFStyleAtom",4006:"TextRulerAtom",4007:"TextBookmarkAtom",4008:"TextBytesAtom",4009:"TxSIStyleAtom",4010:"TextSpecInfoAtom",4011:"DefaultRulerAtom",4012:"StyleTextProp9Atom",4023:"FontEntityAtom",4024:"FontEmbeddedData",4026:"CString",4033:"MetaFile",4035:"ExOleObjAtom",4040:"SrKinsoku",4041:"HandOut",4044:"ExEmbed",4045:"ExEmbedAtom",4046:"ExLink",4048:"BookmarkEntityAtom",4049:"ExLinkAtom",4050:"SrKinsokuAtom",4051:"ExHyperlinkAtom",4055:"ExHyperlink",4056:"SlideNumberMCAtom",4057:"HeadersFooters",4058:"HeadersFootersAtom",4063:"TxInteractiveInfoAtom",4066:"CharFormatAtom",4067:"ParaFormatAtom",4071:"RecolorInfoAtom",4074:"ExQuickTimeMovie",4075:"ExQuickTimeMovieData",4078:"ExControl",4080:"SlideListWithText",4081:"AnimationInfoAtom",4082:"InteractiveInfo",4083:"InteractiveInfoAtom",4085:"UserEditAtom",4086:"CurrentUserAtom",4087:"DateTimeMCAtom",4088:"GenericDateMCAtom",4090:"FooterMCAtom",4091:"ExControlAtom",4100:"ExMediaAtom",4101:"ExVideoContainer",4102:"ExAviMovie",4103:"ExMCIMovie",4109:"ExMIDIAudio",4110:"ExCDAudio",4111:"ExWAVAudioEmbedded",4112:"ExWAVAudioLink",4113:"ExOleObjStg",4114:"ExCDAudioAtom",4115:"ExWAVAudioEmbeddedAtom",4116:"AnimationInfo",4117:"RTFDateTimeMCAtom",5e3:"ProgTags",5001:"ProgStringTag",5002:"ProgBinaryTag",5003:"BinaryTagData",6e3:"PrpublicintOptions",6001:"PersistPtrFullBlock",6002:"PersistPtrIncrementalBlock",10001:"GScalingAtom",10002:"GRColorAtom",12e3:"Comment2000",12001:"Comment2000Atom",12004:"Comment2000Summary",12005:"Comment2000SummaryAtom",12052:"DocumentEncryptionAtom",61440:"OfficeArtDggContainer",61441:"OfficeArtBStoreContainer",61442:"OfficeArtDgContainer",61443:"OfficeArtSpgrContainer",61444:"OfficeArtSpContainer",61445:"OfficeArtSolverContainer",61446:"OfficeArtFDGGBlock",61447:"OfficeArtFBSE",61448:"OfficeArtFDG",61449:"OfficeArtFSPGR",61450:"OfficeArtFSP",61451:"OfficeArtFOPT",61453:"OfficeArtClientTextbox",61456:"OfficeArtClientAnchor",61457:"OfficeArtClientData",61463:"OfficeArtSplitMenuColorContainer",61466:"OfficeArtBlipEMF",61467:"OfficeArtBlipWMF",61468:"OfficeArtBlipPICT",61469:"OfficeArtBlipJPEG",61470:"OfficeArtBlipPNG",61471:"OfficeArtBlipDIB",61481:"OfficeArtSecondaryFOPT",61722:"OfficeArtRegroupItems",61726:"OfficeArtColorMRU"};function Le(e){return dr[e]??`UnknownRecord(${e})`}var lr={0:"notPrimitive",1:"rect",2:"roundRect",3:"ellipse",4:"diamond",5:"triangle",6:"diamond",7:"parallelogram",8:"trapezoid",10:"pentagon",11:"hexagon",13:"octagon",17:"star5",20:"line",23:"seal",24:"star24",25:"star32",26:"textBox",34:"plaque",35:"homePlate",38:"chevron",41:"blockArc",42:"donut",44:"rightArrow",51:"leftRightArrow",55:"chevron",56:"cube",57:"can",62:"textSimple",67:"flowChartProcess",68:"flowChartDecision",73:"flowChartConnector",75:"pictureFrame",96:"wedgeRoundRectCallout",109:"actionButtonHome",110:"actionButtonHelp",135:"hostControl",193:"textPlainText",194:"textStop",202:"textBox2"};function Lt(e){return lr[e]??`shape-${e}`}var ur={4:"rotation",127:"DFF_Prop_lTxid",128:"text.lTxid",129:"text.dxTextLeft",130:"text.dyTextTop",131:"text.dxTextRight",132:"text.dyTextBottom",133:"text.wrapText",135:"text.anchorText",136:"text.textFlow",260:"blip.index",261:"blip.name",262:"blip.flags",320:"geometry.geoLeft",321:"geometry.geoTop",322:"geometry.geoRight",323:"geometry.geoBottom",324:"geometry.shapePath",325:"geometry.pVertices",326:"geometry.pSegmentInfo",327:"geometry.adjustValue",385:"fill.fillColor",386:"fill.fillOpacity",387:"fill.fillBackColor",388:"fill.fillCrMod",395:"fill.fillAngle",447:"shadowColor",448:"line.lineColor",449:"line.lineOpacity",450:"line.lineBackColor",451:"line.lineCrMod",459:"line.lineWidth",511:"lineStyleFlags",512:"fill.fillType",513:"shadow.shadowColor",515:"shadow.shadowOpacity",524:"fillShadePreset",768:"shapeName",769:"shapeDescription",896:"groupShapeFlags",937:"metro.blob",959:"wzName",1024:"pictureId"};function Mt(e){return ur[e]??`prop-${e}`}var ue={group:1,child:2,patriarch:4,deleted:8,ole:16,haveMaster:32,flipH:64,flipV:128,connector:256,haveAnchor:512,background:1024,haveShapeType:2048};function L(e,t){e.ensure(t,8);let n=e.u16(t),r=n&15,o=n>>>4,i=e.u16(t+2),a=e.u32(t+4),s=t+8+a;if(s>e.length)throw new Error(`Record ${i} overruns stream at offset ${t}`);return{offset:t,version:r,instance:o,type:i,length:a,end:s,bodyOffset:t+8,isContainer:r===15}}function C(e,t,n){let r=[],o=t;for(;o+8<=n;){let i=L(e,o);r.push(i),o=i.end}return r}function qe(e,t,n){let r=[],o=t;for(;o+8<=n;){let i=L(e,o),a={offset:i.offset,end:i.end,type:i.type,typeName:Le(i.type),version:i.version,instance:i.instance,length:i.length,isContainer:i.isContainer};i.isContainer&&(a.children=qe(e,i.bodyOffset,i.end)),r.push(a),o=i.end}return r}function Ze(e,t,n){return C(e,t.bodyOffset,t.end).find(r=>r.type===n)}function Rt(e,t){if(t.type!==4026)throw new Error(`Expected CString record, got ${t.type}`);return e.nullTerminatedUtf16(t.bodyOffset,t.length)}var fr=[{kind:"paragraph",name:"paragraphFlags",size:"bitmask",mask:15},{kind:"paragraph",name:"bulletChar",size:2,mask:128},{kind:"paragraph",name:"bulletFont",size:2,mask:16},{kind:"paragraph",name:"bulletSize",size:2,mask:64},{kind:"paragraph",name:"bulletColor",size:4,mask:32},{kind:"paragraph",name:"alignment",size:2,mask:2048},{kind:"paragraph",name:"lineSpacing",size:2,mask:4096},{kind:"paragraph",name:"spaceBefore",size:2,mask:8192},{kind:"paragraph",name:"spaceAfter",size:2,mask:16384},{kind:"paragraph",name:"leftMargin",size:2,mask:256},{kind:"paragraph",name:"indent",size:2,mask:1024},{kind:"paragraph",name:"defaultTabSize",size:2,mask:32768},{kind:"paragraph",name:"tabStops",size:"tabStops",mask:1048576},{kind:"paragraph",name:"fontAlign",size:2,mask:262144},{kind:"paragraph",name:"wrapFlags",size:"bitmask",mask:524288},{kind:"paragraph",name:"textDirection",size:2,mask:2097152},{kind:"paragraph",name:"bulletBlip",size:0,mask:8388608},{kind:"paragraph",name:"bulletScheme",size:0,mask:16777216},{kind:"paragraph",name:"hasBulletScheme",size:0,mask:33554432}],pr=[{kind:"character",name:"pp10ext",size:0,mask:1048576},{kind:"character",name:"newAsianFontIndex",size:0,mask:16777216},{kind:"character",name:"csFontIndex",size:0,mask:33554432},{kind:"character",name:"pp11ext",size:0,mask:67108864},{kind:"character",name:"charFlags",size:"bitmask",mask:65535},{kind:"character",name:"fontIndex",size:2,mask:65536},{kind:"character",name:"asianFontIndex",size:2,mask:2097152},{kind:"character",name:"ansiFontIndex",size:2,mask:4194304},{kind:"character",name:"symbolFontIndex",size:2,mask:8388608},{kind:"character",name:"fontSize",size:2,mask:131072},{kind:"character",name:"fontColor",size:4,mask:262144},{kind:"character",name:"superscript",size:2,mask:524288}];function mr(e){return e.replace(/\r\n/g,`
`).replace(/[\u000b\r]/g,`
`)}function hr(e,t,n){return e.slice(t,n)}function Ft(e){let t=e&255,n=e>>>8&255,r=e>>>16&255;return{r:t,g:n,b:r,hex:`#${[t,n,r].map(o=>o.toString(16).padStart(2,"0")).join("")}`,source:"rgb"}}function gr(e){switch(e){case 0:return"left";case 1:return"center";case 2:return"right";case 3:return"justify";case 4:return"distribute";default:return}}function xr(e){return String.fromCharCode(e&65535)}function yr(e,t){let n=(e&1)!==0,r=(e&2)!==0,o=(e&4)!==0,i=(e&8)!==0,a={enabled:n};t.bullet?.char!==void 0&&(a.char=t.bullet.char),r&&t.bullet?.fontIndex!==void 0&&(a.fontIndex=t.bullet.fontIndex),o&&t.bullet?.color!==void 0&&(a.color=t.bullet.color),i&&t.bullet?.size!==void 0&&(a.size=t.bullet.size),t.bullet=a}function br(e,t){t.wrapFlags=e}function wr(e,t){t.bold=(e&1)!==0,t.italic=(e&2)!==0,t.underline=(e&4)!==0,t.shadow=(e&16)!==0,t.strike=(e&256)!==0,t.emboss=(e&512)!==0}function kr(e,t){return{bytesRead:2+e.u16(t)*4}}function Sr(e,t,n,r){let o=Math.min(e.u32(t),n+1-r),i=e.i16(t+4),a=e.u32(t+6),s=t+10,c={rawMask:a,indentLevel:i};for(let d of fr){if((a&d.mask)===0||d.size===0)continue;if(d.size==="bitmask"){let u=e.u16(s);s+=2,d.name==="paragraphFlags"?yr(u,c):d.name==="wrapFlags"&&br(u,c);continue}if(d.size==="tabStops"){let u=kr(e,s);s+=u.bytesRead;continue}let l=d.size===2?e.i16(s):e.i32(s);switch(s+=d.size,d.name){case"bulletChar":c.bullet={...c.bullet??{enabled:!1},char:xr(l)};break;case"bulletFont":c.bullet={...c.bullet??{enabled:!1},fontIndex:l};break;case"bulletSize":c.bullet={...c.bullet??{enabled:!1},size:l};break;case"bulletColor":c.bullet={...c.bullet??{enabled:!1},color:Ft(l)};break;case"alignment":{let u=gr(l);u!==void 0&&(c.alignment=u);break}case"lineSpacing":c.lineSpacing=l;break;case"spaceBefore":c.spaceBefore=l;break;case"spaceAfter":c.spaceAfter=l;break;case"leftMargin":c.leftMargin=l;break;case"indent":c.indent=l;break;case"defaultTabSize":c.defaultTabSize=l;break;case"textDirection":c.textDirection=l;break;default:break}}return{run:{charsCovered:o,indentLevel:i,mask:a,style:c},bytesRead:s-t}}function $r(e,t,n,r){let o=Math.min(e.u32(t),n+1-r),i=e.u32(t+4),a=t+8,s={rawMask:i};for(let c of pr){if((i&c.mask)===0||c.size===0)continue;if(c.size==="bitmask"){let l=e.u16(a);a+=2,wr(l,s);continue}let d=c.size===2?e.i16(a):e.i32(a);switch(a+=c.size,c.name){case"fontIndex":s.fontIndex=d;break;case"asianFontIndex":s.asianFontIndex=d;break;case"ansiFontIndex":s.ansiFontIndex=d;break;case"symbolFontIndex":s.symbolFontIndex=d;break;case"fontSize":s.fontSize=d;break;case"fontColor":s.color=Ft(d);break;case"superscript":s.superscript=d;break;default:break}}return{run:{charsCovered:o,mask:i,style:s},bytesRead:a-t}}function vr(e,t,n){let r=[],o=[],i=[],a=n.length,s=t.bodyOffset,c=t.end,d=0;for(;s<c&&d<a;)try{let{run:u,bytesRead:f}=Sr(e,s,a,d);o.push(u),d+=u.charsCovered,s+=f,d===a&&s<c&&(d+=1)}catch(u){r.push(`Failed to parse paragraph style run at ${s}: ${String(u)}`);break}let l=0;for(;s<c&&l<a;)try{let{run:u,bytesRead:f}=$r(e,s,a,l);i.push(u),l+=u.charsCovered,s+=f,l===a&&s<c&&(l+=1)}catch(u){r.push(`Failed to parse character style run at ${s}: ${String(u)}`);break}return{paragraphRuns:o,characterRuns:i,warnings:r}}function Me(e,t){let n=0;for(let r of e){let o=n+r.charsCovered;if(t<o)return r.style;n=o}return e.length>0?e[e.length-1].style:{}}function Ot(e,t,n,r){let o=[],i=n;for(;i<r;){let a=Me(t,i),s=i+1;for(;s<r;){let c=Me(t,s);if(JSON.stringify(c)!==JSON.stringify(a))break;s+=1}o.push({start:i,end:s,text:hr(e,i,s),style:a}),i=s}return o.length===0&&o.push({start:n,end:r,text:"",style:{}}),o}function Cr(e,t,n){let r=mr(e),o=[],i=0,a=0;for(let s=0;s<=r.length;s+=1){if(!(s===r.length||r.charCodeAt(s)===10))continue;let d=r.slice(a,s),l=Me(t,i),u=i+d.length;o.push({start:i,end:u,text:d,style:l,runs:Ot(e,n,i,u)}),i=u+1,a=s+1}return o.length===0&&o.push({start:0,end:e.length,text:e,style:Me(t,0),runs:Ot(e,n,0,e.length)}),o}function Re(e,t,n){let r=e[n];if(!r||r.type!==3999)return;let o=e[n+1];if(!o||o.type!==4e3&&o.type!==4008)return;let i=e[n+2],a=t.u32(r.bodyOffset),s=t.bytesAt(o.bodyOffset,o.length),c=o.type===4e3?ve(s):ct(s),d=2,l;if(i?.type===4001){let u=vr(t,i,c);l={rawText:c,headerType:a,paragraphs:Cr(c,u.paragraphRuns,u.characterRuns),styleWarnings:u.warnings},d+=1,e[n+3]?.type===4010&&(d+=1)}else l={rawText:c,headerType:a,paragraphs:[{start:0,end:c.length,text:c,style:{},runs:[{start:0,end:c.length,text:c,style:{}}]}],styleWarnings:[]};return{headerType:a,text:c,style:l,consumedRecords:d}}function Tr(e,t,n,r){return{x:e,y:t,width:Math.max(0,n-e),height:Math.max(0,r-t)}}function Je(e){return Tr(e.left,e.top,e.right,e.bottom)}function Pr(e,t,n){let r={r:e.r,g:e.g,b:e.b,hex:e.hex};return t!==void 0&&(r.source=t),e.a!==void 0&&(r.a=e.a),n!==void 0&&(r.schemeIndex=n),r}function zt(e){let t=e&255,n=e>>>8&255,r=e>>>16&255;return{r:t,g:n,b:r,hex:`#${[t,n,r].map(o=>o.toString(16).padStart(2,"0")).join("")}`,source:"rgb"}}function Ir(e,t=[]){if((e>>>24&255&8)!==0){let r=e&255,o=t.find(i=>i.index===r)?.color;if(o)return Pr(o,"scheme",r)}return zt(e)}function Ar(e){return e/65536}function Br(e,t,n){let r=t.instance,o=[],i=t.bodyOffset,a=t.bodyOffset+r*6;for(let s=0;s<r;s+=1){let c=e.u16(i),d=c&16383,l=(c&16384)!==0,u=(c&32768)!==0,f=e.u32(i+2);i+=6;let p;u&&(p=e.bytesAt(a,f),a+=f);let g;[385,387,448,513].includes(d)?g=Ir(f,n):d===4?g=Ar(f):[261,768,769].includes(d)&&p?g=ve(p).replace(/\u0000+$/g,""):d===937&&p&&p.length>=4&&p[0]===80&&p[1]===75&&p[2]===3&&p[3]===4?g="metroBlob":g=f;let b={id:d,name:Mt(d),value:f,isBlip:l,isComplex:u};p!==void 0&&(b.complexData=p),g!==void 0&&(b.decoded=g),o.push(b)}return o}function Y(e,t){return e.find(n=>n.id===t)}function Er(e,t){if(t.length===8){let n=e.i16(t.bodyOffset),r=e.i16(t.bodyOffset+2),o=e.i16(t.bodyOffset+4),i=e.i16(t.bodyOffset+6);return{left:r,top:n,right:o,bottom:i}}if(t.length===16){let n=e.i32(t.bodyOffset),r=e.i32(t.bodyOffset+4),o=e.i32(t.bodyOffset+8),i=e.i32(t.bodyOffset+12);return{left:r,top:n,right:o,bottom:i}}}function Lr(e,t){if(t.length===16)return{left:e.i32(t.bodyOffset),top:e.i32(t.bodyOffset+4),right:e.i32(t.bodyOffset+8),bottom:e.i32(t.bodyOffset+12)}}function Mr(e,t){let n=t.coordinateSpace.right-t.coordinateSpace.left,r=t.coordinateSpace.bottom-t.coordinateSpace.top;if(n===0||r===0)return Je(e);let o=t.bounds.width/n,i=t.bounds.height/r;return{x:t.bounds.x+(e.left-t.coordinateSpace.left)*o,y:t.bounds.y+(e.top-t.coordinateSpace.top)*i,width:Math.max(0,(e.right-e.left)*o),height:Math.max(0,(e.bottom-e.top)*i)}}function Rr(e,t){let n={};return t.length>=4&&(n.placeholderId=e.u32(t.bodyOffset)),t.length>=8&&(n.placementId=e.u32(t.bodyOffset+4)),n}function Ht(e,t){let n={};return t.length>=1&&(n.action=e.u8(t.bodyOffset)),t.length>=2&&(n.jump=e.u8(t.bodyOffset+1)),t.length>=8&&(n.hyperlinkId=e.u32(t.bodyOffset+4)),t.length>=12&&(n.soundId=e.u32(t.bodyOffset+8)),n}function Or(e,t){return e.find(n=>n.index===t)?.style}function Fr(e,t,n){let r=C(e,t.bodyOffset,t.end),o=r.find(c=>c.type===3998);if(o){let c=e.u32(o.bodyOffset),d={rawTextRef:c},l=Or(n,c);return l!==void 0&&(d.text=l),d}let i=Re(r,e,0),a=r.filter(c=>c.type===4082).map(c=>Ze(e,c,4083)).find(c=>!!c),s={};return i?.style!==void 0&&(s.text=i.style),a&&(s.interactive=Ht(e,a)),s}function zr(e,t,n){let r=C(e,t.bodyOffset,t.end),o=r.find(d=>d.type===3011),i=r.find(d=>d.type===3009),a=r.find(d=>d.type===4082),s=a?Ze(e,a,4083):void 0,c={};if(o&&(c.placeholder=Rr(e,o)),i){let d=e.u32(i.bodyOffset),l=n.get(d),u={exObjId:d,kind:l?.kind??"unknown"};l?.pictureIndex!==void 0&&(u.pictureIndex=l.pictureIndex),l?.targetName!==void 0&&(u.targetName=l.targetName),c.media=u}return s&&(c.interactive=Ht(e,s)),c}function Ye(e,t){let n=Y(e,t)?.decoded;return typeof n=="object"&&n!==null&&"hex"in n?n:void 0}function A(e,t){return Y(e,t)?.value}function Nt(e){if(e.length<6)return;let t=e[0]|e[1]<<8,n=e[4]|e[5]<<8;if(!(t<=0||n<=0))return{count:t,itemSize:n,dataOffset:6}}function Hr(e){let t=e?.complexData;if(!t)return[];let n=Nt(t);if(!n)return[];let r=[];for(let o=0;o<n.count;o+=1){let i=n.dataOffset+o*n.itemSize;if(i+8>t.length)break;let a=t[i]|t[i+1]<<8|t[i+2]<<16|t[i+3]<<24,s=t[i+4]|t[i+5]<<8|t[i+6]<<16|t[i+7]<<24;r.push({x:a,y:s})}return r}function Nr(e){let t=e?.complexData;if(!t)return[];let n=Nt(t);if(!n)return[];let r=[];for(let o=0;o<n.count;o+=1){let i=n.dataOffset+o*n.itemSize;if(i+2>t.length)break;let a=t[i]|t[i+1]<<8,s="unknown";a===16384?s="moveTo":a===1?s="lineTo":a===8193?s="curveTo":a===24577?s="close":a===32768&&(s="end"),r.push({command:s,raw:a})}return r}function Dr(e){let t=Hr(Y(e,325)),n=Nr(Y(e,326));if(t.length===0&&n.length===0)return;let r={vertices:t,segments:n},o=A(e,324);o!==void 0&&(r.shapePath=o);let i=A(e,320),a=A(e,321),s=A(e,322),c=A(e,323);return i!==void 0&&(r.adjustLeft=i),a!==void 0&&(r.adjustTop=a),s!==void 0&&(r.adjustRight=s),c!==void 0&&(r.adjustBottom=c),r}function jr(e){let t=A(e,128),n=A(e,129),r=A(e,130),o=A(e,131),i=A(e,132),a=A(e,133),s=A(e,135),c=A(e,136);if([t,n,r,o,i,a,s,c].every(l=>l===void 0))return;let d={};return t!==void 0&&(d.textId=t),n!==void 0&&(d.leftInset=n),r!==void 0&&(d.topInset=r),o!==void 0&&(d.rightInset=o),i!==void 0&&(d.bottomInset=i),a!==void 0&&(d.wrapText=a),s!==void 0&&(d.anchorText=s),c!==void 0&&(d.textFlow=c),d}function Dt(e){if(e!==void 0)return e<=0?0:$e(e/65536,0,1)}function jt(e,t){return t.some(n=>Y(e,n)!==void 0)}function Ur(e){if(!jt(e,[384,385,386,387]))return;let t=A(e,384),n=Ye(e,385),r=Dt(A(e,386))??1,o=Ye(e,387);if(!n&&!o)return{kind:"none",opacity:r};if(t===7&&n){let a={kind:"gradient",gradientShape:"circle",gradientStops:[{position:0,color:n,opacity:Math.min(1,Math.max(0,r>0?r:.35))},{position:1,color:n,opacity:0}],opacity:1,color:n};return o&&(a.backColor=o),a}if(r===0){let a={kind:"none",opacity:0};return n&&(a.color=n),o&&(a.backColor=o),a}if(t===4&&n&&o)return{kind:"gradient",gradientShape:"linear",gradientAngle:A(e,395)!==void 0?(A(e,395)??0)/65536:0,gradientStops:[{position:0,color:n},{position:1,color:o}],opacity:r,color:n,backColor:o};let i={kind:"solid",opacity:r};return n&&(i.color=n),o&&(i.backColor=o),i}function Wr(e){return Ur(e)??{kind:"none"}}function Vr(e){return[20,32,33,34,73].includes(e)}function Gr(e,t){if(!jt(t,[448,449,459]))return;let n=Ye(t,448),r=Dt(A(t,449)),o=A(t,459);if(!n)return Vr(e)&&o!==void 0&&o>0?{kind:"solid",width:$e(o/9525,0,64)}:{kind:"none"};if(r!==void 0&&r===0)return{kind:"none",opacity:0};let i={kind:"solid",color:n};return r!==void 0&&(i.opacity=r),o!==void 0&&(i.width=$e(o/9525,0,64)),i}function _r(e,t){return Gr(e,t)??{kind:"none"}}function Oe(e){let t=e.picture,n=e.base.text;if(t||e.base.typeId===75){let o={...e.base,kind:"picture"};return t!==void 0&&(o.picture=t),o}return n?{...e.base,kind:"text"}:{...e.base,kind:"shape"}}function ke(e,t,n){let r=C(t.reader,e.bodyOffset,e.end),o=0,i=0,a=0,s,c,d,l=[],u,f,p,g,b;for(let T of r)switch(T.type){case 61449:d={left:t.reader.i32(T.bodyOffset),top:t.reader.i32(T.bodyOffset+4),right:t.reader.i32(T.bodyOffset+8),bottom:t.reader.i32(T.bodyOffset+12)};break;case 61450:i=T.instance,o=t.reader.u32(T.bodyOffset),a=t.reader.u32(T.bodyOffset+4);break;case 61451:case 61481:case 61730:l=l.concat(Br(t.reader,T,t.themeColors));break;case 61456:s=Er(t.reader,T);break;case 61455:c=Lr(t.reader,T);break;case 61457:{let O=zr(t.reader,T,t.externalObjects);u=O.placeholder??u,f=O.media??f,b=O.interactive??b;break}case 61453:{let O=Fr(t.reader,T,t.textBlocks);p=O.text??p,g=O.rawTextRef??g,b=O.interactive??b;break}default:break}let y;c&&n?y=Mr(c,n):s&&(y=Je(s));let B=Y(l,260)?.value,F=B!==void 0?t.picturesByIndex.get(B):void 0,G=Y(l,4)?.decoded,j=typeof G=="number"?G:void 0,E=jr(l),M=Dr(l),x=Y(l,937)?.complexData,k=x?{bytes:x.slice()}:void 0,$=(a&ue.background)!==0,S={id:o,typeId:i,typeName:Lt(i),flags:a,flipH:(a&ue.flipH)!==0,flipV:(a&ue.flipV)!==0,zIndex:t.zCounter.value+=1,properties:l,fill:Wr(l),line:_r(i,l)};$&&(S.isBackground=!0),y!==void 0?S.bounds=y:$&&(S.bounds={x:t.slideBounds.x,y:t.slideBounds.y,width:t.slideBounds.width,height:t.slideBounds.height}),j!==void 0&&(S.rotation=j),E!==void 0&&(S.textBox=E),M!==void 0&&(S.customGeometry=M),u!==void 0&&(S.placeholder=u),f!==void 0&&(S.media=f),b!==void 0&&(S.interactive=b),p!==void 0&&(S.text=p),g!==void 0&&(S.rawTextRef=g),k!==void 0&&(S.metroBlob=k);let z={base:S};return F!==void 0&&(z.picture=F),d!==void 0&&(z.groupCoordinateSpace=d),z}function Ut(e,t,n){let r=C(t.reader,e.bodyOffset,e.end),o=r.find(l=>l.type===61444);if(!o)return{id:0,typeId:0,typeName:"group",flags:ue.group,zIndex:t.zCounter.value+=1,properties:[],kind:"group",children:[],fill:{kind:"none"},line:{kind:"none"}};let i=ke(o,t,n),a=i.groupCoordinateSpace&&i.base.bounds?{coordinateSpace:i.groupCoordinateSpace,bounds:i.base.bounds}:void 0,s=[],c=!1;for(let l of r){if(!c&&l.offset===o.offset){c=!0;continue}l.type===61444?s.push(Oe(ke(l,t,a))):l.type===61443&&s.push(Ut(l,t,a))}let d={...i.base,kind:"group",children:s};return i.groupCoordinateSpace!==void 0&&(d.groupBounds=Je(i.groupCoordinateSpace)),d}function Ke(e,t){if(!t||t.length<32)return[];let n=[];for(let r=0;r<8;r+=1){let o=e.u32(t.bodyOffset+r*4);n.push({index:r,color:zt(o)})}return n}function Wt(e,t){let n=new Map;if(!t)return n;let r=C(e,t.bodyOffset,t.end);for(let o of r){if(!o.isContainer)continue;let i,a;switch(o.type){case 4055:a="unknown";break;case 4044:case 4046:a="ole";break;case 4101:case 4102:case 4103:a="video";break;case 4078:a="control";break;default:a="unknown";break}let s=C(e,o.bodyOffset,o.end);for(let u of s)if([4051,4045,4049,4091,4100,4035].includes(u.type)&&u.length>=4){i=e.u32(u.bodyOffset);break}if(i===void 0)continue;let c=s.filter(u=>u.type===4026).map(u=>Rt(e,u)).filter(u=>u.length>0),d={id:i,kind:a},l=c.join(" | ");l.length>0&&(d.targetName=l),n.set(i,d)}return n}function Fe(e,t,n,r,o,i=[],a={x:0,y:0,width:0,height:0}){if(!t)return[];let s=new Map(r.map(p=>[p.bseIndex,p])),c=[],d={reader:e,textBlocks:n,picturesByIndex:s,externalObjects:o,themeColors:i,slideBounds:a,zCounter:{value:0}},u=C(e,t.bodyOffset,t.end).find(p=>p.type===61442);if(!u)return c;let f=C(e,u.bodyOffset,u.end);for(let p of f){if(p.type===61443){let g=C(e,p.bodyOffset,p.end),b=!1;if(g[0]?.type===61444){let y=ke(g[0],d);b=(y.base.flags&ue.group)!==0,b||c.push(Oe(y))}g.forEach((y,B)=>{if(!(B===0&&b)){if(y.type===61444){c.push(Oe(ke(y,d)));return}y.type===61443&&c.push(Ut(y,d))}});continue}p.type===61444&&c.push(Oe(ke(p,d)))}return c}function Xr(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}function qr(e){let t=[{magic:new Uint8Array([255,216,255]),type:"jpeg",mimeType:"image/jpeg"},{magic:new Uint8Array([137,80,78,71]),type:"png",mimeType:"image/png"},{magic:new Uint8Array([71,73,70,56]),type:"gif",mimeType:"image/gif"},{magic:new Uint8Array([66,77]),type:"bmp",mimeType:"image/bmp"}];for(let n=0;n<Math.min(e.length,64);n+=1)for(let r of t){if(n+r.magic.length>e.length)continue;let o=!0;for(let i=0;i<r.magic.length;i+=1)if(e[n+i]!==r.magic[i]){o=!1;break}if(o)return{offset:n,type:r.type,mimeType:r.mimeType}}return{offset:0,type:"unknown",mimeType:"application/octet-stream"}}function Zr(e){switch(e){case 61466:return{type:"emf",mimeType:"image/emf"};case 61467:return{type:"wmf",mimeType:"image/wmf"};case 61468:return{type:"pict",mimeType:"image/pict"};case 61469:return{type:"jpeg",mimeType:"image/jpeg"};case 61470:return{type:"png",mimeType:"image/png"};case 61471:return{type:"dib",mimeType:"image/bmp"};default:return{type:"unknown",mimeType:"application/octet-stream"}}}function Yr(e,t){let r=C(e,t.bodyOffset,t.end).find(i=>i.type===61440);if(!r)return[];let o=C(e,r.bodyOffset,r.end).find(i=>i.type===61441);return o?C(e,o.bodyOffset,o.end).filter(i=>i.type===61447).map((i,a)=>({index:a+1,typeCode:e.u8(i.bodyOffset),offset:e.u32(i.bodyOffset+28),size:e.u32(i.bodyOffset+20),uid:Xr(e.bytesAt(i.bodyOffset+2,16))})):[]}function Vt(e,t,n,r){if(!t||!n)return[];let o=Yr(e,t),i=new N(n);return o.map(a=>{let s=L(i,a.offset),c=i.bytesAt(s.bodyOffset,s.length),d=qr(c),l=Zr(s.type),u=d.type!=="unknown"?d.type:l.type,f=d.mimeType!=="application/octet-stream"?d.mimeType:l.mimeType,p=c.subarray(d.offset),g={index:a.index,bseIndex:a.index,type:u,offset:a.offset,length:p.length,mimeType:f};return a.uid.length>0&&(g.uid=a.uid),r.includeBinaryPayloads&&(g.data=p.slice()),r.base64Pictures&&(g.base64=ae(p)),g})}function Jr(e,t){let n=L(e,t);if(n.type!==4085)throw new Error(`Expected UserEditAtom at offset ${t}, got ${n.type}`);let r=n.bodyOffset,o=e.u32(r),i=e.u16(r+4),a=e.u8(r+4),s=e.u8(r+5),c=e.u32(r+8),d=e.u32(r+12),l=e.u32(r+16),u=e.u32(r+20),f=e.u16(r+24),p=n.length>=32?e.u32(r+28):void 0,g={offset:t,lastSlideIdRef:o,version:i,majorVersion:s,minorVersion:a,offsetLastEdit:c,offsetPersistDirectory:d,docPersistIdRef:l,persistIdSeed:u,lastView:f};return p!==void 0&&(g.encryptSessionPersistIdRef=p),g}function Kr(e,t){let n=L(e,t);if(n.type!==6001&&n.type!==6002)throw new Error(`Expected PersistDirectory record at offset ${t}, got ${n.type}`);let r=[],o=n.bodyOffset;for(;o+4<=n.end;){let i=e.u32(o);o+=4;let a=i&1048575,s=i>>>20,c=[];for(let d=0;d<s;d+=1)c.push(e.u32(o)),o+=4;r.push({persistId:a,count:s,offsets:c})}return{offset:t,entries:r}}function Gt(e,t){let n=[],r=[],o=new Map,i=0,a=0,s=0,c=t;for(;c!==0;){let l=Jr(e,c);n.push(l),i===0&&(i=l.docPersistIdRef,a=l.persistIdSeed,s=l.lastView),r.push(Kr(e,l.offsetPersistDirectory)),c=l.offsetLastEdit}for(let l=r.length-1;l>=0;l-=1)for(let u of r[l].entries)u.offsets.forEach((f,p)=>{o.set(u.persistId+p,f)});let d=[];for(let[l,u]of[...o.entries()].sort((f,p)=>f[0]-p[0])){let f=L(e,u);d.push({persistId:l,offset:u,recordType:f.type,recordName:Le(f.type)})}return{userEdits:n,directories:r,persistMap:o,persistObjects:d,docPersistIdRef:i,persistIdSeed:a,lastView:s}}function Qr(e,t){let n=t+8;return{slideSize:{width:e.u32(n),height:e.u32(n+4)},notesSize:{width:e.u32(n+8),height:e.u32(n+12)},firstSlideNumber:e.u32(n+16)}}function eo(e,t){let n=L(e,t),r=C(e,n.bodyOffset,n.end),o=[];return r.forEach((i,a)=>{if(i.type!==4023)return;let s={index:a,name:e.nullTerminatedUtf16(i.bodyOffset,Math.min(64,i.length))};i.length>=65&&(s.charSet=e.u8(i.bodyOffset+64)),i.length>=66&&(s.flags=e.u8(i.bodyOffset+65)),i.length>=68&&(s.type=e.u16(i.bodyOffset+66)),o.push(s)}),o}function to(e,t,n){let r=t+8,o=e.u32(r),i=e.u32(r+4),a=e.u32(r+8),s=e.u32(r+12);return{persistIdRef:o,nonOutlineData:(i&4)!==0,textCount:a,slideId:s,textBlocks:n}}function Qe(e,t){let n=L(e,t),r=C(e,n.bodyOffset,n.end),o=[],i=0;for(;i<r.length;){let a=r[i];if(a.type!==1011){i+=1;continue}let s=[],c=i+1,d=0;for(;c<r.length&&r[c].type!==1011;){let l=Re(r,e,c);if(!l){c+=1;continue}let u={index:d,text:l.text};l.headerType!==void 0&&(u.headerType=l.headerType),l.style!==void 0&&(u.style=l.style),s.push(u),d+=1,c+=l.consumedRecords}o.push(to(e,a.offset,s)),i=c}return o}function no(e,t){let n=t+8,r=e.u32(n+12),o=e.u32(n+16),i={};return r!==0&&(i.masterIdRef=r),o!==0&&(i.notesIdRef=o),i}function ro(e,t){let n=e.find(o=>o.headerType===0&&o.text.trim().length>0)?.text;return n?n.split(/[\r\u000b\n]/)[0]?.trim():t.map(o=>o.paragraphs.map(i=>i.text).join(" ")).find(o=>o.trim().length>0)?.split(/[\r\u000b\n]/)[0]?.trim()}function _t(e,t={}){let n=At(e),r=n.readStream("Current User"),o=n.readStream("PowerPoint Document"),i=n.getEntry("Pictures")?n.readStream("Pictures"):void 0,a=Bt(r),s=new N(o),c={slideSize:{width:0,height:0}};Et(c,a);let d=Gt(s,a.offsetToCurrentEdit);c.persistIdSeed=d.persistIdSeed,c.lastView=d.lastView;let l=d.persistMap.get(d.docPersistIdRef)??0,u=L(s,l),f=C(s,u.bodyOffset,u.end),p=f.find(w=>w.type===1001);if(!p)throw new Error("PowerPoint document does not contain DocumentAtom");Object.assign(c,Qr(s,p.offset));let g=f.find(w=>w.type===1010),b=g?C(s,g.bodyOffset,g.end).find(w=>w.type===2005):void 0,y=b?eo(s,b.offset):[],B=f.find(w=>w.type===1035),F=f.find(w=>w.type===1033),G=Wt(s,F),j={};t.includeBinaryPayloads!==void 0&&(j.includeBinaryPayloads=t.includeBinaryPayloads),t.base64Pictures!==void 0&&(j.base64Pictures=t.base64Pictures);let E=Vt(s,B,i,j),M=f.find(w=>w.type===4080&&w.instance===1),x=f.find(w=>w.type===4080&&w.instance===0),k=f.find(w=>w.type===4080&&w.instance===2),$=M?Qe(s,M.offset):[],S=x?Qe(s,x.offset):[],z=k?Qe(s,k.offset):[],T=S.map((w,K)=>{let U=d.persistMap.get(w.persistIdRef);if(U===void 0)throw new Error(`Persist object for slide ${w.persistIdRef} not found`);let ie=L(s,U),X=C(s,ie.bodyOffset,ie.end),Q=X.find(W=>W.type===1007),se=X.find(W=>W.type===1036),q=X.find(W=>W.type===2032),me=Ke(s,q),H=Q?no(s,Q.offset):{},Ne=Fe(s,se,w.textBlocks,E,G,me,{x:0,y:0,width:c.slideSize.width,height:c.slideSize.height}),ot=ro(w.textBlocks,Ne.flatMap(W=>W.text?[W.text]:[])),he={persistId:w.persistIdRef,offset:U,index:K,colorScheme:me,backgroundShapes:Ne.filter(W=>W.isBackground),textBlocks:w.textBlocks,shapes:Ne,html:""};he.slideId=w.slideId,ot!==void 0&&(he.title=ot);let De={slideId:w.slideId};return H.masterIdRef!==void 0&&(De.masterPersistIdRef=H.masterIdRef),H.notesIdRef!==void 0&&(De.notesPersistIdRef=H.notesIdRef,he.notesPersistId=H.notesIdRef),he.masterRef=De,he}),O=$.map((w,K)=>{let U=d.persistMap.get(w.persistIdRef);if(U===void 0)throw new Error(`Persist object for master ${w.persistIdRef} not found`);let ie=L(s,U),X=C(s,ie.bodyOffset,ie.end),Q=X.find(H=>H.type===1036),se=X.find(H=>H.type===2032),q=Ke(s,se),me=Fe(s,Q,w.textBlocks,E,G,q,{x:0,y:0,width:c.slideSize.width,height:c.slideSize.height});return{persistId:w.persistIdRef,offset:U,index:K,kind:"main",colorScheme:q,backgroundShapes:me.filter(H=>H.isBackground),shapes:me}}),J=z.map(w=>{let K=d.persistMap.get(w.persistIdRef);if(K===void 0)throw new Error(`Persist object for notes ${w.persistIdRef} not found`);let U=L(s,K),X=C(s,U.bodyOffset,U.end).find(q=>q.type===1036),Q=Fe(s,X,w.textBlocks,E,G,[],{x:0,y:0,width:c.notesSize?.width??c.slideSize.width,height:c.notesSize?.height??c.slideSize.height}),se={persistId:w.persistIdRef,offset:K,backgroundShapes:Q.filter(q=>q.isBackground),shapes:Q};return w.slideId!==0&&(se.slidePersistIdRef=w.slideId),se}),rt={format:"ppt",metadata:c,fonts:y,pictures:E,slides:T,masters:O,notes:J,persistObjects:d.persistObjects,html:""};return t.includeRawRecords&&(rt.rawRecords=qe(s,0,s.length)),rt}var Se=class{constructor(t){Object.defineProperty(this,"worker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.worker=t.workerFactory()}terminate(){this.worker.terminate()}parse(t,n={},r){return new Promise((o,i)=>{let a=d=>{if(d.data.type==="progress"){r?.(d.data);return}if(this.worker.removeEventListener("message",a),this.worker.removeEventListener("error",s),d.data.type==="result"){o(d.data.payload);return}i(new Error(d.data.payload.message))},s=d=>{this.worker.removeEventListener("message",a),this.worker.removeEventListener("error",s),i(d.error instanceof Error?d.error:new Error(d.message))};this.worker.addEventListener("message",a),this.worker.addEventListener("error",s);let c={type:"parse",payload:{buffer:t,options:n}};this.worker.postMessage(c,[t])})}};async function Xt(e,t={}){let n=_t(e,t);return await It(n),n}var oo={en:{pageTitle:"ppt-viewer demo",heroEyebrow:"Pure TypeScript · Binary .ppt · Worker rendering",heroTitle:"ppt-viewer demo",heroSubtitle:"Open classic PowerPoint 97-2003 .ppt files directly in the browser. The page boots with a bundled test.ppt preview, and you can replace it with your own file at any time.",uploadHeading:"Open a .ppt file",uploadDescription:"The page opens with the bundled test.ppt by default. You can replace it with any local binary PowerPoint .ppt file at any time, and parsing stays in your browser.",dropTitle:"Drop a .ppt file here",dropHint:"or click to browse your device",browseButtonText:"Choose file",workerLabel:"Use worker parsing",workerHelp:"Recommended for large presentations",inlinePicturesLabel:"Inline picture payloads",inlinePicturesHelp:"Embeds extracted images as base64 for self-contained preview output",fitButton:"Fit width",actualButton:"Actual size",clearButton:"Clear",metadataHeading:"Presentation info",metaFileNameLabel:"File",metaSlideCountLabel:"Slides",metaSlideSizeLabel:"Slide size",metaPictureCountLabel:"Pictures",metaFontCountLabel:"Fonts",metaParseTimeLabel:"Parse time",metaVersionLabel:"Doc version",metaUserLabel:"Current user",viewerHeading:"Slide preview",viewerDescription:"Slides are rendered as HTML and scaled to fit the page width by default.",viewerModeFit:"Fit width",viewerModeActual:"Actual size",emptyTitle:"No presentation loaded yet",emptyText:"Choose a local .ppt file to generate the preview.",statusReadyLabel:"Ready",statusReadyText:"Waiting for a local .ppt file.",statusParsingLabel:"Parsing",statusParsingText:"Reading binary records and building the typed presentation model…",statusRenderingLabel:"Rendering",statusRenderingText:"Generating HTML slide output…",statusLoadingDemoLabel:"Loading demo",statusLoadingDemoText:"Fetching the bundled test.ppt so the preview opens automatically…",statusDemoReadyText:"Bundled test.ppt is ready. You can inspect it now or replace it with your own file.",statusDemoLoadFailed:"Unable to load the bundled test.ppt preview.",statusDoneLabel:"Done",statusDoneText:"Preview is ready.",statusErrorLabel:"Error",statusNoWorker:"Web Workers are not available in this browser. Falling back to main-thread parsing.",statusInvalidFile:"Please choose a PowerPoint .ppt file.",statusCleared:"Preview cleared.",parseTimeMs:"ms",useWorkerUnavailableSuffix:" (unsupported in this browser)"},"zh-CN":{pageTitle:"ppt-viewer 演示",heroEyebrow:"纯 TypeScript · 二进制 .ppt · Worker 渲染",heroTitle:"ppt-viewer 演示页面",heroSubtitle:"直接在浏览器中打开经典 PowerPoint 97-2003 .ppt 文件。页面会自动加载内置的 test.ppt 作为默认预览,你也可以随时替换成自己的文件。",uploadHeading:"打开 .ppt 文件",uploadDescription:"页面默认会自动加载内置的 test.ppt。你也可以随时换成本地二进制 PowerPoint .ppt 文件,整个过程都只在浏览器里完成。",dropTitle:"将 .ppt 文件拖到这里",dropHint:"或点击浏览本地文件",browseButtonText:"选择文件",workerLabel:"使用 worker 解析",workerHelp:"更适合较大的演示文稿",inlinePicturesLabel:"内联图片数据",inlinePicturesHelp:"把提取出的图片转成 base64,便于生成自包含预览结果",fitButton:"适应宽度",actualButton:"原始尺寸",clearButton:"清空",metadataHeading:"演示信息",metaFileNameLabel:"文件",metaSlideCountLabel:"页数",metaSlideSizeLabel:"页面尺寸",metaPictureCountLabel:"图片数",metaFontCountLabel:"字体数",metaParseTimeLabel:"解析耗时",metaVersionLabel:"文档版本",metaUserLabel:"当前用户",viewerHeading:"幻灯片预览",viewerDescription:"默认按页面宽度自适应缩放,渲染结果为 HTML。",viewerModeFit:"适应宽度",viewerModeActual:"原始尺寸",emptyTitle:"还没有加载演示文稿",emptyText:"请选择本地 .ppt 文件生成预览。",statusReadyLabel:"就绪",statusReadyText:"等待选择本地 .ppt 文件。",statusParsingLabel:"解析中",statusParsingText:"正在读取二进制记录并构建严格类型的 presentation model…",statusRenderingLabel:"渲染中",statusRenderingText:"正在生成 HTML 幻灯片输出…",statusLoadingDemoLabel:"加载 demo",statusLoadingDemoText:"正在获取内置的 test.ppt,页面打开后会自动展示默认预览…",statusDemoReadyText:"内置 test.ppt 已就绪,你可以直接查看效果,也可以替换为自己的文件。",statusDemoLoadFailed:"无法加载内置的 test.ppt 默认预览。",statusDoneLabel:"完成",statusDoneText:"预览已生成。",statusErrorLabel:"错误",statusNoWorker:"当前浏览器不支持 Web Worker,已回退到主线程解析。",statusInvalidFile:"请选择 PowerPoint .ppt 文件。",statusCleared:"预览已清空。",parseTimeMs:"毫秒",useWorkerUnavailableSuffix:"(当前浏览器不支持)"}},v={lang:localStorage.getItem("ppt-viewer-demo-lang")==="en"?"en":"zh-CN",fitMode:"fit",presentation:null,resizeObserver:null,activeLoadId:0},qt="test.ppt",Zt="20260422092711244",m={body:document.body,pageTitle:document.querySelector("title"),heroEyebrow:document.getElementById("heroEyebrow"),heroTitle:document.getElementById("heroTitle"),heroSubtitle:document.getElementById("heroSubtitle"),uploadHeading:document.getElementById("uploadHeading"),uploadDescription:document.getElementById("uploadDescription"),dropZone:document.getElementById("dropZone"),fileInput:document.getElementById("fileInput"),dropTitle:document.getElementById("dropTitle"),dropHint:document.getElementById("dropHint"),browseButtonText:document.getElementById("browseButtonText"),workerLabel:document.getElementById("workerLabel"),workerHelp:document.getElementById("workerHelp"),useWorker:document.getElementById("useWorker"),inlinePicturesLabel:document.getElementById("inlinePicturesLabel"),inlinePicturesHelp:document.getElementById("inlinePicturesHelp"),inlinePictures:document.getElementById("inlinePictures"),fitButton:document.getElementById("fitButton"),actualButton:document.getElementById("actualButton"),clearButton:document.getElementById("clearButton"),statusCard:document.getElementById("statusCard"),statusLabel:document.getElementById("statusLabel"),statusText:document.getElementById("statusText"),progressBar:document.getElementById("progressBar"),metadataHeading:document.getElementById("metadataHeading"),metaFileNameLabel:document.getElementById("metaFileNameLabel"),metaSlideCountLabel:document.getElementById("metaSlideCountLabel"),metaSlideSizeLabel:document.getElementById("metaSlideSizeLabel"),metaPictureCountLabel:document.getElementById("metaPictureCountLabel"),metaFontCountLabel:document.getElementById("metaFontCountLabel"),metaParseTimeLabel:document.getElementById("metaParseTimeLabel"),metaVersionLabel:document.getElementById("metaVersionLabel"),metaUserLabel:document.getElementById("metaUserLabel"),metaFileName:document.getElementById("metaFileName"),metaSlideCount:document.getElementById("metaSlideCount"),metaSlideSize:document.getElementById("metaSlideSize"),metaPictureCount:document.getElementById("metaPictureCount"),metaFontCount:document.getElementById("metaFontCount"),metaParseTime:document.getElementById("metaParseTime"),metaVersion:document.getElementById("metaVersion"),metaUser:document.getElementById("metaUser"),viewerHeading:document.getElementById("viewerHeading"),viewerDescription:document.getElementById("viewerDescription"),viewerModePill:document.getElementById("viewerModePill"),viewerHost:document.getElementById("viewerHost"),langButtons:Array.from(document.querySelectorAll("[data-lang]")),fitButtons:Array.from(document.querySelectorAll("[data-fit-mode]"))};function h(e){return oo[v.lang][e]}function Jt(e){if(!Zt)return e;let t=e.includes("?")?"&":"?";return`${e}${t}v=${Zt}`}function Kt(){document.documentElement.lang=v.lang,m.pageTitle.textContent=h("pageTitle"),m.heroEyebrow.textContent=h("heroEyebrow"),m.heroTitle.textContent=h("heroTitle"),m.heroSubtitle.textContent=h("heroSubtitle"),m.uploadHeading.textContent=h("uploadHeading"),m.uploadDescription.textContent=h("uploadDescription"),m.dropTitle.textContent=h("dropTitle"),m.dropHint.textContent=h("dropHint"),m.browseButtonText.textContent=h("browseButtonText"),m.workerLabel.textContent=h("workerLabel"),m.workerHelp.textContent=h("workerHelp")+(tt()?"":h("useWorkerUnavailableSuffix")),m.inlinePicturesLabel.textContent=h("inlinePicturesLabel"),m.inlinePicturesHelp.textContent=h("inlinePicturesHelp"),m.fitButton.textContent=h("fitButton"),m.actualButton.textContent=h("actualButton"),m.clearButton.textContent=h("clearButton"),m.metadataHeading.textContent=h("metadataHeading"),m.metaFileNameLabel.textContent=h("metaFileNameLabel"),m.metaSlideCountLabel.textContent=h("metaSlideCountLabel"),m.metaSlideSizeLabel.textContent=h("metaSlideSizeLabel"),m.metaPictureCountLabel.textContent=h("metaPictureCountLabel"),m.metaFontCountLabel.textContent=h("metaFontCountLabel"),m.metaParseTimeLabel.textContent=h("metaParseTimeLabel"),m.metaVersionLabel.textContent=h("metaVersionLabel"),m.metaUserLabel.textContent=h("metaUserLabel"),m.viewerHeading.textContent=h("viewerHeading"),m.viewerDescription.textContent=h("viewerDescription"),He(),v.presentation||(tn(),m.statusCard.dataset.state==="idle"&&R("idle",h("statusReadyLabel"),h("statusReadyText"),0));for(let e of m.langButtons)e.classList.toggle("is-active",e.dataset.lang===v.lang)}function tt(){return typeof Worker<"u"}function pe(e){return new Intl.NumberFormat(v.lang==="zh-CN"?"zh-CN":"en-US").format(e)}function io(e){return Number.isFinite(e)?`${pe(Math.round(e))} ${h("parseTimeMs")}`:"—"}function fe(e){if(!Number.isFinite(e)||e<0)return"—";let t=["B","KB","MB","GB"],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;let o=n>=10||r===0?0:1;return`${new Intl.NumberFormat(v.lang==="zh-CN"?"zh-CN":"en-US",{maximumFractionDigits:o}).format(n)} ${t[r]}`}function R(e,t,n,r=0){m.statusCard.dataset.state=e,m.statusLabel.textContent=t,m.statusText.textContent=n,m.progressBar.style.inlineSize=`${Math.max(0,Math.min(r,100))}%`,tn()}function nt(){return v.activeLoadId+=1,v.activeLoadId}function oe(e){return e===v.activeLoadId}function Qt(){m.metaFileName.textContent="—",m.metaSlideCount.textContent="—",m.metaSlideSize.textContent="—",m.metaPictureCount.textContent="—",m.metaFontCount.textContent="—",m.metaParseTime.textContent="—",m.metaVersion.textContent="—",m.metaUser.textContent="—"}function so(e,t,n){m.metaFileName.textContent=e,m.metaSlideCount.textContent=pe(t.slides.length);let r=Math.round((t.metadata.slideSize.width||0)/6),o=Math.round((t.metadata.slideSize.height||0)/6);m.metaSlideSize.textContent=`${pe(r)} × ${pe(o)}`,m.metaPictureCount.textContent=pe(t.pictures.length),m.metaFontCount.textContent=pe(t.fonts.length),m.metaParseTime.textContent=io(n);let i=[t.metadata.majorVersion,t.metadata.minorVersion].filter(a=>a!==void 0);m.metaVersion.textContent=i.length>0?i.join("."):"—",m.metaUser.textContent=t.metadata.currentUser||"—"}function en(){v.resizeObserver&&(v.resizeObserver.disconnect(),v.resizeObserver=null)}function et(e,t,n="empty"){m.viewerHost.dataset.state=n,m.viewerHost.innerHTML="";let r=document.createElement("div");r.className=`viewer-empty viewer-empty--${n}`;let o=document.createElement("strong");o.textContent=e;let i=document.createElement("span");i.textContent=t,r.append(o,i),m.viewerHost.append(r)}function tn(){if(v.presentation){m.viewerHost.dataset.state="ready",m.viewerHost.removeAttribute("aria-busy");return}let e=m.statusCard.dataset.state;if(e==="working"){m.viewerHost.setAttribute("aria-busy","true"),et(m.statusLabel.textContent||h("statusLoadingDemoLabel"),m.statusText.textContent||h("statusLoadingDemoText"),"loading");return}if(m.viewerHost.removeAttribute("aria-busy"),e==="error"){et(m.statusLabel.textContent||h("statusErrorLabel"),m.statusText.textContent||h("statusDemoLoadFailed"),"error");return}et(h("emptyTitle"),h("emptyText"),"empty")}function ao(e){let t=m.viewerHost.querySelector(".ppt-viewer");if(!t)return;Array.from(t.querySelectorAll(".ppt-viewer-slide")).forEach((r,o)=>{let i=Number.parseFloat(r.style.width)||e.metadata.slideSize.width||960,a=Number.parseFloat(r.style.height)||e.metadata.slideSize.height||540,s=document.createElement("div");s.className="demo-slide-shell",s.dataset.width=String(i),s.dataset.height=String(a),s.dataset.slideIndex=String(o+1);let c=document.createElement("div");c.className="demo-slide-viewport",c.style.width=`${i}px`,c.style.height=`${a}px`,r.parentNode?.insertBefore(s,r),c.append(r),s.append(c)})}function ze(){Array.from(m.viewerHost.querySelectorAll(".demo-slide-shell")).forEach(t=>{let n=Number(t.dataset.width||"0"),r=Number(t.dataset.height||"0"),o=t.querySelector(".demo-slide-viewport");if(!(o instanceof HTMLElement)||n<=0||r<=0)return;let i=t.clientWidth-36,a=v.fitMode==="fit"?Math.min(1,i/n):1;o.style.transform=`scale(${a})`,t.style.height=`${Math.ceil(r*a+36)}px`})}function co(){if(en(),typeof ResizeObserver>"u"){window.addEventListener("resize",ze,{passive:!0});return}v.resizeObserver=new ResizeObserver(()=>{ze()}),v.resizeObserver.observe(m.viewerHost)}function lo(e){v.presentation=e,m.viewerHost.dataset.state="ready",m.viewerHost.removeAttribute("aria-busy"),m.viewerHost.innerHTML=e.html,ao(e),co(),requestAnimationFrame(()=>{ze()})}function uo(){nt(),v.presentation=null,en(),m.viewerHost.innerHTML="",Qt(),R("idle",h("statusReadyLabel"),h("statusCleared"),0)}function He(){for(let e of m.fitButtons)e.classList.toggle("is-active",e.dataset.fitMode===v.fitMode);m.viewerModePill.textContent=v.fitMode==="fit"?h("viewerModeFit"):h("viewerModeActual")}async function fo(e,t,n){if(m.useWorker.checked&&tt()){let r=new Se({workerFactory:()=>new Worker(new URL(Jt("./dist/worker/worker-entry.js"),import.meta.url),{type:"module"})});try{return await r.parse(e,t,n)}finally{r.terminate()}}return Xt(e,t)}async function nn(e,t,n,r=h("statusDoneText")){let o=performance.now(),i={base64Pictures:m.inlinePictures.checked};R("working",h("statusParsingLabel"),h("statusParsingText"),24);try{let a=await fo(t,i,c=>{oe(n)&&(c.payload.stage==="parsing"?R("working",h("statusParsingLabel"),h("statusParsingText"),32):c.payload.stage==="rendering"?R("working",h("statusRenderingLabel"),h("statusRenderingText"),72):c.payload.stage==="done"&&R("working",h("statusDoneLabel"),h("statusDoneText"),96))});if(!oe(n))return;let s=performance.now()-o;lo(a),so(e,a,s),R("idle",h("statusDoneLabel"),r,100)}catch(a){if(!oe(n))return;let s=a instanceof Error?a.message:String(a);R("error",h("statusErrorLabel"),s,100)}}async function Yt(e){if(!e||!e.name.toLowerCase().endsWith(".ppt")){R("error",h("statusErrorLabel"),h("statusInvalidFile"),100);return}let t=nt(),n=await e.arrayBuffer();oe(t)&&await nn(e.name,n,t)}function po(e,t){return v.lang==="zh-CN"?Number.isFinite(t)&&t>0?`正在下载内置 test.ppt(${fe(e)} / ${fe(t)})…`:`正在下载内置 test.ppt(${fe(e)})…`:Number.isFinite(t)&&t>0?`Downloading bundled test.ppt (${fe(e)} / ${fe(t)})…`:`Downloading bundled test.ppt (${fe(e)})…`}async function mo(e,t){let n=Number.parseInt(e.headers.get("content-length")||"0",10);if(!e.body||typeof e.body.getReader!="function")return e.arrayBuffer();let r=e.body.getReader(),o=[],i=0;for(;;){let{done:c,value:d}=await r.read();if(c)break;d&&(o.push(d),i+=d.byteLength,t(i,n>0?n:void 0))}let a=new Uint8Array(i),s=0;for(let c of o)a.set(c,s),s+=c.byteLength;return a.buffer}async function ho(){let e=nt();R("working",h("statusLoadingDemoLabel"),h("statusLoadingDemoText"),8);try{let t=await fetch(Jt(`./${qt}`),{cache:"force-cache"});if(!t.ok)throw new Error(`HTTP ${t.status}`);let n=await mo(t,(r,o)=>{if(!oe(e))return;let i=Number.isFinite(o)&&o>0?r/o:.5,a=8+Math.round(i*12);R("working",h("statusLoadingDemoLabel"),po(r,o),a)});if(!oe(e))return;await nn(qt,n,e,h("statusDemoReadyText"))}catch(t){if(!oe(e))return;let n=t instanceof Error?t.message:String(t),r=n?`${h("statusDemoLoadFailed")} ${n}`:h("statusDemoLoadFailed");R("error",h("statusErrorLabel"),r,100)}}function go(e){v.lang=e==="zh-CN"?"zh-CN":"en",localStorage.setItem("ppt-viewer-demo-lang",v.lang),Kt(),v.presentation&&He()}function xo(){m.fileInput.addEventListener("change",e=>{let t=e.currentTarget;if(!(t instanceof HTMLInputElement))return;let[n]=t.files||[];Yt(n),t.value=""}),["dragenter","dragover"].forEach(e=>{m.dropZone.addEventListener(e,t=>{t.preventDefault(),m.dropZone.classList.add("is-dragover")})}),["dragleave","drop"].forEach(e=>{m.dropZone.addEventListener(e,()=>{m.dropZone.classList.remove("is-dragover")})}),m.dropZone.addEventListener("drop",e=>{e.preventDefault();let t=e.dataTransfer?.files?.[0];Yt(t)}),m.clearButton.addEventListener("click",()=>{uo()}),m.fitButtons.forEach(e=>{e.addEventListener("click",()=>{let t=e.dataset.fitMode==="actual"?"actual":"fit";v.fitMode=t,He(),ze()})}),m.langButtons.forEach(e=>{e.addEventListener("click",()=>{go(e.dataset.lang==="zh-CN"?"zh-CN":"en")})}),tt()||(m.useWorker.checked=!1,m.useWorker.disabled=!0,R("idle",h("statusReadyLabel"),h("statusNoWorker"),0))}Qt();Kt();xo();He();window.requestAnimationFrame(()=>{ho()});