@equinor/fusion-framework-cli 11.1.0 → 11.1.2

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 CHANGED
@@ -1,5 +1,29 @@
1
1
  # Change Log
2
2
 
3
+ ## 11.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3330](https://github.com/equinor/fusion-framework/pull/3330) [`3590104`](https://github.com/equinor/fusion-framework/commit/3590104bdf3bba3386cdec7e2692078e6a92bd01) Thanks [@odinr](https://github.com/odinr)! - Enhanced Vite configuration with improved TypeScript path resolution and centralized config loading.
8
+
9
+ - Added `vite-tsconfig-paths` plugin for better TypeScript path resolution in development
10
+ - Refactored app and portal dev servers to use centralized `loadViteConfig` function
11
+ - Improved Vite config merging with `mergeConfigVite` for better configuration management
12
+ - Added debug logging for Vite and dev server configurations
13
+ - Moved output directory validation to build-time only for better performance
14
+
15
+ - Updated dependencies [[`3590104`](https://github.com/equinor/fusion-framework/commit/3590104bdf3bba3386cdec7e2692078e6a92bd01)]:
16
+ - @equinor/fusion-framework-dev-server@1.0.2
17
+
18
+ ## 11.1.1
19
+
20
+ ### Patch Changes
21
+
22
+ - [#3327](https://github.com/equinor/fusion-framework/pull/3327) [`22d6d3b`](https://github.com/equinor/fusion-framework/commit/22d6d3b7753da8ad30054839e8a6083850a208fa) Thanks [@odinr](https://github.com/odinr)! - moved plugin `vite-tsconfig-paths` to `@equinor/fusion-framework-dev-server`
23
+
24
+ - Updated dependencies [[`22d6d3b`](https://github.com/equinor/fusion-framework/commit/22d6d3b7753da8ad30054839e8a6083850a208fa)]:
25
+ - @equinor/fusion-framework-dev-server@1.0.1
26
+
3
27
  ## 11.1.0
4
28
 
5
29
  ### Minor Changes
package/bin/build/bin.mjs CHANGED
@@ -1 +1 @@
1
- import{loadConfigFromFile as e,mergeConfig as t,build as r}from"vite";import n from"vite-plugin-tsconfig-paths";import{dirname as o,resolve as i,basename as s,extname as a,relative as c}from"node:path";import{readPackageUp as u}from"read-package-up";import{accessSync as l,constants as f,readFileSync as p,statSync as d,existsSync as h,mkdirSync as m,writeFileSync as g}from"node:fs";import{stat as v,mkdir as E}from"node:fs/promises";import{importConfig as y,FileNotFoundError as b}from"@equinor/fusion-imports";import w from"deepmerge";import I from"node:assert";import{execSync as _}from"node:child_process";import C,{z as O}from"zod";import N from"fs";import S from"path";import L from"zlib";import R from"crypto";import D from"ora";import{createDevServer as T,processServices as A}from"@equinor/fusion-framework-dev-server";import{enableAuthModule as P}from"@equinor/fusion-framework-module-msal-node";import{fileURLToPath as $}from"node:url";const x=(e=0)=>t=>`[${t+e}m`,U=(e=0)=>t=>`[${38+e};5;${t}m`,k=(e=0)=>(t,r,n)=>`[${38+e};2;${t};${r};${n}m`,F={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(F.modifier);Object.keys(F.color),Object.keys(F.bgColor);const B=function(){const e=new Map;for(const[t,r]of Object.entries(F)){for(const[t,n]of Object.entries(r))F[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},r[t]=F[t],e.set(n[0],n[1]);Object.defineProperty(F,t,{value:r,enumerable:!1})}return Object.defineProperty(F,"codes",{value:e,enumerable:!1}),F.color.close="",F.bgColor.close="",F.color.ansi=x(),F.color.ansi256=U(),F.color.ansi16m=k(),F.bgColor.ansi=x(10),F.bgColor.ansi256=U(10),F.bgColor.ansi16m=k(10),Object.defineProperties(F,{rgbToAnsi256:{value:(e,t,r)=>e===t&&t===r?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(r/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[r]=t;3===r.length&&(r=[...r].map(e=>e+e).join(""));const n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},enumerable:!1},hexToAnsi256:{value:e=>F.rgbToAnsi256(...F.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,r,n;if(e>=232)t=(10*(e-232)+8)/255,r=t,n=t;else{const o=(e-=16)%36;t=Math.floor(e/36)/5,r=Math.floor(o/6)/5,n=o%6/5}const o=2*Math.max(t,r,n);if(0===o)return 30;let i=30+(Math.round(n)<<2|Math.round(r)<<1|Math.round(t));return 2===o&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,t,r)=>F.ansi256ToAnsi(F.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>F.ansi256ToAnsi(F.hexToAnsi256(e)),enumerable:!1}}),F}(),j=(()=>{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})(),M=0!==j&&{level:j},H={stdout:M,stderr:M};function G(e,t,r){let n=e.indexOf(t);if(-1===n)return e;const o=t.length;let i=0,s="";do{s+=e.slice(i,n)+t+r,i=n+o,n=e.indexOf(t,i)}while(-1!==n);return s+=e.slice(i),s}const{stdout:z,stderr:q}=H,V=Symbol("GENERATOR"),Z=Symbol("STYLER"),X=Symbol("IS_EMPTY"),K=["ansi","ansi","ansi256","ansi16m"],W=Object.create(null),Y=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 r=z?z.level:0;e.level=void 0===t.level?r:t.level})(t,e),Object.setPrototypeOf(t,J.prototype),t};function J(e){return Y(e)}Object.setPrototypeOf(J.prototype,Function.prototype);for(const[e,t]of Object.entries(B))W[e]={get(){const r=ne(this,re(t.open,t.close,this[Z]),this[X]);return Object.defineProperty(this,e,{value:r}),r}};W.visible={get(){const e=ne(this,this[Z],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const Q=(e,t,r,...n)=>"rgb"===e?"ansi16m"===t?B[r].ansi16m(...n):"ansi256"===t?B[r].ansi256(B.rgbToAnsi256(...n)):B[r].ansi(B.rgbToAnsi(...n)):"hex"===e?Q("rgb",t,r,...B.hexToRgb(...n)):B[r][e](...n),ee=["rgb","hex","ansi256"];for(const e of ee){W[e]={get(){const{level:t}=this;return function(...r){const n=re(Q(e,K[t],"color",...r),B.color.close,this[Z]);return ne(this,n,this[X])}}};W["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...r){const n=re(Q(e,K[t],"bgColor",...r),B.bgColor.close,this[Z]);return ne(this,n,this[X])}}}}const te=Object.defineProperties(()=>{},{...W,level:{enumerable:!0,get(){return this[V].level},set(e){this[V].level=e}}}),re=(e,t,r)=>{let n,o;return void 0===r?(n=e,o=t):(n=r.openAll+e,o=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:o,parent:r}},ne=(e,t,r)=>{const n=(...e)=>oe(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,te),n[V]=e,n[Z]=t,n[X]=r,n},oe=(e,t)=>{if(e.level<=0||!t)return e[X]?"":t;let r=e[Z];if(void 0===r)return t;const{openAll:n,closeAll:o}=r;if(t.includes(""))for(;void 0!==r;)t=G(t,r.close,r.open),r=r.parent;const i=t.indexOf("\n");return-1!==i&&(t=function(e,t,r,n){let o=0,i="";do{const s="\r"===e[n-1];i+=e.slice(o,s?n-1:n)+t+(s?"\r\n":"\n")+r,o=n+1,n=e.indexOf("\n",o)}while(-1!==n);return i+=e.slice(o),i}(t,o,n,i)),n+t+o};Object.defineProperties(J.prototype,W);const ie=J();J({level:q?q.level:0});const se=(e,t)=>{try{return l(e,f.F_OK),!0}catch(e){return!1}},ae=["index.ts","index.tsx","main.ts","main.tsx"],ce=(e,t,r)=>{const n=i(e??process.cwd(),"src"),o=ae,s=o.map(e=>i(n,e)).find(e=>se(e));if(!s)throw new Error(`Unable to resolve entry point, ensure ${o.join(", ")} exists in ${n}`);return s},ue=(e,t)=>w(e,t,{arrayMerge:(e,t)=>{const r=t[0]??e[0];return"object"==typeof r&&"match"in r&&"middleware"in r?((e,t,r)=>{const n=r.reduce((t,r)=>Object.assign(t,{[String(r[e])]:r}),{}),o={...t.reduce((t,r)=>Object.assign(t,{[String(r[e])]:r}),{}),...n};return Object.values(o)})("match",e,t):[...new Set([...e,...t])]}}),le=async(r,i)=>{const{packageJson:c,root:u}=i,{config:l}=await e(r)??{},f=c.main??c.module??"./dist/bundle.js",p=ce(u);if(o(f)===u)throw new Error("outDir cannot be root, please specify package.main or package.module in package.json");if("src"===o(f))throw new Error("outDir cannot be src, please specify package.main or package.module in package.json");if(o(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:u,plugins:[n()],define:{"process.env.NODE_ENV":JSON.stringify(r.mode),"process.env.NODE_DEBUG":"production"!==r.mode,"process.env.FUSION_LOG_LEVEL":"production"===r.mode?1:3},build:{outDir:o(f),lib:{entry:p,fileName:s(f,a(f)),formats:["es"]},emptyOutDir:!0}},l??{})};function fe(e,t){I("object"==typeof e,t)}const pe=e=>{if(e.repository)return"string"==typeof e.repository?e.repository:e.repository.url},de=()=>{try{return _("git remote get-url origin").toString().trim().replace("git@github.com:","https://github.com/").replace(/\.git$/,"")}catch(e){return}},he=(e="HEAD")=>{try{return _(`git rev-parse ${e}`).toString().trim()}catch(e){return}},me=()=>{if(process.env.GITHUB_ACTIONS){const e=(()=>{const e=process.env.GITHUB_EVENT_NAME||"unknown",t=process.env.GITHUB_ACTOR||"unknown",r=process.env.GITHUB_RUN_ID||"unknown",n=process.env.GITHUB_REPOSITORY||"unknown",o=process.env.GITHUB_WORKFLOW||"unknown",i=process.env.GITHUB_SERVER_URL||"https://github.com";let s="unknown";"unknown"!==n&&"unknown"!==r&&(s=`${i.replace(/\/$/,"")}/${n}/actions/runs/${r}`);const a={eventName:e,actor:t,runId:r,runUrl:s,workflow:o};if(process.env.GITHUB_EVENT_PATH)try{const e=p(process.env.GITHUB_EVENT_PATH,"utf8");Object.assign(a,JSON.parse(e))}catch{console.error("Failed to parse GitHub event payload")}return a})(),t={source:"github",reason:e.eventName,workflow:e.workflow,runId:e.runId,runUrl:e.runUrl,commitId:e.head_commit?.id,repository:e.repository?.name,repository_homepage:e.repository?.homepage,repository_license:e.repository?.license?.name,repository_owner:e.repository?.owner?.login,repository_owner_avatar_url:e.repository?.owner?.avatar_url,actor:e.actor,sender_login:e.sender?.login,sender_avatar_url:e.sender?.avatar_url};return e.pull_request?{...t,branch:e.pull_request.head?.ref,commitId:e.pull_request.head?.sha,htmlUrl:e.pull_request.html_url}:e.release?{...t,tag:e.release.tag_name,htmlUrl:e.release.html_url}:t}if(process.env.SYSTEM_TEAMPROJECT){const e=(()=>{const e=process.env.BUILD_BUILDID||"unknown",t=process.env.BUILD_DEFINITIONNAME||"unknown",r=process.env.BUILD_REPOSITORY_NAME||"unknown",n=process.env.SYSTEM_TEAMPROJECT||"unknown",o=process.env.SYSTEM_COLLECTIONURI||"unknown",i=process.env.BUILD_REQUESTEDFOR||"unknown",s=process.env.BUILD_SOURCEBRANCH||"unknown",a=process.env.BUILD_SOURCEVERSION||"unknown",c=process.env.BUILD_REASON||"unknown";let u="unknown";return"unknown"!==o&&"unknown"!==n&&"unknown"!==e&&(u=`${o.replace(/\/$/,"")}${n}/_build/results?buildId=${e}`),{runId:e,pipelineName:t,repository:r,project:n,orgUrl:o,actor:i,branch:s,commitId:a,runUrl:u,reason:c}})();return{source:"azure_devops",reason:e.reason,repository:e.repository,runId:e.runId,runUrl:e.runUrl,actor:e.actor,branch:e.branch,commitId:e.commitId,workflow:e.pipelineName}}},ge=["png","jpg","jpeg","gif","svg","ico","webp","mp4","webm","mp3","woff2","woff","eot","ttf","otf","pdf","md","txt"],ve=(e,t)=>{fe(t,"expected packageJson"),I(t.name,"expected [name] in packageJson"),I(t.version,"expected [version] in packageJson");const r=((e,t)=>"build"===e.command||e.isPreview?t.main||t.module||"dist/app-bundle.js":ce(e.root))(e,t),n=t.name.replace(/^@|\w.*\//gm,""),o=t.version,i="build"===e.command?void 0:`/bundles/apps/${n}@${o}`,s=pe(t)??de();return{appKey:n,displayName:t.name,description:t.description||"",keywords:t.keywords,type:"standalone",build:{entryPoint:r,assetPath:i,githubRepo:s,version:o,timestamp:(new Date).toISOString(),commitSha:he(),annotations:me(),projectPage:t.homepage,allowedExtensions:ge.map(e=>`.${e}`)}}},Ee=(e,t)=>w(e,t),ye=O.object({environment:O.record(O.any()).describe("Key-value map of environment-specific variables for the application. Defaults to an empty object if not provided.").optional().default({}),endpoints:O.record(O.object({url:O.string().describe("The endpoint URL. This field is required."),scopes:O.array(O.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."),be=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],we=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],Ie=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],_e=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],Ce=(e,t,r)=>{let n=e;return"string"==typeof t||Array.isArray(t)?n=e.toLocaleString(t,r):!0!==t&&void 0===r||(n=e.toLocaleString(void 0,r)),n},Oe=e=>{if("number"==typeof e)return Math.log10(e);const t=e.toString(10);return t.length+Math.log10("0."+t.slice(0,15))};function Ne(e,t){if("bigint"!=typeof e&&!Number.isFinite(e))throw new TypeError(`Expected a finite number, got ${typeof e}: ${e}`);const r=(t={bits:!1,binary:!1,space:!0,...t}).bits?t.binary?_e:Ie:t.binary?we:be,n=t.space?" ":"";if(t.signed&&("number"==typeof e?0===e:0n===e))return` 0${n}${r[0]}`;const o=e<0,i=o?"-":t.signed?"+":"";let s;if(o&&(e=-e),void 0!==t.minimumFractionDigits&&(s={minimumFractionDigits:t.minimumFractionDigits}),void 0!==t.maximumFractionDigits&&(s={maximumFractionDigits:t.maximumFractionDigits,...s}),e<1){return i+Ce(e,t.locale,s)+n+r[0]}const a=Math.min(Math.floor(t.binary?("number"==typeof(c=e)?Math.log(c):Oe(c)*Math.log(10))/Math.log(1024):Oe(e)/3),r.length-1);var c;if(e=((e,t)=>{if("number"==typeof e)return e/t;const r=e/BigInt(t),n=e%BigInt(t);return Number(r)+Number(n)/t})(e,(t.binary?1024:1e3)**a),!s){const t=Math.max(3,Number.parseInt(e,10).toString().length);e=e.toPrecision(t)}return i+Ce(Number(e),t.locale,s)+n+r[a]}const Se=(e,t)=>ie.blueBright(t?.relative?`./${c(t?.cwd??process.cwd(),e)}`:e),Le=e=>"string"==typeof e?Le(d(e).size):ie.yellowBright(Ne(e)),Re=async(e,t,r)=>{const n=ve(e,t.packageJson);try{r?.log?.start("loading application package...");const{manifest:t,path:o}=await(async(e,t)=>{const r=t?.file??[`app.manifest.${e.environment}`,"app.manifest","app.manifest.config"],n=await y(r,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async r=>{const n=t?.base??{};if("function"==typeof r.default){const t=await r.default(e,{base:n});return Ee(n,t??{})}return Ee(n,r.default??{})}}});return{manifest:n.config,path:n.path,extension:n.extension}})(e,{base:n,file:r?.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}`),r?.log?.succeed("generated manifest from",Se(o,{relative:!0})),t}catch(e){if(e instanceof b){if(r?.manifestPath){const t=new Error(`Failed to load manifest file ${Se(r.manifestPath)}, please check the path.`,{cause:e});throw r?.log?.fail(t.message),t}return r?.log?.succeed(ie.dim("no local manifest config applied, using default generated from package")),n}throw r?.log?.fail(`failed to resolve application manifest ${r?.manifestPath?Se(r?.manifestPath):""}`),e}};async function De(e){e?.start("resolve project package");try{const t=await(async e=>{const t=await u(e);if(!t)throw Error("failed to find package.json");return{...t,root:o(t.path)}})();return e?.succeed("📦",ie.yellowBright([t.packageJson.name,t.packageJson.version].join("@"))),e?.info("🏠",ie.blueBright(t.root)),t}catch(t){throw e?.fail("☠️","failed to resolve project package"),t}}const Te=async e=>{const{log:t}=e??{},r=await De(t);t?.debug("package",r);const n={command:"build",mode:process.env.NODE_ENV??"production",root:r.root,...e?.env};t?.debug("env:",n);const o=await Re(n,r,{log:t,manifestPath:e?.manifest});return t?.debug("manifest:",o),{manifest:o,pkg:r,env:n}},Ae=async e=>{const{log:t}=e??{};t?.log(ie.bold("Starting to build application"));const{manifest:n,pkg:o,env:i}=await Te({log:t,manifest:e?.manifest});t?.start("loading vite config...");const s=await le(i,o);t?.succeed("vite config applied"),t?.debug("vite config:",s),t?.start("🤞🏻","building application..."),t?.startNativeConsoleCapture(),await r(s),t?.stopNativeConsoleCapture(),t?.succeed("build completed 😘");return{pkg:o,manifest:n,outDir:s.build.outDir}};function Pe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $e,xe,Ue={exports:{}};function ke(){return xe?$e:(xe=1,$e={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 Fe,Be,je,Me,He,Ge,ze,qe,Ve={};function Ze(){return Fe||(Fe=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 r(e){return function(...t){return t.length&&(e=e.replace(/\{(\d)\}/g,(e,r)=>t[r]||"")),new Error("ADM-ZIP: "+e)}}for(const n of Object.keys(t))e[n]=r(t[n])}(Ve)),Ve}function Xe(){return qe||(qe=1,Ue.exports=function(){if(je)return Be;je=1;const e=N,t=S,r=ke(),n=Ze(),o="object"==typeof process&&"win32"===process.platform,i=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(r){this.sep=t.sep,this.fs=e,i(r)&&i(r.fs)&&"function"==typeof r.fs.statSync&&(this.fs=r.fs)}return Be=a,a.prototype.makeDir=function(e){const t=this;!function(e){let r=e.split(t.sep)[0];e.split(t.sep).forEach(function(e){if(e&&":"!==e.substr(-1,1)){var o;r+=t.sep+e;try{o=t.fs.statSync(r)}catch(e){t.fs.mkdirSync(r)}if(o&&o.isFile())throw n.FILE_IN_THE_WAY(`"${r}"`)}})}(e)},a.prototype.writeFileTo=function(e,r,n,o){const i=this;if(i.fs.existsSync(e)){if(!n)return!1;if(i.fs.statSync(e).isDirectory())return!1}var s,a=t.dirname(e);i.fs.existsSync(a)||i.makeDir(a);try{s=i.fs.openSync(e,"w",438)}catch(t){i.fs.chmodSync(e,438),s=i.fs.openSync(e,"w",438)}if(s)try{i.fs.writeSync(s,r,0,r.length,0)}finally{i.fs.closeSync(s)}return i.fs.chmodSync(e,o||438),!0},a.prototype.writeFileToAsync=function(e,r,n,o,i){"function"==typeof o&&(i=o,o=void 0);const s=this;s.fs.exists(e,function(a){if(a&&!n)return i(!1);s.fs.stat(e,function(n,c){if(a&&c.isDirectory())return i(!1);var u=t.dirname(e);s.fs.exists(u,function(t){t||s.makeDir(u),s.fs.open(e,"w",438,function(t,n){t?s.fs.chmod(e,438,function(){s.fs.open(e,"w",438,function(t,n){s.fs.write(n,r,0,r.length,0,function(){s.fs.close(n,function(){s.fs.chmod(e,o||438,function(){i(!0)})})})})}):n?s.fs.write(n,r,0,r.length,0,function(){s.fs.close(n,function(){s.fs.chmod(e,o||438,function(){i(!0)})})}):s.fs.chmod(e,o||438,function(){i(!0)})})})})})},a.prototype.findFiles=function(e){const r=this;return function e(n,o,i){let s=[];return r.fs.readdirSync(n).forEach(function(a){const c=t.join(n,a),u=r.fs.statSync(c);s.push(t.normalize(c)+(u.isDirectory()?r.sep:"")),u.isDirectory()&&i&&(s=s.concat(e(c,o,i)))}),s}(e,void 0,!0)},a.prototype.findFilesAsync=function(e,r){const n=this;let o=[];n.fs.readdir(e,function(i,s){if(i)return r(i);let a=s.length;if(!a)return r(null,o);s.forEach(function(i){i=t.join(e,i),n.fs.stat(i,function(e,s){if(e)return r(e);s&&(o.push(t.normalize(i)+(s.isDirectory()?n.sep:"")),s.isDirectory()?n.findFilesAsync(i,function(e,t){if(e)return r(e);o=o.concat(t),--a||r(null,o)}):--a||r(null,o))})})})},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,r=-1;for(let n=0;n<t;)r=a.crc32update(r,e[n++]);return~r>>>0},a.methodToString=function(e){switch(e){case r.STORED:return"STORED ("+e+")";case r.DEFLATED:return"DEFLATED ("+e+")";default:return"UNSUPPORTED ("+e+")"}},a.canonical=function(e){if(!e)return"";const r=t.posix.normalize("/"+e.split("\\").join("/"));return t.join(".",r)},a.zipnamefix=function(e){if(!e)return"";const r=t.posix.normalize("/"+e.split("\\").join("/"));return t.posix.join(".",r)},a.findLast=function(e,t){if(!Array.isArray(e))throw new TypeError("arr is not array");for(let r=(e.length>>>0)-1;r>=0;r--)if(t(e[r],r,e))return e[r]},a.sanitize=function(e,r){e=t.resolve(t.normalize(e));for(var n=r.split("/"),o=0,i=n.length;o<i;o++){var s=t.normalize(t.join(e,n.slice(o,i).join(t.sep)));if(0===s.indexOf(e))return s}return t.normalize(t.join(e,t.basename(r)))},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 r=Buffer.from(e.slice(t,t+8));return r.swap64(),parseInt(`0x${r.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,r=0;return e.getFullYear()>1979&&(t=(e.getFullYear()-1980&127)<<9|e.getMonth()+1<<5|e.getDate(),r=e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1),t<<16|r},a.isWin=o,a.crcTable=s,Be}(),Ue.exports.Constants=ke(),Ue.exports.Errors=Ze(),Ue.exports.FileAttr=function(){if(He)return Me;He=1;const e=S;return Me=function(t,{fs:r}){var n=t||"",o={directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0},i=null;return n&&r.existsSync(n)?(i=r.statSync(n),o.directory=i.isDirectory(),o.mtime=i.mtime,o.atime=i.atime,o.executable=!!(73&i.mode),o.readonly=!(128&i.mode),o.hidden="."===e.basename(n)[0]):console.warn("Invalid path: "+n),{get directory(){return o.directory},get readOnly(){return o.readonly},get hidden(){return o.hidden},get mtime(){return o.mtime},get atime(){return o.atime},get executable(){return o.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:n,isDirectory:o.directory,isReadOnly:o.readonly,isHidden:o.hidden,isExecutable:o.executable,mTime:o.mtime,aTime:o.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}(),Ue.exports.decoder=ze?Ge:(ze=1,Ge={efs:!0,encode:e=>Buffer.from(e,"utf8"),decode:e=>e.toString("utf8")})),Ue.exports}var Ke,We,Ye,Je,Qe,et={};function tt(){if(We)return Ke;We=1;var e=Xe(),t=e.Constants;return Ke=function(){var r=20,n=10,o=0,i=0,s=0,a=0,c=0,u=0,l=0,f=0,p=0,d=0,h=0,m=0,g=0;r|=e.isWin?2560:768,o|=t.FLG_EFS;const v={extraLen:0},E=e=>Math.max(0,e)>>>0;return s=e.fromDate2DOS(new Date),{get made(){return r},set made(e){r=e},get version(){return n},set version(e){n=e},get flags(){return o},set flags(e){o=e},get flags_efs(){return(o&t.FLG_EFS)>0},set flags_efs(e){e?o|=t.FLG_EFS:o&=~t.FLG_EFS},get flags_desc(){return(o&t.FLG_DESC)>0},set flags_desc(e){e?o|=t.FLG_DESC:o&=~t.FLG_DESC},get method(){return i},set method(e){switch(e){case t.STORED:this.version=10;case t.DEFLATED:default:this.version=20}i=e},get time(){return e.fromDOS2Date(this.timeval)},set time(t){this.timeval=e.fromDate2DOS(t)},get timeval(){return s},set timeval(e){s=E(e)},get timeHighByte(){return e=s>>>8,255&Math.max(0,e);var e},get crc(){return a},set crc(e){a=E(e)},get compressedSize(){return c},set compressedSize(e){c=E(e)},get size(){return u},set size(e){u=E(e)},get fileNameLength(){return l},set fileNameLength(e){l=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=E(e)},get inAttr(){return h},set inAttr(e){h=E(e)},get attr(){return m},set attr(e){m=E(e)},get fileAttr(){return(m||0)>>16&4095},get offset(){return g},set offset(e){g=E(e)},get encrypted(){return(o&t.FLG_ENC)===t.FLG_ENC},get centralHeaderSize(){return t.CENHDR+l+f+p},get realDataOffset(){return g+t.LOCHDR+v.fnameLen+v.extraLen},get localHeader(){return v},loadLocalHeaderFromBinary:function(r){var n=r.slice(g,g+t.LOCHDR);if(n.readUInt32LE(0)!==t.LOCSIG)throw e.Errors.INVALID_LOC();v.version=n.readUInt16LE(t.LOCVER),v.flags=n.readUInt16LE(t.LOCFLG),v.method=n.readUInt16LE(t.LOCHOW),v.time=n.readUInt32LE(t.LOCTIM),v.crc=n.readUInt32LE(t.LOCCRC),v.compressedSize=n.readUInt32LE(t.LOCSIZ),v.size=n.readUInt32LE(t.LOCLEN),v.fnameLen=n.readUInt16LE(t.LOCNAM),v.extraLen=n.readUInt16LE(t.LOCEXT);const o=g+t.LOCHDR+v.fnameLen,i=o+v.extraLen;return r.slice(o,i)},loadFromBinary:function(v){if(v.length!==t.CENHDR||v.readUInt32LE(0)!==t.CENSIG)throw e.Errors.INVALID_CEN();r=v.readUInt16LE(t.CENVEM),n=v.readUInt16LE(t.CENVER),o=v.readUInt16LE(t.CENFLG),i=v.readUInt16LE(t.CENHOW),s=v.readUInt32LE(t.CENTIM),a=v.readUInt32LE(t.CENCRC),c=v.readUInt32LE(t.CENSIZ),u=v.readUInt32LE(t.CENLEN),l=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(n,t.LOCVER),e.writeUInt16LE(o,t.LOCFLG),e.writeUInt16LE(i,t.LOCHOW),e.writeUInt32LE(s,t.LOCTIM),e.writeUInt32LE(a,t.LOCCRC),e.writeUInt32LE(c,t.LOCSIZ),e.writeUInt32LE(u,t.LOCLEN),e.writeUInt16LE(l,t.LOCNAM),e.writeUInt16LE(v.extraLen,t.LOCEXT),e},centralHeaderToBinary:function(){var e=Buffer.alloc(t.CENHDR+l+f+p);return e.writeUInt32LE(t.CENSIG,0),e.writeUInt16LE(r,t.CENVEM),e.writeUInt16LE(n,t.CENVER),e.writeUInt16LE(o,t.CENFLG),e.writeUInt16LE(i,t.CENHOW),e.writeUInt32LE(s,t.CENTIM),e.writeUInt32LE(a,t.CENCRC),e.writeUInt32LE(c,t.CENSIZ),e.writeUInt32LE(u,t.CENLEN),e.writeUInt16LE(l,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:r,version:n,flags:o,method:e.methodToString(i),time:this.time,crc:"0x"+a.toString(16).toUpperCase(),compressedSize:s(c),size:s(u),fileNameLength:s(l),extraLength:s(f),commentLength:s(p),diskNumStart:d,inAttr:h,attr:m,offset:g,centralHeaderSize:s(t.CENHDR+l+f+p)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}function rt(){return Qe||(Qe=1,et.EntryHeader=tt(),et.MainHeader=function(){if(Je)return Ye;Je=1;var e=Xe(),t=e.Constants;return Ye=function(){var r=0,n=0,o=0,i=0,s=0;return{get diskEntries(){return r},set diskEntries(e){r=n=e},get totalEntries(){return n},set totalEntries(e){n=r=e},get size(){return o},set size(e){o=e},get offset(){return i},set offset(e){i=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?(r=a.readUInt16LE(t.ENDSUB),n=a.readUInt16LE(t.ENDTOT),o=a.readUInt32LE(t.ENDSIZ),i=a.readUInt32LE(t.ENDOFF),s=a.readUInt16LE(t.ENDCOM)):(r=e.readBigUInt64LE(a,t.ZIP64SUB),n=e.readBigUInt64LE(a,t.ZIP64TOT),o=e.readBigUInt64LE(a,t.ZIP64SIZE),i=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(r,t.ENDSUB),e.writeUInt16LE(n,t.ENDTOT),e.writeUInt32LE(o,t.ENDSIZ),e.writeUInt32LE(i,t.ENDOFF),e.writeUInt16LE(s,t.ENDCOM),e.fill(" ",t.ENDHDR),e},toJSON:function(){return{diskEntries:r,totalEntries:n,size:o+" bytes",offset:function(e,t){let r=e.toString(16).toUpperCase();for(;r.length<t;)r="0"+r;return"0x"+r}(i,4),commentLength:s}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}},Ye}()),et}var nt,ot,it,st,at,ct,ut,lt,ft,pt,dt,ht,mt,gt={};function vt(){if(ct)return at;ct=1;const{randomFillSync:e}=R,t=Ze(),r=new Uint32Array(256).map((e,t)=>{for(let e=0;e<8;e++)1&t?t=t>>>1^3988292384:t>>>=1;return t>>>0}),n=(e,t)=>Math.imul(e,t)>>>0,o=(e,t)=>r[255&(e^t)]^e>>>8,i=()=>"function"==typeof e?e(Buffer.alloc(12)):i.node();i.node=()=>{const e=Buffer.alloc(12),t=e.length;for(let r=0;r<t;r++)e[r]=256*Math.random()&255;return e};const s={genSalt:i};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]=o(t[0],e),t[1]+=255&t[0],t[1]=n(t[1],134775813)+1,t[2]=o(t[2],t[1]>>>24),e},a.prototype.next=function(){const e=(2|this.keys[2])>>>0;return n(e,1^e)>>8&255},at={decrypt:function(e,r,n){if(!e||!Buffer.isBuffer(e)||e.length<12)return Buffer.alloc(0);const o=function(e){const t=new a(e);return function(e){const r=Buffer.alloc(e.length);let n=0;for(let o of e)r[n++]=t.updateKeys(o^t.next());return r}}(n),i=o(e.slice(0,12)),s=8&~r.flags?r.crc>>>24:r.timeHighByte;if(i[11]!==s)throw t.WRONG_PASSWORD();return o(e.slice(12))},encrypt:function(e,t,r,n=!1){null==e&&(e=Buffer.alloc(0)),Buffer.isBuffer(e)||(e=Buffer.from(e.toString()));const o=function(e){const t=new a(e);return function(e,r,n=0){r||(r=Buffer.alloc(e.length));for(let o of e){const e=t.next();r[n++]=o^e,t.updateKeys(o)}return r}}(r),i=s.genSalt();i[11]=t.crc>>>24&255,n&&(i[10]=t.crc>>>16&255);const c=Buffer.alloc(e.length+12);return o(i,c),o(e,c,12)},_salter:function(e){Buffer.isBuffer(e)&&e.length>=12?s.genSalt=function(){return e.slice(0,12)}:s.genSalt="node"===e?i.node:i}},at}function Et(){return ut||(ut=1,gt.Deflater=(ot||(ot=1,nt=function(e){var t=L,r={chunkSize:1024*(parseInt(e.length/1024)+1)};return{deflate:function(){return t.deflateRawSync(e,r)},deflateAsync:function(n){var o=t.createDeflateRaw(r),i=[],s=0;o.on("data",function(e){i.push(e),s+=e.length}),o.on("end",function(){var e=Buffer.alloc(s),t=0;e.fill(0);for(var r=0;r<i.length;r++){var o=i[r];o.copy(e,t),t+=o.length}n&&n(e)}),o.end(e)}}}),nt),gt.Inflater=function(){if(st)return it;st=1;const e=+(process.versions?process.versions.node:"").split(".")[0]||0;return it=function(t,r){var n=L;const o=e>=15&&r>0?{maxOutputLength:r}:{};return{inflate:function(){return n.inflateRawSync(t,o)},inflateAsync:function(e){var r=n.createInflateRaw(o),i=[],s=0;r.on("data",function(e){i.push(e),s+=e.length}),r.on("end",function(){var t=Buffer.alloc(s),r=0;t.fill(0);for(var n=0;n<i.length;n++){var o=i[n];o.copy(t,r),r+=o.length}e&&e(t)}),r.end(t)}}},it}(),gt.ZipCrypto=vt()),gt}function yt(){if(ft)return lt;ft=1;var e=Xe(),t=rt(),r=e.Constants,n=Et();return lt=function(o,i){var s=new t.EntryHeader,a=Buffer.alloc(0),c=Buffer.alloc(0),u=!1,l=null,f=Buffer.alloc(0),p=Buffer.alloc(0),d=!0;const h=o,m="object"==typeof h.decoder?h.decoder:e.decoder;function g(){return i&&i instanceof Uint8Array?(p=s.loadLocalHeaderFromBinary(i),i.slice(s.realDataOffset,s.realDataOffset+s.compressedSize)):Buffer.alloc(0)}function v(t){if(s.flags_desc){const n={},o=s.realDataOffset+s.compressedSize;if(i.readUInt32LE(o)==r.LOCSIG||i.readUInt32LE(o)==r.CENSIG)throw e.Errors.DESCRIPTOR_NOT_EXIST();if(i.readUInt32LE(o)==r.EXTSIG)n.crc=i.readUInt32LE(o+r.EXTCRC),n.compressedSize=i.readUInt32LE(o+r.EXTSIZ),n.size=i.readUInt32LE(o+r.EXTLEN);else{if(19280!==i.readUInt16LE(o+12))throw e.Errors.DESCRIPTOR_UNKNOWN();n.crc=i.readUInt32LE(o+r.EXTCRC-4),n.compressedSize=i.readUInt32LE(o+r.EXTSIZ-4),n.size=i.readUInt32LE(o+r.EXTLEN-4)}if(n.compressedSize!==s.compressedSize||n.size!==s.size||n.crc!==s.crc)throw e.Errors.DESCRIPTOR_FAULTY();if(e.crc32(t)!==n.crc)return!1}else if(e.crc32(t)!==s.localHeader.crc)return!1;return!0}function E(t,r,o){if(void 0===r&&"string"==typeof t&&(o=t,t=void 0),u)return t&&r&&r(Buffer.alloc(0),e.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var i=g();if(0===i.length)return t&&r&&r(i),i;if(s.encrypted){if("string"!=typeof o&&!Buffer.isBuffer(o))throw e.Errors.INVALID_PASS_PARAM();i=n.ZipCrypto.decrypt(i,s,o)}var c=Buffer.alloc(s.size);switch(s.method){case e.Constants.STORED:if(i.copy(c),v(c))return t&&r&&r(c),c;throw t&&r&&r(c,e.Errors.BAD_CRC()),e.Errors.BAD_CRC();case e.Constants.DEFLATED:var l=new n.Inflater(i,s.size);if(!t){if(l.inflate(c).copy(c,0),!v(c))throw e.Errors.BAD_CRC(`"${m.decode(a)}"`);return c}l.inflateAsync(function(t){t.copy(t,0),r&&(v(t)?r(t):r(t,e.Errors.BAD_CRC()))});break;default:throw t&&r&&r(Buffer.alloc(0),e.Errors.UNKNOWN_METHOD()),e.Errors.UNKNOWN_METHOD()}}function y(t,r){if((!l||!l.length)&&Buffer.isBuffer(i))return t&&r&&r(g()),g();if(l.length&&!u){var o;switch(s.method){case e.Constants.STORED:return s.compressedSize=s.size,o=Buffer.alloc(l.length),l.copy(o),t&&r&&r(o),o;default:case e.Constants.DEFLATED:var a=new n.Deflater(l);if(!t){var c=a.deflate();return s.compressedSize=c.length,c}a.deflateAsync(function(e){o=Buffer.alloc(e.length),s.compressedSize=e.length,e.copy(o),r&&r(o)}),a=null}}else{if(!t||!r)return Buffer.alloc(0);r(Buffer.alloc(0))}}function b(e,t){return(e.readUInt32LE(t+4)<<4)+e.readUInt32LE(t)}function w(e){var t,n,o,i;e.length>=r.EF_ZIP64_SCOMP&&(t=b(e,r.EF_ZIP64_SUNCOMP),s.size===r.EF_ZIP64_OR_32&&(s.size=t)),e.length>=r.EF_ZIP64_RHO&&(n=b(e,r.EF_ZIP64_SCOMP),s.compressedSize===r.EF_ZIP64_OR_32&&(s.compressedSize=n)),e.length>=r.EF_ZIP64_DSN&&(o=b(e,r.EF_ZIP64_RHO),s.offset===r.EF_ZIP64_OR_32&&(s.offset=o)),e.length>=r.EF_ZIP64_DSN+4&&(i=e.readUInt32LE(r.EF_ZIP64_DSN),s.diskNumStart===r.EF_ZIP64_OR_16&&(s.diskNumStart=i))}return d=!!m.hasOwnProperty("efs")&&m.efs,{get entryName(){return m.decode(a)},get rawEntryName(){return a},set entryName(t){var r=(a=e.toBuffer(t,m.encode))[a.length-1];u=47===r||92===r,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 n,o,i,s=0;s+4<t.length;)n=t.readUInt16LE(s),s+=2,o=t.readUInt16LE(s),s+=2,i=t.slice(s,s+o),s+=o,r.ID_ZIP64===n&&w(i)}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 u?e.substr(e.length-1).split("/").pop():e.split("/").pop()},get isDirectory(){return u},getCompressedData:function(){return y(!1,null)},getCompressedDataAsync:function(e){y(!0,e)},setData:function(t){l=e.toBuffer(t,e.decoder.encode),!u&&l.length?(s.size=l.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?l:E(!1,null,e)},getDataAsync:function(e,t){s.changed?e(l):E(!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(),r=e.Constants.CENHDR;return a.copy(t,r),r+=a.length,f.copy(t,r),r+=s.extraLength,c.copy(t,r),t},packLocalHeader:function(){let e=0;s.flags_efs=this.efs,s.extraLocalLength=p.length;const t=s.localHeaderToBinary(),r=Buffer.alloc(t.length+a.length+s.extraLocalLength);return t.copy(r,e),e+=t.length,a.copy(r,e),e+=a.length,p.copy(r,e),e+=p.length,r},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(i),data:e(l)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}},lt}function bt(){if(dt)return pt;dt=1;const e=yt(),t=rt(),r=Xe();return pt=function(n,o){var i=[],s={},a=Buffer.alloc(0),c=new t.MainHeader,u=!1;const l=new Set,f=o,{noSort:p,decoder:d}=f;function h(){if(u=!0,s={},c.diskEntries>(n.length-c.offset)/r.Constants.CENHDR)throw r.Errors.DISK_ENTRY_TOO_LARGE();i=new Array(c.diskEntries);for(var t=c.offset,o=0;o<i.length;o++){var a=t,p=new e(f,n);p.header=n.slice(a,a+=r.Constants.CENHDR),p.entryName=n.slice(a,a+=p.header.fileNameLength),p.header.extraLength&&(p.extra=n.slice(a,a+=p.header.extraLength)),p.header.commentLength&&(p.comment=n.slice(a,a+p.header.commentLength)),t+=p.header.centralHeaderSize,i[o]=p,s[p.entryName]=p}l.clear(),function(){const t=new Set;for(const e of Object.keys(s)){const r=e.split("/");if(r.pop(),r.length)for(let e=0;e<r.length;e++){const n=r.slice(0,e+1).join("/")+"/";t.add(n)}}for(const r of t)if(!(r in s)){const t=new e(f);t.entryName=r,t.attr=16,t.temporary=!0,i.push(t),s[t.entryName]=t,l.add(t)}}()}function m(){i.length>1&&!p&&i.sort((e,t)=>e.entryName.toLowerCase().localeCompare(t.entryName.toLowerCase()))}return n?function(e){var t=n.length-r.Constants.ENDHDR,o=Math.max(0,t-65535),i=o,s=n.length,u=-1,l=0;"boolean"==typeof f.trailingSpace&&f.trailingSpace&&(o=0);for(;t>=i;t--)if(80===n[t])if(n.readUInt32LE(t)!==r.Constants.ENDSIG)if(n.readUInt32LE(t)!==r.Constants.END64SIG){if(n.readUInt32LE(t)===r.Constants.ZIP64SIG){u=t,s=t+r.readBigUInt64LE(n,t+r.Constants.ZIP64SIZE)+r.Constants.ZIP64LEAD;break}}else i=o;else u=t,l=t,s=t+r.Constants.ENDHDR,i=t-r.Constants.END64HDR;if(-1==u)throw r.Errors.INVALID_FORMAT();c.loadFromBinary(n.slice(u,s)),c.commentLength&&(a=n.slice(l+r.Constants.ENDHDR));e&&h()}(f.readEntries):u=!0,{get entries(){return u||h(),i.filter(e=>!l.has(e))},get comment(){return d.decode(a)},set comment(e){a=r.toBuffer(e,d.encode),c.commentLength=a.length},getEntryCount:function(){return u?i.length:c.diskEntries},forEach:function(e){this.entries.forEach(e)},getEntry:function(e){return u||h(),s[e]||null},setEntry:function(e){u||h(),i.push(e),s[e.entryName]=e,c.totalEntries=i.length},deleteFile:function(e,t=!0){u||h();const r=s[e];this.getEntryChildren(r,t).map(e=>e.entryName).forEach(this.deleteEntry)},deleteEntry:function(e){u||h();const t=s[e],r=i.indexOf(t);r>=0&&(i.splice(r,1),delete s[e],c.totalEntries=i.length)},getEntryChildren:function(e,t=!0){if(u||h(),"object"==typeof e){if(e.isDirectory&&t){const t=[],r=e.entryName;for(const e of i)e.entryName.startsWith(r)&&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(){u||h(),m();const e=[],t=[];let o=0,i=0;c.size=0,c.offset=0;let s=0;for(const r of this.entries){const n=r.getCompressedData();r.header.offset=i;const a=r.packLocalHeader(),u=a.length+n.length;i+=u,e.push(a),e.push(n);const l=r.packCentralHeader();t.push(l),c.size+=l.length,o+=u+l.length,s++}o+=c.mainHeaderSize,c.offset=i,c.totalEntries=s,i=0;const l=Buffer.alloc(o);for(const t of e)t.copy(l,i),i+=t.length;for(const e of t)e.copy(l,i),i+=e.length;const f=c.toBinary();return a&&a.copy(f,r.Constants.ENDHDR),f.copy(l,i),n=l,u=!1,l},toAsyncBuffer:function(e,t,o,i){try{u||h(),m();const t=[],s=[];let l=0,f=0,p=0;c.size=0,c.offset=0;const d=function(h){if(h.length>0){const e=h.shift(),r=e.entryName+e.extra.toString();o&&o(r),e.getCompressedDataAsync(function(n){i&&i(r),e.header.offset=f;const o=e.packLocalHeader(),a=o.length+n.length;f+=a,t.push(o),t.push(n);const u=e.packCentralHeader();s.push(u),c.size+=u.length,l+=a+u.length,p++,d(h)})}else{l+=c.mainHeaderSize,c.offset=f,c.totalEntries=p,f=0;const o=Buffer.alloc(l);t.forEach(function(e){e.copy(o,f),f+=e.length}),s.forEach(function(e){e.copy(o,f),f+=e.length});const i=c.toBinary();a&&a.copy(i,r.Constants.ENDHDR),i.copy(o,f),n=o,u=!1,e(o)}};d(Array.from(this.entries))}catch(e){t(e)}}}},pt}var wt=function(){if(mt)return ht;mt=1;const e=Xe(),t=S,r=yt(),n=bt(),o=(...t)=>e.findLast(t,e=>"boolean"==typeof e),i=(...t)=>e.findLast(t,e=>"string"==typeof e),s={noSort:!1,readEntries:!1,method:e.Constants.NONE,fs:null};return ht=function(a,c){let u=null;const l=Object.assign(Object.create(null),s);a&&"object"==typeof a&&(a instanceof Uint8Array||(Object.assign(l,a),a=l.input?l.input:void 0,l.input&&delete l.input),Buffer.isBuffer(a)&&(u=a,l.method=e.Constants.BUFFER,a=void 0)),Object.assign(l,c);const f=new e(l);if("object"==typeof l.decoder&&"function"==typeof l.decoder.encode&&"function"==typeof l.decoder.decode||(l.decoder=e.decoder),a&&"string"==typeof a){if(!f.fs.existsSync(a))throw e.Errors.INVALID_FILENAME();l.method=e.Constants.FILE,l.filename=a,u=f.fs.readFileSync(a)}const p=new n(u,l),{canonical:d,sanitize:h,zipnamefix:m}=e;function g(e){var r;if(e&&p&&("string"==typeof e&&(r=p.getEntry(t.posix.normalize(e))),"object"==typeof e&&void 0!==e.entryName&&void 0!==e.header&&(r=p.getEntry(e.entryName)),r))return r;return null}function v(e){const{join:r,normalize:n,sep:o}=t.posix;return r(".",n(o+e.split("\\").join(o)+o))}function E(e){return e instanceof RegExp?(t=e,function(e){return t.test(e)}):"function"!=typeof e?()=>!0:e;var t}const y=(e,r)=>{let n=r.slice(-1);return n=n===f.sep?f.sep:"",t.relative(e,r)+n};return{readFile:function(e,t){var r=g(e);return r&&r.getData(t)||null},childCount:function(e){const t=g(e);if(t)return p.getChildCount(t)},readFileAsync:function(e,t){var r=g(e);r?r.getDataAsync(t):t(null,"getEntry failed for:"+e)},readAsText:function(e,t){var r=g(e);if(r){var n=r.getData();if(n&&n.length)return n.toString(t||"utf8")}return""},readAsTextAsync:function(e,t,r){var n=g(e);n?n.getDataAsync(function(e,n){n?t(e,n):e&&e.length?t(e.toString(r||"utf8")):t("")}):t("")},deleteFile:function(e,t=!0){var r=g(e);r&&p.deleteFile(r.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 r=g(e);r&&(r.comment=t)},getZipEntryComment:function(e){var t=g(e);return t&&t.comment||""},updateFile:function(e,t){var r=g(e);r&&r.setData(t)},addLocalFile:function(r,n,o,i){if(!f.fs.existsSync(r))throw e.Errors.FILE_NOT_FOUND(r);{n=n?v(n):"";const e=t.win32.basename(t.win32.normalize(r));n+=o||e;const s=f.fs.statSync(r),a=s.isFile()?f.fs.readFileSync(r):Buffer.alloc(0);s.isDirectory()&&(n+=f.sep),this.addFile(n,a,i,s)}},addLocalFileAsync:function(e,r){e="object"==typeof e?e:{localPath:e};const n=t.resolve(e.localPath),{comment:o}=e;let{zipPath:i,zipName:s}=e;const a=this;f.fs.stat(n,function(e,c){if(e)return r(e,!1);i=i?v(i):"";const u=t.win32.basename(t.win32.normalize(n));if(i+=s||u,c.isFile())f.fs.readFile(n,function(e,t){return e?r(e,!1):(a.addFile(i,t,o,c),setImmediate(r,void 0,!0))});else if(c.isDirectory())return i+=f.sep,a.addFile(i,Buffer.alloc(0),o,c),setImmediate(r,void 0,!0)})},addLocalFolder:function(r,n,o){if(o=E(o),n=n?v(n):"",r=t.normalize(r),!f.fs.existsSync(r))throw e.Errors.FILE_NOT_FOUND(r);{const e=f.findFiles(r),i=this;if(e.length)for(const s of e){const e=t.join(n,y(r,s));o(e)&&i.addLocalFile(s,t.dirname(e))}}},addLocalFolderAsync:function(r,n,o,i){i=E(i),o=o?v(o):"",r=t.normalize(r);var s=this;f.fs.open(r,"r",function(t){if(t&&"ENOENT"===t.code)n(void 0,e.Errors.FILE_NOT_FOUND(r));else if(t)n(void 0,t);else{var a=f.findFiles(r),c=-1,u=function(){if((c+=1)<a.length){var e=a[c],t=y(r,e).split("\\").join("/");t=t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),i(t)?f.fs.stat(e,function(r,i){r&&n(void 0,r),i.isFile()?f.fs.readFile(e,function(e,r){e?n(void 0,e):(s.addFile(o+t,r,"",i),u())}):(s.addFile(o+t+"/",Buffer.alloc(0),"",i),u())}):process.nextTick(()=>{u()})}else n(!0,void 0)};u()}})},addLocalFolderAsync2:function(r,n){const o=this;r="object"==typeof r?r:{localPath:r},localPath=t.resolve(v(r.localPath));let{zipPath:i,filter:s,namefix:a}=r;var c;s instanceof RegExp?(c=s,s=function(e){return c.test(e)}):"function"!=typeof s&&(s=function(){return!0}),i=i?v(i):"","latin1"==a&&(a=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),"function"!=typeof a&&(a=e=>e);const u=e=>t.join(i,a(y(localPath,e))),l=e=>t.win32.basename(t.win32.normalize(a(e)));f.fs.open(localPath,"r",function(r){r&&"ENOENT"===r.code?n(void 0,e.Errors.FILE_NOT_FOUND(localPath)):r?n(void 0,r):f.findFilesAsync(localPath,function(e,r){if(e)return n(e);(r=r.filter(e=>s(u(e)))).length||n(void 0,!1),setImmediate(r.reverse().reduce(function(e,r){return function(n,i){if(n||!1===i)return setImmediate(e,n,!1);o.addLocalFileAsync({localPath:r,zipPath:t.dirname(u(r)),zipName:l(r)},e)}},n))})})},addLocalFolderPromise:function(e,t){return new Promise((r,n)=>{this.addLocalFolderAsync2(Object.assign({localPath:e},t),(e,t)=>{e&&n(e),t&&r(this)})})},addFile:function(e,t,n,o){let i=g(e=m(e));const s=null!=i;s||(i=new r(l),i.entryName=e),i.comment=n||"";const a="object"==typeof o&&o instanceof f.fs.Stats;a&&(i.header.time=o.mtime);var c=i.isDirectory?16:0;let u=i.isDirectory?16384:32768;return u|=a?4095&o.mode:"number"==typeof o?4095&o:i.isDirectory?493:420,c=(c|u<<16)>>>0,i.attr=c,i.setData(t),s||p.setEntry(i),i},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(r,n,s,a,c,u){a=o(!1,a),c=o(!1,c),s=o(!0,s),u=i(c,u);var l=g(r);if(!l)throw e.Errors.NO_ENTRY();var m=d(l.entryName),v=h(n,u&&!l.isDirectory?u:s?m:t.basename(m));if(l.isDirectory)return p.getEntryChildren(l).forEach(function(r){if(r.isDirectory)return;var o=r.getData();if(!o)throw e.Errors.CANT_EXTRACT_FILE();var i=d(r.entryName),u=h(n,s?i:t.basename(i));const l=c?r.header.fileAttr:void 0;f.writeFileTo(u,o,a,l)}),!0;var E=l.getData(p.password);if(!E)throw e.Errors.CANT_EXTRACT_FILE();if(f.fs.existsSync(v)&&!a)throw e.Errors.CANT_OVERRIDE();const y=c?r.header.fileAttr:void 0;return f.writeFileTo(v,E,a,y),!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,r,n,s){if(n=o(!1,n),s=i(n,s),r=o(!1,r),!p)throw e.Errors.NO_ZIP();p.entries.forEach(function(o){var i=h(t,d(o.entryName));if(o.isDirectory)return void f.makeDir(i);var a=o.getData(s);if(!a)throw e.Errors.CANT_EXTRACT_FILE();const c=n?o.header.fileAttr:void 0;f.writeFileTo(i,a,r,c);try{f.fs.utimesSync(i,o.header.time,o.header.time)}catch(t){throw e.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(r,n,i,s){if(s=((...t)=>e.findLast(t,e=>"function"==typeof e))(n,i,s),i=o(!1,i),n=o(!1,n),!s)return new Promise((e,t)=>{this.extractAllToAsync(r,n,i,function(r){r?t(r):e(this)})});if(!p)return void s(e.Errors.NO_ZIP());r=t.resolve(r);const a=e=>h(r,t.normalize(d(e.entryName))),c=(e,t)=>new Error(e+': "'+t+'"'),u=[],l=[];p.entries.forEach(e=>{e.isDirectory?u.push(e):l.push(e)});for(const e of u){const t=a(e),r=i?e.header.fileAttr:void 0;try{f.makeDir(t),r&&f.fs.chmodSync(t,r),f.fs.utimesSync(t,e.header.time,e.header.time)}catch(e){s(c("Unable to create folder",t))}}l.reverse().reduce(function(o,s){return function(a){if(a)o(a);else{const a=t.normalize(d(s.entryName)),u=h(r,a);s.getDataAsync(function(t,r){if(r)o(r);else if(t){const e=i?s.header.fileAttr:void 0;f.writeFileToAsync(u,t,n,e,function(e){e||o(c("Unable to write file",u)),f.fs.utimes(u,s.header.time,s.header.time,function(e){e?o(c("Unable to set times",u)):o()})})}else o(e.Errors.CANT_EXTRACT_FILE())})}}},s)()},writeZip:function(e,t){if(1===arguments.length&&"function"==typeof e&&(t=e,e=""),!e&&l.filename&&(e=l.filename),e){var r=p.compressToBuffer();if(r){var n=f.writeFileTo(e,r,!0);"function"==typeof t&&t(n?null:new Error("failed"),"")}}},writeZipPromise:function(e,t){const{overwrite:r,perm:n}=Object.assign({overwrite:!0},t);return new Promise((t,o)=>{!e&&l.filename&&(e=l.filename),e||o("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(i=>{f.writeFileToAsync(e,i,r,n,e=>e?t(e):o("ADM-ZIP: Wasn't able to write zip file"))},o)})},toBufferPromise:function(){return new Promise((e,t)=>{p.toAsyncBuffer(e,t)})},toBuffer:function(e,t,r,n){return"function"==typeof e?(p.toAsyncBuffer(e,t,r,n),null):p.compressToBuffer()}}},ht}(),It=Pe(wt);class _t{#e;get ora(){return this.#e}set attachConsole(e){e?(console.log=this.info.bind(this),console.info=this.info.bind(this)):console=Nt}static Global(e){return Ct=new _t(e),Ct}static Clone(e){const{prefixText:t}=e||Ct;return new _t({prefixText:t})}static get Current(){return Ct}static set Current(e){Ct=e}constructor(e){this.#e=D(e)}get prefixText(){return this.#e.prefixText}info(...e){this.#e.info(Ot(e))}succeed(...e){this.#e.succeed(Ot(e))}start(...e){this.#e.start(Ot(e))}fail(...e){this.#e.fail(Ot(e))}warn(...e){this.#e.warn(Ot(e))}clear(){this.#e.clear()}stop(){this.#e.stop()}stopAndPersist(...e){this.#e.stopAndPersist(...e)}}let Ct=new _t;const Ot=e=>e.length?e.join(" "):void 0,Nt=console;let St=class{spinner;debugMode;constructor(e,t){this.spinner=new _t({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 Lt=e=>{const t={spa:{templateEnv:(r=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"]}]},...r})},api:{serviceDiscoveryUrl:"https://discovery.fusion.equinor.com/service-registry/environments/ci/services/",processServices:(e,t)=>{const{data:r,routes:n}=A(e,t);return{data:r.concat({key:"portals",name:"Portal Service - MOCK",uri:"/@fusion-api/portals"}),routes:n}}}};var r;return e.app&&((e,t,r)=>{const{build:n,appKey:o}=t;if(!n)throw new Error("App manifest does not contain build information");e.api.routes??=[],e.api.routes.push({match:[`/apps/bundles/apps/${o}/${n.version}/*path`,`/apps/bundles/apps/${o}@${n.version}/*path`],middleware:async(e,t,r)=>{const n=e.params?.path;!1===Array.isArray(n)&&r(),t.writeHead(302,{"content-type":"application/javascript",location:`/${n.join("/")}`}),t.end()}}),e.api.routes.push({match:`/apps/persons/me/apps/${o}`,middleware:async(e,r)=>{r.writeHead(200,{"content-type":"application/json"}),r.end(JSON.stringify({id:"dev-server-generated-id",...t}))}}),e.api.routes.push({match:`/apps/apps/${o}/builds/${n.version}/config`,middleware:async(e,t)=>{t.writeHead(200,{"content-type":"application/json"}),t.end(JSON.stringify(r))}})})(t,e.app.manifest,e.app.config),e.portal&&((e,t,r)=>{e.api.routes??=[];const n="portal-config";e.api.routes.push({match:`/${n}/portals/${t.name}{@:tag}`,middleware:async(e,r)=>{r.writeHead(200,{"content-type":"application/json"}),r.end(JSON.stringify(t))}}),r&&e.api.routes.push({match:`/${n}/portals/${t.name}{@:tag}/config`,middleware:async(e,t)=>{t.writeHead(200,{"content-type":"application/json"}),t.end(JSON.stringify(r))}})})(t,e.portal.manifest,e.portal.config),t},Rt=async(e,t,r)=>{const n=Lt(t),o=await(async(e,t,r)=>y("dev-server.config",{baseDir:e.root,extensions:r?.extensions,script:{resolve:async r=>{let n;if("function"==typeof r.default){const o={...t};n=await r.default(e,{base:o})}else n=r.default;return ue(t,n??{})}}}))(e,n).catch(()=>({config:n}));return T(o.config,r)},Dt=(e,t,r)=>{const n=o(String(e));h(n)||m(n,{recursive:!0}),g(e,t,r)},Tt=["package.json","LICENSE.md","README.md","CHANGELOG.md"],At=async(e,t)=>{const{archive:r,log:n}=t??{},s=o(e.path),a=t?.buildDir??"dist",c=i(s,a);if(!(await v(c)).isDirectory())throw new Error(`Build directory ${a} does not exist`);n?.log(ie.bold("Starting to pack bundle"));const u=new It;if(u.addLocalFolder(c,a),t?.content)for(const[e,r]of Object.entries(t.content))u.addFile(e,Buffer.from(r)),n?.info("📄",Se(e,{relative:!0}));n?.info("📂",Se(c,{relative:!0}));for(const t of Tt.concat(e.packageJson.files??[])){const e=i(s,t),r=o(e.replace(s,""));se(e)?(u.addLocalFile(e,r),n?.info("📄",Se(e,{relative:!0}))):n?.warn(ie.dim("📄",Se(e,{relative:!0})))}return r&&(se(o(r))||await E(o(r),{recursive:!0}),n?.start("compressing content"),await u.writeZipPromise(r),n?.succeed("📚",Se(r,{relative:!0}),Le(r))),u},Pt=async e=>{const{log:t,manifest:r}=e;process.env.NODE_ENV,process.cwd();const{pkg:n,manifest:o}=await Ae({log:t,manifest:r});if(!o.build)throw new Error("Manifest build config not found");return{archive:await At(n,{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}},$t=async(e,t)=>{const{log:r}=t;try{r?.start("create application configuration"),r?.info(`generating config with ${ie.red.dim(e.command)} command in ${ie.green.dim(e.mode)} mode`);const n=await((e,t)=>{const r=t?.file??[`app.config.${e.environment}`,"app.config"];return y(r,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async r=>{const n=t?.base??{environment:{}};if("function"==typeof r.default){const t=await r.default(e,{base:n})??n;return ye.parse(t??n)}return ye.parse(r.default??n)}}})})(e,{file:t?.config});return r?.succeed("⚙️ generated config from ",Se(n.path,{relative:!0})),n.config}catch(e){if(e instanceof b){if(!t.config)return r?.succeed(ie.dim("⚙️ no local application config applied, using built-in")),{environment:{}};r?.warn(`failed to load config file ${Se(t.config)}, please check the path.`)}throw r?.fail("failed to resolve application config"),r?.debug(e),e}},xt=async e=>{const{log:t}=e??{},r=await De(t),n={command:"build",mode:process.env.NODE_ENV??"production",root:r.root,...e?.env},o=await $t(n,{log:t,config:e?.config});if(t?.debug("config:",o),e?.output){t?.start("writing config to file");try{await Dt(e.output,JSON.stringify(o,null,2)),t?.succeed("config written successfully",Se(e.output,{relative:!0}))}catch(e){throw t?.fail("failed to write config"),e}}return{config:o,pkg:r}};class Ut extends Error{response;static Name="HttpResponseError";constructor(e,t,r){super(e,r),this.response=t}}class kt extends Ut{static Name="HttpJsonResponseError";data;constructor(e,t,r){super(e,t,r),this.name=kt.Name,this.data=r?.data}}class Ft extends Ut{static Name="ServerSentEventResponseError";constructor(e,t,r){super(e,t,r),this.name=Ft.Name}}var Bt,jt,Mt,Ht,Gt,zt,qt,Vt,Zt,Xt,Kt,Wt,Yt,Jt,Qt,er,tr,rr,nr,or,ir,sr,ar,cr,ur,lr,fr,pr,dr,hr,mr,gr,vr,Er,yr,br,wr,Ir,_r,Cr,Or,Nr,Sr,Lr,Rr,Dr,Tr,Ar,Pr,$r,xr,Ur,kr,Fr,Br,jr,Mr,Hr,Gr,zr,qr,Vr,Zr,Xr,Kr,Wr,Yr,Jr,Qr,en,tn,rn,nn,on,sn,an,cn,un,ln,fn,pn,dn,hn,mn,gn,vn,En,yn,bn,wn={exports:{}};function In(){if(jt)return Bt;jt=1;const e=Number.MAX_SAFE_INTEGER||9007199254740991;return Bt={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}}function _n(){if(Ht)return Mt;Ht=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 Mt=e}function Cn(){return Gt||(Gt=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:o}=In(),i=_n(),s=(t=e.exports={}).re=[],a=t.safeRe=[],c=t.src=[],u=t.safeSrc=[],l=t.t={};let f=0;const p="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",o],[p,n]],h=(e,t,r)=>{const n=(e=>{for(const[t,r]of d)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),o=f++;i(e,o,t),l[e]=o,c[o]=t,u[o]=n,s[o]=new RegExp(t,r?"g":void 0),a[o]=new RegExp(n,r?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),h("MAINVERSION",`(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASE",`(?:-(${c[l.PRERELEASEIDENTIFIER]}(?:\\.${c[l.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${c[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[l.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${p}+`),h("BUILD",`(?:\\+(${c[l.BUILDIDENTIFIER]}(?:\\.${c[l.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${c[l.MAINVERSION]}${c[l.PRERELEASE]}?${c[l.BUILD]}?`),h("FULL",`^${c[l.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${c[l.MAINVERSIONLOOSE]}${c[l.PRERELEASELOOSE]}?${c[l.BUILD]}?`),h("LOOSE",`^${c[l.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${c[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${c[l.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:${c[l.PRERELEASE]})?${c[l.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:${c[l.PRERELEASELOOSE]})?${c[l.BUILD]}?)?)?`),h("XRANGE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAINLOOSE]}$`),h("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),h("COERCE",`${c[l.COERCEPLAIN]}(?:$|[^\\d])`),h("COERCEFULL",c[l.COERCEPLAIN]+`(?:${c[l.PRERELEASE]})?`+`(?:${c[l.BUILD]})?(?:$|[^\\d])`),h("COERCERTL",c[l.COERCE],!0),h("COERCERTLFULL",c[l.COERCEFULL],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${c[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${c[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${c[l.LONECARET]}${c[l.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${c[l.LONECARET]}${c[l.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${c[l.GTLT]}\\s*(${c[l.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]}|${c[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${c[l.XRANGEPLAIN]})\\s+-\\s+(${c[l.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${c[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[l.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(wn,wn.exports)),wn.exports}function On(){if(qt)return zt;qt=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return zt=r=>r?"object"!=typeof r?e:r:t}function Nn(){if(Zt)return Vt;Zt=1;const e=/^[0-9]+$/,t=(t,r)=>{const n=e.test(t),o=e.test(r);return n&&o&&(t=+t,r=+r),t===r?0:n&&!o?-1:o&&!n?1:t<r?-1:1};return Vt={compareIdentifiers:t,rcompareIdentifiers:(e,r)=>t(r,e)},Vt}function Sn(){if(Kt)return Xt;Kt=1;const e=_n(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=In(),{safeRe:n,t:o}=Cn(),i=On(),{compareIdentifiers:s}=Nn();class a{constructor(s,c){if(c=i(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 u=s.trim().match(c.loose?n[o.LOOSE]:n[o.FULL]);if(!u)throw new TypeError(`Invalid Version: ${s}`);if(this.raw=s,this.major=+u[1],this.minor=+u[2],this.patch=+u[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");u[4]?this.prerelease=u[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<r)return t}return e}):this.prerelease=[],this.build=u[5]?u[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)),s(this.major,e.major)||s(this.minor,e.minor)||s(this.patch,e.patch)}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 r=0;do{const n=this.prerelease[r],o=t.prerelease[r];if(e("prerelease compare",r,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return s(n,o)}while(++r)}compareBuild(t){t instanceof a||(t=new a(t,this.options));let r=0;do{const n=this.build[r],o=t.build[r];if(e("build compare",r,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return s(n,o)}while(++r)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?n[o.PRERELEASELOOSE]:n[o.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,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);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(r)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let n=this.prerelease.length;for(;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===s(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Xt=a}function Ln(){if(Yt)return Wt;Yt=1;const e=Sn();return Wt=(t,r,n=!1)=>{if(t instanceof e)return t;try{return new e(t,r)}catch(e){if(!n)return null;throw e}},Wt}function Rn(){if(mr)return hr;mr=1;const e=Sn();return hr=(t,r,n)=>new e(t,n).compare(new e(r,n)),hr}function Dn(){if(wr)return br;wr=1;const e=Sn();return br=(t,r,n)=>{const o=new e(t,n),i=new e(r,n);return o.compare(i)||o.compareBuild(i)},br}function Tn(){if(Sr)return Nr;Sr=1;const e=Rn();return Nr=(t,r,n)=>e(t,r,n)>0,Nr}function An(){if(Rr)return Lr;Rr=1;const e=Rn();return Lr=(t,r,n)=>e(t,r,n)<0,Lr}function Pn(){if(Tr)return Dr;Tr=1;const e=Rn();return Dr=(t,r,n)=>0===e(t,r,n),Dr}function $n(){if(Pr)return Ar;Pr=1;const e=Rn();return Ar=(t,r,n)=>0!==e(t,r,n),Ar}function xn(){if(xr)return $r;xr=1;const e=Rn();return $r=(t,r,n)=>e(t,r,n)>=0,$r}function Un(){if(kr)return Ur;kr=1;const e=Rn();return Ur=(t,r,n)=>e(t,r,n)<=0,Ur}function kn(){if(Br)return Fr;Br=1;const e=Pn(),t=$n(),r=Tn(),n=xn(),o=An(),i=Un();return Fr=(s,a,c,u)=>{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,u);case"!=":return t(s,c,u);case">":return r(s,c,u);case">=":return n(s,c,u);case"<":return o(s,c,u);case"<=":return i(s,c,u);default:throw new TypeError(`Invalid operator: ${a}`)}},Fr}function Fn(){if(qr)return zr;qr=1;const e=/\s+/g;class t{constructor(r,i){if(i=n(i),r instanceof t)return r.loose===!!i.loose&&r.includePrerelease===!!i.includePrerelease?r:new t(r.raw,i);if(r instanceof o)return this.raw=r.value,this.set=[[r]],this.formatted=void 0,this;if(this.options=i,this.loose=!!i.loose,this.includePrerelease=!!i.includePrerelease,this.raw=r.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,n=r.get(t);if(n)return n;const s=this.options.loose,m=s?a[c.HYPHENRANGELOOSE]:a[c.HYPHENRANGE];e=e.replace(m,S(this.options.includePrerelease)),i("hyphen replace",e),e=e.replace(a[c.COMPARATORTRIM],u),i("comparator trim",e),e=e.replace(a[c.TILDETRIM],l),i("tilde trim",e),e=e.replace(a[c.CARETTRIM],f),i("caret trim",e);let g=e.split(" ").map(e=>v(e,this.options)).join(" ").split(/\s+/).map(e=>N(e,this.options));s&&(g=g.filter(e=>(i("loose invalid filter",e,this.options),!!e.match(a[c.COMPARATORLOOSE])))),i("range list",g);const E=new Map,y=g.map(e=>new o(e,this.options));for(const e of y){if(h(e))return[e];E.set(e.value,e)}E.size>1&&E.has("")&&E.delete("");const b=[...E.values()];return r.set(t,b),b}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(t=>g(t,r)&&e.set.some(e=>g(e,r)&&t.every(t=>e.every(e=>t.intersects(e,r)))))}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(L(this.set[t],e,this.options))return!0;return!1}}zr=t;const r=new(Gr?Hr:(Gr=1,Hr=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}})),n=On(),o=Bn(),i=_n(),s=Sn(),{safeRe:a,t:c,comparatorTrimReplace:u,tildeTrimReplace:l,caretTrimReplace:f}=Cn(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:d}=In(),h=e=>"<0.0.0-0"===e.value,m=e=>""===e.value,g=(e,t)=>{let r=!0;const n=e.slice();let o=n.pop();for(;r&&n.length;)r=n.every(e=>o.intersects(e,t)),o=n.pop();return r},v=(e,t)=>(i("comp",e,t),e=w(e,t),i("caret",e),e=y(e,t),i("tildes",e),e=_(e,t),i("xrange",e),e=O(e,t),i("stars",e),e),E=e=>!e||"x"===e.toLowerCase()||"*"===e,y=(e,t)=>e.trim().split(/\s+/).map(e=>b(e,t)).join(" "),b=(e,t)=>{const r=t.loose?a[c.TILDELOOSE]:a[c.TILDE];return e.replace(r,(t,r,n,o,s)=>{let a;return i("tilde",e,t,r,n,o,s),E(r)?a="":E(n)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:E(o)?a=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:s?(i("replaceTilde pr",s),a=`>=${r}.${n}.${o}-${s} <${r}.${+n+1}.0-0`):a=`>=${r}.${n}.${o} <${r}.${+n+1}.0-0`,i("tilde return",a),a})},w=(e,t)=>e.trim().split(/\s+/).map(e=>I(e,t)).join(" "),I=(e,t)=>{i("caret",e,t);const r=t.loose?a[c.CARETLOOSE]:a[c.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(t,r,o,s,a)=>{let c;return i("caret",e,t,r,o,s,a),E(r)?c="":E(o)?c=`>=${r}.0.0${n} <${+r+1}.0.0-0`:E(s)?c="0"===r?`>=${r}.${o}.0${n} <${r}.${+o+1}.0-0`:`>=${r}.${o}.0${n} <${+r+1}.0.0-0`:a?(i("replaceCaret pr",a),c="0"===r?"0"===o?`>=${r}.${o}.${s}-${a} <${r}.${o}.${+s+1}-0`:`>=${r}.${o}.${s}-${a} <${r}.${+o+1}.0-0`:`>=${r}.${o}.${s}-${a} <${+r+1}.0.0-0`):(i("no pr"),c="0"===r?"0"===o?`>=${r}.${o}.${s}${n} <${r}.${o}.${+s+1}-0`:`>=${r}.${o}.${s}${n} <${r}.${+o+1}.0-0`:`>=${r}.${o}.${s} <${+r+1}.0.0-0`),i("caret return",c),c})},_=(e,t)=>(i("replaceXRanges",e,t),e.split(/\s+/).map(e=>C(e,t)).join(" ")),C=(e,t)=>{e=e.trim();const r=t.loose?a[c.XRANGELOOSE]:a[c.XRANGE];return e.replace(r,(r,n,o,s,a,c)=>{i("xRange",e,r,n,o,s,a,c);const u=E(o),l=u||E(s),f=l||E(a),p=f;return"="===n&&p&&(n=""),c=t.includePrerelease?"-0":"",u?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&p?(l&&(s=0),a=0,">"===n?(n=">=",l?(o=+o+1,s=0,a=0):(s=+s+1,a=0)):"<="===n&&(n="<",l?o=+o+1:s=+s+1),"<"===n&&(c="-0"),r=`${n+o}.${s}.${a}${c}`):l?r=`>=${o}.0.0${c} <${+o+1}.0.0-0`:f&&(r=`>=${o}.${s}.0${c} <${o}.${+s+1}.0-0`),i("xRange return",r),r})},O=(e,t)=>(i("replaceStars",e,t),e.trim().replace(a[c.STAR],"")),N=(e,t)=>(i("replaceGTE0",e,t),e.trim().replace(a[t.includePrerelease?c.GTE0PRE:c.GTE0],"")),S=e=>(t,r,n,o,i,s,a,c,u,l,f,p)=>`${r=E(n)?"":E(o)?`>=${n}.0.0${e?"-0":""}`:E(i)?`>=${n}.${o}.0${e?"-0":""}`:s?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=E(u)?"":E(l)?`<${+u+1}.0.0-0`:E(f)?`<${u}.${+l+1}.0-0`:p?`<=${u}.${l}.${f}-${p}`:e?`<${u}.${l}.${+f+1}-0`:`<=${c}`}`.trim(),L=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(i(e[r].semver),e[r].semver!==o.ANY&&e[r].semver.prerelease.length>0){const n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0};return zr}function Bn(){if(Zr)return Vr;Zr=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(n,o){if(o=r(o),n instanceof t){if(n.loose===!!o.loose)return n;n=n.value}n=n.trim().split(/\s+/).join(" "),s("comparator",n,o),this.options=o,this.loose=!!o.loose,this.parse(n),this.semver===e?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}parse(t){const r=this.options.loose?n[o.COMPARATORLOOSE]:n[o.COMPARATOR],i=t.match(r);if(!i)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==i[1]?i[1]:"","="===this.operator&&(this.operator=""),i[2]?this.semver=new a(i[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 i(t,this.operator,this.semver,this.options)}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new c(e.value,n).test(this.value):""===e.operator?""===e.value||new c(this.value,n).test(e.semver):(!(n=r(n)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!n.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("="))||(!!(i(this.semver,"<",e.semver,n)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(i(this.semver,">",e.semver,n)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}Vr=t;const r=On(),{safeRe:n,t:o}=Cn(),i=kn(),s=_n(),a=Sn(),c=Fn();return Vr}function jn(){if(Kr)return Xr;Kr=1;const e=Fn();return Xr=(t,r,n)=>{try{r=new e(r,n)}catch(e){return!1}return r.test(t)},Xr}function Mn(){if(sn)return on;sn=1;const e=Fn();return on=(t,r)=>{try{return new e(t,r).range||"*"}catch(e){return null}},on}function Hn(){if(cn)return an;cn=1;const e=Sn(),t=Bn(),{ANY:r}=t,n=Fn(),o=jn(),i=Tn(),s=An(),a=Un(),c=xn();return an=(u,l,f,p)=>{let d,h,m,g,v;switch(u=new e(u,p),l=new n(l,p),f){case">":d=i,h=a,m=s,g=">",v=">=";break;case"<":d=s,h=c,m=i,g="<",v="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(o(u,l,p))return!1;for(let e=0;e<l.set.length;++e){const n=l.set[e];let o=null,i=null;if(n.forEach(e=>{e.semver===r&&(e=new t(">=0.0.0")),o=o||e,i=i||e,d(e.semver,o.semver,p)?o=e:m(e.semver,i.semver,p)&&(i=e)}),o.operator===g||o.operator===v)return!1;if((!i.operator||i.operator===g)&&h(u,i.semver))return!1;if(i.operator===v&&m(u,i.semver))return!1}return!0},an}var Gn=function(){if(bn)return yn;bn=1;const e=Cn(),t=In(),r=Sn(),n=Nn(),o=Ln(),i=function(){if(Qt)return Jt;Qt=1;const e=Ln();return Jt=(t,r)=>{const n=e(t,r);return n?n.version:null},Jt}(),s=function(){if(tr)return er;tr=1;const e=Ln();return er=(t,r)=>{const n=e(t.trim().replace(/^[=v]+/,""),r);return n?n.version:null},er}(),a=function(){if(nr)return rr;nr=1;const e=Sn();return rr=(t,r,n,o,i)=>{"string"==typeof n&&(i=o,o=n,n=void 0);try{return new e(t instanceof e?t.version:t,n).inc(r,o,i).version}catch(e){return null}},rr}(),c=function(){if(ir)return or;ir=1;const e=Ln();return or=(t,r)=>{const n=e(t,null,!0),o=e(r,null,!0),i=n.compare(o);if(0===i)return null;const s=i>0,a=s?n:o,c=s?o:n,u=!!a.prerelease.length;if(c.prerelease.length&&!u){if(!c.patch&&!c.minor)return"major";if(0===c.compareMain(a))return c.minor&&!c.patch?"minor":"patch"}const l=u?"pre":"";return n.major!==o.major?l+"major":n.minor!==o.minor?l+"minor":n.patch!==o.patch?l+"patch":"prerelease"}}(),u=function(){if(ar)return sr;ar=1;const e=Sn();return sr=(t,r)=>new e(t,r).major,sr}(),l=function(){if(ur)return cr;ur=1;const e=Sn();return cr=(t,r)=>new e(t,r).minor,cr}(),f=function(){if(fr)return lr;fr=1;const e=Sn();return lr=(t,r)=>new e(t,r).patch,lr}(),p=function(){if(dr)return pr;dr=1;const e=Ln();return pr=(t,r)=>{const n=e(t,r);return n&&n.prerelease.length?n.prerelease:null},pr}(),d=Rn(),h=function(){if(vr)return gr;vr=1;const e=Rn();return gr=(t,r,n)=>e(r,t,n),gr}(),m=function(){if(yr)return Er;yr=1;const e=Rn();return Er=(t,r)=>e(t,r,!0),Er}(),g=Dn(),v=function(){if(_r)return Ir;_r=1;const e=Dn();return Ir=(t,r)=>t.sort((t,n)=>e(t,n,r)),Ir}(),E=function(){if(Or)return Cr;Or=1;const e=Dn();return Cr=(t,r)=>t.sort((t,n)=>e(n,t,r)),Cr}(),y=Tn(),b=An(),w=Pn(),I=$n(),_=xn(),C=Un(),O=kn(),N=function(){if(Mr)return jr;Mr=1;const e=Sn(),t=Ln(),{safeRe:r,t:n}=Cn();return jr=(o,i)=>{if(o instanceof e)return o;if("number"==typeof o&&(o=String(o)),"string"!=typeof o)return null;let s=null;if((i=i||{}).rtl){const e=i.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let t;for(;(t=e.exec(o))&&(!s||s.index+s[0].length!==o.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=o.match(i.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);if(null===s)return null;const a=s[2],c=s[3]||"0",u=s[4]||"0",l=i.includePrerelease&&s[5]?`-${s[5]}`:"",f=i.includePrerelease&&s[6]?`+${s[6]}`:"";return t(`${a}.${c}.${u}${l}${f}`,i)},jr}(),S=Bn(),L=Fn(),R=jn(),D=function(){if(Yr)return Wr;Yr=1;const e=Fn();return Wr=(t,r)=>new e(t,r).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" ")),Wr}(),T=function(){if(Qr)return Jr;Qr=1;const e=Sn(),t=Fn();return Jr=(r,n,o)=>{let i=null,s=null,a=null;try{a=new t(n,o)}catch(e){return null}return r.forEach(t=>{a.test(t)&&(i&&-1!==s.compare(t)||(i=t,s=new e(i,o)))}),i},Jr}(),A=function(){if(tn)return en;tn=1;const e=Sn(),t=Fn();return en=(r,n,o)=>{let i=null,s=null,a=null;try{a=new t(n,o)}catch(e){return null}return r.forEach(t=>{a.test(t)&&(i&&1!==s.compare(t)||(i=t,s=new e(i,o)))}),i},en}(),P=function(){if(nn)return rn;nn=1;const e=Sn(),t=Fn(),r=Tn();return rn=(n,o)=>{n=new t(n,o);let i=new e("0.0.0");if(n.test(i))return i;if(i=new e("0.0.0-0"),n.test(i))return i;i=null;for(let t=0;t<n.set.length;++t){const o=n.set[t];let s=null;o.forEach(t=>{const n=new e(t.semver.version);switch(t.operator){case">":0===n.prerelease.length?n.patch++:n.prerelease.push(0),n.raw=n.format();case"":case">=":s&&!r(n,s)||(s=n);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${t.operator}`)}}),!s||i&&!r(i,s)||(i=s)}return i&&n.test(i)?i:null},rn}(),$=Mn(),x=Hn(),U=function(){if(ln)return un;ln=1;const e=Hn();return un=(t,r,n)=>e(t,r,">",n),un}(),k=function(){if(pn)return fn;pn=1;const e=Hn();return fn=(t,r,n)=>e(t,r,"<",n),fn}(),F=function(){if(hn)return dn;hn=1;const e=Fn();return dn=(t,r,n)=>(t=new e(t,n),r=new e(r,n),t.intersects(r,n))}(),B=function(){if(gn)return mn;gn=1;const e=jn(),t=Rn();return mn=(r,n,o)=>{const i=[];let s=null,a=null;const c=r.sort((e,r)=>t(e,r,o));for(const t of c)e(t,n,o)?(a=t,s||(s=t)):(a&&i.push([s,a]),a=null,s=null);s&&i.push([s,null]);const u=[];for(const[e,t]of i)e===t?u.push(e):t||e!==c[0]?t?e===c[0]?u.push(`<=${t}`):u.push(`${e} - ${t}`):u.push(`>=${e}`):u.push("*");const l=u.join(" || "),f="string"==typeof n.raw?n.raw:String(n);return l.length<f.length?l:n},mn}(),j=function(){if(En)return vn;En=1;const e=Fn(),t=Bn(),{ANY:r}=t,n=jn(),o=Rn(),i=[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===r){if(1===t.length&&t[0].semver===r)return!0;e=a.includePrerelease?i:s}if(1===t.length&&t[0].semver===r){if(a.includePrerelease)return!0;t=s}const l=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=u(p,t,a):l.add(t.semver);if(l.size>1)return null;if(f&&p){if(d=o(f.semver,p.semver,a),d>0)return null;if(0===d&&(">="!==f.operator||"<="!==p.operator))return null}for(const e of l){if(f&&!n(e,String(f),a))return null;if(p&&!n(e,String(p),a))return null;for(const r of t)if(!n(e,String(r),a))return!1;return!0}let E=!(!p||a.includePrerelease||!p.semver.prerelease.length)&&p.semver,y=!(!f||a.includePrerelease||!f.semver.prerelease.length)&&f.semver;E&&1===E.prerelease.length&&"<"===p.operator&&0===E.prerelease[0]&&(E=!1);for(const e of t){if(v=v||">"===e.operator||">="===e.operator,g=g||"<"===e.operator||"<="===e.operator,f)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(h=c(f,e,a),h===e&&h!==f)return!1}else if(">="===f.operator&&!n(f.semver,String(e),a))return!1;if(p)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(m=u(p,e,a),m===e&&m!==p)return!1}else if("<="===p.operator&&!n(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||y||E)},c=(e,t,r)=>{if(!e)return t;const n=o(e.semver,t.semver,r);return n>0?e:n<0||">"===t.operator&&">="===e.operator?t:e},u=(e,t,r)=>{if(!e)return t;const n=o(e.semver,t.semver,r);return n<0?e:n>0||"<"===t.operator&&"<="===e.operator?t:e};return vn=(t,r,n={})=>{if(t===r)return!0;t=new e(t,n),r=new e(r,n);let o=!1;e:for(const e of t.set){for(const t of r.set){const r=a(e,t,n);if(o=o||null!==r,r)continue e}if(o)return!1}return!0}}();return yn={parse:o,valid:i,clean:s,inc:a,diff:c,major:u,minor:l,patch:f,prerelease:p,compare:d,rcompare:h,compareLoose:m,compareBuild:g,sort:v,rsort:E,gt:y,lt:b,eq:w,neq:I,gte:_,lte:C,cmp:O,coerce:N,Comparator:S,Range:L,satisfies:R,toComparators:D,maxSatisfying:T,minSatisfying:A,minVersion:P,validRange:$,outside:x,gtr:U,ltr:k,intersects:F,simplifyRange:B,subset:j,SemVer:r,re:e.re,src:e.src,tokens:e.t,SEMVER_SPEC_VERSION:t.SEMVER_SPEC_VERSION,RELEASE_TYPES:t.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers}}();class zn extends Gn.SemVer{satisfies(e){return Gn.satisfies(this,e)}}let qn=class{domain;level=Number(process.env.FUSION_LOG_LEVEL)||1;constructor(e){this.domain=e}_createMessage(e){return[`%c FUSION FRAMEWORK %c ${this.domain} %c %s`,"background: rgb(179, 13, 47); color: white; padding: 1px;","background: rgb(244, 244, 244); color: rgb(36, 55, 70); padding: 1px;","background: none; color: inherit",...e.reduce((e,t)=>e.concat(t,"\n"),[])]}debug(...e){this.level>3&&console.debug(...this._createMessage(e))}info(...e){this.level>2&&console.info(...this._createMessage(e))}warn(...e){this.level>1&&console.warn(...this._createMessage(e))}error(...e){this.level>0&&console.error(...this._createMessage(e))}};class Vn extends qn{formatModuleName(e){return`📦${("string"==typeof e?e:e.name).replace(/([A-Z])/g," $1").toUpperCase()}`}}var Zn=function(e,t){return Zn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Zn(e,t)};function Xn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Zn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var Kn=function(){return Kn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Kn.apply(this,arguments)};function Wn(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}c((n=n.apply(e,t||[])).next())})}function Yn(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[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(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function Jn(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Qn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function eo(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function to(e){return this instanceof to?(this.v=e,this):new to(e)}function ro(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),i=[];return n=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,u)}}),n[Symbol.asyncIterator]=function(){return this},n;function s(e,t){o[e]&&(n[e]=function(t){return new Promise(function(r,n){i.push([e,t,r,n])>1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{!function(e){e.value instanceof to?Promise.resolve(e.value.v).then(c,u):l(i[0][2],e)}(o[e](t))}catch(e){l(i[0][3],e)}}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function no(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=Jn(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,o){(function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)})(n,o,(t=e[r](t)).done,t.value)})}}}function oo(e){return"function"==typeof e}function io(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=io(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 r=e.indexOf(t);0<=r&&e.splice(r,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,r,n,o;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var s=Jn(i),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 i.remove(this);var c=this.initialTeardown;if(oo(c))try{c()}catch(e){o=e instanceof so?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=Jn(u),f=l.next();!f.done;f=l.next()){var p=f.value;try{fo(p)}catch(e){o=null!=o?o:[],e instanceof so?o=eo(eo([],Qn(o)),Qn(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(o)throw new so(o)}},e.prototype.add=function(t){var r;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!==(r=this._finalizers)&&void 0!==r?r:[]).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 r=this._finalizers;r&&ao(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),uo=co.EMPTY;function lo(e){return e instanceof co||e&&"closed"in e&&oo(e.remove)&&oo(e.add)&&oo(e.unsubscribe)}function fo(e){oo(e)?e():e.unsubscribe()}var po={Promise:void 0},ho=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,eo([e,t],Qn(r)))};function mo(e){ho(function(){throw e})}function go(){}function vo(e){e()}var Eo=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,lo(t)&&t.add(r)):r.destination=Io,r}return Xn(t,e),t.create=function(e,t,r){return new bo(e,t,r)},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),yo=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,r,n){var o,i=e.call(this)||this;return o=oo(t)||!t?{next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:t,i.destination=new yo(o),i}return Xn(t,e),t}(Eo);function wo(e){mo(e)}var Io={closed:!0,next:go,error:function(e){throw e},complete:go},_o="function"==typeof Symbol&&Symbol.observable||"@@observable";function Co(e){return e}var Oo=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,i=(n=e)&&n instanceof Eo||function(e){return e&&oo(e.next)&&oo(e.error)&&oo(e.complete)}(n)&&lo(n)?e:new bo(e,t,r);return vo(function(){var e=o,t=e.operator,r=e.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=No(t))(function(t,n){var o=new bo({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[_o]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];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=No(e))(function(e,r){var n;t.subscribe(function(e){return n=e},function(e){return r(e)},function(){return e(n)})})},e.create=function(t){return new e(t)},e}();function No(e){var t;return null!==(t=null!=e?e:po.Promise)&&void 0!==t?t:Promise}function So(e){return function(t){if(function(e){return oo(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 Lo(e,t,r,n,o){return new Ro(e,t,r,n,o)}var Ro=function(e){function t(t,r,n,o,i,s){var a=e.call(this,t)||this;return a.onFinalize=i,a.shouldUnsubscribe=s,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return Xn(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(Eo),Do=io(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),To=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 Xn(t,e),t.prototype.lift=function(e){var t=new Ao(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Do},t.prototype.next=function(e){var t=this;vo(function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=Jn(t.currentObservers),i=o.next();!i.done;i=o.next()){i.value.next(e)}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.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 r=t.observers;r.length;)r.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,r=this,n=r.hasError,o=r.isStopped,i=r.observers;return n||o?uo:(this.currentObservers=null,i.push(e),new co(function(){t.currentObservers=null,ao(i,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,o=t.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new Oo;return e.source=this,e},t.create=function(e,t){return new Ao(e,t)},t}(Oo),Ao=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return Xn(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.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,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:uo},t}(To),Po=function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}return Xn(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){var e=this,t=e.hasError,r=e.thrownError,n=e._value;if(t)throw r;return this._throwIfClosed(),n},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(To),$o={now:function(){return($o.delegate||Date).now()},delegate:void 0},xo=function(e){function t(t,r,n){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===n&&(n=$o);var o=e.call(this)||this;return o._bufferSize=t,o._windowTime=r,o._timestampProvider=n,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=r===1/0,o._bufferSize=Math.max(1,t),o._windowTime=Math.max(1,r),o}return Xn(t,e),t.prototype.next=function(t){var r=this,n=r.isStopped,o=r._buffer,i=r._infiniteTimeWindow,s=r._timestampProvider,a=r._windowTime;n||(o.push(t),!i&&o.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),r=this._infiniteTimeWindow,n=this._buffer.slice(),o=0;o<n.length&&!e.closed;o+=r?1:2)e.next(n[o]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,r=e._timestampProvider,n=e._buffer,o=e._infiniteTimeWindow,i=(o?1:2)*t;if(t<1/0&&i<n.length&&n.splice(0,n.length-i),!o){for(var s=r.now(),a=0,c=1;c<n.length&&n[c]<=s;c+=2)a=c;a&&n.splice(0,a+1)}},t}(To),Uo=function(e){function t(t,r){return e.call(this)||this}return Xn(t,e),t.prototype.schedule=function(e,t){return this},t}(co),ko=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setInterval.apply(void 0,eo([e,t],Qn(r)))},Fo=function(e){return clearInterval(e)},Bo=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return Xn(t,e),t.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,o=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(o,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),ko(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&Fo(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,ao(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(Uo),jo=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=$o.now,e}(),Mo=function(e){function t(t,r){void 0===r&&(r=jo.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return Xn(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(jo),Ho=new Mo(Bo),Go=Ho,zo=new Oo(function(e){return e.complete()});function qo(e){return e&&oo(e.schedule)}function Vo(e){return e[e.length-1]}var Zo=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function Xo(e){return oo(null==e?void 0:e.then)}function Ko(e){return oo(e[_o])}function Wo(e){return Symbol.asyncIterator&&oo(null==e?void 0:e[Symbol.asyncIterator])}function Yo(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 oo(null==e?void 0:e[Jo])}function ei(e){return ro(this,arguments,function(){var t,r,n;return Yn(this,function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,to(t.read())];case 3:return r=o.sent(),n=r.value,r.done?[4,to(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,to(n)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function ti(e){return oo(null==e?void 0:e.getReader)}function ri(e){if(e instanceof Oo)return e;if(null!=e){if(Ko(e))return o=e,new Oo(function(e){var t=o[_o]();if(oo(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(Zo(e))return n=e,new Oo(function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()});if(Xo(e))return r=e,new Oo(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,mo)});if(Wo(e))return ni(e);if(Qo(e))return t=e,new Oo(function(e){var r,n;try{for(var o=Jn(t),i=o.next();!i.done;i=o.next()){var s=i.value;if(e.next(s),e.closed)return}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}e.complete()});if(ti(e))return ni(ei(e))}var t,r,n,o;throw Yo(e)}function ni(e){return new Oo(function(t){(function(e,t){var r,n,o,i;return Wn(this,void 0,void 0,function(){var s,a;return Yn(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=no(e),c.label=1;case 1:return[4,r.next()];case 2:if((n=c.sent()).done)return[3,4];if(s=n.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(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function oi(e,t,r,n,o){void 0===n&&(n=0),void 0===o&&(o=!1);var i=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function ii(e,t){return void 0===t&&(t=0),So(function(r,n){r.subscribe(Lo(n,function(r){return oi(n,e,function(){return n.next(r)},t)},function(){return oi(n,e,function(){return n.complete()},t)},function(r){return oi(n,e,function(){return n.error(r)},t)}))})}function si(e,t){return void 0===t&&(t=0),So(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function ai(e,t){if(!e)throw new Error("Iterable cannot be null");return new Oo(function(r){oi(r,t,function(){var n=e[Symbol.asyncIterator]();oi(r,t,function(){n.next().then(function(e){e.done?r.complete():r.next(e.value)})},0,!0)})})}function ci(e,t){if(null!=e){if(Ko(e))return function(e,t){return ri(e).pipe(si(t),ii(t))}(e,t);if(Zo(e))return function(e,t){return new Oo(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}(e,t);if(Xo(e))return function(e,t){return ri(e).pipe(si(t),ii(t))}(e,t);if(Wo(e))return ai(e,t);if(Qo(e))return function(e,t){return new Oo(function(r){var n;return oi(r,t,function(){n=e[Jo](),oi(r,t,function(){var e,t,o;try{t=(e=n.next()).value,o=e.done}catch(e){return void r.error(e)}o?r.complete():r.next(t)},0,!0)}),function(){return oo(null==n?void 0:n.return)&&n.return()}})}(e,t);if(ti(e))return function(e,t){return ai(ei(e),t)}(e,t)}throw Yo(e)}function ui(e,t){return t?ci(e,t):ri(e)}function li(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=function(e){return qo(Vo(e))?e.pop():void 0}(e);return ui(e,r)}var fi=io(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function pi(e,t){var r="object"==typeof t;return new Promise(function(n,o){var i,s=!1;e.subscribe({next:function(e){i=e,s=!0},error:o,complete:function(){s?n(i):r?n(t.defaultValue):o(new fi)}})})}function di(e,t){var r="object"==typeof t;return new Promise(function(n,o){var i=new bo({next:function(e){n(e),i.unsubscribe()},error:o,complete:function(){r?n(t.defaultValue):o(new fi)}});e.subscribe(i)})}function hi(e){return e instanceof Date&&!isNaN(e)}var mi=io(function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function gi(e){throw new mi(e)}function vi(e,t){return So(function(r,n){var o=0;r.subscribe(Lo(n,function(r){n.next(e.call(t,r,o++))}))})}var Ei=Array.isArray;function yi(e){return vi(function(t){return function(e,t){return Ei(t)?e.apply(void 0,eo([],Qn(t))):e(t)}(e,t)})}function bi(e,t,r,n,o,i,s,a){var c=[],u=0,l=0,f=!1,p=function(){!f||c.length||u||t.complete()},d=function(e){return u<n?h(e):c.push(e)},h=function(e){i&&t.next(e),u++;var a=!1;ri(r(e,l++)).subscribe(Lo(t,function(e){null==o||o(e),i?d(e):t.next(e)},function(){a=!0},void 0,function(){if(a)try{u--;for(var e=function(){var e=c.shift();s||h(e)};c.length&&u<n;)e();p()}catch(e){t.error(e)}}))};return e.subscribe(Lo(t,d,function(){f=!0,p()})),function(){null==a||a()}}function wi(e,t,r){return void 0===r&&(r=1/0),oo(t)?wi(function(r,n){return vi(function(e,o){return t(r,e,n,o)})(ri(e(r,n)))},r):("number"==typeof t&&(r=t),So(function(t,n){return bi(t,n,e,r)}))}var Ii=["addListener","removeListener"],_i=["addEventListener","removeEventListener"],Ci=["on","off"];function Oi(e,t,r,n){if(oo(r)&&(n=r,r=void 0),n)return Oi(e,t,r).pipe(yi(n));var o=Qn(function(e){return oo(e.addEventListener)&&oo(e.removeEventListener)}(e)?_i.map(function(n){return function(o){return e[n](t,o,r)}}):function(e){return oo(e.addListener)&&oo(e.removeListener)}(e)?Ii.map(Ni(e,t)):function(e){return oo(e.on)&&oo(e.off)}(e)?Ci.map(Ni(e,t)):[],2),i=o[0],s=o[1];if(!i&&Zo(e))return wi(function(e){return Oi(e,t,r)})(ri(e));if(!i)throw new TypeError("Invalid event target");return new Oo(function(e){var t=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.next(1<t.length?t:t[0])};return i(t),function(){return s(t)}})}function Ni(e,t){return function(r){return function(n){return e[r](t,n)}}}function Si(e,t,r){void 0===e&&(e=0),void 0===r&&(r=Go);var n=-1;return null!=t&&(qo(t)?r=t:n=t),new Oo(function(t){var o=hi(e)?+e-r.now():e;o<0&&(o=0);var i=0;return r.schedule(function(){t.closed||(t.next(i++),0<=n?this.schedule(void 0,n):t.complete())},o)})}function Li(e,t){return So(function(r,n){var o=0;r.subscribe(Lo(n,function(r){return e.call(t,r,o++)&&n.next(r)}))})}function Ri(e){return So(function(t,r){var n,o=null,i=!1;o=t.subscribe(Lo(r,void 0,void 0,function(s){n=ri(e(s,Ri(e)(t))),o?(o.unsubscribe(),o=null,n.subscribe(r)):i=!0})),i&&(o.unsubscribe(),o=null,n.subscribe(r))})}function Di(e,t,r,n,o){return function(i,s){var a=r,c=t,u=0;i.subscribe(Lo(s,function(t){var r=u++;c=a?e(c,t,r):(a=!0,t),n&&s.next(c)},o&&function(){a&&s.next(c),s.complete()}))}}function Ti(e,t){return So(Di(e,t,arguments.length>=2,!1,!0))}function Ai(e,t){return void 0===t&&(t=Co),e=null!=e?e:Pi,So(function(r,n){var o,i=!0;r.subscribe(Lo(n,function(r){var s=t(r);!i&&e(o,s)||(i=!1,o=s,n.next(r))}))})}function Pi(e,t){return e===t}function $i(e){return void 0===e&&(e=xi),So(function(t,r){var n=!1;t.subscribe(Lo(r,function(e){n=!0,r.next(e)},function(){return n?r.complete():r.error(e())}))})}function xi(){return new fi}function Ui(e){return So(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}function ki(e,t){var r=arguments.length>=2;return function(e){return e.pipe(Co,(n=1)<=0?function(){return zo}:So(function(e,t){var r=[];e.subscribe(Lo(t,function(e){r.push(e),n<r.length&&r.shift()},function(){var e,n;try{for(var o=Jn(r),i=o.next();!i.done;i=o.next()){var s=i.value;t.next(s)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}t.complete()},void 0,function(){r=null}))}),r?function(e){return So(function(t,r){var n=!1;t.subscribe(Lo(r,function(e){n=!0,r.next(e)},function(){n||r.next(e),r.complete()}))})}(t):$i(function(){return new fi}));var n}}function Fi(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!0!==t){if(!1!==t){var o=new bo({next:function(){o.unsubscribe(),e()}});return ri(t.apply(void 0,eo([],Qn(r)))).subscribe(o)}}else e()}function Bi(e,t){return So(function(r,n){var o=null,i=0,s=!1,a=function(){return s&&!o&&n.complete()};r.subscribe(Lo(n,function(r){null==o||o.unsubscribe();var s=0,c=i++;ri(e(r,c)).subscribe(o=Lo(n,function(e){return n.next(t?t(r,e,c,s++):e)},function(){o=null,a()}))},function(){s=!0,a()}))})}function ji(e){return So(function(t,r){ri(e).subscribe(Lo(r,function(){return r.complete()},go)),!r.closed&&t.subscribe(r)})}function Mi(e,t,r){var n=oo(e)||t||r?{next:e,error:t,complete:r}:e;return n?So(function(e,t){var r;null===(r=n.subscribe)||void 0===r||r.call(n);var o=!0;e.subscribe(Lo(t,function(e){var r;null===(r=n.next)||void 0===r||r.call(n,e),t.next(e)},function(){var e;o=!1,null===(e=n.complete)||void 0===e||e.call(n),t.complete()},function(e){var r;o=!1,null===(r=n.error)||void 0===r||r.call(n,e),t.error(e)},function(){var e,t;o&&(null===(e=n.unsubscribe)||void 0===e||e.call(n)),null===(t=n.finalize)||void 0===t||t.call(n)}))}):Co}function Hi(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r,n=oo(Vo(r=e))?r.pop():void 0;return So(function(t,r){for(var o=e.length,i=new Array(o),s=e.map(function(){return!1}),a=!1,c=function(t){ri(e[t]).subscribe(Lo(r,function(e){i[t]=e,a||s[t]||(s[t]=!0,(a=s.every(Co))&&(s=null))},go))},u=0;u<o;u++)c(u);t.subscribe(Lo(r,function(e){if(a){var t=eo([e],Qn(i));r.next(n?n.apply(void 0,eo([],Qn(t))):t)}}))})}const Gi=(e,t,r)=>{const n="string"==typeof t?t.split("."):t,o=n.shift();return o&&(e[o]??={},n.length?Gi(e[o],n,r):Object.assign(e,{[o]:r})),e};class zi{#t={};createConfig(e,t){return ui(this._createConfig(e,t))}async createConfigAsync(e,t){return pi(this.createConfig(e,t))}_set(e,t){const r="function"==typeof t?t:async()=>t;this.#t[e]=r}_get(e){return this.#t[e]}_has(e){return e in this.#t}_createConfig(e,t){return ui(this._buildConfig(e,t)).pipe(Bi(t=>this._processConfig(t,e)))}_buildConfig(e,t){return ui(Object.entries(this.#t)).pipe(wi(([t,r])=>ui(r(e)).pipe(Li(e=>void 0!==e),vi(e=>({target:t,value:e})),Ri(e=>(console.error(`Failed to execute config callback: ${r.name} for attribute: '${t}'`,e),zo)))),Ti((e,{target:t,value:r})=>Gi(e,t,r),t??{}))}_processConfig(e,t){return li(e)}}class qi{#r;#n;get version(){return this.#r}constructor(e){const{version:t}=e;this.#r=new zn(t),this.#n=new co}_addTeardown(e){return this.#n.add(e),()=>this.#n.remove(e)}dispose(){this.#n.unsubscribe()}}class Vi extends Error{constructor(){super("It was too slow"),this.name="RequiredModuleTimeoutError"}}class Zi{logger=new Vn("ModulesConfigurator");_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:r,afterInit:n,configure:o}=e;this._modules.add(t),o&&this._configs.push((e,r)=>o(e[t.name],r)),r&&this._afterConfiguration.push(e=>r(e[t.name])),n&&this._afterInit.push(e=>n(e[t.name]))}onConfigured(e){this._afterConfiguration.push(e)}onInitialized(e){this._afterInit.push(e)}async initialize(e){const t=await this._configure(e),r=await this._initialize(t,e);return await this._postInitialize(r,e),Object.seal(Object.assign({},r,{dispose:()=>this.dispose(r)}))}async _configure(e){const t=await this._createConfig(e);return await Promise.all(this._configs.map(r=>Promise.resolve(r(t,e)))),await this._postConfigure(t),t}_createConfig(e){const{modules:t,logger:r,_afterConfiguration:n,_afterInit:o}=this,i=ui(t).pipe(wi(async t=>{r.debug(`🛠 creating configurator ${r.formatModuleName(t)}`);try{const n=await(t.configure?.(e));return r.debug(`🛠 created configurator for ${r.formatModuleName(t)}`,n),{[t.name]:n}}catch(e){throw r.error(`🛠 Failed to created configurator for ${r.formatModuleName(t)}`,e),e}}),Ti((e,t)=>Object.assign(e,t),{onAfterConfiguration(e){n.push(e)},onAfterInit(e){o.push(e)}}));return pi(i)}async _postConfigure(e){const{modules:t,logger:r,_afterConfiguration:n}=this;if(await Promise.allSettled(t.filter(e=>!!e.postConfigure).map(async t=>{try{await(t.postConfigure?.(e)),r.debug(`🏗📌 post configured ${r.formatModuleName(t)}`,t)}catch(e){r.warn(`🏗📌 post configure failed ${r.formatModuleName(t)}`)}})),n.length)try{r.debug(`🏗📌 post configure hooks [${n.length}]`),await Promise.allSettled(n.map(t=>Promise.resolve(t(e)))),r.debug("🏗📌 post configure hooks complete")}catch(e){r.warn("🏗📌 post configure hook failed",e)}}async _initialize(e,t){const{modules:r,logger:n}=this,o=r.map(e=>e.name),i=new Po({}),s=e=>o.includes(e),a=(e,t=60)=>{if(!o.includes(e))throw n.error(`🚀⌛️ Cannot not require ${n.formatModuleName(String(e))} since module is not defined!`),Error(`cannot not require [${String(e)}] since module is not defined!`);return i.value[e]?(n.debug(`🚀⌛️ ${n.formatModuleName(String(e))} is initiated, skipping queue`),Promise.resolve(i.value[e])):(n.debug(`🚀⌛️ Awaiting init ${n.formatModuleName(String(e))}, timeout ${t}s`),di(i.pipe(Li(t=>!!t[e]),vi(t=>t[e]),function(e){var t=hi(e)?{first:e}:"number"==typeof e?{each:e}:e,r=t.first,n=t.each,o=t.with,i=void 0===o?gi:o,s=t.scheduler,a=void 0===s?Ho:s,c=t.meta,u=void 0===c?null:c;if(null==r&&null==n)throw new TypeError("No timeout provided.");return So(function(e,t){var o,s,c=null,l=0,f=function(e){s=oi(t,a,function(){try{o.unsubscribe(),ri(i({meta:u,lastValue:c,seen:l})).subscribe(t)}catch(e){t.error(e)}},e)};o=e.subscribe(Lo(t,function(e){null==s||s.unsubscribe(),l++,t.next(c=e),n>0&&f(n)},void 0,void 0,function(){(null==s?void 0:s.closed)||null==s||s.unsubscribe(),c=null})),!l&&f(null!=r?"number"==typeof r?r:+r-a.now():n)})}({each:1e3*t,with:()=>{return t=oo(e=()=>new Vi)?e:function(){return e},new Oo(function(e){return e.error(t())});var e,t}}))))};ui(r).pipe(wi(r=>{const o=r.name;return n.debug(`🚀 initializing ${n.formatModuleName(r)}`),ui(Promise.resolve(r.initialize({ref:t,config:e[o],requireInstance:a,hasModule:s}))).pipe(vi(e=>{if(!(e instanceof qi||e.version instanceof zn)){n.debug("🤷 module does not extends the [BaseModuleProvider] or exposes [SemanticVersion]");try{e.version=r.version instanceof zn?r.version:new zn(r.version??"0.0.0-unknown")}catch(e){n.error("🚨 failed to set module version")}}return n.debug(`🚀 initialized ${n.formatModuleName(r)}`),[o,e]}))})).subscribe({next:([e,t])=>{i.next(Object.assign(i.value,{[e]:t}))},error:e=>{n.error("🚨 failed to initialize",e),i.error(e)},complete:()=>i.complete()});const c=await pi(i);return Object.seal(c),c}async _postInitialize(e,t){const{modules:r,logger:n,_afterInit:o}=this,i=ui(r).pipe(Li(e=>!!e.postInitialize),Mi(e=>n.debug(`🚀📌 post initializing moule ${n.formatModuleName(e)}`)),wi(r=>ui(r.postInitialize({ref:t,modules:e,instance:e[r.name]})).pipe(Mi(()=>{n.debug(`🚀📌 post initialized moule ${n.formatModuleName(r)}`)}),Ri(e=>(n.warn(`🚀📌 post initialize failed moule ${n.formatModuleName(r)}`,e),zo)))));if(await new Promise((e,t)=>{i.subscribe({complete:()=>e(!0),error:t})}),o.length)try{n.debug(`🚀📌 post configure hooks [${o.length}]`),await Promise.allSettled(o.map(t=>Promise.resolve(t(e)))),n.debug("🚀📌 post configure hooks complete")}catch(e){n.warn("🚀📌 post configure hook failed",e)}n.debug(`🎉 Modules initialized ${r.map(n.formatModuleName)}`,e),n.info("🟢 Modules initialized")}async dispose(e,t){const{modules:r}=this;await Promise.allSettled(r.filter(e=>!!e.dispose).map(async r=>{await(r.dispose?.({ref:t,modules:e,instance:e[r.name]}))}))}}class Xi{_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?ui(Object.values(this._operators)).pipe((t=(e,t)=>Promise.resolve(t(e)).then(t=>t??e),r=e,n=1,So(function(e,o){var i=r;return bi(e,o,function(e,r){return t(i,e,r)},n,function(e){i=e},!1,void 0,function(){return i=null})})),ki()):li(e);var t,r,n}}class Ki extends Xi{setHeader(e,t){const r=((e,t)=>r=>{const n=new Headers(r.headers);return n.append(e,t),{...r,headers:n}})(e,t);return this.set("header-"+e,r)}}class Wi extends Xi{}const Yi=()=>O.custom(e=>e===e?.toUpperCase(),e=>({code:O.ZodIssueCode.custom,validation:"uppercase",path:["method"],message:[`Provided HTTP method '${e}' must be in uppercase.`,"See RFC 7231 Section 4.1 for more information","https://www.rfc-editor.org/rfc/rfc7231#section-4.1"].join(" ")})),Ji=O.object({attributionReporting:O.object({eventSourceEligible:O.boolean().optional(),triggerEligible:O.boolean().optional()}).optional(),body:O.union([O.string(),O.instanceof(Blob),O.instanceof(ArrayBuffer),O.instanceof(FormData),O.instanceof(URLSearchParams),O.instanceof(ReadableStream)]).optional(),browsingTopics:O.boolean().optional(),cache:O.enum(["default","no-store","reload","no-cache","force-cache","only-if-cached"]).optional(),credentials:O.enum(["omit","same-origin","include"]).optional(),headers:O.record(O.string(),O.string()).optional().or(O.instanceof(Headers)),integrity:O.string().optional(),keepalive:O.boolean().optional(),method:Yi().pipe(O.enum(["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD","CONNECT","TRACE"],{errorMap:e=>{const{received:t,options:r}=e;return{message:["Invalid request method.",`Expected '${r.join(" | ")}', but received '${t}'.`,"See RFC 2615 Section 9 for more information","https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html"].join(" ")}}})).optional(),mode:O.enum(["same-origin","cors","no-cors","navigate","websocket"]).optional(),priority:O.enum(["low","high","auto"]).optional(),redirect:O.enum(["follow","error","manual"]).optional(),referrer:O.string().optional(),referrerPolicy:O.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:O.instanceof(AbortSignal).optional()}).extend({uri:O.string(),path:O.string().optional()}),Qi=e=>e=>{const{error:t,success:r,data:n}=Yi().safeParse(e.method);if(e.method=r?n:e.method?.toUpperCase(),t)for(const e of t.errors)console.warn(e.message);return e},es=e=>e=>{const{strict:t,parse:r}={},n=t?Ji:Ji.passthrough();try{const t=n.parse(e);return r?t:void 0}catch(e){if(r)throw e;console.error("Invalid request options",e.message)}};class ts{_clients={};get clients(){return{...this._clients}}defaultHttpClientCtor;defaultHttpRequestHandler=new Ki({"capitalize-method":Qi(),"request-validation":es()});constructor(e){this.defaultHttpClientCtor=e}hasClient(e){return Object.keys(this._clients).includes(e)}configureClient(e,t){const r="string"==typeof t?{baseUri:t}:t,n="function"==typeof r?{onCreate:r}:r;return this._clients[e]={...this._clients[e],...n},this}}class rs extends Error{}class ns{config;get defaultHttpRequestHandler(){return this.config.defaultHttpRequestHandler}constructor(e){this.config=e}hasClient(e){return Object.keys(this.config.clients).includes(e)}createClient(e){const t=this._resolveConfig(e),{baseUri:r,defaultScopes:n=[],onCreate:o,ctor:i=this.config.defaultHttpClientCtor,requestHandler:s=this.defaultHttpRequestHandler}=t,a=new i(r||"",{requestHandler:s});return Object.assign(a,{defaultScopes:n}),o?.(a),a}createCustomClient(e){return this.createClient(e)}_resolveConfig(e){if("string"==typeof e){const r=this.config.clients[e];if(!r&&(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(!r)throw new rs(`No registered http client for key [${e}]`);return r}var t;return e}}function os(e,t){void 0===t&&(t={});var r=t.selector,n=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(t,["selector"]);return new Oo(function(t){var o=new AbortController,i=o.signal,s=!0,a=n.signal;if(a)if(a.aborted)o.abort();else{var c=function(){i.aborted||o.abort()};a.addEventListener("abort",c),t.add(function(){return a.removeEventListener("abort",c)})}var u=Kn(Kn({},n),{signal:i}),l=function(e){s=!1,t.error(e)};return fetch(e,u).then(function(e){r?ri(r(e)).subscribe(Lo(t,void 0,function(){s=!1,t.complete()},l)):(s=!1,t.next(e),t.complete())}).catch(l),function(){s&&o.abort()}})}const is=async e=>{if(204===e.status)return Promise.resolve();try{const t=await e.json();if(!e.ok)throw new kt("network response was not OK",e,{data:t});return t}catch(t){if(t instanceof kt)throw t;throw new kt("failed to parse response",e,{cause:t})}},ss=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")}},as=e=>{try{return JSON.parse(e)}catch{return e}};function*cs(e,t){const r=e.split("\n\n"),n=t?.dataParser||as;for(const e of r){if(!e.trim())continue;const t=e.split("\n").reduce((e,t)=>{if(!t)return e;const r=t.indexOf(":");if(-1===r)return e;const o=t.slice(0,r).trim(),i=t.slice(r+1).trim();return"data"===o?e.data=n(i):e[o]=i,e},{});Object.keys(t).length&&(yield t)}}const us=e=>t=>{if(!t.ok)throw new Ft(`HTTP error! Status: ${t.status}`,t);if(!t.body)throw new Ft("Response body is not readable",t);if(!t.headers.get("Content-Type")?.includes("text/event-stream"))throw new Ft("Response is not a text/event-stream",t);const r=t.body.getReader();return ui(async function*(e,t){const r=!!t?.skipHeartbeats,n=t?.eventFilter?Array.isArray(t.eventFilter)?t.eventFilter:[t.eventFilter]:null,o=new TextDecoder;for(;;){const{done:i,value:s}=await e.read();if(i)break;const a=cs(o.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(r){if(!e.event&&!e.data&&!e.id)continue;if(e.event&&["heartbeat","ping"].includes(e.event))continue}(!n||e.event&&n.includes(e.event))&&(yield e)}}}(r,{dataParser:e?.dataParser,skipHeartbeats:e?.skipHeartbeats,eventFilter:e?.eventFilter})).pipe(ji(e?.abortSignal?Oi(e.abortSignal,"abort"):zo),Ui(async()=>{await r.cancel().catch(()=>{}),r.releaseLock()}))};class ls{uri;requestHandler;responseHandler;_request$=new To;_response$=new To;_abort$=new To;get request$(){return this._request$.asObservable()}get response$(){return this._response$.asObservable()}constructor(e,t){this.uri=e,this.requestHandler=new Ki(t?.requestHandler),this.responseHandler=new Wi(t?.responseHandler),this._init()}_init(){}fetch$(e,t){return this._fetch$(e,t)}fetch(e,t){return di(this.fetch$(e,t))}fetchAsync(e,t){return this.fetch(e,t)}json$(e,t){const r="object"==typeof t?.body?JSON.stringify(t?.body):t?.body,n=t?.selector??is,o=new Headers(t?.headers);return o.append("Accept","application/json"),o.append("Content-Type","application/json"),this.fetch$(e,{...t,body:r,selector:n,headers:o})}json(e,t){return di(this.json$(e,t))}blob$(e,t){const r=t?.selector??ss,n={...t,selector:r};return this.fetch$(e,n)}blob(e,t){return di(this.blob$(e,t))}sse$(e,t,r){const n=new Headers(t?.headers);n.append("Accept","text/event-stream"),n.append("Content-Type","text/event-stream"),n.append("Cache-Control","no-cache"),n.append("Connection","keep-alive");const o=us({...r,abortSignal:t?.signal});return this._fetch$(e,{selector:o,...t,headers:n})}jsonAsync(e,t){return this.json(e,t)}execute(e,t,r){return this[e](t,r)}abort(){this._abort$.next()}_fetch$(e,t){const{selector:r,...n}=t||{},o=li({...n,uri:this._resolveUrl(e)}).pipe(Bi(e=>this._prepareRequest(e)),Mi(e=>this._request$.next(e)),Bi(({uri:e,path:t,...r})=>os(e,r)),Bi(e=>this._prepareResponse(e)),Mi(e=>this._response$.next(e)),Bi(e=>{if(r)try{return r(e)}catch(t){throw new Ut("failed to execute response selector",e,{cause:t})}return li(e)}),ji(this._abort$));return o}_prepareRequest(e){return this.requestHandler.process(e)}_prepareResponse(e){return this.responseHandler.process(e)}_resolveUrl(e){const{origin:t,pathname:r}=new URL(this.uri,this.uri.startsWith("http")?void 0:window.location.origin),n=[r,e].join("/").replace(/\/{2,}/g,"/");return new URL(n,t).href}}class fs extends ls{defaultScopes=[];fetch$(e,t){const r=Object.assign(t||{},{scopes:this.defaultScopes.concat(t?.scopes||[])});return super._fetch$(e,r)}}const ps={name:"http",configure:()=>new ts(fs),initialize:async({config:e,hasModule:t,requireInstance:r})=>{const n=new ns(e);if(t("auth")){const e=await r("auth");n.defaultHttpRequestHandler.set("MSAL",async t=>{const{scopes:r=[]}=t;if(r.length){const n=await e.acquireAccessToken({scopes:r});if(n){const e=new Headers(t.headers);return e.set("Authorization",`Bearer ${n}`),{...t,headers:e}}}})}return n}},ds=(...e)=>t=>t.pipe(function(e,t){return oo(t)?wi(e,t,1):wi(e,1)}(...e)),hs=(...e)=>t=>t.pipe(wi(...e)),ms=(...e)=>t=>t.pipe(Bi(...e)),gs=e=>e.pipe(vi(e=>e.value));var vs=/^(?:[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 Es(e){if(!function(e){return"string"==typeof e&&vs.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 ys=[];for(let e=0;e<256;++e)ys.push((e+256).toString(16).slice(1));function bs(e,t=0){return(ys[e[t+0]]+ys[e[t+1]]+ys[e[t+2]]+ys[e[t+3]]+"-"+ys[e[t+4]]+ys[e[t+5]]+"-"+ys[e[t+6]]+ys[e[t+7]]+"-"+ys[e[t+8]]+ys[e[t+9]]+"-"+ys[e[t+10]]+ys[e[t+11]]+ys[e[t+12]]+ys[e[t+13]]+ys[e[t+14]]+ys[e[t+15]]).toLowerCase()}let ws;const Is=new Uint8Array(16);function _s(e,t,r,n,o,i){const s="string"==typeof r?function(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}(r):r,a="string"==typeof n?Es(n):n;if("string"==typeof n&&(n=Es(n)),16!==n?.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,o){i=i||0;for(let e=0;e<16;++e)o[i+e]=c[e];return o}return bs(c)}var Cs={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Os(e,t,r){if(Cs.randomUUID&&!e)return Cs.randomUUID();const n=(e=e||{}).random??e.rng?.()??function(){if(!ws){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ws=crypto.getRandomValues.bind(crypto)}return ws(Is)}();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=15&n[6]|64,n[8]=63&n[8]|128,bs(n)}function Ns(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function Ss(e,t){return e<<t|e>>>32-t}function Ls(e){const t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128;const o=(e=n).length/4+2,i=Math.ceil(o/16),s=new Array(i);for(let t=0;t<i;++t){const r=new Uint32Array(16);for(let n=0;n<16;++n)r[n]=e[64*t+4*n]<<24|e[64*t+4*n+1]<<16|e[64*t+4*n+2]<<8|e[64*t+4*n+3];s[t]=r}s[i-1][14]=8*(e.length-1)/Math.pow(2,32),s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<i;++e){const n=new Uint32Array(80);for(let t=0;t<16;++t)n[t]=s[e][t];for(let e=16;e<80;++e)n[e]=Ss(n[e-3]^n[e-8]^n[e-14]^n[e-16],1);let o=r[0],i=r[1],a=r[2],c=r[3],u=r[4];for(let e=0;e<80;++e){const r=Math.floor(e/20),s=Ss(o,5)+Ns(r,i,a,c)+u+t[r]+n[e]>>>0;u=c,c=a,a=Ss(i,30)>>>0,i=o,o=s}r[0]=r[0]+o>>>0,r[1]=r[1]+i>>>0,r[2]=r[2]+a>>>0,r[3]=r[3]+c>>>0,r[4]=r[4]+u>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function Rs(e,t,r,n){return _s(80,Ls,e,t,r,n)}Rs.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Rs.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";class Ds extends Error{type;request;constructor(e,t){super(t.message,{cause:t.cause}),this.type=e,this.name="QueryClientError",this.request=t.request}}function Ts(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if("production"!==process.env.NODE_ENV){var o=Ea[e],i=o?"function"==typeof o?o.apply(null,r):o:"unknown error nr: "+e;throw Error("[Immer] "+i)}throw Error("[Immer] minified error nr: "+e+(r.length?" "+r.map(function(e){return"'"+e+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function As(e){return!!e&&!!e[va]}function Ps(e){var t;return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===ya}(e)||Array.isArray(e)||!!e[ga]||!!(null===(t=e.constructor)||void 0===t?void 0:t[ga])||Fs(e)||Bs(e))}function $s(e,t,r){void 0===r&&(r=!1),0===xs(e)?(r?Object.keys:ba)(e).forEach(function(n){r&&"symbol"==typeof n||t(n,e[n],e)}):e.forEach(function(r,n){return t(n,r,e)})}function xs(e){var t=e[va];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:Fs(e)?2:Bs(e)?3:0}function Us(e,t){return 2===xs(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ks(e,t,r){var n=xs(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function Fs(e){return pa&&e instanceof Map}function Bs(e){return da&&e instanceof Set}function js(e){return e.o||e.t}function Ms(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=wa(e);delete t[va];for(var r=ba(t),n=0;n<r.length;n++){var o=r[n],i=t[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function Hs(e,t){return void 0===t&&(t=!1),zs(e)||As(e)||!Ps(e)||(xs(e)>1&&(e.set=e.add=e.clear=e.delete=Gs),Object.freeze(e),t&&$s(e,function(e,t){return Hs(t,!0)},!0)),e}function Gs(){Ts(2)}function zs(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function qs(e){var t=Ia[e];return t||Ts(18,e),t}function Vs(){return"production"===process.env.NODE_ENV||la||Ts(0),la}function Zs(e,t){t&&(qs("Patches"),e.u=[],e.s=[],e.v=t)}function Xs(e){Ks(e),e.p.forEach(Ys),e.p=null}function Ks(e){e===la&&(la=e.l)}function Ws(e){return la={p:[],l:la,h:e,m:!0,_:0}}function Ys(e){var t=e[va];0===t.i||1===t.i?t.j():t.g=!0}function Js(e,t){t._=t.p.length;var r=t.p[0],n=void 0!==e&&e!==r;return t.h.O||qs("ES5").S(t,e,n),n?(r[va].P&&(Xs(t),Ts(4)),Ps(e)&&(e=Qs(t,e),t.l||ta(t,e)),t.u&&qs("Patches").M(r[va].t,e,t.u,t.s)):e=Qs(t,r,[]),Xs(t),t.u&&t.v(t.u,t.s),e!==ma?e:void 0}function Qs(e,t,r){if(zs(t))return t;var n=t[va];if(!n)return $s(t,function(o,i){return ea(e,n,t,o,i,r)},!0),t;if(n.A!==e)return t;if(!n.P)return ta(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var o=4===n.i||5===n.i?n.o=Ms(n.k):n.o,i=o,s=!1;3===n.i&&(i=new Set(o),o.clear(),s=!0),$s(i,function(t,i){return ea(e,n,o,t,i,r,s)}),ta(e,o,!1),r&&e.u&&qs("Patches").N(n,r,e.u,e.s)}return n.o}function ea(e,t,r,n,o,i,s){if("production"!==process.env.NODE_ENV&&o===r&&Ts(5),As(o)){var a=Qs(e,o,i&&t&&3!==t.i&&!Us(t.R,n)?i.concat(n):void 0);if(ks(r,n,a),!As(a))return;e.m=!1}else s&&r.add(o);if(Ps(o)&&!zs(o)){if(!e.h.D&&e._<1)return;Qs(e,o),t&&t.A.l||ta(e,o)}}function ta(e,t,r){void 0===r&&(r=!1),!e.l&&e.h.D&&e.m&&Hs(t,r)}function ra(e,t){var r=e[va];return(r?js(r):e)[t]}function na(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function oa(e){e.P||(e.P=!0,e.l&&oa(e.l))}function ia(e){e.o||(e.o=Ms(e.t))}function sa(e,t,r){var n=Fs(t)?qs("MapSet").F(t,r):Bs(t)?qs("MapSet").T(t,r):e.O?function(e,t){var r=Array.isArray(e),n={i:r?1:0,A:t?t.A:Vs(),P:!1,I:!1,R:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=n,i=_a;r&&(o=[n],i=Ca);var s=Proxy.revocable(o,i),a=s.revoke,c=s.proxy;return n.k=c,n.j=a,c}(t,r):qs("ES5").J(t,r);return(r?r.A:Vs()).p.push(n),n}function aa(e){return As(e)||Ts(22,e),function e(t){if(!Ps(t))return t;var r,n=t[va],o=xs(t);if(n){if(!n.P&&(n.i<4||!qs("ES5").K(n)))return n.t;n.I=!0,r=ca(t,o),n.I=!1}else r=ca(t,o);return $s(r,function(t,o){n&&function(e,t){return 2===xs(e)?e.get(t):e[t]}(n.t,t)===o||ks(r,t,e(o))}),3===o?new Set(r):r}(e)}function ca(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Ms(e)}var ua,la,fa="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),pa="undefined"!=typeof Map,da="undefined"!=typeof Set,ha="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,ma=fa?Symbol.for("immer-nothing"):((ua={})["immer-nothing"]=!0,ua),ga=fa?Symbol.for("immer-draftable"):"__$immer_draftable",va=fa?Symbol.for("immer-state"):"__$immer_state",Ea={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3: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},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(e){return"Cannot apply patch, path doesn't resolve: "+e},16:'Sets cannot have "replace" patches.',17:function(e){return"Unsupported patch operation: "+e},18: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."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21: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+"'"},22:function(e){return"'current' expects a draft, got: "+e},23:function(e){return"'original' expects a draft, got: "+e},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},ya=""+Object.prototype.constructor,ba="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,wa=Object.getOwnPropertyDescriptors||function(e){var t={};return ba(e).forEach(function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)}),t},Ia={},_a={get:function(e,t){if(t===va)return e;var r=js(e);if(!Us(r,t))return function(e,t,r){var n,o=na(t,r);return o?"value"in o?o.value:null===(n=o.get)||void 0===n?void 0:n.call(e.k):void 0}(e,r,t);var n=r[t];return e.I||!Ps(n)?n:n===ra(e.t,t)?(ia(e),e.o[t]=sa(e.A.h,n,e)):n},has:function(e,t){return t in js(e)},ownKeys:function(e){return Reflect.ownKeys(js(e))},set:function(e,t,r){var n=na(js(e),t);if(null==n?void 0:n.set)return n.set.call(e.k,r),!0;if(!e.P){var o=ra(js(e),t),i=null==o?void 0:o[va];if(i&&i.t===r)return e.o[t]=r,e.R[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(r,o)&&(void 0!==r||Us(e.t,t)))return!0;ia(e),oa(e)}return e.o[t]===r&&(void 0!==r||t in e.o)||Number.isNaN(r)&&Number.isNaN(e.o[t])||(e.o[t]=r,e.R[t]=!0),!0},deleteProperty:function(e,t){return void 0!==ra(e.t,t)||t in e.t?(e.R[t]=!1,ia(e),oa(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=js(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty:function(){Ts(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){Ts(12)}},Ca={};$s(_a,function(e,t){Ca[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Ca.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&Ts(13),Ca.set.call(this,e,t,void 0)},Ca.set=function(e,t,r){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&Ts(14),_a.set.call(this,e[0],t,r,e[0])};var Oa=function(){function e(e){var t=this;this.O=ha,this.D=!0,this.produce=function(e,r,n){if("function"==typeof e&&"function"!=typeof r){var o=r;r=e;var i=t;return function(e){var t=this;void 0===e&&(e=o);for(var n=arguments.length,s=Array(n>1?n-1:0),a=1;a<n;a++)s[a-1]=arguments[a];return i.produce(e,function(e){var n;return(n=r).call.apply(n,[t,e].concat(s))})}}var s;if("function"!=typeof r&&Ts(6),void 0!==n&&"function"!=typeof n&&Ts(7),Ps(e)){var a=Ws(t),c=sa(t,e,void 0),u=!0;try{s=r(c),u=!1}finally{u?Xs(a):Ks(a)}return"undefined"!=typeof Promise&&s instanceof Promise?s.then(function(e){return Zs(a,n),Js(e,a)},function(e){throw Xs(a),e}):(Zs(a,n),Js(s,a))}if(!e||"object"!=typeof e){if(void 0===(s=r(e))&&(s=e),s===ma&&(s=void 0),t.D&&Hs(s,!0),n){var l=[],f=[];qs("Patches").M(e,s,l,f),n(l,f)}return s}Ts(21,e)},this.produceWithPatches=function(e,r){if("function"==typeof e)return function(r){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return t.produceWithPatches(r,function(t){return e.apply(void 0,[t].concat(o))})};var n,o,i=t.produce(e,r,function(e,t){n=e,o=t});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(function(e){return[e,n,o]}):[i,n,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){Ps(e)||Ts(8),As(e)&&(e=aa(e));var t=Ws(this),r=sa(this,e,void 0);return r[va].C=!0,Ks(t),r},t.finishDraft=function(e,t){var r=e&&e[va];"production"!==process.env.NODE_ENV&&(r&&r.C||Ts(9),r.I&&Ts(10));var n=r.A;return Zs(n,t),Js(void 0,n)},t.setAutoFreeze=function(e){this.D=e},t.setUseProxies=function(e){e&&!ha&&Ts(20),this.O=e},t.applyPatches=function(e,t){var r;for(r=t.length-1;r>=0;r--){var n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));var o=qs("Patches").$;return As(e)?o(e,t):this.produce(e,function(e){return o(e,t)})},e}(),Na=new Oa,Sa=Na.produce;Na.produceWithPatches.bind(Na),Na.setAutoFreeze.bind(Na),Na.setUseProxies.bind(Na),Na.applyPatches.bind(Na),Na.createDraft.bind(Na),Na.finishDraft.bind(Na);const La=(...e)=>Li(t=>e.includes(t.type));class Ra extends Oo{#o=new To;#i;get action$(){return this.#o.asObservable()}get value(){return this.#i.value}get closed(){return this.#i.closed||this.#o.closed}constructor(e,t){super(e=>this.#i.subscribe(e));const r="getInitialState"in e?e.getInitialState():t;this.#i=new Po(r),this.#o.pipe(function(e,t){return So(Di(e,t,arguments.length>=2,!0))}(e,r),Ai()).subscribe(this.#i),this.reset=()=>this.#i.next(r)}reset;next(e){this.#o.next(e)}select(e,t){return this.#i.pipe(vi(e),Ai(t))}addEffect(e,t){const r="function"==typeof e?this.action$:Array.isArray(e)?this.action$.pipe(La(...e)):this.action$.pipe(La(e)),n=t||e;return r.pipe(wi(e=>ui(new Promise((t,r)=>{try{t(n(e,this.value))}catch(e){r(e)}})).pipe(Ri(e=>(console.warn("unhandled effect",e),zo)))),Li(e=>!!e),ii(Ho)).subscribe(this.#o)}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(Ri(e=>(console.trace("unhandled exception, epic closed!",e),zo)),ii(Ho)).subscribe(this.#o)}unsubscribe(){this.#o.unsubscribe(),this.#i.unsubscribe()}complete(){this.#o.complete(),this.#i.complete()}asObservable(){return this.#i.asObservable()}}function Da(e,t){function r(...r){if(t){const n=t(...r);if(!n)throw new Error("prepareAction did not return an object");return{type:e,payload:n.payload,..."meta"in n&&{meta:n.meta},..."error"in n&&{error:n.error}}}return{type:e,payload:r[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=t=>t.type===e,r}const Ta="::";function Aa(e,t,r,n){const o=Da([e,"request"].join(Ta),t);return r&&Object.assign(o,{success:Da([e,"success"].join(Ta),r)}),n&&Object.assign(o,{failure:Da([e,"failure"].join(Ta),n)}),o}function Pa(e){return Ps(e)?Sa(e,()=>{}):e}function $a(e,t){const[r,n,o]=function(e){const t={},r=[];let n;const o={addCase(e,i){if("production"!==process.env.NODE_ENV){if(r.length>0)throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");if(n)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]=i,o},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&n)throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return r.push({matcher:e,reducer:t}),o},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&n)throw new Error("`builder.addDefaultCase` can only be called once");return n=e,o}};return e(o),[t,r,n]}(t);let i;if(function(e){return"function"==typeof e}(e))i=()=>Pa(e());else{const t=Pa(e);i=()=>t}function s(e,t){let s=[r[t.type],...n.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o&&0===s.filter(e=>!!e).length&&(s=[o]),s.reduce((e,r)=>{if(r){if(As(e)){const n=r(e,t);return void 0===n?e:n}if(Ps(e))return Sa(e,e=>r(e,t));{const n=r(e,t);if(void 0===n){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return n}}return e},e??i())}return s.getInitialState=i,s}const xa={request:Da("client/request",(e,t)=>({payload:{args:e,options:t},meta:{transaction:Os(),created:Date.now()}})),execute:Aa("client/execute",e=>({payload:e,meta:{transaction:e,created:Date.now()}}),e=>({payload:e,meta:{transaction:e.transaction,created:Date.now()}}),(e,t)=>({payload: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()}}))},Ua=e=>e.pipe(Li(xa.request.match),vi(e=>xa.execute(e.meta.transaction))),ka=e=>{const t=Number(e);if(Object.values(Fa).includes(t))return t;if(isNaN(t))return(e=>{if("string"!=typeof e)throw new Error("Expected LogLevel key to be a string.");const t=e.toLowerCase(),r=Object.keys(Fa).find(e=>e.toLowerCase()===t);if(!r)throw new Error(`Failed to parse LogLevel from string: ${e}.`);return Fa[r]})(e);throw Error(`Invalid log level: ${e}`)};var Fa;!function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warning=2]="Warning",e[e.Info=3]="Info",e[e.Debug=4]="Debug"}(Fa||(Fa={}));const Ba=(()=>{const e=process.env.FUSION_LOG_LEVEL;if(e)try{return ka(e)}catch(e){return"development"===process.env.NODE_ENV?Fa.Debug:Fa.Error}return Fa.Error})();class ja{level=Ba;version="1.1.6";_log$=new To;get log(){return this._log$.pipe(Li(e=>this.level>=e.lvl))}debug(...e){this._log$.next({lvl:Fa.Debug,msg:this._createMessage(Fa.Debug,...e)})}info(...e){this._log$.next({lvl:Fa.Info,msg:this._createMessage(Fa.Info,...e)})}warn(...e){this._log$.next({lvl:Fa.Warning,msg:this._createMessage(Fa.Warning,...e)})}error(...e){this._log$.next({lvl:Fa.Error,msg:this._createMessage(Fa.Error,...e)})}}class Ma extends ja{title;subtitle;constructor(e,t){super(),this.title=e,this.subtitle=t,this.log.subscribe(({lvl:e,msg:t})=>{switch(e){case Fa.Debug:console.debug(...t);break;case Fa.Info:console.info(...t);break;case Fa.Warning:console.warn(...t);break;case Fa.Error:console.error(...t)}})}_createMessage(e,...t){return[this._formatTitle(e),...t]}_formatTitle(e){const t=ie.magenta([this.title,this.subtitle].filter(e=>!!e).join(" - "));switch(e){case Fa.Warning:case Fa.Error:return ie.bold(t)}return t}createSubLogger(e,t,r){const n=new Ma(`${this.title}::${e}`,t??this.subtitle);return n.level=void 0===r?this.level:r,n}}class Ha extends Oo{#s=new Po("idle");get status(){return this.#s.value}get status$(){return this.#s.asObservable()}#a;#c;get transaction(){return this.#c}created=Date.now();get closed(){return"complete"===this.status||"error"===this.status||"canceled"===this.status}constructor(e,t,r){super(t=>{const{transaction:n}=this,o=e.action$.pipe(Li(e=>e.meta.transaction===n));t.add(e.state$.pipe(Li(e=>!!e[n]),vi(e=>e[n])).subscribe(e=>{this.#s.next(e.status)})),t.add(o.pipe(Li(xa.execute.success.match),vi(({payload:e})=>e)).subscribe(e=>{this.#s.next("complete"),t.next(e),t.complete()})),t.add(o.pipe(Li(xa.error.match),vi(({payload:e})=>e)).subscribe(e=>{this.#s.next("error"),t.error(e.error)})),t.add(o.pipe(Li(xa.cancel.match)).subscribe(e=>{this.#s.next("canceled"),t.error(new Ds("abort",{message:e.payload.reason||`job: ${n} was canceled`,request:this.#a.getRequest(e.meta.transaction)}))})),r?.signal&&t.add(Oi(r?.signal,"abort").pipe(vi(()=>xa.cancel(n,`job: ${n} was aborted on signal from caller: ${r?.ref}`))).subscribe(t=>e.next(t))),t.add(()=>{this.complete()})}),this.#a=e;const n=xa.request(t,{ref:r?.ref,retry:r?.retry});this.#c=n.meta.transaction,this.#a.next(n)}complete(e){this.closed||this.cancel(e??`job: ${this.transaction} was completed`)}cancel(e){const t=this.transaction;this.#a.cancel(t,e??`job: ${t} was canceled`)}[Symbol.dispose](){this.complete()}}class Ga extends Oo{#i;#u;#l;get closed(){return this.#i.closed}get state$(){return this.#i.asObservable()}get action$(){return this.#i.action$}get success$(){return this.action$.pipe(Li(xa.execute.success.match),vi(({payload:e})=>e))}get error$(){return this.action$.pipe(La("client/error"),Hi(this.#i),vi(([e,t])=>{const{payload:r,meta:{transaction:n}}=e,o=t[n];return new Ds("error",{request:o,message:`job: ${n} failed`,cause:r})}))}constructor(e,t){super(e=>this.#i.subscribe(e)),this.#i=new Ra(((e={})=>$a(e,e=>{e.addCase(xa.request,(e,t)=>{e[t.meta.transaction]={...t.payload,...t.meta,execution:[],errors:[],status:"idle"}}),e.addCase(xa.execute,(e,t)=>{const r=e[t.payload];r&&(r.execution.push(Date.now()),r.status="active")}),e.addCase(xa.execute.success,(e,t)=>{delete e[t.payload.transaction]}),e.addCase(xa.execute.failure,(e,t)=>{const r=e[t.meta.transaction];r&&(r.errors.push(t.payload),r.status="failed")}),e.addCase(xa.error,(e,t)=>{delete e[t.meta.transaction]}),e.addCase(xa.cancel,(e,t)=>{delete e[t.meta.transaction]})}))({})),this.#u=new co(()=>this.#i.complete()),this.#u.add(this.#i.addFlow(Ua)),this.#u.add(this.#i.addFlow((e=>(t,r)=>t.pipe(Li(xa.execute.match),Hi(r),wi(([r,n])=>{const o=r.payload,i=n[o],s=new AbortController,a=t.pipe(Li(xa.cancel.match),Li(e=>e.payload.transaction===o),Mi(()=>{s.signal.aborted||s.abort()}));try{return ui(e(i.args,s.signal)).pipe(vi(e=>xa.execute.success({...i,status:"complete",completed:Date.now(),value:e})),Ri(e=>li(xa.execute.failure(e,o))),ji(a))}catch(e){return li(xa.execute.failure(e,o))}})))(e))),this.#u.add(this.#i.addFlow((e=>(t,r)=>t.pipe(Li(xa.execute.failure.match),Hi(r),wi(([t,n])=>{const{transaction:o}=t.meta,i=n[o];if(!i)return li(xa.error(o,new Ds("error",{message:"request not found, cannot retry request, most likely removed while scheduled for retry!"})));const s=i.execution.length,a=Object.assign({},e,i.options?.retry),c=i.errors?.slice(-1)[0]??new Ds("error",{message:"no errors registered for request!",request:i});if(s>a.count){const e=0===a.count?c:new Ds("error",{message:"maximum retries executed!",cause:i.errors,request:i});return li(xa.error(o,e))}return("function"==typeof a.delay?ui(a.delay(c)).pipe(Ri(e=>li(xa.error(o,new Ds("error",{message:"retry delay callback failed!",cause:[...i.errors??[],e],request:i}))))):Si(a.delay)).pipe(Hi(r),Li(([e,t])=>!!t[o]),Mi(([,e])=>{if(!e[o])throw new Ds("error",{message:"request not found, most likely removed while scheduled for retry",cause:i.errors,request:i})}),vi(()=>xa.execute(o)))})))(Object.assign({count:0,delay:0},t?.retry)))),this.#l=t?.logger??new Ma("QueryClient"),this.#i.addEffect(xa.request.type,({payload:e,meta:{transaction:t}})=>{this.#l.debug("Job requested",{transaction:t,payload:e})}),this.#i.addEffect(xa.execute.type,({payload:e,meta:{transaction:t}})=>{this.#l.debug("Job executing",{transaction:t,payload:e})}),this.#i.addEffect(xa.execute.success.type,({payload:e})=>{this.#l.info("Job complete",{...e})}),this.#i.addEffect(xa.execute.failure.type,({payload:e,meta:{transaction:t}})=>{this.#l.debug("Job failed",{transaction:t,payload:e})}),this.#i.addEffect(xa.cancel.type,({payload:{reason:e},meta:{transaction:t}})=>{this.#l.debug("Job canceled",{transaction:t,reason:e})}),this.#i.addEffect(xa.error.type,({payload:{transaction:e,error:t}})=>{this.#l.error("Job error",{transaction:e,error:t})})}next(e){this.#i.next(e)}query(e,t){const r=new Ha(this,e,t),n=r.pipe(function(e){void 0===e&&(e={});var t=e.connector,r=void 0===t?function(){return new To}:t,n=e.resetOnError,o=void 0===n||n,i=e.resetOnComplete,s=void 0===i||i,a=e.resetOnRefCountZero,c=void 0===a||a;return function(e){var t,n,i,a=0,u=!1,l=!1,f=function(){null==n||n.unsubscribe(),n=void 0},p=function(){f(),t=i=void 0,u=l=!1},d=function(){var e=t;p(),null==e||e.unsubscribe()};return So(function(e,h){a++,l||u||f();var m=i=null!=i?i:r();h.add(function(){0!==--a||l||u||(n=Fi(d,c))}),m.subscribe(h),!t&&a>0&&(t=new bo({next:function(e){return m.next(e)},error:function(e){l=!0,f(),n=Fi(p,o,e),m.error(e)},complete:function(){u=!0,f(),n=Fi(p,s),m.complete()}}),ri(e).subscribe(t))})(e)}}({connector:()=>new xo,resetOnRefCountZero:!1}));return Object.defineProperties(n,{transaction:{get:()=>r.transaction},created:{get:()=>r.created},status:{get:()=>r.status},closed:{get:()=>r.closed},cancel:{value:e=>r.cancel(e)},complete:{value:()=>r.complete()}}),n}async nextAsync(e,t){return di(this.query(e,t))}getRequest(e){return this.#i.value[e]}getRequestByRef(e){return Object.values(this.#i.value).find(t=>t.ref===e)}cancelTaskByRef(e,t){const r=this.getRequestByRef(e);r?.ref&&this.cancel(r.transaction,t)}cancel(e,t){if(e)this.#i.value[e]?(t??=`cancelation requested for job: ${e}`,this.#i.next(xa.cancel(e,t))):this.#l.warn("Task not registered, nothing to cancel",{transaction:e,reason:t});else for(const e of Object.keys(this.#i.value))this.cancel(e,"all transactions requested canceled")}on(e,t){return this.#i.addEffect(xa[e].type,e=>{t(e,this)})}complete(){this.#u.unsubscribe()}}const za={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,r)=>({payload:{...t,key:e},meta:{item:r}})),trim:Da("cache/trim",e=>({payload:e}))},qa=(e,t)=>(t.updated??0)-(e.updated??0);class Va{#i;get state(){return this.#i.value}get state$(){return this.#i.asObservable()}get action$(){return this.#i.action$}constructor(e){const{trimming:t,initial:r}=e??{};this.#i=new Ra(function(e,t={}){return $a(t,t=>t.addCase(e.set,(e,t)=>{const{key:r,record:n}=t.payload;e[r]=n}).addCase(e.insert,(e,t)=>{const{key:r,entry:n}=t.payload,o=e[r];if(o)o.updated=Date.now(),o.updates??=0,o.updates++,o.value=n.value,o.transaction=n.transaction,o.mutated=void 0;else{const t=Date.now();e[r]={...n,created:t,updated:t}}}).addCase(e.remove,(e,t)=>{delete e[t.payload]}).addCase(e.invalidate,(e,t)=>{const r=t.payload?[t.payload]:Object.keys(e);for(const t of r){const r=e[t];r&&(r.updated=void 0)}}).addCase(e.mutate,(e,t)=>{const{key:r,value:n,updated:o}=t.payload,i=e[r];i&&(i.value=n,i.updated=o,i.mutated=Date.now(),i.updates??=0,i.updates++)}).addCase(e.trim,(e,t)=>{const{payload:r}=t,n=r.sort??qa,o=Object.keys(e),i=Object.entries(e).filter(([e,t])=>!r.validate||r.validate(t)).sort((e,t)=>n(e[1],t[1])).slice(0,r.size??Number.MAX_SAFE_INTEGER).map(([e])=>e);if(o.length!==i.length)for(const t of o){const r=i.indexOf(t);-1!==r?i.splice(r,1):delete e[t]}}))}(za,r)),t&&this.#i.addEffect("cache/set",()=>this.#i.next(za.trim(t)))}has(e){return e in this.#i.value}setItem(e,t){const{args:r,transaction:n,value:o}=t;this.#i.next(za.insert(e,{args:r,transaction:n,value:o}))}getItem(e){return this.#i.value[e]}removeItem(e){this.#i.next(za.remove(e))}invalidate(e){const t=e?this.#i.value[e]:void 0;this.#i.next(za.invalidate(e,t))}mutate(e,t){const r=e in this.#i.value?this.#i.value[e]:void 0;if(!r)throw new Error(`Cannot mutate cache item with key ${e}: item not found`);const n="function"==typeof t?t(r?.value):t;return this.#i.next(za.mutate(e,n,r)),()=>this.#i.next(za.set(e,r))}trim(e){this.#i.next(za.trim(e))}reset(){this.#i.reset()}complete(){this.#i.complete()}}class Za extends To{key;args;options;#f=Date.now();get created(){return this.#f}#p=Os();get uuid(){return this.#p}constructor(e,t,r){super(),this.key=e,this.args=t,this.options=r}processJob(e,t){return e.pipe(vi(t=>{const{key:r,uuid:n,created:o}=this;return{key:r,uuid:n,created:o,status:"complete",transaction:e.transaction,complete:t.completed,value:t.value}}),Ui(()=>{t?.debug("QueryTask complete",{uuid:this.uuid,key:this.key,job:{status:e.status,transaction:e.transaction}}),e.complete()})).subscribe(this)}}class Xa{static extractQueryValue=gs;#u=new co;#a;#d;#h=new To;#m={};#g;#v;#E=Os();#l;get client(){return this.#a}get cache(){return this.#d}constructor(e){this.#l=e.logger??new Ma("Query",this.#E),this.#g=t=>Rs(e.key(t),this.#E),this.#v=e?.validate??((e=0)=>t=>(t.updated??0)+e>Date.now())(e?.expire),e.client instanceof Ga?this.#a=e.client:(this.#a=new Ga(e.client.fn,{logger:this.#l.createSubLogger("Client"),...e.client.options}),this.#u.add(()=>this.#a.complete())),e.cache instanceof Va?this.#d=e.cache:(this.#d=new Va(e.cache||{}),this.#u.add(()=>this.#d.complete()));const t=((e="switch")=>"function"==typeof e?e:(()=>{switch(e){case"concat":return ds;case"merge":return hs;case"switch":return ms;default:throw new Error(`Invalid queue operator: ${e}`)}})())(e.queueOperator);var r,n;this.#u.add(()=>this.#h.complete()),this.#u.add(this.#h.pipe(Mi(e=>this.#l.debug("Task added to queue",{key:e})),Li(e=>!!(e in this.#m)),t(e=>{const t=this.#m[e],{args:r,options:n,uuid:o}=t;if(this.#l.debug("Task selected from queue",{key:e,task:t.uuid,args:r,options:n}),!t?.observed)return this.#l.debug("Task skipped",{task:o}),delete this.#m[e],zo;const i=this.#a.query(r,{...n,ref:t.uuid});return new Oo(r=>{const{transaction:n}=i;var s,a;this.#l.info("Task stated",{task:o,transaction:n}),r.add(()=>{this.#l.debug("Task closed",{task:o,transaction:n,jobStatus:i.status}),i.complete("task closed"),delete this.#m[e]}),r.add((s=10,void 0===a&&(a=Ho),Si(s,s,a)).pipe(Li(()=>!t.observed)).subscribe(()=>{i.cancel(`task: ${t.uuid} is not observed`),r.complete()})),r.add(t.processJob(i,this.#l)),i.pipe(vi(e=>({result:e,task:t})),Ri(()=>zo)).subscribe(r)})}),(r=()=>!this.#a.closed,void 0===n&&(n=!1),So(function(e,t){var o=0;e.subscribe(Lo(t,function(e){var i=r(e,o++);(i||n)&&t.next(e),!i&&t.complete()}))}))).subscribe(e=>{const{value:t,transaction:r}=e.result,{args:n,key:o,uuid:i}=e.task;this.#l.debug("Task output added to cache",{uuid:i,args:n,key:o,transaction:r,value:t}),this.#d.setItem(o,{value:t,args:n,transaction:r})}))}query(e,t){return this._query(e,t)}queryAsync(e,t){const{skipResolve:r,...n}=t||{},o=r?di:pi;return new Promise((r,i)=>{t?.signal&&t.signal.addEventListener("abort",()=>i(new Error("Query aborted"))),o(this._query(e,n).pipe($i())).then(r,i)})}persistentQuery(e,t){const r=this.#g(e),n=this._query(e,t);return new Oo(o=>{o.add(n.subscribe({next:o.next.bind(o),error:o.error.bind(o)}));const i=t?.cache?.validate||this.#v;o.add(this.cache.state$.pipe(Li(e=>r in e),vi(t=>({...t[r],key:r,status:"cache",hasValidCache:i(t[r],e)}))).subscribe(o))}).pipe(Ai((e,t)=>e.transaction===t.transaction&&e.mutated===t.mutated))}generateCacheKey(e){return this.#g(e)}mutate(e,t,r){const n=this.#g(e);if(n in this.cache.state==!1){if(void 0===r?.allowCreation)throw new Error(`Cannot mutate cache item with key ${n}: item not found and option "allowCreation" is false`);if(!1===r.allowCreation)return()=>{};const{value:o}="function"==typeof t?t():t;this.cache.setItem(n,{args:e,transaction:Os(),value:o})}return this.#d.mutate(n,t)}invalidate(e){this.#d.invalidate(e&&this.#g(e))}complete(){this.#u.unsubscribe()}onInvalidate(e){const t=this.#d.action$.pipe(La("cache/invalidate")).subscribe(t=>e({detail:{item:t.meta.item}}));return()=>t.unsubscribe()}onMutate(e){const t=this.#d.action$.pipe(La("cache/mutate")).subscribe(t=>e({detail:{changes:t.payload,current:t.meta.item}}));return()=>t.unsubscribe()}_query(e,t){const r=this.#g(e),n=this._createTask(r,e,t);return this.#l.debug("New query created",{key:r,args:e,options:t}),n}_createTask(e,t,r){return new Oo(n=>{if(r?.signal){if(r?.signal.aborted)return this.#l.debug("Abort signal already triggered by caller",{key:e}),n.complete();n.add(Oi(r?.signal,"abort").subscribe(()=>{this.#l.debug("Abort signal triggered by caller",{key:e}),n.complete()}))}const o=this.#d.getItem(e);if(o){this.#l.debug("Query has cache",{key:e,cacheEntry:o});const i=r?.cache?.suppressInvalid??!1,s=(r?.cache?.validate||this.#v)(o,t),a={...o,key:e,status:"cache",hasValidCache:s};if(this.#l.info("Query cache valid, completing",{hasValidCache:s,suppressInvalid:i,record:a}),n.next(a),s||i)return n.complete();this.#l.debug("Query cache entry is invalid, proceeding to fetch new data",{key:e})}const i=e in this.#m;this.#m[e]??=new Za(e,t,r);const s=this.#m[e];n.add(s.subscribe(n)),this.#l.info(i?"Query connected to existing task":"Query started new task",{key:e}),i||this.#h.next(e)})}}const Ka=C.object({key:C.string().describe("The key used to identify the service"),uri:C.string().describe("The URI of the service"),id:C.string().optional().describe("The ID of the service"),environment:C.string().optional().describe("The environment of the service"),name:C.string().optional().describe("The name of the service"),scopes:C.array(C.string()).optional().default([]).describe("Endpoint authentication scopes"),tags:C.array(C.string()).optional().describe("Tags for the service")}).describe("A service from the service discovery API").transform(e=>({...e,get defaultScopes(){return e.scopes??[]}})),Wa=C.array(Ka).describe("A list of services from the service discovery API"),Ya=e=>ui(is(e)).pipe(vi(e=>Wa.default([]).parse(e)));class Ja{#y;endpoint;http;constructor({http:e,endpoint:t}){this.http=e,this.endpoint=t,this.#y=new Xa({client:{fn:()=>e.fetch$(t??"",{selector:Ya})},key:()=>"services",expire:3e5})}resolveServices(e){return(e?di:pi)(Xa.extractQueryValue(this.#y.query()))}async resolveService(e,t){const r=(await this.resolveServices(t)).find(t=>t.key===e);if(!r)throw Error(`Failed to resolve service, invalid key [${e}]`);return r}}class Qa extends zi{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(ui(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:r,endpoint:n}=await pi(ui(e(t)))??{};if(r)return new Ja({http:r,endpoint:n});throw Error("httpClient is required")})}configureServiceDiscoveryClientByClientKey(e,t){this.configureServiceDiscoveryClient(async({requireInstance:r})=>({httpClient:(await r("http")).createClient(e),endpoint:t}))}}class ec{config;_http;constructor(e,t){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 r=await this.resolveService(e);if(!r)throw Error(`Could not load configuration of service [${e}]`);return this._http.createClient({...t,baseUri:r.uri,defaultScopes:r.scopes})}async configureClient(e,t){const{key:r,alias:n}="string"==typeof e?{key:e,alias:e}:e,{uri:o,scopes:i}=await this.resolveService(r);var s,a;t.addConfig((s=n,a={baseUri:o,defaultScopes:i},{module:ps,configure:e=>{e.configureClient(s,a)}}))}}const tc={name:"serviceDiscovery",configure:()=>new Qa,initialize:async e=>{const{requireInstance:t,ref:r}=e,n=await e.config.createConfigAsync(e,{...r?.serviceDiscovery?.config}),o=await t("http");return new ec(n,o)}},rc=(e,t)=>{e.addConfig((e=>({module:tc,configure:t=>e(t)}))(()=>Promise.resolve()))};var nc,oc,ic,sc={},ac=[{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 cc(){return nc||(nc=1,function(e){const t=ac,r=process.env;function n(e){return"string"==typeof e?!!r[e]:"env"in e?r[e.env]&&r[e.env].includes(e.includes):"any"in e?e.any.some(function(e){return!!r[e]}):Object.keys(e).every(function(t){return r[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 o=(Array.isArray(t.env)?t.env:[t.env]).every(function(e){return n(e)});e[t.constant]=o,o&&(e.name=t.name,e.isPR=function(e){switch(typeof e.pr){case"string":return!!r[e.pr];case"object":return"env"in e.pr?"any"in e.pr?e.pr.any.some(function(t){return r[e.pr.env]===t}):e.pr.env in r&&r[e.pr.env]!==e.pr.ne:"any"in e.pr?e.pr.any.some(function(e){return!!r[e]}):n(e.pr);default:return null}}(t),e.id=t.constant)}),e.isCI=!("false"===r.CI||!(r.BUILD_ID||r.BUILD_NUMBER||r.CI||r.CI_APP_ID||r.CI_BUILD_ID||r.CI_BUILD_NUMBER||r.CI_NAME||r.CONTINUOUS_INTEGRATION||r.RUN_ID||e.name))}(sc)),sc}var uc=Pe(ic?oc:(ic=1,oc=cc().isCI));const lc=["5a842df8-3238-415d-b168-9f16a6a6031b/.default"];var fc;!function(e){e.ContinuesIntegration="ci",e.QualityAssurance="fqa",e.Training="tr",e.Production="fprd",e.Development="dev"}(fc||(fc={}));const pc=e=>e&&!uc?fc.Development:fc.ContinuesIntegration,dc=async e=>{const t=new Zi,r=e.env??fc.ContinuesIntegration;t.addConfig({module:ps,configure:t=>{const n=r===fc.Development?fc.ContinuesIntegration:r,o=e.serviceDiscovery?.url??new URL(`/service-registry/environments/${n}/services`,"https://discovery.fusion.equinor.com").toString(),i=e.serviceDiscovery?.scope??lc;t.configureClient("service_discovery",{baseUri:o,defaultScopes:i})}}),rc(t),P(t,t=>{const{auth:r}=e;if("token"in r&&r.token){const{token:e}=r;return t.setMode("token_only"),void t.setAccessToken(e)}const{clientId:n,tenantId:o,interactive:i}=r;if(!n||!o)throw new Error("clientId and tenantId are required for auth module");if(t.setClientConfig(o,n),t.setMode(i?"interactive":"silent"),i){const{server:e}=r;if(!e.port)throw new Error("server.port is required for interactive mode");t.setServerPort(e.port),t.setServerOnOpen(e.onOpen)}});return await t.initialize()},hc=async e=>{const{log:t}=e,{config:r}=await xt({log:t,config:e.config,env:{environment:e.environment}}),{manifest:n}=await Te({log:t,manifest:e.manifest,env:{environment:e.environment}}),o=n.build?.version;if(!o){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 i=await dc({env:e.environment,auth:e.auth});t?.succeed("Initialized Fusion Framework");const s=await i.serviceDiscovery.createClient("apps");s.request$.subscribe(e=>{t?.debug("Request:",e),t?.info("🌎","Executing request to:",Se(e.uri))}),t?.start("Publishing application config"),t?.info("Using environment:",ie.redBright(e.environment));try{const e=await s.json(`/apps/${n.appKey}/builds/${o}/config`,{method:"PUT",body:r});t?.debug("Response:",e),t?.succeed("Published application config")}catch(e){if(e instanceof kt)switch(e.response.status){case 410:t?.fail("🤬",`App ${n.appKey} is deleted from apps-service. Please check the app key and try again.`);break;case 404:t?.fail("🤬",`App ${n.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}},mc=async e=>{const{log:t}=e??{},r="@equinor/fusion-framework-dev-portal",n=await De(t),i={root:n.root,environment:"local",...e?.env,mode:"development",command:"serve"},s=await Re(i,n,{log:t,manifestPath:e?.manifest}),a=await $t(i,{log:t,config:e?.config});let c,l;const f=$(import.meta.resolve(r));se(f)?(c=f,l=await u({cwd:f}).then(e=>e?o(e?.path):void 0)):t?.info(`Portal ${r} is external, skipping entry point resolution`);const p=l?[n.root,l]:[n.root];t?.debug(`File system access allowed for: \n${p.join("\n")}\n`),t?.start("Starting app development server...");const d=await Rt(i,{template:{portal:{id:r}},...c?{portal:{manifest:{name:r,build:{templateEntry:c,assetPath:"/@fs"}},config:{}}}:{},app:{manifest:s,config:a}},{server:{port:e?.port||3e3,host:"localhost",fs:{allow:p}}});await d.listen(),t?.succeed("App development server started successfully");const h=d.config.server.https?"https":"http",m=d.config.server.host||"localhost",g=d.config.server.port||5173;return t?.info(`App development server is running at: ${h}://${m}:${g}/apps/${s.appKey}`),d},gc=async e=>{const{log:t}=e,r=await De(t),n=await Re({command:"build",mode:"production"},r,{log:t});t?.start("Initializing Fusion Framework...");const o=await dc({env:e.environment,auth:"token"in e.auth?{token:e.auth.token}:e.auth});t?.succeed("Initialized Fusion Framework");const i=await o.serviceDiscovery.createClient("apps");i.request$.subscribe(e=>{t?.info("🌎","Executing request to:",e.uri),t?.debug("Request:",e)});try{t?.start(`Checking if ${n.appKey} is registered in app store`);const e=await i.fetch(`/apps/${n.appKey}`,{method:"HEAD"});if(e.ok)return t?.succeed("😃",`Application ${n.appKey} is registered in app store`);if(404===e.status)return t?.fail("😞",`Application ${n.appKey} is not registered in app store`);throw new Error(`Unexpected response status: ${e.status}`)}catch(e){t?.fail("🙅‍♂️","Error checking application registration"),t?.error("Error checking application registration:",e)}},vc=e=>{const t=e.getEntry("metadata.json");if(!t)throw new Error("Metadata file not found in bundle");return new Promise((e,r)=>{t.getDataAsync((t,n)=>{if(n)return r(new Error("Failed to read metadata file",{cause:n}));try{return e(JSON.parse(String(t)))}catch(e){r(new Error("Failed to parse metadata file",{cause:e}))}})})};const Ec=async e=>{const{log:t,framework:r}=e,n="string"==typeof e.fileOrBundle?new It(e.fileOrBundle):e.fileOrBundle,{name:o}=e.appKey?{name:e.appKey}:await vc(n).catch(e=>{t?.error("Failed to resolve manifest:",e),process.exit(1)});t?.info("📦",`Uploading application bundle for ${ie.bold(o)}`),t?.debug("Bundle contents:",(await n.getEntries()).map(e=>e.entryName));const i=await n.toBufferPromise().catch(e=>{t?.error("Failed to read bundle content:",e),process.exit(1)});try{const e=await r.serviceDiscovery.createClient("apps");e.request$.subscribe(e=>{t?.info("🌎","Executing request to:",e.uri),t?.debug("Request:",e)});const n=await e.fetch(`/bundles/apps/${o}`,{method:"POST",body:new Blob([i],{type:"application/zip"}),headers:{"Content-Type":"application/zip"}});if(!n.ok){try{const{error:e}=await n.json();t?.debug("Error:",e),e.message&&t?.warn(ie.red(`🤯 error: ${e.code}\n`),ie.yellowBright(e.message),"\n")}catch(e){t?.debug("Error:",n.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}`)}}(n,o)}t?.succeed("Successfully uploaded application bundle"),t?.debug("Response:",n);try{return{name:o,version:(await n.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 yc;!function(e){e.Latest="latest",e.Preview="preview"}(yc||(yc={}));const bc=async e=>{const{tag:t,appKey:r,version:n,framework:o,log:i}=e;["latest","preview"].includes(t)||(i?.fail("🤪",'Invalid tag. Use "latest" or "preview".'),process.exit(1)),r||(i?.fail("🤪","Application key is required."),process.exit(1)),n||(i?.fail("🤪","Version is required."),process.exit(1));const s=await o.serviceDiscovery.createClient("apps");s.request$.subscribe(e=>{i?.debug("Request:",e),i?.info("🌎","Executing request to:",Se(e.uri))}),i?.start("Publishing application config");try{const e=await s.json(`/apps/${r}/tags/${t}`,{method:"PUT",body:{version:n}});return i?.debug("Response:",e),i?.succeed("Tagged application successfully",ie.greenBright(`${r}@${n} - ${t}`)),e}catch(e){if(e instanceof kt)switch(e.response.status){case 410:i?.fail("🤬",`App ${r} is deleted from apps-service. Please check the app key and try again.`);break;case 404:i?.fail("🤬",`App ${r} not found. Please check the app key and try again.`);break;case 403:case 401:i?.fail("🤬","You are not authorized to tag application. Please check your permissions.");break;default:i?.fail("🤬","Failed to tag application",`Status code: ${e.response.status}`,`Error: ${e.message}`)}throw e}},wc=O.object({templateEntry:O.string({required_error:"templateEntry is required in build section",invalid_type_error:"templateEntry must be a string"}).describe("Main entry point for the portal"),schemaEntry:O.string({required_error:"schemaEntry is required in build section",invalid_type_error:"schemaEntry must be a string"}).describe("Schema file for portal validation"),assetPath:O.string({invalid_type_error:"assetPath must be a string"}).optional().describe("Asset path for dev/preview builds"),githubRepo:O.string({invalid_type_error:"githubRepo must be a string"}).optional().describe("GitHub repo URL or local git remote"),version:O.string({required_error:"version is required in build section",invalid_type_error:"version must be a string"}).describe("Version from package.json"),timestamp:O.string({required_error:"timestamp is required in build section",invalid_type_error:"timestamp must be a string"}).describe("Current build timestamp (ISO8601)"),commitSha:O.string({required_error:"commitSha is required in build section",invalid_type_error:"commitSha must be a string"}).describe("Current git commit SHA"),annotations:O.record(O.string(),{invalid_type_error:"annotations must be a record of string values"}).optional().describe("Optional build annotations"),projectPage:O.string({invalid_type_error:"projectPage must be a string"}).optional().describe("Optional project homepage"),allowedExtensions:O.array(O.string({invalid_type_error:"Each allowed extension must be a string"}),{required_error:"allowedExtensions is required in build section",invalid_type_error:"allowedExtensions must be an array of strings"}).describe("List of allowed asset extensions (with leading dot)"),schema:O.record(O.unknown(),{invalid_type_error:"schema must be a record of unknown values"}).optional().describe("Optional schema for the portal"),config:O.record(O.unknown(),{invalid_type_error:"config must be a record of unknown values"}).optional().describe("Optional configuration for the portal")}),Ic=O.object({name:O.string({required_error:"name is required in portal manifest",invalid_type_error:"name must be a string"}).describe("Short app key (unscoped, derived from package name)"),displayName:O.string({invalid_type_error:"displayName must be a string"}).optional().describe("Full package name, may include scope"),description:O.string({invalid_type_error:"description must be a string"}).optional().describe("Description of the portal"),build:wc}),_c=(e,t)=>{fe(t,"expected packageJson"),I(t.name,"expected [name] in packageJson"),I(t.version,"expected [version] in packageJson");const r=((e,t)=>"build"===e.command||e.isPreview?t.main||t.module||"dist/bundle.js":ce(e.root))(e,t),n=t.name.replace(/^@|\w.*\//gm,""),o=t.version,i="build"===e.command?void 0:"/@fs",s=pe(t)??de(),a={name:n,displayName:t.name,description:t.description||"",build:{templateEntry:r,schemaEntry:"portal.schema.json",assetPath:i,githubRepo:s,version:o,timestamp:(new Date).toISOString(),commitSha:he(),annotations:{...me()},projectPage:t.homepage,allowedExtensions:ge.map(e=>`.${e}`)}},c=Ic.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},Cc=async(e,t,r)=>{const n=_c(e,t.packageJson);try{r?.log?.start("loading manifest...");const t=await(async(e,t)=>{const r=t?.file??[`portal.manifest.${e.environment}`,"portal.manifest"],n=await y(r,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async r=>{const n=t?.base??{};let o;return o="function"==typeof r.default?await r.default(e,{base:n})??void 0:r.default,o?w(n,o):n}}}),o=n.config,i=Ic.safeParse(o);if(!i.success)throw new Error(`Invalid portal manifest: ${i.error.errors.map(e=>`${e.path.join(".")}: ${e.message}`).join("; ")}`);return{manifest:o,path:n.path,extension:n.extension}})(e,{base:n});return r?.log?.succeed("generated manifest from",Se(t.path,{relative:!0})),t.manifest}catch(e){if(e instanceof b){if(r?.manifestPath){const t=new Error(`Failed to load manifest file ${Se(r.manifestPath)}, please check the path.`,{cause:e});throw r?.log?.fail(t.message),t}return r?.log?.succeed(ie.dim("no local manifest config applied, using default generated from package")),n}throw r?.log?.fail(`failed to resolve application manifest ${r?.manifestPath?Se(r?.manifestPath):""}`),e}},Oc=async(e,t)=>{const{log:r}=t;try{r?.start("create portal configuration"),r?.info(`generating config with ${ie.red.dim(e.command)} command in ${ie.green.dim(e.mode)} mode`);const n=await((e,t)=>{const r=t?.file??[`portal.config.${e.environment}`,"portal.config"];return y(r,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async r=>{const n=t?.schema??C.object({}).passthrough(),o=t?.base??{};if("function"==typeof r.default){const t=await r.default(o,e)??o;return n.parse(t)}return n.parse(r.default??o)}}})})(e,{file:t?.config});return r?.succeed("⚙️ generated config from ",Se(n.path,{relative:!0})),n.config}catch(e){if(e instanceof b){if(!t.config)return r?.succeed(ie.dim("⚙️ no local portal config applied, using built-in")),{};r?.warn(`failed to load config file ${Se(t.config)}, please check the path.`)}throw r?.fail("failed to resolve portal config"),r?.debug(e),e}},Nc=async e=>{const{log:t}=e??{},r=await De(t),n={root:r.root,environment:"local",...e?.env,mode:"development",command:"serve"},o=await Cc(n,r,{log:t,manifestPath:e?.manifest}),i=await Oc(n,{log:t,config:e?.config});t?.start("Starting app development server...");const s=await Rt(n,{template:{portal:{id:o.name}},portal:{manifest:o,config:i}},{server:{port:e?.server?.port,fs:{allow:[r.root]}}});return await s.listen(),t?.succeed(`Started app development server on ${s.resolvedUrls?.local?.[0]}`),s},Sc=async e=>{const{log:t}=e??{},r=await De(t);t?.debug("package",r);const n={command:"build",mode:process.env.NODE_ENV??"production",root:r.root,...e?.env};t?.debug("env:",n);const o=await Cc(n,r,{log:t,manifestPath:e?.manifest});return t?.debug("manifest:",o),{manifest:o,pkg:r,env:n}},Lc=async e=>{const{log:t}=e??{};t?.log(ie.bold("Starting to build portal"));const{manifest:n,pkg:o,env:i}=await Sc({log:t,manifest:e?.manifest});t?.start("loading vite config...");const s=await le(i,o);t?.succeed("vite config applied"),t?.debug("vite config:",s),t?.start("🤞🏻","building portal..."),t?.startNativeConsoleCapture(),await r(s),t?.stopNativeConsoleCapture(),t?.succeed("build completed 😘");return{pkg:o,manifest:n,outDir:s.build.outDir}},Rc=async e=>{const{log:t,manifest:r}=e,n={command:"build",mode:process.env.NODE_ENV??"production",environment:null,root:process.cwd()},{pkg:o,manifest:i}=await Lc({log:t,manifest:r});if(!i.build)throw new Error("Manifest build config not found");const s=await(async(e,t)=>{const r=t?.file??[`portal.schema.${e.environment}`,"portal.schema"],n=await y(r,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async t=>{const r="function"==typeof t.default?await Promise.resolve(t.default(e)):t.default;if(!r)throw new Error("Schema function did not return a valid schema");return r}}});return{schema:n.config,path:n.path,extension:n.extension}})(n,{file:e?.schema});t?.debug("Schema:",s);return{archive:await At(o,{log:t,archive:e?.archive,content:{"portal-template-manifest.json":JSON.stringify(i.build,null,2),"portal.schema.json":JSON.stringify(s.schema,null,2),"metadata.json":JSON.stringify({name:i.name,version:i.build.version})}}).catch(e=>{t?.error("Failed to create package:",e),process.exit(1)}),manifest:i,schema:s.schema}},Dc=async e=>{const{log:t}=e??{},r=await De(t),n={command:"build",mode:process.env.NODE_ENV??"production",root:r.root,...e?.env},o=await Oc(n,{log:t,config:e?.config});if(t?.debug("config:",o),e?.output){t?.start("writing config to file");try{await Dt(e.output,JSON.stringify(o,null,2)),t?.succeed("config written successfully",Se(e.output,{relative:!0}))}catch(e){throw t?.fail("failed to write config"),e}}return{config:o,pkg:r}},Tc=async e=>{const{log:t,portal:r}=e,{config:n}=await Dc({log:t,config:e.config,env:{environment:e.environment}});t?.start("Initializing Fusion Framework...");const o=await dc({env:e.environment,auth:e.auth});t?.succeed("Initialized Fusion Framework");const i=await o.serviceDiscovery.createClient("portals");i.request$.subscribe(e=>{t?.debug("Request:",e),t?.info("🌎","Executing request to:",Se(e.uri))}),t?.start("Publishing portal config"),t?.info("Using environment:",ie.redBright(e.environment));try{const e=await i.json(`/portals/${r.name}@${r.version}/config`,{method:"PUT",body:n});t?.debug("Response:",e),t?.succeed("Published portal config")}catch(e){if(e instanceof kt)switch(e.response.status){case 410:t?.fail("🤬",`Portal ${r.name} is deleted from portals-service. Please check the portal key and try again.`);break;case 404:t?.fail("🤬",`Portal ${r.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 Ac=async e=>{const{log:t,framework:r}=e,n="string"==typeof e.fileOrBundle?new It(e.fileOrBundle):e.fileOrBundle,{name:o}=e.name?{name:e.name}:await vc(n).catch(e=>{t?.error("Failed to resolve manifest:",e),process.exit(1)}),i=await n.toBufferPromise().catch(e=>{t?.error("Failed to read bundle content:",e),process.exit(1)});try{const e=await r.serviceDiscovery.createClient("portal-config");e.request$.subscribe(e=>{t?.info("🌎","Executing request to:",e.uri),t?.debug("Request:",e)});const n=await e.fetch(`/bundles/templates/${o}`,{method:"POST",body:new Blob([i],{type:"application/zip"}),headers:{"Content-Type":"application/zip"}});if(!n.ok){try{const{error:e}=await n.json();t?.debug("Error:",e),e.message&&t?.warn(ie.red(`🤯 error: ${e.code}\n`),ie.yellowBright(e.message),"\n")}catch(e){t?.debug("Error:",n.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}`)}}(n,o)}t?.succeed("Successfully uploaded portal bundle"),t?.debug("Response:",n)}catch(e){t?.fail("🙅‍♂️","Failed to upload portal bundle"),t?.error(e),process.exit(1)}};var Pc;!function(e){e.Latest="latest",e.Preview="preview"}(Pc||(Pc={}));const $c=async e=>{const{tag:t,name:r,version:n,framework:o,log:i}=e;["latest","preview"].includes(t)||(i?.fail("🤪",'Invalid tag. Use "latest" or "preview".'),process.exit(1)),r||(i?.fail("🤪","Portal name is required."),process.exit(1)),n||(i?.fail("🤪","Version is required."),process.exit(1)),i?.info("Tagging portal:",ie.greenBright(`${r}@${t}`,n));const s=await o.serviceDiscovery.createClient("portal-config");s.request$.subscribe(e=>{i?.debug("Request:",e),i?.info("🌎","Executing request to:",Se(e.uri))}),i?.start("Tagging portal template...");try{const e=await s.json(`/templates/${r}/tags/${t}`,{method:"PUT",body:{version:n}});i?.debug("Response:",e),i?.succeed("Tagged portal template successfully"),i?.info("🚀",JSON.stringify(e))}catch(e){if(e instanceof kt){const{data:t,response:n}=e;switch(i?.debug("Error:",t),t&&i?.warn(ie.red(`🤯 error: ${t.code}\n`),ie.yellowBright(t.message),"\n"),n?.status){case 410:i?.fail(`🤬 - ${n?.status} -`,`${r} is deleted. Please check the name and try again.`);break;case 404:i?.fail(`🤬 - ${n?.status} -`,`${r} not found. Please check the name and try again.`);break;case 403:case 401:i?.fail(`🤬 - ${n?.status} -`,"You are not authorized to tag. Please check your permissions.");break;default:i?.fail(`🤬 - ${n?.status} -`,"Failed to tag",`Error: ${e.message}`)}}throw e}};export{yc as AllowedAppTags,Pc as AllowedPortalTags,St as ConsoleLogger,fc as FusionEnv,Ae as buildApplication,Lc as buildPortal,Pt as bundleApp,Rc as bundlePortal,gc as checkApp,xt as generateApplicationConfig,Dc as generatePortalConfig,dc as initializeFramework,Te as loadAppManifest,Sc as loadPortalManifest,At as pack,hc as publishAppConfig,Tc as publishPortalConfig,pc as resolveDefaultEnv,mc as startAppDevServer,Nc as startPortalDevServer,bc as tagApplication,$c as tagPortal,Ec as uploadApplication,Ac as uploadPortalBundle};
1
+ import{loadConfigFromFile as e,mergeConfig as t,build as r}from"vite";import n from"vite-tsconfig-paths";import{dirname as o,resolve as i,basename as s,extname as a,relative as c}from"node:path";import{readPackageUp as u}from"read-package-up";import{accessSync as l,constants as f,readFileSync as p,statSync as d,existsSync as h,mkdirSync as m,writeFileSync as g}from"node:fs";import{stat as v,mkdir as E}from"node:fs/promises";import{importConfig as y,FileNotFoundError as b}from"@equinor/fusion-imports";import w from"deepmerge";import I from"node:assert";import{execSync as _}from"node:child_process";import C,{z as O}from"zod";import N from"fs";import S from"path";import L from"zlib";import R from"crypto";import D from"ora";import{createDevServer as T,processServices as A}from"@equinor/fusion-framework-dev-server";import{enableAuthModule as P}from"@equinor/fusion-framework-module-msal-node";import{fileURLToPath as $}from"node:url";const x=(e=0)=>t=>`[${t+e}m`,U=(e=0)=>t=>`[${38+e};5;${t}m`,k=(e=0)=>(t,r,n)=>`[${38+e};2;${t};${r};${n}m`,F={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(F.modifier);Object.keys(F.color),Object.keys(F.bgColor);const B=function(){const e=new Map;for(const[t,r]of Object.entries(F)){for(const[t,n]of Object.entries(r))F[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},r[t]=F[t],e.set(n[0],n[1]);Object.defineProperty(F,t,{value:r,enumerable:!1})}return Object.defineProperty(F,"codes",{value:e,enumerable:!1}),F.color.close="",F.bgColor.close="",F.color.ansi=x(),F.color.ansi256=U(),F.color.ansi16m=k(),F.bgColor.ansi=x(10),F.bgColor.ansi256=U(10),F.bgColor.ansi16m=k(10),Object.defineProperties(F,{rgbToAnsi256:{value:(e,t,r)=>e===t&&t===r?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(r/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[r]=t;3===r.length&&(r=[...r].map(e=>e+e).join(""));const n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},enumerable:!1},hexToAnsi256:{value:e=>F.rgbToAnsi256(...F.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,r,n;if(e>=232)t=(10*(e-232)+8)/255,r=t,n=t;else{const o=(e-=16)%36;t=Math.floor(e/36)/5,r=Math.floor(o/6)/5,n=o%6/5}const o=2*Math.max(t,r,n);if(0===o)return 30;let i=30+(Math.round(n)<<2|Math.round(r)<<1|Math.round(t));return 2===o&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,t,r)=>F.ansi256ToAnsi(F.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>F.ansi256ToAnsi(F.hexToAnsi256(e)),enumerable:!1}}),F}(),j=(()=>{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})(),M=0!==j&&{level:j},H={stdout:M,stderr:M};function G(e,t,r){let n=e.indexOf(t);if(-1===n)return e;const o=t.length;let i=0,s="";do{s+=e.slice(i,n)+t+r,i=n+o,n=e.indexOf(t,i)}while(-1!==n);return s+=e.slice(i),s}const{stdout:z,stderr:q}=H,V=Symbol("GENERATOR"),Z=Symbol("STYLER"),X=Symbol("IS_EMPTY"),K=["ansi","ansi","ansi256","ansi16m"],W=Object.create(null),Y=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 r=z?z.level:0;e.level=void 0===t.level?r:t.level})(t,e),Object.setPrototypeOf(t,J.prototype),t};function J(e){return Y(e)}Object.setPrototypeOf(J.prototype,Function.prototype);for(const[e,t]of Object.entries(B))W[e]={get(){const r=ne(this,re(t.open,t.close,this[Z]),this[X]);return Object.defineProperty(this,e,{value:r}),r}};W.visible={get(){const e=ne(this,this[Z],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const Q=(e,t,r,...n)=>"rgb"===e?"ansi16m"===t?B[r].ansi16m(...n):"ansi256"===t?B[r].ansi256(B.rgbToAnsi256(...n)):B[r].ansi(B.rgbToAnsi(...n)):"hex"===e?Q("rgb",t,r,...B.hexToRgb(...n)):B[r][e](...n),ee=["rgb","hex","ansi256"];for(const e of ee){W[e]={get(){const{level:t}=this;return function(...r){const n=re(Q(e,K[t],"color",...r),B.color.close,this[Z]);return ne(this,n,this[X])}}};W["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...r){const n=re(Q(e,K[t],"bgColor",...r),B.bgColor.close,this[Z]);return ne(this,n,this[X])}}}}const te=Object.defineProperties(()=>{},{...W,level:{enumerable:!0,get(){return this[V].level},set(e){this[V].level=e}}}),re=(e,t,r)=>{let n,o;return void 0===r?(n=e,o=t):(n=r.openAll+e,o=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:o,parent:r}},ne=(e,t,r)=>{const n=(...e)=>oe(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,te),n[V]=e,n[Z]=t,n[X]=r,n},oe=(e,t)=>{if(e.level<=0||!t)return e[X]?"":t;let r=e[Z];if(void 0===r)return t;const{openAll:n,closeAll:o}=r;if(t.includes(""))for(;void 0!==r;)t=G(t,r.close,r.open),r=r.parent;const i=t.indexOf("\n");return-1!==i&&(t=function(e,t,r,n){let o=0,i="";do{const s="\r"===e[n-1];i+=e.slice(o,s?n-1:n)+t+(s?"\r\n":"\n")+r,o=n+1,n=e.indexOf("\n",o)}while(-1!==n);return i+=e.slice(o),i}(t,o,n,i)),n+t+o};Object.defineProperties(J.prototype,W);const ie=J();J({level:q?q.level:0});const se=(e,t)=>{try{return l(e,f.F_OK),!0}catch(e){return!1}},ae=["index.ts","index.tsx","main.ts","main.tsx"],ce=(e,t,r)=>{const n=i(e??process.cwd(),"src"),o=ae,s=o.map(e=>i(n,e)).find(e=>se(e));if(!s)throw new Error(`Unable to resolve entry point, ensure ${o.join(", ")} exists in ${n}`);return s},ue=(e,t)=>w(e,t,{arrayMerge:(e,t)=>{const r=t[0]??e[0];return"object"==typeof r&&"match"in r&&"middleware"in r?((e,t,r)=>{const n=r.reduce((t,r)=>Object.assign(t,{[String(r[e])]:r}),{}),o={...t.reduce((t,r)=>Object.assign(t,{[String(r[e])]:r}),{}),...n};return Object.values(o)})("match",e,t):[...new Set([...e,...t])]}}),le=async(r,i)=>{const{packageJson:c,root:u}=i,{config:l}=await e(r)??{},f=c.main??c.module??"./dist/bundle.js",p=ce(u);if("build"===r.command){if(o(f)===u)throw new Error("outDir cannot be root, please specify package.main or package.module in package.json");if("src"===o(f))throw new Error("outDir cannot be src, please specify package.main or package.module in package.json");if(o(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:u,plugins:[n()],define:{"process.env.NODE_ENV":JSON.stringify(r.mode),"process.env.NODE_DEBUG":"production"!==r.mode,"process.env.FUSION_LOG_LEVEL":"production"===r.mode?1:3},build:{outDir:o(f),lib:{entry:p,fileName:s(f,a(f)),formats:["es"]},emptyOutDir:!0}},l??{})};function fe(e,t){I("object"==typeof e,t)}const pe=e=>{if(e.repository)return"string"==typeof e.repository?e.repository:e.repository.url},de=()=>{try{return _("git remote get-url origin").toString().trim().replace("git@github.com:","https://github.com/").replace(/\.git$/,"")}catch(e){return}},he=(e="HEAD")=>{try{return _(`git rev-parse ${e}`).toString().trim()}catch(e){return}},me=()=>{if(process.env.GITHUB_ACTIONS){const e=(()=>{const e=process.env.GITHUB_EVENT_NAME||"unknown",t=process.env.GITHUB_ACTOR||"unknown",r=process.env.GITHUB_RUN_ID||"unknown",n=process.env.GITHUB_REPOSITORY||"unknown",o=process.env.GITHUB_WORKFLOW||"unknown",i=process.env.GITHUB_SERVER_URL||"https://github.com";let s="unknown";"unknown"!==n&&"unknown"!==r&&(s=`${i.replace(/\/$/,"")}/${n}/actions/runs/${r}`);const a={eventName:e,actor:t,runId:r,runUrl:s,workflow:o};if(process.env.GITHUB_EVENT_PATH)try{const e=p(process.env.GITHUB_EVENT_PATH,"utf8");Object.assign(a,JSON.parse(e))}catch{console.error("Failed to parse GitHub event payload")}return a})(),t={source:"github",reason:e.eventName,workflow:e.workflow,runId:e.runId,runUrl:e.runUrl,commitId:e.head_commit?.id,repository:e.repository?.name,repository_homepage:e.repository?.homepage,repository_license:e.repository?.license?.name,repository_owner:e.repository?.owner?.login,repository_owner_avatar_url:e.repository?.owner?.avatar_url,actor:e.actor,sender_login:e.sender?.login,sender_avatar_url:e.sender?.avatar_url};return e.pull_request?{...t,branch:e.pull_request.head?.ref,commitId:e.pull_request.head?.sha,htmlUrl:e.pull_request.html_url}:e.release?{...t,tag:e.release.tag_name,htmlUrl:e.release.html_url}:t}if(process.env.SYSTEM_TEAMPROJECT){const e=(()=>{const e=process.env.BUILD_BUILDID||"unknown",t=process.env.BUILD_DEFINITIONNAME||"unknown",r=process.env.BUILD_REPOSITORY_NAME||"unknown",n=process.env.SYSTEM_TEAMPROJECT||"unknown",o=process.env.SYSTEM_COLLECTIONURI||"unknown",i=process.env.BUILD_REQUESTEDFOR||"unknown",s=process.env.BUILD_SOURCEBRANCH||"unknown",a=process.env.BUILD_SOURCEVERSION||"unknown",c=process.env.BUILD_REASON||"unknown";let u="unknown";return"unknown"!==o&&"unknown"!==n&&"unknown"!==e&&(u=`${o.replace(/\/$/,"")}${n}/_build/results?buildId=${e}`),{runId:e,pipelineName:t,repository:r,project:n,orgUrl:o,actor:i,branch:s,commitId:a,runUrl:u,reason:c}})();return{source:"azure_devops",reason:e.reason,repository:e.repository,runId:e.runId,runUrl:e.runUrl,actor:e.actor,branch:e.branch,commitId:e.commitId,workflow:e.pipelineName}}},ge=["png","jpg","jpeg","gif","svg","ico","webp","mp4","webm","mp3","woff2","woff","eot","ttf","otf","pdf","md","txt"],ve=(e,t)=>{fe(t,"expected packageJson"),I(t.name,"expected [name] in packageJson"),I(t.version,"expected [version] in packageJson");const r=((e,t)=>"build"===e.command||e.isPreview?t.main||t.module||"dist/app-bundle.js":ce(e.root))(e,t),n=t.name.replace(/^@|\w.*\//gm,""),o=t.version,i="build"===e.command?void 0:`/bundles/apps/${n}@${o}`,s=pe(t)??de();return{appKey:n,displayName:t.name,description:t.description||"",keywords:t.keywords,type:"standalone",build:{entryPoint:r,assetPath:i,githubRepo:s,version:o,timestamp:(new Date).toISOString(),commitSha:he(),annotations:me(),projectPage:t.homepage,allowedExtensions:ge.map(e=>`.${e}`)}}},Ee=(e,t)=>w(e,t),ye=O.object({environment:O.record(O.any()).describe("Key-value map of environment-specific variables for the application. Defaults to an empty object if not provided.").optional().default({}),endpoints:O.record(O.object({url:O.string().describe("The endpoint URL. This field is required."),scopes:O.array(O.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."),be=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],we=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],Ie=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],_e=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],Ce=(e,t,r)=>{let n=e;return"string"==typeof t||Array.isArray(t)?n=e.toLocaleString(t,r):!0!==t&&void 0===r||(n=e.toLocaleString(void 0,r)),n},Oe=e=>{if("number"==typeof e)return Math.log10(e);const t=e.toString(10);return t.length+Math.log10("0."+t.slice(0,15))};function Ne(e,t){if("bigint"!=typeof e&&!Number.isFinite(e))throw new TypeError(`Expected a finite number, got ${typeof e}: ${e}`);const r=(t={bits:!1,binary:!1,space:!0,...t}).bits?t.binary?_e:Ie:t.binary?we:be,n=t.space?" ":"";if(t.signed&&("number"==typeof e?0===e:0n===e))return` 0${n}${r[0]}`;const o=e<0,i=o?"-":t.signed?"+":"";let s;if(o&&(e=-e),void 0!==t.minimumFractionDigits&&(s={minimumFractionDigits:t.minimumFractionDigits}),void 0!==t.maximumFractionDigits&&(s={maximumFractionDigits:t.maximumFractionDigits,...s}),e<1){return i+Ce(e,t.locale,s)+n+r[0]}const a=Math.min(Math.floor(t.binary?("number"==typeof(c=e)?Math.log(c):Oe(c)*Math.log(10))/Math.log(1024):Oe(e)/3),r.length-1);var c;if(e=((e,t)=>{if("number"==typeof e)return e/t;const r=e/BigInt(t),n=e%BigInt(t);return Number(r)+Number(n)/t})(e,(t.binary?1024:1e3)**a),!s){const t=Math.max(3,Number.parseInt(e,10).toString().length);e=e.toPrecision(t)}return i+Ce(Number(e),t.locale,s)+n+r[a]}const Se=(e,t)=>ie.blueBright(t?.relative?`./${c(t?.cwd??process.cwd(),e)}`:e),Le=e=>"string"==typeof e?Le(d(e).size):ie.yellowBright(Ne(e)),Re=async(e,t,r)=>{const n=ve(e,t.packageJson);try{r?.log?.start("loading application package...");const{manifest:t,path:o}=await(async(e,t)=>{const r=t?.file??[`app.manifest.${e.environment}`,"app.manifest","app.manifest.config"],n=await y(r,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async r=>{const n=t?.base??{};if("function"==typeof r.default){const t=await r.default(e,{base:n});return Ee(n,t??{})}return Ee(n,r.default??{})}}});return{manifest:n.config,path:n.path,extension:n.extension}})(e,{base:n,file:r?.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}`),r?.log?.succeed("generated manifest from",Se(o,{relative:!0})),t}catch(e){if(e instanceof b){if(r?.manifestPath){const t=new Error(`Failed to load manifest file ${Se(r.manifestPath)}, please check the path.`,{cause:e});throw r?.log?.fail(t.message),t}return r?.log?.succeed(ie.dim("no local manifest config applied, using default generated from package")),n}throw r?.log?.fail(`failed to resolve application manifest ${r?.manifestPath?Se(r?.manifestPath):""}`),e}};async function De(e){e?.start("resolve project package");try{const t=await(async e=>{const t=await u(e);if(!t)throw Error("failed to find package.json");return{...t,root:o(t.path)}})();return e?.succeed("📦",ie.yellowBright([t.packageJson.name,t.packageJson.version].join("@"))),e?.info("🏠",ie.blueBright(t.root)),t}catch(t){throw e?.fail("☠️","failed to resolve project package"),t}}const Te=async e=>{const{log:t}=e??{},r=await De(t);t?.debug("package",r);const n={command:"build",mode:process.env.NODE_ENV??"production",root:r.root,...e?.env};t?.debug("env:",n);const o=await Re(n,r,{log:t,manifestPath:e?.manifest});return t?.debug("manifest:",o),{manifest:o,pkg:r,env:n}},Ae=async e=>{const{log:t}=e??{};t?.log(ie.bold("Starting to build application"));const{manifest:n,pkg:o,env:i}=await Te({log:t,manifest:e?.manifest});t?.start("loading vite config...");const s=await le(i,o);t?.succeed("vite config applied"),t?.debug("vite config:",s),t?.start("🤞🏻","building application..."),t?.startNativeConsoleCapture(),await r(s),t?.stopNativeConsoleCapture(),t?.succeed("build completed 😘");return{pkg:o,manifest:n,outDir:s.build.outDir}};function Pe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $e,xe,Ue={exports:{}};function ke(){return xe?$e:(xe=1,$e={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 Fe,Be,je,Me,He,Ge,ze,qe,Ve={};function Ze(){return Fe||(Fe=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 r(e){return function(...t){return t.length&&(e=e.replace(/\{(\d)\}/g,(e,r)=>t[r]||"")),new Error("ADM-ZIP: "+e)}}for(const n of Object.keys(t))e[n]=r(t[n])}(Ve)),Ve}function Xe(){return qe||(qe=1,Ue.exports=function(){if(je)return Be;je=1;const e=N,t=S,r=ke(),n=Ze(),o="object"==typeof process&&"win32"===process.platform,i=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(r){this.sep=t.sep,this.fs=e,i(r)&&i(r.fs)&&"function"==typeof r.fs.statSync&&(this.fs=r.fs)}return Be=a,a.prototype.makeDir=function(e){const t=this;!function(e){let r=e.split(t.sep)[0];e.split(t.sep).forEach(function(e){if(e&&":"!==e.substr(-1,1)){var o;r+=t.sep+e;try{o=t.fs.statSync(r)}catch(e){t.fs.mkdirSync(r)}if(o&&o.isFile())throw n.FILE_IN_THE_WAY(`"${r}"`)}})}(e)},a.prototype.writeFileTo=function(e,r,n,o){const i=this;if(i.fs.existsSync(e)){if(!n)return!1;if(i.fs.statSync(e).isDirectory())return!1}var s,a=t.dirname(e);i.fs.existsSync(a)||i.makeDir(a);try{s=i.fs.openSync(e,"w",438)}catch(t){i.fs.chmodSync(e,438),s=i.fs.openSync(e,"w",438)}if(s)try{i.fs.writeSync(s,r,0,r.length,0)}finally{i.fs.closeSync(s)}return i.fs.chmodSync(e,o||438),!0},a.prototype.writeFileToAsync=function(e,r,n,o,i){"function"==typeof o&&(i=o,o=void 0);const s=this;s.fs.exists(e,function(a){if(a&&!n)return i(!1);s.fs.stat(e,function(n,c){if(a&&c.isDirectory())return i(!1);var u=t.dirname(e);s.fs.exists(u,function(t){t||s.makeDir(u),s.fs.open(e,"w",438,function(t,n){t?s.fs.chmod(e,438,function(){s.fs.open(e,"w",438,function(t,n){s.fs.write(n,r,0,r.length,0,function(){s.fs.close(n,function(){s.fs.chmod(e,o||438,function(){i(!0)})})})})}):n?s.fs.write(n,r,0,r.length,0,function(){s.fs.close(n,function(){s.fs.chmod(e,o||438,function(){i(!0)})})}):s.fs.chmod(e,o||438,function(){i(!0)})})})})})},a.prototype.findFiles=function(e){const r=this;return function e(n,o,i){let s=[];return r.fs.readdirSync(n).forEach(function(a){const c=t.join(n,a),u=r.fs.statSync(c);s.push(t.normalize(c)+(u.isDirectory()?r.sep:"")),u.isDirectory()&&i&&(s=s.concat(e(c,o,i)))}),s}(e,void 0,!0)},a.prototype.findFilesAsync=function(e,r){const n=this;let o=[];n.fs.readdir(e,function(i,s){if(i)return r(i);let a=s.length;if(!a)return r(null,o);s.forEach(function(i){i=t.join(e,i),n.fs.stat(i,function(e,s){if(e)return r(e);s&&(o.push(t.normalize(i)+(s.isDirectory()?n.sep:"")),s.isDirectory()?n.findFilesAsync(i,function(e,t){if(e)return r(e);o=o.concat(t),--a||r(null,o)}):--a||r(null,o))})})})},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,r=-1;for(let n=0;n<t;)r=a.crc32update(r,e[n++]);return~r>>>0},a.methodToString=function(e){switch(e){case r.STORED:return"STORED ("+e+")";case r.DEFLATED:return"DEFLATED ("+e+")";default:return"UNSUPPORTED ("+e+")"}},a.canonical=function(e){if(!e)return"";const r=t.posix.normalize("/"+e.split("\\").join("/"));return t.join(".",r)},a.zipnamefix=function(e){if(!e)return"";const r=t.posix.normalize("/"+e.split("\\").join("/"));return t.posix.join(".",r)},a.findLast=function(e,t){if(!Array.isArray(e))throw new TypeError("arr is not array");for(let r=(e.length>>>0)-1;r>=0;r--)if(t(e[r],r,e))return e[r]},a.sanitize=function(e,r){e=t.resolve(t.normalize(e));for(var n=r.split("/"),o=0,i=n.length;o<i;o++){var s=t.normalize(t.join(e,n.slice(o,i).join(t.sep)));if(0===s.indexOf(e))return s}return t.normalize(t.join(e,t.basename(r)))},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 r=Buffer.from(e.slice(t,t+8));return r.swap64(),parseInt(`0x${r.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,r=0;return e.getFullYear()>1979&&(t=(e.getFullYear()-1980&127)<<9|e.getMonth()+1<<5|e.getDate(),r=e.getHours()<<11|e.getMinutes()<<5|e.getSeconds()>>1),t<<16|r},a.isWin=o,a.crcTable=s,Be}(),Ue.exports.Constants=ke(),Ue.exports.Errors=Ze(),Ue.exports.FileAttr=function(){if(He)return Me;He=1;const e=S;return Me=function(t,{fs:r}){var n=t||"",o={directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0},i=null;return n&&r.existsSync(n)?(i=r.statSync(n),o.directory=i.isDirectory(),o.mtime=i.mtime,o.atime=i.atime,o.executable=!!(73&i.mode),o.readonly=!(128&i.mode),o.hidden="."===e.basename(n)[0]):console.warn("Invalid path: "+n),{get directory(){return o.directory},get readOnly(){return o.readonly},get hidden(){return o.hidden},get mtime(){return o.mtime},get atime(){return o.atime},get executable(){return o.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:n,isDirectory:o.directory,isReadOnly:o.readonly,isHidden:o.hidden,isExecutable:o.executable,mTime:o.mtime,aTime:o.atime}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}(),Ue.exports.decoder=ze?Ge:(ze=1,Ge={efs:!0,encode:e=>Buffer.from(e,"utf8"),decode:e=>e.toString("utf8")})),Ue.exports}var Ke,We,Ye,Je,Qe,et={};function tt(){if(We)return Ke;We=1;var e=Xe(),t=e.Constants;return Ke=function(){var r=20,n=10,o=0,i=0,s=0,a=0,c=0,u=0,l=0,f=0,p=0,d=0,h=0,m=0,g=0;r|=e.isWin?2560:768,o|=t.FLG_EFS;const v={extraLen:0},E=e=>Math.max(0,e)>>>0;return s=e.fromDate2DOS(new Date),{get made(){return r},set made(e){r=e},get version(){return n},set version(e){n=e},get flags(){return o},set flags(e){o=e},get flags_efs(){return(o&t.FLG_EFS)>0},set flags_efs(e){e?o|=t.FLG_EFS:o&=~t.FLG_EFS},get flags_desc(){return(o&t.FLG_DESC)>0},set flags_desc(e){e?o|=t.FLG_DESC:o&=~t.FLG_DESC},get method(){return i},set method(e){switch(e){case t.STORED:this.version=10;case t.DEFLATED:default:this.version=20}i=e},get time(){return e.fromDOS2Date(this.timeval)},set time(t){this.timeval=e.fromDate2DOS(t)},get timeval(){return s},set timeval(e){s=E(e)},get timeHighByte(){return e=s>>>8,255&Math.max(0,e);var e},get crc(){return a},set crc(e){a=E(e)},get compressedSize(){return c},set compressedSize(e){c=E(e)},get size(){return u},set size(e){u=E(e)},get fileNameLength(){return l},set fileNameLength(e){l=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=E(e)},get inAttr(){return h},set inAttr(e){h=E(e)},get attr(){return m},set attr(e){m=E(e)},get fileAttr(){return(m||0)>>16&4095},get offset(){return g},set offset(e){g=E(e)},get encrypted(){return(o&t.FLG_ENC)===t.FLG_ENC},get centralHeaderSize(){return t.CENHDR+l+f+p},get realDataOffset(){return g+t.LOCHDR+v.fnameLen+v.extraLen},get localHeader(){return v},loadLocalHeaderFromBinary:function(r){var n=r.slice(g,g+t.LOCHDR);if(n.readUInt32LE(0)!==t.LOCSIG)throw e.Errors.INVALID_LOC();v.version=n.readUInt16LE(t.LOCVER),v.flags=n.readUInt16LE(t.LOCFLG),v.method=n.readUInt16LE(t.LOCHOW),v.time=n.readUInt32LE(t.LOCTIM),v.crc=n.readUInt32LE(t.LOCCRC),v.compressedSize=n.readUInt32LE(t.LOCSIZ),v.size=n.readUInt32LE(t.LOCLEN),v.fnameLen=n.readUInt16LE(t.LOCNAM),v.extraLen=n.readUInt16LE(t.LOCEXT);const o=g+t.LOCHDR+v.fnameLen,i=o+v.extraLen;return r.slice(o,i)},loadFromBinary:function(v){if(v.length!==t.CENHDR||v.readUInt32LE(0)!==t.CENSIG)throw e.Errors.INVALID_CEN();r=v.readUInt16LE(t.CENVEM),n=v.readUInt16LE(t.CENVER),o=v.readUInt16LE(t.CENFLG),i=v.readUInt16LE(t.CENHOW),s=v.readUInt32LE(t.CENTIM),a=v.readUInt32LE(t.CENCRC),c=v.readUInt32LE(t.CENSIZ),u=v.readUInt32LE(t.CENLEN),l=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(n,t.LOCVER),e.writeUInt16LE(o,t.LOCFLG),e.writeUInt16LE(i,t.LOCHOW),e.writeUInt32LE(s,t.LOCTIM),e.writeUInt32LE(a,t.LOCCRC),e.writeUInt32LE(c,t.LOCSIZ),e.writeUInt32LE(u,t.LOCLEN),e.writeUInt16LE(l,t.LOCNAM),e.writeUInt16LE(v.extraLen,t.LOCEXT),e},centralHeaderToBinary:function(){var e=Buffer.alloc(t.CENHDR+l+f+p);return e.writeUInt32LE(t.CENSIG,0),e.writeUInt16LE(r,t.CENVEM),e.writeUInt16LE(n,t.CENVER),e.writeUInt16LE(o,t.CENFLG),e.writeUInt16LE(i,t.CENHOW),e.writeUInt32LE(s,t.CENTIM),e.writeUInt32LE(a,t.CENCRC),e.writeUInt32LE(c,t.CENSIZ),e.writeUInt32LE(u,t.CENLEN),e.writeUInt16LE(l,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:r,version:n,flags:o,method:e.methodToString(i),time:this.time,crc:"0x"+a.toString(16).toUpperCase(),compressedSize:s(c),size:s(u),fileNameLength:s(l),extraLength:s(f),commentLength:s(p),diskNumStart:d,inAttr:h,attr:m,offset:g,centralHeaderSize:s(t.CENHDR+l+f+p)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}}}function rt(){return Qe||(Qe=1,et.EntryHeader=tt(),et.MainHeader=function(){if(Je)return Ye;Je=1;var e=Xe(),t=e.Constants;return Ye=function(){var r=0,n=0,o=0,i=0,s=0;return{get diskEntries(){return r},set diskEntries(e){r=n=e},get totalEntries(){return n},set totalEntries(e){n=r=e},get size(){return o},set size(e){o=e},get offset(){return i},set offset(e){i=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?(r=a.readUInt16LE(t.ENDSUB),n=a.readUInt16LE(t.ENDTOT),o=a.readUInt32LE(t.ENDSIZ),i=a.readUInt32LE(t.ENDOFF),s=a.readUInt16LE(t.ENDCOM)):(r=e.readBigUInt64LE(a,t.ZIP64SUB),n=e.readBigUInt64LE(a,t.ZIP64TOT),o=e.readBigUInt64LE(a,t.ZIP64SIZE),i=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(r,t.ENDSUB),e.writeUInt16LE(n,t.ENDTOT),e.writeUInt32LE(o,t.ENDSIZ),e.writeUInt32LE(i,t.ENDOFF),e.writeUInt16LE(s,t.ENDCOM),e.fill(" ",t.ENDHDR),e},toJSON:function(){return{diskEntries:r,totalEntries:n,size:o+" bytes",offset:function(e,t){let r=e.toString(16).toUpperCase();for(;r.length<t;)r="0"+r;return"0x"+r}(i,4),commentLength:s}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}},Ye}()),et}var nt,ot,it,st,at,ct,ut,lt,ft,pt,dt,ht,mt,gt={};function vt(){if(ct)return at;ct=1;const{randomFillSync:e}=R,t=Ze(),r=new Uint32Array(256).map((e,t)=>{for(let e=0;e<8;e++)1&t?t=t>>>1^3988292384:t>>>=1;return t>>>0}),n=(e,t)=>Math.imul(e,t)>>>0,o=(e,t)=>r[255&(e^t)]^e>>>8,i=()=>"function"==typeof e?e(Buffer.alloc(12)):i.node();i.node=()=>{const e=Buffer.alloc(12),t=e.length;for(let r=0;r<t;r++)e[r]=256*Math.random()&255;return e};const s={genSalt:i};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]=o(t[0],e),t[1]+=255&t[0],t[1]=n(t[1],134775813)+1,t[2]=o(t[2],t[1]>>>24),e},a.prototype.next=function(){const e=(2|this.keys[2])>>>0;return n(e,1^e)>>8&255},at={decrypt:function(e,r,n){if(!e||!Buffer.isBuffer(e)||e.length<12)return Buffer.alloc(0);const o=function(e){const t=new a(e);return function(e){const r=Buffer.alloc(e.length);let n=0;for(let o of e)r[n++]=t.updateKeys(o^t.next());return r}}(n),i=o(e.slice(0,12)),s=8&~r.flags?r.crc>>>24:r.timeHighByte;if(i[11]!==s)throw t.WRONG_PASSWORD();return o(e.slice(12))},encrypt:function(e,t,r,n=!1){null==e&&(e=Buffer.alloc(0)),Buffer.isBuffer(e)||(e=Buffer.from(e.toString()));const o=function(e){const t=new a(e);return function(e,r,n=0){r||(r=Buffer.alloc(e.length));for(let o of e){const e=t.next();r[n++]=o^e,t.updateKeys(o)}return r}}(r),i=s.genSalt();i[11]=t.crc>>>24&255,n&&(i[10]=t.crc>>>16&255);const c=Buffer.alloc(e.length+12);return o(i,c),o(e,c,12)},_salter:function(e){Buffer.isBuffer(e)&&e.length>=12?s.genSalt=function(){return e.slice(0,12)}:s.genSalt="node"===e?i.node:i}},at}function Et(){return ut||(ut=1,gt.Deflater=(ot||(ot=1,nt=function(e){var t=L,r={chunkSize:1024*(parseInt(e.length/1024)+1)};return{deflate:function(){return t.deflateRawSync(e,r)},deflateAsync:function(n){var o=t.createDeflateRaw(r),i=[],s=0;o.on("data",function(e){i.push(e),s+=e.length}),o.on("end",function(){var e=Buffer.alloc(s),t=0;e.fill(0);for(var r=0;r<i.length;r++){var o=i[r];o.copy(e,t),t+=o.length}n&&n(e)}),o.end(e)}}}),nt),gt.Inflater=function(){if(st)return it;st=1;const e=+(process.versions?process.versions.node:"").split(".")[0]||0;return it=function(t,r){var n=L;const o=e>=15&&r>0?{maxOutputLength:r}:{};return{inflate:function(){return n.inflateRawSync(t,o)},inflateAsync:function(e){var r=n.createInflateRaw(o),i=[],s=0;r.on("data",function(e){i.push(e),s+=e.length}),r.on("end",function(){var t=Buffer.alloc(s),r=0;t.fill(0);for(var n=0;n<i.length;n++){var o=i[n];o.copy(t,r),r+=o.length}e&&e(t)}),r.end(t)}}},it}(),gt.ZipCrypto=vt()),gt}function yt(){if(ft)return lt;ft=1;var e=Xe(),t=rt(),r=e.Constants,n=Et();return lt=function(o,i){var s=new t.EntryHeader,a=Buffer.alloc(0),c=Buffer.alloc(0),u=!1,l=null,f=Buffer.alloc(0),p=Buffer.alloc(0),d=!0;const h=o,m="object"==typeof h.decoder?h.decoder:e.decoder;function g(){return i&&i instanceof Uint8Array?(p=s.loadLocalHeaderFromBinary(i),i.slice(s.realDataOffset,s.realDataOffset+s.compressedSize)):Buffer.alloc(0)}function v(t){if(s.flags_desc){const n={},o=s.realDataOffset+s.compressedSize;if(i.readUInt32LE(o)==r.LOCSIG||i.readUInt32LE(o)==r.CENSIG)throw e.Errors.DESCRIPTOR_NOT_EXIST();if(i.readUInt32LE(o)==r.EXTSIG)n.crc=i.readUInt32LE(o+r.EXTCRC),n.compressedSize=i.readUInt32LE(o+r.EXTSIZ),n.size=i.readUInt32LE(o+r.EXTLEN);else{if(19280!==i.readUInt16LE(o+12))throw e.Errors.DESCRIPTOR_UNKNOWN();n.crc=i.readUInt32LE(o+r.EXTCRC-4),n.compressedSize=i.readUInt32LE(o+r.EXTSIZ-4),n.size=i.readUInt32LE(o+r.EXTLEN-4)}if(n.compressedSize!==s.compressedSize||n.size!==s.size||n.crc!==s.crc)throw e.Errors.DESCRIPTOR_FAULTY();if(e.crc32(t)!==n.crc)return!1}else if(e.crc32(t)!==s.localHeader.crc)return!1;return!0}function E(t,r,o){if(void 0===r&&"string"==typeof t&&(o=t,t=void 0),u)return t&&r&&r(Buffer.alloc(0),e.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var i=g();if(0===i.length)return t&&r&&r(i),i;if(s.encrypted){if("string"!=typeof o&&!Buffer.isBuffer(o))throw e.Errors.INVALID_PASS_PARAM();i=n.ZipCrypto.decrypt(i,s,o)}var c=Buffer.alloc(s.size);switch(s.method){case e.Constants.STORED:if(i.copy(c),v(c))return t&&r&&r(c),c;throw t&&r&&r(c,e.Errors.BAD_CRC()),e.Errors.BAD_CRC();case e.Constants.DEFLATED:var l=new n.Inflater(i,s.size);if(!t){if(l.inflate(c).copy(c,0),!v(c))throw e.Errors.BAD_CRC(`"${m.decode(a)}"`);return c}l.inflateAsync(function(t){t.copy(t,0),r&&(v(t)?r(t):r(t,e.Errors.BAD_CRC()))});break;default:throw t&&r&&r(Buffer.alloc(0),e.Errors.UNKNOWN_METHOD()),e.Errors.UNKNOWN_METHOD()}}function y(t,r){if((!l||!l.length)&&Buffer.isBuffer(i))return t&&r&&r(g()),g();if(l.length&&!u){var o;switch(s.method){case e.Constants.STORED:return s.compressedSize=s.size,o=Buffer.alloc(l.length),l.copy(o),t&&r&&r(o),o;default:case e.Constants.DEFLATED:var a=new n.Deflater(l);if(!t){var c=a.deflate();return s.compressedSize=c.length,c}a.deflateAsync(function(e){o=Buffer.alloc(e.length),s.compressedSize=e.length,e.copy(o),r&&r(o)}),a=null}}else{if(!t||!r)return Buffer.alloc(0);r(Buffer.alloc(0))}}function b(e,t){return(e.readUInt32LE(t+4)<<4)+e.readUInt32LE(t)}function w(e){var t,n,o,i;e.length>=r.EF_ZIP64_SCOMP&&(t=b(e,r.EF_ZIP64_SUNCOMP),s.size===r.EF_ZIP64_OR_32&&(s.size=t)),e.length>=r.EF_ZIP64_RHO&&(n=b(e,r.EF_ZIP64_SCOMP),s.compressedSize===r.EF_ZIP64_OR_32&&(s.compressedSize=n)),e.length>=r.EF_ZIP64_DSN&&(o=b(e,r.EF_ZIP64_RHO),s.offset===r.EF_ZIP64_OR_32&&(s.offset=o)),e.length>=r.EF_ZIP64_DSN+4&&(i=e.readUInt32LE(r.EF_ZIP64_DSN),s.diskNumStart===r.EF_ZIP64_OR_16&&(s.diskNumStart=i))}return d=!!m.hasOwnProperty("efs")&&m.efs,{get entryName(){return m.decode(a)},get rawEntryName(){return a},set entryName(t){var r=(a=e.toBuffer(t,m.encode))[a.length-1];u=47===r||92===r,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 n,o,i,s=0;s+4<t.length;)n=t.readUInt16LE(s),s+=2,o=t.readUInt16LE(s),s+=2,i=t.slice(s,s+o),s+=o,r.ID_ZIP64===n&&w(i)}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 u?e.substr(e.length-1).split("/").pop():e.split("/").pop()},get isDirectory(){return u},getCompressedData:function(){return y(!1,null)},getCompressedDataAsync:function(e){y(!0,e)},setData:function(t){l=e.toBuffer(t,e.decoder.encode),!u&&l.length?(s.size=l.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?l:E(!1,null,e)},getDataAsync:function(e,t){s.changed?e(l):E(!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(),r=e.Constants.CENHDR;return a.copy(t,r),r+=a.length,f.copy(t,r),r+=s.extraLength,c.copy(t,r),t},packLocalHeader:function(){let e=0;s.flags_efs=this.efs,s.extraLocalLength=p.length;const t=s.localHeaderToBinary(),r=Buffer.alloc(t.length+a.length+s.extraLocalLength);return t.copy(r,e),e+=t.length,a.copy(r,e),e+=a.length,p.copy(r,e),e+=p.length,r},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(i),data:e(l)}},toString:function(){return JSON.stringify(this.toJSON(),null,"\t")}}},lt}function bt(){if(dt)return pt;dt=1;const e=yt(),t=rt(),r=Xe();return pt=function(n,o){var i=[],s={},a=Buffer.alloc(0),c=new t.MainHeader,u=!1;const l=new Set,f=o,{noSort:p,decoder:d}=f;function h(){if(u=!0,s={},c.diskEntries>(n.length-c.offset)/r.Constants.CENHDR)throw r.Errors.DISK_ENTRY_TOO_LARGE();i=new Array(c.diskEntries);for(var t=c.offset,o=0;o<i.length;o++){var a=t,p=new e(f,n);p.header=n.slice(a,a+=r.Constants.CENHDR),p.entryName=n.slice(a,a+=p.header.fileNameLength),p.header.extraLength&&(p.extra=n.slice(a,a+=p.header.extraLength)),p.header.commentLength&&(p.comment=n.slice(a,a+p.header.commentLength)),t+=p.header.centralHeaderSize,i[o]=p,s[p.entryName]=p}l.clear(),function(){const t=new Set;for(const e of Object.keys(s)){const r=e.split("/");if(r.pop(),r.length)for(let e=0;e<r.length;e++){const n=r.slice(0,e+1).join("/")+"/";t.add(n)}}for(const r of t)if(!(r in s)){const t=new e(f);t.entryName=r,t.attr=16,t.temporary=!0,i.push(t),s[t.entryName]=t,l.add(t)}}()}function m(){i.length>1&&!p&&i.sort((e,t)=>e.entryName.toLowerCase().localeCompare(t.entryName.toLowerCase()))}return n?function(e){var t=n.length-r.Constants.ENDHDR,o=Math.max(0,t-65535),i=o,s=n.length,u=-1,l=0;"boolean"==typeof f.trailingSpace&&f.trailingSpace&&(o=0);for(;t>=i;t--)if(80===n[t])if(n.readUInt32LE(t)!==r.Constants.ENDSIG)if(n.readUInt32LE(t)!==r.Constants.END64SIG){if(n.readUInt32LE(t)===r.Constants.ZIP64SIG){u=t,s=t+r.readBigUInt64LE(n,t+r.Constants.ZIP64SIZE)+r.Constants.ZIP64LEAD;break}}else i=o;else u=t,l=t,s=t+r.Constants.ENDHDR,i=t-r.Constants.END64HDR;if(-1==u)throw r.Errors.INVALID_FORMAT();c.loadFromBinary(n.slice(u,s)),c.commentLength&&(a=n.slice(l+r.Constants.ENDHDR));e&&h()}(f.readEntries):u=!0,{get entries(){return u||h(),i.filter(e=>!l.has(e))},get comment(){return d.decode(a)},set comment(e){a=r.toBuffer(e,d.encode),c.commentLength=a.length},getEntryCount:function(){return u?i.length:c.diskEntries},forEach:function(e){this.entries.forEach(e)},getEntry:function(e){return u||h(),s[e]||null},setEntry:function(e){u||h(),i.push(e),s[e.entryName]=e,c.totalEntries=i.length},deleteFile:function(e,t=!0){u||h();const r=s[e];this.getEntryChildren(r,t).map(e=>e.entryName).forEach(this.deleteEntry)},deleteEntry:function(e){u||h();const t=s[e],r=i.indexOf(t);r>=0&&(i.splice(r,1),delete s[e],c.totalEntries=i.length)},getEntryChildren:function(e,t=!0){if(u||h(),"object"==typeof e){if(e.isDirectory&&t){const t=[],r=e.entryName;for(const e of i)e.entryName.startsWith(r)&&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(){u||h(),m();const e=[],t=[];let o=0,i=0;c.size=0,c.offset=0;let s=0;for(const r of this.entries){const n=r.getCompressedData();r.header.offset=i;const a=r.packLocalHeader(),u=a.length+n.length;i+=u,e.push(a),e.push(n);const l=r.packCentralHeader();t.push(l),c.size+=l.length,o+=u+l.length,s++}o+=c.mainHeaderSize,c.offset=i,c.totalEntries=s,i=0;const l=Buffer.alloc(o);for(const t of e)t.copy(l,i),i+=t.length;for(const e of t)e.copy(l,i),i+=e.length;const f=c.toBinary();return a&&a.copy(f,r.Constants.ENDHDR),f.copy(l,i),n=l,u=!1,l},toAsyncBuffer:function(e,t,o,i){try{u||h(),m();const t=[],s=[];let l=0,f=0,p=0;c.size=0,c.offset=0;const d=function(h){if(h.length>0){const e=h.shift(),r=e.entryName+e.extra.toString();o&&o(r),e.getCompressedDataAsync(function(n){i&&i(r),e.header.offset=f;const o=e.packLocalHeader(),a=o.length+n.length;f+=a,t.push(o),t.push(n);const u=e.packCentralHeader();s.push(u),c.size+=u.length,l+=a+u.length,p++,d(h)})}else{l+=c.mainHeaderSize,c.offset=f,c.totalEntries=p,f=0;const o=Buffer.alloc(l);t.forEach(function(e){e.copy(o,f),f+=e.length}),s.forEach(function(e){e.copy(o,f),f+=e.length});const i=c.toBinary();a&&a.copy(i,r.Constants.ENDHDR),i.copy(o,f),n=o,u=!1,e(o)}};d(Array.from(this.entries))}catch(e){t(e)}}}},pt}var wt=function(){if(mt)return ht;mt=1;const e=Xe(),t=S,r=yt(),n=bt(),o=(...t)=>e.findLast(t,e=>"boolean"==typeof e),i=(...t)=>e.findLast(t,e=>"string"==typeof e),s={noSort:!1,readEntries:!1,method:e.Constants.NONE,fs:null};return ht=function(a,c){let u=null;const l=Object.assign(Object.create(null),s);a&&"object"==typeof a&&(a instanceof Uint8Array||(Object.assign(l,a),a=l.input?l.input:void 0,l.input&&delete l.input),Buffer.isBuffer(a)&&(u=a,l.method=e.Constants.BUFFER,a=void 0)),Object.assign(l,c);const f=new e(l);if("object"==typeof l.decoder&&"function"==typeof l.decoder.encode&&"function"==typeof l.decoder.decode||(l.decoder=e.decoder),a&&"string"==typeof a){if(!f.fs.existsSync(a))throw e.Errors.INVALID_FILENAME();l.method=e.Constants.FILE,l.filename=a,u=f.fs.readFileSync(a)}const p=new n(u,l),{canonical:d,sanitize:h,zipnamefix:m}=e;function g(e){var r;if(e&&p&&("string"==typeof e&&(r=p.getEntry(t.posix.normalize(e))),"object"==typeof e&&void 0!==e.entryName&&void 0!==e.header&&(r=p.getEntry(e.entryName)),r))return r;return null}function v(e){const{join:r,normalize:n,sep:o}=t.posix;return r(".",n(o+e.split("\\").join(o)+o))}function E(e){return e instanceof RegExp?(t=e,function(e){return t.test(e)}):"function"!=typeof e?()=>!0:e;var t}const y=(e,r)=>{let n=r.slice(-1);return n=n===f.sep?f.sep:"",t.relative(e,r)+n};return{readFile:function(e,t){var r=g(e);return r&&r.getData(t)||null},childCount:function(e){const t=g(e);if(t)return p.getChildCount(t)},readFileAsync:function(e,t){var r=g(e);r?r.getDataAsync(t):t(null,"getEntry failed for:"+e)},readAsText:function(e,t){var r=g(e);if(r){var n=r.getData();if(n&&n.length)return n.toString(t||"utf8")}return""},readAsTextAsync:function(e,t,r){var n=g(e);n?n.getDataAsync(function(e,n){n?t(e,n):e&&e.length?t(e.toString(r||"utf8")):t("")}):t("")},deleteFile:function(e,t=!0){var r=g(e);r&&p.deleteFile(r.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 r=g(e);r&&(r.comment=t)},getZipEntryComment:function(e){var t=g(e);return t&&t.comment||""},updateFile:function(e,t){var r=g(e);r&&r.setData(t)},addLocalFile:function(r,n,o,i){if(!f.fs.existsSync(r))throw e.Errors.FILE_NOT_FOUND(r);{n=n?v(n):"";const e=t.win32.basename(t.win32.normalize(r));n+=o||e;const s=f.fs.statSync(r),a=s.isFile()?f.fs.readFileSync(r):Buffer.alloc(0);s.isDirectory()&&(n+=f.sep),this.addFile(n,a,i,s)}},addLocalFileAsync:function(e,r){e="object"==typeof e?e:{localPath:e};const n=t.resolve(e.localPath),{comment:o}=e;let{zipPath:i,zipName:s}=e;const a=this;f.fs.stat(n,function(e,c){if(e)return r(e,!1);i=i?v(i):"";const u=t.win32.basename(t.win32.normalize(n));if(i+=s||u,c.isFile())f.fs.readFile(n,function(e,t){return e?r(e,!1):(a.addFile(i,t,o,c),setImmediate(r,void 0,!0))});else if(c.isDirectory())return i+=f.sep,a.addFile(i,Buffer.alloc(0),o,c),setImmediate(r,void 0,!0)})},addLocalFolder:function(r,n,o){if(o=E(o),n=n?v(n):"",r=t.normalize(r),!f.fs.existsSync(r))throw e.Errors.FILE_NOT_FOUND(r);{const e=f.findFiles(r),i=this;if(e.length)for(const s of e){const e=t.join(n,y(r,s));o(e)&&i.addLocalFile(s,t.dirname(e))}}},addLocalFolderAsync:function(r,n,o,i){i=E(i),o=o?v(o):"",r=t.normalize(r);var s=this;f.fs.open(r,"r",function(t){if(t&&"ENOENT"===t.code)n(void 0,e.Errors.FILE_NOT_FOUND(r));else if(t)n(void 0,t);else{var a=f.findFiles(r),c=-1,u=function(){if((c+=1)<a.length){var e=a[c],t=y(r,e).split("\\").join("/");t=t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),i(t)?f.fs.stat(e,function(r,i){r&&n(void 0,r),i.isFile()?f.fs.readFile(e,function(e,r){e?n(void 0,e):(s.addFile(o+t,r,"",i),u())}):(s.addFile(o+t+"/",Buffer.alloc(0),"",i),u())}):process.nextTick(()=>{u()})}else n(!0,void 0)};u()}})},addLocalFolderAsync2:function(r,n){const o=this;r="object"==typeof r?r:{localPath:r},localPath=t.resolve(v(r.localPath));let{zipPath:i,filter:s,namefix:a}=r;var c;s instanceof RegExp?(c=s,s=function(e){return c.test(e)}):"function"!=typeof s&&(s=function(){return!0}),i=i?v(i):"","latin1"==a&&(a=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),"function"!=typeof a&&(a=e=>e);const u=e=>t.join(i,a(y(localPath,e))),l=e=>t.win32.basename(t.win32.normalize(a(e)));f.fs.open(localPath,"r",function(r){r&&"ENOENT"===r.code?n(void 0,e.Errors.FILE_NOT_FOUND(localPath)):r?n(void 0,r):f.findFilesAsync(localPath,function(e,r){if(e)return n(e);(r=r.filter(e=>s(u(e)))).length||n(void 0,!1),setImmediate(r.reverse().reduce(function(e,r){return function(n,i){if(n||!1===i)return setImmediate(e,n,!1);o.addLocalFileAsync({localPath:r,zipPath:t.dirname(u(r)),zipName:l(r)},e)}},n))})})},addLocalFolderPromise:function(e,t){return new Promise((r,n)=>{this.addLocalFolderAsync2(Object.assign({localPath:e},t),(e,t)=>{e&&n(e),t&&r(this)})})},addFile:function(e,t,n,o){let i=g(e=m(e));const s=null!=i;s||(i=new r(l),i.entryName=e),i.comment=n||"";const a="object"==typeof o&&o instanceof f.fs.Stats;a&&(i.header.time=o.mtime);var c=i.isDirectory?16:0;let u=i.isDirectory?16384:32768;return u|=a?4095&o.mode:"number"==typeof o?4095&o:i.isDirectory?493:420,c=(c|u<<16)>>>0,i.attr=c,i.setData(t),s||p.setEntry(i),i},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(r,n,s,a,c,u){a=o(!1,a),c=o(!1,c),s=o(!0,s),u=i(c,u);var l=g(r);if(!l)throw e.Errors.NO_ENTRY();var m=d(l.entryName),v=h(n,u&&!l.isDirectory?u:s?m:t.basename(m));if(l.isDirectory)return p.getEntryChildren(l).forEach(function(r){if(r.isDirectory)return;var o=r.getData();if(!o)throw e.Errors.CANT_EXTRACT_FILE();var i=d(r.entryName),u=h(n,s?i:t.basename(i));const l=c?r.header.fileAttr:void 0;f.writeFileTo(u,o,a,l)}),!0;var E=l.getData(p.password);if(!E)throw e.Errors.CANT_EXTRACT_FILE();if(f.fs.existsSync(v)&&!a)throw e.Errors.CANT_OVERRIDE();const y=c?r.header.fileAttr:void 0;return f.writeFileTo(v,E,a,y),!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,r,n,s){if(n=o(!1,n),s=i(n,s),r=o(!1,r),!p)throw e.Errors.NO_ZIP();p.entries.forEach(function(o){var i=h(t,d(o.entryName));if(o.isDirectory)return void f.makeDir(i);var a=o.getData(s);if(!a)throw e.Errors.CANT_EXTRACT_FILE();const c=n?o.header.fileAttr:void 0;f.writeFileTo(i,a,r,c);try{f.fs.utimesSync(i,o.header.time,o.header.time)}catch(t){throw e.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(r,n,i,s){if(s=((...t)=>e.findLast(t,e=>"function"==typeof e))(n,i,s),i=o(!1,i),n=o(!1,n),!s)return new Promise((e,t)=>{this.extractAllToAsync(r,n,i,function(r){r?t(r):e(this)})});if(!p)return void s(e.Errors.NO_ZIP());r=t.resolve(r);const a=e=>h(r,t.normalize(d(e.entryName))),c=(e,t)=>new Error(e+': "'+t+'"'),u=[],l=[];p.entries.forEach(e=>{e.isDirectory?u.push(e):l.push(e)});for(const e of u){const t=a(e),r=i?e.header.fileAttr:void 0;try{f.makeDir(t),r&&f.fs.chmodSync(t,r),f.fs.utimesSync(t,e.header.time,e.header.time)}catch(e){s(c("Unable to create folder",t))}}l.reverse().reduce(function(o,s){return function(a){if(a)o(a);else{const a=t.normalize(d(s.entryName)),u=h(r,a);s.getDataAsync(function(t,r){if(r)o(r);else if(t){const e=i?s.header.fileAttr:void 0;f.writeFileToAsync(u,t,n,e,function(e){e||o(c("Unable to write file",u)),f.fs.utimes(u,s.header.time,s.header.time,function(e){e?o(c("Unable to set times",u)):o()})})}else o(e.Errors.CANT_EXTRACT_FILE())})}}},s)()},writeZip:function(e,t){if(1===arguments.length&&"function"==typeof e&&(t=e,e=""),!e&&l.filename&&(e=l.filename),e){var r=p.compressToBuffer();if(r){var n=f.writeFileTo(e,r,!0);"function"==typeof t&&t(n?null:new Error("failed"),"")}}},writeZipPromise:function(e,t){const{overwrite:r,perm:n}=Object.assign({overwrite:!0},t);return new Promise((t,o)=>{!e&&l.filename&&(e=l.filename),e||o("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(i=>{f.writeFileToAsync(e,i,r,n,e=>e?t(e):o("ADM-ZIP: Wasn't able to write zip file"))},o)})},toBufferPromise:function(){return new Promise((e,t)=>{p.toAsyncBuffer(e,t)})},toBuffer:function(e,t,r,n){return"function"==typeof e?(p.toAsyncBuffer(e,t,r,n),null):p.compressToBuffer()}}},ht}(),It=Pe(wt);class _t{#e;get ora(){return this.#e}set attachConsole(e){e?(console.log=this.info.bind(this),console.info=this.info.bind(this)):console=Nt}static Global(e){return Ct=new _t(e),Ct}static Clone(e){const{prefixText:t}=e||Ct;return new _t({prefixText:t})}static get Current(){return Ct}static set Current(e){Ct=e}constructor(e){this.#e=D(e)}get prefixText(){return this.#e.prefixText}info(...e){this.#e.info(Ot(e))}succeed(...e){this.#e.succeed(Ot(e))}start(...e){this.#e.start(Ot(e))}fail(...e){this.#e.fail(Ot(e))}warn(...e){this.#e.warn(Ot(e))}clear(){this.#e.clear()}stop(){this.#e.stop()}stopAndPersist(...e){this.#e.stopAndPersist(...e)}}let Ct=new _t;const Ot=e=>e.length?e.join(" "):void 0,Nt=console;let St=class{spinner;debugMode;constructor(e,t){this.spinner=new _t({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 Lt=e=>{const t={spa:{templateEnv:(r=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"]}]},...r})},api:{serviceDiscoveryUrl:"https://discovery.fusion.equinor.com/service-registry/environments/ci/services/",processServices:(e,t)=>{const{data:r,routes:n}=A(e,t);return{data:r.concat({key:"portals",name:"Portal Service - MOCK",uri:"/@fusion-api/portals"}),routes:n}}}};var r;return e.app&&((e,t,r)=>{const{build:n,appKey:o}=t;if(!n)throw new Error("App manifest does not contain build information");e.api.routes??=[],e.api.routes.push({match:[`/apps/bundles/apps/${o}/${n.version}/*path`,`/apps/bundles/apps/${o}@${n.version}/*path`],middleware:async(e,t,r)=>{const n=e.params?.path;!1===Array.isArray(n)&&r(),t.writeHead(302,{"content-type":"application/javascript",location:`/${n.join("/")}`}),t.end()}}),e.api.routes.push({match:`/apps/persons/me/apps/${o}`,middleware:async(e,r)=>{r.writeHead(200,{"content-type":"application/json"}),r.end(JSON.stringify({id:"dev-server-generated-id",...t}))}}),e.api.routes.push({match:`/apps/apps/${o}/builds/${n.version}/config`,middleware:async(e,t)=>{t.writeHead(200,{"content-type":"application/json"}),t.end(JSON.stringify(r))}})})(t,e.app.manifest,e.app.config),e.portal&&((e,t,r)=>{e.api.routes??=[];const n="portal-config";e.api.routes.push({match:`/${n}/portals/${t.name}{@:tag}`,middleware:async(e,r)=>{r.writeHead(200,{"content-type":"application/json"}),r.end(JSON.stringify(t))}}),r&&e.api.routes.push({match:`/${n}/portals/${t.name}{@:tag}/config`,middleware:async(e,t)=>{t.writeHead(200,{"content-type":"application/json"}),t.end(JSON.stringify(r))}})})(t,e.portal.manifest,e.portal.config),t},Rt=async(e,t,r)=>{const n=Lt(t),o=await(async(e,t,r)=>y("dev-server.config",{baseDir:e.root,extensions:r?.extensions,script:{resolve:async r=>{let n;if("function"==typeof r.default){const o={...t};n=await r.default(e,{base:o})}else n=r.default;return ue(t,n??{})}}}))(e,n).catch(()=>({config:n}));return T(o.config,r)},Dt=(e,t,r)=>{const n=o(String(e));h(n)||m(n,{recursive:!0}),g(e,t,r)},Tt=["package.json","LICENSE.md","README.md","CHANGELOG.md"],At=async(e,t)=>{const{archive:r,log:n}=t??{},s=o(e.path),a=t?.buildDir??"dist",c=i(s,a);if(!(await v(c)).isDirectory())throw new Error(`Build directory ${a} does not exist`);n?.log(ie.bold("Starting to pack bundle"));const u=new It;if(u.addLocalFolder(c,a),t?.content)for(const[e,r]of Object.entries(t.content))u.addFile(e,Buffer.from(r)),n?.info("📄",Se(e,{relative:!0}));n?.info("📂",Se(c,{relative:!0}));for(const t of Tt.concat(e.packageJson.files??[])){const e=i(s,t),r=o(e.replace(s,""));se(e)?(u.addLocalFile(e,r),n?.info("📄",Se(e,{relative:!0}))):n?.warn(ie.dim("📄",Se(e,{relative:!0})))}return r&&(se(o(r))||await E(o(r),{recursive:!0}),n?.start("compressing content"),await u.writeZipPromise(r),n?.succeed("📚",Se(r,{relative:!0}),Le(r))),u},Pt=async e=>{const{log:t,manifest:r}=e;process.env.NODE_ENV,process.cwd();const{pkg:n,manifest:o}=await Ae({log:t,manifest:r});if(!o.build)throw new Error("Manifest build config not found");return{archive:await At(n,{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}},$t=async(e,t)=>{const{log:r}=t;try{r?.start("create application configuration"),r?.info(`generating config with ${ie.red.dim(e.command)} command in ${ie.green.dim(e.mode)} mode`);const n=await((e,t)=>{const r=t?.file??[`app.config.${e.environment}`,"app.config"];return y(r,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async r=>{const n=t?.base??{environment:{}};if("function"==typeof r.default){const t=await r.default(e,{base:n})??n;return ye.parse(t??n)}return ye.parse(r.default??n)}}})})(e,{file:t?.config});return r?.succeed("⚙️ generated config from ",Se(n.path,{relative:!0})),n.config}catch(e){if(e instanceof b){if(!t.config)return r?.succeed(ie.dim("⚙️ no local application config applied, using built-in")),{environment:{}};r?.warn(`failed to load config file ${Se(t.config)}, please check the path.`)}throw r?.fail("failed to resolve application config"),r?.debug(e),e}},xt=async e=>{const{log:t}=e??{},r=await De(t),n={command:"build",mode:process.env.NODE_ENV??"production",root:r.root,...e?.env},o=await $t(n,{log:t,config:e?.config});if(t?.debug("config:",o),e?.output){t?.start("writing config to file");try{await Dt(e.output,JSON.stringify(o,null,2)),t?.succeed("config written successfully",Se(e.output,{relative:!0}))}catch(e){throw t?.fail("failed to write config"),e}}return{config:o,pkg:r}};class Ut extends Error{response;static Name="HttpResponseError";constructor(e,t,r){super(e,r),this.response=t}}class kt extends Ut{static Name="HttpJsonResponseError";data;constructor(e,t,r){super(e,t,r),this.name=kt.Name,this.data=r?.data}}class Ft extends Ut{static Name="ServerSentEventResponseError";constructor(e,t,r){super(e,t,r),this.name=Ft.Name}}var Bt,jt,Mt,Ht,Gt,zt,qt,Vt,Zt,Xt,Kt,Wt,Yt,Jt,Qt,er,tr,rr,nr,or,ir,sr,ar,cr,ur,lr,fr,pr,dr,hr,mr,gr,vr,Er,yr,br,wr,Ir,_r,Cr,Or,Nr,Sr,Lr,Rr,Dr,Tr,Ar,Pr,$r,xr,Ur,kr,Fr,Br,jr,Mr,Hr,Gr,zr,qr,Vr,Zr,Xr,Kr,Wr,Yr,Jr,Qr,en,tn,rn,nn,on,sn,an,cn,un,ln,fn,pn,dn,hn,mn,gn,vn,En,yn,bn,wn={exports:{}};function In(){if(jt)return Bt;jt=1;const e=Number.MAX_SAFE_INTEGER||9007199254740991;return Bt={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}}function _n(){if(Ht)return Mt;Ht=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 Mt=e}function Cn(){return Gt||(Gt=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:o}=In(),i=_n(),s=(t=e.exports={}).re=[],a=t.safeRe=[],c=t.src=[],u=t.safeSrc=[],l=t.t={};let f=0;const p="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",o],[p,n]],h=(e,t,r)=>{const n=(e=>{for(const[t,r]of d)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),o=f++;i(e,o,t),l[e]=o,c[o]=t,u[o]=n,s[o]=new RegExp(t,r?"g":void 0),a[o]=new RegExp(n,r?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),h("MAINVERSION",`(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASE",`(?:-(${c[l.PRERELEASEIDENTIFIER]}(?:\\.${c[l.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${c[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[l.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${p}+`),h("BUILD",`(?:\\+(${c[l.BUILDIDENTIFIER]}(?:\\.${c[l.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${c[l.MAINVERSION]}${c[l.PRERELEASE]}?${c[l.BUILD]}?`),h("FULL",`^${c[l.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${c[l.MAINVERSIONLOOSE]}${c[l.PRERELEASELOOSE]}?${c[l.BUILD]}?`),h("LOOSE",`^${c[l.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${c[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${c[l.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:${c[l.PRERELEASE]})?${c[l.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:${c[l.PRERELEASELOOSE]})?${c[l.BUILD]}?)?)?`),h("XRANGE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAINLOOSE]}$`),h("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),h("COERCE",`${c[l.COERCEPLAIN]}(?:$|[^\\d])`),h("COERCEFULL",c[l.COERCEPLAIN]+`(?:${c[l.PRERELEASE]})?`+`(?:${c[l.BUILD]})?(?:$|[^\\d])`),h("COERCERTL",c[l.COERCE],!0),h("COERCERTLFULL",c[l.COERCEFULL],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${c[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${c[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${c[l.LONECARET]}${c[l.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${c[l.LONECARET]}${c[l.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${c[l.GTLT]}\\s*(${c[l.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]}|${c[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${c[l.XRANGEPLAIN]})\\s+-\\s+(${c[l.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${c[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[l.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(wn,wn.exports)),wn.exports}function On(){if(qt)return zt;qt=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return zt=r=>r?"object"!=typeof r?e:r:t}function Nn(){if(Zt)return Vt;Zt=1;const e=/^[0-9]+$/,t=(t,r)=>{const n=e.test(t),o=e.test(r);return n&&o&&(t=+t,r=+r),t===r?0:n&&!o?-1:o&&!n?1:t<r?-1:1};return Vt={compareIdentifiers:t,rcompareIdentifiers:(e,r)=>t(r,e)},Vt}function Sn(){if(Kt)return Xt;Kt=1;const e=_n(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=In(),{safeRe:n,t:o}=Cn(),i=On(),{compareIdentifiers:s}=Nn();class a{constructor(s,c){if(c=i(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 u=s.trim().match(c.loose?n[o.LOOSE]:n[o.FULL]);if(!u)throw new TypeError(`Invalid Version: ${s}`);if(this.raw=s,this.major=+u[1],this.minor=+u[2],this.patch=+u[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");u[4]?this.prerelease=u[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<r)return t}return e}):this.prerelease=[],this.build=u[5]?u[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)),s(this.major,e.major)||s(this.minor,e.minor)||s(this.patch,e.patch)}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 r=0;do{const n=this.prerelease[r],o=t.prerelease[r];if(e("prerelease compare",r,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return s(n,o)}while(++r)}compareBuild(t){t instanceof a||(t=new a(t,this.options));let r=0;do{const n=this.build[r],o=t.build[r];if(e("build compare",r,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return s(n,o)}while(++r)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?n[o.PRERELEASELOOSE]:n[o.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,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);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(r)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let n=this.prerelease.length;for(;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===s(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Xt=a}function Ln(){if(Yt)return Wt;Yt=1;const e=Sn();return Wt=(t,r,n=!1)=>{if(t instanceof e)return t;try{return new e(t,r)}catch(e){if(!n)return null;throw e}},Wt}function Rn(){if(mr)return hr;mr=1;const e=Sn();return hr=(t,r,n)=>new e(t,n).compare(new e(r,n)),hr}function Dn(){if(wr)return br;wr=1;const e=Sn();return br=(t,r,n)=>{const o=new e(t,n),i=new e(r,n);return o.compare(i)||o.compareBuild(i)},br}function Tn(){if(Sr)return Nr;Sr=1;const e=Rn();return Nr=(t,r,n)=>e(t,r,n)>0,Nr}function An(){if(Rr)return Lr;Rr=1;const e=Rn();return Lr=(t,r,n)=>e(t,r,n)<0,Lr}function Pn(){if(Tr)return Dr;Tr=1;const e=Rn();return Dr=(t,r,n)=>0===e(t,r,n),Dr}function $n(){if(Pr)return Ar;Pr=1;const e=Rn();return Ar=(t,r,n)=>0!==e(t,r,n),Ar}function xn(){if(xr)return $r;xr=1;const e=Rn();return $r=(t,r,n)=>e(t,r,n)>=0,$r}function Un(){if(kr)return Ur;kr=1;const e=Rn();return Ur=(t,r,n)=>e(t,r,n)<=0,Ur}function kn(){if(Br)return Fr;Br=1;const e=Pn(),t=$n(),r=Tn(),n=xn(),o=An(),i=Un();return Fr=(s,a,c,u)=>{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,u);case"!=":return t(s,c,u);case">":return r(s,c,u);case">=":return n(s,c,u);case"<":return o(s,c,u);case"<=":return i(s,c,u);default:throw new TypeError(`Invalid operator: ${a}`)}},Fr}function Fn(){if(qr)return zr;qr=1;const e=/\s+/g;class t{constructor(r,i){if(i=n(i),r instanceof t)return r.loose===!!i.loose&&r.includePrerelease===!!i.includePrerelease?r:new t(r.raw,i);if(r instanceof o)return this.raw=r.value,this.set=[[r]],this.formatted=void 0,this;if(this.options=i,this.loose=!!i.loose,this.includePrerelease=!!i.includePrerelease,this.raw=r.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,n=r.get(t);if(n)return n;const s=this.options.loose,m=s?a[c.HYPHENRANGELOOSE]:a[c.HYPHENRANGE];e=e.replace(m,S(this.options.includePrerelease)),i("hyphen replace",e),e=e.replace(a[c.COMPARATORTRIM],u),i("comparator trim",e),e=e.replace(a[c.TILDETRIM],l),i("tilde trim",e),e=e.replace(a[c.CARETTRIM],f),i("caret trim",e);let g=e.split(" ").map(e=>v(e,this.options)).join(" ").split(/\s+/).map(e=>N(e,this.options));s&&(g=g.filter(e=>(i("loose invalid filter",e,this.options),!!e.match(a[c.COMPARATORLOOSE])))),i("range list",g);const E=new Map,y=g.map(e=>new o(e,this.options));for(const e of y){if(h(e))return[e];E.set(e.value,e)}E.size>1&&E.has("")&&E.delete("");const b=[...E.values()];return r.set(t,b),b}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(t=>g(t,r)&&e.set.some(e=>g(e,r)&&t.every(t=>e.every(e=>t.intersects(e,r)))))}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(L(this.set[t],e,this.options))return!0;return!1}}zr=t;const r=new(Gr?Hr:(Gr=1,Hr=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}})),n=On(),o=Bn(),i=_n(),s=Sn(),{safeRe:a,t:c,comparatorTrimReplace:u,tildeTrimReplace:l,caretTrimReplace:f}=Cn(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:d}=In(),h=e=>"<0.0.0-0"===e.value,m=e=>""===e.value,g=(e,t)=>{let r=!0;const n=e.slice();let o=n.pop();for(;r&&n.length;)r=n.every(e=>o.intersects(e,t)),o=n.pop();return r},v=(e,t)=>(i("comp",e,t),e=w(e,t),i("caret",e),e=y(e,t),i("tildes",e),e=_(e,t),i("xrange",e),e=O(e,t),i("stars",e),e),E=e=>!e||"x"===e.toLowerCase()||"*"===e,y=(e,t)=>e.trim().split(/\s+/).map(e=>b(e,t)).join(" "),b=(e,t)=>{const r=t.loose?a[c.TILDELOOSE]:a[c.TILDE];return e.replace(r,(t,r,n,o,s)=>{let a;return i("tilde",e,t,r,n,o,s),E(r)?a="":E(n)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:E(o)?a=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:s?(i("replaceTilde pr",s),a=`>=${r}.${n}.${o}-${s} <${r}.${+n+1}.0-0`):a=`>=${r}.${n}.${o} <${r}.${+n+1}.0-0`,i("tilde return",a),a})},w=(e,t)=>e.trim().split(/\s+/).map(e=>I(e,t)).join(" "),I=(e,t)=>{i("caret",e,t);const r=t.loose?a[c.CARETLOOSE]:a[c.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(t,r,o,s,a)=>{let c;return i("caret",e,t,r,o,s,a),E(r)?c="":E(o)?c=`>=${r}.0.0${n} <${+r+1}.0.0-0`:E(s)?c="0"===r?`>=${r}.${o}.0${n} <${r}.${+o+1}.0-0`:`>=${r}.${o}.0${n} <${+r+1}.0.0-0`:a?(i("replaceCaret pr",a),c="0"===r?"0"===o?`>=${r}.${o}.${s}-${a} <${r}.${o}.${+s+1}-0`:`>=${r}.${o}.${s}-${a} <${r}.${+o+1}.0-0`:`>=${r}.${o}.${s}-${a} <${+r+1}.0.0-0`):(i("no pr"),c="0"===r?"0"===o?`>=${r}.${o}.${s}${n} <${r}.${o}.${+s+1}-0`:`>=${r}.${o}.${s}${n} <${r}.${+o+1}.0-0`:`>=${r}.${o}.${s} <${+r+1}.0.0-0`),i("caret return",c),c})},_=(e,t)=>(i("replaceXRanges",e,t),e.split(/\s+/).map(e=>C(e,t)).join(" ")),C=(e,t)=>{e=e.trim();const r=t.loose?a[c.XRANGELOOSE]:a[c.XRANGE];return e.replace(r,(r,n,o,s,a,c)=>{i("xRange",e,r,n,o,s,a,c);const u=E(o),l=u||E(s),f=l||E(a),p=f;return"="===n&&p&&(n=""),c=t.includePrerelease?"-0":"",u?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&p?(l&&(s=0),a=0,">"===n?(n=">=",l?(o=+o+1,s=0,a=0):(s=+s+1,a=0)):"<="===n&&(n="<",l?o=+o+1:s=+s+1),"<"===n&&(c="-0"),r=`${n+o}.${s}.${a}${c}`):l?r=`>=${o}.0.0${c} <${+o+1}.0.0-0`:f&&(r=`>=${o}.${s}.0${c} <${o}.${+s+1}.0-0`),i("xRange return",r),r})},O=(e,t)=>(i("replaceStars",e,t),e.trim().replace(a[c.STAR],"")),N=(e,t)=>(i("replaceGTE0",e,t),e.trim().replace(a[t.includePrerelease?c.GTE0PRE:c.GTE0],"")),S=e=>(t,r,n,o,i,s,a,c,u,l,f,p)=>`${r=E(n)?"":E(o)?`>=${n}.0.0${e?"-0":""}`:E(i)?`>=${n}.${o}.0${e?"-0":""}`:s?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=E(u)?"":E(l)?`<${+u+1}.0.0-0`:E(f)?`<${u}.${+l+1}.0-0`:p?`<=${u}.${l}.${f}-${p}`:e?`<${u}.${l}.${+f+1}-0`:`<=${c}`}`.trim(),L=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(i(e[r].semver),e[r].semver!==o.ANY&&e[r].semver.prerelease.length>0){const n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0};return zr}function Bn(){if(Zr)return Vr;Zr=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(n,o){if(o=r(o),n instanceof t){if(n.loose===!!o.loose)return n;n=n.value}n=n.trim().split(/\s+/).join(" "),s("comparator",n,o),this.options=o,this.loose=!!o.loose,this.parse(n),this.semver===e?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}parse(t){const r=this.options.loose?n[o.COMPARATORLOOSE]:n[o.COMPARATOR],i=t.match(r);if(!i)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==i[1]?i[1]:"","="===this.operator&&(this.operator=""),i[2]?this.semver=new a(i[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 i(t,this.operator,this.semver,this.options)}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new c(e.value,n).test(this.value):""===e.operator?""===e.value||new c(this.value,n).test(e.semver):(!(n=r(n)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!n.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("="))||(!!(i(this.semver,"<",e.semver,n)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(i(this.semver,">",e.semver,n)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}Vr=t;const r=On(),{safeRe:n,t:o}=Cn(),i=kn(),s=_n(),a=Sn(),c=Fn();return Vr}function jn(){if(Kr)return Xr;Kr=1;const e=Fn();return Xr=(t,r,n)=>{try{r=new e(r,n)}catch(e){return!1}return r.test(t)},Xr}function Mn(){if(sn)return on;sn=1;const e=Fn();return on=(t,r)=>{try{return new e(t,r).range||"*"}catch(e){return null}},on}function Hn(){if(cn)return an;cn=1;const e=Sn(),t=Bn(),{ANY:r}=t,n=Fn(),o=jn(),i=Tn(),s=An(),a=Un(),c=xn();return an=(u,l,f,p)=>{let d,h,m,g,v;switch(u=new e(u,p),l=new n(l,p),f){case">":d=i,h=a,m=s,g=">",v=">=";break;case"<":d=s,h=c,m=i,g="<",v="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(o(u,l,p))return!1;for(let e=0;e<l.set.length;++e){const n=l.set[e];let o=null,i=null;if(n.forEach(e=>{e.semver===r&&(e=new t(">=0.0.0")),o=o||e,i=i||e,d(e.semver,o.semver,p)?o=e:m(e.semver,i.semver,p)&&(i=e)}),o.operator===g||o.operator===v)return!1;if((!i.operator||i.operator===g)&&h(u,i.semver))return!1;if(i.operator===v&&m(u,i.semver))return!1}return!0},an}var Gn=function(){if(bn)return yn;bn=1;const e=Cn(),t=In(),r=Sn(),n=Nn(),o=Ln(),i=function(){if(Qt)return Jt;Qt=1;const e=Ln();return Jt=(t,r)=>{const n=e(t,r);return n?n.version:null},Jt}(),s=function(){if(tr)return er;tr=1;const e=Ln();return er=(t,r)=>{const n=e(t.trim().replace(/^[=v]+/,""),r);return n?n.version:null},er}(),a=function(){if(nr)return rr;nr=1;const e=Sn();return rr=(t,r,n,o,i)=>{"string"==typeof n&&(i=o,o=n,n=void 0);try{return new e(t instanceof e?t.version:t,n).inc(r,o,i).version}catch(e){return null}},rr}(),c=function(){if(ir)return or;ir=1;const e=Ln();return or=(t,r)=>{const n=e(t,null,!0),o=e(r,null,!0),i=n.compare(o);if(0===i)return null;const s=i>0,a=s?n:o,c=s?o:n,u=!!a.prerelease.length;if(c.prerelease.length&&!u){if(!c.patch&&!c.minor)return"major";if(0===c.compareMain(a))return c.minor&&!c.patch?"minor":"patch"}const l=u?"pre":"";return n.major!==o.major?l+"major":n.minor!==o.minor?l+"minor":n.patch!==o.patch?l+"patch":"prerelease"}}(),u=function(){if(ar)return sr;ar=1;const e=Sn();return sr=(t,r)=>new e(t,r).major,sr}(),l=function(){if(ur)return cr;ur=1;const e=Sn();return cr=(t,r)=>new e(t,r).minor,cr}(),f=function(){if(fr)return lr;fr=1;const e=Sn();return lr=(t,r)=>new e(t,r).patch,lr}(),p=function(){if(dr)return pr;dr=1;const e=Ln();return pr=(t,r)=>{const n=e(t,r);return n&&n.prerelease.length?n.prerelease:null},pr}(),d=Rn(),h=function(){if(vr)return gr;vr=1;const e=Rn();return gr=(t,r,n)=>e(r,t,n),gr}(),m=function(){if(yr)return Er;yr=1;const e=Rn();return Er=(t,r)=>e(t,r,!0),Er}(),g=Dn(),v=function(){if(_r)return Ir;_r=1;const e=Dn();return Ir=(t,r)=>t.sort((t,n)=>e(t,n,r)),Ir}(),E=function(){if(Or)return Cr;Or=1;const e=Dn();return Cr=(t,r)=>t.sort((t,n)=>e(n,t,r)),Cr}(),y=Tn(),b=An(),w=Pn(),I=$n(),_=xn(),C=Un(),O=kn(),N=function(){if(Mr)return jr;Mr=1;const e=Sn(),t=Ln(),{safeRe:r,t:n}=Cn();return jr=(o,i)=>{if(o instanceof e)return o;if("number"==typeof o&&(o=String(o)),"string"!=typeof o)return null;let s=null;if((i=i||{}).rtl){const e=i.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let t;for(;(t=e.exec(o))&&(!s||s.index+s[0].length!==o.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=o.match(i.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);if(null===s)return null;const a=s[2],c=s[3]||"0",u=s[4]||"0",l=i.includePrerelease&&s[5]?`-${s[5]}`:"",f=i.includePrerelease&&s[6]?`+${s[6]}`:"";return t(`${a}.${c}.${u}${l}${f}`,i)},jr}(),S=Bn(),L=Fn(),R=jn(),D=function(){if(Yr)return Wr;Yr=1;const e=Fn();return Wr=(t,r)=>new e(t,r).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" ")),Wr}(),T=function(){if(Qr)return Jr;Qr=1;const e=Sn(),t=Fn();return Jr=(r,n,o)=>{let i=null,s=null,a=null;try{a=new t(n,o)}catch(e){return null}return r.forEach(t=>{a.test(t)&&(i&&-1!==s.compare(t)||(i=t,s=new e(i,o)))}),i},Jr}(),A=function(){if(tn)return en;tn=1;const e=Sn(),t=Fn();return en=(r,n,o)=>{let i=null,s=null,a=null;try{a=new t(n,o)}catch(e){return null}return r.forEach(t=>{a.test(t)&&(i&&1!==s.compare(t)||(i=t,s=new e(i,o)))}),i},en}(),P=function(){if(nn)return rn;nn=1;const e=Sn(),t=Fn(),r=Tn();return rn=(n,o)=>{n=new t(n,o);let i=new e("0.0.0");if(n.test(i))return i;if(i=new e("0.0.0-0"),n.test(i))return i;i=null;for(let t=0;t<n.set.length;++t){const o=n.set[t];let s=null;o.forEach(t=>{const n=new e(t.semver.version);switch(t.operator){case">":0===n.prerelease.length?n.patch++:n.prerelease.push(0),n.raw=n.format();case"":case">=":s&&!r(n,s)||(s=n);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${t.operator}`)}}),!s||i&&!r(i,s)||(i=s)}return i&&n.test(i)?i:null},rn}(),$=Mn(),x=Hn(),U=function(){if(ln)return un;ln=1;const e=Hn();return un=(t,r,n)=>e(t,r,">",n),un}(),k=function(){if(pn)return fn;pn=1;const e=Hn();return fn=(t,r,n)=>e(t,r,"<",n),fn}(),F=function(){if(hn)return dn;hn=1;const e=Fn();return dn=(t,r,n)=>(t=new e(t,n),r=new e(r,n),t.intersects(r,n))}(),B=function(){if(gn)return mn;gn=1;const e=jn(),t=Rn();return mn=(r,n,o)=>{const i=[];let s=null,a=null;const c=r.sort((e,r)=>t(e,r,o));for(const t of c)e(t,n,o)?(a=t,s||(s=t)):(a&&i.push([s,a]),a=null,s=null);s&&i.push([s,null]);const u=[];for(const[e,t]of i)e===t?u.push(e):t||e!==c[0]?t?e===c[0]?u.push(`<=${t}`):u.push(`${e} - ${t}`):u.push(`>=${e}`):u.push("*");const l=u.join(" || "),f="string"==typeof n.raw?n.raw:String(n);return l.length<f.length?l:n},mn}(),j=function(){if(En)return vn;En=1;const e=Fn(),t=Bn(),{ANY:r}=t,n=jn(),o=Rn(),i=[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===r){if(1===t.length&&t[0].semver===r)return!0;e=a.includePrerelease?i:s}if(1===t.length&&t[0].semver===r){if(a.includePrerelease)return!0;t=s}const l=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=u(p,t,a):l.add(t.semver);if(l.size>1)return null;if(f&&p){if(d=o(f.semver,p.semver,a),d>0)return null;if(0===d&&(">="!==f.operator||"<="!==p.operator))return null}for(const e of l){if(f&&!n(e,String(f),a))return null;if(p&&!n(e,String(p),a))return null;for(const r of t)if(!n(e,String(r),a))return!1;return!0}let E=!(!p||a.includePrerelease||!p.semver.prerelease.length)&&p.semver,y=!(!f||a.includePrerelease||!f.semver.prerelease.length)&&f.semver;E&&1===E.prerelease.length&&"<"===p.operator&&0===E.prerelease[0]&&(E=!1);for(const e of t){if(v=v||">"===e.operator||">="===e.operator,g=g||"<"===e.operator||"<="===e.operator,f)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(h=c(f,e,a),h===e&&h!==f)return!1}else if(">="===f.operator&&!n(f.semver,String(e),a))return!1;if(p)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(m=u(p,e,a),m===e&&m!==p)return!1}else if("<="===p.operator&&!n(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||y||E)},c=(e,t,r)=>{if(!e)return t;const n=o(e.semver,t.semver,r);return n>0?e:n<0||">"===t.operator&&">="===e.operator?t:e},u=(e,t,r)=>{if(!e)return t;const n=o(e.semver,t.semver,r);return n<0?e:n>0||"<"===t.operator&&"<="===e.operator?t:e};return vn=(t,r,n={})=>{if(t===r)return!0;t=new e(t,n),r=new e(r,n);let o=!1;e:for(const e of t.set){for(const t of r.set){const r=a(e,t,n);if(o=o||null!==r,r)continue e}if(o)return!1}return!0}}();return yn={parse:o,valid:i,clean:s,inc:a,diff:c,major:u,minor:l,patch:f,prerelease:p,compare:d,rcompare:h,compareLoose:m,compareBuild:g,sort:v,rsort:E,gt:y,lt:b,eq:w,neq:I,gte:_,lte:C,cmp:O,coerce:N,Comparator:S,Range:L,satisfies:R,toComparators:D,maxSatisfying:T,minSatisfying:A,minVersion:P,validRange:$,outside:x,gtr:U,ltr:k,intersects:F,simplifyRange:B,subset:j,SemVer:r,re:e.re,src:e.src,tokens:e.t,SEMVER_SPEC_VERSION:t.SEMVER_SPEC_VERSION,RELEASE_TYPES:t.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers}}();class zn extends Gn.SemVer{satisfies(e){return Gn.satisfies(this,e)}}let qn=class{domain;level=Number(process.env.FUSION_LOG_LEVEL)||1;constructor(e){this.domain=e}_createMessage(e){return[`%c FUSION FRAMEWORK %c ${this.domain} %c %s`,"background: rgb(179, 13, 47); color: white; padding: 1px;","background: rgb(244, 244, 244); color: rgb(36, 55, 70); padding: 1px;","background: none; color: inherit",...e.reduce((e,t)=>e.concat(t,"\n"),[])]}debug(...e){this.level>3&&console.debug(...this._createMessage(e))}info(...e){this.level>2&&console.info(...this._createMessage(e))}warn(...e){this.level>1&&console.warn(...this._createMessage(e))}error(...e){this.level>0&&console.error(...this._createMessage(e))}};class Vn extends qn{formatModuleName(e){return`📦${("string"==typeof e?e:e.name).replace(/([A-Z])/g," $1").toUpperCase()}`}}var Zn=function(e,t){return Zn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},Zn(e,t)};function Xn(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Zn(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var Kn=function(){return Kn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Kn.apply(this,arguments)};function Wn(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}c((n=n.apply(e,t||[])).next())})}function Yn(e,t){var r,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[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(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,n=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function Jn(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Qn(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function eo(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function to(e){return this instanceof to?(this.v=e,this):new to(e)}function ro(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),i=[];return n=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,u)}}),n[Symbol.asyncIterator]=function(){return this},n;function s(e,t){o[e]&&(n[e]=function(t){return new Promise(function(r,n){i.push([e,t,r,n])>1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{!function(e){e.value instanceof to?Promise.resolve(e.value.v).then(c,u):l(i[0][2],e)}(o[e](t))}catch(e){l(i[0][3],e)}}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function no(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=Jn(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,o){(function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)})(n,o,(t=e[r](t)).done,t.value)})}}}function oo(e){return"function"==typeof e}function io(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=io(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 r=e.indexOf(t);0<=r&&e.splice(r,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,r,n,o;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var s=Jn(i),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 i.remove(this);var c=this.initialTeardown;if(oo(c))try{c()}catch(e){o=e instanceof so?e.errors:[e]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=Jn(u),f=l.next();!f.done;f=l.next()){var p=f.value;try{fo(p)}catch(e){o=null!=o?o:[],e instanceof so?o=eo(eo([],Qn(o)),Qn(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}if(o)throw new so(o)}},e.prototype.add=function(t){var r;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!==(r=this._finalizers)&&void 0!==r?r:[]).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 r=this._finalizers;r&&ao(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),uo=co.EMPTY;function lo(e){return e instanceof co||e&&"closed"in e&&oo(e.remove)&&oo(e.add)&&oo(e.unsubscribe)}function fo(e){oo(e)?e():e.unsubscribe()}var po={Promise:void 0},ho=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,eo([e,t],Qn(r)))};function mo(e){ho(function(){throw e})}function go(){}function vo(e){e()}var Eo=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,lo(t)&&t.add(r)):r.destination=Io,r}return Xn(t,e),t.create=function(e,t,r){return new bo(e,t,r)},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),yo=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,r,n){var o,i=e.call(this)||this;return o=oo(t)||!t?{next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:t,i.destination=new yo(o),i}return Xn(t,e),t}(Eo);function wo(e){mo(e)}var Io={closed:!0,next:go,error:function(e){throw e},complete:go},_o="function"==typeof Symbol&&Symbol.observable||"@@observable";function Co(e){return e}var Oo=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,i=(n=e)&&n instanceof Eo||function(e){return e&&oo(e.next)&&oo(e.error)&&oo(e.complete)}(n)&&lo(n)?e:new bo(e,t,r);return vo(function(){var e=o,t=e.operator,r=e.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))}),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=No(t))(function(t,n){var o=new bo({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[_o]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];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=No(e))(function(e,r){var n;t.subscribe(function(e){return n=e},function(e){return r(e)},function(){return e(n)})})},e.create=function(t){return new e(t)},e}();function No(e){var t;return null!==(t=null!=e?e:po.Promise)&&void 0!==t?t:Promise}function So(e){return function(t){if(function(e){return oo(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 Lo(e,t,r,n,o){return new Ro(e,t,r,n,o)}var Ro=function(e){function t(t,r,n,o,i,s){var a=e.call(this,t)||this;return a.onFinalize=i,a.shouldUnsubscribe=s,a._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=o?function(e){try{o(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=n?function(){try{n()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return Xn(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(Eo),Do=io(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),To=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 Xn(t,e),t.prototype.lift=function(e){var t=new Ao(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Do},t.prototype.next=function(e){var t=this;vo(function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=Jn(t.currentObservers),i=o.next();!i.done;i=o.next()){i.value.next(e)}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.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 r=t.observers;r.length;)r.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,r=this,n=r.hasError,o=r.isStopped,i=r.observers;return n||o?uo:(this.currentObservers=null,i.push(e),new co(function(){t.currentObservers=null,ao(i,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,o=t.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new Oo;return e.source=this,e},t.create=function(e,t){return new Ao(e,t)},t}(Oo),Ao=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return Xn(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.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,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:uo},t}(To),Po=function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}return Xn(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){var e=this,t=e.hasError,r=e.thrownError,n=e._value;if(t)throw r;return this._throwIfClosed(),n},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(To),$o={now:function(){return($o.delegate||Date).now()},delegate:void 0},xo=function(e){function t(t,r,n){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===n&&(n=$o);var o=e.call(this)||this;return o._bufferSize=t,o._windowTime=r,o._timestampProvider=n,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=r===1/0,o._bufferSize=Math.max(1,t),o._windowTime=Math.max(1,r),o}return Xn(t,e),t.prototype.next=function(t){var r=this,n=r.isStopped,o=r._buffer,i=r._infiniteTimeWindow,s=r._timestampProvider,a=r._windowTime;n||(o.push(t),!i&&o.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),r=this._infiniteTimeWindow,n=this._buffer.slice(),o=0;o<n.length&&!e.closed;o+=r?1:2)e.next(n[o]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,r=e._timestampProvider,n=e._buffer,o=e._infiniteTimeWindow,i=(o?1:2)*t;if(t<1/0&&i<n.length&&n.splice(0,n.length-i),!o){for(var s=r.now(),a=0,c=1;c<n.length&&n[c]<=s;c+=2)a=c;a&&n.splice(0,a+1)}},t}(To),Uo=function(e){function t(t,r){return e.call(this)||this}return Xn(t,e),t.prototype.schedule=function(e,t){return this},t}(co),ko=function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setInterval.apply(void 0,eo([e,t],Qn(r)))},Fo=function(e){return clearInterval(e)},Bo=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return Xn(t,e),t.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,o=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(o,n,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(o,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),ko(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&Fo(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,n=!1;try{this.work(e)}catch(e){n=!0,r=e||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,n=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,ao(n,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(Uo),jo=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=$o.now,e}(),Mo=function(e){function t(t,r){void 0===r&&(r=jo.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n}return Xn(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(jo),Ho=new Mo(Bo),Go=Ho,zo=new Oo(function(e){return e.complete()});function qo(e){return e&&oo(e.schedule)}function Vo(e){return e[e.length-1]}var Zo=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function Xo(e){return oo(null==e?void 0:e.then)}function Ko(e){return oo(e[_o])}function Wo(e){return Symbol.asyncIterator&&oo(null==e?void 0:e[Symbol.asyncIterator])}function Yo(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 oo(null==e?void 0:e[Jo])}function ei(e){return ro(this,arguments,function(){var t,r,n;return Yn(this,function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,to(t.read())];case 3:return r=o.sent(),n=r.value,r.done?[4,to(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,to(n)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function ti(e){return oo(null==e?void 0:e.getReader)}function ri(e){if(e instanceof Oo)return e;if(null!=e){if(Ko(e))return o=e,new Oo(function(e){var t=o[_o]();if(oo(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(Zo(e))return n=e,new Oo(function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()});if(Xo(e))return r=e,new Oo(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,mo)});if(Wo(e))return ni(e);if(Qo(e))return t=e,new Oo(function(e){var r,n;try{for(var o=Jn(t),i=o.next();!i.done;i=o.next()){var s=i.value;if(e.next(s),e.closed)return}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}e.complete()});if(ti(e))return ni(ei(e))}var t,r,n,o;throw Yo(e)}function ni(e){return new Oo(function(t){(function(e,t){var r,n,o,i;return Wn(this,void 0,void 0,function(){var s,a;return Yn(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=no(e),c.label=1;case 1:return[4,r.next()];case 2:if((n=c.sent()).done)return[3,4];if(s=n.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(),o={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function oi(e,t,r,n,o){void 0===n&&(n=0),void 0===o&&(o=!1);var i=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(i),!o)return i}function ii(e,t){return void 0===t&&(t=0),So(function(r,n){r.subscribe(Lo(n,function(r){return oi(n,e,function(){return n.next(r)},t)},function(){return oi(n,e,function(){return n.complete()},t)},function(r){return oi(n,e,function(){return n.error(r)},t)}))})}function si(e,t){return void 0===t&&(t=0),So(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function ai(e,t){if(!e)throw new Error("Iterable cannot be null");return new Oo(function(r){oi(r,t,function(){var n=e[Symbol.asyncIterator]();oi(r,t,function(){n.next().then(function(e){e.done?r.complete():r.next(e.value)})},0,!0)})})}function ci(e,t){if(null!=e){if(Ko(e))return function(e,t){return ri(e).pipe(si(t),ii(t))}(e,t);if(Zo(e))return function(e,t){return new Oo(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}(e,t);if(Xo(e))return function(e,t){return ri(e).pipe(si(t),ii(t))}(e,t);if(Wo(e))return ai(e,t);if(Qo(e))return function(e,t){return new Oo(function(r){var n;return oi(r,t,function(){n=e[Jo](),oi(r,t,function(){var e,t,o;try{t=(e=n.next()).value,o=e.done}catch(e){return void r.error(e)}o?r.complete():r.next(t)},0,!0)}),function(){return oo(null==n?void 0:n.return)&&n.return()}})}(e,t);if(ti(e))return function(e,t){return ai(ei(e),t)}(e,t)}throw Yo(e)}function ui(e,t){return t?ci(e,t):ri(e)}function li(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=function(e){return qo(Vo(e))?e.pop():void 0}(e);return ui(e,r)}var fi=io(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function pi(e,t){var r="object"==typeof t;return new Promise(function(n,o){var i,s=!1;e.subscribe({next:function(e){i=e,s=!0},error:o,complete:function(){s?n(i):r?n(t.defaultValue):o(new fi)}})})}function di(e,t){var r="object"==typeof t;return new Promise(function(n,o){var i=new bo({next:function(e){n(e),i.unsubscribe()},error:o,complete:function(){r?n(t.defaultValue):o(new fi)}});e.subscribe(i)})}function hi(e){return e instanceof Date&&!isNaN(e)}var mi=io(function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function gi(e){throw new mi(e)}function vi(e,t){return So(function(r,n){var o=0;r.subscribe(Lo(n,function(r){n.next(e.call(t,r,o++))}))})}var Ei=Array.isArray;function yi(e){return vi(function(t){return function(e,t){return Ei(t)?e.apply(void 0,eo([],Qn(t))):e(t)}(e,t)})}function bi(e,t,r,n,o,i,s,a){var c=[],u=0,l=0,f=!1,p=function(){!f||c.length||u||t.complete()},d=function(e){return u<n?h(e):c.push(e)},h=function(e){i&&t.next(e),u++;var a=!1;ri(r(e,l++)).subscribe(Lo(t,function(e){null==o||o(e),i?d(e):t.next(e)},function(){a=!0},void 0,function(){if(a)try{u--;for(var e=function(){var e=c.shift();s||h(e)};c.length&&u<n;)e();p()}catch(e){t.error(e)}}))};return e.subscribe(Lo(t,d,function(){f=!0,p()})),function(){null==a||a()}}function wi(e,t,r){return void 0===r&&(r=1/0),oo(t)?wi(function(r,n){return vi(function(e,o){return t(r,e,n,o)})(ri(e(r,n)))},r):("number"==typeof t&&(r=t),So(function(t,n){return bi(t,n,e,r)}))}var Ii=["addListener","removeListener"],_i=["addEventListener","removeEventListener"],Ci=["on","off"];function Oi(e,t,r,n){if(oo(r)&&(n=r,r=void 0),n)return Oi(e,t,r).pipe(yi(n));var o=Qn(function(e){return oo(e.addEventListener)&&oo(e.removeEventListener)}(e)?_i.map(function(n){return function(o){return e[n](t,o,r)}}):function(e){return oo(e.addListener)&&oo(e.removeListener)}(e)?Ii.map(Ni(e,t)):function(e){return oo(e.on)&&oo(e.off)}(e)?Ci.map(Ni(e,t)):[],2),i=o[0],s=o[1];if(!i&&Zo(e))return wi(function(e){return Oi(e,t,r)})(ri(e));if(!i)throw new TypeError("Invalid event target");return new Oo(function(e){var t=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.next(1<t.length?t:t[0])};return i(t),function(){return s(t)}})}function Ni(e,t){return function(r){return function(n){return e[r](t,n)}}}function Si(e,t,r){void 0===e&&(e=0),void 0===r&&(r=Go);var n=-1;return null!=t&&(qo(t)?r=t:n=t),new Oo(function(t){var o=hi(e)?+e-r.now():e;o<0&&(o=0);var i=0;return r.schedule(function(){t.closed||(t.next(i++),0<=n?this.schedule(void 0,n):t.complete())},o)})}function Li(e,t){return So(function(r,n){var o=0;r.subscribe(Lo(n,function(r){return e.call(t,r,o++)&&n.next(r)}))})}function Ri(e){return So(function(t,r){var n,o=null,i=!1;o=t.subscribe(Lo(r,void 0,void 0,function(s){n=ri(e(s,Ri(e)(t))),o?(o.unsubscribe(),o=null,n.subscribe(r)):i=!0})),i&&(o.unsubscribe(),o=null,n.subscribe(r))})}function Di(e,t,r,n,o){return function(i,s){var a=r,c=t,u=0;i.subscribe(Lo(s,function(t){var r=u++;c=a?e(c,t,r):(a=!0,t),n&&s.next(c)},o&&function(){a&&s.next(c),s.complete()}))}}function Ti(e,t){return So(Di(e,t,arguments.length>=2,!1,!0))}function Ai(e,t){return void 0===t&&(t=Co),e=null!=e?e:Pi,So(function(r,n){var o,i=!0;r.subscribe(Lo(n,function(r){var s=t(r);!i&&e(o,s)||(i=!1,o=s,n.next(r))}))})}function Pi(e,t){return e===t}function $i(e){return void 0===e&&(e=xi),So(function(t,r){var n=!1;t.subscribe(Lo(r,function(e){n=!0,r.next(e)},function(){return n?r.complete():r.error(e())}))})}function xi(){return new fi}function Ui(e){return So(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}function ki(e,t){var r=arguments.length>=2;return function(e){return e.pipe(Co,(n=1)<=0?function(){return zo}:So(function(e,t){var r=[];e.subscribe(Lo(t,function(e){r.push(e),n<r.length&&r.shift()},function(){var e,n;try{for(var o=Jn(r),i=o.next();!i.done;i=o.next()){var s=i.value;t.next(s)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}t.complete()},void 0,function(){r=null}))}),r?function(e){return So(function(t,r){var n=!1;t.subscribe(Lo(r,function(e){n=!0,r.next(e)},function(){n||r.next(e),r.complete()}))})}(t):$i(function(){return new fi}));var n}}function Fi(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!0!==t){if(!1!==t){var o=new bo({next:function(){o.unsubscribe(),e()}});return ri(t.apply(void 0,eo([],Qn(r)))).subscribe(o)}}else e()}function Bi(e,t){return So(function(r,n){var o=null,i=0,s=!1,a=function(){return s&&!o&&n.complete()};r.subscribe(Lo(n,function(r){null==o||o.unsubscribe();var s=0,c=i++;ri(e(r,c)).subscribe(o=Lo(n,function(e){return n.next(t?t(r,e,c,s++):e)},function(){o=null,a()}))},function(){s=!0,a()}))})}function ji(e){return So(function(t,r){ri(e).subscribe(Lo(r,function(){return r.complete()},go)),!r.closed&&t.subscribe(r)})}function Mi(e,t,r){var n=oo(e)||t||r?{next:e,error:t,complete:r}:e;return n?So(function(e,t){var r;null===(r=n.subscribe)||void 0===r||r.call(n);var o=!0;e.subscribe(Lo(t,function(e){var r;null===(r=n.next)||void 0===r||r.call(n,e),t.next(e)},function(){var e;o=!1,null===(e=n.complete)||void 0===e||e.call(n),t.complete()},function(e){var r;o=!1,null===(r=n.error)||void 0===r||r.call(n,e),t.error(e)},function(){var e,t;o&&(null===(e=n.unsubscribe)||void 0===e||e.call(n)),null===(t=n.finalize)||void 0===t||t.call(n)}))}):Co}function Hi(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r,n=oo(Vo(r=e))?r.pop():void 0;return So(function(t,r){for(var o=e.length,i=new Array(o),s=e.map(function(){return!1}),a=!1,c=function(t){ri(e[t]).subscribe(Lo(r,function(e){i[t]=e,a||s[t]||(s[t]=!0,(a=s.every(Co))&&(s=null))},go))},u=0;u<o;u++)c(u);t.subscribe(Lo(r,function(e){if(a){var t=eo([e],Qn(i));r.next(n?n.apply(void 0,eo([],Qn(t))):t)}}))})}const Gi=(e,t,r)=>{const n="string"==typeof t?t.split("."):t,o=n.shift();return o&&(e[o]??={},n.length?Gi(e[o],n,r):Object.assign(e,{[o]:r})),e};class zi{#t={};createConfig(e,t){return ui(this._createConfig(e,t))}async createConfigAsync(e,t){return pi(this.createConfig(e,t))}_set(e,t){const r="function"==typeof t?t:async()=>t;this.#t[e]=r}_get(e){return this.#t[e]}_has(e){return e in this.#t}_createConfig(e,t){return ui(this._buildConfig(e,t)).pipe(Bi(t=>this._processConfig(t,e)))}_buildConfig(e,t){return ui(Object.entries(this.#t)).pipe(wi(([t,r])=>ui(r(e)).pipe(Li(e=>void 0!==e),vi(e=>({target:t,value:e})),Ri(e=>(console.error(`Failed to execute config callback: ${r.name} for attribute: '${t}'`,e),zo)))),Ti((e,{target:t,value:r})=>Gi(e,t,r),t??{}))}_processConfig(e,t){return li(e)}}class qi{#r;#n;get version(){return this.#r}constructor(e){const{version:t}=e;this.#r=new zn(t),this.#n=new co}_addTeardown(e){return this.#n.add(e),()=>this.#n.remove(e)}dispose(){this.#n.unsubscribe()}}class Vi extends Error{constructor(){super("It was too slow"),this.name="RequiredModuleTimeoutError"}}class Zi{logger=new Vn("ModulesConfigurator");_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:r,afterInit:n,configure:o}=e;this._modules.add(t),o&&this._configs.push((e,r)=>o(e[t.name],r)),r&&this._afterConfiguration.push(e=>r(e[t.name])),n&&this._afterInit.push(e=>n(e[t.name]))}onConfigured(e){this._afterConfiguration.push(e)}onInitialized(e){this._afterInit.push(e)}async initialize(e){const t=await this._configure(e),r=await this._initialize(t,e);return await this._postInitialize(r,e),Object.seal(Object.assign({},r,{dispose:()=>this.dispose(r)}))}async _configure(e){const t=await this._createConfig(e);return await Promise.all(this._configs.map(r=>Promise.resolve(r(t,e)))),await this._postConfigure(t),t}_createConfig(e){const{modules:t,logger:r,_afterConfiguration:n,_afterInit:o}=this,i=ui(t).pipe(wi(async t=>{r.debug(`🛠 creating configurator ${r.formatModuleName(t)}`);try{const n=await(t.configure?.(e));return r.debug(`🛠 created configurator for ${r.formatModuleName(t)}`,n),{[t.name]:n}}catch(e){throw r.error(`🛠 Failed to created configurator for ${r.formatModuleName(t)}`,e),e}}),Ti((e,t)=>Object.assign(e,t),{onAfterConfiguration(e){n.push(e)},onAfterInit(e){o.push(e)}}));return pi(i)}async _postConfigure(e){const{modules:t,logger:r,_afterConfiguration:n}=this;if(await Promise.allSettled(t.filter(e=>!!e.postConfigure).map(async t=>{try{await(t.postConfigure?.(e)),r.debug(`🏗📌 post configured ${r.formatModuleName(t)}`,t)}catch(e){r.warn(`🏗📌 post configure failed ${r.formatModuleName(t)}`)}})),n.length)try{r.debug(`🏗📌 post configure hooks [${n.length}]`),await Promise.allSettled(n.map(t=>Promise.resolve(t(e)))),r.debug("🏗📌 post configure hooks complete")}catch(e){r.warn("🏗📌 post configure hook failed",e)}}async _initialize(e,t){const{modules:r,logger:n}=this,o=r.map(e=>e.name),i=new Po({}),s=e=>o.includes(e),a=(e,t=60)=>{if(!o.includes(e))throw n.error(`🚀⌛️ Cannot not require ${n.formatModuleName(String(e))} since module is not defined!`),Error(`cannot not require [${String(e)}] since module is not defined!`);return i.value[e]?(n.debug(`🚀⌛️ ${n.formatModuleName(String(e))} is initiated, skipping queue`),Promise.resolve(i.value[e])):(n.debug(`🚀⌛️ Awaiting init ${n.formatModuleName(String(e))}, timeout ${t}s`),di(i.pipe(Li(t=>!!t[e]),vi(t=>t[e]),function(e){var t=hi(e)?{first:e}:"number"==typeof e?{each:e}:e,r=t.first,n=t.each,o=t.with,i=void 0===o?gi:o,s=t.scheduler,a=void 0===s?Ho:s,c=t.meta,u=void 0===c?null:c;if(null==r&&null==n)throw new TypeError("No timeout provided.");return So(function(e,t){var o,s,c=null,l=0,f=function(e){s=oi(t,a,function(){try{o.unsubscribe(),ri(i({meta:u,lastValue:c,seen:l})).subscribe(t)}catch(e){t.error(e)}},e)};o=e.subscribe(Lo(t,function(e){null==s||s.unsubscribe(),l++,t.next(c=e),n>0&&f(n)},void 0,void 0,function(){(null==s?void 0:s.closed)||null==s||s.unsubscribe(),c=null})),!l&&f(null!=r?"number"==typeof r?r:+r-a.now():n)})}({each:1e3*t,with:()=>{return t=oo(e=()=>new Vi)?e:function(){return e},new Oo(function(e){return e.error(t())});var e,t}}))))};ui(r).pipe(wi(r=>{const o=r.name;return n.debug(`🚀 initializing ${n.formatModuleName(r)}`),ui(Promise.resolve(r.initialize({ref:t,config:e[o],requireInstance:a,hasModule:s}))).pipe(vi(e=>{if(!(e instanceof qi||e.version instanceof zn)){n.debug("🤷 module does not extends the [BaseModuleProvider] or exposes [SemanticVersion]");try{e.version=r.version instanceof zn?r.version:new zn(r.version??"0.0.0-unknown")}catch(e){n.error("🚨 failed to set module version")}}return n.debug(`🚀 initialized ${n.formatModuleName(r)}`),[o,e]}))})).subscribe({next:([e,t])=>{i.next(Object.assign(i.value,{[e]:t}))},error:e=>{n.error("🚨 failed to initialize",e),i.error(e)},complete:()=>i.complete()});const c=await pi(i);return Object.seal(c),c}async _postInitialize(e,t){const{modules:r,logger:n,_afterInit:o}=this,i=ui(r).pipe(Li(e=>!!e.postInitialize),Mi(e=>n.debug(`🚀📌 post initializing moule ${n.formatModuleName(e)}`)),wi(r=>ui(r.postInitialize({ref:t,modules:e,instance:e[r.name]})).pipe(Mi(()=>{n.debug(`🚀📌 post initialized moule ${n.formatModuleName(r)}`)}),Ri(e=>(n.warn(`🚀📌 post initialize failed moule ${n.formatModuleName(r)}`,e),zo)))));if(await new Promise((e,t)=>{i.subscribe({complete:()=>e(!0),error:t})}),o.length)try{n.debug(`🚀📌 post configure hooks [${o.length}]`),await Promise.allSettled(o.map(t=>Promise.resolve(t(e)))),n.debug("🚀📌 post configure hooks complete")}catch(e){n.warn("🚀📌 post configure hook failed",e)}n.debug(`🎉 Modules initialized ${r.map(n.formatModuleName)}`,e),n.info("🟢 Modules initialized")}async dispose(e,t){const{modules:r}=this;await Promise.allSettled(r.filter(e=>!!e.dispose).map(async r=>{await(r.dispose?.({ref:t,modules:e,instance:e[r.name]}))}))}}class Xi{_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?ui(Object.values(this._operators)).pipe((t=(e,t)=>Promise.resolve(t(e)).then(t=>t??e),r=e,n=1,So(function(e,o){var i=r;return bi(e,o,function(e,r){return t(i,e,r)},n,function(e){i=e},!1,void 0,function(){return i=null})})),ki()):li(e);var t,r,n}}class Ki extends Xi{setHeader(e,t){const r=((e,t)=>r=>{const n=new Headers(r.headers);return n.append(e,t),{...r,headers:n}})(e,t);return this.set("header-"+e,r)}}class Wi extends Xi{}const Yi=()=>O.custom(e=>e===e?.toUpperCase(),e=>({code:O.ZodIssueCode.custom,validation:"uppercase",path:["method"],message:[`Provided HTTP method '${e}' must be in uppercase.`,"See RFC 7231 Section 4.1 for more information","https://www.rfc-editor.org/rfc/rfc7231#section-4.1"].join(" ")})),Ji=O.object({attributionReporting:O.object({eventSourceEligible:O.boolean().optional(),triggerEligible:O.boolean().optional()}).optional(),body:O.union([O.string(),O.instanceof(Blob),O.instanceof(ArrayBuffer),O.instanceof(FormData),O.instanceof(URLSearchParams),O.instanceof(ReadableStream)]).optional(),browsingTopics:O.boolean().optional(),cache:O.enum(["default","no-store","reload","no-cache","force-cache","only-if-cached"]).optional(),credentials:O.enum(["omit","same-origin","include"]).optional(),headers:O.record(O.string(),O.string()).optional().or(O.instanceof(Headers)),integrity:O.string().optional(),keepalive:O.boolean().optional(),method:Yi().pipe(O.enum(["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD","CONNECT","TRACE"],{errorMap:e=>{const{received:t,options:r}=e;return{message:["Invalid request method.",`Expected '${r.join(" | ")}', but received '${t}'.`,"See RFC 2615 Section 9 for more information","https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html"].join(" ")}}})).optional(),mode:O.enum(["same-origin","cors","no-cors","navigate","websocket"]).optional(),priority:O.enum(["low","high","auto"]).optional(),redirect:O.enum(["follow","error","manual"]).optional(),referrer:O.string().optional(),referrerPolicy:O.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:O.instanceof(AbortSignal).optional()}).extend({uri:O.string(),path:O.string().optional()}),Qi=e=>e=>{const{error:t,success:r,data:n}=Yi().safeParse(e.method);if(e.method=r?n:e.method?.toUpperCase(),t)for(const e of t.errors)console.warn(e.message);return e},es=e=>e=>{const{strict:t,parse:r}={},n=t?Ji:Ji.passthrough();try{const t=n.parse(e);return r?t:void 0}catch(e){if(r)throw e;console.error("Invalid request options",e.message)}};class ts{_clients={};get clients(){return{...this._clients}}defaultHttpClientCtor;defaultHttpRequestHandler=new Ki({"capitalize-method":Qi(),"request-validation":es()});constructor(e){this.defaultHttpClientCtor=e}hasClient(e){return Object.keys(this._clients).includes(e)}configureClient(e,t){const r="string"==typeof t?{baseUri:t}:t,n="function"==typeof r?{onCreate:r}:r;return this._clients[e]={...this._clients[e],...n},this}}class rs extends Error{}class ns{config;get defaultHttpRequestHandler(){return this.config.defaultHttpRequestHandler}constructor(e){this.config=e}hasClient(e){return Object.keys(this.config.clients).includes(e)}createClient(e){const t=this._resolveConfig(e),{baseUri:r,defaultScopes:n=[],onCreate:o,ctor:i=this.config.defaultHttpClientCtor,requestHandler:s=this.defaultHttpRequestHandler}=t,a=new i(r||"",{requestHandler:s});return Object.assign(a,{defaultScopes:n}),o?.(a),a}createCustomClient(e){return this.createClient(e)}_resolveConfig(e){if("string"==typeof e){const r=this.config.clients[e];if(!r&&(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(!r)throw new rs(`No registered http client for key [${e}]`);return r}var t;return e}}function os(e,t){void 0===t&&(t={});var r=t.selector,n=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(t,["selector"]);return new Oo(function(t){var o=new AbortController,i=o.signal,s=!0,a=n.signal;if(a)if(a.aborted)o.abort();else{var c=function(){i.aborted||o.abort()};a.addEventListener("abort",c),t.add(function(){return a.removeEventListener("abort",c)})}var u=Kn(Kn({},n),{signal:i}),l=function(e){s=!1,t.error(e)};return fetch(e,u).then(function(e){r?ri(r(e)).subscribe(Lo(t,void 0,function(){s=!1,t.complete()},l)):(s=!1,t.next(e),t.complete())}).catch(l),function(){s&&o.abort()}})}const is=async e=>{if(204===e.status)return Promise.resolve();try{const t=await e.json();if(!e.ok)throw new kt("network response was not OK",e,{data:t});return t}catch(t){if(t instanceof kt)throw t;throw new kt("failed to parse response",e,{cause:t})}},ss=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")}},as=e=>{try{return JSON.parse(e)}catch{return e}};function*cs(e,t){const r=e.split("\n\n"),n=t?.dataParser||as;for(const e of r){if(!e.trim())continue;const t=e.split("\n").reduce((e,t)=>{if(!t)return e;const r=t.indexOf(":");if(-1===r)return e;const o=t.slice(0,r).trim(),i=t.slice(r+1).trim();return"data"===o?e.data=n(i):e[o]=i,e},{});Object.keys(t).length&&(yield t)}}const us=e=>t=>{if(!t.ok)throw new Ft(`HTTP error! Status: ${t.status}`,t);if(!t.body)throw new Ft("Response body is not readable",t);if(!t.headers.get("Content-Type")?.includes("text/event-stream"))throw new Ft("Response is not a text/event-stream",t);const r=t.body.getReader();return ui(async function*(e,t){const r=!!t?.skipHeartbeats,n=t?.eventFilter?Array.isArray(t.eventFilter)?t.eventFilter:[t.eventFilter]:null,o=new TextDecoder;for(;;){const{done:i,value:s}=await e.read();if(i)break;const a=cs(o.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(r){if(!e.event&&!e.data&&!e.id)continue;if(e.event&&["heartbeat","ping"].includes(e.event))continue}(!n||e.event&&n.includes(e.event))&&(yield e)}}}(r,{dataParser:e?.dataParser,skipHeartbeats:e?.skipHeartbeats,eventFilter:e?.eventFilter})).pipe(ji(e?.abortSignal?Oi(e.abortSignal,"abort"):zo),Ui(async()=>{await r.cancel().catch(()=>{}),r.releaseLock()}))};class ls{uri;requestHandler;responseHandler;_request$=new To;_response$=new To;_abort$=new To;get request$(){return this._request$.asObservable()}get response$(){return this._response$.asObservable()}constructor(e,t){this.uri=e,this.requestHandler=new Ki(t?.requestHandler),this.responseHandler=new Wi(t?.responseHandler),this._init()}_init(){}fetch$(e,t){return this._fetch$(e,t)}fetch(e,t){return di(this.fetch$(e,t))}fetchAsync(e,t){return this.fetch(e,t)}json$(e,t){const r="object"==typeof t?.body?JSON.stringify(t?.body):t?.body,n=t?.selector??is,o=new Headers(t?.headers);return o.append("Accept","application/json"),o.append("Content-Type","application/json"),this.fetch$(e,{...t,body:r,selector:n,headers:o})}json(e,t){return di(this.json$(e,t))}blob$(e,t){const r=t?.selector??ss,n={...t,selector:r};return this.fetch$(e,n)}blob(e,t){return di(this.blob$(e,t))}sse$(e,t,r){const n=new Headers(t?.headers);n.append("Accept","text/event-stream"),n.append("Content-Type","text/event-stream"),n.append("Cache-Control","no-cache"),n.append("Connection","keep-alive");const o=us({...r,abortSignal:t?.signal});return this._fetch$(e,{selector:o,...t,headers:n})}jsonAsync(e,t){return this.json(e,t)}execute(e,t,r){return this[e](t,r)}abort(){this._abort$.next()}_fetch$(e,t){const{selector:r,...n}=t||{},o=li({...n,uri:this._resolveUrl(e)}).pipe(Bi(e=>this._prepareRequest(e)),Mi(e=>this._request$.next(e)),Bi(({uri:e,path:t,...r})=>os(e,r)),Bi(e=>this._prepareResponse(e)),Mi(e=>this._response$.next(e)),Bi(e=>{if(r)try{return r(e)}catch(t){throw new Ut("failed to execute response selector",e,{cause:t})}return li(e)}),ji(this._abort$));return o}_prepareRequest(e){return this.requestHandler.process(e)}_prepareResponse(e){return this.responseHandler.process(e)}_resolveUrl(e){const{origin:t,pathname:r}=new URL(this.uri,this.uri.startsWith("http")?void 0:window.location.origin),n=[r,e].join("/").replace(/\/{2,}/g,"/");return new URL(n,t).href}}class fs extends ls{defaultScopes=[];fetch$(e,t){const r=Object.assign(t||{},{scopes:this.defaultScopes.concat(t?.scopes||[])});return super._fetch$(e,r)}}const ps={name:"http",configure:()=>new ts(fs),initialize:async({config:e,hasModule:t,requireInstance:r})=>{const n=new ns(e);if(t("auth")){const e=await r("auth");n.defaultHttpRequestHandler.set("MSAL",async t=>{const{scopes:r=[]}=t;if(r.length){const n=await e.acquireAccessToken({scopes:r});if(n){const e=new Headers(t.headers);return e.set("Authorization",`Bearer ${n}`),{...t,headers:e}}}})}return n}},ds=(...e)=>t=>t.pipe(function(e,t){return oo(t)?wi(e,t,1):wi(e,1)}(...e)),hs=(...e)=>t=>t.pipe(wi(...e)),ms=(...e)=>t=>t.pipe(Bi(...e)),gs=e=>e.pipe(vi(e=>e.value));var vs=/^(?:[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 Es(e){if(!function(e){return"string"==typeof e&&vs.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 ys=[];for(let e=0;e<256;++e)ys.push((e+256).toString(16).slice(1));function bs(e,t=0){return(ys[e[t+0]]+ys[e[t+1]]+ys[e[t+2]]+ys[e[t+3]]+"-"+ys[e[t+4]]+ys[e[t+5]]+"-"+ys[e[t+6]]+ys[e[t+7]]+"-"+ys[e[t+8]]+ys[e[t+9]]+"-"+ys[e[t+10]]+ys[e[t+11]]+ys[e[t+12]]+ys[e[t+13]]+ys[e[t+14]]+ys[e[t+15]]).toLowerCase()}let ws;const Is=new Uint8Array(16);function _s(e,t,r,n,o,i){const s="string"==typeof r?function(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=e.charCodeAt(r);return t}(r):r,a="string"==typeof n?Es(n):n;if("string"==typeof n&&(n=Es(n)),16!==n?.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,o){i=i||0;for(let e=0;e<16;++e)o[i+e]=c[e];return o}return bs(c)}var Cs={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Os(e,t,r){if(Cs.randomUUID&&!e)return Cs.randomUUID();const n=(e=e||{}).random??e.rng?.()??function(){if(!ws){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ws=crypto.getRandomValues.bind(crypto)}return ws(Is)}();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=15&n[6]|64,n[8]=63&n[8]|128,bs(n)}function Ns(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function Ss(e,t){return e<<t|e>>>32-t}function Ls(e){const t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(e.length+1);n.set(e),n[e.length]=128;const o=(e=n).length/4+2,i=Math.ceil(o/16),s=new Array(i);for(let t=0;t<i;++t){const r=new Uint32Array(16);for(let n=0;n<16;++n)r[n]=e[64*t+4*n]<<24|e[64*t+4*n+1]<<16|e[64*t+4*n+2]<<8|e[64*t+4*n+3];s[t]=r}s[i-1][14]=8*(e.length-1)/Math.pow(2,32),s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<i;++e){const n=new Uint32Array(80);for(let t=0;t<16;++t)n[t]=s[e][t];for(let e=16;e<80;++e)n[e]=Ss(n[e-3]^n[e-8]^n[e-14]^n[e-16],1);let o=r[0],i=r[1],a=r[2],c=r[3],u=r[4];for(let e=0;e<80;++e){const r=Math.floor(e/20),s=Ss(o,5)+Ns(r,i,a,c)+u+t[r]+n[e]>>>0;u=c,c=a,a=Ss(i,30)>>>0,i=o,o=s}r[0]=r[0]+o>>>0,r[1]=r[1]+i>>>0,r[2]=r[2]+a>>>0,r[3]=r[3]+c>>>0,r[4]=r[4]+u>>>0}return Uint8Array.of(r[0]>>24,r[0]>>16,r[0]>>8,r[0],r[1]>>24,r[1]>>16,r[1]>>8,r[1],r[2]>>24,r[2]>>16,r[2]>>8,r[2],r[3]>>24,r[3]>>16,r[3]>>8,r[3],r[4]>>24,r[4]>>16,r[4]>>8,r[4])}function Rs(e,t,r,n){return _s(80,Ls,e,t,r,n)}Rs.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Rs.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";class Ds extends Error{type;request;constructor(e,t){super(t.message,{cause:t.cause}),this.type=e,this.name="QueryClientError",this.request=t.request}}function Ts(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if("production"!==process.env.NODE_ENV){var o=Ea[e],i=o?"function"==typeof o?o.apply(null,r):o:"unknown error nr: "+e;throw Error("[Immer] "+i)}throw Error("[Immer] minified error nr: "+e+(r.length?" "+r.map(function(e){return"'"+e+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function As(e){return!!e&&!!e[va]}function Ps(e){var t;return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===ya}(e)||Array.isArray(e)||!!e[ga]||!!(null===(t=e.constructor)||void 0===t?void 0:t[ga])||Fs(e)||Bs(e))}function $s(e,t,r){void 0===r&&(r=!1),0===xs(e)?(r?Object.keys:ba)(e).forEach(function(n){r&&"symbol"==typeof n||t(n,e[n],e)}):e.forEach(function(r,n){return t(n,r,e)})}function xs(e){var t=e[va];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:Fs(e)?2:Bs(e)?3:0}function Us(e,t){return 2===xs(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ks(e,t,r){var n=xs(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function Fs(e){return pa&&e instanceof Map}function Bs(e){return da&&e instanceof Set}function js(e){return e.o||e.t}function Ms(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=wa(e);delete t[va];for(var r=ba(t),n=0;n<r.length;n++){var o=r[n],i=t[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(t[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function Hs(e,t){return void 0===t&&(t=!1),zs(e)||As(e)||!Ps(e)||(xs(e)>1&&(e.set=e.add=e.clear=e.delete=Gs),Object.freeze(e),t&&$s(e,function(e,t){return Hs(t,!0)},!0)),e}function Gs(){Ts(2)}function zs(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function qs(e){var t=Ia[e];return t||Ts(18,e),t}function Vs(){return"production"===process.env.NODE_ENV||la||Ts(0),la}function Zs(e,t){t&&(qs("Patches"),e.u=[],e.s=[],e.v=t)}function Xs(e){Ks(e),e.p.forEach(Ys),e.p=null}function Ks(e){e===la&&(la=e.l)}function Ws(e){return la={p:[],l:la,h:e,m:!0,_:0}}function Ys(e){var t=e[va];0===t.i||1===t.i?t.j():t.g=!0}function Js(e,t){t._=t.p.length;var r=t.p[0],n=void 0!==e&&e!==r;return t.h.O||qs("ES5").S(t,e,n),n?(r[va].P&&(Xs(t),Ts(4)),Ps(e)&&(e=Qs(t,e),t.l||ta(t,e)),t.u&&qs("Patches").M(r[va].t,e,t.u,t.s)):e=Qs(t,r,[]),Xs(t),t.u&&t.v(t.u,t.s),e!==ma?e:void 0}function Qs(e,t,r){if(zs(t))return t;var n=t[va];if(!n)return $s(t,function(o,i){return ea(e,n,t,o,i,r)},!0),t;if(n.A!==e)return t;if(!n.P)return ta(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var o=4===n.i||5===n.i?n.o=Ms(n.k):n.o,i=o,s=!1;3===n.i&&(i=new Set(o),o.clear(),s=!0),$s(i,function(t,i){return ea(e,n,o,t,i,r,s)}),ta(e,o,!1),r&&e.u&&qs("Patches").N(n,r,e.u,e.s)}return n.o}function ea(e,t,r,n,o,i,s){if("production"!==process.env.NODE_ENV&&o===r&&Ts(5),As(o)){var a=Qs(e,o,i&&t&&3!==t.i&&!Us(t.R,n)?i.concat(n):void 0);if(ks(r,n,a),!As(a))return;e.m=!1}else s&&r.add(o);if(Ps(o)&&!zs(o)){if(!e.h.D&&e._<1)return;Qs(e,o),t&&t.A.l||ta(e,o)}}function ta(e,t,r){void 0===r&&(r=!1),!e.l&&e.h.D&&e.m&&Hs(t,r)}function ra(e,t){var r=e[va];return(r?js(r):e)[t]}function na(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function oa(e){e.P||(e.P=!0,e.l&&oa(e.l))}function ia(e){e.o||(e.o=Ms(e.t))}function sa(e,t,r){var n=Fs(t)?qs("MapSet").F(t,r):Bs(t)?qs("MapSet").T(t,r):e.O?function(e,t){var r=Array.isArray(e),n={i:r?1:0,A:t?t.A:Vs(),P:!1,I:!1,R:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=n,i=_a;r&&(o=[n],i=Ca);var s=Proxy.revocable(o,i),a=s.revoke,c=s.proxy;return n.k=c,n.j=a,c}(t,r):qs("ES5").J(t,r);return(r?r.A:Vs()).p.push(n),n}function aa(e){return As(e)||Ts(22,e),function e(t){if(!Ps(t))return t;var r,n=t[va],o=xs(t);if(n){if(!n.P&&(n.i<4||!qs("ES5").K(n)))return n.t;n.I=!0,r=ca(t,o),n.I=!1}else r=ca(t,o);return $s(r,function(t,o){n&&function(e,t){return 2===xs(e)?e.get(t):e[t]}(n.t,t)===o||ks(r,t,e(o))}),3===o?new Set(r):r}(e)}function ca(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Ms(e)}var ua,la,fa="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),pa="undefined"!=typeof Map,da="undefined"!=typeof Set,ha="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,ma=fa?Symbol.for("immer-nothing"):((ua={})["immer-nothing"]=!0,ua),ga=fa?Symbol.for("immer-draftable"):"__$immer_draftable",va=fa?Symbol.for("immer-state"):"__$immer_state",Ea={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3: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},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(e){return"Cannot apply patch, path doesn't resolve: "+e},16:'Sets cannot have "replace" patches.',17:function(e){return"Unsupported patch operation: "+e},18: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."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21: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+"'"},22:function(e){return"'current' expects a draft, got: "+e},23:function(e){return"'original' expects a draft, got: "+e},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},ya=""+Object.prototype.constructor,ba="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,wa=Object.getOwnPropertyDescriptors||function(e){var t={};return ba(e).forEach(function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)}),t},Ia={},_a={get:function(e,t){if(t===va)return e;var r=js(e);if(!Us(r,t))return function(e,t,r){var n,o=na(t,r);return o?"value"in o?o.value:null===(n=o.get)||void 0===n?void 0:n.call(e.k):void 0}(e,r,t);var n=r[t];return e.I||!Ps(n)?n:n===ra(e.t,t)?(ia(e),e.o[t]=sa(e.A.h,n,e)):n},has:function(e,t){return t in js(e)},ownKeys:function(e){return Reflect.ownKeys(js(e))},set:function(e,t,r){var n=na(js(e),t);if(null==n?void 0:n.set)return n.set.call(e.k,r),!0;if(!e.P){var o=ra(js(e),t),i=null==o?void 0:o[va];if(i&&i.t===r)return e.o[t]=r,e.R[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(r,o)&&(void 0!==r||Us(e.t,t)))return!0;ia(e),oa(e)}return e.o[t]===r&&(void 0!==r||t in e.o)||Number.isNaN(r)&&Number.isNaN(e.o[t])||(e.o[t]=r,e.R[t]=!0),!0},deleteProperty:function(e,t){return void 0!==ra(e.t,t)||t in e.t?(e.R[t]=!1,ia(e),oa(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=js(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty:function(){Ts(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){Ts(12)}},Ca={};$s(_a,function(e,t){Ca[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Ca.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&Ts(13),Ca.set.call(this,e,t,void 0)},Ca.set=function(e,t,r){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&Ts(14),_a.set.call(this,e[0],t,r,e[0])};var Oa=function(){function e(e){var t=this;this.O=ha,this.D=!0,this.produce=function(e,r,n){if("function"==typeof e&&"function"!=typeof r){var o=r;r=e;var i=t;return function(e){var t=this;void 0===e&&(e=o);for(var n=arguments.length,s=Array(n>1?n-1:0),a=1;a<n;a++)s[a-1]=arguments[a];return i.produce(e,function(e){var n;return(n=r).call.apply(n,[t,e].concat(s))})}}var s;if("function"!=typeof r&&Ts(6),void 0!==n&&"function"!=typeof n&&Ts(7),Ps(e)){var a=Ws(t),c=sa(t,e,void 0),u=!0;try{s=r(c),u=!1}finally{u?Xs(a):Ks(a)}return"undefined"!=typeof Promise&&s instanceof Promise?s.then(function(e){return Zs(a,n),Js(e,a)},function(e){throw Xs(a),e}):(Zs(a,n),Js(s,a))}if(!e||"object"!=typeof e){if(void 0===(s=r(e))&&(s=e),s===ma&&(s=void 0),t.D&&Hs(s,!0),n){var l=[],f=[];qs("Patches").M(e,s,l,f),n(l,f)}return s}Ts(21,e)},this.produceWithPatches=function(e,r){if("function"==typeof e)return function(r){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return t.produceWithPatches(r,function(t){return e.apply(void 0,[t].concat(o))})};var n,o,i=t.produce(e,r,function(e,t){n=e,o=t});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(function(e){return[e,n,o]}):[i,n,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){Ps(e)||Ts(8),As(e)&&(e=aa(e));var t=Ws(this),r=sa(this,e,void 0);return r[va].C=!0,Ks(t),r},t.finishDraft=function(e,t){var r=e&&e[va];"production"!==process.env.NODE_ENV&&(r&&r.C||Ts(9),r.I&&Ts(10));var n=r.A;return Zs(n,t),Js(void 0,n)},t.setAutoFreeze=function(e){this.D=e},t.setUseProxies=function(e){e&&!ha&&Ts(20),this.O=e},t.applyPatches=function(e,t){var r;for(r=t.length-1;r>=0;r--){var n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));var o=qs("Patches").$;return As(e)?o(e,t):this.produce(e,function(e){return o(e,t)})},e}(),Na=new Oa,Sa=Na.produce;Na.produceWithPatches.bind(Na),Na.setAutoFreeze.bind(Na),Na.setUseProxies.bind(Na),Na.applyPatches.bind(Na),Na.createDraft.bind(Na),Na.finishDraft.bind(Na);const La=(...e)=>Li(t=>e.includes(t.type));class Ra extends Oo{#o=new To;#i;get action$(){return this.#o.asObservable()}get value(){return this.#i.value}get closed(){return this.#i.closed||this.#o.closed}constructor(e,t){super(e=>this.#i.subscribe(e));const r="getInitialState"in e?e.getInitialState():t;this.#i=new Po(r),this.#o.pipe(function(e,t){return So(Di(e,t,arguments.length>=2,!0))}(e,r),Ai()).subscribe(this.#i),this.reset=()=>this.#i.next(r)}reset;next(e){this.#o.next(e)}select(e,t){return this.#i.pipe(vi(e),Ai(t))}addEffect(e,t){const r="function"==typeof e?this.action$:Array.isArray(e)?this.action$.pipe(La(...e)):this.action$.pipe(La(e)),n=t||e;return r.pipe(wi(e=>ui(new Promise((t,r)=>{try{t(n(e,this.value))}catch(e){r(e)}})).pipe(Ri(e=>(console.warn("unhandled effect",e),zo)))),Li(e=>!!e),ii(Ho)).subscribe(this.#o)}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(Ri(e=>(console.trace("unhandled exception, epic closed!",e),zo)),ii(Ho)).subscribe(this.#o)}unsubscribe(){this.#o.unsubscribe(),this.#i.unsubscribe()}complete(){this.#o.complete(),this.#i.complete()}asObservable(){return this.#i.asObservable()}}function Da(e,t){function r(...r){if(t){const n=t(...r);if(!n)throw new Error("prepareAction did not return an object");return{type:e,payload:n.payload,..."meta"in n&&{meta:n.meta},..."error"in n&&{error:n.error}}}return{type:e,payload:r[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=t=>t.type===e,r}const Ta="::";function Aa(e,t,r,n){const o=Da([e,"request"].join(Ta),t);return r&&Object.assign(o,{success:Da([e,"success"].join(Ta),r)}),n&&Object.assign(o,{failure:Da([e,"failure"].join(Ta),n)}),o}function Pa(e){return Ps(e)?Sa(e,()=>{}):e}function $a(e,t){const[r,n,o]=function(e){const t={},r=[];let n;const o={addCase(e,i){if("production"!==process.env.NODE_ENV){if(r.length>0)throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");if(n)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]=i,o},addMatcher(e,t){if("production"!==process.env.NODE_ENV&&n)throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return r.push({matcher:e,reducer:t}),o},addDefaultCase(e){if("production"!==process.env.NODE_ENV&&n)throw new Error("`builder.addDefaultCase` can only be called once");return n=e,o}};return e(o),[t,r,n]}(t);let i;if(function(e){return"function"==typeof e}(e))i=()=>Pa(e());else{const t=Pa(e);i=()=>t}function s(e,t){let s=[r[t.type],...n.filter(({matcher:e})=>e(t)).map(({reducer:e})=>e)];return o&&0===s.filter(e=>!!e).length&&(s=[o]),s.reduce((e,r)=>{if(r){if(As(e)){const n=r(e,t);return void 0===n?e:n}if(Ps(e))return Sa(e,e=>r(e,t));{const n=r(e,t);if(void 0===n){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return n}}return e},e??i())}return s.getInitialState=i,s}const xa={request:Da("client/request",(e,t)=>({payload:{args:e,options:t},meta:{transaction:Os(),created:Date.now()}})),execute:Aa("client/execute",e=>({payload:e,meta:{transaction:e,created:Date.now()}}),e=>({payload:e,meta:{transaction:e.transaction,created:Date.now()}}),(e,t)=>({payload: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()}}))},Ua=e=>e.pipe(Li(xa.request.match),vi(e=>xa.execute(e.meta.transaction))),ka=e=>{const t=Number(e);if(Object.values(Fa).includes(t))return t;if(isNaN(t))return(e=>{if("string"!=typeof e)throw new Error("Expected LogLevel key to be a string.");const t=e.toLowerCase(),r=Object.keys(Fa).find(e=>e.toLowerCase()===t);if(!r)throw new Error(`Failed to parse LogLevel from string: ${e}.`);return Fa[r]})(e);throw Error(`Invalid log level: ${e}`)};var Fa;!function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warning=2]="Warning",e[e.Info=3]="Info",e[e.Debug=4]="Debug"}(Fa||(Fa={}));const Ba=(()=>{const e=process.env.FUSION_LOG_LEVEL;if(e)try{return ka(e)}catch(e){return"development"===process.env.NODE_ENV?Fa.Debug:Fa.Error}return Fa.Error})();class ja{level=Ba;version="1.1.6";_log$=new To;get log(){return this._log$.pipe(Li(e=>this.level>=e.lvl))}debug(...e){this._log$.next({lvl:Fa.Debug,msg:this._createMessage(Fa.Debug,...e)})}info(...e){this._log$.next({lvl:Fa.Info,msg:this._createMessage(Fa.Info,...e)})}warn(...e){this._log$.next({lvl:Fa.Warning,msg:this._createMessage(Fa.Warning,...e)})}error(...e){this._log$.next({lvl:Fa.Error,msg:this._createMessage(Fa.Error,...e)})}}class Ma extends ja{title;subtitle;constructor(e,t){super(),this.title=e,this.subtitle=t,this.log.subscribe(({lvl:e,msg:t})=>{switch(e){case Fa.Debug:console.debug(...t);break;case Fa.Info:console.info(...t);break;case Fa.Warning:console.warn(...t);break;case Fa.Error:console.error(...t)}})}_createMessage(e,...t){return[this._formatTitle(e),...t]}_formatTitle(e){const t=ie.magenta([this.title,this.subtitle].filter(e=>!!e).join(" - "));switch(e){case Fa.Warning:case Fa.Error:return ie.bold(t)}return t}createSubLogger(e,t,r){const n=new Ma(`${this.title}::${e}`,t??this.subtitle);return n.level=void 0===r?this.level:r,n}}class Ha extends Oo{#s=new Po("idle");get status(){return this.#s.value}get status$(){return this.#s.asObservable()}#a;#c;get transaction(){return this.#c}created=Date.now();get closed(){return"complete"===this.status||"error"===this.status||"canceled"===this.status}constructor(e,t,r){super(t=>{const{transaction:n}=this,o=e.action$.pipe(Li(e=>e.meta.transaction===n));t.add(e.state$.pipe(Li(e=>!!e[n]),vi(e=>e[n])).subscribe(e=>{this.#s.next(e.status)})),t.add(o.pipe(Li(xa.execute.success.match),vi(({payload:e})=>e)).subscribe(e=>{this.#s.next("complete"),t.next(e),t.complete()})),t.add(o.pipe(Li(xa.error.match),vi(({payload:e})=>e)).subscribe(e=>{this.#s.next("error"),t.error(e.error)})),t.add(o.pipe(Li(xa.cancel.match)).subscribe(e=>{this.#s.next("canceled"),t.error(new Ds("abort",{message:e.payload.reason||`job: ${n} was canceled`,request:this.#a.getRequest(e.meta.transaction)}))})),r?.signal&&t.add(Oi(r?.signal,"abort").pipe(vi(()=>xa.cancel(n,`job: ${n} was aborted on signal from caller: ${r?.ref}`))).subscribe(t=>e.next(t))),t.add(()=>{this.complete()})}),this.#a=e;const n=xa.request(t,{ref:r?.ref,retry:r?.retry});this.#c=n.meta.transaction,this.#a.next(n)}complete(e){this.closed||this.cancel(e??`job: ${this.transaction} was completed`)}cancel(e){const t=this.transaction;this.#a.cancel(t,e??`job: ${t} was canceled`)}[Symbol.dispose](){this.complete()}}class Ga extends Oo{#i;#u;#l;get closed(){return this.#i.closed}get state$(){return this.#i.asObservable()}get action$(){return this.#i.action$}get success$(){return this.action$.pipe(Li(xa.execute.success.match),vi(({payload:e})=>e))}get error$(){return this.action$.pipe(La("client/error"),Hi(this.#i),vi(([e,t])=>{const{payload:r,meta:{transaction:n}}=e,o=t[n];return new Ds("error",{request:o,message:`job: ${n} failed`,cause:r})}))}constructor(e,t){super(e=>this.#i.subscribe(e)),this.#i=new Ra(((e={})=>$a(e,e=>{e.addCase(xa.request,(e,t)=>{e[t.meta.transaction]={...t.payload,...t.meta,execution:[],errors:[],status:"idle"}}),e.addCase(xa.execute,(e,t)=>{const r=e[t.payload];r&&(r.execution.push(Date.now()),r.status="active")}),e.addCase(xa.execute.success,(e,t)=>{delete e[t.payload.transaction]}),e.addCase(xa.execute.failure,(e,t)=>{const r=e[t.meta.transaction];r&&(r.errors.push(t.payload),r.status="failed")}),e.addCase(xa.error,(e,t)=>{delete e[t.meta.transaction]}),e.addCase(xa.cancel,(e,t)=>{delete e[t.meta.transaction]})}))({})),this.#u=new co(()=>this.#i.complete()),this.#u.add(this.#i.addFlow(Ua)),this.#u.add(this.#i.addFlow((e=>(t,r)=>t.pipe(Li(xa.execute.match),Hi(r),wi(([r,n])=>{const o=r.payload,i=n[o],s=new AbortController,a=t.pipe(Li(xa.cancel.match),Li(e=>e.payload.transaction===o),Mi(()=>{s.signal.aborted||s.abort()}));try{return ui(e(i.args,s.signal)).pipe(vi(e=>xa.execute.success({...i,status:"complete",completed:Date.now(),value:e})),Ri(e=>li(xa.execute.failure(e,o))),ji(a))}catch(e){return li(xa.execute.failure(e,o))}})))(e))),this.#u.add(this.#i.addFlow((e=>(t,r)=>t.pipe(Li(xa.execute.failure.match),Hi(r),wi(([t,n])=>{const{transaction:o}=t.meta,i=n[o];if(!i)return li(xa.error(o,new Ds("error",{message:"request not found, cannot retry request, most likely removed while scheduled for retry!"})));const s=i.execution.length,a=Object.assign({},e,i.options?.retry),c=i.errors?.slice(-1)[0]??new Ds("error",{message:"no errors registered for request!",request:i});if(s>a.count){const e=0===a.count?c:new Ds("error",{message:"maximum retries executed!",cause:i.errors,request:i});return li(xa.error(o,e))}return("function"==typeof a.delay?ui(a.delay(c)).pipe(Ri(e=>li(xa.error(o,new Ds("error",{message:"retry delay callback failed!",cause:[...i.errors??[],e],request:i}))))):Si(a.delay)).pipe(Hi(r),Li(([e,t])=>!!t[o]),Mi(([,e])=>{if(!e[o])throw new Ds("error",{message:"request not found, most likely removed while scheduled for retry",cause:i.errors,request:i})}),vi(()=>xa.execute(o)))})))(Object.assign({count:0,delay:0},t?.retry)))),this.#l=t?.logger??new Ma("QueryClient"),this.#i.addEffect(xa.request.type,({payload:e,meta:{transaction:t}})=>{this.#l.debug("Job requested",{transaction:t,payload:e})}),this.#i.addEffect(xa.execute.type,({payload:e,meta:{transaction:t}})=>{this.#l.debug("Job executing",{transaction:t,payload:e})}),this.#i.addEffect(xa.execute.success.type,({payload:e})=>{this.#l.info("Job complete",{...e})}),this.#i.addEffect(xa.execute.failure.type,({payload:e,meta:{transaction:t}})=>{this.#l.debug("Job failed",{transaction:t,payload:e})}),this.#i.addEffect(xa.cancel.type,({payload:{reason:e},meta:{transaction:t}})=>{this.#l.debug("Job canceled",{transaction:t,reason:e})}),this.#i.addEffect(xa.error.type,({payload:{transaction:e,error:t}})=>{this.#l.error("Job error",{transaction:e,error:t})})}next(e){this.#i.next(e)}query(e,t){const r=new Ha(this,e,t),n=r.pipe(function(e){void 0===e&&(e={});var t=e.connector,r=void 0===t?function(){return new To}:t,n=e.resetOnError,o=void 0===n||n,i=e.resetOnComplete,s=void 0===i||i,a=e.resetOnRefCountZero,c=void 0===a||a;return function(e){var t,n,i,a=0,u=!1,l=!1,f=function(){null==n||n.unsubscribe(),n=void 0},p=function(){f(),t=i=void 0,u=l=!1},d=function(){var e=t;p(),null==e||e.unsubscribe()};return So(function(e,h){a++,l||u||f();var m=i=null!=i?i:r();h.add(function(){0!==--a||l||u||(n=Fi(d,c))}),m.subscribe(h),!t&&a>0&&(t=new bo({next:function(e){return m.next(e)},error:function(e){l=!0,f(),n=Fi(p,o,e),m.error(e)},complete:function(){u=!0,f(),n=Fi(p,s),m.complete()}}),ri(e).subscribe(t))})(e)}}({connector:()=>new xo,resetOnRefCountZero:!1}));return Object.defineProperties(n,{transaction:{get:()=>r.transaction},created:{get:()=>r.created},status:{get:()=>r.status},closed:{get:()=>r.closed},cancel:{value:e=>r.cancel(e)},complete:{value:()=>r.complete()}}),n}async nextAsync(e,t){return di(this.query(e,t))}getRequest(e){return this.#i.value[e]}getRequestByRef(e){return Object.values(this.#i.value).find(t=>t.ref===e)}cancelTaskByRef(e,t){const r=this.getRequestByRef(e);r?.ref&&this.cancel(r.transaction,t)}cancel(e,t){if(e)this.#i.value[e]?(t??=`cancelation requested for job: ${e}`,this.#i.next(xa.cancel(e,t))):this.#l.warn("Task not registered, nothing to cancel",{transaction:e,reason:t});else for(const e of Object.keys(this.#i.value))this.cancel(e,"all transactions requested canceled")}on(e,t){return this.#i.addEffect(xa[e].type,e=>{t(e,this)})}complete(){this.#u.unsubscribe()}}const za={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,r)=>({payload:{...t,key:e},meta:{item:r}})),trim:Da("cache/trim",e=>({payload:e}))},qa=(e,t)=>(t.updated??0)-(e.updated??0);class Va{#i;get state(){return this.#i.value}get state$(){return this.#i.asObservable()}get action$(){return this.#i.action$}constructor(e){const{trimming:t,initial:r}=e??{};this.#i=new Ra(function(e,t={}){return $a(t,t=>t.addCase(e.set,(e,t)=>{const{key:r,record:n}=t.payload;e[r]=n}).addCase(e.insert,(e,t)=>{const{key:r,entry:n}=t.payload,o=e[r];if(o)o.updated=Date.now(),o.updates??=0,o.updates++,o.value=n.value,o.transaction=n.transaction,o.mutated=void 0;else{const t=Date.now();e[r]={...n,created:t,updated:t}}}).addCase(e.remove,(e,t)=>{delete e[t.payload]}).addCase(e.invalidate,(e,t)=>{const r=t.payload?[t.payload]:Object.keys(e);for(const t of r){const r=e[t];r&&(r.updated=void 0)}}).addCase(e.mutate,(e,t)=>{const{key:r,value:n,updated:o}=t.payload,i=e[r];i&&(i.value=n,i.updated=o,i.mutated=Date.now(),i.updates??=0,i.updates++)}).addCase(e.trim,(e,t)=>{const{payload:r}=t,n=r.sort??qa,o=Object.keys(e),i=Object.entries(e).filter(([e,t])=>!r.validate||r.validate(t)).sort((e,t)=>n(e[1],t[1])).slice(0,r.size??Number.MAX_SAFE_INTEGER).map(([e])=>e);if(o.length!==i.length)for(const t of o){const r=i.indexOf(t);-1!==r?i.splice(r,1):delete e[t]}}))}(za,r)),t&&this.#i.addEffect("cache/set",()=>this.#i.next(za.trim(t)))}has(e){return e in this.#i.value}setItem(e,t){const{args:r,transaction:n,value:o}=t;this.#i.next(za.insert(e,{args:r,transaction:n,value:o}))}getItem(e){return this.#i.value[e]}removeItem(e){this.#i.next(za.remove(e))}invalidate(e){const t=e?this.#i.value[e]:void 0;this.#i.next(za.invalidate(e,t))}mutate(e,t){const r=e in this.#i.value?this.#i.value[e]:void 0;if(!r)throw new Error(`Cannot mutate cache item with key ${e}: item not found`);const n="function"==typeof t?t(r?.value):t;return this.#i.next(za.mutate(e,n,r)),()=>this.#i.next(za.set(e,r))}trim(e){this.#i.next(za.trim(e))}reset(){this.#i.reset()}complete(){this.#i.complete()}}class Za extends To{key;args;options;#f=Date.now();get created(){return this.#f}#p=Os();get uuid(){return this.#p}constructor(e,t,r){super(),this.key=e,this.args=t,this.options=r}processJob(e,t){return e.pipe(vi(t=>{const{key:r,uuid:n,created:o}=this;return{key:r,uuid:n,created:o,status:"complete",transaction:e.transaction,complete:t.completed,value:t.value}}),Ui(()=>{t?.debug("QueryTask complete",{uuid:this.uuid,key:this.key,job:{status:e.status,transaction:e.transaction}}),e.complete()})).subscribe(this)}}class Xa{static extractQueryValue=gs;#u=new co;#a;#d;#h=new To;#m={};#g;#v;#E=Os();#l;get client(){return this.#a}get cache(){return this.#d}constructor(e){this.#l=e.logger??new Ma("Query",this.#E),this.#g=t=>Rs(e.key(t),this.#E),this.#v=e?.validate??((e=0)=>t=>(t.updated??0)+e>Date.now())(e?.expire),e.client instanceof Ga?this.#a=e.client:(this.#a=new Ga(e.client.fn,{logger:this.#l.createSubLogger("Client"),...e.client.options}),this.#u.add(()=>this.#a.complete())),e.cache instanceof Va?this.#d=e.cache:(this.#d=new Va(e.cache||{}),this.#u.add(()=>this.#d.complete()));const t=((e="switch")=>"function"==typeof e?e:(()=>{switch(e){case"concat":return ds;case"merge":return hs;case"switch":return ms;default:throw new Error(`Invalid queue operator: ${e}`)}})())(e.queueOperator);var r,n;this.#u.add(()=>this.#h.complete()),this.#u.add(this.#h.pipe(Mi(e=>this.#l.debug("Task added to queue",{key:e})),Li(e=>!!(e in this.#m)),t(e=>{const t=this.#m[e],{args:r,options:n,uuid:o}=t;if(this.#l.debug("Task selected from queue",{key:e,task:t.uuid,args:r,options:n}),!t?.observed)return this.#l.debug("Task skipped",{task:o}),delete this.#m[e],zo;const i=this.#a.query(r,{...n,ref:t.uuid});return new Oo(r=>{const{transaction:n}=i;var s,a;this.#l.info("Task stated",{task:o,transaction:n}),r.add(()=>{this.#l.debug("Task closed",{task:o,transaction:n,jobStatus:i.status}),i.complete("task closed"),delete this.#m[e]}),r.add((s=10,void 0===a&&(a=Ho),Si(s,s,a)).pipe(Li(()=>!t.observed)).subscribe(()=>{i.cancel(`task: ${t.uuid} is not observed`),r.complete()})),r.add(t.processJob(i,this.#l)),i.pipe(vi(e=>({result:e,task:t})),Ri(()=>zo)).subscribe(r)})}),(r=()=>!this.#a.closed,void 0===n&&(n=!1),So(function(e,t){var o=0;e.subscribe(Lo(t,function(e){var i=r(e,o++);(i||n)&&t.next(e),!i&&t.complete()}))}))).subscribe(e=>{const{value:t,transaction:r}=e.result,{args:n,key:o,uuid:i}=e.task;this.#l.debug("Task output added to cache",{uuid:i,args:n,key:o,transaction:r,value:t}),this.#d.setItem(o,{value:t,args:n,transaction:r})}))}query(e,t){return this._query(e,t)}queryAsync(e,t){const{skipResolve:r,...n}=t||{},o=r?di:pi;return new Promise((r,i)=>{t?.signal&&t.signal.addEventListener("abort",()=>i(new Error("Query aborted"))),o(this._query(e,n).pipe($i())).then(r,i)})}persistentQuery(e,t){const r=this.#g(e),n=this._query(e,t);return new Oo(o=>{o.add(n.subscribe({next:o.next.bind(o),error:o.error.bind(o)}));const i=t?.cache?.validate||this.#v;o.add(this.cache.state$.pipe(Li(e=>r in e),vi(t=>({...t[r],key:r,status:"cache",hasValidCache:i(t[r],e)}))).subscribe(o))}).pipe(Ai((e,t)=>e.transaction===t.transaction&&e.mutated===t.mutated))}generateCacheKey(e){return this.#g(e)}mutate(e,t,r){const n=this.#g(e);if(n in this.cache.state==!1){if(void 0===r?.allowCreation)throw new Error(`Cannot mutate cache item with key ${n}: item not found and option "allowCreation" is false`);if(!1===r.allowCreation)return()=>{};const{value:o}="function"==typeof t?t():t;this.cache.setItem(n,{args:e,transaction:Os(),value:o})}return this.#d.mutate(n,t)}invalidate(e){this.#d.invalidate(e&&this.#g(e))}complete(){this.#u.unsubscribe()}onInvalidate(e){const t=this.#d.action$.pipe(La("cache/invalidate")).subscribe(t=>e({detail:{item:t.meta.item}}));return()=>t.unsubscribe()}onMutate(e){const t=this.#d.action$.pipe(La("cache/mutate")).subscribe(t=>e({detail:{changes:t.payload,current:t.meta.item}}));return()=>t.unsubscribe()}_query(e,t){const r=this.#g(e),n=this._createTask(r,e,t);return this.#l.debug("New query created",{key:r,args:e,options:t}),n}_createTask(e,t,r){return new Oo(n=>{if(r?.signal){if(r?.signal.aborted)return this.#l.debug("Abort signal already triggered by caller",{key:e}),n.complete();n.add(Oi(r?.signal,"abort").subscribe(()=>{this.#l.debug("Abort signal triggered by caller",{key:e}),n.complete()}))}const o=this.#d.getItem(e);if(o){this.#l.debug("Query has cache",{key:e,cacheEntry:o});const i=r?.cache?.suppressInvalid??!1,s=(r?.cache?.validate||this.#v)(o,t),a={...o,key:e,status:"cache",hasValidCache:s};if(this.#l.info("Query cache valid, completing",{hasValidCache:s,suppressInvalid:i,record:a}),n.next(a),s||i)return n.complete();this.#l.debug("Query cache entry is invalid, proceeding to fetch new data",{key:e})}const i=e in this.#m;this.#m[e]??=new Za(e,t,r);const s=this.#m[e];n.add(s.subscribe(n)),this.#l.info(i?"Query connected to existing task":"Query started new task",{key:e}),i||this.#h.next(e)})}}const Ka=C.object({key:C.string().describe("The key used to identify the service"),uri:C.string().describe("The URI of the service"),id:C.string().optional().describe("The ID of the service"),environment:C.string().optional().describe("The environment of the service"),name:C.string().optional().describe("The name of the service"),scopes:C.array(C.string()).optional().default([]).describe("Endpoint authentication scopes"),tags:C.array(C.string()).optional().describe("Tags for the service")}).describe("A service from the service discovery API").transform(e=>({...e,get defaultScopes(){return e.scopes??[]}})),Wa=C.array(Ka).describe("A list of services from the service discovery API"),Ya=e=>ui(is(e)).pipe(vi(e=>Wa.default([]).parse(e)));class Ja{#y;endpoint;http;constructor({http:e,endpoint:t}){this.http=e,this.endpoint=t,this.#y=new Xa({client:{fn:()=>e.fetch$(t??"",{selector:Ya})},key:()=>"services",expire:3e5})}resolveServices(e){return(e?di:pi)(Xa.extractQueryValue(this.#y.query()))}async resolveService(e,t){const r=(await this.resolveServices(t)).find(t=>t.key===e);if(!r)throw Error(`Failed to resolve service, invalid key [${e}]`);return r}}class Qa extends zi{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(ui(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:r,endpoint:n}=await pi(ui(e(t)))??{};if(r)return new Ja({http:r,endpoint:n});throw Error("httpClient is required")})}configureServiceDiscoveryClientByClientKey(e,t){this.configureServiceDiscoveryClient(async({requireInstance:r})=>({httpClient:(await r("http")).createClient(e),endpoint:t}))}}class ec{config;_http;constructor(e,t){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 r=await this.resolveService(e);if(!r)throw Error(`Could not load configuration of service [${e}]`);return this._http.createClient({...t,baseUri:r.uri,defaultScopes:r.scopes})}async configureClient(e,t){const{key:r,alias:n}="string"==typeof e?{key:e,alias:e}:e,{uri:o,scopes:i}=await this.resolveService(r);var s,a;t.addConfig((s=n,a={baseUri:o,defaultScopes:i},{module:ps,configure:e=>{e.configureClient(s,a)}}))}}const tc={name:"serviceDiscovery",configure:()=>new Qa,initialize:async e=>{const{requireInstance:t,ref:r}=e,n=await e.config.createConfigAsync(e,{...r?.serviceDiscovery?.config}),o=await t("http");return new ec(n,o)}},rc=(e,t)=>{e.addConfig((e=>({module:tc,configure:t=>e(t)}))(()=>Promise.resolve()))};var nc,oc,ic,sc={},ac=[{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 cc(){return nc||(nc=1,function(e){const t=ac,r=process.env;function n(e){return"string"==typeof e?!!r[e]:"env"in e?r[e.env]&&r[e.env].includes(e.includes):"any"in e?e.any.some(function(e){return!!r[e]}):Object.keys(e).every(function(t){return r[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 o=(Array.isArray(t.env)?t.env:[t.env]).every(function(e){return n(e)});e[t.constant]=o,o&&(e.name=t.name,e.isPR=function(e){switch(typeof e.pr){case"string":return!!r[e.pr];case"object":return"env"in e.pr?"any"in e.pr?e.pr.any.some(function(t){return r[e.pr.env]===t}):e.pr.env in r&&r[e.pr.env]!==e.pr.ne:"any"in e.pr?e.pr.any.some(function(e){return!!r[e]}):n(e.pr);default:return null}}(t),e.id=t.constant)}),e.isCI=!("false"===r.CI||!(r.BUILD_ID||r.BUILD_NUMBER||r.CI||r.CI_APP_ID||r.CI_BUILD_ID||r.CI_BUILD_NUMBER||r.CI_NAME||r.CONTINUOUS_INTEGRATION||r.RUN_ID||e.name))}(sc)),sc}var uc=Pe(ic?oc:(ic=1,oc=cc().isCI));const lc=["5a842df8-3238-415d-b168-9f16a6a6031b/.default"];var fc;!function(e){e.ContinuesIntegration="ci",e.QualityAssurance="fqa",e.Training="tr",e.Production="fprd",e.Development="dev"}(fc||(fc={}));const pc=e=>e&&!uc?fc.Development:fc.ContinuesIntegration,dc=async e=>{const t=new Zi,r=e.env??fc.ContinuesIntegration;t.addConfig({module:ps,configure:t=>{const n=r===fc.Development?fc.ContinuesIntegration:r,o=e.serviceDiscovery?.url??new URL(`/service-registry/environments/${n}/services`,"https://discovery.fusion.equinor.com").toString(),i=e.serviceDiscovery?.scope??lc;t.configureClient("service_discovery",{baseUri:o,defaultScopes:i})}}),rc(t),P(t,t=>{const{auth:r}=e;if("token"in r&&r.token){const{token:e}=r;return t.setMode("token_only"),void t.setAccessToken(e)}const{clientId:n,tenantId:o,interactive:i}=r;if(!n||!o)throw new Error("clientId and tenantId are required for auth module");if(t.setClientConfig(o,n),t.setMode(i?"interactive":"silent"),i){const{server:e}=r;if(!e.port)throw new Error("server.port is required for interactive mode");t.setServerPort(e.port),t.setServerOnOpen(e.onOpen)}});return await t.initialize()},hc=async e=>{const{log:t}=e,{config:r}=await xt({log:t,config:e.config,env:{environment:e.environment}}),{manifest:n}=await Te({log:t,manifest:e.manifest,env:{environment:e.environment}}),o=n.build?.version;if(!o){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 i=await dc({env:e.environment,auth:e.auth});t?.succeed("Initialized Fusion Framework");const s=await i.serviceDiscovery.createClient("apps");s.request$.subscribe(e=>{t?.debug("Request:",e),t?.info("🌎","Executing request to:",Se(e.uri))}),t?.start("Publishing application config"),t?.info("Using environment:",ie.redBright(e.environment));try{const e=await s.json(`/apps/${n.appKey}/builds/${o}/config`,{method:"PUT",body:r});t?.debug("Response:",e),t?.succeed("Published application config")}catch(e){if(e instanceof kt)switch(e.response.status){case 410:t?.fail("🤬",`App ${n.appKey} is deleted from apps-service. Please check the app key and try again.`);break;case 404:t?.fail("🤬",`App ${n.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}},mc=async e=>{const{log:r}=e??{},n="@equinor/fusion-framework-dev-portal",i=await De(r),s={root:i.root,environment:"local",...e?.env,mode:"development",command:"serve"},a=await Re(s,i,{log:r,manifestPath:e?.manifest}),c=await $t(s,{log:r,config:e?.config});let l,f;const p=$(import.meta.resolve(n));se(p)?(l=p,f=await u({cwd:p}).then(e=>e?o(e?.path):void 0)):r?.info(`Portal ${n} is external, skipping entry point resolution`);const d=f?[i.root,f]:[i.root];r?.debug(`File system access allowed for: \n${d.join("\n")}\n`);const h=t(await le(s,i),{server:{port:e?.port||3e3,host:"localhost",fs:{allow:d}}}),m={template:{portal:{id:n}},app:{manifest:a,config:c}};l&&(m.portal={manifest:{name:n,build:{templateEntry:l,assetPath:"/@fs"}},config:{}}),r?.debug("vite config:",h),r?.debug("dev server config:",m),r?.start("Starting app development server...");const g=await Rt(s,m,h);await g.listen(),r?.succeed("App development server started successfully");const v=g.config.server.https?"https":"http",E=g.config.server.host||"localhost",y=g.config.server.port||5173;return r?.info(`App development server is running at: ${v}://${E}:${y}/apps/${a.appKey}`),g},gc=async e=>{const{log:t}=e,r=await De(t),n=await Re({command:"build",mode:"production"},r,{log:t});t?.start("Initializing Fusion Framework...");const o=await dc({env:e.environment,auth:"token"in e.auth?{token:e.auth.token}:e.auth});t?.succeed("Initialized Fusion Framework");const i=await o.serviceDiscovery.createClient("apps");i.request$.subscribe(e=>{t?.info("🌎","Executing request to:",e.uri),t?.debug("Request:",e)});try{t?.start(`Checking if ${n.appKey} is registered in app store`);const e=await i.fetch(`/apps/${n.appKey}`,{method:"HEAD"});if(e.ok)return t?.succeed("😃",`Application ${n.appKey} is registered in app store`);if(404===e.status)return t?.fail("😞",`Application ${n.appKey} is not registered in app store`);throw new Error(`Unexpected response status: ${e.status}`)}catch(e){t?.fail("🙅‍♂️","Error checking application registration"),t?.error("Error checking application registration:",e)}},vc=e=>{const t=e.getEntry("metadata.json");if(!t)throw new Error("Metadata file not found in bundle");return new Promise((e,r)=>{t.getDataAsync((t,n)=>{if(n)return r(new Error("Failed to read metadata file",{cause:n}));try{return e(JSON.parse(String(t)))}catch(e){r(new Error("Failed to parse metadata file",{cause:e}))}})})};const Ec=async e=>{const{log:t,framework:r}=e,n="string"==typeof e.fileOrBundle?new It(e.fileOrBundle):e.fileOrBundle,{name:o}=e.appKey?{name:e.appKey}:await vc(n).catch(e=>{t?.error("Failed to resolve manifest:",e),process.exit(1)});t?.info("📦",`Uploading application bundle for ${ie.bold(o)}`),t?.debug("Bundle contents:",(await n.getEntries()).map(e=>e.entryName));const i=await n.toBufferPromise().catch(e=>{t?.error("Failed to read bundle content:",e),process.exit(1)});try{const e=await r.serviceDiscovery.createClient("apps");e.request$.subscribe(e=>{t?.info("🌎","Executing request to:",e.uri),t?.debug("Request:",e)});const n=await e.fetch(`/bundles/apps/${o}`,{method:"POST",body:new Blob([i],{type:"application/zip"}),headers:{"Content-Type":"application/zip"}});if(!n.ok){try{const{error:e}=await n.json();t?.debug("Error:",e),e.message&&t?.warn(ie.red(`🤯 error: ${e.code}\n`),ie.yellowBright(e.message),"\n")}catch(e){t?.debug("Error:",n.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}`)}}(n,o)}t?.succeed("Successfully uploaded application bundle"),t?.debug("Response:",n);try{return{name:o,version:(await n.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 yc;!function(e){e.Latest="latest",e.Preview="preview"}(yc||(yc={}));const bc=async e=>{const{tag:t,appKey:r,version:n,framework:o,log:i}=e;["latest","preview"].includes(t)||(i?.fail("🤪",'Invalid tag. Use "latest" or "preview".'),process.exit(1)),r||(i?.fail("🤪","Application key is required."),process.exit(1)),n||(i?.fail("🤪","Version is required."),process.exit(1));const s=await o.serviceDiscovery.createClient("apps");s.request$.subscribe(e=>{i?.debug("Request:",e),i?.info("🌎","Executing request to:",Se(e.uri))}),i?.start("Publishing application config");try{const e=await s.json(`/apps/${r}/tags/${t}`,{method:"PUT",body:{version:n}});return i?.debug("Response:",e),i?.succeed("Tagged application successfully",ie.greenBright(`${r}@${n} - ${t}`)),e}catch(e){if(e instanceof kt)switch(e.response.status){case 410:i?.fail("🤬",`App ${r} is deleted from apps-service. Please check the app key and try again.`);break;case 404:i?.fail("🤬",`App ${r} not found. Please check the app key and try again.`);break;case 403:case 401:i?.fail("🤬","You are not authorized to tag application. Please check your permissions.");break;default:i?.fail("🤬","Failed to tag application",`Status code: ${e.response.status}`,`Error: ${e.message}`)}throw e}},wc=O.object({templateEntry:O.string({required_error:"templateEntry is required in build section",invalid_type_error:"templateEntry must be a string"}).describe("Main entry point for the portal"),schemaEntry:O.string({required_error:"schemaEntry is required in build section",invalid_type_error:"schemaEntry must be a string"}).describe("Schema file for portal validation"),assetPath:O.string({invalid_type_error:"assetPath must be a string"}).optional().describe("Asset path for dev/preview builds"),githubRepo:O.string({invalid_type_error:"githubRepo must be a string"}).optional().describe("GitHub repo URL or local git remote"),version:O.string({required_error:"version is required in build section",invalid_type_error:"version must be a string"}).describe("Version from package.json"),timestamp:O.string({required_error:"timestamp is required in build section",invalid_type_error:"timestamp must be a string"}).describe("Current build timestamp (ISO8601)"),commitSha:O.string({required_error:"commitSha is required in build section",invalid_type_error:"commitSha must be a string"}).describe("Current git commit SHA"),annotations:O.record(O.string(),{invalid_type_error:"annotations must be a record of string values"}).optional().describe("Optional build annotations"),projectPage:O.string({invalid_type_error:"projectPage must be a string"}).optional().describe("Optional project homepage"),allowedExtensions:O.array(O.string({invalid_type_error:"Each allowed extension must be a string"}),{required_error:"allowedExtensions is required in build section",invalid_type_error:"allowedExtensions must be an array of strings"}).describe("List of allowed asset extensions (with leading dot)"),schema:O.record(O.unknown(),{invalid_type_error:"schema must be a record of unknown values"}).optional().describe("Optional schema for the portal"),config:O.record(O.unknown(),{invalid_type_error:"config must be a record of unknown values"}).optional().describe("Optional configuration for the portal")}),Ic=O.object({name:O.string({required_error:"name is required in portal manifest",invalid_type_error:"name must be a string"}).describe("Short app key (unscoped, derived from package name)"),displayName:O.string({invalid_type_error:"displayName must be a string"}).optional().describe("Full package name, may include scope"),description:O.string({invalid_type_error:"description must be a string"}).optional().describe("Description of the portal"),build:wc}),_c=(e,t)=>{fe(t,"expected packageJson"),I(t.name,"expected [name] in packageJson"),I(t.version,"expected [version] in packageJson");const r=((e,t)=>"build"===e.command||e.isPreview?t.main||t.module||"dist/bundle.js":ce(e.root))(e,t),n=t.name.replace(/^@|\w.*\//gm,""),o=t.version,i="build"===e.command?void 0:"/@fs",s=pe(t)??de(),a={name:n,displayName:t.name,description:t.description||"",build:{templateEntry:r,schemaEntry:"portal.schema.json",assetPath:i,githubRepo:s,version:o,timestamp:(new Date).toISOString(),commitSha:he(),annotations:{...me()},projectPage:t.homepage,allowedExtensions:ge.map(e=>`.${e}`)}},c=Ic.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},Cc=async(e,t,r)=>{const n=_c(e,t.packageJson);try{r?.log?.start("loading manifest...");const t=await(async(e,t)=>{const r=t?.file??[`portal.manifest.${e.environment}`,"portal.manifest"],n=await y(r,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async r=>{const n=t?.base??{};let o;return o="function"==typeof r.default?await r.default(e,{base:n})??void 0:r.default,o?w(n,o):n}}}),o=n.config,i=Ic.safeParse(o);if(!i.success)throw new Error(`Invalid portal manifest: ${i.error.errors.map(e=>`${e.path.join(".")}: ${e.message}`).join("; ")}`);return{manifest:o,path:n.path,extension:n.extension}})(e,{base:n});return r?.log?.succeed("generated manifest from",Se(t.path,{relative:!0})),t.manifest}catch(e){if(e instanceof b){if(r?.manifestPath){const t=new Error(`Failed to load manifest file ${Se(r.manifestPath)}, please check the path.`,{cause:e});throw r?.log?.fail(t.message),t}return r?.log?.succeed(ie.dim("no local manifest config applied, using default generated from package")),n}throw r?.log?.fail(`failed to resolve application manifest ${r?.manifestPath?Se(r?.manifestPath):""}`),e}},Oc=async(e,t)=>{const{log:r}=t;try{r?.start("create portal configuration"),r?.info(`generating config with ${ie.red.dim(e.command)} command in ${ie.green.dim(e.mode)} mode`);const n=await((e,t)=>{const r=t?.file??[`portal.config.${e.environment}`,"portal.config"];return y(r,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async r=>{const n=t?.schema??C.object({}).passthrough(),o=t?.base??{};if("function"==typeof r.default){const t=await r.default(o,e)??o;return n.parse(t)}return n.parse(r.default??o)}}})})(e,{file:t?.config});return r?.succeed("⚙️ generated config from ",Se(n.path,{relative:!0})),n.config}catch(e){if(e instanceof b){if(!t.config)return r?.succeed(ie.dim("⚙️ no local portal config applied, using built-in")),{};r?.warn(`failed to load config file ${Se(t.config)}, please check the path.`)}throw r?.fail("failed to resolve portal config"),r?.debug(e),e}},Nc=async e=>{const{log:r}=e??{},n=await De(r),o={root:n.root,environment:"local",...e?.env,mode:"development",command:"serve"},i=await Cc(o,n,{log:r,manifestPath:e?.manifest}),s=await Oc(o,{log:r,config:e?.config}),a=t(await le(o,n),{server:{port:e?.server?.port,fs:{allow:[n.root]}}}),c={template:{portal:{id:i.name}},portal:{manifest:i,config:s}};r?.debug("vite config:",a),r?.debug("dev server config:",c),r?.start("Starting app development server...");const u=await Rt(o,c,a);return await u.listen(),r?.succeed(`Started app development server on ${u.resolvedUrls?.local?.[0]}`),u},Sc=async e=>{const{log:t}=e??{},r=await De(t);t?.debug("package",r);const n={command:"build",mode:process.env.NODE_ENV??"production",root:r.root,...e?.env};t?.debug("env:",n);const o=await Cc(n,r,{log:t,manifestPath:e?.manifest});return t?.debug("manifest:",o),{manifest:o,pkg:r,env:n}},Lc=async e=>{const{log:t}=e??{};t?.log(ie.bold("Starting to build portal"));const{manifest:n,pkg:o,env:i}=await Sc({log:t,manifest:e?.manifest});t?.start("loading vite config...");const s=await le(i,o);t?.succeed("vite config applied"),t?.debug("vite config:",s),t?.start("🤞🏻","building portal..."),t?.startNativeConsoleCapture(),await r(s),t?.stopNativeConsoleCapture(),t?.succeed("build completed 😘");return{pkg:o,manifest:n,outDir:s.build.outDir}},Rc=async e=>{const{log:t,manifest:r}=e,n={command:"build",mode:process.env.NODE_ENV??"production",environment:null,root:process.cwd()},{pkg:o,manifest:i}=await Lc({log:t,manifest:r});if(!i.build)throw new Error("Manifest build config not found");const s=await(async(e,t)=>{const r=t?.file??[`portal.schema.${e.environment}`,"portal.schema"],n=await y(r,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async t=>{const r="function"==typeof t.default?await Promise.resolve(t.default(e)):t.default;if(!r)throw new Error("Schema function did not return a valid schema");return r}}});return{schema:n.config,path:n.path,extension:n.extension}})(n,{file:e?.schema});t?.debug("Schema:",s);return{archive:await At(o,{log:t,archive:e?.archive,content:{"portal-template-manifest.json":JSON.stringify(i.build,null,2),"portal.schema.json":JSON.stringify(s.schema,null,2),"metadata.json":JSON.stringify({name:i.name,version:i.build.version})}}).catch(e=>{t?.error("Failed to create package:",e),process.exit(1)}),manifest:i,schema:s.schema}},Dc=async e=>{const{log:t}=e??{},r=await De(t),n={command:"build",mode:process.env.NODE_ENV??"production",root:r.root,...e?.env},o=await Oc(n,{log:t,config:e?.config});if(t?.debug("config:",o),e?.output){t?.start("writing config to file");try{await Dt(e.output,JSON.stringify(o,null,2)),t?.succeed("config written successfully",Se(e.output,{relative:!0}))}catch(e){throw t?.fail("failed to write config"),e}}return{config:o,pkg:r}},Tc=async e=>{const{log:t,portal:r}=e,{config:n}=await Dc({log:t,config:e.config,env:{environment:e.environment}});t?.start("Initializing Fusion Framework...");const o=await dc({env:e.environment,auth:e.auth});t?.succeed("Initialized Fusion Framework");const i=await o.serviceDiscovery.createClient("portals");i.request$.subscribe(e=>{t?.debug("Request:",e),t?.info("🌎","Executing request to:",Se(e.uri))}),t?.start("Publishing portal config"),t?.info("Using environment:",ie.redBright(e.environment));try{const e=await i.json(`/portals/${r.name}@${r.version}/config`,{method:"PUT",body:n});t?.debug("Response:",e),t?.succeed("Published portal config")}catch(e){if(e instanceof kt)switch(e.response.status){case 410:t?.fail("🤬",`Portal ${r.name} is deleted from portals-service. Please check the portal key and try again.`);break;case 404:t?.fail("🤬",`Portal ${r.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 Ac=async e=>{const{log:t,framework:r}=e,n="string"==typeof e.fileOrBundle?new It(e.fileOrBundle):e.fileOrBundle,{name:o}=e.name?{name:e.name}:await vc(n).catch(e=>{t?.error("Failed to resolve manifest:",e),process.exit(1)}),i=await n.toBufferPromise().catch(e=>{t?.error("Failed to read bundle content:",e),process.exit(1)});try{const e=await r.serviceDiscovery.createClient("portal-config");e.request$.subscribe(e=>{t?.info("🌎","Executing request to:",e.uri),t?.debug("Request:",e)});const n=await e.fetch(`/bundles/templates/${o}`,{method:"POST",body:new Blob([i],{type:"application/zip"}),headers:{"Content-Type":"application/zip"}});if(!n.ok){try{const{error:e}=await n.json();t?.debug("Error:",e),e.message&&t?.warn(ie.red(`🤯 error: ${e.code}\n`),ie.yellowBright(e.message),"\n")}catch(e){t?.debug("Error:",n.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}`)}}(n,o)}t?.succeed("Successfully uploaded portal bundle"),t?.debug("Response:",n)}catch(e){t?.fail("🙅‍♂️","Failed to upload portal bundle"),t?.error(e),process.exit(1)}};var Pc;!function(e){e.Latest="latest",e.Preview="preview"}(Pc||(Pc={}));const $c=async e=>{const{tag:t,name:r,version:n,framework:o,log:i}=e;["latest","preview"].includes(t)||(i?.fail("🤪",'Invalid tag. Use "latest" or "preview".'),process.exit(1)),r||(i?.fail("🤪","Portal name is required."),process.exit(1)),n||(i?.fail("🤪","Version is required."),process.exit(1)),i?.info("Tagging portal:",ie.greenBright(`${r}@${t}`,n));const s=await o.serviceDiscovery.createClient("portal-config");s.request$.subscribe(e=>{i?.debug("Request:",e),i?.info("🌎","Executing request to:",Se(e.uri))}),i?.start("Tagging portal template...");try{const e=await s.json(`/templates/${r}/tags/${t}`,{method:"PUT",body:{version:n}});i?.debug("Response:",e),i?.succeed("Tagged portal template successfully"),i?.info("🚀",JSON.stringify(e))}catch(e){if(e instanceof kt){const{data:t,response:n}=e;switch(i?.debug("Error:",t),t&&i?.warn(ie.red(`🤯 error: ${t.code}\n`),ie.yellowBright(t.message),"\n"),n?.status){case 410:i?.fail(`🤬 - ${n?.status} -`,`${r} is deleted. Please check the name and try again.`);break;case 404:i?.fail(`🤬 - ${n?.status} -`,`${r} not found. Please check the name and try again.`);break;case 403:case 401:i?.fail(`🤬 - ${n?.status} -`,"You are not authorized to tag. Please check your permissions.");break;default:i?.fail(`🤬 - ${n?.status} -`,"Failed to tag",`Error: ${e.message}`)}}throw e}};export{yc as AllowedAppTags,Pc as AllowedPortalTags,St as ConsoleLogger,fc as FusionEnv,Ae as buildApplication,Lc as buildPortal,Pt as bundleApp,Rc as bundlePortal,gc as checkApp,xt as generateApplicationConfig,Dc as generatePortalConfig,dc as initializeFramework,Te as loadAppManifest,Sc as loadPortalManifest,At as pack,hc as publishAppConfig,Tc as publishPortalConfig,pc as resolveDefaultEnv,mc as startAppDevServer,Nc as startPortalDevServer,bc as tagApplication,$c as tagPortal,Ec as uploadApplication,Ac as uploadPortalBundle};
@@ -1,3 +1,3 @@
1
1
  // Generated by genversion.
2
- export const version = '11.1.0';
2
+ export const version = '11.1.2';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- export declare const version = "11.1.0";
1
+ export declare const version = "11.1.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-cli",
3
- "version": "11.1.0",
3
+ "version": "11.1.2",
4
4
  "keywords": [
5
5
  "Fusion",
6
6
  "Fusion Framework",
@@ -99,12 +99,12 @@
99
99
  "ora": "^8.0.1",
100
100
  "read-package-up": "^11.0.0",
101
101
  "vite": "^6.3.5",
102
- "vite-plugin-tsconfig-paths": "^1.4.1",
102
+ "vite-tsconfig-paths": "^5.1.4",
103
103
  "zod": "^3.25.76",
104
104
  "@equinor/fusion-framework-dev-portal": "^1.0.1",
105
- "@equinor/fusion-framework-dev-server": "^1.0.0",
106
105
  "@equinor/fusion-framework-module-msal-node": "^1.0.1",
107
- "@equinor/fusion-imports": "^1.1.2"
106
+ "@equinor/fusion-imports": "^1.1.2",
107
+ "@equinor/fusion-framework-dev-server": "^1.0.2"
108
108
  },
109
109
  "devDependencies": {
110
110
  "@rollup/plugin-commonjs": "^28.0.3",