@equinor/fusion-framework-cli 13.0.1 → 13.1.1
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.
- package/CHANGELOG.md +67 -0
- package/README.md +25 -0
- package/bin/build/bin.mjs +1 -1
- package/bin/build/cli.mjs +3 -3
- package/dist/esm/lib/app/create-app-manifest.js +5 -2
- package/dist/esm/lib/app/create-app-manifest.js.map +1 -1
- package/dist/esm/lib/utils/index.js +1 -0
- package/dist/esm/lib/utils/index.js.map +1 -1
- package/dist/esm/lib/utils/snapshot.js +40 -0
- package/dist/esm/lib/utils/snapshot.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/bin/app-build.d.ts +5 -1
- package/dist/types/bin/app-manifest.d.ts +10 -1
- package/dist/types/bin/app-pack.d.ts +11 -3
- package/dist/types/bin/app-tag.d.ts +3 -16
- package/dist/types/bin/helpers/resolve-app-manifest.d.ts +1 -0
- package/dist/types/bin/index.d.ts +1 -1
- package/dist/types/cli/commands/app/pack.d.ts +6 -0
- package/dist/types/cli/commands/app/publish.d.ts +7 -1
- package/dist/types/cli/commands/app/tag.d.ts +2 -1
- package/dist/types/cli/commands/portal/publish.d.ts +2 -1
- package/dist/types/cli/commands/portal/tag.d.ts +1 -1
- package/dist/types/lib/app/create-app-manifest.d.ts +3 -1
- package/dist/types/lib/utils/index.d.ts +1 -0
- package/dist/types/lib/utils/snapshot.d.ts +26 -0
- package/dist/types/version.d.ts +1 -1
- package/docs/ai-commands.md +2 -2
- package/docs/dev-server-config.md +10 -0
- package/package.json +17 -15
package/bin/build/bin.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{loadConfigFromFile as e,mergeConfig as t,build as n}from"vite";import r from"vite-tsconfig-paths";import{dirname as i,resolve as o,basename as s,extname as a,relative as c}from"node:path";import{readPackageUp as l}from"read-package-up";import u,{fileURLToPath as f}from"node:url";import p from"url";import d from"node:module";import h from"util";import{accessSync as m,constants as g,readFileSync as v,statSync as y,existsSync as E,mkdirSync as b,writeFileSync as w}from"node:fs";import{stat as L,mkdir as S}from"node:fs/promises";import{importConfig as C,FileNotFoundError as I}from"@equinor/fusion-imports";import _ from"deepmerge";import D from"node:assert";import{execSync as O}from"node:child_process";import N,{z as A}from"zod";import P from"fs";import T from"path";import R from"zlib";import $ from"crypto";import x from"ora";import{createDevServer as k,processServices as F}from"@equinor/fusion-framework-dev-server";import{enableAuthModule as U}from"@equinor/fusion-framework-module-msal-node";const B=(e=0)=>t=>`[${t+e}m`,M=(e=0)=>t=>`[${38+e};5;${t}m`,G=(e=0)=>(t,n,r)=>`[${38+e};2;${t};${n};${r}m`,j={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(j.modifier);Object.keys(j.color),Object.keys(j.bgColor);const z=function(){const e=new Map;for(const[t,n]of Object.entries(j)){for(const[t,r]of Object.entries(n))j[t]={open:`[${r[0]}m`,close:`[${r[1]}m`},n[t]=j[t],e.set(r[0],r[1]);Object.defineProperty(j,t,{value:n,enumerable:!1})}return Object.defineProperty(j,"codes",{value:e,enumerable:!1}),j.color.close="[39m",j.bgColor.close="[49m",j.color.ansi=B(),j.color.ansi256=M(),j.color.ansi16m=G(),j.bgColor.ansi=B(10),j.bgColor.ansi256=M(10),j.bgColor.ansi16m=G(10),Object.defineProperties(j,{rgbToAnsi256:{value:(e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;3===n.length&&(n=[...n].map(e=>e+e).join(""));const r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,255&r]},enumerable:!1},hexToAnsi256:{value:e=>j.rgbToAnsi256(...j.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,n,r;if(e>=232)t=(10*(e-232)+8)/255,n=t,r=t;else{const i=(e-=16)%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}const i=2*Math.max(t,n,r);if(0===i)return 30;let o=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return 2===i&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>j.ansi256ToAnsi(j.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>j.ansi256ToAnsi(j.hexToAnsi256(e)),enumerable:!1}}),j}(),H=(()=>{if(!("navigator"in globalThis))return 0;if(globalThis.navigator.userAgentData){const e=navigator.userAgentData.brands.find(({brand:e})=>"Chromium"===e);if(e&&e.version>93)return 3}return/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)?1:0})(),q=0!==H&&{level:H},V={stdout:q,stderr:q};function W(e,t,n){let r=e.indexOf(t);if(-1===r)return e;const i=t.length;let o=0,s="";do{s+=e.slice(o,r)+t+n,o=r+i,r=e.indexOf(t,o)}while(-1!==r);return s+=e.slice(o),s}const{stdout:Y,stderr:K}=V,X=Symbol("GENERATOR"),Z=Symbol("STYLER"),J=Symbol("IS_EMPTY"),Q=["ansi","ansi","ansi256","ansi16m"],ee=Object.create(null),te=e=>{const t=(...e)=>e.join(" ");return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const n=Y?Y.level:0;e.level=void 0===t.level?n:t.level})(t,e),Object.setPrototypeOf(t,ne.prototype),t};function ne(e){return te(e)}Object.setPrototypeOf(ne.prototype,Function.prototype);for(const[e,t]of Object.entries(z))ee[e]={get(){const n=ae(this,se(t.open,t.close,this[Z]),this[J]);return Object.defineProperty(this,e,{value:n}),n}};ee.visible={get(){const e=ae(this,this[Z],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const re=(e,t,n,...r)=>"rgb"===e?"ansi16m"===t?z[n].ansi16m(...r):"ansi256"===t?z[n].ansi256(z.rgbToAnsi256(...r)):z[n].ansi(z.rgbToAnsi(...r)):"hex"===e?re("rgb",t,n,...z.hexToRgb(...r)):z[n][e](...r),ie=["rgb","hex","ansi256"];for(const e of ie){ee[e]={get(){const{level:t}=this;return function(...n){const r=se(re(e,Q[t],"color",...n),z.color.close,this[Z]);return ae(this,r,this[J])}}};ee["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...n){const r=se(re(e,Q[t],"bgColor",...n),z.bgColor.close,this[Z]);return ae(this,r,this[J])}}}}const oe=Object.defineProperties(()=>{},{...ee,level:{enumerable:!0,get(){return this[X].level},set(e){this[X].level=e}}}),se=(e,t,n)=>{let r,i;return void 0===n?(r=e,i=t):(r=n.openAll+e,i=t+n.closeAll),{open:e,close:t,openAll:r,closeAll:i,parent:n}},ae=(e,t,n)=>{const r=(...e)=>ce(r,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(r,oe),r[X]=e,r[Z]=t,r[J]=n,r},ce=(e,t)=>{if(e.level<=0||!t)return e[J]?"":t;let n=e[Z];if(void 0===n)return t;const{openAll:r,closeAll:i}=n;if(t.includes(""))for(;void 0!==n;)t=W(t,n.close,n.open),n=n.parent;const o=t.indexOf("\n");return-1!==o&&(t=function(e,t,n,r){let i=0,o="";do{const s="\r"===e[r-1];o+=e.slice(i,s?r-1:r)+t+(s?"\r\n":"\n")+n,i=r+1,r=e.indexOf("\n",i)}while(-1!==r);return o+=e.slice(i),o}(t,i,r,o)),r+t+i};Object.defineProperties(ne.prototype,ee);const le=ne();function ue(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fe,pe,de,he;function me(){if(pe)return fe;pe=1;const e="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};return fe=e}function ge(){if(he)return de;he=1;const e=Number.MAX_SAFE_INTEGER||9007199254740991;return de={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:e,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}ne({level:K?K.level:0});var ve,ye,Ee,be,we,Le,Se,Ce,Ie,_e,De,Oe,Ne,Ae={exports:{}};function Pe(){return ve||(ve=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=ge(),o=me(),s=(t=e.exports={}).re=[],a=t.safeRe=[],c=t.src=[],l=t.safeSrc=[],u=t.t={};let f=0;const p="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",i],[p,r]],h=(e,t,n)=>{const r=(e=>{for(const[t,n]of d)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),i=f++;o(e,i,t),u[e]=i,c[i]=t,l[i]=r,s[i]=new RegExp(t,n?"g":void 0),a[i]=new RegExp(r,n?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),h("MAINVERSION",`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASE",`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${p}+`),h("BUILD",`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h("FULL",`^${c[u.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h("LOOSE",`^${c[u.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h("XRANGE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h("COERCE",`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h("COERCEFULL",c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?`+`(?:${c[u.BUILD]})?(?:$|[^\\d])`),h("COERCERTL",c[u.COERCE],!0),h("COERCERTLFULL",c[u.COERCEFULL],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(Ae,Ae.exports)),Ae.exports}function Te(){if(Ee)return ye;Ee=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return ye=n=>n?"object"!=typeof n?e:n:t}function Re(){if(we)return be;we=1;const e=/^[0-9]+$/,t=(t,n)=>{if("number"==typeof t&&"number"==typeof n)return t===n?0:t<n?-1:1;const r=e.test(t),i=e.test(n);return r&&i&&(t=+t,n=+n),t===n?0:r&&!i?-1:i&&!r?1:t<n?-1:1};return be={compareIdentifiers:t,rcompareIdentifiers:(e,n)=>t(n,e)}}function $e(){if(Se)return Le;Se=1;const e=me(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:n}=ge(),{safeRe:r,t:i}=Pe(),o=Te(),{compareIdentifiers:s}=Re();class a{constructor(s,c){if(c=o(c),s instanceof a){if(s.loose===!!c.loose&&s.includePrerelease===!!c.includePrerelease)return s;s=s.version}else if("string"!=typeof s)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof s}".`);if(s.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",s,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;const l=s.trim().match(c.loose?r[i.LOOSE]:r[i.FULL]);if(!l)throw new TypeError(`Invalid Version: ${s}`);if(this.raw=s,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");l[4]?this.prerelease=l[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<n)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(e("SemVer.compare",this.version,this.options,t),!(t instanceof a)){if("string"==typeof t&&t===this.version)return 0;t=new a(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(e){return e instanceof a||(e=new a(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(t){if(t instanceof a||(t=new a(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{const r=this.prerelease[n],i=t.prerelease[n];if(e("prerelease compare",n,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return s(r,i)}while(++n)}compareBuild(t){t instanceof a||(t=new a(t,this.options));let n=0;do{const r=this.build[n],i=t.build[n];if(e("build compare",n,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return s(r,i)}while(++n)}inc(e,t,n){if(e.startsWith("pre")){if(!t&&!1===n)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?r[i.PRERELEASELOOSE]:r[i.PRERELEASE]);if(!e||e[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(n)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let r=[t,e];!1===n&&(r=[t]),0===s(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Le=a}function xe(){if(Ie)return Ce;Ie=1;const e=$e();return Ce=(t,n,r=!1)=>{if(t instanceof e)return t;try{return new e(t,n)}catch(e){if(!r)return null;throw e}},Ce}function ke(){if(De)return _e;De=1;const e=xe();return _e=(t,n)=>{const r=e(t,n);return r?r.version:null},_e}function Fe(){if(Ne)return Oe;Ne=1;const e=xe();return Oe=(t,n)=>{const r=e(t.trim().replace(/^[=v]+/,""),n);return r?r.version:null},Oe}var Ue,Be,Me,Ge,je,ze,He,qe,Ve,We,Ye=["0BSD","3D-Slicer-1.0","AAL","ADSL","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AFL-3.0","AGPL-1.0-only","AGPL-1.0-or-later","AGPL-3.0-only","AGPL-3.0-or-later","AMD-newlib","AMDPLPA","AML","AML-glslang","AMPAS","ANTLR-PD","ANTLR-PD-fallback","APAFML","APL-1.0","APSL-1.0","APSL-1.1","APSL-1.2","APSL-2.0","ASWF-Digital-Assets-1.0","ASWF-Digital-Assets-1.1","Abstyles","AdaCore-doc","Adobe-2006","Adobe-Display-PostScript","Adobe-Glyph","Adobe-Utopia","Afmparse","Aladdin","Apache-1.0","Apache-1.1","Apache-2.0","App-s2p","Arphic-1999","Artistic-1.0","Artistic-1.0-Perl","Artistic-1.0-cl8","Artistic-2.0","Artistic-dist","Aspell-RU","BSD-1-Clause","BSD-2-Clause","BSD-2-Clause-Darwin","BSD-2-Clause-Patent","BSD-2-Clause-Views","BSD-2-Clause-first-lines","BSD-2-Clause-pkgconf-disclaimer","BSD-3-Clause","BSD-3-Clause-Attribution","BSD-3-Clause-Clear","BSD-3-Clause-HP","BSD-3-Clause-LBNL","BSD-3-Clause-Modification","BSD-3-Clause-No-Military-License","BSD-3-Clause-No-Nuclear-License","BSD-3-Clause-No-Nuclear-License-2014","BSD-3-Clause-No-Nuclear-Warranty","BSD-3-Clause-Open-MPI","BSD-3-Clause-Sun","BSD-3-Clause-acpica","BSD-3-Clause-flex","BSD-4-Clause","BSD-4-Clause-Shortened","BSD-4-Clause-UC","BSD-4.3RENO","BSD-4.3TAHOE","BSD-Advertising-Acknowledgement","BSD-Attribution-HPND-disclaimer","BSD-Inferno-Nettverk","BSD-Protection","BSD-Source-Code","BSD-Source-beginning-file","BSD-Systemics","BSD-Systemics-W3Works","BSL-1.0","BUSL-1.1","Baekmuk","Bahyph","Barr","Beerware","BitTorrent-1.0","BitTorrent-1.1","Bitstream-Charter","Bitstream-Vera","BlueOak-1.0.0","Boehm-GC","Boehm-GC-without-fee","Borceux","Brian-Gladman-2-Clause","Brian-Gladman-3-Clause","C-UDA-1.0","CAL-1.0","CAL-1.0-Combined-Work-Exception","CATOSL-1.1","CC-BY-1.0","CC-BY-2.0","CC-BY-2.5","CC-BY-2.5-AU","CC-BY-3.0","CC-BY-3.0-AT","CC-BY-3.0-AU","CC-BY-3.0-DE","CC-BY-3.0-IGO","CC-BY-3.0-NL","CC-BY-3.0-US","CC-BY-4.0","CC-BY-NC-1.0","CC-BY-NC-2.0","CC-BY-NC-2.5","CC-BY-NC-3.0","CC-BY-NC-3.0-DE","CC-BY-NC-4.0","CC-BY-NC-ND-1.0","CC-BY-NC-ND-2.0","CC-BY-NC-ND-2.5","CC-BY-NC-ND-3.0","CC-BY-NC-ND-3.0-DE","CC-BY-NC-ND-3.0-IGO","CC-BY-NC-ND-4.0","CC-BY-NC-SA-1.0","CC-BY-NC-SA-2.0","CC-BY-NC-SA-2.0-DE","CC-BY-NC-SA-2.0-FR","CC-BY-NC-SA-2.0-UK","CC-BY-NC-SA-2.5","CC-BY-NC-SA-3.0","CC-BY-NC-SA-3.0-DE","CC-BY-NC-SA-3.0-IGO","CC-BY-NC-SA-4.0","CC-BY-ND-1.0","CC-BY-ND-2.0","CC-BY-ND-2.5","CC-BY-ND-3.0","CC-BY-ND-3.0-DE","CC-BY-ND-4.0","CC-BY-SA-1.0","CC-BY-SA-2.0","CC-BY-SA-2.0-UK","CC-BY-SA-2.1-JP","CC-BY-SA-2.5","CC-BY-SA-3.0","CC-BY-SA-3.0-AT","CC-BY-SA-3.0-DE","CC-BY-SA-3.0-IGO","CC-BY-SA-4.0","CC-PDDC","CC-PDM-1.0","CC-SA-1.0","CC0-1.0","CDDL-1.0","CDDL-1.1","CDL-1.0","CDLA-Permissive-1.0","CDLA-Permissive-2.0","CDLA-Sharing-1.0","CECILL-1.0","CECILL-1.1","CECILL-2.0","CECILL-2.1","CECILL-B","CECILL-C","CERN-OHL-1.1","CERN-OHL-1.2","CERN-OHL-P-2.0","CERN-OHL-S-2.0","CERN-OHL-W-2.0","CFITSIO","CMU-Mach","CMU-Mach-nodoc","CNRI-Jython","CNRI-Python","CNRI-Python-GPL-Compatible","COIL-1.0","CPAL-1.0","CPL-1.0","CPOL-1.02","CUA-OPL-1.0","Caldera","Caldera-no-preamble","Catharon","ClArtistic","Clips","Community-Spec-1.0","Condor-1.1","Cornell-Lossless-JPEG","Cronyx","Crossword","CryptoSwift","CrystalStacker","Cube","D-FSL-1.0","DEC-3-Clause","DL-DE-BY-2.0","DL-DE-ZERO-2.0","DOC","DRL-1.0","DRL-1.1","DSDP","DocBook-DTD","DocBook-Schema","DocBook-Stylesheet","DocBook-XML","Dotseqn","ECL-1.0","ECL-2.0","EFL-1.0","EFL-2.0","EPICS","EPL-1.0","EPL-2.0","EUDatagrid","EUPL-1.0","EUPL-1.1","EUPL-1.2","Elastic-2.0","Entessa","ErlPL-1.1","Eurosym","FBM","FDK-AAC","FSFAP","FSFAP-no-warranty-disclaimer","FSFUL","FSFULLR","FSFULLRSD","FSFULLRWD","FSL-1.1-ALv2","FSL-1.1-MIT","FTL","Fair","Ferguson-Twofish","Frameworx-1.0","FreeBSD-DOC","FreeImage","Furuseth","GCR-docs","GD","GFDL-1.1-invariants-only","GFDL-1.1-invariants-or-later","GFDL-1.1-no-invariants-only","GFDL-1.1-no-invariants-or-later","GFDL-1.1-only","GFDL-1.1-or-later","GFDL-1.2-invariants-only","GFDL-1.2-invariants-or-later","GFDL-1.2-no-invariants-only","GFDL-1.2-no-invariants-or-later","GFDL-1.2-only","GFDL-1.2-or-later","GFDL-1.3-invariants-only","GFDL-1.3-invariants-or-later","GFDL-1.3-no-invariants-only","GFDL-1.3-no-invariants-or-later","GFDL-1.3-only","GFDL-1.3-or-later","GL2PS","GLWTPL","GPL-1.0-only","GPL-1.0-or-later","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","Game-Programming-Gems","Giftware","Glide","Glulxe","Graphics-Gems","Gutmann","HDF5","HIDAPI","HP-1986","HP-1989","HPND","HPND-DEC","HPND-Fenneberg-Livingston","HPND-INRIA-IMAG","HPND-Intel","HPND-Kevlin-Henney","HPND-MIT-disclaimer","HPND-Markus-Kuhn","HPND-Netrek","HPND-Pbmplus","HPND-UC","HPND-UC-export-US","HPND-doc","HPND-doc-sell","HPND-export-US","HPND-export-US-acknowledgement","HPND-export-US-modify","HPND-export2-US","HPND-merchantability-variant","HPND-sell-MIT-disclaimer-xserver","HPND-sell-regexpr","HPND-sell-variant","HPND-sell-variant-MIT-disclaimer","HPND-sell-variant-MIT-disclaimer-rev","HTMLTIDY","HaskellReport","Hippocratic-2.1","IBM-pibs","ICU","IEC-Code-Components-EULA","IJG","IJG-short","IPA","IPL-1.0","ISC","ISC-Veillard","ImageMagick","Imlib2","Info-ZIP","Inner-Net-2.0","InnoSetup","Intel","Intel-ACPI","Interbase-1.0","JPL-image","JPNIC","JSON","Jam","JasPer-2.0","Kastrup","Kazlib","Knuth-CTAN","LAL-1.2","LAL-1.3","LGPL-2.0-only","LGPL-2.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","LGPLLR","LOOP","LPD-document","LPL-1.0","LPL-1.02","LPPL-1.0","LPPL-1.1","LPPL-1.2","LPPL-1.3a","LPPL-1.3c","LZMA-SDK-9.11-to-9.20","LZMA-SDK-9.22","Latex2e","Latex2e-translated-notice","Leptonica","LiLiQ-P-1.1","LiLiQ-R-1.1","LiLiQ-Rplus-1.1","Libpng","Linux-OpenIB","Linux-man-pages-1-para","Linux-man-pages-copyleft","Linux-man-pages-copyleft-2-para","Linux-man-pages-copyleft-var","Lucida-Bitmap-Fonts","MIPS","MIT","MIT-0","MIT-CMU","MIT-Click","MIT-Festival","MIT-Khronos-old","MIT-Modern-Variant","MIT-Wu","MIT-advertising","MIT-enna","MIT-feh","MIT-open-group","MIT-testregex","MITNFA","MMIXware","MPEG-SSG","MPL-1.0","MPL-1.1","MPL-2.0","MPL-2.0-no-copyleft-exception","MS-LPL","MS-PL","MS-RL","MTLL","Mackerras-3-Clause","Mackerras-3-Clause-acknowledgment","MakeIndex","Martin-Birgmeier","McPhee-slideshow","Minpack","MirOS","Motosoto","MulanPSL-1.0","MulanPSL-2.0","Multics","Mup","NAIST-2003","NASA-1.3","NBPL-1.0","NCBI-PD","NCGL-UK-2.0","NCL","NCSA","NGPL","NICTA-1.0","NIST-PD","NIST-PD-fallback","NIST-Software","NLOD-1.0","NLOD-2.0","NLPL","NOSL","NPL-1.0","NPL-1.1","NPOSL-3.0","NRL","NTIA-PD","NTP","NTP-0","Naumen","NetCDF","Newsletr","Nokia","Noweb","O-UDA-1.0","OAR","OCCT-PL","OCLC-2.0","ODC-By-1.0","ODbL-1.0","OFFIS","OFL-1.0","OFL-1.0-RFN","OFL-1.0-no-RFN","OFL-1.1","OFL-1.1-RFN","OFL-1.1-no-RFN","OGC-1.0","OGDL-Taiwan-1.0","OGL-Canada-2.0","OGL-UK-1.0","OGL-UK-2.0","OGL-UK-3.0","OGTSL","OLDAP-1.1","OLDAP-1.2","OLDAP-1.3","OLDAP-1.4","OLDAP-2.0","OLDAP-2.0.1","OLDAP-2.1","OLDAP-2.2","OLDAP-2.2.1","OLDAP-2.2.2","OLDAP-2.3","OLDAP-2.4","OLDAP-2.5","OLDAP-2.6","OLDAP-2.7","OLDAP-2.8","OLFL-1.3","OML","OPL-1.0","OPL-UK-3.0","OPUBL-1.0","OSET-PL-2.1","OSL-1.0","OSL-1.1","OSL-2.0","OSL-2.1","OSL-3.0","OpenPBS-2.3","OpenSSL","OpenSSL-standalone","OpenVision","PADL","PDDL-1.0","PHP-3.0","PHP-3.01","PPL","PSF-2.0","Parity-6.0.0","Parity-7.0.0","Pixar","Plexus","PolyForm-Noncommercial-1.0.0","PolyForm-Small-Business-1.0.0","PostgreSQL","Python-2.0","Python-2.0.1","QPL-1.0","QPL-1.0-INRIA-2004","Qhull","RHeCos-1.1","RPL-1.1","RPL-1.5","RPSL-1.0","RSA-MD","RSCPL","Rdisc","Ruby","Ruby-pty","SAX-PD","SAX-PD-2.0","SCEA","SGI-B-1.0","SGI-B-1.1","SGI-B-2.0","SGI-OpenGL","SGP4","SHL-0.5","SHL-0.51","SISSL","SISSL-1.2","SL","SMAIL-GPL","SMLNJ","SMPPL","SNIA","SOFA","SPL-1.0","SSH-OpenSSH","SSH-short","SSLeay-standalone","SSPL-1.0","SUL-1.0","SWL","Saxpath","SchemeReport","Sendmail","Sendmail-8.23","Sendmail-Open-Source-1.1","SimPL-2.0","Sleepycat","Soundex","Spencer-86","Spencer-94","Spencer-99","SugarCRM-1.1.3","Sun-PPP","Sun-PPP-2000","SunPro","Symlinks","TAPR-OHL-1.0","TCL","TCP-wrappers","TGPPL-1.0","TMate","TORQUE-1.1","TOSL","TPDL","TPL-1.0","TTWL","TTYP0","TU-Berlin-1.0","TU-Berlin-2.0","TermReadKey","ThirdEye","TrustedQSL","UCAR","UCL-1.0","UMich-Merit","UPL-1.0","URT-RLE","Ubuntu-font-1.0","Unicode-3.0","Unicode-DFS-2015","Unicode-DFS-2016","Unicode-TOU","UnixCrypt","Unlicense","Unlicense-libtelnet","Unlicense-libwhirlpool","VOSTROM","VSL-1.0","Vim","W3C","W3C-19980720","W3C-20150513","WTFPL","Watcom-1.0","Widget-Workshop","Wsuipa","X11","X11-distribute-modifications-variant","X11-swapped","XFree86-1.1","XSkat","Xdebug-1.03","Xerox","Xfig","Xnet","YPL-1.0","YPL-1.1","ZPL-1.1","ZPL-2.0","ZPL-2.1","Zed","Zeeff","Zend-2.0","Zimbra-1.3","Zimbra-1.4","Zlib","any-OSI","any-OSI-perl-modules","bcrypt-Solar-Designer","blessing","bzip2-1.0.6","check-cvs","checkmk","copyleft-next-0.3.0","copyleft-next-0.3.1","curl","cve-tou","diffmark","dtoa","dvipdfm","eGenix","etalab-2.0","fwlw","gSOAP-1.3b","generic-xts","gnuplot","gtkbook","hdparm","iMatix","jove","libpng-1.6.35","libpng-2.0","libselinux-1.0","libtiff","libutil-David-Nugent","lsof","magaz","mailprio","man2html","metamail","mpi-permissive","mpich2","mplus","ngrep","pkgconf","pnmstitch","psfrag","psutils","python-ldap","radvd","snprintf","softSurfer","ssh-keyscan","swrule","threeparttable","ulem","w3m","wwl","xinetd","xkeyboard-config-Zinoviev","xlock","xpp","xzoom","zlib-acknowledgement"],Ke=["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-2.0","GPL-2.0-with-GCC-exception","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-3.0","GPL-3.0-with-GCC-exception","GPL-3.0-with-autoconf-exception","LGPL-2.0","LGPL-2.1","LGPL-3.0","Net-SNMP","Nunit","StandardML-NJ","bzip2-1.0.5","eCos-2.0","wxWindows"],Xe=["389-exception","Asterisk-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Autoconf-exception-generic","Autoconf-exception-generic-3.0","Autoconf-exception-macro","Bison-exception-1.24","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","cryptsetup-OpenSSL-exception","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","fmt-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-2.0-note","GCC-exception-3.1","Gmsh-exception","GNAT-exception","GNOME-examples-exception","GNU-compiler-exception","gnu-javamail-exception","GPL-3.0-interface-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","libpri-OpenH323-exception","Libtool-exception","Linux-syscall-note","LLGPL","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","QPL-1.0-INRIA-2004-exception","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SANE-exception","SHL-2.0","SHL-2.1","stunnel-exception","SWI-exception","Swift-exception","Texinfo-exception","u-boot-exception-2.0","UBDL-exception","Universal-FOSS-exception-1.0","vsftpd-openssl-exception","WxWindows-exception-3.1","x11vnc-openssl-exception"];function Ze(){if(Be)return Ue;Be=1;var e=[].concat(Ye).concat(Ke),t=Xe;return Ue=function(n){var r=0;function i(){return r<n.length}function o(e){if(e instanceof RegExp){var t=n.slice(r).match(e);if(t)return r+=t[0].length,t[0]}else if(n.indexOf(e,r)===r)return r+=e.length,e}function s(){o(/[ ]*/)}function a(){return o(/[A-Za-z0-9-.]+/)}function c(){var e=a();if(!e)throw new Error("Expected idstring at offset "+r);return e}function l(){return function(){for(var e,t=["WITH","AND","OR","(",")",":","+"],i=0;i<t.length&&!(e=o(t[i]));i++);if("+"===e&&r>1&&" "===n[r-2])throw new Error("Space before `+`");return e&&{type:"OPERATOR",string:e}}()||function(){if(o("DocumentRef-"))return{type:"DOCUMENTREF",string:c()}}()||function(){if(o("LicenseRef-"))return{type:"LICENSEREF",string:c()}}()||(i=r,s=a(),-1!==e.indexOf(s)?{type:"LICENSE",string:s}:-1!==t.indexOf(s)?{type:"EXCEPTION",string:s}:void(r=i));var i,s}for(var u=[];i()&&(s(),i());){var f=l();if(!f)throw new Error("Unexpected `"+n[r]+"` at offset "+r);u.push(f)}return u}}function Je(){return Ge?Me:(Ge=1,Me=function(e){var t=0;function n(){return t<e.length}function r(){return n()?e[t]:null}function i(){if(!n())throw new Error;t++}function o(e){var t=r();if(t&&"OPERATOR"===t.type&&e===t.string)return i(),t.string}function s(){var e=r();if(e&&"LICENSE"===e.type){i();var t={license:e.string};o("+")&&(t.plus=!0);var n=function(){if(o("WITH")){var e=r();if(e&&"EXCEPTION"===e.type)return i(),e.string;throw new Error("Expected exception after `WITH`")}}();return n&&(t.exception=n),t}}function a(e,t){return function n(){var r=t();if(r){if(!o(e))return r;var i=n();if(!i)throw new Error("Expected expression");return{left:r,conjunction:e.toLowerCase(),right:i}}}}var c=a("AND",function(){return function(){if(o("(")){var e=l();if(!o(")"))throw new Error("Expected `)`");return e}}()||function(){var e=t,n="",s=r();if("DOCUMENTREF"===s.type&&(i(),n+="DocumentRef-"+s.string+":",!o(":")))throw new Error("Expected `:` after `DocumentRef-...`");if("LICENSEREF"===(s=r()).type)return i(),{license:n+="LicenseRef-"+s.string};t=e}()||s()}),l=a("OR",c),u=l();if(!u||n())throw new Error("Syntax error");return u})}function Qe(){if(ze)return je;ze=1;var e=Ze(),t=Je();return je=function(n){return t(e(n))}}function et(){if(We)return Ve;We=1;var e=Qe(),t=function(){if(qe)return He;qe=1;var e=Qe(),t=Ye;function n(t){try{return e(t),!0}catch(e){return!1}}function r(e,t){var n=t[0].length-e[0].length;return 0!==n?n:e[0].toUpperCase().localeCompare(t[0].toUpperCase())}var i=[["APGL","AGPL"],["Gpl","GPL"],["GLP","GPL"],["APL","Apache"],["ISD","ISC"],["GLP","GPL"],["IST","ISC"],["Claude","Clause"],[" or later","+"],[" International",""],["GNU","GPL"],["GUN","GPL"],["+",""],["GNU GPL","GPL"],["GNU LGPL","LGPL"],["GNU/GPL","GPL"],["GNU GLP","GPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL"],["GNU Lesser General Public License","LGPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["GNU Lesser General Public License","LGPL-2.1"],["LESSER GENERAL PUBLIC LICENSE","LGPL"],["Lesser General Public License","LGPL"],["LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["Lesser General Public License","LGPL-2.1"],["GNU General Public License","GPL"],["Gnu public license","GPL"],["GNU Public License","GPL"],["GNU GENERAL PUBLIC LICENSE","GPL"],["MTI","MIT"],["Mozilla Public License","MPL"],["Universal Permissive License","UPL"],["WTH","WTF"],["WTFGPL","WTFPL"],["-License",""]].sort(r),o=[function(e){return e.toUpperCase()},function(e){return e.trim()},function(e){return e.replace(/\./g,"")},function(e){return e.replace(/\s+/g,"")},function(e){return e.replace(/\s+/g,"-")},function(e){return e.replace("v","-")},function(e){return e.replace(/,?\s*(\d)/,"-$1")},function(e){return e.replace(/,?\s*(\d)/,"-$1.0")},function(e){return e.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(e){return e.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(e){return e[0].toUpperCase()+e.slice(1)},function(e){return e.replace("/","-")},function(e){return e.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(e){return-1!==e.indexOf("3.0")?e+"-or-later":e+"-only"},function(e){return e+"only"},function(e){return e.replace(/(\d)$/,"-$1.0")},function(e){return e.replace(/(-| )?(\d)$/,"-$2-Clause")},function(e){return e.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(e){return e.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(e){return e.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(e){return e.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(e){return e.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(e){return e.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(e){return"CC-"+e},function(e){return"CC-"+e+"-4.0"},function(e){return e.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(e){return"CC-"+e.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],s=t.map(function(e){var t=/^(.*)-\d+\.\d+$/.exec(e);return t?[t[0],t[1]]:[e,null]}).reduce(function(e,t){var n=t[1];return e[n]=e[n]||[],e[n].push(t[0]),e},{}),a=Object.keys(s).map(function(e){return[e,s[e]]}).filter(function(e){return 1===e[1].length&&null!==e[0]&&"APL"!==e[0]}).map(function(e){return[e[0],e[1][0]]});s=void 0;var c=[["UNLI","Unlicense"],["WTF","WTFPL"],["2 CLAUSE","BSD-2-Clause"],["2-CLAUSE","BSD-2-Clause"],["3 CLAUSE","BSD-3-Clause"],["3-CLAUSE","BSD-3-Clause"],["AFFERO","AGPL-3.0-or-later"],["AGPL","AGPL-3.0-or-later"],["APACHE","Apache-2.0"],["ARTISTIC","Artistic-2.0"],["Affero","AGPL-3.0-or-later"],["BEER","Beerware"],["BOOST","BSL-1.0"],["BSD","BSD-2-Clause"],["CDDL","CDDL-1.1"],["ECLIPSE","EPL-1.0"],["FUCK","WTFPL"],["GNU","GPL-3.0-or-later"],["LGPL","LGPL-3.0-or-later"],["GPLV1","GPL-1.0-only"],["GPL-1","GPL-1.0-only"],["GPLV2","GPL-2.0-only"],["GPL-2","GPL-2.0-only"],["GPL","GPL-3.0-or-later"],["MIT +NO-FALSE-ATTRIBS","MITNFA"],["MIT","MIT"],["MPL","MPL-2.0"],["X11","X11"],["ZLIB","Zlib"]].concat(a).sort(r),l=function(e){for(var t=0;t<o.length;t++){var r=o[t](e).trim();if(r!==e&&n(r))return r}return null},u=function(e){for(var t=e.toUpperCase(),n=0;n<c.length;n++){var r=c[n];if(t.indexOf(r[0])>-1)return r[1]}return null},f=function(e,t){for(var n=0;n<i.length;n++){var r=i[n],o=r[0];if(e.indexOf(o)>-1){var s=t(e.replace(o,r[1]));if(null!==s)return s}}return null};return He=function(e,t){var r=void 0===(t=t||{}).upgrade||!!t.upgrade;function i(e){return r?function(e){return-1!==["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(e)?e+"-only":-1!==["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(e)?e.replace(/\+$/,"-or-later"):-1!==["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(e)?e+"-or-later":e}(e):e}if("string"!=typeof e||0===e.trim().length)throw Error("Invalid argument. Expected non-empty string.");if(n(e=e.trim()))return i(e);var o=e.replace(/\+$/,"").trim();if(n(o))return i(o);var s=l(e);return null!==s||null!==(s=f(e,function(e){return n(e)?e:l(e)}))||null!==(s=u(e))||null!==(s=f(e,u))?i(s):null}}(),n='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',r=/^SEE LICEN[CS]E IN (.+)$/;function i(e,t){return t.slice(0,e.length)===e}function o(e){if(e.hasOwnProperty("license")){var t=e.license;return i("LicenseRef",t)||i("DocumentRef",t)}return o(e.left)||o(e.right)}return Ve=function(i){var s;try{s=e(i)}catch(e){var a;if("UNLICENSED"===i||"UNLICENCED"===i)return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(a=r.exec(i))return{validForOldPackages:!0,validForNewPackages:!0,inFile:a[1]};var c={validForOldPackages:!1,validForNewPackages:!1,warnings:[n]};if(0!==i.trim().length){var l=t(i);l&&c.warnings.push('license is similar to the valid expression "'+l+'"')}return c}return o(s)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[n]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}}var tt,nt,rt,it,ot,st,at,ct,lt,ut,ft,pt={};function dt(){if(tt)return pt;tt=1,Object.defineProperty(pt,"__esModule",{value:!0}),pt.LRUCache=void 0;const e="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,t=new Set,n="object"==typeof process&&process?process:{},r=(e,t,r,i)=>{"function"==typeof n.emitWarning?n.emitWarning(e,t,r,i):console.error(`[${r}] ${t}: ${e}`)};let i=globalThis.AbortController,o=globalThis.AbortSignal;if(void 0===i){o=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},i=class{constructor(){t()}signal=new o;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(const t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e="1"!==n.env?.LRU_CACHE_IGNORE_AC_WARNING;const t=()=>{e&&(e=!1,r("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",t))}}const s=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),a=e=>s(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?c:null:null;class c extends Array{constructor(e){super(e),this.fill(0)}}class l{heap;length;static#e=!1;static create(e){const t=a(e);if(!t)return[];l.#e=!0;const n=new l(e,t);return l.#e=!1,n}constructor(e,t){if(!l.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class u{#t;#n;#r;#i;#o;#s;#a;#c;get perf(){return this.#c}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#l;#u;#f;#p;#d;#h;#m;#g;#v;#y;#E;#b;#w;#L;#S;#C;#I;#_;static unsafeExposeInternals(e){return{starts:e.#w,ttls:e.#L,sizes:e.#b,keyMap:e.#f,keyList:e.#p,valList:e.#d,next:e.#h,prev:e.#m,get head(){return e.#g},get tail(){return e.#v},free:e.#y,isBackgroundFetch:t=>e.#D(t),backgroundFetch:(t,n,r,i)=>e.#O(t,n,r,i),moveToTail:t=>e.#N(t),indexes:t=>e.#A(t),rindexes:t=>e.#P(t),isStale:t=>e.#T(t)}}get max(){return this.#t}get maxSize(){return this.#n}get calculatedSize(){return this.#u}get size(){return this.#l}get fetchMethod(){return this.#s}get memoMethod(){return this.#a}get dispose(){return this.#r}get onInsert(){return this.#i}get disposeAfter(){return this.#o}constructor(n){const{max:i=0,ttl:o,ttlResolution:c=1,ttlAutopurge:f,updateAgeOnGet:p,updateAgeOnHas:d,allowStale:h,dispose:m,onInsert:g,disposeAfter:v,noDisposeOnSet:y,noUpdateTTL:E,maxSize:b=0,maxEntrySize:w=0,sizeCalculation:L,fetchMethod:S,memoMethod:C,noDeleteOnFetchRejection:I,noDeleteOnStaleGet:_,allowStaleOnFetchRejection:D,allowStaleOnFetchAbort:O,ignoreFetchAbort:N,perf:A}=n;if(void 0!==A&&"function"!=typeof A?.now)throw new TypeError("perf option must have a now() method if specified");if(this.#c=A??e,0!==i&&!s(i))throw new TypeError("max option must be a nonnegative integer");const P=i?a(i):Array;if(!P)throw new Error("invalid max value: "+i);if(this.#t=i,this.#n=b,this.maxEntrySize=w||this.#n,this.sizeCalculation=L,this.sizeCalculation){if(!this.#n&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==C&&"function"!=typeof C)throw new TypeError("memoMethod must be a function if defined");if(this.#a=C,void 0!==S&&"function"!=typeof S)throw new TypeError("fetchMethod must be a function if specified");if(this.#s=S,this.#C=!!S,this.#f=new Map,this.#p=new Array(i).fill(void 0),this.#d=new Array(i).fill(void 0),this.#h=new P(i),this.#m=new P(i),this.#g=0,this.#v=0,this.#y=l.create(i),this.#l=0,this.#u=0,"function"==typeof m&&(this.#r=m),"function"==typeof g&&(this.#i=g),"function"==typeof v?(this.#o=v,this.#E=[]):(this.#o=void 0,this.#E=void 0),this.#S=!!this.#r,this.#_=!!this.#i,this.#I=!!this.#o,this.noDisposeOnSet=!!y,this.noUpdateTTL=!!E,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!D,this.allowStaleOnFetchAbort=!!O,this.ignoreFetchAbort=!!N,0!==this.maxEntrySize){if(0!==this.#n&&!s(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!s(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#R()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!_,this.updateAgeOnGet=!!p,this.updateAgeOnHas=!!d,this.ttlResolution=s(c)||0===c?c:1,this.ttlAutopurge=!!f,this.ttl=o||0,this.ttl){if(!s(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#$()}if(0===this.#t&&0===this.ttl&&0===this.#n)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#n){const e="LRU_CACHE_UNBOUNDED";if((e=>!t.has(e))(e)){t.add(e);r("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",e,u)}}}getRemainingTTL(e){return this.#f.has(e)?1/0:0}#$(){const e=new c(this.#t),t=new c(this.#t);this.#L=e,this.#w=t,this.#x=(n,r,i=this.#c.now())=>{if(t[n]=0!==r?i:0,e[n]=r,0!==r&&this.ttlAutopurge){const e=setTimeout(()=>{this.#T(n)&&this.#k(this.#p[n],"expire")},r+1);e.unref&&e.unref()}},this.#F=n=>{t[n]=0!==e[n]?this.#c.now():0},this.#U=(i,o)=>{if(e[o]){const s=e[o],a=t[o];if(!s||!a)return;i.ttl=s,i.start=a,i.now=n||r();const c=i.now-a;i.remainingTTL=s-c}};let n=0;const r=()=>{const e=this.#c.now();if(this.ttlResolution>0){n=e;const t=setTimeout(()=>n=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=i=>{const o=this.#f.get(i);if(void 0===o)return 0;const s=e[o],a=t[o];if(!s||!a)return 1/0;return s-((n||r())-a)},this.#T=i=>{const o=t[i],s=e[i];return!!s&&!!o&&(n||r())-o>s}}#F=()=>{};#U=()=>{};#x=()=>{};#T=()=>!1;#R(){const e=new c(this.#t);this.#u=0,this.#b=e,this.#B=t=>{this.#u-=e[t],e[t]=0},this.#M=(e,t,n,r)=>{if(this.#D(t))return 0;if(!s(n)){if(!r)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof r)throw new TypeError("sizeCalculation must be a function");if(n=r(t,e),!s(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return n},this.#G=(t,n,r)=>{if(e[t]=n,this.#n){const n=this.#n-e[t];for(;this.#u>n;)this.#j(!0)}this.#u+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#u)}}#B=e=>{};#G=(e,t,n)=>{};#M=(e,t,n,r)=>{if(n||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#A({allowStale:e=this.allowStale}={}){if(this.#l)for(let t=this.#v;this.#z(t)&&(!e&&this.#T(t)||(yield t),t!==this.#g);)t=this.#m[t]}*#P({allowStale:e=this.allowStale}={}){if(this.#l)for(let t=this.#g;this.#z(t)&&(!e&&this.#T(t)||(yield t),t!==this.#v);)t=this.#h[t]}#z(e){return void 0!==e&&this.#f.get(this.#p[e])===e}*entries(){for(const e of this.#A())void 0===this.#d[e]||void 0===this.#p[e]||this.#D(this.#d[e])||(yield[this.#p[e],this.#d[e]])}*rentries(){for(const e of this.#P())void 0===this.#d[e]||void 0===this.#p[e]||this.#D(this.#d[e])||(yield[this.#p[e],this.#d[e]])}*keys(){for(const e of this.#A()){const t=this.#p[e];void 0===t||this.#D(this.#d[e])||(yield t)}}*rkeys(){for(const e of this.#P()){const t=this.#p[e];void 0===t||this.#D(this.#d[e])||(yield t)}}*values(){for(const e of this.#A()){void 0===this.#d[e]||this.#D(this.#d[e])||(yield this.#d[e])}}*rvalues(){for(const e of this.#P()){void 0===this.#d[e]||this.#D(this.#d[e])||(yield this.#d[e])}}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(const n of this.#A()){const r=this.#d[n],i=this.#D(r)?r.__staleWhileFetching:r;if(void 0!==i&&e(i,this.#p[n],this))return this.get(this.#p[n],t)}}forEach(e,t=this){for(const n of this.#A()){const r=this.#d[n],i=this.#D(r)?r.__staleWhileFetching:r;void 0!==i&&e.call(t,i,this.#p[n],this)}}rforEach(e,t=this){for(const n of this.#P()){const r=this.#d[n],i=this.#D(r)?r.__staleWhileFetching:r;void 0!==i&&e.call(t,i,this.#p[n],this)}}purgeStale(){let e=!1;for(const t of this.#P({allowStale:!0}))this.#T(t)&&(this.#k(this.#p[t],"expire"),e=!0);return e}info(e){const t=this.#f.get(e);if(void 0===t)return;const n=this.#d[t],r=this.#D(n)?n.__staleWhileFetching:n;if(void 0===r)return;const i={value:r};if(this.#L&&this.#w){const e=this.#L[t],n=this.#w[t];if(e&&n){const t=e-(this.#c.now()-n);i.ttl=t,i.start=Date.now()}}return this.#b&&(i.size=this.#b[t]),i}dump(){const e=[];for(const t of this.#A({allowStale:!0})){const n=this.#p[t],r=this.#d[t],i=this.#D(r)?r.__staleWhileFetching:r;if(void 0===i||void 0===n)continue;const o={value:i};if(this.#L&&this.#w){o.ttl=this.#L[t];const e=this.#c.now()-this.#w[t];o.start=Math.floor(Date.now()-e)}this.#b&&(o.size=this.#b[t]),e.unshift([n,o])}return e}load(e){this.clear();for(const[t,n]of e){if(n.start){const e=Date.now()-n.start;n.start=this.#c.now()-e}this.set(t,n.value,n)}}set(e,t,n={}){if(void 0===t)return this.delete(e),this;const{ttl:r=this.ttl,start:i,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:a}=n;let{noUpdateTTL:c=this.noUpdateTTL}=n;const l=this.#M(e,t,n.size||0,s);if(this.maxEntrySize&&l>this.maxEntrySize)return a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this.#k(e,"set"),this;let u=0===this.#l?void 0:this.#f.get(e);if(void 0===u)u=0===this.#l?this.#v:0!==this.#y.length?this.#y.pop():this.#l===this.#t?this.#j(!1):this.#l,this.#p[u]=e,this.#d[u]=t,this.#f.set(e,u),this.#h[this.#v]=u,this.#m[u]=this.#v,this.#v=u,this.#l++,this.#G(u,l,a),a&&(a.set="add"),c=!1,this.#_&&this.#i?.(t,e,"add");else{this.#N(u);const n=this.#d[u];if(t!==n){if(this.#C&&this.#D(n)){n.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:t}=n;void 0===t||o||(this.#S&&this.#r?.(t,e,"set"),this.#I&&this.#E?.push([t,e,"set"]))}else o||(this.#S&&this.#r?.(n,e,"set"),this.#I&&this.#E?.push([n,e,"set"]));if(this.#B(u),this.#G(u,l,a),this.#d[u]=t,a){a.set="replace";const e=n&&this.#D(n)?n.__staleWhileFetching:n;void 0!==e&&(a.oldValue=e)}}else a&&(a.set="update");this.#_&&this.onInsert?.(t,e,t===n?"update":"replace")}if(0===r||this.#L||this.#$(),this.#L&&(c||this.#x(u,r,i),a&&this.#U(a,u)),!o&&this.#I&&this.#E){const e=this.#E;let t;for(;t=e?.shift();)this.#o?.(...t)}return this}pop(){try{for(;this.#l;){const e=this.#d[this.#g];if(this.#j(!0),this.#D(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#I&&this.#E){const e=this.#E;let t;for(;t=e?.shift();)this.#o?.(...t)}}}#j(e){const t=this.#g,n=this.#p[t],r=this.#d[t];return this.#C&&this.#D(r)?r.__abortController.abort(new Error("evicted")):(this.#S||this.#I)&&(this.#S&&this.#r?.(r,n,"evict"),this.#I&&this.#E?.push([r,n,"evict"])),this.#B(t),e&&(this.#p[t]=void 0,this.#d[t]=void 0,this.#y.push(t)),1===this.#l?(this.#g=this.#v=0,this.#y.length=0):this.#g=this.#h[t],this.#f.delete(n),this.#l--,t}has(e,t={}){const{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#f.get(e);if(void 0!==i){const e=this.#d[i];if(this.#D(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#T(i))return n&&this.#F(i),r&&(r.has="hit",this.#U(r,i)),!0;r&&(r.has="stale",this.#U(r,i))}else r&&(r.has="miss");return!1}peek(e,t={}){const{allowStale:n=this.allowStale}=t,r=this.#f.get(e);if(void 0===r||!n&&this.#T(r))return;const i=this.#d[r];return this.#D(i)?i.__staleWhileFetching:i}#O(e,t,n,r){const o=void 0===t?void 0:this.#d[t];if(this.#D(o))return o;const s=new i,{signal:a}=n;a?.addEventListener("abort",()=>s.abort(a.reason),{signal:s.signal});const c={signal:s.signal,options:n,context:r},l=(r,i=!1)=>{const{aborted:o}=s.signal,a=n.ignoreFetchAbort&&void 0!==r;if(n.status&&(o&&!i?(n.status.fetchAborted=!0,n.status.fetchError=s.signal.reason,a&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),o&&!a&&!i)return u(s.signal.reason);const l=f;return this.#d[t]===f&&(void 0===r?void 0!==l.__staleWhileFetching?this.#d[t]=l.__staleWhileFetching:this.#k(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,r,c.options))),r},u=r=>{const{aborted:i}=s.signal,o=i&&n.allowStaleOnFetchAbort,a=o||n.allowStaleOnFetchRejection,c=a||n.noDeleteOnFetchRejection,l=f;if(this.#d[t]===f){!c||void 0===l.__staleWhileFetching?this.#k(e,"fetch"):o||(this.#d[t]=l.__staleWhileFetching)}if(a)return n.status&&void 0!==l.__staleWhileFetching&&(n.status.returnedStale=!0),l.__staleWhileFetching;if(l.__returned===l)throw r};n.status&&(n.status.fetchDispatched=!0);const f=new Promise((t,r)=>{const i=this.#s?.(e,o,c);i&&i instanceof Promise&&i.then(e=>t(void 0===e?void 0:e),r),s.signal.addEventListener("abort",()=>{n.ignoreFetchAbort&&!n.allowStaleOnFetchAbort||(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>l(e,!0)))})}).then(l,e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),u(e))),p=Object.assign(f,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return void 0===t?(this.set(e,p,{...c.options,status:void 0}),t=this.#f.get(e)):this.#d[t]=p,p}#D(e){if(!this.#C)return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof i}async fetch(e,t={}){const{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:a=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:d=this.allowStaleOnFetchAbort,context:h,forceRefresh:m=!1,status:g,signal:v}=t;if(!this.#C)return g&&(g.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});const y={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:o,noDisposeOnSet:s,size:a,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:d,ignoreFetchAbort:p,status:g,signal:v};let E=this.#f.get(e);if(void 0===E){g&&(g.fetch="miss");const t=this.#O(e,E,y,h);return t.__returned=t}{const t=this.#d[E];if(this.#D(t)){const e=n&&void 0!==t.__staleWhileFetching;return g&&(g.fetch="inflight",e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}const i=this.#T(E);if(!m&&!i)return g&&(g.fetch="hit"),this.#N(E),r&&this.#F(E),g&&this.#U(g,E),t;const o=this.#O(e,E,y,h),s=void 0!==o.__staleWhileFetching&&n;return g&&(g.fetch=i?"stale":"refresh",s&&i&&(g.returnedStale=!0)),s?o.__staleWhileFetching:o.__returned=o}}async forceFetch(e,t={}){const n=await this.fetch(e,t);if(void 0===n)throw new Error("fetch() returned undefined");return n}memo(e,t={}){const n=this.#a;if(!n)throw new Error("no memoMethod provided to constructor");const{context:r,forceRefresh:i,...o}=t,s=this.get(e,o);if(!i&&void 0!==s)return s;const a=n(e,s,{options:o,context:r});return this.set(e,a,o),a}get(e,t={}){const{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:o}=t,s=this.#f.get(e);if(void 0!==s){const t=this.#d[s],a=this.#D(t);return o&&this.#U(o,s),this.#T(s)?(o&&(o.get="stale"),a?(o&&n&&void 0!==t.__staleWhileFetching&&(o.returnedStale=!0),n?t.__staleWhileFetching:void 0):(i||this.#k(e,"expire"),o&&n&&(o.returnedStale=!0),n?t:void 0)):(o&&(o.get="hit"),a?t.__staleWhileFetching:(this.#N(s),r&&this.#F(s),t))}o&&(o.get="miss")}#H(e,t){this.#m[t]=e,this.#h[e]=t}#N(e){e!==this.#v&&(e===this.#g?this.#g=this.#h[e]:this.#H(this.#m[e],this.#h[e]),this.#H(this.#v,e),this.#v=e)}delete(e){return this.#k(e,"delete")}#k(e,t){let n=!1;if(0!==this.#l){const r=this.#f.get(e);if(void 0!==r)if(n=!0,1===this.#l)this.#q(t);else{this.#B(r);const n=this.#d[r];if(this.#D(n)?n.__abortController.abort(new Error("deleted")):(this.#S||this.#I)&&(this.#S&&this.#r?.(n,e,t),this.#I&&this.#E?.push([n,e,t])),this.#f.delete(e),this.#p[r]=void 0,this.#d[r]=void 0,r===this.#v)this.#v=this.#m[r];else if(r===this.#g)this.#g=this.#h[r];else{const e=this.#m[r];this.#h[e]=this.#h[r];const t=this.#h[r];this.#m[t]=this.#m[r]}this.#l--,this.#y.push(r)}}if(this.#I&&this.#E?.length){const e=this.#E;let t;for(;t=e?.shift();)this.#o?.(...t)}return n}clear(){return this.#q("delete")}#q(e){for(const t of this.#P({allowStale:!0})){const n=this.#d[t];if(this.#D(n))n.__abortController.abort(new Error("deleted"));else{const r=this.#p[t];this.#S&&this.#r?.(n,r,e),this.#I&&this.#E?.push([n,r,e])}}if(this.#f.clear(),this.#d.fill(void 0),this.#p.fill(void 0),this.#L&&this.#w&&(this.#L.fill(0),this.#w.fill(0)),this.#b&&this.#b.fill(0),this.#g=0,this.#v=0,this.#y.length=0,this.#u=0,this.#l=0,this.#I&&this.#E){const e=this.#E;let t;for(;t=e?.shift();)this.#o?.(...t)}}}return pt.LRUCache=u,pt}function ht(){if(ot)return it;ot=1;const e=p,t=(e,t,n)=>{const r=e.indexOf(n);return e.lastIndexOf(t,r>-1?r:1/0)},n=t=>{try{return new e.URL(t)}catch{}};return it=(e,r)=>{const i=r?((e,t)=>{const n=e.indexOf(":"),r=e.slice(0,n+1);if(Object.prototype.hasOwnProperty.call(t,r))return e;const i=e.indexOf("@");return i>-1?i>n?`git+ssh://${e}`:e:e.indexOf("//")===n+1?e:`${e.slice(0,n+1)}//${e.slice(n+1)}`})(e,r):e;return n(i)||n((e=>{const n=t(e,"@","#"),r=t(e,":","#");return r>n&&(e=e.slice(0,r)+"/"+e.slice(r+1)),-1===t(e,":","#")&&-1===e.indexOf("//")&&(e=`git+ssh://${e}`),e})(i))},it}function mt(){if(at)return st;at=1;const e=ht();return st=(t,n,{gitHosts:r,protocols:i})=>{if(!t)return;const o=(e=>{const t=e.indexOf("#"),n=e.indexOf("/"),r=e.indexOf("/",n+1),i=e.indexOf(":"),o=/\s/.exec(e),s=e.indexOf("@"),a=!o||t>-1&&o.index>t,c=-1===s||t>-1&&s>t,l=-1===i||t>-1&&i>t,u=-1===r||t>-1&&r>t,f=n>0,p=t>-1?"/"!==e[t-1]:!e.endsWith("/"),d=!e.startsWith(".");return a&&f&&p&&d&&c&&l&&u})(t)?`github:${t}`:t,s=e(o,i);if(!s)return;const a=r.byShortcut[s.protocol],c=r.byDomain[s.hostname.startsWith("www.")?s.hostname.slice(4):s.hostname],l=a||c;if(!l)return;const u=r[a||c];let f=null;i[s.protocol]?.auth&&(s.username||s.password)&&(f=`${s.username}${s.password?":"+s.password:""}`);let p=null,d=null,h=null,m=null;try{if(a){let e=s.pathname.startsWith("/")?s.pathname.slice(1):s.pathname;const t=e.indexOf("@");t>-1&&(e=e.slice(t+1));const n=e.lastIndexOf("/");n>-1?(d=decodeURIComponent(e.slice(0,n)),d||(d=null),h=decodeURIComponent(e.slice(n+1))):h=decodeURIComponent(e),h.endsWith(".git")&&(h=h.slice(0,-4)),s.hash&&(p=decodeURIComponent(s.hash.slice(1))),m="shortcut"}else{if(!u.protocols.includes(s.protocol))return;const e=u.extract(s);if(!e)return;d=e.user&&decodeURIComponent(e.user),h=decodeURIComponent(e.project),p=decodeURIComponent(e.committish),m=i[s.protocol]?.name||s.protocol.slice(0,-1)}}catch(e){if(e instanceof URIError)return;throw e}return[l,d,f,h,p,m,n]}}function gt(){if(lt)return ct;lt=1;const{LRUCache:e}=dt(),t=function(){if(rt)return nt;rt=1;const e=(...e)=>e.every(e=>e)?e.join(""):"",t=e=>e?encodeURIComponent(e):"",n=e=>e.toLowerCase().replace(/^\W+/g,"").replace(/(?<!\W)\W+$/,"").replace(/\//g,"").replace(/\W+/g,"-"),r={sshtemplate:({domain:t,user:n,project:r,committish:i})=>`git@${t}:${n}/${r}.git${e("#",i)}`,sshurltemplate:({domain:t,user:n,project:r,committish:i})=>`git+ssh://git@${t}/${n}/${r}.git${e("#",i)}`,edittemplate:({domain:n,user:r,project:i,committish:o,editpath:s,path:a})=>`https://${n}/${r}/${i}${e("/",s,"/",t(o||"HEAD"),"/",a)}`,browsetemplate:({domain:n,user:r,project:i,committish:o,treepath:s})=>`https://${n}/${r}/${i}${e("/",s,"/",t(o))}`,browsetreetemplate:({domain:n,user:r,project:i,committish:o,treepath:s,path:a,fragment:c,hashformat:l})=>`https://${n}/${r}/${i}/${s}/${t(o||"HEAD")}/${a}${e("#",l(c||""))}`,browseblobtemplate:({domain:n,user:r,project:i,committish:o,blobpath:s,path:a,fragment:c,hashformat:l})=>`https://${n}/${r}/${i}/${s}/${t(o||"HEAD")}/${a}${e("#",l(c||""))}`,docstemplate:({domain:n,user:r,project:i,treepath:o,committish:s})=>`https://${n}/${r}/${i}${e("/",o,"/",t(s))}#readme`,httpstemplate:({auth:t,domain:n,user:r,project:i,committish:o})=>`git+https://${e(t,"@")}${n}/${r}/${i}.git${e("#",o)}`,filetemplate:({domain:e,user:n,project:r,committish:i,path:o})=>`https://${e}/${n}/${r}/raw/${t(i||"HEAD")}/${o}`,shortcuttemplate:({type:t,user:n,project:r,committish:i})=>`${t}:${n}/${r}${e("#",i)}`,pathtemplate:({user:t,project:n,committish:r})=>`${t}/${n}${e("#",r)}`,bugstemplate:({domain:e,user:t,project:n})=>`https://${e}/${t}/${n}/issues`,hashformat:n},i={};i.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:n,user:r,project:i,committish:o,path:s})=>`https://${e(n,"@")}raw.githubusercontent.com/${r}/${i}/${t(o||"HEAD")}/${s}`,gittemplate:({auth:t,domain:n,user:r,project:i,committish:o})=>`git://${e(t,"@")}${n}/${r}/${i}.git${e("#",o)}`,tarballtemplate:({domain:e,user:n,project:r,committish:i})=>`https://codeload.${e}/${n}/${r}/tar.gz/${t(i||"HEAD")}`,extract:e=>{let[,t,n,r,i]=e.pathname.split("/",5);if((!r||"tree"===r)&&(r||(i=e.hash.slice(1)),n&&n.endsWith(".git")&&(n=n.slice(0,-4)),t&&n))return{user:t,project:n,committish:i}}},i.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:n,user:r,project:i,committish:o,treepath:s,path:a,editpath:c})=>`https://${n}/${r}/${i}${e("/",s,"/",t(o||"HEAD"),"/",a,c)}`,tarballtemplate:({domain:e,user:n,project:r,committish:i})=>`https://${e}/${n}/${r}/get/${t(i||"HEAD")}.tar.gz`,extract:e=>{let[,t,n,r]=e.pathname.split("/",4);if(!["get"].includes(r)&&(n&&n.endsWith(".git")&&(n=n.slice(0,-4)),t&&n))return{user:t,project:n,committish:e.hash.slice(1)}}},i.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:t,domain:n,user:r,project:i,committish:o})=>`git+https://${e(t,"@")}${n}/${r}/${i}.git${e("#",o)}`,tarballtemplate:({domain:e,user:n,project:r,committish:i})=>`https://${e}/${n}/${r}/repository/archive.tar.gz?ref=${t(i||"HEAD")}`,extract:e=>{const t=e.pathname.slice(1);if(t.includes("/-/")||t.includes("/archive.tar.gz"))return;const n=t.split("/");let r=n.pop();r.endsWith(".git")&&(r=r.slice(0,-4));const i=n.join("/");return i&&r?{user:i,project:r,committish:e.hash.slice(1)}:void 0}},i.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:t,project:n,committish:r})=>`git@${t}:${n}.git${e("#",r)}`,sshurltemplate:({domain:t,project:n,committish:r})=>`git+ssh://git@${t}/${n}.git${e("#",r)}`,edittemplate:({domain:n,user:r,project:i,committish:o,editpath:s})=>`https://${n}/${r}/${i}${e("/",t(o))}/${s}`,browsetemplate:({domain:n,project:r,committish:i})=>`https://${n}/${r}${e("/",t(i))}`,browsetreetemplate:({domain:n,project:r,committish:i,path:o,hashformat:s})=>`https://${n}/${r}${e("/",t(i))}${e("#",s(o))}`,browseblobtemplate:({domain:n,project:r,committish:i,path:o,hashformat:s})=>`https://${n}/${r}${e("/",t(i))}${e("#",s(o))}`,docstemplate:({domain:n,project:r,committish:i})=>`https://${n}/${r}${e("/",t(i))}`,httpstemplate:({domain:t,project:n,committish:r})=>`git+https://${t}/${n}.git${e("#",r)}`,filetemplate:({user:n,project:r,committish:i,path:o})=>`https://gist.githubusercontent.com/${n}/${r}/raw${e("/",t(i))}/${o}`,shortcuttemplate:({type:t,project:n,committish:r})=>`${t}:${n}${e("#",r)}`,pathtemplate:({project:t,committish:n})=>`${t}${e("#",n)}`,bugstemplate:({domain:e,project:t})=>`https://${e}/${t}`,gittemplate:({domain:t,project:n,committish:r})=>`git://${t}/${n}.git${e("#",r)}`,tarballtemplate:({project:e,committish:n})=>`https://codeload.github.com/gist/${e}/tar.gz/${t(n||"HEAD")}`,extract:e=>{let[,t,n,r]=e.pathname.split("/",4);if("raw"!==r){if(!n){if(!t)return;n=t,t=null}return n.endsWith(".git")&&(n=n.slice(0,-4)),{user:t,project:n,committish:e.hash.slice(1)}}},hashformat:function(e){return e&&"file-"+n(e)}},i.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:e,user:n,project:r,committish:i,path:o})=>`https://${e}/${n}/${r}/blob/${t(i)||"HEAD"}/${o}`,httpstemplate:({domain:t,user:n,project:r,committish:i})=>`https://${t}/${n}/${r}.git${e("#",i)}`,tarballtemplate:({domain:e,user:n,project:r,committish:i})=>`https://${e}/${n}/${r}/archive/${t(i)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:e=>{let[,t,n,r]=e.pathname.split("/",4);if(!["archive"].includes(r)&&(n&&n.endsWith(".git")&&(n=n.slice(0,-4)),t&&n))return{user:t,project:n,committish:e.hash.slice(1)}}};for(const[e,t]of Object.entries(i))i[e]=Object.assign({},r,t);return nt=i}(),n=mt(),r=ht(),i=new e({max:1e3});class o{constructor(e,t,n,r,i,s,a={}){Object.assign(this,o.#V[e],{type:e,user:t,auth:n,project:r,committish:i,default:s,opts:a})}static#V={byShortcut:{},byDomain:{}};static#W={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(e,t){o.#V[e]=t,o.#V.byDomain[t.domain]=e,o.#V.byShortcut[`${e}:`]=e,o.#W[`${e}:`]={name:e}}static fromUrl(e,t){if("string"!=typeof e)return;const r=e+JSON.stringify(t||{});if(!i.has(r)){const s=n(e,t,{gitHosts:o.#V,protocols:o.#W});i.set(r,s?new o(...s):void 0)}return i.get(r)}static fromManifest(e,t={}){if(!e||"object"!=typeof e)return;const n=e.repository,r=n&&("string"==typeof n?n:"object"==typeof n&&"string"==typeof n.url?n.url:null);if(!r)throw new Error("no repository");const i=r&&o.fromUrl(r.replace(/^git\+/,""),t)||null;if(i)return i;const s=function(e){try{const{protocol:t,hostname:n,pathname:r}=new URL(e);if(!n)return null;return`${/(?:git\+)http:$/.test(t)?"http:":"https:"}//${n}${r.replace(/\.git$/,"")}`}catch{return null}}(r);return o.fromUrl(s,t)||s}static parseUrl(e){return r(e)}#Y(e,t){if("function"!=typeof e)return null;const n={...this,...this.opts,...t};n.path||(n.path=""),n.path.startsWith("/")&&(n.path=n.path.slice(1)),n.noCommittish&&(n.committish=null);const r=e(n);return n.noGitPlus&&r.startsWith("git+")?r.slice(4):r}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#Y(this.sshtemplate,e)}sshurl(e){return this.#Y(this.sshurltemplate,e)}browse(e,...t){return"string"!=typeof e?this.#Y(this.browsetemplate,e):"string"!=typeof t[0]?this.#Y(this.browsetreetemplate,{...t[0],path:e}):this.#Y(this.browsetreetemplate,{...t[1],fragment:t[0],path:e})}browseFile(e,...t){return"string"!=typeof t[0]?this.#Y(this.browseblobtemplate,{...t[0],path:e}):this.#Y(this.browseblobtemplate,{...t[1],fragment:t[0],path:e})}docs(e){return this.#Y(this.docstemplate,e)}bugs(e){return this.#Y(this.bugstemplate,e)}https(e){return this.#Y(this.httpstemplate,e)}git(e){return this.#Y(this.gittemplate,e)}shortcut(e){return this.#Y(this.shortcuttemplate,e)}path(e){return this.#Y(this.pathtemplate,e)}tarball(e){return this.#Y(this.tarballtemplate,{...e,noCommittish:!1})}file(e,t){return this.#Y(this.filetemplate,{...t,path:e})}edit(e,t){return this.#Y(this.edittemplate,{...t,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&"function"==typeof this[this.default]?this[this.default](e):this.sshurl(e)}}for(const[e,n]of Object.entries(t))o.addHost(e,n);return ct=o}var vt,yt,Et={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}};function bt(){if(yt)return vt;yt=1;var{URL:e}=u,t=ke(),n=Fe(),r=et(),i=gt(),{isBuiltin:o}=d,s=["dependencies","devDependencies","optionalDependencies"],a=ft?ut:(ft=1,ut=function(e){if(!e)return;if("ERROR: No README data found!"===e)return;e=e.trim().split("\n");let t=0;for(;e[t]&&e[t].trim().match(/^(#|$)/);)t++;const n=e.length;let r=t+1;for(;r<n&&e[r].trim();)r++;return e.slice(t,r).join(" ").trim()}),c=Et,l=e=>e.includes("@")&&e.indexOf("@")<e.lastIndexOf(".");function f(e,t){return e.author&&(e.author=t(e.author)),["maintainers","contributors"].forEach(function(n){Array.isArray(e[n])&&(e[n]=e[n].map(t))}),e}function p(e){if("string"==typeof e)return e;var t=e.name||"",n=e.url||e.web,r=n?" ("+n+")":"",i=e.email||e.mail;return t+(i?" <"+i+">":"")+r}function h(e){if("string"!=typeof e)return e;var t=e.match(/^([^(<]+)/),n=e.match(/\(([^()]+)\)/),r=e.match(/<([^<>]+)>/),i={};return t&&t[0].trim()&&(i.name=t[0].trim()),r&&(i.email=r[1]),n&&(i.url=n[1]),i}return vt={warn:function(){},fixRepositoryField:function(e){if(e.repositories&&(this.warn("repositories"),e.repository=e.repositories[0]),!e.repository)return this.warn("missingRepository");"string"==typeof e.repository&&(e.repository={type:"git",url:e.repository});var t=e.repository.url||"";if(t){var n=i.fromUrl(t);n&&(t=e.repository.url="shortcut"===n.getDefaultRepresentation()?n.https():n.toString())}t.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",t)},fixTypos:function(e){Object.keys(c.topLevel).forEach(function(t){Object.prototype.hasOwnProperty.call(e,t)&&this.warn("typo",t,c.topLevel[t])},this)},fixScriptsField:function(e){if(e.scripts)return"object"!=typeof e.scripts?(this.warn("nonObjectScripts"),void delete e.scripts):void Object.keys(e.scripts).forEach(function(t){"string"!=typeof e.scripts[t]?(this.warn("nonStringScript"),delete e.scripts[t]):c.script[t]&&!e.scripts[c.script[t]]&&this.warn("typo",t,c.script[t],"scripts")},this)},fixFilesField:function(e){var t=e.files;t&&!Array.isArray(t)?(this.warn("nonArrayFiles"),delete e.files):e.files&&(e.files=e.files.filter(function(e){return!(!e||"string"!=typeof e)||(this.warn("invalidFilename",e),!1)},this))},fixBinField:function(e){if(e.bin&&"string"==typeof e.bin){var t,n={};(t=e.name.match(/^@[^/]+[/](.*)$/))?n[t[1]]=e.bin:n[e.name]=e.bin,e.bin=n}},fixManField:function(e){e.man&&"string"==typeof e.man&&(e.man=[e.man])},fixBundleDependenciesField:function(e){var t="bundledDependencies",n="bundleDependencies";e[t]&&!e[n]&&(e[n]=e[t],delete e[t]),e[n]&&!Array.isArray(e[n])?(this.warn("nonArrayBundleDependencies"),delete e[n]):e[n]&&(e[n]=e[n].filter(function(t){return t&&"string"==typeof t?(e.dependencies||(e.dependencies={}),Object.prototype.hasOwnProperty.call(e.dependencies,t)||(this.warn("nonDependencyBundleDependency",t),e.dependencies[t]="*"),!0):(this.warn("nonStringBundleDependency",t),!1)},this))},fixDependencies:function(e){!function(e,t){s.forEach(function(n){e[n]&&(e[n]=function(e,t,n){if(!e)return{};"string"==typeof e&&(e=e.trim().split(/[\n\r\s\t ,]+/));if(!Array.isArray(e))return e;n("deprecatedArrayDependencies",t);var r={};return e.filter(function(e){return"string"==typeof e}).forEach(function(e){var t=(e=e.trim().split(/(:?[@\s><=])/)).shift(),n=e.join("");n=(n=n.trim()).replace(/^@/,""),r[t]=n}),r}(e[n],n,t))})}(e,this.warn),function(e){var t=e.optionalDependencies;if(!t)return;var n=e.dependencies||{};Object.keys(t).forEach(function(e){n[e]=t[e]}),e.dependencies=n}(e,this.warn),this.fixBundleDependenciesField(e),["dependencies","devDependencies"].forEach(function(t){if(t in e)return e[t]&&"object"==typeof e[t]?void Object.keys(e[t]).forEach(function(n){var r=e[t][n];"string"!=typeof r&&(this.warn("nonStringDependency",n,JSON.stringify(r)),delete e[t][n]);var o=i.fromUrl(e[t][n]);o&&(e[t][n]=o.toString())},this):(this.warn("nonObjectDependencies",t),void delete e[t])},this)},fixModulesField:function(e){e.modules&&(this.warn("deprecatedModules"),delete e.modules)},fixKeywordsField:function(e){"string"==typeof e.keywords&&(e.keywords=e.keywords.split(/,\s+/)),e.keywords&&!Array.isArray(e.keywords)?(delete e.keywords,this.warn("nonArrayKeywords")):e.keywords&&(e.keywords=e.keywords.filter(function(e){return!("string"!=typeof e||!e)||(this.warn("nonStringKeyword"),!1)},this))},fixVersionField:function(e,r){var i=!r;if(!e.version)return e.version="",!0;if(!t(e.version,i))throw new Error('Invalid version: "'+e.version+'"');return e.version=n(e.version,i),!0},fixPeople:function(e){f(e,p),f(e,h)},fixNameField:function(e,t){"boolean"==typeof t?t={strict:t}:void 0===t&&(t={});var n=t.strict;if(e.name||n){if("string"!=typeof e.name)throw new Error("name field must be a string.");n||(e.name=e.name.trim()),function(e,t,n){if("."===e.charAt(0)||!function(e){if("@"!==e.charAt(0))return!1;var t=e.slice(1).split("/");if(2!==t.length)return!1;return t[0]&&t[1]&&t[0]===encodeURIComponent(t[0])&&t[1]===encodeURIComponent(t[1])}(e)&&(r=e,r.match(/[/@\s+%:]/)||r!==encodeURIComponent(r))||t&&!n&&e!==e.toLowerCase()||"node_modules"===e.toLowerCase()||"favicon.ico"===e.toLowerCase())throw new Error("Invalid name: "+JSON.stringify(e));var r}(e.name,n,t.allowLegacyCase),o(e.name)&&this.warn("conflictingName",e.name)}else e.name=""},fixDescriptionField:function(e){e.description&&"string"!=typeof e.description&&(this.warn("nonStringDescription"),delete e.description),e.readme&&!e.description&&(e.description=a(e.readme)),void 0===e.description&&delete e.description,e.description||this.warn("missingDescription")},fixReadmeField:function(e){e.readme||(this.warn("missingReadme"),e.readme="ERROR: No README data found!")},fixBugsField:function(t){if(!t.bugs&&t.repository&&t.repository.url){var n=i.fromUrl(t.repository.url);n&&n.bugs()&&(t.bugs={url:n.bugs()})}else if(t.bugs){if("string"==typeof t.bugs)l(t.bugs)?t.bugs={email:t.bugs}:e.canParse(t.bugs)?t.bugs={url:t.bugs}:this.warn("nonEmailUrlBugsString");else{!function(e,t){if(!e)return;Object.keys(e).forEach(function(n){c.bugs[n]&&(t("typo",n,c.bugs[n],"bugs"),e[c.bugs[n]]=e[n],delete e[n])})}(t.bugs,this.warn);var r=t.bugs;t.bugs={},r.url&&(e.canParse(r.url)?t.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&("string"==typeof r.email&&l(r.email)?t.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}t.bugs.email||t.bugs.url||(delete t.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(t){if(!t.homepage&&t.repository&&t.repository.url){var n=i.fromUrl(t.repository.url);n&&n.docs()&&(t.homepage=n.docs())}if(t.homepage)return"string"!=typeof t.homepage?(this.warn("nonUrlHomepage"),delete t.homepage):void(e.canParse(t.homepage)||(t.homepage="http://"+t.homepage))},fixLicenseField:function(e){const t=e.license||e.licence;return t?"string"!=typeof t||t.length<1||""===t.trim()?this.warn("invalidLicense"):r(t).validForNewPackages?void 0:this.warn("invalidLicense"):this.warn("missingLicense")}},vt}var wt,Lt,St,Ct,It={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."};function _t(){if(Lt)return wt;Lt=1;var e=h,t=It;function n(n,r,i){return i&&(n=i+"['"+n+"']",r=i+"['"+r+"']"),e.format(t.typo,n,r)}return wt=function(){var r=Array.prototype.slice.call(arguments,0),i=r.shift();if("typo"===i)return n.apply(null,r);var o=t[i]?t[i]:i+": '%s'";return r.unshift(o),e.format.apply(null,r)},wt}var Dt=function(){if(Ct)return St;Ct=1,St=r;var e=bt();r.fixer=e;var t=_t(),n=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"].map(function(e){return i(e)+"Field"});function r(r,o,s){!0===o&&(o=null,s=!0),s||(s=!1),o&&!r.private||(o=function(){}),r.scripts&&"node-gyp rebuild"===r.scripts.install&&!r.scripts.preinstall&&(r.gypfile=!0),e.warn=function(){o(t.apply(null,arguments))},n.forEach(function(t){e["fix"+i(t)](r,s)}),r._id=r.name+"@"+r.version}function i(e){return e.charAt(0).toUpperCase()+e.slice(1)}return n=n.concat(["dependencies","people","typos"]),St}(),Ot=ue(Dt);const Nt=(e,t)=>{try{return m(e,g.F_OK),!0}catch(e){return!1}},At=["index.ts","index.tsx","main.ts","main.tsx"],Pt=(e,t,n)=>{const r=o(e??process.cwd(),"src"),i=At,s=i.map(e=>o(r,e)).find(e=>Nt(e));if(!s)throw new Error(`Unable to resolve entry point, ensure ${i.join(", ")} exists in ${r}`);return s},Tt=(e,t)=>_(e,t,{arrayMerge:(e,t)=>{const n=t[0]??e[0];return"object"==typeof n&&"match"in n&&"middleware"in n?((e,t,n)=>{const r=n.reduce((t,n)=>Object.assign(t,{[String(n[e])]:n}),{}),i={...t.reduce((t,n)=>Object.assign(t,{[String(n[e])]:n}),{}),...r};return Object.values(i)})("match",e,t):[...new Set([...e,...t])]}}),Rt=async(n,o)=>{const{packageJson:c,root:l}=o,{config:u}=await e(n)??{},f=c.main??c.module??"./dist/bundle.js",p=Pt(l);if("build"===n.command){if(i(f)===l)throw new Error("outDir cannot be root, please specify package.main or package.module in package.json");if("src"===i(f))throw new Error("outDir cannot be src, please specify package.main or package.module in package.json");if(i(f)===process.cwd())throw new Error("outDir cannot be the current working directory, please specify package.main or package.module in package.json")}return t({root:l,plugins:[r()],define:{"process.env.NODE_ENV":JSON.stringify(n.mode),"process.env.NODE_DEBUG":"production"!==n.mode,"process.env.FUSION_LOG_LEVEL":"production"===n.mode?1:3},build:{outDir:i(f),lib:{entry:p,fileName:s(f,a(f)),formats:["es"]},emptyOutDir:!0}},u??{})};function $t(e,t){D("object"==typeof e,t)}const xt=e=>{if(e.repository)return"string"==typeof e.repository?e.repository:e.repository.url},kt=()=>{try{return O("git remote get-url origin").toString().trim().replace("git@github.com:","https://github.com/").replace(/\.git$/,"")}catch(e){return}},Ft=(e="HEAD")=>{try{return O(`git rev-parse ${e}`).toString().trim()}catch(e){return}},Ut="13.0.1",Bt=()=>{const e={cliVersion:Ut,source:"local",reason:"manual"};if(process.env.GITHUB_ACTIONS){const t=(()=>{const e=process.env.GITHUB_EVENT_NAME||"unknown",t=process.env.GITHUB_ACTOR||"unknown",n=process.env.GITHUB_RUN_ID||"unknown",r=process.env.GITHUB_REPOSITORY||"unknown",i=process.env.GITHUB_WORKFLOW||"unknown",o=process.env.GITHUB_SERVER_URL||"https://github.com";let s="unknown";"unknown"!==r&&"unknown"!==n&&(s=`${o.replace(/\/$/,"")}/${r}/actions/runs/${n}`);const a={eventName:e,actor:t,runId:n,runUrl:s,workflow:i};if(process.env.GITHUB_EVENT_PATH)try{const e=v(process.env.GITHUB_EVENT_PATH,"utf8");Object.assign(a,JSON.parse(e))}catch{console.error("Failed to parse GitHub event payload")}return a})(),n={...e,source:"github",reason:t.eventName,workflow:t.workflow,runId:t.runId,runUrl:t.runUrl,commitId:t.head_commit?.id,repository:t.repository?.name,repository_homepage:t.repository?.homepage,repository_license:t.repository?.license?.name,repository_owner:t.repository?.owner?.login,repository_owner_avatar_url:t.repository?.owner?.avatar_url,actor:t.actor,sender_login:t.sender?.login,sender_avatar_url:t.sender?.avatar_url};return t.pull_request?{...n,branch:t.pull_request.head?.ref,commitId:t.pull_request.head?.sha,htmlUrl:t.pull_request.html_url}:t.release?{...n,tag:t.release.tag_name,htmlUrl:t.release.html_url}:n}if(process.env.SYSTEM_TEAMPROJECT){const t=(()=>{const e=process.env.BUILD_BUILDID||"unknown",t=process.env.BUILD_DEFINITIONNAME||"unknown",n=process.env.BUILD_REPOSITORY_NAME||"unknown",r=process.env.SYSTEM_TEAMPROJECT||"unknown",i=process.env.SYSTEM_COLLECTIONURI||"unknown",o=process.env.BUILD_REQUESTEDFOR||"unknown",s=process.env.BUILD_SOURCEBRANCH||"unknown",a=process.env.BUILD_SOURCEVERSION||"unknown",c=process.env.BUILD_REASON||"unknown";let l="unknown";return"unknown"!==i&&"unknown"!==r&&"unknown"!==e&&(l=`${i.replace(/\/$/,"")}${r}/_build/results?buildId=${e}`),{runId:e,pipelineName:t,repository:n,project:r,orgUrl:i,actor:o,branch:s,commitId:a,runUrl:l,reason:c}})();return{...e,source:"azure_devops",reason:t.reason,repository:t.repository,runId:t.runId,runUrl:t.runUrl,actor:t.actor,branch:t.branch,commitId:t.commitId,workflow:t.pipelineName}}return e},Mt=["png","jpg","jpeg","gif","svg","ico","webp","mp4","webm","mp3","woff2","woff","eot","ttf","otf","pdf","md","txt"],Gt=(e,t)=>{$t(t,"expected packageJson"),D(t.name,"expected [name] in packageJson"),D(t.version,"expected [version] in packageJson");const n=((e,t)=>"build"===e.command||e.isPreview?t.main||t.module||"dist/app-bundle.js":Pt(e.root))(e,t),r=t.name.replace(/^@|\w.*\//gm,""),i=t.version,o="build"===e.command?void 0:`/bundles/apps/${r}@${i}`,s=xt(t)??kt();return{appKey:r,displayName:t.name,description:t.description||"",keywords:t.keywords,type:"standalone",build:{entryPoint:n,assetPath:o,githubRepo:s,version:i,timestamp:(new Date).toISOString(),commitSha:Ft(),annotations:Bt(),projectPage:t.homepage,allowedExtensions:Mt.map(e=>`.${e}`)}}},jt=(e,t)=>_(e,t),zt=A.object({environment:A.record(A.string(),A.any()).describe("Key-value map of environment-specific variables for the application. Defaults to an empty object if not provided.").optional().default({}),endpoints:A.record(A.string(),A.object({url:A.string({message:"The endpoint URL. This field is required."}),scopes:A.array(A.string()).optional().default([]).describe("List of scopes required for accessing this endpoint. Defaults to an empty array.")})).describe("A mapping of endpoint names to their configuration objects. Each endpoint must specify a URL and may specify scopes.").optional()}).describe("The API application configuration schema, defining environment variables and endpoints for the application."),Ht=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],qt=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],Vt=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],Wt=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],Yt=(e,t,n)=>{let r=e;return"string"==typeof t||Array.isArray(t)?r=e.toLocaleString(t,n):!0!==t&&void 0===n||(r=e.toLocaleString(void 0,n)),r},Kt=e=>{if("number"==typeof e)return Math.log10(e);const t=e.toString(10);return t.length+Math.log10(`0.${t.slice(0,15)}`)},Xt=(e,t)=>{if(void 0===t)return e;if("number"!=typeof t||!Number.isSafeInteger(t)||t<0)throw new TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof t}: ${t}`);return 0===t?e:e.length<t?e.padStart(t," "):e};function Zt(e,t){if("bigint"!=typeof e&&!Number.isFinite(e))throw new TypeError(`Expected a finite number, got ${typeof e}: ${e}`);const n=(t={bits:!1,binary:!1,space:!0,nonBreakingSpace:!1,...t}).bits?t.binary?Wt:Vt:t.binary?qt:Ht,r=t.space?t.nonBreakingSpace?" ":" ":"",i="number"==typeof e?0===e:0n===e;if(t.signed&&i){return Xt(` 0${r}${n[0]}`,t.fixedWidth)}const o=e<0,s=o?"-":t.signed?"+":"";o&&(e=-e);const a=(e=>{const{minimumFractionDigits:t,maximumFractionDigits:n}=e;if(void 0!==t||void 0!==n)return{...void 0!==t&&{minimumFractionDigits:t},...void 0!==n&&{maximumFractionDigits:n},roundingMode:"trunc"}})(t);let c;if(e<1){c=s+Yt(e,t.locale,a)+r+n[0]}else{const i=Math.min(Math.floor(t.binary?("number"==typeof(l=e)?Math.log(l):Kt(l)*Math.log(10))/Math.log(1024):Kt(e)/3),n.length-1);if(e=((e,t)=>{if("number"==typeof e)return e/t;const n=e/BigInt(t),r=e%BigInt(t);return Number(n)+Number(r)/t})(e,(t.binary?1024:1e3)**i),!a){const t=Math.max(3,Math.floor(e).toString().length);e=e.toPrecision(t)}c=s+Yt(Number(e),t.locale,a)+r+n[i]}var l;return Xt(c,t.fixedWidth)}const Jt=(e,t)=>le.blueBright(t?.relative?`./${c(t?.cwd??process.cwd(),e)}`:e),Qt=e=>"string"==typeof e?Qt(y(e).size):le.yellowBright(Zt(e)),en=async(e,t,n)=>{const r=Gt(e,t.packageJson);try{n?.log?.start("loading application package...");const{manifest:t,path:i}=await(async(e,t)=>{const n=t?.file??[`app.manifest.${e.environment}`,"app.manifest","app.manifest.config"],r=await C(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async n=>{const r=t?.base??{};if("function"==typeof n.default){const t=await n.default(e,{base:r});return jt(r,t??{})}return jt(r,n.default??{})}}});return{manifest:r.config,path:r.path,extension:r.extension}})(e,{base:r,file:n?.manifestPath});if(!t.build)throw new Error(`Application manifest for ${t.appKey} does not contain build information, please check the manifest file.`);return"serve"===e.command&&(t.build.assetPath=`/bundles/apps/${t.appKey}/${t.build.version}`),n?.log?.succeed("generated manifest from",Jt(i,{relative:!0})),t}catch(e){if(e instanceof I){if(n?.manifestPath){const t=new Error(`Failed to load manifest file ${Jt(n.manifestPath)}, please check the path.`,{cause:e});throw n?.log?.fail(t.message),t}return n?.log?.succeed(le.dim("no local manifest config applied, using default generated from package")),r}throw n?.log?.fail(`failed to resolve application manifest ${n?.manifestPath?Jt(n?.manifestPath):""}`),e}};async function tn(e){e?.start("resolve project package");try{const t=await(async e=>{const t=await l({...e,normalize:!1});if(!t)throw new Error("failed to find package.json");const n={...t.packageJson};return Ot(n),{packageJson:{...n,version:t.packageJson.version},path:t.path,root:i(t.path)}})();return e?.succeed("📦",le.yellowBright([t.packageJson.name,t.packageJson.version].join("@"))),e?.info("🏠",le.blueBright(t.root)),t}catch(t){throw e?.fail("☠️","failed to resolve project package"),t}}const nn=async e=>{const{log:t}=e??{},n=await tn(t);t?.debug("package",n);const r={command:"build",mode:process.env.NODE_ENV??"production",root:n.root,...e?.env};t?.debug("env:",r);const i=await en(r,n,{log:t,manifestPath:e?.manifest});return t?.debug("manifest:",i),{manifest:i,pkg:n,env:r}},rn=async e=>{const{log:t}=e??{};t?.log(le.bold("Starting to build application"));const{manifest:r,pkg:i,env:o}=await nn({log:t,manifest:e?.manifest});t?.start("loading vite config...");const s=await Rt(o,i);t?.succeed("vite config applied"),t?.debug("vite config:",s),t?.start("🤞🏻","building application..."),t?.startNativeConsoleCapture(),await n(s),t?.stopNativeConsoleCapture(),t?.succeed("build completed 😘");return{pkg:i,manifest:r,outDir:s.build.outDir}};var on,sn,an={exports:{}};function cn(){return sn?on:(sn=1,on={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24})}var ln,un,fn,pn,dn,hn,mn,gn,vn={};function yn(){return ln||(ln=1,function(e){const t={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function n(e){return function(...t){return t.length&&(e=e.replace(/\{(\d)\}/g,(e,n)=>t[n]||"")),new Error("ADM-ZIP: "+e)}}for(const r of Object.keys(t))e[r]=n(t[r])}(vn)),vn}function En(){return gn||(gn=1,an.exports=function(){if(fn)return un;fn=1;const e=P,t=T,n=cn(),r=yn(),i="object"==typeof process&&"win32"===process.platform,o=e=>"object"==typeof e&&null!==e,s=new Uint32Array(256).map((e,t)=>{for(let e=0;e<8;e++)1&t?t=3988292384^t>>>1:t>>>=1;return t>>>0});function a(n){this.sep=t.sep,this.fs=e,o(n)&&o(n.fs)&&"function"==typeof n.fs.statSync&&(this.fs=n.fs)}return un=a,a.prototype.makeDir=function(e){const t=this;!function(e){let n=e.split(t.sep)[0];e.split(t.sep).forEach(function(e){if(e&&":"!==e.substr(-1,1)){var i;n+=t.sep+e;try{i=t.fs.statSync(n)}catch(e){t.fs.mkdirSync(n)}if(i&&i.isFile())throw r.FILE_IN_THE_WAY(`"${n}"`)}})}(e)},a.prototype.writeFileTo=function(e,n,r,i){const o=this;if(o.fs.existsSync(e)){if(!r)return!1;if(o.fs.statSync(e).isDirectory())return!1}var s,a=t.dirname(e);o.fs.existsSync(a)||o.makeDir(a);try{s=o.fs.openSync(e,"w",438)}catch(t){o.fs.chmodSync(e,438),s=o.fs.openSync(e,"w",438)}if(s)try{o.fs.writeSync(s,n,0,n.length,0)}finally{o.fs.closeSync(s)}return o.fs.chmodSync(e,i||438),!0},a.prototype.writeFileToAsync=function(e,n,r,i,o){"function"==typeof i&&(o=i,i=void 0);const s=this;s.fs.exists(e,function(a){if(a&&!r)return o(!1);s.fs.stat(e,function(r,c){if(a&&c.isDirectory())return o(!1);var l=t.dirname(e);s.fs.exists(l,function(t){t||s.makeDir(l),s.fs.open(e,"w",438,function(t,r){t?s.fs.chmod(e,438,function(){s.fs.open(e,"w",438,function(t,r){s.fs.write(r,n,0,n.length,0,function(){s.fs.close(r,function(){s.fs.chmod(e,i||438,function(){o(!0)})})})})}):r?s.fs.write(r,n,0,n.length,0,function(){s.fs.close(r,function(){s.fs.chmod(e,i||438,function(){o(!0)})})}):s.fs.chmod(e,i||438,function(){o(!0)})})})})})},a.prototype.findFiles=function(e){const n=this;return function e(r,i,o){let s=[];return n.fs.readdirSync(r).forEach(function(a){const c=t.join(r,a),l=n.fs.statSync(c);s.push(t.normalize(c)+(l.isDirectory()?n.sep:"")),l.isDirectory()&&o&&(s=s.concat(e(c,i,o)))}),s}(e,void 0,!0)},a.prototype.findFilesAsync=function(e,n){const r=this;let i=[];r.fs.readdir(e,function(o,s){if(o)return n(o);let a=s.length;if(!a)return n(null,i);s.forEach(function(o){o=t.join(e,o),r.fs.stat(o,function(e,s){if(e)return n(e);s&&(i.push(t.normalize(o)+(s.isDirectory()?r.sep:"")),s.isDirectory()?r.findFilesAsync(o,function(e,t){if(e)return n(e);i=i.concat(t),--a||n(null,i)}):--a||n(null,i))})})})},a.prototype.getAttributes=function(){},a.prototype.setAttributes=function(){},a.crc32update=function(e,t){return s[255&(e^t)]^e>>>8},a.crc32=function(e){"string"==typeof e&&(e=Buffer.from(e,"utf8"));let t=e.length,n=-1;for(let r=0;r<t;)n=a.crc32update(n,e[r++]);return~n>>>0},a.methodToString=function(e){switch(e){case n.STORED:return"STORED ("+e+")";case n.DEFLATED:return"DEFLATED ("+e+")";default:return"UNSUPPORTED ("+e+")"}},a.canonical=function(e){if(!e)return"";const n=t.posix.normalize("/"+e.split("\\").join("/"));return t.join(".",n)},a.zipnamefix=function(e){if(!e)return"";const n=t.posix.normalize("/"+e.split("\\").join("/"));return t.posix.join(".",n)},a.findLast=function(e,t){if(!Array.isArray(e))throw new TypeError("arr is not array");for(let n=(e.length>>>0)-1;n>=0;n--)if(t(e[n],n,e))return e[n]},a.sanitize=function(e,n){e=t.resolve(t.normalize(e));for(var r=n.split("/"),i=0,o=r.length;i<o;i++){var s=t.normalize(t.join(e,r.slice(i,o).join(t.sep)));if(0===s.indexOf(e))return s}return t.normalize(t.join(e,t.basename(n)))},a.toBuffer=function(e,t){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):"string"==typeof e?t(e):Buffer.alloc(0)},a.readBigUInt64LE=function(e,t){var n=Buffer.from(e.slice(t,t+8));return n.swap64(),parseInt(`0x${n.toString("hex")}`)},a.fromDOS2Date=function(e){return new Date(1980+(e>>25&127),Math.max((e>>21&15)-1,0),Math.max(e>>16&31,1),e>>11&31,e>>5&63,(31&e)<<1)},a.fromDate2DOS=function(e){let t=0,n=0;return e.getFullYear()>1979&&(t=(e.getFullYear()-1980&127)<<9|e.getMonth()+1<<5|e.getDate(),n=e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1),t<<16|n},a.isWin=i,a.crcTable=s,un}(),an.exports.Constants=cn(),an.exports.Errors=yn(),an.exports.FileAttr=function(){if(dn)return pn;dn=1;const e=T;return pn=function(t,{fs:n}){var r=t||"",i={directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0},o=null;return r&&n.existsSync(r)?(o=n.statSync(r),i.directory=o.isDirectory(),i.mtime=o.mtime,i.atime=o.atime,i.executable=!!(73&o.mode),i.readonly=!(128&o.mode),i.hidden="."===e.basename(r)[0]):console.warn("Invalid path: "+r),{get directory(){return i.directory},get readOnly(){return i.readonly},get hidden(){return i.hidden},get mtime(){return i.mtime},get atime(){return i.atime},get executable(){return i.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:r,isDirectory:i.directory,isReadOnly:i.readonly,isHidden:i.hidden,isExecutable:i.executable,mTime:i.mtime,aTime:i.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}(),an.exports.decoder=mn?hn:(mn=1,hn={efs:!0,encode:e=>Buffer.from(e,"utf8"),decode:e=>e.toString("utf8")})),an.exports}var bn,wn,Ln,Sn,Cn,In={};function _n(){if(wn)return bn;wn=1;var e=En(),t=e.Constants;return bn=function(){var n=20,r=10,i=0,o=0,s=0,a=0,c=0,l=0,u=0,f=0,p=0,d=0,h=0,m=0,g=0;n|=e.isWin?2560:768,i|=t.FLG_EFS;const v={extraLen:0},y=e=>Math.max(0,e)>>>0;return s=e.fromDate2DOS(new Date),{get made(){return n},set made(e){n=e},get version(){return r},set version(e){r=e},get flags(){return i},set flags(e){i=e},get flags_efs(){return(i&t.FLG_EFS)>0},set flags_efs(e){e?i|=t.FLG_EFS:i&=~t.FLG_EFS},get flags_desc(){return(i&t.FLG_DESC)>0},set flags_desc(e){e?i|=t.FLG_DESC:i&=~t.FLG_DESC},get method(){return o},set method(e){switch(e){case t.STORED:this.version=10;case t.DEFLATED:default:this.version=20}o=e},get time(){return e.fromDOS2Date(this.timeval)},set time(t){this.timeval=e.fromDate2DOS(t)},get timeval(){return s},set timeval(e){s=y(e)},get timeHighByte(){return e=s>>>8,255&Math.max(0,e);var e},get crc(){return a},set crc(e){a=y(e)},get compressedSize(){return c},set compressedSize(e){c=y(e)},get size(){return l},set size(e){l=y(e)},get fileNameLength(){return u},set fileNameLength(e){u=e},get extraLength(){return f},set extraLength(e){f=e},get extraLocalLength(){return v.extraLen},set extraLocalLength(e){v.extraLen=e},get commentLength(){return p},set commentLength(e){p=e},get diskNumStart(){return d},set diskNumStart(e){d=y(e)},get inAttr(){return h},set inAttr(e){h=y(e)},get attr(){return m},set attr(e){m=y(e)},get fileAttr(){return(m||0)>>16&4095},get offset(){return g},set offset(e){g=y(e)},get encrypted(){return(i&t.FLG_ENC)===t.FLG_ENC},get centralHeaderSize(){return t.CENHDR+u+f+p},get realDataOffset(){return g+t.LOCHDR+v.fnameLen+v.extraLen},get localHeader(){return v},loadLocalHeaderFromBinary:function(n){var r=n.slice(g,g+t.LOCHDR);if(r.readUInt32LE(0)!==t.LOCSIG)throw e.Errors.INVALID_LOC();v.version=r.readUInt16LE(t.LOCVER),v.flags=r.readUInt16LE(t.LOCFLG),v.method=r.readUInt16LE(t.LOCHOW),v.time=r.readUInt32LE(t.LOCTIM),v.crc=r.readUInt32LE(t.LOCCRC),v.compressedSize=r.readUInt32LE(t.LOCSIZ),v.size=r.readUInt32LE(t.LOCLEN),v.fnameLen=r.readUInt16LE(t.LOCNAM),v.extraLen=r.readUInt16LE(t.LOCEXT);const i=g+t.LOCHDR+v.fnameLen,o=i+v.extraLen;return n.slice(i,o)},loadFromBinary:function(v){if(v.length!==t.CENHDR||v.readUInt32LE(0)!==t.CENSIG)throw e.Errors.INVALID_CEN();n=v.readUInt16LE(t.CENVEM),r=v.readUInt16LE(t.CENVER),i=v.readUInt16LE(t.CENFLG),o=v.readUInt16LE(t.CENHOW),s=v.readUInt32LE(t.CENTIM),a=v.readUInt32LE(t.CENCRC),c=v.readUInt32LE(t.CENSIZ),l=v.readUInt32LE(t.CENLEN),u=v.readUInt16LE(t.CENNAM),f=v.readUInt16LE(t.CENEXT),p=v.readUInt16LE(t.CENCOM),d=v.readUInt16LE(t.CENDSK),h=v.readUInt16LE(t.CENATT),m=v.readUInt32LE(t.CENATX),g=v.readUInt32LE(t.CENOFF)},localHeaderToBinary:function(){var e=Buffer.alloc(t.LOCHDR);return e.writeUInt32LE(t.LOCSIG,0),e.writeUInt16LE(r,t.LOCVER),e.writeUInt16LE(i,t.LOCFLG),e.writeUInt16LE(o,t.LOCHOW),e.writeUInt32LE(s,t.LOCTIM),e.writeUInt32LE(a,t.LOCCRC),e.writeUInt32LE(c,t.LOCSIZ),e.writeUInt32LE(l,t.LOCLEN),e.writeUInt16LE(u,t.LOCNAM),e.writeUInt16LE(v.extraLen,t.LOCEXT),e},centralHeaderToBinary:function(){var e=Buffer.alloc(t.CENHDR+u+f+p);return e.writeUInt32LE(t.CENSIG,0),e.writeUInt16LE(n,t.CENVEM),e.writeUInt16LE(r,t.CENVER),e.writeUInt16LE(i,t.CENFLG),e.writeUInt16LE(o,t.CENHOW),e.writeUInt32LE(s,t.CENTIM),e.writeUInt32LE(a,t.CENCRC),e.writeUInt32LE(c,t.CENSIZ),e.writeUInt32LE(l,t.CENLEN),e.writeUInt16LE(u,t.CENNAM),e.writeUInt16LE(f,t.CENEXT),e.writeUInt16LE(p,t.CENCOM),e.writeUInt16LE(d,t.CENDSK),e.writeUInt16LE(h,t.CENATT),e.writeUInt32LE(m,t.CENATX),e.writeUInt32LE(g,t.CENOFF),e},toJSON:function(){const s=function(e){return e+" bytes"};return{made:n,version:r,flags:i,method:e.methodToString(o),time:this.time,crc:"0x"+a.toString(16).toUpperCase(),compressedSize:s(c),size:s(l),fileNameLength:s(u),extraLength:s(f),commentLength:s(p),diskNumStart:d,inAttr:h,attr:m,offset:g,centralHeaderSize:s(t.CENHDR+u+f+p)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}function Dn(){return Cn||(Cn=1,In.EntryHeader=_n(),In.MainHeader=function(){if(Sn)return Ln;Sn=1;var e=En(),t=e.Constants;return Ln=function(){var n=0,r=0,i=0,o=0,s=0;return{get diskEntries(){return n},set diskEntries(e){n=r=e},get totalEntries(){return r},set totalEntries(e){r=n=e},get size(){return i},set size(e){i=e},get offset(){return o},set offset(e){o=e},get commentLength(){return s},set commentLength(e){s=e},get mainHeaderSize(){return t.ENDHDR+s},loadFromBinary:function(a){if((a.length!==t.ENDHDR||a.readUInt32LE(0)!==t.ENDSIG)&&(a.length<t.ZIP64HDR||a.readUInt32LE(0)!==t.ZIP64SIG))throw e.Errors.INVALID_END();a.readUInt32LE(0)===t.ENDSIG?(n=a.readUInt16LE(t.ENDSUB),r=a.readUInt16LE(t.ENDTOT),i=a.readUInt32LE(t.ENDSIZ),o=a.readUInt32LE(t.ENDOFF),s=a.readUInt16LE(t.ENDCOM)):(n=e.readBigUInt64LE(a,t.ZIP64SUB),r=e.readBigUInt64LE(a,t.ZIP64TOT),i=e.readBigUInt64LE(a,t.ZIP64SIZE),o=e.readBigUInt64LE(a,t.ZIP64OFF),s=0)},toBinary:function(){var e=Buffer.alloc(t.ENDHDR+s);return e.writeUInt32LE(t.ENDSIG,0),e.writeUInt32LE(0,4),e.writeUInt16LE(n,t.ENDSUB),e.writeUInt16LE(r,t.ENDTOT),e.writeUInt32LE(i,t.ENDSIZ),e.writeUInt32LE(o,t.ENDOFF),e.writeUInt16LE(s,t.ENDCOM),e.fill(" ",t.ENDHDR),e},toJSON:function(){return{diskEntries:n,totalEntries:r,size:i+" bytes",offset:function(e,t){let n=e.toString(16).toUpperCase();for(;n.length<t;)n="0"+n;return"0x"+n}(o,4),commentLength:s}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}()),In}var On,Nn,An,Pn,Tn,Rn,$n,xn,kn,Fn,Un,Bn,Mn,Gn={};function jn(){if(Rn)return Tn;Rn=1;const{randomFillSync:e}=$,t=yn(),n=new Uint32Array(256).map((e,t)=>{for(let e=0;e<8;e++)1&t?t=t>>>1^3988292384:t>>>=1;return t>>>0}),r=(e,t)=>Math.imul(e,t)>>>0,i=(e,t)=>n[255&(e^t)]^e>>>8,o=()=>"function"==typeof e?e(Buffer.alloc(12)):o.node();o.node=()=>{const e=Buffer.alloc(12),t=e.length;for(let n=0;n<t;n++)e[n]=256*Math.random()&255;return e};const s={genSalt:o};function a(e){const t=Buffer.isBuffer(e)?e:Buffer.from(e);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let e=0;e<t.length;e++)this.updateKeys(t[e])}return a.prototype.updateKeys=function(e){const t=this.keys;return t[0]=i(t[0],e),t[1]+=255&t[0],t[1]=r(t[1],134775813)+1,t[2]=i(t[2],t[1]>>>24),e},a.prototype.next=function(){const e=(2|this.keys[2])>>>0;return r(e,1^e)>>8&255},Tn={decrypt:function(e,n,r){if(!e||!Buffer.isBuffer(e)||e.length<12)return Buffer.alloc(0);const i=function(e){const t=new a(e);return function(e){const n=Buffer.alloc(e.length);let r=0;for(let i of e)n[r++]=t.updateKeys(i^t.next());return n}}(r),o=i(e.slice(0,12)),s=8&~n.flags?n.crc>>>24:n.timeHighByte;if(o[11]!==s)throw t.WRONG_PASSWORD();return i(e.slice(12))},encrypt:function(e,t,n,r=!1){null==e&&(e=Buffer.alloc(0)),Buffer.isBuffer(e)||(e=Buffer.from(e.toString()));const i=function(e){const t=new a(e);return function(e,n,r=0){n||(n=Buffer.alloc(e.length));for(let i of e){const e=t.next();n[r++]=i^e,t.updateKeys(i)}return n}}(n),o=s.genSalt();o[11]=t.crc>>>24&255,r&&(o[10]=t.crc>>>16&255);const c=Buffer.alloc(e.length+12);return i(o,c),i(e,c,12)},_salter:function(e){Buffer.isBuffer(e)&&e.length>=12?s.genSalt=function(){return e.slice(0,12)}:s.genSalt="node"===e?o.node:o}}}function zn(){return $n||($n=1,Gn.Deflater=Nn?On:(Nn=1,On=function(e){var t=R,n={chunkSize:1024*(parseInt(e.length/1024)+1)};return{deflate:function(){return t.deflateRawSync(e,n)},deflateAsync:function(r){var i=t.createDeflateRaw(n),o=[],s=0;i.on("data",function(e){o.push(e),s+=e.length}),i.on("end",function(){var e=Buffer.alloc(s),t=0;e.fill(0);for(var n=0;n<o.length;n++){var i=o[n];i.copy(e,t),t+=i.length}r&&r(e)}),i.end(e)}}}),Gn.Inflater=function(){if(Pn)return An;Pn=1;const e=+(process.versions?process.versions.node:"").split(".")[0]||0;return An=function(t,n){var r=R;const i=e>=15&&n>0?{maxOutputLength:n}:{};return{inflate:function(){return r.inflateRawSync(t,i)},inflateAsync:function(e){var n=r.createInflateRaw(i),o=[],s=0;n.on("data",function(e){o.push(e),s+=e.length}),n.on("end",function(){var t=Buffer.alloc(s),n=0;t.fill(0);for(var r=0;r<o.length;r++){var i=o[r];i.copy(t,n),n+=i.length}e&&e(t)}),n.end(t)}}}}(),Gn.ZipCrypto=jn()),Gn}function Hn(){if(kn)return xn;kn=1;var e=En(),t=Dn(),n=e.Constants,r=zn();return xn=function(i,o){var s=new t.EntryHeader,a=Buffer.alloc(0),c=Buffer.alloc(0),l=!1,u=null,f=Buffer.alloc(0),p=Buffer.alloc(0),d=!0;const h=i,m="object"==typeof h.decoder?h.decoder:e.decoder;function g(){return o&&o instanceof Uint8Array?(p=s.loadLocalHeaderFromBinary(o),o.slice(s.realDataOffset,s.realDataOffset+s.compressedSize)):Buffer.alloc(0)}function v(t){if(s.flags_desc){const r={},i=s.realDataOffset+s.compressedSize;if(o.readUInt32LE(i)==n.LOCSIG||o.readUInt32LE(i)==n.CENSIG)throw e.Errors.DESCRIPTOR_NOT_EXIST();if(o.readUInt32LE(i)==n.EXTSIG)r.crc=o.readUInt32LE(i+n.EXTCRC),r.compressedSize=o.readUInt32LE(i+n.EXTSIZ),r.size=o.readUInt32LE(i+n.EXTLEN);else{if(19280!==o.readUInt16LE(i+12))throw e.Errors.DESCRIPTOR_UNKNOWN();r.crc=o.readUInt32LE(i+n.EXTCRC-4),r.compressedSize=o.readUInt32LE(i+n.EXTSIZ-4),r.size=o.readUInt32LE(i+n.EXTLEN-4)}if(r.compressedSize!==s.compressedSize||r.size!==s.size||r.crc!==s.crc)throw e.Errors.DESCRIPTOR_FAULTY();if(e.crc32(t)!==r.crc)return!1}else if(e.crc32(t)!==s.localHeader.crc)return!1;return!0}function y(t,n,i){if(void 0===n&&"string"==typeof t&&(i=t,t=void 0),l)return t&&n&&n(Buffer.alloc(0),e.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var o=g();if(0===o.length)return t&&n&&n(o),o;if(s.encrypted){if("string"!=typeof i&&!Buffer.isBuffer(i))throw e.Errors.INVALID_PASS_PARAM();o=r.ZipCrypto.decrypt(o,s,i)}var c=Buffer.alloc(s.size);switch(s.method){case e.Constants.STORED:if(o.copy(c),v(c))return t&&n&&n(c),c;throw t&&n&&n(c,e.Errors.BAD_CRC()),e.Errors.BAD_CRC();case e.Constants.DEFLATED:var u=new r.Inflater(o,s.size);if(!t){if(u.inflate(c).copy(c,0),!v(c))throw e.Errors.BAD_CRC(`"${m.decode(a)}"`);return c}u.inflateAsync(function(t){t.copy(t,0),n&&(v(t)?n(t):n(t,e.Errors.BAD_CRC()))});break;default:throw t&&n&&n(Buffer.alloc(0),e.Errors.UNKNOWN_METHOD()),e.Errors.UNKNOWN_METHOD()}}function E(t,n){if((!u||!u.length)&&Buffer.isBuffer(o))return t&&n&&n(g()),g();if(u.length&&!l){var i;switch(s.method){case e.Constants.STORED:return s.compressedSize=s.size,i=Buffer.alloc(u.length),u.copy(i),t&&n&&n(i),i;default:case e.Constants.DEFLATED:var a=new r.Deflater(u);if(!t){var c=a.deflate();return s.compressedSize=c.length,c}a.deflateAsync(function(e){i=Buffer.alloc(e.length),s.compressedSize=e.length,e.copy(i),n&&n(i)}),a=null}}else{if(!t||!n)return Buffer.alloc(0);n(Buffer.alloc(0))}}function b(e,t){return(e.readUInt32LE(t+4)<<4)+e.readUInt32LE(t)}function w(e){var t,r,i,o;e.length>=n.EF_ZIP64_SCOMP&&(t=b(e,n.EF_ZIP64_SUNCOMP),s.size===n.EF_ZIP64_OR_32&&(s.size=t)),e.length>=n.EF_ZIP64_RHO&&(r=b(e,n.EF_ZIP64_SCOMP),s.compressedSize===n.EF_ZIP64_OR_32&&(s.compressedSize=r)),e.length>=n.EF_ZIP64_DSN&&(i=b(e,n.EF_ZIP64_RHO),s.offset===n.EF_ZIP64_OR_32&&(s.offset=i)),e.length>=n.EF_ZIP64_DSN+4&&(o=e.readUInt32LE(n.EF_ZIP64_DSN),s.diskNumStart===n.EF_ZIP64_OR_16&&(s.diskNumStart=o))}return d=!!m.hasOwnProperty("efs")&&m.efs,{get entryName(){return m.decode(a)},get rawEntryName(){return a},set entryName(t){var n=(a=e.toBuffer(t,m.encode))[a.length-1];l=47===n||92===n,s.fileNameLength=a.length},get efs(){return"function"==typeof d?d(this.entryName):d},get extra(){return f},set extra(t){f=t,s.extraLength=t.length,function(t){try{for(var r,i,o,s=0;s+4<t.length;)r=t.readUInt16LE(s),s+=2,i=t.readUInt16LE(s),s+=2,o=t.slice(s,s+i),s+=i,n.ID_ZIP64===r&&w(o)}catch(t){throw e.Errors.EXTRA_FIELD_PARSE_ERROR()}}(t)},get comment(){return m.decode(c)},set comment(t){if(c=e.toBuffer(t,m.encode),s.commentLength=c.length,c.length>65535)throw e.Errors.COMMENT_TOO_LONG()},get name(){var e=m.decode(a);return l?e.substr(e.length-1).split("/").pop():e.split("/").pop()},get isDirectory(){return l},getCompressedData:function(){return E(!1,null)},getCompressedDataAsync:function(e){E(!0,e)},setData:function(t){u=e.toBuffer(t,e.decoder.encode),!l&&u.length?(s.size=u.length,s.method=e.Constants.DEFLATED,s.crc=e.crc32(t),s.changed=!0):s.method=e.Constants.STORED},getData:function(e){return s.changed?u:y(!1,null,e)},getDataAsync:function(e,t){s.changed?e(u):y(!0,e,t)},set attr(e){s.attr=e},get attr(){return s.attr},set header(e){s.loadFromBinary(e)},get header(){return s},packCentralHeader:function(){s.flags_efs=this.efs,s.extraLength=f.length;var t=s.centralHeaderToBinary(),n=e.Constants.CENHDR;return a.copy(t,n),n+=a.length,f.copy(t,n),n+=s.extraLength,c.copy(t,n),t},packLocalHeader:function(){let e=0;s.flags_efs=this.efs,s.extraLocalLength=p.length;const t=s.localHeaderToBinary(),n=Buffer.alloc(t.length+a.length+s.extraLocalLength);return t.copy(n,e),e+=t.length,a.copy(n,e),e+=a.length,p.copy(n,e),e+=p.length,n},toJSON:function(){const e=function(e){return"<"+(e&&e.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:s.toJSON(),compressedData:e(o),data:e(u)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}},xn}function qn(){if(Un)return Fn;Un=1;const e=Hn(),t=Dn(),n=En();return Fn=function(r,i){var o=[],s={},a=Buffer.alloc(0),c=new t.MainHeader,l=!1;const u=new Set,f=i,{noSort:p,decoder:d}=f;function h(){if(l=!0,s={},c.diskEntries>(r.length-c.offset)/n.Constants.CENHDR)throw n.Errors.DISK_ENTRY_TOO_LARGE();o=new Array(c.diskEntries);for(var t=c.offset,i=0;i<o.length;i++){var a=t,p=new e(f,r);p.header=r.slice(a,a+=n.Constants.CENHDR),p.entryName=r.slice(a,a+=p.header.fileNameLength),p.header.extraLength&&(p.extra=r.slice(a,a+=p.header.extraLength)),p.header.commentLength&&(p.comment=r.slice(a,a+p.header.commentLength)),t+=p.header.centralHeaderSize,o[i]=p,s[p.entryName]=p}u.clear(),function(){const t=new Set;for(const e of Object.keys(s)){const n=e.split("/");if(n.pop(),n.length)for(let e=0;e<n.length;e++){const r=n.slice(0,e+1).join("/")+"/";t.add(r)}}for(const n of t)if(!(n in s)){const t=new e(f);t.entryName=n,t.attr=16,t.temporary=!0,o.push(t),s[t.entryName]=t,u.add(t)}}()}function m(){o.length>1&&!p&&o.sort((e,t)=>e.entryName.toLowerCase().localeCompare(t.entryName.toLowerCase()))}return r?function(e){var t=r.length-n.Constants.ENDHDR,i=Math.max(0,t-65535),o=i,s=r.length,l=-1,u=0;"boolean"==typeof f.trailingSpace&&f.trailingSpace&&(i=0);for(;t>=o;t--)if(80===r[t])if(r.readUInt32LE(t)!==n.Constants.ENDSIG)if(r.readUInt32LE(t)!==n.Constants.END64SIG){if(r.readUInt32LE(t)===n.Constants.ZIP64SIG){l=t,s=t+n.readBigUInt64LE(r,t+n.Constants.ZIP64SIZE)+n.Constants.ZIP64LEAD;break}}else o=i;else l=t,u=t,s=t+n.Constants.ENDHDR,o=t-n.Constants.END64HDR;if(-1==l)throw n.Errors.INVALID_FORMAT();c.loadFromBinary(r.slice(l,s)),c.commentLength&&(a=r.slice(u+n.Constants.ENDHDR));e&&h()}(f.readEntries):l=!0,{get entries(){return l||h(),o.filter(e=>!u.has(e))},get comment(){return d.decode(a)},set comment(e){a=n.toBuffer(e,d.encode),c.commentLength=a.length},getEntryCount:function(){return l?o.length:c.diskEntries},forEach:function(e){this.entries.forEach(e)},getEntry:function(e){return l||h(),s[e]||null},setEntry:function(e){l||h(),o.push(e),s[e.entryName]=e,c.totalEntries=o.length},deleteFile:function(e,t=!0){l||h();const n=s[e];this.getEntryChildren(n,t).map(e=>e.entryName).forEach(this.deleteEntry)},deleteEntry:function(e){l||h();const t=s[e],n=o.indexOf(t);n>=0&&(o.splice(n,1),delete s[e],c.totalEntries=o.length)},getEntryChildren:function(e,t=!0){if(l||h(),"object"==typeof e){if(e.isDirectory&&t){const t=[],n=e.entryName;for(const e of o)e.entryName.startsWith(n)&&t.push(e);return t}return[e]}return[]},getChildCount:function(e){if(e&&e.isDirectory){const t=this.getEntryChildren(e);return t.includes(e)?t.length-1:t.length}return 0},compressToBuffer:function(){l||h(),m();const e=[],t=[];let i=0,o=0;c.size=0,c.offset=0;let s=0;for(const n of this.entries){const r=n.getCompressedData();n.header.offset=o;const a=n.packLocalHeader(),l=a.length+r.length;o+=l,e.push(a),e.push(r);const u=n.packCentralHeader();t.push(u),c.size+=u.length,i+=l+u.length,s++}i+=c.mainHeaderSize,c.offset=o,c.totalEntries=s,o=0;const u=Buffer.alloc(i);for(const t of e)t.copy(u,o),o+=t.length;for(const e of t)e.copy(u,o),o+=e.length;const f=c.toBinary();return a&&a.copy(f,n.Constants.ENDHDR),f.copy(u,o),r=u,l=!1,u},toAsyncBuffer:function(e,t,i,o){try{l||h(),m();const t=[],s=[];let u=0,f=0,p=0;c.size=0,c.offset=0;const d=function(h){if(h.length>0){const e=h.shift(),n=e.entryName+e.extra.toString();i&&i(n),e.getCompressedDataAsync(function(r){o&&o(n),e.header.offset=f;const i=e.packLocalHeader(),a=i.length+r.length;f+=a,t.push(i),t.push(r);const l=e.packCentralHeader();s.push(l),c.size+=l.length,u+=a+l.length,p++,d(h)})}else{u+=c.mainHeaderSize,c.offset=f,c.totalEntries=p,f=0;const i=Buffer.alloc(u);t.forEach(function(e){e.copy(i,f),f+=e.length}),s.forEach(function(e){e.copy(i,f),f+=e.length});const o=c.toBinary();a&&a.copy(o,n.Constants.ENDHDR),o.copy(i,f),r=i,l=!1,e(i)}};d(Array.from(this.entries))}catch(e){t(e)}}}},Fn}var Vn=function(){if(Mn)return Bn;Mn=1;const e=En(),t=T,n=Hn(),r=qn(),i=(...t)=>e.findLast(t,e=>"boolean"==typeof e),o=(...t)=>e.findLast(t,e=>"string"==typeof e),s={noSort:!1,readEntries:!1,method:e.Constants.NONE,fs:null};return Bn=function(a,c){let l=null;const u=Object.assign(Object.create(null),s);a&&"object"==typeof a&&(a instanceof Uint8Array||(Object.assign(u,a),a=u.input?u.input:void 0,u.input&&delete u.input),Buffer.isBuffer(a)&&(l=a,u.method=e.Constants.BUFFER,a=void 0)),Object.assign(u,c);const f=new e(u);if("object"==typeof u.decoder&&"function"==typeof u.decoder.encode&&"function"==typeof u.decoder.decode||(u.decoder=e.decoder),a&&"string"==typeof a){if(!f.fs.existsSync(a))throw e.Errors.INVALID_FILENAME();u.method=e.Constants.FILE,u.filename=a,l=f.fs.readFileSync(a)}const p=new r(l,u),{canonical:d,sanitize:h,zipnamefix:m}=e;function g(e){var n;if(e&&p&&("string"==typeof e&&(n=p.getEntry(t.posix.normalize(e))),"object"==typeof e&&void 0!==e.entryName&&void 0!==e.header&&(n=p.getEntry(e.entryName)),n))return n;return null}function v(e){const{join:n,normalize:r,sep:i}=t.posix;return n(".",r(i+e.split("\\").join(i)+i))}function y(e){return e instanceof RegExp?(t=e,function(e){return t.test(e)}):"function"!=typeof e?()=>!0:e;var t}const E=(e,n)=>{let r=n.slice(-1);return r=r===f.sep?f.sep:"",t.relative(e,n)+r};return{readFile:function(e,t){var n=g(e);return n&&n.getData(t)||null},childCount:function(e){const t=g(e);if(t)return p.getChildCount(t)},readFileAsync:function(e,t){var n=g(e);n?n.getDataAsync(t):t(null,"getEntry failed for:"+e)},readAsText:function(e,t){var n=g(e);if(n){var r=n.getData();if(r&&r.length)return r.toString(t||"utf8")}return""},readAsTextAsync:function(e,t,n){var r=g(e);r?r.getDataAsync(function(e,r){r?t(e,r):e&&e.length?t(e.toString(n||"utf8")):t("")}):t("")},deleteFile:function(e,t=!0){var n=g(e);n&&p.deleteFile(n.entryName,t)},deleteEntry:function(e){var t=g(e);t&&p.deleteEntry(t.entryName)},addZipComment:function(e){p.comment=e},getZipComment:function(){return p.comment||""},addZipEntryComment:function(e,t){var n=g(e);n&&(n.comment=t)},getZipEntryComment:function(e){var t=g(e);return t&&t.comment||""},updateFile:function(e,t){var n=g(e);n&&n.setData(t)},addLocalFile:function(n,r,i,o){if(!f.fs.existsSync(n))throw e.Errors.FILE_NOT_FOUND(n);{r=r?v(r):"";const e=t.win32.basename(t.win32.normalize(n));r+=i||e;const s=f.fs.statSync(n),a=s.isFile()?f.fs.readFileSync(n):Buffer.alloc(0);s.isDirectory()&&(r+=f.sep),this.addFile(r,a,o,s)}},addLocalFileAsync:function(e,n){e="object"==typeof e?e:{localPath:e};const r=t.resolve(e.localPath),{comment:i}=e;let{zipPath:o,zipName:s}=e;const a=this;f.fs.stat(r,function(e,c){if(e)return n(e,!1);o=o?v(o):"";const l=t.win32.basename(t.win32.normalize(r));if(o+=s||l,c.isFile())f.fs.readFile(r,function(e,t){return e?n(e,!1):(a.addFile(o,t,i,c),setImmediate(n,void 0,!0))});else if(c.isDirectory())return o+=f.sep,a.addFile(o,Buffer.alloc(0),i,c),setImmediate(n,void 0,!0)})},addLocalFolder:function(n,r,i){if(i=y(i),r=r?v(r):"",n=t.normalize(n),!f.fs.existsSync(n))throw e.Errors.FILE_NOT_FOUND(n);{const e=f.findFiles(n),o=this;if(e.length)for(const s of e){const e=t.join(r,E(n,s));i(e)&&o.addLocalFile(s,t.dirname(e))}}},addLocalFolderAsync:function(n,r,i,o){o=y(o),i=i?v(i):"",n=t.normalize(n);var s=this;f.fs.open(n,"r",function(t){if(t&&"ENOENT"===t.code)r(void 0,e.Errors.FILE_NOT_FOUND(n));else if(t)r(void 0,t);else{var a=f.findFiles(n),c=-1,l=function(){if((c+=1)<a.length){var e=a[c],t=E(n,e).split("\\").join("/");t=t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),o(t)?f.fs.stat(e,function(n,o){n&&r(void 0,n),o.isFile()?f.fs.readFile(e,function(e,n){e?r(void 0,e):(s.addFile(i+t,n,"",o),l())}):(s.addFile(i+t+"/",Buffer.alloc(0),"",o),l())}):process.nextTick(()=>{l()})}else r(!0,void 0)};l()}})},addLocalFolderAsync2:function(n,r){const i=this;n="object"==typeof n?n:{localPath:n},localPath=t.resolve(v(n.localPath));let{zipPath:o,filter:s,namefix:a}=n;var c;s instanceof RegExp?(c=s,s=function(e){return c.test(e)}):"function"!=typeof s&&(s=function(){return!0}),o=o?v(o):"","latin1"==a&&(a=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),"function"!=typeof a&&(a=e=>e);const l=e=>t.join(o,a(E(localPath,e))),u=e=>t.win32.basename(t.win32.normalize(a(e)));f.fs.open(localPath,"r",function(n){n&&"ENOENT"===n.code?r(void 0,e.Errors.FILE_NOT_FOUND(localPath)):n?r(void 0,n):f.findFilesAsync(localPath,function(e,n){if(e)return r(e);(n=n.filter(e=>s(l(e)))).length||r(void 0,!1),setImmediate(n.reverse().reduce(function(e,n){return function(r,o){if(r||!1===o)return setImmediate(e,r,!1);i.addLocalFileAsync({localPath:n,zipPath:t.dirname(l(n)),zipName:u(n)},e)}},r))})})},addLocalFolderPromise:function(e,t){return new Promise((n,r)=>{this.addLocalFolderAsync2(Object.assign({localPath:e},t),(e,t)=>{e&&r(e),t&&n(this)})})},addFile:function(e,t,r,i){let o=g(e=m(e));const s=null!=o;s||(o=new n(u),o.entryName=e),o.comment=r||"";const a="object"==typeof i&&i instanceof f.fs.Stats;a&&(o.header.time=i.mtime);var c=o.isDirectory?16:0;let l=o.isDirectory?16384:32768;return l|=a?4095&i.mode:"number"==typeof i?4095&i:o.isDirectory?493:420,c=(c|l<<16)>>>0,o.attr=c,o.setData(t),s||p.setEntry(o),o},getEntries:function(e){return p.password=e,p?p.entries:[]},getEntry:function(e){return g(e)},getEntryCount:function(){return p.getEntryCount()},forEach:function(e){return p.forEach(e)},extractEntryTo:function(n,r,s,a,c,l){a=i(!1,a),c=i(!1,c),s=i(!0,s),l=o(c,l);var u=g(n);if(!u)throw e.Errors.NO_ENTRY();var m=d(u.entryName),v=h(r,l&&!u.isDirectory?l:s?m:t.basename(m));if(u.isDirectory)return p.getEntryChildren(u).forEach(function(n){if(n.isDirectory)return;var i=n.getData();if(!i)throw e.Errors.CANT_EXTRACT_FILE();var o=d(n.entryName),l=h(r,s?o:t.basename(o));const u=c?n.header.fileAttr:void 0;f.writeFileTo(l,i,a,u)}),!0;var y=u.getData(p.password);if(!y)throw e.Errors.CANT_EXTRACT_FILE();if(f.fs.existsSync(v)&&!a)throw e.Errors.CANT_OVERRIDE();const E=c?n.header.fileAttr:void 0;return f.writeFileTo(v,y,a,E),!0},test:function(e){if(!p)return!1;for(var t in p.entries)try{if(t.isDirectory)continue;if(!p.entries[t].getData(e))return!1}catch(e){return!1}return!0},extractAllTo:function(t,n,r,s){if(r=i(!1,r),s=o(r,s),n=i(!1,n),!p)throw e.Errors.NO_ZIP();p.entries.forEach(function(i){var o=h(t,d(i.entryName));if(i.isDirectory)return void f.makeDir(o);var a=i.getData(s);if(!a)throw e.Errors.CANT_EXTRACT_FILE();const c=r?i.header.fileAttr:void 0;f.writeFileTo(o,a,n,c);try{f.fs.utimesSync(o,i.header.time,i.header.time)}catch(t){throw e.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(n,r,o,s){if(s=((...t)=>e.findLast(t,e=>"function"==typeof e))(r,o,s),o=i(!1,o),r=i(!1,r),!s)return new Promise((e,t)=>{this.extractAllToAsync(n,r,o,function(n){n?t(n):e(this)})});if(!p)return void s(e.Errors.NO_ZIP());n=t.resolve(n);const a=e=>h(n,t.normalize(d(e.entryName))),c=(e,t)=>new Error(e+': "'+t+'"'),l=[],u=[];p.entries.forEach(e=>{e.isDirectory?l.push(e):u.push(e)});for(const e of l){const t=a(e),n=o?e.header.fileAttr:void 0;try{f.makeDir(t),n&&f.fs.chmodSync(t,n),f.fs.utimesSync(t,e.header.time,e.header.time)}catch(e){s(c("Unable to create folder",t))}}u.reverse().reduce(function(i,s){return function(a){if(a)i(a);else{const a=t.normalize(d(s.entryName)),l=h(n,a);s.getDataAsync(function(t,n){if(n)i(n);else if(t){const e=o?s.header.fileAttr:void 0;f.writeFileToAsync(l,t,r,e,function(e){e||i(c("Unable to write file",l)),f.fs.utimes(l,s.header.time,s.header.time,function(e){e?i(c("Unable to set times",l)):i()})})}else i(e.Errors.CANT_EXTRACT_FILE())})}}},s)()},writeZip:function(e,t){if(1===arguments.length&&"function"==typeof e&&(t=e,e=""),!e&&u.filename&&(e=u.filename),e){var n=p.compressToBuffer();if(n){var r=f.writeFileTo(e,n,!0);"function"==typeof t&&t(r?null:new Error("failed"),"")}}},writeZipPromise:function(e,t){const{overwrite:n,perm:r}=Object.assign({overwrite:!0},t);return new Promise((t,i)=>{!e&&u.filename&&(e=u.filename),e||i("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(o=>{f.writeFileToAsync(e,o,n,r,e=>e?t(e):i("ADM-ZIP: Wasn't able to write zip file"))},i)})},toBufferPromise:function(){return new Promise((e,t)=>{p.toAsyncBuffer(e,t)})},toBuffer:function(e,t,n,r){return"function"==typeof e?(p.toAsyncBuffer(e,t,n,r),null):p.compressToBuffer()}}},Bn}(),Wn=ue(Vn);class Yn{#K;get ora(){return this.#K}set attachConsole(e){e?(console.log=this.info.bind(this),console.info=this.info.bind(this)):console=Zn}static Global(e){return Kn=new Yn(e),Kn}static Clone(e){const{prefixText:t}=e||Kn;return new Yn({prefixText:t})}static get Current(){return Kn}static set Current(e){Kn=e}constructor(e){this.#K=x(e)}get prefixText(){return this.#K.prefixText}info(...e){this.#K.info(Xn(e))}succeed(...e){this.#K.succeed(Xn(e))}start(...e){this.#K.start(Xn(e))}fail(...e){this.#K.fail(Xn(e))}warn(...e){this.#K.warn(Xn(e))}clear(){this.#K.clear()}stop(){this.#K.stop()}stopAndPersist(...e){this.#K.stopAndPersist(...e)}}let Kn=new Yn;const Xn=e=>e.length?e.join(" "):void 0,Zn=console;class Jn{spinner;debugMode;constructor(e,t){this.spinner=new Yn({prefixText:e}),this.debugMode=t?.debug??!1}start(...e){this.spinner.start(...e)}succeed(...e){this.spinner.succeed(...e)}fail(...e){this.spinner.fail(...e)}error(...e){console.log(...e)}warn(...e){this.spinner.warn(...e)}info(...e){this.spinner.info(...e)}log(...e){this.spinner.info(...e)}debug(...e){this.debugMode&&console.debug(...e)}startNativeConsoleCapture(){this.spinner.attachConsole=!0}stopNativeConsoleCapture(){this.spinner.attachConsole=!1}}const Qn=e=>({portal:"object"==typeof e.spa?.templateEnv?e.spa.templateEnv.portal:void 0,msal:"object"==typeof e.spa?.templateEnv?e.spa.templateEnv.msal:void 0,proxy:"object"==typeof e.spa?.templateEnv?e.spa.templateEnv.serviceWorker?.resources:void 0,serviceDiscoveryUrl:e.api.serviceDiscoveryUrl,routes:e.api.routes}),er=e=>{const t={spa:{templateEnv:(n=e.template,{portal:{id:"@equinor/fusion-framework-dev-portal"},title:"Fusion Dev Portal",serviceDiscovery:{url:"/@fusion-services",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]},msal:{clientId:"9b707e3a-3e90-41ed-a47e-652a1e3b53d0",tenantId:"3aa4a235-b6e2-48d5-9195-7fcf05b459b0",redirectUri:"/authentication/login-callback",requiresAuth:"true"},serviceWorker:{resources:[{url:"/apps-proxy",rewrite:"/@fusion-api/apps",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]},{url:"/help-proxy",rewrite:"/@fusion-api/help",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]},{url:"/portal-proxy",rewrite:"/@fusion-api/portal-config",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]}]},...n})},api:{serviceDiscoveryUrl:"https://discovery.fusion.equinor.com/service-registry/environments/ci/services/",processServices:(e,t)=>{const{data:n,routes:r}=F(e,t);return{data:n.concat({key:"portals",name:"Portal Service - MOCK",uri:"/@fusion-api/portals"}),routes:r}}}};var n;return e.app&&((e,t,n)=>{const{build:r,appKey:i}=t;if(!r)throw new Error("App manifest does not contain build information");e.api.routes??=[],e.api.routes.push({match:[`/apps/bundles/apps/${i}/${r.version}/*path`,`/apps/bundles/apps/${i}@${r.version}/*path`],middleware:async(e,t,n)=>{const r=e.params?.path;!1===Array.isArray(r)&&n(),t.writeHead(302,{"content-type":"application/javascript",location:`/${r.join("/")}`}),t.end()}}),e.api.routes.push({match:`/apps/persons/me/apps/${i}`,middleware:async(e,n)=>{n.writeHead(200,{"content-type":"application/json"}),n.end(JSON.stringify({id:"dev-server-generated-id",...t}))}}),e.api.routes.push({match:`/apps/apps/${i}/builds/${r.version}/config`,middleware:async(e,t)=>{t.writeHead(200,{"content-type":"application/json"}),t.end(JSON.stringify(n))}})})(t,e.app.manifest,e.app.config),e.portal&&((e,t,n)=>{e.api.routes??=[];const r="portal-config";e.api.routes.push({match:`/${r}/portals/${t.name}{@:tag}`,middleware:async(e,n)=>{n.writeHead(200,{"content-type":"application/json"}),n.end(JSON.stringify(t))}}),n&&e.api.routes.push({match:`/${r}/portals/${t.name}{@:tag}/config`,middleware:async(e,t)=>{t.writeHead(200,{"content-type":"application/json"}),t.end(JSON.stringify(n))}})})(t,e.portal.manifest,e.portal.config),t},tr=async(e,t,n)=>{const{overrides:r,log:i}=n??{},o=er(t);i?.debug("\nBase dev server config:",Qn(o)),i?.debug("\nCreating dev server with overrides:",r);try{const{path:t,config:n}=await(async(e,t,n)=>C("dev-server.config",{baseDir:e.root,extensions:n?.extensions,script:{resolve:async n=>{let r;if("function"==typeof n.default){const i={...t};r=await n.default(e,{base:i})}else r=n.default;return Tt(t,r??{})}}}))(e,o);return i?.debug(`\nLoaded dev server config from ${t}`),i?.debug("\nLoaded dev server config:",Qn(n)),k(n,r)}catch(e){return i?.warn("\nFailed to load dev server config:",e instanceof Error?e.message:String(e)),k(o,r)}},nr="fusion-framework-cli",rr={"X-Fusion-CLI-Name":nr,"X-Fusion-CLI-Version":Ut,"User-Agent":`${nr}/${Ut}`},ir=(e,t,n)=>{const r=i(String(e));E(r)||b(r,{recursive:!0}),w(e,t,n)},or=["package.json","LICENSE.md","README.md","CHANGELOG.md"],sr=async(e,t)=>{const{archive:n,log:r}=t??{},s=i(e.path),a=t?.buildDir??"dist",c=o(s,a);if(!(await L(c)).isDirectory())throw new Error(`Build directory ${a} does not exist`);r?.log(le.bold("Starting to pack bundle"));const l=new Wn;if(l.addLocalFolder(c,a),t?.content)for(const[e,n]of Object.entries(t.content))l.addFile(e,Buffer.from(n)),r?.info("📄",Jt(e,{relative:!0}));r?.info("📂",Jt(c,{relative:!0}));for(const t of or.concat(e.packageJson.files??[])){const e=o(s,t),n=i(e.replace(s,""));Nt(e)?(l.addLocalFile(e,n),r?.info("📄",Jt(e,{relative:!0}))):r?.warn(le.dim("📄",Jt(e,{relative:!0})))}return n&&(Nt(i(n))||await S(i(n),{recursive:!0}),r?.start("compressing content"),await l.writeZipPromise(n),r?.succeed("📚",Jt(n,{relative:!0}),Qt(n))),l},ar=async e=>{const{log:t,manifest:n}=e;process.env.NODE_ENV,process.cwd();const{pkg:r,manifest:i}=await rn({log:t,manifest:n});if(!i.build)throw new Error("Manifest build config not found");return{archive:await sr(r,{log:t,archive:e?.archive,content:{"app-manifest.json":JSON.stringify(i.build,null,2),"metadata.json":JSON.stringify({name:i.appKey,version:i.build.version})}}).catch(e=>{t?.error("Failed to create package:",e),process.exit(1)}),manifest:i}},cr=async(e,t)=>{const{log:n}=t;try{n?.start("create application configuration"),n?.info(`generating config with ${le.red.dim(e.command)} command in ${le.green.dim(e.mode)} mode`);const r=await((e,t)=>{const n=t?.file??[`app.config.${e.environment}`,"app.config"];return C(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async n=>{const r=t?.base??{environment:{}};if("function"==typeof n.default){const t=await n.default(e,{base:r})??r;return zt.parse(t??r)}return zt.parse(n.default??r)}}})})(e,{file:t?.config});return n?.succeed("⚙️ generated config from ",Jt(r.path,{relative:!0})),r.config}catch(e){if(e instanceof I){if(!t.config)return n?.succeed(le.dim("⚙️ no local application config applied, using built-in")),{environment:{}};n?.warn(`failed to load config file ${Jt(t.config)}, please check the path.`)}throw n?.fail("failed to resolve application config"),n?.debug(e),e}},lr=async e=>{const{log:t}=e??{},n=await tn(t),r={command:"build",mode:process.env.NODE_ENV??"production",root:n.root,...e?.env},i=await cr(r,{log:t,config:e?.config});if(t?.debug("config:",i),e?.output){t?.start("writing config to file");try{await ir(e.output,JSON.stringify(i,null,2)),t?.succeed("config written successfully",Jt(e.output,{relative:!0}))}catch(e){throw t?.fail("failed to write config"),e}}return{config:i,pkg:n}};class ur extends Error{response;static Name="HttpResponseError";constructor(e,t,n){super(e,n),this.response=t}}class fr extends ur{static Name="HttpJsonResponseError";data;constructor(e,t,n){super(e,t,n),this.name=fr.Name,this.data=n?.data}}class pr extends ur{static Name="ServerSentEventResponseError";constructor(e,t,n){super(e,t,n),this.name=pr.Name}}var dr,hr,mr,gr,vr,yr,Er,br,wr,Lr,Sr,Cr,Ir,_r,Dr,Or,Nr,Ar,Pr,Tr,Rr,$r,xr,kr,Fr,Ur,Br,Mr,Gr,jr,zr,Hr,qr,Vr,Wr,Yr,Kr,Xr,Zr,Jr,Qr,ei,ti,ni,ri,ii,oi,si,ai,ci,li,ui,fi,pi,di,hi,mi,gi,vi,yi,Ei,bi,wi,Li,Si,Ci,Ii,_i,Di,Oi,Ni,Ai;function Pi(){if(_r)return Ir;_r=1;const e=$e();return Ir=(t,n,r)=>new e(t,r).compare(new e(n,r))}function Ti(){if(Tr)return Pr;Tr=1;const e=$e();return Pr=(t,n,r)=>{const i=new e(t,r),o=new e(n,r);return i.compare(o)||i.compareBuild(o)}}function Ri(){if(Ur)return Fr;Ur=1;const e=Pi();return Fr=(t,n,r)=>e(t,n,r)>0}function $i(){if(Mr)return Br;Mr=1;const e=Pi();return Br=(t,n,r)=>e(t,n,r)<0}function xi(){if(jr)return Gr;jr=1;const e=Pi();return Gr=(t,n,r)=>0===e(t,n,r)}function ki(){if(Hr)return zr;Hr=1;const e=Pi();return zr=(t,n,r)=>0!==e(t,n,r)}function Fi(){if(Vr)return qr;Vr=1;const e=Pi();return qr=(t,n,r)=>e(t,n,r)>=0}function Ui(){if(Yr)return Wr;Yr=1;const e=Pi();return Wr=(t,n,r)=>e(t,n,r)<=0}function Bi(){if(Xr)return Kr;Xr=1;const e=xi(),t=ki(),n=Ri(),r=Fi(),i=$i(),o=Ui();return Kr=(s,a,c,l)=>{switch(a){case"===":return"object"==typeof s&&(s=s.version),"object"==typeof c&&(c=c.version),s===c;case"!==":return"object"==typeof s&&(s=s.version),"object"==typeof c&&(c=c.version),s!==c;case"":case"=":case"==":return e(s,c,l);case"!=":return t(s,c,l);case">":return n(s,c,l);case">=":return r(s,c,l);case"<":return i(s,c,l);case"<=":return o(s,c,l);default:throw new TypeError(`Invalid operator: ${a}`)}}}function Mi(){if(ni)return ti;ni=1;const e=/\s+/g;class t{constructor(n,o){if(o=r(o),n instanceof t)return n.loose===!!o.loose&&n.includePrerelease===!!o.includePrerelease?n:new t(n.raw,o);if(n instanceof i)return this.raw=n.value,this.set=[[n]],this.formatted=void 0,this;if(this.options=o,this.loose=!!o.loose,this.includePrerelease=!!o.includePrerelease,this.raw=n.trim().replace(e," "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&m(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");const t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&p)|(this.options.loose&&d))+":"+e,r=n.get(t);if(r)return r;const s=this.options.loose,m=s?a[c.HYPHENRANGELOOSE]:a[c.HYPHENRANGE];e=e.replace(m,D(this.options.includePrerelease)),o("hyphen replace",e),e=e.replace(a[c.COMPARATORTRIM],l),o("comparator trim",e),e=e.replace(a[c.TILDETRIM],u),o("tilde trim",e),e=e.replace(a[c.CARETTRIM],f),o("caret trim",e);let g=e.split(" ").map(e=>v(e,this.options)).join(" ").split(/\s+/).map(e=>_(e,this.options));s&&(g=g.filter(e=>(o("loose invalid filter",e,this.options),!!e.match(a[c.COMPARATORLOOSE])))),o("range list",g);const y=new Map,E=g.map(e=>new i(e,this.options));for(const e of E){if(h(e))return[e];y.set(e.value,e)}y.size>1&&y.has("")&&y.delete("");const b=[...y.values()];return n.set(t,b),b}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(t=>g(t,n)&&e.set.some(e=>g(e,n)&&t.every(t=>e.every(e=>t.intersects(e,n)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new s(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(O(this.set[t],e,this.options))return!0;return!1}}ti=t;const n=new(ei?Qr:(ei=1,Qr=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}})),r=Te(),i=Gi(),o=me(),s=$e(),{safeRe:a,t:c,comparatorTrimReplace:l,tildeTrimReplace:u,caretTrimReplace:f}=Pe(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:d}=ge(),h=e=>"<0.0.0-0"===e.value,m=e=>""===e.value,g=(e,t)=>{let n=!0;const r=e.slice();let i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(a[c.BUILD],""),o("comp",e,t),e=w(e,t),o("caret",e),e=E(e,t),o("tildes",e),e=S(e,t),o("xrange",e),e=I(e,t),o("stars",e),e),y=e=>!e||"x"===e.toLowerCase()||"*"===e,E=(e,t)=>e.trim().split(/\s+/).map(e=>b(e,t)).join(" "),b=(e,t)=>{const n=t.loose?a[c.TILDELOOSE]:a[c.TILDE];return e.replace(n,(t,n,r,i,s)=>{let a;return o("tilde",e,t,n,r,i,s),y(n)?a="":y(r)?a=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?a=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:s?(o("replaceTilde pr",s),a=`>=${n}.${r}.${i}-${s} <${n}.${+r+1}.0-0`):a=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o("tilde return",a),a})},w=(e,t)=>e.trim().split(/\s+/).map(e=>L(e,t)).join(" "),L=(e,t)=>{o("caret",e,t);const n=t.loose?a[c.CARETLOOSE]:a[c.CARET],r=t.includePrerelease?"-0":"";return e.replace(n,(t,n,i,s,a)=>{let c;return o("caret",e,t,n,i,s,a),y(n)?c="":y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(s)?c="0"===n?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:a?(o("replaceCaret pr",a),c="0"===n?"0"===i?`>=${n}.${i}.${s}-${a} <${n}.${i}.${+s+1}-0`:`>=${n}.${i}.${s}-${a} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${s}-${a} <${+n+1}.0.0-0`):(o("no pr"),c="0"===n?"0"===i?`>=${n}.${i}.${s}${r} <${n}.${i}.${+s+1}-0`:`>=${n}.${i}.${s}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${s} <${+n+1}.0.0-0`),o("caret return",c),c})},S=(e,t)=>(o("replaceXRanges",e,t),e.split(/\s+/).map(e=>C(e,t)).join(" ")),C=(e,t)=>{e=e.trim();const n=t.loose?a[c.XRANGELOOSE]:a[c.XRANGE];return e.replace(n,(n,r,i,s,a,c)=>{o("xRange",e,n,r,i,s,a,c);const l=y(i),u=l||y(s),f=u||y(a),p=f;return"="===r&&p&&(r=""),c=t.includePrerelease?"-0":"",l?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&p?(u&&(s=0),a=0,">"===r?(r=">=",u?(i=+i+1,s=0,a=0):(s=+s+1,a=0)):"<="===r&&(r="<",u?i=+i+1:s=+s+1),"<"===r&&(c="-0"),n=`${r+i}.${s}.${a}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:f&&(n=`>=${i}.${s}.0${c} <${i}.${+s+1}.0-0`),o("xRange return",n),n})},I=(e,t)=>(o("replaceStars",e,t),e.trim().replace(a[c.STAR],"")),_=(e,t)=>(o("replaceGTE0",e,t),e.trim().replace(a[t.includePrerelease?c.GTE0PRE:c.GTE0],"")),D=e=>(t,n,r,i,o,s,a,c,l,u,f,p)=>`${n=y(r)?"":y(i)?`>=${r}.0.0${e?"-0":""}`:y(o)?`>=${r}.${i}.0${e?"-0":""}`:s?`>=${n}`:`>=${n}${e?"-0":""}`} ${c=y(l)?"":y(u)?`<${+l+1}.0.0-0`:y(f)?`<${l}.${+u+1}.0-0`:p?`<=${l}.${u}.${f}-${p}`:e?`<${l}.${u}.${+f+1}-0`:`<=${c}`}`.trim(),O=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==i.ANY&&e[n].semver.prerelease.length>0){const r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0};return ti}function Gi(){if(ii)return ri;ii=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(r,i){if(i=n(i),r instanceof t){if(r.loose===!!i.loose)return r;r=r.value}r=r.trim().split(/\s+/).join(" "),s("comparator",r,i),this.options=i,this.loose=!!i.loose,this.parse(r),this.semver===e?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}parse(t){const n=this.options.loose?r[i.COMPARATORLOOSE]:r[i.COMPARATOR],o=t.match(n);if(!o)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==o[1]?o[1]:"","="===this.operator&&(this.operator=""),o[2]?this.semver=new a(o[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(s("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new a(t,this.options)}catch(e){return!1}return o(t,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new c(e.value,r).test(this.value):""===e.operator?""===e.value||new c(this.value,r).test(e.semver):(!(r=n(r)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(o(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(o(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}ri=t;const n=Te(),{safeRe:r,t:i}=Pe(),o=Bi(),s=me(),a=$e(),c=Mi();return ri}function ji(){if(si)return oi;si=1;const e=Mi();return oi=(t,n,r)=>{try{n=new e(n,r)}catch(e){return!1}return n.test(t)},oi}function zi(){if(gi)return mi;gi=1;const e=Mi();return mi=(t,n)=>{try{return new e(t,n).range||"*"}catch(e){return null}},mi}function Hi(){if(yi)return vi;yi=1;const e=$e(),t=Gi(),{ANY:n}=t,r=Mi(),i=ji(),o=Ri(),s=$i(),a=Ui(),c=Fi();return vi=(l,u,f,p)=>{let d,h,m,g,v;switch(l=new e(l,p),u=new r(u,p),f){case">":d=o,h=a,m=s,g=">",v=">=";break;case"<":d=s,h=c,m=o,g="<",v="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(i(l,u,p))return!1;for(let e=0;e<u.set.length;++e){const r=u.set[e];let i=null,o=null;if(r.forEach(e=>{e.semver===n&&(e=new t(">=0.0.0")),i=i||e,o=o||e,d(e.semver,i.semver,p)?i=e:m(e.semver,o.semver,p)&&(o=e)}),i.operator===g||i.operator===v)return!1;if((!o.operator||o.operator===g)&&h(l,o.semver))return!1;if(o.operator===v&&m(l,o.semver))return!1}return!0},vi}var qi=function(){if(Ai)return Ni;Ai=1;const e=Pe(),t=ge(),n=$e(),r=Re(),i=xe(),o=ke(),s=Fe(),a=function(){if(hr)return dr;hr=1;const e=$e();return dr=(t,n,r,i,o)=>{"string"==typeof r&&(o=i,i=r,r=void 0);try{return new e(t instanceof e?t.version:t,r).inc(n,i,o).version}catch(e){return null}},dr}(),c=function(){if(gr)return mr;gr=1;const e=xe();return mr=(t,n)=>{const r=e(t,null,!0),i=e(n,null,!0),o=r.compare(i);if(0===o)return null;const s=o>0,a=s?r:i,c=s?i:r,l=!!a.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return"major";if(0===c.compareMain(a))return c.minor&&!c.patch?"minor":"patch"}const u=l?"pre":"";return r.major!==i.major?u+"major":r.minor!==i.minor?u+"minor":r.patch!==i.patch?u+"patch":"prerelease"}}(),l=function(){if(yr)return vr;yr=1;const e=$e();return vr=(t,n)=>new e(t,n).major}(),u=function(){if(br)return Er;br=1;const e=$e();return Er=(t,n)=>new e(t,n).minor}(),f=function(){if(Lr)return wr;Lr=1;const e=$e();return wr=(t,n)=>new e(t,n).patch}(),p=function(){if(Cr)return Sr;Cr=1;const e=xe();return Sr=(t,n)=>{const r=e(t,n);return r&&r.prerelease.length?r.prerelease:null},Sr}(),d=Pi(),h=function(){if(Or)return Dr;Or=1;const e=Pi();return Dr=(t,n,r)=>e(n,t,r)}(),m=function(){if(Ar)return Nr;Ar=1;const e=Pi();return Nr=(t,n)=>e(t,n,!0)}(),g=Ti(),v=function(){if($r)return Rr;$r=1;const e=Ti();return Rr=(t,n)=>t.sort((t,r)=>e(t,r,n))}(),y=function(){if(kr)return xr;kr=1;const e=Ti();return xr=(t,n)=>t.sort((t,r)=>e(r,t,n))}(),E=Ri(),b=$i(),w=xi(),L=ki(),S=Fi(),C=Ui(),I=Bi(),_=function(){if(Jr)return Zr;Jr=1;const e=$e(),t=xe(),{safeRe:n,t:r}=Pe();return Zr=(i,o)=>{if(i instanceof e)return i;if("number"==typeof i&&(i=String(i)),"string"!=typeof i)return null;let s=null;if((o=o||{}).rtl){const e=o.includePrerelease?n[r.COERCERTLFULL]:n[r.COERCERTL];let t;for(;(t=e.exec(i))&&(!s||s.index+s[0].length!==i.length);)s&&t.index+t[0].length===s.index+s[0].length||(s=t),e.lastIndex=t.index+t[1].length+t[2].length;e.lastIndex=-1}else s=i.match(o.includePrerelease?n[r.COERCEFULL]:n[r.COERCE]);if(null===s)return null;const a=s[2],c=s[3]||"0",l=s[4]||"0",u=o.includePrerelease&&s[5]?`-${s[5]}`:"",f=o.includePrerelease&&s[6]?`+${s[6]}`:"";return t(`${a}.${c}.${l}${u}${f}`,o)},Zr}(),D=Gi(),O=Mi(),N=ji(),A=function(){if(ci)return ai;ci=1;const e=Mi();return ai=(t,n)=>new e(t,n).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" ")),ai}(),P=function(){if(ui)return li;ui=1;const e=$e(),t=Mi();return li=(n,r,i)=>{let o=null,s=null,a=null;try{a=new t(r,i)}catch(e){return null}return n.forEach(t=>{a.test(t)&&(o&&-1!==s.compare(t)||(o=t,s=new e(o,i)))}),o},li}(),T=function(){if(pi)return fi;pi=1;const e=$e(),t=Mi();return fi=(n,r,i)=>{let o=null,s=null,a=null;try{a=new t(r,i)}catch(e){return null}return n.forEach(t=>{a.test(t)&&(o&&1!==s.compare(t)||(o=t,s=new e(o,i)))}),o},fi}(),R=function(){if(hi)return di;hi=1;const e=$e(),t=Mi(),n=Ri();return di=(r,i)=>{r=new t(r,i);let o=new e("0.0.0");if(r.test(o))return o;if(o=new e("0.0.0-0"),r.test(o))return o;o=null;for(let t=0;t<r.set.length;++t){const i=r.set[t];let s=null;i.forEach(t=>{const r=new e(t.semver.version);switch(t.operator){case">":0===r.prerelease.length?r.patch++:r.prerelease.push(0),r.raw=r.format();case"":case">=":s&&!n(r,s)||(s=r);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${t.operator}`)}}),!s||o&&!n(o,s)||(o=s)}return o&&r.test(o)?o:null},di}(),$=zi(),x=Hi(),k=function(){if(bi)return Ei;bi=1;const e=Hi();return Ei=(t,n,r)=>e(t,n,">",r),Ei}(),F=function(){if(Li)return wi;Li=1;const e=Hi();return wi=(t,n,r)=>e(t,n,"<",r),wi}(),U=function(){if(Ci)return Si;Ci=1;const e=Mi();return Si=(t,n,r)=>(t=new e(t,r),n=new e(n,r),t.intersects(n,r))}(),B=function(){if(_i)return Ii;_i=1;const e=ji(),t=Pi();return Ii=(n,r,i)=>{const o=[];let s=null,a=null;const c=n.sort((e,n)=>t(e,n,i));for(const t of c)e(t,r,i)?(a=t,s||(s=t)):(a&&o.push([s,a]),a=null,s=null);s&&o.push([s,null]);const l=[];for(const[e,t]of o)e===t?l.push(e):t||e!==c[0]?t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`):l.push("*");const u=l.join(" || "),f="string"==typeof r.raw?r.raw:String(r);return u.length<f.length?u:r},Ii}(),M=function(){if(Oi)return Di;Oi=1;const e=Mi(),t=Gi(),{ANY:n}=t,r=ji(),i=Pi(),o=[new t(">=0.0.0-0")],s=[new t(">=0.0.0")],a=(e,t,a)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===n){if(1===t.length&&t[0].semver===n)return!0;e=a.includePrerelease?o:s}if(1===t.length&&t[0].semver===n){if(a.includePrerelease)return!0;t=s}const u=new Set;let f,p,d,h,m,g,v;for(const t of e)">"===t.operator||">="===t.operator?f=c(f,t,a):"<"===t.operator||"<="===t.operator?p=l(p,t,a):u.add(t.semver);if(u.size>1)return null;if(f&&p){if(d=i(f.semver,p.semver,a),d>0)return null;if(0===d&&(">="!==f.operator||"<="!==p.operator))return null}for(const e of u){if(f&&!r(e,String(f),a))return null;if(p&&!r(e,String(p),a))return null;for(const n of t)if(!r(e,String(n),a))return!1;return!0}let y=!(!p||a.includePrerelease||!p.semver.prerelease.length)&&p.semver,E=!(!f||a.includePrerelease||!f.semver.prerelease.length)&&f.semver;y&&1===y.prerelease.length&&"<"===p.operator&&0===y.prerelease[0]&&(y=!1);for(const e of t){if(v=v||">"===e.operator||">="===e.operator,g=g||"<"===e.operator||"<="===e.operator,f)if(E&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===E.major&&e.semver.minor===E.minor&&e.semver.patch===E.patch&&(E=!1),">"===e.operator||">="===e.operator){if(h=c(f,e,a),h===e&&h!==f)return!1}else if(">="===f.operator&&!r(f.semver,String(e),a))return!1;if(p)if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),"<"===e.operator||"<="===e.operator){if(m=l(p,e,a),m===e&&m!==p)return!1}else if("<="===p.operator&&!r(p.semver,String(e),a))return!1;if(!e.operator&&(p||f)&&0!==d)return!1}return!(f&&g&&!p&&0!==d||p&&v&&!f&&0!==d||E||y)},c=(e,t,n)=>{if(!e)return t;const r=i(e.semver,t.semver,n);return r>0?e:r<0||">"===t.operator&&">="===e.operator?t:e},l=(e,t,n)=>{if(!e)return t;const r=i(e.semver,t.semver,n);return r<0?e:r>0||"<"===t.operator&&"<="===e.operator?t:e};return Di=(t,n,r={})=>{if(t===n)return!0;t=new e(t,r),n=new e(n,r);let i=!1;e:for(const e of t.set){for(const t of n.set){const n=a(e,t,r);if(i=i||null!==n,n)continue e}if(i)return!1}return!0}}();return Ni={parse:i,valid:o,clean:s,inc:a,diff:c,major:l,minor:u,patch:f,prerelease:p,compare:d,rcompare:h,compareLoose:m,compareBuild:g,sort:v,rsort:y,gt:E,lt:b,eq:w,neq:L,gte:S,lte:C,cmp:I,coerce:_,Comparator:D,Range:O,satisfies:N,toComparators:A,maxSatisfying:P,minSatisfying:T,minVersion:R,validRange:$,outside:x,gtr:k,ltr:F,intersects:U,simplifyRange:B,subset:M,SemVer:n,re:e.re,src:e.src,tokens:e.t,SEMVER_SPEC_VERSION:t.SEMVER_SPEC_VERSION,RELEASE_TYPES:t.RELEASE_TYPES,compareIdentifiers:r.compareIdentifiers,rcompareIdentifiers:r.rcompareIdentifiers}}();class Vi extends qi.SemVer{satisfies(e){return qi.satisfies(this,e)}}var Wi=function(e,t){return Wi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Wi(e,t)};function Yi(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Wi(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Ki=function(){return Ki=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ki.apply(this,arguments)};function Xi(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((r=r.apply(e,t||[])).next())})}function Zi(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function Ji(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Qi(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function eo(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function to(e){return this instanceof to?(this.v=e,this):new to(e)}function no(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",function(e){return function(t){return Promise.resolve(t).then(e,l)}}),r[Symbol.asyncIterator]=function(){return this},r;function s(e,t){i[e]&&(r[e]=function(t){return new Promise(function(n,r){o.push([e,t,n,r])>1||a(e,t)})},t&&(r[e]=t(r[e])))}function a(e,t){try{(n=i[e](t)).value instanceof to?Promise.resolve(n.value.v).then(c,l):u(o[0][2],n)}catch(e){u(o[0][3],e)}var n}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function ro(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=Ji(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,i){(function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)})(r,i,(t=e[n](t)).done,t.value)})}}}function io(e){return"function"==typeof e}function oo(e){var t=e(function(e){Error.call(e),e.stack=(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var so=oo(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function ao(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var co=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=Ji(o),a=s.next();!a.done;a=s.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var c=this.initialTeardown;if(io(c))try{c()}catch(e){i=e instanceof so?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var u=Ji(l),f=u.next();!f.done;f=u.next()){var p=f.value;try{fo(p)}catch(e){i=null!=i?i:[],e instanceof so?i=eo(eo([],Qi(i)),Qi(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}if(i)throw new so(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)fo(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&ao(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&ao(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),lo=co.EMPTY;function uo(e){return e instanceof co||e&&"closed"in e&&io(e.remove)&&io(e.add)&&io(e.unsubscribe)}function fo(e){io(e)?e():e.unsubscribe()}var po={Promise:void 0},ho=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,eo([e,t],Qi(n)))};function mo(e){ho(function(){throw e})}function go(){}function vo(e){e()}var yo=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,uo(t)&&t.add(n)):n.destination=Lo,n}return Yi(t,e),t.create=function(e,t,n){return new bo(e,t,n)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(co),Eo=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){wo(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){wo(e)}else wo(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){wo(e)}},e}(),bo=function(e){function t(t,n,r){var i,o=e.call(this)||this;return i=io(t)||!t?{next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:t,o.destination=new Eo(i),o}return Yi(t,e),t}(yo);function wo(e){mo(e)}var Lo={closed:!0,next:go,error:function(e){throw e},complete:go},So="function"==typeof Symbol&&Symbol.observable||"@@observable";function Co(e){return e}var Io=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=this,o=(r=e)&&r instanceof yo||function(e){return e&&io(e.next)&&io(e.error)&&io(e.complete)}(r)&&uo(r)?e:new bo(e,t,n);return vo(function(){var e=i,t=e.operator,n=e.source;o.add(t?t.call(o,n):n?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=_o(t))(function(t,r){var i=new bo({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[So]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(0===(e=t).length?Co:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=_o(e))(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function _o(e){var t;return null!==(t=null!=e?e:po.Promise)&&void 0!==t?t:Promise}function Do(e){return function(t){if(function(e){return io(null==e?void 0:e.lift)}(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw new TypeError("Unable to lift unknown Observable type")}}function Oo(e,t,n,r,i){return new No(e,t,n,r,i)}var No=function(e){function t(t,n,r,i,o,s){var a=e.call(this,t)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return Yi(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(yo),Ao=oo(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Po=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return Yi(t,e),t.prototype.lift=function(e){var t=new To(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Ao},t.prototype.next=function(e){var t=this;vo(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=Ji(t.currentObservers),o=i.next();!o.done;o=i.next()){o.value.next(e)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var t=this;vo(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;vo(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?lo:(this.currentObservers=null,o.push(e),new co(function(){t.currentObservers=null,ao(o,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new Io;return e.source=this,e},t.create=function(e,t){return new To(e,t)},t}(Io),To=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return Yi(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:lo},t}(Po),Ro=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return Yi(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(Po),$o={now:function(){return($o.delegate||Date).now()},delegate:void 0},xo=function(e){function t(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=$o);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return Yi(t,e),t.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,s=n._timestampProvider,a=n._windowTime;r||(i.push(t),!o&&i.push(s.now()+a)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!e.closed;i+=n?1:2)e.next(r[i]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,n=e._timestampProvider,r=e._buffer,i=e._infiniteTimeWindow,o=(i?1:2)*t;if(t<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var s=n.now(),a=0,c=1;c<r.length&&r[c]<=s;c+=2)a=c;a&&r.splice(0,a+1)}},t}(Po),ko=function(e){function t(t,n){return e.call(this)||this}return Yi(t,e),t.prototype.schedule=function(e,t){return this},t}(co),Fo=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,eo([e,t],Qi(n)))},Uo=function(e){return clearInterval(e)},Bo=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return Yi(t,e),t.prototype.schedule=function(e,t){var n;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,t)),this.pending=!0,this.delay=t,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),Fo(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&Uo(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n,r=!1;try{this.work(e)}catch(e){r=!0,n=e||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,ao(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(ko),Mo=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=$o.now,e}(),Go=function(e){function t(t,n){void 0===n&&(n=Mo.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return Yi(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var n;this._active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},t}(Mo),jo=new Go(Bo),zo=jo,Ho=new Io(function(e){return e.complete()});function qo(e){return e&&io(e.schedule)}function Vo(e){return e[e.length-1]}var Wo=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function Yo(e){return io(null==e?void 0:e.then)}function Ko(e){return io(e[So])}function Xo(e){return Symbol.asyncIterator&&io(null==e?void 0:e[Symbol.asyncIterator])}function Zo(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Jo="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Qo(e){return io(null==e?void 0:e[Jo])}function es(e){return no(this,arguments,function(){var t,n,r;return Zi(this,function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,to(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,to(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,to(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function ts(e){return io(null==e?void 0:e.getReader)}function ns(e){if(e instanceof Io)return e;if(null!=e){if(Ko(e))return i=e,new Io(function(e){var t=i[So]();if(io(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(Wo(e))return r=e,new Io(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()});if(Yo(e))return n=e,new Io(function(e){n.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,mo)});if(Xo(e))return rs(e);if(Qo(e))return t=e,new Io(function(e){var n,r;try{for(var i=Ji(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()});if(ts(e))return rs(es(e))}var t,n,r,i;throw Zo(e)}function rs(e){return new Io(function(t){(function(e,t){var n,r,i,o;return Xi(this,void 0,void 0,function(){var s,a;return Zi(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=ro(e),c.label=1;case 1:return[4,n.next()];case 2:if((r=c.sent()).done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function is(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(o),!i)return o}function os(e,t){return void 0===t&&(t=0),Do(function(n,r){n.subscribe(Oo(r,function(n){return is(r,e,function(){return r.next(n)},t)},function(){return is(r,e,function(){return r.complete()},t)},function(n){return is(r,e,function(){return r.error(n)},t)}))})}function ss(e,t){return void 0===t&&(t=0),Do(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function as(e,t){if(!e)throw new Error("Iterable cannot be null");return new Io(function(n){is(n,t,function(){var r=e[Symbol.asyncIterator]();is(n,t,function(){r.next().then(function(e){e.done?n.complete():n.next(e.value)})},0,!0)})})}function cs(e,t){if(null!=e){if(Ko(e))return function(e,t){return ns(e).pipe(ss(t),os(t))}(e,t);if(Wo(e))return function(e,t){return new Io(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}(e,t);if(Yo(e))return function(e,t){return ns(e).pipe(ss(t),os(t))}(e,t);if(Xo(e))return as(e,t);if(Qo(e))return function(e,t){return new Io(function(n){var r;return is(n,t,function(){r=e[Jo](),is(n,t,function(){var e,t,i;try{t=(e=r.next()).value,i=e.done}catch(e){return void n.error(e)}i?n.complete():n.next(t)},0,!0)}),function(){return io(null==r?void 0:r.return)&&r.return()}})}(e,t);if(ts(e))return function(e,t){return as(es(e),t)}(e,t)}throw Zo(e)}function ls(e,t){return t?cs(e,t):ns(e)}function us(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=function(e){return qo(Vo(e))?e.pop():void 0}(e);return ls(e,n)}var fs=oo(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function ps(e,t){var n="object"==typeof t;return new Promise(function(r,i){var o,s=!1;e.subscribe({next:function(e){o=e,s=!0},error:i,complete:function(){s?r(o):n?r(t.defaultValue):i(new fs)}})})}function ds(e,t){var n="object"==typeof t;return new Promise(function(r,i){var o=new bo({next:function(e){r(e),o.unsubscribe()},error:i,complete:function(){n?r(t.defaultValue):i(new fs)}});e.subscribe(o)})}function hs(e){return e instanceof Date&&!isNaN(e)}var ms=oo(function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function gs(e){throw new ms(e)}function vs(e,t){return Do(function(n,r){var i=0;n.subscribe(Oo(r,function(n){r.next(e.call(t,n,i++))}))})}var ys=Array.isArray;function Es(e){return vs(function(t){return function(e,t){return ys(t)?e.apply(void 0,eo([],Qi(t))):e(t)}(e,t)})}function bs(e,t,n,r,i,o,s,a){var c=[],l=0,u=0,f=!1,p=function(){!f||c.length||l||t.complete()},d=function(e){return l<r?h(e):c.push(e)},h=function(e){o&&t.next(e),l++;var a=!1;ns(n(e,u++)).subscribe(Oo(t,function(e){null==i||i(e),o?d(e):t.next(e)},function(){a=!0},void 0,function(){if(a)try{l--;for(var e=function(){var e=c.shift();s||h(e)};c.length&&l<r;)e();p()}catch(e){t.error(e)}}))};return e.subscribe(Oo(t,d,function(){f=!0,p()})),function(){null==a||a()}}function ws(e,t,n){return void 0===n&&(n=1/0),io(t)?ws(function(n,r){return vs(function(e,i){return t(n,e,r,i)})(ns(e(n,r)))},n):("number"==typeof t&&(n=t),Do(function(t,r){return bs(t,r,e,n)}))}var Ls=["addListener","removeListener"],Ss=["addEventListener","removeEventListener"],Cs=["on","off"];function Is(e,t,n,r){if(io(n)&&(r=n,n=void 0),r)return Is(e,t,n).pipe(Es(r));var i=Qi(function(e){return io(e.addEventListener)&&io(e.removeEventListener)}(e)?Ss.map(function(r){return function(i){return e[r](t,i,n)}}):function(e){return io(e.addListener)&&io(e.removeListener)}(e)?Ls.map(_s(e,t)):function(e){return io(e.on)&&io(e.off)}(e)?Cs.map(_s(e,t)):[],2),o=i[0],s=i[1];if(!o&&Wo(e))return ws(function(e){return Is(e,t,n)})(ns(e));if(!o)throw new TypeError("Invalid event target");return new Io(function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.next(1<t.length?t:t[0])};return o(t),function(){return s(t)}})}function _s(e,t){return function(n){return function(r){return e[n](t,r)}}}function Ds(e,t,n){void 0===e&&(e=0),void 0===n&&(n=zo);var r=-1;return null!=t&&(qo(t)?n=t:r=t),new Io(function(t){var i=hs(e)?+e-n.now():e;i<0&&(i=0);var o=0;return n.schedule(function(){t.closed||(t.next(o++),0<=r?this.schedule(void 0,r):t.complete())},i)})}function Os(e,t){return Do(function(n,r){var i=0;n.subscribe(Oo(r,function(n){return e.call(t,n,i++)&&r.next(n)}))})}function Ns(e){return Do(function(t,n){var r,i=null,o=!1;i=t.subscribe(Oo(n,void 0,void 0,function(s){r=ns(e(s,Ns(e)(t))),i?(i.unsubscribe(),i=null,r.subscribe(n)):o=!0})),o&&(i.unsubscribe(),i=null,r.subscribe(n))})}function As(e,t,n,r,i){return function(o,s){var a=n,c=t,l=0;o.subscribe(Oo(s,function(t){var n=l++;c=a?e(c,t,n):(a=!0,t),r&&s.next(c)},i&&function(){a&&s.next(c),s.complete()}))}}function Ps(e,t){return Do(As(e,t,arguments.length>=2,!1,!0))}function Ts(e){return Do(function(t,n){var r=!1;t.subscribe(Oo(n,function(e){r=!0,n.next(e)},function(){r||n.next(e),n.complete()}))})}function Rs(e,t){return void 0===t&&(t=Co),e=null!=e?e:$s,Do(function(n,r){var i,o=!0;n.subscribe(Oo(r,function(n){var s=t(n);!o&&e(i,s)||(o=!1,i=s,r.next(n))}))})}function $s(e,t){return e===t}function xs(e){return void 0===e&&(e=ks),Do(function(t,n){var r=!1;t.subscribe(Oo(n,function(e){r=!0,n.next(e)},function(){return r?n.complete():n.error(e())}))})}function ks(){return new fs}function Fs(e){return Do(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}function Us(e,t){var n=arguments.length>=2;return function(e){return e.pipe(Co,(r=1)<=0?function(){return Ho}:Do(function(e,t){var n=[];e.subscribe(Oo(t,function(e){n.push(e),r<n.length&&n.shift()},function(){var e,r;try{for(var i=Ji(n),o=i.next();!o.done;o=i.next()){var s=o.value;t.next(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}t.complete()},void 0,function(){n=null}))}),n?Ts(t):xs(function(){return new fs}));var r}}function Bs(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0!==t){if(!1!==t){var i=new bo({next:function(){i.unsubscribe(),e()}});return ns(t.apply(void 0,eo([],Qi(n)))).subscribe(i)}}else e()}function Ms(e,t){return Do(function(n,r){var i=null,o=0,s=!1,a=function(){return s&&!i&&r.complete()};n.subscribe(Oo(r,function(n){null==i||i.unsubscribe();var s=0,c=o++;ns(e(n,c)).subscribe(i=Oo(r,function(e){return r.next(t?t(n,e,c,s++):e)},function(){i=null,a()}))},function(){s=!0,a()}))})}function Gs(e){return Do(function(t,n){ns(e).subscribe(Oo(n,function(){return n.complete()},go)),!n.closed&&t.subscribe(n)})}function js(e,t,n){var r=io(e)||t||n?{next:e,error:t,complete:n}:e;return r?Do(function(e,t){var n;null===(n=r.subscribe)||void 0===n||n.call(r);var i=!0;e.subscribe(Oo(t,function(e){var n;null===(n=r.next)||void 0===n||n.call(r,e),t.next(e)},function(){var e;i=!1,null===(e=r.complete)||void 0===e||e.call(r),t.complete()},function(e){var n;i=!1,null===(n=r.error)||void 0===n||n.call(r,e),t.error(e)},function(){var e,t;i&&(null===(e=r.unsubscribe)||void 0===e||e.call(r)),null===(t=r.finalize)||void 0===t||t.call(r)}))}):Co}function zs(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n,r=io(Vo(n=e))?n.pop():void 0;return Do(function(t,n){for(var i=e.length,o=new Array(i),s=e.map(function(){return!1}),a=!1,c=function(t){ns(e[t]).subscribe(Oo(n,function(e){o[t]=e,a||s[t]||(s[t]=!0,(a=s.every(Co))&&(s=null))},go))},l=0;l<i;l++)c(l);t.subscribe(Oo(n,function(e){if(a){var t=eo([e],Qi(o));n.next(r?r.apply(void 0,eo([],Qi(t))):t)}}))})}const Hs=(e,t,n)=>{const r="string"==typeof t?t.split("."):t,i=r.shift();return i&&(e[i]??={},r.length?Hs(e[i],r,n):Object.assign(e,{[i]:n})),e};class qs{#X={};createConfig(e,t){return ls(this._createConfig(e,t))}async createConfigAsync(e,t){return ps(this.createConfig(e,t))}_set(e,t){const n="function"==typeof t?t:async()=>t;this.#X[e]=n}_get(e){return this.#X[e]}_has(e){return e in this.#X}_createConfig(e,t){return ls(this._buildConfig(e,t)).pipe(Ms(t=>this._processConfig(t,e)))}_buildConfig(e,t){return ls(Object.entries(this.#X)).pipe(ws(([t,n])=>ls(n(e)).pipe(Os(e=>void 0!==e),vs(e=>({target:t,value:e})),Ns(e=>(console.error(`Failed to execute config callback: ${n.name} for attribute: '${t}'`,e),Ho)))),Ps((e,{target:t,value:n})=>Hs(e,t,n),t??{}))}_processConfig(e,t){return us(e)}}var Vs;!function(e){e[e.Debug=0]="Debug",e[e.Information=1]="Information",e[e.Warning=2]="Warning",e[e.Error=3]="Error",e[e.Critical=4]="Critical"}(Vs||(Vs={}));class Ws{static[Symbol.hasInstance](e){if(null!==e&&"object"==typeof e&&"version"in e&&"dispose"in e){const t=e,n=qi.coerce(String(t.version)),r=t.dispose;return!!n&&"function"==typeof r}return!1}#Z;#J;get version(){return this.#Z}constructor(e){const{version:t}=e;this.#Z=new Vi(t),this.#J=new co}_addTeardown(e){return this.#J.add(e),()=>this.#J.remove(e)}dispose(){this.#J.unsubscribe()}}class Ys extends Error{constructor(){super("Module initialization timed out"),this.name="RequiredModuleTimeoutError"}}class Ks{static className="ModulesConfigurator";get version(){return"5.0.5"}#Q=new xo(100);get event$(){return this.#Q.asObservable()}_configs=[];_afterConfiguration=[];_afterInit=[];_modules;constructor(e){this._modules=new Set(e)}get modules(){return[...this._modules]}configure(...e){for(const t of e)this.addConfig(t)}addConfig(e){const{module:t,afterConfig:n,afterInit:r,configure:i}=e;this._modules.add(t),this._registerEvent({level:Vs.Debug,name:"moduleConfigAdded",message:`Module configurator added for ${t.name}`,properties:{moduleName:t.name,moduleVersion:t.version?.toString()||"unknown",configure:!!i,afterConfig:!!n,afterInit:!!r}}),i&&this._configs.push((e,n)=>i(e[t.name],n)),n&&this._afterConfiguration.push(e=>n(e[t.name])),r&&this._afterInit.push(e=>r(e[t.name]))}onConfigured(e){this._afterConfiguration.push(e),this._registerEvent({level:Vs.Debug,name:"addOnConfigured",message:"Added onConfigured callback",properties:{count:this._afterConfiguration.length,name:e.name||"anonymous"}})}onInitialized(e){this._afterInit.push(e),this._registerEvent({level:Vs.Debug,name:"addOnInitialized",message:"Added onInitialized callback",properties:{count:this._afterInit.length,name:e.name||"anonymous"}})}async initialize(e){const t=performance.now(),n=await this._configure(e),r=Math.round(performance.now()-t);this._registerEvent({level:Vs.Debug,name:"initialize.configLoaded",message:`Modules configured in ${r}ms`,properties:{modules:this.modules.map(e=>e.name).join(", "),count:this.modules.length,loadTime:r},metric:r});const i=performance.now(),o=await this._initialize(n,e),s=Math.round(performance.now()-i);this._registerEvent({level:Vs.Debug,name:"initialize.instanceInitialized",message:`Modules initialized in ${s}ms`,properties:{modules:this.modules.map(e=>e.name).join(", "),count:this.modules.length,loadTime:s},metric:s});const a=r+s;return this._registerEvent({level:Vs.Information,name:"initialize",message:`initialize in ${a}ms`,properties:{modules:this.modules.map(e=>e.name).join(", "),configLoadTime:r,instanceLoadTime:s,totalLoadTime:a},metric:a}),await this._postInitialize(o,e),Object.seal(Object.assign({},o,{dispose:()=>this.dispose(o)}))}_registerEvent(e){const t=e.name.split("::");this.#Q.next({...e,name:`${this.constructor.className}::${t[t.length-1]}`})}async _configure(e){const t=await this._createConfig(e);return await Promise.all(this._configs.map(n=>Promise.resolve(n(t,e)))),await this._postConfigure(t),t}_createConfig(e){const{modules:t,_afterConfiguration:n,_afterInit:r}=this,i=ls(t).pipe(ws(async t=>{const n=performance.now();try{const r=await(t.configure?.(e)),i=Math.round(performance.now()-n);return this._registerEvent({level:Vs.Debug,name:"_createConfig.configuratorCreated",message:`Configurator created for ${t.name} in ${i}ms`,properties:{moduleName:t.name,moduleVersion:t.version?.toString()||"unknown",configLoadTime:i},metric:i}),{[t.name]:r}}catch(e){throw this._registerEvent({level:Vs.Error,name:"_createConfig.configuratorFailed",message:`Failed to create configurator for ${t.name}`,properties:{moduleName:t.name,moduleVersion:t.version?.toString()||"unknown"},metric:Math.round(performance.now()-n),error:e}),e}}),Ps((e,t)=>Object.assign(e,t),{onAfterConfiguration(e){n.push(e)},onAfterInit(e){r.push(e)}}));return ps(i)}async _postConfigure(e){const{modules:t,_afterConfiguration:n}=this;if(await Promise.allSettled(t.filter(e=>!!e.postConfigure).map(async t=>{try{const n=performance.now();await(t.postConfigure?.(e)),this._registerEvent({level:Vs.Debug,name:"_postConfigure.modulePostConfigured",message:`Module ${t.name} post-configured successfully`,properties:{moduleName:t.name,moduleVersion:t.version?.toString()||"unknown",postConfigTime:Math.round(performance.now()-n)}})}catch(e){this._registerEvent({level:Vs.Warning,name:"_postConfigure.modulePostConfigureError",message:`Module ${t.name} post-configure failed`,properties:{moduleName:t.name,moduleVersion:t.version?.toString()||"unknown"},error:e})}})),n.length)try{this._registerEvent({level:Vs.Debug,name:"_postConfigure.hooks",message:`Post configure hooks [${n.length}] called`});const t=performance.now();await Promise.allSettled(n.map(t=>Promise.resolve(t(e))));const r=Math.round(performance.now()-t);this._registerEvent({level:Vs.Debug,name:"_postConfigure.hooksComplete",message:"Post configure hooks complete",properties:{count:n.length,postConfigHooksTime:r},metric:r})}catch(e){this._registerEvent({level:Vs.Warning,name:"_postConfigure.hooksError",message:"Post configure hook failed",error:e})}}async _initialize(e,t){const n=this.modules.map(e=>e.name),r=new Ro({}),i=e=>n.includes(e),o=(e,t=60)=>{if(!n.includes(e)){const n=new Error(`Cannot require [${String(e)}] since module is not defined!`);throw n.name="ModuleNotDefinedError",this._registerEvent({level:Vs.Error,name:"_initialize.requireInstance.moduleNotDefined",message:n.message,properties:{moduleName:String(e),wait:t},error:n}),n}if(r.value[e])return this._registerEvent({level:Vs.Debug,name:"_initialize.requireInstance.moduleAlreadyInitialized",message:`Module [${String(e)}] is already initialized, skipping queue`,properties:{moduleName:String(e),wait:t}}),Promise.resolve(r.value[e]);const i=performance.now();return this._registerEvent({level:Vs.Debug,name:"_initialize.requireInstance.awaiting",message:`Awaiting module [${String(e)}] initialization, timeout ${t}s`,properties:{moduleName:String(e),wait:t}}),ds(r.pipe(Os(t=>!!t[e]),vs(t=>t[e]),function(e){var t=hs(e)?{first:e}:"number"==typeof e?{each:e}:e,n=t.first,r=t.each,i=t.with,o=void 0===i?gs:i,s=t.scheduler,a=void 0===s?jo:s,c=t.meta,l=void 0===c?null:c;if(null==n&&null==r)throw new TypeError("No timeout provided.");return Do(function(e,t){var i,s,c=null,u=0,f=function(e){s=is(t,a,function(){try{i.unsubscribe(),ns(o({meta:l,lastValue:c,seen:u})).subscribe(t)}catch(e){t.error(e)}},e)};i=e.subscribe(Oo(t,function(e){null==s||s.unsubscribe(),u++,t.next(c=e),r>0&&f(r)},void 0,void 0,function(){(null==s?void 0:s.closed)||null==s||s.unsubscribe(),c=null})),!u&&f(null!=n?"number"==typeof n?n:+n-a.now():r)})}({each:1e3*t,with:()=>{return r=io(n=()=>{const n=new Ys;return this._registerEvent({level:Vs.Error,name:"_initialize.requireInstance.timeout",message:`Module [${String(e)}] initialization timed out after ${t}s`,properties:{moduleName:String(e),wait:t},error:n}),n})?n:function(){return n},new Io(function(e){return e.error(r())});var n,r}}),js(()=>{const n=Math.round(performance.now()-i);this._registerEvent({level:Vs.Debug,name:"_initialize.requireInstance.moduleResolved",message:`Module [${String(e)}] required in ${n}ms`,properties:{moduleName:String(e),wait:t,requireTime:n},metric:n})})))},s=ls(this.modules).pipe(ws(n=>{const r=n.name;if(!n.initialize){const e=new Error(`Module ${n.name} does not have initialize method`);throw e.name="ModuleInitializeError",this._registerEvent({level:Vs.Error,name:"_initialize.moduleInitializeError",message:e.message,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown"},error:e}),e}this._registerEvent({level:Vs.Debug,name:"_initialize.moduleInitializing",message:`Initializing module ${n.name}`,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown"}});const s=performance.now();return ls(Promise.resolve(n.initialize({ref:t,config:e[r],requireInstance:o,hasModule:i}))).pipe(vs(e=>{e instanceof Ws||this._registerEvent({level:Vs.Warning,name:"_initialize.providerNotBaseModuleProvider",message:`Provider for module ${n.name} does not extend BaseModuleProvider`,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown"}}),e.version||this._registerEvent({level:Vs.Warning,name:"_initialize.providerVersionWarning",message:`Provider for module ${n.name} does not expose version`,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown"}});const t=Math.round(performance.now()-s);return this._registerEvent({level:Vs.Debug,name:"_initialize.moduleInitialized",message:`Module ${n.name} initialized in ${t}ms`,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown",providerName:typeof e,providerVersion:e.version?.toString()||"unknown",moduleInitTime:t},metric:t}),[r,e]}))})),a=performance.now();s.pipe(Ts([])).subscribe({next:([e,t])=>{r.next(Object.assign(r.value,{[e]:t}))},error:e=>{this._registerEvent({level:Vs.Error,name:"_initialize.moduleInitializationError",message:`Failed to initialize module ${e.name||"unknown"}`,error:e}),r.error(e)},complete:()=>{const e=Math.round(performance.now()-a);return this._registerEvent({level:Vs.Debug,name:"_initialize.moduleInitializationComplete",message:`All modules initialized in ${e}ms`,properties:{modules:Object.keys(r.value).join(", "),loadTime:e},metric:e}),r.complete()}});const c=performance.now(),l=await ps(r),u=Math.round(performance.now()-c);return this._registerEvent({level:Vs.Debug,name:"_initialize.complete",message:`Modules instance created in ${u}ms`,properties:{modules:Object.keys(l).join(", "),initTime:u},metric:u}),Object.seal(l),l}async _postInitialize(e,t){const{modules:n,_afterInit:r}=this,i=ls(n).pipe(Os(e=>!!e.postInitialize),js(e=>{this._registerEvent({level:Vs.Debug,name:"_postInitialize.modulePostInitializing",message:`Module ${e.name} is being post-initialized`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"}})}),ws(n=>{const r=performance.now();return ls(n.postInitialize({ref:t,modules:e,instance:e[n.name]})).pipe(js(()=>{const e=Math.round(performance.now()-r);this._registerEvent({level:Vs.Debug,name:"_postInitialize.modulePostInitialized",message:`Module ${n.name} has been post-initialized in ${e}ms`,metric:e,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown",postInitTime:e}})}),Ts(null),Ns(e=>(this._registerEvent({level:Vs.Warning,name:"_postInitialize.modulePostInitializeError",message:`Module ${n.name} post-initialize failed`,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown"},error:e}),Ho)))}),Ts(null));this._registerEvent({level:Vs.Debug,name:"_postInitialize.modulesPostInitializing",message:`Post-initializing all modules [${Object.keys(e).length}]`,properties:{modules:Object.keys(e).join(", ")}});const o=performance.now();await ps(i);const s=Math.round(performance.now()-o);if(this._registerEvent({level:Vs.Debug,name:"_postInitialize.modulesPostInitializeComplete",message:`Post-initialization of all modules completed in ${s}ms`,properties:{modules:Object.keys(e).join(", "),postInitTime:s},metric:s}),r.length)try{this._registerEvent({level:Vs.Debug,name:"_postInitialize.afterInitHooks",message:`Executing post-initialize hooks [${r.length}]`,properties:{hooks:r.map(e=>e.name||"anonymous").join(", ")}});const t=performance.now();await Promise.allSettled(r.map(t=>Promise.resolve(t(e))));const n=Math.round(performance.now()-t);this._registerEvent({level:Vs.Debug,name:"_postInitialize.afterInitHooksComplete",message:`Post-initialize hooks completed in ${n}ms`,properties:{hooks:r.map(e=>e.name||"anonymous").join(", "),afterInitTime:n},metric:n})}catch(e){this._registerEvent({level:Vs.Warning,name:"_postInitialize.afterInitHooksError",message:"Post-initialize hooks failed",properties:{hooks:r.map(e=>e.name||"anonymous").join(", ")},error:e})}const a=Math.round(performance.now()-o);this._registerEvent({level:Vs.Debug,name:"_postInitialize.complete",message:"Post-initialization complete",properties:{modules:Object.keys(e).join(", "),postInitCompleteTime:a}})}async dispose(e,t){this._registerEvent({level:Vs.Debug,name:"dispose",message:"Disposing modules instance",properties:{modules:Object.keys(e).join(", ")}}),await Promise.allSettled(this.modules.filter(e=>!!e.dispose).map(async n=>{if(n.dispose)try{await n.dispose({ref:t,modules:e,instance:e[n.name]}),this._registerEvent({level:Vs.Debug,name:"dispose.moduleDisposed",message:`Module ${n.name} disposed successfully`,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown"}})}catch(e){this._registerEvent({level:Vs.Warning,name:"dispose.moduleDisposeError",message:`Module ${n.name} dispose failed`,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown"},error:e})}})),this.#Q.complete()}}class Xs{_operators;get operators(){return this._operators}constructor(e){this._operators=e&&"operators"in e?{...e.operators}:e??{}}add(e,t){if(Object.keys(this._operators).includes(e))throw Error(`Operator [${e}] already defined`);return this.set(e,t)}set(e,t){return this._operators[e]=t,this}remove(e){return delete this._operators[e],this}get(e){return this._operators[e]}process(e){return Object.values(this._operators).length?ls(Object.values(this._operators)).pipe((t=(e,t)=>Promise.resolve(t(e)).then(t=>t??e),n=e,r=1,Do(function(e,i){var o=n;return bs(e,i,function(e,n){return t(o,e,n)},r,function(e){o=e},!1,void 0,function(){return o=null})})),Us()):us(e);var t,n,r}}class Zs extends Xs{setHeader(e,t){const n=((e,t)=>n=>{const r=new Headers(n.headers);return r.append(e,t),{...n,headers:r}})(e,t);return this.set("header-"+e,n)}}class Js extends Xs{}const Qs=A.object({attributionReporting:A.object({eventSourceEligible:A.boolean().optional(),triggerEligible:A.boolean().optional()}).optional(),body:A.union([A.string(),A.instanceof(Blob),A.instanceof(ArrayBuffer),A.instanceof(FormData),A.instanceof(URLSearchParams),A.instanceof(ReadableStream)]).optional(),browsingTopics:A.boolean().optional(),cache:A.enum(["default","no-store","reload","no-cache","force-cache","only-if-cached"]).optional(),credentials:A.enum(["omit","same-origin","include"]).optional(),headers:A.record(A.string(),A.string()).optional().or(A.instanceof(Headers)),integrity:A.string().optional(),keepalive:A.boolean().optional(),method:A.enum(["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD","CONNECT","TRACE"],{message:"Invalid request method. Expected one of: GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD, CONNECT, TRACE. See RFC 2615 Section 9 for more information: https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html"}).optional().optional(),mode:A.enum(["same-origin","cors","no-cors","navigate","websocket"]).optional(),priority:A.enum(["low","high","auto"]).optional(),redirect:A.enum(["follow","error","manual"]).optional(),referrer:A.string().optional(),referrerPolicy:A.enum(["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"]).optional(),signal:A.instanceof(AbortSignal).optional()}).extend({uri:A.string(),path:A.string().optional()}),ea=e=>e=>{const{error:t,success:n,data:r}=A.string().optional().refine(e=>void 0===e||e===e?.toUpperCase(),{message:["Provided HTTP method must be in uppercase.","See RFC 7231 Section 4.1 for more information","https://www.rfc-editor.org/rfc/rfc7231#section-4.1"].join(" ")}).safeParse(e.method);if(e.method=n?r:e.method?.toUpperCase(),t)for(const e of t.issues)console.warn(e.message);return e},ta=e=>e=>{const{strict:t,parse:n}={},r=t?Qs:Qs.passthrough();try{const t=r.parse(e);return n?t:void 0}catch(e){if(n)throw e;console.error("Invalid request options",e.message)}};class na{_clients={};get clients(){return{...this._clients}}defaultHttpClientCtor;defaultHttpRequestHandler=new Zs({"capitalize-method":ea(),"request-validation":ta()});constructor(e){this.defaultHttpClientCtor=e}hasClient(e){return Object.keys(this._clients).includes(e)}configureClient(e,t){const n="string"==typeof t?{baseUri:t}:t,r="function"==typeof n?{onCreate:n}:n;return this._clients[e]={...this._clients[e],...r},this}}class ra extends Error{}class ia extends Ws{config;get defaultHttpRequestHandler(){return this.config.defaultHttpRequestHandler}constructor(e){super({version:"7.0.5",config:e}),this.config=e}hasClient(e){return Object.keys(this.config.clients).includes(e)}createClient(e){const t=this._resolveConfig(e),{baseUri:n,defaultScopes:r=[],onCreate:i,ctor:o=this.config.defaultHttpClientCtor,requestHandler:s=this.defaultHttpRequestHandler}=t,a=new o(n||"",{requestHandler:s});return Object.assign(a,{defaultScopes:r}),i?.(a),a}createCustomClient(e){return this.createClient(e)}_resolveConfig(e){if("string"==typeof e){const n=this.config.clients[e];if(!n&&(t=e,new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(t)))return{baseUri:e};if(!n)throw new ra(`No registered http client for key [${e}]`);return n}var t;return e}}function oa(e,t){void 0===t&&(t={});var n=t.selector,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(t,["selector"]);return new Io(function(t){var i=new AbortController,o=i.signal,s=!0,a=r.signal;if(a)if(a.aborted)i.abort();else{var c=function(){o.aborted||i.abort()};a.addEventListener("abort",c),t.add(function(){return a.removeEventListener("abort",c)})}var l=Ki(Ki({},r),{signal:o}),u=function(e){s=!1,t.error(e)};return fetch(e,l).then(function(e){n?ns(n(e)).subscribe(Oo(t,void 0,function(){s=!1,t.complete()},u)):(s=!1,t.next(e),t.complete())}).catch(u),function(){s&&i.abort()}})}const sa=async e=>{if(204===e.status)return Promise.resolve();try{const t=await e.json();if(!e.ok)throw new fr("network response was not OK",e,{data:t});return t}catch(t){if(t instanceof fr)throw t;throw new fr("failed to parse response",e,{cause:t})}},aa=async e=>{if(!e.ok)throw new Error("network response was not OK");if(204===e.status)throw new Error("no content");const t=e.headers.get("content-disposition")?.split(";").find(e=>e.includes("filename="))?.replace("filename=","")?.trim();try{return{filename:t,blob:await e.blob()}}catch(e){throw Error("failed to parse response")}},ca=e=>{try{return JSON.parse(e)}catch{return e}};function*la(e,t){const n=e.split("\n\n"),r=t?.dataParser||ca;for(const e of n){if(!e.trim())continue;const t=e.split("\n").reduce((e,t)=>{if(!t)return e;const n=t.indexOf(":");if(-1===n)return e;const i=t.slice(0,n).trim(),o=t.slice(n+1).trim();return"data"===i?e.data=r(o):e[i]=o,e},{});Object.keys(t).length&&(yield t)}}const ua=e=>t=>{if(!t.ok)throw new pr(`HTTP error! Status: ${t.status}`,t);if(!t.body)throw new pr("Response body is not readable",t);if(!t.headers.get("Content-Type")?.includes("text/event-stream"))throw new pr("Response is not a text/event-stream",t);const n=t.body.getReader();return ls(async function*(e,t){const n=!!t?.skipHeartbeats,r=t?.eventFilter?Array.isArray(t.eventFilter)?t.eventFilter:[t.eventFilter]:null,i=new TextDecoder;for(;;){const{done:o,value:s}=await e.read();if(o)break;const a=la(i.decode(s,{stream:!0}),{dataParser:t?.dataParser});for(const e of a)if(e.retry)await new Promise(t=>setTimeout(t,Number.parseInt(e.retry??"300",10)));else{if(n){if(!e.event&&!e.data&&!e.id)continue;if(e.event&&["heartbeat","ping"].includes(e.event))continue}(!r||e.event&&r.includes(e.event))&&(yield e)}}}(n,{dataParser:e?.dataParser,skipHeartbeats:e?.skipHeartbeats,eventFilter:e?.eventFilter})).pipe(Gs(e?.abortSignal?Is(e.abortSignal,"abort"):Ho),Fs(async()=>{await n.cancel().catch(()=>{}),n.releaseLock()}))};class fa{uri;requestHandler;responseHandler;_request$=new Po;_response$=new Po;_abort$=new Po;get request$(){return this._request$.asObservable()}get response$(){return this._response$.asObservable()}constructor(e,t){this.uri=e,this.requestHandler=new Zs(t?.requestHandler),this.responseHandler=new Js(t?.responseHandler),this._init()}_init(){}fetch$(e,t){return this._fetch$(e,t)}fetch(e,t){return ds(this.fetch$(e,t))}fetchAsync(e,t){return this.fetch(e,t)}json$(e,t){const n="object"==typeof t?.body?JSON.stringify(t?.body):t?.body,r=t?.selector??sa,i=new Headers(t?.headers);return i.append("Accept","application/json"),i.append("Content-Type","application/json"),this.fetch$(e,{...t,body:n,selector:r,headers:i})}json(e,t){return ds(this.json$(e,t))}blob$(e,t){const n=t?.selector??aa,r={...t,selector:n};return this.fetch$(e,r)}blob(e,t){return ds(this.blob$(e,t))}sse$(e,t,n){const r=new Headers(t?.headers);r.append("Accept","text/event-stream"),r.append("Content-Type","text/event-stream"),r.append("Cache-Control","no-cache"),r.append("Connection","keep-alive");const i=ua({...n,abortSignal:t?.signal});return this._fetch$(e,{selector:i,...t,headers:r})}jsonAsync(e,t){return this.json(e,t)}execute(e,t,n){return this[e](t,n)}abort(){this._abort$.next()}_fetch$(e,t){const{selector:n,...r}=t||{};return us({...r,uri:this._resolveUrl(e)}).pipe(Ms(e=>this._prepareRequest(e)),js(e=>this._request$.next(e)),Ms(({uri:e,path:t,...n})=>oa(e,n)),Ms(e=>this._prepareResponse(e)),js(e=>this._response$.next(e)),Ms(e=>{if(n)try{return n(e)}catch(t){throw new ur("failed to execute response selector",e,{cause:t})}return us(e)}),Gs(this._abort$))}_prepareRequest(e){return this.requestHandler.process(e)}_prepareResponse(e){return this.responseHandler.process(e)}_resolveUrl(e){const{origin:t,pathname:n}=new URL(this.uri,this.uri.startsWith("http")?void 0:window.location.origin),r=[n,e].join("/").replace(/\/{2,}/g,"/");return new URL(r,t).href}}class pa extends fa{defaultScopes=[];fetch$(e,t){const n=Object.assign(t||{},{scopes:this.defaultScopes.concat(t?.scopes||[])});return super._fetch$(e,n)}}const da={name:"http",configure:()=>new na(pa),initialize:async({config:e,hasModule:t,requireInstance:n})=>{const r=new ia(e);if(t("auth")){const e=await n("auth");r.defaultHttpRequestHandler.set("MSAL",async t=>{const{scopes:n=[]}=t;if(n.length){const r=await e.acquireAccessToken({request:{scopes:n}});if(r){const e=new Headers(t.headers);return e.set("Authorization",`Bearer ${r}`),{...t,headers:e}}}})}return r}},ha=(...e)=>t=>t.pipe(function(e,t){return io(t)?ws(e,t,1):ws(e,1)}(...e)),ma=(...e)=>t=>t.pipe(ws(...e)),ga=(...e)=>t=>t.pipe(Ms(...e)),va=e=>e.pipe(vs(e=>e.value));var ya=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function Ea(e){if(!function(e){return"string"==typeof e&&ya.test(e)}(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,255&t,(t=parseInt(e.slice(9,13),16))>>>8,255&t,(t=parseInt(e.slice(14,18),16))>>>8,255&t,(t=parseInt(e.slice(19,23),16))>>>8,255&t,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,255&t)}const ba=[];for(let e=0;e<256;++e)ba.push((e+256).toString(16).slice(1));function wa(e,t=0){return(ba[e[t+0]]+ba[e[t+1]]+ba[e[t+2]]+ba[e[t+3]]+"-"+ba[e[t+4]]+ba[e[t+5]]+"-"+ba[e[t+6]]+ba[e[t+7]]+"-"+ba[e[t+8]]+ba[e[t+9]]+"-"+ba[e[t+10]]+ba[e[t+11]]+ba[e[t+12]]+ba[e[t+13]]+ba[e[t+14]]+ba[e[t+15]]).toLowerCase()}let La;const Sa=new Uint8Array(16);function Ca(e,t,n,r,i,o){const s="string"==typeof n?function(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}(n):n,a="string"==typeof r?Ea(r):r;if("string"==typeof r&&(r=Ea(r)),16!==r?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+s.length);if(c.set(a),c.set(s,a.length),c=t(c),c[6]=15&c[6]|e,c[8]=63&c[8]|128,i){o=o||0;for(let e=0;e<16;++e)i[o+e]=c[e];return i}return wa(c)}var Ia={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function _a(e,t,n){const r=(e=e||{}).random??e.rng?.()??function(){if(!La){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");La=crypto.getRandomValues.bind(crypto)}return La(Sa)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=15&r[6]|64,r[8]=63&r[8]|128,wa(r)}function Da(e,t,n){return Ia.randomUUID&&!e?Ia.randomUUID():_a(e)}function Oa(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function Na(e,t){return e<<t|e>>>32-t}function Aa(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(e.length+1);r.set(e),r[e.length]=128;const i=(e=r).length/4+2,o=Math.ceil(i/16),s=new Array(o);for(let t=0;t<o;++t){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[64*t+4*r]<<24|e[64*t+4*r+1]<<16|e[64*t+4*r+2]<<8|e[64*t+4*r+3];s[t]=n}s[o-1][14]=8*(e.length-1)/Math.pow(2,32),s[o-1][14]=Math.floor(s[o-1][14]),s[o-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<o;++e){const r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=s[e][t];for(let e=16;e<80;++e)r[e]=Na(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let i=n[0],o=n[1],a=n[2],c=n[3],l=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),s=Na(i,5)+Oa(n,o,a,c)+l+t[n]+r[e]>>>0;l=c,c=a,a=Na(o,30)>>>0,o=i,i=s}n[0]=n[0]+i>>>0,n[1]=n[1]+o>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+l>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}function Pa(e,t,n,r){return Ca(80,Aa,e,t,n,r)}Pa.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Pa.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";class Ta extends Error{type;request;constructor(e,t){super(t.message,{cause:t.cause}),this.type=e,this.name="QueryClientError",this.request=t.request}}var Ra=Symbol.for("immer-nothing"),$a=Symbol.for("immer-draftable"),xa=Symbol.for("immer-state"),ka="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Fa(e,...t){if("production"!==process.env.NODE_ENV){const n=ka[e],r=sc(n)?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ua=Object,Ba=Ua.getPrototypeOf,Ma="constructor",Ga="prototype",ja="configurable",za="enumerable",Ha="writable",qa="value",Va=e=>!!e&&!!e[xa];function Wa(e){return!!e&&(Xa(e)||nc(e)||!!e[$a]||!!e[Ma]?.[$a]||rc(e)||ic(e))}var Ya=Ua[Ga][Ma].toString(),Ka=new WeakMap;function Xa(e){if(!e||!oc(e))return!1;const t=Ba(e);if(null===t||t===Ua[Ga])return!0;const n=Ua.hasOwnProperty.call(t,Ma)&&t[Ma];if(n===Object)return!0;if(!sc(n))return!1;let r=Ka.get(n);return void 0===r&&(r=Function.toString.call(n),Ka.set(n,r)),r===Ya}function Za(e,t,n=!0){if(0===Ja(e)){(n?Reflect.ownKeys(e):Ua.keys(e)).forEach(n=>{t(n,e[n],e)})}else e.forEach((n,r)=>t(r,n,e))}function Ja(e){const t=e[xa];return t?t.type_:nc(e)?1:rc(e)?2:ic(e)?3:0}var Qa=(e,t,n=Ja(e))=>2===n?e.has(t):Ua[Ga].hasOwnProperty.call(e,t),ec=(e,t,n=Ja(e))=>2===n?e.get(t):e[t],tc=(e,t,n,r=Ja(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n};var nc=Array.isArray,rc=e=>e instanceof Map,ic=e=>e instanceof Set,oc=e=>"object"==typeof e,sc=e=>"function"==typeof e,ac=e=>"boolean"==typeof e;var cc=e=>e.copy_||e.base_,lc=e=>e.modified_?e.copy_:e.base_;function uc(e,t){if(rc(e))return new Map(e);if(ic(e))return new Set(e);if(nc(e))return Array[Ga].slice.call(e);const n=Xa(e);if(!0===t||"class_only"===t&&!n){const t=Ua.getOwnPropertyDescriptors(e);delete t[xa];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const i=n[r],o=t[i];!1===o[Ha]&&(o[Ha]=!0,o[ja]=!0),(o.get||o.set)&&(t[i]={[ja]:!0,[Ha]:!0,[za]:o[za],[qa]:e[i]})}return Ua.create(Ba(e),t)}{const t=Ba(e);if(null!==t&&n)return{...e};const r=Ua.create(t);return Ua.assign(r,e)}}function fc(e,t=!1){return dc(e)||Va(e)||!Wa(e)||(Ja(e)>1&&Ua.defineProperties(e,{set:pc,add:pc,clear:pc,delete:pc}),Ua.freeze(e),t&&Za(e,(e,t)=>{fc(t,!0)},!1)),e}var pc={[qa]:function(){Fa(2)}};function dc(e){return null===e||!oc(e)||Ua.isFrozen(e)}var hc="MapSet",mc="Patches",gc="ArrayMethods",vc={};function yc(e){const t=vc[e];return t||Fa(0,e),t}var Ec,bc=e=>!!vc[e],wc=()=>Ec;function Lc(e,t){t&&(e.patchPlugin_=yc(mc),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Sc(e){Cc(e),e.drafts_.forEach(_c),e.drafts_=null}function Cc(e){e===Ec&&(Ec=e.parent_)}var Ic=e=>Ec={drafts_:[],parent_:Ec,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:bc(hc)?yc(hc):void 0,arrayMethodsPlugin_:bc(gc)?yc(gc):void 0};function _c(e){const t=e[xa];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Dc(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(void 0!==e&&e!==n){n[xa].modified_&&(Sc(t),Fa(4)),Wa(e)&&(e=Oc(t,e));const{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[xa].base_,e,t)}else e=Oc(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&fc(t,n)}(t,e,!0),Sc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ra?e:void 0}function Oc(e,t){if(dc(t))return t;const n=t[xa];if(!n){return $c(t,e.handledSet_,e)}if(!Ac(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:t}=n;if(t)for(;t.length>0;){t.pop()(e)}Rc(n,e)}return n.copy_}function Nc(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ac=(e,t)=>e.scope_===t,Pc=[];function Tc(e,t,n,r){const i=cc(e),o=e.type_;if(void 0!==r){if(ec(i,r,o)===t)return void tc(i,r,n,o)}if(!e.draftLocations_){const t=e.draftLocations_=new Map;Za(i,(e,n)=>{if(Va(n)){const r=t.get(n)||[];r.push(e),t.set(n,r)}})}const s=e.draftLocations_.get(t)??Pc;for(const e of s)tc(i,e,n,o)}function Rc(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:n}=t;if(n){const r=n.getPath(e);r&&n.generatePatches_(e,r,t)}Nc(e)}}function $c(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Va(e)||t.has(e)||!Wa(e)||dc(e)||(t.add(e),Za(e,(r,i)=>{if(Va(i)){const t=i[xa];if(Ac(t,n)){const n=lc(t);tc(e,r,n,e.type_),Nc(t)}}else Wa(i)&&$c(i,t,n)})),e}var xc={get(e,t){if(t===xa)return e;let n=e.scope_.arrayMethodsPlugin_;const r=1===e.type_&&"string"==typeof t;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=cc(e);if(!Qa(i,t,e.type_))return function(e,t,n){const r=Uc(t,n);return r?qa in r?r[qa]:r.get?.call(e.draft_):void 0}(e,i,t);const o=i[t];if(e.finalized_||!Wa(o))return o;if(r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&function(e){const t=+e;return Number.isInteger(t)&&String(t)===e}(t))return o;if(o===Fc(e.base_,t)){Mc(e);const n=1===e.type_?+t:t,r=Gc(e.scope_,o,e,n);return e.copy_[n]=r}return o},has:(e,t)=>t in cc(e),ownKeys:e=>Reflect.ownKeys(cc(e)),set(e,t,n){const r=Uc(cc(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Fc(cc(e),t),s=r?.[xa];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(((i=n)===(o=r)?0!==i||1/i==1/o:i!=i&&o!=o)&&(void 0!==n||Qa(e.base_,t,e.type_)))return!0;Mc(e),Bc(e)}var i,o;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),function(e,t,n){const{scope_:r}=e;if(Va(n)){const i=n[xa];Ac(i,r)&&i.callbacks_.push(function(){Mc(e);const r=lc(i);Tc(e,n,r,t)})}else Wa(n)&&e.callbacks_.push(function(){const i=cc(e);3===e.type_?i.has(n)&&$c(n,r.handledSet_,r):ec(i,t,e.type_)===n&&r.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&$c(ec(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n)),!0},deleteProperty:(e,t)=>(Mc(e),void 0!==Fc(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),Bc(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=cc(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[Ha]:!0,[ja]:1!==e.type_||"length"!==t,[za]:r[za],[qa]:n[t]}:r},defineProperty(){Fa(11)},getPrototypeOf:e=>Ba(e.base_),setPrototypeOf(){Fa(12)}},kc={};for(let e in xc){let t=xc[e];kc[e]=function(){const e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function Fc(e,t){const n=e[xa];return(n?cc(n):e)[t]}function Uc(e,t){if(!(t in e))return;let n=Ba(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Ba(n)}}function Bc(e){e.modified_||(e.modified_=!0,e.parent_&&Bc(e.parent_))}function Mc(e){e.copy_||(e.assigned_=new Map,e.copy_=uc(e.base_,e.scope_.immer_.useStrictShallowCopy_))}kc.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&Fa(13),kc.set.call(this,e,t,void 0)},kc.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&Fa(14),xc.set.call(this,e[0],t,n,e[0])};function Gc(e,t,n,r){const[i,o]=rc(t)?yc(hc).proxyMap_(t,n):ic(t)?yc(hc).proxySet_(t,n):function(e,t){const n=nc(e),r={type_:n?1:0,scope_:t?t.scope_:wc(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,o=xc;n&&(i=[r],o=kc);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,[a,r]}(t,n);return(n?.scope_??wc()).drafts_.push(i),o.callbacks_=n?.callbacks_??[],o.key_=r,n&&void 0!==r?function(e,t,n){e.callbacks_.push(function(r){const i=t;if(!i||!Ac(i,r))return;r.mapSetPlugin_?.fixSetContents(i);const o=lc(i);Tc(e,i.draft_??i,o,n),Rc(i,r)})}(n,o,r):o.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(o);const{patchPlugin_:t}=e;o.modified_&&t&&t.generatePatches_(o,[],e)}),i}function jc(e){if(!Wa(e)||dc(e))return e;const t=e[xa];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=uc(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=uc(e,!0);return Za(n,(e,t)=>{tc(n,e,jc(t))},r),t&&(t.finalized_=!1),n}var zc=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(sc(e)&&!sc(t)){const n=t;t=e;const r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}let r;if(sc(t)||Fa(6),void 0===n||sc(n)||Fa(7),Wa(e)){const i=Ic(this),o=Gc(i,e,void 0);let s=!0;try{r=t(o),s=!1}finally{s?Sc(i):Cc(i)}return Lc(i,n),Dc(r,i)}if(!e||!oc(e)){if(r=t(e),void 0===r&&(r=e),r===Ra&&(r=void 0),this.autoFreeze_&&fc(r,!0),n){const t=[],i=[];yc(mc).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}Fa(1,e)},this.produceWithPatches=(e,t)=>{if(sc(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},ac(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),ac(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),ac(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Wa(e)||Fa(8),Va(e)&&(e=function(e){Va(e)||Fa(10,e);return jc(e)}(e));const t=Ic(this),n=Gc(t,e,void 0);return n[xa].isManual_=!0,Cc(t),n}finishDraft(e,t){const n=e&&e[xa];n&&n.isManual_||Fa(9);const{scope_:r}=n;return Lc(r,t),Dc(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=yc(mc).applyPatches_;return Va(e)?r(e,t):this.produce(e,e=>r(e,t))}},Hc=zc.produce;const qc=(...e)=>Os(t=>e.includes(t.type));class Vc extends Io{#ee=new Po;#te;get action$(){return this.#ee.asObservable()}get value(){return this.#te.value}get closed(){return this.#te.closed||this.#ee.closed}constructor(e,t){super(e=>this.#te.subscribe(e));const n="getInitialState"in e?e.getInitialState():t;this.#te=new Ro(n),this.#ee.pipe(function(e,t){return Do(As(e,t,arguments.length>=2,!0))}(e,n),Rs()).subscribe(this.#te),this.reset=()=>this.#te.next(n)}reset;next(e){this.#ee.next(e)}select(e,t){return this.#te.pipe(vs(e),Rs(t))}addEffect(e,t){const n="function"==typeof e?this.action$:Array.isArray(e)?this.action$.pipe(qc(...e)):this.action$.pipe(qc(e)),r=t||e;return n.pipe(ws(e=>ls(new Promise((t,n)=>{try{t(r(e,this.value))}catch(e){n(e)}})).pipe(Ns(e=>(console.warn("unhandled effect",e),Ho)))),Os(e=>!!e),os(jo)).subscribe(this.#ee)}addEpic(e){return this.addFlow(e)}addFlow(e){const t=e(this.action$,this);if(!t)throw new TypeError(`addEpic: one of the provided effects "${e.name||"<anonymous>"}" does not return a stream. Double check you're not missing a return statement!`);return t.pipe(Ns(e=>(console.trace("unhandled exception, epic closed!",e),Ho)),os(jo)).subscribe(this.#ee)}unsubscribe(){this.#ee.unsubscribe(),this.#te.unsubscribe()}complete(){this.#ee.complete(),this.#te.complete()}asObservable(){return this.#te.asObservable()}}function Wc(e,t){function n(...n){if(t){const r=t(...n);if(!r)throw new Error("prepareAction did not return an object");return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>t.type===e,n}const Yc="::";function Kc(e,t,n,r){const i=Wc([e,"request"].join(Yc),t);return n&&Object.assign(i,{success:Wc([e,"success"].join(Yc),n)}),r&&Object.assign(i,{failure:Wc([e,"failure"].join(Yc),r)}),i}function Xc(e){return Wa(e)?Hc(e,()=>{}):e}function Zc(e,t){const[n,r,i]=function(e){const t={},n=[];let r;const i={addCase(e,o){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");if(r)throw new Error("`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const s="string"==typeof e?e:e.type;if(s in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[s]=o,i},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&r)throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&r)throw new Error("`builder.addDefaultCase` can only be called once");return r=e,i}};return e(i),[t,n,r]}(t);let o;if("function"==typeof e)o=()=>Xc(e());else{const t=Xc(e);o=()=>t}function s(e,t){let s=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return i&&0===s.filter(e=>!!e).length&&(s=[i]),s.reduce((e,n)=>{if(n){if(Va(e)){const r=n(e,t);return void 0===r?e:r}if(Wa(e))return Hc(e,e=>n(e,t));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}}return e},e??o())}return s.getInitialState=o,s}const Jc={request:Wc("client/request",(e,t)=>({payload:{args:e,options:t},meta:{transaction:Da(),created:Date.now()}})),execute:Kc("client/execute",e=>({payload:e,meta:{transaction:e,created:Date.now()}}),e=>({payload:e,meta:{transaction:e.transaction,created:Date.now()}}),(e,t)=>({payload:{error:e},meta:{transaction:t,created:Date.now()}})),cancel:Wc("client/cancel",(e,t)=>({payload:{transaction:e,reason:t},meta:{transaction:e,created:Date.now()}})),error:Wc("client/error",(e,t)=>({payload:{transaction:e,error:t},meta:{transaction:e,created:Date.now()}}))},Qc=e=>e.pipe(Os(Jc.request.match),vs(e=>Jc.execute(e.meta.transaction)));class el extends Io{#ne=new Ro("idle");get status(){return this.#ne.value}get status$(){return this.#ne.asObservable()}#re;#ie;get transaction(){return this.#ie}created=Date.now();get closed(){return"complete"===this.status||"error"===this.status||"canceled"===this.status}constructor(e,t,n){super(t=>{const{transaction:r}=this,i=e.action$.pipe(Os(e=>e.meta.transaction===r));t.add(e.state$.pipe(Os(e=>!!e[r]),vs(e=>e[r])).subscribe(e=>{this.#ne.next(e.status)})),t.add(i.pipe(Os(Jc.execute.success.match),vs(({payload:e})=>e)).subscribe(e=>{this.#ne.next("complete"),t.next(e),t.complete()})),t.add(i.pipe(Os(Jc.error.match),vs(({payload:e})=>e)).subscribe(e=>{this.#ne.next("error"),t.error(e.error)})),t.add(i.pipe(Os(Jc.cancel.match)).subscribe(e=>{this.#ne.next("canceled"),t.error(new Ta("abort",{message:e.payload.reason||`job: ${r} was canceled`,request:this.#re.getRequest(e.meta.transaction)}))})),n?.signal&&t.add(Is(n?.signal,"abort").pipe(vs(()=>Jc.cancel(r,`job: ${r} was aborted on signal from caller: ${n?.ref}`))).subscribe(t=>e.next(t))),t.add(()=>{this.complete()})}),this.#re=e;const r=Jc.request(t,{ref:n?.ref,retry:n?.retry});this.#ie=r.meta.transaction,this.#re.next(r)}complete(e){this.closed||this.cancel(e??`job: ${this.transaction} was completed`)}cancel(e){const t=this.transaction;this.#re.cancel(t,e??`job: ${t} was canceled`)}[Symbol.dispose](){this.complete()}}class tl{type;transaction;data;constructor(e,t,n){this.type=e,this.transaction=t,this.data=n}}class nl extends Io{#te;#oe;#se;_registerEvent(e,t,n){this.#se.next(new tl(e,t,n))}get closed(){return this.#te.closed}get state$(){return this.#te.asObservable()}get action$(){return this.#te.action$}get event$(){return this.#se.asObservable()}get success$(){return this.action$.pipe(Os(Jc.execute.success.match),vs(({payload:e})=>e))}get error$(){return this.action$.pipe(qc("client/error"),zs(this.#te),vs(([e,t])=>{const{payload:n,meta:{transaction:r}}=e,i=t[r];return new Ta("error",{request:i,message:`job: ${r} failed`,cause:n})}))}constructor(e,t){super(e=>this.#te.subscribe(e)),this.#te=new Vc(((e={})=>Zc(e,e=>{e.addCase(Jc.request,(e,t)=>{e[t.meta.transaction]={...t.payload,...t.meta,execution:[],errors:[],status:"idle"}}),e.addCase(Jc.execute,(e,t)=>{const n=e[t.payload];n&&(n.execution.push(Date.now()),n.status="active")}),e.addCase(Jc.execute.success,(e,t)=>{delete e[t.payload.transaction]}),e.addCase(Jc.execute.failure,(e,t)=>{const n=e[t.meta.transaction];n&&(n.errors.push(t.payload.error),n.status="failed")}),e.addCase(Jc.error,(e,t)=>{delete e[t.meta.transaction]}),e.addCase(Jc.cancel,(e,t)=>{delete e[t.meta.transaction]})}))({})),this.#oe=new co(()=>{this.#te.complete(),this.#se.complete()}),this.#se=new Po,this.#oe.add(this.#te.addFlow(Qc)),this.#oe.add(this.#te.addFlow((e=>(t,n)=>t.pipe(Os(Jc.execute.match),zs(n),ws(([n,r])=>{const i=n.payload,o=r[i],s=new AbortController,a=t.pipe(Os(Jc.cancel.match),Os(e=>e.payload.transaction===i),js(()=>{s.signal.aborted||s.abort()}));try{return ls(e(o.args,s.signal)).pipe(vs(e=>Jc.execute.success({...o,status:"complete",completed:Date.now(),value:e})),Ns(e=>us(Jc.execute.failure(e,i))),Gs(a))}catch(e){return us(Jc.execute.failure(e,i))}})))(e))),this.#oe.add(this.#te.addFlow((e=>(t,n)=>t.pipe(Os(Jc.execute.failure.match),zs(n),ws(([t,r])=>{const{transaction:i}=t.meta,o=r[i];if(!o)return us(Jc.error(i,new Ta("error",{message:"request not found, cannot retry request, most likely removed while scheduled for retry!"})));const s=o.execution.length,a=Object.assign({},e,o.options?.retry),c=o.errors?.slice(-1)[0]??new Ta("error",{message:"no errors registered for request!",request:o});if(s>a.count){const e=0===a.count?c:new Ta("error",{message:"maximum retries executed!",cause:o.errors,request:o});return us(Jc.error(i,e))}return("function"==typeof a.delay?ls(a.delay(c)).pipe(Ns(e=>us(Jc.error(i,new Ta("error",{message:"retry delay callback failed!",cause:[...o.errors??[],e],request:o}))))):Ds(a.delay)).pipe(zs(n),Os(([e,t])=>!!t[i]),js(([,e])=>{if(!e[i])throw new Ta("error",{message:"request not found, most likely removed while scheduled for retry",cause:o.errors,request:o})}),vs(()=>Jc.execute(i)))})))(Object.assign({count:0,delay:0},t?.retry)))),this.#te.addEffect(Jc.request.type,({payload:e,meta:{transaction:t}})=>{this._registerEvent("query_client_job_requested",t,e)}),this.#te.addEffect(Jc.execute.type,({meta:{transaction:e}})=>{this._registerEvent("query_client_job_executing",e)}),this.#te.addEffect(Jc.execute.success.type,({payload:e,meta:{transaction:t}})=>{this._registerEvent("query_client_job_completed",t,{payload:e})}),this.#te.addEffect(Jc.execute.failure.type,({payload:e,meta:{transaction:t}})=>{const n=e.error instanceof Error?e.error:new Error(String(e.error));this._registerEvent("query_client_job_failed",t,{error:n})}),this.#te.addEffect(Jc.cancel.type,({payload:{reason:e},meta:{transaction:t}})=>{this._registerEvent("query_client_job_canceled",t,{reason:e||"no reason provided"})}),this.#te.addEffect(Jc.error.type,({payload:e,meta:{transaction:t}})=>{const n=e.error instanceof Error?e.error:new Error(String(e.error));this._registerEvent("query_client_job_error",t,{error:n})})}next(e){this.#te.next(e)}query(e,t){const n=new el(this,e,t),r=n.pipe(function(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new Po}:t,r=e.resetOnError,i=void 0===r||r,o=e.resetOnComplete,s=void 0===o||o,a=e.resetOnRefCountZero,c=void 0===a||a;return function(e){var t,r,o,a=0,l=!1,u=!1,f=function(){null==r||r.unsubscribe(),r=void 0},p=function(){f(),t=o=void 0,l=u=!1},d=function(){var e=t;p(),null==e||e.unsubscribe()};return Do(function(e,h){a++,u||l||f();var m=o=null!=o?o:n();h.add(function(){0!==--a||u||l||(r=Bs(d,c))}),m.subscribe(h),!t&&a>0&&(t=new bo({next:function(e){return m.next(e)},error:function(e){u=!0,f(),r=Bs(p,i,e),m.error(e)},complete:function(){l=!0,f(),r=Bs(p,s),m.complete()}}),ns(e).subscribe(t))})(e)}}({connector:()=>new xo,resetOnRefCountZero:!1}));return Object.defineProperties(r,{transaction:{get:()=>n.transaction},created:{get:()=>n.created},status:{get:()=>n.status},closed:{get:()=>n.closed},cancel:{value:e=>n.cancel(e)},complete:{value:()=>n.complete()}}),r}async nextAsync(e,t){return ds(this.query(e,t))}getRequest(e){return this.#te.value[e]}getRequestByRef(e){return Object.values(this.#te.value).find(t=>t.ref===e)}cancelTaskByRef(e,t){const n=this.getRequestByRef(e);n?.ref&&this.cancel(n.transaction,t)}cancel(e,t){if(e)this.#te.value[e]&&(t??=`cancelation requested for job: ${e}`,this.#te.next(Jc.cancel(e,t)));else for(const e of Object.keys(this.#te.value))this.cancel(e,"all transactions requested canceled")}on(e,t){return this.#te.addEffect(Jc[e].type,e=>{t(e,this)})}complete(){this.#oe.unsubscribe()}}const rl={set:Wc("cache/set",(e,t)=>({payload:{key:e,record:t}})),insert:Wc("cache/insert",(e,t)=>({payload:{key:e,entry:t}})),remove:Wc("cache/remove",e=>({payload:e})),invalidate:Wc("cache/invalidate",(e,t)=>({payload:e,meta:{item:t}})),mutate:Wc("cache/mutate",(e,t,n)=>({payload:{...t,key:e},meta:{item:n}})),trim:Wc("cache/trim",e=>({payload:e}))},il=(e,t)=>(t.updated??0)-(e.updated??0);class ol{type;key;data;constructor(e,t,n){this.type=e,this.key=t,this.data=n}}class sl{#te;#se;get state(){return this.#te.value}get state$(){return this.#te.asObservable()}get action$(){return this.#te.action$}_registerEvent(e,t){this.#se.next(new ol(e,t?.key,t?.data))}get event$(){return this.#se.asObservable()}constructor(e){const{trimming:t,initial:n}=e??{};this.#te=new Vc(function(e,t={}){return Zc(t,t=>t.addCase(e.set,(e,t)=>{const{key:n,record:r}=t.payload;e[n]=r}).addCase(e.insert,(e,t)=>{const{key:n,entry:r}=t.payload,i=e[n];if(i)i.updated=Date.now(),i.updates??=0,i.updates++,i.value=r.value,i.transaction=r.transaction,i.mutated=void 0;else{const t=Date.now();e[n]={...r,created:t,updated:t}}}).addCase(e.remove,(e,t)=>{delete e[t.payload]}).addCase(e.invalidate,(e,t)=>{const n=t.payload?[t.payload]:Object.keys(e);for(const t of n){const n=e[t];n&&(n.updated=void 0)}}).addCase(e.mutate,(e,t)=>{const{key:n,value:r,updated:i}=t.payload,o=e[n];o&&(o.value=r,o.updated=i,o.mutated=Date.now(),o.updates??=0,o.updates++)}).addCase(e.trim,(e,t)=>{const{payload:n}=t,r=n.sort??il,i=Object.keys(e),o=Object.entries(e).filter(([e,t])=>!n.validate||n.validate(t)).sort((e,t)=>r(e[1],t[1])).slice(0,n.size??Number.MAX_SAFE_INTEGER).map(([e])=>e);if(i.length!==o.length)for(const t of i){const n=o.indexOf(t);-1!==n?o.splice(n,1):delete e[t]}}))}(rl,n)),t&&this.#te.addEffect("cache/set",()=>this.#te.next(rl.trim(t))),this.#se=new Po}has(e){return e in this.#te.value}setItem(e,t){const{args:n,transaction:r,value:i}=t;this.#te.next(rl.insert(e,{args:n,transaction:r,value:i})),this._registerEvent("query_cache_entry_inserted",{key:e,data:{value:i,args:n,transaction:r}})}getItem(e){return this.#te.value[e]}removeItem(e){this.#te.next(rl.remove(e)),this._registerEvent("query_cache_entry_removed",{key:e})}invalidate(e){const t=e?this.#te.value[e]:void 0;this.#te.next(rl.invalidate(e,t)),e&&this._registerEvent("query_cache_entry_invalidated",{key:e,data:{previousValue:t?.value}})}mutate(e,t){const n=e in this.#te.value?this.#te.value[e]:void 0;if(!n)throw new Error(`Cannot mutate cache item with key ${e}: item not found`);const r="function"==typeof t?t(n?.value):t;return this.#te.next(rl.mutate(e,r,n)),this._registerEvent("query_cache_entry_mutated",{key:e,data:{previousValue:n.value,newValue:r,mutation:r}}),()=>this.#te.next(rl.set(e,n))}trim(e){const t=new Set(Object.keys(this.#te.value));this.#te.next(rl.trim(e));const n=new Set(Object.keys(this.#te.value)),r=Array.from(t).filter(e=>!n.has(e));this._registerEvent("query_cache_trimmed",{data:{removedKeys:r,criteria:e}})}reset(){this.#te.reset(),this._registerEvent("query_cache_reset")}complete(){this.#te.complete(),this.#se.complete()}}class al extends Po{key;args;options;#ae=Date.now();get created(){return this.#ae}#ce=Da();get uuid(){return this.#ce}constructor(e,t,n){super(),this.key=e,this.args=t,this.options=n}processJob(e){return e.pipe(vs(t=>{const{key:n,uuid:r,created:i}=this;return{key:n,uuid:r,created:i,status:"complete",transaction:e.transaction,complete:t.completed,value:t.value}}),Fs(()=>{e.complete()})).subscribe(this)}}class cl{type;key;data;constructor(e,t,n){this.type=e,this.key=t,this.data=n}}class ll{static extractQueryValue=va;#oe=new co;#re;#le;#ue=new Po;#fe={};#pe;#de;#he=Da();#Q;get client(){return this.#re}_registerEvent(e,t,n){this.#Q.next(new cl(e,t,n))}get cache(){return this.#le}get event$(){return this.#Q.asObservable()}constructor(e){this.#Q=new Po,this.#pe=t=>Pa(e.key(t),this.#he),this.#de=e?.validate??((e=0)=>t=>(t.updated??0)+e>Date.now())(e?.expire),e.client instanceof nl?this.#re=e.client:(this.#re=new nl(e.client.fn,{...e.client.options}),this.#oe.add(()=>this.#re.complete())),this.#oe.add(this.#re.event$.subscribe({next:e=>this.#Q.next(e)})),e.cache instanceof sl?this.#le=e.cache:(this.#le=new sl(e.cache||{}),this.#oe.add(()=>this.#le.complete())),this.#oe.add(this.#le.event$.subscribe({next:e=>this.#Q.next(e)}));const t=((e="switch")=>"function"==typeof e?e:(()=>{switch(e){case"concat":return ha;case"merge":return ma;case"switch":return ga;default:throw new Error(`Invalid queue operator: ${e}`)}})())(e.queueOperator);var n,r;this.#oe.add(()=>this.#ue.complete()),this.#oe.add(this.#ue.pipe(js(e=>{this._registerEvent("query_queued",e)}),Os(e=>!!(e in this.#fe)),t(e=>{const t=this.#fe[e],{args:n,options:r,uuid:i}=t;if(this._registerEvent("query_job_selected",e,{taskId:i,args:n,options:r}),!t?.observed)return this._registerEvent("query_job_skipped",e,{taskId:i,args:n,options:r}),delete this.#fe[e],Ho;const o=this.#re.query(n,{...r,ref:t.uuid});return new Io(s=>{const{transaction:a}=o;var c,l;this._registerEvent("query_job_started",e,{taskId:i,transaction:a,args:n,options:r}),s.add(()=>{this._registerEvent("query_job_closed",e,{taskId:i,transaction:a,args:n,options:r}),o.complete("task closed"),delete this.#fe[e]}),s.add((c=10,void 0===l&&(l=jo),Ds(c,c,l)).pipe(Os(()=>!t.observed)).subscribe(()=>{o.cancel(`task: ${t.uuid} is not observed`),s.complete()})),s.add(t.processJob(o).add(()=>{this._registerEvent("query_job_completed",e,{taskId:i,transaction:a,args:n,options:r})})),o.pipe(vs(e=>({result:e,task:t})),Ns(()=>Ho)).subscribe(s)})}),(n=()=>!this.#re.closed,void 0===r&&(r=!1),Do(function(e,t){var i=0;e.subscribe(Oo(t,function(e){var o=n(e,i++);(o||r)&&t.next(e),!o&&t.complete()}))}))).subscribe(e=>{const{value:t,transaction:n}=e.result,{args:r,key:i,uuid:o}=e.task;this._registerEvent("query_cache_added",i,{data:t,taskId:o,args:r,transaction:n}),this._registerEvent("query_completed",i,{data:t,hasValidCache:!0}),this.#le.setItem(i,{value:t,args:r,transaction:n})}))}query(e,t){return this._query(e,t)}queryAsync(e,t){const{skipResolve:n,...r}=t||{},i=n?ds:ps;return new Promise((n,o)=>{t?.signal&&t.signal.addEventListener("abort",()=>o(new Error("Query aborted"))),i(this._query(e,r).pipe(xs())).then(n,o)})}persistentQuery(e,t){const n=this.#pe(e),r=this._query(e,t);return new Io(i=>{i.add(r.subscribe({next:i.next.bind(i),error:i.error.bind(i)}));const o=t?.cache?.validate||this.#de;i.add(this.cache.state$.pipe(Os(e=>n in e),vs(t=>({...t[n],key:n,status:"cache",hasValidCache:o(t[n],e)}))).subscribe(i))}).pipe(Rs((e,t)=>e.transaction===t.transaction&&e.mutated===t.mutated))}generateCacheKey(e){return this.#pe(e)}mutate(e,t,n){const r=this.#pe(e);if(r in this.cache.state==!1){if(void 0===n?.allowCreation)throw new Error(`Cannot mutate cache item with key ${r}: item not found and option "allowCreation" is false`);if(!1===n.allowCreation)return()=>{};const{value:i}="function"==typeof t?t():t;this.cache.setItem(r,{args:e,transaction:Da(),value:i})}return this.#le.mutate(r,t)}invalidate(e){this.#le.invalidate(e&&this.#pe(e))}complete(){this.#oe.unsubscribe(),this.#Q?.complete()}onInvalidate(e){const t=this.#le.action$.pipe(qc("cache/invalidate")).subscribe(t=>e({detail:{item:t.meta.item}}));return()=>t.unsubscribe()}onMutate(e){const t=this.#le.action$.pipe(qc("cache/mutate")).subscribe(t=>e({detail:{changes:t.payload,current:t.meta.item}}));return()=>t.unsubscribe()}_query(e,t){const n=this.#pe(e),r=this._createTask(n,e,t);return this._registerEvent("query_created",n,{args:e,options:t}),r}_createTask(e,t,n){return new Io(r=>{if(n?.signal){if(n?.signal.aborted)return this._registerEvent("query_aborted",e),r.complete();r.add(Is(n?.signal,"abort").subscribe(()=>{this._registerEvent("query_aborted",e),r.complete()}))}const i=this.#le.getItem(e);if(i){this._registerEvent("query_cache_hit",e,{cacheEntry:i});const o=n?.cache?.suppressInvalid??!1,s=(n?.cache?.validate||this.#de)(i,t),a={...i,key:e,status:"cache",hasValidCache:s};if(r.next(a),s||o)return this._registerEvent("query_completed",e,{data:i.value,hasValidCache:s}),r.complete();this._registerEvent("query_cache_miss",e)}const o=e in this.#fe;o?this._registerEvent("query_connected",e,{isExistingTask:!0}):(this.#fe[e]=new al(e,t,n),this._registerEvent("query_job_created",e,{taskId:this.#fe[e].uuid,args:t,options:n}));const s=this.#fe[e];r.add(s.subscribe(r)),o||this.#ue.next(e)})}}const ul=N.object({key:N.string().describe("The key used to identify the service"),uri:N.string().describe("The URI of the service"),id:N.string().optional().describe("The ID of the service"),environment:N.string().optional().describe("The environment of the service"),name:N.string().optional().describe("The name of the service"),scopes:N.array(N.string()).optional().default([]).describe("Endpoint authentication scopes"),tags:N.array(N.string()).optional().describe("Tags for the service")}).describe("A service from the service discovery API").transform(e=>({...e,get defaultScopes(){return e.scopes??[]}})),fl=N.array(ul).describe("A list of services from the service discovery API"),pl=e=>ls(sa(e)).pipe(vs(e=>fl.default([]).parse(e)));class dl{#me;endpoint;http;constructor({http:e,endpoint:t}){this.http=e,this.endpoint=t,this.#me=new ll({client:{fn:()=>e.fetch$(t??"",{selector:pl})},key:()=>"services",expire:3e5})}resolveServices(e){return(e?ds:ps)(ll.extractQueryValue(this.#me.query()))}async resolveService(e,t){const n=(await this.resolveServices(t)).find(t=>t.key===e);if(!n)throw Error(`Failed to resolve service, invalid key [${e}]`);return n}}class hl extends qs{async _createConfig(e,t){if(!e.hasModule("http"))throw new Error("http module is required");if(!this._has("discoveryClient")){(await e.requireInstance("http")).hasClient("service_discovery")&&this.configureServiceDiscoveryClientByClientKey("service_discovery")}return ps(ls(super._createConfig(e,t)))}_processConfig(e,t){if(!e.discoveryClient)throw new Error("discoveryClient is required, please configure it");return super._processConfig(e,t)}setServiceDiscoveryClient(e){this._set("discoveryClient","function"==typeof e?e:async()=>e)}configureServiceDiscoveryClient(e){this.setServiceDiscoveryClient(async t=>{const{httpClient:n,endpoint:r}=await ps(ls(e(t)))??{};if(n)return new dl({http:n,endpoint:r});throw Error("httpClient is required")})}configureServiceDiscoveryClientByClientKey(e,t){this.configureServiceDiscoveryClient(async({requireInstance:n})=>({httpClient:(await n("http")).createClient(e),endpoint:t}))}}class ml extends Ws{config;_http;constructor(e,t){super({version:"9.0.4",config:e}),this.config=e,this._http=t}resolveServices(){return this.config.discoveryClient.resolveServices()}async resolveService(e){return this.config.discoveryClient.resolveService(e)}async createClient(e,t){const n=await this.resolveService(e);if(!n)throw Error(`Could not load configuration of service [${e}]`);return this._http.createClient({...t,baseUri:n.uri,defaultScopes:n.scopes})}async configureClient(e,t){const{key:n,alias:r}="string"==typeof e?{key:e,alias:e}:e,{uri:i,scopes:o}=await this.resolveService(n);var s,a;t.addConfig((s=r,a={baseUri:i,defaultScopes:o},{module:da,configure:e=>{e.configureClient(s,a)}}))}}const gl={name:"serviceDiscovery",configure:()=>new hl,initialize:async e=>{const{requireInstance:t,ref:n}=e,r=await e.config.createConfigAsync(e,{...n?.serviceDiscovery?.config}),i=await t("http");return new ml(r,i)}},vl=(e,t)=>{e.addConfig((e=>({module:gl,configure:t=>e(t)}))(()=>Promise.resolve()))};var yl,El,bl,wl={},Ll=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Cloudflare Pages",constant:"CLOUDFLARE_PAGES",env:"CF_PAGES"},{name:"Cloudflare Workers",constant:"CLOUDFLARE_WORKERS",env:"WORKERS_CI"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}];function Sl(){return yl||(yl=1,function(e){const t=Ll,n=process.env;function r(e){return"string"==typeof e?!!n[e]:"env"in e?n[e.env]&&n[e.env].includes(e.includes):"any"in e?e.any.some(function(e){return!!n[e]}):Object.keys(e).every(function(t){return n[t]===e[t]})}Object.defineProperty(e,"_vendors",{value:t.map(function(e){return e.constant})}),e.name=null,e.isPR=null,e.id=null,t.forEach(function(t){const i=(Array.isArray(t.env)?t.env:[t.env]).every(function(e){return r(e)});e[t.constant]=i,i&&(e.name=t.name,e.isPR=function(e){switch(typeof e.pr){case"string":return!!n[e.pr];case"object":return"env"in e.pr?"any"in e.pr?e.pr.any.some(function(t){return n[e.pr.env]===t}):e.pr.env in n&&n[e.pr.env]!==e.pr.ne:"any"in e.pr?e.pr.any.some(function(e){return!!n[e]}):r(e.pr);default:return null}}(t),e.id=t.constant)}),e.isCI=!("false"===n.CI||!(n.BUILD_ID||n.BUILD_NUMBER||n.CI||n.CI_APP_ID||n.CI_BUILD_ID||n.CI_BUILD_NUMBER||n.CI_NAME||n.CONTINUOUS_INTEGRATION||n.RUN_ID||e.name))}(wl)),wl}var Cl=ue(bl?El:(bl=1,El=Sl().isCI));const Il=["5a842df8-3238-415d-b168-9f16a6a6031b/.default"];var _l;!function(e){e.ContinuesIntegration="ci",e.QualityAssurance="fqa",e.Training="tr",e.Production="fprd",e.Development="dev"}(_l||(_l={}));const Dl=e=>e&&!Cl?_l.Development:_l.ContinuesIntegration,Ol=e=>{const t=new Ks,n=e.env??_l.ContinuesIntegration;return t.addConfig({module:da,configure:t=>{const r=n===_l.Development?_l.ContinuesIntegration:n,i=e.serviceDiscovery?.url??new URL(`/service-registry/environments/${r}/services`,"https://discovery.fusion.equinor.com").toString(),o=e.serviceDiscovery?.scope??Il;t.configureClient("service_discovery",{baseUri:i,defaultScopes:o})}}),vl(t),U(t,t=>{const{auth:n}=e;if("token"in n&&n.token){const{token:e}=n;return t.setMode("token_only"),void t.setAccessToken(e)}const{clientId:r,tenantId:i,interactive:o}=n;if(!r||!i)throw new Error("clientId and tenantId are required for auth module");if(t.setClientConfig(i,r),t.setMode(o?"interactive":"silent"),o){const{server:e}=n;if(!e.port)throw new Error("server.port is required for interactive mode");t.setServerPort(e.port),t.setServerOnOpen(e.onOpen)}}),t},Nl=async e=>{const t=Ol(e);return await t.initialize()},Al=async e=>{const{log:t}=e,{config:n}=await lr({log:t,config:e.config,env:{environment:e.environment}}),{manifest:r}=await nn({log:t,manifest:e.manifest,env:{environment:e.environment}}),i=r.build?.version;if(!i){const e=new Error("No build version found in the manifest. Please make sure the manifest is valid.");throw t?.fail("🤪",e.message),e}t?.start("Initializing Fusion Framework...");const o=await Nl({env:e.environment,auth:e.auth});t?.succeed("Initialized Fusion Framework");const s=await o.serviceDiscovery.createClient("apps");s.request$.subscribe(e=>{t?.debug("Request:",e),t?.info("🌎","Executing request to:",Jt(e.uri))}),t?.start("Publishing application config"),t?.info("Using environment:",le.redBright(e.environment));try{const e=await s.json(`/apps/${r.appKey}/builds/${i}/config`,{method:"PUT",body:n,headers:rr});t?.debug("Response:",e),t?.succeed("Published application config")}catch(e){if(e instanceof fr)switch(e.response.status){case 410:t?.fail("🤬",`App ${r.appKey} is deleted from apps-service. Please check the app key and try again.`);break;case 404:t?.fail("🤬",`App ${r.appKey} not found. Please check the app key and try again.`);break;case 403:case 401:t?.fail("🤬","You are not authorized to publish application config. Please check your permissions.");break;default:t?.fail("🤬","Failed to publish application config.",`Status code: ${e.response.status}`,`Message: ${e.response.statusText}`)}throw e}},Pl=async e=>{const{log:n}=e??{},r="@equinor/fusion-framework-dev-portal",o=await tn(n),s={root:o.root,environment:"local",...e?.env,mode:"development",command:"serve"},a=await en(s,o,{log:n,manifestPath:e?.manifest}),c=await cr(s,{log:n,config:e?.config});let u,p;const d=f(import.meta.resolve(r));Nt(d)?(u=d,p=await l({cwd:d}).then(e=>e?i(e?.path):void 0)):n?.info(`Portal ${r} is external, skipping entry point resolution`);const h=await Rt(s,o),m=p?[o.root,p]:[o.root];n?.debug(`File system access allowed for: \n${m.join("\n")}\n`);const g=t(h,{server:{port:e?.port||3e3,host:e?.host||h.server?.host||"localhost",fs:{allow:m}}}),v={template:{portal:{id:r}},app:{manifest:a,config:c}};u&&(v.portal={manifest:{name:r,build:{templateEntry:u,assetPath:"/@fs"}},config:{}}),n?.debug("vite config:",g),n?.debug("dev server config:",v),n?.start("Starting app development server...");const y=await tr(s,v,{overrides:g,log:n});await y.listen(),n?.succeed("App development server started successfully");const E=y.config.server.https?"https":"http",b=y.config.server.host||"localhost",w=y.config.server.port||5173;return n?.info(`App development server is running at: ${E}://${b}:${w}/apps/${a.appKey}`),y},Tl=async e=>{const{log:t}=e,n=await tn(t),r=await en({command:"build",mode:"production"},n,{log:t});t?.start("Initializing Fusion Framework...");const i=await Nl({env:e.environment,auth:"token"in e.auth?{token:e.auth.token}:e.auth});t?.succeed("Initialized Fusion Framework");const o=await i.serviceDiscovery.createClient("apps");o.request$.subscribe(e=>{t?.info("🌎","Executing request to:",e.uri),t?.debug("Request:",e)});try{t?.info("Checking if",r.appKey,"is registered in app store");const e=await o.fetch(`/apps/${r.appKey}`,{method:"HEAD",headers:rr});if(e.ok)return t?.succeed("😃",`Application ${r.appKey} is registered in app store`),!0;if(404===e.status)return t?.fail("😞",`Application ${r.appKey} is not registered in app store`),!1;if(410===e.status)return t?.fail("😞",`Application ${r.appKey} is deleted from app store`),!1;throw new Error(`Unexpected response status: ${e.status}`)}catch(e){return t?.fail("🙅♂️","Error checking application registration"),t?.error("Error checking application registration:",e),!1}},Rl=e=>{const t=e.getEntry("metadata.json");if(!t)throw new Error("Metadata file not found in bundle");return new Promise((e,n)=>{t.getDataAsync((t,r)=>{if(r)return n(new Error("Failed to read metadata file",{cause:r}));try{return e(JSON.parse(String(t)))}catch(e){n(new Error("Failed to parse metadata file",{cause:e}))}})})};const $l=async e=>{const{log:t,framework:n}=e,r="string"==typeof e.fileOrBundle?new Wn(e.fileOrBundle):e.fileOrBundle,{name:i}=e.appKey?{name:e.appKey}:await Rl(r).catch(e=>{t?.error("Failed to resolve manifest:",e),process.exit(1)});t?.info("📦",`Uploading application bundle for ${le.bold(i)}`),t?.debug("Bundle contents:",(await r.getEntries()).map(e=>e.entryName));const o=await r.toBufferPromise().catch(e=>{t?.error("Failed to read bundle content:",e),process.exit(1)});try{const e=await n.serviceDiscovery.createClient("apps");e.request$.subscribe(e=>{t?.info("🌎","Executing request to:",e.uri),t?.debug("Request:",e)});const r=await e.fetch(`/bundles/apps/${i}`,{method:"POST",body:new Blob([o],{type:"application/zip"}),headers:{...rr,"Content-Type":"application/zip"}});if(!r.ok){try{const{error:e}=await r.json();t?.debug("Error:",e),e.message&&t?.warn(le.red(`🤯 error: ${e.code}\n`),le.yellowBright(e.message),"\n")}catch(e){t?.debug("Error:",r.statusText)}!function(e,t){switch(e.status){case 409:throw new Error(`${e.status} - Version is already published, please generate a new release`);case 410:throw new Error(`${e.status} - ${t} is removed from Fusion app store`);case 404:throw new Error(`${e.status} - ${t} not found, please add your application in App Admin before publishing`);case 401:case 403:throw new Error(`${e.status} - This is not allowed for your role on ${t}`);case 500:throw new Error(`${e.status} - Internal server error, please try again later or contact support`);default:throw new Error(`Failed to upload bundle. HTTP status ${e.status}, ${e.statusText}`)}}(r,i)}t?.succeed("Successfully uploaded application bundle"),t?.debug("Response:",r);try{return{name:i,version:(await r.json()).version}}catch(e){throw new Error(`Failed to parse response from app service: ${e instanceof Error?e.message:e}`)}}catch(e){t?.fail("🙅♂️","Failed to upload application bundle"),t?.error(e),process.exit(1)}};var xl;!function(e){e.Latest="latest",e.Preview="preview"}(xl||(xl={}));const kl=async e=>{const{tag:t,appKey:n,version:r,framework:i,log:o}=e;["latest","preview"].includes(t)||(o?.fail("🤪",'Invalid tag. Use "latest" or "preview".'),process.exit(1)),n||(o?.fail("🤪","Application key is required."),process.exit(1)),r||(o?.fail("🤪","Version is required."),process.exit(1));const s=await i.serviceDiscovery.createClient("apps");s.request$.subscribe(e=>{o?.debug("Request:",e),o?.info("🌎","Executing request to:",Jt(e.uri))}),o?.start("Publishing application config");try{const e=await s.json(`/apps/${n}/tags/${t}`,{method:"PUT",body:{version:r},headers:rr});return o?.debug("Response:",e),o?.succeed("Tagged application successfully",le.greenBright(`${n}@${r} - ${t}`)),e}catch(e){if(e instanceof fr)switch(e.response.status){case 410:o?.fail("🤬",`App ${n} is deleted from apps-service. Please check the app key and try again.`);break;case 404:o?.fail("🤬",`App ${n} not found. Please check the app key and try again.`);break;case 403:case 401:o?.fail("🤬","You are not authorized to tag application. Please check your permissions.");break;default:o?.fail("🤬","Failed to tag application",`Status code: ${e.response.status}`,`Error: ${e.message}`)}throw e}},Fl=A.object({templateEntry:A.string({message:"templateEntry must be a string"}).describe("Main entry point for the portal"),schemaEntry:A.string({message:"schemaEntry must be a string"}).describe("Schema file for portal validation"),assetPath:A.string({message:"assetPath must be a string"}).optional().describe("Asset path for dev/preview builds"),githubRepo:A.string({message:"githubRepo must be a string"}).optional().describe("GitHub repo URL or local git remote"),version:A.string({message:"version must be a string"}).describe("Version from package.json"),timestamp:A.string({message:"timestamp must be a string"}).describe("Current build timestamp (ISO8601)"),commitSha:A.string({message:"commitSha must be a string"}).describe("Current git commit SHA"),annotations:A.record(A.string(),A.string()).optional().describe("Optional build annotations"),projectPage:A.string({message:"projectPage must be a string"}).optional().describe("Optional project homepage"),allowedExtensions:A.array(A.string({message:"Each allowed extension must be a string"}),{message:"allowedExtensions must be an array of strings"}).describe("List of allowed asset extensions (with leading dot)"),schema:A.record(A.string(),A.unknown()).optional().describe("Optional schema for the portal"),config:A.record(A.string(),A.unknown()).optional().describe("Optional configuration for the portal")}),Ul=A.object({name:A.string({message:"name must be a string"}).describe("Short app key (unscoped, derived from package name)"),displayName:A.string({message:"displayName must be a string"}).optional().describe("Full package name, may include scope"),description:A.string({message:"description must be a string"}).optional().describe("Description of the portal"),build:Fl}),Bl=(e,t)=>{$t(t,"expected packageJson"),D(t.name,"expected [name] in packageJson"),D(t.version,"expected [version] in packageJson");const n=((e,t)=>"build"===e.command||e.isPreview?t.main||t.module||"dist/bundle.js":Pt(e.root))(e,t),r=t.name.replace(/^@|\w.*\//gm,""),i=t.version,o="build"===e.command?void 0:"/@fs",s=xt(t)??kt(),a={name:r,displayName:t.name,description:t.description||"",build:{templateEntry:n,schemaEntry:"portal.schema.json",assetPath:o,githubRepo:s,version:i,timestamp:(new Date).toISOString(),commitSha:Ft(),annotations:{...Bt()},projectPage:t.homepage,allowedExtensions:Mt.map(e=>`.${e}`)}},c=Ul.safeParse(a);if(!c.success){const e=c.error.issues.map(e=>`- ${e.path.join(".")}: ${e.message}`).join("\n");throw new Error(["Invalid portal manifest generated from package.json:",e].join("\n"))}return c.data},Ml=async(e,t,n)=>{const r=Bl(e,t.packageJson);try{n?.log?.start("loading manifest...");const t=await(async(e,t)=>{const n=t?.file??[`portal.manifest.${e.environment}`,"portal.manifest"],r=await C(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async n=>{const r=t?.base??{};let i;return i="function"==typeof n.default?await n.default(e,{base:r})??void 0:n.default,i?_(r,i):r}}}),i=r.config,o=Ul.safeParse(i);if(!o.success)throw new Error(`Invalid portal manifest: ${o.error.issues.map(e=>`${e.path.join(".")}: ${e.message}`).join("; ")}`);return{manifest:i,path:r.path,extension:r.extension}})(e,{base:r});return n?.log?.succeed("generated manifest from",Jt(t.path,{relative:!0})),t.manifest}catch(e){if(e instanceof I){if(n?.manifestPath){const t=new Error(`Failed to load manifest file ${Jt(n.manifestPath)}, please check the path.`,{cause:e});throw n?.log?.fail(t.message),t}return n?.log?.succeed(le.dim("no local manifest config applied, using default generated from package")),r}throw n?.log?.fail(`failed to resolve application manifest ${n?.manifestPath?Jt(n?.manifestPath):""}`),e}},Gl=async(e,t)=>{const{log:n}=t;try{n?.start("create portal configuration"),n?.info(`generating config with ${le.red.dim(e.command)} command in ${le.green.dim(e.mode)} mode`);const r=await((e,t)=>{const n=t?.file??[`portal.config.${e.environment}`,"portal.config"];return C(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async n=>{const r=t?.schema??N.object({}).passthrough(),i=t?.base??{};if("function"==typeof n.default){const t=await n.default(i,e)??i;return r.parse(t)}return r.parse(n.default??i)}}})})(e,{file:t?.config});return n?.succeed("⚙️ generated config from ",Jt(r.path,{relative:!0})),r.config}catch(e){if(e instanceof I){if(!t.config)return n?.succeed(le.dim("⚙️ no local portal config applied, using built-in")),{};n?.warn(`failed to load config file ${Jt(t.config)}, please check the path.`)}throw n?.fail("failed to resolve portal config"),n?.debug(e),e}},jl=async e=>{const{log:n}=e??{},r=await tn(n),i={root:r.root,environment:"local",...e?.env,mode:"development",command:"serve"},o=await Ml(i,r,{log:n,manifestPath:e?.manifest}),s=await Gl(i,{log:n,config:e?.config}),a=t(await Rt(i,r),{server:{port:e?.server?.port,fs:{allow:[r.root]}}}),c={template:{portal:{id:o.name}},portal:{manifest:o,config:s}};n?.debug("vite config:",a),n?.debug("dev server config:",c),n?.start("Starting app development server...");const l=await tr(i,c,{overrides:a,log:n});return await l.listen(),n?.succeed(`Started app development server on ${l.resolvedUrls?.local?.[0]}`),l},zl=async e=>{const{log:t}=e??{},n=await tn(t);t?.debug("package",n);const r={command:"build",mode:process.env.NODE_ENV??"production",root:n.root,...e?.env};t?.debug("env:",r);const i=await Ml(r,n,{log:t,manifestPath:e?.manifest});return t?.debug("manifest:",i),{manifest:i,pkg:n,env:r}},Hl=async e=>{const{log:t}=e??{};t?.log(le.bold("Starting to build portal"));const{manifest:r,pkg:i,env:o}=await zl({log:t,manifest:e?.manifest});t?.start("loading vite config...");const s=await Rt(o,i);t?.succeed("vite config applied"),t?.debug("vite config:",s),t?.start("🤞🏻","building portal..."),t?.startNativeConsoleCapture(),await n(s),t?.stopNativeConsoleCapture(),t?.succeed("build completed 😘");return{pkg:i,manifest:r,outDir:s.build.outDir}},ql=async e=>{const{log:t,manifest:n}=e,r={command:"build",mode:process.env.NODE_ENV??"production",environment:null,root:process.cwd()},{pkg:i,manifest:o}=await Hl({log:t,manifest:n});if(!o.build)throw new Error("Manifest build config not found");const s=await(async(e,t)=>{const n=t?.file??[`portal.schema.${e.environment}`,"portal.schema"],r=await C(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async t=>{const n="function"==typeof t.default?await Promise.resolve(t.default(e)):t.default;if(!n)throw new Error("Schema function did not return a valid schema");return n}}});return{schema:r.config,path:r.path,extension:r.extension}})(r,{file:e?.schema});t?.debug("Schema:",s);return{archive:await sr(i,{log:t,archive:e?.archive,content:{"portal-template-manifest.json":JSON.stringify(o.build,null,2),"portal.schema.json":JSON.stringify(s.schema,null,2),"metadata.json":JSON.stringify({name:o.name,version:o.build.version})}}).catch(e=>{t?.error("Failed to create package:",e),process.exit(1)}),manifest:o,schema:s.schema}},Vl=async e=>{const{log:t}=e??{},n=await tn(t),r={command:"build",mode:process.env.NODE_ENV??"production",root:n.root,...e?.env},i=await Gl(r,{log:t,config:e?.config});if(t?.debug("config:",i),e?.output){t?.start("writing config to file");try{await ir(e.output,JSON.stringify(i,null,2)),t?.succeed("config written successfully",Jt(e.output,{relative:!0}))}catch(e){throw t?.fail("failed to write config"),e}}return{config:i,pkg:n}},Wl=async e=>{const{log:t,portal:n}=e,{config:r}=await Vl({log:t,config:e.config,env:{environment:e.environment}});t?.start("Initializing Fusion Framework...");const i=await Nl({env:e.environment,auth:e.auth});t?.succeed("Initialized Fusion Framework");const o=await i.serviceDiscovery.createClient("portals");o.request$.subscribe(e=>{t?.debug("Request:",e),t?.info("🌎","Executing request to:",Jt(e.uri))}),t?.start("Publishing portal config"),t?.info("Using environment:",le.redBright(e.environment));try{const e=await o.json(`/portals/${n.name}@${n.version}/config`,{method:"PUT",body:r,headers:rr});t?.debug("Response:",e),t?.succeed("Published portal config")}catch(e){if(e instanceof fr)switch(e.response.status){case 410:t?.fail("🤬",`Portal ${n.name} is deleted from portals-service. Please check the portal key and try again.`);break;case 404:t?.fail("🤬",`Portal ${n.name} not found. Please check the portal key and try again.`);break;case 403:case 401:t?.fail("🤬","You are not authorized to publish portal config. Please check your permissions.");break;default:t?.fail("🤬","Failed to publish portal config.",`Status code: ${e.response.status}`,`Message: ${e.response.statusText}`)}throw e}};const Yl=async e=>{const{log:t,framework:n}=e,r="string"==typeof e.fileOrBundle?new Wn(e.fileOrBundle):e.fileOrBundle,{name:i}=e.name?{name:e.name}:await Rl(r).catch(e=>{t?.error("Failed to resolve manifest:",e),process.exit(1)}),o=await r.toBufferPromise().catch(e=>{t?.error("Failed to read bundle content:",e),process.exit(1)});try{const e=await n.serviceDiscovery.createClient("portal-config");e.request$.subscribe(e=>{t?.info("🌎","Executing request to:",e.uri),t?.debug("Request:",e)});const r=await e.fetch(`/bundles/templates/${i}`,{method:"POST",body:new Blob([o],{type:"application/zip"}),headers:{...rr,"Content-Type":"application/zip"}});if(!r.ok){try{const{error:e}=await r.json();t?.debug("Error:",e),e.message&&t?.warn(le.red(`🤯 error: ${e.code}\n`),le.yellowBright(e.message),"\n")}catch(e){t?.debug("Error:",r.statusText)}!function(e,t){switch(e.status){case 409:throw new Error(`${e.status} - Version is already published, please generate a new release`);case 410:throw new Error(`${e.status} - ${t} is removed from Fusion`);case 404:throw new Error(`${e.status} - ${t} not found`);case 401:case 403:throw new Error(`${e.status} - This is not allowed for your role on ${t}`);case 500:throw new Error(`${e.status} - Internal server error, please try again later or contact support`);default:throw new Error(`Failed to upload bundle. HTTP status ${e.status}, ${e.statusText}`)}}(r,i)}t?.succeed("Successfully uploaded portal bundle"),t?.debug("Response:",r)}catch(e){t?.fail("🙅♂️","Failed to upload portal bundle"),t?.error(e),process.exit(1)}},Kl=async e=>{const{tag:t,name:n,version:r,framework:i,log:o}=e;t&&"string"==typeof t&&0!==t.trim().length||(o?.fail("🤪","Tag must be a non-empty string."),process.exit(1)),n||(o?.fail("🤪","Portal name is required."),process.exit(1)),r||(o?.fail("🤪","Version is required."),process.exit(1)),o?.info("Tagging portal:",le.greenBright(`${n}@${t}`,r));const s=await i.serviceDiscovery.createClient("portal-config");s.request$.subscribe(e=>{o?.debug("Request:",e),o?.info("🌎","Executing request to:",Jt(e.uri))}),o?.start("Tagging portal template...");try{const e=await s.json(`/templates/${n}/tags/${t}`,{method:"PUT",body:{version:r},headers:rr});o?.debug("Response:",e),o?.succeed("Tagged portal template successfully"),o?.info("🚀",JSON.stringify(e))}catch(e){if(e instanceof fr){const{data:t,response:r}=e;switch(o?.debug("Error:",t),t&&o?.warn(le.red(`🤯 error: ${t.code}\n`),le.yellowBright(t.message),"\n"),r?.status){case 410:o?.fail(`🤬 - ${r?.status} -`,`${n} is deleted. Please check the name and try again.`);break;case 404:o?.fail(`🤬 - ${r?.status} -`,`${n} not found. Please check the name and try again.`);break;case 403:case 401:o?.fail(`🤬 - ${r?.status} -`,"You are not authorized to tag. Please check your permissions.");break;default:o?.fail(`🤬 - ${r?.status} -`,"Failed to tag",`Error: ${e.message}`)}}throw e}};export{xl as AllowedAppTags,Jn as ConsoleLogger,_l as FusionEnv,rn as buildApplication,Hl as buildPortal,ar as bundleApp,ql as bundlePortal,Tl as checkApp,Ol as configureFramework,lr as generateApplicationConfig,Vl as generatePortalConfig,Nl as initializeFramework,nn as loadAppManifest,zl as loadPortalManifest,sr as pack,Al as publishAppConfig,Wl as publishPortalConfig,Dl as resolveDefaultEnv,Pl as startAppDevServer,jl as startPortalDevServer,kl as tagApplication,Kl as tagPortal,$l as uploadApplication,Yl as uploadPortalBundle};
|
|
1
|
+
import{loadConfigFromFile as e,mergeConfig as t,build as n}from"vite";import r from"vite-tsconfig-paths";import{dirname as i,resolve as o,basename as s,extname as a,relative as c}from"node:path";import{readPackageUp as l}from"read-package-up";import u,{fileURLToPath as f}from"node:url";import p from"url";import d from"node:module";import h from"util";import{accessSync as m,constants as g,readFileSync as v,statSync as y,existsSync as E,mkdirSync as b,writeFileSync as w}from"node:fs";import{stat as L,mkdir as S}from"node:fs/promises";import{importConfig as C,FileNotFoundError as I}from"@equinor/fusion-imports";import _ from"deepmerge";import D from"node:assert";import{execSync as N}from"node:child_process";import{coerce as O,SemVer as A,satisfies as P}from"semver";import T,{z as R}from"zod";import x from"fs";import $ from"path";import F from"zlib";import k from"crypto";import U from"ora";import{createDevServer as B,processServices as M}from"@equinor/fusion-framework-dev-server";import{enableAuthModule as G}from"@equinor/fusion-framework-module-msal-node";const j=(e=0)=>t=>`[${t+e}m`,z=(e=0)=>t=>`[${38+e};5;${t}m`,H=(e=0)=>(t,n,r)=>`[${38+e};2;${t};${n};${r}m`,q={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(q.modifier);Object.keys(q.color),Object.keys(q.bgColor);const V=function(){const e=new Map;for(const[t,n]of Object.entries(q)){for(const[t,r]of Object.entries(n))q[t]={open:`[${r[0]}m`,close:`[${r[1]}m`},n[t]=q[t],e.set(r[0],r[1]);Object.defineProperty(q,t,{value:n,enumerable:!1})}return Object.defineProperty(q,"codes",{value:e,enumerable:!1}),q.color.close="[39m",q.bgColor.close="[49m",q.color.ansi=j(),q.color.ansi256=z(),q.color.ansi16m=H(),q.bgColor.ansi=j(10),q.bgColor.ansi256=z(10),q.bgColor.ansi16m=H(10),Object.defineProperties(q,{rgbToAnsi256:{value:(e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;3===n.length&&(n=[...n].map(e=>e+e).join(""));const r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,255&r]},enumerable:!1},hexToAnsi256:{value:e=>q.rgbToAnsi256(...q.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,n,r;if(e>=232)t=(10*(e-232)+8)/255,n=t,r=t;else{const i=(e-=16)%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}const i=2*Math.max(t,n,r);if(0===i)return 30;let o=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return 2===i&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>q.ansi256ToAnsi(q.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>q.ansi256ToAnsi(q.hexToAnsi256(e)),enumerable:!1}}),q}(),W=(()=>{if(!("navigator"in globalThis))return 0;if(globalThis.navigator.userAgentData){const e=navigator.userAgentData.brands.find(({brand:e})=>"Chromium"===e);if(e&&e.version>93)return 3}return/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)?1:0})(),Y=0!==W&&{level:W},Z={stdout:Y,stderr:Y};function K(e,t,n){let r=e.indexOf(t);if(-1===r)return e;const i=t.length;let o=0,s="";do{s+=e.slice(o,r)+t+n,o=r+i,r=e.indexOf(t,o)}while(-1!==r);return s+=e.slice(o),s}const{stdout:X,stderr:J}=Z,Q=Symbol("GENERATOR"),ee=Symbol("STYLER"),te=Symbol("IS_EMPTY"),ne=["ansi","ansi","ansi256","ansi16m"],re=Object.create(null),ie=e=>{const t=(...e)=>e.join(" ");return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const n=X?X.level:0;e.level=void 0===t.level?n:t.level})(t,e),Object.setPrototypeOf(t,oe.prototype),t};function oe(e){return ie(e)}Object.setPrototypeOf(oe.prototype,Function.prototype);for(const[e,t]of Object.entries(V))re[e]={get(){const n=ue(this,le(t.open,t.close,this[ee]),this[te]);return Object.defineProperty(this,e,{value:n}),n}};re.visible={get(){const e=ue(this,this[ee],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const se=(e,t,n,...r)=>"rgb"===e?"ansi16m"===t?V[n].ansi16m(...r):"ansi256"===t?V[n].ansi256(V.rgbToAnsi256(...r)):V[n].ansi(V.rgbToAnsi(...r)):"hex"===e?se("rgb",t,n,...V.hexToRgb(...r)):V[n][e](...r),ae=["rgb","hex","ansi256"];for(const e of ae){re[e]={get(){const{level:t}=this;return function(...n){const r=le(se(e,ne[t],"color",...n),V.color.close,this[ee]);return ue(this,r,this[te])}}};re["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...n){const r=le(se(e,ne[t],"bgColor",...n),V.bgColor.close,this[ee]);return ue(this,r,this[te])}}}}const ce=Object.defineProperties(()=>{},{...re,level:{enumerable:!0,get(){return this[Q].level},set(e){this[Q].level=e}}}),le=(e,t,n)=>{let r,i;return void 0===n?(r=e,i=t):(r=n.openAll+e,i=t+n.closeAll),{open:e,close:t,openAll:r,closeAll:i,parent:n}},ue=(e,t,n)=>{const r=(...e)=>fe(r,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(r,ce),r[Q]=e,r[ee]=t,r[te]=n,r},fe=(e,t)=>{if(e.level<=0||!t)return e[te]?"":t;let n=e[ee];if(void 0===n)return t;const{openAll:r,closeAll:i}=n;if(t.includes(""))for(;void 0!==n;)t=K(t,n.close,n.open),n=n.parent;const o=t.indexOf("\n");return-1!==o&&(t=function(e,t,n,r){let i=0,o="";do{const s="\r"===e[r-1];o+=e.slice(i,s?r-1:r)+t+(s?"\r\n":"\n")+n,i=r+1,r=e.indexOf("\n",i)}while(-1!==r);return o+=e.slice(i),o}(t,i,r,o)),r+t+i};Object.defineProperties(oe.prototype,re);const pe=oe();function de(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var he,me,ge,ve;function ye(){if(me)return he;me=1;const e="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};return he=e}function Ee(){if(ve)return ge;ve=1;const e=Number.MAX_SAFE_INTEGER||9007199254740991;return ge={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:e,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}oe({level:J?J.level:0});var be,we,Le,Se,Ce,Ie,_e,De,Ne,Oe,Ae,Pe,Te,Re={exports:{}};function xe(){return be||(be=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=Ee(),o=ye(),s=(t=e.exports={}).re=[],a=t.safeRe=[],c=t.src=[],l=t.safeSrc=[],u=t.t={};let f=0;const p="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",i],[p,r]],h=(e,t,n)=>{const r=(e=>{for(const[t,n]of d)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),i=f++;o(e,i,t),u[e]=i,c[i]=t,l[i]=r,s[i]=new RegExp(t,n?"g":void 0),a[i]=new RegExp(r,n?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),h("MAINVERSION",`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASE",`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${p}+`),h("BUILD",`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h("FULL",`^${c[u.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h("LOOSE",`^${c[u.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h("XRANGE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h("COERCE",`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h("COERCEFULL",c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?`+`(?:${c[u.BUILD]})?(?:$|[^\\d])`),h("COERCERTL",c[u.COERCE],!0),h("COERCERTLFULL",c[u.COERCEFULL],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(Re,Re.exports)),Re.exports}function $e(){if(_e)return Ie;_e=1;const e=ye(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:n}=Ee(),{safeRe:r,t:i}=xe(),o=function(){if(Le)return we;Le=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return we=n=>n?"object"!=typeof n?e:n:t}(),{compareIdentifiers:s}=function(){if(Ce)return Se;Ce=1;const e=/^[0-9]+$/,t=(t,n)=>{if("number"==typeof t&&"number"==typeof n)return t===n?0:t<n?-1:1;const r=e.test(t),i=e.test(n);return r&&i&&(t=+t,n=+n),t===n?0:r&&!i?-1:i&&!r?1:t<n?-1:1};return Se={compareIdentifiers:t,rcompareIdentifiers:(e,n)=>t(n,e)}}();class a{constructor(s,c){if(c=o(c),s instanceof a){if(s.loose===!!c.loose&&s.includePrerelease===!!c.includePrerelease)return s;s=s.version}else if("string"!=typeof s)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof s}".`);if(s.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",s,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;const l=s.trim().match(c.loose?r[i.LOOSE]:r[i.FULL]);if(!l)throw new TypeError(`Invalid Version: ${s}`);if(this.raw=s,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");l[4]?this.prerelease=l[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<n)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(e("SemVer.compare",this.version,this.options,t),!(t instanceof a)){if("string"==typeof t&&t===this.version)return 0;t=new a(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(e){return e instanceof a||(e=new a(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(t){if(t instanceof a||(t=new a(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{const r=this.prerelease[n],i=t.prerelease[n];if(e("prerelease compare",n,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return s(r,i)}while(++n)}compareBuild(t){t instanceof a||(t=new a(t,this.options));let n=0;do{const r=this.build[n],i=t.build[n];if(e("build compare",n,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return s(r,i)}while(++n)}inc(e,t,n){if(e.startsWith("pre")){if(!t&&!1===n)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?r[i.PRERELEASELOOSE]:r[i.PRERELEASE]);if(!e||e[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(n)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let r=[t,e];!1===n&&(r=[t]),0===s(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Ie=a}function Fe(){if(Ne)return De;Ne=1;const e=$e();return De=(t,n,r=!1)=>{if(t instanceof e)return t;try{return new e(t,n)}catch(e){if(!r)return null;throw e}},De}var ke,Ue,Be,Me,Ge,je,ze,He,qe,Ve,We=["0BSD","3D-Slicer-1.0","AAL","ADSL","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AFL-3.0","AGPL-1.0-only","AGPL-1.0-or-later","AGPL-3.0-only","AGPL-3.0-or-later","AMD-newlib","AMDPLPA","AML","AML-glslang","AMPAS","ANTLR-PD","ANTLR-PD-fallback","APAFML","APL-1.0","APSL-1.0","APSL-1.1","APSL-1.2","APSL-2.0","ASWF-Digital-Assets-1.0","ASWF-Digital-Assets-1.1","Abstyles","AdaCore-doc","Adobe-2006","Adobe-Display-PostScript","Adobe-Glyph","Adobe-Utopia","Afmparse","Aladdin","Apache-1.0","Apache-1.1","Apache-2.0","App-s2p","Arphic-1999","Artistic-1.0","Artistic-1.0-Perl","Artistic-1.0-cl8","Artistic-2.0","Artistic-dist","Aspell-RU","BSD-1-Clause","BSD-2-Clause","BSD-2-Clause-Darwin","BSD-2-Clause-Patent","BSD-2-Clause-Views","BSD-2-Clause-first-lines","BSD-2-Clause-pkgconf-disclaimer","BSD-3-Clause","BSD-3-Clause-Attribution","BSD-3-Clause-Clear","BSD-3-Clause-HP","BSD-3-Clause-LBNL","BSD-3-Clause-Modification","BSD-3-Clause-No-Military-License","BSD-3-Clause-No-Nuclear-License","BSD-3-Clause-No-Nuclear-License-2014","BSD-3-Clause-No-Nuclear-Warranty","BSD-3-Clause-Open-MPI","BSD-3-Clause-Sun","BSD-3-Clause-acpica","BSD-3-Clause-flex","BSD-4-Clause","BSD-4-Clause-Shortened","BSD-4-Clause-UC","BSD-4.3RENO","BSD-4.3TAHOE","BSD-Advertising-Acknowledgement","BSD-Attribution-HPND-disclaimer","BSD-Inferno-Nettverk","BSD-Protection","BSD-Source-Code","BSD-Source-beginning-file","BSD-Systemics","BSD-Systemics-W3Works","BSL-1.0","BUSL-1.1","Baekmuk","Bahyph","Barr","Beerware","BitTorrent-1.0","BitTorrent-1.1","Bitstream-Charter","Bitstream-Vera","BlueOak-1.0.0","Boehm-GC","Boehm-GC-without-fee","Borceux","Brian-Gladman-2-Clause","Brian-Gladman-3-Clause","C-UDA-1.0","CAL-1.0","CAL-1.0-Combined-Work-Exception","CATOSL-1.1","CC-BY-1.0","CC-BY-2.0","CC-BY-2.5","CC-BY-2.5-AU","CC-BY-3.0","CC-BY-3.0-AT","CC-BY-3.0-AU","CC-BY-3.0-DE","CC-BY-3.0-IGO","CC-BY-3.0-NL","CC-BY-3.0-US","CC-BY-4.0","CC-BY-NC-1.0","CC-BY-NC-2.0","CC-BY-NC-2.5","CC-BY-NC-3.0","CC-BY-NC-3.0-DE","CC-BY-NC-4.0","CC-BY-NC-ND-1.0","CC-BY-NC-ND-2.0","CC-BY-NC-ND-2.5","CC-BY-NC-ND-3.0","CC-BY-NC-ND-3.0-DE","CC-BY-NC-ND-3.0-IGO","CC-BY-NC-ND-4.0","CC-BY-NC-SA-1.0","CC-BY-NC-SA-2.0","CC-BY-NC-SA-2.0-DE","CC-BY-NC-SA-2.0-FR","CC-BY-NC-SA-2.0-UK","CC-BY-NC-SA-2.5","CC-BY-NC-SA-3.0","CC-BY-NC-SA-3.0-DE","CC-BY-NC-SA-3.0-IGO","CC-BY-NC-SA-4.0","CC-BY-ND-1.0","CC-BY-ND-2.0","CC-BY-ND-2.5","CC-BY-ND-3.0","CC-BY-ND-3.0-DE","CC-BY-ND-4.0","CC-BY-SA-1.0","CC-BY-SA-2.0","CC-BY-SA-2.0-UK","CC-BY-SA-2.1-JP","CC-BY-SA-2.5","CC-BY-SA-3.0","CC-BY-SA-3.0-AT","CC-BY-SA-3.0-DE","CC-BY-SA-3.0-IGO","CC-BY-SA-4.0","CC-PDDC","CC-PDM-1.0","CC-SA-1.0","CC0-1.0","CDDL-1.0","CDDL-1.1","CDL-1.0","CDLA-Permissive-1.0","CDLA-Permissive-2.0","CDLA-Sharing-1.0","CECILL-1.0","CECILL-1.1","CECILL-2.0","CECILL-2.1","CECILL-B","CECILL-C","CERN-OHL-1.1","CERN-OHL-1.2","CERN-OHL-P-2.0","CERN-OHL-S-2.0","CERN-OHL-W-2.0","CFITSIO","CMU-Mach","CMU-Mach-nodoc","CNRI-Jython","CNRI-Python","CNRI-Python-GPL-Compatible","COIL-1.0","CPAL-1.0","CPL-1.0","CPOL-1.02","CUA-OPL-1.0","Caldera","Caldera-no-preamble","Catharon","ClArtistic","Clips","Community-Spec-1.0","Condor-1.1","Cornell-Lossless-JPEG","Cronyx","Crossword","CryptoSwift","CrystalStacker","Cube","D-FSL-1.0","DEC-3-Clause","DL-DE-BY-2.0","DL-DE-ZERO-2.0","DOC","DRL-1.0","DRL-1.1","DSDP","DocBook-DTD","DocBook-Schema","DocBook-Stylesheet","DocBook-XML","Dotseqn","ECL-1.0","ECL-2.0","EFL-1.0","EFL-2.0","EPICS","EPL-1.0","EPL-2.0","EUDatagrid","EUPL-1.0","EUPL-1.1","EUPL-1.2","Elastic-2.0","Entessa","ErlPL-1.1","Eurosym","FBM","FDK-AAC","FSFAP","FSFAP-no-warranty-disclaimer","FSFUL","FSFULLR","FSFULLRSD","FSFULLRWD","FSL-1.1-ALv2","FSL-1.1-MIT","FTL","Fair","Ferguson-Twofish","Frameworx-1.0","FreeBSD-DOC","FreeImage","Furuseth","GCR-docs","GD","GFDL-1.1-invariants-only","GFDL-1.1-invariants-or-later","GFDL-1.1-no-invariants-only","GFDL-1.1-no-invariants-or-later","GFDL-1.1-only","GFDL-1.1-or-later","GFDL-1.2-invariants-only","GFDL-1.2-invariants-or-later","GFDL-1.2-no-invariants-only","GFDL-1.2-no-invariants-or-later","GFDL-1.2-only","GFDL-1.2-or-later","GFDL-1.3-invariants-only","GFDL-1.3-invariants-or-later","GFDL-1.3-no-invariants-only","GFDL-1.3-no-invariants-or-later","GFDL-1.3-only","GFDL-1.3-or-later","GL2PS","GLWTPL","GPL-1.0-only","GPL-1.0-or-later","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","Game-Programming-Gems","Giftware","Glide","Glulxe","Graphics-Gems","Gutmann","HDF5","HIDAPI","HP-1986","HP-1989","HPND","HPND-DEC","HPND-Fenneberg-Livingston","HPND-INRIA-IMAG","HPND-Intel","HPND-Kevlin-Henney","HPND-MIT-disclaimer","HPND-Markus-Kuhn","HPND-Netrek","HPND-Pbmplus","HPND-UC","HPND-UC-export-US","HPND-doc","HPND-doc-sell","HPND-export-US","HPND-export-US-acknowledgement","HPND-export-US-modify","HPND-export2-US","HPND-merchantability-variant","HPND-sell-MIT-disclaimer-xserver","HPND-sell-regexpr","HPND-sell-variant","HPND-sell-variant-MIT-disclaimer","HPND-sell-variant-MIT-disclaimer-rev","HTMLTIDY","HaskellReport","Hippocratic-2.1","IBM-pibs","ICU","IEC-Code-Components-EULA","IJG","IJG-short","IPA","IPL-1.0","ISC","ISC-Veillard","ImageMagick","Imlib2","Info-ZIP","Inner-Net-2.0","InnoSetup","Intel","Intel-ACPI","Interbase-1.0","JPL-image","JPNIC","JSON","Jam","JasPer-2.0","Kastrup","Kazlib","Knuth-CTAN","LAL-1.2","LAL-1.3","LGPL-2.0-only","LGPL-2.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","LGPLLR","LOOP","LPD-document","LPL-1.0","LPL-1.02","LPPL-1.0","LPPL-1.1","LPPL-1.2","LPPL-1.3a","LPPL-1.3c","LZMA-SDK-9.11-to-9.20","LZMA-SDK-9.22","Latex2e","Latex2e-translated-notice","Leptonica","LiLiQ-P-1.1","LiLiQ-R-1.1","LiLiQ-Rplus-1.1","Libpng","Linux-OpenIB","Linux-man-pages-1-para","Linux-man-pages-copyleft","Linux-man-pages-copyleft-2-para","Linux-man-pages-copyleft-var","Lucida-Bitmap-Fonts","MIPS","MIT","MIT-0","MIT-CMU","MIT-Click","MIT-Festival","MIT-Khronos-old","MIT-Modern-Variant","MIT-Wu","MIT-advertising","MIT-enna","MIT-feh","MIT-open-group","MIT-testregex","MITNFA","MMIXware","MPEG-SSG","MPL-1.0","MPL-1.1","MPL-2.0","MPL-2.0-no-copyleft-exception","MS-LPL","MS-PL","MS-RL","MTLL","Mackerras-3-Clause","Mackerras-3-Clause-acknowledgment","MakeIndex","Martin-Birgmeier","McPhee-slideshow","Minpack","MirOS","Motosoto","MulanPSL-1.0","MulanPSL-2.0","Multics","Mup","NAIST-2003","NASA-1.3","NBPL-1.0","NCBI-PD","NCGL-UK-2.0","NCL","NCSA","NGPL","NICTA-1.0","NIST-PD","NIST-PD-fallback","NIST-Software","NLOD-1.0","NLOD-2.0","NLPL","NOSL","NPL-1.0","NPL-1.1","NPOSL-3.0","NRL","NTIA-PD","NTP","NTP-0","Naumen","NetCDF","Newsletr","Nokia","Noweb","O-UDA-1.0","OAR","OCCT-PL","OCLC-2.0","ODC-By-1.0","ODbL-1.0","OFFIS","OFL-1.0","OFL-1.0-RFN","OFL-1.0-no-RFN","OFL-1.1","OFL-1.1-RFN","OFL-1.1-no-RFN","OGC-1.0","OGDL-Taiwan-1.0","OGL-Canada-2.0","OGL-UK-1.0","OGL-UK-2.0","OGL-UK-3.0","OGTSL","OLDAP-1.1","OLDAP-1.2","OLDAP-1.3","OLDAP-1.4","OLDAP-2.0","OLDAP-2.0.1","OLDAP-2.1","OLDAP-2.2","OLDAP-2.2.1","OLDAP-2.2.2","OLDAP-2.3","OLDAP-2.4","OLDAP-2.5","OLDAP-2.6","OLDAP-2.7","OLDAP-2.8","OLFL-1.3","OML","OPL-1.0","OPL-UK-3.0","OPUBL-1.0","OSET-PL-2.1","OSL-1.0","OSL-1.1","OSL-2.0","OSL-2.1","OSL-3.0","OpenPBS-2.3","OpenSSL","OpenSSL-standalone","OpenVision","PADL","PDDL-1.0","PHP-3.0","PHP-3.01","PPL","PSF-2.0","Parity-6.0.0","Parity-7.0.0","Pixar","Plexus","PolyForm-Noncommercial-1.0.0","PolyForm-Small-Business-1.0.0","PostgreSQL","Python-2.0","Python-2.0.1","QPL-1.0","QPL-1.0-INRIA-2004","Qhull","RHeCos-1.1","RPL-1.1","RPL-1.5","RPSL-1.0","RSA-MD","RSCPL","Rdisc","Ruby","Ruby-pty","SAX-PD","SAX-PD-2.0","SCEA","SGI-B-1.0","SGI-B-1.1","SGI-B-2.0","SGI-OpenGL","SGP4","SHL-0.5","SHL-0.51","SISSL","SISSL-1.2","SL","SMAIL-GPL","SMLNJ","SMPPL","SNIA","SOFA","SPL-1.0","SSH-OpenSSH","SSH-short","SSLeay-standalone","SSPL-1.0","SUL-1.0","SWL","Saxpath","SchemeReport","Sendmail","Sendmail-8.23","Sendmail-Open-Source-1.1","SimPL-2.0","Sleepycat","Soundex","Spencer-86","Spencer-94","Spencer-99","SugarCRM-1.1.3","Sun-PPP","Sun-PPP-2000","SunPro","Symlinks","TAPR-OHL-1.0","TCL","TCP-wrappers","TGPPL-1.0","TMate","TORQUE-1.1","TOSL","TPDL","TPL-1.0","TTWL","TTYP0","TU-Berlin-1.0","TU-Berlin-2.0","TermReadKey","ThirdEye","TrustedQSL","UCAR","UCL-1.0","UMich-Merit","UPL-1.0","URT-RLE","Ubuntu-font-1.0","Unicode-3.0","Unicode-DFS-2015","Unicode-DFS-2016","Unicode-TOU","UnixCrypt","Unlicense","Unlicense-libtelnet","Unlicense-libwhirlpool","VOSTROM","VSL-1.0","Vim","W3C","W3C-19980720","W3C-20150513","WTFPL","Watcom-1.0","Widget-Workshop","Wsuipa","X11","X11-distribute-modifications-variant","X11-swapped","XFree86-1.1","XSkat","Xdebug-1.03","Xerox","Xfig","Xnet","YPL-1.0","YPL-1.1","ZPL-1.1","ZPL-2.0","ZPL-2.1","Zed","Zeeff","Zend-2.0","Zimbra-1.3","Zimbra-1.4","Zlib","any-OSI","any-OSI-perl-modules","bcrypt-Solar-Designer","blessing","bzip2-1.0.6","check-cvs","checkmk","copyleft-next-0.3.0","copyleft-next-0.3.1","curl","cve-tou","diffmark","dtoa","dvipdfm","eGenix","etalab-2.0","fwlw","gSOAP-1.3b","generic-xts","gnuplot","gtkbook","hdparm","iMatix","jove","libpng-1.6.35","libpng-2.0","libselinux-1.0","libtiff","libutil-David-Nugent","lsof","magaz","mailprio","man2html","metamail","mpi-permissive","mpich2","mplus","ngrep","pkgconf","pnmstitch","psfrag","psutils","python-ldap","radvd","snprintf","softSurfer","ssh-keyscan","swrule","threeparttable","ulem","w3m","wwl","xinetd","xkeyboard-config-Zinoviev","xlock","xpp","xzoom","zlib-acknowledgement"],Ye=["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-2.0","GPL-2.0-with-GCC-exception","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-3.0","GPL-3.0-with-GCC-exception","GPL-3.0-with-autoconf-exception","LGPL-2.0","LGPL-2.1","LGPL-3.0","Net-SNMP","Nunit","StandardML-NJ","bzip2-1.0.5","eCos-2.0","wxWindows"],Ze=["389-exception","Asterisk-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Autoconf-exception-generic","Autoconf-exception-generic-3.0","Autoconf-exception-macro","Bison-exception-1.24","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","cryptsetup-OpenSSL-exception","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","fmt-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-2.0-note","GCC-exception-3.1","Gmsh-exception","GNAT-exception","GNOME-examples-exception","GNU-compiler-exception","gnu-javamail-exception","GPL-3.0-interface-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","libpri-OpenH323-exception","Libtool-exception","Linux-syscall-note","LLGPL","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","QPL-1.0-INRIA-2004-exception","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SANE-exception","SHL-2.0","SHL-2.1","stunnel-exception","SWI-exception","Swift-exception","Texinfo-exception","u-boot-exception-2.0","UBDL-exception","Universal-FOSS-exception-1.0","vsftpd-openssl-exception","WxWindows-exception-3.1","x11vnc-openssl-exception"];function Ke(){if(Ue)return ke;Ue=1;var e=[].concat(We).concat(Ye),t=Ze;return ke=function(n){var r=0;function i(){return r<n.length}function o(e){if(e instanceof RegExp){var t=n.slice(r).match(e);if(t)return r+=t[0].length,t[0]}else if(n.indexOf(e,r)===r)return r+=e.length,e}function s(){o(/[ ]*/)}function a(){return o(/[A-Za-z0-9-.]+/)}function c(){var e=a();if(!e)throw new Error("Expected idstring at offset "+r);return e}function l(){return function(){for(var e,t=["WITH","AND","OR","(",")",":","+"],i=0;i<t.length&&!(e=o(t[i]));i++);if("+"===e&&r>1&&" "===n[r-2])throw new Error("Space before `+`");return e&&{type:"OPERATOR",string:e}}()||function(){if(o("DocumentRef-"))return{type:"DOCUMENTREF",string:c()}}()||function(){if(o("LicenseRef-"))return{type:"LICENSEREF",string:c()}}()||(i=r,s=a(),-1!==e.indexOf(s)?{type:"LICENSE",string:s}:-1!==t.indexOf(s)?{type:"EXCEPTION",string:s}:void(r=i));var i,s}for(var u=[];i()&&(s(),i());){var f=l();if(!f)throw new Error("Unexpected `"+n[r]+"` at offset "+r);u.push(f)}return u}}function Xe(){return Me?Be:(Me=1,Be=function(e){var t=0;function n(){return t<e.length}function r(){return n()?e[t]:null}function i(){if(!n())throw new Error;t++}function o(e){var t=r();if(t&&"OPERATOR"===t.type&&e===t.string)return i(),t.string}function s(){var e=r();if(e&&"LICENSE"===e.type){i();var t={license:e.string};o("+")&&(t.plus=!0);var n=function(){if(o("WITH")){var e=r();if(e&&"EXCEPTION"===e.type)return i(),e.string;throw new Error("Expected exception after `WITH`")}}();return n&&(t.exception=n),t}}function a(e,t){return function n(){var r=t();if(r){if(!o(e))return r;var i=n();if(!i)throw new Error("Expected expression");return{left:r,conjunction:e.toLowerCase(),right:i}}}}var c=a("AND",function(){return function(){if(o("(")){var e=l();if(!o(")"))throw new Error("Expected `)`");return e}}()||function(){var e=t,n="",s=r();if("DOCUMENTREF"===s.type&&(i(),n+="DocumentRef-"+s.string+":",!o(":")))throw new Error("Expected `:` after `DocumentRef-...`");if("LICENSEREF"===(s=r()).type)return i(),{license:n+="LicenseRef-"+s.string};t=e}()||s()}),l=a("OR",c),u=l();if(!u||n())throw new Error("Syntax error");return u})}function Je(){if(je)return Ge;je=1;var e=Ke(),t=Xe();return Ge=function(n){return t(e(n))}}function Qe(){if(Ve)return qe;Ve=1;var e=Je(),t=function(){if(He)return ze;He=1;var e=Je(),t=We;function n(t){try{return e(t),!0}catch(e){return!1}}function r(e,t){var n=t[0].length-e[0].length;return 0!==n?n:e[0].toUpperCase().localeCompare(t[0].toUpperCase())}var i=[["APGL","AGPL"],["Gpl","GPL"],["GLP","GPL"],["APL","Apache"],["ISD","ISC"],["GLP","GPL"],["IST","ISC"],["Claude","Clause"],[" or later","+"],[" International",""],["GNU","GPL"],["GUN","GPL"],["+",""],["GNU GPL","GPL"],["GNU LGPL","LGPL"],["GNU/GPL","GPL"],["GNU GLP","GPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL"],["GNU Lesser General Public License","LGPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["GNU Lesser General Public License","LGPL-2.1"],["LESSER GENERAL PUBLIC LICENSE","LGPL"],["Lesser General Public License","LGPL"],["LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["Lesser General Public License","LGPL-2.1"],["GNU General Public License","GPL"],["Gnu public license","GPL"],["GNU Public License","GPL"],["GNU GENERAL PUBLIC LICENSE","GPL"],["MTI","MIT"],["Mozilla Public License","MPL"],["Universal Permissive License","UPL"],["WTH","WTF"],["WTFGPL","WTFPL"],["-License",""]].sort(r),o=[function(e){return e.toUpperCase()},function(e){return e.trim()},function(e){return e.replace(/\./g,"")},function(e){return e.replace(/\s+/g,"")},function(e){return e.replace(/\s+/g,"-")},function(e){return e.replace("v","-")},function(e){return e.replace(/,?\s*(\d)/,"-$1")},function(e){return e.replace(/,?\s*(\d)/,"-$1.0")},function(e){return e.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(e){return e.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(e){return e[0].toUpperCase()+e.slice(1)},function(e){return e.replace("/","-")},function(e){return e.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(e){return-1!==e.indexOf("3.0")?e+"-or-later":e+"-only"},function(e){return e+"only"},function(e){return e.replace(/(\d)$/,"-$1.0")},function(e){return e.replace(/(-| )?(\d)$/,"-$2-Clause")},function(e){return e.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(e){return e.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(e){return e.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(e){return e.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(e){return e.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(e){return e.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(e){return"CC-"+e},function(e){return"CC-"+e+"-4.0"},function(e){return e.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(e){return"CC-"+e.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],s=t.map(function(e){var t=/^(.*)-\d+\.\d+$/.exec(e);return t?[t[0],t[1]]:[e,null]}).reduce(function(e,t){var n=t[1];return e[n]=e[n]||[],e[n].push(t[0]),e},{}),a=Object.keys(s).map(function(e){return[e,s[e]]}).filter(function(e){return 1===e[1].length&&null!==e[0]&&"APL"!==e[0]}).map(function(e){return[e[0],e[1][0]]});s=void 0;var c=[["UNLI","Unlicense"],["WTF","WTFPL"],["2 CLAUSE","BSD-2-Clause"],["2-CLAUSE","BSD-2-Clause"],["3 CLAUSE","BSD-3-Clause"],["3-CLAUSE","BSD-3-Clause"],["AFFERO","AGPL-3.0-or-later"],["AGPL","AGPL-3.0-or-later"],["APACHE","Apache-2.0"],["ARTISTIC","Artistic-2.0"],["Affero","AGPL-3.0-or-later"],["BEER","Beerware"],["BOOST","BSL-1.0"],["BSD","BSD-2-Clause"],["CDDL","CDDL-1.1"],["ECLIPSE","EPL-1.0"],["FUCK","WTFPL"],["GNU","GPL-3.0-or-later"],["LGPL","LGPL-3.0-or-later"],["GPLV1","GPL-1.0-only"],["GPL-1","GPL-1.0-only"],["GPLV2","GPL-2.0-only"],["GPL-2","GPL-2.0-only"],["GPL","GPL-3.0-or-later"],["MIT +NO-FALSE-ATTRIBS","MITNFA"],["MIT","MIT"],["MPL","MPL-2.0"],["X11","X11"],["ZLIB","Zlib"]].concat(a).sort(r),l=function(e){for(var t=0;t<o.length;t++){var r=o[t](e).trim();if(r!==e&&n(r))return r}return null},u=function(e){for(var t=e.toUpperCase(),n=0;n<c.length;n++){var r=c[n];if(t.indexOf(r[0])>-1)return r[1]}return null},f=function(e,t){for(var n=0;n<i.length;n++){var r=i[n],o=r[0];if(e.indexOf(o)>-1){var s=t(e.replace(o,r[1]));if(null!==s)return s}}return null};return ze=function(e,t){var r=void 0===(t=t||{}).upgrade||!!t.upgrade;function i(e){return r?function(e){return-1!==["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(e)?e+"-only":-1!==["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(e)?e.replace(/\+$/,"-or-later"):-1!==["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(e)?e+"-or-later":e}(e):e}if("string"!=typeof e||0===e.trim().length)throw Error("Invalid argument. Expected non-empty string.");if(n(e=e.trim()))return i(e);var o=e.replace(/\+$/,"").trim();if(n(o))return i(o);var s=l(e);return null!==s||null!==(s=f(e,function(e){return n(e)?e:l(e)}))||null!==(s=u(e))||null!==(s=f(e,u))?i(s):null}}(),n='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',r=/^SEE LICEN[CS]E IN (.+)$/;function i(e,t){return t.slice(0,e.length)===e}function o(e){if(e.hasOwnProperty("license")){var t=e.license;return i("LicenseRef",t)||i("DocumentRef",t)}return o(e.left)||o(e.right)}return qe=function(i){var s;try{s=e(i)}catch(e){var a;if("UNLICENSED"===i||"UNLICENCED"===i)return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(a=r.exec(i))return{validForOldPackages:!0,validForNewPackages:!0,inFile:a[1]};var c={validForOldPackages:!1,validForNewPackages:!1,warnings:[n]};if(0!==i.trim().length){var l=t(i);l&&c.warnings.push('license is similar to the valid expression "'+l+'"')}return c}return o(s)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[n]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}}var et,tt,nt,rt,it,ot,st,at,ct,lt,ut,ft={};function pt(){if(et)return ft;et=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.LRUCache=void 0;const e="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,t=new Set,n="object"==typeof process&&process?process:{},r=(e,t,r,i)=>{"function"==typeof n.emitWarning?n.emitWarning(e,t,r,i):console.error(`[${r}] ${t}: ${e}`)};let i=globalThis.AbortController,o=globalThis.AbortSignal;if(void 0===i){o=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},i=class{constructor(){t()}signal=new o;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(const t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e="1"!==n.env?.LRU_CACHE_IGNORE_AC_WARNING;const t=()=>{e&&(e=!1,r("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",t))}}const s=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),a=e=>s(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?c:null:null;class c extends Array{constructor(e){super(e),this.fill(0)}}class l{heap;length;static#e=!1;static create(e){const t=a(e);if(!t)return[];l.#e=!0;const n=new l(e,t);return l.#e=!1,n}constructor(e,t){if(!l.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class u{#t;#n;#r;#i;#o;#s;#a;#c;get perf(){return this.#c}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#l;#u;#f;#p;#d;#h;#m;#g;#v;#y;#E;#b;#w;#L;#S;#C;#I;#_;#D;static unsafeExposeInternals(e){return{starts:e.#w,ttls:e.#L,autopurgeTimers:e.#S,sizes:e.#b,keyMap:e.#f,keyList:e.#p,valList:e.#d,next:e.#h,prev:e.#m,get head(){return e.#g},get tail(){return e.#v},free:e.#y,isBackgroundFetch:t=>e.#N(t),backgroundFetch:(t,n,r,i)=>e.#O(t,n,r,i),moveToTail:t=>e.#A(t),indexes:t=>e.#P(t),rindexes:t=>e.#T(t),isStale:t=>e.#R(t)}}get max(){return this.#t}get maxSize(){return this.#n}get calculatedSize(){return this.#u}get size(){return this.#l}get fetchMethod(){return this.#s}get memoMethod(){return this.#a}get dispose(){return this.#r}get onInsert(){return this.#i}get disposeAfter(){return this.#o}constructor(n){const{max:i=0,ttl:o,ttlResolution:c=1,ttlAutopurge:f,updateAgeOnGet:p,updateAgeOnHas:d,allowStale:h,dispose:m,onInsert:g,disposeAfter:v,noDisposeOnSet:y,noUpdateTTL:E,maxSize:b=0,maxEntrySize:w=0,sizeCalculation:L,fetchMethod:S,memoMethod:C,noDeleteOnFetchRejection:I,noDeleteOnStaleGet:_,allowStaleOnFetchRejection:D,allowStaleOnFetchAbort:N,ignoreFetchAbort:O,perf:A}=n;if(void 0!==A&&"function"!=typeof A?.now)throw new TypeError("perf option must have a now() method if specified");if(this.#c=A??e,0!==i&&!s(i))throw new TypeError("max option must be a nonnegative integer");const P=i?a(i):Array;if(!P)throw new Error("invalid max value: "+i);if(this.#t=i,this.#n=b,this.maxEntrySize=w||this.#n,this.sizeCalculation=L,this.sizeCalculation){if(!this.#n&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==C&&"function"!=typeof C)throw new TypeError("memoMethod must be a function if defined");if(this.#a=C,void 0!==S&&"function"!=typeof S)throw new TypeError("fetchMethod must be a function if specified");if(this.#s=S,this.#I=!!S,this.#f=new Map,this.#p=new Array(i).fill(void 0),this.#d=new Array(i).fill(void 0),this.#h=new P(i),this.#m=new P(i),this.#g=0,this.#v=0,this.#y=l.create(i),this.#l=0,this.#u=0,"function"==typeof m&&(this.#r=m),"function"==typeof g&&(this.#i=g),"function"==typeof v?(this.#o=v,this.#E=[]):(this.#o=void 0,this.#E=void 0),this.#C=!!this.#r,this.#D=!!this.#i,this.#_=!!this.#o,this.noDisposeOnSet=!!y,this.noUpdateTTL=!!E,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!D,this.allowStaleOnFetchAbort=!!N,this.ignoreFetchAbort=!!O,0!==this.maxEntrySize){if(0!==this.#n&&!s(this.#n))throw new TypeError("maxSize must be a positive integer if specified");if(!s(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#x()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!_,this.updateAgeOnGet=!!p,this.updateAgeOnHas=!!d,this.ttlResolution=s(c)||0===c?c:1,this.ttlAutopurge=!!f,this.ttl=o||0,this.ttl){if(!s(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#$()}if(0===this.#t&&0===this.ttl&&0===this.#n)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#n){const e="LRU_CACHE_UNBOUNDED";if((e=>!t.has(e))(e)){t.add(e);r("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",e,u)}}}getRemainingTTL(e){return this.#f.has(e)?1/0:0}#$(){const e=new c(this.#t),t=new c(this.#t);this.#L=e,this.#w=t;const n=this.ttlAutopurge?new Array(this.#t):void 0;this.#S=n,this.#F=(r,i,o=this.#c.now())=>{if(t[r]=0!==i?o:0,e[r]=i,n?.[r]&&(clearTimeout(n[r]),n[r]=void 0),0!==i&&n){const e=setTimeout(()=>{this.#R(r)&&this.#k(this.#p[r],"expire")},i+1);e.unref&&e.unref(),n[r]=e}},this.#U=n=>{t[n]=0!==e[n]?this.#c.now():0},this.#B=(n,o)=>{if(e[o]){const s=e[o],a=t[o];if(!s||!a)return;n.ttl=s,n.start=a,n.now=r||i();const c=n.now-a;n.remainingTTL=s-c}};let r=0;const i=()=>{const e=this.#c.now();if(this.ttlResolution>0){r=e;const t=setTimeout(()=>r=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=n=>{const o=this.#f.get(n);if(void 0===o)return 0;const s=e[o],a=t[o];if(!s||!a)return 1/0;return s-((r||i())-a)},this.#R=n=>{const o=t[n],s=e[n];return!!s&&!!o&&(r||i())-o>s}}#U=()=>{};#B=()=>{};#F=()=>{};#R=()=>!1;#x(){const e=new c(this.#t);this.#u=0,this.#b=e,this.#M=t=>{this.#u-=e[t],e[t]=0},this.#G=(e,t,n,r)=>{if(this.#N(t))return 0;if(!s(n)){if(!r)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof r)throw new TypeError("sizeCalculation must be a function");if(n=r(t,e),!s(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return n},this.#j=(t,n,r)=>{if(e[t]=n,this.#n){const n=this.#n-e[t];for(;this.#u>n;)this.#z(!0)}this.#u+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#u)}}#M=e=>{};#j=(e,t,n)=>{};#G=(e,t,n,r)=>{if(n||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#P({allowStale:e=this.allowStale}={}){if(this.#l)for(let t=this.#v;this.#H(t)&&(!e&&this.#R(t)||(yield t),t!==this.#g);)t=this.#m[t]}*#T({allowStale:e=this.allowStale}={}){if(this.#l)for(let t=this.#g;this.#H(t)&&(!e&&this.#R(t)||(yield t),t!==this.#v);)t=this.#h[t]}#H(e){return void 0!==e&&this.#f.get(this.#p[e])===e}*entries(){for(const e of this.#P())void 0===this.#d[e]||void 0===this.#p[e]||this.#N(this.#d[e])||(yield[this.#p[e],this.#d[e]])}*rentries(){for(const e of this.#T())void 0===this.#d[e]||void 0===this.#p[e]||this.#N(this.#d[e])||(yield[this.#p[e],this.#d[e]])}*keys(){for(const e of this.#P()){const t=this.#p[e];void 0===t||this.#N(this.#d[e])||(yield t)}}*rkeys(){for(const e of this.#T()){const t=this.#p[e];void 0===t||this.#N(this.#d[e])||(yield t)}}*values(){for(const e of this.#P()){void 0===this.#d[e]||this.#N(this.#d[e])||(yield this.#d[e])}}*rvalues(){for(const e of this.#T()){void 0===this.#d[e]||this.#N(this.#d[e])||(yield this.#d[e])}}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(const n of this.#P()){const r=this.#d[n],i=this.#N(r)?r.__staleWhileFetching:r;if(void 0!==i&&e(i,this.#p[n],this))return this.get(this.#p[n],t)}}forEach(e,t=this){for(const n of this.#P()){const r=this.#d[n],i=this.#N(r)?r.__staleWhileFetching:r;void 0!==i&&e.call(t,i,this.#p[n],this)}}rforEach(e,t=this){for(const n of this.#T()){const r=this.#d[n],i=this.#N(r)?r.__staleWhileFetching:r;void 0!==i&&e.call(t,i,this.#p[n],this)}}purgeStale(){let e=!1;for(const t of this.#T({allowStale:!0}))this.#R(t)&&(this.#k(this.#p[t],"expire"),e=!0);return e}info(e){const t=this.#f.get(e);if(void 0===t)return;const n=this.#d[t],r=this.#N(n)?n.__staleWhileFetching:n;if(void 0===r)return;const i={value:r};if(this.#L&&this.#w){const e=this.#L[t],n=this.#w[t];if(e&&n){const t=e-(this.#c.now()-n);i.ttl=t,i.start=Date.now()}}return this.#b&&(i.size=this.#b[t]),i}dump(){const e=[];for(const t of this.#P({allowStale:!0})){const n=this.#p[t],r=this.#d[t],i=this.#N(r)?r.__staleWhileFetching:r;if(void 0===i||void 0===n)continue;const o={value:i};if(this.#L&&this.#w){o.ttl=this.#L[t];const e=this.#c.now()-this.#w[t];o.start=Math.floor(Date.now()-e)}this.#b&&(o.size=this.#b[t]),e.unshift([n,o])}return e}load(e){this.clear();for(const[t,n]of e){if(n.start){const e=Date.now()-n.start;n.start=this.#c.now()-e}this.set(t,n.value,n)}}set(e,t,n={}){if(void 0===t)return this.delete(e),this;const{ttl:r=this.ttl,start:i,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:a}=n;let{noUpdateTTL:c=this.noUpdateTTL}=n;const l=this.#G(e,t,n.size||0,s);if(this.maxEntrySize&&l>this.maxEntrySize)return a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this.#k(e,"set"),this;let u=0===this.#l?void 0:this.#f.get(e);if(void 0===u)u=0===this.#l?this.#v:0!==this.#y.length?this.#y.pop():this.#l===this.#t?this.#z(!1):this.#l,this.#p[u]=e,this.#d[u]=t,this.#f.set(e,u),this.#h[this.#v]=u,this.#m[u]=this.#v,this.#v=u,this.#l++,this.#j(u,l,a),a&&(a.set="add"),c=!1,this.#D&&this.#i?.(t,e,"add");else{this.#A(u);const n=this.#d[u];if(t!==n){if(this.#I&&this.#N(n)){n.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:t}=n;void 0===t||o||(this.#C&&this.#r?.(t,e,"set"),this.#_&&this.#E?.push([t,e,"set"]))}else o||(this.#C&&this.#r?.(n,e,"set"),this.#_&&this.#E?.push([n,e,"set"]));if(this.#M(u),this.#j(u,l,a),this.#d[u]=t,a){a.set="replace";const e=n&&this.#N(n)?n.__staleWhileFetching:n;void 0!==e&&(a.oldValue=e)}}else a&&(a.set="update");this.#D&&this.onInsert?.(t,e,t===n?"update":"replace")}if(0===r||this.#L||this.#$(),this.#L&&(c||this.#F(u,r,i),a&&this.#B(a,u)),!o&&this.#_&&this.#E){const e=this.#E;let t;for(;t=e?.shift();)this.#o?.(...t)}return this}pop(){try{for(;this.#l;){const e=this.#d[this.#g];if(this.#z(!0),this.#N(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#_&&this.#E){const e=this.#E;let t;for(;t=e?.shift();)this.#o?.(...t)}}}#z(e){const t=this.#g,n=this.#p[t],r=this.#d[t];return this.#I&&this.#N(r)?r.__abortController.abort(new Error("evicted")):(this.#C||this.#_)&&(this.#C&&this.#r?.(r,n,"evict"),this.#_&&this.#E?.push([r,n,"evict"])),this.#M(t),this.#S?.[t]&&(clearTimeout(this.#S[t]),this.#S[t]=void 0),e&&(this.#p[t]=void 0,this.#d[t]=void 0,this.#y.push(t)),1===this.#l?(this.#g=this.#v=0,this.#y.length=0):this.#g=this.#h[t],this.#f.delete(n),this.#l--,t}has(e,t={}){const{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#f.get(e);if(void 0!==i){const e=this.#d[i];if(this.#N(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#R(i))return n&&this.#U(i),r&&(r.has="hit",this.#B(r,i)),!0;r&&(r.has="stale",this.#B(r,i))}else r&&(r.has="miss");return!1}peek(e,t={}){const{allowStale:n=this.allowStale}=t,r=this.#f.get(e);if(void 0===r||!n&&this.#R(r))return;const i=this.#d[r];return this.#N(i)?i.__staleWhileFetching:i}#O(e,t,n,r){const o=void 0===t?void 0:this.#d[t];if(this.#N(o))return o;const s=new i,{signal:a}=n;a?.addEventListener("abort",()=>s.abort(a.reason),{signal:s.signal});const c={signal:s.signal,options:n,context:r},l=(r,i=!1)=>{const{aborted:o}=s.signal,a=n.ignoreFetchAbort&&void 0!==r;if(n.status&&(o&&!i?(n.status.fetchAborted=!0,n.status.fetchError=s.signal.reason,a&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),o&&!a&&!i)return u(s.signal.reason);const l=f,p=this.#d[t];return(p===f||a&&i&&void 0===p)&&(void 0===r?void 0!==l.__staleWhileFetching?this.#d[t]=l.__staleWhileFetching:this.#k(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,r,c.options))),r},u=r=>{const{aborted:i}=s.signal,o=i&&n.allowStaleOnFetchAbort,a=o||n.allowStaleOnFetchRejection,c=a||n.noDeleteOnFetchRejection,l=f;if(this.#d[t]===f){!c||void 0===l.__staleWhileFetching?this.#k(e,"fetch"):o||(this.#d[t]=l.__staleWhileFetching)}if(a)return n.status&&void 0!==l.__staleWhileFetching&&(n.status.returnedStale=!0),l.__staleWhileFetching;if(l.__returned===l)throw r};n.status&&(n.status.fetchDispatched=!0);const f=new Promise((t,r)=>{const i=this.#s?.(e,o,c);i&&i instanceof Promise&&i.then(e=>t(void 0===e?void 0:e),r),s.signal.addEventListener("abort",()=>{n.ignoreFetchAbort&&!n.allowStaleOnFetchAbort||(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>l(e,!0)))})}).then(l,e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),u(e))),p=Object.assign(f,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return void 0===t?(this.set(e,p,{...c.options,status:void 0}),t=this.#f.get(e)):this.#d[t]=p,p}#N(e){if(!this.#I)return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof i}async fetch(e,t={}){const{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:a=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:d=this.allowStaleOnFetchAbort,context:h,forceRefresh:m=!1,status:g,signal:v}=t;if(!this.#I)return g&&(g.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:g});const y={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:o,noDisposeOnSet:s,size:a,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:d,ignoreFetchAbort:p,status:g,signal:v};let E=this.#f.get(e);if(void 0===E){g&&(g.fetch="miss");const t=this.#O(e,E,y,h);return t.__returned=t}{const t=this.#d[E];if(this.#N(t)){const e=n&&void 0!==t.__staleWhileFetching;return g&&(g.fetch="inflight",e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}const i=this.#R(E);if(!m&&!i)return g&&(g.fetch="hit"),this.#A(E),r&&this.#U(E),g&&this.#B(g,E),t;const o=this.#O(e,E,y,h),s=void 0!==o.__staleWhileFetching&&n;return g&&(g.fetch=i?"stale":"refresh",s&&i&&(g.returnedStale=!0)),s?o.__staleWhileFetching:o.__returned=o}}async forceFetch(e,t={}){const n=await this.fetch(e,t);if(void 0===n)throw new Error("fetch() returned undefined");return n}memo(e,t={}){const n=this.#a;if(!n)throw new Error("no memoMethod provided to constructor");const{context:r,forceRefresh:i,...o}=t,s=this.get(e,o);if(!i&&void 0!==s)return s;const a=n(e,s,{options:o,context:r});return this.set(e,a,o),a}get(e,t={}){const{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:o}=t,s=this.#f.get(e);if(void 0!==s){const t=this.#d[s],a=this.#N(t);return o&&this.#B(o,s),this.#R(s)?(o&&(o.get="stale"),a?(o&&n&&void 0!==t.__staleWhileFetching&&(o.returnedStale=!0),n?t.__staleWhileFetching:void 0):(i||this.#k(e,"expire"),o&&n&&(o.returnedStale=!0),n?t:void 0)):(o&&(o.get="hit"),a?t.__staleWhileFetching:(this.#A(s),r&&this.#U(s),t))}o&&(o.get="miss")}#q(e,t){this.#m[t]=e,this.#h[e]=t}#A(e){e!==this.#v&&(e===this.#g?this.#g=this.#h[e]:this.#q(this.#m[e],this.#h[e]),this.#q(this.#v,e),this.#v=e)}delete(e){return this.#k(e,"delete")}#k(e,t){let n=!1;if(0!==this.#l){const r=this.#f.get(e);if(void 0!==r)if(this.#S?.[r]&&(clearTimeout(this.#S?.[r]),this.#S[r]=void 0),n=!0,1===this.#l)this.#V(t);else{this.#M(r);const n=this.#d[r];if(this.#N(n)?n.__abortController.abort(new Error("deleted")):(this.#C||this.#_)&&(this.#C&&this.#r?.(n,e,t),this.#_&&this.#E?.push([n,e,t])),this.#f.delete(e),this.#p[r]=void 0,this.#d[r]=void 0,r===this.#v)this.#v=this.#m[r];else if(r===this.#g)this.#g=this.#h[r];else{const e=this.#m[r];this.#h[e]=this.#h[r];const t=this.#h[r];this.#m[t]=this.#m[r]}this.#l--,this.#y.push(r)}}if(this.#_&&this.#E?.length){const e=this.#E;let t;for(;t=e?.shift();)this.#o?.(...t)}return n}clear(){return this.#V("delete")}#V(e){for(const t of this.#T({allowStale:!0})){const n=this.#d[t];if(this.#N(n))n.__abortController.abort(new Error("deleted"));else{const r=this.#p[t];this.#C&&this.#r?.(n,r,e),this.#_&&this.#E?.push([n,r,e])}}if(this.#f.clear(),this.#d.fill(void 0),this.#p.fill(void 0),this.#L&&this.#w){this.#L.fill(0),this.#w.fill(0);for(const e of this.#S??[])void 0!==e&&clearTimeout(e);this.#S?.fill(void 0)}if(this.#b&&this.#b.fill(0),this.#g=0,this.#v=0,this.#y.length=0,this.#u=0,this.#l=0,this.#_&&this.#E){const e=this.#E;let t;for(;t=e?.shift();)this.#o?.(...t)}}}return ft.LRUCache=u,ft}function dt(){if(it)return rt;it=1;const e=p,t=(e,t,n)=>{const r=e.indexOf(n);return e.lastIndexOf(t,r>-1?r:1/0)},n=t=>{try{return new e.URL(t)}catch{}};return rt=(e,r)=>{const i=r?((e,t)=>{const n=e.indexOf(":"),r=e.slice(0,n+1);if(Object.prototype.hasOwnProperty.call(t,r))return e;if("://"===e.substr(n,3))return e;const i=e.indexOf("@");return i>-1?i>n?`git+ssh://${e}`:e:`${e.slice(0,n+1)}//${e.slice(n+1)}`})(e,r):e;return n(i)||n((e=>{const n=t(e,"@","#"),r=t(e,":","#");return r>n&&(e=e.slice(0,r)+"/"+e.slice(r+1)),-1===t(e,":","#")&&-1===e.indexOf("//")&&(e=`git+ssh://${e}`),e})(i))},rt}function ht(){if(st)return ot;st=1;const e=dt();return ot=(t,n,{gitHosts:r,protocols:i})=>{if(!t)return;const o=(e=>{const t=e.indexOf("#"),n=e.indexOf("/"),r=e.indexOf("/",n+1),i=e.indexOf(":"),o=/\s/.exec(e),s=e.indexOf("@"),a=!o||t>-1&&o.index>t,c=-1===s||t>-1&&s>t,l=-1===i||t>-1&&i>t,u=-1===r||t>-1&&r>t,f=n>0,p=t>-1?"/"!==e[t-1]:!e.endsWith("/"),d=!e.startsWith(".");return a&&f&&p&&d&&c&&l&&u})(t)?`github:${t}`:t,s=e(o,i);if(!s)return;const a=r.byShortcut[s.protocol],c=r.byDomain[s.hostname.startsWith("www.")?s.hostname.slice(4):s.hostname],l=a||c;if(!l)return;const u=r[a||c];let f=null;i[s.protocol]?.auth&&(s.username||s.password)&&(f=`${s.username}${s.password?":"+s.password:""}`);let p=null,d=null,h=null,m=null;try{if(a){let e=s.pathname.startsWith("/")?s.pathname.slice(1):s.pathname;const t=e.indexOf("@");t>-1&&(e=e.slice(t+1));const n=e.lastIndexOf("/");n>-1?(d=decodeURIComponent(e.slice(0,n)),d||(d=null),h=decodeURIComponent(e.slice(n+1))):h=decodeURIComponent(e),h.endsWith(".git")&&(h=h.slice(0,-4)),s.hash&&(p=decodeURIComponent(s.hash.slice(1))),m="shortcut"}else{if(!u.protocols.includes(s.protocol))return;const e=u.extract(s);if(!e)return;d=e.user&&decodeURIComponent(e.user),h=decodeURIComponent(e.project),p=decodeURIComponent(e.committish),m=i[s.protocol]?.name||s.protocol.slice(0,-1)}}catch(e){if(e instanceof URIError)return;throw e}return[l,d,f,h,p,m,n]}}function mt(){if(ct)return at;ct=1;const{LRUCache:e}=pt(),t=function(){if(nt)return tt;nt=1;const e=(...e)=>e.every(e=>e)?e.join(""):"",t=e=>e?encodeURIComponent(e):"",n=e=>e.toLowerCase().replace(/^\W+/g,"").replace(/(?<!\W)\W+$/,"").replace(/\//g,"").replace(/\W+/g,"-"),r={sshtemplate:({domain:t,user:n,project:r,committish:i})=>`git@${t}:${n}/${r}.git${e("#",i)}`,sshurltemplate:({domain:t,user:n,project:r,committish:i})=>`git+ssh://git@${t}/${n}/${r}.git${e("#",i)}`,edittemplate:({domain:n,user:r,project:i,committish:o,editpath:s,path:a})=>`https://${n}/${r}/${i}${e("/",s,"/",t(o||"HEAD"),"/",a)}`,browsetemplate:({domain:n,user:r,project:i,committish:o,treepath:s})=>`https://${n}/${r}/${i}${e("/",s,"/",t(o))}`,browsetreetemplate:({domain:n,user:r,project:i,committish:o,treepath:s,path:a,fragment:c,hashformat:l})=>`https://${n}/${r}/${i}/${s}/${t(o||"HEAD")}/${a}${e("#",l(c||""))}`,browseblobtemplate:({domain:n,user:r,project:i,committish:o,blobpath:s,path:a,fragment:c,hashformat:l})=>`https://${n}/${r}/${i}/${s}/${t(o||"HEAD")}/${a}${e("#",l(c||""))}`,docstemplate:({domain:n,user:r,project:i,treepath:o,committish:s})=>`https://${n}/${r}/${i}${e("/",o,"/",t(s))}#readme`,httpstemplate:({auth:t,domain:n,user:r,project:i,committish:o})=>`git+https://${e(t,"@")}${n}/${r}/${i}.git${e("#",o)}`,filetemplate:({domain:e,user:n,project:r,committish:i,path:o})=>`https://${e}/${n}/${r}/raw/${t(i||"HEAD")}/${o}`,shortcuttemplate:({type:t,user:n,project:r,committish:i})=>`${t}:${n}/${r}${e("#",i)}`,pathtemplate:({user:t,project:n,committish:r})=>`${t}/${n}${e("#",r)}`,bugstemplate:({domain:e,user:t,project:n})=>`https://${e}/${t}/${n}/issues`,hashformat:n},i={};i.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:n,user:r,project:i,committish:o,path:s})=>`https://${e(n,"@")}raw.githubusercontent.com/${r}/${i}/${t(o||"HEAD")}/${s}`,gittemplate:({auth:t,domain:n,user:r,project:i,committish:o})=>`git://${e(t,"@")}${n}/${r}/${i}.git${e("#",o)}`,tarballtemplate:({domain:e,user:n,project:r,committish:i})=>`https://codeload.${e}/${n}/${r}/tar.gz/${t(i||"HEAD")}`,extract:e=>{let[,t,n,r,i]=e.pathname.split("/",5);if((!r||"tree"===r)&&(r||(i=e.hash.slice(1)),n&&n.endsWith(".git")&&(n=n.slice(0,-4)),t&&n))return{user:t,project:n,committish:i}}},i.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:n,user:r,project:i,committish:o,treepath:s,path:a,editpath:c})=>`https://${n}/${r}/${i}${e("/",s,"/",t(o||"HEAD"),"/",a,c)}`,tarballtemplate:({domain:e,user:n,project:r,committish:i})=>`https://${e}/${n}/${r}/get/${t(i||"HEAD")}.tar.gz`,extract:e=>{let[,t,n,r]=e.pathname.split("/",4);if(!["get"].includes(r)&&(n&&n.endsWith(".git")&&(n=n.slice(0,-4)),t&&n))return{user:t,project:n,committish:e.hash.slice(1)}}},i.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",tarballtemplate:({domain:e,user:n,project:r,committish:i})=>`https://${e}/${n}/${r}/repository/archive.tar.gz?ref=${t(i||"HEAD")}`,extract:e=>{const t=e.pathname.slice(1);if(t.includes("/-/")||t.includes("/archive.tar.gz"))return;const n=t.split("/");let r=n.pop();r.endsWith(".git")&&(r=r.slice(0,-4));const i=n.join("/");return i&&r?{user:i,project:r,committish:e.hash.slice(1)}:void 0}},i.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:t,project:n,committish:r})=>`git@${t}:${n}.git${e("#",r)}`,sshurltemplate:({domain:t,project:n,committish:r})=>`git+ssh://git@${t}/${n}.git${e("#",r)}`,edittemplate:({domain:n,user:r,project:i,committish:o,editpath:s})=>`https://${n}/${r}/${i}${e("/",t(o))}/${s}`,browsetemplate:({domain:n,project:r,committish:i})=>`https://${n}/${r}${e("/",t(i))}`,browsetreetemplate:({domain:n,project:r,committish:i,path:o,hashformat:s})=>`https://${n}/${r}${e("/",t(i))}${e("#",s(o))}`,browseblobtemplate:({domain:n,project:r,committish:i,path:o,hashformat:s})=>`https://${n}/${r}${e("/",t(i))}${e("#",s(o))}`,docstemplate:({domain:n,project:r,committish:i})=>`https://${n}/${r}${e("/",t(i))}`,httpstemplate:({domain:t,project:n,committish:r})=>`git+https://${t}/${n}.git${e("#",r)}`,filetemplate:({user:n,project:r,committish:i,path:o})=>`https://gist.githubusercontent.com/${n}/${r}/raw${e("/",t(i))}/${o}`,shortcuttemplate:({type:t,project:n,committish:r})=>`${t}:${n}${e("#",r)}`,pathtemplate:({project:t,committish:n})=>`${t}${e("#",n)}`,bugstemplate:({domain:e,project:t})=>`https://${e}/${t}`,gittemplate:({domain:t,project:n,committish:r})=>`git://${t}/${n}.git${e("#",r)}`,tarballtemplate:({project:e,committish:n})=>`https://codeload.github.com/gist/${e}/tar.gz/${t(n||"HEAD")}`,extract:e=>{let[,t,n,r]=e.pathname.split("/",4);if("raw"!==r){if(!n){if(!t)return;n=t,t=null}return n.endsWith(".git")&&(n=n.slice(0,-4)),{user:t,project:n,committish:e.hash.slice(1)}}},hashformat:function(e){return e&&"file-"+n(e)}},i.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:e,user:n,project:r,committish:i,path:o})=>`https://${e}/${n}/${r}/blob/${t(i)||"HEAD"}/${o}`,httpstemplate:({domain:t,user:n,project:r,committish:i})=>`https://${t}/${n}/${r}.git${e("#",i)}`,tarballtemplate:({domain:e,user:n,project:r,committish:i})=>`https://${e}/${n}/${r}/archive/${t(i)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:e=>{let[,t,n,r]=e.pathname.split("/",4);if(!["archive"].includes(r)&&(n&&n.endsWith(".git")&&(n=n.slice(0,-4)),t&&n))return{user:t,project:n,committish:e.hash.slice(1)}}};for(const[e,t]of Object.entries(i))i[e]=Object.assign({},r,t);return tt=i}(),n=ht(),r=dt(),i=new e({max:1e3});class o{constructor(e,t,n,r,i,s,a={}){Object.assign(this,o.#W[e],{type:e,user:t,auth:n,project:r,committish:i,default:s,opts:a})}static#W={byShortcut:{},byDomain:{}};static#Y={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(e,t){o.#W[e]=t,o.#W.byDomain[t.domain]=e,o.#W.byShortcut[`${e}:`]=e,o.#Y[`${e}:`]={name:e}}static fromUrl(e,t){if("string"!=typeof e)return;const r=e+JSON.stringify(t||{});if(!i.has(r)){const s=n(e,t,{gitHosts:o.#W,protocols:o.#Y});i.set(r,s?new o(...s):void 0)}return i.get(r)}static fromManifest(e,t={}){if(!e||"object"!=typeof e)return;const n=e.repository,r=n&&("string"==typeof n?n:"object"==typeof n&&"string"==typeof n.url?n.url:null);if(!r)throw new Error("no repository");const i=r&&o.fromUrl(r.replace(/^git\+/,""),t)||null;if(i)return i;const s=function(e){try{const{protocol:t,hostname:n,pathname:r}=new URL(e);if(!n)return null;return`${/(?:git\+)http:$/.test(t)?"http:":"https:"}//${n}${r.replace(/\.git$/,"")}`}catch{return null}}(r);return o.fromUrl(s,t)||s}static parseUrl(e){return r(e)}#Z(e,t){if("function"!=typeof e)return null;const n={...this,...this.opts,...t};n.path||(n.path=""),n.path.startsWith("/")&&(n.path=n.path.slice(1)),n.noCommittish&&(n.committish=null);const r=e(n);return n.noGitPlus&&r.startsWith("git+")?r.slice(4):r}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#Z(this.sshtemplate,e)}sshurl(e){return this.#Z(this.sshurltemplate,e)}browse(e,...t){return"string"!=typeof e?this.#Z(this.browsetemplate,e):"string"!=typeof t[0]?this.#Z(this.browsetreetemplate,{...t[0],path:e}):this.#Z(this.browsetreetemplate,{...t[1],fragment:t[0],path:e})}browseFile(e,...t){return"string"!=typeof t[0]?this.#Z(this.browseblobtemplate,{...t[0],path:e}):this.#Z(this.browseblobtemplate,{...t[1],fragment:t[0],path:e})}docs(e){return this.#Z(this.docstemplate,e)}bugs(e){return this.#Z(this.bugstemplate,e)}https(e){return this.#Z(this.httpstemplate,e)}git(e){return this.#Z(this.gittemplate,e)}shortcut(e){return this.#Z(this.shortcuttemplate,e)}path(e){return this.#Z(this.pathtemplate,e)}tarball(e){return this.#Z(this.tarballtemplate,{...e,noCommittish:!1})}file(e,t){return this.#Z(this.filetemplate,{...t,path:e})}edit(e,t){return this.#Z(this.edittemplate,{...t,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&"function"==typeof this[this.default]?this[this.default](e):this.sshurl(e)}}for(const[e,n]of Object.entries(t))o.addHost(e,n);return at=o}var gt,vt,yt={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}};function Et(){if(vt)return gt;vt=1;var{URL:e}=u,t=function(){if(Ae)return Oe;Ae=1;const e=Fe();return Oe=(t,n)=>{const r=e(t,n);return r?r.version:null},Oe}(),n=function(){if(Te)return Pe;Te=1;const e=Fe();return Pe=(t,n)=>{const r=e(t.trim().replace(/^[=v]+/,""),n);return r?r.version:null},Pe}(),r=Qe(),i=mt(),{isBuiltin:o}=d,s=["dependencies","devDependencies","optionalDependencies"],a=ut?lt:(ut=1,lt=function(e){if(!e)return;if("ERROR: No README data found!"===e)return;e=e.trim().split("\n");let t=0;for(;e[t]&&e[t].trim().match(/^(#|$)/);)t++;const n=e.length;let r=t+1;for(;r<n&&e[r].trim();)r++;return e.slice(t,r).join(" ").trim()}),c=yt,l=e=>e.includes("@")&&e.indexOf("@")<e.lastIndexOf(".");function f(e,t){return e.author&&(e.author=t(e.author)),["maintainers","contributors"].forEach(function(n){Array.isArray(e[n])&&(e[n]=e[n].map(t))}),e}function p(e){if("string"==typeof e)return e;var t=e.name||"",n=e.url||e.web,r=n?" ("+n+")":"",i=e.email||e.mail;return t+(i?" <"+i+">":"")+r}function h(e){if("string"!=typeof e)return e;var t=e.match(/^([^(<]+)/),n=e.match(/\(([^()]+)\)/),r=e.match(/<([^<>]+)>/),i={};return t&&t[0].trim()&&(i.name=t[0].trim()),r&&(i.email=r[1]),n&&(i.url=n[1]),i}return gt={warn:function(){},fixRepositoryField:function(e){if(e.repositories&&(this.warn("repositories"),e.repository=e.repositories[0]),!e.repository)return this.warn("missingRepository");"string"==typeof e.repository&&(e.repository={type:"git",url:e.repository});var t=e.repository.url||"";if(t){var n=i.fromUrl(t);n&&(t=e.repository.url="shortcut"===n.getDefaultRepresentation()?n.https():n.toString())}t.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",t)},fixTypos:function(e){Object.keys(c.topLevel).forEach(function(t){Object.prototype.hasOwnProperty.call(e,t)&&this.warn("typo",t,c.topLevel[t])},this)},fixScriptsField:function(e){if(e.scripts)return"object"!=typeof e.scripts?(this.warn("nonObjectScripts"),void delete e.scripts):void Object.keys(e.scripts).forEach(function(t){"string"!=typeof e.scripts[t]?(this.warn("nonStringScript"),delete e.scripts[t]):c.script[t]&&!e.scripts[c.script[t]]&&this.warn("typo",t,c.script[t],"scripts")},this)},fixFilesField:function(e){var t=e.files;t&&!Array.isArray(t)?(this.warn("nonArrayFiles"),delete e.files):e.files&&(e.files=e.files.filter(function(e){return!(!e||"string"!=typeof e)||(this.warn("invalidFilename",e),!1)},this))},fixBinField:function(e){if(e.bin&&"string"==typeof e.bin){var t,n={};(t=e.name.match(/^@[^/]+[/](.*)$/))?n[t[1]]=e.bin:n[e.name]=e.bin,e.bin=n}},fixManField:function(e){e.man&&"string"==typeof e.man&&(e.man=[e.man])},fixBundleDependenciesField:function(e){var t="bundledDependencies",n="bundleDependencies";e[t]&&!e[n]&&(e[n]=e[t],delete e[t]),e[n]&&!Array.isArray(e[n])?(this.warn("nonArrayBundleDependencies"),delete e[n]):e[n]&&(e[n]=e[n].filter(function(t){return t&&"string"==typeof t?(e.dependencies||(e.dependencies={}),Object.prototype.hasOwnProperty.call(e.dependencies,t)||(this.warn("nonDependencyBundleDependency",t),e.dependencies[t]="*"),!0):(this.warn("nonStringBundleDependency",t),!1)},this))},fixDependencies:function(e){!function(e,t){s.forEach(function(n){e[n]&&(e[n]=function(e,t,n){if(!e)return{};"string"==typeof e&&(e=e.trim().split(/[\n\r\s\t ,]+/));if(!Array.isArray(e))return e;n("deprecatedArrayDependencies",t);var r={};return e.filter(function(e){return"string"==typeof e}).forEach(function(e){var t=(e=e.trim().split(/(:?[@\s><=])/)).shift(),n=e.join("");n=(n=n.trim()).replace(/^@/,""),r[t]=n}),r}(e[n],n,t))})}(e,this.warn),function(e){var t=e.optionalDependencies;if(!t)return;var n=e.dependencies||{};Object.keys(t).forEach(function(e){n[e]=t[e]}),e.dependencies=n}(e,this.warn),this.fixBundleDependenciesField(e),["dependencies","devDependencies"].forEach(function(t){if(t in e)return e[t]&&"object"==typeof e[t]?void Object.keys(e[t]).forEach(function(n){var r=e[t][n];"string"!=typeof r&&(this.warn("nonStringDependency",n,JSON.stringify(r)),delete e[t][n]);var o=i.fromUrl(e[t][n]);o&&(e[t][n]=o.toString())},this):(this.warn("nonObjectDependencies",t),void delete e[t])},this)},fixModulesField:function(e){e.modules&&(this.warn("deprecatedModules"),delete e.modules)},fixKeywordsField:function(e){"string"==typeof e.keywords&&(e.keywords=e.keywords.split(/,\s+/)),e.keywords&&!Array.isArray(e.keywords)?(delete e.keywords,this.warn("nonArrayKeywords")):e.keywords&&(e.keywords=e.keywords.filter(function(e){return!("string"!=typeof e||!e)||(this.warn("nonStringKeyword"),!1)},this))},fixVersionField:function(e,r){var i=!r;if(!e.version)return e.version="",!0;if(!t(e.version,i))throw new Error('Invalid version: "'+e.version+'"');return e.version=n(e.version,i),!0},fixPeople:function(e){f(e,p),f(e,h)},fixNameField:function(e,t){"boolean"==typeof t?t={strict:t}:void 0===t&&(t={});var n=t.strict;if(e.name||n){if("string"!=typeof e.name)throw new Error("name field must be a string.");n||(e.name=e.name.trim()),function(e,t,n){if("."===e.charAt(0)||!function(e){if("@"!==e.charAt(0))return!1;var t=e.slice(1).split("/");if(2!==t.length)return!1;return t[0]&&t[1]&&t[0]===encodeURIComponent(t[0])&&t[1]===encodeURIComponent(t[1])}(e)&&(r=e,r.match(/[/@\s+%:]/)||r!==encodeURIComponent(r))||t&&!n&&e!==e.toLowerCase()||"node_modules"===e.toLowerCase()||"favicon.ico"===e.toLowerCase())throw new Error("Invalid name: "+JSON.stringify(e));var r}(e.name,n,t.allowLegacyCase),o(e.name)&&this.warn("conflictingName",e.name)}else e.name=""},fixDescriptionField:function(e){e.description&&"string"!=typeof e.description&&(this.warn("nonStringDescription"),delete e.description),e.readme&&!e.description&&(e.description=a(e.readme)),void 0===e.description&&delete e.description,e.description||this.warn("missingDescription")},fixReadmeField:function(e){e.readme||(this.warn("missingReadme"),e.readme="ERROR: No README data found!")},fixBugsField:function(t){if(!t.bugs&&t.repository&&t.repository.url){var n=i.fromUrl(t.repository.url);n&&n.bugs()&&(t.bugs={url:n.bugs()})}else if(t.bugs){if("string"==typeof t.bugs)l(t.bugs)?t.bugs={email:t.bugs}:e.canParse(t.bugs)?t.bugs={url:t.bugs}:this.warn("nonEmailUrlBugsString");else{!function(e,t){if(!e)return;Object.keys(e).forEach(function(n){c.bugs[n]&&(t("typo",n,c.bugs[n],"bugs"),e[c.bugs[n]]=e[n],delete e[n])})}(t.bugs,this.warn);var r=t.bugs;t.bugs={},r.url&&(e.canParse(r.url)?t.bugs.url=r.url:this.warn("nonUrlBugsUrlField")),r.email&&("string"==typeof r.email&&l(r.email)?t.bugs.email=r.email:this.warn("nonEmailBugsEmailField"))}t.bugs.email||t.bugs.url||(delete t.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(t){if(!t.homepage&&t.repository&&t.repository.url){var n=i.fromUrl(t.repository.url);n&&n.docs()&&(t.homepage=n.docs())}if(t.homepage)return"string"!=typeof t.homepage?(this.warn("nonUrlHomepage"),delete t.homepage):void(e.canParse(t.homepage)||(t.homepage="http://"+t.homepage))},fixLicenseField:function(e){const t=e.license||e.licence;return t?"string"!=typeof t||t.length<1||""===t.trim()?this.warn("invalidLicense"):r(t).validForNewPackages?void 0:this.warn("invalidLicense"):this.warn("missingLicense")}},gt}var bt,wt,Lt,St,Ct={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."};function It(){if(wt)return bt;wt=1;var e=h,t=Ct;function n(n,r,i){return i&&(n=i+"['"+n+"']",r=i+"['"+r+"']"),e.format(t.typo,n,r)}return bt=function(){var r=Array.prototype.slice.call(arguments,0),i=r.shift();if("typo"===i)return n.apply(null,r);var o=t[i]?t[i]:i+": '%s'";return r.unshift(o),e.format.apply(null,r)},bt}var _t=function(){if(St)return Lt;St=1,Lt=r;var e=Et();r.fixer=e;var t=It(),n=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"].map(function(e){return i(e)+"Field"});function r(r,o,s){!0===o&&(o=null,s=!0),s||(s=!1),o&&!r.private||(o=function(){}),r.scripts&&"node-gyp rebuild"===r.scripts.install&&!r.scripts.preinstall&&(r.gypfile=!0),e.warn=function(){o(t.apply(null,arguments))},n.forEach(function(t){e["fix"+i(t)](r,s)}),r._id=r.name+"@"+r.version}function i(e){return e.charAt(0).toUpperCase()+e.slice(1)}return n=n.concat(["dependencies","people","typos"]),Lt}(),Dt=de(_t);const Nt=(e,t)=>{try{return m(e,g.F_OK),!0}catch(e){return!1}},Ot=["index.ts","index.tsx","main.ts","main.tsx"],At=(e,t,n)=>{const r=o(e??process.cwd(),"src"),i=Ot,s=i.map(e=>o(r,e)).find(e=>Nt(e));if(!s)throw new Error(`Unable to resolve entry point, ensure ${i.join(", ")} exists in ${r}`);return s},Pt=(e,t)=>_(e,t,{arrayMerge:(e,t)=>{const n=t[0]??e[0];return"object"==typeof n&&"match"in n&&"middleware"in n?((e,t,n)=>{const r=n.reduce((t,n)=>Object.assign(t,{[String(n[e])]:n}),{}),i={...t.reduce((t,n)=>Object.assign(t,{[String(n[e])]:n}),{}),...r};return Object.values(i)})("match",e,t):[...new Set([...e,...t])]}}),Tt=async(n,o)=>{const{packageJson:c,root:l}=o,{config:u}=await e(n)??{},f=c.main??c.module??"./dist/bundle.js",p=At(l);if("build"===n.command){if(i(f)===l)throw new Error("outDir cannot be root, please specify package.main or package.module in package.json");if("src"===i(f))throw new Error("outDir cannot be src, please specify package.main or package.module in package.json");if(i(f)===process.cwd())throw new Error("outDir cannot be the current working directory, please specify package.main or package.module in package.json")}return t({root:l,plugins:[r()],define:{"process.env.NODE_ENV":JSON.stringify(n.mode),"process.env.NODE_DEBUG":"production"!==n.mode,"process.env.FUSION_LOG_LEVEL":"production"===n.mode?1:3},build:{outDir:i(f),lib:{entry:p,fileName:s(f,a(f)),formats:["es"]},emptyOutDir:!0}},u??{})};function Rt(e,t){D("object"==typeof e,t)}const xt=e=>{if(e.repository)return"string"==typeof e.repository?e.repository:e.repository.url},$t=()=>{try{return N("git remote get-url origin").toString().trim().replace("git@github.com:","https://github.com/").replace(/\.git$/,"")}catch(e){return}},Ft=(e="HEAD")=>{try{return N(`git rev-parse ${e}`).toString().trim()}catch(e){return}},kt="13.1.1",Ut=()=>{const e={cliVersion:kt,source:"local",reason:"manual"};if(process.env.GITHUB_ACTIONS){const t=(()=>{const e=process.env.GITHUB_EVENT_NAME||"unknown",t=process.env.GITHUB_ACTOR||"unknown",n=process.env.GITHUB_RUN_ID||"unknown",r=process.env.GITHUB_REPOSITORY||"unknown",i=process.env.GITHUB_WORKFLOW||"unknown",o=process.env.GITHUB_SERVER_URL||"https://github.com";let s="unknown";"unknown"!==r&&"unknown"!==n&&(s=`${o.replace(/\/$/,"")}/${r}/actions/runs/${n}`);const a={eventName:e,actor:t,runId:n,runUrl:s,workflow:i};if(process.env.GITHUB_EVENT_PATH)try{const e=v(process.env.GITHUB_EVENT_PATH,"utf8");Object.assign(a,JSON.parse(e))}catch{console.error("Failed to parse GitHub event payload")}return a})(),n={...e,source:"github",reason:t.eventName,workflow:t.workflow,runId:t.runId,runUrl:t.runUrl,commitId:t.head_commit?.id,repository:t.repository?.name,repository_homepage:t.repository?.homepage,repository_license:t.repository?.license?.name,repository_owner:t.repository?.owner?.login,repository_owner_avatar_url:t.repository?.owner?.avatar_url,actor:t.actor,sender_login:t.sender?.login,sender_avatar_url:t.sender?.avatar_url};return t.pull_request?{...n,branch:t.pull_request.head?.ref,commitId:t.pull_request.head?.sha,htmlUrl:t.pull_request.html_url}:t.release?{...n,tag:t.release.tag_name,htmlUrl:t.release.html_url}:n}if(process.env.SYSTEM_TEAMPROJECT){const t=(()=>{const e=process.env.BUILD_BUILDID||"unknown",t=process.env.BUILD_DEFINITIONNAME||"unknown",n=process.env.BUILD_REPOSITORY_NAME||"unknown",r=process.env.SYSTEM_TEAMPROJECT||"unknown",i=process.env.SYSTEM_COLLECTIONURI||"unknown",o=process.env.BUILD_REQUESTEDFOR||"unknown",s=process.env.BUILD_SOURCEBRANCH||"unknown",a=process.env.BUILD_SOURCEVERSION||"unknown",c=process.env.BUILD_REASON||"unknown";let l="unknown";return"unknown"!==i&&"unknown"!==r&&"unknown"!==e&&(l=`${i.replace(/\/$/,"")}${r}/_build/results?buildId=${e}`),{runId:e,pipelineName:t,repository:n,project:r,orgUrl:i,actor:o,branch:s,commitId:a,runUrl:l,reason:c}})();return{...e,source:"azure_devops",reason:t.reason,repository:t.repository,runId:t.runId,runUrl:t.runUrl,actor:t.actor,branch:t.branch,commitId:t.commitId,workflow:t.pipelineName}}return e},Bt=["png","jpg","jpeg","gif","svg","ico","webp","mp4","webm","mp3","woff2","woff","eot","ttf","otf","pdf","md","txt"];const Mt=(e,t,n)=>{Rt(t,"expected packageJson"),D(t.name,"expected [name] in packageJson"),D(t.version,"expected [version] in packageJson");const r=((e,t)=>"build"===e.command||e.isPreview?t.main||t.module||"dist/app-bundle.js":At(e.root))(e,t),i=t.name.replace(/^@|\w.*\//gm,""),o=n?.snapshot?function(e,t){const n=O(e)?.version;if(!n)throw new Error(`Invalid semantic version: "${e}". Expected format: major.minor.patch`);const r=Math.floor(Date.now()/1e3);return`${n}-${"string"==typeof t?`${t}.${r}`:`snapshot.${r}`}`}(t.version,n.snapshot):t.version,s="build"===e.command?void 0:`/bundles/apps/${i}@${o}`,a=xt(t)??$t();return{appKey:i,displayName:t.name,description:t.description||"",keywords:t.keywords,type:"standalone",build:{entryPoint:r,assetPath:s,githubRepo:a,version:o,timestamp:(new Date).toISOString(),commitSha:Ft(),annotations:Ut(),projectPage:t.homepage,allowedExtensions:Bt.map(e=>`.${e}`)}}},Gt=(e,t)=>_(e,t),jt=R.object({environment:R.record(R.string(),R.any()).describe("Key-value map of environment-specific variables for the application. Defaults to an empty object if not provided.").optional().default({}),endpoints:R.record(R.string(),R.object({url:R.string({message:"The endpoint URL. This field is required."}),scopes:R.array(R.string()).optional().default([]).describe("List of scopes required for accessing this endpoint. Defaults to an empty array.")})).describe("A mapping of endpoint names to their configuration objects. Each endpoint must specify a URL and may specify scopes.").optional()}).describe("The API application configuration schema, defining environment variables and endpoints for the application."),zt=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],Ht=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],qt=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],Vt=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],Wt=(e,t,n)=>{let r=e;return"string"==typeof t||Array.isArray(t)?r=e.toLocaleString(t,n):!0!==t&&void 0===n||(r=e.toLocaleString(void 0,n)),r},Yt=e=>{if("number"==typeof e)return Math.log10(e);const t=e.toString(10);return t.length+Math.log10(`0.${t.slice(0,15)}`)},Zt=(e,t)=>{if(void 0===t)return e;if("number"!=typeof t||!Number.isSafeInteger(t)||t<0)throw new TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof t}: ${t}`);return 0===t?e:e.length<t?e.padStart(t," "):e};function Kt(e,t){if("bigint"!=typeof e&&!Number.isFinite(e))throw new TypeError(`Expected a finite number, got ${typeof e}: ${e}`);const n=(t={bits:!1,binary:!1,space:!0,nonBreakingSpace:!1,...t}).bits?t.binary?Vt:qt:t.binary?Ht:zt,r=t.space?t.nonBreakingSpace?" ":" ":"",i="number"==typeof e?0===e:0n===e;if(t.signed&&i){return Zt(` 0${r}${n[0]}`,t.fixedWidth)}const o=e<0,s=o?"-":t.signed?"+":"";o&&(e=-e);const a=(e=>{const{minimumFractionDigits:t,maximumFractionDigits:n}=e;if(void 0!==t||void 0!==n)return{...void 0!==t&&{minimumFractionDigits:t},...void 0!==n&&{maximumFractionDigits:n},roundingMode:"trunc"}})(t);let c;if(e<1){c=s+Wt(e,t.locale,a)+r+n[0]}else{const i=Math.min(Math.floor(t.binary?("number"==typeof(l=e)?Math.log(l):Yt(l)*Math.log(10))/Math.log(1024):Yt(e)/3),n.length-1);if(e=((e,t)=>{if("number"==typeof e)return e/t;const n=e/BigInt(t),r=e%BigInt(t);return Number(n)+Number(r)/t})(e,(t.binary?1024:1e3)**i),!a){const t=Math.max(3,Math.floor(e).toString().length);e=e.toPrecision(t)}c=s+Wt(Number(e),t.locale,a)+r+n[i]}var l;return Zt(c,t.fixedWidth)}const Xt=(e,t)=>pe.blueBright(t?.relative?`./${c(t?.cwd??process.cwd(),e)}`:e),Jt=e=>"string"==typeof e?Jt(y(e).size):pe.yellowBright(Kt(e)),Qt=async(e,t,n)=>{const r=Mt(e,t.packageJson,{snapshot:n?.snapshot});try{n?.log?.start("loading application package...");const{manifest:t,path:i}=await(async(e,t)=>{const n=t?.file??[`app.manifest.${e.environment}`,"app.manifest","app.manifest.config"],r=await C(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async n=>{const r=t?.base??{};if("function"==typeof n.default){const t=await n.default(e,{base:r});return Gt(r,t??{})}return Gt(r,n.default??{})}}});return{manifest:r.config,path:r.path,extension:r.extension}})(e,{base:r,file:n?.manifestPath});if(!t.build)throw new Error(`Application manifest for ${t.appKey} does not contain build information, please check the manifest file.`);return"serve"===e.command&&(t.build.assetPath=`/bundles/apps/${t.appKey}/${t.build.version}`),n?.log?.succeed("generated manifest from",Xt(i,{relative:!0})),t}catch(e){if(e instanceof I){if(n?.manifestPath){const t=new Error(`Failed to load manifest file ${Xt(n.manifestPath)}, please check the path.`,{cause:e});throw n?.log?.fail(t.message),t}return n?.log?.succeed(pe.dim("no local manifest config applied, using default generated from package")),r}throw n?.log?.fail(`failed to resolve application manifest ${n?.manifestPath?Xt(n?.manifestPath):""}`),e}};async function en(e){e?.start("resolve project package");try{const t=await(async e=>{const t=await l({...e,normalize:!1});if(!t)throw new Error("failed to find package.json");const n={...t.packageJson};return Dt(n),{packageJson:{...n,version:t.packageJson.version},path:t.path,root:i(t.path)}})();return e?.succeed("📦",pe.yellowBright([t.packageJson.name,t.packageJson.version].join("@"))),e?.info("🏠",pe.blueBright(t.root)),t}catch(t){throw e?.fail("☠️","failed to resolve project package"),t}}const tn=async e=>{const{log:t}=e??{},n=await en(t);t?.debug("package",n);const r={command:"build",mode:process.env.NODE_ENV??"production",root:n.root,...e?.env};t?.debug("env:",r);const i=await Qt(r,n,{log:t,manifestPath:e?.manifest,snapshot:e?.snapshot});return t?.debug("manifest:",i),{manifest:i,pkg:n,env:r}},nn=async e=>{const{log:t,snapshot:r}=e??{};t?.log(pe.bold("Starting to build application"));const{manifest:i,pkg:o,env:s}=await tn({log:t,manifest:e?.manifest,snapshot:r});t?.start("loading vite config...");const a=await Tt(s,o);t?.succeed("vite config applied"),t?.debug("vite config:",a),t?.start("🤞🏻","building application..."),t?.startNativeConsoleCapture(),await n(a),t?.stopNativeConsoleCapture(),t?.succeed("build completed 😘");return{pkg:o,manifest:i,outDir:a.build.outDir}};var rn,on,sn={exports:{}};function an(){return on?rn:(on=1,rn={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24})}var cn,ln,un,fn,pn,dn,hn,mn,gn={};function vn(){return cn||(cn=1,function(e){const t={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function n(e){return function(...t){return t.length&&(e=e.replace(/\{(\d)\}/g,(e,n)=>t[n]||"")),new Error("ADM-ZIP: "+e)}}for(const r of Object.keys(t))e[r]=n(t[r])}(gn)),gn}function yn(){return mn||(mn=1,sn.exports=function(){if(un)return ln;un=1;const e=x,t=$,n=an(),r=vn(),i="object"==typeof process&&"win32"===process.platform,o=e=>"object"==typeof e&&null!==e,s=new Uint32Array(256).map((e,t)=>{for(let e=0;e<8;e++)1&t?t=3988292384^t>>>1:t>>>=1;return t>>>0});function a(n){this.sep=t.sep,this.fs=e,o(n)&&o(n.fs)&&"function"==typeof n.fs.statSync&&(this.fs=n.fs)}return ln=a,a.prototype.makeDir=function(e){const t=this;!function(e){let n=e.split(t.sep)[0];e.split(t.sep).forEach(function(e){if(e&&":"!==e.substr(-1,1)){var i;n+=t.sep+e;try{i=t.fs.statSync(n)}catch(e){t.fs.mkdirSync(n)}if(i&&i.isFile())throw r.FILE_IN_THE_WAY(`"${n}"`)}})}(e)},a.prototype.writeFileTo=function(e,n,r,i){const o=this;if(o.fs.existsSync(e)){if(!r)return!1;if(o.fs.statSync(e).isDirectory())return!1}var s,a=t.dirname(e);o.fs.existsSync(a)||o.makeDir(a);try{s=o.fs.openSync(e,"w",438)}catch(t){o.fs.chmodSync(e,438),s=o.fs.openSync(e,"w",438)}if(s)try{o.fs.writeSync(s,n,0,n.length,0)}finally{o.fs.closeSync(s)}return o.fs.chmodSync(e,i||438),!0},a.prototype.writeFileToAsync=function(e,n,r,i,o){"function"==typeof i&&(o=i,i=void 0);const s=this;s.fs.exists(e,function(a){if(a&&!r)return o(!1);s.fs.stat(e,function(r,c){if(a&&c.isDirectory())return o(!1);var l=t.dirname(e);s.fs.exists(l,function(t){t||s.makeDir(l),s.fs.open(e,"w",438,function(t,r){t?s.fs.chmod(e,438,function(){s.fs.open(e,"w",438,function(t,r){s.fs.write(r,n,0,n.length,0,function(){s.fs.close(r,function(){s.fs.chmod(e,i||438,function(){o(!0)})})})})}):r?s.fs.write(r,n,0,n.length,0,function(){s.fs.close(r,function(){s.fs.chmod(e,i||438,function(){o(!0)})})}):s.fs.chmod(e,i||438,function(){o(!0)})})})})})},a.prototype.findFiles=function(e){const n=this;return function e(r,i,o){let s=[];return n.fs.readdirSync(r).forEach(function(a){const c=t.join(r,a),l=n.fs.statSync(c);s.push(t.normalize(c)+(l.isDirectory()?n.sep:"")),l.isDirectory()&&o&&(s=s.concat(e(c,i,o)))}),s}(e,void 0,!0)},a.prototype.findFilesAsync=function(e,n){const r=this;let i=[];r.fs.readdir(e,function(o,s){if(o)return n(o);let a=s.length;if(!a)return n(null,i);s.forEach(function(o){o=t.join(e,o),r.fs.stat(o,function(e,s){if(e)return n(e);s&&(i.push(t.normalize(o)+(s.isDirectory()?r.sep:"")),s.isDirectory()?r.findFilesAsync(o,function(e,t){if(e)return n(e);i=i.concat(t),--a||n(null,i)}):--a||n(null,i))})})})},a.prototype.getAttributes=function(){},a.prototype.setAttributes=function(){},a.crc32update=function(e,t){return s[255&(e^t)]^e>>>8},a.crc32=function(e){"string"==typeof e&&(e=Buffer.from(e,"utf8"));let t=e.length,n=-1;for(let r=0;r<t;)n=a.crc32update(n,e[r++]);return~n>>>0},a.methodToString=function(e){switch(e){case n.STORED:return"STORED ("+e+")";case n.DEFLATED:return"DEFLATED ("+e+")";default:return"UNSUPPORTED ("+e+")"}},a.canonical=function(e){if(!e)return"";const n=t.posix.normalize("/"+e.split("\\").join("/"));return t.join(".",n)},a.zipnamefix=function(e){if(!e)return"";const n=t.posix.normalize("/"+e.split("\\").join("/"));return t.posix.join(".",n)},a.findLast=function(e,t){if(!Array.isArray(e))throw new TypeError("arr is not array");for(let n=(e.length>>>0)-1;n>=0;n--)if(t(e[n],n,e))return e[n]},a.sanitize=function(e,n){e=t.resolve(t.normalize(e));for(var r=n.split("/"),i=0,o=r.length;i<o;i++){var s=t.normalize(t.join(e,r.slice(i,o).join(t.sep)));if(0===s.indexOf(e))return s}return t.normalize(t.join(e,t.basename(n)))},a.toBuffer=function(e,t){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):"string"==typeof e?t(e):Buffer.alloc(0)},a.readBigUInt64LE=function(e,t){var n=Buffer.from(e.slice(t,t+8));return n.swap64(),parseInt(`0x${n.toString("hex")}`)},a.fromDOS2Date=function(e){return new Date(1980+(e>>25&127),Math.max((e>>21&15)-1,0),Math.max(e>>16&31,1),e>>11&31,e>>5&63,(31&e)<<1)},a.fromDate2DOS=function(e){let t=0,n=0;return e.getFullYear()>1979&&(t=(e.getFullYear()-1980&127)<<9|e.getMonth()+1<<5|e.getDate(),n=e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1),t<<16|n},a.isWin=i,a.crcTable=s,ln}(),sn.exports.Constants=an(),sn.exports.Errors=vn(),sn.exports.FileAttr=function(){if(pn)return fn;pn=1;const e=$;return fn=function(t,{fs:n}){var r=t||"",i={directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0},o=null;return r&&n.existsSync(r)?(o=n.statSync(r),i.directory=o.isDirectory(),i.mtime=o.mtime,i.atime=o.atime,i.executable=!!(73&o.mode),i.readonly=!(128&o.mode),i.hidden="."===e.basename(r)[0]):console.warn("Invalid path: "+r),{get directory(){return i.directory},get readOnly(){return i.readonly},get hidden(){return i.hidden},get mtime(){return i.mtime},get atime(){return i.atime},get executable(){return i.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:r,isDirectory:i.directory,isReadOnly:i.readonly,isHidden:i.hidden,isExecutable:i.executable,mTime:i.mtime,aTime:i.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}(),sn.exports.decoder=hn?dn:(hn=1,dn={efs:!0,encode:e=>Buffer.from(e,"utf8"),decode:e=>e.toString("utf8")})),sn.exports}var En,bn,wn,Ln,Sn,Cn={};function In(){if(bn)return En;bn=1;var e=yn(),t=e.Constants;return En=function(){var n=20,r=10,i=0,o=0,s=0,a=0,c=0,l=0,u=0,f=0,p=0,d=0,h=0,m=0,g=0;n|=e.isWin?2560:768,i|=t.FLG_EFS;const v={extraLen:0},y=e=>Math.max(0,e)>>>0;return s=e.fromDate2DOS(new Date),{get made(){return n},set made(e){n=e},get version(){return r},set version(e){r=e},get flags(){return i},set flags(e){i=e},get flags_efs(){return(i&t.FLG_EFS)>0},set flags_efs(e){e?i|=t.FLG_EFS:i&=~t.FLG_EFS},get flags_desc(){return(i&t.FLG_DESC)>0},set flags_desc(e){e?i|=t.FLG_DESC:i&=~t.FLG_DESC},get method(){return o},set method(e){switch(e){case t.STORED:this.version=10;case t.DEFLATED:default:this.version=20}o=e},get time(){return e.fromDOS2Date(this.timeval)},set time(t){this.timeval=e.fromDate2DOS(t)},get timeval(){return s},set timeval(e){s=y(e)},get timeHighByte(){return e=s>>>8,255&Math.max(0,e);var e},get crc(){return a},set crc(e){a=y(e)},get compressedSize(){return c},set compressedSize(e){c=y(e)},get size(){return l},set size(e){l=y(e)},get fileNameLength(){return u},set fileNameLength(e){u=e},get extraLength(){return f},set extraLength(e){f=e},get extraLocalLength(){return v.extraLen},set extraLocalLength(e){v.extraLen=e},get commentLength(){return p},set commentLength(e){p=e},get diskNumStart(){return d},set diskNumStart(e){d=y(e)},get inAttr(){return h},set inAttr(e){h=y(e)},get attr(){return m},set attr(e){m=y(e)},get fileAttr(){return(m||0)>>16&4095},get offset(){return g},set offset(e){g=y(e)},get encrypted(){return(i&t.FLG_ENC)===t.FLG_ENC},get centralHeaderSize(){return t.CENHDR+u+f+p},get realDataOffset(){return g+t.LOCHDR+v.fnameLen+v.extraLen},get localHeader(){return v},loadLocalHeaderFromBinary:function(n){var r=n.slice(g,g+t.LOCHDR);if(r.readUInt32LE(0)!==t.LOCSIG)throw e.Errors.INVALID_LOC();v.version=r.readUInt16LE(t.LOCVER),v.flags=r.readUInt16LE(t.LOCFLG),v.method=r.readUInt16LE(t.LOCHOW),v.time=r.readUInt32LE(t.LOCTIM),v.crc=r.readUInt32LE(t.LOCCRC),v.compressedSize=r.readUInt32LE(t.LOCSIZ),v.size=r.readUInt32LE(t.LOCLEN),v.fnameLen=r.readUInt16LE(t.LOCNAM),v.extraLen=r.readUInt16LE(t.LOCEXT);const i=g+t.LOCHDR+v.fnameLen,o=i+v.extraLen;return n.slice(i,o)},loadFromBinary:function(v){if(v.length!==t.CENHDR||v.readUInt32LE(0)!==t.CENSIG)throw e.Errors.INVALID_CEN();n=v.readUInt16LE(t.CENVEM),r=v.readUInt16LE(t.CENVER),i=v.readUInt16LE(t.CENFLG),o=v.readUInt16LE(t.CENHOW),s=v.readUInt32LE(t.CENTIM),a=v.readUInt32LE(t.CENCRC),c=v.readUInt32LE(t.CENSIZ),l=v.readUInt32LE(t.CENLEN),u=v.readUInt16LE(t.CENNAM),f=v.readUInt16LE(t.CENEXT),p=v.readUInt16LE(t.CENCOM),d=v.readUInt16LE(t.CENDSK),h=v.readUInt16LE(t.CENATT),m=v.readUInt32LE(t.CENATX),g=v.readUInt32LE(t.CENOFF)},localHeaderToBinary:function(){var e=Buffer.alloc(t.LOCHDR);return e.writeUInt32LE(t.LOCSIG,0),e.writeUInt16LE(r,t.LOCVER),e.writeUInt16LE(i,t.LOCFLG),e.writeUInt16LE(o,t.LOCHOW),e.writeUInt32LE(s,t.LOCTIM),e.writeUInt32LE(a,t.LOCCRC),e.writeUInt32LE(c,t.LOCSIZ),e.writeUInt32LE(l,t.LOCLEN),e.writeUInt16LE(u,t.LOCNAM),e.writeUInt16LE(v.extraLen,t.LOCEXT),e},centralHeaderToBinary:function(){var e=Buffer.alloc(t.CENHDR+u+f+p);return e.writeUInt32LE(t.CENSIG,0),e.writeUInt16LE(n,t.CENVEM),e.writeUInt16LE(r,t.CENVER),e.writeUInt16LE(i,t.CENFLG),e.writeUInt16LE(o,t.CENHOW),e.writeUInt32LE(s,t.CENTIM),e.writeUInt32LE(a,t.CENCRC),e.writeUInt32LE(c,t.CENSIZ),e.writeUInt32LE(l,t.CENLEN),e.writeUInt16LE(u,t.CENNAM),e.writeUInt16LE(f,t.CENEXT),e.writeUInt16LE(p,t.CENCOM),e.writeUInt16LE(d,t.CENDSK),e.writeUInt16LE(h,t.CENATT),e.writeUInt32LE(m,t.CENATX),e.writeUInt32LE(g,t.CENOFF),e},toJSON:function(){const s=function(e){return e+" bytes"};return{made:n,version:r,flags:i,method:e.methodToString(o),time:this.time,crc:"0x"+a.toString(16).toUpperCase(),compressedSize:s(c),size:s(l),fileNameLength:s(u),extraLength:s(f),commentLength:s(p),diskNumStart:d,inAttr:h,attr:m,offset:g,centralHeaderSize:s(t.CENHDR+u+f+p)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}function _n(){return Sn||(Sn=1,Cn.EntryHeader=In(),Cn.MainHeader=function(){if(Ln)return wn;Ln=1;var e=yn(),t=e.Constants;return wn=function(){var n=0,r=0,i=0,o=0,s=0;return{get diskEntries(){return n},set diskEntries(e){n=r=e},get totalEntries(){return r},set totalEntries(e){r=n=e},get size(){return i},set size(e){i=e},get offset(){return o},set offset(e){o=e},get commentLength(){return s},set commentLength(e){s=e},get mainHeaderSize(){return t.ENDHDR+s},loadFromBinary:function(a){if((a.length!==t.ENDHDR||a.readUInt32LE(0)!==t.ENDSIG)&&(a.length<t.ZIP64HDR||a.readUInt32LE(0)!==t.ZIP64SIG))throw e.Errors.INVALID_END();a.readUInt32LE(0)===t.ENDSIG?(n=a.readUInt16LE(t.ENDSUB),r=a.readUInt16LE(t.ENDTOT),i=a.readUInt32LE(t.ENDSIZ),o=a.readUInt32LE(t.ENDOFF),s=a.readUInt16LE(t.ENDCOM)):(n=e.readBigUInt64LE(a,t.ZIP64SUB),r=e.readBigUInt64LE(a,t.ZIP64TOT),i=e.readBigUInt64LE(a,t.ZIP64SIZE),o=e.readBigUInt64LE(a,t.ZIP64OFF),s=0)},toBinary:function(){var e=Buffer.alloc(t.ENDHDR+s);return e.writeUInt32LE(t.ENDSIG,0),e.writeUInt32LE(0,4),e.writeUInt16LE(n,t.ENDSUB),e.writeUInt16LE(r,t.ENDTOT),e.writeUInt32LE(i,t.ENDSIZ),e.writeUInt32LE(o,t.ENDOFF),e.writeUInt16LE(s,t.ENDCOM),e.fill(" ",t.ENDHDR),e},toJSON:function(){return{diskEntries:n,totalEntries:r,size:i+" bytes",offset:function(e,t){let n=e.toString(16).toUpperCase();for(;n.length<t;)n="0"+n;return"0x"+n}(o,4),commentLength:s}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}()),Cn}var Dn,Nn,On,An,Pn,Tn,Rn,xn,$n,Fn,kn,Un,Bn,Mn={};function Gn(){if(Tn)return Pn;Tn=1;const{randomFillSync:e}=k,t=vn(),n=new Uint32Array(256).map((e,t)=>{for(let e=0;e<8;e++)1&t?t=t>>>1^3988292384:t>>>=1;return t>>>0}),r=(e,t)=>Math.imul(e,t)>>>0,i=(e,t)=>n[255&(e^t)]^e>>>8,o=()=>"function"==typeof e?e(Buffer.alloc(12)):o.node();o.node=()=>{const e=Buffer.alloc(12),t=e.length;for(let n=0;n<t;n++)e[n]=256*Math.random()&255;return e};const s={genSalt:o};function a(e){const t=Buffer.isBuffer(e)?e:Buffer.from(e);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let e=0;e<t.length;e++)this.updateKeys(t[e])}return a.prototype.updateKeys=function(e){const t=this.keys;return t[0]=i(t[0],e),t[1]+=255&t[0],t[1]=r(t[1],134775813)+1,t[2]=i(t[2],t[1]>>>24),e},a.prototype.next=function(){const e=(2|this.keys[2])>>>0;return r(e,1^e)>>8&255},Pn={decrypt:function(e,n,r){if(!e||!Buffer.isBuffer(e)||e.length<12)return Buffer.alloc(0);const i=function(e){const t=new a(e);return function(e){const n=Buffer.alloc(e.length);let r=0;for(let i of e)n[r++]=t.updateKeys(i^t.next());return n}}(r),o=i(e.slice(0,12)),s=8&~n.flags?n.crc>>>24:n.timeHighByte;if(o[11]!==s)throw t.WRONG_PASSWORD();return i(e.slice(12))},encrypt:function(e,t,n,r=!1){null==e&&(e=Buffer.alloc(0)),Buffer.isBuffer(e)||(e=Buffer.from(e.toString()));const i=function(e){const t=new a(e);return function(e,n,r=0){n||(n=Buffer.alloc(e.length));for(let i of e){const e=t.next();n[r++]=i^e,t.updateKeys(i)}return n}}(n),o=s.genSalt();o[11]=t.crc>>>24&255,r&&(o[10]=t.crc>>>16&255);const c=Buffer.alloc(e.length+12);return i(o,c),i(e,c,12)},_salter:function(e){Buffer.isBuffer(e)&&e.length>=12?s.genSalt=function(){return e.slice(0,12)}:s.genSalt="node"===e?o.node:o}}}function jn(){return Rn||(Rn=1,Mn.Deflater=Nn?Dn:(Nn=1,Dn=function(e){var t=F,n={chunkSize:1024*(parseInt(e.length/1024)+1)};return{deflate:function(){return t.deflateRawSync(e,n)},deflateAsync:function(r){var i=t.createDeflateRaw(n),o=[],s=0;i.on("data",function(e){o.push(e),s+=e.length}),i.on("end",function(){var e=Buffer.alloc(s),t=0;e.fill(0);for(var n=0;n<o.length;n++){var i=o[n];i.copy(e,t),t+=i.length}r&&r(e)}),i.end(e)}}}),Mn.Inflater=function(){if(An)return On;An=1;const e=+(process.versions?process.versions.node:"").split(".")[0]||0;return On=function(t,n){var r=F;const i=e>=15&&n>0?{maxOutputLength:n}:{};return{inflate:function(){return r.inflateRawSync(t,i)},inflateAsync:function(e){var n=r.createInflateRaw(i),o=[],s=0;n.on("data",function(e){o.push(e),s+=e.length}),n.on("end",function(){var t=Buffer.alloc(s),n=0;t.fill(0);for(var r=0;r<o.length;r++){var i=o[r];i.copy(t,n),n+=i.length}e&&e(t)}),n.end(t)}}}}(),Mn.ZipCrypto=Gn()),Mn}function zn(){if($n)return xn;$n=1;var e=yn(),t=_n(),n=e.Constants,r=jn();return xn=function(i,o){var s=new t.EntryHeader,a=Buffer.alloc(0),c=Buffer.alloc(0),l=!1,u=null,f=Buffer.alloc(0),p=Buffer.alloc(0),d=!0;const h=i,m="object"==typeof h.decoder?h.decoder:e.decoder;function g(){return o&&o instanceof Uint8Array?(p=s.loadLocalHeaderFromBinary(o),o.slice(s.realDataOffset,s.realDataOffset+s.compressedSize)):Buffer.alloc(0)}function v(t){if(s.flags_desc){const r={},i=s.realDataOffset+s.compressedSize;if(o.readUInt32LE(i)==n.LOCSIG||o.readUInt32LE(i)==n.CENSIG)throw e.Errors.DESCRIPTOR_NOT_EXIST();if(o.readUInt32LE(i)==n.EXTSIG)r.crc=o.readUInt32LE(i+n.EXTCRC),r.compressedSize=o.readUInt32LE(i+n.EXTSIZ),r.size=o.readUInt32LE(i+n.EXTLEN);else{if(19280!==o.readUInt16LE(i+12))throw e.Errors.DESCRIPTOR_UNKNOWN();r.crc=o.readUInt32LE(i+n.EXTCRC-4),r.compressedSize=o.readUInt32LE(i+n.EXTSIZ-4),r.size=o.readUInt32LE(i+n.EXTLEN-4)}if(r.compressedSize!==s.compressedSize||r.size!==s.size||r.crc!==s.crc)throw e.Errors.DESCRIPTOR_FAULTY();if(e.crc32(t)!==r.crc)return!1}else if(e.crc32(t)!==s.localHeader.crc)return!1;return!0}function y(t,n,i){if(void 0===n&&"string"==typeof t&&(i=t,t=void 0),l)return t&&n&&n(Buffer.alloc(0),e.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var o=g();if(0===o.length)return t&&n&&n(o),o;if(s.encrypted){if("string"!=typeof i&&!Buffer.isBuffer(i))throw e.Errors.INVALID_PASS_PARAM();o=r.ZipCrypto.decrypt(o,s,i)}var c=Buffer.alloc(s.size);switch(s.method){case e.Constants.STORED:if(o.copy(c),v(c))return t&&n&&n(c),c;throw t&&n&&n(c,e.Errors.BAD_CRC()),e.Errors.BAD_CRC();case e.Constants.DEFLATED:var u=new r.Inflater(o,s.size);if(!t){if(u.inflate(c).copy(c,0),!v(c))throw e.Errors.BAD_CRC(`"${m.decode(a)}"`);return c}u.inflateAsync(function(t){t.copy(t,0),n&&(v(t)?n(t):n(t,e.Errors.BAD_CRC()))});break;default:throw t&&n&&n(Buffer.alloc(0),e.Errors.UNKNOWN_METHOD()),e.Errors.UNKNOWN_METHOD()}}function E(t,n){if((!u||!u.length)&&Buffer.isBuffer(o))return t&&n&&n(g()),g();if(u.length&&!l){var i;switch(s.method){case e.Constants.STORED:return s.compressedSize=s.size,i=Buffer.alloc(u.length),u.copy(i),t&&n&&n(i),i;default:case e.Constants.DEFLATED:var a=new r.Deflater(u);if(!t){var c=a.deflate();return s.compressedSize=c.length,c}a.deflateAsync(function(e){i=Buffer.alloc(e.length),s.compressedSize=e.length,e.copy(i),n&&n(i)}),a=null}}else{if(!t||!n)return Buffer.alloc(0);n(Buffer.alloc(0))}}function b(e,t){return(e.readUInt32LE(t+4)<<4)+e.readUInt32LE(t)}function w(e){var t,r,i,o;e.length>=n.EF_ZIP64_SCOMP&&(t=b(e,n.EF_ZIP64_SUNCOMP),s.size===n.EF_ZIP64_OR_32&&(s.size=t)),e.length>=n.EF_ZIP64_RHO&&(r=b(e,n.EF_ZIP64_SCOMP),s.compressedSize===n.EF_ZIP64_OR_32&&(s.compressedSize=r)),e.length>=n.EF_ZIP64_DSN&&(i=b(e,n.EF_ZIP64_RHO),s.offset===n.EF_ZIP64_OR_32&&(s.offset=i)),e.length>=n.EF_ZIP64_DSN+4&&(o=e.readUInt32LE(n.EF_ZIP64_DSN),s.diskNumStart===n.EF_ZIP64_OR_16&&(s.diskNumStart=o))}return d=!!m.hasOwnProperty("efs")&&m.efs,{get entryName(){return m.decode(a)},get rawEntryName(){return a},set entryName(t){var n=(a=e.toBuffer(t,m.encode))[a.length-1];l=47===n||92===n,s.fileNameLength=a.length},get efs(){return"function"==typeof d?d(this.entryName):d},get extra(){return f},set extra(t){f=t,s.extraLength=t.length,function(t){try{for(var r,i,o,s=0;s+4<t.length;)r=t.readUInt16LE(s),s+=2,i=t.readUInt16LE(s),s+=2,o=t.slice(s,s+i),s+=i,n.ID_ZIP64===r&&w(o)}catch(t){throw e.Errors.EXTRA_FIELD_PARSE_ERROR()}}(t)},get comment(){return m.decode(c)},set comment(t){if(c=e.toBuffer(t,m.encode),s.commentLength=c.length,c.length>65535)throw e.Errors.COMMENT_TOO_LONG()},get name(){var e=m.decode(a);return l?e.substr(e.length-1).split("/").pop():e.split("/").pop()},get isDirectory(){return l},getCompressedData:function(){return E(!1,null)},getCompressedDataAsync:function(e){E(!0,e)},setData:function(t){u=e.toBuffer(t,e.decoder.encode),!l&&u.length?(s.size=u.length,s.method=e.Constants.DEFLATED,s.crc=e.crc32(t),s.changed=!0):s.method=e.Constants.STORED},getData:function(e){return s.changed?u:y(!1,null,e)},getDataAsync:function(e,t){s.changed?e(u):y(!0,e,t)},set attr(e){s.attr=e},get attr(){return s.attr},set header(e){s.loadFromBinary(e)},get header(){return s},packCentralHeader:function(){s.flags_efs=this.efs,s.extraLength=f.length;var t=s.centralHeaderToBinary(),n=e.Constants.CENHDR;return a.copy(t,n),n+=a.length,f.copy(t,n),n+=s.extraLength,c.copy(t,n),t},packLocalHeader:function(){let e=0;s.flags_efs=this.efs,s.extraLocalLength=p.length;const t=s.localHeaderToBinary(),n=Buffer.alloc(t.length+a.length+s.extraLocalLength);return t.copy(n,e),e+=t.length,a.copy(n,e),e+=a.length,p.copy(n,e),e+=p.length,n},toJSON:function(){const e=function(e){return"<"+(e&&e.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:s.toJSON(),compressedData:e(o),data:e(u)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}},xn}function Hn(){if(kn)return Fn;kn=1;const e=zn(),t=_n(),n=yn();return Fn=function(r,i){var o=[],s={},a=Buffer.alloc(0),c=new t.MainHeader,l=!1;const u=new Set,f=i,{noSort:p,decoder:d}=f;function h(){if(l=!0,s={},c.diskEntries>(r.length-c.offset)/n.Constants.CENHDR)throw n.Errors.DISK_ENTRY_TOO_LARGE();o=new Array(c.diskEntries);for(var t=c.offset,i=0;i<o.length;i++){var a=t,p=new e(f,r);p.header=r.slice(a,a+=n.Constants.CENHDR),p.entryName=r.slice(a,a+=p.header.fileNameLength),p.header.extraLength&&(p.extra=r.slice(a,a+=p.header.extraLength)),p.header.commentLength&&(p.comment=r.slice(a,a+p.header.commentLength)),t+=p.header.centralHeaderSize,o[i]=p,s[p.entryName]=p}u.clear(),function(){const t=new Set;for(const e of Object.keys(s)){const n=e.split("/");if(n.pop(),n.length)for(let e=0;e<n.length;e++){const r=n.slice(0,e+1).join("/")+"/";t.add(r)}}for(const n of t)if(!(n in s)){const t=new e(f);t.entryName=n,t.attr=16,t.temporary=!0,o.push(t),s[t.entryName]=t,u.add(t)}}()}function m(){o.length>1&&!p&&o.sort((e,t)=>e.entryName.toLowerCase().localeCompare(t.entryName.toLowerCase()))}return r?function(e){var t=r.length-n.Constants.ENDHDR,i=Math.max(0,t-65535),o=i,s=r.length,l=-1,u=0;"boolean"==typeof f.trailingSpace&&f.trailingSpace&&(i=0);for(;t>=o;t--)if(80===r[t])if(r.readUInt32LE(t)!==n.Constants.ENDSIG)if(r.readUInt32LE(t)!==n.Constants.END64SIG){if(r.readUInt32LE(t)===n.Constants.ZIP64SIG){l=t,s=t+n.readBigUInt64LE(r,t+n.Constants.ZIP64SIZE)+n.Constants.ZIP64LEAD;break}}else o=i;else l=t,u=t,s=t+n.Constants.ENDHDR,o=t-n.Constants.END64HDR;if(-1==l)throw n.Errors.INVALID_FORMAT();c.loadFromBinary(r.slice(l,s)),c.commentLength&&(a=r.slice(u+n.Constants.ENDHDR));e&&h()}(f.readEntries):l=!0,{get entries(){return l||h(),o.filter(e=>!u.has(e))},get comment(){return d.decode(a)},set comment(e){a=n.toBuffer(e,d.encode),c.commentLength=a.length},getEntryCount:function(){return l?o.length:c.diskEntries},forEach:function(e){this.entries.forEach(e)},getEntry:function(e){return l||h(),s[e]||null},setEntry:function(e){l||h(),o.push(e),s[e.entryName]=e,c.totalEntries=o.length},deleteFile:function(e,t=!0){l||h();const n=s[e];this.getEntryChildren(n,t).map(e=>e.entryName).forEach(this.deleteEntry)},deleteEntry:function(e){l||h();const t=s[e],n=o.indexOf(t);n>=0&&(o.splice(n,1),delete s[e],c.totalEntries=o.length)},getEntryChildren:function(e,t=!0){if(l||h(),"object"==typeof e){if(e.isDirectory&&t){const t=[],n=e.entryName;for(const e of o)e.entryName.startsWith(n)&&t.push(e);return t}return[e]}return[]},getChildCount:function(e){if(e&&e.isDirectory){const t=this.getEntryChildren(e);return t.includes(e)?t.length-1:t.length}return 0},compressToBuffer:function(){l||h(),m();const e=[],t=[];let i=0,o=0;c.size=0,c.offset=0;let s=0;for(const n of this.entries){const r=n.getCompressedData();n.header.offset=o;const a=n.packLocalHeader(),l=a.length+r.length;o+=l,e.push(a),e.push(r);const u=n.packCentralHeader();t.push(u),c.size+=u.length,i+=l+u.length,s++}i+=c.mainHeaderSize,c.offset=o,c.totalEntries=s,o=0;const u=Buffer.alloc(i);for(const t of e)t.copy(u,o),o+=t.length;for(const e of t)e.copy(u,o),o+=e.length;const f=c.toBinary();return a&&a.copy(f,n.Constants.ENDHDR),f.copy(u,o),r=u,l=!1,u},toAsyncBuffer:function(e,t,i,o){try{l||h(),m();const t=[],s=[];let u=0,f=0,p=0;c.size=0,c.offset=0;const d=function(h){if(h.length>0){const e=h.shift(),n=e.entryName+e.extra.toString();i&&i(n),e.getCompressedDataAsync(function(r){o&&o(n),e.header.offset=f;const i=e.packLocalHeader(),a=i.length+r.length;f+=a,t.push(i),t.push(r);const l=e.packCentralHeader();s.push(l),c.size+=l.length,u+=a+l.length,p++,d(h)})}else{u+=c.mainHeaderSize,c.offset=f,c.totalEntries=p,f=0;const i=Buffer.alloc(u);t.forEach(function(e){e.copy(i,f),f+=e.length}),s.forEach(function(e){e.copy(i,f),f+=e.length});const o=c.toBinary();a&&a.copy(o,n.Constants.ENDHDR),o.copy(i,f),r=i,l=!1,e(i)}};d(Array.from(this.entries))}catch(e){t(e)}}}},Fn}var qn=function(){if(Bn)return Un;Bn=1;const e=yn(),t=$,n=zn(),r=Hn(),i=(...t)=>e.findLast(t,e=>"boolean"==typeof e),o=(...t)=>e.findLast(t,e=>"string"==typeof e),s={noSort:!1,readEntries:!1,method:e.Constants.NONE,fs:null};return Un=function(a,c){let l=null;const u=Object.assign(Object.create(null),s);a&&"object"==typeof a&&(a instanceof Uint8Array||(Object.assign(u,a),a=u.input?u.input:void 0,u.input&&delete u.input),Buffer.isBuffer(a)&&(l=a,u.method=e.Constants.BUFFER,a=void 0)),Object.assign(u,c);const f=new e(u);if("object"==typeof u.decoder&&"function"==typeof u.decoder.encode&&"function"==typeof u.decoder.decode||(u.decoder=e.decoder),a&&"string"==typeof a){if(!f.fs.existsSync(a))throw e.Errors.INVALID_FILENAME();u.method=e.Constants.FILE,u.filename=a,l=f.fs.readFileSync(a)}const p=new r(l,u),{canonical:d,sanitize:h,zipnamefix:m}=e;function g(e){var n;if(e&&p&&("string"==typeof e&&(n=p.getEntry(t.posix.normalize(e))),"object"==typeof e&&void 0!==e.entryName&&void 0!==e.header&&(n=p.getEntry(e.entryName)),n))return n;return null}function v(e){const{join:n,normalize:r,sep:i}=t.posix;return n(".",r(i+e.split("\\").join(i)+i))}function y(e){return e instanceof RegExp?(t=e,function(e){return t.test(e)}):"function"!=typeof e?()=>!0:e;var t}const E=(e,n)=>{let r=n.slice(-1);return r=r===f.sep?f.sep:"",t.relative(e,n)+r};return{readFile:function(e,t){var n=g(e);return n&&n.getData(t)||null},childCount:function(e){const t=g(e);if(t)return p.getChildCount(t)},readFileAsync:function(e,t){var n=g(e);n?n.getDataAsync(t):t(null,"getEntry failed for:"+e)},readAsText:function(e,t){var n=g(e);if(n){var r=n.getData();if(r&&r.length)return r.toString(t||"utf8")}return""},readAsTextAsync:function(e,t,n){var r=g(e);r?r.getDataAsync(function(e,r){r?t(e,r):e&&e.length?t(e.toString(n||"utf8")):t("")}):t("")},deleteFile:function(e,t=!0){var n=g(e);n&&p.deleteFile(n.entryName,t)},deleteEntry:function(e){var t=g(e);t&&p.deleteEntry(t.entryName)},addZipComment:function(e){p.comment=e},getZipComment:function(){return p.comment||""},addZipEntryComment:function(e,t){var n=g(e);n&&(n.comment=t)},getZipEntryComment:function(e){var t=g(e);return t&&t.comment||""},updateFile:function(e,t){var n=g(e);n&&n.setData(t)},addLocalFile:function(n,r,i,o){if(!f.fs.existsSync(n))throw e.Errors.FILE_NOT_FOUND(n);{r=r?v(r):"";const e=t.win32.basename(t.win32.normalize(n));r+=i||e;const s=f.fs.statSync(n),a=s.isFile()?f.fs.readFileSync(n):Buffer.alloc(0);s.isDirectory()&&(r+=f.sep),this.addFile(r,a,o,s)}},addLocalFileAsync:function(e,n){e="object"==typeof e?e:{localPath:e};const r=t.resolve(e.localPath),{comment:i}=e;let{zipPath:o,zipName:s}=e;const a=this;f.fs.stat(r,function(e,c){if(e)return n(e,!1);o=o?v(o):"";const l=t.win32.basename(t.win32.normalize(r));if(o+=s||l,c.isFile())f.fs.readFile(r,function(e,t){return e?n(e,!1):(a.addFile(o,t,i,c),setImmediate(n,void 0,!0))});else if(c.isDirectory())return o+=f.sep,a.addFile(o,Buffer.alloc(0),i,c),setImmediate(n,void 0,!0)})},addLocalFolder:function(n,r,i){if(i=y(i),r=r?v(r):"",n=t.normalize(n),!f.fs.existsSync(n))throw e.Errors.FILE_NOT_FOUND(n);{const e=f.findFiles(n),o=this;if(e.length)for(const s of e){const e=t.join(r,E(n,s));i(e)&&o.addLocalFile(s,t.dirname(e))}}},addLocalFolderAsync:function(n,r,i,o){o=y(o),i=i?v(i):"",n=t.normalize(n);var s=this;f.fs.open(n,"r",function(t){if(t&&"ENOENT"===t.code)r(void 0,e.Errors.FILE_NOT_FOUND(n));else if(t)r(void 0,t);else{var a=f.findFiles(n),c=-1,l=function(){if((c+=1)<a.length){var e=a[c],t=E(n,e).split("\\").join("/");t=t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),o(t)?f.fs.stat(e,function(n,o){n&&r(void 0,n),o.isFile()?f.fs.readFile(e,function(e,n){e?r(void 0,e):(s.addFile(i+t,n,"",o),l())}):(s.addFile(i+t+"/",Buffer.alloc(0),"",o),l())}):process.nextTick(()=>{l()})}else r(!0,void 0)};l()}})},addLocalFolderAsync2:function(n,r){const i=this;n="object"==typeof n?n:{localPath:n},localPath=t.resolve(v(n.localPath));let{zipPath:o,filter:s,namefix:a}=n;var c;s instanceof RegExp?(c=s,s=function(e){return c.test(e)}):"function"!=typeof s&&(s=function(){return!0}),o=o?v(o):"","latin1"==a&&(a=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),"function"!=typeof a&&(a=e=>e);const l=e=>t.join(o,a(E(localPath,e))),u=e=>t.win32.basename(t.win32.normalize(a(e)));f.fs.open(localPath,"r",function(n){n&&"ENOENT"===n.code?r(void 0,e.Errors.FILE_NOT_FOUND(localPath)):n?r(void 0,n):f.findFilesAsync(localPath,function(e,n){if(e)return r(e);(n=n.filter(e=>s(l(e)))).length||r(void 0,!1),setImmediate(n.reverse().reduce(function(e,n){return function(r,o){if(r||!1===o)return setImmediate(e,r,!1);i.addLocalFileAsync({localPath:n,zipPath:t.dirname(l(n)),zipName:u(n)},e)}},r))})})},addLocalFolderPromise:function(e,t){return new Promise((n,r)=>{this.addLocalFolderAsync2(Object.assign({localPath:e},t),(e,t)=>{e&&r(e),t&&n(this)})})},addFile:function(e,t,r,i){let o=g(e=m(e));const s=null!=o;s||(o=new n(u),o.entryName=e),o.comment=r||"";const a="object"==typeof i&&i instanceof f.fs.Stats;a&&(o.header.time=i.mtime);var c=o.isDirectory?16:0;let l=o.isDirectory?16384:32768;return l|=a?4095&i.mode:"number"==typeof i?4095&i:o.isDirectory?493:420,c=(c|l<<16)>>>0,o.attr=c,o.setData(t),s||p.setEntry(o),o},getEntries:function(e){return p.password=e,p?p.entries:[]},getEntry:function(e){return g(e)},getEntryCount:function(){return p.getEntryCount()},forEach:function(e){return p.forEach(e)},extractEntryTo:function(n,r,s,a,c,l){a=i(!1,a),c=i(!1,c),s=i(!0,s),l=o(c,l);var u=g(n);if(!u)throw e.Errors.NO_ENTRY();var m=d(u.entryName),v=h(r,l&&!u.isDirectory?l:s?m:t.basename(m));if(u.isDirectory)return p.getEntryChildren(u).forEach(function(n){if(n.isDirectory)return;var i=n.getData();if(!i)throw e.Errors.CANT_EXTRACT_FILE();var o=d(n.entryName),l=h(r,s?o:t.basename(o));const u=c?n.header.fileAttr:void 0;f.writeFileTo(l,i,a,u)}),!0;var y=u.getData(p.password);if(!y)throw e.Errors.CANT_EXTRACT_FILE();if(f.fs.existsSync(v)&&!a)throw e.Errors.CANT_OVERRIDE();const E=c?n.header.fileAttr:void 0;return f.writeFileTo(v,y,a,E),!0},test:function(e){if(!p)return!1;for(var t in p.entries)try{if(t.isDirectory)continue;if(!p.entries[t].getData(e))return!1}catch(e){return!1}return!0},extractAllTo:function(t,n,r,s){if(r=i(!1,r),s=o(r,s),n=i(!1,n),!p)throw e.Errors.NO_ZIP();p.entries.forEach(function(i){var o=h(t,d(i.entryName));if(i.isDirectory)return void f.makeDir(o);var a=i.getData(s);if(!a)throw e.Errors.CANT_EXTRACT_FILE();const c=r?i.header.fileAttr:void 0;f.writeFileTo(o,a,n,c);try{f.fs.utimesSync(o,i.header.time,i.header.time)}catch(t){throw e.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(n,r,o,s){if(s=((...t)=>e.findLast(t,e=>"function"==typeof e))(r,o,s),o=i(!1,o),r=i(!1,r),!s)return new Promise((e,t)=>{this.extractAllToAsync(n,r,o,function(n){n?t(n):e(this)})});if(!p)return void s(e.Errors.NO_ZIP());n=t.resolve(n);const a=e=>h(n,t.normalize(d(e.entryName))),c=(e,t)=>new Error(e+': "'+t+'"'),l=[],u=[];p.entries.forEach(e=>{e.isDirectory?l.push(e):u.push(e)});for(const e of l){const t=a(e),n=o?e.header.fileAttr:void 0;try{f.makeDir(t),n&&f.fs.chmodSync(t,n),f.fs.utimesSync(t,e.header.time,e.header.time)}catch(e){s(c("Unable to create folder",t))}}u.reverse().reduce(function(i,s){return function(a){if(a)i(a);else{const a=t.normalize(d(s.entryName)),l=h(n,a);s.getDataAsync(function(t,n){if(n)i(n);else if(t){const e=o?s.header.fileAttr:void 0;f.writeFileToAsync(l,t,r,e,function(e){e||i(c("Unable to write file",l)),f.fs.utimes(l,s.header.time,s.header.time,function(e){e?i(c("Unable to set times",l)):i()})})}else i(e.Errors.CANT_EXTRACT_FILE())})}}},s)()},writeZip:function(e,t){if(1===arguments.length&&"function"==typeof e&&(t=e,e=""),!e&&u.filename&&(e=u.filename),e){var n=p.compressToBuffer();if(n){var r=f.writeFileTo(e,n,!0);"function"==typeof t&&t(r?null:new Error("failed"),"")}}},writeZipPromise:function(e,t){const{overwrite:n,perm:r}=Object.assign({overwrite:!0},t);return new Promise((t,i)=>{!e&&u.filename&&(e=u.filename),e||i("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(o=>{f.writeFileToAsync(e,o,n,r,e=>e?t(e):i("ADM-ZIP: Wasn't able to write zip file"))},i)})},toBufferPromise:function(){return new Promise((e,t)=>{p.toAsyncBuffer(e,t)})},toBuffer:function(e,t,n,r){return"function"==typeof e?(p.toAsyncBuffer(e,t,n,r),null):p.compressToBuffer()}}},Un}(),Vn=de(qn);class Wn{#K;get ora(){return this.#K}set attachConsole(e){e?(console.log=this.info.bind(this),console.info=this.info.bind(this)):console=Kn}static Global(e){return Yn=new Wn(e),Yn}static Clone(e){const{prefixText:t}=e||Yn;return new Wn({prefixText:t})}static get Current(){return Yn}static set Current(e){Yn=e}constructor(e){this.#K=U(e)}get prefixText(){return this.#K.prefixText}info(...e){this.#K.info(Zn(e))}succeed(...e){this.#K.succeed(Zn(e))}start(...e){this.#K.start(Zn(e))}fail(...e){this.#K.fail(Zn(e))}warn(...e){this.#K.warn(Zn(e))}clear(){this.#K.clear()}stop(){this.#K.stop()}stopAndPersist(...e){this.#K.stopAndPersist(...e)}}let Yn=new Wn;const Zn=e=>e.length?e.join(" "):void 0,Kn=console;class Xn{spinner;debugMode;constructor(e,t){this.spinner=new Wn({prefixText:e}),this.debugMode=t?.debug??!1}start(...e){this.spinner.start(...e)}succeed(...e){this.spinner.succeed(...e)}fail(...e){this.spinner.fail(...e)}error(...e){console.log(...e)}warn(...e){this.spinner.warn(...e)}info(...e){this.spinner.info(...e)}log(...e){this.spinner.info(...e)}debug(...e){this.debugMode&&console.debug(...e)}startNativeConsoleCapture(){this.spinner.attachConsole=!0}stopNativeConsoleCapture(){this.spinner.attachConsole=!1}}const Jn=e=>({portal:"object"==typeof e.spa?.templateEnv?e.spa.templateEnv.portal:void 0,msal:"object"==typeof e.spa?.templateEnv?e.spa.templateEnv.msal:void 0,proxy:"object"==typeof e.spa?.templateEnv?e.spa.templateEnv.serviceWorker?.resources:void 0,serviceDiscoveryUrl:e.api.serviceDiscoveryUrl,routes:e.api.routes}),Qn=e=>{const t={spa:{templateEnv:(n=e.template,{portal:{id:"@equinor/fusion-framework-dev-portal"},title:"Fusion Dev Portal",serviceDiscovery:{url:"/@fusion-services",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]},msal:{clientId:"9b707e3a-3e90-41ed-a47e-652a1e3b53d0",tenantId:"3aa4a235-b6e2-48d5-9195-7fcf05b459b0",redirectUri:"/authentication/login-callback",requiresAuth:"true"},serviceWorker:{resources:[{url:"/apps-proxy",rewrite:"/@fusion-api/apps",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]},{url:"/help-proxy",rewrite:"/@fusion-api/help",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]},{url:"/portal-proxy",rewrite:"/@fusion-api/portal-config",scopes:["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]}]},...n})},api:{serviceDiscoveryUrl:"https://discovery.fusion.equinor.com/service-registry/environments/ci/services/",processServices:(e,t)=>{const{data:n,routes:r}=M(e,t);return{data:n.concat({key:"portals",name:"Portal Service - MOCK",uri:"/@fusion-api/portals"}),routes:r}}}};var n;return e.app&&((e,t,n)=>{const{build:r,appKey:i}=t;if(!r)throw new Error("App manifest does not contain build information");e.api.routes??=[],e.api.routes.push({match:[`/apps/bundles/apps/${i}/${r.version}/*path`,`/apps/bundles/apps/${i}@${r.version}/*path`],middleware:async(e,t,n)=>{const r=e.params?.path;!1===Array.isArray(r)&&n(),t.writeHead(302,{"content-type":"application/javascript",location:`/${r.join("/")}`}),t.end()}}),e.api.routes.push({match:`/apps/persons/me/apps/${i}`,middleware:async(e,n)=>{n.writeHead(200,{"content-type":"application/json"}),n.end(JSON.stringify({id:"dev-server-generated-id",...t}))}}),e.api.routes.push({match:`/apps/apps/${i}/builds/${r.version}/config`,middleware:async(e,t)=>{t.writeHead(200,{"content-type":"application/json"}),t.end(JSON.stringify(n))}})})(t,e.app.manifest,e.app.config),e.portal&&((e,t,n)=>{e.api.routes??=[];const r="portal-config";e.api.routes.push({match:`/${r}/portals/${t.name}{@:tag}`,middleware:async(e,n)=>{n.writeHead(200,{"content-type":"application/json"}),n.end(JSON.stringify(t))}}),n&&e.api.routes.push({match:`/${r}/portals/${t.name}{@:tag}/config`,middleware:async(e,t)=>{t.writeHead(200,{"content-type":"application/json"}),t.end(JSON.stringify(n))}})})(t,e.portal.manifest,e.portal.config),t},er=async(e,t,n)=>{const{overrides:r,log:i}=n??{},o=Qn(t);i?.debug("\nBase dev server config:",Jn(o)),i?.debug("\nCreating dev server with overrides:",r);try{const{path:t,config:n}=await(async(e,t,n)=>C("dev-server.config",{baseDir:e.root,extensions:n?.extensions,script:{resolve:async n=>{let r;if("function"==typeof n.default){const i={...t};r=await n.default(e,{base:i})}else r=n.default;return Pt(t,r??{})}}}))(e,o);return i?.debug(`\nLoaded dev server config from ${t}`),i?.debug("\nLoaded dev server config:",Jn(n)),B(n,r)}catch(e){return i?.warn("\nFailed to load dev server config:",e instanceof Error?e.message:String(e)),B(o,r)}},tr="fusion-framework-cli",nr={"X-Fusion-CLI-Name":tr,"X-Fusion-CLI-Version":kt,"User-Agent":`${tr}/${kt}`},rr=(e,t,n)=>{const r=i(String(e));E(r)||b(r,{recursive:!0}),w(e,t,n)},ir=["package.json","LICENSE.md","README.md","CHANGELOG.md"],or=async(e,t)=>{const{archive:n,log:r}=t??{},s=i(e.path),a=t?.buildDir??"dist",c=o(s,a);if(!(await L(c)).isDirectory())throw new Error(`Build directory ${a} does not exist`);r?.log(pe.bold("Starting to pack bundle"));const l=new Vn;if(l.addLocalFolder(c,a),t?.content)for(const[e,n]of Object.entries(t.content))l.addFile(e,Buffer.from(n)),r?.info("📄",Xt(e,{relative:!0}));r?.info("📂",Xt(c,{relative:!0}));for(const t of ir.concat(e.packageJson.files??[])){const e=o(s,t),n=i(e.replace(s,""));Nt(e)?(l.addLocalFile(e,n),r?.info("📄",Xt(e,{relative:!0}))):r?.warn(pe.dim("📄",Xt(e,{relative:!0})))}return n&&(Nt(i(n))||await S(i(n),{recursive:!0}),r?.start("compressing content"),await l.writeZipPromise(n),r?.succeed("📚",Xt(n,{relative:!0}),Jt(n))),l},sr=async e=>{const{log:t,manifest:n,snapshot:r}=e;process.env.NODE_ENV,process.cwd();const{pkg:i,manifest:o}=await nn({log:t,manifest:n,snapshot:r});if(!o.build)throw new Error("Manifest build config not found");return{archive:await or(i,{log:t,archive:e?.archive,content:{"app-manifest.json":JSON.stringify(o.build,null,2),"metadata.json":JSON.stringify({name:o.appKey,version:o.build.version})}}).catch(e=>{t?.error("Failed to create package:",e),process.exit(1)}),manifest:o}},ar=async(e,t)=>{const{log:n}=t;try{n?.start("create application configuration"),n?.info(`generating config with ${pe.red.dim(e.command)} command in ${pe.green.dim(e.mode)} mode`);const r=await((e,t)=>{const n=t?.file??[`app.config.${e.environment}`,"app.config"];return C(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async n=>{const r=t?.base??{environment:{}};if("function"==typeof n.default){const t=await n.default(e,{base:r})??r;return jt.parse(t??r)}return jt.parse(n.default??r)}}})})(e,{file:t?.config});return n?.succeed("⚙️ generated config from ",Xt(r.path,{relative:!0})),r.config}catch(e){if(e instanceof I){if(!t.config)return n?.succeed(pe.dim("⚙️ no local application config applied, using built-in")),{environment:{}};n?.warn(`failed to load config file ${Xt(t.config)}, please check the path.`)}throw n?.fail("failed to resolve application config"),n?.debug(e),e}},cr=async e=>{const{log:t}=e??{},n=await en(t),r={command:"build",mode:process.env.NODE_ENV??"production",root:n.root,...e?.env},i=await ar(r,{log:t,config:e?.config});if(t?.debug("config:",i),e?.output){t?.start("writing config to file");try{await rr(e.output,JSON.stringify(i,null,2)),t?.succeed("config written successfully",Xt(e.output,{relative:!0}))}catch(e){throw t?.fail("failed to write config"),e}}return{config:i,pkg:n}};class lr extends Error{response;static Name="HttpResponseError";constructor(e,t,n){super(e,n),this.response=t}}class ur extends lr{static Name="HttpJsonResponseError";data;constructor(e,t,n){super(e,t,n),this.name=ur.Name,this.data=n?.data}}class fr extends lr{static Name="ServerSentEventResponseError";constructor(e,t,n){super(e,t,n),this.name=fr.Name}}class pr extends A{satisfies(e){return P(this,e)}}var dr=function(e,t){return dr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},dr(e,t)};function hr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}dr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var mr=function(){return mr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},mr.apply(this,arguments)};function gr(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function a(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((r=r.apply(e,t||[])).next())})}function vr(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function yr(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Er(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function br(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function wr(e){return this instanceof wr?(this.v=e,this):new wr(e)}function Lr(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",function(e){return function(t){return Promise.resolve(t).then(e,l)}}),r[Symbol.asyncIterator]=function(){return this},r;function s(e,t){i[e]&&(r[e]=function(t){return new Promise(function(n,r){o.push([e,t,n,r])>1||a(e,t)})},t&&(r[e]=t(r[e])))}function a(e,t){try{(n=i[e](t)).value instanceof wr?Promise.resolve(n.value.v).then(c,l):u(o[0][2],n)}catch(e){u(o[0][3],e)}var n}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function Sr(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=yr(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,i){(function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)})(r,i,(t=e[n](t)).done,t.value)})}}}function Cr(e){return"function"==typeof e}function Ir(e){var t=e(function(e){Error.call(e),e.stack=(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}"function"==typeof SuppressedError&&SuppressedError;var _r=Ir(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function Dr(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Nr=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=yr(o),a=s.next();!a.done;a=s.next()){a.value.remove(this)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var c=this.initialTeardown;if(Cr(c))try{c()}catch(e){i=e instanceof _r?e.errors:[e]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var u=yr(l),f=u.next();!f.done;f=u.next()){var p=f.value;try{Pr(p)}catch(e){i=null!=i?i:[],e instanceof _r?i=br(br([],Er(i)),Er(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}if(i)throw new _r(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Pr(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Dr(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&Dr(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),Or=Nr.EMPTY;function Ar(e){return e instanceof Nr||e&&"closed"in e&&Cr(e.remove)&&Cr(e.add)&&Cr(e.unsubscribe)}function Pr(e){Cr(e)?e():e.unsubscribe()}var Tr={Promise:void 0},Rr=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,br([e,t],Er(n)))};function xr(e){Rr(function(){throw e})}function $r(){}function Fr(e){e()}var kr=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Ar(t)&&t.add(n)):n.destination=Gr,n}return hr(t,e),t.create=function(e,t,n){return new Br(e,t,n)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Nr),Ur=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){Mr(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Mr(e)}else Mr(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Mr(e)}},e}(),Br=function(e){function t(t,n,r){var i,o=e.call(this)||this;return i=Cr(t)||!t?{next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:t,o.destination=new Ur(i),o}return hr(t,e),t}(kr);function Mr(e){xr(e)}var Gr={closed:!0,next:$r,error:function(e){throw e},complete:$r},jr="function"==typeof Symbol&&Symbol.observable||"@@observable";function zr(e){return e}var Hr=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=this,o=(r=e)&&r instanceof kr||function(e){return e&&Cr(e.next)&&Cr(e.error)&&Cr(e.complete)}(r)&&Ar(r)?e:new Br(e,t,n);return Fr(function(){var e=i,t=e.operator,n=e.source;o.add(t?t.call(o,n):n?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=qr(t))(function(t,r){var i=new Br({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[jr]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(0===(e=t).length?zr:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=qr(e))(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function qr(e){var t;return null!==(t=null!=e?e:Tr.Promise)&&void 0!==t?t:Promise}function Vr(e){return function(t){if(function(e){return Cr(null==e?void 0:e.lift)}(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw new TypeError("Unable to lift unknown Observable type")}}function Wr(e,t,n,r,i){return new Yr(e,t,n,r,i)}var Yr=function(e){function t(t,n,r,i,o,s){var a=e.call(this,t)||this;return a.onFinalize=o,a.shouldUnsubscribe=s,a._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return hr(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(kr),Zr=Ir(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Kr=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return hr(t,e),t.prototype.lift=function(e){var t=new Xr(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Zr},t.prototype.next=function(e){var t=this;Fr(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=yr(t.currentObservers),o=i.next();!o.done;o=i.next()){o.value.next(e)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var t=this;Fr(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;Fr(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?Or:(this.currentObservers=null,o.push(e),new Nr(function(){t.currentObservers=null,Dr(o,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new Hr;return e.source=this,e},t.create=function(e,t){return new Xr(e,t)},t}(Hr),Xr=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return hr(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:Or},t}(Kr),Jr=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return hr(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(Kr),Qr={now:function(){return(Qr.delegate||Date).now()},delegate:void 0},ei=function(e){function t(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=Qr);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return hr(t,e),t.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,s=n._timestampProvider,a=n._windowTime;r||(i.push(t),!o&&i.push(s.now()+a)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!e.closed;i+=n?1:2)e.next(r[i]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,n=e._timestampProvider,r=e._buffer,i=e._infiniteTimeWindow,o=(i?1:2)*t;if(t<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var s=n.now(),a=0,c=1;c<r.length&&r[c]<=s;c+=2)a=c;a&&r.splice(0,a+1)}},t}(Kr),ti=function(e){function t(t,n){return e.call(this)||this}return hr(t,e),t.prototype.schedule=function(e,t){return this},t}(Nr),ni=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,br([e,t],Er(n)))},ri=function(e){return clearInterval(e)},ii=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return hr(t,e),t.prototype.schedule=function(e,t){var n;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,t)),this.pending=!0,this.delay=t,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),ni(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&ri(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n,r=!1;try{this.work(e)}catch(e){r=!0,n=e||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Dr(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(ti),oi=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=Qr.now,e}(),si=function(e){function t(t,n){void 0===n&&(n=oi.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return hr(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var n;this._active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},t}(oi),ai=new si(ii),ci=ai,li=new Hr(function(e){return e.complete()});function ui(e){return e&&Cr(e.schedule)}function fi(e){return e[e.length-1]}var pi=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function di(e){return Cr(null==e?void 0:e.then)}function hi(e){return Cr(e[jr])}function mi(e){return Symbol.asyncIterator&&Cr(null==e?void 0:e[Symbol.asyncIterator])}function gi(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var vi="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function yi(e){return Cr(null==e?void 0:e[vi])}function Ei(e){return Lr(this,arguments,function(){var t,n,r;return vr(this,function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,wr(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,wr(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,wr(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function bi(e){return Cr(null==e?void 0:e.getReader)}function wi(e){if(e instanceof Hr)return e;if(null!=e){if(hi(e))return i=e,new Hr(function(e){var t=i[jr]();if(Cr(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(pi(e))return r=e,new Hr(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()});if(di(e))return n=e,new Hr(function(e){n.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,xr)});if(mi(e))return Li(e);if(yi(e))return t=e,new Hr(function(e){var n,r;try{for(var i=yr(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()});if(bi(e))return Li(Ei(e))}var t,n,r,i;throw gi(e)}function Li(e){return new Hr(function(t){(function(e,t){var n,r,i,o;return gr(this,void 0,void 0,function(){var s,a;return vr(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=Sr(e),c.label=1;case 1:return[4,n.next()];case 2:if((r=c.sent()).done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function Si(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(o),!i)return o}function Ci(e,t){return void 0===t&&(t=0),Vr(function(n,r){n.subscribe(Wr(r,function(n){return Si(r,e,function(){return r.next(n)},t)},function(){return Si(r,e,function(){return r.complete()},t)},function(n){return Si(r,e,function(){return r.error(n)},t)}))})}function Ii(e,t){return void 0===t&&(t=0),Vr(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function _i(e,t){if(!e)throw new Error("Iterable cannot be null");return new Hr(function(n){Si(n,t,function(){var r=e[Symbol.asyncIterator]();Si(n,t,function(){r.next().then(function(e){e.done?n.complete():n.next(e.value)})},0,!0)})})}function Di(e,t){if(null!=e){if(hi(e))return function(e,t){return wi(e).pipe(Ii(t),Ci(t))}(e,t);if(pi(e))return function(e,t){return new Hr(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}(e,t);if(di(e))return function(e,t){return wi(e).pipe(Ii(t),Ci(t))}(e,t);if(mi(e))return _i(e,t);if(yi(e))return function(e,t){return new Hr(function(n){var r;return Si(n,t,function(){r=e[vi](),Si(n,t,function(){var e,t,i;try{t=(e=r.next()).value,i=e.done}catch(e){return void n.error(e)}i?n.complete():n.next(t)},0,!0)}),function(){return Cr(null==r?void 0:r.return)&&r.return()}})}(e,t);if(bi(e))return function(e,t){return _i(Ei(e),t)}(e,t)}throw gi(e)}function Ni(e,t){return t?Di(e,t):wi(e)}function Oi(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=function(e){return ui(fi(e))?e.pop():void 0}(e);return Ni(e,n)}var Ai=Ir(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function Pi(e,t){var n="object"==typeof t;return new Promise(function(r,i){var o,s=!1;e.subscribe({next:function(e){o=e,s=!0},error:i,complete:function(){s?r(o):n?r(t.defaultValue):i(new Ai)}})})}function Ti(e,t){var n="object"==typeof t;return new Promise(function(r,i){var o=new Br({next:function(e){r(e),o.unsubscribe()},error:i,complete:function(){n?r(t.defaultValue):i(new Ai)}});e.subscribe(o)})}function Ri(e){return e instanceof Date&&!isNaN(e)}var xi=Ir(function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function $i(e){throw new xi(e)}function Fi(e,t){return Vr(function(n,r){var i=0;n.subscribe(Wr(r,function(n){r.next(e.call(t,n,i++))}))})}var ki=Array.isArray;function Ui(e){return Fi(function(t){return function(e,t){return ki(t)?e.apply(void 0,br([],Er(t))):e(t)}(e,t)})}function Bi(e,t,n,r,i,o,s,a){var c=[],l=0,u=0,f=!1,p=function(){!f||c.length||l||t.complete()},d=function(e){return l<r?h(e):c.push(e)},h=function(e){o&&t.next(e),l++;var a=!1;wi(n(e,u++)).subscribe(Wr(t,function(e){null==i||i(e),o?d(e):t.next(e)},function(){a=!0},void 0,function(){if(a)try{l--;for(var e=function(){var e=c.shift();s||h(e)};c.length&&l<r;)e();p()}catch(e){t.error(e)}}))};return e.subscribe(Wr(t,d,function(){f=!0,p()})),function(){null==a||a()}}function Mi(e,t,n){return void 0===n&&(n=1/0),Cr(t)?Mi(function(n,r){return Fi(function(e,i){return t(n,e,r,i)})(wi(e(n,r)))},n):("number"==typeof t&&(n=t),Vr(function(t,r){return Bi(t,r,e,n)}))}var Gi=["addListener","removeListener"],ji=["addEventListener","removeEventListener"],zi=["on","off"];function Hi(e,t,n,r){if(Cr(n)&&(r=n,n=void 0),r)return Hi(e,t,n).pipe(Ui(r));var i=Er(function(e){return Cr(e.addEventListener)&&Cr(e.removeEventListener)}(e)?ji.map(function(r){return function(i){return e[r](t,i,n)}}):function(e){return Cr(e.addListener)&&Cr(e.removeListener)}(e)?Gi.map(qi(e,t)):function(e){return Cr(e.on)&&Cr(e.off)}(e)?zi.map(qi(e,t)):[],2),o=i[0],s=i[1];if(!o&&pi(e))return Mi(function(e){return Hi(e,t,n)})(wi(e));if(!o)throw new TypeError("Invalid event target");return new Hr(function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.next(1<t.length?t:t[0])};return o(t),function(){return s(t)}})}function qi(e,t){return function(n){return function(r){return e[n](t,r)}}}function Vi(e,t,n){void 0===e&&(e=0),void 0===n&&(n=ci);var r=-1;return null!=t&&(ui(t)?n=t:r=t),new Hr(function(t){var i=Ri(e)?+e-n.now():e;i<0&&(i=0);var o=0;return n.schedule(function(){t.closed||(t.next(o++),0<=r?this.schedule(void 0,r):t.complete())},i)})}function Wi(e,t){return Vr(function(n,r){var i=0;n.subscribe(Wr(r,function(n){return e.call(t,n,i++)&&r.next(n)}))})}function Yi(e){return Vr(function(t,n){var r,i=null,o=!1;i=t.subscribe(Wr(n,void 0,void 0,function(s){r=wi(e(s,Yi(e)(t))),i?(i.unsubscribe(),i=null,r.subscribe(n)):o=!0})),o&&(i.unsubscribe(),i=null,r.subscribe(n))})}function Zi(e,t,n,r,i){return function(o,s){var a=n,c=t,l=0;o.subscribe(Wr(s,function(t){var n=l++;c=a?e(c,t,n):(a=!0,t),r&&s.next(c)},i&&function(){a&&s.next(c),s.complete()}))}}function Ki(e,t){return Vr(Zi(e,t,arguments.length>=2,!1,!0))}function Xi(e){return Vr(function(t,n){var r=!1;t.subscribe(Wr(n,function(e){r=!0,n.next(e)},function(){r||n.next(e),n.complete()}))})}function Ji(e,t){return void 0===t&&(t=zr),e=null!=e?e:Qi,Vr(function(n,r){var i,o=!0;n.subscribe(Wr(r,function(n){var s=t(n);!o&&e(i,s)||(o=!1,i=s,r.next(n))}))})}function Qi(e,t){return e===t}function eo(e){return void 0===e&&(e=to),Vr(function(t,n){var r=!1;t.subscribe(Wr(n,function(e){r=!0,n.next(e)},function(){return r?n.complete():n.error(e())}))})}function to(){return new Ai}function no(e){return Vr(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}function ro(e,t){var n=arguments.length>=2;return function(e){return e.pipe(zr,(r=1)<=0?function(){return li}:Vr(function(e,t){var n=[];e.subscribe(Wr(t,function(e){n.push(e),r<n.length&&n.shift()},function(){var e,r;try{for(var i=yr(n),o=i.next();!o.done;o=i.next()){var s=o.value;t.next(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}t.complete()},void 0,function(){n=null}))}),n?Xi(t):eo(function(){return new Ai}));var r}}function io(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0!==t){if(!1!==t){var i=new Br({next:function(){i.unsubscribe(),e()}});return wi(t.apply(void 0,br([],Er(n)))).subscribe(i)}}else e()}function oo(e,t){return Vr(function(n,r){var i=null,o=0,s=!1,a=function(){return s&&!i&&r.complete()};n.subscribe(Wr(r,function(n){null==i||i.unsubscribe();var s=0,c=o++;wi(e(n,c)).subscribe(i=Wr(r,function(e){return r.next(t?t(n,e,c,s++):e)},function(){i=null,a()}))},function(){s=!0,a()}))})}function so(e){return Vr(function(t,n){wi(e).subscribe(Wr(n,function(){return n.complete()},$r)),!n.closed&&t.subscribe(n)})}function ao(e,t,n){var r=Cr(e)||t||n?{next:e,error:t,complete:n}:e;return r?Vr(function(e,t){var n;null===(n=r.subscribe)||void 0===n||n.call(r);var i=!0;e.subscribe(Wr(t,function(e){var n;null===(n=r.next)||void 0===n||n.call(r,e),t.next(e)},function(){var e;i=!1,null===(e=r.complete)||void 0===e||e.call(r),t.complete()},function(e){var n;i=!1,null===(n=r.error)||void 0===n||n.call(r,e),t.error(e)},function(){var e,t;i&&(null===(e=r.unsubscribe)||void 0===e||e.call(r)),null===(t=r.finalize)||void 0===t||t.call(r)}))}):zr}function co(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n,r=Cr(fi(n=e))?n.pop():void 0;return Vr(function(t,n){for(var i=e.length,o=new Array(i),s=e.map(function(){return!1}),a=!1,c=function(t){wi(e[t]).subscribe(Wr(n,function(e){o[t]=e,a||s[t]||(s[t]=!0,(a=s.every(zr))&&(s=null))},$r))},l=0;l<i;l++)c(l);t.subscribe(Wr(n,function(e){if(a){var t=br([e],Er(o));n.next(r?r.apply(void 0,br([],Er(t))):t)}}))})}const lo=(e,t,n)=>{const r="string"==typeof t?t.split("."):t,i=r.shift();return i&&(e[i]??={},r.length?lo(e[i],r,n):Object.assign(e,{[i]:n})),e};class uo{#X={};createConfig(e,t){return Ni(this._createConfig(e,t))}async createConfigAsync(e,t){return Pi(this.createConfig(e,t))}_set(e,t){const n="function"==typeof t?t:async()=>t;this.#X[e]=n}_get(e){return this.#X[e]}_has(e){return e in this.#X}_createConfig(e,t){return Ni(this._buildConfig(e,t)).pipe(oo(t=>this._processConfig(t,e)))}_buildConfig(e,t){return Ni(Object.entries(this.#X)).pipe(Mi(([t,n])=>Ni(n(e)).pipe(Wi(e=>void 0!==e),Fi(e=>({target:t,value:e})),Yi(e=>(console.error(`Failed to execute config callback: ${n.name} for attribute: '${t}'`,e),li)))),Ki((e,{target:t,value:n})=>lo(e,t,n),t??{}))}_processConfig(e,t){return Oi(e)}}var fo;!function(e){e[e.Debug=0]="Debug",e[e.Information=1]="Information",e[e.Warning=2]="Warning",e[e.Error=3]="Error",e[e.Critical=4]="Critical"}(fo||(fo={}));class po{static[Symbol.hasInstance](e){if(null!==e&&"object"==typeof e&&"version"in e&&"dispose"in e){const t=e,n=O(String(t.version)),r=t.dispose;return!!n&&"function"==typeof r}return!1}#J;#Q;get version(){return this.#J}constructor(e){const{version:t}=e;this.#J=new pr(t),this.#Q=new Nr}_addTeardown(e){return this.#Q.add(e),()=>this.#Q.remove(e)}dispose(){this.#Q.unsubscribe()}}class ho extends Error{constructor(){super("Module initialization timed out"),this.name="RequiredModuleTimeoutError"}}class mo{static className="ModulesConfigurator";get version(){return"5.0.5"}#ee=new ei(100);get event$(){return this.#ee.asObservable()}_configs=[];_afterConfiguration=[];_afterInit=[];_modules;constructor(e){this._modules=new Set(e)}get modules(){return[...this._modules]}configure(...e){for(const t of e)this.addConfig(t)}addConfig(e){const{module:t,afterConfig:n,afterInit:r,configure:i}=e;this._modules.add(t),this._registerEvent({level:fo.Debug,name:"moduleConfigAdded",message:`Module configurator added for ${t.name}`,properties:{moduleName:t.name,moduleVersion:t.version?.toString()||"unknown",configure:!!i,afterConfig:!!n,afterInit:!!r}}),i&&this._configs.push((e,n)=>i(e[t.name],n)),n&&this._afterConfiguration.push(e=>n(e[t.name])),r&&this._afterInit.push(e=>r(e[t.name]))}onConfigured(e){this._afterConfiguration.push(e),this._registerEvent({level:fo.Debug,name:"addOnConfigured",message:"Added onConfigured callback",properties:{count:this._afterConfiguration.length,name:e.name||"anonymous"}})}onInitialized(e){this._afterInit.push(e),this._registerEvent({level:fo.Debug,name:"addOnInitialized",message:"Added onInitialized callback",properties:{count:this._afterInit.length,name:e.name||"anonymous"}})}async initialize(e){const t=performance.now(),n=await this._configure(e),r=Math.round(performance.now()-t);this._registerEvent({level:fo.Debug,name:"initialize.configLoaded",message:`Modules configured in ${r}ms`,properties:{modules:this.modules.map(e=>e.name).join(", "),count:this.modules.length,loadTime:r},metric:r});const i=performance.now(),o=await this._initialize(n,e),s=Math.round(performance.now()-i);this._registerEvent({level:fo.Debug,name:"initialize.instanceInitialized",message:`Modules initialized in ${s}ms`,properties:{modules:this.modules.map(e=>e.name).join(", "),count:this.modules.length,loadTime:s},metric:s});const a=r+s;return this._registerEvent({level:fo.Information,name:"initialize",message:`initialize in ${a}ms`,properties:{modules:this.modules.map(e=>e.name).join(", "),configLoadTime:r,instanceLoadTime:s,totalLoadTime:a},metric:a}),await this._postInitialize(o,e),Object.seal(Object.assign({},o,{dispose:()=>this.dispose(o)}))}_registerEvent(e){const t=e.name.split("::");this.#ee.next({...e,name:`${this.constructor.className}::${t[t.length-1]}`})}async _configure(e){const t=await this._createConfig(e);return await Promise.all(this._configs.map(n=>Promise.resolve(n(t,e)))),await this._postConfigure(t),t}_createConfig(e){const{modules:t,_afterConfiguration:n,_afterInit:r}=this;return Pi(Ni(t).pipe(Mi(async t=>{const n=performance.now();try{const r=await(t.configure?.(e)),i=Math.round(performance.now()-n);return this._registerEvent({level:fo.Debug,name:"_createConfig.configuratorCreated",message:`Configurator created for ${t.name} in ${i}ms`,properties:{moduleName:t.name,moduleVersion:t.version?.toString()||"unknown",configLoadTime:i},metric:i}),{[t.name]:r}}catch(e){throw this._registerEvent({level:fo.Error,name:"_createConfig.configuratorFailed",message:`Failed to create configurator for ${t.name}`,properties:{moduleName:t.name,moduleVersion:t.version?.toString()||"unknown"},metric:Math.round(performance.now()-n),error:e}),e}}),Ki((e,t)=>Object.assign(e,t),{onAfterConfiguration(e){n.push(e)},onAfterInit(e){r.push(e)}})))}async _postConfigure(e){const{modules:t,_afterConfiguration:n}=this;if(await Promise.allSettled(t.filter(e=>!!e.postConfigure).map(async t=>{try{const n=performance.now();await(t.postConfigure?.(e)),this._registerEvent({level:fo.Debug,name:"_postConfigure.modulePostConfigured",message:`Module ${t.name} post-configured successfully`,properties:{moduleName:t.name,moduleVersion:t.version?.toString()||"unknown",postConfigTime:Math.round(performance.now()-n)}})}catch(e){this._registerEvent({level:fo.Warning,name:"_postConfigure.modulePostConfigureError",message:`Module ${t.name} post-configure failed`,properties:{moduleName:t.name,moduleVersion:t.version?.toString()||"unknown"},error:e})}})),n.length)try{this._registerEvent({level:fo.Debug,name:"_postConfigure.hooks",message:`Post configure hooks [${n.length}] called`});const t=performance.now();await Promise.allSettled(n.map(t=>Promise.resolve(t(e))));const r=Math.round(performance.now()-t);this._registerEvent({level:fo.Debug,name:"_postConfigure.hooksComplete",message:"Post configure hooks complete",properties:{count:n.length,postConfigHooksTime:r},metric:r})}catch(e){this._registerEvent({level:fo.Warning,name:"_postConfigure.hooksError",message:"Post configure hook failed",error:e})}}async _initialize(e,t){const n=this.modules.map(e=>e.name),r=new Jr({}),i=e=>n.includes(e),o=(e,t=60)=>{if(!n.includes(e)){const n=new Error(`Cannot require [${String(e)}] since module is not defined!`);throw n.name="ModuleNotDefinedError",this._registerEvent({level:fo.Error,name:"_initialize.requireInstance.moduleNotDefined",message:n.message,properties:{moduleName:String(e),wait:t},error:n}),n}if(r.value[e])return this._registerEvent({level:fo.Debug,name:"_initialize.requireInstance.moduleAlreadyInitialized",message:`Module [${String(e)}] is already initialized, skipping queue`,properties:{moduleName:String(e),wait:t}}),Promise.resolve(r.value[e]);const i=performance.now();return this._registerEvent({level:fo.Debug,name:"_initialize.requireInstance.awaiting",message:`Awaiting module [${String(e)}] initialization, timeout ${t}s`,properties:{moduleName:String(e),wait:t}}),Ti(r.pipe(Wi(t=>!!t[e]),Fi(t=>t[e]),function(e){var t=Ri(e)?{first:e}:"number"==typeof e?{each:e}:e,n=t.first,r=t.each,i=t.with,o=void 0===i?$i:i,s=t.scheduler,a=void 0===s?ai:s,c=t.meta,l=void 0===c?null:c;if(null==n&&null==r)throw new TypeError("No timeout provided.");return Vr(function(e,t){var i,s,c=null,u=0,f=function(e){s=Si(t,a,function(){try{i.unsubscribe(),wi(o({meta:l,lastValue:c,seen:u})).subscribe(t)}catch(e){t.error(e)}},e)};i=e.subscribe(Wr(t,function(e){null==s||s.unsubscribe(),u++,t.next(c=e),r>0&&f(r)},void 0,void 0,function(){(null==s?void 0:s.closed)||null==s||s.unsubscribe(),c=null})),!u&&f(null!=n?"number"==typeof n?n:+n-a.now():r)})}({each:1e3*t,with:()=>{return r=Cr(n=()=>{const n=new ho;return this._registerEvent({level:fo.Error,name:"_initialize.requireInstance.timeout",message:`Module [${String(e)}] initialization timed out after ${t}s`,properties:{moduleName:String(e),wait:t},error:n}),n})?n:function(){return n},new Hr(function(e){return e.error(r())});var n,r}}),ao(()=>{const n=Math.round(performance.now()-i);this._registerEvent({level:fo.Debug,name:"_initialize.requireInstance.moduleResolved",message:`Module [${String(e)}] required in ${n}ms`,properties:{moduleName:String(e),wait:t,requireTime:n},metric:n})})))},s=Ni(this.modules).pipe(Mi(n=>{const r=n.name;if(!n.initialize){const e=new Error(`Module ${n.name} does not have initialize method`);throw e.name="ModuleInitializeError",this._registerEvent({level:fo.Error,name:"_initialize.moduleInitializeError",message:e.message,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown"},error:e}),e}this._registerEvent({level:fo.Debug,name:"_initialize.moduleInitializing",message:`Initializing module ${n.name}`,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown"}});const s=performance.now();return Ni(Promise.resolve(n.initialize({ref:t,config:e[r],requireInstance:o,hasModule:i}))).pipe(Fi(e=>{e instanceof po||this._registerEvent({level:fo.Warning,name:"_initialize.providerNotBaseModuleProvider",message:`Provider for module ${n.name} does not extend BaseModuleProvider`,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown"}}),e.version||this._registerEvent({level:fo.Warning,name:"_initialize.providerVersionWarning",message:`Provider for module ${n.name} does not expose version`,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown"}});const t=Math.round(performance.now()-s);return this._registerEvent({level:fo.Debug,name:"_initialize.moduleInitialized",message:`Module ${n.name} initialized in ${t}ms`,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown",providerName:typeof e,providerVersion:e.version?.toString()||"unknown",moduleInitTime:t},metric:t}),[r,e]}))})),a=performance.now();s.pipe(Xi([])).subscribe({next:([e,t])=>{r.next(Object.assign(r.value,{[e]:t}))},error:e=>{this._registerEvent({level:fo.Error,name:"_initialize.moduleInitializationError",message:`Failed to initialize module ${e.name||"unknown"}`,error:e}),r.error(e)},complete:()=>{const e=Math.round(performance.now()-a);return this._registerEvent({level:fo.Debug,name:"_initialize.moduleInitializationComplete",message:`All modules initialized in ${e}ms`,properties:{modules:Object.keys(r.value).join(", "),loadTime:e},metric:e}),r.complete()}});const c=performance.now(),l=await Pi(r),u=Math.round(performance.now()-c);return this._registerEvent({level:fo.Debug,name:"_initialize.complete",message:`Modules instance created in ${u}ms`,properties:{modules:Object.keys(l).join(", "),initTime:u},metric:u}),Object.seal(l),l}async _postInitialize(e,t){const{modules:n,_afterInit:r}=this,i=Ni(n).pipe(Wi(e=>!!e.postInitialize),ao(e=>{this._registerEvent({level:fo.Debug,name:"_postInitialize.modulePostInitializing",message:`Module ${e.name} is being post-initialized`,properties:{moduleName:e.name,moduleVersion:e.version?.toString()||"unknown"}})}),Mi(n=>{const r=performance.now();return Ni(n.postInitialize({ref:t,modules:e,instance:e[n.name]})).pipe(ao(()=>{const e=Math.round(performance.now()-r);this._registerEvent({level:fo.Debug,name:"_postInitialize.modulePostInitialized",message:`Module ${n.name} has been post-initialized in ${e}ms`,metric:e,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown",postInitTime:e}})}),Xi(null),Yi(e=>(this._registerEvent({level:fo.Warning,name:"_postInitialize.modulePostInitializeError",message:`Module ${n.name} post-initialize failed`,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown"},error:e}),li)))}),Xi(null));this._registerEvent({level:fo.Debug,name:"_postInitialize.modulesPostInitializing",message:`Post-initializing all modules [${Object.keys(e).length}]`,properties:{modules:Object.keys(e).join(", ")}});const o=performance.now();await Pi(i);const s=Math.round(performance.now()-o);if(this._registerEvent({level:fo.Debug,name:"_postInitialize.modulesPostInitializeComplete",message:`Post-initialization of all modules completed in ${s}ms`,properties:{modules:Object.keys(e).join(", "),postInitTime:s},metric:s}),r.length)try{this._registerEvent({level:fo.Debug,name:"_postInitialize.afterInitHooks",message:`Executing post-initialize hooks [${r.length}]`,properties:{hooks:r.map(e=>e.name||"anonymous").join(", ")}});const t=performance.now();await Promise.allSettled(r.map(t=>Promise.resolve(t(e))));const n=Math.round(performance.now()-t);this._registerEvent({level:fo.Debug,name:"_postInitialize.afterInitHooksComplete",message:`Post-initialize hooks completed in ${n}ms`,properties:{hooks:r.map(e=>e.name||"anonymous").join(", "),afterInitTime:n},metric:n})}catch(e){this._registerEvent({level:fo.Warning,name:"_postInitialize.afterInitHooksError",message:"Post-initialize hooks failed",properties:{hooks:r.map(e=>e.name||"anonymous").join(", ")},error:e})}const a=Math.round(performance.now()-o);this._registerEvent({level:fo.Debug,name:"_postInitialize.complete",message:"Post-initialization complete",properties:{modules:Object.keys(e).join(", "),postInitCompleteTime:a}})}async dispose(e,t){this._registerEvent({level:fo.Debug,name:"dispose",message:"Disposing modules instance",properties:{modules:Object.keys(e).join(", ")}}),await Promise.allSettled(this.modules.filter(e=>!!e.dispose).map(async n=>{if(n.dispose)try{await n.dispose({ref:t,modules:e,instance:e[n.name]}),this._registerEvent({level:fo.Debug,name:"dispose.moduleDisposed",message:`Module ${n.name} disposed successfully`,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown"}})}catch(e){this._registerEvent({level:fo.Warning,name:"dispose.moduleDisposeError",message:`Module ${n.name} dispose failed`,properties:{moduleName:n.name,moduleVersion:n.version?.toString()||"unknown"},error:e})}})),this.#ee.complete()}}class go{_operators;get operators(){return this._operators}constructor(e){this._operators=e&&"operators"in e?{...e.operators}:e??{}}add(e,t){if(Object.keys(this._operators).includes(e))throw Error(`Operator [${e}] already defined`);return this.set(e,t)}set(e,t){return this._operators[e]=t,this}remove(e){return delete this._operators[e],this}get(e){return this._operators[e]}process(e){return Object.values(this._operators).length?Ni(Object.values(this._operators)).pipe((t=(e,t)=>Promise.resolve(t(e)).then(t=>t??e),n=e,r=1,Vr(function(e,i){var o=n;return Bi(e,i,function(e,n){return t(o,e,n)},r,function(e){o=e},!1,void 0,function(){return o=null})})),ro()):Oi(e);var t,n,r}}class vo extends go{setHeader(e,t){const n=((e,t)=>n=>{const r=new Headers(n.headers);return r.append(e,t),{...n,headers:r}})(e,t);return this.set("header-"+e,n)}}class yo extends go{}const Eo=R.object({attributionReporting:R.object({eventSourceEligible:R.boolean().optional(),triggerEligible:R.boolean().optional()}).optional(),body:R.union([R.string(),R.instanceof(Blob),R.instanceof(ArrayBuffer),R.instanceof(FormData),R.instanceof(URLSearchParams),R.instanceof(ReadableStream)]).optional(),browsingTopics:R.boolean().optional(),cache:R.enum(["default","no-store","reload","no-cache","force-cache","only-if-cached"]).optional(),credentials:R.enum(["omit","same-origin","include"]).optional(),headers:R.record(R.string(),R.string()).optional().or(R.instanceof(Headers)),integrity:R.string().optional(),keepalive:R.boolean().optional(),method:R.enum(["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD","CONNECT","TRACE"],{message:"Invalid request method. Expected one of: GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD, CONNECT, TRACE. See RFC 2615 Section 9 for more information: https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html"}).optional().optional(),mode:R.enum(["same-origin","cors","no-cors","navigate","websocket"]).optional(),priority:R.enum(["low","high","auto"]).optional(),redirect:R.enum(["follow","error","manual"]).optional(),referrer:R.string().optional(),referrerPolicy:R.enum(["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"]).optional(),signal:R.instanceof(AbortSignal).optional()}).extend({uri:R.string(),path:R.string().optional()}),bo=e=>e=>{const{error:t,success:n,data:r}=R.string().optional().refine(e=>void 0===e||e===e?.toUpperCase(),{message:["Provided HTTP method must be in uppercase.","See RFC 7231 Section 4.1 for more information","https://www.rfc-editor.org/rfc/rfc7231#section-4.1"].join(" ")}).safeParse(e.method);if(e.method=n?r:e.method?.toUpperCase(),t)for(const e of t.issues)console.warn(e.message);return e},wo=e=>e=>{const{strict:t,parse:n}={},r=t?Eo:Eo.passthrough();try{const t=r.parse(e);return n?t:void 0}catch(e){if(n)throw e;console.error("Invalid request options",e.message)}};class Lo{_clients={};get clients(){return{...this._clients}}defaultHttpClientCtor;defaultHttpRequestHandler=new vo({"capitalize-method":bo(),"request-validation":wo()});constructor(e){this.defaultHttpClientCtor=e}hasClient(e){return Object.keys(this._clients).includes(e)}configureClient(e,t){const n="string"==typeof t?{baseUri:t}:t,r="function"==typeof n?{onCreate:n}:n;return this._clients[e]={...this._clients[e],...r},this}}class So extends Error{}class Co extends po{config;get defaultHttpRequestHandler(){return this.config.defaultHttpRequestHandler}constructor(e){super({version:"7.0.6",config:e}),this.config=e}hasClient(e){return Object.keys(this.config.clients).includes(e)}createClient(e){const t=this._resolveConfig(e),{baseUri:n,defaultScopes:r=[],onCreate:i,ctor:o=this.config.defaultHttpClientCtor,requestHandler:s=this.defaultHttpRequestHandler}=t,a=new o(n||"",{requestHandler:s});return Object.assign(a,{defaultScopes:r}),i?.(a),a}createCustomClient(e){return this.createClient(e)}_resolveConfig(e){if("string"==typeof e){const n=this.config.clients[e];if(!n&&(t=e,new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(t)))return{baseUri:e};if(!n)throw new So(`No registered http client for key [${e}]`);return n}var t;return e}}function Io(e,t){void 0===t&&(t={});var n=t.selector,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(t,["selector"]);return new Hr(function(t){var i=new AbortController,o=i.signal,s=!0,a=r.signal;if(a)if(a.aborted)i.abort();else{var c=function(){o.aborted||i.abort()};a.addEventListener("abort",c),t.add(function(){return a.removeEventListener("abort",c)})}var l=mr(mr({},r),{signal:o}),u=function(e){s=!1,t.error(e)};return fetch(e,l).then(function(e){n?wi(n(e)).subscribe(Wr(t,void 0,function(){s=!1,t.complete()},u)):(s=!1,t.next(e),t.complete())}).catch(u),function(){s&&i.abort()}})}const _o=async e=>{if(204===e.status)return Promise.resolve();try{const t=await e.json();if(!e.ok)throw new ur("network response was not OK",e,{data:t});return t}catch(t){if(t instanceof ur)throw t;throw new ur("failed to parse response",e,{cause:t})}},Do=async e=>{if(!e.ok)throw new Error("network response was not OK");if(204===e.status)throw new Error("no content");const t=e.headers.get("content-disposition")?.split(";").find(e=>e.includes("filename="))?.replace("filename=","")?.trim();try{return{filename:t,blob:await e.blob()}}catch(e){throw Error("failed to parse response")}},No=e=>{try{return JSON.parse(e)}catch{return e}};function*Oo(e,t){const n=e.split("\n\n"),r=t?.dataParser||No;for(const e of n){if(!e.trim())continue;const t=e.split("\n").reduce((e,t)=>{if(!t)return e;const n=t.indexOf(":");if(-1===n)return e;const i=t.slice(0,n).trim(),o=t.slice(n+1).trim();return"data"===i?e.data=r(o):e[i]=o,e},{});Object.keys(t).length&&(yield t)}}const Ao=e=>t=>{if(!t.ok)throw new fr(`HTTP error! Status: ${t.status}`,t);if(!t.body)throw new fr("Response body is not readable",t);if(!t.headers.get("Content-Type")?.includes("text/event-stream"))throw new fr("Response is not a text/event-stream",t);const n=t.body.getReader();return Ni(async function*(e,t){const n=!!t?.skipHeartbeats,r=t?.eventFilter?Array.isArray(t.eventFilter)?t.eventFilter:[t.eventFilter]:null,i=new TextDecoder;for(;;){const{done:o,value:s}=await e.read();if(o)break;const a=Oo(i.decode(s,{stream:!0}),{dataParser:t?.dataParser});for(const e of a)if(e.retry)await new Promise(t=>setTimeout(t,Number.parseInt(e.retry??"300",10)));else{if(n){if(!e.event&&!e.data&&!e.id)continue;if(e.event&&["heartbeat","ping"].includes(e.event))continue}(!r||e.event&&r.includes(e.event))&&(yield e)}}}(n,{dataParser:e?.dataParser,skipHeartbeats:e?.skipHeartbeats,eventFilter:e?.eventFilter})).pipe(so(e?.abortSignal?Hi(e.abortSignal,"abort"):li),no(async()=>{await n.cancel().catch(()=>{}),n.releaseLock()}))};class Po{uri;requestHandler;responseHandler;_request$=new Kr;_response$=new Kr;_abort$=new Kr;get request$(){return this._request$.asObservable()}get response$(){return this._response$.asObservable()}constructor(e,t){this.uri=e,this.requestHandler=new vo(t?.requestHandler),this.responseHandler=new yo(t?.responseHandler),this._init()}_init(){}fetch$(e,t){return this._fetch$(e,t)}fetch(e,t){return Ti(this.fetch$(e,t))}fetchAsync(e,t){return this.fetch(e,t)}json$(e,t){const n="object"==typeof t?.body?JSON.stringify(t?.body):t?.body,r=t?.selector??_o,i=new Headers(t?.headers);return i.append("Accept","application/json"),i.append("Content-Type","application/json"),this.fetch$(e,{...t,body:n,selector:r,headers:i})}json(e,t){return Ti(this.json$(e,t))}blob$(e,t){const n=t?.selector??Do,r={...t,selector:n};return this.fetch$(e,r)}blob(e,t){return Ti(this.blob$(e,t))}sse$(e,t,n){const r=new Headers(t?.headers);r.append("Accept","text/event-stream"),r.append("Content-Type","text/event-stream"),r.append("Cache-Control","no-cache"),r.append("Connection","keep-alive");const i=Ao({...n,abortSignal:t?.signal});return this._fetch$(e,{selector:i,...t,headers:r})}jsonAsync(e,t){return this.json(e,t)}execute(e,t,n){return this[e](t,n)}abort(){this._abort$.next()}_fetch$(e,t){const{selector:n,...r}=t||{};return Oi({...r,uri:this._resolveUrl(e)}).pipe(oo(e=>this._prepareRequest(e)),ao(e=>this._request$.next(e)),oo(({uri:e,path:t,...n})=>Io(e,n)),oo(e=>this._prepareResponse(e)),ao(e=>this._response$.next(e)),oo(e=>{if(n)try{return n(e)}catch(t){throw new lr("failed to execute response selector",e,{cause:t})}return Oi(e)}),so(this._abort$))}_prepareRequest(e){return this.requestHandler.process(e)}_prepareResponse(e){return this.responseHandler.process(e)}_resolveUrl(e){const{origin:t,pathname:n}=new URL(this.uri,this.uri.startsWith("http")?void 0:window.location.origin),r=[n,e].join("/").replace(/\/{2,}/g,"/");return new URL(r,t).href}}class To extends Po{defaultScopes=[];fetch$(e,t){const n=Object.assign(t||{},{scopes:this.defaultScopes.concat(t?.scopes||[])});return super._fetch$(e,n)}}const Ro={name:"http",configure:()=>new Lo(To),initialize:async({config:e,hasModule:t,requireInstance:n})=>{const r=new Co(e);if(t("auth")){const e=await n("auth");r.defaultHttpRequestHandler.set("MSAL",async t=>{const{scopes:n=[]}=t;if(n.length){const r=await e.acquireAccessToken({request:{scopes:n}});if(r){const e=new Headers(t.headers);return e.set("Authorization",`Bearer ${r}`),{...t,headers:e}}}})}return r}},xo=(...e)=>t=>t.pipe(function(e,t){return Cr(t)?Mi(e,t,1):Mi(e,1)}(...e)),$o=(...e)=>t=>t.pipe(Mi(...e)),Fo=(...e)=>t=>t.pipe(oo(...e)),ko=e=>e.pipe(Fi(e=>e.value));var Uo=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function Bo(e){if(!function(e){return"string"==typeof e&&Uo.test(e)}(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,255&t,(t=parseInt(e.slice(9,13),16))>>>8,255&t,(t=parseInt(e.slice(14,18),16))>>>8,255&t,(t=parseInt(e.slice(19,23),16))>>>8,255&t,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,255&t)}const Mo=[];for(let e=0;e<256;++e)Mo.push((e+256).toString(16).slice(1));function Go(e,t=0){return(Mo[e[t+0]]+Mo[e[t+1]]+Mo[e[t+2]]+Mo[e[t+3]]+"-"+Mo[e[t+4]]+Mo[e[t+5]]+"-"+Mo[e[t+6]]+Mo[e[t+7]]+"-"+Mo[e[t+8]]+Mo[e[t+9]]+"-"+Mo[e[t+10]]+Mo[e[t+11]]+Mo[e[t+12]]+Mo[e[t+13]]+Mo[e[t+14]]+Mo[e[t+15]]).toLowerCase()}let jo;const zo=new Uint8Array(16);function Ho(e,t,n,r,i,o){const s="string"==typeof n?function(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}(n):n,a="string"==typeof r?Bo(r):r;if("string"==typeof r&&(r=Bo(r)),16!==r?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+s.length);if(c.set(a),c.set(s,a.length),c=t(c),c[6]=15&c[6]|e,c[8]=63&c[8]|128,i){o=o||0;for(let e=0;e<16;++e)i[o+e]=c[e];return i}return Go(c)}var qo={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Vo(e,t,n){const r=(e=e||{}).random??e.rng?.()??function(){if(!jo){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");jo=crypto.getRandomValues.bind(crypto)}return jo(zo)}();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=15&r[6]|64,r[8]=63&r[8]|128,Go(r)}function Wo(e,t,n){return qo.randomUUID&&!e?qo.randomUUID():Vo(e)}function Yo(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function Zo(e,t){return e<<t|e>>>32-t}function Ko(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(e.length+1);r.set(e),r[e.length]=128;const i=(e=r).length/4+2,o=Math.ceil(i/16),s=new Array(o);for(let t=0;t<o;++t){const n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[64*t+4*r]<<24|e[64*t+4*r+1]<<16|e[64*t+4*r+2]<<8|e[64*t+4*r+3];s[t]=n}s[o-1][14]=8*(e.length-1)/Math.pow(2,32),s[o-1][14]=Math.floor(s[o-1][14]),s[o-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<o;++e){const r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=s[e][t];for(let e=16;e<80;++e)r[e]=Zo(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let i=n[0],o=n[1],a=n[2],c=n[3],l=n[4];for(let e=0;e<80;++e){const n=Math.floor(e/20),s=Zo(i,5)+Yo(n,o,a,c)+l+t[n]+r[e]>>>0;l=c,c=a,a=Zo(o,30)>>>0,o=i,i=s}n[0]=n[0]+i>>>0,n[1]=n[1]+o>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+l>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}function Xo(e,t,n,r){return Ho(80,Ko,e,t,n,r)}Xo.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Xo.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";class Jo extends Error{type;request;constructor(e,t){super(t.message,{cause:t.cause}),this.type=e,this.name="QueryClientError",this.request=t.request}}var Qo=Symbol.for("immer-nothing"),es=Symbol.for("immer-draftable"),ts=Symbol.for("immer-state"),ns="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function rs(e,...t){if("production"!==process.env.NODE_ENV){const n=ns[e],r=_s(n)?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var is=Object,os=is.getPrototypeOf,ss="constructor",as="prototype",cs="configurable",ls="enumerable",us="writable",fs="value",ps=e=>!!e&&!!e[ts];function ds(e){return!!e&&(gs(e)||Ls(e)||!!e[es]||!!e[ss]?.[es]||Ss(e)||Cs(e))}var hs=is[as][ss].toString(),ms=new WeakMap;function gs(e){if(!e||!Is(e))return!1;const t=os(e);if(null===t||t===is[as])return!0;const n=is.hasOwnProperty.call(t,ss)&&t[ss];if(n===Object)return!0;if(!_s(n))return!1;let r=ms.get(n);return void 0===r&&(r=Function.toString.call(n),ms.set(n,r)),r===hs}function vs(e,t,n=!0){if(0===ys(e)){(n?Reflect.ownKeys(e):is.keys(e)).forEach(n=>{t(n,e[n],e)})}else e.forEach((n,r)=>t(r,n,e))}function ys(e){const t=e[ts];return t?t.type_:Ls(e)?1:Ss(e)?2:Cs(e)?3:0}var Es=(e,t,n=ys(e))=>2===n?e.has(t):is[as].hasOwnProperty.call(e,t),bs=(e,t,n=ys(e))=>2===n?e.get(t):e[t],ws=(e,t,n,r=ys(e))=>{2===r?e.set(t,n):3===r?e.add(n):e[t]=n};var Ls=Array.isArray,Ss=e=>e instanceof Map,Cs=e=>e instanceof Set,Is=e=>"object"==typeof e,_s=e=>"function"==typeof e,Ds=e=>"boolean"==typeof e;var Ns=e=>e.copy_||e.base_,Os=e=>e.modified_?e.copy_:e.base_;function As(e,t){if(Ss(e))return new Map(e);if(Cs(e))return new Set(e);if(Ls(e))return Array[as].slice.call(e);const n=gs(e);if(!0===t||"class_only"===t&&!n){const t=is.getOwnPropertyDescriptors(e);delete t[ts];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const i=n[r],o=t[i];!1===o[us]&&(o[us]=!0,o[cs]=!0),(o.get||o.set)&&(t[i]={[cs]:!0,[us]:!0,[ls]:o[ls],[fs]:e[i]})}return is.create(os(e),t)}{const t=os(e);if(null!==t&&n)return{...e};const r=is.create(t);return is.assign(r,e)}}function Ps(e,t=!1){return Rs(e)||ps(e)||!ds(e)||(ys(e)>1&&is.defineProperties(e,{set:Ts,add:Ts,clear:Ts,delete:Ts}),is.freeze(e),t&&vs(e,(e,t)=>{Ps(t,!0)},!1)),e}var Ts={[fs]:function(){rs(2)}};function Rs(e){return null===e||!Is(e)||is.isFrozen(e)}var xs="MapSet",$s="Patches",Fs="ArrayMethods",ks={};function Us(e){const t=ks[e];return t||rs(0,e),t}var Bs,Ms=e=>!!ks[e],Gs=()=>Bs;function js(e,t){t&&(e.patchPlugin_=Us($s),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function zs(e){Hs(e),e.drafts_.forEach(Vs),e.drafts_=null}function Hs(e){e===Bs&&(Bs=e.parent_)}var qs=e=>Bs={drafts_:[],parent_:Bs,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Ms(xs)?Us(xs):void 0,arrayMethodsPlugin_:Ms(Fs)?Us(Fs):void 0};function Vs(e){const t=e[ts];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ws(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];if(void 0!==e&&e!==n){n[ts].modified_&&(zs(t),rs(4)),ds(e)&&(e=Ys(t,e));const{patchPlugin_:r}=t;r&&r.generateReplacementPatches_(n[ts].base_,e,t)}else e=Ys(t,n);return function(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ps(t,n)}(t,e,!0),zs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Qo?e:void 0}function Ys(e,t){if(Rs(t))return t;const n=t[ts];if(!n){return ea(t,e.handledSet_,e)}if(!Ks(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:t}=n;if(t)for(;t.length>0;){t.pop()(e)}Qs(n,e)}return n.copy_}function Zs(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ks=(e,t)=>e.scope_===t,Xs=[];function Js(e,t,n,r){const i=Ns(e),o=e.type_;if(void 0!==r){if(bs(i,r,o)===t)return void ws(i,r,n,o)}if(!e.draftLocations_){const t=e.draftLocations_=new Map;vs(i,(e,n)=>{if(ps(n)){const r=t.get(n)||[];r.push(e),t.set(n,r)}})}const s=e.draftLocations_.get(t)??Xs;for(const e of s)ws(i,e,n,o)}function Qs(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:n}=t;if(n){const r=n.getPath(e);r&&n.generatePatches_(e,r,t)}Zs(e)}}function ea(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||ps(e)||t.has(e)||!ds(e)||Rs(e)||(t.add(e),vs(e,(r,i)=>{if(ps(i)){const t=i[ts];if(Ks(t,n)){const n=Os(t);ws(e,r,n,e.type_),Zs(t)}}else ds(i)&&ea(i,t,n)})),e}var ta={get(e,t){if(t===ts)return e;let n=e.scope_.arrayMethodsPlugin_;const r=1===e.type_&&"string"==typeof t;if(r&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=Ns(e);if(!Es(i,t,e.type_))return function(e,t,n){const r=ia(t,n);return r?fs in r?r[fs]:r.get?.call(e.draft_):void 0}(e,i,t);const o=i[t];if(e.finalized_||!ds(o))return o;if(r&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&function(e){const t=+e;return Number.isInteger(t)&&String(t)===e}(t))return o;if(o===ra(e.base_,t)){sa(e);const n=1===e.type_?+t:t,r=aa(e.scope_,o,e,n);return e.copy_[n]=r}return o},has:(e,t)=>t in Ns(e),ownKeys:e=>Reflect.ownKeys(Ns(e)),set(e,t,n){const r=ia(Ns(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=ra(Ns(e),t),s=r?.[ts];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(((i=n)===(o=r)?0!==i||1/i==1/o:i!=i&&o!=o)&&(void 0!==n||Es(e.base_,t,e.type_)))return!0;sa(e),oa(e)}var i,o;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),function(e,t,n){const{scope_:r}=e;if(ps(n)){const i=n[ts];Ks(i,r)&&i.callbacks_.push(function(){sa(e);const r=Os(i);Js(e,n,r,t)})}else ds(n)&&e.callbacks_.push(function(){const i=Ns(e);3===e.type_?i.has(n)&&ea(n,r.handledSet_,r):bs(i,t,e.type_)===n&&r.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&ea(bs(e.copy_,t,e.type_),r.handledSet_,r)})}(e,t,n)),!0},deleteProperty:(e,t)=>(sa(e),void 0!==ra(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),oa(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Ns(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{[us]:!0,[cs]:1!==e.type_||"length"!==t,[ls]:r[ls],[fs]:n[t]}:r},defineProperty(){rs(11)},getPrototypeOf:e=>os(e.base_),setPrototypeOf(){rs(12)}},na={};for(let e in ta){let t=ta[e];na[e]=function(){const e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function ra(e,t){const n=e[ts];return(n?Ns(n):e)[t]}function ia(e,t){if(!(t in e))return;let n=os(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=os(n)}}function oa(e){e.modified_||(e.modified_=!0,e.parent_&&oa(e.parent_))}function sa(e){e.copy_||(e.assigned_=new Map,e.copy_=As(e.base_,e.scope_.immer_.useStrictShallowCopy_))}na.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&rs(13),na.set.call(this,e,t,void 0)},na.set=function(e,t,n){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&rs(14),ta.set.call(this,e[0],t,n,e[0])};function aa(e,t,n,r){const[i,o]=Ss(t)?Us(xs).proxyMap_(t,n):Cs(t)?Us(xs).proxySet_(t,n):function(e,t){const n=Ls(e),r={type_:n?1:0,scope_:t?t.scope_:Gs(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,o=ta;n&&(i=[r],o=na);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,[a,r]}(t,n);return(n?.scope_??Gs()).drafts_.push(i),o.callbacks_=n?.callbacks_??[],o.key_=r,n&&void 0!==r?function(e,t,n){e.callbacks_.push(function(r){const i=t;if(!i||!Ks(i,r))return;r.mapSetPlugin_?.fixSetContents(i);const o=Os(i);Js(e,i.draft_??i,o,n),Qs(i,r)})}(n,o,r):o.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(o);const{patchPlugin_:t}=e;o.modified_&&t&&t.generatePatches_(o,[],e)}),i}function ca(e){if(!ds(e)||Rs(e))return e;const t=e[ts];let n,r=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=As(e,t.scope_.immer_.useStrictShallowCopy_),r=t.scope_.immer_.shouldUseStrictIteration()}else n=As(e,!0);return vs(n,(e,t)=>{ws(n,e,ca(t))},r),t&&(t.finalized_=!1),n}var la=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,n)=>{if(_s(e)&&!_s(t)){const n=t;t=e;const r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}let r;if(_s(t)||rs(6),void 0===n||_s(n)||rs(7),ds(e)){const i=qs(this),o=aa(i,e,void 0);let s=!0;try{r=t(o),s=!1}finally{s?zs(i):Hs(i)}return js(i,n),Ws(r,i)}if(!e||!Is(e)){if(r=t(e),void 0===r&&(r=e),r===Qo&&(r=void 0),this.autoFreeze_&&Ps(r,!0),n){const t=[],i=[];Us($s).generateReplacementPatches_(e,r,{patches_:t,inversePatches_:i}),n(t,i)}return r}rs(1,e)},this.produceWithPatches=(e,t)=>{if(_s(e))return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},Ds(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Ds(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Ds(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ds(e)||rs(8),ps(e)&&(e=function(e){ps(e)||rs(10,e);return ca(e)}(e));const t=qs(this),n=aa(t,e,void 0);return n[ts].isManual_=!0,Hs(t),n}finishDraft(e,t){const n=e&&e[ts];n&&n.isManual_||rs(9);const{scope_:r}=n;return js(r,t),Ws(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=Us($s).applyPatches_;return ps(e)?r(e,t):this.produce(e,e=>r(e,t))}},ua=la.produce;const fa=(...e)=>Wi(t=>e.includes(t.type));class pa extends Hr{#te=new Kr;#ne;get action$(){return this.#te.asObservable()}get value(){return this.#ne.value}get closed(){return this.#ne.closed||this.#te.closed}constructor(e,t){super(e=>this.#ne.subscribe(e));const n="getInitialState"in e?e.getInitialState():t;this.#ne=new Jr(n),this.#te.pipe(function(e,t){return Vr(Zi(e,t,arguments.length>=2,!0))}(e,n),Ji()).subscribe(this.#ne),this.reset=()=>this.#ne.next(n)}reset;next(e){this.#te.next(e)}select(e,t){return this.#ne.pipe(Fi(e),Ji(t))}addEffect(e,t){const n="function"==typeof e?this.action$:Array.isArray(e)?this.action$.pipe(fa(...e)):this.action$.pipe(fa(e)),r=t||e;return n.pipe(Mi(e=>Ni(new Promise((t,n)=>{try{t(r(e,this.value))}catch(e){n(e)}})).pipe(Yi(e=>(console.warn("unhandled effect",e),li)))),Wi(e=>!!e),Ci(ai)).subscribe(this.#te)}addEpic(e){return this.addFlow(e)}addFlow(e){const t=e(this.action$,this);if(!t)throw new TypeError(`addEpic: one of the provided effects "${e.name||"<anonymous>"}" does not return a stream. Double check you're not missing a return statement!`);return t.pipe(Yi(e=>(console.trace("unhandled exception, epic closed!",e),li)),Ci(ai)).subscribe(this.#te)}unsubscribe(){this.#te.unsubscribe(),this.#ne.unsubscribe()}complete(){this.#te.complete(),this.#ne.complete()}asObservable(){return this.#ne.asObservable()}}function da(e,t){function n(...n){if(t){const r=t(...n);if(!r)throw new Error("prepareAction did not return an object");return{type:e,payload:r.payload,..."meta"in r&&{meta:r.meta},..."error"in r&&{error:r.error}}}return{type:e,payload:n[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=t=>t.type===e,n}const ha="::";function ma(e,t,n,r){const i=da([e,"request"].join(ha),t);return n&&Object.assign(i,{success:da([e,"success"].join(ha),n)}),r&&Object.assign(i,{failure:da([e,"failure"].join(ha),r)}),i}function ga(e){return ds(e)?ua(e,()=>{}):e}function va(e,t){const[n,r,i]=function(e){const t={},n=[];let r;const i={addCase(e,o){if("production"!==process.env.NODE_ENV){if(n.length>0)throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");if(r)throw new Error("`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const s="string"==typeof e?e:e.type;if(s in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[s]=o,i},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&r)throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return n.push({matcher:e,reducer:t}),i},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&r)throw new Error("`builder.addDefaultCase` can only be called once");return r=e,i}};return e(i),[t,n,r]}(t);let o;if("function"==typeof e)o=()=>ga(e());else{const t=ga(e);o=()=>t}function s(e,t){let s=[n[t.type],...r.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return i&&0===s.filter(e=>!!e).length&&(s=[i]),s.reduce((e,n)=>{if(n){if(ps(e)){const r=n(e,t);return void 0===r?e:r}if(ds(e))return ua(e,e=>n(e,t));{const r=n(e,t);if(void 0===r){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}}return e},e??o())}return s.getInitialState=o,s}const ya={request:da("client/request",(e,t)=>({payload:{args:e,options:t},meta:{transaction:Wo(),created:Date.now()}})),execute:ma("client/execute",e=>({payload:e,meta:{transaction:e,created:Date.now()}}),e=>({payload:e,meta:{transaction:e.transaction,created:Date.now()}}),(e,t)=>({payload:{error:e},meta:{transaction:t,created:Date.now()}})),cancel:da("client/cancel",(e,t)=>({payload:{transaction:e,reason:t},meta:{transaction:e,created:Date.now()}})),error:da("client/error",(e,t)=>({payload:{transaction:e,error:t},meta:{transaction:e,created:Date.now()}}))},Ea=e=>e.pipe(Wi(ya.request.match),Fi(e=>ya.execute(e.meta.transaction)));class ba extends Hr{#re=new Jr("idle");get status(){return this.#re.value}get status$(){return this.#re.asObservable()}#ie;#oe;get transaction(){return this.#oe}created=Date.now();get closed(){return"complete"===this.status||"error"===this.status||"canceled"===this.status}constructor(e,t,n){super(t=>{const{transaction:r}=this,i=e.action$.pipe(Wi(e=>e.meta.transaction===r));t.add(e.state$.pipe(Wi(e=>!!e[r]),Fi(e=>e[r])).subscribe(e=>{this.#re.next(e.status)})),t.add(i.pipe(Wi(ya.execute.success.match),Fi(({payload:e})=>e)).subscribe(e=>{this.#re.next("complete"),t.next(e),t.complete()})),t.add(i.pipe(Wi(ya.error.match),Fi(({payload:e})=>e)).subscribe(e=>{this.#re.next("error"),t.error(e.error)})),t.add(i.pipe(Wi(ya.cancel.match)).subscribe(e=>{this.#re.next("canceled"),t.error(new Jo("abort",{message:e.payload.reason||`job: ${r} was canceled`,request:this.#ie.getRequest(e.meta.transaction)}))})),n?.signal&&t.add(Hi(n?.signal,"abort").pipe(Fi(()=>ya.cancel(r,`job: ${r} was aborted on signal from caller: ${n?.ref}`))).subscribe(t=>e.next(t))),t.add(()=>{this.complete()})}),this.#ie=e;const r=ya.request(t,{ref:n?.ref,retry:n?.retry});this.#oe=r.meta.transaction,this.#ie.next(r)}complete(e){this.closed||this.cancel(e??`job: ${this.transaction} was completed`)}cancel(e){const t=this.transaction;this.#ie.cancel(t,e??`job: ${t} was canceled`)}[Symbol.dispose](){this.complete()}}class wa{type;transaction;data;constructor(e,t,n){this.type=e,this.transaction=t,this.data=n}}class La extends Hr{#ne;#se;#ae;_registerEvent(e,t,n){this.#ae.next(new wa(e,t,n))}get closed(){return this.#ne.closed}get state$(){return this.#ne.asObservable()}get action$(){return this.#ne.action$}get event$(){return this.#ae.asObservable()}get success$(){return this.action$.pipe(Wi(ya.execute.success.match),Fi(({payload:e})=>e))}get error$(){return this.action$.pipe(fa("client/error"),co(this.#ne),Fi(([e,t])=>{const{payload:n,meta:{transaction:r}}=e,i=t[r];return new Jo("error",{request:i,message:`job: ${r} failed`,cause:n})}))}constructor(e,t){super(e=>this.#ne.subscribe(e)),this.#ne=new pa(((e={})=>va(e,e=>{e.addCase(ya.request,(e,t)=>{e[t.meta.transaction]={...t.payload,...t.meta,execution:[],errors:[],status:"idle"}}),e.addCase(ya.execute,(e,t)=>{const n=e[t.payload];n&&(n.execution.push(Date.now()),n.status="active")}),e.addCase(ya.execute.success,(e,t)=>{delete e[t.payload.transaction]}),e.addCase(ya.execute.failure,(e,t)=>{const n=e[t.meta.transaction];n&&(n.errors.push(t.payload.error),n.status="failed")}),e.addCase(ya.error,(e,t)=>{delete e[t.meta.transaction]}),e.addCase(ya.cancel,(e,t)=>{delete e[t.meta.transaction]})}))({})),this.#se=new Nr(()=>{this.#ne.complete(),this.#ae.complete()}),this.#ae=new Kr,this.#se.add(this.#ne.addFlow(Ea)),this.#se.add(this.#ne.addFlow((e=>(t,n)=>t.pipe(Wi(ya.execute.match),co(n),Mi(([n,r])=>{const i=n.payload,o=r[i],s=new AbortController,a=t.pipe(Wi(ya.cancel.match),Wi(e=>e.payload.transaction===i),ao(()=>{s.signal.aborted||s.abort()}));try{return Ni(e(o.args,s.signal)).pipe(Fi(e=>ya.execute.success({...o,status:"complete",completed:Date.now(),value:e})),Yi(e=>Oi(ya.execute.failure(e,i))),so(a))}catch(e){return Oi(ya.execute.failure(e,i))}})))(e))),this.#se.add(this.#ne.addFlow((e=>(t,n)=>t.pipe(Wi(ya.execute.failure.match),co(n),Mi(([t,r])=>{const{transaction:i}=t.meta,o=r[i];if(!o)return Oi(ya.error(i,new Jo("error",{message:"request not found, cannot retry request, most likely removed while scheduled for retry!"})));const s=o.execution.length,a=Object.assign({},e,o.options?.retry),c=o.errors?.slice(-1)[0]??new Jo("error",{message:"no errors registered for request!",request:o});if(s>a.count){const e=0===a.count?c:new Jo("error",{message:"maximum retries executed!",cause:o.errors,request:o});return Oi(ya.error(i,e))}return("function"==typeof a.delay?Ni(a.delay(c)).pipe(Yi(e=>Oi(ya.error(i,new Jo("error",{message:"retry delay callback failed!",cause:[...o.errors??[],e],request:o}))))):Vi(a.delay)).pipe(co(n),Wi(([e,t])=>!!t[i]),ao(([,e])=>{if(!e[i])throw new Jo("error",{message:"request not found, most likely removed while scheduled for retry",cause:o.errors,request:o})}),Fi(()=>ya.execute(i)))})))(Object.assign({count:0,delay:0},t?.retry)))),this.#ne.addEffect(ya.request.type,({payload:e,meta:{transaction:t}})=>{this._registerEvent("query_client_job_requested",t,e)}),this.#ne.addEffect(ya.execute.type,({meta:{transaction:e}})=>{this._registerEvent("query_client_job_executing",e)}),this.#ne.addEffect(ya.execute.success.type,({payload:e,meta:{transaction:t}})=>{this._registerEvent("query_client_job_completed",t,{payload:e})}),this.#ne.addEffect(ya.execute.failure.type,({payload:e,meta:{transaction:t}})=>{const n=e.error instanceof Error?e.error:new Error(String(e.error));this._registerEvent("query_client_job_failed",t,{error:n})}),this.#ne.addEffect(ya.cancel.type,({payload:{reason:e},meta:{transaction:t}})=>{this._registerEvent("query_client_job_canceled",t,{reason:e||"no reason provided"})}),this.#ne.addEffect(ya.error.type,({payload:e,meta:{transaction:t}})=>{const n=e.error instanceof Error?e.error:new Error(String(e.error));this._registerEvent("query_client_job_error",t,{error:n})})}next(e){this.#ne.next(e)}query(e,t){const n=new ba(this,e,t),r=n.pipe(function(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new Kr}:t,r=e.resetOnError,i=void 0===r||r,o=e.resetOnComplete,s=void 0===o||o,a=e.resetOnRefCountZero,c=void 0===a||a;return function(e){var t,r,o,a=0,l=!1,u=!1,f=function(){null==r||r.unsubscribe(),r=void 0},p=function(){f(),t=o=void 0,l=u=!1},d=function(){var e=t;p(),null==e||e.unsubscribe()};return Vr(function(e,h){a++,u||l||f();var m=o=null!=o?o:n();h.add(function(){0!==--a||u||l||(r=io(d,c))}),m.subscribe(h),!t&&a>0&&(t=new Br({next:function(e){return m.next(e)},error:function(e){u=!0,f(),r=io(p,i,e),m.error(e)},complete:function(){l=!0,f(),r=io(p,s),m.complete()}}),wi(e).subscribe(t))})(e)}}({connector:()=>new ei,resetOnRefCountZero:!1}));return Object.defineProperties(r,{transaction:{get:()=>n.transaction},created:{get:()=>n.created},status:{get:()=>n.status},closed:{get:()=>n.closed},cancel:{value:e=>n.cancel(e)},complete:{value:()=>n.complete()}}),r}async nextAsync(e,t){return Ti(this.query(e,t))}getRequest(e){return this.#ne.value[e]}getRequestByRef(e){return Object.values(this.#ne.value).find(t=>t.ref===e)}cancelTaskByRef(e,t){const n=this.getRequestByRef(e);n?.ref&&this.cancel(n.transaction,t)}cancel(e,t){if(e)this.#ne.value[e]&&(t??=`cancelation requested for job: ${e}`,this.#ne.next(ya.cancel(e,t)));else for(const e of Object.keys(this.#ne.value))this.cancel(e,"all transactions requested canceled")}on(e,t){return this.#ne.addEffect(ya[e].type,e=>{t(e,this)})}complete(){this.#se.unsubscribe()}}const Sa={set:da("cache/set",(e,t)=>({payload:{key:e,record:t}})),insert:da("cache/insert",(e,t)=>({payload:{key:e,entry:t}})),remove:da("cache/remove",e=>({payload:e})),invalidate:da("cache/invalidate",(e,t)=>({payload:e,meta:{item:t}})),mutate:da("cache/mutate",(e,t,n)=>({payload:{...t,key:e},meta:{item:n}})),trim:da("cache/trim",e=>({payload:e}))},Ca=(e,t)=>(t.updated??0)-(e.updated??0);class Ia{type;key;data;constructor(e,t,n){this.type=e,this.key=t,this.data=n}}class _a{#ne;#ae;get state(){return this.#ne.value}get state$(){return this.#ne.asObservable()}get action$(){return this.#ne.action$}_registerEvent(e,t){this.#ae.next(new Ia(e,t?.key,t?.data))}get event$(){return this.#ae.asObservable()}constructor(e){const{trimming:t,initial:n}=e??{};this.#ne=new pa(function(e,t={}){return va(t,t=>t.addCase(e.set,(e,t)=>{const{key:n,record:r}=t.payload;e[n]=r}).addCase(e.insert,(e,t)=>{const{key:n,entry:r}=t.payload,i=e[n];if(i)i.updated=Date.now(),i.updates??=0,i.updates++,i.value=r.value,i.transaction=r.transaction,i.mutated=void 0;else{const t=Date.now();e[n]={...r,created:t,updated:t}}}).addCase(e.remove,(e,t)=>{delete e[t.payload]}).addCase(e.invalidate,(e,t)=>{const n=t.payload?[t.payload]:Object.keys(e);for(const t of n){const n=e[t];n&&(n.updated=void 0)}}).addCase(e.mutate,(e,t)=>{const{key:n,value:r,updated:i}=t.payload,o=e[n];o&&(o.value=r,o.updated=i,o.mutated=Date.now(),o.updates??=0,o.updates++)}).addCase(e.trim,(e,t)=>{const{payload:n}=t,r=n.sort??Ca,i=Object.keys(e),o=Object.entries(e).filter(([e,t])=>!n.validate||n.validate(t)).sort((e,t)=>r(e[1],t[1])).slice(0,n.size??Number.MAX_SAFE_INTEGER).map(([e])=>e);if(i.length!==o.length)for(const t of i){const n=o.indexOf(t);-1!==n?o.splice(n,1):delete e[t]}}))}(Sa,n)),t&&this.#ne.addEffect("cache/set",()=>this.#ne.next(Sa.trim(t))),this.#ae=new Kr}has(e){return e in this.#ne.value}setItem(e,t){const{args:n,transaction:r,value:i}=t;this.#ne.next(Sa.insert(e,{args:n,transaction:r,value:i})),this._registerEvent("query_cache_entry_inserted",{key:e,data:{value:i,args:n,transaction:r}})}getItem(e){return this.#ne.value[e]}removeItem(e){this.#ne.next(Sa.remove(e)),this._registerEvent("query_cache_entry_removed",{key:e})}invalidate(e){const t=e?this.#ne.value[e]:void 0;this.#ne.next(Sa.invalidate(e,t)),e&&this._registerEvent("query_cache_entry_invalidated",{key:e,data:{previousValue:t?.value}})}mutate(e,t){const n=e in this.#ne.value?this.#ne.value[e]:void 0;if(!n)throw new Error(`Cannot mutate cache item with key ${e}: item not found`);const r="function"==typeof t?t(n?.value):t;return this.#ne.next(Sa.mutate(e,r,n)),this._registerEvent("query_cache_entry_mutated",{key:e,data:{previousValue:n.value,newValue:r,mutation:r}}),()=>this.#ne.next(Sa.set(e,n))}trim(e){const t=new Set(Object.keys(this.#ne.value));this.#ne.next(Sa.trim(e));const n=new Set(Object.keys(this.#ne.value)),r=Array.from(t).filter(e=>!n.has(e));this._registerEvent("query_cache_trimmed",{data:{removedKeys:r,criteria:e}})}reset(){this.#ne.reset(),this._registerEvent("query_cache_reset")}complete(){this.#ne.complete(),this.#ae.complete()}}class Da extends Kr{key;args;options;#ce=Date.now();get created(){return this.#ce}#le=Wo();get uuid(){return this.#le}constructor(e,t,n){super(),this.key=e,this.args=t,this.options=n}processJob(e){return e.pipe(Fi(t=>{const{key:n,uuid:r,created:i}=this;return{key:n,uuid:r,created:i,status:"complete",transaction:e.transaction,complete:t.completed,value:t.value}}),no(()=>{e.complete()})).subscribe(this)}}class Na{type;key;data;constructor(e,t,n){this.type=e,this.key=t,this.data=n}}class Oa{static extractQueryValue=ko;#se=new Nr;#ie;#ue;#fe=new Kr;#pe={};#de;#he;#me=Wo();#ee;get client(){return this.#ie}_registerEvent(e,t,n){this.#ee.next(new Na(e,t,n))}get cache(){return this.#ue}get event$(){return this.#ee.asObservable()}constructor(e){this.#ee=new Kr,this.#de=t=>Xo(e.key(t),this.#me),this.#he=e?.validate??((e=0)=>t=>(t.updated??0)+e>Date.now())(e?.expire),e.client instanceof La?this.#ie=e.client:(this.#ie=new La(e.client.fn,{...e.client.options}),this.#se.add(()=>this.#ie.complete())),this.#se.add(this.#ie.event$.subscribe({next:e=>this.#ee.next(e)})),e.cache instanceof _a?this.#ue=e.cache:(this.#ue=new _a(e.cache||{}),this.#se.add(()=>this.#ue.complete())),this.#se.add(this.#ue.event$.subscribe({next:e=>this.#ee.next(e)}));const t=((e="switch")=>"function"==typeof e?e:(()=>{switch(e){case"concat":return xo;case"merge":return $o;case"switch":return Fo;default:throw new Error(`Invalid queue operator: ${e}`)}})())(e.queueOperator);var n,r;this.#se.add(()=>this.#fe.complete()),this.#se.add(this.#fe.pipe(ao(e=>{this._registerEvent("query_queued",e)}),Wi(e=>!!(e in this.#pe)),t(e=>{const t=this.#pe[e],{args:n,options:r,uuid:i}=t;if(this._registerEvent("query_job_selected",e,{taskId:i,args:n,options:r}),!t?.observed)return this._registerEvent("query_job_skipped",e,{taskId:i,args:n,options:r}),delete this.#pe[e],li;const o=this.#ie.query(n,{...r,ref:t.uuid});return new Hr(s=>{const{transaction:a}=o;var c,l;this._registerEvent("query_job_started",e,{taskId:i,transaction:a,args:n,options:r}),s.add(()=>{this._registerEvent("query_job_closed",e,{taskId:i,transaction:a,args:n,options:r}),o.complete("task closed"),delete this.#pe[e]}),s.add((c=10,void 0===l&&(l=ai),Vi(c,c,l)).pipe(Wi(()=>!t.observed)).subscribe(()=>{o.cancel(`task: ${t.uuid} is not observed`),s.complete()})),s.add(t.processJob(o).add(()=>{this._registerEvent("query_job_completed",e,{taskId:i,transaction:a,args:n,options:r})})),o.pipe(Fi(e=>({result:e,task:t})),Yi(()=>li)).subscribe(s)})}),(n=()=>!this.#ie.closed,void 0===r&&(r=!1),Vr(function(e,t){var i=0;e.subscribe(Wr(t,function(e){var o=n(e,i++);(o||r)&&t.next(e),!o&&t.complete()}))}))).subscribe(e=>{const{value:t,transaction:n}=e.result,{args:r,key:i,uuid:o}=e.task;this._registerEvent("query_cache_added",i,{data:t,taskId:o,args:r,transaction:n}),this._registerEvent("query_completed",i,{data:t,hasValidCache:!0}),this.#ue.setItem(i,{value:t,args:r,transaction:n})}))}query(e,t){return this._query(e,t)}queryAsync(e,t){const{skipResolve:n,...r}=t||{},i=n?Ti:Pi;return new Promise((n,o)=>{t?.signal&&t.signal.addEventListener("abort",()=>o(new Error("Query aborted"))),i(this._query(e,r).pipe(eo())).then(n,o)})}persistentQuery(e,t){const n=this.#de(e),r=this._query(e,t);return new Hr(i=>{i.add(r.subscribe({next:i.next.bind(i),error:i.error.bind(i)}));const o=t?.cache?.validate||this.#he;i.add(this.cache.state$.pipe(Wi(e=>n in e),Fi(t=>({...t[n],key:n,status:"cache",hasValidCache:o(t[n],e)}))).subscribe(i))}).pipe(Ji((e,t)=>e.transaction===t.transaction&&e.mutated===t.mutated))}generateCacheKey(e){return this.#de(e)}mutate(e,t,n){const r=this.#de(e);if(r in this.cache.state==!1){if(void 0===n?.allowCreation)throw new Error(`Cannot mutate cache item with key ${r}: item not found and option "allowCreation" is false`);if(!1===n.allowCreation)return()=>{};const{value:i}="function"==typeof t?t():t;this.cache.setItem(r,{args:e,transaction:Wo(),value:i})}return this.#ue.mutate(r,t)}invalidate(e){this.#ue.invalidate(e&&this.#de(e))}complete(){this.#se.unsubscribe(),this.#ee?.complete()}onInvalidate(e){const t=this.#ue.action$.pipe(fa("cache/invalidate")).subscribe(t=>e({detail:{item:t.meta.item}}));return()=>t.unsubscribe()}onMutate(e){const t=this.#ue.action$.pipe(fa("cache/mutate")).subscribe(t=>e({detail:{changes:t.payload,current:t.meta.item}}));return()=>t.unsubscribe()}_query(e,t){const n=this.#de(e),r=this._createTask(n,e,t);return this._registerEvent("query_created",n,{args:e,options:t}),r}_createTask(e,t,n){return new Hr(r=>{if(n?.signal){if(n?.signal.aborted)return this._registerEvent("query_aborted",e),r.complete();r.add(Hi(n?.signal,"abort").subscribe(()=>{this._registerEvent("query_aborted",e),r.complete()}))}const i=this.#ue.getItem(e);if(i){this._registerEvent("query_cache_hit",e,{cacheEntry:i});const o=n?.cache?.suppressInvalid??!1,s=(n?.cache?.validate||this.#he)(i,t),a={...i,key:e,status:"cache",hasValidCache:s};if(r.next(a),s||o)return this._registerEvent("query_completed",e,{data:i.value,hasValidCache:s}),r.complete();this._registerEvent("query_cache_miss",e)}const o=e in this.#pe;o?this._registerEvent("query_connected",e,{isExistingTask:!0}):(this.#pe[e]=new Da(e,t,n),this._registerEvent("query_job_created",e,{taskId:this.#pe[e].uuid,args:t,options:n}));const s=this.#pe[e];r.add(s.subscribe(r)),o||this.#fe.next(e)})}}const Aa=T.object({key:T.string().describe("The key used to identify the service"),uri:T.string().describe("The URI of the service"),id:T.string().optional().describe("The ID of the service"),environment:T.string().optional().describe("The environment of the service"),name:T.string().optional().describe("The name of the service"),scopes:T.array(T.string()).optional().default([]).describe("Endpoint authentication scopes"),tags:T.array(T.string()).optional().describe("Tags for the service")}).describe("A service from the service discovery API").transform(e=>({...e,get defaultScopes(){return e.scopes??[]}})),Pa=T.array(Aa).describe("A list of services from the service discovery API"),Ta=e=>Ni(_o(e)).pipe(Fi(e=>Pa.default([]).parse(e)));class Ra{#ge;endpoint;http;constructor({http:e,endpoint:t}){this.http=e,this.endpoint=t,this.#ge=new Oa({client:{fn:()=>e.fetch$(t??"",{selector:Ta})},key:()=>"services",expire:3e5})}resolveServices(e){return(e?Ti:Pi)(Oa.extractQueryValue(this.#ge.query()))}async resolveService(e,t){const n=(await this.resolveServices(t)).find(t=>t.key===e);if(!n)throw Error(`Failed to resolve service, invalid key [${e}]`);return n}}class xa extends uo{async _createConfig(e,t){if(!e.hasModule("http"))throw new Error("http module is required");if(!this._has("discoveryClient")){(await e.requireInstance("http")).hasClient("service_discovery")&&this.configureServiceDiscoveryClientByClientKey("service_discovery")}return Pi(Ni(super._createConfig(e,t)))}_processConfig(e,t){if(!e.discoveryClient)throw new Error("discoveryClient is required, please configure it");return super._processConfig(e,t)}setServiceDiscoveryClient(e){this._set("discoveryClient","function"==typeof e?e:async()=>e)}configureServiceDiscoveryClient(e){this.setServiceDiscoveryClient(async t=>{const{httpClient:n,endpoint:r}=await Pi(Ni(e(t)))??{};if(n)return new Ra({http:n,endpoint:r});throw Error("httpClient is required")})}configureServiceDiscoveryClientByClientKey(e,t){this.configureServiceDiscoveryClient(async({requireInstance:n})=>({httpClient:(await n("http")).createClient(e),endpoint:t}))}}class $a extends po{config;_http;constructor(e,t){super({version:"9.0.5",config:e}),this.config=e,this._http=t}resolveServices(){return this.config.discoveryClient.resolveServices()}async resolveService(e){return this.config.discoveryClient.resolveService(e)}async createClient(e,t){const n=await this.resolveService(e);if(!n)throw Error(`Could not load configuration of service [${e}]`);return this._http.createClient({...t,baseUri:n.uri,defaultScopes:n.scopes})}async configureClient(e,t){const{key:n,alias:r}="string"==typeof e?{key:e,alias:e}:e,{uri:i,scopes:o}=await this.resolveService(n);var s,a;t.addConfig((s=r,a={baseUri:i,defaultScopes:o},{module:Ro,configure:e=>{e.configureClient(s,a)}}))}}const Fa={name:"serviceDiscovery",configure:()=>new xa,initialize:async e=>{const{requireInstance:t,ref:n}=e,r=await e.config.createConfigAsync(e,{...n?.serviceDiscovery?.config}),i=await t("http");return new $a(r,i)}},ka=(e,t)=>{e.addConfig((e=>({module:Fa,configure:t=>e(t)}))(()=>Promise.resolve()))};var Ua,Ba,Ma,Ga={},ja=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Cloudflare Pages",constant:"CLOUDFLARE_PAGES",env:"CF_PAGES"},{name:"Cloudflare Workers",constant:"CLOUDFLARE_WORKERS",env:"WORKERS_CI"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}];function za(){return Ua||(Ua=1,function(e){const t=ja,n=process.env;function r(e){return"string"==typeof e?!!n[e]:"env"in e?n[e.env]&&n[e.env].includes(e.includes):"any"in e?e.any.some(function(e){return!!n[e]}):Object.keys(e).every(function(t){return n[t]===e[t]})}Object.defineProperty(e,"_vendors",{value:t.map(function(e){return e.constant})}),e.name=null,e.isPR=null,e.id=null,"false"!==n.CI&&t.forEach(function(t){const i=(Array.isArray(t.env)?t.env:[t.env]).every(function(e){return r(e)});e[t.constant]=i,i&&(e.name=t.name,e.isPR=function(e){switch(typeof e.pr){case"string":return!!n[e.pr];case"object":return"env"in e.pr?"any"in e.pr?e.pr.any.some(function(t){return n[e.pr.env]===t}):e.pr.env in n&&n[e.pr.env]!==e.pr.ne:"any"in e.pr?e.pr.any.some(function(e){return!!n[e]}):r(e.pr);default:return null}}(t),e.id=t.constant)}),e.isCI=!("false"===n.CI||!(n.BUILD_ID||n.BUILD_NUMBER||n.CI||n.CI_APP_ID||n.CI_BUILD_ID||n.CI_BUILD_NUMBER||n.CI_NAME||n.CONTINUOUS_INTEGRATION||n.RUN_ID||e.name))}(Ga)),Ga}var Ha=de(Ma?Ba:(Ma=1,Ba=za().isCI));const qa=["5a842df8-3238-415d-b168-9f16a6a6031b/.default"];var Va;!function(e){e.ContinuesIntegration="ci",e.QualityAssurance="fqa",e.Training="tr",e.Production="fprd",e.Development="dev"}(Va||(Va={}));const Wa=e=>e&&!Ha?Va.Development:Va.ContinuesIntegration,Ya=e=>{const t=new mo,n=e.env??Va.ContinuesIntegration;return t.addConfig({module:Ro,configure:t=>{const r=n===Va.Development?Va.ContinuesIntegration:n,i=e.serviceDiscovery?.url??new URL(`/service-registry/environments/${r}/services`,"https://discovery.fusion.equinor.com").toString(),o=e.serviceDiscovery?.scope??qa;t.configureClient("service_discovery",{baseUri:i,defaultScopes:o})}}),ka(t),G(t,t=>{const{auth:n}=e;if("token"in n&&n.token){const{token:e}=n;return t.setMode("token_only"),void t.setAccessToken(e)}const{clientId:r,tenantId:i,interactive:o}=n;if(!r||!i)throw new Error("clientId and tenantId are required for auth module");if(t.setClientConfig(i,r),t.setMode(o?"interactive":"silent"),o){const{server:e}=n;if(!e.port)throw new Error("server.port is required for interactive mode");t.setServerPort(e.port),t.setServerOnOpen(e.onOpen)}}),t},Za=async e=>{const t=Ya(e);return await t.initialize()},Ka=async e=>{const{log:t}=e,{config:n}=await cr({log:t,config:e.config,env:{environment:e.environment}}),{manifest:r}=await tn({log:t,manifest:e.manifest,env:{environment:e.environment}}),i=r.build?.version;if(!i){const e=new Error("No build version found in the manifest. Please make sure the manifest is valid.");throw t?.fail("🤪",e.message),e}t?.start("Initializing Fusion Framework...");const o=await Za({env:e.environment,auth:e.auth});t?.succeed("Initialized Fusion Framework");const s=await o.serviceDiscovery.createClient("apps");s.request$.subscribe(e=>{t?.debug("Request:",e),t?.info("🌎","Executing request to:",Xt(e.uri))}),t?.start("Publishing application config"),t?.info("Using environment:",pe.redBright(e.environment));try{const e=await s.json(`/apps/${r.appKey}/builds/${i}/config`,{method:"PUT",body:n,headers:nr});t?.debug("Response:",e),t?.succeed("Published application config")}catch(e){if(e instanceof ur)switch(e.response.status){case 410:t?.fail("🤬",`App ${r.appKey} is deleted from apps-service. Please check the app key and try again.`);break;case 404:t?.fail("🤬",`App ${r.appKey} not found. Please check the app key and try again.`);break;case 403:case 401:t?.fail("🤬","You are not authorized to publish application config. Please check your permissions.");break;default:t?.fail("🤬","Failed to publish application config.",`Status code: ${e.response.status}`,`Message: ${e.response.statusText}`)}throw e}},Xa=async e=>{const{log:n}=e??{},r="@equinor/fusion-framework-dev-portal",o=await en(n),s={root:o.root,environment:"local",...e?.env,mode:"development",command:"serve"},a=await Qt(s,o,{log:n,manifestPath:e?.manifest}),c=await ar(s,{log:n,config:e?.config});let u,p;const d=f(import.meta.resolve(r));Nt(d)?(u=d,p=await l({cwd:d}).then(e=>e?i(e?.path):void 0)):n?.info(`Portal ${r} is external, skipping entry point resolution`);const h=await Tt(s,o),m=p?[o.root,p]:[o.root];n?.debug(`File system access allowed for: \n${m.join("\n")}\n`);const g=t(h,{server:{port:e?.port||3e3,host:e?.host||h.server?.host||"localhost",fs:{allow:m}}}),v={template:{portal:{id:r}},app:{manifest:a,config:c}};u&&(v.portal={manifest:{name:r,build:{templateEntry:u,assetPath:"/@fs"}},config:{}}),n?.debug("vite config:",g),n?.debug("dev server config:",v),n?.start("Starting app development server...");const y=await er(s,v,{overrides:g,log:n});await y.listen(),n?.succeed("App development server started successfully");const E=y.config.server.https?"https":"http",b=y.config.server.host||"localhost",w=y.config.server.port||5173;return n?.info(`App development server is running at: ${E}://${b}:${w}/apps/${a.appKey}`),y},Ja=async e=>{const{log:t}=e,n=await en(t),r=await Qt({command:"build",mode:"production"},n,{log:t});t?.start("Initializing Fusion Framework...");const i=await Za({env:e.environment,auth:"token"in e.auth?{token:e.auth.token}:e.auth});t?.succeed("Initialized Fusion Framework");const o=await i.serviceDiscovery.createClient("apps");o.request$.subscribe(e=>{t?.info("🌎","Executing request to:",e.uri),t?.debug("Request:",e)});try{t?.info("Checking if",r.appKey,"is registered in app store");const e=await o.fetch(`/apps/${r.appKey}`,{method:"HEAD",headers:nr});if(e.ok)return t?.succeed("😃",`Application ${r.appKey} is registered in app store`),!0;if(404===e.status)return t?.fail("😞",`Application ${r.appKey} is not registered in app store`),!1;if(410===e.status)return t?.fail("😞",`Application ${r.appKey} is deleted from app store`),!1;throw new Error(`Unexpected response status: ${e.status}`)}catch(e){return t?.fail("🙅♂️","Error checking application registration"),t?.error("Error checking application registration:",e),!1}},Qa=e=>{const t=e.getEntry("metadata.json");if(!t)throw new Error("Metadata file not found in bundle");return new Promise((e,n)=>{t.getDataAsync((t,r)=>{if(r)return n(new Error("Failed to read metadata file",{cause:r}));try{return e(JSON.parse(String(t)))}catch(e){n(new Error("Failed to parse metadata file",{cause:e}))}})})};const ec=async e=>{const{log:t,framework:n}=e,r="string"==typeof e.fileOrBundle?new Vn(e.fileOrBundle):e.fileOrBundle,{name:i}=e.appKey?{name:e.appKey}:await Qa(r).catch(e=>{t?.error("Failed to resolve manifest:",e),process.exit(1)});t?.info("📦",`Uploading application bundle for ${pe.bold(i)}`),t?.debug("Bundle contents:",(await r.getEntries()).map(e=>e.entryName));const o=await r.toBufferPromise().catch(e=>{t?.error("Failed to read bundle content:",e),process.exit(1)});try{const e=await n.serviceDiscovery.createClient("apps");e.request$.subscribe(e=>{t?.info("🌎","Executing request to:",e.uri),t?.debug("Request:",e)});const r=await e.fetch(`/bundles/apps/${i}`,{method:"POST",body:new Blob([o],{type:"application/zip"}),headers:{...nr,"Content-Type":"application/zip"}});if(!r.ok){try{const{error:e}=await r.json();t?.debug("Error:",e),e.message&&t?.warn(pe.red(`🤯 error: ${e.code}\n`),pe.yellowBright(e.message),"\n")}catch(e){t?.debug("Error:",r.statusText)}!function(e,t){switch(e.status){case 409:throw new Error(`${e.status} - Version is already published, please generate a new release`);case 410:throw new Error(`${e.status} - ${t} is removed from Fusion app store`);case 404:throw new Error(`${e.status} - ${t} not found, please add your application in App Admin before publishing`);case 401:case 403:throw new Error(`${e.status} - This is not allowed for your role on ${t}`);case 500:throw new Error(`${e.status} - Internal server error, please try again later or contact support`);default:throw new Error(`Failed to upload bundle. HTTP status ${e.status}, ${e.statusText}`)}}(r,i)}t?.succeed("Successfully uploaded application bundle"),t?.debug("Response:",r);try{return{name:i,version:(await r.json()).version}}catch(e){throw new Error(`Failed to parse response from app service: ${e instanceof Error?e.message:e}`)}}catch(e){t?.fail("🙅♂️","Failed to upload application bundle"),t?.error(e),process.exit(1)}},tc=async e=>{const{tag:t,appKey:n,version:r,framework:i,log:o}=e;t&&"string"==typeof t&&0!==t.trim().length||(o?.fail("🤪","Tag must be a non-empty string."),process.exit(1)),/^[a-zA-Z0-9.-]+$/.test(t)||(o?.fail("🤪",'Invalid tag. Use "latest", "preview" or string [a-z, A-Z, 0-9, ".", "-"].'),process.exit(1)),n||(o?.fail("🤪","Application key is required."),process.exit(1)),r||(o?.fail("🤪","Version is required."),process.exit(1));const s=await i.serviceDiscovery.createClient("apps");s.request$.subscribe(e=>{o?.debug("Request:",e),o?.info("🌎","Executing request to:",Xt(e.uri))}),o?.start("Publishing application config");try{const e=await s.json(`/apps/${n}/tags/${t}`,{method:"PUT",body:{version:r},headers:nr});return o?.debug("Response:",e),o?.succeed("Tagged application successfully",pe.greenBright(`${n}@${r} - ${t}`)),e}catch(e){if(e instanceof ur)switch(e.response.status){case 410:o?.fail("🤬",`App ${n} is deleted from apps-service. Please check the app key and try again.`);break;case 404:o?.fail("🤬",`App ${n} not found. Please check the app key and try again.`);break;case 403:case 401:o?.fail("🤬","You are not authorized to tag application. Please check your permissions.");break;default:o?.fail("🤬","Failed to tag application",`Status code: ${e.response.status}`,`Error: ${e.message}`)}throw e}},nc=R.object({templateEntry:R.string({message:"templateEntry must be a string"}).describe("Main entry point for the portal"),schemaEntry:R.string({message:"schemaEntry must be a string"}).describe("Schema file for portal validation"),assetPath:R.string({message:"assetPath must be a string"}).optional().describe("Asset path for dev/preview builds"),githubRepo:R.string({message:"githubRepo must be a string"}).optional().describe("GitHub repo URL or local git remote"),version:R.string({message:"version must be a string"}).describe("Version from package.json"),timestamp:R.string({message:"timestamp must be a string"}).describe("Current build timestamp (ISO8601)"),commitSha:R.string({message:"commitSha must be a string"}).describe("Current git commit SHA"),annotations:R.record(R.string(),R.string()).optional().describe("Optional build annotations"),projectPage:R.string({message:"projectPage must be a string"}).optional().describe("Optional project homepage"),allowedExtensions:R.array(R.string({message:"Each allowed extension must be a string"}),{message:"allowedExtensions must be an array of strings"}).describe("List of allowed asset extensions (with leading dot)"),schema:R.record(R.string(),R.unknown()).optional().describe("Optional schema for the portal"),config:R.record(R.string(),R.unknown()).optional().describe("Optional configuration for the portal")}),rc=R.object({name:R.string({message:"name must be a string"}).describe("Short app key (unscoped, derived from package name)"),displayName:R.string({message:"displayName must be a string"}).optional().describe("Full package name, may include scope"),description:R.string({message:"description must be a string"}).optional().describe("Description of the portal"),build:nc}),ic=(e,t)=>{Rt(t,"expected packageJson"),D(t.name,"expected [name] in packageJson"),D(t.version,"expected [version] in packageJson");const n=((e,t)=>"build"===e.command||e.isPreview?t.main||t.module||"dist/bundle.js":At(e.root))(e,t),r=t.name.replace(/^@|\w.*\//gm,""),i=t.version,o="build"===e.command?void 0:"/@fs",s=xt(t)??$t(),a={name:r,displayName:t.name,description:t.description||"",build:{templateEntry:n,schemaEntry:"portal.schema.json",assetPath:o,githubRepo:s,version:i,timestamp:(new Date).toISOString(),commitSha:Ft(),annotations:{...Ut()},projectPage:t.homepage,allowedExtensions:Bt.map(e=>`.${e}`)}},c=rc.safeParse(a);if(!c.success){const e=c.error.issues.map(e=>`- ${e.path.join(".")}: ${e.message}`).join("\n");throw new Error(["Invalid portal manifest generated from package.json:",e].join("\n"))}return c.data},oc=async(e,t,n)=>{const r=ic(e,t.packageJson);try{n?.log?.start("loading manifest...");const t=await(async(e,t)=>{const n=t?.file??[`portal.manifest.${e.environment}`,"portal.manifest"],r=await C(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async n=>{const r=t?.base??{};let i;return i="function"==typeof n.default?await n.default(e,{base:r})??void 0:n.default,i?_(r,i):r}}}),i=r.config,o=rc.safeParse(i);if(!o.success)throw new Error(`Invalid portal manifest: ${o.error.issues.map(e=>`${e.path.join(".")}: ${e.message}`).join("; ")}`);return{manifest:i,path:r.path,extension:r.extension}})(e,{base:r});return n?.log?.succeed("generated manifest from",Xt(t.path,{relative:!0})),t.manifest}catch(e){if(e instanceof I){if(n?.manifestPath){const t=new Error(`Failed to load manifest file ${Xt(n.manifestPath)}, please check the path.`,{cause:e});throw n?.log?.fail(t.message),t}return n?.log?.succeed(pe.dim("no local manifest config applied, using default generated from package")),r}throw n?.log?.fail(`failed to resolve application manifest ${n?.manifestPath?Xt(n?.manifestPath):""}`),e}},sc=async(e,t)=>{const{log:n}=t;try{n?.start("create portal configuration"),n?.info(`generating config with ${pe.red.dim(e.command)} command in ${pe.green.dim(e.mode)} mode`);const r=await((e,t)=>{const n=t?.file??[`portal.config.${e.environment}`,"portal.config"];return C(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async n=>{const r=t?.schema??T.object({}).passthrough(),i=t?.base??{};if("function"==typeof n.default){const t=await n.default(i,e)??i;return r.parse(t)}return r.parse(n.default??i)}}})})(e,{file:t?.config});return n?.succeed("⚙️ generated config from ",Xt(r.path,{relative:!0})),r.config}catch(e){if(e instanceof I){if(!t.config)return n?.succeed(pe.dim("⚙️ no local portal config applied, using built-in")),{};n?.warn(`failed to load config file ${Xt(t.config)}, please check the path.`)}throw n?.fail("failed to resolve portal config"),n?.debug(e),e}},ac=async e=>{const{log:n}=e??{},r=await en(n),i={root:r.root,environment:"local",...e?.env,mode:"development",command:"serve"},o=await oc(i,r,{log:n,manifestPath:e?.manifest}),s=await sc(i,{log:n,config:e?.config}),a=t(await Tt(i,r),{server:{port:e?.server?.port,fs:{allow:[r.root]}}}),c={template:{portal:{id:o.name}},portal:{manifest:o,config:s}};n?.debug("vite config:",a),n?.debug("dev server config:",c),n?.start("Starting app development server...");const l=await er(i,c,{overrides:a,log:n});return await l.listen(),n?.succeed(`Started app development server on ${l.resolvedUrls?.local?.[0]}`),l},cc=async e=>{const{log:t}=e??{},n=await en(t);t?.debug("package",n);const r={command:"build",mode:process.env.NODE_ENV??"production",root:n.root,...e?.env};t?.debug("env:",r);const i=await oc(r,n,{log:t,manifestPath:e?.manifest});return t?.debug("manifest:",i),{manifest:i,pkg:n,env:r}},lc=async e=>{const{log:t}=e??{};t?.log(pe.bold("Starting to build portal"));const{manifest:r,pkg:i,env:o}=await cc({log:t,manifest:e?.manifest});t?.start("loading vite config...");const s=await Tt(o,i);t?.succeed("vite config applied"),t?.debug("vite config:",s),t?.start("🤞🏻","building portal..."),t?.startNativeConsoleCapture(),await n(s),t?.stopNativeConsoleCapture(),t?.succeed("build completed 😘");return{pkg:i,manifest:r,outDir:s.build.outDir}},uc=async e=>{const{log:t,manifest:n}=e,r={command:"build",mode:process.env.NODE_ENV??"production",environment:null,root:process.cwd()},{pkg:i,manifest:o}=await lc({log:t,manifest:n});if(!o.build)throw new Error("Manifest build config not found");const s=await(async(e,t)=>{const n=t?.file??[`portal.schema.${e.environment}`,"portal.schema"],r=await C(n,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async t=>{const n="function"==typeof t.default?await Promise.resolve(t.default(e)):t.default;if(!n)throw new Error("Schema function did not return a valid schema");return n}}});return{schema:r.config,path:r.path,extension:r.extension}})(r,{file:e?.schema});t?.debug("Schema:",s);return{archive:await or(i,{log:t,archive:e?.archive,content:{"portal-template-manifest.json":JSON.stringify(o.build,null,2),"portal.schema.json":JSON.stringify(s.schema,null,2),"metadata.json":JSON.stringify({name:o.name,version:o.build.version})}}).catch(e=>{t?.error("Failed to create package:",e),process.exit(1)}),manifest:o,schema:s.schema}},fc=async e=>{const{log:t}=e??{},n=await en(t),r={command:"build",mode:process.env.NODE_ENV??"production",root:n.root,...e?.env},i=await sc(r,{log:t,config:e?.config});if(t?.debug("config:",i),e?.output){t?.start("writing config to file");try{await rr(e.output,JSON.stringify(i,null,2)),t?.succeed("config written successfully",Xt(e.output,{relative:!0}))}catch(e){throw t?.fail("failed to write config"),e}}return{config:i,pkg:n}},pc=async e=>{const{log:t,portal:n}=e,{config:r}=await fc({log:t,config:e.config,env:{environment:e.environment}});t?.start("Initializing Fusion Framework...");const i=await Za({env:e.environment,auth:e.auth});t?.succeed("Initialized Fusion Framework");const o=await i.serviceDiscovery.createClient("portals");o.request$.subscribe(e=>{t?.debug("Request:",e),t?.info("🌎","Executing request to:",Xt(e.uri))}),t?.start("Publishing portal config"),t?.info("Using environment:",pe.redBright(e.environment));try{const e=await o.json(`/portals/${n.name}@${n.version}/config`,{method:"PUT",body:r,headers:nr});t?.debug("Response:",e),t?.succeed("Published portal config")}catch(e){if(e instanceof ur)switch(e.response.status){case 410:t?.fail("🤬",`Portal ${n.name} is deleted from portals-service. Please check the portal key and try again.`);break;case 404:t?.fail("🤬",`Portal ${n.name} not found. Please check the portal key and try again.`);break;case 403:case 401:t?.fail("🤬","You are not authorized to publish portal config. Please check your permissions.");break;default:t?.fail("🤬","Failed to publish portal config.",`Status code: ${e.response.status}`,`Message: ${e.response.statusText}`)}throw e}};const dc=async e=>{const{log:t,framework:n}=e,r="string"==typeof e.fileOrBundle?new Vn(e.fileOrBundle):e.fileOrBundle,{name:i}=e.name?{name:e.name}:await Qa(r).catch(e=>{t?.error("Failed to resolve manifest:",e),process.exit(1)}),o=await r.toBufferPromise().catch(e=>{t?.error("Failed to read bundle content:",e),process.exit(1)});try{const e=await n.serviceDiscovery.createClient("portal-config");e.request$.subscribe(e=>{t?.info("🌎","Executing request to:",e.uri),t?.debug("Request:",e)});const r=await e.fetch(`/bundles/templates/${i}`,{method:"POST",body:new Blob([o],{type:"application/zip"}),headers:{...nr,"Content-Type":"application/zip"}});if(!r.ok){try{const{error:e}=await r.json();t?.debug("Error:",e),e.message&&t?.warn(pe.red(`🤯 error: ${e.code}\n`),pe.yellowBright(e.message),"\n")}catch(e){t?.debug("Error:",r.statusText)}!function(e,t){switch(e.status){case 409:throw new Error(`${e.status} - Version is already published, please generate a new release`);case 410:throw new Error(`${e.status} - ${t} is removed from Fusion`);case 404:throw new Error(`${e.status} - ${t} not found`);case 401:case 403:throw new Error(`${e.status} - This is not allowed for your role on ${t}`);case 500:throw new Error(`${e.status} - Internal server error, please try again later or contact support`);default:throw new Error(`Failed to upload bundle. HTTP status ${e.status}, ${e.statusText}`)}}(r,i)}t?.succeed("Successfully uploaded portal bundle"),t?.debug("Response:",r)}catch(e){t?.fail("🙅♂️","Failed to upload portal bundle"),t?.error(e),process.exit(1)}},hc=async e=>{const{tag:t,name:n,version:r,framework:i,log:o}=e;t&&"string"==typeof t&&0!==t.trim().length||(o?.fail("🤪","Tag must be a non-empty string."),process.exit(1)),/^[a-zA-Z0-9.-]+$/.test(t)||(o?.fail("🤪",'Invalid tag. Use "latest", "preview" or string [a-z, A-Z, 0-9, ".", "-"].'),process.exit(1)),n||(o?.fail("🤪","Portal name is required."),process.exit(1)),r||(o?.fail("🤪","Version is required."),process.exit(1)),o?.info("Tagging portal:",pe.greenBright(`${n}@${t}`,r));const s=await i.serviceDiscovery.createClient("portal-config");s.request$.subscribe(e=>{o?.debug("Request:",e),o?.info("🌎","Executing request to:",Xt(e.uri))}),o?.start("Tagging portal template...");try{const e=await s.json(`/templates/${n}/tags/${t}`,{method:"PUT",body:{version:r},headers:nr});o?.debug("Response:",e),o?.succeed("Tagged portal template successfully"),o?.info("🚀",JSON.stringify(e))}catch(e){if(e instanceof ur){const{data:t,response:r}=e;switch(o?.debug("Error:",t),t&&o?.warn(pe.red(`🤯 error: ${t.code}\n`),pe.yellowBright(t.message),"\n"),r?.status){case 410:o?.fail(`🤬 - ${r?.status} -`,`${n} is deleted. Please check the name and try again.`);break;case 404:o?.fail(`🤬 - ${r?.status} -`,`${n} not found. Please check the name and try again.`);break;case 403:case 401:o?.fail(`🤬 - ${r?.status} -`,"You are not authorized to tag. Please check your permissions.");break;default:o?.fail(`🤬 - ${r?.status} -`,"Failed to tag",`Error: ${e.message}`)}}throw e}};export{Xn as ConsoleLogger,Va as FusionEnv,nn as buildApplication,lc as buildPortal,sr as bundleApp,uc as bundlePortal,Ja as checkApp,Ya as configureFramework,cr as generateApplicationConfig,fc as generatePortalConfig,Za as initializeFramework,tn as loadAppManifest,cc as loadPortalManifest,or as pack,Ka as publishAppConfig,pc as publishPortalConfig,Wa as resolveDefaultEnv,Xa as startAppDevServer,ac as startPortalDevServer,tc as tagApplication,hc as tagPortal,ec as uploadApplication,dc as uploadPortalBundle};
|