@capgo/cli 7.26.0 → 7.26.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/dist/index.js +14 -14
- package/dist/package.json +1 -1
- package/dist/src/bundle/partial.d.ts.map +1 -1
- package/dist/src/sdk.js +25 -25
- package/package.json +1 -1
package/dist/src/sdk.js
CHANGED
|
@@ -37,16 +37,16 @@ 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`${v}
|
|
39
39
|
${S}`}});var zC=b(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.WebAuthnUnknownError=zn.WebAuthnError=void 0;zn.isWebAuthnError=R9;zn.identifyRegistrationError=N9;zn.identifyAuthenticationError=$9;var VC=Fy(),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 Ty=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=Ty;function R9(t){return typeof t=="object"&&t!==null&&"__isWebAuthnError"in t}function N9({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,VC.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 $9({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,VC.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 Fy=b(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=j9;Se.deserializeCredentialRequestOptions=B9;Se.serializeCredentialCreationResponse=M9;Se.serializeCredentialRequestResponse=q9;Se.isValidDomain=U9;Se.createCredential=WC;Se.getCredential=XC;Se.mergeCredentialCreationOptions=YC;Se.mergeCredentialRequestOptions=JC;var KC=(fe(),ue(le)),rn=mf(),dn=ls(),L9=ko(),pn=zC();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 Ef=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=Ef;Se.webAuthnAbortService=new Ef;function j9(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=KC.__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 B9(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=KC.__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 M9(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 q9(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 U9(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function GC(){var t,e;return!!((0,L9.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 WC(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 XC(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 _f(...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]=_f(a,o):n[s]=_f(o)}else n[s]=o}return n}function YC(t,e){return _f(Se.DEFAULT_CREATION_OPTIONS,t,e||{})}function JC(t,e){return _f(Se.DEFAULT_REQUEST_OPTIONS,t,e||{})}var Iy=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=YC(o.webauthn.credential_options.publicKey,s?.create),{data:l,error:h}=await WC({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=JC(o.webauthn.credential_options.publicKey,s?.request),{data:l,error:h}=await XC(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(!GC())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(!GC())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=Iy});var Py=b(ky=>{"use strict";Object.defineProperty(ky,"__esModule",{value:!0});var H9=(fe(),ue(le)),V9=H9.__importDefault(wf()),Dr=df(),ee=ls(),he=by(),se=ko(),ZC=BC(),QC=Oy(),z9=qC(),G9=sy(),eS=mf(),Cf=HC(),Fu=Fy();(0,z9.polyfillGlobalThis)();var K9={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 tS(t,e,r){return await r()}var Ro={},Sf=class t{get jwks(){var e,r;return(r=(e=Ro[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){Ro[this.storageKey]=Object.assign(Object.assign({},Ro[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=Ro[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Ro[this.storageKey]=Object.assign(Object.assign({},Ro[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({},K9),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 V9.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||tS,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=QC.navigatorLock:this.lock=tS,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 Fu.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,ZC.memoryLocalStorageAdapter)(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=(0,ZC.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} (${G9.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:v,statement:S,options:A}=e,p;if((0,se.isBrowser)())if(typeof v=="object")p=v;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 v!="object"||!A?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");p=v}let y=new URL((r=A?.url)!==null&&r!==void 0?r:window.location.href),D=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(!D||D.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");let C=(0,Cf.getAddress)(D[0]),k=(n=A?.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!k){let R=await p.request({method:"eth_chainId"});k=(0,Cf.fromHex)(R)}let E={domain:y.host,address:C,statement:S,uri:y.href,version:"1",chainId:k,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,Cf.createSiweMessage)(E),m=await p.request({method:"personal_sign",params:[(0,Cf.toHex)(f),C]})}try{let{data:g,error:v}=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(v)throw v;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:v})}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:v,wallet:S,statement:A,options:p}=e,y;if((0,se.isBrowser)())if(typeof S=="object")y=S;else{let C=window;if("solana"in C&&typeof C.solana=="object"&&("signIn"in C.solana&&typeof C.solana.signIn=="function"||"signMessage"in C.solana&&typeof C.solana.signMessage=="function"))y=C.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 D=new URL((r=p?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in y&&y.signIn){let C=await y.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},p?.signInWithSolana),{version:"1",domain:D.host,uri:D.href}),A?{statement:A}:null)),k;if(Array.isArray(C)&&C[0]&&typeof C[0]=="object")k=C[0];else if(C&&typeof C=="object"&&"signedMessage"in C&&"signature"in C)k=C;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in k&&"signature"in k&&(typeof k.signedMessage=="string"||k.signedMessage instanceof Uint8Array)&&k.signature instanceof Uint8Array)m=typeof k.signedMessage=="string"?k.signedMessage:new TextDecoder().decode(k.signedMessage),g=k.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=[`${D.host} wants you to sign in with your Solana account:`,y.publicKey.toBase58(),...A?["",A,""]:[""],"Version: 1",`URI: ${D.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(k=>`- ${k}`)]:[]].join(`
|
|
40
|
-
`);let C=await y.signMessage(new TextEncoder().encode(m),"utf8");if(!C||!(C instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=C}}try{let{data:v,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,eS.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(!v||!v.session||!v.user){let A=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:A})}return v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),this._returnResult({data:Object.assign({},v),error:S})}catch(v){if((0,ee.isAuthError)(v))return this._returnResult({data:{user:null,session:null},error:v});throw v}}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:v}=await this._getUser(s);if(v)throw v;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 QC.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,Fu.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,Fu.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,Fu.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,Fu.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,eS.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}}};Sf.nextInstanceID=0;ky.default=Sf});var rS=b(Ry=>{"use strict";Object.defineProperty(Ry,"__esModule",{value:!0});var W9=(fe(),ue(le)),X9=W9.__importDefault(wf()),Y9=X9.default;Ry.default=Y9});var nS=b(Ny=>{"use strict";Object.defineProperty(Ny,"__esModule",{value:!0});var J9=(fe(),ue(le)),Z9=J9.__importDefault(Py()),Q9=Z9.default;Ny.default=Q9});var $y=b(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 No=(fe(),ue(le)),e7=No.__importDefault(wf());At.GoTrueAdminApi=e7.default;var t7=No.__importDefault(Py());At.GoTrueClient=t7.default;var r7=No.__importDefault(rS());At.AuthAdminApi=r7.default;var n7=No.__importDefault(nS());At.AuthClient=n7.default;No.__exportStar(Ey(),At);No.__exportStar(ls(),At);var Af=Oy();Object.defineProperty(At,"navigatorLock",{enumerable:!0,get:function(){return Af.navigatorLock}});Object.defineProperty(At,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return Af.NavigatorLockAcquireTimeoutError}});Object.defineProperty(At,"lockInternals",{enumerable:!0,get:function(){return Af.internals}});Object.defineProperty(At,"processLock",{enumerable:!0,get:function(){return Af.processLock}})});var iS=b(Of=>{"use strict";Object.defineProperty(Of,"__esModule",{value:!0});Of.SupabaseAuthClient=void 0;var i7=$y(),Ly=class extends i7.AuthClient{constructor(e){super(e)}};Of.SupabaseAuthClient=Ly});var My=b(By=>{"use strict";Object.defineProperty(By,"__esModule",{value:!0});var s7=Mm(),o7=ng(),a7=bg(),u7=SC(),xf=OC(),c7=xC(),sS=FC(),l7=iS(),jy=class{constructor(e,r,n){var i,s,o;this.supabaseUrl=e,this.supabaseKey=r;let a=(0,sS.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:xf.DEFAULT_DB_OPTIONS,realtime:xf.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},xf.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:xf.DEFAULT_GLOBAL_OPTIONS},l=(0,sS.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,c7.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 o7.PostgrestClient(new URL("rest/v1",a).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new u7.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new s7.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 l7.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 a7.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)}};By.default=jy});var uS=b(Ve=>{"use strict";var f7=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]})),oS=Ve&&Ve.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&f7(e,t,r)},aS=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 h7=aS(My());oS($y(),Ve);var d7=ng();Object.defineProperty(Ve,"PostgrestError",{enumerable:!0,get:function(){return d7.PostgrestError}});var Iu=Mm();Object.defineProperty(Ve,"FunctionsHttpError",{enumerable:!0,get:function(){return Iu.FunctionsHttpError}});Object.defineProperty(Ve,"FunctionsFetchError",{enumerable:!0,get:function(){return Iu.FunctionsFetchError}});Object.defineProperty(Ve,"FunctionsRelayError",{enumerable:!0,get:function(){return Iu.FunctionsRelayError}});Object.defineProperty(Ve,"FunctionsError",{enumerable:!0,get:function(){return Iu.FunctionsError}});Object.defineProperty(Ve,"FunctionRegion",{enumerable:!0,get:function(){return Iu.FunctionRegion}});oS(bg(),Ve);var p7=My();Object.defineProperty(Ve,"SupabaseClient",{enumerable:!0,get:function(){return aS(p7).default}});var m7=(t,e,r)=>new h7.default(t,e,r);Ve.createClient=m7;function g7(){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}g7()&&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 qy=b((wge,cS)=>{cS.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 Tf=b(fS=>{var lS={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 y7(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(lS))fS[t]=y7(lS[t])});var gS=b((bge,mS)=>{var D7=require("fs"),Tt=require("path"),hS=qy(),w7=Tf(),v7=typeof process=="object"&&process.platform==="win32",dS=t=>typeof t=="object"&&t!==null,pS=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=D7,dS(t)&&dS(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}mS.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 w7.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 pS[(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 hS.STORED:return"STORED ("+t+")";case hS.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=v7;dt.crcTable=pS});var DS=b((Ege,yS)=>{var b7=require("path");yS.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=b7.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 vS=b((_ge,wS)=>{wS.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var Lo=b((Cge,$o)=>{$o.exports=gS();$o.exports.Constants=qy();$o.exports.Errors=Tf();$o.exports.FileAttr=DS();$o.exports.decoder=vS()});var ES=b((Sge,bS)=>{var Oi=Lo(),X=Oi.Constants;bS.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},v=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=v(p)},get timeHighByte(){return A(i>>>8)},get crc(){return s},set crc(p){s=v(p)},get compressedSize(){return o},set compressedSize(p){o=v(p)},get size(){return a},set size(p){a=v(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=v(p)},get inAttr(){return d},set inAttr(p){d=v(p)},get attr(){return f},set attr(p){f=v(p)},get fileAttr(){return(f||0)>>16&4095},get offset(){return m},set offset(p){m=v(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 D=m+X.LOCHDR+g.fnameLen,C=D+g.extraLen;return p.slice(D,C)},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 CS=b((Age,_S)=>{var jo=Lo(),ut=jo.Constants;_S.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 jo.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=jo.readBigUInt64LE(s,ut.ZIP64SUB),e=jo.readBigUInt64LE(s,ut.ZIP64TOT),r=jo.readBigUInt64LE(s,ut.ZIP64SIZE),n=jo.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 Hy=b(Uy=>{Uy.EntryHeader=ES();Uy.MainHeader=CS()});var AS=b((xge,SS)=>{SS.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 xS=b((Tge,OS)=>{var E7=+(process.versions?process.versions.node:"").split(".")[0]||0;OS.exports=function(t,e){var r=require("zlib");let n=E7>=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 PS=b((Fge,kS)=>{"use strict";var{randomFillSync:TS}=require("crypto"),_7=Tf(),C7=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}),IS=(t,e)=>Math.imul(t,e)>>>0,FS=(t,e)=>C7[(t^e)&255]^t>>>8,ku=()=>typeof TS=="function"?TS(Buffer.alloc(12)):ku.node();ku.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 Ff={genSalt:ku};function If(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])}If.prototype.updateKeys=function(t){let e=this.keys;return e[0]=FS(e[0],t),e[1]+=e[0]&255,e[1]=IS(e[1],134775813)+1,e[2]=FS(e[2],e[1]>>>24),t};If.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return IS(t,t^1)>>8&255};function S7(t){let e=new If(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 A7(t){let e=new If(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 O7(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=S7(r),i=n(t.slice(0,12)),s=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(i[11]!==s)throw _7.WRONG_PASSWORD();return n(t.slice(12))}function x7(t){Buffer.isBuffer(t)&&t.length>=12?Ff.genSalt=function(){return t.slice(0,12)}:t==="node"?Ff.genSalt=ku.node:Ff.genSalt=ku}function T7(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let i=A7(r),s=Ff.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)}kS.exports={decrypt:O7,encrypt:T7,_salter:x7}});var RS=b(kf=>{kf.Deflater=AS();kf.Inflater=xS();kf.ZipCrypto=PS()});var zy=b((kge,NS)=>{var ke=Lo(),F7=Hy(),pt=ke.Constants,Vy=RS();NS.exports=function(t,e){var r=new F7.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:ke.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={},D=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(D)==pt.LOCSIG||e.readUInt32LE(D)==pt.CENSIG)throw ke.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(D)==pt.EXTSIG)y.crc=e.readUInt32LE(D+pt.EXTCRC),y.compressedSize=e.readUInt32LE(D+pt.EXTSIZ),y.size=e.readUInt32LE(D+pt.EXTLEN);else if(e.readUInt16LE(D+12)===19280)y.crc=e.readUInt32LE(D+pt.EXTCRC-4),y.compressedSize=e.readUInt32LE(D+pt.EXTSIZ-4),y.size=e.readUInt32LE(D+pt.EXTLEN-4);else throw ke.Errors.DESCRIPTOR_UNKNOWN();if(y.compressedSize!==r.compressedSize||y.size!==r.size||y.crc!==r.crc)throw ke.Errors.DESCRIPTOR_FAULTY();if(ke.crc32(p)!==y.crc)return!1}else if(ke.crc32(p)!==r.localHeader.crc)return!1;return!0}function m(p,y,D){if(typeof y>"u"&&typeof p=="string"&&(D=p,p=void 0),s)return p&&y&&y(Buffer.alloc(0),ke.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var C=d();if(C.length===0)return p&&y&&y(C),C;if(r.encrypted){if(typeof D!="string"&&!Buffer.isBuffer(D))throw ke.Errors.INVALID_PASS_PARAM();C=Vy.ZipCrypto.decrypt(C,r,D)}var k=Buffer.alloc(r.size);switch(r.method){case ke.Constants.STORED:if(C.copy(k),f(k))return p&&y&&y(k),k;throw p&&y&&y(k,ke.Errors.BAD_CRC()),ke.Errors.BAD_CRC();case ke.Constants.DEFLATED:var E=new Vy.Inflater(C,r.size);if(p)E.inflateAsync(function(R){R.copy(R,0),y&&(f(R)?y(R):y(R,ke.Errors.BAD_CRC()))});else{if(E.inflate(k).copy(k,0),!f(k))throw ke.Errors.BAD_CRC(`"${h.decode(n)}"`);return k}break;default:throw p&&y&&y(Buffer.alloc(0),ke.Errors.UNKNOWN_METHOD()),ke.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 D;switch(r.method){case ke.Constants.STORED:return r.compressedSize=r.size,D=Buffer.alloc(o.length),o.copy(D),p&&y&&y(D),D;default:case ke.Constants.DEFLATED:var C=new Vy.Deflater(o);if(p)C.deflateAsync(function(E){D=Buffer.alloc(E.length),r.compressedSize=E.length,E.copy(D),y&&y(D)});else{var k=C.deflate();return r.compressedSize=k.length,k}C=null;break}}else if(p&&y)y(Buffer.alloc(0));else return Buffer.alloc(0)}function v(p,y){return(p.readUInt32LE(y+4)<<4)+p.readUInt32LE(y)}function S(p){try{for(var y=0,D,C,k;y+4<p.length;)D=p.readUInt16LE(y),y+=2,C=p.readUInt16LE(y),y+=2,k=p.slice(y,y+C),y+=C,pt.ID_ZIP64===D&&A(k)}catch{throw ke.Errors.EXTRA_FIELD_PARSE_ERROR()}}function A(p){var y,D,C,k;p.length>=pt.EF_ZIP64_SCOMP&&(y=v(p,pt.EF_ZIP64_SUNCOMP),r.size===pt.EF_ZIP64_OR_32&&(r.size=y)),p.length>=pt.EF_ZIP64_RHO&&(D=v(p,pt.EF_ZIP64_SCOMP),r.compressedSize===pt.EF_ZIP64_OR_32&&(r.compressedSize=D)),p.length>=pt.EF_ZIP64_DSN&&(C=v(p,pt.EF_ZIP64_RHO),r.offset===pt.EF_ZIP64_OR_32&&(r.offset=C)),p.length>=pt.EF_ZIP64_DSN+4&&(k=p.readUInt32LE(pt.EF_ZIP64_DSN),r.diskNumStart===pt.EF_ZIP64_OR_16&&(r.diskNumStart=k))}return{get entryName(){return h.decode(n)},get rawEntryName(){return n},set entryName(p){n=ke.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=ke.toBuffer(p,h.encode),r.commentLength=i.length,i.length>65535)throw ke.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=ke.toBuffer(p,ke.decoder.encode),!s&&o.length?(r.size=o.length,r.method=ke.Constants.DEFLATED,r.crc=ke.crc32(p),r.changed=!0):r.method=ke.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=ke.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(),D=Buffer.alloc(y.length+n.length+r.extraLocalLength);return y.copy(D,p),p+=y.length,n.copy(D,p),p+=n.length,u.copy(D,p),p+=u.length,D},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 jS=b((Pge,LS)=>{var $S=zy(),I7=Hy(),Bt=Lo();LS.exports=function(t,e){var r=[],n={},i=Buffer.alloc(0),s=new I7.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 v=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("/")+"/";v.add(y)}}for(let S of v)if(!(S in n)){let A=new $S(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 v=s.offset,S=0;S<r.length;S++){var A=v,p=new $S(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)),v+=p.header.centralHeaderSize,r[S]=p,n[p.entryName]=p}u.clear(),d()}function m(v){var S=t.length-Bt.Constants.ENDHDR,A=Math.max(0,S-65535),p=A,y=t.length,D=-1,C=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){D=S,C=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){D=S,y=S+Bt.readBigUInt64LE(t,S+Bt.Constants.ZIP64SIZE)+Bt.Constants.ZIP64LEAD;break}}if(D==-1)throw Bt.Errors.INVALID_FORMAT();s.loadFromBinary(t.slice(D,y)),s.commentLength&&(i=t.slice(C+Bt.Constants.ENDHDR)),v&&f()}function g(){r.length>1&&!l&&r.sort((v,S)=>v.entryName.toLowerCase().localeCompare(S.entryName.toLowerCase()))}return{get entries(){return o||f(),r.filter(v=>!u.has(v))},get comment(){return h.decode(i)},set comment(v){i=Bt.toBuffer(v,h.encode),s.commentLength=i.length},getEntryCount:function(){return o?r.length:s.diskEntries},forEach:function(v){this.entries.forEach(v)},getEntry:function(v){return o||f(),n[v]||null},setEntry:function(v){o||f(),r.push(v),n[v.entryName]=v,s.totalEntries=r.length},deleteFile:function(v,S=!0){o||f();let A=n[v];this.getEntryChildren(A,S).map(y=>y.entryName).forEach(this.deleteEntry)},deleteEntry:function(v){o||f();let S=n[v],A=r.indexOf(S);A>=0&&(r.splice(A,1),delete n[v],s.totalEntries=r.length)},getEntryChildren:function(v,S=!0){if(o||f(),typeof v=="object")if(v.isDirectory&&S){let A=[],p=v.entryName;for(let y of r)y.entryName.startsWith(p)&&A.push(y);return A}else return[v];return[]},getChildCount:function(v){if(v&&v.isDirectory){let S=this.getEntryChildren(v);return S.includes(v)?S.length-1:S.length}return 0},compressToBuffer:function(){o||f(),g();let v=[],S=[],A=0,p=0;s.size=0,s.offset=0;let y=0;for(let k of this.entries){let E=k.getCompressedData();k.header.offset=p;let R=k.packLocalHeader(),P=R.length+E.length;p+=P,v.push(R),v.push(E);let F=k.packCentralHeader();S.push(F),s.size+=F.length,A+=P+F.length,y++}A+=s.mainHeaderSize,s.offset=p,s.totalEntries=y,p=0;let D=Buffer.alloc(A);for(let k of v)k.copy(D,p),p+=k.length;for(let k of S)k.copy(D,p),p+=k.length;let C=s.toBinary();return i&&i.copy(C,Bt.Constants.ENDHDR),C.copy(D,p),t=D,o=!1,D},toAsyncBuffer:function(v,S,A,p){try{o||f(),g();let y=[],D=[],C=0,k=0,E=0;s.size=0,s.offset=0;let R=function(P){if(P.length>0){let F=P.shift(),B=F.entryName+F.extra.toString();A&&A(B),F.getCompressedDataAsync(function(U){p&&p(B),F.header.offset=k;let G=F.packLocalHeader(),L=G.length+U.length;k+=L,y.push(G),y.push(U);let _=F.packCentralHeader();D.push(_),s.size+=_.length,C+=L+_.length,E++,R(P)})}else{C+=s.mainHeaderSize,s.offset=k,s.totalEntries=E,k=0;let F=Buffer.alloc(C);y.forEach(function(U){U.copy(F,k),k+=U.length}),D.forEach(function(U){U.copy(F,k),k+=U.length});let B=s.toBinary();i&&i.copy(B,Bt.Constants.ENDHDR),B.copy(F,k),t=F,o=!1,v(F)}};R(Array.from(this.entries))}catch(y){S(y)}}}}});var qS=b((Rge,MS)=>{var ct=Lo(),mt=require("path"),k7=zy(),P7=jS(),ps=(...t)=>ct.findLast(t,e=>typeof e=="boolean"),BS=(...t)=>ct.findLast(t,e=>typeof e=="string"),R7=(...t)=>ct.findLast(t,e=>typeof e=="function"),N7={noSort:!1,readEntries:!1,method:ct.Constants.NONE,fs:null};MS.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),N7);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 P7(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:v}=mt.posix;return m(".",g(v+f.split("\\").join(v)+v))}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 v=g.getData();if(v&&v.length)return v.toString(m||"utf8")}return""},readAsTextAsync:function(f,m,g){var v=c(f);v?v.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,v){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,v,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:v}=f,{zipPath:S,zipName:A}=f,p=this;i.fs.stat(g,function(y,D){if(y)return m(y,!1);S=S?l(S):"";let C=mt.win32.basename(mt.win32.normalize(g));if(S+=A||C,D.isFile())i.fs.readFile(g,function(k,E){return k?m(k,!1):(p.addFile(S,E,v,D),setImmediate(m,void 0,!0))});else if(D.isDirectory())return S+=i.sep,p.addFile(S,Buffer.alloc(0),v,D),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 v=i.findFiles(f),S=this;if(v.length)for(let A of v){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,v){v=h(v),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,D=function(){if(y+=1,y<p.length){var C=p[y],k=d(f,C).split("\\").join("/");k=k.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),v(k)?i.fs.stat(C,function(E,R){E&&m(void 0,E),R.isFile()?i.fs.readFile(C,function(P,F){P?m(void 0,P):(S.addFile(g+k,F,"",R),D())}):(S.addFile(g+k+"/",Buffer.alloc(0),"",R),D())}):process.nextTick(()=>{D()})}else m(!0,void 0)};D()}})},addLocalFolderAsync2:function(f,m){let g=this;f=typeof f=="object"?f:{localPath:f},localPath=mt.resolve(l(f.localPath));let{zipPath:v,filter:S,namefix:A}=f;S instanceof RegExp?S=(function(D){return function(C){return D.test(C)}})(S):typeof S!="function"&&(S=function(){return!0}),v=v?l(v):"",A=="latin1"&&(A=D=>D.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof A!="function"&&(A=D=>D);let p=D=>mt.join(v,A(d(localPath,D))),y=D=>mt.win32.basename(mt.win32.normalize(A(D)));i.fs.open(localPath,"r",function(D){D&&D.code==="ENOENT"?m(void 0,ct.Errors.FILE_NOT_FOUND(localPath)):D?m(void 0,D):i.findFilesAsync(localPath,function(C,k){if(C)return m(C);k=k.filter(E=>S(p(E))),k.length||m(void 0,!1),setImmediate(k.reverse().reduce(function(E,R){return function(P,F){if(P||F===!1)return setImmediate(E,P,!1);g.addLocalFileAsync({localPath:R,zipPath:mt.dirname(p(R)),zipName:y(R)},E)}},m))})})},addLocalFolderPromise:function(f,m){return new Promise((g,v)=>{this.addLocalFolderAsync2(Object.assign({localPath:f},m),(S,A)=>{S&&v(S),A&&g(this)})})},addFile:function(f,m,g,v){f=u(f);let S=c(f),A=S!=null;A||(S=new k7(n),S.entryName=f),S.comment=g||"";let p=typeof v=="object"&&v instanceof i.fs.Stats;p&&(S.header.time=v.mtime);var y=S.isDirectory?16:0;let D=S.isDirectory?16384:32768;return p?D|=4095&v.mode:typeof v=="number"?D|=4095&v:D|=S.isDirectory?493:420,y=(y|D<<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,v,S,A){v=ps(!1,v),S=ps(!1,S),g=ps(!0,g),A=BS(S,A);var p=c(f);if(!p)throw ct.Errors.NO_ENTRY();var y=o(p.entryName),D=a(m,A&&!p.isDirectory?A:g?y:mt.basename(y));if(p.isDirectory){var C=s.getEntryChildren(p);return C.forEach(function(R){if(R.isDirectory)return;var P=R.getData();if(!P)throw ct.Errors.CANT_EXTRACT_FILE();var F=o(R.entryName),B=a(m,g?F:mt.basename(F));let U=S?R.header.fileAttr:void 0;i.writeFileTo(B,P,v,U)}),!0}var k=p.getData(s.password);if(!k)throw ct.Errors.CANT_EXTRACT_FILE();if(i.fs.existsSync(D)&&!v)throw ct.Errors.CANT_OVERRIDE();let E=S?f.header.fileAttr:void 0;return i.writeFileTo(D,k,v,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,v){if(g=ps(!1,g),v=BS(g,v),m=ps(!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(v);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,v){if(v=R7(m,g,v),g=ps(!1,g),m=ps(!1,m),!v)return new Promise((D,C)=>{this.extractAllToAsync(f,m,g,function(k){k?C(k):D(this)})});if(!s){v(ct.Errors.NO_ZIP());return}f=mt.resolve(f);let S=D=>a(f,mt.normalize(o(D.entryName))),A=(D,C)=>new Error(D+': "'+C+'"'),p=[],y=[];s.entries.forEach(D=>{D.isDirectory?p.push(D):y.push(D)});for(let D of p){let C=S(D),k=g?D.header.fileAttr:void 0;try{i.makeDir(C),k&&i.fs.chmodSync(C,k),i.fs.utimesSync(C,D.header.time,D.header.time)}catch{v(A("Unable to create folder",C))}}y.reverse().reduce(function(D,C){return function(k){if(k)D(k);else{let E=mt.normalize(o(C.entryName)),R=a(f,E);C.getDataAsync(function(P,F){if(F)D(F);else if(!P)D(ct.Errors.CANT_EXTRACT_FILE());else{let B=g?C.header.fileAttr:void 0;i.writeFileToAsync(R,P,m,B,function(U){U||D(A("Unable to write file",R)),i.fs.utimes(R,C.header.time,C.header.time,function(G){G?D(A("Unable to set times",R)):D()})})}})}}},v)()},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 v=i.writeFileTo(f,g,!0);typeof m=="function"&&m(v?null:new Error("failed"),"")}}},writeZipPromise:function(f,m){let{overwrite:g,perm:v}=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=D=>D?S(D):A("ADM-ZIP: Wasn't able to write zip file");i.writeFileToAsync(f,p,g,v,y)},A)})},toBufferPromise:function(){return new Promise((f,m)=>{s.toAsyncBuffer(f,m)})},toBuffer:function(f,m,g,v){return typeof f=="function"?(s.toAsyncBuffer(f,m,g,v),null):s.compressToBuffer()}}}});var zS=b((Nge,VS)=>{var HS={};VS.exports=HS;var US={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(US).forEach(function(t){var e=US[t],r=HS[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var KS=b(($ge,GS)=>{"use strict";GS.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 XS=b((Lge,WS)=>{"use strict";var $7=require("os"),nn=KS(),rr=process.env,Bo=void 0;nn("no-color")||nn("no-colors")||nn("color=false")?Bo=!1:(nn("color")||nn("colors")||nn("color=true")||nn("color=always"))&&(Bo=!0);"FORCE_COLOR"in rr&&(Bo=rr.FORCE_COLOR.length===0||parseInt(rr.FORCE_COLOR,10)!==0);function L7(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function j7(t){if(Bo===!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&&Bo!==!0)return 0;var e=Bo?1:0;if(process.platform==="win32"){var r=$7.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 Gy(t){var e=j7(t);return L7(e)}WS.exports={supportsColor:Gy,stdout:Gy(process.stdout),stderr:Gy(process.stderr)}});var JS=b((jge,YS)=>{YS.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 QS=b((Bge,ZS)=>{ZS.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],v=0;v<=h[g];v++)c[g]&&(l=l+n[g][s(n[g].length)])}return l}return a(e,r)}});var tA=b((Mge,eA)=>{eA.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 nA=b((qge,rA)=>{rA.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var sA=b((Uge,iA)=>{iA.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 aA=b((Hge,oA)=>{oA.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 dA=b((zge,hA)=>{var ve={};hA.exports=ve;ve.themes={};var B7=require("util"),ms=ve.styles=zS(),cA=Object.defineProperties,M7=new RegExp(/[\r\n]+/g);ve.supportsColor=XS().supportsColor;typeof ve.enabled>"u"&&(ve.enabled=ve.supportsColor()!==!1);ve.enable=function(){ve.enabled=!0};ve.disable=function(){ve.enabled=!1};ve.stripColors=ve.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var Vge=ve.stylize=function(e,r){if(!ve.enabled)return e+"";var n=ms[r];return!n&&r in ve?ve[r](e):n.open+e+n.close},q7=/[|\\{}()[\]^$+*?.]/g,U7=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(q7,"\\$&")};function lA(t){var e=function r(){return V7.apply(r,arguments)};return e._styles=t,e.__proto__=H7,e}var fA=(function(){var t={};return ms.grey=ms.gray,Object.keys(ms).forEach(function(e){ms[e].closeRe=new RegExp(U7(ms[e].close),"g"),t[e]={get:function(){return lA(this._styles.concat(e))}}}),t})(),H7=cA(function(){},fA);function V7(){var t=Array.prototype.slice.call(arguments),e=t.map(function(o){return o!=null&&o.constructor===String?o:B7.inspect(o)}).join(" ");if(!ve.enabled||!e)return e;for(var r=e.indexOf(`
|
|
40
|
+
`);let C=await y.signMessage(new TextEncoder().encode(m),"utf8");if(!C||!(C instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=C}}try{let{data:v,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,eS.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(!v||!v.session||!v.user){let A=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:A})}return v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),this._returnResult({data:Object.assign({},v),error:S})}catch(v){if((0,ee.isAuthError)(v))return this._returnResult({data:{user:null,session:null},error:v});throw v}}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:v}=await this._getUser(s);if(v)throw v;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 QC.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,Fu.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,Fu.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,Fu.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,Fu.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,eS.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}}};Sf.nextInstanceID=0;ky.default=Sf});var rS=b(Ry=>{"use strict";Object.defineProperty(Ry,"__esModule",{value:!0});var W9=(fe(),ue(le)),X9=W9.__importDefault(wf()),Y9=X9.default;Ry.default=Y9});var nS=b(Ny=>{"use strict";Object.defineProperty(Ny,"__esModule",{value:!0});var J9=(fe(),ue(le)),Z9=J9.__importDefault(Py()),Q9=Z9.default;Ny.default=Q9});var $y=b(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 No=(fe(),ue(le)),e7=No.__importDefault(wf());At.GoTrueAdminApi=e7.default;var t7=No.__importDefault(Py());At.GoTrueClient=t7.default;var r7=No.__importDefault(rS());At.AuthAdminApi=r7.default;var n7=No.__importDefault(nS());At.AuthClient=n7.default;No.__exportStar(Ey(),At);No.__exportStar(ls(),At);var Af=Oy();Object.defineProperty(At,"navigatorLock",{enumerable:!0,get:function(){return Af.navigatorLock}});Object.defineProperty(At,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return Af.NavigatorLockAcquireTimeoutError}});Object.defineProperty(At,"lockInternals",{enumerable:!0,get:function(){return Af.internals}});Object.defineProperty(At,"processLock",{enumerable:!0,get:function(){return Af.processLock}})});var iS=b(Of=>{"use strict";Object.defineProperty(Of,"__esModule",{value:!0});Of.SupabaseAuthClient=void 0;var i7=$y(),Ly=class extends i7.AuthClient{constructor(e){super(e)}};Of.SupabaseAuthClient=Ly});var My=b(By=>{"use strict";Object.defineProperty(By,"__esModule",{value:!0});var s7=Mm(),o7=ng(),a7=bg(),u7=SC(),xf=OC(),c7=xC(),sS=FC(),l7=iS(),jy=class{constructor(e,r,n){var i,s,o;this.supabaseUrl=e,this.supabaseKey=r;let a=(0,sS.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:xf.DEFAULT_DB_OPTIONS,realtime:xf.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},xf.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:xf.DEFAULT_GLOBAL_OPTIONS},l=(0,sS.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,c7.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 o7.PostgrestClient(new URL("rest/v1",a).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new u7.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new s7.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 l7.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 a7.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)}};By.default=jy});var uS=b(Ve=>{"use strict";var f7=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]})),oS=Ve&&Ve.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&f7(e,t,r)},aS=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 h7=aS(My());oS($y(),Ve);var d7=ng();Object.defineProperty(Ve,"PostgrestError",{enumerable:!0,get:function(){return d7.PostgrestError}});var Iu=Mm();Object.defineProperty(Ve,"FunctionsHttpError",{enumerable:!0,get:function(){return Iu.FunctionsHttpError}});Object.defineProperty(Ve,"FunctionsFetchError",{enumerable:!0,get:function(){return Iu.FunctionsFetchError}});Object.defineProperty(Ve,"FunctionsRelayError",{enumerable:!0,get:function(){return Iu.FunctionsRelayError}});Object.defineProperty(Ve,"FunctionsError",{enumerable:!0,get:function(){return Iu.FunctionsError}});Object.defineProperty(Ve,"FunctionRegion",{enumerable:!0,get:function(){return Iu.FunctionRegion}});oS(bg(),Ve);var p7=My();Object.defineProperty(Ve,"SupabaseClient",{enumerable:!0,get:function(){return aS(p7).default}});var m7=(t,e,r)=>new h7.default(t,e,r);Ve.createClient=m7;function g7(){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}g7()&&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 qy=b((wge,cS)=>{cS.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 Tf=b(fS=>{var lS={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 y7(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(lS))fS[t]=y7(lS[t])});var gS=b((bge,mS)=>{var D7=require("fs"),Tt=require("path"),hS=qy(),w7=Tf(),v7=typeof process=="object"&&process.platform==="win32",dS=t=>typeof t=="object"&&t!==null,pS=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=D7,dS(t)&&dS(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}mS.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 w7.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 pS[(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 hS.STORED:return"STORED ("+t+")";case hS.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=v7;dt.crcTable=pS});var DS=b((Ege,yS)=>{var b7=require("path");yS.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=b7.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 vS=b((_ge,wS)=>{wS.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var Lo=b((Cge,$o)=>{$o.exports=gS();$o.exports.Constants=qy();$o.exports.Errors=Tf();$o.exports.FileAttr=DS();$o.exports.decoder=vS()});var ES=b((Sge,bS)=>{var Oi=Lo(),X=Oi.Constants;bS.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},v=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=v(p)},get timeHighByte(){return A(i>>>8)},get crc(){return s},set crc(p){s=v(p)},get compressedSize(){return o},set compressedSize(p){o=v(p)},get size(){return a},set size(p){a=v(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=v(p)},get inAttr(){return d},set inAttr(p){d=v(p)},get attr(){return f},set attr(p){f=v(p)},get fileAttr(){return(f||0)>>16&4095},get offset(){return m},set offset(p){m=v(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 D=m+X.LOCHDR+g.fnameLen,C=D+g.extraLen;return p.slice(D,C)},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 CS=b((Age,_S)=>{var jo=Lo(),ut=jo.Constants;_S.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 jo.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=jo.readBigUInt64LE(s,ut.ZIP64SUB),e=jo.readBigUInt64LE(s,ut.ZIP64TOT),r=jo.readBigUInt64LE(s,ut.ZIP64SIZE),n=jo.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 Hy=b(Uy=>{Uy.EntryHeader=ES();Uy.MainHeader=CS()});var AS=b((xge,SS)=>{SS.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 xS=b((Tge,OS)=>{var E7=+(process.versions?process.versions.node:"").split(".")[0]||0;OS.exports=function(t,e){var r=require("zlib");let n=E7>=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 PS=b((Fge,kS)=>{"use strict";var{randomFillSync:TS}=require("crypto"),_7=Tf(),C7=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}),IS=(t,e)=>Math.imul(t,e)>>>0,FS=(t,e)=>C7[(t^e)&255]^t>>>8,ku=()=>typeof TS=="function"?TS(Buffer.alloc(12)):ku.node();ku.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 Ff={genSalt:ku};function If(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])}If.prototype.updateKeys=function(t){let e=this.keys;return e[0]=FS(e[0],t),e[1]+=e[0]&255,e[1]=IS(e[1],134775813)+1,e[2]=FS(e[2],e[1]>>>24),t};If.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return IS(t,t^1)>>8&255};function S7(t){let e=new If(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 A7(t){let e=new If(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 O7(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=S7(r),i=n(t.slice(0,12)),s=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(i[11]!==s)throw _7.WRONG_PASSWORD();return n(t.slice(12))}function x7(t){Buffer.isBuffer(t)&&t.length>=12?Ff.genSalt=function(){return t.slice(0,12)}:t==="node"?Ff.genSalt=ku.node:Ff.genSalt=ku}function T7(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let i=A7(r),s=Ff.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)}kS.exports={decrypt:O7,encrypt:T7,_salter:x7}});var RS=b(kf=>{kf.Deflater=AS();kf.Inflater=xS();kf.ZipCrypto=PS()});var zy=b((kge,NS)=>{var ke=Lo(),F7=Hy(),pt=ke.Constants,Vy=RS();NS.exports=function(t,e){var r=new F7.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:ke.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={},D=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(D)==pt.LOCSIG||e.readUInt32LE(D)==pt.CENSIG)throw ke.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(D)==pt.EXTSIG)y.crc=e.readUInt32LE(D+pt.EXTCRC),y.compressedSize=e.readUInt32LE(D+pt.EXTSIZ),y.size=e.readUInt32LE(D+pt.EXTLEN);else if(e.readUInt16LE(D+12)===19280)y.crc=e.readUInt32LE(D+pt.EXTCRC-4),y.compressedSize=e.readUInt32LE(D+pt.EXTSIZ-4),y.size=e.readUInt32LE(D+pt.EXTLEN-4);else throw ke.Errors.DESCRIPTOR_UNKNOWN();if(y.compressedSize!==r.compressedSize||y.size!==r.size||y.crc!==r.crc)throw ke.Errors.DESCRIPTOR_FAULTY();if(ke.crc32(p)!==y.crc)return!1}else if(ke.crc32(p)!==r.localHeader.crc)return!1;return!0}function m(p,y,D){if(typeof y>"u"&&typeof p=="string"&&(D=p,p=void 0),s)return p&&y&&y(Buffer.alloc(0),ke.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var C=d();if(C.length===0)return p&&y&&y(C),C;if(r.encrypted){if(typeof D!="string"&&!Buffer.isBuffer(D))throw ke.Errors.INVALID_PASS_PARAM();C=Vy.ZipCrypto.decrypt(C,r,D)}var k=Buffer.alloc(r.size);switch(r.method){case ke.Constants.STORED:if(C.copy(k),f(k))return p&&y&&y(k),k;throw p&&y&&y(k,ke.Errors.BAD_CRC()),ke.Errors.BAD_CRC();case ke.Constants.DEFLATED:var E=new Vy.Inflater(C,r.size);if(p)E.inflateAsync(function(R){R.copy(R,0),y&&(f(R)?y(R):y(R,ke.Errors.BAD_CRC()))});else{if(E.inflate(k).copy(k,0),!f(k))throw ke.Errors.BAD_CRC(`"${h.decode(n)}"`);return k}break;default:throw p&&y&&y(Buffer.alloc(0),ke.Errors.UNKNOWN_METHOD()),ke.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 D;switch(r.method){case ke.Constants.STORED:return r.compressedSize=r.size,D=Buffer.alloc(o.length),o.copy(D),p&&y&&y(D),D;default:case ke.Constants.DEFLATED:var C=new Vy.Deflater(o);if(p)C.deflateAsync(function(E){D=Buffer.alloc(E.length),r.compressedSize=E.length,E.copy(D),y&&y(D)});else{var k=C.deflate();return r.compressedSize=k.length,k}C=null;break}}else if(p&&y)y(Buffer.alloc(0));else return Buffer.alloc(0)}function v(p,y){return(p.readUInt32LE(y+4)<<4)+p.readUInt32LE(y)}function S(p){try{for(var y=0,D,C,k;y+4<p.length;)D=p.readUInt16LE(y),y+=2,C=p.readUInt16LE(y),y+=2,k=p.slice(y,y+C),y+=C,pt.ID_ZIP64===D&&A(k)}catch{throw ke.Errors.EXTRA_FIELD_PARSE_ERROR()}}function A(p){var y,D,C,k;p.length>=pt.EF_ZIP64_SCOMP&&(y=v(p,pt.EF_ZIP64_SUNCOMP),r.size===pt.EF_ZIP64_OR_32&&(r.size=y)),p.length>=pt.EF_ZIP64_RHO&&(D=v(p,pt.EF_ZIP64_SCOMP),r.compressedSize===pt.EF_ZIP64_OR_32&&(r.compressedSize=D)),p.length>=pt.EF_ZIP64_DSN&&(C=v(p,pt.EF_ZIP64_RHO),r.offset===pt.EF_ZIP64_OR_32&&(r.offset=C)),p.length>=pt.EF_ZIP64_DSN+4&&(k=p.readUInt32LE(pt.EF_ZIP64_DSN),r.diskNumStart===pt.EF_ZIP64_OR_16&&(r.diskNumStart=k))}return{get entryName(){return h.decode(n)},get rawEntryName(){return n},set entryName(p){n=ke.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=ke.toBuffer(p,h.encode),r.commentLength=i.length,i.length>65535)throw ke.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=ke.toBuffer(p,ke.decoder.encode),!s&&o.length?(r.size=o.length,r.method=ke.Constants.DEFLATED,r.crc=ke.crc32(p),r.changed=!0):r.method=ke.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=ke.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(),D=Buffer.alloc(y.length+n.length+r.extraLocalLength);return y.copy(D,p),p+=y.length,n.copy(D,p),p+=n.length,u.copy(D,p),p+=u.length,D},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 jS=b((Pge,LS)=>{var $S=zy(),I7=Hy(),Bt=Lo();LS.exports=function(t,e){var r=[],n={},i=Buffer.alloc(0),s=new I7.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 v=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("/")+"/";v.add(y)}}for(let S of v)if(!(S in n)){let A=new $S(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 v=s.offset,S=0;S<r.length;S++){var A=v,p=new $S(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)),v+=p.header.centralHeaderSize,r[S]=p,n[p.entryName]=p}u.clear(),d()}function m(v){var S=t.length-Bt.Constants.ENDHDR,A=Math.max(0,S-65535),p=A,y=t.length,D=-1,C=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){D=S,C=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){D=S,y=S+Bt.readBigUInt64LE(t,S+Bt.Constants.ZIP64SIZE)+Bt.Constants.ZIP64LEAD;break}}if(D==-1)throw Bt.Errors.INVALID_FORMAT();s.loadFromBinary(t.slice(D,y)),s.commentLength&&(i=t.slice(C+Bt.Constants.ENDHDR)),v&&f()}function g(){r.length>1&&!l&&r.sort((v,S)=>v.entryName.toLowerCase().localeCompare(S.entryName.toLowerCase()))}return{get entries(){return o||f(),r.filter(v=>!u.has(v))},get comment(){return h.decode(i)},set comment(v){i=Bt.toBuffer(v,h.encode),s.commentLength=i.length},getEntryCount:function(){return o?r.length:s.diskEntries},forEach:function(v){this.entries.forEach(v)},getEntry:function(v){return o||f(),n[v]||null},setEntry:function(v){o||f(),r.push(v),n[v.entryName]=v,s.totalEntries=r.length},deleteFile:function(v,S=!0){o||f();let A=n[v];this.getEntryChildren(A,S).map(y=>y.entryName).forEach(this.deleteEntry)},deleteEntry:function(v){o||f();let S=n[v],A=r.indexOf(S);A>=0&&(r.splice(A,1),delete n[v],s.totalEntries=r.length)},getEntryChildren:function(v,S=!0){if(o||f(),typeof v=="object")if(v.isDirectory&&S){let A=[],p=v.entryName;for(let y of r)y.entryName.startsWith(p)&&A.push(y);return A}else return[v];return[]},getChildCount:function(v){if(v&&v.isDirectory){let S=this.getEntryChildren(v);return S.includes(v)?S.length-1:S.length}return 0},compressToBuffer:function(){o||f(),g();let v=[],S=[],A=0,p=0;s.size=0,s.offset=0;let y=0;for(let k of this.entries){let E=k.getCompressedData();k.header.offset=p;let R=k.packLocalHeader(),P=R.length+E.length;p+=P,v.push(R),v.push(E);let F=k.packCentralHeader();S.push(F),s.size+=F.length,A+=P+F.length,y++}A+=s.mainHeaderSize,s.offset=p,s.totalEntries=y,p=0;let D=Buffer.alloc(A);for(let k of v)k.copy(D,p),p+=k.length;for(let k of S)k.copy(D,p),p+=k.length;let C=s.toBinary();return i&&i.copy(C,Bt.Constants.ENDHDR),C.copy(D,p),t=D,o=!1,D},toAsyncBuffer:function(v,S,A,p){try{o||f(),g();let y=[],D=[],C=0,k=0,E=0;s.size=0,s.offset=0;let R=function(P){if(P.length>0){let F=P.shift(),j=F.entryName+F.extra.toString();A&&A(j),F.getCompressedDataAsync(function(U){p&&p(j),F.header.offset=k;let G=F.packLocalHeader(),L=G.length+U.length;k+=L,y.push(G),y.push(U);let _=F.packCentralHeader();D.push(_),s.size+=_.length,C+=L+_.length,E++,R(P)})}else{C+=s.mainHeaderSize,s.offset=k,s.totalEntries=E,k=0;let F=Buffer.alloc(C);y.forEach(function(U){U.copy(F,k),k+=U.length}),D.forEach(function(U){U.copy(F,k),k+=U.length});let j=s.toBinary();i&&i.copy(j,Bt.Constants.ENDHDR),j.copy(F,k),t=F,o=!1,v(F)}};R(Array.from(this.entries))}catch(y){S(y)}}}}});var qS=b((Rge,MS)=>{var ct=Lo(),mt=require("path"),k7=zy(),P7=jS(),ps=(...t)=>ct.findLast(t,e=>typeof e=="boolean"),BS=(...t)=>ct.findLast(t,e=>typeof e=="string"),R7=(...t)=>ct.findLast(t,e=>typeof e=="function"),N7={noSort:!1,readEntries:!1,method:ct.Constants.NONE,fs:null};MS.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),N7);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 P7(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:v}=mt.posix;return m(".",g(v+f.split("\\").join(v)+v))}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 v=g.getData();if(v&&v.length)return v.toString(m||"utf8")}return""},readAsTextAsync:function(f,m,g){var v=c(f);v?v.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,v){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,v,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:v}=f,{zipPath:S,zipName:A}=f,p=this;i.fs.stat(g,function(y,D){if(y)return m(y,!1);S=S?l(S):"";let C=mt.win32.basename(mt.win32.normalize(g));if(S+=A||C,D.isFile())i.fs.readFile(g,function(k,E){return k?m(k,!1):(p.addFile(S,E,v,D),setImmediate(m,void 0,!0))});else if(D.isDirectory())return S+=i.sep,p.addFile(S,Buffer.alloc(0),v,D),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 v=i.findFiles(f),S=this;if(v.length)for(let A of v){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,v){v=h(v),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,D=function(){if(y+=1,y<p.length){var C=p[y],k=d(f,C).split("\\").join("/");k=k.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),v(k)?i.fs.stat(C,function(E,R){E&&m(void 0,E),R.isFile()?i.fs.readFile(C,function(P,F){P?m(void 0,P):(S.addFile(g+k,F,"",R),D())}):(S.addFile(g+k+"/",Buffer.alloc(0),"",R),D())}):process.nextTick(()=>{D()})}else m(!0,void 0)};D()}})},addLocalFolderAsync2:function(f,m){let g=this;f=typeof f=="object"?f:{localPath:f},localPath=mt.resolve(l(f.localPath));let{zipPath:v,filter:S,namefix:A}=f;S instanceof RegExp?S=(function(D){return function(C){return D.test(C)}})(S):typeof S!="function"&&(S=function(){return!0}),v=v?l(v):"",A=="latin1"&&(A=D=>D.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof A!="function"&&(A=D=>D);let p=D=>mt.join(v,A(d(localPath,D))),y=D=>mt.win32.basename(mt.win32.normalize(A(D)));i.fs.open(localPath,"r",function(D){D&&D.code==="ENOENT"?m(void 0,ct.Errors.FILE_NOT_FOUND(localPath)):D?m(void 0,D):i.findFilesAsync(localPath,function(C,k){if(C)return m(C);k=k.filter(E=>S(p(E))),k.length||m(void 0,!1),setImmediate(k.reverse().reduce(function(E,R){return function(P,F){if(P||F===!1)return setImmediate(E,P,!1);g.addLocalFileAsync({localPath:R,zipPath:mt.dirname(p(R)),zipName:y(R)},E)}},m))})})},addLocalFolderPromise:function(f,m){return new Promise((g,v)=>{this.addLocalFolderAsync2(Object.assign({localPath:f},m),(S,A)=>{S&&v(S),A&&g(this)})})},addFile:function(f,m,g,v){f=u(f);let S=c(f),A=S!=null;A||(S=new k7(n),S.entryName=f),S.comment=g||"";let p=typeof v=="object"&&v instanceof i.fs.Stats;p&&(S.header.time=v.mtime);var y=S.isDirectory?16:0;let D=S.isDirectory?16384:32768;return p?D|=4095&v.mode:typeof v=="number"?D|=4095&v:D|=S.isDirectory?493:420,y=(y|D<<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,v,S,A){v=ps(!1,v),S=ps(!1,S),g=ps(!0,g),A=BS(S,A);var p=c(f);if(!p)throw ct.Errors.NO_ENTRY();var y=o(p.entryName),D=a(m,A&&!p.isDirectory?A:g?y:mt.basename(y));if(p.isDirectory){var C=s.getEntryChildren(p);return C.forEach(function(R){if(R.isDirectory)return;var P=R.getData();if(!P)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,P,v,U)}),!0}var k=p.getData(s.password);if(!k)throw ct.Errors.CANT_EXTRACT_FILE();if(i.fs.existsSync(D)&&!v)throw ct.Errors.CANT_OVERRIDE();let E=S?f.header.fileAttr:void 0;return i.writeFileTo(D,k,v,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,v){if(g=ps(!1,g),v=BS(g,v),m=ps(!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(v);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,v){if(v=R7(m,g,v),g=ps(!1,g),m=ps(!1,m),!v)return new Promise((D,C)=>{this.extractAllToAsync(f,m,g,function(k){k?C(k):D(this)})});if(!s){v(ct.Errors.NO_ZIP());return}f=mt.resolve(f);let S=D=>a(f,mt.normalize(o(D.entryName))),A=(D,C)=>new Error(D+': "'+C+'"'),p=[],y=[];s.entries.forEach(D=>{D.isDirectory?p.push(D):y.push(D)});for(let D of p){let C=S(D),k=g?D.header.fileAttr:void 0;try{i.makeDir(C),k&&i.fs.chmodSync(C,k),i.fs.utimesSync(C,D.header.time,D.header.time)}catch{v(A("Unable to create folder",C))}}y.reverse().reduce(function(D,C){return function(k){if(k)D(k);else{let E=mt.normalize(o(C.entryName)),R=a(f,E);C.getDataAsync(function(P,F){if(F)D(F);else if(!P)D(ct.Errors.CANT_EXTRACT_FILE());else{let j=g?C.header.fileAttr:void 0;i.writeFileToAsync(R,P,m,j,function(U){U||D(A("Unable to write file",R)),i.fs.utimes(R,C.header.time,C.header.time,function(G){G?D(A("Unable to set times",R)):D()})})}})}}},v)()},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 v=i.writeFileTo(f,g,!0);typeof m=="function"&&m(v?null:new Error("failed"),"")}}},writeZipPromise:function(f,m){let{overwrite:g,perm:v}=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=D=>D?S(D):A("ADM-ZIP: Wasn't able to write zip file");i.writeFileToAsync(f,p,g,v,y)},A)})},toBufferPromise:function(){return new Promise((f,m)=>{s.toAsyncBuffer(f,m)})},toBuffer:function(f,m,g,v){return typeof f=="function"?(s.toAsyncBuffer(f,m,g,v),null):s.compressToBuffer()}}}});var zS=b((Nge,VS)=>{var HS={};VS.exports=HS;var US={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(US).forEach(function(t){var e=US[t],r=HS[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var KS=b(($ge,GS)=>{"use strict";GS.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 XS=b((Lge,WS)=>{"use strict";var $7=require("os"),nn=KS(),rr=process.env,Bo=void 0;nn("no-color")||nn("no-colors")||nn("color=false")?Bo=!1:(nn("color")||nn("colors")||nn("color=true")||nn("color=always"))&&(Bo=!0);"FORCE_COLOR"in rr&&(Bo=rr.FORCE_COLOR.length===0||parseInt(rr.FORCE_COLOR,10)!==0);function L7(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function j7(t){if(Bo===!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&&Bo!==!0)return 0;var e=Bo?1:0;if(process.platform==="win32"){var r=$7.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 Gy(t){var e=j7(t);return L7(e)}WS.exports={supportsColor:Gy,stdout:Gy(process.stdout),stderr:Gy(process.stderr)}});var JS=b((jge,YS)=>{YS.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 QS=b((Bge,ZS)=>{ZS.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],v=0;v<=h[g];v++)c[g]&&(l=l+n[g][s(n[g].length)])}return l}return a(e,r)}});var tA=b((Mge,eA)=>{eA.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 nA=b((qge,rA)=>{rA.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var sA=b((Uge,iA)=>{iA.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 aA=b((Hge,oA)=>{oA.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 dA=b((zge,hA)=>{var ve={};hA.exports=ve;ve.themes={};var B7=require("util"),ms=ve.styles=zS(),cA=Object.defineProperties,M7=new RegExp(/[\r\n]+/g);ve.supportsColor=XS().supportsColor;typeof ve.enabled>"u"&&(ve.enabled=ve.supportsColor()!==!1);ve.enable=function(){ve.enabled=!0};ve.disable=function(){ve.enabled=!1};ve.stripColors=ve.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var Vge=ve.stylize=function(e,r){if(!ve.enabled)return e+"";var n=ms[r];return!n&&r in ve?ve[r](e):n.open+e+n.close},q7=/[|\\{}()[\]^$+*?.]/g,U7=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(q7,"\\$&")};function lA(t){var e=function r(){return V7.apply(r,arguments)};return e._styles=t,e.__proto__=H7,e}var fA=(function(){var t={};return ms.grey=ms.gray,Object.keys(ms).forEach(function(e){ms[e].closeRe=new RegExp(U7(ms[e].close),"g"),t[e]={get:function(){return lA(this._styles.concat(e))}}}),t})(),H7=cA(function(){},fA);function V7(){var t=Array.prototype.slice.call(arguments),e=t.map(function(o){return o!=null&&o.constructor===String?o:B7.inspect(o)}).join(" ");if(!ve.enabled||!e)return e;for(var r=e.indexOf(`
|
|
41
41
|
`)!=-1,n=this._styles,i=n.length;i--;){var s=ms[n[i]];e=s.open+e.replace(s.closeRe,s.open)+s.close,r&&(e=e.replace(M7,function(o){return s.close+o+s.open}))}return e}ve.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){ve[r]=function(n){if(typeof t[r]=="object"){var i=n;for(var s in t[r])i=ve[t[r][s]](i);return i}return ve[t[r]](n)}})(e)};function z7(){var t={};return Object.keys(fA).forEach(function(e){t[e]={get:function(){return lA([e])}}}),t}var G7=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};ve.trap=JS();ve.zalgo=QS();ve.maps={};ve.maps.america=tA()(ve);ve.maps.zebra=nA()(ve);ve.maps.rainbow=sA()(ve);ve.maps.random=aA()(ve);for(uA in ve.maps)(function(t){ve[t]=function(e){return G7(ve.maps[t],e)}})(uA);var uA;cA(ve,z7())});var mA=b((Gge,pA)=>{var K7=dA();pA.exports=K7});var gA=b(Ky=>{"use strict";Ky.indent=function(e){return new Array(e+1).join(" ")};Ky.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 yA=b((Wge,W7)=>{W7.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 DA=b(Pu=>{"use strict";var mn=mA(),xi=gA(),X7=/[^\w\s\n\r\v\t\.,]/i;Pu.version=yA().version;var Wy=function(t,e){return t!==void 0||e.renderUndefined},Pf=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)&&Pf(t[0],!0,r))},Y7=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},Xy=function(t,e){return t.multilineStringColor===null||t.noColor?e:mn[t.multilineStringColor](e)},J7=function(t,e,r){var n=t.split(`
|
|
43
43
|
`);return n=n.map(function(i){return xi.indent(e)+Xy(r,i)}),n.join(`
|
|
44
44
|
`)},Mo=function(t,e,r){if(typeof t=="string"&&t.match(X7)&&e.escape&&(t=JSON.stringify(t)),!Wy(t,e))return[];if(Pf(t,!1,e))return[xi.indent(r)+Y7(t,e)];if(typeof t=="string")return[xi.indent(r)+Xy(e,'"""'),J7(t,r+e.defaultIndentation,e),xi.indent(r)+Xy(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[xi.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(a){if(Wy(a,e)){var u="- ";e.noColor||(u=mn[e.dashColor](u)),u=xi.indent(r)+u,Pf(a,!1,e)?(u+=Mo(a,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,Mo(a,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return Mo({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(Wy(t[a],e))if(s=a+": ",e.noColor||(s=mn[e.keysColor](s)),s=xi.indent(r)+s,Pf(t[a],!1,e)){var u=e.noAlign?0:i-a.length;s+=Mo(t[a],e,u)[0],o.push(s)}else o.push(s),o.push.apply(o,Mo(t[a],e,r+e.defaultIndentation))}),o};Pu.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,Mo(e,r,n).join(`
|
|
46
46
|
`)};Pu.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+=Pu.render(s,r,n),i}});var Zy=b(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});Rf.default=void 0;function qo(t){"@babel/helpers - typeof";return qo=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},qo(t)}function wA(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,Q7(n.key),n)}}function Z7(t,e,r){return e&&wA(t.prototype,e),r&&wA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Q7(t){var e=eH(t,"string");return qo(e)=="symbol"?e:e+""}function eH(t,e){if(qo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(qo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function tH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rH(t,e,r){return e=Nu(e),nH(t,Jy()?Reflect.construct(e,r||[],Nu(t).constructor):e.apply(t,r))}function nH(t,e){if(e&&(qo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iH(t)}function iH(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function sH(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&&Ru(t,e)}function Yy(t){var e=typeof Map=="function"?new Map:void 0;return Yy=function(n){if(n===null||!aH(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 oH(n,arguments,Nu(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Ru(i,n)},Yy(t)}function oH(t,e,r){if(Jy())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(t.bind.apply(t,n));return r&&Ru(i,r.prototype),i}function Jy(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Jy=function(){return!!t})()}function aH(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Ru(t,e){return Ru=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Ru(t,e)}function Nu(t){return Nu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Nu(t)}var uH=(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(tH(this,e),n=rH(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 sH(e,t),Z7(e)})(Yy(Error)),Yge=Rf.default=uH});var Qy=b(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});Nf.enableDebugLog=cH;Nf.log=lH;var vA=!1;function cH(){vA=!0}function lH(t){vA&&console.log(t)}});var EA=b($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});$f.default=void 0;function $u(t){"@babel/helpers - typeof";return $u=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},$u(t)}function fH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bA(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,dH(n.key),n)}}function hH(t,e,r){return e&&bA(t.prototype,e),r&&bA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function dH(t){var e=pH(t,"string");return $u(e)=="symbol"?e:e+""}function pH(t,e){if($u(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if($u(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Qge=$f.default=(function(){function t(){fH(this,t)}return hH(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 _A=b((eD,tD)=>{(function(t,e){typeof eD=="object"&&typeof tD<"u"?tD.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:eD,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,re=0;re<q.length;){if((ae=q.charCodeAt(re++))>255||(x=q.charCodeAt(re++))>255||(O=q.charCodeAt(re++))>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(""))},v=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))},D=function(q,V){return V===void 0&&(V=!1),V?h(y(q)):y(q)},C=function(q){return D(q,!0)},k=/[\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(k,E)},P=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")}:P,B=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 B(L(q))},G=r?function(q){return Buffer.from(q,"base64").toString("utf8")}:n?function(q){return n.decode(B(q))}:function(q){return R(F(q))},L=function(q){return d(q.replace(/[-_]/g,function(V){return V=="-"?"+":"/"}))},_=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 _(this)}),q("toBase64",function(V){return D(this,V)}),q("toBase64URI",function(){return D(this,!0)}),q("toBase64URL",function(){return D(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 v(this,V)}),q("toBase64URI",function(){return v(this,!0)}),q("toBase64URL",function(){return v(this,!0)})},j=function(){$(),M()},K={version:t,VERSION:e,atob:F,atobPolyfill:P,btoa:m,btoaPolyfill:f,fromBase64:_,toBase64:D,encode:D,encodeURI:C,encodeURL:C,utob:p,btou:R,decode:_,isValid:T,fromUint8Array:v,toUint8Array:U,extendString:$,extendUint8Array:M,extendBuiltins:j};return K.Base64={},Object.keys(K).forEach(function(q){return K.Base64[q]=K[q]}),K})});var SA=b((tye,CA)=>{"use strict";CA.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 xA=b(rD=>{"use strict";var mH=Object.prototype.hasOwnProperty,gH;function AA(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function OA(t){try{return encodeURIComponent(t)}catch{return null}}function yH(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var i=AA(n[1]),s=AA(n[2]);i===null||s===null||i in r||(r[i]=s)}return r}function DH(t,e){e=e||"";var r=[],n,i;typeof e!="string"&&(e="?");for(i in t)if(mH.call(t,i)){if(n=t[i],!n&&(n===null||n===gH||isNaN(n))&&(n=""),i=OA(i),n=OA(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?e+r.join("&"):""}rD.stringify=DH;rD.parse=yH});var $A=b((nye,NA)=>{"use strict";var FA=SA(),Lf=xA(),wH=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,IA=/[\n\r\t]/g,vH=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,kA=/:\d+$/,bH=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,EH=/^[a-zA-Z]:/;function iD(t){return(t||"").toString().replace(wH,"")}var nD=[["#","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]],TA={hash:1,query:1};function PA(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 TA)delete n[s]}else if(i==="object"){for(s in t)s in TA||(n[s]=t[s]);n.slashes===void 0&&(n.slashes=vH.test(t.href))}return n}function gn(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function RA(t,e){t=iD(t),t=t.replace(IA,""),e=e||{};var r=bH.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 _H(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=iD(t),t=t.replace(IA,""),!(this instanceof yn))return new yn(t,e,r);var n,i,s,o,a,u,c=nD.slice(),l=typeof e,h=this,d=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=Lf.parse),e=PA(e),i=RA(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||EH.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=_H(h.pathname,e.pathname)),h.pathname.charAt(0)!=="/"&&gn(h.protocol)&&(h.pathname="/"+h.pathname),FA(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 CH(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||Lf.parse)(e)),n[t]=e;break;case"port":n[t]=e,FA(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,kA.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<nD.length;o++){var a=nD[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 SH(t){(!t||typeof t!="function")&&(t=Lf.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]===":"||kA.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:CH,toString:SH};yn.extractProtocol=RA;yn.location=PA;yn.trimLeft=iD;yn.qs=Lf;NA.exports=yn});var LA=b(sD=>{"use strict";Object.defineProperty(sD,"__esModule",{value:!0});sD.default=AH;function AH(){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 ZA=b(qf=>{"use strict";Object.defineProperty(qf,"__esModule",{value:!0});qf.default=void 0;var OH=_A(),xH=uD($A()),jf=uD(Zy()),gs=Qy(),TH=uD(LA());function uD(t){return t&&t.__esModule?t:{default:t}}function oD(){"use strict";oD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(_,T,I){_[T]=I.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(_,T,I){return Object.defineProperty(_,T,{value:I,enumerable:!0,configurable:!0,writable:!0}),_[T]}try{c({},"")}catch{c=function(I,$,M){return I[$]=M}}function l(_,T,I,$){var M=T&&T.prototype instanceof S?T:S,j=Object.create(M.prototype),K=new G($||[]);return i(j,"_invoke",{value:P(_,I,K)}),j}function h(_,T,I){try{return{type:"normal",arg:_.call(T,I)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",g="completed",v={};function S(){}function A(){}function p(){}var y={};c(y,o,function(){return this});var D=Object.getPrototypeOf,C=D&&D(D(L([])));C&&C!==r&&n.call(C,o)&&(y=C);var k=p.prototype=S.prototype=Object.create(y);function E(_){["next","throw","return"].forEach(function(T){c(_,T,function(I){return this._invoke(T,I)})})}function R(_,T){function I(M,j,K,q){var V=h(_[M],_,j);if(V.type!=="throw"){var ae=V.arg,x=ae.value;return x&&ys(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(j,K){function q(){return new T(function(V,ae){I(j,K,V,ae)})}return $=$?$.then(q,q):q()}})}function P(_,T,I){var $=d;return function(M,j){if($===m)throw Error("Generator is already running");if($===g){if(M==="throw")throw j;return{value:t,done:!0}}for(I.method=M,I.arg=j;;){var K=I.delegate;if(K){var q=F(K,I);if(q){if(q===v)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(_,T,I);if(V.type==="normal"){if($=I.done?g:f,V.arg===v)continue;return{value:V.arg,done:I.done}}V.type==="throw"&&($=g,I.method="throw",I.arg=V.arg)}}}function F(_,T){var I=T.method,$=_.iterator[I];if($===t)return T.delegate=null,I==="throw"&&_.iterator.return&&(T.method="return",T.arg=t,F(_,T),T.method==="throw")||I!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+I+"' method")),v;var M=h($,_.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,v;var j=M.arg;return j?j.done?(T[_.resultName]=j.value,T.next=_.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,v):j:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,v)}function B(_){var T={tryLoc:_[0]};1 in _&&(T.catchLoc=_[1]),2 in _&&(T.finallyLoc=_[2],T.afterLoc=_[3]),this.tryEntries.push(T)}function U(_){var T=_.completion||{};T.type="normal",delete T.arg,_.completion=T}function G(_){this.tryEntries=[{tryLoc:"root"}],_.forEach(B,this),this.reset(!0)}function L(_){if(_||_===""){var T=_[o];if(T)return T.call(_);if(typeof _.next=="function")return _;if(!isNaN(_.length)){var I=-1,$=function M(){for(;++I<_.length;)if(n.call(_,I))return M.value=_[I],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(ys(_)+" is not iterable")}return A.prototype=p,i(k,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(_){var T=typeof _=="function"&&_.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(_){return Object.setPrototypeOf?Object.setPrototypeOf(_,p):(_.__proto__=p,c(_,u,"GeneratorFunction")),_.prototype=Object.create(k),_},e.awrap=function(_){return{__await:_}},E(R.prototype),c(R.prototype,a,function(){return this}),e.AsyncIterator=R,e.async=function(_,T,I,$,M){M===void 0&&(M=Promise);var j=new R(l(_,T,I,$),M);return e.isGeneratorFunction(T)?j:j.next().then(function(K){return K.done?K.value:j.next()})},E(k),c(k,u,"Generator"),c(k,o,function(){return this}),c(k,"toString",function(){return"[object Generator]"}),e.keys=function(_){var T=Object(_),I=[];for(var $ in T)I.push($);return I.reverse(),function M(){for(;I.length;){var j=I.pop();if(j in T)return M.value=j,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 j=this.tryEntries[M],K=j.completion;if(j.tryLoc==="root")return $("end");if(j.tryLoc<=this.prev){var q=n.call(j,"catchLoc"),V=n.call(j,"finallyLoc");if(q&&V){if(this.prev<j.catchLoc)return $(j.catchLoc,!0);if(this.prev<j.finallyLoc)return $(j.finallyLoc)}else if(q){if(this.prev<j.catchLoc)return $(j.catchLoc,!0)}else{if(!V)throw Error("try statement without catch or finally");if(this.prev<j.finallyLoc)return $(j.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 j=M;break}}j&&(T==="break"||T==="continue")&&j.tryLoc<=I&&I<=j.finallyLoc&&(j=null);var K=j?j.completion:{};return K.type=T,K.arg=I,j?(this.method="next",this.next=j.finallyLoc,v):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),v},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($),v}},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 j=M.arg;U($)}return j}}throw Error("illegal catch attempt")},delegateYield:function(T,I,$){return this.delegate={iterator:L(T),resultName:I,nextLoc:$},this.method==="next"&&(this.arg=t),v}},e}function jA(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 FH(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){jA(s,n,i,o,a,"next",u)}function a(u){jA(s,n,i,o,a,"throw",u)}o(void 0)})}}function KA(t,e){return PH(t)||kH(t,e)||WA(t,e)||IH()}function IH(){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+=Pu.render(s,r,n),i}});var Zy=b(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});Rf.default=void 0;function qo(t){"@babel/helpers - typeof";return qo=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},qo(t)}function wA(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,Q7(n.key),n)}}function Z7(t,e,r){return e&&wA(t.prototype,e),r&&wA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Q7(t){var e=eH(t,"string");return qo(e)=="symbol"?e:e+""}function eH(t,e){if(qo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(qo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function tH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rH(t,e,r){return e=Nu(e),nH(t,Jy()?Reflect.construct(e,r||[],Nu(t).constructor):e.apply(t,r))}function nH(t,e){if(e&&(qo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return iH(t)}function iH(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function sH(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&&Ru(t,e)}function Yy(t){var e=typeof Map=="function"?new Map:void 0;return Yy=function(n){if(n===null||!aH(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 oH(n,arguments,Nu(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Ru(i,n)},Yy(t)}function oH(t,e,r){if(Jy())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(t.bind.apply(t,n));return r&&Ru(i,r.prototype),i}function Jy(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Jy=function(){return!!t})()}function aH(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Ru(t,e){return Ru=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Ru(t,e)}function Nu(t){return Nu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Nu(t)}var uH=(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(tH(this,e),n=rH(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 sH(e,t),Z7(e)})(Yy(Error)),Yge=Rf.default=uH});var Qy=b(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});Nf.enableDebugLog=cH;Nf.log=lH;var vA=!1;function cH(){vA=!0}function lH(t){vA&&console.log(t)}});var EA=b($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});$f.default=void 0;function $u(t){"@babel/helpers - typeof";return $u=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},$u(t)}function fH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bA(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,dH(n.key),n)}}function hH(t,e,r){return e&&bA(t.prototype,e),r&&bA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function dH(t){var e=pH(t,"string");return $u(e)=="symbol"?e:e+""}function pH(t,e){if($u(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if($u(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Qge=$f.default=(function(){function t(){fH(this,t)}return hH(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 _A=b((eD,tD)=>{(function(t,e){typeof eD=="object"&&typeof tD<"u"?tD.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:eD,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,re=0;re<q.length;){if((ae=q.charCodeAt(re++))>255||(x=q.charCodeAt(re++))>255||(O=q.charCodeAt(re++))>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(""))},v=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))},D=function(q,V){return V===void 0&&(V=!1),V?h(y(q)):y(q)},C=function(q){return D(q,!0)},k=/[\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(k,E)},P=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")}:P,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=="-"?"+":"/"}))},_=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 _(this)}),q("toBase64",function(V){return D(this,V)}),q("toBase64URI",function(){return D(this,!0)}),q("toBase64URL",function(){return D(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 v(this,V)}),q("toBase64URI",function(){return v(this,!0)}),q("toBase64URL",function(){return v(this,!0)})},B=function(){$(),M()},W={version:t,VERSION:e,atob:F,atobPolyfill:P,btoa:m,btoaPolyfill:f,fromBase64:_,toBase64:D,encode:D,encodeURI:C,encodeURL:C,utob:p,btou:R,decode:_,isValid:T,fromUint8Array:v,toUint8Array:U,extendString:$,extendUint8Array:M,extendBuiltins:B};return W.Base64={},Object.keys(W).forEach(function(q){return W.Base64[q]=W[q]}),W})});var SA=b((tye,CA)=>{"use strict";CA.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 xA=b(rD=>{"use strict";var mH=Object.prototype.hasOwnProperty,gH;function AA(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function OA(t){try{return encodeURIComponent(t)}catch{return null}}function yH(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var i=AA(n[1]),s=AA(n[2]);i===null||s===null||i in r||(r[i]=s)}return r}function DH(t,e){e=e||"";var r=[],n,i;typeof e!="string"&&(e="?");for(i in t)if(mH.call(t,i)){if(n=t[i],!n&&(n===null||n===gH||isNaN(n))&&(n=""),i=OA(i),n=OA(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?e+r.join("&"):""}rD.stringify=DH;rD.parse=yH});var $A=b((nye,NA)=>{"use strict";var FA=SA(),Lf=xA(),wH=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,IA=/[\n\r\t]/g,vH=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,kA=/:\d+$/,bH=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,EH=/^[a-zA-Z]:/;function iD(t){return(t||"").toString().replace(wH,"")}var nD=[["#","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]],TA={hash:1,query:1};function PA(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 TA)delete n[s]}else if(i==="object"){for(s in t)s in TA||(n[s]=t[s]);n.slashes===void 0&&(n.slashes=vH.test(t.href))}return n}function gn(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function RA(t,e){t=iD(t),t=t.replace(IA,""),e=e||{};var r=bH.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 _H(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=iD(t),t=t.replace(IA,""),!(this instanceof yn))return new yn(t,e,r);var n,i,s,o,a,u,c=nD.slice(),l=typeof e,h=this,d=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=Lf.parse),e=PA(e),i=RA(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||EH.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=_H(h.pathname,e.pathname)),h.pathname.charAt(0)!=="/"&&gn(h.protocol)&&(h.pathname="/"+h.pathname),FA(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 CH(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||Lf.parse)(e)),n[t]=e;break;case"port":n[t]=e,FA(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,kA.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<nD.length;o++){var a=nD[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 SH(t){(!t||typeof t!="function")&&(t=Lf.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]===":"||kA.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:CH,toString:SH};yn.extractProtocol=RA;yn.location=PA;yn.trimLeft=iD;yn.qs=Lf;NA.exports=yn});var LA=b(sD=>{"use strict";Object.defineProperty(sD,"__esModule",{value:!0});sD.default=AH;function AH(){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 ZA=b(qf=>{"use strict";Object.defineProperty(qf,"__esModule",{value:!0});qf.default=void 0;var OH=_A(),xH=uD($A()),jf=uD(Zy()),gs=Qy(),TH=uD(LA());function uD(t){return t&&t.__esModule?t:{default:t}}function oD(){"use strict";oD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(_,T,I){_[T]=I.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(_,T,I){return Object.defineProperty(_,T,{value:I,enumerable:!0,configurable:!0,writable:!0}),_[T]}try{c({},"")}catch{c=function(I,$,M){return I[$]=M}}function l(_,T,I,$){var M=T&&T.prototype instanceof S?T:S,B=Object.create(M.prototype),W=new G($||[]);return i(B,"_invoke",{value:P(_,I,W)}),B}function h(_,T,I){try{return{type:"normal",arg:_.call(T,I)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",g="completed",v={};function S(){}function A(){}function p(){}var y={};c(y,o,function(){return this});var D=Object.getPrototypeOf,C=D&&D(D(L([])));C&&C!==r&&n.call(C,o)&&(y=C);var k=p.prototype=S.prototype=Object.create(y);function E(_){["next","throw","return"].forEach(function(T){c(_,T,function(I){return this._invoke(T,I)})})}function R(_,T){function I(M,B,W,q){var V=h(_[M],_,B);if(V.type!=="throw"){var ae=V.arg,x=ae.value;return x&&ys(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){I("next",O,W,q)},function(O){I("throw",O,W,q)}):T.resolve(x).then(function(O){ae.value=O,W(ae)},function(O){return I("throw",O,W,q)})}q(V.arg)}var $;i(this,"_invoke",{value:function(B,W){function q(){return new T(function(V,ae){I(B,W,V,ae)})}return $=$?$.then(q,q):q()}})}function P(_,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 W=I.delegate;if(W){var q=F(W,I);if(q){if(q===v)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(_,T,I);if(V.type==="normal"){if($=I.done?g:f,V.arg===v)continue;return{value:V.arg,done:I.done}}V.type==="throw"&&($=g,I.method="throw",I.arg=V.arg)}}}function F(_,T){var I=T.method,$=_.iterator[I];if($===t)return T.delegate=null,I==="throw"&&_.iterator.return&&(T.method="return",T.arg=t,F(_,T),T.method==="throw")||I!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+I+"' method")),v;var M=h($,_.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,v;var B=M.arg;return B?B.done?(T[_.resultName]=B.value,T.next=_.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,v):B:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,v)}function j(_){var T={tryLoc:_[0]};1 in _&&(T.catchLoc=_[1]),2 in _&&(T.finallyLoc=_[2],T.afterLoc=_[3]),this.tryEntries.push(T)}function U(_){var T=_.completion||{};T.type="normal",delete T.arg,_.completion=T}function G(_){this.tryEntries=[{tryLoc:"root"}],_.forEach(j,this),this.reset(!0)}function L(_){if(_||_===""){var T=_[o];if(T)return T.call(_);if(typeof _.next=="function")return _;if(!isNaN(_.length)){var I=-1,$=function M(){for(;++I<_.length;)if(n.call(_,I))return M.value=_[I],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(ys(_)+" is not iterable")}return A.prototype=p,i(k,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(_){var T=typeof _=="function"&&_.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(_){return Object.setPrototypeOf?Object.setPrototypeOf(_,p):(_.__proto__=p,c(_,u,"GeneratorFunction")),_.prototype=Object.create(k),_},e.awrap=function(_){return{__await:_}},E(R.prototype),c(R.prototype,a,function(){return this}),e.AsyncIterator=R,e.async=function(_,T,I,$,M){M===void 0&&(M=Promise);var B=new R(l(_,T,I,$),M);return e.isGeneratorFunction(T)?B:B.next().then(function(W){return W.done?W.value:B.next()})},E(k),c(k,u,"Generator"),c(k,o,function(){return this}),c(k,"toString",function(){return"[object Generator]"}),e.keys=function(_){var T=Object(_),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 W.type="throw",W.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],W=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 W=B?B.completion:{};return W.type=T,W.arg=I,B?(this.method="next",this.next=B.finallyLoc,v):this.complete(W)},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),v},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($),v}},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),v}},e}function jA(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 FH(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){jA(s,n,i,o,a,"next",u)}function a(u){jA(s,n,i,o,a,"throw",u)}o(void 0)})}}function KA(t,e){return PH(t)||kH(t,e)||WA(t,e)||IH()}function IH(){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 kH(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 PH(t){if(Array.isArray(t))return t}function ys(t){"@babel/helpers - typeof";return ys=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},ys(t)}function RH(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=WA(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 WA(t,e){if(t){if(typeof t=="string")return BA(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 BA(t,e)}}function BA(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 MA(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 Uo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?MA(Object(r),!0).forEach(function(n){NH(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):MA(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function NH(t,e,r){return e=XA(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $H(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qA(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,XA(n.key),n)}}function LH(t,e,r){return e&&qA(t.prototype,e),r&&qA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function XA(t){var e=jH(t,"string");return ys(e)=="symbol"?e:e+""}function jH(t,e){if(ys(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ys(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Bf="tus-v1",Mf="ietf-draft-03",Lu="ietf-draft-05",BH={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:JA,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:Bf},YA=(function(){function t(e,r){$H(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 LH(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(![Bf,Mf,Lu].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,gs.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,gs.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:qH(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,v){var S=Uo(Uo({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:Uo(Uo({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:g,onError:v,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=UA(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!Ho(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=GA(n.options.endpoint,h),(0,gs.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,gs.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,gs.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,gs.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var i=RH(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 jf.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),zA(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=UA(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===Mf||this.options.protocol===Lu)&&n.setHeader("Upload-Complete","?0"),s=this._sendRequest(n,null)),s.then(function(o){if(!Ho(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=GA(r.options.endpoint,a),(0,gs.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(!Ho(o,200)){if(o===423){r._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(Ho(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===Bf){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(!Ho(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===Bf?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Lu&&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===Mf||n.options.protocol===Lu)&&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=HA(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 VA(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=HA("DELETE",r,n);return VA(i,null,n).then(function(s){if(s.getStatus()!==204)throw new jf.default("tus: unexpected response while terminating upload",null,i,s)}).catch(function(s){if(s instanceof jf.default||(s=new jf.default("tus: failed to terminate upload",s,i,null)),!zA(s,0,n))throw s;var o=n.retryDelays[0],a=n.retryDelays.slice(1),u=Uo(Uo({},n),{},{retryDelays:a});return new Promise(function(c){return setTimeout(c,o)}).then(function(){return t.terminate(r,u)})})}}])})();function UA(t){return Object.entries(t).map(function(e){var r=KA(e,2),n=r[0],i=r[1];return"".concat(n," ").concat(OH.Base64.encode(String(i)))}).join(",")}function Ho(t,e){return t>=e&&t<e+100}function HA(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===Mf?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Lu?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=KA(o[s],2),u=a[0],c=a[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,TH.default)();n.setHeader("X-Request-ID",l)}return n}function VA(t,e,r){return aD.apply(this,arguments)}function aD(){return aD=FH(oD().mark(function t(e,r,n){var i;return oD().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)})),aD.apply(this,arguments)}function MH(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function zA(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):JA(t)}function JA(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!Ho(e,400)||e===409||e===423)&&MH()}function GA(t,e){return new xH.default(e,t).toString()}function qH(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}YA.defaultOptions=BH;var sye=qf.default=YA});var eO=b((aye,QA)=>{"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";QA.exports=Dn});var rO=b(Uf=>{"use strict";Object.defineProperty(Uf,"__esModule",{value:!0});Uf.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 UH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tO(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,VH(n.key),n)}}function HH(t,e,r){return e&&tO(t.prototype,e),r&&tO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function VH(t){var e=zH(t,"string");return ju(e)=="symbol"?e:e+""}function zH(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 uye=Uf.default=(function(){function t(e){UH(this,t),this._buffer=e,this.size=e.length}return HH(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 oO=b(fD=>{"use strict";Object.defineProperty(fD,"__esModule",{value:!0});fD.default=JH;var sO=require("fs");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 cD(){"use strict";cD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(_,T,I){_[T]=I.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(_,T,I){return Object.defineProperty(_,T,{value:I,enumerable:!0,configurable:!0,writable:!0}),_[T]}try{c({},"")}catch{c=function(I,$,M){return I[$]=M}}function l(_,T,I,$){var M=T&&T.prototype instanceof S?T:S,j=Object.create(M.prototype),K=new G($||[]);return i(j,"_invoke",{value:P(_,I,K)}),j}function h(_,T,I){try{return{type:"normal",arg:_.call(T,I)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",g="completed",v={};function S(){}function A(){}function p(){}var y={};c(y,o,function(){return this});var D=Object.getPrototypeOf,C=D&&D(D(L([])));C&&C!==r&&n.call(C,o)&&(y=C);var k=p.prototype=S.prototype=Object.create(y);function E(_){["next","throw","return"].forEach(function(T){c(_,T,function(I){return this._invoke(T,I)})})}function R(_,T){function I(M,j,K,q){var V=h(_[M],_,j);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(j,K){function q(){return new T(function(V,ae){I(j,K,V,ae)})}return $=$?$.then(q,q):q()}})}function P(_,T,I){var $=d;return function(M,j){if($===m)throw Error("Generator is already running");if($===g){if(M==="throw")throw j;return{value:t,done:!0}}for(I.method=M,I.arg=j;;){var K=I.delegate;if(K){var q=F(K,I);if(q){if(q===v)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(_,T,I);if(V.type==="normal"){if($=I.done?g:f,V.arg===v)continue;return{value:V.arg,done:I.done}}V.type==="throw"&&($=g,I.method="throw",I.arg=V.arg)}}}function F(_,T){var I=T.method,$=_.iterator[I];if($===t)return T.delegate=null,I==="throw"&&_.iterator.return&&(T.method="return",T.arg=t,F(_,T),T.method==="throw")||I!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+I+"' method")),v;var M=h($,_.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,v;var j=M.arg;return j?j.done?(T[_.resultName]=j.value,T.next=_.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,v):j:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,v)}function B(_){var T={tryLoc:_[0]};1 in _&&(T.catchLoc=_[1]),2 in _&&(T.finallyLoc=_[2],T.afterLoc=_[3]),this.tryEntries.push(T)}function U(_){var T=_.completion||{};T.type="normal",delete T.arg,_.completion=T}function G(_){this.tryEntries=[{tryLoc:"root"}],_.forEach(B,this),this.reset(!0)}function L(_){if(_||_===""){var T=_[o];if(T)return T.call(_);if(typeof _.next=="function")return _;if(!isNaN(_.length)){var I=-1,$=function M(){for(;++I<_.length;)if(n.call(_,I))return M.value=_[I],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(Ds(_)+" is not iterable")}return A.prototype=p,i(k,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(_){var T=typeof _=="function"&&_.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(_){return Object.setPrototypeOf?Object.setPrototypeOf(_,p):(_.__proto__=p,c(_,u,"GeneratorFunction")),_.prototype=Object.create(k),_},e.awrap=function(_){return{__await:_}},E(R.prototype),c(R.prototype,a,function(){return this}),e.AsyncIterator=R,e.async=function(_,T,I,$,M){M===void 0&&(M=Promise);var j=new R(l(_,T,I,$),M);return e.isGeneratorFunction(T)?j:j.next().then(function(K){return K.done?K.value:j.next()})},E(k),c(k,u,"Generator"),c(k,o,function(){return this}),c(k,"toString",function(){return"[object Generator]"}),e.keys=function(_){var T=Object(_),I=[];for(var $ in T)I.push($);return I.reverse(),function M(){for(;I.length;){var j=I.pop();if(j in T)return M.value=j,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 j=this.tryEntries[M],K=j.completion;if(j.tryLoc==="root")return $("end");if(j.tryLoc<=this.prev){var q=n.call(j,"catchLoc"),V=n.call(j,"finallyLoc");if(q&&V){if(this.prev<j.catchLoc)return $(j.catchLoc,!0);if(this.prev<j.finallyLoc)return $(j.finallyLoc)}else if(q){if(this.prev<j.catchLoc)return $(j.catchLoc,!0)}else{if(!V)throw Error("try statement without catch or finally");if(this.prev<j.finallyLoc)return $(j.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 j=M;break}}j&&(T==="break"||T==="continue")&&j.tryLoc<=I&&I<=j.finallyLoc&&(j=null);var K=j?j.completion:{};return K.type=T,K.arg=I,j?(this.method="next",this.next=j.finallyLoc,v):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),v},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($),v}},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 j=M.arg;U($)}return j}}throw Error("illegal catch attempt")},delegateYield:function(T,I,$){return this.delegate={iterator:L(T),resultName:I,nextLoc:$},this.method==="next"&&(this.arg=t),v}},e}function GH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nO(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,WH(n.key),n)}}function KH(t,e,r){return e&&nO(t.prototype,e),r&&nO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function WH(t){var e=XH(t,"string");return Ds(e)=="symbol"?e:e+""}function XH(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)}function iO(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 YH(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){iO(s,n,i,o,a,"next",u)}function a(u){iO(s,n,i,o,a,"throw",u)}o(void 0)})}}function JH(t){return lD.apply(this,arguments)}function lD(){return lD=YH(cD().mark(function t(e){var r,n,i,s,o,a,u;return cD().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,sO.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 ZH(e,n,u));case 9:case"end":return l.stop()}},t)})),lD.apply(this,arguments)}var ZH=(function(){function t(e,r,n){GH(this,t),this._stream=e,this._path=r,this.size=n}return KH(t,[{key:"slice",value:function(r,n){var i,s=(i=this._stream.start)!==null&&i!==void 0?i:0,o=(0,sO.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 dD=b(Hf=>{"use strict";Object.defineProperty(Hf,"__esModule",{value:!0});Hf.default=void 0;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 Bu(){"use strict";Bu=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(_,T,I){_[T]=I.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(_,T,I){return Object.defineProperty(_,T,{value:I,enumerable:!0,configurable:!0,writable:!0}),_[T]}try{c({},"")}catch{c=function(I,$,M){return I[$]=M}}function l(_,T,I,$){var M=T&&T.prototype instanceof S?T:S,j=Object.create(M.prototype),K=new G($||[]);return i(j,"_invoke",{value:P(_,I,K)}),j}function h(_,T,I){try{return{type:"normal",arg:_.call(T,I)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",g="completed",v={};function S(){}function A(){}function p(){}var y={};c(y,o,function(){return this});var D=Object.getPrototypeOf,C=D&&D(D(L([])));C&&C!==r&&n.call(C,o)&&(y=C);var k=p.prototype=S.prototype=Object.create(y);function E(_){["next","throw","return"].forEach(function(T){c(_,T,function(I){return this._invoke(T,I)})})}function R(_,T){function I(M,j,K,q){var V=h(_[M],_,j);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(j,K){function q(){return new T(function(V,ae){I(j,K,V,ae)})}return $=$?$.then(q,q):q()}})}function P(_,T,I){var $=d;return function(M,j){if($===m)throw Error("Generator is already running");if($===g){if(M==="throw")throw j;return{value:t,done:!0}}for(I.method=M,I.arg=j;;){var K=I.delegate;if(K){var q=F(K,I);if(q){if(q===v)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(_,T,I);if(V.type==="normal"){if($=I.done?g:f,V.arg===v)continue;return{value:V.arg,done:I.done}}V.type==="throw"&&($=g,I.method="throw",I.arg=V.arg)}}}function F(_,T){var I=T.method,$=_.iterator[I];if($===t)return T.delegate=null,I==="throw"&&_.iterator.return&&(T.method="return",T.arg=t,F(_,T),T.method==="throw")||I!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+I+"' method")),v;var M=h($,_.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,v;var j=M.arg;return j?j.done?(T[_.resultName]=j.value,T.next=_.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,v):j:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,v)}function B(_){var T={tryLoc:_[0]};1 in _&&(T.catchLoc=_[1]),2 in _&&(T.finallyLoc=_[2],T.afterLoc=_[3]),this.tryEntries.push(T)}function U(_){var T=_.completion||{};T.type="normal",delete T.arg,_.completion=T}function G(_){this.tryEntries=[{tryLoc:"root"}],_.forEach(B,this),this.reset(!0)}function L(_){if(_||_===""){var T=_[o];if(T)return T.call(_);if(typeof _.next=="function")return _;if(!isNaN(_.length)){var I=-1,$=function M(){for(;++I<_.length;)if(n.call(_,I))return M.value=_[I],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(ws(_)+" is not iterable")}return A.prototype=p,i(k,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(_){var T=typeof _=="function"&&_.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(_){return Object.setPrototypeOf?Object.setPrototypeOf(_,p):(_.__proto__=p,c(_,u,"GeneratorFunction")),_.prototype=Object.create(k),_},e.awrap=function(_){return{__await:_}},E(R.prototype),c(R.prototype,a,function(){return this}),e.AsyncIterator=R,e.async=function(_,T,I,$,M){M===void 0&&(M=Promise);var j=new R(l(_,T,I,$),M);return e.isGeneratorFunction(T)?j:j.next().then(function(K){return K.done?K.value:j.next()})},E(k),c(k,u,"Generator"),c(k,o,function(){return this}),c(k,"toString",function(){return"[object Generator]"}),e.keys=function(_){var T=Object(_),I=[];for(var $ in T)I.push($);return I.reverse(),function M(){for(;I.length;){var j=I.pop();if(j in T)return M.value=j,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 j=this.tryEntries[M],K=j.completion;if(j.tryLoc==="root")return $("end");if(j.tryLoc<=this.prev){var q=n.call(j,"catchLoc"),V=n.call(j,"finallyLoc");if(q&&V){if(this.prev<j.catchLoc)return $(j.catchLoc,!0);if(this.prev<j.finallyLoc)return $(j.finallyLoc)}else if(q){if(this.prev<j.catchLoc)return $(j.catchLoc,!0)}else{if(!V)throw Error("try statement without catch or finally");if(this.prev<j.finallyLoc)return $(j.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 j=M;break}}j&&(T==="break"||T==="continue")&&j.tryLoc<=I&&I<=j.finallyLoc&&(j=null);var K=j?j.completion:{};return K.type=T,K.arg=I,j?(this.method="next",this.next=j.finallyLoc,v):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),v},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($),v}},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 j=M.arg;U($)}return j}}throw Error("illegal catch attempt")},delegateYield:function(T,I,$){return this.delegate={iterator:L(T),resultName:I,nextLoc:$},this.method==="next"&&(this.arg=t),v}},e}function QH(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,tV(n.key),n)}}function eV(t,e,r){return e&&aO(t.prototype,e),r&&aO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function tV(t){var e=rV(t,"string");return ws(e)=="symbol"?e:e+""}function rV(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 cO(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 nV(t,e){return hD.apply(this,arguments)}function hD(){return hD=cO(Bu().mark(function t(e,r){return Bu().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)})),hD.apply(this,arguments)}var fye=Hf.default=(function(){function t(e){var r=this;QH(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 eV(t,[{key:"slice",value:(function(){var e=cO(Bu().mark(function n(i,s){var o,a,u,c,l;return Bu().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,nV(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 fO=b(zf=>{"use strict";Object.defineProperty(zf,"__esModule",{value:!0});zf.default=void 0;var iV=require("fs"),sV=Vf(eO()),oV=Vf(rO()),aV=Vf(oO()),uV=Vf(dD());function Vf(t){return t&&t.__esModule?t:{default:t}}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 cV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function lO(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&&lO(t.prototype,e),r&&lO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function fV(t){var e=hV(t,"string");return Mu(e)=="symbol"?e:e+""}function hV(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 dye=zf.default=(function(){function t(){cV(this,t)}return lV(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new oV.default(r)):r instanceof iV.ReadStream&&r.path!=null?(0,aV.default)(r):sV.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new uV.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 mO=b(pD=>{"use strict";Object.defineProperty(pD,"__esModule",{value:!0});pD.default=mV;var dV=require("crypto"),hO=pO(require("fs")),pV=pO(require("path"));function dO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(dO=function(n){return n?r:e})(t)}function pO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=dO(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 mV(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),i=(0,dV.createHash)("md5").update(n).digest("hex"),s=["node-buffer",i,t.length,e.endpoint].join("-");return Promise.resolve(s)}return t instanceof hO.ReadStream&&t.path!=null?new Promise(function(o,a){var u=pV.resolve(t.path);hO.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 vO=b((gye,wO)=>{var DO="Expected a function",gO=NaN,gV="[object Symbol]",yV=/^\s+|\s+$/g,DV=/^[-+]0x[0-9a-f]+$/i,wV=/^0b[01]+$/i,vV=/^0o[0-7]+$/i,bV=parseInt,EV=typeof global=="object"&&global&&global.Object===Object&&global,_V=typeof self=="object"&&self&&self.Object===Object&&self,CV=EV||_V||Function("return this")(),SV=Object.prototype,AV=SV.toString,OV=Math.max,xV=Math.min,mD=function(){return CV.Date.now()};function TV(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(DO);e=yO(e)||0,Gf(r)&&(l=!!r.leading,h="maxWait"in r,s=h?OV(yO(r.maxWait)||0,e):s,d="trailing"in r?!!r.trailing:d);function f(C){var k=n,E=i;return n=i=void 0,c=C,o=t.apply(E,k),o}function m(C){return c=C,a=setTimeout(S,e),l?f(C):o}function g(C){var k=C-u,E=C-c,R=e-k;return h?xV(R,s-E):R}function v(C){var k=C-u,E=C-c;return u===void 0||k>=e||k<0||h&&E>=s}function S(){var C=mD();if(v(C))return A(C);a=setTimeout(S,g(C))}function A(C){return a=void 0,d&&n?f(C):(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(mD())}function D(){var C=mD(),k=v(C);if(n=arguments,i=this,u=C,k){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 D.cancel=p,D.flush=y,D}function FV(t,e,r){var n=!0,i=!0;if(typeof t!="function")throw new TypeError(DO);return Gf(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),TV(t,e,{leading:n,maxWait:e,trailing:i})}function Gf(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function IV(t){return!!t&&typeof t=="object"}function kV(t){return typeof t=="symbol"||IV(t)&&AV.call(t)==gV}function yO(t){if(typeof t=="number")return t;if(kV(t))return gO;if(Gf(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Gf(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(yV,"");var r=wV.test(t);return r||vV.test(t)?bV(t.slice(2),r?2:8):DV.test(t)?gO:+t}wO.exports=FV});var TO=b(Yf=>{"use strict";Object.defineProperty(Yf,"__esModule",{value:!0});Yf.default=void 0;var PV=AO(require("http")),RV=AO(require("https")),_O=require("stream"),NV=require("url"),CO=$V(vO());function $V(t){return t&&t.__esModule?t:{default:t}}function SO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(SO=function(n){return n?r:e})(t)}function AO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=SO(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 LV(t,e,r){return e=Kf(e),jV(t,OO()?Reflect.construct(e,r||[],Kf(t).constructor):e.apply(t,r))}function jV(t,e){if(e&&(Vo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return BV(t)}function BV(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function OO(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(OO=function(){return!!t})()}function Kf(t){return Kf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Kf(t)}function MV(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&&gD(t,e)}function gD(t,e){return gD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},gD(t,e)}function bO(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 qu(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?bO(Object(r),!0).forEach(function(n){qV(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function qV(t,e,r){return e=xO(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Vo(t){"@babel/helpers - typeof";return Vo=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},Vo(t)}function Wf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function EO(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,xO(n.key),n)}}function Xf(t,e,r){return e&&EO(t.prototype,e),r&&EO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function xO(t){var e=UV(t,"string");return Vo(e)=="symbol"?e:e+""}function UV(t,e){if(Vo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Vo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var yye=Yf.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Wf(this,t),this._requestOptions=e}return Xf(t,[{key:"createRequest",value:function(r,n){return new HV(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),HV=(function(){function t(e,r,n){Wf(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return Xf(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=qu(qu(qu({},(0,NV.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:qu(qu({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(o.headers["Content-Length"]=n.size);var a=o.protocol==="https:"?RV:PV;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 VV(c,h))})}),u.on("error",function(c){s(c)}),n instanceof _O.Readable?n.pipe(new zV(r._progressHandler)).pipe(u):n instanceof Uint8Array?GV(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}}])})(),VV=(function(){function t(e,r){Wf(this,t),this._response=e,this._body=r}return Xf(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}}])})(),zV=(function(t){function e(r){var n;return Wf(this,e),n=LV(this,e),n._onprogress=(0,CO.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return MV(e,t),Xf(e,[{key:"_transform",value:function(n,i,s){this._position+=n.length,this._onprogress(this._position),s(null,n)}}])})(_O.Transform),GV=function(e,r,n){n=(0,CO.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 FO=b(yD=>{"use strict";yD.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};yD.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 WA(t,e){if(t){if(typeof t=="string")return BA(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 BA(t,e)}}function BA(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 MA(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 Uo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?MA(Object(r),!0).forEach(function(n){NH(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):MA(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function NH(t,e,r){return e=XA(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $H(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qA(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,XA(n.key),n)}}function LH(t,e,r){return e&&qA(t.prototype,e),r&&qA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function XA(t){var e=jH(t,"string");return ys(e)=="symbol"?e:e+""}function jH(t,e){if(ys(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ys(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Bf="tus-v1",Mf="ietf-draft-03",Lu="ietf-draft-05",BH={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:JA,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:Bf},YA=(function(){function t(e,r){$H(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 LH(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(![Bf,Mf,Lu].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,gs.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,gs.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:qH(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,v){var S=Uo(Uo({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:Uo(Uo({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:g,onError:v,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=UA(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!Ho(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=GA(n.options.endpoint,h),(0,gs.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,gs.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,gs.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,gs.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var i=RH(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 jf.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),zA(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=UA(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===Mf||this.options.protocol===Lu)&&n.setHeader("Upload-Complete","?0"),s=this._sendRequest(n,null)),s.then(function(o){if(!Ho(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=GA(r.options.endpoint,a),(0,gs.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(!Ho(o,200)){if(o===423){r._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(Ho(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===Bf){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(!Ho(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===Bf?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Lu&&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===Mf||n.options.protocol===Lu)&&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=HA(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 VA(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=HA("DELETE",r,n);return VA(i,null,n).then(function(s){if(s.getStatus()!==204)throw new jf.default("tus: unexpected response while terminating upload",null,i,s)}).catch(function(s){if(s instanceof jf.default||(s=new jf.default("tus: failed to terminate upload",s,i,null)),!zA(s,0,n))throw s;var o=n.retryDelays[0],a=n.retryDelays.slice(1),u=Uo(Uo({},n),{},{retryDelays:a});return new Promise(function(c){return setTimeout(c,o)}).then(function(){return t.terminate(r,u)})})}}])})();function UA(t){return Object.entries(t).map(function(e){var r=KA(e,2),n=r[0],i=r[1];return"".concat(n," ").concat(OH.Base64.encode(String(i)))}).join(",")}function Ho(t,e){return t>=e&&t<e+100}function HA(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===Mf?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Lu?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=KA(o[s],2),u=a[0],c=a[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,TH.default)();n.setHeader("X-Request-ID",l)}return n}function VA(t,e,r){return aD.apply(this,arguments)}function aD(){return aD=FH(oD().mark(function t(e,r,n){var i;return oD().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)})),aD.apply(this,arguments)}function MH(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function zA(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):JA(t)}function JA(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!Ho(e,400)||e===409||e===423)&&MH()}function GA(t,e){return new xH.default(e,t).toString()}function qH(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}YA.defaultOptions=BH;var sye=qf.default=YA});var eO=b((aye,QA)=>{"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";QA.exports=Dn});var rO=b(Uf=>{"use strict";Object.defineProperty(Uf,"__esModule",{value:!0});Uf.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 UH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tO(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,VH(n.key),n)}}function HH(t,e,r){return e&&tO(t.prototype,e),r&&tO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function VH(t){var e=zH(t,"string");return ju(e)=="symbol"?e:e+""}function zH(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 uye=Uf.default=(function(){function t(e){UH(this,t),this._buffer=e,this.size=e.length}return HH(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 oO=b(fD=>{"use strict";Object.defineProperty(fD,"__esModule",{value:!0});fD.default=JH;var sO=require("fs");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 cD(){"use strict";cD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(_,T,I){_[T]=I.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(_,T,I){return Object.defineProperty(_,T,{value:I,enumerable:!0,configurable:!0,writable:!0}),_[T]}try{c({},"")}catch{c=function(I,$,M){return I[$]=M}}function l(_,T,I,$){var M=T&&T.prototype instanceof S?T:S,B=Object.create(M.prototype),W=new G($||[]);return i(B,"_invoke",{value:P(_,I,W)}),B}function h(_,T,I){try{return{type:"normal",arg:_.call(T,I)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",g="completed",v={};function S(){}function A(){}function p(){}var y={};c(y,o,function(){return this});var D=Object.getPrototypeOf,C=D&&D(D(L([])));C&&C!==r&&n.call(C,o)&&(y=C);var k=p.prototype=S.prototype=Object.create(y);function E(_){["next","throw","return"].forEach(function(T){c(_,T,function(I){return this._invoke(T,I)})})}function R(_,T){function I(M,B,W,q){var V=h(_[M],_,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,W,q)},function(O){I("throw",O,W,q)}):T.resolve(x).then(function(O){ae.value=O,W(ae)},function(O){return I("throw",O,W,q)})}q(V.arg)}var $;i(this,"_invoke",{value:function(B,W){function q(){return new T(function(V,ae){I(B,W,V,ae)})}return $=$?$.then(q,q):q()}})}function P(_,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 W=I.delegate;if(W){var q=F(W,I);if(q){if(q===v)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(_,T,I);if(V.type==="normal"){if($=I.done?g:f,V.arg===v)continue;return{value:V.arg,done:I.done}}V.type==="throw"&&($=g,I.method="throw",I.arg=V.arg)}}}function F(_,T){var I=T.method,$=_.iterator[I];if($===t)return T.delegate=null,I==="throw"&&_.iterator.return&&(T.method="return",T.arg=t,F(_,T),T.method==="throw")||I!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+I+"' method")),v;var M=h($,_.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,v;var B=M.arg;return B?B.done?(T[_.resultName]=B.value,T.next=_.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,v):B:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,v)}function j(_){var T={tryLoc:_[0]};1 in _&&(T.catchLoc=_[1]),2 in _&&(T.finallyLoc=_[2],T.afterLoc=_[3]),this.tryEntries.push(T)}function U(_){var T=_.completion||{};T.type="normal",delete T.arg,_.completion=T}function G(_){this.tryEntries=[{tryLoc:"root"}],_.forEach(j,this),this.reset(!0)}function L(_){if(_||_===""){var T=_[o];if(T)return T.call(_);if(typeof _.next=="function")return _;if(!isNaN(_.length)){var I=-1,$=function M(){for(;++I<_.length;)if(n.call(_,I))return M.value=_[I],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(Ds(_)+" is not iterable")}return A.prototype=p,i(k,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(_){var T=typeof _=="function"&&_.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(_){return Object.setPrototypeOf?Object.setPrototypeOf(_,p):(_.__proto__=p,c(_,u,"GeneratorFunction")),_.prototype=Object.create(k),_},e.awrap=function(_){return{__await:_}},E(R.prototype),c(R.prototype,a,function(){return this}),e.AsyncIterator=R,e.async=function(_,T,I,$,M){M===void 0&&(M=Promise);var B=new R(l(_,T,I,$),M);return e.isGeneratorFunction(T)?B:B.next().then(function(W){return W.done?W.value:B.next()})},E(k),c(k,u,"Generator"),c(k,o,function(){return this}),c(k,"toString",function(){return"[object Generator]"}),e.keys=function(_){var T=Object(_),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 W.type="throw",W.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],W=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 W=B?B.completion:{};return W.type=T,W.arg=I,B?(this.method="next",this.next=B.finallyLoc,v):this.complete(W)},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),v},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($),v}},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),v}},e}function GH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nO(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,WH(n.key),n)}}function KH(t,e,r){return e&&nO(t.prototype,e),r&&nO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function WH(t){var e=XH(t,"string");return Ds(e)=="symbol"?e:e+""}function XH(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)}function iO(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 YH(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){iO(s,n,i,o,a,"next",u)}function a(u){iO(s,n,i,o,a,"throw",u)}o(void 0)})}}function JH(t){return lD.apply(this,arguments)}function lD(){return lD=YH(cD().mark(function t(e){var r,n,i,s,o,a,u;return cD().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,sO.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 ZH(e,n,u));case 9:case"end":return l.stop()}},t)})),lD.apply(this,arguments)}var ZH=(function(){function t(e,r,n){GH(this,t),this._stream=e,this._path=r,this.size=n}return KH(t,[{key:"slice",value:function(r,n){var i,s=(i=this._stream.start)!==null&&i!==void 0?i:0,o=(0,sO.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 dD=b(Hf=>{"use strict";Object.defineProperty(Hf,"__esModule",{value:!0});Hf.default=void 0;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 Bu(){"use strict";Bu=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(_,T,I){_[T]=I.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(_,T,I){return Object.defineProperty(_,T,{value:I,enumerable:!0,configurable:!0,writable:!0}),_[T]}try{c({},"")}catch{c=function(I,$,M){return I[$]=M}}function l(_,T,I,$){var M=T&&T.prototype instanceof S?T:S,B=Object.create(M.prototype),W=new G($||[]);return i(B,"_invoke",{value:P(_,I,W)}),B}function h(_,T,I){try{return{type:"normal",arg:_.call(T,I)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",g="completed",v={};function S(){}function A(){}function p(){}var y={};c(y,o,function(){return this});var D=Object.getPrototypeOf,C=D&&D(D(L([])));C&&C!==r&&n.call(C,o)&&(y=C);var k=p.prototype=S.prototype=Object.create(y);function E(_){["next","throw","return"].forEach(function(T){c(_,T,function(I){return this._invoke(T,I)})})}function R(_,T){function I(M,B,W,q){var V=h(_[M],_,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,W,q)},function(O){I("throw",O,W,q)}):T.resolve(x).then(function(O){ae.value=O,W(ae)},function(O){return I("throw",O,W,q)})}q(V.arg)}var $;i(this,"_invoke",{value:function(B,W){function q(){return new T(function(V,ae){I(B,W,V,ae)})}return $=$?$.then(q,q):q()}})}function P(_,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 W=I.delegate;if(W){var q=F(W,I);if(q){if(q===v)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(_,T,I);if(V.type==="normal"){if($=I.done?g:f,V.arg===v)continue;return{value:V.arg,done:I.done}}V.type==="throw"&&($=g,I.method="throw",I.arg=V.arg)}}}function F(_,T){var I=T.method,$=_.iterator[I];if($===t)return T.delegate=null,I==="throw"&&_.iterator.return&&(T.method="return",T.arg=t,F(_,T),T.method==="throw")||I!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+I+"' method")),v;var M=h($,_.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,v;var B=M.arg;return B?B.done?(T[_.resultName]=B.value,T.next=_.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,v):B:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,v)}function j(_){var T={tryLoc:_[0]};1 in _&&(T.catchLoc=_[1]),2 in _&&(T.finallyLoc=_[2],T.afterLoc=_[3]),this.tryEntries.push(T)}function U(_){var T=_.completion||{};T.type="normal",delete T.arg,_.completion=T}function G(_){this.tryEntries=[{tryLoc:"root"}],_.forEach(j,this),this.reset(!0)}function L(_){if(_||_===""){var T=_[o];if(T)return T.call(_);if(typeof _.next=="function")return _;if(!isNaN(_.length)){var I=-1,$=function M(){for(;++I<_.length;)if(n.call(_,I))return M.value=_[I],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(ws(_)+" is not iterable")}return A.prototype=p,i(k,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(_){var T=typeof _=="function"&&_.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(_){return Object.setPrototypeOf?Object.setPrototypeOf(_,p):(_.__proto__=p,c(_,u,"GeneratorFunction")),_.prototype=Object.create(k),_},e.awrap=function(_){return{__await:_}},E(R.prototype),c(R.prototype,a,function(){return this}),e.AsyncIterator=R,e.async=function(_,T,I,$,M){M===void 0&&(M=Promise);var B=new R(l(_,T,I,$),M);return e.isGeneratorFunction(T)?B:B.next().then(function(W){return W.done?W.value:B.next()})},E(k),c(k,u,"Generator"),c(k,o,function(){return this}),c(k,"toString",function(){return"[object Generator]"}),e.keys=function(_){var T=Object(_),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 W.type="throw",W.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],W=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 W=B?B.completion:{};return W.type=T,W.arg=I,B?(this.method="next",this.next=B.finallyLoc,v):this.complete(W)},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),v},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($),v}},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),v}},e}function QH(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,tV(n.key),n)}}function eV(t,e,r){return e&&aO(t.prototype,e),r&&aO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function tV(t){var e=rV(t,"string");return ws(e)=="symbol"?e:e+""}function rV(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 cO(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 nV(t,e){return hD.apply(this,arguments)}function hD(){return hD=cO(Bu().mark(function t(e,r){return Bu().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)})),hD.apply(this,arguments)}var fye=Hf.default=(function(){function t(e){var r=this;QH(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 eV(t,[{key:"slice",value:(function(){var e=cO(Bu().mark(function n(i,s){var o,a,u,c,l;return Bu().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,nV(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 fO=b(zf=>{"use strict";Object.defineProperty(zf,"__esModule",{value:!0});zf.default=void 0;var iV=require("fs"),sV=Vf(eO()),oV=Vf(rO()),aV=Vf(oO()),uV=Vf(dD());function Vf(t){return t&&t.__esModule?t:{default:t}}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 cV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function lO(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&&lO(t.prototype,e),r&&lO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function fV(t){var e=hV(t,"string");return Mu(e)=="symbol"?e:e+""}function hV(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 dye=zf.default=(function(){function t(){cV(this,t)}return lV(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new oV.default(r)):r instanceof iV.ReadStream&&r.path!=null?(0,aV.default)(r):sV.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new uV.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 mO=b(pD=>{"use strict";Object.defineProperty(pD,"__esModule",{value:!0});pD.default=mV;var dV=require("crypto"),hO=pO(require("fs")),pV=pO(require("path"));function dO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(dO=function(n){return n?r:e})(t)}function pO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=dO(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 mV(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),i=(0,dV.createHash)("md5").update(n).digest("hex"),s=["node-buffer",i,t.length,e.endpoint].join("-");return Promise.resolve(s)}return t instanceof hO.ReadStream&&t.path!=null?new Promise(function(o,a){var u=pV.resolve(t.path);hO.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 vO=b((gye,wO)=>{var DO="Expected a function",gO=NaN,gV="[object Symbol]",yV=/^\s+|\s+$/g,DV=/^[-+]0x[0-9a-f]+$/i,wV=/^0b[01]+$/i,vV=/^0o[0-7]+$/i,bV=parseInt,EV=typeof global=="object"&&global&&global.Object===Object&&global,_V=typeof self=="object"&&self&&self.Object===Object&&self,CV=EV||_V||Function("return this")(),SV=Object.prototype,AV=SV.toString,OV=Math.max,xV=Math.min,mD=function(){return CV.Date.now()};function TV(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(DO);e=yO(e)||0,Gf(r)&&(l=!!r.leading,h="maxWait"in r,s=h?OV(yO(r.maxWait)||0,e):s,d="trailing"in r?!!r.trailing:d);function f(C){var k=n,E=i;return n=i=void 0,c=C,o=t.apply(E,k),o}function m(C){return c=C,a=setTimeout(S,e),l?f(C):o}function g(C){var k=C-u,E=C-c,R=e-k;return h?xV(R,s-E):R}function v(C){var k=C-u,E=C-c;return u===void 0||k>=e||k<0||h&&E>=s}function S(){var C=mD();if(v(C))return A(C);a=setTimeout(S,g(C))}function A(C){return a=void 0,d&&n?f(C):(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(mD())}function D(){var C=mD(),k=v(C);if(n=arguments,i=this,u=C,k){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 D.cancel=p,D.flush=y,D}function FV(t,e,r){var n=!0,i=!0;if(typeof t!="function")throw new TypeError(DO);return Gf(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),TV(t,e,{leading:n,maxWait:e,trailing:i})}function Gf(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function IV(t){return!!t&&typeof t=="object"}function kV(t){return typeof t=="symbol"||IV(t)&&AV.call(t)==gV}function yO(t){if(typeof t=="number")return t;if(kV(t))return gO;if(Gf(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Gf(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(yV,"");var r=wV.test(t);return r||vV.test(t)?bV(t.slice(2),r?2:8):DV.test(t)?gO:+t}wO.exports=FV});var TO=b(Yf=>{"use strict";Object.defineProperty(Yf,"__esModule",{value:!0});Yf.default=void 0;var PV=AO(require("http")),RV=AO(require("https")),_O=require("stream"),NV=require("url"),CO=$V(vO());function $V(t){return t&&t.__esModule?t:{default:t}}function SO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(SO=function(n){return n?r:e})(t)}function AO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=SO(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 LV(t,e,r){return e=Kf(e),jV(t,OO()?Reflect.construct(e,r||[],Kf(t).constructor):e.apply(t,r))}function jV(t,e){if(e&&(Vo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return BV(t)}function BV(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function OO(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(OO=function(){return!!t})()}function Kf(t){return Kf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Kf(t)}function MV(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&&gD(t,e)}function gD(t,e){return gD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},gD(t,e)}function bO(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 qu(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?bO(Object(r),!0).forEach(function(n){qV(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function qV(t,e,r){return e=xO(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Vo(t){"@babel/helpers - typeof";return Vo=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},Vo(t)}function Wf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function EO(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,xO(n.key),n)}}function Xf(t,e,r){return e&&EO(t.prototype,e),r&&EO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function xO(t){var e=UV(t,"string");return Vo(e)=="symbol"?e:e+""}function UV(t,e){if(Vo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Vo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var yye=Yf.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Wf(this,t),this._requestOptions=e}return Xf(t,[{key:"createRequest",value:function(r,n){return new HV(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),HV=(function(){function t(e,r,n){Wf(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return Xf(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=qu(qu(qu({},(0,NV.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:qu(qu({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(o.headers["Content-Length"]=n.size);var a=o.protocol==="https:"?RV:PV;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 VV(c,h))})}),u.on("error",function(c){s(c)}),n instanceof _O.Readable?n.pipe(new zV(r._progressHandler)).pipe(u):n instanceof Uint8Array?GV(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}}])})(),VV=(function(){function t(e,r){Wf(this,t),this._response=e,this._body=r}return Xf(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}}])})(),zV=(function(t){function e(r){var n;return Wf(this,e),n=LV(this,e),n._onprogress=(0,CO.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return MV(e,t),Xf(e,[{key:"_transform",value:function(n,i,s){this._position+=n.length,this._onprogress(this._position),s(null,n)}}])})(_O.Transform),GV=function(e,r,n){n=(0,CO.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 FO=b(yD=>{"use strict";yD.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};yD.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
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 PO=b((vye,kO)=>{"use strict";kO.exports=vs;vs.factory=FO();var vD=vs("CustomError");vD.order=vs(vD,{message:"Arguments out of order.",code:"EOARG"});function vs(t,e,r,n){var i,s;return e=Jf(arguments,1,Error,IO,[DD,Zf]),r=Jf(arguments,2,{},DD,[Zf]),n=Jf(arguments,3,wD,Zf,[]),t=Jf(arguments,0,e===Error?"Error":e.prototype.CustomError.name,KV,[IO,DD,Zf]),s=e===Error,s&&n===wD&&(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,v){vs.factory[m].call(u,g,v,l)}}),h=this.CustomError.chain.length-1;h>=0;h--)d=this.CustomError.chain[h],d.factory!==wD&&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 Jf(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 vD.order;return o!==-1?t[o]:r}function Zf(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function KV(t){return typeof t=="string"}function IO(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function DD(t){return t&&typeof t=="object"}function wD(){}});var NO=b((bye,RO)=>{RO.exports=PO()});var MO=b((bs,zo)=>{var WV=1/0,XV="[object Symbol]",Uu={function:!0,object:!0},YV=Uu[typeof bs]&&bs&&!bs.nodeType?bs:void 0,JV=Uu[typeof zo]&&zo&&!zo.nodeType?zo:void 0,ZV=Qf(YV&&JV&&typeof global=="object"&&global),QV=Qf(Uu[typeof self]&&self),$O=Qf(Uu[typeof window]&&window),bD=Qf(Uu[typeof bs]&&bs),ez=ZV||$O!==(bD&&bD.window)&&$O||QV||bD||Function("return this")();function Qf(t){return t&&t.Object===Object?t:null}var tz=Object.prototype,rz=tz.toString,LO=ez.Symbol,jO=LO?LO.prototype:void 0,BO=jO?jO.toString:void 0;function nz(t){if(typeof t=="string")return t;if(sz(t))return BO?BO.call(t):"";var e=t+"";return e=="0"&&1/t==-WV?"-0":e}function iz(t){return!!t&&typeof t=="object"}function sz(t){return typeof t=="symbol"||iz(t)&&rz.call(t)==XV}zo.exports=nz});var KO=b((Es,Go)=>{var oz=MO(),az="Expected a function",UO="__lodash_hash_undefined__",uz="[object Function]",cz="[object GeneratorFunction]",lz=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,fz=/[\\^$.*+?()[\]{}|]/g,hz=/\\(\\)?/g,dz=/^\[object .+?Constructor\]$/,Vu={function:!0,object:!0},pz=Vu[typeof Es]&&Es&&!Es.nodeType?Es:void 0,mz=Vu[typeof Go]&&Go&&!Go.nodeType?Go:void 0,gz=eh(pz&&mz&&typeof global=="object"&&global),yz=eh(Vu[typeof self]&&self),qO=eh(Vu[typeof window]&&window),ED=eh(Vu[typeof Es]&&Es),Dz=gz||qO!==(ED&&ED.window)&&qO||yz||ED||Function("return this")();function eh(t){return t&&t.Object===Object?t:null}function wz(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var vz=Array.prototype,HO=Object.prototype,VO=Function.prototype.toString,_D=HO.hasOwnProperty,bz=HO.toString,Ez=RegExp("^"+VO.call(_D).replace(fz,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_z=vz.splice,Cz=zO(Dz,"Map"),Hu=zO(Object,"create");function _s(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 Sz(){this.__data__=Hu?Hu(null):{}}function Az(t){return this.has(t)&&delete this.__data__[t]}function Oz(t){var e=this.__data__;if(Hu){var r=e[t];return r===UO?void 0:r}return _D.call(e,t)?e[t]:void 0}function xz(t){var e=this.__data__;return Hu?e[t]!==void 0:_D.call(e,t)}function Tz(t,e){var r=this.__data__;return r[t]=Hu&&e===void 0?UO:e,this}_s.prototype.clear=Sz;_s.prototype.delete=Az;_s.prototype.get=Oz;_s.prototype.has=xz;_s.prototype.set=Tz;function Ko(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 Fz(){this.__data__=[]}function Iz(t){var e=this.__data__,r=th(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():_z.call(e,r,1),!0}function kz(t){var e=this.__data__,r=th(e,t);return r<0?void 0:e[r][1]}function Pz(t){return th(this.__data__,t)>-1}function Rz(t,e){var r=this.__data__,n=th(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Ko.prototype.clear=Fz;Ko.prototype.delete=Iz;Ko.prototype.get=kz;Ko.prototype.has=Pz;Ko.prototype.set=Rz;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__={hash:new _s,map:new(Cz||Ko),string:new _s}}function $z(t){return rh(this,t).delete(t)}function Lz(t){return rh(this,t).get(t)}function jz(t){return rh(this,t).has(t)}function Bz(t,e){return rh(this,t).set(t,e),this}Cs.prototype.clear=Nz;Cs.prototype.delete=$z;Cs.prototype.get=Lz;Cs.prototype.has=jz;Cs.prototype.set=Bz;function th(t,e){for(var r=t.length;r--;)if(Hz(t[r][0],e))return r;return-1}function rh(t,e){var r=t.__data__;return Mz(e)?r[typeof e=="string"?"string":"hash"]:r.map}function zO(t,e){var r=t[e];return zz(r)?r:void 0}function Mz(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var qz=CD(function(t){var e=[];return Gz(t).replace(lz,function(r,n,i,s){e.push(i?s.replace(hz,"$1"):n||r)}),e});function Uz(t){if(t!=null){try{return VO.call(t)}catch{}try{return t+""}catch{}}return""}function CD(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(az);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(CD.Cache||Cs),r}CD.Cache=Cs;function Hz(t,e){return t===e||t!==t&&e!==e}function Vz(t){var e=GO(t)?bz.call(t):"";return e==uz||e==cz}function GO(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function zz(t){if(!GO(t))return!1;var e=Vz(t)||wz(t)?Ez:dz;return e.test(Uz(t))}function Gz(t){return t==null?"":oz(t)}Go.exports=qz});var _x=b((Ss,Xo)=>{var Kz=KO(),Wz=200,ND="__lodash_hash_undefined__",ah=1,Yo=2,Xz=1/0,QO=9007199254740991,nh="[object Arguments]",OD="[object Array]",ex="[object Boolean]",tx="[object Date]",rx="[object Error]",nx="[object Function]",Yz="[object GeneratorFunction]",zu="[object Map]",ix="[object Number]",Wo="[object Object]",WO="[object Promise]",sx="[object RegExp]",Gu="[object Set]",$D="[object String]",ox="[object Symbol]",xD="[object WeakMap]",ax="[object ArrayBuffer]",ih="[object DataView]",Jz="[object Float32Array]",Zz="[object Float64Array]",Qz="[object Int8Array]",eG="[object Int16Array]",tG="[object Int32Array]",rG="[object Uint8Array]",nG="[object Uint8ClampedArray]",iG="[object Uint16Array]",sG="[object Uint32Array]",oG=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,aG=/^\w*$/,uG=/[\\^$.*+?()[\]{}|]/g,cG=/^\[object .+?Constructor\]$/,lG=/^(?:0|[1-9]\d*)$/,Je={};Je[Jz]=Je[Zz]=Je[Qz]=Je[eG]=Je[tG]=Je[rG]=Je[nG]=Je[iG]=Je[sG]=!0;Je[nh]=Je[OD]=Je[ax]=Je[ex]=Je[ih]=Je[tx]=Je[rx]=Je[nx]=Je[zu]=Je[ix]=Je[Wo]=Je[sx]=Je[Gu]=Je[$D]=Je[xD]=!1;var Wu={function:!0,object:!0},fG=Wu[typeof Ss]&&Ss&&!Ss.nodeType?Ss:void 0,hG=Wu[typeof Xo]&&Xo&&!Xo.nodeType?Xo:void 0,dG=uh(fG&&hG&&typeof global=="object"&&global),pG=uh(Wu[typeof self]&&self),XO=uh(Wu[typeof window]&&window),SD=uh(Wu[typeof Ss]&&Ss),xs=dG||XO!==(SD&&SD.window)&&XO||pG||SD||Function("return this")();function mG(t,e){for(var r=-1,n=t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function gG(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function yG(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function DG(t,e){return mG(e,function(r){return[r,t[r]]})}function uh(t){return t&&t.Object===Object?t:null}function TD(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function ux(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}function wG(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function vG(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var bG=Array.prototype,ch=Object.prototype,cx=Function.prototype.toString,As=ch.hasOwnProperty,Ts=ch.toString,EG=RegExp("^"+cx.call(As).replace(uG,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),YO=xs.Symbol,JO=xs.Uint8Array,_G=ch.propertyIsEnumerable,CG=bG.splice,SG=Object.getPrototypeOf,AG=Object.keys,FD=Jo(xs,"DataView"),sh=Jo(xs,"Map"),ID=Jo(xs,"Promise"),kD=Jo(xs,"Set"),PD=Jo(xs,"WeakMap"),Ku=Jo(Object,"create"),OG=Is(FD),xG=Is(sh),TG=Is(ID),FG=Is(kD),IG=Is(PD),ZO=YO?YO.prototype:void 0,AD=ZO?ZO.valueOf:void 0;function Os(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__=Ku?Ku(null):{}}function PG(t){return this.has(t)&&delete this.__data__[t]}function RG(t){var e=this.__data__;if(Ku){var r=e[t];return r===ND?void 0:r}return As.call(e,t)?e[t]:void 0}function NG(t){var e=this.__data__;return Ku?e[t]!==void 0:As.call(e,t)}function $G(t,e){var r=this.__data__;return r[t]=Ku&&e===void 0?ND:e,this}Os.prototype.clear=kG;Os.prototype.delete=PG;Os.prototype.get=RG;Os.prototype.has=NG;Os.prototype.set=$G;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 LG(){this.__data__=[]}function jG(t){var e=this.__data__,r=lh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():CG.call(e,r,1),!0}function BG(t){var e=this.__data__,r=lh(e,t);return r<0?void 0:e[r][1]}function MG(t){return lh(this.__data__,t)>-1}function qG(t,e){var r=this.__data__,n=lh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Wn.prototype.clear=LG;Wn.prototype.delete=jG;Wn.prototype.get=BG;Wn.prototype.has=MG;Wn.prototype.set=qG;function Fs(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__={hash:new Os,map:new(sh||Wn),string:new Os}}function HG(t){return fh(this,t).delete(t)}function VG(t){return fh(this,t).get(t)}function zG(t){return fh(this,t).has(t)}function GG(t,e){return fh(this,t).set(t,e),this}Fs.prototype.clear=UG;Fs.prototype.delete=HG;Fs.prototype.get=VG;Fs.prototype.has=zG;Fs.prototype.set=GG;function oh(t){var e=-1,r=t?t.length:0;for(this.__data__=new Fs;++e<r;)this.add(t[e])}function KG(t){return this.__data__.set(t,ND),this}function WG(t){return this.__data__.has(t)}oh.prototype.add=oh.prototype.push=KG;oh.prototype.has=WG;function Kn(t){this.__data__=new Wn(t)}function XG(){this.__data__=new Wn}function YG(t){return this.__data__.delete(t)}function JG(t){return this.__data__.get(t)}function ZG(t){return this.__data__.has(t)}function QG(t,e){var r=this.__data__;return r instanceof Wn&&r.__data__.length==Wz&&(r=this.__data__=new Fs(r.__data__)),r.set(t,e),this}Kn.prototype.clear=XG;Kn.prototype.delete=YG;Kn.prototype.get=JG;Kn.prototype.has=ZG;Kn.prototype.set=QG;function lh(t,e){for(var r=t.length;r--;)if(DK(t[r][0],e))return r;return-1}function lx(t,e){e=hh(e,t)?[e]:dx(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[dh(e[r++])];return r&&r==n?t:void 0}function fx(t,e){return As.call(t,e)||typeof t=="object"&&e in t&&dK(t)===null}function eK(t,e){return e in Object(t)}function LD(t,e,r,n,i){return t===e?!0:t==null||e==null||!mh(t)&&!Xu(e)?t!==t&&e!==e:tK(t,e,LD,r,n,i)}function tK(t,e,r,n,i,s){var o=Ti(t),a=Ti(e),u=OD,c=OD;o||(u=Gn(t),u=u==nh?Wo:u),a||(c=Gn(e),c=c==nh?Wo:c);var l=u==Wo&&!TD(t),h=c==Wo&&!TD(e),d=u==c;if(d&&!l)return s||(s=new Kn),o||bK(t)?px(t,e,r,n,i,s):cK(t,e,u,r,n,i,s);if(!(i&Yo)){var f=l&&As.call(t,"__wrapped__"),m=h&&As.call(e,"__wrapped__");if(f||m){var g=f?t.value():t,v=m?e.value():e;return s||(s=new Kn),r(g,v,n,i,s)}}return d?(s||(s=new Kn),lK(t,e,r,n,i,s)):!1}function rK(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?LD(l,c,n,ah|Yo,h):d))return!1}}return!0}function nK(t){return typeof t=="function"?t:t==null?SK:typeof t=="object"?Ti(t)?oK(t[0],t[1]):sK(t):AK(t)}function iK(t){return AG(Object(t))}function sK(t){var e=hK(t);return e.length==1&&e[0][2]?yx(e[0][0],e[0][1]):function(r){return r===t||rK(r,t,e)}}function oK(t,e){return hh(t)&&gx(e)?yx(dh(t),e):function(r){var n=EK(r,t);return n===void 0&&n===e?_K(r,t):LD(e,n,void 0,ah|Yo)}}function hx(t){return function(e){return e?.[t]}}function aK(t){return function(e){return lx(e,t)}}function dx(t){return Ti(t)?t:Kz(t)}function uK(t){return function(e){var r=Gn(e);return r==zu?ux(e):r==Gu?vG(e):DG(e,t(e))}}function px(t,e,r,n,i,s){var o=i&Yo,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&ah?new oh: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(!gG(e,function(v,S){if(!d.has(S)&&(f===v||r(f,v,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 cK(t,e,r,n,i,s,o){switch(r){case ih:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case ax:return!(t.byteLength!=e.byteLength||!n(new JO(t),new JO(e)));case ex:case tx:return+t==+e;case rx:return t.name==e.name&&t.message==e.message;case ix:return t!=+t?e!=+e:t==+e;case sx:case $D:return t==e+"";case zu:var a=ux;case Gu:var u=s&Yo;if(a||(a=wG),t.size!=e.size&&!u)return!1;var c=o.get(t);return c?c==e:(s|=ah,o.set(t,e),px(a(t),a(e),n,i,s,o));case ox:if(AD)return AD.call(t)==AD.call(e)}return!1}function lK(t,e,r,n,i,s){var o=i&Yo,a=RD(t),u=a.length,c=RD(e),l=c.length;if(u!=l&&!o)return!1;for(var h=u;h--;){var d=a[h];if(!(o?d in e:fx(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 v=t[d],S=e[d];if(n)var A=o?n(S,v,d,e,t,s):n(v,S,d,t,e,s);if(!(A===void 0?v===S||r(v,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 fK=hx("length");function fh(t,e){var r=t.__data__;return gK(e)?r[typeof e=="string"?"string":"hash"]:r.map}function hK(t){for(var e=CK(t),r=e.length;r--;)e[r][2]=gx(e[r][1]);return e}function Jo(t,e){var r=t[e];return vK(r)?r:void 0}function dK(t){return SG(Object(t))}function Gn(t){return Ts.call(t)}(FD&&Gn(new FD(new ArrayBuffer(1)))!=ih||sh&&Gn(new sh)!=zu||ID&&Gn(ID.resolve())!=WO||kD&&Gn(new kD)!=Gu||PD&&Gn(new PD)!=xD)&&(Gn=function(t){var e=Ts.call(t),r=e==Wo?t.constructor:void 0,n=r?Is(r):void 0;if(n)switch(n){case OG:return ih;case xG:return zu;case TG:return WO;case FG:return Gu;case IG:return xD}return e});function pK(t,e,r){e=hh(e,t)?[e]:dx(e);for(var n,i=-1,o=e.length;++i<o;){var s=dh(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&&ph(o)&&mx(s,o)&&(Ti(t)||bx(t)||Dx(t))}function mK(t){var e=t?t.length:void 0;return ph(e)&&(Ti(t)||bx(t)||Dx(t))?yG(e,String):null}function mx(t,e){return e=e??QO,!!e&&(typeof t=="number"||lG.test(t))&&t>-1&&t%1==0&&t<e}function hh(t,e){if(Ti(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Ex(t)?!0:aG.test(t)||!oG.test(t)||e!=null&&t in Object(e)}function gK(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function yK(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||ch;return t===r}function gx(t){return t===t&&!mh(t)}function yx(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function dh(t){if(typeof t=="string"||Ex(t))return t;var e=t+"";return e=="0"&&1/t==-Xz?"-0":e}function Is(t){if(t!=null){try{return cx.call(t)}catch{}try{return t+""}catch{}}return""}function DK(t,e){return t===e||t!==t&&e!==e}function Dx(t){return wK(t)&&As.call(t,"callee")&&(!_G.call(t,"callee")||Ts.call(t)==nh)}var Ti=Array.isArray;function wx(t){return t!=null&&ph(fK(t))&&!vx(t)}function wK(t){return Xu(t)&&wx(t)}function vx(t){var e=mh(t)?Ts.call(t):"";return e==nx||e==Yz}function ph(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=QO}function mh(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Xu(t){return!!t&&typeof t=="object"}function vK(t){if(!mh(t))return!1;var e=vx(t)||TD(t)?EG:cG;return e.test(Is(t))}function bx(t){return typeof t=="string"||!Ti(t)&&Xu(t)&&Ts.call(t)==$D}function Ex(t){return typeof t=="symbol"||Xu(t)&&Ts.call(t)==ox}function bK(t){return Xu(t)&&ph(t.length)&&!!Je[Ts.call(t)]}function EK(t,e,r){var n=t==null?void 0:lx(t,e);return n===void 0?r:n}function _K(t,e){return t!=null&&pK(t,e,eK)}function RD(t){var e=yK(t);if(!(e||wx(t)))return iK(t);var r=mK(t),n=!!r,i=r||[],s=i.length;for(var o in t)fx(t,o)&&!(n&&(o=="length"||mx(o,s)))&&!(e&&o=="constructor")&&i.push(o);return i}var CK=uK(RD);function SK(t){return t}function AK(t){return hh(t)?hx(dh(t)):aK(t)}Xo.exports=nK});var xx=b((ks,Zo)=>{var OK=1/0,xK="[object Function]",TK="[object GeneratorFunction]",FK=/[\\^$.*+?()[\]{}|]/g,IK=/^\[object .+?Constructor\]$/,Yu={function:!0,object:!0},kK=Yu[typeof ks]&&ks&&!ks.nodeType?ks:void 0,PK=Yu[typeof Zo]&&Zo&&!Zo.nodeType?Zo:void 0,RK=gh(kK&&PK&&typeof global=="object"&&global),NK=gh(Yu[typeof self]&&self),Cx=gh(Yu[typeof window]&&window),jD=gh(Yu[typeof ks]&&ks),$K=RK||Cx!==(jD&&jD.window)&&Cx||NK||jD||Function("return this")();function gh(t){return t&&t.Object===Object?t:null}function LK(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function jK(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Sx=Object.prototype,Ax=Function.prototype.toString,BK=Sx.hasOwnProperty,MK=Sx.toString,qK=RegExp("^"+Ax.call(BK).replace(FK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),BD=HK($K,"Set"),UK=BD&&1/jK(new BD([,-0]))[1]==OK?function(t){return new BD(t)}:KK;function HK(t,e){var r=t[e];return GK(r)?r:void 0}function VK(t){if(t!=null){try{return Ax.call(t)}catch{}try{return t+""}catch{}}return""}function zK(t){var e=Ox(t)?MK.call(t):"";return e==xK||e==TK}function Ox(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function GK(t){if(!Ox(t))return!1;var e=zK(t)||LK(t)?qK:IK;return e.test(VK(t))}function KK(){}Zo.exports=UK});var Fx=b((Ps,Qo)=>{var Ju={function:!0,object:!0},WK=Ju[typeof Ps]&&Ps&&!Ps.nodeType?Ps:void 0,XK=Ju[typeof Qo]&&Qo&&!Qo.nodeType?Qo:void 0,YK=yh(WK&&XK&&typeof global=="object"&&global),JK=yh(Ju[typeof self]&&self),Tx=yh(Ju[typeof window]&&window),MD=yh(Ju[typeof Ps]&&Ps),ZK=YK||Tx!==(MD&&MD.window)&&Tx||JK||MD||Function("return this")();function yh(t){return t&&t.Object===Object?t:null}Qo.exports=ZK});var $x=b((Eye,Nx)=>{var QK=xx(),eW=Fx(),tW=200,qD="__lodash_hash_undefined__",rW="[object Function]",nW="[object GeneratorFunction]",iW=/[\\^$.*+?()[\]{}|]/g,sW=/^\[object .+?Constructor\]$/;function oW(t,e){return!!t.length&&uW(t,e,0)>-1}function aW(t,e,r){for(var n=-1,i=t.length;++n<i;)if(r(e,t[n]))return!0;return!1}function uW(t,e,r){if(e!==e)return lW(t,r);for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function cW(t,e){return t.has(e)}function lW(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 fW(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function hW(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var dW=Array.prototype,Ix=Object.prototype,kx=Function.prototype.toString,UD=Ix.hasOwnProperty,pW=Ix.toString,mW=RegExp("^"+kx.call(UD).replace(iW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),gW=dW.splice,yW=Px(eW,"Map"),Zu=Px(Object,"create");function Rs(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 DW(){this.__data__=Zu?Zu(null):{}}function wW(t){return this.has(t)&&delete this.__data__[t]}function vW(t){var e=this.__data__;if(Zu){var r=e[t];return r===qD?void 0:r}return UD.call(e,t)?e[t]:void 0}function bW(t){var e=this.__data__;return Zu?e[t]!==void 0:UD.call(e,t)}function EW(t,e){var r=this.__data__;return r[t]=Zu&&e===void 0?qD:e,this}Rs.prototype.clear=DW;Rs.prototype.delete=wW;Rs.prototype.get=vW;Rs.prototype.has=bW;Rs.prototype.set=EW;function ea(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 _W(){this.__data__=[]}function CW(t){var e=this.__data__,r=wh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():gW.call(e,r,1),!0}function SW(t){var e=this.__data__,r=wh(e,t);return r<0?void 0:e[r][1]}function AW(t){return wh(this.__data__,t)>-1}function OW(t,e){var r=this.__data__,n=wh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ea.prototype.clear=_W;ea.prototype.delete=CW;ea.prototype.get=SW;ea.prototype.has=AW;ea.prototype.set=OW;function ta(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__={hash:new Rs,map:new(yW||ea),string:new Rs}}function TW(t){return vh(this,t).delete(t)}function FW(t){return vh(this,t).get(t)}function IW(t){return vh(this,t).has(t)}function kW(t,e){return vh(this,t).set(t,e),this}ta.prototype.clear=xW;ta.prototype.delete=TW;ta.prototype.get=FW;ta.prototype.has=IW;ta.prototype.set=kW;function Dh(t){var e=-1,r=t?t.length:0;for(this.__data__=new ta;++e<r;)this.add(t[e])}function PW(t){return this.__data__.set(t,qD),this}function RW(t){return this.__data__.has(t)}Dh.prototype.add=Dh.prototype.push=PW;Dh.prototype.has=RW;function wh(t,e){for(var r=t.length;r--;)if(jW(t[r][0],e))return r;return-1}function NW(t,e,r){var n=-1,i=oW,s=t.length,o=!0,a=[],u=a;if(r)o=!1,i=aW;else if(s>=tW){var c=e?null:QK(t);if(c)return hW(c);o=!1,i=cW,u=new Dh}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 vh(t,e){var r=t.__data__;return $W(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Px(t,e){var r=t[e];return MW(r)?r:void 0}function $W(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function LW(t){if(t!=null){try{return kx.call(t)}catch{}try{return t+""}catch{}}return""}function jW(t,e){return t===e||t!==t&&e!==e}function BW(t){var e=Rx(t)?pW.call(t):"";return e==rW||e==nW}function Rx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function MW(t){if(!Rx(t))return!1;var e=BW(t)||fW(t)?mW:sW;return e.test(LW(t))}Nx.exports=NW});var jx=b((_ye,Lx)=>{var qW=_x(),UW=$x();function HW(t,e){return t&&t.length?UW(t,qW(e)):[]}Lx.exports=HW});var Mx=b((Cye,Bx)=>{"use strict";var VW=NO(),zW=jx(),GW=VW("MultiError");Bx.exports=HD;function HD(t){if(!(this instanceof HD))return new HD(t);if(t=Array.isArray(t)?t:[t],t=zW(t,function(r){return r.stack}),t.length===1)return t[0];var e=new GW({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(`
|
|
@@ -54,7 +54,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
54
54
|
`)}),e.__defineSetter__("stack",function(r){return[r].concat(e.stack).join(`
|
|
55
55
|
|
|
56
56
|
`)}),e}});var Ux=b((Sye,qx)=>{var Fi=require("constants"),KW=process.cwd,bh=null,WW=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return bh||(bh=KW.call(process)),bh};try{process.cwd()}catch{}typeof process.chdir=="function"&&(VD=process.chdir,process.chdir=function(t){bh=null,VD.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,VD));var VD;qx.exports=XW;function XW(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(){}),WW==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function h(d,f,m){var g=Date.now(),v=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,y){p&&p.code==="ENOENT"?l(d,f,S):m(A)})},v),v<100&&(v+=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,v,S){var A;if(S&&typeof S=="function"){var p=0;A=function(y,D,C){if(y&&y.code==="EAGAIN"&&p<10)return p++,l.call(t,d,f,m,g,v,A);S.apply(this,arguments)}}return l.call(t,d,f,m,g,v,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 v=0;;)try{return l.call(t,h,d,f,m,g)}catch(S){if(S.code==="EAGAIN"&&v<10){v++;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(v){l.close(g,function(S){f&&f(v||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,v){if(g){m&&m(g);return}l.futimes(v,d,f,function(S){l.close(v,function(A){m&&m(S||A)})})})},l.lutimesSync=function(h,d,f){var m=l.openSync(h,Fi.O_SYMLINK),g,v=!0;try{g=l.futimesSync(m,d,f),v=!1}finally{if(v)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,v){v&&(v.uid<0&&(v.uid+=4294967296),v.gid<0&&(v.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 zx=b((Aye,Vx)=>{var Hx=require("stream").Stream;Vx.exports=YW;function YW(t){return{ReadStream:e,WriteStream:r};function e(n,i){if(!(this instanceof e))return new e(n,i);Hx.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);Hx.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 Kx=b((Oye,Gx)=>{"use strict";Gx.exports=ZW;var JW=Object.getPrototypeOf||function(t){return t.__proto__};function ZW(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:JW(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=b((xye,KD)=>{var lt=require("fs"),QW=Ux(),eX=zx(),tX=Kx(),Eh=require("util"),Mt,Ch;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Mt=Symbol.for("graceful-fs.queue"),Ch=Symbol.for("graceful-fs.previous")):(Mt="___graceful-fs.queue",Ch="___graceful-fs.previous");function rX(){}function Yx(t,e){Object.defineProperty(t,Mt,{get:function(){return e}})}var Ns=rX;Eh.debuglog?Ns=Eh.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Ns=function(){var t=Eh.format.apply(Eh,arguments);t="GFS4: "+t.split(/\n/).join(`
|
|
57
|
-
GFS4: `),console.error(t)});lt[Mt]||(Wx=global[Mt]||[],Yx(lt,Wx),lt.close=(function(t){function e(r,n){return t.call(lt,r,function(i){i||Xx(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Ch,{value:t}),e})(lt.close),lt.closeSync=(function(t){function e(r){t.apply(lt,arguments),Xx()}return Object.defineProperty(e,Ch,{value:t}),e})(lt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Ns(lt[Mt]),require("assert").equal(lt[Mt].length,0)}));var Wx;global[Mt]||Yx(global,lt[Mt]);KD.exports=zD(tX(lt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!lt.__patched&&(KD.exports=zD(lt),lt.__patched=!0);function zD(t){QW(t),t.gracefulify=zD,t.createReadStream=D,t.createWriteStream=C;var e=t.readFile;t.readFile=r;function r(R,P,F){return typeof P=="function"&&(F=P,P=null),B(R,P,F);function B(U,G,L,_){return e(U,G,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?ra([B,[U,G,L],T,_||Date.now(),Date.now()]):typeof L=="function"&&L.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(R,P,F,B){return typeof F=="function"&&(B=F,F=null),U(R,P,F,B);function U(G,L,_,T,I){return n(G,L,_,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ra([U,[G,L,_,T],$,I||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var s=t.appendFile;s&&(t.appendFile=o);function o(R,P,F,B){return typeof F=="function"&&(B=F,F=null),U(R,P,F,B);function U(G,L,_,T,I){return s(G,L,_,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ra([U,[G,L,_,T],$,I||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=u);function u(R,P,F,B){return typeof F=="function"&&(B=F,F=0),U(R,P,F,B);function U(G,L,_,T,I){return a(G,L,_,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ra([U,[G,L,_,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,P,F){typeof P=="function"&&(F=P,P=null);var B=l.test(process.version)?function(L,_,T,I){return c(L,U(L,_,T,I))}:function(L,_,T,I){return c(L,_,U(L,_,T,I))};return B(R,P,F);function U(G,L,_,T){return function(I,$){I&&(I.code==="EMFILE"||I.code==="ENFILE")?ra([B,[G,L,_],I,T||Date.now(),Date.now()]):($&&$.sort&&$.sort(),typeof _=="function"&&_.call(this,I,$))}}}if(process.version.substr(0,4)==="v0.8"){var d=eX(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 v=p;Object.defineProperty(t,"FileWriteStream",{get:function(){return v},set:function(R){v=R},enumerable:!0,configurable:!0});function S(R,P){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(P,F){P?(R.autoClose&&R.destroy(),R.emit("error",P)):(R.fd=F,R.emit("open",F),R.read())})}function p(R,P){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(P,F){P?(R.destroy(),R.emit("error",P)):(R.fd=F,R.emit("open",F))})}function D(R,P){return new t.ReadStream(R,P)}function C(R,P){return new t.WriteStream(R,P)}var k=t.open;t.open=E;function E(R,P,F,B){return typeof F=="function"&&(B=F,F=null),U(R,P,F,B);function U(G,L,_,T,I){return k(G,L,_,function($,M){$&&($.code==="EMFILE"||$.code==="ENFILE")?ra([U,[G,L,_,T],$,I||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}return t}function ra(t){Ns("ENQUEUE",t[0].name,t[1]),lt[Mt].push(t),GD()}var _h;function Xx(){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);GD()}function GD(){if(clearTimeout(_h),_h=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)Ns("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){Ns("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?(Ns("RETRY",e.name,r),e.apply(null,r.concat([i]))):lt[Mt].push(t)}_h===void 0&&(_h=setTimeout(GD,0))}}});var Zx=b((Tye,Jx)=>{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))}Jx.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 Qx=b($s=>{var nX=Zx();$s.operation=function(t){var e=$s.timeouts(t);return new nX(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};$s.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};$s.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};$s.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=$s.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 t1=b((Iye,e1)=>{e1.exports=Qx()});var r1=b((kye,Sh)=>{Sh.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Sh.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Sh.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Th=b((Pye,sa)=>{var it=global.process,Ls=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"};Ls(it)?(n1=require("assert"),na=r1(),i1=/^win/i.test(it.platform),Qu=require("events"),typeof Qu!="function"&&(Qu=Qu.EventEmitter),it.__signal_exit_emitter__?kt=it.__signal_exit_emitter__:(kt=it.__signal_exit_emitter__=new Qu,kt.count=0,kt.emitted={}),kt.infinite||(kt.setMaxListeners(1/0),kt.infinite=!0),sa.exports=function(t,e){if(!Ls(global.process))return function(){};n1.equal(typeof t,"function","a callback must be provided for exit handler"),ia===!1&&WD();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){kt.removeListener(r,t),kt.listeners("exit").length===0&&kt.listeners("afterexit").length===0&&Ah()};return kt.on(r,t),n},Ah=function(){!ia||!Ls(global.process)||(ia=!1,na.forEach(function(e){try{it.removeListener(e,Oh[e])}catch{}}),it.emit=xh,it.reallyExit=XD,kt.count-=1)},sa.exports.unload=Ah,js=function(e,r,n){kt.emitted[e]||(kt.emitted[e]=!0,kt.emit(e,r,n))},Oh={},na.forEach(function(t){Oh[t]=function(){if(Ls(global.process)){var r=it.listeners(t);r.length===kt.count&&(Ah(),js("exit",null,t),js("afterexit",null,t),i1&&t==="SIGHUP"&&(t="SIGINT"),it.kill(it.pid,t))}}}),sa.exports.signals=function(){return na},ia=!1,WD=function(){ia||!Ls(global.process)||(ia=!0,kt.count+=1,na=na.filter(function(e){try{return it.on(e,Oh[e]),!0}catch{return!1}}),it.emit=o1,it.reallyExit=s1)},sa.exports.load=WD,XD=it.reallyExit,s1=function(e){Ls(global.process)&&(it.exitCode=e||0,js("exit",it.exitCode,null),js("afterexit",it.exitCode,null),XD.call(it,it.exitCode))},xh=it.emit,o1=function(e,r){if(e==="exit"&&Ls(global.process)){r!==void 0&&(it.exitCode=r);var n=xh.apply(this,arguments);return js("exit",it.exitCode,null),js("afterexit",it.exitCode,null),n}else return xh.apply(this,arguments)}):sa.exports=function(){return function(){}};var n1,na,i1,Qu,kt,Ah,js,Oh,ia,WD,XD,s1,xh,o1});var u1=b((Rye,YD)=>{"use strict";var a1=Symbol();function iX(t,e,r){let n=e[a1];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,a1,{value:u}),r(null,a.mtime,u)})})}function sX(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}YD.exports.probe=iX;YD.exports.getMtime=sX});var d1=b((Nye,tc)=>{"use strict";var oX=require("path"),QD=gt(),aX=t1(),uX=Th(),c1=u1(),Xn={};function ec(t,e){return e.lockfilePath||`${t}.lock`}function e0(t,e,r){if(!e.realpath)return r(null,oX.resolve(t));e.fs.realpath(t,r)}function ZD(t,e,r){let n=ec(t,e);e.fs.mkdir(n,i=>{if(!i)return c1.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"?ZD(t,{...e,stale:0},r):r(s);if(!l1(o,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));f1(t,e,a=>{if(a)return r(a);ZD(t,{...e,stale:0},r)})})})}function l1(t,e){return t.mtime.getTime()<Date.now()-e.stale}function f1(t,e,r){e.fs.rmdir(ec(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Fh(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?JD(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Fh(t,e));if(!(r.mtime.getTime()===i.mtime.getTime()))return JD(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=c1.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?JD(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Fh(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,Fh(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function JD(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),Xn[t]===e&&delete Xn[t],e.options.onCompromised(r)}function cX(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:QD,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),e0(t,e,(n,i)=>{if(n)return r(n);let s=aX.operation(e.retries);s.attempt(()=>{ZD(i,e,(o,a,u)=>{if(s.retry(o))return;if(o)return r(s.mainError());let c=Xn[i]={lockfilePath:ec(i,e),mtime:a,mtimePrecision:u,options:e,lastUpdate:Date.now()};Fh(i,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));h1(i,{...e,realpath:!1},l)})})})})}function h1(t,e,r){e={fs:QD,realpath:!0,...e},e0(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],f1(i,e,r)})}function lX(t,e,r){e={stale:1e4,realpath:!0,fs:QD,...e},e.stale=Math.max(e.stale||0,2e3),e0(t,e,(n,i)=>{if(n)return r(n);e.fs.stat(ec(i,e),(s,o)=>s?s.code==="ENOENT"?r(null,!1):r(s):r(null,!l1(o,e)))})}function fX(){return Xn}uX(()=>{for(let t in Xn){let e=Xn[t].options;try{e.fs.rmdirSync(ec(t,e))}catch{}}});tc.exports.lock=cX;tc.exports.unlock=h1;tc.exports.check=lX;tc.exports.getLocks=fX});var m1=b(($ye,p1)=>{"use strict";var hX=gt();function dX(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 pX(t){return(...e)=>new Promise((r,n)=>{e.push((i,s)=>{i?n(i):r(s)}),t(...e)})}function mX(t){return(...e)=>{let r,n;if(e.push((i,s)=>{r=i,n=s}),t(...e),r)throw r;return n}}function gX(t){if(t={...t},t.fs=dX(t.fs||hX),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}p1.exports={toPromise:pX,toSync:mX,toSyncOptions:gX}});var y1=b((Lye,Ii)=>{"use strict";var oa=d1(),{toPromise:Ih,toSync:kh,toSyncOptions:t0}=m1();async function g1(t,e){let r=await Ih(oa.lock)(t,e);return Ih(r)}function yX(t,e){let r=kh(oa.lock)(t,t0(e));return kh(r)}function DX(t,e){return Ih(oa.unlock)(t,e)}function wX(t,e){return kh(oa.unlock)(t,t0(e))}function vX(t,e){return Ih(oa.check)(t,e)}function bX(t,e){return kh(oa.check)(t,t0(e))}Ii.exports=g1;Ii.exports.lock=g1;Ii.exports.unlock=DX;Ii.exports.lockSync=yX;Ii.exports.unlockSync=wX;Ii.exports.check=vX;Ii.exports.checkSync=bX});var E1=b(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.canStoreURLs=aa.FileUrlStorage=void 0;var D1=require("fs"),EX=CX(Mx()),w1=_X(y1());function b1(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(b1=function(n){return n?r:e})(t)}function _X(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=b1(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 CX(t){return t&&t.__esModule?t:{default:t}}function rc(t){"@babel/helpers - typeof";return rc=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},rc(t)}function SX(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v1(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,OX(n.key),n)}}function AX(t,e,r){return e&&v1(t.prototype,e),r&&v1(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function OX(t){var e=xX(t,"string");return rc(e)=="symbol"?e:e+""}function xX(t,e){if(rc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(rc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var jye=aa.canStoreURLs=!0,Bye=aa.FileUrlStorage=(function(){function t(e){SX(this,t),this.path=e}return AX(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;w1.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;w1.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,EX.default)([i,s]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var i={encoding:"utf8",mode:432,flag:"w"};(0,D1.writeFile)(this.path,JSON.stringify(r),i,function(s){return n(s)})}},{key:"_getData",value:function(r){(0,D1.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 i0=b(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});Object.defineProperty(wr,"DefaultHttpStack",{enumerable:!0,get:function(){return A1.default}});Object.defineProperty(wr,"DetailedError",{enumerable:!0,get:function(){return TX.default}});Object.defineProperty(wr,"FileUrlStorage",{enumerable:!0,get:function(){return O1.FileUrlStorage}});Object.defineProperty(wr,"StreamSource",{enumerable:!0,get:function(){return RX.default}});wr.Upload=void 0;Object.defineProperty(wr,"canStoreURLs",{enumerable:!0,get:function(){return O1.canStoreURLs}});wr.defaultOptions=void 0;Object.defineProperty(wr,"enableDebugLog",{enumerable:!0,get:function(){return FX.enableDebugLog}});wr.isSupported=void 0;var TX=Bs(Zy()),FX=Qy(),IX=Bs(EA()),r0=Bs(ZA()),kX=Bs(fO()),PX=Bs(mO()),A1=Bs(TO()),RX=Bs(dD()),O1=E1();function Bs(t){return t&&t.__esModule?t:{default:t}}function ca(t){"@babel/helpers - typeof";return ca=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},ca(t)}function NX(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _1(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,T1(n.key),n)}}function $X(t,e,r){return e&&_1(t.prototype,e),r&&_1(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function LX(t,e,r){return e=Ph(e),jX(t,x1()?Reflect.construct(e,r||[],Ph(t).constructor):e.apply(t,r))}function jX(t,e){if(e&&(ca(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return BX(t)}function BX(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function x1(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(x1=function(){return!!t})()}function Ph(t){return Ph=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ph(t)}function MX(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&&n0(t,e)}function n0(t,e){return n0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},n0(t,e)}function C1(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 ua(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?C1(Object(r),!0).forEach(function(n){qX(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):C1(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function qX(t,e,r){return e=T1(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function T1(t){var e=UX(t,"string");return ca(e)=="symbol"?e:e+""}function UX(t,e){if(ca(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ca(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var S1=wr.defaultOptions=ua(ua({},r0.default.defaultOptions),{},{httpStack:new A1.default,fileReader:new kX.default,urlStorage:new IX.default,fingerprint:PX.default}),qye=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 NX(this,e),n=ua(ua({},S1),n),LX(this,e,[r,n])}return MX(e,t),$X(e,null,[{key:"terminate",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i=ua(ua({},S1),i),r0.default.terminate(n,i)}}])})(r0.default),Uye=wr.isSupported=!0});var P1=b((rDe,k1)=>{var la=1e3,fa=la*60,ha=fa*60,Ms=ha*24,GX=Ms*7,KX=Ms*365.25;k1.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return WX(t);if(r==="number"&&isFinite(t))return e.long?YX(t):XX(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function WX(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*KX;case"weeks":case"week":case"w":return r*GX;case"days":case"day":case"d":return r*Ms;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ha;case"minutes":case"minute":case"mins":case"min":case"m":return r*fa;case"seconds":case"second":case"secs":case"sec":case"s":return r*la;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function XX(t){var e=Math.abs(t);return e>=Ms?Math.round(t/Ms)+"d":e>=ha?Math.round(t/ha)+"h":e>=fa?Math.round(t/fa)+"m":e>=la?Math.round(t/la)+"s":t+"ms"}function YX(t){var e=Math.abs(t);return e>=Ms?Nh(t,e,Ms,"day"):e>=ha?Nh(t,e,ha,"hour"):e>=fa?Nh(t,e,fa,"minute"):e>=la?Nh(t,e,la,"second"):t+" ms"}function Nh(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var o0=b((nDe,R1)=>{function JX(t){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=i,r.enabled=a,r.humanize=P1(),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(...v){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,v[0]=r.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let y=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(C,k)=>{if(C==="%%")return"%";y++;let E=r.formatters[k];if(typeof E=="function"){let R=v[y];C=E.call(S,R),v.splice(y,1),y--}return C}),r.formatArgs.call(S,v),(S.log||r.log).apply(S,v)}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:v=>{d=v}}),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}R1.exports=JX});var N1=b((vr,$h)=>{vr.formatArgs=QX;vr.save=eY;vr.load=tY;vr.useColors=ZX;vr.storage=rY();vr.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`."))}})();vr.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 ZX(){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 QX(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+$h.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)}vr.log=console.debug||console.log||(()=>{});function eY(t){try{t?vr.storage.setItem("debug",t):vr.storage.removeItem("debug")}catch{}}function tY(){let t;try{t=vr.storage.getItem("debug")||vr.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function rY(){try{return localStorage}catch{}}$h.exports=o0()(vr);var{formatters:nY}=$h.exports;nY.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var L1=b((iDe,$1)=>{"use strict";$1.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 M1=b((sDe,B1)=>{"use strict";var iY=require("os"),j1=require("tty"),Hr=L1(),{env:Pt}=process,Pi;Hr("no-color")||Hr("no-colors")||Hr("color=false")||Hr("color=never")?Pi=0:(Hr("color")||Hr("colors")||Hr("color=true")||Hr("color=always"))&&(Pi=1);"FORCE_COLOR"in Pt&&(Pt.FORCE_COLOR==="true"?Pi=1:Pt.FORCE_COLOR==="false"?Pi=0:Pi=Pt.FORCE_COLOR.length===0?1:Math.min(parseInt(Pt.FORCE_COLOR,10),3));function a0(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function u0(t,e){if(Pi===0)return 0;if(Hr("color=16m")||Hr("color=full")||Hr("color=truecolor"))return 3;if(Hr("color=256"))return 2;if(t&&!e&&Pi===void 0)return 0;let r=Pi||0;if(Pt.TERM==="dumb")return r;if(process.platform==="win32"){let n=iY.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in Pt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in Pt)||Pt.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in Pt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Pt.TEAMCITY_VERSION)?1:0;if(Pt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Pt){let n=parseInt((Pt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Pt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Pt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Pt.TERM)||"COLORTERM"in Pt?1:r}function sY(t){let e=u0(t,t&&t.isTTY);return a0(e)}B1.exports={supportsColor:sY,stdout:a0(u0(!0,j1.isatty(1))),stderr:a0(u0(!0,j1.isatty(2)))}});var U1=b((Rt,jh)=>{var oY=require("tty"),Lh=require("util");Rt.init=dY;Rt.log=lY;Rt.formatArgs=uY;Rt.save=fY;Rt.load=hY;Rt.useColors=aY;Rt.destroy=Lh.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=M1();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 aY(){return"colors"in Rt.inspectOpts?!!Rt.inspectOpts.colors:oY.isatty(process.stderr.fd)}function uY(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(`
|
|
57
|
+
GFS4: `),console.error(t)});lt[Mt]||(Wx=global[Mt]||[],Yx(lt,Wx),lt.close=(function(t){function e(r,n){return t.call(lt,r,function(i){i||Xx(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Ch,{value:t}),e})(lt.close),lt.closeSync=(function(t){function e(r){t.apply(lt,arguments),Xx()}return Object.defineProperty(e,Ch,{value:t}),e})(lt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Ns(lt[Mt]),require("assert").equal(lt[Mt].length,0)}));var Wx;global[Mt]||Yx(global,lt[Mt]);KD.exports=zD(tX(lt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!lt.__patched&&(KD.exports=zD(lt),lt.__patched=!0);function zD(t){QW(t),t.gracefulify=zD,t.createReadStream=D,t.createWriteStream=C;var e=t.readFile;t.readFile=r;function r(R,P,F){return typeof P=="function"&&(F=P,P=null),j(R,P,F);function j(U,G,L,_){return e(U,G,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?ra([j,[U,G,L],T,_||Date.now(),Date.now()]):typeof L=="function"&&L.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(R,P,F,j){return typeof F=="function"&&(j=F,F=null),U(R,P,F,j);function U(G,L,_,T,I){return n(G,L,_,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ra([U,[G,L,_,T],$,I||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var s=t.appendFile;s&&(t.appendFile=o);function o(R,P,F,j){return typeof F=="function"&&(j=F,F=null),U(R,P,F,j);function U(G,L,_,T,I){return s(G,L,_,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ra([U,[G,L,_,T],$,I||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=u);function u(R,P,F,j){return typeof F=="function"&&(j=F,F=0),U(R,P,F,j);function U(G,L,_,T,I){return a(G,L,_,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ra([U,[G,L,_,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,P,F){typeof P=="function"&&(F=P,P=null);var j=l.test(process.version)?function(L,_,T,I){return c(L,U(L,_,T,I))}:function(L,_,T,I){return c(L,_,U(L,_,T,I))};return j(R,P,F);function U(G,L,_,T){return function(I,$){I&&(I.code==="EMFILE"||I.code==="ENFILE")?ra([j,[G,L,_],I,T||Date.now(),Date.now()]):($&&$.sort&&$.sort(),typeof _=="function"&&_.call(this,I,$))}}}if(process.version.substr(0,4)==="v0.8"){var d=eX(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 v=p;Object.defineProperty(t,"FileWriteStream",{get:function(){return v},set:function(R){v=R},enumerable:!0,configurable:!0});function S(R,P){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(P,F){P?(R.autoClose&&R.destroy(),R.emit("error",P)):(R.fd=F,R.emit("open",F),R.read())})}function p(R,P){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(P,F){P?(R.destroy(),R.emit("error",P)):(R.fd=F,R.emit("open",F))})}function D(R,P){return new t.ReadStream(R,P)}function C(R,P){return new t.WriteStream(R,P)}var k=t.open;t.open=E;function E(R,P,F,j){return typeof F=="function"&&(j=F,F=null),U(R,P,F,j);function U(G,L,_,T,I){return k(G,L,_,function($,M){$&&($.code==="EMFILE"||$.code==="ENFILE")?ra([U,[G,L,_,T],$,I||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}return t}function ra(t){Ns("ENQUEUE",t[0].name,t[1]),lt[Mt].push(t),GD()}var _h;function Xx(){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);GD()}function GD(){if(clearTimeout(_h),_h=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)Ns("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){Ns("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?(Ns("RETRY",e.name,r),e.apply(null,r.concat([i]))):lt[Mt].push(t)}_h===void 0&&(_h=setTimeout(GD,0))}}});var Zx=b((Tye,Jx)=>{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))}Jx.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 Qx=b($s=>{var nX=Zx();$s.operation=function(t){var e=$s.timeouts(t);return new nX(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};$s.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};$s.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};$s.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=$s.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 t1=b((Iye,e1)=>{e1.exports=Qx()});var r1=b((kye,Sh)=>{Sh.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Sh.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Sh.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Th=b((Pye,sa)=>{var it=global.process,Ls=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"};Ls(it)?(n1=require("assert"),na=r1(),i1=/^win/i.test(it.platform),Qu=require("events"),typeof Qu!="function"&&(Qu=Qu.EventEmitter),it.__signal_exit_emitter__?kt=it.__signal_exit_emitter__:(kt=it.__signal_exit_emitter__=new Qu,kt.count=0,kt.emitted={}),kt.infinite||(kt.setMaxListeners(1/0),kt.infinite=!0),sa.exports=function(t,e){if(!Ls(global.process))return function(){};n1.equal(typeof t,"function","a callback must be provided for exit handler"),ia===!1&&WD();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){kt.removeListener(r,t),kt.listeners("exit").length===0&&kt.listeners("afterexit").length===0&&Ah()};return kt.on(r,t),n},Ah=function(){!ia||!Ls(global.process)||(ia=!1,na.forEach(function(e){try{it.removeListener(e,Oh[e])}catch{}}),it.emit=xh,it.reallyExit=XD,kt.count-=1)},sa.exports.unload=Ah,js=function(e,r,n){kt.emitted[e]||(kt.emitted[e]=!0,kt.emit(e,r,n))},Oh={},na.forEach(function(t){Oh[t]=function(){if(Ls(global.process)){var r=it.listeners(t);r.length===kt.count&&(Ah(),js("exit",null,t),js("afterexit",null,t),i1&&t==="SIGHUP"&&(t="SIGINT"),it.kill(it.pid,t))}}}),sa.exports.signals=function(){return na},ia=!1,WD=function(){ia||!Ls(global.process)||(ia=!0,kt.count+=1,na=na.filter(function(e){try{return it.on(e,Oh[e]),!0}catch{return!1}}),it.emit=o1,it.reallyExit=s1)},sa.exports.load=WD,XD=it.reallyExit,s1=function(e){Ls(global.process)&&(it.exitCode=e||0,js("exit",it.exitCode,null),js("afterexit",it.exitCode,null),XD.call(it,it.exitCode))},xh=it.emit,o1=function(e,r){if(e==="exit"&&Ls(global.process)){r!==void 0&&(it.exitCode=r);var n=xh.apply(this,arguments);return js("exit",it.exitCode,null),js("afterexit",it.exitCode,null),n}else return xh.apply(this,arguments)}):sa.exports=function(){return function(){}};var n1,na,i1,Qu,kt,Ah,js,Oh,ia,WD,XD,s1,xh,o1});var u1=b((Rye,YD)=>{"use strict";var a1=Symbol();function iX(t,e,r){let n=e[a1];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,a1,{value:u}),r(null,a.mtime,u)})})}function sX(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}YD.exports.probe=iX;YD.exports.getMtime=sX});var d1=b((Nye,tc)=>{"use strict";var oX=require("path"),QD=gt(),aX=t1(),uX=Th(),c1=u1(),Xn={};function ec(t,e){return e.lockfilePath||`${t}.lock`}function e0(t,e,r){if(!e.realpath)return r(null,oX.resolve(t));e.fs.realpath(t,r)}function ZD(t,e,r){let n=ec(t,e);e.fs.mkdir(n,i=>{if(!i)return c1.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"?ZD(t,{...e,stale:0},r):r(s);if(!l1(o,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));f1(t,e,a=>{if(a)return r(a);ZD(t,{...e,stale:0},r)})})})}function l1(t,e){return t.mtime.getTime()<Date.now()-e.stale}function f1(t,e,r){e.fs.rmdir(ec(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Fh(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?JD(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Fh(t,e));if(!(r.mtime.getTime()===i.mtime.getTime()))return JD(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=c1.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?JD(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Fh(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,Fh(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function JD(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),Xn[t]===e&&delete Xn[t],e.options.onCompromised(r)}function cX(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:QD,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),e0(t,e,(n,i)=>{if(n)return r(n);let s=aX.operation(e.retries);s.attempt(()=>{ZD(i,e,(o,a,u)=>{if(s.retry(o))return;if(o)return r(s.mainError());let c=Xn[i]={lockfilePath:ec(i,e),mtime:a,mtimePrecision:u,options:e,lastUpdate:Date.now()};Fh(i,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));h1(i,{...e,realpath:!1},l)})})})})}function h1(t,e,r){e={fs:QD,realpath:!0,...e},e0(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],f1(i,e,r)})}function lX(t,e,r){e={stale:1e4,realpath:!0,fs:QD,...e},e.stale=Math.max(e.stale||0,2e3),e0(t,e,(n,i)=>{if(n)return r(n);e.fs.stat(ec(i,e),(s,o)=>s?s.code==="ENOENT"?r(null,!1):r(s):r(null,!l1(o,e)))})}function fX(){return Xn}uX(()=>{for(let t in Xn){let e=Xn[t].options;try{e.fs.rmdirSync(ec(t,e))}catch{}}});tc.exports.lock=cX;tc.exports.unlock=h1;tc.exports.check=lX;tc.exports.getLocks=fX});var m1=b(($ye,p1)=>{"use strict";var hX=gt();function dX(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 pX(t){return(...e)=>new Promise((r,n)=>{e.push((i,s)=>{i?n(i):r(s)}),t(...e)})}function mX(t){return(...e)=>{let r,n;if(e.push((i,s)=>{r=i,n=s}),t(...e),r)throw r;return n}}function gX(t){if(t={...t},t.fs=dX(t.fs||hX),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}p1.exports={toPromise:pX,toSync:mX,toSyncOptions:gX}});var y1=b((Lye,Ii)=>{"use strict";var oa=d1(),{toPromise:Ih,toSync:kh,toSyncOptions:t0}=m1();async function g1(t,e){let r=await Ih(oa.lock)(t,e);return Ih(r)}function yX(t,e){let r=kh(oa.lock)(t,t0(e));return kh(r)}function DX(t,e){return Ih(oa.unlock)(t,e)}function wX(t,e){return kh(oa.unlock)(t,t0(e))}function vX(t,e){return Ih(oa.check)(t,e)}function bX(t,e){return kh(oa.check)(t,t0(e))}Ii.exports=g1;Ii.exports.lock=g1;Ii.exports.unlock=DX;Ii.exports.lockSync=yX;Ii.exports.unlockSync=wX;Ii.exports.check=vX;Ii.exports.checkSync=bX});var E1=b(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});aa.canStoreURLs=aa.FileUrlStorage=void 0;var D1=require("fs"),EX=CX(Mx()),w1=_X(y1());function b1(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(b1=function(n){return n?r:e})(t)}function _X(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=b1(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 CX(t){return t&&t.__esModule?t:{default:t}}function rc(t){"@babel/helpers - typeof";return rc=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},rc(t)}function SX(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v1(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,OX(n.key),n)}}function AX(t,e,r){return e&&v1(t.prototype,e),r&&v1(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function OX(t){var e=xX(t,"string");return rc(e)=="symbol"?e:e+""}function xX(t,e){if(rc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(rc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var jye=aa.canStoreURLs=!0,Bye=aa.FileUrlStorage=(function(){function t(e){SX(this,t),this.path=e}return AX(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;w1.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;w1.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,EX.default)([i,s]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var i={encoding:"utf8",mode:432,flag:"w"};(0,D1.writeFile)(this.path,JSON.stringify(r),i,function(s){return n(s)})}},{key:"_getData",value:function(r){(0,D1.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 i0=b(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});Object.defineProperty(wr,"DefaultHttpStack",{enumerable:!0,get:function(){return A1.default}});Object.defineProperty(wr,"DetailedError",{enumerable:!0,get:function(){return TX.default}});Object.defineProperty(wr,"FileUrlStorage",{enumerable:!0,get:function(){return O1.FileUrlStorage}});Object.defineProperty(wr,"StreamSource",{enumerable:!0,get:function(){return RX.default}});wr.Upload=void 0;Object.defineProperty(wr,"canStoreURLs",{enumerable:!0,get:function(){return O1.canStoreURLs}});wr.defaultOptions=void 0;Object.defineProperty(wr,"enableDebugLog",{enumerable:!0,get:function(){return FX.enableDebugLog}});wr.isSupported=void 0;var TX=Bs(Zy()),FX=Qy(),IX=Bs(EA()),r0=Bs(ZA()),kX=Bs(fO()),PX=Bs(mO()),A1=Bs(TO()),RX=Bs(dD()),O1=E1();function Bs(t){return t&&t.__esModule?t:{default:t}}function ca(t){"@babel/helpers - typeof";return ca=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},ca(t)}function NX(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _1(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,T1(n.key),n)}}function $X(t,e,r){return e&&_1(t.prototype,e),r&&_1(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function LX(t,e,r){return e=Ph(e),jX(t,x1()?Reflect.construct(e,r||[],Ph(t).constructor):e.apply(t,r))}function jX(t,e){if(e&&(ca(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return BX(t)}function BX(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function x1(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(x1=function(){return!!t})()}function Ph(t){return Ph=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ph(t)}function MX(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&&n0(t,e)}function n0(t,e){return n0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},n0(t,e)}function C1(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 ua(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?C1(Object(r),!0).forEach(function(n){qX(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):C1(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function qX(t,e,r){return e=T1(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function T1(t){var e=UX(t,"string");return ca(e)=="symbol"?e:e+""}function UX(t,e){if(ca(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ca(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var S1=wr.defaultOptions=ua(ua({},r0.default.defaultOptions),{},{httpStack:new A1.default,fileReader:new kX.default,urlStorage:new IX.default,fingerprint:PX.default}),qye=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 NX(this,e),n=ua(ua({},S1),n),LX(this,e,[r,n])}return MX(e,t),$X(e,null,[{key:"terminate",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i=ua(ua({},S1),i),r0.default.terminate(n,i)}}])})(r0.default),Uye=wr.isSupported=!0});var P1=b((rDe,k1)=>{var la=1e3,fa=la*60,ha=fa*60,Ms=ha*24,GX=Ms*7,KX=Ms*365.25;k1.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return WX(t);if(r==="number"&&isFinite(t))return e.long?YX(t):XX(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function WX(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*KX;case"weeks":case"week":case"w":return r*GX;case"days":case"day":case"d":return r*Ms;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ha;case"minutes":case"minute":case"mins":case"min":case"m":return r*fa;case"seconds":case"second":case"secs":case"sec":case"s":return r*la;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function XX(t){var e=Math.abs(t);return e>=Ms?Math.round(t/Ms)+"d":e>=ha?Math.round(t/ha)+"h":e>=fa?Math.round(t/fa)+"m":e>=la?Math.round(t/la)+"s":t+"ms"}function YX(t){var e=Math.abs(t);return e>=Ms?Nh(t,e,Ms,"day"):e>=ha?Nh(t,e,ha,"hour"):e>=fa?Nh(t,e,fa,"minute"):e>=la?Nh(t,e,la,"second"):t+" ms"}function Nh(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var o0=b((nDe,R1)=>{function JX(t){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=i,r.enabled=a,r.humanize=P1(),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(...v){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,v[0]=r.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let y=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(C,k)=>{if(C==="%%")return"%";y++;let E=r.formatters[k];if(typeof E=="function"){let R=v[y];C=E.call(S,R),v.splice(y,1),y--}return C}),r.formatArgs.call(S,v),(S.log||r.log).apply(S,v)}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:v=>{d=v}}),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}R1.exports=JX});var N1=b((vr,$h)=>{vr.formatArgs=QX;vr.save=eY;vr.load=tY;vr.useColors=ZX;vr.storage=rY();vr.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`."))}})();vr.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 ZX(){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 QX(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+$h.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)}vr.log=console.debug||console.log||(()=>{});function eY(t){try{t?vr.storage.setItem("debug",t):vr.storage.removeItem("debug")}catch{}}function tY(){let t;try{t=vr.storage.getItem("debug")||vr.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function rY(){try{return localStorage}catch{}}$h.exports=o0()(vr);var{formatters:nY}=$h.exports;nY.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var L1=b((iDe,$1)=>{"use strict";$1.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 M1=b((sDe,B1)=>{"use strict";var iY=require("os"),j1=require("tty"),Hr=L1(),{env:Pt}=process,Pi;Hr("no-color")||Hr("no-colors")||Hr("color=false")||Hr("color=never")?Pi=0:(Hr("color")||Hr("colors")||Hr("color=true")||Hr("color=always"))&&(Pi=1);"FORCE_COLOR"in Pt&&(Pt.FORCE_COLOR==="true"?Pi=1:Pt.FORCE_COLOR==="false"?Pi=0:Pi=Pt.FORCE_COLOR.length===0?1:Math.min(parseInt(Pt.FORCE_COLOR,10),3));function a0(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function u0(t,e){if(Pi===0)return 0;if(Hr("color=16m")||Hr("color=full")||Hr("color=truecolor"))return 3;if(Hr("color=256"))return 2;if(t&&!e&&Pi===void 0)return 0;let r=Pi||0;if(Pt.TERM==="dumb")return r;if(process.platform==="win32"){let n=iY.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in Pt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in Pt)||Pt.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in Pt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Pt.TEAMCITY_VERSION)?1:0;if(Pt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Pt){let n=parseInt((Pt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Pt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Pt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Pt.TERM)||"COLORTERM"in Pt?1:r}function sY(t){let e=u0(t,t&&t.isTTY);return a0(e)}B1.exports={supportsColor:sY,stdout:a0(u0(!0,j1.isatty(1))),stderr:a0(u0(!0,j1.isatty(2)))}});var U1=b((Rt,jh)=>{var oY=require("tty"),Lh=require("util");Rt.init=dY;Rt.log=lY;Rt.formatArgs=uY;Rt.save=fY;Rt.load=hY;Rt.useColors=aY;Rt.destroy=Lh.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=M1();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 aY(){return"colors"in Rt.inspectOpts?!!Rt.inspectOpts.colors:oY.isatty(process.stderr.fd)}function uY(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+"+jh.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=cY()+e+" "+t[0]}function cY(){return Rt.inspectOpts.hideDate?"":new Date().toISOString()+" "}function lY(...t){return process.stderr.write(Lh.formatWithOptions(Rt.inspectOpts,...t)+`
|
|
60
60
|
`)}function fY(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function hY(){return process.env.DEBUG}function dY(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]]}jh.exports=o0()(Rt);var{formatters:q1}=jh.exports;q1.o=function(t){return this.inspectOpts.colors=this.useColors,Lh.inspect(t,this.inspectOpts).split(`
|
|
@@ -181,17 +181,17 @@ Filtered results for: ${this.inputValue?this.inputValue:oi.gray("Enter something
|
|
|
181
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(xa.radioOn):xa.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(ure.hide),super.render();let e=[GP.symbol(this.done,this.aborted),oi.bold(this.msg),GP.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=zP(e,this.out.columns)}};KP.exports=Zw});var QP=b((bwe,ZP)=>{var XP=ht(),lre=ii(),{style:YP,clear:fre}=cn(),{erase:hre,cursor:JP}=Ye(),Qw=class extends lre{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
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(JP.hide):this.out.write(fre(this.outputText,this.out.columns)),super.render(),this.outputText=[YP.symbol(this.done,this.aborted),XP.bold(this.msg),YP.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:XP.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(hre.line+JP.to(0)+this.outputText))}};ZP.exports=Qw});var tR=b((Ewe,eR)=>{"use strict";eR.exports={TextPrompt:Zk(),SelectPrompt:rP(),TogglePrompt:oP(),DatePrompt:kP(),NumberPrompt:$P(),MultiselectPrompt:Ww(),AutocompletePrompt:VP(),AutocompleteMultiselectPrompt:WP(),ConfirmPrompt:QP()}});var nR=b(rR=>{"use strict";var Er=rR,dre=tR(),Cd=t=>t;function Fn(t,e,r={}){return new Promise((n,i)=>{let s=new dre[t](e),o=r.onAbort||Cd,a=r.onSubmit||Cd,u=r.onExit||Cd;s.on("state",e.onState||Cd),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 pre=(t,e)=>Promise.resolve(e.filter(r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));Er.autocomplete=t=>(t.suggest=t.suggest||pre,t.choices=[].concat(t.choices||[]),Fn("AutocompletePrompt",t))});var oR=b((Cwe,sR)=>{"use strict";var ev=nR(),mre=["suggest","format","onState","validate","onRender","type"],iR=()=>{};async function Ui(t=[],{onSubmit:e=iR,onCancel:r=iR}={}){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(mre.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,ev[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?gre(Ui._injected,o.initial):await ev[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 gre(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function yre(t){Ui._injected=(Ui._injected||[]).concat(t)}function Dre(t){Ui._override=Object.assign({},t)}sR.exports=Object.assign(Ui,{prompt:Ui,prompts:ev,inject:yre,override:Dre})});var Sd=b((Swe,aR)=>{function wre(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}aR.exports=wre("8.6.0")?kk():oR()});var mc=b(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.logSuccess=_r.logPrompt=_r.logger=_r.output=void 0;var tv=(fe(),ue(le)),Gs=z0(),Ks=tv.__importDefault(Da()),vre=P2(),uR={colors:Ks.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};_r.output=(0,vre.isInteractive)()?new Gs.TTYOutputStrategy(uR):new Gs.StreamOutputStrategy(uR);_r.logger=(0,Gs.createDefaultLogger)({output:_r.output,formatterOptions:{titleize:!1,tags:new Map([[Gs.LOGGER_LEVELS.DEBUG,Ks.default.log.DEBUG("[debug]")],[Gs.LOGGER_LEVELS.INFO,Ks.default.log.INFO("[info]")],[Gs.LOGGER_LEVELS.WARN,Ks.default.log.WARN("[warn]")],[Gs.LOGGER_LEVELS.ERROR,Ks.default.log.ERROR("[error]")]])}});async function bre(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>tv.__importStar(z0())),{prompt:n}=await Promise.resolve().then(()=>tv.__importStar(Sd()));return _r.logger.log({msg:`${Ks.default.input("[?]")} ${r(t,{indentation:4})}`,logger:_r.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}_r.logPrompt=bre;function Ere(t){_r.logger.msg(`${Ks.default.success("[success]")} ${t}`)}_r.logSuccess=Ere});var Ad=b(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});Ta.resolveNode=Ta.requireTS=void 0;var _re=require("fs"),Cre=ya(),Sre=require("path"),Are=(t,e)=>{let r=(0,Sre.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(i,s)=>{var o;let a=(0,Cre.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};Ta.requireTS=Are;function Ore(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,_re.existsSync)(n)?n:null}}Ta.resolveNode=Ore});var Od=b(rv=>{(function(){rv.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(rv)});var In=b((cR,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(cR)});var nv=b((lR,fR)=>{(function(){var t;fR.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(lR)});var pR=b((hR,dR)=>{(function(){var t;dR.exports=t=(function(){function e(){}return e.prototype.handleError=function(r){throw new Error(r)},e})()}).call(hR)});var yR=b((mR,gR)=>{(function(){var t;gR.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(mR)});var vR=b((DR,wR)=>{(function(){var t,e,r;e=pR(),r=yR(),wR.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(DR)});var Et=b((bR,ER)=>{(function(){ER.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(bR)});var iv=b((_R,CR)=>{(function(){var t,e,r;t=Et(),r=Fr(),CR.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(_R)});var xd=b((SR,AR)=>{(function(){var t;AR.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(SR)});var Td=b((OR,xR)=>{(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=iv(),n=xd(),xR.exports=r=(function(h){c(d,h);function d(f,m,g){var v,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(v=p[S],v.type===t.DocType){v.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,v;g=Object.create(this),g.isRoot&&(g.documentObject=null),g.attribs={},v=this.attribs;for(m in v)l.call(v,m)&&(f=v[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,v;if(f!=null&&(f=s(f)),a(f))for(g in f)l.call(f,g)&&(v=f[g],this.attribute(g,v));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,v;if(f==null)throw new Error("Missing attribute name. "+this.debugInfo());if(f=s(f),Array.isArray(f))for(g=0,v=f.length;g<v;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,v;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,v=this.attribs.length-1;0<=v?g<=v:g>=v;m=0<=v?++g:--g)if(!this.attribs[m].isEqualNode(f.attribs[m]))return!1;return!0},d})(i)}).call(OR)});var Oc=b((TR,FR)=>{(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(),FR.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(TR)});var Fd=b((IR,kR)=>{(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=Oc(),kR.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(IR)});var Id=b((PR,RR)=>{(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=Oc(),RR.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(PR)});var kd=b((NR,$R)=>{(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(),$R.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(NR)});var Pd=b((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;r=Fr(),t=Et(),jR.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(LR)});var Rd=b((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){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(BR)});var Nd=b((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){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(qR)});var $d=b((HR,VR)=>{(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(),VR.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(HR)});var Ld=b((zR,GR)=>{(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=Pd(),n=Rd(),r=Nd(),i=$d(),o=xd(),GR.exports=s=(function(h){c(d,h);function d(f,m,g){var v,S,A,p,y,D;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(v=p[S],v.type===t.Element){this.name=v.name;break}}this.documentObject=f,u(m)&&(y=m,m=y.pubID,g=y.sysID),g==null&&(D=[m,g],g=D[0],m=D[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,v,S;for(v={},S=this.children,m=0,g=S.length;m<g;m++)f=S[m],f.type===t.EntityDeclaration&&!f.pe&&(v[f.name]=f);return new o(v)}}),Object.defineProperty(d.prototype,"notations",{get:function(){var f,m,g,v,S;for(v={},S=this.children,m=0,g=S.length;m<g;m++)f=S[m],f.type===t.NotationDeclaration&&(v[f.name]=f);return new o(v)}}),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,v,S){var A;return A=new e(this,f,m,g,v,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,v,S){return this.attList(f,m,g,v,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(zR)});var jd=b((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;t=Et(),e=Fr(),WR.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(KR)});var Bd=b((XR,YR)=>{(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=Oc(),YR.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(XR)});var Md=b((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=Oc(),ZR.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(JR)});var sv=b((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;r=Fr(),t=Et(),eN.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(QR)});var nN=b((tN,rN)=>{(function(){var t;rN.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(tN)});var oN=b((iN,sN)=>{(function(){sN.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(iN)});var Fr=b((aN,uN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,g,v,S,A,p={}.hasOwnProperty;A=In(),S=A.isObject,v=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,uN.exports=c=(function(){function y(D){this.parent=D,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,a||(a=Td(),r=Fd(),n=Id(),i=kd(),s=Ld(),d=jd(),f=Bd(),h=Md(),o=sv(),e=Et(),l=nN(),u=xd(),t=oN())}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 D;return D=this.parent.children.indexOf(this),this.parent.children[D-1]||null}}),Object.defineProperty(y.prototype,"nextSibling",{get:function(){var D;return D=this.parent.children.indexOf(this),this.parent.children[D+1]||null}}),Object.defineProperty(y.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(y.prototype,"textContent",{get:function(){var D,C,k,E,R;if(this.nodeType===e.Element||this.nodeType===e.DocumentFragment){for(R="",E=this.children,C=0,k=E.length;C<k;C++)D=E[C],D.textContent&&(R+=D.textContent);return R}else return null},set:function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),y.prototype.setParent=function(D){var C,k,E,R,P;for(this.parent=D,D&&(this.options=D.options,this.stringify=D.stringify),R=this.children,P=[],k=0,E=R.length;k<E;k++)C=R[k],P.push(C.setParent(this));return P},y.prototype.element=function(D,C,k){var E,R,P,F,B,U,G,L,_,T,I;if(U=null,C===null&&k==null&&(_=[{},null],C=_[0],k=_[1]),C==null&&(C={}),C=m(C),S(C)||(T=[C,k],k=T[0],C=T[1]),D!=null&&(D=m(D)),Array.isArray(D))for(P=0,G=D.length;P<G;P++)R=D[P],U=this.element(R);else if(v(D))U=this.element(D.apply());else if(S(D)){for(B in D)if(p.call(D,B))if(I=D[B],v(I)&&(I=I.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&B.indexOf(this.stringify.convertAttKey)===0)U=this.attribute(B.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(B);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[B]=R,U=this.element(E);else S(I)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&B.indexOf(this.stringify.convertTextKey)===0?U=this.element(I):(U=this.element(B),U.element(I)):U=this.element(B,I)}else!this.options.keepNullNodes&&k===null?U=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&D.indexOf(this.stringify.convertTextKey)===0?U=this.text(k):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&D.indexOf(this.stringify.convertCDataKey)===0?U=this.cdata(k):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&D.indexOf(this.stringify.convertCommentKey)===0?U=this.comment(k):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&D.indexOf(this.stringify.convertRawKey)===0?U=this.raw(k):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&D.indexOf(this.stringify.convertPIKey)===0?U=this.instruction(D.substr(this.stringify.convertPIKey.length),k):U=this.node(D,C,k);if(U==null)throw new Error("Could not create any elements with: "+D+". "+this.debugInfo());return U},y.prototype.insertBefore=function(D,C,k){var E,R,P,F,B;if(D?.type)return P=D,F=C,P.setParent(this),F?(R=children.indexOf(F),B=children.splice(R),children.push(P),Array.prototype.push.apply(children,B)):children.push(P),P;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(D));return R=this.parent.children.indexOf(this),B=this.parent.children.splice(R),E=this.parent.element(D,C,k),Array.prototype.push.apply(this.parent.children,B),E},y.prototype.insertAfter=function(D,C,k){var E,R,P;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(D));return R=this.parent.children.indexOf(this),P=this.parent.children.splice(R+1),E=this.parent.element(D,C,k),Array.prototype.push.apply(this.parent.children,P),E},y.prototype.remove=function(){var D,C;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return D=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[D,D-D+1].concat(C=[])),this.parent},y.prototype.node=function(D,C,k){var E,R;return D!=null&&(D=m(D)),C||(C={}),C=m(C),S(C)||(R=[C,k],k=R[0],C=R[1]),E=new a(this,D,C),k!=null&&E.text(k),this.children.push(E),E},y.prototype.text=function(D){var C;return S(D)&&this.element(D),C=new f(this,D),this.children.push(C),this},y.prototype.cdata=function(D){var C;return C=new r(this,D),this.children.push(C),this},y.prototype.comment=function(D){var C;return C=new n(this,D),this.children.push(C),this},y.prototype.commentBefore=function(D){var C,k,E;return k=this.parent.children.indexOf(this),E=this.parent.children.splice(k),C=this.parent.comment(D),Array.prototype.push.apply(this.parent.children,E),this},y.prototype.commentAfter=function(D){var C,k,E;return k=this.parent.children.indexOf(this),E=this.parent.children.splice(k+1),C=this.parent.comment(D),Array.prototype.push.apply(this.parent.children,E),this},y.prototype.raw=function(D){var C;return C=new d(this,D),this.children.push(C),this},y.prototype.dummy=function(){var D;return D=new o(this),D},y.prototype.instruction=function(D,C){var k,E,R,P,F;if(D!=null&&(D=m(D)),C!=null&&(C=m(C)),Array.isArray(D))for(P=0,F=D.length;P<F;P++)k=D[P],this.instruction(k);else if(S(D))for(k in D)p.call(D,k)&&(E=D[k],this.instruction(k,E));else v(C)&&(C=C.apply()),R=new h(this,D,C),this.children.push(R);return this},y.prototype.instructionBefore=function(D,C){var k,E,R;return E=this.parent.children.indexOf(this),R=this.parent.children.splice(E),k=this.parent.instruction(D,C),Array.prototype.push.apply(this.parent.children,R),this},y.prototype.instructionAfter=function(D,C){var k,E,R;return E=this.parent.children.indexOf(this),R=this.parent.children.splice(E+1),k=this.parent.instruction(D,C),Array.prototype.push.apply(this.parent.children,R),this},y.prototype.declaration=function(D,C,k){var E,R;return E=this.document(),R=new i(E,D,C,k),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(D,C){var k,E,R,P,F,B,U,G,L,_;for(E=this.document(),R=new s(E,D,C),L=E.children,P=F=0,U=L.length;F<U;P=++F)if(k=L[P],k.type===e.DocType)return E.children[P]=R,R;for(_=E.children,P=B=0,G=_.length;B<G;P=++B)if(k=_[P],k.isRoot)return E.children.splice(P,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 D;for(D=this;D;){if(D.type===e.Document)return D.rootObject;if(D.isRoot)return D;D=D.parent}},y.prototype.document=function(){var D;for(D=this;D;){if(D.type===e.Document)return D;D=D.parent}},y.prototype.end=function(D){return this.document().end(D)},y.prototype.prev=function(){var D;if(D=this.parent.children.indexOf(this),D<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[D-1]},y.prototype.next=function(){var D;if(D=this.parent.children.indexOf(this),D===-1||D===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[D+1]},y.prototype.importDocument=function(D){var C;return C=D.root().clone(),C.parent=this,C.isRoot=!1,this.children.push(C),this},y.prototype.debugInfo=function(D){var C,k;return D=D||this.name,D==null&&!((C=this.parent)!=null&&C.name)?"":D==null?"parent: <"+this.parent.name+">":(k=this.parent)!=null&&k.name?"node: <"+D+">, parent: <"+this.parent.name+">":"node: <"+D+">"},y.prototype.ele=function(D,C,k){return this.element(D,C,k)},y.prototype.nod=function(D,C,k){return this.node(D,C,k)},y.prototype.txt=function(D){return this.text(D)},y.prototype.dat=function(D){return this.cdata(D)},y.prototype.com=function(D){return this.comment(D)},y.prototype.ins=function(D,C){return this.instruction(D,C)},y.prototype.doc=function(){return this.document()},y.prototype.dec=function(D,C,k){return this.declaration(D,C,k)},y.prototype.e=function(D,C,k){return this.element(D,C,k)},y.prototype.n=function(D,C,k){return this.node(D,C,k)},y.prototype.t=function(D){return this.text(D)},y.prototype.d=function(D){return this.cdata(D)},y.prototype.c=function(D){return this.comment(D)},y.prototype.r=function(D){return this.raw(D)},y.prototype.i=function(D,C){return this.instruction(D,C)},y.prototype.u=function(){return this.up()},y.prototype.importXMLBuilder=function(D){return this.importDocument(D)},y.prototype.replaceChild=function(D,C){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.removeChild=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.appendChild=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.hasChildNodes=function(){return this.children.length!==0},y.prototype.cloneNode=function(D){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(D,C){return!0},y.prototype.hasAttributes=function(){return this.attribs.length!==0},y.prototype.compareDocumentPosition=function(D){var C,k;return C=this,C===D?0:this.document()!==D.document()?(k=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?k|=t.Preceding:k|=t.Following,k):C.isAncestor(D)?t.Contains|t.Preceding:C.isDescendant(D)?t.Contains|t.Following:C.isPreceding(D)?t.Preceding:t.Following},y.prototype.isSameNode=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.lookupPrefix=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.isDefaultNamespace=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.lookupNamespaceURI=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.isEqualNode=function(D){var C,k,E;if(D.nodeType!==this.nodeType||D.children.length!==this.children.length)return!1;for(C=k=0,E=this.children.length-1;0<=E?k<=E:k>=E;C=0<=E?++k:--k)if(!this.children[C].isEqualNode(D.children[C]))return!1;return!0},y.prototype.getFeature=function(D,C){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.setUserData=function(D,C,k){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.getUserData=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.contains=function(D){return D?D===this||this.isDescendant(D):!1},y.prototype.isDescendant=function(D){var C,k,E,R,P;for(P=this.children,E=0,R=P.length;E<R;E++)if(C=P[E],D===C||(k=C.isDescendant(D),k))return!0;return!1},y.prototype.isAncestor=function(D){return D.isDescendant(this)},y.prototype.isPreceding=function(D){var C,k;return C=this.treePosition(D),k=this.treePosition(this),C===-1||k===-1?!1:C<k},y.prototype.isFollowing=function(D){var C,k;return C=this.treePosition(D),k=this.treePosition(this),C===-1||k===-1?!1:C>k},y.prototype.treePosition=function(D){var C,k;return k=0,C=!1,this.foreachTreeNode(this.document(),function(E){if(k++,!C&&E===D)return C=!0}),C?k:-1},y.prototype.foreachTreeNode=function(D,C){var k,E,R,P,F;for(D||(D=this.document()),P=D.children,E=0,R=P.length;E<R;E++){if(k=P[E],F=C(k))return F;if(F=this.foreachTreeNode(k,C),F)return F}},y})()}).call(aN)});var ov=b((cN,lN)=>{(function(){var t,e=function(n,i){return function(){return n.apply(i,arguments)}},r={}.hasOwnProperty;lN.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(cN)});var xc=b((fN,hN)=>{(function(){hN.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(fN)});var av=b((dN,pN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,g,v,S={}.hasOwnProperty;v=In().assign,t=Et(),u=kd(),c=Ld(),r=Fd(),n=Id(),h=Td(),f=jd(),m=Bd(),d=Md(),l=sv(),i=Pd(),s=Nd(),o=Rd(),a=$d(),e=xc(),pN.exports=g=(function(){function A(p){var y,D,C;p||(p={}),this.options=p,D=p.writer||{};for(y in D)S.call(D,y)&&(C=D[y],this["_"+y]=this[y],this[y]=C)}return A.prototype.filterOptions=function(p){var y,D,C,k,E,R,P,F;return p||(p={}),p=v({},this.options,p),y={writer:this},y.pretty=p.pretty||!1,y.allowEmpty=p.allowEmpty||!1,y.indent=(D=p.indent)!=null?D:" ",y.newline=(C=p.newline)!=null?C:`
|
|
185
|
-
`,y.offset=(k=p.offset)!=null?k:0,y.dontPrettyTextNodes=(E=(R=p.dontPrettyTextNodes)!=null?R:p.dontprettytextnodes)!=null?E:0,y.spaceBeforeSlash=(P=(F=p.spaceBeforeSlash)!=null?F:p.spacebeforeslash)!=null?P:"",y.spaceBeforeSlash===!0&&(y.spaceBeforeSlash=" "),y.suppressPrettyCount=0,y.user={},y.state=e.None,y},A.prototype.indent=function(p,y,D){var C;return!y.pretty||y.suppressPrettyCount?"":y.pretty&&(C=(D||0)+y.offset+1,C>0)?new Array(C).join(y.indent):""},A.prototype.endline=function(p,y,D){return!y.pretty||y.suppressPrettyCount?"":y.newline},A.prototype.attribute=function(p,y,D){var C;return this.openAttribute(p,y,D),C=" "+p.name+'="'+p.value+'"',this.closeAttribute(p,y,D),C},A.prototype.cdata=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D)+"<![CDATA[",y.state=e.InsideTag,C+=p.value,y.state=e.CloseTag,C+="]]>"+this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.comment=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D)+"<!-- ",y.state=e.InsideTag,C+=p.value,y.state=e.CloseTag,C+=" -->"+this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.declaration=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D)+"<?xml",y.state=e.InsideTag,C+=' version="'+p.version+'"',p.encoding!=null&&(C+=' encoding="'+p.encoding+'"'),p.standalone!=null&&(C+=' standalone="'+p.standalone+'"'),y.state=e.CloseTag,C+=y.spaceBeforeSlash+"?>",C+=this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.docType=function(p,y,D){var C,k,E,R,P;if(D||(D=0),this.openNode(p,y,D),y.state=e.OpenTag,R=this.indent(p,y,D),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,D),y.state=e.InsideTag,P=p.children,k=0,E=P.length;k<E;k++)C=P[k],R+=this.writeChildNode(C,y,D+1);y.state=e.CloseTag,R+="]"}return y.state=e.CloseTag,R+=y.spaceBeforeSlash+">",R+=this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),R},A.prototype.element=function(p,y,D){var C,k,E,R,P,F,B,U,G,L,_,T,I,$;D||(D=0),L=!1,_="",this.openNode(p,y,D),y.state=e.OpenTag,_+=this.indent(p,y,D)+"<"+p.name,T=p.attribs;for(G in T)S.call(T,G)&&(C=T[G],_+=this.attribute(C,y,D));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?(_+=">",y.state=e.CloseTag,_+="</"+p.name+">"+this.endline(p,y,D)):(y.state=e.CloseTag,_+=y.spaceBeforeSlash+"/>"+this.endline(p,y,D));else if(y.pretty&&E===1&&(R.type===t.Text||R.type===t.Raw)&&R.value!=null)_+=">",y.state=e.InsideTag,y.suppressPrettyCount++,L=!0,_+=this.writeChildNode(R,y,D+1),y.suppressPrettyCount--,L=!1,y.state=e.CloseTag,_+="</"+p.name+">"+this.endline(p,y,D);else{if(y.dontPrettyTextNodes){for(I=p.children,P=0,B=I.length;P<B;P++)if(k=I[P],(k.type===t.Text||k.type===t.Raw)&&k.value!=null){y.suppressPrettyCount++,L=!0;break}}for(_+=">"+this.endline(p,y,D),y.state=e.InsideTag,$=p.children,F=0,U=$.length;F<U;F++)k=$[F],_+=this.writeChildNode(k,y,D+1);y.state=e.CloseTag,_+=this.indent(p,y,D)+"</"+p.name+">",L&&y.suppressPrettyCount--,_+=this.endline(p,y,D),y.state=e.None}return this.closeNode(p,y,D),_},A.prototype.writeChildNode=function(p,y,D){switch(p.type){case t.CData:return this.cdata(p,y,D);case t.Comment:return this.comment(p,y,D);case t.Element:return this.element(p,y,D);case t.Raw:return this.raw(p,y,D);case t.Text:return this.text(p,y,D);case t.ProcessingInstruction:return this.processingInstruction(p,y,D);case t.Dummy:return"";case t.Declaration:return this.declaration(p,y,D);case t.DocType:return this.docType(p,y,D);case t.AttributeDeclaration:return this.dtdAttList(p,y,D);case t.ElementDeclaration:return this.dtdElement(p,y,D);case t.EntityDeclaration:return this.dtdEntity(p,y,D);case t.NotationDeclaration:return this.dtdNotation(p,y,D);default:throw new Error("Unknown XML node type: "+p.constructor.name)}},A.prototype.processingInstruction=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D)+"<?",y.state=e.InsideTag,C+=p.target,p.value&&(C+=" "+p.value),y.state=e.CloseTag,C+=y.spaceBeforeSlash+"?>",C+=this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.raw=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D),y.state=e.InsideTag,C+=p.value,y.state=e.CloseTag,C+=this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.text=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D),y.state=e.InsideTag,C+=p.value,y.state=e.CloseTag,C+=this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.dtdAttList=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D)+"<!ATTLIST",y.state=e.InsideTag,C+=" "+p.elementName+" "+p.attributeName+" "+p.attributeType,p.defaultValueType!=="#DEFAULT"&&(C+=" "+p.defaultValueType),p.defaultValue&&(C+=' "'+p.defaultValue+'"'),y.state=e.CloseTag,C+=y.spaceBeforeSlash+">"+this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.dtdElement=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D)+"<!ELEMENT",y.state=e.InsideTag,C+=" "+p.name+" "+p.value,y.state=e.CloseTag,C+=y.spaceBeforeSlash+">"+this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.dtdEntity=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D)+"<!ENTITY",y.state=e.InsideTag,p.pe&&(C+=" %"),C+=" "+p.name,p.value?C+=' "'+p.value+'"':(p.pubID&&p.sysID?C+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.sysID&&(C+=' SYSTEM "'+p.sysID+'"'),p.nData&&(C+=" NDATA "+p.nData)),y.state=e.CloseTag,C+=y.spaceBeforeSlash+">"+this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.dtdNotation=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D)+"<!NOTATION",y.state=e.InsideTag,C+=" "+p.name,p.pubID&&p.sysID?C+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.pubID?C+=' PUBLIC "'+p.pubID+'"':p.sysID&&(C+=' SYSTEM "'+p.sysID+'"'),y.state=e.CloseTag,C+=y.spaceBeforeSlash+">"+this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.openNode=function(p,y,D){},A.prototype.closeNode=function(p,y,D){},A.prototype.openAttribute=function(p,y,D){},A.prototype.closeAttribute=function(p,y,D){},A})()}).call(dN)});var qd=b((mN,gN)=>{(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=av(),gN.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(mN)});var uv=b((yN,DN)=>{(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=nv(),e=vR(),i=Fr(),t=Et(),o=ov(),s=qd(),DN.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(yN)});var bN=b((wN,vN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,g,v,S,A,p,y,D,C,k,E={}.hasOwnProperty;k=In(),D=k.isObject,y=k.isFunction,C=k.isPlainObject,p=k.getValue,t=Et(),h=uv(),f=Td(),n=Fd(),i=Id(),g=jd(),A=Bd(),m=Md(),c=kd(),l=Ld(),s=Pd(),a=Rd(),o=Nd(),u=$d(),r=iv(),S=ov(),v=qd(),e=xc(),vN.exports=d=(function(){function R(P,F,B){var U;this.name="?xml",this.type=t.Document,P||(P={}),U={},P.writer?C(P.writer)&&(U=P.writer,P.writer=new v):P.writer=new v,this.options=P,this.writer=P.writer,this.writerOptions=this.writer.filterOptions(U),this.stringify=new S(P),this.onDataCallback=F||function(){},this.onEndCallback=B||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return R.prototype.createChildNode=function(P){var F,B,U,G,L,_,T,I;switch(P.type){case t.CData:this.cdata(P.value);break;case t.Comment:this.comment(P.value);break;case t.Element:U={},T=P.attribs;for(B in T)E.call(T,B)&&(F=T[B],U[B]=F.value);this.node(P.name,U);break;case t.Dummy:this.dummy();break;case t.Raw:this.raw(P.value);break;case t.Text:this.text(P.value);break;case t.ProcessingInstruction:this.instruction(P.target,P.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+P.constructor.name)}for(I=P.children,L=0,_=I.length;L<_;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(P,F,B){var U;if(P==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(P));return this.openCurrent(),P=p(P),F==null&&(F={}),F=p(F),D(F)||(U=[F,B],B=U[0],F=U[1]),this.currentNode=new f(this,P,F),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,B!=null&&this.text(B),this},R.prototype.element=function(P,F,B){var U,G,L,_,T,I;if(this.currentNode&&this.currentNode.type===t.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(P)||D(P)||y(P))for(_=this.options.noValidation,this.options.noValidation=!0,I=new h(this.options).element("TEMP_ROOT"),I.element(P),this.options.noValidation=_,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(P,F,B);return this},R.prototype.attribute=function(P,F){var B,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(P));if(P!=null&&(P=p(P)),D(P))for(B in P)E.call(P,B)&&(U=P[B],this.attribute(B,U));else y(F)&&(F=F.apply()),this.options.keepNullAttributes&&F==null?this.currentNode.attribs[P]=new r(this,P,""):F!=null&&(this.currentNode.attribs[P]=new r(this,P,F));return this},R.prototype.text=function(P){var F;return this.openCurrent(),F=new A(this,P),this.onData(this.writer.text(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.cdata=function(P){var F;return this.openCurrent(),F=new n(this,P),this.onData(this.writer.cdata(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.comment=function(P){var F;return this.openCurrent(),F=new i(this,P),this.onData(this.writer.comment(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.raw=function(P){var F;return this.openCurrent(),F=new g(this,P),this.onData(this.writer.raw(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.instruction=function(P,F){var B,U,G,L,_;if(this.openCurrent(),P!=null&&(P=p(P)),F!=null&&(F=p(F)),Array.isArray(P))for(B=0,L=P.length;B<L;B++)U=P[B],this.instruction(U);else if(D(P))for(U in P)E.call(P,U)&&(G=P[U],this.instruction(U,G));else y(F)&&(F=F.apply()),_=new m(this,P,F),this.onData(this.writer.processingInstruction(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},R.prototype.declaration=function(P,F,B){var U;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return U=new c(this,P,F,B),this.onData(this.writer.declaration(U,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.doctype=function(P,F,B){if(this.openCurrent(),P==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,B),this.currentNode.rootNodeName=P,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},R.prototype.dtdElement=function(P,F){var B;return this.openCurrent(),B=new o(this,P,F),this.onData(this.writer.dtdElement(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.attList=function(P,F,B,U,G){var L;return this.openCurrent(),L=new s(this,P,F,B,U,G),this.onData(this.writer.dtdAttList(L,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.entity=function(P,F){var B;return this.openCurrent(),B=new a(this,!1,P,F),this.onData(this.writer.dtdEntity(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.pEntity=function(P,F){var B;return this.openCurrent(),B=new a(this,!0,P,F),this.onData(this.writer.dtdEntity(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.notation=function(P,F){var B;return this.openCurrent(),B=new u(this,P,F),this.onData(this.writer.dtdNotation(B,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(P){var F,B,U,G;if(!P.isOpen){if(!this.root&&this.currentLevel===0&&P.type===t.Element&&(this.root=P),B="",P.type===t.Element){this.writerOptions.state=e.OpenTag,B=this.writer.indent(P,this.writerOptions,this.currentLevel)+"<"+P.name,G=P.attribs;for(U in G)E.call(G,U)&&(F=G[U],B+=this.writer.attribute(F,this.writerOptions,this.currentLevel));B+=(P.children?">":"/>")+this.writer.endline(P,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,B=this.writer.indent(P,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+P.rootNodeName,P.pubID&&P.sysID?B+=' PUBLIC "'+P.pubID+'" "'+P.sysID+'"':P.sysID&&(B+=' SYSTEM "'+P.sysID+'"'),P.children?(B+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,B+=">"),B+=this.writer.endline(P,this.writerOptions,this.currentLevel);return this.onData(B,this.currentLevel),P.isOpen=!0}},R.prototype.closeNode=function(P){var F;if(!P.isClosed)return F="",this.writerOptions.state=e.CloseTag,P.type===t.Element?F=this.writer.indent(P,this.writerOptions,this.currentLevel)+"</"+P.name+">"+this.writer.endline(P,this.writerOptions,this.currentLevel):F=this.writer.indent(P,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(P,this.writerOptions,this.currentLevel),this.writerOptions.state=e.None,this.onData(F,this.currentLevel),P.isClosed=!0},R.prototype.onData=function(P,F){return this.documentStarted=!0,this.onDataCallback(P,F+1)},R.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},R.prototype.debugInfo=function(P){return P==null?"":"node: <"+P+">"},R.prototype.ele=function(){return this.element.apply(this,arguments)},R.prototype.nod=function(P,F,B){return this.node(P,F,B)},R.prototype.txt=function(P){return this.text(P)},R.prototype.dat=function(P){return this.cdata(P)},R.prototype.com=function(P){return this.comment(P)},R.prototype.ins=function(P,F){return this.instruction(P,F)},R.prototype.dec=function(P,F,B){return this.declaration(P,F,B)},R.prototype.dtd=function(P,F,B){return this.doctype(P,F,B)},R.prototype.e=function(P,F,B){return this.element(P,F,B)},R.prototype.n=function(P,F,B){return this.node(P,F,B)},R.prototype.t=function(P){return this.text(P)},R.prototype.d=function(P){return this.cdata(P)},R.prototype.c=function(P){return this.comment(P)},R.prototype.r=function(P){return this.raw(P)},R.prototype.i=function(P,F){return this.instruction(P,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(P,F){return this.entity(P,F)},R.prototype.pent=function(P,F){return this.pEntity(P,F)},R.prototype.not=function(P,F){return this.notation(P,F)},R})()}).call(wN)});var CN=b((EN,_N)=>{(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=av(),e=xc(),_N.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,v,S,A;for(v=u.children,h=d=0,m=v.length;d<m;h=++d)l=v[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,v,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(D){return(D.type===t.Text||D.type===t.Raw)&&D.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,v=y.length;g<v;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(EN)});var AN=b((SN,Vi)=>{(function(){var t,e,r,n,i,s,o,a,u,c;c=In(),a=c.assign,u=c.isFunction,r=nv(),n=uv(),i=bN(),o=qd(),s=CN(),t=Et(),e=xc(),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(SN)});var ON=b(cv=>{(function(){"use strict";var t,e,r,n,i,s={}.hasOwnProperty;t=AN(),e=Od().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[>")},cv.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 v,S,A,p,y,D;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(v in S)D=S[v],m=m.att(v,D)}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(cv)});var xN=b(Ud=>{(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),P(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,re=e.length;N<re;N++){var z=x[e[N]].length;if(z>O)switch(e[N]){case"textNode":B(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){B(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(re){if(!re)return H.removeAllListeners(N),H._parser["on"+N]=re,re;H.on(N,re)},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]/,v=/[:_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 y(x){return x==='"'||x==="'"}function D(x){return x===">"||p(x)}function C(x,O){return x.test(O)}function k(x,O){return!C(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 P(x,O,H){x[O]&&x[O](H)}function F(x,O,H){x.textNode&&
|
|
184
|
+
`},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(rv)});var In=b((cR,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(cR)});var nv=b((lR,fR)=>{(function(){var t;fR.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(lR)});var pR=b((hR,dR)=>{(function(){var t;dR.exports=t=(function(){function e(){}return e.prototype.handleError=function(r){throw new Error(r)},e})()}).call(hR)});var yR=b((mR,gR)=>{(function(){var t;gR.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(mR)});var vR=b((DR,wR)=>{(function(){var t,e,r;e=pR(),r=yR(),wR.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(DR)});var Et=b((bR,ER)=>{(function(){ER.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(bR)});var iv=b((_R,CR)=>{(function(){var t,e,r;t=Et(),r=Fr(),CR.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(_R)});var xd=b((SR,AR)=>{(function(){var t;AR.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(SR)});var Td=b((OR,xR)=>{(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=iv(),n=xd(),xR.exports=r=(function(h){c(d,h);function d(f,m,g){var v,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(v=p[S],v.type===t.DocType){v.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,v;g=Object.create(this),g.isRoot&&(g.documentObject=null),g.attribs={},v=this.attribs;for(m in v)l.call(v,m)&&(f=v[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,v;if(f!=null&&(f=s(f)),a(f))for(g in f)l.call(f,g)&&(v=f[g],this.attribute(g,v));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,v;if(f==null)throw new Error("Missing attribute name. "+this.debugInfo());if(f=s(f),Array.isArray(f))for(g=0,v=f.length;g<v;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,v;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,v=this.attribs.length-1;0<=v?g<=v:g>=v;m=0<=v?++g:--g)if(!this.attribs[m].isEqualNode(f.attribs[m]))return!1;return!0},d})(i)}).call(OR)});var Oc=b((TR,FR)=>{(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(),FR.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(TR)});var Fd=b((IR,kR)=>{(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=Oc(),kR.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(IR)});var Id=b((PR,RR)=>{(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=Oc(),RR.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(PR)});var kd=b((NR,$R)=>{(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(),$R.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(NR)});var Pd=b((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;r=Fr(),t=Et(),jR.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(LR)});var Rd=b((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){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(BR)});var Nd=b((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){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(qR)});var $d=b((HR,VR)=>{(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(),VR.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(HR)});var Ld=b((zR,GR)=>{(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=Pd(),n=Rd(),r=Nd(),i=$d(),o=xd(),GR.exports=s=(function(h){c(d,h);function d(f,m,g){var v,S,A,p,y,D;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(v=p[S],v.type===t.Element){this.name=v.name;break}}this.documentObject=f,u(m)&&(y=m,m=y.pubID,g=y.sysID),g==null&&(D=[m,g],g=D[0],m=D[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,v,S;for(v={},S=this.children,m=0,g=S.length;m<g;m++)f=S[m],f.type===t.EntityDeclaration&&!f.pe&&(v[f.name]=f);return new o(v)}}),Object.defineProperty(d.prototype,"notations",{get:function(){var f,m,g,v,S;for(v={},S=this.children,m=0,g=S.length;m<g;m++)f=S[m],f.type===t.NotationDeclaration&&(v[f.name]=f);return new o(v)}}),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,v,S){var A;return A=new e(this,f,m,g,v,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,v,S){return this.attList(f,m,g,v,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(zR)});var jd=b((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;t=Et(),e=Fr(),WR.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(KR)});var Bd=b((XR,YR)=>{(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=Oc(),YR.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(XR)});var Md=b((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=Oc(),ZR.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(JR)});var sv=b((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;r=Fr(),t=Et(),eN.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(QR)});var nN=b((tN,rN)=>{(function(){var t;rN.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(tN)});var oN=b((iN,sN)=>{(function(){sN.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(iN)});var Fr=b((aN,uN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,g,v,S,A,p={}.hasOwnProperty;A=In(),S=A.isObject,v=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,uN.exports=c=(function(){function y(D){this.parent=D,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,a||(a=Td(),r=Fd(),n=Id(),i=kd(),s=Ld(),d=jd(),f=Bd(),h=Md(),o=sv(),e=Et(),l=nN(),u=xd(),t=oN())}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 D;return D=this.parent.children.indexOf(this),this.parent.children[D-1]||null}}),Object.defineProperty(y.prototype,"nextSibling",{get:function(){var D;return D=this.parent.children.indexOf(this),this.parent.children[D+1]||null}}),Object.defineProperty(y.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(y.prototype,"textContent",{get:function(){var D,C,k,E,R;if(this.nodeType===e.Element||this.nodeType===e.DocumentFragment){for(R="",E=this.children,C=0,k=E.length;C<k;C++)D=E[C],D.textContent&&(R+=D.textContent);return R}else return null},set:function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),y.prototype.setParent=function(D){var C,k,E,R,P;for(this.parent=D,D&&(this.options=D.options,this.stringify=D.stringify),R=this.children,P=[],k=0,E=R.length;k<E;k++)C=R[k],P.push(C.setParent(this));return P},y.prototype.element=function(D,C,k){var E,R,P,F,j,U,G,L,_,T,I;if(U=null,C===null&&k==null&&(_=[{},null],C=_[0],k=_[1]),C==null&&(C={}),C=m(C),S(C)||(T=[C,k],k=T[0],C=T[1]),D!=null&&(D=m(D)),Array.isArray(D))for(P=0,G=D.length;P<G;P++)R=D[P],U=this.element(R);else if(v(D))U=this.element(D.apply());else if(S(D)){for(j in D)if(p.call(D,j))if(I=D[j],v(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&&k===null?U=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&D.indexOf(this.stringify.convertTextKey)===0?U=this.text(k):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&D.indexOf(this.stringify.convertCDataKey)===0?U=this.cdata(k):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&D.indexOf(this.stringify.convertCommentKey)===0?U=this.comment(k):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&D.indexOf(this.stringify.convertRawKey)===0?U=this.raw(k):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&D.indexOf(this.stringify.convertPIKey)===0?U=this.instruction(D.substr(this.stringify.convertPIKey.length),k):U=this.node(D,C,k);if(U==null)throw new Error("Could not create any elements with: "+D+". "+this.debugInfo());return U},y.prototype.insertBefore=function(D,C,k){var E,R,P,F,j;if(D?.type)return P=D,F=C,P.setParent(this),F?(R=children.indexOf(F),j=children.splice(R),children.push(P),Array.prototype.push.apply(children,j)):children.push(P),P;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(D));return R=this.parent.children.indexOf(this),j=this.parent.children.splice(R),E=this.parent.element(D,C,k),Array.prototype.push.apply(this.parent.children,j),E},y.prototype.insertAfter=function(D,C,k){var E,R,P;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(D));return R=this.parent.children.indexOf(this),P=this.parent.children.splice(R+1),E=this.parent.element(D,C,k),Array.prototype.push.apply(this.parent.children,P),E},y.prototype.remove=function(){var D,C;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return D=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[D,D-D+1].concat(C=[])),this.parent},y.prototype.node=function(D,C,k){var E,R;return D!=null&&(D=m(D)),C||(C={}),C=m(C),S(C)||(R=[C,k],k=R[0],C=R[1]),E=new a(this,D,C),k!=null&&E.text(k),this.children.push(E),E},y.prototype.text=function(D){var C;return S(D)&&this.element(D),C=new f(this,D),this.children.push(C),this},y.prototype.cdata=function(D){var C;return C=new r(this,D),this.children.push(C),this},y.prototype.comment=function(D){var C;return C=new n(this,D),this.children.push(C),this},y.prototype.commentBefore=function(D){var C,k,E;return k=this.parent.children.indexOf(this),E=this.parent.children.splice(k),C=this.parent.comment(D),Array.prototype.push.apply(this.parent.children,E),this},y.prototype.commentAfter=function(D){var C,k,E;return k=this.parent.children.indexOf(this),E=this.parent.children.splice(k+1),C=this.parent.comment(D),Array.prototype.push.apply(this.parent.children,E),this},y.prototype.raw=function(D){var C;return C=new d(this,D),this.children.push(C),this},y.prototype.dummy=function(){var D;return D=new o(this),D},y.prototype.instruction=function(D,C){var k,E,R,P,F;if(D!=null&&(D=m(D)),C!=null&&(C=m(C)),Array.isArray(D))for(P=0,F=D.length;P<F;P++)k=D[P],this.instruction(k);else if(S(D))for(k in D)p.call(D,k)&&(E=D[k],this.instruction(k,E));else v(C)&&(C=C.apply()),R=new h(this,D,C),this.children.push(R);return this},y.prototype.instructionBefore=function(D,C){var k,E,R;return E=this.parent.children.indexOf(this),R=this.parent.children.splice(E),k=this.parent.instruction(D,C),Array.prototype.push.apply(this.parent.children,R),this},y.prototype.instructionAfter=function(D,C){var k,E,R;return E=this.parent.children.indexOf(this),R=this.parent.children.splice(E+1),k=this.parent.instruction(D,C),Array.prototype.push.apply(this.parent.children,R),this},y.prototype.declaration=function(D,C,k){var E,R;return E=this.document(),R=new i(E,D,C,k),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(D,C){var k,E,R,P,F,j,U,G,L,_;for(E=this.document(),R=new s(E,D,C),L=E.children,P=F=0,U=L.length;F<U;P=++F)if(k=L[P],k.type===e.DocType)return E.children[P]=R,R;for(_=E.children,P=j=0,G=_.length;j<G;P=++j)if(k=_[P],k.isRoot)return E.children.splice(P,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 D;for(D=this;D;){if(D.type===e.Document)return D.rootObject;if(D.isRoot)return D;D=D.parent}},y.prototype.document=function(){var D;for(D=this;D;){if(D.type===e.Document)return D;D=D.parent}},y.prototype.end=function(D){return this.document().end(D)},y.prototype.prev=function(){var D;if(D=this.parent.children.indexOf(this),D<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[D-1]},y.prototype.next=function(){var D;if(D=this.parent.children.indexOf(this),D===-1||D===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[D+1]},y.prototype.importDocument=function(D){var C;return C=D.root().clone(),C.parent=this,C.isRoot=!1,this.children.push(C),this},y.prototype.debugInfo=function(D){var C,k;return D=D||this.name,D==null&&!((C=this.parent)!=null&&C.name)?"":D==null?"parent: <"+this.parent.name+">":(k=this.parent)!=null&&k.name?"node: <"+D+">, parent: <"+this.parent.name+">":"node: <"+D+">"},y.prototype.ele=function(D,C,k){return this.element(D,C,k)},y.prototype.nod=function(D,C,k){return this.node(D,C,k)},y.prototype.txt=function(D){return this.text(D)},y.prototype.dat=function(D){return this.cdata(D)},y.prototype.com=function(D){return this.comment(D)},y.prototype.ins=function(D,C){return this.instruction(D,C)},y.prototype.doc=function(){return this.document()},y.prototype.dec=function(D,C,k){return this.declaration(D,C,k)},y.prototype.e=function(D,C,k){return this.element(D,C,k)},y.prototype.n=function(D,C,k){return this.node(D,C,k)},y.prototype.t=function(D){return this.text(D)},y.prototype.d=function(D){return this.cdata(D)},y.prototype.c=function(D){return this.comment(D)},y.prototype.r=function(D){return this.raw(D)},y.prototype.i=function(D,C){return this.instruction(D,C)},y.prototype.u=function(){return this.up()},y.prototype.importXMLBuilder=function(D){return this.importDocument(D)},y.prototype.replaceChild=function(D,C){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.removeChild=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.appendChild=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.hasChildNodes=function(){return this.children.length!==0},y.prototype.cloneNode=function(D){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(D,C){return!0},y.prototype.hasAttributes=function(){return this.attribs.length!==0},y.prototype.compareDocumentPosition=function(D){var C,k;return C=this,C===D?0:this.document()!==D.document()?(k=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?k|=t.Preceding:k|=t.Following,k):C.isAncestor(D)?t.Contains|t.Preceding:C.isDescendant(D)?t.Contains|t.Following:C.isPreceding(D)?t.Preceding:t.Following},y.prototype.isSameNode=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.lookupPrefix=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.isDefaultNamespace=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.lookupNamespaceURI=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.isEqualNode=function(D){var C,k,E;if(D.nodeType!==this.nodeType||D.children.length!==this.children.length)return!1;for(C=k=0,E=this.children.length-1;0<=E?k<=E:k>=E;C=0<=E?++k:--k)if(!this.children[C].isEqualNode(D.children[C]))return!1;return!0},y.prototype.getFeature=function(D,C){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.setUserData=function(D,C,k){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.getUserData=function(D){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.contains=function(D){return D?D===this||this.isDescendant(D):!1},y.prototype.isDescendant=function(D){var C,k,E,R,P;for(P=this.children,E=0,R=P.length;E<R;E++)if(C=P[E],D===C||(k=C.isDescendant(D),k))return!0;return!1},y.prototype.isAncestor=function(D){return D.isDescendant(this)},y.prototype.isPreceding=function(D){var C,k;return C=this.treePosition(D),k=this.treePosition(this),C===-1||k===-1?!1:C<k},y.prototype.isFollowing=function(D){var C,k;return C=this.treePosition(D),k=this.treePosition(this),C===-1||k===-1?!1:C>k},y.prototype.treePosition=function(D){var C,k;return k=0,C=!1,this.foreachTreeNode(this.document(),function(E){if(k++,!C&&E===D)return C=!0}),C?k:-1},y.prototype.foreachTreeNode=function(D,C){var k,E,R,P,F;for(D||(D=this.document()),P=D.children,E=0,R=P.length;E<R;E++){if(k=P[E],F=C(k))return F;if(F=this.foreachTreeNode(k,C),F)return F}},y})()}).call(aN)});var ov=b((cN,lN)=>{(function(){var t,e=function(n,i){return function(){return n.apply(i,arguments)}},r={}.hasOwnProperty;lN.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(cN)});var xc=b((fN,hN)=>{(function(){hN.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(fN)});var av=b((dN,pN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,g,v,S={}.hasOwnProperty;v=In().assign,t=Et(),u=kd(),c=Ld(),r=Fd(),n=Id(),h=Td(),f=jd(),m=Bd(),d=Md(),l=sv(),i=Pd(),s=Nd(),o=Rd(),a=$d(),e=xc(),pN.exports=g=(function(){function A(p){var y,D,C;p||(p={}),this.options=p,D=p.writer||{};for(y in D)S.call(D,y)&&(C=D[y],this["_"+y]=this[y],this[y]=C)}return A.prototype.filterOptions=function(p){var y,D,C,k,E,R,P,F;return p||(p={}),p=v({},this.options,p),y={writer:this},y.pretty=p.pretty||!1,y.allowEmpty=p.allowEmpty||!1,y.indent=(D=p.indent)!=null?D:" ",y.newline=(C=p.newline)!=null?C:`
|
|
185
|
+
`,y.offset=(k=p.offset)!=null?k:0,y.dontPrettyTextNodes=(E=(R=p.dontPrettyTextNodes)!=null?R:p.dontprettytextnodes)!=null?E:0,y.spaceBeforeSlash=(P=(F=p.spaceBeforeSlash)!=null?F:p.spacebeforeslash)!=null?P:"",y.spaceBeforeSlash===!0&&(y.spaceBeforeSlash=" "),y.suppressPrettyCount=0,y.user={},y.state=e.None,y},A.prototype.indent=function(p,y,D){var C;return!y.pretty||y.suppressPrettyCount?"":y.pretty&&(C=(D||0)+y.offset+1,C>0)?new Array(C).join(y.indent):""},A.prototype.endline=function(p,y,D){return!y.pretty||y.suppressPrettyCount?"":y.newline},A.prototype.attribute=function(p,y,D){var C;return this.openAttribute(p,y,D),C=" "+p.name+'="'+p.value+'"',this.closeAttribute(p,y,D),C},A.prototype.cdata=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D)+"<![CDATA[",y.state=e.InsideTag,C+=p.value,y.state=e.CloseTag,C+="]]>"+this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.comment=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D)+"<!-- ",y.state=e.InsideTag,C+=p.value,y.state=e.CloseTag,C+=" -->"+this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.declaration=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D)+"<?xml",y.state=e.InsideTag,C+=' version="'+p.version+'"',p.encoding!=null&&(C+=' encoding="'+p.encoding+'"'),p.standalone!=null&&(C+=' standalone="'+p.standalone+'"'),y.state=e.CloseTag,C+=y.spaceBeforeSlash+"?>",C+=this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.docType=function(p,y,D){var C,k,E,R,P;if(D||(D=0),this.openNode(p,y,D),y.state=e.OpenTag,R=this.indent(p,y,D),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,D),y.state=e.InsideTag,P=p.children,k=0,E=P.length;k<E;k++)C=P[k],R+=this.writeChildNode(C,y,D+1);y.state=e.CloseTag,R+="]"}return y.state=e.CloseTag,R+=y.spaceBeforeSlash+">",R+=this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),R},A.prototype.element=function(p,y,D){var C,k,E,R,P,F,j,U,G,L,_,T,I,$;D||(D=0),L=!1,_="",this.openNode(p,y,D),y.state=e.OpenTag,_+=this.indent(p,y,D)+"<"+p.name,T=p.attribs;for(G in T)S.call(T,G)&&(C=T[G],_+=this.attribute(C,y,D));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?(_+=">",y.state=e.CloseTag,_+="</"+p.name+">"+this.endline(p,y,D)):(y.state=e.CloseTag,_+=y.spaceBeforeSlash+"/>"+this.endline(p,y,D));else if(y.pretty&&E===1&&(R.type===t.Text||R.type===t.Raw)&&R.value!=null)_+=">",y.state=e.InsideTag,y.suppressPrettyCount++,L=!0,_+=this.writeChildNode(R,y,D+1),y.suppressPrettyCount--,L=!1,y.state=e.CloseTag,_+="</"+p.name+">"+this.endline(p,y,D);else{if(y.dontPrettyTextNodes){for(I=p.children,P=0,j=I.length;P<j;P++)if(k=I[P],(k.type===t.Text||k.type===t.Raw)&&k.value!=null){y.suppressPrettyCount++,L=!0;break}}for(_+=">"+this.endline(p,y,D),y.state=e.InsideTag,$=p.children,F=0,U=$.length;F<U;F++)k=$[F],_+=this.writeChildNode(k,y,D+1);y.state=e.CloseTag,_+=this.indent(p,y,D)+"</"+p.name+">",L&&y.suppressPrettyCount--,_+=this.endline(p,y,D),y.state=e.None}return this.closeNode(p,y,D),_},A.prototype.writeChildNode=function(p,y,D){switch(p.type){case t.CData:return this.cdata(p,y,D);case t.Comment:return this.comment(p,y,D);case t.Element:return this.element(p,y,D);case t.Raw:return this.raw(p,y,D);case t.Text:return this.text(p,y,D);case t.ProcessingInstruction:return this.processingInstruction(p,y,D);case t.Dummy:return"";case t.Declaration:return this.declaration(p,y,D);case t.DocType:return this.docType(p,y,D);case t.AttributeDeclaration:return this.dtdAttList(p,y,D);case t.ElementDeclaration:return this.dtdElement(p,y,D);case t.EntityDeclaration:return this.dtdEntity(p,y,D);case t.NotationDeclaration:return this.dtdNotation(p,y,D);default:throw new Error("Unknown XML node type: "+p.constructor.name)}},A.prototype.processingInstruction=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D)+"<?",y.state=e.InsideTag,C+=p.target,p.value&&(C+=" "+p.value),y.state=e.CloseTag,C+=y.spaceBeforeSlash+"?>",C+=this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.raw=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D),y.state=e.InsideTag,C+=p.value,y.state=e.CloseTag,C+=this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.text=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D),y.state=e.InsideTag,C+=p.value,y.state=e.CloseTag,C+=this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.dtdAttList=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D)+"<!ATTLIST",y.state=e.InsideTag,C+=" "+p.elementName+" "+p.attributeName+" "+p.attributeType,p.defaultValueType!=="#DEFAULT"&&(C+=" "+p.defaultValueType),p.defaultValue&&(C+=' "'+p.defaultValue+'"'),y.state=e.CloseTag,C+=y.spaceBeforeSlash+">"+this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.dtdElement=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D)+"<!ELEMENT",y.state=e.InsideTag,C+=" "+p.name+" "+p.value,y.state=e.CloseTag,C+=y.spaceBeforeSlash+">"+this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.dtdEntity=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D)+"<!ENTITY",y.state=e.InsideTag,p.pe&&(C+=" %"),C+=" "+p.name,p.value?C+=' "'+p.value+'"':(p.pubID&&p.sysID?C+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.sysID&&(C+=' SYSTEM "'+p.sysID+'"'),p.nData&&(C+=" NDATA "+p.nData)),y.state=e.CloseTag,C+=y.spaceBeforeSlash+">"+this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.dtdNotation=function(p,y,D){var C;return this.openNode(p,y,D),y.state=e.OpenTag,C=this.indent(p,y,D)+"<!NOTATION",y.state=e.InsideTag,C+=" "+p.name,p.pubID&&p.sysID?C+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.pubID?C+=' PUBLIC "'+p.pubID+'"':p.sysID&&(C+=' SYSTEM "'+p.sysID+'"'),y.state=e.CloseTag,C+=y.spaceBeforeSlash+">"+this.endline(p,y,D),y.state=e.None,this.closeNode(p,y,D),C},A.prototype.openNode=function(p,y,D){},A.prototype.closeNode=function(p,y,D){},A.prototype.openAttribute=function(p,y,D){},A.prototype.closeAttribute=function(p,y,D){},A})()}).call(dN)});var qd=b((mN,gN)=>{(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=av(),gN.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(mN)});var uv=b((yN,DN)=>{(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=nv(),e=vR(),i=Fr(),t=Et(),o=ov(),s=qd(),DN.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(yN)});var bN=b((wN,vN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,g,v,S,A,p,y,D,C,k,E={}.hasOwnProperty;k=In(),D=k.isObject,y=k.isFunction,C=k.isPlainObject,p=k.getValue,t=Et(),h=uv(),f=Td(),n=Fd(),i=Id(),g=jd(),A=Bd(),m=Md(),c=kd(),l=Ld(),s=Pd(),a=Rd(),o=Nd(),u=$d(),r=iv(),S=ov(),v=qd(),e=xc(),vN.exports=d=(function(){function R(P,F,j){var U;this.name="?xml",this.type=t.Document,P||(P={}),U={},P.writer?C(P.writer)&&(U=P.writer,P.writer=new v):P.writer=new v,this.options=P,this.writer=P.writer,this.writerOptions=this.writer.filterOptions(U),this.stringify=new S(P),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(P){var F,j,U,G,L,_,T,I;switch(P.type){case t.CData:this.cdata(P.value);break;case t.Comment:this.comment(P.value);break;case t.Element:U={},T=P.attribs;for(j in T)E.call(T,j)&&(F=T[j],U[j]=F.value);this.node(P.name,U);break;case t.Dummy:this.dummy();break;case t.Raw:this.raw(P.value);break;case t.Text:this.text(P.value);break;case t.ProcessingInstruction:this.instruction(P.target,P.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+P.constructor.name)}for(I=P.children,L=0,_=I.length;L<_;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(P,F,j){var U;if(P==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(P));return this.openCurrent(),P=p(P),F==null&&(F={}),F=p(F),D(F)||(U=[F,j],j=U[0],F=U[1]),this.currentNode=new f(this,P,F),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,j!=null&&this.text(j),this},R.prototype.element=function(P,F,j){var U,G,L,_,T,I;if(this.currentNode&&this.currentNode.type===t.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(P)||D(P)||y(P))for(_=this.options.noValidation,this.options.noValidation=!0,I=new h(this.options).element("TEMP_ROOT"),I.element(P),this.options.noValidation=_,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(P,F,j);return this},R.prototype.attribute=function(P,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(P));if(P!=null&&(P=p(P)),D(P))for(j in P)E.call(P,j)&&(U=P[j],this.attribute(j,U));else y(F)&&(F=F.apply()),this.options.keepNullAttributes&&F==null?this.currentNode.attribs[P]=new r(this,P,""):F!=null&&(this.currentNode.attribs[P]=new r(this,P,F));return this},R.prototype.text=function(P){var F;return this.openCurrent(),F=new A(this,P),this.onData(this.writer.text(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.cdata=function(P){var F;return this.openCurrent(),F=new n(this,P),this.onData(this.writer.cdata(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.comment=function(P){var F;return this.openCurrent(),F=new i(this,P),this.onData(this.writer.comment(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.raw=function(P){var F;return this.openCurrent(),F=new g(this,P),this.onData(this.writer.raw(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.instruction=function(P,F){var j,U,G,L,_;if(this.openCurrent(),P!=null&&(P=p(P)),F!=null&&(F=p(F)),Array.isArray(P))for(j=0,L=P.length;j<L;j++)U=P[j],this.instruction(U);else if(D(P))for(U in P)E.call(P,U)&&(G=P[U],this.instruction(U,G));else y(F)&&(F=F.apply()),_=new m(this,P,F),this.onData(this.writer.processingInstruction(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},R.prototype.declaration=function(P,F,j){var U;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return U=new c(this,P,F,j),this.onData(this.writer.declaration(U,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.doctype=function(P,F,j){if(this.openCurrent(),P==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=P,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},R.prototype.dtdElement=function(P,F){var j;return this.openCurrent(),j=new o(this,P,F),this.onData(this.writer.dtdElement(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.attList=function(P,F,j,U,G){var L;return this.openCurrent(),L=new s(this,P,F,j,U,G),this.onData(this.writer.dtdAttList(L,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.entity=function(P,F){var j;return this.openCurrent(),j=new a(this,!1,P,F),this.onData(this.writer.dtdEntity(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.pEntity=function(P,F){var j;return this.openCurrent(),j=new a(this,!0,P,F),this.onData(this.writer.dtdEntity(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},R.prototype.notation=function(P,F){var j;return this.openCurrent(),j=new u(this,P,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(P){var F,j,U,G;if(!P.isOpen){if(!this.root&&this.currentLevel===0&&P.type===t.Element&&(this.root=P),j="",P.type===t.Element){this.writerOptions.state=e.OpenTag,j=this.writer.indent(P,this.writerOptions,this.currentLevel)+"<"+P.name,G=P.attribs;for(U in G)E.call(G,U)&&(F=G[U],j+=this.writer.attribute(F,this.writerOptions,this.currentLevel));j+=(P.children?">":"/>")+this.writer.endline(P,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,j=this.writer.indent(P,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+P.rootNodeName,P.pubID&&P.sysID?j+=' PUBLIC "'+P.pubID+'" "'+P.sysID+'"':P.sysID&&(j+=' SYSTEM "'+P.sysID+'"'),P.children?(j+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,j+=">"),j+=this.writer.endline(P,this.writerOptions,this.currentLevel);return this.onData(j,this.currentLevel),P.isOpen=!0}},R.prototype.closeNode=function(P){var F;if(!P.isClosed)return F="",this.writerOptions.state=e.CloseTag,P.type===t.Element?F=this.writer.indent(P,this.writerOptions,this.currentLevel)+"</"+P.name+">"+this.writer.endline(P,this.writerOptions,this.currentLevel):F=this.writer.indent(P,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(P,this.writerOptions,this.currentLevel),this.writerOptions.state=e.None,this.onData(F,this.currentLevel),P.isClosed=!0},R.prototype.onData=function(P,F){return this.documentStarted=!0,this.onDataCallback(P,F+1)},R.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},R.prototype.debugInfo=function(P){return P==null?"":"node: <"+P+">"},R.prototype.ele=function(){return this.element.apply(this,arguments)},R.prototype.nod=function(P,F,j){return this.node(P,F,j)},R.prototype.txt=function(P){return this.text(P)},R.prototype.dat=function(P){return this.cdata(P)},R.prototype.com=function(P){return this.comment(P)},R.prototype.ins=function(P,F){return this.instruction(P,F)},R.prototype.dec=function(P,F,j){return this.declaration(P,F,j)},R.prototype.dtd=function(P,F,j){return this.doctype(P,F,j)},R.prototype.e=function(P,F,j){return this.element(P,F,j)},R.prototype.n=function(P,F,j){return this.node(P,F,j)},R.prototype.t=function(P){return this.text(P)},R.prototype.d=function(P){return this.cdata(P)},R.prototype.c=function(P){return this.comment(P)},R.prototype.r=function(P){return this.raw(P)},R.prototype.i=function(P,F){return this.instruction(P,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(P,F){return this.entity(P,F)},R.prototype.pent=function(P,F){return this.pEntity(P,F)},R.prototype.not=function(P,F){return this.notation(P,F)},R})()}).call(wN)});var CN=b((EN,_N)=>{(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=av(),e=xc(),_N.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,v,S,A;for(v=u.children,h=d=0,m=v.length;d<m;h=++d)l=v[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,v,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(D){return(D.type===t.Text||D.type===t.Raw)&&D.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,v=y.length;g<v;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(EN)});var AN=b((SN,Vi)=>{(function(){var t,e,r,n,i,s,o,a,u,c;c=In(),a=c.assign,u=c.isFunction,r=nv(),n=uv(),i=bN(),o=qd(),s=CN(),t=Et(),e=xc(),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(SN)});var ON=b(cv=>{(function(){"use strict";var t,e,r,n,i,s={}.hasOwnProperty;t=AN(),e=Od().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[>")},cv.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 v,S,A,p,y,D;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(v in S)D=S[v],m=m.att(v,D)}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(cv)});var xN=b(Ud=>{(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),P(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,re=e.length;N<re;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(re){if(!re)return H.removeAllListeners(N),H._parser["on"+N]=re,re;H.on(N,re)},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]/,v=/[:_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 y(x){return x==='"'||x==="'"}function D(x){return x===">"||p(x)}function C(x,O){return x.test(O)}function k(x,O){return!C(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 P(x,O,H){x[O]&&x[O](H)}function F(x,O,H){x.textNode&&j(x),P(x,O,H)}function j(x){x.textNode=U(x.opt,x.textNode),x.textNode&&P(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
|
-
Char: `+x.c),O=new Error(O),x.error=O,P(x,"onerror",O),x}function L(x){return x.sawRoot&&!x.closedRoot&&_(x,"Unclosed root tag"),x.state!==E.BEGIN&&x.state!==E.BEGIN_WHITESPACE&&x.state!==E.TEXT&&G(x,"Unexpected end"),
|
|
189
|
+
Char: `+x.c),O=new Error(O),x.error=O,P(x,"onerror",O),x}function L(x){return x.sawRoot&&!x.closedRoot&&_(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,P(x,"onend"),r.call(x,x.strict,x.opt),x}function _(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(":"),re=N[0],z=N[1];return O&&x==="xmlns"&&(re="xmlns",z=""),{prefix:re,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)_(x,"xml: prefix must be bound to "+d+`
|
|
190
190
|
Actual: `+x.attribValue);else if(N==="xmlns"&&x.attribValue!==f)_(x,"xmlns: prefix must be bound to "+f+`
|
|
191
|
-
Actual: `+x.attribValue);else{var re=x.tag,z=x.tags[x.tags.length-1]||x;re.ns===z.ns&&(re.ns=Object.create(z.ns)),re.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&&(_(x,"Unbound namespace prefix: "+JSON.stringify(x.tagName)),H.uri=N.prefix);var re=x.tags[x.tags.length-1]||x;H.ns&&re.ns!==H.ns&&Object.keys(H.ns).forEach(function(xE){F(x,"onopennamespace",{prefix:xE,uri:H.ns[xE]})});for(var z=0,ie=x.attribList.length;z<ie;z++){var we=x.attribList[z],Oe=we[0],Me=we[1],wt=I(Oe,!0),dr=wt.prefix,Cq=wt.local,OE=dr===""?"":H.ns[dr]||"",om={name:Oe,value:Me,prefix:dr,local:Cq,uri:OE};dr&&dr!=="xmlns"&&!OE&&(_(x,"Unbound namespace prefix: "+JSON.stringify(dr)),om.uri=dr),x.tag.attributes[Oe]=om,F(x,"onattribute",om)}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
|
|
191
|
+
Actual: `+x.attribValue);else{var re=x.tag,z=x.tags[x.tags.length-1]||x;re.ns===z.ns&&(re.ns=Object.create(z.ns)),re.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&&(_(x,"Unbound namespace prefix: "+JSON.stringify(x.tagName)),H.uri=N.prefix);var re=x.tags[x.tags.length-1]||x;H.ns&&re.ns!==H.ns&&Object.keys(H.ns).forEach(function(xE){F(x,"onopennamespace",{prefix:xE,uri:H.ns[xE]})});for(var z=0,ie=x.attribList.length;z<ie;z++){var we=x.attribList[z],Oe=we[0],Me=we[1],wt=I(Oe,!0),dr=wt.prefix,Cq=wt.local,OE=dr===""?"":H.ns[dr]||"",om={name:Oe,value:Me,prefix:dr,local:Cq,uri:OE};dr&&dr!=="xmlns"&&!OE&&(_(x,"Unbound namespace prefix: "+JSON.stringify(dr)),om.uri=dr),x.tag.attributes[Oe]=om,F(x,"onattribute",om)}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){_(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 re=x.tags[O];if(re.name!==N)_(x,"Unexpected close tag");else break}if(O<0){_(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 Oe in ie.ns)we[Oe]=ie.ns[Oe];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 W(x){var O=x.entity,H=O.toLowerCase(),N,re="";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),re=N.toString(16)):(O=O.slice(1),N=parseInt(O,10),re=N.toString(10))),O=O.replace(/^0+/,""),isNaN(N)||re.toLowerCase()!==O||N<0||N>1114111?(_(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)||(_(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
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)&&_(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(C(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(_(O,"Unencoded <"),O.startTagPosition+1<O.position){var re=O.position-O.startTagPosition;N=new Array(re).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)&&_(O,"Inappropriately located doctype declaration"),O.doctype="",O.sgmlDecl=""):N===">"?(F(O,"onsgmldeclaration",O.sgmlDecl),O.sgmlDecl="",O.state=E.TEXT):(y(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:y(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):y(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!==">"?(_(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:C(v,N)?O.tagName+=N:(T(O),N===">"?M(O):N==="/"?O.state=E.OPEN_TAG_SLASH:(p(N)||_(O,"Invalid character in tag name"),O.state=E.ATTRIB));continue;case E.OPEN_TAG_SLASH:N===">"?(M(O,!0),j(O)):(_(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:C(g,N)?(O.attribName=N,O.attribValue="",O.state=E.ATTRIB_NAME):_(O,"Invalid attribute name");continue;case E.ATTRIB_NAME:N==="="?O.state=E.ATTRIB_VALUE:N===">"?(_(O,"Attribute without value"),O.attribValue=O.attribName,$(O),M(O)):p(N)?O.state=E.ATTRIB_NAME_SAW_WHITE:C(v,N)?O.attribName+=N:_(O,"Invalid attribute name");continue;case E.ATTRIB_NAME_SAW_WHITE:if(N==="=")O.state=E.ATTRIB_VALUE;else{if(p(N))continue;_(O,"Attribute without value"),O.tag.attributes[O.attribName]="",O.attribValue="",F(O,"onattribute",{name:O.attribName,value:""}),O.attribName="",N===">"?M(O):C(g,N)?(O.attribName=N,O.state=E.ATTRIB_NAME):(_(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:C(g,N)?(_(O,"No whitespace between attributes"),O.attribName=N,O.attribValue="",O.state=E.ATTRIB_NAME):_(O,"Invalid attribute name");continue;case E.ATTRIB_VALUE_UNQUOTED:if(!D(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===">"?j(O):C(v,N)?O.tagName+=N:O.script?(O.script+="</"+O.tagName,O.tagName="",O.state=E.SCRIPT):(p(N)||_(O,"Invalid tagname in closing tag"),O.state=E.CLOSE_TAG_SAW_WHITE);else{if(p(N))continue;k(g,N)?O.script?(O.script+="</"+N,O.state=E.SCRIPT):_(O,"Invalid tagname in closing tag."):O.tagName=N}continue;case E.CLOSE_TAG_SAW_WHITE:if(p(N))continue;N===">"?j(O):_(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 Oe=K(O);O.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(Oe)?(O.entity="",O.state=ie,O.write(Oe)):(O[we]+=Oe,O.entity="",O.state=ie)}else C(O.entity.length?A:S,N)?O.entity+=N:(_(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,re=[],z,ie,we=-1,Oe=arguments.length;if(!Oe)return"";for(var Me="";++we<Oe;){var wt=Number(arguments[we]);if(!isFinite(wt)||wt<0||wt>1114111||O(wt)!==wt)throw RangeError("Invalid code point: "+wt);wt<=65535?re.push(wt):(wt-=65536,z=(wt>>10)+55296,ie=wt%1024+56320,re.push(z,ie)),(we+1===Oe||re.length>N)&&(Me+=x.apply(null,re),re.length=0)}return Me};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:H,configurable:!0,writable:!0}):String.fromCodePoint=H})()})(typeof Ud>"u"?Ud.sax={}:Ud)});var TN=b(lv=>{(function(){"use strict";lv.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}).call(lv)});var fv=b(Ws=>{(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),Ws.normalize=function(e){return e.toLowerCase()},Ws.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},Ws.stripPrefix=function(e){return e.replace(t,"")},Ws.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},Ws.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(Ws)});var FN=b(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=xN(),n=require("events"),t=TN(),o=fv(),u=require("timers").setImmediate,e=Od().defaults,i=function(d){return typeof d=="object"&&d!=null&&Object.keys(d).length===0},s=function(d,f,m){var g,v,S;for(g=0,v=d.length;g<v;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,v,S;if(!(this instanceof ai.Parser))return new ai.Parser(m);this.options={},v=e["0.2"];for(g in v)h.call(v,g)&&(S=v[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(v){if(g=v,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(g)}},f.prototype.assignOrPush=function(m,g,v){return g in m?(m[g]instanceof Array||r(m,g,[m[g]]),m[g].push(v)):this.options.explicitArray?r(m,g,[v]):r(m,g,v)},f.prototype.reset=function(){var m,g,v,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,D,C,k,E;if(C={},C[g]="",!A.options.ignoreAttrs){E=p.attributes;for(y in E)h.call(E,y)&&(!(m in C)&&!A.options.mergeAttrs&&(C[m]={}),D=A.options.attrValueProcessors?s(A.options.attrValueProcessors,p.attributes[y],y):p.attributes[y],k=A.options.attrNameProcessors?s(A.options.attrNameProcessors,y):y,A.options.mergeAttrs?A.assignOrPush(C,k,D):r(C[m],k,D))}return C["#name"]=A.options.tagNameProcessors?s(A.options.tagNameProcessors,p.name):p.name,A.options.xmlns&&(C[A.options.xmlnskey]={uri:p.uri,local:p.local}),S.push(C)}})(this),this.saxParser.onclosetag=(function(A){return function(){var p,y,D,C,k,E,R,P,F,B;if(E=S.pop(),k=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],k):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&&(B="/"+(function(){var U,G,L;for(L=[],U=0,G=S.length;U<G;U++)C=S[U],L.push(C["#name"]);return L})().concat(k).join("/"),(function(){var U;try{return E=A.options.validator(B,F&&F[k],E)}catch(G){return U=G,A.emit("error",U)}})()),A.options.explicitChildren&&!A.options.mergeAttrs&&typeof E=="object"){if(!A.options.preserveChildrenOrder)C={},A.options.attrkey in E&&(C[A.options.attrkey]=E[A.options.attrkey],delete E[A.options.attrkey]),!A.options.charsAsChildren&&A.options.charkey in E&&(C[A.options.charkey]=E[A.options.charkey],delete E[A.options.charkey]),Object.getOwnPropertyNames(E).length>0&&(C[A.options.childkey]=E),E=C;else if(F){F[A.options.childkey]=F[A.options.childkey]||[],R={};for(D in E)h.call(E,D)&&r(R,D,E[D]);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,k,E):(A.options.explicitRoot&&(P=E,E={},r(E,k,P)),A.resultObject=E,A.saxParser.ended=!0,A.emit("end",A.resultObject))}})(this),v=(function(A){return function(p){var y,D;if(D=S[S.length-1],D)return D[g]+=p,A.options.explicitChildren&&A.options.preserveChildrenOrder&&A.options.charsAsChildren&&(A.options.includeWhiteChars||p.replace(/\\n/g,"").trim()!=="")&&(D[A.options.childkey]=D[A.options.childkey]||[],y={"#name":"__text__"},y[g]=p,A.options.normalize&&(y[g]=y[g].replace(/\s{2,}/g," ").trim()),D[A.options.childkey].push(y)),D}})(this),this.saxParser.ontext=v,this.saxParser.oncdata=(function(A){return function(p){var y;if(y=v(p),y)return y.cdata=!0}})(this)},f.prototype.parseString=function(m,g){var v;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(v=S,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw v}else return this.emit("error",v),this.saxParser.errThrown=!0}},f.prototype.parseStringPromise=function(m){return new Promise((function(g){return function(v,S){return g.parseString(m,function(A,p){return A?S(A):v(p)})}})(this))},f})(n),ai.parseString=function(d,f,m){var g,v,S;return m!=null?(typeof m=="function"&&(g=m),typeof f=="object"&&(v=f)):(typeof f=="function"&&(g=f),v={}),S=new ai.Parser(v),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 IN=b(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=Od(),t=ON(),r=FN(),n=fv(),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 kN=b(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.buildXmlElement=kn.writeXML=kn.parseXML=kn.readXML=void 0;var xre=(fe(),ue(le)),Tre=ya(),Tc=xre.__importDefault(IN());async function Fre(t){var e;try{let r=await(0,Tre.readFile)(t,{encoding:"utf-8"});try{return await Tc.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}kn.readXML=Fre;function Ire(t,e){let r=e!==void 0?new Tc.default.Parser({...e}):new Tc.default.Parser,n;return r.parseString(t,(i,s)=>{i||(n=s)}),n}kn.parseXML=Ire;async function kre(t){return new Promise(e=>{let n=new Tc.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}kn.writeXML=kre;function Pre(t,e){return new Tc.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}kn.buildXmlElement=Pre});var LN=b(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 Rre=(fe(),ue(le)),Nre=ya(),hv=require("path"),Fa=Rre.__importDefault(Da()),$re=td(),Lre=mc(),PN=Ad(),jre=kN();function RN(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=RN;async function Bre(t,e){var r;let n=(r=RN(t,e))!==null&&r!==void 0?r:$N(t);return(await Promise.all(n.map(async s=>NN(t,s)))).filter(s=>!!s)}Le.getPlugins=Bre;async function NN(t,e){try{let r=(0,PN.resolveNode)(t.app.rootDir,e,"package.json");r||(0,$re.fatal)(`Unable to find ${Fa.default.strong(`node_modules/${e}`)}.
|
|
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:C(v,N)?O.tagName+=N:(T(O),N===">"?M(O):N==="/"?O.state=E.OPEN_TAG_SLASH:(p(N)||_(O,"Invalid character in tag name"),O.state=E.ATTRIB));continue;case E.OPEN_TAG_SLASH:N===">"?(M(O,!0),B(O)):(_(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:C(g,N)?(O.attribName=N,O.attribValue="",O.state=E.ATTRIB_NAME):_(O,"Invalid attribute name");continue;case E.ATTRIB_NAME:N==="="?O.state=E.ATTRIB_VALUE:N===">"?(_(O,"Attribute without value"),O.attribValue=O.attribName,$(O),M(O)):p(N)?O.state=E.ATTRIB_NAME_SAW_WHITE:C(v,N)?O.attribName+=N:_(O,"Invalid attribute name");continue;case E.ATTRIB_NAME_SAW_WHITE:if(N==="=")O.state=E.ATTRIB_VALUE;else{if(p(N))continue;_(O,"Attribute without value"),O.tag.attributes[O.attribName]="",O.attribValue="",F(O,"onattribute",{name:O.attribName,value:""}),O.attribName="",N===">"?M(O):C(g,N)?(O.attribName=N,O.state=E.ATTRIB_NAME):(_(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:C(g,N)?(_(O,"No whitespace between attributes"),O.attribName=N,O.attribValue="",O.state=E.ATTRIB_NAME):_(O,"Invalid attribute name");continue;case E.ATTRIB_VALUE_UNQUOTED:if(!D(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):C(v,N)?O.tagName+=N:O.script?(O.script+="</"+O.tagName,O.tagName="",O.state=E.SCRIPT):(p(N)||_(O,"Invalid tagname in closing tag"),O.state=E.CLOSE_TAG_SAW_WHITE);else{if(p(N))continue;k(g,N)?O.script?(O.script+="</"+N,O.state=E.SCRIPT):_(O,"Invalid tagname in closing tag."):O.tagName=N}continue;case E.CLOSE_TAG_SAW_WHITE:if(p(N))continue;N===">"?B(O):_(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 Oe=W(O);O.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(Oe)?(O.entity="",O.state=ie,O.write(Oe)):(O[we]+=Oe,O.entity="",O.state=ie)}else C(O.entity.length?A:S,N)?O.entity+=N:(_(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,re=[],z,ie,we=-1,Oe=arguments.length;if(!Oe)return"";for(var Me="";++we<Oe;){var wt=Number(arguments[we]);if(!isFinite(wt)||wt<0||wt>1114111||O(wt)!==wt)throw RangeError("Invalid code point: "+wt);wt<=65535?re.push(wt):(wt-=65536,z=(wt>>10)+55296,ie=wt%1024+56320,re.push(z,ie)),(we+1===Oe||re.length>N)&&(Me+=x.apply(null,re),re.length=0)}return Me};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:H,configurable:!0,writable:!0}):String.fromCodePoint=H})()})(typeof Ud>"u"?Ud.sax={}:Ud)});var TN=b(lv=>{(function(){"use strict";lv.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}).call(lv)});var fv=b(Ws=>{(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),Ws.normalize=function(e){return e.toLowerCase()},Ws.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},Ws.stripPrefix=function(e){return e.replace(t,"")},Ws.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},Ws.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(Ws)});var FN=b(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=xN(),n=require("events"),t=TN(),o=fv(),u=require("timers").setImmediate,e=Od().defaults,i=function(d){return typeof d=="object"&&d!=null&&Object.keys(d).length===0},s=function(d,f,m){var g,v,S;for(g=0,v=d.length;g<v;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,v,S;if(!(this instanceof ai.Parser))return new ai.Parser(m);this.options={},v=e["0.2"];for(g in v)h.call(v,g)&&(S=v[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(v){if(g=v,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(g)}},f.prototype.assignOrPush=function(m,g,v){return g in m?(m[g]instanceof Array||r(m,g,[m[g]]),m[g].push(v)):this.options.explicitArray?r(m,g,[v]):r(m,g,v)},f.prototype.reset=function(){var m,g,v,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,D,C,k,E;if(C={},C[g]="",!A.options.ignoreAttrs){E=p.attributes;for(y in E)h.call(E,y)&&(!(m in C)&&!A.options.mergeAttrs&&(C[m]={}),D=A.options.attrValueProcessors?s(A.options.attrValueProcessors,p.attributes[y],y):p.attributes[y],k=A.options.attrNameProcessors?s(A.options.attrNameProcessors,y):y,A.options.mergeAttrs?A.assignOrPush(C,k,D):r(C[m],k,D))}return C["#name"]=A.options.tagNameProcessors?s(A.options.tagNameProcessors,p.name):p.name,A.options.xmlns&&(C[A.options.xmlnskey]={uri:p.uri,local:p.local}),S.push(C)}})(this),this.saxParser.onclosetag=(function(A){return function(){var p,y,D,C,k,E,R,P,F,j;if(E=S.pop(),k=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],k):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++)C=S[U],L.push(C["#name"]);return L})().concat(k).join("/"),(function(){var U;try{return E=A.options.validator(j,F&&F[k],E)}catch(G){return U=G,A.emit("error",U)}})()),A.options.explicitChildren&&!A.options.mergeAttrs&&typeof E=="object"){if(!A.options.preserveChildrenOrder)C={},A.options.attrkey in E&&(C[A.options.attrkey]=E[A.options.attrkey],delete E[A.options.attrkey]),!A.options.charsAsChildren&&A.options.charkey in E&&(C[A.options.charkey]=E[A.options.charkey],delete E[A.options.charkey]),Object.getOwnPropertyNames(E).length>0&&(C[A.options.childkey]=E),E=C;else if(F){F[A.options.childkey]=F[A.options.childkey]||[],R={};for(D in E)h.call(E,D)&&r(R,D,E[D]);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,k,E):(A.options.explicitRoot&&(P=E,E={},r(E,k,P)),A.resultObject=E,A.saxParser.ended=!0,A.emit("end",A.resultObject))}})(this),v=(function(A){return function(p){var y,D;if(D=S[S.length-1],D)return D[g]+=p,A.options.explicitChildren&&A.options.preserveChildrenOrder&&A.options.charsAsChildren&&(A.options.includeWhiteChars||p.replace(/\\n/g,"").trim()!=="")&&(D[A.options.childkey]=D[A.options.childkey]||[],y={"#name":"__text__"},y[g]=p,A.options.normalize&&(y[g]=y[g].replace(/\s{2,}/g," ").trim()),D[A.options.childkey].push(y)),D}})(this),this.saxParser.ontext=v,this.saxParser.oncdata=(function(A){return function(p){var y;if(y=v(p),y)return y.cdata=!0}})(this)},f.prototype.parseString=function(m,g){var v;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(v=S,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw v}else return this.emit("error",v),this.saxParser.errThrown=!0}},f.prototype.parseStringPromise=function(m){return new Promise((function(g){return function(v,S){return g.parseString(m,function(A,p){return A?S(A):v(p)})}})(this))},f})(n),ai.parseString=function(d,f,m){var g,v,S;return m!=null?(typeof m=="function"&&(g=m),typeof f=="object"&&(v=f)):(typeof f=="function"&&(g=f),v={}),S=new ai.Parser(v),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 IN=b(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=Od(),t=ON(),r=FN(),n=fv(),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 kN=b(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.buildXmlElement=kn.writeXML=kn.parseXML=kn.readXML=void 0;var xre=(fe(),ue(le)),Tre=ya(),Tc=xre.__importDefault(IN());async function Fre(t){var e;try{let r=await(0,Tre.readFile)(t,{encoding:"utf-8"});try{return await Tc.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}kn.readXML=Fre;function Ire(t,e){let r=e!==void 0?new Tc.default.Parser({...e}):new Tc.default.Parser,n;return r.parseString(t,(i,s)=>{i||(n=s)}),n}kn.parseXML=Ire;async function kre(t){return new Promise(e=>{let n=new Tc.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}kn.writeXML=kre;function Pre(t,e){return new Tc.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}kn.buildXmlElement=Pre});var LN=b(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 Rre=(fe(),ue(le)),Nre=ya(),hv=require("path"),Fa=Rre.__importDefault(Da()),$re=td(),Lre=mc(),PN=Ad(),jre=kN();function RN(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=RN;async function Bre(t,e){var r;let n=(r=RN(t,e))!==null&&r!==void 0?r:$N(t);return(await Promise.all(n.map(async s=>NN(t,s)))).filter(s=>!!s)}Le.getPlugins=Bre;async function NN(t,e){try{let r=(0,PN.resolveNode)(t.app.rootDir,e,"package.json");r||(0,$re.fatal)(`Unable to find ${Fa.default.strong(`node_modules/${e}`)}.
|
|
195
195
|
Are you sure ${Fa.default.strong(e)} is installed?`);let n=(0,hv.dirname)(r),i=await(0,Nre.readJSON)(r);if(!i)return null;if(i.capacitor)return{id:e,name:dv(e),version:i.version,rootPath:n,repository:i.repository,manifest:i.capacitor};let s=(0,hv.join)(n,"plugin.xml"),o=await(0,jre.readXML)(s);return{id:e,name:dv(e),version:i.version,rootPath:n,repository:i.repository,xml:o.plugin}}catch{}return null}Le.resolvePlugin=NN;function $N(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=$N;function dv(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=dv;function Mre(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 ${Fa.default.strong(e)}:
|
|
196
196
|
`;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${i} for ${Fa.default.strong(e)}, skipped install:
|
|
197
197
|
`;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${i} for ${Fa.default.strong(e)}:
|
|
@@ -227,7 +227,7 @@ To use ${to.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 Rce(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(i){(0,Sp.fatal)(`Parsing ${to.default.strong(e)} failed.
|
|
229
229
|
|
|
230
|
-
${(n=i.stack)!==null&&n!==void 0?n:i}`)}}async function Nce(t){var e;let r=(0,ye.resolve)(t,jt.CONFIG_FILE_NAME_TS);if(await(0,Ar.pathExists)(r))return Pce(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 Rce(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,Cb.tryFn)(Ar.readJSON,i))!==null&&e!==void 0?e:{}}}async function $ce(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:Mce(process.platform)}}async function Lce(t,e,r){var n,i,s,o,a,u,c,l,h,d,f,m,g,v,S,A,p;let y="android",D=(i=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&i!==void 0?i:"android",C=(0,ye.resolve)(t,D),k="app",E=`${k}/src`,R=`${E}/main`,P=`${R}/assets`,F=`${P}/public`,
|
|
230
|
+
${(n=i.stack)!==null&&n!==void 0?n:i}`)}}async function Nce(t){var e;let r=(0,ye.resolve)(t,jt.CONFIG_FILE_NAME_TS);if(await(0,Ar.pathExists)(r))return Pce(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 Rce(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,Cb.tryFn)(Ar.readJSON,i))!==null&&e!==void 0?e:{}}}async function $ce(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:Mce(process.platform)}}async function Lce(t,e,r){var n,i,s,o,a,u,c,l,h,d,f,m,g,v,S,A,p;let y="android",D=(i=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&i!==void 0?i:"android",C=(0,ye.resolve)(t,D),k="app",E=`${k}/src`,R=`${E}/main`,P=`${R}/assets`,F=`${P}/public`,j=`${R}/res`,U=`${k}/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,Oce.parseApkNameFromFlavor)(G),_=`${U}/debug`,T="capacitor-cordova-android-plugins",I=(0,Ma.lazy)(()=>Hce(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=(v=e.android)===null||v===void 0?void 0:v.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:y,minVersion:"23",studioPath:I,platformDir:D,platformDirAbs:C,cordovaPluginsDir:T,cordovaPluginsDirAbs:(0,ye.resolve)(C,T),appDir:k,appDirAbs:(0,ye.resolve)(C,k),srcDir:E,srcDirAbs:(0,ye.resolve)(C,E),srcMainDir:R,srcMainDirAbs:(0,ye.resolve)(C,R),assetsDir:P,assetsDirAbs:(0,ye.resolve)(C,P),webDir:F,webDirAbs:(0,ye.resolve)(C,F),resDir:j,resDirAbs:(0,ye.resolve)(C,j),apkName:L,buildOutputDir:_,buildOutputDirAbs:(0,ye.resolve)(C,_),flavor:G,buildOptions:$}}async function jce(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",v=(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)(v,A),y=`${A}/App`,D=(0,ye.resolve)(v,y),C=`${A}/App.xcodeproj`,k=(0,ye.resolve)(v,C),E=(0,Ma.lazy)(()=>qce(p)),R=(0,Ma.lazy)(()=>Vce(t,v,p)),P=(0,Ma.lazy)(()=>Uce(p,D,k)),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:v,scheme:S,cordovaPluginsDir:F,cordovaPluginsDirAbs:(0,ye.resolve)(v,F),nativeProjectDir:A,nativeProjectDirAbs:p,nativeTargetDir:y,nativeTargetDirAbs:D,nativeXcodeProjDir:C,nativeXcodeProjDirAbs:k,nativeXcodeWorkspaceDir:(0,Ma.lazy)(async()=>(0,ye.relative)(v,await E)),nativeXcodeWorkspaceDirAbs:E,webDir:(0,Ma.lazy)(async()=>(0,ye.relative)(v,await P)),webDirAbs:P,podPath:R,buildOptions:j}}async function Bce(t,e){let r=e,n=(0,ye.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function Mce(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function qce(t){return(0,ye.resolve)(t,"App.xcworkspace")}async function Uce(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 xce.logger.warn(`Using the iOS project root for the ${to.default.strong("public")} directory is deprecated.
|
|
231
231
|
Please follow the Upgrade Guide to move ${to.default.strong("public")} inside the iOS target directory: ${to.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 Hce(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(()=>Sb.__importStar(ap())),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){QB("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 Vce(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,Fce.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 zce(t){return`import type { CapacitorConfig } from '@capacitor/cli';
|
|
232
232
|
|
|
233
233
|
const config: CapacitorConfig = ${(0,Tce.formatJSObject)(t)};
|
|
@@ -235,7 +235,7 @@ const config: CapacitorConfig = ${(0,Tce.formatJSObject)(t)};
|
|
|
235
235
|
export default config;
|
|
236
236
|
`}});function Gce(){try{return xb.default.statSync("/.dockerenv"),!0}catch{return!1}}function Kce(){try{return xb.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Tb(){return Ob===void 0&&(Ob=Gce()||Kce()),Ob}var xb,Ob,r8=Rr(()=>{xb=xe(require("node:fs"),1)});function Ua(){return Fb===void 0&&(Fb=Wce()||Tb()),Fb}var n8,Fb,Wce,Ib=Rr(()=>{n8=xe(require("node:fs"),1);r8();Wce=()=>{try{return n8.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var kb,s8,o8,i8,Zi,Pb=Rr(()=>{kb=xe(require("node:process"),1),s8=xe(require("node:os"),1),o8=xe(require("node:fs"),1);Ib();i8=()=>{if(kb.default.platform!=="linux")return!1;if(s8.default.release().toLowerCase().includes("microsoft"))return!Ua();try{return o8.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Ua():!1}catch{return!1}},Zi=kb.default.env.__IS_WSL_TEST__?i8:i8()});var Rb,Zc,Xce,Yce,Nb,a8=Rr(()=>{Rb=xe(require("node:process"),1),Zc=xe(require("node:fs/promises"),1);Pb();Pb();Xce=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await Zc.default.access(r,Zc.constants.F_OK),n=!0}catch{}if(!n)return t;let i=await Zc.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}})(),Yce=async()=>`${await Xce()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,Nb=async()=>Zi?Yce():`${Rb.default.env.SYSTEMROOT||Rb.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 u8=Rr(()=>{});async function $b(){if(l8.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await Jce("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 c8,l8,f8,Jce,h8=Rr(()=>{c8=require("node:util"),l8=xe(require("node:process"),1),f8=require("node:child_process"),Jce=(0,c8.promisify)(f8.execFile)});async function m8(t,{humanReadableOutput:e=!0,signal:r}={}){if(d8.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],i={};r&&(i.signal=r);let{stdout:s}=await Zce("osascript",["-e",t,n],i);return s.trim()}var d8,p8,Lb,Zce,g8=Rr(()=>{d8=xe(require("node:process"),1),p8=require("node:util"),Lb=require("node:child_process"),Zce=(0,p8.promisify)(Lb.execFile)});async function jb(t){return m8(`tell application "Finder" to set app_path to application file id "${t}" as string
|
|
237
237
|
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var y8=Rr(()=>{g8()});async function Bb(t=Qce){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 Ap(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,i=ele[n];if(!i)throw new Ap(`Unknown browser ID: ${n}`);return i}var D8,w8,Qce,ele,Ap,v8=Rr(()=>{D8=require("node:util"),w8=require("node:child_process"),Qce=(0,D8.promisify)(w8.execFile),ele={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"}},Ap=class extends Error{}});async function Mb(){if(Op.default.platform==="darwin"){let t=await $b();return{name:await jb(t),id:t}}if(Op.default.platform==="linux"){let{stdout:t}=await tle("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:rle(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Op.default.platform==="win32")return Bb();throw new Error("Only macOS, Linux, and Windows are supported")}var b8,Op,E8,tle,rle,_8=Rr(()=>{b8=require("node:util"),Op=xe(require("node:process"),1),E8=require("node:child_process");h8();y8();v8();tle=(0,b8.promisify)(E8.execFile),rle=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Gb={};am(Gb,{apps:()=>es,default:()=>ale,openApp:()=>ole});async function ile(){let t=await Nb(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,r=Hb.Buffer.from(e,"utf16le").toString("base64"),{stdout:n}=await nle(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 O8(t){if(typeof t=="string"||Array.isArray(t))return t;let{[S8]:e}=t;if(!e)throw new Error(`${S8} is not supported`);return e}function Tp({[Ha]:t},{wsl:e}){if(e&&Zi)return O8(e);if(!t)throw new Error(`${Ha} is not supported`);return O8(t)}var Ub,Hb,Vb,x8,T8,zb,xp,ule,nle,qb,C8,Ha,S8,A8,Qc,sle,ole,es,ale,Kb=Rr(()=>{Ub=xe(require("node:process"),1),Hb=require("node:buffer"),Vb=xe(require("node:path"),1),x8=require("node:url"),T8=require("node:util"),zb=xe(require("node:child_process"),1),xp=xe(require("node:fs/promises"),1);a8();u8();_8();Ib();ule={},nle=(0,T8.promisify)(zb.default.execFile),qb=Vb.default.dirname((0,x8.fileURLToPath)(ule.url)),C8=Vb.default.join(qb,"xdg-open"),{platform:Ha,arch:S8}=Ub.default;A8=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(i){r=i}throw r},Qc=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return A8(t.app,a=>Qc({...t,app:a}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return A8(e,a=>Qc({...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 ile():await Mb();if(c.id in a){let l=a[c.id];return e==="browserPrivate"&&r.push(u[l]),Qc({...t,app:{name:es[l],arguments:r}})}throw new Error(`${c.name} is not supported as a default browser`)}let n,i=[],s={};if(Ha==="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(Ha==="win32"||Zi&&!Ua()&&!e){n=await Nb(),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=Hb.Buffer.from(a.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let a=!qb||qb==="/",u=!1;try{await xp.default.access(C8,xp.constants.X_OK),u=!0}catch{}n=Ub.default.versions.electron??(Ha==="android"||a||!u)?"xdg-open":C8}r.length>0&&i.push(...r),t.wait||(s.stdio="ignore",s.detached=!0)}Ha==="darwin"&&r.length>0&&i.push("--args",...r),t.target&&i.push(t.target);let o=zb.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)},sle=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return Qc({...e,target:t})},ole=(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 Qc({...e,app:{name:t,arguments:r}})};es={};Qi(es,"chrome",()=>Tp({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",()=>Tp({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",()=>Tp({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",()=>Tp({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");ale=sle});var Jp=b(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 Zp=b((M_e,MM)=>{"use strict";var BM=Jp();MM.exports=(t,e={})=>{let r=(n,i={})=>{let s=e.escapeInvalid&&BM.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(s||o)&&BM.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 UM=b((q_e,qM)=>{"use strict";qM.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var JM=b((U_e,YM)=>{"use strict";var HM=UM(),co=(t,e,r)=>{if(HM(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(HM(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(co.cache.hasOwnProperty(u))return co.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=XM(t)||XM(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=VM(g,Math.abs(c),d,n),c=d.a=0}return l>=0&&(f=VM(c,l,d,n)),d.negatives=m,d.positives=f,d.result=qle(m,f,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&f.length+m.length>1&&(d.result=`(?:${d.result})`),co.cache[u]=d,d.result};function qle(t,e,r){let n=lE(t,e,"-",!1,r)||[],i=lE(e,t,"",!1,r)||[],s=lE(t,e,"-?",!0,r)||[];return n.concat(s).concat(i).join("|")}function Ule(t,e){let r=1,n=1,i=GM(t,r),s=new Set([e]);for(;t<=i&&i<=e;)s.add(i),r+=1,i=GM(t,r);for(i=KM(e+1,n)-1;t<i&&i<=e;)s.add(i),n+=1,i=KM(e+1,n)-1;return s=[...s],s.sort(zle),s}function Hle(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=Vle(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+=Gle(u,c,r):o++}return o&&(s+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[o],digits:i}}function VM(t,e,r,n){let i=Ule(t,e),s=[],o=t,a;for(let u=0;u<i.length;u++){let c=i[u],l=Hle(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+WM(a.count),o=c+1;continue}r.isPadded&&(h=Kle(c,r,n)),l.string=h+l.pattern+WM(l.count),s.push(l),o=c+1,a=l}return s}function lE(t,e,r,n,i){let s=[];for(let o of t){let{string:a}=o;!n&&!zM(e,"string",a)&&s.push(r+a),n&&zM(e,"string",a)&&s.push(r+a)}return s}function Vle(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function zle(t,e){return t>e?1:e>t?-1:0}function zM(t,e,r){return t.some(n=>n[e]===r)}function GM(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function KM(t,e){return t-t%Math.pow(10,e)}function WM(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function Gle(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function XM(t){return/^-?(0+)\d/.test(t)}function Kle(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}}`}}co.cache={};co.clearCache=()=>co.cache={};YM.exports=co});var dE=b((H_e,i6)=>{"use strict";var Wle=require("util"),QM=JM(),ZM=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Xle=t=>e=>t===!0?Number(e):String(e),fE=t=>typeof t=="number"||typeof t=="string"&&t!=="",cl=t=>Number.isInteger(+t),hE=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},Yle=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,Jle=(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},em=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},Zle=(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=>em(String(a),r)).join("|")),t.negatives.length&&(s=`-(${n}${t.negatives.map(a=>em(String(a),r)).join("|")})`),i&&s?o=`${i}|${s}`:o=i||s,e.wrap?`(${n}${o})`:o},e6=(t,e,r,n)=>{if(r)return QM(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let s=String.fromCharCode(e);return`[${i}-${s}]`},t6=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return QM(t,e,r)},r6=(...t)=>new RangeError("Invalid range arguments: "+Wle.inspect(...t)),n6=(t,e,r)=>{if(r.strictRanges===!0)throw r6([t,e]);return[]},Qle=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},efe=(t,e,r=1,n={})=>{let i=Number(t),s=Number(e);if(!Number.isInteger(i)||!Number.isInteger(s)){if(n.strictRanges===!0)throw r6([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=hE(a)||hE(u)||hE(c),h=l?Math.max(a.length,u.length,c.length):0,d=l===!1&&Yle(t,e,n)===!1,f=n.transform||Xle(d);if(n.toRegex&&r===1)return e6(em(t,h),em(e,h),!0,n);let m={negatives:[],positives:[]},g=A=>m[A<0?"negatives":"positives"].push(Math.abs(A)),v=[],S=0;for(;o?i>=s:i<=s;)n.toRegex===!0&&r>1?g(i):v.push(Jle(f(i,S),h,d)),i=o?i-r:i+r,S++;return n.toRegex===!0?r>1?Zle(m,n,h):t6(v,null,{wrap:!1,...n}):v},tfe=(t,e,r=1,n={})=>{if(!cl(t)&&t.length>1||!cl(e)&&e.length>1)return n6(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 e6(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?t6(l,null,{wrap:!1,options:n}):l},Qp=(t,e,r,n={})=>{if(e==null&&fE(t))return[t];if(!fE(t)||!fE(e))return n6(t,e,n);if(typeof r=="function")return Qp(t,e,1,{transform:r});if(ZM(r))return Qp(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,cl(r)?cl(t)&&cl(e)?efe(t,e,r,i):tfe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!ZM(r)?Qle(r,i):Qp(t,e,1,r)};i6.exports=Qp});var a6=b((V_e,o6)=>{"use strict";var rfe=dE(),s6=Jp(),nfe=(t,e={})=>{let r=(n,i={})=>{let s=s6.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=s6.reduce(n.nodes),h=rfe(...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)};o6.exports=nfe});var l6=b((z_e,c6)=>{"use strict";var ife=dE(),u6=Zp(),ru=Jp(),lo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?ru.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let s of i)n.push(lo(s,e,r));else for(let s of e)r===!0&&typeof s=="string"&&(s=`{${s}}`),n.push(Array.isArray(s)?lo(i,s,r):i+s);return ru.flatten(n)},sfe=(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(lo(a.pop(),u6(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(lo(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let h=ru.reduce(i.nodes);if(ru.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=ife(...h,e);d.length===0&&(d=u6(i,e)),a.push(lo(a.pop(),d)),i.nodes=[];return}let u=ru.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(lo(a.pop(),c,u));continue}if(d.value&&d.type!=="open"){c.push(lo(c.pop(),d.value));continue}d.nodes&&n(d,i)}return c};return ru.flatten(n(t))};c6.exports=sfe});var h6=b((G_e,f6)=>{"use strict";f6.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 y6=b((K_e,g6)=>{"use strict";var ofe=Zp(),{MAX_LENGTH:d6,CHAR_BACKSLASH:pE,CHAR_BACKTICK:afe,CHAR_COMMA:ufe,CHAR_DOT:cfe,CHAR_LEFT_PARENTHESES:lfe,CHAR_RIGHT_PARENTHESES:ffe,CHAR_LEFT_CURLY_BRACE:hfe,CHAR_RIGHT_CURLY_BRACE:dfe,CHAR_LEFT_SQUARE_BRACKET:p6,CHAR_RIGHT_SQUARE_BRACKET:m6,CHAR_DOUBLE_QUOTE:pfe,CHAR_SINGLE_QUOTE:mfe,CHAR_NO_BREAK_SPACE:gfe,CHAR_ZERO_WIDTH_NOBREAK_SPACE:yfe}=h6(),Dfe=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(d6,r.maxLength):d6;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===yfe||d===gfe)){if(d===pE){m({type:"text",value:(e.keepEscaping?d:"")+f()});continue}if(d===m6){m({type:"text",value:"\\"+d});continue}if(d===p6){u++;let g;for(;l<c&&(g=f());){if(d+=g,g===p6){u++;continue}if(g===pE){d+=f();continue}if(g===m6&&(u--,u===0))break}m({type:"text",value:d});continue}if(d===lfe){o=m({type:"paren",nodes:[]}),s.push(o),m({type:"text",value:d});continue}if(d===ffe){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===pfe||d===mfe||d===afe){let g=d,v;for(e.keepQuotes!==!0&&(d="");l<c&&(v=f());){if(v===pE){d+=v+f();continue}if(v===g){e.keepQuotes===!0&&(d+=v);break}d+=v}m({type:"text",value:d});continue}if(d===hfe){h++;let v={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(v),s.push(o),m({type:"open",value:d});continue}if(d===dfe){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===ufe&&h>0){if(o.ranges>0){o.ranges=0;let g=o.nodes.shift();o.nodes=[g,{type:"text",value:ofe(o)}]}m({type:"comma",value:d}),o.commas++;continue}if(d===cfe&&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 v=g[g.length-1];v.value+=a.value+d,a=v,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],v=g.nodes.indexOf(o);g.nodes.splice(v,1,...o.nodes)}while(s.length>0);return m({type:"eos"}),i};g6.exports=Dfe});var v6=b((W_e,w6)=>{"use strict";var D6=Zp(),wfe=a6(),vfe=l6(),bfe=y6(),kr=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=kr.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(kr.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};kr.parse=(t,e={})=>bfe(t,e);kr.stringify=(t,e={})=>D6(typeof t=="string"?kr.parse(t,e):t,e);kr.compile=(t,e={})=>(typeof t=="string"&&(t=kr.parse(t,e)),wfe(t,e));kr.expand=(t,e={})=>{typeof t=="string"&&(t=kr.parse(t,e));let r=vfe(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};kr.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?kr.compile(t,e):kr.expand(t,e);w6.exports=kr});var ll=b((X_e,S6)=>{"use strict";var Efe=require("path"),Bn="\\\\/",b6=`[^${Bn}]`,yi="\\.",_fe="\\+",Cfe="\\?",tm="\\/",Sfe="(?=.)",E6="[^/]",mE=`(?:${tm}|$)`,_6=`(?:^|${tm})`,gE=`${yi}{1,2}${mE}`,Afe=`(?!${yi})`,Ofe=`(?!${_6}${gE})`,xfe=`(?!${yi}{0,1}${mE})`,Tfe=`(?!${gE})`,Ffe=`[^.${tm}]`,Ife=`${E6}*?`,C6={DOT_LITERAL:yi,PLUS_LITERAL:_fe,QMARK_LITERAL:Cfe,SLASH_LITERAL:tm,ONE_CHAR:Sfe,QMARK:E6,END_ANCHOR:mE,DOTS_SLASH:gE,NO_DOT:Afe,NO_DOTS:Ofe,NO_DOT_SLASH:xfe,NO_DOTS_SLASH:Tfe,QMARK_NO_DOT:Ffe,STAR:Ife,START_ANCHOR:_6},kfe={...C6,SLASH_LITERAL:`[${Bn}]`,QMARK:b6,STAR:`${b6}*?`,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}]|$)`},Pfe={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"};S6.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Pfe,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:Efe.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?kfe:C6}}});var fl=b(Or=>{"use strict";var Rfe=require("path"),Nfe=process.platform==="win32",{REGEX_BACKSLASH:$fe,REGEX_REMOVE_BACKSLASH:Lfe,REGEX_SPECIAL_CHARS:jfe,REGEX_SPECIAL_CHARS_GLOBAL:Bfe}=ll();Or.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Or.hasRegexChars=t=>jfe.test(t);Or.isRegexChar=t=>t.length===1&&Or.hasRegexChars(t);Or.escapeRegex=t=>t.replace(Bfe,"\\$1");Or.toPosixSlashes=t=>t.replace($fe,"/");Or.removeBackslashes=t=>t.replace(Lfe,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:Nfe===!0||Rfe.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 P6=b((J_e,k6)=>{"use strict";var A6=fl(),{CHAR_ASTERISK:yE,CHAR_AT:Mfe,CHAR_BACKWARD_SLASH:hl,CHAR_COMMA:qfe,CHAR_DOT:DE,CHAR_EXCLAMATION_MARK:wE,CHAR_FORWARD_SLASH:I6,CHAR_LEFT_CURLY_BRACE:vE,CHAR_LEFT_PARENTHESES:bE,CHAR_LEFT_SQUARE_BRACKET:Ufe,CHAR_PLUS:Hfe,CHAR_QUESTION_MARK:O6,CHAR_RIGHT_CURLY_BRACE:Vfe,CHAR_RIGHT_PARENTHESES:x6,CHAR_RIGHT_SQUARE_BRACKET:zfe}=ll(),T6=t=>t===I6||t===hl,F6=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Gfe=(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,v=!1,S=!1,A=!1,p=!1,y=!1,D=!1,C=0,k,E,R={value:"",depth:0,isGlob:!1},P=()=>c>=n,F=()=>u.charCodeAt(c+1),B=()=>(k=E,u.charCodeAt(++c));for(;c<n;){E=B();let T;if(E===hl){A=R.backslashes=!0,E=B(),E===vE&&(S=!0);continue}if(S===!0||E===vE){for(C++;P()!==!0&&(E=B());){if(E===hl){A=R.backslashes=!0,B();continue}if(E===vE){C++;continue}if(S!==!0&&E===DE&&(E=B())===DE){if(d=R.isBrace=!0,m=R.isGlob=!0,D=!0,i===!0)continue;break}if(S!==!0&&E===qfe){if(d=R.isBrace=!0,m=R.isGlob=!0,D=!0,i===!0)continue;break}if(E===Vfe&&(C--,C===0)){S=!1,d=R.isBrace=!0,D=!0;break}}if(i===!0)continue;break}if(E===I6){if(s.push(c),o.push(R),R={value:"",depth:0,isGlob:!1},D===!0)continue;if(k===DE&&c===l+1){l+=2;continue}h=c+1;continue}if(r.noext!==!0&&(E===Hfe||E===Mfe||E===yE||E===O6||E===wE)===!0&&F()===bE){if(m=R.isGlob=!0,g=R.isExtglob=!0,D=!0,E===wE&&c===l&&(y=!0),i===!0){for(;P()!==!0&&(E=B());){if(E===hl){A=R.backslashes=!0,E=B();continue}if(E===x6){m=R.isGlob=!0,D=!0;break}}continue}break}if(E===yE){if(k===yE&&(v=R.isGlobstar=!0),m=R.isGlob=!0,D=!0,i===!0)continue;break}if(E===O6){if(m=R.isGlob=!0,D=!0,i===!0)continue;break}if(E===Ufe){for(;P()!==!0&&(T=B());){if(T===hl){A=R.backslashes=!0,B();continue}if(T===zfe){f=R.isBracket=!0,m=R.isGlob=!0,D=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&E===wE&&c===l){p=R.negated=!0,l++;continue}if(r.noparen!==!0&&E===bE){if(m=R.isGlob=!0,i===!0){for(;P()!==!0&&(E=B());){if(E===bE){A=R.backslashes=!0,E=B();continue}if(E===x6){D=!0;break}}continue}break}if(m===!0){if(D=!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&&T6(U.charCodeAt(U.length-1))&&(U=U.slice(0,-1)),r.unescape===!0&&(L&&(L=A6.removeBackslashes(L)),U&&A===!0&&(U=A6.removeBackslashes(U)));let _={prefix:G,input:t,start:l,base:U,glob:L,isBrace:d,isBracket:f,isGlob:m,isExtglob:g,isGlobstar:v,negated:p,negatedExtglob:y};if(r.tokens===!0&&(_.maxDepth=0,T6(E)||o.push(R),_.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],j=t.slice($,M);r.tokens&&(I===0&&l!==0?(o[I].isPrefix=!0,o[I].value=G):o[I].value=j,F6(o[I]),_.maxDepth+=o[I].depth),(I!==0||j!=="")&&a.push(j),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,F6(o[o.length-1]),_.maxDepth+=o[o.length-1].depth)}_.slashes=s,_.parts=a}return _};k6.exports=Gfe});var $6=b((Z_e,N6)=>{"use strict";var rm=ll(),Pr=fl(),{MAX_LENGTH:nm,POSIX_REGEX_SOURCE:Kfe,REGEX_NON_SPECIAL_CHARS:Wfe,REGEX_SPECIAL_CHARS_BACKREF:Xfe,REPLACEMENTS:R6}=rm,Yfe=(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=>Pr.escapeRegex(i)).join("..")}return r},nu=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,EE=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=R6[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(nm,r.maxLength):nm,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=Pr.isWindows(e),c=rm.globChars(u),l=rm.extglobChars(c),{DOT_LITERAL:h,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:m,DOTS_SLASH:g,NO_DOT:v,NO_DOT_SLASH:S,NO_DOTS_SLASH:A,QMARK:p,QMARK_NO_DOT:y,STAR:D,START_ANCHOR:C}=c,k=N=>`(${a}(?:(?!${C}${N.dot?g:h}).)*?)`,E=r.dot?"":v,R=r.dot?p:y,P=r.bash===!0?k(r):D;r.capture&&(P=`(${P})`),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=Pr.removePrefix(t,F),i=t.length;let B=[],U=[],G=[],L=s,_,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),j=(N="",re=0)=>{F.consumed+=N,F.index+=re},K=N=>{F.output+=N.output!=null?N.output:N.value,j(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 re=F.braces>0&&(N.type==="comma"||N.type==="brace"),z=N.extglob===!0||B.length&&(N.type==="pipe"||N.type==="paren");N.type!=="slash"&&N.type!=="paren"&&!re&&!z&&(F.output=F.output.slice(0,-L.output.length),L.type="star",L.value="*",L.output=P,F.output+=L.output)}if(B.length&&N.type!=="paren"&&(B[B.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,re)=>{let z={...l[re],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:re,output:F.output?"":m}),x({type:"paren",extglob:!0,value:$(),output:ie}),B.push(z)},H=N=>{let re=N.close+(r.capture?")":""),z;if(N.type==="negate"){let ie=P;if(N.inner&&N.inner.length>1&&N.inner.includes("/")&&(ie=k(r)),(ie!==P||T()||/^\)+$/.test(M()))&&(re=N.close=`)$))${ie}`),N.inner.includes("*")&&(z=M())&&/^\.[^\\/.]+$/.test(z)){let we=EE(z,{...e,fastpaths:!1}).output;re=N.close=`)${we})${ie})`}N.prev.type==="bos"&&(F.negatedExtglob=!0)}x({type:"paren",extglob:!0,value:_,output:re}),ae("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let N=!1,re=t.replace(Xfe,(z,ie,we,Oe,Me,wt)=>Oe==="\\"?(N=!0,z):Oe==="?"?ie?ie+Oe+(Me?p.repeat(Me.length):""):wt===0?R+(Me?p.repeat(Me.length):""):p.repeat(we.length):Oe==="."?h.repeat(we.length):Oe==="*"?ie?ie+Oe+(Me?P:""):P:ie?z:`\\${z}`);return N===!0&&(r.unescape===!0?re=re.replace(/\\/g,""):re=re.replace(/\\+/g,z=>z.length%2===0?"\\\\":z?"\\":"")),re===t&&r.contains===!0?(F.output=t,F):(F.output=Pr.wrapOutput(re,F,e),F)}for(;!T();){if(_=$(),_==="\0")continue;if(_==="\\"){let z=I();if(z==="/"&&r.bash!==!0||z==="."||z===";")continue;if(!z){_+="\\",x({type:"text",value:_});continue}let ie=/^\\+/.exec(M()),we=0;if(ie&&ie[0].length>2&&(we=ie[0].length,F.index+=we,we%2!==0&&(_+="\\")),r.unescape===!0?_=$():_+=$(),F.brackets===0){x({type:"text",value:_});continue}}if(F.brackets>0&&(_!=="]"||L.value==="["||L.value==="[^")){if(r.posix!==!1&&_===":"){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),Oe=L.value.slice(ie+2),Me=Kfe[Oe];if(Me){L.value=we+Me,F.backtrack=!0,$(),!s.output&&o.indexOf(L)===1&&(s.output=m);continue}}}(_==="["&&I()!==":"||_==="-"&&I()==="]")&&(_=`\\${_}`),_==="]"&&(L.value==="["||L.value==="[^")&&(_=`\\${_}`),r.posix===!0&&_==="!"&&L.value==="["&&(_="^"),L.value+=_,K({value:_});continue}if(F.quotes===1&&_!=='"'){_=Pr.escapeRegex(_),L.value+=_,K({value:_});continue}if(_==='"'){F.quotes=F.quotes===1?0:1,r.keepQuotes===!0&&x({type:"text",value:_});continue}if(_==="("){V("parens"),x({type:"paren",value:_});continue}if(_===")"){if(F.parens===0&&r.strictBrackets===!0)throw new SyntaxError(nu("opening","("));let z=B[B.length-1];if(z&&F.parens===z.parens+1){H(B.pop());continue}x({type:"paren",value:_,output:F.parens?")":"\\)"}),ae("parens");continue}if(_==="["){if(r.nobracket===!0||!M().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(nu("closing","]"));_=`\\${_}`}else V("brackets");x({type:"bracket",value:_});continue}if(_==="]"){if(r.nobracket===!0||L&&L.type==="bracket"&&L.value.length===1){x({type:"text",value:_,output:`\\${_}`});continue}if(F.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(nu("opening","["));x({type:"text",value:_,output:`\\${_}`});continue}ae("brackets");let z=L.value.slice(1);if(L.posix!==!0&&z[0]==="^"&&!z.includes("/")&&(_=`/${_}`),L.value+=_,K({value:_}),r.literalBrackets===!1||Pr.hasRegexChars(z))continue;let ie=Pr.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(_==="{"&&r.nobrace!==!0){V("braces");let z={type:"brace",value:_,output:"(",outputIndex:F.output.length,tokensIndex:F.tokens.length};U.push(z),x(z);continue}if(_==="}"){let z=U[U.length-1];if(r.nobrace===!0||!z){x({type:"text",value:_,output:_});continue}let ie=")";if(z.dots===!0){let we=o.slice(),Oe=[];for(let Me=we.length-1;Me>=0&&(o.pop(),we[Me].type!=="brace");Me--)we[Me].type!=="dots"&&Oe.unshift(we[Me].value);ie=Yfe(Oe,r),F.backtrack=!0}if(z.comma!==!0&&z.dots!==!0){let we=F.output.slice(0,z.outputIndex),Oe=F.tokens.slice(z.tokensIndex);z.value=z.output="\\{",_=ie="\\}",F.output=we;for(let Me of Oe)F.output+=Me.output||Me.value}x({type:"brace",value:_,output:ie}),ae("braces"),U.pop();continue}if(_==="|"){B.length>0&&B[B.length-1].conditions++,x({type:"text",value:_});continue}if(_===","){let z=_,ie=U[U.length-1];ie&&G[G.length-1]==="braces"&&(ie.comma=!0,z="|"),x({type:"comma",value:_,output:z});continue}if(_==="/"){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:_,output:f});continue}if(_==="."){if(F.braces>0&&L.type==="dot"){L.value==="."&&(L.output=h);let z=U[U.length-1];L.type="dots",L.output+=_,L.value+=_,z.dots=!0;continue}if(F.braces+F.parens===0&&L.type!=="bos"&&L.type!=="slash"){x({type:"text",value:_,output:h});continue}x({type:"dot",value:_,output:h});continue}if(_==="?"){if(!(L&&L.value==="(")&&r.noextglob!==!0&&I()==="("&&I(2)!=="?"){O("qmark",_);continue}if(L&&L.type==="paren"){let ie=I(),we=_;if(ie==="<"&&!Pr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(L.value==="("&&!/[!=<:]/.test(ie)||ie==="<"&&!/<([!=]|\w+>)/.test(M()))&&(we=`\\${_}`),x({type:"text",value:_,output:we});continue}if(r.dot!==!0&&(L.type==="slash"||L.type==="bos")){x({type:"qmark",value:_,output:y});continue}x({type:"qmark",value:_,output:p});continue}if(_==="!"){if(r.noextglob!==!0&&I()==="("&&(I(2)!=="?"||!/[!=<:]/.test(I(3)))){O("negate",_);continue}if(r.nonegate!==!0&&F.index===0){q();continue}}if(_==="+"){if(r.noextglob!==!0&&I()==="("&&I(2)!=="?"){O("plus",_);continue}if(L&&L.value==="("||r.regex===!1){x({type:"plus",value:_,output:d});continue}if(L&&(L.type==="bracket"||L.type==="paren"||L.type==="brace")||F.parens>0){x({type:"plus",value:_});continue}x({type:"plus",value:d});continue}if(_==="@"){if(r.noextglob!==!0&&I()==="("&&I(2)!=="?"){x({type:"at",extglob:!0,value:_,output:""});continue}x({type:"text",value:_});continue}if(_!=="*"){(_==="$"||_==="^")&&(_=`\\${_}`);let z=Wfe.exec(M());z&&(_+=z[0],F.index+=z[0].length),x({type:"text",value:_});continue}if(L&&(L.type==="globstar"||L.star===!0)){L.type="star",L.star=!0,L.value+=_,L.output=P,F.backtrack=!0,F.globstar=!0,j(_);continue}let N=M();if(r.noextglob!==!0&&/^\([^?]/.test(N)){O("star",_);continue}if(L.type==="star"){if(r.noglobstar===!0){j(_);continue}let z=L.prev,ie=z.prev,we=z.type==="slash"||z.type==="bos",Oe=ie&&(ie.type==="star"||ie.type==="globstar");if(r.bash===!0&&(!we||N[0]&&N[0]!=="/")){x({type:"star",value:_,output:""});continue}let Me=F.braces>0&&(z.type==="comma"||z.type==="brace"),wt=B.length&&(z.type==="pipe"||z.type==="paren");if(!we&&z.type!=="paren"&&!Me&&!wt){x({type:"star",value:_,output:""});continue}for(;N.slice(0,3)==="/**";){let dr=t[F.index+4];if(dr&&dr!=="/")break;N=N.slice(3),j("/**",3)}if(z.type==="bos"&&T()){L.type="globstar",L.value+=_,L.output=k(r),F.output=L.output,F.globstar=!0,j(_);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&!Oe&&T()){F.output=F.output.slice(0,-(z.output+L.output).length),z.output=`(?:${z.output}`,L.type="globstar",L.output=k(r)+(r.strictSlashes?")":"|$)"),L.value+=_,F.globstar=!0,F.output+=z.output+L.output,j(_);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=`${k(r)}${f}|${f}${dr})`,L.value+=_,F.output+=z.output+L.output,F.globstar=!0,j(_+$()),x({type:"slash",value:"/",output:""});continue}if(z.type==="bos"&&N[0]==="/"){L.type="globstar",L.value+=_,L.output=`(?:^|${f}|${k(r)}${f})`,F.output=L.output,F.globstar=!0,j(_+$()),x({type:"slash",value:"/",output:""});continue}F.output=F.output.slice(0,-L.output.length),L.type="globstar",L.output=k(r),L.value+=_,F.output+=L.output,F.globstar=!0,j(_);continue}let re={type:"star",value:_,output:P};if(r.bash===!0){re.output=".*?",(L.type==="bos"||L.type==="slash")&&(re.output=E+re.output),x(re);continue}if(L&&(L.type==="bracket"||L.type==="paren")&&r.regex===!0){re.output=_,x(re);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(re)}for(;F.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(nu("closing","]"));F.output=Pr.escapeLast(F.output,"["),ae("brackets")}for(;F.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(nu("closing",")"));F.output=Pr.escapeLast(F.output,"("),ae("parens")}for(;F.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(nu("closing","}"));F.output=Pr.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};EE.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(nm,r.maxLength):nm,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=R6[t]||t;let s=Pr.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}=rm.globChars(s),g=r.dot?h:l,v=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}).)*?)`,D=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}${v}${p}`;case"**":return g+y(r);case"**/*":return`(?:${g}${y(r)}${a})?${v}${u}${p}`;case"**/*.*":return`(?:${g}${y(r)}${a})?${v}${p}${o}${u}${p}`;case"**/.*":return`(?:${g}${y(r)}${a})?${o}${u}${p}`;default:{let R=/^(.*?)\.(\w+)$/.exec(E);if(!R)return;let P=D(R[1]);return P?P+o+R[2]:void 0}}},C=Pr.removePrefix(t,A),k=D(C);return k&&r.strictSlashes!==!0&&(k+=`${a}?`),k};N6.exports=EE});var j6=b((Q_e,L6)=>{"use strict";var Jfe=require("path"),Zfe=P6(),_E=$6(),CE=fl(),Qfe=ll(),ehe=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=ehe(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=CE.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?CE.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=CE.isWindows(r))=>(e instanceof RegExp?e:_t.makeRe(e,r)).test(Jfe.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)):_E(t,{...e,fastpaths:!1});_t.scan=(t,e)=>Zfe(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=_E.fastpaths(t,e)),i.output||(i=_E(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=Qfe;L6.exports=_t});var M6=b((eCe,B6)=>{"use strict";B6.exports=j6()});var G6=b((tCe,z6)=>{"use strict";var U6=require("util"),H6=v6(),Mn=M6(),SE=fl(),q6=t=>t===""||t==="./",V6=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: "${U6.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>et.contains(t,n,r));if(typeof e=="string"){if(q6(t)||q6(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(!SE.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: "${U6.inspect(t)}"`);return[].concat(e).every(n=>Mn(n,r)(t))};et.capture=(t,e,r)=>{let n=SE.isWindows(r),s=Mn.makeRe(String(t),{...r,capture:!0}).exec(n?SE.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 H6(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||!V6(t)?[t]:H6(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=V6;z6.exports=et});var Vhe={};am(Vhe,{CapgoSDK:()=>st,addApp:()=>Bhe,addChannel:()=>qhe,addOrganization:()=>$he,checkBundleCompatibility:()=>She,createSupabaseClient:()=>pe,decryptBundle:()=>Ohe,deleteLegacyEncryptionKey:()=>Ihe,deleteOrganization:()=>jhe,doctor:()=>Che,encryptBundle:()=>Ahe,generateEncryptionKeys:()=>The,getAccountId:()=>Rhe,getCapacitorConfig:()=>Hhe,getCurrentBundle:()=>khe,getStats:()=>Uhe,listBundles:()=>Mhe,listOrganizations:()=>Nhe,login:()=>_he,saveEncryptionKey:()=>Fhe,updateAppSetting:()=>Phe,updateOrganization:()=>Lhe,uploadBundle:()=>Ehe,zipBundle:()=>xhe});module.exports=ue(Vhe);var Ut=xe(Ye(),1),mo=require("node:process"),Di=xe(require("node:readline"),1),dm=xe(require("node:readline"),1),ME=require("node:stream"),qE=xe(lm(),1);function Nq({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 $q=Nq();function UE(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace($q,"")}function HE(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var VE={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}})(VE);var Lq=VE.exports,jq=HE(Lq),Bq=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},Mq=HE(Bq);function su(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=UE(t),t.length===0))return 0;t=t.replace(Mq()," ");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(jq.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var fm=10,PE=(t=0)=>e=>`\x1B[${e+t}m`,RE=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,NE=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,tt={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(tt.modifier);var qq=Object.keys(tt.color),Uq=Object.keys(tt.bgColor);[...qq,...Uq];function Hq(){let t=new Map;for(let[e,r]of Object.entries(tt)){for(let[n,i]of Object.entries(r))tt[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=tt[n],t.set(i[0],i[1]);Object.defineProperty(tt,e,{value:r,enumerable:!1})}return Object.defineProperty(tt,"codes",{value:t,enumerable:!1}),tt.color.close="\x1B[39m",tt.bgColor.close="\x1B[49m",tt.color.ansi=PE(),tt.color.ansi256=RE(),tt.color.ansi16m=NE(),tt.bgColor.ansi=PE(fm),tt.bgColor.ansi256=RE(fm),tt.bgColor.ansi16m=NE(fm),Object.defineProperties(tt,{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=>tt.rgbToAnsi256(...tt.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)=>tt.ansi256ToAnsi(tt.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>tt.ansi256ToAnsi(tt.hexToAnsi256(e)),enumerable:!1}}),tt}var Vq=Hq(),El=new Set(["\x1B","\x9B"]),zq=39,mm="\x07",zE="[",Gq="]",GE="m",gm=`${Gq}8;;`,$E=t=>`${El.values().next().value}${zE}${t}${GE}`,LE=t=>`${El.values().next().value}${gm}${t}${mm}`,Kq=t=>t.split(" ").map(e=>su(e)),hm=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=su(UE(t[t.length-1]));for(let[a,u]of n.entries()){let c=su(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),El.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith(gm)),i){s?u===mm&&(i=!1,s=!1):u===GE&&(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())},Wq=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(su(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},Xq=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,s,o=Kq(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let h=su(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(""),hm(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){hm(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){hm(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>Wq(c)));let u=[...a.join(`
|
|
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 y6=b((K_e,g6)=>{"use strict";var ofe=Zp(),{MAX_LENGTH:d6,CHAR_BACKSLASH:pE,CHAR_BACKTICK:afe,CHAR_COMMA:ufe,CHAR_DOT:cfe,CHAR_LEFT_PARENTHESES:lfe,CHAR_RIGHT_PARENTHESES:ffe,CHAR_LEFT_CURLY_BRACE:hfe,CHAR_RIGHT_CURLY_BRACE:dfe,CHAR_LEFT_SQUARE_BRACKET:p6,CHAR_RIGHT_SQUARE_BRACKET:m6,CHAR_DOUBLE_QUOTE:pfe,CHAR_SINGLE_QUOTE:mfe,CHAR_NO_BREAK_SPACE:gfe,CHAR_ZERO_WIDTH_NOBREAK_SPACE:yfe}=h6(),Dfe=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(d6,r.maxLength):d6;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===yfe||d===gfe)){if(d===pE){m({type:"text",value:(e.keepEscaping?d:"")+f()});continue}if(d===m6){m({type:"text",value:"\\"+d});continue}if(d===p6){u++;let g;for(;l<c&&(g=f());){if(d+=g,g===p6){u++;continue}if(g===pE){d+=f();continue}if(g===m6&&(u--,u===0))break}m({type:"text",value:d});continue}if(d===lfe){o=m({type:"paren",nodes:[]}),s.push(o),m({type:"text",value:d});continue}if(d===ffe){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===pfe||d===mfe||d===afe){let g=d,v;for(e.keepQuotes!==!0&&(d="");l<c&&(v=f());){if(v===pE){d+=v+f();continue}if(v===g){e.keepQuotes===!0&&(d+=v);break}d+=v}m({type:"text",value:d});continue}if(d===hfe){h++;let v={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(v),s.push(o),m({type:"open",value:d});continue}if(d===dfe){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===ufe&&h>0){if(o.ranges>0){o.ranges=0;let g=o.nodes.shift();o.nodes=[g,{type:"text",value:ofe(o)}]}m({type:"comma",value:d}),o.commas++;continue}if(d===cfe&&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 v=g[g.length-1];v.value+=a.value+d,a=v,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],v=g.nodes.indexOf(o);g.nodes.splice(v,1,...o.nodes)}while(s.length>0);return m({type:"eos"}),i};g6.exports=Dfe});var v6=b((W_e,w6)=>{"use strict";var D6=Zp(),wfe=a6(),vfe=l6(),bfe=y6(),kr=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=kr.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(kr.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};kr.parse=(t,e={})=>bfe(t,e);kr.stringify=(t,e={})=>D6(typeof t=="string"?kr.parse(t,e):t,e);kr.compile=(t,e={})=>(typeof t=="string"&&(t=kr.parse(t,e)),wfe(t,e));kr.expand=(t,e={})=>{typeof t=="string"&&(t=kr.parse(t,e));let r=vfe(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};kr.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?kr.compile(t,e):kr.expand(t,e);w6.exports=kr});var ll=b((X_e,S6)=>{"use strict";var Efe=require("path"),Bn="\\\\/",b6=`[^${Bn}]`,yi="\\.",_fe="\\+",Cfe="\\?",tm="\\/",Sfe="(?=.)",E6="[^/]",mE=`(?:${tm}|$)`,_6=`(?:^|${tm})`,gE=`${yi}{1,2}${mE}`,Afe=`(?!${yi})`,Ofe=`(?!${_6}${gE})`,xfe=`(?!${yi}{0,1}${mE})`,Tfe=`(?!${gE})`,Ffe=`[^.${tm}]`,Ife=`${E6}*?`,C6={DOT_LITERAL:yi,PLUS_LITERAL:_fe,QMARK_LITERAL:Cfe,SLASH_LITERAL:tm,ONE_CHAR:Sfe,QMARK:E6,END_ANCHOR:mE,DOTS_SLASH:gE,NO_DOT:Afe,NO_DOTS:Ofe,NO_DOT_SLASH:xfe,NO_DOTS_SLASH:Tfe,QMARK_NO_DOT:Ffe,STAR:Ife,START_ANCHOR:_6},kfe={...C6,SLASH_LITERAL:`[${Bn}]`,QMARK:b6,STAR:`${b6}*?`,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}]|$)`},Pfe={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"};S6.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Pfe,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:Efe.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?kfe:C6}}});var fl=b(Or=>{"use strict";var Rfe=require("path"),Nfe=process.platform==="win32",{REGEX_BACKSLASH:$fe,REGEX_REMOVE_BACKSLASH:Lfe,REGEX_SPECIAL_CHARS:jfe,REGEX_SPECIAL_CHARS_GLOBAL:Bfe}=ll();Or.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Or.hasRegexChars=t=>jfe.test(t);Or.isRegexChar=t=>t.length===1&&Or.hasRegexChars(t);Or.escapeRegex=t=>t.replace(Bfe,"\\$1");Or.toPosixSlashes=t=>t.replace($fe,"/");Or.removeBackslashes=t=>t.replace(Lfe,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:Nfe===!0||Rfe.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 P6=b((J_e,k6)=>{"use strict";var A6=fl(),{CHAR_ASTERISK:yE,CHAR_AT:Mfe,CHAR_BACKWARD_SLASH:hl,CHAR_COMMA:qfe,CHAR_DOT:DE,CHAR_EXCLAMATION_MARK:wE,CHAR_FORWARD_SLASH:I6,CHAR_LEFT_CURLY_BRACE:vE,CHAR_LEFT_PARENTHESES:bE,CHAR_LEFT_SQUARE_BRACKET:Ufe,CHAR_PLUS:Hfe,CHAR_QUESTION_MARK:O6,CHAR_RIGHT_CURLY_BRACE:Vfe,CHAR_RIGHT_PARENTHESES:x6,CHAR_RIGHT_SQUARE_BRACKET:zfe}=ll(),T6=t=>t===I6||t===hl,F6=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Gfe=(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,v=!1,S=!1,A=!1,p=!1,y=!1,D=!1,C=0,k,E,R={value:"",depth:0,isGlob:!1},P=()=>c>=n,F=()=>u.charCodeAt(c+1),j=()=>(k=E,u.charCodeAt(++c));for(;c<n;){E=j();let T;if(E===hl){A=R.backslashes=!0,E=j(),E===vE&&(S=!0);continue}if(S===!0||E===vE){for(C++;P()!==!0&&(E=j());){if(E===hl){A=R.backslashes=!0,j();continue}if(E===vE){C++;continue}if(S!==!0&&E===DE&&(E=j())===DE){if(d=R.isBrace=!0,m=R.isGlob=!0,D=!0,i===!0)continue;break}if(S!==!0&&E===qfe){if(d=R.isBrace=!0,m=R.isGlob=!0,D=!0,i===!0)continue;break}if(E===Vfe&&(C--,C===0)){S=!1,d=R.isBrace=!0,D=!0;break}}if(i===!0)continue;break}if(E===I6){if(s.push(c),o.push(R),R={value:"",depth:0,isGlob:!1},D===!0)continue;if(k===DE&&c===l+1){l+=2;continue}h=c+1;continue}if(r.noext!==!0&&(E===Hfe||E===Mfe||E===yE||E===O6||E===wE)===!0&&F()===bE){if(m=R.isGlob=!0,g=R.isExtglob=!0,D=!0,E===wE&&c===l&&(y=!0),i===!0){for(;P()!==!0&&(E=j());){if(E===hl){A=R.backslashes=!0,E=j();continue}if(E===x6){m=R.isGlob=!0,D=!0;break}}continue}break}if(E===yE){if(k===yE&&(v=R.isGlobstar=!0),m=R.isGlob=!0,D=!0,i===!0)continue;break}if(E===O6){if(m=R.isGlob=!0,D=!0,i===!0)continue;break}if(E===Ufe){for(;P()!==!0&&(T=j());){if(T===hl){A=R.backslashes=!0,j();continue}if(T===zfe){f=R.isBracket=!0,m=R.isGlob=!0,D=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&E===wE&&c===l){p=R.negated=!0,l++;continue}if(r.noparen!==!0&&E===bE){if(m=R.isGlob=!0,i===!0){for(;P()!==!0&&(E=j());){if(E===bE){A=R.backslashes=!0,E=j();continue}if(E===x6){D=!0;break}}continue}break}if(m===!0){if(D=!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&&T6(U.charCodeAt(U.length-1))&&(U=U.slice(0,-1)),r.unescape===!0&&(L&&(L=A6.removeBackslashes(L)),U&&A===!0&&(U=A6.removeBackslashes(U)));let _={prefix:G,input:t,start:l,base:U,glob:L,isBrace:d,isBracket:f,isGlob:m,isExtglob:g,isGlobstar:v,negated:p,negatedExtglob:y};if(r.tokens===!0&&(_.maxDepth=0,T6(E)||o.push(R),_.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,F6(o[I]),_.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,F6(o[o.length-1]),_.maxDepth+=o[o.length-1].depth)}_.slashes=s,_.parts=a}return _};k6.exports=Gfe});var $6=b((Z_e,N6)=>{"use strict";var rm=ll(),Pr=fl(),{MAX_LENGTH:nm,POSIX_REGEX_SOURCE:Kfe,REGEX_NON_SPECIAL_CHARS:Wfe,REGEX_SPECIAL_CHARS_BACKREF:Xfe,REPLACEMENTS:R6}=rm,Yfe=(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=>Pr.escapeRegex(i)).join("..")}return r},nu=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,EE=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=R6[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(nm,r.maxLength):nm,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=Pr.isWindows(e),c=rm.globChars(u),l=rm.extglobChars(c),{DOT_LITERAL:h,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:m,DOTS_SLASH:g,NO_DOT:v,NO_DOT_SLASH:S,NO_DOTS_SLASH:A,QMARK:p,QMARK_NO_DOT:y,STAR:D,START_ANCHOR:C}=c,k=N=>`(${a}(?:(?!${C}${N.dot?g:h}).)*?)`,E=r.dot?"":v,R=r.dot?p:y,P=r.bash===!0?k(r):D;r.capture&&(P=`(${P})`),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=Pr.removePrefix(t,F),i=t.length;let j=[],U=[],G=[],L=s,_,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="",re=0)=>{F.consumed+=N,F.index+=re},W=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 re=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"&&!re&&!z&&(F.output=F.output.slice(0,-L.output.length),L.type="star",L.value="*",L.output=P,F.output+=L.output)}if(j.length&&N.type!=="paren"&&(j[j.length-1].inner+=N.value),(N.value||N.output)&&W(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,re)=>{let z={...l[re],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:re,output:F.output?"":m}),x({type:"paren",extglob:!0,value:$(),output:ie}),j.push(z)},H=N=>{let re=N.close+(r.capture?")":""),z;if(N.type==="negate"){let ie=P;if(N.inner&&N.inner.length>1&&N.inner.includes("/")&&(ie=k(r)),(ie!==P||T()||/^\)+$/.test(M()))&&(re=N.close=`)$))${ie}`),N.inner.includes("*")&&(z=M())&&/^\.[^\\/.]+$/.test(z)){let we=EE(z,{...e,fastpaths:!1}).output;re=N.close=`)${we})${ie})`}N.prev.type==="bos"&&(F.negatedExtglob=!0)}x({type:"paren",extglob:!0,value:_,output:re}),ae("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let N=!1,re=t.replace(Xfe,(z,ie,we,Oe,Me,wt)=>Oe==="\\"?(N=!0,z):Oe==="?"?ie?ie+Oe+(Me?p.repeat(Me.length):""):wt===0?R+(Me?p.repeat(Me.length):""):p.repeat(we.length):Oe==="."?h.repeat(we.length):Oe==="*"?ie?ie+Oe+(Me?P:""):P:ie?z:`\\${z}`);return N===!0&&(r.unescape===!0?re=re.replace(/\\/g,""):re=re.replace(/\\+/g,z=>z.length%2===0?"\\\\":z?"\\":"")),re===t&&r.contains===!0?(F.output=t,F):(F.output=Pr.wrapOutput(re,F,e),F)}for(;!T();){if(_=$(),_==="\0")continue;if(_==="\\"){let z=I();if(z==="/"&&r.bash!==!0||z==="."||z===";")continue;if(!z){_+="\\",x({type:"text",value:_});continue}let ie=/^\\+/.exec(M()),we=0;if(ie&&ie[0].length>2&&(we=ie[0].length,F.index+=we,we%2!==0&&(_+="\\")),r.unescape===!0?_=$():_+=$(),F.brackets===0){x({type:"text",value:_});continue}}if(F.brackets>0&&(_!=="]"||L.value==="["||L.value==="[^")){if(r.posix!==!1&&_===":"){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),Oe=L.value.slice(ie+2),Me=Kfe[Oe];if(Me){L.value=we+Me,F.backtrack=!0,$(),!s.output&&o.indexOf(L)===1&&(s.output=m);continue}}}(_==="["&&I()!==":"||_==="-"&&I()==="]")&&(_=`\\${_}`),_==="]"&&(L.value==="["||L.value==="[^")&&(_=`\\${_}`),r.posix===!0&&_==="!"&&L.value==="["&&(_="^"),L.value+=_,W({value:_});continue}if(F.quotes===1&&_!=='"'){_=Pr.escapeRegex(_),L.value+=_,W({value:_});continue}if(_==='"'){F.quotes=F.quotes===1?0:1,r.keepQuotes===!0&&x({type:"text",value:_});continue}if(_==="("){V("parens"),x({type:"paren",value:_});continue}if(_===")"){if(F.parens===0&&r.strictBrackets===!0)throw new SyntaxError(nu("opening","("));let z=j[j.length-1];if(z&&F.parens===z.parens+1){H(j.pop());continue}x({type:"paren",value:_,output:F.parens?")":"\\)"}),ae("parens");continue}if(_==="["){if(r.nobracket===!0||!M().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(nu("closing","]"));_=`\\${_}`}else V("brackets");x({type:"bracket",value:_});continue}if(_==="]"){if(r.nobracket===!0||L&&L.type==="bracket"&&L.value.length===1){x({type:"text",value:_,output:`\\${_}`});continue}if(F.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(nu("opening","["));x({type:"text",value:_,output:`\\${_}`});continue}ae("brackets");let z=L.value.slice(1);if(L.posix!==!0&&z[0]==="^"&&!z.includes("/")&&(_=`/${_}`),L.value+=_,W({value:_}),r.literalBrackets===!1||Pr.hasRegexChars(z))continue;let ie=Pr.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(_==="{"&&r.nobrace!==!0){V("braces");let z={type:"brace",value:_,output:"(",outputIndex:F.output.length,tokensIndex:F.tokens.length};U.push(z),x(z);continue}if(_==="}"){let z=U[U.length-1];if(r.nobrace===!0||!z){x({type:"text",value:_,output:_});continue}let ie=")";if(z.dots===!0){let we=o.slice(),Oe=[];for(let Me=we.length-1;Me>=0&&(o.pop(),we[Me].type!=="brace");Me--)we[Me].type!=="dots"&&Oe.unshift(we[Me].value);ie=Yfe(Oe,r),F.backtrack=!0}if(z.comma!==!0&&z.dots!==!0){let we=F.output.slice(0,z.outputIndex),Oe=F.tokens.slice(z.tokensIndex);z.value=z.output="\\{",_=ie="\\}",F.output=we;for(let Me of Oe)F.output+=Me.output||Me.value}x({type:"brace",value:_,output:ie}),ae("braces"),U.pop();continue}if(_==="|"){j.length>0&&j[j.length-1].conditions++,x({type:"text",value:_});continue}if(_===","){let z=_,ie=U[U.length-1];ie&&G[G.length-1]==="braces"&&(ie.comma=!0,z="|"),x({type:"comma",value:_,output:z});continue}if(_==="/"){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:_,output:f});continue}if(_==="."){if(F.braces>0&&L.type==="dot"){L.value==="."&&(L.output=h);let z=U[U.length-1];L.type="dots",L.output+=_,L.value+=_,z.dots=!0;continue}if(F.braces+F.parens===0&&L.type!=="bos"&&L.type!=="slash"){x({type:"text",value:_,output:h});continue}x({type:"dot",value:_,output:h});continue}if(_==="?"){if(!(L&&L.value==="(")&&r.noextglob!==!0&&I()==="("&&I(2)!=="?"){O("qmark",_);continue}if(L&&L.type==="paren"){let ie=I(),we=_;if(ie==="<"&&!Pr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(L.value==="("&&!/[!=<:]/.test(ie)||ie==="<"&&!/<([!=]|\w+>)/.test(M()))&&(we=`\\${_}`),x({type:"text",value:_,output:we});continue}if(r.dot!==!0&&(L.type==="slash"||L.type==="bos")){x({type:"qmark",value:_,output:y});continue}x({type:"qmark",value:_,output:p});continue}if(_==="!"){if(r.noextglob!==!0&&I()==="("&&(I(2)!=="?"||!/[!=<:]/.test(I(3)))){O("negate",_);continue}if(r.nonegate!==!0&&F.index===0){q();continue}}if(_==="+"){if(r.noextglob!==!0&&I()==="("&&I(2)!=="?"){O("plus",_);continue}if(L&&L.value==="("||r.regex===!1){x({type:"plus",value:_,output:d});continue}if(L&&(L.type==="bracket"||L.type==="paren"||L.type==="brace")||F.parens>0){x({type:"plus",value:_});continue}x({type:"plus",value:d});continue}if(_==="@"){if(r.noextglob!==!0&&I()==="("&&I(2)!=="?"){x({type:"at",extglob:!0,value:_,output:""});continue}x({type:"text",value:_});continue}if(_!=="*"){(_==="$"||_==="^")&&(_=`\\${_}`);let z=Wfe.exec(M());z&&(_+=z[0],F.index+=z[0].length),x({type:"text",value:_});continue}if(L&&(L.type==="globstar"||L.star===!0)){L.type="star",L.star=!0,L.value+=_,L.output=P,F.backtrack=!0,F.globstar=!0,B(_);continue}let N=M();if(r.noextglob!==!0&&/^\([^?]/.test(N)){O("star",_);continue}if(L.type==="star"){if(r.noglobstar===!0){B(_);continue}let z=L.prev,ie=z.prev,we=z.type==="slash"||z.type==="bos",Oe=ie&&(ie.type==="star"||ie.type==="globstar");if(r.bash===!0&&(!we||N[0]&&N[0]!=="/")){x({type:"star",value:_,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:_,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+=_,L.output=k(r),F.output=L.output,F.globstar=!0,B(_);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&!Oe&&T()){F.output=F.output.slice(0,-(z.output+L.output).length),z.output=`(?:${z.output}`,L.type="globstar",L.output=k(r)+(r.strictSlashes?")":"|$)"),L.value+=_,F.globstar=!0,F.output+=z.output+L.output,B(_);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=`${k(r)}${f}|${f}${dr})`,L.value+=_,F.output+=z.output+L.output,F.globstar=!0,B(_+$()),x({type:"slash",value:"/",output:""});continue}if(z.type==="bos"&&N[0]==="/"){L.type="globstar",L.value+=_,L.output=`(?:^|${f}|${k(r)}${f})`,F.output=L.output,F.globstar=!0,B(_+$()),x({type:"slash",value:"/",output:""});continue}F.output=F.output.slice(0,-L.output.length),L.type="globstar",L.output=k(r),L.value+=_,F.output+=L.output,F.globstar=!0,B(_);continue}let re={type:"star",value:_,output:P};if(r.bash===!0){re.output=".*?",(L.type==="bos"||L.type==="slash")&&(re.output=E+re.output),x(re);continue}if(L&&(L.type==="bracket"||L.type==="paren")&&r.regex===!0){re.output=_,x(re);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(re)}for(;F.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(nu("closing","]"));F.output=Pr.escapeLast(F.output,"["),ae("brackets")}for(;F.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(nu("closing",")"));F.output=Pr.escapeLast(F.output,"("),ae("parens")}for(;F.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(nu("closing","}"));F.output=Pr.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};EE.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(nm,r.maxLength):nm,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=R6[t]||t;let s=Pr.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}=rm.globChars(s),g=r.dot?h:l,v=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}).)*?)`,D=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}${v}${p}`;case"**":return g+y(r);case"**/*":return`(?:${g}${y(r)}${a})?${v}${u}${p}`;case"**/*.*":return`(?:${g}${y(r)}${a})?${v}${p}${o}${u}${p}`;case"**/.*":return`(?:${g}${y(r)}${a})?${o}${u}${p}`;default:{let R=/^(.*?)\.(\w+)$/.exec(E);if(!R)return;let P=D(R[1]);return P?P+o+R[2]:void 0}}},C=Pr.removePrefix(t,A),k=D(C);return k&&r.strictSlashes!==!0&&(k+=`${a}?`),k};N6.exports=EE});var j6=b((Q_e,L6)=>{"use strict";var Jfe=require("path"),Zfe=P6(),_E=$6(),CE=fl(),Qfe=ll(),ehe=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=ehe(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=CE.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?CE.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=CE.isWindows(r))=>(e instanceof RegExp?e:_t.makeRe(e,r)).test(Jfe.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)):_E(t,{...e,fastpaths:!1});_t.scan=(t,e)=>Zfe(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=_E.fastpaths(t,e)),i.output||(i=_E(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=Qfe;L6.exports=_t});var M6=b((eCe,B6)=>{"use strict";B6.exports=j6()});var G6=b((tCe,z6)=>{"use strict";var U6=require("util"),H6=v6(),Mn=M6(),SE=fl(),q6=t=>t===""||t==="./",V6=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: "${U6.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>et.contains(t,n,r));if(typeof e=="string"){if(q6(t)||q6(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(!SE.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: "${U6.inspect(t)}"`);return[].concat(e).every(n=>Mn(n,r)(t))};et.capture=(t,e,r)=>{let n=SE.isWindows(r),s=Mn.makeRe(String(t),{...r,capture:!0}).exec(n?SE.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 H6(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||!V6(t)?[t]:H6(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=V6;z6.exports=et});var Vhe={};am(Vhe,{CapgoSDK:()=>st,addApp:()=>Bhe,addChannel:()=>qhe,addOrganization:()=>$he,checkBundleCompatibility:()=>She,createSupabaseClient:()=>pe,decryptBundle:()=>Ohe,deleteLegacyEncryptionKey:()=>Ihe,deleteOrganization:()=>jhe,doctor:()=>Che,encryptBundle:()=>Ahe,generateEncryptionKeys:()=>The,getAccountId:()=>Rhe,getCapacitorConfig:()=>Hhe,getCurrentBundle:()=>khe,getStats:()=>Uhe,listBundles:()=>Mhe,listOrganizations:()=>Nhe,login:()=>_he,saveEncryptionKey:()=>Fhe,updateAppSetting:()=>Phe,updateOrganization:()=>Lhe,uploadBundle:()=>Ehe,zipBundle:()=>xhe});module.exports=ue(Vhe);var Ut=xe(Ye(),1),mo=require("node:process"),Di=xe(require("node:readline"),1),dm=xe(require("node:readline"),1),ME=require("node:stream"),qE=xe(lm(),1);function Nq({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 $q=Nq();function UE(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace($q,"")}function HE(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var VE={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}})(VE);var Lq=VE.exports,jq=HE(Lq),Bq=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},Mq=HE(Bq);function su(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=UE(t),t.length===0))return 0;t=t.replace(Mq()," ");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(jq.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var fm=10,PE=(t=0)=>e=>`\x1B[${e+t}m`,RE=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,NE=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,tt={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(tt.modifier);var qq=Object.keys(tt.color),Uq=Object.keys(tt.bgColor);[...qq,...Uq];function Hq(){let t=new Map;for(let[e,r]of Object.entries(tt)){for(let[n,i]of Object.entries(r))tt[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=tt[n],t.set(i[0],i[1]);Object.defineProperty(tt,e,{value:r,enumerable:!1})}return Object.defineProperty(tt,"codes",{value:t,enumerable:!1}),tt.color.close="\x1B[39m",tt.bgColor.close="\x1B[49m",tt.color.ansi=PE(),tt.color.ansi256=RE(),tt.color.ansi16m=NE(),tt.bgColor.ansi=PE(fm),tt.bgColor.ansi256=RE(fm),tt.bgColor.ansi16m=NE(fm),Object.defineProperties(tt,{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=>tt.rgbToAnsi256(...tt.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)=>tt.ansi256ToAnsi(tt.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>tt.ansi256ToAnsi(tt.hexToAnsi256(e)),enumerable:!1}}),tt}var Vq=Hq(),El=new Set(["\x1B","\x9B"]),zq=39,mm="\x07",zE="[",Gq="]",GE="m",gm=`${Gq}8;;`,$E=t=>`${El.values().next().value}${zE}${t}${GE}`,LE=t=>`${El.values().next().value}${gm}${t}${mm}`,Kq=t=>t.split(" ").map(e=>su(e)),hm=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=su(UE(t[t.length-1]));for(let[a,u]of n.entries()){let c=su(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),El.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith(gm)),i){s?u===mm&&(i=!1,s=!1):u===GE&&(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())},Wq=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(su(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},Xq=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,s,o=Kq(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let h=su(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(""),hm(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){hm(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){hm(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>Wq(c)));let u=[...a.join(`
|
|
239
239
|
`)];for(let[c,l]of u.entries()){if(n+=l,El.has(l)){let{groups:d}=new RegExp(`(?:\\${zE}(?<code>\\d+)m|\\${gm}(?<uri>.*)${mm})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let f=Number.parseFloat(d.code);i=f===zq?void 0:f}else d.uri!==void 0&&(s=d.uri.length===0?void 0:d.uri)}let h=Vq.codes.get(Number(i));u[c+1]===`
|
|
240
240
|
`?(s&&(n+=LE("")),i&&h&&(n+=$E(h))):l===`
|
|
241
241
|
`&&(i&&h&&(n+=$E(i)),s&&(n+=LE(s)))}return n};function jE(t,e,r){return String(t).normalize().replace(/\r\n/g,`
|
|
@@ -280,9 +280,9 @@ ${Y.default.gray(au)} ${t}
|
|
|
280
280
|
`);let D=0,C=0;f(),s=setInterval(()=>{if(n&&a===u)return;g(),u=a;let k=Y.default.magenta(e[D]);if(n)process.stdout.write(`${k} ${a}...`);else if(t==="timer")process.stdout.write(`${k} ${a} ${S(c)}`);else{let E=".".repeat(Math.floor(C)).slice(0,3);process.stdout.write(`${k} ${a}${E}`)}D=D+1<e.length?D+1:0,C=C<e.length?C+.125:0},r)},p=(y="",D=0)=>{o=!1,clearInterval(s),g();let C=D===0?Y.default.green(bm):D===1?Y.default.red(WE):Y.default.red(XE);a=v(y??a),t==="timer"?process.stdout.write(`${C} ${a} ${S(c)}
|
|
281
281
|
`):process.stdout.write(`${C} ${a}
|
|
282
282
|
`),m(),i()};return{start:A,stop:p,message:(y="")=>{a=v(y??a)}}};function YE(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?YE("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))+YE("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 $8=require("node:child_process"),Xe=require("node:fs"),Ip=require("node:os"),We=xe(require("node:path")),Nn=require("node:process"),ts=xe(Sl());var Jt=require("fs"),cu=(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},Al=(t=cu(),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"}},JE=(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 Ol(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function e_(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Am(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 Do="0|[1-9]\\d*",mU="\\d*[a-zA-Z-][a-zA-Z0-9-]*",gU=`(?<major>${Do})\\.(?<minor>${Do})\\.(?<patch>${Do})`,ZE=`(?:${Do}|${mU})`,t_=`(?:-(?<prerelease>${ZE}(?:\\.${ZE})*))`,QE="[0-9A-Za-z-]+",r_=`(?:\\+(?<buildmetadata>${QE}(?:\\.${QE})*))`,n_=`v?${gU}${t_}?${r_}?`,i_=new RegExp(`^${n_}$`),s_="(?:<|>)?=?",yU="x|X|\\*",Sm=`${Do}|${yU}`,xl=`[v=\\s]*(?<major>${Sm})(?:\\.(?<minor>${Sm})(?:\\.(?<patch>${Sm})${t_}?${r_}?)?)?`,o_=new RegExp(`^(?<operator>~>?|\\^|${s_})\\s*${xl}$`),a_=new RegExp(`^(?<operator>${s_})\\s*(${n_})$|^$`);function Om(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var xm=256;var DU=new RegExp(`^${Do}$`);function Zt(t){return t.split(".").filter(Boolean).map(e=>{if(DU.test(e)){let r=Number(e);if(Om(r))return r}return e})}function Zr(t){return t.split(".").filter(Boolean)}function vi(t,e){let r=Number(t);if(!Om(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:Ol(t.major,e.major)||Ol(t.minor,e.minor)||Ol(t.patch,e.patch)||e_(t.prerelease,e.prerelease)||Am(t.prerelease,e.prerelease)}function Tm(t){return t.toFixed(0)}function bi(t){let e=Tm(t.major),r=Tm(t.minor),n=Tm(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 wU(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 Tl(t,e){for(let r of e)if(!wU(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 lu(t,e){return e.some(r=>Tl(t,r))}function vU(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 fu(t=[],e){let r=vU(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 u_(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:fu(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:fu(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:fu(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:fu(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:fu(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var Fl={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},wo={operator:void 0,...Fl};function Fm(t,e){return Qt(t,e)>0}function Im(t,e){return Qt(t,e)<0}function bU(t){let r=t.match(a_)?.groups;if(!r)return null;let{operator:n,prerelease:i,buildmetadata:s}=r,o=r.major?{major:vi(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:vi(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:vi(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:i?Zt(i):[],build:s?Zr(s):[]}:Fl;return{operator:n||void 0,...o}}function qe(t){return!t||t.toLowerCase()==="x"||t==="*"}function EU(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 _U(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 CU(t){let e=t.match(new RegExp(`^${xl}`)),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(`^${xl}\\s*$`))?.groups;if(!a)return null;let u=EU(r),c=_U(a);return[u,c].filter(Boolean)}function SU(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[wo];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 AU(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[wo];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 OU(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 xU(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 TU(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 FU(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[wo];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 IU(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[wo];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 kU(t){let e=t.match(o_)?.groups;if(!e)return bU(t);switch(e.operator){case"^":return SU(e);case"~":case"~>":return AU(e);case"<":return OU(e);case"<=":return xU(e);case">":return TU(e);case">=":return FU(e);case"=":case"":return IU(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function PU(t){return t.split(/\s+/).flatMap(kU)}function Il(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>CU(r)||PU(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>xm)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${xm}`);t=t.trim();let e=t.match(i_)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=vi(e.major,`Cannot parse version ${t}: invalid major version`),n=vi(e.minor,`Cannot parse version ${t}: invalid minor version`),i=vi(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 c_(t,e){let r=t.operator,n=e.operator;if(r===void 0)return qn(t)?!0:lu(t,[[e]]);if(n===void 0)return qn(e)?!0:lu(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 RU(t){return t.every(e=>e.some(r=>NU(r)))}function NU(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!c_(r,n))return!1}return!0}function l_(t,e){return RU([t,e])&&t.some(r=>e.some(n=>r.every(i=>n.every(s=>c_(i,s)))))}function f_(t){try{return Ct(t),!0}catch{return!1}}function Ei(t,e){return Qt(t,e)>=0}var za=xe(uS()),Xb=xe(qS()),L8=xe(DA()),kp=xe(i0());var ki={name:"@capgo/cli",version:"7.26.0",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",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 Rh(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 Rh("@capgo/cli")??"",e=t?.split(".")[0];t!==ki.version&&w.warning(`\u{1F6A8} You are using @capgo/cli@${ki.version} it's not the latest version.
|
|
284
|
-
Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}async function F1(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 s0=require("node:buffer"),I1=require("node:crypto"),VX=(()=>{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 zX(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=VX[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function Yn(t,e="sha256"){let r=s0.Buffer.isBuffer(t)?t:s0.Buffer.from(t);if(e==="crc32")return zX(r);let n=(0,I1.createHash)(e);return n.update(r),n.digest("hex")}var Jc=xe(e8());async function t8(){let t=await(0,Jc.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function Ab(t,e,r=!1){let n=await(0,Jc.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,Jc.writeConfig)(i,n.app.extConfigFilePath))}async function qa(t,e=!1){await Ab("CapacitorUpdater",t,e)}var Ga=".capgo_key",Ir=".capgo_key_v2",Pp=`${Ga}.pub`,hi=`${Ir}.pub`,F8="https://capgo.app",I8="https://files.capgo.app",k8="https://api.capgo.app",P8="https://console.capgo.app",Yb=12e4,cle=1024*1024*20,lle=1024*1024*1024,fle=1024*1024*99,Rp="package.json",Ka=/^(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,
|
|
285
|
-
${L8.default.render(t)}`:"";function Fp(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 hle(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 w.error(i),new Error(i)}let n=(0,Xe.readFileSync)(r??(0,We.join)(t,Rp));return JSON.parse(n)}function rs(t=Xr((0,Nn.cwd)()),e=void 0){return hle(t,e).version??""}function R8(t){let e=t.replace("^","").replace("~","");if(f_(e))try{let r=Ct(e);return bi(r)}catch{return e}return e}async function ro(t,e=(0,Nn.cwd)(),r){if(t!=="@capgo/capacitor-updater")return null;if(r)try{let o=(await tl(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,Rp);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 tl(e)).get(t);if(o)return o}catch{}return null}async function tl(t=Xr((0,Nn.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,We.join)(t,Rp)],r){for(let i of r)if(!(0,Xe.existsSync)(i)){let s=`Package.json at ${i} does not exist`;throw w.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,R8(o.dependencies[a]));for(let a in o.devDependencies)n.set(a,R8(o.devDependencies[a]))}return n}async function de(){try{let t=await t8();if(!t){let e="No capacitor config file found, run `cap init` first";throw w.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${
|
|
283
|
+
`)}};var $8=require("node:child_process"),Xe=require("node:fs"),Ip=require("node:os"),We=xe(require("node:path")),Nn=require("node:process"),ts=xe(Sl());var Jt=require("fs"),cu=(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},Al=(t=cu(),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"}},JE=(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 Ol(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function e_(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Am(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 Do="0|[1-9]\\d*",mU="\\d*[a-zA-Z-][a-zA-Z0-9-]*",gU=`(?<major>${Do})\\.(?<minor>${Do})\\.(?<patch>${Do})`,ZE=`(?:${Do}|${mU})`,t_=`(?:-(?<prerelease>${ZE}(?:\\.${ZE})*))`,QE="[0-9A-Za-z-]+",r_=`(?:\\+(?<buildmetadata>${QE}(?:\\.${QE})*))`,n_=`v?${gU}${t_}?${r_}?`,i_=new RegExp(`^${n_}$`),s_="(?:<|>)?=?",yU="x|X|\\*",Sm=`${Do}|${yU}`,xl=`[v=\\s]*(?<major>${Sm})(?:\\.(?<minor>${Sm})(?:\\.(?<patch>${Sm})${t_}?${r_}?)?)?`,o_=new RegExp(`^(?<operator>~>?|\\^|${s_})\\s*${xl}$`),a_=new RegExp(`^(?<operator>${s_})\\s*(${n_})$|^$`);function Om(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var xm=256;var DU=new RegExp(`^${Do}$`);function Zt(t){return t.split(".").filter(Boolean).map(e=>{if(DU.test(e)){let r=Number(e);if(Om(r))return r}return e})}function Zr(t){return t.split(".").filter(Boolean)}function vi(t,e){let r=Number(t);if(!Om(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:Ol(t.major,e.major)||Ol(t.minor,e.minor)||Ol(t.patch,e.patch)||e_(t.prerelease,e.prerelease)||Am(t.prerelease,e.prerelease)}function Tm(t){return t.toFixed(0)}function bi(t){let e=Tm(t.major),r=Tm(t.minor),n=Tm(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 wU(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 Tl(t,e){for(let r of e)if(!wU(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 lu(t,e){return e.some(r=>Tl(t,r))}function vU(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 fu(t=[],e){let r=vU(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 u_(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:fu(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:fu(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:fu(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:fu(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:fu(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var Fl={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},wo={operator:void 0,...Fl};function Fm(t,e){return Qt(t,e)>0}function Im(t,e){return Qt(t,e)<0}function bU(t){let r=t.match(a_)?.groups;if(!r)return null;let{operator:n,prerelease:i,buildmetadata:s}=r,o=r.major?{major:vi(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:vi(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:vi(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:i?Zt(i):[],build:s?Zr(s):[]}:Fl;return{operator:n||void 0,...o}}function qe(t){return!t||t.toLowerCase()==="x"||t==="*"}function EU(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 _U(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 CU(t){let e=t.match(new RegExp(`^${xl}`)),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(`^${xl}\\s*$`))?.groups;if(!a)return null;let u=EU(r),c=_U(a);return[u,c].filter(Boolean)}function SU(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[wo];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 AU(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[wo];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 OU(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 xU(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 TU(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 FU(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[wo];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 IU(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[wo];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 kU(t){let e=t.match(o_)?.groups;if(!e)return bU(t);switch(e.operator){case"^":return SU(e);case"~":case"~>":return AU(e);case"<":return OU(e);case"<=":return xU(e);case">":return TU(e);case">=":return FU(e);case"=":case"":return IU(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function PU(t){return t.split(/\s+/).flatMap(kU)}function Il(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>CU(r)||PU(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>xm)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${xm}`);t=t.trim();let e=t.match(i_)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=vi(e.major,`Cannot parse version ${t}: invalid major version`),n=vi(e.minor,`Cannot parse version ${t}: invalid minor version`),i=vi(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 c_(t,e){let r=t.operator,n=e.operator;if(r===void 0)return qn(t)?!0:lu(t,[[e]]);if(n===void 0)return qn(e)?!0:lu(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 RU(t){return t.every(e=>e.some(r=>NU(r)))}function NU(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!c_(r,n))return!1}return!0}function l_(t,e){return RU([t,e])&&t.some(r=>e.some(n=>r.every(i=>n.every(s=>c_(i,s)))))}function f_(t){try{return Ct(t),!0}catch{return!1}}function Ei(t,e){return Qt(t,e)>=0}var za=xe(uS()),Xb=xe(qS()),L8=xe(DA()),kp=xe(i0());var ki={name:"@capgo/cli",version:"7.26.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",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 Rh(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 Rh("@capgo/cli")??"",e=t?.split(".")[0];t!==ki.version&&w.warning(`\u{1F6A8} You are using @capgo/cli@${ki.version} it's not the latest version.
|
|
284
|
+
Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}async function F1(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 s0=require("node:buffer"),I1=require("node:crypto"),VX=(()=>{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 zX(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=VX[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function Yn(t,e="sha256"){let r=s0.Buffer.isBuffer(t)?t:s0.Buffer.from(t);if(e==="crc32")return zX(r);let n=(0,I1.createHash)(e);return n.update(r),n.digest("hex")}var Jc=xe(e8());async function t8(){let t=await(0,Jc.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function Ab(t,e,r=!1){let n=await(0,Jc.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,Jc.writeConfig)(i,n.app.extConfigFilePath))}async function qa(t,e=!1){await Ab("CapacitorUpdater",t,e)}var Ga=".capgo_key",Ir=".capgo_key_v2",Pp=`${Ga}.pub`,hi=`${Ir}.pub`,F8="https://capgo.app",I8="https://files.capgo.app",k8="https://api.capgo.app",P8="https://console.capgo.app",Yb=12e4,cle=1024*1024*20,lle=1024*1024*1024,fle=1024*1024*99,Rp="package.json",Ka=/^(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,K=t=>t?`
|
|
285
|
+
${L8.default.render(t)}`:"";function Fp(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 hle(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 w.error(i),new Error(i)}let n=(0,Xe.readFileSync)(r??(0,We.join)(t,Rp));return JSON.parse(n)}function rs(t=Xr((0,Nn.cwd)()),e=void 0){return hle(t,e).version??""}function R8(t){let e=t.replace("^","").replace("~","");if(f_(e))try{let r=Ct(e);return bi(r)}catch{return e}return e}async function ro(t,e=(0,Nn.cwd)(),r){if(t!=="@capgo/capacitor-updater")return null;if(r)try{let o=(await tl(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,Rp);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 tl(e)).get(t);if(o)return o}catch{}return null}async function tl(t=Xr((0,Nn.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,We.join)(t,Rp)],r){for(let i of r)if(!(0,Xe.existsSync)(i)){let s=`Package.json at ${i} does not exist`;throw w.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,R8(o.dependencies[a]));for(let a in o.devDependencies)n.set(a,R8(o.devDependencies[a]))}return n}async function de(){try{let t=await t8();if(!t){let e="No capacitor config file found, run `cap init` first";throw w.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${K(t)}`;throw w.error(e),new Error(e)}}async function dle(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 Ab(t,r)),r}async function j8(t){return dle("CapacitorUpdater",t)}async function wn(){try{let t=await de(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||F8,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||P8,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||I8,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||k8};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(w.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:F8,hostWeb:P8,hostFilesApi:I8,hostApi:k8}}}var ple=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function Np(){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 w.info(`Local config ${K(t)}`),t}}async function B8(){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:lle,maxChunkSize:fle,alertUploadSize:cle}}}async function pe(t,e,r){let n=await Np();if(e&&r&&(w.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw w.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,za.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function mle(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){w.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 w.error(s),new Error("Invalid API key or insufficient permissions.")}}async function M8(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function q8(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function gle(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function yle(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||{}),Wa=(t,e)=>t>=e;async function U8(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 w.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")?(w.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(w.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 w.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 H8(t,e,r){let{data:n,error:i}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(i){w.error(`Cannot get cli warnings: ${K(i)}`);return}if(n.length>0){w.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"){w.error(`Invalid cli warning: ${o}`);continue}let a=o;a.fatal?(w.error(`${a.message.replaceAll("\\n",`
|
|
286
286
|
`)}`),s=new Error(a.message)):w.warn(`${a.message.replaceAll("\\n",`
|
|
287
287
|
`)}`)}if(s)throw w.error("Please fix the warnings and try again."),s;w.info("End of cli warnings.")}}async function V8(t,e,r,n,i=!0){let s=await Np();if(!await(n?yle(t,n,r):gle(t,e)))throw w.error(`You need to upgrade your plan to continue to use capgo.
|
|
288
288
|
Upgrade here: ${s.hostWeb}/dashboard/settings/plans
|
|
@@ -292,13 +292,13 @@ Trial expires in ${a} days, upgrade here: ${s.hostWeb}/dashboard/settings/plans
|
|
|
292
292
|
Upgrade here: ${s.hostWeb}/dashboard/settings/plans
|
|
293
293
|
`),Fp(100),Promise.resolve().then(()=>(Kb(),Gb)).then(c=>{c.default(`${s.hostWeb}/dashboard/settings/plans`)}),Fp(500),new Error("Plan upgrade required for upload");let[a,u]=await Promise.all([q8(t,e),M8(t,e)]);a>0&&i&&!u&&w.warn(`WARNING !!
|
|
294
294
|
Trial expires in ${a} days, upgrade here: ${s.hostWeb}/dashboard/settings/plans
|
|
295
|
-
`)}function ne(t=!1){let e=Nn.env.CAPGO_TOKEN?.trim();if(e)return t||w.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,Ip.homedir)(),n,i=`${r}/.capgo`;if((0,Xe.existsSync)(i)&&(t||w.info(`Use global API key ${i}`),n=(0,Xe.readFileSync)(i,"utf8").trim()),i=".capgo",!n&&(0,Xe.existsSync)(i)&&(t||w.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 w.error(s),new Error(s)}return n}function Xa(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 Jb(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 G8(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 za.FunctionsHttpError){let o=await s.error.context.json();w.error(`Upload URL error: ${o.status||JSON.stringify(o)}`)}else w.error(`Cannot get upload url: ${s.error.message}`);return""}return s.data.url}catch(i){w.error(`Cannot get upload url ${W(i)}`)}return""}async function*K8(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*K8(n):yield n}}async function W8(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 K8(t)){if(r.some(a=>n.includes(a))){w.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){w.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 $p(t){return(0,Ip.platform)()==="win32"?wle(t):Dle(t)}function Dle(t){let e=new Xb.default;return e.addLocalFolder(t),e.toBuffer()}async function wle(t){w.info("Zipping file windows mode");let e=new Xb.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 X8(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 kp.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(w.error(`Error uploading bundle: ${h.message}`),h instanceof kp.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 Y8(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 za.FunctionsHttpError){let o=await s.error.context.json();w.error(`Cannot delete failed version: ${o.status||JSON.stringify(o)}`)}else w.error(`Cannot delete failed version: ${s.error.message}`);return}return s.data?.status}catch(i){if(i instanceof za.FunctionsHttpError){let s=await i.context.json();w.error(`Cannot delete failed version: ${s.message||JSON.stringify(s)}`)}else w.error(`Cannot delete failed version: ${W(i)}`)}}async function Lp(t,e){if(!e.app_id||!e.name||!e.created_by)return w.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&&w.info(`Get remove config: for ${e.event}`);let n=await Np();r&&w.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&&w.error(`Failed to send LogSnag event: ${a.error}`)}finally{clearTimeout(s)}}catch(n){r&&(w.error("Failed to send Stats event details:"),w.error(W(n)))}}async function jp(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw w.error("Cannot get the list of organizations - exiting"),w.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 w.error("Could not get organization please create an organization first"),new Error("No organizations available");if(i.length===0)throw w.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 yo({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 w.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let o=s,a=n.find(u=>u.gid===o);return w.info(`Using the organization "${a.name}" as the app owner`),a}async function De(t,e,r=["all"]){await mle(t,e,r);let{data:n,error:i}=await t.rpc("get_user_id",{apikey:e}).single(),s=(n||"").toString();if(!s||i)throw w.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 w.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 Ya(t){return new Date(t||"").toLocaleString()}var N8=!1,Va="npm",el="install",Wb="npx";function $n(){if(N8)return{pm:Va,command:el,installCommand:`${Va} ${el}`,runner:Wb};let t=Xr((0,Nn.cwd)());return Va=cu(t,"npm"),el=Al(Va),N8=!0,Wb=JE(t),{pm:Va,command:el,installCommand:`${Va} ${el}`,runner:Wb}}function J8(t){return(0,Xe.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let i=(0,We.join)(t,n.name);return n.isDirectory()?J8(i):i.split(`node_modules${We.sep}`)[1]||i})}async function Zb(t,e){let r=e?e.split(","):[],n;try{n=await tl("",t)}catch(l){throw w.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(Rp,""):Xr((0,Nn.cwd)());if(!n)throw w.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 w.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=cu(s,"npm"),h=Al(l);throw w.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(J8(g).some(S=>ple.test(S))){f=!0;break}}catch(v){throw w.error(`Error reading node_modules files for ${l} package in ${m}`),console.error(v),v instanceof Error?v:new Error(`Error reading node_modules files for ${l}`)}}}if(!d){u=!0;let m=cu(s,"npm"),g=Al(m);return w.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 w.error("Missing dependencies or invalid dependencies"),w.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 vle(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 ble(t){if(!t)throw w.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 w.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 w.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 w.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 Z8(t,e,r){let{data:n,error:i}=await t.from("channels").select(`version (
|
|
295
|
+
`)}function ne(t=!1){let e=Nn.env.CAPGO_TOKEN?.trim();if(e)return t||w.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,Ip.homedir)(),n,i=`${r}/.capgo`;if((0,Xe.existsSync)(i)&&(t||w.info(`Use global API key ${i}`),n=(0,Xe.readFileSync)(i,"utf8").trim()),i=".capgo",!n&&(0,Xe.existsSync)(i)&&(t||w.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 w.error(s),new Error(s)}return n}function Xa(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 Jb(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 G8(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 za.FunctionsHttpError){let o=await s.error.context.json();w.error(`Upload URL error: ${o.status||JSON.stringify(o)}`)}else w.error(`Cannot get upload url: ${s.error.message}`);return""}return s.data.url}catch(i){w.error(`Cannot get upload url ${K(i)}`)}return""}async function*K8(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*K8(n):yield n}}async function W8(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 K8(t)){if(r.some(a=>n.includes(a))){w.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){w.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 $p(t){return(0,Ip.platform)()==="win32"?wle(t):Dle(t)}function Dle(t){let e=new Xb.default;return e.addLocalFolder(t),e.toBuffer()}async function wle(t){w.info("Zipping file windows mode");let e=new Xb.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 X8(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 kp.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(w.error(`Error uploading bundle: ${h.message}`),h instanceof kp.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 Y8(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 za.FunctionsHttpError){let o=await s.error.context.json();w.error(`Cannot delete failed version: ${o.status||JSON.stringify(o)}`)}else w.error(`Cannot delete failed version: ${s.error.message}`);return}return s.data?.status}catch(i){if(i instanceof za.FunctionsHttpError){let s=await i.context.json();w.error(`Cannot delete failed version: ${s.message||JSON.stringify(s)}`)}else w.error(`Cannot delete failed version: ${K(i)}`)}}async function Lp(t,e){if(!e.app_id||!e.name||!e.created_by)return w.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&&w.info(`Get remove config: for ${e.event}`);let n=await Np();r&&w.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&&w.error(`Failed to send LogSnag event: ${a.error}`)}finally{clearTimeout(s)}}catch(n){r&&(w.error("Failed to send Stats event details:"),w.error(K(n)))}}async function jp(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw w.error("Cannot get the list of organizations - exiting"),w.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 w.error("Could not get organization please create an organization first"),new Error("No organizations available");if(i.length===0)throw w.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 yo({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 w.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let o=s,a=n.find(u=>u.gid===o);return w.info(`Using the organization "${a.name}" as the app owner`),a}async function De(t,e,r=["all"]){await mle(t,e,r);let{data:n,error:i}=await t.rpc("get_user_id",{apikey:e}).single(),s=(n||"").toString();if(!s||i)throw w.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 w.error(`Cannot get organization id for app id ${e}`),K(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function Ya(t){return new Date(t||"").toLocaleString()}var N8=!1,Va="npm",el="install",Wb="npx";function $n(){if(N8)return{pm:Va,command:el,installCommand:`${Va} ${el}`,runner:Wb};let t=Xr((0,Nn.cwd)());return Va=cu(t,"npm"),el=Al(Va),N8=!0,Wb=JE(t),{pm:Va,command:el,installCommand:`${Va} ${el}`,runner:Wb}}function J8(t){return(0,Xe.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let i=(0,We.join)(t,n.name);return n.isDirectory()?J8(i):i.split(`node_modules${We.sep}`)[1]||i})}async function Zb(t,e){let r=e?e.split(","):[],n;try{n=await tl("",t)}catch(l){throw w.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(Rp,""):Xr((0,Nn.cwd)());if(!n)throw w.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 w.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=cu(s,"npm"),h=Al(l);throw w.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(J8(g).some(S=>ple.test(S))){f=!0;break}}catch(v){throw w.error(`Error reading node_modules files for ${l} package in ${m}`),console.error(v),v instanceof Error?v:new Error(`Error reading node_modules files for ${l}`)}}}if(!d){u=!0;let m=cu(s,"npm"),g=Al(m);return w.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 w.error("Missing dependencies or invalid dependencies"),w.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 vle(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 ble(t){if(!t)throw w.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 w.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 w.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 w.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 Z8(t,e,r){let{data:n,error:i}=await t.from("channels").select(`version (
|
|
296
296
|
native_packages
|
|
297
297
|
)`).eq("name",r).eq("app_id",e).single();if(i)throw w.error(`Error fetching native packages: ${i.message}`),new Error(`Error fetching native packages: ${i.message}`);return ble(n.version.native_packages??[])}async function Q8(t,e,r,n){let i=Ft();i.start(`Checking bundle checksum compatibility with channel ${r}`);let s=await vle(t,e,r);if(!s){i.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}if(s&&s===n)throw w.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 Pe(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function no(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=Il(t.localVersion),r=Il(t.remoteVersion);return l_(e,r)}catch{return!1}}async function Bp(t,e,r,n,i){let s=await Zb(n,i),o=await Z8(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 Qb(t,e,r,n){let i=await Z8(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 eM(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 F1("onboarding-v2",e,r,"canceled","\u{1F937}"),w.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,$8.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"),w.error(`Failed to run Capacitor sync: ${o}`),w.warn(`Please run "${i.runner} cap sync" manually to ensure encrypted updates work properly`)}}else{let i=$n();w.warn("\u26A0\uFE0F Important: If you upload encrypted bundles without syncing, updates will fail!"),w.info(`Remember to run "${i.runner} cap sync" before uploading encrypted bundles`)}}async function tM(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||w.error(`Cannot check Version ${e}@${r.name}: ${
|
|
301
|
-
${
|
|
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 Pe(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function no(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=Il(t.localVersion),r=Il(t.remoteVersion);return l_(e,r)}catch{return!1}}async function Bp(t,e,r,n,i){let s=await Zb(n,i),o=await Z8(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 Qb(t,e,r,n){let i=await Z8(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 eM(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 F1("onboarding-v2",e,r,"canceled","\u{1F937}"),w.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,$8.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"),w.error(`Failed to run Capacitor sync: ${o}`),w.warn(`Please run "${i.runner} cap sync" manually to ensure encrypted updates work properly`)}}else{let i=$n();w.warn("\u26A0\uFE0F Important: If you upload encrypted bundles without syncing, updates will fail!"),w.info(`Remember to run "${i.runner} cap sync" before uploading encrypted bundles`)}}async function tM(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||w.error(`Cannot check Version ${e}@${r.name}: ${K(a)}`),new Error(`Cannot check version ${e}@${r.name}: ${K(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 w.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 eE(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} ${K(d)}`),new Error(`Cannot update channel ${c.name}: ${K(d)}`);l.stop(`\u2705 Channel ${c.name} unlinked`)}ce(`Version unlinked from ${o.length} channel${o.length>1?"s":""}`)}async function eE(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||w.error(`Cannot call findUnknownVersion as it returned an error.
|
|
301
|
+
${K(s)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${K(s)}`)}function rM(t,e){return t.from("channels").insert(e).select().single()}function nM(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function iM(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function sM(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function oM(t,e,r){return t.from("channels").select(`
|
|
302
302
|
id,
|
|
303
303
|
version (id, name)
|
|
304
304
|
`).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function aM(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"]);w.success("Channels"),w.success(r.toString())}async function uM(t,e,r=!1){let{data:n,error:i}=await t.from("channels").select(`
|
|
@@ -316,7 +316,7 @@ ${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||w.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${W(i)}`);return n}async function tE(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||w.error(o),new Error(`${o}: ${W(s)}`)}}async function Mp(t,e,r,n={}){let{silent:i=!1,autoUnlink:s=!1}=n,o=await Ele(t,e,r,{silent:i});await tM(t,e,o,{silent:i,autoUnlink:s}),await tE(t,e,r,{silent:i})}function cM(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,Ya(n.created_at),n.keep??""]);w.success("Bundles"),w.success(r.toString())}async function qp(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||w.error(o),new Error(`${o}: ${W(s)}`)}return i??[]}async function lM(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||w.error(o),new Error(`${o}: ${W(s)}`)}return(i??[]).map(o=>o.version)}async function Ele(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||w.error(a),new Error(`${a}${o?`: ${W(o)}`:""}`)}return s}var Ja=require("node:fs");async function fM(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 U8(t,e,r);if(!o.okay)switch(o.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw i||w.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||w.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw i||w.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||w.error(c),new Error(c)}return o.data}var Yr="assets/icon.png";var _le=/^[a-z0-9]+(\.[\w-]+)+$/i;function Cle(t,e,r){if(!e.apikey)throw r||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||w.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||w.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!_le.test(t))throw r||(w.error(`Invalid app ID format: "${t}"`),w.info("App ID must be in reverse domain notation (e.g., com.example.app)"),w.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),w.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function Sle(t,e,r){if(await fM(t,e))throw e==="io.ionic.starter"?(r||w.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||w.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function hM(t,e,r,n=!1){n||oe("Adding"),await ze(),e.apikey=e.apikey||ne();let i=await de(),s=Pe(t,i?.config);Cle(s,e,n);let o=await pe(e.apikey,e.supaHost,e.supaAnon),a=await De(o,e.apikey,["write","all"]);await Sle(o,s,n),r||(r=await jp(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||w.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||w.info(`Adding ${s} to Capgo`);let h=null,d=null;l&&(0,Ja.existsSync)(l)?(h=(0,Ja.readFileSync)(l),d=Xa(l)||"image/png",n||w.warn(`Found app icon ${l}`)):(0,Ja.existsSync)(Yr)?(h=(0,Ja.readFileSync)(Yr),d=Xa(Yr)||"image/png",n||w.warn(`Found app icon ${Yr}`)):n||w.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:v}=await o.storage.from(`images/org/${u}/${s}`).upload(f,h,{contentType:d});if(v)throw n||console.error(v),n||w.error(`Could not add app ${W(v)}`),new Error(`Could not add app ${W(v)}`);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||w.error(`Could not add app ${W(g)}`),new Error(`Could not add app ${W(g)}`);return n||(w.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 dM(t,e,r=!1,n=!1){r||oe("Deleting"),e.apikey=e.apikey||ne();let i=await de(),s=Pe(t,i?.config);if(!e.apikey)throw r||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||w.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");{w.warn("Deleting the app is not recommended for users that are not the organization owner"),w.warn("You are invited as a super_admin but your are not the owner"),w.warn("It's strongly recommended that you do not continue!");let g=await yo({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(xt(g)||g==="no")throw w.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&w.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&&w.error("Could not delete app logo");let{error:d}=await o.storage.from(`apps/${s}/${a}`).remove(["versions"]);d&&!r&&w.error("Could not delete app version");let{error:f}=await o.from("apps").delete().eq("app_id",s);if(f)throw r||w.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||(w.success("App deleted in Capgo"),ce("Done \u2705")),!0}var Up=require("node:os"),mM=require("node:process");async function pM(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(i=>Rh(i)))).forEach((i,s)=>{i&&(e[r[s]]=i)}),e}async function Ale(){let t=await tl(),e={"@capgo/cli":ki.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function gM(t,e=!1){e||w.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=Pe("",r?.config),a=r?.config?.webDir||"";e||(w.info(` App Name: ${s}`),w.info(` App ID: ${o}`),w.info(` App Version: ${i}`),w.info(` Web Dir: ${a}`),w.info(` OS: ${(0,Up.platform)()} ${(0,Up.version)()}`),w.info(` Node: ${mM.version}`),w.info(" Installed Dependencies:"));let u=await Ale();if(Object.keys(u).length===0)throw e||w.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))w.info(` ${l}: ${u[l]}`);let c={};if(e)c=await pM(u);else{let l=Ft();l.start("Running: Loading latest dependencies"),c=await pM(u),l.stop("Latest Dependencies:");for(let h of Object.keys(c))w.info(` ${h}: ${c[h]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||w.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||w.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 Ole(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,Ya(r.created_at)]);w.success("Apps"),w.success(e.toString())}async function xle(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||w.error("Apps not found"),new Error("Apps not found");return r??[]}async function yM(t,e=!1){e||oe("List apps in Capgo"),await ze(),t.apikey=t.apikey||ne();let r=await pe(t.apikey,t.supaHost,t.supaAnon);await De(r,t.apikey,["write","all","read","upload"]),e||w.info("Getting active bundle in Capgo");let n=await xle(r,e);if(!n.length)throw e||w.error("No apps found"),new Error("No apps found");return e||(w.info(`Active app in Capgo: ${n.length}`),Ole(n),ce("Done \u2705")),n}var DM=require("node:crypto"),Za=require("node:fs");async function wM(t,e,r=!1){r||oe("Set app"),e.apikey=e.apikey||ne();let n=await de();if(t=Pe(t,n?.config),!e.apikey)throw r||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||w.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 jp(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||w.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||w.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||w.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,DM.randomUUID)()}`,m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,Za.existsSync)(c)?(h=(0,Za.readFileSync)(c),d=Xa(c)||"image/png",r||w.warn(`Found app icon ${c}`)):(0,Za.existsSync)(Yr)?(h=(0,Za.readFileSync)(Yr),d=Xa(Yr)||"image/png",r||w.warn(`Found app icon ${Yr}`)):r||w.warn(`Cannot find app icon in any of the following locations: ${c}, ${Yr}`),h&&d){let{error:v}=await i.storage.from(`images/org/${o}/${t}`).upload(f,h,{contentType:d});if(v)throw r||w.error(`Could not set app ${W(v)}`),new Error(`Could not set app: ${W(v)}`);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||w.error(`Could not set app ${W(g)}`),new Error(`Could not set app: ${W(g)}`);return r||ce("Done \u2705"),!0}async function vM(t,e,r=!1){if(r||oe("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||w.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||w.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||w.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||w.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 qa(n,!0),r||w.success(`Set "${t}" to "${o}"`)}catch(n){throw r||w.error(`Cannot set config in capacitor settings ${W(n)}`),new Error(`Cannot set capacitor config: ${W(n)}`)}r||ce("Done \u2705")}async function Tle(t,e,r,n){for await(let i of t)n||w.warn(`Removing ${i.name} created on ${Ya(i.created_at)}`),await Mp(e,r,i.name)}function Fle(t,e,r){let n=[];for(let i of t??[]){let s=Ct(i.name);Fm(s,e)&&Im(s,r)&&n.push(i)}return n}async function bM(t,e,r=!1){r||oe("Cleanup versions in Capgo"),await ze(),e.apikey=e.apikey||ne();let{bundle:n,keep:i=4}=e,s=e.force||!1,o=e.ignoreChannel||!1,a=await de();if(t=Pe(t,a?.config),!e.apikey)throw r||w.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||w.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||w.info("Querying all available versions in Capgo");let c=await qp(u,t),l=await lM(u,t);if(r||w.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||w.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let f=Ct(n),m=u_(f,"major");r||w.info(`Querying available versions in Capgo between ${bi(f)} and ${bi(m)}`),c=Fle(c,f,m),r||w.info(`Active versions in Capgo between ${bi(f)} and ${bi(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||w.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:d};if(r||cM(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 w.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||w.success("You have confirmed removal, removing versions now"),await Tle(h,u,t,r),r||ce("Done \u2705"),{removed:h.length,kept:d}}async function EM(t,e,r=!1){r||oe("Check compatibility");let n={...e,apikey:e.apikey||ne()},i=await de(),s=Pe(t,i?.config),o=n.channel;if(!o)throw r||w.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||w.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 Bp(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,v=no(d)?l:h;c.rows.push([f,m,g,v])}w.success("Compatibility"),w.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}var pi=require("node:fs");var ns=require("node:buffer"),qt=require("node:crypto"),_M="aes-128-cbc",di="base64",Hp=qt.constants.RSA_PKCS1_PADDING;function Vp(t){let e=(0,qt.randomBytes)(16),r=(0,qt.randomBytes)(16),n=e.toString(di),i=(0,qt.privateEncrypt)({key:t,padding:Hp},r).toString(di);return{sessionKey:r,ivSessionKey:`${n}:${i}`}}function Qa(t,e,r){let[n]=r.split(":"),i=ns.Buffer.from(n,di),s=(0,qt.createCipheriv)(_M,e,i);return s.setAutoPadding(!0),ns.Buffer.concat([s.update(t),s.final()])}function CM(t,e,r){let[n,i]=e.split(":"),s=(0,qt.publicDecrypt)({key:r,padding:Hp},ns.Buffer.from(i,di)),o=ns.Buffer.from(n,di),a=(0,qt.createDecipheriv)(_M,s,o);return a.setAutoPadding(!0),ns.Buffer.concat([a.update(t),a.final()])}function eu(t,e){return(0,qt.privateEncrypt)({key:e,padding:Hp},ns.Buffer.from(t,di)).toString(di)}function SM(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 AM(t,e){return(0,qt.publicDecrypt)({key:e,padding:Hp},ns.Buffer.from(t,di)).toString(di)}function Ile(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 OM(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||w.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||w.error(h),new Error(h)}let{publicKey:s,fallbackKeyPath:o}=Ile(r,i);if(!s){let h=`Cannot find public key ${o} or as keyData option or in ${i.path}`;throw n||w.error(h),new Error(h)}let a=(0,pi.readFileSync)(t),u=CM(a,e,r.keyData??s),c=`${t}_decrypted.zip`;(0,pi.writeFileSync)(c,u),n||w.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let h=await Yn(u,"sha256"),d=AM(r.checksum,r.keyData??s);if(l=h===d,!l){let f=`Checksum does not match ${h} !== ${d}`;throw n||w.error(f),new Error(f)}n||w.info("Checksum matches")}return n||ce("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(i){throw n||w.error(`Error decrypting zip file ${W(i)}`),i instanceof Error?i:new Error(String(i))}}async function xM(t,e,r,n=!1){n||oe("Delete bundle"),r.apikey=r.apikey||ne();let i=await de();if(e=Pe(e,i?.config),!r.apikey)throw n||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||w.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||w.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||(w.info(`Deleting bundle ${e}@${t} from Capgo`),w.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await Mp(s,e,t),n||(w.success(`Bundle ${e}@${t} deleted in Capgo`),ce("Done")),!0}var mi=require("node:fs");function rl(t){console.error(W(t))}async function TM(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&&w.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?rl({error:"zip_not_found"}):w.error(`Error: ${S}`)),new Error(S)}if(!u)throw n||(i?rl({error:"missing_public_key"}):w.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?rl({error:"missing_key"}):(w.warning(`Cannot find a private key at ${c} or as a keyData option`),w.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?rl({error:"invalid_private_key"}):w.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}=Vp(l),m=Qa(h,d,f),g=eu(e,l),v=`${t}_encrypted.zip`;return(0,mi.writeFileSync)(v,m),n||(i?console.log(JSON.stringify({checksum:g,filename:v,ivSessionKey:f},null,2)):(w.success(`Encoded Checksum: ${g}`),w.success(`ivSessionKey: ${f}`),w.success(`Encrypted zip saved at ${v}`),ce("Done \u2705"))),{checksum:g,filename:v,ivSessionKey:f}}catch(o){throw n||(r.json?rl(o):w.error(`Error encrypting zip file ${W(o)}`)),o instanceof Error?o:new Error(String(o))}}var rq=require("node:crypto"),ho=require("node:fs"),AE=require("node:process");var zp=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 is(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{},nl=class extends Ln{},Gp=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}},ss=class extends Ln{constructor(){super("accessKey is required")}},tu=class extends Ln{constructor(){super("secretKey is required")}},il=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 FM(t){try{let r=is(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 IM(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function kM(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 os(t){return!(!kle(t)||t.length===0)}function kle(t){return!(typeof t!="string"||t.length>1024)}function sl(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function io(t=""){let e={'"':"",""":"",""":"",""":"",""":""};return t.replace(/^("|"|")|("|"|")$/g,r=>e[r])}function nE(t){return t.get("x-amz-version-id")??null}function so(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 iE(t){return so(t).slice(0,8)}function sE(t,e){return`${iE(e)}/${t}/s3/aws4_request`}async function Kp(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),sl(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var Ple=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],Wp=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:io(A.headers.get("etag")??void 0),versionId:nE(A.headers)};return}g===1&&(u=(await Rle({client:e,bucketName:r,objectName:n,metadata:s})).uploadId);let v={"Content-Length":String(d.length)};for(let A of Ple){let p=s[A];p&&(v[A]=p)}let S=e.makeRequest({method:"PUT",query:{partNumber:g.toString(),uploadId:u},headers:new Headers(v),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(v){throw v}},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 Nle({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 Rle(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=is(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 Nle({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||w.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${K(i)}`);return n}async function tE(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||w.error(o),new Error(`${o}: ${K(s)}`)}}async function Mp(t,e,r,n={}){let{silent:i=!1,autoUnlink:s=!1}=n,o=await Ele(t,e,r,{silent:i});await tM(t,e,o,{silent:i,autoUnlink:s}),await tE(t,e,r,{silent:i})}function cM(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,Ya(n.created_at),n.keep??""]);w.success("Bundles"),w.success(r.toString())}async function qp(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||w.error(o),new Error(`${o}: ${K(s)}`)}return i??[]}async function lM(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||w.error(o),new Error(`${o}: ${K(s)}`)}return(i??[]).map(o=>o.version)}async function Ele(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||w.error(a),new Error(`${a}${o?`: ${K(o)}`:""}`)}return s}var Ja=require("node:fs");async function fM(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 U8(t,e,r);if(!o.okay)switch(o.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw i||w.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||w.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw i||w.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||w.error(c),new Error(c)}return o.data}var Yr="assets/icon.png";var _le=/^[a-z0-9]+(\.[\w-]+)+$/i;function Cle(t,e,r){if(!e.apikey)throw r||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||w.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||w.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!_le.test(t))throw r||(w.error(`Invalid app ID format: "${t}"`),w.info("App ID must be in reverse domain notation (e.g., com.example.app)"),w.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),w.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function Sle(t,e,r){if(await fM(t,e))throw e==="io.ionic.starter"?(r||w.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||w.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function hM(t,e,r,n=!1){n||oe("Adding"),await ze(),e.apikey=e.apikey||ne();let i=await de(),s=Pe(t,i?.config);Cle(s,e,n);let o=await pe(e.apikey,e.supaHost,e.supaAnon),a=await De(o,e.apikey,["write","all"]);await Sle(o,s,n),r||(r=await jp(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||w.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||w.info(`Adding ${s} to Capgo`);let h=null,d=null;l&&(0,Ja.existsSync)(l)?(h=(0,Ja.readFileSync)(l),d=Xa(l)||"image/png",n||w.warn(`Found app icon ${l}`)):(0,Ja.existsSync)(Yr)?(h=(0,Ja.readFileSync)(Yr),d=Xa(Yr)||"image/png",n||w.warn(`Found app icon ${Yr}`)):n||w.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:v}=await o.storage.from(`images/org/${u}/${s}`).upload(f,h,{contentType:d});if(v)throw n||console.error(v),n||w.error(`Could not add app ${K(v)}`),new Error(`Could not add app ${K(v)}`);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||w.error(`Could not add app ${K(g)}`),new Error(`Could not add app ${K(g)}`);return n||(w.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 dM(t,e,r=!1,n=!1){r||oe("Deleting"),e.apikey=e.apikey||ne();let i=await de(),s=Pe(t,i?.config);if(!e.apikey)throw r||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||w.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");{w.warn("Deleting the app is not recommended for users that are not the organization owner"),w.warn("You are invited as a super_admin but your are not the owner"),w.warn("It's strongly recommended that you do not continue!");let g=await yo({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(xt(g)||g==="no")throw w.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&w.warn(`Cannot get the app owner ${K(c)}`);let{error:h}=await o.storage.from("images").remove([`org/${l?.owner_org.id}/${s}/icon`]);h&&!r&&w.error("Could not delete app logo");let{error:d}=await o.storage.from(`apps/${s}/${a}`).remove(["versions"]);d&&!r&&w.error("Could not delete app version");let{error:f}=await o.from("apps").delete().eq("app_id",s);if(f)throw r||w.error("Could not delete app"),new Error(`Could not delete app: ${K(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||(w.success("App deleted in Capgo"),ce("Done \u2705")),!0}var Up=require("node:os"),mM=require("node:process");async function pM(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(i=>Rh(i)))).forEach((i,s)=>{i&&(e[r[s]]=i)}),e}async function Ale(){let t=await tl(),e={"@capgo/cli":ki.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function gM(t,e=!1){e||w.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=Pe("",r?.config),a=r?.config?.webDir||"";e||(w.info(` App Name: ${s}`),w.info(` App ID: ${o}`),w.info(` App Version: ${i}`),w.info(` Web Dir: ${a}`),w.info(` OS: ${(0,Up.platform)()} ${(0,Up.version)()}`),w.info(` Node: ${mM.version}`),w.info(" Installed Dependencies:"));let u=await Ale();if(Object.keys(u).length===0)throw e||w.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))w.info(` ${l}: ${u[l]}`);let c={};if(e)c=await pM(u);else{let l=Ft();l.start("Running: Loading latest dependencies"),c=await pM(u),l.stop("Latest Dependencies:");for(let h of Object.keys(c))w.info(` ${h}: ${c[h]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||w.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||w.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 Ole(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,Ya(r.created_at)]);w.success("Apps"),w.success(e.toString())}async function xle(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||w.error("Apps not found"),new Error("Apps not found");return r??[]}async function yM(t,e=!1){e||oe("List apps in Capgo"),await ze(),t.apikey=t.apikey||ne();let r=await pe(t.apikey,t.supaHost,t.supaAnon);await De(r,t.apikey,["write","all","read","upload"]),e||w.info("Getting active bundle in Capgo");let n=await xle(r,e);if(!n.length)throw e||w.error("No apps found"),new Error("No apps found");return e||(w.info(`Active app in Capgo: ${n.length}`),Ole(n),ce("Done \u2705")),n}var DM=require("node:crypto"),Za=require("node:fs");async function wM(t,e,r=!1){r||oe("Set app"),e.apikey=e.apikey||ne();let n=await de();if(t=Pe(t,n?.config),!e.apikey)throw r||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||w.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 jp(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||w.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||w.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||w.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,DM.randomUUID)()}`,m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,Za.existsSync)(c)?(h=(0,Za.readFileSync)(c),d=Xa(c)||"image/png",r||w.warn(`Found app icon ${c}`)):(0,Za.existsSync)(Yr)?(h=(0,Za.readFileSync)(Yr),d=Xa(Yr)||"image/png",r||w.warn(`Found app icon ${Yr}`)):r||w.warn(`Cannot find app icon in any of the following locations: ${c}, ${Yr}`),h&&d){let{error:v}=await i.storage.from(`images/org/${o}/${t}`).upload(f,h,{contentType:d});if(v)throw r||w.error(`Could not set app ${K(v)}`),new Error(`Could not set app: ${K(v)}`);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||w.error(`Could not set app ${K(g)}`),new Error(`Could not set app: ${K(g)}`);return r||ce("Done \u2705"),!0}async function vM(t,e,r=!1){if(r||oe("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||w.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||w.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||w.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||w.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 qa(n,!0),r||w.success(`Set "${t}" to "${o}"`)}catch(n){throw r||w.error(`Cannot set config in capacitor settings ${K(n)}`),new Error(`Cannot set capacitor config: ${K(n)}`)}r||ce("Done \u2705")}async function Tle(t,e,r,n){for await(let i of t)n||w.warn(`Removing ${i.name} created on ${Ya(i.created_at)}`),await Mp(e,r,i.name)}function Fle(t,e,r){let n=[];for(let i of t??[]){let s=Ct(i.name);Fm(s,e)&&Im(s,r)&&n.push(i)}return n}async function bM(t,e,r=!1){r||oe("Cleanup versions in Capgo"),await ze(),e.apikey=e.apikey||ne();let{bundle:n,keep:i=4}=e,s=e.force||!1,o=e.ignoreChannel||!1,a=await de();if(t=Pe(t,a?.config),!e.apikey)throw r||w.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||w.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||w.info("Querying all available versions in Capgo");let c=await qp(u,t),l=await lM(u,t);if(r||w.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||w.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let f=Ct(n),m=u_(f,"major");r||w.info(`Querying available versions in Capgo between ${bi(f)} and ${bi(m)}`),c=Fle(c,f,m),r||w.info(`Active versions in Capgo between ${bi(f)} and ${bi(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||w.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:d};if(r||cM(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 w.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||w.success("You have confirmed removal, removing versions now"),await Tle(h,u,t,r),r||ce("Done \u2705"),{removed:h.length,kept:d}}async function EM(t,e,r=!1){r||oe("Check compatibility");let n={...e,apikey:e.apikey||ne()},i=await de(),s=Pe(t,i?.config),o=n.channel;if(!o)throw r||w.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||w.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 Bp(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,v=no(d)?l:h;c.rows.push([f,m,g,v])}w.success("Compatibility"),w.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}var pi=require("node:fs");var ns=require("node:buffer"),qt=require("node:crypto"),_M="aes-128-cbc",di="base64",Hp=qt.constants.RSA_PKCS1_PADDING;function Vp(t){let e=(0,qt.randomBytes)(16),r=(0,qt.randomBytes)(16),n=e.toString(di),i=(0,qt.privateEncrypt)({key:t,padding:Hp},r).toString(di);return{sessionKey:r,ivSessionKey:`${n}:${i}`}}function Qa(t,e,r){let[n]=r.split(":"),i=ns.Buffer.from(n,di),s=(0,qt.createCipheriv)(_M,e,i);return s.setAutoPadding(!0),ns.Buffer.concat([s.update(t),s.final()])}function CM(t,e,r){let[n,i]=e.split(":"),s=(0,qt.publicDecrypt)({key:r,padding:Hp},ns.Buffer.from(i,di)),o=ns.Buffer.from(n,di),a=(0,qt.createDecipheriv)(_M,s,o);return a.setAutoPadding(!0),ns.Buffer.concat([a.update(t),a.final()])}function eu(t,e){return(0,qt.privateEncrypt)({key:e,padding:Hp},ns.Buffer.from(t,di)).toString(di)}function SM(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 AM(t,e){return(0,qt.publicDecrypt)({key:e,padding:Hp},ns.Buffer.from(t,di)).toString(di)}function Ile(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 OM(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||w.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||w.error(h),new Error(h)}let{publicKey:s,fallbackKeyPath:o}=Ile(r,i);if(!s){let h=`Cannot find public key ${o} or as keyData option or in ${i.path}`;throw n||w.error(h),new Error(h)}let a=(0,pi.readFileSync)(t),u=CM(a,e,r.keyData??s),c=`${t}_decrypted.zip`;(0,pi.writeFileSync)(c,u),n||w.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let h=await Yn(u,"sha256"),d=AM(r.checksum,r.keyData??s);if(l=h===d,!l){let f=`Checksum does not match ${h} !== ${d}`;throw n||w.error(f),new Error(f)}n||w.info("Checksum matches")}return n||ce("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(i){throw n||w.error(`Error decrypting zip file ${K(i)}`),i instanceof Error?i:new Error(String(i))}}async function xM(t,e,r,n=!1){n||oe("Delete bundle"),r.apikey=r.apikey||ne();let i=await de();if(e=Pe(e,i?.config),!r.apikey)throw n||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||w.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||w.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||(w.info(`Deleting bundle ${e}@${t} from Capgo`),w.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await Mp(s,e,t),n||(w.success(`Bundle ${e}@${t} deleted in Capgo`),ce("Done")),!0}var mi=require("node:fs");function rl(t){console.error(K(t))}async function TM(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&&w.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?rl({error:"zip_not_found"}):w.error(`Error: ${S}`)),new Error(S)}if(!u)throw n||(i?rl({error:"missing_public_key"}):w.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?rl({error:"missing_key"}):(w.warning(`Cannot find a private key at ${c} or as a keyData option`),w.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?rl({error:"invalid_private_key"}):w.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}=Vp(l),m=Qa(h,d,f),g=eu(e,l),v=`${t}_encrypted.zip`;return(0,mi.writeFileSync)(v,m),n||(i?console.log(JSON.stringify({checksum:g,filename:v,ivSessionKey:f},null,2)):(w.success(`Encoded Checksum: ${g}`),w.success(`ivSessionKey: ${f}`),w.success(`Encrypted zip saved at ${v}`),ce("Done \u2705"))),{checksum:g,filename:v,ivSessionKey:f}}catch(o){throw n||(r.json?rl(o):w.error(`Error encrypting zip file ${K(o)}`)),o instanceof Error?o:new Error(String(o))}}var rq=require("node:crypto"),ho=require("node:fs"),AE=require("node:process");var zp=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 is(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{},nl=class extends Ln{},Gp=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}},ss=class extends Ln{constructor(){super("accessKey is required")}},tu=class extends Ln{constructor(){super("secretKey is required")}},il=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 FM(t){try{let r=is(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 IM(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function kM(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 os(t){return!(!kle(t)||t.length===0)}function kle(t){return!(typeof t!="string"||t.length>1024)}function sl(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function io(t=""){let e={'"':"",""":"",""":"",""":"",""":""};return t.replace(/^("|"|")|("|"|")$/g,r=>e[r])}function nE(t){return t.get("x-amz-version-id")??null}function so(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 iE(t){return so(t).slice(0,8)}function sE(t,e){return`${iE(e)}/${t}/s3/aws4_request`}async function Kp(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),sl(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var Ple=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],Wp=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:io(A.headers.get("etag")??void 0),versionId:nE(A.headers)};return}g===1&&(u=(await Rle({client:e,bucketName:r,objectName:n,metadata:s})).uploadId);let v={"Content-Length":String(d.length)};for(let A of Ple){let p=s[A];p&&(v[A]=p)}let S=e.makeRequest({method:"PUT",query:{partNumber:g.toString(),uploadId:u},headers:new Headers(v),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(v){throw v}},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 Nle({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 Rle(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=is(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 Nle({client:t,bucketName:e,objectName:r,uploadId:n,etags:i}){let s=`
|
|
320
320
|
<CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
321
321
|
${i.map(h=>` <Part><PartNumber>${h.part}</PartNumber><ETag>${h.etag}</ETag></Part>`).join(`
|
|
322
322
|
`)}
|
|
@@ -325,22 +325,22 @@ ${W(s)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${W(s)}`)}fun
|
|
|
325
325
|
`)+`
|
|
326
326
|
`,n.join(";").toLowerCase(),i].join(`
|
|
327
327
|
`)}async function LM(t,e,r){let n=await Kp(t),i=sE(r,e);return[ol,so(e),i,n].join(`
|
|
328
|
-
`)}async function aE(t,e,r){let n=iE(t),i=await ao("AWS4"+r,n),s=await ao(i,e),o=await ao(s,"s3");return await ao(o,"aws4_request")}function uE(t,e,r){return`${t}/${sE(e,r)}`}async function ao(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 jM(t){if(!t.accessKey)throw new ss;if(!t.secretKey)throw new tu;if(t.expirySeconds<1||t.expirySeconds>604800)throw new il;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=uE(t.accessKey,t.region,t.date),n=so(t.date),i={"X-Amz-Algorithm":ol,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},s=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":ol},{"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 aE(t.date,t.region,t.secretKey),h=sl(await ao(l,c)).toLowerCase();return i["X-Amz-Signature"]=h,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:i}}var Lle=["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"],jle=5*1024*1024,Ble=5*1024*1024*1024,cE=5*1024*1024*1024*1024,al=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 nl(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new nl(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!IM(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||!kM(r))throw new Gp(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 Kp(r??new Uint8Array);s.set("x-amz-date",so(i)),s.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&s.set("x-amz-security-token",this.sessionToken),s.set("authorization",await PM({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 FM(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(!os(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(!os(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 ss;if(!os(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 RM({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=is(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:io(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,v=m.type==="Object"?m.key:m.prefix;return g>v?1:g<v?-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(!os(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<jle)throw new Yt("Part size should be greater than 5MB");if(a>Ble)throw new Yt("Part size should be less than 6MB");let u=new zp(a),c=new Wp({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=cE),e>cE)throw new TypeError(`size should not be more than ${cE}`);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(!os(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 Lle)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:io(s.headers.get("ETag")??"")}}async copyObject(e,r,n){let i=this.getBucketName(n),s=e.sourceBucketName??i;if(!os(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=is(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:io(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(!os(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 jM({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 uo=require("node:fs"),Xp=require("node:path");function Mle(t,e){return(0,uo.readFileSync)(t,"utf8").includes(e)}function ul(t,e){let r=(0,uo.readdirSync)(t);for(let n of r){let i=(0,Xp.join)(t,n),s=(0,uo.statSync)(i);if(s.isDirectory()){if(ul(i,e))return!0}else if(s.isFile()&&(0,Xp.extname)(i)===".js"&&Mle(i,e))return!0}return!1}function Yp(t){return(0,uo.readdirSync)(t).indexOf("index.html")>-1}var iu=require("node:fs"),K6=require("node:os"),fo=require("node:path"),W6=require("node:process"),im=require("node:stream/consumers"),X6=require("node:zlib");var Y6=xe(G6()),J6=xe(i0());async function the(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var rhe=8192,Z6="6.25.0",Q6="7.0.35";async function nhe(t){let e=Xr((0,W6.cwd)()),r=await ro("@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(Z6)),s=n.major>=7&&Ei(n,Ct(Q6)),o=i||s;return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:o}}function ihe(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:Y6.isMatch(t,r)}async function she(t,e,r){let i=(0,iu.statSync)(t).size,s=await(0,im.buffer)((0,iu.createReadStream)(t));if(i===0)return{buffer:s,useBrotli:!1};if(ihe(e,r.noBrotliPatterns))return w.info(`Skipping brotli for excluded file: ${e}`),{buffer:s,useBrotli:!1};if(i<rhe)return{buffer:s,useBrotli:!1};try{let o=await(0,im.buffer)((0,iu.createReadStream)(t).pipe((0,X6.createBrotliCompress)({})));return o.length>=i-10?{buffer:s,useBrotli:!1}:{buffer:o,useBrotli:!0}}catch(o){return w.warn(`Brotli compression failed for ${t}: ${o}, using original file`),{buffer:s,useBrotli:!1}}}async function eq(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 W8(t);if(i==="v2")for(let u of a)u.hash=eu(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 ohe(t){return(0,K6.platform)()!=="win32"?t:fo.win32.normalize(t).split(fo.win32.sep).join(fo.posix.sep)}function ahe(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&w.warn(`File "${t}" contains spaces in its name.`),e}async function tq(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 nhe(o);if(d)o.disableBrotli?w.info("Brotli compression disabled by user request"):o.noBrotliPatterns&&w.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 ${Z6} (v6) or ${Q6} (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,v=0;try{a.message(`Uploading ${g} files using TUS protocol`);let S=e.map(async D=>{let C=(0,fo.join)(r,D.file),k=ohe(D.file),E,R=!1;if(o.disableBrotli)E=await(0,im.buffer)((0,iu.createReadStream)(C)),R=!1;else{let G=await she(C,k,o);E=G.buffer,R=G.useBrotli}let P=E;s&&(P=Qa(E,s.sessionKey,s.ivSessionKey));let F=k;R&&(F=`${k}.br`,v++);let B=ahe(F),U=`orgs/${i}/apps/${n}/delta/${D.hash}_${B}`;return await the(c,U)?(m++,Promise.resolve({file_name:B,s3_path:U,file_hash:D.hash})):new Promise((G,L)=>{let _=0,T=3,I=()=>{a.message(`Prepare upload partial file: ${k}`),new J6.Upload(P,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:o.tusChunkSize,retryDelays:[0,1e3,3e3,5e3],removeFingerprintOnSuccess:!0,metadata:{filename:U},headers:{Authorization:t},onError:async M=>{let j=M.toString(),K;try{let V=j.match(/response text: (\{.*?\})/);V&&V[1]&&(K=JSON.parse(V[1]).moreInfo?.requestId)}catch{}let q=K?` [requestId: ${K}]`:"";if(j.includes("offset")||j.includes("409")||j.includes("conflict"))if(_++,_<=T){w.warn(`Offset mismatch for ${k}, retrying (attempt ${_}/${T})...${q}`),await new Promise(V=>setTimeout(V,1e3*_)),I();return}else w.error(`Failed to upload ${k} after ${T} retries due to offset errors${q}`),w.info("This may happen if the upload expired or there was a network issue. The file will be skipped.");else w.error(`Failed to upload ${k}: ${j}${q}`);L(M)},onProgress(){let M=(m/g*100).toFixed(2);a.message(`Uploading partial update: ${M}%`)},onSuccess(){m++,G({file_name:B,s3_path:U,file_hash:D.hash})}}).start()};I()})}),A=await Promise.all(S),y=((performance.now()-u)/1e3).toFixed(2);return a.stop(`Partial update uploaded successfully \u{1F4AA} in (${y} seconds)`),v>0&&w.info(`${v} of ${g} files were compressed with brotli and use .br extension`),await Ae(t,{channel:"app",event:`App Partial TUS done${v>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:y},notify:!1}),A}catch(S){let p=((performance.now()-u)/1e3).toFixed(2);if(a.stop(`Failed to upload Partial bundle (after ${p} seconds)`),l)throw w.error(`Error uploading partial update: ${S}`),w.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),S;return w.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 w.error(t),new Error(t)}async function uhe(t,e){let r=rs("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,rq.randomUUID)().split("-")[0]}`;return Ka.test(n)||Dt(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function che(t){let e=t.apikey||ne();return e||Dt("Missing API key, you need to provide an API key to upload your bundle"),e}function lhe(t,e,r){let n=Pe(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,ho.existsSync)(i)||Dt(`Path ${i} does not exist, build your app first, or provide a valid path`),{appid:n,path:i}}function fhe(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(ul(e,"notifyAppReady")||Dt(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
|
|
329
|
-
If you are sure your app has this code, you can use the --no-code-check option`),Yp(e)||Dt(`index.html is missing in the root folder of ${e}`))}async function hhe(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 v=Ft();v.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:S,localDependencies:A}=await Bp(t,i,n,r.packageJson,r.nodeModules);if(f=S,d=A,f.find(p=>!no(p)))v.stop(`Bundle NOT compatible with ${n} channel`),w.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),a&&(u=s,w.info(`Auto set min-update-version to ${u}`));else if(a)try{let{min_update_version:p}=c.version;(!p||!Ka.test(p))&&Dt("Invalid remote min update version, skipping auto setting compatibility"),u=p,v.stop(`Auto set min-update-version to ${u}`)}catch{Dt(`Cannot auto set compatibility, invalid data ${c}`)}else v.stop(`Bundle compatible with ${n} channel`)}else o||(w.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),d=await Zb(r.packageJson,r.nodeModules),a&&(u=s,w.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&&(Ka.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(v=>!!v.native&&v.native!==void 0).map(v=>[v.name,v])):new Map;return{nativePackages:m.size>0||!r.ignoreMetadataCheck?Array.from(m,([v,S])=>({name:v,version:S.version})):void 0,minUpdateVersion:u}}async function dhe(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 w.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 ${
|
|
328
|
+
`)}async function aE(t,e,r){let n=iE(t),i=await ao("AWS4"+r,n),s=await ao(i,e),o=await ao(s,"s3");return await ao(o,"aws4_request")}function uE(t,e,r){return`${t}/${sE(e,r)}`}async function ao(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 jM(t){if(!t.accessKey)throw new ss;if(!t.secretKey)throw new tu;if(t.expirySeconds<1||t.expirySeconds>604800)throw new il;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=uE(t.accessKey,t.region,t.date),n=so(t.date),i={"X-Amz-Algorithm":ol,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},s=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":ol},{"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 aE(t.date,t.region,t.secretKey),h=sl(await ao(l,c)).toLowerCase();return i["X-Amz-Signature"]=h,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:i}}var Lle=["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"],jle=5*1024*1024,Ble=5*1024*1024*1024,cE=5*1024*1024*1024*1024,al=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 nl(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new nl(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!IM(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||!kM(r))throw new Gp(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 Kp(r??new Uint8Array);s.set("x-amz-date",so(i)),s.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&s.set("x-amz-security-token",this.sessionToken),s.set("authorization",await PM({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 FM(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(!os(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(!os(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 ss;if(!os(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 RM({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=is(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:io(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,v=m.type==="Object"?m.key:m.prefix;return g>v?1:g<v?-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(!os(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<jle)throw new Yt("Part size should be greater than 5MB");if(a>Ble)throw new Yt("Part size should be less than 6MB");let u=new zp(a),c=new Wp({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=cE),e>cE)throw new TypeError(`size should not be more than ${cE}`);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(!os(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 Lle)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:io(s.headers.get("ETag")??"")}}async copyObject(e,r,n){let i=this.getBucketName(n),s=e.sourceBucketName??i;if(!os(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=is(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:io(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(!os(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 jM({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 uo=require("node:fs"),Xp=require("node:path");function Mle(t,e){return(0,uo.readFileSync)(t,"utf8").includes(e)}function ul(t,e){let r=(0,uo.readdirSync)(t);for(let n of r){let i=(0,Xp.join)(t,n),s=(0,uo.statSync)(i);if(s.isDirectory()){if(ul(i,e))return!0}else if(s.isFile()&&(0,Xp.extname)(i)===".js"&&Mle(i,e))return!0}return!1}function Yp(t){return(0,uo.readdirSync)(t).indexOf("index.html")>-1}var iu=require("node:fs"),K6=require("node:os"),fo=require("node:path"),W6=require("node:process"),im=require("node:stream/consumers"),X6=require("node:zlib");var Y6=xe(G6()),J6=xe(i0());async function the(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var rhe=8192,Z6="6.25.0",Q6="7.0.35";async function nhe(t){let e=Xr((0,W6.cwd)()),r=await ro("@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(Z6)),s=n.major>=7&&Ei(n,Ct(Q6)),o=i||s;return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:o}}function ihe(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:Y6.isMatch(t,r)}async function she(t,e,r){let i=(0,iu.statSync)(t).size,s=await(0,im.buffer)((0,iu.createReadStream)(t));if(i===0)return{buffer:s,useBrotli:!1};if(ihe(e,r.noBrotliPatterns))return w.info(`Skipping brotli for excluded file: ${e}`),{buffer:s,useBrotli:!1};if(i<rhe)return{buffer:s,useBrotli:!1};try{let o=await(0,im.buffer)((0,iu.createReadStream)(t).pipe((0,X6.createBrotliCompress)({})));return o.length>=i-10?{buffer:s,useBrotli:!1}:{buffer:o,useBrotli:!0}}catch(o){return w.warn(`Brotli compression failed for ${t}: ${o}, using original file`),{buffer:s,useBrotli:!1}}}async function eq(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 W8(t);if(i==="v2")for(let u of a)u.hash=eu(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 ohe(t){return(0,K6.platform)()!=="win32"?t:fo.win32.normalize(t).split(fo.win32.sep).join(fo.posix.sep)}function ahe(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&w.warn(`File "${t}" contains spaces in its name.`),e}async function tq(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 nhe(o);if(d)o.disableBrotli?w.info("Brotli compression disabled by user request"):o.noBrotliPatterns&&w.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 ${Z6} (v6) or ${Q6} (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,v=0;try{a.message(`Uploading ${g} files using TUS protocol`);let S=e.map(async D=>{let C=(0,fo.join)(r,D.file),k=ohe(D.file),E,R=!1;if(o.disableBrotli)E=await(0,im.buffer)((0,iu.createReadStream)(C)),R=!1;else{let G=await she(C,k,o);E=G.buffer,R=G.useBrotli}let P=E;s&&(P=Qa(E,s.sessionKey,s.ivSessionKey));let F=k;R&&(F=`${k}.br`,v++);let j=ahe(F),U=`orgs/${i}/apps/${n}/delta/${D.hash}_${j}`;return await the(c,U)?(m++,Promise.resolve({file_name:j,s3_path:U,file_hash:D.hash})):new Promise((G,L)=>{a.message(`Prepare upload partial file: ${k}`),new J6.Upload(P,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:o.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:U},headers:{Authorization:t},onError:T=>{let I=T.toString(),$;try{let B=I.match(/response text: (\{.*?\})/);B&&B[1]&&($=JSON.parse(B[1]).moreInfo?.requestId)}catch{}let M=$?` [requestId: ${$}]`:"";w.error(`Failed to upload ${k}: ${I}${M}`),L(T)},onProgress(){let T=(m/g*100).toFixed(2);a.message(`Uploading partial update: ${T}%`)},onSuccess(){m++,G({file_name:j,s3_path:U,file_hash:D.hash})}}).start()})}),A=await Promise.all(S),y=((performance.now()-u)/1e3).toFixed(2);return a.stop(`Partial update uploaded successfully \u{1F4AA} in (${y} seconds)`),v>0&&w.info(`${v} of ${g} files were compressed with brotli and use .br extension`),await Ae(t,{channel:"app",event:`App Partial TUS done${v>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:y},notify:!1}),A}catch(S){let p=((performance.now()-u)/1e3).toFixed(2);if(a.stop(`Failed to upload Partial bundle (after ${p} seconds)`),l)throw w.error(`Error uploading partial update: ${S}`),w.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),S;return w.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 w.error(t),new Error(t)}async function uhe(t,e){let r=rs("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,rq.randomUUID)().split("-")[0]}`;return Ka.test(n)||Dt(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function che(t){let e=t.apikey||ne();return e||Dt("Missing API key, you need to provide an API key to upload your bundle"),e}function lhe(t,e,r){let n=Pe(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,ho.existsSync)(i)||Dt(`Path ${i} does not exist, build your app first, or provide a valid path`),{appid:n,path:i}}function fhe(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(ul(e,"notifyAppReady")||Dt(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
|
|
329
|
+
If you are sure your app has this code, you can use the --no-code-check option`),Yp(e)||Dt(`index.html is missing in the root folder of ${e}`))}async function hhe(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 v=Ft();v.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:S,localDependencies:A}=await Bp(t,i,n,r.packageJson,r.nodeModules);if(f=S,d=A,f.find(p=>!no(p)))v.stop(`Bundle NOT compatible with ${n} channel`),w.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),a&&(u=s,w.info(`Auto set min-update-version to ${u}`));else if(a)try{let{min_update_version:p}=c.version;(!p||!Ka.test(p))&&Dt("Invalid remote min update version, skipping auto setting compatibility"),u=p,v.stop(`Auto set min-update-version to ${u}`)}catch{Dt(`Cannot auto set compatibility, invalid data ${c}`)}else v.stop(`Bundle compatible with ${n} channel`)}else o||(w.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),d=await Zb(r.packageJson,r.nodeModules),a&&(u=s,w.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&&(Ka.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(v=>!!v.native&&v.native!==void 0).map(v=>[v.name,v])):new Map;return{nativePackages:m.size>0||!r.ignoreMetadataCheck?Array.from(m,([v,S])=>({name:v,version:S.version})):void 0,minUpdateVersion:u}}async function dhe(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 w.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 ${K(s)}`)}return!1}async function phe(t,e,r,n,i,s,o){let a,u,c="",l=null,h="none",d="",f=e.keyV2,m=e.key===!1;l=await $p(t);let g=Ft();g.start("Calculating checksum");let v=Xr((0,AE.cwd)()),S=await ro("@capgo/capacitor-updater",v,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:../")&&(w.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,ho.existsSync)(Ir))&&!m||A?c=await Yn(l,"sha256"):c=await Yn(l,"crc32"),g.stop(`Checksum ${A?"SHA256":"CRC32"}: ${c}`),m)w.info("Encryption ignored");else if((f||(0,ho.existsSync)(Ir)||e.keyDataV2)&&!e.oldEncryption){let C=typeof f=="string"?f:Ir,k=e.keyDataV2||"";!k&&!(0,ho.existsSync)(C)&&Dt(`Cannot find private key ${C}`),await Ae(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":i},notify:!1},e.verbose),k||(k=(0,ho.readFileSync)(C).toString()),w.info("Encrypting your bundle with V2");let{sessionKey:E,ivSessionKey:R}=Vp(k),P=Qa(l,E,R);c=eu(c,k),a=R,u=E,h="v2",d=k,e.displayIvSession&&w.info(`Your Iv Session key is ${a},
|
|
330
330
|
keep it safe, you will need it to decrypt your bundle.
|
|
331
331
|
It will be also visible in your dashboard
|
|
332
332
|
`),l=P}let y=Math.floor((l?.byteLength??0)/1024/1024),D=Math.floor(s/1024/1024);return l?.byteLength>s?Dt(`The bundle size is ${y} Mb, this is greater than the maximum upload length ${D} Mb, please reduce the size of your bundle`):l?.byteLength>o?(w.warn(`WARNING !!
|
|
333
333
|
The bundle size is ${y} Mb, this may take a while to download for users
|
|
334
334
|
`),w.info(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
|
|
335
335
|
`),e.verbose&&(w.info("[Verbose] Bundle size details:"),w.info(` - Actual size: ${y} MB (${l?.byteLength} bytes)`),w.info(` - Alert threshold: ${Math.floor(o/1024/1024)} MB`),w.info(` - Maximum allowed: ${D} MB`),w.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&&w.info("[Verbose] Event sent successfully")):e.verbose&&w.info(`[Verbose] Bundle size OK: ${y} MB (under ${Math.floor(o/1024/1024)} MB alert threshold)`),e.verbose&&w.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:l,ivSessionKey:a,sessionKey:u,checksum:c,encryptionMethod:h,finalKeyData:d}}async function mhe(t,e,r,n,i,s,o,a){let u=Ft();u.start("Uploading Bundle");let c=performance.now(),l=!1;if(o.verbose&&(w.info("[Verbose] uploadBundleToCapgoCloud called:"),w.info(` - Bundle size: ${Math.floor(s.byteLength/1024)} KB`),w.info(` - App ID: ${r}`),w.info(` - Bundle version: ${n}`),w.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),o.dryUpload){u.stop(`Dry run, bundle not uploaded
|
|
336
|
-
Bundle uploaded \u{1F4AA} in 0 seconds`),o.verbose&&w.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let f=await wn();if(o.verbose&&w.info("[Verbose] Local config retrieved for upload"),o.multipart!==void 0&&o.multipart||o.tus!==void 0&&o.tus){o.multipart?w.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):w.info("Uploading bundle with TUS protocol"),o.verbose&&(w.info("[Verbose] Starting TUS resumable upload..."),w.info(` - Host: ${f.hostWeb}`),w.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),await X8(t,s,i,r,n,u,f,a),l=!0,o.verbose&&w.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 w.error(`Cannot finish TUS upload ${W(g)}`),o.verbose&&w.info(`[Verbose] Database update failed: ${W(g)}`),Promise.reject(new Error("Cannot finish TUS upload"));o.verbose&&w.info(`[Verbose] Database updated with R2 path: ${m}`)}else{o.verbose&&w.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await G8(e,r,n);if(!m)return w.error("Cannot get upload url"),o.verbose&&w.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));o.verbose&&(w.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),w.info(` - Timeout: ${o.timeout||Yb}ms`),w.info(" - Retry attempts: 5"),w.info(" - Content-Type: application/zip"));let g=new AbortController,v=setTimeout(()=>g.abort(),o.timeout||Yb);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(v)}o.verbose&&w.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&&(w.info(`[Verbose] Upload failed after ${g} seconds`),w.info(`[Verbose] Error type: ${f instanceof Error?"Error":typeof f}`)),f instanceof Error&&f.message.includes("HTTP error"))try{let v=f.message.match(/status: (\d+)/),S=v?v[1]:"unknown";w.error(`Upload failed with status ${S}: ${f.message}`)}catch{w.error(`Upload failed: ${f.message}`)}else o.verbose&&w.info(`[Verbose] Non-HTTP error: ${W(f)}`),o.tus?w.error(`Cannot upload bundle please contact support if the issue persists ${W(f)}`):w.error(`Cannot upload bundle ( try again with --tus option) ${W(f)}`);throw o.verbose&&w.info("[Verbose] Cleaning up failed version from database..."),await Y8(e,r,n),o.verbose&&w.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&&(w.info("[Verbose] Upload successful:"),w.info(` - Upload time: ${d} seconds`),w.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),w.info(` - Bundle size: ${Math.floor(s.byteLength/1024)} KB`),w.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&&w.info("[Verbose] Performance event sent successfully")}async function ghe(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){w.error(`Cannot delete linked bundle on upload ${W(i)}`);return}if(n.length===0){w.warn("No linked bundle found in the channel you are trying to upload to");return}let s=n[0].version;if(s.deleted){w.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){w.error(`Cannot delete linked bundle on upload ${W(o)}`);return}w.info("Linked bundle deleted")}async function yhe(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 Lp(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?w.info("Your update is now available in your public channel \u{1F389}"):f?.id&&w.info(`Link device to this bundle to try it: ${m}`),r&&w.info(`Bundle url: ${m}`)}else w.warn("The upload key is not allowed to set the version in the channel")}async function Dhe(t,e,r){let{error:n,data:i}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(w.warn("Cannot find default upload channel"),w.info(`You can set it here: ${r}/app/p/${t}/settings`),null):i.default_upload_channel}async function nq(t,e,r=!1){r||oe(`Uploading with CLI version ${ki.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&&(w.info("[Verbose] Starting upload process with options:"),w.info(` - API key: ${e.apikey?"provided":"from saved key"}`),w.info(` - Path: ${e.path||"from capacitor config"}`),w.info(` - Channel: ${e.channel||"from default upload channel"}`),w.info(` - Bundle: ${e.bundle||"auto-detected"}`),w.info(` - External: ${e.external||"false"}`),w.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),w.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),w.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let d=che(e);e.verbose&&w.info("[Verbose] API key retrieved successfully");let f=await de();e.verbose&&w.info("[Verbose] Capacitor config loaded successfully");let m=await B8();e.verbose&&(w.info("[Verbose] Remote file config retrieved:"),w.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),w.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),w.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),w.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),w.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),w.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:g,path:v}=lhe(t,e,f.config);e.verbose&&w.info(`[Verbose] App ID: ${g}, Build path: ${v}`);let S=await uhe(f.config,e);e.verbose&&w.info(`[Verbose] Bundle version: ${S}`);let A=e.external?"external":"r2-direct",p="none";e.autoSetBundle&&(await j8({version:S}),e.verbose&&w.info("[Verbose] Auto-set bundle version in capacitor.config.json")),fhe(e,v),e.verbose&&w.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),w.info(`Upload ${g}@${S} started from path "${v}" to Capgo cloud`);let y=await wn();e.verbose&&w.info(`[Verbose] Local config loaded: host=${y.hostWeb}`),e.supaHost&&e.supaAnon&&(w.info("Using custom supabase instance from provided options"),y.supaHost=e.supaHost,y.supaKey=e.supaAnon,e.verbose&&w.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let D=await pe(d,e.supaHost,e.supaAnon);e.verbose&&w.info("[Verbose] Supabase client created successfully");let C=await De(D,d,["write","all","upload"]);e.verbose&&w.info(`[Verbose] User verified successfully, user_id: ${C}`);let k=e.channel||await Dhe(g,D,y.hostWeb)||"dev";e.verbose&&w.info(`[Verbose] Target channel: ${k}`);let E=await sn(D,g);e.verbose&&w.info(`[Verbose] Organization ID: ${E}`),await H8(D,E,ki.version),e.verbose&&w.info("[Verbose] Remote CLI messages checked"),await z8(D,E,d,g,!0),e.verbose&&w.info("[Verbose] Plan validation passed"),e.verbose&&w.info("[Verbose] Trial check completed"),e.verbose&&w.info(`[Verbose] Checking compatibility with channel ${k}...`);let{nativePackages:R,minUpdateVersion:P}=await hhe(D,i,e,k,g,S);e.verbose&&(w.info("[Verbose] Compatibility check completed:"),w.info(` - Native packages: ${R?R.length:0}`),w.info(` - Min update version: ${P||"none"}`)),e.verbose&&w.info(`[Verbose] Checking if version ${S} already exists...`);let F=await dhe(D,g,S,e.versionExistsOk);if(e.verbose&&w.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&&(w.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),w.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let B={name:S,app_id:g,session_key:void 0,external_url:e.external,storage_provider:A,min_update_version:P,native_packages:R,owner_org:E,user_id:C,checksum:void 0,link:e.link||null,comment:e.comment||null},U=null,G="";if(e.external)e.verbose&&w.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),B.session_key=e.ivSessionKey,B.checksum=e.encryptedChecksum,e.verbose&&(w.info("[Verbose] External bundle configured:"),w.info(` - URL: ${e.external}`),w.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),w.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&w.info(`[Verbose] Preparing bundle file from path: ${v}`);let{zipped:$,ivSessionKey:M,checksum:j,sessionKey:K,encryptionMethod:q,finalKeyData:V}=await phe(v,e,d,E,g,m.maxUploadLength,m.alertUploadSize);B.session_key=M,B.checksum=j,n=K,U=$,p=q,G=V,e.verbose&&(w.info("[Verbose] Bundle prepared:"),w.info(` - Size: ${Math.floor(($?.byteLength??0)/1024)} KB`),w.info(` - Checksum: ${j}`),w.info(` - Encryption: ${q}`),w.info(` - IV Session Key: ${M?"present":"none"}`)),e.ignoreChecksumCheck||(e.verbose&&w.info("[Verbose] Checking for duplicate checksum..."),await Q8(D,g,k,j),e.verbose&&w.info("[Verbose] Checksum is unique"))}if(e.zip?(e.tus=!1,e.verbose&&w.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&w.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&w.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&w.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&w.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,AE.cwd)()),M=await ro("@capgo/capacitor-updater",$,e.packageJson),j;try{j=M?Ct(M):void 0}catch{j=void 0}M&&j&&Ei(j,Ct("6.14.4"))&&(w.info(`Auto-enabling partial update encryption for updater version ${j} (> 6.14.4)`),e.verbose&&w.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}e.verbose&&e.delta&&w.info("[Verbose] Preparing delta/partial update manifest...");let L=e.delta?await eq(v,d,E,g,e.encryptPartial?p:"none",G):[];e.verbose&&e.delta&&w.info(`[Verbose] Delta manifest prepared with ${L.length} files`),e.verbose&&w.info("[Verbose] Creating version record in database...");let{error:_}=await Jb(D,B);if(_&&Dt(`Cannot add bundle ${W(_)}`),e.verbose&&w.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(w.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&&w.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"),w.info("Uploading to S3"),e.verbose&&(w.info("[Verbose] S3 configuration:"),w.info(` - Endpoint: ${c}`),w.info(` - Region: ${s}`),w.info(` - Bucket: ${u}`),w.info(` - Port: ${l}`),w.info(` - SSL: ${h?"enabled":"disabled"}`));let $=h?`https://${c}`:`http://${c}`,M=new al({endPoint:c,region:s,port:l,pathStyle:!0,bucket:u,accessKey:o,secretKey:a}),j=`${g}-${S}`,K=encodeURIComponent(j);e.verbose&&w.info(`[Verbose] Uploading to S3 as: ${j}`),await M.putObject(j,Uint8Array.from(U)),B.external_url=`${$}/${K}`,B.storage_provider="external",e.verbose&&w.info(`[Verbose] S3 upload complete, external URL: ${B.external_url}`)}else if(U){!e.partialOnly&&!e.deltaOnly?(e.verbose&&w.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await mhe(d,D,g,S,E,U,e,e.tusChunkSize)):e.verbose&&w.info("[Verbose] Skipping full bundle upload (delta-only mode)");let $=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&w.info("[Verbose] Dry upload mode: skipping delta upload"));let j=B.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:B.session_key}:void 0;e.verbose&&e.delta&&(w.info("[Verbose] Starting delta/partial file upload..."),w.info(` - Manifest entries: ${L.length}`),w.info(` - Encryption: ${j?"enabled":"disabled"}`)),$=e.delta?await tq(d,L,v,g,E,j,e):null,e.verbose&&$&&w.info(`[Verbose] Delta upload complete with ${$.length} files`)}catch(j){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw j;w.info(`Failed to upload partial files to capgo cloud. Error: ${W(j)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&w.info(`[Verbose] Delta upload error details: ${W(j)}`)}B.storage_provider="r2",B.manifest=$,e.verbose&&w.info("[Verbose] Updating version record with storage provider and manifest...");let{error:M}=await Jb(D,B);M&&Dt(`Cannot update bundle ${W(M)}`),e.verbose&&w.info("[Verbose] Version record updated successfully")}e.verbose&&w.info("[Verbose] Checking app permissions...");let T=await yt(D,d,g,2);e.verbose&&(w.info("[Verbose] Permissions:"),w.info(` - Upload: ${Wa(T,2)?"yes":"no"}`),w.info(` - Write: ${Wa(T,3)?"yes":"no"}`),w.info(` - Admin: ${Wa(T,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&Wa(T,3)?(e.verbose&&w.info(`[Verbose] Deleting linked bundle in channel ${k}...`),await ghe(D,g,k)):e.deleteLinkedBundleOnUpload&&w.warn("Cannot delete linked bundle on upload as a upload organization member"),Wa(T,3)?(e.verbose&&w.info(`[Verbose] Setting bundle ${S} to channel ${k}...`),await yhe(D,d,!!e.bundleUrl,S,k,C,E,g,y,e.selfAssign),e.verbose&&w.info("[Verbose] Channel updated successfully")):w.warn("Cannot set channel as a upload organization member"),e.verbose&&w.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:B.checksum??null,encryptionMethod:p,sessionKey:n?n.toString("base64"):void 0,ivSessionKey:typeof B.session_key=="string"?B.session_key:void 0,storageProvider:B.storage_provider};return e.verbose&&(w.info("[Verbose] Upload completed successfully:"),w.info(` - Bundle: ${I.bundle}`),w.info(` - Checksum: ${I.checksum}`),w.info(` - Encryption: ${I.encryptionMethod}`),w.info(` - Storage: ${I.storageProvider}`)),r&&!I.skipped&&ce("Time to share your update to the world \u{1F30D}"),I}var iq=require("node:crypto"),sm=require("node:fs"),sq=require("node:process");var whe=20;function vhe(t){console.log(JSON.stringify(t,null,2))}function dl(t){console.error(W(t))}async function oq(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=Pe(t,a?.config),c=(0,iq.randomUUID)().split("-")[0],l=rs("",e.packageJson);if(i=i||l||`0.0.1-beta.${c}`,o&&oe(`Zipping ${u}@${i}`),i&&!Ka.test(i)){let C=`Your bundle name ${i}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?dl({error:"invalid_semver"}):w.error(C)),new Error("Invalid bundle version format")}if(s=s||a?.config?.webDir,!u||!i||!s){let C="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?dl({error:"missing_argument"}):w.error(C)),new Error(C)}if(o&&w.info(`Started from path "${s}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!ul(s,"notifyAppReady"))throw r||(n?dl({error:"notifyAppReady_not_in_source_code"}):w.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(!Yp(s))throw r||(n?dl({error:"index_html_not_found"}):w.error(`index.html is missing in the root folder of ${s}`)),new Error("index.html is missing in root folder")}let d=await $p(s);o&&w.info(`Zipped ${d.byteLength} bytes`);let f=o?Ft():null;f&&f.start("Calculating checksum");let m=Xr((0,sq.cwd)()),g=await ro("@capgo/capacitor-updater",m,e.packageJson);if(!g){let C="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||w.warn(C),new Error(C)}let v=!1,S;try{S=g?Ct(g):void 0}catch{S=void 0}if(S){let C=S.major===6&&Ei(S,Ct("6.25.0")),k=S.major>=7;v=C||k}else g==="link:@capgo/capacitor-updater"&&(r||w.warn("Using local @capgo/capacitor-updater. Assuming v7"),v=!0);let A=await Yn(d,e.keyV2||(0,sm.existsSync)(Ir)||v?"sha256":"crc32");f&&f.stop(`Checksum ${v?"SHA256":"CRC32"}: ${A}`);let p=Math.floor(d.byteLength/1024/1024);p>whe&&o&&(w.warn(`WARNING !!
|
|
336
|
+
Bundle uploaded \u{1F4AA} in 0 seconds`),o.verbose&&w.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let f=await wn();if(o.verbose&&w.info("[Verbose] Local config retrieved for upload"),o.multipart!==void 0&&o.multipart||o.tus!==void 0&&o.tus){o.multipart?w.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):w.info("Uploading bundle with TUS protocol"),o.verbose&&(w.info("[Verbose] Starting TUS resumable upload..."),w.info(` - Host: ${f.hostWeb}`),w.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),await X8(t,s,i,r,n,u,f,a),l=!0,o.verbose&&w.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 w.error(`Cannot finish TUS upload ${K(g)}`),o.verbose&&w.info(`[Verbose] Database update failed: ${K(g)}`),Promise.reject(new Error("Cannot finish TUS upload"));o.verbose&&w.info(`[Verbose] Database updated with R2 path: ${m}`)}else{o.verbose&&w.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await G8(e,r,n);if(!m)return w.error("Cannot get upload url"),o.verbose&&w.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));o.verbose&&(w.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),w.info(` - Timeout: ${o.timeout||Yb}ms`),w.info(" - Retry attempts: 5"),w.info(" - Content-Type: application/zip"));let g=new AbortController,v=setTimeout(()=>g.abort(),o.timeout||Yb);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(v)}o.verbose&&w.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&&(w.info(`[Verbose] Upload failed after ${g} seconds`),w.info(`[Verbose] Error type: ${f instanceof Error?"Error":typeof f}`)),f instanceof Error&&f.message.includes("HTTP error"))try{let v=f.message.match(/status: (\d+)/),S=v?v[1]:"unknown";w.error(`Upload failed with status ${S}: ${f.message}`)}catch{w.error(`Upload failed: ${f.message}`)}else o.verbose&&w.info(`[Verbose] Non-HTTP error: ${K(f)}`),o.tus?w.error(`Cannot upload bundle please contact support if the issue persists ${K(f)}`):w.error(`Cannot upload bundle ( try again with --tus option) ${K(f)}`);throw o.verbose&&w.info("[Verbose] Cleaning up failed version from database..."),await Y8(e,r,n),o.verbose&&w.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&&(w.info("[Verbose] Upload successful:"),w.info(` - Upload time: ${d} seconds`),w.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),w.info(` - Bundle size: ${Math.floor(s.byteLength/1024)} KB`),w.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&&w.info("[Verbose] Performance event sent successfully")}async function ghe(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){w.error(`Cannot delete linked bundle on upload ${K(i)}`);return}if(n.length===0){w.warn("No linked bundle found in the channel you are trying to upload to");return}let s=n[0].version;if(s.deleted){w.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){w.error(`Cannot delete linked bundle on upload ${K(o)}`);return}w.info("Linked bundle deleted")}async function yhe(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 Lp(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. ${K(d)}`);let m=`${u.hostWeb}/app/p/${a}/channel/${f.id}`;f?.public?w.info("Your update is now available in your public channel \u{1F389}"):f?.id&&w.info(`Link device to this bundle to try it: ${m}`),r&&w.info(`Bundle url: ${m}`)}else w.warn("The upload key is not allowed to set the version in the channel")}async function Dhe(t,e,r){let{error:n,data:i}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(w.warn("Cannot find default upload channel"),w.info(`You can set it here: ${r}/app/p/${t}/settings`),null):i.default_upload_channel}async function nq(t,e,r=!1){r||oe(`Uploading with CLI version ${ki.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&&(w.info("[Verbose] Starting upload process with options:"),w.info(` - API key: ${e.apikey?"provided":"from saved key"}`),w.info(` - Path: ${e.path||"from capacitor config"}`),w.info(` - Channel: ${e.channel||"from default upload channel"}`),w.info(` - Bundle: ${e.bundle||"auto-detected"}`),w.info(` - External: ${e.external||"false"}`),w.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),w.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),w.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let d=che(e);e.verbose&&w.info("[Verbose] API key retrieved successfully");let f=await de();e.verbose&&w.info("[Verbose] Capacitor config loaded successfully");let m=await B8();e.verbose&&(w.info("[Verbose] Remote file config retrieved:"),w.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),w.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),w.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),w.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),w.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),w.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:g,path:v}=lhe(t,e,f.config);e.verbose&&w.info(`[Verbose] App ID: ${g}, Build path: ${v}`);let S=await uhe(f.config,e);e.verbose&&w.info(`[Verbose] Bundle version: ${S}`);let A=e.external?"external":"r2-direct",p="none";e.autoSetBundle&&(await j8({version:S}),e.verbose&&w.info("[Verbose] Auto-set bundle version in capacitor.config.json")),fhe(e,v),e.verbose&&w.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),w.info(`Upload ${g}@${S} started from path "${v}" to Capgo cloud`);let y=await wn();e.verbose&&w.info(`[Verbose] Local config loaded: host=${y.hostWeb}`),e.supaHost&&e.supaAnon&&(w.info("Using custom supabase instance from provided options"),y.supaHost=e.supaHost,y.supaKey=e.supaAnon,e.verbose&&w.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let D=await pe(d,e.supaHost,e.supaAnon);e.verbose&&w.info("[Verbose] Supabase client created successfully");let C=await De(D,d,["write","all","upload"]);e.verbose&&w.info(`[Verbose] User verified successfully, user_id: ${C}`);let k=e.channel||await Dhe(g,D,y.hostWeb)||"dev";e.verbose&&w.info(`[Verbose] Target channel: ${k}`);let E=await sn(D,g);e.verbose&&w.info(`[Verbose] Organization ID: ${E}`),await H8(D,E,ki.version),e.verbose&&w.info("[Verbose] Remote CLI messages checked"),await z8(D,E,d,g,!0),e.verbose&&w.info("[Verbose] Plan validation passed"),e.verbose&&w.info("[Verbose] Trial check completed"),e.verbose&&w.info(`[Verbose] Checking compatibility with channel ${k}...`);let{nativePackages:R,minUpdateVersion:P}=await hhe(D,i,e,k,g,S);e.verbose&&(w.info("[Verbose] Compatibility check completed:"),w.info(` - Native packages: ${R?R.length:0}`),w.info(` - Min update version: ${P||"none"}`)),e.verbose&&w.info(`[Verbose] Checking if version ${S} already exists...`);let F=await dhe(D,g,S,e.versionExistsOk);if(e.verbose&&w.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&&(w.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),w.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:P,native_packages:R,owner_org:E,user_id:C,checksum:void 0,link:e.link||null,comment:e.comment||null},U=null,G="";if(e.external)e.verbose&&w.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&&(w.info("[Verbose] External bundle configured:"),w.info(` - URL: ${e.external}`),w.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),w.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&w.info(`[Verbose] Preparing bundle file from path: ${v}`);let{zipped:$,ivSessionKey:M,checksum:B,sessionKey:W,encryptionMethod:q,finalKeyData:V}=await phe(v,e,d,E,g,m.maxUploadLength,m.alertUploadSize);j.session_key=M,j.checksum=B,n=W,U=$,p=q,G=V,e.verbose&&(w.info("[Verbose] Bundle prepared:"),w.info(` - Size: ${Math.floor(($?.byteLength??0)/1024)} KB`),w.info(` - Checksum: ${B}`),w.info(` - Encryption: ${q}`),w.info(` - IV Session Key: ${M?"present":"none"}`)),e.ignoreChecksumCheck||(e.verbose&&w.info("[Verbose] Checking for duplicate checksum..."),await Q8(D,g,k,B),e.verbose&&w.info("[Verbose] Checksum is unique"))}if(e.zip?(e.tus=!1,e.verbose&&w.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&w.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&w.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&w.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&w.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,AE.cwd)()),M=await ro("@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"))&&(w.info(`Auto-enabling partial update encryption for updater version ${B} (> 6.14.4)`),e.verbose&&w.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}e.verbose&&e.delta&&w.info("[Verbose] Preparing delta/partial update manifest...");let L=e.delta?await eq(v,d,E,g,e.encryptPartial?p:"none",G):[];e.verbose&&e.delta&&w.info(`[Verbose] Delta manifest prepared with ${L.length} files`),e.verbose&&w.info("[Verbose] Creating version record in database...");let{error:_}=await Jb(D,j);if(_&&Dt(`Cannot add bundle ${K(_)}`),e.verbose&&w.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(w.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&&w.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"),w.info("Uploading to S3"),e.verbose&&(w.info("[Verbose] S3 configuration:"),w.info(` - Endpoint: ${c}`),w.info(` - Region: ${s}`),w.info(` - Bucket: ${u}`),w.info(` - Port: ${l}`),w.info(` - SSL: ${h?"enabled":"disabled"}`));let $=h?`https://${c}`:`http://${c}`,M=new al({endPoint:c,region:s,port:l,pathStyle:!0,bucket:u,accessKey:o,secretKey:a}),B=`${g}-${S}`,W=encodeURIComponent(B);e.verbose&&w.info(`[Verbose] Uploading to S3 as: ${B}`),await M.putObject(B,Uint8Array.from(U)),j.external_url=`${$}/${W}`,j.storage_provider="external",e.verbose&&w.info(`[Verbose] S3 upload complete, external URL: ${j.external_url}`)}else if(U){!e.partialOnly&&!e.deltaOnly?(e.verbose&&w.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await mhe(d,D,g,S,E,U,e,e.tusChunkSize)):e.verbose&&w.info("[Verbose] Skipping full bundle upload (delta-only mode)");let $=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&w.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&&(w.info("[Verbose] Starting delta/partial file upload..."),w.info(` - Manifest entries: ${L.length}`),w.info(` - Encryption: ${B?"enabled":"disabled"}`)),$=e.delta?await tq(d,L,v,g,E,B,e):null,e.verbose&&$&&w.info(`[Verbose] Delta upload complete with ${$.length} files`)}catch(B){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw B;w.info(`Failed to upload partial files to capgo cloud. Error: ${K(B)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&w.info(`[Verbose] Delta upload error details: ${K(B)}`)}j.storage_provider="r2",j.manifest=$,e.verbose&&w.info("[Verbose] Updating version record with storage provider and manifest...");let{error:M}=await Jb(D,j);M&&Dt(`Cannot update bundle ${K(M)}`),e.verbose&&w.info("[Verbose] Version record updated successfully")}e.verbose&&w.info("[Verbose] Checking app permissions...");let T=await yt(D,d,g,2);e.verbose&&(w.info("[Verbose] Permissions:"),w.info(` - Upload: ${Wa(T,2)?"yes":"no"}`),w.info(` - Write: ${Wa(T,3)?"yes":"no"}`),w.info(` - Admin: ${Wa(T,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&Wa(T,3)?(e.verbose&&w.info(`[Verbose] Deleting linked bundle in channel ${k}...`),await ghe(D,g,k)):e.deleteLinkedBundleOnUpload&&w.warn("Cannot delete linked bundle on upload as a upload organization member"),Wa(T,3)?(e.verbose&&w.info(`[Verbose] Setting bundle ${S} to channel ${k}...`),await yhe(D,d,!!e.bundleUrl,S,k,C,E,g,y,e.selfAssign),e.verbose&&w.info("[Verbose] Channel updated successfully")):w.warn("Cannot set channel as a upload organization member"),e.verbose&&w.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&&(w.info("[Verbose] Upload completed successfully:"),w.info(` - Bundle: ${I.bundle}`),w.info(` - Checksum: ${I.checksum}`),w.info(` - Encryption: ${I.encryptionMethod}`),w.info(` - Storage: ${I.storageProvider}`)),r&&!I.skipped&&ce("Time to share your update to the world \u{1F30D}"),I}var iq=require("node:crypto"),sm=require("node:fs"),sq=require("node:process");var whe=20;function vhe(t){console.log(JSON.stringify(t,null,2))}function dl(t){console.error(K(t))}async function oq(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=Pe(t,a?.config),c=(0,iq.randomUUID)().split("-")[0],l=rs("",e.packageJson);if(i=i||l||`0.0.1-beta.${c}`,o&&oe(`Zipping ${u}@${i}`),i&&!Ka.test(i)){let C=`Your bundle name ${i}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?dl({error:"invalid_semver"}):w.error(C)),new Error("Invalid bundle version format")}if(s=s||a?.config?.webDir,!u||!i||!s){let C="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?dl({error:"missing_argument"}):w.error(C)),new Error(C)}if(o&&w.info(`Started from path "${s}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!ul(s,"notifyAppReady"))throw r||(n?dl({error:"notifyAppReady_not_in_source_code"}):w.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(!Yp(s))throw r||(n?dl({error:"index_html_not_found"}):w.error(`index.html is missing in the root folder of ${s}`)),new Error("index.html is missing in root folder")}let d=await $p(s);o&&w.info(`Zipped ${d.byteLength} bytes`);let f=o?Ft():null;f&&f.start("Calculating checksum");let m=Xr((0,sq.cwd)()),g=await ro("@capgo/capacitor-updater",m,e.packageJson);if(!g){let C="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||w.warn(C),new Error(C)}let v=!1,S;try{S=g?Ct(g):void 0}catch{S=void 0}if(S){let C=S.major===6&&Ei(S,Ct("6.25.0")),k=S.major>=7;v=C||k}else g==="link:@capgo/capacitor-updater"&&(r||w.warn("Using local @capgo/capacitor-updater. Assuming v7"),v=!0);let A=await Yn(d,e.keyV2||(0,sm.existsSync)(Ir)||v?"sha256":"crc32");f&&f.stop(`Checksum ${v?"SHA256":"CRC32"}: ${A}`);let p=Math.floor(d.byteLength/1024/1024);p>whe&&o&&(w.warn(`WARNING !!
|
|
337
337
|
The bundle size is ${p} Mb, this may take a while to download for users
|
|
338
338
|
`),w.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
|
|
339
|
-
`));let y=o?Ft():null,D=e.name||`${u}_${i}.zip`;return y&&y.start(`Saving to ${D}`),(0,sm.writeFileSync)(D,d),y&&y.stop(`Saved to ${D}`),o&&ce("Done \u2705"),!r&&n&&vhe({bundle:i,filename:D,checksum:A}),{bundle:i,filename:D,checksum:A}}catch(a){throw r||(n?dl(a):w.error(
|
|
340
|
-
${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||(w.success("Channel created \u2705"),ce("Done \u2705")),c.data??!0}async function uq(t,e,r,n=!1){let{quiet:i}=r;!i&&!n&&oe("List current bundle"),r.apikey=r.apikey||ne(i);let s=await de();if(e=Pe(e,s?.config),!r.apikey)throw n||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||w.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||w.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||w.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||w.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?w.info(c.name):w.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function cq(t,e,r,n=!1){n||oe("Delete channel"),r.apikey=r.apikey||ne();let i=await de();if(e=Pe(e,i?.config),!r.apikey)throw n||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||w.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&&w.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let d=await oM(s,e,t);d?.name&&!n&&w.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await tE(s,e,d.name)}let{data:a,error:u}=await iM(s,e,t);if(u||!a){if(n||w.error(`Channel ${t} not found`),r.successIfNotFound)return n||w.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await sM(s,e,a.id);if(c)throw n||w.error(`Cannot delete channel devices: ${W(c)}`),new Error(`Cannot delete channel devices: ${W(c)}`);n||w.info(`Deleting channel ${e}#${t} from Capgo`);let l=await nM(s,t,e,o);if(l.error)throw n||w.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||(w.success("Channel deleted"),ce("Done \u2705")),!0}async function lq(t,e,r=!1){r||oe("List channels"),e.apikey=e.apikey||ne();let n=await de();if(t=Pe(t,n?.config),!e.apikey)throw r||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||w.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||w.info("Querying available channels in Capgo");let o=await uM(i,t);return r||(w.info(`Active channels in Capgo: ${o?.length??0}`),aM(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 fq=["major","minor","metadata","patch","none"];async function hq(t,e,r,n=!1){n||oe("Set channel"),r.apikey=r.apikey||ne();let i=await de();if(e=Pe(e,i?.config),!r.apikey)throw n||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||w.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||w.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:v,dev:S,emulator:A}=r;if(h&&u)throw n||w.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(d&&u)throw n||w.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||w.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&&v==null)throw n||w.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await V8(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||w.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let D=h?i?.config?.plugins?.CapacitorUpdater?.version||rs("",r.packageJson):u;if(D!=null){let{data:k,error:E}=await s.from("app_versions").select().eq("app_id",e).eq("name",D).eq("user_id",o).eq("deleted",!1).single();if(E||!k)throw n||w.error(`Cannot find version ${D}`),new Error(`Cannot find version ${D}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:R,localDependencies:P}=await Qb(s,e,t,k.native_packages??[]),F=$n();if(P.length>0&&R.some(B=>!no(B)))throw n||(w.warn(`Bundle NOT compatible with ${t} channel`),w.warn(`You can check compatibility with "${F.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(P.length===0&&R.length>0?w.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):w.info(`Bundle is compatible with ${t} channel`))}n||w.info(`Set ${e} channel: ${t} to @${D}`),p.version=k.id}if(d){let{data:k,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||!k)throw n||w.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:R}=await Qb(s,e,t,k.native_packages??[]),P=$n();if(R.some(F=>!no(F)))throw n||(w.warn(`Bundle NOT compatible with ${t} channel`),w.warn(`You can check compatibility with "${P.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||w.info(`Set ${e} channel: ${t} to @${k.name}`),p.version=k.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||w.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||w.info(`Set ${e} channel: ${t} to ${c}`),p.public=c==="default"}if(l!=null&&(n||w.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),p.disable_auto_update_under_native=!l),f!=null&&(n||w.info(`Set ${e} channel: ${t} to ${f?"allow":"disallow"} ios update`),p.ios=!!f),m!=null&&(n||w.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),p.android=!!m),g!=null&&(n||w.info(`Set ${e} channel: ${t} to ${g?"allow":"disallow"} self assign to this channel`),p.allow_device_self_set=!!g),S!=null&&(n||w.info(`Set ${e} channel: ${t} to ${S?"allow":"disallow"} dev devices`),p.allow_dev=!!S),A!=null&&(n||w.info(`Set ${e} channel: ${t} to ${A?"allow":"disallow"} emulator devices`),p.allow_emulator=!!A),v!=null){let k=v.toLowerCase();if(!fq.includes(k))throw n||w.error(`Channel strategy ${k} is not known. The possible values are: ${fq.join(", ")}.`),new Error(`Unknown channel strategy ${k}`);k==="metadata"&&(k="version_number"),p.disable_auto_update=k,n||w.info(`Set ${e} channel: ${t} to ${k} disable update strategy to this channel`)}let{error:C}=await Lp(s,p);if(C)throw n||w.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 dq(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function pq(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||w.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||w.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let s=dq(r.config);s.privateKey&&(delete s.privateKey,e||w.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 qa(r)}return e||(w.success(`Public key saved into ${r.path} file in local directory`),w.success("Your app will decode the zip archive with this key")),!0}async function mq(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 qa(r),(0,hr.existsSync)(Ga))try{(0,hr.unlinkSync)(Ga),e||w.success(`Old private key file deleted: ${Ga}`)}catch(i){e||w.error(`Failed to delete old private key file: ${Ga} (${String(i)})`)}if((0,hr.existsSync)(Pp))try{(0,hr.unlinkSync)(Pp),e||w.success(`Old public key file deleted: ${Pp}`)}catch(i){e||w.error(`Failed to delete old public key file: ${hi} (${String(i)})`)}return e||(w.success(`Old private key deleted from ${r.path} file`),ce("Done \u2705")),!0}return e||w.info("No old private key found in config file"),!1}async function gq(t,e=!1){e||oe("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=SM();if((0,hr.existsSync)(hi)&&!t.force)throw e||w.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||w.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=dq(i.config);s.privateKey&&(delete s.privateKey,e||w.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 qa(i)}if(!e){w.success("Your RSA key has been generated"),w.success(`Private key saved in ${Ir}`),w.success("This key will be used to encrypt your bundle before sending it to Capgo"),w.success("Keep it safe"),w.success("Then make it unreadable by Capgo and unmodifiable by anyone"),w.success(`Public key saved in ${i.path}`),w.success("Your app will be the only one having it"),w.success("Only your users can decrypt your update"),w.success("Only you can send them an update");try{await eM(),ce("Done \u2705")}catch(s){if(s instanceof Error&&s.message==="Capacitor sync cancelled")return!0;throw s}}return!0}var po=require("node:fs"),yq=require("node:os");async function Dq(t,e,r=!1){if(r||oe("Login to Capgo"),!t)throw r||w.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,po.existsSync)(".git"))throw r||w.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,po.writeFileSync)(".capgo",`${t}
|
|
339
|
+
`));let y=o?Ft():null,D=e.name||`${u}_${i}.zip`;return y&&y.start(`Saving to ${D}`),(0,sm.writeFileSync)(D,d),y&&y.stop(`Saved to ${D}`),o&&ce("Done \u2705"),!r&&n&&vhe({bundle:i,filename:D,checksum:A}),{bundle:i,filename:D,checksum:A}}catch(a){throw r||(n?dl(a):w.error(K(a))),a instanceof Error?a:new Error(String(a))}}async function aq(t,e,r,n=!1){n||oe("Create channel"),r.apikey=r.apikey||ne();let i=await de().catch(()=>{});if(e=Pe(e,i?.config),!r.apikey)throw n||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||w.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||w.info(`Creating channel ${e}#${t} to Capgo`);let o=await eE(s,e);if(!o)throw n||w.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 rM(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||w.error(`Cannot create Channel \u{1F640}
|
|
340
|
+
${K(c.error)}`),new Error(`Cannot create channel: ${K(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||(w.success("Channel created \u2705"),ce("Done \u2705")),c.data??!0}async function uq(t,e,r,n=!1){let{quiet:i}=r;!i&&!n&&oe("List current bundle"),r.apikey=r.apikey||ne(i);let s=await de();if(e=Pe(e,s?.config),!r.apikey)throw n||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||w.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||w.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||w.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||w.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?w.info(c.name):w.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function cq(t,e,r,n=!1){n||oe("Delete channel"),r.apikey=r.apikey||ne();let i=await de();if(e=Pe(e,i?.config),!r.apikey)throw n||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||w.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&&w.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let d=await oM(s,e,t);d?.name&&!n&&w.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await tE(s,e,d.name)}let{data:a,error:u}=await iM(s,e,t);if(u||!a){if(n||w.error(`Channel ${t} not found`),r.successIfNotFound)return n||w.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await sM(s,e,a.id);if(c)throw n||w.error(`Cannot delete channel devices: ${K(c)}`),new Error(`Cannot delete channel devices: ${K(c)}`);n||w.info(`Deleting channel ${e}#${t} from Capgo`);let l=await nM(s,t,e,o);if(l.error)throw n||w.error(`Cannot delete Channel \u{1F640} ${K(l.error)}`),new Error(`Cannot delete channel: ${K(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||(w.success("Channel deleted"),ce("Done \u2705")),!0}async function lq(t,e,r=!1){r||oe("List channels"),e.apikey=e.apikey||ne();let n=await de();if(t=Pe(t,n?.config),!e.apikey)throw r||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||w.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||w.info("Querying available channels in Capgo");let o=await uM(i,t);return r||(w.info(`Active channels in Capgo: ${o?.length??0}`),aM(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 fq=["major","minor","metadata","patch","none"];async function hq(t,e,r,n=!1){n||oe("Set channel"),r.apikey=r.apikey||ne();let i=await de();if(e=Pe(e,i?.config),!r.apikey)throw n||w.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||w.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||w.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:v,dev:S,emulator:A}=r;if(h&&u)throw n||w.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(d&&u)throw n||w.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||w.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&&v==null)throw n||w.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await V8(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||w.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let D=h?i?.config?.plugins?.CapacitorUpdater?.version||rs("",r.packageJson):u;if(D!=null){let{data:k,error:E}=await s.from("app_versions").select().eq("app_id",e).eq("name",D).eq("user_id",o).eq("deleted",!1).single();if(E||!k)throw n||w.error(`Cannot find version ${D}`),new Error(`Cannot find version ${D}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:R,localDependencies:P}=await Qb(s,e,t,k.native_packages??[]),F=$n();if(P.length>0&&R.some(j=>!no(j)))throw n||(w.warn(`Bundle NOT compatible with ${t} channel`),w.warn(`You can check compatibility with "${F.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(P.length===0&&R.length>0?w.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):w.info(`Bundle is compatible with ${t} channel`))}n||w.info(`Set ${e} channel: ${t} to @${D}`),p.version=k.id}if(d){let{data:k,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||!k)throw n||w.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:R}=await Qb(s,e,t,k.native_packages??[]),P=$n();if(R.some(F=>!no(F)))throw n||(w.warn(`Bundle NOT compatible with ${t} channel`),w.warn(`You can check compatibility with "${P.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||w.info(`Set ${e} channel: ${t} to @${k.name}`),p.version=k.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||w.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||w.info(`Set ${e} channel: ${t} to ${c}`),p.public=c==="default"}if(l!=null&&(n||w.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),p.disable_auto_update_under_native=!l),f!=null&&(n||w.info(`Set ${e} channel: ${t} to ${f?"allow":"disallow"} ios update`),p.ios=!!f),m!=null&&(n||w.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),p.android=!!m),g!=null&&(n||w.info(`Set ${e} channel: ${t} to ${g?"allow":"disallow"} self assign to this channel`),p.allow_device_self_set=!!g),S!=null&&(n||w.info(`Set ${e} channel: ${t} to ${S?"allow":"disallow"} dev devices`),p.allow_dev=!!S),A!=null&&(n||w.info(`Set ${e} channel: ${t} to ${A?"allow":"disallow"} emulator devices`),p.allow_emulator=!!A),v!=null){let k=v.toLowerCase();if(!fq.includes(k))throw n||w.error(`Channel strategy ${k} is not known. The possible values are: ${fq.join(", ")}.`),new Error(`Unknown channel strategy ${k}`);k==="metadata"&&(k="version_number"),p.disable_auto_update=k,n||w.info(`Set ${e} channel: ${t} to ${k} disable update strategy to this channel`)}let{error:C}=await Lp(s,p);if(C)throw n||w.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 dq(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function pq(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||w.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||w.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let s=dq(r.config);s.privateKey&&(delete s.privateKey,e||w.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 qa(r)}return e||(w.success(`Public key saved into ${r.path} file in local directory`),w.success("Your app will decode the zip archive with this key")),!0}async function mq(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 qa(r),(0,hr.existsSync)(Ga))try{(0,hr.unlinkSync)(Ga),e||w.success(`Old private key file deleted: ${Ga}`)}catch(i){e||w.error(`Failed to delete old private key file: ${Ga} (${String(i)})`)}if((0,hr.existsSync)(Pp))try{(0,hr.unlinkSync)(Pp),e||w.success(`Old public key file deleted: ${Pp}`)}catch(i){e||w.error(`Failed to delete old public key file: ${hi} (${String(i)})`)}return e||(w.success(`Old private key deleted from ${r.path} file`),ce("Done \u2705")),!0}return e||w.info("No old private key found in config file"),!1}async function gq(t,e=!1){e||oe("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=SM();if((0,hr.existsSync)(hi)&&!t.force)throw e||w.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||w.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=dq(i.config);s.privateKey&&(delete s.privateKey,e||w.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 qa(i)}if(!e){w.success("Your RSA key has been generated"),w.success(`Private key saved in ${Ir}`),w.success("This key will be used to encrypt your bundle before sending it to Capgo"),w.success("Keep it safe"),w.success("Then make it unreadable by Capgo and unmodifiable by anyone"),w.success(`Public key saved in ${i.path}`),w.success("Your app will be the only one having it"),w.success("Only your users can decrypt your update"),w.success("Only you can send them an update");try{await eM(),ce("Done \u2705")}catch(s){if(s instanceof Error&&s.message==="Capacitor sync cancelled")return!0;throw s}}return!0}var po=require("node:fs"),yq=require("node:os");async function Dq(t,e,r=!1){if(r||oe("Login to Capgo"),!t)throw r||w.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,po.existsSync)(".git"))throw r||w.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,po.writeFileSync)(".capgo",`${t}
|
|
341
341
|
`),(0,po.appendFileSync)(".gitignore",`.capgo
|
|
342
342
|
`)}else{let o=(0,yq.homedir)();(0,po.writeFileSync)(`${o}/.capgo`,`${t}
|
|
343
|
-
`)}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||(w.success(`login saved into .capgo file in ${n?"local":"home"} directory`),ce("Done \u2705"))}async function wq(t,e=!1){e||oe("Adding organization"),await ze();let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||w.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 go({message:"Organization name:",placeholder:"My Organization"});if(xt(c))throw w.error("Canceled adding organization"),new Error("Organization creation cancelled");s=c}if(!e&&!o){let c=await go({message:"Management email:",placeholder:"admin@example.com"});if(xt(c))throw w.error("Canceled adding organization"),new Error("Organization creation cancelled");o=c}if(!s||!o)throw e||w.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||w.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||w.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||(w.success(`Organization "${s}" added to Capgo`),ce("Done \u2705")),a}async function vq(t,e,r=!1){r||oe("Deleting organization"),await ze();let n={...e,apikey:e.apikey||ne()};if(!n.apikey)throw r||w.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||w.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||w.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");w.warn("Deleting an organization is restricted to the organization owner"),w.warn("You are not the owner of this organization"),w.warn("It's strongly recommended that you do not continue!");let c=await yo({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(xt(c)||c==="no")throw w.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 w.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||w.info(`Deleting organization "${o.name}"`);let{error:u}=await i.from("orgs").delete().eq("id",t);if(u)throw r||w.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||(w.success(`Organization "${o.name}" deleted from Capgo`),ce("Done \u2705")),!0}function bhe(t,e){if(e)return;if(!t.length){w.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"]);w.success("Organizations"),w.success(r.toString())}async function bq(t,e=!1){e||oe("List organizations"),await ze();let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||w.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||w.info("Getting organizations from Capgo");let{error:i,data:s}=await n.rpc("get_orgs_v6");if(i)throw e||w.error(`Cannot get organizations ${W(i)}`),new Error(`Cannot get organizations: ${W(i)}`);let o=s||[];return e||(w.info(`Organizations found: ${o.length}`),bhe(o,e),ce("Done \u2705")),o}async function Eq(t,e,r=!1){r||oe("Updating organization"),await ze();let n={...e,apikey:e.apikey||ne()};if(!n.apikey)throw r||w.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||w.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||w.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 go({message:"New organization name:",placeholder:s.name||"My Organization"});if(xt(l))throw w.error("Canceled updating organization"),new Error("Organization update cancelled");a=l}if(!r&&!u){let l=await go({message:"Management email:",placeholder:s.management_email||"admin@example.com"});if(xt(l))throw w.error("Canceled updating organization"),new Error("Organization update cancelled");u=l}if(!a||!u)throw r||w.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||w.info(`Updating organization "${t}"`);let{error:c}=await i.from("orgs").update({name:a,management_email:u}).eq("id",t);if(c)throw r||w.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||(w.success("Organization updated"),ce("Done \u2705")),{orgId:t,name:a,email:u}}async function _q(t,e=!1){e||oe("Getting user id");let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||w.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||w.error(`Error getting user id ${W(n)}`),n instanceof Error?n:new Error(String(n))}}var st=class{apikey;supaHost;supaAnon;constructor(e){this.apikey=e?.apikey,this.supaHost=e?.supaHost,this.supaAnon=e?.supaAnon}async login(e){try{return await Dq(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 gM({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||ne(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,icon:e.icon};return await hM(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||ne(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,icon:e.icon,retention:e.retention};return await wM(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||ne(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return await dM(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||ne(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:(await yM(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||ne(!0),supaHost:e?.supaHost||this.supaHost,supaAnon:e?.supaAnon||this.supaAnon};return{success:!0,data:await _q(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||ne(!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 EM(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 TM(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 OM(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 oq(e.appId,{apikey:this.apikey||ne(!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||ne(!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 nq(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||ne(!0),n=await pe(r,this.supaHost,this.supaAnon);return{success:!0,data:(await qp(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||ne(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,bundle:r};return await xM(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||ne(!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 bM(e.appId,r,!0)}}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||ne(!0),quiet:!0,supaHost:n?.supaHost||this.supaHost,supaAnon:n?.supaAnon||this.supaAnon};return{success:!0,data:await uq(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||ne(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,default:e.default,selfAssign:e.selfAssign};return await aq(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||ne(!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 hq(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||ne(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,deleteBundle:n,successIfNotFound:!1};return await cq(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||ne(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:await lq(e,r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async generateEncryptionKeys(e){try{return await gq({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 pq({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 mq({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||ne(!0),supaHost:e?.supaHost||this.supaHost,supaAnon:e?.supaAnon||this.supaAnon};return{success:!0,data:(await bq(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||ne(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,email:e.email},n=await wq(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||ne(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,email:e.email},n=await Eq(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||ne(!0),supaHost:r?.supaHost||this.supaHost,supaAnon:r?.supaAnon||this.supaAnon,autoConfirm:r?.autoConfirm??!0};return{success:!0,data:{deleted:await vq(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||ne(!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 vM(e,{apikey:r.apikey||this.apikey||ne(!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 Ehe(t){return new st({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).uploadBundle(t)}async function _he(t){return new st({supaHost:t.supaHost,supaAnon:t.supaAnon}).login(t)}async function Che(t){return new st().doctor(t)}async function She(t){return new st({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).checkBundleCompatibility(t)}async function Ahe(t){return new st().encryptBundle(t)}async function Ohe(t){return new st().decryptBundle(t)}async function xhe(t){return new st().zipBundle(t)}async function The(t){return new st().generateEncryptionKeys(t)}async function Fhe(t){return new st().saveEncryptionKey(t)}async function Ihe(t){return new st().deleteLegacyEncryptionKey(t)}async function khe(t,e,r){return new st({apikey:r?.apikey,supaHost:r?.supaHost,supaAnon:r?.supaAnon}).getCurrentBundle(t,e,r)}async function Phe(t,e){return new st({apikey:e.apikey}).setAppSetting(t,e)}async function Rhe(t){return new st({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).getAccountId(t)}async function Nhe(t){return new st({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).listOrganizations(t)}async function $he(t){return new st({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addOrganization(t)}async function Lhe(t){return new st({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).updateOrganization(t)}async function jhe(t,e){return new st({apikey:e?.apikey,supaHost:e?.supaHost,supaAnon:e?.supaAnon}).deleteOrganization(t,e)}async function Bhe(t){return new st({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addApp(t)}async function Mhe(t,e){return new st(e).listBundles(t)}async function qhe(t){return new st({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addChannel(t)}async function Uhe(t){return new st({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).getStats(t)}async function Hhe(){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,saveEncryptionKey,updateAppSetting,updateOrganization,uploadBundle,zipBundle});
|
|
343
|
+
`)}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||(w.success(`login saved into .capgo file in ${n?"local":"home"} directory`),ce("Done \u2705"))}async function wq(t,e=!1){e||oe("Adding organization"),await ze();let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||w.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 go({message:"Organization name:",placeholder:"My Organization"});if(xt(c))throw w.error("Canceled adding organization"),new Error("Organization creation cancelled");s=c}if(!e&&!o){let c=await go({message:"Management email:",placeholder:"admin@example.com"});if(xt(c))throw w.error("Canceled adding organization"),new Error("Organization creation cancelled");o=c}if(!s||!o)throw e||w.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||w.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||w.error(`Could not add organization ${K(u)}`),new Error(`Could not add organization: ${K(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||(w.success(`Organization "${s}" added to Capgo`),ce("Done \u2705")),a}async function vq(t,e,r=!1){r||oe("Deleting organization"),await ze();let n={...e,apikey:e.apikey||ne()};if(!n.apikey)throw r||w.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||w.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||w.error(`Cannot get organization details ${K(a)}`),new Error(`Cannot get organization details: ${K(a)}`);if(o.created_by!==s){if(r)throw new Error("Deleting an organization is restricted to the organization owner");w.warn("Deleting an organization is restricted to the organization owner"),w.warn("You are not the owner of this organization"),w.warn("It's strongly recommended that you do not continue!");let c=await yo({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(xt(c)||c==="no")throw w.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 w.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||w.info(`Deleting organization "${o.name}"`);let{error:u}=await i.from("orgs").delete().eq("id",t);if(u)throw r||w.error(`Could not delete organization ${K(u)}`),new Error(`Could not delete organization: ${K(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||(w.success(`Organization "${o.name}" deleted from Capgo`),ce("Done \u2705")),!0}function bhe(t,e){if(e)return;if(!t.length){w.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"]);w.success("Organizations"),w.success(r.toString())}async function bq(t,e=!1){e||oe("List organizations"),await ze();let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||w.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||w.info("Getting organizations from Capgo");let{error:i,data:s}=await n.rpc("get_orgs_v6");if(i)throw e||w.error(`Cannot get organizations ${K(i)}`),new Error(`Cannot get organizations: ${K(i)}`);let o=s||[];return e||(w.info(`Organizations found: ${o.length}`),bhe(o,e),ce("Done \u2705")),o}async function Eq(t,e,r=!1){r||oe("Updating organization"),await ze();let n={...e,apikey:e.apikey||ne()};if(!n.apikey)throw r||w.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||w.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||w.error(`Cannot get organization details ${K(o)}`),new Error(`Cannot get organization details: ${K(o)}`);let{name:a,email:u}=n;if(!r&&!a){let l=await go({message:"New organization name:",placeholder:s.name||"My Organization"});if(xt(l))throw w.error("Canceled updating organization"),new Error("Organization update cancelled");a=l}if(!r&&!u){let l=await go({message:"Management email:",placeholder:s.management_email||"admin@example.com"});if(xt(l))throw w.error("Canceled updating organization"),new Error("Organization update cancelled");u=l}if(!a||!u)throw r||w.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||w.info(`Updating organization "${t}"`);let{error:c}=await i.from("orgs").update({name:a,management_email:u}).eq("id",t);if(c)throw r||w.error(`Could not update organization ${K(c)}`),new Error(`Could not update organization: ${K(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||(w.success("Organization updated"),ce("Done \u2705")),{orgId:t,name:a,email:u}}async function _q(t,e=!1){e||oe("Getting user id");let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||w.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||w.error(`Error getting user id ${K(n)}`),n instanceof Error?n:new Error(String(n))}}var st=class{apikey;supaHost;supaAnon;constructor(e){this.apikey=e?.apikey,this.supaHost=e?.supaHost,this.supaAnon=e?.supaAnon}async login(e){try{return await Dq(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 gM({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||ne(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,icon:e.icon};return await hM(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||ne(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,icon:e.icon,retention:e.retention};return await wM(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||ne(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return await dM(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||ne(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:(await yM(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||ne(!0),supaHost:e?.supaHost||this.supaHost,supaAnon:e?.supaAnon||this.supaAnon};return{success:!0,data:await _q(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||ne(!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 EM(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 TM(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 OM(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 oq(e.appId,{apikey:this.apikey||ne(!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||ne(!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 nq(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||ne(!0),n=await pe(r,this.supaHost,this.supaAnon);return{success:!0,data:(await qp(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||ne(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,bundle:r};return await xM(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||ne(!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 bM(e.appId,r,!0)}}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||ne(!0),quiet:!0,supaHost:n?.supaHost||this.supaHost,supaAnon:n?.supaAnon||this.supaAnon};return{success:!0,data:await uq(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||ne(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,default:e.default,selfAssign:e.selfAssign};return await aq(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||ne(!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 hq(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||ne(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,deleteBundle:n,successIfNotFound:!1};return await cq(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||ne(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:await lq(e,r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async generateEncryptionKeys(e){try{return await gq({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 pq({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 mq({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||ne(!0),supaHost:e?.supaHost||this.supaHost,supaAnon:e?.supaAnon||this.supaAnon};return{success:!0,data:(await bq(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||ne(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,email:e.email},n=await wq(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||ne(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,email:e.email},n=await Eq(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||ne(!0),supaHost:r?.supaHost||this.supaHost,supaAnon:r?.supaAnon||this.supaAnon,autoConfirm:r?.autoConfirm??!0};return{success:!0,data:{deleted:await vq(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||ne(!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 vM(e,{apikey:r.apikey||this.apikey||ne(!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 Ehe(t){return new st({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).uploadBundle(t)}async function _he(t){return new st({supaHost:t.supaHost,supaAnon:t.supaAnon}).login(t)}async function Che(t){return new st().doctor(t)}async function She(t){return new st({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).checkBundleCompatibility(t)}async function Ahe(t){return new st().encryptBundle(t)}async function Ohe(t){return new st().decryptBundle(t)}async function xhe(t){return new st().zipBundle(t)}async function The(t){return new st().generateEncryptionKeys(t)}async function Fhe(t){return new st().saveEncryptionKey(t)}async function Ihe(t){return new st().deleteLegacyEncryptionKey(t)}async function khe(t,e,r){return new st({apikey:r?.apikey,supaHost:r?.supaHost,supaAnon:r?.supaAnon}).getCurrentBundle(t,e,r)}async function Phe(t,e){return new st({apikey:e.apikey}).setAppSetting(t,e)}async function Rhe(t){return new st({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).getAccountId(t)}async function Nhe(t){return new st({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).listOrganizations(t)}async function $he(t){return new st({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addOrganization(t)}async function Lhe(t){return new st({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).updateOrganization(t)}async function jhe(t,e){return new st({apikey:e?.apikey,supaHost:e?.supaHost,supaAnon:e?.supaAnon}).deleteOrganization(t,e)}async function Bhe(t){return new st({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addApp(t)}async function Mhe(t,e){return new st(e).listBundles(t)}async function qhe(t){return new st({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addChannel(t)}async function Uhe(t){return new st({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).getStats(t)}async function Hhe(){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,saveEncryptionKey,updateAppSetting,updateOrganization,uploadBundle,zipBundle});
|
|
344
344
|
/*! Bundled license information:
|
|
345
345
|
|
|
346
346
|
tus-js-client/lib.es5/upload.js:
|