"use strict";var j=Object.create;var w=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var S=(t,e,n,g)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of H(e))!y.call(t,i)&&i!==n&&w(t,i,{get:()=>e[i],enumerable:!(g=F(e,i))||g.enumerable});return t};var v=(t,e,n)=>(n=t!=null?j(T(t)):{},S(e||!t||!t.__esModule?w(n,"default",{value:t,enumerable:!0}):n,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("./dom-to-png-DgRl9bEH.cjs");async function I({domElement:t,fileName:e,scale:n=2,options:g={}}){if(!t)return Promise.reject("No domElement provided");let i;try{i=(await import("jspdf")).default}catch{return Promise.reject("jspdf is not installed. Run npm install jspdf")}const o={width:595.28,height:841.89},l=await D.domToPng({container:t,scale:n});return await new Promise((c,P)=>{const a=new window.Image;a.onload=function(){const d=a.naturalWidth,h=a.naturalHeight;let m=o.width,f=o.width/d*h;const r=new i("","pt","a4");let u=0,s=h;const p=d/o.width*o.height;if(s<p)r.addImage(l,"PNG",0,0,m,f,"","FAST");else for(;s>0;)r.addImage(l,"PNG",0,u,m,f,"","FAST"),s-=p,u-=o.height,s>0&&r.addPage();r.save(`${e}.pdf`),c()},a.onerror=d=>P("Failed to load image for PDF: "+d),a.src=l})}exports.default=I;
