import{c as Je,a as Xe}from"./_commonjsHelpers.js?v=1775123024591";var Ue={exports:{}};/* @license Papa Parse v5.5.3 https://github.com/mholt/PapaParse License: MIT */(function(e,t){((s,i)=>{e.exports=i()})(Je,function s(){var i=typeof self<"u"?self:typeof window<"u"?window:i!==void 0?i:{},u,a=!i.document&&!!i.postMessage,c=i.IS_PAPA_WORKER||!1,l={},k=0,g={};function U(r){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(n){var o=we(n);o.chunkSize=parseInt(o.chunkSize),n.step||n.chunk||(o.chunkSize=null),this._handle=new xe(o),(this._handle.streamer=this)._config=o}).call(this,r),this.parseChunk=function(n,o){var f=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0=this._config.preview),c)i.postMessage({results:h,workerId:g.WORKER_ID,finished:f});else if(v(this._config.chunk)&&!o){if(this._config.chunk(h,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=h=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(h.data),this._completeResults.errors=this._completeResults.errors.concat(h.errors),this._completeResults.meta=h.meta),this._completed||!f||!v(this._config.complete)||h&&h.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),f||h&&h.meta.paused||this._nextChunk(),h}this._halted=!0},this._sendError=function(n){v(this._config.error)?this._config.error(n):c&&this._config.error&&i.postMessage({workerId:g.WORKER_ID,error:n,finished:!1})}}function N(r){var n;(r=r||{}).chunkSize||(r.chunkSize=g.RemoteChunkSize),U.call(this,r),this._nextChunk=a?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(o){this._input=o,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(n=new XMLHttpRequest,this._config.withCredentials&&(n.withCredentials=this._config.withCredentials),a||(n.onload=ee(this._chunkLoaded,this),n.onerror=ee(this._chunkError,this)),n.open(this._config.downloadRequestBody?"POST":"GET",this._input,!a),this._config.downloadRequestHeaders){var o,f=this._config.downloadRequestHeaders;for(o in f)n.setRequestHeader(o,f[o])}var h;this._config.chunkSize&&(h=this._start+this._config.chunkSize-1,n.setRequestHeader("Range","bytes="+this._start+"-"+h));try{n.send(this._config.downloadRequestBody)}catch(_){this._chunkError(_.message)}a&&n.status===0&&this._chunkError()}},this._chunkLoaded=function(){n.readyState===4&&(n.status<200||400<=n.status?this._chunkError():(this._start+=this._config.chunkSize||n.responseText.length,this._finished=!this._config.chunkSize||this._start>=(o=>(o=o.getResponseHeader("Content-Range"))!==null?parseInt(o.substring(o.lastIndexOf("/")+1)):-1)(n),this.parseChunk(n.responseText)))},this._chunkError=function(o){o=n.statusText||o,this._sendError(new Error(o))}}function ne(r){(r=r||{}).chunkSize||(r.chunkSize=g.LocalChunkSize),U.call(this,r);var n,o,f=typeof FileReader<"u";this.stream=function(h){this._input=h,o=h.slice||h.webkitSlice||h.mozSlice,f?((n=new FileReader).onload=ee(this._chunkLoaded,this),n.onerror=ee(this._chunkError,this)):n=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(h.target.result)},this._chunkError=function(){this._sendError(n.error)}}function ue(r){var n;U.call(this,r=r||{}),this.stream=function(o){return n=o,this._nextChunk()},this._nextChunk=function(){var o,f;if(!this._finished)return o=this._config.chunkSize,n=o?(f=n.substring(0,o),n.substring(o)):(f=n,""),this._finished=!n,this.parseChunk(f)}}function de(r){U.call(this,r=r||{});var n=[],o=!0,f=!1;this.pause=function(){U.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){U.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(h){this._input=h,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){f&&n.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),n.length?this.parseChunk(n.shift()):o=!0},this._streamData=ee(function(h){try{n.push(typeof h=="string"?h:h.toString(this._config.encoding)),o&&(o=!1,this._checkIsFinished(),this.parseChunk(n.shift()))}catch(_){this._streamError(_)}},this),this._streamError=ee(function(h){this._streamCleanUp(),this._sendError(h)},this),this._streamEnd=ee(function(){this._streamCleanUp(),f=!0,this._streamData("")},this),this._streamCleanUp=ee(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function xe(r){var n,o,f,h,_=Math.pow(2,53),F=-_,V=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,K=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,b=this,I=0,p=0,z=!1,y=!1,E=[],d={data:[],errors:[],meta:{}};function D(S){return r.skipEmptyLines==="greedy"?S.join("").trim()==="":S.length===1&&S[0].length===0}function P(){if(d&&f&&(G("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+g.DefaultDelimiter+"'"),f=!1),r.skipEmptyLines&&(d.data=d.data.filter(function(m){return!D(m)})),j()){let m=function(A,$){v(r.transformHeader)&&(A=r.transformHeader(A,$)),E.push(A)};if(d)if(Array.isArray(d.data[0])){for(var S=0;j()&&S(O=>(r.dynamicTypingFunction&&r.dynamicTyping[O]===void 0&&(r.dynamicTyping[O]=r.dynamicTypingFunction(O)),(r.dynamicTyping[O]||r.dynamicTyping)===!0))(Q)?w==="true"||w==="TRUE"||w!=="false"&&w!=="FALSE"&&((O=>{if(V.test(O)&&(O=parseFloat(O),F=E.length?"__parsed_extra":E[C]:T,R=r.transform?r.transform(R,T):R);T==="__parsed_extra"?($[T]=$[T]||[],$[T].push(R)):$[T]=R}return r.header&&(C>E.length?G("FieldMismatch","TooManyFields","Too many fields: expected "+E.length+" fields but parsed "+C,p+A):Cr.preview?o.abort():(d.data=d.data[0],h(d,b))))}),this.parse=function(S,x,L){var m=r.quoteChar||'"',m=(r.newline||(r.newline=this.guessLineEndings(S,m)),f=!1,r.delimiter?v(r.delimiter)&&(r.delimiter=r.delimiter(S),d.meta.delimiter=r.delimiter):((m=((A,$,C,T,R)=>{var Q,w,O,te;R=R||[","," ","|",";",g.RECORD_SEP,g.UNIT_SEP];for(var ie=0;ie=L.length/2?`\r `:"\r"}}function ce(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ye(r){var n=(r=r||{}).delimiter,o=r.newline,f=r.comments,h=r.step,_=r.preview,F=r.fastMode,V=null,K=!1,b=r.quoteChar==null?'"':r.quoteChar,I=b;if(r.escapeChar!==void 0&&(I=r.escapeChar),(typeof n!="string"||-1=_)return q(!0);break}L.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:p}),w++}}else if(f&&m.length===0&&y.substring(p,p+G)===f){if(R===-1)return q();p=R+j,R=y.indexOf(o,p),T=y.indexOf(n,p)}else if(T!==-1&&(T=_)return q(!0)}return J();function te(M){x.push(M),A=p}function ie(M){var H=0;return H=M!==-1&&(M=y.substring(w+1,M))&&M.trim()===""?M.length:H}function J(M){return d||(M===void 0&&(M=y.substring(p)),m.push(M),p=D,te(m),S&&X()),q()}function le(M){p=M,te(m),m=[],R=y.indexOf(o,p)}function q(M){if(r.header&&!E&&x.length&&!K){var H=x[0],Y=Object.create(null),_e=new Set(H);let Te=!1;for(let se=0;sef.charCodeAt(0)!==65279?f:f.slice(1))(r),o=new(n.download?N:ue)(n)):r.readable===!0&&v(r.read)&&v(r.on)?o=new de(n):(i.File&&r instanceof File||r instanceof Object)&&(o=new ne(n)),o.stream(r);(o=(()=>{var f;return!!g.WORKERS_SUPPORTED&&(f=(()=>{var h=i.URL||i.webkitURL||null,_=s.toString();return g.BLOB_URL||(g.BLOB_URL=h.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",_,")();"],{type:"text/javascript"})))})(),(f=new i.Worker(f)).onmessage=Qe,f.id=k++,l[f.id]=f)})()).userStep=n.step,o.userChunk=n.chunk,o.userComplete=n.complete,o.userError=n.error,n.step=v(n.step),n.chunk=v(n.chunk),n.complete=v(n.complete),n.error=v(n.error),delete n.worker,o.postMessage({input:r,config:n,workerId:o.id})},g.unparse=function(r,n){var o=!1,f=!0,h=",",_=`\r `,F='"',V=F+F,K=!1,b=null,I=!1,p=((()=>{if(typeof n=="object"){if(typeof n.delimiter!="string"||g.BAD_DELIMITERS.filter(function(E){return n.delimiter.indexOf(E)!==-1}).length||(h=n.delimiter),typeof n.quotes!="boolean"&&typeof n.quotes!="function"&&!Array.isArray(n.quotes)||(o=n.quotes),typeof n.skipEmptyLines!="boolean"&&typeof n.skipEmptyLines!="string"||(K=n.skipEmptyLines),typeof n.newline=="string"&&(_=n.newline),typeof n.quoteChar=="string"&&(F=n.quoteChar),typeof n.header=="boolean"&&(f=n.header),Array.isArray(n.columns)){if(n.columns.length===0)throw new Error("Option columns is empty");b=n.columns}n.escapeChar!==void 0&&(V=n.escapeChar+F),n.escapeFormulae instanceof RegExp?I=n.escapeFormulae:typeof n.escapeFormulae=="boolean"&&n.escapeFormulae&&(I=/^[=+\-@\t\r].*$/)}})(),new RegExp(ce(F),"g"));if(typeof r=="string"&&(r=JSON.parse(r)),Array.isArray(r)){if(!r.length||Array.isArray(r[0]))return z(null,r,K);if(typeof r[0]=="object")return z(b||Object.keys(r[0]),r,K)}else if(typeof r=="object")return typeof r.data=="string"&&(r.data=JSON.parse(r.data)),Array.isArray(r.data)&&(r.fields||(r.fields=r.meta&&r.meta.fields||b),r.fields||(r.fields=Array.isArray(r.data[0])?r.fields:typeof r.data[0]=="object"?Object.keys(r.data[0]):[]),Array.isArray(r.data[0])||typeof r.data[0]=="object"||(r.data=[r.data])),z(r.fields||[],r.data||[],K);throw new Error("Unable to serialize unrecognized input");function z(E,d,D){var P="",j=(typeof E=="string"&&(E=JSON.parse(E)),typeof d=="string"&&(d=JSON.parse(d)),Array.isArray(E)&&0{for(var S=0;S{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function re(e){const t=[];for(let s=0,i=e.length;sW||e.height>W)&&(e.width>W&&e.height>W?e.width>e.height?(e.height*=W/e.width,e.width=W):(e.width*=W/e.height,e.height=W):e.width>W?(e.height*=W/e.width,e.width=W):(e.width*=W/e.height,e.height=W))}function it(e,t={}){return e.toBlob?new Promise(s=>{e.toBlob(s,t.type?t.type:"image/png",t.quality?t.quality:1)}):new Promise(s=>{const i=window.atob(e.toDataURL(t.type?t.type:void 0,t.quality?t.quality:void 0).split(",")[1]),u=i.length,a=new Uint8Array(u);for(let c=0;c{const i=new Image;i.onload=()=>{i.decode().then(()=>{requestAnimationFrame(()=>t(i))})},i.onerror=s,i.crossOrigin="anonymous",i.decoding="async",i.src=e})}async function st(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function at(e,t,s){const i="http://www.w3.org/2000/svg",u=document.createElementNS(i,"svg"),a=document.createElementNS(i,"foreignObject");return u.setAttribute("width",`${t}`),u.setAttribute("height",`${s}`),u.setAttribute("viewBox",`0 0 ${t} ${s}`),a.setAttribute("width","100%"),a.setAttribute("height","100%"),a.setAttribute("x","0"),a.setAttribute("y","0"),a.setAttribute("externalResourcesRequired","true"),u.appendChild(a),a.appendChild(e),st(u)}const B=(e,t)=>{if(e instanceof t)return!0;const s=Object.getPrototypeOf(e);return s===null?!1:s.constructor.name===t.name||B(s,t)};function ot(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function ut(e,t){return Me(t).map(s=>{const i=e.getPropertyValue(s),u=e.getPropertyPriority(s);return`${s}: ${i}${u?" !important":""};`}).join(" ")}function ct(e,t,s,i){const u=`.${e}:${t}`,a=s.cssText?ot(s):ut(s,i);return document.createTextNode(`${u}{${a}}`)}function Ie(e,t,s,i){const u=window.getComputedStyle(e,s),a=u.getPropertyValue("content");if(a===""||a==="none")return;const c=Ne();try{t.className=`${t.className} ${c}`}catch{return}const l=document.createElement("style");l.appendChild(ct(c,s,u,i)),t.appendChild(l)}function lt(e,t,s){Ie(e,t,":before",s),Ie(e,t,":after",s)}const Le="application/font-woff",Ae="image/jpeg",ht={woff:Le,woff2:Le,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Ae,jpeg:Ae,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function ft(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function Re(e){const t=ft(e).toLowerCase();return ht[t]||""}function dt(e){return e.split(/,/)[1]}function Ee(e){return e.search(/^(data:)/)!==-1}function gt(e,t){return`data:${t};base64,${e}`}async function je(e,t,s){const i=await fetch(e,t);if(i.status===404)throw new Error(`Resource "${i.url}" not found`);const u=await i.blob();return new Promise((a,c)=>{const l=new FileReader;l.onerror=c,l.onloadend=()=>{try{a(s({res:i,result:l.result}))}catch(k){c(k)}},l.readAsDataURL(u)})}const be={};function pt(e,t,s){let i=e.replace(/\?.*/,"");return s&&(i=e),/ttf|otf|eot|woff2?/i.test(i)&&(i=i.replace(/.*\//,"")),t?`[${t}]${i}`:i}async function ke(e,t,s){const i=pt(e,t,s.includeQueryParams);if(be[i]!=null)return be[i];s.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let u;try{const a=await je(e,s.fetchRequestInit,({res:c,result:l})=>(t||(t=c.headers.get("Content-Type")||""),dt(l)));u=gt(a,t)}catch(a){u=s.imagePlaceholder||"";let c=`Failed to fetch resource: ${e}`;a&&(c=typeof a=="string"?a:a.message),c&&console.warn(c)}return be[i]=u,u}async function mt(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):pe(t)}async function yt(e,t){if(e.currentSrc){const a=document.createElement("canvas"),c=a.getContext("2d");a.width=e.clientWidth,a.height=e.clientHeight,c==null||c.drawImage(e,0,0,a.width,a.height);const l=a.toDataURL();return pe(l)}const s=e.poster,i=Re(s),u=await ke(s,i,t);return pe(u)}async function wt(e,t){var s;try{if(!((s=e==null?void 0:e.contentDocument)===null||s===void 0)&&s.body)return await me(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function _t(e,t){return B(e,HTMLCanvasElement)?mt(e):B(e,HTMLVideoElement)?yt(e,t):B(e,HTMLIFrameElement)?wt(e,t):e.cloneNode(ze(e))}const bt=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",ze=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function Et(e,t,s){var i,u;if(ze(t))return t;let a=[];return bt(e)&&e.assignedNodes?a=re(e.assignedNodes()):B(e,HTMLIFrameElement)&&(!((i=e.contentDocument)===null||i===void 0)&&i.body)?a=re(e.contentDocument.body.childNodes):a=re(((u=e.shadowRoot)!==null&&u!==void 0?u:e).childNodes),a.length===0||B(e,HTMLVideoElement)||await a.reduce((c,l)=>c.then(()=>me(l,s)).then(k=>{k&&t.appendChild(k)}),Promise.resolve()),t}function St(e,t,s){const i=t.style;if(!i)return;const u=window.getComputedStyle(e);u.cssText?(i.cssText=u.cssText,i.transformOrigin=u.transformOrigin):Me(s).forEach(a=>{let c=u.getPropertyValue(a);a==="font-size"&&c.endsWith("px")&&(c=`${Math.floor(parseFloat(c.substring(0,c.length-2)))-.1}px`),B(e,HTMLIFrameElement)&&a==="display"&&c==="inline"&&(c="block"),a==="d"&&t.getAttribute("d")&&(c=`path(${t.getAttribute("d")})`),i.setProperty(a,c,u.getPropertyPriority(a))})}function Rt(e,t){B(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),B(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function kt(e,t){if(B(e,HTMLSelectElement)){const s=t,i=Array.from(s.children).find(u=>e.value===u.getAttribute("value"));i&&i.setAttribute("selected","")}}function xt(e,t,s){return B(t,Element)&&(St(e,t,s),lt(e,t,s),Rt(e,t),kt(e,t)),t}async function Ct(e,t){const s=e.querySelectorAll?e.querySelectorAll("use"):[];if(s.length===0)return e;const i={};for(let a=0;a_t(i,t)).then(i=>Et(e,i,t)).then(i=>xt(e,i,t)).then(i=>Ct(i,t))}const qe=/url\((['"]?)([^'"]+?)\1\)/g,vt=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Tt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Ot(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function It(e){const t=[];return e.replace(qe,(s,i,u)=>(t.push(u),s)),t.filter(s=>!Ee(s))}async function Lt(e,t,s,i,u){try{const a=s?Ye(t,s):t,c=Re(t);let l;return u||(l=await ke(a,c,i)),e.replace(Ot(t),`$1${l}$3`)}catch{}return e}function At(e,{preferredFontFormat:t}){return t?e.replace(Tt,s=>{for(;;){const[i,,u]=vt.exec(s)||[];if(!u)return"";if(u===t)return`src: ${i};`}}):e}function He(e){return e.search(qe)!==-1}async function Be(e,t,s){if(!He(e))return e;const i=At(e,s);return It(i).reduce((a,c)=>a.then(l=>Lt(l,c,t,s)),Promise.resolve(i))}async function oe(e,t,s){var i;const u=(i=t.style)===null||i===void 0?void 0:i.getPropertyValue(e);if(u){const a=await Be(u,null,s);return t.style.setProperty(e,a,t.style.getPropertyPriority(e)),!0}return!1}async function Pt(e,t){await oe("background",e,t)||await oe("background-image",e,t),await oe("mask",e,t)||await oe("-webkit-mask",e,t)||await oe("mask-image",e,t)||await oe("-webkit-mask-image",e,t)}async function Ft(e,t){const s=B(e,HTMLImageElement);if(!(s&&!Ee(e.src))&&!(B(e,SVGImageElement)&&!Ee(e.href.baseVal)))return;const i=s?e.src:e.href.baseVal,u=await ke(i,Re(i),t);await new Promise((a,c)=>{e.onload=a,e.onerror=t.onImageErrorHandler?(...k)=>{try{a(t.onImageErrorHandler(...k))}catch(g){c(g)}}:c;const l=e;l.decode&&(l.decode=a),l.loading==="lazy"&&(l.loading="eager"),s?(e.srcset="",e.src=u):e.href.baseVal=u})}async function Dt(e,t){const i=re(e.childNodes).map(u=>We(u,t));await Promise.all(i).then(()=>e)}async function We(e,t){B(e,Element)&&(await Pt(e,t),await Ft(e,t),await Dt(e,t))}function $t(e,t){const{style:s}=e;t.backgroundColor&&(s.backgroundColor=t.backgroundColor),t.width&&(s.width=`${t.width}px`),t.height&&(s.height=`${t.height}px`);const i=t.style;return i!=null&&Object.keys(i).forEach(u=>{s[u]=i[u]}),e}const Pe={};async function Fe(e){let t=Pe[e];if(t!=null)return t;const i=await(await fetch(e)).text();return t={url:e,cssText:i},Pe[e]=t,t}async function De(e,t){let s=e.cssText;const i=/url\(["']?([^"')]+)["']?\)/g,a=(s.match(/url\([^)]+\)/g)||[]).map(async c=>{let l=c.replace(i,"$1");return l.startsWith("https://")||(l=new URL(l,e.url).href),je(l,t.fetchRequestInit,({result:k})=>(s=s.replace(c,`url(${k})`),[c,k]))});return Promise.all(a).then(()=>s)}function $e(e){if(e==null)return[];const t=[],s=/(\/\*[\s\S]*?\*\/)/gi;let i=e.replace(s,"");const u=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const k=u.exec(i);if(k===null)break;t.push(k[0])}i=i.replace(u,"");const a=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,c="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",l=new RegExp(c,"gi");for(;;){let k=a.exec(i);if(k===null){if(k=l.exec(i),k===null)break;a.lastIndex=l.lastIndex}else l.lastIndex=a.lastIndex;t.push(k[0])}return t}async function Ut(e,t){const s=[],i=[];return e.forEach(u=>{if("cssRules"in u)try{re(u.cssRules||[]).forEach((a,c)=>{if(a.type===CSSRule.IMPORT_RULE){let l=c+1;const k=a.href,g=Fe(k).then(U=>De(U,t)).then(U=>$e(U).forEach(N=>{try{u.insertRule(N,N.startsWith("@import")?l+=1:u.cssRules.length)}catch(ne){console.error("Error inserting rule from remote css",{rule:N,error:ne})}})).catch(U=>{console.error("Error loading remote css",U.toString())});i.push(g)}})}catch(a){const c=e.find(l=>l.href==null)||document.styleSheets[0];u.href!=null&&i.push(Fe(u.href).then(l=>De(l,t)).then(l=>$e(l).forEach(k=>{c.insertRule(k,c.cssRules.length)})).catch(l=>{console.error("Error loading remote stylesheet",l)})),console.error("Error inlining remote css file",a)}}),Promise.all(i).then(()=>(e.forEach(u=>{if("cssRules"in u)try{re(u.cssRules||[]).forEach(a=>{s.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${u.href}`,a)}}),s))}function Mt(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>He(t.style.getPropertyValue("src")))}async function jt(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const s=re(e.ownerDocument.styleSheets),i=await Ut(s,t);return Mt(i)}function Ve(e){return e.trim().replace(/["']/g,"")}function zt(e){const t=new Set;function s(i){(i.style.fontFamily||getComputedStyle(i).fontFamily).split(",").forEach(a=>{t.add(Ve(a))}),Array.from(i.children).forEach(a=>{a instanceof HTMLElement&&s(a)})}return s(e),t}async function Ke(e,t){const s=await jt(e,t),i=zt(e);return(await Promise.all(s.filter(a=>i.has(Ve(a.style.fontFamily))).map(a=>{const c=a.parentStyleSheet?a.parentStyleSheet.href:null;return Be(a.cssText,c,t)}))).join(` `)}async function qt(e,t){const s=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Ke(e,t);if(s){const i=document.createElement("style"),u=document.createTextNode(s);i.appendChild(u),e.firstChild?e.insertBefore(i,e.firstChild):e.appendChild(i)}}async function Ge(e,t={}){const{width:s,height:i}=Se(e,t),u=await me(e,t,!0);return await qt(u,t),await We(u,t),$t(u,t),await at(u,s,i)}async function fe(e,t={}){const{width:s,height:i}=Se(e,t),u=await Ge(e,t),a=await pe(u),c=document.createElement("canvas"),l=c.getContext("2d"),k=t.pixelRatio||rt(),g=t.canvasWidth||s,U=t.canvasHeight||i;return c.width=g*k,c.height=U*k,t.skipAutoScale||nt(c),c.style.width=`${g}`,c.style.height=`${U}`,t.backgroundColor&&(l.fillStyle=t.backgroundColor,l.fillRect(0,0,c.width,c.height)),l.drawImage(a,0,0,c.width,c.height),c}async function Ht(e,t={}){const{width:s,height:i}=Se(e,t);return(await fe(e,t)).getContext("2d").getImageData(0,0,s,i).data}async function Bt(e,t={}){return(await fe(e,t)).toDataURL()}async function Wt(e,t={}){return(await fe(e,t)).toDataURL("image/jpeg",t.quality||1)}async function Vt(e,t={}){const s=await fe(e,t);return await it(s)}async function Kt(e,t={}){return Ke(e,t)}const Jt=Object.freeze(Object.defineProperty({__proto__:null,getFontEmbedCSS:Kt,toBlob:Vt,toCanvas:fe,toJpeg:Wt,toPixelData:Ht,toPng:Bt,toSvg:Ge},Symbol.toStringTag,{value:"Module"}));export{Qt as P,Jt as i};