@stlite/desktop 0.62.1 → 0.62.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/bin/dump_artifacts.js +1 -1
  2. package/build/asset-manifest.json +33 -33
  3. package/build/electron/worker.js +13 -20
  4. package/build/index.html +1 -1
  5. package/build/static/css/main.fc8432ac.css +1 -0
  6. package/build/static/js/1046.ac5578f7.chunk.js +1 -0
  7. package/build/static/js/1122.6e3ebec6.chunk.js +1 -0
  8. package/build/static/js/144.e524055a.chunk.js +1 -0
  9. package/build/static/js/{1740.760a8d99.chunk.js → 1740.0e2e5bba.chunk.js} +1 -1
  10. package/build/static/js/188.b2d8398c.chunk.js +1 -0
  11. package/build/static/js/2664.eabe48f2.chunk.js +1 -0
  12. package/build/static/js/2873.fef955fd.chunk.js +1 -0
  13. package/build/static/js/2940.d2fb8fd8.chunk.js +1 -0
  14. package/build/static/js/{4021.50e4fad7.chunk.js → 4021.8fb78041.chunk.js} +1 -1
  15. package/build/static/js/4482.98a18a0a.chunk.js +17 -0
  16. package/build/static/js/4494.322ddf1c.chunk.js +1 -0
  17. package/build/static/js/4724.db036438.chunk.js +5 -0
  18. package/build/static/js/{4785.23c48fdd.chunk.js → 4785.3cf5ba35.chunk.js} +1 -1
  19. package/build/static/js/4831.1e1e6a8e.chunk.js +5 -0
  20. package/build/static/js/5299.37cca9f0.chunk.js +9 -0
  21. package/build/static/js/{6134.d4057528.chunk.js → 6134.8ad13d14.chunk.js} +1 -1
  22. package/build/static/js/6802.07e6658b.chunk.js +1 -0
  23. package/build/static/js/698.f3d5f888.chunk.js +1 -0
  24. package/build/static/js/7125.44ce1822.chunk.js +1 -0
  25. package/build/static/js/7579.36786736.chunk.js +1 -0
  26. package/build/static/js/7696.21dc1df4.chunk.js +1 -0
  27. package/build/static/js/{8186.383ded78.chunk.js → 8186.a240968d.chunk.js} +2 -2
  28. package/build/static/js/8798.a2b2458c.chunk.js +1 -0
  29. package/build/static/js/8853.aba4297d.chunk.js +5 -0
  30. package/build/static/js/9001.10d51d69.chunk.js +1 -0
  31. package/build/static/js/9005.95d4ec49.chunk.js +5 -0
  32. package/build/static/js/9813.a1d01534.chunk.js +1 -0
  33. package/build/static/js/{9846.e3403599.chunk.js → 9846.7f2d71be.chunk.js} +1 -1
  34. package/build/static/js/main.53e797b7.js +28 -0
  35. package/package.json +4 -4
  36. package/wheels/{stlite_server-0.1.0-py3-none-any.whl → stlite_lib-0.1.0-py3-none-any.whl} +0 -0
  37. package/wheels/streamlit-1.36.0-cp312-none-any.whl +0 -0
  38. package/build/static/css/main.6fb7674e.css +0 -1
  39. package/build/static/js/1046.3bed3c50.chunk.js +0 -1
  40. package/build/static/js/1122.1fd3187d.chunk.js +0 -1
  41. package/build/static/js/144.546cefc4.chunk.js +0 -1
  42. package/build/static/js/188.d9018bc1.chunk.js +0 -1
  43. package/build/static/js/2664.219ef364.chunk.js +0 -1
  44. package/build/static/js/2873.86ab0f7f.chunk.js +0 -1
  45. package/build/static/js/2940.a8dfa8f6.chunk.js +0 -1
  46. package/build/static/js/4482.6da0ecb0.chunk.js +0 -1
  47. package/build/static/js/4494.280a2293.chunk.js +0 -1
  48. package/build/static/js/4724.85ca8f57.chunk.js +0 -1
  49. package/build/static/js/4831.a2c2c8ad.chunk.js +0 -1
  50. package/build/static/js/5299.478bd9da.chunk.js +0 -1
  51. package/build/static/js/6802.e50f982c.chunk.js +0 -1
  52. package/build/static/js/698.e345ddd0.chunk.js +0 -1
  53. package/build/static/js/7125.b89dc54f.chunk.js +0 -1
  54. package/build/static/js/7579.0cee4fc7.chunk.js +0 -1
  55. package/build/static/js/7696.82915710.chunk.js +0 -1
  56. package/build/static/js/8798.108f543f.chunk.js +0 -1
  57. package/build/static/js/8853.7b55e9e4.chunk.js +0 -1
  58. package/build/static/js/9001.18ff903a.chunk.js +0 -1
  59. package/build/static/js/9005.36ad4e5c.chunk.js +0 -1
  60. package/build/static/js/9813.151e8692.chunk.js +0 -1
  61. package/build/static/js/main.eea22731.js +0 -20
  62. /package/build/static/js/{8186.383ded78.chunk.js.LICENSE.txt → 8186.a240968d.chunk.js.LICENSE.txt} +0 -0
  63. /package/build/static/js/{main.eea22731.js.LICENSE.txt → main.53e797b7.js.LICENSE.txt} +0 -0
@@ -33,7 +33,7 @@ ${_}`),y.pop(),`{${k}}`}case"number":return isFinite(f)?String(f):e?e(f):"null";
33
33
  `).filter(e=>!e.startsWith("#")).map(e=>e.replace(L_,"")).map(e=>e.trim()).filter(e=>e!=="")}Xn.parseRequirementsTxt=j_});var tp=w(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.PromiseDelegate=void 0;var Co=class{constructor(){this.promise=new Promise((e,r)=>{this.resolveInternal=e,this.rejectInternal=r})}resolve(e){this.resolveInternal(e)}reject(e){this.rejectInternal(e)}};es.PromiseDelegate=Co});var rp=w(at=>{"use strict";var N_=at&&at.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Lo=at&&at.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&N_(e,t,r)};Object.defineProperty(at,"__esModule",{value:!0});Lo(Xd(),at);Lo(ep(),at);Lo(tp(),at)});var op=w((IR,ap)=>{"use strict";ap.exports=np;function np(t,e,r){t instanceof RegExp&&(t=ip(t,r)),e instanceof RegExp&&(e=ip(e,r));var i=sp(t,e,r);return i&&{start:i[0],end:i[1],pre:r.slice(0,i[0]),body:r.slice(i[0]+t.length,i[1]),post:r.slice(i[1]+e.length)}}function ip(t,e){var r=e.match(t);return r?r[0]:null}np.range=sp;function sp(t,e,r){var i,n,s,a,o,l=r.indexOf(t),u=r.indexOf(e,l+1),h=l;if(l>=0&&u>0){if(t===e)return[l,u];for(i=[],s=r.length;h>=0&&!o;)h==l?(i.push(h),l=r.indexOf(t,h+1)):i.length==1?o=[i.pop(),u]:(n=i.pop(),n<s&&(s=n,a=u),u=r.indexOf(e,h+1)),h=l<u&&l>=0?l:u;i.length&&(o=[s,a])}return o}});var gp=w(($R,pp)=>{var lp=op();pp.exports=$_;var up="\0SLASH"+Math.random()+"\0",fp="\0OPEN"+Math.random()+"\0",No="\0CLOSE"+Math.random()+"\0",hp="\0COMMA"+Math.random()+"\0",cp="\0PERIOD"+Math.random()+"\0";function jo(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function F_(t){return t.split("\\\\").join(up).split("\\{").join(fp).split("\\}").join(No).split("\\,").join(hp).split("\\.").join(cp)}function I_(t){return t.split(up).join("\\").split(fp).join("{").split(No).join("}").split(hp).join(",").split(cp).join(".")}function dp(t){if(!t)return[""];var e=[],r=lp("{","}",t);if(!r)return t.split(",");var i=r.pre,n=r.body,s=r.post,a=i.split(",");a[a.length-1]+="{"+n+"}";var o=dp(s);return s.length&&(a[a.length-1]+=o.shift(),a.push.apply(a,o)),e.push.apply(e,a),e}function $_(t){return t?(t.substr(0,2)==="{}"&&(t="\\{\\}"+t.substr(2)),fi(F_(t),!0).map(I_)):[]}function W_(t){return"{"+t+"}"}function B_(t){return/^-?0\d/.test(t)}function U_(t,e){return t<=e}function z_(t,e){return t>=e}function fi(t,e){var r=[],i=lp("{","}",t);if(!i)return[t];var n=i.pre,s=i.post.length?fi(i.post,!1):[""];if(/\$$/.test(i.pre))for(var a=0;a<s.length;a++){var o=n+"{"+i.body+"}"+s[a];r.push(o)}else{var l=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),u=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),h=l||u,p=i.body.indexOf(",")>=0;if(!h&&!p)return i.post.match(/,.*\}/)?(t=i.pre+"{"+i.body+No+i.post,fi(t)):[t];var c;if(h)c=i.body.split(/\.\./);else if(c=dp(i.body),c.length===1&&(c=fi(c[0],!1).map(W_),c.length===1))return s.map(function(te){return i.pre+c[0]+te});var f;if(h){var y=jo(c[0]),b=jo(c[1]),S=Math.max(c[0].length,c[1].length),_=c.length==3?Math.abs(jo(c[2])):1,x=U_,R=b<y;R&&(_*=-1,x=z_);var O=c.some(B_);f=[];for(var k=y;x(k,b);k+=_){var D;if(u)D=String.fromCharCode(k),D==="\\"&&(D="");else if(D=String(k),O){var F=S-D.length;if(F>0){var N=new Array(F+1).join("0");k<0?D="-"+N+D.slice(1):D=N+D}}f.push(D)}}else{f=[];for(var B=0;B<c.length;B++)f.push.apply(f,fi(c[B],!1))}for(var B=0;B<f.length;B++)for(var a=0;a<s.length;a++){var o=n+f[B]+s[a];(!e||h||o)&&r.push(o)}}return r}});var ig=pe(require("yargs")),ng=require("yargs/helpers"),ce=pe(require("node:path")),ut=pe(require("node:fs/promises")),tl=pe(require("fs-extra")),Oi=require("pyodide");var zd=pe(require("node:path")),Hd=pe(require("node:fs/promises"));var xt=pe(Ud()),I=xt.createLogger({transports:[new xt.transports.Console({format:xt.format.combine(xt.format.splat(),xt.format.cli())})]});function ui(t){process.emitWarning(t,{type:"DeprecationWarning"})}var Kn=class{sourceUrl;isRemote;_data=null;constructor(e){e.startsWith("file://")&&(e=e.slice(7)),this.sourceUrl=e,this.isRemote=e.includes("://")}async readJson(e){let r=zd.default.join(this.sourceUrl,e);if(this.isRemote){I.debug(`Fetching ${r}`);let i=await fetch(r);if(!i.ok)throw new Error(`Failed to download ${r}: ${i.status} ${i.statusText}`);return await i.json()}else{I.debug(`Reading ${r}`);let i=await Hd.default.readFile(r);return JSON.parse(i.toString())}}async loadPrebuiltPackageData(){if(this._data!=null)return this._data;I.info("Load pyodide-lock.json");let e=await this.readJson("pyodide-lock.json");return this._data=e.packages,e.packages}async getPackageInfoByName(e){let r=await this.loadPrebuiltPackageData(),i=Object.values(r).find(n=>n.name===e);if(i==null)throw new Error(`Package ${e} is not found in the lock file.`);return i}};var Vd=pe(require("node:fs/promises")),Kd=pe(Zn());var X=pe(Zn()),Yd=X.object({entrypoint:X.string(),embed:X.defaulted(X.boolean(),!1),idbfsMountpoints:X.optional(X.array(X.string())),nodeJsWorker:X.defaulted(X.boolean(),!1),nodefsMountpoints:X.optional(X.record(X.string(),X.string()))});function R_(t){let e=Kd.mask(t??{},Yd);if(e.nodeJsWorker){if(e.idbfsMountpoints!=null)throw new Error("The `idbfsMountpoints` field is not allowed when `nodeJsWorker` is true.")}else if(e.nodefsMountpoints!=null)throw new Error("The `nodefsMountpoints` field is not allowed when `nodeJsWorker` is false.");return e}async function Jd(t){let e=R_({...t.packageJsonStliteDesktopField,...t.fallbacks});I.info("App manifest: %j",e);let r=JSON.stringify(e,null,2);I.info(`Dump the manifest file -> ${t.manifestFilePath}`),await Vd.default.writeFile(t.manifestFilePath,r,{encoding:"utf-8"})}var Zd=pe(require("node:path")),fe=pe(Zn());async function Qd(t){let{files:e,entrypoint:r}=x_(t),i=await T_(t),n=await O_(t);return{files:e,entrypoint:r,dependencies:i,requirementsTxtFilePaths:n}}function x_(t){let{packageJsonStliteDesktopField:e,fallbacks:{appHomeDirSource:r}}=t,i=e?.files,n=e?.entrypoint;if(i==null||n==null){ui("Missing `stlite.desktop.files` and `stlite.desktop.entrypoint` in `package.json`. Falling back to the `appHomeDirSource` argument to determine the app directory. Please update your `package.json` as this fallback is deprecated and will be removed in a future release.");let s=r;if(typeof s!="string")throw new Error("The `appHomeDirSource` argument is required when `stlite.desktop.files` and `stlite.desktop.entrypoint` are not found in the package.json. Note that `appHomeDirSource` is deprecated and will be removed in the future, so please specify `stlite.desktop.files` and `stlite.desktop.entrypoint` in the package.json.");i=[s],n=`./${s}/streamlit_app.py`}else r!=null&&ui("The `appHomeDirSource` argument is deprecated and has been ignored because `stlite.desktop.files` is specified in `package.json`.");return fe.assert(n,fe.string(),"The `stlite.desktop.entrypoint` field must be a string."),fe.assert(i,fe.array(fe.string()),"The `stlite.desktop.files` field must be an array of strings."),{files:i,entrypoint:n}}async function T_(t){let{packageJsonStliteDesktopField:e,fallbacks:{packages:r}}=t,i=e?.dependencies;fe.assert(i,fe.optional(fe.array(fe.string())),"The `stlite.desktop.dependencies` field must be an array of strings.");let n=[];return r!=null&&(ui("The `packages` argument is deprecated and will be removed in a future release. Use `stlite.desktop.dependencies` in your `package.json` instead."),n=r),[...i??[],...n]}async function O_(t){let{pathResolutionRoot:e,packageJsonStliteDesktopField:r,fallbacks:{requirementsTxtFilePaths:i}}=t,n=r?.requirementsTxtFiles;fe.assert(n,fe.optional(fe.array(fe.string())),"The `stlite.desktop.requirementsTxtFiles` field must be an array of strings.");let s=n?.map(o=>Zd.default.resolve(e,o)),a=[];return i!=null&&i.length>0&&(ui("The `requirement` argument is deprecated and will be removed in a future release. Use `stlite.desktop.requirementsTxtFiles` in your `package.json` instead."),a=i),[...s??[],...a]}var _s=pe(rp());var Ep=pe(gp(),1);var hi=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")};var H_={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},ci=t=>t.replace(/[[\]\\-]/g,"\\$&"),G_=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),mp=t=>t.join(""),yp=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let i=[],n=[],s=r+1,a=!1,o=!1,l=!1,u=!1,h=r,p="";e:for(;s<t.length;){let b=t.charAt(s);if((b==="!"||b==="^")&&s===r+1){u=!0,s++;continue}if(b==="]"&&a&&!l){h=s+1;break}if(a=!0,b==="\\"&&!l){l=!0,s++;continue}if(b==="["&&!l){for(let[S,[_,x,R]]of Object.entries(H_))if(t.startsWith(S,s)){if(p)return["$.",!1,t.length-r,!0];s+=S.length,R?n.push(_):i.push(_),o=o||x;continue e}}if(l=!1,p){b>p?i.push(ci(p)+"-"+ci(b)):b===p&&i.push(ci(b)),p="",s++;continue}if(t.startsWith("-]",s+1)){i.push(ci(b+"-")),s+=2;continue}if(t.startsWith("-",s+1)){p=b,s+=2;continue}i.push(ci(b)),s++}if(h<s)return["",!1,0,!1];if(!i.length&&!n.length)return["$.",!1,t.length-r,!0];if(n.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!u){let b=i[0].length===2?i[0].slice(-1):i[0];return[G_(b),!1,h-r,!1]}let c="["+(u?"^":"")+mp(i)+"]",f="["+(u?"":"^")+mp(n)+"]";return[i.length&&n.length?"("+c+"|"+f+")":i.length?c:f,o,h-r,!0]};var We=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");var Y_=new Set(["!","?","+","*","@"]),bp=t=>Y_.has(t),V_="(?!(?:^|/)\\.\\.?(?:$|/))",ts="(?!\\.)",K_=new Set(["[","."]),J_=new Set(["..","."]),Z_=new Set("().*{}+?[]^$\\!"),Q_=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Fo="[^/]",wp=Fo+"*?",vp=Fo+"+?",br=class t{type;#e;#r;#s=!1;#i=[];#o;#u;#h;#l=!1;#a;#t;#g=!1;constructor(e,r,i={}){this.type=e,e&&(this.#r=!0),this.#o=r,this.#e=this.#o?this.#o.#e:this,this.#a=this.#e===this?i:this.#e.#a,this.#h=this.#e===this?[]:this.#e.#h,e==="!"&&!this.#e.#l&&this.#h.push(this),this.#u=this.#o?this.#o.#i.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let e of this.#i)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#t!==void 0?this.#t:this.type?this.#t=this.type+"("+this.#i.map(e=>String(e)).join("|")+")":this.#t=this.#i.map(e=>String(e)).join("")}#y(){if(this!==this.#e)throw new Error("should only call on root");if(this.#l)return this;this.toString(),this.#l=!0;let e;for(;e=this.#h.pop();){if(e.type!=="!")continue;let r=e,i=r.#o;for(;i;){for(let n=r.#u+1;!i.type&&n<i.#i.length;n++)for(let s of e.#i){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(i.#i[n])}r=i,i=r.#o}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof t&&r.#o===this))throw new Error("invalid part: "+r);this.#i.push(r)}}toJSON(){let e=this.type===null?this.#i.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#i.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#l&&this.#o?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#o?.isStart())return!1;if(this.#u===0)return!0;let e=this.#o;for(let r=0;r<this.#u;r++){let i=e.#i[r];if(!(i instanceof t&&i.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let e=this.#o?this.#o.#i.length:0;return this.#u===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let r=new t(this.type,e);for(let i of this.#i)r.copyIn(i);return r}static#d(e,r,i,n){let s=!1,a=!1,o=-1,l=!1;if(r.type===null){let f=i,y="";for(;f<e.length;){let b=e.charAt(f++);if(s||b==="\\"){s=!s,y+=b;continue}if(a){f===o+1?(b==="^"||b==="!")&&(l=!0):b==="]"&&!(f===o+2&&l)&&(a=!1),y+=b;continue}else if(b==="["){a=!0,o=f,l=!1,y+=b;continue}if(!n.noext&&bp(b)&&e.charAt(f)==="("){r.push(y),y="";let S=new t(b,r);f=t.#d(e,S,f,n),r.push(S);continue}y+=b}return r.push(y),f}let u=i+1,h=new t(null,r),p=[],c="";for(;u<e.length;){let f=e.charAt(u++);if(s||f==="\\"){s=!s,c+=f;continue}if(a){u===o+1?(f==="^"||f==="!")&&(l=!0):f==="]"&&!(u===o+2&&l)&&(a=!1),c+=f;continue}else if(f==="["){a=!0,o=u,l=!1,c+=f;continue}if(bp(f)&&e.charAt(u)==="("){h.push(c),c="";let y=new t(f,h);h.push(y),u=t.#d(e,y,u,n);continue}if(f==="|"){h.push(c),c="",p.push(h),h=new t(null,r);continue}if(f===")")return c===""&&r.#i.length===0&&(r.#g=!0),h.push(c),c="",r.push(...p,h),u;c+=f}return r.type=null,r.#r=void 0,r.#i=[e.substring(i-1)],u}static fromGlob(e,r={}){let i=new t(null,void 0,r);return t.#d(e,i,0,r),i}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[r,i,n,s]=this.toRegExpSource();if(!(n||this.#r||this.#a.nocase&&!this.#a.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return i;let o=(this.#a.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${r}$`,o),{_src:r,_glob:e})}toRegExpSource(e){let r=e??!!this.#a.dot;if(this.#e===this&&this.#y(),!this.type){let l=this.isStart()&&this.isEnd(),u=this.#i.map(f=>{let[y,b,S,_]=typeof f=="string"?t.#v(f,this.#r,l):f.toRegExpSource(e);return this.#r=this.#r||S,this.#s=this.#s||_,y}).join(""),h="";if(this.isStart()&&typeof this.#i[0]=="string"&&!(this.#i.length===1&&J_.has(this.#i[0]))){let y=K_,b=r&&y.has(u.charAt(0))||u.startsWith("\\.")&&y.has(u.charAt(2))||u.startsWith("\\.\\.")&&y.has(u.charAt(4)),S=!r&&!e&&y.has(u.charAt(0));h=b?V_:S?ts:""}let p="";return this.isEnd()&&this.#e.#l&&this.#o?.type==="!"&&(p="(?:$|\\/)"),[h+u+p,We(u),this.#r=!!this.#r,this.#s]}let i=this.type==="*"||this.type==="+",n=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#c(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let l=this.toString();return this.#i=[l],this.type=null,this.#r=void 0,[l,We(this.toString()),!1,!1]}let a=!i||e||r||!ts?"":this.#c(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let o="";if(this.type==="!"&&this.#g)o=(this.isStart()&&!r?ts:"")+vp;else{let l=this.type==="!"?"))"+(this.isStart()&&!r&&!e?ts:"")+wp+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;o=n+s+l}return[o,We(s),this.#r=!!this.#r,this.#s]}#c(e){return this.#i.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[i,n,s,a]=r.toRegExpSource(e);return this.#s=this.#s||a,i}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#v(e,r,i=!1){let n=!1,s="",a=!1;for(let o=0;o<e.length;o++){let l=e.charAt(o);if(n){n=!1,s+=(Z_.has(l)?"\\":"")+l;continue}if(l==="\\"){o===e.length-1?s+="\\\\":n=!0;continue}if(l==="["){let[u,h,p,c]=yp(e,o);if(p){s+=u,a=a||h,o+=p-1,r=r||c;continue}}if(l==="*"){i&&e==="*"?s+=vp:s+=wp,r=!0;continue}if(l==="?"){s+=Fo,r=!0;continue}s+=Q_(l)}return[s,We(e),!!r,a]}};var wr=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");var _e=(t,e,r={})=>(hi(e),!r.nocomment&&e.charAt(0)==="#"?!1:new Ae(e,r).match(t)),X_=/^\*+([^+@!?\*\[\(]*)$/,eS=t=>e=>!e.startsWith(".")&&e.endsWith(t),tS=t=>e=>e.endsWith(t),rS=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),iS=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),nS=/^\*+\.\*+$/,sS=t=>!t.startsWith(".")&&t.includes("."),aS=t=>t!=="."&&t!==".."&&t.includes("."),oS=/^\.\*+$/,lS=t=>t!=="."&&t!==".."&&t.startsWith("."),uS=/^\*+$/,fS=t=>t.length!==0&&!t.startsWith("."),hS=t=>t.length!==0&&t!=="."&&t!=="..",cS=/^\?+([^+@!?\*\[\(]*)?$/,dS=([t,e=""])=>{let r=Rp([t]);return e?(e=e.toLowerCase(),i=>r(i)&&i.toLowerCase().endsWith(e)):r},pS=([t,e=""])=>{let r=xp([t]);return e?(e=e.toLowerCase(),i=>r(i)&&i.toLowerCase().endsWith(e)):r},gS=([t,e=""])=>{let r=xp([t]);return e?i=>r(i)&&i.endsWith(e):r},mS=([t,e=""])=>{let r=Rp([t]);return e?i=>r(i)&&i.endsWith(e):r},Rp=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},xp=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},Tp=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",_p={win32:{sep:"\\"},posix:{sep:"/"}},yS=Tp==="win32"?_p.win32.sep:_p.posix.sep;_e.sep=yS;var he=Symbol("globstar **");_e.GLOBSTAR=he;var bS="[^/]",wS=bS+"*?",vS="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",_S="(?:(?!(?:\\/|^)\\.).)*?",SS=(t,e={})=>r=>_e(r,t,e);_e.filter=SS;var Le=(t,e={})=>Object.assign({},t,e),ES=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return _e;let e=_e;return Object.assign((i,n,s={})=>e(i,n,Le(t,s)),{Minimatch:class extends e.Minimatch{constructor(n,s={}){super(n,Le(t,s))}static defaults(n){return e.defaults(Le(t,n)).Minimatch}},AST:class extends e.AST{constructor(n,s,a={}){super(n,s,Le(t,a))}static fromGlob(n,s={}){return e.AST.fromGlob(n,Le(t,s))}},unescape:(i,n={})=>e.unescape(i,Le(t,n)),escape:(i,n={})=>e.escape(i,Le(t,n)),filter:(i,n={})=>e.filter(i,Le(t,n)),defaults:i=>e.defaults(Le(t,i)),makeRe:(i,n={})=>e.makeRe(i,Le(t,n)),braceExpand:(i,n={})=>e.braceExpand(i,Le(t,n)),match:(i,n,s={})=>e.match(i,n,Le(t,s)),sep:e.sep,GLOBSTAR:he})};_e.defaults=ES;var Op=(t,e={})=>(hi(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,Ep.default)(t));_e.braceExpand=Op;var RS=(t,e={})=>new Ae(t,e).makeRe();_e.makeRe=RS;var xS=(t,e,r={})=>{let i=new Ae(e,r);return t=t.filter(n=>i.match(n)),i.options.nonull&&!t.length&&t.push(e),t};_e.match=xS;var Sp=/[?*]|[+@!]\(.*?\)|\[|\]/,TS=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Ae=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,r={}){hi(e),r=r||{},this.options=r,this.pattern=e,this.platform=r.platform||Tp,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let r of e)if(typeof r!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let n=this.globParts.map((s,a,o)=>{if(this.isWindows&&this.windowsNoMagicRoot){let l=s[0]===""&&s[1]===""&&(s[2]==="?"||!Sp.test(s[2]))&&!Sp.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(l)return[...s.slice(0,4),...s.slice(4).map(h=>this.parse(h))];if(u)return[s[0],...s.slice(1).map(h=>this.parse(h))]}return s.map(l=>this.parse(l))});if(this.debug(this.pattern,n),this.set=n.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let i=0;i<e.length;i++)for(let n=0;n<e[i].length;n++)e[i][n]==="**"&&(e[i][n]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):r>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(r=>{let i=-1;for(;(i=r.indexOf("**",i+1))!==-1;){let n=i;for(;r[n+1]==="**";)n++;n!==i&&r.splice(i,n-i)}return r})}levelOneOptimize(e){return e.map(r=>(r=r.reduce((i,n)=>{let s=i[i.length-1];return n==="**"&&s==="**"?i:n===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(i.pop(),i):(i.push(n),i)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let s=e[n];n===1&&s===""&&e[0]===""||(s==="."||s==="")&&(r=!0,e.splice(n,1),n--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(r=!0,e.pop())}let i=0;for(;(i=e.indexOf("..",i+1))!==-1;){let n=e[i-1];n&&n!=="."&&n!==".."&&n!=="**"&&(r=!0,e.splice(i-1,2),i-=2)}}while(r);return e.length===0?[""]:e}firstPhasePreProcess(e){let r=!1;do{r=!1;for(let i of e){let n=-1;for(;(n=i.indexOf("**",n+1))!==-1;){let a=n;for(;i[a+1]==="**";)a++;a>n&&i.splice(n+1,a-n);let o=i[n+1],l=i[n+2],u=i[n+3];if(o!==".."||!l||l==="."||l===".."||!u||u==="."||u==="..")continue;r=!0,i.splice(n,1);let h=i.slice(0);h[n]="**",e.push(h),n--}if(!this.preserveMultipleSlashes){for(let a=1;a<i.length-1;a++){let o=i[a];a===1&&o===""&&i[0]===""||(o==="."||o==="")&&(r=!0,i.splice(a,1),a--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(r=!0,i.pop())}let s=0;for(;(s=i.indexOf("..",s+1))!==-1;){let a=i[s-1];if(a&&a!=="."&&a!==".."&&a!=="**"){r=!0;let l=s===1&&i[s+1]==="**"?["."]:[];i.splice(s-1,2,...l),i.length===0&&i.push(""),s-=2}}}}while(r);return e}secondPhasePreProcess(e){for(let r=0;r<e.length-1;r++)for(let i=r+1;i<e.length;i++){let n=this.partsMatch(e[r],e[i],!this.preserveMultipleSlashes);n&&(e[r]=n,e[i]=[])}return e.filter(r=>r.length)}partsMatch(e,r,i=!1){let n=0,s=0,a=[],o="";for(;n<e.length&&s<r.length;)if(e[n]===r[s])a.push(o==="b"?r[s]:e[n]),n++,s++;else if(i&&e[n]==="**"&&r[s]===e[n+1])a.push(e[n]),n++;else if(i&&r[s]==="**"&&e[n]===r[s+1])a.push(r[s]),s++;else if(e[n]==="*"&&r[s]&&(this.options.dot||!r[s].startsWith("."))&&r[s]!=="**"){if(o==="b")return!1;o="a",a.push(e[n]),n++,s++}else if(r[s]==="*"&&e[n]&&(this.options.dot||!e[n].startsWith("."))&&e[n]!=="**"){if(o==="a")return!1;o="b",a.push(r[s]),n++,s++}else return!1;return e.length===r.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,r=!1,i=0;for(let n=0;n<e.length&&e.charAt(n)==="!";n++)r=!r,i++;i&&(this.pattern=e.slice(i)),this.negate=r}matchOne(e,r,i=!1){let n=this.options;if(this.isWindows){let b=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),S=!b&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),_=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),x=!_&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),R=S?3:b?0:void 0,O=x?3:_?0:void 0;if(typeof R=="number"&&typeof O=="number"){let[k,D]=[e[R],r[O]];k.toLowerCase()===D.toLowerCase()&&(r[O]=k,O>R?r=r.slice(O):R>O&&(e=e.slice(R)))}}let{optimizationLevel:s=1}=this.options;s>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:r}),this.debug("matchOne",e.length,r.length);for(var a=0,o=0,l=e.length,u=r.length;a<l&&o<u;a++,o++){this.debug("matchOne loop");var h=r[o],p=e[a];if(this.debug(r,h,p),h===!1)return!1;if(h===he){this.debug("GLOBSTAR",[r,h,p]);var c=a,f=o+1;if(f===u){for(this.debug("** at the end");a<l;a++)if(e[a]==="."||e[a]===".."||!n.dot&&e[a].charAt(0)===".")return!1;return!0}for(;c<l;){var y=e[c];if(this.debug(`
34
34
  globstar while`,e,c,r,f,y),this.matchOne(e.slice(c),r.slice(f),i))return this.debug("globstar found match!",c,l,y),!0;if(y==="."||y===".."||!n.dot&&y.charAt(0)==="."){this.debug("dot detected!",e,c,r,f);break}this.debug("globstar swallow a segment, and continue"),c++}return!!(i&&(this.debug(`
35
35
  >>> no match, partial?`,e,c,r,f),c===l))}let b;if(typeof h=="string"?(b=p===h,this.debug("string match",h,p,b)):(b=h.test(p),this.debug("pattern match",h,p,b)),!b)return!1}if(a===l&&o===u)return!0;if(a===l)return i;if(o===u)return a===l-1&&e[a]==="";throw new Error("wtf?")}braceExpand(){return Op(this.pattern,this.options)}parse(e){hi(e);let r=this.options;if(e==="**")return he;if(e==="")return"";let i,n=null;(i=e.match(uS))?n=r.dot?hS:fS:(i=e.match(X_))?n=(r.nocase?r.dot?iS:rS:r.dot?tS:eS)(i[1]):(i=e.match(cS))?n=(r.nocase?r.dot?pS:dS:r.dot?gS:mS)(i):(i=e.match(nS))?n=r.dot?aS:sS:(i=e.match(oS))&&(n=lS);let s=br.fromGlob(e,this.options).toMMPattern();return n?Object.assign(s,{test:n}):s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,i=r.noglobstar?wS:r.dot?vS:_S,n=new Set(r.nocase?["i"]:[]),s=e.map(l=>{let u=l.map(h=>{if(h instanceof RegExp)for(let p of h.flags.split(""))n.add(p);return typeof h=="string"?TS(h):h===he?he:h._src});return u.forEach((h,p)=>{let c=u[p+1],f=u[p-1];h!==he||f===he||(f===void 0?c!==void 0&&c!==he?u[p+1]="(?:\\/|"+i+"\\/)?"+c:u[p]=i:c===void 0?u[p-1]=f+"(?:\\/|"+i+")?":c!==he&&(u[p-1]=f+"(?:\\/|\\/"+i+"\\/)"+c,u[p+1]=he))}),u.filter(h=>h!==he).join("/")}).join("|"),[a,o]=e.length>1?["(?:",")"]:["",""];s="^"+a+s+o+"$",this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...n].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let i=this.options;this.isWindows&&(e=e.split("\\").join("/"));let n=this.slashSplit(e);this.debug(this.pattern,"split",n);let s=this.set;this.debug(this.pattern,"set",s);let a=n[n.length-1];if(!a)for(let o=n.length-2;!a&&o>=0;o--)a=n[o];for(let o=0;o<s.length;o++){let l=s[o],u=n;if(i.matchBase&&l.length===1&&(u=[a]),this.matchOne(u,l,r))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(e){return _e.defaults(e).Minimatch}};_e.AST=br;_e.Minimatch=Ae;_e.escape=wr;_e.unescape=We;var vr=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ap=new Set,Io=typeof process=="object"&&process?process:{},kp=(t,e,r,i)=>{typeof Io.emitWarning=="function"?Io.emitWarning(t,e,r,i):console.error(`[${r}] ${e}: ${t}`)},rs=globalThis.AbortController,Mp=globalThis.AbortSignal;if(typeof rs>"u"){Mp=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(i,n){this._onabort.push(n)}},rs=class{constructor(){e()}signal=new Mp;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let n of this.signal._onabort)n(i);this.signal.onabort?.(i)}}};let t=Io.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,kp("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var OS=t=>!Ap.has(t),ax=Symbol("type"),Tt=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Pp=t=>Tt(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?_r:null:null,_r=class extends Array{constructor(e){super(e),this.fill(0)}},$o=class t{heap;length;static#e=!1;static create(e){let r=Pp(e);if(!r)return[];t.#e=!0;let i=new t(e,r);return t.#e=!1,i}constructor(e,r){if(!t.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},di=class t{#e;#r;#s;#i;#o;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#u;#h;#l;#a;#t;#g;#y;#d;#c;#v;#m;#x;#T;#_;#w;#M;#p;static unsafeExposeInternals(e){return{starts:e.#T,ttls:e.#_,sizes:e.#x,keyMap:e.#l,keyList:e.#a,valList:e.#t,next:e.#g,prev:e.#y,get head(){return e.#d},get tail(){return e.#c},free:e.#v,isBackgroundFetch:r=>e.#f(r),backgroundFetch:(r,i,n,s)=>e.#C(r,i,n,s),moveToTail:r=>e.#q(r),indexes:r=>e.#R(r),rindexes:r=>e.#A(r),isStale:r=>e.#b(r)}}get max(){return this.#e}get maxSize(){return this.#r}get calculatedSize(){return this.#h}get size(){return this.#u}get fetchMethod(){return this.#o}get dispose(){return this.#s}get disposeAfter(){return this.#i}constructor(e){let{max:r=0,ttl:i,ttlResolution:n=1,ttlAutopurge:s,updateAgeOnGet:a,updateAgeOnHas:o,allowStale:l,dispose:u,disposeAfter:h,noDisposeOnSet:p,noUpdateTTL:c,maxSize:f=0,maxEntrySize:y=0,sizeCalculation:b,fetchMethod:S,noDeleteOnFetchRejection:_,noDeleteOnStaleGet:x,allowStaleOnFetchRejection:R,allowStaleOnFetchAbort:O,ignoreFetchAbort:k}=e;if(r!==0&&!Tt(r))throw new TypeError("max option must be a nonnegative integer");let D=r?Pp(r):Array;if(!D)throw new Error("invalid max value: "+r);if(this.#e=r,this.#r=f,this.maxEntrySize=y||this.#r,this.sizeCalculation=b,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(S!==void 0&&typeof S!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=S,this.#M=!!S,this.#l=new Map,this.#a=new Array(r).fill(void 0),this.#t=new Array(r).fill(void 0),this.#g=new D(r),this.#y=new D(r),this.#d=0,this.#c=0,this.#v=$o.create(r),this.#u=0,this.#h=0,typeof u=="function"&&(this.#s=u),typeof h=="function"?(this.#i=h,this.#m=[]):(this.#i=void 0,this.#m=void 0),this.#w=!!this.#s,this.#p=!!this.#i,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!c,this.noDeleteOnFetchRejection=!!_,this.allowStaleOnFetchRejection=!!R,this.allowStaleOnFetchAbort=!!O,this.ignoreFetchAbort=!!k,this.maxEntrySize!==0){if(this.#r!==0&&!Tt(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!Tt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#P()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!x,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!o,this.ttlResolution=Tt(n)||n===0?n:1,this.ttlAutopurge=!!s,this.ttl=i||0,this.ttl){if(!Tt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#k()}if(this.#e===0&&this.ttl===0&&this.#r===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#r){let F="LRU_CACHE_UNBOUNDED";OS(F)&&(Ap.add(F),kp("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",F,t))}}getRemainingTTL(e){return this.#l.has(e)?1/0:0}#k(){let e=new _r(this.#e),r=new _r(this.#e);this.#_=e,this.#T=r,this.#n=(s,a,o=vr.now())=>{if(r[s]=a!==0?o:0,e[s]=a,a!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#b(s)&&this.delete(this.#a[s])},a+1);l.unref&&l.unref()}},this.#O=s=>{r[s]=e[s]!==0?vr.now():0},this.#S=(s,a)=>{if(e[a]){let o=e[a],l=r[a];if(!o||!l)return;s.ttl=o,s.start=l,s.now=i||n();let u=s.now-l;s.remainingTTL=o-u}};let i=0,n=()=>{let s=vr.now();if(this.ttlResolution>0){i=s;let a=setTimeout(()=>i=0,this.ttlResolution);a.unref&&a.unref()}return s};this.getRemainingTTL=s=>{let a=this.#l.get(s);if(a===void 0)return 0;let o=e[a],l=r[a];if(!o||!l)return 1/0;let u=(i||n())-l;return o-u},this.#b=s=>{let a=r[s],o=e[s];return!!o&&!!a&&(i||n())-a>o}}#O=()=>{};#S=()=>{};#n=()=>{};#b=()=>!1;#P(){let e=new _r(this.#e);this.#h=0,this.#x=e,this.#E=r=>{this.#h-=e[r],e[r]=0},this.#j=(r,i,n,s)=>{if(this.#f(i))return 0;if(!Tt(n))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(n=s(i,r),!Tt(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n},this.#L=(r,i,n)=>{if(e[r]=i,this.#r){let s=this.#r-e[r];for(;this.#h>s;)this.#D(!0)}this.#h+=e[r],n&&(n.entrySize=i,n.totalCalculatedSize=this.#h)}}#E=e=>{};#L=(e,r,i)=>{};#j=(e,r,i,n)=>{if(i||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#R({allowStale:e=this.allowStale}={}){if(this.#u)for(let r=this.#c;!(!this.#N(r)||((e||!this.#b(r))&&(yield r),r===this.#d));)r=this.#y[r]}*#A({allowStale:e=this.allowStale}={}){if(this.#u)for(let r=this.#d;!(!this.#N(r)||((e||!this.#b(r))&&(yield r),r===this.#c));)r=this.#g[r]}#N(e){return e!==void 0&&this.#l.get(this.#a[e])===e}*entries(){for(let e of this.#R())this.#t[e]!==void 0&&this.#a[e]!==void 0&&!this.#f(this.#t[e])&&(yield[this.#a[e],this.#t[e]])}*rentries(){for(let e of this.#A())this.#t[e]!==void 0&&this.#a[e]!==void 0&&!this.#f(this.#t[e])&&(yield[this.#a[e],this.#t[e]])}*keys(){for(let e of this.#R()){let r=this.#a[e];r!==void 0&&!this.#f(this.#t[e])&&(yield r)}}*rkeys(){for(let e of this.#A()){let r=this.#a[e];r!==void 0&&!this.#f(this.#t[e])&&(yield r)}}*values(){for(let e of this.#R())this.#t[e]!==void 0&&!this.#f(this.#t[e])&&(yield this.#t[e])}*rvalues(){for(let e of this.#A())this.#t[e]!==void 0&&!this.#f(this.#t[e])&&(yield this.#t[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let i of this.#R()){let n=this.#t[i],s=this.#f(n)?n.__staleWhileFetching:n;if(s!==void 0&&e(s,this.#a[i],this))return this.get(this.#a[i],r)}}forEach(e,r=this){for(let i of this.#R()){let n=this.#t[i],s=this.#f(n)?n.__staleWhileFetching:n;s!==void 0&&e.call(r,s,this.#a[i],this)}}rforEach(e,r=this){for(let i of this.#A()){let n=this.#t[i],s=this.#f(n)?n.__staleWhileFetching:n;s!==void 0&&e.call(r,s,this.#a[i],this)}}purgeStale(){let e=!1;for(let r of this.#A({allowStale:!0}))this.#b(r)&&(this.delete(this.#a[r]),e=!0);return e}info(e){let r=this.#l.get(e);if(r===void 0)return;let i=this.#t[r],n=this.#f(i)?i.__staleWhileFetching:i;if(n===void 0)return;let s={value:n};if(this.#_&&this.#T){let a=this.#_[r],o=this.#T[r];if(a&&o){let l=a-(vr.now()-o);s.ttl=l,s.start=Date.now()}}return this.#x&&(s.size=this.#x[r]),s}dump(){let e=[];for(let r of this.#R({allowStale:!0})){let i=this.#a[r],n=this.#t[r],s=this.#f(n)?n.__staleWhileFetching:n;if(s===void 0||i===void 0)continue;let a={value:s};if(this.#_&&this.#T){a.ttl=this.#_[r];let o=vr.now()-this.#T[r];a.start=Math.floor(Date.now()-o)}this.#x&&(a.size=this.#x[r]),e.unshift([i,a])}return e}load(e){this.clear();for(let[r,i]of e){if(i.start){let n=Date.now()-i.start;i.start=vr.now()-n}this.set(r,i.value,i)}}set(e,r,i={}){if(r===void 0)return this.delete(e),this;let{ttl:n=this.ttl,start:s,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:l}=i,{noUpdateTTL:u=this.noUpdateTTL}=i,h=this.#j(e,r,i.size||0,o);if(this.maxEntrySize&&h>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.delete(e),this;let p=this.#u===0?void 0:this.#l.get(e);if(p===void 0)p=this.#u===0?this.#c:this.#v.length!==0?this.#v.pop():this.#u===this.#e?this.#D(!1):this.#u,this.#a[p]=e,this.#t[p]=r,this.#l.set(e,p),this.#g[this.#c]=p,this.#y[p]=this.#c,this.#c=p,this.#u++,this.#L(p,h,l),l&&(l.set="add"),u=!1;else{this.#q(p);let c=this.#t[p];if(r!==c){if(this.#M&&this.#f(c)){c.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:f}=c;f!==void 0&&!a&&(this.#w&&this.#s?.(f,e,"set"),this.#p&&this.#m?.push([f,e,"set"]))}else a||(this.#w&&this.#s?.(c,e,"set"),this.#p&&this.#m?.push([c,e,"set"]));if(this.#E(p),this.#L(p,h,l),this.#t[p]=r,l){l.set="replace";let f=c&&this.#f(c)?c.__staleWhileFetching:c;f!==void 0&&(l.oldValue=f)}}else l&&(l.set="update")}if(n!==0&&!this.#_&&this.#k(),this.#_&&(u||this.#n(p,n,s),l&&this.#S(l,p)),!a&&this.#p&&this.#m){let c=this.#m,f;for(;f=c?.shift();)this.#i?.(...f)}return this}pop(){try{for(;this.#u;){let e=this.#t[this.#d];if(this.#D(!0),this.#f(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#p&&this.#m){let e=this.#m,r;for(;r=e?.shift();)this.#i?.(...r)}}}#D(e){let r=this.#d,i=this.#a[r],n=this.#t[r];return this.#M&&this.#f(n)?n.__abortController.abort(new Error("evicted")):(this.#w||this.#p)&&(this.#w&&this.#s?.(n,i,"evict"),this.#p&&this.#m?.push([n,i,"evict"])),this.#E(r),e&&(this.#a[r]=void 0,this.#t[r]=void 0,this.#v.push(r)),this.#u===1?(this.#d=this.#c=0,this.#v.length=0):this.#d=this.#g[r],this.#l.delete(i),this.#u--,r}has(e,r={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:n}=r,s=this.#l.get(e);if(s!==void 0){let a=this.#t[s];if(this.#f(a)&&a.__staleWhileFetching===void 0)return!1;if(this.#b(s))n&&(n.has="stale",this.#S(n,s));else return i&&this.#O(s),n&&(n.has="hit",this.#S(n,s)),!0}else n&&(n.has="miss");return!1}peek(e,r={}){let{allowStale:i=this.allowStale}=r,n=this.#l.get(e);if(n===void 0||!i&&this.#b(n))return;let s=this.#t[n];return this.#f(s)?s.__staleWhileFetching:s}#C(e,r,i,n){let s=r===void 0?void 0:this.#t[r];if(this.#f(s))return s;let a=new rs,{signal:o}=i;o?.addEventListener("abort",()=>a.abort(o.reason),{signal:a.signal});let l={signal:a.signal,options:i,context:n},u=(b,S=!1)=>{let{aborted:_}=a.signal,x=i.ignoreFetchAbort&&b!==void 0;if(i.status&&(_&&!S?(i.status.fetchAborted=!0,i.status.fetchError=a.signal.reason,x&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),_&&!x&&!S)return p(a.signal.reason);let R=f;return this.#t[r]===f&&(b===void 0?R.__staleWhileFetching?this.#t[r]=R.__staleWhileFetching:this.delete(e):(i.status&&(i.status.fetchUpdated=!0),this.set(e,b,l.options))),b},h=b=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=b),p(b)),p=b=>{let{aborted:S}=a.signal,_=S&&i.allowStaleOnFetchAbort,x=_||i.allowStaleOnFetchRejection,R=x||i.noDeleteOnFetchRejection,O=f;if(this.#t[r]===f&&(!R||O.__staleWhileFetching===void 0?this.delete(e):_||(this.#t[r]=O.__staleWhileFetching)),x)return i.status&&O.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),O.__staleWhileFetching;if(O.__returned===O)throw b},c=(b,S)=>{let _=this.#o?.(e,s,l);_&&_ instanceof Promise&&_.then(x=>b(x===void 0?void 0:x),S),a.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(b(void 0),i.allowStaleOnFetchAbort&&(b=x=>u(x,!0)))})};i.status&&(i.status.fetchDispatched=!0);let f=new Promise(c).then(u,h),y=Object.assign(f,{__abortController:a,__staleWhileFetching:s,__returned:void 0});return r===void 0?(this.set(e,y,{...l.options,status:void 0}),r=this.#l.get(e)):this.#t[r]=y,y}#f(e){if(!this.#M)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof rs}async fetch(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:l=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:h=this.noUpdateTTL,noDeleteOnFetchRejection:p=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:c=this.allowStaleOnFetchRejection,ignoreFetchAbort:f=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,context:b,forceRefresh:S=!1,status:_,signal:x}=r;if(!this.#M)return _&&(_.fetch="get"),this.get(e,{allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:s,status:_});let R={allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:s,ttl:a,noDisposeOnSet:o,size:l,sizeCalculation:u,noUpdateTTL:h,noDeleteOnFetchRejection:p,allowStaleOnFetchRejection:c,allowStaleOnFetchAbort:y,ignoreFetchAbort:f,status:_,signal:x},O=this.#l.get(e);if(O===void 0){_&&(_.fetch="miss");let k=this.#C(e,O,R,b);return k.__returned=k}else{let k=this.#t[O];if(this.#f(k)){let te=i&&k.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",te&&(_.returnedStale=!0)),te?k.__staleWhileFetching:k.__returned=k}let D=this.#b(O);if(!S&&!D)return _&&(_.fetch="hit"),this.#q(O),n&&this.#O(O),_&&this.#S(_,O),k;let F=this.#C(e,O,R,b),B=F.__staleWhileFetching!==void 0&&i;return _&&(_.fetch=D?"stale":"refresh",B&&D&&(_.returnedStale=!0)),B?F.__staleWhileFetching:F.__returned=F}}get(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:a}=r,o=this.#l.get(e);if(o!==void 0){let l=this.#t[o],u=this.#f(l);return a&&this.#S(a,o),this.#b(o)?(a&&(a.get="stale"),u?(a&&i&&l.__staleWhileFetching!==void 0&&(a.returnedStale=!0),i?l.__staleWhileFetching:void 0):(s||this.delete(e),a&&i&&(a.returnedStale=!0),i?l:void 0)):(a&&(a.get="hit"),u?l.__staleWhileFetching:(this.#q(o),n&&this.#O(o),l))}else a&&(a.get="miss")}#F(e,r){this.#y[r]=e,this.#g[e]=r}#q(e){e!==this.#c&&(e===this.#d?this.#d=this.#g[e]:this.#F(this.#y[e],this.#g[e]),this.#F(this.#c,e),this.#c=e)}delete(e){let r=!1;if(this.#u!==0){let i=this.#l.get(e);if(i!==void 0)if(r=!0,this.#u===1)this.clear();else{this.#E(i);let n=this.#t[i];if(this.#f(n)?n.__abortController.abort(new Error("deleted")):(this.#w||this.#p)&&(this.#w&&this.#s?.(n,e,"delete"),this.#p&&this.#m?.push([n,e,"delete"])),this.#l.delete(e),this.#a[i]=void 0,this.#t[i]=void 0,i===this.#c)this.#c=this.#y[i];else if(i===this.#d)this.#d=this.#g[i];else{let s=this.#y[i];this.#g[s]=this.#g[i];let a=this.#g[i];this.#y[a]=this.#y[i]}this.#u--,this.#v.push(i)}}if(this.#p&&this.#m?.length){let i=this.#m,n;for(;n=i?.shift();)this.#i?.(...n)}return r}clear(){for(let e of this.#A({allowStale:!0})){let r=this.#t[e];if(this.#f(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#a[e];this.#w&&this.#s?.(r,i,"delete"),this.#p&&this.#m?.push([r,i,"delete"])}}if(this.#l.clear(),this.#t.fill(void 0),this.#a.fill(void 0),this.#_&&this.#T&&(this.#_.fill(0),this.#T.fill(0)),this.#x&&this.#x.fill(0),this.#d=0,this.#c=0,this.#v.length=0,this.#h=0,this.#u=0,this.#p&&this.#m){let e=this.#m,r;for(;r=e?.shift();)this.#i?.(...r)}}};var Rr=require("path"),Wp=require("url"),NS=pe(require("fs"),1),et=require("fs"),At=require("fs/promises");var us=require("events"),Yo=pe(require("stream"),1),jp=require("string_decoder"),Dp=typeof process=="object"&&process?process:{stdout:null,stderr:null},MS=t=>!!t&&typeof t=="object"&&(t instanceof Mt||t instanceof Yo.default||AS(t)||kS(t)),AS=t=>!!t&&typeof t=="object"&&t instanceof us.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==Yo.default.Writable.prototype.pipe,kS=t=>!!t&&typeof t=="object"&&t instanceof us.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",ot=Symbol("EOF"),lt=Symbol("maybeEmitEnd"),Ot=Symbol("emittedEnd"),is=Symbol("emittingEnd"),pi=Symbol("emittedError"),ns=Symbol("closed"),qp=Symbol("read"),ss=Symbol("flush"),Cp=Symbol("flushChunk"),Be=Symbol("encoding"),Sr=Symbol("decoder"),se=Symbol("flowing"),gi=Symbol("paused"),Er=Symbol("resume"),ae=Symbol("buffer"),Se=Symbol("pipes"),oe=Symbol("bufferLength"),Wo=Symbol("bufferPush"),as=Symbol("bufferShift"),ge=Symbol("objectMode"),ee=Symbol("destroyed"),Bo=Symbol("error"),Uo=Symbol("emitData"),Lp=Symbol("emitEnd"),zo=Symbol("emitEnd2"),Qe=Symbol("async"),Ho=Symbol("abort"),os=Symbol("aborted"),mi=Symbol("signal"),Jt=Symbol("dataListeners"),ke=Symbol("discarded"),yi=t=>Promise.resolve().then(t),PS=t=>t(),DS=t=>t==="end"||t==="finish"||t==="prefinish",qS=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,CS=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),ls=class{src;dest;opts;ondrain;constructor(e,r,i){this.src=e,this.dest=r,this.opts=i,this.ondrain=()=>e[Er](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Go=class extends ls{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,r,i){super(e,r,i),this.proxyErrors=n=>r.emit("error",n),e.on("error",this.proxyErrors)}},LS=t=>!!t.objectMode,jS=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",Mt=class extends us.EventEmitter{[se]=!1;[gi]=!1;[Se]=[];[ae]=[];[ge];[Be];[Qe];[Sr];[ot]=!1;[Ot]=!1;[is]=!1;[ns]=!1;[pi]=null;[oe]=0;[ee]=!1;[mi];[os]=!1;[Jt]=0;[ke]=!1;writable=!0;readable=!0;constructor(...e){let r=e[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");LS(r)?(this[ge]=!0,this[Be]=null):jS(r)?(this[Be]=r.encoding,this[ge]=!1):(this[ge]=!1,this[Be]=null),this[Qe]=!!r.async,this[Sr]=this[Be]?new jp.StringDecoder(this[Be]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[ae]}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Se]});let{signal:i}=r;i&&(this[mi]=i,i.aborted?this[Ho]():i.addEventListener("abort",()=>this[Ho]()))}get bufferLength(){return this[oe]}get encoding(){return this[Be]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[ge]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Qe]}set async(e){this[Qe]=this[Qe]||!!e}[Ho](){this[os]=!0,this.emit("abort",this[mi]?.reason),this.destroy(this[mi]?.reason)}get aborted(){return this[os]}set aborted(e){}write(e,r,i){if(this[os])return!1;if(this[ot])throw new Error("write after end");if(this[ee])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(i=r,r="utf8"),r||(r="utf8");let n=this[Qe]?yi:PS;if(!this[ge]&&!Buffer.isBuffer(e)){if(CS(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(qS(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[ge]?(this[se]&&this[oe]!==0&&this[ss](!0),this[se]?this.emit("data",e):this[Wo](e),this[oe]!==0&&this.emit("readable"),i&&n(i),this[se]):e.length?(typeof e=="string"&&!(r===this[Be]&&!this[Sr]?.lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[Be]&&(e=this[Sr].write(e)),this[se]&&this[oe]!==0&&this[ss](!0),this[se]?this.emit("data",e):this[Wo](e),this[oe]!==0&&this.emit("readable"),i&&n(i),this[se]):(this[oe]!==0&&this.emit("readable"),i&&n(i),this[se])}read(e){if(this[ee])return null;if(this[ke]=!1,this[oe]===0||e===0||e&&e>this[oe])return this[lt](),null;this[ge]&&(e=null),this[ae].length>1&&!this[ge]&&(this[ae]=[this[Be]?this[ae].join(""):Buffer.concat(this[ae],this[oe])]);let r=this[qp](e||null,this[ae][0]);return this[lt](),r}[qp](e,r){if(this[ge])this[as]();else{let i=r;e===i.length||e===null?this[as]():typeof i=="string"?(this[ae][0]=i.slice(e),r=i.slice(0,e),this[oe]-=e):(this[ae][0]=i.subarray(e),r=i.subarray(0,e),this[oe]-=e)}return this.emit("data",r),!this[ae].length&&!this[ot]&&this.emit("drain"),r}end(e,r,i){return typeof e=="function"&&(i=e,e=void 0),typeof r=="function"&&(i=r,r="utf8"),e!==void 0&&this.write(e,r),i&&this.once("end",i),this[ot]=!0,this.writable=!1,(this[se]||!this[gi])&&this[lt](),this}[Er](){this[ee]||(!this[Jt]&&!this[Se].length&&(this[ke]=!0),this[gi]=!1,this[se]=!0,this.emit("resume"),this[ae].length?this[ss]():this[ot]?this[lt]():this.emit("drain"))}resume(){return this[Er]()}pause(){this[se]=!1,this[gi]=!0,this[ke]=!1}get destroyed(){return this[ee]}get flowing(){return this[se]}get paused(){return this[gi]}[Wo](e){this[ge]?this[oe]+=1:this[oe]+=e.length,this[ae].push(e)}[as](){return this[ge]?this[oe]-=1:this[oe]-=this[ae][0].length,this[ae].shift()}[ss](e=!1){do;while(this[Cp](this[as]())&&this[ae].length);!e&&!this[ae].length&&!this[ot]&&this.emit("drain")}[Cp](e){return this.emit("data",e),this[se]}pipe(e,r){if(this[ee])return e;this[ke]=!1;let i=this[Ot];return r=r||{},e===Dp.stdout||e===Dp.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,i?r.end&&e.end():(this[Se].push(r.proxyErrors?new Go(this,e,r):new ls(this,e,r)),this[Qe]?yi(()=>this[Er]()):this[Er]()),e}unpipe(e){let r=this[Se].find(i=>i.dest===e);r&&(this[Se].length===1?(this[se]&&this[Jt]===0&&(this[se]=!1),this[Se]=[]):this[Se].splice(this[Se].indexOf(r),1),r.unpipe())}addListener(e,r){return this.on(e,r)}on(e,r){let i=super.on(e,r);if(e==="data")this[ke]=!1,this[Jt]++,!this[Se].length&&!this[se]&&this[Er]();else if(e==="readable"&&this[oe]!==0)super.emit("readable");else if(DS(e)&&this[Ot])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[pi]){let n=r;this[Qe]?yi(()=>n.call(this,this[pi])):n.call(this,this[pi])}return i}removeListener(e,r){return this.off(e,r)}off(e,r){let i=super.off(e,r);return e==="data"&&(this[Jt]=this.listeners("data").length,this[Jt]===0&&!this[ke]&&!this[Se].length&&(this[se]=!1)),i}removeAllListeners(e){let r=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Jt]=0,!this[ke]&&!this[Se].length&&(this[se]=!1)),r}get emittedEnd(){return this[Ot]}[lt](){!this[is]&&!this[Ot]&&!this[ee]&&this[ae].length===0&&this[ot]&&(this[is]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[ns]&&this.emit("close"),this[is]=!1)}emit(e,...r){let i=r[0];if(e!=="error"&&e!=="close"&&e!==ee&&this[ee])return!1;if(e==="data")return!this[ge]&&!i?!1:this[Qe]?(yi(()=>this[Uo](i)),!0):this[Uo](i);if(e==="end")return this[Lp]();if(e==="close"){if(this[ns]=!0,!this[Ot]&&!this[ee])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[pi]=i,super.emit(Bo,i);let s=!this[mi]||this.listeners("error").length?super.emit("error",i):!1;return this[lt](),s}else if(e==="resume"){let s=super.emit("resume");return this[lt](),s}else if(e==="finish"||e==="prefinish"){let s=super.emit(e);return this.removeAllListeners(e),s}let n=super.emit(e,...r);return this[lt](),n}[Uo](e){for(let i of this[Se])i.dest.write(e)===!1&&this.pause();let r=this[ke]?!1:super.emit("data",e);return this[lt](),r}[Lp](){return this[Ot]?!1:(this[Ot]=!0,this.readable=!1,this[Qe]?(yi(()=>this[zo]()),!0):this[zo]())}[zo](){if(this[Sr]){let r=this[Sr].end();if(r){for(let i of this[Se])i.dest.write(r);this[ke]||super.emit("data",r)}}for(let r of this[Se])r.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[ge]||(e.dataLength=0);let r=this.promise();return this.on("data",i=>{e.push(i),this[ge]||(e.dataLength+=i.length)}),await r,e}async concat(){if(this[ge])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Be]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,r)=>{this.on(ee,()=>r(new Error("stream destroyed"))),this.on("error",i=>r(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[ke]=!1;let e=!1,r=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return r();let n=this.read();if(n!==null)return Promise.resolve({done:!1,value:n});if(this[ot])return r();let s,a,o=p=>{this.off("data",l),this.off("end",u),this.off(ee,h),r(),a(p)},l=p=>{this.off("error",o),this.off("end",u),this.off(ee,h),this.pause(),s({value:p,done:!!this[ot]})},u=()=>{this.off("error",o),this.off("data",l),this.off(ee,h),r(),s({done:!0,value:void 0})},h=()=>o(new Error("stream destroyed"));return new Promise((p,c)=>{a=c,s=p,this.once(ee,h),this.once("error",o),this.once("end",u),this.once("data",l)})},throw:r,return:r,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[ke]=!1;let e=!1,r=()=>(this.pause(),this.off(Bo,r),this.off(ee,r),this.off("end",r),e=!0,{done:!0,value:void 0}),i=()=>{if(e)return r();let n=this.read();return n===null?r():{done:!1,value:n}};return this.once("end",r),this.once(Bo,r),this.once(ee,r),{next:i,throw:r,return:r,[Symbol.iterator](){return this}}}destroy(e){if(this[ee])return e?this.emit("error",e):this.emit(ee),this;this[ee]=!0,this[ke]=!0,this[ae].length=0,this[oe]=0;let r=this;return typeof r.close=="function"&&!this[ns]&&r.close(),e?this.emit("error",e):this.emit(ee),this}static get isStream(){return MS}};var FS=et.realpathSync.native,wi={lstatSync:et.lstatSync,readdir:et.readdir,readdirSync:et.readdirSync,readlinkSync:et.readlinkSync,realpathSync:FS,promises:{lstat:At.lstat,readdir:At.readdir,readlink:At.readlink,realpath:At.realpath}},Bp=t=>!t||t===wi||t===NS?wi:{...wi,...t,promises:{...wi.promises,...t.promises||{}}},Up=/^\\\\\?\\([a-z]:)\\?$/i,IS=t=>t.replace(/\//g,"\\").replace(Up,"$1\\"),$S=/[\\\/]/,Ne=0,zp=1,Hp=2,Xe=4,Gp=6,Yp=8,Zt=10,Vp=12,je=15,bi=~je,Vo=16,Np=32,vi=64,Ue=128,fs=256,cs=512,Fp=vi|Ue|cs,WS=1023,Ko=t=>t.isFile()?Yp:t.isDirectory()?Xe:t.isSymbolicLink()?Zt:t.isCharacterDevice()?Hp:t.isBlockDevice()?Gp:t.isSocket()?Vp:t.isFIFO()?zp:Ne,Ip=new Map,_i=t=>{let e=Ip.get(t);if(e)return e;let r=t.normalize("NFKD");return Ip.set(t,r),r},$p=new Map,hs=t=>{let e=$p.get(t);if(e)return e;let r=_i(t.toLowerCase());return $p.set(t,r),r},ds=class extends di{constructor(){super({max:256})}},Jo=class extends di{constructor(e=16*1024){super({maxSize:e,sizeCalculation:r=>r.length+1})}},Kp=Symbol("PathScurry setAsCwd"),me=class{name;root;roots;parent;nocase;#e;#r;get dev(){return this.#r}#s;get mode(){return this.#s}#i;get nlink(){return this.#i}#o;get uid(){return this.#o}#u;get gid(){return this.#u}#h;get rdev(){return this.#h}#l;get blksize(){return this.#l}#a;get ino(){return this.#a}#t;get size(){return this.#t}#g;get blocks(){return this.#g}#y;get atimeMs(){return this.#y}#d;get mtimeMs(){return this.#d}#c;get ctimeMs(){return this.#c}#v;get birthtimeMs(){return this.#v}#m;get atime(){return this.#m}#x;get mtime(){return this.#x}#T;get ctime(){return this.#T}#_;get birthtime(){return this.#_}#w;#M;#p;#k;#O;#S;#n;#b;#P;#E;get path(){return(this.parent||this).fullpath()}constructor(e,r=Ne,i,n,s,a,o){this.name=e,this.#w=s?hs(e):_i(e),this.#n=r&WS,this.nocase=s,this.roots=n,this.root=i||this,this.#b=a,this.#p=o.fullpath,this.#O=o.relative,this.#S=o.relativePosix,this.parent=o.parent,this.parent?this.#e=this.parent.#e:this.#e=Bp(o.fs)}depth(){return this.#M!==void 0?this.#M:this.parent?this.#M=this.parent.depth()+1:this.#M=0}childrenCache(){return this.#b}resolve(e){if(!e)return this;let r=this.getRootString(e),n=e.substring(r.length).split(this.splitSep);return r?this.getRoot(r).#L(n):this.#L(n)}#L(e){let r=this;for(let i of e)r=r.child(i);return r}children(){let e=this.#b.get(this);if(e)return e;let r=Object.assign([],{provisional:0});return this.#b.set(this,r),this.#n&=~Vo,r}child(e,r){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let i=this.children(),n=this.nocase?hs(e):_i(e);for(let l of i)if(l.#w===n)return l;let s=this.parent?this.sep:"",a=this.#p?this.#p+s+e:void 0,o=this.newChild(e,Ne,{...r,parent:this,fullpath:a});return this.canReaddir()||(o.#n|=Ue),i.push(o),o}relative(){if(this.#O!==void 0)return this.#O;let e=this.name,r=this.parent;if(!r)return this.#O=this.name;let i=r.relative();return i+(!i||!r.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.#S!==void 0)return this.#S;let e=this.name,r=this.parent;if(!r)return this.#S=this.fullpathPosix();let i=r.relativePosix();return i+(!i||!r.parent?"":"/")+e}fullpath(){if(this.#p!==void 0)return this.#p;let e=this.name,r=this.parent;if(!r)return this.#p=this.name;let n=r.fullpath()+(r.parent?this.sep:"")+e;return this.#p=n}fullpathPosix(){if(this.#k!==void 0)return this.#k;if(this.sep==="/")return this.#k=this.fullpath();if(!this.parent){let n=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(n)?this.#k=`//?/${n}`:this.#k=n}let e=this.parent,r=e.fullpathPosix(),i=r+(!r||!e.parent?"":"/")+this.name;return this.#k=i}isUnknown(){return(this.#n&je)===Ne}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#n&je)===Yp}isDirectory(){return(this.#n&je)===Xe}isCharacterDevice(){return(this.#n&je)===Hp}isBlockDevice(){return(this.#n&je)===Gp}isFIFO(){return(this.#n&je)===zp}isSocket(){return(this.#n&je)===Vp}isSymbolicLink(){return(this.#n&Zt)===Zt}lstatCached(){return this.#n&Np?this:void 0}readlinkCached(){return this.#P}realpathCached(){return this.#E}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#P)return!0;if(!this.parent)return!1;let e=this.#n&je;return!(e!==Ne&&e!==Zt||this.#n&fs||this.#n&Ue)}calledReaddir(){return!!(this.#n&Vo)}isENOENT(){return!!(this.#n&Ue)}isNamed(e){return this.nocase?this.#w===hs(e):this.#w===_i(e)}async readlink(){let e=this.#P;if(e)return e;if(this.canReadlink()&&this.parent)try{let r=await this.#e.promises.readlink(this.fullpath()),i=(await this.parent.realpath())?.resolve(r);if(i)return this.#P=i}catch(r){this.#F(r.code);return}}readlinkSync(){let e=this.#P;if(e)return e;if(this.canReadlink()&&this.parent)try{let r=this.#e.readlinkSync(this.fullpath()),i=this.parent.realpathSync()?.resolve(r);if(i)return this.#P=i}catch(r){this.#F(r.code);return}}#j(e){this.#n|=Vo;for(let r=e.provisional;r<e.length;r++){let i=e[r];i&&i.#R()}}#R(){this.#n&Ue||(this.#n=(this.#n|Ue)&bi,this.#A())}#A(){let e=this.children();e.provisional=0;for(let r of e)r.#R()}#N(){this.#n|=cs,this.#D()}#D(){if(this.#n&vi)return;let e=this.#n;(e&je)===Xe&&(e&=bi),this.#n=e|vi,this.#A()}#C(e=""){e==="ENOTDIR"||e==="EPERM"?this.#D():e==="ENOENT"?this.#R():this.children().provisional=0}#f(e=""){e==="ENOTDIR"?this.parent.#D():e==="ENOENT"&&this.#R()}#F(e=""){let r=this.#n;r|=fs,e==="ENOENT"&&(r|=Ue),(e==="EINVAL"||e==="UNKNOWN")&&(r&=bi),this.#n=r,e==="ENOTDIR"&&this.parent&&this.parent.#D()}#q(e,r){return this.#z(e,r)||this.#U(e,r)}#U(e,r){let i=Ko(e),n=this.newChild(e.name,i,{parent:this}),s=n.#n&je;return s!==Xe&&s!==Zt&&s!==Ne&&(n.#n|=vi),r.unshift(n),r.provisional++,n}#z(e,r){for(let i=r.provisional;i<r.length;i++){let n=r[i];if((this.nocase?hs(e.name):_i(e.name))===n.#w)return this.#H(e,n,i,r)}}#H(e,r,i,n){let s=r.name;return r.#n=r.#n&bi|Ko(e),s!==e.name&&(r.name=e.name),i!==n.provisional&&(i===n.length-1?n.pop():n.splice(i,1),n.unshift(r)),n.provisional++,r}async lstat(){if(!(this.#n&Ue))try{return this.#B(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#f(e.code)}}lstatSync(){if(!(this.#n&Ue))try{return this.#B(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#f(e.code)}}#B(e){let{atime:r,atimeMs:i,birthtime:n,birthtimeMs:s,blksize:a,blocks:o,ctime:l,ctimeMs:u,dev:h,gid:p,ino:c,mode:f,mtime:y,mtimeMs:b,nlink:S,rdev:_,size:x,uid:R}=e;this.#m=r,this.#y=i,this.#_=n,this.#v=s,this.#l=a,this.#g=o,this.#T=l,this.#c=u,this.#r=h,this.#u=p,this.#a=c,this.#s=f,this.#x=y,this.#d=b,this.#i=S,this.#h=_,this.#t=x,this.#o=R;let O=Ko(e);this.#n=this.#n&bi|O|Np,O!==Ne&&O!==Xe&&O!==Zt&&(this.#n|=vi)}#$=[];#W=!1;#G(e){this.#W=!1;let r=this.#$.slice();this.#$.length=0,r.forEach(i=>i(null,e))}readdirCB(e,r=!1){if(!this.canReaddir()){r?e(null,[]):queueMicrotask(()=>e(null,[]));return}let i=this.children();if(this.calledReaddir()){let s=i.slice(0,i.provisional);r?e(null,s):queueMicrotask(()=>e(null,s));return}if(this.#$.push(e),this.#W)return;this.#W=!0;let n=this.fullpath();this.#e.readdir(n,{withFileTypes:!0},(s,a)=>{if(s)this.#C(s.code),i.provisional=0;else{for(let o of a)this.#q(o,i);this.#j(i)}this.#G(i.slice(0,i.provisional))})}#I;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let r=this.fullpath();if(this.#I)await this.#I;else{let i=()=>{};this.#I=new Promise(n=>i=n);try{for(let n of await this.#e.promises.readdir(r,{withFileTypes:!0}))this.#q(n,e);this.#j(e)}catch(n){this.#C(n.code),e.provisional=0}this.#I=void 0,i()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let r=this.fullpath();try{for(let i of this.#e.readdirSync(r,{withFileTypes:!0}))this.#q(i,e);this.#j(e)}catch(i){this.#C(i.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#n&Fp)return!1;let e=je&this.#n;return e===Ne||e===Xe||e===Zt}shouldWalk(e,r){return(this.#n&Xe)===Xe&&!(this.#n&Fp)&&!e.has(this)&&(!r||r(this))}async realpath(){if(this.#E)return this.#E;if(!((cs|fs|Ue)&this.#n))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#E=this.resolve(e)}catch{this.#N()}}realpathSync(){if(this.#E)return this.#E;if(!((cs|fs|Ue)&this.#n))try{let e=this.#e.realpathSync(this.fullpath());return this.#E=this.resolve(e)}catch{this.#N()}}[Kp](e){if(e===this)return;let r=new Set([]),i=[],n=this;for(;n&&n.parent;)r.add(n),n.#O=i.join(this.sep),n.#S=i.join("/"),n=n.parent,i.push("..");for(n=e;n&&n.parent&&!r.has(n);)n.#O=void 0,n.#S=void 0,n=n.parent}},ps=class t extends me{sep="\\";splitSep=$S;constructor(e,r=Ne,i,n,s,a,o){super(e,r,i,n,s,a,o)}newChild(e,r=Ne,i={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),i)}getRootString(e){return Rr.win32.parse(e).root}getRoot(e){if(e=IS(e.toUpperCase()),e===this.root.name)return this.root;for(let[r,i]of Object.entries(this.roots))if(this.sameRoot(e,r))return this.roots[e]=i;return this.roots[e]=new xr(e,this).root}sameRoot(e,r=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(Up,"$1\\"),e===r}},gs=class t extends me{splitSep="/";sep="/";constructor(e,r=Ne,i,n,s,a,o){super(e,r,i,n,s,a,o)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,r=Ne,i={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),i)}},ms=class{root;rootPath;roots;cwd;#e;#r;#s;nocase;#i;constructor(e=process.cwd(),r,i,{nocase:n,childrenCacheSize:s=16*1024,fs:a=wi}={}){this.#i=Bp(a),(e instanceof URL||e.startsWith("file://"))&&(e=(0,Wp.fileURLToPath)(e));let o=r.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(o),this.#e=new ds,this.#r=new ds,this.#s=new Jo(s);let l=o.substring(this.rootPath.length).split(i);if(l.length===1&&!l[0]&&l.pop(),n===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=n,this.root=this.newRoot(this.#i),this.roots[this.rootPath]=this.root;let u=this.root,h=l.length-1,p=r.sep,c=this.rootPath,f=!1;for(let y of l){let b=h--;u=u.child(y,{relative:new Array(b).fill("..").join(p),relativePosix:new Array(b).fill("..").join("/"),fullpath:c+=(f?"":p)+y}),f=!0}this.cwd=u}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#s}resolve(...e){let r="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(r=r?`${a}/${r}`:a,this.isAbsolute(a)))break}let i=this.#e.get(r);if(i!==void 0)return i;let n=this.cwd.resolve(r).fullpath();return this.#e.set(r,n),n}resolvePosix(...e){let r="";for(let s=e.length-1;s>=0;s--){let a=e[s];if(!(!a||a===".")&&(r=r?`${a}/${r}`:a,this.isAbsolute(a)))break}let i=this.#r.get(r);if(i!==void 0)return i;let n=this.cwd.resolve(r).fullpathPosix();return this.#r.set(r,n),n}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,r={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof me||(r=e,e=this.cwd);let{withFileTypes:i}=r;if(e.canReaddir()){let n=await e.readdir();return i?n:n.map(s=>s.name)}else return[]}readdirSync(e=this.cwd,r={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof me||(r=e,e=this.cwd);let{withFileTypes:i=!0}=r;return e.canReaddir()?i?e.readdirSync():e.readdirSync().map(n=>n.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof me||(r=e.withFileTypes,e=this.cwd);let i=await e.readlink();return r?i:i?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof me||(r=e.withFileTypes,e=this.cwd);let i=e.readlinkSync();return r?i:i?.fullpath()}async realpath(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof me||(r=e.withFileTypes,e=this.cwd);let i=await e.realpath();return r?i:i?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof me||(r=e.withFileTypes,e=this.cwd);let i=e.realpathSync();return r?i:i?.fullpath()}async walk(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof me||(r=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:s,walkFilter:a}=r,o=[];(!s||s(e))&&o.push(i?e:e.fullpath());let l=new Set,u=(p,c)=>{l.add(p),p.readdirCB((f,y)=>{if(f)return c(f);let b=y.length;if(!b)return c();let S=()=>{--b===0&&c()};for(let _ of y)(!s||s(_))&&o.push(i?_:_.fullpath()),n&&_.isSymbolicLink()?_.realpath().then(x=>x?.isUnknown()?x.lstat():x).then(x=>x?.shouldWalk(l,a)?u(x,S):S()):_.shouldWalk(l,a)?u(_,S):S()},!0)},h=e;return new Promise((p,c)=>{u(h,f=>{if(f)return c(f);p(o)})})}walkSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof me||(r=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:s,walkFilter:a}=r,o=[];(!s||s(e))&&o.push(i?e:e.fullpath());let l=new Set([e]);for(let u of l){let h=u.readdirSync();for(let p of h){(!s||s(p))&&o.push(i?p:p.fullpath());let c=p;if(p.isSymbolicLink()){if(!(n&&(c=p.realpathSync())))continue;c.isUnknown()&&c.lstatSync()}c.shouldWalk(l,a)&&l.add(c)}}return o}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,r={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof me||(r=e,e=this.cwd),this.stream(e,r)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof me||(r=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:s,walkFilter:a}=r;(!s||s(e))&&(yield i?e:e.fullpath());let o=new Set([e]);for(let l of o){let u=l.readdirSync();for(let h of u){(!s||s(h))&&(yield i?h:h.fullpath());let p=h;if(h.isSymbolicLink()){if(!(n&&(p=h.realpathSync())))continue;p.isUnknown()&&p.lstatSync()}p.shouldWalk(o,a)&&o.add(p)}}}stream(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof me||(r=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:s,walkFilter:a}=r,o=new Mt({objectMode:!0});(!s||s(e))&&o.write(i?e:e.fullpath());let l=new Set,u=[e],h=0,p=()=>{let c=!1;for(;!c;){let f=u.shift();if(!f){h===0&&o.end();return}h++,l.add(f);let y=(S,_,x=!1)=>{if(S)return o.emit("error",S);if(n&&!x){let R=[];for(let O of _)O.isSymbolicLink()&&R.push(O.realpath().then(k=>k?.isUnknown()?k.lstat():k));if(R.length){Promise.all(R).then(()=>y(null,_,!0));return}}for(let R of _)R&&(!s||s(R))&&(o.write(i?R:R.fullpath())||(c=!0));h--;for(let R of _){let O=R.realpathCached()||R;O.shouldWalk(l,a)&&u.push(O)}c&&!o.flowing?o.once("drain",p):b||p()},b=!0;f.readdirCB(y,!0),b=!1}};return p(),o}streamSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof me||(r=e,e=this.cwd);let{withFileTypes:i=!0,follow:n=!1,filter:s,walkFilter:a}=r,o=new Mt({objectMode:!0}),l=new Set;(!s||s(e))&&o.write(i?e:e.fullpath());let u=[e],h=0,p=()=>{let c=!1;for(;!c;){let f=u.shift();if(!f){h===0&&o.end();return}h++,l.add(f);let y=f.readdirSync();for(let b of y)(!s||s(b))&&(o.write(i?b:b.fullpath())||(c=!0));h--;for(let b of y){let S=b;if(b.isSymbolicLink()){if(!(n&&(S=b.realpathSync())))continue;S.isUnknown()&&S.lstatSync()}S.shouldWalk(l,a)&&u.push(S)}}c&&!o.flowing&&o.once("drain",p)};return p(),o}chdir(e=this.cwd){let r=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[Kp](r)}},xr=class extends ms{sep="\\";constructor(e=process.cwd(),r={}){let{nocase:i=!0}=r;super(e,Rr.win32,"\\",{...r,nocase:i}),this.nocase=i;for(let n=this.cwd;n;n=n.parent)n.nocase=this.nocase}parseRootPath(e){return Rr.win32.parse(e).root.toUpperCase()}newRoot(e){return new ps(this.rootPath,Xe,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},Tr=class extends ms{sep="/";constructor(e=process.cwd(),r={}){let{nocase:i=!1}=r;super(e,Rr.posix,"/",{...r,nocase:i}),this.nocase=i}parseRootPath(e){return"/"}newRoot(e){return new gs(this.rootPath,Xe,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Si=class extends Tr{constructor(e=process.cwd(),r={}){let{nocase:i=!0}=r;super(e,{...r,nocase:i})}},hx=process.platform==="win32"?ps:gs,Jp=process.platform==="win32"?xr:process.platform==="darwin"?Si:Tr;var Zp=require("url");var BS=t=>t.length>=1,US=t=>t.length>=1,Or=class t{#e;#r;#s;length;#i;#o;#u;#h;#l;#a;#t=!0;constructor(e,r,i,n){if(!BS(e))throw new TypeError("empty pattern list");if(!US(r))throw new TypeError("empty glob list");if(r.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,i<0||i>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#r=r,this.#s=i,this.#i=n,this.#s===0){if(this.isUNC()){let[s,a,o,l,...u]=this.#e,[h,p,c,f,...y]=this.#r;u[0]===""&&(u.shift(),y.shift());let b=[s,a,o,l,""].join("/"),S=[h,p,c,f,""].join("/");this.#e=[b,...u],this.#r=[S,...y],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...a]=this.#e,[o,...l]=this.#r;a[0]===""&&(a.shift(),l.shift());let u=s+"/",h=o+"/";this.#e=[u,...a],this.#r=[h,...l],this.length=this.#e.length}}}pattern(){return this.#e[this.#s]}isString(){return typeof this.#e[this.#s]=="string"}isGlobstar(){return this.#e[this.#s]===he}isRegExp(){return this.#e[this.#s]instanceof RegExp}globString(){return this.#u=this.#u||(this.#s===0?this.isAbsolute()?this.#r[0]+this.#r.slice(1).join("/"):this.#r.join("/"):this.#r.slice(this.#s).join("/"))}hasMore(){return this.length>this.#s+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new t(this.#e,this.#r,this.#s+1,this.#i),this.#o.#a=this.#a,this.#o.#l=this.#l,this.#o.#h=this.#h,this.#o):this.#o=null}isUNC(){let e=this.#e;return this.#l!==void 0?this.#l:this.#l=this.#i==="win32"&&this.#s===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#h!==void 0?this.#h:this.#h=this.#i==="win32"&&this.#s===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#a!==void 0?this.#a:this.#a=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#s===0?e:""}checkFollowGlobstar(){return!(this.#s===0||!this.isGlobstar()||!this.#t)}markFollowGlobstar(){return this.#s===0||!this.isGlobstar()||!this.#t?!1:(this.#t=!1,!0)}};var zS=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ei=class{relative;relativeChildren;absolute;absoluteChildren;constructor(e,{nobrace:r,nocase:i,noext:n,noglobstar:s,platform:a=zS}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[];let o={dot:!0,nobrace:r,nocase:i,noext:n,noglobstar:s,optimizationLevel:2,platform:a,nocomment:!0,nonegate:!0};for(let l of e){let u=new Ae(l,o);for(let h=0;h<u.set.length;h++){let p=u.set[h],c=u.globParts[h];if(!p||!c)throw new Error("invalid pattern object");for(;p[0]==="."&&c[0]===".";)p.shift(),c.shift();let f=new Or(p,c,0,a),y=new Ae(f.globString(),o),b=c[c.length-1]==="**",S=f.isAbsolute();S?this.absolute.push(y):this.relative.push(y),b&&(S?this.absoluteChildren.push(y):this.relativeChildren.push(y))}}}ignored(e){let r=e.fullpath(),i=`${r}/`,n=e.relative()||".",s=`${n}/`;for(let a of this.relative)if(a.match(n)||a.match(s))return!0;for(let a of this.absolute)if(a.match(r)||a.match(i))return!0;return!1}childrenIgnored(e){let r=e.fullpath()+"/",i=(e.relative()||".")+"/";for(let n of this.relativeChildren)if(n.match(i))return!0;for(let n of this.absoluteChildren)if(n.match(r))return!0;return!1}};var Zo=class t{store;constructor(e=new Map){this.store=e}copy(){return new t(new Map(this.store))}hasWalked(e,r){return this.store.get(e.fullpath())?.has(r.globString())}storeWalked(e,r){let i=e.fullpath(),n=this.store.get(i);n?n.add(r.globString()):this.store.set(i,new Set([r.globString()]))}},Qo=class{store=new Map;add(e,r,i){let n=(r?2:0)|(i?1:0),s=this.store.get(e);this.store.set(e,s===void 0?n:n&s)}entries(){return[...this.store.entries()].map(([e,r])=>[e,!!(r&2),!!(r&1)])}},Xo=class{store=new Map;add(e,r){if(!e.canReaddir())return;let i=this.store.get(e);i?i.find(n=>n.globString()===r.globString())||i.push(r):this.store.set(e,[r])}get(e){let r=this.store.get(e);if(!r)throw new Error("attempting to walk unknown path");return r}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},Ri=class t{hasWalkedCache;matches=new Qo;subwalks=new Xo;patterns;follow;dot;opts;constructor(e,r){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=r?r.copy():new Zo}processPatterns(e,r){this.patterns=r;let i=r.map(n=>[e,n]);for(let[n,s]of i){this.hasWalkedCache.storeWalked(n,s);let a=s.root(),o=s.isAbsolute()&&this.opts.absolute!==!1;if(a){n=n.resolve(a==="/"&&this.opts.root!==void 0?this.opts.root:a);let p=s.rest();if(p)s=p;else{this.matches.add(n,!0,!1);continue}}if(n.isENOENT())continue;let l,u,h=!1;for(;typeof(l=s.pattern())=="string"&&(u=s.rest());)n=n.resolve(l),s=u,h=!0;if(l=s.pattern(),u=s.rest(),h){if(this.hasWalkedCache.hasWalked(n,s))continue;this.hasWalkedCache.storeWalked(n,s)}if(typeof l=="string"){let p=l===".."||l===""||l===".";this.matches.add(n.resolve(l),o,p);continue}else if(l===he){(!n.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(n,s);let p=u?.pattern(),c=u?.rest();if(!u||(p===""||p===".")&&!c)this.matches.add(n,o,p===""||p===".");else if(p===".."){let f=n.parent||n;c?this.hasWalkedCache.hasWalked(f,c)||this.subwalks.add(f,c):this.matches.add(f,o,!0)}}else l instanceof RegExp&&this.subwalks.add(n,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new t(this.opts,this.hasWalkedCache)}filterEntries(e,r){let i=this.subwalks.get(e),n=this.child();for(let s of r)for(let a of i){let o=a.isAbsolute(),l=a.pattern(),u=a.rest();l===he?n.testGlobstar(s,a,u,o):l instanceof RegExp?n.testRegExp(s,l,u,o):n.testString(s,l,u,o)}return n}testGlobstar(e,r,i,n){if((this.dot||!e.name.startsWith("."))&&(r.hasMore()||this.matches.add(e,n,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,r):e.isSymbolicLink()&&(i&&r.checkFollowGlobstar()?this.subwalks.add(e,i):r.markFollowGlobstar()&&this.subwalks.add(e,r)))),i){let s=i.pattern();if(typeof s=="string"&&s!==".."&&s!==""&&s!==".")this.testString(e,s,i.rest(),n);else if(s===".."){let a=e.parent||e;this.subwalks.add(a,i)}else s instanceof RegExp&&this.testRegExp(e,s,i.rest(),n)}}testRegExp(e,r,i,n){r.test(e.name)&&(i?this.subwalks.add(e,i):this.matches.add(e,n,!1))}testString(e,r,i,n){e.isNamed(r)&&(i?this.subwalks.add(e,i):this.matches.add(e,n,!1))}};var HS=(t,e)=>typeof t=="string"?new Ei([t],e):Array.isArray(t)?new Ei(t,e):t,ys=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#r;#s;signal;maxDepth;constructor(e,r,i){this.patterns=e,this.path=r,this.opts=i,this.#s=!i.posix&&i.platform==="win32"?"\\":"/",i.ignore&&(this.#r=HS(i.ignore,i)),this.maxDepth=i.maxDepth||1/0,i.signal&&(this.signal=i.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#i(e){return this.seen.has(e)||!!this.#r?.ignored?.(e)}#o(e){return!!this.#r?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,r){if(r&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=e.realpathCached()||await e.realpath(),!i)return;e=i}let s=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let a=await s.realpath();a&&(a.isUnknown()||this.opts.stat)&&await a.lstat()}return this.matchCheckTest(s,r)}matchCheckTest(e,r){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!r||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#i(e)?e:void 0}matchCheckSync(e,r){if(r&&this.opts.nodir)return;let i;if(this.opts.realpath){if(i=e.realpathCached()||e.realpathSync(),!i)return;e=i}let s=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let a=s.realpathSync();a&&(a?.isUnknown()||this.opts.stat)&&a.lstatSync()}return this.matchCheckTest(s,r)}matchFinish(e,r){if(this.#i(e))return;let i=this.opts.absolute===void 0?r:this.opts.absolute;this.seen.add(e);let n=this.opts.mark&&e.isDirectory()?this.#s:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(i){let s=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(s+n)}else{let s=this.opts.posix?e.relativePosix():e.relative(),a=this.opts.dotRelative&&!s.startsWith(".."+this.#s)?"."+this.#s:"";this.matchEmit(s?a+s+n:"."+n)}}async match(e,r,i){let n=await this.matchCheck(e,i);n&&this.matchFinish(n,r)}matchSync(e,r,i){let n=this.matchCheckSync(e,i);n&&this.matchFinish(n,r)}walkCB(e,r,i){this.signal?.aborted&&i(),this.walkCB2(e,r,new Ri(this.opts),i)}walkCB2(e,r,i,n){if(this.#o(e))return n();if(this.signal?.aborted&&n(),this.paused){this.onResume(()=>this.walkCB2(e,r,i,n));return}i.processPatterns(e,r);let s=1,a=()=>{--s===0&&n()};for(let[o,l,u]of i.matches.entries())this.#i(o)||(s++,this.match(o,l,u).then(()=>a()));for(let o of i.subwalkTargets()){if(this.maxDepth!==1/0&&o.depth()>=this.maxDepth)continue;s++;let l=o.readdirCached();o.calledReaddir()?this.walkCB3(o,l,i,a):o.readdirCB((u,h)=>this.walkCB3(o,h,i,a),!0)}a()}walkCB3(e,r,i,n){i=i.filterEntries(e,r);let s=1,a=()=>{--s===0&&n()};for(let[o,l,u]of i.matches.entries())this.#i(o)||(s++,this.match(o,l,u).then(()=>a()));for(let[o,l]of i.subwalks.entries())s++,this.walkCB2(o,l,i.child(),a);a()}walkCBSync(e,r,i){this.signal?.aborted&&i(),this.walkCB2Sync(e,r,new Ri(this.opts),i)}walkCB2Sync(e,r,i,n){if(this.#o(e))return n();if(this.signal?.aborted&&n(),this.paused){this.onResume(()=>this.walkCB2Sync(e,r,i,n));return}i.processPatterns(e,r);let s=1,a=()=>{--s===0&&n()};for(let[o,l,u]of i.matches.entries())this.#i(o)||this.matchSync(o,l,u);for(let o of i.subwalkTargets()){if(this.maxDepth!==1/0&&o.depth()>=this.maxDepth)continue;s++;let l=o.readdirSync();this.walkCB3Sync(o,l,i,a)}a()}walkCB3Sync(e,r,i,n){i=i.filterEntries(e,r);let s=1,a=()=>{--s===0&&n()};for(let[o,l,u]of i.matches.entries())this.#i(o)||this.matchSync(o,l,u);for(let[o,l]of i.subwalks.entries())s++,this.walkCB2Sync(o,l,i.child(),a);a()}},xi=class extends ys{matches;constructor(e,r,i){super(e,r,i),this.matches=new Set}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,r)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?r(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},Ti=class extends ys{results;constructor(e,r,i){super(e,r,i),this.results=new Mt({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var GS=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",ze=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;opts;patterns;constructor(e,r){if(!r)throw new TypeError("glob options required");if(this.withFileTypes=!!r.withFileTypes,this.signal=r.signal,this.follow=!!r.follow,this.dot=!!r.dot,this.dotRelative=!!r.dotRelative,this.nodir=!!r.nodir,this.mark=!!r.mark,r.cwd?(r.cwd instanceof URL||r.cwd.startsWith("file://"))&&(r.cwd=(0,Zp.fileURLToPath)(r.cwd)):this.cwd="",this.cwd=r.cwd||"",this.root=r.root,this.magicalBraces=!!r.magicalBraces,this.nobrace=!!r.nobrace,this.noext=!!r.noext,this.realpath=!!r.realpath,this.absolute=r.absolute,this.noglobstar=!!r.noglobstar,this.matchBase=!!r.matchBase,this.maxDepth=typeof r.maxDepth=="number"?r.maxDepth:1/0,this.stat=!!r.stat,this.ignore=r.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(l=>l.replace(/\\/g,"/"))),this.matchBase){if(r.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(l=>l.includes("/")?l:`./**/${l}`)}if(this.pattern=e,this.platform=r.platform||GS,this.opts={...r,platform:this.platform},r.scurry){if(this.scurry=r.scurry,r.nocase!==void 0&&r.nocase!==r.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let l=r.platform==="win32"?xr:r.platform==="darwin"?Si:r.platform?Tr:Jp;this.scurry=new l(this.cwd,{nocase:r.nocase,fs:r.fs})}this.nocase=this.scurry.nocase;let i=this.platform==="darwin"||this.platform==="win32",n={...r,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:i,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},s=this.pattern.map(l=>new Ae(l,n)),[a,o]=s.reduce((l,u)=>(l[0].push(...u.set),l[1].push(...u.globParts),l),[[],[]]);this.patterns=a.map((l,u)=>{let h=o[u];if(!h)throw new Error("invalid pattern object");return new Or(l,h,0,this.platform)})}async walk(){return[...await new xi(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase}).walk()]}walkSync(){return[...new xi(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase}).walkSync()]}stream(){return new Ti(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase}).stream()}streamSync(){return new Ti(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var el=(t,e={})=>{Array.isArray(t)||(t=[t]);for(let r of t)if(new Ae(r,e).hasMagic())return!0;return!1};function ws(t,e={}){return new ze(t,e).streamSync()}function Xp(t,e={}){return new ze(t,e).stream()}function eg(t,e={}){return new ze(t,e).walkSync()}async function Qp(t,e={}){return new ze(t,e).walk()}function vs(t,e={}){return new ze(t,e).iterateSync()}function tg(t,e={}){return new ze(t,e).iterate()}var YS=ws,VS=Object.assign(Xp,{sync:ws}),KS=vs,JS=Object.assign(tg,{sync:vs}),ZS=Object.assign(eg,{stream:ws,iterate:vs}),bs=Object.assign(Qp,{glob:Qp,globSync:eg,sync:ZS,globStream:Xp,stream:VS,globStreamSync:ws,streamSync:YS,globIterate:tg,iterate:JS,globIterateSync:vs,iterateSync:KS,Glob:ze,hasMagic:el,escape:wr,unescape:We});bs.glob=bs;var QS="../build",XS="../wheels";async function sg(t,e){let r=[],i=n=>{r.push(n)};if(await t.loadPackage(e,{errorCallback:i}),r.length>0)throw new Error(r.join(`
36
- `))}async function eE(t){I.info("Copy the build directory (the bare built app files) to this directory...");let e=ce.default.resolve(__dirname,QS);if(!(await ut.default.stat(e)).isDirectory())throw new Error(`The source ${e} does not exist.`);if(e===t.copyTo){I.warn(`sourceDir == destDir (${e}). Are you in the development environment? Skip copying the directory.`);return}if(t.keepOld)try{await ut.default.access(t.copyTo),I.info(`${t.copyTo} already exists. Use it and skip copying.`);return}catch{throw new Error(`${t.copyTo} does not exist even though the \`keepOld\` option is specified`)}I.debug(`Copy ${e} to ${t.copyTo}`),await ut.default.rm(t.copyTo,{recursive:!0,force:!0}),await tl.default.copy(e,t.copyTo,{errorOnExist:!0})}async function tE(t){if(t.requirements.length===0)return[];let e=await(0,Oi.loadPyodide)({packageCacheDir:t.pyodideRuntimeDir});return e._api.setCdnUrl(t.pyodideSource),await ag(e,{requirements:t.requirements}),Object.entries(e.loadedPackages).filter(([,r])=>r==="default channel").map(([r])=>r)}async function rg(t,e){I.debug("Preparing the local wheel: %s",e);let r=await ut.default.readFile(e),i="/tmp/"+ce.default.basename(e);t.FS.writeFile(i,r);let n=`emfs:${i}`;return I.debug("The local wheel %s is prepared as %s",e,n),n}async function ag(t,e){await sg(t,"micropip");let r=t.pyimport("micropip"),i=[...e.requirements],n=ce.default.join(__dirname,XS),s=await rg(t,ce.default.join(n,"stlite_server-0.1.0-py3-none-any.whl"));i.push(s);let a=await rg(t,ce.default.join(n,"streamlit-1.36.0-cp312-none-any.whl"));i.push(a),I.info("Install the packages: %j",i),await r.install.callKwargs(i,{keep_going:!0})}async function rE(t){I.info("Create the site-packages snapshot file...");let e=await(0,Oi.loadPyodide)({packageCacheDir:t.pyodideRuntimeDir});e._api.setCdnUrl(t.pyodideSource),await sg(e,"micropip");let r=e.pyimport("micropip"),i=new Kn(t.pyodideSource),n=[];if(t.usedPrebuiltPackages.length>0){I.info("Mocking prebuilt packages so that they will not be included in the site-packages snapshot because these will be installed from the vendored wheel files at runtime...");for(let o of t.usedPrebuiltPackages){let l=await i.getPackageInfoByName(o);if(l==null)throw new Error(`Package ${o} is not found in the lock file.`);I.debug(`Mock ${l.name} ${l.version}`),r.add_mock_package(l.name,l.version),n.push(l.name)}}I.info("Install the requirements %j",t.requirements),await ag(e,{requirements:t.requirements}),I.info("Remove the mocked packages: %j",n),n.forEach(o=>r.remove_mock_package(o)),I.info("Archive the site-packages director(y|ies)");let s="/tmp/site-packages-snapshot.tar.gz";await e.runPythonAsync(`
36
+ `))}async function eE(t){I.info("Copy the build directory (the bare built app files) to this directory...");let e=ce.default.resolve(__dirname,QS);if(!(await ut.default.stat(e)).isDirectory())throw new Error(`The source ${e} does not exist.`);if(e===t.copyTo){I.warn(`sourceDir == destDir (${e}). Are you in the development environment? Skip copying the directory.`);return}if(t.keepOld)try{await ut.default.access(t.copyTo),I.info(`${t.copyTo} already exists. Use it and skip copying.`);return}catch{throw new Error(`${t.copyTo} does not exist even though the \`keepOld\` option is specified`)}I.debug(`Copy ${e} to ${t.copyTo}`),await ut.default.rm(t.copyTo,{recursive:!0,force:!0}),await tl.default.copy(e,t.copyTo,{errorOnExist:!0})}async function tE(t){if(t.requirements.length===0)return[];let e=await(0,Oi.loadPyodide)({packageCacheDir:t.pyodideRuntimeDir});return e._api.setCdnUrl(t.pyodideSource),await ag(e,{requirements:t.requirements}),Object.entries(e.loadedPackages).filter(([,r])=>r==="default channel").map(([r])=>r)}async function rg(t,e){I.debug("Preparing the local wheel: %s",e);let r=await ut.default.readFile(e),i="/tmp/"+ce.default.basename(e);t.FS.writeFile(i,r);let n=`emfs:${i}`;return I.debug("The local wheel %s is prepared as %s",e,n),n}async function ag(t,e){await sg(t,"micropip");let r=t.pyimport("micropip"),i=[...e.requirements],n=ce.default.join(__dirname,XS),s=await rg(t,ce.default.join(n,"stlite_lib-0.1.0-py3-none-any.whl"));i.push(s);let a=await rg(t,ce.default.join(n,"streamlit-1.36.0-cp312-none-any.whl"));i.push(a),I.info("Install the packages: %j",i),await r.install.callKwargs(i,{keep_going:!0})}async function rE(t){I.info("Create the site-packages snapshot file...");let e=await(0,Oi.loadPyodide)({packageCacheDir:t.pyodideRuntimeDir});e._api.setCdnUrl(t.pyodideSource),await sg(e,"micropip");let r=e.pyimport("micropip"),i=new Kn(t.pyodideSource),n=[];if(t.usedPrebuiltPackages.length>0){I.info("Mocking prebuilt packages so that they will not be included in the site-packages snapshot because these will be installed from the vendored wheel files at runtime...");for(let o of t.usedPrebuiltPackages){let l=await i.getPackageInfoByName(o);if(l==null)throw new Error(`Package ${o} is not found in the lock file.`);I.debug(`Mock ${l.name} ${l.version}`),r.add_mock_package(l.name,l.version),n.push(l.name)}}I.info("Install the requirements %j",t.requirements),await ag(e,{requirements:t.requirements}),I.info("Remove the mocked packages: %j",n),n.forEach(o=>r.remove_mock_package(o)),I.info("Archive the site-packages director(y|ies)");let s="/tmp/site-packages-snapshot.tar.gz";await e.runPythonAsync(`
37
37
  import os
38
38
  import tarfile
39
39
  import site
@@ -1,46 +1,46 @@
1
1
  {
2
2
  "files": {
3
- "main.css": "/static/css/main.6fb7674e.css",
4
- "main.js": "/static/js/main.eea22731.js",
5
- "static/js/8798.108f543f.chunk.js": "/static/js/8798.108f543f.chunk.js",
3
+ "main.css": "/static/css/main.fc8432ac.css",
4
+ "main.js": "/static/js/main.53e797b7.js",
5
+ "static/js/8798.a2b2458c.chunk.js": "/static/js/8798.a2b2458c.chunk.js",
6
6
  "static/js/4994.2d981099.chunk.js": "/static/js/4994.2d981099.chunk.js",
7
7
  "static/js/3685.39209b63.chunk.js": "/static/js/3685.39209b63.chunk.js",
8
- "static/js/4785.23c48fdd.chunk.js": "/static/js/4785.23c48fdd.chunk.js",
9
- "static/js/5299.478bd9da.chunk.js": "/static/js/5299.478bd9da.chunk.js",
10
- "static/js/4482.6da0ecb0.chunk.js": "/static/js/4482.6da0ecb0.chunk.js",
8
+ "static/js/4785.3cf5ba35.chunk.js": "/static/js/4785.3cf5ba35.chunk.js",
9
+ "static/js/5299.37cca9f0.chunk.js": "/static/js/5299.37cca9f0.chunk.js",
10
+ "static/js/4482.98a18a0a.chunk.js": "/static/js/4482.98a18a0a.chunk.js",
11
11
  "static/css/188.da3ff442.chunk.css": "/static/css/188.da3ff442.chunk.css",
12
- "static/js/188.d9018bc1.chunk.js": "/static/js/188.d9018bc1.chunk.js",
12
+ "static/js/188.b2d8398c.chunk.js": "/static/js/188.b2d8398c.chunk.js",
13
13
  "static/css/2664.c24b25fa.chunk.css": "/static/css/2664.c24b25fa.chunk.css",
14
- "static/js/2664.219ef364.chunk.js": "/static/js/2664.219ef364.chunk.js",
15
- "static/js/4021.50e4fad7.chunk.js": "/static/js/4021.50e4fad7.chunk.js",
16
- "static/js/8186.383ded78.chunk.js": "/static/js/8186.383ded78.chunk.js",
17
- "static/js/1122.1fd3187d.chunk.js": "/static/js/1122.1fd3187d.chunk.js",
18
- "static/js/6802.e50f982c.chunk.js": "/static/js/6802.e50f982c.chunk.js",
14
+ "static/js/2664.eabe48f2.chunk.js": "/static/js/2664.eabe48f2.chunk.js",
15
+ "static/js/4021.8fb78041.chunk.js": "/static/js/4021.8fb78041.chunk.js",
16
+ "static/js/8186.a240968d.chunk.js": "/static/js/8186.a240968d.chunk.js",
17
+ "static/js/1122.6e3ebec6.chunk.js": "/static/js/1122.6e3ebec6.chunk.js",
18
+ "static/js/6802.07e6658b.chunk.js": "/static/js/6802.07e6658b.chunk.js",
19
19
  "static/js/9311.313a112a.chunk.js": "/static/js/9311.313a112a.chunk.js",
20
- "static/js/144.546cefc4.chunk.js": "/static/js/144.546cefc4.chunk.js",
21
- "static/js/2940.a8dfa8f6.chunk.js": "/static/js/2940.a8dfa8f6.chunk.js",
22
- "static/js/9001.18ff903a.chunk.js": "/static/js/9001.18ff903a.chunk.js",
23
- "static/js/2873.86ab0f7f.chunk.js": "/static/js/2873.86ab0f7f.chunk.js",
24
- "static/js/6134.d4057528.chunk.js": "/static/js/6134.d4057528.chunk.js",
20
+ "static/js/144.e524055a.chunk.js": "/static/js/144.e524055a.chunk.js",
21
+ "static/js/2940.d2fb8fd8.chunk.js": "/static/js/2940.d2fb8fd8.chunk.js",
22
+ "static/js/9001.10d51d69.chunk.js": "/static/js/9001.10d51d69.chunk.js",
23
+ "static/js/2873.fef955fd.chunk.js": "/static/js/2873.fef955fd.chunk.js",
24
+ "static/js/6134.8ad13d14.chunk.js": "/static/js/6134.8ad13d14.chunk.js",
25
25
  "static/js/1189.4d3c558f.chunk.js": "/static/js/1189.4d3c558f.chunk.js",
26
- "static/js/1740.760a8d99.chunk.js": "/static/js/1740.760a8d99.chunk.js",
27
- "static/js/698.e345ddd0.chunk.js": "/static/js/698.e345ddd0.chunk.js",
28
- "static/js/4724.85ca8f57.chunk.js": "/static/js/4724.85ca8f57.chunk.js",
29
- "static/js/9846.e3403599.chunk.js": "/static/js/9846.e3403599.chunk.js",
26
+ "static/js/1740.0e2e5bba.chunk.js": "/static/js/1740.0e2e5bba.chunk.js",
27
+ "static/js/698.f3d5f888.chunk.js": "/static/js/698.f3d5f888.chunk.js",
28
+ "static/js/4724.db036438.chunk.js": "/static/js/4724.db036438.chunk.js",
29
+ "static/js/9846.7f2d71be.chunk.js": "/static/js/9846.7f2d71be.chunk.js",
30
30
  "static/js/1261.55fcf8e4.chunk.js": "/static/js/1261.55fcf8e4.chunk.js",
31
- "static/js/4494.280a2293.chunk.js": "/static/js/4494.280a2293.chunk.js",
31
+ "static/js/4494.322ddf1c.chunk.js": "/static/js/4494.322ddf1c.chunk.js",
32
32
  "static/js/1612.2c8886f8.chunk.js": "/static/js/1612.2c8886f8.chunk.js",
33
- "static/js/9813.151e8692.chunk.js": "/static/js/9813.151e8692.chunk.js",
33
+ "static/js/9813.a1d01534.chunk.js": "/static/js/9813.a1d01534.chunk.js",
34
34
  "static/js/4694.153a454c.chunk.js": "/static/js/4694.153a454c.chunk.js",
35
- "static/js/7579.0cee4fc7.chunk.js": "/static/js/7579.0cee4fc7.chunk.js",
35
+ "static/js/7579.36786736.chunk.js": "/static/js/7579.36786736.chunk.js",
36
36
  "static/js/2448.d1709ca6.chunk.js": "/static/js/2448.d1709ca6.chunk.js",
37
37
  "static/js/8801.76a4052c.chunk.js": "/static/js/8801.76a4052c.chunk.js",
38
- "static/js/7696.82915710.chunk.js": "/static/js/7696.82915710.chunk.js",
39
- "static/js/7125.b89dc54f.chunk.js": "/static/js/7125.b89dc54f.chunk.js",
40
- "static/js/8853.7b55e9e4.chunk.js": "/static/js/8853.7b55e9e4.chunk.js",
41
- "static/js/9005.36ad4e5c.chunk.js": "/static/js/9005.36ad4e5c.chunk.js",
42
- "static/js/1046.3bed3c50.chunk.js": "/static/js/1046.3bed3c50.chunk.js",
43
- "static/js/4831.a2c2c8ad.chunk.js": "/static/js/4831.a2c2c8ad.chunk.js",
38
+ "static/js/7696.21dc1df4.chunk.js": "/static/js/7696.21dc1df4.chunk.js",
39
+ "static/js/7125.44ce1822.chunk.js": "/static/js/7125.44ce1822.chunk.js",
40
+ "static/js/8853.aba4297d.chunk.js": "/static/js/8853.aba4297d.chunk.js",
41
+ "static/js/9005.95d4ec49.chunk.js": "/static/js/9005.95d4ec49.chunk.js",
42
+ "static/js/1046.ac5578f7.chunk.js": "/static/js/1046.ac5578f7.chunk.js",
43
+ "static/js/4831.1e1e6a8e.chunk.js": "/static/js/4831.1e1e6a8e.chunk.js",
44
44
  "static/js/5599.47501794.chunk.js": "/static/js/5599.47501794.chunk.js",
45
45
  "static/js/4004.05e297fd.chunk.js": "/static/js/4004.05e297fd.chunk.js",
46
46
  "static/js/5783.1caefe8d.chunk.js": "/static/js/5783.1caefe8d.chunk.js",
@@ -105,7 +105,7 @@
105
105
  "static/media/KaTeX_Main-Bold.woff2": "/static/media/KaTeX_Main-Bold.39890742bc957b368704.woff2",
106
106
  "static/media/KaTeX_SansSerif-Bold.ttf": "/static/media/KaTeX_SansSerif-Bold.5b49f4993ae22d7975b4.ttf",
107
107
  "static/media/KaTeX_SansSerif-Italic.ttf": "/static/media/KaTeX_SansSerif-Italic.b257a18c016f37ee4543.ttf",
108
- "pypi/stlite_server-0.1.0-py3-none-any.whl": "/pypi/stlite_server-0.1.0-py3-none-any.whl",
108
+ "pypi/stlite_lib-0.1.0-py3-none-any.whl": "/pypi/stlite_lib-0.1.0-py3-none-any.whl",
109
109
  "static/media/KaTeX_Main-Italic.woff": "/static/media/KaTeX_Main-Italic.fd947498bc16392e76c2.woff",
110
110
  "static/media/KaTeX_Fraktur-Bold.ttf": "/static/media/KaTeX_Fraktur-Bold.4c761b3711973ab04edf.ttf",
111
111
  "static/media/KaTeX_Fraktur-Regular.ttf": "/static/media/KaTeX_Fraktur-Regular.ed305b5434865e06ffde.ttf",
@@ -162,7 +162,7 @@
162
162
  "index.html": "/index.html"
163
163
  },
164
164
  "entrypoints": [
165
- "static/css/main.6fb7674e.css",
166
- "static/js/main.eea22731.js"
165
+ "static/css/main.fc8432ac.css",
166
+ "static/js/main.53e797b7.js"
167
167
  ]
168
168
  }
@@ -1,5 +1,5 @@
1
- var pe=Object.create;var X=Object.defineProperty;var _e=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var he=Object.getPrototypeOf,ve=Object.prototype.hasOwnProperty;var M=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Pe=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ye(e))!ve.call(r,o)&&o!==t&&X(r,o,{get:()=>e[o],enumerable:!(s=_e(e,o))||s.enumerable});return r};var I=(r,e,t)=>(t=r!=null?pe(he(r)):{},Pe(e||!r||!r.__esModule?X(t,"default",{value:r,enumerable:!0}):t,r));var G=M(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.validateRequirements=void 0;var be="[",we="(<=>!~",Se=";",ke="@",Ae=new RegExp(`[${be+we+Se+ke}]`);function Re(r){return r.split(Ae)[0].trim()}function Fe(r){return r.forEach(t=>{let s;try{s=new URL(t)}catch{return}if(s.protocol==="emfs:"||s.protocol==="file:")throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${t})`)}),r.filter(t=>Re(t)==="streamlit"?(console.warn(`Streamlit is specified in the requirements ("${t}"), but it will be ignored. A built-in version of Streamlit will be used.`),!1):!0)}C.validateRequirements=Fe});var Q=M(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.parseRequirementsTxt=void 0;var Me=/\s#.*$/;function Ie(r){return r.split(`
2
- `).filter(e=>!e.startsWith("#")).map(e=>e.replace(Me,"")).map(e=>e.trim()).filter(e=>e!=="")}T.parseRequirementsTxt=Ie});var Y=M(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.PromiseDelegate=void 0;var U=class{constructor(){this.promise=new Promise((e,t)=>{this.resolveInternal=e,this.rejectInternal=t})}resolve(e){this.resolveInternal(e)}reject(e){this.rejectInternal(e)}};N.PromiseDelegate=U});var Z=M(w=>{"use strict";var Oe=w&&w.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t);var o=Object.getOwnPropertyDescriptor(e,t);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,s,o)}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]}),x=w&&w.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Oe(e,r,t)};Object.defineProperty(w,"__esModule",{value:!0});x(G(),w);x(Q(),w);x(Y(),w)});var re=M((Xe,te)=>{"use strict";function P(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}function ee(r,e){for(var t="",s=0,o=-1,i=0,n,a=0;a<=r.length;++a){if(a<r.length)n=r.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(o===a-1||i===1))if(o!==a-1&&i===2){if(t.length<2||s!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var c=t.lastIndexOf("/");if(c!==t.length-1){c===-1?(t="",s=0):(t=t.slice(0,c),s=t.length-1-t.lastIndexOf("/")),o=a,i=0;continue}}else if(t.length===2||t.length===1){t="",s=0,o=a,i=0;continue}}e&&(t.length>0?t+="/..":t="..",s=2)}else t.length>0?t+="/"+r.slice(o+1,a):t=r.slice(o+1,a),s=a-o-1;o=a,i=0}else n===46&&i!==-1?++i:i=-1}return t}function Ee(r,e){var t=e.dir||e.root,s=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+s:t+r+s:s}var R={resolve:function(){for(var e="",t=!1,s,o=arguments.length-1;o>=-1&&!t;o--){var i;o>=0?i=arguments[o]:(s===void 0&&(s=process.cwd()),i=s),P(i),i.length!==0&&(e=i+"/"+e,t=i.charCodeAt(0)===47)}return e=ee(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(P(e),e.length===0)return".";var t=e.charCodeAt(0)===47,s=e.charCodeAt(e.length-1)===47;return e=ee(e,!t),e.length===0&&!t&&(e="."),e.length>0&&s&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return P(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var s=arguments[t];P(s),s.length>0&&(e===void 0?e=s:e+="/"+s)}return e===void 0?".":R.normalize(e)},relative:function(e,t){if(P(e),P(t),e===t||(e=R.resolve(e),t=R.resolve(t),e===t))return"";for(var s=1;s<e.length&&e.charCodeAt(s)===47;++s);for(var o=e.length,i=o-s,n=1;n<t.length&&t.charCodeAt(n)===47;++n);for(var a=t.length,c=a-n,g=i<c?i:c,f=-1,l=0;l<=g;++l){if(l===g){if(c>g){if(t.charCodeAt(n+l)===47)return t.slice(n+l+1);if(l===0)return t.slice(n+l)}else i>g&&(e.charCodeAt(s+l)===47?f=l:l===0&&(f=0));break}var S=e.charCodeAt(s+l),_=t.charCodeAt(n+l);if(S!==_)break;S===47&&(f=l)}var d="";for(l=s+f+1;l<=o;++l)(l===o||e.charCodeAt(l)===47)&&(d.length===0?d+="..":d+="/..");return d.length>0?d+t.slice(n+f):(n+=f,t.charCodeAt(n)===47&&++n,t.slice(n))},_makeLong:function(e){return e},dirname:function(e){if(P(e),e.length===0)return".";for(var t=e.charCodeAt(0),s=t===47,o=-1,i=!0,n=e.length-1;n>=1;--n)if(t=e.charCodeAt(n),t===47){if(!i){o=n;break}}else i=!1;return o===-1?s?"/":".":s&&o===1?"//":e.slice(0,o)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');P(e);var s=0,o=-1,i=!0,n;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,c=-1;for(n=e.length-1;n>=0;--n){var g=e.charCodeAt(n);if(g===47){if(!i){s=n+1;break}}else c===-1&&(i=!1,c=n+1),a>=0&&(g===t.charCodeAt(a)?--a===-1&&(o=n):(a=-1,o=c))}return s===o?o=c:o===-1&&(o=e.length),e.slice(s,o)}else{for(n=e.length-1;n>=0;--n)if(e.charCodeAt(n)===47){if(!i){s=n+1;break}}else o===-1&&(i=!1,o=n+1);return o===-1?"":e.slice(s,o)}},extname:function(e){P(e);for(var t=-1,s=0,o=-1,i=!0,n=0,a=e.length-1;a>=0;--a){var c=e.charCodeAt(a);if(c===47){if(!i){s=a+1;break}continue}o===-1&&(i=!1,o=a+1),c===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||o===-1||n===0||n===1&&t===o-1&&t===s+1?"":e.slice(t,o)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return Ee("/",e)},parse:function(e){P(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var s=e.charCodeAt(0),o=s===47,i;o?(t.root="/",i=1):i=0;for(var n=-1,a=0,c=-1,g=!0,f=e.length-1,l=0;f>=i;--f){if(s=e.charCodeAt(f),s===47){if(!g){a=f+1;break}continue}c===-1&&(g=!1,c=f+1),s===46?n===-1?n=f:l!==1&&(l=1):n!==-1&&(l=-1)}return n===-1||c===-1||l===0||l===1&&n===c-1&&n===a+1?c!==-1&&(a===0&&o?t.base=t.name=e.slice(1,c):t.base=t.name=e.slice(a,c)):(a===0&&o?(t.name=e.slice(1,n),t.base=e.slice(1,c)):(t.name=e.slice(a,n),t.base=e.slice(a,c)),t.ext=e.slice(n,c)),a>0?t.dir=e.slice(0,a-1):o&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};R.posix=R;te.exports=R});var B=require("node:worker_threads");var le=I(Z());var q=I(re());function oe(r,e){let t=q.default.normalize(e),o=q.default.dirname(t).split("/"),i=[];for(let n of o){i.push(n);let a=i.join("/");if(r.FS.analyzePath(a).exists){if(r.FS.isDir(a))throw new Error(`"${a}" already exists and is not a directory.`);continue}try{r.FS.mkdir(a)}catch(c){throw console.error(`Failed to create a directory "${a}"`),c}}}function $(r,e,t,s){oe(r,e),r.FS.writeFile(e,t,s)}function se(r,e,t){oe(r,t),r.FS.rename(e,t)}var Le="[",Ce="(<=>!~",Te=";",Ne="@",De=new RegExp(`[${Le+Ce+Te+Ne}]`);function Ue(r){return r.split(De)[0].trim()}function H(r){return r.forEach(t=>{let s;try{s=new URL(t)}catch{return}if(s.protocol==="emfs:"||s.protocol==="file:")throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${t})`)}),r.filter(t=>Ue(t)==="streamlit"?(console.warn(`Streamlit is specified in the requirements ("${t}"), but it will be ignored. A built-in version of Streamlit will be used.`),!1):!0)}async function xe(r){let e=typeof process<"u"&&process.versions?.node,t;e?t=(await import("node:path")).sep:t="/";let s=r.slice(0,r.lastIndexOf(t)+1);if(r.endsWith(".mjs")){if(e){let o=await import("node:path"),i=await import("node:url");!r.includes("://")&&o.isAbsolute(r)&&(r=i.pathToFileURL(r).href)}return{scriptURL:r,pyodideIndexURL:s,isESModule:!0}}else return{scriptURL:r,pyodideIndexURL:s,isESModule:!1}}async function ne(r,e){let{scriptURL:t,pyodideIndexURL:s,isESModule:o}=await xe(r),i;return o?i=(await import(t)).loadPyodide:(importScripts(t),i=self.loadPyodide),i({...e,indexURL:s})}function j(r){r.runPython(`
1
+ var me=Object.create;var K=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var ye=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty;var I=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var ve=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of _e(e))!he.call(r,o)&&o!==t&&K(r,o,{get:()=>e[o],enumerable:!(s=pe(e,o))||s.enumerable});return r};var M=(r,e,t)=>(t=r!=null?me(ye(r)):{},ve(e||!r||!r.__esModule?K(t,"default",{value:r,enumerable:!0}):t,r));var V=I(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.validateRequirements=void 0;var Pe="[",be="(<=>!~",Se=";",we="@",ke=new RegExp(`[${Pe+be+Se+we}]`);function Ae(r){return r.split(ke)[0].trim()}function Re(r){return r.forEach(t=>{let s;try{s=new URL(t)}catch{return}if(s.protocol==="emfs:"||s.protocol==="file:")throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${t})`)}),r.filter(t=>Ae(t)==="streamlit"?(console.warn(`Streamlit is specified in the requirements ("${t}"), but it will be ignored. A built-in version of Streamlit will be used.`),!1):!0)}C.validateRequirements=Re});var X=I(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.parseRequirementsTxt=void 0;var Fe=/\s#.*$/;function Ie(r){return r.split(`
2
+ `).filter(e=>!e.startsWith("#")).map(e=>e.replace(Fe,"")).map(e=>e.trim()).filter(e=>e!=="")}T.parseRequirementsTxt=Ie});var G=I(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.PromiseDelegate=void 0;var U=class{constructor(){this.promise=new Promise((e,t)=>{this.resolveInternal=e,this.rejectInternal=t})}resolve(e){this.resolveInternal(e)}reject(e){this.rejectInternal(e)}};N.PromiseDelegate=U});var Q=I(b=>{"use strict";var Me=b&&b.__createBinding||(Object.create?function(r,e,t,s){s===void 0&&(s=t);var o=Object.getOwnPropertyDescriptor(e,t);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,s,o)}:function(r,e,t,s){s===void 0&&(s=t),r[s]=e[t]}),x=b&&b.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Me(e,r,t)};Object.defineProperty(b,"__esModule",{value:!0});x(V(),b);x(X(),b);x(G(),b)});var ee=I((Ve,Z)=>{"use strict";function v(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}function Y(r,e){for(var t="",s=0,o=-1,i=0,n,a=0;a<=r.length;++a){if(a<r.length)n=r.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(o===a-1||i===1))if(o!==a-1&&i===2){if(t.length<2||s!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var d=t.lastIndexOf("/");if(d!==t.length-1){d===-1?(t="",s=0):(t=t.slice(0,d),s=t.length-1-t.lastIndexOf("/")),o=a,i=0;continue}}else if(t.length===2||t.length===1){t="",s=0,o=a,i=0;continue}}e&&(t.length>0?t+="/..":t="..",s=2)}else t.length>0?t+="/"+r.slice(o+1,a):t=r.slice(o+1,a),s=a-o-1;o=a,i=0}else n===46&&i!==-1?++i:i=-1}return t}function Oe(r,e){var t=e.dir||e.root,s=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+s:t+r+s:s}var A={resolve:function(){for(var e="",t=!1,s,o=arguments.length-1;o>=-1&&!t;o--){var i;o>=0?i=arguments[o]:(s===void 0&&(s=process.cwd()),i=s),v(i),i.length!==0&&(e=i+"/"+e,t=i.charCodeAt(0)===47)}return e=Y(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(v(e),e.length===0)return".";var t=e.charCodeAt(0)===47,s=e.charCodeAt(e.length-1)===47;return e=Y(e,!t),e.length===0&&!t&&(e="."),e.length>0&&s&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return v(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var s=arguments[t];v(s),s.length>0&&(e===void 0?e=s:e+="/"+s)}return e===void 0?".":A.normalize(e)},relative:function(e,t){if(v(e),v(t),e===t||(e=A.resolve(e),t=A.resolve(t),e===t))return"";for(var s=1;s<e.length&&e.charCodeAt(s)===47;++s);for(var o=e.length,i=o-s,n=1;n<t.length&&t.charCodeAt(n)===47;++n);for(var a=t.length,d=a-n,f=i<d?i:d,g=-1,l=0;l<=f;++l){if(l===f){if(d>f){if(t.charCodeAt(n+l)===47)return t.slice(n+l+1);if(l===0)return t.slice(n+l)}else i>f&&(e.charCodeAt(s+l)===47?g=l:l===0&&(g=0));break}var k=e.charCodeAt(s+l),_=t.charCodeAt(n+l);if(k!==_)break;k===47&&(g=l)}var c="";for(l=s+g+1;l<=o;++l)(l===o||e.charCodeAt(l)===47)&&(c.length===0?c+="..":c+="/..");return c.length>0?c+t.slice(n+g):(n+=g,t.charCodeAt(n)===47&&++n,t.slice(n))},_makeLong:function(e){return e},dirname:function(e){if(v(e),e.length===0)return".";for(var t=e.charCodeAt(0),s=t===47,o=-1,i=!0,n=e.length-1;n>=1;--n)if(t=e.charCodeAt(n),t===47){if(!i){o=n;break}}else i=!1;return o===-1?s?"/":".":s&&o===1?"//":e.slice(0,o)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');v(e);var s=0,o=-1,i=!0,n;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,d=-1;for(n=e.length-1;n>=0;--n){var f=e.charCodeAt(n);if(f===47){if(!i){s=n+1;break}}else d===-1&&(i=!1,d=n+1),a>=0&&(f===t.charCodeAt(a)?--a===-1&&(o=n):(a=-1,o=d))}return s===o?o=d:o===-1&&(o=e.length),e.slice(s,o)}else{for(n=e.length-1;n>=0;--n)if(e.charCodeAt(n)===47){if(!i){s=n+1;break}}else o===-1&&(i=!1,o=n+1);return o===-1?"":e.slice(s,o)}},extname:function(e){v(e);for(var t=-1,s=0,o=-1,i=!0,n=0,a=e.length-1;a>=0;--a){var d=e.charCodeAt(a);if(d===47){if(!i){s=a+1;break}continue}o===-1&&(i=!1,o=a+1),d===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||o===-1||n===0||n===1&&t===o-1&&t===s+1?"":e.slice(t,o)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return Oe("/",e)},parse:function(e){v(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var s=e.charCodeAt(0),o=s===47,i;o?(t.root="/",i=1):i=0;for(var n=-1,a=0,d=-1,f=!0,g=e.length-1,l=0;g>=i;--g){if(s=e.charCodeAt(g),s===47){if(!f){a=g+1;break}continue}d===-1&&(f=!1,d=g+1),s===46?n===-1?n=g:l!==1&&(l=1):n!==-1&&(l=-1)}return n===-1||d===-1||l===0||l===1&&n===d-1&&n===a+1?d!==-1&&(a===0&&o?t.base=t.name=e.slice(1,d):t.base=t.name=e.slice(a,d)):(a===0&&o?(t.name=e.slice(1,n),t.base=e.slice(1,d)):(t.name=e.slice(a,n),t.base=e.slice(a,d)),t.ext=e.slice(n,d)),a>0?t.dir=e.slice(0,a-1):o&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};A.posix=A;Z.exports=A});var W=require("node:worker_threads");var ae=M(Q());var q=M(ee());function te(r,e){let t=q.default.normalize(e),o=q.default.dirname(t).split("/"),i=[];for(let n of o){i.push(n);let a=i.join("/");if(r.FS.analyzePath(a).exists){if(r.FS.isDir(a))throw new Error(`"${a}" already exists and is not a directory.`);continue}try{r.FS.mkdir(a)}catch(d){throw console.error(`Failed to create a directory "${a}"`),d}}}function H(r,e,t,s){te(r,e),r.FS.writeFile(e,t,s)}function re(r,e,t){te(r,t),r.FS.rename(e,t)}var Le="[",Ee="(<=>!~",Ce=";",Te="@",Ne=new RegExp(`[${Le+Ee+Ce+Te}]`);function De(r){return r.split(Ne)[0].trim()}function $(r){return r.forEach(t=>{let s;try{s=new URL(t)}catch{return}if(s.protocol==="emfs:"||s.protocol==="file:")throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${t})`)}),r.filter(t=>De(t)==="streamlit"?(console.warn(`Streamlit is specified in the requirements ("${t}"), but it will be ignored. A built-in version of Streamlit will be used.`),!1):!0)}async function Ue(r){let e=typeof process<"u"&&process.versions?.node,t;e?t=(await import("node:path")).sep:t="/";let s=r.slice(0,r.lastIndexOf(t)+1);if(r.endsWith(".mjs")){if(e){let o=await import("node:path"),i=await import("node:url");!r.includes("://")&&o.isAbsolute(r)&&(r=i.pathToFileURL(r).href)}return{scriptURL:r,pyodideIndexURL:s,isESModule:!0}}else return{scriptURL:r,pyodideIndexURL:s,isESModule:!1}}async function oe(r,e){let{scriptURL:t,pyodideIndexURL:s,isESModule:o}=await Ue(r),i;return o?i=(await import(t)).loadPyodide:(importScripts(t),i=self.loadPyodide),i({...e,indexURL:s})}function se(r){r.runPython(`
3
3
  import micropip
4
4
  micropip.add_mock_package(
5
5
  "pyarrow", "0.0.1",
@@ -25,7 +25,7 @@ class ChunkedArray:
25
25
  """
26
26
  }
27
27
  )
28
- `)}var W;function qe(r,e){return W||(r.runPython(`
28
+ `)}var j;function xe(r,e){return j||(r.runPython(`
29
29
  import ast
30
30
  from textwrap import dedent
31
31
 
@@ -48,19 +48,12 @@ def find_imports(source: str) -> list[str]:
48
48
  continue
49
49
  imports.add(module_name.split(".")[0])
50
50
  return imports
51
- `),W=r.globals.get("find_imports")),W(e).toJs()}function $e(r){let e=new Set;for(let t of r)for(let s of t)e.add(s);return e}async function ie(r,e,t){let s=t.map(g=>qe(r,g)),o=$e(s),a=Array.from(o).filter(g=>!r.runPython(`__import__('importlib').util.find_spec('${g}')`)).map(g=>r._api._import_name_to_package_name.get(g)).filter(g=>g);if(a.length===0)return;let c=new MessageChannel;e({type:"event:moduleAutoLoad",data:{packagesToLoad:a}},c.port2);try{let g=await r.loadPackage(a);c.port1.postMessage({type:"moduleAutoLoad:success",data:{loadedPackages:g}}),c.port1.close();return}catch(g){throw c.port1.postMessage({type:"moduleAutoLoad:error",error:g}),c.port1.close(),g}}var D=global;function ae(r,e,t){let s=ie(r,e,t);D.__moduleAutoLoadPromise__=s,r.runPythonAsync(`
51
+ `),j=r.globals.get("find_imports")),j(e).toJs()}function qe(r){let e=new Set;for(let t of r)for(let s of t)e.add(s);return e}async function ne(r,e,t){let s=t.map(f=>xe(r,f)),o=qe(s),a=Array.from(o).filter(f=>!r.runPython(`__import__('importlib').util.find_spec('${f}')`)).map(f=>r._api._import_name_to_package_name.get(f)).filter(f=>f);if(a.length===0)return;let d=new MessageChannel;e({type:"event:moduleAutoLoad",data:{packagesToLoad:a}},d.port2);try{let f=await r.loadPackage(a);d.port1.postMessage({type:"moduleAutoLoad:success",data:{loadedPackages:f}}),d.port1.close();return}catch(f){throw d.port1.postMessage({type:"moduleAutoLoad:error",error:f}),d.port1.close(),f}}var D=global;function ie(r,e,t){let s=ne(r,e,t);D.__moduleAutoLoadPromise__=s,r.runPythonAsync(`
52
52
  from streamlit.runtime.scriptrunner import script_runner
53
53
  from js import __moduleAutoLoadPromise__
54
54
 
55
55
  script_runner.moduleAutoLoadPromise = __moduleAutoLoadPromise__
56
- `)}function ce(r,e,t){function s(f){e({type:"event:progress",data:{message:f}})}let o,i,n=new le.PromiseDelegate;async function a(){let f=await n.promise,l={...t,...f};console.debug("Initial data",l);let{entrypoint:S,files:_,archives:d,requirements:p,prebuiltPackageNames:y,wheels:h,mountedSitePackagesSnapshotFilePath:v,pyodideUrl:k=r,streamlitConfig:A,idbfsMountpoints:O,nodefsMountpoints:z,moduleAutoLoad:ue}=l,E=H(p);s("Loading Pyodide."),console.debug("Loading Pyodide"),o=await ne(k,{stdout:console.log,stderr:console.error}),console.debug("Loaded Pyodide");let J=!1;O&&(J=!0,O.forEach(u=>{o.FS.mkdir(u),o.FS.mount(o.FS.filesystems.IDBFS,{},u)}),await new Promise((u,m)=>{o.FS.syncfs(!0,b=>{b?m(b):u()})})),z&&Object.entries(z).forEach(([u,m])=>{o.FS.mkdir(u),o.FS.mount(o.FS.filesystems.NODEFS,{root:m},u)}),s("Mounting files.");let K=[];if(await Promise.all(Object.keys(_).map(async u=>{let m=_[u],b;"url"in m?(console.debug(`Fetch a file from ${m.url}`),b=await fetch(m.url).then(F=>F.arrayBuffer()).then(F=>new Uint8Array(F))):b=m.data;let{opts:L}=_[u];console.debug(`Write a file "${u}"`),$(o,u,b,L),u.endsWith(".py")&&K.push(u)})),s("Unpacking archives."),await Promise.all(d.map(async u=>{let m;"url"in u?(console.debug(`Fetch an archive from ${u.url}`),m=await fetch(u.url).then(F=>F.arrayBuffer())):m=u.buffer;let{format:b,options:L}=u;console.debug("Unpack an archive",{format:b,options:L}),o.unpackArchive(m,b,L)})),!v&&!h)throw new Error("Neither snapshot nor wheel files are provided.");v&&(s("Restoring the snapshot."),await o.runPythonAsync("import tarfile, shutil, site"),await o.runPythonAsync(`
57
- site_packages_dirs = site.getsitepackages()
58
- for site_packages in site_packages_dirs:
59
- shutil.rmtree(site_packages)
60
- `),console.debug(`Unarchive ${v}`),await o.runPythonAsync(`
61
- with tarfile.open("${v}", "r") as tar_gz_file:
62
- tar_gz_file.extractall("/")
63
- `),console.debug("Restored the snapshot"),s("Mocking some packages."),console.debug("Mock pyarrow"),j(o),console.debug("Mocked pyarrow")),s("Installing packages."),console.debug("Installing the prebuilt packages:",y),await o.loadPackage(y),console.debug("Installed the prebuilt packages"),await o.loadPackage("micropip");let V=o.pyimport("micropip");if(h?(console.debug("Installing the wheels:",h,"and the requirements:",E),await V.install.callKwargs([h.stliteServer,h.streamlit,...E],{keep_going:!0}),console.debug("Installed the wheels and the requirements"),s("Mocking some packages."),console.debug("Mock pyarrow"),j(o),console.debug("Mocked pyarrow")):(console.debug("Installing the requirements:",E),await V.install.callKwargs(E,{keep_going:!0}),console.debug("Installed the requirements")),ue){let u=K.map(m=>o.FS.readFile(m,{encoding:"utf8"}));ae(o,e,u)}await o.runPythonAsync(`
56
+ `)}function le(r,e,t){function s(g){e({type:"event:progress",data:{message:g}})}let o,i,n=new ae.PromiseDelegate;async function a(){let g=await n.promise,l={...t,...g};console.debug("Initial data",l);let{entrypoint:k,files:_,archives:c,requirements:p,prebuiltPackageNames:y,wheels:h,pyodideUrl:w=r,streamlitConfig:S,idbfsMountpoints:R,nodefsMountpoints:O,moduleAutoLoad:ce}=l,L=$(p);s("Loading Pyodide."),console.debug("Loading Pyodide"),o=await oe(w,{stdout:console.log,stderr:console.error}),console.debug("Loaded Pyodide");let B=!1;R&&(B=!0,R.forEach(u=>{o.FS.mkdir(u),o.FS.mount(o.FS.filesystems.IDBFS,{},u)}),await new Promise((u,m)=>{o.FS.syncfs(!0,P=>{P?m(P):u()})})),O&&Object.entries(O).forEach(([u,m])=>{o.FS.mkdir(u),o.FS.mount(o.FS.filesystems.NODEFS,{root:m},u)}),s("Mounting files.");let z=[];await Promise.all(Object.keys(_).map(async u=>{let m=_[u],P;"url"in m?(console.debug(`Fetch a file from ${m.url}`),P=await fetch(m.url).then(F=>F.arrayBuffer()).then(F=>new Uint8Array(F))):P=m.data;let{opts:E}=_[u];console.debug(`Write a file "${u}"`),H(o,u,P,E),u.endsWith(".py")&&z.push(u)})),s("Unpacking archives."),await Promise.all(c.map(async u=>{let m;"url"in u?(console.debug(`Fetch an archive from ${u.url}`),m=await fetch(u.url).then(F=>F.arrayBuffer())):m=u.buffer;let{format:P,options:E}=u;console.debug("Unpack an archive",{format:P,options:E}),o.unpackArchive(m,P,E)})),await o.loadPackage("micropip");let J=o.pyimport("micropip");if(s("Mocking some packages."),console.debug("Mock pyarrow"),se(o),console.debug("Mocked pyarrow"),s("Installing packages."),console.debug("Installing the prebuilt packages:",y),await o.loadPackage(y),console.debug("Installed the prebuilt packages"),h?(console.debug("Installing the wheels:",h,"and the requirements:",L),await J.install.callKwargs([h.stliteLib,h.streamlit,...L],{keep_going:!0}),console.debug("Installed the wheels and the requirements")):(console.debug("Installing the requirements:",L),await J.install.callKwargs(L,{keep_going:!0}),console.debug("Installed the requirements")),ce){let u=z.map(m=>o.FS.readFile(m,{encoding:"utf8"}));ie(o,e,u)}await o.runPythonAsync(`
64
57
  import importlib
65
58
  importlib.invalidate_caches()
66
59
  `),s("Loading streamlit package."),console.debug("Loading the Streamlit package"),await o.runPythonAsync(`
@@ -83,7 +76,7 @@ for name in streamlit.logger._loggers.keys():
83
76
  logger.setLevel(logging.NOTSET)
84
77
 
85
78
  streamlit.logger._loggers = {}
86
- `);let ge=(u,m)=>{u>=40?console.error(m):u>=30?console.warn(m):u>=20?console.info(m):console.debug(m)};D.__logCallback__=ge,await o.runPythonAsync(`
79
+ `);let ue=(u,m)=>{u>=40?console.error(m):u>=30?console.warn(m):u>=20?console.info(m):console.debug(m)};D.__logCallback__=ue,await o.runPythonAsync(`
87
80
  def setup_loggers(streamlit_level, streamlit_message_format):
88
81
  from js import __logCallback__
89
82
 
@@ -112,14 +105,14 @@ def setup_loggers(streamlit_level, streamlit_message_format):
112
105
  streamlit_handler.setFormatter(streamlit_formatter)
113
106
  streamlit_logger.addHandler(streamlit_handler)
114
107
  streamlit_logger.setLevel(streamlit_level.upper())
115
- `);let fe=(A?.["logger.level"]??"INFO").toString(),me=A?.["logger.messageFormat"]??"%(asctime)s %(message)s";if(o.globals.get("setup_loggers")(fe,me),console.debug("Set the loggers"),s("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),await o.runPythonAsync(`
108
+ `);let fe=(S?.["logger.level"]??"INFO").toString(),ge=S?.["logger.messageFormat"]??"%(asctime)s %(message)s";if(o.globals.get("setup_loggers")(fe,ge),console.debug("Set the loggers"),s("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),await o.runPythonAsync(`
116
109
  import streamlit
117
110
 
118
111
  def is_cacheable_msg(msg):
119
112
  return False
120
113
 
121
114
  streamlit.runtime.runtime.is_cacheable_msg = is_cacheable_msg
122
- `),console.debug("Mocked some Streamlit functions"),J){s("Setting up the IndexedDB filesystem synchronizer."),console.debug("Setting up the IndexedDB filesystem synchronizer");let u=!1;D.__scriptFinishedCallback__=()=>{console.debug("The script has finished. Syncing the filesystem."),u||(u=!0,o.FS.syncfs(!1,m=>{u=!1,m&&console.error(m)}))},await o.runPythonAsync(`
115
+ `),console.debug("Mocked some Streamlit functions"),B){s("Setting up the IndexedDB filesystem synchronizer."),console.debug("Setting up the IndexedDB filesystem synchronizer");let u=!1;D.__scriptFinishedCallback__=()=>{console.debug("The script has finished. Syncing the filesystem."),u||(u=!0,o.FS.syncfs(!1,m=>{u=!1,m&&console.error(m)}))},await o.runPythonAsync(`
123
116
  from streamlit.runtime.app_session import AppSession
124
117
  from streamlit.runtime.scriptrunner import ScriptRunnerEvent
125
118
  from js import __scriptFinishedCallback__
@@ -134,19 +127,19 @@ def wrap_app_session_on_scriptrunner_event(original_method):
134
127
  return wrapped
135
128
 
136
129
  AppSession._on_scriptrunner_event = wrap_app_session_on_scriptrunner_event(AppSession._on_scriptrunner_event)
137
- `),console.debug("Set up the IndexedDB filesystem synchronizer")}return s("Booting up the Streamlit server."),console.debug("Booting up the Streamlit server"),D.__streamlitFlagOptions__={"browser.gatherUsageStats":!1,...A,"runner.fastReruns":!1},await o.runPythonAsync(`
138
- from stlite_server.bootstrap import load_config_options, prepare
139
- from stlite_server.server import Server
130
+ `),console.debug("Set up the IndexedDB filesystem synchronizer")}return s("Booting up the Streamlit server."),console.debug("Booting up the Streamlit server"),D.__streamlitFlagOptions__={"browser.gatherUsageStats":!1,...S,"runner.fastReruns":!1},await o.runPythonAsync(`
131
+ from stlite_lib.bootstrap import load_config_options, prepare
132
+ from stlite_lib.server import Server
140
133
  from js import __streamlitFlagOptions__
141
134
 
142
135
  flag_options = __streamlitFlagOptions__.to_py()
143
136
  load_config_options(flag_options)
144
137
 
145
- main_script_path = "${S}"
138
+ main_script_path = "${k}"
146
139
  args = []
147
140
 
148
141
  prepare(main_script_path, args)
149
142
 
150
143
  server = Server(main_script_path)
151
144
  server.start()
152
- `),console.debug("Booted up the Streamlit server"),console.debug("Setting up the HTTP server"),i=o.globals.get("server").copy(),console.debug("Set up the HTTP server"),e({type:"event:loaded"}),l}let c=a().catch(f=>{throw e({type:"event:error",data:{error:f}}),f}),g=async f=>{let l=f.data;if(l.type==="initData"){n.resolve(l.data);return}let{moduleAutoLoad:S}=await c,_=f.ports[0];try{switch(l.type){case"websocket:connect":{console.debug("websocket:connect",l.data);let{path:d}=l.data;i.start_websocket(d,(p,y)=>{if(y){let h=p,v=h.getBuffer("u8");h.destroy();let k=new Uint8ClampedArray(v.data.buffer,v.data.byteOffset,v.data.byteLength);e({type:"websocket:message",data:{payload:new Uint8Array(k)}})}else e({type:"websocket:message",data:{payload:p}})}),_.postMessage({type:"reply"});break}case"websocket:send":{console.debug("websocket:send",l.data);let{payload:d}=l.data;i.receive_websocket_from_js(d);break}case"http:request":{console.debug("http:request",l.data);let{request:d}=l.data,p=(y,h,v)=>{let k=new Map(h.toJs()),A=v.toJs();console.debug({statusCode:y,headers:k,body:A});let O={type:"http:response",data:{response:{statusCode:y,headers:k,body:A}}};_.postMessage(O)};i.receive_http_from_js(d.method,decodeURIComponent(d.path),d.headers,d.body,p);break}case"file:write":{let{path:d,data:p,opts:y}=l.data;S&&typeof p=="string"&&d.endsWith(".py")&&(console.debug(`Auto install the requirements in ${d}`),ae(o,e,[p])),console.debug(`Write a file "${d}"`),$(o,d,p,y),_.postMessage({type:"reply"});break}case"file:rename":{let{oldPath:d,newPath:p}=l.data;console.debug(`Rename "${d}" to ${p}`),se(o,d,p),_.postMessage({type:"reply"});break}case"file:unlink":{let{path:d}=l.data;console.debug(`Remove "${d}`),o.FS.unlink(d),_.postMessage({type:"reply"});break}case"install":{let{requirements:d}=l.data,p=o.pyimport("micropip"),y=H(d);console.debug("Install the requirements:",y),await p.install.callKwargs(y,{keep_going:!0}).then(()=>{console.debug("Successfully installed"),_.postMessage({type:"reply"})})}}}catch(d){if(console.error(d),!(d instanceof Error))throw d;let p=new Error(d.message);p.name=d.name,p.stack=d.stack,_.postMessage({type:"reply",error:p})}};return e({type:"event:start"}),g}function de(){let r=process.env.NODEFS_MOUNTPOINTS;if(!r)return;let e;try{e=JSON.parse(r)}catch{console.error(`Failed to parse NODEFS_MOUNTPOINTS as JSON: ${r}`);return}if(typeof e!="object"){console.error(`NODEFS_MOUNTPOINTS is not an object: ${r}`);return}if(Array.isArray(e)){console.error(`NODEFS_MOUNTPOINTS is an array: ${r}`);return}if(Object.keys(e).some(t=>typeof t!="string")){console.error(`NODEFS_MOUNTPOINTS has non-string keys: ${r}`);return}if(Object.values(e).some(t=>typeof t!="string")){console.error(`NODEFS_MOUNTPOINTS has non-string values: ${r}`);return}return e}var He=r=>{console.debug("[worker thread] postMessage from worker",r),B.parentPort?.postMessage(r)},je=ce(process.env.PYODIDE_URL,He,{nodefsMountpoints:de()});B.parentPort?.on("message",({data:r,port:e})=>{console.debug("[worker thread] parentPort.onMessage",{data:r,port:e}),je({data:r,ports:[e]})});
145
+ `),console.debug("Booted up the Streamlit server"),console.debug("Setting up the HTTP server"),i=o.globals.get("server").copy(),console.debug("Set up the HTTP server"),e({type:"event:loaded"}),l}let d=a().catch(g=>{throw e({type:"event:error",data:{error:g}}),g}),f=async g=>{let l=g.data;if(l.type==="initData"){n.resolve(l.data);return}let{moduleAutoLoad:k}=await d,_=g.ports[0];try{switch(l.type){case"websocket:connect":{console.debug("websocket:connect",l.data);let{path:c}=l.data;i.start_websocket(c,(p,y)=>{if(y){let h=p,w=h.getBuffer("u8");h.destroy();let S=new Uint8ClampedArray(w.data.buffer,w.data.byteOffset,w.data.byteLength);e({type:"websocket:message",data:{payload:new Uint8Array(S)}})}else e({type:"websocket:message",data:{payload:p}})}),_.postMessage({type:"reply"});break}case"websocket:send":{console.debug("websocket:send",l.data);let{payload:c}=l.data;i.receive_websocket_from_js(c);break}case"http:request":{console.debug("http:request",l.data);let{request:c}=l.data,p=(y,h,w)=>{let S=new Map(h.toJs()),R=w.toJs();console.debug({statusCode:y,headers:S,body:R});let O={type:"http:response",data:{response:{statusCode:y,headers:S,body:R}}};_.postMessage(O)};i.receive_http_from_js(c.method,decodeURIComponent(c.path),c.headers,c.body,p);break}case"file:write":{let{path:c,data:p,opts:y}=l.data;k&&typeof p=="string"&&c.endsWith(".py")&&(console.debug(`Auto install the requirements in ${c}`),ie(o,e,[p])),console.debug(`Write a file "${c}"`),H(o,c,p,y),_.postMessage({type:"reply"});break}case"file:rename":{let{oldPath:c,newPath:p}=l.data;console.debug(`Rename "${c}" to ${p}`),re(o,c,p),_.postMessage({type:"reply"});break}case"file:unlink":{let{path:c}=l.data;console.debug(`Remove "${c}`),o.FS.unlink(c),_.postMessage({type:"reply"});break}case"install":{let{requirements:c}=l.data,p=o.pyimport("micropip"),y=$(c);console.debug("Install the requirements:",y),await p.install.callKwargs(y,{keep_going:!0}).then(()=>{console.debug("Successfully installed"),_.postMessage({type:"reply"})})}}}catch(c){if(console.error(c),!(c instanceof Error))throw c;let p=new Error(c.message);p.name=c.name,p.stack=c.stack,_.postMessage({type:"reply",error:p})}};return e({type:"event:start"}),f}function de(){let r=process.env.NODEFS_MOUNTPOINTS;if(!r)return;let e;try{e=JSON.parse(r)}catch{console.error(`Failed to parse NODEFS_MOUNTPOINTS as JSON: ${r}`);return}if(typeof e!="object"){console.error(`NODEFS_MOUNTPOINTS is not an object: ${r}`);return}if(Array.isArray(e)){console.error(`NODEFS_MOUNTPOINTS is an array: ${r}`);return}if(Object.keys(e).some(t=>typeof t!="string")){console.error(`NODEFS_MOUNTPOINTS has non-string keys: ${r}`);return}if(Object.values(e).some(t=>typeof t!="string")){console.error(`NODEFS_MOUNTPOINTS has non-string values: ${r}`);return}return e}var He=r=>{console.debug("[worker thread] postMessage from worker",r),W.parentPort?.postMessage(r)},$e=le(process.env.PYODIDE_URL,He,{nodefsMountpoints:de()});W.parentPort?.on("message",({data:r,port:e})=>{console.debug("[worker thread] parentPort.onMessage",{data:r,port:e}),$e({data:r,ports:[e]})});
package/build/index.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>stlite</title><script defer="defer" src="/static/js/main.eea22731.js"></script><link href="/static/css/main.6fb7674e.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>stlite</title><script defer="defer" src="/static/js/main.53e797b7.js"></script><link href="/static/css/main.fc8432ac.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>