@capgo/cli 8.5.0 → 8.5.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 +2 -2
- package/dist/package.json +1 -1
- package/dist/src/sdk.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -91,7 +91,7 @@ Expecting one of '${B.join("', '")}'`);if(this._lifeCycleHooks[A])this._lifeCycl
|
|
|
91
91
|
`),this.outputHelp({error:!0});let B=Q||{},$=B.exitCode||1,I=B.code||"commander.error";this._exit($,I,A)}_parseOptionsEnv(){this.options.forEach((A)=>{if(A.envVar&&A.envVar in O1.env){let Q=A.attributeName();if(this.getOptionValue(Q)===void 0||["default","config","env"].includes(this.getOptionValueSource(Q)))if(A.required||A.optional)this.emit(`optionEnv:${A.name()}`,O1.env[A.envVar]);else this.emit(`optionEnv:${A.name()}`)}})}_parseOptionsImplied(){let A=new ydA(this.options),Q=(B)=>{return this.getOptionValue(B)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(B))};this.options.filter((B)=>B.implied!==void 0&&Q(B.attributeName())&&A.valueFromOption(this.getOptionValue(B.attributeName()),B)).forEach((B)=>{Object.keys(B.implied).filter(($)=>!Q($)).forEach(($)=>{this.setOptionValueWithSource($,B.implied[$],"implied")})})}missingArgument(A){let Q=`error: missing required argument '${A}'`;this.error(Q,{code:"commander.missingArgument"})}optionMissingArgument(A){let Q=`error: option '${A.flags}' argument missing`;this.error(Q,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(A){let Q=`error: required option '${A.flags}' not specified`;this.error(Q,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(A,Q){let B=(E)=>{let G=E.attributeName(),J=this.getOptionValue(G),Y=this.options.find((H)=>H.negate&&G===H.attributeName()),X=this.options.find((H)=>!H.negate&&G===H.attributeName());if(Y&&(Y.presetArg===void 0&&J===!1||Y.presetArg!==void 0&&J===Y.presetArg))return Y;return X||E},$=(E)=>{let G=B(E),J=G.attributeName();if(this.getOptionValueSource(J)==="env")return`environment variable '${G.envVar}'`;return`option '${G.flags}'`},I=`error: ${$(A)} cannot be used with ${$(Q)}`;this.error(I,{code:"commander.conflictingOption"})}unknownOption(A){if(this._allowUnknownOption)return;let Q="";if(A.startsWith("--")&&this._showSuggestionAfterError){let $=[],I=this;do{let E=I.createHelp().visibleOptions(I).filter((G)=>G.long).map((G)=>G.long);$=$.concat(E),I=I.parent}while(I&&!I._enablePositionalOptions);Q=n4A(A,$)}let B=`error: unknown option '${A}'${Q}`;this.error(B,{code:"commander.unknownOption"})}_excessArguments(A){if(this._allowExcessArguments)return;let Q=this.registeredArguments.length,B=Q===1?"":"s",I=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${Q} argument${B} but got ${A.length}.`;this.error(I,{code:"commander.excessArguments"})}unknownCommand(){let A=this.args[0],Q="";if(this._showSuggestionAfterError){let $=[];this.createHelp().visibleCommands(this).forEach((I)=>{if($.push(I.name()),I.alias())$.push(I.alias())}),Q=n4A(A,$)}let B=`error: unknown command '${A}'${Q}`;this.error(B,{code:"commander.unknownCommand"})}version(A,Q,B){if(A===void 0)return this._version;this._version=A,Q=Q||"-V, --version",B=B||"output the version number";let $=this.createOption(Q,B);return this._versionOptionName=$.attributeName(),this._registerOption($),this.on("option:"+$.name(),()=>{this._outputConfiguration.writeOut(`${A}
|
|
92
92
|
`),this._exit(0,"commander.version",A)}),this}description(A,Q){if(A===void 0&&Q===void 0)return this._description;if(this._description=A,Q)this._argsDescription=Q;return this}summary(A){if(A===void 0)return this._summary;return this._summary=A,this}alias(A){if(A===void 0)return this._aliases[0];let Q=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)Q=this.commands[this.commands.length-1];if(A===Q._name)throw Error("Command alias can't be the same as its name");let B=this.parent?._findCommand(A);if(B){let $=[B.name()].concat(B.aliases()).join("|");throw Error(`cannot add alias '${A}' to command '${this.name()}' as already have command '${$}'`)}return Q._aliases.push(A),this}aliases(A){if(A===void 0)return this._aliases;return A.forEach((Q)=>this.alias(Q)),this}usage(A){if(A===void 0){if(this._usage)return this._usage;let Q=this.registeredArguments.map((B)=>{return xdA(B)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?Q:[]).join(" ")}return this._usage=A,this}name(A){if(A===void 0)return this._name;return this._name=A,this}helpGroup(A){if(A===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=A,this}commandsGroup(A){if(A===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=A,this}optionsGroup(A){if(A===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=A,this}_initOptionGroup(A){if(this._defaultOptionGroup&&!A.helpGroupHeading)A.helpGroup(this._defaultOptionGroup)}_initCommandGroup(A){if(this._defaultCommandGroup&&!A.helpGroup())A.helpGroup(this._defaultCommandGroup)}nameFromFilename(A){return this._name=_D.basename(A,_D.extname(A)),this}executableDir(A){if(A===void 0)return this._executableDir;return this._executableDir=A,this}helpInformation(A){let Q=this.createHelp(),B=this._getOutputContext(A);Q.prepareContext({error:B.error,helpWidth:B.helpWidth,outputHasColors:B.hasColors});let $=Q.formatHelp(this,Q);if(B.hasColors)return $;return this._outputConfiguration.stripColor($)}_getOutputContext(A){A=A||{};let Q=!!A.error,B,$,I;if(Q)B=(G)=>this._outputConfiguration.writeErr(G),$=this._outputConfiguration.getErrHasColors(),I=this._outputConfiguration.getErrHelpWidth();else B=(G)=>this._outputConfiguration.writeOut(G),$=this._outputConfiguration.getOutHasColors(),I=this._outputConfiguration.getOutHelpWidth();return{error:Q,write:(G)=>{if(!$)G=this._outputConfiguration.stripColor(G);return B(G)},hasColors:$,helpWidth:I}}outputHelp(A){let Q;if(typeof A==="function")Q=A,A=void 0;let B=this._getOutputContext(A),$={error:B.error,write:B.write,command:this};this._getCommandAndAncestors().reverse().forEach((E)=>E.emit("beforeAllHelp",$)),this.emit("beforeHelp",$);let I=this.helpInformation({error:B.error});if(Q){if(I=Q(I),typeof I!=="string"&&!Buffer.isBuffer(I))throw Error("outputHelp callback must return a string or a Buffer")}if(B.write(I),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",$),this._getCommandAndAncestors().forEach((E)=>E.emit("afterAllHelp",$))}helpOption(A,Q){if(typeof A==="boolean"){if(A){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption(A??"-h, --help",Q??"display help for command"),A||Q)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption(A){return this._helpOption=A,this._initOptionGroup(A),this}help(A){this.outputHelp(A);let Q=Number(O1.exitCode??0);if(Q===0&&A&&typeof A!=="function"&&A.error)Q=1;this._exit(Q,"commander.help","(outputHelp)")}addHelpText(A,Q){let B=["beforeAll","before","after","afterAll"];if(!B.includes(A))throw Error(`Unexpected value for position to addHelpText.
|
|
93
93
|
Expecting one of '${B.join("', '")}'`);let $=`${A}Help`;return this.on($,(I)=>{let E;if(typeof Q==="function")E=Q({error:I.error,command:I.command});else E=Q;if(E)I.write(`${E}
|
|
94
|
-
`)}),this}_outputHelpIfRequested(A){let Q=this._getHelpOption();if(Q&&A.find(($)=>Q.is($)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function i4A(A){return A.map((Q)=>{if(!Q.startsWith("--inspect"))return Q;let B,$="127.0.0.1",I="9229",E;if((E=Q.match(/^(--inspect(-brk)?)$/))!==null)B=E[1];else if((E=Q.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(B=E[1],/^\d+$/.test(E[3]))I=E[3];else $=E[3];else if((E=Q.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)B=E[1],$=E[3],I=E[4];if(B&&I!=="0")return`${B}=${$}:${parseInt(I)+1}`;return Q})}function bf(){if(O1.env.NO_COLOR||O1.env.FORCE_COLOR==="0"||O1.env.FORCE_COLOR==="false")return!1;if(O1.env.FORCE_COLOR||O1.env.CLICOLOR_FORCE!==void 0)return!0;return}fdA.Command=gf;fdA.useColor=bf});var t4A=b((ldA)=>{var{Argument:o4A}=cO(),{Command:yf}=r4A(),{CommanderError:mdA,InvalidArgumentError:a4A}=DZ(),{Help:cdA}=_f(),{Option:s4A}=kf();ldA.program=new yf;ldA.createCommand=(A)=>new yf(A);ldA.createOption=(A,Q)=>new s4A(A,Q);ldA.createArgument=(A,Q)=>new o4A(A,Q);ldA.Command=yf;ldA.Option=s4A;ldA.Argument=o4A;ldA.Help=cdA;ldA.CommanderError=mdA;ldA.InvalidArgumentError=a4A;ldA.InvalidOptionArgumentError=a4A});var i8;var $9=_A(()=>{i8={name:"@capgo/cli",type:"module",version:"8.5.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/capgo.git",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","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:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:credentials":"bun test/test-credentials.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:mcp":"node test/test-mcp.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:payload-split":"bun test/test-payload-split.mjs","test:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:apple-api-cert-create":"bun test/test-apple-api-cert-create.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:manifest-path-encoding":"bun test/test-manifest-path-encoding.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs","test:android-tail-engine":"bun test/test-android-tail-engine.mjs","test:android-tail-render":"bun test/test-android-tail-render.mjs","test:android-tail-routing":"bun test/test-android-tail-routing.mjs","test:dev-gate-stripped":"bun test/test-dev-gate-stripped.mjs","test:frame-fit-ios-shared":"bun test/test-frame-fit-ios-shared.mjs","test:ios-confirm-app-id":"bun test/test-ios-confirm-app-id.mjs","test:ios-create-new":"bun test/test-ios-create-new.mjs","test:ios-e2e":"bun test/test-ios-e2e.mjs","test:ios-flow-contract":"bun test/test-ios-flow-contract.mjs","test:ios-import-discovery":"bun test/test-ios-import-discovery.mjs","test:ios-import-export":"bun test/test-ios-import-export.mjs","test:ios-import-pickers":"bun test/test-ios-import-pickers.mjs","test:ios-import-recovery":"bun test/test-ios-import-recovery.mjs","test:ios-recovery":"bun test/test-ios-recovery.mjs","test:ios-resume":"bun test/test-ios-resume.mjs","test:ios-tail-handoff":"bun test/test-ios-tail-handoff.mjs","test:ios-tui-render":"bun test/test-ios-tui-render.mjs","test:p8-error":"bun test/test-p8-error.mjs","test:ios-tui-routing":"bun test/test-ios-tui-routing.mjs","test:ios-updater-sync-validation":"bun test/test-ios-updater-sync-validation.mjs","test:ios-verify-app":"bun test/test-ios-verify-app.mjs","test:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun run test:helper-dce && bun run test:version-detection:setup && 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 && bun run test:fail-on-incompatible && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:mcp-analytics && bun run test:app-created-source && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:version-detection && bun run test:platform-paths && bun run test:payload-split && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:platform-flow-contract && bun run test:tail-engine-shared","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:ai-analyze-stream":"bun test/test-ai-analyze-stream.mjs","test:ai-sse-parser":"bun test/test-ai-sse-parser.mjs","test:ai-render-markdown":"bun test/test-ai-render-markdown.mjs","test:ai-onboarding-mode":"bun test/test-ai-onboarding-mode.mjs","test:ai-fit":"bun test/test-ai-fit.mjs","test:platform-layout":"bun test/test-platform-layout.mjs","test:frame-fit":"bun test/run-frame-fit.mjs","test:onboarding-min-size":"bun test/test-onboarding-min-size.mjs","test:min-size-gate":"bun test/test-min-size-gate.mjs","test:shell-size-gate":"bun test/test-shell-size-gate.mjs","test:build-log-sanitize":"bun test/test-build-log-sanitize.mjs","test:build-output-viewport":"bun test/test-build-output-viewport.mjs","test:diff-viewer-viewport":"bun test/test-diff-viewer-viewport.mjs","test:build-complete-exit":"bun test/test-build-complete-exit.mjs","test:ai-stream-markdown":"bun test/test-ai-stream-markdown.mjs","test:support-mailto":"bun test/test-support-mailto.mjs","test:support-redact":"bun test/test-support-redact.mjs","test:support-internal-log":"bun test/test-support-internal-log.mjs","test:support-help-menu":"bun test/test-support-help-menu.mjs","test:support-contact":"bun test/test-support-contact.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.mjs"},dependencies:{"@inkjs/ui":"^2.0.0",ink:"^7.0.4","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.6","string-width":"^8.2.1"},optionalDependencies:{"@capgo/cli-helper-darwin-arm64":"^1.1.0","@capgo/cli-helper-darwin-x64":"^1.1.0"},devDependencies:{"@antfu/eslint-config":"^9.0.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.3.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.4.0","@modelcontextprotocol/sdk":"^1.29.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.106.2","@tanstack/intent":"^0.0.41","@types/adm-zip":"^0.5.8","@types/jsonwebtoken":"^9.0.10","@types/node":"^25.9.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.15","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native-preview":"7.0.0-dev.20260526.1","@vercel/ncc":"^0.38.4","@xterm/headless":"^6.0.0","adm-zip":"^0.5.17","ci-info":"^4.4.0",commander:"^14.0.3",eslint:"^10.4.0","git-format-staged":"4.0.1",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.67.0",partysocket:"^1.1.19",prettyjson:"^1.2.5",tmp:"^0.2.6","tus-js-client":"^4.3.1",typescript:"^6.0.3",ws:"^8.21.0",zod:"^4.4.3"}}});function BpA(A){if(A&&typeof A==="object"&&"status"in A){let Q=A.status;if(typeof Q==="number")return Q}return}function $pA(A){if(A instanceof Error)return A.message;if(typeof A==="string")return A;return""}function UZ(A){if(A&&typeof A==="object"&&"code"in A){let $=A.code;if(typeof $==="string"&&$.startsWith("commander."))return"commander"}let Q=BpA(A);if(Q!==void 0){if(Q===401)return"unauthorized";if(Q===403)return"forbidden";if(Q===404)return"not_found";if(Q===413)return"payload_too_large";if(Q>=500)return"server_error"}let B=$pA(A).toLowerCase();if(/econnrefused|enotfound|fetch failed|network|socket|dns/.test(B))return"network_error";if(/timed out|timeout|etimedout|aborted/.test(B))return"timeout";if(/invalid|must be|required|not allowed|malformed|validation/.test(B))return"validation_error";return"unknown"}function A$A(A){if(A===401)return"unauthorized";if(A===403)return"forbidden";if(A===404)return"not_found";if(A===408||A===504)return"timeout";if(A===413)return"payload_too_large";if(A===429)return"rate_limited";if(A===400||A===422)return"validation_error";if(A>=500)return"server_error";return"unknown"}import{AsyncLocalStorage as IpA}from"node:async_hooks";function XZ(A,Q){return B$A.run(A,()=>Promise.resolve(Q()))}function EpA(){return B$A.getStore()}function HZ(){$$A=!0}function I$A(){return $$A}function G$A(A){E$A=A}function Q$A(A){try{E$A?.(A)}catch{}}function D$A(A,Q){let B;try{B=new URL(A).pathname}catch{B=A.split("?")[0]}let $="/functions/v1/",I=B.indexOf($);if(I>=0){let X=B.slice(I+$.length).replace(/^\/+|\/+$/g,"");return X?`${Q} functions:${X}`:`${Q} functions`}let E="/rest/v1/",G=B.indexOf(E),J=G>=0?B.slice(G+E.length):B.replace(/^\//,"");if(J.startsWith("rpc/"))return`rpc:${J.slice(4).split("/")[0]}`;let Y=J.split("/")[0]||B;return`${Q} ${Y}`}function GpA(A){let Q=A?.headers;if(!Q)return;let B=Q.get;if(typeof B==="function")return B.call(Q,"capgkey")??void 0;if(Array.isArray(Q))return Q.find(([$])=>$.toLowerCase()==="capgkey")?.[1];return Q.capgkey}function Y$A(){return async(Q,B)=>{let $=(B?.method??"GET").toUpperCase(),I=typeof Q==="string"?Q:Q instanceof URL?Q.href:Q.url,E=EpA(),G=GpA(B),J=Date.now();try{let Y=await globalThis.fetch(Q,B);return Q$A({url:I,method:$,status:Y.status,ok:Y.ok,durationMs:Date.now()-J,source:E,apikey:G}),Y}catch(Y){throw Q$A({url:I,method:$,status:0,ok:!1,durationMs:Date.now()-J,source:E,apikey:G,error:Y}),Y}}}var B$A,$$A=!1,E$A,J$A=5000;var FZ=_A(()=>{B$A=new IpA});var U$A=b((ziQ,JpA)=>{JpA.exports=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Alpic",constant:"ALPIC",env:"ALPIC_HOST"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Cloudflare Pages",constant:"CLOUDFLARE_PAGES",env:"CF_PAGES"},{name:"Cloudflare Workers",constant:"CLOUDFLARE_WORKERS",env:"WORKERS_CI"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]});var uf=b((ff)=>{var X$A=U$A(),_4=process.env;Object.defineProperty(ff,"_vendors",{value:X$A.map(function(A){return A.constant})});ff.name=null;ff.isPR=null;ff.id=null;if(_4.CI!=="false")X$A.forEach(function(A){let B=(Array.isArray(A.env)?A.env:[A.env]).every(function($){return H$A($)});if(ff[A.constant]=B,!B)return;ff.name=A.name,ff.isPR=DpA(A),ff.id=A.constant});ff.isCI=!!(_4.CI!=="false"&&(_4.BUILD_ID||_4.BUILD_NUMBER||_4.CI||_4.CI_APP_ID||_4.CI_BUILD_ID||_4.CI_BUILD_NUMBER||_4.CI_NAME||_4.CONTINUOUS_INTEGRATION||_4.RUN_ID||ff.name||!1));function H$A(A){if(typeof A==="string")return!!_4[A];if("env"in A)return _4[A.env]&&_4[A.env].includes(A.includes);if("any"in A)return A.any.some(function(Q){return!!_4[Q]});return Object.keys(A).every(function(Q){return _4[Q]===A[Q]})}function DpA(A){switch(typeof A.pr){case"string":return!!_4[A.pr];case"object":if("env"in A.pr)if("any"in A.pr)return A.pr.any.some(function(Q){return _4[A.pr.env]===Q});else return A.pr.env in _4&&_4[A.pr.env]!==A.pr.ne;else if("any"in A.pr)return A.pr.any.some(function(Q){return!!_4[Q]});else return H$A(A.pr);default:return null}}});import{homedir as C$A,platform as UpA,release as XpA}from"node:os";import{arch as HpA,cwd as K$A,env as bU,version as FpA}from"node:process";function WZ(A){return A==="1"||A?.toLowerCase()==="true"||A?.toLowerCase()==="yes"}function qpA(){if(WZ(bU.CAPGO_DISABLE_TELEMETRY)||WZ(bU.CAPGO_DISABLE_POSTHOG))return;return bU.CAPGO_CLI_POSTHOG_API_KEY?.trim()||bU.POSTHOG_API_KEY?.trim()||CpA}function ZpA(A){let Q=A.replace(/\/+$/,"");if(Q.endsWith("/i/v0/e"))return`${Q}/`;let B=Q.replace(/\/capture$/,"/");return new URL("i/v0/e/",B.endsWith("/")?B:`${B}/`).toString()}function MpA(A){if(A instanceof Error)return{cause:A.cause,message:A.message,name:A.name||"Error",stack:A.stack};if(typeof A==="string")return{message:A,name:"Error",stack:void 0};try{return{message:JSON.stringify(A)??String(A),name:"Error",stack:void 0}}catch{return{message:String(A),name:"Error",stack:void 0}}}function zpA(A){let Q=A,B=K$A(),$=C$A();if(B)Q=Q.replaceAll(B,"<cwd>");if($)Q=Q.replaceAll($,"~");return Q}function NpA(A){let Q=A,B=K$A(),$=C$A();if(B)Q=Q.replaceAll(B,"<cwd>");if($)Q=Q.replaceAll($,"~");return Q.replace(/<cwd>\/[^\s"',)]+/g,"<cwd>/<path>").replace(/~\/[^\s"',)]+/g,"~/<path>").replace(/[\w.%+-]+@[\w.-]+\.[A-Z]{2,}/gi,"<email>").replace(/(https?:\/\/)([^/\s:@]+):([^/\s@]+)@/gi,"$1<redacted>@").replace(/\b[a-z][\w-]*(?:\.[\w-]+){2,}\b/gi,"<app_id>").replace(/\b[a-z]:\\[^\s"',)]+/gi,"<path>").replace(/(^|[\s"'(])\/[^\s"',)]+/g,"$1<path>").replace(/(--(?:token|api[-_]?key|key|password|secret|private[-_]?key|jwt|session|auth)(?:=|\s+))("[^"]+"|'[^']+'|\S+)/gi,"$1<redacted>").replace(/\b((?:token|api[-_]?key|password|secret|authorization)\s*[:=]\s*)[^\s,;]+/gi,"$1<redacted>")}function LpA(A,Q){let B=A?.split(`
|
|
94
|
+
`)}),this}_outputHelpIfRequested(A){let Q=this._getHelpOption();if(Q&&A.find(($)=>Q.is($)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function i4A(A){return A.map((Q)=>{if(!Q.startsWith("--inspect"))return Q;let B,$="127.0.0.1",I="9229",E;if((E=Q.match(/^(--inspect(-brk)?)$/))!==null)B=E[1];else if((E=Q.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(B=E[1],/^\d+$/.test(E[3]))I=E[3];else $=E[3];else if((E=Q.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)B=E[1],$=E[3],I=E[4];if(B&&I!=="0")return`${B}=${$}:${parseInt(I)+1}`;return Q})}function bf(){if(O1.env.NO_COLOR||O1.env.FORCE_COLOR==="0"||O1.env.FORCE_COLOR==="false")return!1;if(O1.env.FORCE_COLOR||O1.env.CLICOLOR_FORCE!==void 0)return!0;return}fdA.Command=gf;fdA.useColor=bf});var t4A=b((ldA)=>{var{Argument:o4A}=cO(),{Command:yf}=r4A(),{CommanderError:mdA,InvalidArgumentError:a4A}=DZ(),{Help:cdA}=_f(),{Option:s4A}=kf();ldA.program=new yf;ldA.createCommand=(A)=>new yf(A);ldA.createOption=(A,Q)=>new s4A(A,Q);ldA.createArgument=(A,Q)=>new o4A(A,Q);ldA.Command=yf;ldA.Option=s4A;ldA.Argument=o4A;ldA.Help=cdA;ldA.CommanderError=mdA;ldA.InvalidArgumentError=a4A;ldA.InvalidOptionArgumentError=a4A});var i8;var $9=_A(()=>{i8={name:"@capgo/cli",type:"module",version:"8.5.1",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/capgo.git",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","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:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:credentials":"bun test/test-credentials.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:mcp":"node test/test-mcp.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:payload-split":"bun test/test-payload-split.mjs","test:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:apple-api-cert-create":"bun test/test-apple-api-cert-create.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:manifest-path-encoding":"bun test/test-manifest-path-encoding.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs","test:android-tail-engine":"bun test/test-android-tail-engine.mjs","test:android-tail-render":"bun test/test-android-tail-render.mjs","test:android-tail-routing":"bun test/test-android-tail-routing.mjs","test:dev-gate-stripped":"bun test/test-dev-gate-stripped.mjs","test:frame-fit-ios-shared":"bun test/test-frame-fit-ios-shared.mjs","test:ios-confirm-app-id":"bun test/test-ios-confirm-app-id.mjs","test:ios-create-new":"bun test/test-ios-create-new.mjs","test:ios-e2e":"bun test/test-ios-e2e.mjs","test:ios-flow-contract":"bun test/test-ios-flow-contract.mjs","test:ios-import-discovery":"bun test/test-ios-import-discovery.mjs","test:ios-import-export":"bun test/test-ios-import-export.mjs","test:ios-import-pickers":"bun test/test-ios-import-pickers.mjs","test:ios-import-recovery":"bun test/test-ios-import-recovery.mjs","test:ios-recovery":"bun test/test-ios-recovery.mjs","test:ios-resume":"bun test/test-ios-resume.mjs","test:ios-tail-handoff":"bun test/test-ios-tail-handoff.mjs","test:ios-tui-render":"bun test/test-ios-tui-render.mjs","test:p8-error":"bun test/test-p8-error.mjs","test:ios-tui-routing":"bun test/test-ios-tui-routing.mjs","test:ios-updater-sync-validation":"bun test/test-ios-updater-sync-validation.mjs","test:ios-verify-app":"bun test/test-ios-verify-app.mjs","test:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun run test:helper-dce && bun run test:version-detection:setup && 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 && bun run test:fail-on-incompatible && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:mcp-analytics && bun run test:app-created-source && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:version-detection && bun run test:platform-paths && bun run test:payload-split && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:platform-flow-contract && bun run test:tail-engine-shared","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:ai-analyze-stream":"bun test/test-ai-analyze-stream.mjs","test:ai-sse-parser":"bun test/test-ai-sse-parser.mjs","test:ai-render-markdown":"bun test/test-ai-render-markdown.mjs","test:ai-onboarding-mode":"bun test/test-ai-onboarding-mode.mjs","test:ai-fit":"bun test/test-ai-fit.mjs","test:platform-layout":"bun test/test-platform-layout.mjs","test:frame-fit":"bun test/run-frame-fit.mjs","test:onboarding-min-size":"bun test/test-onboarding-min-size.mjs","test:min-size-gate":"bun test/test-min-size-gate.mjs","test:shell-size-gate":"bun test/test-shell-size-gate.mjs","test:build-log-sanitize":"bun test/test-build-log-sanitize.mjs","test:build-output-viewport":"bun test/test-build-output-viewport.mjs","test:diff-viewer-viewport":"bun test/test-diff-viewer-viewport.mjs","test:build-complete-exit":"bun test/test-build-complete-exit.mjs","test:ai-stream-markdown":"bun test/test-ai-stream-markdown.mjs","test:support-mailto":"bun test/test-support-mailto.mjs","test:support-redact":"bun test/test-support-redact.mjs","test:support-internal-log":"bun test/test-support-internal-log.mjs","test:support-help-menu":"bun test/test-support-help-menu.mjs","test:support-contact":"bun test/test-support-contact.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.mjs"},dependencies:{"@inkjs/ui":"^2.0.0",ink:"^7.0.4","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.6","string-width":"^8.2.1"},optionalDependencies:{"@capgo/cli-helper-darwin-arm64":"^1.1.0","@capgo/cli-helper-darwin-x64":"^1.1.0"},devDependencies:{"@antfu/eslint-config":"^9.0.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.3.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.4.0","@modelcontextprotocol/sdk":"^1.29.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.106.2","@tanstack/intent":"^0.0.41","@types/adm-zip":"^0.5.8","@types/jsonwebtoken":"^9.0.10","@types/node":"^25.9.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.15","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native-preview":"7.0.0-dev.20260526.1","@vercel/ncc":"^0.38.4","@xterm/headless":"^6.0.0","adm-zip":"^0.5.17","ci-info":"^4.4.0",commander:"^14.0.3",eslint:"^10.4.0","git-format-staged":"4.0.1",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.67.0",partysocket:"^1.1.19",prettyjson:"^1.2.5",tmp:"^0.2.6","tus-js-client":"^4.3.1",typescript:"^6.0.3",ws:"^8.21.0",zod:"^4.4.3"}}});function BpA(A){if(A&&typeof A==="object"&&"status"in A){let Q=A.status;if(typeof Q==="number")return Q}return}function $pA(A){if(A instanceof Error)return A.message;if(typeof A==="string")return A;return""}function UZ(A){if(A&&typeof A==="object"&&"code"in A){let $=A.code;if(typeof $==="string"&&$.startsWith("commander."))return"commander"}let Q=BpA(A);if(Q!==void 0){if(Q===401)return"unauthorized";if(Q===403)return"forbidden";if(Q===404)return"not_found";if(Q===413)return"payload_too_large";if(Q>=500)return"server_error"}let B=$pA(A).toLowerCase();if(/econnrefused|enotfound|fetch failed|network|socket|dns/.test(B))return"network_error";if(/timed out|timeout|etimedout|aborted/.test(B))return"timeout";if(/invalid|must be|required|not allowed|malformed|validation/.test(B))return"validation_error";return"unknown"}function A$A(A){if(A===401)return"unauthorized";if(A===403)return"forbidden";if(A===404)return"not_found";if(A===408||A===504)return"timeout";if(A===413)return"payload_too_large";if(A===429)return"rate_limited";if(A===400||A===422)return"validation_error";if(A>=500)return"server_error";return"unknown"}import{AsyncLocalStorage as IpA}from"node:async_hooks";function XZ(A,Q){return B$A.run(A,()=>Promise.resolve(Q()))}function EpA(){return B$A.getStore()}function HZ(){$$A=!0}function I$A(){return $$A}function G$A(A){E$A=A}function Q$A(A){try{E$A?.(A)}catch{}}function D$A(A,Q){let B;try{B=new URL(A).pathname}catch{B=A.split("?")[0]}let $="/functions/v1/",I=B.indexOf($);if(I>=0){let X=B.slice(I+$.length).replace(/^\/+|\/+$/g,"");return X?`${Q} functions:${X}`:`${Q} functions`}let E="/rest/v1/",G=B.indexOf(E),J=G>=0?B.slice(G+E.length):B.replace(/^\//,"");if(J.startsWith("rpc/"))return`rpc:${J.slice(4).split("/")[0]}`;let Y=J.split("/")[0]||B;return`${Q} ${Y}`}function GpA(A){let Q=A?.headers;if(!Q)return;let B=Q.get;if(typeof B==="function")return B.call(Q,"capgkey")??void 0;if(Array.isArray(Q))return Q.find(([$])=>$.toLowerCase()==="capgkey")?.[1];return Q.capgkey}function Y$A(){return async(Q,B)=>{let $=(B?.method??"GET").toUpperCase(),I=typeof Q==="string"?Q:Q instanceof URL?Q.href:Q.url,E=EpA(),G=GpA(B),J=Date.now();try{let Y=await globalThis.fetch(Q,B);return Q$A({url:I,method:$,status:Y.status,ok:Y.ok,durationMs:Date.now()-J,source:E,apikey:G}),Y}catch(Y){throw Q$A({url:I,method:$,status:0,ok:!1,durationMs:Date.now()-J,source:E,apikey:G,error:Y}),Y}}}var B$A,$$A=!1,E$A,J$A=5000;var FZ=_A(()=>{B$A=new IpA});var U$A=b((ziQ,JpA)=>{JpA.exports=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Alpic",constant:"ALPIC",env:"ALPIC_HOST"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Cloudflare Pages",constant:"CLOUDFLARE_PAGES",env:"CF_PAGES"},{name:"Cloudflare Workers",constant:"CLOUDFLARE_WORKERS",env:"WORKERS_CI"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]});var uf=b((ff)=>{var X$A=U$A(),_4=process.env;Object.defineProperty(ff,"_vendors",{value:X$A.map(function(A){return A.constant})});ff.name=null;ff.isPR=null;ff.id=null;if(_4.CI!=="false")X$A.forEach(function(A){let B=(Array.isArray(A.env)?A.env:[A.env]).every(function($){return H$A($)});if(ff[A.constant]=B,!B)return;ff.name=A.name,ff.isPR=DpA(A),ff.id=A.constant});ff.isCI=!!(_4.CI!=="false"&&(_4.BUILD_ID||_4.BUILD_NUMBER||_4.CI||_4.CI_APP_ID||_4.CI_BUILD_ID||_4.CI_BUILD_NUMBER||_4.CI_NAME||_4.CONTINUOUS_INTEGRATION||_4.RUN_ID||ff.name||!1));function H$A(A){if(typeof A==="string")return!!_4[A];if("env"in A)return _4[A.env]&&_4[A.env].includes(A.includes);if("any"in A)return A.any.some(function(Q){return!!_4[Q]});return Object.keys(A).every(function(Q){return _4[Q]===A[Q]})}function DpA(A){switch(typeof A.pr){case"string":return!!_4[A.pr];case"object":if("env"in A.pr)if("any"in A.pr)return A.pr.any.some(function(Q){return _4[A.pr.env]===Q});else return A.pr.env in _4&&_4[A.pr.env]!==A.pr.ne;else if("any"in A.pr)return A.pr.any.some(function(Q){return!!_4[Q]});else return H$A(A.pr);default:return null}}});import{homedir as C$A,platform as UpA,release as XpA}from"node:os";import{arch as HpA,cwd as K$A,env as bU,version as FpA}from"node:process";function WZ(A){return A==="1"||A?.toLowerCase()==="true"||A?.toLowerCase()==="yes"}function qpA(){if(WZ(bU.CAPGO_DISABLE_TELEMETRY)||WZ(bU.CAPGO_DISABLE_POSTHOG))return;return bU.CAPGO_CLI_POSTHOG_API_KEY?.trim()||bU.POSTHOG_API_KEY?.trim()||CpA}function ZpA(A){let Q=A.replace(/\/+$/,"");if(Q.endsWith("/i/v0/e"))return`${Q}/`;let B=Q.replace(/\/capture$/,"/");return new URL("i/v0/e/",B.endsWith("/")?B:`${B}/`).toString()}function MpA(A){if(A instanceof Error)return{cause:A.cause,message:A.message,name:A.name||"Error",stack:A.stack};if(typeof A==="string")return{message:A,name:"Error",stack:void 0};try{return{message:JSON.stringify(A)??String(A),name:"Error",stack:void 0}}catch{return{message:String(A),name:"Error",stack:void 0}}}function zpA(A){let Q=A,B=K$A(),$=C$A();if(B)Q=Q.replaceAll(B,"<cwd>");if($)Q=Q.replaceAll($,"~");return Q}function NpA(A){let Q=A,B=K$A(),$=C$A();if(B)Q=Q.replaceAll(B,"<cwd>");if($)Q=Q.replaceAll($,"~");return Q.replace(/<cwd>\/[^\s"',)]+/g,"<cwd>/<path>").replace(/~\/[^\s"',)]+/g,"~/<path>").replace(/[\w.%+-]+@[\w.-]+\.[A-Z]{2,}/gi,"<email>").replace(/(https?:\/\/)([^/\s:@]+):([^/\s@]+)@/gi,"$1<redacted>@").replace(/\b[a-z][\w-]*(?:\.[\w-]+){2,}\b/gi,"<app_id>").replace(/\b[a-z]:\\[^\s"',)]+/gi,"<path>").replace(/(^|[\s"'(])\/[^\s"',)]+/g,"$1<path>").replace(/(--(?:token|api[-_]?key|key|password|secret|private[-_]?key|jwt|session|auth)(?:=|\s+))("[^"]+"|'[^']+'|\S+)/gi,"$1<redacted>").replace(/\b((?:token|api[-_]?key|password|secret|authorization)\s*[:=]\s*)[^\s,;]+/gi,"$1<redacted>")}function LpA(A,Q){let B=A?.split(`
|
|
95
95
|
`).slice(1).map(($)=>{let I=$.trim(),E=I.startsWith("at ")?I.slice(3):I,G=Q,J=E,Y=E.lastIndexOf(" (");if(Y!==-1&&E.endsWith(")"))G=E.slice(0,Y).trim()||Q,J=E.slice(Y+2,-1);else{let F=E.lastIndexOf(" "),C=F===-1?"":E.slice(F+1);if(/:\d+:\d+$/.test(C))G=E.slice(0,F).trim()||Q,J=C}let X=J.lastIndexOf(":"),H=X===-1?-1:J.lastIndexOf(":",X-1);if(X===-1||H===-1)return{function:Q,platform:"custom",lang:"javascript"};return{function:G,filename:zpA(J.slice(0,H)),lineno:Number.parseInt(J.slice(H+1,X),10),colno:Number.parseInt(J.slice(X+1),10),platform:"custom",lang:"javascript"}}).filter(Boolean);return B&&B.length>0?B:[{function:Q,platform:"custom",lang:"javascript"}]}function wpA(A){if(!A||typeof A!=="object"||!("code"in A))return;let{code:Q}=A;return typeof Q==="string"?Q:void 0}function q$A(A){return!wpA(A)?.startsWith("commander.")}function mf(A){let Q=[],B=A;while(B?.parent){let $=B.name();if($)Q.push($);B=B.parent}return Q.reverse().join(" ")||"unknown"}async function cf(A){let Q=qpA();if(!Q)return!1;let B=bU.CAPGO_CLI_POSTHOG_API_HOST?.trim()||bU.POSTHOG_API_HOST?.trim()||WpA,$;try{$=ZpA(B)}catch{return!1}let I=MpA(A.error),E=NpA(I.message),G=`cli:${i8.version}:${A.functionName}`,J=LpA(I.stack,A.functionName),Y=J[0],X=[G,A.kind,I.name||"Error",Y?.function||A.functionName,Y&&"filename"in Y?Y.filename:"unknown",String(A.status??1)].join(":"),H={token:Q,event:"$exception",properties:{distinct_id:G,$exception_list:[{type:I.name||"Error",value:E,mechanism:{handled:!0,synthetic:!1},stacktrace:{type:"raw",frames:J}}],$exception_fingerprint:X,architecture:HpA,cli_version:i8.version,error_kind:A.kind,function_name:A.functionName,is_ci:Boolean(bU.CI),node_version:FpA,os_platform:UpA(),os_release:XpA(),runtime:"cli",status:A.status},timestamp:new Date().toISOString()};try{let F=new AbortController,C=setTimeout(()=>F.abort(),KpA);try{return(await fetch($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(H),signal:F.signal})).ok}finally{clearTimeout(C)}}catch{return!1}}var WpA="https://eu.i.posthog.com/i/v0/e/",CpA="phc_NXDyDajQaTQVwb25DEhIVZfxVUn4R0Y348Z7vWYHZUi",KpA=1500;var lf=_A(()=>{$9()});import{existsSync as _6}from"fs";var CZ=(A=".",Q="unknown")=>{let B=`${A}/bun.lockb`,$=`${A}/bun.lock`,I=`${A}/pnpm-lock.yaml`,E=`${A}/shrinkwrap.yaml`,G=`${A}/yarn.lock`,J=`${A}/package-lock.json`,Y=`${A}/npm-shrinkwrap.json`;if(_6(B)||_6($))return"bun";if(_6(I)||_6(E))return"pnpm";if(_6(G))return"yarn";if(_6(J)||_6(Y))return"npm";return Q},dO=(A=CZ(),Q=!1)=>{switch(A){case"bun":return Q?"bun install":"install";case"pnpm":return Q?"pnpm install":"install";case"yarn":return Q?"yarn install":"install";case"npm":return Q?"npm install":"install";case"unknown":return Q?"unknown unknown":"unknown";default:return Q?"npm install":"install"}},Z$A=(A=".",Q="npx")=>{let B=`${A}/bun.lockb`,$=`${A}/bun.lock`,I=`${A}/pnpm-lock.yaml`,E=`${A}/shrinkwrap.yaml`,G=`${A}/yarn.lock`,J=`${A}/package-lock.json`,Y=`${A}/npm-shrinkwrap.json`;if(_6(B)||_6($))return"bunx";if(_6(I)||_6(E))return"pnpm exec";if(_6(G))return"yarn dlx";if(_6(J)||_6(Y))return"npx";return Q};var M$A=()=>{};function pO(A,Q){if(isNaN(A)||isNaN(Q))throw Error("Cannot compare against non-numbers");return A===Q?0:A<Q?-1:1}function L$A(A=[],Q=[]){if(A.length&&!Q.length)return-1;if(!A.length&&Q.length)return 1;return 0}function nO(A=[],Q=[]){let B=Math.max(A.length,Q.length);for(let $=0;$<B;$++){let I=A[$],E=Q[$];if(I===void 0&&E===void 0)return 0;if(E===void 0)return 1;if(I===void 0)return-1;if(typeof I==="string"&&typeof E==="number")return 1;if(typeof I==="number"&&typeof E==="string")return-1;if(I<E)return-1;if(I>E)return 1}return 0}function pf(A){return typeof A==="number"&&!Number.isNaN(A)&&(!Number.isFinite(A)||0<=A&&A<=Number.MAX_SAFE_INTEGER)}function k6(A){return A.split(".").filter(Boolean).map((Q)=>{if(jpA.test(Q)){let B=Number(Q);if(pf(B))return B}return Q})}function I9(A){return A.split(".").filter(Boolean)}function rO(A,Q){let B=Number(A);if(!pf(B))throw TypeError(Q);return B}function kD(A){return Number.isNaN(A.major)&&Number.isNaN(A.minor)&&Number.isNaN(A.patch)&&(A.prerelease===void 0||A.prerelease.length===0)&&(A.build===void 0||A.build.length===0)}var h3="0|[1-9]\\d*",OpA="\\d*[a-zA-Z-][a-zA-Z0-9-]*",RpA,z$A,w$A,N$A="[0-9A-Za-z-]+",O$A,R$A,V$A,j$A="(?:<|>)?=?",VpA="x|X|\\*",df,iO,T$A,S$A,nf=256,jpA;var ME=_A(()=>{RpA=`(?<major>${h3})\\.(?<minor>${h3})\\.(?<patch>${h3})`,z$A=`(?:${h3}|${OpA})`,w$A=`(?:-(?<prerelease>${z$A}(?:\\.${z$A})*))`,O$A=`(?:\\+(?<buildmetadata>${N$A}(?:\\.${N$A})*))`,R$A=`v?${RpA}${w$A}?${O$A}?`,V$A=new RegExp(`^${R$A}$`),df=`${h3}|${VpA}`,iO=`[v=\\s]*(?<major>${df})(?:\\.(?<minor>${df})(?:\\.(?<patch>${df})${w$A}?${O$A}?)?)?`,T$A=new RegExp(`^(?<operator>~>?|\\^|${j$A})\\s*${iO}$`),S$A=new RegExp(`^(?<operator>${j$A})\\s*(${R$A})$|^$`);jpA=new RegExp(`^${h3}$`)});function iI(A,Q){if(A===Q)return 0;return pO(A.major,Q.major)||pO(A.minor,Q.minor)||pO(A.patch,Q.patch)||L$A(A.prerelease,Q.prerelease)||nO(A.prerelease,Q.prerelease)}var eE=_A(()=>{ME()});function P$A(A,Q){let B=A.prerelease?.length||Q.prerelease?.length;if(A.major!==Q.major)return B?"premajor":"major";if(A.minor!==Q.minor)return B?"preminor":"minor";if(A.patch!==Q.patch)return B?"prepatch":"patch";if(nO(A.prerelease,Q.prerelease)!==0)return"prerelease"}var _$A=_A(()=>{ME()});function rf(A){return A.toFixed(0)}function o$(A){let Q=rf(A.major),B=rf(A.minor),$=rf(A.patch),I=A.prerelease?.join(".")??"",E=A.build?.join(".")??"";return[[`${Q}.${B}.${$}`,I].filter((Y)=>Y).join("-"),E].filter((Y)=>Y).join("+")}function TpA(A,Q){if(kD(Q))return!0;let B=iI(A,Q);switch(Q.operator){case"=":case void 0:return B===0;case"!=":return B!==0;case">":return B>0;case"<":return B<0;case">=":return B>=0;case"<=":return B<=0}}function oO(A,Q){for(let B of Q)if(!TpA(A,B))return!1;if(!A.prerelease?.length)return!0;for(let B of Q){if(kD(B))continue;if(!B.prerelease?.length)continue;let{major:$,minor:I,patch:E}=B;if(A.major===$&&A.minor===I&&A.patch===E)return!0}return!1}var aO=_A(()=>{ME();eE()});function KZ(A,Q){return Q.some((B)=>oO(A,B))}var qZ=_A(()=>{aO()});function SpA(A=[]){let Q=[...A],B=Q.length;while(B>=0){let $=Q[B];if(typeof $==="number"){Q[B]=$+1;break}B-=1}if(B===-1)Q.push(0);return Q}function ZZ(A=[],Q){let B=SpA(A);if(!Q)return B;let $=k6(Q);if($.every((I)=>typeof I==="string")){if($.every((I,E)=>I===B[E])&&typeof B[$.length]==="number")return B;$=[...$,0]}return $}function E5(A,Q,B={}){let $=B.build!==void 0?I9(B.build):A.build??[];switch(Q){case"premajor":return{major:A.major+1,minor:0,patch:0,prerelease:ZZ(A.prerelease,B.prerelease),build:$};case"preminor":return{major:A.major,minor:A.minor+1,patch:0,prerelease:ZZ(A.prerelease,B.prerelease),build:$};case"prepatch":return{major:A.major,minor:A.minor,patch:A.patch+1,prerelease:ZZ(A.prerelease,B.prerelease),build:$};case"prerelease":{let E=(A.prerelease??[]).length===0?A.patch+1:A.patch;return{major:A.major,minor:A.minor,patch:E,prerelease:ZZ(A.prerelease,B.prerelease),build:$}}case"major":return{major:(A.prerelease??[]).length===0||A.minor!==0||A.patch!==0?A.major+1:A.major,minor:0,patch:0,prerelease:[],build:$};case"minor":{let E=(A.prerelease??[]).length===0||A.patch!==0?A.minor+1:A.minor;return{major:A.major,minor:E,patch:0,prerelease:[],build:$}}case"patch":{let E=(A.prerelease??[]).length===0?A.patch+1:A.patch;return{major:A.major,minor:A.minor,patch:E,prerelease:[],build:$}}case"pre":return{major:A.major,minor:A.minor,patch:A.patch,prerelease:ZZ(A.prerelease,B.prerelease),build:$};default:throw TypeError(`Cannot increment version: invalid argument ${Q}`)}}var k$A=_A(()=>{ME()});var sO,u3;var MZ=_A(()=>{sO={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},u3={operator:void 0,...sO}});var of=_A(()=>{MZ();ME()});function af(A,Q){return iI(A,Q)>0}var sf=_A(()=>{eE()});var v$A=_A(()=>{qZ();sf()});function zE(A,Q){return iI(A,Q)<0}var tf=_A(()=>{eE()});var x$A=_A(()=>{qZ();tf()});function PpA(A){let B=A.match(S$A)?.groups;if(!B)return null;let{operator:$}=B;return{operator:$||void 0,...sO}}function M8(A){return!A||A.toLowerCase()==="x"||A==="*"}function _pA(A){if(M8(A.major))return;if(M8(A.minor))return{operator:">=",major:+A.major,minor:0,patch:0,prerelease:[],build:[]};if(M8(A.patch))return{operator:">=",major:+A.major,minor:+A.minor,patch:0,prerelease:[],build:[]};return{operator:">=",major:+A.major,minor:+A.minor,patch:+A.patch,prerelease:A.prerelease?k6(A.prerelease):[],build:[]}}function kpA(A){if(M8(A.major))return;if(M8(A.minor))return{operator:"<",major:+A.major+1,minor:0,patch:0,prerelease:[],build:[]};if(M8(A.patch))return{operator:"<",major:+A.major,minor:+A.minor+1,patch:0,prerelease:[],build:[]};if(A.prerelease)return{operator:"<=",major:+A.major,minor:+A.minor,patch:+A.patch,prerelease:k6(A.prerelease),build:[]};return{operator:"<=",major:+A.major,minor:+A.minor,patch:+A.patch,prerelease:[],build:[]}}function vpA(A){let Q=A.match(new RegExp(`^${iO}`)),B=Q?.groups;if(!B)return null;let $=Q[0].length,I=A.slice($).match(/^\s+-\s+/);if(!I)return null;let E=I[0].length,J=A.slice($+E).match(new RegExp(`^${iO}\\s*$`))?.groups,Y=_pA(B),X=kpA(J);return[Y,X].filter(Boolean)}function xpA(A){let Q=M8(A.major),B=M8(A.minor),$=M8(A.patch),I=+A.major,E=+A.minor,G=+A.patch;if(Q)return[u3];if(B)return[{operator:">=",major:I,minor:0,patch:0},{operator:"<",major:I+1,minor:0,patch:0}];if($){if(I===0)return[{operator:">=",major:I,minor:E,patch:0},{operator:"<",major:I,minor:E+1,patch:0}];return[{operator:">=",major:I,minor:E,patch:0},{operator:"<",major:I+1,minor:0,patch:0}]}let J=k6(A.prerelease??"");if(I===0){if(E===0)return[{operator:">=",major:I,minor:E,patch:G,prerelease:J},{operator:"<",major:I,minor:E,patch:G+1}];return[{operator:">=",major:I,minor:E,patch:G,prerelease:J},{operator:"<",major:I,minor:E+1,patch:0}]}return[{operator:">=",major:I,minor:E,patch:G,prerelease:J},{operator:"<",major:I+1,minor:0,patch:0}]}function bpA(A){let Q=M8(A.major),B=M8(A.minor),$=M8(A.patch),I=+A.major,E=+A.minor,G=+A.patch;if(Q)return[u3];if(B)return[{operator:">=",major:I,minor:0,patch:0},{operator:"<",major:I+1,minor:0,patch:0}];if($)return[{operator:">=",major:I,minor:E,patch:0},{operator:"<",major:I,minor:E+1,patch:0}];let J=k6(A.prerelease??"");return[{operator:">=",major:I,minor:E,patch:G,prerelease:J},{operator:"<",major:I,minor:E+1,patch:0}]}function gpA(A){let Q=M8(A.major),B=M8(A.minor),$=M8(A.patch),I=+A.major,E=+A.minor,G=+A.patch;if(Q)return[{operator:"<",major:0,minor:0,patch:0}];if(B){if($)return[{operator:"<",major:I,minor:0,patch:0}];return[{operator:"<",major:I,minor:0,patch:0}]}if($)return[{operator:"<",major:I,minor:E,patch:0}];let J=k6(A.prerelease??""),Y=I9(A.build??"");return[{operator:"<",major:I,minor:E,patch:G,prerelease:J,build:Y}]}function ypA(A){let Q=M8(A.minor),B=M8(A.patch),$=+A.major,I=+A.minor,E=+A.patch;if(Q)return[{operator:"<",major:$+1,minor:0,patch:0}];if(B)return[{operator:"<",major:$,minor:I+1,patch:0}];let G=k6(A.prerelease??""),J=I9(A.build??"");return[{operator:"<=",major:$,minor:I,patch:E,prerelease:G,build:J}]}function fpA(A){let Q=M8(A.major),B=M8(A.minor),$=M8(A.patch),I=+A.major,E=+A.minor,G=+A.patch;if(Q)return[{operator:"<",major:0,minor:0,patch:0}];if(B)return[{operator:">=",major:I+1,minor:0,patch:0}];if($)return[{operator:">=",major:I,minor:E+1,patch:0}];let J=k6(A.prerelease??""),Y=I9(A.build??"");return[{operator:">",major:I,minor:E,patch:G,prerelease:J,build:Y}]}function hpA(A){let Q=M8(A.major),B=M8(A.minor),$=M8(A.patch),I=+A.major,E=+A.minor,G=+A.patch;if(Q)return[u3];if(B)return[{operator:">=",major:I,minor:0,patch:0}];if($)return[{operator:">=",major:I,minor:E,patch:0}];let J=k6(A.prerelease??""),Y=I9(A.build??"");return[{operator:">=",major:I,minor:E,patch:G,prerelease:J,build:Y}]}function upA(A){let Q=M8(A.major),B=M8(A.minor),$=M8(A.patch),I=+A.major,E=+A.minor,G=+A.patch;if(Q)return[u3];if(B)return[{operator:">=",major:I,minor:0,patch:0},{operator:"<",major:I+1,minor:0,patch:0}];if($)return[{operator:">=",major:I,minor:E,patch:0},{operator:"<",major:I,minor:E+1,patch:0}];let J=k6(A.prerelease??""),Y=I9(A.build??"");return[{operator:A.operator==="="?"=":void 0,major:I,minor:E,patch:G,prerelease:J,build:Y}]}function mpA(A){let Q=A.match(T$A)?.groups;if(!Q)return PpA(A);switch(Q.operator){case"^":return xpA(Q);case"~":case"~>":return bpA(Q);case"<":return gpA(Q);case"<=":return ypA(Q);case">":return fpA(Q);case">=":return hpA(Q);default:return upA(Q)}}function cpA(A){return A.split(/\s+/).flatMap(mpA)}function tO(A){let Q=A.replaceAll(/(?<=[<>=~^])(\s+)/g,"").split(/\s*\|\|\s*/).map((B)=>vpA(B)||cpA(B));if(Q.some((B)=>B.includes(null)))throw TypeError(`Cannot parse version range: range "${A}" is invalid`);return Q}var ef=_A(()=>{ME();MZ()});function A0(A){if(typeof A!=="string")throw TypeError(`Cannot parse version as version must be a string: received ${typeof A}`);if(A.length>nf)throw TypeError(`Cannot parse version as version length is too long: length is ${A.length}, max length is ${nf}`);A=A.trim();let Q=A.match(V$A)?.groups;if(!Q)throw TypeError(`Cannot parse version: ${A}`);let B=rO(Q.major,`Cannot parse version ${A}: invalid major version`),$=rO(Q.minor,`Cannot parse version ${A}: invalid minor version`),I=rO(Q.patch,`Cannot parse version ${A}: invalid patch version`),E=Q.prerelease?k6(Q.prerelease):[],G=Q.buildmetadata?I9(Q.buildmetadata):[];return{major:B,minor:$,patch:I,prerelease:E,build:G}}var eO=_A(()=>{ME();ME()});function b$A(A,Q){let B=A.operator,$=Q.operator;if(B===void 0){if(kD(A))return!0;return KZ(A,[[Q]])}if($===void 0){if(kD(Q))return!0;return KZ(Q,[[A]])}let I=iI(A,Q);return(B===">="||B===">")&&($===">="||$===">")||(B==="<="||B==="<")&&($==="<="||$==="<")||I===0&&((B===">="||B==="<=")&&($===">="||$==="<="))||I===-1&&(B===">="||B===">")&&($==="<="||$==="<")||I===1&&(B==="<="||B==="<")&&($===">="||$===">")}function lpA(A){return A.every((Q)=>{return Q.some((B)=>dpA(B))})}function dpA(A){for(let Q=0;Q<A.length-1;Q++){let B=A[Q];for(let $ of A.slice(Q+1))if(!b$A(B,$))return!1}return!0}function g$A(A,Q){return lpA([A,Q])&&A.some((B)=>{return Q.some(($)=>{return B.every((I)=>{return $.every((E)=>b$A(I,E))})})})}var y$A=_A(()=>{ME();eE();qZ()});var f$A=_A(()=>{ef()});var h$A=_A(()=>{MZ();MZ();of()});function zZ(A){try{return A0(A),!0}catch{return!1}}var u$A=_A(()=>{eO()});var m$A=_A(()=>{eO()});var c$A=_A(()=>{ME()});var l$A=_A(()=>{eE()});var d$A=_A(()=>{eE()});var p$A=_A(()=>{aO();ME();eE()});function Ah(A,Q){return iI(A,Q)>=0}var n$A=_A(()=>{eE()});var i$A=_A(()=>{aO();ME();eE()});var r$A=_A(()=>{eE()});var AJ=_A(()=>{eE();_$A();qZ();k$A();of();v$A();x$A();ef();eO();y$A();f$A();h$A();u$A();m$A();c$A();l$A();d$A();sf();p$A();n$A();tf();i$A();r$A()});var v6=b((CoQ,BR)=>{var o$A,a$A,s$A,t$A,e$A,AIA,QIA,BIA,$IA,IIA,EIA,GIA,JIA,AR,Qh,DIA,YIA,UIA,m3,XIA,HIA,FIA,WIA,CIA,KIA,qIA,ZIA,MIA,QR,zIA,NIA,LIA;(function(A){var Q=typeof global==="object"?global:typeof self==="object"?self:typeof this==="object"?this:{};if(typeof define==="function"&&define.amd)define("tslib",["exports"],function($){A(B(Q,B($)))});else if(typeof BR==="object"&&typeof CoQ==="object")A(B(Q,B(CoQ)));else A(B(Q));function B($,I){if($!==Q)if(typeof Object.create==="function")Object.defineProperty($,"__esModule",{value:!0});else $.__esModule=!0;return function(E,G){return $[E]=I?I(E,G):G}}})(function(A){var Q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,G){E.__proto__=G}||function(E,G){for(var J in G)if(Object.prototype.hasOwnProperty.call(G,J))E[J]=G[J]};o$A=function(E,G){if(typeof G!=="function"&&G!==null)throw TypeError("Class extends value "+String(G)+" is not a constructor or null");Q(E,G);function J(){this.constructor=E}E.prototype=G===null?Object.create(G):(J.prototype=G.prototype,new J)},a$A=Object.assign||function(E){for(var G,J=1,Y=arguments.length;J<Y;J++){G=arguments[J];for(var X in G)if(Object.prototype.hasOwnProperty.call(G,X))E[X]=G[X]}return E},s$A=function(E,G){var J={};for(var Y in E)if(Object.prototype.hasOwnProperty.call(E,Y)&&G.indexOf(Y)<0)J[Y]=E[Y];if(E!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var X=0,Y=Object.getOwnPropertySymbols(E);X<Y.length;X++)if(G.indexOf(Y[X])<0&&Object.prototype.propertyIsEnumerable.call(E,Y[X]))J[Y[X]]=E[Y[X]]}return J},t$A=function(E,G,J,Y){var X=arguments.length,H=X<3?G:Y===null?Y=Object.getOwnPropertyDescriptor(G,J):Y,F;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")H=Reflect.decorate(E,G,J,Y);else for(var C=E.length-1;C>=0;C--)if(F=E[C])H=(X<3?F(H):X>3?F(G,J,H):F(G,J))||H;return X>3&&H&&Object.defineProperty(G,J,H),H},e$A=function(E,G){return function(J,Y){G(J,Y,E)}},AIA=function(E,G,J,Y,X,H){function F(x){if(x!==void 0&&typeof x!=="function")throw TypeError("Function expected");return x}var C=Y.kind,K=C==="getter"?"get":C==="setter"?"set":"value",Z=!G&&E?Y.static?E:E.prototype:null,M=G||(Z?Object.getOwnPropertyDescriptor(Z,Y.name):{}),N,O=!1;for(var j=J.length-1;j>=0;j--){var R={};for(var S in Y)R[S]=S==="access"?{}:Y[S];for(var S in Y.access)R.access[S]=Y.access[S];R.addInitializer=function(x){if(O)throw TypeError("Cannot add initializers after decoration has completed");H.push(F(x||null))};var T=(0,J[j])(C==="accessor"?{get:M.get,set:M.set}:M[K],R);if(C==="accessor"){if(T===void 0)continue;if(T===null||typeof T!=="object")throw TypeError("Object expected");if(N=F(T.get))M.get=N;if(N=F(T.set))M.set=N;if(N=F(T.init))X.unshift(N)}else if(N=F(T))if(C==="field")X.unshift(N);else M[K]=N}if(Z)Object.defineProperty(Z,Y.name,M);O=!0},QIA=function(E,G,J){var Y=arguments.length>2;for(var X=0;X<G.length;X++)J=Y?G[X].call(E,J):G[X].call(E);return Y?J:void 0},BIA=function(E){return typeof E==="symbol"?E:"".concat(E)},$IA=function(E,G,J){if(typeof G==="symbol")G=G.description?"[".concat(G.description,"]"):"";return Object.defineProperty(E,"name",{configurable:!0,value:J?"".concat(J," ",G):G})},IIA=function(E,G){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(E,G)},EIA=function(E,G,J,Y){function X(H){return H instanceof J?H:new J(function(F){F(H)})}return new(J||(J=Promise))(function(H,F){function C(M){try{Z(Y.next(M))}catch(N){F(N)}}function K(M){try{Z(Y.throw(M))}catch(N){F(N)}}function Z(M){M.done?H(M.value):X(M.value).then(C,K)}Z((Y=Y.apply(E,G||[])).next())})},GIA=function(E,G){var J={label:0,sent:function(){if(H[0]&1)throw H[1];return H[1]},trys:[],ops:[]},Y,X,H,F=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return F.next=C(0),F.throw=C(1),F.return=C(2),typeof Symbol==="function"&&(F[Symbol.iterator]=function(){return this}),F;function C(Z){return function(M){return K([Z,M])}}function K(Z){if(Y)throw TypeError("Generator is already executing.");while(F&&(F=0,Z[0]&&(J=0)),J)try{if(Y=1,X&&(H=Z[0]&2?X.return:Z[0]?X.throw||((H=X.return)&&H.call(X),0):X.next)&&!(H=H.call(X,Z[1])).done)return H;if(X=0,H)Z=[Z[0]&2,H.value];switch(Z[0]){case 0:case 1:H=Z;break;case 4:return J.label++,{value:Z[1],done:!1};case 5:J.label++,X=Z[1],Z=[0];continue;case 7:Z=J.ops.pop(),J.trys.pop();continue;default:if((H=J.trys,!(H=H.length>0&&H[H.length-1]))&&(Z[0]===6||Z[0]===2)){J=0;continue}if(Z[0]===3&&(!H||Z[1]>H[0]&&Z[1]<H[3])){J.label=Z[1];break}if(Z[0]===6&&J.label<H[1]){J.label=H[1],H=Z;break}if(H&&J.label<H[2]){J.label=H[2],J.ops.push(Z);break}if(H[2])J.ops.pop();J.trys.pop();continue}Z=G.call(E,J)}catch(M){Z=[6,M],X=0}finally{Y=H=0}if(Z[0]&5)throw Z[1];return{value:Z[0]?Z[1]:void 0,done:!0}}},JIA=function(E,G){for(var J in E)if(J!=="default"&&!Object.prototype.hasOwnProperty.call(G,J))QR(G,E,J)},QR=Object.create?function(E,G,J,Y){if(Y===void 0)Y=J;var X=Object.getOwnPropertyDescriptor(G,J);if(!X||("get"in X?!G.__esModule:X.writable||X.configurable))X={enumerable:!0,get:function(){return G[J]}};Object.defineProperty(E,Y,X)}:function(E,G,J,Y){if(Y===void 0)Y=J;E[Y]=G[J]},AR=function(E){var G=typeof Symbol==="function"&&Symbol.iterator,J=G&&E[G],Y=0;if(J)return J.call(E);if(E&&typeof E.length==="number")return{next:function(){if(E&&Y>=E.length)E=void 0;return{value:E&&E[Y++],done:!E}}};throw TypeError(G?"Object is not iterable.":"Symbol.iterator is not defined.")},Qh=function(E,G){var J=typeof Symbol==="function"&&E[Symbol.iterator];if(!J)return E;var Y=J.call(E),X,H=[],F;try{while((G===void 0||G-- >0)&&!(X=Y.next()).done)H.push(X.value)}catch(C){F={error:C}}finally{try{if(X&&!X.done&&(J=Y.return))J.call(Y)}finally{if(F)throw F.error}}return H},DIA=function(){for(var E=[],G=0;G<arguments.length;G++)E=E.concat(Qh(arguments[G]));return E},YIA=function(){for(var E=0,G=0,J=arguments.length;G<J;G++)E+=arguments[G].length;for(var Y=Array(E),X=0,G=0;G<J;G++)for(var H=arguments[G],F=0,C=H.length;F<C;F++,X++)Y[X]=H[F];return Y},UIA=function(E,G,J){if(J||arguments.length===2){for(var Y=0,X=G.length,H;Y<X;Y++)if(H||!(Y in G)){if(!H)H=Array.prototype.slice.call(G,0,Y);H[Y]=G[Y]}}return E.concat(H||Array.prototype.slice.call(G))},m3=function(E){return this instanceof m3?(this.v=E,this):new m3(E)},XIA=function(E,G,J){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var Y=J.apply(E,G||[]),X,H=[];return X=Object.create((typeof AsyncIterator==="function"?AsyncIterator:Object).prototype),C("next"),C("throw"),C("return",F),X[Symbol.asyncIterator]=function(){return this},X;function F(j){return function(R){return Promise.resolve(R).then(j,N)}}function C(j,R){if(Y[j]){if(X[j]=function(S){return new Promise(function(T,x){H.push([j,S,T,x])>1||K(j,S)})},R)X[j]=R(X[j])}}function K(j,R){try{Z(Y[j](R))}catch(S){O(H[0][3],S)}}function Z(j){j.value instanceof m3?Promise.resolve(j.value.v).then(M,N):O(H[0][2],j)}function M(j){K("next",j)}function N(j){K("throw",j)}function O(j,R){if(j(R),H.shift(),H.length)K(H[0][0],H[0][1])}},HIA=function(E){var G,J;return G={},Y("next"),Y("throw",function(X){throw X}),Y("return"),G[Symbol.iterator]=function(){return this},G;function Y(X,H){G[X]=E[X]?function(F){return(J=!J)?{value:m3(E[X](F)),done:!1}:H?H(F):F}:H}},FIA=function(E){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var G=E[Symbol.asyncIterator],J;return G?G.call(E):(E=typeof AR==="function"?AR(E):E[Symbol.iterator](),J={},Y("next"),Y("throw"),Y("return"),J[Symbol.asyncIterator]=function(){return this},J);function Y(H){J[H]=E[H]&&function(F){return new Promise(function(C,K){F=E[H](F),X(C,K,F.done,F.value)})}}function X(H,F,C,K){Promise.resolve(K).then(function(Z){H({value:Z,done:C})},F)}},WIA=function(E,G){if(Object.defineProperty)Object.defineProperty(E,"raw",{value:G});else E.raw=G;return E};var B=Object.create?function(E,G){Object.defineProperty(E,"default",{enumerable:!0,value:G})}:function(E,G){E.default=G},$=function(E){return $=Object.getOwnPropertyNames||function(G){var J=[];for(var Y in G)if(Object.prototype.hasOwnProperty.call(G,Y))J[J.length]=Y;return J},$(E)};CIA=function(E){if(E&&E.__esModule)return E;var G={};if(E!=null){for(var J=$(E),Y=0;Y<J.length;Y++)if(J[Y]!=="default")QR(G,E,J[Y])}return B(G,E),G},KIA=function(E){return E&&E.__esModule?E:{default:E}},qIA=function(E,G,J,Y){if(J==="a"&&!Y)throw TypeError("Private accessor was defined without a getter");if(typeof G==="function"?E!==G||!Y:!G.has(E))throw TypeError("Cannot read private member from an object whose class did not declare it");return J==="m"?Y:J==="a"?Y.call(E):Y?Y.value:G.get(E)},ZIA=function(E,G,J,Y,X){if(Y==="m")throw TypeError("Private method is not writable");if(Y==="a"&&!X)throw TypeError("Private accessor was defined without a setter");if(typeof G==="function"?E!==G||!X:!G.has(E))throw TypeError("Cannot write private member to an object whose class did not declare it");return Y==="a"?X.call(E,J):X?X.value=J:G.set(E,J),J},MIA=function(E,G){if(G===null||typeof G!=="object"&&typeof G!=="function")throw TypeError("Cannot use 'in' operator on non-object");return typeof E==="function"?G===E:E.has(G)},zIA=function(E,G,J){if(G!==null&&G!==void 0){if(typeof G!=="object"&&typeof G!=="function")throw TypeError("Object expected.");var Y,X;if(J){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");Y=G[Symbol.asyncDispose]}if(Y===void 0){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");if(Y=G[Symbol.dispose],J)X=Y}if(typeof Y!=="function")throw TypeError("Object not disposable.");if(X)Y=function(){try{X.call(this)}catch(H){return Promise.reject(H)}};E.stack.push({value:G,dispose:Y,async:J})}else if(J)E.stack.push({async:!0});return G};var I=typeof SuppressedError==="function"?SuppressedError:function(E,G,J){var Y=Error(J);return Y.name="SuppressedError",Y.error=E,Y.suppressed=G,Y};NIA=function(E){function G(H){E.error=E.hasError?new I(H,E.error,"An error was suppressed during disposal."):H,E.hasError=!0}var J,Y=0;function X(){while(J=E.stack.pop())try{if(!J.async&&Y===1)return Y=0,E.stack.push(J),Promise.resolve().then(X);if(J.dispose){var H=J.dispose.call(J.value);if(J.async)return Y|=2,Promise.resolve(H).then(X,function(F){return G(F),X()})}else Y|=1}catch(F){G(F)}if(Y===1)return E.hasError?Promise.reject(E.error):Promise.resolve();if(E.hasError)throw E.error}return X()},LIA=function(E,G){if(typeof E==="string"&&/^\.\.?\//.test(E))return E.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(J,Y,X,H,F){return Y?G?".jsx":".js":X&&(!H||!F)?J:X+H+"."+F.toLowerCase()+"js"});return E},A("__extends",o$A),A("__assign",a$A),A("__rest",s$A),A("__decorate",t$A),A("__param",e$A),A("__esDecorate",AIA),A("__runInitializers",QIA),A("__propKey",BIA),A("__setFunctionName",$IA),A("__metadata",IIA),A("__awaiter",EIA),A("__generator",GIA),A("__exportStar",JIA),A("__createBinding",QR),A("__values",AR),A("__read",Qh),A("__spread",DIA),A("__spreadArrays",YIA),A("__spreadArray",UIA),A("__await",m3),A("__asyncGenerator",XIA),A("__asyncDelegator",HIA),A("__asyncValues",FIA),A("__makeTemplateObject",WIA),A("__importStar",CIA),A("__importDefault",KIA),A("__classPrivateFieldGet",qIA),A("__classPrivateFieldSet",ZIA),A("__classPrivateFieldIn",MIA),A("__addDisposableResource",zIA),A("__disposeResources",NIA),A("__rewriteRelativeImportExtension",LIA)})});var RIA=b((wIA)=>{Object.defineProperty(wIA,"__esModule",{value:!0});wIA.resolveFetch=void 0;var ppA=(A)=>{if(A)return(...Q)=>A(...Q);return(...Q)=>fetch(...Q)};wIA.resolveFetch=ppA});var Bh=b((PIA)=>{Object.defineProperty(PIA,"__esModule",{value:!0});PIA.FunctionRegion=PIA.FunctionsHttpError=PIA.FunctionsRelayError=PIA.FunctionsFetchError=PIA.FunctionsError=void 0;class NZ extends Error{constructor(A,Q="FunctionsError",B){super(A);this.name=Q,this.context=B}toJSON(){return{name:this.name,message:this.message,context:this.context}}}PIA.FunctionsError=NZ;class jIA extends NZ{constructor(A){super("Failed to send a request to the Edge Function","FunctionsFetchError",A)}}PIA.FunctionsFetchError=jIA;class TIA extends NZ{constructor(A){super("Relay Error invoking the Edge Function","FunctionsRelayError",A)}}PIA.FunctionsRelayError=TIA;class SIA extends NZ{constructor(A){super("Edge Function returned a non-2xx status code","FunctionsHttpError",A)}}PIA.FunctionsHttpError=SIA;var VIA;(function(A){A.Any="any",A.ApNortheast1="ap-northeast-1",A.ApNortheast2="ap-northeast-2",A.ApSouth1="ap-south-1",A.ApSoutheast1="ap-southeast-1",A.ApSoutheast2="ap-southeast-2",A.CaCentral1="ca-central-1",A.EuCentral1="eu-central-1",A.EuWest1="eu-west-1",A.EuWest2="eu-west-2",A.EuWest3="eu-west-3",A.SaEast1="sa-east-1",A.UsEast1="us-east-1",A.UsWest1="us-west-1",A.UsWest2="us-west-2"})(VIA||(PIA.FunctionRegion=VIA={}))});var bIA=b((vIA)=>{Object.defineProperty(vIA,"__esModule",{value:!0});vIA.FunctionsClient=void 0;var apA=v6(),spA=RIA(),c3=Bh();class kIA{constructor(A,{headers:Q={},customFetch:B,region:$=c3.FunctionRegion.Any}={}){this.url=A,this.headers=Q,this.region=$,this.fetch=(0,spA.resolveFetch)(B)}setAuth(A){this.headers.Authorization=`Bearer ${A}`}invoke(A){return apA.__awaiter(this,arguments,void 0,function*(Q,B={}){var $;let I,E;try{let{headers:G,method:J,body:Y,signal:X,timeout:H}=B,F={},{region:C}=B;if(!C)C=this.region;let K=new URL(`${this.url}/${Q}`);if(C&&C!=="any")F["x-region"]=C,K.searchParams.set("forceFunctionRegion",C);let Z;if(Y&&(G&&!Object.prototype.hasOwnProperty.call(G,"Content-Type")||!G))if(typeof Blob<"u"&&Y instanceof Blob||Y instanceof ArrayBuffer)F["Content-Type"]="application/octet-stream",Z=Y;else if(typeof Y==="string")F["Content-Type"]="text/plain",Z=Y;else if(typeof FormData<"u"&&Y instanceof FormData)Z=Y;else F["Content-Type"]="application/json",Z=JSON.stringify(Y);else if(Y&&typeof Y!=="string"&&!(typeof Blob<"u"&&Y instanceof Blob)&&!(Y instanceof ArrayBuffer)&&!(typeof FormData<"u"&&Y instanceof FormData))Z=JSON.stringify(Y);else Z=Y;let M=X;if(H)if(E=new AbortController,I=setTimeout(()=>E.abort(),H),X)M=E.signal,X.addEventListener("abort",()=>E.abort());else M=E.signal;let N=yield this.fetch(K.toString(),{method:J||"POST",headers:Object.assign(Object.assign(Object.assign({},F),this.headers),G),body:Z,signal:M}).catch((S)=>{throw new c3.FunctionsFetchError(S)}),O=N.headers.get("x-relay-error");if(O&&O==="true")throw new c3.FunctionsRelayError(N);if(!N.ok)throw new c3.FunctionsHttpError(N);let j=(($=N.headers.get("Content-Type"))!==null&&$!==void 0?$:"text/plain").split(";")[0].trim(),R;if(j==="application/json")R=yield N.json();else if(j==="application/octet-stream"||j==="application/pdf")R=yield N.blob();else if(j==="text/event-stream")R=N;else if(j==="multipart/form-data")R=yield N.formData();else R=yield N.text();return{data:R,error:null,response:N}}catch(G){return{data:null,error:G,response:G instanceof c3.FunctionsHttpError||G instanceof c3.FunctionsRelayError?G.context:void 0}}finally{if(I)clearTimeout(I)}})}}vIA.FunctionsClient=kIA});var gIA=b((G5)=>{Object.defineProperty(G5,"__esModule",{value:!0});G5.FunctionRegion=G5.FunctionsRelayError=G5.FunctionsHttpError=G5.FunctionsFetchError=G5.FunctionsError=G5.FunctionsClient=void 0;var tpA=bIA();Object.defineProperty(G5,"FunctionsClient",{enumerable:!0,get:function(){return tpA.FunctionsClient}});var LZ=Bh();Object.defineProperty(G5,"FunctionsError",{enumerable:!0,get:function(){return LZ.FunctionsError}});Object.defineProperty(G5,"FunctionsFetchError",{enumerable:!0,get:function(){return LZ.FunctionsFetchError}});Object.defineProperty(G5,"FunctionsHttpError",{enumerable:!0,get:function(){return LZ.FunctionsHttpError}});Object.defineProperty(G5,"FunctionsRelayError",{enumerable:!0,get:function(){return LZ.FunctionsRelayError}});Object.defineProperty(G5,"FunctionRegion",{enumerable:!0,get:function(){return LZ.FunctionRegion}})});function fIA(A,Q){return new Promise((B)=>{if(Q===null||Q===void 0?void 0:Q.aborted){B();return}let $=setTimeout(()=>{Q===null||Q===void 0||Q.removeEventListener("abort",I),B()},A);function I(){clearTimeout($),B()}Q===null||Q===void 0||Q.addEventListener("abort",I)})}function QnA(A,Q,B,$){if(!$||B>=3)return!1;if(!mIA.includes(A))return!1;if(!AnA.includes(Q))return!1;return!0}function wZ(A){return wZ=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Q){return typeof Q}:function(Q){return Q&&typeof Symbol=="function"&&Q.constructor===Symbol&&Q!==Symbol.prototype?"symbol":typeof Q},wZ(A)}function EnA(A,Q){if(wZ(A)!="object"||!A)return A;var B=A[Symbol.toPrimitive];if(B!==void 0){var $=B.call(A,Q||"default");if(wZ($)!="object")return $;throw TypeError("@@toPrimitive must return a primitive value.")}return(Q==="string"?String:Number)(A)}function GnA(A){var Q=EnA(A,"string");return wZ(Q)=="symbol"?Q:Q+""}function JnA(A,Q,B){return(Q=GnA(Q))in A?Object.defineProperty(A,Q,{value:B,enumerable:!0,configurable:!0,writable:!0}):A[Q]=B,A}function uIA(A,Q){var B=Object.keys(A);if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(A);Q&&($=$.filter(function(I){return Object.getOwnPropertyDescriptor(A,I).enumerable})),B.push.apply(B,$)}return B}function $R(A){for(var Q=1;Q<arguments.length;Q++){var B=arguments[Q]!=null?arguments[Q]:{};Q%2?uIA(Object(B),!0).forEach(function($){JnA(A,$,B[$])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(B)):uIA(Object(B)).forEach(function($){Object.defineProperty(A,$,Object.getOwnPropertyDescriptor(B,$))})}return A}var yIA=(A)=>Math.min(1000*2**A,30000),AnA,mIA,$h,BnA=class{constructor(A){var Q,B,$,I,E;if(this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=A.method,this.url=A.url,this.headers=new Headers(A.headers),this.schema=A.schema,this.body=A.body,this.shouldThrowOnError=(Q=A.shouldThrowOnError)!==null&&Q!==void 0?Q:!1,this.signal=A.signal,this.isMaybeSingle=(B=A.isMaybeSingle)!==null&&B!==void 0?B:!1,this.shouldStripNulls=($=A.shouldStripNulls)!==null&&$!==void 0?$:!1,this.urlLengthLimit=(I=A.urlLengthLimit)!==null&&I!==void 0?I:8000,this.retryEnabled=(E=A.retry)!==null&&E!==void 0?E:!0,A.fetch)this.fetch=A.fetch;else this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(A,Q){return this.headers=new Headers(this.headers),this.headers.set(A,Q),this}retry(A){return this.retryEnabled=A,this}then(A,Q){var B=this;if(this.schema===void 0);else if(["GET","HEAD"].includes(this.method))this.headers.set("Accept-Profile",this.schema);else this.headers.set("Content-Profile",this.schema);if(this.method!=="GET"&&this.method!=="HEAD")this.headers.set("Content-Type","application/json");if(this.shouldStripNulls){let G=this.headers.get("Accept");if(G==="application/vnd.pgrst.object+json")this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped");else if(!G||G==="application/json")this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}let $=this.fetch,E=(async()=>{let G=0;while(!0){let X=new Headers(B.headers);if(G>0)X.set("X-Retry-Count",String(G));let H;try{H=await $(B.url.toString(),{method:B.method,headers:X,body:JSON.stringify(B.body,(F,C)=>typeof C==="bigint"?C.toString():C),signal:B.signal})}catch(F){if((F===null||F===void 0?void 0:F.name)==="AbortError"||(F===null||F===void 0?void 0:F.code)==="ABORT_ERR")throw F;if(!mIA.includes(B.method))throw F;if(B.retryEnabled&&G<3){let C=yIA(G);G++,await fIA(C,B.signal);continue}throw F}if(QnA(B.method,H.status,G,B.retryEnabled)){var J,Y;let F=(J=(Y=H.headers)===null||Y===void 0?void 0:Y.get("Retry-After"))!==null&&J!==void 0?J:null,C=F!==null?Math.max(0,parseInt(F,10)||0)*1000:yIA(G);await H.text(),G++,await fIA(C,B.signal);continue}return await B.processResponse(H)}})();if(!this.shouldThrowOnError)E=E.catch((G)=>{var J;let Y="",X="",H="",F=G===null||G===void 0?void 0:G.cause;if(F){var C,K,Z,M;let j=(C=F===null||F===void 0?void 0:F.message)!==null&&C!==void 0?C:"",R=(K=F===null||F===void 0?void 0:F.code)!==null&&K!==void 0?K:"";if(Y=`${(Z=G===null||G===void 0?void 0:G.name)!==null&&Z!==void 0?Z:"FetchError"}: ${G===null||G===void 0?void 0:G.message}`,Y+=`
|
|
96
96
|
|
|
97
97
|
Caused by: ${(M=F===null||F===void 0?void 0:F.name)!==null&&M!==void 0?M:"Error"}: ${j}`,R)Y+=` (${R})`;if(F===null||F===void 0?void 0:F.stack)Y+=`
|
|
@@ -906,7 +906,7 @@ Bundle uploaded \uD83D\uDCAA in 0 seconds`),G.verbose)w.info("[Verbose] Dry uplo
|
|
|
906
906
|
The bundle size is ${R} Mb, this may take a while to download for users
|
|
907
907
|
`),w.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
|
|
908
908
|
`);let S=G?a1():null,T=Q.name||`${Y}_${I}.zip`;if(S)S.start(`Saving to ${T}`);if(FkQ(T,C),S)S.stop(`Saved to ${T}`);if(QB({channel:"bundle",event:"Bundle Zipped",icon:"\uD83D\uDDDC️",tags:{zip_size_bytes:C.byteLength}}),G)XB("Done ✅");if(!B&&$)KkQ({bundle:I,filename:T,checksum:j});return{bundle:I,filename:T,checksum:j}}catch(J){if(!B)if($)BL(J);else w.error(VA(J));throw J instanceof Error?J:Error(String(J))}}async function xkA(A,Q){await Ce(A,Q,!1)}gB();CB();async function $L(A,Q,B,$=!1){if(!$)UB("Create channel");B.apikey=B.apikey||dQ();let I=await GB($).catch(()=>{return});if(Q=cB(Q,I?.config),!B.apikey){if(!$)w.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!Q){if(!$)w.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}let E=await FB(B.apikey,B.supaHost,B.supaAnon,$);if(await x8(E,Q,$),await D1(E,B.apikey),await Q8(E,B.apikey,Q,4,$,!0),!$)w.info(`Creating channel ${Q}#${A} to Capgo`);let G=await z8(E,Q),J=await D1(E,B.apikey),Y=await WPA(E,{name:A,app_id:Q,version:null,created_by:J,owner_org:G,allow_device_self_set:B.selfAssign??!1,public:B.default??!1});if(Y.error){if(!$)w.error(`Cannot create Channel \uD83D\uDE40
|
|
909
|
-
${VA(Y.error)}`);throw Error(`Cannot create channel: ${VA(Y.error)}`)}if(await OB(B.apikey,{channel:"channel",event:"Create channel",icon:"✅",org_id:G,tracking_version:2,tags:{"app-id":Q,channel:A},notify:!1}).catch(()=>{}),!$)w.success("Channel created ✅"),XB("Done ✅");return Y.data??!0}async function bkA(A,Q,B){await $L(A,Q,B,!1)}gB();R1();CB();async function Ke(A,Q,B,$=!1){let{quiet:I}=B;if(!I&&!$)UB("List current bundle");B.apikey=B.apikey||dQ(I);let E=await GB();if(Q=cB(Q,E?.config),!B.apikey){if(!$)w.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!Q){if(!$)w.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}let G=await FB(B.apikey,B.supaHost,B.supaAnon);if(await x8(G,Q,$),await D1(G,B.apikey),await Q8(G,B.apikey,Q,1,$,!0),!A){if(!$)w.error("Please provide a channel to get the bundle from.");throw Error("Channel name missing")}let{data:J,error:Y}=await XZ("channels.currentBundle",()=>G.from("channels").select("version ( name )").eq("name",A).eq("app_id",Q).limit(1));if(Y||!J?.length){if(!$)w.error(`Error retrieving channel ${A} for app ${Q}. Perhaps the channel does not exist?`);throw Error(`Channel ${A} not found for app ${Q}`)}let{version:X}=J[0];if(QB({channel:"channel",event:"Channel Current Bundle Viewed",icon:"\uD83D\uDCE6",tags:{has_bundle:Boolean(X)}}),!X){if(!$)w.error(`Error retrieving channel ${A} for app ${Q}. Perhaps the channel does not exist?`);throw Error(`Channel ${A} does not have a bundle linked`)}if(!$)if(!I)w.info(`Current bundle for channel ${A} is ${X.name}`);else w.info(X.name);return X.name}async function gkA(A,Q,B){return Ke(A,Q,B)}gB();CB();async function qe(A,Q,B,$=!1){if(!$)UB("Delete channel");B.apikey=B.apikey||dQ();let I=await GB();if(Q=cB(Q,I?.config),!B.apikey){if(!$)w.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!Q){if(!$)w.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}let E=await FB(B.apikey,B.supaHost,B.supaAnon);await x8(E,Q,$);let G=await D1(E,B.apikey);if(await Q8(E,B.apikey,Q,4,$,!0),B.deleteBundle&&!$)w.info(`Deleting bundle ${Q}#${A} from Capgo`);if(B.deleteBundle){let C=await ZPA(E,Q,A);if(C?.name&&!$)w.info(`Deleting bundle ${C.name} from Capgo`);if(C?.name)await zt(E,Q,C.name)}let{data:J,error:Y}=await KPA(E,Q,A);if(Y||!J){if(!$)w.error(`Channel ${A} not found`);if(B.successIfNotFound){if(!$)w.success(`Channel ${A} not found and successIfNotFound is true`);return!0}throw Error(`Channel ${A} not found`)}let{error:X}=await qPA(E,Q,J.id);if(X){if(!$)w.error(`Cannot delete channel devices: ${VA(X)}`);throw Error(`Cannot delete channel devices: ${VA(X)}`)}if(!$)w.info(`Deleting channel ${Q}#${A} from Capgo`);let H=await CPA(E,A,Q,G);if(H.error){if(!$)w.error(`Cannot delete Channel \uD83D\uDE40 ${VA(H.error)}`);throw Error(`Cannot delete channel: ${VA(H.error)}`)}let F=await z8(E,Q);if(await OB(B.apikey,{channel:"channel",event:"Delete channel",icon:"✅",org_id:F,tracking_version:2,tags:{"app-id":Q,channel:A},notify:!1}).catch(()=>{}),!$)w.success("Channel deleted"),XB("Done ✅");return!0}async function ykA(A,Q,B){return qe(A,Q,B,!1)}gB();CB();async function Ze(A,Q,B=!1){if(!B)UB("List channels");Q.apikey=Q.apikey||dQ();let $=await GB();if(A=cB(A,$?.config),!Q.apikey){if(!B)w.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!A){if(!B)w.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}let I=await FB(Q.apikey,Q.supaHost,Q.supaAnon);await x8(I,A,B);let E=await z8(I,A);if(await Q8(I,Q.apikey,A,1,B,!0),!B)w.info("Querying available channels in Capgo");let G=await zPA(I,A);if(!B)w.info(`Active channels in Capgo: ${G?.length??0}`),MPA(G);if(await OB(Q.apikey,{channel:"channel",event:"List channel",icon:"✅",org_id:E,tracking_version:2,tags:{"app-id":A},notify:!1}).catch(()=>{}),!B)XB("Done ✅");return G}async function fkA(A,Q){return Ze(A,Q,!1)}gB();CB();function hkA(A){let Q=A.map((B)=>{let $=Z9(B);return[B.name,B.localVersion||"-",B.remoteVersion||"-",$.compatible?"✅":"❌",$.message]});w.info(k7({headers:["Package","Local","Remote","Status","Details"],rows:Q}))}var ukA=["major","minor","metadata","patch","none"];async function Me(A,Q,B,$=!1){if(!$)UB("Set channel");B.apikey=B.apikey||dQ();let I=await GB();if(Q=cB(Q,I?.config),!B.apikey){if(!$)w.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!Q){if(!$)w.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}if(!A){if(!$)w.error("Missing argument, you need to provide a channel");throw Error("Missing channel id")}let E=await FB(B.apikey,B.supaHost,B.supaAnon);await x8(E,Q,$);let G=await D1(E,B.apikey);await Q8(E,B.apikey,Q,4,$,!0);let J=await z8(E,Q),{bundle:Y,state:X,downgrade:H,latest:F,latestRemote:C,ios:K,android:Z,selfAssign:M,disableAutoUpdate:N,dev:O,emulator:j,device:R,prod:S}=B;if(F&&Y){if(!$)w.error("Cannot set latest and bundle at the same time");throw Error("Cannot set both latest and bundle simultaneously")}if(C&&Y){if(!$)w.error("Cannot set latest remote and bundle at the same time");throw Error("Cannot set both latest remote and bundle simultaneously")}if(C&&F){if(!$)w.error("Cannot set latest remote and latest at the same time");throw Error("Cannot set both latest remote and latest simultaneously")}if(Y==null&&X==null&&F==null&&C==null&&H==null&&K==null&&Z==null&&M==null&&O==null&&j==null&&R==null&&S==null&&N==null){if(!$)w.error("Missing argument, you need to provide a option to set");throw Error("No channel option provided")}await MFA(E,J,B.apikey,Q);let T={created_by:G,app_id:Q,name:A,owner_org:J,version:void 0},{error:x}=await E.from("channels").select().eq("app_id",Q).eq("name",A).single();if(x){if(!$)w.error(`Cannot find channel ${A}`);throw Error(`Cannot find channel ${A}`)}let l=F?I?.config?.plugins?.CapacitorUpdater?.version||DJ("",B.packageJson):Y;if(l!=null){let{data:m,error:s}=await E.from("app_versions").select().eq("app_id",Q).eq("name",l).eq("user_id",G).eq("deleted",!1).single();if(s||!m){if(!$)w.error(`Cannot find version ${l}`);throw Error(`Cannot find version ${l}`)}if(!B.ignoreMetadataCheck){let{finalCompatibility:p,localDependencies:UA}=await Sn(E,Q,A,m.native_packages??[]),FA=p.filter((LA)=>!l6(LA));if(UA.length>0&&FA.length>0){if(!$)w.warn(`Bundle NOT compatible with ${A} channel`),w.warn(""),hkA(p),w.warn(""),w.warn("An app store update may be required for these changes to take effect.");throw Error(`Bundle is not compatible with ${A} channel`)}if(!$)if(UA.length===0&&p.length>0)w.info(`Ignoring check compatibility with ${A} channel because the bundle does not contain any native packages`);else w.info(`Bundle is compatible with ${A} channel`)}if(!$)w.info(`Set ${Q} channel: ${A} to @${l}`);T.version=m.id}if(C){let{data:m,error:s}=await E.from("app_versions").select().eq("app_id",Q).eq("user_id",G).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(s||!m){if(!$)w.error("Cannot find latest remote version");throw Error("Cannot find latest remote version")}if(!B.ignoreMetadataCheck){let{finalCompatibility:p}=await Sn(E,Q,A,m.native_packages??[]);if(p.filter((FA)=>!l6(FA)).length>0){if(!$)w.warn(`Bundle NOT compatible with ${A} channel`),w.warn(""),hkA(p),w.warn(""),w.warn("An app store update may be required for these changes to take effect.");throw Error(`Latest remote bundle is not compatible with ${A} channel`)}}if(!$)w.info(`Set ${Q} channel: ${A} to @${m.name}`);T.version=m.id}if(X!=null){if(X!=="normal"&&X!=="default"){if(!$)w.error(`State ${X} is not known. The possible values are: normal, default.`);throw Error(`Unknown state ${X}. Expected normal or default`)}if(!$)w.info(`Set ${Q} channel: ${A} to ${X}`);T.public=X==="default"}if(H!=null){if(!$)w.info(`Set ${Q} channel: ${A} to ${H?"allow":"disallow"} downgrade`);T.disable_auto_update_under_native=!H}if(K!=null){if(!$)w.info(`Set ${Q} channel: ${A} to ${K?"allow":"disallow"} ios update`);T.ios=!!K}if(Z!=null){if(!$)w.info(`Set ${Q} channel: ${A} to ${Z?"allow":"disallow"} android update`);T.android=!!Z}if(M!=null){if(!$)w.info(`Set ${Q} channel: ${A} to ${M?"allow":"disallow"} self assign to this channel`);T.allow_device_self_set=!!M}if(O!=null){if(!$)w.info(`Set ${Q} channel: ${A} to ${O?"allow":"disallow"} dev devices`);T.allow_dev=!!O}if(j!=null){if(!$)w.info(`Set ${Q} channel: ${A} to ${j?"allow":"disallow"} emulator devices`);T.allow_emulator=!!j}if(R!=null){if(!$)w.info(`Set ${Q} channel: ${A} to ${R?"allow":"disallow"} physical devices`);T.allow_device=!!R}if(S!=null){if(!$)w.info(`Set ${Q} channel: ${A} to ${S?"allow":"disallow"} prod builds`);T.allow_prod=!!S}if(N!=null){let m=N.toLowerCase();if(!ukA.includes(m)){if(!$)w.error(`Channel strategy ${m} is not known. The possible values are: ${ukA.join(", ")}.`);throw Error(`Unknown channel strategy ${m}`)}if(m==="metadata")m="version_number";if(T.disable_auto_update=m,!$)w.info(`Set ${Q} channel: ${A} to ${m} disable update strategy to this channel`)}let{error:e}=await gS(E,T);if(e){if(!$)w.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.');throw Error("Upload key is not allowed to set this channel")}if(B.qrPreview&&!$){let m=await dN(E,Q,A);if(!m)throw Error(`Channel ${A} not found for app ${Q}`);await Pt(E,Q,m)}if(await OB(B.apikey,{channel:"channel",event:"Set channel",icon:"✅",org_id:J,tracking_version:2,tags:{"app-id":Q},notify:!1}).catch(()=>{}),!$)XB("Done ✅");return!0}async function mkA(A,Q,B){return Me(A,Q,B,!1)}gB();import{existsSync as qkQ,mkdirSync as ZkQ,readFileSync as MkQ,writeFileSync as ze}from"node:fs";CB();function zkQ(A){return`options-${A.join("-")}`}function NkQ(A){return JSON.stringify(A)}function Ne(A){let Q="\uD83D\uDD39";if(A.includes("upload"))Q="⬆️";else if(A.includes("delete"))Q="\uD83D\uDDD1️";else if(A.includes("list"))Q="\uD83D\uDCCB";else if(A.includes("add"))Q="➕";else if(A.includes("set"))Q="⚙️";else if(A.includes("create"))Q="\uD83D\uDD28";else if(A.includes("encrypt"))Q="\uD83D\uDD12";else if(A.includes("decrypt"))Q="\uD83D\uDD13";else if(A.includes("debug"))Q="\uD83D\uDC1E";else if(A==="run")Q="\uD83D\uDCF1";else if(A.includes("doctor"))Q="\uD83D\uDC68⚕️";else if(A.includes("login"))Q="\uD83D\uDD11";else if(A.includes("init"))Q="\uD83D\uDE80";else if(A.includes("compatibility"))Q="\uD83E\uDDEA";else if(A.includes("cleanup"))Q="\uD83E\uDDF9";else if(A.includes("currentBundle"))Q="\uD83D\uDCE6";else if(A.includes("setting"))Q="⚙️";else if(A==="app")Q="\uD83D\uDCF1";else if(A==="bundle")Q="\uD83D\uDCE6";else if(A==="channel")Q="\uD83D\uDCE2";else if(A==="key")Q="\uD83D\uDD10";else if(A==="account")Q="\uD83D\uDC64";return Q}function ckA(A){return A.charAt(0).toUpperCase()+A.slice(1)}function LkQ(A){return{flags:A.flags,description:A.description||"",displayName:A.short||A.long||A.flags.split(" ")[0].replace(/,$/,"").trim(),type:A.required||A.optional?"string":"boolean"}}function lkA(A){let Q=A,B=Q._actionHandler!==null&&Q._actionHandler!==void 0,$=A.commands?.map(lkA)??[],I=$.length>0;return{name:A.name(),alias:A.alias()||"",description:A.description(),options:A.options.map(LkQ),subcommands:$,hasAction:B,isCommandGroup:I&&!B}}function dkA(A="./README.md",Q){let B=D8.commands.map(lkA),$=(G,J=[],Y=!1)=>{let X=G.name,H=ckA(X),F=J.length>0,C=[...J,X],K=C.join("-"),Z="#".repeat(Math.min(2+J.length,6)),M="",N=Ne(X);if(!(Y&&!F))M+=`${Z} <a id="${K}"></a> ${N} **${H}**
|
|
909
|
+
${VA(Y.error)}`);throw Error(`Cannot create channel: ${VA(Y.error)}`)}if(await OB(B.apikey,{channel:"channel",event:"Create channel",icon:"✅",org_id:G,tracking_version:2,tags:{"app-id":Q,channel:A},notify:!1}).catch(()=>{}),!$)w.success("Channel created ✅"),XB("Done ✅");return Y.data??!0}async function bkA(A,Q,B){await $L(A,Q,B,!1)}gB();R1();CB();async function Ke(A,Q,B,$=!1){let{quiet:I}=B;if(!I&&!$)UB("List current bundle");B.apikey=B.apikey||dQ(I);let E=await GB();if(Q=cB(Q,E?.config),!B.apikey){if(!$)w.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!Q){if(!$)w.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}let G=await FB(B.apikey,B.supaHost,B.supaAnon);if(await x8(G,Q,$),await D1(G,B.apikey),await Q8(G,B.apikey,Q,1,$,!0),!A){if(!$)w.error("Please provide a channel to get the bundle from.");throw Error("Channel name missing")}let{data:J,error:Y}=await XZ("channels.currentBundle",()=>G.from("channels").select("version ( name )").eq("name",A).eq("app_id",Q).limit(1));if(Y||!J?.length){if(!$)w.error(`Error retrieving channel ${A} for app ${Q}. Perhaps the channel does not exist?`);throw Error(`Channel ${A} not found for app ${Q}`)}let{version:X}=J[0];if(QB({channel:"channel",event:"Channel Current Bundle Viewed",icon:"\uD83D\uDCE6",tags:{has_bundle:Boolean(X)}}),!X){if(!$)w.error(`Error retrieving channel ${A} for app ${Q}. Perhaps the channel does not exist?`);throw Error(`Channel ${A} does not have a bundle linked`)}if(!$)if(!I)w.info(`Current bundle for channel ${A} is ${X.name}`);else w.info(X.name);return X.name}async function gkA(A,Q,B){return Ke(A,Q,B)}gB();CB();async function qe(A,Q,B,$=!1){if(!$)UB("Delete channel");B.apikey=B.apikey||dQ();let I=await GB();if(Q=cB(Q,I?.config),!B.apikey){if(!$)w.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!Q){if(!$)w.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}let E=await FB(B.apikey,B.supaHost,B.supaAnon);await x8(E,Q,$);let G=await D1(E,B.apikey);if(await Q8(E,B.apikey,Q,4,$,!0),B.deleteBundle&&!$)w.info(`Deleting bundle ${Q}#${A} from Capgo`);if(B.deleteBundle){let C=await ZPA(E,Q,A);if(C?.name&&!$)w.info(`Deleting bundle ${C.name} from Capgo`);if(C?.name)await zt(E,Q,C.name)}let{data:J,error:Y}=await KPA(E,Q,A);if(Y||!J){if(!$)w.error(`Channel ${A} not found`);if(B.successIfNotFound){if(!$)w.success(`Channel ${A} not found and successIfNotFound is true`);return!0}throw Error(`Channel ${A} not found`)}let{error:X}=await qPA(E,Q,J.id);if(X){if(!$)w.error(`Cannot delete channel devices: ${VA(X)}`);throw Error(`Cannot delete channel devices: ${VA(X)}`)}if(!$)w.info(`Deleting channel ${Q}#${A} from Capgo`);let H=await CPA(E,A,Q,G);if(H.error){if(!$)w.error(`Cannot delete Channel \uD83D\uDE40 ${VA(H.error)}`);throw Error(`Cannot delete channel: ${VA(H.error)}`)}let F=await z8(E,Q);if(await OB(B.apikey,{channel:"channel",event:"Delete channel",icon:"✅",org_id:F,tracking_version:2,tags:{"app-id":Q,channel:A},notify:!1}).catch(()=>{}),!$)w.success("Channel deleted"),XB("Done ✅");return!0}async function ykA(A,Q,B){return qe(A,Q,B,!1)}gB();CB();async function Ze(A,Q,B=!1){if(!B)UB("List channels");Q.apikey=Q.apikey||dQ();let $=await GB();if(A=cB(A,$?.config),!Q.apikey){if(!B)w.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!A){if(!B)w.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}let I=await FB(Q.apikey,Q.supaHost,Q.supaAnon);await x8(I,A,B);let E=await z8(I,A);if(await Q8(I,Q.apikey,A,1,B,!0),!B)w.info("Querying available channels in Capgo");let G=await zPA(I,A);if(!B)w.info(`Active channels in Capgo: ${G?.length??0}`),MPA(G);if(await OB(Q.apikey,{channel:"channel",event:"List channel",icon:"✅",org_id:E,tracking_version:2,tags:{"app-id":A},notify:!1}).catch(()=>{}),!B)XB("Done ✅");return G}async function fkA(A,Q){return Ze(A,Q,!1)}gB();CB();function hkA(A){let Q=A.map((B)=>{let $=Z9(B);return[B.name,B.localVersion||"-",B.remoteVersion||"-",$.compatible?"✅":"❌",$.message]});w.info(k7({headers:["Package","Local","Remote","Status","Details"],rows:Q}))}var ukA=["major","minor","metadata","patch","none"];async function Me(A,Q,B,$=!1){if(!$)UB("Set channel");B.apikey=B.apikey||dQ();let I=await GB();if(Q=cB(Q,I?.config),!B.apikey){if(!$)w.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!Q){if(!$)w.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}if(!A){if(!$)w.error("Missing argument, you need to provide a channel");throw Error("Missing channel id")}let E=await FB(B.apikey,B.supaHost,B.supaAnon);await x8(E,Q,$);let G=await D1(E,B.apikey);await Q8(E,B.apikey,Q,3,$,!0);let J=await z8(E,Q),{bundle:Y,state:X,downgrade:H,latest:F,latestRemote:C,ios:K,android:Z,selfAssign:M,disableAutoUpdate:N,dev:O,emulator:j,device:R,prod:S}=B;if(F&&Y){if(!$)w.error("Cannot set latest and bundle at the same time");throw Error("Cannot set both latest and bundle simultaneously")}if(C&&Y){if(!$)w.error("Cannot set latest remote and bundle at the same time");throw Error("Cannot set both latest remote and bundle simultaneously")}if(C&&F){if(!$)w.error("Cannot set latest remote and latest at the same time");throw Error("Cannot set both latest remote and latest simultaneously")}if(Y==null&&X==null&&F==null&&C==null&&H==null&&K==null&&Z==null&&M==null&&O==null&&j==null&&R==null&&S==null&&N==null){if(!$)w.error("Missing argument, you need to provide a option to set");throw Error("No channel option provided")}await MFA(E,J,B.apikey,Q);let T={created_by:G,app_id:Q,name:A,owner_org:J,version:void 0},{error:x}=await E.from("channels").select().eq("app_id",Q).eq("name",A).single();if(x){if(!$)w.error(`Cannot find channel ${A}`);throw Error(`Cannot find channel ${A}`)}let l=F?I?.config?.plugins?.CapacitorUpdater?.version||DJ("",B.packageJson):Y;if(l!=null){let{data:m,error:s}=await E.from("app_versions").select().eq("app_id",Q).eq("name",l).eq("user_id",G).eq("deleted",!1).single();if(s||!m){if(!$)w.error(`Cannot find version ${l}`);throw Error(`Cannot find version ${l}`)}if(!B.ignoreMetadataCheck){let{finalCompatibility:p,localDependencies:UA}=await Sn(E,Q,A,m.native_packages??[]),FA=p.filter((LA)=>!l6(LA));if(UA.length>0&&FA.length>0){if(!$)w.warn(`Bundle NOT compatible with ${A} channel`),w.warn(""),hkA(p),w.warn(""),w.warn("An app store update may be required for these changes to take effect.");throw Error(`Bundle is not compatible with ${A} channel`)}if(!$)if(UA.length===0&&p.length>0)w.info(`Ignoring check compatibility with ${A} channel because the bundle does not contain any native packages`);else w.info(`Bundle is compatible with ${A} channel`)}if(!$)w.info(`Set ${Q} channel: ${A} to @${l}`);T.version=m.id}if(C){let{data:m,error:s}=await E.from("app_versions").select().eq("app_id",Q).eq("user_id",G).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(s||!m){if(!$)w.error("Cannot find latest remote version");throw Error("Cannot find latest remote version")}if(!B.ignoreMetadataCheck){let{finalCompatibility:p}=await Sn(E,Q,A,m.native_packages??[]);if(p.filter((FA)=>!l6(FA)).length>0){if(!$)w.warn(`Bundle NOT compatible with ${A} channel`),w.warn(""),hkA(p),w.warn(""),w.warn("An app store update may be required for these changes to take effect.");throw Error(`Latest remote bundle is not compatible with ${A} channel`)}}if(!$)w.info(`Set ${Q} channel: ${A} to @${m.name}`);T.version=m.id}if(X!=null){if(X!=="normal"&&X!=="default"){if(!$)w.error(`State ${X} is not known. The possible values are: normal, default.`);throw Error(`Unknown state ${X}. Expected normal or default`)}if(!$)w.info(`Set ${Q} channel: ${A} to ${X}`);T.public=X==="default"}if(H!=null){if(!$)w.info(`Set ${Q} channel: ${A} to ${H?"allow":"disallow"} downgrade`);T.disable_auto_update_under_native=!H}if(K!=null){if(!$)w.info(`Set ${Q} channel: ${A} to ${K?"allow":"disallow"} ios update`);T.ios=!!K}if(Z!=null){if(!$)w.info(`Set ${Q} channel: ${A} to ${Z?"allow":"disallow"} android update`);T.android=!!Z}if(M!=null){if(!$)w.info(`Set ${Q} channel: ${A} to ${M?"allow":"disallow"} self assign to this channel`);T.allow_device_self_set=!!M}if(O!=null){if(!$)w.info(`Set ${Q} channel: ${A} to ${O?"allow":"disallow"} dev devices`);T.allow_dev=!!O}if(j!=null){if(!$)w.info(`Set ${Q} channel: ${A} to ${j?"allow":"disallow"} emulator devices`);T.allow_emulator=!!j}if(R!=null){if(!$)w.info(`Set ${Q} channel: ${A} to ${R?"allow":"disallow"} physical devices`);T.allow_device=!!R}if(S!=null){if(!$)w.info(`Set ${Q} channel: ${A} to ${S?"allow":"disallow"} prod builds`);T.allow_prod=!!S}if(N!=null){let m=N.toLowerCase();if(!ukA.includes(m)){if(!$)w.error(`Channel strategy ${m} is not known. The possible values are: ${ukA.join(", ")}.`);throw Error(`Unknown channel strategy ${m}`)}if(m==="metadata")m="version_number";if(T.disable_auto_update=m,!$)w.info(`Set ${Q} channel: ${A} to ${m} disable update strategy to this channel`)}let{error:e}=await gS(E,T);if(e){if(!$)w.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.');throw Error("Upload key is not allowed to set this channel")}if(B.qrPreview&&!$){let m=await dN(E,Q,A);if(!m)throw Error(`Channel ${A} not found for app ${Q}`);await Pt(E,Q,m)}if(await OB(B.apikey,{channel:"channel",event:"Set channel",icon:"✅",org_id:J,tracking_version:2,tags:{"app-id":Q},notify:!1}).catch(()=>{}),!$)XB("Done ✅");return!0}async function mkA(A,Q,B){return Me(A,Q,B,!1)}gB();import{existsSync as qkQ,mkdirSync as ZkQ,readFileSync as MkQ,writeFileSync as ze}from"node:fs";CB();function zkQ(A){return`options-${A.join("-")}`}function NkQ(A){return JSON.stringify(A)}function Ne(A){let Q="\uD83D\uDD39";if(A.includes("upload"))Q="⬆️";else if(A.includes("delete"))Q="\uD83D\uDDD1️";else if(A.includes("list"))Q="\uD83D\uDCCB";else if(A.includes("add"))Q="➕";else if(A.includes("set"))Q="⚙️";else if(A.includes("create"))Q="\uD83D\uDD28";else if(A.includes("encrypt"))Q="\uD83D\uDD12";else if(A.includes("decrypt"))Q="\uD83D\uDD13";else if(A.includes("debug"))Q="\uD83D\uDC1E";else if(A==="run")Q="\uD83D\uDCF1";else if(A.includes("doctor"))Q="\uD83D\uDC68⚕️";else if(A.includes("login"))Q="\uD83D\uDD11";else if(A.includes("init"))Q="\uD83D\uDE80";else if(A.includes("compatibility"))Q="\uD83E\uDDEA";else if(A.includes("cleanup"))Q="\uD83E\uDDF9";else if(A.includes("currentBundle"))Q="\uD83D\uDCE6";else if(A.includes("setting"))Q="⚙️";else if(A==="app")Q="\uD83D\uDCF1";else if(A==="bundle")Q="\uD83D\uDCE6";else if(A==="channel")Q="\uD83D\uDCE2";else if(A==="key")Q="\uD83D\uDD10";else if(A==="account")Q="\uD83D\uDC64";return Q}function ckA(A){return A.charAt(0).toUpperCase()+A.slice(1)}function LkQ(A){return{flags:A.flags,description:A.description||"",displayName:A.short||A.long||A.flags.split(" ")[0].replace(/,$/,"").trim(),type:A.required||A.optional?"string":"boolean"}}function lkA(A){let Q=A,B=Q._actionHandler!==null&&Q._actionHandler!==void 0,$=A.commands?.map(lkA)??[],I=$.length>0;return{name:A.name(),alias:A.alias()||"",description:A.description(),options:A.options.map(LkQ),subcommands:$,hasAction:B,isCommandGroup:I&&!B}}function dkA(A="./README.md",Q){let B=D8.commands.map(lkA),$=(G,J=[],Y=!1)=>{let X=G.name,H=ckA(X),F=J.length>0,C=[...J,X],K=C.join("-"),Z="#".repeat(Math.min(2+J.length,6)),M="",N=Ne(X);if(!(Y&&!F))M+=`${Z} <a id="${K}"></a> ${N} **${H}**
|
|
910
910
|
|
|
911
911
|
`;if(G.alias)M+=`**Alias:** \`${G.alias}\`
|
|
912
912
|
|
package/dist/package.json
CHANGED
package/dist/src/sdk.js
CHANGED
|
@@ -124,7 +124,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
124
124
|
`)}),$.__defineSetter__("stack",function(X){return[X].concat($.stack).join(`
|
|
125
125
|
|
|
126
126
|
`)}),$}});var sx=E((ke0,ax)=>{var I4=l("constants"),TW0=process.cwd,yF=null,CW0=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!yF)yF=TW0.call(process);return yF};try{process.cwd()}catch(D){}if(typeof process.chdir==="function"){if(bF=process.chdir,process.chdir=function(D){yF=null,bF.call(process,D)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,bF)}var bF;ax.exports=PW0;function PW0(D){if(I4.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./))$(D);if(!D.lutimes)X(D);if(D.chown=F(D.chown),D.fchown=F(D.fchown),D.lchown=F(D.lchown),D.chmod=J(D.chmod),D.fchmod=J(D.fchmod),D.lchmod=J(D.lchmod),D.chownSync=Q(D.chownSync),D.fchownSync=Q(D.fchownSync),D.lchownSync=Q(D.lchownSync),D.chmodSync=Y(D.chmodSync),D.fchmodSync=Y(D.fchmodSync),D.lchmodSync=Y(D.lchmodSync),D.stat=U(D.stat),D.fstat=U(D.fstat),D.lstat=U(D.lstat),D.statSync=Z(D.statSync),D.fstatSync=Z(D.fstatSync),D.lstatSync=Z(D.lstatSync),D.chmod&&!D.lchmod)D.lchmod=function(O,q,w){if(w)process.nextTick(w)},D.lchmodSync=function(){};if(D.chown&&!D.lchown)D.lchown=function(O,q,w,W){if(W)process.nextTick(W)},D.lchownSync=function(){};if(CW0==="win32")D.rename=typeof D.rename!=="function"?D.rename:function(O){function q(w,W,K){var H=Date.now(),B=0;O(w,W,function M(j){if(j&&(j.code==="EACCES"||j.code==="EPERM"||j.code==="EBUSY")&&Date.now()-H<60000){if(setTimeout(function(){D.stat(W,function(z,V){if(z&&z.code==="ENOENT")O(w,W,M);else K(j)})},B),B<100)B+=10;return}if(K)K(j)})}if(Object.setPrototypeOf)Object.setPrototypeOf(q,O);return q}(D.rename);D.read=typeof D.read!=="function"?D.read:function(O){function q(w,W,K,H,B,M){var j;if(M&&typeof M==="function"){var z=0;j=function(V,N,A){if(V&&V.code==="EAGAIN"&&z<10)return z++,O.call(D,w,W,K,H,B,j);M.apply(this,arguments)}}return O.call(D,w,W,K,H,B,j)}if(Object.setPrototypeOf)Object.setPrototypeOf(q,O);return q}(D.read),D.readSync=typeof D.readSync!=="function"?D.readSync:function(O){return function(q,w,W,K,H){var B=0;while(!0)try{return O.call(D,q,w,W,K,H)}catch(M){if(M.code==="EAGAIN"&&B<10){B++;continue}throw M}}}(D.readSync);function $(O){O.lchmod=function(q,w,W){O.open(q,I4.O_WRONLY|I4.O_SYMLINK,w,function(K,H){if(K){if(W)W(K);return}O.fchmod(H,w,function(B){O.close(H,function(M){if(W)W(B||M)})})})},O.lchmodSync=function(q,w){var W=O.openSync(q,I4.O_WRONLY|I4.O_SYMLINK,w),K=!0,H;try{H=O.fchmodSync(W,w),K=!1}finally{if(K)try{O.closeSync(W)}catch(B){}else O.closeSync(W)}return H}}function X(O){if(I4.hasOwnProperty("O_SYMLINK")&&O.futimes)O.lutimes=function(q,w,W,K){O.open(q,I4.O_SYMLINK,function(H,B){if(H){if(K)K(H);return}O.futimes(B,w,W,function(M){O.close(B,function(j){if(K)K(M||j)})})})},O.lutimesSync=function(q,w,W){var K=O.openSync(q,I4.O_SYMLINK),H,B=!0;try{H=O.futimesSync(K,w,W),B=!1}finally{if(B)try{O.closeSync(K)}catch(M){}else O.closeSync(K)}return H};else if(O.futimes)O.lutimes=function(q,w,W,K){if(K)process.nextTick(K)},O.lutimesSync=function(){}}function J(O){if(!O)return O;return function(q,w,W){return O.call(D,q,w,function(K){if(G(K))K=null;if(W)W.apply(this,arguments)})}}function Y(O){if(!O)return O;return function(q,w){try{return O.call(D,q,w)}catch(W){if(!G(W))throw W}}}function F(O){if(!O)return O;return function(q,w,W,K){return O.call(D,q,w,W,function(H){if(G(H))H=null;if(K)K.apply(this,arguments)})}}function Q(O){if(!O)return O;return function(q,w,W){try{return O.call(D,q,w,W)}catch(K){if(!G(K))throw K}}}function U(O){if(!O)return O;return function(q,w,W){if(typeof w==="function")W=w,w=null;function K(H,B){if(B){if(B.uid<0)B.uid+=4294967296;if(B.gid<0)B.gid+=4294967296}if(W)W.apply(this,arguments)}return w?O.call(D,q,w,K):O.call(D,q,K)}}function Z(O){if(!O)return O;return function(q,w){var W=w?O.call(D,q,w):O.call(D,q);if(W){if(W.uid<0)W.uid+=4294967296;if(W.gid<0)W.gid+=4294967296}return W}}function G(O){if(!O)return!0;if(O.code==="ENOSYS")return!0;var q=!process.getuid||process.getuid()!==0;if(q){if(O.code==="EINVAL"||O.code==="EPERM")return!0}return!1}}});var $_=E((ye0,D_)=>{var ex=l("stream").Stream;D_.exports=SW0;function SW0(D){return{ReadStream:$,WriteStream:X};function $(J,Y){if(!(this instanceof $))return new $(J,Y);ex.call(this);var F=this;this.path=J,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,Y=Y||{};var Q=Object.keys(Y);for(var U=0,Z=Q.length;U<Z;U++){var G=Q[U];this[G]=Y[G]}if(this.encoding)this.setEncoding(this.encoding);if(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 Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){F._read()});return}D.open(this.path,this.flags,this.mode,function(O,q){if(O){F.emit("error",O),F.readable=!1;return}F.fd=q,F.emit("open",q),F._read()})}function X(J,Y){if(!(this instanceof X))return new X(J,Y);ex.call(this),this.path=J,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,Y=Y||{};var F=Object.keys(Y);for(var Q=0,U=F.length;Q<U;Q++){var Z=F[Q];this[Z]=Y[Z]}if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.start<0)throw Error("start must be >= zero");this.pos=this.start}if(this.busy=!1,this._queue=[],this.fd===null)this._open=D.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush()}}});var J_=E((be0,X_)=>{X_.exports=uW0;var vW0=Object.getPrototypeOf||function(D){return D.__proto__};function uW0(D){if(D===null||typeof D!=="object")return D;if(D instanceof Object)var $={__proto__:vW0(D)};else var $=Object.create(null);return Object.getOwnPropertyNames(D).forEach(function(X){Object.defineProperty($,X,Object.getOwnPropertyDescriptor(D,X))}),$}});var mD=E((ge0,NW)=>{var xD=l("fs"),xW0=sx(),_W0=$_(),fW0=J_(),gF=l("util"),Z1,mF;if(typeof Symbol==="function"&&typeof Symbol.for==="function")Z1=Symbol.for("graceful-fs.queue"),mF=Symbol.for("graceful-fs.previous");else Z1="___graceful-fs.queue",mF="___graceful-fs.previous";function kW0(){}function F_(D,$){Object.defineProperty(D,Z1,{get:function(){return $}})}var n8=kW0;if(gF.debuglog)n8=gF.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))n8=function(){var D=gF.format.apply(gF,arguments);D="GFS4: "+D.split(/\n/).join(`
|
|
127
|
-
GFS4: `),console.error(D)};if(!xD[Z1]){if(HW=global[Z1]||[],F_(xD,HW),xD.close=function(D){function $(X,J){return D.call(xD,X,function(Y){if(!Y)Y_();if(typeof J==="function")J.apply(this,arguments)})}return Object.defineProperty($,mF,{value:D}),$}(xD.close),xD.closeSync=function(D){function $(X){D.apply(xD,arguments),Y_()}return Object.defineProperty($,mF,{value:D}),$}(xD.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){n8(xD[Z1]),l("assert").equal(xD[Z1].length,0)})}var HW;if(!global[Z1])F_(global,xD[Z1]);NW.exports=zW(fW0(xD));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!xD.__patched)NW.exports=zW(xD),xD.__patched=!0;function zW(D){xW0(D),D.gracefulify=zW,D.createReadStream=N,D.createWriteStream=A;var $=D.readFile;D.readFile=X;function X(I,x,P){if(typeof x==="function")P=x,x=null;return m(I,x,P);function m(b,p,k,R){return $(b,p,function(S){if(S&&(S.code==="EMFILE"||S.code==="ENFILE"))x5([m,[b,p,k],S,R||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}var J=D.writeFile;D.writeFile=Y;function Y(I,x,P,m){if(typeof P==="function")m=P,P=null;return b(I,x,P,m);function b(p,k,R,S,v){return J(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var F=D.appendFile;if(F)D.appendFile=Q;function Q(I,x,P,m){if(typeof P==="function")m=P,P=null;return b(I,x,P,m);function b(p,k,R,S,v){return F(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var U=D.copyFile;if(U)D.copyFile=Z;function Z(I,x,P,m){if(typeof P==="function")m=P,P=0;return b(I,x,P,m);function b(p,k,R,S,v){return U(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var G=D.readdir;D.readdir=q;var O=/^v[0-5]\./;function q(I,x,P){if(typeof x==="function")P=x,x=null;var m=O.test(process.version)?function(k,R,S,v){return G(k,b(k,R,S,v))}:function(k,R,S,v){return G(k,R,b(k,R,S,v))};return m(I,x,P);function b(p,k,R,S){return function(v,f){if(v&&(v.code==="EMFILE"||v.code==="ENFILE"))x5([m,[p,k,R],v,S||Date.now(),Date.now()]);else{if(f&&f.sort)f.sort();if(typeof R==="function")R.call(this,v,f)}}}}if(process.version.substr(0,4)==="v0.8"){var w=_W0(D);M=w.ReadStream,z=w.WriteStream}var W=D.ReadStream;if(W)M.prototype=Object.create(W.prototype),M.prototype.open=j;var K=D.WriteStream;if(K)z.prototype=Object.create(K.prototype),z.prototype.open=V;Object.defineProperty(D,"ReadStream",{get:function(){return M},set:function(I){M=I},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return z},set:function(I){z=I},enumerable:!0,configurable:!0});var H=M;Object.defineProperty(D,"FileReadStream",{get:function(){return H},set:function(I){H=I},enumerable:!0,configurable:!0});var B=z;Object.defineProperty(D,"FileWriteStream",{get:function(){return B},set:function(I){B=I},enumerable:!0,configurable:!0});function M(I,x){if(this instanceof M)return W.apply(this,arguments),this;else return M.apply(Object.create(M.prototype),arguments)}function j(){var I=this;_(I.path,I.flags,I.mode,function(x,P){if(x){if(I.autoClose)I.destroy();I.emit("error",x)}else I.fd=P,I.emit("open",P),I.read()})}function z(I,x){if(this instanceof z)return K.apply(this,arguments),this;else return z.apply(Object.create(z.prototype),arguments)}function V(){var I=this;_(I.path,I.flags,I.mode,function(x,P){if(x)I.destroy(),I.emit("error",x);else I.fd=P,I.emit("open",P)})}function N(I,x){return new D.ReadStream(I,x)}function A(I,x){return new D.WriteStream(I,x)}var u=D.open;D.open=_;function _(I,x,P,m){if(typeof P==="function")m=P,P=null;return b(I,x,P,m);function b(p,k,R,S,v){return u(p,k,R,function(f,h){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}return D}function x5(D){n8("ENQUEUE",D[0].name,D[1]),xD[Z1].push(D),VW()}var hF;function Y_(){var D=Date.now();for(var $=0;$<xD[Z1].length;++$)if(xD[Z1][$].length>2)xD[Z1][$][3]=D,xD[Z1][$][4]=D;VW()}function VW(){if(clearTimeout(hF),hF=void 0,xD[Z1].length===0)return;var D=xD[Z1].shift(),$=D[0],X=D[1],J=D[2],Y=D[3],F=D[4];if(Y===void 0)n8("RETRY",$.name,X),$.apply(null,X);else if(Date.now()-Y>=60000){n8("TIMEOUT",$.name,X);var Q=X.pop();if(typeof Q==="function")Q.call(null,J)}else{var U=Date.now()-F,Z=Math.max(F-Y,1),G=Math.min(Z*1.2,100);if(U>=G)n8("RETRY",$.name,X),$.apply(null,X.concat([Y]));else xD[Z1].push(D)}if(hF===void 0)hF=setTimeout(VW,0)}});var U_=E((he0,Q_)=>{function E$(D,$){if(typeof $==="boolean")$={forever:$};if(this._originalTimeouts=JSON.parse(JSON.stringify(D)),this._timeouts=D,this._options=$||{},this._maxRetryTime=$&&$.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)}Q_.exports=E$;E$.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};E$.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};E$.prototype.retry=function(D){if(this._timeout)clearTimeout(this._timeout);if(!D)return!1;var $=new Date().getTime();if(D&&$-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(D);var X=this._timeouts.shift();if(X===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),X=this._timeouts.shift();else return!1;var J=this,Y=setTimeout(function(){if(J._attempts++,J._operationTimeoutCb){if(J._timeout=setTimeout(function(){J._operationTimeoutCb(J._attempts)},J._operationTimeout),J._options.unref)J._timeout.unref()}J._fn(J._attempts)},X);if(this._options.unref)Y.unref();return!0};E$.prototype.attempt=function(D,$){if(this._fn=D,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var X=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){X._operationTimeoutCb()},X._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};E$.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};E$.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};E$.prototype.start=E$.prototype.try;E$.prototype.errors=function(){return this._errors};E$.prototype.attempts=function(){return this._attempts};E$.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},$=null,X=0;for(var J=0;J<this._errors.length;J++){var Y=this._errors[J],F=Y.message,Q=(D[F]||0)+1;if(D[F]=Q,Q>=X)$=Y,X=Q}return $}});var G_=E((bW0)=>{var yW0=U_();bW0.operation=function(D){var $=bW0.timeouts(D);return new yW0($,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};bW0.timeouts=function(D){if(D instanceof Array)return[].concat(D);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var X in D)$[X]=D[X];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var J=[];for(var Y=0;Y<$.retries;Y++)J.push(this.createTimeout(Y,$));if(D&&D.forever&&!J.length)J.push(this.createTimeout(Y,$));return J.sort(function(F,Q){return F-Q}),J};bW0.createTimeout=function(D,$){var X=$.randomize?Math.random()+1:1,J=Math.round(X*$.minTimeout*Math.pow($.factor,D));return J=Math.min(J,$.maxTimeout),J};bW0.wrap=function(D,$,X){if($ instanceof Array)X=$,$=null;if(!X){X=[];for(var J in D)if(typeof D[J]==="function")X.push(J)}for(var Y=0;Y<X.length;Y++){var F=X[Y],Q=D[F];D[F]=function(Z){var G=bW0.operation($),O=Array.prototype.slice.call(arguments,1),q=O.pop();O.push(function(w){if(G.retry(w))return;if(w)arguments[0]=G.mainError();q.apply(this,arguments)}),G.attempt(function(){Z.apply(D,O)})}.bind(D,Q),D[F].options=$}}});var O_=E((ce0,cF)=>{cF.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")cF.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")cF.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var lF=E((de0,f5)=>{var TD=global.process,l8=function(D){return D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function"};if(!l8(TD))f5.exports=function(){return function(){}};else{if(LW=l("assert"),i8=O_(),BW=/^win/i.test(TD.platform),_5=l("events"),typeof _5!=="function")_5=_5.EventEmitter;if(TD.__signal_exit_emitter__)sD=TD.__signal_exit_emitter__;else sD=TD.__signal_exit_emitter__=new _5,sD.count=0,sD.emitted={};if(!sD.infinite)sD.setMaxListeners(1/0),sD.infinite=!0;f5.exports=function(D,$){if(!l8(global.process))return function(){};if(LW.equal(typeof D,"function","a callback must be provided for exit handler"),p8===!1)dF();var X="exit";if($&&$.alwaysLast)X="afterexit";var J=function(){if(sD.removeListener(X,D),sD.listeners("exit").length===0&&sD.listeners("afterexit").length===0)v2()};return sD.on(X,D),J},v2=function(){if(!p8||!l8(global.process))return;p8=!1,i8.forEach(function($){try{TD.removeListener($,u2[$])}catch(X){}}),TD.emit=x2,TD.reallyExit=nF,sD.count-=1},f5.exports.unload=v2,E4=function($,X,J){if(sD.emitted[$])return;sD.emitted[$]=!0,sD.emit($,X,J)},u2={},i8.forEach(function(D){u2[D]=function(){if(!l8(global.process))return;var X=TD.listeners(D);if(X.length===sD.count){if(v2(),E4("exit",null,D),E4("afterexit",null,D),BW&&D==="SIGHUP")D="SIGINT";TD.kill(TD.pid,D)}}}),f5.exports.signals=function(){return i8},p8=!1,dF=function(){if(p8||!l8(global.process))return;p8=!0,sD.count+=1,i8=i8.filter(function($){try{return TD.on($,u2[$]),!0}catch(X){return!1}}),TD.emit=jW,TD.reallyExit=MW},f5.exports.load=dF,nF=TD.reallyExit,MW=function($){if(!l8(global.process))return;TD.exitCode=$||0,E4("exit",TD.exitCode,null),E4("afterexit",TD.exitCode,null),nF.call(TD,TD.exitCode)},x2=TD.emit,jW=function($,X){if($==="exit"&&l8(global.process)){if(X!==void 0)TD.exitCode=X;var J=x2.apply(this,arguments);return E4("exit",TD.exitCode,null),E4("afterexit",TD.exitCode,null),J}else return x2.apply(this,arguments)}}var LW,i8,BW,_5,sD,v2,E4,u2,p8,dF,nF,MW,x2,jW});var w_=E((nW0,IW)=>{var q_=Symbol();function cW0(D,$,X){let J=$[q_];if(J)return $.stat(D,(F,Q)=>{if(F)return X(F);X(null,Q.mtime,J)});let Y=new Date(Math.ceil(Date.now()/1000)*1000+5);$.utimes(D,Y,Y,(F)=>{if(F)return X(F);$.stat(D,(Q,U)=>{if(Q)return X(Q);let Z=U.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty($,q_,{value:Z}),X(null,U.mtime,Z)})})}function dW0(D){let $=Date.now();if(D==="s")$=Math.ceil($/1000)*1000;return new Date($)}nW0.probe=cW0;nW0.getMtime=dW0});var V_=E((eW0,f2)=>{var pW0=l("path"),RW=mD(),rW0=G_(),tW0=lF(),W_=w_(),c6={};function _2(D,$){return $.lockfilePath||`${D}.lock`}function TW(D,$,X){if(!$.realpath)return X(null,pW0.resolve(D));$.fs.realpath(D,X)}function AW(D,$,X){let J=_2(D,$);$.fs.mkdir(J,(Y)=>{if(!Y)return W_.probe(J,$.fs,(F,Q,U)=>{if(F)return $.fs.rmdir(J,()=>{}),X(F);X(null,Q,U)});if(Y.code!=="EEXIST")return X(Y);if($.stale<=0)return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));$.fs.stat(J,(F,Q)=>{if(F){if(F.code==="ENOENT")return AW(D,{...$,stale:0},X);return X(F)}if(!K_(Q,$))return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));H_(D,$,(U)=>{if(U)return X(U);AW(D,{...$,stale:0},X)})})})}function K_(D,$){return D.mtime.getTime()<Date.now()-$.stale}function H_(D,$,X){$.fs.rmdir(_2(D,$),(J)=>{if(J&&J.code!=="ENOENT")return X(J);X()})}function iF(D,$){let X=c6[D];if(X.updateTimeout)return;if(X.updateDelay=X.updateDelay||$.update,X.updateTimeout=setTimeout(()=>{X.updateTimeout=null,$.fs.stat(X.lockfilePath,(J,Y)=>{let F=X.lastUpdate+$.stale<Date.now();if(J){if(J.code==="ENOENT"||F)return EW(D,X,Object.assign(J,{code:"ECOMPROMISED"}));return X.updateDelay=1000,iF(D,$)}if(X.mtime.getTime()!==Y.mtime.getTime())return EW(D,X,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let U=W_.getMtime(X.mtimePrecision);$.fs.utimes(X.lockfilePath,U,U,(Z)=>{let G=X.lastUpdate+$.stale<Date.now();if(X.released)return;if(Z){if(Z.code==="ENOENT"||G)return EW(D,X,Object.assign(Z,{code:"ECOMPROMISED"}));return X.updateDelay=1000,iF(D,$)}X.mtime=U,X.lastUpdate=Date.now(),X.updateDelay=null,iF(D,$)})})},X.updateDelay),X.updateTimeout.unref)X.updateTimeout.unref()}function EW(D,$,X){if($.released=!0,$.updateTimeout)clearTimeout($.updateTimeout);if(c6[D]===$)delete c6[D];$.options.onCompromised(X)}function oW0(D,$,X){$={stale:1e4,update:null,realpath:!0,retries:0,fs:RW,onCompromised:(J)=>{throw J},...$},$.retries=$.retries||0,$.retries=typeof $.retries==="number"?{retries:$.retries}:$.retries,$.stale=Math.max($.stale||0,2000),$.update=$.update==null?$.stale/2:$.update||0,$.update=Math.max(Math.min($.update,$.stale/2),1000),TW(D,$,(J,Y)=>{if(J)return X(J);let F=rW0.operation($.retries);F.attempt(()=>{AW(Y,$,(Q,U,Z)=>{if(F.retry(Q))return;if(Q)return X(F.mainError());let G=c6[Y]={lockfilePath:_2(Y,$),mtime:U,mtimePrecision:Z,options:$,lastUpdate:Date.now()};iF(Y,$),X(null,(O)=>{if(G.released)return O&&O(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));z_(Y,{...$,realpath:!1},O)})})})})}function z_(D,$,X){$={fs:RW,realpath:!0,...$},TW(D,$,(J,Y)=>{if(J)return X(J);let F=c6[Y];if(!F)return X(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));F.updateTimeout&&clearTimeout(F.updateTimeout),F.released=!0,delete c6[Y],H_(Y,$,X)})}function aW0(D,$,X){$={stale:1e4,realpath:!0,fs:RW,...$},$.stale=Math.max($.stale||0,2000),TW(D,$,(J,Y)=>{if(J)return X(J);$.fs.stat(_2(Y,$),(F,Q)=>{if(F)return F.code==="ENOENT"?X(null,!1):X(F);return X(null,!K_(Q,$))})})}function sW0(){return c6}tW0(()=>{for(let D in c6){let $=c6[D].options;try{$.fs.rmdirSync(_2(D,$))}catch(X){}}});eW0.lock=oW0;eW0.unlock=z_;eW0.check=aW0;eW0.getLocks=sW0});var L_=E((ne0,N_)=>{var YK0=mD();function FK0(D){let $=["mkdir","realpath","stat","rmdir","utimes"],X={...D};return $.forEach((J)=>{X[J]=(...Y)=>{let F=Y.pop(),Q;try{Q=D[`${J}Sync`](...Y)}catch(U){return F(U)}F(null,Q)}}),X}function QK0(D){return(...$)=>new Promise((X,J)=>{$.push((Y,F)=>{if(Y)J(Y);else X(F)}),D(...$)})}function UK0(D){return(...$)=>{let X,J;if($.push((Y,F)=>{X=Y,J=F}),D(...$),X)throw X;return J}}function ZK0(D){if(D={...D},D.fs=FK0(D.fs||YK0),typeof D.retries==="number"&&D.retries>0||D.retries&&typeof D.retries.retries==="number"&&D.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return D}N_.exports={toPromise:QK0,toSync:UK0,toSyncOptions:ZK0}});var M_=E((le0,A4)=>{var k5=V_(),{toPromise:pF,toSync:rF,toSyncOptions:CW}=L_();async function B_(D,$){let X=await pF(k5.lock)(D,$);return pF(X)}function GK0(D,$){let X=rF(k5.lock)(D,CW($));return rF(X)}function OK0(D,$){return pF(k5.unlock)(D,$)}function qK0(D,$){return rF(k5.unlock)(D,CW($))}function wK0(D,$){return pF(k5.check)(D,$)}function WK0(D,$){return rF(k5.check)(D,CW($))}A4.exports=B_;A4.exports.lock=B_;A4.exports.unlock=OK0;A4.exports.lockSync=GK0;A4.exports.unlockSync=qK0;A4.exports.check=wK0;A4.exports.checkSync=WK0});var C_=E((R_)=>{Object.defineProperty(R_,"__esModule",{value:!0});R_.canStoreURLs=R_.FileUrlStorage=void 0;var j_=l("fs"),KK0=zK0(ox()),I_=HK0(M_());function A_(D){if(typeof WeakMap!="function")return null;var $=new WeakMap,X=new WeakMap;return(A_=function(J){return J?X:$})(D)}function HK0(D,$){if(!$&&D&&D.__esModule)return D;if(D===null||typeof D!="object"&&typeof D!="function")return{default:D};var X=A_($);if(X&&X.has(D))return X.get(D);var J={__proto__:null},Y=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var F in D)if(F!=="default"&&{}.hasOwnProperty.call(D,F)){var Q=Y?Object.getOwnPropertyDescriptor(D,F):null;Q&&(Q.get||Q.set)?Object.defineProperty(J,F,Q):J[F]=D[F]}return J.default=D,X&&X.set(D,J),J}function zK0(D){return D&&D.__esModule?D:{default:D}}function k2(D){return k2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},k2(D)}function VK0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function E_(D,$){for(var X=0;X<$.length;X++){var J=$[X];if(J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J)J.writable=!0;Object.defineProperty(D,LK0(J.key),J)}}function NK0(D,$,X){if($)E_(D.prototype,$);if(X)E_(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function LK0(D){var $=BK0(D,"string");return k2($)=="symbol"?$:$+""}function BK0(D,$){if(k2(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var J=X.call(D,$||"default");if(k2(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var ie0=R_.canStoreURLs=!0,pe0=R_.FileUrlStorage=function(){function D($){VK0(this,D),this.path=$}return NK0(D,[{key:"findAllUploads",value:function(){var X=this;return new Promise(function(J,Y){X._getItems("tus::",function(F,Q){if(F)Y(F);else J(Q)})})}},{key:"findUploadsByFingerprint",value:function(X){var J=this;return new Promise(function(Y,F){J._getItems("tus::".concat(X),function(Q,U){if(Q)F(Q);else Y(U)})})}},{key:"removeUpload",value:function(X){var J=this;return new Promise(function(Y,F){J._removeItem(X,function(Q){if(Q)F(Q);else Y()})})}},{key:"addUpload",value:function(X,J){var Y=this,F=Math.round(Math.random()*1000000000000),Q="tus::".concat(X,"::").concat(F);return new Promise(function(U,Z){Y._setItem(Q,J,function(G){if(G)Z(G);else U(Q)})})}},{key:"_setItem",value:function(X,J,Y){var F=this;I_.lock(this.path,this._lockfileOptions()).then(function(Q){Y=F._releaseAndCb(Q,Y),F._getData(function(U,Z){if(U){Y(U);return}Z[X]=J,F._writeData(Z,function(G){return Y(G)})})}).catch(Y)}},{key:"_getItems",value:function(X,J){this._getData(function(Y,F){if(Y){J(Y);return}var Q=Object.keys(F).filter(function(U){return U.startsWith(X)}).map(function(U){var Z=F[U];return Z.urlStorageKey=U,Z});J(null,Q)})}},{key:"_removeItem",value:function(X,J){var Y=this;I_.lock(this.path,this._lockfileOptions()).then(function(F){J=Y._releaseAndCb(F,J),Y._getData(function(Q,U){if(Q){J(Q);return}delete U[X],Y._writeData(U,function(Z){return J(Z)})})}).catch(J)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(X,J){return function(Y){if(Y){X().then(function(){return J(Y)}).catch(function(F){return J((0,KK0.default)([Y,F]))});return}X().then(J).catch(J)}}},{key:"_writeData",value:function(X,J){var Y={encoding:"utf8",mode:432,flag:"w"};(0,j_.writeFile)(this.path,JSON.stringify(X),Y,function(F){return J(F)})}},{key:"_getData",value:function(X){(0,j_.readFile)(this.path,"utf8",function(J,Y){if(J){if(J.code==="ENOENT")X(null,{});else X(J);return}try{Y=!Y.trim().length?{}:JSON.parse(Y)}catch(F){X(F);return}X(null,Y)})}}])}()});var oF=E((R4)=>{Object.defineProperty(R4,"__esModule",{value:!0});Object.defineProperty(R4,"DefaultHttpStack",{enumerable:!0,get:function(){return u_.default}});Object.defineProperty(R4,"DetailedError",{enumerable:!0,get:function(){return jK0.default}});Object.defineProperty(R4,"FileUrlStorage",{enumerable:!0,get:function(){return x_.FileUrlStorage}});Object.defineProperty(R4,"StreamSource",{enumerable:!0,get:function(){return TK0.default}});R4.Upload=void 0;Object.defineProperty(R4,"canStoreURLs",{enumerable:!0,get:function(){return x_.canStoreURLs}});R4.defaultOptions=void 0;Object.defineProperty(R4,"enableDebugLog",{enumerable:!0,get:function(){return IK0.enableDebugLog}});R4.isSupported=void 0;var jK0=r8(Cw()),IK0=Pw(),EK0=r8(Mv()),PW=r8(Du()),AK0=r8(Bu()),RK0=r8(Au()),u_=r8(mu()),TK0=r8(hw()),x_=C_();function r8(D){return D&&D.__esModule?D:{default:D}}function b5(D){return b5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},b5(D)}function CK0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function P_(D,$){for(var X=0;X<$.length;X++){var J=$[X];if(J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J)J.writable=!0;Object.defineProperty(D,f_(J.key),J)}}function PK0(D,$,X){if($)P_(D.prototype,$);if(X)P_(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function SK0(D,$,X){return $=tF($),vK0(D,__()?Reflect.construct($,X||[],tF(D).constructor):$.apply(D,X))}function vK0(D,$){if($&&(b5($)==="object"||typeof $==="function"))return $;else if($!==void 0)throw TypeError("Derived constructors may only return object or undefined");return uK0(D)}function uK0(D){if(D===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function __(){try{var D=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch($){}return(__=function(){return!!D})()}function tF(D){return tF=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(X){return X.__proto__||Object.getPrototypeOf(X)},tF(D)}function xK0(D,$){if(typeof $!=="function"&&$!==null)throw TypeError("Super expression must either be null or a function");if(D.prototype=Object.create($&&$.prototype,{constructor:{value:D,writable:!0,configurable:!0}}),Object.defineProperty(D,"prototype",{writable:!1}),$)SW(D,$)}function SW(D,$){return SW=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(J,Y){return J.__proto__=Y,J},SW(D,$)}function S_(D,$){var X=Object.keys(D);if(Object.getOwnPropertySymbols){var J=Object.getOwnPropertySymbols(D);$&&(J=J.filter(function(Y){return Object.getOwnPropertyDescriptor(D,Y).enumerable})),X.push.apply(X,J)}return X}function y5(D){for(var $=1;$<arguments.length;$++){var X=arguments[$]!=null?arguments[$]:{};$%2?S_(Object(X),!0).forEach(function(J){_K0(D,J,X[J])}):Object.getOwnPropertyDescriptors?Object.defineProperties(D,Object.getOwnPropertyDescriptors(X)):S_(Object(X)).forEach(function(J){Object.defineProperty(D,J,Object.getOwnPropertyDescriptor(X,J))})}return D}function _K0(D,$,X){if($=f_($),$ in D)Object.defineProperty(D,$,{value:X,enumerable:!0,configurable:!0,writable:!0});else D[$]=X;return D}function f_(D){var $=fK0(D,"string");return b5($)=="symbol"?$:$+""}function fK0(D,$){if(b5(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var J=X.call(D,$||"default");if(b5(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var v_=R4.defaultOptions=y5(y5({},PW.default.defaultOptions),{},{httpStack:new u_.default,fileReader:new AK0.default,urlStorage:new EK0.default,fingerprint:RK0.default}),te0=R4.Upload=function(D){function $(){var X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return CK0(this,$),J=y5(y5({},v_),J),SK0(this,$,[X,J])}return xK0($,D),PK0($,null,[{key:"terminate",value:function(J){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Y=y5(y5({},v_),Y),PW.default.terminate(J,Y)}}])}(PW.default),oe0=R4.isSupported=!0});var B1;var T4=r(()=>{B1={name:"@capgo/cli",type:"module",version:"8.5.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/capgo.git",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","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:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:credentials":"bun test/test-credentials.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:mcp":"node test/test-mcp.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:payload-split":"bun test/test-payload-split.mjs","test:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:apple-api-cert-create":"bun test/test-apple-api-cert-create.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:manifest-path-encoding":"bun test/test-manifest-path-encoding.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs","test:android-tail-engine":"bun test/test-android-tail-engine.mjs","test:android-tail-render":"bun test/test-android-tail-render.mjs","test:android-tail-routing":"bun test/test-android-tail-routing.mjs","test:dev-gate-stripped":"bun test/test-dev-gate-stripped.mjs","test:frame-fit-ios-shared":"bun test/test-frame-fit-ios-shared.mjs","test:ios-confirm-app-id":"bun test/test-ios-confirm-app-id.mjs","test:ios-create-new":"bun test/test-ios-create-new.mjs","test:ios-e2e":"bun test/test-ios-e2e.mjs","test:ios-flow-contract":"bun test/test-ios-flow-contract.mjs","test:ios-import-discovery":"bun test/test-ios-import-discovery.mjs","test:ios-import-export":"bun test/test-ios-import-export.mjs","test:ios-import-pickers":"bun test/test-ios-import-pickers.mjs","test:ios-import-recovery":"bun test/test-ios-import-recovery.mjs","test:ios-recovery":"bun test/test-ios-recovery.mjs","test:ios-resume":"bun test/test-ios-resume.mjs","test:ios-tail-handoff":"bun test/test-ios-tail-handoff.mjs","test:ios-tui-render":"bun test/test-ios-tui-render.mjs","test:p8-error":"bun test/test-p8-error.mjs","test:ios-tui-routing":"bun test/test-ios-tui-routing.mjs","test:ios-updater-sync-validation":"bun test/test-ios-updater-sync-validation.mjs","test:ios-verify-app":"bun test/test-ios-verify-app.mjs","test:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun run test:helper-dce && bun run test:version-detection:setup && 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 && bun run test:fail-on-incompatible && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:mcp-analytics && bun run test:app-created-source && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:version-detection && bun run test:platform-paths && bun run test:payload-split && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:platform-flow-contract && bun run test:tail-engine-shared","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:ai-analyze-stream":"bun test/test-ai-analyze-stream.mjs","test:ai-sse-parser":"bun test/test-ai-sse-parser.mjs","test:ai-render-markdown":"bun test/test-ai-render-markdown.mjs","test:ai-onboarding-mode":"bun test/test-ai-onboarding-mode.mjs","test:ai-fit":"bun test/test-ai-fit.mjs","test:platform-layout":"bun test/test-platform-layout.mjs","test:frame-fit":"bun test/run-frame-fit.mjs","test:onboarding-min-size":"bun test/test-onboarding-min-size.mjs","test:min-size-gate":"bun test/test-min-size-gate.mjs","test:shell-size-gate":"bun test/test-shell-size-gate.mjs","test:build-log-sanitize":"bun test/test-build-log-sanitize.mjs","test:build-output-viewport":"bun test/test-build-output-viewport.mjs","test:diff-viewer-viewport":"bun test/test-diff-viewer-viewport.mjs","test:build-complete-exit":"bun test/test-build-complete-exit.mjs","test:ai-stream-markdown":"bun test/test-ai-stream-markdown.mjs","test:support-mailto":"bun test/test-support-mailto.mjs","test:support-redact":"bun test/test-support-redact.mjs","test:support-internal-log":"bun test/test-support-internal-log.mjs","test:support-help-menu":"bun test/test-support-help-menu.mjs","test:support-contact":"bun test/test-support-contact.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.mjs"},dependencies:{"@inkjs/ui":"^2.0.0",ink:"^7.0.4","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.6","string-width":"^8.2.1"},optionalDependencies:{"@capgo/cli-helper-darwin-arm64":"^1.1.0","@capgo/cli-helper-darwin-x64":"^1.1.0"},devDependencies:{"@antfu/eslint-config":"^9.0.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.3.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.4.0","@modelcontextprotocol/sdk":"^1.29.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.106.2","@tanstack/intent":"^0.0.41","@types/adm-zip":"^0.5.8","@types/jsonwebtoken":"^9.0.10","@types/node":"^25.9.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.15","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native-preview":"7.0.0-dev.20260526.1","@vercel/ncc":"^0.38.4","@xterm/headless":"^6.0.0","adm-zip":"^0.5.17","ci-info":"^4.4.0",commander:"^14.0.3",eslint:"^10.4.0","git-format-staged":"4.0.1",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.67.0",partysocket:"^1.1.19",prettyjson:"^1.2.5",tmp:"^0.2.6","tus-js-client":"^4.3.1",typescript:"^6.0.3",ws:"^8.21.0",zod:"^4.4.3"}}});async function aF(D){try{let X=`https://registry.npmjs.org/${encodeURIComponent(D.toLowerCase())}`,J=await fetch(X,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});if(!J.ok)return null;return(await J.json())["dist-tags"]?.latest||null}catch{return null}}async function yK0(){let D=await aF("@capgo/cli")??"",$=D?.split(".")[0]??"";return{currentVersion:B1.version,latestVersion:D,isOutdated:!!D&&D!==B1.version,majorVersion:$}}async function VD(){let{isOutdated:D,currentVersion:$,latestVersion:X,majorVersion:J}=await yK0();if(D)L.warning(`\uD83D\uDEA8 You are using @capgo/cli@${$} it's not the latest version.
|
|
127
|
+
GFS4: `),console.error(D)};if(!xD[Z1]){if(HW=global[Z1]||[],F_(xD,HW),xD.close=function(D){function $(X,J){return D.call(xD,X,function(Y){if(!Y)Y_();if(typeof J==="function")J.apply(this,arguments)})}return Object.defineProperty($,mF,{value:D}),$}(xD.close),xD.closeSync=function(D){function $(X){D.apply(xD,arguments),Y_()}return Object.defineProperty($,mF,{value:D}),$}(xD.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){n8(xD[Z1]),l("assert").equal(xD[Z1].length,0)})}var HW;if(!global[Z1])F_(global,xD[Z1]);NW.exports=zW(fW0(xD));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!xD.__patched)NW.exports=zW(xD),xD.__patched=!0;function zW(D){xW0(D),D.gracefulify=zW,D.createReadStream=N,D.createWriteStream=A;var $=D.readFile;D.readFile=X;function X(I,x,P){if(typeof x==="function")P=x,x=null;return m(I,x,P);function m(b,p,k,R){return $(b,p,function(S){if(S&&(S.code==="EMFILE"||S.code==="ENFILE"))x5([m,[b,p,k],S,R||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}var J=D.writeFile;D.writeFile=Y;function Y(I,x,P,m){if(typeof P==="function")m=P,P=null;return b(I,x,P,m);function b(p,k,R,S,v){return J(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var F=D.appendFile;if(F)D.appendFile=Q;function Q(I,x,P,m){if(typeof P==="function")m=P,P=null;return b(I,x,P,m);function b(p,k,R,S,v){return F(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var U=D.copyFile;if(U)D.copyFile=Z;function Z(I,x,P,m){if(typeof P==="function")m=P,P=0;return b(I,x,P,m);function b(p,k,R,S,v){return U(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var G=D.readdir;D.readdir=q;var O=/^v[0-5]\./;function q(I,x,P){if(typeof x==="function")P=x,x=null;var m=O.test(process.version)?function(k,R,S,v){return G(k,b(k,R,S,v))}:function(k,R,S,v){return G(k,R,b(k,R,S,v))};return m(I,x,P);function b(p,k,R,S){return function(v,f){if(v&&(v.code==="EMFILE"||v.code==="ENFILE"))x5([m,[p,k,R],v,S||Date.now(),Date.now()]);else{if(f&&f.sort)f.sort();if(typeof R==="function")R.call(this,v,f)}}}}if(process.version.substr(0,4)==="v0.8"){var w=_W0(D);M=w.ReadStream,z=w.WriteStream}var W=D.ReadStream;if(W)M.prototype=Object.create(W.prototype),M.prototype.open=j;var K=D.WriteStream;if(K)z.prototype=Object.create(K.prototype),z.prototype.open=V;Object.defineProperty(D,"ReadStream",{get:function(){return M},set:function(I){M=I},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return z},set:function(I){z=I},enumerable:!0,configurable:!0});var H=M;Object.defineProperty(D,"FileReadStream",{get:function(){return H},set:function(I){H=I},enumerable:!0,configurable:!0});var B=z;Object.defineProperty(D,"FileWriteStream",{get:function(){return B},set:function(I){B=I},enumerable:!0,configurable:!0});function M(I,x){if(this instanceof M)return W.apply(this,arguments),this;else return M.apply(Object.create(M.prototype),arguments)}function j(){var I=this;_(I.path,I.flags,I.mode,function(x,P){if(x){if(I.autoClose)I.destroy();I.emit("error",x)}else I.fd=P,I.emit("open",P),I.read()})}function z(I,x){if(this instanceof z)return K.apply(this,arguments),this;else return z.apply(Object.create(z.prototype),arguments)}function V(){var I=this;_(I.path,I.flags,I.mode,function(x,P){if(x)I.destroy(),I.emit("error",x);else I.fd=P,I.emit("open",P)})}function N(I,x){return new D.ReadStream(I,x)}function A(I,x){return new D.WriteStream(I,x)}var u=D.open;D.open=_;function _(I,x,P,m){if(typeof P==="function")m=P,P=null;return b(I,x,P,m);function b(p,k,R,S,v){return u(p,k,R,function(f,h){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}return D}function x5(D){n8("ENQUEUE",D[0].name,D[1]),xD[Z1].push(D),VW()}var hF;function Y_(){var D=Date.now();for(var $=0;$<xD[Z1].length;++$)if(xD[Z1][$].length>2)xD[Z1][$][3]=D,xD[Z1][$][4]=D;VW()}function VW(){if(clearTimeout(hF),hF=void 0,xD[Z1].length===0)return;var D=xD[Z1].shift(),$=D[0],X=D[1],J=D[2],Y=D[3],F=D[4];if(Y===void 0)n8("RETRY",$.name,X),$.apply(null,X);else if(Date.now()-Y>=60000){n8("TIMEOUT",$.name,X);var Q=X.pop();if(typeof Q==="function")Q.call(null,J)}else{var U=Date.now()-F,Z=Math.max(F-Y,1),G=Math.min(Z*1.2,100);if(U>=G)n8("RETRY",$.name,X),$.apply(null,X.concat([Y]));else xD[Z1].push(D)}if(hF===void 0)hF=setTimeout(VW,0)}});var U_=E((he0,Q_)=>{function E$(D,$){if(typeof $==="boolean")$={forever:$};if(this._originalTimeouts=JSON.parse(JSON.stringify(D)),this._timeouts=D,this._options=$||{},this._maxRetryTime=$&&$.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)}Q_.exports=E$;E$.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};E$.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};E$.prototype.retry=function(D){if(this._timeout)clearTimeout(this._timeout);if(!D)return!1;var $=new Date().getTime();if(D&&$-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(D);var X=this._timeouts.shift();if(X===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),X=this._timeouts.shift();else return!1;var J=this,Y=setTimeout(function(){if(J._attempts++,J._operationTimeoutCb){if(J._timeout=setTimeout(function(){J._operationTimeoutCb(J._attempts)},J._operationTimeout),J._options.unref)J._timeout.unref()}J._fn(J._attempts)},X);if(this._options.unref)Y.unref();return!0};E$.prototype.attempt=function(D,$){if(this._fn=D,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var X=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){X._operationTimeoutCb()},X._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};E$.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};E$.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};E$.prototype.start=E$.prototype.try;E$.prototype.errors=function(){return this._errors};E$.prototype.attempts=function(){return this._attempts};E$.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},$=null,X=0;for(var J=0;J<this._errors.length;J++){var Y=this._errors[J],F=Y.message,Q=(D[F]||0)+1;if(D[F]=Q,Q>=X)$=Y,X=Q}return $}});var G_=E((bW0)=>{var yW0=U_();bW0.operation=function(D){var $=bW0.timeouts(D);return new yW0($,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};bW0.timeouts=function(D){if(D instanceof Array)return[].concat(D);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var X in D)$[X]=D[X];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var J=[];for(var Y=0;Y<$.retries;Y++)J.push(this.createTimeout(Y,$));if(D&&D.forever&&!J.length)J.push(this.createTimeout(Y,$));return J.sort(function(F,Q){return F-Q}),J};bW0.createTimeout=function(D,$){var X=$.randomize?Math.random()+1:1,J=Math.round(X*$.minTimeout*Math.pow($.factor,D));return J=Math.min(J,$.maxTimeout),J};bW0.wrap=function(D,$,X){if($ instanceof Array)X=$,$=null;if(!X){X=[];for(var J in D)if(typeof D[J]==="function")X.push(J)}for(var Y=0;Y<X.length;Y++){var F=X[Y],Q=D[F];D[F]=function(Z){var G=bW0.operation($),O=Array.prototype.slice.call(arguments,1),q=O.pop();O.push(function(w){if(G.retry(w))return;if(w)arguments[0]=G.mainError();q.apply(this,arguments)}),G.attempt(function(){Z.apply(D,O)})}.bind(D,Q),D[F].options=$}}});var O_=E((ce0,cF)=>{cF.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")cF.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")cF.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var lF=E((de0,f5)=>{var TD=global.process,l8=function(D){return D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function"};if(!l8(TD))f5.exports=function(){return function(){}};else{if(LW=l("assert"),i8=O_(),BW=/^win/i.test(TD.platform),_5=l("events"),typeof _5!=="function")_5=_5.EventEmitter;if(TD.__signal_exit_emitter__)sD=TD.__signal_exit_emitter__;else sD=TD.__signal_exit_emitter__=new _5,sD.count=0,sD.emitted={};if(!sD.infinite)sD.setMaxListeners(1/0),sD.infinite=!0;f5.exports=function(D,$){if(!l8(global.process))return function(){};if(LW.equal(typeof D,"function","a callback must be provided for exit handler"),p8===!1)dF();var X="exit";if($&&$.alwaysLast)X="afterexit";var J=function(){if(sD.removeListener(X,D),sD.listeners("exit").length===0&&sD.listeners("afterexit").length===0)v2()};return sD.on(X,D),J},v2=function(){if(!p8||!l8(global.process))return;p8=!1,i8.forEach(function($){try{TD.removeListener($,u2[$])}catch(X){}}),TD.emit=x2,TD.reallyExit=nF,sD.count-=1},f5.exports.unload=v2,E4=function($,X,J){if(sD.emitted[$])return;sD.emitted[$]=!0,sD.emit($,X,J)},u2={},i8.forEach(function(D){u2[D]=function(){if(!l8(global.process))return;var X=TD.listeners(D);if(X.length===sD.count){if(v2(),E4("exit",null,D),E4("afterexit",null,D),BW&&D==="SIGHUP")D="SIGINT";TD.kill(TD.pid,D)}}}),f5.exports.signals=function(){return i8},p8=!1,dF=function(){if(p8||!l8(global.process))return;p8=!0,sD.count+=1,i8=i8.filter(function($){try{return TD.on($,u2[$]),!0}catch(X){return!1}}),TD.emit=jW,TD.reallyExit=MW},f5.exports.load=dF,nF=TD.reallyExit,MW=function($){if(!l8(global.process))return;TD.exitCode=$||0,E4("exit",TD.exitCode,null),E4("afterexit",TD.exitCode,null),nF.call(TD,TD.exitCode)},x2=TD.emit,jW=function($,X){if($==="exit"&&l8(global.process)){if(X!==void 0)TD.exitCode=X;var J=x2.apply(this,arguments);return E4("exit",TD.exitCode,null),E4("afterexit",TD.exitCode,null),J}else return x2.apply(this,arguments)}}var LW,i8,BW,_5,sD,v2,E4,u2,p8,dF,nF,MW,x2,jW});var w_=E((nW0,IW)=>{var q_=Symbol();function cW0(D,$,X){let J=$[q_];if(J)return $.stat(D,(F,Q)=>{if(F)return X(F);X(null,Q.mtime,J)});let Y=new Date(Math.ceil(Date.now()/1000)*1000+5);$.utimes(D,Y,Y,(F)=>{if(F)return X(F);$.stat(D,(Q,U)=>{if(Q)return X(Q);let Z=U.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty($,q_,{value:Z}),X(null,U.mtime,Z)})})}function dW0(D){let $=Date.now();if(D==="s")$=Math.ceil($/1000)*1000;return new Date($)}nW0.probe=cW0;nW0.getMtime=dW0});var V_=E((eW0,f2)=>{var pW0=l("path"),RW=mD(),rW0=G_(),tW0=lF(),W_=w_(),c6={};function _2(D,$){return $.lockfilePath||`${D}.lock`}function TW(D,$,X){if(!$.realpath)return X(null,pW0.resolve(D));$.fs.realpath(D,X)}function AW(D,$,X){let J=_2(D,$);$.fs.mkdir(J,(Y)=>{if(!Y)return W_.probe(J,$.fs,(F,Q,U)=>{if(F)return $.fs.rmdir(J,()=>{}),X(F);X(null,Q,U)});if(Y.code!=="EEXIST")return X(Y);if($.stale<=0)return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));$.fs.stat(J,(F,Q)=>{if(F){if(F.code==="ENOENT")return AW(D,{...$,stale:0},X);return X(F)}if(!K_(Q,$))return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));H_(D,$,(U)=>{if(U)return X(U);AW(D,{...$,stale:0},X)})})})}function K_(D,$){return D.mtime.getTime()<Date.now()-$.stale}function H_(D,$,X){$.fs.rmdir(_2(D,$),(J)=>{if(J&&J.code!=="ENOENT")return X(J);X()})}function iF(D,$){let X=c6[D];if(X.updateTimeout)return;if(X.updateDelay=X.updateDelay||$.update,X.updateTimeout=setTimeout(()=>{X.updateTimeout=null,$.fs.stat(X.lockfilePath,(J,Y)=>{let F=X.lastUpdate+$.stale<Date.now();if(J){if(J.code==="ENOENT"||F)return EW(D,X,Object.assign(J,{code:"ECOMPROMISED"}));return X.updateDelay=1000,iF(D,$)}if(X.mtime.getTime()!==Y.mtime.getTime())return EW(D,X,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let U=W_.getMtime(X.mtimePrecision);$.fs.utimes(X.lockfilePath,U,U,(Z)=>{let G=X.lastUpdate+$.stale<Date.now();if(X.released)return;if(Z){if(Z.code==="ENOENT"||G)return EW(D,X,Object.assign(Z,{code:"ECOMPROMISED"}));return X.updateDelay=1000,iF(D,$)}X.mtime=U,X.lastUpdate=Date.now(),X.updateDelay=null,iF(D,$)})})},X.updateDelay),X.updateTimeout.unref)X.updateTimeout.unref()}function EW(D,$,X){if($.released=!0,$.updateTimeout)clearTimeout($.updateTimeout);if(c6[D]===$)delete c6[D];$.options.onCompromised(X)}function oW0(D,$,X){$={stale:1e4,update:null,realpath:!0,retries:0,fs:RW,onCompromised:(J)=>{throw J},...$},$.retries=$.retries||0,$.retries=typeof $.retries==="number"?{retries:$.retries}:$.retries,$.stale=Math.max($.stale||0,2000),$.update=$.update==null?$.stale/2:$.update||0,$.update=Math.max(Math.min($.update,$.stale/2),1000),TW(D,$,(J,Y)=>{if(J)return X(J);let F=rW0.operation($.retries);F.attempt(()=>{AW(Y,$,(Q,U,Z)=>{if(F.retry(Q))return;if(Q)return X(F.mainError());let G=c6[Y]={lockfilePath:_2(Y,$),mtime:U,mtimePrecision:Z,options:$,lastUpdate:Date.now()};iF(Y,$),X(null,(O)=>{if(G.released)return O&&O(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));z_(Y,{...$,realpath:!1},O)})})})})}function z_(D,$,X){$={fs:RW,realpath:!0,...$},TW(D,$,(J,Y)=>{if(J)return X(J);let F=c6[Y];if(!F)return X(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));F.updateTimeout&&clearTimeout(F.updateTimeout),F.released=!0,delete c6[Y],H_(Y,$,X)})}function aW0(D,$,X){$={stale:1e4,realpath:!0,fs:RW,...$},$.stale=Math.max($.stale||0,2000),TW(D,$,(J,Y)=>{if(J)return X(J);$.fs.stat(_2(Y,$),(F,Q)=>{if(F)return F.code==="ENOENT"?X(null,!1):X(F);return X(null,!K_(Q,$))})})}function sW0(){return c6}tW0(()=>{for(let D in c6){let $=c6[D].options;try{$.fs.rmdirSync(_2(D,$))}catch(X){}}});eW0.lock=oW0;eW0.unlock=z_;eW0.check=aW0;eW0.getLocks=sW0});var L_=E((ne0,N_)=>{var YK0=mD();function FK0(D){let $=["mkdir","realpath","stat","rmdir","utimes"],X={...D};return $.forEach((J)=>{X[J]=(...Y)=>{let F=Y.pop(),Q;try{Q=D[`${J}Sync`](...Y)}catch(U){return F(U)}F(null,Q)}}),X}function QK0(D){return(...$)=>new Promise((X,J)=>{$.push((Y,F)=>{if(Y)J(Y);else X(F)}),D(...$)})}function UK0(D){return(...$)=>{let X,J;if($.push((Y,F)=>{X=Y,J=F}),D(...$),X)throw X;return J}}function ZK0(D){if(D={...D},D.fs=FK0(D.fs||YK0),typeof D.retries==="number"&&D.retries>0||D.retries&&typeof D.retries.retries==="number"&&D.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return D}N_.exports={toPromise:QK0,toSync:UK0,toSyncOptions:ZK0}});var M_=E((le0,A4)=>{var k5=V_(),{toPromise:pF,toSync:rF,toSyncOptions:CW}=L_();async function B_(D,$){let X=await pF(k5.lock)(D,$);return pF(X)}function GK0(D,$){let X=rF(k5.lock)(D,CW($));return rF(X)}function OK0(D,$){return pF(k5.unlock)(D,$)}function qK0(D,$){return rF(k5.unlock)(D,CW($))}function wK0(D,$){return pF(k5.check)(D,$)}function WK0(D,$){return rF(k5.check)(D,CW($))}A4.exports=B_;A4.exports.lock=B_;A4.exports.unlock=OK0;A4.exports.lockSync=GK0;A4.exports.unlockSync=qK0;A4.exports.check=wK0;A4.exports.checkSync=WK0});var C_=E((R_)=>{Object.defineProperty(R_,"__esModule",{value:!0});R_.canStoreURLs=R_.FileUrlStorage=void 0;var j_=l("fs"),KK0=zK0(ox()),I_=HK0(M_());function A_(D){if(typeof WeakMap!="function")return null;var $=new WeakMap,X=new WeakMap;return(A_=function(J){return J?X:$})(D)}function HK0(D,$){if(!$&&D&&D.__esModule)return D;if(D===null||typeof D!="object"&&typeof D!="function")return{default:D};var X=A_($);if(X&&X.has(D))return X.get(D);var J={__proto__:null},Y=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var F in D)if(F!=="default"&&{}.hasOwnProperty.call(D,F)){var Q=Y?Object.getOwnPropertyDescriptor(D,F):null;Q&&(Q.get||Q.set)?Object.defineProperty(J,F,Q):J[F]=D[F]}return J.default=D,X&&X.set(D,J),J}function zK0(D){return D&&D.__esModule?D:{default:D}}function k2(D){return k2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},k2(D)}function VK0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function E_(D,$){for(var X=0;X<$.length;X++){var J=$[X];if(J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J)J.writable=!0;Object.defineProperty(D,LK0(J.key),J)}}function NK0(D,$,X){if($)E_(D.prototype,$);if(X)E_(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function LK0(D){var $=BK0(D,"string");return k2($)=="symbol"?$:$+""}function BK0(D,$){if(k2(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var J=X.call(D,$||"default");if(k2(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var ie0=R_.canStoreURLs=!0,pe0=R_.FileUrlStorage=function(){function D($){VK0(this,D),this.path=$}return NK0(D,[{key:"findAllUploads",value:function(){var X=this;return new Promise(function(J,Y){X._getItems("tus::",function(F,Q){if(F)Y(F);else J(Q)})})}},{key:"findUploadsByFingerprint",value:function(X){var J=this;return new Promise(function(Y,F){J._getItems("tus::".concat(X),function(Q,U){if(Q)F(Q);else Y(U)})})}},{key:"removeUpload",value:function(X){var J=this;return new Promise(function(Y,F){J._removeItem(X,function(Q){if(Q)F(Q);else Y()})})}},{key:"addUpload",value:function(X,J){var Y=this,F=Math.round(Math.random()*1000000000000),Q="tus::".concat(X,"::").concat(F);return new Promise(function(U,Z){Y._setItem(Q,J,function(G){if(G)Z(G);else U(Q)})})}},{key:"_setItem",value:function(X,J,Y){var F=this;I_.lock(this.path,this._lockfileOptions()).then(function(Q){Y=F._releaseAndCb(Q,Y),F._getData(function(U,Z){if(U){Y(U);return}Z[X]=J,F._writeData(Z,function(G){return Y(G)})})}).catch(Y)}},{key:"_getItems",value:function(X,J){this._getData(function(Y,F){if(Y){J(Y);return}var Q=Object.keys(F).filter(function(U){return U.startsWith(X)}).map(function(U){var Z=F[U];return Z.urlStorageKey=U,Z});J(null,Q)})}},{key:"_removeItem",value:function(X,J){var Y=this;I_.lock(this.path,this._lockfileOptions()).then(function(F){J=Y._releaseAndCb(F,J),Y._getData(function(Q,U){if(Q){J(Q);return}delete U[X],Y._writeData(U,function(Z){return J(Z)})})}).catch(J)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(X,J){return function(Y){if(Y){X().then(function(){return J(Y)}).catch(function(F){return J((0,KK0.default)([Y,F]))});return}X().then(J).catch(J)}}},{key:"_writeData",value:function(X,J){var Y={encoding:"utf8",mode:432,flag:"w"};(0,j_.writeFile)(this.path,JSON.stringify(X),Y,function(F){return J(F)})}},{key:"_getData",value:function(X){(0,j_.readFile)(this.path,"utf8",function(J,Y){if(J){if(J.code==="ENOENT")X(null,{});else X(J);return}try{Y=!Y.trim().length?{}:JSON.parse(Y)}catch(F){X(F);return}X(null,Y)})}}])}()});var oF=E((R4)=>{Object.defineProperty(R4,"__esModule",{value:!0});Object.defineProperty(R4,"DefaultHttpStack",{enumerable:!0,get:function(){return u_.default}});Object.defineProperty(R4,"DetailedError",{enumerable:!0,get:function(){return jK0.default}});Object.defineProperty(R4,"FileUrlStorage",{enumerable:!0,get:function(){return x_.FileUrlStorage}});Object.defineProperty(R4,"StreamSource",{enumerable:!0,get:function(){return TK0.default}});R4.Upload=void 0;Object.defineProperty(R4,"canStoreURLs",{enumerable:!0,get:function(){return x_.canStoreURLs}});R4.defaultOptions=void 0;Object.defineProperty(R4,"enableDebugLog",{enumerable:!0,get:function(){return IK0.enableDebugLog}});R4.isSupported=void 0;var jK0=r8(Cw()),IK0=Pw(),EK0=r8(Mv()),PW=r8(Du()),AK0=r8(Bu()),RK0=r8(Au()),u_=r8(mu()),TK0=r8(hw()),x_=C_();function r8(D){return D&&D.__esModule?D:{default:D}}function b5(D){return b5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},b5(D)}function CK0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function P_(D,$){for(var X=0;X<$.length;X++){var J=$[X];if(J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J)J.writable=!0;Object.defineProperty(D,f_(J.key),J)}}function PK0(D,$,X){if($)P_(D.prototype,$);if(X)P_(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function SK0(D,$,X){return $=tF($),vK0(D,__()?Reflect.construct($,X||[],tF(D).constructor):$.apply(D,X))}function vK0(D,$){if($&&(b5($)==="object"||typeof $==="function"))return $;else if($!==void 0)throw TypeError("Derived constructors may only return object or undefined");return uK0(D)}function uK0(D){if(D===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function __(){try{var D=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch($){}return(__=function(){return!!D})()}function tF(D){return tF=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(X){return X.__proto__||Object.getPrototypeOf(X)},tF(D)}function xK0(D,$){if(typeof $!=="function"&&$!==null)throw TypeError("Super expression must either be null or a function");if(D.prototype=Object.create($&&$.prototype,{constructor:{value:D,writable:!0,configurable:!0}}),Object.defineProperty(D,"prototype",{writable:!1}),$)SW(D,$)}function SW(D,$){return SW=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(J,Y){return J.__proto__=Y,J},SW(D,$)}function S_(D,$){var X=Object.keys(D);if(Object.getOwnPropertySymbols){var J=Object.getOwnPropertySymbols(D);$&&(J=J.filter(function(Y){return Object.getOwnPropertyDescriptor(D,Y).enumerable})),X.push.apply(X,J)}return X}function y5(D){for(var $=1;$<arguments.length;$++){var X=arguments[$]!=null?arguments[$]:{};$%2?S_(Object(X),!0).forEach(function(J){_K0(D,J,X[J])}):Object.getOwnPropertyDescriptors?Object.defineProperties(D,Object.getOwnPropertyDescriptors(X)):S_(Object(X)).forEach(function(J){Object.defineProperty(D,J,Object.getOwnPropertyDescriptor(X,J))})}return D}function _K0(D,$,X){if($=f_($),$ in D)Object.defineProperty(D,$,{value:X,enumerable:!0,configurable:!0,writable:!0});else D[$]=X;return D}function f_(D){var $=fK0(D,"string");return b5($)=="symbol"?$:$+""}function fK0(D,$){if(b5(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var J=X.call(D,$||"default");if(b5(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var v_=R4.defaultOptions=y5(y5({},PW.default.defaultOptions),{},{httpStack:new u_.default,fileReader:new AK0.default,urlStorage:new EK0.default,fingerprint:RK0.default}),te0=R4.Upload=function(D){function $(){var X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return CK0(this,$),J=y5(y5({},v_),J),SK0(this,$,[X,J])}return xK0($,D),PK0($,null,[{key:"terminate",value:function(J){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Y=y5(y5({},v_),Y),PW.default.terminate(J,Y)}}])}(PW.default),oe0=R4.isSupported=!0});var B1;var T4=r(()=>{B1={name:"@capgo/cli",type:"module",version:"8.5.1",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/capgo.git",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","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:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:credentials":"bun test/test-credentials.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:mcp":"node test/test-mcp.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:payload-split":"bun test/test-payload-split.mjs","test:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:apple-api-cert-create":"bun test/test-apple-api-cert-create.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:manifest-path-encoding":"bun test/test-manifest-path-encoding.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs","test:android-tail-engine":"bun test/test-android-tail-engine.mjs","test:android-tail-render":"bun test/test-android-tail-render.mjs","test:android-tail-routing":"bun test/test-android-tail-routing.mjs","test:dev-gate-stripped":"bun test/test-dev-gate-stripped.mjs","test:frame-fit-ios-shared":"bun test/test-frame-fit-ios-shared.mjs","test:ios-confirm-app-id":"bun test/test-ios-confirm-app-id.mjs","test:ios-create-new":"bun test/test-ios-create-new.mjs","test:ios-e2e":"bun test/test-ios-e2e.mjs","test:ios-flow-contract":"bun test/test-ios-flow-contract.mjs","test:ios-import-discovery":"bun test/test-ios-import-discovery.mjs","test:ios-import-export":"bun test/test-ios-import-export.mjs","test:ios-import-pickers":"bun test/test-ios-import-pickers.mjs","test:ios-import-recovery":"bun test/test-ios-import-recovery.mjs","test:ios-recovery":"bun test/test-ios-recovery.mjs","test:ios-resume":"bun test/test-ios-resume.mjs","test:ios-tail-handoff":"bun test/test-ios-tail-handoff.mjs","test:ios-tui-render":"bun test/test-ios-tui-render.mjs","test:p8-error":"bun test/test-p8-error.mjs","test:ios-tui-routing":"bun test/test-ios-tui-routing.mjs","test:ios-updater-sync-validation":"bun test/test-ios-updater-sync-validation.mjs","test:ios-verify-app":"bun test/test-ios-verify-app.mjs","test:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun run test:helper-dce && bun run test:version-detection:setup && 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 && bun run test:fail-on-incompatible && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:mcp-analytics && bun run test:app-created-source && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:version-detection && bun run test:platform-paths && bun run test:payload-split && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:asc-key-protocol && bun run test:apple-api-import-helpers && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:platform-flow-contract && bun run test:tail-engine-shared","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:ai-analyze-stream":"bun test/test-ai-analyze-stream.mjs","test:ai-sse-parser":"bun test/test-ai-sse-parser.mjs","test:ai-render-markdown":"bun test/test-ai-render-markdown.mjs","test:ai-onboarding-mode":"bun test/test-ai-onboarding-mode.mjs","test:ai-fit":"bun test/test-ai-fit.mjs","test:platform-layout":"bun test/test-platform-layout.mjs","test:frame-fit":"bun test/run-frame-fit.mjs","test:onboarding-min-size":"bun test/test-onboarding-min-size.mjs","test:min-size-gate":"bun test/test-min-size-gate.mjs","test:shell-size-gate":"bun test/test-shell-size-gate.mjs","test:build-log-sanitize":"bun test/test-build-log-sanitize.mjs","test:build-output-viewport":"bun test/test-build-output-viewport.mjs","test:diff-viewer-viewport":"bun test/test-diff-viewer-viewport.mjs","test:build-complete-exit":"bun test/test-build-complete-exit.mjs","test:ai-stream-markdown":"bun test/test-ai-stream-markdown.mjs","test:support-mailto":"bun test/test-support-mailto.mjs","test:support-redact":"bun test/test-support-redact.mjs","test:support-internal-log":"bun test/test-support-internal-log.mjs","test:support-help-menu":"bun test/test-support-help-menu.mjs","test:support-contact":"bun test/test-support-contact.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.mjs"},dependencies:{"@inkjs/ui":"^2.0.0",ink:"^7.0.4","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.6","string-width":"^8.2.1"},optionalDependencies:{"@capgo/cli-helper-darwin-arm64":"^1.1.0","@capgo/cli-helper-darwin-x64":"^1.1.0"},devDependencies:{"@antfu/eslint-config":"^9.0.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.3.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.4.0","@modelcontextprotocol/sdk":"^1.29.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.106.2","@tanstack/intent":"^0.0.41","@types/adm-zip":"^0.5.8","@types/jsonwebtoken":"^9.0.10","@types/node":"^25.9.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.15","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native-preview":"7.0.0-dev.20260526.1","@vercel/ncc":"^0.38.4","@xterm/headless":"^6.0.0","adm-zip":"^0.5.17","ci-info":"^4.4.0",commander:"^14.0.3",eslint:"^10.4.0","git-format-staged":"4.0.1",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.67.0",partysocket:"^1.1.19",prettyjson:"^1.2.5",tmp:"^0.2.6","tus-js-client":"^4.3.1",typescript:"^6.0.3",ws:"^8.21.0",zod:"^4.4.3"}}});async function aF(D){try{let X=`https://registry.npmjs.org/${encodeURIComponent(D.toLowerCase())}`,J=await fetch(X,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});if(!J.ok)return null;return(await J.json())["dist-tags"]?.latest||null}catch{return null}}async function yK0(){let D=await aF("@capgo/cli")??"",$=D?.split(".")[0]??"";return{currentVersion:B1.version,latestVersion:D,isOutdated:!!D&&D!==B1.version,majorVersion:$}}async function VD(){let{isOutdated:D,currentVersion:$,latestVersion:X,majorVersion:J}=await yK0();if(D)L.warning(`\uD83D\uDEA8 You are using @capgo/cli@${$} it's not the latest version.
|
|
128
128
|
Please use @capgo/cli@${X}" or @capgo/cli@${J} to keep up to date with the latest features and bug fixes.`)}var x1=r(()=>{g0();T4()});async function g_(D,$,X,J,Y,F="✅"){await j0(X,{channel:D,event:J,icon:F,org_id:$,tracking_version:2,...Y?{tags:{"app-id":Y}}:{},notify:!1})}var h_=r(()=>{g0();i9();x1();_0()});var c_=E((G0D,m_)=>{var g5=1000,h5=g5*60,m5=h5*60,t8=m5*24,bK0=t8*7,gK0=t8*365.25;m_.exports=function(D,$){$=$||{};var X=typeof D;if(X==="string"&&D.length>0)return hK0(D);else if(X==="number"&&isFinite(D))return $.long?cK0(D):mK0(D);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(D))};function hK0(D){if(D=String(D),D.length>100)return;var $=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(D);if(!$)return;var X=parseFloat($[1]),J=($[2]||"ms").toLowerCase();switch(J){case"years":case"year":case"yrs":case"yr":case"y":return X*gK0;case"weeks":case"week":case"w":return X*bK0;case"days":case"day":case"d":return X*t8;case"hours":case"hour":case"hrs":case"hr":case"h":return X*m5;case"minutes":case"minute":case"mins":case"min":case"m":return X*h5;case"seconds":case"second":case"secs":case"sec":case"s":return X*g5;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return X;default:return}}function mK0(D){var $=Math.abs(D);if($>=t8)return Math.round(D/t8)+"d";if($>=m5)return Math.round(D/m5)+"h";if($>=h5)return Math.round(D/h5)+"m";if($>=g5)return Math.round(D/g5)+"s";return D+"ms"}function cK0(D){var $=Math.abs(D);if($>=t8)return sF(D,$,t8,"day");if($>=m5)return sF(D,$,m5,"hour");if($>=h5)return sF(D,$,h5,"minute");if($>=g5)return sF(D,$,g5,"second");return D+" ms"}function sF(D,$,X,J){var Y=$>=X*1.5;return Math.round(D/X)+" "+J+(Y?"s":"")}});var vW=E((O0D,d_)=>{function dK0(D){X.debug=X,X.default=X,X.coerce=Z,X.disable=Q,X.enable=Y,X.enabled=U,X.humanize=c_(),X.destroy=G,Object.keys(D).forEach((O)=>{X[O]=D[O]}),X.names=[],X.skips=[],X.formatters={};function $(O){let q=0;for(let w=0;w<O.length;w++)q=(q<<5)-q+O.charCodeAt(w),q|=0;return X.colors[Math.abs(q)%X.colors.length]}X.selectColor=$;function X(O){let q,w=null,W,K;function H(...B){if(!H.enabled)return;let M=H,j=Number(new Date),z=j-(q||j);if(M.diff=z,M.prev=q,M.curr=j,q=j,B[0]=X.coerce(B[0]),typeof B[0]!=="string")B.unshift("%O");let V=0;B[0]=B[0].replace(/%([a-zA-Z%])/g,(A,u)=>{if(A==="%%")return"%";V++;let _=X.formatters[u];if(typeof _==="function"){let I=B[V];A=_.call(M,I),B.splice(V,1),V--}return A}),X.formatArgs.call(M,B),(M.log||X.log).apply(M,B)}if(H.namespace=O,H.useColors=X.useColors(),H.color=X.selectColor(O),H.extend=J,H.destroy=X.destroy,Object.defineProperty(H,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(w!==null)return w;if(W!==X.namespaces)W=X.namespaces,K=X.enabled(O);return K},set:(B)=>{w=B}}),typeof X.init==="function")X.init(H);return H}function J(O,q){let w=X(this.namespace+(typeof q>"u"?":":q)+O);return w.log=this.log,w}function Y(O){X.save(O),X.namespaces=O,X.names=[],X.skips=[];let q=(typeof O==="string"?O:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let w of q)if(w[0]==="-")X.skips.push(w.slice(1));else X.names.push(w)}function F(O,q){let w=0,W=0,K=-1,H=0;while(w<O.length)if(W<q.length&&(q[W]===O[w]||q[W]==="*"))if(q[W]==="*")K=W,H=w,W++;else w++,W++;else if(K!==-1)W=K+1,H++,w=H;else return!1;while(W<q.length&&q[W]==="*")W++;return W===q.length}function Q(){let O=[...X.names,...X.skips.map((q)=>"-"+q)].join(",");return X.enable(""),O}function U(O){for(let q of X.skips)if(F(O,q))return!1;for(let q of X.names)if(F(O,q))return!0;return!1}function Z(O){if(O instanceof Error)return O.stack||O.message;return O}function G(){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 X.enable(X.load()),X}d_.exports=dK0});var l_=E((n_,eF)=>{n_.formatArgs=lK0;n_.save=iK0;n_.load=pK0;n_.useColors=nK0;n_.storage=rK0();n_.destroy=(()=>{let D=!1;return()=>{if(!D)D=!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`.")}})();n_.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 nK0(){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 D;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&&(D=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(D[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function lK0(D){if(D[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+D[0]+(this.useColors?"%c ":" ")+"+"+eF.exports.humanize(this.diff),!this.useColors)return;let $="color: "+this.color;D.splice(1,0,$,"color: inherit");let X=0,J=0;D[0].replace(/%[a-zA-Z%]/g,(Y)=>{if(Y==="%%")return;if(X++,Y==="%c")J=X}),D.splice(J,0,$)}n_.log=console.debug||console.log||(()=>{});function iK0(D){try{if(D)n_.storage.setItem("debug",D);else n_.storage.removeItem("debug")}catch($){}}function pK0(){let D;try{D=n_.storage.getItem("debug")||n_.storage.getItem("DEBUG")}catch($){}if(!D&&typeof process<"u"&&"env"in process)D=process.env.DEBUG;return D}function rK0(){try{return localStorage}catch(D){}}eF.exports=vW()(n_);var{formatters:tK0}=eF.exports;tK0.j=function(D){try{return JSON.stringify(D)}catch($){return"[UnexpectedJSONParseError]: "+$.message}}});var p_=E((w0D,i_)=>{i_.exports=(D,$=process.argv)=>{let X=D.startsWith("-")?"":D.length===1?"-":"--",J=$.indexOf(X+D),Y=$.indexOf("--");return J!==-1&&(Y===-1||J<Y)}});var o_=E((W0D,t_)=>{var JH0=l("os"),r_=l("tty"),A$=p_(),{env:X1}=process,C4;if(A$("no-color")||A$("no-colors")||A$("color=false")||A$("color=never"))C4=0;else if(A$("color")||A$("colors")||A$("color=true")||A$("color=always"))C4=1;if("FORCE_COLOR"in X1)if(X1.FORCE_COLOR==="true")C4=1;else if(X1.FORCE_COLOR==="false")C4=0;else C4=X1.FORCE_COLOR.length===0?1:Math.min(parseInt(X1.FORCE_COLOR,10),3);function uW(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function xW(D,$){if(C4===0)return 0;if(A$("color=16m")||A$("color=full")||A$("color=truecolor"))return 3;if(A$("color=256"))return 2;if(D&&!$&&C4===void 0)return 0;let X=C4||0;if(X1.TERM==="dumb")return X;if(process.platform==="win32"){let J=JH0.release().split(".");if(Number(J[0])>=10&&Number(J[2])>=10586)return Number(J[2])>=14931?3:2;return 1}if("CI"in X1){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((J)=>(J in X1))||X1.CI_NAME==="codeship")return 1;return X}if("TEAMCITY_VERSION"in X1)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(X1.TEAMCITY_VERSION)?1:0;if(X1.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in X1){let J=parseInt((X1.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(X1.TERM_PROGRAM){case"iTerm.app":return J>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(X1.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(X1.TERM))return 1;if("COLORTERM"in X1)return 1;return X}function YH0(D){let $=xW(D,D&&D.isTTY);return uW($)}t_.exports={supportsColor:YH0,stdout:uW(xW(!0,r_.isatty(1))),stderr:uW(xW(!0,r_.isatty(2)))}});var Df=E((s_,$Q)=>{var FH0=l("tty"),DQ=l("util");s_.init=wH0;s_.log=GH0;s_.formatArgs=UH0;s_.save=OH0;s_.load=qH0;s_.useColors=QH0;s_.destroy=DQ.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");s_.colors=[6,2,3,4,5,1];try{let D=o_();if(D&&(D.stderr||D).level>=2)s_.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(D){}s_.inspectOpts=Object.keys(process.env).filter((D)=>{return/^debug_/i.test(D)}).reduce((D,$)=>{let X=$.substring(6).toLowerCase().replace(/_([a-z])/g,(Y,F)=>{return F.toUpperCase()}),J=process.env[$];if(/^(yes|on|true|enabled)$/i.test(J))J=!0;else if(/^(no|off|false|disabled)$/i.test(J))J=!1;else if(J==="null")J=null;else J=Number(J);return D[X]=J,D},{});function QH0(){return"colors"in s_.inspectOpts?Boolean(s_.inspectOpts.colors):FH0.isatty(process.stderr.fd)}function UH0(D){let{namespace:$,useColors:X}=this;if(X){let J=this.color,Y="\x1B[3"+(J<8?J:"8;5;"+J),F=` ${Y};1m${$} \x1B[0m`;D[0]=F+D[0].split(`
|
|
129
129
|
`).join(`
|
|
130
130
|
`+F),D.push(Y+"m+"+$Q.exports.humanize(this.diff)+"\x1B[0m")}else D[0]=ZH0()+$+" "+D[0]}function ZH0(){if(s_.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function GH0(...D){return process.stderr.write(DQ.formatWithOptions(s_.inspectOpts,...D)+`
|
|
@@ -635,7 +635,7 @@ ${o(Z.error)}`);throw Error(`Cannot create channel: ${o(Z.error)}`)}if(await j0(
|
|
|
635
635
|
${X}
|
|
636
636
|
${$}
|
|
637
637
|
|
|
638
|
-
`)}async function L50(D,$,X){await bp0(D,$),await hp0(X)}_0();function B50(D){let $=D.map((X)=>{let J=F8(X);return[X.name,X.localVersion||"-",X.remoteVersion||"-",J.compatible?"✅":"❌",J.message]});L.info(M3({headers:["Package","Local","Remote","Status","Details"],rows:$}))}var M50=["major","minor","metadata","patch","none"];async function j50(D,$,X,J=!1){if(!J)B0("Set channel");X.apikey=X.apikey||z0();let Y=await E0();if($=i0($,Y?.config),!X.apikey){if(!J)L.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!$){if(!J)L.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}if(!D){if(!J)L.error("Missing argument, you need to provide a channel");throw Error("Missing channel id")}let F=await C0(X.apikey,X.supaHost,X.supaAnon);await tD(F,$,J);let Q=await $D(F,X.apikey);await fD(F,X.apikey,$,
|
|
638
|
+
`)}async function L50(D,$,X){await bp0(D,$),await hp0(X)}_0();function B50(D){let $=D.map((X)=>{let J=F8(X);return[X.name,X.localVersion||"-",X.remoteVersion||"-",J.compatible?"✅":"❌",J.message]});L.info(M3({headers:["Package","Local","Remote","Status","Details"],rows:$}))}var M50=["major","minor","metadata","patch","none"];async function j50(D,$,X,J=!1){if(!J)B0("Set channel");X.apikey=X.apikey||z0();let Y=await E0();if($=i0($,Y?.config),!X.apikey){if(!J)L.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!$){if(!J)L.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}if(!D){if(!J)L.error("Missing argument, you need to provide a channel");throw Error("Missing channel id")}let F=await C0(X.apikey,X.supaHost,X.supaAnon);await tD(F,$,J);let Q=await $D(F,X.apikey);await fD(F,X.apikey,$,3,J,!0);let U=await rD(F,$),{bundle:Z,state:G,downgrade:O,latest:q,latestRemote:w,ios:W,android:K,selfAssign:H,disableAutoUpdate:B,dev:M,emulator:j,device:z,prod:V}=X;if(q&&Z){if(!J)L.error("Cannot set latest and bundle at the same time");throw Error("Cannot set both latest and bundle simultaneously")}if(w&&Z){if(!J)L.error("Cannot set latest remote and bundle at the same time");throw Error("Cannot set both latest remote and bundle simultaneously")}if(w&&q){if(!J)L.error("Cannot set latest remote and latest at the same time");throw Error("Cannot set both latest remote and latest simultaneously")}if(Z==null&&G==null&&q==null&&w==null&&O==null&&W==null&&K==null&&H==null&&M==null&&j==null&&z==null&&V==null&&B==null){if(!J)L.error("Missing argument, you need to provide a option to set");throw Error("No channel option provided")}await l00(F,U,X.apikey,$);let N={created_by:Q,app_id:$,name:D,owner_org:U,version:void 0},{error:A}=await F.from("channels").select().eq("app_id",$).eq("name",D).single();if(A){if(!J)L.error(`Cannot find channel ${D}`);throw Error(`Cannot find channel ${D}`)}let u=q?Y?.config?.plugins?.CapacitorUpdater?.version||J8("",X.packageJson):Z;if(u!=null){let{data:I,error:x}=await F.from("app_versions").select().eq("app_id",$).eq("name",u).eq("user_id",Q).eq("deleted",!1).single();if(x||!I){if(!J)L.error(`Cannot find version ${u}`);throw Error(`Cannot find version ${u}`)}if(!X.ignoreMetadataCheck){let{finalCompatibility:P,localDependencies:m}=await tj(F,$,D,I.native_packages??[]),b=P.filter((p)=>!E6(p));if(m.length>0&&b.length>0){if(!J)L.warn(`Bundle NOT compatible with ${D} channel`),L.warn(""),B50(P),L.warn(""),L.warn("An app store update may be required for these changes to take effect.");throw Error(`Bundle is not compatible with ${D} channel`)}if(!J)if(m.length===0&&P.length>0)L.info(`Ignoring check compatibility with ${D} channel because the bundle does not contain any native packages`);else L.info(`Bundle is compatible with ${D} channel`)}if(!J)L.info(`Set ${$} channel: ${D} to @${u}`);N.version=I.id}if(w){let{data:I,error:x}=await F.from("app_versions").select().eq("app_id",$).eq("user_id",Q).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(x||!I){if(!J)L.error("Cannot find latest remote version");throw Error("Cannot find latest remote version")}if(!X.ignoreMetadataCheck){let{finalCompatibility:P}=await tj(F,$,D,I.native_packages??[]);if(P.filter((b)=>!E6(b)).length>0){if(!J)L.warn(`Bundle NOT compatible with ${D} channel`),L.warn(""),B50(P),L.warn(""),L.warn("An app store update may be required for these changes to take effect.");throw Error(`Latest remote bundle is not compatible with ${D} channel`)}}if(!J)L.info(`Set ${$} channel: ${D} to @${I.name}`);N.version=I.id}if(G!=null){if(G!=="normal"&&G!=="default"){if(!J)L.error(`State ${G} is not known. The possible values are: normal, default.`);throw Error(`Unknown state ${G}. Expected normal or default`)}if(!J)L.info(`Set ${$} channel: ${D} to ${G}`);N.public=G==="default"}if(O!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${O?"allow":"disallow"} downgrade`);N.disable_auto_update_under_native=!O}if(W!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${W?"allow":"disallow"} ios update`);N.ios=!!W}if(K!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${K?"allow":"disallow"} android update`);N.android=!!K}if(H!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${H?"allow":"disallow"} self assign to this channel`);N.allow_device_self_set=!!H}if(M!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${M?"allow":"disallow"} dev devices`);N.allow_dev=!!M}if(j!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${j?"allow":"disallow"} emulator devices`);N.allow_emulator=!!j}if(z!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${z?"allow":"disallow"} physical devices`);N.allow_device=!!z}if(V!=null){if(!J)L.info(`Set ${$} channel: ${D} to ${V?"allow":"disallow"} prod builds`);N.allow_prod=!!V}if(B!=null){let I=B.toLowerCase();if(!M50.includes(I)){if(!J)L.error(`Channel strategy ${I} is not known. The possible values are: ${M50.join(", ")}.`);throw Error(`Unknown channel strategy ${I}`)}if(I==="metadata")I="version_number";if(N.disable_auto_update=I,!J)L.info(`Set ${$} channel: ${D} to ${I} disable update strategy to this channel`)}let{error:_}=await cG(F,N);if(_){if(!J)L.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.');throw Error("Upload key is not allowed to set this channel")}if(X.qrPreview&&!J){let I=await N50(F,$,D);if(!I)throw Error(`Channel ${D} not found for app ${$}`);await L50(F,$,I)}if(await j0(X.apikey,{channel:"channel",event:"Set channel",icon:"✅",org_id:U,tracking_version:2,tags:{"app-id":$},notify:!1}).catch(()=>{}),!J)M0("Done ✅");return!0}g0();H1();import{existsSync as P3,readFileSync as mp0,unlinkSync as I50,writeFileSync as E50}from"node:fs";x1();cU();_0();function A50(D){return D.plugins??={},D.plugins.extConfig??={},D.plugins.CapacitorUpdater??={},D.plugins.CapacitorUpdater}async function R50(D,$=!1){if(!$)B0("Save keys \uD83D\uDD11");let X=await E0(),J=D.key||F4,Y=D.keyData||"";if(!P3(J)&&!Y){if(!$)L.error(`Cannot find a public key at ${J} or as keyData option or in ${X.path}`);throw Error("Missing public key")}if(P3(J))Y=mp0(J,"utf8");if(!Y.startsWith("-----BEGIN RSA PUBLIC KEY-----")){if(!$)L.error("The public key provided is not a valid RSA Public key");throw Error("Invalid RSA public key")}if(X?.config){let F=A50(X.config);if(F.privateKey){if(delete F.privateKey,!$)L.info("Old private key deleted from config file");if($?D.setupChannel??!1:D.setupChannel??await kD({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))F.defaultChannel="encryption_v2"}F.publicKey=Y,await W7(X),l0({channel:"key",event:"Key Saved",icon:"\uD83D\uDCBE",tags:{}})}if(!$)L.success(`Public key saved into ${X.path} file in local directory`),L.success("Your app will decode the zip archive with this key");return!0}async function T50(D,$=!1){if(!$)B0("Deleting old private key \uD83D\uDDD1️");let X=await E0(),J=X?.config?.plugins?.CapacitorUpdater;if(J?.privateKey){if(delete J.privateKey,await W7(X),P3(o7))try{if(I50(o7),!$)L.success(`Old private key file deleted: ${o7}`)}catch(Y){if(!$)L.error(`Failed to delete old private key file: ${o7} (${String(Y)})`)}if(P3(_G))try{if(I50(_G),!$)L.success(`Old public key file deleted: ${_G}`)}catch(Y){if(!$)L.error(`Failed to delete old public key file: ${F4} (${String(Y)})`)}if(!$)L.success(`Old private key deleted from ${X.path} file`),M0("Done ✅");return l0({channel:"key",event:"Old Key Deleted",icon:"\uD83E\uDDF9",tags:{}}),!0}if(!$)L.info("No old private key found in config file");return!1}async function C50(D,$=!1){if(!$)B0("Create keys \uD83D\uDD11");let{publicKey:X,privateKey:J}=G80();if(P3(F4)&&!D.force){if(!$)L.error("Public Key already exists, use --force to overwrite");throw Error("Public key already exists")}if(E50(F4,X),P3(V$)&&!D.force){if(!$)L.error("Private Key already exists, use --force to overwrite");throw Error("Private key already exists")}E50(V$,J);let Y=await E0();if(Y){let F=A50(Y.config);if(F.privateKey){if(delete F.privateKey,!$)L.info("Old private key deleted from config file");if($?D.setupChannel??!1:D.setupChannel??await kD({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))F.defaultChannel="encryption_v2"}F.publicKey=X,await W7(Y)}if(l0({channel:"key",event:"Encryption Keys Generated",icon:"\uD83D\uDD11",tags:{}}),!$){L.success("Your RSA key has been generated"),L.success(`Private key saved in ${V$}`),L.success("This key will be used to encrypt your bundle before sending it to Capgo"),L.success("Keep it safe"),L.success("Then make it unreadable by Capgo and unmodifiable by anyone"),L.success(`Public key saved in ${Y.path}`),L.success("Your app will be the only one having it"),L.success("Only your users can decrypt your update"),L.success("Only you can send them an update");try{await FD0(void 0,void 0,void 0,{validateIosUpdater:!0}),M0("Done ✅")}catch(F){if(F instanceof Error&&F.message==="Capacitor sync cancelled")return!0;throw F}}return!0}g0();x1();_0();import{existsSync as cp0}from"node:fs";import{homedir as dp0}from"node:os";async function P50(D,$,X=!1){if(!X)B0("Login to Capgo");if(!D&&!X){let F=await tA({message:"Enter your API key:",mask:"*"});if(c0(F))throw L.error("Login cancelled"),Error("Login cancelled");D=F}if(!D){if(!X)L.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!X)await VD();let{local:J}=$;if(J&&!cp0(".git")){if(!X)L.error("To use local you should be in a git repository");throw Error("Not in a git repository")}let Y=await C0(D,$.supaHost,$.supaAnon);if(await $D(Y,D),J)await w3(".capgo",`${D}
|
|
639
639
|
`,{mode:384}),await I$0(".gitignore",`.capgo
|
|
640
640
|
`,384);else{let F=dp0();await w3(`${F}/.capgo`,`${D}
|
|
641
641
|
`,{mode:384})}if(await j0(D,{channel:"user-login",event:"User CLI login",icon:"✅",tracking_version:2,notify:!1}).catch(),!X)L.success(`login saved into .capgo file in ${J?"local":"home"} directory`),M0("Done ✅")}g0();x1();_0();async function S50(D,$=!1){if(!$)B0("Adding organization");await VD();let X={...D,apikey:D.apikey||z0()};if(!X.apikey){if(!$)L.error("Missing API key, you need to provide an API key to add an organization");throw Error("Missing API key")}let J=await C0(X.apikey,X.supaHost,X.supaAnon),Y=await $D(J,X.apikey),{name:F,email:Q}=X;if(!$&&!F){let G=await H4({message:"Organization name:",placeholder:"My Organization"});if(c0(G))throw L.error("Canceled adding organization"),Error("Organization creation cancelled");F=G}if(!$&&!Q){let G=await H4({message:"Management email:",placeholder:"admin@example.com"});if(c0(G))throw L.error("Canceled adding organization"),Error("Organization creation cancelled");Q=G}if(!F||!Q){if(!$)L.error("Missing arguments, you need to provide an organization name and management email");throw Error("Missing organization name or management email")}if(!$)L.info(`Adding organization "${F}" to Capgo`);let{data:U,error:Z}=await J.from("orgs").insert({name:F,management_email:Q,created_by:Y}).select().single();if(Z){if(!$)L.error(`Could not add organization ${o(Z)}`);throw Error(`Could not add organization: ${o(Z)}`)}if(await j0(X.apikey,{channel:"organization",event:"Organization Created",icon:"\uD83C\uDFE2",org_id:U.id,tracking_version:2,tags:{"org-name":F},notify:!1}).catch(()=>{}),!$)L.success(`Organization "${F}" added to Capgo`),M0("Done ✅");return U}g0();x1();_0();async function v50(D,$,X=!1){if(!X)B0("Deleting organization");await VD();let J={...$,apikey:$.apikey||z0()};if(!J.apikey){if(!X)L.error("Missing API key, you need to provide an API key to delete an organization");throw Error("Missing API key")}if(!D){if(!X)L.error("Missing argument, you need to provide an organization ID");throw Error("Missing organization id")}let Y=await C0(J.apikey,J.supaHost,J.supaAnon);await nG(Y,J.apikey,"org.delete",D,`Insufficient permissions to delete organization ${D}`,X),await fG(Y,D,X);let{data:F,error:Q}=await Y.from("orgs").select("created_by, name").eq("id",D).single();if(Q||!F){if(!X)L.error(`Cannot get organization details ${o(Q)}`);throw Error(`Cannot get organization details: ${o(Q)}`)}if(!X&&!J.autoConfirm){let Z=await kD({message:`Are you sure you want to delete organization "${F.name}"? This action cannot be undone.`});if(c0(Z)||!Z)throw L.error("Canceled deleting the organization"),Error("Organization deletion cancelled")}if(!X)L.info(`Deleting organization "${F.name}"`);let{error:U}=await Y.from("orgs").delete().eq("id",D);if(U){if(!X)L.error(`Could not delete organization ${o(U)}`);throw Error(`Could not delete organization: ${o(U)}`)}if(await j0(J.apikey,{channel:"organization",event:"Organization Deleted",icon:"\uD83D\uDDD1️",org_id:D,tracking_version:2,tags:{"org-name":F.name},notify:!1}).catch(()=>{}),!X)L.success(`Organization "${F.name}" deleted from Capgo`),M0("Done ✅");return!0}g0();i9();H1();x1();_0();function np0(D,$){if($)return;if(!D.length){L.error("No organizations found");return}let X=new G$;X.headers=["Name","ID","Role","Apps","2FA Required","2FA Access"],X.rows=[];for(let Y of D.toReversed()){let F=Y.enforcing_2fa?"✓ Yes":"✗ No",Q=Y["2fa_has_access"]?"✓ Yes":"✗ No";X.rows.push([Y.name??"Unknown",Y.gid,Y.role,Y.app_count?.toString()||"0",F,Q])}L.success("Organizations"),L.success(X.toString());let J=D.filter((Y)=>Y.enforcing_2fa&&!Y["2fa_has_access"]);if(J.length>0){L.warn(`
|