MCPcopy Create free account
hub / github.com/simstudioai/sim / write

Method write

apps/sim/lib/execution/sandbox/bundles/pptxgenjs.cjs:124–124  ·  view source on GitHub ↗
($)

Source from the content-addressed store, hash-verified

122 </Relationships>`}function iB($,q){let Q=q.map((K,J)=>({target:`../slideLayouts/slideLayout${J+1}.xml`,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"}));return Q.push({target:"../theme/theme1.xml",type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"}),d7($,Q)}function oB(){return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${n0}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
123 <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>
124 </Relationships>`}function aB($,q,Q){for(let K=0;K<q.length;K++)if(q[K]._name===$[Q-1]._slideLayout._name)return K+1;return 1}function lB($){var q,Q,K,J;let Z=((q=$.theme)===null||q===void 0?void 0:q.headFontFace)?`<a:latin typeface="${(Q=$.theme)===null||Q===void 0?void 0:Q.headFontFace}"/>`:'<a:latin typeface="Calibri Light" panose="020F0302020204030204"/>',G=((K=$.theme)===null||K===void 0?void 0:K.bodyFontFace)?`<a:latin typeface="${(J=$.theme)===null||J===void 0?void 0:J.bodyFontFace}"/>`:'<a:latin typeface="Calibri" panose="020F0502020204030204"/>';return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"><a:themeElements><a:clrScheme name="Office"><a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1><a:dk2><a:srgbClr val="44546A"/></a:dk2><a:lt2><a:srgbClr val="E7E6E6"/></a:lt2><a:accent1><a:srgbClr val="4472C4"/></a:accent1><a:accent2><a:srgbClr val="ED7D31"/></a:accent2><a:accent3><a:srgbClr val="A5A5A5"/></a:accent3><a:accent4><a:srgbClr val="FFC000"/></a:accent4><a:accent5><a:srgbClr val="5B9BD5"/></a:accent5><a:accent6><a:srgbClr val="70AD47"/></a:accent6><a:hlink><a:srgbClr val="0563C1"/></a:hlink><a:folHlink><a:srgbClr val="954F72"/></a:folHlink></a:clrScheme><a:fontScheme name="Office"><a:majorFont>${Z}<a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="游ゴシック Light"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="等线 Light"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Times New Roman"/><a:font script="Hebr" typeface="Times New Roman"/><a:font script="Thai" typeface="Angsana New"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="MoolBoran"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Times New Roman"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/><a:font script="Armn" typeface="Arial"/><a:font script="Bugi" typeface="Leelawadee UI"/><a:font script="Bopo" typeface="Microsoft JhengHei"/><a:font script="Java" typeface="Javanese Text"/><a:font script="Lisu" typeface="Segoe UI"/><a:font script="Mymr" typeface="Myanmar Text"/><a:font script="Nkoo" typeface="Ebrima"/><a:font script="Olck" typeface="Nirmala UI"/><a:font script="Osma" typeface="Ebrima"/><a:font script="Phag" typeface="Phagspa"/><a:font script="Syrn" typeface="Estrangelo Edessa"/><a:font script="Syrj" typeface="Estrangelo Edessa"/><a:font script="Syre" typeface="Estrangelo Edessa"/><a:font script="Sora" typeface="Nirmala UI"/><a:font script="Tale" typeface="Microsoft Tai Le"/><a:font script="Talu" typeface="Microsoft New Tai Lue"/><a:font script="Tfng" typeface="Ebrima"/></a:majorFont><a:minorFont>${G}<a:ea typeface=""/><a:cs typeface=""/><a:font script="Jpan" typeface="游ゴシック"/><a:font script="Hang" typeface="맑은 고딕"/><a:font script="Hans" typeface="等线"/><a:font script="Hant" typeface="新細明體"/><a:font script="Arab" typeface="Arial"/><a:font script="Hebr" typeface="Arial"/><a:font script="Thai" typeface="Cordia New"/><a:font script="Ethi" typeface="Nyala"/><a:font script="Beng" typeface="Vrinda"/><a:font script="Gujr" typeface="Shruti"/><a:font script="Khmr" typeface="DaunPenh"/><a:font script="Knda" typeface="Tunga"/><a:font script="Guru" typeface="Raavi"/><a:font script="Cans" typeface="Euphemia"/><a:font script="Cher" typeface="Plantagenet Cherokee"/><a:font script="Yiii" typeface="Microsoft Yi Baiti"/><a:font script="Tibt" typeface="Microsoft Himalaya"/><a:font script="Thaa" typeface="MV Boli"/><a:font script="Deva" typeface="Mangal"/><a:font script="Telu" typeface="Gautami"/><a:font script="Taml" typeface="Latha"/><a:font script="Syrc" typeface="Estrangelo Edessa"/><a:font script="Orya" typeface="Kalinga"/><a:font script="Mlym" typeface="Kartika"/><a:font script="Laoo" typeface="DokChampa"/><a:font script="Sinh" typeface="Iskoola Pota"/><a:font script="Mong" typeface="Mongolian Baiti"/><a:font script="Viet" typeface="Arial"/><a:font script="Uigh" typeface="Microsoft Uighur"/><a:font script="Geor" typeface="Sylfaen"/><a:font script="Armn" typeface="Arial"/><a:font script="Bugi" typeface="Leelawadee UI"/><a:font script="Bopo" typeface="Microsoft JhengHei"/><a:font script="Java" typeface="Javanese Text"/><a:font script="Lisu" typeface="Segoe UI"/><a:font script="Mymr" typeface="Myanmar Text"/><a:font script="Nkoo" typeface="Ebrima"/><a:font script="Olck" typeface="Nirmala UI"/><a:font script="Osma" typeface="Ebrima"/><a:font script="Phag" typeface="Phagspa"/><a:font script="Syrn" typeface="Estrangelo Edessa"/><a:font script="Syrj" typeface="Estrangelo Edessa"/><a:font script="Syre" typeface="Estrangelo Edessa"/><a:font script="Sora" typeface="Nirmala UI"/><a:font script="Tale" typeface="Microsoft Tai Le"/><a:font script="Talu" typeface="Microsoft New Tai Lue"/><a:font script="Tfng" typeface="Ebrima"/></a:minorFont></a:fontScheme><a:fmtScheme name="Office"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:lumMod val="110000"/><a:satMod val="105000"/><a:tint val="67000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="103000"/><a:tint val="73000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="109000"/><a:tint val="81000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:satMod val="103000"/><a:lumMod val="102000"/><a:tint val="94000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:satMod val="110000"/><a:lumMod val="100000"/><a:shade val="100000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="99000"/><a:satMod val="120000"/><a:shade val="78000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w="6350" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="12700" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="19050" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="57150" dist="19050" dir="5400000" algn="ctr" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="63000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:tint val="95000"/><a:satMod val="170000"/></a:schemeClr></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="93000"/><a:satMod val="150000"/><a:shade val="98000"/><a:lumMod val="102000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:tint val="98000"/><a:satMod val="130000"/><a:shade val="90000"/><a:lumMod val="103000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="63000"/><a:satMod val="120000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults/><a:extraClrSchemeLst/><a:extLst><a:ext uri="{05A4C25C-085E-4340-85A3-A5531E510DB2}"><thm15:themeFamily xmlns:thm15="http://schemas.microsoft.com/office/thememl/2012/main" name="Office Theme" id="{62F939B6-93AF-4DB8-9C6B-D6C7DFDC589F}" vid="{4A3C46E8-61CC-4603-A589-7422A47A8E4A}"/></a:ext></a:extLst></a:theme>`}function rB($){let q=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${n0}<p:presentation xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" ${$.rtlMode?'rtl="1"':""} saveSubsetFonts="1" autoCompressPictures="0">`;q+='<p:sldMasterIdLst><p:sldMasterId id="2147483648" r:id="rId1"/></p:sldMasterIdLst>',q+="<p:sldIdLst>",$.slides.forEach((Q)=>q+=`<p:sldId id="${Q._slideId}" r:id="rId${Q._rId}"/>`),q+="</p:sldIdLst>",q+=`<p:notesMasterIdLst><p:notesMasterId r:id="rId${$.slides.length+2}"/></p:notesMasterIdLst>`,q+=`<p:sldSz cx="${$.presLayout.width}" cy="${$.presLayout.height}"/>`,q+=`<p:notesSz cx="${$.presLayout.height}" cy="${$.presLayout.width}"/>`,q+="<p:defaultTextStyle>";for(let Q=1;Q<10;Q++)q+=`<a:lvl${Q}pPr marL="${(Q-1)*457200}" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1"><a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr></a:lvl${Q}pPr>`;if(q+="</p:defaultTextStyle>",$.sections&&$.sections.length>0)q+='<p:extLst><p:ext uri="{521415D9-36F7-43E2-AB2F-B90AF26B5E84}">',q+='<p14:sectionLst xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main">',$.sections.forEach((Q)=>{q+=`<p14:section name="${k0(Q.title)}" id="{${Y5("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")}}"><p14:sldIdLst>`,Q._slides.forEach((K)=>q+=`<p14:sldId id="${K._slideId}"/>`),q+="</p14:sldIdLst></p14:section>"}),q+="</p14:sectionLst></p:ext>",q+='<p:ext uri="{EFAFB233-063F-42B5-8137-9DF3F51BA10A}"><p15:sldGuideLst xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main"/></p:ext>',q+="</p:extLst>";return q+="</p:presentation>",q}function sB(){return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${n0}<p:presentationPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"/>`}function tB(){return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${n0}<a:tblStyleLst xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" def="{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}"/>`}function eB(){return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${n0}<p:viewPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"><p:normalViewPr horzBarState="maximized"><p:restoredLeft sz="15611"/><p:restoredTop sz="94610"/></p:normalViewPr><p:slideViewPr><p:cSldViewPr snapToGrid="0" snapToObjects="1"><p:cViewPr varScale="1"><p:scale><a:sx n="136" d="100"/><a:sy n="136" d="100"/></p:scale><p:origin x="216" y="312"/></p:cViewPr><p:guideLst/></p:cSldViewPr></p:slideViewPr><p:notesTextViewPr><p:cViewPr><p:scale><a:sx n="1" d="1"/><a:sy n="1" d="1"/></p:scale><p:origin x="0" y="0"/></p:cViewPr></p:notesTextViewPr><p:gridSpacing cx="76200" cy="76200"/></p:viewPr>`}var $z="4.0.1";class m7{set layout($){let q=this.LAYOUTS[$];if(q)this._layout=$,this._presLayout=q;else throw Error("UNKNOWN-LAYOUT")}get layout(){return this._layout}get version(){return this._version}set author($){this._author=$}get author(){return this._author}set company($){this._company=$}get company(){return this._company}set revision($){this._revision=$}get revision(){return this._revision}set subject($){this._subject=$}get subject(){return this._subject}set theme($){this._theme=$}get theme(){return this._theme}set title($){this._title=$}get title(){return this._title}set rtlMode($){this._rtlMode=$}get rtlMode(){return this._rtlMode}get masterSlide(){return this._masterSlide}get slides(){return this._slides}get sections(){return this._sections}get slideLayouts(){return this._slideLayouts}get AlignH(){return this._alignH}get AlignV(){return this._alignV}get ChartType(){return this._chartType}get OutputType(){return this._outputType}get presLayout(){return this._presLayout}get SchemeColor(){return this._schemeColor}get ShapeType(){return this._shapeType}get charts(){return this._charts}get colors(){return this._colors}get shapes(){return this._shapes}constructor(){this._version=$z,this._alignH=u7,this._alignV=S7,this._chartType=P7,this._outputType=O7,this._schemeColor=G2,this._shapeType=T7,this._charts=q0,this._colors=D5,this._shapes=B1,this.addNewSlide=(J)=>{let Z=this.sections.length>0&&this.sections[this.sections.length-1]._slides.filter((G)=>G._slideNum===this.slides[this.slides.length-1]._slideNum).length>0;return J.sectionTitle=Z?this.sections[this.sections.length-1].title:null,this.addSlide(J)},this.getSlide=(J)=>this.slides.filter((Z)=>Z._slideNum===J)[0],this.setSlideNumber=(J)=>{this.masterSlide._slideNumberProps=J,this.slideLayouts.filter((Z)=>Z._name===h7)[0]._slideNumberProps=J},this.createChartMediaRels=(J,Z,G)=>{J._relsChart.forEach((W)=>G.push(jB(W,Z))),J._relsMedia.forEach((W)=>{if(W.type!=="online"&&W.type!=="hyperlink"){let B=W.data&&typeof W.data==="string"?W.data:"";if(!B.includes(",")&&!B.includes(";"))B="image/png;base64,"+B;else if(!B.includes(","))B="image/png;base64,"+B;else if(!B.includes(";"))B="image/png;"+B;Z.file(W.Target.replace("..","ppt"),B.split(",").pop(),{base64:!0})}})},this.writeFileToBrowser=(J,Z)=>W2(this,void 0,void 0,function*(){let G=document.createElement("a");if(G.setAttribute("style","display:none;"),G.dataset.interception="off",document.body.appendChild(G),window.URL.createObjectURL){let W=window.URL.createObjectURL(new Blob([Z],{type:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}));return G.href=W,G.download=J,G.click(),setTimeout(()=>{window.URL.revokeObjectURL(W),document.body.removeChild(G)},100),yield Promise.resolve(J)}}),this.exportPresentation=(J)=>W2(this,void 0,void 0,function*(){let Z=[],G=[],W=new _7.default;return this.slides.forEach((B)=>{G=G.concat(y7(B))}),this.slideLayouts.forEach((B)=>{G=G.concat(y7(B))}),G=G.concat(y7(this.masterSlide)),yield Promise.all(G).then(()=>W2(this,void 0,void 0,function*(){return this.slides.forEach((B)=>{if(B._slideLayout)CB(B)}),W.folder("_rels"),W.folder("docProps"),W.folder("ppt").folder("_rels"),W.folder("ppt/charts").folder("_rels"),W.folder("ppt/embeddings"),W.folder("ppt/media"),W.folder("ppt/slideLayouts").folder("_rels"),W.folder("ppt/slideMasters").folder("_rels"),W.folder("ppt/slides").folder("_rels"),W.folder("ppt/theme"),W.folder("ppt/notesMasters").folder("_rels"),W.folder("ppt/notesSlides").folder("_rels"),W.file("[Content_Types].xml",xB(this.slides,this.slideLayouts,this.masterSlide)),W.file("_rels/.rels",OB()),W.file("docProps/app.xml",PB(this.slides,this.company)),W.file("docProps/core.xml",TB(this.title,this.subject,this.author,this.revision)),W.file("ppt/_rels/presentation.xml.rels",uB(this.slides)),W.file("ppt/theme/theme1.xml",lB(this)),W.file("ppt/presentation.xml",rB(this)),W.file("ppt/presProps.xml",sB()),W.file("ppt/tableStyles.xml",tB()),W.file("ppt/viewProps.xml",eB()),this.slideLayouts.forEach((B,V)=>{W.file(`ppt/slideLayouts/slideLayout${V+1}.xml`,bB(B)),W.file(`ppt/slideLayouts/_rels/slideLayout${V+1}.xml.rels`,dB(V+1,this.slideLayouts))}),this.slides.forEach((B,V)=>{W.file(`ppt/slides/slide${V+1}.xml`,SB(B)),W.file(`ppt/slides/_rels/slide${V+1}.xml.rels`,mB(this.slides,this.slideLayouts,V+1)),W.file(`ppt/notesSlides/notesSlide${V+1}.xml`,cB(B)),W.file(`ppt/notesSlides/_rels/notesSlide${V+1}.xml.rels`,pB(V+1))}),W.file("ppt/slideMasters/slideMaster1.xml",nB(this.masterSlide,this.slideLayouts)),W.file("ppt/slideMasters/_rels/slideMaster1.xml.rels",iB(this.masterSlide,this.slideLayouts)),W.file("ppt/notesMasters/notesMaster1.xml",_B()),W.file("ppt/notesMasters/_rels/notesMaster1.xml.rels",oB()),this.slideLayouts.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.slides.forEach((B)=>{this.createChartMediaRels(B,W,Z)}),this.createChartMediaRels(this.masterSlide,W,Z),yield Promise.all(Z).then(()=>W2(this,void 0,void 0,function*(){if(J.outputType==="STREAM")return yield W.generateAsync({type:"nodebuffer",compression:J.compression?"DEFLATE":"STORE"});else if(J.outputType)return yield W.generateAsync({type:J.outputType});else return yield W.generateAsync({type:"blob",compression:J.compression?"DEFLATE":"STORE"})}))}))});let $={name:"screen4x3",width:9144000,height:6858000},q={name:"screen16x9",width:9144000,height:5143500},Q={name:"screen16x10",width:9144000,height:5715000},K={name:"custom",width:12192000,height:6858000};this.LAYOUTS={LAYOUT_4x3:$,LAYOUT_16x9:q,LAYOUT_16x10:Q,LAYOUT_WIDE:K},this._author="PptxGenJS",this._company="PptxGenJS",this._revision="1",this._subject="PptxGenJS Presentation",this._title="PptxGenJS Presentation",this._presLayout={name:this.LAYOUTS[f6].name,_sizeW:this.LAYOUTS[f6].width,_sizeH:this.LAYOUTS[f6].height,width:this.LAYOUTS[f6].width,height:this.LAYOUTS[f6].height},this._rtlMode=!1,this._slideLayouts=[{_margin:M8,_name:h7,_presLayout:this._presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000,_slideNumberProps:null,_slideObjects:[]}],this._slides=[],this._sections=[],this._masterSlide={addChart:null,addImage:null,addMedia:null,addNotes:null,addShape:null,addTable:null,addText:null,_name:null,_presLayout:this._presLayout,_rId:null,_rels:[],_relsChart:[],_relsMedia:[],_slideId:null,_slideLayout:null,_slideNum:null,_slideNumberProps:null,_slideObjects:[]}}stream($){return W2(this,void 0,void 0,function*(){return yield this.exportPresentation({compression:$===null||$===void 0?void 0:$.compression,outputType:"STREAM"})})}write($){return W2(this,void 0,void 0,function*(){let q=typeof $==="object"&&($===null||$===void 0?void 0:$.outputType)?$.outputType:$?$:null,Q=typeof $==="object"&&($===null||$===void 0?void 0:$.compression)?$.compression:!1;return yield this.exportPresentation({compression:Q,outputType:q})})}writeFile($){return W2(this,void 0,void 0,function*(){var q,Q;let K=typeof process<"u"&&!!((q=process.versions)===null||q===void 0?void 0:q.node)&&((Q=process.release)===null||Q===void 0?void 0:Q.name)==="node";if(typeof $==="string")console.warn("[WARNING] writeFile(string) is deprecated - pass { fileName } instead."),$={fileName:$};let{fileName:J="Presentation.pptx",compression:Z=!1}=$,G=J.toLowerCase().endsWith(".pptx")?J:`${J}.pptx`,W=K?"nodebuffer":null,B=yield this.exportPresentation({compression:Z,outputType:W});if(K){let{promises:V}=yield import("node:fs"),{writeFile:U}=V;return yield U(G,B),G}return yield this.writeFileToBrowser(G,B),G})}addSection($){if(!$)console.warn("addSection requires an argument");else if(!$.title)console.warn("addSection requires a title");let q={_type:"user",_slides:[],title:$.title};if($.order)this.sections.splice($.order,0,q);else this._sections.push(q)}addSlide($){let q=typeof $==="string"?$:($===null||$===void 0?void 0:$.masterName)?$.masterName:"",Q={_name:this.LAYOUTS[f6].name,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slideNum:this.slides.length+1};if(q){let J=this.slideLayouts.filter((Z)=>Z._name===q)[0];if(J)Q=J}let K=new zJ({addSlide:this.addNewSlide,getSlide:this.getSlide,presLayout:this.presLayout,setSlideNum:this.setSlideNumber,slideId:this.slides.length+256,slideRId:this.slides.length+2,slideNumber:this.slides.length+1,slideLayout:Q});if(this._slides.push(K),$===null||$===void 0?void 0:$.sectionTitle){let J=this.sections.filter((Z)=>Z.title===$.sectionTitle)[0];if(!J)console.warn(`addSlide: unable to find section with title: "${$.sectionTitle}"`);else J._slides.push(K)}else if(this.sections&&this.sections.length>0&&!($===null||$===void 0?void 0:$.sectionTitle)){let J=this._sections[this.sections.length-1];if(J._type==="default")J._slides.push(K);else this._sections.push({title:`Default-${this.sections.filter((Z)=>Z._type==="default").length+1}`,_type:"default",_slides:[K]})}return K}defineLayout($){if(!$)console.warn("defineLayout requires `{name, width, height}`");else if(!$.name)console.warn("defineLayout requires `name`");else if(!$.width)console.warn("defineLayout requires `width`");else if(!$.height)console.warn("defineLayout requires `height`");else if(typeof $.height!=="number")console.warn("defineLayout `height` should be a number (inches)");else if(typeof $.width!=="number")console.warn("defineLayout `width` should be a number (inches)");this.LAYOUTS[$.name]={name:$.name,_sizeW:Math.round(Number($.width)*L0),_sizeH:Math.round(Number($.height)*L0),width:Math.round(Number($.width)*L0),height:Math.round(Number($.height)*L0)}}defineSlideMaster($){let q=JSON.parse(JSON.stringify($));if(!q.title)throw Error("defineSlideMaster() object argument requires a `title` value. (https://gitbrent.github.io/PptxGenJS/docs/masters.html)");let Q={_margin:q.margin||M8,_name:q.title,_presLayout:this.presLayout,_rels:[],_relsChart:[],_relsMedia:[],_slide:null,_slideNum:1000+this.slideLayouts.length+1,_slideNumberProps:q.slideNumber||null,_slideObjects:[],background:q.background||null,bkgd:q.bkgd||null};if(vB(q,Q),this.slideLayouts.push(Q),q.background||q.bkgd)BJ(q.background,Q);if(Q._slideNumberProps&&!this.masterSlide._slideNumberProps)this.masterSlide._slideNumberProps=Q._slideNumberProps}tableToSlides($,q={}){LB(this,$,q,(q===null||q===void 0?void 0:q.masterSlideName)?this.slideLayouts.filter((Q)=>Q._name===q.masterSlideName)[0]:null)}}if(typeof globalThis.Buffer>"u")globalThis.Buffer=o;if(typeof globalThis.process>"u")globalThis.process=Qz;globalThis.__bundles=globalThis.__bundles||{};globalThis.__bundles.pptxgenjs=m7;})();

Callers

nothing calls this directly

Calls 1

W2Function · 0.70

Tested by

no test coverage detected