"use strict";var ti=Object.defineProperty;var v=(e,t)=>ti(e,"name",{value:t,configurable:!0});const Be=require("node:process"),j=require("@visulima/colorize"),ii=require("@visulima/find-cache-dir"),S=require("@visulima/fs"),L=require("@visulima/humanizer"),f=require("@visulima/path"),He=require("@visulima/tsconfig"),ni=require("browserslist"),oi=require("defu"),ai=require("hookable"),vt=require("jiti"),pe=require("rollup"),si=require("tinyexec"),Y=require("node:fs/promises"),ri=require("@rollup/plugin-alias"),li=require("@rollup/plugin-commonjs"),pi=require("@rollup/plugin-dynamic-import-vars"),ht=require("@rollup/plugin-node-resolve"),ci=require("@rollup/plugin-replace"),di=require("@rollup/plugin-wasm"),ui=require("rollup-plugin-polyfill-node"),mi=require("rollup-plugin-visualizer"),xe=require("semver"),fi=require("node:assert/strict"),U=require("@rollup/pluginutils"),gi=require("magic-string"),vi=require("glob-parent"),he=require("tinyglobby"),Se=require("@visulima/path/utils"),yt=require("./packem_shared/index-B4tUSomc.cjs"),hi=require("source-map-js"),Te=require("./packem_shared/sourcemap-CXAd1Jcz.cjs"),_=require("./packem_shared/Mime-BsyBfmma.cjs"),Ce=require("./packem_shared/ensure-auto-modules-DBW-5Idh.cjs"),te=require("mlly"),yi=require("oxc-parser"),E=require("./packem_shared/constants-C98jAkyM.cjs"),xi=require("@rollup/plugin-json"),bi=require("rollup-plugin-license"),xt=require("./packem_shared/create-or-update-key-storage-DOolYH4A.cjs"),be=require("node:fs"),ye=require("node:module"),wi=require("node:url"),ki=require("@visulima/source-map"),ji=require("@babel/parser"),$i=require("node:crypto"),Ei=require("child_process"),Si=require("@visulima/package/package-json"),Oi=require("@visulima/fs/error"),Pi=require("fastest-levenshtein");var ee=typeof document<"u"?document.currentScript:null;const T=v(e=>e&&typeof e=="object"&&"default"in e?e.default:e,"_interopDefaultCompat"),Me=T(Be),Di=T(ni),bt=T(ri),Ni=T(li),_i=T(pi),wt=T(ci),Ci=T(ui),we=T(fi),G=T(gi),Mi=T(vi),Ai=T(xi),Fi=T(bi),Ge=T(ye),Ii=T($i),Ti=T(Ei);var zi=Object.defineProperty,Ri=v((e,t)=>zi(e,"name",{value:t,configurable:!0}),"a$n");const le=Ri(e=>e==null?[]:Array.isArray(e)?e:[e],"arrayify");var qi=Object.defineProperty,kt=v((e,t)=>qi(e,"name",{value:t,configurable:!0}),"s$g");const Ji=kt((e,t,i)=>{const n=i??new Map;return(...o)=>{const a=t?typeof t=="function"?t(...o):t:JSON.stringify({args:o}),s=n.get(a);if(s!==void 0)return s;const r=e(...o);return n.set(a,r),r}},"memoize"),Bi=kt(e=>{const t=new Map;return i=>Ji(e,i,t)},"memoizeByKey");var Wi=Object.defineProperty,ce=v((e,t)=>Wi(e,"name",{value:t,configurable:!0}),"r$e");const Li=ce(function*(e){switch(e.declaration?.type){case"ClassDeclaration":case"FunctionDeclaration":{const{id:t}=e.declaration;we(t,"Expected class/function to have a name"),yield t.name;break}case"VariableDeclaration":{for(const t of e.declaration.declarations)for(const i of U.extractAssignedNames(t.id))yield i;break}}},"exportName"),Ui=ce(function*(e){if(e.declaration)for(const t of Li(e))yield{exportedName:t,from:"self",type:"named"};else if(e.source)yield{bindings:e.specifiers.map(t=>({exportedName:t.exported.name,importedName:t.local.name})),from:"other",source:e.source.value,type:"named"};else for(const t of e.specifiers)yield{exportedName:t.exported.name,from:"self",type:"named"}},"parseExportNamed"),Ki=ce(function*(e){e.exported?yield{exportedName:e.exported.name,from:"self",type:"named"}:yield{from:"other",source:e.source.value,type:"barrel"}},"parseExportAll"),Vi=ce(function*(){yield{exportedName:"default",from:"self",type:"named"}},"parseExportDefault"),Hi=ce(function*(e,t){we(t.code!=null,`Module ${t.id} doesn't have associated code`);const i=e.parse(t.code);for(const n of i.body)switch(n.type){case"ExportAllDeclaration":{yield*Ki(n);break}case"ExportDefaultDeclaration":{yield*Vi();break}case"ExportNamedDeclaration":{yield*Ui(n);break}}},"parseExports");var Gi=Object.defineProperty,de=v((e,t)=>Gi(e,"name",{value:t,configurable:!0}),"n$b");const jt=de(async function(e,t,i){const n=await e.resolve(t,i.id);if(we(n,`Rollup can't resolve ${t} from ${i.id}`),n.external)return null;const o=await e.load(n);return we(o,`Rollup doesn't have a module for id ${n.id}`),o},"getImportedModule"),Yi=de(async function*(e,t,i){const n=await jt(e,t.source,i);n&&(yield*We(e,n))},"gatherBarrelReExports"),Qi=de(async function*(e,t,i){const n=await jt(e,t.source,i);if(!n)return;const o=new Map(t.bindings.map(a=>[a.importedName,a]));for await(const a of We(e,n)){const s=o.get(a.exportedName);s&&(yield{...a,exportedName:s.exportedName})}},"gatherNamedReExports"),Zi=de(async function*(e,t){yield{exportedName:t.exportedName,id:e.id,sourceName:t.exportedName}},"gatherNamedSelfExports"),We=de(async function*(e,t){for(const i of Hi(e,t))i.from==="self"?yield*Zi(t,i):i.type==="barrel"?yield*Yi(e,i,t):yield*Qi(e,i,t)},"gatherExports");var Xi=Object.defineProperty,en=v((e,t)=>Xi(e,"name",{value:t,configurable:!0}),"r$d");const tn=en(()=>({moduleParsed:{async handler(e){if(e.isEntry)for await(const t of We(this,e))t.id!==e.id&&this.emitFile({id:t.id,name:t.exportedName,preserveSignature:"exports-only",type:"chunk"})},order:"post"},name:"packem:chunk-splitter"}),"chunkSplitter");var nn=Object.defineProperty,on=v((e,t)=>nn(e,"name",{value:t,configurable:!0}),"r$c");const an=on((e,t)=>{const i=e,n=[];let o;for(;(o=i.exec(t))!==null;)o.index===i.lastIndex&&i.lastIndex++,o.forEach(a=>{n.push(a)});return n.filter(Boolean)},"getRegexMatches");var sn=Object.defineProperty,rn=v((e,t)=>sn(e,"name",{value:t,configurable:!0}),"a$m");const $t=rn(e=>{const t=an(/export\s(\{\s(.*)\s\}|default\s.*);/g,e);if(t.length===0)return null;const i=t.at(-1).split(", ");let n="";for(const o of i)if(!o.includes("type")&&(o.includes("default ")&&(n=o.split("default ")[1]),o.includes("as"))){const[a,s]=o.split(" as ");s==="default"&&(n=a)}if(n!==""){const o=new G(e);return o.replace(new RegExp(`(,s)?${n} as default(,)?`),""),o.replace(new RegExp(`export default ${n}; ?`),""),o.append(` export = `+n+";"),{code:o.toString().replace(/export\s\{\s\s\};/,""),map:o.generateMap({hires:!0})}}return null},"patchCjsDefaultExport");var ln=Object.defineProperty,Ye=v((e,t)=>ln(e,"name",{value:t,configurable:!0}),"i$b");const Et=Ye(({addDefaultProperty:e=!1,logger:t,type:i})=>({name:"packem:cjs-interop",renderChunk:Ye(async(n,o,a)=>{if(o.type!=="chunk"||!o.isEntry)return null;if(a.format==="cjs"&&a.exports==="auto"){const s=/(exports(?:\['default'\]|\.default)) = (.*);/i.exec(n);if(s===null||s.length<3)return null;const r=new G(n);r.replace("",""),r.replaceAll(/exports\.(.*) = (.*);/g,"module.module.exports.$1 = $2;"),e&&r.append(` module.module.exports = `+s[2]+";");let p=r.toString();return p=p.replace(/(?:module\.)?exports(?:\['default'\]|\.default)/i,"module.exports"),t.debug({message:"Applied CommonJS interop to entry chunk "+o.fileName+".",prefix:"plugin:cjs-interop"}),{code:p,map:r.generateMap({hires:!0})}}return a.format==="es"&&/\.d\.(?:ts|cts)$/.test(o.fileName)?i!=="commonjs"&&o.fileName.endsWith(".d.mts")?null:$t(n):null},"renderChunk")}),"cjsInteropPlugin");var pn=Object.defineProperty,cn=v((e,t)=>pn(e,"name",{value:t,configurable:!0}),"f$f");const dn=cn((e,t)=>{const i=new Map,n={copyOnce:!0,exactFileNames:!0,flatten:!1,...e};let{targets:o}=n;return Array.isArray(o)?o=o.map(a=>{if(typeof a=="string")return{src:a};if(typeof a=="object"&&"src"in a)return a}).filter(Boolean):typeof o=="string"&&(o=[{src:o}]),{async buildStart(){const a=await Promise.all(o.flatMap(s=>Array.isArray(s.src)?s.src.map(r=>({...s,src:r})):s).map(async s=>await he.glob(le(s.src),{ignore:le(s.exclude).filter(Boolean)}).then(r=>({dest:s.dest??"",parent:Mi(s.src),src:r}))));for(const s of a)for(const r of s.src){let p;i.has(r)?p=i.get(r):(p={copied:[],dest:[],timestamp:0},i.set(r,p));const l=n.flatten?f.normalize(s.dest):f.join(s.dest,f.relative(s.parent,f.dirname(r)));p.dest.includes(l)||p.dest.push(l),this.addWatchFile(r)}t.info({message:"Copying files...",prefix:"plugin:copy"}),await Promise.all([...i].map(async([s,r])=>{let p;try{const l=await Y.stat(s);if(!l.isFile())return;const c=l.mtime.getTime();c>r.timestamp&&(r.timestamp=c,r.copied=[]),p=await S.readFile(s,{buffer:!0})}catch(l){t.error({context:[l],message:`error reading file ${s}`,prefix:"plugin:copy"});return}for(const l of r.dest){if(n.copyOnce&&r.copied.includes(l))continue;const c=f.basename(s),u=f.join(l,c);try{this.emitFile({[n.exactFileNames?"fileName":"name"]:u,source:p,type:"asset"}),t.debug({message:`copied ${s} → ${u}`,prefix:"plugin:copy"}),r.copied.push(l)}catch(d){t.error({context:[d],message:`error copying file ${s} → ${u}`,prefix:"plugin:copy"})}}}))},name:"packem:copy"}},"copyPlugin");var un=Object.defineProperty,mn=v((e,t)=>un(e,"name",{value:t,configurable:!0}),"r$b");const Qe=mn((e,t)=>{if(!t)return!1;if(typeof t=="function")return t(e);if(typeof t.test=="function")return t.test(e);throw new Error("Invalid condition type")},"matchFile");var fn=Object.defineProperty,gn=v((e,t)=>fn(e,"name",{value:t,configurable:!0}),"a$l");const vn=4,hn=process.env.UV_THREADPOOL_SIZE?Number.parseInt(process.env.UV_THREADPOOL_SIZE,10):vn;let yn=class{static{v(this,"f")}static{gn(this,"LoaderManager")}test;loaders=new Map;options;workQueue;logger;constructor({extensions:t,loaders:i,logger:n,options:o}){this.test=a=>t.some(s=>a.toLowerCase().endsWith(s)),i.length>0&&this.add(...i),this.options=o,this.logger=n}add(...t){for(const i of t)this.loaders.has(i.name)||this.loaders.set(i.name,i)}isSupported(t){if(this.test(t))return!0;for(const[,i]of this.loaders)if(Qe(t,i.test))return!0;return!1}async process(t,i){this.workQueue||(this.workQueue=new yt.d({concurrency:hn-1}));for await(const[n,o]of this.loaders){const a={...i,options:this.options[n]??{}};if(o.alwaysProcess||Qe(a.id,o.test)){this.logger.debug(`Processing ${n} loader for ${a.id}`);const s=await this.workQueue.add(o.process.bind(a,t));s&&(t=s)}}return t}};var xn=Object.defineProperty,bn=v((e,t)=>xn(e,"name",{value:t,configurable:!0}),"u$c");const wn=bn(async e=>{const t=new hi.SourceMapGenerator({file:""}),i=[];let n=0;for await(const{css:o,map:a}of e){i.push(o);const s=Te.m(a),r=s.toObject();if(!r)continue;const p=s.toConsumer();if(p){if(p.eachMapping(l=>{t.addMapping({generated:{column:l.generatedColumn,line:n+l.generatedLine},name:l.name,original:{column:l.originalColumn,line:l.originalLine},source:l.source})}),r.sourcesContent)for(const l of r.sources)t.setSourceContent(l,p.sourceContentFor(l,!0));n+=o.split(` `).length}}return{css:i.join(` `),map:t}},"concat");var kn=Object.defineProperty,oe=v((e,t)=>kn(e,"name",{value:t,configurable:!0}),"b$3");const jn=oe(async(e,t)=>e.sort((i,n)=>t.indexOf(i.name)-t.indexOf(n.name)),"sortByNameOrder"),$n=oe(async(e,t,i,n,o,a,s,r,p,l)=>{const c={...l,...e.alias},u=U.createFilter(e.include,e.exclude),d=_.i(e.sourceMap),m={..._.a(e.mode),autoModules:e.autoModules??!1,dts:e.dts,extensions:e.extensions,namedExports:e.namedExports};typeof m.inject=="object"&&m.inject.treeshakeable&&(m.namedExports=!1,t.info({message:"Disabling named exports due to `inject.treeshakeable` option",prefix:"css"}));let w=!1;if(e.loaders)for(const h of e.loaders)h.name==="postcss"&&(w=!0);else e.loaders=[];w&&(m.postcss={...e.postcss,config:_.b(e.postcss?.config,{}),import:_.c(e.postcss?.import,c),modules:_.b(e.postcss?.modules,void 0),to:e.postcss?.to,url:_.c(e.postcss?.url,c)},e.postcss?.parser&&(m.postcss.parser=await _.e(e.postcss.parser,"parser",n)),e.postcss?.syntax&&(m.postcss.syntax=await _.e(e.postcss.syntax,"syntax",n)),e.postcss?.stringifier&&(m.postcss.stringifier=await _.e(e.postcss.stringifier,"stringifier",n)),e.postcss?.plugins&&(m.postcss.plugins=await _.d(e.postcss.plugins,n)));const k=new yn({extensions:m.extensions,loaders:await jn(e.loaders,["sourcemap","stylus","less","sass","postcss"]),logger:t,options:{...e,...m,alias:c}});let x=[];const g=oe((h,b)=>{const $=[];for(const y of Object.keys(h)){const P=new Set;let A=[y];do{const J=[];for(const z of A){if(P.has(z))continue;if(k.isSupported(z)){u(z)&&J.push(z);continue}P.add(z);const Z=b(z);Z&&J.push(...Z.importedIds)}A=J}while(A.some(J=>!k.isSupported(J)));$.push(...A)}return $},"traverseImportedModules");return{augmentChunkHash(h){if(x.length===0)return null;const b=g(h.modules,this.getModuleInfo),$=x.filter(y=>b.includes(y.id)).sort((y,P)=>b.lastIndexOf(y.id)-b.lastIndexOf(P.id)).map(y=>`${f.basename(y.id)}:${y.css}`);return $.length===0?null:$.join(":")},async generateBundle(h,b){if(x.length===0||!(h.dir||h.file))return;const $=Object.values(b),y=h.dir??f.dirname(h.file),P=$.filter(D=>D.type==="chunk"),A=P.filter(D=>!D.facadeModuleId),J=h.preserveModules?P:P.filter(D=>D.isEntry||D.isDynamicEntry),z=[],Z=oe(async(D,C)=>{const O=typeof m.extract=="string"?f.normalize(m.extract).replace(/^\.[/\\]/,""):f.normalize(`${D}.css`);f.isAbsolute(O)&&this.error(["Extraction path must be relative to the output directory,",`which is ${f.relative(n,y)}`].join(` `)),Se.isRelative(O)&&this.error(["Extraction path must be nested inside output directory,",`which is ${f.relative(n,y)}`].join(` `));const B=x.filter(W=>C.includes(W.id)).sort((W,X)=>C.lastIndexOf(W.id)-C.lastIndexOf(X.id)),ue=await wn(B);return{css:ue.css,map:Te.m(ue.map.toString()).relative(f.dirname(f.resolve(y,O))).toString(),name:O}},"getExtractedData"),R=oe(D=>{if(h.file)return f.parse(h.file).name;if(h.preserveModules){const{dir:C,name:O}=f.parse(D.fileName);return C?f.join(C,O):O}return D.name},"getName"),V=[];if(typeof m.extract=="string"){t.debug({message:`Extracting to ${m.extract}`,prefix:"css"});const D=[];for(const O of A){const B=g(O.modules,this.getModuleInfo);V.push(...B),D.push(...B)}for(const O of J)D.push(...g(O.modules,this.getModuleInfo).filter(B=>!V.includes(B)));const C=R(P[0]);z.push([C,D])}else{t.debug({message:"Extracting to individual files",prefix:"css"});for(const D of A){const C=g(D.modules,this.getModuleInfo);if(C.length===0)continue;V.push(...C);const O=R(D);z.push([O,C])}for(const D of J){const C=g(D.modules,this.getModuleInfo).filter(B=>!V.includes(B));if(C.length===0)continue;const O=R(D);z.push([O,C])}}for await(const[D,C]of z){const O=await Z(D,C);if(typeof e.onExtract=="function"&&!e.onExtract(O))continue;if(p&&e.minifier){t.info({message:`Minifying ${O.name} with ${e.minifier.name}`,prefix:"css"});const{css:W,map:X}=await e.minifier.handler.bind({browserTargets:i,warn:this.warn.bind(this)})(O,d,e[e.minifier.name]??{});O.css=W,O.map=X}const B={fileName:O.name,name:O.name,names:[O.name],originalFileName:O.name,originalFileNames:[O.name],source:O.css,type:"asset"},ue=this.emitFile(B);if(O.map&&d){const W=this.getFileName(ue),X=typeof h.assetFileNames=="string"?f.normalize(f.dirname(h.assetFileNames)):typeof h.assetFileNames=="function"?f.normalize(f.dirname(h.assetFileNames(B))):"assets",ie=Te.m(O.map).modify(M=>(M.file=f.basename(W),M)).modifySources(M=>{if(M===""||X.length<=1)return M;M=`../${M}`;for(const _e of X)_e==="/"&&(M=`../${M}`);return M});if(d.inline)ie.modify(M=>d.transform?.(M,f.normalize(f.join(y,W)))),b[W].source+=ie.toCommentData();else{const M=`${W}.map`;ie.modify(ei=>d.transform?.(ei,f.normalize(f.join(y,M)))),this.emitFile({fileName:M,source:ie.toString(),type:"asset"});const{base:_e}=f.parse(M);b[W].source+=ie.toCommentFile(_e)}}}},name:"packem:css",async transform(h,b){if(!u(b)||!k.isSupported(b)||h.replaceAll(/\s/g,"")==="")return null;try{return this.parse(h,{}),this.warn(`Skipping processed file ${f.relative(n,b)}`),null}catch{}typeof e.onImport=="function"&&e.onImport(h,b);const $={alias:c,assets:new Map,autoModules:m.autoModules,browserTargets:i,cwd:n,debug:r,deps:new Set,dts:m.dts,emit:m.emit,environment:a,extensions:m.extensions,extract:m.extract,id:b,inject:m.inject,logger:t,namedExports:m.namedExports,options:{},plugin:this,sourceDir:o,sourceMap:d,useSourcemap:s,warn:this.warn.bind(this)},y=await k.process({code:h},$);for(const P of $.deps)this.addWatchFile(P);for(const[P,A]of $.assets)this.emitFile({fileName:P,source:A,type:"asset"});if(y.extracted){const{id:P}=y.extracted;x=x.filter(A=>A.id!==P),x.push(y.extracted)}return{code:y.code,map:d&&y.map?y.map:{mappings:""},meta:{styles:y.meta},moduleSideEffects:y.extracted?!0:null}}}},"default");var En=Object.defineProperty,Sn=v((e,t)=>En(e,"name",{value:t,configurable:!0}),"u$b");const On=` /* eslint-disable */ /* prettier-ignore */ // @ts-nocheck /** * Generated by packem * @see https://npmjs.com/@visulima/packem */ `.trim(),Pn=Sn((e,t,i)=>{let n;return e.postcss&&typeof e.postcss.modules=="boolean"?n=e.postcss.modules:e.lightningcss&&typeof e.lightningcss.modules=="boolean"&&(n=e.lightningcss.modules),{async transform(o,a){let s=n;if(e.postcss&&typeof e.postcss.modules=="object"?s=Ce.n(e.postcss.modules.include,a):e.lightningcss&&typeof e.lightningcss.modules=="object"&&(s=Ce.n(e.lightningcss.modules.include,a)),e.autoModules&&s===void 0&&(s=Ce.n(e.autoModules,a)),!s)return null;const{types:r}=this.getModuleInfo(a)?.meta.styles??{};return r===void 0||await S.isAccessible(a)&&(await S.writeFile(a+".d.ts",`${On} ${r}`),i.info({message:`Generated types for ${f.normalize(a).replace(t+"/","")}`,prefix:"dts:css-modules"}),this.addWatchFile(a+".d.ts")),null}}},"cssModulesTypes");var Dn=Object.defineProperty,Oe=v((e,t)=>Dn(e,"name",{value:t,configurable:!0}),"t$a");const Nn=/\Wrequire(?:\.resolve)?\(/,_n=Oe((e,t)=>{if(Be.env.INTERNAL_PACKEM_BUILD!=="1"&&(e.includes("// -- packem CommonJS __filename shim")||e.includes("// -- packem CommonJS __dirname shim")||e.includes("// -- packem CommonJS require shim")))return null;let i=!1,n=!1,o=!1;if(e.includes("__filename")&&(i=!0),e.includes("__dirname")&&(n=!0),Nn.test(e)&&(o=!0),!i&&!n&&!o)return null;const a=te.findStaticImports(e).pop(),s=a?a.end:0,r=new G(e);return r.appendRight(s,t(i,n,o)),{code:r.toString(),map:r.generateMap()}},"CJSToESM"),Cn=Oe((e,t,i)=>{let n="";return(e||t)&&(n+=`import __cjs_url__ from "node:url"; // -- packem CommonJS __filename shim -- `),t&&(n+=`import __cjs_path__ from "node:path"; // -- packem CommonJS __dirname shim -- `),i&&(n+=`import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim -- `),(e||t)&&(n+=`const __filename = __cjs_url__.fileURLToPath(import.meta.url); `),t&&(n+=`const __dirname = __cjs_path__.dirname(__filename); `),i&&(n+=`const require = __cjs_mod__.createRequire(import.meta.url); `),n},"generateCJSShim"),Mn=Oe((e,t,i)=>{let n="";return i&&(n+=`import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim -- `),e&&(n+=`const __filename = import.meta.filename; // -- packem CommonJS __filename shim -- `),t&&(n+=`const __dirname = import.meta.dirname; // -- packem CommonJS __dirname shim -- `),i&&(n+=`const require = __cjs_mod__.createRequire(import.meta.url); `),n},"generateCJSShimNode20_11"),An=Oe((e,t)=>{const i=U.createFilter(t.include,t.exclude);return{name:"packem:esm-shim-cjs-syntax",renderChunk(n,o,a){if(a.format==="es"&&i(o.fileName)){let s=Cn;if(e.engines?.node){const r=xe.minVersion(e.engines.node);r&&r.major>=20&&r.minor>=11&&(s=Mn)}return _n(n,s)}return null}}},"esmShimCjsSyntaxPlugin");var Fn=Object.defineProperty,In=v((e,t)=>Fn(e,"name",{value:t,configurable:!0}),"m$9");const Tn=In(()=>({name:"packem:fix-dynamic-import-extension",renderChunk(e,t,i){return i.format==="es"||i.format==="cjs"?{code:e.replaceAll(/(import\(.*)(.ts)(['´"`]\))/g,"$1."+(i.format==="es"?"mjs":"cjs")+"$3"),map:null}:null}}),"fixDynamicImportExtension");var zn=Object.defineProperty,Rn=v((e,t)=>zn(e,"name",{value:t,configurable:!0}),"e$7");const Ze=/^([\w-]+):/,Xe=Rn(e=>{if(!e||typeof e!="string")throw new Error("Invalid key: Key must be a non-empty string.");const t=[],i=Ze.exec(e);i&&(t.push(i[1]),e=e.replace(Ze,""));const n=e.split("/");for(const o of n)(o.includes("*")||o)&&t.push(o);return t},"splitTsconfigPathKey");var qn=Object.defineProperty,Jn=v((e,t)=>qn(e,"name",{value:t,configurable:!0}),"h$2");const Bn=Jn((e,t)=>{const i=e.replace(/^\.\//,""),n=t.replace(/^\.\//,"");if(n.startsWith(i))return e+n.slice(i.length);if(e.endsWith(t))return e;const o=Xe(e),a=Xe(t);let s=o.length-1,r=a.length-1;for(;s>=0&&r>=0&&o[s]===a[r];)s--,r--;let p=o.slice(0,s).join("/");const l=a.slice(r).join("/");return(!p.startsWith(".")||p==="")&&(p="./"+p),p+(l?"/"+l:"")},"extendString");var Wn=Object.defineProperty,Ln=v((e,t)=>Wn(e,"name",{value:t,configurable:!0}),"s$d");const Un=Ln((...e)=>{if(e.length===0)return"";if(e.length===1)return f.dirname(e[0]);e=e.map(o=>f.toNamespacedPath(o));const[t,...i]=e;let n=t.split("/");for(const o of i){const a=o.split("/",n.length);let s=0;for(const r of a)if(r===n[s])s+=1;else{n=n.slice(0,s);break}n=n.slice(0,s)}return n.length<=1&&n[0]===""?`/${n[0]}`:n.join("/")},"lowestCommonAncestor");var Kn=Object.defineProperty,Ae=v((e,t)=>Kn(e,"name",{value:t,configurable:!0}),"m$7");const Vn=Ae((e,t,i,n,o,a)=>{const s=U.createFilter(o.include,o.exclude),r={},p=Ae((u,d)=>{r[u.replace(E.E,"")]=d},"addOutput");let l=[];a?.config.compilerOptions&&(l=Object.entries(a.config.compilerOptions.paths??{}).map(([u])=>u.endsWith("*")?new RegExp(`^${u.replace("*","(.*)")}$`):new RegExp(`^${u}$`)));async function c(u,d){if(!s(d))return;let m;try{m=(await yi.parseAsync(u,{sourceFilename:d})).program}catch{}if(m){const g=m.body.filter(h=>h.type==="ImportDeclaration"||h.type==="ExportAllDeclaration"||h.type==="ExportNamedDeclaration");for await(const h of g){if(!h.source||f.basename(h.source.value).includes("."))continue;const b=await this.resolve(h.source.value,d);if(!(!b||b.external)&&(b.id.endsWith(".ts")||b.id.endsWith(".cts")||b.id.endsWith(".mts")||b.id.endsWith(".tsx")||b.id.endsWith(".ctsx")||b.id.endsWith(".mtsx"))){const $=b.id.replace(e+"/","");let y=h.source.value;l.some(P=>P.test(h.source.value))&&!h.source.value.startsWith(".")&&(y="./"+h.source.value),u=u.replaceAll('from "'+h.source.value+'"','from "'+Bn(y,$)+'"')}}}const{errors:w,sourceText:k}=await t(d,u);if(w.length>0){if(o.ignoreErrors){this.warn(w[0]);return}return this.error(w[0])}if(p(d,k),!m)return;const x=m.body.filter(g=>g.type==="ImportDeclaration"?g.importKind==="type"?!0:g.specifiers?.every(h=>h.type==="ImportSpecifier"&&h.importKind==="type"):g.type==="ExportNamedDeclaration"||g.type==="ExportAllDeclaration"?g.exportKind==="type"?!0:g.type==="ExportNamedDeclaration"&&g.specifiers?.every(h=>h.type==="ExportSpecifier"&&h.exportKind==="type"):!1);for await(const g of x){if(!g.source)continue;const h=await this.resolve(g.source.value,d);if(!h)return;const b=h.id;if(s(b)&&!r[b.replace(E.E,"")])try{const $=await S.readFile(b);await c.call(this,$,b)}catch{}}}return v(c,"N"),Ae(c,"transform"),{name:"packem:isolated-declarations",async renderStart(u,{input:d}){const m=Un(...Array.isArray(d)?d:Object.values(d));typeof u.entryFileNames=="function"&&(u.entryFileNames=u.entryFileNames({name:u.name}));const w=u.entryFileNames.replace(/\.(.)?[jt]sx?$/,(k,x)=>`.d.${x||""}ts`);for await(let[k,x]of Object.entries(r)){if(n&&u.format==="cjs"){const h=$t(x);h!==null&&(x=h.code)}const g=x.includes("from '")?"'":'"';(i===!0||i==="compatible")&&u.format==="cjs"&&this.emitFile({fileName:w.replace("[name]",f.relative(m,k)).replace(".cts",".ts"),source:x.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(h,b,$,y)=>b+g+(y||$)+".d.ts"+g+";"),type:"asset"}),this.emitFile({fileName:w.replace("[name]",f.relative(m,k)),source:x.replaceAll(/(from\s)['|"]((.*)\..+|['|"].*)['|"];?/g,(h,b,$,y)=>b+g+(y||$)+(u.format==="cjs"?".d.cts":".d.mts")+g+";"),type:"asset"})}},transform:c}},"isolatedDeclarationsPlugin");var Hn=Object.defineProperty,Gn=v((e,t)=>Hn(e,"name",{value:t,configurable:!0}),"n$9");const et="export default ",St=Gn(e=>{const t=Ai(e);return{...t,name:"packem:json",transform(i,n){const o=t.transform?.call(this,i,n);return o&&typeof o!="string"&&"code"in o&&o.code?.startsWith(et)&&(o.code=o.code.replace(et,"module.exports = ")),o}}},"JSONPlugin");var Yn=Object.defineProperty,me=v((e,t)=>Yn(e,"name",{value:t,configurable:!0}),"i$8");class Ot{static{v(this,"WalkerBase")}static{me(this,"WalkerBase")}constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:me(()=>this.should_skip=!0,"skip"),remove:me(()=>this.should_remove=!0,"remove"),replace:me(t=>this.replacement=t,"replace")}}replace(t,i,n,o){t&&i&&(n!=null?t[i][n]=o:t[i]=o)}remove(t,i,n){t&&i&&(n!=null?t[i].splice(n,1):delete t[i])}}var Qn=Object.defineProperty,ae=v((e,t)=>Qn(e,"name",{value:t,configurable:!0}),"c$g");class Zn extends Ot{static{v(this,"SyncWalker")}static{ae(this,"SyncWalker")}constructor(t,i){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:ae(()=>this.should_skip=!0,"skip"),remove:ae(()=>this.should_remove=!0,"remove"),replace:ae(n=>this.replacement=n,"replace")},this.enter=t,this.leave=i}visit(t,i,n,o){if(t){if(this.enter){const s=this.should_skip,r=this.should_remove,p=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,t,i,n,o),this.replacement&&(t=this.replacement,this.replace(i,n,o,t)),this.should_remove&&this.remove(i,n,o);const l=this.should_skip,c=this.should_remove;if(this.should_skip=s,this.should_remove=r,this.replacement=p,l)return t;if(c)return null}let a;for(a in t){const s=t[a];if(s&&typeof s=="object")if(Array.isArray(s)){const r=s;for(let p=0;pXn(e,"name",{value:t,configurable:!0}),"c$f");class eo extends Ot{static{v(this,"AsyncWalker")}static{se(this,"AsyncWalker")}constructor(t,i){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:se(()=>this.should_skip=!0,"skip"),remove:se(()=>this.should_remove=!0,"remove"),replace:se(n=>this.replacement=n,"replace")},this.enter=t,this.leave=i}async visit(t,i,n,o){if(t){if(this.enter){const s=this.should_skip,r=this.should_remove,p=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,await this.enter.call(this.context,t,i,n,o),this.replacement&&(t=this.replacement,this.replace(i,n,o,t)),this.should_remove&&this.remove(i,n,o);const l=this.should_skip,c=this.should_remove;if(this.should_skip=s,this.should_remove=r,this.replacement=p,l)return t;if(c)return null}let a;for(a in t){const s=t[a];if(s&&typeof s=="object")if(Array.isArray(s)){const r=s;for(let p=0;pto(e,"name",{value:t,configurable:!0}),"a$h");function Le(e,{enter:t,leave:i}){return new Zn(t,i).visit(e,null)}v(Le,"walk");Pt(Le,"walk");async function io(e,{enter:t,leave:i}){return await new eo(t,i).visit(e,null)}v(io,"asyncWalk");Pt(io,"asyncWalk");var no=Object.defineProperty,oo=v((e,t)=>no(e,"name",{value:t,configurable:!0}),"u$9");const ao=oo(({attributes:e,logger:t})=>{const i=U.createFilter([/\.[tj]sx$/],/node_modules/);if(!Array.isArray(e)||e.length===0)throw new Error("[packem:jsx-remove-attributes]: attributes must be a non-empty array of strings.");return{name:"packem:jsx-remove-attributes",transform(n,o){if(!i(o))return null;let a=null;try{a=this.parse(n,{allowReturnOutsideFunction:!0})}catch(p){return this.warn({code:"PARSE_ERROR",message:`[packem:jsx-remove-attributes]: failed to parse "${o}" and remove the jsx attribute.`}),t.warn(p),null}let s=!1;const r=new G(n);return Le(a,{enter(p){if(p.type==="CallExpression"&&p.callee.type==="Identifier"&&p.callee.name==="jsx"){const l=p.arguments.filter(c=>c.type==="ObjectExpression"&&Array.isArray(c.properties));for(const c of l)for(const u of c.properties)u.type==="Property"&&u.key.type==="Literal"&&u.value.type==="Literal"&&e.includes(u.key.value)&&(r.overwrite(u.start-2,u.end,""),s=!0)}}}),s?{code:r.toString(),map:r.generateMap({hires:!0})}:null}}},"jsxRemoveAttributes");var so=Object.defineProperty,Dt=v((e,t)=>so(e,"name",{value:t,configurable:!0}),"d$a");const ro=Dt(e=>{const t=[],i=[];return e.forEach(n=>{n.startsWith("(")?t.push(n):i.push(n)}),[...i.sort(),...t.sort()]},"sortLicenses"),Nt=Dt(({dtsMarker:e,licenseFilePath:t,licenseTemplate:i,logger:n,marker:o,mode:a,packageName:s})=>Fi({thirdParty(r){const p=new Set,l=r.sort(({name:u},{name:d})=>(u||0)>(d||0)?1:(d||0)>(u||0)?-1:0).map(({author:u,contributors:d,license:m,licenseText:w,maintainers:k,name:x,repository:g})=>{let h="## "+x+` `;m&&(h+=`License: ${m} `);const b=new Set;for(const $ of[u,...k,...d]){const y=typeof $=="string"?$:$?.name;y&&b.add(y)}return b.size>0&&(h+=`By: ${[...b].join(", ")} `),g&&(h+=`Repository: ${typeof g=="string"?g:g.url} `),w&&(h+=` `+w.trim().replaceAll(/\r\n|\r/g,` `).replaceAll(``,"").replaceAll(e?``:"","").replaceAll(``,"").replaceAll(e?``:"","").trim().split(` `).map($=>$?`> ${$}`:">").join(` `)+` `),m&&p.add(m),h}).join(` --------------------------------------- `);if(l===""){n.info({message:"No dependencies license information found.",prefix:"plugin:license:"+a});return}const c=i(ro(p),l,s);try{const u=S.readFileSync(t),d=xt.g(u,o,c);if(!d){n.error({message:`Could not find the license marker: in ${t}`,prefix:"plugin:license:"+a});return}u!==d&&(S.writeFileSync(t,d),n.info({message:`${t} updated.`,prefix:"plugin:license:"+a}))}catch(u){n.error(u)}}}),"license");var lo=Object.defineProperty,po=v((e,t)=>lo(e,"name",{value:t,configurable:!0}),"u$8");const co=po(()=>({async generateBundle(e,t){const i=[];for(const o of this.getModuleIds()){const a=this.getModuleInfo(o);if(a!=null&&!a.isExternal)for(const s of a.importedIds)i.push({source:o,target:s})}if(Array.isArray(i)&&i.length===0)return;const n=Object.keys(t);this.emitFile({fileName:`metafile-${n[0].replace(E.E,"")}-${e.format}.json`,source:JSON.stringify(i,null,2),type:"asset"})},name:"packem:metafile"}),"metafilePlugin");var uo=Object.defineProperty,mo=v((e,t)=>uo(e,"name",{value:t,configurable:!0}),"g$7");let tt=!1;const fo=mo((e,t,i,n,o,a)=>{if(a!=="*"&&xe.valid(xe.coerce(a))===null)throw new Error("Invalid typeScriptVersion option. It must be a valid semver range.");return{name:"packem:node10-compatibility",writeBundle(){tt||(e.info({message:"Declaration node10 compatibility mode is enabled.",prefix:"plugin:node10-compatibility"}),tt=!0);const s={};for(const l of t)for(const c of l.exportKey)c.includes("/*")?s[c]=["./"+f.join(i,f.dirname(l.name),"*.d.ts")]:s[c]=[...s[c]??[],"./"+f.join(i,l.name+".d.ts")];const r=f.join(n,"package.json"),p=S.readJsonSync(r);o==="file"&&Object.keys(s).length>0?(S.writeJsonSync(r,{...p,typesVersions:{...p.typesVersions,[a]:s}},{detectIndent:!0}),e.info({message:'Your package.json "typesVersions" field has been updated.',prefix:"plugin:node10-compatibility"})):Object.keys(s).length>0&&e.info({message:`Please add the following field into your package.json to enable node 10 compatibility: ${JSON.stringify({typesVersions:{"*":s}},null,4)} `,prefix:"plugin:node10-compatibility"})}}},"node10CompatibilityPlugin");var go=Object.defineProperty,_t=v((e,t)=>go(e,"name",{value:t,configurable:!0}),"d$9");const ne=_t(e=>e.handler||e,"getHandler"),F=_t((e,t,i="")=>({...e,async buildEnd(n){e.buildEnd&&await ne(e.buildEnd).call(this,n)},async buildStart(n){e.buildStart&&await ne(e.buildStart).call(this,n)},async load(n){if(!e.load)return null;const o=f.join(i,e.name),a=f.join("load",_.f(n));if(t.has(a,o))return await t.get(a,o);const s=await ne(e.load).call(this,n);return t.set(a,s,o),s},name:`cached(${e.name})`,async resolveId(n,o,a){if(!e.resolveId)return null;const s=f.join(i,e.name),r=f.join("resolveId",_.f(n),o?_.f(o):"",_.f(JSON.stringify(a)));if(t.has(r,s))return await t.get(r,s);const p=await ne(e.resolveId).call(this,n,o,a);return t.set(r,p,s),p},async transform(n,o){if(!e.transform)return null;const a=f.join(i,e.name),s=f.join("transform",_.f(o),_.f(n));if(t.has(s,a))return await t.get(s,a);const r=await ne(e.transform).call(this,n,o);return t.set(s,r,a),r}}),"cachingPlugin");var vo=Object.defineProperty,ho=v((e,t)=>vo(e,"name",{value:t,configurable:!0}),"n$7");const yo=ho(()=>({name:"packem:prepend-directive",transform:{handler(e,t){const i=this.getModuleInfo(t);if(i?.meta.preserveDirectives){const n=i.meta.preserveDirectives.directives[0];if(n)return`'${n.value}'; `+e}return null},order:"post"}}),"prependDirectivePlugin");var xo=Object.defineProperty,bo=v((e,t)=>xo(e,"name",{value:t,configurable:!0}),"c$b");const wo=bo(({directiveRegex:e,exclude:t=[],include:i=[],logger:n})=>{const o={},a={},s=U.createFilter(i,t);return{name:"packem:preserve-directives",onLog(r,p){return p.code==="MODULE_LEVEL_DIRECTIVE"&&r==="warn"?!1:null},renderChunk:{handler(r,p,{sourcemap:l}){const c=p.moduleIds.map(m=>o[m]?o[m]:null).reduce((m,w)=>(w&&w.forEach(k=>{m.add(k)}),m),new Set),u=new G(r);c.size>0&&(n.debug({message:`directives for chunk "${p.fileName}" are preserved.`,prefix:"plugin:preserve-directives"}),u.prepend(`${[...c].map(m=>`'${m}';`).join(` `)} `));let d;return p.facadeModuleId&&typeof a[p.facadeModuleId]=="string"&&(d=a[p.facadeModuleId]),d&&(n.debug({message:`shebang for chunk "${p.fileName}" is preserved.`,prefix:"plugin:preserve-directives"}),u.prepend(`${d} `)),c.size===0&&d===void 0?null:{code:u.toString(),map:l?u.generateMap({hires:!0}):null}},order:"post"},transform(r,p){if(!s(p))return null;let l=!1;const c=new G(r);if(r.startsWith("#")&&r[1]==="!"){let d=0;for(let m=2,w=r.length;mko(e,"name",{value:t,configurable:!0}),"n$6");const $o=jo(e=>{const t=U.createFilter(e.include,e.exclude);return{async load(i){return i.includes("?raw")?await this.load({id:i.replace(/\?raw$/,"")}):null},name:"packem:raw",transform(i,n){return!t(n)&&!n.includes("?raw")?null:(n.includes("?raw")||(i=`export default ${JSON.stringify(i)}`),{code:i,map:{mappings:""}})}}},"rawPlugin");var Eo=Object.defineProperty,So=v((e,t)=>Eo(e,"name",{value:t,configurable:!0}),"i$7");const Pe=So((e,t)=>{let i={};return e.name&&(i[e.name]=t.rootDir),i={...i,...t.alias},t.rollup.alias&&(Array.isArray(t.rollup.alias.entries)?Object.assign(i,Object.fromEntries(t.rollup.alias.entries.map(n=>[n.find,n.replacement]))):Object.assign(i,t.rollup.alias.entries??t.rollup.alias)),i},"resolveAliases");var Oo=Object.defineProperty,re=v((e,t)=>Oo(e,"name",{value:t,configurable:!0}),"a$f");const it=re((e,t,i)=>e.reduce((n,o,a)=>(o instanceof RegExp?n.push(o):typeof o=="string"&&o.length>0?n.push(new RegExp("^"+o.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&")+"$")):i.warn(`Ignoring wrong entry type #${a} in '${t}' option: ${JSON.stringify(o)}`),n),[]),"getRegExps"),Ct=re((e,t,i,n,o)=>{const a=new Map,s=new Map,r=new Map,p=new Set(it([...i.externals],"include",n)),l=new Set(it([...o.exclude??[]],"exclude",n)),c={};Object.assign(c,o.deps?e.dependencies:void 0,o.devDeps?e.devDependencies:void 0,o.peerDeps?e.peerDependencies:void 0,o.optDeps?e.optionalDependencies:void 0);const u=Object.keys(c);if(u.length>0&&p.add(new RegExp("^(?:"+u.join("|")+")(?:/.+)?$")),e.peerDependenciesMeta)for(const[x,g]of Object.entries(e.peerDependenciesMeta))g?.optional&&p.add(new RegExp(`^${x}(?:/.+)?$`));const d=re(x=>[...p].some(g=>g.test(x)),"isIncluded"),m=re(x=>[...l].some(g=>g.test(x)),"isExcluded");let w=[];t&&(w=Object.entries(t.config.compilerOptions?.paths??{}).map(([x])=>x.endsWith("*")?new RegExp(`^${x.replace("*","(.*)")}$`):new RegExp(`^${x}$`)));const k=Pe(e,i);return{name:"packem:resolve-externals",options:re(x=>{x.external=(g,h)=>{if(r.has(g))return r.get(g);if(Object.keys(k).length>0&&(g=Se.resolveAlias(g,k)),/^(?:\0|\.{1,2}\/)/.test(g)||f.isAbsolute(g)||e.name&&g.startsWith(e.name))return r.set(g,!1),!1;if(ye.isBuiltin(g)){let b=o.builtins;return b===void 0&&h&&(b=d(h)&&!m(h)),r.set(g,b),b}if(d(g)&&!m(g))return r.set(g,!0),!0;if(e.imports)for(const[b,$]of Object.entries(e.imports)){if(b===g)return r.set(g,!1),!1;if(b.includes("*")){let y;s.has(b)?y=s.get(b):(y=be.readdirSync(f.join(i.rootDir,$.replace("/*","")),{withFileTypes:!0}).filter(P=>P.isFile()).map(P=>P.name),s.set(b,y));for(const P of y)if(P.replace(E.E,"")===g.replace(E.E,"").replace("#",""))return r.set(g,!1),!1}}if(w.length>0){for(const b of w)if(b.test(g))return r.set(g,!1),!1}return a.has(g)||n.info({message:'Inlined implicit external "'+j.cyan(g)+'". If this is incorrect, add it to the "externals" option.',prefix:"plugin:packem:resolve-externals"}),a.set(g,!0),!1}},"options"),resolveId:{async handler(x,g,{isEntry:h}){if(h)return null;if(ye.isBuiltin(x)){const b=x.replace(/^node:/,"");return{external:(o.builtins||d(x))&&!m(x),id:o.builtinsPrefix==="ignore"?x:o.builtinsPrefix==="add"||!ye.isBuiltin(b)?"node:"+b:b,moduleSideEffects:!1}}return null},order:"pre"}}},"resolveExternalsPlugin");var Po=Object.defineProperty,Do=v((e,t)=>Po(e,"name",{value:t,configurable:!0}),"r$9");const Mt=Do(()=>({name:"packem:resolve-file-url",resolveId(e){if(e.startsWith("file://"))return wi.fileURLToPath(e)}}),"resolveFileUrl");var No=Object.defineProperty,De=v((e,t)=>No(e,"name",{value:t,configurable:!0}),"i$5");const ke=/^#![^\n]*/,qe=De(async e=>{await Y.chmod(e,493).catch(()=>{})},"makeExecutable"),_o=De((e,t)=>({name:"packem:shebang",renderChunk:{handler(i,n,o){if(!n.isEntry||!n.facadeModuleId)return null;const a=i.startsWith("#")&&i[1]==="!";if(a&&t.replace)return i.replace(ke,t.shebang+` `);if(a)return null;if(e.includes(n.name)){const s=new G(i);return s.prepend(t.shebang+` `),{code:s.toString(),map:o.sourcemap?s.generateMap({hires:!0}):void 0}}return null},order:"post"},async writeBundle(i,n){for(const[o,a]of Object.entries(n))if(a.type==="chunk"&&ke.test(a.code)&&i.dir){const s=f.resolve(i.dir,o);await qe(s)}}}),"shebangPlugin"),Co=De(()=>({name:"packem:remove-shebang",renderChunk(e){return e.replace(ke,"")}}),"removeShebangPlugin"),Mo=De((e,t=` `)=>{const i=ke.exec(e);return i?i+t:""},"getShebang");var Ao=Object.defineProperty,Fo=v((e,t)=>Ao(e,"name",{value:t,configurable:!0}),"l$6");const Io=Fo(({exclude:e,include:t}={})=>{const i=U.createFilter(t,e);return{async load(n){if(!i(n))return null;let o;try{o=await S.readFile(n,{buffer:!1}),this.addWatchFile(n)}catch{try{const s=n.replace(/\?.*$/,"");o=await S.readFile(s,{buffer:!1}),this.addWatchFile(s)}catch{return this.warn("Failed reading file"),null}}let a;try{const s=ki.loadSourceMap(n);if(s===void 0)return o;a=s}catch{return this.warn("Failed resolving source map"),{code:o}}return{code:o,map:a}},name:"packem:sourcemaps"}},"sourcemapsPlugin");var To=Object.defineProperty,Q=v((e,t)=>To(e,"name",{value:t,configurable:!0}),"r$8");const zo=/\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g,Ro=/MIT License|MIT license|BSD license/,qo=/\n{2,}/g,Jo=/\b(\w+)\$\d+\b/g,Bo=/[-/\\^$*+?.()|[\]{}]/g,Wo=Q(e=>e.replaceAll(Bo,"\\$&"),"escapeRegex"),Lo=Q(e=>[...new Set(e)],"unique"),Uo=Q(e=>e.replaceAll(zo,t=>Ro.test(t)?"":t).replaceAll(qo,` `),"cleanUnnecessaryComments"),nt=new Map;function At(e,t,{identifierReplacements:i},n){const o=te.findStaticImports(e);for(const s in i){const r=o.find(l=>l.specifier===s&&l.imports.includes("{"));if(!r){this.warn(`${t.fileName} does not import "${s}" for replacement`),process.exitCode=1;continue}const p=i[s];for(const l in p){if(!r.imports.includes(l))throw new Error(`${t.fileName} does not import "${l}" from "${s}" for replacement`);const c=p[l],u=Wo(l);c.includes(".")&&(e=e.replace(new RegExp(`\\b\\w+\\b as ${u},?\\s?`),"")),e=e.replaceAll(new RegExp(`\\b${u}\\b`,"g"),c)}}const a=Lo(Array.from(e.matchAll(Jo),s=>s[0]));if(a.length>0){const s=a.map(p=>` - ${p}`).join(""),r=t.fileName.replace(/\.[^/.]+$/,"");nt.has(r)||n.warn({message:`${t.fileName} contains confusing identifier names${s} To replace these, add them to the "rollup -> patchTypes -> identifierReplacements" option in your packem config.`,prefix:"plugin:patch-types"}),nt.set(r,!0)}return e}v(At,"I$1");Q(At,"replaceConfusingTypeNames");const Ko=Q((e,t)=>{if(t.leadingComments?.some(i=>i.type==="CommentBlock"&&i.value.includes("@internal"))){const i=e.original[t.end]===","?t.end+1:t.end;return e.remove(t.leadingComments[0].start,i),!0}return!1},"removeInternal");function Ft(e,t){if(e.includes("@internal")){const i=new G(e),n=ji.parse(e,{plugins:["typescript"],sourceType:"module"});if(Le(n,{enter(o){Ko(i,o)&&this.skip()}}),e=i.toString(),e.includes("@internal"))throw new Error(`${t.fileName} has unhandled @internal declarations`)}return e}v(Ft,"S$3");Q(Ft,"stripInternalTypes");const Vo=Q((e,t)=>({name:"packem:patch-types",renderChunk(i,n){return i=At.call(this,i,n,e,t),i=Ft.call(this,i,n),i=Uo(i),i},resolveId(i){return i.startsWith("types/")?{external:!0,id:"../../"+(i.endsWith(".js")?i:i+".js")}:null}}),"patchTypescriptTypes");var Ho=Object.defineProperty,K=v((e,t)=>Ho(e,"name",{value:t,configurable:!0}),"a$e");const Go=42,Yo=K(e=>{let t=!1;for(let i=0;i{const t=e.indexOf("*");return t===-1?void 0:{prefix:e.slice(0,t),suffix:e.slice(t+1)}},"tryParsePattern"),Zo=K(({prefix:e,suffix:t},i)=>i.length>=e.length+t.length&&i.startsWith(e)&&i.endsWith(t),"isPatternMatch"),Xo=K((e,t,i)=>{let n,o=-1;for(const a of e){const s=t(a);Zo(s,i)&&s.prefix.length>o&&(o=s.prefix.length,n=a)}return n},"findBestPatternMatch"),ea=K((e,t)=>{const i=[];for(const n of e){if(!Yo(n))continue;const o=Qo(n);if(o)i.push(o);else if(n===t)return n}return Xo(i,n=>n,t)},"matchPatternOrExact"),ta=K((e,t)=>t.substring(e.prefix.length,t.length-e.suffix.length),"matchedText"),ia=K(({prefix:e,suffix:t})=>`${e}*${t}`,"patternText"),na=K((e,t,i)=>{let n=f.dirname(t.path);t.config.compilerOptions?.baseUrl&&(n=f.resolve(e,t.config.compilerOptions.baseUrl)),i?.debug({message:`Resolved baseUrl to ${n}`,prefix:"plugin:packem:resolve-tsconfig-paths"});const o=t.config.compilerOptions?.paths??{};return Object.keys(o).length===0&&i?.debug({message:"No paths found in tsconfig.json",prefix:"plugin:packem:resolve-tsconfig-paths"}),{paths:o,resolvedBaseUrl:n}},"getTsconfigPaths"),It=K((e,t,i,n)=>{const{paths:o,resolvedBaseUrl:a}=na(e,t,i),s=Object.keys(o);return{name:"packem:resolve-tsconfig-paths",async resolveId(r,p,l){if(s.length===0)return null;if(r.includes("\0"))return i.debug({message:`Skipping resolution of ${r} as it is a virtual module`,prefix:"plugin:packem:resolve-tsconfig-paths"}),null;if(r.includes("node_modules"))return i.debug({message:`Skipping request as it is inside node_modules ${r}`,prefix:"plugin:packem:resolve-tsconfig-paths"}),null;if(!n.resolveAbsolutePath&&f.isAbsolute(r))return i.debug({message:`Skipping request as it is an absolute path ${r}`,prefix:"plugin:packem:resolve-tsconfig-paths"}),null;if(Se.isRelative(r))return i.debug({message:`Skipping request as it is a relative path ${r}`,prefix:"plugin:packem:resolve-tsconfig-paths"}),null;const c=ea(s,r);if(!c)return i.debug({message:`moduleName did not match any paths pattern ${r}`,prefix:"plugin:packem:resolve-tsconfig-paths"}),null;const u=typeof c=="string"?void 0:ta(c,r),d=typeof c=="string"?c:ia(c);for await(const m of o[d]){const w=u?m.replace("*",u):m;if(w.endsWith(".d.ts")||w.endsWith(".d.cts")||w.endsWith(".d.mts"))continue;const k=f.join(a,w);try{const x=await this.resolve(k,p,{skipSelf:!0,...l});if(x)return x}catch(x){i.debug({context:x,message:`Failed to resolve ${k} from ${r}`,prefix:"plugin:packem:resolve-tsconfig-paths"})}}return null}}},"resolveTsconfigPathsPlugin");var oa=Object.defineProperty,Tt=v((e,t)=>oa(e,"name",{value:t,configurable:!0}),"u$6");const aa=Tt((e,t)=>{if(!t)return null;const{config:i,path:n}=t;if(!i.compilerOptions)return null;const{rootDirs:o}=i.compilerOptions;if(!o)return null;const a=[];for(const s of o){if(s.startsWith("."))throw new Error(`Invalid rootDir value '.' in ${n}.`);if(s.startsWith(".."))throw new Error(`Invalid rootDir value '..' in ${n}.`);a.push(f.resolve(e,s))}return a},"getRootDirectories"),zt=Tt((e,t,i)=>{const n=aa(e,i);return{name:"packem:resolve-tsconfig-root-dirs",async resolveId(o,a,s){if(n===null||n.length===0)return null;if(o.startsWith("."))for(const r of n){const p=f.join(r,o),l=await this.resolve(p,a,{skipSelf:!0,...s});if(l)return t.debug({message:`Resolved ${o} to ${l.id} using rootDirs from tsconfig.json.`,prefix:"plugin:resolve-tsconfig-root-dirs"}),l.id}return null}}},"resolveTsconfigRootDirectories");var sa=Object.defineProperty,ra=v((e,t)=>sa(e,"name",{value:t,configurable:!0}),"r$7");const Rt=ra(()=>{const e=/\.(?:[mc]?js|jsx)$/;return{name:"packem:resolve-typescript-mjs-cjs",async resolveId(t,i,n){return e.test(t)&&i?await this.resolve(t.replace(/js(x?)$/,"ts$1"),i,n):null}}},"resolveTypescriptMjsCts"),qt={"application/prs.cww":["cww"],"application/prs.xsf+xml":["xsf"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["*xfdf"],"application/vnd.age":["age"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["*fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["*mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.pwg-xhtml-print+xml":["xhtm"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml","uo"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["*prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["*sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["*aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif","btf"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.cld":["cld"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.pytha.pyox":["pyo","pyox"],"model/vnd.sap.vds":["vds"],"model/vnd.usda":["usda"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.familysearch.gedcom":["ged"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]};Object.freeze(qt);const la=new _.p(_.g,qt)._freeze();var pa=Object.defineProperty,Ue=v((e,t)=>pa(e,"name",{value:t,configurable:!0}),"u$5");const ca=Ue(async(e,t)=>{await new Promise((i,n)=>{const o=be.createReadStream(e);o.on("error",n);const a=be.createWriteStream(t);a.on("error",n),a.on("finish",i),o.pipe(a)})},"copy"),da=Ue(e=>{let t=e.toString("utf8").replaceAll(/[\n\r]/g,"").replaceAll(" "," "),i;do i=t,t=t.replaceAll(/))-->/g,"");while(t!==i);return encodeURIComponent(t.replaceAll("'","\\i")).replaceAll("(","%28").replaceAll(")","%29")},"encodeSVG"),ua=Ue(({destDir:e,emitFiles:t,exclude:i,fileName:n,include:o,limit:a,publicPath:s,sourceDir:r})=>{const p=U.createFilter(o,i),l={};return{async generateBundle(c){if(!t)return;const u=e??c.dir??f.dirname(c.file??"");await S.ensureDir(u),await Promise.all(Object.keys(l).map(async d=>{const m=l[d],w=f.join(u,f.dirname(m));await S.ensureDir(w),await ca(d,f.join(u,m))}))},async load(c){if(!p(c))return null;this.addWatchFile(c);const[u,d]=await Promise.all([Y.stat(c),Y.readFile(c)]);let m;if(a&&u.size>a||a===0){const w=Ii.createHash("sha1").update(d).digest("hex").slice(0,16),k=f.extname(c),x=f.basename(c,k),g=r?f.relative(r,f.dirname(c)):f.basename(f.dirname(c)),h=n.replaceAll("[hash]",w).replaceAll("[extname]",k).replaceAll("[dirname]",g===""?"":`${g}/`).replaceAll("[name]",x);m=f.join(s??"",h),l[c]=h}else{const w=la.getType(c);if(w===null)throw new Error(`Could not determine mimetype for ${c}`);const k=w==="image/svg+xml";m=k?da(d):d.toString("base64"),m=`data:${w}${k?"":";base64"},${m}`}return`export default "${m}"`},name:"packem:url"}},"urlPlugin");var ma=Object.defineProperty,fa=v((e,t)=>ma(e,"name",{value:t,configurable:!0}),"s$8");const ga=fa(e=>{const t=f.basename(e).split(".");if(t.length>=2){const[i,n]=t.slice(-2),o=t[0],a=/^(\w+)-runtime$/.exec(i)?.[1];if(E.D.includes(n)&&a&&a.length>0)return o+"-"+a}},"getCustomModuleLayer");var va=Object.defineProperty,ha=v((e,t)=>va(e,"name",{value:t,configurable:!0}),"i$4");const Fe=ha(e=>(e.preserveDirectives||{directives:[]}).directives.map(t=>t.replace(/^use /,"")).find(t=>t!=="strict"),"getModuleLayer");var ya=Object.defineProperty,ot=v((e,t)=>ya(e,"name",{value:t,configurable:!0}),"d$8");const xa=ot((e,t)=>{const i=new Map;return ot(function(n,o){const a=o.getModuleInfo(n);if(!a)return;const{isEntry:s}=a,r=a.meta,p=Fe(r);if(!s){const l=i.get(n);if(l)return l;const c=ga(n);if(c)return i.set(n,c),c}if(s){const l=o.getModuleIds();for(const c of l)o.getModuleInfo(c)&&Fe(r)===p&&(e.has(c)||e.set(c,new Set),e.get(c).add([n,p]))}if(p&&!s&&e.has(n)){const l=[...e.get(n)];if(l.some(([u])=>{if(t.some(d=>d.path===u)){const d=o.getModuleInfo(u);return Fe(d?d.meta:{})===p}return!1}))return;if(l.every(([,u])=>u===p))return i.has(n)?i.get(n):void 0;const c=f.basename(n,f.extname(n))+"-"+p;return i.set(n,c),c}},"splitChunks")},"createSplitChunks");var ba=Object.defineProperty,wa=v((e,t)=>ba(e,"name",{value:t,configurable:!0}),"n$4");const H=wa((e,t)=>e.isDynamicEntry?`${E.C}/[name].${t}`:`${E.S}/${e.name}-[hash].${t}`,"getChunkFilename");var ka=Object.defineProperty,ja=v((e,t)=>ka(e,"name",{value:t,configurable:!0}),"o$4");const $a=process.platform==="win32",at=ja((e,t)=>{const i=$a?"\\":"/";for(let n of Array.isArray(e.names)?e.names:[]){if(n.includes("node_modules"+i+".pnpm"))return n=n.replace("node_modules"+i+".pnpm","external")+"."+t,n.replace("node_modules"+i,"");if(n.includes("node_modules"))return n.replace("node_modules","external")+"."+t}return"[name]."+t},"getEntryFileNames");var Ea=Object.defineProperty,I=v((e,t)=>Ea(e,"name",{value:t,configurable:!0}),"e$5");const Jt=I((e,t)=>{const i=[],n=[],o=[];return e&&e.filter(Boolean).filter(a=>a.type===t?!0:t==="build"&&a.type===void 0).forEach(a=>{a.enforce==="pre"?i.push(a.plugin):a.enforce==="post"?n.push(a.plugin):o.push(a.plugin)}),[i,o,n]},"sortUserPlugins"),Sa=I((e,t)=>{if(e==="esbuild"){if(!t.options.rollup.esbuild)throw new Error("No esbuild options found in your configuration.");t.tsconfig?.config.compilerOptions?.target?.toLowerCase()==="es3"&&(t.logger.warn(["ES3 target is not supported by esbuild, so ES5 will be used instead..","Please set 'target' option in tsconfig to at least ES5 to disable this error"].join(" ")),t.tsconfig.config.compilerOptions.target="es5",t.options.rollup.esbuild.target="es5");let i="node"+Be.versions.node.split(".")[0];if(t.pkg.engines?.node){const n=xe.minVersion(t.pkg.engines.node);n&&(i="node"+n.major)}if(t.options.rollup.esbuild.target){const n=le(t.options.rollup.esbuild.target);n.some(o=>o.startsWith("node"))||(t.options.rollup.esbuild.target=[...new Set([...le(i),...n])])}else t.options.rollup.esbuild.target=le(i);return t.tsconfig?.config.compilerOptions?.target==="es5"&&(t.options.rollup.esbuild.keepNames=!1,t.logger.debug("Disabling keepNames because target is set to es5")),{logger:t.logger,minify:t.options.minify,minifyWhitespace:t.options.minify,sourceMap:t.options.sourcemap,...t.options.rollup.esbuild}}if(e==="swc"){if(!t.options.rollup.swc)throw new Error("No swc options found in your configuration.");return{minify:t.options.minify,...t.options.rollup.swc,jsc:{minify:{compress:{directives:!1},format:{comments:"some"},mangle:{topLevel:!0},sourceMap:t.options.sourcemap,toplevel:t.options.emitCJS??t.options.emitESM},...t.options.rollup.swc.jsc},sourceMaps:t.options.sourcemap}}if(e==="sucrase"){if(!t.options.rollup.sucrase)throw new Error("No sucrase options found in your configuration.");return t.options.rollup.sucrase}throw new Error("A Unknown transformer was provided")},"getTransformerConfig"),Bt=I((e,t)=>{if(e.code==="CIRCULAR_DEPENDENCY"&&/Circular dependency:[\s\S]*node_modules/.test(e.message))return!0;if(e.code==="UNRESOLVED_IMPORT")throw new Error(`Failed to resolve the module "${e.exporter}" imported by "${j.cyan(f.relative(f.resolve(),e.id))}" Is the module installed? Note: ↳ to inline a module into your bundle, install it to "devDependencies". ↳ to depend on a module via import/require, install it to "dependencies".`);return e.code==="MODULE_LEVEL_DIRECTIVE"?!0:e.code==="MIXED_EXPORTS"&&t.options.cjsInterop===!0},"sharedOnWarn"),Wt=I((e,t)=>({input:Object.fromEntries(e.options.entries.map(i=>[i.name,f.resolve(e.options.rootDir,i.input)])),logLevel:e.options.debug?"debug":"info",onLog:I((i,n)=>{let o=n.message;switch(n.stack&&(o=`${o} ${n.stack}`),i){case"info":{e.logger.info({message:o,prefix:t+(n.plugin?":plugin:"+n.plugin:"")});return}case"warn":{e.logger.warn({message:o,prefix:t+(n.plugin?":plugin:"+n.plugin:"")});return}case"debug":e.logger.debug({message:o,prefix:t+(n.plugin?":plugin:"+n.plugin:"")})}},"onLog"),onwarn(i,n){Bt(i,e)||i.code||n(i)},treeshake:{moduleSideEffects:!0,preset:"smallest"},watch:e.mode==="watch"?e.options.rollup.watch:!1}),"baseRollupOptions"),Lt=I(async(e,t)=>{const i=Pe(e.pkg,e.options);let n;e.options.rollup.resolve&&(n=ht.nodeResolve({...e.options.rollup.resolve}));const o=e.options.rollup.output?.preserveModules?{preserveModules:!0,preserveModulesRoot:e.options.rollup.output.preserveModulesRoot??"src"}:{manualChunks:xa(e.dependencyGraphMap,e.buildEntries),preserveModules:!1},[a,s,r]=Jt(e.options.rollup.plugins,"build");return{...Wt(e,"build"),output:[e.options.emitCJS&&{assetFileNames:"[name]-[hash][extname]",chunkFileNames:I(p=>H(p,"cjs"),"chunkFileNames"),compact:e.options.minify,dir:f.resolve(e.options.rootDir,e.options.outDir),entryFileNames:I(p=>at(p,"cjs"),"entryFileNames"),exports:"auto",externalLiveBindings:!1,format:"cjs",freeze:!1,generatedCode:{arrowFunctions:!0,constBindings:!0,objectShorthand:!0,preset:e.tsconfig?.config.compilerOptions?.target==="es5"?"es5":"es2015",reservedNamesAsProps:!0,symbols:!0},hoistTransitiveImports:!1,interop:"compat",sourcemap:e.options.sourcemap,validate:!0,...e.options.rollup.output,...o},e.options.emitESM&&{assetFileNames:"[name]-[hash][extname]",chunkFileNames:I(p=>H(p,"mjs"),"chunkFileNames"),compact:e.options.minify,dir:f.resolve(e.options.rootDir,e.options.outDir),entryFileNames:I(p=>at(p,"mjs"),"entryFileNames"),exports:"auto",externalLiveBindings:!1,format:"esm",freeze:!1,generatedCode:{arrowFunctions:!0,constBindings:!0,objectShorthand:!0,preset:e.tsconfig?.config.compilerOptions?.target==="es5"?"es5":"es2015",reservedNamesAsProps:!0,symbols:!0},hoistTransitiveImports:!1,sourcemap:e.options.sourcemap,validate:!0,...e.options.rollup.output,...o}].filter(Boolean),plugins:[F(Mt(),t),F(Rt(),t),e.tsconfig&&F(zt(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&e.options.rollup.tsconfigPaths&&F(It(e.options.rootDir,e.tsconfig,e.logger,e.options.rollup.tsconfigPaths),t),F(Ct(e.pkg,e.tsconfig,e.options,e.logger,e.options.rollup.resolveExternals??{}),t),e.options.rollup.replace&&wt({sourcemap:e.options.sourcemap,...e.options.rollup.replace}),e.options.rollup.alias&&bt({customResolver:n,...e.options.rollup.alias,entries:i}),...a,n,e.options.rollup.polyfillNode&&Ci({sourceMap:e.options.sourcemap,...e.options.rollup.polyfillNode}),e.options.rollup.json&&St({...e.options.rollup.json}),tn(),e.options.rollup.wasm&&di.wasm(e.options.rollup.wasm),e.options.rollup.url&&ua(e.options.rollup.url),e.options.rollup.css&&e.options.rollup.css.loaders&&e.options.rollup.css.loaders.length>0&&await $n({dts:!!e.options.declaration||e.options.isolatedDeclarationTransformer!==void 0,sourceMap:e.options.sourcemap,...e.options.rollup.css},e.logger,e.options.browserTargets,e.options.rootDir,e.options.sourceDir,e.environment,e.options.sourcemap,e.options.debug,e.options.minify??!1,i),e.options.rollup.css&&e.options.rollup.css.loaders&&e.options.rollup.css.loaders.length>0&&e.options.declaration&&Pn(e.options.rollup.css,e.options.rootDir,e.logger),e.options.rollup.raw&&F($o(e.options.rollup.raw),t),e.options.sourcemap&&Io(e.options.rollup.sourcemap),...s,e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer&&Vn(f.join(e.options.rootDir,e.options.sourceDir),e.options.isolatedDeclarationTransformer,e.options.declaration,!!e.options.rollup.cjsInterop,e.options.rollup.isolatedDeclarations,e.tsconfig),e.options.transformer(Sa(e.options.transformerName,e)),F(wo({directiveRegex:/^['|"](use (\w+))['|"]$/,...e.options.rollup.preserveDirectives,logger:e.logger}),t),e.options.rollup.shebang&&_o(e.options.entries.filter(p=>p.executable).map(p=>p.name).filter(Boolean),e.options.rollup.shebang),e.options.cjsInterop&&e.options.emitCJS&&Et({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.dynamicVars&&Tn(),e.options.rollup.dynamicVars&&_i(e.options.rollup.dynamicVars),e.options.rollup.commonjs&&F(Ni({sourceMap:e.options.sourcemap,...e.options.rollup.commonjs}),t),e.options.rollup.preserveDynamicImports&&{name:"packem:preserve-dynamic-imports",renderDynamicImport(){return{left:"import(",right:")"}}},e.options.cjsInterop&&e.options.rollup.shim&&An(e.pkg,e.options.rollup.shim),e.options.rollup.jsxRemoveAttributes&&F(ao({attributes:e.options.rollup.jsxRemoveAttributes.attributes,logger:e.logger}),t),...r,e.options.rollup.metafile&&co(),e.options.rollup.copy&&dn(e.options.rollup.copy,e.logger),e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dependenciesTemplate=="function"&&Nt({dtsMarker:e.options.rollup.license.dtsMarker??"TYPE_DEPENDENCIES",licenseFilePath:e.options.rollup.license.path,licenseTemplate:e.options.rollup.license.dependenciesTemplate,logger:e.logger,marker:e.options.rollup.license.dependenciesMarker??"DEPENDENCIES",mode:"dependencies",packageName:e.pkg.name}),yo(),e.options.emitCJS&&e.mode==="build"&&e.options.declaration==="compatible"&&e.options.rollup.node10Compatibility&&fo(e.logger,e.options.entries,e.options.outDir,e.options.rootDir,e.options.rollup.node10Compatibility.writeToPackageJson?"file":"console",e.options.rollup.node10Compatibility.typeScriptVersion??"*"),e.options.analyze&&e.options.rollup.visualizer!==!1&&mi.visualizer({brotliSize:!0,gzipSize:!0,projectRoot:e.options.rootDir,sourcemap:e.options.sourcemap,...e.options.rollup.visualizer,filename:"packem-bundle-analyze.html",title:"Packem Visualizer"})].filter(Boolean)}},"getRollupOptions"),Oa=I(async e=>{const{dts:t}=require("rollup-plugin-dts");return t({compilerOptions:{...e.options.rollup.dts.compilerOptions,incremental:void 0,inlineSources:void 0,sourceMap:void 0,tsBuildInfoFile:void 0},respectExternal:e.options.rollup.dts.respectExternal,tsconfig:e.tsconfig?.path})},"createDtsPlugin"),Pa=Bi(Oa),Ut=I(async(e,t)=>{const i=Pe(e.pkg,e.options),n=e.tsconfig?.config.compilerOptions;delete n?.lib;let o;e.options.rollup.resolve&&(o=ht.nodeResolve({...e.options.rollup.resolve}));const a="dts-plugin:"+process.pid+e.tsconfig.path,[s,r,p]=Jt(e.options.rollup.plugins,"dts");return{...Wt(e,"dts"),onwarn(l,c){Bt(l,e)||l.code!=="EMPTY_BUNDLE"&&c(l)},output:[e.options.emitCJS&&{chunkFileNames:I(l=>H(l,"d.cts"),"chunkFileNames"),compact:e.options.minify,dir:f.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output},e.options.emitESM&&{chunkFileNames:I(l=>H(l,"d.mts"),"chunkFileNames"),compact:e.options.minify,dir:f.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts",format:"esm",sourcemap:e.options.sourcemap,...e.options.rollup.output},e.options.declaration==="compatible"&&{chunkFileNames:I(l=>H(l,"d.ts"),"chunkFileNames"),compact:e.options.minify,dir:f.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts",format:"cjs",sourcemap:e.options.sourcemap,...e.options.rollup.output}].filter(Boolean),plugins:[F(Mt(),t),F(Rt(),t),e.options.rollup.json&&St({...e.options.rollup.json}),{load(l){return/\.(?:js|cjs|mjs|jsx|ts|tsx|ctsx|mtsx|mts|json)$/.test(l)?null:""},name:"packem:ignore-files"},e.tsconfig&&F(zt(e.options.rootDir,e.logger,e.tsconfig),t),e.tsconfig&&e.options.rollup.tsconfigPaths&&F(It(e.options.rootDir,e.tsconfig,e.logger,e.options.rollup.tsconfigPaths),t),F(Ct(e.pkg,e.tsconfig,e.options,e.logger,e.options.rollup.resolveExternals??{}),t),e.options.rollup.replace&&wt({sourcemap:e.options.sourcemap,...e.options.rollup.replace}),e.options.rollup.alias&&bt({customResolver:o,...e.options.rollup.alias,entries:i}),...s,o,...r,await Pa(a)(e),e.options.cjsInterop&&e.options.emitCJS&&Et({...e.options.rollup.cjsInterop,logger:e.logger,type:e.pkg.type??"commonjs"}),e.options.rollup.patchTypes&&F(Vo(e.options.rollup.patchTypes,e.logger),t),Co(),...p,e.options.rollup.license&&e.options.rollup.license.path&&typeof e.options.rollup.license.dtsTemplate=="function"&&Nt({licenseFilePath:e.options.rollup.license.path,licenseTemplate:e.options.rollup.license.dtsTemplate,logger:e.logger,marker:e.options.rollup.license.dtsMarker??"TYPE_DEPENDENCIES",mode:"types",packageName:e.pkg.name})].filter(Boolean)}},"getRollupDtsOptions");var Da=Object.defineProperty,Na=v((e,t)=>Da(e,"name",{value:t,configurable:!0}),"m$5");const st="rollup-build.json",_a=Na(async(e,t,i)=>{const n=await Lt(e,t);if(await e.hooks.callHook("rollup:options",e,n),Object.keys(n.input).length===0)return;let o=!0;(e.options.rollup.isolatedDeclarations||e.options.isolatedDeclarationTransformer||e.options.rollup.css)&&(o=!1),o&&(n.cache=t.get(st,i));const a=await pe.rollup(n);o&&t.set(st,a.cache,i),await e.hooks.callHook("rollup:build",e,a);const s=new Map;for(const r of n.output){const{output:p}=await a.write(r),l=new Set,c=p.filter(d=>d.type==="chunk");for(const d of c){l.add(d.fileName);for(const m of d.imports)e.usedImports.add(m);d.isEntry&&e.buildEntries.push({bytes:Buffer.byteLength(d.code,"utf8"),chunks:d.imports.filter(m=>c.find(w=>w.fileName===m)),exports:d.exports,modules:Object.entries(d.modules).map(([m,w])=>({bytes:w.renderedLength,id:m})),path:d.fileName,type:"entry"})}const u=p.filter(d=>d.type==="asset");for(const d of u)s.has(d.fileName)||s.set(d.fileName,{bytes:Buffer.byteLength(d.source,"utf8"),path:d.fileName,type:"asset"});for(const d of l)e.usedImports.delete(d)}e.buildEntries.push(...s.values())},"build");var Ca=Object.defineProperty,fe=v((e,t)=>Ca(e,"name",{value:t,configurable:!0}),"a$9");const rt="rollup-dts.json",Ma=fe(async(e,t,i)=>{if(e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer){e.logger.info({message:"Using isolated declaration transformer to generate declaration files...",prefix:"dts"});return}const n=await Ut(e,t);if(await e.hooks.callHook("rollup:dts:options",e,n),Object.keys(n.input).length===0)return;n.cache=t.get(rt,i);const o=await pe.rollup(n);t.set(rt,o.cache,i),await e.hooks.callHook("rollup:dts:build",e,o),e.logger.info({message:"Building declaration files...",prefix:"dts"}),e.options.emitCJS&&await o.write({chunkFileNames:fe(a=>H(a,"d.cts"),"chunkFileNames"),dir:f.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.cts"}),e.options.emitESM&&await o.write({chunkFileNames:fe(a=>H(a,"d.mts"),"chunkFileNames"),dir:f.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.mts"}),e.options.declaration==="compatible"&&await o.write({chunkFileNames:fe(a=>H(a,"d.cjs"),"chunkFileNames"),dir:f.resolve(e.options.rootDir,e.options.outDir),entryFileNames:"[name].d.ts"}),await e.hooks.callHook("rollup:dts:done",e)},"buildTypes");var Aa=Object.defineProperty,Fa=v((e,t)=>Aa(e,"name",{value:t,configurable:!0}),"y$4");const Ia=Fa((e,t,i)=>e.reduce((n,o)=>{const a=o[t],s=o[i];return n[a]||(n[a]={}),n[a][s]||(n[a][s]=[]),n[a][s].push(o),n},{}),"groupByKeys");var Ta=Object.defineProperty,je=v((e,t)=>Ta(e,"name",{value:t,configurable:!0}),"j$1");const za=je((e,t)=>{const i=je(s=>f.relative(t.options.rootDir,f.resolve(t.options.outDir,s)),"rPath");let n=!1;const o=[],a=t.buildEntries.filter(s=>s.type==="entry");if(a.length>0){e.raw(`Entries: `);for(const s of a){let r=s.bytes??0;for(const l of s.chunks??[])r+=t.buildEntries.find(c=>c.path===l)?.bytes??0;let p=` ${j.bold(i(s.path))} (${["total size: "+j.cyan(L.formatBytes(r)),s.bytes&&"chunk size: "+j.cyan(L.formatBytes(s.bytes))].filter(Boolean).join(", ")})`;if(p+=s.exports?.length?` exports: `+j.gray(s.exports.join(", ")):"",s.chunks?.length&&(p+=` ${s.chunks.map(l=>{const c=t.buildEntries.find(u=>u.path===l)??{};return j.gray(" └─ "+i(l)+j.bold(c.bytes?" ("+L.formatBytes(c?.bytes)+")":""))}).join(` `)}`),s.modules&&s.modules.length>0){const l=s.modules.filter(c=>c.id.includes("node_modules")).sort((c,u)=>(u.bytes||0)-(c.bytes||0)).map(c=>j.gray(" 📦 "+i(c.id)+j.bold(c.bytes?" ("+L.formatBytes(c.bytes)+")":""))).join(` `);p+=l.length>0?` inlined modules: `+l:""}if(t.options.declaration){let l=s.path.replace(/\.js$/,".d.ts"),c="commonjs";s.path.endsWith(".cjs")?l=s.path.replace(/\.cjs$/,".d.cts"):s.path.endsWith(".mjs")&&(c="module",l=s.path.replace(/\.mjs$/,".d.mts"));const u=t.buildEntries.find(d=>d.path.endsWith(l));if(u){o.push(u.path);let d;l.includes(".d.ts")||(l=l.replace(".d.c",".d."),d=t.buildEntries.find(m=>m.path.endsWith(l))),d&&(o.push(d.path),p+=c==="commonjs"?` types: `+[u,d].map(m=>j.gray(" └─ ")+j.bold(i(m.path))+" (total size: "+j.cyan(L.formatBytes(m.bytes??0))+")").join(` `):` types: `+j.bold(i(u.path))+" (total size: "+j.cyan(L.formatBytes(u.bytes??0))+")")}}n=!0,p+=` `,e.raw(s.chunk?j.gray(p):p)}}if(t.buildEntries.filter(s=>s.type==="asset").length>0){let s="Assets:";for(const r of t.buildEntries.filter(p=>p.type==="asset"))o.includes(r.path)||(s+=j.gray(` └─ `)+j.bold(i(r.path))+" (total size: "+j.cyan(L.formatBytes(r.bytes??0))+")");s+=` `,e.raw(s)}return n&&e.raw("Σ Total dist size (byte size):",j.cyan(L.formatBytes(t.buildEntries.reduce((s,r)=>s+(r.bytes??0),0),{decimals:2})),` `),n},"showSizeInformation"),Ra=je((e,t)=>{const i=Ia(e.options.entries,"environment","runtime"),n=new Set,o=new Set;for(const[a,s]of Object.entries(i))for(const[r,p]of Object.entries(s)){const l={...e};!e.options.dtsOnly&&(a!=="undefined"||r!=="undefined")&&e.logger.info("Preparing build for "+(a==="undefined"?"":j.cyan(a)+" environment"+(r==="undefined"?"":" with "))+(r==="undefined"?"":j.cyan(r)+" runtime"));const c={};l.options.rollup.replace?(l.options.rollup.replace.values===void 0&&(l.options.rollup.replace.values={}),a!=="undefined"&&(c[["process","env","NODE_ENV"].join(".")]=JSON.stringify(a)),c[["process","env","EdgeRuntime"].join(".")]=JSON.stringify(r==="edge-light"),Object.freeze(c)):e.logger.warn("'replace' plugin is disabled. You should enable it to replace 'process.env.*' environments.");let u="";a!=="undefined"&&(u+=a+"/"),r!=="undefined"&&(u+=r+"/");let d=!1;l.options.minify!==void 0&&(d=l.options.minify),a==="development"?d=!1:a==="production"&&(d=!0);const m=[],w=[],k=[],x=[];for(const g of p)g.cjs&&g.esm?m.push(g):g.cjs?k.push(g):g.esm?w.push(g):g.declaration&&x.push(g);if(m.length>0){const g={...l,options:{...l.options,emitCJS:!0,emitESM:!0,entries:m,minify:d,rollup:{...l.options.rollup,replace:l.options.rollup.replace?{...l.options.rollup.replace,values:{...l.options.rollup.replace.values,...c}}:!1}}};if(e.options.dtsOnly||n.add({context:g,fileCache:t,subDirectory:u}),e.options.declaration){const h=g.options.entries.filter(b=>b.declaration);h.length>0&&o.add({context:{...g,options:{...g.options,entries:h}},fileCache:t,subDirectory:u})}}if(w.length>0){const g={...l,options:{...l.options,emitCJS:!1,emitESM:!0,entries:w,minify:d,rollup:{...l.options.rollup,replace:l.options.rollup.replace?{...l.options.rollup.replace,values:{...l.options.rollup.replace.values,...c}}:!1}}};if(e.options.dtsOnly||n.add({context:g,fileCache:t,subDirectory:u}),e.options.declaration){const h=g.options.entries.filter(b=>b.declaration);h.length>0&&o.add({context:{...g,options:{...g.options,entries:h}},fileCache:t,subDirectory:u})}}if(k.length>0){const g={...l,options:{...l.options,emitCJS:!0,emitESM:!1,entries:k,minify:d,rollup:{...l.options.rollup,replace:l.options.rollup.replace?{...l.options.rollup.replace,values:{...l.options.rollup.replace.values,...c}}:!1}}};if(e.options.dtsOnly||n.add({context:g,fileCache:t,subDirectory:u}),e.options.declaration){const h=g.options.entries.filter(b=>b.declaration);h.length>0&&o.add({context:{...g,options:{...g.options,entries:h}},fileCache:t,subDirectory:u})}}l.options.declaration&&x.length>0&&o.add({context:{...l,options:{...l.options,emitCJS:!1,emitESM:!1,entries:x,minify:d,rollup:{...l.options.rollup,replace:l.options.rollup.replace?{...l.options.rollup.replace,values:{...l.options.rollup.replace.values,...c}}:!1}}},fileCache:t,subDirectory:u})}return{builders:n,typeBuilders:o}},"prepareRollupConfig"),qa=je(async(e,t)=>{await e.hooks.callHook("build:before",e);const{builders:i,typeBuilders:n}=Ra(e,t);await Promise.all([...i].map(async({context:o,fileCache:a,subDirectory:s})=>await _a(o,a,s))),await Promise.all([...n].map(async({context:o,fileCache:a,subDirectory:s})=>await Ma(o,a,s))),e.logger.success(j.green(e.options.name?"Build succeeded for "+e.options.name:"Build succeeded"));for await(const o of S.walk(f.join(e.options.rootDir,e.options.outDir))){let a=e.buildEntries.find(s=>f.join(e.options.rootDir,e.options.outDir,s.path)===o.path);if(a||(a={chunk:!0,path:o.path},e.buildEntries.push(a)),!a.bytes){const s=await Y.stat(f.resolve(e.options.rootDir,e.options.outDir,o.path));a.bytes=s.size}}return await e.hooks.callHook("build:done",e),za(e.logger,e)},"build");var Ja=Object.defineProperty,Ba=v((e,t)=>Ja(e,"name",{value:t,configurable:!0}),"r$5");const N=Ba((e,t)=>{e.warnings.has(t)||e.warnings.add(t)},"warn");var Wa=Object.defineProperty,Kt=v((e,t)=>Wa(e,"name",{value:t,configurable:!0}),"t$4");const $e=Kt(e=>{if(e.endsWith(".mjs")||e.endsWith(".d.mts"))return"esm";if(e.endsWith(".cjs")||e.endsWith(".d.cts"))return"cjs"},"inferExportTypeFromFileName"),Je=Kt((e,t,i,n)=>{if(e==="module-sync")return"esm";if(n){const s=$e(n);if(s)return s}if(e==="module"||e==="import")return"esm";if(e==="require")return"cjs";if(t.length===0)return i;const[o,...a]=t;return Je(o,a,i,n)},"inferExportType");var La=Object.defineProperty,Ua=v((e,t)=>La(e,"name",{value:t,configurable:!0}),"y$3");const Ka=new Set(["electron","import","require","node","node-addons","default","types","deno","browser","module-sync","bun","workerd",...E.R,...E.a]),Ke=Ua((e,t,i,n=[])=>{if(!e)return[];if(typeof e=="string"){const o=$e(e);if(o&&o!==t)throw new Error(`Exported file "${e}" has an extension that does not match the package.json type "${t==="esm"?"module":"commonjs"}".`);return[{file:e,key:"exports",type:o??t}]}if(typeof e=="object"){const o=Object.entries(e).filter(([s])=>!s.endsWith(".json"));let a=[];for(const[s,r]of o)if(typeof r=="string"){let p={};Number.isInteger(+s)?p={exportKey:"*"}:s.startsWith("./")?p={exportKey:s.replace("./","")}:p={exportKey:s==="."?".":"*",subKey:s},a.push({...p,file:r,key:"exports",type:Je(s,n,t,r)})}else if(typeof r=="object"&&r!==null)for(const[p,l]of Object.entries(r)){if(i===!1&&p==="types")continue;const c=Number.isInteger(+s)?p:s;typeof l=="string"?a.push({exportKey:c.replace("./",""),file:l,key:"exports",...Ka.has(p)?{subKey:p}:{},type:Je(p,n,t,l)}):a=[...a,...Ke({[c]:l},t,i,[...n,p])]}return a}return[]},"extractExportFilenames");var Va=Object.defineProperty,Ne=v((e,t)=>Va(e,"name",{value:t,configurable:!0}),"y$2");const Ha=Ne((e,t)=>e.key==="exports"&&e.subKey===E.P?E.P:e.key==="exports"&&e.subKey===E.b?E.b:t,"getEnvironment"),ge=Ne((e,t,i,n,o,a,s)=>{const r=Ha(o,a.environment);let p="node";for(const u of E.R)if(o.file.includes("."+u+".")||o.subKey===u){p=u;break}let l=e.find(u=>u.input===t&&u.environment===r&&u.runtime===p);l===void 0?l=e[e.push({environment:r,exportKey:new Set([o.exportKey].filter(Boolean)),input:t,runtime:p})-1]:l.exportKey&&o.exportKey&&l.exportKey.add(o.exportKey),s&&(l.isGlob=!0),i&&(l.outDir=n),o.isExecutable?(l.executable=!0,l.declaration=!1,o.type==="cjs"?l.cjs=!0:o.type==="esm"&&(l.esm=!0)):(/\.d\.[mc]?ts$/.test(o.file)&&a.options.declaration!==!1&&(l.declaration=a.options.declaration),o.type==="cjs"?l.cjs=!0:o.type==="esm"&&(l.esm=!0));const c=o.file.replace(f.extname(o.file),"").replace(new RegExp(`^./${a.options.outDir.replace(/^\.\//,"")}/`),"");E.a.has(o.subKey)&&!t.includes(c)&&(l.fileAlias=c)},"createOrUpdateEntry");let lt=!1;const pt=Ne(e=>{if(e.pkg?.dependencies?.typescript===void 0&&e.pkg?.devDependencies?.typescript===void 0)throw new Error("You tried to use a `.ts`, `.cts` or `.mts` file but `typescript` was not found in your package.json.")},"validateIfTypescriptIsInstalled"),Ga=Ne((e,t,i)=>{const n=[];t.sort((r,p)=>r.split("/").length-p.split("/").length);const o=e.type==="module"?"esm":"cjs";o==="esm"&&(i.options.emitESM=!0),o==="cjs"&&(i.options.emitCJS=!0);const a=Ke(e.exports,o,i.options.declaration);if(e.bin){const r=(typeof e.bin=="string"?[e.bin]:Object.values(e.bin)).filter(Boolean);for(const p of r){const l=$e(p);if(l&&l!==o)throw new Error(`Exported file "${p}" has an extension that does not match the package.json type "${e.type??"commonjs"}".`);a.push({file:p,isExecutable:!0,key:"bin",type:l??o})}}e.main&&a.push({file:e.main,key:"main",type:$e(e.main)??o}),e.module&&a.push({file:e.module,key:"module",type:"esm"}),(e.types||e.typings)&&(pt(i),i.options.declaration===void 0&&(i.options.declaration="compatible"),a.push({file:e.types??e.typings,key:"types"}));const s=[];for(const r of a){const p=f.extname(r.file);if(p!==""&&!E.D.includes(p))continue;i.options.declaration===void 0&&(r.key==="types"||r.subKey==="types")&&(i.options.declaration=r.file.includes(".d.ts")?"compatible":!0),i.options.emitCJS===void 0&&r.type==="cjs"&&(i.options.emitCJS=!0),i.options.emitESM===void 0&&r.type==="esm"&&(i.options.emitESM=!0);const l=r.file.replace(/(?:\*[^/\\]|\.d\.[mc]?ts|\.\w+)$/,""),c=l.endsWith("/");if(c&&["./","/"].includes(l))continue;const u=l.replace(new RegExp("(./)?"+i.options.outDir),i.options.sourceDir).replace("./",""),d="(?<=/|$)",m=c?"":"(\\.[cm]?[tj]sx?)$";if(r.file.includes("/*")&&r.key==="exports"){lt||(i.logger.debug("Private subfolders are not supported, if you need this feature please open an issue on GitHub."),lt=!0);const g=[],h=new RegExp(d+u.replace("*","(.*)")+m),b=new RegExp(d+u.replace(/(.*)\.[^.]*$/,"$1").replace("*","(.*)")+m);for(const $ of t)(h.test($)||E.a.has(r.subKey)&&b.test($))&&g.push($);if(g.length===0){n.push(`Could not find entrypoint for \`${r.file}\``);continue}for(const $ of g)ge(s,$,c,l,r,i,!0);continue}const w=new RegExp(d+u+m);let k=t.find(g=>w.test(g));if(E.a.has(r.subKey)&&k===void 0){const g=new RegExp(d+u.replace(/(.*)\.[^.]*$/,"$1")+m);k=t.find(h=>g.test(h))}if(k===void 0){S.isAccessibleSync(f.resolve(i.options.rootDir,r.file))||n.push(`Could not find entrypoint for \`${r.file}\``);continue}(k.endsWith(".ts")||k.endsWith(".cts")||k.endsWith(".mts"))&&S.isAccessibleSync(k)&&pt(i);const x=f.toNamespacedPath(k.replace(E.E,""));S.isAccessibleSync(x+".cts")&&S.isAccessibleSync(x+".mts")?(ge(s,x+".cts",c,l,{...r,type:"cjs"},i,!1),ge(s,x+".mts",c,l,{...r,type:"esm"},i,!1)):ge(s,k,c,l,r,i,!1)}return{entries:s,warnings:n}},"inferEntries");var Ya=Object.defineProperty,Qa=v((e,t)=>Ya(e,"name",{value:t,configurable:!0}),"o$3");const Za=Qa((e,t)=>{const{publishConfig:i}=e;return i&&(i.bin&&(typeof i.bin=="object"||typeof i.bin=="string")&&(e.bin=i.bin),i.type&&typeof i.type=="string"&&i.type!==""&&(e.type=i.type),i.main&&typeof i.main=="string"&&i.main!==""&&(e.main=i.main),i.module&&typeof i.module=="string"&&i.module!==""&&(e.module=i.module),t===void 0&&i.types&&typeof i.types=="string"&&i.types!==""?e.types=i.types:t===void 0&&i.typings&&typeof i.typings=="string"&&i.typings!==""&&(e.typings=i.typings),i.exports&&typeof i.exports=="object"&&(e.exports=i.exports)),e},"overwriteWithPublishConfig");var Xa=Object.defineProperty,es=v((e,t)=>Xa(e,"name",{value:t,configurable:!0}),"t$3");const ts={hooks:{"build:prepare":es(function(e){if(e.options.entries.length>0)return;const t=f.join(e.options.rootDir,e.options.sourceDir);if(!S.isAccessibleSync(t))throw new Error("No 'src' directory found. Please provide entries manually.");const i=S.collectSync(t,{extensions:[],includeDirs:!1,includeSymlinks:!1});if(i.length===0)throw new Error("No source files found in 'src' directory. Please provide entries manually.");let n={...e.pkg};n.publishConfig&&(e.logger.info('Using publishConfig found in package.json, to override the default key-value pairs of "'+Object.keys(n.publishConfig).join(", ")+'".'),e.logger.debug(n.publishConfig),n=Za(n,e.options.declaration));const o=Ga(n,i,e);for(const a of o.warnings)N(e,a);if(e.options.entries.push(...o.entries),e.options.entries.length===0)throw new Error("No entries detected. Please provide entries manually.");e.logger.info("Automatically detected entries:",j.cyan(e.options.entries.map(a=>a.fileAlias?j.bold(a.fileAlias)+" => "+j.bold(a.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*")):j.bold(a.input.replace(`${e.options.rootDir}/`,"").replace(/\/$/,"/*"))).join(", ")),j.gray([e.options.emitESM&&"esm",e.options.emitCJS&&"cjs",e.options.declaration&&"dts"].filter(Boolean).map(a=>`[${a}]`).join(" ")))},"build:prepare")}};var is=Object.defineProperty,ns=v((e,t)=>is(e,"name",{value:t,configurable:!0}),"t$2");const os=ns(async(e,t)=>{if(e==="auto")e=ts;else{if(e==="none")return{};typeof e=="string"&&(e=await t.import(e)||{})}return typeof e=="function"&&(e=e()),e},"resolvePreset");var as=Object.defineProperty,ss=v((e,t)=>as(e,"name",{value:t,configurable:!0}),"j");const rs=ss(async e=>{const t=e.options.jiti.transformOptions?.babel?.plugins,i=[],n=JSON.stringify({...e.options.jiti,alias:{...Pe(e.pkg,e.options),...e.options.jiti.alias},transformOptions:{...e.options.jiti.transformOptions,babel:{...e.options.jiti.transformOptions?.babel,plugins:"__$BABEL_PLUGINS"}}},null,2).replace('"__$BABEL_PLUGINS"',Array.isArray(t)?"["+t.map((o,a)=>{if(Array.isArray(o)){const[s,...r]=o;return i.push(s),"["+["plugin"+a,...r.map(p=>JSON.stringify(p))].join(", ")+"]"}return i.push(o),"plugin"+a}).join(",")+"]":"[]");for(const o of e.options.entries){const a=f.resolve(e.options.rootDir,e.options.outDir,o.name),s=te.fileURLToPath(e.jiti.esmResolve(o.input,{try:!0})??o.input),r=s.replace(E.E,""),p=S.readFileSync(s),l=Mo(p);let c=[];try{c=await te.resolveModuleExportNames(s,{extensions:E.D})}catch(d){N(e,`Cannot analyze ${s} for exports: ${d.toString()}`);return}const u=c.includes("default")||c.length===0;if(e.options.emitESM){const d=f.relative(f.dirname(a),await te.resolvePath("jiti",{conditions:["node","import"],url:typeof document>"u"?require("url").pathToFileURL(__filename).href:ee&&ee.tagName.toUpperCase()==="SCRIPT"&&ee.src||new URL("packem.cjs",document.baseURI).href})),m=r+".d.mts";S.writeFileSync(`${a}.mjs`,l+['import { createJiti } from "'+d+'";',...i.map((w,k)=>"import plugin"+k+' from "'+w+'";'),"","const jiti = createJiti(import.meta.url, "+n+");","",'/** @type {import("'+m+'")} */','const _module = await jiti.import("'+s+'");',u?` export default _module;`:"",...c.filter(w=>w!=="default").map(w=>`export const ${w} = _module.${w};`)].join(` `)),e.options.declaration&&S.writeFileSync(`${a}.d.mts`,'export * from "'+m+`"; `+(u?'export { default } from "'+m+'";':""))}if(e.options.emitCJS){const d=f.relative(f.dirname(a),await te.resolvePath("jiti",{conditions:["node","require"],url:typeof document>"u"?require("url").pathToFileURL(__filename).href:ee&&ee.tagName.toUpperCase()==="SCRIPT"&&ee.src||new URL("packem.cjs",document.baseURI).href})),m=r+".d.cts";S.writeFileSync(`${a}.cjs`,l+['const { createJiti } = require("'+d+'");',...i.map((w,k)=>"const plugin"+k+" = require("+JSON.stringify(w)+")"),"","const jiti = createJiti(__filename, "+n+");","",'/** @type {import("'+m+'")} */','module.exports = jiti("'+s+'")'].join(` `)),e.options.declaration&&S.writeFileSync(a+".d.cts",'export * from "'+m+`"; `+(u?'export { default } from "'+m+'";':""))}l&&(await qe(`${a}.cjs`),await qe(`${a}.mjs`))}await e.hooks.callHook("rollup:done",e)},"createStub");var ls=Object.defineProperty,Ve=v((e,t)=>ls(e,"name",{value:t,configurable:!0}),"i$2");const ps=Ve(e=>{const{message:t,name:i="Error",stack:n}=e;if(!n)return n;const o=`${i}: ${t} `;return n.startsWith(o)?n.slice(o.length):n},"extractStack"),cs=Ve(e=>` ${e.replaceAll(/^\n|\n$/g,"")} `,"normalizeCodeFrame"),Vt=Ve(e=>{const t=ps(e);let i=(e.plugin?`[${e.plugin}] `:"")+e.message;e.id&&(i+=` file: ${j.cyan(e.id+(e.loc?":"+e.loc.line+":"+e.loc.column:""))}`),e.frame&&(i+=` `+j.yellow(cs(e.frame))),e.message=i,t!==void 0&&(e.stack=`${e.message} ${t}`)},"enhanceRollupError");var ds=Object.defineProperty,Ht=v((e,t)=>ds(e,"name",{value:t,configurable:!0}),"d$3");const Ee="rollup-watch.json",ct=Ht(({context:e,doOnSuccessCleanup:t,fileCache:i,mode:n,runBuilder:o,runOnsuccess:a,useCache:s,watcher:r})=>{const p="watcher:"+n;r.on("change",async(l,{event:c})=>{await t?.(),e.logger.info({message:`${j.cyan(f.relative(".",l))} was ${c}d`,prefix:p})}),r.on("restart",()=>{e.logger.info({message:"Rebuilding ...",prefix:p})}),r.on("event",async l=>{switch(l.code){case"END":{e.logger.success({message:"Rebuild finished",prefix:p}),await a?.();break}case"BUNDLE_START":{e.logger.info({message:j.cyan("build started..."),prefix:p});break}case"BUNDLE_END":{await l.result.close(),s&&i.set(n==="bundle"?Ee:"dts-"+Ee,l.result.cache),e.logger.raw(` ⚡️ Build run in `+l.duration+`ms `),await o?.(!0);break}case"ERROR":{Vt(l.error),e.logger.error({context:[l.error],message:"Rebuild failed: "+l.error.message,prefix:p});break}}})},"watchHandler"),us=Ht(async(e,t,i,n,o)=>{const a=await Lt(e,t);if(await e.hooks.callHook("rollup:options",e,a),Object.keys(a.input).length===0)return;let s=!0;(e.options.rollup.isolatedDeclarations||e.options.isolatedDeclarationTransformer||e.options.rollup.css)&&(s=!1),s&&(a.cache=t.get(Ee)),e.options.rollup.watch&&typeof a.watch=="object"&&a.watch.include===void 0&&(a.watch={...a.watch,...e.options.rollup.watch},a.watch.include=[f.join(e.options.sourceDir,"**","*"),"package.json","packem.config.*","tsconfig.json","tsconfig.*.json"],Array.isArray(e.options.rollup.watch.include)?a.watch.include=[...a.watch.include,...e.options.rollup.watch.include]:e.options.rollup.watch.include&&a.watch.include.push(e.options.rollup.watch.include),a.watch.chokidar={cwd:e.options.rootDir,...a.watch.chokidar,ignored:["**/.git/**","**/node_modules/**","**/test-results/**",...a.watch.chokidar?.ignored??[]]});const r=pe.watch(a);await e.hooks.callHook("rollup:watch",e,r);const p=[...Array.isArray(a.input)?a.input:typeof a.input=="string"?[a.input]:Object.keys(a.input??{})];let l="Starting watcher for entries:";for(const c of p)l+=j.gray(` └─ ${f.relative(process.cwd(),c)}`);if(e.logger.info(l),ct({context:e,doOnSuccessCleanup:o,fileCache:t,mode:"bundle",runBuilder:i,runOnsuccess:n,useCache:s,watcher:r}),e.options.declaration&&e.options.rollup.isolatedDeclarations&&e.options.isolatedDeclarationTransformer)e.logger.info({message:"Using isolated declaration transformer to generate declaration files...",prefix:"dts"});else if(e.options.declaration){const c=await Ut(e,t);s&&(c.cache=t.get("dts-"+Ee)),await e.hooks.callHook("rollup:dts:options",e,c);const u=pe.watch(c);await e.hooks.callHook("rollup:watch",e,u),ct({context:e,fileCache:t,mode:"types",useCache:s,watcher:u})}},"watch");var ms=Object.defineProperty,fs=v((e,t)=>ms(e,"name",{value:t,configurable:!0}),"s$5");const gs=fs(async e=>{const t=[];if(e.options.clean)for(const i of new Set(e.options.entries.map(n=>n.outDir).filter(Boolean).sort()))i===e.options.rootDir||i===e.options.sourceDir||e.options.rootDir.startsWith(i.endsWith("/")?i:`${i}/`)||t.some(n=>i.startsWith(n))||(t.push(i),e.logger.info(`Cleaning dist directory: \`./${f.relative(e.options.rootDir,i)}\``),await S.emptyDir(i))},"cleanDistributionDirectories");var vs=Object.defineProperty,Gt=v((e,t)=>vs(e,"name",{value:t,configurable:!0}),"s$4");const hs=Gt(e=>{try{JSON.parse(e)}catch{return!1}return!0},"isJson");let ys=class{static{v(this,"g")}static{Gt(this,"FileCache")}#n;#e;#o;#t=!0;#i=new Map;constructor(t,i,n,o){this.#n=t,this.#o=n,i===void 0?o.debug({message:"Could not create cache directory.",prefix:"file-cache"}):(this.#e=i,o.debug({message:"Cache path is: "+this.#e,prefix:"file-cache"}))}set isEnabled(t){this.#t=t}has(t,i){return!this.#t||this.#e===void 0?!1:S.isAccessibleSync(this.getFilePath(t,i))}get(t,i){if(!this.#t||this.#e===void 0)return;const n=this.getFilePath(t,i);if(this.#i.has(n))return this.#i.get(n);if(!S.isAccessibleSync(n))return;const o=S.readFileSync(n);if(hs(o)){const a=JSON.parse(o);return this.#i.set(n,a),a}return this.#i.set(n,o),o}set(t,i,n){if(!this.#t||this.#e===void 0||i===void 0)return;const o=this.getFilePath(t,n);(typeof i=="object"||typeof i=="number"||typeof i=="boolean")&&(i=JSON.stringify(i)),S.writeFileSync(o,i,{overwrite:!0})}getFilePath(t,i){let n=t.replaceAll(f.toNamespacedPath(this.#n),"");return n=n.replaceAll(":","-"),f.join(this.#e,this.#o,i?.replaceAll(":","-")??"",f.toNamespacedPath(n))}};var xs=Object.defineProperty,bs=v((e,t)=>xs(e,"name",{value:t,configurable:!0}),"t$1");const ws=bs(async(e,t="")=>{let i=t;if(!i){const n=["packem.config.js","packem.config.mjs","packem.config.cjs","packem.config.ts","packem.config.cts","packem.config.mts"];for(const o of n)if(await S.isAccessible(f.join(e,o))){i="./"+o;break}}if(!/\.(?:js|mjs|cjs|ts|cts|mts)$/.test(i))throw new Error("Invalid packem config file extension. Only .js, .mjs, .cjs, .ts, .cts and .mts extensions are allowed.");return i},"findPackemFile");var ks=Object.defineProperty,ve=v((e,t)=>ks(e,"name",{value:t,configurable:!0}),"l$4");const js=U.createFilter,$s=ve((e,t)=>{const{sideEffects:i}=t;let n;if(typeof i=="boolean")n=ve(()=>i,"hasSideEffects");else if(Array.isArray(i))if(i.length<=0)n=ve(()=>!1,"hasSideEffects");else{const o=i.map(a=>a.includes("/")?a:`**/${a}`);n=js(o,null,{resolve:e})}else n=ve(()=>null,"hasSideEffects");return n},"getPackageSideEffect");var Ie,dt;function Es(){if(dt)return Ie;dt=1;var e=Object.defineProperty,t=v((p,l)=>e(p,"name",{value:l,configurable:!0}),"s"),i=Ti,n=i.spawn,o=i.exec;Ie=v(function(p,l,c){if(typeof l=="function"&&c===void 0&&(c=l,l=void 0),p=parseInt(p),Number.isNaN(p)){if(c)return c(new Error("pid must be a number"));throw new Error("pid must be a number")}var u={},d={};switch(u[p]=[],d[p]=1,process.platform){case"win32":o("taskkill /pid "+p+" /T /F",c);break;case"darwin":r(p,u,d,function(m){return n("pgrep",["-P",m])},function(){a(u,l,c)});break;default:r(p,u,d,function(m){return n("ps",["-o","pid","--no-headers","--ppid",m])},function(){a(u,l,c)});break}},"treeKill");function a(p,l,c){var u={};try{Object.keys(p).forEach(function(d){p[d].forEach(function(m){u[m]||(s(m,l),u[m]=1)}),u[d]||(s(d,l),u[d]=1)})}catch(d){if(c)return c(d);throw d}if(c)return c()}v(a,"killAll"),t(a,"killAll");function s(p,l){try{process.kill(parseInt(p,10),l)}catch(c){if(c.code!=="ESRCH")throw c}}v(s,"killPid"),t(s,"killPid");function r(p,l,c,u,d){var m=u(p),w="";m.stdout.on("data",function(g){var g=g.toString("ascii");w+=g});var k=t(function(x){if(delete c[p],x!=0){Object.keys(c).length==0&&d();return}w.match(/\d+/g).forEach(function(g){g=parseInt(g,10),l[p].push(g),l[g]=[],c[g]=1,r(g,l,c,u,d)})},"onClose");m.on("close",k)}return v(r,"buildProcessTree"),t(r,"buildProcessTree"),Ie}v(Es,"requireTreeKill");var Ss=Es();const Os=yt.g(Ss);var Ps=Object.defineProperty,Yt=v((e,t)=>Ps(e,"name",{value:t,configurable:!0}),"l$3");const Ds=Yt(e=>process.platform==="win32"&&"cmd"in e&&"code"in e&&typeof e.cmd=="string"&&e.cmd.startsWith("taskkill")&&e.code===128,"isTaskKillCmdProcessNotFoundError"),Ns=Yt(async({pid:e,signal:t})=>await new Promise((i,n)=>{if(!Number.isInteger(e)||e<=0){n(new Error("Invalid process ID"));return}Os(e,t,o=>{if(o&&!Ds(o)){n(o);return}i()})}),"killProcess");var _s=Object.defineProperty,Cs=v((e,t)=>_s(e,"name",{value:t,configurable:!0}),"n$1");const Qt=Cs(e=>{const t=f.join(e,"package.json");if(!S.isAccessibleSync(t))throw new Error("package.json not found at "+t);return{packageJson:Si.parsePackageJson(t),packageJsonPath:t}},"loadPackageJson");var Ms=Object.defineProperty,As=v((e,t)=>Ms(e,"name",{value:t,configurable:!0}),"r$3");const ut=As((e,t)=>{if(e.warnings.size>0&&(t&&e.logger.raw(` `),e.logger.warn(`Build is done with some warnings: ${[...e.warnings].map(i=>`- ${i}`).join(` `)}`),e.options.failOnWarn))throw new Error("Exiting with code (1). You can change this behavior by setting `failOnWarn: false`.")},"logBuildErrors");var Fs=Object.defineProperty,Zt=v((e,t)=>Fs(e,"name",{value:t,configurable:!0}),"r$2");const mt=Zt(async(e,t)=>{if(typeof e.name!="string"){let i=f.isAbsolute(e.input)?f.relative(t.options.rootDir,e.input):f.normalize(e.input);i.startsWith("./")&&(i=i.slice(2)),e.name=i.replace(new RegExp(`^${t.options.sourceDir}/`),"").replace(E.E,"")}if(!e.input)throw new Error(`Missing entry input: ${JSON.stringify(e)}`);Se.isRelative(e.input)&&(e.input=f.resolve(t.options.rootDir,e.input)),t.options.declaration&&e.declaration===void 0&&(e.declaration=t.options.declaration),e.executable&&(e.cjs===void 0||e.esm===void 0)?t.pkg.type==="commonjs"&&e.cjs===void 0&&t.options.emitCJS!==void 0?(e.cjs=t.options.emitCJS,e.esm=!1):t.pkg.type==="module"&&e.esm===void 0&&t.options.emitESM!==void 0&&(e.esm=t.options.emitESM,e.cjs=!1):e.cjs===void 0&&e.esm===void 0&&(t.options.emitCJS!==void 0&&(e.cjs=t.options.emitCJS),t.options.emitESM!==void 0&&(e.esm=t.options.emitESM)),e.outDir=f.resolve(t.options.rootDir,e.outDir??t.options.outDir)},"extendEntry"),Is=Zt(async e=>{e.options.entries=e.options.entries.map(t=>typeof t=="string"?{input:t,isGlob:he.isDynamicPattern(t)}:{...t,exportKey:t.exportKey??new Set,isGlob:he.isDynamicPattern(t.input)});for(const t of e.options.entries.filter(i=>i.isGlob)){const{isGlob:i,...n}=t,o=["**/.git/**","**/node_modules/**","**/test-results/**"];if(e.options.rollup.watch){if(typeof e.options.rollup.watch.exclude=="string")o.push(e.options.rollup.watch.exclude);else if(Array.isArray(e.options.rollup.watch.exclude))for(const s of e.options.rollup.watch.exclude)typeof s=="string"&&o.push(s)}const a=he.globSync([n.input],{cwd:e.options.rootDir,dot:!1,ignore:o,onlyFiles:!0});if(a.length===0)throw new Oi.NotFoundError("No files found in the glob pattern: "+j.cyan(f.join(e.options.rootDir,n.input)));for(const s of a)e.options.entries.push({...n,input:f.resolve(e.options.rootDir,s)});e.options.entries.splice(e.options.entries.indexOf(t),1)}for(const t of e.options.entries.filter(i=>i.fileAlias===void 0))await mt(t,e);for(const t of e.options.entries.filter(i=>i.fileAlias!==void 0))t.name=t.fileAlias,t.fileAlias=void 0,await mt(t,e)},"prepareEntries");var Ts=Object.defineProperty,zs=v((e,t)=>Ts(e,"name",{value:t,configurable:!0}),"a$4");const Rs=zs(async(e,t,i)=>{if(e&&await S.isAccessible(f.join(e,"keystore.json"))){const n=await S.readJson(f.join(e,"keystore.json"));let o=await Y.readdir(e,{withFileTypes:!0});o=o.filter(s=>s.isDirectory());let a=i;for(const s of o)if(!n[s.name]){try{await Y.rm(f.join(e,s.name),{force:!0,recursive:!0})}catch(r){t.error({message:`Failed to remove cache directory ${s.name}: ${r instanceof Error?r.message:String(r)}`,prefix:"file-cache"});continue}a&&t.raw(` `),t.info({message:"Removing "+s.name+" file cache, the cache key is not used anymore.",prefix:"file-cache"}),a=!1}}},"removeOldCacheFolders");var qs=Object.defineProperty,Js=v((e,t)=>qs(e,"name",{value:t,configurable:!0}),"a$3");const Bs=Js((e,t)=>e.some(i=>i instanceof RegExp?i.test(t):i===t),"arrayIncludes");var Ws=Object.defineProperty,Ls=v((e,t)=>Ws(e,"name",{value:t,configurable:!0}),"a$2");const Us=Ls((e="")=>{const t=e.split("/");return t[0].startsWith("@")?t[0]+"/"+t[1]:t[0]},"getPackageName");var Ks=Object.defineProperty,Vs=v((e,t)=>Ks(e,"name",{value:t,configurable:!0}),"o");const Hs=Vs(e=>{if(e.options.validation?.packageJson?.dependencies===!1)return;const t=new Set,i=new Set(Object.keys(e.pkg?.dependencies??{})),n=new Set;for(const o of e.usedImports)i.delete(o),t.add(o);if(e.pkg?.dependencies)for(const o of Object.keys(e.pkg?.dependencies))i.delete(o);for(const o of t){const a=Us(o);!Bs(e.options.externals,o)&&!o.startsWith("chunks/")&&![...Ge.builtinModules,...Ge.builtinModules.map(s=>`node:${s}`)].includes(a)&&e.pkg?.dependencies?.[a]===void 0&&e.pkg?.peerDependencies?.[a]===void 0&&e.pkg.peerDependenciesMeta?.[a]?.optional!==!0&&n.add(o)}i.size>0&&N(e,`Potential unused dependencies found: ${[...i].map(o=>j.cyan(o)).join(", ")}`),n.size>0&&N(e,`Potential implicit dependencies found: ${[...n].map(o=>j.cyan(o)).join(", ")}`)},"validateDependencies");var Gs=Object.defineProperty,Xt=v((e,t)=>Gs(e,"name",{value:t,configurable:!0}),"i$1");const Ys=Xt((e,t)=>Pi.distance(e,t)<=e.length/3||t.includes(e),"isSimilar"),Qs=Xt((e,t)=>{const i=e.toLowerCase();return t.filter(n=>Ys(n.toLowerCase(),i))},"findAlternatives");var Zs=Object.defineProperty,ft=v((e,t)=>Zs(e,"name",{value:t,configurable:!0}),"r");const Xs=ft(e=>{const{options:t}=e;if(t.validation?.packageJson?.exports===!1)return;const i=t.validation?.packageJson,n=new Set([t.declaration&&i?.types?e.pkg.types:"",t.declaration&&i?.types?e.pkg.typings:"",...t.dtsOnly||i?.bin===!1?[""]:typeof e.pkg.bin=="string"?[e.pkg.bin]:Object.values(e.pkg.bin??{}),t.dtsOnly&&i?.main===!1?"":e.pkg.main,t.dtsOnly&&i?.module===!1?"":e.pkg.module,...i?.exports===!1?[]:Ke(e.pkg.exports,e.pkg.type==="module"?"esm":"cjs",t.declaration).map(r=>t.dtsOnly?r.subKey==="types"?r.file:void 0:r.file)].filter(Boolean).map(r=>r&&f.resolve(t.rootDir,r.replace(/\/[^*/]*\*[^\n\r/\u2028\u2029]*(?:[\n\r\u2028\u2029][^*/]*\*[^\n\r/\u2028\u2029]*)*(?:\/.*)?$/,"")))),o=[];for(const r of n)r&&!r.includes("*")&&!be.existsSync(r)&&o.push(r.replace(`${t.rootDir}/`,""));const a=ft(r=>f.relative(t.rootDir,f.resolve(t.outDir,r)),"rPath"),s=e.buildEntries.filter(r=>!r.chunk).map(r=>a(r.path));if(o.length>0){let r="Potential missing or wrong package.json files:";for(const p of o){const l=Qs(p,s);r+=` - `+j.cyan(p)+(l.length>0?j.grey` (did you mean ${l.map(c=>`"${c}"`).join(", ")}?)`:"")}N(e,r)}},"validatePackageEntries");var er=Object.defineProperty,tr=v((e,t)=>er(e,"name",{value:t,configurable:!0}),"l$1");const ir=tr(e=>{const{options:{validation:t},pkg:i}=e;i.name===void 0&&t?.packageJson?.name!==!1&&N(e,"The 'name' field is missing in your package.json. Please provide a valid package name."),t?.packageJson?.files!==!1&&(i.files===void 0?N(e,"The 'files' field is missing in your package.json. Add the files to be included in the package."):i.files.length===0?N(e,"The 'files' field in your package.json is empty. Please specify the files to be included in the package."):i.files.some(a=>a.includes(e.options.outDir))||N(e,`The 'files' field in your package.json is missing the '${e.options.outDir}' directory. Ensure the output directory is included.`));const n=i.type==="commonjs"||i.type===void 0,o=i.type==="module";if(n?(t?.packageJson?.main!==!1&&(i.main===void 0&&N(e,"The 'main' field is missing in your package.json. This field should point to your main entry file."),i.main?.includes(".mjs")&&N(e,"The 'main' field in your package.json should not use a '.mjs' extension for CommonJS modules.")),t?.packageJson?.module!==!1&&(i.module===void 0&&e.options.emitESM&&N(e,"The 'module' field is missing in your package.json, but you are emitting ES modules."),i.module&&i.main&&i.module===i.main&&N(e,`Conflict detected: The 'module' and 'main' fields both point to '${i.module}'. Please ensure they refer to different module types.`),e.options.emitESM&&i.module?.includes(".cjs")&&N(e,"The 'module' field in your package.json should not use a '.cjs' extension for ES modules."))):o&&(i.exports===void 0&&!e.options.emitCJS?t?.packageJson?.exports!==!1&&N(e,"The 'exports' field is missing in your package.json. Define module exports explicitly."):e.options.emitCJS&&(t?.packageJson?.main!==!1&&i.main===void 0&&N(e,"The 'main' field is missing in your package.json. This field is needed when emitting CommonJS modules."),t?.packageJson?.module!==!1&&(i.module===void 0&&N(e,"The 'module' field is missing in your package.json. This field is necessary when emitting ES modules."),i.module?.includes(".cjs")&&N(e,"The 'module' field should not use a '.cjs' extension for ES modules."),i.module&&i.main&&i.module===i.main&&N(e,`Conflict detected: The 'module' and 'main' fields both point to '${i.module}'. Please ensure they refer to different module types.`)),t?.packageJson?.exports!==!1&&i.exports===void 0&&N(e,"The 'exports' field is missing in your package.json. This field is required for defining explicit exports."))),t?.packageJson?.bin!==!1){if(typeof i.bin=="string"&&i.bin.includes(n?".mjs":".cjs"))N(e,`The 'bin' field in your package.json should not use a ${n?".mjs":".cjs"} extension for ${n?"CommonJS":"ES modules"} binaries.`);else if(typeof i.bin=="object")for(const[a,s]of Object.entries(i.bin))s&&s.includes(n?".mjs":".cjs")&&N(e,`The 'bin.${a}' field in your package.json should not use a ${n?".mjs":".cjs"} extension for ${n?"CommonJS":"ES modules"} binaries.`)}if(e.options.declaration){let a=!0;i.type==="module"&&(a=!!i.main?.endsWith(".cjs")),i.types===void 0&&i.typings===void 0&&a&&t?.packageJson?.types!==!1&&N(e,"The 'types' field is missing in your package.json. This field should point to your type definitions file."),(e.options.declaration===!0||e.options.declaration==="compatible")&&a&&t?.packageJson?.typesVersions!==!1&&(i.typesVersions===void 0||Object.keys(i.typesVersions).length===0)&&N(e,"No 'typesVersions' field found in your package.json. Consider adding this field, or change the declaration option to 'node16' or 'false'.")}},"validatePackageFields");var nr=Object.defineProperty,or=v((e,t)=>nr(e,"name",{value:t,configurable:!0}),"i");const ar=or(e=>{const{packageJson:t}=Qt(e.options.rootDir);e.pkg=t,Hs(e),ir(e),Xs(e)},"validator");var sr=Object.defineProperty,rr=v((e,t)=>sr(e,"name",{value:t,configurable:!0}),"a");const lr=/^[^a-z_@#~]|[^\w/@#~-]|@\/|#\/|~\//i,pr=new Set(["abstract","await","boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","let","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with","yield"]),gt=rr(e=>{if(!Array.isArray(e)&&e!==null)for(const[t,i]of Object.entries(e)){if(typeof t!="string"||t.trim()==="")throw new Error(`Alias name "${t}" is invalid. Alias names should be non-empty strings.`);if(lr.test(t))throw new Error(`Alias name "${t}" is invalid. Alias names should start with a letter or underscore and only contain letters, numbers, underscores, and dashes.`);if(pr.has(t))throw new Error(`Alias name "${t}" is a reserved keyword and cannot be used.`);const n=f.resolve(i);if(!S.isAccessibleSync(n))throw new Error(`Target path "${n}" for alias "${t}" does not exist.`)}},"validateAliasEntries");var cr=Object.defineProperty,q=v((e,t)=>cr(e,"name",{value:t,configurable:!0}),"c");const dr=q(e=>{switch(e){case"preserve":case"react-native":return"preserve";case"react":return"transform";case"react-jsx":case"react-jsxdev":return"automatic";default:return}},"resolveTsconfigJsxToJsxRuntime"),ur=q((e,t,i,n,o,a,s,r,p)=>{const l=dr(p?.config.compilerOptions?.jsx),c=oi.defu(a,o,s,{alias:{},browserTargets:Di(),cjsInterop:!1,clean:!0,debug:n,declaration:void 0,emitCJS:void 0,emitESM:void 0,entries:[],externals:[],failOnWarn:!0,fileCache:!0,jiti:{alias:{},debug:n,interopDefault:!0},minify:i===E.P,name:(r.name??"").split("/").pop()??"default",outDir:p?.config.compilerOptions?.outDir??"dist",rollup:{alias:{},cjsInterop:{addDefaultProperty:!1},commonjs:{extensions:[".mjs",".js",".json",".node",".cjs"],ignoreTryCatch:!0,preserveSymlinks:!0,transformMixedEsModules:!1},css:{autoModules:!0,extensions:[".css",".pcss",".postcss",".sss"],namedExports:!0},dts:{compilerOptions:{baseUrl:p?.config.compilerOptions?.baseUrl??".",checkJs:!1,composite:!1,declaration:!0,declarationMap:!1,emitDeclarationOnly:!0,incremental:!1,moduleResolution:100,noEmit:!1,noEmitOnError:!0,preserveSymlinks:!1,skipLibCheck:!0,target:99},respectExternal:!0},dynamicVars:{errorWhenNoFilesFound:!0,exclude:E.c,include:/\bimport\s*[(/]/},esbuild:{charset:"utf8",jsx:l,jsxDev:p?.config.compilerOptions?.jsx==="react-jsxdev",jsxFactory:p?.config.compilerOptions?.jsxFactory,jsxFragment:p?.config.compilerOptions?.jsxFragmentFactory,jsxImportSource:p?.config.compilerOptions?.jsxImportSource,jsxSideEffects:!0,keepNames:!0,sourcesContent:!1,target:p?.config.compilerOptions?.target,treeShaking:!0,tsconfigRaw:p?.config},isolatedDeclarations:{exclude:E.c,ignoreErrors:!1,include:E.A},json:{preferConst:!0},license:{dependenciesTemplate:q((u,d,m)=>` # Licenses of bundled dependencies The published ${m} artifact additionally contains code with the following licenses: `+(u.length>0?`${u.join(", ")} `:` `)+`# Bundled dependencies: `+d,"dependenciesTemplate"),dtsTemplate:q((u,d,m)=>` # Licenses of bundled types The published ${m} artifact additionally contains code with the following licenses: `+(u.length>0?`${u.join(", ")} `:` `)+`# Bundled types: `+d,"dtsTemplate")},node10Compatibility:{},patchTypes:{},polyfillNode:{},preserveDirectives:{include:E.A},preserveDynamicImports:!0,raw:{exclude:E.c,include:[/\.(md|txt|htm|html|data)$/]},replace:{objectGuards:!0,preventAssignment:!0},resolve:{allowExportsFolderMapping:!1,exportConditions:["module-sync"],extensions:E.D,preferBuiltins:!1},resolveExternals:{builtins:!0,builtinsPrefix:"add",deps:!0,devDeps:!1,exclude:[],optDeps:!0,peerDeps:!0},shebang:{replace:!1,shebang:"#!/usr/bin/env node"},shim:{exclude:E.c,include:E.A},sourcemap:{},sucrase:{disableESTransforms:!0,enableLegacyBabel5ModuleInterop:!1,enableLegacyTypeScriptModuleInterop:p?.config.compilerOptions?.esModuleInterop===!1,include:E.A,injectCreateRequireForImportRequire:!1,preserveDynamicImport:!0,production:i===E.P,...p?.config.compilerOptions?.jsx&&["react","react-jsx","react-jsxdev"].includes(p.config.compilerOptions.jsx)?{jsxFragmentPragma:p.config.compilerOptions.jsxFragmentFactory,jsxImportSource:p.config.compilerOptions.jsxImportSource,jsxPragma:p.config.compilerOptions.jsxFactory,jsxRuntime:l,transforms:["typescript","jsx",...p.config.compilerOptions.esModuleInterop?["imports"]:[]]}:{transforms:["typescript",...p?.config.compilerOptions?.esModuleInterop?["imports"]:[]]}},swc:{include:E.A,inlineSourcesContent:!1,inputSourceMap:!1,isModule:!0,jsc:{experimental:{keepImportAttributes:!0},externalHelpers:!1,keepClassNames:!0,loose:!0,parser:{decorators:p?.config.compilerOptions?.experimentalDecorators,syntax:p?"typescript":"ecmascript",[p?"tsx":"jsx"]:!0},target:p?.config.compilerOptions?.target?.toLowerCase(),transform:{decoratorMetadata:p?.config.compilerOptions?.emitDecoratorMetadata,decoratorVersion:"2022-03",legacyDecorator:p?.config.compilerOptions?.experimentalDecorators,react:{development:i!==E.P,pragma:p?.config.compilerOptions?.jsxFactory,pragmaFrag:p?.config.compilerOptions?.jsxFragmentFactory,runtime:l,throwIfNamespace:!0},treatConstEnumAsEnum:p?.config.compilerOptions?.preserveConstEnums,useDefineForClassFields:p?.config.compilerOptions?.useDefineForClassFields}},module:{ignoreDynamic:!0,importInterop:"none",preserveImportMeta:!0,strict:!1,strictMode:!1,type:"es6"}},treeshake:{moduleSideEffects:$s(t,r),preset:"recommended",propertyReadSideEffects:!0},tsconfigPaths:{resolveAbsolutePath:!1},url:{emitFiles:!0,fileName:"[hash][extname]",include:["**/*.svg","**/*.png","**/*.jp(e)?g","**/*.gif","**/*.webp"],limit:14*1024},visualizer:{},watch:{chokidar:{ignoreInitial:!0,ignorePermissionErrors:!0},clearScreen:!0,exclude:E.c}},rootDir:t,sourceDir:"src",sourcemap:!1,transformerName:void 0,typedoc:{excludePrivate:!0,groupOrder:["Classes","Constructors","Accessors","Methods","Functions","Namespaces","Variables","Enumerations","Interfaces","Type Aliases","*"],kindSortOrder:["Project","Module","Class","Interface","Function","Namespace","Variable","Enum","EnumMember","TypeAlias","Reference","Constructor","Property","Accessor","Method","Parameter","TypeParameter","TypeLiteral","CallSignature","ConstructorSignature","IndexSignature","GetSignature","SetSignature"],marker:"TYPEDOC",name:r.name??"unknown",pretty:!0,readme:"none",showConfig:n,tsconfig:p?.path}});if(!c.transformerName){const u=new Map([...Object.entries(r.dependencies??{}),...Object.entries(r.devDependencies??{})]);let d="0.0.0";if(u.has("esbuild"))c.transformerName="esbuild",d=u.get("esbuild");else if(u.has("@swc/core"))c.transformerName="swc",d=u.get("@swc/core");else if(u.has("sucrase"))c.transformerName="sucrase",d=u.get("sucrase");else throw new Error("Unknown transformer, check your transformer options or install one of the supported transformers: esbuild, swc, sucrase");e.info("Using "+j.cyan("rollup ")+pe.VERSION),e.info({message:"Using "+j.cyan(c.transformerName)+" "+d,prefix:"transformer"})}return c.rollup.resolve&&c.rollup.resolve.preferBuiltins===!0&&(c.rollup.polyfillNode=!1,e.debug("Disabling polyfillNode because preferBuiltins is set to true")),c.browserTargets&&c.browserTargets.length>0&&e.debug("Using browser targets: "+c.browserTargets.join(", ")),gt(c.alias),c.rollup.alias&&c.rollup.alias.entries&>(c.rollup.alias.entries),c},"generateOptions"),mr=q(async(e,t,i,n,o,a,s,r,p,l)=>{const c=await os(s.preset??a.preset??"auto",l),u=ur(e,t,n,o,a,s,c,r,p);S.ensureDirSync(f.join(u.rootDir,u.outDir));const d={buildEntries:[],dependencyGraphMap:new Map,environment:n,hooks:ai.createHooks(),jiti:vt.createJiti(u.rootDir,u.jiti),logger:e,mode:i,options:u,pkg:r,tsconfig:p,usedImports:new Set,warnings:new Set};c.hooks&&d.hooks.addHooks(c.hooks),a.hooks&&d.hooks.addHooks(a.hooks),s.hooks&&d.hooks.addHooks(s.hooks),await d.hooks.callHook("build:prepare",d),d.options.emitESM===void 0&&d.logger.info("Emitting of ESM bundles, is disabled."),d.options.emitCJS===void 0&&d.logger.info("Emitting of CJS bundles, is disabled."),d.options.minify&&d.logger.info("Minification is enabled, the output will be minified");const m=r.dependencies?.typescript!==void 0||r.devDependencies?.typescript!==void 0;if(d.options.declaration&&d.tsconfig===void 0&&m)throw new Error("Cannot build declaration files without a tsconfig.json");return m?d.options.declaration===!1&&d.logger.info({message:"Generation of declaration files are disabled.",prefix:"dts"}):(d.options.declaration=!1,d.logger.info({message:"Typescript is not installed. Generation of declaration files are disabled.",prefix:"dts"})),d.options.declaration&&d.logger.info("Using typescript version: "+j.cyan(r.devDependencies?.typescript??r.dependencies?.typescript??"unknown")),d.options.declaration&&(r.dependencies?.typescript||r.devDependencies?.typescript)&&!d.tsconfig?.config.compilerOptions?.isolatedModules&&d.logger.warn(`'compilerOptions.isolatedModules' is not enabled in tsconfig. Because none of the third-party transpiler, packem uses under the hood is type-aware, some techniques or features often used in TypeScript are not properly checked and can cause mis-compilation or even runtime errors. To mitigate this, you should set the isolatedModules option to true in tsconfig and let your IDE warn you when such incompatible constructs are used.`),await Is(d),d},"createContext"),fr=q(e=>{switch(e){case"jit":return"Stubbing";case"watch":return"Watching";case"tsdoc":return"Generating TSDoc";default:return"Building"}},"getMode"),gr=q(async(e,t,i,n,o={})=>{const{configPath:a,debug:s,tsconfigPath:r,...p}=o;n.wrapAll(),e=f.resolve(Me.cwd(),e),n.debug("Root directory:",e);const{packageJson:l,packageJsonPath:c}=Qt(e);n.debug("Using package.json found at",c);let u;if(r){const x=f.join(e,r);if(!await S.isAccessible(x))throw new Error("tsconfig.json not found at "+x);u={config:He.readTsConfig(x),path:x},n.info("Using tsconfig settings at",x)}else if(l.dependencies?.typescript||l.devDependencies?.typescript)try{u=await He.findTsConfig(e),n.debug("Using tsconfig settings found at",u.path)}catch{n.info("No tsconfig.json or jsconfig.json found.")}const d=ii.findCacheDirSync("@visulima/packem",{cwd:e});let m=!1,w,k;try{const x=await ws(e,a??""),g=vt.createJiti(e,{debug:s});let h=await g.import(x,{default:!0,try:!0})||{};typeof h=="function"&&(h=await h(i,t)),n.debug("Using packem config found at",f.join(e,x));const b=_.f(JSON.stringify({version:l.version,...l.dependencies,...l.devDependencies,...l.peerDependencies,...l.peerDependenciesMeta,browser:l.browser,eNode:l.engines?.node,exports:l.exports,main:l.main,module:l.module,type:l.type,types:l.types}))+_.f(JSON.stringify(h));d&&xt.d(b,d,n);const $=new ys(e,d,b,n),y=await mr(n,e,t,i,s??!1,p,h,l,u,g);$.isEnabled=y.options.fileCache,y.logger.info(j.cyan(fr(t)+" "+y.options.name)),y.logger.debug({context:y.options.entries,message:`${j.bold("Root dir:")} ${y.options.rootDir} ${j.bold("Entries:")}`}),await gs(y);const P=q(async R=>{for await(const[V,D]of Object.entries(y.options.builder??{})){y.logger.raw(` `),await y.hooks.callHook("builder:before",V,y);const C=Date.now(),O=q(()=>L.duration(Math.floor(Date.now()-C)),"getBuilderDuration");await D(y,d,$,m),await y.hooks.callHook("builder:done",V,y),y.logger.raw(` ⚡️ `+V+" run in "+O()),R&&y.logger.raw(` `)}},"runBuilder"),A=q(async()=>{if(w!==void 0)await Ns({pid:w.pid,signal:p.killSignal??h.killSignal??"SIGTERM"});else if(k!==void 0)try{await k()}catch(R){throw new Error("onSuccess function cleanup failed: "+R.message,{cause:R})}w=void 0,k=void 0},"doOnSuccessCleanup"),J=q(async()=>{if(typeof y.options.onSuccess=="function")try{k=await y.options.onSuccess()}catch(R){throw new Error("onSuccess function failed: "+R.message,{cause:R})}else if(typeof y.options.onSuccess=="string"){const R=y.options.onSuccessTimeout??3e4;if(w=si.exec(y.options.onSuccess,[],{nodeOptions:{shell:!0,stdio:"inherit",timeout:R}}),await w,w.exitCode&&w.exitCode!==0)throw new Error("onSuccess script failed with exit code "+w.exitCode+". Check the output above for details.")}},"runOnsuccess"),z=Date.now(),Z=q(()=>L.duration(Math.floor(Date.now()-z)),"getDuration");if(t==="watch"){if(y.options.rollup.watch===!1)throw new Error("Rollup watch is disabled. You should check your packem.config file.");await us(y,$,P,J,A),ut(y,!1);return}t==="jit"?(await rs(y),await y.hooks.callHook("build:done",y)):(m=await qa(y,$),await y.hooks.callHook("validate:before",y),ar(y),await y.hooks.callHook("validate:done",y),ut(y,m)),y.logger.raw(` ⚡️ Build run in `+Z()),await P(),await J(),Me.on("SIGINT",async()=>{await A()}),Me.on("SIGTERM",async()=>{await A()})}catch(x){throw n.raw(` `),Vt(x),x}finally{n.restoreAll(),await Rs(d,n,m)}},"packem");module.exports=gr;