@capgo/cli 7.28.1 → 7.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/index.js +191 -184
- package/dist/package.json +1 -1
- package/dist/src/build/credentials-command.d.ts +6 -2
- package/dist/src/build/credentials-command.d.ts.map +1 -1
- package/dist/src/build/credentials.d.ts +24 -13
- package/dist/src/build/credentials.d.ts.map +1 -1
- package/dist/src/build/request.d.ts.map +1 -1
- package/dist/src/sdk.js +84 -84
- package/package.json +1 -1
package/dist/src/sdk.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var N6=Object.create;var gl=Object.defineProperty;var $6=Object.getOwnPropertyDescriptor;var L6=Object.getOwnPropertyNames;var j6=Object.getPrototypeOf,B6=Object.prototype.hasOwnProperty;var Rr=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),lm=(t,e)=>{for(var r in e)gl(t,r,{get:e[r],enumerable:!0})},kE=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of L6(e))!B6.call(t,i)&&i!==r&&gl(t,i,{get:()=>e[i],enumerable:!(n=$6(e,i))||n.enumerable});return t};var Oe=(t,e,r)=>(r=t!=null?N6(j6(t)):{},kE(e||!t||!t.__esModule?gl(r,"default",{value:t,enumerable:!0}):r,t)),ue=t=>kE(gl({},"__esModule",{value:!0}),t);var Ye=v((cde,RE)=>{"use strict";var fm={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let r="";return t<0?r+=`\x1B[${-t}D`:t>0&&(r+=`\x1B[${t}C`),e<0?r+=`\x1B[${-e}A`:e>0&&(r+=`\x1B[${e}B`),r},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},M6={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},q6={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let r=0;r<t;r++)e+=this.line+(r<t-1?fm.up():"");return t&&(e+=fm.left),e}};RE.exports={cursor:fm,scroll:M6,erase:q6,beep:"\x07"}});var dm=v((lde,hm)=>{var Dl=process||{},NE=Dl.argv||[],yl=Dl.env||{},U6=!(yl.NO_COLOR||NE.includes("--no-color"))&&(!!yl.FORCE_COLOR||NE.includes("--color")||Dl.platform==="win32"||(Dl.stdout||{}).isTTY&&yl.TERM!=="dumb"||!!yl.CI),H6=(t,e,r=t)=>n=>{let i=""+n,s=i.indexOf(e,t.length);return~s?t+V6(i,e,r,s)+e:t+i+e},V6=(t,e,r,n)=>{let i="",s=0;do i+=t.substring(s,n)+r,s=n+e.length,n=t.indexOf(e,s);while(~n);return i+t.substring(s)},$E=(t=U6)=>{let e=t?H6:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};hm.exports=$E();hm.exports.createColors=$E});var Ol=v(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.isNXMonorepo=pr.isMonorepo=pr.findPackageRelativePathInMonorepo=pr.findPackagePath=pr.findNXMonorepoRoot=pr.findMonorepoRoot=void 0;var lu=require("node:fs"),wi=require("node:path");function Al(t){let e=(0,wi.join)(t,"package.json"),r=(0,wi.join)(t,"pnpm-workspace.yaml");if((0,lu.existsSync)(r)||(0,lu.existsSync)(e)&&JSON.parse((0,lu.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,wi.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return Al(n)}pr.findMonorepoRoot=Al;function Am(t){let e=(0,wi.join)(t,"nx.json");if((0,lu.existsSync)(e))return t;let r=(0,wi.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return Am(r)}pr.findNXMonorepoRoot=Am;function Om(t,e,r){let n=(0,wi.join)(e,"node_modules",t);if((0,lu.existsSync)(n))return n;if(e===r)return null;let i=(0,wi.dirname)(e);return Om(t,i,r)}pr.findPackagePath=Om;function EU(t,e){let r=Al(e),n=Om(t,e,r);return n?(0,wi.relative)(e,n):null}pr.findPackageRelativePathInMonorepo=EU;function _U(t){try{return Al(t),!0}catch{return!1}}pr.isMonorepo=_U;function CU(t){try{return Am(t),!0}catch{return!1}}pr.isNXMonorepo=CU});var le={};lm(le,{__addDisposableResource:()=>M_,__assign:()=>Rl,__asyncDelegator:()=>P_,__asyncGenerator:()=>I_,__asyncValues:()=>k_,__await:()=>Eo,__awaiter:()=>S_,__classPrivateFieldGet:()=>L_,__classPrivateFieldIn:()=>B_,__classPrivateFieldSet:()=>j_,__createBinding:()=>$l,__decorate:()=>D_,__disposeResources:()=>q_,__esDecorate:()=>b_,__exportStar:()=>O_,__extends:()=>g_,__generator:()=>A_,__importDefault:()=>$_,__importStar:()=>N_,__makeTemplateObject:()=>R_,__metadata:()=>C_,__param:()=>w_,__propKey:()=>E_,__read:()=>Lm,__rest:()=>y_,__rewriteRelativeImportExtension:()=>U_,__runInitializers:()=>v_,__setFunctionName:()=>__,__spread:()=>x_,__spreadArray:()=>F_,__spreadArrays:()=>T_,__values:()=>Nl,default:()=>WU});function g_(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Nm(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function y_(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function D_(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function w_(t,e){return function(r,n){e(r,n,t)}}function b_(t,e,r,n,i,s){function o(S){if(S!==void 0&&typeof S!="function")throw new TypeError("Function expected");return S}for(var a=n.kind,u=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,l=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),h,d=!1,f=r.length-1;f>=0;f--){var m={};for(var g in n)m[g]=g==="access"?{}:n[g];for(var g in n.access)m.access[g]=n.access[g];m.addInitializer=function(S){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(S||null))};var b=(0,r[f])(a==="accessor"?{get:l.get,set:l.set}:l[u],m);if(a==="accessor"){if(b===void 0)continue;if(b===null||typeof b!="object")throw new TypeError("Object expected");(h=o(b.get))&&(l.get=h),(h=o(b.set))&&(l.set=h),(h=o(b.init))&&i.unshift(h)}else(h=o(b))&&(a==="field"?i.unshift(h):l[u]=h)}c&&Object.defineProperty(c,n.name,l),d=!0}function v_(t,e,r){for(var n=arguments.length>2,i=0;i<e.length;i++)r=n?e[i].call(t,r):e[i].call(t);return n?r:void 0}function E_(t){return typeof t=="symbol"?t:"".concat(t)}function __(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function C_(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function S_(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{c(n.next(l))}catch(h){o(h)}}function u(l){try{c(n.throw(l))}catch(h){o(h)}}function c(l){l.done?s(l.value):i(l.value).then(a,u)}c((n=n.apply(t,e||[])).next())})}function A_(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(l){return u([c,l])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){r.label=c[1];break}if(c[0]===6&&r.label<s[1]){r.label=s[1],s=c;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(c);break}s[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(l){c=[6,l],i=0}finally{n=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function O_(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$l(e,t,r)}function Nl(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Lm(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function x_(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Lm(arguments[e]));return t}function T_(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function F_(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}function Eo(t){return this instanceof Eo?(this.v=t,this):new Eo(t)}function I_(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(f){return function(m){return Promise.resolve(m).then(f,h)}}function a(f,m){n[f]&&(i[f]=function(g){return new Promise(function(b,S){s.push([f,g,b,S])>1||u(f,g)})},m&&(i[f]=m(i[f])))}function u(f,m){try{c(n[f](m))}catch(g){d(s[0][3],g)}}function c(f){f.value instanceof Eo?Promise.resolve(f.value.v).then(l,h):d(s[0][2],f)}function l(f){u("next",f)}function h(f){u("throw",f)}function d(f,m){f(m),s.shift(),s.length&&u(s[0][0],s[0][1])}}function P_(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Eo(t[i](o)),done:!1}:s?s(o):o}:s}}function k_(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Nl=="function"?Nl(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(c){s({value:c,done:a})},o)}}function R_(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function N_(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=$m(t),n=0;n<r.length;n++)r[n]!=="default"&&$l(e,t,r[n]);return GU(e,t),e}function $_(t){return t&&t.__esModule?t:{default:t}}function L_(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function j_(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}function B_(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function M_(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,i;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(i=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");i&&(n=function(){try{i.call(this)}catch(s){return Promise.reject(s)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function q_(t){function e(s){t.error=t.hasError?new KU(s,t.error,"An error was suppressed during disposal."):s,t.hasError=!0}var r,n=0;function i(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(i);if(r.dispose){var s=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(s).then(i,function(o){return e(o),i()})}else n|=1}catch(o){e(o)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return i()}function U_(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,i,s,o){return n?e?".jsx":".js":i&&(!s||!o)?r:i+s+"."+o.toLowerCase()+"js"}):t}var Nm,Rl,$l,GU,$m,KU,WU,fe=Rr(()=>{Nm=function(t,e){return Nm=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Nm(t,e)};Rl=function(){return Rl=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Rl.apply(this,arguments)};$l=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]});GU=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},$m=function(t){return $m=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},$m(t)};KU=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};WU={__extends:g_,__assign:Rl,__rest:y_,__decorate:D_,__param:w_,__esDecorate:b_,__runInitializers:v_,__propKey:E_,__setFunctionName:__,__metadata:C_,__awaiter:S_,__generator:A_,__createBinding:$l,__exportStar:O_,__values:Nl,__read:Lm,__spread:x_,__spreadArrays:T_,__spreadArray:F_,__await:Eo,__asyncGenerator:I_,__asyncDelegator:P_,__asyncValues:k_,__makeTemplateObject:R_,__importStar:N_,__importDefault:$_,__classPrivateFieldGet:L_,__classPrivateFieldSet:j_,__classPrivateFieldIn:B_,__addDisposableResource:M_,__disposeResources:q_,__rewriteRelativeImportExtension:U_}});var H_=v(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});Ll.resolveFetch=void 0;var XU=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Ll.resolveFetch=XU});var qm=v(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.FunctionRegion=Lr.FunctionsHttpError=Lr.FunctionsRelayError=Lr.FunctionsFetchError=Lr.FunctionsError=void 0;var _o=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};Lr.FunctionsError=_o;var jm=class extends _o{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};Lr.FunctionsFetchError=jm;var Bm=class extends _o{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};Lr.FunctionsRelayError=Bm;var Mm=class extends _o{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};Lr.FunctionsHttpError=Mm;var V_;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(V_||(Lr.FunctionRegion=V_={}))});var z_=v(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});jl.FunctionsClient=void 0;var YU=(fe(),ue(le)),JU=H_(),us=qm(),Um=class{constructor(e,{headers:r={},customFetch:n,region:i=us.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=i,this.fetch=(0,JU.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return YU.__awaiter(this,arguments,void 0,function*(r,n={}){var i;try{let{headers:s,method:o,body:a,signal:u}=n,c={},{region:l}=n;l||(l=this.region);let h=new URL(`${this.url}/${r}`);l&&l!=="any"&&(c["x-region"]=l,h.searchParams.set("forceFunctionRegion",l));let d;a&&(s&&!Object.prototype.hasOwnProperty.call(s,"Content-Type")||!s)?typeof Blob<"u"&&a instanceof Blob||a instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",d=a):typeof a=="string"?(c["Content-Type"]="text/plain",d=a):typeof FormData<"u"&&a instanceof FormData?d=a:(c["Content-Type"]="application/json",d=JSON.stringify(a)):d=a;let f=yield this.fetch(h.toString(),{method:o||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),s),body:d,signal:u}).catch(S=>{throw S.name==="AbortError"?S:new us.FunctionsFetchError(S)}),m=f.headers.get("x-relay-error");if(m&&m==="true")throw new us.FunctionsRelayError(f);if(!f.ok)throw new us.FunctionsHttpError(f);let g=((i=f.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),b;return g==="application/json"?b=yield f.json():g==="application/octet-stream"||g==="application/pdf"?b=yield f.blob():g==="text/event-stream"?b=f:g==="multipart/form-data"?b=yield f.formData():b=yield f.text(),{data:b,error:null,response:f}}catch(s){return s instanceof Error&&s.name==="AbortError"?{data:null,error:new us.FunctionsFetchError(s)}:{data:null,error:s,response:s instanceof us.FunctionsHttpError||s instanceof us.FunctionsRelayError?s.context:void 0}}})}};jl.FunctionsClient=Um});var Hm=v(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.FunctionRegion=mr.FunctionsRelayError=mr.FunctionsHttpError=mr.FunctionsFetchError=mr.FunctionsError=mr.FunctionsClient=void 0;var ZU=z_();Object.defineProperty(mr,"FunctionsClient",{enumerable:!0,get:function(){return ZU.FunctionsClient}});var pu=qm();Object.defineProperty(mr,"FunctionsError",{enumerable:!0,get:function(){return pu.FunctionsError}});Object.defineProperty(mr,"FunctionsFetchError",{enumerable:!0,get:function(){return pu.FunctionsFetchError}});Object.defineProperty(mr,"FunctionsHttpError",{enumerable:!0,get:function(){return pu.FunctionsHttpError}});Object.defineProperty(mr,"FunctionsRelayError",{enumerable:!0,get:function(){return pu.FunctionsRelayError}});Object.defineProperty(mr,"FunctionRegion",{enumerable:!0,get:function(){return pu.FunctionRegion}})});var Gm=v(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});var Vm=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};zm.default=Vm});var Xm=v(Wm=>{"use strict";Object.defineProperty(Wm,"__esModule",{value:!0});var QU=(fe(),ue(le)),e4=QU.__importDefault(Gm()),Km=class{constructor(e){var r,n;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(r=e.shouldThrowOnError)!==null&&r!==void 0?r:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,r){return this.headers=new Headers(this.headers),this.headers.set(e,r),this}then(e,r){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let n=this.fetch,i=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async s=>{var o,a,u,c;let l=null,h=null,d=null,f=s.status,m=s.statusText;if(s.ok){if(this.method!=="HEAD"){let A=await s.text();A===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((o=this.headers.get("Accept"))===null||o===void 0)&&o.includes("application/vnd.pgrst.plan+text"))?h=A:h=JSON.parse(A))}let b=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),S=(u=s.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");b&&S&&S.length>1&&(d=parseInt(S[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(h)&&(h.length>1?(l={code:"PGRST116",details:`Results contain ${h.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},h=null,d=null,f=406,m="Not Acceptable"):h.length===1?h=h[0]:h=null)}else{let b=await s.text();try{l=JSON.parse(b),Array.isArray(l)&&s.status===404&&(h=[],l=null,f=200,m="OK")}catch{s.status===404&&b===""?(f=204,m="No Content"):l={message:b}}if(l&&this.isMaybeSingle&&(!((c=l?.details)===null||c===void 0)&&c.includes("0 rows"))&&(l=null,f=200,m="OK"),l&&this.shouldThrowOnError)throw new e4.default(l)}return{error:l,data:h,count:d,status:f,statusText:m}});return this.shouldThrowOnError||(i=i.catch(s=>{var o,a,u;return{error:{message:`${(o=s?.name)!==null&&o!==void 0?o:"FetchError"}: ${s?.message}`,details:`${(a=s?.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(u=s?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),i.then(e,r)}returns(){return this}overrideTypes(){return this}};Wm.default=Km});var Zm=v(Jm=>{"use strict";Object.defineProperty(Jm,"__esModule",{value:!0});var t4=(fe(),ue(le)),r4=t4.__importDefault(Xm()),Ym=class extends r4.default{select(e){let r=!1,n=(e??"*").split("").map(i=>/\s/.test(i)&&!r?"":(i==='"'&&(r=!r),i)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:r=!0,nullsFirst:n,foreignTable:i,referencedTable:s=i}={}){let o=s?`${s}.order`:"order",a=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${a?`${a},`:""}${e}.${r?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:r,referencedTable:n=r}={}){let i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${e}`),this}range(e,r,{foreignTable:n,referencedTable:i=n}={}){let s=typeof i>"u"?"offset":`${i}.offset`,o=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(o,`${r-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:r=!1,settings:n=!1,buffers:i=!1,wal:s=!1,format:o="text"}={}){var a;let u=[e?"analyze":null,r?"verbose":null,n?"settings":null,i?"buffers":null,s?"wal":null].filter(Boolean).join("|"),c=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${o}; for="${c}"; options=${u};`),o==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};Jm.default=Ym});var Bl=v(eg=>{"use strict";Object.defineProperty(eg,"__esModule",{value:!0});var n4=(fe(),ue(le)),i4=n4.__importDefault(Zm()),s4=new RegExp("[,()]"),Qm=class extends i4.default{eq(e,r){return this.url.searchParams.append(e,`eq.${r}`),this}neq(e,r){return this.url.searchParams.append(e,`neq.${r}`),this}gt(e,r){return this.url.searchParams.append(e,`gt.${r}`),this}gte(e,r){return this.url.searchParams.append(e,`gte.${r}`),this}lt(e,r){return this.url.searchParams.append(e,`lt.${r}`),this}lte(e,r){return this.url.searchParams.append(e,`lte.${r}`),this}like(e,r){return this.url.searchParams.append(e,`like.${r}`),this}likeAllOf(e,r){return this.url.searchParams.append(e,`like(all).{${r.join(",")}}`),this}likeAnyOf(e,r){return this.url.searchParams.append(e,`like(any).{${r.join(",")}}`),this}ilike(e,r){return this.url.searchParams.append(e,`ilike.${r}`),this}ilikeAllOf(e,r){return this.url.searchParams.append(e,`ilike(all).{${r.join(",")}}`),this}ilikeAnyOf(e,r){return this.url.searchParams.append(e,`ilike(any).{${r.join(",")}}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(i=>typeof i=="string"&&s4.test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}contains(e,r){return typeof r=="string"?this.url.searchParams.append(e,`cs.${r}`):Array.isArray(r)?this.url.searchParams.append(e,`cs.{${r.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(r)}`),this}containedBy(e,r){return typeof r=="string"?this.url.searchParams.append(e,`cd.${r}`):Array.isArray(r)?this.url.searchParams.append(e,`cd.{${r.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(r)}`),this}rangeGt(e,r){return this.url.searchParams.append(e,`sr.${r}`),this}rangeGte(e,r){return this.url.searchParams.append(e,`nxl.${r}`),this}rangeLt(e,r){return this.url.searchParams.append(e,`sl.${r}`),this}rangeLte(e,r){return this.url.searchParams.append(e,`nxr.${r}`),this}rangeAdjacent(e,r){return this.url.searchParams.append(e,`adj.${r}`),this}overlaps(e,r){return typeof r=="string"?this.url.searchParams.append(e,`ov.${r}`):this.url.searchParams.append(e,`ov.{${r.join(",")}}`),this}textSearch(e,r,{config:n,type:i}={}){let s="";i==="plain"?s="pl":i==="phrase"?s="ph":i==="websearch"&&(s="w");let o=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${s}fts${o}.${r}`),this}match(e){return Object.entries(e).forEach(([r,n])=>{this.url.searchParams.append(r,`eq.${n}`)}),this}not(e,r,n){return this.url.searchParams.append(e,`not.${r}.${n}`),this}or(e,{foreignTable:r,referencedTable:n=r}={}){let i=n?`${n}.or`:"or";return this.url.searchParams.append(i,`(${e})`),this}filter(e,r,n){return this.url.searchParams.append(e,`${r}.${n}`),this}};eg.default=Qm});var ng=v(rg=>{"use strict";Object.defineProperty(rg,"__esModule",{value:!0});var o4=(fe(),ue(le)),mu=o4.__importDefault(Bl()),tg=class{constructor(e,{headers:r={},schema:n,fetch:i}){this.url=e,this.headers=new Headers(r),this.schema=n,this.fetch=i}select(e,r){let{head:n=!1,count:i}=r??{},s=n?"HEAD":"GET",o=!1,a=(e??"*").split("").map(u=>/\s/.test(u)&&!o?"":(u==='"'&&(o=!o),u)).join("");return this.url.searchParams.set("select",a),i&&this.headers.append("Prefer",`count=${i}`),new mu.default({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:r,defaultToNull:n=!0}={}){var i;let s="POST";if(r&&this.headers.append("Prefer",`count=${r}`),n||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let o=e.reduce((a,u)=>a.concat(Object.keys(u)),[]);if(o.length>0){let a=[...new Set(o)].map(u=>`"${u}"`);this.url.searchParams.set("columns",a.join(","))}}return new mu.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}upsert(e,{onConflict:r,ignoreDuplicates:n=!1,count:i,defaultToNull:s=!0}={}){var o;let a="POST";if(this.headers.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),r!==void 0&&this.url.searchParams.set("on_conflict",r),i&&this.headers.append("Prefer",`count=${i}`),s||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let u=e.reduce((c,l)=>c.concat(Object.keys(l)),[]);if(u.length>0){let c=[...new Set(u)].map(l=>`"${l}"`);this.url.searchParams.set("columns",c.join(","))}}return new mu.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}update(e,{count:r}={}){var n;let i="PATCH";return r&&this.headers.append("Prefer",`count=${r}`),new mu.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:e}={}){var r;let n="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new mu.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};rg.default=tg});var K_=v(sg=>{"use strict";Object.defineProperty(sg,"__esModule",{value:!0});var G_=(fe(),ue(le)),a4=G_.__importDefault(ng()),u4=G_.__importDefault(Bl()),ig=class t{constructor(e,{headers:r={},schema:n,fetch:i}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.fetch=i}from(e){let r=new URL(`${this.url}/${e}`);return new a4.default(r,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new t(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,r={},{head:n=!1,get:i=!1,count:s}={}){var o;let a,u=new URL(`${this.url}/rpc/${e}`),c;n||i?(a=n?"HEAD":"GET",Object.entries(r).filter(([h,d])=>d!==void 0).map(([h,d])=>[h,Array.isArray(d)?`{${d.join(",")}}`:`${d}`]).forEach(([h,d])=>{u.searchParams.append(h,d)})):(a="POST",c=r);let l=new Headers(this.headers);return s&&l.set("Prefer",`count=${s}`),new u4.default({method:a,url:u,headers:l,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};sg.default=ig});var og=v(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.PostgrestError=er.PostgrestBuilder=er.PostgrestTransformBuilder=er.PostgrestFilterBuilder=er.PostgrestQueryBuilder=er.PostgrestClient=void 0;var Co=(fe(),ue(le)),W_=Co.__importDefault(K_());er.PostgrestClient=W_.default;var X_=Co.__importDefault(ng());er.PostgrestQueryBuilder=X_.default;var Y_=Co.__importDefault(Bl());er.PostgrestFilterBuilder=Y_.default;var J_=Co.__importDefault(Zm());er.PostgrestTransformBuilder=J_.default;var Z_=Co.__importDefault(Xm());er.PostgrestBuilder=Z_.default;var Q_=Co.__importDefault(Gm());er.PostgrestError=Q_.default;er.default={PostgrestClient:W_.default,PostgrestQueryBuilder:X_.default,PostgrestFilterBuilder:Y_.default,PostgrestTransformBuilder:J_.default,PostgrestBuilder:Z_.default,PostgrestError:Q_.default}});var ag=v(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.WebSocketFactory=void 0;var Ml=class{static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){let r=process.versions;if(r&&r.node){let n=r.node,i=parseInt(n.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
1
|
+
"use strict";var N6=Object.create;var gl=Object.defineProperty;var $6=Object.getOwnPropertyDescriptor;var L6=Object.getOwnPropertyNames;var j6=Object.getPrototypeOf,B6=Object.prototype.hasOwnProperty;var Rr=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),lm=(t,e)=>{for(var r in e)gl(t,r,{get:e[r],enumerable:!0})},kE=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of L6(e))!B6.call(t,i)&&i!==r&&gl(t,i,{get:()=>e[i],enumerable:!(n=$6(e,i))||n.enumerable});return t};var Oe=(t,e,r)=>(r=t!=null?N6(j6(t)):{},kE(e||!t||!t.__esModule?gl(r,"default",{value:t,enumerable:!0}):r,t)),ue=t=>kE(gl({},"__esModule",{value:!0}),t);var Ye=v((lde,RE)=>{"use strict";var fm={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let r="";return t<0?r+=`\x1B[${-t}D`:t>0&&(r+=`\x1B[${t}C`),e<0?r+=`\x1B[${-e}A`:e>0&&(r+=`\x1B[${e}B`),r},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},M6={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},q6={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let r=0;r<t;r++)e+=this.line+(r<t-1?fm.up():"");return t&&(e+=fm.left),e}};RE.exports={cursor:fm,scroll:M6,erase:q6,beep:"\x07"}});var dm=v((fde,hm)=>{var Dl=process||{},NE=Dl.argv||[],yl=Dl.env||{},U6=!(yl.NO_COLOR||NE.includes("--no-color"))&&(!!yl.FORCE_COLOR||NE.includes("--color")||Dl.platform==="win32"||(Dl.stdout||{}).isTTY&&yl.TERM!=="dumb"||!!yl.CI),H6=(t,e,r=t)=>n=>{let i=""+n,s=i.indexOf(e,t.length);return~s?t+V6(i,e,r,s)+e:t+i+e},V6=(t,e,r,n)=>{let i="",s=0;do i+=t.substring(s,n)+r,s=n+e.length,n=t.indexOf(e,s);while(~n);return i+t.substring(s)},$E=(t=U6)=>{let e=t?H6:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};hm.exports=$E();hm.exports.createColors=$E});var Ol=v(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.isNXMonorepo=pr.isMonorepo=pr.findPackageRelativePathInMonorepo=pr.findPackagePath=pr.findNXMonorepoRoot=pr.findMonorepoRoot=void 0;var lu=require("node:fs"),wi=require("node:path");function Al(t){let e=(0,wi.join)(t,"package.json"),r=(0,wi.join)(t,"pnpm-workspace.yaml");if((0,lu.existsSync)(r)||(0,lu.existsSync)(e)&&JSON.parse((0,lu.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,wi.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return Al(n)}pr.findMonorepoRoot=Al;function Am(t){let e=(0,wi.join)(t,"nx.json");if((0,lu.existsSync)(e))return t;let r=(0,wi.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return Am(r)}pr.findNXMonorepoRoot=Am;function Om(t,e,r){let n=(0,wi.join)(e,"node_modules",t);if((0,lu.existsSync)(n))return n;if(e===r)return null;let i=(0,wi.dirname)(e);return Om(t,i,r)}pr.findPackagePath=Om;function EU(t,e){let r=Al(e),n=Om(t,e,r);return n?(0,wi.relative)(e,n):null}pr.findPackageRelativePathInMonorepo=EU;function _U(t){try{return Al(t),!0}catch{return!1}}pr.isMonorepo=_U;function CU(t){try{return Am(t),!0}catch{return!1}}pr.isNXMonorepo=CU});var le={};lm(le,{__addDisposableResource:()=>M_,__assign:()=>Rl,__asyncDelegator:()=>P_,__asyncGenerator:()=>I_,__asyncValues:()=>k_,__await:()=>Eo,__awaiter:()=>S_,__classPrivateFieldGet:()=>L_,__classPrivateFieldIn:()=>B_,__classPrivateFieldSet:()=>j_,__createBinding:()=>$l,__decorate:()=>D_,__disposeResources:()=>q_,__esDecorate:()=>b_,__exportStar:()=>O_,__extends:()=>g_,__generator:()=>A_,__importDefault:()=>$_,__importStar:()=>N_,__makeTemplateObject:()=>R_,__metadata:()=>C_,__param:()=>w_,__propKey:()=>E_,__read:()=>Lm,__rest:()=>y_,__rewriteRelativeImportExtension:()=>U_,__runInitializers:()=>v_,__setFunctionName:()=>__,__spread:()=>x_,__spreadArray:()=>F_,__spreadArrays:()=>T_,__values:()=>Nl,default:()=>WU});function g_(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Nm(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function y_(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function D_(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function w_(t,e){return function(r,n){e(r,n,t)}}function b_(t,e,r,n,i,s){function o(S){if(S!==void 0&&typeof S!="function")throw new TypeError("Function expected");return S}for(var a=n.kind,u=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,l=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),h,d=!1,f=r.length-1;f>=0;f--){var m={};for(var g in n)m[g]=g==="access"?{}:n[g];for(var g in n.access)m.access[g]=n.access[g];m.addInitializer=function(S){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(S||null))};var b=(0,r[f])(a==="accessor"?{get:l.get,set:l.set}:l[u],m);if(a==="accessor"){if(b===void 0)continue;if(b===null||typeof b!="object")throw new TypeError("Object expected");(h=o(b.get))&&(l.get=h),(h=o(b.set))&&(l.set=h),(h=o(b.init))&&i.unshift(h)}else(h=o(b))&&(a==="field"?i.unshift(h):l[u]=h)}c&&Object.defineProperty(c,n.name,l),d=!0}function v_(t,e,r){for(var n=arguments.length>2,i=0;i<e.length;i++)r=n?e[i].call(t,r):e[i].call(t);return n?r:void 0}function E_(t){return typeof t=="symbol"?t:"".concat(t)}function __(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function C_(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function S_(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{c(n.next(l))}catch(h){o(h)}}function u(l){try{c(n.throw(l))}catch(h){o(h)}}function c(l){l.done?s(l.value):i(l.value).then(a,u)}c((n=n.apply(t,e||[])).next())})}function A_(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(l){return u([c,l])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){r.label=c[1];break}if(c[0]===6&&r.label<s[1]){r.label=s[1],s=c;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(c);break}s[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(l){c=[6,l],i=0}finally{n=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function O_(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&$l(e,t,r)}function Nl(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Lm(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function x_(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Lm(arguments[e]));return t}function T_(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function F_(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}function Eo(t){return this instanceof Eo?(this.v=t,this):new Eo(t)}function I_(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(f){return function(m){return Promise.resolve(m).then(f,h)}}function a(f,m){n[f]&&(i[f]=function(g){return new Promise(function(b,S){s.push([f,g,b,S])>1||u(f,g)})},m&&(i[f]=m(i[f])))}function u(f,m){try{c(n[f](m))}catch(g){d(s[0][3],g)}}function c(f){f.value instanceof Eo?Promise.resolve(f.value.v).then(l,h):d(s[0][2],f)}function l(f){u("next",f)}function h(f){u("throw",f)}function d(f,m){f(m),s.shift(),s.length&&u(s[0][0],s[0][1])}}function P_(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Eo(t[i](o)),done:!1}:s?s(o):o}:s}}function k_(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Nl=="function"?Nl(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(c){s({value:c,done:a})},o)}}function R_(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function N_(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=$m(t),n=0;n<r.length;n++)r[n]!=="default"&&$l(e,t,r[n]);return GU(e,t),e}function $_(t){return t&&t.__esModule?t:{default:t}}function L_(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function j_(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}function B_(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function M_(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,i;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(i=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");i&&(n=function(){try{i.call(this)}catch(s){return Promise.reject(s)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function q_(t){function e(s){t.error=t.hasError?new KU(s,t.error,"An error was suppressed during disposal."):s,t.hasError=!0}var r,n=0;function i(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(i);if(r.dispose){var s=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(s).then(i,function(o){return e(o),i()})}else n|=1}catch(o){e(o)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return i()}function U_(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,i,s,o){return n?e?".jsx":".js":i&&(!s||!o)?r:i+s+"."+o.toLowerCase()+"js"}):t}var Nm,Rl,$l,GU,$m,KU,WU,fe=Rr(()=>{Nm=function(t,e){return Nm=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Nm(t,e)};Rl=function(){return Rl=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Rl.apply(this,arguments)};$l=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]});GU=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},$m=function(t){return $m=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},$m(t)};KU=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};WU={__extends:g_,__assign:Rl,__rest:y_,__decorate:D_,__param:w_,__esDecorate:b_,__runInitializers:v_,__propKey:E_,__setFunctionName:__,__metadata:C_,__awaiter:S_,__generator:A_,__createBinding:$l,__exportStar:O_,__values:Nl,__read:Lm,__spread:x_,__spreadArrays:T_,__spreadArray:F_,__await:Eo,__asyncGenerator:I_,__asyncDelegator:P_,__asyncValues:k_,__makeTemplateObject:R_,__importStar:N_,__importDefault:$_,__classPrivateFieldGet:L_,__classPrivateFieldSet:j_,__classPrivateFieldIn:B_,__addDisposableResource:M_,__disposeResources:q_,__rewriteRelativeImportExtension:U_}});var H_=v(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});Ll.resolveFetch=void 0;var XU=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Ll.resolveFetch=XU});var qm=v(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.FunctionRegion=Lr.FunctionsHttpError=Lr.FunctionsRelayError=Lr.FunctionsFetchError=Lr.FunctionsError=void 0;var _o=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};Lr.FunctionsError=_o;var jm=class extends _o{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};Lr.FunctionsFetchError=jm;var Bm=class extends _o{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};Lr.FunctionsRelayError=Bm;var Mm=class extends _o{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};Lr.FunctionsHttpError=Mm;var V_;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(V_||(Lr.FunctionRegion=V_={}))});var z_=v(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});jl.FunctionsClient=void 0;var YU=(fe(),ue(le)),JU=H_(),us=qm(),Um=class{constructor(e,{headers:r={},customFetch:n,region:i=us.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=i,this.fetch=(0,JU.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return YU.__awaiter(this,arguments,void 0,function*(r,n={}){var i;try{let{headers:s,method:o,body:a,signal:u}=n,c={},{region:l}=n;l||(l=this.region);let h=new URL(`${this.url}/${r}`);l&&l!=="any"&&(c["x-region"]=l,h.searchParams.set("forceFunctionRegion",l));let d;a&&(s&&!Object.prototype.hasOwnProperty.call(s,"Content-Type")||!s)?typeof Blob<"u"&&a instanceof Blob||a instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",d=a):typeof a=="string"?(c["Content-Type"]="text/plain",d=a):typeof FormData<"u"&&a instanceof FormData?d=a:(c["Content-Type"]="application/json",d=JSON.stringify(a)):d=a;let f=yield this.fetch(h.toString(),{method:o||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),s),body:d,signal:u}).catch(S=>{throw S.name==="AbortError"?S:new us.FunctionsFetchError(S)}),m=f.headers.get("x-relay-error");if(m&&m==="true")throw new us.FunctionsRelayError(f);if(!f.ok)throw new us.FunctionsHttpError(f);let g=((i=f.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),b;return g==="application/json"?b=yield f.json():g==="application/octet-stream"||g==="application/pdf"?b=yield f.blob():g==="text/event-stream"?b=f:g==="multipart/form-data"?b=yield f.formData():b=yield f.text(),{data:b,error:null,response:f}}catch(s){return s instanceof Error&&s.name==="AbortError"?{data:null,error:new us.FunctionsFetchError(s)}:{data:null,error:s,response:s instanceof us.FunctionsHttpError||s instanceof us.FunctionsRelayError?s.context:void 0}}})}};jl.FunctionsClient=Um});var Hm=v(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.FunctionRegion=mr.FunctionsRelayError=mr.FunctionsHttpError=mr.FunctionsFetchError=mr.FunctionsError=mr.FunctionsClient=void 0;var ZU=z_();Object.defineProperty(mr,"FunctionsClient",{enumerable:!0,get:function(){return ZU.FunctionsClient}});var pu=qm();Object.defineProperty(mr,"FunctionsError",{enumerable:!0,get:function(){return pu.FunctionsError}});Object.defineProperty(mr,"FunctionsFetchError",{enumerable:!0,get:function(){return pu.FunctionsFetchError}});Object.defineProperty(mr,"FunctionsHttpError",{enumerable:!0,get:function(){return pu.FunctionsHttpError}});Object.defineProperty(mr,"FunctionsRelayError",{enumerable:!0,get:function(){return pu.FunctionsRelayError}});Object.defineProperty(mr,"FunctionRegion",{enumerable:!0,get:function(){return pu.FunctionRegion}})});var Gm=v(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});var Vm=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};zm.default=Vm});var Xm=v(Wm=>{"use strict";Object.defineProperty(Wm,"__esModule",{value:!0});var QU=(fe(),ue(le)),e4=QU.__importDefault(Gm()),Km=class{constructor(e){var r,n;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(r=e.shouldThrowOnError)!==null&&r!==void 0?r:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,r){return this.headers=new Headers(this.headers),this.headers.set(e,r),this}then(e,r){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let n=this.fetch,i=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async s=>{var o,a,u,c;let l=null,h=null,d=null,f=s.status,m=s.statusText;if(s.ok){if(this.method!=="HEAD"){let A=await s.text();A===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((o=this.headers.get("Accept"))===null||o===void 0)&&o.includes("application/vnd.pgrst.plan+text"))?h=A:h=JSON.parse(A))}let b=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),S=(u=s.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");b&&S&&S.length>1&&(d=parseInt(S[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(h)&&(h.length>1?(l={code:"PGRST116",details:`Results contain ${h.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},h=null,d=null,f=406,m="Not Acceptable"):h.length===1?h=h[0]:h=null)}else{let b=await s.text();try{l=JSON.parse(b),Array.isArray(l)&&s.status===404&&(h=[],l=null,f=200,m="OK")}catch{s.status===404&&b===""?(f=204,m="No Content"):l={message:b}}if(l&&this.isMaybeSingle&&(!((c=l?.details)===null||c===void 0)&&c.includes("0 rows"))&&(l=null,f=200,m="OK"),l&&this.shouldThrowOnError)throw new e4.default(l)}return{error:l,data:h,count:d,status:f,statusText:m}});return this.shouldThrowOnError||(i=i.catch(s=>{var o,a,u;return{error:{message:`${(o=s?.name)!==null&&o!==void 0?o:"FetchError"}: ${s?.message}`,details:`${(a=s?.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(u=s?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),i.then(e,r)}returns(){return this}overrideTypes(){return this}};Wm.default=Km});var Zm=v(Jm=>{"use strict";Object.defineProperty(Jm,"__esModule",{value:!0});var t4=(fe(),ue(le)),r4=t4.__importDefault(Xm()),Ym=class extends r4.default{select(e){let r=!1,n=(e??"*").split("").map(i=>/\s/.test(i)&&!r?"":(i==='"'&&(r=!r),i)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:r=!0,nullsFirst:n,foreignTable:i,referencedTable:s=i}={}){let o=s?`${s}.order`:"order",a=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${a?`${a},`:""}${e}.${r?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:r,referencedTable:n=r}={}){let i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${e}`),this}range(e,r,{foreignTable:n,referencedTable:i=n}={}){let s=typeof i>"u"?"offset":`${i}.offset`,o=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(o,`${r-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:r=!1,settings:n=!1,buffers:i=!1,wal:s=!1,format:o="text"}={}){var a;let u=[e?"analyze":null,r?"verbose":null,n?"settings":null,i?"buffers":null,s?"wal":null].filter(Boolean).join("|"),c=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${o}; for="${c}"; options=${u};`),o==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};Jm.default=Ym});var Bl=v(eg=>{"use strict";Object.defineProperty(eg,"__esModule",{value:!0});var n4=(fe(),ue(le)),i4=n4.__importDefault(Zm()),s4=new RegExp("[,()]"),Qm=class extends i4.default{eq(e,r){return this.url.searchParams.append(e,`eq.${r}`),this}neq(e,r){return this.url.searchParams.append(e,`neq.${r}`),this}gt(e,r){return this.url.searchParams.append(e,`gt.${r}`),this}gte(e,r){return this.url.searchParams.append(e,`gte.${r}`),this}lt(e,r){return this.url.searchParams.append(e,`lt.${r}`),this}lte(e,r){return this.url.searchParams.append(e,`lte.${r}`),this}like(e,r){return this.url.searchParams.append(e,`like.${r}`),this}likeAllOf(e,r){return this.url.searchParams.append(e,`like(all).{${r.join(",")}}`),this}likeAnyOf(e,r){return this.url.searchParams.append(e,`like(any).{${r.join(",")}}`),this}ilike(e,r){return this.url.searchParams.append(e,`ilike.${r}`),this}ilikeAllOf(e,r){return this.url.searchParams.append(e,`ilike(all).{${r.join(",")}}`),this}ilikeAnyOf(e,r){return this.url.searchParams.append(e,`ilike(any).{${r.join(",")}}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(i=>typeof i=="string"&&s4.test(i)?`"${i}"`:`${i}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}contains(e,r){return typeof r=="string"?this.url.searchParams.append(e,`cs.${r}`):Array.isArray(r)?this.url.searchParams.append(e,`cs.{${r.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(r)}`),this}containedBy(e,r){return typeof r=="string"?this.url.searchParams.append(e,`cd.${r}`):Array.isArray(r)?this.url.searchParams.append(e,`cd.{${r.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(r)}`),this}rangeGt(e,r){return this.url.searchParams.append(e,`sr.${r}`),this}rangeGte(e,r){return this.url.searchParams.append(e,`nxl.${r}`),this}rangeLt(e,r){return this.url.searchParams.append(e,`sl.${r}`),this}rangeLte(e,r){return this.url.searchParams.append(e,`nxr.${r}`),this}rangeAdjacent(e,r){return this.url.searchParams.append(e,`adj.${r}`),this}overlaps(e,r){return typeof r=="string"?this.url.searchParams.append(e,`ov.${r}`):this.url.searchParams.append(e,`ov.{${r.join(",")}}`),this}textSearch(e,r,{config:n,type:i}={}){let s="";i==="plain"?s="pl":i==="phrase"?s="ph":i==="websearch"&&(s="w");let o=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${s}fts${o}.${r}`),this}match(e){return Object.entries(e).forEach(([r,n])=>{this.url.searchParams.append(r,`eq.${n}`)}),this}not(e,r,n){return this.url.searchParams.append(e,`not.${r}.${n}`),this}or(e,{foreignTable:r,referencedTable:n=r}={}){let i=n?`${n}.or`:"or";return this.url.searchParams.append(i,`(${e})`),this}filter(e,r,n){return this.url.searchParams.append(e,`${r}.${n}`),this}};eg.default=Qm});var ng=v(rg=>{"use strict";Object.defineProperty(rg,"__esModule",{value:!0});var o4=(fe(),ue(le)),mu=o4.__importDefault(Bl()),tg=class{constructor(e,{headers:r={},schema:n,fetch:i}){this.url=e,this.headers=new Headers(r),this.schema=n,this.fetch=i}select(e,r){let{head:n=!1,count:i}=r??{},s=n?"HEAD":"GET",o=!1,a=(e??"*").split("").map(u=>/\s/.test(u)&&!o?"":(u==='"'&&(o=!o),u)).join("");return this.url.searchParams.set("select",a),i&&this.headers.append("Prefer",`count=${i}`),new mu.default({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:r,defaultToNull:n=!0}={}){var i;let s="POST";if(r&&this.headers.append("Prefer",`count=${r}`),n||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let o=e.reduce((a,u)=>a.concat(Object.keys(u)),[]);if(o.length>0){let a=[...new Set(o)].map(u=>`"${u}"`);this.url.searchParams.set("columns",a.join(","))}}return new mu.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}upsert(e,{onConflict:r,ignoreDuplicates:n=!1,count:i,defaultToNull:s=!0}={}){var o;let a="POST";if(this.headers.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),r!==void 0&&this.url.searchParams.set("on_conflict",r),i&&this.headers.append("Prefer",`count=${i}`),s||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let u=e.reduce((c,l)=>c.concat(Object.keys(l)),[]);if(u.length>0){let c=[...new Set(u)].map(l=>`"${l}"`);this.url.searchParams.set("columns",c.join(","))}}return new mu.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}update(e,{count:r}={}){var n;let i="PATCH";return r&&this.headers.append("Prefer",`count=${r}`),new mu.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:e}={}){var r;let n="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new mu.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};rg.default=tg});var K_=v(sg=>{"use strict";Object.defineProperty(sg,"__esModule",{value:!0});var G_=(fe(),ue(le)),a4=G_.__importDefault(ng()),u4=G_.__importDefault(Bl()),ig=class t{constructor(e,{headers:r={},schema:n,fetch:i}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.fetch=i}from(e){let r=new URL(`${this.url}/${e}`);return new a4.default(r,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new t(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,r={},{head:n=!1,get:i=!1,count:s}={}){var o;let a,u=new URL(`${this.url}/rpc/${e}`),c;n||i?(a=n?"HEAD":"GET",Object.entries(r).filter(([h,d])=>d!==void 0).map(([h,d])=>[h,Array.isArray(d)?`{${d.join(",")}}`:`${d}`]).forEach(([h,d])=>{u.searchParams.append(h,d)})):(a="POST",c=r);let l=new Headers(this.headers);return s&&l.set("Prefer",`count=${s}`),new u4.default({method:a,url:u,headers:l,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};sg.default=ig});var og=v(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.PostgrestError=er.PostgrestBuilder=er.PostgrestTransformBuilder=er.PostgrestFilterBuilder=er.PostgrestQueryBuilder=er.PostgrestClient=void 0;var Co=(fe(),ue(le)),W_=Co.__importDefault(K_());er.PostgrestClient=W_.default;var X_=Co.__importDefault(ng());er.PostgrestQueryBuilder=X_.default;var Y_=Co.__importDefault(Bl());er.PostgrestFilterBuilder=Y_.default;var J_=Co.__importDefault(Zm());er.PostgrestTransformBuilder=J_.default;var Z_=Co.__importDefault(Xm());er.PostgrestBuilder=Z_.default;var Q_=Co.__importDefault(Gm());er.PostgrestError=Q_.default;er.default={PostgrestClient:W_.default,PostgrestQueryBuilder:X_.default,PostgrestFilterBuilder:Y_.default,PostgrestTransformBuilder:J_.default,PostgrestBuilder:Z_.default,PostgrestError:Q_.default}});var ag=v(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.WebSocketFactory=void 0;var Ml=class{static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){let r=process.versions;if(r&&r.node){let n=r.node,i=parseInt(n.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
2
2
|
import ws from "ws"
|
|
3
3
|
new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){let e=this.detectEnvironment();if(e.constructor)return e.constructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`
|
|
4
4
|
|
|
5
|
-
Suggested solution: ${e.workaround}`),new Error(r)}static createWebSocket(e,r){let n=this.getWebSocketConstructor();return new n(e,r)}static isWebSocketSupported(){try{let e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}};gu.WebSocketFactory=Ml;gu.default=Ml});var eC=v(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});ql.version=void 0;ql.version="2.79.0"});var Ul=v(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.CONNECTION_STATE=nt.TRANSPORTS=nt.CHANNEL_EVENTS=nt.CHANNEL_STATES=nt.SOCKET_STATES=nt.MAX_PUSH_BUFFER_SIZE=nt.WS_CLOSE_NORMAL=nt.DEFAULT_TIMEOUT=nt.VERSION=nt.VSN=nt.DEFAULT_VERSION=void 0;var oC=eC();nt.DEFAULT_VERSION=`realtime-js/${oC.version}`;nt.VSN="1.0.0";nt.VERSION=oC.version;nt.DEFAULT_TIMEOUT=1e4;nt.WS_CLOSE_NORMAL=1e3;nt.MAX_PUSH_BUFFER_SIZE=100;var tC;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(tC||(nt.SOCKET_STATES=tC={}));var rC;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(rC||(nt.CHANNEL_STATES=rC={}));var nC;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(nC||(nt.CHANNEL_EVENTS=nC={}));var iC;(function(t){t.websocket="websocket"})(iC||(nt.TRANSPORTS=iC={}));var sC;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(sC||(nt.CONNECTION_STATE=sC={}))});var aC=v(cg=>{"use strict";Object.defineProperty(cg,"__esModule",{value:!0});var ug=class{constructor(){this.HEADER_LENGTH=1}decode(e,r){return e.constructor===ArrayBuffer?r(this._binaryDecode(e)):r(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){let r=new DataView(e),n=new TextDecoder;return this._decodeBroadcast(e,r,n)}_decodeBroadcast(e,r,n){let i=r.getUint8(1),s=r.getUint8(2),o=this.HEADER_LENGTH+2,a=n.decode(e.slice(o,o+i));o=o+i;let u=n.decode(e.slice(o,o+s));o=o+s;let c=JSON.parse(n.decode(e.slice(o,e.byteLength)));return{ref:null,topic:a,event:u,payload:c}}};cg.default=ug});var hg=v(fg=>{"use strict";Object.defineProperty(fg,"__esModule",{value:!0});var lg=class{constructor(e,r){this.callback=e,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=r}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}};fg.default=lg});var Hl=v(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.httpEndpointURL=Te.toTimestampString=Te.toArray=Te.toJson=Te.toNumber=Te.toBoolean=Te.convertCell=Te.convertColumn=Te.convertChangeData=Te.PostgresTypes=void 0;var Ue;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Ue||(Te.PostgresTypes=Ue={}));var c4=(t,e,r={})=>{var n;let i=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((s,o)=>(s[o]=(0,Te.convertColumn)(o,t,e,i),s),{}):{}};Te.convertChangeData=c4;var l4=(t,e,r,n)=>{let i=e.find(a=>a.name===t),s=i?.type,o=r[t];return s&&!n.includes(s)?(0,Te.convertCell)(s,o):dg(o)};Te.convertColumn=l4;var f4=(t,e)=>{if(t.charAt(0)==="_"){let r=t.slice(1,t.length);return(0,Te.toArray)(e,r)}switch(t){case Ue.bool:return(0,Te.toBoolean)(e);case Ue.float4:case Ue.float8:case Ue.int2:case Ue.int4:case Ue.int8:case Ue.numeric:case Ue.oid:return(0,Te.toNumber)(e);case Ue.json:case Ue.jsonb:return(0,Te.toJson)(e);case Ue.timestamp:return(0,Te.toTimestampString)(e);case Ue.abstime:case Ue.date:case Ue.daterange:case Ue.int4range:case Ue.int8range:case Ue.money:case Ue.reltime:case Ue.text:case Ue.time:case Ue.timestamptz:case Ue.timetz:case Ue.tsrange:case Ue.tstzrange:return dg(e);default:return dg(e)}};Te.convertCell=f4;var dg=t=>t,h4=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}};Te.toBoolean=h4;var d4=t=>{if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return e}return t};Te.toNumber=d4;var p4=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t};Te.toJson=p4;var m4=(t,e)=>{if(typeof t!="string")return t;let r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let s,o=t.slice(1,r);try{s=JSON.parse("["+o+"]")}catch{s=o?o.split(","):[]}return s.map(a=>(0,Te.convertCell)(e,a))}return t};Te.toArray=m4;var g4=t=>typeof t=="string"?t.replace(" ","T"):t;Te.toTimestampString=g4;var y4=t=>{let e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};Te.httpEndpointURL=y4});var uC=v(mg=>{"use strict";Object.defineProperty(mg,"__esModule",{value:!0});var D4=Ul(),pg=class{constructor(e,r,n={},i=D4.DEFAULT_TIMEOUT){this.channel=e,this.event=r,this.payload=n,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,r){var n;return this._hasReceived(e)&&r((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:e,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);let e=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:r})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:r}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(r))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}};mg.default=pg});var yg=v(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.REALTIME_PRESENCE_LISTEN_EVENTS=void 0;var cC;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(cC||(yu.REALTIME_PRESENCE_LISTEN_EVENTS=cC={}));var gg=class t{constructor(e,r){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};let n=r?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},i=>{let{onJoin:s,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=t.syncState(this.state,i,s,o),this.pendingDiffs.forEach(u=>{this.state=t.syncDiff(this.state,u,s,o)}),this.pendingDiffs=[],a()}),this.channel._on(n.diff,{},i=>{let{onJoin:s,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=t.syncDiff(this.state,i,s,o),a())}),this.onJoin((i,s,o)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:s,newPresences:o})}),this.onLeave((i,s,o)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:s,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,r,n,i){let s=this.cloneDeep(e),o=this.transformState(r),a={},u={};return this.map(s,(c,l)=>{o[c]||(u[c]=l)}),this.map(o,(c,l)=>{let h=s[c];if(h){let d=l.map(b=>b.presence_ref),f=h.map(b=>b.presence_ref),m=l.filter(b=>f.indexOf(b.presence_ref)<0),g=h.filter(b=>d.indexOf(b.presence_ref)<0);m.length>0&&(a[c]=m),g.length>0&&(u[c]=g)}else a[c]=l}),this.syncDiff(s,{joins:a,leaves:u},n,i)}static syncDiff(e,r,n,i){let{joins:s,leaves:o}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return n||(n=()=>{}),i||(i=()=>{}),this.map(s,(a,u)=>{var c;let l=(c=e[a])!==null&&c!==void 0?c:[];if(e[a]=this.cloneDeep(u),l.length>0){let h=e[a].map(f=>f.presence_ref),d=l.filter(f=>h.indexOf(f.presence_ref)<0);e[a].unshift(...d)}n(a,l,u)}),this.map(o,(a,u)=>{let c=e[a];if(!c)return;let l=u.map(h=>h.presence_ref);c=c.filter(h=>l.indexOf(h.presence_ref)<0),e[a]=c,i(a,c,u),c.length===0&&delete e[a]}),e}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{let i=e[n];return"metas"in i?r[n]=i.metas.map(s=>(s.presence_ref=s.phx_ref,delete s.phx_ref,delete s.phx_ref_prev,s)):r[n]=i,r},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}};yu.default=gg});var bg=v(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.REALTIME_CHANNEL_STATES=Qr.REALTIME_SUBSCRIBE_STATES=Qr.REALTIME_LISTEN_TYPES=Qr.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=void 0;var Vl=(fe(),ue(le)),He=Ul(),Dg=Vl.__importDefault(uC()),w4=Vl.__importDefault(hg()),b4=Vl.__importDefault(yg()),lC=Vl.__importStar(Hl()),v4=Hl(),fC;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(fC||(Qr.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=fC={}));var Du;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Du||(Qr.REALTIME_LISTEN_TYPES=Du={}));var Un;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Un||(Qr.REALTIME_SUBSCRIBE_STATES=Un={}));Qr.REALTIME_CHANNEL_STATES=He.CHANNEL_STATES;var wg=class t{constructor(e,r={config:{}},n){var i,s;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.state=He.CHANNEL_STATES.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.timeout=this.socket.timeout,this.joinPush=new Dg.default(this,He.CHANNEL_EVENTS.join,this.params,this.timeout),this.rejoinTimer=new w4.default(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=He.CHANNEL_STATES.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(o=>o.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=He.CHANNEL_STATES.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=He.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=He.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=He.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this._on(He.CHANNEL_EVENTS.reply,{},(o,a)=>{this._trigger(this._replyEventName(a),o)}),this.presence=new b4.default(this),this.broadcastEndpointURL=(0,v4.httpEndpointURL)(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((s=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||s===void 0)&&s.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,r=this.timeout){var n,i,s;if(this.socket.isConnected()||this.socket.connect(),this.state==He.CHANNEL_STATES.closed){let{config:{broadcast:o,presence:a,private:u}}=this.params,c=(i=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&i!==void 0?i:[],l=!!this.bindings[Du.PRESENCE]&&this.bindings[Du.PRESENCE].length>0||((s=this.params.config.presence)===null||s===void 0?void 0:s.enabled)===!0,h={},d={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:l}),postgres_changes:c,private:u};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>e?.(Un.CHANNEL_ERROR,f)),this._onClose(()=>e?.(Un.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:f})=>{var m;if(this.socket.setAuth(),f===void 0){e?.(Un.SUBSCRIBED);return}else{let g=this.bindings.postgres_changes,b=(m=g?.length)!==null&&m!==void 0?m:0,S=[];for(let A=0;A<b;A++){let p=g[A],{filter:{event:y,schema:w,table:_,filter:P}}=p,E=f&&f[A];if(E&&E.event===y&&E.schema===w&&E.table===_&&E.filter===P)S.push(Object.assign(Object.assign({},p),{id:E.id}));else{this.unsubscribe(),this.state=He.CHANNEL_STATES.errored,e?.(Un.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=S,e&&e(Un.SUBSCRIBED);return}}).receive("error",f=>{this.state=He.CHANNEL_STATES.errored,e?.(Un.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e?.(Un.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){return this.state===He.CHANNEL_STATES.joined&&e===Du.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,r,n)}async httpSend(e,r,n={}){var i;let s=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(r==null)return Promise.reject("Payload is required for httpSend()");let o={method:"POST",headers:{Authorization:s,apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:r,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(i=n.timeout)!==null&&i!==void 0?i:this.timeout);if(a.status===202)return{success:!0};let u=a.statusText;try{let c=await a.json();u=c.error||c.message||u}catch{}return Promise.reject(new Error(u))}async send(e,r={}){var n,i;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");let{event:s,payload:o}=e,u={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:o,private:this.private}]})};try{let c=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((i=c.body)===null||i===void 0?void 0:i.cancel()),c.ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var o,a,u;let c=this._push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((u=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||u===void 0)&&u.ack)&&s("ok"),c.receive("ok",()=>s("ok")),c.receive("error",()=>s("error")),c.receive("timeout",()=>s("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=He.CHANNEL_STATES.leaving;let r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(He.CHANNEL_EVENTS.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(i=>{n=new Dg.default(this,He.CHANNEL_EVENTS.leave,{},e),n.receive("ok",()=>{r(),i("ok")}).receive("timeout",()=>{r(),i("timed out")}).receive("error",()=>{i("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n?.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=He.CHANNEL_STATES.closed,this.bindings={}}async _fetchWithTimeout(e,r,n){let i=new AbortController,s=setTimeout(()=>i.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:i.signal}));return clearTimeout(s),o}_push(e,r,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new Dg.default(this,e,r,n);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>He.MAX_PUSH_BUFFER_SIZE){let r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(e,r,n){return r}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,r,n){var i,s;let o=e.toLocaleLowerCase(),{close:a,error:u,leave:c,join:l}=He.CHANNEL_EVENTS;if(n&&[a,u,c,l].indexOf(o)>=0&&n!==this._joinRef())return;let d=this._onMessage(o,r,n);if(r&&!d)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(f=>{var m,g,b;return((m=f.filter)===null||m===void 0?void 0:m.event)==="*"||((b=(g=f.filter)===null||g===void 0?void 0:g.event)===null||b===void 0?void 0:b.toLocaleLowerCase())===o}).map(f=>f.callback(d,n)):(s=this.bindings[o])===null||s===void 0||s.filter(f=>{var m,g,b,S,A,p;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in f){let y=f.id,w=(m=f.filter)===null||m===void 0?void 0:m.event;return y&&((g=r.ids)===null||g===void 0?void 0:g.includes(y))&&(w==="*"||w?.toLocaleLowerCase()===((b=r.data)===null||b===void 0?void 0:b.type.toLocaleLowerCase()))}else{let y=(A=(S=f?.filter)===null||S===void 0?void 0:S.event)===null||A===void 0?void 0:A.toLocaleLowerCase();return y==="*"||y===((p=r?.event)===null||p===void 0?void 0:p.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===o}).map(f=>{if(typeof d=="object"&&"ids"in d){let m=d.data,{schema:g,table:b,commit_timestamp:S,type:A,errors:p}=m;d=Object.assign(Object.assign({},{schema:g,table:b,commit_timestamp:S,eventType:A,new:{},old:{},errors:p}),this._getPayloadRecords(m))}f.callback(d,n)})}_isClosed(){return this.state===He.CHANNEL_STATES.closed}_isJoined(){return this.state===He.CHANNEL_STATES.joined}_isJoining(){return this.state===He.CHANNEL_STATES.joining}_isLeaving(){return this.state===He.CHANNEL_STATES.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,r,n){let i=e.toLocaleLowerCase(),s={type:i,filter:r,callback:n};return this.bindings[i]?this.bindings[i].push(s):this.bindings[i]=[s],this}_off(e,r){let n=e.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(i=>{var s;return!(((s=i.type)===null||s===void 0?void 0:s.toLocaleLowerCase())===n&&t.isEqual(i.filter,r))})),this}static isEqual(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(let n in e)if(e[n]!==r[n])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(He.CHANNEL_EVENTS.close,{},e)}_onError(e){this._on(He.CHANNEL_EVENTS.error,{},r=>e(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=He.CHANNEL_STATES.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=lC.convertChangeData(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=lC.convertChangeData(e.columns,e.old_record)),r}};Qr.default=wg});var hC=v(_g=>{"use strict";Object.defineProperty(_g,"__esModule",{value:!0});var Gl=(fe(),ue(le)),E4=Gl.__importDefault(ag()),Vt=Ul(),_4=Gl.__importDefault(aC()),C4=Gl.__importDefault(hg()),S4=Hl(),A4=Gl.__importDefault(bg()),vg=()=>{},zl={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},O4=[1e3,2e3,5e3,1e4],x4=1e4,T4=`
|
|
5
|
+
Suggested solution: ${e.workaround}`),new Error(r)}static createWebSocket(e,r){let n=this.getWebSocketConstructor();return new n(e,r)}static isWebSocketSupported(){try{let e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}};gu.WebSocketFactory=Ml;gu.default=Ml});var eC=v(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});ql.version=void 0;ql.version="2.79.0"});var Ul=v(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.CONNECTION_STATE=nt.TRANSPORTS=nt.CHANNEL_EVENTS=nt.CHANNEL_STATES=nt.SOCKET_STATES=nt.MAX_PUSH_BUFFER_SIZE=nt.WS_CLOSE_NORMAL=nt.DEFAULT_TIMEOUT=nt.VERSION=nt.VSN=nt.DEFAULT_VERSION=void 0;var oC=eC();nt.DEFAULT_VERSION=`realtime-js/${oC.version}`;nt.VSN="1.0.0";nt.VERSION=oC.version;nt.DEFAULT_TIMEOUT=1e4;nt.WS_CLOSE_NORMAL=1e3;nt.MAX_PUSH_BUFFER_SIZE=100;var tC;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(tC||(nt.SOCKET_STATES=tC={}));var rC;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(rC||(nt.CHANNEL_STATES=rC={}));var nC;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(nC||(nt.CHANNEL_EVENTS=nC={}));var iC;(function(t){t.websocket="websocket"})(iC||(nt.TRANSPORTS=iC={}));var sC;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(sC||(nt.CONNECTION_STATE=sC={}))});var aC=v(cg=>{"use strict";Object.defineProperty(cg,"__esModule",{value:!0});var ug=class{constructor(){this.HEADER_LENGTH=1}decode(e,r){return e.constructor===ArrayBuffer?r(this._binaryDecode(e)):r(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){let r=new DataView(e),n=new TextDecoder;return this._decodeBroadcast(e,r,n)}_decodeBroadcast(e,r,n){let i=r.getUint8(1),s=r.getUint8(2),o=this.HEADER_LENGTH+2,a=n.decode(e.slice(o,o+i));o=o+i;let u=n.decode(e.slice(o,o+s));o=o+s;let c=JSON.parse(n.decode(e.slice(o,e.byteLength)));return{ref:null,topic:a,event:u,payload:c}}};cg.default=ug});var hg=v(fg=>{"use strict";Object.defineProperty(fg,"__esModule",{value:!0});var lg=class{constructor(e,r){this.callback=e,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=r}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}};fg.default=lg});var Hl=v(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.httpEndpointURL=Te.toTimestampString=Te.toArray=Te.toJson=Te.toNumber=Te.toBoolean=Te.convertCell=Te.convertColumn=Te.convertChangeData=Te.PostgresTypes=void 0;var Ue;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(Ue||(Te.PostgresTypes=Ue={}));var c4=(t,e,r={})=>{var n;let i=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((s,o)=>(s[o]=(0,Te.convertColumn)(o,t,e,i),s),{}):{}};Te.convertChangeData=c4;var l4=(t,e,r,n)=>{let i=e.find(a=>a.name===t),s=i?.type,o=r[t];return s&&!n.includes(s)?(0,Te.convertCell)(s,o):dg(o)};Te.convertColumn=l4;var f4=(t,e)=>{if(t.charAt(0)==="_"){let r=t.slice(1,t.length);return(0,Te.toArray)(e,r)}switch(t){case Ue.bool:return(0,Te.toBoolean)(e);case Ue.float4:case Ue.float8:case Ue.int2:case Ue.int4:case Ue.int8:case Ue.numeric:case Ue.oid:return(0,Te.toNumber)(e);case Ue.json:case Ue.jsonb:return(0,Te.toJson)(e);case Ue.timestamp:return(0,Te.toTimestampString)(e);case Ue.abstime:case Ue.date:case Ue.daterange:case Ue.int4range:case Ue.int8range:case Ue.money:case Ue.reltime:case Ue.text:case Ue.time:case Ue.timestamptz:case Ue.timetz:case Ue.tsrange:case Ue.tstzrange:return dg(e);default:return dg(e)}};Te.convertCell=f4;var dg=t=>t,h4=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}};Te.toBoolean=h4;var d4=t=>{if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return e}return t};Te.toNumber=d4;var p4=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t};Te.toJson=p4;var m4=(t,e)=>{if(typeof t!="string")return t;let r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let s,o=t.slice(1,r);try{s=JSON.parse("["+o+"]")}catch{s=o?o.split(","):[]}return s.map(a=>(0,Te.convertCell)(e,a))}return t};Te.toArray=m4;var g4=t=>typeof t=="string"?t.replace(" ","T"):t;Te.toTimestampString=g4;var y4=t=>{let e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};Te.httpEndpointURL=y4});var uC=v(mg=>{"use strict";Object.defineProperty(mg,"__esModule",{value:!0});var D4=Ul(),pg=class{constructor(e,r,n={},i=D4.DEFAULT_TIMEOUT){this.channel=e,this.event=r,this.payload=n,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,r){var n;return this._hasReceived(e)&&r((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:e,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);let e=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:r})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:r}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(r))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}};mg.default=pg});var yg=v(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.REALTIME_PRESENCE_LISTEN_EVENTS=void 0;var cC;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(cC||(yu.REALTIME_PRESENCE_LISTEN_EVENTS=cC={}));var gg=class t{constructor(e,r){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};let n=r?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},i=>{let{onJoin:s,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=t.syncState(this.state,i,s,o),this.pendingDiffs.forEach(u=>{this.state=t.syncDiff(this.state,u,s,o)}),this.pendingDiffs=[],a()}),this.channel._on(n.diff,{},i=>{let{onJoin:s,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=t.syncDiff(this.state,i,s,o),a())}),this.onJoin((i,s,o)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:s,newPresences:o})}),this.onLeave((i,s,o)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:s,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,r,n,i){let s=this.cloneDeep(e),o=this.transformState(r),a={},u={};return this.map(s,(c,l)=>{o[c]||(u[c]=l)}),this.map(o,(c,l)=>{let h=s[c];if(h){let d=l.map(b=>b.presence_ref),f=h.map(b=>b.presence_ref),m=l.filter(b=>f.indexOf(b.presence_ref)<0),g=h.filter(b=>d.indexOf(b.presence_ref)<0);m.length>0&&(a[c]=m),g.length>0&&(u[c]=g)}else a[c]=l}),this.syncDiff(s,{joins:a,leaves:u},n,i)}static syncDiff(e,r,n,i){let{joins:s,leaves:o}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return n||(n=()=>{}),i||(i=()=>{}),this.map(s,(a,u)=>{var c;let l=(c=e[a])!==null&&c!==void 0?c:[];if(e[a]=this.cloneDeep(u),l.length>0){let h=e[a].map(f=>f.presence_ref),d=l.filter(f=>h.indexOf(f.presence_ref)<0);e[a].unshift(...d)}n(a,l,u)}),this.map(o,(a,u)=>{let c=e[a];if(!c)return;let l=u.map(h=>h.presence_ref);c=c.filter(h=>l.indexOf(h.presence_ref)<0),e[a]=c,i(a,c,u),c.length===0&&delete e[a]}),e}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{let i=e[n];return"metas"in i?r[n]=i.metas.map(s=>(s.presence_ref=s.phx_ref,delete s.phx_ref,delete s.phx_ref_prev,s)):r[n]=i,r},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}};yu.default=gg});var bg=v(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.REALTIME_CHANNEL_STATES=Qr.REALTIME_SUBSCRIBE_STATES=Qr.REALTIME_LISTEN_TYPES=Qr.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=void 0;var Vl=(fe(),ue(le)),He=Ul(),Dg=Vl.__importDefault(uC()),w4=Vl.__importDefault(hg()),b4=Vl.__importDefault(yg()),lC=Vl.__importStar(Hl()),v4=Hl(),fC;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(fC||(Qr.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=fC={}));var Du;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Du||(Qr.REALTIME_LISTEN_TYPES=Du={}));var Un;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Un||(Qr.REALTIME_SUBSCRIBE_STATES=Un={}));Qr.REALTIME_CHANNEL_STATES=He.CHANNEL_STATES;var wg=class t{constructor(e,r={config:{}},n){var i,s;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.state=He.CHANNEL_STATES.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.timeout=this.socket.timeout,this.joinPush=new Dg.default(this,He.CHANNEL_EVENTS.join,this.params,this.timeout),this.rejoinTimer=new w4.default(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=He.CHANNEL_STATES.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(o=>o.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=He.CHANNEL_STATES.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=He.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=He.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=He.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this._on(He.CHANNEL_EVENTS.reply,{},(o,a)=>{this._trigger(this._replyEventName(a),o)}),this.presence=new b4.default(this),this.broadcastEndpointURL=(0,v4.httpEndpointURL)(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((s=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||s===void 0)&&s.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,r=this.timeout){var n,i,s;if(this.socket.isConnected()||this.socket.connect(),this.state==He.CHANNEL_STATES.closed){let{config:{broadcast:o,presence:a,private:u}}=this.params,c=(i=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&i!==void 0?i:[],l=!!this.bindings[Du.PRESENCE]&&this.bindings[Du.PRESENCE].length>0||((s=this.params.config.presence)===null||s===void 0?void 0:s.enabled)===!0,h={},d={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:l}),postgres_changes:c,private:u};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>e?.(Un.CHANNEL_ERROR,f)),this._onClose(()=>e?.(Un.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:f})=>{var m;if(this.socket.setAuth(),f===void 0){e?.(Un.SUBSCRIBED);return}else{let g=this.bindings.postgres_changes,b=(m=g?.length)!==null&&m!==void 0?m:0,S=[];for(let A=0;A<b;A++){let p=g[A],{filter:{event:D,schema:w,table:_,filter:P}}=p,E=f&&f[A];if(E&&E.event===D&&E.schema===w&&E.table===_&&E.filter===P)S.push(Object.assign(Object.assign({},p),{id:E.id}));else{this.unsubscribe(),this.state=He.CHANNEL_STATES.errored,e?.(Un.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=S,e&&e(Un.SUBSCRIBED);return}}).receive("error",f=>{this.state=He.CHANNEL_STATES.errored,e?.(Un.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e?.(Un.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){return this.state===He.CHANNEL_STATES.joined&&e===Du.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,r,n)}async httpSend(e,r,n={}){var i;let s=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(r==null)return Promise.reject("Payload is required for httpSend()");let o={method:"POST",headers:{Authorization:s,apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:r,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(i=n.timeout)!==null&&i!==void 0?i:this.timeout);if(a.status===202)return{success:!0};let u=a.statusText;try{let c=await a.json();u=c.error||c.message||u}catch{}return Promise.reject(new Error(u))}async send(e,r={}){var n,i;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");let{event:s,payload:o}=e,u={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:o,private:this.private}]})};try{let c=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((i=c.body)===null||i===void 0?void 0:i.cancel()),c.ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var o,a,u;let c=this._push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((u=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||u===void 0)&&u.ack)&&s("ok"),c.receive("ok",()=>s("ok")),c.receive("error",()=>s("error")),c.receive("timeout",()=>s("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=He.CHANNEL_STATES.leaving;let r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(He.CHANNEL_EVENTS.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(i=>{n=new Dg.default(this,He.CHANNEL_EVENTS.leave,{},e),n.receive("ok",()=>{r(),i("ok")}).receive("timeout",()=>{r(),i("timed out")}).receive("error",()=>{i("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n?.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=He.CHANNEL_STATES.closed,this.bindings={}}async _fetchWithTimeout(e,r,n){let i=new AbortController,s=setTimeout(()=>i.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:i.signal}));return clearTimeout(s),o}_push(e,r,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new Dg.default(this,e,r,n);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>He.MAX_PUSH_BUFFER_SIZE){let r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(e,r,n){return r}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,r,n){var i,s;let o=e.toLocaleLowerCase(),{close:a,error:u,leave:c,join:l}=He.CHANNEL_EVENTS;if(n&&[a,u,c,l].indexOf(o)>=0&&n!==this._joinRef())return;let d=this._onMessage(o,r,n);if(r&&!d)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(f=>{var m,g,b;return((m=f.filter)===null||m===void 0?void 0:m.event)==="*"||((b=(g=f.filter)===null||g===void 0?void 0:g.event)===null||b===void 0?void 0:b.toLocaleLowerCase())===o}).map(f=>f.callback(d,n)):(s=this.bindings[o])===null||s===void 0||s.filter(f=>{var m,g,b,S,A,p;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in f){let D=f.id,w=(m=f.filter)===null||m===void 0?void 0:m.event;return D&&((g=r.ids)===null||g===void 0?void 0:g.includes(D))&&(w==="*"||w?.toLocaleLowerCase()===((b=r.data)===null||b===void 0?void 0:b.type.toLocaleLowerCase()))}else{let D=(A=(S=f?.filter)===null||S===void 0?void 0:S.event)===null||A===void 0?void 0:A.toLocaleLowerCase();return D==="*"||D===((p=r?.event)===null||p===void 0?void 0:p.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===o}).map(f=>{if(typeof d=="object"&&"ids"in d){let m=d.data,{schema:g,table:b,commit_timestamp:S,type:A,errors:p}=m;d=Object.assign(Object.assign({},{schema:g,table:b,commit_timestamp:S,eventType:A,new:{},old:{},errors:p}),this._getPayloadRecords(m))}f.callback(d,n)})}_isClosed(){return this.state===He.CHANNEL_STATES.closed}_isJoined(){return this.state===He.CHANNEL_STATES.joined}_isJoining(){return this.state===He.CHANNEL_STATES.joining}_isLeaving(){return this.state===He.CHANNEL_STATES.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,r,n){let i=e.toLocaleLowerCase(),s={type:i,filter:r,callback:n};return this.bindings[i]?this.bindings[i].push(s):this.bindings[i]=[s],this}_off(e,r){let n=e.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(i=>{var s;return!(((s=i.type)===null||s===void 0?void 0:s.toLocaleLowerCase())===n&&t.isEqual(i.filter,r))})),this}static isEqual(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(let n in e)if(e[n]!==r[n])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(He.CHANNEL_EVENTS.close,{},e)}_onError(e){this._on(He.CHANNEL_EVENTS.error,{},r=>e(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=He.CHANNEL_STATES.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=lC.convertChangeData(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=lC.convertChangeData(e.columns,e.old_record)),r}};Qr.default=wg});var hC=v(_g=>{"use strict";Object.defineProperty(_g,"__esModule",{value:!0});var Gl=(fe(),ue(le)),E4=Gl.__importDefault(ag()),Vt=Ul(),_4=Gl.__importDefault(aC()),C4=Gl.__importDefault(hg()),S4=Hl(),A4=Gl.__importDefault(bg()),vg=()=>{},zl={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},O4=[1e3,2e3,5e3,1e4],x4=1e4,T4=`
|
|
6
6
|
addEventListener("message", (e) => {
|
|
7
7
|
if (e.data.event === "start") {
|
|
8
8
|
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
@@ -36,40 +36,40 @@ Not Before: ${a.toISOString()}`),u&&(S+=`
|
|
|
36
36
|
Request ID: ${u}`),c){let A=`
|
|
37
37
|
Resources:`;for(let p of c){if(!p||typeof p!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${p}`);A+=`
|
|
38
38
|
- ${p}`}S+=A}return`${b}
|
|
39
|
-
${S}`}});var XC=v(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.WebAuthnUnknownError=zn.WebAuthnError=void 0;zn.isWebAuthnError=V9;zn.identifyRegistrationError=z9;zn.identifyAuthenticationError=G9;var WC=ky(),at=class extends Error{constructor({message:e,code:r,cause:n,name:i}){var s;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(s=i??(n instanceof Error?n.name:void 0))!==null&&s!==void 0?s:"Unknown Error",this.code=r}};zn.WebAuthnError=at;var Py=class extends at{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}};zn.WebAuthnUnknownError=Py;function V9(t){return typeof t=="object"&&t!==null&&"__isWebAuthnError"in t}function z9({error:t,options:e}){var r,n,i;let{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new at({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=s.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new at({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=s.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new at({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=s.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new at({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new at({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new at({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return s.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new at({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new at({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){let o=window.location.hostname;if((0,WC.isValidDomain)(o)){if(s.rp.id!==o)return new at({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new at({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new at({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new at({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new at({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function G9({error:t,options:e}){let{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new at({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new at({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){let n=window.location.hostname;if((0,WC.isValidDomain)(n)){if(r.rpId!==n)return new at({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new at({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new at({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new at({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}});var ky=v(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.WebAuthnApi=Se.DEFAULT_REQUEST_OPTIONS=Se.DEFAULT_CREATION_OPTIONS=Se.webAuthnAbortService=Se.WebAuthnAbortService=Se.identifyAuthenticationError=Se.identifyRegistrationError=Se.isWebAuthnError=Se.WebAuthnError=void 0;Se.deserializeCredentialCreationOptions=W9;Se.deserializeCredentialRequestOptions=X9;Se.serializeCredentialCreationResponse=Y9;Se.serializeCredentialRequestResponse=J9;Se.isValidDomain=Z9;Se.createCredential=ZC;Se.getCredential=QC;Se.mergeCredentialCreationOptions=eS;Se.mergeCredentialRequestOptions=tS;var JC=(fe(),ue(le)),rn=yf(),dn=fs(),K9=Ro(),pn=XC();Object.defineProperty(Se,"identifyAuthenticationError",{enumerable:!0,get:function(){return pn.identifyAuthenticationError}});Object.defineProperty(Se,"identifyRegistrationError",{enumerable:!0,get:function(){return pn.identifyRegistrationError}});Object.defineProperty(Se,"isWebAuthnError",{enumerable:!0,get:function(){return pn.isWebAuthnError}});Object.defineProperty(Se,"WebAuthnError",{enumerable:!0,get:function(){return pn.WebAuthnError}});var Cf=class{createNewAbortSignal(){if(this.controller){let r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}};Se.WebAuthnAbortService=Cf;Se.webAuthnAbortService=new Cf;function W9(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);let{challenge:e,user:r,excludeCredentials:n}=t,i=JC.__rest(t,["challenge","user","excludeCredentials"]),s=(0,rn.base64UrlToUint8Array)(e).buffer,o=Object.assign(Object.assign({},r),{id:(0,rn.base64UrlToUint8Array)(r.id).buffer}),a=Object.assign(Object.assign({},i),{challenge:s,user:o});if(n&&n.length>0){a.excludeCredentials=new Array(n.length);for(let u=0;u<n.length;u++){let c=n[u];a.excludeCredentials[u]=Object.assign(Object.assign({},c),{id:(0,rn.base64UrlToUint8Array)(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function X9(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);let{challenge:e,allowCredentials:r}=t,n=JC.__rest(t,["challenge","allowCredentials"]),i=(0,rn.base64UrlToUint8Array)(e).buffer,s=Object.assign(Object.assign({},n),{challenge:i});if(r&&r.length>0){s.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){let a=r[o];s.allowCredentials[o]=Object.assign(Object.assign({},a),{id:(0,rn.base64UrlToUint8Array)(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return s}function Y9(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();let r=t;return{id:t.id,rawId:t.id,response:{attestationObject:(0,rn.bytesToBase64URL)(new Uint8Array(t.response.attestationObject)),clientDataJSON:(0,rn.bytesToBase64URL)(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function J9(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();let r=t,n=t.getClientExtensionResults(),i=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:(0,rn.bytesToBase64URL)(new Uint8Array(i.authenticatorData)),clientDataJSON:(0,rn.bytesToBase64URL)(new Uint8Array(i.clientDataJSON)),signature:(0,rn.bytesToBase64URL)(new Uint8Array(i.signature)),userHandle:i.userHandle?(0,rn.bytesToBase64URL)(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Z9(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function YC(){var t,e;return!!((0,K9.isBrowser)()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function ZC(t){try{let e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new pn.WebAuthnUnknownError("Browser returned unexpected credential type",e)}:{data:null,error:new pn.WebAuthnUnknownError("Empty credential response",e)}}catch(e){return{data:null,error:(0,pn.identifyRegistrationError)({error:e,options:t})}}}async function QC(t){try{let e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new pn.WebAuthnUnknownError("Browser returned unexpected credential type",e)}:{data:null,error:new pn.WebAuthnUnknownError("Empty credential response",e)}}catch(e){return{data:null,error:(0,pn.identifyAuthenticationError)({error:e,options:t})}}}Se.DEFAULT_CREATION_OPTIONS={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"none"};Se.DEFAULT_REQUEST_OPTIONS={userVerification:"preferred",hints:["security-key"]};function Sf(...t){let e=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),r=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),n={};for(let i of t)if(i)for(let s in i){let o=i[s];if(o!==void 0)if(Array.isArray(o))n[s]=o;else if(r(o))n[s]=o;else if(e(o)){let a=n[s];e(a)?n[s]=Sf(a,o):n[s]=Sf(o)}else n[s]=o}return n}function eS(t,e){return Sf(Se.DEFAULT_CREATION_OPTIONS,t,e||{})}function tS(t,e){return Sf(Se.DEFAULT_REQUEST_OPTIONS,t,e||{})}var Ry=class{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:i},s){try{let{data:o,error:a}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!o)return{data:null,error:a};let u=i??Se.webAuthnAbortService.createNewAbortSignal();if(o.webauthn.type==="create"){let{user:c}=o.webauthn.credential_options.publicKey;c.name||(c.name=`${c.id}:${n}`),c.displayName||(c.displayName=c.name)}switch(o.webauthn.type){case"create":{let c=eS(o.webauthn.credential_options.publicKey,s?.create),{data:l,error:h}=await ZC({publicKey:c,signal:u});return l?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:l}},error:null}:{data:null,error:h}}case"request":{let c=tS(o.webauthn.credential_options.publicKey,s?.request),{data:l,error:h}=await QC(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:c,signal:u}));return l?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:l}},error:null}:{data:null,error:h}}}}catch(o){return(0,dn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new dn.AuthUnknownError("Unexpected error in challenge",o)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i}},s){if(!r)return{data:null,error:new dn.AuthError("rpId is required for WebAuthn authentication")};try{if(!YC())return{data:null,error:new dn.AuthUnknownError("Browser does not support WebAuthn",null)};let{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:i},{request:s});if(!o)return{data:null,error:a};let{webauthn:u}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:u.type,rpId:r,rpOrigins:n,credential_response:u.credential_response}})}catch(o){return(0,dn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new dn.AuthUnknownError("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i},s){if(!r)return{data:null,error:new dn.AuthError("rpId is required for WebAuthn registration")};try{if(!YC())return{data:null,error:new dn.AuthUnknownError("Browser does not support WebAuthn",null)};let{data:o,error:a}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(l=>{var h;return(h=l.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===e&&d.status!=="unverified")}).then(l=>l?this.client.mfa.unenroll({factorId:l?.id}):void 0),{data:null,error:a};let{data:u,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:i},{create:s});return u?this._verify({factorId:o.id,challengeId:u.challengeId,webauthn:{rpId:r,rpOrigins:n,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:c}}catch(o){return(0,dn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new dn.AuthUnknownError("Unexpected error in register",o)}}}};Se.WebAuthnApi=Ry});var $y=v(Ny=>{"use strict";Object.defineProperty(Ny,"__esModule",{value:!0});var Q9=(fe(),ue(le)),e7=Q9.__importDefault(vf()),Dr=mf(),ee=fs(),he=Cy(),se=Ro(),rS=HC(),nS=Fy(),t7=zC(),r7=uy(),iS=yf(),Af=KC(),Pu=ky();(0,t7.polyfillGlobalThis)();var n7={url:Dr.GOTRUE_URL,storageKey:Dr.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Dr.DEFAULT_HEADERS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function sS(t,e,r){return await r()}var $o={},Of=class t{get jwks(){var e,r;return(r=(e=$o[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){$o[this.storageKey]=Object.assign(Object.assign({},$o[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=$o[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){$o[this.storageKey]=Object.assign(Object.assign({},$o[this.storageKey]),{cachedAt:e})}constructor(e){var r,n;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=t.nextInstanceID,t.nextInstanceID+=1,this.instanceID>0&&(0,se.isBrowser)()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");let i=Object.assign(Object.assign({},n7),e);if(this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.persistSession=i.persistSession,this.storageKey=i.storageKey,this.autoRefreshToken=i.autoRefreshToken,this.admin=new e7.default({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=(0,se.resolveFetch)(i.fetch),this.lock=i.lock||sS,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,i.lock?this.lock=i.lock:(0,se.isBrowser)()&&(!((r=globalThis?.navigator)===null||r===void 0)&&r.locks)?this.lock=nS.navigatorLock:this.lock=sS,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new Pu.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:(0,se.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,rS.memoryLocalStorageAdapter)(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=(0,rS.memoryLocalStorageAdapter)(this.memoryStorage)),(0,se.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(s){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",s)}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",async s=>{this._debug("received broadcast notification from other tab or client",s),await this._notifyAllSubscribers(s.data.event,s.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${r7.version}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let r={},n="none";if((0,se.isBrowser)()&&(r=(0,se.parseParametersFromURL)(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),(0,se.isBrowser)()&&this.detectSessionInUrl&&n!=="none"){let{data:i,error:s}=await this._getSessionFromURL(r,n);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),(0,ee.isAuthImplicitGrantRedirectError)(s)){let u=(e=s.details)===null||e===void 0?void 0:e.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:s}}return await this._removeSession(),{error:s}}let{session:o,redirectType:a}=i;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return(0,ee.isAuthError)(r)?this._returnResult({error:r}):this._returnResult({error:new ee.AuthUnknownError("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,i;try{let s=await(0,he._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e?.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(i=e?.options)===null||i===void 0?void 0:i.captchaToken}},xform:he._sessionResponse}),{data:o,error:a}=s;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});let u=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(e){var r,n,i;try{let s;if("email"in e){let{email:l,password:h,options:d}=e,f=null,m=null;this.flowType==="pkce"&&([f,m]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey)),s=await(0,he._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d?.emailRedirectTo,body:{email:l,password:h,data:(r=d?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:d?.captchaToken},code_challenge:f,code_challenge_method:m},xform:he._sessionResponse})}else if("phone"in e){let{phone:l,password:h,options:d}=e;s=await(0,he._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:l,password:h,data:(n=d?.data)!==null&&n!==void 0?n:{},channel:(i=d?.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:he._sessionResponse})}else throw new ee.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:o,error:a}=s;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});let u=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(e){try{let r;if("email"in e){let{email:s,password:o,options:a}=e;r=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:he._sessionResponsePassword})}else if("phone"in e){let{phone:s,password:o,options:a}=e;r=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:he._sessionResponsePassword})}else throw new ee.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:n,error:i}=r;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!n||!n.session||!n.user){let s=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:s})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:i})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,i,s;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(s=e.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){let{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,i,s,o,a,u,c,l,h,d;let f,m;if("message"in e)f=e.message,m=e.signature;else{let{chain:g,wallet:b,statement:S,options:A}=e,p;if((0,se.isBrowser)())if(typeof b=="object")p=b;else{let R=window;if("ethereum"in R&&typeof R.ethereum=="object"&&"request"in R.ethereum&&typeof R.ethereum.request=="function")p=R.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof b!="object"||!A?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");p=b}let y=new URL((r=A?.url)!==null&&r!==void 0?r:window.location.href),w=await p.request({method:"eth_requestAccounts"}).then(R=>R).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!w||w.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");let _=(0,Af.getAddress)(w[0]),P=(n=A?.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!P){let R=await p.request({method:"eth_chainId"});P=(0,Af.fromHex)(R)}let E={domain:y.host,address:_,statement:S,uri:y.href,version:"1",chainId:P,nonce:(i=A?.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(o=(s=A?.signInWithEthereum)===null||s===void 0?void 0:s.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=A?.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(u=A?.signInWithEthereum)===null||u===void 0?void 0:u.notBefore,requestId:(c=A?.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(l=A?.signInWithEthereum)===null||l===void 0?void 0:l.resources};f=(0,Af.createSiweMessage)(E),m=await p.request({method:"personal_sign",params:[(0,Af.toHex)(f),_]})}try{let{data:g,error:b}=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:m},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=e.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:he._sessionResponse});if(b)throw b;if(!g||!g.session||!g.user){let S=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:S})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:Object.assign({},g),error:b})}catch(g){if((0,ee.isAuthError)(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}}async signInWithSolana(e){var r,n,i,s,o,a,u,c,l,h,d,f;let m,g;if("message"in e)m=e.message,g=e.signature;else{let{chain:b,wallet:S,statement:A,options:p}=e,y;if((0,se.isBrowser)())if(typeof S=="object")y=S;else{let _=window;if("solana"in _&&typeof _.solana=="object"&&("signIn"in _.solana&&typeof _.solana.signIn=="function"||"signMessage"in _.solana&&typeof _.solana.signMessage=="function"))y=_.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof S!="object"||!p?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");y=S}let w=new URL((r=p?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in y&&y.signIn){let _=await y.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},p?.signInWithSolana),{version:"1",domain:w.host,uri:w.href}),A?{statement:A}:null)),P;if(Array.isArray(_)&&_[0]&&typeof _[0]=="object")P=_[0];else if(_&&typeof _=="object"&&"signedMessage"in _&&"signature"in _)P=_;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in P&&"signature"in P&&(typeof P.signedMessage=="string"||P.signedMessage instanceof Uint8Array)&&P.signature instanceof Uint8Array)m=typeof P.signedMessage=="string"?P.signedMessage:new TextDecoder().decode(P.signedMessage),g=P.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in y)||typeof y.signMessage!="function"||!("publicKey"in y)||typeof y!="object"||!y.publicKey||!("toBase58"in y.publicKey)||typeof y.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${w.host} wants you to sign in with your Solana account:`,y.publicKey.toBase58(),...A?["",A,""]:[""],"Version: 1",`URI: ${w.href}`,`Issued At: ${(i=(n=p?.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((s=p?.signInWithSolana)===null||s===void 0)&&s.notBefore?[`Not Before: ${p.signInWithSolana.notBefore}`]:[],...!((o=p?.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${p.signInWithSolana.expirationTime}`]:[],...!((a=p?.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${p.signInWithSolana.chainId}`]:[],...!((u=p?.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${p.signInWithSolana.nonce}`]:[],...!((c=p?.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${p.signInWithSolana.requestId}`]:[],...!((h=(l=p?.signInWithSolana)===null||l===void 0?void 0:l.resources)===null||h===void 0)&&h.length?["Resources",...p.signInWithSolana.resources.map(P=>`- ${P}`)]:[]].join(`
|
|
40
|
-
`);let _=await y.signMessage(new TextEncoder().encode(m),"utf8");if(!_||!(_ instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=_}}try{let{data:b,error:S}=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:(0,iS.bytesToBase64URL)(g)},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:he._sessionResponse});if(S)throw S;if(!b||!b.session||!b.user){let A=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:A})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:S})}catch(b){if((0,ee.isAuthError)(b))return this._returnResult({data:{user:null,session:null},error:b});throw b}}async _exchangeCodeForSession(e){let r=await(0,se.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[n,i]=(r??"").split("/");try{let{data:s,error:o}=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:he._sessionResponse});if(await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!s||!s.session||!s.user){let a=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign(Object.assign({},s),{redirectType:i??null}),error:o})}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(e){try{let{options:r,provider:n,token:i,access_token:s,nonce:o}=e,a=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:i,access_token:s,nonce:o,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:he._sessionResponse}),{data:u,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!u||!u.session||!u.user){let l=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:l})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:u,error:c})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,i,s,o;try{if("email"in e){let{email:a,options:u}=e,c=null,l=null;this.flowType==="pkce"&&([c,l]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{error:h}=await(0,he._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(r=u?.data)!==null&&r!==void 0?r:{},create_user:(n=u?.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},code_challenge:c,code_challenge_method:l},redirectTo:u?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){let{phone:a,options:u}=e,{data:c,error:l}=await(0,he._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(i=u?.data)!==null&&i!==void 0?i:{},create_user:(s=u?.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},channel:(o=u?.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c?.message_id},error:l})}throw new ee.AuthInvalidCredentialsError("You must provide either an email or phone number.")}catch(a){if((0,ee.isAuthError)(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(e){var r,n;try{let i,s;"options"in e&&(i=(r=e.options)===null||r===void 0?void 0:r.redirectTo,s=(n=e.options)===null||n===void 0?void 0:n.captchaToken);let{data:o,error:a}=await(0,he._request)(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:i,xform:he._sessionResponse});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");let u=o.session,c=o.user;return u?.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(i){if((0,ee.isAuthError)(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(e){var r,n,i;try{let s=null,o=null;this.flowType==="pkce"&&([s,o]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let a=await(0,he._request)(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((i=e?.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:s,code_challenge_method:o}),headers:this.headers,xform:he._ssoResponse});return this._returnResult(a)}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:null,error:s});throw s}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new ee.AuthSessionMissingError;let{error:i}=await(0,he._request)(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(e){if((0,ee.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{let r=`${this.url}/resend`;if("email"in e){let{email:n,type:i,options:s}=e,{error:o}=await(0,he._request)(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:i,gotrue_meta_security:{captcha_token:s?.captchaToken}},redirectTo:s?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in e){let{phone:n,type:i,options:s}=e,{data:o,error:a}=await(0,he._request)(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:i,gotrue_meta_security:{captcha_token:s?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o?.message_id},error:a})}throw new ee.AuthInvalidCredentialsError("You must provide either an email or phone number and a type")}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){let i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{let r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null,r=await(0,se.getItemAsync)(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};let n=e.expires_at?e.expires_at*1e3-Date.now()<Dr.EXPIRY_MARGIN_MS:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){let o=await(0,se.getItemAsync)(this.userStorage,this.storageKey+"-user");o?.user?e.user=o.user:e.user=(0,se.userNotAvailableProxy)()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){let o={value:this.suppressGetSessionWarning};e.user=(0,se.insecureUserWarningProxy)(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}let{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{session:null},error:s}):this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await(0,he._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:he._userResponse}):await this._useSession(async r=>{var n,i,s;let{data:o,error:a}=r;if(a)throw a;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ee.AuthSessionMissingError}:await(0,he._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(i=o.session)===null||i===void 0?void 0:i.access_token)!==null&&s!==void 0?s:void 0,xform:he._userResponse})})}catch(r){if((0,ee.isAuthError)(r))return(0,ee.isAuthSessionMissingError)(r)&&(await this._removeSession(),await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async n=>{let{data:i,error:s}=n;if(s)throw s;if(!i.session)throw new ee.AuthSessionMissingError;let o=i.session,a=null,u=null;this.flowType==="pkce"&&e.email!=null&&([a,u]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{data:c,error:l}=await(0,he._request)(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:u}),jwt:o.access_token,xform:he._userResponse});if(l)throw l;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new ee.AuthSessionMissingError;let r=Date.now()/1e3,n=r,i=!0,s=null,{payload:o}=(0,se.decodeJWT)(e.access_token);if(o.exp&&(n=o.exp,i=n<=r),i){let{data:a,error:u}=await this._callRefreshToken(e.refresh_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!a)return{data:{user:null,session:null},error:null};s=a}else{let{data:a,error:u}=await this._getUser(e.access_token);if(u)throw u;s={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){let{data:o,error:a}=r;if(a)throw a;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!e?.refresh_token)throw new ee.AuthSessionMissingError;let{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){try{if(!(0,se.isBrowser)())throw new ee.AuthImplicitGrantRedirectError("No browser detected.");if(e.error||e.error_description||e.error_code)throw new ee.AuthImplicitGrantRedirectError(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new ee.AuthPKCEGrantCodeExchangeError("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ee.AuthImplicitGrantRedirectError("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new ee.AuthPKCEGrantCodeExchangeError("No code detected.");let{data:A,error:p}=await this._exchangeCodeForSession(e.code);if(p)throw p;let y=new URL(window.location.href);return y.searchParams.delete("code"),window.history.replaceState(window.history.state,"",y.toString()),{data:{session:A.session,redirectType:null},error:null}}let{provider_token:n,provider_refresh_token:i,access_token:s,refresh_token:o,expires_in:a,expires_at:u,token_type:c}=e;if(!s||!a||!o||!c)throw new ee.AuthImplicitGrantRedirectError("No session defined in URL");let l=Math.round(Date.now()/1e3),h=parseInt(a),d=l+h;u&&(d=parseInt(u));let f=d-l;f*1e3<=Dr.AUTO_REFRESH_TICK_DURATION_MS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${h}s`);let m=d-h;l-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,d,l):l-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",m,d,l);let{data:g,error:b}=await this._getUser(s);if(b)throw b;let S={provider_token:n,provider_refresh_token:i,access_token:s,expires_in:h,expires_at:d,refresh_token:o,token_type:c,user:g.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:S,redirectType:e.type},error:null})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){let r=await(0,se.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({error:s});let o=(n=i.session)===null||n===void 0?void 0:n.access_token;if(o){let{error:a}=await this.admin.signOut(o,e);if(a&&!((0,ee.isAuthApiError)(a)&&(a.status===404||a.status===401||a.status===403)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){let r=(0,se.uuid)(),n={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,i;try{let{data:{session:s},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(s){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),console.error(s)}})}async resetPasswordForEmail(e,r={}){let n=null,i=null;this.flowType==="pkce"&&([n,i]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,he._request)(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:i,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var e;try{let{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{let{data:n,error:i}=await this._useSession(async s=>{var o,a,u,c,l;let{data:h,error:d}=s;if(d)throw d;let f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(u=e.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await(0,he._request)(this.fetch,"GET",f,{headers:this.headers,jwt:(l=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&l!==void 0?l:void 0})});if(i)throw i;return(0,se.isBrowser)()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n?.url),this._returnResult({data:{provider:e.provider,url:n?.url},error:null})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{let{error:i,data:{session:s}}=r;if(i)throw i;let{options:o,provider:a,token:u,access_token:c,nonce:l}=e,h=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=s?.access_token)!==null&&n!==void 0?n:void 0,body:{provider:a,id_token:u,access_token:c,nonce:l,link_identity:!0,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:he._sessionResponse}),{data:d,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!d||!d.session||!d.user?this._returnResult({data:{user:null,session:null},error:new ee.AuthInvalidTokenResponseError}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(i){if((0,ee.isAuthError)(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,i;let{data:s,error:o}=r;if(o)throw o;return await(0,he._request)(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(n=s.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0})})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){let r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{let n=Date.now();return await(0,se.retryable)(async i=>(i>0&&await(0,se.sleep)(200*Math.pow(2,i-1)),this._debug(r,"refreshing attempt",i),await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:he._sessionResponse})),(i,s)=>{let o=200*Math.pow(2,i);return s&&(0,ee.isAuthRetryableFetchError)(s)&&Date.now()+o-n<Dr.AUTO_REFRESH_TICK_DURATION_MS})}catch(n){if(this._debug(r,"error",n),(0,ee.isAuthError)(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){let n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),(0,se.isBrowser)()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;let n="#_recoverAndRefresh()";this._debug(n,"begin");try{let i=await(0,se.getItemAsync)(this.storage,this.storageKey);if(i&&this.userStorage){let o=await(0,se.getItemAsync)(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:i.user},await(0,se.setItemAsync)(this.userStorage,this.storageKey+"-user",o)),i.user=(e=o?.user)!==null&&e!==void 0?e:(0,se.userNotAvailableProxy)()}else if(i&&!i.user&&!i.user){let o=await(0,se.getItemAsync)(this.storage,this.storageKey+"-user");o&&o?.user?(i.user=o.user,await(0,se.removeItemAsync)(this.storage,this.storageKey+"-user"),await(0,se.setItemAsync)(this.storage,this.storageKey,i)):i.user=(0,se.userNotAvailableProxy)()}if(this._debug(n,"session from storage",i),!this._isValidSession(i)){this._debug(n,"session is not valid"),i!==null&&await this._removeSession();return}let s=((r=i.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Dr.EXPIRY_MARGIN_MS;if(this._debug(n,`session has${s?"":" not"} expired with margin of ${Dr.EXPIRY_MARGIN_MS}s`),s){if(this.autoRefreshToken&&i.refresh_token){let{error:o}=await this._callRefreshToken(i.refresh_token);o&&(console.error(o),(0,ee.isAuthRetryableFetchError)(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{let{data:o,error:a}=await this._getUser(i.access_token);!a&&o?.user?(i.user=o.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(n,"error",i),console.error(i);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new ee.AuthSessionMissingError;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let i=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new se.Deferred;let{data:s,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!s.session)throw new ee.AuthSessionMissingError;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);let a={data:s.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(s){if(this._debug(i,"error",s),(0,ee.isAuthError)(s)){let o={data:null,error:s};return(0,ee.isAuthRetryableFetchError)(s)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(s),s}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,r,n=!0){let i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});let s=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,r)}catch(u){s.push(u)}});if(await Promise.all(o),s.length>0){for(let a=0;a<s.length;a+=1)console.error(s[a]);throw s[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;let r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await(0,se.setItemAsync)(this.userStorage,this.storageKey+"-user",{user:r.user});let i=Object.assign({},r);delete i.user;let s=(0,se.deepClone)(i);await(0,se.setItemAsync)(this.storage,this.storageKey,s)}else{let i=(0,se.deepClone)(r);await(0,se.setItemAsync)(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),await(0,se.removeItemAsync)(this.storage,this.storageKey),await(0,se.removeItemAsync)(this.storage,this.storageKey+"-code-verifier"),await(0,se.removeItemAsync)(this.storage,this.storageKey+"-user"),this.userStorage&&await(0,se.removeItemAsync)(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&(0,se.isBrowser)()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),Dr.AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{let e=Date.now();try{return await this._useSession(async r=>{let{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}let i=Math.floor((n.expires_at*1e3-e)/Dr.AUTO_REFRESH_TICK_DURATION_MS);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${Dr.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${Dr.AUTO_REFRESH_TICK_THRESHOLD} ticks`),i<=Dr.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof nS.LockAcquireTimeoutError)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!(0,se.isBrowser)()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let r=`#_onVisibilityChanged(${e})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,n){let i=[`provider=${encodeURIComponent(r)}`];if(n?.redirectTo&&i.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n?.scopes&&i.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){let[s,o]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(o)}`});i.push(a.toString())}if(n?.queryParams){let s=new URLSearchParams(n.queryParams);i.push(s.toString())}return n?.skipBrowserRedirect&&i.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;return s?this._returnResult({data:null,error:s}):await(0,he._request)(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,i;let{data:s,error:o}=r;if(o)return this._returnResult({data:null,error:o});let a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:u,error:c}=await(0,he._request)(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(n=s?.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&u.type==="totp"&&(!((i=u?.totp)===null||i===void 0)&&i.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),this._returnResult({data:u,error:null}))})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({data:null,error:s});let o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?(0,Pu.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,Pu.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:u}=await(0,he._request)(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token});return u?this._returnResult({data:null,error:u}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:u}))})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({data:null,error:s});let o=await(0,he._request)(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token});if(o.error)return o;let{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,Pu.deserializeCredentialCreationOptions)(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,Pu.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){let{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;let{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};let i={all:[],phone:[],totp:[],webauthn:[]};for(let s of(e=r?.factors)!==null&&e!==void 0?e:[])i.all.push(s),s.status==="verified"&&i[s.factor_type].push(s);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(){var e,r;let{data:{session:n},error:i}=await this.getSession();if(i)return this._returnResult({data:null,error:i});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:s}=(0,se.decodeJWT)(n.access_token),o=null;s.aal&&(o=s.aal);let a=o;((r=(e=n.user.factors)===null||e===void 0?void 0:e.filter(l=>l.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(a="aal2");let c=s.amr||[];return{data:{currentLevel:o,nextLevel:a,currentAuthenticationMethods:c},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{let{data:{session:n},error:i}=r;return i?this._returnResult({data:null,error:i}):n?await(0,he._request)(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new ee.AuthSessionMissingError})})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async n=>{let{data:{session:i},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new ee.AuthSessionMissingError});let o=await(0,he._request)(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&(0,se.isBrowser)()&&!r?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,r){try{return await this._useSession(async n=>{let{data:{session:i},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new ee.AuthSessionMissingError});let o=await(0,he._request)(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&(0,se.isBrowser)()&&!r?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(a=>a.kid===e);if(n)return n;let i=Date.now();if(n=this.jwks.keys.find(a=>a.kid===e),n&&this.jwks_cached_at+Dr.JWKS_TTL>i)return n;let{data:s,error:o}=await(0,he._request)(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!s.keys||s.keys.length===0||(this.jwks=s,this.jwks_cached_at=i,n=s.keys.find(a=>a.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){let{data:f,error:m}=await this.getSession();if(m||!f.session)return this._returnResult({data:null,error:m});n=f.session.access_token}let{header:i,payload:s,signature:o,raw:{header:a,payload:u}}=(0,se.decodeJWT)(n);r?.allowExpired||(0,se.validateExp)(s.exp);let c=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,r?.keys?{keys:r.keys}:r?.jwks);if(!c){let{error:f}=await this.getUser(n);if(f)throw f;return{data:{claims:s,header:i,signature:o},error:null}}let l=(0,se.getAlgorithm)(i.alg),h=await crypto.subtle.importKey("jwk",c,l,!0,["verify"]);if(!await crypto.subtle.verify(l,h,o,(0,iS.stringToUint8Array)(`${a}.${u}`)))throw new ee.AuthInvalidJwtError("Invalid JWT signature");return{data:{claims:s,header:i,signature:o},error:null}}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}};Of.nextInstanceID=0;Ny.default=Of});var oS=v(Ly=>{"use strict";Object.defineProperty(Ly,"__esModule",{value:!0});var i7=(fe(),ue(le)),s7=i7.__importDefault(vf()),o7=s7.default;Ly.default=o7});var aS=v(jy=>{"use strict";Object.defineProperty(jy,"__esModule",{value:!0});var a7=(fe(),ue(le)),u7=a7.__importDefault($y()),c7=u7.default;jy.default=c7});var By=v(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.processLock=At.lockInternals=At.NavigatorLockAcquireTimeoutError=At.navigatorLock=At.AuthClient=At.AuthAdminApi=At.GoTrueClient=At.GoTrueAdminApi=void 0;var Lo=(fe(),ue(le)),l7=Lo.__importDefault(vf());At.GoTrueAdminApi=l7.default;var f7=Lo.__importDefault($y());At.GoTrueClient=f7.default;var h7=Lo.__importDefault(oS());At.AuthAdminApi=h7.default;var d7=Lo.__importDefault(aS());At.AuthClient=d7.default;Lo.__exportStar(Sy(),At);Lo.__exportStar(fs(),At);var xf=Fy();Object.defineProperty(At,"navigatorLock",{enumerable:!0,get:function(){return xf.navigatorLock}});Object.defineProperty(At,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return xf.NavigatorLockAcquireTimeoutError}});Object.defineProperty(At,"lockInternals",{enumerable:!0,get:function(){return xf.internals}});Object.defineProperty(At,"processLock",{enumerable:!0,get:function(){return xf.processLock}})});var uS=v(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});Tf.SupabaseAuthClient=void 0;var p7=By(),My=class extends p7.AuthClient{constructor(e){super(e)}};Tf.SupabaseAuthClient=My});var Hy=v(Uy=>{"use strict";Object.defineProperty(Uy,"__esModule",{value:!0});var m7=Hm(),g7=og(),y7=Cg(),D7=TC(),Ff=IC(),w7=PC(),cS=RC(),b7=uS(),qy=class{constructor(e,r,n){var i,s,o;this.supabaseUrl=e,this.supabaseKey=r;let a=(0,cS.validateSupabaseUrl)(e);if(!r)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);let u=`sb-${a.hostname.split(".")[0]}-auth-token`,c={db:Ff.DEFAULT_DB_OPTIONS,realtime:Ff.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},Ff.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:Ff.DEFAULT_GLOBAL_OPTIONS},l=(0,cS.applySettingDefaults)(n??{},c);this.storageKey=(i=l.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(s=l.global.headers)!==null&&s!==void 0?s:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(h,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=l.auth)!==null&&o!==void 0?o:{},this.headers,l.global.fetch),this.fetch=(0,w7.fetchWithAuth)(r,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.rest=new g7.PostgrestClient(new URL("rest/v1",a).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new D7.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new m7.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,r={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,r,n)}channel(e,r={config:{}}){return this.realtime.channel(e,r)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,r;if(this.accessToken)return await this.accessToken();let{data:n}=await this.auth.getSession();return(r=(e=n.session)===null||e===void 0?void 0:e.access_token)!==null&&r!==void 0?r:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:i,userStorage:s,storageKey:o,flowType:a,lock:u,debug:c,throwOnError:l},h,d){let f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new b7.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},f),h),storageKey:o,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:i,userStorage:s,flowType:a,lock:u,debug:c,throwOnError:l,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new y7.RealtimeClient(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((r,n)=>{this._handleTokenChanged(r,"CLIENT",n?.access_token)})}_handleTokenChanged(e,r,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};Uy.default=qy});var hS=v(Ve=>{"use strict";var v7=Ve&&Ve.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),lS=Ve&&Ve.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&v7(e,t,r)},fS=Ve&&Ve.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.createClient=Ve.SupabaseClient=Ve.FunctionRegion=Ve.FunctionsError=Ve.FunctionsRelayError=Ve.FunctionsFetchError=Ve.FunctionsHttpError=Ve.PostgrestError=void 0;var E7=fS(Hy());lS(By(),Ve);var _7=og();Object.defineProperty(Ve,"PostgrestError",{enumerable:!0,get:function(){return _7.PostgrestError}});var ku=Hm();Object.defineProperty(Ve,"FunctionsHttpError",{enumerable:!0,get:function(){return ku.FunctionsHttpError}});Object.defineProperty(Ve,"FunctionsFetchError",{enumerable:!0,get:function(){return ku.FunctionsFetchError}});Object.defineProperty(Ve,"FunctionsRelayError",{enumerable:!0,get:function(){return ku.FunctionsRelayError}});Object.defineProperty(Ve,"FunctionsError",{enumerable:!0,get:function(){return ku.FunctionsError}});Object.defineProperty(Ve,"FunctionRegion",{enumerable:!0,get:function(){return ku.FunctionRegion}});lS(Cg(),Ve);var C7=Hy();Object.defineProperty(Ve,"SupabaseClient",{enumerable:!0,get:function(){return fS(C7).default}});var S7=(t,e,r)=>new E7.default(t,e,r);Ve.createClient=S7;function A7(){if(typeof window<"u"||typeof process>"u")return!1;let t=process.version;if(t==null)return!1;let e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}A7()&&console.warn("\u26A0\uFE0F Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")});var Vy=v(($ge,dS)=>{dS.exports={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 If=v(mS=>{var pS={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 O7(t){return function(...e){return e.length&&(t=t.replace(/\{(\d)\}/g,(r,n)=>e[n]||"")),new Error("ADM-ZIP: "+t)}}for(let t of Object.keys(pS))mS[t]=O7(pS[t])});var bS=v((jge,wS)=>{var x7=require("fs"),Tt=require("path"),gS=Vy(),T7=If(),F7=typeof process=="object"&&process.platform==="win32",yS=t=>typeof t=="object"&&t!==null,DS=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=3988292384^e>>>1:e>>>=1;return e>>>0});function dt(t){this.sep=Tt.sep,this.fs=x7,yS(t)&&yS(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}wS.exports=dt;dt.prototype.makeDir=function(t){let e=this;function r(n){let i=n.split(e.sep)[0];n.split(e.sep).forEach(function(s){if(!(!s||s.substr(-1,1)===":")){i+=e.sep+s;var o;try{o=e.fs.statSync(i)}catch{e.fs.mkdirSync(i)}if(o&&o.isFile())throw T7.FILE_IN_THE_WAY(`"${i}"`)}})}r(t)};dt.prototype.writeFileTo=function(t,e,r,n){let i=this;if(i.fs.existsSync(t)){if(!r)return!1;var s=i.fs.statSync(t);if(s.isDirectory())return!1}var o=Tt.dirname(t);i.fs.existsSync(o)||i.makeDir(o);var a;try{a=i.fs.openSync(t,"w",438)}catch{i.fs.chmodSync(t,438),a=i.fs.openSync(t,"w",438)}if(a)try{i.fs.writeSync(a,e,0,e.length,0)}finally{i.fs.closeSync(a)}return i.fs.chmodSync(t,n||438),!0};dt.prototype.writeFileToAsync=function(t,e,r,n,i){typeof n=="function"&&(i=n,n=void 0);let s=this;s.fs.exists(t,function(o){if(o&&!r)return i(!1);s.fs.stat(t,function(a,u){if(o&&u.isDirectory())return i(!1);var c=Tt.dirname(t);s.fs.exists(c,function(l){l||s.makeDir(c),s.fs.open(t,"w",438,function(h,d){h?s.fs.chmod(t,438,function(){s.fs.open(t,"w",438,function(f,m){s.fs.write(m,e,0,e.length,0,function(){s.fs.close(m,function(){s.fs.chmod(t,n||438,function(){i(!0)})})})})}):d?s.fs.write(d,e,0,e.length,0,function(){s.fs.close(d,function(){s.fs.chmod(t,n||438,function(){i(!0)})})}):s.fs.chmod(t,n||438,function(){i(!0)})})})})})};dt.prototype.findFiles=function(t){let e=this;function r(n,i,s){typeof i=="boolean"&&(s=i,i=void 0);let o=[];return e.fs.readdirSync(n).forEach(function(a){let u=Tt.join(n,a),c=e.fs.statSync(u);(!i||i.test(u))&&o.push(Tt.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&s&&(o=o.concat(r(u,i,s)))}),o}return r(t,void 0,!0)};dt.prototype.findFilesAsync=function(t,e){let r=this,n=[];r.fs.readdir(t,function(i,s){if(i)return e(i);let o=s.length;if(!o)return e(null,n);s.forEach(function(a){a=Tt.join(t,a),r.fs.stat(a,function(u,c){if(u)return e(u);c&&(n.push(Tt.normalize(a)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(a,function(l,h){if(l)return e(l);n=n.concat(h),--o||e(null,n)}):--o||e(null,n))})})})};dt.prototype.getAttributes=function(){};dt.prototype.setAttributes=function(){};dt.crc32update=function(t,e){return DS[(t^e)&255]^t>>>8};dt.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=dt.crc32update(r,t[n++]);return~r>>>0};dt.methodToString=function(t){switch(t){case gS.STORED:return"STORED ("+t+")";case gS.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};dt.canonical=function(t){if(!t)return"";let e=Tt.posix.normalize("/"+t.split("\\").join("/"));return Tt.join(".",e)};dt.zipnamefix=function(t){if(!t)return"";let e=Tt.posix.normalize("/"+t.split("\\").join("/"));return Tt.posix.join(".",e)};dt.findLast=function(t,e){if(!Array.isArray(t))throw new TypeError("arr is not array");let r=t.length>>>0;for(let n=r-1;n>=0;n--)if(e(t[n],n,t))return t[n]};dt.sanitize=function(t,e){t=Tt.resolve(Tt.normalize(t));for(var r=e.split("/"),n=0,i=r.length;n<i;n++){var s=Tt.normalize(Tt.join(t,r.slice(n,i).join(Tt.sep)));if(s.indexOf(t)===0)return s}return Tt.normalize(Tt.join(t,Tt.basename(e)))};dt.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};dt.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};dt.fromDOS2Date=function(t){return new Date((t>>25&127)+1980,Math.max((t>>21&15)-1,0),Math.max(t>>16&31,1),t>>11&31,t>>5&63,(t&31)<<1)};dt.fromDate2DOS=function(t){let e=0,r=0;return t.getFullYear()>1979&&(e=(t.getFullYear()-1980&127)<<9|t.getMonth()+1<<5|t.getDate(),r=t.getHours()<<11|t.getMinutes()<<5|t.getSeconds()>>1),e<<16|r};dt.isWin=F7;dt.crcTable=DS});var ES=v((Bge,vS)=>{var I7=require("path");vS.exports=function(t,{fs:e}){var r=t||"",n=s(),i=null;function s(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return r&&e.existsSync(r)?(i=e.statSync(r),n.directory=i.isDirectory(),n.mtime=i.mtime,n.atime=i.atime,n.executable=(73&i.mode)!==0,n.readonly=(128&i.mode)===0,n.hidden=I7.basename(r)[0]==="."):console.warn("Invalid path: "+r),{get directory(){return n.directory},get readOnly(){return n.readonly},get hidden(){return n.hidden},get mtime(){return n.mtime},get atime(){return n.atime},get executable(){return n.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:r,isDirectory:n.directory,isReadOnly:n.readonly,isHidden:n.hidden,isExecutable:n.executable,mTime:n.mtime,aTime:n.atime}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var CS=v((Mge,_S)=>{_S.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var Bo=v((qge,jo)=>{jo.exports=bS();jo.exports.Constants=Vy();jo.exports.Errors=If();jo.exports.FileAttr=ES();jo.exports.decoder=CS()});var AS=v((Uge,SS)=>{var Oi=Bo(),X=Oi.Constants;SS.exports=function(){var t=20,e=10,r=0,n=0,i=0,s=0,o=0,a=0,u=0,c=0,l=0,h=0,d=0,f=0,m=0;t|=Oi.isWin?2560:768,r|=X.FLG_EFS;let g={extraLen:0},b=p=>Math.max(0,p)>>>0,S=p=>Math.max(0,p)&65535,A=p=>Math.max(0,p)&255;return i=Oi.fromDate2DOS(new Date),{get made(){return t},set made(p){t=p},get version(){return e},set version(p){e=p},get flags(){return r},set flags(p){r=p},get flags_efs(){return(r&X.FLG_EFS)>0},set flags_efs(p){p?r|=X.FLG_EFS:r&=~X.FLG_EFS},get flags_desc(){return(r&X.FLG_DESC)>0},set flags_desc(p){p?r|=X.FLG_DESC:r&=~X.FLG_DESC},get method(){return n},set method(p){switch(p){case X.STORED:this.version=10;case X.DEFLATED:default:this.version=20}n=p},get time(){return Oi.fromDOS2Date(this.timeval)},set time(p){this.timeval=Oi.fromDate2DOS(p)},get timeval(){return i},set timeval(p){i=b(p)},get timeHighByte(){return A(i>>>8)},get crc(){return s},set crc(p){s=b(p)},get compressedSize(){return o},set compressedSize(p){o=b(p)},get size(){return a},set size(p){a=b(p)},get fileNameLength(){return u},set fileNameLength(p){u=p},get extraLength(){return c},set extraLength(p){c=p},get extraLocalLength(){return g.extraLen},set extraLocalLength(p){g.extraLen=p},get commentLength(){return l},set commentLength(p){l=p},get diskNumStart(){return h},set diskNumStart(p){h=b(p)},get inAttr(){return d},set inAttr(p){d=b(p)},get attr(){return f},set attr(p){f=b(p)},get fileAttr(){return(f||0)>>16&4095},get offset(){return m},set offset(p){m=b(p)},get encrypted(){return(r&X.FLG_ENC)===X.FLG_ENC},get centralHeaderSize(){return X.CENHDR+u+c+l},get realDataOffset(){return m+X.LOCHDR+g.fnameLen+g.extraLen},get localHeader(){return g},loadLocalHeaderFromBinary:function(p){var y=p.slice(m,m+X.LOCHDR);if(y.readUInt32LE(0)!==X.LOCSIG)throw Oi.Errors.INVALID_LOC();g.version=y.readUInt16LE(X.LOCVER),g.flags=y.readUInt16LE(X.LOCFLG),g.method=y.readUInt16LE(X.LOCHOW),g.time=y.readUInt32LE(X.LOCTIM),g.crc=y.readUInt32LE(X.LOCCRC),g.compressedSize=y.readUInt32LE(X.LOCSIZ),g.size=y.readUInt32LE(X.LOCLEN),g.fnameLen=y.readUInt16LE(X.LOCNAM),g.extraLen=y.readUInt16LE(X.LOCEXT);let w=m+X.LOCHDR+g.fnameLen,_=w+g.extraLen;return p.slice(w,_)},loadFromBinary:function(p){if(p.length!==X.CENHDR||p.readUInt32LE(0)!==X.CENSIG)throw Oi.Errors.INVALID_CEN();t=p.readUInt16LE(X.CENVEM),e=p.readUInt16LE(X.CENVER),r=p.readUInt16LE(X.CENFLG),n=p.readUInt16LE(X.CENHOW),i=p.readUInt32LE(X.CENTIM),s=p.readUInt32LE(X.CENCRC),o=p.readUInt32LE(X.CENSIZ),a=p.readUInt32LE(X.CENLEN),u=p.readUInt16LE(X.CENNAM),c=p.readUInt16LE(X.CENEXT),l=p.readUInt16LE(X.CENCOM),h=p.readUInt16LE(X.CENDSK),d=p.readUInt16LE(X.CENATT),f=p.readUInt32LE(X.CENATX),m=p.readUInt32LE(X.CENOFF)},localHeaderToBinary:function(){var p=Buffer.alloc(X.LOCHDR);return p.writeUInt32LE(X.LOCSIG,0),p.writeUInt16LE(e,X.LOCVER),p.writeUInt16LE(r,X.LOCFLG),p.writeUInt16LE(n,X.LOCHOW),p.writeUInt32LE(i,X.LOCTIM),p.writeUInt32LE(s,X.LOCCRC),p.writeUInt32LE(o,X.LOCSIZ),p.writeUInt32LE(a,X.LOCLEN),p.writeUInt16LE(u,X.LOCNAM),p.writeUInt16LE(g.extraLen,X.LOCEXT),p},centralHeaderToBinary:function(){var p=Buffer.alloc(X.CENHDR+u+c+l);return p.writeUInt32LE(X.CENSIG,0),p.writeUInt16LE(t,X.CENVEM),p.writeUInt16LE(e,X.CENVER),p.writeUInt16LE(r,X.CENFLG),p.writeUInt16LE(n,X.CENHOW),p.writeUInt32LE(i,X.CENTIM),p.writeUInt32LE(s,X.CENCRC),p.writeUInt32LE(o,X.CENSIZ),p.writeUInt32LE(a,X.CENLEN),p.writeUInt16LE(u,X.CENNAM),p.writeUInt16LE(c,X.CENEXT),p.writeUInt16LE(l,X.CENCOM),p.writeUInt16LE(h,X.CENDSK),p.writeUInt16LE(d,X.CENATT),p.writeUInt32LE(f,X.CENATX),p.writeUInt32LE(m,X.CENOFF),p},toJSON:function(){let p=function(y){return y+" bytes"};return{made:t,version:e,flags:r,method:Oi.methodToString(n),time:this.time,crc:"0x"+s.toString(16).toUpperCase(),compressedSize:p(o),size:p(a),fileNameLength:p(u),extraLength:p(c),commentLength:p(l),diskNumStart:h,inAttr:d,attr:f,offset:m,centralHeaderSize:p(X.CENHDR+u+c+l)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var xS=v((Hge,OS)=>{var Mo=Bo(),ut=Mo.Constants;OS.exports=function(){var t=0,e=0,r=0,n=0,i=0;return{get diskEntries(){return t},set diskEntries(s){t=e=s},get totalEntries(){return e},set totalEntries(s){e=t=s},get size(){return r},set size(s){r=s},get offset(){return n},set offset(s){n=s},get commentLength(){return i},set commentLength(s){i=s},get mainHeaderSize(){return ut.ENDHDR+i},loadFromBinary:function(s){if((s.length!==ut.ENDHDR||s.readUInt32LE(0)!==ut.ENDSIG)&&(s.length<ut.ZIP64HDR||s.readUInt32LE(0)!==ut.ZIP64SIG))throw Mo.Errors.INVALID_END();s.readUInt32LE(0)===ut.ENDSIG?(t=s.readUInt16LE(ut.ENDSUB),e=s.readUInt16LE(ut.ENDTOT),r=s.readUInt32LE(ut.ENDSIZ),n=s.readUInt32LE(ut.ENDOFF),i=s.readUInt16LE(ut.ENDCOM)):(t=Mo.readBigUInt64LE(s,ut.ZIP64SUB),e=Mo.readBigUInt64LE(s,ut.ZIP64TOT),r=Mo.readBigUInt64LE(s,ut.ZIP64SIZE),n=Mo.readBigUInt64LE(s,ut.ZIP64OFF),i=0)},toBinary:function(){var s=Buffer.alloc(ut.ENDHDR+i);return s.writeUInt32LE(ut.ENDSIG,0),s.writeUInt32LE(0,4),s.writeUInt16LE(t,ut.ENDSUB),s.writeUInt16LE(e,ut.ENDTOT),s.writeUInt32LE(r,ut.ENDSIZ),s.writeUInt32LE(n,ut.ENDOFF),s.writeUInt16LE(i,ut.ENDCOM),s.fill(" ",ut.ENDHDR),s},toJSON:function(){let s=function(o,a){let u=o.toString(16).toUpperCase();for(;u.length<a;)u="0"+u;return"0x"+u};return{diskEntries:t,totalEntries:e,size:r+" bytes",offset:s(n,4),commentLength:i}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Gy=v(zy=>{zy.EntryHeader=AS();zy.MainHeader=xS()});var FS=v((zge,TS)=>{TS.exports=function(t){var e=require("zlib"),r={chunkSize:(parseInt(t.length/1024)+1)*1024};return{deflate:function(){return e.deflateRawSync(t,r)},deflateAsync:function(n){var i=e.createDeflateRaw(r),s=[],o=0;i.on("data",function(a){s.push(a),o+=a.length}),i.on("end",function(){var a=Buffer.alloc(o),u=0;a.fill(0);for(var c=0;c<s.length;c++){var l=s[c];l.copy(a,u),u+=l.length}n&&n(a)}),i.end(t)}}}});var PS=v((Gge,IS)=>{var P7=+(process.versions?process.versions.node:"").split(".")[0]||0;IS.exports=function(t,e){var r=require("zlib");let n=P7>=15&&e>0?{maxOutputLength:e}:{};return{inflate:function(){return r.inflateRawSync(t,n)},inflateAsync:function(i){var s=r.createInflateRaw(n),o=[],a=0;s.on("data",function(u){o.push(u),a+=u.length}),s.on("end",function(){var u=Buffer.alloc(a),c=0;u.fill(0);for(var l=0;l<o.length;l++){var h=o[l];h.copy(u,c),c+=h.length}i&&i(u)}),s.end(t)}}}});var LS=v((Kge,$S)=>{"use strict";var{randomFillSync:kS}=require("crypto"),k7=If(),R7=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=e>>>1^3988292384:e>>>=1;return e>>>0}),NS=(t,e)=>Math.imul(t,e)>>>0,RS=(t,e)=>R7[(t^e)&255]^t>>>8,Ru=()=>typeof kS=="function"?kS(Buffer.alloc(12)):Ru.node();Ru.node=()=>{let t=Buffer.alloc(12),e=t.length;for(let r=0;r<e;r++)t[r]=Math.random()*256&255;return t};var Pf={genSalt:Ru};function kf(t){let e=Buffer.isBuffer(t)?t:Buffer.from(t);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let r=0;r<e.length;r++)this.updateKeys(e[r])}kf.prototype.updateKeys=function(t){let e=this.keys;return e[0]=RS(e[0],t),e[1]+=e[0]&255,e[1]=NS(e[1],134775813)+1,e[2]=RS(e[2],e[1]>>>24),t};kf.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return NS(t,t^1)>>8&255};function N7(t){let e=new kf(t);return function(r){let n=Buffer.alloc(r.length),i=0;for(let s of r)n[i++]=e.updateKeys(s^e.next());return n}}function $7(t){let e=new kf(t);return function(r,n,i=0){n||(n=Buffer.alloc(r.length));for(let s of r){let o=e.next();n[i++]=s^o,e.updateKeys(s)}return n}}function L7(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=N7(r),i=n(t.slice(0,12)),s=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(i[11]!==s)throw k7.WRONG_PASSWORD();return n(t.slice(12))}function j7(t){Buffer.isBuffer(t)&&t.length>=12?Pf.genSalt=function(){return t.slice(0,12)}:t==="node"?Pf.genSalt=Ru.node:Pf.genSalt=Ru}function B7(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let i=$7(r),s=Pf.genSalt();s[11]=e.crc>>>24&255,n&&(s[10]=e.crc>>>16&255);let o=Buffer.alloc(t.length+12);return i(s,o),i(t,o,12)}$S.exports={decrypt:L7,encrypt:B7,_salter:j7}});var jS=v(Rf=>{Rf.Deflater=FS();Rf.Inflater=PS();Rf.ZipCrypto=LS()});var Wy=v((Xge,BS)=>{var Pe=Bo(),M7=Gy(),pt=Pe.Constants,Ky=jS();BS.exports=function(t,e){var r=new M7.EntryHeader,n=Buffer.alloc(0),i=Buffer.alloc(0),s=!1,o=null,a=Buffer.alloc(0),u=Buffer.alloc(0),c=!0;let l=t,h=typeof l.decoder=="object"?l.decoder:Pe.decoder;c=h.hasOwnProperty("efs")?h.efs:!1;function d(){return!e||!(e instanceof Uint8Array)?Buffer.alloc(0):(u=r.loadLocalHeaderFromBinary(e),e.slice(r.realDataOffset,r.realDataOffset+r.compressedSize))}function f(p){if(r.flags_desc){let y={},w=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(w)==pt.LOCSIG||e.readUInt32LE(w)==pt.CENSIG)throw Pe.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(w)==pt.EXTSIG)y.crc=e.readUInt32LE(w+pt.EXTCRC),y.compressedSize=e.readUInt32LE(w+pt.EXTSIZ),y.size=e.readUInt32LE(w+pt.EXTLEN);else if(e.readUInt16LE(w+12)===19280)y.crc=e.readUInt32LE(w+pt.EXTCRC-4),y.compressedSize=e.readUInt32LE(w+pt.EXTSIZ-4),y.size=e.readUInt32LE(w+pt.EXTLEN-4);else throw Pe.Errors.DESCRIPTOR_UNKNOWN();if(y.compressedSize!==r.compressedSize||y.size!==r.size||y.crc!==r.crc)throw Pe.Errors.DESCRIPTOR_FAULTY();if(Pe.crc32(p)!==y.crc)return!1}else if(Pe.crc32(p)!==r.localHeader.crc)return!1;return!0}function m(p,y,w){if(typeof y>"u"&&typeof p=="string"&&(w=p,p=void 0),s)return p&&y&&y(Buffer.alloc(0),Pe.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var _=d();if(_.length===0)return p&&y&&y(_),_;if(r.encrypted){if(typeof w!="string"&&!Buffer.isBuffer(w))throw Pe.Errors.INVALID_PASS_PARAM();_=Ky.ZipCrypto.decrypt(_,r,w)}var P=Buffer.alloc(r.size);switch(r.method){case Pe.Constants.STORED:if(_.copy(P),f(P))return p&&y&&y(P),P;throw p&&y&&y(P,Pe.Errors.BAD_CRC()),Pe.Errors.BAD_CRC();case Pe.Constants.DEFLATED:var E=new Ky.Inflater(_,r.size);if(p)E.inflateAsync(function(R){R.copy(R,0),y&&(f(R)?y(R):y(R,Pe.Errors.BAD_CRC()))});else{if(E.inflate(P).copy(P,0),!f(P))throw Pe.Errors.BAD_CRC(`"${h.decode(n)}"`);return P}break;default:throw p&&y&&y(Buffer.alloc(0),Pe.Errors.UNKNOWN_METHOD()),Pe.Errors.UNKNOWN_METHOD()}}function g(p,y){if((!o||!o.length)&&Buffer.isBuffer(e))return p&&y&&y(d()),d();if(o.length&&!s){var w;switch(r.method){case Pe.Constants.STORED:return r.compressedSize=r.size,w=Buffer.alloc(o.length),o.copy(w),p&&y&&y(w),w;default:case Pe.Constants.DEFLATED:var _=new Ky.Deflater(o);if(p)_.deflateAsync(function(E){w=Buffer.alloc(E.length),r.compressedSize=E.length,E.copy(w),y&&y(w)});else{var P=_.deflate();return r.compressedSize=P.length,P}_=null;break}}else if(p&&y)y(Buffer.alloc(0));else return Buffer.alloc(0)}function b(p,y){return(p.readUInt32LE(y+4)<<4)+p.readUInt32LE(y)}function S(p){try{for(var y=0,w,_,P;y+4<p.length;)w=p.readUInt16LE(y),y+=2,_=p.readUInt16LE(y),y+=2,P=p.slice(y,y+_),y+=_,pt.ID_ZIP64===w&&A(P)}catch{throw Pe.Errors.EXTRA_FIELD_PARSE_ERROR()}}function A(p){var y,w,_,P;p.length>=pt.EF_ZIP64_SCOMP&&(y=b(p,pt.EF_ZIP64_SUNCOMP),r.size===pt.EF_ZIP64_OR_32&&(r.size=y)),p.length>=pt.EF_ZIP64_RHO&&(w=b(p,pt.EF_ZIP64_SCOMP),r.compressedSize===pt.EF_ZIP64_OR_32&&(r.compressedSize=w)),p.length>=pt.EF_ZIP64_DSN&&(_=b(p,pt.EF_ZIP64_RHO),r.offset===pt.EF_ZIP64_OR_32&&(r.offset=_)),p.length>=pt.EF_ZIP64_DSN+4&&(P=p.readUInt32LE(pt.EF_ZIP64_DSN),r.diskNumStart===pt.EF_ZIP64_OR_16&&(r.diskNumStart=P))}return{get entryName(){return h.decode(n)},get rawEntryName(){return n},set entryName(p){n=Pe.toBuffer(p,h.encode);var y=n[n.length-1];s=y===47||y===92,r.fileNameLength=n.length},get efs(){return typeof c=="function"?c(this.entryName):c},get extra(){return a},set extra(p){a=p,r.extraLength=p.length,S(p)},get comment(){return h.decode(i)},set comment(p){if(i=Pe.toBuffer(p,h.encode),r.commentLength=i.length,i.length>65535)throw Pe.Errors.COMMENT_TOO_LONG()},get name(){var p=h.decode(n);return s?p.substr(p.length-1).split("/").pop():p.split("/").pop()},get isDirectory(){return s},getCompressedData:function(){return g(!1,null)},getCompressedDataAsync:function(p){g(!0,p)},setData:function(p){o=Pe.toBuffer(p,Pe.decoder.encode),!s&&o.length?(r.size=o.length,r.method=Pe.Constants.DEFLATED,r.crc=Pe.crc32(p),r.changed=!0):r.method=Pe.Constants.STORED},getData:function(p){return r.changed?o:m(!1,null,p)},getDataAsync:function(p,y){r.changed?p(o):m(!0,p,y)},set attr(p){r.attr=p},get attr(){return r.attr},set header(p){r.loadFromBinary(p)},get header(){return r},packCentralHeader:function(){r.flags_efs=this.efs,r.extraLength=a.length;var p=r.centralHeaderToBinary(),y=Pe.Constants.CENHDR;return n.copy(p,y),y+=n.length,a.copy(p,y),y+=r.extraLength,i.copy(p,y),p},packLocalHeader:function(){let p=0;r.flags_efs=this.efs,r.extraLocalLength=u.length;let y=r.localHeaderToBinary(),w=Buffer.alloc(y.length+n.length+r.extraLocalLength);return y.copy(w,p),p+=y.length,n.copy(w,p),p+=n.length,u.copy(w,p),p+=u.length,w},toJSON:function(){let p=function(y){return"<"+(y&&y.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:p(e),data:p(o)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var US=v((Yge,qS)=>{var MS=Wy(),q7=Gy(),Bt=Bo();qS.exports=function(t,e){var r=[],n={},i=Buffer.alloc(0),s=new q7.MainHeader,o=!1,a=null;let u=new Set,c=e,{noSort:l,decoder:h}=c;t?m(c.readEntries):o=!0;function d(){let b=new Set;for(let S of Object.keys(n)){let A=S.split("/");if(A.pop(),!!A.length)for(let p=0;p<A.length;p++){let y=A.slice(0,p+1).join("/")+"/";b.add(y)}}for(let S of b)if(!(S in n)){let A=new MS(c);A.entryName=S,A.attr=16,A.temporary=!0,r.push(A),n[A.entryName]=A,u.add(A)}}function f(){if(o=!0,n={},s.diskEntries>(t.length-s.offset)/Bt.Constants.CENHDR)throw Bt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(s.diskEntries);for(var b=s.offset,S=0;S<r.length;S++){var A=b,p=new MS(c,t);p.header=t.slice(A,A+=Bt.Constants.CENHDR),p.entryName=t.slice(A,A+=p.header.fileNameLength),p.header.extraLength&&(p.extra=t.slice(A,A+=p.header.extraLength)),p.header.commentLength&&(p.comment=t.slice(A,A+p.header.commentLength)),b+=p.header.centralHeaderSize,r[S]=p,n[p.entryName]=p}u.clear(),d()}function m(b){var S=t.length-Bt.Constants.ENDHDR,A=Math.max(0,S-65535),p=A,y=t.length,w=-1,_=0;for((typeof c.trailingSpace=="boolean"?c.trailingSpace:!1)&&(A=0),S;S>=p;S--)if(t[S]===80){if(t.readUInt32LE(S)===Bt.Constants.ENDSIG){w=S,_=S,y=S+Bt.Constants.ENDHDR,p=S-Bt.Constants.END64HDR;continue}if(t.readUInt32LE(S)===Bt.Constants.END64SIG){p=A;continue}if(t.readUInt32LE(S)===Bt.Constants.ZIP64SIG){w=S,y=S+Bt.readBigUInt64LE(t,S+Bt.Constants.ZIP64SIZE)+Bt.Constants.ZIP64LEAD;break}}if(w==-1)throw Bt.Errors.INVALID_FORMAT();s.loadFromBinary(t.slice(w,y)),s.commentLength&&(i=t.slice(_+Bt.Constants.ENDHDR)),b&&f()}function g(){r.length>1&&!l&&r.sort((b,S)=>b.entryName.toLowerCase().localeCompare(S.entryName.toLowerCase()))}return{get entries(){return o||f(),r.filter(b=>!u.has(b))},get comment(){return h.decode(i)},set comment(b){i=Bt.toBuffer(b,h.encode),s.commentLength=i.length},getEntryCount:function(){return o?r.length:s.diskEntries},forEach:function(b){this.entries.forEach(b)},getEntry:function(b){return o||f(),n[b]||null},setEntry:function(b){o||f(),r.push(b),n[b.entryName]=b,s.totalEntries=r.length},deleteFile:function(b,S=!0){o||f();let A=n[b];this.getEntryChildren(A,S).map(y=>y.entryName).forEach(this.deleteEntry)},deleteEntry:function(b){o||f();let S=n[b],A=r.indexOf(S);A>=0&&(r.splice(A,1),delete n[b],s.totalEntries=r.length)},getEntryChildren:function(b,S=!0){if(o||f(),typeof b=="object")if(b.isDirectory&&S){let A=[],p=b.entryName;for(let y of r)y.entryName.startsWith(p)&&A.push(y);return A}else return[b];return[]},getChildCount:function(b){if(b&&b.isDirectory){let S=this.getEntryChildren(b);return S.includes(b)?S.length-1:S.length}return 0},compressToBuffer:function(){o||f(),g();let b=[],S=[],A=0,p=0;s.size=0,s.offset=0;let y=0;for(let P of this.entries){let E=P.getCompressedData();P.header.offset=p;let R=P.packLocalHeader(),k=R.length+E.length;p+=k,b.push(R),b.push(E);let F=P.packCentralHeader();S.push(F),s.size+=F.length,A+=k+F.length,y++}A+=s.mainHeaderSize,s.offset=p,s.totalEntries=y,p=0;let w=Buffer.alloc(A);for(let P of b)P.copy(w,p),p+=P.length;for(let P of S)P.copy(w,p),p+=P.length;let _=s.toBinary();return i&&i.copy(_,Bt.Constants.ENDHDR),_.copy(w,p),t=w,o=!1,w},toAsyncBuffer:function(b,S,A,p){try{o||f(),g();let y=[],w=[],_=0,P=0,E=0;s.size=0,s.offset=0;let R=function(k){if(k.length>0){let F=k.shift(),j=F.entryName+F.extra.toString();A&&A(j),F.getCompressedDataAsync(function(U){p&&p(j),F.header.offset=P;let G=F.packLocalHeader(),L=G.length+U.length;P+=L,y.push(G),y.push(U);let C=F.packCentralHeader();w.push(C),s.size+=C.length,_+=L+C.length,E++,R(k)})}else{_+=s.mainHeaderSize,s.offset=P,s.totalEntries=E,P=0;let F=Buffer.alloc(_);y.forEach(function(U){U.copy(F,P),P+=U.length}),w.forEach(function(U){U.copy(F,P),P+=U.length});let j=s.toBinary();i&&i.copy(j,Bt.Constants.ENDHDR),j.copy(F,P),t=F,o=!1,b(F)}};R(Array.from(this.entries))}catch(y){S(y)}}}}});var zS=v((Jge,VS)=>{var ct=Bo(),mt=require("path"),U7=Wy(),H7=US(),ms=(...t)=>ct.findLast(t,e=>typeof e=="boolean"),HS=(...t)=>ct.findLast(t,e=>typeof e=="string"),V7=(...t)=>ct.findLast(t,e=>typeof e=="function"),z7={noSort:!1,readEntries:!1,method:ct.Constants.NONE,fs:null};VS.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),z7);t&&typeof t=="object"&&(t instanceof Uint8Array||(Object.assign(n,t),t=n.input?n.input:void 0,n.input&&delete n.input),Buffer.isBuffer(t)&&(r=t,n.method=ct.Constants.BUFFER,t=void 0)),Object.assign(n,e);let i=new ct(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=ct.decoder),t&&typeof t=="string")if(i.fs.existsSync(t))n.method=ct.Constants.FILE,n.filename=t,r=i.fs.readFileSync(t);else throw ct.Errors.INVALID_FILENAME();let s=new H7(r,n),{canonical:o,sanitize:a,zipnamefix:u}=ct;function c(f){if(f&&s){var m;if(typeof f=="string"&&(m=s.getEntry(mt.posix.normalize(f))),typeof f=="object"&&typeof f.entryName<"u"&&typeof f.header<"u"&&(m=s.getEntry(f.entryName)),m)return m}return null}function l(f){let{join:m,normalize:g,sep:b}=mt.posix;return m(".",g(b+f.split("\\").join(b)+b))}function h(f){return f instanceof RegExp?(function(m){return function(g){return m.test(g)}})(f):typeof f!="function"?()=>!0:f}let d=(f,m)=>{let g=m.slice(-1);return g=g===i.sep?i.sep:"",mt.relative(f,m)+g};return{readFile:function(f,m){var g=c(f);return g&&g.getData(m)||null},childCount:function(f){let m=c(f);if(m)return s.getChildCount(m)},readFileAsync:function(f,m){var g=c(f);g?g.getDataAsync(m):m(null,"getEntry failed for:"+f)},readAsText:function(f,m){var g=c(f);if(g){var b=g.getData();if(b&&b.length)return b.toString(m||"utf8")}return""},readAsTextAsync:function(f,m,g){var b=c(f);b?b.getDataAsync(function(S,A){if(A){m(S,A);return}S&&S.length?m(S.toString(g||"utf8")):m("")}):m("")},deleteFile:function(f,m=!0){var g=c(f);g&&s.deleteFile(g.entryName,m)},deleteEntry:function(f){var m=c(f);m&&s.deleteEntry(m.entryName)},addZipComment:function(f){s.comment=f},getZipComment:function(){return s.comment||""},addZipEntryComment:function(f,m){var g=c(f);g&&(g.comment=m)},getZipEntryComment:function(f){var m=c(f);return m&&m.comment||""},updateFile:function(f,m){var g=c(f);g&&g.setData(m)},addLocalFile:function(f,m,g,b){if(i.fs.existsSync(f)){m=m?l(m):"";let S=mt.win32.basename(mt.win32.normalize(f));m+=g||S;let A=i.fs.statSync(f),p=A.isFile()?i.fs.readFileSync(f):Buffer.alloc(0);A.isDirectory()&&(m+=i.sep),this.addFile(m,p,b,A)}else throw ct.Errors.FILE_NOT_FOUND(f)},addLocalFileAsync:function(f,m){f=typeof f=="object"?f:{localPath:f};let g=mt.resolve(f.localPath),{comment:b}=f,{zipPath:S,zipName:A}=f,p=this;i.fs.stat(g,function(y,w){if(y)return m(y,!1);S=S?l(S):"";let _=mt.win32.basename(mt.win32.normalize(g));if(S+=A||_,w.isFile())i.fs.readFile(g,function(P,E){return P?m(P,!1):(p.addFile(S,E,b,w),setImmediate(m,void 0,!0))});else if(w.isDirectory())return S+=i.sep,p.addFile(S,Buffer.alloc(0),b,w),setImmediate(m,void 0,!0)})},addLocalFolder:function(f,m,g){if(g=h(g),m=m?l(m):"",f=mt.normalize(f),i.fs.existsSync(f)){let b=i.findFiles(f),S=this;if(b.length)for(let A of b){let p=mt.join(m,d(f,A));g(p)&&S.addLocalFile(A,mt.dirname(p))}}else throw ct.Errors.FILE_NOT_FOUND(f)},addLocalFolderAsync:function(f,m,g,b){b=h(b),g=g?l(g):"",f=mt.normalize(f);var S=this;i.fs.open(f,"r",function(A){if(A&&A.code==="ENOENT")m(void 0,ct.Errors.FILE_NOT_FOUND(f));else if(A)m(void 0,A);else{var p=i.findFiles(f),y=-1,w=function(){if(y+=1,y<p.length){var _=p[y],P=d(f,_).split("\\").join("/");P=P.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),b(P)?i.fs.stat(_,function(E,R){E&&m(void 0,E),R.isFile()?i.fs.readFile(_,function(k,F){k?m(void 0,k):(S.addFile(g+P,F,"",R),w())}):(S.addFile(g+P+"/",Buffer.alloc(0),"",R),w())}):process.nextTick(()=>{w()})}else m(!0,void 0)};w()}})},addLocalFolderAsync2:function(f,m){let g=this;f=typeof f=="object"?f:{localPath:f},localPath=mt.resolve(l(f.localPath));let{zipPath:b,filter:S,namefix:A}=f;S instanceof RegExp?S=(function(w){return function(_){return w.test(_)}})(S):typeof S!="function"&&(S=function(){return!0}),b=b?l(b):"",A=="latin1"&&(A=w=>w.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof A!="function"&&(A=w=>w);let p=w=>mt.join(b,A(d(localPath,w))),y=w=>mt.win32.basename(mt.win32.normalize(A(w)));i.fs.open(localPath,"r",function(w){w&&w.code==="ENOENT"?m(void 0,ct.Errors.FILE_NOT_FOUND(localPath)):w?m(void 0,w):i.findFilesAsync(localPath,function(_,P){if(_)return m(_);P=P.filter(E=>S(p(E))),P.length||m(void 0,!1),setImmediate(P.reverse().reduce(function(E,R){return function(k,F){if(k||F===!1)return setImmediate(E,k,!1);g.addLocalFileAsync({localPath:R,zipPath:mt.dirname(p(R)),zipName:y(R)},E)}},m))})})},addLocalFolderPromise:function(f,m){return new Promise((g,b)=>{this.addLocalFolderAsync2(Object.assign({localPath:f},m),(S,A)=>{S&&b(S),A&&g(this)})})},addFile:function(f,m,g,b){f=u(f);let S=c(f),A=S!=null;A||(S=new U7(n),S.entryName=f),S.comment=g||"";let p=typeof b=="object"&&b instanceof i.fs.Stats;p&&(S.header.time=b.mtime);var y=S.isDirectory?16:0;let w=S.isDirectory?16384:32768;return p?w|=4095&b.mode:typeof b=="number"?w|=4095&b:w|=S.isDirectory?493:420,y=(y|w<<16)>>>0,S.attr=y,S.setData(m),A||s.setEntry(S),S},getEntries:function(f){return s.password=f,s?s.entries:[]},getEntry:function(f){return c(f)},getEntryCount:function(){return s.getEntryCount()},forEach:function(f){return s.forEach(f)},extractEntryTo:function(f,m,g,b,S,A){b=ms(!1,b),S=ms(!1,S),g=ms(!0,g),A=HS(S,A);var p=c(f);if(!p)throw ct.Errors.NO_ENTRY();var y=o(p.entryName),w=a(m,A&&!p.isDirectory?A:g?y:mt.basename(y));if(p.isDirectory){var _=s.getEntryChildren(p);return _.forEach(function(R){if(R.isDirectory)return;var k=R.getData();if(!k)throw ct.Errors.CANT_EXTRACT_FILE();var F=o(R.entryName),j=a(m,g?F:mt.basename(F));let U=S?R.header.fileAttr:void 0;i.writeFileTo(j,k,b,U)}),!0}var P=p.getData(s.password);if(!P)throw ct.Errors.CANT_EXTRACT_FILE();if(i.fs.existsSync(w)&&!b)throw ct.Errors.CANT_OVERRIDE();let E=S?f.header.fileAttr:void 0;return i.writeFileTo(w,P,b,E),!0},test:function(f){if(!s)return!1;for(var m in s.entries)try{if(m.isDirectory)continue;var g=s.entries[m].getData(f);if(!g)return!1}catch{return!1}return!0},extractAllTo:function(f,m,g,b){if(g=ms(!1,g),b=HS(g,b),m=ms(!1,m),!s)throw ct.Errors.NO_ZIP();s.entries.forEach(function(S){var A=a(f,o(S.entryName));if(S.isDirectory){i.makeDir(A);return}var p=S.getData(b);if(!p)throw ct.Errors.CANT_EXTRACT_FILE();let y=g?S.header.fileAttr:void 0;i.writeFileTo(A,p,m,y);try{i.fs.utimesSync(A,S.header.time,S.header.time)}catch{throw ct.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(f,m,g,b){if(b=V7(m,g,b),g=ms(!1,g),m=ms(!1,m),!b)return new Promise((w,_)=>{this.extractAllToAsync(f,m,g,function(P){P?_(P):w(this)})});if(!s){b(ct.Errors.NO_ZIP());return}f=mt.resolve(f);let S=w=>a(f,mt.normalize(o(w.entryName))),A=(w,_)=>new Error(w+': "'+_+'"'),p=[],y=[];s.entries.forEach(w=>{w.isDirectory?p.push(w):y.push(w)});for(let w of p){let _=S(w),P=g?w.header.fileAttr:void 0;try{i.makeDir(_),P&&i.fs.chmodSync(_,P),i.fs.utimesSync(_,w.header.time,w.header.time)}catch{b(A("Unable to create folder",_))}}y.reverse().reduce(function(w,_){return function(P){if(P)w(P);else{let E=mt.normalize(o(_.entryName)),R=a(f,E);_.getDataAsync(function(k,F){if(F)w(F);else if(!k)w(ct.Errors.CANT_EXTRACT_FILE());else{let j=g?_.header.fileAttr:void 0;i.writeFileToAsync(R,k,m,j,function(U){U||w(A("Unable to write file",R)),i.fs.utimes(R,_.header.time,_.header.time,function(G){G?w(A("Unable to set times",R)):w()})})}})}}},b)()},writeZip:function(f,m){if(arguments.length===1&&typeof f=="function"&&(m=f,f=""),!f&&n.filename&&(f=n.filename),!!f){var g=s.compressToBuffer();if(g){var b=i.writeFileTo(f,g,!0);typeof m=="function"&&m(b?null:new Error("failed"),"")}}},writeZipPromise:function(f,m){let{overwrite:g,perm:b}=Object.assign({overwrite:!0},m);return new Promise((S,A)=>{!f&&n.filename&&(f=n.filename),f||A("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(p=>{let y=w=>w?S(w):A("ADM-ZIP: Wasn't able to write zip file");i.writeFileToAsync(f,p,g,b,y)},A)})},toBufferPromise:function(){return new Promise((f,m)=>{s.toAsyncBuffer(f,m)})},toBuffer:function(f,m,g,b){return typeof f=="function"?(s.toAsyncBuffer(f,m,g,b),null):s.compressToBuffer()}}}});var XS=v((Zge,WS)=>{var KS={};WS.exports=KS;var GS={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(GS).forEach(function(t){var e=GS[t],r=KS[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var JS=v((Qge,YS)=>{"use strict";YS.exports=function(t,e){e=e||process.argv;var r=e.indexOf("--"),n=/^-{1,2}/.test(t)?"":"--",i=e.indexOf(n+t);return i!==-1&&(r===-1?!0:i<r)}});var QS=v((eye,ZS)=>{"use strict";var G7=require("os"),nn=JS(),rr=process.env,qo=void 0;nn("no-color")||nn("no-colors")||nn("color=false")?qo=!1:(nn("color")||nn("colors")||nn("color=true")||nn("color=always"))&&(qo=!0);"FORCE_COLOR"in rr&&(qo=rr.FORCE_COLOR.length===0||parseInt(rr.FORCE_COLOR,10)!==0);function K7(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function W7(t){if(qo===!1)return 0;if(nn("color=16m")||nn("color=full")||nn("color=truecolor"))return 3;if(nn("color=256"))return 2;if(t&&!t.isTTY&&qo!==!0)return 0;var e=qo?1:0;if(process.platform==="win32"){var r=G7.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in rr)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(i){return i in rr})||rr.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in rr)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(rr.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in rr){var n=parseInt((rr.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(rr.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(rr.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(rr.TERM)||"COLORTERM"in rr?1:(rr.TERM==="dumb",e)}function Xy(t){var e=W7(t);return K7(e)}ZS.exports={supportsColor:Xy,stdout:Xy(process.stdout),stderr:Xy(process.stderr)}});var tA=v((tye,eA)=>{eA.exports=function(e,r){var n="";e=e||"Run the trap, drop the bass",e=e.split("");var i={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(s){s=s.toLowerCase();var o=i[s]||[" "],a=Math.floor(Math.random()*o.length);typeof i[s]<"u"?n+=i[s][a]:n+=s}),n}});var nA=v((rye,rA)=>{rA.exports=function(e,r){e=e||" he is here ";var n={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},i=[].concat(n.up,n.down,n.mid);function s(u){var c=Math.floor(Math.random()*u);return c}function o(u){var c=!1;return i.filter(function(l){c=l===u}),c}function a(u,c){var l="",h,d;c=c||{},c.up=typeof c.up<"u"?c.up:!0,c.mid=typeof c.mid<"u"?c.mid:!0,c.down=typeof c.down<"u"?c.down:!0,c.size=typeof c.size<"u"?c.size:"maxi",u=u.split("");for(d in u)if(!o(d)){switch(l=l+u[d],h={up:0,down:0,mid:0},c.size){case"mini":h.up=s(8),h.mid=s(2),h.down=s(8);break;case"maxi":h.up=s(16)+3,h.mid=s(4)+1,h.down=s(64)+3;break;default:h.up=s(8)+1,h.mid=s(6)/2,h.down=s(8)+1;break}var f=["up","mid","down"];for(var m in f)for(var g=f[m],b=0;b<=h[g];b++)c[g]&&(l=l+n[g][s(n[g].length)])}return l}return a(e,r)}});var sA=v((nye,iA)=>{iA.exports=function(t){return function(e,r,n){if(e===" ")return e;switch(r%3){case 0:return t.red(e);case 1:return t.white(e);case 2:return t.blue(e)}}}});var aA=v((iye,oA)=>{oA.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var cA=v((sye,uA)=>{uA.exports=function(t){var e=["red","yellow","green","blue","magenta"];return function(r,n,i){return r===" "?r:t[e[n++%e.length]](r)}}});var fA=v((oye,lA)=>{lA.exports=function(t){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,n,i){return r===" "?r:t[e[Math.round(Math.random()*(e.length-2))]](r)}}});var yA=v((uye,gA)=>{var be={};gA.exports=be;be.themes={};var X7=require("util"),gs=be.styles=XS(),dA=Object.defineProperties,Y7=new RegExp(/[\r\n]+/g);be.supportsColor=QS().supportsColor;typeof be.enabled>"u"&&(be.enabled=be.supportsColor()!==!1);be.enable=function(){be.enabled=!0};be.disable=function(){be.enabled=!1};be.stripColors=be.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var aye=be.stylize=function(e,r){if(!be.enabled)return e+"";var n=gs[r];return!n&&r in be?be[r](e):n.open+e+n.close},J7=/[|\\{}()[\]^$+*?.]/g,Z7=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(J7,"\\$&")};function pA(t){var e=function r(){return eH.apply(r,arguments)};return e._styles=t,e.__proto__=Q7,e}var mA=(function(){var t={};return gs.grey=gs.gray,Object.keys(gs).forEach(function(e){gs[e].closeRe=new RegExp(Z7(gs[e].close),"g"),t[e]={get:function(){return pA(this._styles.concat(e))}}}),t})(),Q7=dA(function(){},mA);function eH(){var t=Array.prototype.slice.call(arguments),e=t.map(function(o){return o!=null&&o.constructor===String?o:X7.inspect(o)}).join(" ");if(!be.enabled||!e)return e;for(var r=e.indexOf(`
|
|
41
|
-
`)!=-1,n=this._styles,i=n.length;i--;){var s=gs[n[i]];e=s.open+e.replace(s.closeRe,s.open)+s.close,r&&(e=e.replace(Y7,function(o){return s.close+o+s.open}))}return e}be.setTheme=function(t){if(typeof t=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var e in t)(function(r){be[r]=function(n){if(typeof t[r]=="object"){var i=n;for(var s in t[r])i=be[t[r][s]](i);return i}return be[t[r]](n)}})(e)};function tH(){var t={};return Object.keys(mA).forEach(function(e){t[e]={get:function(){return pA([e])}}}),t}var rH=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};be.trap=tA();be.zalgo=nA();be.maps={};be.maps.america=sA()(be);be.maps.zebra=aA()(be);be.maps.rainbow=cA()(be);be.maps.random=fA()(be);for(hA in be.maps)(function(t){be[t]=function(e){return rH(be.maps[t],e)}})(hA);var hA;dA(be,tH())});var wA=v((
|
|
39
|
+
${S}`}});var XC=v(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.WebAuthnUnknownError=zn.WebAuthnError=void 0;zn.isWebAuthnError=V9;zn.identifyRegistrationError=z9;zn.identifyAuthenticationError=G9;var WC=ky(),at=class extends Error{constructor({message:e,code:r,cause:n,name:i}){var s;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(s=i??(n instanceof Error?n.name:void 0))!==null&&s!==void 0?s:"Unknown Error",this.code=r}};zn.WebAuthnError=at;var Py=class extends at{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}};zn.WebAuthnUnknownError=Py;function V9(t){return typeof t=="object"&&t!==null&&"__isWebAuthnError"in t}function z9({error:t,options:e}){var r,n,i;let{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new at({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=s.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new at({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=s.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new at({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=s.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new at({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new at({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new at({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return s.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new at({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new at({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){let o=window.location.hostname;if((0,WC.isValidDomain)(o)){if(s.rp.id!==o)return new at({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new at({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new at({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new at({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new at({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function G9({error:t,options:e}){let{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new at({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new at({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){let n=window.location.hostname;if((0,WC.isValidDomain)(n)){if(r.rpId!==n)return new at({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new at({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new at({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new at({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}});var ky=v(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.WebAuthnApi=Se.DEFAULT_REQUEST_OPTIONS=Se.DEFAULT_CREATION_OPTIONS=Se.webAuthnAbortService=Se.WebAuthnAbortService=Se.identifyAuthenticationError=Se.identifyRegistrationError=Se.isWebAuthnError=Se.WebAuthnError=void 0;Se.deserializeCredentialCreationOptions=W9;Se.deserializeCredentialRequestOptions=X9;Se.serializeCredentialCreationResponse=Y9;Se.serializeCredentialRequestResponse=J9;Se.isValidDomain=Z9;Se.createCredential=ZC;Se.getCredential=QC;Se.mergeCredentialCreationOptions=eS;Se.mergeCredentialRequestOptions=tS;var JC=(fe(),ue(le)),rn=yf(),dn=fs(),K9=Ro(),pn=XC();Object.defineProperty(Se,"identifyAuthenticationError",{enumerable:!0,get:function(){return pn.identifyAuthenticationError}});Object.defineProperty(Se,"identifyRegistrationError",{enumerable:!0,get:function(){return pn.identifyRegistrationError}});Object.defineProperty(Se,"isWebAuthnError",{enumerable:!0,get:function(){return pn.isWebAuthnError}});Object.defineProperty(Se,"WebAuthnError",{enumerable:!0,get:function(){return pn.WebAuthnError}});var Cf=class{createNewAbortSignal(){if(this.controller){let r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}};Se.WebAuthnAbortService=Cf;Se.webAuthnAbortService=new Cf;function W9(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);let{challenge:e,user:r,excludeCredentials:n}=t,i=JC.__rest(t,["challenge","user","excludeCredentials"]),s=(0,rn.base64UrlToUint8Array)(e).buffer,o=Object.assign(Object.assign({},r),{id:(0,rn.base64UrlToUint8Array)(r.id).buffer}),a=Object.assign(Object.assign({},i),{challenge:s,user:o});if(n&&n.length>0){a.excludeCredentials=new Array(n.length);for(let u=0;u<n.length;u++){let c=n[u];a.excludeCredentials[u]=Object.assign(Object.assign({},c),{id:(0,rn.base64UrlToUint8Array)(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function X9(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);let{challenge:e,allowCredentials:r}=t,n=JC.__rest(t,["challenge","allowCredentials"]),i=(0,rn.base64UrlToUint8Array)(e).buffer,s=Object.assign(Object.assign({},n),{challenge:i});if(r&&r.length>0){s.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){let a=r[o];s.allowCredentials[o]=Object.assign(Object.assign({},a),{id:(0,rn.base64UrlToUint8Array)(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return s}function Y9(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();let r=t;return{id:t.id,rawId:t.id,response:{attestationObject:(0,rn.bytesToBase64URL)(new Uint8Array(t.response.attestationObject)),clientDataJSON:(0,rn.bytesToBase64URL)(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function J9(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();let r=t,n=t.getClientExtensionResults(),i=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:(0,rn.bytesToBase64URL)(new Uint8Array(i.authenticatorData)),clientDataJSON:(0,rn.bytesToBase64URL)(new Uint8Array(i.clientDataJSON)),signature:(0,rn.bytesToBase64URL)(new Uint8Array(i.signature)),userHandle:i.userHandle?(0,rn.bytesToBase64URL)(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Z9(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function YC(){var t,e;return!!((0,K9.isBrowser)()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function ZC(t){try{let e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new pn.WebAuthnUnknownError("Browser returned unexpected credential type",e)}:{data:null,error:new pn.WebAuthnUnknownError("Empty credential response",e)}}catch(e){return{data:null,error:(0,pn.identifyRegistrationError)({error:e,options:t})}}}async function QC(t){try{let e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new pn.WebAuthnUnknownError("Browser returned unexpected credential type",e)}:{data:null,error:new pn.WebAuthnUnknownError("Empty credential response",e)}}catch(e){return{data:null,error:(0,pn.identifyAuthenticationError)({error:e,options:t})}}}Se.DEFAULT_CREATION_OPTIONS={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"none"};Se.DEFAULT_REQUEST_OPTIONS={userVerification:"preferred",hints:["security-key"]};function Sf(...t){let e=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),r=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),n={};for(let i of t)if(i)for(let s in i){let o=i[s];if(o!==void 0)if(Array.isArray(o))n[s]=o;else if(r(o))n[s]=o;else if(e(o)){let a=n[s];e(a)?n[s]=Sf(a,o):n[s]=Sf(o)}else n[s]=o}return n}function eS(t,e){return Sf(Se.DEFAULT_CREATION_OPTIONS,t,e||{})}function tS(t,e){return Sf(Se.DEFAULT_REQUEST_OPTIONS,t,e||{})}var Ry=class{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:i},s){try{let{data:o,error:a}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!o)return{data:null,error:a};let u=i??Se.webAuthnAbortService.createNewAbortSignal();if(o.webauthn.type==="create"){let{user:c}=o.webauthn.credential_options.publicKey;c.name||(c.name=`${c.id}:${n}`),c.displayName||(c.displayName=c.name)}switch(o.webauthn.type){case"create":{let c=eS(o.webauthn.credential_options.publicKey,s?.create),{data:l,error:h}=await ZC({publicKey:c,signal:u});return l?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:l}},error:null}:{data:null,error:h}}case"request":{let c=tS(o.webauthn.credential_options.publicKey,s?.request),{data:l,error:h}=await QC(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:c,signal:u}));return l?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:l}},error:null}:{data:null,error:h}}}}catch(o){return(0,dn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new dn.AuthUnknownError("Unexpected error in challenge",o)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i}},s){if(!r)return{data:null,error:new dn.AuthError("rpId is required for WebAuthn authentication")};try{if(!YC())return{data:null,error:new dn.AuthUnknownError("Browser does not support WebAuthn",null)};let{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:i},{request:s});if(!o)return{data:null,error:a};let{webauthn:u}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:u.type,rpId:r,rpOrigins:n,credential_response:u.credential_response}})}catch(o){return(0,dn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new dn.AuthUnknownError("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i},s){if(!r)return{data:null,error:new dn.AuthError("rpId is required for WebAuthn registration")};try{if(!YC())return{data:null,error:new dn.AuthUnknownError("Browser does not support WebAuthn",null)};let{data:o,error:a}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(l=>{var h;return(h=l.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===e&&d.status!=="unverified")}).then(l=>l?this.client.mfa.unenroll({factorId:l?.id}):void 0),{data:null,error:a};let{data:u,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:i},{create:s});return u?this._verify({factorId:o.id,challengeId:u.challengeId,webauthn:{rpId:r,rpOrigins:n,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:c}}catch(o){return(0,dn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new dn.AuthUnknownError("Unexpected error in register",o)}}}};Se.WebAuthnApi=Ry});var $y=v(Ny=>{"use strict";Object.defineProperty(Ny,"__esModule",{value:!0});var Q9=(fe(),ue(le)),e7=Q9.__importDefault(vf()),Dr=mf(),ee=fs(),he=Cy(),se=Ro(),rS=HC(),nS=Fy(),t7=zC(),r7=uy(),iS=yf(),Af=KC(),Pu=ky();(0,t7.polyfillGlobalThis)();var n7={url:Dr.GOTRUE_URL,storageKey:Dr.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Dr.DEFAULT_HEADERS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function sS(t,e,r){return await r()}var $o={},Of=class t{get jwks(){var e,r;return(r=(e=$o[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){$o[this.storageKey]=Object.assign(Object.assign({},$o[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=$o[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){$o[this.storageKey]=Object.assign(Object.assign({},$o[this.storageKey]),{cachedAt:e})}constructor(e){var r,n;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=t.nextInstanceID,t.nextInstanceID+=1,this.instanceID>0&&(0,se.isBrowser)()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");let i=Object.assign(Object.assign({},n7),e);if(this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.persistSession=i.persistSession,this.storageKey=i.storageKey,this.autoRefreshToken=i.autoRefreshToken,this.admin=new e7.default({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=(0,se.resolveFetch)(i.fetch),this.lock=i.lock||sS,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,i.lock?this.lock=i.lock:(0,se.isBrowser)()&&(!((r=globalThis?.navigator)===null||r===void 0)&&r.locks)?this.lock=nS.navigatorLock:this.lock=sS,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new Pu.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:(0,se.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,rS.memoryLocalStorageAdapter)(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=(0,rS.memoryLocalStorageAdapter)(this.memoryStorage)),(0,se.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(s){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",s)}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",async s=>{this._debug("received broadcast notification from other tab or client",s),await this._notifyAllSubscribers(s.data.event,s.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${r7.version}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let r={},n="none";if((0,se.isBrowser)()&&(r=(0,se.parseParametersFromURL)(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),(0,se.isBrowser)()&&this.detectSessionInUrl&&n!=="none"){let{data:i,error:s}=await this._getSessionFromURL(r,n);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),(0,ee.isAuthImplicitGrantRedirectError)(s)){let u=(e=s.details)===null||e===void 0?void 0:e.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:s}}return await this._removeSession(),{error:s}}let{session:o,redirectType:a}=i;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return(0,ee.isAuthError)(r)?this._returnResult({error:r}):this._returnResult({error:new ee.AuthUnknownError("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,i;try{let s=await(0,he._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e?.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(i=e?.options)===null||i===void 0?void 0:i.captchaToken}},xform:he._sessionResponse}),{data:o,error:a}=s;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});let u=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(e){var r,n,i;try{let s;if("email"in e){let{email:l,password:h,options:d}=e,f=null,m=null;this.flowType==="pkce"&&([f,m]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey)),s=await(0,he._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d?.emailRedirectTo,body:{email:l,password:h,data:(r=d?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:d?.captchaToken},code_challenge:f,code_challenge_method:m},xform:he._sessionResponse})}else if("phone"in e){let{phone:l,password:h,options:d}=e;s=await(0,he._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:l,password:h,data:(n=d?.data)!==null&&n!==void 0?n:{},channel:(i=d?.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:he._sessionResponse})}else throw new ee.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:o,error:a}=s;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});let u=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(e){try{let r;if("email"in e){let{email:s,password:o,options:a}=e;r=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:he._sessionResponsePassword})}else if("phone"in e){let{phone:s,password:o,options:a}=e;r=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:he._sessionResponsePassword})}else throw new ee.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:n,error:i}=r;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!n||!n.session||!n.user){let s=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:s})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:i})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,i,s;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(s=e.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){let{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,i,s,o,a,u,c,l,h,d;let f,m;if("message"in e)f=e.message,m=e.signature;else{let{chain:g,wallet:b,statement:S,options:A}=e,p;if((0,se.isBrowser)())if(typeof b=="object")p=b;else{let R=window;if("ethereum"in R&&typeof R.ethereum=="object"&&"request"in R.ethereum&&typeof R.ethereum.request=="function")p=R.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof b!="object"||!A?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");p=b}let D=new URL((r=A?.url)!==null&&r!==void 0?r:window.location.href),w=await p.request({method:"eth_requestAccounts"}).then(R=>R).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!w||w.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");let _=(0,Af.getAddress)(w[0]),P=(n=A?.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!P){let R=await p.request({method:"eth_chainId"});P=(0,Af.fromHex)(R)}let E={domain:D.host,address:_,statement:S,uri:D.href,version:"1",chainId:P,nonce:(i=A?.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(o=(s=A?.signInWithEthereum)===null||s===void 0?void 0:s.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=A?.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(u=A?.signInWithEthereum)===null||u===void 0?void 0:u.notBefore,requestId:(c=A?.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(l=A?.signInWithEthereum)===null||l===void 0?void 0:l.resources};f=(0,Af.createSiweMessage)(E),m=await p.request({method:"personal_sign",params:[(0,Af.toHex)(f),_]})}try{let{data:g,error:b}=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:m},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=e.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:he._sessionResponse});if(b)throw b;if(!g||!g.session||!g.user){let S=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:S})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:Object.assign({},g),error:b})}catch(g){if((0,ee.isAuthError)(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}}async signInWithSolana(e){var r,n,i,s,o,a,u,c,l,h,d,f;let m,g;if("message"in e)m=e.message,g=e.signature;else{let{chain:b,wallet:S,statement:A,options:p}=e,D;if((0,se.isBrowser)())if(typeof S=="object")D=S;else{let _=window;if("solana"in _&&typeof _.solana=="object"&&("signIn"in _.solana&&typeof _.solana.signIn=="function"||"signMessage"in _.solana&&typeof _.solana.signMessage=="function"))D=_.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof S!="object"||!p?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");D=S}let w=new URL((r=p?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in D&&D.signIn){let _=await D.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},p?.signInWithSolana),{version:"1",domain:w.host,uri:w.href}),A?{statement:A}:null)),P;if(Array.isArray(_)&&_[0]&&typeof _[0]=="object")P=_[0];else if(_&&typeof _=="object"&&"signedMessage"in _&&"signature"in _)P=_;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in P&&"signature"in P&&(typeof P.signedMessage=="string"||P.signedMessage instanceof Uint8Array)&&P.signature instanceof Uint8Array)m=typeof P.signedMessage=="string"?P.signedMessage:new TextDecoder().decode(P.signedMessage),g=P.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in D)||typeof D.signMessage!="function"||!("publicKey"in D)||typeof D!="object"||!D.publicKey||!("toBase58"in D.publicKey)||typeof D.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${w.host} wants you to sign in with your Solana account:`,D.publicKey.toBase58(),...A?["",A,""]:[""],"Version: 1",`URI: ${w.href}`,`Issued At: ${(i=(n=p?.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((s=p?.signInWithSolana)===null||s===void 0)&&s.notBefore?[`Not Before: ${p.signInWithSolana.notBefore}`]:[],...!((o=p?.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${p.signInWithSolana.expirationTime}`]:[],...!((a=p?.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${p.signInWithSolana.chainId}`]:[],...!((u=p?.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${p.signInWithSolana.nonce}`]:[],...!((c=p?.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${p.signInWithSolana.requestId}`]:[],...!((h=(l=p?.signInWithSolana)===null||l===void 0?void 0:l.resources)===null||h===void 0)&&h.length?["Resources",...p.signInWithSolana.resources.map(P=>`- ${P}`)]:[]].join(`
|
|
40
|
+
`);let _=await D.signMessage(new TextEncoder().encode(m),"utf8");if(!_||!(_ instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=_}}try{let{data:b,error:S}=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:(0,iS.bytesToBase64URL)(g)},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:he._sessionResponse});if(S)throw S;if(!b||!b.session||!b.user){let A=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:A})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:S})}catch(b){if((0,ee.isAuthError)(b))return this._returnResult({data:{user:null,session:null},error:b});throw b}}async _exchangeCodeForSession(e){let r=await(0,se.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[n,i]=(r??"").split("/");try{let{data:s,error:o}=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:he._sessionResponse});if(await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!s||!s.session||!s.user){let a=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign(Object.assign({},s),{redirectType:i??null}),error:o})}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(e){try{let{options:r,provider:n,token:i,access_token:s,nonce:o}=e,a=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:i,access_token:s,nonce:o,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:he._sessionResponse}),{data:u,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!u||!u.session||!u.user){let l=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:l})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:u,error:c})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,i,s,o;try{if("email"in e){let{email:a,options:u}=e,c=null,l=null;this.flowType==="pkce"&&([c,l]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{error:h}=await(0,he._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(r=u?.data)!==null&&r!==void 0?r:{},create_user:(n=u?.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},code_challenge:c,code_challenge_method:l},redirectTo:u?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){let{phone:a,options:u}=e,{data:c,error:l}=await(0,he._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(i=u?.data)!==null&&i!==void 0?i:{},create_user:(s=u?.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},channel:(o=u?.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c?.message_id},error:l})}throw new ee.AuthInvalidCredentialsError("You must provide either an email or phone number.")}catch(a){if((0,ee.isAuthError)(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(e){var r,n;try{let i,s;"options"in e&&(i=(r=e.options)===null||r===void 0?void 0:r.redirectTo,s=(n=e.options)===null||n===void 0?void 0:n.captchaToken);let{data:o,error:a}=await(0,he._request)(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:i,xform:he._sessionResponse});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");let u=o.session,c=o.user;return u?.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(i){if((0,ee.isAuthError)(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(e){var r,n,i;try{let s=null,o=null;this.flowType==="pkce"&&([s,o]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let a=await(0,he._request)(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((i=e?.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:s,code_challenge_method:o}),headers:this.headers,xform:he._ssoResponse});return this._returnResult(a)}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:null,error:s});throw s}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new ee.AuthSessionMissingError;let{error:i}=await(0,he._request)(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(e){if((0,ee.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{let r=`${this.url}/resend`;if("email"in e){let{email:n,type:i,options:s}=e,{error:o}=await(0,he._request)(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:i,gotrue_meta_security:{captcha_token:s?.captchaToken}},redirectTo:s?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in e){let{phone:n,type:i,options:s}=e,{data:o,error:a}=await(0,he._request)(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:i,gotrue_meta_security:{captcha_token:s?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o?.message_id},error:a})}throw new ee.AuthInvalidCredentialsError("You must provide either an email or phone number and a type")}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){let i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{let r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null,r=await(0,se.getItemAsync)(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};let n=e.expires_at?e.expires_at*1e3-Date.now()<Dr.EXPIRY_MARGIN_MS:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){let o=await(0,se.getItemAsync)(this.userStorage,this.storageKey+"-user");o?.user?e.user=o.user:e.user=(0,se.userNotAvailableProxy)()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){let o={value:this.suppressGetSessionWarning};e.user=(0,se.insecureUserWarningProxy)(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}let{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{session:null},error:s}):this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await(0,he._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:he._userResponse}):await this._useSession(async r=>{var n,i,s;let{data:o,error:a}=r;if(a)throw a;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ee.AuthSessionMissingError}:await(0,he._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(i=o.session)===null||i===void 0?void 0:i.access_token)!==null&&s!==void 0?s:void 0,xform:he._userResponse})})}catch(r){if((0,ee.isAuthError)(r))return(0,ee.isAuthSessionMissingError)(r)&&(await this._removeSession(),await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async n=>{let{data:i,error:s}=n;if(s)throw s;if(!i.session)throw new ee.AuthSessionMissingError;let o=i.session,a=null,u=null;this.flowType==="pkce"&&e.email!=null&&([a,u]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{data:c,error:l}=await(0,he._request)(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:u}),jwt:o.access_token,xform:he._userResponse});if(l)throw l;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new ee.AuthSessionMissingError;let r=Date.now()/1e3,n=r,i=!0,s=null,{payload:o}=(0,se.decodeJWT)(e.access_token);if(o.exp&&(n=o.exp,i=n<=r),i){let{data:a,error:u}=await this._callRefreshToken(e.refresh_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!a)return{data:{user:null,session:null},error:null};s=a}else{let{data:a,error:u}=await this._getUser(e.access_token);if(u)throw u;s={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){let{data:o,error:a}=r;if(a)throw a;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!e?.refresh_token)throw new ee.AuthSessionMissingError;let{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){try{if(!(0,se.isBrowser)())throw new ee.AuthImplicitGrantRedirectError("No browser detected.");if(e.error||e.error_description||e.error_code)throw new ee.AuthImplicitGrantRedirectError(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new ee.AuthPKCEGrantCodeExchangeError("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ee.AuthImplicitGrantRedirectError("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new ee.AuthPKCEGrantCodeExchangeError("No code detected.");let{data:A,error:p}=await this._exchangeCodeForSession(e.code);if(p)throw p;let D=new URL(window.location.href);return D.searchParams.delete("code"),window.history.replaceState(window.history.state,"",D.toString()),{data:{session:A.session,redirectType:null},error:null}}let{provider_token:n,provider_refresh_token:i,access_token:s,refresh_token:o,expires_in:a,expires_at:u,token_type:c}=e;if(!s||!a||!o||!c)throw new ee.AuthImplicitGrantRedirectError("No session defined in URL");let l=Math.round(Date.now()/1e3),h=parseInt(a),d=l+h;u&&(d=parseInt(u));let f=d-l;f*1e3<=Dr.AUTO_REFRESH_TICK_DURATION_MS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${h}s`);let m=d-h;l-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,d,l):l-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",m,d,l);let{data:g,error:b}=await this._getUser(s);if(b)throw b;let S={provider_token:n,provider_refresh_token:i,access_token:s,expires_in:h,expires_at:d,refresh_token:o,token_type:c,user:g.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:S,redirectType:e.type},error:null})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){let r=await(0,se.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({error:s});let o=(n=i.session)===null||n===void 0?void 0:n.access_token;if(o){let{error:a}=await this.admin.signOut(o,e);if(a&&!((0,ee.isAuthApiError)(a)&&(a.status===404||a.status===401||a.status===403)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){let r=(0,se.uuid)(),n={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,i;try{let{data:{session:s},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(s){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),console.error(s)}})}async resetPasswordForEmail(e,r={}){let n=null,i=null;this.flowType==="pkce"&&([n,i]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,he._request)(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:i,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var e;try{let{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{let{data:n,error:i}=await this._useSession(async s=>{var o,a,u,c,l;let{data:h,error:d}=s;if(d)throw d;let f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(u=e.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await(0,he._request)(this.fetch,"GET",f,{headers:this.headers,jwt:(l=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&l!==void 0?l:void 0})});if(i)throw i;return(0,se.isBrowser)()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n?.url),this._returnResult({data:{provider:e.provider,url:n?.url},error:null})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{let{error:i,data:{session:s}}=r;if(i)throw i;let{options:o,provider:a,token:u,access_token:c,nonce:l}=e,h=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=s?.access_token)!==null&&n!==void 0?n:void 0,body:{provider:a,id_token:u,access_token:c,nonce:l,link_identity:!0,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:he._sessionResponse}),{data:d,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!d||!d.session||!d.user?this._returnResult({data:{user:null,session:null},error:new ee.AuthInvalidTokenResponseError}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(i){if((0,ee.isAuthError)(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,i;let{data:s,error:o}=r;if(o)throw o;return await(0,he._request)(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(n=s.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0})})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){let r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{let n=Date.now();return await(0,se.retryable)(async i=>(i>0&&await(0,se.sleep)(200*Math.pow(2,i-1)),this._debug(r,"refreshing attempt",i),await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:he._sessionResponse})),(i,s)=>{let o=200*Math.pow(2,i);return s&&(0,ee.isAuthRetryableFetchError)(s)&&Date.now()+o-n<Dr.AUTO_REFRESH_TICK_DURATION_MS})}catch(n){if(this._debug(r,"error",n),(0,ee.isAuthError)(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){let n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),(0,se.isBrowser)()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;let n="#_recoverAndRefresh()";this._debug(n,"begin");try{let i=await(0,se.getItemAsync)(this.storage,this.storageKey);if(i&&this.userStorage){let o=await(0,se.getItemAsync)(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:i.user},await(0,se.setItemAsync)(this.userStorage,this.storageKey+"-user",o)),i.user=(e=o?.user)!==null&&e!==void 0?e:(0,se.userNotAvailableProxy)()}else if(i&&!i.user&&!i.user){let o=await(0,se.getItemAsync)(this.storage,this.storageKey+"-user");o&&o?.user?(i.user=o.user,await(0,se.removeItemAsync)(this.storage,this.storageKey+"-user"),await(0,se.setItemAsync)(this.storage,this.storageKey,i)):i.user=(0,se.userNotAvailableProxy)()}if(this._debug(n,"session from storage",i),!this._isValidSession(i)){this._debug(n,"session is not valid"),i!==null&&await this._removeSession();return}let s=((r=i.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Dr.EXPIRY_MARGIN_MS;if(this._debug(n,`session has${s?"":" not"} expired with margin of ${Dr.EXPIRY_MARGIN_MS}s`),s){if(this.autoRefreshToken&&i.refresh_token){let{error:o}=await this._callRefreshToken(i.refresh_token);o&&(console.error(o),(0,ee.isAuthRetryableFetchError)(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{let{data:o,error:a}=await this._getUser(i.access_token);!a&&o?.user?(i.user=o.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(n,"error",i),console.error(i);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new ee.AuthSessionMissingError;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let i=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new se.Deferred;let{data:s,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!s.session)throw new ee.AuthSessionMissingError;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);let a={data:s.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(s){if(this._debug(i,"error",s),(0,ee.isAuthError)(s)){let o={data:null,error:s};return(0,ee.isAuthRetryableFetchError)(s)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(s),s}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,r,n=!0){let i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});let s=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,r)}catch(u){s.push(u)}});if(await Promise.all(o),s.length>0){for(let a=0;a<s.length;a+=1)console.error(s[a]);throw s[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;let r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await(0,se.setItemAsync)(this.userStorage,this.storageKey+"-user",{user:r.user});let i=Object.assign({},r);delete i.user;let s=(0,se.deepClone)(i);await(0,se.setItemAsync)(this.storage,this.storageKey,s)}else{let i=(0,se.deepClone)(r);await(0,se.setItemAsync)(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),await(0,se.removeItemAsync)(this.storage,this.storageKey),await(0,se.removeItemAsync)(this.storage,this.storageKey+"-code-verifier"),await(0,se.removeItemAsync)(this.storage,this.storageKey+"-user"),this.userStorage&&await(0,se.removeItemAsync)(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&(0,se.isBrowser)()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),Dr.AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{let e=Date.now();try{return await this._useSession(async r=>{let{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}let i=Math.floor((n.expires_at*1e3-e)/Dr.AUTO_REFRESH_TICK_DURATION_MS);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${Dr.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${Dr.AUTO_REFRESH_TICK_THRESHOLD} ticks`),i<=Dr.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof nS.LockAcquireTimeoutError)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!(0,se.isBrowser)()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let r=`#_onVisibilityChanged(${e})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,n){let i=[`provider=${encodeURIComponent(r)}`];if(n?.redirectTo&&i.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n?.scopes&&i.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){let[s,o]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(o)}`});i.push(a.toString())}if(n?.queryParams){let s=new URLSearchParams(n.queryParams);i.push(s.toString())}return n?.skipBrowserRedirect&&i.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;return s?this._returnResult({data:null,error:s}):await(0,he._request)(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,i;let{data:s,error:o}=r;if(o)return this._returnResult({data:null,error:o});let a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:u,error:c}=await(0,he._request)(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(n=s?.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&u.type==="totp"&&(!((i=u?.totp)===null||i===void 0)&&i.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),this._returnResult({data:u,error:null}))})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({data:null,error:s});let o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?(0,Pu.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,Pu.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:u}=await(0,he._request)(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token});return u?this._returnResult({data:null,error:u}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:u}))})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({data:null,error:s});let o=await(0,he._request)(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token});if(o.error)return o;let{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,Pu.deserializeCredentialCreationOptions)(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,Pu.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){let{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;let{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};let i={all:[],phone:[],totp:[],webauthn:[]};for(let s of(e=r?.factors)!==null&&e!==void 0?e:[])i.all.push(s),s.status==="verified"&&i[s.factor_type].push(s);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(){var e,r;let{data:{session:n},error:i}=await this.getSession();if(i)return this._returnResult({data:null,error:i});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:s}=(0,se.decodeJWT)(n.access_token),o=null;s.aal&&(o=s.aal);let a=o;((r=(e=n.user.factors)===null||e===void 0?void 0:e.filter(l=>l.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(a="aal2");let c=s.amr||[];return{data:{currentLevel:o,nextLevel:a,currentAuthenticationMethods:c},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{let{data:{session:n},error:i}=r;return i?this._returnResult({data:null,error:i}):n?await(0,he._request)(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new ee.AuthSessionMissingError})})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async n=>{let{data:{session:i},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new ee.AuthSessionMissingError});let o=await(0,he._request)(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&(0,se.isBrowser)()&&!r?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,r){try{return await this._useSession(async n=>{let{data:{session:i},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new ee.AuthSessionMissingError});let o=await(0,he._request)(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&(0,se.isBrowser)()&&!r?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(a=>a.kid===e);if(n)return n;let i=Date.now();if(n=this.jwks.keys.find(a=>a.kid===e),n&&this.jwks_cached_at+Dr.JWKS_TTL>i)return n;let{data:s,error:o}=await(0,he._request)(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!s.keys||s.keys.length===0||(this.jwks=s,this.jwks_cached_at=i,n=s.keys.find(a=>a.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){let{data:f,error:m}=await this.getSession();if(m||!f.session)return this._returnResult({data:null,error:m});n=f.session.access_token}let{header:i,payload:s,signature:o,raw:{header:a,payload:u}}=(0,se.decodeJWT)(n);r?.allowExpired||(0,se.validateExp)(s.exp);let c=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,r?.keys?{keys:r.keys}:r?.jwks);if(!c){let{error:f}=await this.getUser(n);if(f)throw f;return{data:{claims:s,header:i,signature:o},error:null}}let l=(0,se.getAlgorithm)(i.alg),h=await crypto.subtle.importKey("jwk",c,l,!0,["verify"]);if(!await crypto.subtle.verify(l,h,o,(0,iS.stringToUint8Array)(`${a}.${u}`)))throw new ee.AuthInvalidJwtError("Invalid JWT signature");return{data:{claims:s,header:i,signature:o},error:null}}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}};Of.nextInstanceID=0;Ny.default=Of});var oS=v(Ly=>{"use strict";Object.defineProperty(Ly,"__esModule",{value:!0});var i7=(fe(),ue(le)),s7=i7.__importDefault(vf()),o7=s7.default;Ly.default=o7});var aS=v(jy=>{"use strict";Object.defineProperty(jy,"__esModule",{value:!0});var a7=(fe(),ue(le)),u7=a7.__importDefault($y()),c7=u7.default;jy.default=c7});var By=v(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.processLock=At.lockInternals=At.NavigatorLockAcquireTimeoutError=At.navigatorLock=At.AuthClient=At.AuthAdminApi=At.GoTrueClient=At.GoTrueAdminApi=void 0;var Lo=(fe(),ue(le)),l7=Lo.__importDefault(vf());At.GoTrueAdminApi=l7.default;var f7=Lo.__importDefault($y());At.GoTrueClient=f7.default;var h7=Lo.__importDefault(oS());At.AuthAdminApi=h7.default;var d7=Lo.__importDefault(aS());At.AuthClient=d7.default;Lo.__exportStar(Sy(),At);Lo.__exportStar(fs(),At);var xf=Fy();Object.defineProperty(At,"navigatorLock",{enumerable:!0,get:function(){return xf.navigatorLock}});Object.defineProperty(At,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return xf.NavigatorLockAcquireTimeoutError}});Object.defineProperty(At,"lockInternals",{enumerable:!0,get:function(){return xf.internals}});Object.defineProperty(At,"processLock",{enumerable:!0,get:function(){return xf.processLock}})});var uS=v(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});Tf.SupabaseAuthClient=void 0;var p7=By(),My=class extends p7.AuthClient{constructor(e){super(e)}};Tf.SupabaseAuthClient=My});var Hy=v(Uy=>{"use strict";Object.defineProperty(Uy,"__esModule",{value:!0});var m7=Hm(),g7=og(),y7=Cg(),D7=TC(),Ff=IC(),w7=PC(),cS=RC(),b7=uS(),qy=class{constructor(e,r,n){var i,s,o;this.supabaseUrl=e,this.supabaseKey=r;let a=(0,cS.validateSupabaseUrl)(e);if(!r)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);let u=`sb-${a.hostname.split(".")[0]}-auth-token`,c={db:Ff.DEFAULT_DB_OPTIONS,realtime:Ff.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},Ff.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:Ff.DEFAULT_GLOBAL_OPTIONS},l=(0,cS.applySettingDefaults)(n??{},c);this.storageKey=(i=l.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(s=l.global.headers)!==null&&s!==void 0?s:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(h,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=l.auth)!==null&&o!==void 0?o:{},this.headers,l.global.fetch),this.fetch=(0,w7.fetchWithAuth)(r,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.rest=new g7.PostgrestClient(new URL("rest/v1",a).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new D7.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new m7.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,r={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,r,n)}channel(e,r={config:{}}){return this.realtime.channel(e,r)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,r;if(this.accessToken)return await this.accessToken();let{data:n}=await this.auth.getSession();return(r=(e=n.session)===null||e===void 0?void 0:e.access_token)!==null&&r!==void 0?r:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:i,userStorage:s,storageKey:o,flowType:a,lock:u,debug:c,throwOnError:l},h,d){let f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new b7.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},f),h),storageKey:o,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:i,userStorage:s,flowType:a,lock:u,debug:c,throwOnError:l,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new y7.RealtimeClient(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((r,n)=>{this._handleTokenChanged(r,"CLIENT",n?.access_token)})}_handleTokenChanged(e,r,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};Uy.default=qy});var hS=v(Ve=>{"use strict";var v7=Ve&&Ve.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),lS=Ve&&Ve.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&v7(e,t,r)},fS=Ve&&Ve.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.createClient=Ve.SupabaseClient=Ve.FunctionRegion=Ve.FunctionsError=Ve.FunctionsRelayError=Ve.FunctionsFetchError=Ve.FunctionsHttpError=Ve.PostgrestError=void 0;var E7=fS(Hy());lS(By(),Ve);var _7=og();Object.defineProperty(Ve,"PostgrestError",{enumerable:!0,get:function(){return _7.PostgrestError}});var ku=Hm();Object.defineProperty(Ve,"FunctionsHttpError",{enumerable:!0,get:function(){return ku.FunctionsHttpError}});Object.defineProperty(Ve,"FunctionsFetchError",{enumerable:!0,get:function(){return ku.FunctionsFetchError}});Object.defineProperty(Ve,"FunctionsRelayError",{enumerable:!0,get:function(){return ku.FunctionsRelayError}});Object.defineProperty(Ve,"FunctionsError",{enumerable:!0,get:function(){return ku.FunctionsError}});Object.defineProperty(Ve,"FunctionRegion",{enumerable:!0,get:function(){return ku.FunctionRegion}});lS(Cg(),Ve);var C7=Hy();Object.defineProperty(Ve,"SupabaseClient",{enumerable:!0,get:function(){return fS(C7).default}});var S7=(t,e,r)=>new E7.default(t,e,r);Ve.createClient=S7;function A7(){if(typeof window<"u"||typeof process>"u")return!1;let t=process.version;if(t==null)return!1;let e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}A7()&&console.warn("\u26A0\uFE0F Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")});var Vy=v((Lge,dS)=>{dS.exports={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 If=v(mS=>{var pS={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 O7(t){return function(...e){return e.length&&(t=t.replace(/\{(\d)\}/g,(r,n)=>e[n]||"")),new Error("ADM-ZIP: "+t)}}for(let t of Object.keys(pS))mS[t]=O7(pS[t])});var bS=v((Bge,wS)=>{var x7=require("fs"),Tt=require("path"),gS=Vy(),T7=If(),F7=typeof process=="object"&&process.platform==="win32",yS=t=>typeof t=="object"&&t!==null,DS=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=3988292384^e>>>1:e>>>=1;return e>>>0});function dt(t){this.sep=Tt.sep,this.fs=x7,yS(t)&&yS(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}wS.exports=dt;dt.prototype.makeDir=function(t){let e=this;function r(n){let i=n.split(e.sep)[0];n.split(e.sep).forEach(function(s){if(!(!s||s.substr(-1,1)===":")){i+=e.sep+s;var o;try{o=e.fs.statSync(i)}catch{e.fs.mkdirSync(i)}if(o&&o.isFile())throw T7.FILE_IN_THE_WAY(`"${i}"`)}})}r(t)};dt.prototype.writeFileTo=function(t,e,r,n){let i=this;if(i.fs.existsSync(t)){if(!r)return!1;var s=i.fs.statSync(t);if(s.isDirectory())return!1}var o=Tt.dirname(t);i.fs.existsSync(o)||i.makeDir(o);var a;try{a=i.fs.openSync(t,"w",438)}catch{i.fs.chmodSync(t,438),a=i.fs.openSync(t,"w",438)}if(a)try{i.fs.writeSync(a,e,0,e.length,0)}finally{i.fs.closeSync(a)}return i.fs.chmodSync(t,n||438),!0};dt.prototype.writeFileToAsync=function(t,e,r,n,i){typeof n=="function"&&(i=n,n=void 0);let s=this;s.fs.exists(t,function(o){if(o&&!r)return i(!1);s.fs.stat(t,function(a,u){if(o&&u.isDirectory())return i(!1);var c=Tt.dirname(t);s.fs.exists(c,function(l){l||s.makeDir(c),s.fs.open(t,"w",438,function(h,d){h?s.fs.chmod(t,438,function(){s.fs.open(t,"w",438,function(f,m){s.fs.write(m,e,0,e.length,0,function(){s.fs.close(m,function(){s.fs.chmod(t,n||438,function(){i(!0)})})})})}):d?s.fs.write(d,e,0,e.length,0,function(){s.fs.close(d,function(){s.fs.chmod(t,n||438,function(){i(!0)})})}):s.fs.chmod(t,n||438,function(){i(!0)})})})})})};dt.prototype.findFiles=function(t){let e=this;function r(n,i,s){typeof i=="boolean"&&(s=i,i=void 0);let o=[];return e.fs.readdirSync(n).forEach(function(a){let u=Tt.join(n,a),c=e.fs.statSync(u);(!i||i.test(u))&&o.push(Tt.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&s&&(o=o.concat(r(u,i,s)))}),o}return r(t,void 0,!0)};dt.prototype.findFilesAsync=function(t,e){let r=this,n=[];r.fs.readdir(t,function(i,s){if(i)return e(i);let o=s.length;if(!o)return e(null,n);s.forEach(function(a){a=Tt.join(t,a),r.fs.stat(a,function(u,c){if(u)return e(u);c&&(n.push(Tt.normalize(a)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(a,function(l,h){if(l)return e(l);n=n.concat(h),--o||e(null,n)}):--o||e(null,n))})})})};dt.prototype.getAttributes=function(){};dt.prototype.setAttributes=function(){};dt.crc32update=function(t,e){return DS[(t^e)&255]^t>>>8};dt.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=dt.crc32update(r,t[n++]);return~r>>>0};dt.methodToString=function(t){switch(t){case gS.STORED:return"STORED ("+t+")";case gS.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};dt.canonical=function(t){if(!t)return"";let e=Tt.posix.normalize("/"+t.split("\\").join("/"));return Tt.join(".",e)};dt.zipnamefix=function(t){if(!t)return"";let e=Tt.posix.normalize("/"+t.split("\\").join("/"));return Tt.posix.join(".",e)};dt.findLast=function(t,e){if(!Array.isArray(t))throw new TypeError("arr is not array");let r=t.length>>>0;for(let n=r-1;n>=0;n--)if(e(t[n],n,t))return t[n]};dt.sanitize=function(t,e){t=Tt.resolve(Tt.normalize(t));for(var r=e.split("/"),n=0,i=r.length;n<i;n++){var s=Tt.normalize(Tt.join(t,r.slice(n,i).join(Tt.sep)));if(s.indexOf(t)===0)return s}return Tt.normalize(Tt.join(t,Tt.basename(e)))};dt.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};dt.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};dt.fromDOS2Date=function(t){return new Date((t>>25&127)+1980,Math.max((t>>21&15)-1,0),Math.max(t>>16&31,1),t>>11&31,t>>5&63,(t&31)<<1)};dt.fromDate2DOS=function(t){let e=0,r=0;return t.getFullYear()>1979&&(e=(t.getFullYear()-1980&127)<<9|t.getMonth()+1<<5|t.getDate(),r=t.getHours()<<11|t.getMinutes()<<5|t.getSeconds()>>1),e<<16|r};dt.isWin=F7;dt.crcTable=DS});var ES=v((Mge,vS)=>{var I7=require("path");vS.exports=function(t,{fs:e}){var r=t||"",n=s(),i=null;function s(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return r&&e.existsSync(r)?(i=e.statSync(r),n.directory=i.isDirectory(),n.mtime=i.mtime,n.atime=i.atime,n.executable=(73&i.mode)!==0,n.readonly=(128&i.mode)===0,n.hidden=I7.basename(r)[0]==="."):console.warn("Invalid path: "+r),{get directory(){return n.directory},get readOnly(){return n.readonly},get hidden(){return n.hidden},get mtime(){return n.mtime},get atime(){return n.atime},get executable(){return n.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:r,isDirectory:n.directory,isReadOnly:n.readonly,isHidden:n.hidden,isExecutable:n.executable,mTime:n.mtime,aTime:n.atime}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var CS=v((qge,_S)=>{_S.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var Bo=v((Uge,jo)=>{jo.exports=bS();jo.exports.Constants=Vy();jo.exports.Errors=If();jo.exports.FileAttr=ES();jo.exports.decoder=CS()});var AS=v((Hge,SS)=>{var Oi=Bo(),X=Oi.Constants;SS.exports=function(){var t=20,e=10,r=0,n=0,i=0,s=0,o=0,a=0,u=0,c=0,l=0,h=0,d=0,f=0,m=0;t|=Oi.isWin?2560:768,r|=X.FLG_EFS;let g={extraLen:0},b=p=>Math.max(0,p)>>>0,S=p=>Math.max(0,p)&65535,A=p=>Math.max(0,p)&255;return i=Oi.fromDate2DOS(new Date),{get made(){return t},set made(p){t=p},get version(){return e},set version(p){e=p},get flags(){return r},set flags(p){r=p},get flags_efs(){return(r&X.FLG_EFS)>0},set flags_efs(p){p?r|=X.FLG_EFS:r&=~X.FLG_EFS},get flags_desc(){return(r&X.FLG_DESC)>0},set flags_desc(p){p?r|=X.FLG_DESC:r&=~X.FLG_DESC},get method(){return n},set method(p){switch(p){case X.STORED:this.version=10;case X.DEFLATED:default:this.version=20}n=p},get time(){return Oi.fromDOS2Date(this.timeval)},set time(p){this.timeval=Oi.fromDate2DOS(p)},get timeval(){return i},set timeval(p){i=b(p)},get timeHighByte(){return A(i>>>8)},get crc(){return s},set crc(p){s=b(p)},get compressedSize(){return o},set compressedSize(p){o=b(p)},get size(){return a},set size(p){a=b(p)},get fileNameLength(){return u},set fileNameLength(p){u=p},get extraLength(){return c},set extraLength(p){c=p},get extraLocalLength(){return g.extraLen},set extraLocalLength(p){g.extraLen=p},get commentLength(){return l},set commentLength(p){l=p},get diskNumStart(){return h},set diskNumStart(p){h=b(p)},get inAttr(){return d},set inAttr(p){d=b(p)},get attr(){return f},set attr(p){f=b(p)},get fileAttr(){return(f||0)>>16&4095},get offset(){return m},set offset(p){m=b(p)},get encrypted(){return(r&X.FLG_ENC)===X.FLG_ENC},get centralHeaderSize(){return X.CENHDR+u+c+l},get realDataOffset(){return m+X.LOCHDR+g.fnameLen+g.extraLen},get localHeader(){return g},loadLocalHeaderFromBinary:function(p){var D=p.slice(m,m+X.LOCHDR);if(D.readUInt32LE(0)!==X.LOCSIG)throw Oi.Errors.INVALID_LOC();g.version=D.readUInt16LE(X.LOCVER),g.flags=D.readUInt16LE(X.LOCFLG),g.method=D.readUInt16LE(X.LOCHOW),g.time=D.readUInt32LE(X.LOCTIM),g.crc=D.readUInt32LE(X.LOCCRC),g.compressedSize=D.readUInt32LE(X.LOCSIZ),g.size=D.readUInt32LE(X.LOCLEN),g.fnameLen=D.readUInt16LE(X.LOCNAM),g.extraLen=D.readUInt16LE(X.LOCEXT);let w=m+X.LOCHDR+g.fnameLen,_=w+g.extraLen;return p.slice(w,_)},loadFromBinary:function(p){if(p.length!==X.CENHDR||p.readUInt32LE(0)!==X.CENSIG)throw Oi.Errors.INVALID_CEN();t=p.readUInt16LE(X.CENVEM),e=p.readUInt16LE(X.CENVER),r=p.readUInt16LE(X.CENFLG),n=p.readUInt16LE(X.CENHOW),i=p.readUInt32LE(X.CENTIM),s=p.readUInt32LE(X.CENCRC),o=p.readUInt32LE(X.CENSIZ),a=p.readUInt32LE(X.CENLEN),u=p.readUInt16LE(X.CENNAM),c=p.readUInt16LE(X.CENEXT),l=p.readUInt16LE(X.CENCOM),h=p.readUInt16LE(X.CENDSK),d=p.readUInt16LE(X.CENATT),f=p.readUInt32LE(X.CENATX),m=p.readUInt32LE(X.CENOFF)},localHeaderToBinary:function(){var p=Buffer.alloc(X.LOCHDR);return p.writeUInt32LE(X.LOCSIG,0),p.writeUInt16LE(e,X.LOCVER),p.writeUInt16LE(r,X.LOCFLG),p.writeUInt16LE(n,X.LOCHOW),p.writeUInt32LE(i,X.LOCTIM),p.writeUInt32LE(s,X.LOCCRC),p.writeUInt32LE(o,X.LOCSIZ),p.writeUInt32LE(a,X.LOCLEN),p.writeUInt16LE(u,X.LOCNAM),p.writeUInt16LE(g.extraLen,X.LOCEXT),p},centralHeaderToBinary:function(){var p=Buffer.alloc(X.CENHDR+u+c+l);return p.writeUInt32LE(X.CENSIG,0),p.writeUInt16LE(t,X.CENVEM),p.writeUInt16LE(e,X.CENVER),p.writeUInt16LE(r,X.CENFLG),p.writeUInt16LE(n,X.CENHOW),p.writeUInt32LE(i,X.CENTIM),p.writeUInt32LE(s,X.CENCRC),p.writeUInt32LE(o,X.CENSIZ),p.writeUInt32LE(a,X.CENLEN),p.writeUInt16LE(u,X.CENNAM),p.writeUInt16LE(c,X.CENEXT),p.writeUInt16LE(l,X.CENCOM),p.writeUInt16LE(h,X.CENDSK),p.writeUInt16LE(d,X.CENATT),p.writeUInt32LE(f,X.CENATX),p.writeUInt32LE(m,X.CENOFF),p},toJSON:function(){let p=function(D){return D+" bytes"};return{made:t,version:e,flags:r,method:Oi.methodToString(n),time:this.time,crc:"0x"+s.toString(16).toUpperCase(),compressedSize:p(o),size:p(a),fileNameLength:p(u),extraLength:p(c),commentLength:p(l),diskNumStart:h,inAttr:d,attr:f,offset:m,centralHeaderSize:p(X.CENHDR+u+c+l)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var xS=v((Vge,OS)=>{var Mo=Bo(),ut=Mo.Constants;OS.exports=function(){var t=0,e=0,r=0,n=0,i=0;return{get diskEntries(){return t},set diskEntries(s){t=e=s},get totalEntries(){return e},set totalEntries(s){e=t=s},get size(){return r},set size(s){r=s},get offset(){return n},set offset(s){n=s},get commentLength(){return i},set commentLength(s){i=s},get mainHeaderSize(){return ut.ENDHDR+i},loadFromBinary:function(s){if((s.length!==ut.ENDHDR||s.readUInt32LE(0)!==ut.ENDSIG)&&(s.length<ut.ZIP64HDR||s.readUInt32LE(0)!==ut.ZIP64SIG))throw Mo.Errors.INVALID_END();s.readUInt32LE(0)===ut.ENDSIG?(t=s.readUInt16LE(ut.ENDSUB),e=s.readUInt16LE(ut.ENDTOT),r=s.readUInt32LE(ut.ENDSIZ),n=s.readUInt32LE(ut.ENDOFF),i=s.readUInt16LE(ut.ENDCOM)):(t=Mo.readBigUInt64LE(s,ut.ZIP64SUB),e=Mo.readBigUInt64LE(s,ut.ZIP64TOT),r=Mo.readBigUInt64LE(s,ut.ZIP64SIZE),n=Mo.readBigUInt64LE(s,ut.ZIP64OFF),i=0)},toBinary:function(){var s=Buffer.alloc(ut.ENDHDR+i);return s.writeUInt32LE(ut.ENDSIG,0),s.writeUInt32LE(0,4),s.writeUInt16LE(t,ut.ENDSUB),s.writeUInt16LE(e,ut.ENDTOT),s.writeUInt32LE(r,ut.ENDSIZ),s.writeUInt32LE(n,ut.ENDOFF),s.writeUInt16LE(i,ut.ENDCOM),s.fill(" ",ut.ENDHDR),s},toJSON:function(){let s=function(o,a){let u=o.toString(16).toUpperCase();for(;u.length<a;)u="0"+u;return"0x"+u};return{diskEntries:t,totalEntries:e,size:r+" bytes",offset:s(n,4),commentLength:i}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Gy=v(zy=>{zy.EntryHeader=AS();zy.MainHeader=xS()});var FS=v((Gge,TS)=>{TS.exports=function(t){var e=require("zlib"),r={chunkSize:(parseInt(t.length/1024)+1)*1024};return{deflate:function(){return e.deflateRawSync(t,r)},deflateAsync:function(n){var i=e.createDeflateRaw(r),s=[],o=0;i.on("data",function(a){s.push(a),o+=a.length}),i.on("end",function(){var a=Buffer.alloc(o),u=0;a.fill(0);for(var c=0;c<s.length;c++){var l=s[c];l.copy(a,u),u+=l.length}n&&n(a)}),i.end(t)}}}});var PS=v((Kge,IS)=>{var P7=+(process.versions?process.versions.node:"").split(".")[0]||0;IS.exports=function(t,e){var r=require("zlib");let n=P7>=15&&e>0?{maxOutputLength:e}:{};return{inflate:function(){return r.inflateRawSync(t,n)},inflateAsync:function(i){var s=r.createInflateRaw(n),o=[],a=0;s.on("data",function(u){o.push(u),a+=u.length}),s.on("end",function(){var u=Buffer.alloc(a),c=0;u.fill(0);for(var l=0;l<o.length;l++){var h=o[l];h.copy(u,c),c+=h.length}i&&i(u)}),s.end(t)}}}});var LS=v((Wge,$S)=>{"use strict";var{randomFillSync:kS}=require("crypto"),k7=If(),R7=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=e>>>1^3988292384:e>>>=1;return e>>>0}),NS=(t,e)=>Math.imul(t,e)>>>0,RS=(t,e)=>R7[(t^e)&255]^t>>>8,Ru=()=>typeof kS=="function"?kS(Buffer.alloc(12)):Ru.node();Ru.node=()=>{let t=Buffer.alloc(12),e=t.length;for(let r=0;r<e;r++)t[r]=Math.random()*256&255;return t};var Pf={genSalt:Ru};function kf(t){let e=Buffer.isBuffer(t)?t:Buffer.from(t);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let r=0;r<e.length;r++)this.updateKeys(e[r])}kf.prototype.updateKeys=function(t){let e=this.keys;return e[0]=RS(e[0],t),e[1]+=e[0]&255,e[1]=NS(e[1],134775813)+1,e[2]=RS(e[2],e[1]>>>24),t};kf.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return NS(t,t^1)>>8&255};function N7(t){let e=new kf(t);return function(r){let n=Buffer.alloc(r.length),i=0;for(let s of r)n[i++]=e.updateKeys(s^e.next());return n}}function $7(t){let e=new kf(t);return function(r,n,i=0){n||(n=Buffer.alloc(r.length));for(let s of r){let o=e.next();n[i++]=s^o,e.updateKeys(s)}return n}}function L7(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=N7(r),i=n(t.slice(0,12)),s=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(i[11]!==s)throw k7.WRONG_PASSWORD();return n(t.slice(12))}function j7(t){Buffer.isBuffer(t)&&t.length>=12?Pf.genSalt=function(){return t.slice(0,12)}:t==="node"?Pf.genSalt=Ru.node:Pf.genSalt=Ru}function B7(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let i=$7(r),s=Pf.genSalt();s[11]=e.crc>>>24&255,n&&(s[10]=e.crc>>>16&255);let o=Buffer.alloc(t.length+12);return i(s,o),i(t,o,12)}$S.exports={decrypt:L7,encrypt:B7,_salter:j7}});var jS=v(Rf=>{Rf.Deflater=FS();Rf.Inflater=PS();Rf.ZipCrypto=LS()});var Wy=v((Yge,BS)=>{var Pe=Bo(),M7=Gy(),pt=Pe.Constants,Ky=jS();BS.exports=function(t,e){var r=new M7.EntryHeader,n=Buffer.alloc(0),i=Buffer.alloc(0),s=!1,o=null,a=Buffer.alloc(0),u=Buffer.alloc(0),c=!0;let l=t,h=typeof l.decoder=="object"?l.decoder:Pe.decoder;c=h.hasOwnProperty("efs")?h.efs:!1;function d(){return!e||!(e instanceof Uint8Array)?Buffer.alloc(0):(u=r.loadLocalHeaderFromBinary(e),e.slice(r.realDataOffset,r.realDataOffset+r.compressedSize))}function f(p){if(r.flags_desc){let D={},w=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(w)==pt.LOCSIG||e.readUInt32LE(w)==pt.CENSIG)throw Pe.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(w)==pt.EXTSIG)D.crc=e.readUInt32LE(w+pt.EXTCRC),D.compressedSize=e.readUInt32LE(w+pt.EXTSIZ),D.size=e.readUInt32LE(w+pt.EXTLEN);else if(e.readUInt16LE(w+12)===19280)D.crc=e.readUInt32LE(w+pt.EXTCRC-4),D.compressedSize=e.readUInt32LE(w+pt.EXTSIZ-4),D.size=e.readUInt32LE(w+pt.EXTLEN-4);else throw Pe.Errors.DESCRIPTOR_UNKNOWN();if(D.compressedSize!==r.compressedSize||D.size!==r.size||D.crc!==r.crc)throw Pe.Errors.DESCRIPTOR_FAULTY();if(Pe.crc32(p)!==D.crc)return!1}else if(Pe.crc32(p)!==r.localHeader.crc)return!1;return!0}function m(p,D,w){if(typeof D>"u"&&typeof p=="string"&&(w=p,p=void 0),s)return p&&D&&D(Buffer.alloc(0),Pe.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var _=d();if(_.length===0)return p&&D&&D(_),_;if(r.encrypted){if(typeof w!="string"&&!Buffer.isBuffer(w))throw Pe.Errors.INVALID_PASS_PARAM();_=Ky.ZipCrypto.decrypt(_,r,w)}var P=Buffer.alloc(r.size);switch(r.method){case Pe.Constants.STORED:if(_.copy(P),f(P))return p&&D&&D(P),P;throw p&&D&&D(P,Pe.Errors.BAD_CRC()),Pe.Errors.BAD_CRC();case Pe.Constants.DEFLATED:var E=new Ky.Inflater(_,r.size);if(p)E.inflateAsync(function(R){R.copy(R,0),D&&(f(R)?D(R):D(R,Pe.Errors.BAD_CRC()))});else{if(E.inflate(P).copy(P,0),!f(P))throw Pe.Errors.BAD_CRC(`"${h.decode(n)}"`);return P}break;default:throw p&&D&&D(Buffer.alloc(0),Pe.Errors.UNKNOWN_METHOD()),Pe.Errors.UNKNOWN_METHOD()}}function g(p,D){if((!o||!o.length)&&Buffer.isBuffer(e))return p&&D&&D(d()),d();if(o.length&&!s){var w;switch(r.method){case Pe.Constants.STORED:return r.compressedSize=r.size,w=Buffer.alloc(o.length),o.copy(w),p&&D&&D(w),w;default:case Pe.Constants.DEFLATED:var _=new Ky.Deflater(o);if(p)_.deflateAsync(function(E){w=Buffer.alloc(E.length),r.compressedSize=E.length,E.copy(w),D&&D(w)});else{var P=_.deflate();return r.compressedSize=P.length,P}_=null;break}}else if(p&&D)D(Buffer.alloc(0));else return Buffer.alloc(0)}function b(p,D){return(p.readUInt32LE(D+4)<<4)+p.readUInt32LE(D)}function S(p){try{for(var D=0,w,_,P;D+4<p.length;)w=p.readUInt16LE(D),D+=2,_=p.readUInt16LE(D),D+=2,P=p.slice(D,D+_),D+=_,pt.ID_ZIP64===w&&A(P)}catch{throw Pe.Errors.EXTRA_FIELD_PARSE_ERROR()}}function A(p){var D,w,_,P;p.length>=pt.EF_ZIP64_SCOMP&&(D=b(p,pt.EF_ZIP64_SUNCOMP),r.size===pt.EF_ZIP64_OR_32&&(r.size=D)),p.length>=pt.EF_ZIP64_RHO&&(w=b(p,pt.EF_ZIP64_SCOMP),r.compressedSize===pt.EF_ZIP64_OR_32&&(r.compressedSize=w)),p.length>=pt.EF_ZIP64_DSN&&(_=b(p,pt.EF_ZIP64_RHO),r.offset===pt.EF_ZIP64_OR_32&&(r.offset=_)),p.length>=pt.EF_ZIP64_DSN+4&&(P=p.readUInt32LE(pt.EF_ZIP64_DSN),r.diskNumStart===pt.EF_ZIP64_OR_16&&(r.diskNumStart=P))}return{get entryName(){return h.decode(n)},get rawEntryName(){return n},set entryName(p){n=Pe.toBuffer(p,h.encode);var D=n[n.length-1];s=D===47||D===92,r.fileNameLength=n.length},get efs(){return typeof c=="function"?c(this.entryName):c},get extra(){return a},set extra(p){a=p,r.extraLength=p.length,S(p)},get comment(){return h.decode(i)},set comment(p){if(i=Pe.toBuffer(p,h.encode),r.commentLength=i.length,i.length>65535)throw Pe.Errors.COMMENT_TOO_LONG()},get name(){var p=h.decode(n);return s?p.substr(p.length-1).split("/").pop():p.split("/").pop()},get isDirectory(){return s},getCompressedData:function(){return g(!1,null)},getCompressedDataAsync:function(p){g(!0,p)},setData:function(p){o=Pe.toBuffer(p,Pe.decoder.encode),!s&&o.length?(r.size=o.length,r.method=Pe.Constants.DEFLATED,r.crc=Pe.crc32(p),r.changed=!0):r.method=Pe.Constants.STORED},getData:function(p){return r.changed?o:m(!1,null,p)},getDataAsync:function(p,D){r.changed?p(o):m(!0,p,D)},set attr(p){r.attr=p},get attr(){return r.attr},set header(p){r.loadFromBinary(p)},get header(){return r},packCentralHeader:function(){r.flags_efs=this.efs,r.extraLength=a.length;var p=r.centralHeaderToBinary(),D=Pe.Constants.CENHDR;return n.copy(p,D),D+=n.length,a.copy(p,D),D+=r.extraLength,i.copy(p,D),p},packLocalHeader:function(){let p=0;r.flags_efs=this.efs,r.extraLocalLength=u.length;let D=r.localHeaderToBinary(),w=Buffer.alloc(D.length+n.length+r.extraLocalLength);return D.copy(w,p),p+=D.length,n.copy(w,p),p+=n.length,u.copy(w,p),p+=u.length,w},toJSON:function(){let p=function(D){return"<"+(D&&D.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:p(e),data:p(o)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var US=v((Jge,qS)=>{var MS=Wy(),q7=Gy(),Bt=Bo();qS.exports=function(t,e){var r=[],n={},i=Buffer.alloc(0),s=new q7.MainHeader,o=!1,a=null;let u=new Set,c=e,{noSort:l,decoder:h}=c;t?m(c.readEntries):o=!0;function d(){let b=new Set;for(let S of Object.keys(n)){let A=S.split("/");if(A.pop(),!!A.length)for(let p=0;p<A.length;p++){let D=A.slice(0,p+1).join("/")+"/";b.add(D)}}for(let S of b)if(!(S in n)){let A=new MS(c);A.entryName=S,A.attr=16,A.temporary=!0,r.push(A),n[A.entryName]=A,u.add(A)}}function f(){if(o=!0,n={},s.diskEntries>(t.length-s.offset)/Bt.Constants.CENHDR)throw Bt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(s.diskEntries);for(var b=s.offset,S=0;S<r.length;S++){var A=b,p=new MS(c,t);p.header=t.slice(A,A+=Bt.Constants.CENHDR),p.entryName=t.slice(A,A+=p.header.fileNameLength),p.header.extraLength&&(p.extra=t.slice(A,A+=p.header.extraLength)),p.header.commentLength&&(p.comment=t.slice(A,A+p.header.commentLength)),b+=p.header.centralHeaderSize,r[S]=p,n[p.entryName]=p}u.clear(),d()}function m(b){var S=t.length-Bt.Constants.ENDHDR,A=Math.max(0,S-65535),p=A,D=t.length,w=-1,_=0;for((typeof c.trailingSpace=="boolean"?c.trailingSpace:!1)&&(A=0),S;S>=p;S--)if(t[S]===80){if(t.readUInt32LE(S)===Bt.Constants.ENDSIG){w=S,_=S,D=S+Bt.Constants.ENDHDR,p=S-Bt.Constants.END64HDR;continue}if(t.readUInt32LE(S)===Bt.Constants.END64SIG){p=A;continue}if(t.readUInt32LE(S)===Bt.Constants.ZIP64SIG){w=S,D=S+Bt.readBigUInt64LE(t,S+Bt.Constants.ZIP64SIZE)+Bt.Constants.ZIP64LEAD;break}}if(w==-1)throw Bt.Errors.INVALID_FORMAT();s.loadFromBinary(t.slice(w,D)),s.commentLength&&(i=t.slice(_+Bt.Constants.ENDHDR)),b&&f()}function g(){r.length>1&&!l&&r.sort((b,S)=>b.entryName.toLowerCase().localeCompare(S.entryName.toLowerCase()))}return{get entries(){return o||f(),r.filter(b=>!u.has(b))},get comment(){return h.decode(i)},set comment(b){i=Bt.toBuffer(b,h.encode),s.commentLength=i.length},getEntryCount:function(){return o?r.length:s.diskEntries},forEach:function(b){this.entries.forEach(b)},getEntry:function(b){return o||f(),n[b]||null},setEntry:function(b){o||f(),r.push(b),n[b.entryName]=b,s.totalEntries=r.length},deleteFile:function(b,S=!0){o||f();let A=n[b];this.getEntryChildren(A,S).map(D=>D.entryName).forEach(this.deleteEntry)},deleteEntry:function(b){o||f();let S=n[b],A=r.indexOf(S);A>=0&&(r.splice(A,1),delete n[b],s.totalEntries=r.length)},getEntryChildren:function(b,S=!0){if(o||f(),typeof b=="object")if(b.isDirectory&&S){let A=[],p=b.entryName;for(let D of r)D.entryName.startsWith(p)&&A.push(D);return A}else return[b];return[]},getChildCount:function(b){if(b&&b.isDirectory){let S=this.getEntryChildren(b);return S.includes(b)?S.length-1:S.length}return 0},compressToBuffer:function(){o||f(),g();let b=[],S=[],A=0,p=0;s.size=0,s.offset=0;let D=0;for(let P of this.entries){let E=P.getCompressedData();P.header.offset=p;let R=P.packLocalHeader(),k=R.length+E.length;p+=k,b.push(R),b.push(E);let F=P.packCentralHeader();S.push(F),s.size+=F.length,A+=k+F.length,D++}A+=s.mainHeaderSize,s.offset=p,s.totalEntries=D,p=0;let w=Buffer.alloc(A);for(let P of b)P.copy(w,p),p+=P.length;for(let P of S)P.copy(w,p),p+=P.length;let _=s.toBinary();return i&&i.copy(_,Bt.Constants.ENDHDR),_.copy(w,p),t=w,o=!1,w},toAsyncBuffer:function(b,S,A,p){try{o||f(),g();let D=[],w=[],_=0,P=0,E=0;s.size=0,s.offset=0;let R=function(k){if(k.length>0){let F=k.shift(),j=F.entryName+F.extra.toString();A&&A(j),F.getCompressedDataAsync(function(U){p&&p(j),F.header.offset=P;let G=F.packLocalHeader(),L=G.length+U.length;P+=L,D.push(G),D.push(U);let C=F.packCentralHeader();w.push(C),s.size+=C.length,_+=L+C.length,E++,R(k)})}else{_+=s.mainHeaderSize,s.offset=P,s.totalEntries=E,P=0;let F=Buffer.alloc(_);D.forEach(function(U){U.copy(F,P),P+=U.length}),w.forEach(function(U){U.copy(F,P),P+=U.length});let j=s.toBinary();i&&i.copy(j,Bt.Constants.ENDHDR),j.copy(F,P),t=F,o=!1,b(F)}};R(Array.from(this.entries))}catch(D){S(D)}}}}});var zS=v((Zge,VS)=>{var ct=Bo(),mt=require("path"),U7=Wy(),H7=US(),ms=(...t)=>ct.findLast(t,e=>typeof e=="boolean"),HS=(...t)=>ct.findLast(t,e=>typeof e=="string"),V7=(...t)=>ct.findLast(t,e=>typeof e=="function"),z7={noSort:!1,readEntries:!1,method:ct.Constants.NONE,fs:null};VS.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),z7);t&&typeof t=="object"&&(t instanceof Uint8Array||(Object.assign(n,t),t=n.input?n.input:void 0,n.input&&delete n.input),Buffer.isBuffer(t)&&(r=t,n.method=ct.Constants.BUFFER,t=void 0)),Object.assign(n,e);let i=new ct(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=ct.decoder),t&&typeof t=="string")if(i.fs.existsSync(t))n.method=ct.Constants.FILE,n.filename=t,r=i.fs.readFileSync(t);else throw ct.Errors.INVALID_FILENAME();let s=new H7(r,n),{canonical:o,sanitize:a,zipnamefix:u}=ct;function c(f){if(f&&s){var m;if(typeof f=="string"&&(m=s.getEntry(mt.posix.normalize(f))),typeof f=="object"&&typeof f.entryName<"u"&&typeof f.header<"u"&&(m=s.getEntry(f.entryName)),m)return m}return null}function l(f){let{join:m,normalize:g,sep:b}=mt.posix;return m(".",g(b+f.split("\\").join(b)+b))}function h(f){return f instanceof RegExp?(function(m){return function(g){return m.test(g)}})(f):typeof f!="function"?()=>!0:f}let d=(f,m)=>{let g=m.slice(-1);return g=g===i.sep?i.sep:"",mt.relative(f,m)+g};return{readFile:function(f,m){var g=c(f);return g&&g.getData(m)||null},childCount:function(f){let m=c(f);if(m)return s.getChildCount(m)},readFileAsync:function(f,m){var g=c(f);g?g.getDataAsync(m):m(null,"getEntry failed for:"+f)},readAsText:function(f,m){var g=c(f);if(g){var b=g.getData();if(b&&b.length)return b.toString(m||"utf8")}return""},readAsTextAsync:function(f,m,g){var b=c(f);b?b.getDataAsync(function(S,A){if(A){m(S,A);return}S&&S.length?m(S.toString(g||"utf8")):m("")}):m("")},deleteFile:function(f,m=!0){var g=c(f);g&&s.deleteFile(g.entryName,m)},deleteEntry:function(f){var m=c(f);m&&s.deleteEntry(m.entryName)},addZipComment:function(f){s.comment=f},getZipComment:function(){return s.comment||""},addZipEntryComment:function(f,m){var g=c(f);g&&(g.comment=m)},getZipEntryComment:function(f){var m=c(f);return m&&m.comment||""},updateFile:function(f,m){var g=c(f);g&&g.setData(m)},addLocalFile:function(f,m,g,b){if(i.fs.existsSync(f)){m=m?l(m):"";let S=mt.win32.basename(mt.win32.normalize(f));m+=g||S;let A=i.fs.statSync(f),p=A.isFile()?i.fs.readFileSync(f):Buffer.alloc(0);A.isDirectory()&&(m+=i.sep),this.addFile(m,p,b,A)}else throw ct.Errors.FILE_NOT_FOUND(f)},addLocalFileAsync:function(f,m){f=typeof f=="object"?f:{localPath:f};let g=mt.resolve(f.localPath),{comment:b}=f,{zipPath:S,zipName:A}=f,p=this;i.fs.stat(g,function(D,w){if(D)return m(D,!1);S=S?l(S):"";let _=mt.win32.basename(mt.win32.normalize(g));if(S+=A||_,w.isFile())i.fs.readFile(g,function(P,E){return P?m(P,!1):(p.addFile(S,E,b,w),setImmediate(m,void 0,!0))});else if(w.isDirectory())return S+=i.sep,p.addFile(S,Buffer.alloc(0),b,w),setImmediate(m,void 0,!0)})},addLocalFolder:function(f,m,g){if(g=h(g),m=m?l(m):"",f=mt.normalize(f),i.fs.existsSync(f)){let b=i.findFiles(f),S=this;if(b.length)for(let A of b){let p=mt.join(m,d(f,A));g(p)&&S.addLocalFile(A,mt.dirname(p))}}else throw ct.Errors.FILE_NOT_FOUND(f)},addLocalFolderAsync:function(f,m,g,b){b=h(b),g=g?l(g):"",f=mt.normalize(f);var S=this;i.fs.open(f,"r",function(A){if(A&&A.code==="ENOENT")m(void 0,ct.Errors.FILE_NOT_FOUND(f));else if(A)m(void 0,A);else{var p=i.findFiles(f),D=-1,w=function(){if(D+=1,D<p.length){var _=p[D],P=d(f,_).split("\\").join("/");P=P.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),b(P)?i.fs.stat(_,function(E,R){E&&m(void 0,E),R.isFile()?i.fs.readFile(_,function(k,F){k?m(void 0,k):(S.addFile(g+P,F,"",R),w())}):(S.addFile(g+P+"/",Buffer.alloc(0),"",R),w())}):process.nextTick(()=>{w()})}else m(!0,void 0)};w()}})},addLocalFolderAsync2:function(f,m){let g=this;f=typeof f=="object"?f:{localPath:f},localPath=mt.resolve(l(f.localPath));let{zipPath:b,filter:S,namefix:A}=f;S instanceof RegExp?S=(function(w){return function(_){return w.test(_)}})(S):typeof S!="function"&&(S=function(){return!0}),b=b?l(b):"",A=="latin1"&&(A=w=>w.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof A!="function"&&(A=w=>w);let p=w=>mt.join(b,A(d(localPath,w))),D=w=>mt.win32.basename(mt.win32.normalize(A(w)));i.fs.open(localPath,"r",function(w){w&&w.code==="ENOENT"?m(void 0,ct.Errors.FILE_NOT_FOUND(localPath)):w?m(void 0,w):i.findFilesAsync(localPath,function(_,P){if(_)return m(_);P=P.filter(E=>S(p(E))),P.length||m(void 0,!1),setImmediate(P.reverse().reduce(function(E,R){return function(k,F){if(k||F===!1)return setImmediate(E,k,!1);g.addLocalFileAsync({localPath:R,zipPath:mt.dirname(p(R)),zipName:D(R)},E)}},m))})})},addLocalFolderPromise:function(f,m){return new Promise((g,b)=>{this.addLocalFolderAsync2(Object.assign({localPath:f},m),(S,A)=>{S&&b(S),A&&g(this)})})},addFile:function(f,m,g,b){f=u(f);let S=c(f),A=S!=null;A||(S=new U7(n),S.entryName=f),S.comment=g||"";let p=typeof b=="object"&&b instanceof i.fs.Stats;p&&(S.header.time=b.mtime);var D=S.isDirectory?16:0;let w=S.isDirectory?16384:32768;return p?w|=4095&b.mode:typeof b=="number"?w|=4095&b:w|=S.isDirectory?493:420,D=(D|w<<16)>>>0,S.attr=D,S.setData(m),A||s.setEntry(S),S},getEntries:function(f){return s.password=f,s?s.entries:[]},getEntry:function(f){return c(f)},getEntryCount:function(){return s.getEntryCount()},forEach:function(f){return s.forEach(f)},extractEntryTo:function(f,m,g,b,S,A){b=ms(!1,b),S=ms(!1,S),g=ms(!0,g),A=HS(S,A);var p=c(f);if(!p)throw ct.Errors.NO_ENTRY();var D=o(p.entryName),w=a(m,A&&!p.isDirectory?A:g?D:mt.basename(D));if(p.isDirectory){var _=s.getEntryChildren(p);return _.forEach(function(R){if(R.isDirectory)return;var k=R.getData();if(!k)throw ct.Errors.CANT_EXTRACT_FILE();var F=o(R.entryName),j=a(m,g?F:mt.basename(F));let U=S?R.header.fileAttr:void 0;i.writeFileTo(j,k,b,U)}),!0}var P=p.getData(s.password);if(!P)throw ct.Errors.CANT_EXTRACT_FILE();if(i.fs.existsSync(w)&&!b)throw ct.Errors.CANT_OVERRIDE();let E=S?f.header.fileAttr:void 0;return i.writeFileTo(w,P,b,E),!0},test:function(f){if(!s)return!1;for(var m in s.entries)try{if(m.isDirectory)continue;var g=s.entries[m].getData(f);if(!g)return!1}catch{return!1}return!0},extractAllTo:function(f,m,g,b){if(g=ms(!1,g),b=HS(g,b),m=ms(!1,m),!s)throw ct.Errors.NO_ZIP();s.entries.forEach(function(S){var A=a(f,o(S.entryName));if(S.isDirectory){i.makeDir(A);return}var p=S.getData(b);if(!p)throw ct.Errors.CANT_EXTRACT_FILE();let D=g?S.header.fileAttr:void 0;i.writeFileTo(A,p,m,D);try{i.fs.utimesSync(A,S.header.time,S.header.time)}catch{throw ct.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(f,m,g,b){if(b=V7(m,g,b),g=ms(!1,g),m=ms(!1,m),!b)return new Promise((w,_)=>{this.extractAllToAsync(f,m,g,function(P){P?_(P):w(this)})});if(!s){b(ct.Errors.NO_ZIP());return}f=mt.resolve(f);let S=w=>a(f,mt.normalize(o(w.entryName))),A=(w,_)=>new Error(w+': "'+_+'"'),p=[],D=[];s.entries.forEach(w=>{w.isDirectory?p.push(w):D.push(w)});for(let w of p){let _=S(w),P=g?w.header.fileAttr:void 0;try{i.makeDir(_),P&&i.fs.chmodSync(_,P),i.fs.utimesSync(_,w.header.time,w.header.time)}catch{b(A("Unable to create folder",_))}}D.reverse().reduce(function(w,_){return function(P){if(P)w(P);else{let E=mt.normalize(o(_.entryName)),R=a(f,E);_.getDataAsync(function(k,F){if(F)w(F);else if(!k)w(ct.Errors.CANT_EXTRACT_FILE());else{let j=g?_.header.fileAttr:void 0;i.writeFileToAsync(R,k,m,j,function(U){U||w(A("Unable to write file",R)),i.fs.utimes(R,_.header.time,_.header.time,function(G){G?w(A("Unable to set times",R)):w()})})}})}}},b)()},writeZip:function(f,m){if(arguments.length===1&&typeof f=="function"&&(m=f,f=""),!f&&n.filename&&(f=n.filename),!!f){var g=s.compressToBuffer();if(g){var b=i.writeFileTo(f,g,!0);typeof m=="function"&&m(b?null:new Error("failed"),"")}}},writeZipPromise:function(f,m){let{overwrite:g,perm:b}=Object.assign({overwrite:!0},m);return new Promise((S,A)=>{!f&&n.filename&&(f=n.filename),f||A("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(p=>{let D=w=>w?S(w):A("ADM-ZIP: Wasn't able to write zip file");i.writeFileToAsync(f,p,g,b,D)},A)})},toBufferPromise:function(){return new Promise((f,m)=>{s.toAsyncBuffer(f,m)})},toBuffer:function(f,m,g,b){return typeof f=="function"?(s.toAsyncBuffer(f,m,g,b),null):s.compressToBuffer()}}}});var XS=v((Qge,WS)=>{var KS={};WS.exports=KS;var GS={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(GS).forEach(function(t){var e=GS[t],r=KS[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var JS=v((eye,YS)=>{"use strict";YS.exports=function(t,e){e=e||process.argv;var r=e.indexOf("--"),n=/^-{1,2}/.test(t)?"":"--",i=e.indexOf(n+t);return i!==-1&&(r===-1?!0:i<r)}});var QS=v((tye,ZS)=>{"use strict";var G7=require("os"),nn=JS(),rr=process.env,qo=void 0;nn("no-color")||nn("no-colors")||nn("color=false")?qo=!1:(nn("color")||nn("colors")||nn("color=true")||nn("color=always"))&&(qo=!0);"FORCE_COLOR"in rr&&(qo=rr.FORCE_COLOR.length===0||parseInt(rr.FORCE_COLOR,10)!==0);function K7(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function W7(t){if(qo===!1)return 0;if(nn("color=16m")||nn("color=full")||nn("color=truecolor"))return 3;if(nn("color=256"))return 2;if(t&&!t.isTTY&&qo!==!0)return 0;var e=qo?1:0;if(process.platform==="win32"){var r=G7.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in rr)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(i){return i in rr})||rr.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in rr)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(rr.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in rr){var n=parseInt((rr.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(rr.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(rr.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(rr.TERM)||"COLORTERM"in rr?1:(rr.TERM==="dumb",e)}function Xy(t){var e=W7(t);return K7(e)}ZS.exports={supportsColor:Xy,stdout:Xy(process.stdout),stderr:Xy(process.stderr)}});var tA=v((rye,eA)=>{eA.exports=function(e,r){var n="";e=e||"Run the trap, drop the bass",e=e.split("");var i={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(s){s=s.toLowerCase();var o=i[s]||[" "],a=Math.floor(Math.random()*o.length);typeof i[s]<"u"?n+=i[s][a]:n+=s}),n}});var nA=v((nye,rA)=>{rA.exports=function(e,r){e=e||" he is here ";var n={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},i=[].concat(n.up,n.down,n.mid);function s(u){var c=Math.floor(Math.random()*u);return c}function o(u){var c=!1;return i.filter(function(l){c=l===u}),c}function a(u,c){var l="",h,d;c=c||{},c.up=typeof c.up<"u"?c.up:!0,c.mid=typeof c.mid<"u"?c.mid:!0,c.down=typeof c.down<"u"?c.down:!0,c.size=typeof c.size<"u"?c.size:"maxi",u=u.split("");for(d in u)if(!o(d)){switch(l=l+u[d],h={up:0,down:0,mid:0},c.size){case"mini":h.up=s(8),h.mid=s(2),h.down=s(8);break;case"maxi":h.up=s(16)+3,h.mid=s(4)+1,h.down=s(64)+3;break;default:h.up=s(8)+1,h.mid=s(6)/2,h.down=s(8)+1;break}var f=["up","mid","down"];for(var m in f)for(var g=f[m],b=0;b<=h[g];b++)c[g]&&(l=l+n[g][s(n[g].length)])}return l}return a(e,r)}});var sA=v((iye,iA)=>{iA.exports=function(t){return function(e,r,n){if(e===" ")return e;switch(r%3){case 0:return t.red(e);case 1:return t.white(e);case 2:return t.blue(e)}}}});var aA=v((sye,oA)=>{oA.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var cA=v((oye,uA)=>{uA.exports=function(t){var e=["red","yellow","green","blue","magenta"];return function(r,n,i){return r===" "?r:t[e[n++%e.length]](r)}}});var fA=v((aye,lA)=>{lA.exports=function(t){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,n,i){return r===" "?r:t[e[Math.round(Math.random()*(e.length-2))]](r)}}});var yA=v((cye,gA)=>{var be={};gA.exports=be;be.themes={};var X7=require("util"),gs=be.styles=XS(),dA=Object.defineProperties,Y7=new RegExp(/[\r\n]+/g);be.supportsColor=QS().supportsColor;typeof be.enabled>"u"&&(be.enabled=be.supportsColor()!==!1);be.enable=function(){be.enabled=!0};be.disable=function(){be.enabled=!1};be.stripColors=be.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var uye=be.stylize=function(e,r){if(!be.enabled)return e+"";var n=gs[r];return!n&&r in be?be[r](e):n.open+e+n.close},J7=/[|\\{}()[\]^$+*?.]/g,Z7=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(J7,"\\$&")};function pA(t){var e=function r(){return eH.apply(r,arguments)};return e._styles=t,e.__proto__=Q7,e}var mA=(function(){var t={};return gs.grey=gs.gray,Object.keys(gs).forEach(function(e){gs[e].closeRe=new RegExp(Z7(gs[e].close),"g"),t[e]={get:function(){return pA(this._styles.concat(e))}}}),t})(),Q7=dA(function(){},mA);function eH(){var t=Array.prototype.slice.call(arguments),e=t.map(function(o){return o!=null&&o.constructor===String?o:X7.inspect(o)}).join(" ");if(!be.enabled||!e)return e;for(var r=e.indexOf(`
|
|
41
|
+
`)!=-1,n=this._styles,i=n.length;i--;){var s=gs[n[i]];e=s.open+e.replace(s.closeRe,s.open)+s.close,r&&(e=e.replace(Y7,function(o){return s.close+o+s.open}))}return e}be.setTheme=function(t){if(typeof t=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var e in t)(function(r){be[r]=function(n){if(typeof t[r]=="object"){var i=n;for(var s in t[r])i=be[t[r][s]](i);return i}return be[t[r]](n)}})(e)};function tH(){var t={};return Object.keys(mA).forEach(function(e){t[e]={get:function(){return pA([e])}}}),t}var rH=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};be.trap=tA();be.zalgo=nA();be.maps={};be.maps.america=sA()(be);be.maps.zebra=aA()(be);be.maps.rainbow=cA()(be);be.maps.random=fA()(be);for(hA in be.maps)(function(t){be[t]=function(e){return rH(be.maps[t],e)}})(hA);var hA;dA(be,tH())});var wA=v((lye,DA)=>{var nH=yA();DA.exports=nH});var bA=v(Yy=>{"use strict";Yy.indent=function(e){return new Array(e+1).join(" ")};Yy.getMaxIndexLength=function(t){var e=0;return Object.getOwnPropertyNames(t).forEach(function(r){t[r]!==void 0&&(e=Math.max(e,r.length))}),e}});var vA=v((hye,iH)=>{iH.exports={author:"Rafael de Oleza <rafeca@gmail.com> (https://github.com/rafeca)",name:"prettyjson",description:"Package for formatting JSON data in a coloured YAML-style, perfect for CLI output",version:"1.2.5",homepage:"http://rafeca.com/prettyjson",keywords:["json","cli","formatting","colors"],repository:{type:"git",url:"https://github.com/rafeca/prettyjson.git"},bugs:{url:"https://github.com/rafeca/prettyjson/issues"},main:"./lib/prettyjson",files:["bin/prettyjson","lib/*.js"],license:"MIT",scripts:{test:"npm run jshint && mocha --reporter spec",testwin:"node ./node_modules/mocha/bin/mocha --reporter spec",jshint:"jshint lib/*.js test/*.js",coverage:"istanbul cover _mocha --report lcovonly -- -R spec",coveralls:"npm run coverage && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage",changelog:"git log $(git describe --tags --abbrev=0)..HEAD --pretty='* %s' --first-parent"},bin:{prettyjson:"./bin/prettyjson"},dependencies:{colors:"1.4.0",minimist:"^1.2.0"},devDependencies:{coveralls:"^2.11.15",istanbul:"^0.4.5",jshint:"^2.9.4",mocha:"^3.1.2","mocha-lcov-reporter":"^1.2.0",should:"^11.1.1"}}});var EA=v(Nu=>{"use strict";var mn=wA(),xi=bA(),sH=/[^\w\s\n\r\v\t\.,]/i;Nu.version=vA().version;var Jy=function(t,e){return t!==void 0||e.renderUndefined},Nf=function(t,e,r){return!!(typeof t=="boolean"||typeof t=="number"||typeof t=="function"||t===null||t===void 0||t instanceof Date||typeof t=="string"&&t.indexOf(`
|
|
42
42
|
`)===-1||r.inlineArrays&&!e&&Array.isArray(t)&&Nf(t[0],!0,r))},oH=function(t,e){if(e.noColor)return t;if(typeof t=="string")return e.stringColor?mn[e.stringColor](t):t;var r=t+"";return t===!0?mn.green(r):t===!1?mn.red(r):t==null?mn.grey(r):typeof t=="number"?t>=0?mn[e.positiveNumberColor](r):mn[e.negativeNumberColor](r):typeof t=="function"?"function() {}":Array.isArray(t)?t.join(", "):r},Zy=function(t,e){return t.multilineStringColor===null||t.noColor?e:mn[t.multilineStringColor](e)},aH=function(t,e,r){var n=t.split(`
|
|
43
43
|
`);return n=n.map(function(i){return xi.indent(e)+Zy(r,i)}),n.join(`
|
|
44
44
|
`)},Uo=function(t,e,r){if(typeof t=="string"&&t.match(sH)&&e.escape&&(t=JSON.stringify(t)),!Jy(t,e))return[];if(Nf(t,!1,e))return[xi.indent(r)+oH(t,e)];if(typeof t=="string")return[xi.indent(r)+Zy(e,'"""'),aH(t,r+e.defaultIndentation,e),xi.indent(r)+Zy(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[xi.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(a){if(Jy(a,e)){var u="- ";e.noColor||(u=mn[e.dashColor](u)),u=xi.indent(r)+u,Nf(a,!1,e)?(u+=Uo(a,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,Uo(a,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return Uo({message:t.message,stack:t.stack.split(`
|
|
45
45
|
`)},e,r);var i=e.noAlign?0:xi.getMaxIndexLength(t),s,o=[];return Object.getOwnPropertyNames(t).forEach(function(a){if(Jy(t[a],e))if(s=a+": ",e.noColor||(s=mn[e.keysColor](s)),s=xi.indent(r)+s,Nf(t[a],!1,e)){var u=e.noAlign?0:i-a.length;s+=Uo(t[a],e,u)[0],o.push(s)}else o.push(s),o.push.apply(o,Uo(t[a],e,r+e.defaultIndentation))}),o};Nu.render=function(e,r,n){return n=n||0,r=r||{},r.emptyArrayMsg=r.emptyArrayMsg||"(empty array)",r.keysColor=r.keysColor||"green",r.dashColor=r.dashColor||"green",r.numberColor=r.numberColor||"blue",r.positiveNumberColor=r.positiveNumberColor||r.numberColor,r.negativeNumberColor=r.negativeNumberColor||r.numberColor,r.defaultIndentation=r.defaultIndentation||2,r.noColor=!!r.noColor,r.noAlign=!!r.noAlign,r.escape=!!r.escape,r.renderUndefined=!!r.renderUndefined,r.stringColor=r.stringColor||null,r.multilineStringColor=r.multilineStringColor||null,Uo(e,r,n).join(`
|
|
46
46
|
`)};Nu.renderString=function(e,r,n){var i="",s;if(typeof e!="string"||e==="")return"";if(e[0]!=="{"&&e[0]!=="["){var o;e.indexOf("{")===-1?o=e.indexOf("["):e.indexOf("[")===-1||e.indexOf("{")<e.indexOf("[")?o=e.indexOf("{"):o=e.indexOf("["),i+=e.substr(0,o)+`
|
|
47
|
-
`,e=e.substr(o)}try{s=JSON.parse(e)}catch{return mn.red("Error:")+" Not valid JSON!"}return i+=Nu.render(s,r,n),i}});var tD=v($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});$f.default=void 0;function Ho(t){"@babel/helpers - typeof";return Ho=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ho(t)}function _A(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,cH(n.key),n)}}function uH(t,e,r){return e&&_A(t.prototype,e),r&&_A(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function cH(t){var e=lH(t,"string");return Ho(e)=="symbol"?e:e+""}function lH(t,e){if(Ho(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ho(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function hH(t,e,r){return e=Lu(e),dH(t,eD()?Reflect.construct(e,r||[],Lu(t).constructor):e.apply(t,r))}function dH(t,e){if(e&&(Ho(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return pH(t)}function pH(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function mH(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&$u(t,e)}function Qy(t){var e=typeof Map=="function"?new Map:void 0;return Qy=function(n){if(n===null||!yH(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return gH(n,arguments,Lu(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),$u(i,n)},Qy(t)}function gH(t,e,r){if(eD())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(t.bind.apply(t,n));return r&&$u(i,r.prototype),i}function eD(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(eD=function(){return!!t})()}function yH(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function $u(t,e){return $u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},$u(t,e)}function Lu(t){return Lu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Lu(t)}var DH=(function(t){function e(r){var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(fH(this,e),n=hH(this,e,[r]),n.originalRequest=s,n.originalResponse=o,n.causingError=i,i!=null&&(r+=", caused by ".concat(i.toString())),s!=null){var a=s.getHeader("X-Request-ID")||"n/a",u=s.getMethod(),c=s.getURL(),l=o?o.getStatus():"n/a",h=o?o.getBody()||"":"n/a";r+=", originated from request (method: ".concat(u,", url: ").concat(c,", response code: ").concat(l,", response text: ").concat(h,", request id: ").concat(a,")")}return n.message=r,n}return mH(e,t),uH(e)})(Qy(Error)),dye=$f.default=DH});var rD=v(Lf=>{"use strict";Object.defineProperty(Lf,"__esModule",{value:!0});Lf.enableDebugLog=wH;Lf.log=bH;var CA=!1;function wH(){CA=!0}function bH(t){CA&&console.log(t)}});var AA=v(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});jf.default=void 0;function ju(t){"@babel/helpers - typeof";return ju=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ju(t)}function vH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function SA(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_H(n.key),n)}}function EH(t,e,r){return e&&SA(t.prototype,e),r&&SA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _H(t){var e=CH(t,"string");return ju(e)=="symbol"?e:e+""}function CH(t,e){if(ju(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ju(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var gye=jf.default=(function(){function t(){vH(this,t)}return EH(t,[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(r){return Promise.resolve([])}},{key:"removeUpload",value:function(r){return Promise.resolve()}},{key:"addUpload",value:function(r,n){return Promise.resolve(null)}}])})()});var OA=v((nD,iD)=>{(function(t,e){typeof nD=="object"&&typeof iD<"u"?iD.exports=e():typeof define=="function"&&define.amd?define(e):(function(){var r=t.Base64,n=e();n.noConflict=function(){return t.Base64=r,n},t.Meteor&&(Base64=n),t.Base64=n})()})(typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:nD,function(){"use strict";var t="3.7.8",e=t,r=typeof Buffer=="function",n=typeof TextDecoder=="function"?new TextDecoder:void 0,i=typeof TextEncoder=="function"?new TextEncoder:void 0,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=Array.prototype.slice.call(s),a=(function(q){var V={};return q.forEach(function(ae,x){return V[ae]=x}),V})(o),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),l=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(q){return new Uint8Array(Array.prototype.slice.call(q,0))},h=function(q){return q.replace(/=/g,"").replace(/[+\/]/g,function(V){return V=="+"?"-":"_"})},d=function(q){return q.replace(/[^A-Za-z0-9\+\/]/g,"")},f=function(q){for(var V,ae,x,O,H="",N=q.length%3,ne=0;ne<q.length;){if((ae=q.charCodeAt(ne++))>255||(x=q.charCodeAt(ne++))>255||(O=q.charCodeAt(ne++))>255)throw new TypeError("invalid character found");V=ae<<16|x<<8|O,H+=o[V>>18&63]+o[V>>12&63]+o[V>>6&63]+o[V&63]}return N?H.slice(0,N-3)+"===".substring(N):H},m=typeof btoa=="function"?function(q){return btoa(q)}:r?function(q){return Buffer.from(q,"binary").toString("base64")}:f,g=r?function(q){return Buffer.from(q).toString("base64")}:function(q){for(var V=4096,ae=[],x=0,O=q.length;x<O;x+=V)ae.push(c.apply(null,q.subarray(x,x+V)));return m(ae.join(""))},b=function(q,V){return V===void 0&&(V=!1),V?h(g(q)):g(q)},S=function(q){if(q.length<2){var V=q.charCodeAt(0);return V<128?q:V<2048?c(192|V>>>6)+c(128|V&63):c(224|V>>>12&15)+c(128|V>>>6&63)+c(128|V&63)}else{var V=65536+(q.charCodeAt(0)-55296)*1024+(q.charCodeAt(1)-56320);return c(240|V>>>18&7)+c(128|V>>>12&63)+c(128|V>>>6&63)+c(128|V&63)}},A=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,p=function(q){return q.replace(A,S)},y=r?function(q){return Buffer.from(q,"utf8").toString("base64")}:i?function(q){return g(i.encode(q))}:function(q){return m(p(q))},w=function(q,V){return V===void 0&&(V=!1),V?h(y(q)):y(q)},_=function(q){return w(q,!0)},P=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,E=function(q){switch(q.length){case 4:var V=(7&q.charCodeAt(0))<<18|(63&q.charCodeAt(1))<<12|(63&q.charCodeAt(2))<<6|63&q.charCodeAt(3),ae=V-65536;return c((ae>>>10)+55296)+c((ae&1023)+56320);case 3:return c((15&q.charCodeAt(0))<<12|(63&q.charCodeAt(1))<<6|63&q.charCodeAt(2));default:return c((31&q.charCodeAt(0))<<6|63&q.charCodeAt(1))}},R=function(q){return q.replace(P,E)},k=function(q){if(q=q.replace(/\s+/g,""),!u.test(q))throw new TypeError("malformed base64.");q+="==".slice(2-(q.length&3));for(var V,ae,x,O=[],H=0;H<q.length;)V=a[q.charAt(H++)]<<18|a[q.charAt(H++)]<<12|(ae=a[q.charAt(H++)])<<6|(x=a[q.charAt(H++)]),ae===64?O.push(c(V>>16&255)):x===64?O.push(c(V>>16&255,V>>8&255)):O.push(c(V>>16&255,V>>8&255,V&255));return O.join("")},F=typeof atob=="function"?function(q){return atob(d(q))}:r?function(q){return Buffer.from(q,"base64").toString("binary")}:k,j=r?function(q){return l(Buffer.from(q,"base64"))}:function(q){return l(F(q).split("").map(function(V){return V.charCodeAt(0)}))},U=function(q){return j(L(q))},G=r?function(q){return Buffer.from(q,"base64").toString("utf8")}:n?function(q){return n.decode(j(q))}:function(q){return R(F(q))},L=function(q){return d(q.replace(/[-_]/g,function(V){return V=="-"?"+":"/"}))},C=function(q){return G(L(q))},T=function(q){if(typeof q!="string")return!1;var V=q.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(V)||!/[^\s0-9a-zA-Z\-_]/.test(V)},I=function(q){return{value:q,enumerable:!1,writable:!0,configurable:!0}},$=function(){var q=function(V,ae){return Object.defineProperty(String.prototype,V,I(ae))};q("fromBase64",function(){return C(this)}),q("toBase64",function(V){return w(this,V)}),q("toBase64URI",function(){return w(this,!0)}),q("toBase64URL",function(){return w(this,!0)}),q("toUint8Array",function(){return U(this)})},M=function(){var q=function(V,ae){return Object.defineProperty(Uint8Array.prototype,V,I(ae))};q("toBase64",function(V){return b(this,V)}),q("toBase64URI",function(){return b(this,!0)}),q("toBase64URL",function(){return b(this,!0)})},B=function(){$(),M()},K={version:t,VERSION:e,atob:F,atobPolyfill:k,btoa:m,btoaPolyfill:f,fromBase64:C,toBase64:w,encode:w,encodeURI:_,encodeURL:_,utob:p,btou:R,decode:C,isValid:T,fromUint8Array:b,toUint8Array:U,extendString:$,extendUint8Array:M,extendBuiltins:B};return K.Base64={},Object.keys(K).forEach(function(q){return K.Base64[q]=K[q]}),K})});var TA=v((Dye,xA)=>{"use strict";xA.exports=function(e,r){if(r=r.split(":")[0],e=+e,!e)return!1;switch(r){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0}});var PA=v(sD=>{"use strict";var SH=Object.prototype.hasOwnProperty,AH;function FA(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function IA(t){try{return encodeURIComponent(t)}catch{return null}}function OH(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var i=FA(n[1]),s=FA(n[2]);i===null||s===null||i in r||(r[i]=s)}return r}function xH(t,e){e=e||"";var r=[],n,i;typeof e!="string"&&(e="?");for(i in t)if(SH.call(t,i)){if(n=t[i],!n&&(n===null||n===AH||isNaN(n))&&(n=""),i=IA(i),n=IA(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?e+r.join("&"):""}sD.stringify=xH;sD.parse=OH});var MA=v((bye,BA)=>{"use strict";var RA=TA(),Bf=PA(),TH=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,NA=/[\n\r\t]/g,FH=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,$A=/:\d+$/,IH=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,PH=/^[a-zA-Z]:/;function aD(t){return(t||"").toString().replace(TH,"")}var oD=[["#","hash"],["?","query"],function(e,r){return gn(r.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],kA={hash:1,query:1};function LA(t){var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e={};var r=e.location||{};t=t||r;var n={},i=typeof t,s;if(t.protocol==="blob:")n=new yn(unescape(t.pathname),{});else if(i==="string"){n=new yn(t,{});for(s in kA)delete n[s]}else if(i==="object"){for(s in t)s in kA||(n[s]=t[s]);n.slashes===void 0&&(n.slashes=FH.test(t.href))}return n}function gn(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function jA(t,e){t=aD(t),t=t.replace(NA,""),e=e||{};var r=IH.exec(t),n=r[1]?r[1].toLowerCase():"",i=!!r[2],s=!!r[3],o=0,a;return i?s?(a=r[2]+r[3]+r[4],o=r[2].length+r[3].length):(a=r[2]+r[4],o=r[2].length):s?(a=r[3]+r[4],o=r[3].length):a=r[4],n==="file:"?o>=2&&(a=a.slice(2)):gn(n)?a=r[4]:n?i&&(a=a.slice(2)):o>=2&&gn(e.protocol)&&(a=r[4]),{protocol:n,slashes:i||gn(n),slashesCount:o,rest:a}}function kH(t,e){if(t==="")return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,i=r[n-1],s=!1,o=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),o++):o&&(n===0&&(s=!0),r.splice(n,1),o--);return s&&r.unshift(""),(i==="."||i==="..")&&r.push(""),r.join("/")}function yn(t,e,r){if(t=aD(t),t=t.replace(NA,""),!(this instanceof yn))return new yn(t,e,r);var n,i,s,o,a,u,c=oD.slice(),l=typeof e,h=this,d=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=Bf.parse),e=LA(e),i=jA(t||"",e),n=!i.protocol&&!i.slashes,h.slashes=i.slashes||n&&e.slashes,h.protocol=i.protocol||e.protocol||"",t=i.rest,(i.protocol==="file:"&&(i.slashesCount!==2||PH.test(t))||!i.slashes&&(i.protocol||i.slashesCount<2||!gn(h.protocol)))&&(c[3]=[/(.*)/,"pathname"]);d<c.length;d++){if(o=c[d],typeof o=="function"){t=o(t,h);continue}s=o[0],u=o[1],s!==s?h[u]=t:typeof s=="string"?(a=s==="@"?t.lastIndexOf(s):t.indexOf(s),~a&&(typeof o[2]=="number"?(h[u]=t.slice(0,a),t=t.slice(a+o[2])):(h[u]=t.slice(a),t=t.slice(0,a)))):(a=s.exec(t))&&(h[u]=a[1],t=t.slice(0,a.index)),h[u]=h[u]||n&&o[3]&&e[u]||"",o[4]&&(h[u]=h[u].toLowerCase())}r&&(h.query=r(h.query)),n&&e.slashes&&h.pathname.charAt(0)!=="/"&&(h.pathname!==""||e.pathname!=="")&&(h.pathname=kH(h.pathname,e.pathname)),h.pathname.charAt(0)!=="/"&&gn(h.protocol)&&(h.pathname="/"+h.pathname),RA(h.port,h.protocol)||(h.host=h.hostname,h.port=""),h.username=h.password="",h.auth&&(a=h.auth.indexOf(":"),~a?(h.username=h.auth.slice(0,a),h.username=encodeURIComponent(decodeURIComponent(h.username)),h.password=h.auth.slice(a+1),h.password=encodeURIComponent(decodeURIComponent(h.password))):h.username=encodeURIComponent(decodeURIComponent(h.auth)),h.auth=h.password?h.username+":"+h.password:h.username),h.origin=h.protocol!=="file:"&&gn(h.protocol)&&h.host?h.protocol+"//"+h.host:"null",h.href=h.toString()}function RH(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||Bf.parse)(e)),n[t]=e;break;case"port":n[t]=e,RA(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[t]="");break;case"hostname":n[t]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[t]=e,$A.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(e){var i=t==="pathname"?"/":"#";n[t]=e.charAt(0)!==i?i+e:e}else n[t]=e;break;case"username":case"password":n[t]=encodeURIComponent(e);break;case"auth":var s=e.indexOf(":");~s?(n.username=e.slice(0,s),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(s+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var o=0;o<oD.length;o++){var a=oD[o];a[4]&&(n[a[1]]=n[a[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&gn(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function NH(t){(!t||typeof t!="function")&&(t=Bf.stringify);var e,r=this,n=r.host,i=r.protocol;i&&i.charAt(i.length-1)!==":"&&(i+=":");var s=i+(r.protocol&&r.slashes||gn(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):r.protocol!=="file:"&&gn(r.protocol)&&!n&&r.pathname!=="/"&&(s+="@"),(n[n.length-1]===":"||$A.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,e=typeof r.query=="object"?t(r.query):r.query,e&&(s+=e.charAt(0)!=="?"?"?"+e:e),r.hash&&(s+=r.hash),s}yn.prototype={set:RH,toString:NH};yn.extractProtocol=jA;yn.location=LA;yn.trimLeft=aD;yn.qs=Bf;BA.exports=yn});var qA=v(uD=>{"use strict";Object.defineProperty(uD,"__esModule",{value:!0});uD.default=$H;function $H(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=Math.random()*16|0,r=t==="x"?e:e&3|8;return r.toString(16)})}});var rO=v(Hf=>{"use strict";Object.defineProperty(Hf,"__esModule",{value:!0});Hf.default=void 0;var LH=OA(),jH=fD(MA()),Mf=fD(tD()),ys=rD(),BH=fD(qA());function fD(t){return t&&t.__esModule?t:{default:t}}function cD(){"use strict";cD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(C,T,I){C[T]=I.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(C,T,I){return Object.defineProperty(C,T,{value:I,enumerable:!0,configurable:!0,writable:!0}),C[T]}try{c({},"")}catch{c=function(I,$,M){return I[$]=M}}function l(C,T,I,$){var M=T&&T.prototype instanceof S?T:S,B=Object.create(M.prototype),K=new G($||[]);return i(B,"_invoke",{value:k(C,I,K)}),B}function h(C,T,I){try{return{type:"normal",arg:C.call(T,I)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",g="completed",b={};function S(){}function A(){}function p(){}var y={};c(y,o,function(){return this});var w=Object.getPrototypeOf,_=w&&w(w(L([])));_&&_!==r&&n.call(_,o)&&(y=_);var P=p.prototype=S.prototype=Object.create(y);function E(C){["next","throw","return"].forEach(function(T){c(C,T,function(I){return this._invoke(T,I)})})}function R(C,T){function I(M,B,K,q){var V=h(C[M],C,B);if(V.type!=="throw"){var ae=V.arg,x=ae.value;return x&&Ds(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){I("next",O,K,q)},function(O){I("throw",O,K,q)}):T.resolve(x).then(function(O){ae.value=O,K(ae)},function(O){return I("throw",O,K,q)})}q(V.arg)}var $;i(this,"_invoke",{value:function(B,K){function q(){return new T(function(V,ae){I(B,K,V,ae)})}return $=$?$.then(q,q):q()}})}function k(C,T,I){var $=d;return function(M,B){if($===m)throw Error("Generator is already running");if($===g){if(M==="throw")throw B;return{value:t,done:!0}}for(I.method=M,I.arg=B;;){var K=I.delegate;if(K){var q=F(K,I);if(q){if(q===b)continue;return q}}if(I.method==="next")I.sent=I._sent=I.arg;else if(I.method==="throw"){if($===d)throw $=g,I.arg;I.dispatchException(I.arg)}else I.method==="return"&&I.abrupt("return",I.arg);$=m;var V=h(C,T,I);if(V.type==="normal"){if($=I.done?g:f,V.arg===b)continue;return{value:V.arg,done:I.done}}V.type==="throw"&&($=g,I.method="throw",I.arg=V.arg)}}}function F(C,T){var I=T.method,$=C.iterator[I];if($===t)return T.delegate=null,I==="throw"&&C.iterator.return&&(T.method="return",T.arg=t,F(C,T),T.method==="throw")||I!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+I+"' method")),b;var M=h($,C.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,b;var B=M.arg;return B?B.done?(T[C.resultName]=B.value,T.next=C.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,b):B:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,b)}function j(C){var T={tryLoc:C[0]};1 in C&&(T.catchLoc=C[1]),2 in C&&(T.finallyLoc=C[2],T.afterLoc=C[3]),this.tryEntries.push(T)}function U(C){var T=C.completion||{};T.type="normal",delete T.arg,C.completion=T}function G(C){this.tryEntries=[{tryLoc:"root"}],C.forEach(j,this),this.reset(!0)}function L(C){if(C||C===""){var T=C[o];if(T)return T.call(C);if(typeof C.next=="function")return C;if(!isNaN(C.length)){var I=-1,$=function M(){for(;++I<C.length;)if(n.call(C,I))return M.value=C[I],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(Ds(C)+" is not iterable")}return A.prototype=p,i(P,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(C){var T=typeof C=="function"&&C.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(C){return Object.setPrototypeOf?Object.setPrototypeOf(C,p):(C.__proto__=p,c(C,u,"GeneratorFunction")),C.prototype=Object.create(P),C},e.awrap=function(C){return{__await:C}},E(R.prototype),c(R.prototype,a,function(){return this}),e.AsyncIterator=R,e.async=function(C,T,I,$,M){M===void 0&&(M=Promise);var B=new R(l(C,T,I,$),M);return e.isGeneratorFunction(T)?B:B.next().then(function(K){return K.done?K.value:B.next()})},E(P),c(P,u,"Generator"),c(P,o,function(){return this}),c(P,"toString",function(){return"[object Generator]"}),e.keys=function(C){var T=Object(C),I=[];for(var $ in T)I.push($);return I.reverse(),function M(){for(;I.length;){var B=I.pop();if(B in T)return M.value=B,M.done=!1,M}return M.done=!0,M}},e.values=L,G.prototype={constructor:G,reset:function(T){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(U),!T)for(var I in this)I.charAt(0)==="t"&&n.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=t)},stop:function(){this.done=!0;var T=this.tryEntries[0].completion;if(T.type==="throw")throw T.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var I=this;function $(ae,x){return K.type="throw",K.arg=T,I.next=ae,x&&(I.method="next",I.arg=t),!!x}for(var M=this.tryEntries.length-1;M>=0;--M){var B=this.tryEntries[M],K=B.completion;if(B.tryLoc==="root")return $("end");if(B.tryLoc<=this.prev){var q=n.call(B,"catchLoc"),V=n.call(B,"finallyLoc");if(q&&V){if(this.prev<B.catchLoc)return $(B.catchLoc,!0);if(this.prev<B.finallyLoc)return $(B.finallyLoc)}else if(q){if(this.prev<B.catchLoc)return $(B.catchLoc,!0)}else{if(!V)throw Error("try statement without catch or finally");if(this.prev<B.finallyLoc)return $(B.finallyLoc)}}}},abrupt:function(T,I){for(var $=this.tryEntries.length-1;$>=0;--$){var M=this.tryEntries[$];if(M.tryLoc<=this.prev&&n.call(M,"finallyLoc")&&this.prev<M.finallyLoc){var B=M;break}}B&&(T==="break"||T==="continue")&&B.tryLoc<=I&&I<=B.finallyLoc&&(B=null);var K=B?B.completion:{};return K.type=T,K.arg=I,B?(this.method="next",this.next=B.finallyLoc,b):this.complete(K)},complete:function(T,I){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&I&&(this.next=I),b},finish:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var $=this.tryEntries[I];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),U($),b}},catch:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var $=this.tryEntries[I];if($.tryLoc===T){var M=$.completion;if(M.type==="throw"){var B=M.arg;U($)}return B}}throw Error("illegal catch attempt")},delegateYield:function(T,I,$){return this.delegate={iterator:L(T),resultName:I,nextLoc:$},this.method==="next"&&(this.arg=t),b}},e}function UA(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function MH(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){UA(s,n,i,o,a,"next",u)}function a(u){UA(s,n,i,o,a,"throw",u)}o(void 0)})}}function JA(t,e){return HH(t)||UH(t,e)||ZA(t,e)||qH()}function qH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
47
|
+
`,e=e.substr(o)}try{s=JSON.parse(e)}catch{return mn.red("Error:")+" Not valid JSON!"}return i+=Nu.render(s,r,n),i}});var tD=v($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});$f.default=void 0;function Ho(t){"@babel/helpers - typeof";return Ho=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ho(t)}function _A(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,cH(n.key),n)}}function uH(t,e,r){return e&&_A(t.prototype,e),r&&_A(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function cH(t){var e=lH(t,"string");return Ho(e)=="symbol"?e:e+""}function lH(t,e){if(Ho(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ho(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function hH(t,e,r){return e=Lu(e),dH(t,eD()?Reflect.construct(e,r||[],Lu(t).constructor):e.apply(t,r))}function dH(t,e){if(e&&(Ho(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return pH(t)}function pH(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function mH(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&$u(t,e)}function Qy(t){var e=typeof Map=="function"?new Map:void 0;return Qy=function(n){if(n===null||!yH(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return gH(n,arguments,Lu(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),$u(i,n)},Qy(t)}function gH(t,e,r){if(eD())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(t.bind.apply(t,n));return r&&$u(i,r.prototype),i}function eD(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(eD=function(){return!!t})()}function yH(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function $u(t,e){return $u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},$u(t,e)}function Lu(t){return Lu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Lu(t)}var DH=(function(t){function e(r){var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(fH(this,e),n=hH(this,e,[r]),n.originalRequest=s,n.originalResponse=o,n.causingError=i,i!=null&&(r+=", caused by ".concat(i.toString())),s!=null){var a=s.getHeader("X-Request-ID")||"n/a",u=s.getMethod(),c=s.getURL(),l=o?o.getStatus():"n/a",h=o?o.getBody()||"":"n/a";r+=", originated from request (method: ".concat(u,", url: ").concat(c,", response code: ").concat(l,", response text: ").concat(h,", request id: ").concat(a,")")}return n.message=r,n}return mH(e,t),uH(e)})(Qy(Error)),pye=$f.default=DH});var rD=v(Lf=>{"use strict";Object.defineProperty(Lf,"__esModule",{value:!0});Lf.enableDebugLog=wH;Lf.log=bH;var CA=!1;function wH(){CA=!0}function bH(t){CA&&console.log(t)}});var AA=v(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});jf.default=void 0;function ju(t){"@babel/helpers - typeof";return ju=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ju(t)}function vH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function SA(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_H(n.key),n)}}function EH(t,e,r){return e&&SA(t.prototype,e),r&&SA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _H(t){var e=CH(t,"string");return ju(e)=="symbol"?e:e+""}function CH(t,e){if(ju(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ju(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var yye=jf.default=(function(){function t(){vH(this,t)}return EH(t,[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(r){return Promise.resolve([])}},{key:"removeUpload",value:function(r){return Promise.resolve()}},{key:"addUpload",value:function(r,n){return Promise.resolve(null)}}])})()});var OA=v((nD,iD)=>{(function(t,e){typeof nD=="object"&&typeof iD<"u"?iD.exports=e():typeof define=="function"&&define.amd?define(e):(function(){var r=t.Base64,n=e();n.noConflict=function(){return t.Base64=r,n},t.Meteor&&(Base64=n),t.Base64=n})()})(typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:nD,function(){"use strict";var t="3.7.8",e=t,r=typeof Buffer=="function",n=typeof TextDecoder=="function"?new TextDecoder:void 0,i=typeof TextEncoder=="function"?new TextEncoder:void 0,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=Array.prototype.slice.call(s),a=(function(q){var V={};return q.forEach(function(ae,x){return V[ae]=x}),V})(o),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),l=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(q){return new Uint8Array(Array.prototype.slice.call(q,0))},h=function(q){return q.replace(/=/g,"").replace(/[+\/]/g,function(V){return V=="+"?"-":"_"})},d=function(q){return q.replace(/[^A-Za-z0-9\+\/]/g,"")},f=function(q){for(var V,ae,x,O,H="",N=q.length%3,ne=0;ne<q.length;){if((ae=q.charCodeAt(ne++))>255||(x=q.charCodeAt(ne++))>255||(O=q.charCodeAt(ne++))>255)throw new TypeError("invalid character found");V=ae<<16|x<<8|O,H+=o[V>>18&63]+o[V>>12&63]+o[V>>6&63]+o[V&63]}return N?H.slice(0,N-3)+"===".substring(N):H},m=typeof btoa=="function"?function(q){return btoa(q)}:r?function(q){return Buffer.from(q,"binary").toString("base64")}:f,g=r?function(q){return Buffer.from(q).toString("base64")}:function(q){for(var V=4096,ae=[],x=0,O=q.length;x<O;x+=V)ae.push(c.apply(null,q.subarray(x,x+V)));return m(ae.join(""))},b=function(q,V){return V===void 0&&(V=!1),V?h(g(q)):g(q)},S=function(q){if(q.length<2){var V=q.charCodeAt(0);return V<128?q:V<2048?c(192|V>>>6)+c(128|V&63):c(224|V>>>12&15)+c(128|V>>>6&63)+c(128|V&63)}else{var V=65536+(q.charCodeAt(0)-55296)*1024+(q.charCodeAt(1)-56320);return c(240|V>>>18&7)+c(128|V>>>12&63)+c(128|V>>>6&63)+c(128|V&63)}},A=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,p=function(q){return q.replace(A,S)},D=r?function(q){return Buffer.from(q,"utf8").toString("base64")}:i?function(q){return g(i.encode(q))}:function(q){return m(p(q))},w=function(q,V){return V===void 0&&(V=!1),V?h(D(q)):D(q)},_=function(q){return w(q,!0)},P=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,E=function(q){switch(q.length){case 4:var V=(7&q.charCodeAt(0))<<18|(63&q.charCodeAt(1))<<12|(63&q.charCodeAt(2))<<6|63&q.charCodeAt(3),ae=V-65536;return c((ae>>>10)+55296)+c((ae&1023)+56320);case 3:return c((15&q.charCodeAt(0))<<12|(63&q.charCodeAt(1))<<6|63&q.charCodeAt(2));default:return c((31&q.charCodeAt(0))<<6|63&q.charCodeAt(1))}},R=function(q){return q.replace(P,E)},k=function(q){if(q=q.replace(/\s+/g,""),!u.test(q))throw new TypeError("malformed base64.");q+="==".slice(2-(q.length&3));for(var V,ae,x,O=[],H=0;H<q.length;)V=a[q.charAt(H++)]<<18|a[q.charAt(H++)]<<12|(ae=a[q.charAt(H++)])<<6|(x=a[q.charAt(H++)]),ae===64?O.push(c(V>>16&255)):x===64?O.push(c(V>>16&255,V>>8&255)):O.push(c(V>>16&255,V>>8&255,V&255));return O.join("")},F=typeof atob=="function"?function(q){return atob(d(q))}:r?function(q){return Buffer.from(q,"base64").toString("binary")}:k,j=r?function(q){return l(Buffer.from(q,"base64"))}:function(q){return l(F(q).split("").map(function(V){return V.charCodeAt(0)}))},U=function(q){return j(L(q))},G=r?function(q){return Buffer.from(q,"base64").toString("utf8")}:n?function(q){return n.decode(j(q))}:function(q){return R(F(q))},L=function(q){return d(q.replace(/[-_]/g,function(V){return V=="-"?"+":"/"}))},C=function(q){return G(L(q))},T=function(q){if(typeof q!="string")return!1;var V=q.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(V)||!/[^\s0-9a-zA-Z\-_]/.test(V)},I=function(q){return{value:q,enumerable:!1,writable:!0,configurable:!0}},$=function(){var q=function(V,ae){return Object.defineProperty(String.prototype,V,I(ae))};q("fromBase64",function(){return C(this)}),q("toBase64",function(V){return w(this,V)}),q("toBase64URI",function(){return w(this,!0)}),q("toBase64URL",function(){return w(this,!0)}),q("toUint8Array",function(){return U(this)})},M=function(){var q=function(V,ae){return Object.defineProperty(Uint8Array.prototype,V,I(ae))};q("toBase64",function(V){return b(this,V)}),q("toBase64URI",function(){return b(this,!0)}),q("toBase64URL",function(){return b(this,!0)})},B=function(){$(),M()},K={version:t,VERSION:e,atob:F,atobPolyfill:k,btoa:m,btoaPolyfill:f,fromBase64:C,toBase64:w,encode:w,encodeURI:_,encodeURL:_,utob:p,btou:R,decode:C,isValid:T,fromUint8Array:b,toUint8Array:U,extendString:$,extendUint8Array:M,extendBuiltins:B};return K.Base64={},Object.keys(K).forEach(function(q){return K.Base64[q]=K[q]}),K})});var TA=v((wye,xA)=>{"use strict";xA.exports=function(e,r){if(r=r.split(":")[0],e=+e,!e)return!1;switch(r){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0}});var PA=v(sD=>{"use strict";var SH=Object.prototype.hasOwnProperty,AH;function FA(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function IA(t){try{return encodeURIComponent(t)}catch{return null}}function OH(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var i=FA(n[1]),s=FA(n[2]);i===null||s===null||i in r||(r[i]=s)}return r}function xH(t,e){e=e||"";var r=[],n,i;typeof e!="string"&&(e="?");for(i in t)if(SH.call(t,i)){if(n=t[i],!n&&(n===null||n===AH||isNaN(n))&&(n=""),i=IA(i),n=IA(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?e+r.join("&"):""}sD.stringify=xH;sD.parse=OH});var MA=v((vye,BA)=>{"use strict";var RA=TA(),Bf=PA(),TH=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,NA=/[\n\r\t]/g,FH=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,$A=/:\d+$/,IH=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,PH=/^[a-zA-Z]:/;function aD(t){return(t||"").toString().replace(TH,"")}var oD=[["#","hash"],["?","query"],function(e,r){return gn(r.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],kA={hash:1,query:1};function LA(t){var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e={};var r=e.location||{};t=t||r;var n={},i=typeof t,s;if(t.protocol==="blob:")n=new yn(unescape(t.pathname),{});else if(i==="string"){n=new yn(t,{});for(s in kA)delete n[s]}else if(i==="object"){for(s in t)s in kA||(n[s]=t[s]);n.slashes===void 0&&(n.slashes=FH.test(t.href))}return n}function gn(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function jA(t,e){t=aD(t),t=t.replace(NA,""),e=e||{};var r=IH.exec(t),n=r[1]?r[1].toLowerCase():"",i=!!r[2],s=!!r[3],o=0,a;return i?s?(a=r[2]+r[3]+r[4],o=r[2].length+r[3].length):(a=r[2]+r[4],o=r[2].length):s?(a=r[3]+r[4],o=r[3].length):a=r[4],n==="file:"?o>=2&&(a=a.slice(2)):gn(n)?a=r[4]:n?i&&(a=a.slice(2)):o>=2&&gn(e.protocol)&&(a=r[4]),{protocol:n,slashes:i||gn(n),slashesCount:o,rest:a}}function kH(t,e){if(t==="")return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,i=r[n-1],s=!1,o=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),o++):o&&(n===0&&(s=!0),r.splice(n,1),o--);return s&&r.unshift(""),(i==="."||i==="..")&&r.push(""),r.join("/")}function yn(t,e,r){if(t=aD(t),t=t.replace(NA,""),!(this instanceof yn))return new yn(t,e,r);var n,i,s,o,a,u,c=oD.slice(),l=typeof e,h=this,d=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=Bf.parse),e=LA(e),i=jA(t||"",e),n=!i.protocol&&!i.slashes,h.slashes=i.slashes||n&&e.slashes,h.protocol=i.protocol||e.protocol||"",t=i.rest,(i.protocol==="file:"&&(i.slashesCount!==2||PH.test(t))||!i.slashes&&(i.protocol||i.slashesCount<2||!gn(h.protocol)))&&(c[3]=[/(.*)/,"pathname"]);d<c.length;d++){if(o=c[d],typeof o=="function"){t=o(t,h);continue}s=o[0],u=o[1],s!==s?h[u]=t:typeof s=="string"?(a=s==="@"?t.lastIndexOf(s):t.indexOf(s),~a&&(typeof o[2]=="number"?(h[u]=t.slice(0,a),t=t.slice(a+o[2])):(h[u]=t.slice(a),t=t.slice(0,a)))):(a=s.exec(t))&&(h[u]=a[1],t=t.slice(0,a.index)),h[u]=h[u]||n&&o[3]&&e[u]||"",o[4]&&(h[u]=h[u].toLowerCase())}r&&(h.query=r(h.query)),n&&e.slashes&&h.pathname.charAt(0)!=="/"&&(h.pathname!==""||e.pathname!=="")&&(h.pathname=kH(h.pathname,e.pathname)),h.pathname.charAt(0)!=="/"&&gn(h.protocol)&&(h.pathname="/"+h.pathname),RA(h.port,h.protocol)||(h.host=h.hostname,h.port=""),h.username=h.password="",h.auth&&(a=h.auth.indexOf(":"),~a?(h.username=h.auth.slice(0,a),h.username=encodeURIComponent(decodeURIComponent(h.username)),h.password=h.auth.slice(a+1),h.password=encodeURIComponent(decodeURIComponent(h.password))):h.username=encodeURIComponent(decodeURIComponent(h.auth)),h.auth=h.password?h.username+":"+h.password:h.username),h.origin=h.protocol!=="file:"&&gn(h.protocol)&&h.host?h.protocol+"//"+h.host:"null",h.href=h.toString()}function RH(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||Bf.parse)(e)),n[t]=e;break;case"port":n[t]=e,RA(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[t]="");break;case"hostname":n[t]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[t]=e,$A.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(e){var i=t==="pathname"?"/":"#";n[t]=e.charAt(0)!==i?i+e:e}else n[t]=e;break;case"username":case"password":n[t]=encodeURIComponent(e);break;case"auth":var s=e.indexOf(":");~s?(n.username=e.slice(0,s),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(s+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var o=0;o<oD.length;o++){var a=oD[o];a[4]&&(n[a[1]]=n[a[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&gn(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function NH(t){(!t||typeof t!="function")&&(t=Bf.stringify);var e,r=this,n=r.host,i=r.protocol;i&&i.charAt(i.length-1)!==":"&&(i+=":");var s=i+(r.protocol&&r.slashes||gn(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):r.protocol!=="file:"&&gn(r.protocol)&&!n&&r.pathname!=="/"&&(s+="@"),(n[n.length-1]===":"||$A.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,e=typeof r.query=="object"?t(r.query):r.query,e&&(s+=e.charAt(0)!=="?"?"?"+e:e),r.hash&&(s+=r.hash),s}yn.prototype={set:RH,toString:NH};yn.extractProtocol=jA;yn.location=LA;yn.trimLeft=aD;yn.qs=Bf;BA.exports=yn});var qA=v(uD=>{"use strict";Object.defineProperty(uD,"__esModule",{value:!0});uD.default=$H;function $H(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=Math.random()*16|0,r=t==="x"?e:e&3|8;return r.toString(16)})}});var rO=v(Hf=>{"use strict";Object.defineProperty(Hf,"__esModule",{value:!0});Hf.default=void 0;var LH=OA(),jH=fD(MA()),Mf=fD(tD()),ys=rD(),BH=fD(qA());function fD(t){return t&&t.__esModule?t:{default:t}}function cD(){"use strict";cD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(C,T,I){C[T]=I.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(C,T,I){return Object.defineProperty(C,T,{value:I,enumerable:!0,configurable:!0,writable:!0}),C[T]}try{c({},"")}catch{c=function(I,$,M){return I[$]=M}}function l(C,T,I,$){var M=T&&T.prototype instanceof S?T:S,B=Object.create(M.prototype),K=new G($||[]);return i(B,"_invoke",{value:k(C,I,K)}),B}function h(C,T,I){try{return{type:"normal",arg:C.call(T,I)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",g="completed",b={};function S(){}function A(){}function p(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,_=w&&w(w(L([])));_&&_!==r&&n.call(_,o)&&(D=_);var P=p.prototype=S.prototype=Object.create(D);function E(C){["next","throw","return"].forEach(function(T){c(C,T,function(I){return this._invoke(T,I)})})}function R(C,T){function I(M,B,K,q){var V=h(C[M],C,B);if(V.type!=="throw"){var ae=V.arg,x=ae.value;return x&&Ds(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){I("next",O,K,q)},function(O){I("throw",O,K,q)}):T.resolve(x).then(function(O){ae.value=O,K(ae)},function(O){return I("throw",O,K,q)})}q(V.arg)}var $;i(this,"_invoke",{value:function(B,K){function q(){return new T(function(V,ae){I(B,K,V,ae)})}return $=$?$.then(q,q):q()}})}function k(C,T,I){var $=d;return function(M,B){if($===m)throw Error("Generator is already running");if($===g){if(M==="throw")throw B;return{value:t,done:!0}}for(I.method=M,I.arg=B;;){var K=I.delegate;if(K){var q=F(K,I);if(q){if(q===b)continue;return q}}if(I.method==="next")I.sent=I._sent=I.arg;else if(I.method==="throw"){if($===d)throw $=g,I.arg;I.dispatchException(I.arg)}else I.method==="return"&&I.abrupt("return",I.arg);$=m;var V=h(C,T,I);if(V.type==="normal"){if($=I.done?g:f,V.arg===b)continue;return{value:V.arg,done:I.done}}V.type==="throw"&&($=g,I.method="throw",I.arg=V.arg)}}}function F(C,T){var I=T.method,$=C.iterator[I];if($===t)return T.delegate=null,I==="throw"&&C.iterator.return&&(T.method="return",T.arg=t,F(C,T),T.method==="throw")||I!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+I+"' method")),b;var M=h($,C.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,b;var B=M.arg;return B?B.done?(T[C.resultName]=B.value,T.next=C.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,b):B:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,b)}function j(C){var T={tryLoc:C[0]};1 in C&&(T.catchLoc=C[1]),2 in C&&(T.finallyLoc=C[2],T.afterLoc=C[3]),this.tryEntries.push(T)}function U(C){var T=C.completion||{};T.type="normal",delete T.arg,C.completion=T}function G(C){this.tryEntries=[{tryLoc:"root"}],C.forEach(j,this),this.reset(!0)}function L(C){if(C||C===""){var T=C[o];if(T)return T.call(C);if(typeof C.next=="function")return C;if(!isNaN(C.length)){var I=-1,$=function M(){for(;++I<C.length;)if(n.call(C,I))return M.value=C[I],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(Ds(C)+" is not iterable")}return A.prototype=p,i(P,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(C){var T=typeof C=="function"&&C.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(C){return Object.setPrototypeOf?Object.setPrototypeOf(C,p):(C.__proto__=p,c(C,u,"GeneratorFunction")),C.prototype=Object.create(P),C},e.awrap=function(C){return{__await:C}},E(R.prototype),c(R.prototype,a,function(){return this}),e.AsyncIterator=R,e.async=function(C,T,I,$,M){M===void 0&&(M=Promise);var B=new R(l(C,T,I,$),M);return e.isGeneratorFunction(T)?B:B.next().then(function(K){return K.done?K.value:B.next()})},E(P),c(P,u,"Generator"),c(P,o,function(){return this}),c(P,"toString",function(){return"[object Generator]"}),e.keys=function(C){var T=Object(C),I=[];for(var $ in T)I.push($);return I.reverse(),function M(){for(;I.length;){var B=I.pop();if(B in T)return M.value=B,M.done=!1,M}return M.done=!0,M}},e.values=L,G.prototype={constructor:G,reset:function(T){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(U),!T)for(var I in this)I.charAt(0)==="t"&&n.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=t)},stop:function(){this.done=!0;var T=this.tryEntries[0].completion;if(T.type==="throw")throw T.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var I=this;function $(ae,x){return K.type="throw",K.arg=T,I.next=ae,x&&(I.method="next",I.arg=t),!!x}for(var M=this.tryEntries.length-1;M>=0;--M){var B=this.tryEntries[M],K=B.completion;if(B.tryLoc==="root")return $("end");if(B.tryLoc<=this.prev){var q=n.call(B,"catchLoc"),V=n.call(B,"finallyLoc");if(q&&V){if(this.prev<B.catchLoc)return $(B.catchLoc,!0);if(this.prev<B.finallyLoc)return $(B.finallyLoc)}else if(q){if(this.prev<B.catchLoc)return $(B.catchLoc,!0)}else{if(!V)throw Error("try statement without catch or finally");if(this.prev<B.finallyLoc)return $(B.finallyLoc)}}}},abrupt:function(T,I){for(var $=this.tryEntries.length-1;$>=0;--$){var M=this.tryEntries[$];if(M.tryLoc<=this.prev&&n.call(M,"finallyLoc")&&this.prev<M.finallyLoc){var B=M;break}}B&&(T==="break"||T==="continue")&&B.tryLoc<=I&&I<=B.finallyLoc&&(B=null);var K=B?B.completion:{};return K.type=T,K.arg=I,B?(this.method="next",this.next=B.finallyLoc,b):this.complete(K)},complete:function(T,I){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&I&&(this.next=I),b},finish:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var $=this.tryEntries[I];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),U($),b}},catch:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var $=this.tryEntries[I];if($.tryLoc===T){var M=$.completion;if(M.type==="throw"){var B=M.arg;U($)}return B}}throw Error("illegal catch attempt")},delegateYield:function(T,I,$){return this.delegate={iterator:L(T),resultName:I,nextLoc:$},this.method==="next"&&(this.arg=t),b}},e}function UA(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function MH(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){UA(s,n,i,o,a,"next",u)}function a(u){UA(s,n,i,o,a,"throw",u)}o(void 0)})}}function JA(t,e){return HH(t)||UH(t,e)||ZA(t,e)||qH()}function qH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
48
48
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UH(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,o,a=[],u=!0,c=!1;try{if(s=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=s.call(r)).done)&&(a.push(n.value),a.length!==e);u=!0);}catch(l){c=!0,i=l}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function HH(t){if(Array.isArray(t))return t}function Ds(t){"@babel/helpers - typeof";return Ds=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ds(t)}function VH(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ZA(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(c){throw c},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
49
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{!s&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function ZA(t,e){if(t){if(typeof t=="string")return HA(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return HA(t,e)}}function HA(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function VA(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Vo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?VA(Object(r),!0).forEach(function(n){zH(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):VA(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function zH(t,e,r){return e=QA(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function GH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function zA(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,QA(n.key),n)}}function KH(t,e,r){return e&&zA(t.prototype,e),r&&zA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function QA(t){var e=WH(t,"string");return Ds(e)=="symbol"?e:e+""}function WH(t,e){if(Ds(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ds(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var qf="tus-v1",Uf="ietf-draft-03",Bu="ietf-draft-05",XH={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:tO,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null,protocol:qf},eO=(function(){function t(e,r){GH(this,t),"resume"in r&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=r,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=e,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}return KH(t,[{key:"findPreviousUploads",value:function(){var r=this;return this.options.fingerprint(this.file,this.options).then(function(n){return r._urlStorage.findUploadsByFingerprint(n)})}},{key:"resumeFromPreviousUpload",value:function(r){this.url=r.uploadUrl||null,this._parallelUploadUrls=r.parallelUploadUrls||null,this._urlStorageKey=r.urlStorageKey}},{key:"start",value:function(){var r=this,n=this.file;if(!n){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![qf,Uf,Bu].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var i=this.options.retryDelays;if(i!=null&&Object.prototype.toString.call(i)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var s=0,o=["uploadUrl","uploadSize","uploadLengthDeferred"];s<o.length;s++){var a=o[s];if(this.options[a]){this._emitError(new Error("tus: cannot use the ".concat(a," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(function(u){return u==null?(0,ys.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,ys.log)("Calculated fingerprint: ".concat(u)),r._fingerprint=u,r._source?r._source:r.options.fileReader.openFile(n,r.options.chunkSize)}).then(function(u){if(r._source=u,r.options.uploadLengthDeferred)r._size=null;else if(r.options.uploadSize!=null){if(r._size=Number(r.options.uploadSize),Number.isNaN(r._size)){r._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(r._size=r._source.size,r._size==null){r._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}r.options.parallelUploads>1||r._parallelUploadUrls!=null?r._startParallelUpload():r._startSingleUpload()}).catch(function(u){r._emitError(u)})}},{key:"_startParallelUpload",value:function(){var r,n=this,i=this._size,s=0;this._parallelUploads=[];var o=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,a=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:JH(this._source.size,o);this._parallelUploadUrls&&a.forEach(function(l,h){l.uploadUrl=n._parallelUploadUrls[h]||null}),this._parallelUploadUrls=new Array(a.length);var u=a.map(function(l,h){var d=0;return n._source.slice(l.start,l.end).then(function(f){var m=f.value;return new Promise(function(g,b){var S=Vo(Vo({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:Vo(Vo({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:g,onError:b,onProgress:function(y){s=s-d+y,d=y,n._emitProgress(s,i)},onUploadUrlAvailable:function(){n._parallelUploadUrls[h]=A.url,n._parallelUploadUrls.filter(function(y){return!!y}).length===a.length&&n._saveUploadInUrlStorage()}}),A=new t(m,S);A.start(),n._parallelUploads.push(A)})})}),c;Promise.all(u).then(function(){c=n._openRequest("POST",n.options.endpoint),c.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var l=GA(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!zo(l.getStatus(),200)){n._emitHttpError(c,l,"tus: unexpected response while creating upload");return}var h=l.getHeader("Location");if(h==null){n._emitHttpError(c,l,"tus: invalid or missing Location header");return}n.url=YA(n.options.endpoint,h),(0,ys.log)("Created upload at ".concat(n.url)),n._emitSuccess(l)}).catch(function(l){n._emitError(l)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){(0,ys.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,ys.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,ys.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var i=VH(this._parallelUploads),s;try{for(i.s();!(s=i.n()).done;){var o=s.value;o.abort(r)}}catch(a){i.e(a)}finally{i.f()}}return this._req!==null&&this._req.abort(),this._aborted=!0,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!r||this.url==null?Promise.resolve():t.terminate(this.url,this.options).then(function(){return n._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(r,n,i,s){this._emitError(new Mf.default(i,s,r,n))}},{key:"_emitError",value:function(r){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var i=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(i&&(this._retryAttempt=0),XA(r,this._retryAttempt,this.options)){var s=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){n.start()},s);return}}if(typeof this.options.onError=="function")this.options.onError(r);else throw r}}},{key:"_emitSuccess",value:function(r){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:r})}},{key:"_emitProgress",value:function(r,n){typeof this.options.onProgress=="function"&&this.options.onProgress(r,n)}},{key:"_emitChunkComplete",value:function(r,n,i){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(r,n,i)}},{key:"_createUpload",value:function(){var r=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var n=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?n.setHeader("Upload-Defer-Length","1"):n.setHeader("Upload-Length","".concat(this._size));var i=GA(this.options.metadata);i!==""&&n.setHeader("Upload-Metadata",i);var s;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,s=this._addChunkToRequest(n)):((this.options.protocol===Uf||this.options.protocol===Bu)&&n.setHeader("Upload-Complete","?0"),s=this._sendRequest(n,null)),s.then(function(o){if(!zo(o.getStatus(),200)){r._emitHttpError(n,o,"tus: unexpected response while creating upload");return}var a=o.getHeader("Location");if(a==null){r._emitHttpError(n,o,"tus: invalid or missing Location header");return}if(r.url=YA(r.options.endpoint,a),(0,ys.log)("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(o),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,o):(r._offset=0,r._performUpload())})}).catch(function(o){r._emitHttpError(n,null,"tus: failed to create upload",o)})}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),i=this._sendRequest(n,null);i.then(function(s){var o=s.getStatus();if(!zo(o,200)){if(o===423){r._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(zo(o,400)&&r._removeFromUrlStorage(),!r.options.endpoint){r._emitHttpError(n,s,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}r.url=null,r._createUpload();return}var a=Number.parseInt(s.getHeader("Upload-Offset"),10);if(Number.isNaN(a)){r._emitHttpError(n,s,"tus: invalid or missing offset value");return}var u=Number.parseInt(s.getHeader("Upload-Length"),10);if(Number.isNaN(u)&&!r.options.uploadLengthDeferred&&r.options.protocol===qf){r._emitHttpError(n,s,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(a===u){r._emitProgress(u,u),r._emitSuccess(s);return}r._offset=a,r._performUpload()})}).catch(function(s){r._emitHttpError(n,null,"tus: failed to resume upload",s)})}},{key:"_performUpload",value:function(){var r=this;if(!this._aborted){var n;this.options.overridePatchMethod?(n=this._openRequest("POST",this.url),n.setHeader("X-HTTP-Method-Override","PATCH")):n=this._openRequest("PATCH",this.url),n.setHeader("Upload-Offset","".concat(this._offset));var i=this._addChunkToRequest(n);i.then(function(s){if(!zo(s.getStatus(),200)){r._emitHttpError(n,s,"tus: unexpected response while uploading chunk");return}r._handleUploadResponse(n,s)}).catch(function(s){r._aborted||r._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(r._offset),s)})}}},{key:"_addChunkToRequest",value:function(r){var n=this,i=this._offset,s=this._offset+this.options.chunkSize;return r.setProgressHandler(function(o){n._emitProgress(i+o,n._size)}),this.options.protocol===qf?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Bu&&r.setHeader("Content-Type","application/partial-upload"),(s===Number.POSITIVE_INFINITY||s>this._size)&&!this.options.uploadLengthDeferred&&(s=this._size),this._source.slice(i,s).then(function(o){var a=o.value,u=o.done,c=a!=null&&a.size?a.size:0;n.options.uploadLengthDeferred&&u&&(n._size=n._offset+c,r.setHeader("Upload-Length","".concat(n._size)));var l=n._offset+c;return!n.options.uploadLengthDeferred&&u&&l!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(l," bytes"))):a===null?n._sendRequest(r):((n.options.protocol===Uf||n.options.protocol===Bu)&&r.setHeader("Upload-Complete",u?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,a))})}},{key:"_handleUploadResponse",value:function(r,n){var i=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(i)){this._emitHttpError(r,n,"tus: invalid or missing offset value");return}if(this._emitProgress(i,this._size),this._emitChunkComplete(i-this._offset,i,this._size),this._offset=i,i===this._size){this._emitSuccess(n),this._source.close();return}this._performUpload()}},{key:"_openRequest",value:function(r,n){var i=KA(r,n,this.options);return this._req=i,i}},{key:"_removeFromUrlStorage",value:function(){var r=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(n){r._emitError(n)}),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var r=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var n={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?n.parallelUploadUrls=this._parallelUploadUrls:n.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,n).then(function(i){r._urlStorageKey=i})}},{key:"_sendRequest",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return WA(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=KA("DELETE",r,n);return WA(i,null,n).then(function(s){if(s.getStatus()!==204)throw new Mf.default("tus: unexpected response while terminating upload",null,i,s)}).catch(function(s){if(s instanceof Mf.default||(s=new Mf.default("tus: failed to terminate upload",s,i,null)),!XA(s,0,n))throw s;var o=n.retryDelays[0],a=n.retryDelays.slice(1),u=Vo(Vo({},n),{},{retryDelays:a});return new Promise(function(c){return setTimeout(c,o)}).then(function(){return t.terminate(r,u)})})}}])})();function GA(t){return Object.entries(t).map(function(e){var r=JA(e,2),n=r[0],i=r[1];return"".concat(n," ").concat(LH.Base64.encode(String(i)))}).join(",")}function zo(t,e){return t>=e&&t<e+100}function KA(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===Uf?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Bu?n.setHeader("Upload-Draft-Interop-Version","6"):n.setHeader("Tus-Resumable","1.0.0");for(var i=r.headers||{},s=0,o=Object.entries(i);s<o.length;s++){var a=JA(o[s],2),u=a[0],c=a[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,BH.default)();n.setHeader("X-Request-ID",l)}return n}function WA(t,e,r){return lD.apply(this,arguments)}function lD(){return lD=MH(cD().mark(function t(e,r,n){var i;return cD().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(typeof n.onBeforeRequest!="function"){o.next=3;break}return o.next=3,n.onBeforeRequest(e);case 3:return o.next=5,e.send(r);case 5:if(i=o.sent,typeof n.onAfterResponse!="function"){o.next=9;break}return o.next=9,n.onAfterResponse(e,i);case 9:return o.abrupt("return",i);case 10:case"end":return o.stop()}},t)})),lD.apply(this,arguments)}function YH(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function XA(t,e,r){return r.retryDelays==null||e>=r.retryDelays.length||t.originalRequest==null?!1:r&&typeof r.onShouldRetry=="function"?r.onShouldRetry(t,e,r):tO(t)}function tO(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!zo(e,400)||e===409||e===423)&&YH()}function YA(t,e){return new jH.default(e,t).toString()}function JH(t,e){for(var r=Math.floor(t/e),n=[],i=0;i<e;i++)n.push({start:r*i,end:r*(i+1)});return n[e-1].end=t,n}eO.defaultOptions=XH;var Eye=Hf.default=eO});var iO=v((Cye,nO)=>{"use strict";var Dn=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";Dn.writable=t=>Dn(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";Dn.readable=t=>Dn(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";Dn.duplex=t=>Dn.writable(t)&&Dn.readable(t);Dn.transform=t=>Dn.duplex(t)&&typeof t._transform=="function";nO.exports=Dn});var oO=v(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});Vf.default=void 0;function Mu(t){"@babel/helpers - typeof";return Mu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mu(t)}function ZH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function sO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,eV(n.key),n)}}function QH(t,e,r){return e&&sO(t.prototype,e),r&&sO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function eV(t){var e=tV(t,"string");return Mu(e)=="symbol"?e:e+""}function tV(t,e){if(Mu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Mu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Sye=Vf.default=(function(){function t(e){ZH(this,t),this._buffer=e,this.size=e.length}return QH(t,[{key:"slice",value:function(r,n){var i=this._buffer.slice(r,n);i.size=i.length;var s=n>=this.size;return Promise.resolve({value:i,done:s})}},{key:"close",value:function(){}}])})()});var lO=v(pD=>{"use strict";Object.defineProperty(pD,"__esModule",{value:!0});pD.default=aV;var cO=require("fs");function ws(t){"@babel/helpers - typeof";return ws=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ws(t)}function hD(){"use strict";hD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(C,T,I){C[T]=I.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(C,T,I){return Object.defineProperty(C,T,{value:I,enumerable:!0,configurable:!0,writable:!0}),C[T]}try{c({},"")}catch{c=function(I,$,M){return I[$]=M}}function l(C,T,I,$){var M=T&&T.prototype instanceof S?T:S,B=Object.create(M.prototype),K=new G($||[]);return i(B,"_invoke",{value:k(C,I,K)}),B}function h(C,T,I){try{return{type:"normal",arg:C.call(T,I)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",g="completed",b={};function S(){}function A(){}function p(){}var y={};c(y,o,function(){return this});var w=Object.getPrototypeOf,_=w&&w(w(L([])));_&&_!==r&&n.call(_,o)&&(y=_);var P=p.prototype=S.prototype=Object.create(y);function E(C){["next","throw","return"].forEach(function(T){c(C,T,function(I){return this._invoke(T,I)})})}function R(C,T){function I(M,B,K,q){var V=h(C[M],C,B);if(V.type!=="throw"){var ae=V.arg,x=ae.value;return x&&ws(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){I("next",O,K,q)},function(O){I("throw",O,K,q)}):T.resolve(x).then(function(O){ae.value=O,K(ae)},function(O){return I("throw",O,K,q)})}q(V.arg)}var $;i(this,"_invoke",{value:function(B,K){function q(){return new T(function(V,ae){I(B,K,V,ae)})}return $=$?$.then(q,q):q()}})}function k(C,T,I){var $=d;return function(M,B){if($===m)throw Error("Generator is already running");if($===g){if(M==="throw")throw B;return{value:t,done:!0}}for(I.method=M,I.arg=B;;){var K=I.delegate;if(K){var q=F(K,I);if(q){if(q===b)continue;return q}}if(I.method==="next")I.sent=I._sent=I.arg;else if(I.method==="throw"){if($===d)throw $=g,I.arg;I.dispatchException(I.arg)}else I.method==="return"&&I.abrupt("return",I.arg);$=m;var V=h(C,T,I);if(V.type==="normal"){if($=I.done?g:f,V.arg===b)continue;return{value:V.arg,done:I.done}}V.type==="throw"&&($=g,I.method="throw",I.arg=V.arg)}}}function F(C,T){var I=T.method,$=C.iterator[I];if($===t)return T.delegate=null,I==="throw"&&C.iterator.return&&(T.method="return",T.arg=t,F(C,T),T.method==="throw")||I!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+I+"' method")),b;var M=h($,C.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,b;var B=M.arg;return B?B.done?(T[C.resultName]=B.value,T.next=C.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,b):B:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,b)}function j(C){var T={tryLoc:C[0]};1 in C&&(T.catchLoc=C[1]),2 in C&&(T.finallyLoc=C[2],T.afterLoc=C[3]),this.tryEntries.push(T)}function U(C){var T=C.completion||{};T.type="normal",delete T.arg,C.completion=T}function G(C){this.tryEntries=[{tryLoc:"root"}],C.forEach(j,this),this.reset(!0)}function L(C){if(C||C===""){var T=C[o];if(T)return T.call(C);if(typeof C.next=="function")return C;if(!isNaN(C.length)){var I=-1,$=function M(){for(;++I<C.length;)if(n.call(C,I))return M.value=C[I],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(ws(C)+" is not iterable")}return A.prototype=p,i(P,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(C){var T=typeof C=="function"&&C.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(C){return Object.setPrototypeOf?Object.setPrototypeOf(C,p):(C.__proto__=p,c(C,u,"GeneratorFunction")),C.prototype=Object.create(P),C},e.awrap=function(C){return{__await:C}},E(R.prototype),c(R.prototype,a,function(){return this}),e.AsyncIterator=R,e.async=function(C,T,I,$,M){M===void 0&&(M=Promise);var B=new R(l(C,T,I,$),M);return e.isGeneratorFunction(T)?B:B.next().then(function(K){return K.done?K.value:B.next()})},E(P),c(P,u,"Generator"),c(P,o,function(){return this}),c(P,"toString",function(){return"[object Generator]"}),e.keys=function(C){var T=Object(C),I=[];for(var $ in T)I.push($);return I.reverse(),function M(){for(;I.length;){var B=I.pop();if(B in T)return M.value=B,M.done=!1,M}return M.done=!0,M}},e.values=L,G.prototype={constructor:G,reset:function(T){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(U),!T)for(var I in this)I.charAt(0)==="t"&&n.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=t)},stop:function(){this.done=!0;var T=this.tryEntries[0].completion;if(T.type==="throw")throw T.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var I=this;function $(ae,x){return K.type="throw",K.arg=T,I.next=ae,x&&(I.method="next",I.arg=t),!!x}for(var M=this.tryEntries.length-1;M>=0;--M){var B=this.tryEntries[M],K=B.completion;if(B.tryLoc==="root")return $("end");if(B.tryLoc<=this.prev){var q=n.call(B,"catchLoc"),V=n.call(B,"finallyLoc");if(q&&V){if(this.prev<B.catchLoc)return $(B.catchLoc,!0);if(this.prev<B.finallyLoc)return $(B.finallyLoc)}else if(q){if(this.prev<B.catchLoc)return $(B.catchLoc,!0)}else{if(!V)throw Error("try statement without catch or finally");if(this.prev<B.finallyLoc)return $(B.finallyLoc)}}}},abrupt:function(T,I){for(var $=this.tryEntries.length-1;$>=0;--$){var M=this.tryEntries[$];if(M.tryLoc<=this.prev&&n.call(M,"finallyLoc")&&this.prev<M.finallyLoc){var B=M;break}}B&&(T==="break"||T==="continue")&&B.tryLoc<=I&&I<=B.finallyLoc&&(B=null);var K=B?B.completion:{};return K.type=T,K.arg=I,B?(this.method="next",this.next=B.finallyLoc,b):this.complete(K)},complete:function(T,I){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&I&&(this.next=I),b},finish:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var $=this.tryEntries[I];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),U($),b}},catch:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var $=this.tryEntries[I];if($.tryLoc===T){var M=$.completion;if(M.type==="throw"){var B=M.arg;U($)}return B}}throw Error("illegal catch attempt")},delegateYield:function(T,I,$){return this.delegate={iterator:L(T),resultName:I,nextLoc:$},this.method==="next"&&(this.arg=t),b}},e}function rV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function aO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,iV(n.key),n)}}function nV(t,e,r){return e&&aO(t.prototype,e),r&&aO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function iV(t){var e=sV(t,"string");return ws(e)=="symbol"?e:e+""}function sV(t,e){if(ws(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ws(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function uO(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function oV(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){uO(s,n,i,o,a,"next",u)}function a(u){uO(s,n,i,o,a,"throw",u)}o(void 0)})}}function aV(t){return dD.apply(this,arguments)}function dD(){return dD=oV(hD().mark(function t(e){var r,n,i,s,o,a,u;return hD().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,cO.promises.stat(n);case 3:return i=l.sent,s=i.size,o=(r=e.start)!==null&&r!==void 0?r:0,a=Number.isFinite(e.end)?e.end+1:s,u=a-o,l.abrupt("return",new uV(e,n,u));case 9:case"end":return l.stop()}},t)})),dD.apply(this,arguments)}var uV=(function(){function t(e,r,n){rV(this,t),this._stream=e,this._path=r,this.size=n}return nV(t,[{key:"slice",value:function(r,n){var i,s=(i=this._stream.start)!==null&&i!==void 0?i:0,o=(0,cO.createReadStream)(this._path,{start:s+r,end:s+n-1,autoClose:!0});o.size=Math.min(n-r,this.size);var a=o.size>=this.size;return Promise.resolve({value:o,done:a})}},{key:"close",value:function(){this._stream.destroy()}}])})()});var gD=v(zf=>{"use strict";Object.defineProperty(zf,"__esModule",{value:!0});zf.default=void 0;function bs(t){"@babel/helpers - typeof";return bs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bs(t)}function qu(){"use strict";qu=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(C,T,I){C[T]=I.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(C,T,I){return Object.defineProperty(C,T,{value:I,enumerable:!0,configurable:!0,writable:!0}),C[T]}try{c({},"")}catch{c=function(I,$,M){return I[$]=M}}function l(C,T,I,$){var M=T&&T.prototype instanceof S?T:S,B=Object.create(M.prototype),K=new G($||[]);return i(B,"_invoke",{value:k(C,I,K)}),B}function h(C,T,I){try{return{type:"normal",arg:C.call(T,I)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",g="completed",b={};function S(){}function A(){}function p(){}var y={};c(y,o,function(){return this});var w=Object.getPrototypeOf,_=w&&w(w(L([])));_&&_!==r&&n.call(_,o)&&(y=_);var P=p.prototype=S.prototype=Object.create(y);function E(C){["next","throw","return"].forEach(function(T){c(C,T,function(I){return this._invoke(T,I)})})}function R(C,T){function I(M,B,K,q){var V=h(C[M],C,B);if(V.type!=="throw"){var ae=V.arg,x=ae.value;return x&&bs(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){I("next",O,K,q)},function(O){I("throw",O,K,q)}):T.resolve(x).then(function(O){ae.value=O,K(ae)},function(O){return I("throw",O,K,q)})}q(V.arg)}var $;i(this,"_invoke",{value:function(B,K){function q(){return new T(function(V,ae){I(B,K,V,ae)})}return $=$?$.then(q,q):q()}})}function k(C,T,I){var $=d;return function(M,B){if($===m)throw Error("Generator is already running");if($===g){if(M==="throw")throw B;return{value:t,done:!0}}for(I.method=M,I.arg=B;;){var K=I.delegate;if(K){var q=F(K,I);if(q){if(q===b)continue;return q}}if(I.method==="next")I.sent=I._sent=I.arg;else if(I.method==="throw"){if($===d)throw $=g,I.arg;I.dispatchException(I.arg)}else I.method==="return"&&I.abrupt("return",I.arg);$=m;var V=h(C,T,I);if(V.type==="normal"){if($=I.done?g:f,V.arg===b)continue;return{value:V.arg,done:I.done}}V.type==="throw"&&($=g,I.method="throw",I.arg=V.arg)}}}function F(C,T){var I=T.method,$=C.iterator[I];if($===t)return T.delegate=null,I==="throw"&&C.iterator.return&&(T.method="return",T.arg=t,F(C,T),T.method==="throw")||I!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+I+"' method")),b;var M=h($,C.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,b;var B=M.arg;return B?B.done?(T[C.resultName]=B.value,T.next=C.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,b):B:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,b)}function j(C){var T={tryLoc:C[0]};1 in C&&(T.catchLoc=C[1]),2 in C&&(T.finallyLoc=C[2],T.afterLoc=C[3]),this.tryEntries.push(T)}function U(C){var T=C.completion||{};T.type="normal",delete T.arg,C.completion=T}function G(C){this.tryEntries=[{tryLoc:"root"}],C.forEach(j,this),this.reset(!0)}function L(C){if(C||C===""){var T=C[o];if(T)return T.call(C);if(typeof C.next=="function")return C;if(!isNaN(C.length)){var I=-1,$=function M(){for(;++I<C.length;)if(n.call(C,I))return M.value=C[I],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(bs(C)+" is not iterable")}return A.prototype=p,i(P,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(C){var T=typeof C=="function"&&C.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(C){return Object.setPrototypeOf?Object.setPrototypeOf(C,p):(C.__proto__=p,c(C,u,"GeneratorFunction")),C.prototype=Object.create(P),C},e.awrap=function(C){return{__await:C}},E(R.prototype),c(R.prototype,a,function(){return this}),e.AsyncIterator=R,e.async=function(C,T,I,$,M){M===void 0&&(M=Promise);var B=new R(l(C,T,I,$),M);return e.isGeneratorFunction(T)?B:B.next().then(function(K){return K.done?K.value:B.next()})},E(P),c(P,u,"Generator"),c(P,o,function(){return this}),c(P,"toString",function(){return"[object Generator]"}),e.keys=function(C){var T=Object(C),I=[];for(var $ in T)I.push($);return I.reverse(),function M(){for(;I.length;){var B=I.pop();if(B in T)return M.value=B,M.done=!1,M}return M.done=!0,M}},e.values=L,G.prototype={constructor:G,reset:function(T){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(U),!T)for(var I in this)I.charAt(0)==="t"&&n.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=t)},stop:function(){this.done=!0;var T=this.tryEntries[0].completion;if(T.type==="throw")throw T.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var I=this;function $(ae,x){return K.type="throw",K.arg=T,I.next=ae,x&&(I.method="next",I.arg=t),!!x}for(var M=this.tryEntries.length-1;M>=0;--M){var B=this.tryEntries[M],K=B.completion;if(B.tryLoc==="root")return $("end");if(B.tryLoc<=this.prev){var q=n.call(B,"catchLoc"),V=n.call(B,"finallyLoc");if(q&&V){if(this.prev<B.catchLoc)return $(B.catchLoc,!0);if(this.prev<B.finallyLoc)return $(B.finallyLoc)}else if(q){if(this.prev<B.catchLoc)return $(B.catchLoc,!0)}else{if(!V)throw Error("try statement without catch or finally");if(this.prev<B.finallyLoc)return $(B.finallyLoc)}}}},abrupt:function(T,I){for(var $=this.tryEntries.length-1;$>=0;--$){var M=this.tryEntries[$];if(M.tryLoc<=this.prev&&n.call(M,"finallyLoc")&&this.prev<M.finallyLoc){var B=M;break}}B&&(T==="break"||T==="continue")&&B.tryLoc<=I&&I<=B.finallyLoc&&(B=null);var K=B?B.completion:{};return K.type=T,K.arg=I,B?(this.method="next",this.next=B.finallyLoc,b):this.complete(K)},complete:function(T,I){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&I&&(this.next=I),b},finish:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var $=this.tryEntries[I];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),U($),b}},catch:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var $=this.tryEntries[I];if($.tryLoc===T){var M=$.completion;if(M.type==="throw"){var B=M.arg;U($)}return B}}throw Error("illegal catch attempt")},delegateYield:function(T,I,$){return this.delegate={iterator:L(T),resultName:I,nextLoc:$},this.method==="next"&&(this.arg=t),b}},e}function cV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function fO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fV(n.key),n)}}function lV(t,e,r){return e&&fO(t.prototype,e),r&&fO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function fV(t){var e=hV(t,"string");return bs(e)=="symbol"?e:e+""}function hV(t,e){if(bs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(bs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function hO(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function dO(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){hO(s,n,i,o,a,"next",u)}function a(u){hO(s,n,i,o,a,"throw",u)}o(void 0)})}}function dV(t,e){return mD.apply(this,arguments)}function mD(){return mD=dO(qu().mark(function t(e,r){return qu().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",new Promise(function(s,o){var a=function(l){e.off("readable",u),o(l)},u=function c(){var l=e.read(r);l!==null&&(e.off("error",a),e.off("readable",c),s(l))};e.once("error",a),e.on("readable",u)}));case 1:case"end":return i.stop()}},t)})),mD.apply(this,arguments)}var xye=zf.default=(function(){function t(e){var r=this;cV(this,t),this._stream=e,this.size=null,this._buf=Buffer.alloc(0),this._bufPos=0,this._ended=!1,this._error=null,e.pause(),e.on("end",function(){r._ended=!0}),e.on("error",function(n){r._error=n})}return lV(t,[{key:"slice",value:(function(){var e=dO(qu().mark(function n(i,s){var o,a,u,c,l;return qu().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(!(i<this._bufPos)){d.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(i>this._bufPos+this._buf.length)){d.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){d.next=6;break}throw this._error;case 6:if(i<this._bufPos+this._buf.length?(a=i-this._bufPos,u=Math.min(this._buf.length,s-this._bufPos),o=this._buf.slice(a,u)):o=Buffer.alloc(0),!this._ended){d.next=10;break}return o.size=o.length,d.abrupt("return",{value:o,done:!0});case 10:if(c=s-i,!(c>o.length)){d.next=16;break}return d.next=14,dV(this._stream,c-o.length);case 14:l=d.sent,o=Buffer.concat([o,l]);case 16:return this._buf=o,this._bufPos=i,o.size=o.length,d.abrupt("return",{value:o,done:this._ended});case 20:case"end":return d.stop()}},n,this)}));function r(n,i){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var mO=v(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.default=void 0;var pV=require("fs"),mV=Gf(iO()),gV=Gf(oO()),yV=Gf(lO()),DV=Gf(gD());function Gf(t){return t&&t.__esModule?t:{default:t}}function Uu(t){"@babel/helpers - typeof";return Uu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uu(t)}function wV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,vV(n.key),n)}}function bV(t,e,r){return e&&pO(t.prototype,e),r&&pO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function vV(t){var e=EV(t,"string");return Uu(e)=="symbol"?e:e+""}function EV(t,e){if(Uu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Uu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Fye=Kf.default=(function(){function t(){wV(this,t)}return bV(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new gV.default(r)):r instanceof pV.ReadStream&&r.path!=null?(0,yV.default)(r):mV.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new DV.default(r)):Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option; specify a chunkSize to control the memory consumption"))):Promise.reject(new Error("source object may only be an instance of Buffer or Readable in this environment"))}}])})()});var wO=v(yD=>{"use strict";Object.defineProperty(yD,"__esModule",{value:!0});yD.default=SV;var _V=require("crypto"),gO=DO(require("fs")),CV=DO(require("path"));function yO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(yO=function(n){return n?r:e})(t)}function DO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=yO(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function SV(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),i=(0,_V.createHash)("md5").update(n).digest("hex"),s=["node-buffer",i,t.length,e.endpoint].join("-");return Promise.resolve(s)}return t instanceof gO.ReadStream&&t.path!=null?new Promise(function(o,a){var u=CV.resolve(t.path);gO.stat(t.path,function(c,l){if(c){a(c);return}var h=["node-file",u,l.size,l.mtime.getTime(),e.endpoint].join("-");o(h)})}):Promise.resolve(null)}});var CO=v((kye,_O)=>{var EO="Expected a function",bO=NaN,AV="[object Symbol]",OV=/^\s+|\s+$/g,xV=/^[-+]0x[0-9a-f]+$/i,TV=/^0b[01]+$/i,FV=/^0o[0-7]+$/i,IV=parseInt,PV=typeof global=="object"&&global&&global.Object===Object&&global,kV=typeof self=="object"&&self&&self.Object===Object&&self,RV=PV||kV||Function("return this")(),NV=Object.prototype,$V=NV.toString,LV=Math.max,jV=Math.min,DD=function(){return RV.Date.now()};function BV(t,e,r){var n,i,s,o,a,u,c=0,l=!1,h=!1,d=!0;if(typeof t!="function")throw new TypeError(EO);e=vO(e)||0,Wf(r)&&(l=!!r.leading,h="maxWait"in r,s=h?LV(vO(r.maxWait)||0,e):s,d="trailing"in r?!!r.trailing:d);function f(_){var P=n,E=i;return n=i=void 0,c=_,o=t.apply(E,P),o}function m(_){return c=_,a=setTimeout(S,e),l?f(_):o}function g(_){var P=_-u,E=_-c,R=e-P;return h?jV(R,s-E):R}function b(_){var P=_-u,E=_-c;return u===void 0||P>=e||P<0||h&&E>=s}function S(){var _=DD();if(b(_))return A(_);a=setTimeout(S,g(_))}function A(_){return a=void 0,d&&n?f(_):(n=i=void 0,o)}function p(){a!==void 0&&clearTimeout(a),c=0,n=u=i=a=void 0}function y(){return a===void 0?o:A(DD())}function w(){var _=DD(),P=b(_);if(n=arguments,i=this,u=_,P){if(a===void 0)return m(u);if(h)return a=setTimeout(S,e),f(u)}return a===void 0&&(a=setTimeout(S,e)),o}return w.cancel=p,w.flush=y,w}function MV(t,e,r){var n=!0,i=!0;if(typeof t!="function")throw new TypeError(EO);return Wf(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),BV(t,e,{leading:n,maxWait:e,trailing:i})}function Wf(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function qV(t){return!!t&&typeof t=="object"}function UV(t){return typeof t=="symbol"||qV(t)&&$V.call(t)==AV}function vO(t){if(typeof t=="number")return t;if(UV(t))return bO;if(Wf(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Wf(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(OV,"");var r=TV.test(t);return r||FV.test(t)?IV(t.slice(2),r?2:8):xV.test(t)?bO:+t}_O.exports=MV});var kO=v(Zf=>{"use strict";Object.defineProperty(Zf,"__esModule",{value:!0});Zf.default=void 0;var HV=FO(require("http")),VV=FO(require("https")),OO=require("stream"),zV=require("url"),xO=GV(CO());function GV(t){return t&&t.__esModule?t:{default:t}}function TO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(TO=function(n){return n?r:e})(t)}function FO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=TO(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function KV(t,e,r){return e=Xf(e),WV(t,IO()?Reflect.construct(e,r||[],Xf(t).constructor):e.apply(t,r))}function WV(t,e){if(e&&(Go(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return XV(t)}function XV(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function IO(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(IO=function(){return!!t})()}function Xf(t){return Xf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Xf(t)}function YV(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&wD(t,e)}function wD(t,e){return wD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},wD(t,e)}function SO(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Hu(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?SO(Object(r),!0).forEach(function(n){JV(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):SO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function JV(t,e,r){return e=PO(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Go(t){"@babel/helpers - typeof";return Go=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Go(t)}function Yf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function AO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,PO(n.key),n)}}function Jf(t,e,r){return e&&AO(t.prototype,e),r&&AO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function PO(t){var e=ZV(t,"string");return Go(e)=="symbol"?e:e+""}function ZV(t,e){if(Go(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Go(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Rye=Zf.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Yf(this,t),this._requestOptions=e}return Jf(t,[{key:"createRequest",value:function(r,n){return new QV(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),QV=(function(){function t(e,r,n){Yf(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return Jf(t,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(r,n){this._headers[r]=n}},{key:"getHeader",value:function(r){return this._headers[r]}},{key:"setProgressHandler",value:function(r){this._progressHandler=r}},{key:"send",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(i,s){var o=Hu(Hu(Hu({},(0,zV.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:Hu(Hu({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(o.headers["Content-Length"]=n.size);var a=o.protocol==="https:"?VV:HV;r._request=a.request(o);var u=r._request;u.on("response",function(c){var l=[];c.on("data",function(h){l.push(h)}),c.on("end",function(){var h=Buffer.concat(l).toString("utf8");i(new ez(c,h))})}),u.on("error",function(c){s(c)}),n instanceof OO.Readable?n.pipe(new tz(r._progressHandler)).pipe(u):n instanceof Uint8Array?rz(u,n,r._progressHandler):u.end(n)})}},{key:"abort",value:function(){return this._request!==null&&this._request.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._request}}])})(),ez=(function(){function t(e,r){Yf(this,t),this._response=e,this._body=r}return Jf(t,[{key:"getStatus",value:function(){return this._response.statusCode}},{key:"getHeader",value:function(r){return this._response.headers[r.toLowerCase()]}},{key:"getBody",value:function(){return this._body}},{key:"getUnderlyingObject",value:function(){return this._response}}])})(),tz=(function(t){function e(r){var n;return Yf(this,e),n=KV(this,e),n._onprogress=(0,xO.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return YV(e,t),Jf(e,[{key:"_transform",value:function(n,i,s){this._position+=n.length,this._onprogress(this._position),s(null,n)}}])})(OO.Transform),rz=function(e,r,n){n=(0,xO.default)(n,100,{leading:!0,trailing:!1});var i=0;function s(){var o=Math.min(e.writableHighWaterMark,r.length-i),a=r.subarray(i,i+o);i+=a.length;var u=e.write(a);u?i<r.length?s():e.end():(e.once("drain",s),n(i))}s()}});var RO=v(bD=>{"use strict";bD.expectReceive=function(t,e,r){var n;r.root(t,e,r),n=this.message,t.hasOwnProperty("expected")&&(n+=" Expected "+t.expected+"."),t.hasOwnProperty("received")&&(n+=" Received: "+t.received+"."),this.message=n};bD.root=function(t,e,r){var n=this,i,s={stackLength:Error.stackTraceLimit,rootOnly:!0},o="",a=Error.stackTraceLimit,u;function c(){u[0]=n.toString(),n.stack=u.join(`
|
|
49
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{!s&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function ZA(t,e){if(t){if(typeof t=="string")return HA(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return HA(t,e)}}function HA(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function VA(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Vo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?VA(Object(r),!0).forEach(function(n){zH(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):VA(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function zH(t,e,r){return e=QA(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function GH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function zA(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,QA(n.key),n)}}function KH(t,e,r){return e&&zA(t.prototype,e),r&&zA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function QA(t){var e=WH(t,"string");return Ds(e)=="symbol"?e:e+""}function WH(t,e){if(Ds(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ds(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var qf="tus-v1",Uf="ietf-draft-03",Bu="ietf-draft-05",XH={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:tO,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null,protocol:qf},eO=(function(){function t(e,r){GH(this,t),"resume"in r&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=r,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=e,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}return KH(t,[{key:"findPreviousUploads",value:function(){var r=this;return this.options.fingerprint(this.file,this.options).then(function(n){return r._urlStorage.findUploadsByFingerprint(n)})}},{key:"resumeFromPreviousUpload",value:function(r){this.url=r.uploadUrl||null,this._parallelUploadUrls=r.parallelUploadUrls||null,this._urlStorageKey=r.urlStorageKey}},{key:"start",value:function(){var r=this,n=this.file;if(!n){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![qf,Uf,Bu].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var i=this.options.retryDelays;if(i!=null&&Object.prototype.toString.call(i)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var s=0,o=["uploadUrl","uploadSize","uploadLengthDeferred"];s<o.length;s++){var a=o[s];if(this.options[a]){this._emitError(new Error("tus: cannot use the ".concat(a," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(function(u){return u==null?(0,ys.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,ys.log)("Calculated fingerprint: ".concat(u)),r._fingerprint=u,r._source?r._source:r.options.fileReader.openFile(n,r.options.chunkSize)}).then(function(u){if(r._source=u,r.options.uploadLengthDeferred)r._size=null;else if(r.options.uploadSize!=null){if(r._size=Number(r.options.uploadSize),Number.isNaN(r._size)){r._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(r._size=r._source.size,r._size==null){r._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}r.options.parallelUploads>1||r._parallelUploadUrls!=null?r._startParallelUpload():r._startSingleUpload()}).catch(function(u){r._emitError(u)})}},{key:"_startParallelUpload",value:function(){var r,n=this,i=this._size,s=0;this._parallelUploads=[];var o=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,a=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:JH(this._source.size,o);this._parallelUploadUrls&&a.forEach(function(l,h){l.uploadUrl=n._parallelUploadUrls[h]||null}),this._parallelUploadUrls=new Array(a.length);var u=a.map(function(l,h){var d=0;return n._source.slice(l.start,l.end).then(function(f){var m=f.value;return new Promise(function(g,b){var S=Vo(Vo({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:Vo(Vo({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:g,onError:b,onProgress:function(D){s=s-d+D,d=D,n._emitProgress(s,i)},onUploadUrlAvailable:function(){n._parallelUploadUrls[h]=A.url,n._parallelUploadUrls.filter(function(D){return!!D}).length===a.length&&n._saveUploadInUrlStorage()}}),A=new t(m,S);A.start(),n._parallelUploads.push(A)})})}),c;Promise.all(u).then(function(){c=n._openRequest("POST",n.options.endpoint),c.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var l=GA(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!zo(l.getStatus(),200)){n._emitHttpError(c,l,"tus: unexpected response while creating upload");return}var h=l.getHeader("Location");if(h==null){n._emitHttpError(c,l,"tus: invalid or missing Location header");return}n.url=YA(n.options.endpoint,h),(0,ys.log)("Created upload at ".concat(n.url)),n._emitSuccess(l)}).catch(function(l){n._emitError(l)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){(0,ys.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,ys.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,ys.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var i=VH(this._parallelUploads),s;try{for(i.s();!(s=i.n()).done;){var o=s.value;o.abort(r)}}catch(a){i.e(a)}finally{i.f()}}return this._req!==null&&this._req.abort(),this._aborted=!0,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!r||this.url==null?Promise.resolve():t.terminate(this.url,this.options).then(function(){return n._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(r,n,i,s){this._emitError(new Mf.default(i,s,r,n))}},{key:"_emitError",value:function(r){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var i=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(i&&(this._retryAttempt=0),XA(r,this._retryAttempt,this.options)){var s=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){n.start()},s);return}}if(typeof this.options.onError=="function")this.options.onError(r);else throw r}}},{key:"_emitSuccess",value:function(r){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:r})}},{key:"_emitProgress",value:function(r,n){typeof this.options.onProgress=="function"&&this.options.onProgress(r,n)}},{key:"_emitChunkComplete",value:function(r,n,i){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(r,n,i)}},{key:"_createUpload",value:function(){var r=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var n=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?n.setHeader("Upload-Defer-Length","1"):n.setHeader("Upload-Length","".concat(this._size));var i=GA(this.options.metadata);i!==""&&n.setHeader("Upload-Metadata",i);var s;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,s=this._addChunkToRequest(n)):((this.options.protocol===Uf||this.options.protocol===Bu)&&n.setHeader("Upload-Complete","?0"),s=this._sendRequest(n,null)),s.then(function(o){if(!zo(o.getStatus(),200)){r._emitHttpError(n,o,"tus: unexpected response while creating upload");return}var a=o.getHeader("Location");if(a==null){r._emitHttpError(n,o,"tus: invalid or missing Location header");return}if(r.url=YA(r.options.endpoint,a),(0,ys.log)("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(o),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,o):(r._offset=0,r._performUpload())})}).catch(function(o){r._emitHttpError(n,null,"tus: failed to create upload",o)})}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),i=this._sendRequest(n,null);i.then(function(s){var o=s.getStatus();if(!zo(o,200)){if(o===423){r._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(zo(o,400)&&r._removeFromUrlStorage(),!r.options.endpoint){r._emitHttpError(n,s,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}r.url=null,r._createUpload();return}var a=Number.parseInt(s.getHeader("Upload-Offset"),10);if(Number.isNaN(a)){r._emitHttpError(n,s,"tus: invalid or missing offset value");return}var u=Number.parseInt(s.getHeader("Upload-Length"),10);if(Number.isNaN(u)&&!r.options.uploadLengthDeferred&&r.options.protocol===qf){r._emitHttpError(n,s,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(a===u){r._emitProgress(u,u),r._emitSuccess(s);return}r._offset=a,r._performUpload()})}).catch(function(s){r._emitHttpError(n,null,"tus: failed to resume upload",s)})}},{key:"_performUpload",value:function(){var r=this;if(!this._aborted){var n;this.options.overridePatchMethod?(n=this._openRequest("POST",this.url),n.setHeader("X-HTTP-Method-Override","PATCH")):n=this._openRequest("PATCH",this.url),n.setHeader("Upload-Offset","".concat(this._offset));var i=this._addChunkToRequest(n);i.then(function(s){if(!zo(s.getStatus(),200)){r._emitHttpError(n,s,"tus: unexpected response while uploading chunk");return}r._handleUploadResponse(n,s)}).catch(function(s){r._aborted||r._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(r._offset),s)})}}},{key:"_addChunkToRequest",value:function(r){var n=this,i=this._offset,s=this._offset+this.options.chunkSize;return r.setProgressHandler(function(o){n._emitProgress(i+o,n._size)}),this.options.protocol===qf?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Bu&&r.setHeader("Content-Type","application/partial-upload"),(s===Number.POSITIVE_INFINITY||s>this._size)&&!this.options.uploadLengthDeferred&&(s=this._size),this._source.slice(i,s).then(function(o){var a=o.value,u=o.done,c=a!=null&&a.size?a.size:0;n.options.uploadLengthDeferred&&u&&(n._size=n._offset+c,r.setHeader("Upload-Length","".concat(n._size)));var l=n._offset+c;return!n.options.uploadLengthDeferred&&u&&l!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(l," bytes"))):a===null?n._sendRequest(r):((n.options.protocol===Uf||n.options.protocol===Bu)&&r.setHeader("Upload-Complete",u?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,a))})}},{key:"_handleUploadResponse",value:function(r,n){var i=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(i)){this._emitHttpError(r,n,"tus: invalid or missing offset value");return}if(this._emitProgress(i,this._size),this._emitChunkComplete(i-this._offset,i,this._size),this._offset=i,i===this._size){this._emitSuccess(n),this._source.close();return}this._performUpload()}},{key:"_openRequest",value:function(r,n){var i=KA(r,n,this.options);return this._req=i,i}},{key:"_removeFromUrlStorage",value:function(){var r=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(n){r._emitError(n)}),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var r=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var n={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?n.parallelUploadUrls=this._parallelUploadUrls:n.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,n).then(function(i){r._urlStorageKey=i})}},{key:"_sendRequest",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return WA(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=KA("DELETE",r,n);return WA(i,null,n).then(function(s){if(s.getStatus()!==204)throw new Mf.default("tus: unexpected response while terminating upload",null,i,s)}).catch(function(s){if(s instanceof Mf.default||(s=new Mf.default("tus: failed to terminate upload",s,i,null)),!XA(s,0,n))throw s;var o=n.retryDelays[0],a=n.retryDelays.slice(1),u=Vo(Vo({},n),{},{retryDelays:a});return new Promise(function(c){return setTimeout(c,o)}).then(function(){return t.terminate(r,u)})})}}])})();function GA(t){return Object.entries(t).map(function(e){var r=JA(e,2),n=r[0],i=r[1];return"".concat(n," ").concat(LH.Base64.encode(String(i)))}).join(",")}function zo(t,e){return t>=e&&t<e+100}function KA(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===Uf?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Bu?n.setHeader("Upload-Draft-Interop-Version","6"):n.setHeader("Tus-Resumable","1.0.0");for(var i=r.headers||{},s=0,o=Object.entries(i);s<o.length;s++){var a=JA(o[s],2),u=a[0],c=a[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,BH.default)();n.setHeader("X-Request-ID",l)}return n}function WA(t,e,r){return lD.apply(this,arguments)}function lD(){return lD=MH(cD().mark(function t(e,r,n){var i;return cD().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(typeof n.onBeforeRequest!="function"){o.next=3;break}return o.next=3,n.onBeforeRequest(e);case 3:return o.next=5,e.send(r);case 5:if(i=o.sent,typeof n.onAfterResponse!="function"){o.next=9;break}return o.next=9,n.onAfterResponse(e,i);case 9:return o.abrupt("return",i);case 10:case"end":return o.stop()}},t)})),lD.apply(this,arguments)}function YH(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function XA(t,e,r){return r.retryDelays==null||e>=r.retryDelays.length||t.originalRequest==null?!1:r&&typeof r.onShouldRetry=="function"?r.onShouldRetry(t,e,r):tO(t)}function tO(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!zo(e,400)||e===409||e===423)&&YH()}function YA(t,e){return new jH.default(e,t).toString()}function JH(t,e){for(var r=Math.floor(t/e),n=[],i=0;i<e;i++)n.push({start:r*i,end:r*(i+1)});return n[e-1].end=t,n}eO.defaultOptions=XH;var _ye=Hf.default=eO});var iO=v((Sye,nO)=>{"use strict";var Dn=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";Dn.writable=t=>Dn(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";Dn.readable=t=>Dn(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";Dn.duplex=t=>Dn.writable(t)&&Dn.readable(t);Dn.transform=t=>Dn.duplex(t)&&typeof t._transform=="function";nO.exports=Dn});var oO=v(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});Vf.default=void 0;function Mu(t){"@babel/helpers - typeof";return Mu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mu(t)}function ZH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function sO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,eV(n.key),n)}}function QH(t,e,r){return e&&sO(t.prototype,e),r&&sO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function eV(t){var e=tV(t,"string");return Mu(e)=="symbol"?e:e+""}function tV(t,e){if(Mu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Mu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Aye=Vf.default=(function(){function t(e){ZH(this,t),this._buffer=e,this.size=e.length}return QH(t,[{key:"slice",value:function(r,n){var i=this._buffer.slice(r,n);i.size=i.length;var s=n>=this.size;return Promise.resolve({value:i,done:s})}},{key:"close",value:function(){}}])})()});var lO=v(pD=>{"use strict";Object.defineProperty(pD,"__esModule",{value:!0});pD.default=aV;var cO=require("fs");function ws(t){"@babel/helpers - typeof";return ws=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ws(t)}function hD(){"use strict";hD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(C,T,I){C[T]=I.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(C,T,I){return Object.defineProperty(C,T,{value:I,enumerable:!0,configurable:!0,writable:!0}),C[T]}try{c({},"")}catch{c=function(I,$,M){return I[$]=M}}function l(C,T,I,$){var M=T&&T.prototype instanceof S?T:S,B=Object.create(M.prototype),K=new G($||[]);return i(B,"_invoke",{value:k(C,I,K)}),B}function h(C,T,I){try{return{type:"normal",arg:C.call(T,I)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",g="completed",b={};function S(){}function A(){}function p(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,_=w&&w(w(L([])));_&&_!==r&&n.call(_,o)&&(D=_);var P=p.prototype=S.prototype=Object.create(D);function E(C){["next","throw","return"].forEach(function(T){c(C,T,function(I){return this._invoke(T,I)})})}function R(C,T){function I(M,B,K,q){var V=h(C[M],C,B);if(V.type!=="throw"){var ae=V.arg,x=ae.value;return x&&ws(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){I("next",O,K,q)},function(O){I("throw",O,K,q)}):T.resolve(x).then(function(O){ae.value=O,K(ae)},function(O){return I("throw",O,K,q)})}q(V.arg)}var $;i(this,"_invoke",{value:function(B,K){function q(){return new T(function(V,ae){I(B,K,V,ae)})}return $=$?$.then(q,q):q()}})}function k(C,T,I){var $=d;return function(M,B){if($===m)throw Error("Generator is already running");if($===g){if(M==="throw")throw B;return{value:t,done:!0}}for(I.method=M,I.arg=B;;){var K=I.delegate;if(K){var q=F(K,I);if(q){if(q===b)continue;return q}}if(I.method==="next")I.sent=I._sent=I.arg;else if(I.method==="throw"){if($===d)throw $=g,I.arg;I.dispatchException(I.arg)}else I.method==="return"&&I.abrupt("return",I.arg);$=m;var V=h(C,T,I);if(V.type==="normal"){if($=I.done?g:f,V.arg===b)continue;return{value:V.arg,done:I.done}}V.type==="throw"&&($=g,I.method="throw",I.arg=V.arg)}}}function F(C,T){var I=T.method,$=C.iterator[I];if($===t)return T.delegate=null,I==="throw"&&C.iterator.return&&(T.method="return",T.arg=t,F(C,T),T.method==="throw")||I!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+I+"' method")),b;var M=h($,C.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,b;var B=M.arg;return B?B.done?(T[C.resultName]=B.value,T.next=C.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,b):B:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,b)}function j(C){var T={tryLoc:C[0]};1 in C&&(T.catchLoc=C[1]),2 in C&&(T.finallyLoc=C[2],T.afterLoc=C[3]),this.tryEntries.push(T)}function U(C){var T=C.completion||{};T.type="normal",delete T.arg,C.completion=T}function G(C){this.tryEntries=[{tryLoc:"root"}],C.forEach(j,this),this.reset(!0)}function L(C){if(C||C===""){var T=C[o];if(T)return T.call(C);if(typeof C.next=="function")return C;if(!isNaN(C.length)){var I=-1,$=function M(){for(;++I<C.length;)if(n.call(C,I))return M.value=C[I],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(ws(C)+" is not iterable")}return A.prototype=p,i(P,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(C){var T=typeof C=="function"&&C.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(C){return Object.setPrototypeOf?Object.setPrototypeOf(C,p):(C.__proto__=p,c(C,u,"GeneratorFunction")),C.prototype=Object.create(P),C},e.awrap=function(C){return{__await:C}},E(R.prototype),c(R.prototype,a,function(){return this}),e.AsyncIterator=R,e.async=function(C,T,I,$,M){M===void 0&&(M=Promise);var B=new R(l(C,T,I,$),M);return e.isGeneratorFunction(T)?B:B.next().then(function(K){return K.done?K.value:B.next()})},E(P),c(P,u,"Generator"),c(P,o,function(){return this}),c(P,"toString",function(){return"[object Generator]"}),e.keys=function(C){var T=Object(C),I=[];for(var $ in T)I.push($);return I.reverse(),function M(){for(;I.length;){var B=I.pop();if(B in T)return M.value=B,M.done=!1,M}return M.done=!0,M}},e.values=L,G.prototype={constructor:G,reset:function(T){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(U),!T)for(var I in this)I.charAt(0)==="t"&&n.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=t)},stop:function(){this.done=!0;var T=this.tryEntries[0].completion;if(T.type==="throw")throw T.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var I=this;function $(ae,x){return K.type="throw",K.arg=T,I.next=ae,x&&(I.method="next",I.arg=t),!!x}for(var M=this.tryEntries.length-1;M>=0;--M){var B=this.tryEntries[M],K=B.completion;if(B.tryLoc==="root")return $("end");if(B.tryLoc<=this.prev){var q=n.call(B,"catchLoc"),V=n.call(B,"finallyLoc");if(q&&V){if(this.prev<B.catchLoc)return $(B.catchLoc,!0);if(this.prev<B.finallyLoc)return $(B.finallyLoc)}else if(q){if(this.prev<B.catchLoc)return $(B.catchLoc,!0)}else{if(!V)throw Error("try statement without catch or finally");if(this.prev<B.finallyLoc)return $(B.finallyLoc)}}}},abrupt:function(T,I){for(var $=this.tryEntries.length-1;$>=0;--$){var M=this.tryEntries[$];if(M.tryLoc<=this.prev&&n.call(M,"finallyLoc")&&this.prev<M.finallyLoc){var B=M;break}}B&&(T==="break"||T==="continue")&&B.tryLoc<=I&&I<=B.finallyLoc&&(B=null);var K=B?B.completion:{};return K.type=T,K.arg=I,B?(this.method="next",this.next=B.finallyLoc,b):this.complete(K)},complete:function(T,I){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&I&&(this.next=I),b},finish:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var $=this.tryEntries[I];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),U($),b}},catch:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var $=this.tryEntries[I];if($.tryLoc===T){var M=$.completion;if(M.type==="throw"){var B=M.arg;U($)}return B}}throw Error("illegal catch attempt")},delegateYield:function(T,I,$){return this.delegate={iterator:L(T),resultName:I,nextLoc:$},this.method==="next"&&(this.arg=t),b}},e}function rV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function aO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,iV(n.key),n)}}function nV(t,e,r){return e&&aO(t.prototype,e),r&&aO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function iV(t){var e=sV(t,"string");return ws(e)=="symbol"?e:e+""}function sV(t,e){if(ws(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ws(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function uO(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function oV(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){uO(s,n,i,o,a,"next",u)}function a(u){uO(s,n,i,o,a,"throw",u)}o(void 0)})}}function aV(t){return dD.apply(this,arguments)}function dD(){return dD=oV(hD().mark(function t(e){var r,n,i,s,o,a,u;return hD().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,cO.promises.stat(n);case 3:return i=l.sent,s=i.size,o=(r=e.start)!==null&&r!==void 0?r:0,a=Number.isFinite(e.end)?e.end+1:s,u=a-o,l.abrupt("return",new uV(e,n,u));case 9:case"end":return l.stop()}},t)})),dD.apply(this,arguments)}var uV=(function(){function t(e,r,n){rV(this,t),this._stream=e,this._path=r,this.size=n}return nV(t,[{key:"slice",value:function(r,n){var i,s=(i=this._stream.start)!==null&&i!==void 0?i:0,o=(0,cO.createReadStream)(this._path,{start:s+r,end:s+n-1,autoClose:!0});o.size=Math.min(n-r,this.size);var a=o.size>=this.size;return Promise.resolve({value:o,done:a})}},{key:"close",value:function(){this._stream.destroy()}}])})()});var gD=v(zf=>{"use strict";Object.defineProperty(zf,"__esModule",{value:!0});zf.default=void 0;function bs(t){"@babel/helpers - typeof";return bs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bs(t)}function qu(){"use strict";qu=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(C,T,I){C[T]=I.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(C,T,I){return Object.defineProperty(C,T,{value:I,enumerable:!0,configurable:!0,writable:!0}),C[T]}try{c({},"")}catch{c=function(I,$,M){return I[$]=M}}function l(C,T,I,$){var M=T&&T.prototype instanceof S?T:S,B=Object.create(M.prototype),K=new G($||[]);return i(B,"_invoke",{value:k(C,I,K)}),B}function h(C,T,I){try{return{type:"normal",arg:C.call(T,I)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",g="completed",b={};function S(){}function A(){}function p(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,_=w&&w(w(L([])));_&&_!==r&&n.call(_,o)&&(D=_);var P=p.prototype=S.prototype=Object.create(D);function E(C){["next","throw","return"].forEach(function(T){c(C,T,function(I){return this._invoke(T,I)})})}function R(C,T){function I(M,B,K,q){var V=h(C[M],C,B);if(V.type!=="throw"){var ae=V.arg,x=ae.value;return x&&bs(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){I("next",O,K,q)},function(O){I("throw",O,K,q)}):T.resolve(x).then(function(O){ae.value=O,K(ae)},function(O){return I("throw",O,K,q)})}q(V.arg)}var $;i(this,"_invoke",{value:function(B,K){function q(){return new T(function(V,ae){I(B,K,V,ae)})}return $=$?$.then(q,q):q()}})}function k(C,T,I){var $=d;return function(M,B){if($===m)throw Error("Generator is already running");if($===g){if(M==="throw")throw B;return{value:t,done:!0}}for(I.method=M,I.arg=B;;){var K=I.delegate;if(K){var q=F(K,I);if(q){if(q===b)continue;return q}}if(I.method==="next")I.sent=I._sent=I.arg;else if(I.method==="throw"){if($===d)throw $=g,I.arg;I.dispatchException(I.arg)}else I.method==="return"&&I.abrupt("return",I.arg);$=m;var V=h(C,T,I);if(V.type==="normal"){if($=I.done?g:f,V.arg===b)continue;return{value:V.arg,done:I.done}}V.type==="throw"&&($=g,I.method="throw",I.arg=V.arg)}}}function F(C,T){var I=T.method,$=C.iterator[I];if($===t)return T.delegate=null,I==="throw"&&C.iterator.return&&(T.method="return",T.arg=t,F(C,T),T.method==="throw")||I!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+I+"' method")),b;var M=h($,C.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,b;var B=M.arg;return B?B.done?(T[C.resultName]=B.value,T.next=C.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,b):B:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,b)}function j(C){var T={tryLoc:C[0]};1 in C&&(T.catchLoc=C[1]),2 in C&&(T.finallyLoc=C[2],T.afterLoc=C[3]),this.tryEntries.push(T)}function U(C){var T=C.completion||{};T.type="normal",delete T.arg,C.completion=T}function G(C){this.tryEntries=[{tryLoc:"root"}],C.forEach(j,this),this.reset(!0)}function L(C){if(C||C===""){var T=C[o];if(T)return T.call(C);if(typeof C.next=="function")return C;if(!isNaN(C.length)){var I=-1,$=function M(){for(;++I<C.length;)if(n.call(C,I))return M.value=C[I],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(bs(C)+" is not iterable")}return A.prototype=p,i(P,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(C){var T=typeof C=="function"&&C.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(C){return Object.setPrototypeOf?Object.setPrototypeOf(C,p):(C.__proto__=p,c(C,u,"GeneratorFunction")),C.prototype=Object.create(P),C},e.awrap=function(C){return{__await:C}},E(R.prototype),c(R.prototype,a,function(){return this}),e.AsyncIterator=R,e.async=function(C,T,I,$,M){M===void 0&&(M=Promise);var B=new R(l(C,T,I,$),M);return e.isGeneratorFunction(T)?B:B.next().then(function(K){return K.done?K.value:B.next()})},E(P),c(P,u,"Generator"),c(P,o,function(){return this}),c(P,"toString",function(){return"[object Generator]"}),e.keys=function(C){var T=Object(C),I=[];for(var $ in T)I.push($);return I.reverse(),function M(){for(;I.length;){var B=I.pop();if(B in T)return M.value=B,M.done=!1,M}return M.done=!0,M}},e.values=L,G.prototype={constructor:G,reset:function(T){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(U),!T)for(var I in this)I.charAt(0)==="t"&&n.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=t)},stop:function(){this.done=!0;var T=this.tryEntries[0].completion;if(T.type==="throw")throw T.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var I=this;function $(ae,x){return K.type="throw",K.arg=T,I.next=ae,x&&(I.method="next",I.arg=t),!!x}for(var M=this.tryEntries.length-1;M>=0;--M){var B=this.tryEntries[M],K=B.completion;if(B.tryLoc==="root")return $("end");if(B.tryLoc<=this.prev){var q=n.call(B,"catchLoc"),V=n.call(B,"finallyLoc");if(q&&V){if(this.prev<B.catchLoc)return $(B.catchLoc,!0);if(this.prev<B.finallyLoc)return $(B.finallyLoc)}else if(q){if(this.prev<B.catchLoc)return $(B.catchLoc,!0)}else{if(!V)throw Error("try statement without catch or finally");if(this.prev<B.finallyLoc)return $(B.finallyLoc)}}}},abrupt:function(T,I){for(var $=this.tryEntries.length-1;$>=0;--$){var M=this.tryEntries[$];if(M.tryLoc<=this.prev&&n.call(M,"finallyLoc")&&this.prev<M.finallyLoc){var B=M;break}}B&&(T==="break"||T==="continue")&&B.tryLoc<=I&&I<=B.finallyLoc&&(B=null);var K=B?B.completion:{};return K.type=T,K.arg=I,B?(this.method="next",this.next=B.finallyLoc,b):this.complete(K)},complete:function(T,I){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&I&&(this.next=I),b},finish:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var $=this.tryEntries[I];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),U($),b}},catch:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var $=this.tryEntries[I];if($.tryLoc===T){var M=$.completion;if(M.type==="throw"){var B=M.arg;U($)}return B}}throw Error("illegal catch attempt")},delegateYield:function(T,I,$){return this.delegate={iterator:L(T),resultName:I,nextLoc:$},this.method==="next"&&(this.arg=t),b}},e}function cV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function fO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fV(n.key),n)}}function lV(t,e,r){return e&&fO(t.prototype,e),r&&fO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function fV(t){var e=hV(t,"string");return bs(e)=="symbol"?e:e+""}function hV(t,e){if(bs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(bs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function hO(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function dO(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){hO(s,n,i,o,a,"next",u)}function a(u){hO(s,n,i,o,a,"throw",u)}o(void 0)})}}function dV(t,e){return mD.apply(this,arguments)}function mD(){return mD=dO(qu().mark(function t(e,r){return qu().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",new Promise(function(s,o){var a=function(l){e.off("readable",u),o(l)},u=function c(){var l=e.read(r);l!==null&&(e.off("error",a),e.off("readable",c),s(l))};e.once("error",a),e.on("readable",u)}));case 1:case"end":return i.stop()}},t)})),mD.apply(this,arguments)}var Tye=zf.default=(function(){function t(e){var r=this;cV(this,t),this._stream=e,this.size=null,this._buf=Buffer.alloc(0),this._bufPos=0,this._ended=!1,this._error=null,e.pause(),e.on("end",function(){r._ended=!0}),e.on("error",function(n){r._error=n})}return lV(t,[{key:"slice",value:(function(){var e=dO(qu().mark(function n(i,s){var o,a,u,c,l;return qu().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(!(i<this._bufPos)){d.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(i>this._bufPos+this._buf.length)){d.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){d.next=6;break}throw this._error;case 6:if(i<this._bufPos+this._buf.length?(a=i-this._bufPos,u=Math.min(this._buf.length,s-this._bufPos),o=this._buf.slice(a,u)):o=Buffer.alloc(0),!this._ended){d.next=10;break}return o.size=o.length,d.abrupt("return",{value:o,done:!0});case 10:if(c=s-i,!(c>o.length)){d.next=16;break}return d.next=14,dV(this._stream,c-o.length);case 14:l=d.sent,o=Buffer.concat([o,l]);case 16:return this._buf=o,this._bufPos=i,o.size=o.length,d.abrupt("return",{value:o,done:this._ended});case 20:case"end":return d.stop()}},n,this)}));function r(n,i){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var mO=v(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.default=void 0;var pV=require("fs"),mV=Gf(iO()),gV=Gf(oO()),yV=Gf(lO()),DV=Gf(gD());function Gf(t){return t&&t.__esModule?t:{default:t}}function Uu(t){"@babel/helpers - typeof";return Uu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uu(t)}function wV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,vV(n.key),n)}}function bV(t,e,r){return e&&pO(t.prototype,e),r&&pO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function vV(t){var e=EV(t,"string");return Uu(e)=="symbol"?e:e+""}function EV(t,e){if(Uu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Uu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Iye=Kf.default=(function(){function t(){wV(this,t)}return bV(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new gV.default(r)):r instanceof pV.ReadStream&&r.path!=null?(0,yV.default)(r):mV.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new DV.default(r)):Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option; specify a chunkSize to control the memory consumption"))):Promise.reject(new Error("source object may only be an instance of Buffer or Readable in this environment"))}}])})()});var wO=v(yD=>{"use strict";Object.defineProperty(yD,"__esModule",{value:!0});yD.default=SV;var _V=require("crypto"),gO=DO(require("fs")),CV=DO(require("path"));function yO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(yO=function(n){return n?r:e})(t)}function DO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=yO(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function SV(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),i=(0,_V.createHash)("md5").update(n).digest("hex"),s=["node-buffer",i,t.length,e.endpoint].join("-");return Promise.resolve(s)}return t instanceof gO.ReadStream&&t.path!=null?new Promise(function(o,a){var u=CV.resolve(t.path);gO.stat(t.path,function(c,l){if(c){a(c);return}var h=["node-file",u,l.size,l.mtime.getTime(),e.endpoint].join("-");o(h)})}):Promise.resolve(null)}});var CO=v((Rye,_O)=>{var EO="Expected a function",bO=NaN,AV="[object Symbol]",OV=/^\s+|\s+$/g,xV=/^[-+]0x[0-9a-f]+$/i,TV=/^0b[01]+$/i,FV=/^0o[0-7]+$/i,IV=parseInt,PV=typeof global=="object"&&global&&global.Object===Object&&global,kV=typeof self=="object"&&self&&self.Object===Object&&self,RV=PV||kV||Function("return this")(),NV=Object.prototype,$V=NV.toString,LV=Math.max,jV=Math.min,DD=function(){return RV.Date.now()};function BV(t,e,r){var n,i,s,o,a,u,c=0,l=!1,h=!1,d=!0;if(typeof t!="function")throw new TypeError(EO);e=vO(e)||0,Wf(r)&&(l=!!r.leading,h="maxWait"in r,s=h?LV(vO(r.maxWait)||0,e):s,d="trailing"in r?!!r.trailing:d);function f(_){var P=n,E=i;return n=i=void 0,c=_,o=t.apply(E,P),o}function m(_){return c=_,a=setTimeout(S,e),l?f(_):o}function g(_){var P=_-u,E=_-c,R=e-P;return h?jV(R,s-E):R}function b(_){var P=_-u,E=_-c;return u===void 0||P>=e||P<0||h&&E>=s}function S(){var _=DD();if(b(_))return A(_);a=setTimeout(S,g(_))}function A(_){return a=void 0,d&&n?f(_):(n=i=void 0,o)}function p(){a!==void 0&&clearTimeout(a),c=0,n=u=i=a=void 0}function D(){return a===void 0?o:A(DD())}function w(){var _=DD(),P=b(_);if(n=arguments,i=this,u=_,P){if(a===void 0)return m(u);if(h)return a=setTimeout(S,e),f(u)}return a===void 0&&(a=setTimeout(S,e)),o}return w.cancel=p,w.flush=D,w}function MV(t,e,r){var n=!0,i=!0;if(typeof t!="function")throw new TypeError(EO);return Wf(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),BV(t,e,{leading:n,maxWait:e,trailing:i})}function Wf(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function qV(t){return!!t&&typeof t=="object"}function UV(t){return typeof t=="symbol"||qV(t)&&$V.call(t)==AV}function vO(t){if(typeof t=="number")return t;if(UV(t))return bO;if(Wf(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Wf(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(OV,"");var r=TV.test(t);return r||FV.test(t)?IV(t.slice(2),r?2:8):xV.test(t)?bO:+t}_O.exports=MV});var kO=v(Zf=>{"use strict";Object.defineProperty(Zf,"__esModule",{value:!0});Zf.default=void 0;var HV=FO(require("http")),VV=FO(require("https")),OO=require("stream"),zV=require("url"),xO=GV(CO());function GV(t){return t&&t.__esModule?t:{default:t}}function TO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(TO=function(n){return n?r:e})(t)}function FO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=TO(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function KV(t,e,r){return e=Xf(e),WV(t,IO()?Reflect.construct(e,r||[],Xf(t).constructor):e.apply(t,r))}function WV(t,e){if(e&&(Go(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return XV(t)}function XV(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function IO(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(IO=function(){return!!t})()}function Xf(t){return Xf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Xf(t)}function YV(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&wD(t,e)}function wD(t,e){return wD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},wD(t,e)}function SO(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Hu(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?SO(Object(r),!0).forEach(function(n){JV(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):SO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function JV(t,e,r){return e=PO(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Go(t){"@babel/helpers - typeof";return Go=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Go(t)}function Yf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function AO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,PO(n.key),n)}}function Jf(t,e,r){return e&&AO(t.prototype,e),r&&AO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function PO(t){var e=ZV(t,"string");return Go(e)=="symbol"?e:e+""}function ZV(t,e){if(Go(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Go(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Nye=Zf.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Yf(this,t),this._requestOptions=e}return Jf(t,[{key:"createRequest",value:function(r,n){return new QV(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),QV=(function(){function t(e,r,n){Yf(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return Jf(t,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(r,n){this._headers[r]=n}},{key:"getHeader",value:function(r){return this._headers[r]}},{key:"setProgressHandler",value:function(r){this._progressHandler=r}},{key:"send",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(i,s){var o=Hu(Hu(Hu({},(0,zV.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:Hu(Hu({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(o.headers["Content-Length"]=n.size);var a=o.protocol==="https:"?VV:HV;r._request=a.request(o);var u=r._request;u.on("response",function(c){var l=[];c.on("data",function(h){l.push(h)}),c.on("end",function(){var h=Buffer.concat(l).toString("utf8");i(new ez(c,h))})}),u.on("error",function(c){s(c)}),n instanceof OO.Readable?n.pipe(new tz(r._progressHandler)).pipe(u):n instanceof Uint8Array?rz(u,n,r._progressHandler):u.end(n)})}},{key:"abort",value:function(){return this._request!==null&&this._request.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._request}}])})(),ez=(function(){function t(e,r){Yf(this,t),this._response=e,this._body=r}return Jf(t,[{key:"getStatus",value:function(){return this._response.statusCode}},{key:"getHeader",value:function(r){return this._response.headers[r.toLowerCase()]}},{key:"getBody",value:function(){return this._body}},{key:"getUnderlyingObject",value:function(){return this._response}}])})(),tz=(function(t){function e(r){var n;return Yf(this,e),n=KV(this,e),n._onprogress=(0,xO.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return YV(e,t),Jf(e,[{key:"_transform",value:function(n,i,s){this._position+=n.length,this._onprogress(this._position),s(null,n)}}])})(OO.Transform),rz=function(e,r,n){n=(0,xO.default)(n,100,{leading:!0,trailing:!1});var i=0;function s(){var o=Math.min(e.writableHighWaterMark,r.length-i),a=r.subarray(i,i+o);i+=a.length;var u=e.write(a);u?i<r.length?s():e.end():(e.once("drain",s),n(i))}s()}});var RO=v(bD=>{"use strict";bD.expectReceive=function(t,e,r){var n;r.root(t,e,r),n=this.message,t.hasOwnProperty("expected")&&(n+=" Expected "+t.expected+"."),t.hasOwnProperty("received")&&(n+=" Received: "+t.received+"."),this.message=n};bD.root=function(t,e,r){var n=this,i,s={stackLength:Error.stackTraceLimit,rootOnly:!0},o="",a=Error.stackTraceLimit,u;function c(){u[0]=n.toString(),n.stack=u.join(`
|
|
50
50
|
`)}(!e||typeof e!="object")&&(e={}),e.hasOwnProperty("stackLength")&&typeof e.stackLength=="number"&&!isNaN(e.stackLength)&&e.stackLength>=0&&(s.stackLength=e.stackLength),e.hasOwnProperty("rootOnly")||(s.rootOnly=e.rootOnly),(!s.rootOnly||this.CustomError.parent===Error)&&(Object.keys(t).forEach(function(l){switch(l){case"code":i=t.code||void 0;break;case"message":o=t.message||"";break;default:n[l]=t[l]}}),Error.stackTraceLimit=s.stackLength+2,u=new Error().stack.split(`
|
|
51
51
|
`),u.splice(0,3),u.unshift(""),Error.stackTraceLimit=a,this.stack=u.join(`
|
|
52
|
-
`),Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,get:function(){return i},set:function(l){i=l,c()}}),Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,get:function(){return o},set:function(l){o=l,c()}}),c())}});var LO=v((Lye,$O)=>{"use strict";$O.exports=vs;vs.factory=RO();var _D=vs("CustomError");_D.order=vs(_D,{message:"Arguments out of order.",code:"EOARG"});function vs(t,e,r,n){var i,s;return e=Qf(arguments,1,Error,NO,[vD,eh]),r=Qf(arguments,2,{},vD,[eh]),n=Qf(arguments,3,ED,eh,[]),t=Qf(arguments,0,e===Error?"Error":e.prototype.CustomError.name,nz,[NO,vD,eh]),s=e===Error,s&&n===ED&&(n=vs.factory.root),i=function(o,a){var u,c,l,h,d,f;if(!(this instanceof i))return new i(o,a);for(delete this.constructor.name,Object.defineProperty(this.constructor,"name",{enumerable:!1,configurable:!0,value:t,writable:!1}),typeof o=="string"&&(o={message:o}),o||(o={}),c=this.CustomError.chain.slice(0).reverse().map(function(m){return m.properties}),c.push(o),c.unshift({}),f=Object.assign.apply(Object,c),u=this,l={},Object.keys(vs.factory).forEach(function(m){l[m]=function(g,b){vs.factory[m].call(u,g,b,l)}}),h=this.CustomError.chain.length-1;h>=0;h--)d=this.CustomError.chain[h],d.factory!==ED&&d.factory.call(this,f,a,l)},i.prototype=Object.create(e.prototype),i.prototype.constructor=i,i.prototype.name=t,i.prototype.CustomError={chain:s?[]:e.prototype.CustomError.chain.slice(0),factory:n,name:t,parent:e,properties:r},i.prototype.CustomError.chain.unshift(i.prototype.CustomError),i.prototype.toString=function(){var o=this.CustomError.chain[this.CustomError.chain.length-1].name;return this.code&&(o+=" "+this.code),this.message&&(o+=": "+this.message),o},i}function Qf(t,e,r,n,i){var s=-1,o=-1,a,u,c=e<t.length?e:t.length,l;for(a=0;a<=c;a++){if(l=t[a],s===-1)for(u=0;u<i.length;u++)i[u](l)&&(s=a);o===-1&&n(l)&&(o=a)}if(o!==-1&&s!==-1&&s<o)throw new _D.order;return o!==-1?t[o]:r}function eh(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function nz(t){return typeof t=="string"}function NO(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function vD(t){return t&&typeof t=="object"}function ED(){}});var BO=v((jye,jO)=>{jO.exports=LO()});var VO=v((Es,Ko)=>{var iz=1/0,sz="[object Symbol]",Vu={function:!0,object:!0},oz=Vu[typeof Es]&&Es&&!Es.nodeType?Es:void 0,az=Vu[typeof Ko]&&Ko&&!Ko.nodeType?Ko:void 0,uz=th(oz&&az&&typeof global=="object"&&global),cz=th(Vu[typeof self]&&self),MO=th(Vu[typeof window]&&window),CD=th(Vu[typeof Es]&&Es),lz=uz||MO!==(CD&&CD.window)&&MO||cz||CD||Function("return this")();function th(t){return t&&t.Object===Object?t:null}var fz=Object.prototype,hz=fz.toString,qO=lz.Symbol,UO=qO?qO.prototype:void 0,HO=UO?UO.toString:void 0;function dz(t){if(typeof t=="string")return t;if(mz(t))return HO?HO.call(t):"";var e=t+"";return e=="0"&&1/t==-iz?"-0":e}function pz(t){return!!t&&typeof t=="object"}function mz(t){return typeof t=="symbol"||pz(t)&&hz.call(t)==sz}Ko.exports=dz});var JO=v((_s,Wo)=>{var gz=VO(),yz="Expected a function",GO="__lodash_hash_undefined__",Dz="[object Function]",wz="[object GeneratorFunction]",bz=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,vz=/[\\^$.*+?()[\]{}|]/g,Ez=/\\(\\)?/g,_z=/^\[object .+?Constructor\]$/,Gu={function:!0,object:!0},Cz=Gu[typeof _s]&&_s&&!_s.nodeType?_s:void 0,Sz=Gu[typeof Wo]&&Wo&&!Wo.nodeType?Wo:void 0,Az=rh(Cz&&Sz&&typeof global=="object"&&global),Oz=rh(Gu[typeof self]&&self),zO=rh(Gu[typeof window]&&window),SD=rh(Gu[typeof _s]&&_s),xz=Az||zO!==(SD&&SD.window)&&zO||Oz||SD||Function("return this")();function rh(t){return t&&t.Object===Object?t:null}function Tz(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var Fz=Array.prototype,KO=Object.prototype,WO=Function.prototype.toString,AD=KO.hasOwnProperty,Iz=KO.toString,Pz=RegExp("^"+WO.call(AD).replace(vz,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kz=Fz.splice,Rz=XO(xz,"Map"),zu=XO(Object,"create");function Cs(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Nz(){this.__data__=zu?zu(null):{}}function $z(t){return this.has(t)&&delete this.__data__[t]}function Lz(t){var e=this.__data__;if(zu){var r=e[t];return r===GO?void 0:r}return AD.call(e,t)?e[t]:void 0}function jz(t){var e=this.__data__;return zu?e[t]!==void 0:AD.call(e,t)}function Bz(t,e){var r=this.__data__;return r[t]=zu&&e===void 0?GO:e,this}Cs.prototype.clear=Nz;Cs.prototype.delete=$z;Cs.prototype.get=Lz;Cs.prototype.has=jz;Cs.prototype.set=Bz;function Xo(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Mz(){this.__data__=[]}function qz(t){var e=this.__data__,r=nh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():kz.call(e,r,1),!0}function Uz(t){var e=this.__data__,r=nh(e,t);return r<0?void 0:e[r][1]}function Hz(t){return nh(this.__data__,t)>-1}function Vz(t,e){var r=this.__data__,n=nh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Xo.prototype.clear=Mz;Xo.prototype.delete=qz;Xo.prototype.get=Uz;Xo.prototype.has=Hz;Xo.prototype.set=Vz;function Ss(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function zz(){this.__data__={hash:new Cs,map:new(Rz||Xo),string:new Cs}}function Gz(t){return ih(this,t).delete(t)}function Kz(t){return ih(this,t).get(t)}function Wz(t){return ih(this,t).has(t)}function Xz(t,e){return ih(this,t).set(t,e),this}Ss.prototype.clear=zz;Ss.prototype.delete=Gz;Ss.prototype.get=Kz;Ss.prototype.has=Wz;Ss.prototype.set=Xz;function nh(t,e){for(var r=t.length;r--;)if(Qz(t[r][0],e))return r;return-1}function ih(t,e){var r=t.__data__;return Yz(e)?r[typeof e=="string"?"string":"hash"]:r.map}function XO(t,e){var r=t[e];return tG(r)?r:void 0}function Yz(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Jz=OD(function(t){var e=[];return rG(t).replace(bz,function(r,n,i,s){e.push(i?s.replace(Ez,"$1"):n||r)}),e});function Zz(t){if(t!=null){try{return WO.call(t)}catch{}try{return t+""}catch{}}return""}function OD(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(yz);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=t.apply(this,n);return r.cache=s.set(i,o),o};return r.cache=new(OD.Cache||Ss),r}OD.Cache=Ss;function Qz(t,e){return t===e||t!==t&&e!==e}function eG(t){var e=YO(t)?Iz.call(t):"";return e==Dz||e==wz}function YO(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function tG(t){if(!YO(t))return!1;var e=eG(t)||Tz(t)?Pz:_z;return e.test(Zz(t))}function rG(t){return t==null?"":gz(t)}Wo.exports=Jz});var Ox=v((As,Jo)=>{var nG=JO(),iG=200,jD="__lodash_hash_undefined__",ch=1,Zo=2,sG=1/0,nx=9007199254740991,sh="[object Arguments]",FD="[object Array]",ix="[object Boolean]",sx="[object Date]",ox="[object Error]",ax="[object Function]",oG="[object GeneratorFunction]",Ku="[object Map]",ux="[object Number]",Yo="[object Object]",ZO="[object Promise]",cx="[object RegExp]",Wu="[object Set]",BD="[object String]",lx="[object Symbol]",ID="[object WeakMap]",fx="[object ArrayBuffer]",oh="[object DataView]",aG="[object Float32Array]",uG="[object Float64Array]",cG="[object Int8Array]",lG="[object Int16Array]",fG="[object Int32Array]",hG="[object Uint8Array]",dG="[object Uint8ClampedArray]",pG="[object Uint16Array]",mG="[object Uint32Array]",gG=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,yG=/^\w*$/,DG=/[\\^$.*+?()[\]{}|]/g,wG=/^\[object .+?Constructor\]$/,bG=/^(?:0|[1-9]\d*)$/,Je={};Je[aG]=Je[uG]=Je[cG]=Je[lG]=Je[fG]=Je[hG]=Je[dG]=Je[pG]=Je[mG]=!0;Je[sh]=Je[FD]=Je[fx]=Je[ix]=Je[oh]=Je[sx]=Je[ox]=Je[ax]=Je[Ku]=Je[ux]=Je[Yo]=Je[cx]=Je[Wu]=Je[BD]=Je[ID]=!1;var Yu={function:!0,object:!0},vG=Yu[typeof As]&&As&&!As.nodeType?As:void 0,EG=Yu[typeof Jo]&&Jo&&!Jo.nodeType?Jo:void 0,_G=lh(vG&&EG&&typeof global=="object"&&global),CG=lh(Yu[typeof self]&&self),QO=lh(Yu[typeof window]&&window),xD=lh(Yu[typeof As]&&As),Ts=_G||QO!==(xD&&xD.window)&&QO||CG||xD||Function("return this")();function SG(t,e){for(var r=-1,n=t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function AG(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function OG(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function xG(t,e){return SG(e,function(r){return[r,t[r]]})}function lh(t){return t&&t.Object===Object?t:null}function PD(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function hx(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}function TG(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function FG(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var IG=Array.prototype,fh=Object.prototype,dx=Function.prototype.toString,Os=fh.hasOwnProperty,Fs=fh.toString,PG=RegExp("^"+dx.call(Os).replace(DG,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ex=Ts.Symbol,tx=Ts.Uint8Array,kG=fh.propertyIsEnumerable,RG=IG.splice,NG=Object.getPrototypeOf,$G=Object.keys,kD=Qo(Ts,"DataView"),ah=Qo(Ts,"Map"),RD=Qo(Ts,"Promise"),ND=Qo(Ts,"Set"),$D=Qo(Ts,"WeakMap"),Xu=Qo(Object,"create"),LG=Ps(kD),jG=Ps(ah),BG=Ps(RD),MG=Ps(ND),qG=Ps($D),rx=ex?ex.prototype:void 0,TD=rx?rx.valueOf:void 0;function xs(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function UG(){this.__data__=Xu?Xu(null):{}}function HG(t){return this.has(t)&&delete this.__data__[t]}function VG(t){var e=this.__data__;if(Xu){var r=e[t];return r===jD?void 0:r}return Os.call(e,t)?e[t]:void 0}function zG(t){var e=this.__data__;return Xu?e[t]!==void 0:Os.call(e,t)}function GG(t,e){var r=this.__data__;return r[t]=Xu&&e===void 0?jD:e,this}xs.prototype.clear=UG;xs.prototype.delete=HG;xs.prototype.get=VG;xs.prototype.has=zG;xs.prototype.set=GG;function Wn(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function KG(){this.__data__=[]}function WG(t){var e=this.__data__,r=hh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():RG.call(e,r,1),!0}function XG(t){var e=this.__data__,r=hh(e,t);return r<0?void 0:e[r][1]}function YG(t){return hh(this.__data__,t)>-1}function JG(t,e){var r=this.__data__,n=hh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Wn.prototype.clear=KG;Wn.prototype.delete=WG;Wn.prototype.get=XG;Wn.prototype.has=YG;Wn.prototype.set=JG;function Is(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function ZG(){this.__data__={hash:new xs,map:new(ah||Wn),string:new xs}}function QG(t){return dh(this,t).delete(t)}function eK(t){return dh(this,t).get(t)}function tK(t){return dh(this,t).has(t)}function rK(t,e){return dh(this,t).set(t,e),this}Is.prototype.clear=ZG;Is.prototype.delete=QG;Is.prototype.get=eK;Is.prototype.has=tK;Is.prototype.set=rK;function uh(t){var e=-1,r=t?t.length:0;for(this.__data__=new Is;++e<r;)this.add(t[e])}function nK(t){return this.__data__.set(t,jD),this}function iK(t){return this.__data__.has(t)}uh.prototype.add=uh.prototype.push=nK;uh.prototype.has=iK;function Kn(t){this.__data__=new Wn(t)}function sK(){this.__data__=new Wn}function oK(t){return this.__data__.delete(t)}function aK(t){return this.__data__.get(t)}function uK(t){return this.__data__.has(t)}function cK(t,e){var r=this.__data__;return r instanceof Wn&&r.__data__.length==iG&&(r=this.__data__=new Is(r.__data__)),r.set(t,e),this}Kn.prototype.clear=sK;Kn.prototype.delete=oK;Kn.prototype.get=aK;Kn.prototype.has=uK;Kn.prototype.set=cK;function hh(t,e){for(var r=t.length;r--;)if(xK(t[r][0],e))return r;return-1}function px(t,e){e=ph(e,t)?[e]:yx(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[mh(e[r++])];return r&&r==n?t:void 0}function mx(t,e){return Os.call(t,e)||typeof t=="object"&&e in t&&_K(t)===null}function lK(t,e){return e in Object(t)}function MD(t,e,r,n,i){return t===e?!0:t==null||e==null||!yh(t)&&!Ju(e)?t!==t&&e!==e:fK(t,e,MD,r,n,i)}function fK(t,e,r,n,i,s){var o=Ti(t),a=Ti(e),u=FD,c=FD;o||(u=Gn(t),u=u==sh?Yo:u),a||(c=Gn(e),c=c==sh?Yo:c);var l=u==Yo&&!PD(t),h=c==Yo&&!PD(e),d=u==c;if(d&&!l)return s||(s=new Kn),o||IK(t)?Dx(t,e,r,n,i,s):wK(t,e,u,r,n,i,s);if(!(i&Zo)){var f=l&&Os.call(t,"__wrapped__"),m=h&&Os.call(e,"__wrapped__");if(f||m){var g=f?t.value():t,b=m?e.value():e;return s||(s=new Kn),r(g,b,n,i,s)}}return d?(s||(s=new Kn),bK(t,e,r,n,i,s)):!1}function hK(t,e,r,n){var i=r.length,s=i,o=!n;if(t==null)return!s;for(t=Object(t);i--;){var a=r[i];if(o&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<s;){a=r[i];var u=a[0],c=t[u],l=a[1];if(o&&a[2]){if(c===void 0&&!(u in t))return!1}else{var h=new Kn;if(n)var d=n(c,l,u,t,e,h);if(!(d===void 0?MD(l,c,n,ch|Zo,h):d))return!1}}return!0}function dK(t){return typeof t=="function"?t:t==null?NK:typeof t=="object"?Ti(t)?gK(t[0],t[1]):mK(t):$K(t)}function pK(t){return $G(Object(t))}function mK(t){var e=EK(t);return e.length==1&&e[0][2]?vx(e[0][0],e[0][1]):function(r){return r===t||hK(r,t,e)}}function gK(t,e){return ph(t)&&bx(e)?vx(mh(t),e):function(r){var n=PK(r,t);return n===void 0&&n===e?kK(r,t):MD(e,n,void 0,ch|Zo)}}function gx(t){return function(e){return e?.[t]}}function yK(t){return function(e){return px(e,t)}}function yx(t){return Ti(t)?t:nG(t)}function DK(t){return function(e){var r=Gn(e);return r==Ku?hx(e):r==Wu?FG(e):xG(e,t(e))}}function Dx(t,e,r,n,i,s){var o=i&Zo,a=t.length,u=e.length;if(a!=u&&!(o&&u>a))return!1;var c=s.get(t);if(c)return c==e;var l=-1,h=!0,d=i&ch?new uh:void 0;for(s.set(t,e);++l<a;){var f=t[l],m=e[l];if(n)var g=o?n(m,f,l,e,t,s):n(f,m,l,t,e,s);if(g!==void 0){if(g)continue;h=!1;break}if(d){if(!AG(e,function(b,S){if(!d.has(S)&&(f===b||r(f,b,n,i,s)))return d.add(S)})){h=!1;break}}else if(!(f===m||r(f,m,n,i,s))){h=!1;break}}return s.delete(t),h}function wK(t,e,r,n,i,s,o){switch(r){case oh:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case fx:return!(t.byteLength!=e.byteLength||!n(new tx(t),new tx(e)));case ix:case sx:return+t==+e;case ox:return t.name==e.name&&t.message==e.message;case ux:return t!=+t?e!=+e:t==+e;case cx:case BD:return t==e+"";case Ku:var a=hx;case Wu:var u=s&Zo;if(a||(a=TG),t.size!=e.size&&!u)return!1;var c=o.get(t);return c?c==e:(s|=ch,o.set(t,e),Dx(a(t),a(e),n,i,s,o));case lx:if(TD)return TD.call(t)==TD.call(e)}return!1}function bK(t,e,r,n,i,s){var o=i&Zo,a=LD(t),u=a.length,c=LD(e),l=c.length;if(u!=l&&!o)return!1;for(var h=u;h--;){var d=a[h];if(!(o?d in e:mx(e,d)))return!1}var f=s.get(t);if(f)return f==e;var m=!0;s.set(t,e);for(var g=o;++h<u;){d=a[h];var b=t[d],S=e[d];if(n)var A=o?n(S,b,d,e,t,s):n(b,S,d,t,e,s);if(!(A===void 0?b===S||r(b,S,n,i,s):A)){m=!1;break}g||(g=d=="constructor")}if(m&&!g){var p=t.constructor,y=e.constructor;p!=y&&"constructor"in t&&"constructor"in e&&!(typeof p=="function"&&p instanceof p&&typeof y=="function"&&y instanceof y)&&(m=!1)}return s.delete(t),m}var vK=gx("length");function dh(t,e){var r=t.__data__;return AK(e)?r[typeof e=="string"?"string":"hash"]:r.map}function EK(t){for(var e=RK(t),r=e.length;r--;)e[r][2]=bx(e[r][1]);return e}function Qo(t,e){var r=t[e];return FK(r)?r:void 0}function _K(t){return NG(Object(t))}function Gn(t){return Fs.call(t)}(kD&&Gn(new kD(new ArrayBuffer(1)))!=oh||ah&&Gn(new ah)!=Ku||RD&&Gn(RD.resolve())!=ZO||ND&&Gn(new ND)!=Wu||$D&&Gn(new $D)!=ID)&&(Gn=function(t){var e=Fs.call(t),r=e==Yo?t.constructor:void 0,n=r?Ps(r):void 0;if(n)switch(n){case LG:return oh;case jG:return Ku;case BG:return ZO;case MG:return Wu;case qG:return ID}return e});function CK(t,e,r){e=ph(e,t)?[e]:yx(e);for(var n,i=-1,o=e.length;++i<o;){var s=mh(e[i]);if(!(n=t!=null&&r(t,s)))break;t=t[s]}if(n)return n;var o=t?t.length:0;return!!o&&gh(o)&&wx(s,o)&&(Ti(t)||Sx(t)||Ex(t))}function SK(t){var e=t?t.length:void 0;return gh(e)&&(Ti(t)||Sx(t)||Ex(t))?OG(e,String):null}function wx(t,e){return e=e??nx,!!e&&(typeof t=="number"||bG.test(t))&&t>-1&&t%1==0&&t<e}function ph(t,e){if(Ti(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Ax(t)?!0:yG.test(t)||!gG.test(t)||e!=null&&t in Object(e)}function AK(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function OK(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||fh;return t===r}function bx(t){return t===t&&!yh(t)}function vx(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function mh(t){if(typeof t=="string"||Ax(t))return t;var e=t+"";return e=="0"&&1/t==-sG?"-0":e}function Ps(t){if(t!=null){try{return dx.call(t)}catch{}try{return t+""}catch{}}return""}function xK(t,e){return t===e||t!==t&&e!==e}function Ex(t){return TK(t)&&Os.call(t,"callee")&&(!kG.call(t,"callee")||Fs.call(t)==sh)}var Ti=Array.isArray;function _x(t){return t!=null&&gh(vK(t))&&!Cx(t)}function TK(t){return Ju(t)&&_x(t)}function Cx(t){var e=yh(t)?Fs.call(t):"";return e==ax||e==oG}function gh(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=nx}function yh(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Ju(t){return!!t&&typeof t=="object"}function FK(t){if(!yh(t))return!1;var e=Cx(t)||PD(t)?PG:wG;return e.test(Ps(t))}function Sx(t){return typeof t=="string"||!Ti(t)&&Ju(t)&&Fs.call(t)==BD}function Ax(t){return typeof t=="symbol"||Ju(t)&&Fs.call(t)==lx}function IK(t){return Ju(t)&&gh(t.length)&&!!Je[Fs.call(t)]}function PK(t,e,r){var n=t==null?void 0:px(t,e);return n===void 0?r:n}function kK(t,e){return t!=null&&CK(t,e,lK)}function LD(t){var e=OK(t);if(!(e||_x(t)))return pK(t);var r=SK(t),n=!!r,i=r||[],s=i.length;for(var o in t)mx(t,o)&&!(n&&(o=="length"||wx(o,s)))&&!(e&&o=="constructor")&&i.push(o);return i}var RK=DK(LD);function NK(t){return t}function $K(t){return ph(t)?gx(mh(t)):yK(t)}Jo.exports=dK});var Px=v((ks,ea)=>{var LK=1/0,jK="[object Function]",BK="[object GeneratorFunction]",MK=/[\\^$.*+?()[\]{}|]/g,qK=/^\[object .+?Constructor\]$/,Zu={function:!0,object:!0},UK=Zu[typeof ks]&&ks&&!ks.nodeType?ks:void 0,HK=Zu[typeof ea]&&ea&&!ea.nodeType?ea:void 0,VK=Dh(UK&&HK&&typeof global=="object"&&global),zK=Dh(Zu[typeof self]&&self),xx=Dh(Zu[typeof window]&&window),qD=Dh(Zu[typeof ks]&&ks),GK=VK||xx!==(qD&&qD.window)&&xx||zK||qD||Function("return this")();function Dh(t){return t&&t.Object===Object?t:null}function KK(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function WK(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Tx=Object.prototype,Fx=Function.prototype.toString,XK=Tx.hasOwnProperty,YK=Tx.toString,JK=RegExp("^"+Fx.call(XK).replace(MK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),UD=QK(GK,"Set"),ZK=UD&&1/WK(new UD([,-0]))[1]==LK?function(t){return new UD(t)}:nW;function QK(t,e){var r=t[e];return rW(r)?r:void 0}function eW(t){if(t!=null){try{return Fx.call(t)}catch{}try{return t+""}catch{}}return""}function tW(t){var e=Ix(t)?YK.call(t):"";return e==jK||e==BK}function Ix(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function rW(t){if(!Ix(t))return!1;var e=tW(t)||KK(t)?JK:qK;return e.test(eW(t))}function nW(){}ea.exports=ZK});var Rx=v((Rs,ta)=>{var Qu={function:!0,object:!0},iW=Qu[typeof Rs]&&Rs&&!Rs.nodeType?Rs:void 0,sW=Qu[typeof ta]&&ta&&!ta.nodeType?ta:void 0,oW=wh(iW&&sW&&typeof global=="object"&&global),aW=wh(Qu[typeof self]&&self),kx=wh(Qu[typeof window]&&window),HD=wh(Qu[typeof Rs]&&Rs),uW=oW||kx!==(HD&&HD.window)&&kx||aW||HD||Function("return this")();function wh(t){return t&&t.Object===Object?t:null}ta.exports=uW});var Mx=v((Bye,Bx)=>{var cW=Px(),lW=Rx(),fW=200,VD="__lodash_hash_undefined__",hW="[object Function]",dW="[object GeneratorFunction]",pW=/[\\^$.*+?()[\]{}|]/g,mW=/^\[object .+?Constructor\]$/;function gW(t,e){return!!t.length&&DW(t,e,0)>-1}function yW(t,e,r){for(var n=-1,i=t.length;++n<i;)if(r(e,t[n]))return!0;return!1}function DW(t,e,r){if(e!==e)return bW(t,r);for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function wW(t,e){return t.has(e)}function bW(t,e,r){for(var n=t.length,i=e+(r?0:-1);r?i--:++i<n;){var s=t[i];if(s!==s)return i}return-1}function vW(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function EW(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var _W=Array.prototype,Nx=Object.prototype,$x=Function.prototype.toString,zD=Nx.hasOwnProperty,CW=Nx.toString,SW=RegExp("^"+$x.call(zD).replace(pW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),AW=_W.splice,OW=Lx(lW,"Map"),ec=Lx(Object,"create");function Ns(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function xW(){this.__data__=ec?ec(null):{}}function TW(t){return this.has(t)&&delete this.__data__[t]}function FW(t){var e=this.__data__;if(ec){var r=e[t];return r===VD?void 0:r}return zD.call(e,t)?e[t]:void 0}function IW(t){var e=this.__data__;return ec?e[t]!==void 0:zD.call(e,t)}function PW(t,e){var r=this.__data__;return r[t]=ec&&e===void 0?VD:e,this}Ns.prototype.clear=xW;Ns.prototype.delete=TW;Ns.prototype.get=FW;Ns.prototype.has=IW;Ns.prototype.set=PW;function ra(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function kW(){this.__data__=[]}function RW(t){var e=this.__data__,r=vh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():AW.call(e,r,1),!0}function NW(t){var e=this.__data__,r=vh(e,t);return r<0?void 0:e[r][1]}function $W(t){return vh(this.__data__,t)>-1}function LW(t,e){var r=this.__data__,n=vh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ra.prototype.clear=kW;ra.prototype.delete=RW;ra.prototype.get=NW;ra.prototype.has=$W;ra.prototype.set=LW;function na(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function jW(){this.__data__={hash:new Ns,map:new(OW||ra),string:new Ns}}function BW(t){return Eh(this,t).delete(t)}function MW(t){return Eh(this,t).get(t)}function qW(t){return Eh(this,t).has(t)}function UW(t,e){return Eh(this,t).set(t,e),this}na.prototype.clear=jW;na.prototype.delete=BW;na.prototype.get=MW;na.prototype.has=qW;na.prototype.set=UW;function bh(t){var e=-1,r=t?t.length:0;for(this.__data__=new na;++e<r;)this.add(t[e])}function HW(t){return this.__data__.set(t,VD),this}function VW(t){return this.__data__.has(t)}bh.prototype.add=bh.prototype.push=HW;bh.prototype.has=VW;function vh(t,e){for(var r=t.length;r--;)if(WW(t[r][0],e))return r;return-1}function zW(t,e,r){var n=-1,i=gW,s=t.length,o=!0,a=[],u=a;if(r)o=!1,i=yW;else if(s>=fW){var c=e?null:cW(t);if(c)return EW(c);o=!1,i=wW,u=new bh}else u=e?[]:a;e:for(;++n<s;){var l=t[n],h=e?e(l):l;if(l=r||l!==0?l:0,o&&h===h){for(var d=u.length;d--;)if(u[d]===h)continue e;e&&u.push(h),a.push(l)}else i(u,h,r)||(u!==a&&u.push(h),a.push(l))}return a}function Eh(t,e){var r=t.__data__;return GW(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Lx(t,e){var r=t[e];return YW(r)?r:void 0}function GW(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function KW(t){if(t!=null){try{return $x.call(t)}catch{}try{return t+""}catch{}}return""}function WW(t,e){return t===e||t!==t&&e!==e}function XW(t){var e=jx(t)?CW.call(t):"";return e==hW||e==dW}function jx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function YW(t){if(!jx(t))return!1;var e=XW(t)||vW(t)?SW:mW;return e.test(KW(t))}Bx.exports=zW});var Ux=v((Mye,qx)=>{var JW=Ox(),ZW=Mx();function QW(t,e){return t&&t.length?ZW(t,JW(e)):[]}qx.exports=QW});var Vx=v((qye,Hx)=>{"use strict";var eX=BO(),tX=Ux(),rX=eX("MultiError");Hx.exports=GD;function GD(t){if(!(this instanceof GD))return new GD(t);if(t=Array.isArray(t)?t:[t],t=tX(t,function(r){return r.stack}),t.length===1)return t[0];var e=new rX({message:t.map(function(r){return r.message}).join("; "),errors:t.reduce(function(r,n){return r.concat(n.errors||n)},[])});return e.__defineGetter__("stack",function(){return t.map(function(r){return r.stack}).join(`
|
|
52
|
+
`),Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,get:function(){return i},set:function(l){i=l,c()}}),Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,get:function(){return o},set:function(l){o=l,c()}}),c())}});var LO=v((jye,$O)=>{"use strict";$O.exports=vs;vs.factory=RO();var _D=vs("CustomError");_D.order=vs(_D,{message:"Arguments out of order.",code:"EOARG"});function vs(t,e,r,n){var i,s;return e=Qf(arguments,1,Error,NO,[vD,eh]),r=Qf(arguments,2,{},vD,[eh]),n=Qf(arguments,3,ED,eh,[]),t=Qf(arguments,0,e===Error?"Error":e.prototype.CustomError.name,nz,[NO,vD,eh]),s=e===Error,s&&n===ED&&(n=vs.factory.root),i=function(o,a){var u,c,l,h,d,f;if(!(this instanceof i))return new i(o,a);for(delete this.constructor.name,Object.defineProperty(this.constructor,"name",{enumerable:!1,configurable:!0,value:t,writable:!1}),typeof o=="string"&&(o={message:o}),o||(o={}),c=this.CustomError.chain.slice(0).reverse().map(function(m){return m.properties}),c.push(o),c.unshift({}),f=Object.assign.apply(Object,c),u=this,l={},Object.keys(vs.factory).forEach(function(m){l[m]=function(g,b){vs.factory[m].call(u,g,b,l)}}),h=this.CustomError.chain.length-1;h>=0;h--)d=this.CustomError.chain[h],d.factory!==ED&&d.factory.call(this,f,a,l)},i.prototype=Object.create(e.prototype),i.prototype.constructor=i,i.prototype.name=t,i.prototype.CustomError={chain:s?[]:e.prototype.CustomError.chain.slice(0),factory:n,name:t,parent:e,properties:r},i.prototype.CustomError.chain.unshift(i.prototype.CustomError),i.prototype.toString=function(){var o=this.CustomError.chain[this.CustomError.chain.length-1].name;return this.code&&(o+=" "+this.code),this.message&&(o+=": "+this.message),o},i}function Qf(t,e,r,n,i){var s=-1,o=-1,a,u,c=e<t.length?e:t.length,l;for(a=0;a<=c;a++){if(l=t[a],s===-1)for(u=0;u<i.length;u++)i[u](l)&&(s=a);o===-1&&n(l)&&(o=a)}if(o!==-1&&s!==-1&&s<o)throw new _D.order;return o!==-1?t[o]:r}function eh(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function nz(t){return typeof t=="string"}function NO(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function vD(t){return t&&typeof t=="object"}function ED(){}});var BO=v((Bye,jO)=>{jO.exports=LO()});var VO=v((Es,Ko)=>{var iz=1/0,sz="[object Symbol]",Vu={function:!0,object:!0},oz=Vu[typeof Es]&&Es&&!Es.nodeType?Es:void 0,az=Vu[typeof Ko]&&Ko&&!Ko.nodeType?Ko:void 0,uz=th(oz&&az&&typeof global=="object"&&global),cz=th(Vu[typeof self]&&self),MO=th(Vu[typeof window]&&window),CD=th(Vu[typeof Es]&&Es),lz=uz||MO!==(CD&&CD.window)&&MO||cz||CD||Function("return this")();function th(t){return t&&t.Object===Object?t:null}var fz=Object.prototype,hz=fz.toString,qO=lz.Symbol,UO=qO?qO.prototype:void 0,HO=UO?UO.toString:void 0;function dz(t){if(typeof t=="string")return t;if(mz(t))return HO?HO.call(t):"";var e=t+"";return e=="0"&&1/t==-iz?"-0":e}function pz(t){return!!t&&typeof t=="object"}function mz(t){return typeof t=="symbol"||pz(t)&&hz.call(t)==sz}Ko.exports=dz});var JO=v((_s,Wo)=>{var gz=VO(),yz="Expected a function",GO="__lodash_hash_undefined__",Dz="[object Function]",wz="[object GeneratorFunction]",bz=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,vz=/[\\^$.*+?()[\]{}|]/g,Ez=/\\(\\)?/g,_z=/^\[object .+?Constructor\]$/,Gu={function:!0,object:!0},Cz=Gu[typeof _s]&&_s&&!_s.nodeType?_s:void 0,Sz=Gu[typeof Wo]&&Wo&&!Wo.nodeType?Wo:void 0,Az=rh(Cz&&Sz&&typeof global=="object"&&global),Oz=rh(Gu[typeof self]&&self),zO=rh(Gu[typeof window]&&window),SD=rh(Gu[typeof _s]&&_s),xz=Az||zO!==(SD&&SD.window)&&zO||Oz||SD||Function("return this")();function rh(t){return t&&t.Object===Object?t:null}function Tz(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var Fz=Array.prototype,KO=Object.prototype,WO=Function.prototype.toString,AD=KO.hasOwnProperty,Iz=KO.toString,Pz=RegExp("^"+WO.call(AD).replace(vz,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kz=Fz.splice,Rz=XO(xz,"Map"),zu=XO(Object,"create");function Cs(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Nz(){this.__data__=zu?zu(null):{}}function $z(t){return this.has(t)&&delete this.__data__[t]}function Lz(t){var e=this.__data__;if(zu){var r=e[t];return r===GO?void 0:r}return AD.call(e,t)?e[t]:void 0}function jz(t){var e=this.__data__;return zu?e[t]!==void 0:AD.call(e,t)}function Bz(t,e){var r=this.__data__;return r[t]=zu&&e===void 0?GO:e,this}Cs.prototype.clear=Nz;Cs.prototype.delete=$z;Cs.prototype.get=Lz;Cs.prototype.has=jz;Cs.prototype.set=Bz;function Xo(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Mz(){this.__data__=[]}function qz(t){var e=this.__data__,r=nh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():kz.call(e,r,1),!0}function Uz(t){var e=this.__data__,r=nh(e,t);return r<0?void 0:e[r][1]}function Hz(t){return nh(this.__data__,t)>-1}function Vz(t,e){var r=this.__data__,n=nh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Xo.prototype.clear=Mz;Xo.prototype.delete=qz;Xo.prototype.get=Uz;Xo.prototype.has=Hz;Xo.prototype.set=Vz;function Ss(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function zz(){this.__data__={hash:new Cs,map:new(Rz||Xo),string:new Cs}}function Gz(t){return ih(this,t).delete(t)}function Kz(t){return ih(this,t).get(t)}function Wz(t){return ih(this,t).has(t)}function Xz(t,e){return ih(this,t).set(t,e),this}Ss.prototype.clear=zz;Ss.prototype.delete=Gz;Ss.prototype.get=Kz;Ss.prototype.has=Wz;Ss.prototype.set=Xz;function nh(t,e){for(var r=t.length;r--;)if(Qz(t[r][0],e))return r;return-1}function ih(t,e){var r=t.__data__;return Yz(e)?r[typeof e=="string"?"string":"hash"]:r.map}function XO(t,e){var r=t[e];return tG(r)?r:void 0}function Yz(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Jz=OD(function(t){var e=[];return rG(t).replace(bz,function(r,n,i,s){e.push(i?s.replace(Ez,"$1"):n||r)}),e});function Zz(t){if(t!=null){try{return WO.call(t)}catch{}try{return t+""}catch{}}return""}function OD(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(yz);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=t.apply(this,n);return r.cache=s.set(i,o),o};return r.cache=new(OD.Cache||Ss),r}OD.Cache=Ss;function Qz(t,e){return t===e||t!==t&&e!==e}function eG(t){var e=YO(t)?Iz.call(t):"";return e==Dz||e==wz}function YO(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function tG(t){if(!YO(t))return!1;var e=eG(t)||Tz(t)?Pz:_z;return e.test(Zz(t))}function rG(t){return t==null?"":gz(t)}Wo.exports=Jz});var Ox=v((As,Jo)=>{var nG=JO(),iG=200,jD="__lodash_hash_undefined__",ch=1,Zo=2,sG=1/0,nx=9007199254740991,sh="[object Arguments]",FD="[object Array]",ix="[object Boolean]",sx="[object Date]",ox="[object Error]",ax="[object Function]",oG="[object GeneratorFunction]",Ku="[object Map]",ux="[object Number]",Yo="[object Object]",ZO="[object Promise]",cx="[object RegExp]",Wu="[object Set]",BD="[object String]",lx="[object Symbol]",ID="[object WeakMap]",fx="[object ArrayBuffer]",oh="[object DataView]",aG="[object Float32Array]",uG="[object Float64Array]",cG="[object Int8Array]",lG="[object Int16Array]",fG="[object Int32Array]",hG="[object Uint8Array]",dG="[object Uint8ClampedArray]",pG="[object Uint16Array]",mG="[object Uint32Array]",gG=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,yG=/^\w*$/,DG=/[\\^$.*+?()[\]{}|]/g,wG=/^\[object .+?Constructor\]$/,bG=/^(?:0|[1-9]\d*)$/,Je={};Je[aG]=Je[uG]=Je[cG]=Je[lG]=Je[fG]=Je[hG]=Je[dG]=Je[pG]=Je[mG]=!0;Je[sh]=Je[FD]=Je[fx]=Je[ix]=Je[oh]=Je[sx]=Je[ox]=Je[ax]=Je[Ku]=Je[ux]=Je[Yo]=Je[cx]=Je[Wu]=Je[BD]=Je[ID]=!1;var Yu={function:!0,object:!0},vG=Yu[typeof As]&&As&&!As.nodeType?As:void 0,EG=Yu[typeof Jo]&&Jo&&!Jo.nodeType?Jo:void 0,_G=lh(vG&&EG&&typeof global=="object"&&global),CG=lh(Yu[typeof self]&&self),QO=lh(Yu[typeof window]&&window),xD=lh(Yu[typeof As]&&As),Ts=_G||QO!==(xD&&xD.window)&&QO||CG||xD||Function("return this")();function SG(t,e){for(var r=-1,n=t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function AG(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function OG(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function xG(t,e){return SG(e,function(r){return[r,t[r]]})}function lh(t){return t&&t.Object===Object?t:null}function PD(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function hx(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}function TG(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function FG(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var IG=Array.prototype,fh=Object.prototype,dx=Function.prototype.toString,Os=fh.hasOwnProperty,Fs=fh.toString,PG=RegExp("^"+dx.call(Os).replace(DG,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ex=Ts.Symbol,tx=Ts.Uint8Array,kG=fh.propertyIsEnumerable,RG=IG.splice,NG=Object.getPrototypeOf,$G=Object.keys,kD=Qo(Ts,"DataView"),ah=Qo(Ts,"Map"),RD=Qo(Ts,"Promise"),ND=Qo(Ts,"Set"),$D=Qo(Ts,"WeakMap"),Xu=Qo(Object,"create"),LG=Ps(kD),jG=Ps(ah),BG=Ps(RD),MG=Ps(ND),qG=Ps($D),rx=ex?ex.prototype:void 0,TD=rx?rx.valueOf:void 0;function xs(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function UG(){this.__data__=Xu?Xu(null):{}}function HG(t){return this.has(t)&&delete this.__data__[t]}function VG(t){var e=this.__data__;if(Xu){var r=e[t];return r===jD?void 0:r}return Os.call(e,t)?e[t]:void 0}function zG(t){var e=this.__data__;return Xu?e[t]!==void 0:Os.call(e,t)}function GG(t,e){var r=this.__data__;return r[t]=Xu&&e===void 0?jD:e,this}xs.prototype.clear=UG;xs.prototype.delete=HG;xs.prototype.get=VG;xs.prototype.has=zG;xs.prototype.set=GG;function Wn(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function KG(){this.__data__=[]}function WG(t){var e=this.__data__,r=hh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():RG.call(e,r,1),!0}function XG(t){var e=this.__data__,r=hh(e,t);return r<0?void 0:e[r][1]}function YG(t){return hh(this.__data__,t)>-1}function JG(t,e){var r=this.__data__,n=hh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Wn.prototype.clear=KG;Wn.prototype.delete=WG;Wn.prototype.get=XG;Wn.prototype.has=YG;Wn.prototype.set=JG;function Is(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function ZG(){this.__data__={hash:new xs,map:new(ah||Wn),string:new xs}}function QG(t){return dh(this,t).delete(t)}function eK(t){return dh(this,t).get(t)}function tK(t){return dh(this,t).has(t)}function rK(t,e){return dh(this,t).set(t,e),this}Is.prototype.clear=ZG;Is.prototype.delete=QG;Is.prototype.get=eK;Is.prototype.has=tK;Is.prototype.set=rK;function uh(t){var e=-1,r=t?t.length:0;for(this.__data__=new Is;++e<r;)this.add(t[e])}function nK(t){return this.__data__.set(t,jD),this}function iK(t){return this.__data__.has(t)}uh.prototype.add=uh.prototype.push=nK;uh.prototype.has=iK;function Kn(t){this.__data__=new Wn(t)}function sK(){this.__data__=new Wn}function oK(t){return this.__data__.delete(t)}function aK(t){return this.__data__.get(t)}function uK(t){return this.__data__.has(t)}function cK(t,e){var r=this.__data__;return r instanceof Wn&&r.__data__.length==iG&&(r=this.__data__=new Is(r.__data__)),r.set(t,e),this}Kn.prototype.clear=sK;Kn.prototype.delete=oK;Kn.prototype.get=aK;Kn.prototype.has=uK;Kn.prototype.set=cK;function hh(t,e){for(var r=t.length;r--;)if(xK(t[r][0],e))return r;return-1}function px(t,e){e=ph(e,t)?[e]:yx(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[mh(e[r++])];return r&&r==n?t:void 0}function mx(t,e){return Os.call(t,e)||typeof t=="object"&&e in t&&_K(t)===null}function lK(t,e){return e in Object(t)}function MD(t,e,r,n,i){return t===e?!0:t==null||e==null||!yh(t)&&!Ju(e)?t!==t&&e!==e:fK(t,e,MD,r,n,i)}function fK(t,e,r,n,i,s){var o=Ti(t),a=Ti(e),u=FD,c=FD;o||(u=Gn(t),u=u==sh?Yo:u),a||(c=Gn(e),c=c==sh?Yo:c);var l=u==Yo&&!PD(t),h=c==Yo&&!PD(e),d=u==c;if(d&&!l)return s||(s=new Kn),o||IK(t)?Dx(t,e,r,n,i,s):wK(t,e,u,r,n,i,s);if(!(i&Zo)){var f=l&&Os.call(t,"__wrapped__"),m=h&&Os.call(e,"__wrapped__");if(f||m){var g=f?t.value():t,b=m?e.value():e;return s||(s=new Kn),r(g,b,n,i,s)}}return d?(s||(s=new Kn),bK(t,e,r,n,i,s)):!1}function hK(t,e,r,n){var i=r.length,s=i,o=!n;if(t==null)return!s;for(t=Object(t);i--;){var a=r[i];if(o&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<s;){a=r[i];var u=a[0],c=t[u],l=a[1];if(o&&a[2]){if(c===void 0&&!(u in t))return!1}else{var h=new Kn;if(n)var d=n(c,l,u,t,e,h);if(!(d===void 0?MD(l,c,n,ch|Zo,h):d))return!1}}return!0}function dK(t){return typeof t=="function"?t:t==null?NK:typeof t=="object"?Ti(t)?gK(t[0],t[1]):mK(t):$K(t)}function pK(t){return $G(Object(t))}function mK(t){var e=EK(t);return e.length==1&&e[0][2]?vx(e[0][0],e[0][1]):function(r){return r===t||hK(r,t,e)}}function gK(t,e){return ph(t)&&bx(e)?vx(mh(t),e):function(r){var n=PK(r,t);return n===void 0&&n===e?kK(r,t):MD(e,n,void 0,ch|Zo)}}function gx(t){return function(e){return e?.[t]}}function yK(t){return function(e){return px(e,t)}}function yx(t){return Ti(t)?t:nG(t)}function DK(t){return function(e){var r=Gn(e);return r==Ku?hx(e):r==Wu?FG(e):xG(e,t(e))}}function Dx(t,e,r,n,i,s){var o=i&Zo,a=t.length,u=e.length;if(a!=u&&!(o&&u>a))return!1;var c=s.get(t);if(c)return c==e;var l=-1,h=!0,d=i&ch?new uh:void 0;for(s.set(t,e);++l<a;){var f=t[l],m=e[l];if(n)var g=o?n(m,f,l,e,t,s):n(f,m,l,t,e,s);if(g!==void 0){if(g)continue;h=!1;break}if(d){if(!AG(e,function(b,S){if(!d.has(S)&&(f===b||r(f,b,n,i,s)))return d.add(S)})){h=!1;break}}else if(!(f===m||r(f,m,n,i,s))){h=!1;break}}return s.delete(t),h}function wK(t,e,r,n,i,s,o){switch(r){case oh:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case fx:return!(t.byteLength!=e.byteLength||!n(new tx(t),new tx(e)));case ix:case sx:return+t==+e;case ox:return t.name==e.name&&t.message==e.message;case ux:return t!=+t?e!=+e:t==+e;case cx:case BD:return t==e+"";case Ku:var a=hx;case Wu:var u=s&Zo;if(a||(a=TG),t.size!=e.size&&!u)return!1;var c=o.get(t);return c?c==e:(s|=ch,o.set(t,e),Dx(a(t),a(e),n,i,s,o));case lx:if(TD)return TD.call(t)==TD.call(e)}return!1}function bK(t,e,r,n,i,s){var o=i&Zo,a=LD(t),u=a.length,c=LD(e),l=c.length;if(u!=l&&!o)return!1;for(var h=u;h--;){var d=a[h];if(!(o?d in e:mx(e,d)))return!1}var f=s.get(t);if(f)return f==e;var m=!0;s.set(t,e);for(var g=o;++h<u;){d=a[h];var b=t[d],S=e[d];if(n)var A=o?n(S,b,d,e,t,s):n(b,S,d,t,e,s);if(!(A===void 0?b===S||r(b,S,n,i,s):A)){m=!1;break}g||(g=d=="constructor")}if(m&&!g){var p=t.constructor,D=e.constructor;p!=D&&"constructor"in t&&"constructor"in e&&!(typeof p=="function"&&p instanceof p&&typeof D=="function"&&D instanceof D)&&(m=!1)}return s.delete(t),m}var vK=gx("length");function dh(t,e){var r=t.__data__;return AK(e)?r[typeof e=="string"?"string":"hash"]:r.map}function EK(t){for(var e=RK(t),r=e.length;r--;)e[r][2]=bx(e[r][1]);return e}function Qo(t,e){var r=t[e];return FK(r)?r:void 0}function _K(t){return NG(Object(t))}function Gn(t){return Fs.call(t)}(kD&&Gn(new kD(new ArrayBuffer(1)))!=oh||ah&&Gn(new ah)!=Ku||RD&&Gn(RD.resolve())!=ZO||ND&&Gn(new ND)!=Wu||$D&&Gn(new $D)!=ID)&&(Gn=function(t){var e=Fs.call(t),r=e==Yo?t.constructor:void 0,n=r?Ps(r):void 0;if(n)switch(n){case LG:return oh;case jG:return Ku;case BG:return ZO;case MG:return Wu;case qG:return ID}return e});function CK(t,e,r){e=ph(e,t)?[e]:yx(e);for(var n,i=-1,o=e.length;++i<o;){var s=mh(e[i]);if(!(n=t!=null&&r(t,s)))break;t=t[s]}if(n)return n;var o=t?t.length:0;return!!o&&gh(o)&&wx(s,o)&&(Ti(t)||Sx(t)||Ex(t))}function SK(t){var e=t?t.length:void 0;return gh(e)&&(Ti(t)||Sx(t)||Ex(t))?OG(e,String):null}function wx(t,e){return e=e??nx,!!e&&(typeof t=="number"||bG.test(t))&&t>-1&&t%1==0&&t<e}function ph(t,e){if(Ti(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Ax(t)?!0:yG.test(t)||!gG.test(t)||e!=null&&t in Object(e)}function AK(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function OK(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||fh;return t===r}function bx(t){return t===t&&!yh(t)}function vx(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function mh(t){if(typeof t=="string"||Ax(t))return t;var e=t+"";return e=="0"&&1/t==-sG?"-0":e}function Ps(t){if(t!=null){try{return dx.call(t)}catch{}try{return t+""}catch{}}return""}function xK(t,e){return t===e||t!==t&&e!==e}function Ex(t){return TK(t)&&Os.call(t,"callee")&&(!kG.call(t,"callee")||Fs.call(t)==sh)}var Ti=Array.isArray;function _x(t){return t!=null&&gh(vK(t))&&!Cx(t)}function TK(t){return Ju(t)&&_x(t)}function Cx(t){var e=yh(t)?Fs.call(t):"";return e==ax||e==oG}function gh(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=nx}function yh(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Ju(t){return!!t&&typeof t=="object"}function FK(t){if(!yh(t))return!1;var e=Cx(t)||PD(t)?PG:wG;return e.test(Ps(t))}function Sx(t){return typeof t=="string"||!Ti(t)&&Ju(t)&&Fs.call(t)==BD}function Ax(t){return typeof t=="symbol"||Ju(t)&&Fs.call(t)==lx}function IK(t){return Ju(t)&&gh(t.length)&&!!Je[Fs.call(t)]}function PK(t,e,r){var n=t==null?void 0:px(t,e);return n===void 0?r:n}function kK(t,e){return t!=null&&CK(t,e,lK)}function LD(t){var e=OK(t);if(!(e||_x(t)))return pK(t);var r=SK(t),n=!!r,i=r||[],s=i.length;for(var o in t)mx(t,o)&&!(n&&(o=="length"||wx(o,s)))&&!(e&&o=="constructor")&&i.push(o);return i}var RK=DK(LD);function NK(t){return t}function $K(t){return ph(t)?gx(mh(t)):yK(t)}Jo.exports=dK});var Px=v((ks,ea)=>{var LK=1/0,jK="[object Function]",BK="[object GeneratorFunction]",MK=/[\\^$.*+?()[\]{}|]/g,qK=/^\[object .+?Constructor\]$/,Zu={function:!0,object:!0},UK=Zu[typeof ks]&&ks&&!ks.nodeType?ks:void 0,HK=Zu[typeof ea]&&ea&&!ea.nodeType?ea:void 0,VK=Dh(UK&&HK&&typeof global=="object"&&global),zK=Dh(Zu[typeof self]&&self),xx=Dh(Zu[typeof window]&&window),qD=Dh(Zu[typeof ks]&&ks),GK=VK||xx!==(qD&&qD.window)&&xx||zK||qD||Function("return this")();function Dh(t){return t&&t.Object===Object?t:null}function KK(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function WK(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Tx=Object.prototype,Fx=Function.prototype.toString,XK=Tx.hasOwnProperty,YK=Tx.toString,JK=RegExp("^"+Fx.call(XK).replace(MK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),UD=QK(GK,"Set"),ZK=UD&&1/WK(new UD([,-0]))[1]==LK?function(t){return new UD(t)}:nW;function QK(t,e){var r=t[e];return rW(r)?r:void 0}function eW(t){if(t!=null){try{return Fx.call(t)}catch{}try{return t+""}catch{}}return""}function tW(t){var e=Ix(t)?YK.call(t):"";return e==jK||e==BK}function Ix(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function rW(t){if(!Ix(t))return!1;var e=tW(t)||KK(t)?JK:qK;return e.test(eW(t))}function nW(){}ea.exports=ZK});var Rx=v((Rs,ta)=>{var Qu={function:!0,object:!0},iW=Qu[typeof Rs]&&Rs&&!Rs.nodeType?Rs:void 0,sW=Qu[typeof ta]&&ta&&!ta.nodeType?ta:void 0,oW=wh(iW&&sW&&typeof global=="object"&&global),aW=wh(Qu[typeof self]&&self),kx=wh(Qu[typeof window]&&window),HD=wh(Qu[typeof Rs]&&Rs),uW=oW||kx!==(HD&&HD.window)&&kx||aW||HD||Function("return this")();function wh(t){return t&&t.Object===Object?t:null}ta.exports=uW});var Mx=v((Mye,Bx)=>{var cW=Px(),lW=Rx(),fW=200,VD="__lodash_hash_undefined__",hW="[object Function]",dW="[object GeneratorFunction]",pW=/[\\^$.*+?()[\]{}|]/g,mW=/^\[object .+?Constructor\]$/;function gW(t,e){return!!t.length&&DW(t,e,0)>-1}function yW(t,e,r){for(var n=-1,i=t.length;++n<i;)if(r(e,t[n]))return!0;return!1}function DW(t,e,r){if(e!==e)return bW(t,r);for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function wW(t,e){return t.has(e)}function bW(t,e,r){for(var n=t.length,i=e+(r?0:-1);r?i--:++i<n;){var s=t[i];if(s!==s)return i}return-1}function vW(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function EW(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var _W=Array.prototype,Nx=Object.prototype,$x=Function.prototype.toString,zD=Nx.hasOwnProperty,CW=Nx.toString,SW=RegExp("^"+$x.call(zD).replace(pW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),AW=_W.splice,OW=Lx(lW,"Map"),ec=Lx(Object,"create");function Ns(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function xW(){this.__data__=ec?ec(null):{}}function TW(t){return this.has(t)&&delete this.__data__[t]}function FW(t){var e=this.__data__;if(ec){var r=e[t];return r===VD?void 0:r}return zD.call(e,t)?e[t]:void 0}function IW(t){var e=this.__data__;return ec?e[t]!==void 0:zD.call(e,t)}function PW(t,e){var r=this.__data__;return r[t]=ec&&e===void 0?VD:e,this}Ns.prototype.clear=xW;Ns.prototype.delete=TW;Ns.prototype.get=FW;Ns.prototype.has=IW;Ns.prototype.set=PW;function ra(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function kW(){this.__data__=[]}function RW(t){var e=this.__data__,r=vh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():AW.call(e,r,1),!0}function NW(t){var e=this.__data__,r=vh(e,t);return r<0?void 0:e[r][1]}function $W(t){return vh(this.__data__,t)>-1}function LW(t,e){var r=this.__data__,n=vh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ra.prototype.clear=kW;ra.prototype.delete=RW;ra.prototype.get=NW;ra.prototype.has=$W;ra.prototype.set=LW;function na(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function jW(){this.__data__={hash:new Ns,map:new(OW||ra),string:new Ns}}function BW(t){return Eh(this,t).delete(t)}function MW(t){return Eh(this,t).get(t)}function qW(t){return Eh(this,t).has(t)}function UW(t,e){return Eh(this,t).set(t,e),this}na.prototype.clear=jW;na.prototype.delete=BW;na.prototype.get=MW;na.prototype.has=qW;na.prototype.set=UW;function bh(t){var e=-1,r=t?t.length:0;for(this.__data__=new na;++e<r;)this.add(t[e])}function HW(t){return this.__data__.set(t,VD),this}function VW(t){return this.__data__.has(t)}bh.prototype.add=bh.prototype.push=HW;bh.prototype.has=VW;function vh(t,e){for(var r=t.length;r--;)if(WW(t[r][0],e))return r;return-1}function zW(t,e,r){var n=-1,i=gW,s=t.length,o=!0,a=[],u=a;if(r)o=!1,i=yW;else if(s>=fW){var c=e?null:cW(t);if(c)return EW(c);o=!1,i=wW,u=new bh}else u=e?[]:a;e:for(;++n<s;){var l=t[n],h=e?e(l):l;if(l=r||l!==0?l:0,o&&h===h){for(var d=u.length;d--;)if(u[d]===h)continue e;e&&u.push(h),a.push(l)}else i(u,h,r)||(u!==a&&u.push(h),a.push(l))}return a}function Eh(t,e){var r=t.__data__;return GW(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Lx(t,e){var r=t[e];return YW(r)?r:void 0}function GW(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function KW(t){if(t!=null){try{return $x.call(t)}catch{}try{return t+""}catch{}}return""}function WW(t,e){return t===e||t!==t&&e!==e}function XW(t){var e=jx(t)?CW.call(t):"";return e==hW||e==dW}function jx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function YW(t){if(!jx(t))return!1;var e=XW(t)||vW(t)?SW:mW;return e.test(KW(t))}Bx.exports=zW});var Ux=v((qye,qx)=>{var JW=Ox(),ZW=Mx();function QW(t,e){return t&&t.length?ZW(t,JW(e)):[]}qx.exports=QW});var Vx=v((Uye,Hx)=>{"use strict";var eX=BO(),tX=Ux(),rX=eX("MultiError");Hx.exports=GD;function GD(t){if(!(this instanceof GD))return new GD(t);if(t=Array.isArray(t)?t:[t],t=tX(t,function(r){return r.stack}),t.length===1)return t[0];var e=new rX({message:t.map(function(r){return r.message}).join("; "),errors:t.reduce(function(r,n){return r.concat(n.errors||n)},[])});return e.__defineGetter__("stack",function(){return t.map(function(r){return r.stack}).join(`
|
|
53
53
|
|
|
54
54
|
`)}),e.__defineSetter__("stack",function(r){return[r].concat(e.stack).join(`
|
|
55
55
|
|
|
56
|
-
`)}),e}});var Gx=v((
|
|
57
|
-
GFS4: `),console.error(t)});lt[Mt]||(Zx=global[Mt]||[],eT(lt,Zx),lt.close=(function(t){function e(r,n){return t.call(lt,r,function(i){i||Qx(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Ah,{value:t}),e})(lt.close),lt.closeSync=(function(t){function e(r){t.apply(lt,arguments),Qx()}return Object.defineProperty(e,Ah,{value:t}),e})(lt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){$s(lt[Mt]),require("assert").equal(lt[Mt].length,0)}));var Zx;global[Mt]||eT(global,lt[Mt]);YD.exports=WD(fX(lt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!lt.__patched&&(YD.exports=WD(lt),lt.__patched=!0);function WD(t){cX(t),t.gracefulify=WD,t.createReadStream=w,t.createWriteStream=_;var e=t.readFile;t.readFile=r;function r(R,k,F){return typeof k=="function"&&(F=k,k=null),j(R,k,F);function j(U,G,L,C){return e(U,G,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?ia([j,[U,G,L],T,C||Date.now(),Date.now()]):typeof L=="function"&&L.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(R,k,F,j){return typeof F=="function"&&(j=F,F=null),U(R,k,F,j);function U(G,L,C,T,I){return n(G,L,C,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ia([U,[G,L,C,T],$,I||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var s=t.appendFile;s&&(t.appendFile=o);function o(R,k,F,j){return typeof F=="function"&&(j=F,F=null),U(R,k,F,j);function U(G,L,C,T,I){return s(G,L,C,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ia([U,[G,L,C,T],$,I||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=u);function u(R,k,F,j){return typeof F=="function"&&(j=F,F=0),U(R,k,F,j);function U(G,L,C,T,I){return a(G,L,C,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ia([U,[G,L,C,T],$,I||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var c=t.readdir;t.readdir=h;var l=/^v[0-5]\./;function h(R,k,F){typeof k=="function"&&(F=k,k=null);var j=l.test(process.version)?function(L,C,T,I){return c(L,U(L,C,T,I))}:function(L,C,T,I){return c(L,C,U(L,C,T,I))};return j(R,k,F);function U(G,L,C,T){return function(I,$){I&&(I.code==="EMFILE"||I.code==="ENFILE")?ia([j,[G,L,C],I,T||Date.now(),Date.now()]):($&&$.sort&&$.sort(),typeof C=="function"&&C.call(this,I,$))}}}if(process.version.substr(0,4)==="v0.8"){var d=lX(t);S=d.ReadStream,p=d.WriteStream}var f=t.ReadStream;f&&(S.prototype=Object.create(f.prototype),S.prototype.open=A);var m=t.WriteStream;m&&(p.prototype=Object.create(m.prototype),p.prototype.open=y),Object.defineProperty(t,"ReadStream",{get:function(){return S},set:function(R){S=R},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return p},set:function(R){p=R},enumerable:!0,configurable:!0});var g=S;Object.defineProperty(t,"FileReadStream",{get:function(){return g},set:function(R){g=R},enumerable:!0,configurable:!0});var b=p;Object.defineProperty(t,"FileWriteStream",{get:function(){return b},set:function(R){b=R},enumerable:!0,configurable:!0});function S(R,k){return this instanceof S?(f.apply(this,arguments),this):S.apply(Object.create(S.prototype),arguments)}function A(){var R=this;E(R.path,R.flags,R.mode,function(k,F){k?(R.autoClose&&R.destroy(),R.emit("error",k)):(R.fd=F,R.emit("open",F),R.read())})}function p(R,k){return this instanceof p?(m.apply(this,arguments),this):p.apply(Object.create(p.prototype),arguments)}function y(){var R=this;E(R.path,R.flags,R.mode,function(k,F){k?(R.destroy(),R.emit("error",k)):(R.fd=F,R.emit("open",F))})}function w(R,k){return new t.ReadStream(R,k)}function _(R,k){return new t.WriteStream(R,k)}var P=t.open;t.open=E;function E(R,k,F,j){return typeof F=="function"&&(j=F,F=null),U(R,k,F,j);function U(G,L,C,T,I){return P(G,L,C,function($,M){$&&($.code==="EMFILE"||$.code==="ENFILE")?ia([U,[G,L,C,T],$,I||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}return t}function ia(t){$s("ENQUEUE",t[0].name,t[1]),lt[Mt].push(t),XD()}var Sh;function Qx(){for(var t=Date.now(),e=0;e<lt[Mt].length;++e)lt[Mt][e].length>2&&(lt[Mt][e][3]=t,lt[Mt][e][4]=t);XD()}function XD(){if(clearTimeout(Sh),Sh=void 0,lt[Mt].length!==0){var t=lt[Mt].shift(),e=t[0],r=t[1],n=t[2],i=t[3],s=t[4];if(i===void 0)$s("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){$s("TIMEOUT",e.name,r);var o=r.pop();typeof o=="function"&&o.call(null,n)}else{var a=Date.now()-s,u=Math.max(s-i,1),c=Math.min(u*1.2,100);a>=c?($s("RETRY",e.name,r),e.apply(null,r.concat([i]))):lt[Mt].push(t)}Sh===void 0&&(Sh=setTimeout(XD,0))}}});var rT=v((Gye,tT)=>{function Ur(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}tT.exports=Ur;Ur.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Ur.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};Ur.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var n=this,i=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r);return this._options.unref&&i.unref(),!0};Ur.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Ur.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Ur.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Ur.prototype.start=Ur.prototype.try;Ur.prototype.errors=function(){return this._errors};Ur.prototype.attempts=function(){return this._attempts};Ur.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var i=this._errors[n],s=i.message,o=(t[s]||0)+1;t[s]=o,o>=r&&(e=i,r=o)}return e}});var nT=v(Ls=>{var dX=rT();Ls.operation=function(t){var e=Ls.timeouts(t);return new dX(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};Ls.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],i=0;i<e.retries;i++)n.push(this.createTimeout(i,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(i,e)),n.sort(function(s,o){return s-o}),n};Ls.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*e.minTimeout*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};Ls.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var n in t)typeof t[n]=="function"&&r.push(n)}for(var i=0;i<r.length;i++){var s=r[i],o=t[s];t[s]=function(u){var c=Ls.operation(e),l=Array.prototype.slice.call(arguments,1),h=l.pop();l.push(function(d){c.retry(d)||(d&&(arguments[0]=c.mainError()),h.apply(this,arguments))}),c.attempt(function(){u.apply(t,l)})}.bind(t,o),t[s].options=e}}});var sT=v((Wye,iT)=>{iT.exports=nT()});var oT=v((Xye,Oh)=>{Oh.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Oh.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Oh.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Ih=v((Yye,aa)=>{var st=global.process,js=function(t){return t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function"};js(st)?(aT=require("assert"),sa=oT(),uT=/^win/i.test(st.platform),tc=require("events"),typeof tc!="function"&&(tc=tc.EventEmitter),st.__signal_exit_emitter__?Pt=st.__signal_exit_emitter__:(Pt=st.__signal_exit_emitter__=new tc,Pt.count=0,Pt.emitted={}),Pt.infinite||(Pt.setMaxListeners(1/0),Pt.infinite=!0),aa.exports=function(t,e){if(!js(global.process))return function(){};aT.equal(typeof t,"function","a callback must be provided for exit handler"),oa===!1&&JD();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){Pt.removeListener(r,t),Pt.listeners("exit").length===0&&Pt.listeners("afterexit").length===0&&xh()};return Pt.on(r,t),n},xh=function(){!oa||!js(global.process)||(oa=!1,sa.forEach(function(e){try{st.removeListener(e,Th[e])}catch{}}),st.emit=Fh,st.reallyExit=ZD,Pt.count-=1)},aa.exports.unload=xh,Bs=function(e,r,n){Pt.emitted[e]||(Pt.emitted[e]=!0,Pt.emit(e,r,n))},Th={},sa.forEach(function(t){Th[t]=function(){if(js(global.process)){var r=st.listeners(t);r.length===Pt.count&&(xh(),Bs("exit",null,t),Bs("afterexit",null,t),uT&&t==="SIGHUP"&&(t="SIGINT"),st.kill(st.pid,t))}}}),aa.exports.signals=function(){return sa},oa=!1,JD=function(){oa||!js(global.process)||(oa=!0,Pt.count+=1,sa=sa.filter(function(e){try{return st.on(e,Th[e]),!0}catch{return!1}}),st.emit=lT,st.reallyExit=cT)},aa.exports.load=JD,ZD=st.reallyExit,cT=function(e){js(global.process)&&(st.exitCode=e||0,Bs("exit",st.exitCode,null),Bs("afterexit",st.exitCode,null),ZD.call(st,st.exitCode))},Fh=st.emit,lT=function(e,r){if(e==="exit"&&js(global.process)){r!==void 0&&(st.exitCode=r);var n=Fh.apply(this,arguments);return Bs("exit",st.exitCode,null),Bs("afterexit",st.exitCode,null),n}else return Fh.apply(this,arguments)}):aa.exports=function(){return function(){}};var aT,sa,uT,tc,Pt,xh,Bs,Th,oa,JD,ZD,cT,Fh,lT});var hT=v((Jye,QD)=>{"use strict";var fT=Symbol();function pX(t,e,r){let n=e[fT];if(n)return e.stat(t,(s,o)=>{if(s)return r(s);r(null,o.mtime,n)});let i=new Date(Math.ceil(Date.now()/1e3)*1e3+5);e.utimes(t,i,i,s=>{if(s)return r(s);e.stat(t,(o,a)=>{if(o)return r(o);let u=a.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(e,fT,{value:u}),r(null,a.mtime,u)})})}function mX(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}QD.exports.probe=pX;QD.exports.getMtime=mX});var yT=v((Zye,nc)=>{"use strict";var gX=require("path"),r0=gt(),yX=sT(),DX=Ih(),dT=hT(),Xn={};function rc(t,e){return e.lockfilePath||`${t}.lock`}function n0(t,e,r){if(!e.realpath)return r(null,gX.resolve(t));e.fs.realpath(t,r)}function t0(t,e,r){let n=rc(t,e);e.fs.mkdir(n,i=>{if(!i)return dT.probe(n,e.fs,(s,o,a)=>{if(s)return e.fs.rmdir(n,()=>{}),r(s);r(null,o,a)});if(i.code!=="EEXIST")return r(i);if(e.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));e.fs.stat(n,(s,o)=>{if(s)return s.code==="ENOENT"?t0(t,{...e,stale:0},r):r(s);if(!pT(o,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));mT(t,e,a=>{if(a)return r(a);t0(t,{...e,stale:0},r)})})})}function pT(t,e){return t.mtime.getTime()<Date.now()-e.stale}function mT(t,e,r){e.fs.rmdir(rc(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Ph(t,e){let r=Xn[t];r.updateTimeout||(r.updateDelay=r.updateDelay||e.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,e.fs.stat(r.lockfilePath,(n,i)=>{let s=r.lastUpdate+e.stale<Date.now();if(n)return n.code==="ENOENT"||s?e0(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Ph(t,e));if(!(r.mtime.getTime()===i.mtime.getTime()))return e0(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=dT.getMtime(r.mtimePrecision);e.fs.utimes(r.lockfilePath,a,a,u=>{let c=r.lastUpdate+e.stale<Date.now();if(!r.released){if(u)return u.code==="ENOENT"||c?e0(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Ph(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,Ph(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function e0(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),Xn[t]===e&&delete Xn[t],e.options.onCompromised(r)}function wX(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:r0,onCompromised:n=>{throw n},...e},e.retries=e.retries||0,e.retries=typeof e.retries=="number"?{retries:e.retries}:e.retries,e.stale=Math.max(e.stale||0,2e3),e.update=e.update==null?e.stale/2:e.update||0,e.update=Math.max(Math.min(e.update,e.stale/2),1e3),n0(t,e,(n,i)=>{if(n)return r(n);let s=yX.operation(e.retries);s.attempt(()=>{t0(i,e,(o,a,u)=>{if(s.retry(o))return;if(o)return r(s.mainError());let c=Xn[i]={lockfilePath:rc(i,e),mtime:a,mtimePrecision:u,options:e,lastUpdate:Date.now()};Ph(i,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));gT(i,{...e,realpath:!1},l)})})})})}function gT(t,e,r){e={fs:r0,realpath:!0,...e},n0(t,e,(n,i)=>{if(n)return r(n);let s=Xn[i];if(!s)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));s.updateTimeout&&clearTimeout(s.updateTimeout),s.released=!0,delete Xn[i],mT(i,e,r)})}function bX(t,e,r){e={stale:1e4,realpath:!0,fs:r0,...e},e.stale=Math.max(e.stale||0,2e3),n0(t,e,(n,i)=>{if(n)return r(n);e.fs.stat(rc(i,e),(s,o)=>s?s.code==="ENOENT"?r(null,!1):r(s):r(null,!pT(o,e)))})}function vX(){return Xn}DX(()=>{for(let t in Xn){let e=Xn[t].options;try{e.fs.rmdirSync(rc(t,e))}catch{}}});nc.exports.lock=wX;nc.exports.unlock=gT;nc.exports.check=bX;nc.exports.getLocks=vX});var wT=v((Qye,DT)=>{"use strict";var EX=gt();function _X(t){let e=["mkdir","realpath","stat","rmdir","utimes"],r={...t};return e.forEach(n=>{r[n]=(...i)=>{let s=i.pop(),o;try{o=t[`${n}Sync`](...i)}catch(a){return s(a)}s(null,o)}}),r}function CX(t){return(...e)=>new Promise((r,n)=>{e.push((i,s)=>{i?n(i):r(s)}),t(...e)})}function SX(t){return(...e)=>{let r,n;if(e.push((i,s)=>{r=i,n=s}),t(...e),r)throw r;return n}}function AX(t){if(t={...t},t.fs=_X(t.fs||EX),typeof t.retries=="number"&&t.retries>0||t.retries&&typeof t.retries.retries=="number"&&t.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return t}DT.exports={toPromise:CX,toSync:SX,toSyncOptions:AX}});var vT=v((eDe,Ii)=>{"use strict";var ua=yT(),{toPromise:kh,toSync:Rh,toSyncOptions:i0}=wT();async function bT(t,e){let r=await kh(ua.lock)(t,e);return kh(r)}function OX(t,e){let r=Rh(ua.lock)(t,i0(e));return Rh(r)}function xX(t,e){return kh(ua.unlock)(t,e)}function TX(t,e){return Rh(ua.unlock)(t,i0(e))}function FX(t,e){return kh(ua.check)(t,e)}function IX(t,e){return Rh(ua.check)(t,i0(e))}Ii.exports=bT;Ii.exports.lock=bT;Ii.exports.unlock=xX;Ii.exports.lockSync=OX;Ii.exports.unlockSync=TX;Ii.exports.check=FX;Ii.exports.checkSync=IX});var AT=v(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.canStoreURLs=ca.FileUrlStorage=void 0;var ET=require("fs"),PX=RX(Vx()),_T=kX(vT());function ST(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(ST=function(n){return n?r:e})(t)}function kX(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=ST(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function RX(t){return t&&t.__esModule?t:{default:t}}function ic(t){"@babel/helpers - typeof";return ic=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ic(t)}function NX(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function CT(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,LX(n.key),n)}}function $X(t,e,r){return e&&CT(t.prototype,e),r&&CT(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function LX(t){var e=jX(t,"string");return ic(e)=="symbol"?e:e+""}function jX(t,e){if(ic(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ic(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var tDe=ca.canStoreURLs=!0,rDe=ca.FileUrlStorage=(function(){function t(e){NX(this,t),this.path=e}return $X(t,[{key:"findAllUploads",value:function(){var r=this;return new Promise(function(n,i){r._getItems("tus::",function(s,o){s?i(s):n(o)})})}},{key:"findUploadsByFingerprint",value:function(r){var n=this;return new Promise(function(i,s){n._getItems("tus::".concat(r),function(o,a){o?s(o):i(a)})})}},{key:"removeUpload",value:function(r){var n=this;return new Promise(function(i,s){n._removeItem(r,function(o){o?s(o):i()})})}},{key:"addUpload",value:function(r,n){var i=this,s=Math.round(Math.random()*1e12),o="tus::".concat(r,"::").concat(s);return new Promise(function(a,u){i._setItem(o,n,function(c){c?u(c):a(o)})})}},{key:"_setItem",value:function(r,n,i){var s=this;_T.lock(this.path,this._lockfileOptions()).then(function(o){i=s._releaseAndCb(o,i),s._getData(function(a,u){if(a){i(a);return}u[r]=n,s._writeData(u,function(c){return i(c)})})}).catch(i)}},{key:"_getItems",value:function(r,n){this._getData(function(i,s){if(i){n(i);return}var o=Object.keys(s).filter(function(a){return a.startsWith(r)}).map(function(a){var u=s[a];return u.urlStorageKey=a,u});n(null,o)})}},{key:"_removeItem",value:function(r,n){var i=this;_T.lock(this.path,this._lockfileOptions()).then(function(s){n=i._releaseAndCb(s,n),i._getData(function(o,a){if(o){n(o);return}delete a[r],i._writeData(a,function(u){return n(u)})})}).catch(n)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(r,n){return function(i){if(i){r().then(function(){return n(i)}).catch(function(s){return n((0,PX.default)([i,s]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var i={encoding:"utf8",mode:432,flag:"w"};(0,ET.writeFile)(this.path,JSON.stringify(r),i,function(s){return n(s)})}},{key:"_getData",value:function(r){(0,ET.readFile)(this.path,"utf8",function(n,i){if(n){n.code==="ENOENT"?r(null,{}):r(n);return}try{i=i.trim().length?JSON.parse(i):{}}catch(s){r(s);return}r(null,i)})}}])})()});var a0=v(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});Object.defineProperty(wr,"DefaultHttpStack",{enumerable:!0,get:function(){return FT.default}});Object.defineProperty(wr,"DetailedError",{enumerable:!0,get:function(){return BX.default}});Object.defineProperty(wr,"FileUrlStorage",{enumerable:!0,get:function(){return IT.FileUrlStorage}});Object.defineProperty(wr,"StreamSource",{enumerable:!0,get:function(){return VX.default}});wr.Upload=void 0;Object.defineProperty(wr,"canStoreURLs",{enumerable:!0,get:function(){return IT.canStoreURLs}});wr.defaultOptions=void 0;Object.defineProperty(wr,"enableDebugLog",{enumerable:!0,get:function(){return MX.enableDebugLog}});wr.isSupported=void 0;var BX=Ms(tD()),MX=rD(),qX=Ms(AA()),s0=Ms(rO()),UX=Ms(mO()),HX=Ms(wO()),FT=Ms(kO()),VX=Ms(gD()),IT=AT();function Ms(t){return t&&t.__esModule?t:{default:t}}function fa(t){"@babel/helpers - typeof";return fa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fa(t)}function zX(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function OT(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,kT(n.key),n)}}function GX(t,e,r){return e&&OT(t.prototype,e),r&&OT(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function KX(t,e,r){return e=Nh(e),WX(t,PT()?Reflect.construct(e,r||[],Nh(t).constructor):e.apply(t,r))}function WX(t,e){if(e&&(fa(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return XX(t)}function XX(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function PT(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(PT=function(){return!!t})()}function Nh(t){return Nh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Nh(t)}function YX(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o0(t,e)}function o0(t,e){return o0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},o0(t,e)}function xT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function la(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?xT(Object(r),!0).forEach(function(n){JX(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):xT(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function JX(t,e,r){return e=kT(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function kT(t){var e=ZX(t,"string");return fa(e)=="symbol"?e:e+""}function ZX(t,e){if(fa(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(fa(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var TT=wr.defaultOptions=la(la({},s0.default.defaultOptions),{},{httpStack:new FT.default,fileReader:new UX.default,urlStorage:new qX.default,fingerprint:HX.default}),iDe=wr.Upload=(function(t){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return zX(this,e),n=la(la({},TT),n),KX(this,e,[r,n])}return YX(e,t),GX(e,null,[{key:"terminate",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i=la(la({},TT),i),s0.default.terminate(n,i)}}])})(s0.default),sDe=wr.isSupported=!0});var LT=v((wDe,$T)=>{var ha=1e3,da=ha*60,pa=da*60,qs=pa*24,rY=qs*7,nY=qs*365.25;$T.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return iY(t);if(r==="number"&&isFinite(t))return e.long?oY(t):sY(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function iY(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*nY;case"weeks":case"week":case"w":return r*rY;case"days":case"day":case"d":return r*qs;case"hours":case"hour":case"hrs":case"hr":case"h":return r*pa;case"minutes":case"minute":case"mins":case"min":case"m":return r*da;case"seconds":case"second":case"secs":case"sec":case"s":return r*ha;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function sY(t){var e=Math.abs(t);return e>=qs?Math.round(t/qs)+"d":e>=pa?Math.round(t/pa)+"h":e>=da?Math.round(t/da)+"m":e>=ha?Math.round(t/ha)+"s":t+"ms"}function oY(t){var e=Math.abs(t);return e>=qs?Lh(t,e,qs,"day"):e>=pa?Lh(t,e,pa,"hour"):e>=da?Lh(t,e,da,"minute"):e>=ha?Lh(t,e,ha,"second"):t+" ms"}function Lh(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var c0=v((bDe,jT)=>{function aY(t){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=i,r.enabled=a,r.humanize=LT(),r.destroy=c,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let h=0;for(let d=0;d<l.length;d++)h=(h<<5)-h+l.charCodeAt(d),h|=0;return r.colors[Math.abs(h)%r.colors.length]}r.selectColor=e;function r(l){let h,d=null,f,m;function g(...b){if(!g.enabled)return;let S=g,A=Number(new Date),p=A-(h||A);S.diff=p,S.prev=h,S.curr=A,h=A,b[0]=r.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let y=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(_,P)=>{if(_==="%%")return"%";y++;let E=r.formatters[P];if(typeof E=="function"){let R=b[y];_=E.call(S,R),b.splice(y,1),y--}return _}),r.formatArgs.call(S,b),(S.log||r.log).apply(S,b)}return g.namespace=l,g.useColors=r.useColors(),g.color=r.selectColor(l),g.extend=n,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(f!==r.namespaces&&(f=r.namespaces,m=r.enabled(l)),m),set:b=>{d=b}}),typeof r.init=="function"&&r.init(g),g}function n(l,h){let d=r(this.namespace+(typeof h>"u"?":":h)+l);return d.log=this.log,d}function i(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let h=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of h)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function s(l,h){let d=0,f=0,m=-1,g=0;for(;d<l.length;)if(f<h.length&&(h[f]===l[d]||h[f]==="*"))h[f]==="*"?(m=f,g=d,f++):(d++,f++);else if(m!==-1)f=m+1,g++,d=g;else return!1;for(;f<h.length&&h[f]==="*";)f++;return f===h.length}function o(){let l=[...r.names,...r.skips.map(h=>"-"+h)].join(",");return r.enable(""),l}function a(l){for(let h of r.skips)if(s(l,h))return!1;for(let h of r.names)if(s(l,h))return!0;return!1}function u(l){return l instanceof Error?l.stack||l.message:l}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}jT.exports=aY});var BT=v((br,jh)=>{br.formatArgs=cY;br.save=lY;br.load=fY;br.useColors=uY;br.storage=hY();br.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();br.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function uY(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function cY(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+jh.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),t.splice(n,0,e)}br.log=console.debug||console.log||(()=>{});function lY(t){try{t?br.storage.setItem("debug",t):br.storage.removeItem("debug")}catch{}}function fY(){let t;try{t=br.storage.getItem("debug")||br.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function hY(){try{return localStorage}catch{}}jh.exports=c0()(br);var{formatters:dY}=jh.exports;dY.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var qT=v((vDe,MT)=>{"use strict";MT.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),i=e.indexOf("--");return n!==-1&&(i===-1||n<i)}});var VT=v((EDe,HT)=>{"use strict";var pY=require("os"),UT=require("tty"),Hr=qT(),{env:kt}=process,ki;Hr("no-color")||Hr("no-colors")||Hr("color=false")||Hr("color=never")?ki=0:(Hr("color")||Hr("colors")||Hr("color=true")||Hr("color=always"))&&(ki=1);"FORCE_COLOR"in kt&&(kt.FORCE_COLOR==="true"?ki=1:kt.FORCE_COLOR==="false"?ki=0:ki=kt.FORCE_COLOR.length===0?1:Math.min(parseInt(kt.FORCE_COLOR,10),3));function l0(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function f0(t,e){if(ki===0)return 0;if(Hr("color=16m")||Hr("color=full")||Hr("color=truecolor"))return 3;if(Hr("color=256"))return 2;if(t&&!e&&ki===void 0)return 0;let r=ki||0;if(kt.TERM==="dumb")return r;if(process.platform==="win32"){let n=pY.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in kt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in kt)||kt.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in kt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(kt.TEAMCITY_VERSION)?1:0;if(kt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in kt){let n=parseInt((kt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(kt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(kt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(kt.TERM)||"COLORTERM"in kt?1:r}function mY(t){let e=f0(t,t&&t.isTTY);return l0(e)}HT.exports={supportsColor:mY,stdout:l0(f0(!0,UT.isatty(1))),stderr:l0(f0(!0,UT.isatty(2)))}});var GT=v((Rt,Mh)=>{var gY=require("tty"),Bh=require("util");Rt.init=_Y;Rt.log=bY;Rt.formatArgs=DY;Rt.save=vY;Rt.load=EY;Rt.useColors=yY;Rt.destroy=Bh.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Rt.colors=[6,2,3,4,5,1];try{let t=VT();t&&(t.stderr||t).level>=2&&(Rt.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}Rt.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(i,s)=>s.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),t[r]=n,t},{});function yY(){return"colors"in Rt.inspectOpts?!!Rt.inspectOpts.colors:gY.isatty(process.stderr.fd)}function DY(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),s=` ${i};1m${e} \x1B[0m`;t[0]=s+t[0].split(`
|
|
56
|
+
`)}),e}});var Gx=v((Hye,zx)=>{var Fi=require("constants"),nX=process.cwd,_h=null,iX=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return _h||(_h=nX.call(process)),_h};try{process.cwd()}catch{}typeof process.chdir=="function"&&(KD=process.chdir,process.chdir=function(t){_h=null,KD.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,KD));var KD;zx.exports=sX;function sX(t){Fi.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=s(t.chown),t.fchown=s(t.fchown),t.lchown=s(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=o(t.chownSync),t.fchownSync=o(t.fchownSync),t.lchownSync=o(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=u(t.statSync),t.fstatSync=u(t.fstatSync),t.lstatSync=u(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(l,h,d){d&&process.nextTick(d)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,h,d,f){f&&process.nextTick(f)},t.lchownSync=function(){}),iX==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function h(d,f,m){var g=Date.now(),b=0;l(d,f,function S(A){if(A&&(A.code==="EACCES"||A.code==="EPERM"||A.code==="EBUSY")&&Date.now()-g<6e4){setTimeout(function(){t.stat(f,function(p,D){p&&p.code==="ENOENT"?l(d,f,S):m(A)})},b),b<100&&(b+=10);return}m&&m(A)})}return Object.setPrototypeOf&&Object.setPrototypeOf(h,l),h})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(l){function h(d,f,m,g,b,S){var A;if(S&&typeof S=="function"){var p=0;A=function(D,w,_){if(D&&D.code==="EAGAIN"&&p<10)return p++,l.call(t,d,f,m,g,b,A);S.apply(this,arguments)}}return l.call(t,d,f,m,g,b,A)}return Object.setPrototypeOf&&Object.setPrototypeOf(h,l),h})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(l){return function(h,d,f,m,g){for(var b=0;;)try{return l.call(t,h,d,f,m,g)}catch(S){if(S.code==="EAGAIN"&&b<10){b++;continue}throw S}}})(t.readSync);function e(l){l.lchmod=function(h,d,f){l.open(h,Fi.O_WRONLY|Fi.O_SYMLINK,d,function(m,g){if(m){f&&f(m);return}l.fchmod(g,d,function(b){l.close(g,function(S){f&&f(b||S)})})})},l.lchmodSync=function(h,d){var f=l.openSync(h,Fi.O_WRONLY|Fi.O_SYMLINK,d),m=!0,g;try{g=l.fchmodSync(f,d),m=!1}finally{if(m)try{l.closeSync(f)}catch{}else l.closeSync(f)}return g}}function r(l){Fi.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(h,d,f,m){l.open(h,Fi.O_SYMLINK,function(g,b){if(g){m&&m(g);return}l.futimes(b,d,f,function(S){l.close(b,function(A){m&&m(S||A)})})})},l.lutimesSync=function(h,d,f){var m=l.openSync(h,Fi.O_SYMLINK),g,b=!0;try{g=l.futimesSync(m,d,f),b=!1}finally{if(b)try{l.closeSync(m)}catch{}else l.closeSync(m)}return g}):l.futimes&&(l.lutimes=function(h,d,f,m){m&&process.nextTick(m)},l.lutimesSync=function(){})}function n(l){return l&&function(h,d,f){return l.call(t,h,d,function(m){c(m)&&(m=null),f&&f.apply(this,arguments)})}}function i(l){return l&&function(h,d){try{return l.call(t,h,d)}catch(f){if(!c(f))throw f}}}function s(l){return l&&function(h,d,f,m){return l.call(t,h,d,f,function(g){c(g)&&(g=null),m&&m.apply(this,arguments)})}}function o(l){return l&&function(h,d,f){try{return l.call(t,h,d,f)}catch(m){if(!c(m))throw m}}}function a(l){return l&&function(h,d,f){typeof d=="function"&&(f=d,d=null);function m(g,b){b&&(b.uid<0&&(b.uid+=4294967296),b.gid<0&&(b.gid+=4294967296)),f&&f.apply(this,arguments)}return d?l.call(t,h,d,m):l.call(t,h,m)}}function u(l){return l&&function(h,d){var f=d?l.call(t,h,d):l.call(t,h);return f&&(f.uid<0&&(f.uid+=4294967296),f.gid<0&&(f.gid+=4294967296)),f}}function c(l){if(!l||l.code==="ENOSYS")return!0;var h=!process.getuid||process.getuid()!==0;return!!(h&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var Xx=v((Vye,Wx)=>{var Kx=require("stream").Stream;Wx.exports=oX;function oX(t){return{ReadStream:e,WriteStream:r};function e(n,i){if(!(this instanceof e))return new e(n,i);Kx.call(this);var s=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var o=Object.keys(i),a=0,u=o.length;a<u;a++){var c=o[a];this[c]=i[c]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){s._read()});return}t.open(this.path,this.flags,this.mode,function(l,h){if(l){s.emit("error",l),s.readable=!1;return}s.fd=h,s.emit("open",h),s._read()})}function r(n,i){if(!(this instanceof r))return new r(n,i);Kx.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var s=Object.keys(i),o=0,a=s.length;o<a;o++){var u=s[o];this[u]=i[u]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var Jx=v((zye,Yx)=>{"use strict";Yx.exports=uX;var aX=Object.getPrototypeOf||function(t){return t.__proto__};function uX(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:aX(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var gt=v((Gye,YD)=>{var lt=require("fs"),cX=Gx(),lX=Xx(),fX=Jx(),Ch=require("util"),Mt,Ah;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Mt=Symbol.for("graceful-fs.queue"),Ah=Symbol.for("graceful-fs.previous")):(Mt="___graceful-fs.queue",Ah="___graceful-fs.previous");function hX(){}function eT(t,e){Object.defineProperty(t,Mt,{get:function(){return e}})}var $s=hX;Ch.debuglog?$s=Ch.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&($s=function(){var t=Ch.format.apply(Ch,arguments);t="GFS4: "+t.split(/\n/).join(`
|
|
57
|
+
GFS4: `),console.error(t)});lt[Mt]||(Zx=global[Mt]||[],eT(lt,Zx),lt.close=(function(t){function e(r,n){return t.call(lt,r,function(i){i||Qx(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Ah,{value:t}),e})(lt.close),lt.closeSync=(function(t){function e(r){t.apply(lt,arguments),Qx()}return Object.defineProperty(e,Ah,{value:t}),e})(lt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){$s(lt[Mt]),require("assert").equal(lt[Mt].length,0)}));var Zx;global[Mt]||eT(global,lt[Mt]);YD.exports=WD(fX(lt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!lt.__patched&&(YD.exports=WD(lt),lt.__patched=!0);function WD(t){cX(t),t.gracefulify=WD,t.createReadStream=w,t.createWriteStream=_;var e=t.readFile;t.readFile=r;function r(R,k,F){return typeof k=="function"&&(F=k,k=null),j(R,k,F);function j(U,G,L,C){return e(U,G,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?ia([j,[U,G,L],T,C||Date.now(),Date.now()]):typeof L=="function"&&L.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(R,k,F,j){return typeof F=="function"&&(j=F,F=null),U(R,k,F,j);function U(G,L,C,T,I){return n(G,L,C,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ia([U,[G,L,C,T],$,I||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var s=t.appendFile;s&&(t.appendFile=o);function o(R,k,F,j){return typeof F=="function"&&(j=F,F=null),U(R,k,F,j);function U(G,L,C,T,I){return s(G,L,C,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ia([U,[G,L,C,T],$,I||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=u);function u(R,k,F,j){return typeof F=="function"&&(j=F,F=0),U(R,k,F,j);function U(G,L,C,T,I){return a(G,L,C,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ia([U,[G,L,C,T],$,I||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var c=t.readdir;t.readdir=h;var l=/^v[0-5]\./;function h(R,k,F){typeof k=="function"&&(F=k,k=null);var j=l.test(process.version)?function(L,C,T,I){return c(L,U(L,C,T,I))}:function(L,C,T,I){return c(L,C,U(L,C,T,I))};return j(R,k,F);function U(G,L,C,T){return function(I,$){I&&(I.code==="EMFILE"||I.code==="ENFILE")?ia([j,[G,L,C],I,T||Date.now(),Date.now()]):($&&$.sort&&$.sort(),typeof C=="function"&&C.call(this,I,$))}}}if(process.version.substr(0,4)==="v0.8"){var d=lX(t);S=d.ReadStream,p=d.WriteStream}var f=t.ReadStream;f&&(S.prototype=Object.create(f.prototype),S.prototype.open=A);var m=t.WriteStream;m&&(p.prototype=Object.create(m.prototype),p.prototype.open=D),Object.defineProperty(t,"ReadStream",{get:function(){return S},set:function(R){S=R},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return p},set:function(R){p=R},enumerable:!0,configurable:!0});var g=S;Object.defineProperty(t,"FileReadStream",{get:function(){return g},set:function(R){g=R},enumerable:!0,configurable:!0});var b=p;Object.defineProperty(t,"FileWriteStream",{get:function(){return b},set:function(R){b=R},enumerable:!0,configurable:!0});function S(R,k){return this instanceof S?(f.apply(this,arguments),this):S.apply(Object.create(S.prototype),arguments)}function A(){var R=this;E(R.path,R.flags,R.mode,function(k,F){k?(R.autoClose&&R.destroy(),R.emit("error",k)):(R.fd=F,R.emit("open",F),R.read())})}function p(R,k){return this instanceof p?(m.apply(this,arguments),this):p.apply(Object.create(p.prototype),arguments)}function D(){var R=this;E(R.path,R.flags,R.mode,function(k,F){k?(R.destroy(),R.emit("error",k)):(R.fd=F,R.emit("open",F))})}function w(R,k){return new t.ReadStream(R,k)}function _(R,k){return new t.WriteStream(R,k)}var P=t.open;t.open=E;function E(R,k,F,j){return typeof F=="function"&&(j=F,F=null),U(R,k,F,j);function U(G,L,C,T,I){return P(G,L,C,function($,M){$&&($.code==="EMFILE"||$.code==="ENFILE")?ia([U,[G,L,C,T],$,I||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}return t}function ia(t){$s("ENQUEUE",t[0].name,t[1]),lt[Mt].push(t),XD()}var Sh;function Qx(){for(var t=Date.now(),e=0;e<lt[Mt].length;++e)lt[Mt][e].length>2&&(lt[Mt][e][3]=t,lt[Mt][e][4]=t);XD()}function XD(){if(clearTimeout(Sh),Sh=void 0,lt[Mt].length!==0){var t=lt[Mt].shift(),e=t[0],r=t[1],n=t[2],i=t[3],s=t[4];if(i===void 0)$s("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){$s("TIMEOUT",e.name,r);var o=r.pop();typeof o=="function"&&o.call(null,n)}else{var a=Date.now()-s,u=Math.max(s-i,1),c=Math.min(u*1.2,100);a>=c?($s("RETRY",e.name,r),e.apply(null,r.concat([i]))):lt[Mt].push(t)}Sh===void 0&&(Sh=setTimeout(XD,0))}}});var rT=v((Kye,tT)=>{function Ur(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}tT.exports=Ur;Ur.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Ur.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};Ur.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var n=this,i=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r);return this._options.unref&&i.unref(),!0};Ur.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};Ur.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Ur.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Ur.prototype.start=Ur.prototype.try;Ur.prototype.errors=function(){return this._errors};Ur.prototype.attempts=function(){return this._attempts};Ur.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var i=this._errors[n],s=i.message,o=(t[s]||0)+1;t[s]=o,o>=r&&(e=i,r=o)}return e}});var nT=v(Ls=>{var dX=rT();Ls.operation=function(t){var e=Ls.timeouts(t);return new dX(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};Ls.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],i=0;i<e.retries;i++)n.push(this.createTimeout(i,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(i,e)),n.sort(function(s,o){return s-o}),n};Ls.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*e.minTimeout*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};Ls.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var n in t)typeof t[n]=="function"&&r.push(n)}for(var i=0;i<r.length;i++){var s=r[i],o=t[s];t[s]=function(u){var c=Ls.operation(e),l=Array.prototype.slice.call(arguments,1),h=l.pop();l.push(function(d){c.retry(d)||(d&&(arguments[0]=c.mainError()),h.apply(this,arguments))}),c.attempt(function(){u.apply(t,l)})}.bind(t,o),t[s].options=e}}});var sT=v((Xye,iT)=>{iT.exports=nT()});var oT=v((Yye,Oh)=>{Oh.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Oh.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Oh.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Ih=v((Jye,aa)=>{var st=global.process,js=function(t){return t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function"};js(st)?(aT=require("assert"),sa=oT(),uT=/^win/i.test(st.platform),tc=require("events"),typeof tc!="function"&&(tc=tc.EventEmitter),st.__signal_exit_emitter__?Pt=st.__signal_exit_emitter__:(Pt=st.__signal_exit_emitter__=new tc,Pt.count=0,Pt.emitted={}),Pt.infinite||(Pt.setMaxListeners(1/0),Pt.infinite=!0),aa.exports=function(t,e){if(!js(global.process))return function(){};aT.equal(typeof t,"function","a callback must be provided for exit handler"),oa===!1&&JD();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){Pt.removeListener(r,t),Pt.listeners("exit").length===0&&Pt.listeners("afterexit").length===0&&xh()};return Pt.on(r,t),n},xh=function(){!oa||!js(global.process)||(oa=!1,sa.forEach(function(e){try{st.removeListener(e,Th[e])}catch{}}),st.emit=Fh,st.reallyExit=ZD,Pt.count-=1)},aa.exports.unload=xh,Bs=function(e,r,n){Pt.emitted[e]||(Pt.emitted[e]=!0,Pt.emit(e,r,n))},Th={},sa.forEach(function(t){Th[t]=function(){if(js(global.process)){var r=st.listeners(t);r.length===Pt.count&&(xh(),Bs("exit",null,t),Bs("afterexit",null,t),uT&&t==="SIGHUP"&&(t="SIGINT"),st.kill(st.pid,t))}}}),aa.exports.signals=function(){return sa},oa=!1,JD=function(){oa||!js(global.process)||(oa=!0,Pt.count+=1,sa=sa.filter(function(e){try{return st.on(e,Th[e]),!0}catch{return!1}}),st.emit=lT,st.reallyExit=cT)},aa.exports.load=JD,ZD=st.reallyExit,cT=function(e){js(global.process)&&(st.exitCode=e||0,Bs("exit",st.exitCode,null),Bs("afterexit",st.exitCode,null),ZD.call(st,st.exitCode))},Fh=st.emit,lT=function(e,r){if(e==="exit"&&js(global.process)){r!==void 0&&(st.exitCode=r);var n=Fh.apply(this,arguments);return Bs("exit",st.exitCode,null),Bs("afterexit",st.exitCode,null),n}else return Fh.apply(this,arguments)}):aa.exports=function(){return function(){}};var aT,sa,uT,tc,Pt,xh,Bs,Th,oa,JD,ZD,cT,Fh,lT});var hT=v((Zye,QD)=>{"use strict";var fT=Symbol();function pX(t,e,r){let n=e[fT];if(n)return e.stat(t,(s,o)=>{if(s)return r(s);r(null,o.mtime,n)});let i=new Date(Math.ceil(Date.now()/1e3)*1e3+5);e.utimes(t,i,i,s=>{if(s)return r(s);e.stat(t,(o,a)=>{if(o)return r(o);let u=a.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(e,fT,{value:u}),r(null,a.mtime,u)})})}function mX(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}QD.exports.probe=pX;QD.exports.getMtime=mX});var yT=v((Qye,nc)=>{"use strict";var gX=require("path"),r0=gt(),yX=sT(),DX=Ih(),dT=hT(),Xn={};function rc(t,e){return e.lockfilePath||`${t}.lock`}function n0(t,e,r){if(!e.realpath)return r(null,gX.resolve(t));e.fs.realpath(t,r)}function t0(t,e,r){let n=rc(t,e);e.fs.mkdir(n,i=>{if(!i)return dT.probe(n,e.fs,(s,o,a)=>{if(s)return e.fs.rmdir(n,()=>{}),r(s);r(null,o,a)});if(i.code!=="EEXIST")return r(i);if(e.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));e.fs.stat(n,(s,o)=>{if(s)return s.code==="ENOENT"?t0(t,{...e,stale:0},r):r(s);if(!pT(o,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));mT(t,e,a=>{if(a)return r(a);t0(t,{...e,stale:0},r)})})})}function pT(t,e){return t.mtime.getTime()<Date.now()-e.stale}function mT(t,e,r){e.fs.rmdir(rc(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Ph(t,e){let r=Xn[t];r.updateTimeout||(r.updateDelay=r.updateDelay||e.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,e.fs.stat(r.lockfilePath,(n,i)=>{let s=r.lastUpdate+e.stale<Date.now();if(n)return n.code==="ENOENT"||s?e0(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Ph(t,e));if(!(r.mtime.getTime()===i.mtime.getTime()))return e0(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=dT.getMtime(r.mtimePrecision);e.fs.utimes(r.lockfilePath,a,a,u=>{let c=r.lastUpdate+e.stale<Date.now();if(!r.released){if(u)return u.code==="ENOENT"||c?e0(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Ph(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,Ph(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function e0(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),Xn[t]===e&&delete Xn[t],e.options.onCompromised(r)}function wX(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:r0,onCompromised:n=>{throw n},...e},e.retries=e.retries||0,e.retries=typeof e.retries=="number"?{retries:e.retries}:e.retries,e.stale=Math.max(e.stale||0,2e3),e.update=e.update==null?e.stale/2:e.update||0,e.update=Math.max(Math.min(e.update,e.stale/2),1e3),n0(t,e,(n,i)=>{if(n)return r(n);let s=yX.operation(e.retries);s.attempt(()=>{t0(i,e,(o,a,u)=>{if(s.retry(o))return;if(o)return r(s.mainError());let c=Xn[i]={lockfilePath:rc(i,e),mtime:a,mtimePrecision:u,options:e,lastUpdate:Date.now()};Ph(i,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));gT(i,{...e,realpath:!1},l)})})})})}function gT(t,e,r){e={fs:r0,realpath:!0,...e},n0(t,e,(n,i)=>{if(n)return r(n);let s=Xn[i];if(!s)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));s.updateTimeout&&clearTimeout(s.updateTimeout),s.released=!0,delete Xn[i],mT(i,e,r)})}function bX(t,e,r){e={stale:1e4,realpath:!0,fs:r0,...e},e.stale=Math.max(e.stale||0,2e3),n0(t,e,(n,i)=>{if(n)return r(n);e.fs.stat(rc(i,e),(s,o)=>s?s.code==="ENOENT"?r(null,!1):r(s):r(null,!pT(o,e)))})}function vX(){return Xn}DX(()=>{for(let t in Xn){let e=Xn[t].options;try{e.fs.rmdirSync(rc(t,e))}catch{}}});nc.exports.lock=wX;nc.exports.unlock=gT;nc.exports.check=bX;nc.exports.getLocks=vX});var wT=v((eDe,DT)=>{"use strict";var EX=gt();function _X(t){let e=["mkdir","realpath","stat","rmdir","utimes"],r={...t};return e.forEach(n=>{r[n]=(...i)=>{let s=i.pop(),o;try{o=t[`${n}Sync`](...i)}catch(a){return s(a)}s(null,o)}}),r}function CX(t){return(...e)=>new Promise((r,n)=>{e.push((i,s)=>{i?n(i):r(s)}),t(...e)})}function SX(t){return(...e)=>{let r,n;if(e.push((i,s)=>{r=i,n=s}),t(...e),r)throw r;return n}}function AX(t){if(t={...t},t.fs=_X(t.fs||EX),typeof t.retries=="number"&&t.retries>0||t.retries&&typeof t.retries.retries=="number"&&t.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return t}DT.exports={toPromise:CX,toSync:SX,toSyncOptions:AX}});var vT=v((tDe,Ii)=>{"use strict";var ua=yT(),{toPromise:kh,toSync:Rh,toSyncOptions:i0}=wT();async function bT(t,e){let r=await kh(ua.lock)(t,e);return kh(r)}function OX(t,e){let r=Rh(ua.lock)(t,i0(e));return Rh(r)}function xX(t,e){return kh(ua.unlock)(t,e)}function TX(t,e){return Rh(ua.unlock)(t,i0(e))}function FX(t,e){return kh(ua.check)(t,e)}function IX(t,e){return Rh(ua.check)(t,i0(e))}Ii.exports=bT;Ii.exports.lock=bT;Ii.exports.unlock=xX;Ii.exports.lockSync=OX;Ii.exports.unlockSync=TX;Ii.exports.check=FX;Ii.exports.checkSync=IX});var AT=v(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});ca.canStoreURLs=ca.FileUrlStorage=void 0;var ET=require("fs"),PX=RX(Vx()),_T=kX(vT());function ST(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(ST=function(n){return n?r:e})(t)}function kX(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=ST(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function RX(t){return t&&t.__esModule?t:{default:t}}function ic(t){"@babel/helpers - typeof";return ic=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ic(t)}function NX(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function CT(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,LX(n.key),n)}}function $X(t,e,r){return e&&CT(t.prototype,e),r&&CT(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function LX(t){var e=jX(t,"string");return ic(e)=="symbol"?e:e+""}function jX(t,e){if(ic(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ic(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var rDe=ca.canStoreURLs=!0,nDe=ca.FileUrlStorage=(function(){function t(e){NX(this,t),this.path=e}return $X(t,[{key:"findAllUploads",value:function(){var r=this;return new Promise(function(n,i){r._getItems("tus::",function(s,o){s?i(s):n(o)})})}},{key:"findUploadsByFingerprint",value:function(r){var n=this;return new Promise(function(i,s){n._getItems("tus::".concat(r),function(o,a){o?s(o):i(a)})})}},{key:"removeUpload",value:function(r){var n=this;return new Promise(function(i,s){n._removeItem(r,function(o){o?s(o):i()})})}},{key:"addUpload",value:function(r,n){var i=this,s=Math.round(Math.random()*1e12),o="tus::".concat(r,"::").concat(s);return new Promise(function(a,u){i._setItem(o,n,function(c){c?u(c):a(o)})})}},{key:"_setItem",value:function(r,n,i){var s=this;_T.lock(this.path,this._lockfileOptions()).then(function(o){i=s._releaseAndCb(o,i),s._getData(function(a,u){if(a){i(a);return}u[r]=n,s._writeData(u,function(c){return i(c)})})}).catch(i)}},{key:"_getItems",value:function(r,n){this._getData(function(i,s){if(i){n(i);return}var o=Object.keys(s).filter(function(a){return a.startsWith(r)}).map(function(a){var u=s[a];return u.urlStorageKey=a,u});n(null,o)})}},{key:"_removeItem",value:function(r,n){var i=this;_T.lock(this.path,this._lockfileOptions()).then(function(s){n=i._releaseAndCb(s,n),i._getData(function(o,a){if(o){n(o);return}delete a[r],i._writeData(a,function(u){return n(u)})})}).catch(n)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(r,n){return function(i){if(i){r().then(function(){return n(i)}).catch(function(s){return n((0,PX.default)([i,s]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var i={encoding:"utf8",mode:432,flag:"w"};(0,ET.writeFile)(this.path,JSON.stringify(r),i,function(s){return n(s)})}},{key:"_getData",value:function(r){(0,ET.readFile)(this.path,"utf8",function(n,i){if(n){n.code==="ENOENT"?r(null,{}):r(n);return}try{i=i.trim().length?JSON.parse(i):{}}catch(s){r(s);return}r(null,i)})}}])})()});var a0=v(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});Object.defineProperty(wr,"DefaultHttpStack",{enumerable:!0,get:function(){return FT.default}});Object.defineProperty(wr,"DetailedError",{enumerable:!0,get:function(){return BX.default}});Object.defineProperty(wr,"FileUrlStorage",{enumerable:!0,get:function(){return IT.FileUrlStorage}});Object.defineProperty(wr,"StreamSource",{enumerable:!0,get:function(){return VX.default}});wr.Upload=void 0;Object.defineProperty(wr,"canStoreURLs",{enumerable:!0,get:function(){return IT.canStoreURLs}});wr.defaultOptions=void 0;Object.defineProperty(wr,"enableDebugLog",{enumerable:!0,get:function(){return MX.enableDebugLog}});wr.isSupported=void 0;var BX=Ms(tD()),MX=rD(),qX=Ms(AA()),s0=Ms(rO()),UX=Ms(mO()),HX=Ms(wO()),FT=Ms(kO()),VX=Ms(gD()),IT=AT();function Ms(t){return t&&t.__esModule?t:{default:t}}function fa(t){"@babel/helpers - typeof";return fa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fa(t)}function zX(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function OT(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,kT(n.key),n)}}function GX(t,e,r){return e&&OT(t.prototype,e),r&&OT(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function KX(t,e,r){return e=Nh(e),WX(t,PT()?Reflect.construct(e,r||[],Nh(t).constructor):e.apply(t,r))}function WX(t,e){if(e&&(fa(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return XX(t)}function XX(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function PT(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(PT=function(){return!!t})()}function Nh(t){return Nh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Nh(t)}function YX(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o0(t,e)}function o0(t,e){return o0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},o0(t,e)}function xT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function la(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?xT(Object(r),!0).forEach(function(n){JX(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):xT(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function JX(t,e,r){return e=kT(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function kT(t){var e=ZX(t,"string");return fa(e)=="symbol"?e:e+""}function ZX(t,e){if(fa(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(fa(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var TT=wr.defaultOptions=la(la({},s0.default.defaultOptions),{},{httpStack:new FT.default,fileReader:new UX.default,urlStorage:new qX.default,fingerprint:HX.default}),sDe=wr.Upload=(function(t){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return zX(this,e),n=la(la({},TT),n),KX(this,e,[r,n])}return YX(e,t),GX(e,null,[{key:"terminate",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i=la(la({},TT),i),s0.default.terminate(n,i)}}])})(s0.default),oDe=wr.isSupported=!0});var LT=v((bDe,$T)=>{var ha=1e3,da=ha*60,pa=da*60,qs=pa*24,rY=qs*7,nY=qs*365.25;$T.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return iY(t);if(r==="number"&&isFinite(t))return e.long?oY(t):sY(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function iY(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*nY;case"weeks":case"week":case"w":return r*rY;case"days":case"day":case"d":return r*qs;case"hours":case"hour":case"hrs":case"hr":case"h":return r*pa;case"minutes":case"minute":case"mins":case"min":case"m":return r*da;case"seconds":case"second":case"secs":case"sec":case"s":return r*ha;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function sY(t){var e=Math.abs(t);return e>=qs?Math.round(t/qs)+"d":e>=pa?Math.round(t/pa)+"h":e>=da?Math.round(t/da)+"m":e>=ha?Math.round(t/ha)+"s":t+"ms"}function oY(t){var e=Math.abs(t);return e>=qs?Lh(t,e,qs,"day"):e>=pa?Lh(t,e,pa,"hour"):e>=da?Lh(t,e,da,"minute"):e>=ha?Lh(t,e,ha,"second"):t+" ms"}function Lh(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var c0=v((vDe,jT)=>{function aY(t){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=i,r.enabled=a,r.humanize=LT(),r.destroy=c,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let h=0;for(let d=0;d<l.length;d++)h=(h<<5)-h+l.charCodeAt(d),h|=0;return r.colors[Math.abs(h)%r.colors.length]}r.selectColor=e;function r(l){let h,d=null,f,m;function g(...b){if(!g.enabled)return;let S=g,A=Number(new Date),p=A-(h||A);S.diff=p,S.prev=h,S.curr=A,h=A,b[0]=r.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let D=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(_,P)=>{if(_==="%%")return"%";D++;let E=r.formatters[P];if(typeof E=="function"){let R=b[D];_=E.call(S,R),b.splice(D,1),D--}return _}),r.formatArgs.call(S,b),(S.log||r.log).apply(S,b)}return g.namespace=l,g.useColors=r.useColors(),g.color=r.selectColor(l),g.extend=n,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(f!==r.namespaces&&(f=r.namespaces,m=r.enabled(l)),m),set:b=>{d=b}}),typeof r.init=="function"&&r.init(g),g}function n(l,h){let d=r(this.namespace+(typeof h>"u"?":":h)+l);return d.log=this.log,d}function i(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let h=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of h)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function s(l,h){let d=0,f=0,m=-1,g=0;for(;d<l.length;)if(f<h.length&&(h[f]===l[d]||h[f]==="*"))h[f]==="*"?(m=f,g=d,f++):(d++,f++);else if(m!==-1)f=m+1,g++,d=g;else return!1;for(;f<h.length&&h[f]==="*";)f++;return f===h.length}function o(){let l=[...r.names,...r.skips.map(h=>"-"+h)].join(",");return r.enable(""),l}function a(l){for(let h of r.skips)if(s(l,h))return!1;for(let h of r.names)if(s(l,h))return!0;return!1}function u(l){return l instanceof Error?l.stack||l.message:l}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}jT.exports=aY});var BT=v((br,jh)=>{br.formatArgs=cY;br.save=lY;br.load=fY;br.useColors=uY;br.storage=hY();br.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();br.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function uY(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function cY(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+jh.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),t.splice(n,0,e)}br.log=console.debug||console.log||(()=>{});function lY(t){try{t?br.storage.setItem("debug",t):br.storage.removeItem("debug")}catch{}}function fY(){let t;try{t=br.storage.getItem("debug")||br.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function hY(){try{return localStorage}catch{}}jh.exports=c0()(br);var{formatters:dY}=jh.exports;dY.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var qT=v((EDe,MT)=>{"use strict";MT.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),i=e.indexOf("--");return n!==-1&&(i===-1||n<i)}});var VT=v((_De,HT)=>{"use strict";var pY=require("os"),UT=require("tty"),Hr=qT(),{env:kt}=process,ki;Hr("no-color")||Hr("no-colors")||Hr("color=false")||Hr("color=never")?ki=0:(Hr("color")||Hr("colors")||Hr("color=true")||Hr("color=always"))&&(ki=1);"FORCE_COLOR"in kt&&(kt.FORCE_COLOR==="true"?ki=1:kt.FORCE_COLOR==="false"?ki=0:ki=kt.FORCE_COLOR.length===0?1:Math.min(parseInt(kt.FORCE_COLOR,10),3));function l0(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function f0(t,e){if(ki===0)return 0;if(Hr("color=16m")||Hr("color=full")||Hr("color=truecolor"))return 3;if(Hr("color=256"))return 2;if(t&&!e&&ki===void 0)return 0;let r=ki||0;if(kt.TERM==="dumb")return r;if(process.platform==="win32"){let n=pY.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in kt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in kt)||kt.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in kt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(kt.TEAMCITY_VERSION)?1:0;if(kt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in kt){let n=parseInt((kt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(kt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(kt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(kt.TERM)||"COLORTERM"in kt?1:r}function mY(t){let e=f0(t,t&&t.isTTY);return l0(e)}HT.exports={supportsColor:mY,stdout:l0(f0(!0,UT.isatty(1))),stderr:l0(f0(!0,UT.isatty(2)))}});var GT=v((Rt,Mh)=>{var gY=require("tty"),Bh=require("util");Rt.init=_Y;Rt.log=bY;Rt.formatArgs=DY;Rt.save=vY;Rt.load=EY;Rt.useColors=yY;Rt.destroy=Bh.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Rt.colors=[6,2,3,4,5,1];try{let t=VT();t&&(t.stderr||t).level>=2&&(Rt.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}Rt.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(i,s)=>s.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),t[r]=n,t},{});function yY(){return"colors"in Rt.inspectOpts?!!Rt.inspectOpts.colors:gY.isatty(process.stderr.fd)}function DY(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),s=` ${i};1m${e} \x1B[0m`;t[0]=s+t[0].split(`
|
|
58
58
|
`).join(`
|
|
59
59
|
`+s),t.push(i+"m+"+Mh.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=wY()+e+" "+t[0]}function wY(){return Rt.inspectOpts.hideDate?"":new Date().toISOString()+" "}function bY(...t){return process.stderr.write(Bh.formatWithOptions(Rt.inspectOpts,...t)+`
|
|
60
60
|
`)}function vY(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function EY(){return process.env.DEBUG}function _Y(t){t.inspectOpts={};let e=Object.keys(Rt.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=Rt.inspectOpts[e[r]]}Mh.exports=c0()(Rt);var{formatters:zT}=Mh.exports;zT.o=function(t){return this.inspectOpts.colors=this.useColors,Bh.inspect(t,this.inspectOpts).split(`
|
|
61
|
-
`).map(e=>e.trim()).join(" ")};zT.O=function(t){return this.inspectOpts.colors=this.useColors,Bh.inspect(t,this.inspectOpts)}});var qh=v((
|
|
61
|
+
`).map(e=>e.trim()).join(" ")};zT.O=function(t){return this.inspectOpts.colors=this.useColors,Bh.inspect(t,this.inspectOpts)}});var qh=v((CDe,h0)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?h0.exports=BT():h0.exports=GT()});var Fe=v(d0=>{"use strict";d0.fromCallback=function(t){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")t.apply(this,e);else return new Promise((r,n)=>{e.push((i,s)=>i!=null?n(i):r(s)),t.apply(this,e)})},"name",{value:t.name})};d0.fromPromise=function(t){return Object.defineProperty(function(...e){let r=e[e.length-1];if(typeof r!="function")return t.apply(this,e);e.pop(),t.apply(this,e).then(n=>r(null,n),r)},"name",{value:t.name})}});var ir=v(Jn=>{"use strict";var KT=Fe().fromCallback,nr=gt(),CY=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof nr[t]=="function");Object.assign(Jn,nr);CY.forEach(t=>{Jn[t]=KT(nr[t])});Jn.exists=function(t,e){return typeof e=="function"?nr.exists(t,e):new Promise(r=>nr.exists(t,r))};Jn.read=function(t,e,r,n,i,s){return typeof s=="function"?nr.read(t,e,r,n,i,s):new Promise((o,a)=>{nr.read(t,e,r,n,i,(u,c,l)=>{if(u)return a(u);o({bytesRead:c,buffer:l})})})};Jn.write=function(t,e,...r){return typeof r[r.length-1]=="function"?nr.write(t,e,...r):new Promise((n,i)=>{nr.write(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffer:a})})})};Jn.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?nr.readv(t,e,...r):new Promise((n,i)=>{nr.readv(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesRead:o,buffers:a})})})};Jn.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?nr.writev(t,e,...r):new Promise((n,i)=>{nr.writev(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffers:a})})})};typeof nr.realpath.native=="function"?Jn.realpath.native=KT(nr.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var XT=v((ODe,WT)=>{"use strict";var SY=require("path");WT.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(SY.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var QT=v((xDe,p0)=>{"use strict";var YT=ir(),{checkPath:JT}=XT(),ZT=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};p0.exports.makeDir=async(t,e)=>(JT(t),YT.mkdir(t,{mode:ZT(e),recursive:!0}));p0.exports.makeDirSync=(t,e)=>(JT(t),YT.mkdirSync(t,{mode:ZT(e),recursive:!0}))});var on=v((TDe,e1)=>{"use strict";var AY=Fe().fromPromise,{makeDir:OY,makeDirSync:m0}=QT(),g0=AY(OY);e1.exports={mkdirs:g0,mkdirsSync:m0,mkdirp:g0,mkdirpSync:m0,ensureDir:g0,ensureDirSync:m0}});var Ri=v((FDe,r1)=>{"use strict";var xY=Fe().fromPromise,t1=ir();function TY(t){return t1.access(t).then(()=>!0).catch(()=>!1)}r1.exports={pathExists:xY(TY),pathExistsSync:t1.existsSync}});var y0=v((IDe,n1)=>{"use strict";var ma=ir(),FY=Fe().fromPromise;async function IY(t,e,r){let n=await ma.open(t,"r+"),i=null;try{await ma.futimes(n,e,r)}finally{try{await ma.close(n)}catch(s){i=s}}if(i)throw i}function PY(t,e,r){let n=ma.openSync(t,"r+");return ma.futimesSync(n,e,r),ma.closeSync(n)}n1.exports={utimesMillis:FY(IY),utimesMillisSync:PY}});var Us=v((PDe,a1)=>{"use strict";var ga=ir(),Nt=require("path"),i1=Fe().fromPromise;function kY(t,e,r){let n=r.dereference?i=>ga.stat(i,{bigint:!0}):i=>ga.lstat(i,{bigint:!0});return Promise.all([n(t),n(e).catch(i=>{if(i.code==="ENOENT")return null;throw i})]).then(([i,s])=>({srcStat:i,destStat:s}))}function RY(t,e,r){let n,i=r.dereference?o=>ga.statSync(o,{bigint:!0}):o=>ga.lstatSync(o,{bigint:!0}),s=i(t);try{n=i(e)}catch(o){if(o.code==="ENOENT")return{srcStat:s,destStat:null};throw o}return{srcStat:s,destStat:n}}async function NY(t,e,r,n){let{srcStat:i,destStat:s}=await kY(t,e,n);if(s){if(sc(i,s)){let o=Nt.basename(t),a=Nt.basename(e);if(r==="move"&&o!==a&&o.toLowerCase()===a.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(i.isDirectory()&&D0(t,e))throw new Error(Uh(t,e,r));return{srcStat:i,destStat:s}}function $Y(t,e,r,n){let{srcStat:i,destStat:s}=RY(t,e,n);if(s){if(sc(i,s)){let o=Nt.basename(t),a=Nt.basename(e);if(r==="move"&&o!==a&&o.toLowerCase()===a.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(i.isDirectory()&&D0(t,e))throw new Error(Uh(t,e,r));return{srcStat:i,destStat:s}}async function s1(t,e,r,n){let i=Nt.resolve(Nt.dirname(t)),s=Nt.resolve(Nt.dirname(r));if(s===i||s===Nt.parse(s).root)return;let o;try{o=await ga.stat(s,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if(sc(e,o))throw new Error(Uh(t,r,n));return s1(t,e,s,n)}function o1(t,e,r,n){let i=Nt.resolve(Nt.dirname(t)),s=Nt.resolve(Nt.dirname(r));if(s===i||s===Nt.parse(s).root)return;let o;try{o=ga.statSync(s,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if(sc(e,o))throw new Error(Uh(t,r,n));return o1(t,e,s,n)}function sc(t,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===t.ino&&e.dev===t.dev}function D0(t,e){let r=Nt.resolve(t).split(Nt.sep).filter(i=>i),n=Nt.resolve(e).split(Nt.sep).filter(i=>i);return r.every((i,s)=>n[s]===i)}function Uh(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}a1.exports={checkPaths:i1(NY),checkPathsSync:$Y,checkParentPaths:i1(s1),checkParentPathsSync:o1,isSrcSubdir:D0,areIdentical:sc}});var c1=v((kDe,u1)=>{"use strict";async function LY(t,e){let r=[];for await(let n of t)r.push(e(n).then(()=>null,i=>i??new Error("unknown error")));await Promise.all(r.map(n=>n.then(i=>{if(i!==null)throw i})))}u1.exports={asyncIteratorConcurrentProcess:LY}});var p1=v((RDe,d1)=>{"use strict";var Gt=ir(),oc=require("path"),{mkdirs:jY}=on(),{pathExists:BY}=Ri(),{utimesMillis:MY}=y0(),ac=Us(),{asyncIteratorConcurrentProcess:qY}=c1();async function UY(t,e,r={}){typeof r=="function"&&(r={filter:r}),r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
62
62
|
|
|
63
|
-
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:i}=await ac.checkPaths(t,e,"copy",r);if(await ac.checkParentPaths(t,n,e,"copy"),!await f1(t,e,r))return;let o=oc.dirname(e);await BY(o)||await jY(o),await h1(i,t,e,r)}async function f1(t,e,r){return r.filter?r.filter(t,e):!0}async function h1(t,e,r,n){let s=await(n.dereference?Gt.stat:Gt.lstat)(e);if(s.isDirectory())return GY(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return HY(s,t,e,r,n);if(s.isSymbolicLink())return KY(t,e,r,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}async function HY(t,e,r,n,i){if(!e)return l1(t,r,n,i);if(i.overwrite)return await Gt.unlink(n),l1(t,r,n,i);if(i.errorOnExist)throw new Error(`'${n}' already exists`)}async function l1(t,e,r,n){if(await Gt.copyFile(e,r),n.preserveTimestamps){VY(t.mode)&&await zY(r,t.mode);let i=await Gt.stat(e);await MY(r,i.atime,i.mtime)}return Gt.chmod(r,t.mode)}function VY(t){return(t&128)===0}function zY(t,e){return Gt.chmod(t,e|128)}async function GY(t,e,r,n,i){e||await Gt.mkdir(n),await qY(await Gt.opendir(r),async s=>{let o=oc.join(r,s.name),a=oc.join(n,s.name);if(await f1(o,a,i)){let{destStat:c}=await ac.checkPaths(o,a,"copy",i);await h1(c,o,a,i)}}),e||await Gt.chmod(n,t.mode)}async function KY(t,e,r,n){let i=await Gt.readlink(e);if(n.dereference&&(i=oc.resolve(process.cwd(),i)),!t)return Gt.symlink(i,r);let s=null;try{s=await Gt.readlink(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return Gt.symlink(i,r);throw o}if(n.dereference&&(s=oc.resolve(process.cwd(),s)),ac.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(ac.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return await Gt.unlink(r),Gt.symlink(i,r)}d1.exports=UY});var w1=v((
|
|
63
|
+
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:i}=await ac.checkPaths(t,e,"copy",r);if(await ac.checkParentPaths(t,n,e,"copy"),!await f1(t,e,r))return;let o=oc.dirname(e);await BY(o)||await jY(o),await h1(i,t,e,r)}async function f1(t,e,r){return r.filter?r.filter(t,e):!0}async function h1(t,e,r,n){let s=await(n.dereference?Gt.stat:Gt.lstat)(e);if(s.isDirectory())return GY(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return HY(s,t,e,r,n);if(s.isSymbolicLink())return KY(t,e,r,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}async function HY(t,e,r,n,i){if(!e)return l1(t,r,n,i);if(i.overwrite)return await Gt.unlink(n),l1(t,r,n,i);if(i.errorOnExist)throw new Error(`'${n}' already exists`)}async function l1(t,e,r,n){if(await Gt.copyFile(e,r),n.preserveTimestamps){VY(t.mode)&&await zY(r,t.mode);let i=await Gt.stat(e);await MY(r,i.atime,i.mtime)}return Gt.chmod(r,t.mode)}function VY(t){return(t&128)===0}function zY(t,e){return Gt.chmod(t,e|128)}async function GY(t,e,r,n,i){e||await Gt.mkdir(n),await qY(await Gt.opendir(r),async s=>{let o=oc.join(r,s.name),a=oc.join(n,s.name);if(await f1(o,a,i)){let{destStat:c}=await ac.checkPaths(o,a,"copy",i);await h1(c,o,a,i)}}),e||await Gt.chmod(n,t.mode)}async function KY(t,e,r,n){let i=await Gt.readlink(e);if(n.dereference&&(i=oc.resolve(process.cwd(),i)),!t)return Gt.symlink(i,r);let s=null;try{s=await Gt.readlink(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return Gt.symlink(i,r);throw o}if(n.dereference&&(s=oc.resolve(process.cwd(),s)),ac.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(ac.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return await Gt.unlink(r),Gt.symlink(i,r)}d1.exports=UY});var w1=v((NDe,D1)=>{"use strict";var sr=gt(),uc=require("path"),WY=on().mkdirsSync,XY=y0().utimesMillisSync,cc=Us();function YY(t,e,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
64
64
|
|
|
65
|
-
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:i}=cc.checkPathsSync(t,e,"copy",r);if(cc.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let s=uc.dirname(e);return sr.existsSync(s)||WY(s),m1(i,t,e,r)}function m1(t,e,r,n){let s=(n.dereference?sr.statSync:sr.lstatSync)(e);if(s.isDirectory())return nJ(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return JY(s,t,e,r,n);if(s.isSymbolicLink())return oJ(t,e,r,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}function JY(t,e,r,n,i){return e?ZY(t,r,n,i):g1(t,r,n,i)}function ZY(t,e,r,n){if(n.overwrite)return sr.unlinkSync(r),g1(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function g1(t,e,r,n){return sr.copyFileSync(e,r),n.preserveTimestamps&&QY(t.mode,e,r),w0(r,t.mode)}function QY(t,e,r){return eJ(t)&&tJ(r,t),rJ(e,r)}function eJ(t){return(t&128)===0}function tJ(t,e){return w0(t,e|128)}function w0(t,e){return sr.chmodSync(t,e)}function rJ(t,e){let r=sr.statSync(t);return XY(e,r.atime,r.mtime)}function nJ(t,e,r,n,i){return e?y1(r,n,i):iJ(t.mode,r,n,i)}function iJ(t,e,r,n){return sr.mkdirSync(r),y1(e,r,n),w0(r,t)}function y1(t,e,r){let n=sr.opendirSync(t);try{let i;for(;(i=n.readSync())!==null;)sJ(i.name,t,e,r)}finally{n.closeSync()}}function sJ(t,e,r,n){let i=uc.join(e,t),s=uc.join(r,t);if(n.filter&&!n.filter(i,s))return;let{destStat:o}=cc.checkPathsSync(i,s,"copy",n);return m1(o,i,s,n)}function oJ(t,e,r,n){let i=sr.readlinkSync(e);if(n.dereference&&(i=uc.resolve(process.cwd(),i)),t){let s;try{s=sr.readlinkSync(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return sr.symlinkSync(i,r);throw o}if(n.dereference&&(s=uc.resolve(process.cwd(),s)),cc.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(cc.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return aJ(i,r)}else return sr.symlinkSync(i,r)}function aJ(t,e){return sr.unlinkSync(e),sr.symlinkSync(t,e)}D1.exports=YY});var Hh=v((
|
|
66
|
-
`,finalEOL:r=!0,replacer:n=null,spaces:i}={}){let s=r?e:"";return JSON.stringify(t,n,i).replace(/\n/g,e)+s}function jJ(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}nF.exports={stringify:LJ,stripBom:jJ}});var b0=v((zDe,oF)=>{var Da;try{Da=gt()}catch{Da=require("fs")}var Vh=Fe(),{stringify:iF,stripBom:sF}=ya();async function BJ(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Da,n="throws"in e?e.throws:!0,i=await Vh.fromCallback(r.readFile)(t,e);i=sF(i);let s;try{s=JSON.parse(i,e?e.reviver:null)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}return s}var MJ=Vh.fromPromise(BJ);function qJ(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Da,n="throws"in e?e.throws:!0;try{let i=r.readFileSync(t,e);return i=sF(i),JSON.parse(i,e.reviver)}catch(i){if(n)throw i.message=`${t}: ${i.message}`,i;return null}}async function UJ(t,e,r={}){let n=r.fs||Da,i=iF(e,r);await Vh.fromCallback(n.writeFile)(t,i,r)}var HJ=Vh.fromPromise(UJ);function VJ(t,e,r={}){let n=r.fs||Da,i=iF(e,r);return n.writeFileSync(t,i,r)}oF.exports={readFile:MJ,readFileSync:qJ,writeFile:HJ,writeFileSync:VJ}});var uF=v((GDe,aF)=>{"use strict";var zh=b0();aF.exports={readJson:zh.readFile,readJsonSync:zh.readFileSync,writeJson:zh.writeFile,writeJsonSync:zh.writeFileSync}});var Gh=v((KDe,fF)=>{"use strict";var zJ=Fe().fromPromise,v0=ir(),cF=require("path"),lF=on(),GJ=Ri().pathExists;async function KJ(t,e,r="utf-8"){let n=cF.dirname(t);return await GJ(n)||await lF.mkdirs(n),v0.writeFile(t,e,r)}function WJ(t,...e){let r=cF.dirname(t);v0.existsSync(r)||lF.mkdirsSync(r),v0.writeFileSync(t,...e)}fF.exports={outputFile:zJ(KJ),outputFileSync:WJ}});var dF=v((WDe,hF)=>{"use strict";var{stringify:XJ}=ya(),{outputFile:YJ}=Gh();async function JJ(t,e,r={}){let n=XJ(e,r);await YJ(t,n,r)}hF.exports=JJ});var mF=v((XDe,pF)=>{"use strict";var{stringify:ZJ}=ya(),{outputFileSync:QJ}=Gh();function eZ(t,e,r){let n=ZJ(e,r);QJ(t,n,r)}pF.exports=eZ});var yF=v((YDe,gF)=>{"use strict";var tZ=Fe().fromPromise,or=uF();or.outputJson=tZ(dF());or.outputJsonSync=mF();or.outputJSON=or.outputJson;or.outputJSONSync=or.outputJsonSync;or.writeJSON=or.writeJson;or.writeJSONSync=or.writeJsonSync;or.readJSON=or.readJson;or.readJSONSync=or.readJsonSync;gF.exports=or});var EF=v((JDe,vF)=>{"use strict";var rZ=ir(),DF=require("path"),{copy:nZ}=Hh(),{remove:bF}=lc(),{mkdirp:iZ}=on(),{pathExists:sZ}=Ri(),wF=Us();async function oZ(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await wF.checkPaths(t,e,"move",r);await wF.checkParentPaths(t,i,e,"move");let o=DF.dirname(e);return DF.parse(o).root!==o&&await iZ(o),aZ(t,e,n,s)}async function aZ(t,e,r,n){if(!n){if(r)await bF(e);else if(await sZ(e))throw new Error("dest already exists.")}try{await rZ.rename(t,e)}catch(i){if(i.code!=="EXDEV")throw i;await uZ(t,e,r)}}async function uZ(t,e,r){return await nZ(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),bF(t)}vF.exports=oZ});var OF=v((ZDe,AF)=>{"use strict";var CF=gt(),_0=require("path"),cZ=Hh().copySync,SF=lc().removeSync,lZ=on().mkdirpSync,_F=Us();function fZ(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:i,isChangingCase:s=!1}=_F.checkPathsSync(t,e,"move",r);return _F.checkParentPathsSync(t,i,e,"move"),hZ(e)||lZ(_0.dirname(e)),dZ(t,e,n,s)}function hZ(t){let e=_0.dirname(t);return _0.parse(e).root===e}function dZ(t,e,r,n){if(n)return E0(t,e,r);if(r)return SF(e),E0(t,e,r);if(CF.existsSync(e))throw new Error("dest already exists.");return E0(t,e,r)}function E0(t,e,r){try{CF.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return pZ(t,e,r)}}function pZ(t,e,r){return cZ(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),SF(t)}AF.exports=fZ});var TF=v((QDe,xF)=>{"use strict";var mZ=Fe().fromPromise;xF.exports={move:mZ(EF()),moveSync:OF()}});var wa=v((e0e,FF)=>{"use strict";FF.exports={...ir(),...Hh(),...F1(),...rF(),...yF(),...on(),...TF(),...Gh(),...Ri(),...lc()}});var LF=v((t0e,$F)=>{"use strict";var C0,PF,kF,RF,NF=!0;typeof process<"u"&&({FORCE_COLOR:C0,NODE_DISABLE_COLORS:PF,NO_COLOR:kF,TERM:RF}=process.env||{},NF=process.stdout&&process.stdout.isTTY);var Re={enabled:!PF&&kF==null&&RF!=="dumb"&&(C0!=null&&C0!=="0"||NF),reset:Ge(0,0),bold:Ge(1,22),dim:Ge(2,22),italic:Ge(3,23),underline:Ge(4,24),inverse:Ge(7,27),hidden:Ge(8,28),strikethrough:Ge(9,29),black:Ge(30,39),red:Ge(31,39),green:Ge(32,39),yellow:Ge(33,39),blue:Ge(34,39),magenta:Ge(35,39),cyan:Ge(36,39),white:Ge(37,39),gray:Ge(90,39),grey:Ge(90,39),bgBlack:Ge(40,49),bgRed:Ge(41,49),bgGreen:Ge(42,49),bgYellow:Ge(43,49),bgBlue:Ge(44,49),bgMagenta:Ge(45,49),bgCyan:Ge(46,49),bgWhite:Ge(47,49)};function IF(t,e){let r=0,n,i="",s="";for(;r<t.length;r++)n=t[r],i+=n.open,s+=n.close,~e.indexOf(n.close)&&(e=e.replace(n.rgx,n.close+n.open));return i+e+s}function gZ(t,e){let r={has:t,keys:e};return r.reset=Re.reset.bind(r),r.bold=Re.bold.bind(r),r.dim=Re.dim.bind(r),r.italic=Re.italic.bind(r),r.underline=Re.underline.bind(r),r.inverse=Re.inverse.bind(r),r.hidden=Re.hidden.bind(r),r.strikethrough=Re.strikethrough.bind(r),r.black=Re.black.bind(r),r.red=Re.red.bind(r),r.green=Re.green.bind(r),r.yellow=Re.yellow.bind(r),r.blue=Re.blue.bind(r),r.magenta=Re.magenta.bind(r),r.cyan=Re.cyan.bind(r),r.white=Re.white.bind(r),r.gray=Re.gray.bind(r),r.grey=Re.grey.bind(r),r.bgBlack=Re.bgBlack.bind(r),r.bgRed=Re.bgRed.bind(r),r.bgGreen=Re.bgGreen.bind(r),r.bgYellow=Re.bgYellow.bind(r),r.bgBlue=Re.bgBlue.bind(r),r.bgMagenta=Re.bgMagenta.bind(r),r.bgCyan=Re.bgCyan.bind(r),r.bgWhite=Re.bgWhite.bind(r),r}function Ge(t,e){let r={open:`\x1B[${t}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(n){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(t)||(this.has.push(t),this.keys.push(r)),n===void 0?this:Re.enabled?IF(this.keys,n+""):n+""):n===void 0?gZ([t],[r]):Re.enabled?IF([r],n+""):n+""}}$F.exports=Re});var ba=v(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.ancillary=vt.failure=vt.success=vt.input=vt.weak=vt.strong=void 0;var yZ=(fe(),ue(le)),vn=yZ.__importDefault(LF());vt.strong=vn.default.bold;vt.weak=vn.default.dim;vt.input=vn.default.cyan;vt.success=vn.default.green;vt.failure=vn.default.red;vt.ancillary=vn.default.cyan;var DZ={strong:vt.strong,weak:vt.weak,input:vt.input,success:vt.success,failure:vt.failure,ancillary:vt.ancillary,log:{DEBUG:vn.default.magenta,INFO:vn.default.cyan,WARN:vn.default.yellow,ERROR:vn.default.red}};vt.default=DZ});var S0=v(Kh=>{"use strict";Object.defineProperty(Kh,"__esModule",{value:!0});Kh.EscapeCode=void 0;var an="\x1B[",$t=class{};Kh.EscapeCode=$t;$t.cursorLeft=()=>`${an}G`;$t.cursorUp=(t=1)=>`${an}${t}A`;$t.cursorDown=(t=1)=>`${an}${t}B`;$t.cursorForward=(t=1)=>`${an}${t}C`;$t.cursorBackward=(t=1)=>`${an}${t}D`;$t.cursorHide=()=>`${an}?25l`;$t.cursorShow=()=>`${an}?25h`;$t.eraseLine=()=>`${an}2K`;$t.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=$t.eraseLine(),r<t-1&&(e+=$t.cursorUp());return`${e}${$t.cursorLeft()}`};$t.eraseUp=()=>`${an}1J`;$t.eraseDown=()=>`${an}J`;$t.eraseScreen=()=>`${an}2J`});var BF=v(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.Cursor=void 0;var wZ=(fe(),ue(le)),bZ=wZ.__importDefault(Ih()),jF=S0(),va=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(jF.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,bZ.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(jF.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};Wh.Cursor=va;va.stream=process.stderr;va._isVisible=!0;va._listenerAttached=!1});var O0=v((s0e,A0)=>{"use strict";var MF=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);A0.exports=MF;A0.exports.default=MF});var HF=v((o0e,UF)=>{"use strict";var qF="[\uD800-\uDBFF][\uDC00-\uDFFF]",vZ=t=>t&&t.exact?new RegExp(`^${qF}$`):new RegExp(qF,"g");UF.exports=vZ});var zF=v((a0e,VF)=>{"use strict";VF.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var x0=v((u0e,KF)=>{var hc=zF(),GF={};for(let t of Object.keys(hc))GF[hc[t]]=t;var re={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};KF.exports=re;for(let t of Object.keys(re)){if(!("channels"in re[t]))throw new Error("missing channels property: "+t);if(!("labels"in re[t]))throw new Error("missing channel labels property: "+t);if(re[t].labels.length!==re[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=re[t];delete re[t].channels,delete re[t].labels,Object.defineProperty(re[t],"channels",{value:e}),Object.defineProperty(re[t],"labels",{value:r})}re.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.min(e,r,n),s=Math.max(e,r,n),o=s-i,a,u;s===i?a=0:e===s?a=(r-n)/o:r===s?a=2+(n-e)/o:n===s&&(a=4+(e-r)/o),a=Math.min(a*60,360),a<0&&(a+=360);let c=(i+s)/2;return s===i?u=0:c<=.5?u=o/(s+i):u=o/(2-s-i),[a,u*100,c*100]};re.rgb.hsv=function(t){let e,r,n,i,s,o=t[0]/255,a=t[1]/255,u=t[2]/255,c=Math.max(o,a,u),l=c-Math.min(o,a,u),h=function(d){return(c-d)/6/l+1/2};return l===0?(i=0,s=0):(s=l/c,e=h(o),r=h(a),n=h(u),o===c?i=n-r:a===c?i=1/3+e-n:u===c&&(i=2/3+r-e),i<0?i+=1:i>1&&(i-=1)),[i*360,s*100,c*100]};re.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],i=re.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[i,s*100,n*100]};re.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.min(1-e,1-r,1-n),s=(1-e-i)/(1-i)||0,o=(1-r-i)/(1-i)||0,a=(1-n-i)/(1-i)||0;return[s*100,o*100,a*100,i*100]};function EZ(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}re.rgb.keyword=function(t){let e=GF[t];if(e)return e;let r=1/0,n;for(let i of Object.keys(hc)){let s=hc[i],o=EZ(t,s);o<r&&(r=o,n=i)}return n};re.keyword.rgb=function(t){return hc[t]};re.rgb.xyz=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;let i=e*.4124+r*.3576+n*.1805,s=e*.2126+r*.7152+n*.0722,o=e*.0193+r*.1192+n*.9505;return[i*100,s*100,o*100]};re.rgb.lab=function(t){let e=re.rgb.xyz(t),r=e[0],n=e[1],i=e[2];r/=95.047,n/=100,i/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let s=116*n-16,o=500*(r-n),a=200*(n-i);return[s,o,a]};re.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,i,s,o;if(r===0)return o=n*255,[o,o,o];n<.5?i=n*(1+r):i=n+r-n*r;let a=2*n-i,u=[0,0,0];for(let c=0;c<3;c++)s=e+1/3*-(c-1),s<0&&s++,s>1&&s--,6*s<1?o=a+(i-a)*6*s:2*s<1?o=i:3*s<2?o=a+(i-a)*(2/3-s)*6:o=a,u[c]=o*255;return u};re.hsl.hsv=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,i=r,s=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,i*=s<=1?s:2-s;let o=(n+r)/2,a=n===0?2*i/(s+i):2*r/(n+r);return[e,a*100,o*100]};re.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,n=t[2]/100,i=Math.floor(e)%6,s=e-Math.floor(e),o=255*n*(1-r),a=255*n*(1-r*s),u=255*n*(1-r*(1-s));switch(n*=255,i){case 0:return[n,u,o];case 1:return[a,n,o];case 2:return[o,n,u];case 3:return[o,a,n];case 4:return[u,o,n];case 5:return[n,o,a]}};re.hsv.hsl=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,i=Math.max(n,.01),s,o;o=(2-r)*n;let a=(2-r)*i;return s=r*i,s/=a<=1?a:2-a,s=s||0,o/=2,[e,s*100,o*100]};re.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,i=r+n,s;i>1&&(r/=i,n/=i);let o=Math.floor(6*e),a=1-n;s=6*e-o,(o&1)!==0&&(s=1-s);let u=r+s*(a-r),c,l,h;switch(o){default:case 6:case 0:c=a,l=u,h=r;break;case 1:c=u,l=a,h=r;break;case 2:c=r,l=a,h=u;break;case 3:c=r,l=u,h=a;break;case 4:c=u,l=r,h=a;break;case 5:c=a,l=r,h=u;break}return[c*255,l*255,h*255]};re.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,i=t[3]/100,s=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,r*(1-i)+i),a=1-Math.min(1,n*(1-i)+i);return[s*255,o*255,a*255]};re.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,i,s,o;return i=e*3.2406+r*-1.5372+n*-.4986,s=e*-.9689+r*1.8758+n*.0415,o=e*.0557+r*-.204+n*1.057,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),[i*255,s*255,o*255]};re.xyz.lab=function(t){let e=t[0],r=t[1],n=t[2];e/=95.047,r/=100,n/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let i=116*r-16,s=500*(e-r),o=200*(r-n);return[i,s,o]};re.lab.xyz=function(t){let e=t[0],r=t[1],n=t[2],i,s,o;s=(e+16)/116,i=r/500+s,o=s-n/200;let a=s**3,u=i**3,c=o**3;return s=a>.008856?a:(s-16/116)/7.787,i=u>.008856?u:(i-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,i*=95.047,s*=100,o*=108.883,[i,s,o]};re.lab.lch=function(t){let e=t[0],r=t[1],n=t[2],i;i=Math.atan2(n,r)*360/2/Math.PI,i<0&&(i+=360);let o=Math.sqrt(r*r+n*n);return[e,o,i]};re.lch.lab=function(t){let e=t[0],r=t[1],i=t[2]/360*2*Math.PI,s=r*Math.cos(i),o=r*Math.sin(i);return[e,s,o]};re.rgb.ansi16=function(t,e=null){let[r,n,i]=t,s=e===null?re.rgb.hsv(t)[2]:e;if(s=Math.round(s/50),s===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return s===2&&(o+=60),o};re.hsv.ansi16=function(t){return re.rgb.ansi16(re.hsv.rgb(t),t[2])};re.rgb.ansi256=function(t){let e=t[0],r=t[1],n=t[2];return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};re.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let r=(~~(t>50)+1)*.5,n=(e&1)*r*255,i=(e>>1&1)*r*255,s=(e>>2&1)*r*255;return[n,i,s]};re.ansi256.rgb=function(t){if(t>=232){let s=(t-232)*10+8;return[s,s,s]}t-=16;let e,r=Math.floor(t/36)/5*255,n=Math.floor((e=t%36)/6)/5*255,i=e%6/5*255;return[r,n,i]};re.rgb.hex=function(t){let r=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};re.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];e[0].length===3&&(r=r.split("").map(a=>a+a).join(""));let n=parseInt(r,16),i=n>>16&255,s=n>>8&255,o=n&255;return[i,s,o]};re.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.max(Math.max(e,r),n),s=Math.min(Math.min(e,r),n),o=i-s,a,u;return o<1?a=s/(1-o):a=0,o<=0?u=0:i===e?u=(r-n)/o%6:i===r?u=2+(n-e)/o:u=4+(e-r)/o,u/=6,u%=1,[u*360,o*100,a*100]};re.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r),i=0;return n<1&&(i=(r-.5*n)/(1-n)),[t[0],n*100,i*100]};re.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=e*r,i=0;return n<1&&(i=(r-n)/(1-n)),[t[0],n*100,i*100]};re.hcg.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100;if(r===0)return[n*255,n*255,n*255];let i=[0,0,0],s=e%1*6,o=s%1,a=1-o,u=0;switch(Math.floor(s)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=a,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=a,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=a}return u=(1-r)*n,[(r*i[0]+u)*255,(r*i[1]+u)*255,(r*i[2]+u)*255]};re.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e),i=0;return n>0&&(i=e/n),[t[0],i*100,n*100]};re.hcg.hsl=function(t){let e=t[1]/100,n=t[2]/100*(1-e)+.5*e,i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],i*100,n*100]};re.hcg.hwb=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e);return[t[0],(n-e)*100,(1-n)*100]};re.hwb.hcg=function(t){let e=t[1]/100,n=1-t[2]/100,i=n-e,s=0;return i<1&&(s=(n-i)/(1-i)),[t[0],i*100,s*100]};re.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};re.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};re.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};re.gray.hsl=function(t){return[0,0,t[0]]};re.gray.hsv=re.gray.hsl;re.gray.hwb=function(t){return[0,100,t[0]]};re.gray.cmyk=function(t){return[0,0,0,t[0]]};re.gray.lab=function(t){return[t[0],0,0]};re.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n};re.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var XF=v((c0e,WF)=>{var Xh=x0();function _Z(){let t={},e=Object.keys(Xh);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function CZ(t){let e=_Z(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),i=Object.keys(Xh[n]);for(let s=i.length,o=0;o<s;o++){let a=i[o],u=e[a];u.distance===-1&&(u.distance=e[n].distance+1,u.parent=n,r.unshift(a))}}return e}function SZ(t,e){return function(r){return e(t(r))}}function AZ(t,e){let r=[e[t].parent,t],n=Xh[e[t].parent][t],i=e[t].parent;for(;e[i].parent;)r.unshift(e[i].parent),n=SZ(Xh[e[i].parent][i],n),i=e[i].parent;return n.conversion=r,n}WF.exports=function(t){let e=CZ(t),r={},n=Object.keys(e);for(let i=n.length,s=0;s<i;s++){let o=n[s];e[o].parent!==null&&(r[o]=AZ(o,e))}return r}});var JF=v((l0e,YF)=>{var T0=x0(),OZ=XF(),Ea={},xZ=Object.keys(T0);function TZ(t){let e=function(...r){let n=r[0];return n==null?n:(n.length>1&&(r=n),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function FZ(t){let e=function(...r){let n=r[0];if(n==null)return n;n.length>1&&(r=n);let i=t(r);if(typeof i=="object")for(let s=i.length,o=0;o<s;o++)i[o]=Math.round(i[o]);return i};return"conversion"in t&&(e.conversion=t.conversion),e}xZ.forEach(t=>{Ea[t]={},Object.defineProperty(Ea[t],"channels",{value:T0[t].channels}),Object.defineProperty(Ea[t],"labels",{value:T0[t].labels});let e=OZ(t);Object.keys(e).forEach(n=>{let i=e[n];Ea[t][n]=FZ(i),Ea[t][n].raw=TZ(i)})});YF.exports=Ea});var I0=v((f0e,rI)=>{"use strict";var ZF=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,QF=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},eI=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},Yh=t=>t,tI=(t,e,r)=>[t,e,r],_a=(t,e,r)=>{Object.defineProperty(t,e,{get:()=>{let n=r();return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0}),n},enumerable:!0,configurable:!0})},F0,Ca=(t,e,r,n)=>{F0===void 0&&(F0=JF());let i=n?10:0,s={};for(let[o,a]of Object.entries(F0)){let u=o==="ansi16"?"ansi":o;o===e?s[u]=t(r,i):typeof a=="object"&&(s[u]=t(a[e],i))}return s};function IZ(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],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],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],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[i,s]of Object.entries(n))e[i]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},n[i]=e[i],t.set(s[0],s[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",_a(e.color,"ansi",()=>Ca(ZF,"ansi16",Yh,!1)),_a(e.color,"ansi256",()=>Ca(QF,"ansi256",Yh,!1)),_a(e.color,"ansi16m",()=>Ca(eI,"rgb",tI,!1)),_a(e.bgColor,"ansi",()=>Ca(ZF,"ansi16",Yh,!0)),_a(e.bgColor,"ansi256",()=>Ca(QF,"ansi256",Yh,!0)),_a(e.bgColor,"ansi16m",()=>Ca(eI,"rgb",tI,!0)),e}Object.defineProperty(rI,"exports",{enumerable:!0,get:IZ})});var aI=v((h0e,oI)=>{"use strict";var PZ=O0(),kZ=HF(),nI=I0(),sI=["\x1B","\x9B"],Jh=t=>`${sI[0]}[${t}m`,iI=(t,e,r)=>{let n=[];t=[...t];for(let i of t){let s=i;i.includes(";")&&(i=i.split(";")[0][0]+"0");let o=nI.codes.get(Number.parseInt(i,10));if(o){let a=t.indexOf(o.toString());a===-1?n.push(Jh(e?o:s)):t.splice(a,1)}else if(e){n.push(Jh(0));break}else n.push(Jh(s))}if(e&&(n=n.filter((i,s)=>n.indexOf(i)===s),r!==void 0)){let i=Jh(nI.codes.get(Number.parseInt(r,10)));n=n.reduce((s,o)=>o===i?[o,...s]:[...s,o],[])}return n.join("")};oI.exports=(t,e,r)=>{let n=[...t],i=[],s=typeof r=="number"?r:n.length,o=!1,a,u=0,c="";for(let[l,h]of n.entries()){let d=!1;if(sI.includes(h)){let f=/\d[^m]*/.exec(t.slice(l,l+18));a=f&&f.length>0?f[0]:void 0,u<s&&(o=!0,a!==void 0&&i.push(a))}else o&&h==="m"&&(o=!1,d=!0);if(!o&&!d&&u++,!kZ({exact:!0}).test(h)&&PZ(h.codePointAt())&&(u++,typeof r!="number"&&s++),u>e&&u<=s)c+=h;else if(u===e&&!o&&a!==void 0)c=iI(i);else if(u>=s){c+=iI(i,!0,a);break}}return c}});var cI=v((d0e,uI)=>{"use strict";uI.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var Zh=v((p0e,lI)=>{"use strict";var RZ=cI();lI.exports=t=>typeof t=="string"?t.replace(RZ(),""):t});var hI=v((m0e,fI)=>{"use strict";fI.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var k0=v((g0e,P0)=>{"use strict";var NZ=Zh(),$Z=O0(),LZ=hI(),dI=t=>{if(typeof t!="string"||t.length===0||(t=NZ(t),t.length===0))return 0;t=t.replace(LZ()," ");let e=0;for(let r=0;r<t.length;r++){let n=t.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,e+=$Z(n)?2:1)}return e};P0.exports=dI;P0.exports.default=dI});var wI=v((y0e,DI)=>{"use strict";var dc=k0(),jZ=Zh(),BZ=I0(),Qh=new Set(["\x1B","\x9B"]),MZ=39,N0="\x07",gI="[",qZ="]",yI="m",$0=`${qZ}8;;`,pI=t=>`${Qh.values().next().value}${gI}${t}${yI}`,mI=t=>`${Qh.values().next().value}${$0}${t}${N0}`,UZ=t=>t.split(" ").map(e=>dc(e)),R0=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=dc(jZ(t[t.length-1]));for(let[a,u]of n.entries()){let c=dc(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),Qh.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith($0)),i){s?u===N0&&(i=!1,s=!1):u===yI&&(i=!1);continue}o+=c,o===r&&a<n.length-1&&(t.push(""),o=0)}!o&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},HZ=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(dc(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},VZ=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,s,o=UZ(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let h=dc(a[a.length-1]);if(c!==0&&(h>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),h=0),(h>0||r.trim===!1)&&(a[a.length-1]+=" ",h++)),r.hard&&o[c]>e){let d=e-h,f=1+Math.floor((o[c]-d-1)/e);Math.floor((o[c]-1)/e)<f&&a.push(""),R0(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){R0(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){R0(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(HZ));let u=[...a.join(`
|
|
65
|
+
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:i}=cc.checkPathsSync(t,e,"copy",r);if(cc.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let s=uc.dirname(e);return sr.existsSync(s)||WY(s),m1(i,t,e,r)}function m1(t,e,r,n){let s=(n.dereference?sr.statSync:sr.lstatSync)(e);if(s.isDirectory())return nJ(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return JY(s,t,e,r,n);if(s.isSymbolicLink())return oJ(t,e,r,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}function JY(t,e,r,n,i){return e?ZY(t,r,n,i):g1(t,r,n,i)}function ZY(t,e,r,n){if(n.overwrite)return sr.unlinkSync(r),g1(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function g1(t,e,r,n){return sr.copyFileSync(e,r),n.preserveTimestamps&&QY(t.mode,e,r),w0(r,t.mode)}function QY(t,e,r){return eJ(t)&&tJ(r,t),rJ(e,r)}function eJ(t){return(t&128)===0}function tJ(t,e){return w0(t,e|128)}function w0(t,e){return sr.chmodSync(t,e)}function rJ(t,e){let r=sr.statSync(t);return XY(e,r.atime,r.mtime)}function nJ(t,e,r,n,i){return e?y1(r,n,i):iJ(t.mode,r,n,i)}function iJ(t,e,r,n){return sr.mkdirSync(r),y1(e,r,n),w0(r,t)}function y1(t,e,r){let n=sr.opendirSync(t);try{let i;for(;(i=n.readSync())!==null;)sJ(i.name,t,e,r)}finally{n.closeSync()}}function sJ(t,e,r,n){let i=uc.join(e,t),s=uc.join(r,t);if(n.filter&&!n.filter(i,s))return;let{destStat:o}=cc.checkPathsSync(i,s,"copy",n);return m1(o,i,s,n)}function oJ(t,e,r,n){let i=sr.readlinkSync(e);if(n.dereference&&(i=uc.resolve(process.cwd(),i)),t){let s;try{s=sr.readlinkSync(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return sr.symlinkSync(i,r);throw o}if(n.dereference&&(s=uc.resolve(process.cwd(),s)),cc.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(cc.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return aJ(i,r)}else return sr.symlinkSync(i,r)}function aJ(t,e){return sr.unlinkSync(e),sr.symlinkSync(t,e)}D1.exports=YY});var Hh=v(($De,b1)=>{"use strict";var uJ=Fe().fromPromise;b1.exports={copy:uJ(p1()),copySync:w1()}});var lc=v((LDe,E1)=>{"use strict";var v1=gt(),cJ=Fe().fromCallback;function lJ(t,e){v1.rm(t,{recursive:!0,force:!0},e)}function fJ(t){v1.rmSync(t,{recursive:!0,force:!0})}E1.exports={remove:cJ(lJ),removeSync:fJ}});var F1=v((jDe,T1)=>{"use strict";var hJ=Fe().fromPromise,S1=ir(),A1=require("path"),O1=on(),x1=lc(),_1=hJ(async function(e){let r;try{r=await S1.readdir(e)}catch{return O1.mkdirs(e)}return Promise.all(r.map(n=>x1.remove(A1.join(e,n))))});function C1(t){let e;try{e=S1.readdirSync(t)}catch{return O1.mkdirsSync(t)}e.forEach(r=>{r=A1.join(t,r),x1.removeSync(r)})}T1.exports={emptyDirSync:C1,emptydirSync:C1,emptyDir:_1,emptydir:_1}});var R1=v((BDe,k1)=>{"use strict";var dJ=Fe().fromPromise,I1=require("path"),Zn=ir(),P1=on();async function pJ(t){let e;try{e=await Zn.stat(t)}catch{}if(e&&e.isFile())return;let r=I1.dirname(t),n=null;try{n=await Zn.stat(r)}catch(i){if(i.code==="ENOENT"){await P1.mkdirs(r),await Zn.writeFile(t,"");return}else throw i}n.isDirectory()?await Zn.writeFile(t,""):await Zn.readdir(r)}function mJ(t){let e;try{e=Zn.statSync(t)}catch{}if(e&&e.isFile())return;let r=I1.dirname(t);try{Zn.statSync(r).isDirectory()||Zn.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")P1.mkdirsSync(r);else throw n}Zn.writeFileSync(t,"")}k1.exports={createFile:dJ(pJ),createFileSync:mJ}});var B1=v((MDe,j1)=>{"use strict";var gJ=Fe().fromPromise,N1=require("path"),Ni=ir(),$1=on(),{pathExists:yJ}=Ri(),{areIdentical:L1}=Us();async function DJ(t,e){let r;try{r=await Ni.lstat(e)}catch{}let n;try{n=await Ni.lstat(t)}catch(o){throw o.message=o.message.replace("lstat","ensureLink"),o}if(r&&L1(n,r))return;let i=N1.dirname(e);await yJ(i)||await $1.mkdirs(i),await Ni.link(t,e)}function wJ(t,e){let r;try{r=Ni.lstatSync(e)}catch{}try{let s=Ni.lstatSync(t);if(r&&L1(s,r))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=N1.dirname(e);return Ni.existsSync(n)||$1.mkdirsSync(n),Ni.linkSync(t,e)}j1.exports={createLink:gJ(DJ),createLinkSync:wJ}});var q1=v((qDe,M1)=>{"use strict";var $i=require("path"),fc=ir(),{pathExists:bJ}=Ri(),vJ=Fe().fromPromise;async function EJ(t,e){if($i.isAbsolute(t)){try{await fc.lstat(t)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:t,toDst:t}}let r=$i.dirname(e),n=$i.join(r,t);if(await bJ(n))return{toCwd:n,toDst:t};try{await fc.lstat(t)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:t,toDst:$i.relative(r,t)}}function _J(t,e){if($i.isAbsolute(t)){if(!fc.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}let r=$i.dirname(e),n=$i.join(r,t);if(fc.existsSync(n))return{toCwd:n,toDst:t};if(!fc.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:$i.relative(r,t)}}M1.exports={symlinkPaths:vJ(EJ),symlinkPathsSync:_J}});var V1=v((UDe,H1)=>{"use strict";var U1=ir(),CJ=Fe().fromPromise;async function SJ(t,e){if(e)return e;let r;try{r=await U1.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function AJ(t,e){if(e)return e;let r;try{r=U1.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}H1.exports={symlinkType:CJ(SJ),symlinkTypeSync:AJ}});var W1=v((HDe,K1)=>{"use strict";var OJ=Fe().fromPromise,z1=require("path"),bn=ir(),{mkdirs:xJ,mkdirsSync:TJ}=on(),{symlinkPaths:FJ,symlinkPathsSync:IJ}=q1(),{symlinkType:PJ,symlinkTypeSync:kJ}=V1(),{pathExists:RJ}=Ri(),{areIdentical:G1}=Us();async function NJ(t,e,r){let n;try{n=await bn.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[a,u]=await Promise.all([bn.stat(t),bn.stat(e)]);if(G1(a,u))return}let i=await FJ(t,e);t=i.toDst;let s=await PJ(i.toCwd,r),o=z1.dirname(e);return await RJ(o)||await xJ(o),bn.symlink(t,e,s)}function $J(t,e,r){let n;try{n=bn.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let a=bn.statSync(t),u=bn.statSync(e);if(G1(a,u))return}let i=IJ(t,e);t=i.toDst,r=kJ(i.toCwd,r);let s=z1.dirname(e);return bn.existsSync(s)||TJ(s),bn.symlinkSync(t,e,r)}K1.exports={createSymlink:OJ(NJ),createSymlinkSync:$J}});var rF=v((VDe,tF)=>{"use strict";var{createFile:X1,createFileSync:Y1}=R1(),{createLink:J1,createLinkSync:Z1}=B1(),{createSymlink:Q1,createSymlinkSync:eF}=W1();tF.exports={createFile:X1,createFileSync:Y1,ensureFile:X1,ensureFileSync:Y1,createLink:J1,createLinkSync:Z1,ensureLink:J1,ensureLinkSync:Z1,createSymlink:Q1,createSymlinkSync:eF,ensureSymlink:Q1,ensureSymlinkSync:eF}});var ya=v((zDe,nF)=>{function LJ(t,{EOL:e=`
|
|
66
|
+
`,finalEOL:r=!0,replacer:n=null,spaces:i}={}){let s=r?e:"";return JSON.stringify(t,n,i).replace(/\n/g,e)+s}function jJ(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}nF.exports={stringify:LJ,stripBom:jJ}});var b0=v((GDe,oF)=>{var Da;try{Da=gt()}catch{Da=require("fs")}var Vh=Fe(),{stringify:iF,stripBom:sF}=ya();async function BJ(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Da,n="throws"in e?e.throws:!0,i=await Vh.fromCallback(r.readFile)(t,e);i=sF(i);let s;try{s=JSON.parse(i,e?e.reviver:null)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}return s}var MJ=Vh.fromPromise(BJ);function qJ(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Da,n="throws"in e?e.throws:!0;try{let i=r.readFileSync(t,e);return i=sF(i),JSON.parse(i,e.reviver)}catch(i){if(n)throw i.message=`${t}: ${i.message}`,i;return null}}async function UJ(t,e,r={}){let n=r.fs||Da,i=iF(e,r);await Vh.fromCallback(n.writeFile)(t,i,r)}var HJ=Vh.fromPromise(UJ);function VJ(t,e,r={}){let n=r.fs||Da,i=iF(e,r);return n.writeFileSync(t,i,r)}oF.exports={readFile:MJ,readFileSync:qJ,writeFile:HJ,writeFileSync:VJ}});var uF=v((KDe,aF)=>{"use strict";var zh=b0();aF.exports={readJson:zh.readFile,readJsonSync:zh.readFileSync,writeJson:zh.writeFile,writeJsonSync:zh.writeFileSync}});var Gh=v((WDe,fF)=>{"use strict";var zJ=Fe().fromPromise,v0=ir(),cF=require("path"),lF=on(),GJ=Ri().pathExists;async function KJ(t,e,r="utf-8"){let n=cF.dirname(t);return await GJ(n)||await lF.mkdirs(n),v0.writeFile(t,e,r)}function WJ(t,...e){let r=cF.dirname(t);v0.existsSync(r)||lF.mkdirsSync(r),v0.writeFileSync(t,...e)}fF.exports={outputFile:zJ(KJ),outputFileSync:WJ}});var dF=v((XDe,hF)=>{"use strict";var{stringify:XJ}=ya(),{outputFile:YJ}=Gh();async function JJ(t,e,r={}){let n=XJ(e,r);await YJ(t,n,r)}hF.exports=JJ});var mF=v((YDe,pF)=>{"use strict";var{stringify:ZJ}=ya(),{outputFileSync:QJ}=Gh();function eZ(t,e,r){let n=ZJ(e,r);QJ(t,n,r)}pF.exports=eZ});var yF=v((JDe,gF)=>{"use strict";var tZ=Fe().fromPromise,or=uF();or.outputJson=tZ(dF());or.outputJsonSync=mF();or.outputJSON=or.outputJson;or.outputJSONSync=or.outputJsonSync;or.writeJSON=or.writeJson;or.writeJSONSync=or.writeJsonSync;or.readJSON=or.readJson;or.readJSONSync=or.readJsonSync;gF.exports=or});var EF=v((ZDe,vF)=>{"use strict";var rZ=ir(),DF=require("path"),{copy:nZ}=Hh(),{remove:bF}=lc(),{mkdirp:iZ}=on(),{pathExists:sZ}=Ri(),wF=Us();async function oZ(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await wF.checkPaths(t,e,"move",r);await wF.checkParentPaths(t,i,e,"move");let o=DF.dirname(e);return DF.parse(o).root!==o&&await iZ(o),aZ(t,e,n,s)}async function aZ(t,e,r,n){if(!n){if(r)await bF(e);else if(await sZ(e))throw new Error("dest already exists.")}try{await rZ.rename(t,e)}catch(i){if(i.code!=="EXDEV")throw i;await uZ(t,e,r)}}async function uZ(t,e,r){return await nZ(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),bF(t)}vF.exports=oZ});var OF=v((QDe,AF)=>{"use strict";var CF=gt(),_0=require("path"),cZ=Hh().copySync,SF=lc().removeSync,lZ=on().mkdirpSync,_F=Us();function fZ(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:i,isChangingCase:s=!1}=_F.checkPathsSync(t,e,"move",r);return _F.checkParentPathsSync(t,i,e,"move"),hZ(e)||lZ(_0.dirname(e)),dZ(t,e,n,s)}function hZ(t){let e=_0.dirname(t);return _0.parse(e).root===e}function dZ(t,e,r,n){if(n)return E0(t,e,r);if(r)return SF(e),E0(t,e,r);if(CF.existsSync(e))throw new Error("dest already exists.");return E0(t,e,r)}function E0(t,e,r){try{CF.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return pZ(t,e,r)}}function pZ(t,e,r){return cZ(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),SF(t)}AF.exports=fZ});var TF=v((e0e,xF)=>{"use strict";var mZ=Fe().fromPromise;xF.exports={move:mZ(EF()),moveSync:OF()}});var wa=v((t0e,FF)=>{"use strict";FF.exports={...ir(),...Hh(),...F1(),...rF(),...yF(),...on(),...TF(),...Gh(),...Ri(),...lc()}});var LF=v((r0e,$F)=>{"use strict";var C0,PF,kF,RF,NF=!0;typeof process<"u"&&({FORCE_COLOR:C0,NODE_DISABLE_COLORS:PF,NO_COLOR:kF,TERM:RF}=process.env||{},NF=process.stdout&&process.stdout.isTTY);var Re={enabled:!PF&&kF==null&&RF!=="dumb"&&(C0!=null&&C0!=="0"||NF),reset:Ge(0,0),bold:Ge(1,22),dim:Ge(2,22),italic:Ge(3,23),underline:Ge(4,24),inverse:Ge(7,27),hidden:Ge(8,28),strikethrough:Ge(9,29),black:Ge(30,39),red:Ge(31,39),green:Ge(32,39),yellow:Ge(33,39),blue:Ge(34,39),magenta:Ge(35,39),cyan:Ge(36,39),white:Ge(37,39),gray:Ge(90,39),grey:Ge(90,39),bgBlack:Ge(40,49),bgRed:Ge(41,49),bgGreen:Ge(42,49),bgYellow:Ge(43,49),bgBlue:Ge(44,49),bgMagenta:Ge(45,49),bgCyan:Ge(46,49),bgWhite:Ge(47,49)};function IF(t,e){let r=0,n,i="",s="";for(;r<t.length;r++)n=t[r],i+=n.open,s+=n.close,~e.indexOf(n.close)&&(e=e.replace(n.rgx,n.close+n.open));return i+e+s}function gZ(t,e){let r={has:t,keys:e};return r.reset=Re.reset.bind(r),r.bold=Re.bold.bind(r),r.dim=Re.dim.bind(r),r.italic=Re.italic.bind(r),r.underline=Re.underline.bind(r),r.inverse=Re.inverse.bind(r),r.hidden=Re.hidden.bind(r),r.strikethrough=Re.strikethrough.bind(r),r.black=Re.black.bind(r),r.red=Re.red.bind(r),r.green=Re.green.bind(r),r.yellow=Re.yellow.bind(r),r.blue=Re.blue.bind(r),r.magenta=Re.magenta.bind(r),r.cyan=Re.cyan.bind(r),r.white=Re.white.bind(r),r.gray=Re.gray.bind(r),r.grey=Re.grey.bind(r),r.bgBlack=Re.bgBlack.bind(r),r.bgRed=Re.bgRed.bind(r),r.bgGreen=Re.bgGreen.bind(r),r.bgYellow=Re.bgYellow.bind(r),r.bgBlue=Re.bgBlue.bind(r),r.bgMagenta=Re.bgMagenta.bind(r),r.bgCyan=Re.bgCyan.bind(r),r.bgWhite=Re.bgWhite.bind(r),r}function Ge(t,e){let r={open:`\x1B[${t}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(n){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(t)||(this.has.push(t),this.keys.push(r)),n===void 0?this:Re.enabled?IF(this.keys,n+""):n+""):n===void 0?gZ([t],[r]):Re.enabled?IF([r],n+""):n+""}}$F.exports=Re});var ba=v(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.ancillary=vt.failure=vt.success=vt.input=vt.weak=vt.strong=void 0;var yZ=(fe(),ue(le)),vn=yZ.__importDefault(LF());vt.strong=vn.default.bold;vt.weak=vn.default.dim;vt.input=vn.default.cyan;vt.success=vn.default.green;vt.failure=vn.default.red;vt.ancillary=vn.default.cyan;var DZ={strong:vt.strong,weak:vt.weak,input:vt.input,success:vt.success,failure:vt.failure,ancillary:vt.ancillary,log:{DEBUG:vn.default.magenta,INFO:vn.default.cyan,WARN:vn.default.yellow,ERROR:vn.default.red}};vt.default=DZ});var S0=v(Kh=>{"use strict";Object.defineProperty(Kh,"__esModule",{value:!0});Kh.EscapeCode=void 0;var an="\x1B[",$t=class{};Kh.EscapeCode=$t;$t.cursorLeft=()=>`${an}G`;$t.cursorUp=(t=1)=>`${an}${t}A`;$t.cursorDown=(t=1)=>`${an}${t}B`;$t.cursorForward=(t=1)=>`${an}${t}C`;$t.cursorBackward=(t=1)=>`${an}${t}D`;$t.cursorHide=()=>`${an}?25l`;$t.cursorShow=()=>`${an}?25h`;$t.eraseLine=()=>`${an}2K`;$t.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=$t.eraseLine(),r<t-1&&(e+=$t.cursorUp());return`${e}${$t.cursorLeft()}`};$t.eraseUp=()=>`${an}1J`;$t.eraseDown=()=>`${an}J`;$t.eraseScreen=()=>`${an}2J`});var BF=v(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.Cursor=void 0;var wZ=(fe(),ue(le)),bZ=wZ.__importDefault(Ih()),jF=S0(),va=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(jF.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,bZ.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(jF.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};Wh.Cursor=va;va.stream=process.stderr;va._isVisible=!0;va._listenerAttached=!1});var O0=v((o0e,A0)=>{"use strict";var MF=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);A0.exports=MF;A0.exports.default=MF});var HF=v((a0e,UF)=>{"use strict";var qF="[\uD800-\uDBFF][\uDC00-\uDFFF]",vZ=t=>t&&t.exact?new RegExp(`^${qF}$`):new RegExp(qF,"g");UF.exports=vZ});var zF=v((u0e,VF)=>{"use strict";VF.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var x0=v((c0e,KF)=>{var hc=zF(),GF={};for(let t of Object.keys(hc))GF[hc[t]]=t;var re={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};KF.exports=re;for(let t of Object.keys(re)){if(!("channels"in re[t]))throw new Error("missing channels property: "+t);if(!("labels"in re[t]))throw new Error("missing channel labels property: "+t);if(re[t].labels.length!==re[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=re[t];delete re[t].channels,delete re[t].labels,Object.defineProperty(re[t],"channels",{value:e}),Object.defineProperty(re[t],"labels",{value:r})}re.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.min(e,r,n),s=Math.max(e,r,n),o=s-i,a,u;s===i?a=0:e===s?a=(r-n)/o:r===s?a=2+(n-e)/o:n===s&&(a=4+(e-r)/o),a=Math.min(a*60,360),a<0&&(a+=360);let c=(i+s)/2;return s===i?u=0:c<=.5?u=o/(s+i):u=o/(2-s-i),[a,u*100,c*100]};re.rgb.hsv=function(t){let e,r,n,i,s,o=t[0]/255,a=t[1]/255,u=t[2]/255,c=Math.max(o,a,u),l=c-Math.min(o,a,u),h=function(d){return(c-d)/6/l+1/2};return l===0?(i=0,s=0):(s=l/c,e=h(o),r=h(a),n=h(u),o===c?i=n-r:a===c?i=1/3+e-n:u===c&&(i=2/3+r-e),i<0?i+=1:i>1&&(i-=1)),[i*360,s*100,c*100]};re.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],i=re.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[i,s*100,n*100]};re.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.min(1-e,1-r,1-n),s=(1-e-i)/(1-i)||0,o=(1-r-i)/(1-i)||0,a=(1-n-i)/(1-i)||0;return[s*100,o*100,a*100,i*100]};function EZ(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}re.rgb.keyword=function(t){let e=GF[t];if(e)return e;let r=1/0,n;for(let i of Object.keys(hc)){let s=hc[i],o=EZ(t,s);o<r&&(r=o,n=i)}return n};re.keyword.rgb=function(t){return hc[t]};re.rgb.xyz=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;let i=e*.4124+r*.3576+n*.1805,s=e*.2126+r*.7152+n*.0722,o=e*.0193+r*.1192+n*.9505;return[i*100,s*100,o*100]};re.rgb.lab=function(t){let e=re.rgb.xyz(t),r=e[0],n=e[1],i=e[2];r/=95.047,n/=100,i/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let s=116*n-16,o=500*(r-n),a=200*(n-i);return[s,o,a]};re.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,i,s,o;if(r===0)return o=n*255,[o,o,o];n<.5?i=n*(1+r):i=n+r-n*r;let a=2*n-i,u=[0,0,0];for(let c=0;c<3;c++)s=e+1/3*-(c-1),s<0&&s++,s>1&&s--,6*s<1?o=a+(i-a)*6*s:2*s<1?o=i:3*s<2?o=a+(i-a)*(2/3-s)*6:o=a,u[c]=o*255;return u};re.hsl.hsv=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,i=r,s=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,i*=s<=1?s:2-s;let o=(n+r)/2,a=n===0?2*i/(s+i):2*r/(n+r);return[e,a*100,o*100]};re.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,n=t[2]/100,i=Math.floor(e)%6,s=e-Math.floor(e),o=255*n*(1-r),a=255*n*(1-r*s),u=255*n*(1-r*(1-s));switch(n*=255,i){case 0:return[n,u,o];case 1:return[a,n,o];case 2:return[o,n,u];case 3:return[o,a,n];case 4:return[u,o,n];case 5:return[n,o,a]}};re.hsv.hsl=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,i=Math.max(n,.01),s,o;o=(2-r)*n;let a=(2-r)*i;return s=r*i,s/=a<=1?a:2-a,s=s||0,o/=2,[e,s*100,o*100]};re.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,i=r+n,s;i>1&&(r/=i,n/=i);let o=Math.floor(6*e),a=1-n;s=6*e-o,(o&1)!==0&&(s=1-s);let u=r+s*(a-r),c,l,h;switch(o){default:case 6:case 0:c=a,l=u,h=r;break;case 1:c=u,l=a,h=r;break;case 2:c=r,l=a,h=u;break;case 3:c=r,l=u,h=a;break;case 4:c=u,l=r,h=a;break;case 5:c=a,l=r,h=u;break}return[c*255,l*255,h*255]};re.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,i=t[3]/100,s=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,r*(1-i)+i),a=1-Math.min(1,n*(1-i)+i);return[s*255,o*255,a*255]};re.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,i,s,o;return i=e*3.2406+r*-1.5372+n*-.4986,s=e*-.9689+r*1.8758+n*.0415,o=e*.0557+r*-.204+n*1.057,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),[i*255,s*255,o*255]};re.xyz.lab=function(t){let e=t[0],r=t[1],n=t[2];e/=95.047,r/=100,n/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let i=116*r-16,s=500*(e-r),o=200*(r-n);return[i,s,o]};re.lab.xyz=function(t){let e=t[0],r=t[1],n=t[2],i,s,o;s=(e+16)/116,i=r/500+s,o=s-n/200;let a=s**3,u=i**3,c=o**3;return s=a>.008856?a:(s-16/116)/7.787,i=u>.008856?u:(i-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,i*=95.047,s*=100,o*=108.883,[i,s,o]};re.lab.lch=function(t){let e=t[0],r=t[1],n=t[2],i;i=Math.atan2(n,r)*360/2/Math.PI,i<0&&(i+=360);let o=Math.sqrt(r*r+n*n);return[e,o,i]};re.lch.lab=function(t){let e=t[0],r=t[1],i=t[2]/360*2*Math.PI,s=r*Math.cos(i),o=r*Math.sin(i);return[e,s,o]};re.rgb.ansi16=function(t,e=null){let[r,n,i]=t,s=e===null?re.rgb.hsv(t)[2]:e;if(s=Math.round(s/50),s===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return s===2&&(o+=60),o};re.hsv.ansi16=function(t){return re.rgb.ansi16(re.hsv.rgb(t),t[2])};re.rgb.ansi256=function(t){let e=t[0],r=t[1],n=t[2];return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};re.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let r=(~~(t>50)+1)*.5,n=(e&1)*r*255,i=(e>>1&1)*r*255,s=(e>>2&1)*r*255;return[n,i,s]};re.ansi256.rgb=function(t){if(t>=232){let s=(t-232)*10+8;return[s,s,s]}t-=16;let e,r=Math.floor(t/36)/5*255,n=Math.floor((e=t%36)/6)/5*255,i=e%6/5*255;return[r,n,i]};re.rgb.hex=function(t){let r=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};re.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];e[0].length===3&&(r=r.split("").map(a=>a+a).join(""));let n=parseInt(r,16),i=n>>16&255,s=n>>8&255,o=n&255;return[i,s,o]};re.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.max(Math.max(e,r),n),s=Math.min(Math.min(e,r),n),o=i-s,a,u;return o<1?a=s/(1-o):a=0,o<=0?u=0:i===e?u=(r-n)/o%6:i===r?u=2+(n-e)/o:u=4+(e-r)/o,u/=6,u%=1,[u*360,o*100,a*100]};re.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r),i=0;return n<1&&(i=(r-.5*n)/(1-n)),[t[0],n*100,i*100]};re.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=e*r,i=0;return n<1&&(i=(r-n)/(1-n)),[t[0],n*100,i*100]};re.hcg.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100;if(r===0)return[n*255,n*255,n*255];let i=[0,0,0],s=e%1*6,o=s%1,a=1-o,u=0;switch(Math.floor(s)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=a,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=a,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=a}return u=(1-r)*n,[(r*i[0]+u)*255,(r*i[1]+u)*255,(r*i[2]+u)*255]};re.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e),i=0;return n>0&&(i=e/n),[t[0],i*100,n*100]};re.hcg.hsl=function(t){let e=t[1]/100,n=t[2]/100*(1-e)+.5*e,i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],i*100,n*100]};re.hcg.hwb=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e);return[t[0],(n-e)*100,(1-n)*100]};re.hwb.hcg=function(t){let e=t[1]/100,n=1-t[2]/100,i=n-e,s=0;return i<1&&(s=(n-i)/(1-i)),[t[0],i*100,s*100]};re.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};re.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};re.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};re.gray.hsl=function(t){return[0,0,t[0]]};re.gray.hsv=re.gray.hsl;re.gray.hwb=function(t){return[0,100,t[0]]};re.gray.cmyk=function(t){return[0,0,0,t[0]]};re.gray.lab=function(t){return[t[0],0,0]};re.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n};re.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var XF=v((l0e,WF)=>{var Xh=x0();function _Z(){let t={},e=Object.keys(Xh);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function CZ(t){let e=_Z(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),i=Object.keys(Xh[n]);for(let s=i.length,o=0;o<s;o++){let a=i[o],u=e[a];u.distance===-1&&(u.distance=e[n].distance+1,u.parent=n,r.unshift(a))}}return e}function SZ(t,e){return function(r){return e(t(r))}}function AZ(t,e){let r=[e[t].parent,t],n=Xh[e[t].parent][t],i=e[t].parent;for(;e[i].parent;)r.unshift(e[i].parent),n=SZ(Xh[e[i].parent][i],n),i=e[i].parent;return n.conversion=r,n}WF.exports=function(t){let e=CZ(t),r={},n=Object.keys(e);for(let i=n.length,s=0;s<i;s++){let o=n[s];e[o].parent!==null&&(r[o]=AZ(o,e))}return r}});var JF=v((f0e,YF)=>{var T0=x0(),OZ=XF(),Ea={},xZ=Object.keys(T0);function TZ(t){let e=function(...r){let n=r[0];return n==null?n:(n.length>1&&(r=n),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function FZ(t){let e=function(...r){let n=r[0];if(n==null)return n;n.length>1&&(r=n);let i=t(r);if(typeof i=="object")for(let s=i.length,o=0;o<s;o++)i[o]=Math.round(i[o]);return i};return"conversion"in t&&(e.conversion=t.conversion),e}xZ.forEach(t=>{Ea[t]={},Object.defineProperty(Ea[t],"channels",{value:T0[t].channels}),Object.defineProperty(Ea[t],"labels",{value:T0[t].labels});let e=OZ(t);Object.keys(e).forEach(n=>{let i=e[n];Ea[t][n]=FZ(i),Ea[t][n].raw=TZ(i)})});YF.exports=Ea});var I0=v((h0e,rI)=>{"use strict";var ZF=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,QF=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},eI=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},Yh=t=>t,tI=(t,e,r)=>[t,e,r],_a=(t,e,r)=>{Object.defineProperty(t,e,{get:()=>{let n=r();return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0}),n},enumerable:!0,configurable:!0})},F0,Ca=(t,e,r,n)=>{F0===void 0&&(F0=JF());let i=n?10:0,s={};for(let[o,a]of Object.entries(F0)){let u=o==="ansi16"?"ansi":o;o===e?s[u]=t(r,i):typeof a=="object"&&(s[u]=t(a[e],i))}return s};function IZ(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],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],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],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[i,s]of Object.entries(n))e[i]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},n[i]=e[i],t.set(s[0],s[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",_a(e.color,"ansi",()=>Ca(ZF,"ansi16",Yh,!1)),_a(e.color,"ansi256",()=>Ca(QF,"ansi256",Yh,!1)),_a(e.color,"ansi16m",()=>Ca(eI,"rgb",tI,!1)),_a(e.bgColor,"ansi",()=>Ca(ZF,"ansi16",Yh,!0)),_a(e.bgColor,"ansi256",()=>Ca(QF,"ansi256",Yh,!0)),_a(e.bgColor,"ansi16m",()=>Ca(eI,"rgb",tI,!0)),e}Object.defineProperty(rI,"exports",{enumerable:!0,get:IZ})});var aI=v((d0e,oI)=>{"use strict";var PZ=O0(),kZ=HF(),nI=I0(),sI=["\x1B","\x9B"],Jh=t=>`${sI[0]}[${t}m`,iI=(t,e,r)=>{let n=[];t=[...t];for(let i of t){let s=i;i.includes(";")&&(i=i.split(";")[0][0]+"0");let o=nI.codes.get(Number.parseInt(i,10));if(o){let a=t.indexOf(o.toString());a===-1?n.push(Jh(e?o:s)):t.splice(a,1)}else if(e){n.push(Jh(0));break}else n.push(Jh(s))}if(e&&(n=n.filter((i,s)=>n.indexOf(i)===s),r!==void 0)){let i=Jh(nI.codes.get(Number.parseInt(r,10)));n=n.reduce((s,o)=>o===i?[o,...s]:[...s,o],[])}return n.join("")};oI.exports=(t,e,r)=>{let n=[...t],i=[],s=typeof r=="number"?r:n.length,o=!1,a,u=0,c="";for(let[l,h]of n.entries()){let d=!1;if(sI.includes(h)){let f=/\d[^m]*/.exec(t.slice(l,l+18));a=f&&f.length>0?f[0]:void 0,u<s&&(o=!0,a!==void 0&&i.push(a))}else o&&h==="m"&&(o=!1,d=!0);if(!o&&!d&&u++,!kZ({exact:!0}).test(h)&&PZ(h.codePointAt())&&(u++,typeof r!="number"&&s++),u>e&&u<=s)c+=h;else if(u===e&&!o&&a!==void 0)c=iI(i);else if(u>=s){c+=iI(i,!0,a);break}}return c}});var cI=v((p0e,uI)=>{"use strict";uI.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var Zh=v((m0e,lI)=>{"use strict";var RZ=cI();lI.exports=t=>typeof t=="string"?t.replace(RZ(),""):t});var hI=v((g0e,fI)=>{"use strict";fI.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var k0=v((y0e,P0)=>{"use strict";var NZ=Zh(),$Z=O0(),LZ=hI(),dI=t=>{if(typeof t!="string"||t.length===0||(t=NZ(t),t.length===0))return 0;t=t.replace(LZ()," ");let e=0;for(let r=0;r<t.length;r++){let n=t.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,e+=$Z(n)?2:1)}return e};P0.exports=dI;P0.exports.default=dI});var wI=v((D0e,DI)=>{"use strict";var dc=k0(),jZ=Zh(),BZ=I0(),Qh=new Set(["\x1B","\x9B"]),MZ=39,N0="\x07",gI="[",qZ="]",yI="m",$0=`${qZ}8;;`,pI=t=>`${Qh.values().next().value}${gI}${t}${yI}`,mI=t=>`${Qh.values().next().value}${$0}${t}${N0}`,UZ=t=>t.split(" ").map(e=>dc(e)),R0=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=dc(jZ(t[t.length-1]));for(let[a,u]of n.entries()){let c=dc(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),Qh.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith($0)),i){s?u===N0&&(i=!1,s=!1):u===yI&&(i=!1);continue}o+=c,o===r&&a<n.length-1&&(t.push(""),o=0)}!o&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},HZ=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(dc(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},VZ=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,s,o=UZ(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let h=dc(a[a.length-1]);if(c!==0&&(h>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),h=0),(h>0||r.trim===!1)&&(a[a.length-1]+=" ",h++)),r.hard&&o[c]>e){let d=e-h,f=1+Math.floor((o[c]-d-1)/e);Math.floor((o[c]-1)/e)<f&&a.push(""),R0(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){R0(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){R0(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(HZ));let u=[...a.join(`
|
|
67
67
|
`)];for(let[c,l]of u.entries()){if(n+=l,Qh.has(l)){let{groups:d}=new RegExp(`(?:\\${gI}(?<code>\\d+)m|\\${$0}(?<uri>.*)${N0})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let f=Number.parseFloat(d.code);i=f===MZ?void 0:f}else d.uri!==void 0&&(s=d.uri.length===0?void 0:d.uri)}let h=BZ.codes.get(Number(i));u[c+1]===`
|
|
68
68
|
`?(s&&(n+=mI("")),i&&h&&(n+=pI(h))):l===`
|
|
69
69
|
`&&(i&&h&&(n+=pI(i)),s&&(n+=mI(s)))}return n};DI.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
|
|
70
70
|
`).split(`
|
|
71
71
|
`).map(n=>VZ(n,e,r)).join(`
|
|
72
|
-
`)});var EI=v((
|
|
72
|
+
`)});var EI=v((w0e,vI)=>{"use strict";var zZ=require("os"),bI=zZ.homedir();vI.exports=t=>{if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);return bI?t.replace(/^~(?=$|\/|\\)/,bI):t}});var xI=v(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.columnar=ft.generateFillSpaceStringList=ft.expandPath=ft.prettyPath=ft.wordWrap=ft.indent=ft.TTY_WIDTH=ft.stripAnsi=ft.stringWidth=ft.sliceAnsi=void 0;var _I=(fe(),ue(le)),GZ=_I.__importStar(require("os")),Qn=_I.__importStar(require("path")),CI=aI();ft.sliceAnsi=CI;var ed=k0();ft.stringWidth=ed;var KZ=Zh();ft.stripAnsi=KZ;var WZ=wI(),XZ=EI(),YZ=80,JZ=120;ft.TTY_WIDTH=process.stdout.columns?Math.max(YZ,Math.min(process.stdout.columns,JZ)):1/0;function SI(t=4){return" ".repeat(t)}ft.indent=SI;function ZZ(t,{width:e=ft.TTY_WIDTH,indentation:r=0,append:n=""}){return WZ(t,e-r-n.length,{trim:!0}).split(`
|
|
73
73
|
`).join(`${n}
|
|
74
74
|
${SI(r)}`)}ft.wordWrap=ZZ;function QZ(t){t=AI(t);let e=process.cwd(),r=Qn.dirname(t),n=GZ.homedir(),i=Math.abs(r.split(Qn.sep).length-e.split(Qn.sep).length);if(e===r)return"."+Qn.sep+Qn.basename(t);if(r.startsWith(e))return"."+Qn.sep+t.substring(e.length+1);if(i<=2){let s=Qn.relative(e,t);return s||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+Qn.sep+t.substring(n.length+1)}return t}ft.prettyPath=QZ;function AI(t){return Qn.resolve(XZ(t))}ft.expandPath=AI;function OI(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(o=>ed(o))),i=n>e?n+1:e,s=r.repeat(i);return t.map(o=>CI(s,0,i-ed(o)))}ft.generateFillSpaceStringList=OI;function eQ(t,{hsep:e="-",vsep:r="|",headers:n}){let i=!!n;if(!t[0])return"";let s=n?n.length:t[0].length,o=n?n.map(l=>[l]):t[0].map(()=>[]);for(let l of t){let h=0,d=l.map(f=>{let m=f.split(`
|
|
75
75
|
`);return h=Math.max(h,m.length),m});for(let f in l)o[f]&&o[f].push(...d[f],...Array(h-d[f].length).fill(""))}let a=o.map((l,h)=>{if(h<s-1){let d=OI(l);return l.map((f,m)=>`${f}${d[m]}${r===""?"":`${r} `}`)}else return l}),u=0,c=a.reduce((l,h)=>l.map((d,f)=>{let m=l[f]+h[f];return u=Math.max(u,ed(m)),m}));return i&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
|
|
@@ -84,29 +84,29 @@ ${SI(r)}`)}ft.wordWrap=ZZ;function QZ(t){t=AI(t);let e=process.cwd(),r=Qn.dirnam
|
|
|
84
84
|
`)})}),i}};ji.StreamOutputStrategy=ud;var z0=class extends ud{constructor({stream:e=process.stdout,colors:r=RI.NO_COLORS}={}){super({stream:e,colors:r}),this.stream=e,this.redrawer=new cd({stream:e})}createTaskChain(){let{failure:e,strong:r,success:n,weak:i}=this.colors,s=new Hs.TaskChain({taskOptions:{tickInterval:50}});return s.on("next",o=>{o.on("end",u=>{u.success?this.write(`${n(Hs.ICON_SUCCESS)} ${o.msg} ${i(`in ${(0,NI.formatHrTime)(u.elapsedTime)}`)}
|
|
85
85
|
`):this.write(`${e(Hs.ICON_FAILURE)} ${o.msg} ${e(i("- failed!"))}
|
|
86
86
|
`)});let a=new Hs.Spinner;o.on("tick",()=>{let u=o.progressRatio?(o.progressRatio*100).toFixed(2):"",c=a.frame();this.redrawer.redraw(`${r(c)} ${o.msg}${u?" ("+r(String(u)+"%")+")":""} `)}),o.on("clear",()=>{this.redrawer.clear()})}),s.on("end",()=>{this.redrawer.end()}),s}};ji.TTYOutputStrategy=z0;var cd=class{constructor({stream:e=process.stdout}){this.stream=e}get width(){return this.stream.columns||80}redraw(e){ad.Cursor.hide(),this.stream.write(ad.EscapeCode.eraseLines(1)+e.replace(/[\r\n]+$/,""))}clear(){this.stream.write(ad.EscapeCode.eraseLines(1))}end(){ad.Cursor.show()}};ji.TTYOutputRedrawer=cd});var W0=v(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.createDefaultLogger=Ot.wordWrap=Ot.stripAnsi=Ot.stringWidth=Ot.sliceAnsi=Ot.indent=Ot.TTY_WIDTH=void 0;var ld=(fe(),ue(le)),Aa=Li();Object.defineProperty(Ot,"TTY_WIDTH",{enumerable:!0,get:function(){return Aa.TTY_WIDTH}});Object.defineProperty(Ot,"indent",{enumerable:!0,get:function(){return Aa.indent}});Object.defineProperty(Ot,"sliceAnsi",{enumerable:!0,get:function(){return Aa.sliceAnsi}});Object.defineProperty(Ot,"stringWidth",{enumerable:!0,get:function(){return Aa.stringWidth}});Object.defineProperty(Ot,"stripAnsi",{enumerable:!0,get:function(){return Aa.stripAnsi}});Object.defineProperty(Ot,"wordWrap",{enumerable:!0,get:function(){return Aa.wordWrap}});var vQ=mc(),K0=M0(),EQ=G0();ld.__exportStar(mc(),Ot);ld.__exportStar(M0(),Ot);ld.__exportStar(G0(),Ot);ld.__exportStar(V0(),Ot);function _Q({output:t=new EQ.StreamOutputStrategy({colors:vQ.NO_COLORS,stream:process.stdout}),formatterOptions:e}={}){let{weak:r}=t.colors,n=process.argv.includes("--log-timestamps")?()=>`${r("["+new Date().toISOString()+"]")}`:"",i=(0,K0.createTaggedFormatter)({colors:t.colors,prefix:n,titleize:!0,wrap:!0,...e}),s=new Set([new K0.StreamHandler({stream:t.stream,formatter:i})]);return new K0.Logger({handlers:s})}Ot.createDefaultLogger=_Q});var LI=v(Vs=>{"use strict";Object.defineProperty(Vs,"__esModule",{value:!0});Vs.isInteractive=Vs.checkInteractive=void 0;var CQ=(fe(),ue(le)),$I=Li(),SQ=CQ.__importDefault(ba()),AQ=yc(),OQ=(...t)=>(0,Vs.isInteractive)()?!0:t.length?t.filter(e=>!e).length?(AQ.logger.error(`Non-interactive shell detected.
|
|
87
|
-
Run the command with ${SQ.default.input("--help")} to see a list of arguments that must be provided.`),!1):!0:!1;Vs.checkInteractive=OQ;var xQ=()=>$I.TERMINAL_INFO.tty&&!$I.TERMINAL_INFO.ci;Vs.isInteractive=xQ});var ht=v((
|
|
88
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{!s&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function RQ(t,e){if(t){if(typeof t=="string")return HI(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return HI(t,e)}}function HI(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var NQ=fd(),zI=Ye(),VI=zI.erase,$Q=zI.cursor,LQ=t=>[...NQ(t)].length;GI.exports=function(t,e){if(!e)return VI.line+$Q.to(0);let r=0,n=t.split(/\r?\n/);var i=kQ(n),s;try{for(i.s();!(s=i.n()).done;){let o=s.value;r+=1+Math.floor(Math.max(LQ(o)-1,0)/e)}}catch(o){i.e(o)}finally{i.f()}return VI.lines(r)}});var X0=v((
|
|
87
|
+
Run the command with ${SQ.default.input("--help")} to see a list of arguments that must be provided.`),!1):!0:!1;Vs.checkInteractive=OQ;var xQ=()=>$I.TERMINAL_INFO.tty&&!$I.TERMINAL_INFO.ci;Vs.isInteractive=xQ});var ht=v((P0e,BI)=>{"use strict";var{FORCE_COLOR:TQ,NODE_DISABLE_COLORS:FQ,TERM:IQ}=process.env,Ne={enabled:!FQ&&IQ!=="dumb"&&TQ!=="0",reset:Ke(0,0),bold:Ke(1,22),dim:Ke(2,22),italic:Ke(3,23),underline:Ke(4,24),inverse:Ke(7,27),hidden:Ke(8,28),strikethrough:Ke(9,29),black:Ke(30,39),red:Ke(31,39),green:Ke(32,39),yellow:Ke(33,39),blue:Ke(34,39),magenta:Ke(35,39),cyan:Ke(36,39),white:Ke(37,39),gray:Ke(90,39),grey:Ke(90,39),bgBlack:Ke(40,49),bgRed:Ke(41,49),bgGreen:Ke(42,49),bgYellow:Ke(43,49),bgBlue:Ke(44,49),bgMagenta:Ke(45,49),bgCyan:Ke(46,49),bgWhite:Ke(47,49)};function jI(t,e){let r=0,n,i="",s="";for(;r<t.length;r++)n=t[r],i+=n.open,s+=n.close,e.includes(n.close)&&(e=e.replace(n.rgx,n.close+n.open));return i+e+s}function PQ(t,e){let r={has:t,keys:e};return r.reset=Ne.reset.bind(r),r.bold=Ne.bold.bind(r),r.dim=Ne.dim.bind(r),r.italic=Ne.italic.bind(r),r.underline=Ne.underline.bind(r),r.inverse=Ne.inverse.bind(r),r.hidden=Ne.hidden.bind(r),r.strikethrough=Ne.strikethrough.bind(r),r.black=Ne.black.bind(r),r.red=Ne.red.bind(r),r.green=Ne.green.bind(r),r.yellow=Ne.yellow.bind(r),r.blue=Ne.blue.bind(r),r.magenta=Ne.magenta.bind(r),r.cyan=Ne.cyan.bind(r),r.white=Ne.white.bind(r),r.gray=Ne.gray.bind(r),r.grey=Ne.grey.bind(r),r.bgBlack=Ne.bgBlack.bind(r),r.bgRed=Ne.bgRed.bind(r),r.bgGreen=Ne.bgGreen.bind(r),r.bgYellow=Ne.bgYellow.bind(r),r.bgBlue=Ne.bgBlue.bind(r),r.bgMagenta=Ne.bgMagenta.bind(r),r.bgCyan=Ne.bgCyan.bind(r),r.bgWhite=Ne.bgWhite.bind(r),r}function Ke(t,e){let r={open:`\x1B[${t}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(n){return this!==void 0&&this.has!==void 0?(this.has.includes(t)||(this.has.push(t),this.keys.push(r)),n===void 0?this:Ne.enabled?jI(this.keys,n+""):n+""):n===void 0?PQ([t],[r]):Ne.enabled?jI([r],n+""):n+""}}BI.exports=Ne});var qI=v((k0e,MI)=>{"use strict";MI.exports=(t,e)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(e){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"home":t.name==="end"?"end":t.name==="up"?"up":t.name==="down"?"down":t.name==="right"?"right":t.name==="left"?"left":!1}}});var fd=v((R0e,UI)=>{"use strict";UI.exports=t=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),r=new RegExp(e,"g");return typeof t=="string"?t.replace(r,""):t}});var KI=v((N0e,GI)=>{"use strict";function kQ(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=RQ(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(c){throw c},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
88
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{!s&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function RQ(t,e){if(t){if(typeof t=="string")return HI(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return HI(t,e)}}function HI(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var NQ=fd(),zI=Ye(),VI=zI.erase,$Q=zI.cursor,LQ=t=>[...NQ(t)].length;GI.exports=function(t,e){if(!e)return VI.line+$Q.to(0);let r=0,n=t.split(/\r?\n/);var i=kQ(n),s;try{for(i.s();!(s=i.n()).done;){let o=s.value;r+=1+Math.floor(Math.max(LQ(o)-1,0)/e)}}catch(o){i.e(o)}finally{i.f()}return VI.lines(r)}});var X0=v(($0e,WI)=>{"use strict";var Dc={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},jQ={arrowUp:Dc.arrowUp,arrowDown:Dc.arrowDown,arrowLeft:Dc.arrowLeft,arrowRight:Dc.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},BQ=process.platform==="win32"?jQ:Dc;WI.exports=BQ});var YI=v((L0e,XI)=>{"use strict";var Oa=ht(),zs=X0(),Y0=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"\u{1F603}".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}}),MQ=t=>Y0[t]||Y0.default,wc=Object.freeze({aborted:Oa.red(zs.cross),done:Oa.green(zs.tick),exited:Oa.yellow(zs.cross),default:Oa.cyan("?")}),qQ=(t,e,r)=>e?wc.aborted:r?wc.exited:t?wc.done:wc.default,UQ=t=>Oa.gray(t?zs.ellipsis:zs.pointerSmall),HQ=(t,e)=>Oa.gray(t?e?zs.pointerSmall:"+":zs.line);XI.exports={styles:Y0,render:MQ,symbols:wc,symbol:qQ,delimiter:UQ,item:HQ}});var ZI=v((j0e,JI)=>{"use strict";var VQ=fd();JI.exports=function(t,e){let r=String(VQ(t)||"").split(/\r?\n/);return e?r.map(n=>Math.ceil(n.length/e)).reduce((n,i)=>n+i):r.length}});var e2=v((B0e,QI)=>{"use strict";QI.exports=(t,e={})=>{let r=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",n=e.width;return(t||"").split(/\r?\n/g).map(i=>i.split(/\s+/g).reduce((s,o)=>(o.length+r.length>=n||s[s.length-1].length+o.length+1<n?s[s.length-1]+=` ${o}`:s.push(`${r}${o}`),s),[r]).join(`
|
|
89
89
|
`)).join(`
|
|
90
|
-
`)}});var r2=v((
|
|
90
|
+
`)}});var r2=v((M0e,t2)=>{"use strict";t2.exports=(t,e,r)=>{r=r||e;let n=Math.min(e-r,t-Math.floor(r/2));n<0&&(n=0);let i=Math.min(n+r,e);return{startIndex:n,endIndex:i}}});var un=v((q0e,n2)=>{"use strict";n2.exports={action:qI(),clear:KI(),style:YI(),strip:fd(),figures:X0(),lines:ZI(),wrap:e2(),entriesToDisplay:r2()}});var ei=v((U0e,o2)=>{"use strict";var i2=require("readline"),zQ=un(),GQ=zQ.action,KQ=require("events"),s2=Ye(),WQ=s2.beep,XQ=s2.cursor,YQ=ht(),J0=class extends KQ{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let r=i2.createInterface({input:this.in,escapeCodeTimeout:50});i2.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);let n=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,i=(s,o)=>{let a=GQ(o,n);a===!1?this._&&this._(s,o):typeof this[a]=="function"?this[a](o):this.bell()};this.close=()=>{this.out.write(XQ.show),this.in.removeListener("keypress",i),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",i)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(WQ)}render(){this.onRender(YQ),this.firstRender&&(this.firstRender=!1)}};o2.exports=J0});var f2=v((H0e,l2)=>{"use strict";function a2(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function u2(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){a2(s,n,i,o,a,"next",u)}function a(u){a2(s,n,i,o,a,"throw",u)}o(void 0)})}}var hd=ht(),JQ=ei(),c2=Ye(),ZQ=c2.erase,bc=c2.cursor,dd=un(),Z0=dd.style,Q0=dd.clear,QQ=dd.lines,eee=dd.figures,ew=class extends JQ{constructor(e={}){super(e),this.transform=Z0.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=Q0("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=hd.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
91
91
|
`),this.close()}validate(){var e=this;return u2(function*(){let r=yield e.validator(e.value);typeof r=="string"&&(e.errorMsg=r,r=!1),e.error=!r})()}submit(){var e=this;return u2(function*(){if(e.value=e.value||e.initial,e.cursorOffset=0,e.cursor=e.rendered.length,yield e.validate(),e.error){e.red=!0,e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
|
|
92
92
|
`),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,r){let n=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor);this.value=`${n}${e}${i}`,this.red=!1,this.cursor=this.placeholder?0:n.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),r=this.value.slice(this.cursor);this.value=`${e}${r}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor+1);this.value=`${e}${r}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(bc.down(QQ(this.outputError,this.out.columns)-1)+Q0(this.outputError,this.out.columns)),this.out.write(Q0(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Z0.symbol(this.done,this.aborted),hd.bold(this.msg),Z0.delimiter(this.done),this.red?hd.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
93
93
|
`).reduce((e,r,n)=>e+`
|
|
94
|
-
${n?" ":eee.pointerSmall} ${hd.red().italic(r)}`,"")),this.out.write(ZQ.line+bc.to(0)+this.outputText+bc.save+this.outputError+bc.restore+bc.move(this.cursorOffset,0)))}};l2.exports=ew});var m2=v((
|
|
94
|
+
${n?" ":eee.pointerSmall} ${hd.red().italic(r)}`,"")),this.out.write(ZQ.line+bc.to(0)+this.outputText+bc.save+this.outputError+bc.restore+bc.move(this.cursorOffset,0)))}};l2.exports=ew});var m2=v((V0e,p2)=>{"use strict";var ti=ht(),tee=ei(),vc=un(),h2=vc.style,d2=vc.clear,pd=vc.figures,ree=vc.wrap,nee=vc.entriesToDisplay,iee=Ye(),see=iee.cursor,tw=class extends tee{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),value:r&&(r.value===void 0?n:r.value),description:r&&r.description,selected:r&&r.selected,disabled:r&&r.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=d2("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
95
95
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
96
96
|
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,r){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(see.hide):this.out.write(d2(this.outputText,this.out.columns)),super.render();let e=nee(this.cursor,this.choices.length,this.optionsPerPage),r=e.startIndex,n=e.endIndex;if(this.outputText=[h2.symbol(this.done,this.aborted),ti.bold(this.msg),h2.delimiter(!1),this.done?this.selection.title:this.selection.disabled?ti.yellow(this.warn):ti.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
97
97
|
`;for(let i=r;i<n;i++){let s,o,a="",u=this.choices[i];i===r&&r>0?o=pd.arrowUp:i===n-1&&n<this.choices.length?o=pd.arrowDown:o=" ",u.disabled?(s=this.cursor===i?ti.gray().underline(u.title):ti.strikethrough().gray(u.title),o=(this.cursor===i?ti.bold().gray(pd.pointer)+" ":" ")+o):(s=this.cursor===i?ti.cyan().underline(u.title):u.title,o=(this.cursor===i?ti.cyan(pd.pointer)+" ":" ")+o,u.description&&this.cursor===i&&(a=` - ${u.description}`,(o.length+s.length+a.length>=this.out.columns||u.description.split(/\r?\n/).length>1)&&(a=`
|
|
98
98
|
`+ree(u.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${s}${ti.gray(a)}
|
|
99
|
-
`}}this.out.write(this.outputText)}};p2.exports=tw});var v2=v((
|
|
99
|
+
`}}this.out.write(this.outputText)}};p2.exports=tw});var v2=v((z0e,b2)=>{"use strict";var md=ht(),oee=ei(),D2=un(),g2=D2.style,aee=D2.clear,w2=Ye(),y2=w2.cursor,uee=w2.erase,rw=class extends oee{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
100
100
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
101
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,r){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(y2.hide):this.out.write(aee(this.outputText,this.out.columns)),super.render(),this.outputText=[g2.symbol(this.done,this.aborted),md.bold(this.msg),g2.delimiter(this.done),this.value?this.inactive:md.cyan().underline(this.inactive),md.gray("/"),this.value?md.cyan().underline(this.active):this.active].join(" "),this.out.write(uee.line+y2.to(0)+this.outputText))}};b2.exports=rw});var Sn=v((
|
|
101
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,r){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(y2.hide):this.out.write(aee(this.outputText,this.out.columns)),super.render(),this.outputText=[g2.symbol(this.done,this.aborted),md.bold(this.msg),g2.delimiter(this.done),this.value?this.inactive:md.cyan().underline(this.inactive),md.gray("/"),this.value?md.cyan().underline(this.active):this.active].join(" "),this.out.write(uee.line+y2.to(0)+this.outputText))}};b2.exports=rw});var Sn=v((G0e,E2)=>{"use strict";var nw=class t{constructor({token:e,date:r,parts:n,locales:i}){this.token=e,this.date=r||new Date,this.parts=n||[this],this.locales=i||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((r,n)=>n>e&&r instanceof t)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),r=e.indexOf(this);return e.find((n,i)=>i>r&&n instanceof t)}toString(){return String(this.date)}};E2.exports=nw});var C2=v((K0e,_2)=>{"use strict";var cee=Sn(),iw=class extends cee{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};_2.exports=iw});var A2=v((W0e,S2)=>{"use strict";var lee=Sn(),fee=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th"),sw=class extends lee{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+fee(e):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:e}};S2.exports=sw});var x2=v((X0e,O2)=>{"use strict";var hee=Sn(),ow=class extends hee{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};O2.exports=ow});var F2=v((Y0e,T2)=>{"use strict";var dee=Sn(),aw=class extends dee{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};T2.exports=aw});var P2=v((J0e,I2)=>{"use strict";var pee=Sn(),uw=class extends pee{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};I2.exports=uw});var R2=v((Z0e,k2)=>{"use strict";var mee=Sn(),cw=class extends mee{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),r=this.token.length;return r===2?String(e+1).padStart(2,"0"):r===3?this.locales.monthsShort[e]:r===4?this.locales.months[e]:String(e+1)}};k2.exports=cw});var $2=v((Q0e,N2)=>{"use strict";var gee=Sn(),lw=class extends gee{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};N2.exports=lw});var j2=v((ewe,L2)=>{"use strict";var yee=Sn(),fw=class extends yee{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};L2.exports=fw});var M2=v((twe,B2)=>{"use strict";B2.exports={DatePart:Sn(),Meridiem:C2(),Day:A2(),Hours:x2(),Milliseconds:F2(),Minutes:P2(),Month:R2(),Seconds:$2(),Year:j2()}});var Y2=v((rwe,X2)=>{"use strict";function q2(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function U2(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){q2(s,n,i,o,a,"next",u)}function a(u){q2(s,n,i,o,a,"throw",u)}o(void 0)})}}var hw=ht(),Dee=ei(),pw=un(),H2=pw.style,V2=pw.clear,wee=pw.figures,W2=Ye(),bee=W2.erase,z2=W2.cursor,ri=M2(),G2=ri.DatePart,vee=ri.Meridiem,Eee=ri.Day,_ee=ri.Hours,Cee=ri.Milliseconds,See=ri.Minutes,Aee=ri.Month,Oee=ri.Seconds,xee=ri.Year,Tee=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,K2={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new Eee(t),3:t=>new Aee(t),4:t=>new xee(t),5:t=>new vee(t),6:t=>new _ee(t),7:t=>new See(t),8:t=>new Oee(t),9:t=>new Cee(t)},Fee={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},dw=class extends Dee{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Fee,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=V2("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let r;for(this.parts=[];r=Tee.exec(e);){let i=r.shift(),s=r.findIndex(o=>o!=null);this.parts.push(s in K2?K2[s]({token:r[s]||i,date:this.date,parts:this.parts,locales:this.locales}):r[s]||i)}let n=this.parts.reduce((i,s)=>(typeof s=="string"&&typeof i[i.length-1]=="string"?i[i.length-1]+=s:i.push(s),i),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof G2)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
102
102
|
`),this.close()}validate(){var e=this;return U2(function*(){let r=yield e.validator(e.value);typeof r=="string"&&(e.errorMsg=r,r=!1),e.error=!r})()}submit(){var e=this;return U2(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
|
|
103
103
|
`),e.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(r=>r instanceof G2)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(z2.hide):this.out.write(V2(this.outputText,this.out.columns)),super.render(),this.outputText=[H2.symbol(this.done,this.aborted),hw.bold(this.msg),H2.delimiter(!1),this.parts.reduce((e,r,n)=>e.concat(n===this.cursor&&!this.done?hw.cyan().underline(r.toString()):r),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
104
104
|
`).reduce((e,r,n)=>e+`
|
|
105
|
-
${n?" ":wee.pointerSmall} ${hw.red().italic(r)}`,"")),this.out.write(bee.line+z2.to(0)+this.outputText))}};X2.exports=dw});var nP=v((
|
|
105
|
+
${n?" ":wee.pointerSmall} ${hw.red().italic(r)}`,"")),this.out.write(bee.line+z2.to(0)+this.outputText))}};X2.exports=dw});var nP=v((nwe,rP)=>{"use strict";function J2(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function Z2(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){J2(s,n,i,o,a,"next",u)}function a(u){J2(s,n,i,o,a,"throw",u)}o(void 0)})}}var gd=ht(),Iee=ei(),tP=Ye(),yd=tP.cursor,Pee=tP.erase,Dd=un(),mw=Dd.style,kee=Dd.figures,Q2=Dd.clear,Ree=Dd.lines,Nee=/[0-9]/,gw=t=>t!==void 0,eP=(t,e)=>{let r=Math.pow(10,e);return Math.round(t*r)/r},yw=class extends Iee{constructor(e={}){super(e),this.transform=mw.render(e.style),this.msg=e.message,this.initial=gw(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=gw(e.min)?e.min:-1/0,this.max=gw(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=gd.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${eP(e,this.round)}`),this._value=eP(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||Nee.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
106
106
|
`),this.close()}validate(){var e=this;return Z2(function*(){let r=yield e.validator(e.value);typeof r=="string"&&(e.errorMsg=r,r=!1),e.error=!r})()}submit(){var e=this;return Z2(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}let r=e.value;e.value=r!==""?r:e.initial,e.done=!0,e.aborted=!1,e.error=!1,e.fire(),e.render(),e.out.write(`
|
|
107
107
|
`),e.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,r){if(!this.valid(e))return this.bell();let n=Date.now();if(n-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=n,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(yd.down(Ree(this.outputError,this.out.columns)-1)+Q2(this.outputError,this.out.columns)),this.out.write(Q2(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[mw.symbol(this.done,this.aborted),gd.bold(this.msg),mw.delimiter(this.done),!this.done||!this.done&&!this.placeholder?gd[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
108
108
|
`).reduce((e,r,n)=>e+`
|
|
109
|
-
${n?" ":kee.pointerSmall} ${gd.red().italic(r)}`,"")),this.out.write(Pee.line+yd.to(0)+this.outputText+yd.save+this.outputError+yd.restore))}};rP.exports=yw});var ww=v((
|
|
109
|
+
${n?" ":kee.pointerSmall} ${gd.red().italic(r)}`,"")),this.out.write(Pee.line+yd.to(0)+this.outputText+yd.save+this.outputError+yd.restore))}};rP.exports=yw});var ww=v((iwe,oP)=>{"use strict";var An=ht(),$ee=Ye(),Lee=$ee.cursor,jee=ei(),Ec=un(),iP=Ec.clear,Bi=Ec.figures,sP=Ec.style,Bee=Ec.wrap,Mee=Ec.entriesToDisplay,Dw=class extends jee{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),description:r&&r.description,value:r&&(r.value===void 0?n:r.value),selected:r&&r.selected,disabled:r&&r.disabled})),this.clear=iP("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
110
110
|
`),this.close()}submit(){let e=this.value.filter(r=>r.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
111
111
|
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(r=>!r.disabled).forEach(r=>r.selected=e),this.render()}_(e,r){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
112
112
|
Instructions:
|
|
@@ -116,13 +116,13 @@ Instructions:
|
|
|
116
116
|
`:"")+" enter/return: Complete answer":""}renderOption(e,r,n,i){let s=(r.selected?An.green(Bi.radioOn):Bi.radioOff)+" "+i+" ",o,a;return r.disabled?o=e===n?An.gray().underline(r.title):An.strikethrough().gray(r.title):(o=e===n?An.cyan().underline(r.title):r.title,e===n&&r.description&&(a=` - ${r.description}`,(s.length+o.length+a.length>=this.out.columns||r.description.split(/\r?\n/).length>1)&&(a=`
|
|
117
117
|
`+Bee(r.description,{margin:s.length,width:this.out.columns})))),s+o+An.gray(a||"")}paginateOptions(e){if(e.length===0)return An.red("No matches for this query.");let r=Mee(this.cursor,e.length,this.optionsPerPage),n=r.startIndex,i=r.endIndex,s,o=[];for(let a=n;a<i;a++)a===n&&n>0?s=Bi.arrowUp:a===i-1&&i<e.length?s=Bi.arrowDown:s=" ",o.push(this.renderOption(this.cursor,e[a],a,s));return`
|
|
118
118
|
`+o.join(`
|
|
119
|
-
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[An.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(An.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Lee.hide),super.render();let e=[sP.symbol(this.done,this.aborted),An.bold(this.msg),sP.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=An.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=iP(e,this.out.columns)}};oP.exports=Dw});var dP=v((
|
|
119
|
+
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[An.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(An.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Lee.hide),super.render();let e=[sP.symbol(this.done,this.aborted),An.bold(this.msg),sP.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=An.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=iP(e,this.out.columns)}};oP.exports=Dw});var dP=v((swe,hP)=>{"use strict";function aP(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function qee(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){aP(s,n,i,o,a,"next",u)}function a(u){aP(s,n,i,o,a,"throw",u)}o(void 0)})}}var _c=ht(),Uee=ei(),fP=Ye(),Hee=fP.erase,uP=fP.cursor,Cc=un(),bw=Cc.style,cP=Cc.clear,vw=Cc.figures,Vee=Cc.wrap,zee=Cc.entriesToDisplay,lP=(t,e)=>t[e]&&(t[e].value||t[e].title||t[e]),Gee=(t,e)=>t[e]&&(t[e].title||t[e].value||t[e]),Kee=(t,e)=>{let r=t.findIndex(n=>n.value===e||n.title===e);return r>-1?r:void 0},Ew=class extends Uee{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Kee(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=bw.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=cP("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=lP(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var r=this;return qee(function*(){let n=r.completing=r.suggest(r.input,r.choices),i=yield n;if(r.completing!==n)return;r.suggestions=i.map((o,a,u)=>({title:Gee(u,a),value:lP(u,a),description:o.description})),r.completing=!1;let s=Math.max(i.length-1,0);r.moveSelect(Math.min(s,r.select)),e&&e()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
120
120
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
121
121
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
122
122
|
`),this.close()}_(e,r){let n=this.input.slice(0,this.cursor),i=this.input.slice(this.cursor);this.input=`${n}${e}${i}`,this.cursor=n.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),r=this.input.slice(this.cursor);this.input=`${e}${r}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor+1);this.input=`${e}${r}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,r,n,i){let s,o=n?vw.arrowUp:i?vw.arrowDown:" ",a=r?_c.cyan().underline(e.title):e.title;return o=(r?_c.cyan(vw.pointer)+" ":" ")+o,e.description&&(s=` - ${e.description}`,(o.length+a.length+s.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(s=`
|
|
123
123
|
`+Vee(e.description,{margin:3,width:this.out.columns}))),o+" "+a+_c.gray(s||"")}render(){if(this.closed)return;this.firstRender?this.out.write(uP.hide):this.out.write(cP(this.outputText,this.out.columns)),super.render();let e=zee(this.select,this.choices.length,this.limit),r=e.startIndex,n=e.endIndex;if(this.outputText=[bw.symbol(this.done,this.aborted,this.exited),_c.bold(this.msg),bw.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let i=this.suggestions.slice(r,n).map((s,o)=>this.renderOption(s,this.select===o+r,o===0&&r>0,o+r===n-1&&n<this.choices.length)).join(`
|
|
124
124
|
`);this.outputText+=`
|
|
125
|
-
`+(i||_c.gray(this.fallback.title))}this.out.write(Hee.line+uP.to(0)+this.outputText)}};hP.exports=Ew});var yP=v((
|
|
125
|
+
`+(i||_c.gray(this.fallback.title))}this.out.write(Hee.line+uP.to(0)+this.outputText)}};hP.exports=Ew});var yP=v((owe,gP)=>{"use strict";var ni=ht(),Wee=Ye(),Xee=Wee.cursor,Yee=ww(),Cw=un(),pP=Cw.clear,mP=Cw.style,xa=Cw.figures,_w=class extends Yee{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=pP("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(n=>this.inputValue?!!(typeof n.title=="string"&&n.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof n.value=="string"&&n.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let r=this.filteredOptions.findIndex(n=>n===e);this.cursor=r<0?0:r,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,r){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
126
126
|
Instructions:
|
|
127
127
|
${xa.arrowUp}/${xa.arrowDown}: Highlight option
|
|
128
128
|
${xa.arrowLeft}/${xa.arrowRight}/[space]: Toggle selection
|
|
@@ -130,31 +130,31 @@ Instructions:
|
|
|
130
130
|
enter/return: Complete answer
|
|
131
131
|
`:""}renderCurrentInput(){return`
|
|
132
132
|
Filtered results for: ${this.inputValue?this.inputValue:ni.gray("Enter something to filter")}
|
|
133
|
-
`}renderOption(e,r,n){let i;return r.disabled?i=e===n?ni.gray().underline(r.title):ni.strikethrough().gray(r.title):i=e===n?ni.cyan().underline(r.title):r.title,(r.selected?ni.green(xa.radioOn):xa.radioOff)+" "+i}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[ni.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(ni.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Xee.hide),super.render();let e=[mP.symbol(this.done,this.aborted),ni.bold(this.msg),mP.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=ni.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=pP(e,this.out.columns)}};gP.exports=_w});var CP=v((
|
|
133
|
+
`}renderOption(e,r,n){let i;return r.disabled?i=e===n?ni.gray().underline(r.title):ni.strikethrough().gray(r.title):i=e===n?ni.cyan().underline(r.title):r.title,(r.selected?ni.green(xa.radioOn):xa.radioOff)+" "+i}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[ni.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(ni.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Xee.hide),super.render();let e=[mP.symbol(this.done,this.aborted),ni.bold(this.msg),mP.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=ni.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=pP(e,this.out.columns)}};gP.exports=_w});var CP=v((awe,_P)=>{"use strict";var DP=ht(),Jee=ei(),vP=un(),wP=vP.style,Zee=vP.clear,EP=Ye(),Qee=EP.erase,bP=EP.cursor,Sw=class extends Jee{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
134
134
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
135
|
-
`),this.close()}_(e,r){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(bP.hide):this.out.write(Zee(this.outputText,this.out.columns)),super.render(),this.outputText=[wP.symbol(this.done,this.aborted),DP.bold(this.msg),wP.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:DP.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Qee.line+bP.to(0)+this.outputText))}};_P.exports=Sw});var AP=v((
|
|
136
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{!s&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function ite(t,e){if(t){if(typeof t=="string")return IP(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return IP(t,e)}}function IP(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function PP(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function kP(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){PP(s,n,i,o,a,"next",u)}function a(u){PP(s,n,i,o,a,"throw",u)}o(void 0)})}}var Aw=xP(),ste=["suggest","format","onState","validate","onRender","type"],RP=()=>{};function Mi(){return Ow.apply(this,arguments)}function Ow(){return Ow=kP(function*(t=[],{onSubmit:e=RP,onCancel:r=RP}={}){let n={},i=Mi._override||{};t=[].concat(t);let s,o,a,u,c,l,h=(function(){var b=kP(function*(S,A,p=!1){if(!(!p&&S.validate&&S.validate(A)!==!0))return S.format?yield S.format(A,n):A});return function(A,p){return b.apply(this,arguments)}})();var d=nte(t),f;try{for(d.s();!(f=d.n()).done;){o=f.value;var m=o;if(u=m.name,c=m.type,typeof c=="function"&&(c=yield c(s,FP({},n),o),o.type=c),!!c){for(let b in o){if(ste.includes(b))continue;let S=o[b];o[b]=typeof S=="function"?yield S(s,FP({},n),l):S}if(l=o,typeof o.message!="string")throw new Error("prompt message is required");var g=o;if(u=g.name,c=g.type,Aw[c]===void 0)throw new Error(`prompt type (${c}) is not defined`);if(i[o.name]!==void 0&&(s=yield h(o,i[o.name]),s!==void 0)){n[u]=s;continue}try{s=Mi._injected?ote(Mi._injected,o.initial):yield Aw[c](o),n[u]=s=yield h(o,s,!0),a=yield e(o,s,n)}catch{a=!(yield r(o,n))}if(a)return n}}}catch(b){d.e(b)}finally{d.f()}return n}),Ow.apply(this,arguments)}function ote(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function ate(t){Mi._injected=(Mi._injected||[]).concat(t)}function ute(t){Mi._override=Object.assign({},t)}NP.exports=Object.assign(Mi,{prompt:Mi,prompts:Aw,inject:ate,override:ute})});var jP=v((
|
|
135
|
+
`),this.close()}_(e,r){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(bP.hide):this.out.write(Zee(this.outputText,this.out.columns)),super.render(),this.outputText=[wP.symbol(this.done,this.aborted),DP.bold(this.msg),wP.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:DP.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Qee.line+bP.to(0)+this.outputText))}};_P.exports=Sw});var AP=v((uwe,SP)=>{"use strict";SP.exports={TextPrompt:f2(),SelectPrompt:m2(),TogglePrompt:v2(),DatePrompt:Y2(),NumberPrompt:nP(),MultiselectPrompt:ww(),AutocompletePrompt:dP(),AutocompleteMultiselectPrompt:yP(),ConfirmPrompt:CP()}});var xP=v(OP=>{"use strict";var vr=OP,ete=AP(),wd=t=>t;function On(t,e,r={}){return new Promise((n,i)=>{let s=new ete[t](e),o=r.onAbort||wd,a=r.onSubmit||wd,u=r.onExit||wd;s.on("state",e.onState||wd),s.on("submit",c=>n(a(c))),s.on("exit",c=>n(u(c))),s.on("abort",c=>i(o(c)))})}vr.text=t=>On("TextPrompt",t);vr.password=t=>(t.style="password",vr.text(t));vr.invisible=t=>(t.style="invisible",vr.text(t));vr.number=t=>On("NumberPrompt",t);vr.date=t=>On("DatePrompt",t);vr.confirm=t=>On("ConfirmPrompt",t);vr.list=t=>{let e=t.separator||",";return On("TextPrompt",t,{onSubmit:r=>r.split(e).map(n=>n.trim())})};vr.toggle=t=>On("TogglePrompt",t);vr.select=t=>On("SelectPrompt",t);vr.multiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return On("MultiselectPrompt",t,{onAbort:e,onSubmit:e})};vr.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return On("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})};var tte=(t,e)=>Promise.resolve(e.filter(r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));vr.autocomplete=t=>(t.suggest=t.suggest||tte,t.choices=[].concat(t.choices||[]),On("AutocompletePrompt",t))});var $P=v((lwe,NP)=>{"use strict";function TP(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function FP(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?TP(Object(r),!0).forEach(function(n){rte(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):TP(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function rte(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function nte(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ite(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(c){throw c},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
136
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{!s&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function ite(t,e){if(t){if(typeof t=="string")return IP(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return IP(t,e)}}function IP(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function PP(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function kP(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){PP(s,n,i,o,a,"next",u)}function a(u){PP(s,n,i,o,a,"throw",u)}o(void 0)})}}var Aw=xP(),ste=["suggest","format","onState","validate","onRender","type"],RP=()=>{};function Mi(){return Ow.apply(this,arguments)}function Ow(){return Ow=kP(function*(t=[],{onSubmit:e=RP,onCancel:r=RP}={}){let n={},i=Mi._override||{};t=[].concat(t);let s,o,a,u,c,l,h=(function(){var b=kP(function*(S,A,p=!1){if(!(!p&&S.validate&&S.validate(A)!==!0))return S.format?yield S.format(A,n):A});return function(A,p){return b.apply(this,arguments)}})();var d=nte(t),f;try{for(d.s();!(f=d.n()).done;){o=f.value;var m=o;if(u=m.name,c=m.type,typeof c=="function"&&(c=yield c(s,FP({},n),o),o.type=c),!!c){for(let b in o){if(ste.includes(b))continue;let S=o[b];o[b]=typeof S=="function"?yield S(s,FP({},n),l):S}if(l=o,typeof o.message!="string")throw new Error("prompt message is required");var g=o;if(u=g.name,c=g.type,Aw[c]===void 0)throw new Error(`prompt type (${c}) is not defined`);if(i[o.name]!==void 0&&(s=yield h(o,i[o.name]),s!==void 0)){n[u]=s;continue}try{s=Mi._injected?ote(Mi._injected,o.initial):yield Aw[c](o),n[u]=s=yield h(o,s,!0),a=yield e(o,s,n)}catch{a=!(yield r(o,n))}if(a)return n}}}catch(b){d.e(b)}finally{d.f()}return n}),Ow.apply(this,arguments)}function ote(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function ate(t){Mi._injected=(Mi._injected||[]).concat(t)}function ute(t){Mi._override=Object.assign({},t)}NP.exports=Object.assign(Mi,{prompt:Mi,prompts:Aw,inject:ate,override:ute})});var jP=v((fwe,LP)=>{"use strict";LP.exports=(t,e)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(e){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"home":t.name==="end"?"end":t.name==="up"?"up":t.name==="down"?"down":t.name==="right"?"right":t.name==="left"?"left":!1}}});var bd=v((hwe,BP)=>{"use strict";BP.exports=t=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),r=new RegExp(e,"g");return typeof t=="string"?t.replace(r,""):t}});var UP=v((dwe,qP)=>{"use strict";var cte=bd(),{erase:MP,cursor:lte}=Ye(),fte=t=>[...cte(t)].length;qP.exports=function(t,e){if(!e)return MP.line+lte.to(0);let r=0,n=t.split(/\r?\n/);for(let i of n)r+=1+Math.floor(Math.max(fte(i)-1,0)/e);return MP.lines(r)}});var xw=v((pwe,HP)=>{"use strict";var Sc={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},hte={arrowUp:Sc.arrowUp,arrowDown:Sc.arrowDown,arrowLeft:Sc.arrowLeft,arrowRight:Sc.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},dte=process.platform==="win32"?hte:Sc;HP.exports=dte});var zP=v((mwe,VP)=>{"use strict";var Ta=ht(),Gs=xw(),Tw=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"\u{1F603}".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}}),pte=t=>Tw[t]||Tw.default,Ac=Object.freeze({aborted:Ta.red(Gs.cross),done:Ta.green(Gs.tick),exited:Ta.yellow(Gs.cross),default:Ta.cyan("?")}),mte=(t,e,r)=>e?Ac.aborted:r?Ac.exited:t?Ac.done:Ac.default,gte=t=>Ta.gray(t?Gs.ellipsis:Gs.pointerSmall),yte=(t,e)=>Ta.gray(t?e?Gs.pointerSmall:"+":Gs.line);VP.exports={styles:Tw,render:pte,symbols:Ac,symbol:mte,delimiter:gte,item:yte}});var KP=v((gwe,GP)=>{"use strict";var Dte=bd();GP.exports=function(t,e){let r=String(Dte(t)||"").split(/\r?\n/);return e?r.map(n=>Math.ceil(n.length/e)).reduce((n,i)=>n+i):r.length}});var XP=v((ywe,WP)=>{"use strict";WP.exports=(t,e={})=>{let r=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",n=e.width;return(t||"").split(/\r?\n/g).map(i=>i.split(/\s+/g).reduce((s,o)=>(o.length+r.length>=n||s[s.length-1].length+o.length+1<n?s[s.length-1]+=` ${o}`:s.push(`${r}${o}`),s),[r]).join(`
|
|
137
137
|
`)).join(`
|
|
138
|
-
`)}});var JP=v((
|
|
138
|
+
`)}});var JP=v((Dwe,YP)=>{"use strict";YP.exports=(t,e,r)=>{r=r||e;let n=Math.min(e-r,t-Math.floor(r/2));n<0&&(n=0);let i=Math.min(n+r,e);return{startIndex:n,endIndex:i}}});var cn=v((wwe,ZP)=>{"use strict";ZP.exports={action:jP(),clear:UP(),style:zP(),strip:bd(),figures:xw(),lines:KP(),wrap:XP(),entriesToDisplay:JP()}});var ii=v((bwe,ek)=>{"use strict";var QP=require("readline"),{action:wte}=cn(),bte=require("events"),{beep:vte,cursor:Ete}=Ye(),_te=ht(),Fw=class extends bte{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let r=QP.createInterface({input:this.in,escapeCodeTimeout:50});QP.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);let n=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,i=(s,o)=>{let a=wte(o,n);a===!1?this._&&this._(s,o):typeof this[a]=="function"?this[a](o):this.bell()};this.close=()=>{this.out.write(Ete.show),this.in.removeListener("keypress",i),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",i)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(vte)}render(){this.onRender(_te),this.firstRender&&(this.firstRender=!1)}};ek.exports=Fw});var rk=v((vwe,tk)=>{var vd=ht(),Cte=ii(),{erase:Ste,cursor:Oc}=Ye(),{style:Iw,clear:Pw,lines:Ate,figures:Ote}=cn(),kw=class extends Cte{constructor(e={}){super(e),this.transform=Iw.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=Pw("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=vd.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
|
|
139
139
|
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
140
140
|
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,r){let n=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor);this.value=`${n}${e}${i}`,this.red=!1,this.cursor=this.placeholder?0:n.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),r=this.value.slice(this.cursor);this.value=`${e}${r}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor+1);this.value=`${e}${r}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Oc.down(Ate(this.outputError,this.out.columns)-1)+Pw(this.outputError,this.out.columns)),this.out.write(Pw(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Iw.symbol(this.done,this.aborted),vd.bold(this.msg),Iw.delimiter(this.done),this.red?vd.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
141
141
|
`).reduce((e,r,n)=>e+`
|
|
142
|
-
${n?" ":Ote.pointerSmall} ${vd.red().italic(r)}`,"")),this.out.write(Ste.line+Oc.to(0)+this.outputText+Oc.save+this.outputError+Oc.restore+Oc.move(this.cursorOffset,0)))}};tk.exports=kw});var ok=v((
|
|
142
|
+
${n?" ":Ote.pointerSmall} ${vd.red().italic(r)}`,"")),this.out.write(Ste.line+Oc.to(0)+this.outputText+Oc.save+this.outputError+Oc.restore+Oc.move(this.cursorOffset,0)))}};tk.exports=kw});var ok=v((Ewe,sk)=>{"use strict";var si=ht(),xte=ii(),{style:nk,clear:ik,figures:Ed,wrap:Tte,entriesToDisplay:Fte}=cn(),{cursor:Ite}=Ye(),Rw=class extends xte{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),value:r&&(r.value===void 0?n:r.value),description:r&&r.description,selected:r&&r.selected,disabled:r&&r.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=ik("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
143
143
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
144
144
|
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,r){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Ite.hide):this.out.write(ik(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:r}=Fte(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[nk.symbol(this.done,this.aborted),si.bold(this.msg),nk.delimiter(!1),this.done?this.selection.title:this.selection.disabled?si.yellow(this.warn):si.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
145
145
|
`;for(let n=e;n<r;n++){let i,s,o="",a=this.choices[n];n===e&&e>0?s=Ed.arrowUp:n===r-1&&r<this.choices.length?s=Ed.arrowDown:s=" ",a.disabled?(i=this.cursor===n?si.gray().underline(a.title):si.strikethrough().gray(a.title),s=(this.cursor===n?si.bold().gray(Ed.pointer)+" ":" ")+s):(i=this.cursor===n?si.cyan().underline(a.title):a.title,s=(this.cursor===n?si.cyan(Ed.pointer)+" ":" ")+s,a.description&&this.cursor===n&&(o=` - ${a.description}`,(s.length+i.length+o.length>=this.out.columns||a.description.split(/\r?\n/).length>1)&&(o=`
|
|
146
146
|
`+Tte(a.description,{margin:3,width:this.out.columns})))),this.outputText+=`${s} ${i}${si.gray(o)}
|
|
147
|
-
`}}this.out.write(this.outputText)}};sk.exports=Rw});var lk=v((
|
|
147
|
+
`}}this.out.write(this.outputText)}};sk.exports=Rw});var lk=v((_we,ck)=>{var _d=ht(),Pte=ii(),{style:ak,clear:kte}=cn(),{cursor:uk,erase:Rte}=Ye(),Nw=class extends Pte{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
148
148
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
149
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,r){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(uk.hide):this.out.write(kte(this.outputText,this.out.columns)),super.render(),this.outputText=[ak.symbol(this.done,this.aborted),_d.bold(this.msg),ak.delimiter(this.done),this.value?this.inactive:_d.cyan().underline(this.inactive),_d.gray("/"),this.value?_d.cyan().underline(this.active):this.active].join(" "),this.out.write(Rte.line+uk.to(0)+this.outputText))}};ck.exports=Nw});var xn=v((
|
|
149
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,r){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(uk.hide):this.out.write(kte(this.outputText,this.out.columns)),super.render(),this.outputText=[ak.symbol(this.done,this.aborted),_d.bold(this.msg),ak.delimiter(this.done),this.value?this.inactive:_d.cyan().underline(this.inactive),_d.gray("/"),this.value?_d.cyan().underline(this.active):this.active].join(" "),this.out.write(Rte.line+uk.to(0)+this.outputText))}};ck.exports=Nw});var xn=v((Cwe,fk)=>{"use strict";var $w=class t{constructor({token:e,date:r,parts:n,locales:i}){this.token=e,this.date=r||new Date,this.parts=n||[this],this.locales=i||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((r,n)=>n>e&&r instanceof t)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),r=e.indexOf(this);return e.find((n,i)=>i>r&&n instanceof t)}toString(){return String(this.date)}};fk.exports=$w});var dk=v((Swe,hk)=>{"use strict";var Nte=xn(),Lw=class extends Nte{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};hk.exports=Lw});var mk=v((Awe,pk)=>{"use strict";var $te=xn(),Lte=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th"),jw=class extends $te{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+Lte(e):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:e}};pk.exports=jw});var yk=v((Owe,gk)=>{"use strict";var jte=xn(),Bw=class extends jte{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};gk.exports=Bw});var wk=v((xwe,Dk)=>{"use strict";var Bte=xn(),Mw=class extends Bte{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};Dk.exports=Mw});var vk=v((Twe,bk)=>{"use strict";var Mte=xn(),qw=class extends Mte{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};bk.exports=qw});var _k=v((Fwe,Ek)=>{"use strict";var qte=xn(),Uw=class extends qte{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),r=this.token.length;return r===2?String(e+1).padStart(2,"0"):r===3?this.locales.monthsShort[e]:r===4?this.locales.months[e]:String(e+1)}};Ek.exports=Uw});var Sk=v((Iwe,Ck)=>{"use strict";var Ute=xn(),Hw=class extends Ute{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};Ck.exports=Hw});var Ok=v((Pwe,Ak)=>{"use strict";var Hte=xn(),Vw=class extends Hte{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};Ak.exports=Vw});var Tk=v((kwe,xk)=>{"use strict";xk.exports={DatePart:xn(),Meridiem:dk(),Day:mk(),Hours:yk(),Milliseconds:wk(),Minutes:vk(),Month:_k(),Seconds:Sk(),Year:Ok()}});var $k=v((Rwe,Nk)=>{"use strict";var zw=ht(),Vte=ii(),{style:Fk,clear:Ik,figures:zte}=cn(),{erase:Gte,cursor:Pk}=Ye(),{DatePart:kk,Meridiem:Kte,Day:Wte,Hours:Xte,Milliseconds:Yte,Minutes:Jte,Month:Zte,Seconds:Qte,Year:ere}=Tk(),tre=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,Rk={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new Wte(t),3:t=>new Zte(t),4:t=>new ere(t),5:t=>new Kte(t),6:t=>new Xte(t),7:t=>new Jte(t),8:t=>new Qte(t),9:t=>new Yte(t)},rre={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},Gw=class extends Vte{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(rre,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=Ik("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let r;for(this.parts=[];r=tre.exec(e);){let i=r.shift(),s=r.findIndex(o=>o!=null);this.parts.push(s in Rk?Rk[s]({token:r[s]||i,date:this.date,parts:this.parts,locales:this.locales}):r[s]||i)}let n=this.parts.reduce((i,s)=>(typeof s=="string"&&typeof i[i.length-1]=="string"?i[i.length-1]+=s:i.push(s),i),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof kk)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
150
150
|
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
151
151
|
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(r=>r instanceof kk)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(Pk.hide):this.out.write(Ik(this.outputText,this.out.columns)),super.render(),this.outputText=[Fk.symbol(this.done,this.aborted),zw.bold(this.msg),Fk.delimiter(!1),this.parts.reduce((e,r,n)=>e.concat(n===this.cursor&&!this.done?zw.cyan().underline(r.toString()):r),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
152
152
|
`).reduce((e,r,n)=>e+`
|
|
153
|
-
${n?" ":zte.pointerSmall} ${zw.red().italic(r)}`,"")),this.out.write(Gte.line+Pk.to(0)+this.outputText))}};Nk.exports=Gw});var Mk=v((
|
|
153
|
+
${n?" ":zte.pointerSmall} ${zw.red().italic(r)}`,"")),this.out.write(Gte.line+Pk.to(0)+this.outputText))}};Nk.exports=Gw});var Mk=v((Nwe,Bk)=>{var Cd=ht(),nre=ii(),{cursor:Sd,erase:ire}=Ye(),{style:Kw,figures:sre,clear:Lk,lines:ore}=cn(),are=/[0-9]/,Ww=t=>t!==void 0,jk=(t,e)=>{let r=Math.pow(10,e);return Math.round(t*r)/r},Xw=class extends nre{constructor(e={}){super(e),this.transform=Kw.render(e.style),this.msg=e.message,this.initial=Ww(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=Ww(e.min)?e.min:-1/0,this.max=Ww(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Cd.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${jk(e,this.round)}`),this._value=jk(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||are.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
154
154
|
`),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let e=this.value;this.value=e!==""?e:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
155
155
|
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,r){if(!this.valid(e))return this.bell();let n=Date.now();if(n-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=n,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Sd.down(ore(this.outputError,this.out.columns)-1)+Lk(this.outputError,this.out.columns)),this.out.write(Lk(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Kw.symbol(this.done,this.aborted),Cd.bold(this.msg),Kw.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Cd[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
156
156
|
`).reduce((e,r,n)=>e+`
|
|
157
|
-
${n?" ":sre.pointerSmall} ${Cd.red().italic(r)}`,"")),this.out.write(ire.line+Sd.to(0)+this.outputText+Sd.save+this.outputError+Sd.restore))}};Bk.exports=Xw});var Jw=v((
|
|
157
|
+
${n?" ":sre.pointerSmall} ${Cd.red().italic(r)}`,"")),this.out.write(ire.line+Sd.to(0)+this.outputText+Sd.save+this.outputError+Sd.restore))}};Bk.exports=Xw});var Jw=v(($we,Hk)=>{"use strict";var Tn=ht(),{cursor:ure}=Ye(),cre=ii(),{clear:qk,figures:qi,style:Uk,wrap:lre,entriesToDisplay:fre}=cn(),Yw=class extends cre{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),description:r&&r.description,value:r&&(r.value===void 0?n:r.value),selected:r&&r.selected,disabled:r&&r.disabled})),this.clear=qk("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
158
158
|
`),this.close()}submit(){let e=this.value.filter(r=>r.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
159
159
|
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(r=>!r.disabled).forEach(r=>r.selected=e),this.render()}_(e,r){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
160
160
|
Instructions:
|
|
@@ -164,13 +164,13 @@ Instructions:
|
|
|
164
164
|
`:"")+" enter/return: Complete answer":""}renderOption(e,r,n,i){let s=(r.selected?Tn.green(qi.radioOn):qi.radioOff)+" "+i+" ",o,a;return r.disabled?o=e===n?Tn.gray().underline(r.title):Tn.strikethrough().gray(r.title):(o=e===n?Tn.cyan().underline(r.title):r.title,e===n&&r.description&&(a=` - ${r.description}`,(s.length+o.length+a.length>=this.out.columns||r.description.split(/\r?\n/).length>1)&&(a=`
|
|
165
165
|
`+lre(r.description,{margin:s.length,width:this.out.columns})))),s+o+Tn.gray(a||"")}paginateOptions(e){if(e.length===0)return Tn.red("No matches for this query.");let{startIndex:r,endIndex:n}=fre(this.cursor,e.length,this.optionsPerPage),i,s=[];for(let o=r;o<n;o++)o===r&&r>0?i=qi.arrowUp:o===n-1&&n<e.length?i=qi.arrowDown:i=" ",s.push(this.renderOption(this.cursor,e[o],o,i));return`
|
|
166
166
|
`+s.join(`
|
|
167
|
-
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[Tn.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(Tn.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(ure.hide),super.render();let e=[Uk.symbol(this.done,this.aborted),Tn.bold(this.msg),Uk.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Tn.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=qk(e,this.out.columns)}};Hk.exports=Yw});var Wk=v((
|
|
167
|
+
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[Tn.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(Tn.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(ure.hide),super.render();let e=[Uk.symbol(this.done,this.aborted),Tn.bold(this.msg),Uk.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Tn.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=qk(e,this.out.columns)}};Hk.exports=Yw});var Wk=v((Lwe,Kk)=>{"use strict";var xc=ht(),hre=ii(),{erase:dre,cursor:Vk}=Ye(),{style:Zw,clear:zk,figures:Qw,wrap:pre,entriesToDisplay:mre}=cn(),Gk=(t,e)=>t[e]&&(t[e].value||t[e].title||t[e]),gre=(t,e)=>t[e]&&(t[e].title||t[e].value||t[e]),yre=(t,e)=>{let r=t.findIndex(n=>n.value===e||n.title===e);return r>-1?r:void 0},eb=class extends hre{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:yre(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=Zw.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=zk("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=Gk(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){let r=this.completing=this.suggest(this.input,this.choices),n=await r;if(this.completing!==r)return;this.suggestions=n.map((s,o,a)=>({title:gre(a,o),value:Gk(a,o),description:s.description})),this.completing=!1;let i=Math.max(n.length-1,0);this.moveSelect(Math.min(i,this.select)),e&&e()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
168
168
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
169
169
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
170
170
|
`),this.close()}_(e,r){let n=this.input.slice(0,this.cursor),i=this.input.slice(this.cursor);this.input=`${n}${e}${i}`,this.cursor=n.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),r=this.input.slice(this.cursor);this.input=`${e}${r}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor+1);this.input=`${e}${r}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,r,n,i){let s,o=n?Qw.arrowUp:i?Qw.arrowDown:" ",a=r?xc.cyan().underline(e.title):e.title;return o=(r?xc.cyan(Qw.pointer)+" ":" ")+o,e.description&&(s=` - ${e.description}`,(o.length+a.length+s.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(s=`
|
|
171
171
|
`+pre(e.description,{margin:3,width:this.out.columns}))),o+" "+a+xc.gray(s||"")}render(){if(this.closed)return;this.firstRender?this.out.write(Vk.hide):this.out.write(zk(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:r}=mre(this.select,this.choices.length,this.limit);if(this.outputText=[Zw.symbol(this.done,this.aborted,this.exited),xc.bold(this.msg),Zw.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let n=this.suggestions.slice(e,r).map((i,s)=>this.renderOption(i,this.select===s+e,s===0&&e>0,s+e===r-1&&r<this.choices.length)).join(`
|
|
172
172
|
`);this.outputText+=`
|
|
173
|
-
`+(n||xc.gray(this.fallback.title))}this.out.write(dre.line+Vk.to(0)+this.outputText)}};Kk.exports=eb});var Zk=v((
|
|
173
|
+
`+(n||xc.gray(this.fallback.title))}this.out.write(dre.line+Vk.to(0)+this.outputText)}};Kk.exports=eb});var Zk=v((jwe,Jk)=>{"use strict";var oi=ht(),{cursor:Dre}=Ye(),wre=Jw(),{clear:Xk,style:Yk,figures:Fa}=cn(),tb=class extends wre{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=Xk("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(n=>this.inputValue?!!(typeof n.title=="string"&&n.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof n.value=="string"&&n.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let r=this.filteredOptions.findIndex(n=>n===e);this.cursor=r<0?0:r,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,r){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
174
174
|
Instructions:
|
|
175
175
|
${Fa.arrowUp}/${Fa.arrowDown}: Highlight option
|
|
176
176
|
${Fa.arrowLeft}/${Fa.arrowRight}/[space]: Toggle selection
|
|
@@ -178,29 +178,29 @@ Instructions:
|
|
|
178
178
|
enter/return: Complete answer
|
|
179
179
|
`:""}renderCurrentInput(){return`
|
|
180
180
|
Filtered results for: ${this.inputValue?this.inputValue:oi.gray("Enter something to filter")}
|
|
181
|
-
`}renderOption(e,r,n){let i;return r.disabled?i=e===n?oi.gray().underline(r.title):oi.strikethrough().gray(r.title):i=e===n?oi.cyan().underline(r.title):r.title,(r.selected?oi.green(Fa.radioOn):Fa.radioOff)+" "+i}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[oi.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(oi.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Dre.hide),super.render();let e=[Yk.symbol(this.done,this.aborted),oi.bold(this.msg),Yk.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=oi.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=Xk(e,this.out.columns)}};Jk.exports=tb});var nR=v((
|
|
181
|
+
`}renderOption(e,r,n){let i;return r.disabled?i=e===n?oi.gray().underline(r.title):oi.strikethrough().gray(r.title):i=e===n?oi.cyan().underline(r.title):r.title,(r.selected?oi.green(Fa.radioOn):Fa.radioOff)+" "+i}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[oi.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(oi.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Dre.hide),super.render();let e=[Yk.symbol(this.done,this.aborted),oi.bold(this.msg),Yk.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=oi.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=Xk(e,this.out.columns)}};Jk.exports=tb});var nR=v((Bwe,rR)=>{var Qk=ht(),bre=ii(),{style:eR,clear:vre}=cn(),{erase:Ere,cursor:tR}=Ye(),rb=class extends bre{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
182
182
|
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
183
|
-
`),this.close()}_(e,r){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(tR.hide):this.out.write(vre(this.outputText,this.out.columns)),super.render(),this.outputText=[eR.symbol(this.done,this.aborted),Qk.bold(this.msg),eR.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Qk.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Ere.line+tR.to(0)+this.outputText))}};rR.exports=rb});var sR=v((
|
|
184
|
-
`},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(sb)});var In=v((dR,Hi)=>{(function(){var t,e,r,n,i,s,o,a=[].slice,u={}.hasOwnProperty;t=function(){var c,l,h,d,f,m;if(m=arguments[0],f=2<=arguments.length?a.call(arguments,1):[],i(Object.assign))Object.assign.apply(null,arguments);else for(c=0,h=f.length;c<h;c++)if(d=f[c],d!=null)for(l in d)u.call(d,l)&&(m[l]=d[l]);return m},i=function(c){return!!c&&Object.prototype.toString.call(c)==="[object Function]"},s=function(c){var l;return!!c&&((l=typeof c)=="function"||l==="object")},r=function(c){return i(Array.isArray)?Array.isArray(c):Object.prototype.toString.call(c)==="[object Array]"},n=function(c){var l;if(r(c))return!c.length;for(l in c)if(u.call(c,l))return!1;return!0},o=function(c){var l,h;return s(c)&&(h=Object.getPrototypeOf(c))&&(l=h.constructor)&&typeof l=="function"&&l instanceof l&&Function.prototype.toString.call(l)===Function.prototype.toString.call(Object)},e=function(c){return i(c.valueOf)?c.valueOf():c},Hi.exports.assign=t,Hi.exports.isFunction=i,Hi.exports.isObject=s,Hi.exports.isArray=r,Hi.exports.isEmpty=n,Hi.exports.isPlainObject=o,Hi.exports.getValue=e}).call(dR)});var ob=v((pR,mR)=>{(function(){var t;mR.exports=t=(function(){function e(){}return e.prototype.hasFeature=function(r,n){return!0},e.prototype.createDocumentType=function(r,n,i){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(r,n,i){throw new Error("This DOM method is not implemented.")},e.prototype.createHTMLDocument=function(r){throw new Error("This DOM method is not implemented.")},e.prototype.getFeature=function(r,n){throw new Error("This DOM method is not implemented.")},e})()}).call(pR)});var DR=v((gR,yR)=>{(function(){var t;yR.exports=t=(function(){function e(){}return e.prototype.handleError=function(r){throw new Error(r)},e})()}).call(gR)});var vR=v((wR,bR)=>{(function(){var t;bR.exports=t=(function(){function e(r){this.arr=r||[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.arr.length}}),e.prototype.item=function(r){return this.arr[r]||null},e.prototype.contains=function(r){return this.arr.indexOf(r)!==-1},e})()}).call(wR)});var CR=v((ER,_R)=>{(function(){var t,e,r;e=DR(),r=vR(),_R.exports=t=(function(){function n(){var i;this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new e,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=i=Object.create(this.defaultParams)}return Object.defineProperty(n.prototype,"parameterNames",{get:function(){return new r(Object.keys(this.defaultParams))}}),n.prototype.getParameter=function(i){return this.params.hasOwnProperty(i)?this.params[i]:null},n.prototype.canSetParameter=function(i,s){return!0},n.prototype.setParameter=function(i,s){return s!=null?this.params[i]=s:delete this.params[i]},n})()}).call(ER)});var Et=v((SR,AR)=>{(function(){AR.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}).call(SR)});var ab=v((OR,xR)=>{(function(){var t,e,r;t=Et(),r=Fr(),xR.exports=e=(function(){function n(i,s,o){if(this.parent=i,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),s==null)throw new Error("Missing attribute name. "+this.debugInfo(s));this.name=this.stringify.name(s),this.value=this.stringify.attValue(o),this.type=t.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(n.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(n.prototype,"textContent",{get:function(){return this.value},set:function(i){return this.value=i||""}}),Object.defineProperty(n.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(n.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(n.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(n.prototype,"specified",{get:function(){return!0}}),n.prototype.clone=function(){return Object.create(this)},n.prototype.toString=function(i){return this.options.writer.attribute(this,this.options.writer.filterOptions(i))},n.prototype.debugInfo=function(i){return i=i||this.name,i==null?"parent: <"+this.parent.name+">":"attribute: {"+i+"}, parent: <"+this.parent.name+">"},n.prototype.isEqualNode=function(i){return!(i.namespaceURI!==this.namespaceURI||i.prefix!==this.prefix||i.localName!==this.localName||i.value!==this.value)},n})()}).call(OR)});var Fd=v((TR,FR)=>{(function(){var t;FR.exports=t=(function(){function e(r){this.nodes=r}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.getNamedItem=function(r){return this.nodes[r]},e.prototype.setNamedItem=function(r){var n;return n=this.nodes[r.nodeName],this.nodes[r.nodeName]=r,n||null},e.prototype.removeNamedItem=function(r){var n;return n=this.nodes[r],delete this.nodes[r],n||null},e.prototype.item=function(r){return this.nodes[Object.keys(this.nodes)[r]]||null},e.prototype.getNamedItemNS=function(r,n){throw new Error("This DOM method is not implemented.")},e.prototype.setNamedItemNS=function(r){throw new Error("This DOM method is not implemented.")},e.prototype.removeNamedItemNS=function(r,n){throw new Error("This DOM method is not implemented.")},e})()}).call(TR)});var Id=v((IR,PR)=>{(function(){var t,e,r,n,i,s,o,a,u,c=function(h,d){for(var f in d)l.call(d,f)&&(h[f]=d[f]);function m(){this.constructor=h}return m.prototype=d.prototype,h.prototype=new m,h.__super__=d.prototype,h},l={}.hasOwnProperty;u=In(),a=u.isObject,o=u.isFunction,s=u.getValue,i=Fr(),t=Et(),e=ab(),n=Fd(),PR.exports=r=(function(h){c(d,h);function d(f,m,g){var b,S,A,p;if(d.__super__.constructor.call(this,f),m==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(m),this.type=t.Element,this.attribs={},this.schemaTypeInfo=null,g!=null&&this.attribute(g),f.type===t.Document&&(this.isRoot=!0,this.documentObject=f,f.rootObject=this,f.children)){for(p=f.children,S=0,A=p.length;S<A;S++)if(b=p[S],b.type===t.DocType){b.name=this.name;break}}}return Object.defineProperty(d.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(d.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(d.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(d.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(d.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new n(this.attribs)),this.attributeMap}}),d.prototype.clone=function(){var f,m,g,b;g=Object.create(this),g.isRoot&&(g.documentObject=null),g.attribs={},b=this.attribs;for(m in b)l.call(b,m)&&(f=b[m],g.attribs[m]=f.clone());return g.children=[],this.children.forEach(function(S){var A;return A=S.clone(),A.parent=g,g.children.push(A)}),g},d.prototype.attribute=function(f,m){var g,b;if(f!=null&&(f=s(f)),a(f))for(g in f)l.call(f,g)&&(b=f[g],this.attribute(g,b));else o(m)&&(m=m.apply()),this.options.keepNullAttributes&&m==null?this.attribs[f]=new e(this,f,""):m!=null&&(this.attribs[f]=new e(this,f,m));return this},d.prototype.removeAttribute=function(f){var m,g,b;if(f==null)throw new Error("Missing attribute name. "+this.debugInfo());if(f=s(f),Array.isArray(f))for(g=0,b=f.length;g<b;g++)m=f[g],delete this.attribs[m];else delete this.attribs[f];return this},d.prototype.toString=function(f){return this.options.writer.element(this,this.options.writer.filterOptions(f))},d.prototype.att=function(f,m){return this.attribute(f,m)},d.prototype.a=function(f,m){return this.attribute(f,m)},d.prototype.getAttribute=function(f){return this.attribs.hasOwnProperty(f)?this.attribs[f].value:null},d.prototype.setAttribute=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNode=function(f){return this.attribs.hasOwnProperty(f)?this.attribs[f]:null},d.prototype.setAttributeNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.removeAttributeNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setAttributeNS=function(f,m,g){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.removeAttributeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNodeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setAttributeNodeNS=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagNameNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.hasAttribute=function(f){return this.attribs.hasOwnProperty(f)},d.prototype.hasAttributeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setIdAttribute=function(f,m){return this.attribs.hasOwnProperty(f)?this.attribs[f].isId:m},d.prototype.setIdAttributeNS=function(f,m,g){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setIdAttributeNode=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagNameNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByClassName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.isEqualNode=function(f){var m,g,b;if(!d.__super__.isEqualNode.apply(this,arguments).isEqualNode(f)||f.namespaceURI!==this.namespaceURI||f.prefix!==this.prefix||f.localName!==this.localName||f.attribs.length!==this.attribs.length)return!1;for(m=g=0,b=this.attribs.length-1;0<=b?g<=b:g>=b;m=0<=b?++g:--g)if(!this.attribs[m].isEqualNode(f.attribs[m]))return!1;return!0},d})(i)}).call(IR)});var Tc=v((kR,RR)=>{(function(){var t,e,r=function(i,s){for(var o in s)n.call(s,o)&&(i[o]=s[o]);function a(){this.constructor=i}return a.prototype=s.prototype,i.prototype=new a,i.__super__=s.prototype,i},n={}.hasOwnProperty;e=Fr(),RR.exports=t=(function(i){r(s,i);function s(o){s.__super__.constructor.call(this,o),this.value=""}return Object.defineProperty(s.prototype,"data",{get:function(){return this.value},set:function(o){return this.value=o||""}}),Object.defineProperty(s.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(s.prototype,"textContent",{get:function(){return this.value},set:function(o){return this.value=o||""}}),s.prototype.clone=function(){return Object.create(this)},s.prototype.substringData=function(o,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.appendData=function(o){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.insertData=function(o,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.deleteData=function(o,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.replaceData=function(o,a,u){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.isEqualNode=function(o){return!(!s.__super__.isEqualNode.apply(this,arguments).isEqualNode(o)||o.data!==this.data)},s})(e)}).call(kR)});var Pd=v((NR,$R)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=Et(),r=Tc(),$R.exports=e=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=t.CData,this.value=this.stringify.cdata(u)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.cdata(this,this.options.writer.filterOptions(a))},o})(r)}).call(NR)});var kd=v((LR,jR)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=Et(),e=Tc(),jR.exports=r=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=t.Comment,this.value=this.stringify.comment(u)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.comment(this,this.options.writer.filterOptions(a))},o})(e)}).call(LR)});var Rd=v((BR,MR)=>{(function(){var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;n=In().isObject,r=Fr(),t=Et(),MR.exports=e=(function(o){i(a,o);function a(u,c,l,h){var d;a.__super__.constructor.call(this,u),n(c)&&(d=c,c=d.version,l=d.encoding,h=d.standalone),c||(c="1.0"),this.type=t.Declaration,this.version=this.stringify.xmlVersion(c),l!=null&&(this.encoding=this.stringify.xmlEncoding(l)),h!=null&&(this.standalone=this.stringify.xmlStandalone(h))}return a.prototype.toString=function(u){return this.options.writer.declaration(this,this.options.writer.filterOptions(u))},a})(r)}).call(BR)});var Nd=v((qR,UR)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=Fr(),t=Et(),UR.exports=e=(function(s){n(o,s);function o(a,u,c,l,h,d){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(c==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(u));if(!l)throw new Error("Missing DTD attribute type. "+this.debugInfo(u));if(!h)throw new Error("Missing DTD attribute default. "+this.debugInfo(u));if(h.indexOf("#")!==0&&(h="#"+h),!h.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(u));if(d&&!h.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(u));this.elementName=this.stringify.name(u),this.type=t.AttributeDeclaration,this.attributeName=this.stringify.name(c),this.attributeType=this.stringify.dtdAttType(l),d&&(this.defaultValue=this.stringify.dtdAttDefault(d)),this.defaultValueType=h}return o.prototype.toString=function(a){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(a))},o})(r)}).call(qR)});var $d=v((HR,VR)=>{(function(){var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;n=In().isObject,r=Fr(),t=Et(),VR.exports=e=(function(o){i(a,o);function a(u,c,l,h){if(a.__super__.constructor.call(this,u),l==null)throw new Error("Missing DTD entity name. "+this.debugInfo(l));if(h==null)throw new Error("Missing DTD entity value. "+this.debugInfo(l));if(this.pe=!!c,this.name=this.stringify.name(l),this.type=t.EntityDeclaration,!n(h))this.value=this.stringify.dtdEntityValue(h),this.internal=!0;else{if(!h.pubID&&!h.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(l));if(h.pubID&&!h.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(l));if(this.internal=!1,h.pubID!=null&&(this.pubID=this.stringify.dtdPubID(h.pubID)),h.sysID!=null&&(this.sysID=this.stringify.dtdSysID(h.sysID)),h.nData!=null&&(this.nData=this.stringify.dtdNData(h.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(l))}}return Object.defineProperty(a.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(a.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(a.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(a.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(a.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(a.prototype,"xmlVersion",{get:function(){return null}}),a.prototype.toString=function(u){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(u))},a})(r)}).call(HR)});var Ld=v((zR,GR)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=Fr(),t=Et(),GR.exports=e=(function(s){n(o,s);function o(a,u,c){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing DTD element name. "+this.debugInfo());c||(c="(#PCDATA)"),Array.isArray(c)&&(c="("+c.join(",")+")"),this.name=this.stringify.name(u),this.type=t.ElementDeclaration,this.value=this.stringify.dtdElementValue(c)}return o.prototype.toString=function(a){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(a))},o})(r)}).call(zR)});var jd=v((KR,WR)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=Fr(),t=Et(),WR.exports=e=(function(s){n(o,s);function o(a,u,c){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing DTD notation name. "+this.debugInfo(u));if(!c.pubID&&!c.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(u));this.name=this.stringify.name(u),this.type=t.NotationDeclaration,c.pubID!=null&&(this.pubID=this.stringify.dtdPubID(c.pubID)),c.sysID!=null&&(this.sysID=this.stringify.dtdSysID(c.sysID))}return Object.defineProperty(o.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(o.prototype,"systemId",{get:function(){return this.sysID}}),o.prototype.toString=function(a){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(a))},o})(r)}).call(KR)});var Bd=v((XR,YR)=>{(function(){var t,e,r,n,i,s,o,a,u,c=function(h,d){for(var f in d)l.call(d,f)&&(h[f]=d[f]);function m(){this.constructor=h}return m.prototype=d.prototype,h.prototype=new m,h.__super__=d.prototype,h},l={}.hasOwnProperty;u=In().isObject,a=Fr(),t=Et(),e=Nd(),n=$d(),r=Ld(),i=jd(),o=Fd(),YR.exports=s=(function(h){c(d,h);function d(f,m,g){var b,S,A,p,y,w;if(d.__super__.constructor.call(this,f),this.type=t.DocType,f.children){for(p=f.children,S=0,A=p.length;S<A;S++)if(b=p[S],b.type===t.Element){this.name=b.name;break}}this.documentObject=f,u(m)&&(y=m,m=y.pubID,g=y.sysID),g==null&&(w=[m,g],g=w[0],m=w[1]),m!=null&&(this.pubID=this.stringify.dtdPubID(m)),g!=null&&(this.sysID=this.stringify.dtdSysID(g))}return Object.defineProperty(d.prototype,"entities",{get:function(){var f,m,g,b,S;for(b={},S=this.children,m=0,g=S.length;m<g;m++)f=S[m],f.type===t.EntityDeclaration&&!f.pe&&(b[f.name]=f);return new o(b)}}),Object.defineProperty(d.prototype,"notations",{get:function(){var f,m,g,b,S;for(b={},S=this.children,m=0,g=S.length;m<g;m++)f=S[m],f.type===t.NotationDeclaration&&(b[f.name]=f);return new o(b)}}),Object.defineProperty(d.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(d.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(d.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),d.prototype.element=function(f,m){var g;return g=new r(this,f,m),this.children.push(g),this},d.prototype.attList=function(f,m,g,b,S){var A;return A=new e(this,f,m,g,b,S),this.children.push(A),this},d.prototype.entity=function(f,m){var g;return g=new n(this,!1,f,m),this.children.push(g),this},d.prototype.pEntity=function(f,m){var g;return g=new n(this,!0,f,m),this.children.push(g),this},d.prototype.notation=function(f,m){var g;return g=new i(this,f,m),this.children.push(g),this},d.prototype.toString=function(f){return this.options.writer.docType(this,this.options.writer.filterOptions(f))},d.prototype.ele=function(f,m){return this.element(f,m)},d.prototype.att=function(f,m,g,b,S){return this.attList(f,m,g,b,S)},d.prototype.ent=function(f,m){return this.entity(f,m)},d.prototype.pent=function(f,m){return this.pEntity(f,m)},d.prototype.not=function(f,m){return this.notation(f,m)},d.prototype.up=function(){return this.root()||this.documentObject},d.prototype.isEqualNode=function(f){return!(!d.__super__.isEqualNode.apply(this,arguments).isEqualNode(f)||f.name!==this.name||f.publicId!==this.publicId||f.systemId!==this.systemId)},d})(a)}).call(XR)});var Md=v((JR,ZR)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=Et(),e=Fr(),ZR.exports=r=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=t.Raw,this.value=this.stringify.raw(u)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.raw(this,this.options.writer.filterOptions(a))},o})(e)}).call(JR)});var qd=v((QR,eN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=Et(),e=Tc(),eN.exports=r=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=t.Text,this.value=this.stringify.text(u)}return Object.defineProperty(o.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(o.prototype,"wholeText",{get:function(){var a,u,c;for(c="",u=this.previousSibling;u;)c=u.data+c,u=u.previousSibling;for(c+=this.data,a=this.nextSibling;a;)c=c+a.data,a=a.nextSibling;return c}}),o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.text(this,this.options.writer.filterOptions(a))},o.prototype.splitText=function(a){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.replaceWholeText=function(a){throw new Error("This DOM method is not implemented."+this.debugInfo())},o})(e)}).call(QR)});var Ud=v((tN,rN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=Et(),e=Tc(),rN.exports=r=(function(s){n(o,s);function o(a,u,c){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=t.ProcessingInstruction,this.target=this.stringify.insTarget(u),this.name=this.target,c&&(this.value=this.stringify.insValue(c))}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(a))},o.prototype.isEqualNode=function(a){return!(!o.__super__.isEqualNode.apply(this,arguments).isEqualNode(a)||a.target!==this.target)},o})(e)}).call(tN)});var ub=v((nN,iN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=Fr(),t=Et(),iN.exports=e=(function(s){n(o,s);function o(a){o.__super__.constructor.call(this,a),this.type=t.Dummy}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return""},o})(r)}).call(nN)});var aN=v((sN,oN)=>{(function(){var t;oN.exports=t=(function(){function e(r){this.nodes=r}return Object.defineProperty(e.prototype,"length",{get:function(){return this.nodes.length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.item=function(r){return this.nodes[r]||null},e})()}).call(sN)});var lN=v((uN,cN)=>{(function(){cN.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(uN)});var Fr=v((fN,hN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,g,b,S,A,p={}.hasOwnProperty;A=In(),S=A.isObject,b=A.isFunction,g=A.isEmpty,m=A.getValue,a=null,r=null,n=null,i=null,s=null,d=null,f=null,h=null,o=null,e=null,l=null,u=null,t=null,hN.exports=c=(function(){function y(w){this.parent=w,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,a||(a=Id(),r=Pd(),n=kd(),i=Rd(),s=Bd(),d=Md(),f=qd(),h=Ud(),o=ub(),e=Et(),l=aN(),u=Fd(),t=lN())}return Object.defineProperty(y.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(y.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(y.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(y.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(y.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new l(this.children)),this.childNodeList}}),Object.defineProperty(y.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(y.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(y.prototype,"previousSibling",{get:function(){var w;return w=this.parent.children.indexOf(this),this.parent.children[w-1]||null}}),Object.defineProperty(y.prototype,"nextSibling",{get:function(){var w;return w=this.parent.children.indexOf(this),this.parent.children[w+1]||null}}),Object.defineProperty(y.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(y.prototype,"textContent",{get:function(){var w,_,P,E,R;if(this.nodeType===e.Element||this.nodeType===e.DocumentFragment){for(R="",E=this.children,_=0,P=E.length;_<P;_++)w=E[_],w.textContent&&(R+=w.textContent);return R}else return null},set:function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),y.prototype.setParent=function(w){var _,P,E,R,k;for(this.parent=w,w&&(this.options=w.options,this.stringify=w.stringify),R=this.children,k=[],P=0,E=R.length;P<E;P++)_=R[P],k.push(_.setParent(this));return k},y.prototype.element=function(w,_,P){var E,R,k,F,j,U,G,L,C,T,I;if(U=null,_===null&&P==null&&(C=[{},null],_=C[0],P=C[1]),_==null&&(_={}),_=m(_),S(_)||(T=[_,P],P=T[0],_=T[1]),w!=null&&(w=m(w)),Array.isArray(w))for(k=0,G=w.length;k<G;k++)R=w[k],U=this.element(R);else if(b(w))U=this.element(w.apply());else if(S(w)){for(j in w)if(p.call(w,j))if(I=w[j],b(I)&&(I=I.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&j.indexOf(this.stringify.convertAttKey)===0)U=this.attribute(j.substr(this.stringify.convertAttKey.length),I);else if(!this.options.separateArrayItems&&Array.isArray(I)&&g(I))U=this.dummy();else if(S(I)&&g(I))U=this.element(j);else if(!this.options.keepNullNodes&&I==null)U=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(I))for(F=0,L=I.length;F<L;F++)R=I[F],E={},E[j]=R,U=this.element(E);else S(I)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&j.indexOf(this.stringify.convertTextKey)===0?U=this.element(I):(U=this.element(j),U.element(I)):U=this.element(j,I)}else!this.options.keepNullNodes&&P===null?U=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&w.indexOf(this.stringify.convertTextKey)===0?U=this.text(P):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&w.indexOf(this.stringify.convertCDataKey)===0?U=this.cdata(P):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&w.indexOf(this.stringify.convertCommentKey)===0?U=this.comment(P):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&w.indexOf(this.stringify.convertRawKey)===0?U=this.raw(P):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&w.indexOf(this.stringify.convertPIKey)===0?U=this.instruction(w.substr(this.stringify.convertPIKey.length),P):U=this.node(w,_,P);if(U==null)throw new Error("Could not create any elements with: "+w+". "+this.debugInfo());return U},y.prototype.insertBefore=function(w,_,P){var E,R,k,F,j;if(w?.type)return k=w,F=_,k.setParent(this),F?(R=children.indexOf(F),j=children.splice(R),children.push(k),Array.prototype.push.apply(children,j)):children.push(k),k;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(w));return R=this.parent.children.indexOf(this),j=this.parent.children.splice(R),E=this.parent.element(w,_,P),Array.prototype.push.apply(this.parent.children,j),E},y.prototype.insertAfter=function(w,_,P){var E,R,k;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(w));return R=this.parent.children.indexOf(this),k=this.parent.children.splice(R+1),E=this.parent.element(w,_,P),Array.prototype.push.apply(this.parent.children,k),E},y.prototype.remove=function(){var w,_;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return w=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[w,w-w+1].concat(_=[])),this.parent},y.prototype.node=function(w,_,P){var E,R;return w!=null&&(w=m(w)),_||(_={}),_=m(_),S(_)||(R=[_,P],P=R[0],_=R[1]),E=new a(this,w,_),P!=null&&E.text(P),this.children.push(E),E},y.prototype.text=function(w){var _;return S(w)&&this.element(w),_=new f(this,w),this.children.push(_),this},y.prototype.cdata=function(w){var _;return _=new r(this,w),this.children.push(_),this},y.prototype.comment=function(w){var _;return _=new n(this,w),this.children.push(_),this},y.prototype.commentBefore=function(w){var _,P,E;return P=this.parent.children.indexOf(this),E=this.parent.children.splice(P),_=this.parent.comment(w),Array.prototype.push.apply(this.parent.children,E),this},y.prototype.commentAfter=function(w){var _,P,E;return P=this.parent.children.indexOf(this),E=this.parent.children.splice(P+1),_=this.parent.comment(w),Array.prototype.push.apply(this.parent.children,E),this},y.prototype.raw=function(w){var _;return _=new d(this,w),this.children.push(_),this},y.prototype.dummy=function(){var w;return w=new o(this),w},y.prototype.instruction=function(w,_){var P,E,R,k,F;if(w!=null&&(w=m(w)),_!=null&&(_=m(_)),Array.isArray(w))for(k=0,F=w.length;k<F;k++)P=w[k],this.instruction(P);else if(S(w))for(P in w)p.call(w,P)&&(E=w[P],this.instruction(P,E));else b(_)&&(_=_.apply()),R=new h(this,w,_),this.children.push(R);return this},y.prototype.instructionBefore=function(w,_){var P,E,R;return E=this.parent.children.indexOf(this),R=this.parent.children.splice(E),P=this.parent.instruction(w,_),Array.prototype.push.apply(this.parent.children,R),this},y.prototype.instructionAfter=function(w,_){var P,E,R;return E=this.parent.children.indexOf(this),R=this.parent.children.splice(E+1),P=this.parent.instruction(w,_),Array.prototype.push.apply(this.parent.children,R),this},y.prototype.declaration=function(w,_,P){var E,R;return E=this.document(),R=new i(E,w,_,P),E.children.length===0?E.children.unshift(R):E.children[0].type===e.Declaration?E.children[0]=R:E.children.unshift(R),E.root()||E},y.prototype.dtd=function(w,_){var P,E,R,k,F,j,U,G,L,C;for(E=this.document(),R=new s(E,w,_),L=E.children,k=F=0,U=L.length;F<U;k=++F)if(P=L[k],P.type===e.DocType)return E.children[k]=R,R;for(C=E.children,k=j=0,G=C.length;j<G;k=++j)if(P=C[k],P.isRoot)return E.children.splice(k,0,R),R;return E.children.push(R),R},y.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},y.prototype.root=function(){var w;for(w=this;w;){if(w.type===e.Document)return w.rootObject;if(w.isRoot)return w;w=w.parent}},y.prototype.document=function(){var w;for(w=this;w;){if(w.type===e.Document)return w;w=w.parent}},y.prototype.end=function(w){return this.document().end(w)},y.prototype.prev=function(){var w;if(w=this.parent.children.indexOf(this),w<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[w-1]},y.prototype.next=function(){var w;if(w=this.parent.children.indexOf(this),w===-1||w===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[w+1]},y.prototype.importDocument=function(w){var _;return _=w.root().clone(),_.parent=this,_.isRoot=!1,this.children.push(_),this},y.prototype.debugInfo=function(w){var _,P;return w=w||this.name,w==null&&!((_=this.parent)!=null&&_.name)?"":w==null?"parent: <"+this.parent.name+">":(P=this.parent)!=null&&P.name?"node: <"+w+">, parent: <"+this.parent.name+">":"node: <"+w+">"},y.prototype.ele=function(w,_,P){return this.element(w,_,P)},y.prototype.nod=function(w,_,P){return this.node(w,_,P)},y.prototype.txt=function(w){return this.text(w)},y.prototype.dat=function(w){return this.cdata(w)},y.prototype.com=function(w){return this.comment(w)},y.prototype.ins=function(w,_){return this.instruction(w,_)},y.prototype.doc=function(){return this.document()},y.prototype.dec=function(w,_,P){return this.declaration(w,_,P)},y.prototype.e=function(w,_,P){return this.element(w,_,P)},y.prototype.n=function(w,_,P){return this.node(w,_,P)},y.prototype.t=function(w){return this.text(w)},y.prototype.d=function(w){return this.cdata(w)},y.prototype.c=function(w){return this.comment(w)},y.prototype.r=function(w){return this.raw(w)},y.prototype.i=function(w,_){return this.instruction(w,_)},y.prototype.u=function(){return this.up()},y.prototype.importXMLBuilder=function(w){return this.importDocument(w)},y.prototype.replaceChild=function(w,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.removeChild=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.appendChild=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.hasChildNodes=function(){return this.children.length!==0},y.prototype.cloneNode=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.isSupported=function(w,_){return!0},y.prototype.hasAttributes=function(){return this.attribs.length!==0},y.prototype.compareDocumentPosition=function(w){var _,P;return _=this,_===w?0:this.document()!==w.document()?(P=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?P|=t.Preceding:P|=t.Following,P):_.isAncestor(w)?t.Contains|t.Preceding:_.isDescendant(w)?t.Contains|t.Following:_.isPreceding(w)?t.Preceding:t.Following},y.prototype.isSameNode=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.lookupPrefix=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.isDefaultNamespace=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.lookupNamespaceURI=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.isEqualNode=function(w){var _,P,E;if(w.nodeType!==this.nodeType||w.children.length!==this.children.length)return!1;for(_=P=0,E=this.children.length-1;0<=E?P<=E:P>=E;_=0<=E?++P:--P)if(!this.children[_].isEqualNode(w.children[_]))return!1;return!0},y.prototype.getFeature=function(w,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.setUserData=function(w,_,P){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.getUserData=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.contains=function(w){return w?w===this||this.isDescendant(w):!1},y.prototype.isDescendant=function(w){var _,P,E,R,k;for(k=this.children,E=0,R=k.length;E<R;E++)if(_=k[E],w===_||(P=_.isDescendant(w),P))return!0;return!1},y.prototype.isAncestor=function(w){return w.isDescendant(this)},y.prototype.isPreceding=function(w){var _,P;return _=this.treePosition(w),P=this.treePosition(this),_===-1||P===-1?!1:_<P},y.prototype.isFollowing=function(w){var _,P;return _=this.treePosition(w),P=this.treePosition(this),_===-1||P===-1?!1:_>P},y.prototype.treePosition=function(w){var _,P;return P=0,_=!1,this.foreachTreeNode(this.document(),function(E){if(P++,!_&&E===w)return _=!0}),_?P:-1},y.prototype.foreachTreeNode=function(w,_){var P,E,R,k,F;for(w||(w=this.document()),k=w.children,E=0,R=k.length;E<R;E++){if(P=k[E],F=_(P))return F;if(F=this.foreachTreeNode(P,_),F)return F}},y})()}).call(fN)});var cb=v((dN,pN)=>{(function(){var t,e=function(n,i){return function(){return n.apply(i,arguments)}},r={}.hasOwnProperty;pN.exports=t=(function(){function n(i){this.assertLegalName=e(this.assertLegalName,this),this.assertLegalChar=e(this.assertLegalChar,this);var s,o,a;i||(i={}),this.options=i,this.options.version||(this.options.version="1.0"),o=i.stringify||{};for(s in o)r.call(o,s)&&(a=o[s],this[s]=a)}return n.prototype.name=function(i){return this.options.noValidation?i:this.assertLegalName(""+i||"")},n.prototype.text=function(i){return this.options.noValidation?i:this.assertLegalChar(this.textEscape(""+i||""))},n.prototype.cdata=function(i){return this.options.noValidation?i:(i=""+i||"",i=i.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(i))},n.prototype.comment=function(i){if(this.options.noValidation)return i;if(i=""+i||"",i.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+i);return this.assertLegalChar(i)},n.prototype.raw=function(i){return this.options.noValidation?i:""+i||""},n.prototype.attValue=function(i){return this.options.noValidation?i:this.assertLegalChar(this.attEscape(i=""+i||""))},n.prototype.insTarget=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.insValue=function(i){if(this.options.noValidation)return i;if(i=""+i||"",i.match(/\?>/))throw new Error("Invalid processing instruction value: "+i);return this.assertLegalChar(i)},n.prototype.xmlVersion=function(i){if(this.options.noValidation)return i;if(i=""+i||"",!i.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+i);return i},n.prototype.xmlEncoding=function(i){if(this.options.noValidation)return i;if(i=""+i||"",!i.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+i);return this.assertLegalChar(i)},n.prototype.xmlStandalone=function(i){return this.options.noValidation?i:i?"yes":"no"},n.prototype.dtdPubID=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdSysID=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdElementValue=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdAttType=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdAttDefault=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdEntityValue=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdNData=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.convertAttKey="@",n.prototype.convertPIKey="?",n.prototype.convertTextKey="#text",n.prototype.convertCDataKey="#cdata",n.prototype.convertCommentKey="#comment",n.prototype.convertRawKey="#raw",n.prototype.assertLegalChar=function(i){var s,o;if(this.options.noValidation)return i;if(s="",this.options.version==="1.0"){if(s=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=i.match(s))throw new Error("Invalid character in string: "+i+" at index "+o.index)}else if(this.options.version==="1.1"&&(s=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=i.match(s)))throw new Error("Invalid character in string: "+i+" at index "+o.index);return i},n.prototype.assertLegalName=function(i){var s;if(this.options.noValidation)return i;if(this.assertLegalChar(i),s=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!i.match(s))throw new Error("Invalid character in name");return i},n.prototype.textEscape=function(i){var s;return this.options.noValidation?i:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(s,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
"))},n.prototype.attEscape=function(i){var s;return this.options.noValidation?i:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(s,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
"))},n})()}).call(dN)});var Fc=v((mN,gN)=>{(function(){gN.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(mN)});var lb=v((yN,DN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,g,b,S={}.hasOwnProperty;b=In().assign,t=Et(),u=Rd(),c=Bd(),r=Pd(),n=kd(),h=Id(),f=Md(),m=qd(),d=Ud(),l=ub(),i=Nd(),s=Ld(),o=$d(),a=jd(),e=Fc(),DN.exports=g=(function(){function A(p){var y,w,_;p||(p={}),this.options=p,w=p.writer||{};for(y in w)S.call(w,y)&&(_=w[y],this["_"+y]=this[y],this[y]=_)}return A.prototype.filterOptions=function(p){var y,w,_,P,E,R,k,F;return p||(p={}),p=b({},this.options,p),y={writer:this},y.pretty=p.pretty||!1,y.allowEmpty=p.allowEmpty||!1,y.indent=(w=p.indent)!=null?w:" ",y.newline=(_=p.newline)!=null?_:`
|
|
185
|
-
`,y.offset=(P=p.offset)!=null?P:0,y.dontPrettyTextNodes=(E=(R=p.dontPrettyTextNodes)!=null?R:p.dontprettytextnodes)!=null?E:0,y.spaceBeforeSlash=(k=(F=p.spaceBeforeSlash)!=null?F:p.spacebeforeslash)!=null?k:"",y.spaceBeforeSlash===!0&&(y.spaceBeforeSlash=" "),y.suppressPrettyCount=0,y.user={},y.state=e.None,y},A.prototype.indent=function(p,y,w){var _;return!y.pretty||y.suppressPrettyCount?"":y.pretty&&(_=(w||0)+y.offset+1,_>0)?new Array(_).join(y.indent):""},A.prototype.endline=function(p,y,w){return!y.pretty||y.suppressPrettyCount?"":y.newline},A.prototype.attribute=function(p,y,w){var _;return this.openAttribute(p,y,w),_=" "+p.name+'="'+p.value+'"',this.closeAttribute(p,y,w),_},A.prototype.cdata=function(p,y,w){var _;return this.openNode(p,y,w),y.state=e.OpenTag,_=this.indent(p,y,w)+"<![CDATA[",y.state=e.InsideTag,_+=p.value,y.state=e.CloseTag,_+="]]>"+this.endline(p,y,w),y.state=e.None,this.closeNode(p,y,w),_},A.prototype.comment=function(p,y,w){var _;return this.openNode(p,y,w),y.state=e.OpenTag,_=this.indent(p,y,w)+"<!-- ",y.state=e.InsideTag,_+=p.value,y.state=e.CloseTag,_+=" -->"+this.endline(p,y,w),y.state=e.None,this.closeNode(p,y,w),_},A.prototype.declaration=function(p,y,w){var _;return this.openNode(p,y,w),y.state=e.OpenTag,_=this.indent(p,y,w)+"<?xml",y.state=e.InsideTag,_+=' version="'+p.version+'"',p.encoding!=null&&(_+=' encoding="'+p.encoding+'"'),p.standalone!=null&&(_+=' standalone="'+p.standalone+'"'),y.state=e.CloseTag,_+=y.spaceBeforeSlash+"?>",_+=this.endline(p,y,w),y.state=e.None,this.closeNode(p,y,w),_},A.prototype.docType=function(p,y,w){var _,P,E,R,k;if(w||(w=0),this.openNode(p,y,w),y.state=e.OpenTag,R=this.indent(p,y,w),R+="<!DOCTYPE "+p.root().name,p.pubID&&p.sysID?R+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.sysID&&(R+=' SYSTEM "'+p.sysID+'"'),p.children.length>0){for(R+=" [",R+=this.endline(p,y,w),y.state=e.InsideTag,k=p.children,P=0,E=k.length;P<E;P++)_=k[P],R+=this.writeChildNode(_,y,w+1);y.state=e.CloseTag,R+="]"}return y.state=e.CloseTag,R+=y.spaceBeforeSlash+">",R+=this.endline(p,y,w),y.state=e.None,this.closeNode(p,y,w),R},A.prototype.element=function(p,y,w){var _,P,E,R,k,F,j,U,G,L,C,T,I,$;w||(w=0),L=!1,C="",this.openNode(p,y,w),y.state=e.OpenTag,C+=this.indent(p,y,w)+"<"+p.name,T=p.attribs;for(G in T)S.call(T,G)&&(_=T[G],C+=this.attribute(_,y,w));if(E=p.children.length,R=E===0?null:p.children[0],E===0||p.children.every(function(M){return(M.type===t.Text||M.type===t.Raw)&&M.value===""}))y.allowEmpty?(C+=">",y.state=e.CloseTag,C+="</"+p.name+">"+this.endline(p,y,w)):(y.state=e.CloseTag,C+=y.spaceBeforeSlash+"/>"+this.endline(p,y,w));else if(y.pretty&&E===1&&(R.type===t.Text||R.type===t.Raw)&&R.value!=null)C+=">",y.state=e.InsideTag,y.suppressPrettyCount++,L=!0,C+=this.writeChildNode(R,y,w+1),y.suppressPrettyCount--,L=!1,y.state=e.CloseTag,C+="</"+p.name+">"+this.endline(p,y,w);else{if(y.dontPrettyTextNodes){for(I=p.children,k=0,j=I.length;k<j;k++)if(P=I[k],(P.type===t.Text||P.type===t.Raw)&&P.value!=null){y.suppressPrettyCount++,L=!0;break}}for(C+=">"+this.endline(p,y,w),y.state=e.InsideTag,$=p.children,F=0,U=$.length;F<U;F++)P=$[F],C+=this.writeChildNode(P,y,w+1);y.state=e.CloseTag,C+=this.indent(p,y,w)+"</"+p.name+">",L&&y.suppressPrettyCount--,C+=this.endline(p,y,w),y.state=e.None}return this.closeNode(p,y,w),C},A.prototype.writeChildNode=function(p,y,w){switch(p.type){case t.CData:return this.cdata(p,y,w);case t.Comment:return this.comment(p,y,w);case t.Element:return this.element(p,y,w);case t.Raw:return this.raw(p,y,w);case t.Text:return this.text(p,y,w);case t.ProcessingInstruction:return this.processingInstruction(p,y,w);case t.Dummy:return"";case t.Declaration:return this.declaration(p,y,w);case t.DocType:return this.docType(p,y,w);case t.AttributeDeclaration:return this.dtdAttList(p,y,w);case t.ElementDeclaration:return this.dtdElement(p,y,w);case t.EntityDeclaration:return this.dtdEntity(p,y,w);case t.NotationDeclaration:return this.dtdNotation(p,y,w);default:throw new Error("Unknown XML node type: "+p.constructor.name)}},A.prototype.processingInstruction=function(p,y,w){var _;return this.openNode(p,y,w),y.state=e.OpenTag,_=this.indent(p,y,w)+"<?",y.state=e.InsideTag,_+=p.target,p.value&&(_+=" "+p.value),y.state=e.CloseTag,_+=y.spaceBeforeSlash+"?>",_+=this.endline(p,y,w),y.state=e.None,this.closeNode(p,y,w),_},A.prototype.raw=function(p,y,w){var _;return this.openNode(p,y,w),y.state=e.OpenTag,_=this.indent(p,y,w),y.state=e.InsideTag,_+=p.value,y.state=e.CloseTag,_+=this.endline(p,y,w),y.state=e.None,this.closeNode(p,y,w),_},A.prototype.text=function(p,y,w){var _;return this.openNode(p,y,w),y.state=e.OpenTag,_=this.indent(p,y,w),y.state=e.InsideTag,_+=p.value,y.state=e.CloseTag,_+=this.endline(p,y,w),y.state=e.None,this.closeNode(p,y,w),_},A.prototype.dtdAttList=function(p,y,w){var _;return this.openNode(p,y,w),y.state=e.OpenTag,_=this.indent(p,y,w)+"<!ATTLIST",y.state=e.InsideTag,_+=" "+p.elementName+" "+p.attributeName+" "+p.attributeType,p.defaultValueType!=="#DEFAULT"&&(_+=" "+p.defaultValueType),p.defaultValue&&(_+=' "'+p.defaultValue+'"'),y.state=e.CloseTag,_+=y.spaceBeforeSlash+">"+this.endline(p,y,w),y.state=e.None,this.closeNode(p,y,w),_},A.prototype.dtdElement=function(p,y,w){var _;return this.openNode(p,y,w),y.state=e.OpenTag,_=this.indent(p,y,w)+"<!ELEMENT",y.state=e.InsideTag,_+=" "+p.name+" "+p.value,y.state=e.CloseTag,_+=y.spaceBeforeSlash+">"+this.endline(p,y,w),y.state=e.None,this.closeNode(p,y,w),_},A.prototype.dtdEntity=function(p,y,w){var _;return this.openNode(p,y,w),y.state=e.OpenTag,_=this.indent(p,y,w)+"<!ENTITY",y.state=e.InsideTag,p.pe&&(_+=" %"),_+=" "+p.name,p.value?_+=' "'+p.value+'"':(p.pubID&&p.sysID?_+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.sysID&&(_+=' SYSTEM "'+p.sysID+'"'),p.nData&&(_+=" NDATA "+p.nData)),y.state=e.CloseTag,_+=y.spaceBeforeSlash+">"+this.endline(p,y,w),y.state=e.None,this.closeNode(p,y,w),_},A.prototype.dtdNotation=function(p,y,w){var _;return this.openNode(p,y,w),y.state=e.OpenTag,_=this.indent(p,y,w)+"<!NOTATION",y.state=e.InsideTag,_+=" "+p.name,p.pubID&&p.sysID?_+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.pubID?_+=' PUBLIC "'+p.pubID+'"':p.sysID&&(_+=' SYSTEM "'+p.sysID+'"'),y.state=e.CloseTag,_+=y.spaceBeforeSlash+">"+this.endline(p,y,w),y.state=e.None,this.closeNode(p,y,w),_},A.prototype.openNode=function(p,y,w){},A.prototype.closeNode=function(p,y,w){},A.prototype.openAttribute=function(p,y,w){},A.prototype.closeAttribute=function(p,y,w){},A})()}).call(yN)});var Hd=v((wN,bN)=>{(function(){var t,e,r=function(i,s){for(var o in s)n.call(s,o)&&(i[o]=s[o]);function a(){this.constructor=i}return a.prototype=s.prototype,i.prototype=new a,i.__super__=s.prototype,i},n={}.hasOwnProperty;e=lb(),bN.exports=t=(function(i){r(s,i);function s(o){s.__super__.constructor.call(this,o)}return s.prototype.document=function(o,a){var u,c,l,h,d;for(a=this.filterOptions(a),h="",d=o.children,c=0,l=d.length;c<l;c++)u=d[c],h+=this.writeChildNode(u,a,0);return a.pretty&&h.slice(-a.newline.length)===a.newline&&(h=h.slice(0,-a.newline.length)),h},s})(e)}).call(wN)});var fb=v((vN,EN)=>{(function(){var t,e,r,n,i,s,o,a,u=function(l,h){for(var d in h)c.call(h,d)&&(l[d]=h[d]);function f(){this.constructor=l}return f.prototype=h.prototype,l.prototype=new f,l.__super__=h.prototype,l},c={}.hasOwnProperty;a=In().isPlainObject,r=ob(),e=CR(),i=Fr(),t=Et(),o=cb(),s=Hd(),EN.exports=n=(function(l){u(h,l);function h(d){h.__super__.constructor.call(this,null),this.name="#document",this.type=t.Document,this.documentURI=null,this.domConfig=new e,d||(d={}),d.writer||(d.writer=new s),this.options=d,this.stringify=new o(d)}return Object.defineProperty(h.prototype,"implementation",{value:new r}),Object.defineProperty(h.prototype,"doctype",{get:function(){var d,f,m,g;for(g=this.children,f=0,m=g.length;f<m;f++)if(d=g[f],d.type===t.DocType)return d;return null}}),Object.defineProperty(h.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(h.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(h.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(h.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].encoding:null}}),Object.defineProperty(h.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(h.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(h.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(h.prototype,"origin",{get:function(){return null}}),Object.defineProperty(h.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(h.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(h.prototype,"contentType",{get:function(){return null}}),h.prototype.end=function(d){var f;return f={},d?a(d)&&(f=d,d=this.options.writer):d=this.options.writer,d.document(this,d.filterOptions(f))},h.prototype.toString=function(d){return this.options.writer.document(this,this.options.writer.filterOptions(d))},h.prototype.createElement=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createTextNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createComment=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createCDATASection=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createProcessingInstruction=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createAttribute=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createEntityReference=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByTagName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.importNode=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createElementNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createAttributeNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByTagNameNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementById=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.adoptNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.renameNode=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByClassName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createEvent=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createNodeIterator=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createTreeWalker=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h})(i)}).call(vN)});var SN=v((_N,CN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,g,b,S,A,p,y,w,_,P,E={}.hasOwnProperty;P=In(),w=P.isObject,y=P.isFunction,_=P.isPlainObject,p=P.getValue,t=Et(),h=fb(),f=Id(),n=Pd(),i=kd(),g=Md(),A=qd(),m=Ud(),c=Rd(),l=Bd(),s=Nd(),a=$d(),o=Ld(),u=jd(),r=ab(),S=cb(),b=Hd(),e=Fc(),CN.exports=d=(function(){function R(k,F,j){var U;this.name="?xml",this.type=t.Document,k||(k={}),U={},k.writer?_(k.writer)&&(U=k.writer,k.writer=new b):k.writer=new b,this.options=k,this.writer=k.writer,this.writerOptions=this.writer.filterOptions(U),this.stringify=new S(k),this.onDataCallback=F||function(){},this.onEndCallback=j||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return R.prototype.createChildNode=function(k){var F,j,U,G,L,C,T,I;switch(k.type){case t.CData:this.cdata(k.value);break;case t.Comment:this.comment(k.value);break;case t.Element:U={},T=k.attribs;for(j in T)E.call(T,j)&&(F=T[j],U[j]=F.value);this.node(k.name,U);break;case t.Dummy:this.dummy();break;case t.Raw:this.raw(k.value);break;case t.Text:this.text(k.value);break;case t.ProcessingInstruction:this.instruction(k.target,k.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+k.constructor.name)}for(I=k.children,L=0,C=I.length;L<C;L++)G=I[L],this.createChildNode(G),G.type===t.Element&&this.up();return this},R.prototype.dummy=function(){return this},R.prototype.node=function(k,F,j){var U;if(k==null)throw new Error("Missing node name.");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node. "+this.debugInfo(k));return this.openCurrent(),k=p(k),F==null&&(F={}),F=p(F),w(F)||(U=[F,j],j=U[0],F=U[1]),this.currentNode=new f(this,k,F),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,j!=null&&this.text(j),this},R.prototype.element=function(k,F,j){var U,G,L,C,T,I;if(this.currentNode&&this.currentNode.type===t.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(k)||w(k)||y(k))for(C=this.options.noValidation,this.options.noValidation=!0,I=new h(this.options).element("TEMP_ROOT"),I.element(k),this.options.noValidation=C,T=I.children,G=0,L=T.length;G<L;G++)U=T[G],this.createChildNode(U),U.type===t.Element&&this.up();else this.node(k,F,j);return this},R.prototype.attribute=function(k,F){var j,U;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(k));if(k!=null&&(k=p(k)),w(k))for(j in k)E.call(k,j)&&(U=k[j],this.attribute(j,U));else y(F)&&(F=F.apply()),this.options.keepNullAttributes&&F==null?this.currentNode.attribs[k]=new r(this,k,""):F!=null&&(this.currentNode.attribs[k]=new r(this,k,F));return this},R.prototype.text=function(k){var F;return this.openCurrent(),F=new A(this,k),this.onData(this.writer.text(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.cdata=function(k){var F;return this.openCurrent(),F=new n(this,k),this.onData(this.writer.cdata(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.comment=function(k){var F;return this.openCurrent(),F=new i(this,k),this.onData(this.writer.comment(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.raw=function(k){var F;return this.openCurrent(),F=new g(this,k),this.onData(this.writer.raw(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.instruction=function(k,F){var j,U,G,L,C;if(this.openCurrent(),k!=null&&(k=p(k)),F!=null&&(F=p(F)),Array.isArray(k))for(j=0,L=k.length;j<L;j++)U=k[j],this.instruction(U);else if(w(k))for(U in k)E.call(k,U)&&(G=k[U],this.instruction(U,G));else y(F)&&(F=F.apply()),C=new m(this,k,F),this.onData(this.writer.processingInstruction(C,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},R.prototype.declaration=function(k,F,j){var U;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return U=new c(this,k,F,j),this.onData(this.writer.declaration(U,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.doctype=function(k,F,j){if(this.openCurrent(),k==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new l(this,F,j),this.currentNode.rootNodeName=k,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},R.prototype.dtdElement=function(k,F){var j;return this.openCurrent(),j=new o(this,k,F),this.onData(this.writer.dtdElement(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.attList=function(k,F,j,U,G){var L;return this.openCurrent(),L=new s(this,k,F,j,U,G),this.onData(this.writer.dtdAttList(L,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.entity=function(k,F){var j;return this.openCurrent(),j=new a(this,!1,k,F),this.onData(this.writer.dtdEntity(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.pEntity=function(k,F){var j;return this.openCurrent(),j=new a(this,!0,k,F),this.onData(this.writer.dtdEntity(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.notation=function(k,F){var j;return this.openCurrent(),j=new u(this,k,F),this.onData(this.writer.dtdNotation(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},R.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},R.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},R.prototype.openNode=function(k){var F,j,U,G;if(!k.isOpen){if(!this.root&&this.currentLevel===0&&k.type===t.Element&&(this.root=k),j="",k.type===t.Element){this.writerOptions.state=e.OpenTag,j=this.writer.indent(k,this.writerOptions,this.currentLevel)+"<"+k.name,G=k.attribs;for(U in G)E.call(G,U)&&(F=G[U],j+=this.writer.attribute(F,this.writerOptions,this.currentLevel));j+=(k.children?">":"/>")+this.writer.endline(k,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,j=this.writer.indent(k,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+k.rootNodeName,k.pubID&&k.sysID?j+=' PUBLIC "'+k.pubID+'" "'+k.sysID+'"':k.sysID&&(j+=' SYSTEM "'+k.sysID+'"'),k.children?(j+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,j+=">"),j+=this.writer.endline(k,this.writerOptions,this.currentLevel);return this.onData(j,this.currentLevel),k.isOpen=!0}},R.prototype.closeNode=function(k){var F;if(!k.isClosed)return F="",this.writerOptions.state=e.CloseTag,k.type===t.Element?F=this.writer.indent(k,this.writerOptions,this.currentLevel)+"</"+k.name+">"+this.writer.endline(k,this.writerOptions,this.currentLevel):F=this.writer.indent(k,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(k,this.writerOptions,this.currentLevel),this.writerOptions.state=e.None,this.onData(F,this.currentLevel),k.isClosed=!0},R.prototype.onData=function(k,F){return this.documentStarted=!0,this.onDataCallback(k,F+1)},R.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},R.prototype.debugInfo=function(k){return k==null?"":"node: <"+k+">"},R.prototype.ele=function(){return this.element.apply(this,arguments)},R.prototype.nod=function(k,F,j){return this.node(k,F,j)},R.prototype.txt=function(k){return this.text(k)},R.prototype.dat=function(k){return this.cdata(k)},R.prototype.com=function(k){return this.comment(k)},R.prototype.ins=function(k,F){return this.instruction(k,F)},R.prototype.dec=function(k,F,j){return this.declaration(k,F,j)},R.prototype.dtd=function(k,F,j){return this.doctype(k,F,j)},R.prototype.e=function(k,F,j){return this.element(k,F,j)},R.prototype.n=function(k,F,j){return this.node(k,F,j)},R.prototype.t=function(k){return this.text(k)},R.prototype.d=function(k){return this.cdata(k)},R.prototype.c=function(k){return this.comment(k)},R.prototype.r=function(k){return this.raw(k)},R.prototype.i=function(k,F){return this.instruction(k,F)},R.prototype.att=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},R.prototype.a=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},R.prototype.ent=function(k,F){return this.entity(k,F)},R.prototype.pent=function(k,F){return this.pEntity(k,F)},R.prototype.not=function(k,F){return this.notation(k,F)},R})()}).call(_N)});var xN=v((AN,ON)=>{(function(){var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;t=Et(),n=lb(),e=Fc(),ON.exports=r=(function(o){i(a,o);function a(u,c){this.stream=u,a.__super__.constructor.call(this,c)}return a.prototype.endline=function(u,c,l){return u.isLastRootNode&&c.state===e.CloseTag?"":a.__super__.endline.call(this,u,c,l)},a.prototype.document=function(u,c){var l,h,d,f,m,g,b,S,A;for(b=u.children,h=d=0,m=b.length;d<m;h=++d)l=b[h],l.isLastRootNode=h===u.children.length-1;for(c=this.filterOptions(c),S=u.children,A=[],f=0,g=S.length;f<g;f++)l=S[f],A.push(this.writeChildNode(l,c,0));return A},a.prototype.attribute=function(u,c,l){return this.stream.write(a.__super__.attribute.call(this,u,c,l))},a.prototype.cdata=function(u,c,l){return this.stream.write(a.__super__.cdata.call(this,u,c,l))},a.prototype.comment=function(u,c,l){return this.stream.write(a.__super__.comment.call(this,u,c,l))},a.prototype.declaration=function(u,c,l){return this.stream.write(a.__super__.declaration.call(this,u,c,l))},a.prototype.docType=function(u,c,l){var h,d,f,m;if(l||(l=0),this.openNode(u,c,l),c.state=e.OpenTag,this.stream.write(this.indent(u,c,l)),this.stream.write("<!DOCTYPE "+u.root().name),u.pubID&&u.sysID?this.stream.write(' PUBLIC "'+u.pubID+'" "'+u.sysID+'"'):u.sysID&&this.stream.write(' SYSTEM "'+u.sysID+'"'),u.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(u,c,l)),c.state=e.InsideTag,m=u.children,d=0,f=m.length;d<f;d++)h=m[d],this.writeChildNode(h,c,l+1);c.state=e.CloseTag,this.stream.write("]")}return c.state=e.CloseTag,this.stream.write(c.spaceBeforeSlash+">"),this.stream.write(this.endline(u,c,l)),c.state=e.None,this.closeNode(u,c,l)},a.prototype.element=function(u,c,l){var h,d,f,m,g,b,S,A,p,y;l||(l=0),this.openNode(u,c,l),c.state=e.OpenTag,this.stream.write(this.indent(u,c,l)+"<"+u.name),p=u.attribs;for(S in p)s.call(p,S)&&(h=p[S],this.attribute(h,c,l));if(f=u.children.length,m=f===0?null:u.children[0],f===0||u.children.every(function(w){return(w.type===t.Text||w.type===t.Raw)&&w.value===""}))c.allowEmpty?(this.stream.write(">"),c.state=e.CloseTag,this.stream.write("</"+u.name+">")):(c.state=e.CloseTag,this.stream.write(c.spaceBeforeSlash+"/>"));else if(c.pretty&&f===1&&(m.type===t.Text||m.type===t.Raw)&&m.value!=null)this.stream.write(">"),c.state=e.InsideTag,c.suppressPrettyCount++,A=!0,this.writeChildNode(m,c,l+1),c.suppressPrettyCount--,A=!1,c.state=e.CloseTag,this.stream.write("</"+u.name+">");else{for(this.stream.write(">"+this.endline(u,c,l)),c.state=e.InsideTag,y=u.children,g=0,b=y.length;g<b;g++)d=y[g],this.writeChildNode(d,c,l+1);c.state=e.CloseTag,this.stream.write(this.indent(u,c,l)+"</"+u.name+">")}return this.stream.write(this.endline(u,c,l)),c.state=e.None,this.closeNode(u,c,l)},a.prototype.processingInstruction=function(u,c,l){return this.stream.write(a.__super__.processingInstruction.call(this,u,c,l))},a.prototype.raw=function(u,c,l){return this.stream.write(a.__super__.raw.call(this,u,c,l))},a.prototype.text=function(u,c,l){return this.stream.write(a.__super__.text.call(this,u,c,l))},a.prototype.dtdAttList=function(u,c,l){return this.stream.write(a.__super__.dtdAttList.call(this,u,c,l))},a.prototype.dtdElement=function(u,c,l){return this.stream.write(a.__super__.dtdElement.call(this,u,c,l))},a.prototype.dtdEntity=function(u,c,l){return this.stream.write(a.__super__.dtdEntity.call(this,u,c,l))},a.prototype.dtdNotation=function(u,c,l){return this.stream.write(a.__super__.dtdNotation.call(this,u,c,l))},a})(n)}).call(AN)});var FN=v((TN,Vi)=>{(function(){var t,e,r,n,i,s,o,a,u,c;c=In(),a=c.assign,u=c.isFunction,r=ob(),n=fb(),i=SN(),o=Hd(),s=xN(),t=Et(),e=Fc(),Vi.exports.create=function(l,h,d,f){var m,g;if(l==null)throw new Error("Root element needs a name.");return f=a({},h,d,f),m=new n(f),g=m.element(l),f.headless||(m.declaration(f),(f.pubID!=null||f.sysID!=null)&&m.dtd(f)),g},Vi.exports.begin=function(l,h,d){var f;return u(l)&&(f=[l,h],h=f[0],d=f[1],l={}),h?new i(l,h,d):new n(l)},Vi.exports.stringWriter=function(l){return new o(l)},Vi.exports.streamWriter=function(l,h){return new s(l,h)},Vi.exports.implementation=new r,Vi.exports.nodeType=t,Vi.exports.writerState=e}).call(TN)});var IN=v(hb=>{(function(){"use strict";var t,e,r,n,i,s={}.hasOwnProperty;t=FN(),e=Td().defaults,n=function(o){return typeof o=="string"&&(o.indexOf("&")>=0||o.indexOf(">")>=0||o.indexOf("<")>=0)},i=function(o){return"<![CDATA["+r(o)+"]]>"},r=function(o){return o.replace("]]>","]]]]><![CDATA[>")},hb.Builder=(function(){function o(a){var u,c,l;this.options={},c=e["0.2"];for(u in c)s.call(c,u)&&(l=c[u],this.options[u]=l);for(u in a)s.call(a,u)&&(l=a[u],this.options[u]=l)}return o.prototype.buildObject=function(a){var u,c,l,h,d;return u=this.options.attrkey,c=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===e["0.2"].rootName?(d=Object.keys(a)[0],a=a[d]):d=this.options.rootName,l=(function(f){return function(m,g){var b,S,A,p,y,w;if(typeof g!="object")f.options.cdata&&n(g)?m.raw(i(g)):m.txt(g);else if(Array.isArray(g)){for(p in g)if(s.call(g,p)){S=g[p];for(y in S)A=S[y],m=l(m.ele(y),A).up()}}else for(y in g)if(s.call(g,y))if(S=g[y],y===u){if(typeof S=="object")for(b in S)w=S[b],m=m.att(b,w)}else if(y===c)f.options.cdata&&n(S)?m=m.raw(i(S)):m=m.txt(S);else if(Array.isArray(S))for(p in S)s.call(S,p)&&(A=S[p],typeof A=="string"?f.options.cdata&&n(A)?m=m.ele(y).raw(i(A)).up():m=m.ele(y,A).up():m=l(m.ele(y),A).up());else typeof S=="object"?m=l(m.ele(y),S).up():typeof S=="string"&&f.options.cdata&&n(S)?m=m.ele(y).raw(i(S)).up():(S==null&&(S=""),m=m.ele(y,S.toString()).up());return m}})(this),h=t.create(d,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),l(h,a).end(this.options.renderOpts)},o})()}).call(hb)});var PN=v(Vd=>{(function(t){t.parser=function(x,O){return new r(x,O)},t.SAXParser=r,t.SAXStream=c,t.createStream=u,t.MAX_BUFFER_LENGTH=64*1024;var e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(x,O){if(!(this instanceof r))return new r(x,O);var H=this;i(H),H.q=H.c="",H.bufferCheckPosition=t.MAX_BUFFER_LENGTH,H.opt=O||{},H.opt.lowercase=H.opt.lowercase||H.opt.lowercasetags,H.looseCase=H.opt.lowercase?"toLowerCase":"toUpperCase",H.tags=[],H.closed=H.closedRoot=H.sawRoot=!1,H.tag=H.error=null,H.strict=!!x,H.noscript=!!(x||H.opt.noscript),H.state=E.BEGIN,H.strictEntities=H.opt.strictEntities,H.ENTITIES=H.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),H.attribList=[],H.opt.xmlns&&(H.ns=Object.create(m)),H.opt.unquotedAttributeValues===void 0&&(H.opt.unquotedAttributeValues=!x),H.trackPosition=H.opt.position!==!1,H.trackPosition&&(H.position=H.line=H.column=0),k(H,"onready")}Object.create||(Object.create=function(x){function O(){}O.prototype=x;var H=new O;return H}),Object.keys||(Object.keys=function(x){var O=[];for(var H in x)x.hasOwnProperty(H)&&O.push(H);return O});function n(x){for(var O=Math.max(t.MAX_BUFFER_LENGTH,10),H=0,N=0,ne=e.length;N<ne;N++){var z=x[e[N]].length;if(z>O)switch(e[N]){case"textNode":j(x);break;case"cdata":F(x,"oncdata",x.cdata),x.cdata="";break;case"script":F(x,"onscript",x.script),x.script="";break;default:G(x,"Max buffer length exceeded: "+e[N])}H=Math.max(H,z)}var ie=t.MAX_BUFFER_LENGTH-H;x.bufferCheckPosition=ie+x.position}function i(x){for(var O=0,H=e.length;O<H;O++)x[e[O]]=""}function s(x){j(x),x.cdata!==""&&(F(x,"oncdata",x.cdata),x.cdata=""),x.script!==""&&(F(x,"onscript",x.script),x.script="")}r.prototype={end:function(){L(this)},write:ae,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){s(this)}};var o;try{o=require("stream").Stream}catch{o=function(){}}o||(o=function(){});var a=t.EVENTS.filter(function(x){return x!=="error"&&x!=="end"});function u(x,O){return new c(x,O)}function c(x,O){if(!(this instanceof c))return new c(x,O);o.apply(this),this._parser=new r(x,O),this.writable=!0,this.readable=!0;var H=this;this._parser.onend=function(){H.emit("end")},this._parser.onerror=function(N){H.emit("error",N),H._parser.error=null},this._decoder=null,a.forEach(function(N){Object.defineProperty(H,"on"+N,{get:function(){return H._parser["on"+N]},set:function(ne){if(!ne)return H.removeAllListeners(N),H._parser["on"+N]=ne,ne;H.on(N,ne)},enumerable:!0,configurable:!1})})}c.prototype=Object.create(o.prototype,{constructor:{value:c}}),c.prototype.write=function(x){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(x)){if(!this._decoder){var O=require("string_decoder").StringDecoder;this._decoder=new O("utf8")}x=this._decoder.write(x)}return this._parser.write(x.toString()),this.emit("data",x),!0},c.prototype.end=function(x){return x&&x.length&&this.write(x),this._parser.end(),!0},c.prototype.on=function(x,O){var H=this;return!H._parser["on"+x]&&a.indexOf(x)!==-1&&(H._parser["on"+x]=function(){var N=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);N.splice(0,0,x),H.emit.apply(H,N)}),o.prototype.on.call(H,x,O)};var l="[CDATA[",h="DOCTYPE",d="http://www.w3.org/XML/1998/namespace",f="http://www.w3.org/2000/xmlns/",m={xml:d,xmlns:f},g=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,b=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,S=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,A=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function p(x){return x===" "||x===`
|
|
186
|
-
`||x==="\r"||x===" "}function
|
|
183
|
+
`),this.close()}_(e,r){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(tR.hide):this.out.write(vre(this.outputText,this.out.columns)),super.render(),this.outputText=[eR.symbol(this.done,this.aborted),Qk.bold(this.msg),eR.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Qk.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Ere.line+tR.to(0)+this.outputText))}};rR.exports=rb});var sR=v((Mwe,iR)=>{"use strict";iR.exports={TextPrompt:rk(),SelectPrompt:ok(),TogglePrompt:lk(),DatePrompt:$k(),NumberPrompt:Mk(),MultiselectPrompt:Jw(),AutocompletePrompt:Wk(),AutocompleteMultiselectPrompt:Zk(),ConfirmPrompt:nR()}});var aR=v(oR=>{"use strict";var Er=oR,_re=sR(),Ad=t=>t;function Fn(t,e,r={}){return new Promise((n,i)=>{let s=new _re[t](e),o=r.onAbort||Ad,a=r.onSubmit||Ad,u=r.onExit||Ad;s.on("state",e.onState||Ad),s.on("submit",c=>n(a(c))),s.on("exit",c=>n(u(c))),s.on("abort",c=>i(o(c)))})}Er.text=t=>Fn("TextPrompt",t);Er.password=t=>(t.style="password",Er.text(t));Er.invisible=t=>(t.style="invisible",Er.text(t));Er.number=t=>Fn("NumberPrompt",t);Er.date=t=>Fn("DatePrompt",t);Er.confirm=t=>Fn("ConfirmPrompt",t);Er.list=t=>{let e=t.separator||",";return Fn("TextPrompt",t,{onSubmit:r=>r.split(e).map(n=>n.trim())})};Er.toggle=t=>Fn("TogglePrompt",t);Er.select=t=>Fn("SelectPrompt",t);Er.multiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return Fn("MultiselectPrompt",t,{onAbort:e,onSubmit:e})};Er.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return Fn("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})};var Cre=(t,e)=>Promise.resolve(e.filter(r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));Er.autocomplete=t=>(t.suggest=t.suggest||Cre,t.choices=[].concat(t.choices||[]),Fn("AutocompletePrompt",t))});var lR=v((Uwe,cR)=>{"use strict";var nb=aR(),Sre=["suggest","format","onState","validate","onRender","type"],uR=()=>{};async function Ui(t=[],{onSubmit:e=uR,onCancel:r=uR}={}){let n={},i=Ui._override||{};t=[].concat(t);let s,o,a,u,c,l,h=async(d,f,m=!1)=>{if(!(!m&&d.validate&&d.validate(f)!==!0))return d.format?await d.format(f,n):f};for(o of t)if({name:u,type:c}=o,typeof c=="function"&&(c=await c(s,{...n},o),o.type=c),!!c){for(let d in o){if(Sre.includes(d))continue;let f=o[d];o[d]=typeof f=="function"?await f(s,{...n},l):f}if(l=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:u,type:c}=o,nb[c]===void 0)throw new Error(`prompt type (${c}) is not defined`);if(i[o.name]!==void 0&&(s=await h(o,i[o.name]),s!==void 0)){n[u]=s;continue}try{s=Ui._injected?Are(Ui._injected,o.initial):await nb[c](o),n[u]=s=await h(o,s,!0),a=await e(o,s,n)}catch{a=!await r(o,n)}if(a)return n}return n}function Are(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function Ore(t){Ui._injected=(Ui._injected||[]).concat(t)}function xre(t){Ui._override=Object.assign({},t)}cR.exports=Object.assign(Ui,{prompt:Ui,prompts:nb,inject:Ore,override:xre})});var Od=v((Hwe,fR)=>{function Tre(t){t=(Array.isArray(t)?t:t.split(".")).map(Number);let e=0,r=process.versions.node.split(".").map(Number);for(;e<t.length;e++){if(r[e]>t[e])return!1;if(t[e]>r[e])return!0}return!1}fR.exports=Tre("8.6.0")?$P():lR()});var yc=v(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.logSuccess=_r.logPrompt=_r.logger=_r.output=void 0;var ib=(fe(),ue(le)),Ks=W0(),Ws=ib.__importDefault(ba()),Fre=LI(),hR={colors:Ws.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};_r.output=(0,Fre.isInteractive)()?new Ks.TTYOutputStrategy(hR):new Ks.StreamOutputStrategy(hR);_r.logger=(0,Ks.createDefaultLogger)({output:_r.output,formatterOptions:{titleize:!1,tags:new Map([[Ks.LOGGER_LEVELS.DEBUG,Ws.default.log.DEBUG("[debug]")],[Ks.LOGGER_LEVELS.INFO,Ws.default.log.INFO("[info]")],[Ks.LOGGER_LEVELS.WARN,Ws.default.log.WARN("[warn]")],[Ks.LOGGER_LEVELS.ERROR,Ws.default.log.ERROR("[error]")]])}});async function Ire(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>ib.__importStar(W0())),{prompt:n}=await Promise.resolve().then(()=>ib.__importStar(Od()));return _r.logger.log({msg:`${Ws.default.input("[?]")} ${r(t,{indentation:4})}`,logger:_r.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}_r.logPrompt=Ire;function Pre(t){_r.logger.msg(`${Ws.default.success("[success]")} ${t}`)}_r.logSuccess=Pre});var xd=v(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});Ia.resolveNode=Ia.requireTS=void 0;var kre=require("fs"),Rre=wa(),Nre=require("path"),$re=(t,e)=>{let r=(0,Nre.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(i,s)=>{var o;let a=(0,Rre.readFileSync)(s,"utf8");s.endsWith(".ts")?a=t.transpileModule(a,{fileName:s,compilerOptions:{module:t.ModuleKind.CommonJS,moduleResolution:t.ModuleResolutionKind.NodeJs,esModuleInterop:!0,strict:!0,target:t.ScriptTarget.ES2017},reportDiagnostics:!0}).outputText:a=a.replace(/export\s+\w+\s+(\w+)/gm,"exports.$1"),(o=i._compile)===null||o===void 0||o.call(i,a,s)};let n=require(r);return delete require.extensions[".ts"],n};Ia.requireTS=$re;function Lre(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,kre.existsSync)(n)?n:null}}Ia.resolveNode=Lre});var Td=v(sb=>{(function(){sb.defaults={"0.1":{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},"0.2":{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:`
|
|
184
|
+
`},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(sb)});var In=v((dR,Hi)=>{(function(){var t,e,r,n,i,s,o,a=[].slice,u={}.hasOwnProperty;t=function(){var c,l,h,d,f,m;if(m=arguments[0],f=2<=arguments.length?a.call(arguments,1):[],i(Object.assign))Object.assign.apply(null,arguments);else for(c=0,h=f.length;c<h;c++)if(d=f[c],d!=null)for(l in d)u.call(d,l)&&(m[l]=d[l]);return m},i=function(c){return!!c&&Object.prototype.toString.call(c)==="[object Function]"},s=function(c){var l;return!!c&&((l=typeof c)=="function"||l==="object")},r=function(c){return i(Array.isArray)?Array.isArray(c):Object.prototype.toString.call(c)==="[object Array]"},n=function(c){var l;if(r(c))return!c.length;for(l in c)if(u.call(c,l))return!1;return!0},o=function(c){var l,h;return s(c)&&(h=Object.getPrototypeOf(c))&&(l=h.constructor)&&typeof l=="function"&&l instanceof l&&Function.prototype.toString.call(l)===Function.prototype.toString.call(Object)},e=function(c){return i(c.valueOf)?c.valueOf():c},Hi.exports.assign=t,Hi.exports.isFunction=i,Hi.exports.isObject=s,Hi.exports.isArray=r,Hi.exports.isEmpty=n,Hi.exports.isPlainObject=o,Hi.exports.getValue=e}).call(dR)});var ob=v((pR,mR)=>{(function(){var t;mR.exports=t=(function(){function e(){}return e.prototype.hasFeature=function(r,n){return!0},e.prototype.createDocumentType=function(r,n,i){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(r,n,i){throw new Error("This DOM method is not implemented.")},e.prototype.createHTMLDocument=function(r){throw new Error("This DOM method is not implemented.")},e.prototype.getFeature=function(r,n){throw new Error("This DOM method is not implemented.")},e})()}).call(pR)});var DR=v((gR,yR)=>{(function(){var t;yR.exports=t=(function(){function e(){}return e.prototype.handleError=function(r){throw new Error(r)},e})()}).call(gR)});var vR=v((wR,bR)=>{(function(){var t;bR.exports=t=(function(){function e(r){this.arr=r||[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.arr.length}}),e.prototype.item=function(r){return this.arr[r]||null},e.prototype.contains=function(r){return this.arr.indexOf(r)!==-1},e})()}).call(wR)});var CR=v((ER,_R)=>{(function(){var t,e,r;e=DR(),r=vR(),_R.exports=t=(function(){function n(){var i;this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new e,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=i=Object.create(this.defaultParams)}return Object.defineProperty(n.prototype,"parameterNames",{get:function(){return new r(Object.keys(this.defaultParams))}}),n.prototype.getParameter=function(i){return this.params.hasOwnProperty(i)?this.params[i]:null},n.prototype.canSetParameter=function(i,s){return!0},n.prototype.setParameter=function(i,s){return s!=null?this.params[i]=s:delete this.params[i]},n})()}).call(ER)});var Et=v((SR,AR)=>{(function(){AR.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}).call(SR)});var ab=v((OR,xR)=>{(function(){var t,e,r;t=Et(),r=Fr(),xR.exports=e=(function(){function n(i,s,o){if(this.parent=i,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),s==null)throw new Error("Missing attribute name. "+this.debugInfo(s));this.name=this.stringify.name(s),this.value=this.stringify.attValue(o),this.type=t.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(n.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(n.prototype,"textContent",{get:function(){return this.value},set:function(i){return this.value=i||""}}),Object.defineProperty(n.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(n.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(n.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(n.prototype,"specified",{get:function(){return!0}}),n.prototype.clone=function(){return Object.create(this)},n.prototype.toString=function(i){return this.options.writer.attribute(this,this.options.writer.filterOptions(i))},n.prototype.debugInfo=function(i){return i=i||this.name,i==null?"parent: <"+this.parent.name+">":"attribute: {"+i+"}, parent: <"+this.parent.name+">"},n.prototype.isEqualNode=function(i){return!(i.namespaceURI!==this.namespaceURI||i.prefix!==this.prefix||i.localName!==this.localName||i.value!==this.value)},n})()}).call(OR)});var Fd=v((TR,FR)=>{(function(){var t;FR.exports=t=(function(){function e(r){this.nodes=r}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.getNamedItem=function(r){return this.nodes[r]},e.prototype.setNamedItem=function(r){var n;return n=this.nodes[r.nodeName],this.nodes[r.nodeName]=r,n||null},e.prototype.removeNamedItem=function(r){var n;return n=this.nodes[r],delete this.nodes[r],n||null},e.prototype.item=function(r){return this.nodes[Object.keys(this.nodes)[r]]||null},e.prototype.getNamedItemNS=function(r,n){throw new Error("This DOM method is not implemented.")},e.prototype.setNamedItemNS=function(r){throw new Error("This DOM method is not implemented.")},e.prototype.removeNamedItemNS=function(r,n){throw new Error("This DOM method is not implemented.")},e})()}).call(TR)});var Id=v((IR,PR)=>{(function(){var t,e,r,n,i,s,o,a,u,c=function(h,d){for(var f in d)l.call(d,f)&&(h[f]=d[f]);function m(){this.constructor=h}return m.prototype=d.prototype,h.prototype=new m,h.__super__=d.prototype,h},l={}.hasOwnProperty;u=In(),a=u.isObject,o=u.isFunction,s=u.getValue,i=Fr(),t=Et(),e=ab(),n=Fd(),PR.exports=r=(function(h){c(d,h);function d(f,m,g){var b,S,A,p;if(d.__super__.constructor.call(this,f),m==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(m),this.type=t.Element,this.attribs={},this.schemaTypeInfo=null,g!=null&&this.attribute(g),f.type===t.Document&&(this.isRoot=!0,this.documentObject=f,f.rootObject=this,f.children)){for(p=f.children,S=0,A=p.length;S<A;S++)if(b=p[S],b.type===t.DocType){b.name=this.name;break}}}return Object.defineProperty(d.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(d.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(d.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(d.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(d.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new n(this.attribs)),this.attributeMap}}),d.prototype.clone=function(){var f,m,g,b;g=Object.create(this),g.isRoot&&(g.documentObject=null),g.attribs={},b=this.attribs;for(m in b)l.call(b,m)&&(f=b[m],g.attribs[m]=f.clone());return g.children=[],this.children.forEach(function(S){var A;return A=S.clone(),A.parent=g,g.children.push(A)}),g},d.prototype.attribute=function(f,m){var g,b;if(f!=null&&(f=s(f)),a(f))for(g in f)l.call(f,g)&&(b=f[g],this.attribute(g,b));else o(m)&&(m=m.apply()),this.options.keepNullAttributes&&m==null?this.attribs[f]=new e(this,f,""):m!=null&&(this.attribs[f]=new e(this,f,m));return this},d.prototype.removeAttribute=function(f){var m,g,b;if(f==null)throw new Error("Missing attribute name. "+this.debugInfo());if(f=s(f),Array.isArray(f))for(g=0,b=f.length;g<b;g++)m=f[g],delete this.attribs[m];else delete this.attribs[f];return this},d.prototype.toString=function(f){return this.options.writer.element(this,this.options.writer.filterOptions(f))},d.prototype.att=function(f,m){return this.attribute(f,m)},d.prototype.a=function(f,m){return this.attribute(f,m)},d.prototype.getAttribute=function(f){return this.attribs.hasOwnProperty(f)?this.attribs[f].value:null},d.prototype.setAttribute=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNode=function(f){return this.attribs.hasOwnProperty(f)?this.attribs[f]:null},d.prototype.setAttributeNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.removeAttributeNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setAttributeNS=function(f,m,g){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.removeAttributeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNodeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setAttributeNodeNS=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagNameNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.hasAttribute=function(f){return this.attribs.hasOwnProperty(f)},d.prototype.hasAttributeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setIdAttribute=function(f,m){return this.attribs.hasOwnProperty(f)?this.attribs[f].isId:m},d.prototype.setIdAttributeNS=function(f,m,g){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setIdAttributeNode=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagNameNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByClassName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.isEqualNode=function(f){var m,g,b;if(!d.__super__.isEqualNode.apply(this,arguments).isEqualNode(f)||f.namespaceURI!==this.namespaceURI||f.prefix!==this.prefix||f.localName!==this.localName||f.attribs.length!==this.attribs.length)return!1;for(m=g=0,b=this.attribs.length-1;0<=b?g<=b:g>=b;m=0<=b?++g:--g)if(!this.attribs[m].isEqualNode(f.attribs[m]))return!1;return!0},d})(i)}).call(IR)});var Tc=v((kR,RR)=>{(function(){var t,e,r=function(i,s){for(var o in s)n.call(s,o)&&(i[o]=s[o]);function a(){this.constructor=i}return a.prototype=s.prototype,i.prototype=new a,i.__super__=s.prototype,i},n={}.hasOwnProperty;e=Fr(),RR.exports=t=(function(i){r(s,i);function s(o){s.__super__.constructor.call(this,o),this.value=""}return Object.defineProperty(s.prototype,"data",{get:function(){return this.value},set:function(o){return this.value=o||""}}),Object.defineProperty(s.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(s.prototype,"textContent",{get:function(){return this.value},set:function(o){return this.value=o||""}}),s.prototype.clone=function(){return Object.create(this)},s.prototype.substringData=function(o,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.appendData=function(o){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.insertData=function(o,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.deleteData=function(o,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.replaceData=function(o,a,u){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.isEqualNode=function(o){return!(!s.__super__.isEqualNode.apply(this,arguments).isEqualNode(o)||o.data!==this.data)},s})(e)}).call(kR)});var Pd=v((NR,$R)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=Et(),r=Tc(),$R.exports=e=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=t.CData,this.value=this.stringify.cdata(u)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.cdata(this,this.options.writer.filterOptions(a))},o})(r)}).call(NR)});var kd=v((LR,jR)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=Et(),e=Tc(),jR.exports=r=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=t.Comment,this.value=this.stringify.comment(u)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.comment(this,this.options.writer.filterOptions(a))},o})(e)}).call(LR)});var Rd=v((BR,MR)=>{(function(){var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;n=In().isObject,r=Fr(),t=Et(),MR.exports=e=(function(o){i(a,o);function a(u,c,l,h){var d;a.__super__.constructor.call(this,u),n(c)&&(d=c,c=d.version,l=d.encoding,h=d.standalone),c||(c="1.0"),this.type=t.Declaration,this.version=this.stringify.xmlVersion(c),l!=null&&(this.encoding=this.stringify.xmlEncoding(l)),h!=null&&(this.standalone=this.stringify.xmlStandalone(h))}return a.prototype.toString=function(u){return this.options.writer.declaration(this,this.options.writer.filterOptions(u))},a})(r)}).call(BR)});var Nd=v((qR,UR)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=Fr(),t=Et(),UR.exports=e=(function(s){n(o,s);function o(a,u,c,l,h,d){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(c==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(u));if(!l)throw new Error("Missing DTD attribute type. "+this.debugInfo(u));if(!h)throw new Error("Missing DTD attribute default. "+this.debugInfo(u));if(h.indexOf("#")!==0&&(h="#"+h),!h.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(u));if(d&&!h.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(u));this.elementName=this.stringify.name(u),this.type=t.AttributeDeclaration,this.attributeName=this.stringify.name(c),this.attributeType=this.stringify.dtdAttType(l),d&&(this.defaultValue=this.stringify.dtdAttDefault(d)),this.defaultValueType=h}return o.prototype.toString=function(a){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(a))},o})(r)}).call(qR)});var $d=v((HR,VR)=>{(function(){var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;n=In().isObject,r=Fr(),t=Et(),VR.exports=e=(function(o){i(a,o);function a(u,c,l,h){if(a.__super__.constructor.call(this,u),l==null)throw new Error("Missing DTD entity name. "+this.debugInfo(l));if(h==null)throw new Error("Missing DTD entity value. "+this.debugInfo(l));if(this.pe=!!c,this.name=this.stringify.name(l),this.type=t.EntityDeclaration,!n(h))this.value=this.stringify.dtdEntityValue(h),this.internal=!0;else{if(!h.pubID&&!h.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(l));if(h.pubID&&!h.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(l));if(this.internal=!1,h.pubID!=null&&(this.pubID=this.stringify.dtdPubID(h.pubID)),h.sysID!=null&&(this.sysID=this.stringify.dtdSysID(h.sysID)),h.nData!=null&&(this.nData=this.stringify.dtdNData(h.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(l))}}return Object.defineProperty(a.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(a.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(a.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(a.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(a.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(a.prototype,"xmlVersion",{get:function(){return null}}),a.prototype.toString=function(u){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(u))},a})(r)}).call(HR)});var Ld=v((zR,GR)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=Fr(),t=Et(),GR.exports=e=(function(s){n(o,s);function o(a,u,c){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing DTD element name. "+this.debugInfo());c||(c="(#PCDATA)"),Array.isArray(c)&&(c="("+c.join(",")+")"),this.name=this.stringify.name(u),this.type=t.ElementDeclaration,this.value=this.stringify.dtdElementValue(c)}return o.prototype.toString=function(a){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(a))},o})(r)}).call(zR)});var jd=v((KR,WR)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=Fr(),t=Et(),WR.exports=e=(function(s){n(o,s);function o(a,u,c){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing DTD notation name. "+this.debugInfo(u));if(!c.pubID&&!c.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(u));this.name=this.stringify.name(u),this.type=t.NotationDeclaration,c.pubID!=null&&(this.pubID=this.stringify.dtdPubID(c.pubID)),c.sysID!=null&&(this.sysID=this.stringify.dtdSysID(c.sysID))}return Object.defineProperty(o.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(o.prototype,"systemId",{get:function(){return this.sysID}}),o.prototype.toString=function(a){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(a))},o})(r)}).call(KR)});var Bd=v((XR,YR)=>{(function(){var t,e,r,n,i,s,o,a,u,c=function(h,d){for(var f in d)l.call(d,f)&&(h[f]=d[f]);function m(){this.constructor=h}return m.prototype=d.prototype,h.prototype=new m,h.__super__=d.prototype,h},l={}.hasOwnProperty;u=In().isObject,a=Fr(),t=Et(),e=Nd(),n=$d(),r=Ld(),i=jd(),o=Fd(),YR.exports=s=(function(h){c(d,h);function d(f,m,g){var b,S,A,p,D,w;if(d.__super__.constructor.call(this,f),this.type=t.DocType,f.children){for(p=f.children,S=0,A=p.length;S<A;S++)if(b=p[S],b.type===t.Element){this.name=b.name;break}}this.documentObject=f,u(m)&&(D=m,m=D.pubID,g=D.sysID),g==null&&(w=[m,g],g=w[0],m=w[1]),m!=null&&(this.pubID=this.stringify.dtdPubID(m)),g!=null&&(this.sysID=this.stringify.dtdSysID(g))}return Object.defineProperty(d.prototype,"entities",{get:function(){var f,m,g,b,S;for(b={},S=this.children,m=0,g=S.length;m<g;m++)f=S[m],f.type===t.EntityDeclaration&&!f.pe&&(b[f.name]=f);return new o(b)}}),Object.defineProperty(d.prototype,"notations",{get:function(){var f,m,g,b,S;for(b={},S=this.children,m=0,g=S.length;m<g;m++)f=S[m],f.type===t.NotationDeclaration&&(b[f.name]=f);return new o(b)}}),Object.defineProperty(d.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(d.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(d.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),d.prototype.element=function(f,m){var g;return g=new r(this,f,m),this.children.push(g),this},d.prototype.attList=function(f,m,g,b,S){var A;return A=new e(this,f,m,g,b,S),this.children.push(A),this},d.prototype.entity=function(f,m){var g;return g=new n(this,!1,f,m),this.children.push(g),this},d.prototype.pEntity=function(f,m){var g;return g=new n(this,!0,f,m),this.children.push(g),this},d.prototype.notation=function(f,m){var g;return g=new i(this,f,m),this.children.push(g),this},d.prototype.toString=function(f){return this.options.writer.docType(this,this.options.writer.filterOptions(f))},d.prototype.ele=function(f,m){return this.element(f,m)},d.prototype.att=function(f,m,g,b,S){return this.attList(f,m,g,b,S)},d.prototype.ent=function(f,m){return this.entity(f,m)},d.prototype.pent=function(f,m){return this.pEntity(f,m)},d.prototype.not=function(f,m){return this.notation(f,m)},d.prototype.up=function(){return this.root()||this.documentObject},d.prototype.isEqualNode=function(f){return!(!d.__super__.isEqualNode.apply(this,arguments).isEqualNode(f)||f.name!==this.name||f.publicId!==this.publicId||f.systemId!==this.systemId)},d})(a)}).call(XR)});var Md=v((JR,ZR)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=Et(),e=Fr(),ZR.exports=r=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=t.Raw,this.value=this.stringify.raw(u)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.raw(this,this.options.writer.filterOptions(a))},o})(e)}).call(JR)});var qd=v((QR,eN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=Et(),e=Tc(),eN.exports=r=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=t.Text,this.value=this.stringify.text(u)}return Object.defineProperty(o.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(o.prototype,"wholeText",{get:function(){var a,u,c;for(c="",u=this.previousSibling;u;)c=u.data+c,u=u.previousSibling;for(c+=this.data,a=this.nextSibling;a;)c=c+a.data,a=a.nextSibling;return c}}),o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.text(this,this.options.writer.filterOptions(a))},o.prototype.splitText=function(a){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.replaceWholeText=function(a){throw new Error("This DOM method is not implemented."+this.debugInfo())},o})(e)}).call(QR)});var Ud=v((tN,rN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=Et(),e=Tc(),rN.exports=r=(function(s){n(o,s);function o(a,u,c){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=t.ProcessingInstruction,this.target=this.stringify.insTarget(u),this.name=this.target,c&&(this.value=this.stringify.insValue(c))}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(a))},o.prototype.isEqualNode=function(a){return!(!o.__super__.isEqualNode.apply(this,arguments).isEqualNode(a)||a.target!==this.target)},o})(e)}).call(tN)});var ub=v((nN,iN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=Fr(),t=Et(),iN.exports=e=(function(s){n(o,s);function o(a){o.__super__.constructor.call(this,a),this.type=t.Dummy}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return""},o})(r)}).call(nN)});var aN=v((sN,oN)=>{(function(){var t;oN.exports=t=(function(){function e(r){this.nodes=r}return Object.defineProperty(e.prototype,"length",{get:function(){return this.nodes.length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.item=function(r){return this.nodes[r]||null},e})()}).call(sN)});var lN=v((uN,cN)=>{(function(){cN.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(uN)});var Fr=v((fN,hN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,g,b,S,A,p={}.hasOwnProperty;A=In(),S=A.isObject,b=A.isFunction,g=A.isEmpty,m=A.getValue,a=null,r=null,n=null,i=null,s=null,d=null,f=null,h=null,o=null,e=null,l=null,u=null,t=null,hN.exports=c=(function(){function D(w){this.parent=w,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,a||(a=Id(),r=Pd(),n=kd(),i=Rd(),s=Bd(),d=Md(),f=qd(),h=Ud(),o=ub(),e=Et(),l=aN(),u=Fd(),t=lN())}return Object.defineProperty(D.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(D.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(D.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(D.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(D.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new l(this.children)),this.childNodeList}}),Object.defineProperty(D.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(D.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(D.prototype,"previousSibling",{get:function(){var w;return w=this.parent.children.indexOf(this),this.parent.children[w-1]||null}}),Object.defineProperty(D.prototype,"nextSibling",{get:function(){var w;return w=this.parent.children.indexOf(this),this.parent.children[w+1]||null}}),Object.defineProperty(D.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(D.prototype,"textContent",{get:function(){var w,_,P,E,R;if(this.nodeType===e.Element||this.nodeType===e.DocumentFragment){for(R="",E=this.children,_=0,P=E.length;_<P;_++)w=E[_],w.textContent&&(R+=w.textContent);return R}else return null},set:function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),D.prototype.setParent=function(w){var _,P,E,R,k;for(this.parent=w,w&&(this.options=w.options,this.stringify=w.stringify),R=this.children,k=[],P=0,E=R.length;P<E;P++)_=R[P],k.push(_.setParent(this));return k},D.prototype.element=function(w,_,P){var E,R,k,F,j,U,G,L,C,T,I;if(U=null,_===null&&P==null&&(C=[{},null],_=C[0],P=C[1]),_==null&&(_={}),_=m(_),S(_)||(T=[_,P],P=T[0],_=T[1]),w!=null&&(w=m(w)),Array.isArray(w))for(k=0,G=w.length;k<G;k++)R=w[k],U=this.element(R);else if(b(w))U=this.element(w.apply());else if(S(w)){for(j in w)if(p.call(w,j))if(I=w[j],b(I)&&(I=I.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&j.indexOf(this.stringify.convertAttKey)===0)U=this.attribute(j.substr(this.stringify.convertAttKey.length),I);else if(!this.options.separateArrayItems&&Array.isArray(I)&&g(I))U=this.dummy();else if(S(I)&&g(I))U=this.element(j);else if(!this.options.keepNullNodes&&I==null)U=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(I))for(F=0,L=I.length;F<L;F++)R=I[F],E={},E[j]=R,U=this.element(E);else S(I)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&j.indexOf(this.stringify.convertTextKey)===0?U=this.element(I):(U=this.element(j),U.element(I)):U=this.element(j,I)}else!this.options.keepNullNodes&&P===null?U=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&w.indexOf(this.stringify.convertTextKey)===0?U=this.text(P):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&w.indexOf(this.stringify.convertCDataKey)===0?U=this.cdata(P):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&w.indexOf(this.stringify.convertCommentKey)===0?U=this.comment(P):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&w.indexOf(this.stringify.convertRawKey)===0?U=this.raw(P):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&w.indexOf(this.stringify.convertPIKey)===0?U=this.instruction(w.substr(this.stringify.convertPIKey.length),P):U=this.node(w,_,P);if(U==null)throw new Error("Could not create any elements with: "+w+". "+this.debugInfo());return U},D.prototype.insertBefore=function(w,_,P){var E,R,k,F,j;if(w?.type)return k=w,F=_,k.setParent(this),F?(R=children.indexOf(F),j=children.splice(R),children.push(k),Array.prototype.push.apply(children,j)):children.push(k),k;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(w));return R=this.parent.children.indexOf(this),j=this.parent.children.splice(R),E=this.parent.element(w,_,P),Array.prototype.push.apply(this.parent.children,j),E},D.prototype.insertAfter=function(w,_,P){var E,R,k;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(w));return R=this.parent.children.indexOf(this),k=this.parent.children.splice(R+1),E=this.parent.element(w,_,P),Array.prototype.push.apply(this.parent.children,k),E},D.prototype.remove=function(){var w,_;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return w=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[w,w-w+1].concat(_=[])),this.parent},D.prototype.node=function(w,_,P){var E,R;return w!=null&&(w=m(w)),_||(_={}),_=m(_),S(_)||(R=[_,P],P=R[0],_=R[1]),E=new a(this,w,_),P!=null&&E.text(P),this.children.push(E),E},D.prototype.text=function(w){var _;return S(w)&&this.element(w),_=new f(this,w),this.children.push(_),this},D.prototype.cdata=function(w){var _;return _=new r(this,w),this.children.push(_),this},D.prototype.comment=function(w){var _;return _=new n(this,w),this.children.push(_),this},D.prototype.commentBefore=function(w){var _,P,E;return P=this.parent.children.indexOf(this),E=this.parent.children.splice(P),_=this.parent.comment(w),Array.prototype.push.apply(this.parent.children,E),this},D.prototype.commentAfter=function(w){var _,P,E;return P=this.parent.children.indexOf(this),E=this.parent.children.splice(P+1),_=this.parent.comment(w),Array.prototype.push.apply(this.parent.children,E),this},D.prototype.raw=function(w){var _;return _=new d(this,w),this.children.push(_),this},D.prototype.dummy=function(){var w;return w=new o(this),w},D.prototype.instruction=function(w,_){var P,E,R,k,F;if(w!=null&&(w=m(w)),_!=null&&(_=m(_)),Array.isArray(w))for(k=0,F=w.length;k<F;k++)P=w[k],this.instruction(P);else if(S(w))for(P in w)p.call(w,P)&&(E=w[P],this.instruction(P,E));else b(_)&&(_=_.apply()),R=new h(this,w,_),this.children.push(R);return this},D.prototype.instructionBefore=function(w,_){var P,E,R;return E=this.parent.children.indexOf(this),R=this.parent.children.splice(E),P=this.parent.instruction(w,_),Array.prototype.push.apply(this.parent.children,R),this},D.prototype.instructionAfter=function(w,_){var P,E,R;return E=this.parent.children.indexOf(this),R=this.parent.children.splice(E+1),P=this.parent.instruction(w,_),Array.prototype.push.apply(this.parent.children,R),this},D.prototype.declaration=function(w,_,P){var E,R;return E=this.document(),R=new i(E,w,_,P),E.children.length===0?E.children.unshift(R):E.children[0].type===e.Declaration?E.children[0]=R:E.children.unshift(R),E.root()||E},D.prototype.dtd=function(w,_){var P,E,R,k,F,j,U,G,L,C;for(E=this.document(),R=new s(E,w,_),L=E.children,k=F=0,U=L.length;F<U;k=++F)if(P=L[k],P.type===e.DocType)return E.children[k]=R,R;for(C=E.children,k=j=0,G=C.length;j<G;k=++j)if(P=C[k],P.isRoot)return E.children.splice(k,0,R),R;return E.children.push(R),R},D.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},D.prototype.root=function(){var w;for(w=this;w;){if(w.type===e.Document)return w.rootObject;if(w.isRoot)return w;w=w.parent}},D.prototype.document=function(){var w;for(w=this;w;){if(w.type===e.Document)return w;w=w.parent}},D.prototype.end=function(w){return this.document().end(w)},D.prototype.prev=function(){var w;if(w=this.parent.children.indexOf(this),w<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[w-1]},D.prototype.next=function(){var w;if(w=this.parent.children.indexOf(this),w===-1||w===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[w+1]},D.prototype.importDocument=function(w){var _;return _=w.root().clone(),_.parent=this,_.isRoot=!1,this.children.push(_),this},D.prototype.debugInfo=function(w){var _,P;return w=w||this.name,w==null&&!((_=this.parent)!=null&&_.name)?"":w==null?"parent: <"+this.parent.name+">":(P=this.parent)!=null&&P.name?"node: <"+w+">, parent: <"+this.parent.name+">":"node: <"+w+">"},D.prototype.ele=function(w,_,P){return this.element(w,_,P)},D.prototype.nod=function(w,_,P){return this.node(w,_,P)},D.prototype.txt=function(w){return this.text(w)},D.prototype.dat=function(w){return this.cdata(w)},D.prototype.com=function(w){return this.comment(w)},D.prototype.ins=function(w,_){return this.instruction(w,_)},D.prototype.doc=function(){return this.document()},D.prototype.dec=function(w,_,P){return this.declaration(w,_,P)},D.prototype.e=function(w,_,P){return this.element(w,_,P)},D.prototype.n=function(w,_,P){return this.node(w,_,P)},D.prototype.t=function(w){return this.text(w)},D.prototype.d=function(w){return this.cdata(w)},D.prototype.c=function(w){return this.comment(w)},D.prototype.r=function(w){return this.raw(w)},D.prototype.i=function(w,_){return this.instruction(w,_)},D.prototype.u=function(){return this.up()},D.prototype.importXMLBuilder=function(w){return this.importDocument(w)},D.prototype.replaceChild=function(w,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.removeChild=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.appendChild=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.hasChildNodes=function(){return this.children.length!==0},D.prototype.cloneNode=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.isSupported=function(w,_){return!0},D.prototype.hasAttributes=function(){return this.attribs.length!==0},D.prototype.compareDocumentPosition=function(w){var _,P;return _=this,_===w?0:this.document()!==w.document()?(P=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?P|=t.Preceding:P|=t.Following,P):_.isAncestor(w)?t.Contains|t.Preceding:_.isDescendant(w)?t.Contains|t.Following:_.isPreceding(w)?t.Preceding:t.Following},D.prototype.isSameNode=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.lookupPrefix=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.isDefaultNamespace=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.lookupNamespaceURI=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.isEqualNode=function(w){var _,P,E;if(w.nodeType!==this.nodeType||w.children.length!==this.children.length)return!1;for(_=P=0,E=this.children.length-1;0<=E?P<=E:P>=E;_=0<=E?++P:--P)if(!this.children[_].isEqualNode(w.children[_]))return!1;return!0},D.prototype.getFeature=function(w,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.setUserData=function(w,_,P){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.getUserData=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.contains=function(w){return w?w===this||this.isDescendant(w):!1},D.prototype.isDescendant=function(w){var _,P,E,R,k;for(k=this.children,E=0,R=k.length;E<R;E++)if(_=k[E],w===_||(P=_.isDescendant(w),P))return!0;return!1},D.prototype.isAncestor=function(w){return w.isDescendant(this)},D.prototype.isPreceding=function(w){var _,P;return _=this.treePosition(w),P=this.treePosition(this),_===-1||P===-1?!1:_<P},D.prototype.isFollowing=function(w){var _,P;return _=this.treePosition(w),P=this.treePosition(this),_===-1||P===-1?!1:_>P},D.prototype.treePosition=function(w){var _,P;return P=0,_=!1,this.foreachTreeNode(this.document(),function(E){if(P++,!_&&E===w)return _=!0}),_?P:-1},D.prototype.foreachTreeNode=function(w,_){var P,E,R,k,F;for(w||(w=this.document()),k=w.children,E=0,R=k.length;E<R;E++){if(P=k[E],F=_(P))return F;if(F=this.foreachTreeNode(P,_),F)return F}},D})()}).call(fN)});var cb=v((dN,pN)=>{(function(){var t,e=function(n,i){return function(){return n.apply(i,arguments)}},r={}.hasOwnProperty;pN.exports=t=(function(){function n(i){this.assertLegalName=e(this.assertLegalName,this),this.assertLegalChar=e(this.assertLegalChar,this);var s,o,a;i||(i={}),this.options=i,this.options.version||(this.options.version="1.0"),o=i.stringify||{};for(s in o)r.call(o,s)&&(a=o[s],this[s]=a)}return n.prototype.name=function(i){return this.options.noValidation?i:this.assertLegalName(""+i||"")},n.prototype.text=function(i){return this.options.noValidation?i:this.assertLegalChar(this.textEscape(""+i||""))},n.prototype.cdata=function(i){return this.options.noValidation?i:(i=""+i||"",i=i.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(i))},n.prototype.comment=function(i){if(this.options.noValidation)return i;if(i=""+i||"",i.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+i);return this.assertLegalChar(i)},n.prototype.raw=function(i){return this.options.noValidation?i:""+i||""},n.prototype.attValue=function(i){return this.options.noValidation?i:this.assertLegalChar(this.attEscape(i=""+i||""))},n.prototype.insTarget=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.insValue=function(i){if(this.options.noValidation)return i;if(i=""+i||"",i.match(/\?>/))throw new Error("Invalid processing instruction value: "+i);return this.assertLegalChar(i)},n.prototype.xmlVersion=function(i){if(this.options.noValidation)return i;if(i=""+i||"",!i.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+i);return i},n.prototype.xmlEncoding=function(i){if(this.options.noValidation)return i;if(i=""+i||"",!i.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+i);return this.assertLegalChar(i)},n.prototype.xmlStandalone=function(i){return this.options.noValidation?i:i?"yes":"no"},n.prototype.dtdPubID=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdSysID=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdElementValue=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdAttType=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdAttDefault=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdEntityValue=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdNData=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.convertAttKey="@",n.prototype.convertPIKey="?",n.prototype.convertTextKey="#text",n.prototype.convertCDataKey="#cdata",n.prototype.convertCommentKey="#comment",n.prototype.convertRawKey="#raw",n.prototype.assertLegalChar=function(i){var s,o;if(this.options.noValidation)return i;if(s="",this.options.version==="1.0"){if(s=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=i.match(s))throw new Error("Invalid character in string: "+i+" at index "+o.index)}else if(this.options.version==="1.1"&&(s=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=i.match(s)))throw new Error("Invalid character in string: "+i+" at index "+o.index);return i},n.prototype.assertLegalName=function(i){var s;if(this.options.noValidation)return i;if(this.assertLegalChar(i),s=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!i.match(s))throw new Error("Invalid character in name");return i},n.prototype.textEscape=function(i){var s;return this.options.noValidation?i:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(s,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
"))},n.prototype.attEscape=function(i){var s;return this.options.noValidation?i:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(s,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
"))},n})()}).call(dN)});var Fc=v((mN,gN)=>{(function(){gN.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(mN)});var lb=v((yN,DN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,g,b,S={}.hasOwnProperty;b=In().assign,t=Et(),u=Rd(),c=Bd(),r=Pd(),n=kd(),h=Id(),f=Md(),m=qd(),d=Ud(),l=ub(),i=Nd(),s=Ld(),o=$d(),a=jd(),e=Fc(),DN.exports=g=(function(){function A(p){var D,w,_;p||(p={}),this.options=p,w=p.writer||{};for(D in w)S.call(w,D)&&(_=w[D],this["_"+D]=this[D],this[D]=_)}return A.prototype.filterOptions=function(p){var D,w,_,P,E,R,k,F;return p||(p={}),p=b({},this.options,p),D={writer:this},D.pretty=p.pretty||!1,D.allowEmpty=p.allowEmpty||!1,D.indent=(w=p.indent)!=null?w:" ",D.newline=(_=p.newline)!=null?_:`
|
|
185
|
+
`,D.offset=(P=p.offset)!=null?P:0,D.dontPrettyTextNodes=(E=(R=p.dontPrettyTextNodes)!=null?R:p.dontprettytextnodes)!=null?E:0,D.spaceBeforeSlash=(k=(F=p.spaceBeforeSlash)!=null?F:p.spacebeforeslash)!=null?k:"",D.spaceBeforeSlash===!0&&(D.spaceBeforeSlash=" "),D.suppressPrettyCount=0,D.user={},D.state=e.None,D},A.prototype.indent=function(p,D,w){var _;return!D.pretty||D.suppressPrettyCount?"":D.pretty&&(_=(w||0)+D.offset+1,_>0)?new Array(_).join(D.indent):""},A.prototype.endline=function(p,D,w){return!D.pretty||D.suppressPrettyCount?"":D.newline},A.prototype.attribute=function(p,D,w){var _;return this.openAttribute(p,D,w),_=" "+p.name+'="'+p.value+'"',this.closeAttribute(p,D,w),_},A.prototype.cdata=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<![CDATA[",D.state=e.InsideTag,_+=p.value,D.state=e.CloseTag,_+="]]>"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.comment=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<!-- ",D.state=e.InsideTag,_+=p.value,D.state=e.CloseTag,_+=" -->"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.declaration=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<?xml",D.state=e.InsideTag,_+=' version="'+p.version+'"',p.encoding!=null&&(_+=' encoding="'+p.encoding+'"'),p.standalone!=null&&(_+=' standalone="'+p.standalone+'"'),D.state=e.CloseTag,_+=D.spaceBeforeSlash+"?>",_+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.docType=function(p,D,w){var _,P,E,R,k;if(w||(w=0),this.openNode(p,D,w),D.state=e.OpenTag,R=this.indent(p,D,w),R+="<!DOCTYPE "+p.root().name,p.pubID&&p.sysID?R+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.sysID&&(R+=' SYSTEM "'+p.sysID+'"'),p.children.length>0){for(R+=" [",R+=this.endline(p,D,w),D.state=e.InsideTag,k=p.children,P=0,E=k.length;P<E;P++)_=k[P],R+=this.writeChildNode(_,D,w+1);D.state=e.CloseTag,R+="]"}return D.state=e.CloseTag,R+=D.spaceBeforeSlash+">",R+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),R},A.prototype.element=function(p,D,w){var _,P,E,R,k,F,j,U,G,L,C,T,I,$;w||(w=0),L=!1,C="",this.openNode(p,D,w),D.state=e.OpenTag,C+=this.indent(p,D,w)+"<"+p.name,T=p.attribs;for(G in T)S.call(T,G)&&(_=T[G],C+=this.attribute(_,D,w));if(E=p.children.length,R=E===0?null:p.children[0],E===0||p.children.every(function(M){return(M.type===t.Text||M.type===t.Raw)&&M.value===""}))D.allowEmpty?(C+=">",D.state=e.CloseTag,C+="</"+p.name+">"+this.endline(p,D,w)):(D.state=e.CloseTag,C+=D.spaceBeforeSlash+"/>"+this.endline(p,D,w));else if(D.pretty&&E===1&&(R.type===t.Text||R.type===t.Raw)&&R.value!=null)C+=">",D.state=e.InsideTag,D.suppressPrettyCount++,L=!0,C+=this.writeChildNode(R,D,w+1),D.suppressPrettyCount--,L=!1,D.state=e.CloseTag,C+="</"+p.name+">"+this.endline(p,D,w);else{if(D.dontPrettyTextNodes){for(I=p.children,k=0,j=I.length;k<j;k++)if(P=I[k],(P.type===t.Text||P.type===t.Raw)&&P.value!=null){D.suppressPrettyCount++,L=!0;break}}for(C+=">"+this.endline(p,D,w),D.state=e.InsideTag,$=p.children,F=0,U=$.length;F<U;F++)P=$[F],C+=this.writeChildNode(P,D,w+1);D.state=e.CloseTag,C+=this.indent(p,D,w)+"</"+p.name+">",L&&D.suppressPrettyCount--,C+=this.endline(p,D,w),D.state=e.None}return this.closeNode(p,D,w),C},A.prototype.writeChildNode=function(p,D,w){switch(p.type){case t.CData:return this.cdata(p,D,w);case t.Comment:return this.comment(p,D,w);case t.Element:return this.element(p,D,w);case t.Raw:return this.raw(p,D,w);case t.Text:return this.text(p,D,w);case t.ProcessingInstruction:return this.processingInstruction(p,D,w);case t.Dummy:return"";case t.Declaration:return this.declaration(p,D,w);case t.DocType:return this.docType(p,D,w);case t.AttributeDeclaration:return this.dtdAttList(p,D,w);case t.ElementDeclaration:return this.dtdElement(p,D,w);case t.EntityDeclaration:return this.dtdEntity(p,D,w);case t.NotationDeclaration:return this.dtdNotation(p,D,w);default:throw new Error("Unknown XML node type: "+p.constructor.name)}},A.prototype.processingInstruction=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<?",D.state=e.InsideTag,_+=p.target,p.value&&(_+=" "+p.value),D.state=e.CloseTag,_+=D.spaceBeforeSlash+"?>",_+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.raw=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w),D.state=e.InsideTag,_+=p.value,D.state=e.CloseTag,_+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.text=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w),D.state=e.InsideTag,_+=p.value,D.state=e.CloseTag,_+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.dtdAttList=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<!ATTLIST",D.state=e.InsideTag,_+=" "+p.elementName+" "+p.attributeName+" "+p.attributeType,p.defaultValueType!=="#DEFAULT"&&(_+=" "+p.defaultValueType),p.defaultValue&&(_+=' "'+p.defaultValue+'"'),D.state=e.CloseTag,_+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.dtdElement=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<!ELEMENT",D.state=e.InsideTag,_+=" "+p.name+" "+p.value,D.state=e.CloseTag,_+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.dtdEntity=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<!ENTITY",D.state=e.InsideTag,p.pe&&(_+=" %"),_+=" "+p.name,p.value?_+=' "'+p.value+'"':(p.pubID&&p.sysID?_+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.sysID&&(_+=' SYSTEM "'+p.sysID+'"'),p.nData&&(_+=" NDATA "+p.nData)),D.state=e.CloseTag,_+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.dtdNotation=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<!NOTATION",D.state=e.InsideTag,_+=" "+p.name,p.pubID&&p.sysID?_+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.pubID?_+=' PUBLIC "'+p.pubID+'"':p.sysID&&(_+=' SYSTEM "'+p.sysID+'"'),D.state=e.CloseTag,_+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.openNode=function(p,D,w){},A.prototype.closeNode=function(p,D,w){},A.prototype.openAttribute=function(p,D,w){},A.prototype.closeAttribute=function(p,D,w){},A})()}).call(yN)});var Hd=v((wN,bN)=>{(function(){var t,e,r=function(i,s){for(var o in s)n.call(s,o)&&(i[o]=s[o]);function a(){this.constructor=i}return a.prototype=s.prototype,i.prototype=new a,i.__super__=s.prototype,i},n={}.hasOwnProperty;e=lb(),bN.exports=t=(function(i){r(s,i);function s(o){s.__super__.constructor.call(this,o)}return s.prototype.document=function(o,a){var u,c,l,h,d;for(a=this.filterOptions(a),h="",d=o.children,c=0,l=d.length;c<l;c++)u=d[c],h+=this.writeChildNode(u,a,0);return a.pretty&&h.slice(-a.newline.length)===a.newline&&(h=h.slice(0,-a.newline.length)),h},s})(e)}).call(wN)});var fb=v((vN,EN)=>{(function(){var t,e,r,n,i,s,o,a,u=function(l,h){for(var d in h)c.call(h,d)&&(l[d]=h[d]);function f(){this.constructor=l}return f.prototype=h.prototype,l.prototype=new f,l.__super__=h.prototype,l},c={}.hasOwnProperty;a=In().isPlainObject,r=ob(),e=CR(),i=Fr(),t=Et(),o=cb(),s=Hd(),EN.exports=n=(function(l){u(h,l);function h(d){h.__super__.constructor.call(this,null),this.name="#document",this.type=t.Document,this.documentURI=null,this.domConfig=new e,d||(d={}),d.writer||(d.writer=new s),this.options=d,this.stringify=new o(d)}return Object.defineProperty(h.prototype,"implementation",{value:new r}),Object.defineProperty(h.prototype,"doctype",{get:function(){var d,f,m,g;for(g=this.children,f=0,m=g.length;f<m;f++)if(d=g[f],d.type===t.DocType)return d;return null}}),Object.defineProperty(h.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(h.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(h.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(h.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].encoding:null}}),Object.defineProperty(h.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(h.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(h.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(h.prototype,"origin",{get:function(){return null}}),Object.defineProperty(h.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(h.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(h.prototype,"contentType",{get:function(){return null}}),h.prototype.end=function(d){var f;return f={},d?a(d)&&(f=d,d=this.options.writer):d=this.options.writer,d.document(this,d.filterOptions(f))},h.prototype.toString=function(d){return this.options.writer.document(this,this.options.writer.filterOptions(d))},h.prototype.createElement=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createTextNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createComment=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createCDATASection=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createProcessingInstruction=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createAttribute=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createEntityReference=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByTagName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.importNode=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createElementNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createAttributeNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByTagNameNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementById=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.adoptNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.renameNode=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByClassName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createEvent=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createNodeIterator=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createTreeWalker=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h})(i)}).call(vN)});var SN=v((_N,CN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,g,b,S,A,p,D,w,_,P,E={}.hasOwnProperty;P=In(),w=P.isObject,D=P.isFunction,_=P.isPlainObject,p=P.getValue,t=Et(),h=fb(),f=Id(),n=Pd(),i=kd(),g=Md(),A=qd(),m=Ud(),c=Rd(),l=Bd(),s=Nd(),a=$d(),o=Ld(),u=jd(),r=ab(),S=cb(),b=Hd(),e=Fc(),CN.exports=d=(function(){function R(k,F,j){var U;this.name="?xml",this.type=t.Document,k||(k={}),U={},k.writer?_(k.writer)&&(U=k.writer,k.writer=new b):k.writer=new b,this.options=k,this.writer=k.writer,this.writerOptions=this.writer.filterOptions(U),this.stringify=new S(k),this.onDataCallback=F||function(){},this.onEndCallback=j||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return R.prototype.createChildNode=function(k){var F,j,U,G,L,C,T,I;switch(k.type){case t.CData:this.cdata(k.value);break;case t.Comment:this.comment(k.value);break;case t.Element:U={},T=k.attribs;for(j in T)E.call(T,j)&&(F=T[j],U[j]=F.value);this.node(k.name,U);break;case t.Dummy:this.dummy();break;case t.Raw:this.raw(k.value);break;case t.Text:this.text(k.value);break;case t.ProcessingInstruction:this.instruction(k.target,k.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+k.constructor.name)}for(I=k.children,L=0,C=I.length;L<C;L++)G=I[L],this.createChildNode(G),G.type===t.Element&&this.up();return this},R.prototype.dummy=function(){return this},R.prototype.node=function(k,F,j){var U;if(k==null)throw new Error("Missing node name.");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node. "+this.debugInfo(k));return this.openCurrent(),k=p(k),F==null&&(F={}),F=p(F),w(F)||(U=[F,j],j=U[0],F=U[1]),this.currentNode=new f(this,k,F),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,j!=null&&this.text(j),this},R.prototype.element=function(k,F,j){var U,G,L,C,T,I;if(this.currentNode&&this.currentNode.type===t.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(k)||w(k)||D(k))for(C=this.options.noValidation,this.options.noValidation=!0,I=new h(this.options).element("TEMP_ROOT"),I.element(k),this.options.noValidation=C,T=I.children,G=0,L=T.length;G<L;G++)U=T[G],this.createChildNode(U),U.type===t.Element&&this.up();else this.node(k,F,j);return this},R.prototype.attribute=function(k,F){var j,U;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(k));if(k!=null&&(k=p(k)),w(k))for(j in k)E.call(k,j)&&(U=k[j],this.attribute(j,U));else D(F)&&(F=F.apply()),this.options.keepNullAttributes&&F==null?this.currentNode.attribs[k]=new r(this,k,""):F!=null&&(this.currentNode.attribs[k]=new r(this,k,F));return this},R.prototype.text=function(k){var F;return this.openCurrent(),F=new A(this,k),this.onData(this.writer.text(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.cdata=function(k){var F;return this.openCurrent(),F=new n(this,k),this.onData(this.writer.cdata(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.comment=function(k){var F;return this.openCurrent(),F=new i(this,k),this.onData(this.writer.comment(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.raw=function(k){var F;return this.openCurrent(),F=new g(this,k),this.onData(this.writer.raw(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.instruction=function(k,F){var j,U,G,L,C;if(this.openCurrent(),k!=null&&(k=p(k)),F!=null&&(F=p(F)),Array.isArray(k))for(j=0,L=k.length;j<L;j++)U=k[j],this.instruction(U);else if(w(k))for(U in k)E.call(k,U)&&(G=k[U],this.instruction(U,G));else D(F)&&(F=F.apply()),C=new m(this,k,F),this.onData(this.writer.processingInstruction(C,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},R.prototype.declaration=function(k,F,j){var U;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return U=new c(this,k,F,j),this.onData(this.writer.declaration(U,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.doctype=function(k,F,j){if(this.openCurrent(),k==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new l(this,F,j),this.currentNode.rootNodeName=k,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},R.prototype.dtdElement=function(k,F){var j;return this.openCurrent(),j=new o(this,k,F),this.onData(this.writer.dtdElement(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.attList=function(k,F,j,U,G){var L;return this.openCurrent(),L=new s(this,k,F,j,U,G),this.onData(this.writer.dtdAttList(L,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.entity=function(k,F){var j;return this.openCurrent(),j=new a(this,!1,k,F),this.onData(this.writer.dtdEntity(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.pEntity=function(k,F){var j;return this.openCurrent(),j=new a(this,!0,k,F),this.onData(this.writer.dtdEntity(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.notation=function(k,F){var j;return this.openCurrent(),j=new u(this,k,F),this.onData(this.writer.dtdNotation(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},R.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},R.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},R.prototype.openNode=function(k){var F,j,U,G;if(!k.isOpen){if(!this.root&&this.currentLevel===0&&k.type===t.Element&&(this.root=k),j="",k.type===t.Element){this.writerOptions.state=e.OpenTag,j=this.writer.indent(k,this.writerOptions,this.currentLevel)+"<"+k.name,G=k.attribs;for(U in G)E.call(G,U)&&(F=G[U],j+=this.writer.attribute(F,this.writerOptions,this.currentLevel));j+=(k.children?">":"/>")+this.writer.endline(k,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,j=this.writer.indent(k,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+k.rootNodeName,k.pubID&&k.sysID?j+=' PUBLIC "'+k.pubID+'" "'+k.sysID+'"':k.sysID&&(j+=' SYSTEM "'+k.sysID+'"'),k.children?(j+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,j+=">"),j+=this.writer.endline(k,this.writerOptions,this.currentLevel);return this.onData(j,this.currentLevel),k.isOpen=!0}},R.prototype.closeNode=function(k){var F;if(!k.isClosed)return F="",this.writerOptions.state=e.CloseTag,k.type===t.Element?F=this.writer.indent(k,this.writerOptions,this.currentLevel)+"</"+k.name+">"+this.writer.endline(k,this.writerOptions,this.currentLevel):F=this.writer.indent(k,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(k,this.writerOptions,this.currentLevel),this.writerOptions.state=e.None,this.onData(F,this.currentLevel),k.isClosed=!0},R.prototype.onData=function(k,F){return this.documentStarted=!0,this.onDataCallback(k,F+1)},R.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},R.prototype.debugInfo=function(k){return k==null?"":"node: <"+k+">"},R.prototype.ele=function(){return this.element.apply(this,arguments)},R.prototype.nod=function(k,F,j){return this.node(k,F,j)},R.prototype.txt=function(k){return this.text(k)},R.prototype.dat=function(k){return this.cdata(k)},R.prototype.com=function(k){return this.comment(k)},R.prototype.ins=function(k,F){return this.instruction(k,F)},R.prototype.dec=function(k,F,j){return this.declaration(k,F,j)},R.prototype.dtd=function(k,F,j){return this.doctype(k,F,j)},R.prototype.e=function(k,F,j){return this.element(k,F,j)},R.prototype.n=function(k,F,j){return this.node(k,F,j)},R.prototype.t=function(k){return this.text(k)},R.prototype.d=function(k){return this.cdata(k)},R.prototype.c=function(k){return this.comment(k)},R.prototype.r=function(k){return this.raw(k)},R.prototype.i=function(k,F){return this.instruction(k,F)},R.prototype.att=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},R.prototype.a=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},R.prototype.ent=function(k,F){return this.entity(k,F)},R.prototype.pent=function(k,F){return this.pEntity(k,F)},R.prototype.not=function(k,F){return this.notation(k,F)},R})()}).call(_N)});var xN=v((AN,ON)=>{(function(){var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;t=Et(),n=lb(),e=Fc(),ON.exports=r=(function(o){i(a,o);function a(u,c){this.stream=u,a.__super__.constructor.call(this,c)}return a.prototype.endline=function(u,c,l){return u.isLastRootNode&&c.state===e.CloseTag?"":a.__super__.endline.call(this,u,c,l)},a.prototype.document=function(u,c){var l,h,d,f,m,g,b,S,A;for(b=u.children,h=d=0,m=b.length;d<m;h=++d)l=b[h],l.isLastRootNode=h===u.children.length-1;for(c=this.filterOptions(c),S=u.children,A=[],f=0,g=S.length;f<g;f++)l=S[f],A.push(this.writeChildNode(l,c,0));return A},a.prototype.attribute=function(u,c,l){return this.stream.write(a.__super__.attribute.call(this,u,c,l))},a.prototype.cdata=function(u,c,l){return this.stream.write(a.__super__.cdata.call(this,u,c,l))},a.prototype.comment=function(u,c,l){return this.stream.write(a.__super__.comment.call(this,u,c,l))},a.prototype.declaration=function(u,c,l){return this.stream.write(a.__super__.declaration.call(this,u,c,l))},a.prototype.docType=function(u,c,l){var h,d,f,m;if(l||(l=0),this.openNode(u,c,l),c.state=e.OpenTag,this.stream.write(this.indent(u,c,l)),this.stream.write("<!DOCTYPE "+u.root().name),u.pubID&&u.sysID?this.stream.write(' PUBLIC "'+u.pubID+'" "'+u.sysID+'"'):u.sysID&&this.stream.write(' SYSTEM "'+u.sysID+'"'),u.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(u,c,l)),c.state=e.InsideTag,m=u.children,d=0,f=m.length;d<f;d++)h=m[d],this.writeChildNode(h,c,l+1);c.state=e.CloseTag,this.stream.write("]")}return c.state=e.CloseTag,this.stream.write(c.spaceBeforeSlash+">"),this.stream.write(this.endline(u,c,l)),c.state=e.None,this.closeNode(u,c,l)},a.prototype.element=function(u,c,l){var h,d,f,m,g,b,S,A,p,D;l||(l=0),this.openNode(u,c,l),c.state=e.OpenTag,this.stream.write(this.indent(u,c,l)+"<"+u.name),p=u.attribs;for(S in p)s.call(p,S)&&(h=p[S],this.attribute(h,c,l));if(f=u.children.length,m=f===0?null:u.children[0],f===0||u.children.every(function(w){return(w.type===t.Text||w.type===t.Raw)&&w.value===""}))c.allowEmpty?(this.stream.write(">"),c.state=e.CloseTag,this.stream.write("</"+u.name+">")):(c.state=e.CloseTag,this.stream.write(c.spaceBeforeSlash+"/>"));else if(c.pretty&&f===1&&(m.type===t.Text||m.type===t.Raw)&&m.value!=null)this.stream.write(">"),c.state=e.InsideTag,c.suppressPrettyCount++,A=!0,this.writeChildNode(m,c,l+1),c.suppressPrettyCount--,A=!1,c.state=e.CloseTag,this.stream.write("</"+u.name+">");else{for(this.stream.write(">"+this.endline(u,c,l)),c.state=e.InsideTag,D=u.children,g=0,b=D.length;g<b;g++)d=D[g],this.writeChildNode(d,c,l+1);c.state=e.CloseTag,this.stream.write(this.indent(u,c,l)+"</"+u.name+">")}return this.stream.write(this.endline(u,c,l)),c.state=e.None,this.closeNode(u,c,l)},a.prototype.processingInstruction=function(u,c,l){return this.stream.write(a.__super__.processingInstruction.call(this,u,c,l))},a.prototype.raw=function(u,c,l){return this.stream.write(a.__super__.raw.call(this,u,c,l))},a.prototype.text=function(u,c,l){return this.stream.write(a.__super__.text.call(this,u,c,l))},a.prototype.dtdAttList=function(u,c,l){return this.stream.write(a.__super__.dtdAttList.call(this,u,c,l))},a.prototype.dtdElement=function(u,c,l){return this.stream.write(a.__super__.dtdElement.call(this,u,c,l))},a.prototype.dtdEntity=function(u,c,l){return this.stream.write(a.__super__.dtdEntity.call(this,u,c,l))},a.prototype.dtdNotation=function(u,c,l){return this.stream.write(a.__super__.dtdNotation.call(this,u,c,l))},a})(n)}).call(AN)});var FN=v((TN,Vi)=>{(function(){var t,e,r,n,i,s,o,a,u,c;c=In(),a=c.assign,u=c.isFunction,r=ob(),n=fb(),i=SN(),o=Hd(),s=xN(),t=Et(),e=Fc(),Vi.exports.create=function(l,h,d,f){var m,g;if(l==null)throw new Error("Root element needs a name.");return f=a({},h,d,f),m=new n(f),g=m.element(l),f.headless||(m.declaration(f),(f.pubID!=null||f.sysID!=null)&&m.dtd(f)),g},Vi.exports.begin=function(l,h,d){var f;return u(l)&&(f=[l,h],h=f[0],d=f[1],l={}),h?new i(l,h,d):new n(l)},Vi.exports.stringWriter=function(l){return new o(l)},Vi.exports.streamWriter=function(l,h){return new s(l,h)},Vi.exports.implementation=new r,Vi.exports.nodeType=t,Vi.exports.writerState=e}).call(TN)});var IN=v(hb=>{(function(){"use strict";var t,e,r,n,i,s={}.hasOwnProperty;t=FN(),e=Td().defaults,n=function(o){return typeof o=="string"&&(o.indexOf("&")>=0||o.indexOf(">")>=0||o.indexOf("<")>=0)},i=function(o){return"<![CDATA["+r(o)+"]]>"},r=function(o){return o.replace("]]>","]]]]><![CDATA[>")},hb.Builder=(function(){function o(a){var u,c,l;this.options={},c=e["0.2"];for(u in c)s.call(c,u)&&(l=c[u],this.options[u]=l);for(u in a)s.call(a,u)&&(l=a[u],this.options[u]=l)}return o.prototype.buildObject=function(a){var u,c,l,h,d;return u=this.options.attrkey,c=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===e["0.2"].rootName?(d=Object.keys(a)[0],a=a[d]):d=this.options.rootName,l=(function(f){return function(m,g){var b,S,A,p,D,w;if(typeof g!="object")f.options.cdata&&n(g)?m.raw(i(g)):m.txt(g);else if(Array.isArray(g)){for(p in g)if(s.call(g,p)){S=g[p];for(D in S)A=S[D],m=l(m.ele(D),A).up()}}else for(D in g)if(s.call(g,D))if(S=g[D],D===u){if(typeof S=="object")for(b in S)w=S[b],m=m.att(b,w)}else if(D===c)f.options.cdata&&n(S)?m=m.raw(i(S)):m=m.txt(S);else if(Array.isArray(S))for(p in S)s.call(S,p)&&(A=S[p],typeof A=="string"?f.options.cdata&&n(A)?m=m.ele(D).raw(i(A)).up():m=m.ele(D,A).up():m=l(m.ele(D),A).up());else typeof S=="object"?m=l(m.ele(D),S).up():typeof S=="string"&&f.options.cdata&&n(S)?m=m.ele(D).raw(i(S)).up():(S==null&&(S=""),m=m.ele(D,S.toString()).up());return m}})(this),h=t.create(d,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),l(h,a).end(this.options.renderOpts)},o})()}).call(hb)});var PN=v(Vd=>{(function(t){t.parser=function(x,O){return new r(x,O)},t.SAXParser=r,t.SAXStream=c,t.createStream=u,t.MAX_BUFFER_LENGTH=64*1024;var e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(x,O){if(!(this instanceof r))return new r(x,O);var H=this;i(H),H.q=H.c="",H.bufferCheckPosition=t.MAX_BUFFER_LENGTH,H.opt=O||{},H.opt.lowercase=H.opt.lowercase||H.opt.lowercasetags,H.looseCase=H.opt.lowercase?"toLowerCase":"toUpperCase",H.tags=[],H.closed=H.closedRoot=H.sawRoot=!1,H.tag=H.error=null,H.strict=!!x,H.noscript=!!(x||H.opt.noscript),H.state=E.BEGIN,H.strictEntities=H.opt.strictEntities,H.ENTITIES=H.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),H.attribList=[],H.opt.xmlns&&(H.ns=Object.create(m)),H.opt.unquotedAttributeValues===void 0&&(H.opt.unquotedAttributeValues=!x),H.trackPosition=H.opt.position!==!1,H.trackPosition&&(H.position=H.line=H.column=0),k(H,"onready")}Object.create||(Object.create=function(x){function O(){}O.prototype=x;var H=new O;return H}),Object.keys||(Object.keys=function(x){var O=[];for(var H in x)x.hasOwnProperty(H)&&O.push(H);return O});function n(x){for(var O=Math.max(t.MAX_BUFFER_LENGTH,10),H=0,N=0,ne=e.length;N<ne;N++){var z=x[e[N]].length;if(z>O)switch(e[N]){case"textNode":j(x);break;case"cdata":F(x,"oncdata",x.cdata),x.cdata="";break;case"script":F(x,"onscript",x.script),x.script="";break;default:G(x,"Max buffer length exceeded: "+e[N])}H=Math.max(H,z)}var ie=t.MAX_BUFFER_LENGTH-H;x.bufferCheckPosition=ie+x.position}function i(x){for(var O=0,H=e.length;O<H;O++)x[e[O]]=""}function s(x){j(x),x.cdata!==""&&(F(x,"oncdata",x.cdata),x.cdata=""),x.script!==""&&(F(x,"onscript",x.script),x.script="")}r.prototype={end:function(){L(this)},write:ae,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){s(this)}};var o;try{o=require("stream").Stream}catch{o=function(){}}o||(o=function(){});var a=t.EVENTS.filter(function(x){return x!=="error"&&x!=="end"});function u(x,O){return new c(x,O)}function c(x,O){if(!(this instanceof c))return new c(x,O);o.apply(this),this._parser=new r(x,O),this.writable=!0,this.readable=!0;var H=this;this._parser.onend=function(){H.emit("end")},this._parser.onerror=function(N){H.emit("error",N),H._parser.error=null},this._decoder=null,a.forEach(function(N){Object.defineProperty(H,"on"+N,{get:function(){return H._parser["on"+N]},set:function(ne){if(!ne)return H.removeAllListeners(N),H._parser["on"+N]=ne,ne;H.on(N,ne)},enumerable:!0,configurable:!1})})}c.prototype=Object.create(o.prototype,{constructor:{value:c}}),c.prototype.write=function(x){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(x)){if(!this._decoder){var O=require("string_decoder").StringDecoder;this._decoder=new O("utf8")}x=this._decoder.write(x)}return this._parser.write(x.toString()),this.emit("data",x),!0},c.prototype.end=function(x){return x&&x.length&&this.write(x),this._parser.end(),!0},c.prototype.on=function(x,O){var H=this;return!H._parser["on"+x]&&a.indexOf(x)!==-1&&(H._parser["on"+x]=function(){var N=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);N.splice(0,0,x),H.emit.apply(H,N)}),o.prototype.on.call(H,x,O)};var l="[CDATA[",h="DOCTYPE",d="http://www.w3.org/XML/1998/namespace",f="http://www.w3.org/2000/xmlns/",m={xml:d,xmlns:f},g=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,b=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,S=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,A=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function p(x){return x===" "||x===`
|
|
186
|
+
`||x==="\r"||x===" "}function D(x){return x==='"'||x==="'"}function w(x){return x===">"||p(x)}function _(x,O){return x.test(O)}function P(x,O){return!_(x,O)}var E=0;t.STATE={BEGIN:E++,BEGIN_WHITESPACE:E++,TEXT:E++,TEXT_ENTITY:E++,OPEN_WAKA:E++,SGML_DECL:E++,SGML_DECL_QUOTED:E++,DOCTYPE:E++,DOCTYPE_QUOTED:E++,DOCTYPE_DTD:E++,DOCTYPE_DTD_QUOTED:E++,COMMENT_STARTING:E++,COMMENT:E++,COMMENT_ENDING:E++,COMMENT_ENDED:E++,CDATA:E++,CDATA_ENDING:E++,CDATA_ENDING_2:E++,PROC_INST:E++,PROC_INST_BODY:E++,PROC_INST_ENDING:E++,OPEN_TAG:E++,OPEN_TAG_SLASH:E++,ATTRIB:E++,ATTRIB_NAME:E++,ATTRIB_NAME_SAW_WHITE:E++,ATTRIB_VALUE:E++,ATTRIB_VALUE_QUOTED:E++,ATTRIB_VALUE_CLOSED:E++,ATTRIB_VALUE_UNQUOTED:E++,ATTRIB_VALUE_ENTITY_Q:E++,ATTRIB_VALUE_ENTITY_U:E++,CLOSE_TAG:E++,CLOSE_TAG_SAW_WHITE:E++,SCRIPT:E++,SCRIPT_ENDING:E++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(x){var O=t.ENTITIES[x],H=typeof O=="number"?String.fromCharCode(O):O;t.ENTITIES[x]=H});for(var R in t.STATE)t.STATE[t.STATE[R]]=R;E=t.STATE;function k(x,O,H){x[O]&&x[O](H)}function F(x,O,H){x.textNode&&j(x),k(x,O,H)}function j(x){x.textNode=U(x.opt,x.textNode),x.textNode&&k(x,"ontext",x.textNode),x.textNode=""}function U(x,O){return x.trim&&(O=O.trim()),x.normalize&&(O=O.replace(/\s+/g," ")),O}function G(x,O){return j(x),x.trackPosition&&(O+=`
|
|
187
187
|
Line: `+x.line+`
|
|
188
188
|
Column: `+x.column+`
|
|
189
189
|
Char: `+x.c),O=new Error(O),x.error=O,k(x,"onerror",O),x}function L(x){return x.sawRoot&&!x.closedRoot&&C(x,"Unclosed root tag"),x.state!==E.BEGIN&&x.state!==E.BEGIN_WHITESPACE&&x.state!==E.TEXT&&G(x,"Unexpected end"),j(x),x.c="",x.closed=!0,k(x,"onend"),r.call(x,x.strict,x.opt),x}function C(x,O){if(typeof x!="object"||!(x instanceof r))throw new Error("bad call to strictFail");x.strict&&G(x,O)}function T(x){x.strict||(x.tagName=x.tagName[x.looseCase]());var O=x.tags[x.tags.length-1]||x,H=x.tag={name:x.tagName,attributes:{}};x.opt.xmlns&&(H.ns=O.ns),x.attribList.length=0,F(x,"onopentagstart",H)}function I(x,O){var H=x.indexOf(":"),N=H<0?["",x]:x.split(":"),ne=N[0],z=N[1];return O&&x==="xmlns"&&(ne="xmlns",z=""),{prefix:ne,local:z}}function $(x){if(x.strict||(x.attribName=x.attribName[x.looseCase]()),x.attribList.indexOf(x.attribName)!==-1||x.tag.attributes.hasOwnProperty(x.attribName)){x.attribName=x.attribValue="";return}if(x.opt.xmlns){var O=I(x.attribName,!0),H=O.prefix,N=O.local;if(H==="xmlns")if(N==="xml"&&x.attribValue!==d)C(x,"xml: prefix must be bound to "+d+`
|
|
190
190
|
Actual: `+x.attribValue);else if(N==="xmlns"&&x.attribValue!==f)C(x,"xmlns: prefix must be bound to "+f+`
|
|
191
191
|
Actual: `+x.attribValue);else{var ne=x.tag,z=x.tags[x.tags.length-1]||x;ne.ns===z.ns&&(ne.ns=Object.create(z.ns)),ne.ns[N]=x.attribValue}x.attribList.push([x.attribName,x.attribValue])}else x.tag.attributes[x.attribName]=x.attribValue,F(x,"onattribute",{name:x.attribName,value:x.attribValue});x.attribName=x.attribValue=""}function M(x,O){if(x.opt.xmlns){var H=x.tag,N=I(x.tagName);H.prefix=N.prefix,H.local=N.local,H.uri=H.ns[N.prefix]||"",H.prefix&&!H.uri&&(C(x,"Unbound namespace prefix: "+JSON.stringify(x.tagName)),H.uri=N.prefix);var ne=x.tags[x.tags.length-1]||x;H.ns&&ne.ns!==H.ns&&Object.keys(H.ns).forEach(function(PE){F(x,"onopennamespace",{prefix:PE,uri:H.ns[PE]})});for(var z=0,ie=x.attribList.length;z<ie;z++){var we=x.attribList[z],xe=we[0],Me=we[1],wt=I(xe,!0),dr=wt.prefix,R6=wt.local,IE=dr===""?"":H.ns[dr]||"",cm={name:xe,value:Me,prefix:dr,local:R6,uri:IE};dr&&dr!=="xmlns"&&!IE&&(C(x,"Unbound namespace prefix: "+JSON.stringify(dr)),cm.uri=dr),x.tag.attributes[xe]=cm,F(x,"onattribute",cm)}x.attribList.length=0}x.tag.isSelfClosing=!!O,x.sawRoot=!0,x.tags.push(x.tag),F(x,"onopentag",x.tag),O||(!x.noscript&&x.tagName.toLowerCase()==="script"?x.state=E.SCRIPT:x.state=E.TEXT,x.tag=null,x.tagName=""),x.attribName=x.attribValue="",x.attribList.length=0}function B(x){if(!x.tagName){C(x,"Weird empty close tag."),x.textNode+="</>",x.state=E.TEXT;return}if(x.script){if(x.tagName!=="script"){x.script+="</"+x.tagName+">",x.tagName="",x.state=E.SCRIPT;return}F(x,"onscript",x.script),x.script=""}var O=x.tags.length,H=x.tagName;x.strict||(H=H[x.looseCase]());for(var N=H;O--;){var ne=x.tags[O];if(ne.name!==N)C(x,"Unexpected close tag");else break}if(O<0){C(x,"Unmatched closing tag: "+x.tagName),x.textNode+="</"+x.tagName+">",x.state=E.TEXT;return}x.tagName=H;for(var z=x.tags.length;z-- >O;){var ie=x.tag=x.tags.pop();x.tagName=x.tag.name,F(x,"onclosetag",x.tagName);var we={};for(var xe in ie.ns)we[xe]=ie.ns[xe];var Me=x.tags[x.tags.length-1]||x;x.opt.xmlns&&ie.ns!==Me.ns&&Object.keys(ie.ns).forEach(function(wt){var dr=ie.ns[wt];F(x,"onclosenamespace",{prefix:wt,uri:dr})})}O===0&&(x.closedRoot=!0),x.tagName=x.attribValue=x.attribName="",x.attribList.length=0,x.state=E.TEXT}function K(x){var O=x.entity,H=O.toLowerCase(),N,ne="";return x.ENTITIES[O]?x.ENTITIES[O]:x.ENTITIES[H]?x.ENTITIES[H]:(O=H,O.charAt(0)==="#"&&(O.charAt(1)==="x"?(O=O.slice(2),N=parseInt(O,16),ne=N.toString(16)):(O=O.slice(1),N=parseInt(O,10),ne=N.toString(10))),O=O.replace(/^0+/,""),isNaN(N)||ne.toLowerCase()!==O||N<0||N>1114111?(C(x,"Invalid character entity"),"&"+x.entity+";"):String.fromCodePoint(N))}function q(x,O){O==="<"?(x.state=E.OPEN_WAKA,x.startTagPosition=x.position):p(O)||(C(x,"Non-whitespace before first tag."),x.textNode=O,x.state=E.TEXT)}function V(x,O){var H="";return O<x.length&&(H=x.charAt(O)),H}function ae(x){var O=this;if(this.error)throw this.error;if(O.closed)return G(O,"Cannot write after close. Assign an onready handler.");if(x===null)return L(O);typeof x=="object"&&(x=x.toString());for(var H=0,N="";N=V(x,H++),O.c=N,!!N;)switch(O.trackPosition&&(O.position++,N===`
|
|
192
192
|
`?(O.line++,O.column=0):O.column++),O.state){case E.BEGIN:if(O.state=E.BEGIN_WHITESPACE,N==="\uFEFF")continue;q(O,N);continue;case E.BEGIN_WHITESPACE:q(O,N);continue;case E.TEXT:if(O.sawRoot&&!O.closedRoot){for(var z=H-1;N&&N!=="<"&&N!=="&";)N=V(x,H++),N&&O.trackPosition&&(O.position++,N===`
|
|
193
|
-
`?(O.line++,O.column=0):O.column++);O.textNode+=x.substring(z,H-1)}N==="<"&&!(O.sawRoot&&O.closedRoot&&!O.strict)?(O.state=E.OPEN_WAKA,O.startTagPosition=O.position):(!p(N)&&(!O.sawRoot||O.closedRoot)&&C(O,"Text data outside of root node."),N==="&"?O.state=E.TEXT_ENTITY:O.textNode+=N);continue;case E.SCRIPT:N==="<"?O.state=E.SCRIPT_ENDING:O.script+=N;continue;case E.SCRIPT_ENDING:N==="/"?O.state=E.CLOSE_TAG:(O.script+="<"+N,O.state=E.SCRIPT);continue;case E.OPEN_WAKA:if(N==="!")O.state=E.SGML_DECL,O.sgmlDecl="";else if(!p(N))if(_(g,N))O.state=E.OPEN_TAG,O.tagName=N;else if(N==="/")O.state=E.CLOSE_TAG,O.tagName="";else if(N==="?")O.state=E.PROC_INST,O.procInstName=O.procInstBody="";else{if(C(O,"Unencoded <"),O.startTagPosition+1<O.position){var ne=O.position-O.startTagPosition;N=new Array(ne).join(" ")+N}O.textNode+="<"+N,O.state=E.TEXT}continue;case E.SGML_DECL:if(O.sgmlDecl+N==="--"){O.state=E.COMMENT,O.comment="",O.sgmlDecl="";continue}O.doctype&&O.doctype!==!0&&O.sgmlDecl?(O.state=E.DOCTYPE_DTD,O.doctype+="<!"+O.sgmlDecl+N,O.sgmlDecl=""):(O.sgmlDecl+N).toUpperCase()===l?(F(O,"onopencdata"),O.state=E.CDATA,O.sgmlDecl="",O.cdata=""):(O.sgmlDecl+N).toUpperCase()===h?(O.state=E.DOCTYPE,(O.doctype||O.sawRoot)&&C(O,"Inappropriately located doctype declaration"),O.doctype="",O.sgmlDecl=""):N===">"?(F(O,"onsgmldeclaration",O.sgmlDecl),O.sgmlDecl="",O.state=E.TEXT):(
|
|
194
|
-
`?(O.line++,O.column=0):O.column++);O.cdata+=x.substring(z,H-1),N==="]"&&(O.state=E.CDATA_ENDING);continue;case E.CDATA_ENDING:N==="]"?O.state=E.CDATA_ENDING_2:(O.cdata+="]"+N,O.state=E.CDATA);continue;case E.CDATA_ENDING_2:N===">"?(O.cdata&&F(O,"oncdata",O.cdata),F(O,"onclosecdata"),O.cdata="",O.state=E.TEXT):N==="]"?O.cdata+="]":(O.cdata+="]]"+N,O.state=E.CDATA);continue;case E.PROC_INST:N==="?"?O.state=E.PROC_INST_ENDING:p(N)?O.state=E.PROC_INST_BODY:O.procInstName+=N;continue;case E.PROC_INST_BODY:if(!O.procInstBody&&p(N))continue;N==="?"?O.state=E.PROC_INST_ENDING:O.procInstBody+=N;continue;case E.PROC_INST_ENDING:N===">"?(F(O,"onprocessinginstruction",{name:O.procInstName,body:O.procInstBody}),O.procInstName=O.procInstBody="",O.state=E.TEXT):(O.procInstBody+="?"+N,O.state=E.PROC_INST_BODY);continue;case E.OPEN_TAG:_(b,N)?O.tagName+=N:(T(O),N===">"?M(O):N==="/"?O.state=E.OPEN_TAG_SLASH:(p(N)||C(O,"Invalid character in tag name"),O.state=E.ATTRIB));continue;case E.OPEN_TAG_SLASH:N===">"?(M(O,!0),B(O)):(C(O,"Forward-slash in opening tag not followed by >"),O.state=E.ATTRIB);continue;case E.ATTRIB:if(p(N))continue;N===">"?M(O):N==="/"?O.state=E.OPEN_TAG_SLASH:_(g,N)?(O.attribName=N,O.attribValue="",O.state=E.ATTRIB_NAME):C(O,"Invalid attribute name");continue;case E.ATTRIB_NAME:N==="="?O.state=E.ATTRIB_VALUE:N===">"?(C(O,"Attribute without value"),O.attribValue=O.attribName,$(O),M(O)):p(N)?O.state=E.ATTRIB_NAME_SAW_WHITE:_(b,N)?O.attribName+=N:C(O,"Invalid attribute name");continue;case E.ATTRIB_NAME_SAW_WHITE:if(N==="=")O.state=E.ATTRIB_VALUE;else{if(p(N))continue;C(O,"Attribute without value"),O.tag.attributes[O.attribName]="",O.attribValue="",F(O,"onattribute",{name:O.attribName,value:""}),O.attribName="",N===">"?M(O):_(g,N)?(O.attribName=N,O.state=E.ATTRIB_NAME):(C(O,"Invalid attribute name"),O.state=E.ATTRIB)}continue;case E.ATTRIB_VALUE:if(p(N))continue;y(N)?(O.q=N,O.state=E.ATTRIB_VALUE_QUOTED):(O.opt.unquotedAttributeValues||G(O,"Unquoted attribute value"),O.state=E.ATTRIB_VALUE_UNQUOTED,O.attribValue=N);continue;case E.ATTRIB_VALUE_QUOTED:if(N!==O.q){N==="&"?O.state=E.ATTRIB_VALUE_ENTITY_Q:O.attribValue+=N;continue}$(O),O.q="",O.state=E.ATTRIB_VALUE_CLOSED;continue;case E.ATTRIB_VALUE_CLOSED:p(N)?O.state=E.ATTRIB:N===">"?M(O):N==="/"?O.state=E.OPEN_TAG_SLASH:_(g,N)?(C(O,"No whitespace between attributes"),O.attribName=N,O.attribValue="",O.state=E.ATTRIB_NAME):C(O,"Invalid attribute name");continue;case E.ATTRIB_VALUE_UNQUOTED:if(!w(N)){N==="&"?O.state=E.ATTRIB_VALUE_ENTITY_U:O.attribValue+=N;continue}$(O),N===">"?M(O):O.state=E.ATTRIB;continue;case E.CLOSE_TAG:if(O.tagName)N===">"?B(O):_(b,N)?O.tagName+=N:O.script?(O.script+="</"+O.tagName,O.tagName="",O.state=E.SCRIPT):(p(N)||C(O,"Invalid tagname in closing tag"),O.state=E.CLOSE_TAG_SAW_WHITE);else{if(p(N))continue;P(g,N)?O.script?(O.script+="</"+N,O.state=E.SCRIPT):C(O,"Invalid tagname in closing tag."):O.tagName=N}continue;case E.CLOSE_TAG_SAW_WHITE:if(p(N))continue;N===">"?B(O):C(O,"Invalid characters in closing tag");continue;case E.TEXT_ENTITY:case E.ATTRIB_VALUE_ENTITY_Q:case E.ATTRIB_VALUE_ENTITY_U:var ie,we;switch(O.state){case E.TEXT_ENTITY:ie=E.TEXT,we="textNode";break;case E.ATTRIB_VALUE_ENTITY_Q:ie=E.ATTRIB_VALUE_QUOTED,we="attribValue";break;case E.ATTRIB_VALUE_ENTITY_U:ie=E.ATTRIB_VALUE_UNQUOTED,we="attribValue";break}if(N===";"){var xe=K(O);O.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(xe)?(O.entity="",O.state=ie,O.write(xe)):(O[we]+=xe,O.entity="",O.state=ie)}else _(O.entity.length?A:S,N)?O.entity+=N:(C(O,"Invalid character in entity name"),O[we]+="&"+O.entity+N,O.entity="",O.state=ie);continue;default:throw new Error(O,"Unknown state: "+O.state)}return O.position>=O.bufferCheckPosition&&n(O),O}String.fromCodePoint||(function(){var x=String.fromCharCode,O=Math.floor,H=function(){var N=16384,ne=[],z,ie,we=-1,xe=arguments.length;if(!xe)return"";for(var Me="";++we<xe;){var wt=Number(arguments[we]);if(!isFinite(wt)||wt<0||wt>1114111||O(wt)!==wt)throw RangeError("Invalid code point: "+wt);wt<=65535?ne.push(wt):(wt-=65536,z=(wt>>10)+55296,ie=wt%1024+56320,ne.push(z,ie)),(we+1===xe||ne.length>N)&&(Me+=x.apply(null,ne),ne.length=0)}return Me};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:H,configurable:!0,writable:!0}):String.fromCodePoint=H})()})(typeof Vd>"u"?Vd.sax={}:Vd)});var kN=v(db=>{(function(){"use strict";db.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}).call(db)});var pb=v(Xs=>{(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),Xs.normalize=function(e){return e.toLowerCase()},Xs.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},Xs.stripPrefix=function(e){return e.replace(t,"")},Xs.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},Xs.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(Xs)});var RN=v(ai=>{(function(){"use strict";var t,e,r,n,i,s,o,a,u,c=function(d,f){return function(){return d.apply(f,arguments)}},l=function(d,f){for(var m in f)h.call(f,m)&&(d[m]=f[m]);function g(){this.constructor=d}return g.prototype=f.prototype,d.prototype=new g,d.__super__=f.prototype,d},h={}.hasOwnProperty;a=PN(),n=require("events"),t=kN(),o=pb(),u=require("timers").setImmediate,e=Td().defaults,i=function(d){return typeof d=="object"&&d!=null&&Object.keys(d).length===0},s=function(d,f,m){var g,b,S;for(g=0,b=d.length;g<b;g++)S=d[g],f=S(f,m);return f},r=function(d,f,m){var g;return g=Object.create(null),g.value=m,g.writable=!0,g.enumerable=!0,g.configurable=!0,Object.defineProperty(d,f,g)},ai.Parser=(function(d){l(f,d);function f(m){this.parseStringPromise=c(this.parseStringPromise,this),this.parseString=c(this.parseString,this),this.reset=c(this.reset,this),this.assignOrPush=c(this.assignOrPush,this),this.processAsync=c(this.processAsync,this);var g,b,S;if(!(this instanceof ai.Parser))return new ai.Parser(m);this.options={},b=e["0.2"];for(g in b)h.call(b,g)&&(S=b[g],this.options[g]=S);for(g in m)h.call(m,g)&&(S=m[g],this.options[g]=S);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(o.normalize)),this.reset()}return f.prototype.processAsync=function(){var m,g;try{return this.remaining.length<=this.options.chunkSize?(m=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(m),this.saxParser.close()):(m=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(m),u(this.processAsync))}catch(b){if(g=b,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(g)}},f.prototype.assignOrPush=function(m,g,b){return g in m?(m[g]instanceof Array||r(m,g,[m[g]]),m[g].push(b)):this.options.explicitArray?r(m,g,[b]):r(m,g,b)},f.prototype.reset=function(){var m,g,b,S;return this.removeAllListeners(),this.saxParser=a.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(function(A){return function(p){if(A.saxParser.resume(),!A.saxParser.errThrown)return A.saxParser.errThrown=!0,A.emit("error",p)}})(this),this.saxParser.onend=(function(A){return function(){if(!A.saxParser.ended)return A.saxParser.ended=!0,A.emit("end",A.resultObject)}})(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,S=[],m=this.options.attrkey,g=this.options.charkey,this.saxParser.onopentag=(function(A){return function(p){var y,w,_,P,E;if(_={},_[g]="",!A.options.ignoreAttrs){E=p.attributes;for(y in E)h.call(E,y)&&(!(m in _)&&!A.options.mergeAttrs&&(_[m]={}),w=A.options.attrValueProcessors?s(A.options.attrValueProcessors,p.attributes[y],y):p.attributes[y],P=A.options.attrNameProcessors?s(A.options.attrNameProcessors,y):y,A.options.mergeAttrs?A.assignOrPush(_,P,w):r(_[m],P,w))}return _["#name"]=A.options.tagNameProcessors?s(A.options.tagNameProcessors,p.name):p.name,A.options.xmlns&&(_[A.options.xmlnskey]={uri:p.uri,local:p.local}),S.push(_)}})(this),this.saxParser.onclosetag=(function(A){return function(){var p,y,w,_,P,E,R,k,F,j;if(E=S.pop(),P=E["#name"],(!A.options.explicitChildren||!A.options.preserveChildrenOrder)&&delete E["#name"],E.cdata===!0&&(p=E.cdata,delete E.cdata),F=S[S.length-1],E[g].match(/^\s*$/)&&!p?(y=E[g],delete E[g]):(A.options.trim&&(E[g]=E[g].trim()),A.options.normalize&&(E[g]=E[g].replace(/\s{2,}/g," ").trim()),E[g]=A.options.valueProcessors?s(A.options.valueProcessors,E[g],P):E[g],Object.keys(E).length===1&&g in E&&!A.EXPLICIT_CHARKEY&&(E=E[g])),i(E)&&(typeof A.options.emptyTag=="function"?E=A.options.emptyTag():E=A.options.emptyTag!==""?A.options.emptyTag:y),A.options.validator!=null&&(j="/"+(function(){var U,G,L;for(L=[],U=0,G=S.length;U<G;U++)_=S[U],L.push(_["#name"]);return L})().concat(P).join("/"),(function(){var U;try{return E=A.options.validator(j,F&&F[P],E)}catch(G){return U=G,A.emit("error",U)}})()),A.options.explicitChildren&&!A.options.mergeAttrs&&typeof E=="object"){if(!A.options.preserveChildrenOrder)_={},A.options.attrkey in E&&(_[A.options.attrkey]=E[A.options.attrkey],delete E[A.options.attrkey]),!A.options.charsAsChildren&&A.options.charkey in E&&(_[A.options.charkey]=E[A.options.charkey],delete E[A.options.charkey]),Object.getOwnPropertyNames(E).length>0&&(_[A.options.childkey]=E),E=_;else if(F){F[A.options.childkey]=F[A.options.childkey]||[],R={};for(w in E)h.call(E,w)&&r(R,w,E[w]);F[A.options.childkey].push(R),delete E["#name"],Object.keys(E).length===1&&g in E&&!A.EXPLICIT_CHARKEY&&(E=E[g])}}return S.length>0?A.assignOrPush(F,P,E):(A.options.explicitRoot&&(k=E,E={},r(E,P,k)),A.resultObject=E,A.saxParser.ended=!0,A.emit("end",A.resultObject))}})(this),b=(function(A){return function(p){var y,w;if(w=S[S.length-1],w)return w[g]+=p,A.options.explicitChildren&&A.options.preserveChildrenOrder&&A.options.charsAsChildren&&(A.options.includeWhiteChars||p.replace(/\\n/g,"").trim()!=="")&&(w[A.options.childkey]=w[A.options.childkey]||[],y={"#name":"__text__"},y[g]=p,A.options.normalize&&(y[g]=y[g].replace(/\s{2,}/g," ").trim()),w[A.options.childkey].push(y)),w}})(this),this.saxParser.ontext=b,this.saxParser.oncdata=(function(A){return function(p){var y;if(y=b(p),y)return y.cdata=!0}})(this)},f.prototype.parseString=function(m,g){var b;g!=null&&typeof g=="function"&&(this.on("end",function(S){return this.reset(),g(null,S)}),this.on("error",function(S){return this.reset(),g(S)}));try{return m=m.toString(),m.trim()===""?(this.emit("end",null),!0):(m=t.stripBOM(m),this.options.async?(this.remaining=m,u(this.processAsync),this.saxParser):this.saxParser.write(m).close())}catch(S){if(b=S,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw b}else return this.emit("error",b),this.saxParser.errThrown=!0}},f.prototype.parseStringPromise=function(m){return new Promise((function(g){return function(b,S){return g.parseString(m,function(A,p){return A?S(A):b(p)})}})(this))},f})(n),ai.parseString=function(d,f,m){var g,b,S;return m!=null?(typeof m=="function"&&(g=m),typeof f=="object"&&(b=f)):(typeof f=="function"&&(g=f),b={}),S=new ai.Parser(b),S.parseString(d,g)},ai.parseStringPromise=function(d,f){var m,g;return typeof f=="object"&&(m=f),g=new ai.Parser(m),g.parseStringPromise(d)}}).call(ai)});var NN=v(ui=>{(function(){"use strict";var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;e=Td(),t=IN(),r=RN(),n=pb(),ui.defaults=e.defaults,ui.processors=n,ui.ValidationError=(function(o){i(a,o);function a(u){this.message=u}return a})(Error),ui.Builder=t.Builder,ui.Parser=r.Parser,ui.parseString=r.parseString,ui.parseStringPromise=r.parseStringPromise}).call(ui)});var $N=v(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.buildXmlElement=Pn.writeXML=Pn.parseXML=Pn.readXML=void 0;var jre=(fe(),ue(le)),Bre=wa(),Ic=jre.__importDefault(NN());async function Mre(t){var e;try{let r=await(0,Bre.readFile)(t,{encoding:"utf-8"});try{return await Ic.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Pn.readXML=Mre;function qre(t,e){let r=e!==void 0?new Ic.default.Parser({...e}):new Ic.default.Parser,n;return r.parseString(t,(i,s)=>{i||(n=s)}),n}Pn.parseXML=qre;async function Ure(t){return new Promise(e=>{let n=new Ic.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Pn.writeXML=Ure;function Hre(t,e){return new Ic.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Pn.buildXmlElement=Hre});var qN=v(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.getAllElements=Le.getFilePath=Le.getAssets=Le.getJSModules=Le.getPluginType=Le.getPlatformElement=Le.getPluginPlatform=Le.printPlugins=Le.fixName=Le.getDependencies=Le.resolvePlugin=Le.getPlugins=Le.getIncludedPluginPackages=void 0;var Vre=(fe(),ue(le)),zre=wa(),mb=require("path"),Pa=Vre.__importDefault(ba()),Gre=nd(),Kre=yc(),LN=xd(),Wre=$N();function jN(t,e){var r,n,i,s;let{extConfig:o}=t.app;switch(e){case"android":return(n=(r=o.android)===null||r===void 0?void 0:r.includePlugins)!==null&&n!==void 0?n:o.includePlugins;case"ios":return(s=(i=o.ios)===null||i===void 0?void 0:i.includePlugins)!==null&&s!==void 0?s:o.includePlugins}}Le.getIncludedPluginPackages=jN;async function Xre(t,e){var r;let n=(r=jN(t,e))!==null&&r!==void 0?r:MN(t);return(await Promise.all(n.map(async s=>BN(t,s)))).filter(s=>!!s)}Le.getPlugins=Xre;async function BN(t,e){try{let r=(0,LN.resolveNode)(t.app.rootDir,e,"package.json");r||(0,Gre.fatal)(`Unable to find ${Pa.default.strong(`node_modules/${e}`)}.
|
|
193
|
+
`?(O.line++,O.column=0):O.column++);O.textNode+=x.substring(z,H-1)}N==="<"&&!(O.sawRoot&&O.closedRoot&&!O.strict)?(O.state=E.OPEN_WAKA,O.startTagPosition=O.position):(!p(N)&&(!O.sawRoot||O.closedRoot)&&C(O,"Text data outside of root node."),N==="&"?O.state=E.TEXT_ENTITY:O.textNode+=N);continue;case E.SCRIPT:N==="<"?O.state=E.SCRIPT_ENDING:O.script+=N;continue;case E.SCRIPT_ENDING:N==="/"?O.state=E.CLOSE_TAG:(O.script+="<"+N,O.state=E.SCRIPT);continue;case E.OPEN_WAKA:if(N==="!")O.state=E.SGML_DECL,O.sgmlDecl="";else if(!p(N))if(_(g,N))O.state=E.OPEN_TAG,O.tagName=N;else if(N==="/")O.state=E.CLOSE_TAG,O.tagName="";else if(N==="?")O.state=E.PROC_INST,O.procInstName=O.procInstBody="";else{if(C(O,"Unencoded <"),O.startTagPosition+1<O.position){var ne=O.position-O.startTagPosition;N=new Array(ne).join(" ")+N}O.textNode+="<"+N,O.state=E.TEXT}continue;case E.SGML_DECL:if(O.sgmlDecl+N==="--"){O.state=E.COMMENT,O.comment="",O.sgmlDecl="";continue}O.doctype&&O.doctype!==!0&&O.sgmlDecl?(O.state=E.DOCTYPE_DTD,O.doctype+="<!"+O.sgmlDecl+N,O.sgmlDecl=""):(O.sgmlDecl+N).toUpperCase()===l?(F(O,"onopencdata"),O.state=E.CDATA,O.sgmlDecl="",O.cdata=""):(O.sgmlDecl+N).toUpperCase()===h?(O.state=E.DOCTYPE,(O.doctype||O.sawRoot)&&C(O,"Inappropriately located doctype declaration"),O.doctype="",O.sgmlDecl=""):N===">"?(F(O,"onsgmldeclaration",O.sgmlDecl),O.sgmlDecl="",O.state=E.TEXT):(D(N)&&(O.state=E.SGML_DECL_QUOTED),O.sgmlDecl+=N);continue;case E.SGML_DECL_QUOTED:N===O.q&&(O.state=E.SGML_DECL,O.q=""),O.sgmlDecl+=N;continue;case E.DOCTYPE:N===">"?(O.state=E.TEXT,F(O,"ondoctype",O.doctype),O.doctype=!0):(O.doctype+=N,N==="["?O.state=E.DOCTYPE_DTD:D(N)&&(O.state=E.DOCTYPE_QUOTED,O.q=N));continue;case E.DOCTYPE_QUOTED:O.doctype+=N,N===O.q&&(O.q="",O.state=E.DOCTYPE);continue;case E.DOCTYPE_DTD:N==="]"?(O.doctype+=N,O.state=E.DOCTYPE):N==="<"?(O.state=E.OPEN_WAKA,O.startTagPosition=O.position):D(N)?(O.doctype+=N,O.state=E.DOCTYPE_DTD_QUOTED,O.q=N):O.doctype+=N;continue;case E.DOCTYPE_DTD_QUOTED:O.doctype+=N,N===O.q&&(O.state=E.DOCTYPE_DTD,O.q="");continue;case E.COMMENT:N==="-"?O.state=E.COMMENT_ENDING:O.comment+=N;continue;case E.COMMENT_ENDING:N==="-"?(O.state=E.COMMENT_ENDED,O.comment=U(O.opt,O.comment),O.comment&&F(O,"oncomment",O.comment),O.comment=""):(O.comment+="-"+N,O.state=E.COMMENT);continue;case E.COMMENT_ENDED:N!==">"?(C(O,"Malformed comment"),O.comment+="--"+N,O.state=E.COMMENT):O.doctype&&O.doctype!==!0?O.state=E.DOCTYPE_DTD:O.state=E.TEXT;continue;case E.CDATA:for(var z=H-1;N&&N!=="]";)N=V(x,H++),N&&O.trackPosition&&(O.position++,N===`
|
|
194
|
+
`?(O.line++,O.column=0):O.column++);O.cdata+=x.substring(z,H-1),N==="]"&&(O.state=E.CDATA_ENDING);continue;case E.CDATA_ENDING:N==="]"?O.state=E.CDATA_ENDING_2:(O.cdata+="]"+N,O.state=E.CDATA);continue;case E.CDATA_ENDING_2:N===">"?(O.cdata&&F(O,"oncdata",O.cdata),F(O,"onclosecdata"),O.cdata="",O.state=E.TEXT):N==="]"?O.cdata+="]":(O.cdata+="]]"+N,O.state=E.CDATA);continue;case E.PROC_INST:N==="?"?O.state=E.PROC_INST_ENDING:p(N)?O.state=E.PROC_INST_BODY:O.procInstName+=N;continue;case E.PROC_INST_BODY:if(!O.procInstBody&&p(N))continue;N==="?"?O.state=E.PROC_INST_ENDING:O.procInstBody+=N;continue;case E.PROC_INST_ENDING:N===">"?(F(O,"onprocessinginstruction",{name:O.procInstName,body:O.procInstBody}),O.procInstName=O.procInstBody="",O.state=E.TEXT):(O.procInstBody+="?"+N,O.state=E.PROC_INST_BODY);continue;case E.OPEN_TAG:_(b,N)?O.tagName+=N:(T(O),N===">"?M(O):N==="/"?O.state=E.OPEN_TAG_SLASH:(p(N)||C(O,"Invalid character in tag name"),O.state=E.ATTRIB));continue;case E.OPEN_TAG_SLASH:N===">"?(M(O,!0),B(O)):(C(O,"Forward-slash in opening tag not followed by >"),O.state=E.ATTRIB);continue;case E.ATTRIB:if(p(N))continue;N===">"?M(O):N==="/"?O.state=E.OPEN_TAG_SLASH:_(g,N)?(O.attribName=N,O.attribValue="",O.state=E.ATTRIB_NAME):C(O,"Invalid attribute name");continue;case E.ATTRIB_NAME:N==="="?O.state=E.ATTRIB_VALUE:N===">"?(C(O,"Attribute without value"),O.attribValue=O.attribName,$(O),M(O)):p(N)?O.state=E.ATTRIB_NAME_SAW_WHITE:_(b,N)?O.attribName+=N:C(O,"Invalid attribute name");continue;case E.ATTRIB_NAME_SAW_WHITE:if(N==="=")O.state=E.ATTRIB_VALUE;else{if(p(N))continue;C(O,"Attribute without value"),O.tag.attributes[O.attribName]="",O.attribValue="",F(O,"onattribute",{name:O.attribName,value:""}),O.attribName="",N===">"?M(O):_(g,N)?(O.attribName=N,O.state=E.ATTRIB_NAME):(C(O,"Invalid attribute name"),O.state=E.ATTRIB)}continue;case E.ATTRIB_VALUE:if(p(N))continue;D(N)?(O.q=N,O.state=E.ATTRIB_VALUE_QUOTED):(O.opt.unquotedAttributeValues||G(O,"Unquoted attribute value"),O.state=E.ATTRIB_VALUE_UNQUOTED,O.attribValue=N);continue;case E.ATTRIB_VALUE_QUOTED:if(N!==O.q){N==="&"?O.state=E.ATTRIB_VALUE_ENTITY_Q:O.attribValue+=N;continue}$(O),O.q="",O.state=E.ATTRIB_VALUE_CLOSED;continue;case E.ATTRIB_VALUE_CLOSED:p(N)?O.state=E.ATTRIB:N===">"?M(O):N==="/"?O.state=E.OPEN_TAG_SLASH:_(g,N)?(C(O,"No whitespace between attributes"),O.attribName=N,O.attribValue="",O.state=E.ATTRIB_NAME):C(O,"Invalid attribute name");continue;case E.ATTRIB_VALUE_UNQUOTED:if(!w(N)){N==="&"?O.state=E.ATTRIB_VALUE_ENTITY_U:O.attribValue+=N;continue}$(O),N===">"?M(O):O.state=E.ATTRIB;continue;case E.CLOSE_TAG:if(O.tagName)N===">"?B(O):_(b,N)?O.tagName+=N:O.script?(O.script+="</"+O.tagName,O.tagName="",O.state=E.SCRIPT):(p(N)||C(O,"Invalid tagname in closing tag"),O.state=E.CLOSE_TAG_SAW_WHITE);else{if(p(N))continue;P(g,N)?O.script?(O.script+="</"+N,O.state=E.SCRIPT):C(O,"Invalid tagname in closing tag."):O.tagName=N}continue;case E.CLOSE_TAG_SAW_WHITE:if(p(N))continue;N===">"?B(O):C(O,"Invalid characters in closing tag");continue;case E.TEXT_ENTITY:case E.ATTRIB_VALUE_ENTITY_Q:case E.ATTRIB_VALUE_ENTITY_U:var ie,we;switch(O.state){case E.TEXT_ENTITY:ie=E.TEXT,we="textNode";break;case E.ATTRIB_VALUE_ENTITY_Q:ie=E.ATTRIB_VALUE_QUOTED,we="attribValue";break;case E.ATTRIB_VALUE_ENTITY_U:ie=E.ATTRIB_VALUE_UNQUOTED,we="attribValue";break}if(N===";"){var xe=K(O);O.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(xe)?(O.entity="",O.state=ie,O.write(xe)):(O[we]+=xe,O.entity="",O.state=ie)}else _(O.entity.length?A:S,N)?O.entity+=N:(C(O,"Invalid character in entity name"),O[we]+="&"+O.entity+N,O.entity="",O.state=ie);continue;default:throw new Error(O,"Unknown state: "+O.state)}return O.position>=O.bufferCheckPosition&&n(O),O}String.fromCodePoint||(function(){var x=String.fromCharCode,O=Math.floor,H=function(){var N=16384,ne=[],z,ie,we=-1,xe=arguments.length;if(!xe)return"";for(var Me="";++we<xe;){var wt=Number(arguments[we]);if(!isFinite(wt)||wt<0||wt>1114111||O(wt)!==wt)throw RangeError("Invalid code point: "+wt);wt<=65535?ne.push(wt):(wt-=65536,z=(wt>>10)+55296,ie=wt%1024+56320,ne.push(z,ie)),(we+1===xe||ne.length>N)&&(Me+=x.apply(null,ne),ne.length=0)}return Me};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:H,configurable:!0,writable:!0}):String.fromCodePoint=H})()})(typeof Vd>"u"?Vd.sax={}:Vd)});var kN=v(db=>{(function(){"use strict";db.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}).call(db)});var pb=v(Xs=>{(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),Xs.normalize=function(e){return e.toLowerCase()},Xs.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},Xs.stripPrefix=function(e){return e.replace(t,"")},Xs.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},Xs.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(Xs)});var RN=v(ai=>{(function(){"use strict";var t,e,r,n,i,s,o,a,u,c=function(d,f){return function(){return d.apply(f,arguments)}},l=function(d,f){for(var m in f)h.call(f,m)&&(d[m]=f[m]);function g(){this.constructor=d}return g.prototype=f.prototype,d.prototype=new g,d.__super__=f.prototype,d},h={}.hasOwnProperty;a=PN(),n=require("events"),t=kN(),o=pb(),u=require("timers").setImmediate,e=Td().defaults,i=function(d){return typeof d=="object"&&d!=null&&Object.keys(d).length===0},s=function(d,f,m){var g,b,S;for(g=0,b=d.length;g<b;g++)S=d[g],f=S(f,m);return f},r=function(d,f,m){var g;return g=Object.create(null),g.value=m,g.writable=!0,g.enumerable=!0,g.configurable=!0,Object.defineProperty(d,f,g)},ai.Parser=(function(d){l(f,d);function f(m){this.parseStringPromise=c(this.parseStringPromise,this),this.parseString=c(this.parseString,this),this.reset=c(this.reset,this),this.assignOrPush=c(this.assignOrPush,this),this.processAsync=c(this.processAsync,this);var g,b,S;if(!(this instanceof ai.Parser))return new ai.Parser(m);this.options={},b=e["0.2"];for(g in b)h.call(b,g)&&(S=b[g],this.options[g]=S);for(g in m)h.call(m,g)&&(S=m[g],this.options[g]=S);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(o.normalize)),this.reset()}return f.prototype.processAsync=function(){var m,g;try{return this.remaining.length<=this.options.chunkSize?(m=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(m),this.saxParser.close()):(m=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(m),u(this.processAsync))}catch(b){if(g=b,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(g)}},f.prototype.assignOrPush=function(m,g,b){return g in m?(m[g]instanceof Array||r(m,g,[m[g]]),m[g].push(b)):this.options.explicitArray?r(m,g,[b]):r(m,g,b)},f.prototype.reset=function(){var m,g,b,S;return this.removeAllListeners(),this.saxParser=a.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(function(A){return function(p){if(A.saxParser.resume(),!A.saxParser.errThrown)return A.saxParser.errThrown=!0,A.emit("error",p)}})(this),this.saxParser.onend=(function(A){return function(){if(!A.saxParser.ended)return A.saxParser.ended=!0,A.emit("end",A.resultObject)}})(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,S=[],m=this.options.attrkey,g=this.options.charkey,this.saxParser.onopentag=(function(A){return function(p){var D,w,_,P,E;if(_={},_[g]="",!A.options.ignoreAttrs){E=p.attributes;for(D in E)h.call(E,D)&&(!(m in _)&&!A.options.mergeAttrs&&(_[m]={}),w=A.options.attrValueProcessors?s(A.options.attrValueProcessors,p.attributes[D],D):p.attributes[D],P=A.options.attrNameProcessors?s(A.options.attrNameProcessors,D):D,A.options.mergeAttrs?A.assignOrPush(_,P,w):r(_[m],P,w))}return _["#name"]=A.options.tagNameProcessors?s(A.options.tagNameProcessors,p.name):p.name,A.options.xmlns&&(_[A.options.xmlnskey]={uri:p.uri,local:p.local}),S.push(_)}})(this),this.saxParser.onclosetag=(function(A){return function(){var p,D,w,_,P,E,R,k,F,j;if(E=S.pop(),P=E["#name"],(!A.options.explicitChildren||!A.options.preserveChildrenOrder)&&delete E["#name"],E.cdata===!0&&(p=E.cdata,delete E.cdata),F=S[S.length-1],E[g].match(/^\s*$/)&&!p?(D=E[g],delete E[g]):(A.options.trim&&(E[g]=E[g].trim()),A.options.normalize&&(E[g]=E[g].replace(/\s{2,}/g," ").trim()),E[g]=A.options.valueProcessors?s(A.options.valueProcessors,E[g],P):E[g],Object.keys(E).length===1&&g in E&&!A.EXPLICIT_CHARKEY&&(E=E[g])),i(E)&&(typeof A.options.emptyTag=="function"?E=A.options.emptyTag():E=A.options.emptyTag!==""?A.options.emptyTag:D),A.options.validator!=null&&(j="/"+(function(){var U,G,L;for(L=[],U=0,G=S.length;U<G;U++)_=S[U],L.push(_["#name"]);return L})().concat(P).join("/"),(function(){var U;try{return E=A.options.validator(j,F&&F[P],E)}catch(G){return U=G,A.emit("error",U)}})()),A.options.explicitChildren&&!A.options.mergeAttrs&&typeof E=="object"){if(!A.options.preserveChildrenOrder)_={},A.options.attrkey in E&&(_[A.options.attrkey]=E[A.options.attrkey],delete E[A.options.attrkey]),!A.options.charsAsChildren&&A.options.charkey in E&&(_[A.options.charkey]=E[A.options.charkey],delete E[A.options.charkey]),Object.getOwnPropertyNames(E).length>0&&(_[A.options.childkey]=E),E=_;else if(F){F[A.options.childkey]=F[A.options.childkey]||[],R={};for(w in E)h.call(E,w)&&r(R,w,E[w]);F[A.options.childkey].push(R),delete E["#name"],Object.keys(E).length===1&&g in E&&!A.EXPLICIT_CHARKEY&&(E=E[g])}}return S.length>0?A.assignOrPush(F,P,E):(A.options.explicitRoot&&(k=E,E={},r(E,P,k)),A.resultObject=E,A.saxParser.ended=!0,A.emit("end",A.resultObject))}})(this),b=(function(A){return function(p){var D,w;if(w=S[S.length-1],w)return w[g]+=p,A.options.explicitChildren&&A.options.preserveChildrenOrder&&A.options.charsAsChildren&&(A.options.includeWhiteChars||p.replace(/\\n/g,"").trim()!=="")&&(w[A.options.childkey]=w[A.options.childkey]||[],D={"#name":"__text__"},D[g]=p,A.options.normalize&&(D[g]=D[g].replace(/\s{2,}/g," ").trim()),w[A.options.childkey].push(D)),w}})(this),this.saxParser.ontext=b,this.saxParser.oncdata=(function(A){return function(p){var D;if(D=b(p),D)return D.cdata=!0}})(this)},f.prototype.parseString=function(m,g){var b;g!=null&&typeof g=="function"&&(this.on("end",function(S){return this.reset(),g(null,S)}),this.on("error",function(S){return this.reset(),g(S)}));try{return m=m.toString(),m.trim()===""?(this.emit("end",null),!0):(m=t.stripBOM(m),this.options.async?(this.remaining=m,u(this.processAsync),this.saxParser):this.saxParser.write(m).close())}catch(S){if(b=S,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw b}else return this.emit("error",b),this.saxParser.errThrown=!0}},f.prototype.parseStringPromise=function(m){return new Promise((function(g){return function(b,S){return g.parseString(m,function(A,p){return A?S(A):b(p)})}})(this))},f})(n),ai.parseString=function(d,f,m){var g,b,S;return m!=null?(typeof m=="function"&&(g=m),typeof f=="object"&&(b=f)):(typeof f=="function"&&(g=f),b={}),S=new ai.Parser(b),S.parseString(d,g)},ai.parseStringPromise=function(d,f){var m,g;return typeof f=="object"&&(m=f),g=new ai.Parser(m),g.parseStringPromise(d)}}).call(ai)});var NN=v(ui=>{(function(){"use strict";var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;e=Td(),t=IN(),r=RN(),n=pb(),ui.defaults=e.defaults,ui.processors=n,ui.ValidationError=(function(o){i(a,o);function a(u){this.message=u}return a})(Error),ui.Builder=t.Builder,ui.Parser=r.Parser,ui.parseString=r.parseString,ui.parseStringPromise=r.parseStringPromise}).call(ui)});var $N=v(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.buildXmlElement=Pn.writeXML=Pn.parseXML=Pn.readXML=void 0;var jre=(fe(),ue(le)),Bre=wa(),Ic=jre.__importDefault(NN());async function Mre(t){var e;try{let r=await(0,Bre.readFile)(t,{encoding:"utf-8"});try{return await Ic.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Pn.readXML=Mre;function qre(t,e){let r=e!==void 0?new Ic.default.Parser({...e}):new Ic.default.Parser,n;return r.parseString(t,(i,s)=>{i||(n=s)}),n}Pn.parseXML=qre;async function Ure(t){return new Promise(e=>{let n=new Ic.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Pn.writeXML=Ure;function Hre(t,e){return new Ic.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Pn.buildXmlElement=Hre});var qN=v(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.getAllElements=Le.getFilePath=Le.getAssets=Le.getJSModules=Le.getPluginType=Le.getPlatformElement=Le.getPluginPlatform=Le.printPlugins=Le.fixName=Le.getDependencies=Le.resolvePlugin=Le.getPlugins=Le.getIncludedPluginPackages=void 0;var Vre=(fe(),ue(le)),zre=wa(),mb=require("path"),Pa=Vre.__importDefault(ba()),Gre=nd(),Kre=yc(),LN=xd(),Wre=$N();function jN(t,e){var r,n,i,s;let{extConfig:o}=t.app;switch(e){case"android":return(n=(r=o.android)===null||r===void 0?void 0:r.includePlugins)!==null&&n!==void 0?n:o.includePlugins;case"ios":return(s=(i=o.ios)===null||i===void 0?void 0:i.includePlugins)!==null&&s!==void 0?s:o.includePlugins}}Le.getIncludedPluginPackages=jN;async function Xre(t,e){var r;let n=(r=jN(t,e))!==null&&r!==void 0?r:MN(t);return(await Promise.all(n.map(async s=>BN(t,s)))).filter(s=>!!s)}Le.getPlugins=Xre;async function BN(t,e){try{let r=(0,LN.resolveNode)(t.app.rootDir,e,"package.json");r||(0,Gre.fatal)(`Unable to find ${Pa.default.strong(`node_modules/${e}`)}.
|
|
195
195
|
Are you sure ${Pa.default.strong(e)} is installed?`);let n=(0,mb.dirname)(r),i=await(0,zre.readJSON)(r);if(!i)return null;if(i.capacitor)return{id:e,name:gb(e),version:i.version,rootPath:n,repository:i.repository,manifest:i.capacitor};let s=(0,mb.join)(n,"plugin.xml"),o=await(0,Wre.readXML)(s);return{id:e,name:gb(e),version:i.version,rootPath:n,repository:i.repository,xml:o.plugin}}catch{}return null}Le.resolvePlugin=BN;function MN(t){var e,r;return[...Object.keys((e=t.app.package.dependencies)!==null&&e!==void 0?e:{}),...Object.keys((r=t.app.package.devDependencies)!==null&&r!==void 0?r:{})]}Le.getDependencies=MN;function gb(t){return t=t.replace(/\//g,"_").replace(/-/g,"_").replace(/@/g,"").replace(/_\w/g,e=>e[1].toUpperCase()),t.charAt(0).toUpperCase()+t.slice(1)}Le.fixName=gb;function Yre(t,e,r="capacitor"){if(t.length===0)return;let n,i=t.length===1?"":"s";switch(r){case"cordova":n=`Found ${t.length} Cordova plugin${i} for ${Pa.default.strong(e)}:
|
|
196
196
|
`;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${i} for ${Pa.default.strong(e)}, skipped install:
|
|
197
197
|
`;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${i} for ${Pa.default.strong(e)}:
|
|
198
198
|
`;break}n+=t.map(s=>`${s.id}${Pa.default.weak(`@${s.version}`)}`).join(`
|
|
199
|
-
`),Kre.logger.info(n)}Le.printPlugins=Yre;function yb(t,e){return t.xml.platform?t.xml.platform.filter(function(i){return i.$.name===e})[0]:[]}Le.getPluginPlatform=yb;function Jre(t,e,r){let n=yb(t,e);if(n){let i=n[r];if(i)return i}return[]}Le.getPlatformElement=Jre;function Zre(t,e){var r,n,i,s;switch(e){case"ios":return(n=(r=t.ios)===null||r===void 0?void 0:r.type)!==null&&n!==void 0?n:0;case"android":return(s=(i=t.android)===null||i===void 0?void 0:i.type)!==null&&s!==void 0?s:0}return 0}Le.getPluginType=Zre;function Qre(t,e){return Db(t,e,"js-module")}Le.getJSModules=Qre;function ene(t,e){return Db(t,e,"asset")}Le.getAssets=ene;function tne(t,e,r){if(r.startsWith("node_modules")){let n=r.split("/").slice(1);n[0].startsWith("@")&&(n=[n[0]+"/"+n[1],...n.slice(2)]);let i=(0,LN.resolveNode)(t.app.rootDir,...n);if(!i)throw new Error(`Can't resolve module ${n[0]}`);return i}return(0,mb.join)(e.rootPath,r)}Le.getFilePath=tne;function Db(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let i=yb(t,e);return i?.[r]&&(n=n.concat(i[r])),n}Le.getAllElements=Db});var UN=v(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.replace=Lt.move=Lt.splice=Lt.reduce=Lt.map=Lt.filter=Lt.concurrentFilter=Lt.conform=void 0;function rne(t){return typeof t>"u"?[]:Array.isArray(t)?t:[t]}Lt.conform=rne;async function nne(t,e){let r=async i=>[i,await e(i)];return(await Promise.all(t.map(r))).filter(([,i])=>i).map(([i])=>i)}Lt.concurrentFilter=nne;async function ine(t,e){return wb(t,async(n,i,s,o)=>(await e(i,s,o)&&n.push(i),n),[])}Lt.filter=ine;async function sne(t,e){return wb(t,async(n,i,s,o)=>(n.push(await e(i,s,o)),n),[])}Lt.map=sne;async function wb(t,e,r){let i=typeof r>"u"?1:0;if(typeof r>"u"){if(t.length===0)throw new TypeError("Reduce of empty array with no initial value");r=t[0]}let s=r;for(let o=i;o<t.length;o++)s=await e(s,t[o],o,t);return s}Lt.reduce=wb;function zd(t,e,r=t.length-e,...n){let i=[...t];return i.splice(e,r,...n),i}Lt.splice=zd;function one(t,e,r){let n=t[e];return e<0||r<0||e>=t.length||r>=t.length?[...t]:zd(zd(t,e,1),r,0,n)}Lt.move=one;function ane(t,e,r){return e<0||e>t.length?[...t]:zd(t,e,1,r)}Lt.replace=ane});var Pc=v(zi=>{"use strict";var HN=Fe().fromCallback,ar=gt(),une=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof ar[t]=="function");Object.keys(ar).forEach(t=>{t!=="promises"&&(zi[t]=ar[t])});une.forEach(t=>{zi[t]=HN(ar[t])});zi.exists=function(t,e){return typeof e=="function"?ar.exists(t,e):new Promise(r=>ar.exists(t,r))};zi.read=function(t,e,r,n,i,s){return typeof s=="function"?ar.read(t,e,r,n,i,s):new Promise((o,a)=>{ar.read(t,e,r,n,i,(u,c,l)=>{if(u)return a(u);o({bytesRead:c,buffer:l})})})};zi.write=function(t,e,...r){return typeof r[r.length-1]=="function"?ar.write(t,e,...r):new Promise((n,i)=>{ar.write(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffer:a})})})};typeof ar.writev=="function"&&(zi.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?ar.writev(t,e,...r):new Promise((n,i)=>{ar.writev(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffers:a})})})});typeof ar.realpath.native=="function"&&(zi.realpath.native=HN(ar.realpath.native))});var bb=v((
|
|
199
|
+
`),Kre.logger.info(n)}Le.printPlugins=Yre;function yb(t,e){return t.xml.platform?t.xml.platform.filter(function(i){return i.$.name===e})[0]:[]}Le.getPluginPlatform=yb;function Jre(t,e,r){let n=yb(t,e);if(n){let i=n[r];if(i)return i}return[]}Le.getPlatformElement=Jre;function Zre(t,e){var r,n,i,s;switch(e){case"ios":return(n=(r=t.ios)===null||r===void 0?void 0:r.type)!==null&&n!==void 0?n:0;case"android":return(s=(i=t.android)===null||i===void 0?void 0:i.type)!==null&&s!==void 0?s:0}return 0}Le.getPluginType=Zre;function Qre(t,e){return Db(t,e,"js-module")}Le.getJSModules=Qre;function ene(t,e){return Db(t,e,"asset")}Le.getAssets=ene;function tne(t,e,r){if(r.startsWith("node_modules")){let n=r.split("/").slice(1);n[0].startsWith("@")&&(n=[n[0]+"/"+n[1],...n.slice(2)]);let i=(0,LN.resolveNode)(t.app.rootDir,...n);if(!i)throw new Error(`Can't resolve module ${n[0]}`);return i}return(0,mb.join)(e.rootPath,r)}Le.getFilePath=tne;function Db(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let i=yb(t,e);return i?.[r]&&(n=n.concat(i[r])),n}Le.getAllElements=Db});var UN=v(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.replace=Lt.move=Lt.splice=Lt.reduce=Lt.map=Lt.filter=Lt.concurrentFilter=Lt.conform=void 0;function rne(t){return typeof t>"u"?[]:Array.isArray(t)?t:[t]}Lt.conform=rne;async function nne(t,e){let r=async i=>[i,await e(i)];return(await Promise.all(t.map(r))).filter(([,i])=>i).map(([i])=>i)}Lt.concurrentFilter=nne;async function ine(t,e){return wb(t,async(n,i,s,o)=>(await e(i,s,o)&&n.push(i),n),[])}Lt.filter=ine;async function sne(t,e){return wb(t,async(n,i,s,o)=>(n.push(await e(i,s,o)),n),[])}Lt.map=sne;async function wb(t,e,r){let i=typeof r>"u"?1:0;if(typeof r>"u"){if(t.length===0)throw new TypeError("Reduce of empty array with no initial value");r=t[0]}let s=r;for(let o=i;o<t.length;o++)s=await e(s,t[o],o,t);return s}Lt.reduce=wb;function zd(t,e,r=t.length-e,...n){let i=[...t];return i.splice(e,r,...n),i}Lt.splice=zd;function one(t,e,r){let n=t[e];return e<0||r<0||e>=t.length||r>=t.length?[...t]:zd(zd(t,e,1),r,0,n)}Lt.move=one;function ane(t,e,r){return e<0||e>t.length?[...t]:zd(t,e,1,r)}Lt.replace=ane});var Pc=v(zi=>{"use strict";var HN=Fe().fromCallback,ar=gt(),une=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof ar[t]=="function");Object.keys(ar).forEach(t=>{t!=="promises"&&(zi[t]=ar[t])});une.forEach(t=>{zi[t]=HN(ar[t])});zi.exists=function(t,e){return typeof e=="function"?ar.exists(t,e):new Promise(r=>ar.exists(t,r))};zi.read=function(t,e,r,n,i,s){return typeof s=="function"?ar.read(t,e,r,n,i,s):new Promise((o,a)=>{ar.read(t,e,r,n,i,(u,c,l)=>{if(u)return a(u);o({bytesRead:c,buffer:l})})})};zi.write=function(t,e,...r){return typeof r[r.length-1]=="function"?ar.write(t,e,...r):new Promise((n,i)=>{ar.write(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffer:a})})})};typeof ar.writev=="function"&&(zi.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?ar.writev(t,e,...r):new Promise((n,i)=>{ar.writev(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffers:a})})})});typeof ar.realpath.native=="function"&&(zi.realpath.native=HN(ar.realpath.native))});var bb=v((nbe,VN)=>{VN.exports=t=>{let e=process.versions.node.split(".").map(r=>parseInt(r,10));return t=t.split(".").map(r=>parseInt(r,10)),e[0]>t[0]||e[0]===t[0]&&(e[1]>t[1]||e[1]===t[1]&&e[2]>=t[2])}});var XN=v((ibe,vb)=>{"use strict";var ka=Pc(),ci=require("path"),cne=bb(),zN=cne("10.12.0"),GN=t=>{if(process.platform==="win32"&&/[<>:"|?*]/.test(t.replace(ci.parse(t).root,""))){let r=new Error(`Path contains invalid characters: ${t}`);throw r.code="EINVAL",r}},KN=t=>{let e={mode:511};return typeof t=="number"&&(t={mode:t}),{...e,...t}},WN=t=>{let e=new Error(`operation not permitted, mkdir '${t}'`);return e.code="EPERM",e.errno=-4048,e.path=t,e.syscall="mkdir",e};vb.exports.makeDir=async(t,e)=>{if(GN(t),e=KN(e),zN){let n=ci.resolve(t);return ka.mkdir(n,{mode:e.mode,recursive:!0})}let r=async n=>{try{await ka.mkdir(n,e.mode)}catch(i){if(i.code==="EPERM")throw i;if(i.code==="ENOENT"){if(ci.dirname(n)===n)throw WN(n);if(i.message.includes("null bytes"))throw i;return await r(ci.dirname(n)),r(n)}try{if(!(await ka.stat(n)).isDirectory())throw new Error("The path is not a directory")}catch{throw i}}};return r(ci.resolve(t))};vb.exports.makeDirSync=(t,e)=>{if(GN(t),e=KN(e),zN){let n=ci.resolve(t);return ka.mkdirSync(n,{mode:e.mode,recursive:!0})}let r=n=>{try{ka.mkdirSync(n,e.mode)}catch(i){if(i.code==="EPERM")throw i;if(i.code==="ENOENT"){if(ci.dirname(n)===n)throw WN(n);if(i.message.includes("null bytes"))throw i;return r(ci.dirname(n)),r(n)}try{if(!ka.statSync(n).isDirectory())throw new Error("The path is not a directory")}catch{throw i}}};return r(ci.resolve(t))}});var ln=v((sbe,YN)=>{"use strict";var lne=Fe().fromPromise,{makeDir:fne,makeDirSync:Eb}=XN(),_b=lne(fne);YN.exports={mkdirs:_b,mkdirsSync:Eb,mkdirp:_b,mkdirpSync:Eb,ensureDir:_b,ensureDirSync:Eb}});var Cb=v((obe,JN)=>{"use strict";var Ra=gt();function hne(t,e,r,n){Ra.open(t,"r+",(i,s)=>{if(i)return n(i);Ra.futimes(s,e,r,o=>{Ra.close(s,a=>{n&&n(o||a)})})})}function dne(t,e,r){let n=Ra.openSync(t,"r+");return Ra.futimesSync(n,e,r),Ra.closeSync(n)}JN.exports={utimesMillis:hne,utimesMillisSync:dne}});var kc=v((abe,t$)=>{"use strict";var Na=Pc(),Cr=require("path"),pne=require("util"),mne=bb(),Gd=mne("10.5.0"),ZN=t=>Gd?Na.stat(t,{bigint:!0}):Na.stat(t),Sb=t=>Gd?Na.statSync(t,{bigint:!0}):Na.statSync(t);function gne(t,e){return Promise.all([ZN(t),ZN(e).catch(r=>{if(r.code==="ENOENT")return null;throw r})]).then(([r,n])=>({srcStat:r,destStat:n}))}function yne(t,e){let r,n=Sb(t);try{r=Sb(e)}catch(i){if(i.code==="ENOENT")return{srcStat:n,destStat:null};throw i}return{srcStat:n,destStat:r}}function Dne(t,e,r,n){pne.callbackify(gne)(t,e,(i,s)=>{if(i)return n(i);let{srcStat:o,destStat:a}=s;return a&&Kd(o,a)?n(new Error("Source and destination must not be the same.")):o.isDirectory()&&Ab(t,e)?n(new Error(Wd(t,e,r))):n(null,{srcStat:o,destStat:a})})}function wne(t,e,r){let{srcStat:n,destStat:i}=yne(t,e);if(i&&Kd(n,i))throw new Error("Source and destination must not be the same.");if(n.isDirectory()&&Ab(t,e))throw new Error(Wd(t,e,r));return{srcStat:n,destStat:i}}function QN(t,e,r,n,i){let s=Cr.resolve(Cr.dirname(t)),o=Cr.resolve(Cr.dirname(r));if(o===s||o===Cr.parse(o).root)return i();let a=(u,c)=>u?u.code==="ENOENT"?i():i(u):Kd(e,c)?i(new Error(Wd(t,r,n))):QN(t,e,o,n,i);Gd?Na.stat(o,{bigint:!0},a):Na.stat(o,a)}function e$(t,e,r,n){let i=Cr.resolve(Cr.dirname(t)),s=Cr.resolve(Cr.dirname(r));if(s===i||s===Cr.parse(s).root)return;let o;try{o=Sb(s)}catch(a){if(a.code==="ENOENT")return;throw a}if(Kd(e,o))throw new Error(Wd(t,r,n));return e$(t,e,s,n)}function Kd(t,e){return!!(e.ino&&e.dev&&e.ino===t.ino&&e.dev===t.dev&&(Gd||e.ino<Number.MAX_SAFE_INTEGER||e.size===t.size&&e.mode===t.mode&&e.nlink===t.nlink&&e.atimeMs===t.atimeMs&&e.mtimeMs===t.mtimeMs&&e.ctimeMs===t.ctimeMs&&e.birthtimeMs===t.birthtimeMs))}function Ab(t,e){let r=Cr.resolve(t).split(Cr.sep).filter(i=>i),n=Cr.resolve(e).split(Cr.sep).filter(i=>i);return r.reduce((i,s,o)=>i&&n[o]===s,!0)}function Wd(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}t$.exports={checkPaths:Dne,checkPathsSync:wne,checkParentPaths:QN,checkParentPathsSync:e$,isSrcSubdir:Ab}});var o$=v((ube,s$)=>{"use strict";var Kt=gt(),Rc=require("path"),bne=ln().mkdirsSync,vne=Cb().utimesMillisSync,Nc=kc();function Ene(t,e,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
200
200
|
|
|
201
|
-
see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:n,destStat:i}=Nc.checkPathsSync(t,e,"copy");return Nc.checkParentPathsSync(t,n,e,"copy"),_ne(i,t,e,r)}function _ne(t,e,r,n){if(n.filter&&!n.filter(e,r))return;let i=Rc.dirname(r);return Kt.existsSync(i)||bne(i),r$(t,e,r,n)}function r$(t,e,r,n){if(!(n.filter&&!n.filter(e,r)))return Cne(t,e,r,n)}function Cne(t,e,r,n){let s=(n.dereference?Kt.statSync:Kt.lstatSync)(e);if(s.isDirectory())return Ine(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return Sne(s,t,e,r,n);if(s.isSymbolicLink())return Rne(t,e,r,n)}function Sne(t,e,r,n,i){return e?Ane(t,r,n,i):n$(t,r,n,i)}function Ane(t,e,r,n){if(n.overwrite)return Kt.unlinkSync(r),n$(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function n$(t,e,r,n){return Kt.copyFileSync(e,r),n.preserveTimestamps&&One(t.mode,e,r),Ob(r,t.mode)}function One(t,e,r){return xne(t)&&Tne(r,t),Fne(e,r)}function xne(t){return(t&128)===0}function Tne(t,e){return Ob(t,e|128)}function Ob(t,e){return Kt.chmodSync(t,e)}function Fne(t,e){let r=Kt.statSync(t);return vne(e,r.atime,r.mtime)}function Ine(t,e,r,n,i){if(!e)return Pne(t.mode,r,n,i);if(e&&!e.isDirectory())throw new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`);return i$(r,n,i)}function Pne(t,e,r,n){return Kt.mkdirSync(r),i$(e,r,n),Ob(r,t)}function i$(t,e,r){Kt.readdirSync(t).forEach(n=>kne(n,t,e,r))}function kne(t,e,r,n){let i=Rc.join(e,t),s=Rc.join(r,t),{destStat:o}=Nc.checkPathsSync(i,s,"copy");return r$(o,i,s,n)}function Rne(t,e,r,n){let i=Kt.readlinkSync(e);if(n.dereference&&(i=Rc.resolve(process.cwd(),i)),t){let s;try{s=Kt.readlinkSync(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return Kt.symlinkSync(i,r);throw o}if(n.dereference&&(s=Rc.resolve(process.cwd(),s)),Nc.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Kt.statSync(r).isDirectory()&&Nc.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return Nne(i,r)}else return Kt.symlinkSync(i,r)}function Nne(t,e){return Kt.unlinkSync(e),Kt.symlinkSync(t,e)}s$.exports=Ene});var xb=v((
|
|
201
|
+
see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:n,destStat:i}=Nc.checkPathsSync(t,e,"copy");return Nc.checkParentPathsSync(t,n,e,"copy"),_ne(i,t,e,r)}function _ne(t,e,r,n){if(n.filter&&!n.filter(e,r))return;let i=Rc.dirname(r);return Kt.existsSync(i)||bne(i),r$(t,e,r,n)}function r$(t,e,r,n){if(!(n.filter&&!n.filter(e,r)))return Cne(t,e,r,n)}function Cne(t,e,r,n){let s=(n.dereference?Kt.statSync:Kt.lstatSync)(e);if(s.isDirectory())return Ine(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return Sne(s,t,e,r,n);if(s.isSymbolicLink())return Rne(t,e,r,n)}function Sne(t,e,r,n,i){return e?Ane(t,r,n,i):n$(t,r,n,i)}function Ane(t,e,r,n){if(n.overwrite)return Kt.unlinkSync(r),n$(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function n$(t,e,r,n){return Kt.copyFileSync(e,r),n.preserveTimestamps&&One(t.mode,e,r),Ob(r,t.mode)}function One(t,e,r){return xne(t)&&Tne(r,t),Fne(e,r)}function xne(t){return(t&128)===0}function Tne(t,e){return Ob(t,e|128)}function Ob(t,e){return Kt.chmodSync(t,e)}function Fne(t,e){let r=Kt.statSync(t);return vne(e,r.atime,r.mtime)}function Ine(t,e,r,n,i){if(!e)return Pne(t.mode,r,n,i);if(e&&!e.isDirectory())throw new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`);return i$(r,n,i)}function Pne(t,e,r,n){return Kt.mkdirSync(r),i$(e,r,n),Ob(r,t)}function i$(t,e,r){Kt.readdirSync(t).forEach(n=>kne(n,t,e,r))}function kne(t,e,r,n){let i=Rc.join(e,t),s=Rc.join(r,t),{destStat:o}=Nc.checkPathsSync(i,s,"copy");return r$(o,i,s,n)}function Rne(t,e,r,n){let i=Kt.readlinkSync(e);if(n.dereference&&(i=Rc.resolve(process.cwd(),i)),t){let s;try{s=Kt.readlinkSync(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return Kt.symlinkSync(i,r);throw o}if(n.dereference&&(s=Rc.resolve(process.cwd(),s)),Nc.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Kt.statSync(r).isDirectory()&&Nc.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return Nne(i,r)}else return Kt.symlinkSync(i,r)}function Nne(t,e){return Kt.unlinkSync(e),Kt.symlinkSync(t,e)}s$.exports=Ene});var xb=v((cbe,a$)=>{"use strict";a$.exports={copySync:o$()}});var Gi=v((lbe,c$)=>{"use strict";var $ne=Fe().fromPromise,u$=Pc();function Lne(t){return u$.access(t).then(()=>!0).catch(()=>!1)}c$.exports={pathExists:$ne(Lne),pathExistsSync:u$.existsSync}});var D$=v((fbe,y$)=>{"use strict";var Sr=gt(),$c=require("path"),jne=ln().mkdirs,Bne=Gi().pathExists,Mne=Cb().utimesMillis,Lc=kc();function qne(t,e,r,n){typeof r=="function"&&!n?(n=r,r={}):typeof r=="function"&&(r={filter:r}),n=n||function(){},r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
202
202
|
|
|
203
|
-
see https://github.com/jprichardson/node-fs-extra/issues/269`),Lc.checkPaths(t,e,"copy",(i,s)=>{if(i)return n(i);let{srcStat:o,destStat:a}=s;Lc.checkParentPaths(t,o,e,"copy",u=>u?n(u):r.filter?d$(l$,a,t,e,r,n):l$(a,t,e,r,n))})}function l$(t,e,r,n,i){let s=$c.dirname(r);Bne(s,(o,a)=>{if(o)return i(o);if(a)return Tb(t,e,r,n,i);jne(s,u=>u?i(u):Tb(t,e,r,n,i))})}function d$(t,e,r,n,i,s){Promise.resolve(i.filter(r,n)).then(o=>o?t(e,r,n,i,s):s(),o=>s(o))}function Tb(t,e,r,n,i){return n.filter?d$(f$,t,e,r,n,i):f$(t,e,r,n,i)}function f$(t,e,r,n,i){(n.dereference?Sr.stat:Sr.lstat)(e,(o,a)=>{if(o)return i(o);if(a.isDirectory())return Wne(a,t,e,r,n,i);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return Une(a,t,e,r,n,i);if(a.isSymbolicLink())return Jne(t,e,r,n,i)})}function Une(t,e,r,n,i,s){return e?Hne(t,r,n,i,s):p$(t,r,n,i,s)}function Hne(t,e,r,n,i){if(n.overwrite)Sr.unlink(r,s=>s?i(s):p$(t,e,r,n,i));else return n.errorOnExist?i(new Error(`'${r}' already exists`)):i()}function p$(t,e,r,n,i){Sr.copyFile(e,r,s=>s?i(s):n.preserveTimestamps?Vne(t.mode,e,r,i):Xd(r,t.mode,i))}function Vne(t,e,r,n){return zne(t)?Gne(r,t,i=>i?n(i):h$(t,e,r,n)):h$(t,e,r,n)}function zne(t){return(t&128)===0}function Gne(t,e,r){return Xd(t,e|128,r)}function h$(t,e,r,n){Kne(e,r,i=>i?n(i):Xd(r,t,n))}function Xd(t,e,r){return Sr.chmod(t,e,r)}function Kne(t,e,r){Sr.stat(t,(n,i)=>n?r(n):Mne(e,i.atime,i.mtime,r))}function Wne(t,e,r,n,i,s){return e?e&&!e.isDirectory()?s(new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`)):m$(r,n,i,s):Xne(t.mode,r,n,i,s)}function Xne(t,e,r,n,i){Sr.mkdir(r,s=>{if(s)return i(s);m$(e,r,n,o=>o?i(o):Xd(r,t,i))})}function m$(t,e,r,n){Sr.readdir(t,(i,s)=>i?n(i):g$(s,t,e,r,n))}function g$(t,e,r,n,i){let s=t.pop();return s?Yne(t,s,e,r,n,i):i()}function Yne(t,e,r,n,i,s){let o=$c.join(r,e),a=$c.join(n,e);Lc.checkPaths(o,a,"copy",(u,c)=>{if(u)return s(u);let{destStat:l}=c;Tb(l,o,a,i,h=>h?s(h):g$(t,r,n,i,s))})}function Jne(t,e,r,n,i){Sr.readlink(e,(s,o)=>{if(s)return i(s);if(n.dereference&&(o=$c.resolve(process.cwd(),o)),t)Sr.readlink(r,(a,u)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?Sr.symlink(o,r,i):i(a):(n.dereference&&(u=$c.resolve(process.cwd(),u)),Lc.isSrcSubdir(o,u)?i(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${u}'.`)):t.isDirectory()&&Lc.isSrcSubdir(u,o)?i(new Error(`Cannot overwrite '${u}' with '${o}'.`)):Zne(o,r,i)));else return Sr.symlink(o,r,i)})}function Zne(t,e,r){Sr.unlink(e,n=>n?r(n):Sr.symlink(t,e,r))}y$.exports=qne});var Fb=v((fbe,w$)=>{"use strict";var Qne=Fe().fromCallback;w$.exports={copy:Qne(D$())}});var x$=v((hbe,O$)=>{"use strict";var b$=gt(),C$=require("path"),Be=require("assert"),jc=process.platform==="win32";function S$(t){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{t[r]=t[r]||b$[r],r=r+"Sync",t[r]=t[r]||b$[r]}),t.maxBusyTries=t.maxBusyTries||3}function Ib(t,e,r){let n=0;typeof e=="function"&&(r=e,e={}),Be(t,"rimraf: missing path"),Be.strictEqual(typeof t,"string","rimraf: path should be a string"),Be.strictEqual(typeof r,"function","rimraf: callback function required"),Be(e,"rimraf: invalid options argument provided"),Be.strictEqual(typeof e,"object","rimraf: options should be object"),S$(e),v$(t,e,function i(s){if(s){if((s.code==="EBUSY"||s.code==="ENOTEMPTY"||s.code==="EPERM")&&n<e.maxBusyTries){n++;let o=n*100;return setTimeout(()=>v$(t,e,i),o)}s.code==="ENOENT"&&(s=null)}r(s)})}function v$(t,e,r){Be(t),Be(e),Be(typeof r=="function"),e.lstat(t,(n,i)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&jc)return E$(t,e,n,r);if(i&&i.isDirectory())return Yd(t,e,n,r);e.unlink(t,s=>{if(s){if(s.code==="ENOENT")return r(null);if(s.code==="EPERM")return jc?E$(t,e,s,r):Yd(t,e,s,r);if(s.code==="EISDIR")return Yd(t,e,s,r)}return r(s)})})}function E$(t,e,r,n){Be(t),Be(e),Be(typeof n=="function"),e.chmod(t,438,i=>{i?n(i.code==="ENOENT"?null:r):e.stat(t,(s,o)=>{s?n(s.code==="ENOENT"?null:r):o.isDirectory()?Yd(t,e,r,n):e.unlink(t,n)})})}function _$(t,e,r){let n;Be(t),Be(e);try{e.chmodSync(t,438)}catch(i){if(i.code==="ENOENT")return;throw r}try{n=e.statSync(t)}catch(i){if(i.code==="ENOENT")return;throw r}n.isDirectory()?Jd(t,e,r):e.unlinkSync(t)}function Yd(t,e,r,n){Be(t),Be(e),Be(typeof n=="function"),e.rmdir(t,i=>{i&&(i.code==="ENOTEMPTY"||i.code==="EEXIST"||i.code==="EPERM")?eie(t,e,n):i&&i.code==="ENOTDIR"?n(r):n(i)})}function eie(t,e,r){Be(t),Be(e),Be(typeof r=="function"),e.readdir(t,(n,i)=>{if(n)return r(n);let s=i.length,o;if(s===0)return e.rmdir(t,r);i.forEach(a=>{Ib(C$.join(t,a),e,u=>{if(!o){if(u)return r(o=u);--s===0&&e.rmdir(t,r)}})})})}function A$(t,e){let r;e=e||{},S$(e),Be(t,"rimraf: missing path"),Be.strictEqual(typeof t,"string","rimraf: path should be a string"),Be(e,"rimraf: missing options"),Be.strictEqual(typeof e,"object","rimraf: options should be object");try{r=e.lstatSync(t)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&jc&&_$(t,e,n)}try{r&&r.isDirectory()?Jd(t,e,null):e.unlinkSync(t)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return jc?_$(t,e,n):Jd(t,e,n);if(n.code!=="EISDIR")throw n;Jd(t,e,n)}}function Jd(t,e,r){Be(t),Be(e);try{e.rmdirSync(t)}catch(n){if(n.code==="ENOTDIR")throw r;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")tie(t,e);else if(n.code!=="ENOENT")throw n}}function tie(t,e){if(Be(t),Be(e),e.readdirSync(t).forEach(r=>A$(C$.join(t,r),e)),jc){let r=Date.now();do try{return e.rmdirSync(t,e)}catch{}while(Date.now()-r<500)}else return e.rmdirSync(t,e)}O$.exports=Ib;Ib.sync=A$});var Bc=v((dbe,F$)=>{"use strict";var rie=Fe().fromCallback,T$=x$();F$.exports={remove:rie(T$),removeSync:T$.sync}});var j$=v((pbe,L$)=>{"use strict";var nie=Fe().fromCallback,k$=gt(),R$=require("path"),N$=ln(),$$=Bc(),I$=nie(function(e,r){r=r||function(){},k$.readdir(e,(n,i)=>{if(n)return N$.mkdirs(e,r);i=i.map(o=>R$.join(e,o)),s();function s(){let o=i.pop();if(!o)return r();$$.remove(o,a=>{if(a)return r(a);s()})}})});function P$(t){let e;try{e=k$.readdirSync(t)}catch{return N$.mkdirsSync(t)}e.forEach(r=>{r=R$.join(t,r),$$.removeSync(r)})}L$.exports={emptyDirSync:P$,emptydirSync:P$,emptyDir:I$,emptydir:I$}});var U$=v((mbe,q$)=>{"use strict";var iie=Fe().fromCallback,B$=require("path"),Ki=gt(),M$=ln();function sie(t,e){function r(){Ki.writeFile(t,"",n=>{if(n)return e(n);e()})}Ki.stat(t,(n,i)=>{if(!n&&i.isFile())return e();let s=B$.dirname(t);Ki.stat(s,(o,a)=>{if(o)return o.code==="ENOENT"?M$.mkdirs(s,u=>{if(u)return e(u);r()}):e(o);a.isDirectory()?r():Ki.readdir(s,u=>{if(u)return e(u)})})})}function oie(t){let e;try{e=Ki.statSync(t)}catch{}if(e&&e.isFile())return;let r=B$.dirname(t);try{Ki.statSync(r).isDirectory()||Ki.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")M$.mkdirsSync(r);else throw n}Ki.writeFileSync(t,"")}q$.exports={createFile:iie(sie),createFileSync:oie}});var K$=v((gbe,G$)=>{"use strict";var aie=Fe().fromCallback,V$=require("path"),Ys=gt(),z$=ln(),H$=Gi().pathExists;function uie(t,e,r){function n(i,s){Ys.link(i,s,o=>{if(o)return r(o);r(null)})}H$(e,(i,s)=>{if(i)return r(i);if(s)return r(null);Ys.lstat(t,o=>{if(o)return o.message=o.message.replace("lstat","ensureLink"),r(o);let a=V$.dirname(e);H$(a,(u,c)=>{if(u)return r(u);if(c)return n(t,e);z$.mkdirs(a,l=>{if(l)return r(l);n(t,e)})})})})}function cie(t,e){if(Ys.existsSync(e))return;try{Ys.lstatSync(t)}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=V$.dirname(e);return Ys.existsSync(n)||z$.mkdirsSync(n),Ys.linkSync(t,e)}G$.exports={createLink:aie(uie),createLinkSync:cie}});var X$=v((ybe,W$)=>{"use strict";var Wi=require("path"),Mc=gt(),lie=Gi().pathExists;function fie(t,e,r){if(Wi.isAbsolute(t))return Mc.lstat(t,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:t,toDst:t}));{let n=Wi.dirname(e),i=Wi.join(n,t);return lie(i,(s,o)=>s?r(s):o?r(null,{toCwd:i,toDst:t}):Mc.lstat(t,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),r(a)):r(null,{toCwd:t,toDst:Wi.relative(n,t)})))}}function hie(t,e){let r;if(Wi.isAbsolute(t)){if(r=Mc.existsSync(t),!r)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}else{let n=Wi.dirname(e),i=Wi.join(n,t);if(r=Mc.existsSync(i),r)return{toCwd:i,toDst:t};if(r=Mc.existsSync(t),!r)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Wi.relative(n,t)}}}W$.exports={symlinkPaths:fie,symlinkPathsSync:hie}});var Z$=v((Dbe,J$)=>{"use strict";var Y$=gt();function die(t,e,r){if(r=typeof e=="function"?e:r,e=typeof e=="function"?!1:e,e)return r(null,e);Y$.lstat(t,(n,i)=>{if(n)return r(null,"file");e=i&&i.isDirectory()?"dir":"file",r(null,e)})}function pie(t,e){let r;if(e)return e;try{r=Y$.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}J$.exports={symlinkType:die,symlinkTypeSync:pie}});var sL=v((wbe,iL)=>{"use strict";var mie=Fe().fromCallback,eL=require("path"),$a=gt(),tL=ln(),gie=tL.mkdirs,yie=tL.mkdirsSync,rL=X$(),Die=rL.symlinkPaths,wie=rL.symlinkPathsSync,nL=Z$(),bie=nL.symlinkType,vie=nL.symlinkTypeSync,Q$=Gi().pathExists;function Eie(t,e,r,n){n=typeof r=="function"?r:n,r=typeof r=="function"?!1:r,Q$(e,(i,s)=>{if(i)return n(i);if(s)return n(null);Die(t,e,(o,a)=>{if(o)return n(o);t=a.toDst,bie(a.toCwd,r,(u,c)=>{if(u)return n(u);let l=eL.dirname(e);Q$(l,(h,d)=>{if(h)return n(h);if(d)return $a.symlink(t,e,c,n);gie(l,f=>{if(f)return n(f);$a.symlink(t,e,c,n)})})})})})}function _ie(t,e,r){if($a.existsSync(e))return;let i=wie(t,e);t=i.toDst,r=vie(i.toCwd,r);let s=eL.dirname(e);return $a.existsSync(s)||yie(s),$a.symlinkSync(t,e,r)}iL.exports={createSymlink:mie(Eie),createSymlinkSync:_ie}});var aL=v((bbe,oL)=>{"use strict";var Zd=U$(),Qd=K$(),ep=sL();oL.exports={createFile:Zd.createFile,createFileSync:Zd.createFileSync,ensureFile:Zd.createFile,ensureFileSync:Zd.createFileSync,createLink:Qd.createLink,createLinkSync:Qd.createLinkSync,ensureLink:Qd.createLink,ensureLinkSync:Qd.createLinkSync,createSymlink:ep.createSymlink,createSymlinkSync:ep.createSymlinkSync,ensureSymlink:ep.createSymlink,ensureSymlinkSync:ep.createSymlinkSync}});var cL=v((vbe,uL)=>{"use strict";var tp=b0();uL.exports={readJson:tp.readFile,readJsonSync:tp.readFileSync,writeJson:tp.writeFile,writeJsonSync:tp.writeFileSync}});var rp=v((Ebe,hL)=>{"use strict";var Cie=Fe().fromCallback,qc=gt(),lL=require("path"),fL=ln(),Sie=Gi().pathExists;function Aie(t,e,r,n){typeof r=="function"&&(n=r,r="utf8");let i=lL.dirname(t);Sie(i,(s,o)=>{if(s)return n(s);if(o)return qc.writeFile(t,e,r,n);fL.mkdirs(i,a=>{if(a)return n(a);qc.writeFile(t,e,r,n)})})}function Oie(t,...e){let r=lL.dirname(t);if(qc.existsSync(r))return qc.writeFileSync(t,...e);fL.mkdirsSync(r),qc.writeFileSync(t,...e)}hL.exports={outputFile:Cie(Aie),outputFileSync:Oie}});var pL=v((_be,dL)=>{"use strict";var{stringify:xie}=ya(),{outputFile:Tie}=rp();async function Fie(t,e,r={}){let n=xie(e,r);await Tie(t,n,r)}dL.exports=Fie});var gL=v((Cbe,mL)=>{"use strict";var{stringify:Iie}=ya(),{outputFileSync:Pie}=rp();function kie(t,e,r){let n=Iie(e,r);Pie(t,n,r)}mL.exports=kie});var DL=v((Sbe,yL)=>{"use strict";var Rie=Fe().fromPromise,ur=cL();ur.outputJson=Rie(pL());ur.outputJsonSync=gL();ur.outputJSON=ur.outputJson;ur.outputJSONSync=ur.outputJsonSync;ur.writeJSON=ur.writeJson;ur.writeJSONSync=ur.writeJsonSync;ur.readJSON=ur.readJson;ur.readJSONSync=ur.readJsonSync;yL.exports=ur});var CL=v((Abe,_L)=>{"use strict";var vL=gt(),Nie=require("path"),$ie=xb().copySync,EL=Bc().removeSync,Lie=ln().mkdirpSync,wL=kc();function jie(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:i}=wL.checkPathsSync(t,e,"move");return wL.checkParentPathsSync(t,i,e,"move"),Lie(Nie.dirname(e)),Bie(t,e,n)}function Bie(t,e,r){if(r)return EL(e),bL(t,e,r);if(vL.existsSync(e))throw new Error("dest already exists.");return bL(t,e,r)}function bL(t,e,r){try{vL.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return Mie(t,e,r)}}function Mie(t,e,r){return $ie(t,e,{overwrite:r,errorOnExist:!0}),EL(t)}_L.exports=jie});var AL=v((Obe,SL)=>{"use strict";SL.exports={moveSync:CL()}});var IL=v((xbe,FL)=>{"use strict";var qie=gt(),Uie=require("path"),Hie=Fb().copy,TL=Bc().remove,Vie=ln().mkdirp,zie=Gi().pathExists,OL=kc();function Gie(t,e,r,n){typeof r=="function"&&(n=r,r={});let i=r.overwrite||r.clobber||!1;OL.checkPaths(t,e,"move",(s,o)=>{if(s)return n(s);let{srcStat:a}=o;OL.checkParentPaths(t,a,e,"move",u=>{if(u)return n(u);Vie(Uie.dirname(e),c=>c?n(c):Kie(t,e,i,n))})})}function Kie(t,e,r,n){if(r)return TL(e,i=>i?n(i):xL(t,e,r,n));zie(e,(i,s)=>i?n(i):s?n(new Error("dest already exists.")):xL(t,e,r,n))}function xL(t,e,r,n){qie.rename(t,e,i=>i?i.code!=="EXDEV"?n(i):Wie(t,e,r,n):n())}function Wie(t,e,r,n){Hie(t,e,{overwrite:r,errorOnExist:!0},s=>s?n(s):TL(t,n))}FL.exports=Gie});var kL=v((Tbe,PL)=>{"use strict";var Xie=Fe().fromCallback;PL.exports={move:Xie(IL())}});var np=v((Fbe,Pb)=>{"use strict";Pb.exports={...Pc(),...xb(),...Fb(),...j$(),...aL(),...DL(),...ln(),...AL(),...kL(),...rp(),...Gi(),...Bc()};var RL=require("fs");Object.getOwnPropertyDescriptor(RL,"promises")&&Object.defineProperty(Pb.exports,"promises",{get(){return RL.promises}})});var kb=v(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});La.readdir=La.stat=void 0;var NL=np();async function Yie(t){try{return await NL.stat(t)}catch{}}La.stat=Yie;async function Jie(t){try{return await NL.readdir(t)}catch{return[]}}La.readdir=Jie});var qL=v(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.walk=me.Walker=me.compilePaths=me.tmpfilepath=me.findBaseDirectory=me.isExecutableFile=me.pathExecutable=me.pathWritable=me.pathReadable=me.pathExists=me.pathAccessible=me.writeStreamToFile=me.cacheFileChecksum=me.getFileChecksums=me.getFileChecksum=me.fileToString=me.getFileTree=me.readdirp=me.readdirSafe=me.statSafe=void 0;var Zie=(fe(),ue(le)),Gr=np(),Qie=require("os"),li=require("path"),$L=require("stream"),LL=kb();Zie.__exportStar(np(),me);var jL=kb();Object.defineProperty(me,"statSafe",{enumerable:!0,get:function(){return jL.stat}});Object.defineProperty(me,"readdirSafe",{enumerable:!0,get:function(){return jL.readdir}});async function ese(t,{filter:e,onError:r,walkerOptions:n}={}){return new Promise((i,s)=>{let o=[],a=Nb(t,n);e&&(a=a.pipe(new $L.Transform({objectMode:!0,transform(u,c,l){(!e||e(u))&&this.push(u),l()}}))),a.on("error",u=>r?r(u):s(u)).on("data",u=>o.push(u.path)).on("end",()=>i(o))})}me.readdirp=ese;async function tse(t,{onError:e,onFileNode:r=s=>s,onDirectoryNode:n=s=>s,walkerOptions:i}={}){let s=new Map([]),o=u=>{let c=li.dirname(u.path),l=s.get(c);return l&&l.type==="directory"?l:n({path:c,type:"directory",children:[]})},a=(u,c)=>{let l={path:u.path,parent:c};return u.stats.isDirectory()?n({...l,type:"directory",children:[]}):r({...l,type:"file"})};return new Promise((u,c)=>{t=li.resolve(t),Nb(t,i).on("error",h=>e?e(h):c(h)).on("data",h=>{let d=o(h),f=a(h,d);d.children.push(f),s.set(h.path,f),s.set(d.path,d)}).on("end",()=>{let h=s.get(t);if(!h)return c(new Error("No root node found after walking directory structure."));delete h.parent,u(h)})})}me.getFileTree=tse;async function rse(t){try{return await Gr.readFile(t,{encoding:"utf8"})}catch(e){if(e.code==="ENOENT"||e.code==="ENOTDIR")return"";throw e}}me.fileToString=rse;async function Rb(t){let e=await Promise.resolve().then(()=>require("crypto"));return new Promise((r,n)=>{let i=e.createHash("md5"),s=Gr.createReadStream(t);s.on("error",o=>{n(o)}),i.once("readable",()=>{let o=i.read().toString("hex");r(o)}),s.pipe(i)})}me.getFileChecksum=Rb;async function nse(t){return Promise.all([Rb(t),(async()=>{try{return(await Gr.readFile(`${t}.md5`,{encoding:"utf8"})).trim()}catch(e){if(e.code!=="ENOENT")throw e}})()])}me.getFileChecksums=nse;async function ise(t,e){let r=await Rb(t);await Gr.writeFile(`${t}.md5`,r,{encoding:"utf8"})}me.cacheFileChecksum=ise;function sse(t,e){return new Promise((r,n)=>{let i=Gr.createWriteStream(e);t.pipe(i),i.on("error",n),i.on("finish",r)})}me.writeStreamToFile=sse;async function Uc(t,e){try{await Gr.access(t,e)}catch{return!1}return!0}me.pathAccessible=Uc;async function ose(t){return Uc(t,Gr.constants.F_OK)}me.pathExists=ose;async function ase(t){return Uc(t,Gr.constants.R_OK)}me.pathReadable=ase;async function use(t){return Uc(t,Gr.constants.W_OK)}me.pathWritable=use;async function BL(t){return Uc(t,Gr.constants.X_OK)}me.pathExecutable=BL;async function cse(t){let[e,r]=await Promise.all([LL.stat(t),BL(t)]);return!!e&&(e.isFile()||e.isSymbolicLink())&&r}me.isExecutableFile=cse;async function lse(t,e){if(!(!t||!e)){for(let r of ML(t))if((await LL.readdir(r)).includes(e))return r}}me.findBaseDirectory=lse;function fse(t){let e=Math.random().toString(16).substring(2,8);return li.resolve(Qie.tmpdir(),t?`${t}-${e}`:e)}me.tmpfilepath=fse;function ML(t){if(t=li.normalize(t),!li.isAbsolute(t))throw new Error(`${t} is not an absolute path`);let e=li.parse(t);return t===e.root?[t]:t.slice(e.root.length).split(li.sep).map((r,n,i)=>e.root+li.join(...i.slice(0,i.length-n))).concat(e.root)}me.compilePaths=ML;var ip=class extends $L.Readable{constructor(e,r={}){super({objectMode:!0}),this.p=e,this.options=r,this.paths=[this.p]}_read(){let e=this.paths.shift(),{pathFilter:r}=this.options;if(!e){this.push(null);return}Gr.lstat(e,(n,i)=>{if(n){this.emit("error",n);return}let s={path:e,stats:i};i.isDirectory()?Gr.readdir(e,(o,a)=>{if(o){this.emit("error",o);return}let u=a.map(c=>li.join(e,c));r&&(u=u.filter(c=>r(c.substring(this.p.length+1)))),this.paths.push(...u),this.push(s)}):this.push(s)})}};me.Walker=ip;function Nb(t,e={}){return new ip(t,e)}me.walk=Nb});var UL=v(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.AliasedMap=fi.CaseInsensitiveProxyHandler=fi.createCaseInsensitiveObject=void 0;function hse(){return new Proxy({},fi.CaseInsensitiveProxyHandler)}fi.createCaseInsensitiveObject=hse;fi.CaseInsensitiveProxyHandler={has:(t,e)=>sp(e)in t,get:(t,e)=>t[sp(e)],set:(t,e,r)=>(t[sp(e)]=r,!0),deleteProperty:(t,e)=>delete t[sp(e)]};var sp=t=>typeof t=="string"?t.toLowerCase():t,$b=class extends Map{getAliases(){let e=new Map;return[...this.entries()].filter(([,n])=>typeof n=="string"||typeof n=="symbol").forEach(([n,i])=>{let s=e.get(i)||[];s.push(n),e.set(i,s)}),e}resolveAlias(e){let r=this.get(e);return typeof r!="string"&&typeof r!="symbol"?r:this.resolveAlias(r)}keysWithoutAliases(){return[...this.entries()].filter(e=>typeof e[1]!="string"&&typeof e[1]!="symbol").map(([e,r])=>e)}};fi.AliasedMap=$b});var WL=v((Rbe,KL)=>{"use strict";var GL=require("child_process"),HL=GL.spawn,dse=GL.exec;KL.exports=function(t,e,r){if(typeof e=="function"&&r===void 0&&(r=e,e=void 0),t=parseInt(t),Number.isNaN(t)){if(r)return r(new Error("pid must be a number"));throw new Error("pid must be a number")}var n={},i={};switch(n[t]=[],i[t]=1,process.platform){case"win32":dse("taskkill /pid "+t+" /T /F",r);break;case"darwin":Lb(t,n,i,function(s){return HL("pgrep",["-P",s])},function(){VL(n,e,r)});break;default:Lb(t,n,i,function(s){return HL("ps",["-o","pid","--no-headers","--ppid",s])},function(){VL(n,e,r)});break}};function VL(t,e,r){var n={};try{Object.keys(t).forEach(function(i){t[i].forEach(function(s){n[s]||(zL(s,e),n[s]=1)}),n[i]||(zL(i,e),n[i]=1)})}catch(i){if(r)return r(i);throw i}if(r)return r()}function zL(t,e){try{process.kill(parseInt(t,10),e)}catch(r){if(r.code!=="ESRCH")throw r}}function Lb(t,e,r,n,i){var s=n(t),o="";s.stdout.on("data",function(c){var c=c.toString("ascii");o+=c});var a=function(u){if(delete r[t],u!=0){Object.keys(r).length==0&&i();return}o.match(/\d+/g).forEach(function(c){c=parseInt(c,10),e[t].push(c),e[c]=[],r[c]=1,Lb(c,e,r,n,i)})};s.on("close",a)}});var JL=v(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.processExit=Ze.offBeforeExit=Ze.onBeforeExit=Ze.onExit=Ze.sleepForever=Ze.sleepUntil=Ze.sleep=Ze.getPathParts=Ze.createProcessEnv=Ze.killProcessTree=Ze.ERROR_TIMEOUT_REACHED=void 0;var jb=(fe(),ue(le)),pse=UL(),mse=Li(),gse=qh(),yse=jb.__importStar(require("path")),Dse=jb.__importDefault(Ih()),wse=jb.__importDefault(WL()),Js=(0,gse.debug)("ionic:utils-process");Ze.ERROR_TIMEOUT_REACHED=new Error("TIMEOUT_REACHED");function bse(t,e="SIGTERM"){return new Promise((r,n)=>{(0,wse.default)(t,e,i=>{if(i)return Js("error while killing process tree for %d: %O",t,i),n(i);r()})})}Ze.killProcessTree=bse;function vse(...t){return Object.assign(mse.TERMINAL_INFO.windows?(0,pse.createCaseInsensitiveObject)():{},...t)}Ze.createProcessEnv=vse;function Ese(t=process.env.PATH||""){return t.split(yse.delimiter)}Ze.getPathParts=Ese;async function XL(t){return new Promise(e=>{setTimeout(e,t)})}Ze.sleep=XL;async function _se(t,{interval:e=30,timeout:r=1/0}){let n=0;for(;!t();)if(await XL(e),n+=e,n>r)throw Ze.ERROR_TIMEOUT_REACHED}Ze.sleepUntil=_se;async function Cse(){return new Promise(()=>{setInterval(()=>{},1e3)})}Ze.sleepForever=Cse;function Sse(t){(0,Dse.default)(()=>{Js("onExit: process.exit/normal shutdown"),t()})}Ze.onExit=Sse;var op=new Set;function Ase(t){op.add(t)}Ze.onBeforeExit=Ase;function Ose(t){op.delete(t)}Ze.offBeforeExit=Ose;var xse=t=>{let e=!1;return async()=>{e||(await t(),e=!0)}},Hc=t=>xse(async()=>{Js("onBeforeExit handler: %O received",t),Js("onBeforeExit handler: running %O functions",op.size),await Promise.all([...op.values()].map(async e=>{try{await e()}catch(r){Js("onBeforeExit handler: error from function: %O",r)}})),t!=="process.exit"&&(Js("onBeforeExit handler: killing self (exit code %O, signal %O)",process.exitCode?process.exitCode:0,t),process.removeListener(t,YL[t]),process.kill(process.pid,t))}),YL={SIGINT:Hc("SIGINT"),SIGTERM:Hc("SIGTERM"),SIGHUP:Hc("SIGHUP"),SIGBREAK:Hc("SIGBREAK")};for(let[t,e]of Object.entries(YL))process.on(t,e);var Tse=Hc("process.exit");async function Fse(t=0){process.exitCode=t,await Tse(),Js("processExit: exiting (exit code: %O)",process.exitCode),process.exit()}Ze.processExit=Fse});var e3=v(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.growBufferForAppendedData=kn.WritableStreamBuffer=kn.ReadableStreamBuffer=kn.NullStream=void 0;var Ub=require("stream"),Ise=4,ZL=32,QL=16,Bb=class extends Ub.Writable{_write(e,r,n){n()}};kn.NullStream=Bb;var Mb=class extends Ub.Readable{constructor(e){super(e),this._size=0,this._stopped=!1,this.buffer=Buffer.alloc(e&&e.allocSize?e.allocSize:ZL),this.chunkSize=e&&e.chunkSize?e.chunkSize:Ise,this.growSize=e&&e.growSize?e.growSize:QL}get size(){return this._size}get stopped(){return this._stopped}_read(){this._send()}feed(e,r="utf8"){if(this._stopped)throw new Error("ReadableStreamBuffer is stopped. Can no longer feed.");let n=typeof e=="string"?Buffer.byteLength(e):e.length;this.buffer=Hb(this.buffer,this._size,Math.ceil(n/this.growSize)*this.growSize),typeof e=="string"?this.buffer.write(e,this._size,n,r):this.buffer.copy(e,this._size,0),this._size+=n}stop(){this._stopped||(this._stopped=!0,this._size===0&&this.push(null))}_send(){let e=Math.min(this.chunkSize,this._size),r=!1;if(e>0){let n=Buffer.alloc(e);this.buffer.copy(n,0,0,e),r=!this.push(n),this.buffer.copy(this.buffer,0,e,this._size),this._size-=e}this._size===0&&this._stopped&&this.push(null),r||setTimeout(()=>this._send(),1)}};kn.ReadableStreamBuffer=Mb;var qb=class extends Ub.Writable{constructor(e){super(e),this._size=0,this.buffer=Buffer.alloc(e&&e.allocSize?e.allocSize:ZL),this.growSize=e&&e.growSize?e.growSize:QL}get size(){return this._size}_write(e,r,n){this.buffer=Hb(this.buffer,this._size,Math.ceil(e.length/this.growSize)*this.growSize),e.copy(this.buffer,this._size,0),this._size+=e.length,n()}consume(e){e=typeof e=="number"?e:this._size;let r=Buffer.alloc(e);return this.buffer.copy(r,0,0,r.length),this.buffer.copy(this.buffer,0,r.length),this._size-=r.length,r}};kn.WritableStreamBuffer=qb;function Hb(t,e,r){if(t.length-e>=r)return t;let n=Buffer.alloc(t.length+r);return t.copy(n,0,0,e),n}kn.growBufferForAppendedData=Hb});var s3=v((Lbe,i3)=>{i3.exports=n3;n3.sync=kse;var t3=require("fs");function Pse(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function r3(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:Pse(e,r)}function n3(t,e,r){t3.stat(t,function(n,i){r(n,n?!1:r3(i,t,e))})}function kse(t,e){return r3(t3.statSync(t),t,e)}});var l3=v((jbe,c3)=>{c3.exports=a3;a3.sync=Rse;var o3=require("fs");function a3(t,e,r){o3.stat(t,function(n,i){r(n,n?!1:u3(i,e))})}function Rse(t,e){return u3(o3.statSync(t),e)}function u3(t,e){return t.isFile()&&Nse(t,e)}function Nse(t,e){var r=t.mode,n=t.uid,i=t.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),l=a|u,h=r&c||r&u&&i===o||r&a&&n===s||r&l&&s===0;return h}});var h3=v((Mbe,f3)=>{var Bbe=require("fs"),ap;process.platform==="win32"||global.TESTING_WINDOWS?ap=s3():ap=l3();f3.exports=Vb;Vb.sync=$se;function Vb(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){Vb(t,e||{},function(s,o){s?i(s):n(o)})})}ap(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function $se(t,e){try{return ap.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var w3=v((qbe,D3)=>{var ja=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",d3=require("path"),Lse=ja?";":":",p3=h3(),m3=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),g3=(t,e)=>{let r=e.colon||Lse,n=t.match(/\//)||ja&&t.match(/\\/)?[""]:[...ja?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=ja?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=ja?i.split(r):[""];return ja&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:i}},y3=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:s}=g3(t,e),o=[],a=c=>new Promise((l,h)=>{if(c===n.length)return e.all&&o.length?l(o):h(m3(t));let d=n[c],f=/^".*"$/.test(d)?d.slice(1,-1):d,m=d3.join(f,t),g=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;l(u(g,c,0))}),u=(c,l,h)=>new Promise((d,f)=>{if(h===i.length)return d(a(l+1));let m=i[h];p3(c+m,{pathExt:s},(g,b)=>{if(!g&&b)if(e.all)o.push(c+m);else return d(c+m);return d(u(c,l,h+1))})});return r?a(0).then(c=>r(null,c),r):a(0)},jse=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=g3(t,e),s=[];for(let o=0;o<r.length;o++){let a=r[o],u=/^".*"$/.test(a)?a.slice(1,-1):a,c=d3.join(u,t),l=!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+c:c;for(let h=0;h<n.length;h++){let d=l+n[h];try{if(p3.sync(d,{pathExt:i}))if(e.all)s.push(d);else return d}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw m3(t)};D3.exports=y3;y3.sync=jse});var v3=v((Ube,zb)=>{"use strict";var b3=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};zb.exports=b3;zb.exports.default=b3});var S3=v((Hbe,C3)=>{"use strict";var E3=require("path"),Bse=w3(),Mse=v3();function _3(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,s=i&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let o;try{o=Bse.sync(t.command,{path:r[Mse({env:r})],pathExt:e?E3.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return o&&(o=E3.resolve(i?t.options.cwd:"",o)),o}function qse(t){return _3(t)||_3(t,!0)}C3.exports=qse});var A3=v((Vbe,Kb)=>{"use strict";var Gb=/([()\][%!^"`<>&|;, *?])/g;function Use(t){return t=t.replace(Gb,"^$1"),t}function Hse(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(Gb,"^$1"),e&&(t=t.replace(Gb,"^$1")),t}Kb.exports.command=Use;Kb.exports.argument=Hse});var x3=v((zbe,O3)=>{"use strict";O3.exports=/^#!(.*)/});var F3=v((Gbe,T3)=>{"use strict";var Vse=x3();T3.exports=(t="")=>{let e=t.match(Vse);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var P3=v((Kbe,I3)=>{"use strict";var Wb=require("fs"),zse=F3();function Gse(t){let r=Buffer.alloc(150),n;try{n=Wb.openSync(t,"r"),Wb.readSync(n,r,0,150,0),Wb.closeSync(n)}catch{}return zse(r.toString())}I3.exports=Gse});var $3=v((Wbe,N3)=>{"use strict";var Kse=require("path"),k3=S3(),R3=A3(),Wse=P3(),Xse=process.platform==="win32",Yse=/\.(?:com|exe)$/i,Jse=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Zse(t){t.file=k3(t);let e=t.file&&Wse(t.file);return e?(t.args.unshift(t.file),t.command=e,k3(t)):t.file}function Qse(t){if(!Xse)return t;let e=Zse(t),r=!Yse.test(e);if(t.options.forceShell||r){let n=Jse.test(e);t.command=Kse.normalize(t.command),t.command=R3.command(t.command),t.args=t.args.map(s=>R3.argument(s,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function eoe(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Qse(n)}N3.exports=eoe});var B3=v((Xbe,j3)=>{"use strict";var Xb=process.platform==="win32";function Yb(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function toe(t,e){if(!Xb)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let s=L3(i,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function L3(t,e){return Xb&&t===1&&!e.file?Yb(e.original,"spawn"):null}function roe(t,e){return Xb&&t===1&&!e.file?Yb(e.original,"spawnSync"):null}j3.exports={hookChildProcess:toe,verifyENOENT:L3,verifyENOENTSync:roe,notFoundError:Yb}});var U3=v((Ybe,Ba)=>{"use strict";var M3=require("child_process"),Jb=$3(),Zb=B3();function q3(t,e,r){let n=Jb(t,e,r),i=M3.spawn(n.command,n.args,n.options);return Zb.hookChildProcess(i,n),i}function noe(t,e,r){let n=Jb(t,e,r),i=M3.spawnSync(n.command,n.args,n.options);return i.error=i.error||Zb.verifyENOENTSync(i.status,n),i}Ba.exports=q3;Ba.exports.spawn=q3;Ba.exports.sync=noe;Ba.exports._parse=Jb;Ba.exports._enoent=Zb});var X3=v(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.findExecutables=Ie.which=Ie.fork=Ie.spawn=Ie.Subprocess=Ie.SubprocessError=Ie.convertPATH=Ie.expandTildePath=Ie.TILDE_PATH_REGEX=Ie.ERROR_SIGNAL_EXIT=Ie.ERROR_NON_ZERO_EXIT=Ie.ERROR_COMMAND_NOT_FOUND=void 0;var tv=(fe(),ue(le)),H3=UN(),ioe=qL(),Qb=JL(),up=e3(),V3=Li(),soe=require("child_process"),ooe=tv.__importDefault(U3()),aoe=tv.__importStar(require("os")),Qs=tv.__importStar(require("path"));Ie.ERROR_COMMAND_NOT_FOUND="ERR_SUBPROCESS_COMMAND_NOT_FOUND";Ie.ERROR_NON_ZERO_EXIT="ERR_SUBPROCESS_NON_ZERO_EXIT";Ie.ERROR_SIGNAL_EXIT="ERR_SUBPROCESS_SIGNAL_EXIT";Ie.TILDE_PATH_REGEX=/^~($|\/|\\)/;function z3(t){let e=aoe.homedir();return t.replace(Ie.TILDE_PATH_REGEX,`${e}$1`)}Ie.expandTildePath=z3;function G3(t=process.env.PATH||""){return t.split(Qs.delimiter).map(z3).join(Qs.delimiter)}Ie.convertPATH=G3;var Zs=class extends Error{constructor(){super(...arguments),this.name="SubprocessError"}};Ie.SubprocessError=Zs;var ev=class{constructor(e,r,n={}){this.name=e,this.args=r;let i=this.maskArg(e);i!==e&&(this.name=i,this.path=e),this._options=n}get options(){let e=this._options;e.env||(e.env=process.env);let r=(0,Qb.createProcessEnv)(e.env||{},{PATH:G3(typeof e.env.PATH=="string"?e.env.PATH:process.env.PATH)});return{...e,env:r}}async output(){this._options.stdio="pipe";let e=this.run(),r=new up.WritableStreamBuffer,n=new up.WritableStreamBuffer,i=new up.WritableStreamBuffer;e.p.stdout?.pipe(r),e.p.stdout?.pipe(i),e.p.stderr?.pipe(n),e.p.stderr?.pipe(i);try{await e}catch(s){throw r.end(),n.end(),s.output=i.consume().toString(),s}return n.end(),i.end(),r.consume().toString()}async combinedOutput(){this._options.stdio="pipe";let e=this.run(),r=new up.WritableStreamBuffer;e.p.stdout?.pipe(r),e.p.stderr?.pipe(r);try{await e}catch(n){throw n.output=r.consume().toString(),n}return r.consume().toString()}run(){let e=this.spawn(),r=new Promise((n,i)=>{e.on("error",s=>{let o;s.code==="ENOENT"?(o=new Zs("Command not found.",{cause:s}),o.code=Ie.ERROR_COMMAND_NOT_FOUND):o=new Zs("Command error.",{cause:s}),i(o)}),e.on("close",(s,o)=>{let a;if(s===0)return n();if(o)a=new Zs("Signal exit from subprocess."),a.code=Ie.ERROR_SIGNAL_EXIT,a.signal=o;else if(s)a=new Zs("Non-zero exit from subprocess."),a.code=Ie.ERROR_NON_ZERO_EXIT,a.exitCode=s;else return n();i(a)})});return Object.defineProperties(r,{p:{value:e}}),r}spawn(){return K3(this.path?this.path:this.name,this.args,this.options)}bashify({maskArgv0:e=!0,maskArgv1:r=!1,shiftArgv0:n=!1}={}){let i=[this.path?this.path:this.name,...this.args];return n&&i.shift(),i[0]&&e&&(i[0]=this.maskArg(i[0])),i[1]&&r&&(i[1]=this.maskArg(i[1])),i.length>0?i.map(s=>this.bashifyArg(s)).join(" "):""}bashifyArg(e){return e.includes(" ")?`"${e.replace(/\"/g,'\\"')}"`:e}maskArg(e){let r=e.lastIndexOf(Qs.sep);return r>=0?e.substring(r+1):e}};Ie.Subprocess=ev;function K3(t,e=[],r){return(0,ooe.default)(t,[...e],r)}Ie.spawn=K3;function uoe(t,e=[],r={}){return(0,soe.fork)(t,[...e],r)}Ie.fork=uoe;var rv=V3.TERMINAL_INFO.windows?".COM;.EXE;.BAT;.CMD":void 0;async function coe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||rv}={}){if(t.includes(Qs.sep))return t;let n=await W3(t,{PATH:e});if(!n.length){let i=new Error(`${t} cannot be found within PATH`);throw i.code="ENOENT",i}return n[0]}Ie.which=coe;async function loe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||rv}={}){return t.includes(Qs.sep)?[t]:W3(t,{PATH:e})}Ie.findExecutables=loe;async function W3(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||rv}={}){let n=(0,Qb.getPathParts)(e),i;if(V3.TERMINAL_INFO.windows){let s=(0,Qb.getPathParts)(r).map(o=>o.toLowerCase());i=s.includes(Qs.extname(t).toLowerCase())?[t]:s.map(o=>t+o)}else i=[t];return[].concat(...await(0,H3.map)(i,async s=>(0,H3.concurrentFilter)(n.map(o=>Qs.join(o,s)),async o=>(0,ioe.isExecutableFile)(o))))}});var cp=v(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.isInstalled=Xi.getCommandOutput=Xi.runCommand=void 0;var nv=X3();async function Y3(t,e,r={}){let n=new nv.Subprocess(t,e,r);try{return await n.output()}catch(i){throw i instanceof nv.SubprocessError?i.output?i.output:i.cause?`${i.message} ${i.cause.toString()}`:i.code?i.code:"Unknown error":i}}Xi.runCommand=Y3;async function foe(t,e,r={}){try{return(await Y3(t,e,r)).trim()}catch{return null}}Xi.getCommandOutput=foe;async function hoe(t){try{await(0,nv.which)(t)}catch{return!1}return!0}Xi.isInstalled=hoe});var Vc=v((Qbe,J3)=>{"use strict";var doe="2.0.0",poe=Number.MAX_SAFE_INTEGER||9007199254740991,moe=16,goe=250,yoe=["major","premajor","minor","preminor","patch","prepatch","prerelease"];J3.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:moe,MAX_SAFE_BUILD_LENGTH:goe,MAX_SAFE_INTEGER:poe,RELEASE_TYPES:yoe,SEMVER_SPEC_VERSION:doe,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var zc=v((eve,Z3)=>{"use strict";var Doe=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};Z3.exports=Doe});var Ma=v((Rn,Q3)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:iv,MAX_SAFE_BUILD_LENGTH:woe,MAX_LENGTH:boe}=Vc(),voe=zc();Rn=Q3.exports={};var Eoe=Rn.re=[],_oe=Rn.safeRe=[],J=Rn.src=[],Coe=Rn.safeSrc=[],Z=Rn.t={},Soe=0,sv="[a-zA-Z0-9-]",Aoe=[["\\s",1],["\\d",boe],[sv,woe]],Ooe=t=>{for(let[e,r]of Aoe)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},ge=(t,e,r)=>{let n=Ooe(e),i=Soe++;voe(t,i,e),Z[t]=i,J[i]=e,Coe[i]=n,Eoe[i]=new RegExp(e,r?"g":void 0),_oe[i]=new RegExp(n,r?"g":void 0)};ge("NUMERICIDENTIFIER","0|[1-9]\\d*");ge("NUMERICIDENTIFIERLOOSE","\\d+");ge("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${sv}*`);ge("MAINVERSION",`(${J[Z.NUMERICIDENTIFIER]})\\.(${J[Z.NUMERICIDENTIFIER]})\\.(${J[Z.NUMERICIDENTIFIER]})`);ge("MAINVERSIONLOOSE",`(${J[Z.NUMERICIDENTIFIERLOOSE]})\\.(${J[Z.NUMERICIDENTIFIERLOOSE]})\\.(${J[Z.NUMERICIDENTIFIERLOOSE]})`);ge("PRERELEASEIDENTIFIER",`(?:${J[Z.NONNUMERICIDENTIFIER]}|${J[Z.NUMERICIDENTIFIER]})`);ge("PRERELEASEIDENTIFIERLOOSE",`(?:${J[Z.NONNUMERICIDENTIFIER]}|${J[Z.NUMERICIDENTIFIERLOOSE]})`);ge("PRERELEASE",`(?:-(${J[Z.PRERELEASEIDENTIFIER]}(?:\\.${J[Z.PRERELEASEIDENTIFIER]})*))`);ge("PRERELEASELOOSE",`(?:-?(${J[Z.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${J[Z.PRERELEASEIDENTIFIERLOOSE]})*))`);ge("BUILDIDENTIFIER",`${sv}+`);ge("BUILD",`(?:\\+(${J[Z.BUILDIDENTIFIER]}(?:\\.${J[Z.BUILDIDENTIFIER]})*))`);ge("FULLPLAIN",`v?${J[Z.MAINVERSION]}${J[Z.PRERELEASE]}?${J[Z.BUILD]}?`);ge("FULL",`^${J[Z.FULLPLAIN]}$`);ge("LOOSEPLAIN",`[v=\\s]*${J[Z.MAINVERSIONLOOSE]}${J[Z.PRERELEASELOOSE]}?${J[Z.BUILD]}?`);ge("LOOSE",`^${J[Z.LOOSEPLAIN]}$`);ge("GTLT","((?:<|>)?=?)");ge("XRANGEIDENTIFIERLOOSE",`${J[Z.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ge("XRANGEIDENTIFIER",`${J[Z.NUMERICIDENTIFIER]}|x|X|\\*`);ge("XRANGEPLAIN",`[v=\\s]*(${J[Z.XRANGEIDENTIFIER]})(?:\\.(${J[Z.XRANGEIDENTIFIER]})(?:\\.(${J[Z.XRANGEIDENTIFIER]})(?:${J[Z.PRERELEASE]})?${J[Z.BUILD]}?)?)?`);ge("XRANGEPLAINLOOSE",`[v=\\s]*(${J[Z.XRANGEIDENTIFIERLOOSE]})(?:\\.(${J[Z.XRANGEIDENTIFIERLOOSE]})(?:\\.(${J[Z.XRANGEIDENTIFIERLOOSE]})(?:${J[Z.PRERELEASELOOSE]})?${J[Z.BUILD]}?)?)?`);ge("XRANGE",`^${J[Z.GTLT]}\\s*${J[Z.XRANGEPLAIN]}$`);ge("XRANGELOOSE",`^${J[Z.GTLT]}\\s*${J[Z.XRANGEPLAINLOOSE]}$`);ge("COERCEPLAIN",`(^|[^\\d])(\\d{1,${iv}})(?:\\.(\\d{1,${iv}}))?(?:\\.(\\d{1,${iv}}))?`);ge("COERCE",`${J[Z.COERCEPLAIN]}(?:$|[^\\d])`);ge("COERCEFULL",J[Z.COERCEPLAIN]+`(?:${J[Z.PRERELEASE]})?(?:${J[Z.BUILD]})?(?:$|[^\\d])`);ge("COERCERTL",J[Z.COERCE],!0);ge("COERCERTLFULL",J[Z.COERCEFULL],!0);ge("LONETILDE","(?:~>?)");ge("TILDETRIM",`(\\s*)${J[Z.LONETILDE]}\\s+`,!0);Rn.tildeTrimReplace="$1~";ge("TILDE",`^${J[Z.LONETILDE]}${J[Z.XRANGEPLAIN]}$`);ge("TILDELOOSE",`^${J[Z.LONETILDE]}${J[Z.XRANGEPLAINLOOSE]}$`);ge("LONECARET","(?:\\^)");ge("CARETTRIM",`(\\s*)${J[Z.LONECARET]}\\s+`,!0);Rn.caretTrimReplace="$1^";ge("CARET",`^${J[Z.LONECARET]}${J[Z.XRANGEPLAIN]}$`);ge("CARETLOOSE",`^${J[Z.LONECARET]}${J[Z.XRANGEPLAINLOOSE]}$`);ge("COMPARATORLOOSE",`^${J[Z.GTLT]}\\s*(${J[Z.LOOSEPLAIN]})$|^$`);ge("COMPARATOR",`^${J[Z.GTLT]}\\s*(${J[Z.FULLPLAIN]})$|^$`);ge("COMPARATORTRIM",`(\\s*)${J[Z.GTLT]}\\s*(${J[Z.LOOSEPLAIN]}|${J[Z.XRANGEPLAIN]})`,!0);Rn.comparatorTrimReplace="$1$2$3";ge("HYPHENRANGE",`^\\s*(${J[Z.XRANGEPLAIN]})\\s+-\\s+(${J[Z.XRANGEPLAIN]})\\s*$`);ge("HYPHENRANGELOOSE",`^\\s*(${J[Z.XRANGEPLAINLOOSE]})\\s+-\\s+(${J[Z.XRANGEPLAINLOOSE]})\\s*$`);ge("STAR","(<|>)?=?\\s*\\*");ge("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ge("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var lp=v((tve,ej)=>{"use strict";var xoe=Object.freeze({loose:!0}),Toe=Object.freeze({}),Foe=t=>t?typeof t!="object"?xoe:t:Toe;ej.exports=Foe});var ov=v((rve,nj)=>{"use strict";var tj=/^[0-9]+$/,rj=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=tj.test(t),n=tj.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Ioe=(t,e)=>rj(e,t);nj.exports={compareIdentifiers:rj,rcompareIdentifiers:Ioe}});var Wt=v((nve,sj)=>{"use strict";var fp=zc(),{MAX_LENGTH:ij,MAX_SAFE_INTEGER:hp}=Vc(),{safeRe:dp,t:pp}=Ma(),Poe=lp(),{compareIdentifiers:av}=ov(),uv=class t{constructor(e,r){if(r=Poe(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>ij)throw new TypeError(`version is longer than ${ij} characters`);fp("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?dp[pp.LOOSE]:dp[pp.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>hp||this.major<0)throw new TypeError("Invalid major version");if(this.minor>hp||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>hp||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&s<hp)return s}return i}):this.prerelease=[],this.build=n[5]?n[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(e){if(fp("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=e.prerelease[r];if(fp("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return av(n,i)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],i=e.build[r];if(fp("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return av(n,i)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?dp[pp.PRERELEASELOOSE]:dp[pp.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),av(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};sj.exports=uv});var eo=v((ive,aj)=>{"use strict";var oj=Wt(),koe=(t,e,r=!1)=>{if(t instanceof oj)return t;try{return new oj(t,e)}catch(n){if(!r)return null;throw n}};aj.exports=koe});var cj=v((sve,uj)=>{"use strict";var Roe=eo(),Noe=(t,e)=>{let r=Roe(t,e);return r?r.version:null};uj.exports=Noe});var fj=v((ove,lj)=>{"use strict";var $oe=eo(),Loe=(t,e)=>{let r=$oe(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};lj.exports=Loe});var pj=v((ave,dj)=>{"use strict";var hj=Wt(),joe=(t,e,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new hj(t instanceof hj?t.version:t,r).inc(e,n,i).version}catch{return null}};dj.exports=joe});var yj=v((uve,gj)=>{"use strict";var mj=eo(),Boe=(t,e)=>{let r=mj(t,null,!0),n=mj(e,null,!0),i=r.compare(n);if(i===0)return null;let s=i>0,o=s?r:n,a=s?n:r,u=!!o.prerelease.length;if(!!a.prerelease.length&&!u){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let l=u?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};gj.exports=Boe});var wj=v((cve,Dj)=>{"use strict";var Moe=Wt(),qoe=(t,e)=>new Moe(t,e).major;Dj.exports=qoe});var vj=v((lve,bj)=>{"use strict";var Uoe=Wt(),Hoe=(t,e)=>new Uoe(t,e).minor;bj.exports=Hoe});var _j=v((fve,Ej)=>{"use strict";var Voe=Wt(),zoe=(t,e)=>new Voe(t,e).patch;Ej.exports=zoe});var Sj=v((hve,Cj)=>{"use strict";var Goe=eo(),Koe=(t,e)=>{let r=Goe(t,e);return r&&r.prerelease.length?r.prerelease:null};Cj.exports=Koe});var Kr=v((dve,Oj)=>{"use strict";var Aj=Wt(),Woe=(t,e,r)=>new Aj(t,r).compare(new Aj(e,r));Oj.exports=Woe});var Tj=v((pve,xj)=>{"use strict";var Xoe=Kr(),Yoe=(t,e,r)=>Xoe(e,t,r);xj.exports=Yoe});var Ij=v((mve,Fj)=>{"use strict";var Joe=Kr(),Zoe=(t,e)=>Joe(t,e,!0);Fj.exports=Zoe});var mp=v((gve,kj)=>{"use strict";var Pj=Wt(),Qoe=(t,e,r)=>{let n=new Pj(t,r),i=new Pj(e,r);return n.compare(i)||n.compareBuild(i)};kj.exports=Qoe});var Nj=v((yve,Rj)=>{"use strict";var eae=mp(),tae=(t,e)=>t.sort((r,n)=>eae(r,n,e));Rj.exports=tae});var Lj=v((Dve,$j)=>{"use strict";var rae=mp(),nae=(t,e)=>t.sort((r,n)=>rae(n,r,e));$j.exports=nae});var Gc=v((wve,jj)=>{"use strict";var iae=Kr(),sae=(t,e,r)=>iae(t,e,r)>0;jj.exports=sae});var gp=v((bve,Bj)=>{"use strict";var oae=Kr(),aae=(t,e,r)=>oae(t,e,r)<0;Bj.exports=aae});var cv=v((vve,Mj)=>{"use strict";var uae=Kr(),cae=(t,e,r)=>uae(t,e,r)===0;Mj.exports=cae});var lv=v((Eve,qj)=>{"use strict";var lae=Kr(),fae=(t,e,r)=>lae(t,e,r)!==0;qj.exports=fae});var yp=v((_ve,Uj)=>{"use strict";var hae=Kr(),dae=(t,e,r)=>hae(t,e,r)>=0;Uj.exports=dae});var Dp=v((Cve,Hj)=>{"use strict";var pae=Kr(),mae=(t,e,r)=>pae(t,e,r)<=0;Hj.exports=mae});var fv=v((Sve,Vj)=>{"use strict";var gae=cv(),yae=lv(),Dae=Gc(),wae=yp(),bae=gp(),vae=Dp(),Eae=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return gae(t,r,n);case"!=":return yae(t,r,n);case">":return Dae(t,r,n);case">=":return wae(t,r,n);case"<":return bae(t,r,n);case"<=":return vae(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};Vj.exports=Eae});var Gj=v((Ave,zj)=>{"use strict";var _ae=Wt(),Cae=eo(),{safeRe:wp,t:bp}=Ma(),Sae=(t,e)=>{if(t instanceof _ae)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?wp[bp.COERCEFULL]:wp[bp.COERCE]);else{let u=e.includePrerelease?wp[bp.COERCERTLFULL]:wp[bp.COERCERTL],c;for(;(c=u.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||c.index+c[0].length!==r.index+r[0].length)&&(r=c),u.lastIndex=c.index+c[1].length+c[2].length;u.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",s=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Cae(`${n}.${i}.${s}${o}${a}`,e)};zj.exports=Sae});var Wj=v((Ove,Kj)=>{"use strict";var hv=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(e,r)}return this}};Kj.exports=hv});var Wr=v((xve,Zj)=>{"use strict";var Aae=/\s+/g,dv=class t{constructor(e,r){if(r=xae(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof pv)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(Aae," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(i=>!Yj(i[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&Nae(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&kae)|(this.options.loose&&Rae))+":"+e,i=Xj.get(n);if(i)return i;let s=this.options.loose,o=s?cr[Xt.HYPHENRANGELOOSE]:cr[Xt.HYPHENRANGE];e=e.replace(o,zae(this.options.includePrerelease)),Qe("hyphen replace",e),e=e.replace(cr[Xt.COMPARATORTRIM],Fae),Qe("comparator trim",e),e=e.replace(cr[Xt.TILDETRIM],Iae),Qe("tilde trim",e),e=e.replace(cr[Xt.CARETTRIM],Pae),Qe("caret trim",e);let a=e.split(" ").map(h=>$ae(h,this.options)).join(" ").split(/\s+/).map(h=>Vae(h,this.options));s&&(a=a.filter(h=>(Qe("loose invalid filter",h,this.options),!!h.match(cr[Xt.COMPARATORLOOSE])))),Qe("range list",a);let u=new Map,c=a.map(h=>new pv(h,this.options));for(let h of c){if(Yj(h))return[h];u.set(h.value,h)}u.size>1&&u.has("")&&u.delete("");let l=[...u.values()];return Xj.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>Jj(n,r)&&e.set.some(i=>Jj(i,r)&&n.every(s=>i.every(o=>s.intersects(o,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Tae(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Gae(this.set[r],e,this.options))return!0;return!1}};Zj.exports=dv;var Oae=Wj(),Xj=new Oae,xae=lp(),pv=Kc(),Qe=zc(),Tae=Wt(),{safeRe:cr,t:Xt,comparatorTrimReplace:Fae,tildeTrimReplace:Iae,caretTrimReplace:Pae}=Ma(),{FLAG_INCLUDE_PRERELEASE:kae,FLAG_LOOSE:Rae}=Vc(),Yj=t=>t.value==="<0.0.0-0",Nae=t=>t.value==="",Jj=(t,e)=>{let r=!0,n=t.slice(),i=n.pop();for(;r&&n.length;)r=n.every(s=>i.intersects(s,e)),i=n.pop();return r},$ae=(t,e)=>(t=t.replace(cr[Xt.BUILD],""),Qe("comp",t,e),t=Bae(t,e),Qe("caret",t),t=Lae(t,e),Qe("tildes",t),t=qae(t,e),Qe("xrange",t),t=Hae(t,e),Qe("stars",t),t),lr=t=>!t||t.toLowerCase()==="x"||t==="*",Lae=(t,e)=>t.trim().split(/\s+/).map(r=>jae(r,e)).join(" "),jae=(t,e)=>{let r=e.loose?cr[Xt.TILDELOOSE]:cr[Xt.TILDE];return t.replace(r,(n,i,s,o,a)=>{Qe("tilde",t,n,i,s,o,a);let u;return lr(i)?u="":lr(s)?u=`>=${i}.0.0 <${+i+1}.0.0-0`:lr(o)?u=`>=${i}.${s}.0 <${i}.${+s+1}.0-0`:a?(Qe("replaceTilde pr",a),u=`>=${i}.${s}.${o}-${a} <${i}.${+s+1}.0-0`):u=`>=${i}.${s}.${o} <${i}.${+s+1}.0-0`,Qe("tilde return",u),u})},Bae=(t,e)=>t.trim().split(/\s+/).map(r=>Mae(r,e)).join(" "),Mae=(t,e)=>{Qe("caret",t,e);let r=e.loose?cr[Xt.CARETLOOSE]:cr[Xt.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(i,s,o,a,u)=>{Qe("caret",t,i,s,o,a,u);let c;return lr(s)?c="":lr(o)?c=`>=${s}.0.0${n} <${+s+1}.0.0-0`:lr(a)?s==="0"?c=`>=${s}.${o}.0${n} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.0${n} <${+s+1}.0.0-0`:u?(Qe("replaceCaret pr",u),s==="0"?o==="0"?c=`>=${s}.${o}.${a}-${u} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}-${u} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a}-${u} <${+s+1}.0.0-0`):(Qe("no pr"),s==="0"?o==="0"?c=`>=${s}.${o}.${a}${n} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}${n} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a} <${+s+1}.0.0-0`),Qe("caret return",c),c})},qae=(t,e)=>(Qe("replaceXRanges",t,e),t.split(/\s+/).map(r=>Uae(r,e)).join(" ")),Uae=(t,e)=>{t=t.trim();let r=e.loose?cr[Xt.XRANGELOOSE]:cr[Xt.XRANGE];return t.replace(r,(n,i,s,o,a,u)=>{Qe("xRange",t,n,i,s,o,a,u);let c=lr(s),l=c||lr(o),h=l||lr(a),d=h;return i==="="&&d&&(i=""),u=e.includePrerelease?"-0":"",c?i===">"||i==="<"?n="<0.0.0-0":n="*":i&&d?(l&&(o=0),a=0,i===">"?(i=">=",l?(s=+s+1,o=0,a=0):(o=+o+1,a=0)):i==="<="&&(i="<",l?s=+s+1:o=+o+1),i==="<"&&(u="-0"),n=`${i+s}.${o}.${a}${u}`):l?n=`>=${s}.0.0${u} <${+s+1}.0.0-0`:h&&(n=`>=${s}.${o}.0${u} <${s}.${+o+1}.0-0`),Qe("xRange return",n),n})},Hae=(t,e)=>(Qe("replaceStars",t,e),t.trim().replace(cr[Xt.STAR],"")),Vae=(t,e)=>(Qe("replaceGTE0",t,e),t.trim().replace(cr[e.includePrerelease?Xt.GTE0PRE:Xt.GTE0],"")),zae=t=>(e,r,n,i,s,o,a,u,c,l,h,d)=>(lr(n)?r="":lr(i)?r=`>=${n}.0.0${t?"-0":""}`:lr(s)?r=`>=${n}.${i}.0${t?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,lr(c)?u="":lr(l)?u=`<${+c+1}.0.0-0`:lr(h)?u=`<${c}.${+l+1}.0-0`:d?u=`<=${c}.${l}.${h}-${d}`:t?u=`<${c}.${l}.${+h+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),Gae=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(Qe(t[n].semver),t[n].semver!==pv.ANY&&t[n].semver.prerelease.length>0){let i=t[n].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0}});var Kc=v((Tve,iB)=>{"use strict";var Wc=Symbol("SemVer ANY"),yv=class t{static get ANY(){return Wc}constructor(e,r){if(r=Qj(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),gv("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Wc?this.value="":this.value=this.operator+this.semver.version,gv("comp",this)}parse(e){let r=this.options.loose?eB[tB.COMPARATORLOOSE]:eB[tB.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new rB(n[2],this.options.loose):this.semver=Wc}toString(){return this.value}test(e){if(gv("Comparator.test",e,this.options.loose),this.semver===Wc||e===Wc)return!0;if(typeof e=="string")try{e=new rB(e,this.options)}catch{return!1}return mv(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new nB(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new nB(this.value,r).test(e.semver):(r=Qj(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||mv(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||mv(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};iB.exports=yv;var Qj=lp(),{safeRe:eB,t:tB}=Ma(),mv=fv(),gv=zc(),rB=Wt(),nB=Wr()});var Xc=v((Fve,sB)=>{"use strict";var Kae=Wr(),Wae=(t,e,r)=>{try{e=new Kae(e,r)}catch{return!1}return e.test(t)};sB.exports=Wae});var aB=v((Ive,oB)=>{"use strict";var Xae=Wr(),Yae=(t,e)=>new Xae(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));oB.exports=Yae});var cB=v((Pve,uB)=>{"use strict";var Jae=Wt(),Zae=Wr(),Qae=(t,e,r)=>{let n=null,i=null,s=null;try{s=new Zae(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new Jae(n,r))}),n};uB.exports=Qae});var fB=v((kve,lB)=>{"use strict";var eue=Wt(),tue=Wr(),rue=(t,e,r)=>{let n=null,i=null,s=null;try{s=new tue(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new eue(n,r))}),n};lB.exports=rue});var pB=v((Rve,dB)=>{"use strict";var Dv=Wt(),nue=Wr(),hB=Gc(),iue=(t,e)=>{t=new nue(t,e);let r=new Dv("0.0.0");if(t.test(r)||(r=new Dv("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let i=t.set[n],s=null;i.forEach(o=>{let a=new Dv(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||hB(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||hB(r,s))&&(r=s)}return r&&t.test(r)?r:null};dB.exports=iue});var gB=v((Nve,mB)=>{"use strict";var sue=Wr(),oue=(t,e)=>{try{return new sue(t,e).range||"*"}catch{return null}};mB.exports=oue});var vp=v(($ve,bB)=>{"use strict";var aue=Wt(),wB=Kc(),{ANY:uue}=wB,cue=Wr(),lue=Xc(),yB=Gc(),DB=gp(),fue=Dp(),hue=yp(),due=(t,e,r,n)=>{t=new aue(t,n),e=new cue(e,n);let i,s,o,a,u;switch(r){case">":i=yB,s=fue,o=DB,a=">",u=">=";break;case"<":i=DB,s=hue,o=yB,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(lue(t,e,n))return!1;for(let c=0;c<e.set.length;++c){let l=e.set[c],h=null,d=null;if(l.forEach(f=>{f.semver===uue&&(f=new wB(">=0.0.0")),h=h||f,d=d||f,i(f.semver,h.semver,n)?h=f:o(f.semver,d.semver,n)&&(d=f)}),h.operator===a||h.operator===u||(!d.operator||d.operator===a)&&s(t,d.semver))return!1;if(d.operator===u&&o(t,d.semver))return!1}return!0};bB.exports=due});var EB=v((Lve,vB)=>{"use strict";var pue=vp(),mue=(t,e,r)=>pue(t,e,">",r);vB.exports=mue});var CB=v((jve,_B)=>{"use strict";var gue=vp(),yue=(t,e,r)=>gue(t,e,"<",r);_B.exports=yue});var OB=v((Bve,AB)=>{"use strict";var SB=Wr(),Due=(t,e,r)=>(t=new SB(t,r),e=new SB(e,r),t.intersects(e,r));AB.exports=Due});var TB=v((Mve,xB)=>{"use strict";var wue=Xc(),bue=Kr();xB.exports=(t,e,r)=>{let n=[],i=null,s=null,o=t.sort((l,h)=>bue(l,h,r));for(let l of o)wue(l,e,r)?(s=l,i||(i=l)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);let a=[];for(let[l,h]of n)l===h?a.push(l):!h&&l===o[0]?a.push("*"):h?l===o[0]?a.push(`<=${h}`):a.push(`${l} - ${h}`):a.push(`>=${l}`);let u=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return u.length<c.length?u:e}});var NB=v((qve,RB)=>{"use strict";var FB=Wr(),bv=Kc(),{ANY:wv}=bv,Yc=Xc(),vv=Kr(),vue=(t,e,r={})=>{if(t===e)return!0;t=new FB(t,r),e=new FB(e,r);let n=!1;e:for(let i of t.set){for(let s of e.set){let o=_ue(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},Eue=[new bv(">=0.0.0-0")],IB=[new bv(">=0.0.0")],_ue=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===wv){if(e.length===1&&e[0].semver===wv)return!0;r.includePrerelease?t=Eue:t=IB}if(e.length===1&&e[0].semver===wv){if(r.includePrerelease)return!0;e=IB}let n=new Set,i,s;for(let f of t)f.operator===">"||f.operator===">="?i=PB(i,f,r):f.operator==="<"||f.operator==="<="?s=kB(s,f,r):n.add(f.semver);if(n.size>1)return null;let o;if(i&&s){if(o=vv(i.semver,s.semver,r),o>0)return null;if(o===0&&(i.operator!==">="||s.operator!=="<="))return null}for(let f of n){if(i&&!Yc(f,String(i),r)||s&&!Yc(f,String(s),r))return null;for(let m of e)if(!Yc(f,String(m),r))return!1;return!0}let a,u,c,l,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;h&&h.prerelease.length===1&&s.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let f of e){if(l=l||f.operator===">"||f.operator===">=",c=c||f.operator==="<"||f.operator==="<=",i){if(d&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===d.major&&f.semver.minor===d.minor&&f.semver.patch===d.patch&&(d=!1),f.operator===">"||f.operator===">="){if(a=PB(i,f,r),a===f&&a!==i)return!1}else if(i.operator===">="&&!Yc(i.semver,String(f),r))return!1}if(s){if(h&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===h.major&&f.semver.minor===h.minor&&f.semver.patch===h.patch&&(h=!1),f.operator==="<"||f.operator==="<="){if(u=kB(s,f,r),u===f&&u!==s)return!1}else if(s.operator==="<="&&!Yc(s.semver,String(f),r))return!1}if(!f.operator&&(s||i)&&o!==0)return!1}return!(i&&c&&!s&&o!==0||s&&l&&!i&&o!==0||d||h)},PB=(t,e,r)=>{if(!t)return e;let n=vv(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},kB=(t,e,r)=>{if(!t)return e;let n=vv(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};RB.exports=vue});var BB=v((Uve,jB)=>{"use strict";var Ev=Ma(),$B=Vc(),Cue=Wt(),LB=ov(),Sue=eo(),Aue=cj(),Oue=fj(),xue=pj(),Tue=yj(),Fue=wj(),Iue=vj(),Pue=_j(),kue=Sj(),Rue=Kr(),Nue=Tj(),$ue=Ij(),Lue=mp(),jue=Nj(),Bue=Lj(),Mue=Gc(),que=gp(),Uue=cv(),Hue=lv(),Vue=yp(),zue=Dp(),Gue=fv(),Kue=Gj(),Wue=Kc(),Xue=Wr(),Yue=Xc(),Jue=aB(),Zue=cB(),Que=fB(),ece=pB(),tce=gB(),rce=vp(),nce=EB(),ice=CB(),sce=OB(),oce=TB(),ace=NB();jB.exports={parse:Sue,valid:Aue,clean:Oue,inc:xue,diff:Tue,major:Fue,minor:Iue,patch:Pue,prerelease:kue,compare:Rue,rcompare:Nue,compareLoose:$ue,compareBuild:Lue,sort:jue,rsort:Bue,gt:Mue,lt:que,eq:Uue,neq:Hue,gte:Vue,lte:zue,cmp:Gue,coerce:Kue,Comparator:Wue,Range:Xue,satisfies:Yue,toComparators:Jue,maxSatisfying:Zue,minSatisfying:Que,minVersion:ece,validRange:tce,outside:rce,gtr:nce,ltr:ice,intersects:sce,simplifyRange:oce,subset:ace,SemVer:Cue,re:Ev.re,src:Ev.src,tokens:Ev.t,SEMVER_SPEC_VERSION:$B.SEMVER_SPEC_VERSION,RELEASE_TYPES:$B.RELEASE_TYPES,compareIdentifiers:LB.compareIdentifiers,rcompareIdentifiers:LB.rcompareIdentifiers}});var JB=v(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.parseApkNameFromFlavor=Q.checkJDKMajorVersion=Q.resolvePlatform=Q.checkPlatformVersions=Q.getAddedPlatforms=Q.getPlatformTargetName=Q.promptForPlatformTarget=Q.promptForPlatform=Q.isValidEnterprisePlatform=Q.getKnownEnterprisePlatforms=Q.isValidCommunityPlatform=Q.getKnownCommunityPlatforms=Q.isValidPlatform=Q.getKnownPlatforms=Q.selectPlatforms=Q.getProjectPlatformDirectory=Q.getCLIVersion=Q.getCoreVersion=Q.getCapacitorPackageVersion=Q.requireCapacitorPackage=Q.getCapacitorPackage=Q.runTask=Q.runPlatformHook=Q.runHooks=Q.wait=Q.checkAppName=Q.checkAppId=Q.checkAppDir=Q.checkAppConfig=Q.checkCapacitorPlatform=Q.checkPackage=Q.checkWebDir=Q.check=void 0;var Zc=(fe(),ue(le)),MB=Li(),Yi=wa(),to=require("path"),je=Zc.__importDefault(ba()),qa=nd(),UB=yc(),uce=qN(),qB=Ol(),Jc=xd(),cce=cp();async function lce(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
|
|
203
|
+
see https://github.com/jprichardson/node-fs-extra/issues/269`),Lc.checkPaths(t,e,"copy",(i,s)=>{if(i)return n(i);let{srcStat:o,destStat:a}=s;Lc.checkParentPaths(t,o,e,"copy",u=>u?n(u):r.filter?d$(l$,a,t,e,r,n):l$(a,t,e,r,n))})}function l$(t,e,r,n,i){let s=$c.dirname(r);Bne(s,(o,a)=>{if(o)return i(o);if(a)return Tb(t,e,r,n,i);jne(s,u=>u?i(u):Tb(t,e,r,n,i))})}function d$(t,e,r,n,i,s){Promise.resolve(i.filter(r,n)).then(o=>o?t(e,r,n,i,s):s(),o=>s(o))}function Tb(t,e,r,n,i){return n.filter?d$(f$,t,e,r,n,i):f$(t,e,r,n,i)}function f$(t,e,r,n,i){(n.dereference?Sr.stat:Sr.lstat)(e,(o,a)=>{if(o)return i(o);if(a.isDirectory())return Wne(a,t,e,r,n,i);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return Une(a,t,e,r,n,i);if(a.isSymbolicLink())return Jne(t,e,r,n,i)})}function Une(t,e,r,n,i,s){return e?Hne(t,r,n,i,s):p$(t,r,n,i,s)}function Hne(t,e,r,n,i){if(n.overwrite)Sr.unlink(r,s=>s?i(s):p$(t,e,r,n,i));else return n.errorOnExist?i(new Error(`'${r}' already exists`)):i()}function p$(t,e,r,n,i){Sr.copyFile(e,r,s=>s?i(s):n.preserveTimestamps?Vne(t.mode,e,r,i):Xd(r,t.mode,i))}function Vne(t,e,r,n){return zne(t)?Gne(r,t,i=>i?n(i):h$(t,e,r,n)):h$(t,e,r,n)}function zne(t){return(t&128)===0}function Gne(t,e,r){return Xd(t,e|128,r)}function h$(t,e,r,n){Kne(e,r,i=>i?n(i):Xd(r,t,n))}function Xd(t,e,r){return Sr.chmod(t,e,r)}function Kne(t,e,r){Sr.stat(t,(n,i)=>n?r(n):Mne(e,i.atime,i.mtime,r))}function Wne(t,e,r,n,i,s){return e?e&&!e.isDirectory()?s(new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`)):m$(r,n,i,s):Xne(t.mode,r,n,i,s)}function Xne(t,e,r,n,i){Sr.mkdir(r,s=>{if(s)return i(s);m$(e,r,n,o=>o?i(o):Xd(r,t,i))})}function m$(t,e,r,n){Sr.readdir(t,(i,s)=>i?n(i):g$(s,t,e,r,n))}function g$(t,e,r,n,i){let s=t.pop();return s?Yne(t,s,e,r,n,i):i()}function Yne(t,e,r,n,i,s){let o=$c.join(r,e),a=$c.join(n,e);Lc.checkPaths(o,a,"copy",(u,c)=>{if(u)return s(u);let{destStat:l}=c;Tb(l,o,a,i,h=>h?s(h):g$(t,r,n,i,s))})}function Jne(t,e,r,n,i){Sr.readlink(e,(s,o)=>{if(s)return i(s);if(n.dereference&&(o=$c.resolve(process.cwd(),o)),t)Sr.readlink(r,(a,u)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?Sr.symlink(o,r,i):i(a):(n.dereference&&(u=$c.resolve(process.cwd(),u)),Lc.isSrcSubdir(o,u)?i(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${u}'.`)):t.isDirectory()&&Lc.isSrcSubdir(u,o)?i(new Error(`Cannot overwrite '${u}' with '${o}'.`)):Zne(o,r,i)));else return Sr.symlink(o,r,i)})}function Zne(t,e,r){Sr.unlink(e,n=>n?r(n):Sr.symlink(t,e,r))}y$.exports=qne});var Fb=v((hbe,w$)=>{"use strict";var Qne=Fe().fromCallback;w$.exports={copy:Qne(D$())}});var x$=v((dbe,O$)=>{"use strict";var b$=gt(),C$=require("path"),Be=require("assert"),jc=process.platform==="win32";function S$(t){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{t[r]=t[r]||b$[r],r=r+"Sync",t[r]=t[r]||b$[r]}),t.maxBusyTries=t.maxBusyTries||3}function Ib(t,e,r){let n=0;typeof e=="function"&&(r=e,e={}),Be(t,"rimraf: missing path"),Be.strictEqual(typeof t,"string","rimraf: path should be a string"),Be.strictEqual(typeof r,"function","rimraf: callback function required"),Be(e,"rimraf: invalid options argument provided"),Be.strictEqual(typeof e,"object","rimraf: options should be object"),S$(e),v$(t,e,function i(s){if(s){if((s.code==="EBUSY"||s.code==="ENOTEMPTY"||s.code==="EPERM")&&n<e.maxBusyTries){n++;let o=n*100;return setTimeout(()=>v$(t,e,i),o)}s.code==="ENOENT"&&(s=null)}r(s)})}function v$(t,e,r){Be(t),Be(e),Be(typeof r=="function"),e.lstat(t,(n,i)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&jc)return E$(t,e,n,r);if(i&&i.isDirectory())return Yd(t,e,n,r);e.unlink(t,s=>{if(s){if(s.code==="ENOENT")return r(null);if(s.code==="EPERM")return jc?E$(t,e,s,r):Yd(t,e,s,r);if(s.code==="EISDIR")return Yd(t,e,s,r)}return r(s)})})}function E$(t,e,r,n){Be(t),Be(e),Be(typeof n=="function"),e.chmod(t,438,i=>{i?n(i.code==="ENOENT"?null:r):e.stat(t,(s,o)=>{s?n(s.code==="ENOENT"?null:r):o.isDirectory()?Yd(t,e,r,n):e.unlink(t,n)})})}function _$(t,e,r){let n;Be(t),Be(e);try{e.chmodSync(t,438)}catch(i){if(i.code==="ENOENT")return;throw r}try{n=e.statSync(t)}catch(i){if(i.code==="ENOENT")return;throw r}n.isDirectory()?Jd(t,e,r):e.unlinkSync(t)}function Yd(t,e,r,n){Be(t),Be(e),Be(typeof n=="function"),e.rmdir(t,i=>{i&&(i.code==="ENOTEMPTY"||i.code==="EEXIST"||i.code==="EPERM")?eie(t,e,n):i&&i.code==="ENOTDIR"?n(r):n(i)})}function eie(t,e,r){Be(t),Be(e),Be(typeof r=="function"),e.readdir(t,(n,i)=>{if(n)return r(n);let s=i.length,o;if(s===0)return e.rmdir(t,r);i.forEach(a=>{Ib(C$.join(t,a),e,u=>{if(!o){if(u)return r(o=u);--s===0&&e.rmdir(t,r)}})})})}function A$(t,e){let r;e=e||{},S$(e),Be(t,"rimraf: missing path"),Be.strictEqual(typeof t,"string","rimraf: path should be a string"),Be(e,"rimraf: missing options"),Be.strictEqual(typeof e,"object","rimraf: options should be object");try{r=e.lstatSync(t)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&jc&&_$(t,e,n)}try{r&&r.isDirectory()?Jd(t,e,null):e.unlinkSync(t)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return jc?_$(t,e,n):Jd(t,e,n);if(n.code!=="EISDIR")throw n;Jd(t,e,n)}}function Jd(t,e,r){Be(t),Be(e);try{e.rmdirSync(t)}catch(n){if(n.code==="ENOTDIR")throw r;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")tie(t,e);else if(n.code!=="ENOENT")throw n}}function tie(t,e){if(Be(t),Be(e),e.readdirSync(t).forEach(r=>A$(C$.join(t,r),e)),jc){let r=Date.now();do try{return e.rmdirSync(t,e)}catch{}while(Date.now()-r<500)}else return e.rmdirSync(t,e)}O$.exports=Ib;Ib.sync=A$});var Bc=v((pbe,F$)=>{"use strict";var rie=Fe().fromCallback,T$=x$();F$.exports={remove:rie(T$),removeSync:T$.sync}});var j$=v((mbe,L$)=>{"use strict";var nie=Fe().fromCallback,k$=gt(),R$=require("path"),N$=ln(),$$=Bc(),I$=nie(function(e,r){r=r||function(){},k$.readdir(e,(n,i)=>{if(n)return N$.mkdirs(e,r);i=i.map(o=>R$.join(e,o)),s();function s(){let o=i.pop();if(!o)return r();$$.remove(o,a=>{if(a)return r(a);s()})}})});function P$(t){let e;try{e=k$.readdirSync(t)}catch{return N$.mkdirsSync(t)}e.forEach(r=>{r=R$.join(t,r),$$.removeSync(r)})}L$.exports={emptyDirSync:P$,emptydirSync:P$,emptyDir:I$,emptydir:I$}});var U$=v((gbe,q$)=>{"use strict";var iie=Fe().fromCallback,B$=require("path"),Ki=gt(),M$=ln();function sie(t,e){function r(){Ki.writeFile(t,"",n=>{if(n)return e(n);e()})}Ki.stat(t,(n,i)=>{if(!n&&i.isFile())return e();let s=B$.dirname(t);Ki.stat(s,(o,a)=>{if(o)return o.code==="ENOENT"?M$.mkdirs(s,u=>{if(u)return e(u);r()}):e(o);a.isDirectory()?r():Ki.readdir(s,u=>{if(u)return e(u)})})})}function oie(t){let e;try{e=Ki.statSync(t)}catch{}if(e&&e.isFile())return;let r=B$.dirname(t);try{Ki.statSync(r).isDirectory()||Ki.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")M$.mkdirsSync(r);else throw n}Ki.writeFileSync(t,"")}q$.exports={createFile:iie(sie),createFileSync:oie}});var K$=v((ybe,G$)=>{"use strict";var aie=Fe().fromCallback,V$=require("path"),Ys=gt(),z$=ln(),H$=Gi().pathExists;function uie(t,e,r){function n(i,s){Ys.link(i,s,o=>{if(o)return r(o);r(null)})}H$(e,(i,s)=>{if(i)return r(i);if(s)return r(null);Ys.lstat(t,o=>{if(o)return o.message=o.message.replace("lstat","ensureLink"),r(o);let a=V$.dirname(e);H$(a,(u,c)=>{if(u)return r(u);if(c)return n(t,e);z$.mkdirs(a,l=>{if(l)return r(l);n(t,e)})})})})}function cie(t,e){if(Ys.existsSync(e))return;try{Ys.lstatSync(t)}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=V$.dirname(e);return Ys.existsSync(n)||z$.mkdirsSync(n),Ys.linkSync(t,e)}G$.exports={createLink:aie(uie),createLinkSync:cie}});var X$=v((Dbe,W$)=>{"use strict";var Wi=require("path"),Mc=gt(),lie=Gi().pathExists;function fie(t,e,r){if(Wi.isAbsolute(t))return Mc.lstat(t,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:t,toDst:t}));{let n=Wi.dirname(e),i=Wi.join(n,t);return lie(i,(s,o)=>s?r(s):o?r(null,{toCwd:i,toDst:t}):Mc.lstat(t,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),r(a)):r(null,{toCwd:t,toDst:Wi.relative(n,t)})))}}function hie(t,e){let r;if(Wi.isAbsolute(t)){if(r=Mc.existsSync(t),!r)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}else{let n=Wi.dirname(e),i=Wi.join(n,t);if(r=Mc.existsSync(i),r)return{toCwd:i,toDst:t};if(r=Mc.existsSync(t),!r)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Wi.relative(n,t)}}}W$.exports={symlinkPaths:fie,symlinkPathsSync:hie}});var Z$=v((wbe,J$)=>{"use strict";var Y$=gt();function die(t,e,r){if(r=typeof e=="function"?e:r,e=typeof e=="function"?!1:e,e)return r(null,e);Y$.lstat(t,(n,i)=>{if(n)return r(null,"file");e=i&&i.isDirectory()?"dir":"file",r(null,e)})}function pie(t,e){let r;if(e)return e;try{r=Y$.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}J$.exports={symlinkType:die,symlinkTypeSync:pie}});var sL=v((bbe,iL)=>{"use strict";var mie=Fe().fromCallback,eL=require("path"),$a=gt(),tL=ln(),gie=tL.mkdirs,yie=tL.mkdirsSync,rL=X$(),Die=rL.symlinkPaths,wie=rL.symlinkPathsSync,nL=Z$(),bie=nL.symlinkType,vie=nL.symlinkTypeSync,Q$=Gi().pathExists;function Eie(t,e,r,n){n=typeof r=="function"?r:n,r=typeof r=="function"?!1:r,Q$(e,(i,s)=>{if(i)return n(i);if(s)return n(null);Die(t,e,(o,a)=>{if(o)return n(o);t=a.toDst,bie(a.toCwd,r,(u,c)=>{if(u)return n(u);let l=eL.dirname(e);Q$(l,(h,d)=>{if(h)return n(h);if(d)return $a.symlink(t,e,c,n);gie(l,f=>{if(f)return n(f);$a.symlink(t,e,c,n)})})})})})}function _ie(t,e,r){if($a.existsSync(e))return;let i=wie(t,e);t=i.toDst,r=vie(i.toCwd,r);let s=eL.dirname(e);return $a.existsSync(s)||yie(s),$a.symlinkSync(t,e,r)}iL.exports={createSymlink:mie(Eie),createSymlinkSync:_ie}});var aL=v((vbe,oL)=>{"use strict";var Zd=U$(),Qd=K$(),ep=sL();oL.exports={createFile:Zd.createFile,createFileSync:Zd.createFileSync,ensureFile:Zd.createFile,ensureFileSync:Zd.createFileSync,createLink:Qd.createLink,createLinkSync:Qd.createLinkSync,ensureLink:Qd.createLink,ensureLinkSync:Qd.createLinkSync,createSymlink:ep.createSymlink,createSymlinkSync:ep.createSymlinkSync,ensureSymlink:ep.createSymlink,ensureSymlinkSync:ep.createSymlinkSync}});var cL=v((Ebe,uL)=>{"use strict";var tp=b0();uL.exports={readJson:tp.readFile,readJsonSync:tp.readFileSync,writeJson:tp.writeFile,writeJsonSync:tp.writeFileSync}});var rp=v((_be,hL)=>{"use strict";var Cie=Fe().fromCallback,qc=gt(),lL=require("path"),fL=ln(),Sie=Gi().pathExists;function Aie(t,e,r,n){typeof r=="function"&&(n=r,r="utf8");let i=lL.dirname(t);Sie(i,(s,o)=>{if(s)return n(s);if(o)return qc.writeFile(t,e,r,n);fL.mkdirs(i,a=>{if(a)return n(a);qc.writeFile(t,e,r,n)})})}function Oie(t,...e){let r=lL.dirname(t);if(qc.existsSync(r))return qc.writeFileSync(t,...e);fL.mkdirsSync(r),qc.writeFileSync(t,...e)}hL.exports={outputFile:Cie(Aie),outputFileSync:Oie}});var pL=v((Cbe,dL)=>{"use strict";var{stringify:xie}=ya(),{outputFile:Tie}=rp();async function Fie(t,e,r={}){let n=xie(e,r);await Tie(t,n,r)}dL.exports=Fie});var gL=v((Sbe,mL)=>{"use strict";var{stringify:Iie}=ya(),{outputFileSync:Pie}=rp();function kie(t,e,r){let n=Iie(e,r);Pie(t,n,r)}mL.exports=kie});var DL=v((Abe,yL)=>{"use strict";var Rie=Fe().fromPromise,ur=cL();ur.outputJson=Rie(pL());ur.outputJsonSync=gL();ur.outputJSON=ur.outputJson;ur.outputJSONSync=ur.outputJsonSync;ur.writeJSON=ur.writeJson;ur.writeJSONSync=ur.writeJsonSync;ur.readJSON=ur.readJson;ur.readJSONSync=ur.readJsonSync;yL.exports=ur});var CL=v((Obe,_L)=>{"use strict";var vL=gt(),Nie=require("path"),$ie=xb().copySync,EL=Bc().removeSync,Lie=ln().mkdirpSync,wL=kc();function jie(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:i}=wL.checkPathsSync(t,e,"move");return wL.checkParentPathsSync(t,i,e,"move"),Lie(Nie.dirname(e)),Bie(t,e,n)}function Bie(t,e,r){if(r)return EL(e),bL(t,e,r);if(vL.existsSync(e))throw new Error("dest already exists.");return bL(t,e,r)}function bL(t,e,r){try{vL.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return Mie(t,e,r)}}function Mie(t,e,r){return $ie(t,e,{overwrite:r,errorOnExist:!0}),EL(t)}_L.exports=jie});var AL=v((xbe,SL)=>{"use strict";SL.exports={moveSync:CL()}});var IL=v((Tbe,FL)=>{"use strict";var qie=gt(),Uie=require("path"),Hie=Fb().copy,TL=Bc().remove,Vie=ln().mkdirp,zie=Gi().pathExists,OL=kc();function Gie(t,e,r,n){typeof r=="function"&&(n=r,r={});let i=r.overwrite||r.clobber||!1;OL.checkPaths(t,e,"move",(s,o)=>{if(s)return n(s);let{srcStat:a}=o;OL.checkParentPaths(t,a,e,"move",u=>{if(u)return n(u);Vie(Uie.dirname(e),c=>c?n(c):Kie(t,e,i,n))})})}function Kie(t,e,r,n){if(r)return TL(e,i=>i?n(i):xL(t,e,r,n));zie(e,(i,s)=>i?n(i):s?n(new Error("dest already exists.")):xL(t,e,r,n))}function xL(t,e,r,n){qie.rename(t,e,i=>i?i.code!=="EXDEV"?n(i):Wie(t,e,r,n):n())}function Wie(t,e,r,n){Hie(t,e,{overwrite:r,errorOnExist:!0},s=>s?n(s):TL(t,n))}FL.exports=Gie});var kL=v((Fbe,PL)=>{"use strict";var Xie=Fe().fromCallback;PL.exports={move:Xie(IL())}});var np=v((Ibe,Pb)=>{"use strict";Pb.exports={...Pc(),...xb(),...Fb(),...j$(),...aL(),...DL(),...ln(),...AL(),...kL(),...rp(),...Gi(),...Bc()};var RL=require("fs");Object.getOwnPropertyDescriptor(RL,"promises")&&Object.defineProperty(Pb.exports,"promises",{get(){return RL.promises}})});var kb=v(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});La.readdir=La.stat=void 0;var NL=np();async function Yie(t){try{return await NL.stat(t)}catch{}}La.stat=Yie;async function Jie(t){try{return await NL.readdir(t)}catch{return[]}}La.readdir=Jie});var qL=v(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.walk=me.Walker=me.compilePaths=me.tmpfilepath=me.findBaseDirectory=me.isExecutableFile=me.pathExecutable=me.pathWritable=me.pathReadable=me.pathExists=me.pathAccessible=me.writeStreamToFile=me.cacheFileChecksum=me.getFileChecksums=me.getFileChecksum=me.fileToString=me.getFileTree=me.readdirp=me.readdirSafe=me.statSafe=void 0;var Zie=(fe(),ue(le)),Gr=np(),Qie=require("os"),li=require("path"),$L=require("stream"),LL=kb();Zie.__exportStar(np(),me);var jL=kb();Object.defineProperty(me,"statSafe",{enumerable:!0,get:function(){return jL.stat}});Object.defineProperty(me,"readdirSafe",{enumerable:!0,get:function(){return jL.readdir}});async function ese(t,{filter:e,onError:r,walkerOptions:n}={}){return new Promise((i,s)=>{let o=[],a=Nb(t,n);e&&(a=a.pipe(new $L.Transform({objectMode:!0,transform(u,c,l){(!e||e(u))&&this.push(u),l()}}))),a.on("error",u=>r?r(u):s(u)).on("data",u=>o.push(u.path)).on("end",()=>i(o))})}me.readdirp=ese;async function tse(t,{onError:e,onFileNode:r=s=>s,onDirectoryNode:n=s=>s,walkerOptions:i}={}){let s=new Map([]),o=u=>{let c=li.dirname(u.path),l=s.get(c);return l&&l.type==="directory"?l:n({path:c,type:"directory",children:[]})},a=(u,c)=>{let l={path:u.path,parent:c};return u.stats.isDirectory()?n({...l,type:"directory",children:[]}):r({...l,type:"file"})};return new Promise((u,c)=>{t=li.resolve(t),Nb(t,i).on("error",h=>e?e(h):c(h)).on("data",h=>{let d=o(h),f=a(h,d);d.children.push(f),s.set(h.path,f),s.set(d.path,d)}).on("end",()=>{let h=s.get(t);if(!h)return c(new Error("No root node found after walking directory structure."));delete h.parent,u(h)})})}me.getFileTree=tse;async function rse(t){try{return await Gr.readFile(t,{encoding:"utf8"})}catch(e){if(e.code==="ENOENT"||e.code==="ENOTDIR")return"";throw e}}me.fileToString=rse;async function Rb(t){let e=await Promise.resolve().then(()=>require("crypto"));return new Promise((r,n)=>{let i=e.createHash("md5"),s=Gr.createReadStream(t);s.on("error",o=>{n(o)}),i.once("readable",()=>{let o=i.read().toString("hex");r(o)}),s.pipe(i)})}me.getFileChecksum=Rb;async function nse(t){return Promise.all([Rb(t),(async()=>{try{return(await Gr.readFile(`${t}.md5`,{encoding:"utf8"})).trim()}catch(e){if(e.code!=="ENOENT")throw e}})()])}me.getFileChecksums=nse;async function ise(t,e){let r=await Rb(t);await Gr.writeFile(`${t}.md5`,r,{encoding:"utf8"})}me.cacheFileChecksum=ise;function sse(t,e){return new Promise((r,n)=>{let i=Gr.createWriteStream(e);t.pipe(i),i.on("error",n),i.on("finish",r)})}me.writeStreamToFile=sse;async function Uc(t,e){try{await Gr.access(t,e)}catch{return!1}return!0}me.pathAccessible=Uc;async function ose(t){return Uc(t,Gr.constants.F_OK)}me.pathExists=ose;async function ase(t){return Uc(t,Gr.constants.R_OK)}me.pathReadable=ase;async function use(t){return Uc(t,Gr.constants.W_OK)}me.pathWritable=use;async function BL(t){return Uc(t,Gr.constants.X_OK)}me.pathExecutable=BL;async function cse(t){let[e,r]=await Promise.all([LL.stat(t),BL(t)]);return!!e&&(e.isFile()||e.isSymbolicLink())&&r}me.isExecutableFile=cse;async function lse(t,e){if(!(!t||!e)){for(let r of ML(t))if((await LL.readdir(r)).includes(e))return r}}me.findBaseDirectory=lse;function fse(t){let e=Math.random().toString(16).substring(2,8);return li.resolve(Qie.tmpdir(),t?`${t}-${e}`:e)}me.tmpfilepath=fse;function ML(t){if(t=li.normalize(t),!li.isAbsolute(t))throw new Error(`${t} is not an absolute path`);let e=li.parse(t);return t===e.root?[t]:t.slice(e.root.length).split(li.sep).map((r,n,i)=>e.root+li.join(...i.slice(0,i.length-n))).concat(e.root)}me.compilePaths=ML;var ip=class extends $L.Readable{constructor(e,r={}){super({objectMode:!0}),this.p=e,this.options=r,this.paths=[this.p]}_read(){let e=this.paths.shift(),{pathFilter:r}=this.options;if(!e){this.push(null);return}Gr.lstat(e,(n,i)=>{if(n){this.emit("error",n);return}let s={path:e,stats:i};i.isDirectory()?Gr.readdir(e,(o,a)=>{if(o){this.emit("error",o);return}let u=a.map(c=>li.join(e,c));r&&(u=u.filter(c=>r(c.substring(this.p.length+1)))),this.paths.push(...u),this.push(s)}):this.push(s)})}};me.Walker=ip;function Nb(t,e={}){return new ip(t,e)}me.walk=Nb});var UL=v(fi=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});fi.AliasedMap=fi.CaseInsensitiveProxyHandler=fi.createCaseInsensitiveObject=void 0;function hse(){return new Proxy({},fi.CaseInsensitiveProxyHandler)}fi.createCaseInsensitiveObject=hse;fi.CaseInsensitiveProxyHandler={has:(t,e)=>sp(e)in t,get:(t,e)=>t[sp(e)],set:(t,e,r)=>(t[sp(e)]=r,!0),deleteProperty:(t,e)=>delete t[sp(e)]};var sp=t=>typeof t=="string"?t.toLowerCase():t,$b=class extends Map{getAliases(){let e=new Map;return[...this.entries()].filter(([,n])=>typeof n=="string"||typeof n=="symbol").forEach(([n,i])=>{let s=e.get(i)||[];s.push(n),e.set(i,s)}),e}resolveAlias(e){let r=this.get(e);return typeof r!="string"&&typeof r!="symbol"?r:this.resolveAlias(r)}keysWithoutAliases(){return[...this.entries()].filter(e=>typeof e[1]!="string"&&typeof e[1]!="symbol").map(([e,r])=>e)}};fi.AliasedMap=$b});var WL=v((Nbe,KL)=>{"use strict";var GL=require("child_process"),HL=GL.spawn,dse=GL.exec;KL.exports=function(t,e,r){if(typeof e=="function"&&r===void 0&&(r=e,e=void 0),t=parseInt(t),Number.isNaN(t)){if(r)return r(new Error("pid must be a number"));throw new Error("pid must be a number")}var n={},i={};switch(n[t]=[],i[t]=1,process.platform){case"win32":dse("taskkill /pid "+t+" /T /F",r);break;case"darwin":Lb(t,n,i,function(s){return HL("pgrep",["-P",s])},function(){VL(n,e,r)});break;default:Lb(t,n,i,function(s){return HL("ps",["-o","pid","--no-headers","--ppid",s])},function(){VL(n,e,r)});break}};function VL(t,e,r){var n={};try{Object.keys(t).forEach(function(i){t[i].forEach(function(s){n[s]||(zL(s,e),n[s]=1)}),n[i]||(zL(i,e),n[i]=1)})}catch(i){if(r)return r(i);throw i}if(r)return r()}function zL(t,e){try{process.kill(parseInt(t,10),e)}catch(r){if(r.code!=="ESRCH")throw r}}function Lb(t,e,r,n,i){var s=n(t),o="";s.stdout.on("data",function(c){var c=c.toString("ascii");o+=c});var a=function(u){if(delete r[t],u!=0){Object.keys(r).length==0&&i();return}o.match(/\d+/g).forEach(function(c){c=parseInt(c,10),e[t].push(c),e[c]=[],r[c]=1,Lb(c,e,r,n,i)})};s.on("close",a)}});var JL=v(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.processExit=Ze.offBeforeExit=Ze.onBeforeExit=Ze.onExit=Ze.sleepForever=Ze.sleepUntil=Ze.sleep=Ze.getPathParts=Ze.createProcessEnv=Ze.killProcessTree=Ze.ERROR_TIMEOUT_REACHED=void 0;var jb=(fe(),ue(le)),pse=UL(),mse=Li(),gse=qh(),yse=jb.__importStar(require("path")),Dse=jb.__importDefault(Ih()),wse=jb.__importDefault(WL()),Js=(0,gse.debug)("ionic:utils-process");Ze.ERROR_TIMEOUT_REACHED=new Error("TIMEOUT_REACHED");function bse(t,e="SIGTERM"){return new Promise((r,n)=>{(0,wse.default)(t,e,i=>{if(i)return Js("error while killing process tree for %d: %O",t,i),n(i);r()})})}Ze.killProcessTree=bse;function vse(...t){return Object.assign(mse.TERMINAL_INFO.windows?(0,pse.createCaseInsensitiveObject)():{},...t)}Ze.createProcessEnv=vse;function Ese(t=process.env.PATH||""){return t.split(yse.delimiter)}Ze.getPathParts=Ese;async function XL(t){return new Promise(e=>{setTimeout(e,t)})}Ze.sleep=XL;async function _se(t,{interval:e=30,timeout:r=1/0}){let n=0;for(;!t();)if(await XL(e),n+=e,n>r)throw Ze.ERROR_TIMEOUT_REACHED}Ze.sleepUntil=_se;async function Cse(){return new Promise(()=>{setInterval(()=>{},1e3)})}Ze.sleepForever=Cse;function Sse(t){(0,Dse.default)(()=>{Js("onExit: process.exit/normal shutdown"),t()})}Ze.onExit=Sse;var op=new Set;function Ase(t){op.add(t)}Ze.onBeforeExit=Ase;function Ose(t){op.delete(t)}Ze.offBeforeExit=Ose;var xse=t=>{let e=!1;return async()=>{e||(await t(),e=!0)}},Hc=t=>xse(async()=>{Js("onBeforeExit handler: %O received",t),Js("onBeforeExit handler: running %O functions",op.size),await Promise.all([...op.values()].map(async e=>{try{await e()}catch(r){Js("onBeforeExit handler: error from function: %O",r)}})),t!=="process.exit"&&(Js("onBeforeExit handler: killing self (exit code %O, signal %O)",process.exitCode?process.exitCode:0,t),process.removeListener(t,YL[t]),process.kill(process.pid,t))}),YL={SIGINT:Hc("SIGINT"),SIGTERM:Hc("SIGTERM"),SIGHUP:Hc("SIGHUP"),SIGBREAK:Hc("SIGBREAK")};for(let[t,e]of Object.entries(YL))process.on(t,e);var Tse=Hc("process.exit");async function Fse(t=0){process.exitCode=t,await Tse(),Js("processExit: exiting (exit code: %O)",process.exitCode),process.exit()}Ze.processExit=Fse});var e3=v(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.growBufferForAppendedData=kn.WritableStreamBuffer=kn.ReadableStreamBuffer=kn.NullStream=void 0;var Ub=require("stream"),Ise=4,ZL=32,QL=16,Bb=class extends Ub.Writable{_write(e,r,n){n()}};kn.NullStream=Bb;var Mb=class extends Ub.Readable{constructor(e){super(e),this._size=0,this._stopped=!1,this.buffer=Buffer.alloc(e&&e.allocSize?e.allocSize:ZL),this.chunkSize=e&&e.chunkSize?e.chunkSize:Ise,this.growSize=e&&e.growSize?e.growSize:QL}get size(){return this._size}get stopped(){return this._stopped}_read(){this._send()}feed(e,r="utf8"){if(this._stopped)throw new Error("ReadableStreamBuffer is stopped. Can no longer feed.");let n=typeof e=="string"?Buffer.byteLength(e):e.length;this.buffer=Hb(this.buffer,this._size,Math.ceil(n/this.growSize)*this.growSize),typeof e=="string"?this.buffer.write(e,this._size,n,r):this.buffer.copy(e,this._size,0),this._size+=n}stop(){this._stopped||(this._stopped=!0,this._size===0&&this.push(null))}_send(){let e=Math.min(this.chunkSize,this._size),r=!1;if(e>0){let n=Buffer.alloc(e);this.buffer.copy(n,0,0,e),r=!this.push(n),this.buffer.copy(this.buffer,0,e,this._size),this._size-=e}this._size===0&&this._stopped&&this.push(null),r||setTimeout(()=>this._send(),1)}};kn.ReadableStreamBuffer=Mb;var qb=class extends Ub.Writable{constructor(e){super(e),this._size=0,this.buffer=Buffer.alloc(e&&e.allocSize?e.allocSize:ZL),this.growSize=e&&e.growSize?e.growSize:QL}get size(){return this._size}_write(e,r,n){this.buffer=Hb(this.buffer,this._size,Math.ceil(e.length/this.growSize)*this.growSize),e.copy(this.buffer,this._size,0),this._size+=e.length,n()}consume(e){e=typeof e=="number"?e:this._size;let r=Buffer.alloc(e);return this.buffer.copy(r,0,0,r.length),this.buffer.copy(this.buffer,0,r.length),this._size-=r.length,r}};kn.WritableStreamBuffer=qb;function Hb(t,e,r){if(t.length-e>=r)return t;let n=Buffer.alloc(t.length+r);return t.copy(n,0,0,e),n}kn.growBufferForAppendedData=Hb});var s3=v((jbe,i3)=>{i3.exports=n3;n3.sync=kse;var t3=require("fs");function Pse(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function r3(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:Pse(e,r)}function n3(t,e,r){t3.stat(t,function(n,i){r(n,n?!1:r3(i,t,e))})}function kse(t,e){return r3(t3.statSync(t),t,e)}});var l3=v((Bbe,c3)=>{c3.exports=a3;a3.sync=Rse;var o3=require("fs");function a3(t,e,r){o3.stat(t,function(n,i){r(n,n?!1:u3(i,e))})}function Rse(t,e){return u3(o3.statSync(t),e)}function u3(t,e){return t.isFile()&&Nse(t,e)}function Nse(t,e){var r=t.mode,n=t.uid,i=t.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),l=a|u,h=r&c||r&u&&i===o||r&a&&n===s||r&l&&s===0;return h}});var h3=v((qbe,f3)=>{var Mbe=require("fs"),ap;process.platform==="win32"||global.TESTING_WINDOWS?ap=s3():ap=l3();f3.exports=Vb;Vb.sync=$se;function Vb(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){Vb(t,e||{},function(s,o){s?i(s):n(o)})})}ap(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function $se(t,e){try{return ap.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var w3=v((Ube,D3)=>{var ja=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",d3=require("path"),Lse=ja?";":":",p3=h3(),m3=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),g3=(t,e)=>{let r=e.colon||Lse,n=t.match(/\//)||ja&&t.match(/\\/)?[""]:[...ja?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=ja?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=ja?i.split(r):[""];return ja&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:i}},y3=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:s}=g3(t,e),o=[],a=c=>new Promise((l,h)=>{if(c===n.length)return e.all&&o.length?l(o):h(m3(t));let d=n[c],f=/^".*"$/.test(d)?d.slice(1,-1):d,m=d3.join(f,t),g=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;l(u(g,c,0))}),u=(c,l,h)=>new Promise((d,f)=>{if(h===i.length)return d(a(l+1));let m=i[h];p3(c+m,{pathExt:s},(g,b)=>{if(!g&&b)if(e.all)o.push(c+m);else return d(c+m);return d(u(c,l,h+1))})});return r?a(0).then(c=>r(null,c),r):a(0)},jse=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=g3(t,e),s=[];for(let o=0;o<r.length;o++){let a=r[o],u=/^".*"$/.test(a)?a.slice(1,-1):a,c=d3.join(u,t),l=!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+c:c;for(let h=0;h<n.length;h++){let d=l+n[h];try{if(p3.sync(d,{pathExt:i}))if(e.all)s.push(d);else return d}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw m3(t)};D3.exports=y3;y3.sync=jse});var v3=v((Hbe,zb)=>{"use strict";var b3=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};zb.exports=b3;zb.exports.default=b3});var S3=v((Vbe,C3)=>{"use strict";var E3=require("path"),Bse=w3(),Mse=v3();function _3(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,s=i&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let o;try{o=Bse.sync(t.command,{path:r[Mse({env:r})],pathExt:e?E3.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return o&&(o=E3.resolve(i?t.options.cwd:"",o)),o}function qse(t){return _3(t)||_3(t,!0)}C3.exports=qse});var A3=v((zbe,Kb)=>{"use strict";var Gb=/([()\][%!^"`<>&|;, *?])/g;function Use(t){return t=t.replace(Gb,"^$1"),t}function Hse(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(Gb,"^$1"),e&&(t=t.replace(Gb,"^$1")),t}Kb.exports.command=Use;Kb.exports.argument=Hse});var x3=v((Gbe,O3)=>{"use strict";O3.exports=/^#!(.*)/});var F3=v((Kbe,T3)=>{"use strict";var Vse=x3();T3.exports=(t="")=>{let e=t.match(Vse);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var P3=v((Wbe,I3)=>{"use strict";var Wb=require("fs"),zse=F3();function Gse(t){let r=Buffer.alloc(150),n;try{n=Wb.openSync(t,"r"),Wb.readSync(n,r,0,150,0),Wb.closeSync(n)}catch{}return zse(r.toString())}I3.exports=Gse});var $3=v((Xbe,N3)=>{"use strict";var Kse=require("path"),k3=S3(),R3=A3(),Wse=P3(),Xse=process.platform==="win32",Yse=/\.(?:com|exe)$/i,Jse=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Zse(t){t.file=k3(t);let e=t.file&&Wse(t.file);return e?(t.args.unshift(t.file),t.command=e,k3(t)):t.file}function Qse(t){if(!Xse)return t;let e=Zse(t),r=!Yse.test(e);if(t.options.forceShell||r){let n=Jse.test(e);t.command=Kse.normalize(t.command),t.command=R3.command(t.command),t.args=t.args.map(s=>R3.argument(s,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function eoe(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:Qse(n)}N3.exports=eoe});var B3=v((Ybe,j3)=>{"use strict";var Xb=process.platform==="win32";function Yb(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function toe(t,e){if(!Xb)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let s=L3(i,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function L3(t,e){return Xb&&t===1&&!e.file?Yb(e.original,"spawn"):null}function roe(t,e){return Xb&&t===1&&!e.file?Yb(e.original,"spawnSync"):null}j3.exports={hookChildProcess:toe,verifyENOENT:L3,verifyENOENTSync:roe,notFoundError:Yb}});var U3=v((Jbe,Ba)=>{"use strict";var M3=require("child_process"),Jb=$3(),Zb=B3();function q3(t,e,r){let n=Jb(t,e,r),i=M3.spawn(n.command,n.args,n.options);return Zb.hookChildProcess(i,n),i}function noe(t,e,r){let n=Jb(t,e,r),i=M3.spawnSync(n.command,n.args,n.options);return i.error=i.error||Zb.verifyENOENTSync(i.status,n),i}Ba.exports=q3;Ba.exports.spawn=q3;Ba.exports.sync=noe;Ba.exports._parse=Jb;Ba.exports._enoent=Zb});var X3=v(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.findExecutables=Ie.which=Ie.fork=Ie.spawn=Ie.Subprocess=Ie.SubprocessError=Ie.convertPATH=Ie.expandTildePath=Ie.TILDE_PATH_REGEX=Ie.ERROR_SIGNAL_EXIT=Ie.ERROR_NON_ZERO_EXIT=Ie.ERROR_COMMAND_NOT_FOUND=void 0;var tv=(fe(),ue(le)),H3=UN(),ioe=qL(),Qb=JL(),up=e3(),V3=Li(),soe=require("child_process"),ooe=tv.__importDefault(U3()),aoe=tv.__importStar(require("os")),Qs=tv.__importStar(require("path"));Ie.ERROR_COMMAND_NOT_FOUND="ERR_SUBPROCESS_COMMAND_NOT_FOUND";Ie.ERROR_NON_ZERO_EXIT="ERR_SUBPROCESS_NON_ZERO_EXIT";Ie.ERROR_SIGNAL_EXIT="ERR_SUBPROCESS_SIGNAL_EXIT";Ie.TILDE_PATH_REGEX=/^~($|\/|\\)/;function z3(t){let e=aoe.homedir();return t.replace(Ie.TILDE_PATH_REGEX,`${e}$1`)}Ie.expandTildePath=z3;function G3(t=process.env.PATH||""){return t.split(Qs.delimiter).map(z3).join(Qs.delimiter)}Ie.convertPATH=G3;var Zs=class extends Error{constructor(){super(...arguments),this.name="SubprocessError"}};Ie.SubprocessError=Zs;var ev=class{constructor(e,r,n={}){this.name=e,this.args=r;let i=this.maskArg(e);i!==e&&(this.name=i,this.path=e),this._options=n}get options(){let e=this._options;e.env||(e.env=process.env);let r=(0,Qb.createProcessEnv)(e.env||{},{PATH:G3(typeof e.env.PATH=="string"?e.env.PATH:process.env.PATH)});return{...e,env:r}}async output(){this._options.stdio="pipe";let e=this.run(),r=new up.WritableStreamBuffer,n=new up.WritableStreamBuffer,i=new up.WritableStreamBuffer;e.p.stdout?.pipe(r),e.p.stdout?.pipe(i),e.p.stderr?.pipe(n),e.p.stderr?.pipe(i);try{await e}catch(s){throw r.end(),n.end(),s.output=i.consume().toString(),s}return n.end(),i.end(),r.consume().toString()}async combinedOutput(){this._options.stdio="pipe";let e=this.run(),r=new up.WritableStreamBuffer;e.p.stdout?.pipe(r),e.p.stderr?.pipe(r);try{await e}catch(n){throw n.output=r.consume().toString(),n}return r.consume().toString()}run(){let e=this.spawn(),r=new Promise((n,i)=>{e.on("error",s=>{let o;s.code==="ENOENT"?(o=new Zs("Command not found.",{cause:s}),o.code=Ie.ERROR_COMMAND_NOT_FOUND):o=new Zs("Command error.",{cause:s}),i(o)}),e.on("close",(s,o)=>{let a;if(s===0)return n();if(o)a=new Zs("Signal exit from subprocess."),a.code=Ie.ERROR_SIGNAL_EXIT,a.signal=o;else if(s)a=new Zs("Non-zero exit from subprocess."),a.code=Ie.ERROR_NON_ZERO_EXIT,a.exitCode=s;else return n();i(a)})});return Object.defineProperties(r,{p:{value:e}}),r}spawn(){return K3(this.path?this.path:this.name,this.args,this.options)}bashify({maskArgv0:e=!0,maskArgv1:r=!1,shiftArgv0:n=!1}={}){let i=[this.path?this.path:this.name,...this.args];return n&&i.shift(),i[0]&&e&&(i[0]=this.maskArg(i[0])),i[1]&&r&&(i[1]=this.maskArg(i[1])),i.length>0?i.map(s=>this.bashifyArg(s)).join(" "):""}bashifyArg(e){return e.includes(" ")?`"${e.replace(/\"/g,'\\"')}"`:e}maskArg(e){let r=e.lastIndexOf(Qs.sep);return r>=0?e.substring(r+1):e}};Ie.Subprocess=ev;function K3(t,e=[],r){return(0,ooe.default)(t,[...e],r)}Ie.spawn=K3;function uoe(t,e=[],r={}){return(0,soe.fork)(t,[...e],r)}Ie.fork=uoe;var rv=V3.TERMINAL_INFO.windows?".COM;.EXE;.BAT;.CMD":void 0;async function coe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||rv}={}){if(t.includes(Qs.sep))return t;let n=await W3(t,{PATH:e});if(!n.length){let i=new Error(`${t} cannot be found within PATH`);throw i.code="ENOENT",i}return n[0]}Ie.which=coe;async function loe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||rv}={}){return t.includes(Qs.sep)?[t]:W3(t,{PATH:e})}Ie.findExecutables=loe;async function W3(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||rv}={}){let n=(0,Qb.getPathParts)(e),i;if(V3.TERMINAL_INFO.windows){let s=(0,Qb.getPathParts)(r).map(o=>o.toLowerCase());i=s.includes(Qs.extname(t).toLowerCase())?[t]:s.map(o=>t+o)}else i=[t];return[].concat(...await(0,H3.map)(i,async s=>(0,H3.concurrentFilter)(n.map(o=>Qs.join(o,s)),async o=>(0,ioe.isExecutableFile)(o))))}});var cp=v(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.isInstalled=Xi.getCommandOutput=Xi.runCommand=void 0;var nv=X3();async function Y3(t,e,r={}){let n=new nv.Subprocess(t,e,r);try{return await n.output()}catch(i){throw i instanceof nv.SubprocessError?i.output?i.output:i.cause?`${i.message} ${i.cause.toString()}`:i.code?i.code:"Unknown error":i}}Xi.runCommand=Y3;async function foe(t,e,r={}){try{return(await Y3(t,e,r)).trim()}catch{return null}}Xi.getCommandOutput=foe;async function hoe(t){try{await(0,nv.which)(t)}catch{return!1}return!0}Xi.isInstalled=hoe});var Vc=v((eve,J3)=>{"use strict";var doe="2.0.0",poe=Number.MAX_SAFE_INTEGER||9007199254740991,moe=16,goe=250,yoe=["major","premajor","minor","preminor","patch","prepatch","prerelease"];J3.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:moe,MAX_SAFE_BUILD_LENGTH:goe,MAX_SAFE_INTEGER:poe,RELEASE_TYPES:yoe,SEMVER_SPEC_VERSION:doe,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var zc=v((tve,Z3)=>{"use strict";var Doe=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};Z3.exports=Doe});var Ma=v((Rn,Q3)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:iv,MAX_SAFE_BUILD_LENGTH:woe,MAX_LENGTH:boe}=Vc(),voe=zc();Rn=Q3.exports={};var Eoe=Rn.re=[],_oe=Rn.safeRe=[],J=Rn.src=[],Coe=Rn.safeSrc=[],Z=Rn.t={},Soe=0,sv="[a-zA-Z0-9-]",Aoe=[["\\s",1],["\\d",boe],[sv,woe]],Ooe=t=>{for(let[e,r]of Aoe)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},ge=(t,e,r)=>{let n=Ooe(e),i=Soe++;voe(t,i,e),Z[t]=i,J[i]=e,Coe[i]=n,Eoe[i]=new RegExp(e,r?"g":void 0),_oe[i]=new RegExp(n,r?"g":void 0)};ge("NUMERICIDENTIFIER","0|[1-9]\\d*");ge("NUMERICIDENTIFIERLOOSE","\\d+");ge("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${sv}*`);ge("MAINVERSION",`(${J[Z.NUMERICIDENTIFIER]})\\.(${J[Z.NUMERICIDENTIFIER]})\\.(${J[Z.NUMERICIDENTIFIER]})`);ge("MAINVERSIONLOOSE",`(${J[Z.NUMERICIDENTIFIERLOOSE]})\\.(${J[Z.NUMERICIDENTIFIERLOOSE]})\\.(${J[Z.NUMERICIDENTIFIERLOOSE]})`);ge("PRERELEASEIDENTIFIER",`(?:${J[Z.NONNUMERICIDENTIFIER]}|${J[Z.NUMERICIDENTIFIER]})`);ge("PRERELEASEIDENTIFIERLOOSE",`(?:${J[Z.NONNUMERICIDENTIFIER]}|${J[Z.NUMERICIDENTIFIERLOOSE]})`);ge("PRERELEASE",`(?:-(${J[Z.PRERELEASEIDENTIFIER]}(?:\\.${J[Z.PRERELEASEIDENTIFIER]})*))`);ge("PRERELEASELOOSE",`(?:-?(${J[Z.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${J[Z.PRERELEASEIDENTIFIERLOOSE]})*))`);ge("BUILDIDENTIFIER",`${sv}+`);ge("BUILD",`(?:\\+(${J[Z.BUILDIDENTIFIER]}(?:\\.${J[Z.BUILDIDENTIFIER]})*))`);ge("FULLPLAIN",`v?${J[Z.MAINVERSION]}${J[Z.PRERELEASE]}?${J[Z.BUILD]}?`);ge("FULL",`^${J[Z.FULLPLAIN]}$`);ge("LOOSEPLAIN",`[v=\\s]*${J[Z.MAINVERSIONLOOSE]}${J[Z.PRERELEASELOOSE]}?${J[Z.BUILD]}?`);ge("LOOSE",`^${J[Z.LOOSEPLAIN]}$`);ge("GTLT","((?:<|>)?=?)");ge("XRANGEIDENTIFIERLOOSE",`${J[Z.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ge("XRANGEIDENTIFIER",`${J[Z.NUMERICIDENTIFIER]}|x|X|\\*`);ge("XRANGEPLAIN",`[v=\\s]*(${J[Z.XRANGEIDENTIFIER]})(?:\\.(${J[Z.XRANGEIDENTIFIER]})(?:\\.(${J[Z.XRANGEIDENTIFIER]})(?:${J[Z.PRERELEASE]})?${J[Z.BUILD]}?)?)?`);ge("XRANGEPLAINLOOSE",`[v=\\s]*(${J[Z.XRANGEIDENTIFIERLOOSE]})(?:\\.(${J[Z.XRANGEIDENTIFIERLOOSE]})(?:\\.(${J[Z.XRANGEIDENTIFIERLOOSE]})(?:${J[Z.PRERELEASELOOSE]})?${J[Z.BUILD]}?)?)?`);ge("XRANGE",`^${J[Z.GTLT]}\\s*${J[Z.XRANGEPLAIN]}$`);ge("XRANGELOOSE",`^${J[Z.GTLT]}\\s*${J[Z.XRANGEPLAINLOOSE]}$`);ge("COERCEPLAIN",`(^|[^\\d])(\\d{1,${iv}})(?:\\.(\\d{1,${iv}}))?(?:\\.(\\d{1,${iv}}))?`);ge("COERCE",`${J[Z.COERCEPLAIN]}(?:$|[^\\d])`);ge("COERCEFULL",J[Z.COERCEPLAIN]+`(?:${J[Z.PRERELEASE]})?(?:${J[Z.BUILD]})?(?:$|[^\\d])`);ge("COERCERTL",J[Z.COERCE],!0);ge("COERCERTLFULL",J[Z.COERCEFULL],!0);ge("LONETILDE","(?:~>?)");ge("TILDETRIM",`(\\s*)${J[Z.LONETILDE]}\\s+`,!0);Rn.tildeTrimReplace="$1~";ge("TILDE",`^${J[Z.LONETILDE]}${J[Z.XRANGEPLAIN]}$`);ge("TILDELOOSE",`^${J[Z.LONETILDE]}${J[Z.XRANGEPLAINLOOSE]}$`);ge("LONECARET","(?:\\^)");ge("CARETTRIM",`(\\s*)${J[Z.LONECARET]}\\s+`,!0);Rn.caretTrimReplace="$1^";ge("CARET",`^${J[Z.LONECARET]}${J[Z.XRANGEPLAIN]}$`);ge("CARETLOOSE",`^${J[Z.LONECARET]}${J[Z.XRANGEPLAINLOOSE]}$`);ge("COMPARATORLOOSE",`^${J[Z.GTLT]}\\s*(${J[Z.LOOSEPLAIN]})$|^$`);ge("COMPARATOR",`^${J[Z.GTLT]}\\s*(${J[Z.FULLPLAIN]})$|^$`);ge("COMPARATORTRIM",`(\\s*)${J[Z.GTLT]}\\s*(${J[Z.LOOSEPLAIN]}|${J[Z.XRANGEPLAIN]})`,!0);Rn.comparatorTrimReplace="$1$2$3";ge("HYPHENRANGE",`^\\s*(${J[Z.XRANGEPLAIN]})\\s+-\\s+(${J[Z.XRANGEPLAIN]})\\s*$`);ge("HYPHENRANGELOOSE",`^\\s*(${J[Z.XRANGEPLAINLOOSE]})\\s+-\\s+(${J[Z.XRANGEPLAINLOOSE]})\\s*$`);ge("STAR","(<|>)?=?\\s*\\*");ge("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ge("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var lp=v((rve,ej)=>{"use strict";var xoe=Object.freeze({loose:!0}),Toe=Object.freeze({}),Foe=t=>t?typeof t!="object"?xoe:t:Toe;ej.exports=Foe});var ov=v((nve,nj)=>{"use strict";var tj=/^[0-9]+$/,rj=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=tj.test(t),n=tj.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Ioe=(t,e)=>rj(e,t);nj.exports={compareIdentifiers:rj,rcompareIdentifiers:Ioe}});var Wt=v((ive,sj)=>{"use strict";var fp=zc(),{MAX_LENGTH:ij,MAX_SAFE_INTEGER:hp}=Vc(),{safeRe:dp,t:pp}=Ma(),Poe=lp(),{compareIdentifiers:av}=ov(),uv=class t{constructor(e,r){if(r=Poe(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>ij)throw new TypeError(`version is longer than ${ij} characters`);fp("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?dp[pp.LOOSE]:dp[pp.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>hp||this.major<0)throw new TypeError("Invalid major version");if(this.minor>hp||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>hp||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&s<hp)return s}return i}):this.prerelease=[],this.build=n[5]?n[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(e){if(fp("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=e.prerelease[r];if(fp("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return av(n,i)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],i=e.build[r];if(fp("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return av(n,i)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?dp[pp.PRERELEASELOOSE]:dp[pp.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),av(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};sj.exports=uv});var eo=v((sve,aj)=>{"use strict";var oj=Wt(),koe=(t,e,r=!1)=>{if(t instanceof oj)return t;try{return new oj(t,e)}catch(n){if(!r)return null;throw n}};aj.exports=koe});var cj=v((ove,uj)=>{"use strict";var Roe=eo(),Noe=(t,e)=>{let r=Roe(t,e);return r?r.version:null};uj.exports=Noe});var fj=v((ave,lj)=>{"use strict";var $oe=eo(),Loe=(t,e)=>{let r=$oe(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};lj.exports=Loe});var pj=v((uve,dj)=>{"use strict";var hj=Wt(),joe=(t,e,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new hj(t instanceof hj?t.version:t,r).inc(e,n,i).version}catch{return null}};dj.exports=joe});var yj=v((cve,gj)=>{"use strict";var mj=eo(),Boe=(t,e)=>{let r=mj(t,null,!0),n=mj(e,null,!0),i=r.compare(n);if(i===0)return null;let s=i>0,o=s?r:n,a=s?n:r,u=!!o.prerelease.length;if(!!a.prerelease.length&&!u){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let l=u?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};gj.exports=Boe});var wj=v((lve,Dj)=>{"use strict";var Moe=Wt(),qoe=(t,e)=>new Moe(t,e).major;Dj.exports=qoe});var vj=v((fve,bj)=>{"use strict";var Uoe=Wt(),Hoe=(t,e)=>new Uoe(t,e).minor;bj.exports=Hoe});var _j=v((hve,Ej)=>{"use strict";var Voe=Wt(),zoe=(t,e)=>new Voe(t,e).patch;Ej.exports=zoe});var Sj=v((dve,Cj)=>{"use strict";var Goe=eo(),Koe=(t,e)=>{let r=Goe(t,e);return r&&r.prerelease.length?r.prerelease:null};Cj.exports=Koe});var Kr=v((pve,Oj)=>{"use strict";var Aj=Wt(),Woe=(t,e,r)=>new Aj(t,r).compare(new Aj(e,r));Oj.exports=Woe});var Tj=v((mve,xj)=>{"use strict";var Xoe=Kr(),Yoe=(t,e,r)=>Xoe(e,t,r);xj.exports=Yoe});var Ij=v((gve,Fj)=>{"use strict";var Joe=Kr(),Zoe=(t,e)=>Joe(t,e,!0);Fj.exports=Zoe});var mp=v((yve,kj)=>{"use strict";var Pj=Wt(),Qoe=(t,e,r)=>{let n=new Pj(t,r),i=new Pj(e,r);return n.compare(i)||n.compareBuild(i)};kj.exports=Qoe});var Nj=v((Dve,Rj)=>{"use strict";var eae=mp(),tae=(t,e)=>t.sort((r,n)=>eae(r,n,e));Rj.exports=tae});var Lj=v((wve,$j)=>{"use strict";var rae=mp(),nae=(t,e)=>t.sort((r,n)=>rae(n,r,e));$j.exports=nae});var Gc=v((bve,jj)=>{"use strict";var iae=Kr(),sae=(t,e,r)=>iae(t,e,r)>0;jj.exports=sae});var gp=v((vve,Bj)=>{"use strict";var oae=Kr(),aae=(t,e,r)=>oae(t,e,r)<0;Bj.exports=aae});var cv=v((Eve,Mj)=>{"use strict";var uae=Kr(),cae=(t,e,r)=>uae(t,e,r)===0;Mj.exports=cae});var lv=v((_ve,qj)=>{"use strict";var lae=Kr(),fae=(t,e,r)=>lae(t,e,r)!==0;qj.exports=fae});var yp=v((Cve,Uj)=>{"use strict";var hae=Kr(),dae=(t,e,r)=>hae(t,e,r)>=0;Uj.exports=dae});var Dp=v((Sve,Hj)=>{"use strict";var pae=Kr(),mae=(t,e,r)=>pae(t,e,r)<=0;Hj.exports=mae});var fv=v((Ave,Vj)=>{"use strict";var gae=cv(),yae=lv(),Dae=Gc(),wae=yp(),bae=gp(),vae=Dp(),Eae=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return gae(t,r,n);case"!=":return yae(t,r,n);case">":return Dae(t,r,n);case">=":return wae(t,r,n);case"<":return bae(t,r,n);case"<=":return vae(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};Vj.exports=Eae});var Gj=v((Ove,zj)=>{"use strict";var _ae=Wt(),Cae=eo(),{safeRe:wp,t:bp}=Ma(),Sae=(t,e)=>{if(t instanceof _ae)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?wp[bp.COERCEFULL]:wp[bp.COERCE]);else{let u=e.includePrerelease?wp[bp.COERCERTLFULL]:wp[bp.COERCERTL],c;for(;(c=u.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||c.index+c[0].length!==r.index+r[0].length)&&(r=c),u.lastIndex=c.index+c[1].length+c[2].length;u.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",s=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Cae(`${n}.${i}.${s}${o}${a}`,e)};zj.exports=Sae});var Wj=v((xve,Kj)=>{"use strict";var hv=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(e,r)}return this}};Kj.exports=hv});var Wr=v((Tve,Zj)=>{"use strict";var Aae=/\s+/g,dv=class t{constructor(e,r){if(r=xae(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof pv)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(Aae," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(i=>!Yj(i[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&Nae(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&kae)|(this.options.loose&&Rae))+":"+e,i=Xj.get(n);if(i)return i;let s=this.options.loose,o=s?cr[Xt.HYPHENRANGELOOSE]:cr[Xt.HYPHENRANGE];e=e.replace(o,zae(this.options.includePrerelease)),Qe("hyphen replace",e),e=e.replace(cr[Xt.COMPARATORTRIM],Fae),Qe("comparator trim",e),e=e.replace(cr[Xt.TILDETRIM],Iae),Qe("tilde trim",e),e=e.replace(cr[Xt.CARETTRIM],Pae),Qe("caret trim",e);let a=e.split(" ").map(h=>$ae(h,this.options)).join(" ").split(/\s+/).map(h=>Vae(h,this.options));s&&(a=a.filter(h=>(Qe("loose invalid filter",h,this.options),!!h.match(cr[Xt.COMPARATORLOOSE])))),Qe("range list",a);let u=new Map,c=a.map(h=>new pv(h,this.options));for(let h of c){if(Yj(h))return[h];u.set(h.value,h)}u.size>1&&u.has("")&&u.delete("");let l=[...u.values()];return Xj.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>Jj(n,r)&&e.set.some(i=>Jj(i,r)&&n.every(s=>i.every(o=>s.intersects(o,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Tae(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Gae(this.set[r],e,this.options))return!0;return!1}};Zj.exports=dv;var Oae=Wj(),Xj=new Oae,xae=lp(),pv=Kc(),Qe=zc(),Tae=Wt(),{safeRe:cr,t:Xt,comparatorTrimReplace:Fae,tildeTrimReplace:Iae,caretTrimReplace:Pae}=Ma(),{FLAG_INCLUDE_PRERELEASE:kae,FLAG_LOOSE:Rae}=Vc(),Yj=t=>t.value==="<0.0.0-0",Nae=t=>t.value==="",Jj=(t,e)=>{let r=!0,n=t.slice(),i=n.pop();for(;r&&n.length;)r=n.every(s=>i.intersects(s,e)),i=n.pop();return r},$ae=(t,e)=>(t=t.replace(cr[Xt.BUILD],""),Qe("comp",t,e),t=Bae(t,e),Qe("caret",t),t=Lae(t,e),Qe("tildes",t),t=qae(t,e),Qe("xrange",t),t=Hae(t,e),Qe("stars",t),t),lr=t=>!t||t.toLowerCase()==="x"||t==="*",Lae=(t,e)=>t.trim().split(/\s+/).map(r=>jae(r,e)).join(" "),jae=(t,e)=>{let r=e.loose?cr[Xt.TILDELOOSE]:cr[Xt.TILDE];return t.replace(r,(n,i,s,o,a)=>{Qe("tilde",t,n,i,s,o,a);let u;return lr(i)?u="":lr(s)?u=`>=${i}.0.0 <${+i+1}.0.0-0`:lr(o)?u=`>=${i}.${s}.0 <${i}.${+s+1}.0-0`:a?(Qe("replaceTilde pr",a),u=`>=${i}.${s}.${o}-${a} <${i}.${+s+1}.0-0`):u=`>=${i}.${s}.${o} <${i}.${+s+1}.0-0`,Qe("tilde return",u),u})},Bae=(t,e)=>t.trim().split(/\s+/).map(r=>Mae(r,e)).join(" "),Mae=(t,e)=>{Qe("caret",t,e);let r=e.loose?cr[Xt.CARETLOOSE]:cr[Xt.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(i,s,o,a,u)=>{Qe("caret",t,i,s,o,a,u);let c;return lr(s)?c="":lr(o)?c=`>=${s}.0.0${n} <${+s+1}.0.0-0`:lr(a)?s==="0"?c=`>=${s}.${o}.0${n} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.0${n} <${+s+1}.0.0-0`:u?(Qe("replaceCaret pr",u),s==="0"?o==="0"?c=`>=${s}.${o}.${a}-${u} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}-${u} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a}-${u} <${+s+1}.0.0-0`):(Qe("no pr"),s==="0"?o==="0"?c=`>=${s}.${o}.${a}${n} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}${n} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a} <${+s+1}.0.0-0`),Qe("caret return",c),c})},qae=(t,e)=>(Qe("replaceXRanges",t,e),t.split(/\s+/).map(r=>Uae(r,e)).join(" ")),Uae=(t,e)=>{t=t.trim();let r=e.loose?cr[Xt.XRANGELOOSE]:cr[Xt.XRANGE];return t.replace(r,(n,i,s,o,a,u)=>{Qe("xRange",t,n,i,s,o,a,u);let c=lr(s),l=c||lr(o),h=l||lr(a),d=h;return i==="="&&d&&(i=""),u=e.includePrerelease?"-0":"",c?i===">"||i==="<"?n="<0.0.0-0":n="*":i&&d?(l&&(o=0),a=0,i===">"?(i=">=",l?(s=+s+1,o=0,a=0):(o=+o+1,a=0)):i==="<="&&(i="<",l?s=+s+1:o=+o+1),i==="<"&&(u="-0"),n=`${i+s}.${o}.${a}${u}`):l?n=`>=${s}.0.0${u} <${+s+1}.0.0-0`:h&&(n=`>=${s}.${o}.0${u} <${s}.${+o+1}.0-0`),Qe("xRange return",n),n})},Hae=(t,e)=>(Qe("replaceStars",t,e),t.trim().replace(cr[Xt.STAR],"")),Vae=(t,e)=>(Qe("replaceGTE0",t,e),t.trim().replace(cr[e.includePrerelease?Xt.GTE0PRE:Xt.GTE0],"")),zae=t=>(e,r,n,i,s,o,a,u,c,l,h,d)=>(lr(n)?r="":lr(i)?r=`>=${n}.0.0${t?"-0":""}`:lr(s)?r=`>=${n}.${i}.0${t?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,lr(c)?u="":lr(l)?u=`<${+c+1}.0.0-0`:lr(h)?u=`<${c}.${+l+1}.0-0`:d?u=`<=${c}.${l}.${h}-${d}`:t?u=`<${c}.${l}.${+h+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),Gae=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(Qe(t[n].semver),t[n].semver!==pv.ANY&&t[n].semver.prerelease.length>0){let i=t[n].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0}});var Kc=v((Fve,iB)=>{"use strict";var Wc=Symbol("SemVer ANY"),yv=class t{static get ANY(){return Wc}constructor(e,r){if(r=Qj(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),gv("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Wc?this.value="":this.value=this.operator+this.semver.version,gv("comp",this)}parse(e){let r=this.options.loose?eB[tB.COMPARATORLOOSE]:eB[tB.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new rB(n[2],this.options.loose):this.semver=Wc}toString(){return this.value}test(e){if(gv("Comparator.test",e,this.options.loose),this.semver===Wc||e===Wc)return!0;if(typeof e=="string")try{e=new rB(e,this.options)}catch{return!1}return mv(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new nB(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new nB(this.value,r).test(e.semver):(r=Qj(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||mv(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||mv(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};iB.exports=yv;var Qj=lp(),{safeRe:eB,t:tB}=Ma(),mv=fv(),gv=zc(),rB=Wt(),nB=Wr()});var Xc=v((Ive,sB)=>{"use strict";var Kae=Wr(),Wae=(t,e,r)=>{try{e=new Kae(e,r)}catch{return!1}return e.test(t)};sB.exports=Wae});var aB=v((Pve,oB)=>{"use strict";var Xae=Wr(),Yae=(t,e)=>new Xae(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));oB.exports=Yae});var cB=v((kve,uB)=>{"use strict";var Jae=Wt(),Zae=Wr(),Qae=(t,e,r)=>{let n=null,i=null,s=null;try{s=new Zae(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new Jae(n,r))}),n};uB.exports=Qae});var fB=v((Rve,lB)=>{"use strict";var eue=Wt(),tue=Wr(),rue=(t,e,r)=>{let n=null,i=null,s=null;try{s=new tue(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new eue(n,r))}),n};lB.exports=rue});var pB=v((Nve,dB)=>{"use strict";var Dv=Wt(),nue=Wr(),hB=Gc(),iue=(t,e)=>{t=new nue(t,e);let r=new Dv("0.0.0");if(t.test(r)||(r=new Dv("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let i=t.set[n],s=null;i.forEach(o=>{let a=new Dv(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||hB(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||hB(r,s))&&(r=s)}return r&&t.test(r)?r:null};dB.exports=iue});var gB=v(($ve,mB)=>{"use strict";var sue=Wr(),oue=(t,e)=>{try{return new sue(t,e).range||"*"}catch{return null}};mB.exports=oue});var vp=v((Lve,bB)=>{"use strict";var aue=Wt(),wB=Kc(),{ANY:uue}=wB,cue=Wr(),lue=Xc(),yB=Gc(),DB=gp(),fue=Dp(),hue=yp(),due=(t,e,r,n)=>{t=new aue(t,n),e=new cue(e,n);let i,s,o,a,u;switch(r){case">":i=yB,s=fue,o=DB,a=">",u=">=";break;case"<":i=DB,s=hue,o=yB,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(lue(t,e,n))return!1;for(let c=0;c<e.set.length;++c){let l=e.set[c],h=null,d=null;if(l.forEach(f=>{f.semver===uue&&(f=new wB(">=0.0.0")),h=h||f,d=d||f,i(f.semver,h.semver,n)?h=f:o(f.semver,d.semver,n)&&(d=f)}),h.operator===a||h.operator===u||(!d.operator||d.operator===a)&&s(t,d.semver))return!1;if(d.operator===u&&o(t,d.semver))return!1}return!0};bB.exports=due});var EB=v((jve,vB)=>{"use strict";var pue=vp(),mue=(t,e,r)=>pue(t,e,">",r);vB.exports=mue});var CB=v((Bve,_B)=>{"use strict";var gue=vp(),yue=(t,e,r)=>gue(t,e,"<",r);_B.exports=yue});var OB=v((Mve,AB)=>{"use strict";var SB=Wr(),Due=(t,e,r)=>(t=new SB(t,r),e=new SB(e,r),t.intersects(e,r));AB.exports=Due});var TB=v((qve,xB)=>{"use strict";var wue=Xc(),bue=Kr();xB.exports=(t,e,r)=>{let n=[],i=null,s=null,o=t.sort((l,h)=>bue(l,h,r));for(let l of o)wue(l,e,r)?(s=l,i||(i=l)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);let a=[];for(let[l,h]of n)l===h?a.push(l):!h&&l===o[0]?a.push("*"):h?l===o[0]?a.push(`<=${h}`):a.push(`${l} - ${h}`):a.push(`>=${l}`);let u=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return u.length<c.length?u:e}});var NB=v((Uve,RB)=>{"use strict";var FB=Wr(),bv=Kc(),{ANY:wv}=bv,Yc=Xc(),vv=Kr(),vue=(t,e,r={})=>{if(t===e)return!0;t=new FB(t,r),e=new FB(e,r);let n=!1;e:for(let i of t.set){for(let s of e.set){let o=_ue(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},Eue=[new bv(">=0.0.0-0")],IB=[new bv(">=0.0.0")],_ue=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===wv){if(e.length===1&&e[0].semver===wv)return!0;r.includePrerelease?t=Eue:t=IB}if(e.length===1&&e[0].semver===wv){if(r.includePrerelease)return!0;e=IB}let n=new Set,i,s;for(let f of t)f.operator===">"||f.operator===">="?i=PB(i,f,r):f.operator==="<"||f.operator==="<="?s=kB(s,f,r):n.add(f.semver);if(n.size>1)return null;let o;if(i&&s){if(o=vv(i.semver,s.semver,r),o>0)return null;if(o===0&&(i.operator!==">="||s.operator!=="<="))return null}for(let f of n){if(i&&!Yc(f,String(i),r)||s&&!Yc(f,String(s),r))return null;for(let m of e)if(!Yc(f,String(m),r))return!1;return!0}let a,u,c,l,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;h&&h.prerelease.length===1&&s.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let f of e){if(l=l||f.operator===">"||f.operator===">=",c=c||f.operator==="<"||f.operator==="<=",i){if(d&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===d.major&&f.semver.minor===d.minor&&f.semver.patch===d.patch&&(d=!1),f.operator===">"||f.operator===">="){if(a=PB(i,f,r),a===f&&a!==i)return!1}else if(i.operator===">="&&!Yc(i.semver,String(f),r))return!1}if(s){if(h&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===h.major&&f.semver.minor===h.minor&&f.semver.patch===h.patch&&(h=!1),f.operator==="<"||f.operator==="<="){if(u=kB(s,f,r),u===f&&u!==s)return!1}else if(s.operator==="<="&&!Yc(s.semver,String(f),r))return!1}if(!f.operator&&(s||i)&&o!==0)return!1}return!(i&&c&&!s&&o!==0||s&&l&&!i&&o!==0||d||h)},PB=(t,e,r)=>{if(!t)return e;let n=vv(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},kB=(t,e,r)=>{if(!t)return e;let n=vv(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};RB.exports=vue});var BB=v((Hve,jB)=>{"use strict";var Ev=Ma(),$B=Vc(),Cue=Wt(),LB=ov(),Sue=eo(),Aue=cj(),Oue=fj(),xue=pj(),Tue=yj(),Fue=wj(),Iue=vj(),Pue=_j(),kue=Sj(),Rue=Kr(),Nue=Tj(),$ue=Ij(),Lue=mp(),jue=Nj(),Bue=Lj(),Mue=Gc(),que=gp(),Uue=cv(),Hue=lv(),Vue=yp(),zue=Dp(),Gue=fv(),Kue=Gj(),Wue=Kc(),Xue=Wr(),Yue=Xc(),Jue=aB(),Zue=cB(),Que=fB(),ece=pB(),tce=gB(),rce=vp(),nce=EB(),ice=CB(),sce=OB(),oce=TB(),ace=NB();jB.exports={parse:Sue,valid:Aue,clean:Oue,inc:xue,diff:Tue,major:Fue,minor:Iue,patch:Pue,prerelease:kue,compare:Rue,rcompare:Nue,compareLoose:$ue,compareBuild:Lue,sort:jue,rsort:Bue,gt:Mue,lt:que,eq:Uue,neq:Hue,gte:Vue,lte:zue,cmp:Gue,coerce:Kue,Comparator:Wue,Range:Xue,satisfies:Yue,toComparators:Jue,maxSatisfying:Zue,minSatisfying:Que,minVersion:ece,validRange:tce,outside:rce,gtr:nce,ltr:ice,intersects:sce,simplifyRange:oce,subset:ace,SemVer:Cue,re:Ev.re,src:Ev.src,tokens:Ev.t,SEMVER_SPEC_VERSION:$B.SEMVER_SPEC_VERSION,RELEASE_TYPES:$B.RELEASE_TYPES,compareIdentifiers:LB.compareIdentifiers,rcompareIdentifiers:LB.rcompareIdentifiers}});var JB=v(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.parseApkNameFromFlavor=Q.checkJDKMajorVersion=Q.resolvePlatform=Q.checkPlatformVersions=Q.getAddedPlatforms=Q.getPlatformTargetName=Q.promptForPlatformTarget=Q.promptForPlatform=Q.isValidEnterprisePlatform=Q.getKnownEnterprisePlatforms=Q.isValidCommunityPlatform=Q.getKnownCommunityPlatforms=Q.isValidPlatform=Q.getKnownPlatforms=Q.selectPlatforms=Q.getProjectPlatformDirectory=Q.getCLIVersion=Q.getCoreVersion=Q.getCapacitorPackageVersion=Q.requireCapacitorPackage=Q.getCapacitorPackage=Q.runTask=Q.runPlatformHook=Q.runHooks=Q.wait=Q.checkAppName=Q.checkAppId=Q.checkAppDir=Q.checkAppConfig=Q.checkCapacitorPlatform=Q.checkPackage=Q.checkWebDir=Q.check=void 0;var Zc=(fe(),ue(le)),MB=Li(),Yi=wa(),to=require("path"),je=Zc.__importDefault(ba()),qa=nd(),UB=yc(),uce=qN(),qB=Ol(),Jc=xd(),cce=cp();async function lce(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
|
|
204
204
|
`)}Q.check=lce;async function fce(t){var e;return!((e=t.app.extConfig.server)===null||e===void 0)&&e.url?null:["",".","..","../","./"].includes(t.app.webDir)?`"${t.app.webDir}" is not a valid value for webDir`:await(0,Yi.pathExists)(t.app.webDirAbs)?await(0,Yi.pathExists)((0,to.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${je.default.strong((0,MB.prettyPath)(t.app.webDirAbs))}) must contain an ${je.default.strong("index.html")} file.
|
|
205
205
|
It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${je.default.strong((0,MB.prettyPath)(t.app.webDirAbs))}.
|
|
206
206
|
Please create it and make sure it has an ${je.default.strong("index.html")} file. You can change the path of this directory in ${je.default.strong(t.app.extConfigName)} (${je.default.input("webDir")} option). You may need to compile the web assets for your app (typically ${je.default.input("npm run build")}). More info: ${je.default.strong("https://capacitorjs.com/docs/basics/workflow#sync-your-project")}`}Q.checkWebDir=fce;async function hce(){return await(0,Yi.pathExists)("package.json")||await(0,Yi.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
|
|
@@ -227,15 +227,15 @@ To use ${ro.default.strong(e)} files, you must install TypeScript in your projec
|
|
|
227
227
|
|
|
228
228
|
${(n=i.stack)!==null&&n!==void 0?n:i}`),i}}async function Vce(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(i){(0,Op.fatal)(`Parsing ${ro.default.strong(e)} failed.
|
|
229
229
|
|
|
230
|
-
${(n=i.stack)!==null&&n!==void 0?n:i}`)}}async function zce(t){var e;let r=(0,ye.resolve)(t,jt.CONFIG_FILE_NAME_TS);if(await(0,Ar.pathExists)(r))return Hce(t,jt.CONFIG_FILE_NAME_TS,r);let n=(0,ye.resolve)(t,jt.CONFIG_FILE_NAME_JS);if(await(0,Ar.pathExists)(n))return Vce(t,jt.CONFIG_FILE_NAME_JS,n);let i=(0,ye.resolve)(t,jt.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:jt.CONFIG_FILE_NAME_JSON,extConfigFilePath:i,extConfig:(e=await(0,Ov.tryFn)(Ar.readJSON,i))!==null&&e!==void 0?e:{}}}async function Gce(t){let e="assets",r=(0,ye.join)(t,e),n="ios-pods-template.tar.gz",i="capacitor-cordova-ios-plugins.tar.gz",s="android-template.tar.gz",o="capacitor-cordova-android-plugins.tar.gz";return{rootDir:t,assetsDir:e,assetsDirAbs:r,assets:{ios:{platformTemplateArchive:n,platformTemplateArchiveAbs:(0,ye.resolve)(r,n),cordovaPluginsTemplateArchive:i,cordovaPluginsTemplateArchiveAbs:(0,ye.resolve)(r,i)},android:{platformTemplateArchive:s,platformTemplateArchiveAbs:(0,ye.resolve)(r,s),cordovaPluginsTemplateArchive:o,cordovaPluginsTemplateArchiveAbs:(0,ye.resolve)(r,o)}},package:await(0,Ar.readJSON)((0,ye.resolve)(t,"package.json")),os:Yce(process.platform)}}async function Kce(t,e,r){var n,i,s,o,a,u,c,l,h,d,f,m,g,b,S,A,p;let
|
|
230
|
+
${(n=i.stack)!==null&&n!==void 0?n:i}`)}}async function zce(t){var e;let r=(0,ye.resolve)(t,jt.CONFIG_FILE_NAME_TS);if(await(0,Ar.pathExists)(r))return Hce(t,jt.CONFIG_FILE_NAME_TS,r);let n=(0,ye.resolve)(t,jt.CONFIG_FILE_NAME_JS);if(await(0,Ar.pathExists)(n))return Vce(t,jt.CONFIG_FILE_NAME_JS,n);let i=(0,ye.resolve)(t,jt.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:jt.CONFIG_FILE_NAME_JSON,extConfigFilePath:i,extConfig:(e=await(0,Ov.tryFn)(Ar.readJSON,i))!==null&&e!==void 0?e:{}}}async function Gce(t){let e="assets",r=(0,ye.join)(t,e),n="ios-pods-template.tar.gz",i="capacitor-cordova-ios-plugins.tar.gz",s="android-template.tar.gz",o="capacitor-cordova-android-plugins.tar.gz";return{rootDir:t,assetsDir:e,assetsDirAbs:r,assets:{ios:{platformTemplateArchive:n,platformTemplateArchiveAbs:(0,ye.resolve)(r,n),cordovaPluginsTemplateArchive:i,cordovaPluginsTemplateArchiveAbs:(0,ye.resolve)(r,i)},android:{platformTemplateArchive:s,platformTemplateArchiveAbs:(0,ye.resolve)(r,s),cordovaPluginsTemplateArchive:o,cordovaPluginsTemplateArchiveAbs:(0,ye.resolve)(r,o)}},package:await(0,Ar.readJSON)((0,ye.resolve)(t,"package.json")),os:Yce(process.platform)}}async function Kce(t,e,r){var n,i,s,o,a,u,c,l,h,d,f,m,g,b,S,A,p;let D="android",w=(i=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&i!==void 0?i:"android",_=(0,ye.resolve)(t,w),P="app",E=`${P}/src`,R=`${E}/main`,k=`${R}/assets`,F=`${k}/public`,j=`${R}/res`,U=`${P}/build/outputs/apk/`,G=((s=e.android)===null||s===void 0?void 0:s.flavor)||"";!((o=e.android)===null||o===void 0)&&o.flavor&&(U=`${U}/${(a=e.android)===null||a===void 0?void 0:a.flavor}`);let L=(0,Lce.parseApkNameFromFlavor)(G),C=`${U}/debug`,T="capacitor-cordova-android-plugins",I=(0,Ua.lazy)(()=>Qce(r.os)),$={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(h=(l=e.android)===null||l===void 0?void 0:l.buildOptions)===null||h===void 0?void 0:h.keystorePassword,keystoreAlias:(f=(d=e.android)===null||d===void 0?void 0:d.buildOptions)===null||f===void 0?void 0:f.keystoreAlias,keystoreAliasPassword:(g=(m=e.android)===null||m===void 0?void 0:m.buildOptions)===null||g===void 0?void 0:g.keystoreAliasPassword,signingType:(S=(b=e.android)===null||b===void 0?void 0:b.buildOptions)===null||S===void 0?void 0:S.signingType,releaseType:(p=(A=e.android)===null||A===void 0?void 0:A.buildOptions)===null||p===void 0?void 0:p.releaseType};return{name:D,minVersion:"23",studioPath:I,platformDir:w,platformDirAbs:_,cordovaPluginsDir:T,cordovaPluginsDirAbs:(0,ye.resolve)(_,T),appDir:P,appDirAbs:(0,ye.resolve)(_,P),srcDir:E,srcDirAbs:(0,ye.resolve)(_,E),srcMainDir:R,srcMainDirAbs:(0,ye.resolve)(_,R),assetsDir:k,assetsDirAbs:(0,ye.resolve)(_,k),webDir:F,webDirAbs:(0,ye.resolve)(_,F),resDir:j,resDirAbs:(0,ye.resolve)(_,j),apkName:L,buildOutputDir:C,buildOutputDirAbs:(0,ye.resolve)(_,C),flavor:G,buildOptions:$}}async function Wce(t,e){var r,n,i,s,o,a,u,c,l,h,d,f;let g=(n=(r=e.ios)===null||r===void 0?void 0:r.path)!==null&&n!==void 0?n:"ios",b=(0,ye.resolve)(t,g),S=(s=(i=e.ios)===null||i===void 0?void 0:i.scheme)!==null&&s!==void 0?s:"App",A="App",p=(0,ye.resolve)(b,A),D=`${A}/App`,w=(0,ye.resolve)(b,D),_=`${A}/App.xcodeproj`,P=(0,ye.resolve)(b,_),E=(0,Ua.lazy)(()=>Jce(p)),R=(0,Ua.lazy)(()=>ele(t,b,p)),k=(0,Ua.lazy)(()=>Zce(p,w,P)),F="capacitor-cordova-ios-plugins",j={exportMethod:(a=(o=e.ios)===null||o===void 0?void 0:o.buildOptions)===null||a===void 0?void 0:a.exportMethod,xcodeSigningStyle:(c=(u=e.ios)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.signingStyle,signingCertificate:(h=(l=e.ios)===null||l===void 0?void 0:l.buildOptions)===null||h===void 0?void 0:h.signingCertificate,provisioningProfile:(f=(d=e.ios)===null||d===void 0?void 0:d.buildOptions)===null||f===void 0?void 0:f.provisioningProfile};return{name:"ios",minVersion:"14.0",platformDir:g,platformDirAbs:b,scheme:S,cordovaPluginsDir:F,cordovaPluginsDirAbs:(0,ye.resolve)(b,F),nativeProjectDir:A,nativeProjectDirAbs:p,nativeTargetDir:D,nativeTargetDirAbs:w,nativeXcodeProjDir:_,nativeXcodeProjDirAbs:P,nativeXcodeWorkspaceDir:(0,Ua.lazy)(async()=>(0,ye.relative)(b,await E)),nativeXcodeWorkspaceDirAbs:E,webDir:(0,Ua.lazy)(async()=>(0,ye.relative)(b,await k)),webDirAbs:k,podPath:R,buildOptions:j}}async function Xce(t,e){let r=e,n=(0,ye.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function Yce(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function Jce(t){return(0,ye.resolve)(t,"App.xcworkspace")}async function Zce(t,e,r){let n=/path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/,i=(0,ye.resolve)(r,"project.pbxproj");try{let o=(await(0,Ar.readFile)(i,{encoding:"utf8"})).match(n);if(o&&o[1]==="SOURCE_ROOT")return jce.logger.warn(`Using the iOS project root for the ${ro.default.strong("public")} directory is deprecated.
|
|
231
231
|
Please follow the Upgrade Guide to move ${ro.default.strong("public")} inside the iOS target directory: ${ro.default.strong("https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory")}`),(0,ye.resolve)(t,"public")}catch{}return(0,ye.resolve)(e,"public")}async function Qce(t){if(process.env.CAPACITOR_ANDROID_STUDIO_PATH)return process.env.CAPACITOR_ANDROID_STUDIO_PATH;switch(t){case"mac":return"/Applications/Android Studio.app";case"windows":{let{runCommand:e}=await Promise.resolve().then(()=>xv.__importStar(cp())),r="C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";try{if(!await(0,Ar.pathExists)(r)){let n=await e("REG",["QUERY","HKEY_LOCAL_MACHINE\\SOFTWARE\\Android Studio","/v","Path"]);n=n.replace(/(\r\n|\n|\r)/gm,"");let i=n.indexOf("REG_SZ");i>0&&(r=n.substring(i+6).trim()+"\\bin\\studio64.exe")}}catch(n){n8("Error checking registry for Android Studio path: %O",n);break}return r}case"linux":return"/usr/local/android-studio/bin/studio.sh"}return""}async function ele(t,e,r){if(process.env.CAPACITOR_COCOAPODS_PATH)return process.env.CAPACITOR_COCOAPODS_PATH;let n="";if(await(0,Ar.pathExists)((0,ye.resolve)(t,"Gemfile"))?n=(0,ye.resolve)(t,"Gemfile"):await(0,Ar.pathExists)((0,ye.resolve)(e,"Gemfile"))?n=(0,ye.resolve)(e,"Gemfile"):await(0,Ar.pathExists)((0,ye.resolve)(r,"Gemfile"))&&(n=(0,ye.resolve)(r,"Gemfile")),!(n!=""))try{let s=await(0,Mce.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});s!=null&&(n=(0,ye.resolve)(s,"Gemfile"))}catch{}try{let s=(await(0,Ar.readFile)(n)).toString();return s&&new RegExp(/gem\s+['"]cocoapods/).test(s)?"bundle exec pod":"pod"}catch{return"pod"}}function tle(t){return`import type { CapacitorConfig } from '@capacitor/cli';
|
|
232
232
|
|
|
233
233
|
const config: CapacitorConfig = ${(0,Bce.formatJSObject)(t)};
|
|
234
234
|
|
|
235
235
|
export default config;
|
|
236
236
|
`}});function rle(){try{return Iv.default.statSync("/.dockerenv"),!0}catch{return!1}}function nle(){try{return Iv.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Pv(){return Fv===void 0&&(Fv=rle()||nle()),Fv}var Iv,Fv,o8=Rr(()=>{Iv=Oe(require("node:fs"),1)});function Va(){return kv===void 0&&(kv=ile()||Pv()),kv}var a8,kv,ile,Rv=Rr(()=>{a8=Oe(require("node:fs"),1);o8();ile=()=>{try{return a8.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var Nv,c8,l8,u8,Zi,$v=Rr(()=>{Nv=Oe(require("node:process"),1),c8=Oe(require("node:os"),1),l8=Oe(require("node:fs"),1);Rv();u8=()=>{if(Nv.default.platform!=="linux")return!1;if(c8.default.release().toLowerCase().includes("microsoft"))return!Va();try{return l8.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Va():!1}catch{return!1}},Zi=Nv.default.env.__IS_WSL_TEST__?u8:u8()});var Lv,el,sle,ole,jv,f8=Rr(()=>{Lv=Oe(require("node:process"),1),el=Oe(require("node:fs/promises"),1);$v();$v();sle=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await el.default.access(r,el.constants.F_OK),n=!0}catch{}if(!n)return t;let i=await el.default.readFile(r,{encoding:"utf8"}),s=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return s?(e=s.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),ole=async()=>`${await sle()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,jv=async()=>Zi?ole():`${Lv.default.env.SYSTEMROOT||Lv.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`});function Qi(t,e,r){let n=i=>Object.defineProperty(t,e,{value:i,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let i=r();return n(i),i},set(i){n(i)}}),t}var h8=Rr(()=>{});async function Bv(){if(p8.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await ale("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari"}var d8,p8,m8,ale,g8=Rr(()=>{d8=require("node:util"),p8=Oe(require("node:process"),1),m8=require("node:child_process"),ale=(0,d8.promisify)(m8.execFile)});async function w8(t,{humanReadableOutput:e=!0,signal:r}={}){if(y8.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],i={};r&&(i.signal=r);let{stdout:s}=await ule("osascript",["-e",t,n],i);return s.trim()}var y8,D8,Mv,ule,b8=Rr(()=>{y8=Oe(require("node:process"),1),D8=require("node:util"),Mv=require("node:child_process"),ule=(0,D8.promisify)(Mv.execFile)});async function qv(t){return w8(`tell application "Finder" to set app_path to application file id "${t}" as string
|
|
237
|
-
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var v8=Rr(()=>{b8()});async function Uv(t=cle){let{stdout:e}=await t("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e);if(!r)throw new xp(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,i=lle[n];if(!i)throw new xp(`Unknown browser ID: ${n}`);return i}var E8,_8,cle,lle,xp,C8=Rr(()=>{E8=require("node:util"),_8=require("node:child_process"),cle=(0,E8.promisify)(_8.execFile),lle={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},xp=class extends Error{}});async function Hv(){if(Tp.default.platform==="darwin"){let t=await Bv();return{name:await qv(t),id:t}}if(Tp.default.platform==="linux"){let{stdout:t}=await fle("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:hle(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Tp.default.platform==="win32")return Uv();throw new Error("Only macOS, Linux, and Windows are supported")}var S8,Tp,A8,fle,hle,O8=Rr(()=>{S8=require("node:util"),Tp=Oe(require("node:process"),1),A8=require("node:child_process");g8();v8();C8();fle=(0,S8.promisify)(A8.execFile),hle=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Xv={};lm(Xv,{apps:()=>es,default:()=>yle,openApp:()=>gle});async function ple(){let t=await jv(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,r=Gv.Buffer.from(e,"utf16le").toString("base64"),{stdout:n}=await dle(t,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",r],{encoding:"utf8"}),i=n.trim(),s={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return s[i]?{id:s[i]}:{}}function I8(t){if(typeof t=="string"||Array.isArray(t))return t;let{[T8]:e}=t;if(!e)throw new Error(`${T8} is not supported`);return e}function Ip({[za]:t},{wsl:e}){if(e&&Zi)return I8(e);if(!t)throw new Error(`${za} is not supported`);return I8(t)}var zv,Gv,Kv,P8,k8,Wv,Fp,Dle,dle,Vv,x8,za,T8,F8,tl,mle,gle,es,yle,Yv=Rr(()=>{zv=Oe(require("node:process"),1),Gv=require("node:buffer"),Kv=Oe(require("node:path"),1),P8=require("node:url"),k8=require("node:util"),Wv=Oe(require("node:child_process"),1),Fp=Oe(require("node:fs/promises"),1);f8();h8();O8();Rv();Dle={},dle=(0,k8.promisify)(Wv.default.execFile),Vv=Kv.default.dirname((0,P8.fileURLToPath)(Dle.url)),x8=Kv.default.join(Vv,"xdg-open"),{platform:za,arch:T8}=zv.default;F8=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(i){r=i}throw r},tl=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return F8(t.app,a=>tl({...t,app:a}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return F8(e,a=>tl({...t,app:{name:a,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let a={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},u={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},c=Zi?await ple():await Hv();if(c.id in a){let l=a[c.id];return e==="browserPrivate"&&r.push(u[l]),tl({...t,app:{name:es[l],arguments:r}})}throw new Error(`${c.name} is not supported as a default browser`)}let n,i=[],s={};if(za==="darwin")n="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),e&&i.push("-a",e);else if(za==="win32"||Zi&&!Va()&&!e){n=await jv(),i.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),Zi||(s.windowsVerbatimArguments=!0);let a=["Start"];t.wait&&a.push("-Wait"),e?(a.push(`"\`"${e}\`""`),t.target&&r.push(t.target)):t.target&&a.push(`"${t.target}"`),r.length>0&&(r=r.map(u=>`"\`"${u}\`""`),a.push("-ArgumentList",r.join(","))),t.target=Gv.Buffer.from(a.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let a=!Vv||Vv==="/",u=!1;try{await Fp.default.access(x8,Fp.constants.X_OK),u=!0}catch{}n=zv.default.versions.electron??(za==="android"||a||!u)?"xdg-open":x8}r.length>0&&i.push(...r),t.wait||(s.stdio="ignore",s.detached=!0)}za==="darwin"&&r.length>0&&i.push("--args",...r),t.target&&i.push(t.target);let o=Wv.default.spawn(n,i,s);return t.wait?new Promise((a,u)=>{o.once("error",u),o.once("close",c=>{if(!t.allowNonzeroExitCode&&c>0){u(new Error(`Exited with code ${c}`));return}a(o)})}):(o.unref(),o)},mle=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return tl({...e,target:t})},gle=(t,e)=>{if(typeof t!="string"&&!Array.isArray(t))throw new TypeError("Expected a valid `name`");let{arguments:r=[]}=e??{};if(r!=null&&!Array.isArray(r))throw new TypeError("Expected `appArguments` as Array type");return tl({...e,app:{name:t,arguments:r}})};es={};Qi(es,"chrome",()=>Ip({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));Qi(es,"brave",()=>Ip({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));Qi(es,"firefox",()=>Ip({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Qi(es,"edge",()=>Ip({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));Qi(es,"browser",()=>"browser");Qi(es,"browserPrivate",()=>"browserPrivate");yle=mle});var em=v(Jr=>{"use strict";Jr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Jr.find=(t,e)=>t.nodes.find(r=>r.type===e);Jr.exceedsLimit=(t,e,r=1,n)=>n===!1||!Jr.isInteger(t)||!Jr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;Jr.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};Jr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;Jr.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;Jr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Jr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);Jr.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let s=n[i];if(Array.isArray(s)){r(s);continue}s!==void 0&&e.push(s)}return e};return r(t),e}});var tm=v((uCe,YM)=>{"use strict";var XM=em();YM.exports=(t,e={})=>{let r=(n,i={})=>{let s=e.escapeInvalid&&XM.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(s||o)&&XM.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let u of n.nodes)a+=r(u);return a};return r(t)}});var ZM=v((cCe,JM)=>{"use strict";JM.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var aq=v((lCe,oq)=>{"use strict";var QM=ZM(),fo=(t,e,r)=>{if(QM(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(QM(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let i=String(n.relaxZeros),s=String(n.shorthand),o=String(n.capture),a=String(n.wrap),u=t+":"+e+"="+i+s+o+a;if(fo.cache.hasOwnProperty(u))return fo.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let g=t+"|"+e;return n.capture?`(${g})`:n.wrap===!1?g:`(?:${g})`}let h=sq(t)||sq(e),d={min:t,max:e,a:c,b:l},f=[],m=[];if(h&&(d.isPadded=h,d.maxLen=String(d.max).length),c<0){let g=l<0?Math.abs(l):1;m=eq(g,Math.abs(c),d,n),c=d.a=0}return l>=0&&(f=eq(c,l,d,n)),d.negatives=m,d.positives=f,d.result=nfe(m,f,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&f.length+m.length>1&&(d.result=`(?:${d.result})`),fo.cache[u]=d,d.result};function nfe(t,e,r){let n=pE(t,e,"-",!1,r)||[],i=pE(e,t,"",!1,r)||[],s=pE(t,e,"-?",!0,r)||[];return n.concat(s).concat(i).join("|")}function ife(t,e){let r=1,n=1,i=rq(t,r),s=new Set([e]);for(;t<=i&&i<=e;)s.add(i),r+=1,i=rq(t,r);for(i=nq(e+1,n)-1;t<i&&i<=e;)s.add(i),n+=1,i=nq(e+1,n)-1;return s=[...s],s.sort(afe),s}function sfe(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=ofe(t,e),i=n.length,s="",o=0;for(let a=0;a<i;a++){let[u,c]=n[a];u===c?s+=u:u!=="0"||c!=="9"?s+=ufe(u,c,r):o++}return o&&(s+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[o],digits:i}}function eq(t,e,r,n){let i=ife(t,e),s=[],o=t,a;for(let u=0;u<i.length;u++){let c=i[u],l=sfe(String(o),String(c),n),h="";if(!r.isPadded&&a&&a.pattern===l.pattern){a.count.length>1&&a.count.pop(),a.count.push(l.count[0]),a.string=a.pattern+iq(a.count),o=c+1;continue}r.isPadded&&(h=cfe(c,r,n)),l.string=h+l.pattern+iq(l.count),s.push(l),o=c+1,a=l}return s}function pE(t,e,r,n,i){let s=[];for(let o of t){let{string:a}=o;!n&&!tq(e,"string",a)&&s.push(r+a),n&&tq(e,"string",a)&&s.push(r+a)}return s}function ofe(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function afe(t,e){return t>e?1:e>t?-1:0}function tq(t,e,r){return t.some(n=>n[e]===r)}function rq(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function nq(t,e){return t-t%Math.pow(10,e)}function iq(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function ufe(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function sq(t){return/^-?(0+)\d/.test(t)}function cfe(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}fo.cache={};fo.clearCache=()=>fo.cache={};oq.exports=fo});var yE=v((fCe,pq)=>{"use strict";var lfe=require("util"),cq=aq(),uq=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),ffe=t=>e=>t===!0?Number(e):String(e),mE=t=>typeof t=="number"||typeof t=="string"&&t!=="",fl=t=>Number.isInteger(+t),gE=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},hfe=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,dfe=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},nm=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},pfe=(t,e,r)=>{t.negatives.sort((a,u)=>a<u?-1:a>u?1:0),t.positives.sort((a,u)=>a<u?-1:a>u?1:0);let n=e.capture?"":"?:",i="",s="",o;return t.positives.length&&(i=t.positives.map(a=>nm(String(a),r)).join("|")),t.negatives.length&&(s=`-(${n}${t.negatives.map(a=>nm(String(a),r)).join("|")})`),i&&s?o=`${i}|${s}`:o=i||s,e.wrap?`(${n}${o})`:o},lq=(t,e,r,n)=>{if(r)return cq(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let s=String.fromCharCode(e);return`[${i}-${s}]`},fq=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return cq(t,e,r)},hq=(...t)=>new RangeError("Invalid range arguments: "+lfe.inspect(...t)),dq=(t,e,r)=>{if(r.strictRanges===!0)throw hq([t,e]);return[]},mfe=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},gfe=(t,e,r=1,n={})=>{let i=Number(t),s=Number(e);if(!Number.isInteger(i)||!Number.isInteger(s)){if(n.strictRanges===!0)throw hq([t,e]);return[]}i===0&&(i=0),s===0&&(s=0);let o=i>s,a=String(t),u=String(e),c=String(r);r=Math.max(Math.abs(r),1);let l=gE(a)||gE(u)||gE(c),h=l?Math.max(a.length,u.length,c.length):0,d=l===!1&&hfe(t,e,n)===!1,f=n.transform||ffe(d);if(n.toRegex&&r===1)return lq(nm(t,h),nm(e,h),!0,n);let m={negatives:[],positives:[]},g=A=>m[A<0?"negatives":"positives"].push(Math.abs(A)),b=[],S=0;for(;o?i>=s:i<=s;)n.toRegex===!0&&r>1?g(i):b.push(dfe(f(i,S),h,d)),i=o?i-r:i+r,S++;return n.toRegex===!0?r>1?pfe(m,n,h):fq(b,null,{wrap:!1,...n}):b},yfe=(t,e,r=1,n={})=>{if(!fl(t)&&t.length>1||!fl(e)&&e.length>1)return dq(t,e,n);let i=n.transform||(d=>String.fromCharCode(d)),s=`${t}`.charCodeAt(0),o=`${e}`.charCodeAt(0),a=s>o,u=Math.min(s,o),c=Math.max(s,o);if(n.toRegex&&r===1)return lq(u,c,!1,n);let l=[],h=0;for(;a?s>=o:s<=o;)l.push(i(s,h)),s=a?s-r:s+r,h++;return n.toRegex===!0?fq(l,null,{wrap:!1,options:n}):l},rm=(t,e,r,n={})=>{if(e==null&&mE(t))return[t];if(!mE(t)||!mE(e))return dq(t,e,n);if(typeof r=="function")return rm(t,e,1,{transform:r});if(uq(r))return rm(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,fl(r)?fl(t)&&fl(e)?gfe(t,e,r,i):yfe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!uq(r)?mfe(r,i):rm(t,e,1,r)};pq.exports=rm});var yq=v((hCe,gq)=>{"use strict";var Dfe=yE(),mq=em(),wfe=(t,e={})=>{let r=(n,i={})=>{let s=mq.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a=s===!0||o===!0,u=e.escapeInvalid===!0?"\\":"",c="";if(n.isOpen===!0)return u+n.value;if(n.isClose===!0)return console.log("node.isClose",u,n.value),u+n.value;if(n.type==="open")return a?u+n.value:"(";if(n.type==="close")return a?u+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=mq.reduce(n.nodes),h=Dfe(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(h.length!==0)return l.length>1&&h.length>1?`(${h})`:h}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};gq.exports=wfe});var bq=v((dCe,wq)=>{"use strict";var bfe=yE(),Dq=tm(),iu=em(),ho=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?iu.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let s of i)n.push(ho(s,e,r));else for(let s of e)r===!0&&typeof s=="string"&&(s=`{${s}}`),n.push(Array.isArray(s)?ho(i,s,r):i+s);return iu.flatten(n)},vfe=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,s={})=>{i.queue=[];let o=s,a=s.queue;for(;o.type!=="brace"&&o.type!=="root"&&o.parent;)o=o.parent,a=o.queue;if(i.invalid||i.dollar){a.push(ho(a.pop(),Dq(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(ho(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let h=iu.reduce(i.nodes);if(iu.exceedsLimit(...h,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let d=bfe(...h,e);d.length===0&&(d=Dq(i,e)),a.push(ho(a.pop(),d)),i.nodes=[];return}let u=iu.encloseBrace(i),c=i.queue,l=i;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let h=0;h<i.nodes.length;h++){let d=i.nodes[h];if(d.type==="comma"&&i.type==="brace"){h===1&&c.push(""),c.push("");continue}if(d.type==="close"){a.push(ho(a.pop(),c,u));continue}if(d.value&&d.type!=="open"){c.push(ho(c.pop(),d.value));continue}d.nodes&&n(d,i)}return c};return iu.flatten(n(t))};wq.exports=vfe});var Eq=v((pCe,vq)=>{"use strict";vq.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
|
238
|
-
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var Oq=v((mCe,Aq)=>{"use strict";var Efe=tm(),{MAX_LENGTH:_q,CHAR_BACKSLASH:DE,CHAR_BACKTICK:_fe,CHAR_COMMA:Cfe,CHAR_DOT:Sfe,CHAR_LEFT_PARENTHESES:Afe,CHAR_RIGHT_PARENTHESES:Ofe,CHAR_LEFT_CURLY_BRACE:xfe,CHAR_RIGHT_CURLY_BRACE:Tfe,CHAR_LEFT_SQUARE_BRACKET:Cq,CHAR_RIGHT_SQUARE_BRACKET:Sq,CHAR_DOUBLE_QUOTE:Ffe,CHAR_SINGLE_QUOTE:Ife,CHAR_NO_BREAK_SPACE:Pfe,CHAR_ZERO_WIDTH_NOBREAK_SPACE:kfe}=Eq(),Rfe=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(_q,r.maxLength):_q;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let i={type:"root",input:t,nodes:[]},s=[i],o=i,a=i,u=0,c=t.length,l=0,h=0,d,f=()=>t[l++],m=g=>{if(g.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&g.type==="text"){a.value+=g.value;return}return o.nodes.push(g),g.parent=o,g.prev=a,a=g,g};for(m({type:"bos"});l<c;)if(o=s[s.length-1],d=f(),!(d===kfe||d===Pfe)){if(d===DE){m({type:"text",value:(e.keepEscaping?d:"")+f()});continue}if(d===Sq){m({type:"text",value:"\\"+d});continue}if(d===Cq){u++;let g;for(;l<c&&(g=f());){if(d+=g,g===Cq){u++;continue}if(g===DE){d+=f();continue}if(g===Sq&&(u--,u===0))break}m({type:"text",value:d});continue}if(d===Afe){o=m({type:"paren",nodes:[]}),s.push(o),m({type:"text",value:d});continue}if(d===Ofe){if(o.type!=="paren"){m({type:"text",value:d});continue}o=s.pop(),m({type:"text",value:d}),o=s[s.length-1];continue}if(d===Ffe||d===Ife||d===_fe){let g=d,b;for(e.keepQuotes!==!0&&(d="");l<c&&(b=f());){if(b===DE){d+=b+f();continue}if(b===g){e.keepQuotes===!0&&(d+=b);break}d+=b}m({type:"text",value:d});continue}if(d===xfe){h++;let b={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||o.dollar===!0,depth:h,commas:0,ranges:0,nodes:[]};o=m(b),s.push(o),m({type:"open",value:d});continue}if(d===Tfe){if(o.type!=="brace"){m({type:"text",value:d});continue}let g="close";o=s.pop(),o.close=!0,m({type:g,value:d}),h--,o=s[s.length-1];continue}if(d===Cfe&&h>0){if(o.ranges>0){o.ranges=0;let g=o.nodes.shift();o.nodes=[g,{type:"text",value:Efe(o)}]}m({type:"comma",value:d}),o.commas++;continue}if(d===Sfe&&h>0&&o.commas===0){let g=o.nodes;if(h===0||g.length===0){m({type:"text",value:d});continue}if(a.type==="dot"){if(o.range=[],a.value+=d,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){g.pop();let b=g[g.length-1];b.value+=a.value+d,a=b,o.ranges--;continue}m({type:"dot",value:d});continue}m({type:"text",value:d})}do if(o=s.pop(),o.type!=="root"){o.nodes.forEach(S=>{S.nodes||(S.type==="open"&&(S.isOpen=!0),S.type==="close"&&(S.isClose=!0),S.nodes||(S.type="text"),S.invalid=!0)});let g=s[s.length-1],b=g.nodes.indexOf(o);g.nodes.splice(b,1,...o.nodes)}while(s.length>0);return m({type:"eos"}),i};Aq.exports=Rfe});var Fq=v((gCe,Tq)=>{"use strict";var xq=tm(),Nfe=yq(),$fe=bq(),Lfe=Oq(),Pr=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=Pr.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(Pr.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Pr.parse=(t,e={})=>Lfe(t,e);Pr.stringify=(t,e={})=>xq(typeof t=="string"?Pr.parse(t,e):t,e);Pr.compile=(t,e={})=>(typeof t=="string"&&(t=Pr.parse(t,e)),Nfe(t,e));Pr.expand=(t,e={})=>{typeof t=="string"&&(t=Pr.parse(t,e));let r=$fe(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Pr.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Pr.compile(t,e):Pr.expand(t,e);Tq.exports=Pr});var hl=v((yCe,Nq)=>{"use strict";var jfe=require("path"),Bn="\\\\/",Iq=`[^${Bn}]`,yi="\\.",Bfe="\\+",Mfe="\\?",im="\\/",qfe="(?=.)",Pq="[^/]",wE=`(?:${im}|$)`,kq=`(?:^|${im})`,bE=`${yi}{1,2}${wE}`,Ufe=`(?!${yi})`,Hfe=`(?!${kq}${bE})`,Vfe=`(?!${yi}{0,1}${wE})`,zfe=`(?!${bE})`,Gfe=`[^.${im}]`,Kfe=`${Pq}*?`,Rq={DOT_LITERAL:yi,PLUS_LITERAL:Bfe,QMARK_LITERAL:Mfe,SLASH_LITERAL:im,ONE_CHAR:qfe,QMARK:Pq,END_ANCHOR:wE,DOTS_SLASH:bE,NO_DOT:Ufe,NO_DOTS:Hfe,NO_DOT_SLASH:Vfe,NO_DOTS_SLASH:zfe,QMARK_NO_DOT:Gfe,STAR:Kfe,START_ANCHOR:kq},Wfe={...Rq,SLASH_LITERAL:`[${Bn}]`,QMARK:Iq,STAR:`${Iq}*?`,DOTS_SLASH:`${yi}{1,2}(?:[${Bn}]|$)`,NO_DOT:`(?!${yi})`,NO_DOTS:`(?!(?:^|[${Bn}])${yi}{1,2}(?:[${Bn}]|$))`,NO_DOT_SLASH:`(?!${yi}{0,1}(?:[${Bn}]|$))`,NO_DOTS_SLASH:`(?!${yi}{1,2}(?:[${Bn}]|$))`,QMARK_NO_DOT:`[^.${Bn}]`,START_ANCHOR:`(?:^|[${Bn}])`,END_ANCHOR:`(?:[${Bn}]|$)`},Xfe={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Nq.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Xfe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:jfe.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Wfe:Rq}}});var dl=v(Or=>{"use strict";var Yfe=require("path"),Jfe=process.platform==="win32",{REGEX_BACKSLASH:Zfe,REGEX_REMOVE_BACKSLASH:Qfe,REGEX_SPECIAL_CHARS:ehe,REGEX_SPECIAL_CHARS_GLOBAL:the}=hl();Or.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Or.hasRegexChars=t=>ehe.test(t);Or.isRegexChar=t=>t.length===1&&Or.hasRegexChars(t);Or.escapeRegex=t=>t.replace(the,"\\$1");Or.toPosixSlashes=t=>t.replace(Zfe,"/");Or.removeBackslashes=t=>t.replace(Qfe,e=>e==="\\"?"":e);Or.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Or.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:Jfe===!0||Yfe.sep==="\\";Or.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Or.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Or.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Or.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",s=`${n}(?:${t})${i}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s}});var Hq=v((wCe,Uq)=>{"use strict";var $q=dl(),{CHAR_ASTERISK:vE,CHAR_AT:rhe,CHAR_BACKWARD_SLASH:pl,CHAR_COMMA:nhe,CHAR_DOT:EE,CHAR_EXCLAMATION_MARK:_E,CHAR_FORWARD_SLASH:qq,CHAR_LEFT_CURLY_BRACE:CE,CHAR_LEFT_PARENTHESES:SE,CHAR_LEFT_SQUARE_BRACKET:ihe,CHAR_PLUS:she,CHAR_QUESTION_MARK:Lq,CHAR_RIGHT_CURLY_BRACE:ohe,CHAR_RIGHT_PARENTHESES:jq,CHAR_RIGHT_SQUARE_BRACKET:ahe}=hl(),Bq=t=>t===qq||t===pl,Mq=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},uhe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,s=[],o=[],a=[],u=t,c=-1,l=0,h=0,d=!1,f=!1,m=!1,g=!1,b=!1,S=!1,A=!1,p=!1,y=!1,w=!1,_=0,P,E,R={value:"",depth:0,isGlob:!1},k=()=>c>=n,F=()=>u.charCodeAt(c+1),j=()=>(P=E,u.charCodeAt(++c));for(;c<n;){E=j();let T;if(E===pl){A=R.backslashes=!0,E=j(),E===CE&&(S=!0);continue}if(S===!0||E===CE){for(_++;k()!==!0&&(E=j());){if(E===pl){A=R.backslashes=!0,j();continue}if(E===CE){_++;continue}if(S!==!0&&E===EE&&(E=j())===EE){if(d=R.isBrace=!0,m=R.isGlob=!0,w=!0,i===!0)continue;break}if(S!==!0&&E===nhe){if(d=R.isBrace=!0,m=R.isGlob=!0,w=!0,i===!0)continue;break}if(E===ohe&&(_--,_===0)){S=!1,d=R.isBrace=!0,w=!0;break}}if(i===!0)continue;break}if(E===qq){if(s.push(c),o.push(R),R={value:"",depth:0,isGlob:!1},w===!0)continue;if(P===EE&&c===l+1){l+=2;continue}h=c+1;continue}if(r.noext!==!0&&(E===she||E===rhe||E===vE||E===Lq||E===_E)===!0&&F()===SE){if(m=R.isGlob=!0,g=R.isExtglob=!0,w=!0,E===_E&&c===l&&(y=!0),i===!0){for(;k()!==!0&&(E=j());){if(E===pl){A=R.backslashes=!0,E=j();continue}if(E===jq){m=R.isGlob=!0,w=!0;break}}continue}break}if(E===vE){if(P===vE&&(b=R.isGlobstar=!0),m=R.isGlob=!0,w=!0,i===!0)continue;break}if(E===Lq){if(m=R.isGlob=!0,w=!0,i===!0)continue;break}if(E===ihe){for(;k()!==!0&&(T=j());){if(T===pl){A=R.backslashes=!0,j();continue}if(T===ahe){f=R.isBracket=!0,m=R.isGlob=!0,w=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&E===_E&&c===l){p=R.negated=!0,l++;continue}if(r.noparen!==!0&&E===SE){if(m=R.isGlob=!0,i===!0){for(;k()!==!0&&(E=j());){if(E===SE){A=R.backslashes=!0,E=j();continue}if(E===jq){w=!0;break}}continue}break}if(m===!0){if(w=!0,i===!0)continue;break}}r.noext===!0&&(g=!1,m=!1);let U=u,G="",L="";l>0&&(G=u.slice(0,l),u=u.slice(l),h-=l),U&&m===!0&&h>0?(U=u.slice(0,h),L=u.slice(h)):m===!0?(U="",L=u):U=u,U&&U!==""&&U!=="/"&&U!==u&&Bq(U.charCodeAt(U.length-1))&&(U=U.slice(0,-1)),r.unescape===!0&&(L&&(L=$q.removeBackslashes(L)),U&&A===!0&&(U=$q.removeBackslashes(U)));let C={prefix:G,input:t,start:l,base:U,glob:L,isBrace:d,isBracket:f,isGlob:m,isExtglob:g,isGlobstar:b,negated:p,negatedExtglob:y};if(r.tokens===!0&&(C.maxDepth=0,Bq(E)||o.push(R),C.tokens=o),r.parts===!0||r.tokens===!0){let T;for(let I=0;I<s.length;I++){let $=T?T+1:l,M=s[I],B=t.slice($,M);r.tokens&&(I===0&&l!==0?(o[I].isPrefix=!0,o[I].value=G):o[I].value=B,Mq(o[I]),C.maxDepth+=o[I].depth),(I!==0||B!=="")&&a.push(B),T=M}if(T&&T+1<t.length){let I=t.slice(T+1);a.push(I),r.tokens&&(o[o.length-1].value=I,Mq(o[o.length-1]),C.maxDepth+=o[o.length-1].depth)}C.slashes=s,C.parts=a}return C};Uq.exports=uhe});var Gq=v((bCe,zq)=>{"use strict";var sm=hl(),kr=dl(),{MAX_LENGTH:om,POSIX_REGEX_SOURCE:che,REGEX_NON_SPECIAL_CHARS:lhe,REGEX_SPECIAL_CHARS_BACKREF:fhe,REPLACEMENTS:Vq}=sm,hhe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>kr.escapeRegex(i)).join("..")}return r},su=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,AE=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=Vq[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(om,r.maxLength):om,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let s={type:"bos",value:"",output:r.prepend||""},o=[s],a=r.capture?"":"?:",u=kr.isWindows(e),c=sm.globChars(u),l=sm.extglobChars(c),{DOT_LITERAL:h,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:m,DOTS_SLASH:g,NO_DOT:b,NO_DOT_SLASH:S,NO_DOTS_SLASH:A,QMARK:p,QMARK_NO_DOT:y,STAR:w,START_ANCHOR:_}=c,P=N=>`(${a}(?:(?!${_}${N.dot?g:h}).)*?)`,E=r.dot?"":b,R=r.dot?p:y,k=r.bash===!0?P(r):w;r.capture&&(k=`(${k})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let F={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};t=kr.removePrefix(t,F),i=t.length;let j=[],U=[],G=[],L=s,C,T=()=>F.index===i-1,I=F.peek=(N=1)=>t[F.index+N],$=F.advance=()=>t[++F.index]||"",M=()=>t.slice(F.index+1),B=(N="",ne=0)=>{F.consumed+=N,F.index+=ne},K=N=>{F.output+=N.output!=null?N.output:N.value,B(N.value)},q=()=>{let N=1;for(;I()==="!"&&(I(2)!=="("||I(3)==="?");)$(),F.start++,N++;return N%2===0?!1:(F.negated=!0,F.start++,!0)},V=N=>{F[N]++,G.push(N)},ae=N=>{F[N]--,G.pop()},x=N=>{if(L.type==="globstar"){let ne=F.braces>0&&(N.type==="comma"||N.type==="brace"),z=N.extglob===!0||j.length&&(N.type==="pipe"||N.type==="paren");N.type!=="slash"&&N.type!=="paren"&&!ne&&!z&&(F.output=F.output.slice(0,-L.output.length),L.type="star",L.value="*",L.output=k,F.output+=L.output)}if(j.length&&N.type!=="paren"&&(j[j.length-1].inner+=N.value),(N.value||N.output)&&K(N),L&&L.type==="text"&&N.type==="text"){L.value+=N.value,L.output=(L.output||"")+N.value;return}N.prev=L,o.push(N),L=N},O=(N,ne)=>{let z={...l[ne],conditions:1,inner:""};z.prev=L,z.parens=F.parens,z.output=F.output;let ie=(r.capture?"(":"")+z.open;V("parens"),x({type:N,value:ne,output:F.output?"":m}),x({type:"paren",extglob:!0,value:$(),output:ie}),j.push(z)},H=N=>{let ne=N.close+(r.capture?")":""),z;if(N.type==="negate"){let ie=k;if(N.inner&&N.inner.length>1&&N.inner.includes("/")&&(ie=P(r)),(ie!==k||T()||/^\)+$/.test(M()))&&(ne=N.close=`)$))${ie}`),N.inner.includes("*")&&(z=M())&&/^\.[^\\/.]+$/.test(z)){let we=AE(z,{...e,fastpaths:!1}).output;ne=N.close=`)${we})${ie})`}N.prev.type==="bos"&&(F.negatedExtglob=!0)}x({type:"paren",extglob:!0,value:C,output:ne}),ae("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let N=!1,ne=t.replace(fhe,(z,ie,we,xe,Me,wt)=>xe==="\\"?(N=!0,z):xe==="?"?ie?ie+xe+(Me?p.repeat(Me.length):""):wt===0?R+(Me?p.repeat(Me.length):""):p.repeat(we.length):xe==="."?h.repeat(we.length):xe==="*"?ie?ie+xe+(Me?k:""):k:ie?z:`\\${z}`);return N===!0&&(r.unescape===!0?ne=ne.replace(/\\/g,""):ne=ne.replace(/\\+/g,z=>z.length%2===0?"\\\\":z?"\\":"")),ne===t&&r.contains===!0?(F.output=t,F):(F.output=kr.wrapOutput(ne,F,e),F)}for(;!T();){if(C=$(),C==="\0")continue;if(C==="\\"){let z=I();if(z==="/"&&r.bash!==!0||z==="."||z===";")continue;if(!z){C+="\\",x({type:"text",value:C});continue}let ie=/^\\+/.exec(M()),we=0;if(ie&&ie[0].length>2&&(we=ie[0].length,F.index+=we,we%2!==0&&(C+="\\")),r.unescape===!0?C=$():C+=$(),F.brackets===0){x({type:"text",value:C});continue}}if(F.brackets>0&&(C!=="]"||L.value==="["||L.value==="[^")){if(r.posix!==!1&&C===":"){let z=L.value.slice(1);if(z.includes("[")&&(L.posix=!0,z.includes(":"))){let ie=L.value.lastIndexOf("["),we=L.value.slice(0,ie),xe=L.value.slice(ie+2),Me=che[xe];if(Me){L.value=we+Me,F.backtrack=!0,$(),!s.output&&o.indexOf(L)===1&&(s.output=m);continue}}}(C==="["&&I()!==":"||C==="-"&&I()==="]")&&(C=`\\${C}`),C==="]"&&(L.value==="["||L.value==="[^")&&(C=`\\${C}`),r.posix===!0&&C==="!"&&L.value==="["&&(C="^"),L.value+=C,K({value:C});continue}if(F.quotes===1&&C!=='"'){C=kr.escapeRegex(C),L.value+=C,K({value:C});continue}if(C==='"'){F.quotes=F.quotes===1?0:1,r.keepQuotes===!0&&x({type:"text",value:C});continue}if(C==="("){V("parens"),x({type:"paren",value:C});continue}if(C===")"){if(F.parens===0&&r.strictBrackets===!0)throw new SyntaxError(su("opening","("));let z=j[j.length-1];if(z&&F.parens===z.parens+1){H(j.pop());continue}x({type:"paren",value:C,output:F.parens?")":"\\)"}),ae("parens");continue}if(C==="["){if(r.nobracket===!0||!M().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(su("closing","]"));C=`\\${C}`}else V("brackets");x({type:"bracket",value:C});continue}if(C==="]"){if(r.nobracket===!0||L&&L.type==="bracket"&&L.value.length===1){x({type:"text",value:C,output:`\\${C}`});continue}if(F.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(su("opening","["));x({type:"text",value:C,output:`\\${C}`});continue}ae("brackets");let z=L.value.slice(1);if(L.posix!==!0&&z[0]==="^"&&!z.includes("/")&&(C=`/${C}`),L.value+=C,K({value:C}),r.literalBrackets===!1||kr.hasRegexChars(z))continue;let ie=kr.escapeRegex(L.value);if(F.output=F.output.slice(0,-L.value.length),r.literalBrackets===!0){F.output+=ie,L.value=ie;continue}L.value=`(${a}${ie}|${L.value})`,F.output+=L.value;continue}if(C==="{"&&r.nobrace!==!0){V("braces");let z={type:"brace",value:C,output:"(",outputIndex:F.output.length,tokensIndex:F.tokens.length};U.push(z),x(z);continue}if(C==="}"){let z=U[U.length-1];if(r.nobrace===!0||!z){x({type:"text",value:C,output:C});continue}let ie=")";if(z.dots===!0){let we=o.slice(),xe=[];for(let Me=we.length-1;Me>=0&&(o.pop(),we[Me].type!=="brace");Me--)we[Me].type!=="dots"&&xe.unshift(we[Me].value);ie=hhe(xe,r),F.backtrack=!0}if(z.comma!==!0&&z.dots!==!0){let we=F.output.slice(0,z.outputIndex),xe=F.tokens.slice(z.tokensIndex);z.value=z.output="\\{",C=ie="\\}",F.output=we;for(let Me of xe)F.output+=Me.output||Me.value}x({type:"brace",value:C,output:ie}),ae("braces"),U.pop();continue}if(C==="|"){j.length>0&&j[j.length-1].conditions++,x({type:"text",value:C});continue}if(C===","){let z=C,ie=U[U.length-1];ie&&G[G.length-1]==="braces"&&(ie.comma=!0,z="|"),x({type:"comma",value:C,output:z});continue}if(C==="/"){if(L.type==="dot"&&F.index===F.start+1){F.start=F.index+1,F.consumed="",F.output="",o.pop(),L=s;continue}x({type:"slash",value:C,output:f});continue}if(C==="."){if(F.braces>0&&L.type==="dot"){L.value==="."&&(L.output=h);let z=U[U.length-1];L.type="dots",L.output+=C,L.value+=C,z.dots=!0;continue}if(F.braces+F.parens===0&&L.type!=="bos"&&L.type!=="slash"){x({type:"text",value:C,output:h});continue}x({type:"dot",value:C,output:h});continue}if(C==="?"){if(!(L&&L.value==="(")&&r.noextglob!==!0&&I()==="("&&I(2)!=="?"){O("qmark",C);continue}if(L&&L.type==="paren"){let ie=I(),we=C;if(ie==="<"&&!kr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(L.value==="("&&!/[!=<:]/.test(ie)||ie==="<"&&!/<([!=]|\w+>)/.test(M()))&&(we=`\\${C}`),x({type:"text",value:C,output:we});continue}if(r.dot!==!0&&(L.type==="slash"||L.type==="bos")){x({type:"qmark",value:C,output:y});continue}x({type:"qmark",value:C,output:p});continue}if(C==="!"){if(r.noextglob!==!0&&I()==="("&&(I(2)!=="?"||!/[!=<:]/.test(I(3)))){O("negate",C);continue}if(r.nonegate!==!0&&F.index===0){q();continue}}if(C==="+"){if(r.noextglob!==!0&&I()==="("&&I(2)!=="?"){O("plus",C);continue}if(L&&L.value==="("||r.regex===!1){x({type:"plus",value:C,output:d});continue}if(L&&(L.type==="bracket"||L.type==="paren"||L.type==="brace")||F.parens>0){x({type:"plus",value:C});continue}x({type:"plus",value:d});continue}if(C==="@"){if(r.noextglob!==!0&&I()==="("&&I(2)!=="?"){x({type:"at",extglob:!0,value:C,output:""});continue}x({type:"text",value:C});continue}if(C!=="*"){(C==="$"||C==="^")&&(C=`\\${C}`);let z=lhe.exec(M());z&&(C+=z[0],F.index+=z[0].length),x({type:"text",value:C});continue}if(L&&(L.type==="globstar"||L.star===!0)){L.type="star",L.star=!0,L.value+=C,L.output=k,F.backtrack=!0,F.globstar=!0,B(C);continue}let N=M();if(r.noextglob!==!0&&/^\([^?]/.test(N)){O("star",C);continue}if(L.type==="star"){if(r.noglobstar===!0){B(C);continue}let z=L.prev,ie=z.prev,we=z.type==="slash"||z.type==="bos",xe=ie&&(ie.type==="star"||ie.type==="globstar");if(r.bash===!0&&(!we||N[0]&&N[0]!=="/")){x({type:"star",value:C,output:""});continue}let Me=F.braces>0&&(z.type==="comma"||z.type==="brace"),wt=j.length&&(z.type==="pipe"||z.type==="paren");if(!we&&z.type!=="paren"&&!Me&&!wt){x({type:"star",value:C,output:""});continue}for(;N.slice(0,3)==="/**";){let dr=t[F.index+4];if(dr&&dr!=="/")break;N=N.slice(3),B("/**",3)}if(z.type==="bos"&&T()){L.type="globstar",L.value+=C,L.output=P(r),F.output=L.output,F.globstar=!0,B(C);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&!xe&&T()){F.output=F.output.slice(0,-(z.output+L.output).length),z.output=`(?:${z.output}`,L.type="globstar",L.output=P(r)+(r.strictSlashes?")":"|$)"),L.value+=C,F.globstar=!0,F.output+=z.output+L.output,B(C);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&N[0]==="/"){let dr=N[1]!==void 0?"|$":"";F.output=F.output.slice(0,-(z.output+L.output).length),z.output=`(?:${z.output}`,L.type="globstar",L.output=`${P(r)}${f}|${f}${dr})`,L.value+=C,F.output+=z.output+L.output,F.globstar=!0,B(C+$()),x({type:"slash",value:"/",output:""});continue}if(z.type==="bos"&&N[0]==="/"){L.type="globstar",L.value+=C,L.output=`(?:^|${f}|${P(r)}${f})`,F.output=L.output,F.globstar=!0,B(C+$()),x({type:"slash",value:"/",output:""});continue}F.output=F.output.slice(0,-L.output.length),L.type="globstar",L.output=P(r),L.value+=C,F.output+=L.output,F.globstar=!0,B(C);continue}let ne={type:"star",value:C,output:k};if(r.bash===!0){ne.output=".*?",(L.type==="bos"||L.type==="slash")&&(ne.output=E+ne.output),x(ne);continue}if(L&&(L.type==="bracket"||L.type==="paren")&&r.regex===!0){ne.output=C,x(ne);continue}(F.index===F.start||L.type==="slash"||L.type==="dot")&&(L.type==="dot"?(F.output+=S,L.output+=S):r.dot===!0?(F.output+=A,L.output+=A):(F.output+=E,L.output+=E),I()!=="*"&&(F.output+=m,L.output+=m)),x(ne)}for(;F.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(su("closing","]"));F.output=kr.escapeLast(F.output,"["),ae("brackets")}for(;F.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(su("closing",")"));F.output=kr.escapeLast(F.output,"("),ae("parens")}for(;F.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(su("closing","}"));F.output=kr.escapeLast(F.output,"{"),ae("braces")}if(r.strictSlashes!==!0&&(L.type==="star"||L.type==="bracket")&&x({type:"maybe_slash",value:"",output:`${f}?`}),F.backtrack===!0){F.output="";for(let N of F.tokens)F.output+=N.output!=null?N.output:N.value,N.suffix&&(F.output+=N.suffix)}return F};AE.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(om,r.maxLength):om,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=Vq[t]||t;let s=kr.isWindows(e),{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:h,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:m}=sm.globChars(s),g=r.dot?h:l,b=r.dot?d:l,S=r.capture?"":"?:",A={negated:!1,prefix:""},p=r.bash===!0?".*?":f;r.capture&&(p=`(${p})`);let y=E=>E.noglobstar===!0?p:`(${S}(?:(?!${m}${E.dot?c:o}).)*?)`,w=E=>{switch(E){case"*":return`${g}${u}${p}`;case".*":return`${o}${u}${p}`;case"*.*":return`${g}${p}${o}${u}${p}`;case"*/*":return`${g}${p}${a}${u}${b}${p}`;case"**":return g+y(r);case"**/*":return`(?:${g}${y(r)}${a})?${b}${u}${p}`;case"**/*.*":return`(?:${g}${y(r)}${a})?${b}${p}${o}${u}${p}`;case"**/.*":return`(?:${g}${y(r)}${a})?${o}${u}${p}`;default:{let R=/^(.*?)\.(\w+)$/.exec(E);if(!R)return;let k=w(R[1]);return k?k+o+R[2]:void 0}}},_=kr.removePrefix(t,A),P=w(_);return P&&r.strictSlashes!==!0&&(P+=`${a}?`),P};zq.exports=AE});var Wq=v((vCe,Kq)=>{"use strict";var dhe=require("path"),phe=Hq(),OE=Gq(),xE=dl(),mhe=hl(),ghe=t=>t&&typeof t=="object"&&!Array.isArray(t),_t=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>_t(d,e,r));return d=>{for(let f of l){let m=f(d);if(m)return m}return!1}}let n=ghe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},s=xE.isWindows(e),o=n?_t.compileRe(t,e):_t.makeRe(t,e,!1,!0),a=o.state;delete o.state;let u=()=>!1;if(i.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};u=_t(i.ignore,l,r)}let c=(l,h=!1)=>{let{isMatch:d,match:f,output:m}=_t.test(l,o,e,{glob:t,posix:s}),g={glob:t,state:a,regex:o,posix:s,input:l,output:m,match:f,isMatch:d};return typeof i.onResult=="function"&&i.onResult(g),d===!1?(g.isMatch=!1,h?g:!1):u(l)?(typeof i.onIgnore=="function"&&i.onIgnore(g),g.isMatch=!1,h?g:!1):(typeof i.onMatch=="function"&&i.onMatch(g),h?g:!0)};return r&&(c.state=a),c};_t.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let s=r||{},o=s.format||(i?xE.toPosixSlashes:null),a=t===n,u=a&&o?o(t):t;return a===!1&&(u=o?o(t):t,a=u===n),(a===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?a=_t.matchBase(t,e,r,i):a=e.exec(u)),{isMatch:!!a,match:a,output:u}};_t.matchBase=(t,e,r,n=xE.isWindows(r))=>(e instanceof RegExp?e:_t.makeRe(e,r)).test(dhe.basename(t));_t.isMatch=(t,e,r)=>_t(e,r)(t);_t.parse=(t,e)=>Array.isArray(t)?t.map(r=>_t.parse(r,e)):OE(t,{...e,fastpaths:!1});_t.scan=(t,e)=>phe(t,e);_t.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},s=i.contains?"":"^",o=i.contains?"":"$",a=`${s}(?:${t.output})${o}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let u=_t.toRegex(a,e);return n===!0&&(u.state=t),u};_t.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=OE.fastpaths(t,e)),i.output||(i=OE(t,e)),_t.compileRe(i,e,r,n)};_t.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};_t.constants=mhe;Kq.exports=_t});var Yq=v((ECe,Xq)=>{"use strict";Xq.exports=Wq()});var r6=v((_Ce,t6)=>{"use strict";var Zq=require("util"),Qq=Fq(),Mn=Yq(),TE=dl(),Jq=t=>t===""||t==="./",e6=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},et=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,i=new Set,s=new Set,o=0,a=l=>{s.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let h=Mn(String(e[l]),{...r,onResult:a},!0),d=h.state.negated||h.state.negatedExtglob;d&&o++;for(let f of t){let m=h(f,!0);(d?!m.isMatch:m.isMatch)&&(d?n.add(m.output):(n.delete(m.output),i.add(m.output)))}}let c=(o===e.length?[...s]:[...i]).filter(l=>!n.has(l));if(r&&c.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(l=>l.replace(/\\/g,"")):e}return c};et.match=et;et.matcher=(t,e)=>Mn(t,e);et.isMatch=(t,e,r)=>Mn(e,r)(t);et.any=et.isMatch;et.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,i=[],s=a=>{r.onResult&&r.onResult(a),i.push(a.output)},o=new Set(et(t,e,{...r,onResult:s}));for(let a of i)o.has(a)||n.add(a);return[...n]};et.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Zq.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>et.contains(t,n,r));if(typeof e=="string"){if(Jq(t)||Jq(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return et.isMatch(t,e,{...r,contains:!0})};et.matchKeys=(t,e,r)=>{if(!TE.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=et(Object.keys(t),e,r),i={};for(let s of n)i[s]=t[s];return i};et.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=Mn(String(i),r);if(n.some(o=>s(o)))return!0}return!1};et.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=Mn(String(i),r);if(!n.every(o=>s(o)))return!1}return!0};et.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Zq.inspect(t)}"`);return[].concat(e).every(n=>Mn(n,r)(t))};et.capture=(t,e,r)=>{let n=TE.isWindows(r),s=Mn.makeRe(String(t),{...r,capture:!0}).exec(n?TE.toPosixSlashes(e):e);if(s)return s.slice(1).map(o=>o===void 0?"":o)};et.makeRe=(...t)=>Mn.makeRe(...t);et.scan=(...t)=>Mn.scan(...t);et.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of Qq(String(n),e))r.push(Mn.parse(i,e));return r};et.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!e6(t)?[t]:Qq(t,e)};et.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return et.braces(t,{...e,expand:!0})};et.hasBraces=e6;t6.exports=et});var ade={};lm(ade,{CapgoSDK:()=>tt,addApp:()=>tde,addChannel:()=>nde,addOrganization:()=>Zhe,checkBundleCompatibility:()=>qhe,createSupabaseClient:()=>pe,decryptBundle:()=>Hhe,deleteLegacyEncryptionKey:()=>Khe,deleteOrganization:()=>ede,doctor:()=>Mhe,encryptBundle:()=>Uhe,generateEncryptionKeys:()=>zhe,getAccountId:()=>Yhe,getCapacitorConfig:()=>ode,getCurrentBundle:()=>Whe,getStats:()=>sde,listBundles:()=>rde,listOrganizations:()=>Jhe,login:()=>Bhe,requestBuild:()=>ide,saveEncryptionKey:()=>Ghe,updateAppSetting:()=>Xhe,updateOrganization:()=>Qhe,uploadBundle:()=>jhe,zipBundle:()=>Vhe});module.exports=ue(ade);var Ut=Oe(Ye(),1),yo=require("node:process"),Di=Oe(require("node:readline"),1),gm=Oe(require("node:readline"),1),VE=require("node:stream"),zE=Oe(dm(),1);function z6({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}var G6=z6();function GE(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(G6,"")}function KE(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var WE={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var i=n.charCodeAt(0),s=n.length==2?n.charCodeAt(1):0,o=i;return 55296<=i&&i<=56319&&56320<=s&&s<=57343&&(i&=1023,s&=1023,o=i<<10|s,o+=65536),o==12288||65281<=o&&o<=65376||65504<=o&&o<=65510?"F":o==8361||65377<=o&&o<=65470||65474<=o&&o<=65479||65482<=o&&o<=65487||65490<=o&&o<=65495||65498<=o&&o<=65500||65512<=o&&o<=65518?"H":4352<=o&&o<=4447||4515<=o&&o<=4519||4602<=o&&o<=4607||9001<=o&&o<=9002||11904<=o&&o<=11929||11931<=o&&o<=12019||12032<=o&&o<=12245||12272<=o&&o<=12283||12289<=o&&o<=12350||12353<=o&&o<=12438||12441<=o&&o<=12543||12549<=o&&o<=12589||12593<=o&&o<=12686||12688<=o&&o<=12730||12736<=o&&o<=12771||12784<=o&&o<=12830||12832<=o&&o<=12871||12880<=o&&o<=13054||13056<=o&&o<=19903||19968<=o&&o<=42124||42128<=o&&o<=42182||43360<=o&&o<=43388||44032<=o&&o<=55203||55216<=o&&o<=55238||55243<=o&&o<=55291||63744<=o&&o<=64255||65040<=o&&o<=65049||65072<=o&&o<=65106||65108<=o&&o<=65126||65128<=o&&o<=65131||110592<=o&&o<=110593||127488<=o&&o<=127490||127504<=o&&o<=127546||127552<=o&&o<=127560||127568<=o&&o<=127569||131072<=o&&o<=194367||177984<=o&&o<=196605||196608<=o&&o<=262141?"W":32<=o&&o<=126||162<=o&&o<=163||165<=o&&o<=166||o==172||o==175||10214<=o&&o<=10221||10629<=o&&o<=10630?"Na":o==161||o==164||167<=o&&o<=168||o==170||173<=o&&o<=174||176<=o&&o<=180||182<=o&&o<=186||188<=o&&o<=191||o==198||o==208||215<=o&&o<=216||222<=o&&o<=225||o==230||232<=o&&o<=234||236<=o&&o<=237||o==240||242<=o&&o<=243||247<=o&&o<=250||o==252||o==254||o==257||o==273||o==275||o==283||294<=o&&o<=295||o==299||305<=o&&o<=307||o==312||319<=o&&o<=322||o==324||328<=o&&o<=331||o==333||338<=o&&o<=339||358<=o&&o<=359||o==363||o==462||o==464||o==466||o==468||o==470||o==472||o==474||o==476||o==593||o==609||o==708||o==711||713<=o&&o<=715||o==717||o==720||728<=o&&o<=731||o==733||o==735||768<=o&&o<=879||913<=o&&o<=929||931<=o&&o<=937||945<=o&&o<=961||963<=o&&o<=969||o==1025||1040<=o&&o<=1103||o==1105||o==8208||8211<=o&&o<=8214||8216<=o&&o<=8217||8220<=o&&o<=8221||8224<=o&&o<=8226||8228<=o&&o<=8231||o==8240||8242<=o&&o<=8243||o==8245||o==8251||o==8254||o==8308||o==8319||8321<=o&&o<=8324||o==8364||o==8451||o==8453||o==8457||o==8467||o==8470||8481<=o&&o<=8482||o==8486||o==8491||8531<=o&&o<=8532||8539<=o&&o<=8542||8544<=o&&o<=8555||8560<=o&&o<=8569||o==8585||8592<=o&&o<=8601||8632<=o&&o<=8633||o==8658||o==8660||o==8679||o==8704||8706<=o&&o<=8707||8711<=o&&o<=8712||o==8715||o==8719||o==8721||o==8725||o==8730||8733<=o&&o<=8736||o==8739||o==8741||8743<=o&&o<=8748||o==8750||8756<=o&&o<=8759||8764<=o&&o<=8765||o==8776||o==8780||o==8786||8800<=o&&o<=8801||8804<=o&&o<=8807||8810<=o&&o<=8811||8814<=o&&o<=8815||8834<=o&&o<=8835||8838<=o&&o<=8839||o==8853||o==8857||o==8869||o==8895||o==8978||9312<=o&&o<=9449||9451<=o&&o<=9547||9552<=o&&o<=9587||9600<=o&&o<=9615||9618<=o&&o<=9621||9632<=o&&o<=9633||9635<=o&&o<=9641||9650<=o&&o<=9651||9654<=o&&o<=9655||9660<=o&&o<=9661||9664<=o&&o<=9665||9670<=o&&o<=9672||o==9675||9678<=o&&o<=9681||9698<=o&&o<=9701||o==9711||9733<=o&&o<=9734||o==9737||9742<=o&&o<=9743||9748<=o&&o<=9749||o==9756||o==9758||o==9792||o==9794||9824<=o&&o<=9825||9827<=o&&o<=9829||9831<=o&&o<=9834||9836<=o&&o<=9837||o==9839||9886<=o&&o<=9887||9918<=o&&o<=9919||9924<=o&&o<=9933||9935<=o&&o<=9953||o==9955||9960<=o&&o<=9983||o==10045||o==10071||10102<=o&&o<=10111||11093<=o&&o<=11097||12872<=o&&o<=12879||57344<=o&&o<=63743||65024<=o&&o<=65039||o==65533||127232<=o&&o<=127242||127248<=o&&o<=127277||127280<=o&&o<=127337||127344<=o&&o<=127386||917760<=o&&o<=917999||983040<=o&&o<=1048573||1048576<=o&&o<=1114109?"A":"N"},e.characterLength=function(n){var i=this.eastAsianWidth(n);return i=="F"||i=="W"||i=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var i=r(n),s=0,o=0;o<i.length;o++)s=s+this.characterLength(i[o]);return s},e.slice=function(n,i,s){textLen=e.length(n),i=i||0,s=s||1,i<0&&(i=textLen+i),s<0&&(s=textLen+s);for(var o="",a=0,u=r(n),c=0;c<u.length;c++){var l=u[c],h=e.length(l);if(a>=i-(h==2?1:0))if(a+h<=s)o+=l;else break;a+=h}return o}})(WE);var K6=WE.exports,W6=KE(K6),X6=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},Y6=KE(X6);function au(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=GE(t),t.length===0))return 0;t=t.replace(Y6()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let i of t){let s=i.codePointAt(0);if(!(s<=31||s>=127&&s<=159||s>=768&&s<=879))switch(W6.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var pm=10,LE=(t=0)=>e=>`\x1B[${e+t}m`,jE=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,BE=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,rt={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(rt.modifier);var J6=Object.keys(rt.color),Z6=Object.keys(rt.bgColor);[...J6,...Z6];function Q6(){let t=new Map;for(let[e,r]of Object.entries(rt)){for(let[n,i]of Object.entries(r))rt[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=rt[n],t.set(i[0],i[1]);Object.defineProperty(rt,e,{value:r,enumerable:!1})}return Object.defineProperty(rt,"codes",{value:t,enumerable:!1}),rt.color.close="\x1B[39m",rt.bgColor.close="\x1B[49m",rt.color.ansi=LE(),rt.color.ansi256=jE(),rt.color.ansi16m=BE(),rt.bgColor.ansi=LE(pm),rt.bgColor.ansi256=jE(pm),rt.bgColor.ansi16m=BE(pm),Object.defineProperties(rt,{rgbToAnsi256:{value:(e,r,n)=>e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(s=>s+s).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>rt.rgbToAnsi256(...rt.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,i;if(e>=232)r=((e-232)*10+8)/255,n=r,i=r;else{e-=16;let a=e%36;r=Math.floor(e/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let s=Math.max(r,n,i)*2;if(s===0)return 30;let o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return s===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>rt.ansi256ToAnsi(rt.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>rt.ansi256ToAnsi(rt.hexToAnsi256(e)),enumerable:!1}}),rt}var eU=Q6(),Cl=new Set(["\x1B","\x9B"]),tU=39,Dm="\x07",XE="[",rU="]",YE="m",wm=`${rU}8;;`,ME=t=>`${Cl.values().next().value}${XE}${t}${YE}`,qE=t=>`${Cl.values().next().value}${wm}${t}${Dm}`,nU=t=>t.split(" ").map(e=>au(e)),mm=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=au(GE(t[t.length-1]));for(let[a,u]of n.entries()){let c=au(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),Cl.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith(wm)),i){s?u===Dm&&(i=!1,s=!1):u===YE&&(i=!1);continue}o+=c,o===r&&a<n.length-1&&(t.push(""),o=0)}!o&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},iU=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(au(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},sU=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,s,o=nU(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let h=au(a[a.length-1]);if(c!==0&&(h>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),h=0),(h>0||r.trim===!1)&&(a[a.length-1]+=" ",h++)),r.hard&&o[c]>e){let d=e-h,f=1+Math.floor((o[c]-d-1)/e);Math.floor((o[c]-1)/e)<f&&a.push(""),mm(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){mm(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){mm(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>iU(c)));let u=[...a.join(`
|
|
237
|
+
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var v8=Rr(()=>{b8()});async function Uv(t=cle){let{stdout:e}=await t("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e);if(!r)throw new xp(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,i=lle[n];if(!i)throw new xp(`Unknown browser ID: ${n}`);return i}var E8,_8,cle,lle,xp,C8=Rr(()=>{E8=require("node:util"),_8=require("node:child_process"),cle=(0,E8.promisify)(_8.execFile),lle={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},xp=class extends Error{}});async function Hv(){if(Tp.default.platform==="darwin"){let t=await Bv();return{name:await qv(t),id:t}}if(Tp.default.platform==="linux"){let{stdout:t}=await fle("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:hle(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Tp.default.platform==="win32")return Uv();throw new Error("Only macOS, Linux, and Windows are supported")}var S8,Tp,A8,fle,hle,O8=Rr(()=>{S8=require("node:util"),Tp=Oe(require("node:process"),1),A8=require("node:child_process");g8();v8();C8();fle=(0,S8.promisify)(A8.execFile),hle=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Xv={};lm(Xv,{apps:()=>es,default:()=>yle,openApp:()=>gle});async function ple(){let t=await jv(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,r=Gv.Buffer.from(e,"utf16le").toString("base64"),{stdout:n}=await dle(t,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",r],{encoding:"utf8"}),i=n.trim(),s={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return s[i]?{id:s[i]}:{}}function I8(t){if(typeof t=="string"||Array.isArray(t))return t;let{[T8]:e}=t;if(!e)throw new Error(`${T8} is not supported`);return e}function Ip({[za]:t},{wsl:e}){if(e&&Zi)return I8(e);if(!t)throw new Error(`${za} is not supported`);return I8(t)}var zv,Gv,Kv,P8,k8,Wv,Fp,Dle,dle,Vv,x8,za,T8,F8,tl,mle,gle,es,yle,Yv=Rr(()=>{zv=Oe(require("node:process"),1),Gv=require("node:buffer"),Kv=Oe(require("node:path"),1),P8=require("node:url"),k8=require("node:util"),Wv=Oe(require("node:child_process"),1),Fp=Oe(require("node:fs/promises"),1);f8();h8();O8();Rv();Dle={},dle=(0,k8.promisify)(Wv.default.execFile),Vv=Kv.default.dirname((0,P8.fileURLToPath)(Dle.url)),x8=Kv.default.join(Vv,"xdg-open"),{platform:za,arch:T8}=zv.default;F8=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(i){r=i}throw r},tl=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return F8(t.app,a=>tl({...t,app:a}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return F8(e,a=>tl({...t,app:{name:a,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let a={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},u={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},c=Zi?await ple():await Hv();if(c.id in a){let l=a[c.id];return e==="browserPrivate"&&r.push(u[l]),tl({...t,app:{name:es[l],arguments:r}})}throw new Error(`${c.name} is not supported as a default browser`)}let n,i=[],s={};if(za==="darwin")n="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),e&&i.push("-a",e);else if(za==="win32"||Zi&&!Va()&&!e){n=await jv(),i.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),Zi||(s.windowsVerbatimArguments=!0);let a=["Start"];t.wait&&a.push("-Wait"),e?(a.push(`"\`"${e}\`""`),t.target&&r.push(t.target)):t.target&&a.push(`"${t.target}"`),r.length>0&&(r=r.map(u=>`"\`"${u}\`""`),a.push("-ArgumentList",r.join(","))),t.target=Gv.Buffer.from(a.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let a=!Vv||Vv==="/",u=!1;try{await Fp.default.access(x8,Fp.constants.X_OK),u=!0}catch{}n=zv.default.versions.electron??(za==="android"||a||!u)?"xdg-open":x8}r.length>0&&i.push(...r),t.wait||(s.stdio="ignore",s.detached=!0)}za==="darwin"&&r.length>0&&i.push("--args",...r),t.target&&i.push(t.target);let o=Wv.default.spawn(n,i,s);return t.wait?new Promise((a,u)=>{o.once("error",u),o.once("close",c=>{if(!t.allowNonzeroExitCode&&c>0){u(new Error(`Exited with code ${c}`));return}a(o)})}):(o.unref(),o)},mle=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return tl({...e,target:t})},gle=(t,e)=>{if(typeof t!="string"&&!Array.isArray(t))throw new TypeError("Expected a valid `name`");let{arguments:r=[]}=e??{};if(r!=null&&!Array.isArray(r))throw new TypeError("Expected `appArguments` as Array type");return tl({...e,app:{name:t,arguments:r}})};es={};Qi(es,"chrome",()=>Ip({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));Qi(es,"brave",()=>Ip({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));Qi(es,"firefox",()=>Ip({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Qi(es,"edge",()=>Ip({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));Qi(es,"browser",()=>"browser");Qi(es,"browserPrivate",()=>"browserPrivate");yle=mle});var em=v(Jr=>{"use strict";Jr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Jr.find=(t,e)=>t.nodes.find(r=>r.type===e);Jr.exceedsLimit=(t,e,r=1,n)=>n===!1||!Jr.isInteger(t)||!Jr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;Jr.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};Jr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;Jr.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;Jr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Jr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);Jr.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let s=n[i];if(Array.isArray(s)){r(s);continue}s!==void 0&&e.push(s)}return e};return r(t),e}});var tm=v((cCe,YM)=>{"use strict";var XM=em();YM.exports=(t,e={})=>{let r=(n,i={})=>{let s=e.escapeInvalid&&XM.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(s||o)&&XM.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let u of n.nodes)a+=r(u);return a};return r(t)}});var ZM=v((lCe,JM)=>{"use strict";JM.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var aq=v((fCe,oq)=>{"use strict";var QM=ZM(),fo=(t,e,r)=>{if(QM(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(QM(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let i=String(n.relaxZeros),s=String(n.shorthand),o=String(n.capture),a=String(n.wrap),u=t+":"+e+"="+i+s+o+a;if(fo.cache.hasOwnProperty(u))return fo.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let g=t+"|"+e;return n.capture?`(${g})`:n.wrap===!1?g:`(?:${g})`}let h=sq(t)||sq(e),d={min:t,max:e,a:c,b:l},f=[],m=[];if(h&&(d.isPadded=h,d.maxLen=String(d.max).length),c<0){let g=l<0?Math.abs(l):1;m=eq(g,Math.abs(c),d,n),c=d.a=0}return l>=0&&(f=eq(c,l,d,n)),d.negatives=m,d.positives=f,d.result=ife(m,f,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&f.length+m.length>1&&(d.result=`(?:${d.result})`),fo.cache[u]=d,d.result};function ife(t,e,r){let n=pE(t,e,"-",!1,r)||[],i=pE(e,t,"",!1,r)||[],s=pE(t,e,"-?",!0,r)||[];return n.concat(s).concat(i).join("|")}function sfe(t,e){let r=1,n=1,i=rq(t,r),s=new Set([e]);for(;t<=i&&i<=e;)s.add(i),r+=1,i=rq(t,r);for(i=nq(e+1,n)-1;t<i&&i<=e;)s.add(i),n+=1,i=nq(e+1,n)-1;return s=[...s],s.sort(ufe),s}function ofe(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=afe(t,e),i=n.length,s="",o=0;for(let a=0;a<i;a++){let[u,c]=n[a];u===c?s+=u:u!=="0"||c!=="9"?s+=cfe(u,c,r):o++}return o&&(s+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[o],digits:i}}function eq(t,e,r,n){let i=sfe(t,e),s=[],o=t,a;for(let u=0;u<i.length;u++){let c=i[u],l=ofe(String(o),String(c),n),h="";if(!r.isPadded&&a&&a.pattern===l.pattern){a.count.length>1&&a.count.pop(),a.count.push(l.count[0]),a.string=a.pattern+iq(a.count),o=c+1;continue}r.isPadded&&(h=lfe(c,r,n)),l.string=h+l.pattern+iq(l.count),s.push(l),o=c+1,a=l}return s}function pE(t,e,r,n,i){let s=[];for(let o of t){let{string:a}=o;!n&&!tq(e,"string",a)&&s.push(r+a),n&&tq(e,"string",a)&&s.push(r+a)}return s}function afe(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function ufe(t,e){return t>e?1:e>t?-1:0}function tq(t,e,r){return t.some(n=>n[e]===r)}function rq(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function nq(t,e){return t-t%Math.pow(10,e)}function iq(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function cfe(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function sq(t){return/^-?(0+)\d/.test(t)}function lfe(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}fo.cache={};fo.clearCache=()=>fo.cache={};oq.exports=fo});var yE=v((hCe,pq)=>{"use strict";var ffe=require("util"),cq=aq(),uq=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),hfe=t=>e=>t===!0?Number(e):String(e),mE=t=>typeof t=="number"||typeof t=="string"&&t!=="",fl=t=>Number.isInteger(+t),gE=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},dfe=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,pfe=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},nm=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},mfe=(t,e,r)=>{t.negatives.sort((a,u)=>a<u?-1:a>u?1:0),t.positives.sort((a,u)=>a<u?-1:a>u?1:0);let n=e.capture?"":"?:",i="",s="",o;return t.positives.length&&(i=t.positives.map(a=>nm(String(a),r)).join("|")),t.negatives.length&&(s=`-(${n}${t.negatives.map(a=>nm(String(a),r)).join("|")})`),i&&s?o=`${i}|${s}`:o=i||s,e.wrap?`(${n}${o})`:o},lq=(t,e,r,n)=>{if(r)return cq(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let s=String.fromCharCode(e);return`[${i}-${s}]`},fq=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return cq(t,e,r)},hq=(...t)=>new RangeError("Invalid range arguments: "+ffe.inspect(...t)),dq=(t,e,r)=>{if(r.strictRanges===!0)throw hq([t,e]);return[]},gfe=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},yfe=(t,e,r=1,n={})=>{let i=Number(t),s=Number(e);if(!Number.isInteger(i)||!Number.isInteger(s)){if(n.strictRanges===!0)throw hq([t,e]);return[]}i===0&&(i=0),s===0&&(s=0);let o=i>s,a=String(t),u=String(e),c=String(r);r=Math.max(Math.abs(r),1);let l=gE(a)||gE(u)||gE(c),h=l?Math.max(a.length,u.length,c.length):0,d=l===!1&&dfe(t,e,n)===!1,f=n.transform||hfe(d);if(n.toRegex&&r===1)return lq(nm(t,h),nm(e,h),!0,n);let m={negatives:[],positives:[]},g=A=>m[A<0?"negatives":"positives"].push(Math.abs(A)),b=[],S=0;for(;o?i>=s:i<=s;)n.toRegex===!0&&r>1?g(i):b.push(pfe(f(i,S),h,d)),i=o?i-r:i+r,S++;return n.toRegex===!0?r>1?mfe(m,n,h):fq(b,null,{wrap:!1,...n}):b},Dfe=(t,e,r=1,n={})=>{if(!fl(t)&&t.length>1||!fl(e)&&e.length>1)return dq(t,e,n);let i=n.transform||(d=>String.fromCharCode(d)),s=`${t}`.charCodeAt(0),o=`${e}`.charCodeAt(0),a=s>o,u=Math.min(s,o),c=Math.max(s,o);if(n.toRegex&&r===1)return lq(u,c,!1,n);let l=[],h=0;for(;a?s>=o:s<=o;)l.push(i(s,h)),s=a?s-r:s+r,h++;return n.toRegex===!0?fq(l,null,{wrap:!1,options:n}):l},rm=(t,e,r,n={})=>{if(e==null&&mE(t))return[t];if(!mE(t)||!mE(e))return dq(t,e,n);if(typeof r=="function")return rm(t,e,1,{transform:r});if(uq(r))return rm(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,fl(r)?fl(t)&&fl(e)?yfe(t,e,r,i):Dfe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!uq(r)?gfe(r,i):rm(t,e,1,r)};pq.exports=rm});var yq=v((dCe,gq)=>{"use strict";var wfe=yE(),mq=em(),bfe=(t,e={})=>{let r=(n,i={})=>{let s=mq.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a=s===!0||o===!0,u=e.escapeInvalid===!0?"\\":"",c="";if(n.isOpen===!0)return u+n.value;if(n.isClose===!0)return console.log("node.isClose",u,n.value),u+n.value;if(n.type==="open")return a?u+n.value:"(";if(n.type==="close")return a?u+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=mq.reduce(n.nodes),h=wfe(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(h.length!==0)return l.length>1&&h.length>1?`(${h})`:h}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};gq.exports=bfe});var bq=v((pCe,wq)=>{"use strict";var vfe=yE(),Dq=tm(),iu=em(),ho=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?iu.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let s of i)n.push(ho(s,e,r));else for(let s of e)r===!0&&typeof s=="string"&&(s=`{${s}}`),n.push(Array.isArray(s)?ho(i,s,r):i+s);return iu.flatten(n)},Efe=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,s={})=>{i.queue=[];let o=s,a=s.queue;for(;o.type!=="brace"&&o.type!=="root"&&o.parent;)o=o.parent,a=o.queue;if(i.invalid||i.dollar){a.push(ho(a.pop(),Dq(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(ho(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let h=iu.reduce(i.nodes);if(iu.exceedsLimit(...h,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let d=vfe(...h,e);d.length===0&&(d=Dq(i,e)),a.push(ho(a.pop(),d)),i.nodes=[];return}let u=iu.encloseBrace(i),c=i.queue,l=i;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let h=0;h<i.nodes.length;h++){let d=i.nodes[h];if(d.type==="comma"&&i.type==="brace"){h===1&&c.push(""),c.push("");continue}if(d.type==="close"){a.push(ho(a.pop(),c,u));continue}if(d.value&&d.type!=="open"){c.push(ho(c.pop(),d.value));continue}d.nodes&&n(d,i)}return c};return iu.flatten(n(t))};wq.exports=Efe});var Eq=v((mCe,vq)=>{"use strict";vq.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
|
238
|
+
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var Oq=v((gCe,Aq)=>{"use strict";var _fe=tm(),{MAX_LENGTH:_q,CHAR_BACKSLASH:DE,CHAR_BACKTICK:Cfe,CHAR_COMMA:Sfe,CHAR_DOT:Afe,CHAR_LEFT_PARENTHESES:Ofe,CHAR_RIGHT_PARENTHESES:xfe,CHAR_LEFT_CURLY_BRACE:Tfe,CHAR_RIGHT_CURLY_BRACE:Ffe,CHAR_LEFT_SQUARE_BRACKET:Cq,CHAR_RIGHT_SQUARE_BRACKET:Sq,CHAR_DOUBLE_QUOTE:Ife,CHAR_SINGLE_QUOTE:Pfe,CHAR_NO_BREAK_SPACE:kfe,CHAR_ZERO_WIDTH_NOBREAK_SPACE:Rfe}=Eq(),Nfe=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(_q,r.maxLength):_q;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let i={type:"root",input:t,nodes:[]},s=[i],o=i,a=i,u=0,c=t.length,l=0,h=0,d,f=()=>t[l++],m=g=>{if(g.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&g.type==="text"){a.value+=g.value;return}return o.nodes.push(g),g.parent=o,g.prev=a,a=g,g};for(m({type:"bos"});l<c;)if(o=s[s.length-1],d=f(),!(d===Rfe||d===kfe)){if(d===DE){m({type:"text",value:(e.keepEscaping?d:"")+f()});continue}if(d===Sq){m({type:"text",value:"\\"+d});continue}if(d===Cq){u++;let g;for(;l<c&&(g=f());){if(d+=g,g===Cq){u++;continue}if(g===DE){d+=f();continue}if(g===Sq&&(u--,u===0))break}m({type:"text",value:d});continue}if(d===Ofe){o=m({type:"paren",nodes:[]}),s.push(o),m({type:"text",value:d});continue}if(d===xfe){if(o.type!=="paren"){m({type:"text",value:d});continue}o=s.pop(),m({type:"text",value:d}),o=s[s.length-1];continue}if(d===Ife||d===Pfe||d===Cfe){let g=d,b;for(e.keepQuotes!==!0&&(d="");l<c&&(b=f());){if(b===DE){d+=b+f();continue}if(b===g){e.keepQuotes===!0&&(d+=b);break}d+=b}m({type:"text",value:d});continue}if(d===Tfe){h++;let b={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||o.dollar===!0,depth:h,commas:0,ranges:0,nodes:[]};o=m(b),s.push(o),m({type:"open",value:d});continue}if(d===Ffe){if(o.type!=="brace"){m({type:"text",value:d});continue}let g="close";o=s.pop(),o.close=!0,m({type:g,value:d}),h--,o=s[s.length-1];continue}if(d===Sfe&&h>0){if(o.ranges>0){o.ranges=0;let g=o.nodes.shift();o.nodes=[g,{type:"text",value:_fe(o)}]}m({type:"comma",value:d}),o.commas++;continue}if(d===Afe&&h>0&&o.commas===0){let g=o.nodes;if(h===0||g.length===0){m({type:"text",value:d});continue}if(a.type==="dot"){if(o.range=[],a.value+=d,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){g.pop();let b=g[g.length-1];b.value+=a.value+d,a=b,o.ranges--;continue}m({type:"dot",value:d});continue}m({type:"text",value:d})}do if(o=s.pop(),o.type!=="root"){o.nodes.forEach(S=>{S.nodes||(S.type==="open"&&(S.isOpen=!0),S.type==="close"&&(S.isClose=!0),S.nodes||(S.type="text"),S.invalid=!0)});let g=s[s.length-1],b=g.nodes.indexOf(o);g.nodes.splice(b,1,...o.nodes)}while(s.length>0);return m({type:"eos"}),i};Aq.exports=Nfe});var Fq=v((yCe,Tq)=>{"use strict";var xq=tm(),$fe=yq(),Lfe=bq(),jfe=Oq(),Pr=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=Pr.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(Pr.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Pr.parse=(t,e={})=>jfe(t,e);Pr.stringify=(t,e={})=>xq(typeof t=="string"?Pr.parse(t,e):t,e);Pr.compile=(t,e={})=>(typeof t=="string"&&(t=Pr.parse(t,e)),$fe(t,e));Pr.expand=(t,e={})=>{typeof t=="string"&&(t=Pr.parse(t,e));let r=Lfe(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Pr.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Pr.compile(t,e):Pr.expand(t,e);Tq.exports=Pr});var hl=v((DCe,Nq)=>{"use strict";var Bfe=require("path"),Bn="\\\\/",Iq=`[^${Bn}]`,yi="\\.",Mfe="\\+",qfe="\\?",im="\\/",Ufe="(?=.)",Pq="[^/]",wE=`(?:${im}|$)`,kq=`(?:^|${im})`,bE=`${yi}{1,2}${wE}`,Hfe=`(?!${yi})`,Vfe=`(?!${kq}${bE})`,zfe=`(?!${yi}{0,1}${wE})`,Gfe=`(?!${bE})`,Kfe=`[^.${im}]`,Wfe=`${Pq}*?`,Rq={DOT_LITERAL:yi,PLUS_LITERAL:Mfe,QMARK_LITERAL:qfe,SLASH_LITERAL:im,ONE_CHAR:Ufe,QMARK:Pq,END_ANCHOR:wE,DOTS_SLASH:bE,NO_DOT:Hfe,NO_DOTS:Vfe,NO_DOT_SLASH:zfe,NO_DOTS_SLASH:Gfe,QMARK_NO_DOT:Kfe,STAR:Wfe,START_ANCHOR:kq},Xfe={...Rq,SLASH_LITERAL:`[${Bn}]`,QMARK:Iq,STAR:`${Iq}*?`,DOTS_SLASH:`${yi}{1,2}(?:[${Bn}]|$)`,NO_DOT:`(?!${yi})`,NO_DOTS:`(?!(?:^|[${Bn}])${yi}{1,2}(?:[${Bn}]|$))`,NO_DOT_SLASH:`(?!${yi}{0,1}(?:[${Bn}]|$))`,NO_DOTS_SLASH:`(?!${yi}{1,2}(?:[${Bn}]|$))`,QMARK_NO_DOT:`[^.${Bn}]`,START_ANCHOR:`(?:^|[${Bn}])`,END_ANCHOR:`(?:[${Bn}]|$)`},Yfe={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Nq.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Yfe,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:Bfe.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Xfe:Rq}}});var dl=v(Or=>{"use strict";var Jfe=require("path"),Zfe=process.platform==="win32",{REGEX_BACKSLASH:Qfe,REGEX_REMOVE_BACKSLASH:ehe,REGEX_SPECIAL_CHARS:the,REGEX_SPECIAL_CHARS_GLOBAL:rhe}=hl();Or.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Or.hasRegexChars=t=>the.test(t);Or.isRegexChar=t=>t.length===1&&Or.hasRegexChars(t);Or.escapeRegex=t=>t.replace(rhe,"\\$1");Or.toPosixSlashes=t=>t.replace(Qfe,"/");Or.removeBackslashes=t=>t.replace(ehe,e=>e==="\\"?"":e);Or.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Or.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:Zfe===!0||Jfe.sep==="\\";Or.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Or.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Or.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Or.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",s=`${n}(?:${t})${i}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s}});var Hq=v((bCe,Uq)=>{"use strict";var $q=dl(),{CHAR_ASTERISK:vE,CHAR_AT:nhe,CHAR_BACKWARD_SLASH:pl,CHAR_COMMA:ihe,CHAR_DOT:EE,CHAR_EXCLAMATION_MARK:_E,CHAR_FORWARD_SLASH:qq,CHAR_LEFT_CURLY_BRACE:CE,CHAR_LEFT_PARENTHESES:SE,CHAR_LEFT_SQUARE_BRACKET:she,CHAR_PLUS:ohe,CHAR_QUESTION_MARK:Lq,CHAR_RIGHT_CURLY_BRACE:ahe,CHAR_RIGHT_PARENTHESES:jq,CHAR_RIGHT_SQUARE_BRACKET:uhe}=hl(),Bq=t=>t===qq||t===pl,Mq=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},che=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,s=[],o=[],a=[],u=t,c=-1,l=0,h=0,d=!1,f=!1,m=!1,g=!1,b=!1,S=!1,A=!1,p=!1,D=!1,w=!1,_=0,P,E,R={value:"",depth:0,isGlob:!1},k=()=>c>=n,F=()=>u.charCodeAt(c+1),j=()=>(P=E,u.charCodeAt(++c));for(;c<n;){E=j();let T;if(E===pl){A=R.backslashes=!0,E=j(),E===CE&&(S=!0);continue}if(S===!0||E===CE){for(_++;k()!==!0&&(E=j());){if(E===pl){A=R.backslashes=!0,j();continue}if(E===CE){_++;continue}if(S!==!0&&E===EE&&(E=j())===EE){if(d=R.isBrace=!0,m=R.isGlob=!0,w=!0,i===!0)continue;break}if(S!==!0&&E===ihe){if(d=R.isBrace=!0,m=R.isGlob=!0,w=!0,i===!0)continue;break}if(E===ahe&&(_--,_===0)){S=!1,d=R.isBrace=!0,w=!0;break}}if(i===!0)continue;break}if(E===qq){if(s.push(c),o.push(R),R={value:"",depth:0,isGlob:!1},w===!0)continue;if(P===EE&&c===l+1){l+=2;continue}h=c+1;continue}if(r.noext!==!0&&(E===ohe||E===nhe||E===vE||E===Lq||E===_E)===!0&&F()===SE){if(m=R.isGlob=!0,g=R.isExtglob=!0,w=!0,E===_E&&c===l&&(D=!0),i===!0){for(;k()!==!0&&(E=j());){if(E===pl){A=R.backslashes=!0,E=j();continue}if(E===jq){m=R.isGlob=!0,w=!0;break}}continue}break}if(E===vE){if(P===vE&&(b=R.isGlobstar=!0),m=R.isGlob=!0,w=!0,i===!0)continue;break}if(E===Lq){if(m=R.isGlob=!0,w=!0,i===!0)continue;break}if(E===she){for(;k()!==!0&&(T=j());){if(T===pl){A=R.backslashes=!0,j();continue}if(T===uhe){f=R.isBracket=!0,m=R.isGlob=!0,w=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&E===_E&&c===l){p=R.negated=!0,l++;continue}if(r.noparen!==!0&&E===SE){if(m=R.isGlob=!0,i===!0){for(;k()!==!0&&(E=j());){if(E===SE){A=R.backslashes=!0,E=j();continue}if(E===jq){w=!0;break}}continue}break}if(m===!0){if(w=!0,i===!0)continue;break}}r.noext===!0&&(g=!1,m=!1);let U=u,G="",L="";l>0&&(G=u.slice(0,l),u=u.slice(l),h-=l),U&&m===!0&&h>0?(U=u.slice(0,h),L=u.slice(h)):m===!0?(U="",L=u):U=u,U&&U!==""&&U!=="/"&&U!==u&&Bq(U.charCodeAt(U.length-1))&&(U=U.slice(0,-1)),r.unescape===!0&&(L&&(L=$q.removeBackslashes(L)),U&&A===!0&&(U=$q.removeBackslashes(U)));let C={prefix:G,input:t,start:l,base:U,glob:L,isBrace:d,isBracket:f,isGlob:m,isExtglob:g,isGlobstar:b,negated:p,negatedExtglob:D};if(r.tokens===!0&&(C.maxDepth=0,Bq(E)||o.push(R),C.tokens=o),r.parts===!0||r.tokens===!0){let T;for(let I=0;I<s.length;I++){let $=T?T+1:l,M=s[I],B=t.slice($,M);r.tokens&&(I===0&&l!==0?(o[I].isPrefix=!0,o[I].value=G):o[I].value=B,Mq(o[I]),C.maxDepth+=o[I].depth),(I!==0||B!=="")&&a.push(B),T=M}if(T&&T+1<t.length){let I=t.slice(T+1);a.push(I),r.tokens&&(o[o.length-1].value=I,Mq(o[o.length-1]),C.maxDepth+=o[o.length-1].depth)}C.slashes=s,C.parts=a}return C};Uq.exports=che});var Gq=v((vCe,zq)=>{"use strict";var sm=hl(),kr=dl(),{MAX_LENGTH:om,POSIX_REGEX_SOURCE:lhe,REGEX_NON_SPECIAL_CHARS:fhe,REGEX_SPECIAL_CHARS_BACKREF:hhe,REPLACEMENTS:Vq}=sm,dhe=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>kr.escapeRegex(i)).join("..")}return r},su=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,AE=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=Vq[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(om,r.maxLength):om,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let s={type:"bos",value:"",output:r.prepend||""},o=[s],a=r.capture?"":"?:",u=kr.isWindows(e),c=sm.globChars(u),l=sm.extglobChars(c),{DOT_LITERAL:h,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:m,DOTS_SLASH:g,NO_DOT:b,NO_DOT_SLASH:S,NO_DOTS_SLASH:A,QMARK:p,QMARK_NO_DOT:D,STAR:w,START_ANCHOR:_}=c,P=N=>`(${a}(?:(?!${_}${N.dot?g:h}).)*?)`,E=r.dot?"":b,R=r.dot?p:D,k=r.bash===!0?P(r):w;r.capture&&(k=`(${k})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let F={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};t=kr.removePrefix(t,F),i=t.length;let j=[],U=[],G=[],L=s,C,T=()=>F.index===i-1,I=F.peek=(N=1)=>t[F.index+N],$=F.advance=()=>t[++F.index]||"",M=()=>t.slice(F.index+1),B=(N="",ne=0)=>{F.consumed+=N,F.index+=ne},K=N=>{F.output+=N.output!=null?N.output:N.value,B(N.value)},q=()=>{let N=1;for(;I()==="!"&&(I(2)!=="("||I(3)==="?");)$(),F.start++,N++;return N%2===0?!1:(F.negated=!0,F.start++,!0)},V=N=>{F[N]++,G.push(N)},ae=N=>{F[N]--,G.pop()},x=N=>{if(L.type==="globstar"){let ne=F.braces>0&&(N.type==="comma"||N.type==="brace"),z=N.extglob===!0||j.length&&(N.type==="pipe"||N.type==="paren");N.type!=="slash"&&N.type!=="paren"&&!ne&&!z&&(F.output=F.output.slice(0,-L.output.length),L.type="star",L.value="*",L.output=k,F.output+=L.output)}if(j.length&&N.type!=="paren"&&(j[j.length-1].inner+=N.value),(N.value||N.output)&&K(N),L&&L.type==="text"&&N.type==="text"){L.value+=N.value,L.output=(L.output||"")+N.value;return}N.prev=L,o.push(N),L=N},O=(N,ne)=>{let z={...l[ne],conditions:1,inner:""};z.prev=L,z.parens=F.parens,z.output=F.output;let ie=(r.capture?"(":"")+z.open;V("parens"),x({type:N,value:ne,output:F.output?"":m}),x({type:"paren",extglob:!0,value:$(),output:ie}),j.push(z)},H=N=>{let ne=N.close+(r.capture?")":""),z;if(N.type==="negate"){let ie=k;if(N.inner&&N.inner.length>1&&N.inner.includes("/")&&(ie=P(r)),(ie!==k||T()||/^\)+$/.test(M()))&&(ne=N.close=`)$))${ie}`),N.inner.includes("*")&&(z=M())&&/^\.[^\\/.]+$/.test(z)){let we=AE(z,{...e,fastpaths:!1}).output;ne=N.close=`)${we})${ie})`}N.prev.type==="bos"&&(F.negatedExtglob=!0)}x({type:"paren",extglob:!0,value:C,output:ne}),ae("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let N=!1,ne=t.replace(hhe,(z,ie,we,xe,Me,wt)=>xe==="\\"?(N=!0,z):xe==="?"?ie?ie+xe+(Me?p.repeat(Me.length):""):wt===0?R+(Me?p.repeat(Me.length):""):p.repeat(we.length):xe==="."?h.repeat(we.length):xe==="*"?ie?ie+xe+(Me?k:""):k:ie?z:`\\${z}`);return N===!0&&(r.unescape===!0?ne=ne.replace(/\\/g,""):ne=ne.replace(/\\+/g,z=>z.length%2===0?"\\\\":z?"\\":"")),ne===t&&r.contains===!0?(F.output=t,F):(F.output=kr.wrapOutput(ne,F,e),F)}for(;!T();){if(C=$(),C==="\0")continue;if(C==="\\"){let z=I();if(z==="/"&&r.bash!==!0||z==="."||z===";")continue;if(!z){C+="\\",x({type:"text",value:C});continue}let ie=/^\\+/.exec(M()),we=0;if(ie&&ie[0].length>2&&(we=ie[0].length,F.index+=we,we%2!==0&&(C+="\\")),r.unescape===!0?C=$():C+=$(),F.brackets===0){x({type:"text",value:C});continue}}if(F.brackets>0&&(C!=="]"||L.value==="["||L.value==="[^")){if(r.posix!==!1&&C===":"){let z=L.value.slice(1);if(z.includes("[")&&(L.posix=!0,z.includes(":"))){let ie=L.value.lastIndexOf("["),we=L.value.slice(0,ie),xe=L.value.slice(ie+2),Me=lhe[xe];if(Me){L.value=we+Me,F.backtrack=!0,$(),!s.output&&o.indexOf(L)===1&&(s.output=m);continue}}}(C==="["&&I()!==":"||C==="-"&&I()==="]")&&(C=`\\${C}`),C==="]"&&(L.value==="["||L.value==="[^")&&(C=`\\${C}`),r.posix===!0&&C==="!"&&L.value==="["&&(C="^"),L.value+=C,K({value:C});continue}if(F.quotes===1&&C!=='"'){C=kr.escapeRegex(C),L.value+=C,K({value:C});continue}if(C==='"'){F.quotes=F.quotes===1?0:1,r.keepQuotes===!0&&x({type:"text",value:C});continue}if(C==="("){V("parens"),x({type:"paren",value:C});continue}if(C===")"){if(F.parens===0&&r.strictBrackets===!0)throw new SyntaxError(su("opening","("));let z=j[j.length-1];if(z&&F.parens===z.parens+1){H(j.pop());continue}x({type:"paren",value:C,output:F.parens?")":"\\)"}),ae("parens");continue}if(C==="["){if(r.nobracket===!0||!M().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(su("closing","]"));C=`\\${C}`}else V("brackets");x({type:"bracket",value:C});continue}if(C==="]"){if(r.nobracket===!0||L&&L.type==="bracket"&&L.value.length===1){x({type:"text",value:C,output:`\\${C}`});continue}if(F.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(su("opening","["));x({type:"text",value:C,output:`\\${C}`});continue}ae("brackets");let z=L.value.slice(1);if(L.posix!==!0&&z[0]==="^"&&!z.includes("/")&&(C=`/${C}`),L.value+=C,K({value:C}),r.literalBrackets===!1||kr.hasRegexChars(z))continue;let ie=kr.escapeRegex(L.value);if(F.output=F.output.slice(0,-L.value.length),r.literalBrackets===!0){F.output+=ie,L.value=ie;continue}L.value=`(${a}${ie}|${L.value})`,F.output+=L.value;continue}if(C==="{"&&r.nobrace!==!0){V("braces");let z={type:"brace",value:C,output:"(",outputIndex:F.output.length,tokensIndex:F.tokens.length};U.push(z),x(z);continue}if(C==="}"){let z=U[U.length-1];if(r.nobrace===!0||!z){x({type:"text",value:C,output:C});continue}let ie=")";if(z.dots===!0){let we=o.slice(),xe=[];for(let Me=we.length-1;Me>=0&&(o.pop(),we[Me].type!=="brace");Me--)we[Me].type!=="dots"&&xe.unshift(we[Me].value);ie=dhe(xe,r),F.backtrack=!0}if(z.comma!==!0&&z.dots!==!0){let we=F.output.slice(0,z.outputIndex),xe=F.tokens.slice(z.tokensIndex);z.value=z.output="\\{",C=ie="\\}",F.output=we;for(let Me of xe)F.output+=Me.output||Me.value}x({type:"brace",value:C,output:ie}),ae("braces"),U.pop();continue}if(C==="|"){j.length>0&&j[j.length-1].conditions++,x({type:"text",value:C});continue}if(C===","){let z=C,ie=U[U.length-1];ie&&G[G.length-1]==="braces"&&(ie.comma=!0,z="|"),x({type:"comma",value:C,output:z});continue}if(C==="/"){if(L.type==="dot"&&F.index===F.start+1){F.start=F.index+1,F.consumed="",F.output="",o.pop(),L=s;continue}x({type:"slash",value:C,output:f});continue}if(C==="."){if(F.braces>0&&L.type==="dot"){L.value==="."&&(L.output=h);let z=U[U.length-1];L.type="dots",L.output+=C,L.value+=C,z.dots=!0;continue}if(F.braces+F.parens===0&&L.type!=="bos"&&L.type!=="slash"){x({type:"text",value:C,output:h});continue}x({type:"dot",value:C,output:h});continue}if(C==="?"){if(!(L&&L.value==="(")&&r.noextglob!==!0&&I()==="("&&I(2)!=="?"){O("qmark",C);continue}if(L&&L.type==="paren"){let ie=I(),we=C;if(ie==="<"&&!kr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(L.value==="("&&!/[!=<:]/.test(ie)||ie==="<"&&!/<([!=]|\w+>)/.test(M()))&&(we=`\\${C}`),x({type:"text",value:C,output:we});continue}if(r.dot!==!0&&(L.type==="slash"||L.type==="bos")){x({type:"qmark",value:C,output:D});continue}x({type:"qmark",value:C,output:p});continue}if(C==="!"){if(r.noextglob!==!0&&I()==="("&&(I(2)!=="?"||!/[!=<:]/.test(I(3)))){O("negate",C);continue}if(r.nonegate!==!0&&F.index===0){q();continue}}if(C==="+"){if(r.noextglob!==!0&&I()==="("&&I(2)!=="?"){O("plus",C);continue}if(L&&L.value==="("||r.regex===!1){x({type:"plus",value:C,output:d});continue}if(L&&(L.type==="bracket"||L.type==="paren"||L.type==="brace")||F.parens>0){x({type:"plus",value:C});continue}x({type:"plus",value:d});continue}if(C==="@"){if(r.noextglob!==!0&&I()==="("&&I(2)!=="?"){x({type:"at",extglob:!0,value:C,output:""});continue}x({type:"text",value:C});continue}if(C!=="*"){(C==="$"||C==="^")&&(C=`\\${C}`);let z=fhe.exec(M());z&&(C+=z[0],F.index+=z[0].length),x({type:"text",value:C});continue}if(L&&(L.type==="globstar"||L.star===!0)){L.type="star",L.star=!0,L.value+=C,L.output=k,F.backtrack=!0,F.globstar=!0,B(C);continue}let N=M();if(r.noextglob!==!0&&/^\([^?]/.test(N)){O("star",C);continue}if(L.type==="star"){if(r.noglobstar===!0){B(C);continue}let z=L.prev,ie=z.prev,we=z.type==="slash"||z.type==="bos",xe=ie&&(ie.type==="star"||ie.type==="globstar");if(r.bash===!0&&(!we||N[0]&&N[0]!=="/")){x({type:"star",value:C,output:""});continue}let Me=F.braces>0&&(z.type==="comma"||z.type==="brace"),wt=j.length&&(z.type==="pipe"||z.type==="paren");if(!we&&z.type!=="paren"&&!Me&&!wt){x({type:"star",value:C,output:""});continue}for(;N.slice(0,3)==="/**";){let dr=t[F.index+4];if(dr&&dr!=="/")break;N=N.slice(3),B("/**",3)}if(z.type==="bos"&&T()){L.type="globstar",L.value+=C,L.output=P(r),F.output=L.output,F.globstar=!0,B(C);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&!xe&&T()){F.output=F.output.slice(0,-(z.output+L.output).length),z.output=`(?:${z.output}`,L.type="globstar",L.output=P(r)+(r.strictSlashes?")":"|$)"),L.value+=C,F.globstar=!0,F.output+=z.output+L.output,B(C);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&N[0]==="/"){let dr=N[1]!==void 0?"|$":"";F.output=F.output.slice(0,-(z.output+L.output).length),z.output=`(?:${z.output}`,L.type="globstar",L.output=`${P(r)}${f}|${f}${dr})`,L.value+=C,F.output+=z.output+L.output,F.globstar=!0,B(C+$()),x({type:"slash",value:"/",output:""});continue}if(z.type==="bos"&&N[0]==="/"){L.type="globstar",L.value+=C,L.output=`(?:^|${f}|${P(r)}${f})`,F.output=L.output,F.globstar=!0,B(C+$()),x({type:"slash",value:"/",output:""});continue}F.output=F.output.slice(0,-L.output.length),L.type="globstar",L.output=P(r),L.value+=C,F.output+=L.output,F.globstar=!0,B(C);continue}let ne={type:"star",value:C,output:k};if(r.bash===!0){ne.output=".*?",(L.type==="bos"||L.type==="slash")&&(ne.output=E+ne.output),x(ne);continue}if(L&&(L.type==="bracket"||L.type==="paren")&&r.regex===!0){ne.output=C,x(ne);continue}(F.index===F.start||L.type==="slash"||L.type==="dot")&&(L.type==="dot"?(F.output+=S,L.output+=S):r.dot===!0?(F.output+=A,L.output+=A):(F.output+=E,L.output+=E),I()!=="*"&&(F.output+=m,L.output+=m)),x(ne)}for(;F.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(su("closing","]"));F.output=kr.escapeLast(F.output,"["),ae("brackets")}for(;F.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(su("closing",")"));F.output=kr.escapeLast(F.output,"("),ae("parens")}for(;F.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(su("closing","}"));F.output=kr.escapeLast(F.output,"{"),ae("braces")}if(r.strictSlashes!==!0&&(L.type==="star"||L.type==="bracket")&&x({type:"maybe_slash",value:"",output:`${f}?`}),F.backtrack===!0){F.output="";for(let N of F.tokens)F.output+=N.output!=null?N.output:N.value,N.suffix&&(F.output+=N.suffix)}return F};AE.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(om,r.maxLength):om,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=Vq[t]||t;let s=kr.isWindows(e),{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:h,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:m}=sm.globChars(s),g=r.dot?h:l,b=r.dot?d:l,S=r.capture?"":"?:",A={negated:!1,prefix:""},p=r.bash===!0?".*?":f;r.capture&&(p=`(${p})`);let D=E=>E.noglobstar===!0?p:`(${S}(?:(?!${m}${E.dot?c:o}).)*?)`,w=E=>{switch(E){case"*":return`${g}${u}${p}`;case".*":return`${o}${u}${p}`;case"*.*":return`${g}${p}${o}${u}${p}`;case"*/*":return`${g}${p}${a}${u}${b}${p}`;case"**":return g+D(r);case"**/*":return`(?:${g}${D(r)}${a})?${b}${u}${p}`;case"**/*.*":return`(?:${g}${D(r)}${a})?${b}${p}${o}${u}${p}`;case"**/.*":return`(?:${g}${D(r)}${a})?${o}${u}${p}`;default:{let R=/^(.*?)\.(\w+)$/.exec(E);if(!R)return;let k=w(R[1]);return k?k+o+R[2]:void 0}}},_=kr.removePrefix(t,A),P=w(_);return P&&r.strictSlashes!==!0&&(P+=`${a}?`),P};zq.exports=AE});var Wq=v((ECe,Kq)=>{"use strict";var phe=require("path"),mhe=Hq(),OE=Gq(),xE=dl(),ghe=hl(),yhe=t=>t&&typeof t=="object"&&!Array.isArray(t),_t=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>_t(d,e,r));return d=>{for(let f of l){let m=f(d);if(m)return m}return!1}}let n=yhe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},s=xE.isWindows(e),o=n?_t.compileRe(t,e):_t.makeRe(t,e,!1,!0),a=o.state;delete o.state;let u=()=>!1;if(i.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};u=_t(i.ignore,l,r)}let c=(l,h=!1)=>{let{isMatch:d,match:f,output:m}=_t.test(l,o,e,{glob:t,posix:s}),g={glob:t,state:a,regex:o,posix:s,input:l,output:m,match:f,isMatch:d};return typeof i.onResult=="function"&&i.onResult(g),d===!1?(g.isMatch=!1,h?g:!1):u(l)?(typeof i.onIgnore=="function"&&i.onIgnore(g),g.isMatch=!1,h?g:!1):(typeof i.onMatch=="function"&&i.onMatch(g),h?g:!0)};return r&&(c.state=a),c};_t.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let s=r||{},o=s.format||(i?xE.toPosixSlashes:null),a=t===n,u=a&&o?o(t):t;return a===!1&&(u=o?o(t):t,a=u===n),(a===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?a=_t.matchBase(t,e,r,i):a=e.exec(u)),{isMatch:!!a,match:a,output:u}};_t.matchBase=(t,e,r,n=xE.isWindows(r))=>(e instanceof RegExp?e:_t.makeRe(e,r)).test(phe.basename(t));_t.isMatch=(t,e,r)=>_t(e,r)(t);_t.parse=(t,e)=>Array.isArray(t)?t.map(r=>_t.parse(r,e)):OE(t,{...e,fastpaths:!1});_t.scan=(t,e)=>mhe(t,e);_t.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},s=i.contains?"":"^",o=i.contains?"":"$",a=`${s}(?:${t.output})${o}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let u=_t.toRegex(a,e);return n===!0&&(u.state=t),u};_t.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=OE.fastpaths(t,e)),i.output||(i=OE(t,e)),_t.compileRe(i,e,r,n)};_t.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};_t.constants=ghe;Kq.exports=_t});var Yq=v((_Ce,Xq)=>{"use strict";Xq.exports=Wq()});var r6=v((CCe,t6)=>{"use strict";var Zq=require("util"),Qq=Fq(),Mn=Yq(),TE=dl(),Jq=t=>t===""||t==="./",e6=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},et=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,i=new Set,s=new Set,o=0,a=l=>{s.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let h=Mn(String(e[l]),{...r,onResult:a},!0),d=h.state.negated||h.state.negatedExtglob;d&&o++;for(let f of t){let m=h(f,!0);(d?!m.isMatch:m.isMatch)&&(d?n.add(m.output):(n.delete(m.output),i.add(m.output)))}}let c=(o===e.length?[...s]:[...i]).filter(l=>!n.has(l));if(r&&c.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(l=>l.replace(/\\/g,"")):e}return c};et.match=et;et.matcher=(t,e)=>Mn(t,e);et.isMatch=(t,e,r)=>Mn(e,r)(t);et.any=et.isMatch;et.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,i=[],s=a=>{r.onResult&&r.onResult(a),i.push(a.output)},o=new Set(et(t,e,{...r,onResult:s}));for(let a of i)o.has(a)||n.add(a);return[...n]};et.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Zq.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>et.contains(t,n,r));if(typeof e=="string"){if(Jq(t)||Jq(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return et.isMatch(t,e,{...r,contains:!0})};et.matchKeys=(t,e,r)=>{if(!TE.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=et(Object.keys(t),e,r),i={};for(let s of n)i[s]=t[s];return i};et.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=Mn(String(i),r);if(n.some(o=>s(o)))return!0}return!1};et.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=Mn(String(i),r);if(!n.every(o=>s(o)))return!1}return!0};et.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Zq.inspect(t)}"`);return[].concat(e).every(n=>Mn(n,r)(t))};et.capture=(t,e,r)=>{let n=TE.isWindows(r),s=Mn.makeRe(String(t),{...r,capture:!0}).exec(n?TE.toPosixSlashes(e):e);if(s)return s.slice(1).map(o=>o===void 0?"":o)};et.makeRe=(...t)=>Mn.makeRe(...t);et.scan=(...t)=>Mn.scan(...t);et.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of Qq(String(n),e))r.push(Mn.parse(i,e));return r};et.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!e6(t)?[t]:Qq(t,e)};et.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return et.braces(t,{...e,expand:!0})};et.hasBraces=e6;t6.exports=et});var ude={};lm(ude,{CapgoSDK:()=>tt,addApp:()=>rde,addChannel:()=>ide,addOrganization:()=>Qhe,checkBundleCompatibility:()=>Uhe,createSupabaseClient:()=>pe,decryptBundle:()=>Vhe,deleteLegacyEncryptionKey:()=>Whe,deleteOrganization:()=>tde,doctor:()=>qhe,encryptBundle:()=>Hhe,generateEncryptionKeys:()=>Ghe,getAccountId:()=>Jhe,getCapacitorConfig:()=>ade,getCurrentBundle:()=>Xhe,getStats:()=>ode,listBundles:()=>nde,listOrganizations:()=>Zhe,login:()=>Mhe,requestBuild:()=>sde,saveEncryptionKey:()=>Khe,updateAppSetting:()=>Yhe,updateOrganization:()=>ede,uploadBundle:()=>Bhe,zipBundle:()=>zhe});module.exports=ue(ude);var Ut=Oe(Ye(),1),yo=require("node:process"),Di=Oe(require("node:readline"),1),gm=Oe(require("node:readline"),1),VE=require("node:stream"),zE=Oe(dm(),1);function z6({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}var G6=z6();function GE(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(G6,"")}function KE(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var WE={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var i=n.charCodeAt(0),s=n.length==2?n.charCodeAt(1):0,o=i;return 55296<=i&&i<=56319&&56320<=s&&s<=57343&&(i&=1023,s&=1023,o=i<<10|s,o+=65536),o==12288||65281<=o&&o<=65376||65504<=o&&o<=65510?"F":o==8361||65377<=o&&o<=65470||65474<=o&&o<=65479||65482<=o&&o<=65487||65490<=o&&o<=65495||65498<=o&&o<=65500||65512<=o&&o<=65518?"H":4352<=o&&o<=4447||4515<=o&&o<=4519||4602<=o&&o<=4607||9001<=o&&o<=9002||11904<=o&&o<=11929||11931<=o&&o<=12019||12032<=o&&o<=12245||12272<=o&&o<=12283||12289<=o&&o<=12350||12353<=o&&o<=12438||12441<=o&&o<=12543||12549<=o&&o<=12589||12593<=o&&o<=12686||12688<=o&&o<=12730||12736<=o&&o<=12771||12784<=o&&o<=12830||12832<=o&&o<=12871||12880<=o&&o<=13054||13056<=o&&o<=19903||19968<=o&&o<=42124||42128<=o&&o<=42182||43360<=o&&o<=43388||44032<=o&&o<=55203||55216<=o&&o<=55238||55243<=o&&o<=55291||63744<=o&&o<=64255||65040<=o&&o<=65049||65072<=o&&o<=65106||65108<=o&&o<=65126||65128<=o&&o<=65131||110592<=o&&o<=110593||127488<=o&&o<=127490||127504<=o&&o<=127546||127552<=o&&o<=127560||127568<=o&&o<=127569||131072<=o&&o<=194367||177984<=o&&o<=196605||196608<=o&&o<=262141?"W":32<=o&&o<=126||162<=o&&o<=163||165<=o&&o<=166||o==172||o==175||10214<=o&&o<=10221||10629<=o&&o<=10630?"Na":o==161||o==164||167<=o&&o<=168||o==170||173<=o&&o<=174||176<=o&&o<=180||182<=o&&o<=186||188<=o&&o<=191||o==198||o==208||215<=o&&o<=216||222<=o&&o<=225||o==230||232<=o&&o<=234||236<=o&&o<=237||o==240||242<=o&&o<=243||247<=o&&o<=250||o==252||o==254||o==257||o==273||o==275||o==283||294<=o&&o<=295||o==299||305<=o&&o<=307||o==312||319<=o&&o<=322||o==324||328<=o&&o<=331||o==333||338<=o&&o<=339||358<=o&&o<=359||o==363||o==462||o==464||o==466||o==468||o==470||o==472||o==474||o==476||o==593||o==609||o==708||o==711||713<=o&&o<=715||o==717||o==720||728<=o&&o<=731||o==733||o==735||768<=o&&o<=879||913<=o&&o<=929||931<=o&&o<=937||945<=o&&o<=961||963<=o&&o<=969||o==1025||1040<=o&&o<=1103||o==1105||o==8208||8211<=o&&o<=8214||8216<=o&&o<=8217||8220<=o&&o<=8221||8224<=o&&o<=8226||8228<=o&&o<=8231||o==8240||8242<=o&&o<=8243||o==8245||o==8251||o==8254||o==8308||o==8319||8321<=o&&o<=8324||o==8364||o==8451||o==8453||o==8457||o==8467||o==8470||8481<=o&&o<=8482||o==8486||o==8491||8531<=o&&o<=8532||8539<=o&&o<=8542||8544<=o&&o<=8555||8560<=o&&o<=8569||o==8585||8592<=o&&o<=8601||8632<=o&&o<=8633||o==8658||o==8660||o==8679||o==8704||8706<=o&&o<=8707||8711<=o&&o<=8712||o==8715||o==8719||o==8721||o==8725||o==8730||8733<=o&&o<=8736||o==8739||o==8741||8743<=o&&o<=8748||o==8750||8756<=o&&o<=8759||8764<=o&&o<=8765||o==8776||o==8780||o==8786||8800<=o&&o<=8801||8804<=o&&o<=8807||8810<=o&&o<=8811||8814<=o&&o<=8815||8834<=o&&o<=8835||8838<=o&&o<=8839||o==8853||o==8857||o==8869||o==8895||o==8978||9312<=o&&o<=9449||9451<=o&&o<=9547||9552<=o&&o<=9587||9600<=o&&o<=9615||9618<=o&&o<=9621||9632<=o&&o<=9633||9635<=o&&o<=9641||9650<=o&&o<=9651||9654<=o&&o<=9655||9660<=o&&o<=9661||9664<=o&&o<=9665||9670<=o&&o<=9672||o==9675||9678<=o&&o<=9681||9698<=o&&o<=9701||o==9711||9733<=o&&o<=9734||o==9737||9742<=o&&o<=9743||9748<=o&&o<=9749||o==9756||o==9758||o==9792||o==9794||9824<=o&&o<=9825||9827<=o&&o<=9829||9831<=o&&o<=9834||9836<=o&&o<=9837||o==9839||9886<=o&&o<=9887||9918<=o&&o<=9919||9924<=o&&o<=9933||9935<=o&&o<=9953||o==9955||9960<=o&&o<=9983||o==10045||o==10071||10102<=o&&o<=10111||11093<=o&&o<=11097||12872<=o&&o<=12879||57344<=o&&o<=63743||65024<=o&&o<=65039||o==65533||127232<=o&&o<=127242||127248<=o&&o<=127277||127280<=o&&o<=127337||127344<=o&&o<=127386||917760<=o&&o<=917999||983040<=o&&o<=1048573||1048576<=o&&o<=1114109?"A":"N"},e.characterLength=function(n){var i=this.eastAsianWidth(n);return i=="F"||i=="W"||i=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var i=r(n),s=0,o=0;o<i.length;o++)s=s+this.characterLength(i[o]);return s},e.slice=function(n,i,s){textLen=e.length(n),i=i||0,s=s||1,i<0&&(i=textLen+i),s<0&&(s=textLen+s);for(var o="",a=0,u=r(n),c=0;c<u.length;c++){var l=u[c],h=e.length(l);if(a>=i-(h==2?1:0))if(a+h<=s)o+=l;else break;a+=h}return o}})(WE);var K6=WE.exports,W6=KE(K6),X6=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},Y6=KE(X6);function au(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=GE(t),t.length===0))return 0;t=t.replace(Y6()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let i of t){let s=i.codePointAt(0);if(!(s<=31||s>=127&&s<=159||s>=768&&s<=879))switch(W6.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var pm=10,LE=(t=0)=>e=>`\x1B[${e+t}m`,jE=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,BE=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,rt={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(rt.modifier);var J6=Object.keys(rt.color),Z6=Object.keys(rt.bgColor);[...J6,...Z6];function Q6(){let t=new Map;for(let[e,r]of Object.entries(rt)){for(let[n,i]of Object.entries(r))rt[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=rt[n],t.set(i[0],i[1]);Object.defineProperty(rt,e,{value:r,enumerable:!1})}return Object.defineProperty(rt,"codes",{value:t,enumerable:!1}),rt.color.close="\x1B[39m",rt.bgColor.close="\x1B[49m",rt.color.ansi=LE(),rt.color.ansi256=jE(),rt.color.ansi16m=BE(),rt.bgColor.ansi=LE(pm),rt.bgColor.ansi256=jE(pm),rt.bgColor.ansi16m=BE(pm),Object.defineProperties(rt,{rgbToAnsi256:{value:(e,r,n)=>e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(s=>s+s).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>rt.rgbToAnsi256(...rt.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,i;if(e>=232)r=((e-232)*10+8)/255,n=r,i=r;else{e-=16;let a=e%36;r=Math.floor(e/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let s=Math.max(r,n,i)*2;if(s===0)return 30;let o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return s===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>rt.ansi256ToAnsi(rt.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>rt.ansi256ToAnsi(rt.hexToAnsi256(e)),enumerable:!1}}),rt}var eU=Q6(),Cl=new Set(["\x1B","\x9B"]),tU=39,Dm="\x07",XE="[",rU="]",YE="m",wm=`${rU}8;;`,ME=t=>`${Cl.values().next().value}${XE}${t}${YE}`,qE=t=>`${Cl.values().next().value}${wm}${t}${Dm}`,nU=t=>t.split(" ").map(e=>au(e)),mm=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=au(GE(t[t.length-1]));for(let[a,u]of n.entries()){let c=au(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),Cl.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith(wm)),i){s?u===Dm&&(i=!1,s=!1):u===YE&&(i=!1);continue}o+=c,o===r&&a<n.length-1&&(t.push(""),o=0)}!o&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},iU=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(au(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},sU=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,s,o=nU(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let h=au(a[a.length-1]);if(c!==0&&(h>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),h=0),(h>0||r.trim===!1)&&(a[a.length-1]+=" ",h++)),r.hard&&o[c]>e){let d=e-h,f=1+Math.floor((o[c]-d-1)/e);Math.floor((o[c]-1)/e)<f&&a.push(""),mm(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){mm(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){mm(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>iU(c)));let u=[...a.join(`
|
|
239
239
|
`)];for(let[c,l]of u.entries()){if(n+=l,Cl.has(l)){let{groups:d}=new RegExp(`(?:\\${XE}(?<code>\\d+)m|\\${wm}(?<uri>.*)${Dm})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let f=Number.parseFloat(d.code);i=f===tU?void 0:f}else d.uri!==void 0&&(s=d.uri.length===0?void 0:d.uri)}let h=eU.codes.get(Number(i));u[c+1]===`
|
|
240
240
|
`?(s&&(n+=qE("")),i&&h&&(n+=ME(h))):l===`
|
|
241
241
|
`&&(i&&h&&(n+=ME(i)),s&&(n+=qE(s)))}return n};function UE(t,e,r){return String(t).normalize().replace(/\r\n/g,`
|
|
@@ -248,7 +248,7 @@ tell application "System Events" to get value of property list item "CFBundleNam
|
|
|
248
248
|
`).length-1;this.output.write(Ut.cursor.move(-999,e*-1))}render(){let e=UE(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(Ut.cursor.hide);else{let r=aU(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(Ut.cursor.move(0,n)),this.output.write(Ut.erase.lines(1));let i=e.split(`
|
|
249
249
|
`);this.output.write(i[n]),this._prevFrame=e,this.output.write(Ut.cursor.move(0,i.length-n-1));return}if(r&&r?.length>1){let n=r[0];this.output.write(Ut.cursor.move(0,n)),this.output.write(Ut.erase.down());let i=e.split(`
|
|
250
250
|
`).slice(n);this.output.write(i.join(`
|
|
251
|
-
`)),this._prevFrame=e;return}this.output.write(Ut.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},vl=class extends uu{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(Ut.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var fU;fU=new WeakMap;var hU=Object.defineProperty,dU=(t,e,r)=>e in t?hU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,HE=(t,e,r)=>(dU(t,typeof e!="symbol"?e+"":e,r),r),El=class extends uu{constructor(e){super(e,!1),HE(this,"options"),HE(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:r})=>r===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",r=>{switch(r){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};var _l=class extends uu{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let e=this.value.slice(0,this.cursor),[r,...n]=this.value.slice(this.cursor);return`${e}${zE.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var Nr=Oe(require("node:process"),1),Y=Oe(dm(),1),Sl=Oe(Ye(),1);function pU(){return Nr.default.platform!=="win32"?Nr.default.env.TERM!=="linux":!!Nr.default.env.CI||!!Nr.default.env.WT_SESSION||!!Nr.default.env.TERMINUS_SUBLIME||Nr.default.env.ConEmuTask==="{cmd::Cmder}"||Nr.default.env.TERM_PROGRAM==="Terminus-Sublime"||Nr.default.env.TERM_PROGRAM==="vscode"||Nr.default.env.TERM==="xterm-256color"||Nr.default.env.TERM==="alacritty"||Nr.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var vm=pU(),bt=(t,e)=>vm?t:e,mU=bt("\u25C6","*"),ZE=bt("\u25A0","x"),QE=bt("\u25B2","x"),Cm=bt("\u25C7","o"),gU=bt("\u250C","T"),ot=bt("\u2502","|"),cu=bt("\u2514","\u2014"),Em=bt("\u25CF",">"),_m=bt("\u25CB"," "),
|
|
251
|
+
`)),this._prevFrame=e;return}this.output.write(Ut.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},vl=class extends uu{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(Ut.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var fU;fU=new WeakMap;var hU=Object.defineProperty,dU=(t,e,r)=>e in t?hU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,HE=(t,e,r)=>(dU(t,typeof e!="symbol"?e+"":e,r),r),El=class extends uu{constructor(e){super(e,!1),HE(this,"options"),HE(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:r})=>r===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",r=>{switch(r){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};var _l=class extends uu{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let e=this.value.slice(0,this.cursor),[r,...n]=this.value.slice(this.cursor);return`${e}${zE.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var Nr=Oe(require("node:process"),1),Y=Oe(dm(),1),Sl=Oe(Ye(),1);function pU(){return Nr.default.platform!=="win32"?Nr.default.env.TERM!=="linux":!!Nr.default.env.CI||!!Nr.default.env.WT_SESSION||!!Nr.default.env.TERMINUS_SUBLIME||Nr.default.env.ConEmuTask==="{cmd::Cmder}"||Nr.default.env.TERM_PROGRAM==="Terminus-Sublime"||Nr.default.env.TERM_PROGRAM==="vscode"||Nr.default.env.TERM==="xterm-256color"||Nr.default.env.TERM==="alacritty"||Nr.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var vm=pU(),bt=(t,e)=>vm?t:e,mU=bt("\u25C6","*"),ZE=bt("\u25A0","x"),QE=bt("\u25B2","x"),Cm=bt("\u25C7","o"),gU=bt("\u250C","T"),ot=bt("\u2502","|"),cu=bt("\u2514","\u2014"),Em=bt("\u25CF",">"),_m=bt("\u25CB"," "),wde=bt("\u25FB","[\u2022]"),bde=bt("\u25FC","[+]"),vde=bt("\u25FB","[ ]"),Ede=bt("\u25AA","\u2022"),_de=bt("\u2500","-"),Cde=bt("\u256E","+"),Sde=bt("\u251C","+"),Ade=bt("\u256F","+"),yU=bt("\u25CF","\u2022"),DU=bt("\u25C6","*"),wU=bt("\u25B2","!"),bU=bt("\u25A0","x"),Sm=t=>{switch(t){case"initial":case"active":return Y.default.cyan(mU);case"cancel":return Y.default.red(ZE);case"error":return Y.default.yellow(QE);case"submit":return Y.default.green(Cm)}},vU=t=>{let{cursor:e,options:r,style:n}=t,i=t.maxItems??Number.POSITIVE_INFINITY,s=Math.max(process.stdout.rows-4,0),o=Math.min(s,Math.max(i,5)),a=0;e>=a+o-3?a=Math.max(Math.min(e-o+3,r.length-o),0):e<a+2&&(a=Math.max(e-2,0));let u=o<r.length&&a>0,c=o<r.length&&a+o<r.length;return r.slice(a,a+o).map((l,h,d)=>{let f=h===0&&u,m=h===d.length-1&&c;return f||m?Y.default.dim("..."):n(l,h+a===e)})},Do=t=>new _l({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${Y.default.gray(ot)}
|
|
252
252
|
${Sm(this.state)} ${t.message}
|
|
253
253
|
`,r=t.placeholder?Y.default.inverse(t.placeholder[0])+Y.default.dim(t.placeholder.slice(1)):Y.default.inverse(Y.default.hidden("_")),n=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${e.trim()}
|
|
254
254
|
${Y.default.yellow(ot)} ${n}
|
|
@@ -271,37 +271,37 @@ ${Y.default.cyan(cu)}
|
|
|
271
271
|
`)},ce=(t="")=>{process.stdout.write(`${Y.default.gray(ot)}
|
|
272
272
|
${Y.default.gray(cu)} ${t}
|
|
273
273
|
|
|
274
|
-
`)},
|
|
274
|
+
`)},y={message:(t="",{symbol:e=Y.default.gray(ot)}={})=>{let r=[`${Y.default.gray(ot)}`];if(t){let[n,...i]=t.split(`
|
|
275
275
|
`);r.push(`${e} ${n}`,...i.map(s=>`${Y.default.gray(ot)} ${s}`))}process.stdout.write(`${r.join(`
|
|
276
276
|
`)}
|
|
277
|
-
`)},info:t=>{
|
|
278
|
-
`);let
|
|
279
|
-
`);process.stdout.write(Sl.cursor.move(-999,
|
|
280
|
-
`);let w=0,_=0;f(),s=setInterval(()=>{if(n&&a===u)return;g(),u=a;let P=Y.default.magenta(e[w]);if(n)process.stdout.write(`${P} ${a}...`);else if(t==="timer")process.stdout.write(`${P} ${a} ${S(c)}`);else{let E=".".repeat(Math.floor(_)).slice(0,3);process.stdout.write(`${P} ${a}${E}`)}w=w+1<e.length?w+1:0,_=_<e.length?_+.125:0},r)},p=(
|
|
277
|
+
`)},info:t=>{y.message(t,{symbol:Y.default.blue(yU)})},success:t=>{y.message(t,{symbol:Y.default.green(DU)})},step:t=>{y.message(t,{symbol:Y.default.green(Cm)})},warn:t=>{y.message(t,{symbol:Y.default.yellow(wU)})},warning:t=>{y.warn(t)},error:t=>{y.message(t,{symbol:Y.default.red(bU)})}},Ode=`${Y.default.gray(ot)} `;var Ft=({indicator:t="dots"}={})=>{let e=vm?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=vm?80:120,n=process.env.CI==="true",i,s,o=!1,a="",u,c=performance.now(),l=D=>{let w=D>1?"Something went wrong":"Canceled";o&&p(w,D)},h=()=>l(2),d=()=>l(1),f=()=>{process.on("uncaughtExceptionMonitor",h),process.on("unhandledRejection",h),process.on("SIGINT",d),process.on("SIGTERM",d),process.on("exit",l)},m=()=>{process.removeListener("uncaughtExceptionMonitor",h),process.removeListener("unhandledRejection",h),process.removeListener("SIGINT",d),process.removeListener("SIGTERM",d),process.removeListener("exit",l)},g=()=>{if(u===void 0)return;n&&process.stdout.write(`
|
|
278
|
+
`);let D=u.split(`
|
|
279
|
+
`);process.stdout.write(Sl.cursor.move(-999,D.length-1)),process.stdout.write(Sl.erase.down(D.length))},b=D=>D.replace(/\.+$/,""),S=D=>{let w=(performance.now()-D)/1e3,_=Math.floor(w/60),P=Math.floor(w%60);return _>0?`[${_}m ${P}s]`:`[${P}s]`},A=(D="")=>{o=!0,i=JE(),a=b(D),c=performance.now(),process.stdout.write(`${Y.default.gray(ot)}
|
|
280
|
+
`);let w=0,_=0;f(),s=setInterval(()=>{if(n&&a===u)return;g(),u=a;let P=Y.default.magenta(e[w]);if(n)process.stdout.write(`${P} ${a}...`);else if(t==="timer")process.stdout.write(`${P} ${a} ${S(c)}`);else{let E=".".repeat(Math.floor(_)).slice(0,3);process.stdout.write(`${P} ${a}${E}`)}w=w+1<e.length?w+1:0,_=_<e.length?_+.125:0},r)},p=(D="",w=0)=>{o=!1,clearInterval(s),g();let _=w===0?Y.default.green(Cm):w===1?Y.default.red(ZE):Y.default.red(QE);a=b(D??a),t==="timer"?process.stdout.write(`${_} ${a} ${S(c)}
|
|
281
281
|
`):process.stdout.write(`${_} ${a}
|
|
282
|
-
`),m(),i()};return{start:A,stop:p,message:(
|
|
283
|
-
`)}};var M8=require("node:child_process"),Xe=require("node:fs"),kp=require("node:os"),We=Oe(require("node:path")),Nn=require("node:process"),ts=Oe(Ol());var Jt=require("fs"),fu=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Jt.existsSync)(r)||(0,Jt.existsSync)(n)?"bun":(0,Jt.existsSync)(i)||(0,Jt.existsSync)(s)?"pnpm":(0,Jt.existsSync)(o)?"yarn":(0,Jt.existsSync)(a)||(0,Jt.existsSync)(u)?"npm":e},xl=(t=fu(),e=!1)=>{switch(t){case"bun":return e?"bun install":"install";case"pnpm":return e?"pnpm install":"install";case"yarn":return e?"yarn install":"install";case"npm":return e?"npm install":"install";case"unknown":return e?"unknown unknown":"unknown";default:return e?"npm install":"install"}},t_=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Jt.existsSync)(r)||(0,Jt.existsSync)(n)?"bunx":(0,Jt.existsSync)(i)||(0,Jt.existsSync)(s)?"pnpm exec":(0,Jt.existsSync)(o)?"yarn dlx":(0,Jt.existsSync)(a)||(0,Jt.existsSync)(u)?"npx":e};function Tl(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function i_(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Tm(t=[],e=[]){let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let i=t[n],s=e[n];if(i===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(i===void 0)return-1;if(typeof i=="string"&&typeof s=="number")return 1;if(typeof i=="number"&&typeof s=="string"||i<s)return-1;if(i>s)return 1}return 0}var bo="0|[1-9]\\d*",SU="\\d*[a-zA-Z-][a-zA-Z0-9-]*",AU=`(?<major>${bo})\\.(?<minor>${bo})\\.(?<patch>${bo})`,r_=`(?:${bo}|${SU})`,s_=`(?:-(?<prerelease>${r_}(?:\\.${r_})*))`,n_="[0-9A-Za-z-]+",o_=`(?:\\+(?<buildmetadata>${n_}(?:\\.${n_})*))`,a_=`v?${AU}${s_}?${o_}?`,u_=new RegExp(`^${a_}$`),c_="(?:<|>)?=?",OU="x|X|\\*",xm=`${bo}|${OU}`,Fl=`[v=\\s]*(?<major>${xm})(?:\\.(?<minor>${xm})(?:\\.(?<patch>${xm})${s_}?${o_}?)?)?`,l_=new RegExp(`^(?<operator>~>?|\\^|${c_})\\s*${Fl}$`),f_=new RegExp(`^(?<operator>${c_})\\s*(${a_})$|^$`);function Fm(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Im=256;var xU=new RegExp(`^${bo}$`);function Zt(t){return t.split(".").filter(Boolean).map(e=>{if(xU.test(e)){let r=Number(e);if(Fm(r))return r}return e})}function Zr(t){return t.split(".").filter(Boolean)}function bi(t,e){let r=Number(t);if(!Fm(r))throw new TypeError(e);return r}function qn(t){return Number.isNaN(t.major)&&Number.isNaN(t.minor)&&Number.isNaN(t.patch)&&(t.prerelease===void 0||t.prerelease.length===0)&&(t.build===void 0||t.build.length===0)}function Qt(t,e){return t===e?0:Tl(t.major,e.major)||Tl(t.minor,e.minor)||Tl(t.patch,e.patch)||i_(t.prerelease,e.prerelease)||Tm(t.prerelease,e.prerelease)}function Pm(t){return t.toFixed(0)}function vi(t){let e=Pm(t.major),r=Pm(t.minor),n=Pm(t.patch),i=t.prerelease?.join(".")??"",s=t.build?.join(".")??"";return[[`${e}.${r}.${n}`,i].filter(u=>u).join("-"),s].filter(u=>u).join("+")}function TU(t,e){if(qn(e))return!0;let r=Qt(t,e);switch(e.operator){case"=":case void 0:return r===0;case"!=":return r!==0;case">":return r>0;case"<":return r<0;case">=":return r>=0;case"<=":return r<=0}}function Il(t,e){for(let r of e)if(!TU(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(qn(r))continue;let{major:n,minor:i,patch:s,prerelease:o}=r;if(o&&o.length>0&&t.major===n&&t.minor===i&&t.patch===s)return!0}return!1}return!0}function hu(t,e){return e.some(r=>Il(t,r))}function FU(t=[]){let e=[...t],r=e.length;for(;r>=0;){let n=e[r];if(typeof n=="number"){e[r]=n+1;break}r-=1}return r===-1&&e.push(0),e}function du(t=[],e){let r=FU(t);if(!e)return r;let n=Zt(e);if(n.every(i=>typeof i=="string")){if(n.every((i,s)=>i===r[s])&&typeof r[n.length]=="number")return r;n=[...n,0]}return n}function h_(t,e,r={}){let n=r.build!==void 0?Zr(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:du(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:du(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:du(t.prerelease,r.prerelease),build:n};case"prerelease":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:du(t.prerelease,r.prerelease),build:n}}case"major":return{major:(t.prerelease??[]).length===0||t.minor!==0||t.patch!==0?t.major+1:t.major,minor:0,patch:0,prerelease:[],build:n};case"minor":{let s=(t.prerelease??[]).length===0||t.patch!==0?t.minor+1:t.minor;return{major:t.major,minor:s,patch:0,prerelease:[],build:n}}case"patch":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:[],build:n}}case"pre":return{major:t.major,minor:t.minor,patch:t.patch,prerelease:du(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var Pl={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},vo={operator:void 0,...Pl};function km(t,e){return Qt(t,e)>0}function Rm(t,e){return Qt(t,e)<0}function IU(t){let r=t.match(f_)?.groups;if(!r)return null;let{operator:n,prerelease:i,buildmetadata:s}=r,o=r.major?{major:bi(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:bi(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:bi(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:i?Zt(i):[],build:s?Zr(s):[]}:Pl;return{operator:n||void 0,...o}}function qe(t){return!t||t.toLowerCase()==="x"||t==="*"}function PU(t){if(!qe(t.major))return qe(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:qe(t.patch)?{operator:">=",major:+t.major,minor:+t.minor,patch:0,prerelease:[],build:[]}:{operator:">=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:t.prerelease?Zt(t.prerelease):[],build:[]}}function kU(t){if(!qe(t.major))return qe(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:qe(t.patch)?{operator:"<",major:+t.major,minor:+t.minor+1,patch:0,prerelease:[],build:[]}:t.prerelease?{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:Zt(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function RU(t){let e=t.match(new RegExp(`^${Fl}`)),r=e?.groups;if(!r)return null;let n=e[0].length,i=t.slice(n).match(/^\s+-\s+/);if(!i)return null;let s=i[0].length,a=t.slice(n+s).match(new RegExp(`^${Fl}\\s*$`))?.groups;if(!a)return null;let u=PU(r),c=kU(a);return[u,c].filter(Boolean)}function NU(t){let e=qe(t.major),r=qe(t.minor),n=qe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return i===0?[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];let a=Zt(t.prerelease??"");return i===0?s===0?[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s,patch:o+1}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i+1,minor:0,patch:0}]}function $U(t){let e=qe(t.major),r=qe(t.minor),n=qe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=Zt(t.prerelease??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]}function LU(t){let e=qe(t.major),r=qe(t.minor),n=qe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return n?[{operator:"<",major:i,minor:0,patch:0}]:[{operator:"<",major:i,minor:0,patch:0}];if(n)return[{operator:"<",major:i,minor:s,patch:0}];let a=Zt(t.prerelease??""),u=Zr(t.build??"");return[{operator:"<",major:i,minor:s,patch:o,prerelease:a,build:u}]}function jU(t){let e=qe(t.minor),r=qe(t.patch),n=+t.major,i=+t.minor,s=+t.patch;if(e)return r?[{operator:"<",major:n+1,minor:0,patch:0}]:[{operator:"<",major:n,minor:i+1,patch:0}];if(r)return[{operator:"<",major:n,minor:i+1,patch:0}];let o=Zt(t.prerelease??""),a=Zr(t.build??"");return[{operator:"<=",major:n,minor:i,patch:s,prerelease:o,build:a}]}function BU(t){let e=qe(t.major),r=qe(t.minor),n=qe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return[{operator:">=",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s+1,patch:0}];let a=Zt(t.prerelease??""),u=Zr(t.build??"");return[{operator:">",major:i,minor:s,patch:o,prerelease:a,build:u}]}function MU(t){let e=qe(t.major),r=qe(t.minor),n=qe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return n?[{operator:">=",major:i,minor:0,patch:0}]:[{operator:">=",major:i,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0}];let a=Zt(t.prerelease??""),u=Zr(t.build??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a,build:u}]}function qU(t){let e=qe(t.major),r=qe(t.minor),n=qe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=Zt(t.prerelease??""),u=Zr(t.build??"");return[{operator:void 0,major:i,minor:s,patch:o,prerelease:a,build:u}]}function UU(t){let e=t.match(l_)?.groups;if(!e)return IU(t);switch(e.operator){case"^":return NU(e);case"~":case"~>":return $U(e);case"<":return LU(e);case"<=":return jU(e);case">":return BU(e);case">=":return MU(e);case"=":case"":return qU(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function HU(t){return t.split(/\s+/).flatMap(UU)}function kl(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>RU(r)||HU(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function Ct(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>Im)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Im}`);t=t.trim();let e=t.match(u_)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=bi(e.major,`Cannot parse version ${t}: invalid major version`),n=bi(e.minor,`Cannot parse version ${t}: invalid minor version`),i=bi(e.patch,`Cannot parse version ${t}: invalid patch version`),s=e.prerelease?Zt(e.prerelease):[],o=e.buildmetadata?Zr(e.buildmetadata):[];return{major:r,minor:n,patch:i,prerelease:s,build:o}}function d_(t,e){let r=t.operator,n=e.operator;if(r===void 0)return qn(t)?!0:hu(t,[[e]]);if(n===void 0)return qn(e)?!0:hu(e,[[t]]);let i=Qt(t,e);return(r===">="||r===">")&&(n===">="||n===">")||(r==="<="||r==="<")&&(n==="<="||n==="<")||i===0&&((r===">="||r==="<=")&&(n===">="||n==="<="))||i===-1&&(r===">="||r===">")&&(n==="<="||n==="<")||i===1&&(r==="<="||r==="<")&&(n===">="||n===">")}function VU(t){return t.every(e=>e.some(r=>zU(r)))}function zU(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!d_(r,n))return!1}return!0}function p_(t,e){return VU([t,e])&&t.some(r=>e.some(n=>r.every(i=>n.every(s=>d_(i,s)))))}function m_(t){try{return Ct(t),!0}catch{return!1}}function Ei(t,e){return Qt(t,e)>=0}var Ka=Oe(hS()),Zv=Oe(zS()),q8=Oe(EA()),Rp=Oe(a0());var Pi={name:"@capgo/cli",version:"7.28.1",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24.9.1","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.25.11",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^10.1.2",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};async function $h(t){try{let r=`https://registry.npmjs.org/${encodeURIComponent(t.toLowerCase())}`,n=await fetch(r,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});return n.ok&&(await n.json())["dist-tags"]?.latest||null}catch{return null}}async function ze(){let t=await $h("@capgo/cli")??"",e=t?.split(".")[0];t!==Pi.version&&D.warning(`\u{1F6A8} You are using @capgo/cli@${Pi.version} it's not the latest version.
|
|
282
|
+
`),m(),i()};return{start:A,stop:p,message:(D="")=>{a=b(D??a)}}};function e_(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),i="\x1B[";return i+n+"m"+e+i+"0m"}var Ht=class t{title=null;headers=[];rows=[];static narrowTheme={top:["\u2554","\u2550","\u2564","\u2557"],row:["\u2551"," ","\u2502","\u2551"],div:["\u255F","\u2500","\u253C","\u2562"],bot:["\u255A","\u2550","\u2567","\u255D"]};static wideTheme={top:["\u2554\u2550","\u2550","\u2550\u2564\u2550","\u2550\u2557"],row:["\u2551 "," "," \u2502 "," \u2551"],div:["\u255F\u2500","\u2500","\u2500\u253C\u2500","\u2500\u2562"],bot:["\u255A\u2550","\u2550","\u2550\u2567\u2550","\u2550\u255D"]};static roundTheme={top:["\u256D\u2500","\u2500","\u2500\u252C\u2500","\u2500\u256E"],row:["\u2502 "," "," \u2502 "," \u2502"],div:["\u251C\u2500","\u2500","\u2500\u253C\u2500","\u2500\u2524"],bot:["\u2570\u2500","\u2500","\u2500\u2534\u2500","\u2500\u256F"]};theme=t.wideTheme;columnWidth(){let e=[this.headers,...this.rows].filter(n=>n.length>0),r=e[0].map(n=>this.cast(n).length);for(let n of e.slice(1))for(let i=0;i<r.length;i++){let s=this.cast(n[i]).length;s>r[i]&&(r[i]=s)}return r}cast(e){return typeof e=="object"?"obj":e!==void 0&&typeof e.toString=="function"?e.toString():""}renderTitle(){return"[ "+this.title+" ]"}renderLine(e){let r=this.columnWidth();return e[0]+r.map(n=>e[1].repeat(n)).join(e[2])+e[3]}renderCell(e,r,n=!1){let i=this.cast(e),s=n?e_("bold",i):i,o=r-i.length,a=this.theme.row[1];switch(typeof e){case"number":return a.repeat(o)+s;case"string":return s+a.repeat(o);case"boolean":case"object":return a.repeat(Math.ceil(o/2))+e_("italic",i)+a.repeat(Math.floor(o/2));default:return a.repeat(o)}}renderRow(e,r=!1){let n=this.theme.row,i=this.columnWidth();return n[0]+e.map((s,o)=>this.renderCell(s,i[o],r)).join(n[2])+n[3]}toString(){let e=this.theme,r=this.headers.length>0,n=this.rows.length>0;return[this.title?this.renderTitle():"",r||n?this.renderLine(e.top):"",r?this.renderRow(this.headers,!0):"",r&&n?this.renderLine(e.div):"",...this.rows.map(i=>this.renderRow(i)),r||n?this.renderLine(e.bot):""].filter(i=>i.length>0).join(`
|
|
283
|
+
`)}};var M8=require("node:child_process"),Xe=require("node:fs"),kp=require("node:os"),We=Oe(require("node:path")),Nn=require("node:process"),ts=Oe(Ol());var Jt=require("fs"),fu=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Jt.existsSync)(r)||(0,Jt.existsSync)(n)?"bun":(0,Jt.existsSync)(i)||(0,Jt.existsSync)(s)?"pnpm":(0,Jt.existsSync)(o)?"yarn":(0,Jt.existsSync)(a)||(0,Jt.existsSync)(u)?"npm":e},xl=(t=fu(),e=!1)=>{switch(t){case"bun":return e?"bun install":"install";case"pnpm":return e?"pnpm install":"install";case"yarn":return e?"yarn install":"install";case"npm":return e?"npm install":"install";case"unknown":return e?"unknown unknown":"unknown";default:return e?"npm install":"install"}},t_=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Jt.existsSync)(r)||(0,Jt.existsSync)(n)?"bunx":(0,Jt.existsSync)(i)||(0,Jt.existsSync)(s)?"pnpm exec":(0,Jt.existsSync)(o)?"yarn dlx":(0,Jt.existsSync)(a)||(0,Jt.existsSync)(u)?"npx":e};function Tl(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function i_(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Tm(t=[],e=[]){let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let i=t[n],s=e[n];if(i===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(i===void 0)return-1;if(typeof i=="string"&&typeof s=="number")return 1;if(typeof i=="number"&&typeof s=="string"||i<s)return-1;if(i>s)return 1}return 0}var bo="0|[1-9]\\d*",SU="\\d*[a-zA-Z-][a-zA-Z0-9-]*",AU=`(?<major>${bo})\\.(?<minor>${bo})\\.(?<patch>${bo})`,r_=`(?:${bo}|${SU})`,s_=`(?:-(?<prerelease>${r_}(?:\\.${r_})*))`,n_="[0-9A-Za-z-]+",o_=`(?:\\+(?<buildmetadata>${n_}(?:\\.${n_})*))`,a_=`v?${AU}${s_}?${o_}?`,u_=new RegExp(`^${a_}$`),c_="(?:<|>)?=?",OU="x|X|\\*",xm=`${bo}|${OU}`,Fl=`[v=\\s]*(?<major>${xm})(?:\\.(?<minor>${xm})(?:\\.(?<patch>${xm})${s_}?${o_}?)?)?`,l_=new RegExp(`^(?<operator>~>?|\\^|${c_})\\s*${Fl}$`),f_=new RegExp(`^(?<operator>${c_})\\s*(${a_})$|^$`);function Fm(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Im=256;var xU=new RegExp(`^${bo}$`);function Zt(t){return t.split(".").filter(Boolean).map(e=>{if(xU.test(e)){let r=Number(e);if(Fm(r))return r}return e})}function Zr(t){return t.split(".").filter(Boolean)}function bi(t,e){let r=Number(t);if(!Fm(r))throw new TypeError(e);return r}function qn(t){return Number.isNaN(t.major)&&Number.isNaN(t.minor)&&Number.isNaN(t.patch)&&(t.prerelease===void 0||t.prerelease.length===0)&&(t.build===void 0||t.build.length===0)}function Qt(t,e){return t===e?0:Tl(t.major,e.major)||Tl(t.minor,e.minor)||Tl(t.patch,e.patch)||i_(t.prerelease,e.prerelease)||Tm(t.prerelease,e.prerelease)}function Pm(t){return t.toFixed(0)}function vi(t){let e=Pm(t.major),r=Pm(t.minor),n=Pm(t.patch),i=t.prerelease?.join(".")??"",s=t.build?.join(".")??"";return[[`${e}.${r}.${n}`,i].filter(u=>u).join("-"),s].filter(u=>u).join("+")}function TU(t,e){if(qn(e))return!0;let r=Qt(t,e);switch(e.operator){case"=":case void 0:return r===0;case"!=":return r!==0;case">":return r>0;case"<":return r<0;case">=":return r>=0;case"<=":return r<=0}}function Il(t,e){for(let r of e)if(!TU(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(qn(r))continue;let{major:n,minor:i,patch:s,prerelease:o}=r;if(o&&o.length>0&&t.major===n&&t.minor===i&&t.patch===s)return!0}return!1}return!0}function hu(t,e){return e.some(r=>Il(t,r))}function FU(t=[]){let e=[...t],r=e.length;for(;r>=0;){let n=e[r];if(typeof n=="number"){e[r]=n+1;break}r-=1}return r===-1&&e.push(0),e}function du(t=[],e){let r=FU(t);if(!e)return r;let n=Zt(e);if(n.every(i=>typeof i=="string")){if(n.every((i,s)=>i===r[s])&&typeof r[n.length]=="number")return r;n=[...n,0]}return n}function h_(t,e,r={}){let n=r.build!==void 0?Zr(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:du(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:du(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:du(t.prerelease,r.prerelease),build:n};case"prerelease":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:du(t.prerelease,r.prerelease),build:n}}case"major":return{major:(t.prerelease??[]).length===0||t.minor!==0||t.patch!==0?t.major+1:t.major,minor:0,patch:0,prerelease:[],build:n};case"minor":{let s=(t.prerelease??[]).length===0||t.patch!==0?t.minor+1:t.minor;return{major:t.major,minor:s,patch:0,prerelease:[],build:n}}case"patch":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:[],build:n}}case"pre":return{major:t.major,minor:t.minor,patch:t.patch,prerelease:du(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var Pl={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},vo={operator:void 0,...Pl};function km(t,e){return Qt(t,e)>0}function Rm(t,e){return Qt(t,e)<0}function IU(t){let r=t.match(f_)?.groups;if(!r)return null;let{operator:n,prerelease:i,buildmetadata:s}=r,o=r.major?{major:bi(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:bi(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:bi(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:i?Zt(i):[],build:s?Zr(s):[]}:Pl;return{operator:n||void 0,...o}}function qe(t){return!t||t.toLowerCase()==="x"||t==="*"}function PU(t){if(!qe(t.major))return qe(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:qe(t.patch)?{operator:">=",major:+t.major,minor:+t.minor,patch:0,prerelease:[],build:[]}:{operator:">=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:t.prerelease?Zt(t.prerelease):[],build:[]}}function kU(t){if(!qe(t.major))return qe(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:qe(t.patch)?{operator:"<",major:+t.major,minor:+t.minor+1,patch:0,prerelease:[],build:[]}:t.prerelease?{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:Zt(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function RU(t){let e=t.match(new RegExp(`^${Fl}`)),r=e?.groups;if(!r)return null;let n=e[0].length,i=t.slice(n).match(/^\s+-\s+/);if(!i)return null;let s=i[0].length,a=t.slice(n+s).match(new RegExp(`^${Fl}\\s*$`))?.groups;if(!a)return null;let u=PU(r),c=kU(a);return[u,c].filter(Boolean)}function NU(t){let e=qe(t.major),r=qe(t.minor),n=qe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return i===0?[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];let a=Zt(t.prerelease??"");return i===0?s===0?[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s,patch:o+1}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i+1,minor:0,patch:0}]}function $U(t){let e=qe(t.major),r=qe(t.minor),n=qe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=Zt(t.prerelease??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]}function LU(t){let e=qe(t.major),r=qe(t.minor),n=qe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return n?[{operator:"<",major:i,minor:0,patch:0}]:[{operator:"<",major:i,minor:0,patch:0}];if(n)return[{operator:"<",major:i,minor:s,patch:0}];let a=Zt(t.prerelease??""),u=Zr(t.build??"");return[{operator:"<",major:i,minor:s,patch:o,prerelease:a,build:u}]}function jU(t){let e=qe(t.minor),r=qe(t.patch),n=+t.major,i=+t.minor,s=+t.patch;if(e)return r?[{operator:"<",major:n+1,minor:0,patch:0}]:[{operator:"<",major:n,minor:i+1,patch:0}];if(r)return[{operator:"<",major:n,minor:i+1,patch:0}];let o=Zt(t.prerelease??""),a=Zr(t.build??"");return[{operator:"<=",major:n,minor:i,patch:s,prerelease:o,build:a}]}function BU(t){let e=qe(t.major),r=qe(t.minor),n=qe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return[{operator:">=",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s+1,patch:0}];let a=Zt(t.prerelease??""),u=Zr(t.build??"");return[{operator:">",major:i,minor:s,patch:o,prerelease:a,build:u}]}function MU(t){let e=qe(t.major),r=qe(t.minor),n=qe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return n?[{operator:">=",major:i,minor:0,patch:0}]:[{operator:">=",major:i,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0}];let a=Zt(t.prerelease??""),u=Zr(t.build??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a,build:u}]}function qU(t){let e=qe(t.major),r=qe(t.minor),n=qe(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=Zt(t.prerelease??""),u=Zr(t.build??"");return[{operator:void 0,major:i,minor:s,patch:o,prerelease:a,build:u}]}function UU(t){let e=t.match(l_)?.groups;if(!e)return IU(t);switch(e.operator){case"^":return NU(e);case"~":case"~>":return $U(e);case"<":return LU(e);case"<=":return jU(e);case">":return BU(e);case">=":return MU(e);case"=":case"":return qU(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function HU(t){return t.split(/\s+/).flatMap(UU)}function kl(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>RU(r)||HU(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function Ct(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>Im)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Im}`);t=t.trim();let e=t.match(u_)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=bi(e.major,`Cannot parse version ${t}: invalid major version`),n=bi(e.minor,`Cannot parse version ${t}: invalid minor version`),i=bi(e.patch,`Cannot parse version ${t}: invalid patch version`),s=e.prerelease?Zt(e.prerelease):[],o=e.buildmetadata?Zr(e.buildmetadata):[];return{major:r,minor:n,patch:i,prerelease:s,build:o}}function d_(t,e){let r=t.operator,n=e.operator;if(r===void 0)return qn(t)?!0:hu(t,[[e]]);if(n===void 0)return qn(e)?!0:hu(e,[[t]]);let i=Qt(t,e);return(r===">="||r===">")&&(n===">="||n===">")||(r==="<="||r==="<")&&(n==="<="||n==="<")||i===0&&((r===">="||r==="<=")&&(n===">="||n==="<="))||i===-1&&(r===">="||r===">")&&(n==="<="||n==="<")||i===1&&(r==="<="||r==="<")&&(n===">="||n===">")}function VU(t){return t.every(e=>e.some(r=>zU(r)))}function zU(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!d_(r,n))return!1}return!0}function p_(t,e){return VU([t,e])&&t.some(r=>e.some(n=>r.every(i=>n.every(s=>d_(i,s)))))}function m_(t){try{return Ct(t),!0}catch{return!1}}function Ei(t,e){return Qt(t,e)>=0}var Ka=Oe(hS()),Zv=Oe(zS()),q8=Oe(EA()),Rp=Oe(a0());var Pi={name:"@capgo/cli",version:"7.29.1",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24.9.1","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.25.11",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^10.1.2",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};async function $h(t){try{let r=`https://registry.npmjs.org/${encodeURIComponent(t.toLowerCase())}`,n=await fetch(r,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});return n.ok&&(await n.json())["dist-tags"]?.latest||null}catch{return null}}async function ze(){let t=await $h("@capgo/cli")??"",e=t?.split(".")[0];t!==Pi.version&&y.warning(`\u{1F6A8} You are using @capgo/cli@${Pi.version} it's not the latest version.
|
|
284
284
|
Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}async function RT(t,e,r,n,i,s="\u2705"){await Ae(r,{channel:t,event:n,icon:s,user_id:e,...i?{tags:{"app-id":i}}:{},notify:!1})}var u0=require("node:buffer"),NT=require("node:crypto"),eY=(()=>{let t=[];for(let e=0;e<256;e++){let r=e;for(let n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;t[e]=r}return t})();function tY(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=eY[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function Yn(t,e="sha256"){let r=u0.Buffer.isBuffer(t)?t:u0.Buffer.from(t);if(e==="crc32")return tY(r);let n=(0,NT.createHash)(e);return n.update(r),n.digest("hex")}var Qc=Oe(i8());async function s8(){let t=await(0,Qc.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function Tv(t,e,r=!1){let n=await(0,Qc.loadConfig)(),{extConfig:i}=n.app;i&&(i.plugins||(i.plugins={extConfig:{},[t]:{}}),i.plugins[t]||(i.plugins[t]={}),r?i=e.config:i.plugins[t]=e.config.plugins?.[t],(0,Qc.writeConfig)(i,n.app.extConfigFilePath))}async function Ha(t,e=!1){await Tv("CapacitorUpdater",t,e)}var Wa=".capgo_key",Ir=".capgo_key_v2",Np=`${Wa}.pub`,hi=`${Ir}.pub`,R8="https://capgo.app",N8="https://files.capgo.app",$8="https://api.capgo.app",L8="https://console.capgo.app",Qv=12e4,wle=1024*1024*20,ble=1024*1024*1024,vle=1024*1024*99,$p="package.json",Xa=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i,W=t=>t?`
|
|
285
|
-
${q8.default.render(t)}`:"";function Pp(t){return new Promise(e=>{setTimeout(e,t)})}function Xr(t){return(0,ts.isMonorepo)(t)?(0,ts.findMonorepoRoot)(t):(0,ts.isNXMonorepo)(t)?(0,ts.findNXMonorepoRoot)(t):t}function Ele(t=Xr((0,Nn.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,Xe.existsSync)(r)){let i=`Package.json at ${r} does not exist`;throw
|
|
286
|
-
`)}`),s=new Error(a.message)):
|
|
287
|
-
`)}`)}if(s)throw
|
|
285
|
+
${q8.default.render(t)}`:"";function Pp(t){return new Promise(e=>{setTimeout(e,t)})}function Xr(t){return(0,ts.isMonorepo)(t)?(0,ts.findMonorepoRoot)(t):(0,ts.isNXMonorepo)(t)?(0,ts.findNXMonorepoRoot)(t):t}function Ele(t=Xr((0,Nn.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,Xe.existsSync)(r)){let i=`Package.json at ${r} does not exist`;throw y.error(i),new Error(i)}let n=(0,Xe.readFileSync)(r??(0,We.join)(t,$p));return JSON.parse(n)}function rs(t=Xr((0,Nn.cwd)()),e=void 0){return Ele(t,e).version??""}function j8(t){let e=t.replace("^","").replace("~","");if(m_(e))try{let r=Ct(e);return vi(r)}catch{return e}return e}async function no(t,e=(0,Nn.cwd)(),r){if(t!=="@capgo/capacitor-updater")return null;if(r)try{let o=(await nl(e,r)).get(t);if(o)return o}catch{}let n=null,i=(0,We.join)(e,"ios","App","Podfile");if((0,Xe.existsSync)(i))try{let o=(0,Xe.readFileSync)(i,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);o?.[1]&&(n=(0,We.resolve)((0,We.join)(e,"ios","App",o[1])))}catch{}if(!n){let s=(0,We.join)(e,"android","capacitor.settings.gradle");if((0,Xe.existsSync)(s))try{let a=(0,Xe.readFileSync)(s,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);a?.[1]&&(n=(0,We.resolve)((0,We.join)(e,"android",a[1])).replace(/\/android$/,""))}catch{}}if(n){let s=(0,We.join)(n,$p);if((0,Xe.existsSync)(s))try{let o=JSON.parse((0,Xe.readFileSync)(s,"utf-8"));if(o.version)return o.version}catch{}}try{let o=(await nl(e)).get(t);if(o)return o}catch{}return null}async function nl(t=Xr((0,Nn.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,We.join)(t,$p)],r){for(let i of r)if(!(0,Xe.existsSync)(i)){let s=`Package.json at ${i} does not exist`;throw y.error(s),new Error(s)}}let n=new Map;for(let i of r){let s=(0,Xe.readFileSync)(i),o=JSON.parse(s);for(let a in o.dependencies)n.set(a,j8(o.dependencies[a]));for(let a in o.devDependencies)n.set(a,j8(o.devDependencies[a]))}return n}async function de(){try{let t=await s8();if(!t){let e="No capacitor config file found, run `cap init` first";throw y.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${W(t)}`;throw y.error(e),new Error(e)}}async function _le(t,e){let r=await de();return r?.config&&(r.config.plugins??={},r.config.plugins.extConfig??={},r.config.plugins[t]??={},r.config.plugins[t]={...r.config.plugins[t],...e},await Tv(t,r)),r}async function U8(t){return _le("CapacitorUpdater",t)}async function wn(){try{let t=await de(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||R8,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||L8,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||N8,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||$8};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(y.info("Using custom supabase instance from capacitor.config.json"),e.supaKey=t?.config?.plugins?.CapacitorUpdater?.localSupaAnon,e.supaHost=t?.config?.plugins?.CapacitorUpdater?.localSupa),e}catch{return{host:R8,hostWeb:L8,hostFilesApi:N8,hostApi:$8}}}var Cle=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function Lp(){let t=await wn();try{let e=await fetch(`${t.hostApi}/private/config`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return{...await e.json(),...t}}catch{return y.info(`Local config ${W(t)}`),t}}async function H8(){let t=await wn();try{let e=await fetch(`${t.hostFilesApi}/files/config`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch{return{partialUpload:!1,TUSUpload:!1,partialUploadForced:!1,TUSUploadForced:!1,maxUploadLength:ble,maxChunkSize:vle,alertUploadSize:wle}}}async function pe(t,e,r){let n=await Lp();if(e&&r&&(y.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw y.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,Ka.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function Sle(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){y.error("Invalid API key or insufficient permissions.");let s=`Your key should be: ${r.map((o,a)=>r.length===1?`"${o}"`:a===r.length-1?`or "${o}"`:`"${o}", `).join("")} mode.`;throw y.error(s),new Error("Invalid API key or insufficient permissions.")}}async function V8(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function z8(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function Ale(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function Ole(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var fr=(o=>(o[o.none=0]="none",o[o.read=1]="read",o[o.upload=2]="upload",o[o.write=3]="write",o[o.admin=4]="admin",o[o.super_admin=5]="super_admin",o))(fr||{}),Ya=(t,e)=>t>=e;async function G8(t,e,r){let{data:n,error:i}=await t.rpc("get_org_perm_for_apikey",{apikey:e,app_id:r}).single();if(i)throw y.error("Cannot get permissions for organization!"),console.error(i),new Error("Cannot get permissions for organization");if(n.includes("perm")){let a=null;switch(n){case"perm_none":{a=0;break}case"perm_read":{a=1;break}case"perm_upload":{a=2;break}case"perm_write":{a=3;break}case"perm_admin":{a=4;break}case"perm_owner":{a=5;break}default:throw n.includes("invite")?(y.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(y.error(`Invalid output when fetching organization permission. Response: ${n}`),new Error(`Invalid output when fetching organization permission. Response: ${n}`))}return{okay:!0,data:a}}let o=null;switch(n){case"INVALID_APIKEY":{o="INVALID_APIKEY";break}case"NO_APP":{o="NO_APP";break}case"NO_ORG":{o="NO_ORG";break}default:throw y.error(`Invalid error when fetching organization permission. Response: ${n}`),new Error(`Invalid error when fetching organization permission. Response: ${n}`)}return{okay:!1,error:o}}async function K8(t,e,r){let{data:n,error:i}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(i){y.error(`Cannot get cli warnings: ${W(i)}`);return}if(n.length>0){y.warn(`Found ${n.length} cli warnings for your organization.`);let s=null;for(let o of n){if(typeof o!="object"||typeof o.message!="string"||typeof o.fatal!="boolean"){y.error(`Invalid cli warning: ${o}`);continue}let a=o;a.fatal?(y.error(`${a.message.replaceAll("\\n",`
|
|
286
|
+
`)}`),s=new Error(a.message)):y.warn(`${a.message.replaceAll("\\n",`
|
|
287
|
+
`)}`)}if(s)throw y.error("Please fix the warnings and try again."),s;y.info("End of cli warnings.")}}async function W8(t,e,r,n,i=!0){let s=await Lp();if(!await(n?Ole(t,n,r):Ale(t,e)))throw y.error(`You need to upgrade your plan to continue to use capgo.
|
|
288
288
|
Upgrade here: ${s.hostWeb}/dashboard/settings/plans
|
|
289
|
-
`),Pp(100),Promise.resolve().then(()=>(Yv(),Xv)).then(c=>{c.default(`${s.hostWeb}/dashboard/settings/plans`)}),Pp(500),new Error("Plan upgrade required");let[a,u]=await Promise.all([z8(t,e),V8(t,e)]);a>0&&i&&!u&&
|
|
289
|
+
`),Pp(100),Promise.resolve().then(()=>(Yv(),Xv)).then(c=>{c.default(`${s.hostWeb}/dashboard/settings/plans`)}),Pp(500),new Error("Plan upgrade required");let[a,u]=await Promise.all([z8(t,e),V8(t,e)]);a>0&&i&&!u&&y.warn(`WARNING !!
|
|
290
290
|
Trial expires in ${a} days, upgrade here: ${s.hostWeb}/dashboard/settings/plans
|
|
291
|
-
`)}async function X8(t,e,r,n,i=!0){let s=await Lp(),{data:o}=await t.rpc("is_allowed_action_org_action",{orgid:e,actions:["storage"]});if(!o)throw
|
|
291
|
+
`)}async function X8(t,e,r,n,i=!0){let s=await Lp(),{data:o}=await t.rpc("is_allowed_action_org_action",{orgid:e,actions:["storage"]});if(!o)throw y.error(`You need to upgrade your plan to continue to use capgo.
|
|
292
292
|
Upgrade here: ${s.hostWeb}/dashboard/settings/plans
|
|
293
|
-
`),Pp(100),Promise.resolve().then(()=>(Yv(),Xv)).then(c=>{c.default(`${s.hostWeb}/dashboard/settings/plans`)}),Pp(500),new Error("Plan upgrade required for upload");let[a,u]=await Promise.all([z8(t,e),V8(t,e)]);a>0&&i&&!u&&
|
|
293
|
+
`),Pp(100),Promise.resolve().then(()=>(Yv(),Xv)).then(c=>{c.default(`${s.hostWeb}/dashboard/settings/plans`)}),Pp(500),new Error("Plan upgrade required for upload");let[a,u]=await Promise.all([z8(t,e),V8(t,e)]);a>0&&i&&!u&&y.warn(`WARNING !!
|
|
294
294
|
Trial expires in ${a} days, upgrade here: ${s.hostWeb}/dashboard/settings/plans
|
|
295
|
-
`)}function te(t=!1){let e=Nn.env.CAPGO_TOKEN?.trim();if(e)return t||D.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,kp.homedir)(),n,i=`${r}/.capgo`;if((0,Xe.existsSync)(i)&&(t||D.info(`Use global API key ${i}`),n=(0,Xe.readFileSync)(i,"utf8").trim()),i=".capgo",!n&&(0,Xe.existsSync)(i)&&(t||D.info(`Use local API key ${i}`),n=(0,Xe.readFileSync)(i,"utf8").trim()),!n){let s=`Cannot find API key in local folder or global, please login first with ${$n().runner} @capacitor/cli login`;throw D.error(s),new Error(s)}return n}function Ja(t){let e=/\.(jpg|jpeg|png|gif|bmp|webp)$/i,r=t.match(e);if(r)switch(r[1].toLowerCase()){case"jpg":case"jpeg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp"}return null}async function eE(t,e){return t.from("app_versions").upsert(e,{onConflict:"name,app_id"}).eq("app_id",e.app_id).eq("name",e.name)}async function Y8(t,e,r){let n={app_id:e,name:r,version:0};try{let s=await t.functions.invoke("files/upload_link",{body:JSON.stringify(n)});if(s.error){if(s.error instanceof Ka.FunctionsHttpError){let o=await s.error.context.json();D.error(`Upload URL error: ${o.status||JSON.stringify(o)}`)}else D.error(`Cannot get upload url: ${s.error.message}`);return""}return s.data.url}catch(i){D.error(`Cannot get upload url ${W(i)}`)}return""}async function*J8(t){let e=(0,Xe.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,We.join)(t,r.name);r.isDirectory()?yield*J8(n):yield n}}async function Z8(t){let e=[],r=[".DS_Store",".git",".gitignore","node_modules","package-lock.json","tsconfig.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json"];for await(let n of J8(t)){if(r.some(a=>n.includes(a))){D.info(`Ignoring file ${n}, please ensure you have only required files in your dist folder`);continue}let i=(0,Xe.readFileSync)(n);if(i.length===0){D.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let s=await Yn(i,"sha256"),o=(0,We.relative)(t,n);o.startsWith("/")&&(o=o.substring(1)),e.push({file:o,hash:s})}return e}async function jp(t){return(0,kp.platform)()==="win32"?Tle(t):xle(t)}function xle(t){let e=new Zv.default;return e.addLocalFolder(t),e.toBuffer()}async function Tle(t){D.info("Zipping file windows mode");let e=new Zv.default,r=(n,i)=>{let s=(0,Xe.readdirSync)(n);for(let o of s){let a=(0,We.join)(n,o),u=(0,Xe.statSync)(a);if(u.isFile()){let c=(0,Xe.readFileSync)(a);e.addFile((0,We.join)(i,o).split(We.sep).join("/"),c)}else u.isDirectory()&&r(a,(0,We.join)(i,o))}};return r(t,""),e.toBuffer()}async function Q8(t,e,r,n,i,s,o,a){return new Promise((u,c)=>{Ae(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Rp.Upload(e,{endpoint:`${o.hostFilesApi}/files/upload/attachments/`,chunkSize:a,metadataForPartialUploads:{filename:`orgs/${r}/apps/${n}/${i}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${r}/apps/${n}/${i}.zip`,filetype:"application/zip"},headers:{Authorization:t},onError(h){if(D.error(`Error uploading bundle: ${h.message}`),h instanceof Rp.DetailedError){let d=h.originalResponse?.getBody(),f=JSON.parse(d||'{"error": "unknown error"}');c(f.status||f.error||f.message||"unknown error")}else c(h.message||h.toString()||"unknown error")},onProgress(h,d){let f=(h/d*100).toFixed(2);s.message(`Uploaded ${f}%`)},async onSuccess(){await Ae(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function eM(t,e,r){let n={app_id:e,name:r};try{let s=await t.functions.invoke("private/delete_failed_version",{body:JSON.stringify(n),method:"DELETE"});if(s.error){if(s.error instanceof Ka.FunctionsHttpError){let o=await s.error.context.json();D.error(`Cannot delete failed version: ${o.status||JSON.stringify(o)}`)}else D.error(`Cannot delete failed version: ${s.error.message}`);return}return s.data?.status}catch(i){if(i instanceof Ka.FunctionsHttpError){let s=await i.context.json();D.error(`Cannot delete failed version: ${s.message||JSON.stringify(s)}`)}else D.error(`Cannot delete failed version: ${W(i)}`)}}async function Bp(t,e){if(!e.app_id||!e.name||!e.created_by)return D.error("missing app_id, name, or created_by"),Promise.reject(new Error("missing app_id, name, or created_by"));let{data:r,error:n}=await t.from("channels").select().eq("app_id",e.app_id).eq("name",e.name).single();return r&&!n?t.from("channels").update(e).eq("app_id",e.app_id).eq("name",e.name).select().single():t.from("channels").insert(e).select().single()}async function Ae(t,e,r){try{r&&D.info(`Get remove config: for ${e.event}`);let n=await Lp();r&&D.info(`Sending LogSnag event: ${JSON.stringify(e)}`);let i=new AbortController,s=setTimeout(()=>i.abort(),1e4);try{let o=await fetch(`${n.hostApi}/private/events`,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json",capgkey:t},signal:i.signal});if(clearTimeout(s),!o.ok)throw new Error(`HTTP error! status: ${o.status}`);let a=await o.json();a.error&&D.error(`Failed to send LogSnag event: ${a.error}`)}finally{clearTimeout(s)}}catch(n){r&&(D.error("Failed to send Stats event details:"),D.error(W(n)))}}async function Mp(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw D.error("Cannot get the list of organizations - exiting"),D.error(`Error ${JSON.stringify(r)}`),new Error("Cannot get the list of organizations");let i=n.filter(u=>!!e.find(c=>c===u.role));if(n.length===0)throw D.error("Could not get organization please create an organization first"),new Error("No organizations available");if(i.length===0)throw D.error(`Could not find organization with roles: ${e.join(" or ")} please create an organization or ask the admin to add you to the organization with this roles`),new Error("Could not find organization with required roles");let s=i.length>1?await wo({message:"Please pick the organization that you want to insert to",options:i.map(u=>({value:u.gid,label:u.name}))}):i[0].gid;if(xt(s))throw D.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let o=s,a=n.find(u=>u.gid===o);return D.info(`Using the organization "${a.name}" as the app owner`),a}async function De(t,e,r=["all"]){await Sle(t,e,r);let{data:n,error:i}=await t.rpc("get_user_id",{apikey:e}).single(),s=(n||"").toString();if(!s||i)throw D.error("Cannot auth user with apikey"),new Error("Cannot authenticate user with provided API key");return s}async function sn(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();if(!r||n)throw D.error(`Cannot get organization id for app id ${e}`),W(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function Za(t){return new Date(t||"").toLocaleString()}var B8=!1,Ga="npm",rl="install",Jv="npx";function $n(){if(B8)return{pm:Ga,command:rl,installCommand:`${Ga} ${rl}`,runner:Jv};let t=Xr((0,Nn.cwd)());return Ga=fu(t,"npm"),rl=xl(Ga),B8=!0,Jv=t_(t),{pm:Ga,command:rl,installCommand:`${Ga} ${rl}`,runner:Jv}}function tM(t){return(0,Xe.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let i=(0,We.join)(t,n.name);return n.isDirectory()?tM(i):i.split(`node_modules${We.sep}`)[1]||i})}async function tE(t,e){let r=e?e.split(","):[],n;try{n=await nl("",t)}catch(l){throw D.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",l),l instanceof Error?l:new Error("Invalid package.json")}let i=t?.split(",")[0],s=i?We.default.resolve(i).replace($p,""):Xr((0,Nn.cwd)());if(!n)throw D.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[l,h]of Object.entries(n))if(typeof h!="string")throw D.error(`Invalid dependency ${l}: ${h}, expected string, got ${typeof h}`),new Error(`Invalid dependency ${l}: expected string version`);let o=r.length===0?[(0,We.join)((0,Nn.cwd)(),"node_modules")]:r;if(!o.some(l=>(0,Xe.existsSync)(l))){let l=fu(s,"npm"),h=xl(l);throw D.error(`Missing node_modules folder at ${o.join(", ")}, please run ${l} ${h}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([l,h])=>{let d=!1,f=!1;for(let m of o){let g=(0,We.join)(m,l);if((0,Xe.existsSync)(g)){d=!0;try{if(tM(g).some(S=>Cle.test(S))){f=!0;break}}catch(b){throw D.error(`Error reading node_modules files for ${l} package in ${m}`),console.error(b),b instanceof Error?b:new Error(`Error reading node_modules files for ${l}`)}}}if(!d){u=!0;let m=fu(s,"npm"),g=xl(m);return D.error(`Missing dependency ${l}, please run ${m} ${g}`),{name:l,version:h}}return{name:l,version:h,native:f}})).catch(()=>[]);if(u||c.find(l=>l.native===void 0))throw D.error("Missing dependencies or invalid dependencies"),D.error("If you use monorepo, workspace or any special package manager you can use the --package-json [path,] and --node-modules [path,] options to make the command work properly"),new Error("Missing dependencies or invalid dependencies");return c}async function Fle(t,e,r){let{data:n,error:i}=await t.from("channels").select("version(checksum)").eq("name",r).eq("app_id",e).single(),s=n;return i||s===null||!s.version||!s.version.checksum?null:s.version.checksum}function Ile(t){if(!t)throw D.error("Error parsing native packages, perhaps the metadata does not exist in Capgo?"),new Error("Error parsing native packages");for(let r of t){if(typeof r!="object")throw D.error(`Invalid remote native package data: ${r}, expected object, got ${typeof r}`),new Error("Invalid remote native package data");let{name:n,version:i}=r;if(!n||typeof n!="string")throw D.error(`Invalid remote native package name: ${n}, expected string, got ${typeof n}`),new Error("Invalid remote native package name");if(!i||typeof i!="string")throw D.error(`Invalid remote native package version: ${i}, expected string, got ${typeof i}`),new Error("Invalid remote native package version")}return new Map(t.map(r=>[r.name,r]))}async function rM(t,e,r){let{data:n,error:i}=await t.from("channels").select(`version (
|
|
295
|
+
`)}function te(t=!1){let e=Nn.env.CAPGO_TOKEN?.trim();if(e)return t||y.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,kp.homedir)(),n,i=`${r}/.capgo`;if((0,Xe.existsSync)(i)&&(t||y.info(`Use global API key ${i}`),n=(0,Xe.readFileSync)(i,"utf8").trim()),i=".capgo",!n&&(0,Xe.existsSync)(i)&&(t||y.info(`Use local API key ${i}`),n=(0,Xe.readFileSync)(i,"utf8").trim()),!n){let s=`Cannot find API key in local folder or global, please login first with ${$n().runner} @capacitor/cli login`;throw y.error(s),new Error(s)}return n}function Ja(t){let e=/\.(jpg|jpeg|png|gif|bmp|webp)$/i,r=t.match(e);if(r)switch(r[1].toLowerCase()){case"jpg":case"jpeg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp"}return null}async function eE(t,e){return t.from("app_versions").upsert(e,{onConflict:"name,app_id"}).eq("app_id",e.app_id).eq("name",e.name)}async function Y8(t,e,r){let n={app_id:e,name:r,version:0};try{let s=await t.functions.invoke("files/upload_link",{body:JSON.stringify(n)});if(s.error){if(s.error instanceof Ka.FunctionsHttpError){let o=await s.error.context.json();y.error(`Upload URL error: ${o.status||JSON.stringify(o)}`)}else y.error(`Cannot get upload url: ${s.error.message}`);return""}return s.data.url}catch(i){y.error(`Cannot get upload url ${W(i)}`)}return""}async function*J8(t){let e=(0,Xe.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,We.join)(t,r.name);r.isDirectory()?yield*J8(n):yield n}}async function Z8(t){let e=[],r=[".DS_Store",".git",".gitignore","node_modules","package-lock.json","tsconfig.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json"];for await(let n of J8(t)){if(r.some(a=>n.includes(a))){y.info(`Ignoring file ${n}, please ensure you have only required files in your dist folder`);continue}let i=(0,Xe.readFileSync)(n);if(i.length===0){y.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let s=await Yn(i,"sha256"),o=(0,We.relative)(t,n);o.startsWith("/")&&(o=o.substring(1)),e.push({file:o,hash:s})}return e}async function jp(t){return(0,kp.platform)()==="win32"?Tle(t):xle(t)}function xle(t){let e=new Zv.default;return e.addLocalFolder(t),e.toBuffer()}async function Tle(t){y.info("Zipping file windows mode");let e=new Zv.default,r=(n,i)=>{let s=(0,Xe.readdirSync)(n);for(let o of s){let a=(0,We.join)(n,o),u=(0,Xe.statSync)(a);if(u.isFile()){let c=(0,Xe.readFileSync)(a);e.addFile((0,We.join)(i,o).split(We.sep).join("/"),c)}else u.isDirectory()&&r(a,(0,We.join)(i,o))}};return r(t,""),e.toBuffer()}async function Q8(t,e,r,n,i,s,o,a){return new Promise((u,c)=>{Ae(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Rp.Upload(e,{endpoint:`${o.hostFilesApi}/files/upload/attachments/`,chunkSize:a,metadataForPartialUploads:{filename:`orgs/${r}/apps/${n}/${i}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${r}/apps/${n}/${i}.zip`,filetype:"application/zip"},headers:{Authorization:t},onError(h){if(y.error(`Error uploading bundle: ${h.message}`),h instanceof Rp.DetailedError){let d=h.originalResponse?.getBody(),f=JSON.parse(d||'{"error": "unknown error"}');c(f.status||f.error||f.message||"unknown error")}else c(h.message||h.toString()||"unknown error")},onProgress(h,d){let f=(h/d*100).toFixed(2);s.message(`Uploaded ${f}%`)},async onSuccess(){await Ae(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function eM(t,e,r){let n={app_id:e,name:r};try{let s=await t.functions.invoke("private/delete_failed_version",{body:JSON.stringify(n),method:"DELETE"});if(s.error){if(s.error instanceof Ka.FunctionsHttpError){let o=await s.error.context.json();y.error(`Cannot delete failed version: ${o.status||JSON.stringify(o)}`)}else y.error(`Cannot delete failed version: ${s.error.message}`);return}return s.data?.status}catch(i){if(i instanceof Ka.FunctionsHttpError){let s=await i.context.json();y.error(`Cannot delete failed version: ${s.message||JSON.stringify(s)}`)}else y.error(`Cannot delete failed version: ${W(i)}`)}}async function Bp(t,e){if(!e.app_id||!e.name||!e.created_by)return y.error("missing app_id, name, or created_by"),Promise.reject(new Error("missing app_id, name, or created_by"));let{data:r,error:n}=await t.from("channels").select().eq("app_id",e.app_id).eq("name",e.name).single();return r&&!n?t.from("channels").update(e).eq("app_id",e.app_id).eq("name",e.name).select().single():t.from("channels").insert(e).select().single()}async function Ae(t,e,r){try{r&&y.info(`Get remove config: for ${e.event}`);let n=await Lp();r&&y.info(`Sending LogSnag event: ${JSON.stringify(e)}`);let i=new AbortController,s=setTimeout(()=>i.abort(),1e4);try{let o=await fetch(`${n.hostApi}/private/events`,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json",capgkey:t},signal:i.signal});if(clearTimeout(s),!o.ok)throw new Error(`HTTP error! status: ${o.status}`);let a=await o.json();a.error&&y.error(`Failed to send LogSnag event: ${a.error}`)}finally{clearTimeout(s)}}catch(n){r&&(y.error("Failed to send Stats event details:"),y.error(W(n)))}}async function Mp(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw y.error("Cannot get the list of organizations - exiting"),y.error(`Error ${JSON.stringify(r)}`),new Error("Cannot get the list of organizations");let i=n.filter(u=>!!e.find(c=>c===u.role));if(n.length===0)throw y.error("Could not get organization please create an organization first"),new Error("No organizations available");if(i.length===0)throw y.error(`Could not find organization with roles: ${e.join(" or ")} please create an organization or ask the admin to add you to the organization with this roles`),new Error("Could not find organization with required roles");let s=i.length>1?await wo({message:"Please pick the organization that you want to insert to",options:i.map(u=>({value:u.gid,label:u.name}))}):i[0].gid;if(xt(s))throw y.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let o=s,a=n.find(u=>u.gid===o);return y.info(`Using the organization "${a.name}" as the app owner`),a}async function De(t,e,r=["all"]){await Sle(t,e,r);let{data:n,error:i}=await t.rpc("get_user_id",{apikey:e}).single(),s=(n||"").toString();if(!s||i)throw y.error("Cannot auth user with apikey"),new Error("Cannot authenticate user with provided API key");return s}async function sn(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();if(!r||n)throw y.error(`Cannot get organization id for app id ${e}`),W(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function Za(t){return new Date(t||"").toLocaleString()}var B8=!1,Ga="npm",rl="install",Jv="npx";function $n(){if(B8)return{pm:Ga,command:rl,installCommand:`${Ga} ${rl}`,runner:Jv};let t=Xr((0,Nn.cwd)());return Ga=fu(t,"npm"),rl=xl(Ga),B8=!0,Jv=t_(t),{pm:Ga,command:rl,installCommand:`${Ga} ${rl}`,runner:Jv}}function tM(t){return(0,Xe.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let i=(0,We.join)(t,n.name);return n.isDirectory()?tM(i):i.split(`node_modules${We.sep}`)[1]||i})}async function tE(t,e){let r=e?e.split(","):[],n;try{n=await nl("",t)}catch(l){throw y.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",l),l instanceof Error?l:new Error("Invalid package.json")}let i=t?.split(",")[0],s=i?We.default.resolve(i).replace($p,""):Xr((0,Nn.cwd)());if(!n)throw y.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[l,h]of Object.entries(n))if(typeof h!="string")throw y.error(`Invalid dependency ${l}: ${h}, expected string, got ${typeof h}`),new Error(`Invalid dependency ${l}: expected string version`);let o=r.length===0?[(0,We.join)((0,Nn.cwd)(),"node_modules")]:r;if(!o.some(l=>(0,Xe.existsSync)(l))){let l=fu(s,"npm"),h=xl(l);throw y.error(`Missing node_modules folder at ${o.join(", ")}, please run ${l} ${h}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([l,h])=>{let d=!1,f=!1;for(let m of o){let g=(0,We.join)(m,l);if((0,Xe.existsSync)(g)){d=!0;try{if(tM(g).some(S=>Cle.test(S))){f=!0;break}}catch(b){throw y.error(`Error reading node_modules files for ${l} package in ${m}`),console.error(b),b instanceof Error?b:new Error(`Error reading node_modules files for ${l}`)}}}if(!d){u=!0;let m=fu(s,"npm"),g=xl(m);return y.error(`Missing dependency ${l}, please run ${m} ${g}`),{name:l,version:h}}return{name:l,version:h,native:f}})).catch(()=>[]);if(u||c.find(l=>l.native===void 0))throw y.error("Missing dependencies or invalid dependencies"),y.error("If you use monorepo, workspace or any special package manager you can use the --package-json [path,] and --node-modules [path,] options to make the command work properly"),new Error("Missing dependencies or invalid dependencies");return c}async function Fle(t,e,r){let{data:n,error:i}=await t.from("channels").select("version(checksum)").eq("name",r).eq("app_id",e).single(),s=n;return i||s===null||!s.version||!s.version.checksum?null:s.version.checksum}function Ile(t){if(!t)throw y.error("Error parsing native packages, perhaps the metadata does not exist in Capgo?"),new Error("Error parsing native packages");for(let r of t){if(typeof r!="object")throw y.error(`Invalid remote native package data: ${r}, expected object, got ${typeof r}`),new Error("Invalid remote native package data");let{name:n,version:i}=r;if(!n||typeof n!="string")throw y.error(`Invalid remote native package name: ${n}, expected string, got ${typeof n}`),new Error("Invalid remote native package name");if(!i||typeof i!="string")throw y.error(`Invalid remote native package version: ${i}, expected string, got ${typeof i}`),new Error("Invalid remote native package version")}return new Map(t.map(r=>[r.name,r]))}async function rM(t,e,r){let{data:n,error:i}=await t.from("channels").select(`version (
|
|
296
296
|
native_packages
|
|
297
|
-
)`).eq("name",r).eq("app_id",e).single();if(i)throw
|
|
297
|
+
)`).eq("name",r).eq("app_id",e).single();if(i)throw y.error(`Error fetching native packages: ${i.message}`),new Error(`Error fetching native packages: ${i.message}`);return Ile(n.version.native_packages??[])}async function nM(t,e,r,n){let i=Ft();i.start(`Checking bundle checksum compatibility with channel ${r}`);let s=await Fle(t,e,r);if(!s){i.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}if(s&&s===n)throw y.error(`Cannot upload the same bundle content.
|
|
298
298
|
Current bundle checksum matches remote bundle for channel ${r}
|
|
299
299
|
Did you build your app before uploading?
|
|
300
|
-
PS: You can ignore this check with "--ignore-checksum-check"`),new Error("Cannot upload the same bundle content");i.stop(`Checksum compatible with ${r} channel`)}function ke(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function io(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=kl(t.localVersion),r=kl(t.remoteVersion);return p_(e,r)}catch{return!1}}async function qp(t,e,r,n,i){let s=await tE(n,i),o=await rM(t,e,r),a=s.filter(c=>!!c.native).map(c=>{let l=o.get(c.name);return l?{name:c.name,localVersion:c.version,remoteVersion:l.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...o].filter(([c])=>s.find(l=>l.name===c)===void 0).map(([c,l])=>({name:c,localVersion:void 0,remoteVersion:l.version}));return a.push(...u),{finalCompatibility:a,localDependencies:s}}async function rE(t,e,r,n){let i=await rM(t,e,r),s=n.map(a=>{let u=i.get(a.name);return u?{name:a.name,localVersion:a.version,remoteVersion:u.version}:{name:a.name,localVersion:a.version,remoteVersion:void 0}}),o=[...i].filter(([a])=>n.find(u=>u.name===a)===void 0).map(([a,u])=>({name:a,localVersion:void 0,remoteVersion:u.version}));return s.push(...o),{finalCompatibility:s,localDependencies:n}}async function iM(t,e,r){let n=await $r({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(xt(n))throw t&&e&&r&&await RT("onboarding-v2",e,r,"canceled","\u{1F937}"),
|
|
300
|
+
PS: You can ignore this check with "--ignore-checksum-check"`),new Error("Cannot upload the same bundle content");i.stop(`Checksum compatible with ${r} channel`)}function ke(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function io(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=kl(t.localVersion),r=kl(t.remoteVersion);return p_(e,r)}catch{return!1}}async function qp(t,e,r,n,i){let s=await tE(n,i),o=await rM(t,e,r),a=s.filter(c=>!!c.native).map(c=>{let l=o.get(c.name);return l?{name:c.name,localVersion:c.version,remoteVersion:l.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...o].filter(([c])=>s.find(l=>l.name===c)===void 0).map(([c,l])=>({name:c,localVersion:void 0,remoteVersion:l.version}));return a.push(...u),{finalCompatibility:a,localDependencies:s}}async function rE(t,e,r,n){let i=await rM(t,e,r),s=n.map(a=>{let u=i.get(a.name);return u?{name:a.name,localVersion:a.version,remoteVersion:u.version}:{name:a.name,localVersion:a.version,remoteVersion:void 0}}),o=[...i].filter(([a])=>n.find(u=>u.name===a)===void 0).map(([a,u])=>({name:a,localVersion:void 0,remoteVersion:u.version}));return s.push(...o),{finalCompatibility:s,localDependencies:n}}async function iM(t,e,r){let n=await $r({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(xt(n))throw t&&e&&r&&await RT("onboarding-v2",e,r,"canceled","\u{1F937}"),y.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let i=$n(),s=Ft();s.start("Running the command...");try{await new Promise((o,a)=>{let u=(0,M8.spawn)(i.runner,["cap","sync"],{stdio:"pipe"});u.on("close",c=>{c===0?o():a(new Error(`Command failed with exit code ${c}`))}),u.on("error",c=>{a(c)})}),s.stop("Capacitor sync completed \u2705")}catch(o){s.stop("Error"),y.error(`Failed to run Capacitor sync: ${o}`),y.warn(`Please run "${i.runner} cap sync" manually to ensure encrypted updates work properly`)}}else{let i=$n();y.warn("\u26A0\uFE0F Important: If you upload encrypted bundles without syncing, updates will fail!"),y.info(`Remember to run "${i.runner} cap sync" before uploading encrypted bundles`)}}async function sM(t,e,r,n={}){let{silent:i=!1,autoUnlink:s=!1}=n,{data:o,error:a}=await t.from("channels").select().eq("app_id",e).eq("version",r.id);if(a)throw i||y.error(`Cannot check Version ${e}@${r.name}: ${W(a)}`),new Error(`Cannot check version ${e}@${r.name}: ${W(a)}`);if(!o?.length)return;if(i)throw new Error(`Version ${e}@${r.name} is used in ${o.length} channel(s)`);oe(`\u274C Version ${e}@${r.name} is used in ${o.length} channel${o.length>1?"s":""}`);let u=s;if(s||(u=await $r({message:"unlink it?"})===!0),!u)throw y.error("Unlink it first"),new Error(`Version ${e}@${r.name} is still linked to channel(s)`);for(let c of o){let l=Ft();l.start(`Unlinking channel ${c.name}`);let h=await nE(t,e,{silent:i});if(!h)throw l.stop(`Cannot find unknown version for ${e}`),new Error(`Cannot find unknown version for ${e}`);let{error:d}=await t.from("channels").update({version:h.id}).eq("id",c.id);if(d)throw l.stop(`Cannot update channel ${c.name} ${W(d)}`),new Error(`Cannot update channel ${c.name}: ${W(d)}`);l.stop(`\u2705 Channel ${c.name} unlinked`)}ce(`Version unlinked from ${o.length} channel${o.length>1?"s":""}`)}async function nE(t,e,r={}){let{silent:n=!1}=r,i=[3e3,7e3],s;for(let o=0;o<=2;o++){let{data:a,error:u}=await t.from("app_versions").select("id").eq("app_id",e).eq("name","unknown").single();if(!u)return a;s=u,o<2&&await new Promise(c=>setTimeout(c,i[o]))}throw n||y.error(`Cannot call findUnknownVersion as it returned an error.
|
|
301
301
|
${W(s)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${W(s)}`)}function oM(t,e){return t.from("channels").insert(e).select().single()}function aM(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function uM(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function cM(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function lM(t,e,r){return t.from("channels").select(`
|
|
302
302
|
id,
|
|
303
303
|
version (id, name)
|
|
304
|
-
`).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function fM(t,e=!1){if(e)return;let r=new Ht;r.theme=Ht.roundTheme,r.headers=["Name","Version","Public","iOS","Android","Auto Update","Native Auto Update","Device Self Set","Progressive Deploy","Secondary Version","Secondary Version Percentage","AB Testing","AB Testing Version","AB Testing Percentage","Emulator","Dev"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,n.version?.name,n.public?"\u2705":"\u274C",n.ios?"\u2705":"\u274C",n.android?"\u2705":"\u274C",n.disable_auto_update,n.disable_auto_update_under_native?"\u274C":"\u2705",n.allow_device_self_set?"\u2705":"\u274C",n.allow_emulator?"\u2705":"\u274C",n.allow_dev?"\u2705":"\u274C"]);
|
|
304
|
+
`).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function fM(t,e=!1){if(e)return;let r=new Ht;r.theme=Ht.roundTheme,r.headers=["Name","Version","Public","iOS","Android","Auto Update","Native Auto Update","Device Self Set","Progressive Deploy","Secondary Version","Secondary Version Percentage","AB Testing","AB Testing Version","AB Testing Percentage","Emulator","Dev"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,n.version?.name,n.public?"\u2705":"\u274C",n.ios?"\u2705":"\u274C",n.android?"\u2705":"\u274C",n.disable_auto_update,n.disable_auto_update_under_native?"\u274C":"\u2705",n.allow_device_self_set?"\u2705":"\u274C",n.allow_emulator?"\u2705":"\u274C",n.allow_dev?"\u2705":"\u274C"]);y.success("Channels"),y.success(r.toString())}async function hM(t,e,r=!1){let{data:n,error:i}=await t.from("channels").select(`
|
|
305
305
|
id,
|
|
306
306
|
name,
|
|
307
307
|
public,
|
|
@@ -316,35 +316,35 @@ ${W(s)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${W(s)}`)}fun
|
|
|
316
316
|
created_by,
|
|
317
317
|
app_id,
|
|
318
318
|
version (id, name)
|
|
319
|
-
`).eq("app_id",e).order("created_at",{ascending:!1});if(i)throw r||D.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${W(i)}`);return n}async function iE(t,e,r,n={}){let{silent:i=!1}=n,{error:s}=await t.from("app_versions").update({deleted:!0}).eq("app_id",e).eq("deleted",!1).eq("name",r);if(s){let o=`App version ${e}@${r} not found in database`;throw i||D.error(o),new Error(`${o}: ${W(s)}`)}}async function Up(t,e,r,n={}){let{silent:i=!1,autoUnlink:s=!1}=n,o=await Ple(t,e,r,{silent:i});await sM(t,e,o,{silent:i,autoUnlink:s}),await iE(t,e,r,{silent:i})}function dM(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new Ht;r.theme=Ht.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,Za(n.created_at),n.keep??""]);D.success("Bundles"),D.success(r.toString())}async function Hp(t,e,r={}){let{silent:n=!1}=r,{data:i,error:s}=await t.from("app_versions").select().eq("app_id",e).eq("deleted",!1).order("created_at",{ascending:!1});if(s){let o=`App ${e} not found in database`;throw n||D.error(o),new Error(`${o}: ${W(s)}`)}return i??[]}async function pM(t,e,r={}){let{silent:n=!1}=r,{data:i,error:s}=await t.from("channels").select("version").eq("app_id",e);if(s){let o=`App ${e} not found in database`;throw n||D.error(o),new Error(`${o}: ${W(s)}`)}return(i??[]).map(o=>o.version)}async function Ple(t,e,r,n={}){let{silent:i=!1}=n,{data:s,error:o}=await t.from("app_versions").select().eq("app_id",e).eq("name",r).eq("deleted",!1).single();if(!s||o){let a=`App version ${e}@${r} doesn't exist`;throw i||D.error(a),new Error(`${a}${o?`: ${W(o)}`:""}`)}return s}var Qa=require("node:fs");async function mM(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function yt(t,e,r,n,i=!1){let s=$n(),o=await G8(t,e,r);if(!o.okay)switch(o.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw i||D.error(c),new Error(c)}case"NO_APP":{let c=`App ${r} does not exist, run first \`${s.runner} @capgo/cli app add ${r}\` to create it`;throw i||D.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw i||D.error(c),new Error(c)}}let a=o.data;if(n>a){let c=`Insuficcent permissions for app ${r}. Current permission: ${fr[o.data]}, required for this action: ${fr[n]}.`;throw i||D.error(c),new Error(c)}return o.data}var Yr="assets/icon.png";var kle=/^[a-z0-9]+(\.[\w-]+)+$/i;function Rle(t,e,r){if(!e.apikey)throw r||D.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||D.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||D.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!kle.test(t))throw r||(D.error(`Invalid app ID format: "${t}"`),D.info("App ID must be in reverse domain notation (e.g., com.example.app)"),D.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),D.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function Nle(t,e,r){if(await mM(t,e))throw e==="io.ionic.starter"?(r||D.error(`This appId ${e} cannot be used it's reserved, please change it in your capacitor config.`),new Error("Reserved appId, please change it in capacitor config")):(r||D.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function gM(t,e,r,n=!1){n||oe("Adding"),await ze(),e.apikey=e.apikey||te();let i=await de(),s=ke(t,i?.config);Rle(s,e,n);let o=await pe(e.apikey,e.supaHost,e.supaAnon),a=await De(o,e.apikey,["write","all"]);await Nle(o,s,n),r||(r=await Mp(o,["admin","super_admin"]));let u=r.gid,{name:c,icon:l}=e;if(c=c||i.config?.appName||"Unknown",l=l||"resources/icon.png",!l||!c)throw n||D.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project"),new Error("Missing app name or icon path");n||D.info(`Adding ${s} to Capgo`);let h=null,d=null;l&&(0,Qa.existsSync)(l)?(h=(0,Qa.readFileSync)(l),d=Ja(l)||"image/png",n||D.warn(`Found app icon ${l}`)):(0,Qa.existsSync)(Yr)?(h=(0,Qa.readFileSync)(Yr),d=Ja(Yr)||"image/png",n||D.warn(`Found app icon ${Yr}`)):n||D.warn(`Cannot find app icon in any of the following locations: ${l}, ${Yr}`);let f="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(h&&d){let{error:b}=await o.storage.from(`images/org/${u}/${s}`).upload(f,h,{contentType:d});if(b)throw n||console.error(b),n||D.error(`Could not add app ${W(b)}`),new Error(`Could not add app ${W(b)}`);let{data:S}=await o.storage.from(`images/org/${u}/${s}`).getPublicUrl(f);m=S?.publicUrl||m}let{error:g}=await o.from("apps").insert({icon_url:m,owner_org:u,user_id:a,name:c,app_id:s});if(g)throw n||D.error(`Could not add app ${W(g)}`),new Error(`Could not add app ${W(g)}`);return n||(D.success(`App ${s} added to Capgo. You can upload a bundle now`),ce("Done \u2705")),{appId:s,organizationUid:u,userId:a,name:c,signedURL:m}}async function yM(t,e,r=!1,n=!1){r||oe("Deleting"),e.apikey=e.apikey||te();let i=await de(),s=ke(t,i?.config);if(!e.apikey)throw r||D.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||D.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await pe(e.apikey,e.supaHost,e.supaAnon),a=await De(o,e.apikey,["write","all"]);await yt(o,e.apikey,s,5,r);let{data:u,error:c}=await o.from("apps").select("owner_org ( created_by, id )").eq("app_id",s).single(),l=u;if(!n&&!c&&(l?.owner_org.created_by??"")!==a){if(r)throw new Error("Cannot delete app: you are not the organization owner");{D.warn("Deleting the app is not recommended for users that are not the organization owner"),D.warn("You are invited as a super_admin but your are not the owner"),D.warn("It's strongly recommended that you do not continue!");let g=await wo({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(xt(g)||g==="no")throw D.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&D.warn(`Cannot get the app owner ${W(c)}`);let{error:h}=await o.storage.from("images").remove([`org/${l?.owner_org.id}/${s}/icon`]);h&&!r&&D.error("Could not delete app logo");let{error:d}=await o.storage.from(`apps/${s}/${a}`).remove(["versions"]);d&&!r&&D.error("Could not delete app version");let{error:f}=await o.from("apps").delete().eq("app_id",s);if(f)throw r||D.error("Could not delete app"),new Error(`Could not delete app: ${W(f)}`);let m=await sn(o,s);return await Ae(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":s},notify:!1}).catch(()=>{}),r||(D.success("App deleted in Capgo"),ce("Done \u2705")),!0}var Vp=require("node:os"),wM=require("node:process");async function DM(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(i=>$h(i)))).forEach((i,s)=>{i&&(e[r[s]]=i)}),e}async function $le(){let t=await nl(),e={"@capgo/cli":Pi.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function bM(t,e=!1){e||D.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await de(),n=rs("",t.packageJson),i=r?.config?.plugins?.CapacitorUpdater?.version||n,s=r?.config?.appName||"",o=ke("",r?.config),a=r?.config?.webDir||"";e||(D.info(` App Name: ${s}`),D.info(` App ID: ${o}`),D.info(` App Version: ${i}`),D.info(` Web Dir: ${a}`),D.info(` OS: ${(0,Vp.platform)()} ${(0,Vp.version)()}`),D.info(` Node: ${wM.version}`),D.info(" Installed Dependencies:"));let u=await $le();if(Object.keys(u).length===0)throw e||D.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),new Error("No dependencies found");if(!e)for(let l of Object.keys(u))D.info(` ${l}: ${u[l]}`);let c={};if(e)c=await DM(u);else{let l=Ft();l.start("Running: Loading latest dependencies"),c=await DM(u),l.stop("Latest Dependencies:");for(let h of Object.keys(c))D.info(` ${h}: ${c[h]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||D.warn("\x1B[31m\u{1F6A8} Some dependencies are not up to date\x1B[0m"),new Error("Some dependencies are not up to date");return e||D.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),{appName:s,appId:o,appVersion:i,webDir:a,installedDependencies:u,latestDependencies:c}}function Lle(t){let e=new Ht;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,Za(r.created_at)]);D.success("Apps"),D.success(e.toString())}async function jle(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||D.error("Apps not found"),new Error("Apps not found");return r??[]}async function vM(t,e=!1){e||oe("List apps in Capgo"),await ze(),t.apikey=t.apikey||te();let r=await pe(t.apikey,t.supaHost,t.supaAnon);await De(r,t.apikey,["write","all","read","upload"]),e||D.info("Getting active bundle in Capgo");let n=await jle(r,e);if(!n.length)throw e||D.error("No apps found"),new Error("No apps found");return e||(D.info(`Active app in Capgo: ${n.length}`),Lle(n),ce("Done \u2705")),n}var EM=require("node:crypto"),eu=require("node:fs");async function _M(t,e,r=!1){r||oe("Set app"),e.apikey=e.apikey||te();let n=await de();if(t=ke(t,n?.config),!e.apikey)throw r||D.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||D.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await pe(e.apikey,e.supaHost,e.supaAnon),o=(await Mp(i,["admin","super_admin"])).gid,a=await De(i,e.apikey,["write","all"]);await yt(i,e.apikey,t,4,r);let{name:u,icon:c,retention:l}=e;if(l&&Number.isNaN(Number(l)))throw r||D.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||D.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||D.error("retention value cannot be greater than 63113904 seconds (2 years)"),new Error("Retention value cannot be greater than 63113904 seconds (2 years)");let h,d,f=`icon_${(0,EM.randomUUID)()}`,m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,eu.existsSync)(c)?(h=(0,eu.readFileSync)(c),d=Ja(c)||"image/png",r||D.warn(`Found app icon ${c}`)):(0,eu.existsSync)(Yr)?(h=(0,eu.readFileSync)(Yr),d=Ja(Yr)||"image/png",r||D.warn(`Found app icon ${Yr}`)):r||D.warn(`Cannot find app icon in any of the following locations: ${c}, ${Yr}`),h&&d){let{error:b}=await i.storage.from(`images/org/${o}/${t}`).upload(f,h,{contentType:d});if(b)throw r||D.error(`Could not set app ${W(b)}`),new Error(`Could not set app: ${W(b)}`);let{data:S}=await i.storage.from(`images/org/${o}/${t}`).getPublicUrl(f);m=S?.publicUrl||m}let{error:g}=await i.from("apps").update({icon_url:m,name:u,retention:l?l*24*60*60:void 0}).eq("app_id",t).eq("user_id",a);if(g)throw r||D.error(`Could not set app ${W(g)}`),new Error(`Could not set app: ${W(g)}`);return r||ce("Done \u2705"),!0}async function CM(t,e,r=!1){if(r||oe("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||D.error("Bool and string CANNOT be set at the same time"),new Error("Bool and string cannot both be provided");if(!e.bool&&!e.string)throw r||D.error("You MUST provide either bool or string as the value"),new Error("Either bool or string value is required");if(e.bool&&e.bool!=="true"&&e.bool!=="false")throw r||D.error("Invalid bool"),new Error("Invalid bool value; expected true or false");try{let n=await de(),i=n.config,s=t.split(".");if(s.length===0)throw r||D.error("Invalid path"),new Error("Invalid config path");for(let a of s.slice(0,-1))Object.prototype.hasOwnProperty.call(i,a)||(i[a]={}),i=i[a];let o=e.bool?e.bool==="true":e.string;i[s.at(-1)]=o,await Ha(n,!0),r||D.success(`Set "${t}" to "${o}"`)}catch(n){throw r||D.error(`Cannot set config in capacitor settings ${W(n)}`),new Error(`Cannot set capacitor config: ${W(n)}`)}r||ce("Done \u2705")}var OM=require("node:child_process"),ns=require("node:fs/promises"),xM=require("node:os"),so=require("node:path"),TM=Oe(require("node:process"));var zp=require("node:fs/promises"),SM=require("node:os"),sE=require("node:path"),Ble=(0,sE.join)((0,SM.homedir)(),".capgo"),Mle=(0,sE.join)(Ble,"credentials.json");async function qle(){try{let t=await(0,zp.readFile)(Mle,"utf-8");return JSON.parse(t)}catch{return null}}async function AM(t,e){let r=await qle();return!r||!r[t]?e:{...r[t],...e}}async function Ule(t,e,r,n,i){if(!i)try{let s=await fetch(`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`,{headers:{authorization:n}});if(!s.ok){D.warn("Could not stream logs, continuing...");return}let o=s.body?.getReader();if(!o)return;let a=new TextDecoder;for(;;){let{done:u,value:c}=await o.read();if(u)break;let h=a.decode(c,{stream:!0}).split(`
|
|
320
|
-
`);for(let d of h)if(d.startsWith("data: ")){let f=d.slice(6);f.trim()&&
|
|
321
|
-
\u{1F512} Security: Credentials are never stored on Capgo servers`),
|
|
322
|
-
`));let o=await AM(e.lane,e.credentials),a={app_id:t,platform:e.lane};o
|
|
323
|
-
`)),await Ule(u,l.job_id,t,e.apikey,r);let p=await Hle(u,l.job_id,t,e.lane,e.apikey,r);return r||(p==="succeeded"?D.success("Build completed successfully!"):p==="failed"?D.error("Build failed"):D.warn(`Build finished with status: ${p}`)),{success:p==="succeeded",jobId:l.job_id,uploadUrl:l.upload_url,status:p||A.status||l.status}}finally{await(0,ns.rm)(h,{recursive:!0,force:!0})}}catch(n){let i=n instanceof Error?n.message:String(n);return r||D.error(i),{success:!1,error:i}}}async function zle(t,e,r,n){for await(let i of t)n||D.warn(`Removing ${i.name} created on ${Za(i.created_at)}`),await Up(e,r,i.name)}function Gle(t,e,r){let n=[];for(let i of t??[]){let s=Ct(i.name);km(s,e)&&Rm(s,r)&&n.push(i)}return n}async function IM(t,e,r=!1){r||oe("Cleanup versions in Capgo"),await ze(),e.apikey=e.apikey||te();let{bundle:n,keep:i=4}=e,s=e.force||!1,o=e.ignoreChannel||!1,a=await de();if(t=ke(t,a?.config),!e.apikey)throw r||D.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||D.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let u=await pe(e.apikey,e.supaHost,e.supaAnon);await De(u,e.apikey,["write","all"]),await yt(u,e.apikey,t,3,r),r||D.info("Querying all available versions in Capgo");let c=await Hp(u,t),l=await pM(u,t);if(r||D.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||D.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let f=Ct(n),m=h_(f,"major");r||D.info(`Querying available versions in Capgo between ${vi(f)} and ${vi(m)}`),c=Gle(c,f,m),r||D.info(`Active versions in Capgo between ${vi(f)} and ${vi(m)}: ${c?.length??0}`)}let h=[],d=0;for(let f of c){let m=l.find(g=>g===f.id);d<i||m&&!o?(f.keep=m?"\u2705 (Linked to channel)":"\u2705",d+=1):(f.keep="\u274C",h.push(f))}if(!h.length)return r||D.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:d};if(r||dM(c),!s){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let f=await $r({message:"Do you want to continue removing the versions specified?"});if(xt(f)||!f)throw D.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||D.success("You have confirmed removal, removing versions now"),await zle(h,u,t,r),r||ce("Done \u2705"),{removed:h.length,kept:d}}async function PM(t,e,r=!1){r||oe("Check compatibility");let n={...e,apikey:e.apikey||te()},i=await de(),s=ke(t,i?.config),o=n.channel;if(!o)throw r||D.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||D.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||D.error("Missing argument, you need to provide an appId, or be in a capacitor project"),new Error("Missing appId");let a=await pe(n.apikey,n.supaHost,n.supaAnon);await De(a,n.apikey,["write","all","read","upload"]),await yt(a,n.apikey,s,1,r);let u=await qp(a,s,o,n.packageJson,n.nodeModules);if(!r){let c=new Ht;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=Ht.roundTheme,c.rows=[];let l=n.text?"Yes":"\u2705",h=n.text?"No":"\u274C";for(let d of u.finalCompatibility){let{name:f,localVersion:m,remoteVersion:g}=d,b=io(d)?l:h;c.rows.push([f,m,g,b])}D.success("Compatibility"),D.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}var pi=require("node:fs");var is=require("node:buffer"),qt=require("node:crypto"),kM="aes-128-cbc",di="base64",Gp=qt.constants.RSA_PKCS1_PADDING;function Kp(t){let e=(0,qt.randomBytes)(16),r=(0,qt.randomBytes)(16),n=e.toString(di),i=(0,qt.privateEncrypt)({key:t,padding:Gp},r).toString(di);return{sessionKey:r,ivSessionKey:`${n}:${i}`}}function tu(t,e,r){let[n]=r.split(":"),i=is.Buffer.from(n,di),s=(0,qt.createCipheriv)(kM,e,i);return s.setAutoPadding(!0),is.Buffer.concat([s.update(t),s.final()])}function RM(t,e,r){let[n,i]=e.split(":"),s=(0,qt.publicDecrypt)({key:r,padding:Gp},is.Buffer.from(i,di)),o=is.Buffer.from(n,di),a=(0,qt.createDecipheriv)(kM,s,o);return a.setAutoPadding(!0),is.Buffer.concat([a.update(t),a.final()])}function ru(t,e){return(0,qt.privateEncrypt)({key:e,padding:Gp},is.Buffer.from(t,di)).toString(di)}function NM(t="pem",e=2048){let{publicKey:r,privateKey:n}=(0,qt.generateKeyPairSync)("rsa",{modulusLength:e});return t==="pem"?{publicKey:r.export({type:"pkcs1",format:"pem"}),privateKey:n.export({type:"pkcs1",format:"pem"})}:{publicKey:r.export({type:"spki",format:"der"}).toString("base64"),privateKey:n.export({type:"pkcs1",format:"pem"}).toString("base64")}}function $M(t,e){return(0,qt.publicDecrypt)({key:e,padding:Gp},is.Buffer.from(t,di)).toString(di)}function Kle(t,e){let r=t.key||hi,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,pi.existsSync)(r)?n=(0,pi.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function LM(t,e,r,n=!1){n||oe("Decrypt zip file");try{if(await ze(),!(0,pi.existsSync)(t)){let h=`Zip not found at the path ${t}`;throw n||D.error(h),new Error(h)}let i=await de();if(!r.key&&!(0,pi.existsSync)(hi)&&!i.config.plugins?.CapacitorUpdater?.privateKey){let h=`Private Key not found at the path ${hi} or in ${i.path}`;throw n||D.error(h),new Error(h)}let{publicKey:s,fallbackKeyPath:o}=Kle(r,i);if(!s){let h=`Cannot find public key ${o} or as keyData option or in ${i.path}`;throw n||D.error(h),new Error(h)}let a=(0,pi.readFileSync)(t),u=RM(a,e,r.keyData??s),c=`${t}_decrypted.zip`;(0,pi.writeFileSync)(c,u),n||D.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let h=await Yn(u,"sha256"),d=$M(r.checksum,r.keyData??s);if(l=h===d,!l){let f=`Checksum does not match ${h} !== ${d}`;throw n||D.error(f),new Error(f)}n||D.info("Checksum matches")}return n||ce("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(i){throw n||D.error(`Error decrypting zip file ${W(i)}`),i instanceof Error?i:new Error(String(i))}}async function jM(t,e,r,n=!1){n||oe("Delete bundle"),r.apikey=r.apikey||te();let i=await de();if(e=ke(e,i?.config),!r.apikey)throw n||D.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||D.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||D.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),new Error("Missing bundleId");let s=await pe(r.apikey,r.supaHost,r.supaAnon);return await De(s,r.apikey,["write","all"]),await yt(s,r.apikey,e,3,n),n||(D.info(`Deleting bundle ${e}@${t} from Capgo`),D.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await Up(s,e,t),n||(D.success(`Bundle ${e}@${t} deleted in Capgo`),ce("Done")),!0}var mi=require("node:fs");function il(t){console.error(W(t))}async function BM(t,e,r,n=!1){let{json:i}=r,s=!i&&!n;s&&(oe("Encryption"),await ze());try{let o=await de(),a=!!o.config.plugins?.CapacitorUpdater?.privateKey,u=!!o.config.plugins?.CapacitorUpdater?.publicKey;if(a&&s&&D.warning("There is still a privateKey in the config"),!(0,mi.existsSync)(t)){let S=`Zip not found at the path ${t}`;throw n||(i?il({error:"zip_not_found"}):D.error(`Error: ${S}`)),new Error(S)}if(!u)throw n||(i?il({error:"missing_public_key"}):D.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||Ir,l=r.keyData||"";if(!(0,mi.existsSync)(c)&&!l)throw n||(i?il({error:"missing_key"}):(D.warning(`Cannot find a private key at ${c} or as a keyData option`),D.error("Error: Missing key"))),new Error("Missing private key");if((0,mi.existsSync)(c)&&(l=(0,mi.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(i?il({error:"invalid_private_key"}):D.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let h=(0,mi.readFileSync)(t),{sessionKey:d,ivSessionKey:f}=Kp(l),m=tu(h,d,f),g=ru(e,l),b=`${t}_encrypted.zip`;return(0,mi.writeFileSync)(b,m),n||(i?console.log(JSON.stringify({checksum:g,filename:b,ivSessionKey:f},null,2)):(D.success(`Encoded Checksum: ${g}`),D.success(`ivSessionKey: ${f}`),D.success(`Encrypted zip saved at ${b}`),ce("Done \u2705"))),{checksum:g,filename:b,ivSessionKey:f}}catch(o){throw n||(r.json?il(o):D.error(`Error encrypting zip file ${W(o)}`)),o instanceof Error?o:new Error(String(o))}}var h6=require("node:crypto"),mo=require("node:fs"),FE=require("node:process");var Wp=class extends TransformStream{outChunkSize;constructor(e){let r=new Uint8Array(e),n=0;super({transform(i,s){let o=0;for(;o<i.length;){let a=e-n,u=Math.min(a,i.length-o);r.set(i.subarray(o,o+u),n),o+=u,n+=u,n===e&&(s.enqueue(r),r=new Uint8Array(e),n=0)}},flush(i){n>0&&i.enqueue(r.subarray(0,n))}}),this.outChunkSize=e}};function ss(t){return t=t.trim(),t=t.replace(/<!--[\s\S]*?-->/g,""),e();function e(){return{declaration:r(),root:n()}}function r(){if(!u(/^<\?xml\s*/))return;let d={attributes:{}};for(;!(c()||l("?>"));){let f=s();if(!f)return d;d.attributes[f.name]=f.value}return u(/\?>\s*/),d}function n(){let h=u(/^<([\w-:.]+)\s*/);if(!h)return;let d={name:h[1],attributes:{},children:[]};for(;!(c()||l(">")||l("?>")||l("/>"));){let m=s();if(!m)return d;d.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return d;u(/\??>\s*/),d.content=i();let f;for(;f=n();)d.children.push(f);return u(/^<\/[\w-:.]+>\s*/),d}function i(){let h=u(/^([^<]*)/);return h?a(h[1]):""}function s(){let h=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(h)return{name:h[1],value:a(o(h[2]))}}function o(h){return h.replace(/^['"]|['"]$/g,"")}function a(h){return h.replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function u(h){let d=t.match(h);if(d)return t=t.slice(d[0].length),d}function c(){return t.length===0}function l(h){return t.startsWith(h)}}var Ln=class extends Error{};var Yt=class extends Ln{},sl=class extends Ln{},Xp=class extends Ln{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},jn=class extends Ln{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},os=class extends Ln{constructor(){super("accessKey is required")}},nu=class extends Ln{constructor(){super("secretKey is required")}},ol=class extends Ln{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},gi=class extends Ln{statusCode;code;key;bucketName;resource;region;constructor(e,r,n,i={}){super(n),this.statusCode=e,this.code=r,this.key=i.key,this.bucketName=i.bucketName,this.resource=i.resource,this.region=i.region}};async function MM(t){try{let r=ss(await t.text()).root;if(r?.name!=="Error")throw new Error("Invalid root, expected <Error>");let n=r.children.find(c=>c.name==="Code")?.content??"UnknownErrorCode",i=r.children.find(c=>c.name==="Message")?.content??"The error message could not be determined.",s=r.children.find(c=>c.name==="Key")?.content,o=r.children.find(c=>c.name==="BucketName")?.content,a=r.children.find(c=>c.name==="Resource")?.content,u=r.children.find(c=>c.name==="Region")?.content;return new gi(t.status,n,i,{key:s,bucketName:o,resource:a,region:u})}catch{return new gi(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function qM(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function UM(t){return typeof t!="string"||t.length<3||t.length>63||t.includes("..")||t.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)?!1:!!t.match(/^[a-z0-9][a-z0-9.-]+[a-z0-9]$/)}function as(t){return!(!Wle(t)||t.length===0)}function Wle(t){return!(typeof t!="string"||t.length>1024)}function al(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function oo(t=""){let e={'"':"",""":"",""":"",""":"",""":""};return t.replace(/^("|"|")|("|"|")$/g,r=>e[r])}function aE(t){return t.get("x-amz-version-id")??null}function ao(t){let e=t.toISOString();return e.slice(0,4)+e.slice(5,7)+e.slice(8,13)+e.slice(14,16)+e.slice(17,19)+"Z"}function uE(t){return ao(t).slice(0,8)}function cE(t,e){return`${uE(e)}/${t}/s3/aws4_request`}async function Yp(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),al(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var Xle=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],Jp=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:i,metadata:s}){let o,a=1,u,c=[],l,h=[];super({start(){},async write(d,f){let g=a++;try{if(g==1&&d.length<i){let A=await e.makeRequest({method:"PUT",headers:new Headers({...s,"Content-Length":String(d.length)}),bucketName:r,objectName:n,payload:d});o={etag:oo(A.headers.get("etag")??void 0),versionId:aE(A.headers)};return}g===1&&(u=(await Yle({client:e,bucketName:r,objectName:n,metadata:s})).uploadId);let b={"Content-Length":String(d.length)};for(let A of Xle){let p=s[A];p&&(b[A]=p)}let S=e.makeRequest({method:"PUT",query:{partNumber:g.toString(),uploadId:u},headers:new Headers(b),bucketName:r,objectName:n,payload:d}).then(A=>{let p=A.headers.get("etag")??"";return p&&(p=p.replace(/^"/,"").replace(/"$/,"")),c.push({part:g,etag:p}),A});h.push(S.catch(A=>{l||(l=A)}))}catch(b){throw b}},async close(){if(!o)if(u){if(await Promise.all(h),l)throw l;c.sort((d,f)=>d.part>f.part?1:-1),o=await Jle({client:e,bucketName:r,objectName:n,uploadId:u,etags:c})}else throw new Error("Stream was closed without uploading any data.")}}),this.getResult=()=>{if(o===void 0)throw new Error("Result is not ready. await the stream first.");return o}}};async function Yle(t){let e="POST",r=new Headers(t.metadata),s=await(await t.client.makeRequest({method:e,bucketName:t.bucketName,objectName:t.objectName,query:"uploads",headers:r,returnBody:!0})).text(),o=ss(s).root;if(!o||o.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let a=o.children.find(u=>u.name==="UploadId")?.content;if(!a)throw new Error(`Unable to get UploadId from response: ${s}`);return{uploadId:a}}async function Jle({client:t,bucketName:e,objectName:r,uploadId:n,etags:i}){let s=`
|
|
319
|
+
`).eq("app_id",e).order("created_at",{ascending:!1});if(i)throw r||y.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${W(i)}`);return n}async function iE(t,e,r,n={}){let{silent:i=!1}=n,{error:s}=await t.from("app_versions").update({deleted:!0}).eq("app_id",e).eq("deleted",!1).eq("name",r);if(s){let o=`App version ${e}@${r} not found in database`;throw i||y.error(o),new Error(`${o}: ${W(s)}`)}}async function Up(t,e,r,n={}){let{silent:i=!1,autoUnlink:s=!1}=n,o=await Ple(t,e,r,{silent:i});await sM(t,e,o,{silent:i,autoUnlink:s}),await iE(t,e,r,{silent:i})}function dM(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new Ht;r.theme=Ht.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,Za(n.created_at),n.keep??""]);y.success("Bundles"),y.success(r.toString())}async function Hp(t,e,r={}){let{silent:n=!1}=r,{data:i,error:s}=await t.from("app_versions").select().eq("app_id",e).eq("deleted",!1).order("created_at",{ascending:!1});if(s){let o=`App ${e} not found in database`;throw n||y.error(o),new Error(`${o}: ${W(s)}`)}return i??[]}async function pM(t,e,r={}){let{silent:n=!1}=r,{data:i,error:s}=await t.from("channels").select("version").eq("app_id",e);if(s){let o=`App ${e} not found in database`;throw n||y.error(o),new Error(`${o}: ${W(s)}`)}return(i??[]).map(o=>o.version)}async function Ple(t,e,r,n={}){let{silent:i=!1}=n,{data:s,error:o}=await t.from("app_versions").select().eq("app_id",e).eq("name",r).eq("deleted",!1).single();if(!s||o){let a=`App version ${e}@${r} doesn't exist`;throw i||y.error(a),new Error(`${a}${o?`: ${W(o)}`:""}`)}return s}var Qa=require("node:fs");async function mM(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function yt(t,e,r,n,i=!1){let s=$n(),o=await G8(t,e,r);if(!o.okay)switch(o.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw i||y.error(c),new Error(c)}case"NO_APP":{let c=`App ${r} does not exist, run first \`${s.runner} @capgo/cli app add ${r}\` to create it`;throw i||y.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw i||y.error(c),new Error(c)}}let a=o.data;if(n>a){let c=`Insuficcent permissions for app ${r}. Current permission: ${fr[o.data]}, required for this action: ${fr[n]}.`;throw i||y.error(c),new Error(c)}return o.data}var Yr="assets/icon.png";var kle=/^[a-z0-9]+(\.[\w-]+)+$/i;function Rle(t,e,r){if(!e.apikey)throw r||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||y.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||y.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!kle.test(t))throw r||(y.error(`Invalid app ID format: "${t}"`),y.info("App ID must be in reverse domain notation (e.g., com.example.app)"),y.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),y.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function Nle(t,e,r){if(await mM(t,e))throw e==="io.ionic.starter"?(r||y.error(`This appId ${e} cannot be used it's reserved, please change it in your capacitor config.`),new Error("Reserved appId, please change it in capacitor config")):(r||y.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function gM(t,e,r,n=!1){n||oe("Adding"),await ze(),e.apikey=e.apikey||te();let i=await de(),s=ke(t,i?.config);Rle(s,e,n);let o=await pe(e.apikey,e.supaHost,e.supaAnon),a=await De(o,e.apikey,["write","all"]);await Nle(o,s,n),r||(r=await Mp(o,["admin","super_admin"]));let u=r.gid,{name:c,icon:l}=e;if(c=c||i.config?.appName||"Unknown",l=l||"resources/icon.png",!l||!c)throw n||y.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project"),new Error("Missing app name or icon path");n||y.info(`Adding ${s} to Capgo`);let h=null,d=null;l&&(0,Qa.existsSync)(l)?(h=(0,Qa.readFileSync)(l),d=Ja(l)||"image/png",n||y.warn(`Found app icon ${l}`)):(0,Qa.existsSync)(Yr)?(h=(0,Qa.readFileSync)(Yr),d=Ja(Yr)||"image/png",n||y.warn(`Found app icon ${Yr}`)):n||y.warn(`Cannot find app icon in any of the following locations: ${l}, ${Yr}`);let f="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(h&&d){let{error:b}=await o.storage.from(`images/org/${u}/${s}`).upload(f,h,{contentType:d});if(b)throw n||console.error(b),n||y.error(`Could not add app ${W(b)}`),new Error(`Could not add app ${W(b)}`);let{data:S}=await o.storage.from(`images/org/${u}/${s}`).getPublicUrl(f);m=S?.publicUrl||m}let{error:g}=await o.from("apps").insert({icon_url:m,owner_org:u,user_id:a,name:c,app_id:s});if(g)throw n||y.error(`Could not add app ${W(g)}`),new Error(`Could not add app ${W(g)}`);return n||(y.success(`App ${s} added to Capgo. You can upload a bundle now`),ce("Done \u2705")),{appId:s,organizationUid:u,userId:a,name:c,signedURL:m}}async function yM(t,e,r=!1,n=!1){r||oe("Deleting"),e.apikey=e.apikey||te();let i=await de(),s=ke(t,i?.config);if(!e.apikey)throw r||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||y.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await pe(e.apikey,e.supaHost,e.supaAnon),a=await De(o,e.apikey,["write","all"]);await yt(o,e.apikey,s,5,r);let{data:u,error:c}=await o.from("apps").select("owner_org ( created_by, id )").eq("app_id",s).single(),l=u;if(!n&&!c&&(l?.owner_org.created_by??"")!==a){if(r)throw new Error("Cannot delete app: you are not the organization owner");{y.warn("Deleting the app is not recommended for users that are not the organization owner"),y.warn("You are invited as a super_admin but your are not the owner"),y.warn("It's strongly recommended that you do not continue!");let g=await wo({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(xt(g)||g==="no")throw y.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&y.warn(`Cannot get the app owner ${W(c)}`);let{error:h}=await o.storage.from("images").remove([`org/${l?.owner_org.id}/${s}/icon`]);h&&!r&&y.error("Could not delete app logo");let{error:d}=await o.storage.from(`apps/${s}/${a}`).remove(["versions"]);d&&!r&&y.error("Could not delete app version");let{error:f}=await o.from("apps").delete().eq("app_id",s);if(f)throw r||y.error("Could not delete app"),new Error(`Could not delete app: ${W(f)}`);let m=await sn(o,s);return await Ae(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":s},notify:!1}).catch(()=>{}),r||(y.success("App deleted in Capgo"),ce("Done \u2705")),!0}var Vp=require("node:os"),wM=require("node:process");async function DM(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(i=>$h(i)))).forEach((i,s)=>{i&&(e[r[s]]=i)}),e}async function $le(){let t=await nl(),e={"@capgo/cli":Pi.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function bM(t,e=!1){e||y.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await de(),n=rs("",t.packageJson),i=r?.config?.plugins?.CapacitorUpdater?.version||n,s=r?.config?.appName||"",o=ke("",r?.config),a=r?.config?.webDir||"";e||(y.info(` App Name: ${s}`),y.info(` App ID: ${o}`),y.info(` App Version: ${i}`),y.info(` Web Dir: ${a}`),y.info(` OS: ${(0,Vp.platform)()} ${(0,Vp.version)()}`),y.info(` Node: ${wM.version}`),y.info(" Installed Dependencies:"));let u=await $le();if(Object.keys(u).length===0)throw e||y.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),new Error("No dependencies found");if(!e)for(let l of Object.keys(u))y.info(` ${l}: ${u[l]}`);let c={};if(e)c=await DM(u);else{let l=Ft();l.start("Running: Loading latest dependencies"),c=await DM(u),l.stop("Latest Dependencies:");for(let h of Object.keys(c))y.info(` ${h}: ${c[h]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||y.warn("\x1B[31m\u{1F6A8} Some dependencies are not up to date\x1B[0m"),new Error("Some dependencies are not up to date");return e||y.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),{appName:s,appId:o,appVersion:i,webDir:a,installedDependencies:u,latestDependencies:c}}function Lle(t){let e=new Ht;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,Za(r.created_at)]);y.success("Apps"),y.success(e.toString())}async function jle(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||y.error("Apps not found"),new Error("Apps not found");return r??[]}async function vM(t,e=!1){e||oe("List apps in Capgo"),await ze(),t.apikey=t.apikey||te();let r=await pe(t.apikey,t.supaHost,t.supaAnon);await De(r,t.apikey,["write","all","read","upload"]),e||y.info("Getting active bundle in Capgo");let n=await jle(r,e);if(!n.length)throw e||y.error("No apps found"),new Error("No apps found");return e||(y.info(`Active app in Capgo: ${n.length}`),Lle(n),ce("Done \u2705")),n}var EM=require("node:crypto"),eu=require("node:fs");async function _M(t,e,r=!1){r||oe("Set app"),e.apikey=e.apikey||te();let n=await de();if(t=ke(t,n?.config),!e.apikey)throw r||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||y.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await pe(e.apikey,e.supaHost,e.supaAnon),o=(await Mp(i,["admin","super_admin"])).gid,a=await De(i,e.apikey,["write","all"]);await yt(i,e.apikey,t,4,r);let{name:u,icon:c,retention:l}=e;if(l&&Number.isNaN(Number(l)))throw r||y.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||y.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||y.error("retention value cannot be greater than 63113904 seconds (2 years)"),new Error("Retention value cannot be greater than 63113904 seconds (2 years)");let h,d,f=`icon_${(0,EM.randomUUID)()}`,m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,eu.existsSync)(c)?(h=(0,eu.readFileSync)(c),d=Ja(c)||"image/png",r||y.warn(`Found app icon ${c}`)):(0,eu.existsSync)(Yr)?(h=(0,eu.readFileSync)(Yr),d=Ja(Yr)||"image/png",r||y.warn(`Found app icon ${Yr}`)):r||y.warn(`Cannot find app icon in any of the following locations: ${c}, ${Yr}`),h&&d){let{error:b}=await i.storage.from(`images/org/${o}/${t}`).upload(f,h,{contentType:d});if(b)throw r||y.error(`Could not set app ${W(b)}`),new Error(`Could not set app: ${W(b)}`);let{data:S}=await i.storage.from(`images/org/${o}/${t}`).getPublicUrl(f);m=S?.publicUrl||m}let{error:g}=await i.from("apps").update({icon_url:m,name:u,retention:l?l*24*60*60:void 0}).eq("app_id",t).eq("user_id",a);if(g)throw r||y.error(`Could not set app ${W(g)}`),new Error(`Could not set app: ${W(g)}`);return r||ce("Done \u2705"),!0}async function CM(t,e,r=!1){if(r||oe("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||y.error("Bool and string CANNOT be set at the same time"),new Error("Bool and string cannot both be provided");if(!e.bool&&!e.string)throw r||y.error("You MUST provide either bool or string as the value"),new Error("Either bool or string value is required");if(e.bool&&e.bool!=="true"&&e.bool!=="false")throw r||y.error("Invalid bool"),new Error("Invalid bool value; expected true or false");try{let n=await de(),i=n.config,s=t.split(".");if(s.length===0)throw r||y.error("Invalid path"),new Error("Invalid config path");for(let a of s.slice(0,-1))Object.prototype.hasOwnProperty.call(i,a)||(i[a]={}),i=i[a];let o=e.bool?e.bool==="true":e.string;i[s.at(-1)]=o,await Ha(n,!0),r||y.success(`Set "${t}" to "${o}"`)}catch(n){throw r||y.error(`Cannot set config in capacitor settings ${W(n)}`),new Error(`Cannot set capacitor config: ${W(n)}`)}r||ce("Done \u2705")}var OM=require("node:child_process"),ns=require("node:fs/promises"),xM=require("node:os"),so=require("node:path"),TM=Oe(require("node:process"));var zp=require("node:fs/promises"),SM=require("node:os"),sE=require("node:path"),Ble=(0,sE.join)((0,SM.homedir)(),".capgo-credentials"),Mle=(0,sE.join)(Ble,"credentials.json");async function qle(){try{let t=await(0,zp.readFile)(Mle,"utf-8");return JSON.parse(t)}catch{return{}}}async function Ule(t){let e=await qle();if(!t){let r=Object.keys(e);return r.length===0?null:e[r[0]]||null}return e[t]||null}async function AM(t,e,r){let n=await Ule(t);return!n||!n[e]?r:{...n[e],...r}}async function Hle(t,e,r,n,i){if(!i)try{let s=await fetch(`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`,{headers:{authorization:n}});if(!s.ok){y.warn("Could not stream logs, continuing...");return}let o=s.body?.getReader();if(!o)return;let a=new TextDecoder;for(;;){let{done:u,value:c}=await o.read();if(u)break;let h=a.decode(c,{stream:!0}).split(`
|
|
320
|
+
`);for(let d of h)if(d.startsWith("data: ")){let f=d.slice(6);f.trim()&&y.error(f)}}}catch(s){i||y.warn(`Log streaming interrupted${s instanceof Error?`: ${s.message}`:""}`)}}async function Vle(t,e,r,n,i,s){let a=0;for(;a<120;)try{let u=await fetch(`${t}/build/status?job_id=${encodeURIComponent(e)}&app_id=${encodeURIComponent(r)}&platform=${n}`,{headers:{authorization:i}});if(!u.ok){s||y.warn(`Status check failed: ${u.status}`),await new Promise(l=>setTimeout(l,5e3)),a++;continue}let c=await u.json();if(c.status==="succeeded"||c.status==="failed")return c.status;await new Promise(l=>setTimeout(l,5e3)),a++}catch(u){s||y.warn(`Status check error: ${u}`),await new Promise(c=>setTimeout(c,5e3)),a++}return s||y.warn("Build status polling timed out"),"timeout"}async function zle(t,e){return new Promise((r,n)=>{let s=(0,OM.spawn)("zip",["-rq",e,"."],{cwd:t,stdio:"inherit"});s.on("error",o=>{o.code==="ENOENT"?n(new Error("zip command not found. Please install zip utility.")):n(o)}),s.on("close",o=>{o===0?r():n(new Error(`zip process exited with code ${o}`))})})}async function FM(t,e,r=!1){try{e.apikey=e.apikey||te(r);let n=await de();if(t=t||n?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");let i=(0,so.resolve)(e.path||TM.default.cwd()),s=await pe(e.apikey,e.supaHost,e.supaAnon);await De(s,e.apikey,["write","all"]),r||(y.info(`Requesting native build for ${t}`),y.info(`Platform: ${e.lane}`),y.info(`Project: ${i}`),y.info(`
|
|
321
|
+
\u{1F512} Security: Credentials are never stored on Capgo servers`),y.info(" They are used only during build and deleted after (max 24h)"),y.info(` Builds sent directly to app stores - Capgo keeps nothing
|
|
322
|
+
`));let o=await AM(t,e.lane,e.credentials),a={app_id:t,platform:e.lane};if(o)a.credentials=o,r||y.info("\u2713 Using credentials (saved + provided)");else throw r||(y.error("\u274C No credentials found for this app and platform"),y.error(""),y.error("You must save credentials before building:"),y.error(` npx @capgo/cli build credentials save --appId ${t} --platform ${e.lane}`),y.error(""),y.error("Documentation:"),y.error(" https://capgo.app/docs/cli/cloud-build/credentials/#saving-ios-credentials"),y.error(" https://capgo.app/docs/cli/cloud-build/credentials/#saving-android-credentials")),new Error("No credentials found. Please save credentials before building.");r||y.info("Requesting build from Capgo...");let u=e.supaHost||"https://api.capgo.app",c=await fetch(`${u}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(a)});if(!c.ok){let f=await c.text();throw new Error(`Failed to request build: ${c.status} - ${f}`)}let l=await c.json();r||(y.success(`Build job created: ${l.job_id}`),y.info(`Status: ${l.status}`));let h=(0,so.join)((0,xM.tmpdir)(),`capgo-build-${Date.now()}`);await(0,ns.mkdir)(h,{recursive:!0});let d=(0,so.join)(h,`${(0,so.basename)(i)}.zip`);try{r||y.info(`Zipping project from ${i}...`),await zle(i,d);let f=await(0,ns.stat)(d),m=(f.size/1024/1024).toFixed(2);r||y.success(`Created zip: ${d} (${m} MB)`),r||y.info("Uploading to builder...");let g=await(0,ns.readFile)(d),b=await fetch(l.upload_url,{method:"PUT",headers:{"Content-Type":"application/zip","Content-Length":String(f.size)},body:g});if(!b.ok){let D=await b.text();throw new Error(`Upload failed: ${b.status} - ${D}`)}r||y.success("Upload complete!"),r||y.info("Starting build job...");let S=await fetch(`${u}/build/start/${l.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!S.ok){let D=await S.text();throw new Error(`Failed to start build: ${S.status} - ${D}`)}let A=await S.json();r||(y.success("Build started successfully!"),y.info(`Job ID: ${l.job_id}`),y.info(`Streaming build logs...
|
|
323
|
+
`)),await Hle(u,l.job_id,t,e.apikey,r);let p=await Vle(u,l.job_id,t,e.lane,e.apikey,r);return r||(p==="succeeded"?y.success("Build completed successfully!"):p==="failed"?y.error("Build failed"):y.warn(`Build finished with status: ${p}`)),{success:p==="succeeded",jobId:l.job_id,uploadUrl:l.upload_url,status:p||A.status||l.status}}finally{await(0,ns.rm)(h,{recursive:!0,force:!0})}}catch(n){let i=n instanceof Error?n.message:String(n);return r||y.error(i),{success:!1,error:i}}}async function Gle(t,e,r,n){for await(let i of t)n||y.warn(`Removing ${i.name} created on ${Za(i.created_at)}`),await Up(e,r,i.name)}function Kle(t,e,r){let n=[];for(let i of t??[]){let s=Ct(i.name);km(s,e)&&Rm(s,r)&&n.push(i)}return n}async function IM(t,e,r=!1){r||oe("Cleanup versions in Capgo"),await ze(),e.apikey=e.apikey||te();let{bundle:n,keep:i=4}=e,s=e.force||!1,o=e.ignoreChannel||!1,a=await de();if(t=ke(t,a?.config),!e.apikey)throw r||y.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||y.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let u=await pe(e.apikey,e.supaHost,e.supaAnon);await De(u,e.apikey,["write","all"]),await yt(u,e.apikey,t,3,r),r||y.info("Querying all available versions in Capgo");let c=await Hp(u,t),l=await pM(u,t);if(r||y.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||y.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let f=Ct(n),m=h_(f,"major");r||y.info(`Querying available versions in Capgo between ${vi(f)} and ${vi(m)}`),c=Kle(c,f,m),r||y.info(`Active versions in Capgo between ${vi(f)} and ${vi(m)}: ${c?.length??0}`)}let h=[],d=0;for(let f of c){let m=l.find(g=>g===f.id);d<i||m&&!o?(f.keep=m?"\u2705 (Linked to channel)":"\u2705",d+=1):(f.keep="\u274C",h.push(f))}if(!h.length)return r||y.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:d};if(r||dM(c),!s){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let f=await $r({message:"Do you want to continue removing the versions specified?"});if(xt(f)||!f)throw y.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||y.success("You have confirmed removal, removing versions now"),await Gle(h,u,t,r),r||ce("Done \u2705"),{removed:h.length,kept:d}}async function PM(t,e,r=!1){r||oe("Check compatibility");let n={...e,apikey:e.apikey||te()},i=await de(),s=ke(t,i?.config),o=n.channel;if(!o)throw r||y.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||y.error("Missing argument, you need to provide an appId, or be in a capacitor project"),new Error("Missing appId");let a=await pe(n.apikey,n.supaHost,n.supaAnon);await De(a,n.apikey,["write","all","read","upload"]),await yt(a,n.apikey,s,1,r);let u=await qp(a,s,o,n.packageJson,n.nodeModules);if(!r){let c=new Ht;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=Ht.roundTheme,c.rows=[];let l=n.text?"Yes":"\u2705",h=n.text?"No":"\u274C";for(let d of u.finalCompatibility){let{name:f,localVersion:m,remoteVersion:g}=d,b=io(d)?l:h;c.rows.push([f,m,g,b])}y.success("Compatibility"),y.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}var pi=require("node:fs");var is=require("node:buffer"),qt=require("node:crypto"),kM="aes-128-cbc",di="base64",Gp=qt.constants.RSA_PKCS1_PADDING;function Kp(t){let e=(0,qt.randomBytes)(16),r=(0,qt.randomBytes)(16),n=e.toString(di),i=(0,qt.privateEncrypt)({key:t,padding:Gp},r).toString(di);return{sessionKey:r,ivSessionKey:`${n}:${i}`}}function tu(t,e,r){let[n]=r.split(":"),i=is.Buffer.from(n,di),s=(0,qt.createCipheriv)(kM,e,i);return s.setAutoPadding(!0),is.Buffer.concat([s.update(t),s.final()])}function RM(t,e,r){let[n,i]=e.split(":"),s=(0,qt.publicDecrypt)({key:r,padding:Gp},is.Buffer.from(i,di)),o=is.Buffer.from(n,di),a=(0,qt.createDecipheriv)(kM,s,o);return a.setAutoPadding(!0),is.Buffer.concat([a.update(t),a.final()])}function ru(t,e){return(0,qt.privateEncrypt)({key:e,padding:Gp},is.Buffer.from(t,di)).toString(di)}function NM(t="pem",e=2048){let{publicKey:r,privateKey:n}=(0,qt.generateKeyPairSync)("rsa",{modulusLength:e});return t==="pem"?{publicKey:r.export({type:"pkcs1",format:"pem"}),privateKey:n.export({type:"pkcs1",format:"pem"})}:{publicKey:r.export({type:"spki",format:"der"}).toString("base64"),privateKey:n.export({type:"pkcs1",format:"pem"}).toString("base64")}}function $M(t,e){return(0,qt.publicDecrypt)({key:e,padding:Gp},is.Buffer.from(t,di)).toString(di)}function Wle(t,e){let r=t.key||hi,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,pi.existsSync)(r)?n=(0,pi.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function LM(t,e,r,n=!1){n||oe("Decrypt zip file");try{if(await ze(),!(0,pi.existsSync)(t)){let h=`Zip not found at the path ${t}`;throw n||y.error(h),new Error(h)}let i=await de();if(!r.key&&!(0,pi.existsSync)(hi)&&!i.config.plugins?.CapacitorUpdater?.privateKey){let h=`Private Key not found at the path ${hi} or in ${i.path}`;throw n||y.error(h),new Error(h)}let{publicKey:s,fallbackKeyPath:o}=Wle(r,i);if(!s){let h=`Cannot find public key ${o} or as keyData option or in ${i.path}`;throw n||y.error(h),new Error(h)}let a=(0,pi.readFileSync)(t),u=RM(a,e,r.keyData??s),c=`${t}_decrypted.zip`;(0,pi.writeFileSync)(c,u),n||y.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let h=await Yn(u,"sha256"),d=$M(r.checksum,r.keyData??s);if(l=h===d,!l){let f=`Checksum does not match ${h} !== ${d}`;throw n||y.error(f),new Error(f)}n||y.info("Checksum matches")}return n||ce("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(i){throw n||y.error(`Error decrypting zip file ${W(i)}`),i instanceof Error?i:new Error(String(i))}}async function jM(t,e,r,n=!1){n||oe("Delete bundle"),r.apikey=r.apikey||te();let i=await de();if(e=ke(e,i?.config),!r.apikey)throw n||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||y.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||y.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),new Error("Missing bundleId");let s=await pe(r.apikey,r.supaHost,r.supaAnon);return await De(s,r.apikey,["write","all"]),await yt(s,r.apikey,e,3,n),n||(y.info(`Deleting bundle ${e}@${t} from Capgo`),y.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await Up(s,e,t),n||(y.success(`Bundle ${e}@${t} deleted in Capgo`),ce("Done")),!0}var mi=require("node:fs");function il(t){console.error(W(t))}async function BM(t,e,r,n=!1){let{json:i}=r,s=!i&&!n;s&&(oe("Encryption"),await ze());try{let o=await de(),a=!!o.config.plugins?.CapacitorUpdater?.privateKey,u=!!o.config.plugins?.CapacitorUpdater?.publicKey;if(a&&s&&y.warning("There is still a privateKey in the config"),!(0,mi.existsSync)(t)){let S=`Zip not found at the path ${t}`;throw n||(i?il({error:"zip_not_found"}):y.error(`Error: ${S}`)),new Error(S)}if(!u)throw n||(i?il({error:"missing_public_key"}):y.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||Ir,l=r.keyData||"";if(!(0,mi.existsSync)(c)&&!l)throw n||(i?il({error:"missing_key"}):(y.warning(`Cannot find a private key at ${c} or as a keyData option`),y.error("Error: Missing key"))),new Error("Missing private key");if((0,mi.existsSync)(c)&&(l=(0,mi.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(i?il({error:"invalid_private_key"}):y.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let h=(0,mi.readFileSync)(t),{sessionKey:d,ivSessionKey:f}=Kp(l),m=tu(h,d,f),g=ru(e,l),b=`${t}_encrypted.zip`;return(0,mi.writeFileSync)(b,m),n||(i?console.log(JSON.stringify({checksum:g,filename:b,ivSessionKey:f},null,2)):(y.success(`Encoded Checksum: ${g}`),y.success(`ivSessionKey: ${f}`),y.success(`Encrypted zip saved at ${b}`),ce("Done \u2705"))),{checksum:g,filename:b,ivSessionKey:f}}catch(o){throw n||(r.json?il(o):y.error(`Error encrypting zip file ${W(o)}`)),o instanceof Error?o:new Error(String(o))}}var h6=require("node:crypto"),mo=require("node:fs"),FE=require("node:process");var Wp=class extends TransformStream{outChunkSize;constructor(e){let r=new Uint8Array(e),n=0;super({transform(i,s){let o=0;for(;o<i.length;){let a=e-n,u=Math.min(a,i.length-o);r.set(i.subarray(o,o+u),n),o+=u,n+=u,n===e&&(s.enqueue(r),r=new Uint8Array(e),n=0)}},flush(i){n>0&&i.enqueue(r.subarray(0,n))}}),this.outChunkSize=e}};function ss(t){return t=t.trim(),t=t.replace(/<!--[\s\S]*?-->/g,""),e();function e(){return{declaration:r(),root:n()}}function r(){if(!u(/^<\?xml\s*/))return;let d={attributes:{}};for(;!(c()||l("?>"));){let f=s();if(!f)return d;d.attributes[f.name]=f.value}return u(/\?>\s*/),d}function n(){let h=u(/^<([\w-:.]+)\s*/);if(!h)return;let d={name:h[1],attributes:{},children:[]};for(;!(c()||l(">")||l("?>")||l("/>"));){let m=s();if(!m)return d;d.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return d;u(/\??>\s*/),d.content=i();let f;for(;f=n();)d.children.push(f);return u(/^<\/[\w-:.]+>\s*/),d}function i(){let h=u(/^([^<]*)/);return h?a(h[1]):""}function s(){let h=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(h)return{name:h[1],value:a(o(h[2]))}}function o(h){return h.replace(/^['"]|['"]$/g,"")}function a(h){return h.replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function u(h){let d=t.match(h);if(d)return t=t.slice(d[0].length),d}function c(){return t.length===0}function l(h){return t.startsWith(h)}}var Ln=class extends Error{};var Yt=class extends Ln{},sl=class extends Ln{},Xp=class extends Ln{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},jn=class extends Ln{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},os=class extends Ln{constructor(){super("accessKey is required")}},nu=class extends Ln{constructor(){super("secretKey is required")}},ol=class extends Ln{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},gi=class extends Ln{statusCode;code;key;bucketName;resource;region;constructor(e,r,n,i={}){super(n),this.statusCode=e,this.code=r,this.key=i.key,this.bucketName=i.bucketName,this.resource=i.resource,this.region=i.region}};async function MM(t){try{let r=ss(await t.text()).root;if(r?.name!=="Error")throw new Error("Invalid root, expected <Error>");let n=r.children.find(c=>c.name==="Code")?.content??"UnknownErrorCode",i=r.children.find(c=>c.name==="Message")?.content??"The error message could not be determined.",s=r.children.find(c=>c.name==="Key")?.content,o=r.children.find(c=>c.name==="BucketName")?.content,a=r.children.find(c=>c.name==="Resource")?.content,u=r.children.find(c=>c.name==="Region")?.content;return new gi(t.status,n,i,{key:s,bucketName:o,resource:a,region:u})}catch{return new gi(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function qM(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function UM(t){return typeof t!="string"||t.length<3||t.length>63||t.includes("..")||t.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)?!1:!!t.match(/^[a-z0-9][a-z0-9.-]+[a-z0-9]$/)}function as(t){return!(!Xle(t)||t.length===0)}function Xle(t){return!(typeof t!="string"||t.length>1024)}function al(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function oo(t=""){let e={'"':"",""":"",""":"",""":"",""":""};return t.replace(/^("|"|")|("|"|")$/g,r=>e[r])}function aE(t){return t.get("x-amz-version-id")??null}function ao(t){let e=t.toISOString();return e.slice(0,4)+e.slice(5,7)+e.slice(8,13)+e.slice(14,16)+e.slice(17,19)+"Z"}function uE(t){return ao(t).slice(0,8)}function cE(t,e){return`${uE(e)}/${t}/s3/aws4_request`}async function Yp(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),al(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var Yle=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],Jp=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:i,metadata:s}){let o,a=1,u,c=[],l,h=[];super({start(){},async write(d,f){let g=a++;try{if(g==1&&d.length<i){let A=await e.makeRequest({method:"PUT",headers:new Headers({...s,"Content-Length":String(d.length)}),bucketName:r,objectName:n,payload:d});o={etag:oo(A.headers.get("etag")??void 0),versionId:aE(A.headers)};return}g===1&&(u=(await Jle({client:e,bucketName:r,objectName:n,metadata:s})).uploadId);let b={"Content-Length":String(d.length)};for(let A of Yle){let p=s[A];p&&(b[A]=p)}let S=e.makeRequest({method:"PUT",query:{partNumber:g.toString(),uploadId:u},headers:new Headers(b),bucketName:r,objectName:n,payload:d}).then(A=>{let p=A.headers.get("etag")??"";return p&&(p=p.replace(/^"/,"").replace(/"$/,"")),c.push({part:g,etag:p}),A});h.push(S.catch(A=>{l||(l=A)}))}catch(b){throw b}},async close(){if(!o)if(u){if(await Promise.all(h),l)throw l;c.sort((d,f)=>d.part>f.part?1:-1),o=await Zle({client:e,bucketName:r,objectName:n,uploadId:u,etags:c})}else throw new Error("Stream was closed without uploading any data.")}}),this.getResult=()=>{if(o===void 0)throw new Error("Result is not ready. await the stream first.");return o}}};async function Jle(t){let e="POST",r=new Headers(t.metadata),s=await(await t.client.makeRequest({method:e,bucketName:t.bucketName,objectName:t.objectName,query:"uploads",headers:r,returnBody:!0})).text(),o=ss(s).root;if(!o||o.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let a=o.children.find(u=>u.name==="UploadId")?.content;if(!a)throw new Error(`Unable to get UploadId from response: ${s}`);return{uploadId:a}}async function Zle({client:t,bucketName:e,objectName:r,uploadId:n,etags:i}){let s=`
|
|
324
324
|
<CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
325
325
|
${i.map(h=>` <Part><PartNumber>${h.part}</PartNumber><ETag>${h.etag}</ETag></Part>`).join(`
|
|
326
326
|
`)}
|
|
327
327
|
</CompleteMultipartUpload>
|
|
328
|
-
`,o=await t.makeRequest({method:"POST",bucketName:e,objectName:r,query:`uploadId=${encodeURIComponent(n)}`,payload:new TextEncoder().encode(s),returnBody:!0}),a=await o.text(),u=ss(a).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${a}`);let c=u.children.find(h=>h.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${a}`);let l=aE(o.headers);return{etag:oo(c),versionId:l}}var ul="AWS4-HMAC-SHA256";async function HM(t){if(!t.accessKey)throw new os;if(!t.secretKey)throw new nu;let e=t.headers.get("x-amz-content-sha256");if(e===null)throw new Error("Internal S3 client error - expected x-amz-content-sha256 header, but it's missing.");let r=zM(t.headers),n=GM(t.method,t.path,t.headers,r,e),i=await KM(n,t.date,t.region),s=await fE(t.date,t.region,t.secretKey),o=hE(t.accessKey,t.region,t.date),a=al(await co(s,i)).toLowerCase();return`${ul} Credential=${o}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${a}`}async function VM(t){if(!t.accessKey)throw new os;if(!t.secretKey)throw new nu;if(t.expirySeconds<1||t.expirySeconds>604800)throw new ol;if(!t.headers.has("Host"))throw new Error("Internal error: host header missing");let e=t.path.split("?")[0],r=t.path.split("?")[1],n=ao(t.date),i=zM(t.headers),s=hE(t.accessKey,t.region,t.date),o="UNSIGNED-PAYLOAD",a=new URLSearchParams(r);a.set("X-Amz-Algorithm",ul),a.set("X-Amz-Credential",s),a.set("X-Amz-Date",n),a.set("X-Amz-Expires",t.expirySeconds.toString()),a.set("X-Amz-SignedHeaders",i.join(";").toLowerCase()),t.sessionToken&&a.set("X-Amz-Security-Token",t.sessionToken);let u=a.toString().replace("+","%20"),c=e+"?"+u,l=e.split("/").map(b=>encodeURIComponent(b)).join("/"),h=GM(t.method,c,t.headers,i,o),d=await KM(h,t.date,t.region),f=await fE(t.date,t.region,t.secretKey),m=al(await co(f,d)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${l}?${u}&X-Amz-Signature=${m}`}function zM(t){let e=["authorization","content-length","content-type","user-agent"],r=[];for(let n of t.keys())e.includes(n.toLowerCase())||r.push(n);return r.sort(),r}var uo={A:65,Z:90,a:97,z:122,0:48,9:57,"/":47},
|
|
328
|
+
`,o=await t.makeRequest({method:"POST",bucketName:e,objectName:r,query:`uploadId=${encodeURIComponent(n)}`,payload:new TextEncoder().encode(s),returnBody:!0}),a=await o.text(),u=ss(a).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${a}`);let c=u.children.find(h=>h.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${a}`);let l=aE(o.headers);return{etag:oo(c),versionId:l}}var ul="AWS4-HMAC-SHA256";async function HM(t){if(!t.accessKey)throw new os;if(!t.secretKey)throw new nu;let e=t.headers.get("x-amz-content-sha256");if(e===null)throw new Error("Internal S3 client error - expected x-amz-content-sha256 header, but it's missing.");let r=zM(t.headers),n=GM(t.method,t.path,t.headers,r,e),i=await KM(n,t.date,t.region),s=await fE(t.date,t.region,t.secretKey),o=hE(t.accessKey,t.region,t.date),a=al(await co(s,i)).toLowerCase();return`${ul} Credential=${o}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${a}`}async function VM(t){if(!t.accessKey)throw new os;if(!t.secretKey)throw new nu;if(t.expirySeconds<1||t.expirySeconds>604800)throw new ol;if(!t.headers.has("Host"))throw new Error("Internal error: host header missing");let e=t.path.split("?")[0],r=t.path.split("?")[1],n=ao(t.date),i=zM(t.headers),s=hE(t.accessKey,t.region,t.date),o="UNSIGNED-PAYLOAD",a=new URLSearchParams(r);a.set("X-Amz-Algorithm",ul),a.set("X-Amz-Credential",s),a.set("X-Amz-Date",n),a.set("X-Amz-Expires",t.expirySeconds.toString()),a.set("X-Amz-SignedHeaders",i.join(";").toLowerCase()),t.sessionToken&&a.set("X-Amz-Security-Token",t.sessionToken);let u=a.toString().replace("+","%20"),c=e+"?"+u,l=e.split("/").map(b=>encodeURIComponent(b)).join("/"),h=GM(t.method,c,t.headers,i,o),d=await KM(h,t.date,t.region),f=await fE(t.date,t.region,t.secretKey),m=al(await co(f,d)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${l}?${u}&X-Amz-Signature=${m}`}function zM(t){let e=["authorization","content-length","content-type","user-agent"],r=[];for(let n of t.keys())e.includes(n.toLowerCase())||r.push(n);return r.sort(),r}var uo={A:65,Z:90,a:97,z:122,0:48,9:57,"/":47},Qle="-._~".split("").map(t=>t.charCodeAt(0));function lE(t,e=!1){let r=new TextEncoder().encode(t),n="";for(let i of r)i>=uo.A&&i<=uo.Z||i>=uo.a&&i<=uo.z||i>=uo[0]&&i<=uo[9]||Qle.includes(i)||i==uo["/"]&&e?n+=String.fromCharCode(i):n+="%"+i.toString(16).padStart(2,"0").toUpperCase();return n}function GM(t,e,r,n,i){let s=n.reduce((u,c)=>{let l=`${r.get(c)}`.replace(/ +/g," ");return u.push(`${c.toLowerCase()}:${l}`),u},[]),o=e.split("?")[0],a=e.split("?")[1];return a?a=a.split("&").map(u=>{let[c,l]=u.split("=",2);return lE(decodeURIComponent(c))+"="+lE(decodeURIComponent(l||""))}).sort().join("&"):a="",[t.toUpperCase(),lE(o,!0),a,s.join(`
|
|
329
329
|
`)+`
|
|
330
330
|
`,n.join(";").toLowerCase(),i].join(`
|
|
331
331
|
`)}async function KM(t,e,r){let n=await Yp(t),i=cE(r,e);return[ul,ao(e),i,n].join(`
|
|
332
|
-
`)}async function fE(t,e,r){let n=uE(t),i=await co("AWS4"+r,n),s=await co(i,e),o=await co(s,"s3");return await co(o,"aws4_request")}function hE(t,e,r){return`${t}/${cE(e,r)}`}async function co(t,e){let r=new TextEncoder,n=await crypto.subtle.importKey("raw",t instanceof Uint8Array?t:r.encode(t),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),i=await crypto.subtle.sign("HMAC",n,e instanceof Uint8Array?e:r.encode(e));return new Uint8Array(i)}async function WM(t){if(!t.accessKey)throw new os;if(!t.secretKey)throw new nu;if(t.expirySeconds<1||t.expirySeconds>604800)throw new ol;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=hE(t.accessKey,t.region,t.date),n=ao(t.date),i={"X-Amz-Algorithm":ul,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},s=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":ul},{"X-Amz-Credential":r},{"X-Amz-Date":n}];t.conditions&&s.push(...t.conditions);for(let[f,m]of Object.entries(t.fields||{}))["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(f)||s.push({[f]:m});let o={expiration:e.toISOString(),conditions:s},a=new TextEncoder().encode(JSON.stringify(o)),u=btoa(String.fromCharCode(...a));i.policy=u;let c=u,l=await fE(t.date,t.region,t.secretKey),h=al(await co(l,c)).toLowerCase();return i["X-Amz-Signature"]=h,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:i}}var Qle=["Content-Type","Cache-Control","Content-Disposition","Content-Encoding","Content-Language","Expires","x-amz-checksum-sha256","x-amz-grant-full-control","x-amz-grant-read","x-amz-grant-read-acp","x-amz-grant-write-acp","x-amz-server-side-encryption","x-amz-storage-class","x-amz-website-redirect-location","x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5","x-amz-server-side-encryption-aws-kms-key-id","x-amz-server-side-encryption-context","x-amz-server-side-encryption-bucket-key-enabled","x-amz-request-payer","x-amz-tagging","x-amz-object-lock-mode","x-amz-object-lock-retain-until-date","x-amz-object-lock-legal-hold","x-amz-expected-bucket-owner"],efe=5*1024*1024,tfe=5*1024*1024*1024,dE=5*1024*1024*1024*1024,cl=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:e,useSSL:r,port:n,pathPrefix:i,...s}){if(/^https?:\/\//i.test(e)){if(r!==void 0||n!==void 0||i!==void 0)throw new Yt("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let a=new URL(e);e=a.hostname,r=a.protocol==="https:",n=a.port?parseInt(a.port,10):r?443:80,a.pathname&&a.pathname!=="/"&&(i=a.pathname.endsWith("/")?a.pathname.slice(0,-1):a.pathname)}catch{throw new sl(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new sl(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!qM(n))throw new Yt(`Invalid port: ${n}`);if(s.accessKey&&!s.secretKey)throw new Yt("If specifying access key, secret key must also be provided.");if(s.accessKey&&s.accessKey.startsWith("ASIA")&&!s.sessionToken)throw new Yt("If specifying temporary access key, session token must also be provided.");let o=r?443:80;if(this.port=n??o,this.host=e.toLowerCase()+(this.port!==o?`:${this.port}`:""),this.protocol=r?"https:":"http:",this.accessKey=s.accessKey,this.#e=s.secretKey??"",this.sessionToken=s.sessionToken,this.pathStyle=s.pathStyle??!0,this.pathPrefix=i??"",this.defaultBucket=s.bucket,this.region=s.region,this.pathPrefix){if(!this.pathStyle)throw new Yt("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new Yt("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new Yt("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!UM(r))throw new Xp(r??"");return r}buildRequestOptions(e){let r=this.getBucketName(e),n=this.pathStyle?this.host:`${r}.${this.host}`,i=e.headers??new Headers;i.set("host",n);let s=typeof e.query=="object"?new URLSearchParams(e.query).toString().replace("+","%20"):e.query,o=this.pathStyle?`${this.pathPrefix}/${r}/${e.objectName}`:`/${e.objectName}`,a=s?`?${s}`:"",u=o+a,c=o.split("/").map(l=>encodeURIComponent(l)).join("/")+a;return{headers:i,host:n,path:u,encodedPath:c}}async makeRequest({method:e,payload:r,...n}){let i=new Date,{headers:s,host:o,path:a,encodedPath:u}=this.buildRequestOptions(n),c=n.statusCode??200;if(e==="POST"||e==="PUT"||e==="DELETE")r===void 0?r=new Uint8Array:typeof r=="string"&&(r=new TextEncoder().encode(r)),s.set("Content-Length",String(r.length));else if(r)throw new Error(`Unexpected payload on ${e} request.`);let l=await Yp(r??new Uint8Array);s.set("x-amz-date",ao(i)),s.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&s.set("x-amz-security-token",this.sessionToken),s.set("authorization",await HM({headers:s,method:e,path:a,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:i})));let h=`${this.protocol}//${o}${u}`,d=await fetch(h,{method:e,headers:s,body:r});if(d.status!==c)throw d.status>=400?await MM(d):d.status===301?new gi(d.status,"UnexpectedRedirect",'The server unexpectedly returned a redirect response. With AWS S3, this usually means you need to use a region-specific endpoint like "s3.us-west-2.amazonaws.com" instead of "s3.amazonaws.com"'):new gi(d.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${d.status} ${d.statusText}).`);return n.returnBody||await d.body?.getReader().read(),d}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!as(e))throw new jn(e);let i=r.versionId?{versionId:r.versionId}:{},s=new Headers;r.governanceBypass&&s.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:n,objectName:e,headers:s,query:i,statusCode:204})}async exists(e,r){try{return await this.statObject(e,r),!0}catch(n){if(n instanceof gi&&n.statusCode===404)return!1;throw n}}getObject(e,r){return this.getPartialObject(e,{...r,offset:0,length:0})}async getPartialObject(e,{offset:r,length:n,...i}){let s=this.getBucketName(i);if(!as(e))throw new jn(e);let o=new Headers(Object.entries(i.metadata??{})),a=200;if(r||n){let c="";r?c=`bytes=${+r}-`:(c="bytes=0-",r=0),n&&(c+=`${+n+r-1}`),o.set("Range",c),a=206}let u={...i.responseParams,...i.versionId?{versionId:i.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:s,objectName:e,headers:o,query:u,statusCode:a,returnBody:!0})}getPresignedUrl(e,r,n={}){if(!this.accessKey)throw new os;if(!as(r))throw new jn(r);let{headers:i,path:s}=this.buildRequestOptions({objectName:r,bucketName:n.bucketName,query:n.parameters}),o=n.requestDate??new Date,a=n.expirySeconds??1440*60*7;return VM({protocol:this.protocol,headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,sessionToken:this.sessionToken,region:this.region,date:o,expirySeconds:a})}presignedGetObject(e,r={}){let{versionId:n,responseParams:i,...s}=r,o={...i,...n?{versionId:n}:{}};return this.getPresignedUrl("GET",e,{parameters:o,...s})}async*listObjects(e={}){for await(let r of this.listObjectsGrouped({...e,delimiter:""}))if(r.type==="Object")yield r;else throw new Error(`Unexpected result from listObjectsGrouped(): ${r}`)}async*listObjectsGrouped(e){let r=this.getBucketName(e),n="",i=e.pageSize??1e3;if(i<1||i>1e3)throw new Yt("pageSize must be between 1 and 1,000.");let s=0;for(;;){let o=e.maxResults?Math.min(i,e.maxResults-s):i;if(o===0)return;let u=await(await this.makeRequest({method:"GET",bucketName:r,objectName:"",query:{"list-type":"2",prefix:e.prefix??"",delimiter:e.delimiter,"max-keys":String(o),...n?{"continuation-token":n}:{}},returnBody:!0})).text(),c=ss(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let l=c.children.filter(f=>f.name==="CommonPrefixes").flatMap(f=>f.children),h=[];for(let f of l)h.push({type:"CommonPrefix",prefix:f.content??""}),s++;for(let f of c.children.filter(m=>m.name==="Contents"))h.push({type:"Object",key:f.children.find(m=>m.name==="Key")?.content??"",etag:oo(f.children.find(m=>m.name==="ETag")?.content??""),size:parseInt(f.children.find(m=>m.name==="Size")?.content??"",10),lastModified:new Date(f.children.find(m=>m.name==="LastModified")?.content??"invalid")}),s++;h.sort((f,m)=>{let g=f.type==="Object"?f.key:f.prefix,b=m.type==="Object"?m.key:m.prefix;return g>b?1:g<b?-1:0});for(let f of h)yield f;if(c.children.find(f=>f.name==="IsTruncated")?.content==="true"){let f=c.children.find(m=>m.name==="NextContinuationToken")?.content;if(!f)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=f}else return}}async putObject(e,r,n){let i=this.getBucketName(n);if(!as(e))throw new jn(e);let s,o;if(typeof r=="string"){let l=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?o=ReadableStream.from([l]):o=new ReadableStream({start(h){h.enqueue(l),h.close()}}),s=l.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?o=ReadableStream.from([r]):o=new ReadableStream({start(l){l.enqueue(r),l.close()}}),s=r.byteLength;else if(r instanceof ReadableStream)o=r;else throw new Yt("Invalid stream/data type provided.");if(n?.size!==void 0){if(s!==void 0&&n?.size!==s)throw new Yt(`size was specified (${n.size}) but doesn't match auto-detected size (${s}).`);if(typeof n.size!="number"||n.size<0||isNaN(n.size))throw new Yt(`invalid size specified: ${n.size}`);s=n.size}let a=n?.partSize??this.calculatePartSize(s);if(a<efe)throw new Yt("Part size should be greater than 5MB");if(a>tfe)throw new Yt("Part size should be less than 6MB");let u=new Wp(a),c=new Jp({client:this,bucketName:i,objectName:e,partSize:a,metadata:n?.metadata??{}});return await o.pipeThrough(u).pipeTo(c),c.getResult()}calculatePartSize(e){if(e===void 0&&(e=dE),e>dE)throw new TypeError(`size should not be more than ${dE}`);let r=64*1024*1024;for(;;){if(r*1e4>e)return r;r+=16*1024*1024}}async statObject(e,r){let n=this.getBucketName(r);if(!as(e))throw new jn(e);let i={};r?.versionId&&(i.versionId=r.versionId);let s=await this.makeRequest({method:"HEAD",bucketName:n,objectName:e,query:i,headers:new Headers(r?.headers)}),o={};for(let a of Qle)s.headers.has(a)&&(o[a]=s.headers.get(a));return s.headers.forEach((a,u)=>{u.startsWith("x-amz-meta-")&&(o[u]=s.headers.get(u))}),{type:"Object",key:e,size:parseInt(s.headers.get("content-length")??"",10),metadata:o,lastModified:new Date(s.headers.get("Last-Modified")??"error: missing last modified"),versionId:s.headers.get("x-amz-version-id")||null,etag:oo(s.headers.get("ETag")??"")}}async copyObject(e,r,n){let i=this.getBucketName(n),s=e.sourceBucketName??i;if(!as(r))throw new jn(r);let o=`${s}/${e.sourceKey}`;e.sourceVersionId&&(o+=`?versionId=${e.sourceVersionId}`);let a=new Headers(n?.metadata);n?.metadata!==void 0&&a.set("x-amz-metadata-directive","REPLACE"),a.set("x-amz-copy-source",o);let u=await this.makeRequest({method:"PUT",bucketName:i,objectName:r,headers:a,returnBody:!0}),c=await u.text(),l=ss(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let h=l.children.find(f=>f.name==="ETag")?.content??"",d=l.children.find(f=>f.name==="LastModified")?.content;if(d===void 0)throw new Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:u.headers.get("x-amz-copy-source-version-id")||null,etag:oo(h),lastModified:new Date(d),versionId:u.headers.get("x-amz-version-id")||null}}async bucketExists(e){try{return await this.listObjects({bucketName:e}).next(),!0}catch(r){if(r instanceof gi&&r.statusCode===404)return!1;throw r}}async makeBucket(e){await this.makeRequest({method:"PUT",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:200})}async removeBucket(e){await this.makeRequest({method:"DELETE",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:204})}presignedPostObject(e,r={}){if(!as(e))throw new jn(e);let n=this.getBucketName(r);if(!n)throw new Error("Bucket name is required for presignedPost, but none was provided either to this method nor to the client constructor");let i=r.requestDate||new Date,s=r.expirySeconds??3600;return WM({protocol:this.protocol,host:this.host,bucket:n,objectKey:e,accessKey:this.accessKey||"",secretKey:this.#e||"",region:this.region,date:i,expirySeconds:s,conditions:r.conditions,fields:r.fields})}};var lo=require("node:fs"),Zp=require("node:path");function rfe(t,e){return(0,lo.readFileSync)(t,"utf8").includes(e)}function ll(t,e){let r=(0,lo.readdirSync)(t);for(let n of r){let i=(0,Zp.join)(t,n),s=(0,lo.statSync)(i);if(s.isDirectory()){if(ll(i,e))return!0}else if(s.isFile()&&(0,Zp.extname)(i)===".js"&&rfe(i,e))return!0}return!1}function Qp(t){return(0,lo.readdirSync)(t).indexOf("index.html")>-1}var ou=require("node:fs"),n6=require("node:os"),po=require("node:path"),i6=require("node:process"),am=require("node:stream/consumers"),s6=require("node:zlib");var o6=Oe(r6()),a6=Oe(a0());async function yhe(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var Dhe=8192,u6="6.25.0",c6="7.0.35";async function whe(t){let e=Xr((0,i6.cwd)()),r=await no("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?Ct(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let i=n.major===6&&Ei(n,Ct(u6)),s=n.major>=7&&Ei(n,Ct(c6)),o=i||s;return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:o}}function bhe(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:o6.isMatch(t,r)}async function vhe(t,e,r){let i=(0,ou.statSync)(t).size,s=await(0,am.buffer)((0,ou.createReadStream)(t));if(i===0)return{buffer:s,useBrotli:!1};if(bhe(e,r.noBrotliPatterns))return{buffer:s,useBrotli:!1};if(i<Dhe)return{buffer:s,useBrotli:!1};try{let o=await(0,am.buffer)((0,ou.createReadStream)(t).pipe((0,s6.createBrotliCompress)({})));return o.length>=i-10?{buffer:s,useBrotli:!1}:{buffer:o,useBrotli:!0}}catch(o){return D.warn(`Brotli compression failed for ${t}: ${o}, using original file`),{buffer:s,useBrotli:!1}}}async function l6(t,e,r,n,i,s){let o=Ft();o.start(i!=="v2"?"Generating the update manifest":"Generating the update manifest with v2 encryption");let a=await Z8(t);if(i==="v2")for(let u of a)u.hash=ru(u.hash,s);return o.stop("Manifest generated successfully"),await Ae(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),a}function Ehe(t){return(0,n6.platform)()!=="win32"?t:po.win32.normalize(t).split(po.win32.sep).join(po.posix.sep)}function _he(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&D.warn(`File "${t}" contains spaces in its name.`),e}async function f6(t,e,r,n,i,s,o){let a=Ft();a.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await wn(),l=!!(o.partial||o.delta||o.partialOnly||o.deltaOnly),{version:h,supportsBrotliV2:d}=await whe(o);if(d)o.disableBrotli?D.info("Brotli compression disabled by user request"):o.noBrotliPatterns&&D.info(`Files matching patterns (${o.noBrotliPatterns}) will be excluded from brotli compression`);else throw new Error(`Your project is using an older version of @capgo/capacitor-updater (${h||"unknown"}). To use Delta updates, please upgrade to version ${u6} (v6) or ${c6} (v7) or higher.`);let f=e.filter(S=>S.file.includes(" "));if(f.length>0)throw new Error(`Files with spaces in their names (${f.map(S=>S.file).join(", ")}). Please rename the files.`);let m=0,g=e.length,b=0;try{a.message(`Uploading ${g} files using TUS protocol`);let S=async _=>{let P=(0,po.join)(r,_.file),E=Ehe(_.file),R,k=!1;if(o.disableBrotli)R=await(0,am.buffer)((0,ou.createReadStream)(P)),k=!1;else{let L=await vhe(P,E,o);R=L.buffer,k=L.useBrotli}let F=R;s&&(F=tu(R,s.sessionKey,s.ivSessionKey));let j=E;k&&(j=`${E}.br`,b++);let U=_he(j),G=`orgs/${i}/apps/${n}/delta/${_.hash}_${U}`;return await yhe(c,G)?(m++,Promise.resolve({file_name:U,s3_path:G,file_hash:_.hash})):new Promise((L,C)=>{a.message(`Prepare upload partial file: ${E}`),new a6.Upload(F,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:o.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:G},headers:{Authorization:t},onError:I=>{let $=I.toString(),M;try{let K=$.match(/response text: (\{.*?\})/);K&&K[1]&&(M=JSON.parse(K[1]).moreInfo?.requestId)}catch{}let B=M?` [requestId: ${M}]`:"";D.error(`Failed to upload ${E}: ${$}${B}`),C(I)},onProgress(){let I=(m/g*100).toFixed(2);a.message(`Uploading partial update: ${I}%`)},onSuccess(){m++,L({file_name:U,s3_path:G,file_hash:_.hash})}}).start()})},A=500,p=[];for(let _=0;_<e.length;_+=A){let P=e.slice(_,_+A),E=Math.floor(_/A)+1,R=Math.ceil(e.length/A);R>1&&a.message(`Processing batch ${E}/${R} (${P.length} files)`);let k=await Promise.all(P.map(F=>S(F)));p.push(...k)}let w=((performance.now()-u)/1e3).toFixed(2);return a.stop(`Partial update uploaded successfully \u{1F4AA} in (${w} seconds)`),b>0&&D.info(`${b} of ${g} files were compressed with brotli and use .br extension`),await Ae(t,{channel:"app",event:`App Partial TUS done${b>0?" with .br extension":""}`,icon:"\u23EB",user_id:i,tags:{"app-id":n},notify:!1}),await Ae(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":n,time:w},notify:!1}),p}catch(S){let p=((performance.now()-u)/1e3).toFixed(2);if(a.stop(`Failed to upload Partial bundle (after ${p} seconds)`),l)throw D.error(`Error uploading partial update: ${S}`),D.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),S;return D.info(`Error uploading partial update: ${S}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function Dt(t){throw D.error(t),new Error(t)}async function Che(t,e){let r=rs("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,h6.randomUUID)().split("-")[0]}`;return Xa.test(n)||Dt(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function She(t){let e=t.apikey||te();return e||Dt("Missing API key, you need to provide an API key to upload your bundle"),e}function Ahe(t,e,r){let n=ke(t,r),i=e.path||r?.webDir;return n||Dt("Missing argument, you need to provide a appid or be in a capacitor project"),i||Dt("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,mo.existsSync)(i)||Dt(`Path ${i} does not exist, build your app first, or provide a valid path`),{appid:n,path:i}}function Ohe(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(ll(e,"notifyAppReady")||Dt(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
|
|
333
|
-
If you are sure your app has this code, you can use the --no-code-check option`),Qp(e)||Dt(`index.html is missing in the root folder of ${e}`))}async function
|
|
332
|
+
`)}async function fE(t,e,r){let n=uE(t),i=await co("AWS4"+r,n),s=await co(i,e),o=await co(s,"s3");return await co(o,"aws4_request")}function hE(t,e,r){return`${t}/${cE(e,r)}`}async function co(t,e){let r=new TextEncoder,n=await crypto.subtle.importKey("raw",t instanceof Uint8Array?t:r.encode(t),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),i=await crypto.subtle.sign("HMAC",n,e instanceof Uint8Array?e:r.encode(e));return new Uint8Array(i)}async function WM(t){if(!t.accessKey)throw new os;if(!t.secretKey)throw new nu;if(t.expirySeconds<1||t.expirySeconds>604800)throw new ol;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=hE(t.accessKey,t.region,t.date),n=ao(t.date),i={"X-Amz-Algorithm":ul,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},s=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":ul},{"X-Amz-Credential":r},{"X-Amz-Date":n}];t.conditions&&s.push(...t.conditions);for(let[f,m]of Object.entries(t.fields||{}))["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(f)||s.push({[f]:m});let o={expiration:e.toISOString(),conditions:s},a=new TextEncoder().encode(JSON.stringify(o)),u=btoa(String.fromCharCode(...a));i.policy=u;let c=u,l=await fE(t.date,t.region,t.secretKey),h=al(await co(l,c)).toLowerCase();return i["X-Amz-Signature"]=h,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:i}}var efe=["Content-Type","Cache-Control","Content-Disposition","Content-Encoding","Content-Language","Expires","x-amz-checksum-sha256","x-amz-grant-full-control","x-amz-grant-read","x-amz-grant-read-acp","x-amz-grant-write-acp","x-amz-server-side-encryption","x-amz-storage-class","x-amz-website-redirect-location","x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5","x-amz-server-side-encryption-aws-kms-key-id","x-amz-server-side-encryption-context","x-amz-server-side-encryption-bucket-key-enabled","x-amz-request-payer","x-amz-tagging","x-amz-object-lock-mode","x-amz-object-lock-retain-until-date","x-amz-object-lock-legal-hold","x-amz-expected-bucket-owner"],tfe=5*1024*1024,rfe=5*1024*1024*1024,dE=5*1024*1024*1024*1024,cl=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:e,useSSL:r,port:n,pathPrefix:i,...s}){if(/^https?:\/\//i.test(e)){if(r!==void 0||n!==void 0||i!==void 0)throw new Yt("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let a=new URL(e);e=a.hostname,r=a.protocol==="https:",n=a.port?parseInt(a.port,10):r?443:80,a.pathname&&a.pathname!=="/"&&(i=a.pathname.endsWith("/")?a.pathname.slice(0,-1):a.pathname)}catch{throw new sl(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new sl(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!qM(n))throw new Yt(`Invalid port: ${n}`);if(s.accessKey&&!s.secretKey)throw new Yt("If specifying access key, secret key must also be provided.");if(s.accessKey&&s.accessKey.startsWith("ASIA")&&!s.sessionToken)throw new Yt("If specifying temporary access key, session token must also be provided.");let o=r?443:80;if(this.port=n??o,this.host=e.toLowerCase()+(this.port!==o?`:${this.port}`:""),this.protocol=r?"https:":"http:",this.accessKey=s.accessKey,this.#e=s.secretKey??"",this.sessionToken=s.sessionToken,this.pathStyle=s.pathStyle??!0,this.pathPrefix=i??"",this.defaultBucket=s.bucket,this.region=s.region,this.pathPrefix){if(!this.pathStyle)throw new Yt("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new Yt("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new Yt("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!UM(r))throw new Xp(r??"");return r}buildRequestOptions(e){let r=this.getBucketName(e),n=this.pathStyle?this.host:`${r}.${this.host}`,i=e.headers??new Headers;i.set("host",n);let s=typeof e.query=="object"?new URLSearchParams(e.query).toString().replace("+","%20"):e.query,o=this.pathStyle?`${this.pathPrefix}/${r}/${e.objectName}`:`/${e.objectName}`,a=s?`?${s}`:"",u=o+a,c=o.split("/").map(l=>encodeURIComponent(l)).join("/")+a;return{headers:i,host:n,path:u,encodedPath:c}}async makeRequest({method:e,payload:r,...n}){let i=new Date,{headers:s,host:o,path:a,encodedPath:u}=this.buildRequestOptions(n),c=n.statusCode??200;if(e==="POST"||e==="PUT"||e==="DELETE")r===void 0?r=new Uint8Array:typeof r=="string"&&(r=new TextEncoder().encode(r)),s.set("Content-Length",String(r.length));else if(r)throw new Error(`Unexpected payload on ${e} request.`);let l=await Yp(r??new Uint8Array);s.set("x-amz-date",ao(i)),s.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&s.set("x-amz-security-token",this.sessionToken),s.set("authorization",await HM({headers:s,method:e,path:a,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:i})));let h=`${this.protocol}//${o}${u}`,d=await fetch(h,{method:e,headers:s,body:r});if(d.status!==c)throw d.status>=400?await MM(d):d.status===301?new gi(d.status,"UnexpectedRedirect",'The server unexpectedly returned a redirect response. With AWS S3, this usually means you need to use a region-specific endpoint like "s3.us-west-2.amazonaws.com" instead of "s3.amazonaws.com"'):new gi(d.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${d.status} ${d.statusText}).`);return n.returnBody||await d.body?.getReader().read(),d}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!as(e))throw new jn(e);let i=r.versionId?{versionId:r.versionId}:{},s=new Headers;r.governanceBypass&&s.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:n,objectName:e,headers:s,query:i,statusCode:204})}async exists(e,r){try{return await this.statObject(e,r),!0}catch(n){if(n instanceof gi&&n.statusCode===404)return!1;throw n}}getObject(e,r){return this.getPartialObject(e,{...r,offset:0,length:0})}async getPartialObject(e,{offset:r,length:n,...i}){let s=this.getBucketName(i);if(!as(e))throw new jn(e);let o=new Headers(Object.entries(i.metadata??{})),a=200;if(r||n){let c="";r?c=`bytes=${+r}-`:(c="bytes=0-",r=0),n&&(c+=`${+n+r-1}`),o.set("Range",c),a=206}let u={...i.responseParams,...i.versionId?{versionId:i.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:s,objectName:e,headers:o,query:u,statusCode:a,returnBody:!0})}getPresignedUrl(e,r,n={}){if(!this.accessKey)throw new os;if(!as(r))throw new jn(r);let{headers:i,path:s}=this.buildRequestOptions({objectName:r,bucketName:n.bucketName,query:n.parameters}),o=n.requestDate??new Date,a=n.expirySeconds??1440*60*7;return VM({protocol:this.protocol,headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,sessionToken:this.sessionToken,region:this.region,date:o,expirySeconds:a})}presignedGetObject(e,r={}){let{versionId:n,responseParams:i,...s}=r,o={...i,...n?{versionId:n}:{}};return this.getPresignedUrl("GET",e,{parameters:o,...s})}async*listObjects(e={}){for await(let r of this.listObjectsGrouped({...e,delimiter:""}))if(r.type==="Object")yield r;else throw new Error(`Unexpected result from listObjectsGrouped(): ${r}`)}async*listObjectsGrouped(e){let r=this.getBucketName(e),n="",i=e.pageSize??1e3;if(i<1||i>1e3)throw new Yt("pageSize must be between 1 and 1,000.");let s=0;for(;;){let o=e.maxResults?Math.min(i,e.maxResults-s):i;if(o===0)return;let u=await(await this.makeRequest({method:"GET",bucketName:r,objectName:"",query:{"list-type":"2",prefix:e.prefix??"",delimiter:e.delimiter,"max-keys":String(o),...n?{"continuation-token":n}:{}},returnBody:!0})).text(),c=ss(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let l=c.children.filter(f=>f.name==="CommonPrefixes").flatMap(f=>f.children),h=[];for(let f of l)h.push({type:"CommonPrefix",prefix:f.content??""}),s++;for(let f of c.children.filter(m=>m.name==="Contents"))h.push({type:"Object",key:f.children.find(m=>m.name==="Key")?.content??"",etag:oo(f.children.find(m=>m.name==="ETag")?.content??""),size:parseInt(f.children.find(m=>m.name==="Size")?.content??"",10),lastModified:new Date(f.children.find(m=>m.name==="LastModified")?.content??"invalid")}),s++;h.sort((f,m)=>{let g=f.type==="Object"?f.key:f.prefix,b=m.type==="Object"?m.key:m.prefix;return g>b?1:g<b?-1:0});for(let f of h)yield f;if(c.children.find(f=>f.name==="IsTruncated")?.content==="true"){let f=c.children.find(m=>m.name==="NextContinuationToken")?.content;if(!f)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=f}else return}}async putObject(e,r,n){let i=this.getBucketName(n);if(!as(e))throw new jn(e);let s,o;if(typeof r=="string"){let l=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?o=ReadableStream.from([l]):o=new ReadableStream({start(h){h.enqueue(l),h.close()}}),s=l.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?o=ReadableStream.from([r]):o=new ReadableStream({start(l){l.enqueue(r),l.close()}}),s=r.byteLength;else if(r instanceof ReadableStream)o=r;else throw new Yt("Invalid stream/data type provided.");if(n?.size!==void 0){if(s!==void 0&&n?.size!==s)throw new Yt(`size was specified (${n.size}) but doesn't match auto-detected size (${s}).`);if(typeof n.size!="number"||n.size<0||isNaN(n.size))throw new Yt(`invalid size specified: ${n.size}`);s=n.size}let a=n?.partSize??this.calculatePartSize(s);if(a<tfe)throw new Yt("Part size should be greater than 5MB");if(a>rfe)throw new Yt("Part size should be less than 6MB");let u=new Wp(a),c=new Jp({client:this,bucketName:i,objectName:e,partSize:a,metadata:n?.metadata??{}});return await o.pipeThrough(u).pipeTo(c),c.getResult()}calculatePartSize(e){if(e===void 0&&(e=dE),e>dE)throw new TypeError(`size should not be more than ${dE}`);let r=64*1024*1024;for(;;){if(r*1e4>e)return r;r+=16*1024*1024}}async statObject(e,r){let n=this.getBucketName(r);if(!as(e))throw new jn(e);let i={};r?.versionId&&(i.versionId=r.versionId);let s=await this.makeRequest({method:"HEAD",bucketName:n,objectName:e,query:i,headers:new Headers(r?.headers)}),o={};for(let a of efe)s.headers.has(a)&&(o[a]=s.headers.get(a));return s.headers.forEach((a,u)=>{u.startsWith("x-amz-meta-")&&(o[u]=s.headers.get(u))}),{type:"Object",key:e,size:parseInt(s.headers.get("content-length")??"",10),metadata:o,lastModified:new Date(s.headers.get("Last-Modified")??"error: missing last modified"),versionId:s.headers.get("x-amz-version-id")||null,etag:oo(s.headers.get("ETag")??"")}}async copyObject(e,r,n){let i=this.getBucketName(n),s=e.sourceBucketName??i;if(!as(r))throw new jn(r);let o=`${s}/${e.sourceKey}`;e.sourceVersionId&&(o+=`?versionId=${e.sourceVersionId}`);let a=new Headers(n?.metadata);n?.metadata!==void 0&&a.set("x-amz-metadata-directive","REPLACE"),a.set("x-amz-copy-source",o);let u=await this.makeRequest({method:"PUT",bucketName:i,objectName:r,headers:a,returnBody:!0}),c=await u.text(),l=ss(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let h=l.children.find(f=>f.name==="ETag")?.content??"",d=l.children.find(f=>f.name==="LastModified")?.content;if(d===void 0)throw new Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:u.headers.get("x-amz-copy-source-version-id")||null,etag:oo(h),lastModified:new Date(d),versionId:u.headers.get("x-amz-version-id")||null}}async bucketExists(e){try{return await this.listObjects({bucketName:e}).next(),!0}catch(r){if(r instanceof gi&&r.statusCode===404)return!1;throw r}}async makeBucket(e){await this.makeRequest({method:"PUT",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:200})}async removeBucket(e){await this.makeRequest({method:"DELETE",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:204})}presignedPostObject(e,r={}){if(!as(e))throw new jn(e);let n=this.getBucketName(r);if(!n)throw new Error("Bucket name is required for presignedPost, but none was provided either to this method nor to the client constructor");let i=r.requestDate||new Date,s=r.expirySeconds??3600;return WM({protocol:this.protocol,host:this.host,bucket:n,objectKey:e,accessKey:this.accessKey||"",secretKey:this.#e||"",region:this.region,date:i,expirySeconds:s,conditions:r.conditions,fields:r.fields})}};var lo=require("node:fs"),Zp=require("node:path");function nfe(t,e){return(0,lo.readFileSync)(t,"utf8").includes(e)}function ll(t,e){let r=(0,lo.readdirSync)(t);for(let n of r){let i=(0,Zp.join)(t,n),s=(0,lo.statSync)(i);if(s.isDirectory()){if(ll(i,e))return!0}else if(s.isFile()&&(0,Zp.extname)(i)===".js"&&nfe(i,e))return!0}return!1}function Qp(t){return(0,lo.readdirSync)(t).indexOf("index.html")>-1}var ou=require("node:fs"),n6=require("node:os"),po=require("node:path"),i6=require("node:process"),am=require("node:stream/consumers"),s6=require("node:zlib");var o6=Oe(r6()),a6=Oe(a0());async function Dhe(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var whe=8192,u6="6.25.0",c6="7.0.35";async function bhe(t){let e=Xr((0,i6.cwd)()),r=await no("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?Ct(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let i=n.major===6&&Ei(n,Ct(u6)),s=n.major>=7&&Ei(n,Ct(c6)),o=i||s;return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:o}}function vhe(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:o6.isMatch(t,r)}async function Ehe(t,e,r){let i=(0,ou.statSync)(t).size,s=await(0,am.buffer)((0,ou.createReadStream)(t));if(i===0)return{buffer:s,useBrotli:!1};if(vhe(e,r.noBrotliPatterns))return{buffer:s,useBrotli:!1};if(i<whe)return{buffer:s,useBrotli:!1};try{let o=await(0,am.buffer)((0,ou.createReadStream)(t).pipe((0,s6.createBrotliCompress)({})));return o.length>=i-10?{buffer:s,useBrotli:!1}:{buffer:o,useBrotli:!0}}catch(o){return y.warn(`Brotli compression failed for ${t}: ${o}, using original file`),{buffer:s,useBrotli:!1}}}async function l6(t,e,r,n,i,s){let o=Ft();o.start(i!=="v2"?"Generating the update manifest":"Generating the update manifest with v2 encryption");let a=await Z8(t);if(i==="v2")for(let u of a)u.hash=ru(u.hash,s);return o.stop("Manifest generated successfully"),await Ae(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),a}function _he(t){return(0,n6.platform)()!=="win32"?t:po.win32.normalize(t).split(po.win32.sep).join(po.posix.sep)}function Che(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&y.warn(`File "${t}" contains spaces in its name.`),e}async function f6(t,e,r,n,i,s,o){let a=Ft();a.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await wn(),l=!!(o.partial||o.delta||o.partialOnly||o.deltaOnly),{version:h,supportsBrotliV2:d}=await bhe(o);if(d)o.disableBrotli?y.info("Brotli compression disabled by user request"):o.noBrotliPatterns&&y.info(`Files matching patterns (${o.noBrotliPatterns}) will be excluded from brotli compression`);else throw new Error(`Your project is using an older version of @capgo/capacitor-updater (${h||"unknown"}). To use Delta updates, please upgrade to version ${u6} (v6) or ${c6} (v7) or higher.`);let f=e.filter(S=>S.file.includes(" "));if(f.length>0)throw new Error(`Files with spaces in their names (${f.map(S=>S.file).join(", ")}). Please rename the files.`);let m=0,g=e.length,b=0;try{a.message(`Uploading ${g} files using TUS protocol`);let S=async _=>{let P=(0,po.join)(r,_.file),E=_he(_.file),R,k=!1;if(o.disableBrotli)R=await(0,am.buffer)((0,ou.createReadStream)(P)),k=!1;else{let L=await Ehe(P,E,o);R=L.buffer,k=L.useBrotli}let F=R;s&&(F=tu(R,s.sessionKey,s.ivSessionKey));let j=E;k&&(j=`${E}.br`,b++);let U=Che(j),G=`orgs/${i}/apps/${n}/delta/${_.hash}_${U}`;return await Dhe(c,G)?(m++,Promise.resolve({file_name:U,s3_path:G,file_hash:_.hash})):new Promise((L,C)=>{a.message(`Prepare upload partial file: ${E}`),new a6.Upload(F,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:o.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:G},headers:{Authorization:t},onError:I=>{let $=I.toString(),M;try{let K=$.match(/response text: (\{.*?\})/);K&&K[1]&&(M=JSON.parse(K[1]).moreInfo?.requestId)}catch{}let B=M?` [requestId: ${M}]`:"";y.error(`Failed to upload ${E}: ${$}${B}`),C(I)},onProgress(){let I=(m/g*100).toFixed(2);a.message(`Uploading partial update: ${I}%`)},onSuccess(){m++,L({file_name:U,s3_path:G,file_hash:_.hash})}}).start()})},A=500,p=[];for(let _=0;_<e.length;_+=A){let P=e.slice(_,_+A),E=Math.floor(_/A)+1,R=Math.ceil(e.length/A);R>1&&a.message(`Processing batch ${E}/${R} (${P.length} files)`);let k=await Promise.all(P.map(F=>S(F)));p.push(...k)}let w=((performance.now()-u)/1e3).toFixed(2);return a.stop(`Partial update uploaded successfully \u{1F4AA} in (${w} seconds)`),b>0&&y.info(`${b} of ${g} files were compressed with brotli and use .br extension`),await Ae(t,{channel:"app",event:`App Partial TUS done${b>0?" with .br extension":""}`,icon:"\u23EB",user_id:i,tags:{"app-id":n},notify:!1}),await Ae(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":n,time:w},notify:!1}),p}catch(S){let p=((performance.now()-u)/1e3).toFixed(2);if(a.stop(`Failed to upload Partial bundle (after ${p} seconds)`),l)throw y.error(`Error uploading partial update: ${S}`),y.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),S;return y.info(`Error uploading partial update: ${S}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function Dt(t){throw y.error(t),new Error(t)}async function She(t,e){let r=rs("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,h6.randomUUID)().split("-")[0]}`;return Xa.test(n)||Dt(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function Ahe(t){let e=t.apikey||te();return e||Dt("Missing API key, you need to provide an API key to upload your bundle"),e}function Ohe(t,e,r){let n=ke(t,r),i=e.path||r?.webDir;return n||Dt("Missing argument, you need to provide a appid or be in a capacitor project"),i||Dt("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,mo.existsSync)(i)||Dt(`Path ${i} does not exist, build your app first, or provide a valid path`),{appid:n,path:i}}function xhe(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(ll(e,"notifyAppReady")||Dt(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
|
|
333
|
+
If you are sure your app has this code, you can use the --no-code-check option`),Qp(e)||Dt(`index.html is missing in the root folder of ${e}`))}async function The(t,e,r,n,i,s){let o=r.ignoreMetadataCheck,a=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:c,error:l}=await t.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",n).eq("app_id",i).single(),h=!!c&&c.disable_auto_update==="version_number",d,f;if(!l&&c&&c.version&&c.version.native_packages&&!o){let b=Ft();b.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:S,localDependencies:A}=await qp(t,i,n,r.packageJson,r.nodeModules);if(f=S,d=A,f.find(p=>!io(p)))b.stop(`Bundle NOT compatible with ${n} channel`),y.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),a&&(u=s,y.info(`Auto set min-update-version to ${u}`));else if(a)try{let{min_update_version:p}=c.version;(!p||!Xa.test(p))&&Dt("Invalid remote min update version, skipping auto setting compatibility"),u=p,b.stop(`Auto set min-update-version to ${u}`)}catch{Dt(`Cannot auto set compatibility, invalid data ${c}`)}else b.stop(`Bundle compatible with ${n} channel`)}else o||(y.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),d=await tE(r.packageJson,r.nodeModules),a&&(u=s,y.info(`Auto set min-update-version to ${u}`)));h&&!u&&!o&&Dt("You need to provide a min-update-version to upload a bundle to this channel"),u&&(Xa.test(u)||Dt(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=d?new Map(d.filter(b=>!!b.native&&b.native!==void 0).map(b=>[b.name,b])):new Map;return{nativePackages:m.size>0||!r.ignoreMetadataCheck?Array.from(m,([b,S])=>({name:b,version:S.version})):void 0,minUpdateVersion:u}}async function Fhe(t,e,r,n=!1){let{data:i,error:s}=await t.rpc("exist_app_versions",{appid:e,name_version:r}).single();if(i||s){if(n)return y.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),ce("Bundle version already exists - exiting gracefully \u{1F389}"),!0;Dt(`Version ${r} already exists ${W(s)}`)}return!1}async function Ihe(t,e,r,n,i,s,o){let a,u,c="",l=null,h="none",d="",f=e.keyV2,m=e.key===!1,g=Ft();g.start(`Zipping bundle from ${t}`),l=await jp(t),g.message("Calculating checksum");let b=Xr((0,FE.cwd)()),S=await no("@capgo/capacitor-updater",b,e.packageJson),A=!1,p;try{p=S?Ct(S):void 0}catch{p=void 0}if(S?p?A=Ei(p,Ct("6.25.0")):(S==="link:@capgo/capacitor-updater"||S==="file:.."||S==="file:../")&&(y.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),A=!0):Dt("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(f||e.keyDataV2||(0,mo.existsSync)(Ir))&&!m||A?c=await Yn(l,"sha256"):c=await Yn(l,"crc32"),g.stop(`Checksum ${A?"SHA256":"CRC32"}: ${c}`),m)y.info("Encryption ignored");else if((f||(0,mo.existsSync)(Ir)||e.keyDataV2)&&!e.oldEncryption){let _=typeof f=="string"?f:Ir,P=e.keyDataV2||"";!P&&!(0,mo.existsSync)(_)&&Dt(`Cannot find private key ${_}`),await Ae(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":i},notify:!1},e.verbose),P||(P=(0,mo.readFileSync)(_).toString()),y.info("Encrypting your bundle with V2");let{sessionKey:E,ivSessionKey:R}=Kp(P),k=tu(l,E,R);c=ru(c,P),a=R,u=E,h="v2",d=P,e.displayIvSession&&y.info(`Your Iv Session key is ${a},
|
|
334
334
|
keep it safe, you will need it to decrypt your bundle.
|
|
335
335
|
It will be also visible in your dashboard
|
|
336
|
-
`),l=k}let
|
|
337
|
-
The bundle size is ${
|
|
338
|
-
`),
|
|
339
|
-
`),e.verbose&&(
|
|
340
|
-
Bundle uploaded \u{1F4AA} in 0 seconds`),o.verbose&&D.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let f=await wn();if(o.verbose&&D.info("[Verbose] Local config retrieved for upload"),o.multipart!==void 0&&o.multipart||o.tus!==void 0&&o.tus){o.multipart?D.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):D.info("Uploading bundle with TUS protocol"),o.verbose&&(D.info("[Verbose] Starting TUS resumable upload..."),D.info(` - Host: ${f.hostWeb}`),D.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),await Q8(t,s,i,r,n,u,f,a),l=!0,o.verbose&&D.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${i}/apps/${r}/${n}.zip`,{error:g}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(g)return D.error(`Cannot finish TUS upload ${W(g)}`),o.verbose&&D.info(`[Verbose] Database update failed: ${W(g)}`),Promise.reject(new Error("Cannot finish TUS upload"));o.verbose&&D.info(`[Verbose] Database updated with R2 path: ${m}`)}else{o.verbose&&D.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await Y8(e,r,n);if(!m)return D.error("Cannot get upload url"),o.verbose&&D.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));o.verbose&&(D.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),D.info(` - Timeout: ${o.timeout||Qv}ms`),D.info(" - Retry attempts: 5"),D.info(" - Content-Type: application/zip"));let g=new AbortController,b=setTimeout(()=>g.abort(),o.timeout||Qv);try{let S=await fetch(m,{method:"PUT",body:s,headers:{"Content-Type":"application/zip"},signal:g.signal});if(!S.ok)throw new Error(`HTTP error! status: ${S.status}`)}finally{clearTimeout(b)}o.verbose&&D.info("[Verbose] HTTP PUT upload completed successfully")}}catch(f){let g=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${g} seconds)`),o.verbose&&(D.info(`[Verbose] Upload failed after ${g} seconds`),D.info(`[Verbose] Error type: ${f instanceof Error?"Error":typeof f}`)),f instanceof Error&&f.message.includes("HTTP error"))try{let b=f.message.match(/status: (\d+)/),S=b?b[1]:"unknown";D.error(`Upload failed with status ${S}: ${f.message}`)}catch{D.error(`Upload failed: ${f.message}`)}else o.verbose&&D.info(`[Verbose] Non-HTTP error: ${W(f)}`),o.tus?D.error(`Cannot upload bundle please contact support if the issue persists ${W(f)}`):D.error(`Cannot upload bundle ( try again with --tus option) ${W(f)}`);throw o.verbose&&D.info("[Verbose] Cleaning up failed version from database..."),await eM(e,r,n),o.verbose&&D.info("[Verbose] Failed version cleaned up"),f instanceof Error?f:new Error(String(f))}let d=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${d} seconds)`),o.verbose&&(D.info("[Verbose] Upload successful:"),D.info(` - Upload time: ${d} seconds`),D.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),D.info(` - Bundle size: ${Math.floor(s.byteLength/1024)} KB`),D.info("[Verbose] Sending performance event...")),await Ae(t,{channel:"performance",event:l?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":r,time:d},notify:!1},o.verbose),o.verbose&&D.info("[Verbose] Performance event sent successfully")}async function Phe(t,e,r){let{data:n,error:i}=await t.from("channels").select("version ( id, name, deleted )").eq("app_id",e).eq("name",r);if(i){D.error(`Cannot delete linked bundle on upload ${W(i)}`);return}if(n.length===0){D.warn("No linked bundle found in the channel you are trying to upload to");return}let s=n[0].version;if(s.deleted){D.warn("The linked bundle is already deleted");return}let{error:o}=await t.from("app_versions").update({deleted:!0}).eq("id",s.id);if(o){D.error(`Cannot delete linked bundle on upload ${W(o)}`);return}D.info("Linked bundle deleted")}async function khe(t,e,r,n,i,s,o,a,u,c){let{data:l}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:a}).single();l||Dt("Cannot get version id, cannot set channel");let{data:h}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(h){let{error:d,data:f}=await Bp(t,{name:i,app_id:a,created_by:s,version:l,owner_org:o,...c?{allow_device_self_set:!0}:{}});d&&Dt(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${W(d)}`);let m=`${u.hostWeb}/app/p/${a}/channel/${f.id}`;f?.public?D.info("Your update is now available in your public channel \u{1F389}"):f?.id&&D.info(`Link device to this bundle to try it: ${m}`),r&&D.info(`Bundle url: ${m}`)}else D.warn("The upload key is not allowed to set the version in the channel")}async function Rhe(t,e,r){let{error:n,data:i}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(D.warn("Cannot find default upload channel"),D.info(`You can set it here: ${r}/app/p/${t}/settings`),null):i.default_upload_channel}async function d6(t,e,r=!1){r||oe(`Uploading with CLI version ${Pi.version}`);let n,i=$n();await ze();let{s3Region:s,s3Apikey:o,s3Apisecret:a,s3BucketName:u,s3Endpoint:c,s3Port:l,s3SSL:h}=e;e.verbose&&(D.info("[Verbose] Starting upload process with options:"),D.info(` - API key: ${e.apikey?"provided":"from saved key"}`),D.info(` - Path: ${e.path||"from capacitor config"}`),D.info(` - Channel: ${e.channel||"from default upload channel"}`),D.info(` - Bundle: ${e.bundle||"auto-detected"}`),D.info(` - External: ${e.external||"false"}`),D.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),D.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),D.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let d=She(e);e.verbose&&D.info("[Verbose] API key retrieved successfully");let f=await de();e.verbose&&D.info("[Verbose] Capacitor config loaded successfully");let m=await H8();e.verbose&&(D.info("[Verbose] Remote file config retrieved:"),D.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),D.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),D.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),D.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),D.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),D.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:g,path:b}=Ahe(t,e,f.config);e.verbose&&D.info(`[Verbose] App ID: ${g}, Build path: ${b}`);let S=await Che(f.config,e);e.verbose&&D.info(`[Verbose] Bundle version: ${S}`);let A=e.external?"external":"r2-direct",p="none";e.autoSetBundle&&(await U8({version:S}),e.verbose&&D.info("[Verbose] Auto-set bundle version in capacitor.config.json")),Ohe(e,b),e.verbose&&D.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),D.info(`Upload ${g}@${S} started from path "${b}" to Capgo cloud`);let y=await wn();e.verbose&&D.info(`[Verbose] Local config loaded: host=${y.hostWeb}`),e.supaHost&&e.supaAnon&&(D.info("Using custom supabase instance from provided options"),y.supaHost=e.supaHost,y.supaKey=e.supaAnon,e.verbose&&D.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let w=await pe(d,e.supaHost,e.supaAnon);e.verbose&&D.info("[Verbose] Supabase client created successfully");let _=await De(w,d,["write","all","upload"]);e.verbose&&D.info(`[Verbose] User verified successfully, user_id: ${_}`);let P=e.channel||await Rhe(g,w,y.hostWeb)||"dev";e.verbose&&D.info(`[Verbose] Target channel: ${P}`);let E=await sn(w,g);e.verbose&&D.info(`[Verbose] Organization ID: ${E}`),await K8(w,E,Pi.version),e.verbose&&D.info("[Verbose] Remote CLI messages checked"),await X8(w,E,d,g,!0),e.verbose&&D.info("[Verbose] Plan validation passed"),e.verbose&&D.info("[Verbose] Trial check completed"),e.verbose&&D.info(`[Verbose] Checking compatibility with channel ${P}...`);let{nativePackages:R,minUpdateVersion:k}=await xhe(w,i,e,P,g,S);e.verbose&&(D.info("[Verbose] Compatibility check completed:"),D.info(` - Native packages: ${R?R.length:0}`),D.info(` - Min update version: ${k||"none"}`)),e.verbose&&D.info(`[Verbose] Checking if version ${S} already exists...`);let F=await The(w,g,S,e.versionExistsOk);if(e.verbose&&D.info(`[Verbose] Version exists check: ${F?"yes (skipping)":"no (continuing)"}`),F)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:S,checksum:null,encryptionMethod:p,storageProvider:A};e.external&&!e.external.startsWith("https://")&&Dt(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(D.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),D.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let j={name:S,app_id:g,session_key:void 0,external_url:e.external,storage_provider:A,min_update_version:k,native_packages:R,owner_org:E,user_id:_,checksum:void 0,link:e.link||null,comment:e.comment||null},U=null,G="";if(e.external)e.verbose&&D.info(`[Verbose] Using external URL: ${e.external}`),await Ae(d,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:E,tags:{"app-id":g},notify:!1},e.verbose),j.session_key=e.ivSessionKey,j.checksum=e.encryptedChecksum,e.verbose&&(D.info("[Verbose] External bundle configured:"),D.info(` - URL: ${e.external}`),D.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),D.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&D.info(`[Verbose] Preparing bundle file from path: ${b}`);let{zipped:$,ivSessionKey:M,checksum:B,sessionKey:K,encryptionMethod:q,finalKeyData:V}=await Fhe(b,e,d,E,g,m.maxUploadLength,m.alertUploadSize);j.session_key=M,j.checksum=B,n=K,U=$,p=q,G=V,e.verbose&&(D.info("[Verbose] Bundle prepared:"),D.info(` - Size: ${Math.floor(($?.byteLength??0)/1024)} KB`),D.info(` - Checksum: ${B}`),D.info(` - Encryption: ${q}`),D.info(` - IV Session Key: ${M?"present":"none"}`)),e.ignoreChecksumCheck||(e.verbose&&D.info("[Verbose] Checking for duplicate checksum..."),await nM(w,g,P,B),e.verbose&&D.info("[Verbose] Checksum is unique"))}if(e.zip?(e.tus=!1,e.verbose&&D.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&D.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&D.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&D.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&D.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&p==="v1"&&Dt("You cannot encrypt the partial update if you are not using the v2 encryption method"),e.delta&&p==="v2"&&!e.encryptPartial){let $=Xr((0,FE.cwd)()),M=await no("@capgo/capacitor-updater",$,e.packageJson),B;try{B=M?Ct(M):void 0}catch{B=void 0}M&&B&&Ei(B,Ct("6.14.4"))&&(D.info(`Auto-enabling partial update encryption for updater version ${B} (> 6.14.4)`),e.verbose&&D.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}e.verbose&&e.delta&&D.info("[Verbose] Preparing delta/partial update manifest...");let L=e.delta?await l6(b,d,E,g,e.encryptPartial?p:"none",G):[];e.verbose&&e.delta&&D.info(`[Verbose] Delta manifest prepared with ${L.length} files`),e.verbose&&D.info("[Verbose] Creating version record in database...");let{error:C}=await eE(w,j);if(C&&Dt(`Cannot add bundle ${W(C)}`),e.verbose&&D.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(D.error(`Chunk size ${e.tusChunkSize} is greater than the maximum chunk size ${m.maxChunkSize}, using the maximum chunk size`),e.tusChunkSize=m.maxChunkSize):e.tusChunkSize||(e.tusChunkSize=m.maxChunkSize),e.verbose&&D.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),U&&(u||c||s||o||a||l||h)){(!u||!c||!s||!o||!a||!l)&&Dt("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),D.info("Uploading to S3"),e.verbose&&(D.info("[Verbose] S3 configuration:"),D.info(` - Endpoint: ${c}`),D.info(` - Region: ${s}`),D.info(` - Bucket: ${u}`),D.info(` - Port: ${l}`),D.info(` - SSL: ${h?"enabled":"disabled"}`));let $=h?`https://${c}`:`http://${c}`,M=new cl({endPoint:c,region:s,port:l,pathStyle:!0,bucket:u,accessKey:o,secretKey:a}),B=`${g}-${S}`,K=encodeURIComponent(B);e.verbose&&D.info(`[Verbose] Uploading to S3 as: ${B}`),await M.putObject(B,Uint8Array.from(U)),j.external_url=`${$}/${K}`,j.storage_provider="external",e.verbose&&D.info(`[Verbose] S3 upload complete, external URL: ${j.external_url}`)}else if(U){!e.partialOnly&&!e.deltaOnly?(e.verbose&&D.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await Ihe(d,w,g,S,E,U,e,e.tusChunkSize)):e.verbose&&D.info("[Verbose] Skipping full bundle upload (delta-only mode)");let $=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&D.info("[Verbose] Dry upload mode: skipping delta upload"));let B=j.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:j.session_key}:void 0;e.verbose&&e.delta&&(D.info("[Verbose] Starting delta/partial file upload..."),D.info(` - Manifest entries: ${L.length}`),D.info(` - Encryption: ${B?"enabled":"disabled"}`)),$=e.delta?await f6(d,L,b,g,E,B,e):null,e.verbose&&$&&D.info(`[Verbose] Delta upload complete with ${$.length} files`)}catch(B){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw B;D.info(`Failed to upload partial files to capgo cloud. Error: ${W(B)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&D.info(`[Verbose] Delta upload error details: ${W(B)}`)}j.storage_provider="r2",j.manifest=$,e.verbose&&D.info("[Verbose] Updating version record with storage provider and manifest...");let{error:M}=await eE(w,j);M&&Dt(`Cannot update bundle ${W(M)}`),e.verbose&&D.info("[Verbose] Version record updated successfully")}e.verbose&&D.info("[Verbose] Checking app permissions...");let T=await yt(w,d,g,2);e.verbose&&(D.info("[Verbose] Permissions:"),D.info(` - Upload: ${Ya(T,2)?"yes":"no"}`),D.info(` - Write: ${Ya(T,3)?"yes":"no"}`),D.info(` - Admin: ${Ya(T,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&Ya(T,3)?(e.verbose&&D.info(`[Verbose] Deleting linked bundle in channel ${P}...`),await Phe(w,g,P)):e.deleteLinkedBundleOnUpload&&D.warn("Cannot delete linked bundle on upload as a upload organization member"),Ya(T,3)?(e.verbose&&D.info(`[Verbose] Setting bundle ${S} to channel ${P}...`),await khe(w,d,!!e.bundleUrl,S,P,_,E,g,y,e.selfAssign),e.verbose&&D.info("[Verbose] Channel updated successfully")):D.warn("Cannot set channel as a upload organization member"),e.verbose&&D.info("[Verbose] Sending upload event..."),await Ae(d,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:E,tags:{"app-id":g},notify:!1},e.verbose);let I={success:!0,bundle:S,checksum:j.checksum??null,encryptionMethod:p,sessionKey:n?n.toString("base64"):void 0,ivSessionKey:typeof j.session_key=="string"?j.session_key:void 0,storageProvider:j.storage_provider};return e.verbose&&(D.info("[Verbose] Upload completed successfully:"),D.info(` - Bundle: ${I.bundle}`),D.info(` - Checksum: ${I.checksum}`),D.info(` - Encryption: ${I.encryptionMethod}`),D.info(` - Storage: ${I.storageProvider}`)),r&&!I.skipped&&ce("Time to share your update to the world \u{1F30D}"),I}var p6=require("node:crypto"),um=require("node:fs"),m6=require("node:process");var Nhe=20;function $he(t){console.log(JSON.stringify(t,null,2))}function ml(t){console.error(W(t))}async function g6(t,e,r=!1){let{json:n}=e,{bundle:i,path:s}=e,o=!n&&!r;try{o&&await ze();let a=await de(),u=ke(t,a?.config),c=(0,p6.randomUUID)().split("-")[0],l=rs("",e.packageJson);if(i=i||l||`0.0.1-beta.${c}`,o&&oe(`Zipping ${u}@${i}`),i&&!Xa.test(i)){let _=`Your bundle name ${i}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?ml({error:"invalid_semver"}):D.error(_)),new Error("Invalid bundle version format")}if(s=s||a?.config?.webDir,!u||!i||!s){let _="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?ml({error:"missing_argument"}):D.error(_)),new Error(_)}if(o&&D.info(`Started from path "${s}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!ll(s,"notifyAppReady"))throw r||(n?ml({error:"notifyAppReady_not_in_source_code"}):D.error("notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready")),new Error("notifyAppReady() is missing in build folder");if(!Qp(s))throw r||(n?ml({error:"index_html_not_found"}):D.error(`index.html is missing in the root folder of ${s}`)),new Error("index.html is missing in root folder")}let d=await jp(s);o&&D.info(`Zipped ${d.byteLength} bytes`);let f=o?Ft():null;f&&f.start("Calculating checksum");let m=Xr((0,m6.cwd)()),g=await no("@capgo/capacitor-updater",m,e.packageJson);if(!g){let _="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||D.warn(_),new Error(_)}let b=!1,S;try{S=g?Ct(g):void 0}catch{S=void 0}if(S){let _=S.major===6&&Ei(S,Ct("6.25.0")),P=S.major>=7;b=_||P}else g==="link:@capgo/capacitor-updater"&&(r||D.warn("Using local @capgo/capacitor-updater. Assuming v7"),b=!0);let A=await Yn(d,e.keyV2||(0,um.existsSync)(Ir)||b?"sha256":"crc32");f&&f.stop(`Checksum ${b?"SHA256":"CRC32"}: ${A}`);let p=Math.floor(d.byteLength/1024/1024);p>Nhe&&o&&(D.warn(`WARNING !!
|
|
336
|
+
`),l=k}let D=Math.floor((l?.byteLength??0)/1024/1024),w=Math.floor(s/1024/1024);return l?.byteLength>s?Dt(`The bundle size is ${D} Mb, this is greater than the maximum upload length ${w} Mb, please reduce the size of your bundle`):l?.byteLength>o?(y.warn(`WARNING !!
|
|
337
|
+
The bundle size is ${D} Mb, this may take a while to download for users
|
|
338
|
+
`),y.info(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
|
|
339
|
+
`),e.verbose&&(y.info("[Verbose] Bundle size details:"),y.info(` - Actual size: ${D} MB (${l?.byteLength} bytes)`),y.info(` - Alert threshold: ${Math.floor(o/1024/1024)} MB`),y.info(` - Maximum allowed: ${w} MB`),y.info("[Verbose] Sending 'App Too Large' event to analytics...")),await Ae(r,{channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":i},notify:!1},e.verbose),e.verbose&&y.info("[Verbose] Event sent successfully")):e.verbose&&y.info(`[Verbose] Bundle size OK: ${D} MB (under ${Math.floor(o/1024/1024)} MB alert threshold)`),e.verbose&&y.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:l,ivSessionKey:a,sessionKey:u,checksum:c,encryptionMethod:h,finalKeyData:d}}async function Phe(t,e,r,n,i,s,o,a){let u=Ft();u.start("Uploading Bundle");let c=performance.now(),l=!1;if(o.verbose&&(y.info("[Verbose] uploadBundleToCapgoCloud called:"),y.info(` - Bundle size: ${Math.floor(s.byteLength/1024)} KB`),y.info(` - App ID: ${r}`),y.info(` - Bundle version: ${n}`),y.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),o.dryUpload){u.stop(`Dry run, bundle not uploaded
|
|
340
|
+
Bundle uploaded \u{1F4AA} in 0 seconds`),o.verbose&&y.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let f=await wn();if(o.verbose&&y.info("[Verbose] Local config retrieved for upload"),o.multipart!==void 0&&o.multipart||o.tus!==void 0&&o.tus){o.multipart?y.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):y.info("Uploading bundle with TUS protocol"),o.verbose&&(y.info("[Verbose] Starting TUS resumable upload..."),y.info(` - Host: ${f.hostWeb}`),y.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),await Q8(t,s,i,r,n,u,f,a),l=!0,o.verbose&&y.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${i}/apps/${r}/${n}.zip`,{error:g}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(g)return y.error(`Cannot finish TUS upload ${W(g)}`),o.verbose&&y.info(`[Verbose] Database update failed: ${W(g)}`),Promise.reject(new Error("Cannot finish TUS upload"));o.verbose&&y.info(`[Verbose] Database updated with R2 path: ${m}`)}else{o.verbose&&y.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await Y8(e,r,n);if(!m)return y.error("Cannot get upload url"),o.verbose&&y.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));o.verbose&&(y.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),y.info(` - Timeout: ${o.timeout||Qv}ms`),y.info(" - Retry attempts: 5"),y.info(" - Content-Type: application/zip"));let g=new AbortController,b=setTimeout(()=>g.abort(),o.timeout||Qv);try{let S=await fetch(m,{method:"PUT",body:s,headers:{"Content-Type":"application/zip"},signal:g.signal});if(!S.ok)throw new Error(`HTTP error! status: ${S.status}`)}finally{clearTimeout(b)}o.verbose&&y.info("[Verbose] HTTP PUT upload completed successfully")}}catch(f){let g=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${g} seconds)`),o.verbose&&(y.info(`[Verbose] Upload failed after ${g} seconds`),y.info(`[Verbose] Error type: ${f instanceof Error?"Error":typeof f}`)),f instanceof Error&&f.message.includes("HTTP error"))try{let b=f.message.match(/status: (\d+)/),S=b?b[1]:"unknown";y.error(`Upload failed with status ${S}: ${f.message}`)}catch{y.error(`Upload failed: ${f.message}`)}else o.verbose&&y.info(`[Verbose] Non-HTTP error: ${W(f)}`),o.tus?y.error(`Cannot upload bundle please contact support if the issue persists ${W(f)}`):y.error(`Cannot upload bundle ( try again with --tus option) ${W(f)}`);throw o.verbose&&y.info("[Verbose] Cleaning up failed version from database..."),await eM(e,r,n),o.verbose&&y.info("[Verbose] Failed version cleaned up"),f instanceof Error?f:new Error(String(f))}let d=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${d} seconds)`),o.verbose&&(y.info("[Verbose] Upload successful:"),y.info(` - Upload time: ${d} seconds`),y.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),y.info(` - Bundle size: ${Math.floor(s.byteLength/1024)} KB`),y.info("[Verbose] Sending performance event...")),await Ae(t,{channel:"performance",event:l?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":r,time:d},notify:!1},o.verbose),o.verbose&&y.info("[Verbose] Performance event sent successfully")}async function khe(t,e,r){let{data:n,error:i}=await t.from("channels").select("version ( id, name, deleted )").eq("app_id",e).eq("name",r);if(i){y.error(`Cannot delete linked bundle on upload ${W(i)}`);return}if(n.length===0){y.warn("No linked bundle found in the channel you are trying to upload to");return}let s=n[0].version;if(s.deleted){y.warn("The linked bundle is already deleted");return}let{error:o}=await t.from("app_versions").update({deleted:!0}).eq("id",s.id);if(o){y.error(`Cannot delete linked bundle on upload ${W(o)}`);return}y.info("Linked bundle deleted")}async function Rhe(t,e,r,n,i,s,o,a,u,c){let{data:l}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:a}).single();l||Dt("Cannot get version id, cannot set channel");let{data:h}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(h){let{error:d,data:f}=await Bp(t,{name:i,app_id:a,created_by:s,version:l,owner_org:o,...c?{allow_device_self_set:!0}:{}});d&&Dt(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${W(d)}`);let m=`${u.hostWeb}/app/p/${a}/channel/${f.id}`;f?.public?y.info("Your update is now available in your public channel \u{1F389}"):f?.id&&y.info(`Link device to this bundle to try it: ${m}`),r&&y.info(`Bundle url: ${m}`)}else y.warn("The upload key is not allowed to set the version in the channel")}async function Nhe(t,e,r){let{error:n,data:i}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(y.warn("Cannot find default upload channel"),y.info(`You can set it here: ${r}/app/p/${t}/settings`),null):i.default_upload_channel}async function d6(t,e,r=!1){r||oe(`Uploading with CLI version ${Pi.version}`);let n,i=$n();await ze();let{s3Region:s,s3Apikey:o,s3Apisecret:a,s3BucketName:u,s3Endpoint:c,s3Port:l,s3SSL:h}=e;e.verbose&&(y.info("[Verbose] Starting upload process with options:"),y.info(` - API key: ${e.apikey?"provided":"from saved key"}`),y.info(` - Path: ${e.path||"from capacitor config"}`),y.info(` - Channel: ${e.channel||"from default upload channel"}`),y.info(` - Bundle: ${e.bundle||"auto-detected"}`),y.info(` - External: ${e.external||"false"}`),y.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),y.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),y.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let d=Ahe(e);e.verbose&&y.info("[Verbose] API key retrieved successfully");let f=await de();e.verbose&&y.info("[Verbose] Capacitor config loaded successfully");let m=await H8();e.verbose&&(y.info("[Verbose] Remote file config retrieved:"),y.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),y.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),y.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),y.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),y.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),y.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:g,path:b}=Ohe(t,e,f.config);e.verbose&&y.info(`[Verbose] App ID: ${g}, Build path: ${b}`);let S=await She(f.config,e);e.verbose&&y.info(`[Verbose] Bundle version: ${S}`);let A=e.external?"external":"r2-direct",p="none";e.autoSetBundle&&(await U8({version:S}),e.verbose&&y.info("[Verbose] Auto-set bundle version in capacitor.config.json")),xhe(e,b),e.verbose&&y.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),y.info(`Upload ${g}@${S} started from path "${b}" to Capgo cloud`);let D=await wn();e.verbose&&y.info(`[Verbose] Local config loaded: host=${D.hostWeb}`),e.supaHost&&e.supaAnon&&(y.info("Using custom supabase instance from provided options"),D.supaHost=e.supaHost,D.supaKey=e.supaAnon,e.verbose&&y.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let w=await pe(d,e.supaHost,e.supaAnon);e.verbose&&y.info("[Verbose] Supabase client created successfully");let _=await De(w,d,["write","all","upload"]);e.verbose&&y.info(`[Verbose] User verified successfully, user_id: ${_}`);let P=e.channel||await Nhe(g,w,D.hostWeb)||"dev";e.verbose&&y.info(`[Verbose] Target channel: ${P}`);let E=await sn(w,g);e.verbose&&y.info(`[Verbose] Organization ID: ${E}`),await K8(w,E,Pi.version),e.verbose&&y.info("[Verbose] Remote CLI messages checked"),await X8(w,E,d,g,!0),e.verbose&&y.info("[Verbose] Plan validation passed"),e.verbose&&y.info("[Verbose] Trial check completed"),e.verbose&&y.info(`[Verbose] Checking compatibility with channel ${P}...`);let{nativePackages:R,minUpdateVersion:k}=await The(w,i,e,P,g,S);e.verbose&&(y.info("[Verbose] Compatibility check completed:"),y.info(` - Native packages: ${R?R.length:0}`),y.info(` - Min update version: ${k||"none"}`)),e.verbose&&y.info(`[Verbose] Checking if version ${S} already exists...`);let F=await Fhe(w,g,S,e.versionExistsOk);if(e.verbose&&y.info(`[Verbose] Version exists check: ${F?"yes (skipping)":"no (continuing)"}`),F)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:S,checksum:null,encryptionMethod:p,storageProvider:A};e.external&&!e.external.startsWith("https://")&&Dt(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(y.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),y.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let j={name:S,app_id:g,session_key:void 0,external_url:e.external,storage_provider:A,min_update_version:k,native_packages:R,owner_org:E,user_id:_,checksum:void 0,link:e.link||null,comment:e.comment||null},U=null,G="";if(e.external)e.verbose&&y.info(`[Verbose] Using external URL: ${e.external}`),await Ae(d,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:E,tags:{"app-id":g},notify:!1},e.verbose),j.session_key=e.ivSessionKey,j.checksum=e.encryptedChecksum,e.verbose&&(y.info("[Verbose] External bundle configured:"),y.info(` - URL: ${e.external}`),y.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),y.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&y.info(`[Verbose] Preparing bundle file from path: ${b}`);let{zipped:$,ivSessionKey:M,checksum:B,sessionKey:K,encryptionMethod:q,finalKeyData:V}=await Ihe(b,e,d,E,g,m.maxUploadLength,m.alertUploadSize);j.session_key=M,j.checksum=B,n=K,U=$,p=q,G=V,e.verbose&&(y.info("[Verbose] Bundle prepared:"),y.info(` - Size: ${Math.floor(($?.byteLength??0)/1024)} KB`),y.info(` - Checksum: ${B}`),y.info(` - Encryption: ${q}`),y.info(` - IV Session Key: ${M?"present":"none"}`)),e.ignoreChecksumCheck||(e.verbose&&y.info("[Verbose] Checking for duplicate checksum..."),await nM(w,g,P,B),e.verbose&&y.info("[Verbose] Checksum is unique"))}if(e.zip?(e.tus=!1,e.verbose&&y.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&y.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&y.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&y.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&y.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&p==="v1"&&Dt("You cannot encrypt the partial update if you are not using the v2 encryption method"),e.delta&&p==="v2"&&!e.encryptPartial){let $=Xr((0,FE.cwd)()),M=await no("@capgo/capacitor-updater",$,e.packageJson),B;try{B=M?Ct(M):void 0}catch{B=void 0}M&&B&&Ei(B,Ct("6.14.4"))&&(y.info(`Auto-enabling partial update encryption for updater version ${B} (> 6.14.4)`),e.verbose&&y.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}e.verbose&&e.delta&&y.info("[Verbose] Preparing delta/partial update manifest...");let L=e.delta?await l6(b,d,E,g,e.encryptPartial?p:"none",G):[];e.verbose&&e.delta&&y.info(`[Verbose] Delta manifest prepared with ${L.length} files`),e.verbose&&y.info("[Verbose] Creating version record in database...");let{error:C}=await eE(w,j);if(C&&Dt(`Cannot add bundle ${W(C)}`),e.verbose&&y.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(y.error(`Chunk size ${e.tusChunkSize} is greater than the maximum chunk size ${m.maxChunkSize}, using the maximum chunk size`),e.tusChunkSize=m.maxChunkSize):e.tusChunkSize||(e.tusChunkSize=m.maxChunkSize),e.verbose&&y.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),U&&(u||c||s||o||a||l||h)){(!u||!c||!s||!o||!a||!l)&&Dt("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),y.info("Uploading to S3"),e.verbose&&(y.info("[Verbose] S3 configuration:"),y.info(` - Endpoint: ${c}`),y.info(` - Region: ${s}`),y.info(` - Bucket: ${u}`),y.info(` - Port: ${l}`),y.info(` - SSL: ${h?"enabled":"disabled"}`));let $=h?`https://${c}`:`http://${c}`,M=new cl({endPoint:c,region:s,port:l,pathStyle:!0,bucket:u,accessKey:o,secretKey:a}),B=`${g}-${S}`,K=encodeURIComponent(B);e.verbose&&y.info(`[Verbose] Uploading to S3 as: ${B}`),await M.putObject(B,Uint8Array.from(U)),j.external_url=`${$}/${K}`,j.storage_provider="external",e.verbose&&y.info(`[Verbose] S3 upload complete, external URL: ${j.external_url}`)}else if(U){!e.partialOnly&&!e.deltaOnly?(e.verbose&&y.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await Phe(d,w,g,S,E,U,e,e.tusChunkSize)):e.verbose&&y.info("[Verbose] Skipping full bundle upload (delta-only mode)");let $=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&y.info("[Verbose] Dry upload mode: skipping delta upload"));let B=j.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:j.session_key}:void 0;e.verbose&&e.delta&&(y.info("[Verbose] Starting delta/partial file upload..."),y.info(` - Manifest entries: ${L.length}`),y.info(` - Encryption: ${B?"enabled":"disabled"}`)),$=e.delta?await f6(d,L,b,g,E,B,e):null,e.verbose&&$&&y.info(`[Verbose] Delta upload complete with ${$.length} files`)}catch(B){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw B;y.info(`Failed to upload partial files to capgo cloud. Error: ${W(B)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&y.info(`[Verbose] Delta upload error details: ${W(B)}`)}j.storage_provider="r2",j.manifest=$,e.verbose&&y.info("[Verbose] Updating version record with storage provider and manifest...");let{error:M}=await eE(w,j);M&&Dt(`Cannot update bundle ${W(M)}`),e.verbose&&y.info("[Verbose] Version record updated successfully")}e.verbose&&y.info("[Verbose] Checking app permissions...");let T=await yt(w,d,g,2);e.verbose&&(y.info("[Verbose] Permissions:"),y.info(` - Upload: ${Ya(T,2)?"yes":"no"}`),y.info(` - Write: ${Ya(T,3)?"yes":"no"}`),y.info(` - Admin: ${Ya(T,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&Ya(T,3)?(e.verbose&&y.info(`[Verbose] Deleting linked bundle in channel ${P}...`),await khe(w,g,P)):e.deleteLinkedBundleOnUpload&&y.warn("Cannot delete linked bundle on upload as a upload organization member"),Ya(T,3)?(e.verbose&&y.info(`[Verbose] Setting bundle ${S} to channel ${P}...`),await Rhe(w,d,!!e.bundleUrl,S,P,_,E,g,D,e.selfAssign),e.verbose&&y.info("[Verbose] Channel updated successfully")):y.warn("Cannot set channel as a upload organization member"),e.verbose&&y.info("[Verbose] Sending upload event..."),await Ae(d,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:E,tags:{"app-id":g},notify:!1},e.verbose);let I={success:!0,bundle:S,checksum:j.checksum??null,encryptionMethod:p,sessionKey:n?n.toString("base64"):void 0,ivSessionKey:typeof j.session_key=="string"?j.session_key:void 0,storageProvider:j.storage_provider};return e.verbose&&(y.info("[Verbose] Upload completed successfully:"),y.info(` - Bundle: ${I.bundle}`),y.info(` - Checksum: ${I.checksum}`),y.info(` - Encryption: ${I.encryptionMethod}`),y.info(` - Storage: ${I.storageProvider}`)),r&&!I.skipped&&ce("Time to share your update to the world \u{1F30D}"),I}var p6=require("node:crypto"),um=require("node:fs"),m6=require("node:process");var $he=20;function Lhe(t){console.log(JSON.stringify(t,null,2))}function ml(t){console.error(W(t))}async function g6(t,e,r=!1){let{json:n}=e,{bundle:i,path:s}=e,o=!n&&!r;try{o&&await ze();let a=await de(),u=ke(t,a?.config),c=(0,p6.randomUUID)().split("-")[0],l=rs("",e.packageJson);if(i=i||l||`0.0.1-beta.${c}`,o&&oe(`Zipping ${u}@${i}`),i&&!Xa.test(i)){let _=`Your bundle name ${i}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?ml({error:"invalid_semver"}):y.error(_)),new Error("Invalid bundle version format")}if(s=s||a?.config?.webDir,!u||!i||!s){let _="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?ml({error:"missing_argument"}):y.error(_)),new Error(_)}if(o&&y.info(`Started from path "${s}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!ll(s,"notifyAppReady"))throw r||(n?ml({error:"notifyAppReady_not_in_source_code"}):y.error("notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready")),new Error("notifyAppReady() is missing in build folder");if(!Qp(s))throw r||(n?ml({error:"index_html_not_found"}):y.error(`index.html is missing in the root folder of ${s}`)),new Error("index.html is missing in root folder")}let d=await jp(s);o&&y.info(`Zipped ${d.byteLength} bytes`);let f=o?Ft():null;f&&f.start("Calculating checksum");let m=Xr((0,m6.cwd)()),g=await no("@capgo/capacitor-updater",m,e.packageJson);if(!g){let _="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||y.warn(_),new Error(_)}let b=!1,S;try{S=g?Ct(g):void 0}catch{S=void 0}if(S){let _=S.major===6&&Ei(S,Ct("6.25.0")),P=S.major>=7;b=_||P}else g==="link:@capgo/capacitor-updater"&&(r||y.warn("Using local @capgo/capacitor-updater. Assuming v7"),b=!0);let A=await Yn(d,e.keyV2||(0,um.existsSync)(Ir)||b?"sha256":"crc32");f&&f.stop(`Checksum ${b?"SHA256":"CRC32"}: ${A}`);let p=Math.floor(d.byteLength/1024/1024);p>$he&&o&&(y.warn(`WARNING !!
|
|
341
341
|
The bundle size is ${p} Mb, this may take a while to download for users
|
|
342
|
-
`),
|
|
343
|
-
`));let
|
|
344
|
-
${W(c.error)}`),new Error(`Cannot create channel: ${W(c.error)}`);return await Ae(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:a,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(D.success("Channel created \u2705"),ce("Done \u2705")),c.data??!0}async function D6(t,e,r,n=!1){let{quiet:i}=r;!i&&!n&&oe("List current bundle"),r.apikey=r.apikey||te(i);let s=await de();if(e=ke(e,s?.config),!r.apikey)throw n||D.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||D.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await pe(r.apikey,r.supaHost,r.supaAnon);if(await De(o,r.apikey,["write","all","read"]),await yt(o,r.apikey,e,1,n),!t)throw n||D.error("Please provide a channel to get the bundle from."),new Error("Channel name missing");let{data:a,error:u}=await o.from("channels").select("version ( name )").eq("name",t).eq("app_id",e).limit(1);if(u||!a?.length)throw n||D.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} not found for app ${e}`);let{version:c}=a[0];if(!c)throw n||D.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} does not have a bundle linked`);return n||(i?D.info(c.name):D.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function w6(t,e,r,n=!1){n||oe("Delete channel"),r.apikey=r.apikey||te();let i=await de();if(e=ke(e,i?.config),!r.apikey)throw n||D.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||D.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let s=await pe(r.apikey,r.supaHost,r.supaAnon),o=await De(s,r.apikey,["all"]);if(await yt(s,r.apikey,e,4,n),r.deleteBundle&&!n&&D.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let d=await lM(s,e,t);d?.name&&!n&&D.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await iE(s,e,d.name)}let{data:a,error:u}=await uM(s,e,t);if(u||!a){if(n||D.error(`Channel ${t} not found`),r.successIfNotFound)return n||D.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await cM(s,e,a.id);if(c)throw n||D.error(`Cannot delete channel devices: ${W(c)}`),new Error(`Cannot delete channel devices: ${W(c)}`);n||D.info(`Deleting channel ${e}#${t} from Capgo`);let l=await aM(s,t,e,o);if(l.error)throw n||D.error(`Cannot delete Channel \u{1F640} ${W(l.error)}`),new Error(`Cannot delete channel: ${W(l.error)}`);let h=await sn(s,e);return await Ae(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:h,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(D.success("Channel deleted"),ce("Done \u2705")),!0}async function b6(t,e,r=!1){r||oe("List channels"),e.apikey=e.apikey||te();let n=await de();if(t=ke(t,n?.config),!e.apikey)throw r||D.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||D.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await pe(e.apikey,e.supaHost,e.supaAnon),s=await De(i,e.apikey,["write","all","read","upload"]);await yt(i,e.apikey,t,1,r),r||D.info("Querying available channels in Capgo");let o=await hM(i,t);return r||(D.info(`Active channels in Capgo: ${o?.length??0}`),fM(o)),await Ae(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:s,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||ce("Done \u2705"),o}var v6=["major","minor","metadata","patch","none"];async function E6(t,e,r,n=!1){n||oe("Set channel"),r.apikey=r.apikey||te();let i=await de();if(e=ke(e,i?.config),!r.apikey)throw n||D.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||D.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||D.error("Missing argument, you need to provide a channel"),new Error("Missing channel id");let s=await pe(r.apikey,r.supaHost,r.supaAnon),o=await De(s,r.apikey,["write","all"]);await yt(s,r.apikey,e,4,n);let a=await sn(s,e),{bundle:u,state:c,downgrade:l,latest:h,latestRemote:d,ios:f,android:m,selfAssign:g,disableAutoUpdate:b,dev:S,emulator:A}=r;if(h&&u)throw n||D.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(d&&u)throw n||D.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(d&&h)throw n||D.error("Cannot set latest remote and latest at the same time"),new Error("Cannot set both latest remote and latest simultaneously");if(u==null&&c==null&&h==null&&d==null&&l==null&&f==null&&m==null&&g==null&&S==null&&A==null&&b==null)throw n||D.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await W8(s,a,r.apikey,e);let p={created_by:o,app_id:e,name:t,owner_org:a,version:void 0},{error:y}=await s.from("channels").select().eq("app_id",e).eq("name",t).single();if(y)throw n||D.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let w=h?i?.config?.plugins?.CapacitorUpdater?.version||rs("",r.packageJson):u;if(w!=null){let{data:P,error:E}=await s.from("app_versions").select().eq("app_id",e).eq("name",w).eq("user_id",o).eq("deleted",!1).single();if(E||!P)throw n||D.error(`Cannot find version ${w}`),new Error(`Cannot find version ${w}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:R,localDependencies:k}=await rE(s,e,t,P.native_packages??[]),F=$n();if(k.length>0&&R.some(j=>!io(j)))throw n||(D.warn(`Bundle NOT compatible with ${t} channel`),D.warn(`You can check compatibility with "${F.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(k.length===0&&R.length>0?D.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):D.info(`Bundle is compatible with ${t} channel`))}n||D.info(`Set ${e} channel: ${t} to @${w}`),p.version=P.id}if(d){let{data:P,error:E}=await s.from("app_versions").select().eq("app_id",e).eq("user_id",o).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(E||!P)throw n||D.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:R}=await rE(s,e,t,P.native_packages??[]),k=$n();if(R.some(F=>!io(F)))throw n||(D.warn(`Bundle NOT compatible with ${t} channel`),D.warn(`You can check compatibility with "${k.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||D.info(`Set ${e} channel: ${t} to @${P.name}`),p.version=P.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||D.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||D.info(`Set ${e} channel: ${t} to ${c}`),p.public=c==="default"}if(l!=null&&(n||D.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),p.disable_auto_update_under_native=!l),f!=null&&(n||D.info(`Set ${e} channel: ${t} to ${f?"allow":"disallow"} ios update`),p.ios=!!f),m!=null&&(n||D.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),p.android=!!m),g!=null&&(n||D.info(`Set ${e} channel: ${t} to ${g?"allow":"disallow"} self assign to this channel`),p.allow_device_self_set=!!g),S!=null&&(n||D.info(`Set ${e} channel: ${t} to ${S?"allow":"disallow"} dev devices`),p.allow_dev=!!S),A!=null&&(n||D.info(`Set ${e} channel: ${t} to ${A?"allow":"disallow"} emulator devices`),p.allow_emulator=!!A),b!=null){let P=b.toLowerCase();if(!v6.includes(P))throw n||D.error(`Channel strategy ${P} is not known. The possible values are: ${v6.join(", ")}.`),new Error(`Unknown channel strategy ${P}`);P==="metadata"&&(P="version_number"),p.disable_auto_update=P,n||D.info(`Set ${e} channel: ${t} to ${P} disable update strategy to this channel`)}let{error:_}=await Bp(s,p);if(_)throw n||D.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),new Error("Upload key is not allowed to set this channel");return await Ae(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:a,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||ce("Done \u2705"),!0}var hr=require("node:fs");function _6(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function C6(t,e=!1){e||oe("Save keys \u{1F511}");let r=await de(),n=t.key||hi,i=t.keyData||"";if(!(0,hr.existsSync)(n)&&!i)throw e||D.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,hr.existsSync)(n)&&(i=(0,hr.readFileSync)(n,"utf8")),!i.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||D.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let s=_6(r.config);s.privateKey&&(delete s.privateKey,e||D.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await $r({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(s.defaultChannel="encryption_v2")),s.publicKey=i,await Ha(r)}return e||(D.success(`Public key saved into ${r.path} file in local directory`),D.success("Your app will decode the zip archive with this key")),!0}async function S6(t,e=!1){e||oe("Deleting old private key \u{1F5D1}\uFE0F");let r=await de(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Ha(r),(0,hr.existsSync)(Wa))try{(0,hr.unlinkSync)(Wa),e||D.success(`Old private key file deleted: ${Wa}`)}catch(i){e||D.error(`Failed to delete old private key file: ${Wa} (${String(i)})`)}if((0,hr.existsSync)(Np))try{(0,hr.unlinkSync)(Np),e||D.success(`Old public key file deleted: ${Np}`)}catch(i){e||D.error(`Failed to delete old public key file: ${hi} (${String(i)})`)}return e||(D.success(`Old private key deleted from ${r.path} file`),ce("Done \u2705")),!0}return e||D.info("No old private key found in config file"),!1}async function A6(t,e=!1){e||oe("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=NM();if((0,hr.existsSync)(hi)&&!t.force)throw e||D.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,hr.writeFileSync)(hi,r),(0,hr.existsSync)(Ir)&&!t.force)throw e||D.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,hr.writeFileSync)(Ir,n);let i=await de();if(i){let s=_6(i.config);s.privateKey&&(delete s.privateKey,e||D.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await $r({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(s.defaultChannel="encryption_v2")),s.publicKey=r,await Ha(i)}if(!e){D.success("Your RSA key has been generated"),D.success(`Private key saved in ${Ir}`),D.success("This key will be used to encrypt your bundle before sending it to Capgo"),D.success("Keep it safe"),D.success("Then make it unreadable by Capgo and unmodifiable by anyone"),D.success(`Public key saved in ${i.path}`),D.success("Your app will be the only one having it"),D.success("Only your users can decrypt your update"),D.success("Only you can send them an update");try{await iM(),ce("Done \u2705")}catch(s){if(s instanceof Error&&s.message==="Capacitor sync cancelled")return!0;throw s}}return!0}var go=require("node:fs"),O6=require("node:os");async function x6(t,e,r=!1){if(r||oe("Login to Capgo"),!t)throw r||D.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await ze();let{local:n}=e;if(n){if(!(0,go.existsSync)(".git"))throw r||D.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,go.writeFileSync)(".capgo",`${t}
|
|
342
|
+
`),y.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
|
|
343
|
+
`));let D=o?Ft():null,w=e.name||`${u}_${i}.zip`;return D&&D.start(`Saving to ${w}`),(0,um.writeFileSync)(w,d),D&&D.stop(`Saved to ${w}`),o&&ce("Done \u2705"),!r&&n&&Lhe({bundle:i,filename:w,checksum:A}),{bundle:i,filename:w,checksum:A}}catch(a){throw r||(n?ml(a):y.error(W(a))),a instanceof Error?a:new Error(String(a))}}async function y6(t,e,r,n=!1){n||oe("Create channel"),r.apikey=r.apikey||te();let i=await de().catch(()=>{});if(e=ke(e,i?.config),!r.apikey)throw n||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||y.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let s=await pe(r.apikey,r.supaHost,r.supaAnon);await De(s,r.apikey,["write","all"]),await yt(s,r.apikey,e,4,n),n||y.info(`Creating channel ${e}#${t} to Capgo`);let o=await nE(s,e);if(!o)throw n||y.error("Cannot find default version for channel creation, please contact Capgo support \u{1F928}"),new Error("Cannot find default version for channel creation");let a=await sn(s,e),u=await De(s,r.apikey,["write","all"]),c=await oM(s,{name:t,app_id:e,version:o.id,created_by:u,owner_org:a,allow_device_self_set:r.selfAssign??!1,public:r.default??!1});if(c.error)throw n||y.error(`Cannot create Channel \u{1F640}
|
|
344
|
+
${W(c.error)}`),new Error(`Cannot create channel: ${W(c.error)}`);return await Ae(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:a,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(y.success("Channel created \u2705"),ce("Done \u2705")),c.data??!0}async function D6(t,e,r,n=!1){let{quiet:i}=r;!i&&!n&&oe("List current bundle"),r.apikey=r.apikey||te(i);let s=await de();if(e=ke(e,s?.config),!r.apikey)throw n||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||y.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await pe(r.apikey,r.supaHost,r.supaAnon);if(await De(o,r.apikey,["write","all","read"]),await yt(o,r.apikey,e,1,n),!t)throw n||y.error("Please provide a channel to get the bundle from."),new Error("Channel name missing");let{data:a,error:u}=await o.from("channels").select("version ( name )").eq("name",t).eq("app_id",e).limit(1);if(u||!a?.length)throw n||y.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} not found for app ${e}`);let{version:c}=a[0];if(!c)throw n||y.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} does not have a bundle linked`);return n||(i?y.info(c.name):y.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function w6(t,e,r,n=!1){n||oe("Delete channel"),r.apikey=r.apikey||te();let i=await de();if(e=ke(e,i?.config),!r.apikey)throw n||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||y.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let s=await pe(r.apikey,r.supaHost,r.supaAnon),o=await De(s,r.apikey,["all"]);if(await yt(s,r.apikey,e,4,n),r.deleteBundle&&!n&&y.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let d=await lM(s,e,t);d?.name&&!n&&y.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await iE(s,e,d.name)}let{data:a,error:u}=await uM(s,e,t);if(u||!a){if(n||y.error(`Channel ${t} not found`),r.successIfNotFound)return n||y.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await cM(s,e,a.id);if(c)throw n||y.error(`Cannot delete channel devices: ${W(c)}`),new Error(`Cannot delete channel devices: ${W(c)}`);n||y.info(`Deleting channel ${e}#${t} from Capgo`);let l=await aM(s,t,e,o);if(l.error)throw n||y.error(`Cannot delete Channel \u{1F640} ${W(l.error)}`),new Error(`Cannot delete channel: ${W(l.error)}`);let h=await sn(s,e);return await Ae(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:h,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(y.success("Channel deleted"),ce("Done \u2705")),!0}async function b6(t,e,r=!1){r||oe("List channels"),e.apikey=e.apikey||te();let n=await de();if(t=ke(t,n?.config),!e.apikey)throw r||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||y.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await pe(e.apikey,e.supaHost,e.supaAnon),s=await De(i,e.apikey,["write","all","read","upload"]);await yt(i,e.apikey,t,1,r),r||y.info("Querying available channels in Capgo");let o=await hM(i,t);return r||(y.info(`Active channels in Capgo: ${o?.length??0}`),fM(o)),await Ae(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:s,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||ce("Done \u2705"),o}var v6=["major","minor","metadata","patch","none"];async function E6(t,e,r,n=!1){n||oe("Set channel"),r.apikey=r.apikey||te();let i=await de();if(e=ke(e,i?.config),!r.apikey)throw n||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||y.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||y.error("Missing argument, you need to provide a channel"),new Error("Missing channel id");let s=await pe(r.apikey,r.supaHost,r.supaAnon),o=await De(s,r.apikey,["write","all"]);await yt(s,r.apikey,e,4,n);let a=await sn(s,e),{bundle:u,state:c,downgrade:l,latest:h,latestRemote:d,ios:f,android:m,selfAssign:g,disableAutoUpdate:b,dev:S,emulator:A}=r;if(h&&u)throw n||y.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(d&&u)throw n||y.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(d&&h)throw n||y.error("Cannot set latest remote and latest at the same time"),new Error("Cannot set both latest remote and latest simultaneously");if(u==null&&c==null&&h==null&&d==null&&l==null&&f==null&&m==null&&g==null&&S==null&&A==null&&b==null)throw n||y.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await W8(s,a,r.apikey,e);let p={created_by:o,app_id:e,name:t,owner_org:a,version:void 0},{error:D}=await s.from("channels").select().eq("app_id",e).eq("name",t).single();if(D)throw n||y.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let w=h?i?.config?.plugins?.CapacitorUpdater?.version||rs("",r.packageJson):u;if(w!=null){let{data:P,error:E}=await s.from("app_versions").select().eq("app_id",e).eq("name",w).eq("user_id",o).eq("deleted",!1).single();if(E||!P)throw n||y.error(`Cannot find version ${w}`),new Error(`Cannot find version ${w}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:R,localDependencies:k}=await rE(s,e,t,P.native_packages??[]),F=$n();if(k.length>0&&R.some(j=>!io(j)))throw n||(y.warn(`Bundle NOT compatible with ${t} channel`),y.warn(`You can check compatibility with "${F.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(k.length===0&&R.length>0?y.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):y.info(`Bundle is compatible with ${t} channel`))}n||y.info(`Set ${e} channel: ${t} to @${w}`),p.version=P.id}if(d){let{data:P,error:E}=await s.from("app_versions").select().eq("app_id",e).eq("user_id",o).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(E||!P)throw n||y.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:R}=await rE(s,e,t,P.native_packages??[]),k=$n();if(R.some(F=>!io(F)))throw n||(y.warn(`Bundle NOT compatible with ${t} channel`),y.warn(`You can check compatibility with "${k.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||y.info(`Set ${e} channel: ${t} to @${P.name}`),p.version=P.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||y.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||y.info(`Set ${e} channel: ${t} to ${c}`),p.public=c==="default"}if(l!=null&&(n||y.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),p.disable_auto_update_under_native=!l),f!=null&&(n||y.info(`Set ${e} channel: ${t} to ${f?"allow":"disallow"} ios update`),p.ios=!!f),m!=null&&(n||y.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),p.android=!!m),g!=null&&(n||y.info(`Set ${e} channel: ${t} to ${g?"allow":"disallow"} self assign to this channel`),p.allow_device_self_set=!!g),S!=null&&(n||y.info(`Set ${e} channel: ${t} to ${S?"allow":"disallow"} dev devices`),p.allow_dev=!!S),A!=null&&(n||y.info(`Set ${e} channel: ${t} to ${A?"allow":"disallow"} emulator devices`),p.allow_emulator=!!A),b!=null){let P=b.toLowerCase();if(!v6.includes(P))throw n||y.error(`Channel strategy ${P} is not known. The possible values are: ${v6.join(", ")}.`),new Error(`Unknown channel strategy ${P}`);P==="metadata"&&(P="version_number"),p.disable_auto_update=P,n||y.info(`Set ${e} channel: ${t} to ${P} disable update strategy to this channel`)}let{error:_}=await Bp(s,p);if(_)throw n||y.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),new Error("Upload key is not allowed to set this channel");return await Ae(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:a,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||ce("Done \u2705"),!0}var hr=require("node:fs");function _6(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function C6(t,e=!1){e||oe("Save keys \u{1F511}");let r=await de(),n=t.key||hi,i=t.keyData||"";if(!(0,hr.existsSync)(n)&&!i)throw e||y.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,hr.existsSync)(n)&&(i=(0,hr.readFileSync)(n,"utf8")),!i.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||y.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let s=_6(r.config);s.privateKey&&(delete s.privateKey,e||y.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await $r({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(s.defaultChannel="encryption_v2")),s.publicKey=i,await Ha(r)}return e||(y.success(`Public key saved into ${r.path} file in local directory`),y.success("Your app will decode the zip archive with this key")),!0}async function S6(t,e=!1){e||oe("Deleting old private key \u{1F5D1}\uFE0F");let r=await de(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Ha(r),(0,hr.existsSync)(Wa))try{(0,hr.unlinkSync)(Wa),e||y.success(`Old private key file deleted: ${Wa}`)}catch(i){e||y.error(`Failed to delete old private key file: ${Wa} (${String(i)})`)}if((0,hr.existsSync)(Np))try{(0,hr.unlinkSync)(Np),e||y.success(`Old public key file deleted: ${Np}`)}catch(i){e||y.error(`Failed to delete old public key file: ${hi} (${String(i)})`)}return e||(y.success(`Old private key deleted from ${r.path} file`),ce("Done \u2705")),!0}return e||y.info("No old private key found in config file"),!1}async function A6(t,e=!1){e||oe("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=NM();if((0,hr.existsSync)(hi)&&!t.force)throw e||y.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,hr.writeFileSync)(hi,r),(0,hr.existsSync)(Ir)&&!t.force)throw e||y.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,hr.writeFileSync)(Ir,n);let i=await de();if(i){let s=_6(i.config);s.privateKey&&(delete s.privateKey,e||y.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await $r({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(s.defaultChannel="encryption_v2")),s.publicKey=r,await Ha(i)}if(!e){y.success("Your RSA key has been generated"),y.success(`Private key saved in ${Ir}`),y.success("This key will be used to encrypt your bundle before sending it to Capgo"),y.success("Keep it safe"),y.success("Then make it unreadable by Capgo and unmodifiable by anyone"),y.success(`Public key saved in ${i.path}`),y.success("Your app will be the only one having it"),y.success("Only your users can decrypt your update"),y.success("Only you can send them an update");try{await iM(),ce("Done \u2705")}catch(s){if(s instanceof Error&&s.message==="Capacitor sync cancelled")return!0;throw s}}return!0}var go=require("node:fs"),O6=require("node:os");async function x6(t,e,r=!1){if(r||oe("Login to Capgo"),!t)throw r||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await ze();let{local:n}=e;if(n){if(!(0,go.existsSync)(".git"))throw r||y.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,go.writeFileSync)(".capgo",`${t}
|
|
345
345
|
`),(0,go.appendFileSync)(".gitignore",`.capgo
|
|
346
346
|
`)}else{let o=(0,O6.homedir)();(0,go.writeFileSync)(`${o}/.capgo`,`${t}
|
|
347
|
-
`)}let i=await pe(t,e.supaHost,e.supaAnon),s=await De(i,t,["write","all","upload"]);await Ae(t,{channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:s,notify:!1}).catch(),r||(D.success(`login saved into .capgo file in ${n?"local":"home"} directory`),ce("Done \u2705"))}async function T6(t,e=!1){e||oe("Adding organization"),await ze();let r={...t,apikey:t.apikey||te()};if(!r.apikey)throw e||D.error("Missing API key, you need to provide an API key to add an organization"),new Error("Missing API key");let n=await pe(r.apikey,r.supaHost,r.supaAnon),i=await De(n,r.apikey,["write","all"]),{name:s,email:o}=r;if(!e&&!s){let c=await Do({message:"Organization name:",placeholder:"My Organization"});if(xt(c))throw D.error("Canceled adding organization"),new Error("Organization creation cancelled");s=c}if(!e&&!o){let c=await Do({message:"Management email:",placeholder:"admin@example.com"});if(xt(c))throw D.error("Canceled adding organization"),new Error("Organization creation cancelled");o=c}if(!s||!o)throw e||D.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||D.info(`Adding organization "${s}" to Capgo`);let{data:a,error:u}=await n.from("orgs").insert({name:s,management_email:o,created_by:i}).select().single();if(u)throw e||D.error(`Could not add organization ${W(u)}`),new Error(`Could not add organization: ${W(u)}`);return await Ae(r.apikey,{channel:"organization",event:"Organization Created",icon:"\u{1F3E2}",user_id:a.id,tags:{"org-name":s},notify:!1}).catch(()=>{}),e||(D.success(`Organization "${s}" added to Capgo`),ce("Done \u2705")),a}async function F6(t,e,r=!1){r||oe("Deleting organization"),await ze();let n={...e,apikey:e.apikey||te()};if(!n.apikey)throw r||D.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||D.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let i=await pe(n.apikey,n.supaHost,n.supaAnon),s=await De(i,n.apikey,["write","all"]),{data:o,error:a}=await i.from("orgs").select("created_by, name").eq("id",t).single();if(a||!o)throw r||D.error(`Cannot get organization details ${W(a)}`),new Error(`Cannot get organization details: ${W(a)}`);if(o.created_by!==s){if(r)throw new Error("Deleting an organization is restricted to the organization owner");D.warn("Deleting an organization is restricted to the organization owner"),D.warn("You are not the owner of this organization"),D.warn("It's strongly recommended that you do not continue!");let c=await wo({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(xt(c)||c==="no")throw D.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await $r({message:`Are you sure you want to delete organization "${o.name}"? This action cannot be undone.`});if(xt(c)||!c)throw D.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||D.info(`Deleting organization "${o.name}"`);let{error:u}=await i.from("orgs").delete().eq("id",t);if(u)throw r||D.error(`Could not delete organization ${W(u)}`),new Error(`Could not delete organization: ${W(u)}`);return await Ae(n.apikey,{channel:"organization",event:"Organization Deleted",icon:"\u{1F5D1}\uFE0F",user_id:t,tags:{"org-name":o.name},notify:!1}).catch(()=>{}),r||(D.success(`Organization "${o.name}" deleted from Capgo`),ce("Done \u2705")),!0}function Lhe(t,e){if(e)return;if(!t.length){D.error("No organizations found");return}let r=new Ht;r.headers=["Name","ID","Role","Apps"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name??"Unknown",n.gid,n.role,n.app_count?.toString()||"0"]);D.success("Organizations"),D.success(r.toString())}async function I6(t,e=!1){e||oe("List organizations"),await ze();let r={...t,apikey:t.apikey||te()};if(!r.apikey)throw e||D.error("Missing API key, you need to provide an API key to list organizations"),new Error("Missing API key");let n=await pe(r.apikey,r.supaHost,r.supaAnon);await De(n,r.apikey,["read","write","all"]),e||D.info("Getting organizations from Capgo");let{error:i,data:s}=await n.rpc("get_orgs_v6");if(i)throw e||D.error(`Cannot get organizations ${W(i)}`),new Error(`Cannot get organizations: ${W(i)}`);let o=s||[];return e||(D.info(`Organizations found: ${o.length}`),Lhe(o,e),ce("Done \u2705")),o}async function P6(t,e,r=!1){r||oe("Updating organization"),await ze();let n={...e,apikey:e.apikey||te()};if(!n.apikey)throw r||D.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||D.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let i=await pe(n.apikey,n.supaHost,n.supaAnon);await De(i,n.apikey,["write","all"]);let{data:s,error:o}=await i.from("orgs").select("name, management_email, created_by").eq("id",t).single();if(o||!s)throw r||D.error(`Cannot get organization details ${W(o)}`),new Error(`Cannot get organization details: ${W(o)}`);let{name:a,email:u}=n;if(!r&&!a){let l=await Do({message:"New organization name:",placeholder:s.name||"My Organization"});if(xt(l))throw D.error("Canceled updating organization"),new Error("Organization update cancelled");a=l}if(!r&&!u){let l=await Do({message:"Management email:",placeholder:s.management_email||"admin@example.com"});if(xt(l))throw D.error("Canceled updating organization"),new Error("Organization update cancelled");u=l}if(!a||!u)throw r||D.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||D.info(`Updating organization "${t}"`);let{error:c}=await i.from("orgs").update({name:a,management_email:u}).eq("id",t);if(c)throw r||D.error(`Could not update organization ${W(c)}`),new Error(`Could not update organization: ${W(c)}`);return await Ae(n.apikey,{channel:"organization",event:"Organization Updated",icon:"\u270F\uFE0F",user_id:t,tags:{"org-name":a},notify:!1}).catch(()=>{}),r||(D.success("Organization updated"),ce("Done \u2705")),{orgId:t,name:a,email:u}}async function k6(t,e=!1){e||oe("Getting user id");let r={...t,apikey:t.apikey||te()};if(!r.apikey)throw e||D.error("Missing API key, you need to provide an API key to fetch the user id"),new Error("Missing API key");try{let n=await pe(r.apikey,r.supaHost,r.supaAnon),i=await De(n,r.apikey,["read","all","write"]);return e||ce(`Done \u2705: ${i}`),i}catch(n){throw e||D.error(`Error getting user id ${W(n)}`),n instanceof Error?n:new Error(String(n))}}var tt=class{apikey;supaHost;supaAnon;constructor(e){this.apikey=e?.apikey,this.supaHost=e?.supaHost,this.supaAnon=e?.supaAnon}async login(e){try{return await x6(e.apikey,{local:e.local??!1,supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon},!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async doctor(e){try{return{success:!0,data:await bM({packageJson:e?.packageJson},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async addApp(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,icon:e.icon};return await gM(e.appId,r,void 0,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async updateApp(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,icon:e.icon,retention:e.retention};return await _M(e.appId,r,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteApp(e,r=!1){try{let n={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return await yM(e,n,!1,r),{success:!0}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async listApps(){try{let e={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:(await vM(e,!1)).map(i=>({appId:i.app_id,name:i.name||"Unknown",iconUrl:i.icon_url||void 0,createdAt:new Date(i.created_at||"")}))}}catch(e){return{success:!1,error:e instanceof Error?e.message:String(e)}}}async getAccountId(e){try{let r={apikey:e?.apikey||this.apikey||te(!0),supaHost:e?.supaHost||this.supaHost,supaAnon:e?.supaAnon||this.supaAnon};return{success:!0,data:await k6(r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async checkBundleCompatibility(e){try{let r={apikey:e.apikey||this.apikey||te(!0),channel:e.channel,text:e.textOutput??!1,packageJson:e.packageJson,nodeModules:e.nodeModules,supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon};return{success:!0,data:(await PM(e.appId,r,!0)).finalCompatibility}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async encryptBundle(e){try{return{success:!0,data:await BM(e.zipPath,e.checksum,{key:e.keyPath,keyData:e.keyData,json:e.json},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async decryptBundle(e){try{return{success:!0,data:await LM(e.zipPath,e.ivSessionKey,{key:e.keyPath,keyData:e.keyData,checksum:e.checksum},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async zipBundle(e){try{return{success:!0,data:await g6(e.appId,{apikey:this.apikey||te(!0),path:e.path,bundle:e.bundle,name:e.name,codeCheck:e.codeCheck,json:e.json,keyV2:e.keyV2,packageJson:e.packageJson},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async uploadBundle(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,path:e.path,bundle:e.bundle,channel:e.channel,external:e.external,key:e.encrypt!==!1,keyV2:e.encryptionKey,timeout:e.timeout,tus:e.useTus,comment:e.comment,minUpdateVersion:e.minUpdateVersion,autoMinUpdateVersion:e.autoMinUpdateVersion,selfAssign:e.selfAssign,packageJson:e.packageJsonPaths,ignoreMetadataCheck:e.ignoreCompatibilityCheck,codeCheck:!e.disableCodeCheck,zip:e.useZip},n=await d6(e.appId,r,!0);return{success:n.success,bundleId:n.bundle,checksum:n.checksum??null,encryptionMethod:n.encryptionMethod,sessionKey:n.sessionKey,ivSessionKey:n.ivSessionKey,storageProvider:n.storageProvider,skipped:n.skipped,reason:n.reason}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async listBundles(e){try{let r=this.apikey||te(!0),n=await pe(r,this.supaHost,this.supaAnon);return{success:!0,data:(await Hp(n,e)).map(o=>({id:o.id.toString(),version:o.name,uploadedAt:new Date(o.created_at||""),size:0,encrypted:o.session_key!==null}))}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteBundle(e,r){try{let n={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,bundle:r};return await jM(r,e,n,!0),{success:!0}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async cleanupBundles(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,bundle:e.bundle||"",version:"",keep:e.keep||4,force:e.force||!1,ignoreChannel:e.ignoreChannel||!1};return{success:!0,data:await IM(e.appId,r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async requestBuild(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,path:e.path,lane:e.lane,credentials:e.credentials,userId:e.userId},n=await FM(e.appId,r,!0);return n.success&&n.jobId?{success:!0,data:{jobId:n.jobId,uploadUrl:n.uploadUrl||"",status:n.status||"unknown"}}:{success:!1,error:n.error||"Unknown error during build request"}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async getCurrentBundle(e,r,n){try{let i={apikey:n?.apikey||this.apikey||te(!0),quiet:!0,supaHost:n?.supaHost||this.supaHost,supaAnon:n?.supaAnon||this.supaAnon};return{success:!0,data:await D6(r,e,i,!0)}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}async addChannel(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,default:e.default,selfAssign:e.selfAssign};return await y6(e.channelId,e.appId,r,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async updateChannel(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,bundle:e.bundle??void 0,state:e.state,downgrade:e.downgrade,ios:e.ios,android:e.android,selfAssign:e.selfAssign,disableAutoUpdate:e.disableAutoUpdate??void 0,dev:e.dev,emulator:e.emulator,latest:!1,latestRemote:!1,packageJson:void 0,ignoreMetadataCheck:!1};return await E6(e.channelId,e.appId,r,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteChannel(e,r,n=!1){try{let i={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,deleteBundle:n,successIfNotFound:!1};return await w6(e,r,i,!0),{success:!0}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}async listChannels(e){try{let r={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:await b6(e,r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async generateEncryptionKeys(e){try{return await A6({force:e?.force,setupChannel:e?.setupChannel},!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async saveEncryptionKey(e){try{return await C6({key:e?.keyPath,keyData:e?.keyData,setupChannel:e?.setupChannel},!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteLegacyEncryptionKey(e){try{return{success:!0,data:{deleted:await S6({force:e?.force,setupChannel:e?.setupChannel},!0)}}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async listOrganizations(e){try{let r={apikey:e?.apikey||this.apikey||te(!0),supaHost:e?.supaHost||this.supaHost,supaAnon:e?.supaAnon||this.supaAnon};return{success:!0,data:(await I6(r,!0)).map(s=>({id:String(s.id??s.gid??""),name:s.name??"Unknown",role:s.role??void 0,appCount:typeof s.app_count=="number"?s.app_count:void 0,email:s.management_email??void 0,createdAt:s.created_at?new Date(s.created_at):void 0}))}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async addOrganization(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,email:e.email},n=await T6(r,!0);return{success:!0,data:{id:String(n.id??n.gid??""),name:n.name??e.name,role:"owner",appCount:0,email:n.management_email??e.email,createdAt:n.created_at?new Date(n.created_at):void 0}}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async updateOrganization(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,email:e.email},n=await P6(e.orgId,r,!0);return{success:!0,data:{id:n.orgId,name:n.name,email:n.email}}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteOrganization(e,r){try{let n={apikey:r?.apikey||this.apikey||te(!0),supaHost:r?.supaHost||this.supaHost,supaAnon:r?.supaAnon||this.supaAnon,autoConfirm:r?.autoConfirm??!0};return{success:!0,data:{deleted:await F6(e,n,!0)}}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async getStats(e){try{let r=e.apikey||this.apikey||te(!0),n=await wn(),i={appId:e.appId,devicesId:e.deviceIds,search:e.search,order:e.order,rangeStart:e.after||e.rangeStart,rangeEnd:e.rangeEnd,limit:e.limit},s=await fetch(`${n.hostApi}/private/stats`,{method:"POST",headers:{"Content-Type":"application/json",capgkey:r},body:JSON.stringify(i)});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return{success:!0,data:(await s.json()).map(u=>({appId:u.app_id,deviceId:u.device_id,action:u.action,versionId:u.version_id,version:u.version,createdAt:u.created_at}))}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async setAppSetting(e,r){try{return await CM(e,{apikey:r.apikey||this.apikey||te(!0),bool:r.bool,string:r.string},!0),{success:!0}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}};async function jhe(t){return new tt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).uploadBundle(t)}async function Bhe(t){return new tt({supaHost:t.supaHost,supaAnon:t.supaAnon}).login(t)}async function Mhe(t){return new tt().doctor(t)}async function qhe(t){return new tt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).checkBundleCompatibility(t)}async function Uhe(t){return new tt().encryptBundle(t)}async function Hhe(t){return new tt().decryptBundle(t)}async function Vhe(t){return new tt().zipBundle(t)}async function zhe(t){return new tt().generateEncryptionKeys(t)}async function Ghe(t){return new tt().saveEncryptionKey(t)}async function Khe(t){return new tt().deleteLegacyEncryptionKey(t)}async function Whe(t,e,r){return new tt({apikey:r?.apikey,supaHost:r?.supaHost,supaAnon:r?.supaAnon}).getCurrentBundle(t,e,r)}async function Xhe(t,e){return new tt({apikey:e.apikey}).setAppSetting(t,e)}async function Yhe(t){return new tt({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).getAccountId(t)}async function Jhe(t){return new tt({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).listOrganizations(t)}async function Zhe(t){return new tt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addOrganization(t)}async function Qhe(t){return new tt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).updateOrganization(t)}async function ede(t,e){return new tt({apikey:e?.apikey,supaHost:e?.supaHost,supaAnon:e?.supaAnon}).deleteOrganization(t,e)}async function tde(t){return new tt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addApp(t)}async function rde(t,e){return new tt(e).listBundles(t)}async function nde(t){return new tt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addChannel(t)}async function ide(t){return new tt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).requestBuild(t)}async function sde(t){return new tt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).getStats(t)}async function ode(){try{return await de()}catch{return null}}0&&(module.exports={CapgoSDK,addApp,addChannel,addOrganization,checkBundleCompatibility,createSupabaseClient,decryptBundle,deleteLegacyEncryptionKey,deleteOrganization,doctor,encryptBundle,generateEncryptionKeys,getAccountId,getCapacitorConfig,getCurrentBundle,getStats,listBundles,listOrganizations,login,requestBuild,saveEncryptionKey,updateAppSetting,updateOrganization,uploadBundle,zipBundle});
|
|
347
|
+
`)}let i=await pe(t,e.supaHost,e.supaAnon),s=await De(i,t,["write","all","upload"]);await Ae(t,{channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:s,notify:!1}).catch(),r||(y.success(`login saved into .capgo file in ${n?"local":"home"} directory`),ce("Done \u2705"))}async function T6(t,e=!1){e||oe("Adding organization"),await ze();let r={...t,apikey:t.apikey||te()};if(!r.apikey)throw e||y.error("Missing API key, you need to provide an API key to add an organization"),new Error("Missing API key");let n=await pe(r.apikey,r.supaHost,r.supaAnon),i=await De(n,r.apikey,["write","all"]),{name:s,email:o}=r;if(!e&&!s){let c=await Do({message:"Organization name:",placeholder:"My Organization"});if(xt(c))throw y.error("Canceled adding organization"),new Error("Organization creation cancelled");s=c}if(!e&&!o){let c=await Do({message:"Management email:",placeholder:"admin@example.com"});if(xt(c))throw y.error("Canceled adding organization"),new Error("Organization creation cancelled");o=c}if(!s||!o)throw e||y.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||y.info(`Adding organization "${s}" to Capgo`);let{data:a,error:u}=await n.from("orgs").insert({name:s,management_email:o,created_by:i}).select().single();if(u)throw e||y.error(`Could not add organization ${W(u)}`),new Error(`Could not add organization: ${W(u)}`);return await Ae(r.apikey,{channel:"organization",event:"Organization Created",icon:"\u{1F3E2}",user_id:a.id,tags:{"org-name":s},notify:!1}).catch(()=>{}),e||(y.success(`Organization "${s}" added to Capgo`),ce("Done \u2705")),a}async function F6(t,e,r=!1){r||oe("Deleting organization"),await ze();let n={...e,apikey:e.apikey||te()};if(!n.apikey)throw r||y.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||y.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let i=await pe(n.apikey,n.supaHost,n.supaAnon),s=await De(i,n.apikey,["write","all"]),{data:o,error:a}=await i.from("orgs").select("created_by, name").eq("id",t).single();if(a||!o)throw r||y.error(`Cannot get organization details ${W(a)}`),new Error(`Cannot get organization details: ${W(a)}`);if(o.created_by!==s){if(r)throw new Error("Deleting an organization is restricted to the organization owner");y.warn("Deleting an organization is restricted to the organization owner"),y.warn("You are not the owner of this organization"),y.warn("It's strongly recommended that you do not continue!");let c=await wo({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(xt(c)||c==="no")throw y.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await $r({message:`Are you sure you want to delete organization "${o.name}"? This action cannot be undone.`});if(xt(c)||!c)throw y.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||y.info(`Deleting organization "${o.name}"`);let{error:u}=await i.from("orgs").delete().eq("id",t);if(u)throw r||y.error(`Could not delete organization ${W(u)}`),new Error(`Could not delete organization: ${W(u)}`);return await Ae(n.apikey,{channel:"organization",event:"Organization Deleted",icon:"\u{1F5D1}\uFE0F",user_id:t,tags:{"org-name":o.name},notify:!1}).catch(()=>{}),r||(y.success(`Organization "${o.name}" deleted from Capgo`),ce("Done \u2705")),!0}function jhe(t,e){if(e)return;if(!t.length){y.error("No organizations found");return}let r=new Ht;r.headers=["Name","ID","Role","Apps"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name??"Unknown",n.gid,n.role,n.app_count?.toString()||"0"]);y.success("Organizations"),y.success(r.toString())}async function I6(t,e=!1){e||oe("List organizations"),await ze();let r={...t,apikey:t.apikey||te()};if(!r.apikey)throw e||y.error("Missing API key, you need to provide an API key to list organizations"),new Error("Missing API key");let n=await pe(r.apikey,r.supaHost,r.supaAnon);await De(n,r.apikey,["read","write","all"]),e||y.info("Getting organizations from Capgo");let{error:i,data:s}=await n.rpc("get_orgs_v6");if(i)throw e||y.error(`Cannot get organizations ${W(i)}`),new Error(`Cannot get organizations: ${W(i)}`);let o=s||[];return e||(y.info(`Organizations found: ${o.length}`),jhe(o,e),ce("Done \u2705")),o}async function P6(t,e,r=!1){r||oe("Updating organization"),await ze();let n={...e,apikey:e.apikey||te()};if(!n.apikey)throw r||y.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||y.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let i=await pe(n.apikey,n.supaHost,n.supaAnon);await De(i,n.apikey,["write","all"]);let{data:s,error:o}=await i.from("orgs").select("name, management_email, created_by").eq("id",t).single();if(o||!s)throw r||y.error(`Cannot get organization details ${W(o)}`),new Error(`Cannot get organization details: ${W(o)}`);let{name:a,email:u}=n;if(!r&&!a){let l=await Do({message:"New organization name:",placeholder:s.name||"My Organization"});if(xt(l))throw y.error("Canceled updating organization"),new Error("Organization update cancelled");a=l}if(!r&&!u){let l=await Do({message:"Management email:",placeholder:s.management_email||"admin@example.com"});if(xt(l))throw y.error("Canceled updating organization"),new Error("Organization update cancelled");u=l}if(!a||!u)throw r||y.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||y.info(`Updating organization "${t}"`);let{error:c}=await i.from("orgs").update({name:a,management_email:u}).eq("id",t);if(c)throw r||y.error(`Could not update organization ${W(c)}`),new Error(`Could not update organization: ${W(c)}`);return await Ae(n.apikey,{channel:"organization",event:"Organization Updated",icon:"\u270F\uFE0F",user_id:t,tags:{"org-name":a},notify:!1}).catch(()=>{}),r||(y.success("Organization updated"),ce("Done \u2705")),{orgId:t,name:a,email:u}}async function k6(t,e=!1){e||oe("Getting user id");let r={...t,apikey:t.apikey||te()};if(!r.apikey)throw e||y.error("Missing API key, you need to provide an API key to fetch the user id"),new Error("Missing API key");try{let n=await pe(r.apikey,r.supaHost,r.supaAnon),i=await De(n,r.apikey,["read","all","write"]);return e||ce(`Done \u2705: ${i}`),i}catch(n){throw e||y.error(`Error getting user id ${W(n)}`),n instanceof Error?n:new Error(String(n))}}var tt=class{apikey;supaHost;supaAnon;constructor(e){this.apikey=e?.apikey,this.supaHost=e?.supaHost,this.supaAnon=e?.supaAnon}async login(e){try{return await x6(e.apikey,{local:e.local??!1,supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon},!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async doctor(e){try{return{success:!0,data:await bM({packageJson:e?.packageJson},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async addApp(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,icon:e.icon};return await gM(e.appId,r,void 0,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async updateApp(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,icon:e.icon,retention:e.retention};return await _M(e.appId,r,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteApp(e,r=!1){try{let n={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return await yM(e,n,!1,r),{success:!0}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async listApps(){try{let e={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:(await vM(e,!1)).map(i=>({appId:i.app_id,name:i.name||"Unknown",iconUrl:i.icon_url||void 0,createdAt:new Date(i.created_at||"")}))}}catch(e){return{success:!1,error:e instanceof Error?e.message:String(e)}}}async getAccountId(e){try{let r={apikey:e?.apikey||this.apikey||te(!0),supaHost:e?.supaHost||this.supaHost,supaAnon:e?.supaAnon||this.supaAnon};return{success:!0,data:await k6(r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async checkBundleCompatibility(e){try{let r={apikey:e.apikey||this.apikey||te(!0),channel:e.channel,text:e.textOutput??!1,packageJson:e.packageJson,nodeModules:e.nodeModules,supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon};return{success:!0,data:(await PM(e.appId,r,!0)).finalCompatibility}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async encryptBundle(e){try{return{success:!0,data:await BM(e.zipPath,e.checksum,{key:e.keyPath,keyData:e.keyData,json:e.json},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async decryptBundle(e){try{return{success:!0,data:await LM(e.zipPath,e.ivSessionKey,{key:e.keyPath,keyData:e.keyData,checksum:e.checksum},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async zipBundle(e){try{return{success:!0,data:await g6(e.appId,{apikey:this.apikey||te(!0),path:e.path,bundle:e.bundle,name:e.name,codeCheck:e.codeCheck,json:e.json,keyV2:e.keyV2,packageJson:e.packageJson},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async uploadBundle(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,path:e.path,bundle:e.bundle,channel:e.channel,external:e.external,key:e.encrypt!==!1,keyV2:e.encryptionKey,timeout:e.timeout,tus:e.useTus,comment:e.comment,minUpdateVersion:e.minUpdateVersion,autoMinUpdateVersion:e.autoMinUpdateVersion,selfAssign:e.selfAssign,packageJson:e.packageJsonPaths,ignoreMetadataCheck:e.ignoreCompatibilityCheck,codeCheck:!e.disableCodeCheck,zip:e.useZip},n=await d6(e.appId,r,!0);return{success:n.success,bundleId:n.bundle,checksum:n.checksum??null,encryptionMethod:n.encryptionMethod,sessionKey:n.sessionKey,ivSessionKey:n.ivSessionKey,storageProvider:n.storageProvider,skipped:n.skipped,reason:n.reason}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async listBundles(e){try{let r=this.apikey||te(!0),n=await pe(r,this.supaHost,this.supaAnon);return{success:!0,data:(await Hp(n,e)).map(o=>({id:o.id.toString(),version:o.name,uploadedAt:new Date(o.created_at||""),size:0,encrypted:o.session_key!==null}))}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteBundle(e,r){try{let n={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,bundle:r};return await jM(r,e,n,!0),{success:!0}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async cleanupBundles(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,bundle:e.bundle||"",version:"",keep:e.keep||4,force:e.force||!1,ignoreChannel:e.ignoreChannel||!1};return{success:!0,data:await IM(e.appId,r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async requestBuild(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,path:e.path,lane:e.lane,credentials:e.credentials,userId:e.userId},n=await FM(e.appId,r,!0);return n.success&&n.jobId?{success:!0,data:{jobId:n.jobId,uploadUrl:n.uploadUrl||"",status:n.status||"unknown"}}:{success:!1,error:n.error||"Unknown error during build request"}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async getCurrentBundle(e,r,n){try{let i={apikey:n?.apikey||this.apikey||te(!0),quiet:!0,supaHost:n?.supaHost||this.supaHost,supaAnon:n?.supaAnon||this.supaAnon};return{success:!0,data:await D6(r,e,i,!0)}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}async addChannel(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,default:e.default,selfAssign:e.selfAssign};return await y6(e.channelId,e.appId,r,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async updateChannel(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,bundle:e.bundle??void 0,state:e.state,downgrade:e.downgrade,ios:e.ios,android:e.android,selfAssign:e.selfAssign,disableAutoUpdate:e.disableAutoUpdate??void 0,dev:e.dev,emulator:e.emulator,latest:!1,latestRemote:!1,packageJson:void 0,ignoreMetadataCheck:!1};return await E6(e.channelId,e.appId,r,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteChannel(e,r,n=!1){try{let i={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,deleteBundle:n,successIfNotFound:!1};return await w6(e,r,i,!0),{success:!0}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}async listChannels(e){try{let r={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:await b6(e,r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async generateEncryptionKeys(e){try{return await A6({force:e?.force,setupChannel:e?.setupChannel},!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async saveEncryptionKey(e){try{return await C6({key:e?.keyPath,keyData:e?.keyData,setupChannel:e?.setupChannel},!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteLegacyEncryptionKey(e){try{return{success:!0,data:{deleted:await S6({force:e?.force,setupChannel:e?.setupChannel},!0)}}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async listOrganizations(e){try{let r={apikey:e?.apikey||this.apikey||te(!0),supaHost:e?.supaHost||this.supaHost,supaAnon:e?.supaAnon||this.supaAnon};return{success:!0,data:(await I6(r,!0)).map(s=>({id:String(s.id??s.gid??""),name:s.name??"Unknown",role:s.role??void 0,appCount:typeof s.app_count=="number"?s.app_count:void 0,email:s.management_email??void 0,createdAt:s.created_at?new Date(s.created_at):void 0}))}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async addOrganization(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,email:e.email},n=await T6(r,!0);return{success:!0,data:{id:String(n.id??n.gid??""),name:n.name??e.name,role:"owner",appCount:0,email:n.management_email??e.email,createdAt:n.created_at?new Date(n.created_at):void 0}}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async updateOrganization(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,email:e.email},n=await P6(e.orgId,r,!0);return{success:!0,data:{id:n.orgId,name:n.name,email:n.email}}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteOrganization(e,r){try{let n={apikey:r?.apikey||this.apikey||te(!0),supaHost:r?.supaHost||this.supaHost,supaAnon:r?.supaAnon||this.supaAnon,autoConfirm:r?.autoConfirm??!0};return{success:!0,data:{deleted:await F6(e,n,!0)}}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async getStats(e){try{let r=e.apikey||this.apikey||te(!0),n=await wn(),i={appId:e.appId,devicesId:e.deviceIds,search:e.search,order:e.order,rangeStart:e.after||e.rangeStart,rangeEnd:e.rangeEnd,limit:e.limit},s=await fetch(`${n.hostApi}/private/stats`,{method:"POST",headers:{"Content-Type":"application/json",capgkey:r},body:JSON.stringify(i)});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return{success:!0,data:(await s.json()).map(u=>({appId:u.app_id,deviceId:u.device_id,action:u.action,versionId:u.version_id,version:u.version,createdAt:u.created_at}))}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async setAppSetting(e,r){try{return await CM(e,{apikey:r.apikey||this.apikey||te(!0),bool:r.bool,string:r.string},!0),{success:!0}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}};async function Bhe(t){return new tt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).uploadBundle(t)}async function Mhe(t){return new tt({supaHost:t.supaHost,supaAnon:t.supaAnon}).login(t)}async function qhe(t){return new tt().doctor(t)}async function Uhe(t){return new tt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).checkBundleCompatibility(t)}async function Hhe(t){return new tt().encryptBundle(t)}async function Vhe(t){return new tt().decryptBundle(t)}async function zhe(t){return new tt().zipBundle(t)}async function Ghe(t){return new tt().generateEncryptionKeys(t)}async function Khe(t){return new tt().saveEncryptionKey(t)}async function Whe(t){return new tt().deleteLegacyEncryptionKey(t)}async function Xhe(t,e,r){return new tt({apikey:r?.apikey,supaHost:r?.supaHost,supaAnon:r?.supaAnon}).getCurrentBundle(t,e,r)}async function Yhe(t,e){return new tt({apikey:e.apikey}).setAppSetting(t,e)}async function Jhe(t){return new tt({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).getAccountId(t)}async function Zhe(t){return new tt({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).listOrganizations(t)}async function Qhe(t){return new tt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addOrganization(t)}async function ede(t){return new tt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).updateOrganization(t)}async function tde(t,e){return new tt({apikey:e?.apikey,supaHost:e?.supaHost,supaAnon:e?.supaAnon}).deleteOrganization(t,e)}async function rde(t){return new tt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addApp(t)}async function nde(t,e){return new tt(e).listBundles(t)}async function ide(t){return new tt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addChannel(t)}async function sde(t){return new tt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).requestBuild(t)}async function ode(t){return new tt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).getStats(t)}async function ade(){try{return await de()}catch{return null}}0&&(module.exports={CapgoSDK,addApp,addChannel,addOrganization,checkBundleCompatibility,createSupabaseClient,decryptBundle,deleteLegacyEncryptionKey,deleteOrganization,doctor,encryptBundle,generateEncryptionKeys,getAccountId,getCapacitorConfig,getCurrentBundle,getStats,listBundles,listOrganizations,login,requestBuild,saveEncryptionKey,updateAppSetting,updateOrganization,uploadBundle,zipBundle});
|
|
348
348
|
/*! Bundled license information:
|
|
349
349
|
|
|
350
350
|
tus-js-client/lib.es5/upload.js:
|