@capgo/cli 8.56.0 → 8.56.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 CHANGED
@@ -67,7 +67,7 @@ ${X}
67
67
  `}}}}).prompt();var WB=mA(()=>{yJA();yJA();jJA();VJA();Hk=eA(PJA(),1);gJA=qRQ(),IRQ=P6("◆","*"),wTA=P6("■","x"),PTA=P6("▲","x"),uJA=P6("◇","o"),ORQ=P6("┌","T"),g4=P6("│","|"),f2=P6("└","—"),ye0=P6("┐","T"),ge0=P6("┘","—"),hJA=P6("●",">"),Op=P6("○"," "),he0=P6("◻","[•]"),ue0=P6("◼","[+]"),me0=P6("◻","[ ]"),MRQ=P6("▪","•"),ce0=P6("─","-"),de0=P6("╮","+"),le0=P6("├","+"),pe0=P6("╯","+"),ie0=P6("╰","+"),ne0=P6("╭","+"),LRQ=P6("●","•"),CRQ=P6("◆","*"),VRQ=P6("▲","!"),NRQ=P6("■","x");ae0=[`${j0("dim","↑/↓")} to navigate`,`${j0("dim","Space:")} select`,`${j0("dim","Enter:")} confirm`],f={message:(A=[],{symbol:Q=j0("gray",g4),secondarySymbol:B=j0("gray",g4),output:$=process.stdout,spacing:J=1,withGuide:Y}={})=>{let Z=[],X=Y??aJ.withGuide,G=X?B:"",K=X?`${Q} `:"",W=X?`${B} `:"";for(let U=0;U<J;U++)Z.push(G);let H=Array.isArray(A)?A:A.split(`
68
68
  `);if(H.length>0){let[U,...q]=H;U.length>0?Z.push(`${K}${U}`):Z.push(X?Q:"");for(let D of q)D.length>0?Z.push(`${W}${D}`):Z.push(X?B:"")}$.write(`${Z.join(`
69
69
  `)}
70
- `)},info:(A,Q)=>{f.message(A,{...Q,symbol:j0("blue",LRQ)})},success:(A,Q)=>{f.message(A,{...Q,symbol:j0("green",CRQ)})},step:(A,Q)=>{f.message(A,{...Q,symbol:j0("green",uJA)})},warn:(A,Q)=>{f.message(A,{...Q,symbol:j0("yellow",VRQ)})},warning:(A,Q)=>{f.warn(A,Q)},error:(A,Q)=>{f.message(A,{...Q,symbol:j0("red",NRQ)})}},re0={light:P6("─","-"),heavy:P6("━","="),block:P6("█","#")},PRQ=[`${j0("dim","↑/↓")} to navigate`,`${j0("dim","Enter:")} confirm`],oe0=`${j0("gray",g4)} `});var $6;var fZ=mA(()=>{$6={name:"@capgo/cli",type:"module",version:"8.56.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:"https://github.com/Cap-go/capgo.app",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:notify-app-ready-background":"bun test ./test/test-notify-app-ready-background.mjs ./test/test-background-check-shutdown.mjs","test:bundle":"bun test/test-bundle.mjs","test:bundle-validation":"bun test test/bundle/","test:prescan":"bun test test/prescan/","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:native-dependencies":"bun test/test-native-dependencies.mjs && bun test/test-get-remote-dependencies.mjs","test:package-json-guard":"bun test/test-package-json-guard.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-export":"bun test/test-credentials-export.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:cli-help":"bun test/test-cli-help.mjs","test:build-cache-payload":"bun test/test-build-cache-payload.mjs","test:build-cancellation":"bun test/test-build-cancellation.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:cli-headers":"bun test/test-cli-headers.mjs","test:min-cli-version":"bun test/test-min-cli-version.mjs","test:authenticated-command-invocation":"bun test/test-authenticated-command-invocation.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:mcp-instructions":"bun test/test-mcp-instructions.mjs","test:mcp-stdout-guard":"bun test/test-mcp-stdout-guard.mjs","test:mcp-platform-select":"bun test/test-mcp-platform-select.mjs","test:mcp-explain-scopes":"bun test/test-mcp-explain-scopes.mjs","test:mcp-oauth-reopen":"bun test/test-mcp-oauth-reopen.mjs","test:mcp-broker-oauth":"bun test/test-mcp-broker-oauth.mjs","test:mcp-broker-session":"bun test/test-mcp-broker-session.mjs","test:mcp-credentials-manage":"bun test/test-mcp-credentials-manage.mjs","test:mcp-resume-prompt":"bun test/test-mcp-resume-prompt.mjs","test:mcp-build-job":"bun test/test-mcp-build-job.mjs","test:mcp-build-tools":"bun test/test-mcp-build-tools.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:app-add-exists":"bun test/test-app-add-exists.mjs","test:app-add-getting-started":"bun test/test-app-add-getting-started.mjs","test:app-list-output-text":"bun test/test-app-list-output-text.mjs","test:app-todo":"bun test/test-app-todo.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:cli-recovery":"bun test/test-cli-recovery.mjs","test:create-supabase-client":"bun test/test-create-supabase-client.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:channel-add-exists":"bun test/test-channel-add-exists.mjs","test:wait-log":"bun test/test-wait-log.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:init-upload-recovery":"bun test/test-init-upload-error-gate.mjs && bun test/test-init-upload-monorepo-recovery.mjs","test:init-replay":"bun test/test-init-replay.mjs","test:init-telemetry":"bun test/test-init-telemetry.mjs","test:capacitor-config-target":"bun test/test-capacitor-config-target.mjs","test:capacitor-config-typescript7":"bun test/test-capacitor-config-typescript7.mjs","test:capacitor-config-native-import":"bun test/test-capacitor-config-native-import.mjs","test:cli-user-error-config":"bun test/test-cli-user-error-config.mjs","test:init-monorepo-targeting":"bun run test:capacitor-config-target && bun run test:capacitor-config-typescript7 && bun run test:capacitor-config-native-import && bun run test:cli-user-error-config && bun test/test-init-monorepo-targeting.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:auth-session":"bun test/test-auth-session.mjs","test:mcp":"node test/test-mcp.mjs","test:mcp-no-key-handshake":"node test/test-mcp-no-key-handshake.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:project-type-detection":"bun test/test-project-type-detection.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:apple-api-verify-key":"bun test/test-apple-api-verify-key.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:ios-marketing-version":"bun test/test-ios-marketing-version.mjs","test:android-version":"bun test/test-android-version.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:notify-app-ready-background && bun run test:bundle-validation && bun run test:functional && bun run test:semver && bun run test:auto-bump-version && bun run test:auto-bump-ai-diff && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:fail-on-incompatible && bun run test:native-dependencies && bun run test:package-json-guard && bun run test:credentials && bun run test:credentials-export && bun run test:ios-provisioning-map && bun run test:ios-provisioning-command && 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:cli-help && bun run test:build-cache-payload && bun run test:build-cancellation && 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:cli-headers && bun run test:min-cli-version && bun run test:authenticated-command-invocation && 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:app-set-options && bun run test:mcp-analytics && bun run test:mcp-instructions && bun run test:mcp-live-update-onboarding && bun run test:mcp-stdout-guard && bun run test:mcp-platform-select && bun run test:mcp-explain-scopes && bun run test:mcp-oauth-reopen && bun run test:mcp-broker-oauth && bun run test:mcp-broker-session && bun run test:mcp-credentials-manage && bun run test:mcp-resume-prompt && bun run test:mcp-build-job && bun run test:mcp-build-tools && bun run test:app-created-source && bun run test:app-add-exists && bun run test:app-add-getting-started && bun run test:app-list-output-text && bun run test:app-todo && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:cli-recovery && bun run test:create-supabase-client && bun run test:build-platform-selection && bun run test:builder-project-discovery && 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-monorepo-targeting && bun run test:init-app-conflict && bun run test:channel-list && bun run test:channel-add-exists && bun run test:wait-log && bun run test:init-guardrails && bun run test:init-upload-recovery && bun run test:init-replay && bun run test:init-telemetry && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:mcp-no-key-handshake && bun run test:auth-session && bun run test:version-detection && bun run test:platform-paths && bun run test:project-type-detection && 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:apple-api-verify-key && 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:cicd-failure-help && 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-upload-prompt && 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:ios-marketing-version && bun run test:android-version && bun run test:platform-flow-contract && bun run test:tail-engine-shared && bun run test:prescan && bun run test:android-reporting-api && bun run test:android-gcp && bun run test:android-app-verification && bun run test:android-rename && bun run test:appflow-auth && bun run test:appflow-api-map && bun run test:appflow-validate && bun run test:appflow-flow && bun run test:appflow-gapfill && bun run test:appflow-engine && bun run test:appflow-tail && bun run test:appflow-fetch && bun run test:appflow-sa-decode && bun run test:app-permission-helper && bun run test:2fa-compliance-network && bun run test:organization-set-api-host && bun run test:trial-warning && bun run test:plan-validation","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:builder-project-discovery":"bun test/test-builder-project-discovery.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:cicd-failure-help":"bun test/test-cicd-failure-help.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-upload-prompt":"bun test/test-support-upload-prompt.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.mjs","test:mcp-live-update-onboarding":"bun test/test-mcp-live-update-onboarding.mjs","test:app-set-options":"bun test/test-app-set-options.mjs && bun test/test-app-list-options.mjs","test:android-reporting-api":"bun test/test-android-reporting-api.mjs","test:android-gcp":"bun test/test-android-gcp.mjs","test:android-app-verification":"bun test/test-android-app-verification.mjs","test:android-rename":"bun test/test-android-rename.mjs","test:appflow-auth":"bun test/test-appflow-auth.mjs","test:appflow-api-map":"bun test/test-appflow-api-map.mjs","test:appflow-validate":"bun test/test-appflow-validate.mjs","test:appflow-flow":"bun test/test-appflow-flow.mjs","test:appflow-gapfill":"bun test/test-appflow-gapfill.mjs","test:appflow-engine":"bun test/test-appflow-engine.mjs","test:appflow-tail":"bun test/test-appflow-tail.mjs","test:appflow-fetch":"bun test/test-appflow-fetch.mjs","test:appflow-sa-decode":"bun test/test-appflow-sa-decode.mjs","test:app-permission-helper":"bun test/test-app-permission-helper.mjs","test:2fa-compliance-network":"bun test/test-2fa-compliance-network.mjs","test:organization-set-api-host":"bun test/test-organization-set-api-host.mjs","test:trial-warning":"bun test/test-trial-warning.mjs","test:plan-validation":"bun test/test-plan-validation.mjs","test:auto-bump-version":"bun test/test-auto-bump-version.mjs","test:auto-bump-ai-diff":"bun test/test-auto-bump-ai-diff.mjs","test:ios-provisioning-map":"bun test/test-ios-provisioning-map.mjs","test:ios-provisioning-command":"bun test/test-ios-provisioning-command.mjs","test:channel-list":"bun test/test-channel-list.mjs"},dependencies:{"@inkjs/ui":"^2.0.0","@manypkg/tools":"^2.1.2","@rrweb/types":"^2.1.1","@standard-schema/spec":"^1.1.0","@xmldom/xmldom":"^0.9.10","@xterm/addon-serialize":"^0.14.0","@xterm/headless":"^6.0.0","agent-cli-detector":"^0.1.6","happy-dom":"^20.11.0",ink:"^7.1.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.8","rrweb-snapshot":"^2.1.1","string-width":"^8.2.2",typescript:"6.0.3",zod:"^4.4.3"},optionalDependencies:{"@capgo/cli-helper-darwin-arm64":"^1.1.1","@capgo/cli-helper-darwin-x64":"^1.1.1","node-pty":"^1.1.0"},devDependencies:{"@antfu/eslint-config":"^9.2.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.4.2","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.7.0","@modelcontextprotocol/client":"^2.0.0-beta.5","@modelcontextprotocol/server":"^2.0.0-beta.5","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.110.8","@tanstack/intent":"^0.3.6","@types/adm-zip":"^0.5.8","@types/jsonwebtoken":"^9.0.10","@types/node":"^26.1.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.17","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native-preview":"7.0.0-dev.20260707.2","@vercel/ncc":"^0.44.1","@vue/compiler-dom":"3.5.40","@xterm/headless":"^6.0.0","adm-zip":"^0.6.0","ci-info":"^4.4.0",commander:"^15.0.0",eslint:"^10.7.0","git-format-staged":"4.0.2",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.75.0",partysocket:"^1.3.0",prettyjson:"^1.2.5",tmp:"^0.2.7","tus-js-client":"^4.3.1",ws:"^8.21.1"}}});function fRQ(A){if(A&&typeof A==="object"&&"status"in A){let Q=A.status;if(typeof Q==="number")return Q}return}function vRQ(A){let Q=[],B=new Set,$=A;if(typeof A==="string")return A;while($){if(typeof $==="string"){Q.push($);break}if(typeof $!=="object")break;if(B.has($))break;if(B.add($),$ instanceof Error){Q.push($.message),$=$.cause;continue}let J=$;if(typeof J.message==="string")Q.push(J.message);$=J.cause}return Q.join(" ")}function yRQ(A){return vRQ(A)}function mM(A){if(A&&typeof A==="object"&&"code"in A){let $=A.code;if(typeof $==="string"&&$.startsWith("commander."))return"commander"}let Q=fRQ(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=yRQ(A).toLowerCase();if(/econnrefused|econnreset|enotfound|eai_again|fetch failed|failed to fetch|connect timeout|und_err/.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 bTA(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 hRQ}from"node:async_hooks";function wp(A,Q){return vTA.run(A,()=>Promise.resolve(Q()))}function uRQ(){return vTA.getStore()}function Fk(){yTA=!0}function gTA(){return yTA}function uTA(A){hTA=A}function fTA(A){try{hTA?.(A)}catch{}}function cTA(A,Q){let B;try{B=new URL(A).pathname}catch{B=A.split("?")[0]}let $="/functions/v1/",J=B.indexOf($);if(J>=0){let K=B.slice(J+$.length),W=0,H=K.length;while(W<H&&K[W]==="/")W+=1;while(H>W&&K[H-1]==="/")H-=1;let U=K.slice(W,H);return U?`${Q} functions:${U}`:`${Q} functions`}let Y="/rest/v1/",Z=B.indexOf(Y),X=Z>=0?B.slice(Z+Y.length):B.replace(/^\//,"");if(X.startsWith("rpc/"))return`rpc:${X.slice(4).split("/")[0]}`;let G=X.split("/")[0]||B;return`${Q} ${G}`}function mRQ(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 dTA(){return async(Q,B)=>{let $=(B?.method??"GET").toUpperCase(),J=typeof Q==="string"?Q:Q instanceof URL?Q.href:Q.url,Y=uRQ(),Z=mRQ(B),X=Date.now();try{let G=await globalThis.fetch(Q,B);return fTA({url:J,method:$,status:G.status,ok:G.ok,durationMs:Date.now()-X,source:Y,apikey:Z}),G}catch(G){throw fTA({url:J,method:$,status:0,ok:!1,durationMs:Date.now()-X,source:Y,apikey:Z,error:G}),G}}}var vTA,yTA=!1,hTA,mTA=5000;var Uk=mA(()=>{vTA=new hRQ});var qQ;var D8=mA(()=>{qQ=class qQ extends Error{context;constructor(A,Q){super(A);this.name="CliUserError",this.context=Q}}});import{platform as cRQ}from"node:os";import{version as dRQ}from"node:process";function iTA(A){pTA=A}function pRQ(A){for(let Q=0;Q<A.length;Q++)if(A.charCodeAt(Q)>255)return!1;return!0}function lTA(A){if(A.toLowerCase()==="x-capgo-log-token")return"Build log token is missing. Re-run the build command or pass a valid log token.";return"Capgo API key is missing. Run `npx -y @capgo/cli@latest login` or pass `--apikey`."}function iRQ(A){if(A.toLowerCase()==="x-capgo-log-token")return"Build log token contains invalid characters (only ASCII is allowed). Re-run the build command to get a fresh token.";if(A.toLowerCase()==="authorization")return"Authorization header contains invalid characters (only ASCII is allowed). Check your Capgo API key or Supabase anon key configuration.";return"Capgo API key contains invalid characters (only ASCII is allowed). Copy the key from the Capgo dashboard."}function pJA(A,Q){if(Q===void 0||Q===null){if(lJA.has(A.toLowerCase()))throw new qQ(lTA(A));throw new qQ(`HTTP header "${A}" is missing or invalid.`)}if(typeof Q!=="string"){if(lJA.has(A.toLowerCase()))throw new qQ(lTA(A));throw new qQ(`HTTP header "${A}" is missing or invalid.`)}if(!pRQ(Q)){if(lJA.has(A.toLowerCase()))throw new qQ(iRQ(A));throw new qQ(`HTTP header "${A}" contains invalid characters (only ASCII is allowed).`)}return Q}function I8(A){let Q={capgo_api:lRQ,"x-cli-version":$6.version,"x-cli-command":pTA,"x-cli-node":dRQ,"x-cli-os":cRQ()};if(A)for(let[B,$]of Object.entries(A))Q[B]=pJA(B,$);return Q}var lRQ="2025-10-01",pTA="",lJA;var p7=mA(()=>{fZ();D8();lJA=new Set(["authorization","capgkey","x-capgo-log-token"])});function TY(A){let Q=A.length;while(Q>0&&A[Q-1]==="/")Q-=1;return A.slice(0,Q)}import{randomUUID as nTA}from"node:crypto";import{existsSync as nRQ,mkdirSync as aRQ,readFileSync as rRQ,writeFileSync as oRQ}from"node:fs";import{homedir as nJA,platform as sRQ,release as tRQ}from"node:os";import{join as aTA}from"node:path";import{arch as eRQ,cwd as rTA,env as cM,version as AEQ}from"node:process";function wW(A){return A==="1"||A?.toLowerCase()==="true"||A?.toLowerCase()==="yes"}function YEQ(){if(wW(cM.CAPGO_DISABLE_TELEMETRY)||wW(cM.CAPGO_DISABLE_POSTHOG))return;return cM.CAPGO_CLI_POSTHOG_API_KEY?.trim()||cM.POSTHOG_API_KEY?.trim()||BEQ}function ZEQ(A){let Q=TY(A);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 XEQ(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 GEQ(A){let Q=A,B=rTA(),$=nJA();if(B)Q=Q.replaceAll(B,"<cwd>");if($)Q=Q.replaceAll($,"~");return Q}function KEQ(A){let Q=A,B=rTA(),$=nJA();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-]+){1,}\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 WEQ(A,Q){let B=A?.split(`
70
+ `)},info:(A,Q)=>{f.message(A,{...Q,symbol:j0("blue",LRQ)})},success:(A,Q)=>{f.message(A,{...Q,symbol:j0("green",CRQ)})},step:(A,Q)=>{f.message(A,{...Q,symbol:j0("green",uJA)})},warn:(A,Q)=>{f.message(A,{...Q,symbol:j0("yellow",VRQ)})},warning:(A,Q)=>{f.warn(A,Q)},error:(A,Q)=>{f.message(A,{...Q,symbol:j0("red",NRQ)})}},re0={light:P6("─","-"),heavy:P6("━","="),block:P6("█","#")},PRQ=[`${j0("dim","↑/↓")} to navigate`,`${j0("dim","Enter:")} confirm`],oe0=`${j0("gray",g4)} `});var $6;var fZ=mA(()=>{$6={name:"@capgo/cli",type:"module",version:"8.56.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:"https://github.com/Cap-go/capgo.app",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:notify-app-ready-background":"bun test ./test/test-notify-app-ready-background.mjs ./test/test-background-check-shutdown.mjs","test:bundle":"bun test/test-bundle.mjs","test:bundle-validation":"bun test test/bundle/","test:prescan":"bun test test/prescan/","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:native-dependencies":"bun test/test-native-dependencies.mjs && bun test/test-get-remote-dependencies.mjs","test:package-json-guard":"bun test/test-package-json-guard.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-export":"bun test/test-credentials-export.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:cli-help":"bun test/test-cli-help.mjs","test:build-cache-payload":"bun test/test-build-cache-payload.mjs","test:build-cancellation":"bun test/test-build-cancellation.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:cli-headers":"bun test/test-cli-headers.mjs","test:min-cli-version":"bun test/test-min-cli-version.mjs","test:authenticated-command-invocation":"bun test/test-authenticated-command-invocation.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:mcp-instructions":"bun test/test-mcp-instructions.mjs","test:mcp-stdout-guard":"bun test/test-mcp-stdout-guard.mjs","test:mcp-platform-select":"bun test/test-mcp-platform-select.mjs","test:mcp-explain-scopes":"bun test/test-mcp-explain-scopes.mjs","test:mcp-oauth-reopen":"bun test/test-mcp-oauth-reopen.mjs","test:mcp-broker-oauth":"bun test/test-mcp-broker-oauth.mjs","test:mcp-broker-session":"bun test/test-mcp-broker-session.mjs","test:mcp-credentials-manage":"bun test/test-mcp-credentials-manage.mjs","test:mcp-resume-prompt":"bun test/test-mcp-resume-prompt.mjs","test:mcp-build-job":"bun test/test-mcp-build-job.mjs","test:mcp-build-tools":"bun test/test-mcp-build-tools.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:app-add-exists":"bun test/test-app-add-exists.mjs","test:app-add-getting-started":"bun test/test-app-add-getting-started.mjs","test:app-list-output-text":"bun test/test-app-list-output-text.mjs","test:app-todo":"bun test/test-app-todo.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:cli-recovery":"bun test/test-cli-recovery.mjs","test:create-supabase-client":"bun test/test-create-supabase-client.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:channel-add-exists":"bun test/test-channel-add-exists.mjs","test:wait-log":"bun test/test-wait-log.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:init-upload-recovery":"bun test/test-init-upload-error-gate.mjs && bun test/test-init-upload-monorepo-recovery.mjs","test:init-replay":"bun test/test-init-replay.mjs","test:init-telemetry":"bun test/test-init-telemetry.mjs","test:capacitor-config-target":"bun test/test-capacitor-config-target.mjs","test:capacitor-config-typescript7":"bun test/test-capacitor-config-typescript7.mjs","test:capacitor-config-native-import":"bun test/test-capacitor-config-native-import.mjs","test:cli-user-error-config":"bun test/test-cli-user-error-config.mjs","test:init-monorepo-targeting":"bun run test:capacitor-config-target && bun run test:capacitor-config-typescript7 && bun run test:capacitor-config-native-import && bun run test:cli-user-error-config && bun test/test-init-monorepo-targeting.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:auth-session":"bun test/test-auth-session.mjs","test:mcp":"node test/test-mcp.mjs","test:mcp-no-key-handshake":"node test/test-mcp-no-key-handshake.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:project-type-detection":"bun test/test-project-type-detection.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:apple-api-verify-key":"bun test/test-apple-api-verify-key.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:ios-marketing-version":"bun test/test-ios-marketing-version.mjs","test:android-version":"bun test/test-android-version.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:notify-app-ready-background && bun run test:bundle-validation && bun run test:functional && bun run test:semver && bun run test:auto-bump-version && bun run test:auto-bump-ai-diff && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:fail-on-incompatible && bun run test:native-dependencies && bun run test:package-json-guard && bun run test:credentials && bun run test:credentials-export && bun run test:ios-provisioning-map && bun run test:ios-provisioning-command && 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:cli-help && bun run test:build-cache-payload && bun run test:build-cancellation && 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:cli-headers && bun run test:min-cli-version && bun run test:authenticated-command-invocation && 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:app-set-options && bun run test:mcp-analytics && bun run test:mcp-instructions && bun run test:mcp-live-update-onboarding && bun run test:mcp-stdout-guard && bun run test:mcp-platform-select && bun run test:mcp-explain-scopes && bun run test:mcp-oauth-reopen && bun run test:mcp-broker-oauth && bun run test:mcp-broker-session && bun run test:mcp-credentials-manage && bun run test:mcp-resume-prompt && bun run test:mcp-build-job && bun run test:mcp-build-tools && bun run test:app-created-source && bun run test:app-add-exists && bun run test:app-add-getting-started && bun run test:app-list-output-text && bun run test:app-todo && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:cli-recovery && bun run test:create-supabase-client && bun run test:build-platform-selection && bun run test:builder-project-discovery && 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-monorepo-targeting && bun run test:init-app-conflict && bun run test:channel-list && bun run test:channel-add-exists && bun run test:wait-log && bun run test:init-guardrails && bun run test:init-upload-recovery && bun run test:init-replay && bun run test:init-telemetry && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:mcp-no-key-handshake && bun run test:auth-session && bun run test:version-detection && bun run test:platform-paths && bun run test:project-type-detection && 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:apple-api-verify-key && 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:cicd-failure-help && 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-upload-prompt && 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:ios-marketing-version && bun run test:android-version && bun run test:platform-flow-contract && bun run test:tail-engine-shared && bun run test:prescan && bun run test:android-reporting-api && bun run test:android-gcp && bun run test:android-app-verification && bun run test:android-rename && bun run test:appflow-auth && bun run test:appflow-api-map && bun run test:appflow-validate && bun run test:appflow-flow && bun run test:appflow-gapfill && bun run test:appflow-engine && bun run test:appflow-tail && bun run test:appflow-fetch && bun run test:appflow-sa-decode && bun run test:app-permission-helper && bun run test:2fa-compliance-network && bun run test:organization-set-api-host && bun run test:trial-warning && bun run test:plan-validation","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:builder-project-discovery":"bun test/test-builder-project-discovery.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:cicd-failure-help":"bun test/test-cicd-failure-help.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-upload-prompt":"bun test/test-support-upload-prompt.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.mjs","test:mcp-live-update-onboarding":"bun test/test-mcp-live-update-onboarding.mjs","test:app-set-options":"bun test/test-app-set-options.mjs && bun test/test-app-list-options.mjs","test:android-reporting-api":"bun test/test-android-reporting-api.mjs","test:android-gcp":"bun test/test-android-gcp.mjs","test:android-app-verification":"bun test/test-android-app-verification.mjs","test:android-rename":"bun test/test-android-rename.mjs","test:appflow-auth":"bun test/test-appflow-auth.mjs","test:appflow-api-map":"bun test/test-appflow-api-map.mjs","test:appflow-validate":"bun test/test-appflow-validate.mjs","test:appflow-flow":"bun test/test-appflow-flow.mjs","test:appflow-gapfill":"bun test/test-appflow-gapfill.mjs","test:appflow-engine":"bun test/test-appflow-engine.mjs","test:appflow-tail":"bun test/test-appflow-tail.mjs","test:appflow-fetch":"bun test/test-appflow-fetch.mjs","test:appflow-sa-decode":"bun test/test-appflow-sa-decode.mjs","test:app-permission-helper":"bun test/test-app-permission-helper.mjs","test:2fa-compliance-network":"bun test/test-2fa-compliance-network.mjs","test:organization-set-api-host":"bun test/test-organization-set-api-host.mjs","test:trial-warning":"bun test/test-trial-warning.mjs","test:plan-validation":"bun test/test-plan-validation.mjs","test:auto-bump-version":"bun test/test-auto-bump-version.mjs","test:auto-bump-ai-diff":"bun test/test-auto-bump-ai-diff.mjs","test:ios-provisioning-map":"bun test/test-ios-provisioning-map.mjs","test:ios-provisioning-command":"bun test/test-ios-provisioning-command.mjs","test:channel-list":"bun test/test-channel-list.mjs"},dependencies:{"@inkjs/ui":"^2.0.0","@manypkg/tools":"^2.1.2","@rrweb/types":"^2.1.1","@standard-schema/spec":"^1.1.0","@xmldom/xmldom":"^0.9.10","@xterm/addon-serialize":"^0.14.0","@xterm/headless":"^6.0.0","agent-cli-detector":"^0.1.6","happy-dom":"^20.11.0",ink:"^7.1.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.8","rrweb-snapshot":"^2.1.1","string-width":"^8.2.2",typescript:"6.0.3",zod:"^4.4.3"},optionalDependencies:{"@capgo/cli-helper-darwin-arm64":"^1.1.1","@capgo/cli-helper-darwin-x64":"^1.1.1","node-pty":"^1.1.0"},devDependencies:{"@antfu/eslint-config":"^9.2.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.4.2","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.7.0","@modelcontextprotocol/client":"^2.0.0-beta.5","@modelcontextprotocol/server":"^2.0.0-beta.5","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.110.8","@tanstack/intent":"^0.3.6","@types/adm-zip":"^0.5.8","@types/jsonwebtoken":"^9.0.10","@types/node":"^26.1.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.17","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native-preview":"7.0.0-dev.20260707.2","@vercel/ncc":"^0.44.1","@vue/compiler-dom":"3.5.40","@xterm/headless":"^6.0.0","adm-zip":"^0.6.0","ci-info":"^4.4.0",commander:"^15.0.0",eslint:"^10.7.0","git-format-staged":"4.0.2",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.75.0",partysocket:"^1.3.0",prettyjson:"^1.2.5",tmp:"^0.2.7","tus-js-client":"^4.3.1",ws:"^8.21.1"}}});function fRQ(A){if(A&&typeof A==="object"&&"status"in A){let Q=A.status;if(typeof Q==="number")return Q}return}function vRQ(A){let Q=[],B=new Set,$=A;if(typeof A==="string")return A;while($){if(typeof $==="string"){Q.push($);break}if(typeof $!=="object")break;if(B.has($))break;if(B.add($),$ instanceof Error){Q.push($.message),$=$.cause;continue}let J=$;if(typeof J.message==="string")Q.push(J.message);$=J.cause}return Q.join(" ")}function yRQ(A){return vRQ(A)}function mM(A){if(A&&typeof A==="object"&&"code"in A){let $=A.code;if(typeof $==="string"&&$.startsWith("commander."))return"commander"}let Q=fRQ(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=yRQ(A).toLowerCase();if(/econnrefused|econnreset|enotfound|eai_again|fetch failed|failed to fetch|connect timeout|und_err/.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 bTA(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 hRQ}from"node:async_hooks";function wp(A,Q){return vTA.run(A,()=>Promise.resolve(Q()))}function uRQ(){return vTA.getStore()}function Fk(){yTA=!0}function gTA(){return yTA}function uTA(A){hTA=A}function fTA(A){try{hTA?.(A)}catch{}}function cTA(A,Q){let B;try{B=new URL(A).pathname}catch{B=A.split("?")[0]}let $="/functions/v1/",J=B.indexOf($);if(J>=0){let K=B.slice(J+$.length),W=0,H=K.length;while(W<H&&K[W]==="/")W+=1;while(H>W&&K[H-1]==="/")H-=1;let U=K.slice(W,H);return U?`${Q} functions:${U}`:`${Q} functions`}let Y="/rest/v1/",Z=B.indexOf(Y),X=Z>=0?B.slice(Z+Y.length):B.replace(/^\//,"");if(X.startsWith("rpc/"))return`rpc:${X.slice(4).split("/")[0]}`;let G=X.split("/")[0]||B;return`${Q} ${G}`}function mRQ(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 dTA(){return async(Q,B)=>{let $=(B?.method??"GET").toUpperCase(),J=typeof Q==="string"?Q:Q instanceof URL?Q.href:Q.url,Y=uRQ(),Z=mRQ(B),X=Date.now();try{let G=await globalThis.fetch(Q,B);return fTA({url:J,method:$,status:G.status,ok:G.ok,durationMs:Date.now()-X,source:Y,apikey:Z}),G}catch(G){throw fTA({url:J,method:$,status:0,ok:!1,durationMs:Date.now()-X,source:Y,apikey:Z,error:G}),G}}}var vTA,yTA=!1,hTA,mTA=5000;var Uk=mA(()=>{vTA=new hRQ});var qQ;var D8=mA(()=>{qQ=class qQ extends Error{context;constructor(A,Q){super(A);this.name="CliUserError",this.context=Q}}});import{platform as cRQ}from"node:os";import{version as dRQ}from"node:process";function iTA(A){pTA=A}function pRQ(A){for(let Q=0;Q<A.length;Q++)if(A.charCodeAt(Q)>255)return!1;return!0}function lTA(A){if(A.toLowerCase()==="x-capgo-log-token")return"Build log token is missing. Re-run the build command or pass a valid log token.";return"Capgo API key is missing. Run `npx -y @capgo/cli@latest login` or pass `--apikey`."}function iRQ(A){if(A.toLowerCase()==="x-capgo-log-token")return"Build log token contains invalid characters (only ASCII is allowed). Re-run the build command to get a fresh token.";if(A.toLowerCase()==="authorization")return"Authorization header contains invalid characters (only ASCII is allowed). Check your Capgo API key or Supabase anon key configuration.";return"Capgo API key contains invalid characters (only ASCII is allowed). Copy the key from the Capgo dashboard."}function pJA(A,Q){if(Q===void 0||Q===null){if(lJA.has(A.toLowerCase()))throw new qQ(lTA(A));throw new qQ(`HTTP header "${A}" is missing or invalid.`)}if(typeof Q!=="string"){if(lJA.has(A.toLowerCase()))throw new qQ(lTA(A));throw new qQ(`HTTP header "${A}" is missing or invalid.`)}if(!pRQ(Q)){if(lJA.has(A.toLowerCase()))throw new qQ(iRQ(A));throw new qQ(`HTTP header "${A}" contains invalid characters (only ASCII is allowed).`)}return Q}function I8(A){let Q={capgo_api:lRQ,"x-cli-version":$6.version,"x-cli-command":pTA,"x-cli-node":dRQ,"x-cli-os":cRQ()};if(A)for(let[B,$]of Object.entries(A))Q[B]=pJA(B,$);return Q}var lRQ="2025-10-01",pTA="",lJA;var p7=mA(()=>{fZ();D8();lJA=new Set(["authorization","capgkey","x-capgo-log-token"])});function TY(A){let Q=A.length;while(Q>0&&A[Q-1]==="/")Q-=1;return A.slice(0,Q)}import{randomUUID as nTA}from"node:crypto";import{existsSync as nRQ,mkdirSync as aRQ,readFileSync as rRQ,writeFileSync as oRQ}from"node:fs";import{homedir as nJA,platform as sRQ,release as tRQ}from"node:os";import{join as aTA}from"node:path";import{arch as eRQ,cwd as rTA,env as cM,version as AEQ}from"node:process";function wW(A){return A==="1"||A?.toLowerCase()==="true"||A?.toLowerCase()==="yes"}function YEQ(){if(wW(cM.CAPGO_DISABLE_TELEMETRY)||wW(cM.CAPGO_DISABLE_POSTHOG))return;return cM.CAPGO_CLI_POSTHOG_API_KEY?.trim()||cM.POSTHOG_API_KEY?.trim()||BEQ}function ZEQ(A){let Q=TY(A);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 XEQ(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 GEQ(A){let Q=A,B=rTA(),$=nJA();if(B)Q=Q.replaceAll(B,"<cwd>");if($)Q=Q.replaceAll($,"~");return Q}function KEQ(A){let Q=A,B=rTA(),$=nJA();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-]+){1,}\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 WEQ(A,Q){let B=A?.split(`
71
71
  `).slice(1).map(($)=>{let J=$.trim(),Y=J.startsWith("at ")?J.slice(3):J,Z=Q,X=Y,G=Y.lastIndexOf(" (");if(G!==-1&&Y.endsWith(")"))Z=Y.slice(0,G).trim()||Q,X=Y.slice(G+2,-1);else{let H=Y.lastIndexOf(" "),U=H===-1?"":Y.slice(H+1);if(/:\d+:\d+$/.test(U))Z=Y.slice(0,H).trim()||Q,X=U}let K=X.lastIndexOf(":"),W=K===-1?-1:X.lastIndexOf(":",K-1);if(K===-1||W===-1)return{function:Q,platform:"custom",lang:"javascript"};return{function:Z,filename:GEQ(X.slice(0,W)),lineno:Number.parseInt(X.slice(W+1,K),10),colno:Number.parseInt(X.slice(K+1),10),platform:"custom",lang:"javascript"}}).filter(Boolean);return B&&B.length>0?B:[{function:Q,platform:"custom",lang:"javascript"}]}function HEQ(A){if(!A||typeof A!=="object"||!("code"in A))return;let{code:Q}=A;return typeof Q==="string"?Q:void 0}function UEQ(A){if(!A||typeof A!=="object")return;let Q=A;if(typeof Q.status==="number")return Q.status;if(typeof Q.statusCode==="number")return Q.statusCode;let B=Q.context&&typeof Q.context==="object"?Q.context.status:void 0;return typeof B==="number"?B:void 0}function zEQ(A){let Q=(A instanceof Error?A.message:typeof A==="string"?A:"").toLowerCase();if(FEQ.some((B)=>Q.includes(B)))return!0;return UEQ(A)===401}function zk(A){if(A instanceof qQ){if(JEQ.has(A.message))return!0;return!1}if(zEQ(A))return!1;return!HEQ(A)?.startsWith("commander.")}function Pp(A){let Q=[],B=A;while(B?.parent){let $=B.name();if($)Q.push($);B=B.parent}return Q.reverse().join(" ")||"unknown"}function qEQ(A=aTA(nJA(),".capgo-credentials")){if(iJA)return iJA;let Q=aTA(A,"install-id"),B;try{let $=nRQ(Q)?rRQ(Q,"utf8").trim():"";if($)B=$;else B=nTA(),aRQ(A,{recursive:!0}),oRQ(Q,B,{encoding:"utf8",mode:384})}catch{B=nTA()}return iJA=B,B}async function qk(A){let Q=YEQ();if(!Q)return!1;let B=cM.CAPGO_CLI_POSTHOG_API_HOST?.trim()||cM.POSTHOG_API_HOST?.trim()||QEQ,$;try{$=ZEQ(B)}catch{return!1}let J=XEQ(A.error),Y=KEQ(J.message),Z=qEQ(),X=WEQ(J.stack,A.functionName),G=[A.functionName,A.kind,J.name||"Error",String(A.status??1)].join(":"),K={token:Q,event:"$exception",properties:{distinct_id:Z,$exception_list:[{type:J.name||"Error",value:Y,mechanism:{handled:!0,synthetic:!1},stacktrace:{type:"raw",frames:X}}],$exception_fingerprint:G,architecture:eRQ,cli_version:$6.version,error_kind:A.kind,function_name:A.functionName,is_ci:Boolean(cM.CI),node_version:AEQ,os_platform:sRQ(),os_release:tRQ(),runtime:"cli",status:A.status},timestamp:new Date().toISOString()};try{let W=new AbortController,H=setTimeout(()=>W.abort(),$EQ);try{return(await fetch($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(K),signal:W.signal})).ok}finally{clearTimeout(H)}}catch{return!1}}var QEQ="https://eu.i.posthog.com/i/v0/e/",BEQ="phc_NXDyDajQaTQVwb25DEhIVZfxVUn4R0Y348Z7vWYHZUi",$EQ=1500,aJA="iOS sync validation failed. Delete your iOS folder, then rerun the add and sync commands above and retry.",JEQ,FEQ,iJA;var VR=mA(()=>{fZ();D8();JEQ=new Set([aJA]);FEQ=["invalid_apikey","invalid apikey","no_key_provided","no key provided","invalid api key or insufficient permissions","does not exist, run first"]});import{existsSync as vZ}from"fs";var $H=(A=".",Q="unknown")=>{let B=`${A}/bun.lockb`,$=`${A}/bun.lock`,J=`${A}/pnpm-lock.yaml`,Y=`${A}/shrinkwrap.yaml`,Z=`${A}/yarn.lock`,X=`${A}/package-lock.json`,G=`${A}/npm-shrinkwrap.json`;if(vZ(B)||vZ($))return"bun";if(vZ(J)||vZ(Y))return"pnpm";if(vZ(Z))return"yarn";if(vZ(X)||vZ(G))return"npm";return Q},hq=(A=$H(),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"}},_p=(A=".",Q="npx")=>{let B=`${A}/bun.lockb`,$=`${A}/bun.lock`,J=`${A}/pnpm-lock.yaml`,Y=`${A}/shrinkwrap.yaml`,Z=`${A}/yarn.lock`,X=`${A}/package-lock.json`,G=`${A}/npm-shrinkwrap.json`;if(vZ(B)||vZ($))return"bunx";if(vZ(J)||vZ(Y))return"pnpm exec";if(vZ(Z))return"yarn dlx";if(vZ(X)||vZ(G))return"npx";return Q};var Dk=()=>{};function Tp(A,Q){if(isNaN(A)||isNaN(Q))throw Error("Cannot compare against non-numbers");return A===Q?0:A<Q?-1:1}function tTA(A=[],Q=[]){if(A.length&&!Q.length)return-1;if(!A.length&&Q.length)return 1;return 0}function Sp(A=[],Q=[]){let B=Math.max(A.length,Q.length);for(let $=0;$<B;$++){let J=A[$],Y=Q[$];if(J===void 0&&Y===void 0)return 0;if(Y===void 0)return 1;if(J===void 0)return-1;if(typeof J==="string"&&typeof Y==="number")return 1;if(typeof J==="number"&&typeof Y==="string")return-1;if(J<Y)return-1;if(J>Y)return 1}return 0}function oJA(A){return typeof A==="number"&&!Number.isNaN(A)&&(!Number.isFinite(A)||0<=A&&A<=Number.MAX_SAFE_INTEGER)}function yZ(A){return A.split(".").filter(Boolean).map((Q)=>{if(MEQ.test(Q)){let B=Number(Q);if(oJA(B))return B}return Q})}function JH(A){return A.split(".").filter(Boolean)}function bp(A,Q){let B=Number(A);if(!oJA(B))throw TypeError(Q);return B}function y2(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 NR="0|[1-9]\\d*",DEQ="\\d*[a-zA-Z-][a-zA-Z0-9-]*",IEQ,oTA,eTA,sTA="[0-9A-Za-z-]+",ASA,QSA,BSA,$SA="(?:<|>)?=?",OEQ="x|X|\\*",rJA,kp,JSA,YSA,sJA=256,MEQ;var hX=mA(()=>{IEQ=`(?<major>${NR})\\.(?<minor>${NR})\\.(?<patch>${NR})`,oTA=`(?:${NR}|${DEQ})`,eTA=`(?:-(?<prerelease>${oTA}(?:\\.${oTA})*))`,ASA=`(?:\\+(?<buildmetadata>${sTA}(?:\\.${sTA})*))`,QSA=`v?${IEQ}${eTA}?${ASA}?`,BSA=new RegExp(`^${QSA}$`),rJA=`${NR}|${OEQ}`,kp=`[v=\\s]*(?<major>${rJA})(?:\\.(?<minor>${rJA})(?:\\.(?<patch>${rJA})${eTA}?${ASA}?)?)?`,JSA=new RegExp(`^(?<operator>~>?|\\^|${$SA})\\s*${kp}$`),YSA=new RegExp(`^(?<operator>${$SA})\\s*(${QSA})$|^$`);MEQ=new RegExp(`^${NR}$`)});function SY(A,Q){if(A===Q)return 0;return Tp(A.major,Q.major)||Tp(A.minor,Q.minor)||Tp(A.patch,Q.patch)||tTA(A.prerelease,Q.prerelease)||Sp(A.prerelease,Q.prerelease)}var lG=mA(()=>{hX()});function ZSA(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(Sp(A.prerelease,Q.prerelease)!==0)return"prerelease"}var XSA=mA(()=>{hX()});function tJA(A){return A.toFixed(0)}function X7(A){let Q=tJA(A.major),B=tJA(A.minor),$=tJA(A.patch),J=A.prerelease?.join(".")??"",Y=A.build?.join(".")??"";return[[`${Q}.${B}.${$}`,J].filter((G)=>G).join("-"),Y].filter((G)=>G).join("+")}function LEQ(A,Q){if(y2(Q))return!0;let B=SY(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 xp(A,Q){for(let B of Q)if(!LEQ(A,B))return!1;if(!A.prerelease?.length)return!0;for(let B of Q){if(y2(B))continue;if(!B.prerelease?.length)continue;let{major:$,minor:J,patch:Y}=B;if(A.major===$&&A.minor===J&&A.patch===Y)return!0}return!1}var fp=mA(()=>{hX();lG()});function Ik(A,Q){return Q.some((B)=>xp(A,B))}var Ok=mA(()=>{fp()});function CEQ(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 Mk(A=[],Q){let B=CEQ(A);if(!Q)return B;let $=yZ(Q);if($.every((J)=>typeof J==="string")){if($.every((J,Y)=>J===B[Y])&&typeof B[$.length]==="number")return B;$=[...$,0]}return $}function uq(A,Q,B={}){let $=B.build!==void 0?JH(B.build):A.build??[];switch(Q){case"premajor":return{major:A.major+1,minor:0,patch:0,prerelease:Mk(A.prerelease,B.prerelease),build:$};case"preminor":return{major:A.major,minor:A.minor+1,patch:0,prerelease:Mk(A.prerelease,B.prerelease),build:$};case"prepatch":return{major:A.major,minor:A.minor,patch:A.patch+1,prerelease:Mk(A.prerelease,B.prerelease),build:$};case"prerelease":{let Y=(A.prerelease??[]).length===0?A.patch+1:A.patch;return{major:A.major,minor:A.minor,patch:Y,prerelease:Mk(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 Y=(A.prerelease??[]).length===0||A.patch!==0?A.minor+1:A.minor;return{major:A.major,minor:Y,patch:0,prerelease:[],build:$}}case"patch":{let Y=(A.prerelease??[]).length===0?A.patch+1:A.patch;return{major:A.major,minor:A.minor,patch:Y,prerelease:[],build:$}}case"pre":return{major:A.major,minor:A.minor,patch:A.patch,prerelease:Mk(A.prerelease,B.prerelease),build:$};default:throw TypeError(`Cannot increment version: invalid argument ${Q}`)}}var GSA=mA(()=>{hX()});var vp,RR;var Lk=mA(()=>{vp={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},RR={operator:void 0,...vp}});var eJA=mA(()=>{Lk();hX()});function A5A(A,Q){return SY(A,Q)>0}var Q5A=mA(()=>{lG()});var KSA=mA(()=>{Ok();Q5A()});function i7(A,Q){return SY(A,Q)<0}var B5A=mA(()=>{lG()});var WSA=mA(()=>{Ok();B5A()});function VEQ(A){let B=A.match(YSA)?.groups;if(!B)return null;let{operator:$}=B;return{operator:$||void 0,...vp}}function o6(A){return!A||A.toLowerCase()==="x"||A==="*"}function NEQ(A){if(o6(A.major))return;if(o6(A.minor))return{operator:">=",major:+A.major,minor:0,patch:0,prerelease:[],build:[]};if(o6(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?yZ(A.prerelease):[],build:[]}}function REQ(A){if(o6(A.major))return;if(o6(A.minor))return{operator:"<",major:+A.major+1,minor:0,patch:0,prerelease:[],build:[]};if(o6(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:yZ(A.prerelease),build:[]};return{operator:"<=",major:+A.major,minor:+A.minor,patch:+A.patch,prerelease:[],build:[]}}function EEQ(A){let Q=A.match(new RegExp(`^${kp}`)),B=Q?.groups;if(!B)return null;let $=Q[0].length,J=A.slice($).match(/^\s+-\s+/);if(!J)return null;let Y=J[0].length,X=A.slice($+Y).match(new RegExp(`^${kp}\\s*$`))?.groups,G=NEQ(B),K=REQ(X);return[G,K].filter(Boolean)}function jEQ(A){let Q=o6(A.major),B=o6(A.minor),$=o6(A.patch),J=+A.major,Y=+A.minor,Z=+A.patch;if(Q)return[RR];if(B)return[{operator:">=",major:J,minor:0,patch:0},{operator:"<",major:J+1,minor:0,patch:0}];if($){if(J===0)return[{operator:">=",major:J,minor:Y,patch:0},{operator:"<",major:J,minor:Y+1,patch:0}];return[{operator:">=",major:J,minor:Y,patch:0},{operator:"<",major:J+1,minor:0,patch:0}]}let X=yZ(A.prerelease??"");if(J===0){if(Y===0)return[{operator:">=",major:J,minor:Y,patch:Z,prerelease:X},{operator:"<",major:J,minor:Y,patch:Z+1}];return[{operator:">=",major:J,minor:Y,patch:Z,prerelease:X},{operator:"<",major:J,minor:Y+1,patch:0}]}return[{operator:">=",major:J,minor:Y,patch:Z,prerelease:X},{operator:"<",major:J+1,minor:0,patch:0}]}function wEQ(A){let Q=o6(A.major),B=o6(A.minor),$=o6(A.patch),J=+A.major,Y=+A.minor,Z=+A.patch;if(Q)return[RR];if(B)return[{operator:">=",major:J,minor:0,patch:0},{operator:"<",major:J+1,minor:0,patch:0}];if($)return[{operator:">=",major:J,minor:Y,patch:0},{operator:"<",major:J,minor:Y+1,patch:0}];let X=yZ(A.prerelease??"");return[{operator:">=",major:J,minor:Y,patch:Z,prerelease:X},{operator:"<",major:J,minor:Y+1,patch:0}]}function PEQ(A){let Q=o6(A.major),B=o6(A.minor),$=o6(A.patch),J=+A.major,Y=+A.minor,Z=+A.patch;if(Q)return[{operator:"<",major:0,minor:0,patch:0}];if(B){if($)return[{operator:"<",major:J,minor:0,patch:0}];return[{operator:"<",major:J,minor:0,patch:0}]}if($)return[{operator:"<",major:J,minor:Y,patch:0}];let X=yZ(A.prerelease??""),G=JH(A.build??"");return[{operator:"<",major:J,minor:Y,patch:Z,prerelease:X,build:G}]}function _EQ(A){let Q=o6(A.minor),B=o6(A.patch),$=+A.major,J=+A.minor,Y=+A.patch;if(Q)return[{operator:"<",major:$+1,minor:0,patch:0}];if(B)return[{operator:"<",major:$,minor:J+1,patch:0}];let Z=yZ(A.prerelease??""),X=JH(A.build??"");return[{operator:"<=",major:$,minor:J,patch:Y,prerelease:Z,build:X}]}function TEQ(A){let Q=o6(A.major),B=o6(A.minor),$=o6(A.patch),J=+A.major,Y=+A.minor,Z=+A.patch;if(Q)return[{operator:"<",major:0,minor:0,patch:0}];if(B)return[{operator:">=",major:J+1,minor:0,patch:0}];if($)return[{operator:">=",major:J,minor:Y+1,patch:0}];let X=yZ(A.prerelease??""),G=JH(A.build??"");return[{operator:">",major:J,minor:Y,patch:Z,prerelease:X,build:G}]}function SEQ(A){let Q=o6(A.major),B=o6(A.minor),$=o6(A.patch),J=+A.major,Y=+A.minor,Z=+A.patch;if(Q)return[RR];if(B)return[{operator:">=",major:J,minor:0,patch:0}];if($)return[{operator:">=",major:J,minor:Y,patch:0}];let X=yZ(A.prerelease??""),G=JH(A.build??"");return[{operator:">=",major:J,minor:Y,patch:Z,prerelease:X,build:G}]}function kEQ(A){let Q=o6(A.major),B=o6(A.minor),$=o6(A.patch),J=+A.major,Y=+A.minor,Z=+A.patch;if(Q)return[RR];if(B)return[{operator:">=",major:J,minor:0,patch:0},{operator:"<",major:J+1,minor:0,patch:0}];if($)return[{operator:">=",major:J,minor:Y,patch:0},{operator:"<",major:J,minor:Y+1,patch:0}];let X=yZ(A.prerelease??""),G=JH(A.build??"");return[{operator:A.operator==="="?"=":void 0,major:J,minor:Y,patch:Z,prerelease:X,build:G}]}function bEQ(A){let Q=A.match(JSA)?.groups;if(!Q)return VEQ(A);switch(Q.operator){case"^":return jEQ(Q);case"~":case"~>":return wEQ(Q);case"<":return PEQ(Q);case"<=":return _EQ(Q);case">":return TEQ(Q);case">=":return SEQ(Q);default:return kEQ(Q)}}function xEQ(A){return A.split(/\s+/).flatMap(bEQ)}function yp(A){let Q=A.replaceAll(/(?<=[<>=~^])(\s+)/g,"").split(/\s*\|\|\s*/).map((B)=>EEQ(B)||xEQ(B));if(Q.some((B)=>B.includes(null)))throw TypeError(`Cannot parse version range: range "${A}" is invalid`);return Q}var $5A=mA(()=>{hX();Lk()});function B1(A){if(typeof A!=="string")throw TypeError(`Cannot parse version as version must be a string: received ${typeof A}`);if(A.length>sJA)throw TypeError(`Cannot parse version as version length is too long: length is ${A.length}, max length is ${sJA}`);A=A.trim();let Q=A.match(BSA)?.groups;if(!Q)throw TypeError(`Cannot parse version: ${A}`);let B=bp(Q.major,`Cannot parse version ${A}: invalid major version`),$=bp(Q.minor,`Cannot parse version ${A}: invalid minor version`),J=bp(Q.patch,`Cannot parse version ${A}: invalid patch version`),Y=Q.prerelease?yZ(Q.prerelease):[],Z=Q.buildmetadata?JH(Q.buildmetadata):[];return{major:B,minor:$,patch:J,prerelease:Y,build:Z}}var gp=mA(()=>{hX();hX()});function HSA(A,Q){let B=A.operator,$=Q.operator;if(B===void 0){if(y2(A))return!0;return Ik(A,[[Q]])}if($===void 0){if(y2(Q))return!0;return Ik(Q,[[A]])}let J=SY(A,Q);return(B===">="||B===">")&&($===">="||$===">")||(B==="<="||B==="<")&&($==="<="||$==="<")||J===0&&((B===">="||B==="<=")&&($===">="||$==="<="))||J===-1&&(B===">="||B===">")&&($==="<="||$==="<")||J===1&&(B==="<="||B==="<")&&($===">="||$===">")}function fEQ(A){return A.every((Q)=>{return Q.some((B)=>vEQ(B))})}function vEQ(A){for(let Q=0;Q<A.length-1;Q++){let B=A[Q];for(let $ of A.slice(Q+1))if(!HSA(B,$))return!1}return!0}function FSA(A,Q){return fEQ([A,Q])&&A.some((B)=>{return Q.some(($)=>{return B.every((J)=>{return $.every((Y)=>HSA(J,Y))})})})}var USA=mA(()=>{hX();lG();Ok()});var zSA=mA(()=>{$5A()});var qSA=mA(()=>{Lk();Lk();eJA()});function mq(A){try{return B1(A),!0}catch{return!1}}var DSA=mA(()=>{gp()});var ISA=mA(()=>{gp()});var OSA=mA(()=>{hX()});var MSA=mA(()=>{lG()});var LSA=mA(()=>{lG()});var CSA=mA(()=>{fp();hX();lG()});function J5A(A,Q){return SY(A,Q)>=0}var VSA=mA(()=>{lG()});var NSA=mA(()=>{fp();hX();lG()});var RSA=mA(()=>{lG()});var pG=mA(()=>{lG();XSA();Ok();GSA();eJA();KSA();WSA();$5A();gp();USA();zSA();qSA();DSA();ISA();OSA();MSA();LSA();Q5A();CSA();VSA();B5A();NSA();RSA()});var gZ=$A((v0B,mp)=>{var ESA,jSA,wSA,PSA,_SA,TSA,SSA,kSA,bSA,xSA,fSA,vSA,ySA,hp,Y5A,gSA,hSA,uSA,ER,mSA,cSA,dSA,lSA,pSA,iSA,nSA,aSA,rSA,up,oSA,sSA,tSA;(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 mp==="object"&&typeof v0B==="object")A(B(Q,B(v0B)));else A(B(Q));function B($,J){if($!==Q)if(typeof Object.create==="function")Object.defineProperty($,"__esModule",{value:!0});else $.__esModule=!0;return function(Y,Z){return $[Y]=J?J(Y,Z):Z}}})(function(A){var Q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Y,Z){Y.__proto__=Z}||function(Y,Z){for(var X in Z)if(Object.prototype.hasOwnProperty.call(Z,X))Y[X]=Z[X]};ESA=function(Y,Z){if(typeof Z!=="function"&&Z!==null)throw TypeError("Class extends value "+String(Z)+" is not a constructor or null");Q(Y,Z);function X(){this.constructor=Y}Y.prototype=Z===null?Object.create(Z):(X.prototype=Z.prototype,new X)},jSA=Object.assign||function(Y){for(var Z,X=1,G=arguments.length;X<G;X++){Z=arguments[X];for(var K in Z)if(Object.prototype.hasOwnProperty.call(Z,K))Y[K]=Z[K]}return Y},wSA=function(Y,Z){var X={};for(var G in Y)if(Object.prototype.hasOwnProperty.call(Y,G)&&Z.indexOf(G)<0)X[G]=Y[G];if(Y!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var K=0,G=Object.getOwnPropertySymbols(Y);K<G.length;K++)if(Z.indexOf(G[K])<0&&Object.prototype.propertyIsEnumerable.call(Y,G[K]))X[G[K]]=Y[G[K]]}return X},PSA=function(Y,Z,X,G){var K=arguments.length,W=K<3?Z:G===null?G=Object.getOwnPropertyDescriptor(Z,X):G,H;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")W=Reflect.decorate(Y,Z,X,G);else for(var U=Y.length-1;U>=0;U--)if(H=Y[U])W=(K<3?H(W):K>3?H(Z,X,W):H(Z,X))||W;return K>3&&W&&Object.defineProperty(Z,X,W),W},_SA=function(Y,Z){return function(X,G){Z(X,G,Y)}},TSA=function(Y,Z,X,G,K,W){function H(E){if(E!==void 0&&typeof E!=="function")throw TypeError("Function expected");return E}var U=G.kind,q=U==="getter"?"get":U==="setter"?"set":"value",D=!Z&&Y?G.static?Y:Y.prototype:null,I=Z||(D?Object.getOwnPropertyDescriptor(D,G.name):{}),O,V=!1;for(var N=X.length-1;N>=0;N--){var L={};for(var C in G)L[C]=C==="access"?{}:G[C];for(var C in G.access)L.access[C]=G.access[C];L.addInitializer=function(E){if(V)throw TypeError("Cannot add initializers after decoration has completed");W.push(H(E||null))};var R=(0,X[N])(U==="accessor"?{get:I.get,set:I.set}:I[q],L);if(U==="accessor"){if(R===void 0)continue;if(R===null||typeof R!=="object")throw TypeError("Object expected");if(O=H(R.get))I.get=O;if(O=H(R.set))I.set=O;if(O=H(R.init))K.unshift(O)}else if(O=H(R))if(U==="field")K.unshift(O);else I[q]=O}if(D)Object.defineProperty(D,G.name,I);V=!0},SSA=function(Y,Z,X){var G=arguments.length>2;for(var K=0;K<Z.length;K++)X=G?Z[K].call(Y,X):Z[K].call(Y);return G?X:void 0},kSA=function(Y){return typeof Y==="symbol"?Y:"".concat(Y)},bSA=function(Y,Z,X){if(typeof Z==="symbol")Z=Z.description?"[".concat(Z.description,"]"):"";return Object.defineProperty(Y,"name",{configurable:!0,value:X?"".concat(X," ",Z):Z})},xSA=function(Y,Z){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Y,Z)},fSA=function(Y,Z,X,G){function K(W){return W instanceof X?W:new X(function(H){H(W)})}return new(X||(X=Promise))(function(W,H){function U(I){try{D(G.next(I))}catch(O){H(O)}}function q(I){try{D(G.throw(I))}catch(O){H(O)}}function D(I){I.done?W(I.value):K(I.value).then(U,q)}D((G=G.apply(Y,Z||[])).next())})},vSA=function(Y,Z){var X={label:0,sent:function(){if(W[0]&1)throw W[1];return W[1]},trys:[],ops:[]},G,K,W,H=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return H.next=U(0),H.throw=U(1),H.return=U(2),typeof Symbol==="function"&&(H[Symbol.iterator]=function(){return this}),H;function U(D){return function(I){return q([D,I])}}function q(D){if(G)throw TypeError("Generator is already executing.");while(H&&(H=0,D[0]&&(X=0)),X)try{if(G=1,K&&(W=D[0]&2?K.return:D[0]?K.throw||((W=K.return)&&W.call(K),0):K.next)&&!(W=W.call(K,D[1])).done)return W;if(K=0,W)D=[D[0]&2,W.value];switch(D[0]){case 0:case 1:W=D;break;case 4:return X.label++,{value:D[1],done:!1};case 5:X.label++,K=D[1],D=[0];continue;case 7:D=X.ops.pop(),X.trys.pop();continue;default:if((W=X.trys,!(W=W.length>0&&W[W.length-1]))&&(D[0]===6||D[0]===2)){X=0;continue}if(D[0]===3&&(!W||D[1]>W[0]&&D[1]<W[3])){X.label=D[1];break}if(D[0]===6&&X.label<W[1]){X.label=W[1],W=D;break}if(W&&X.label<W[2]){X.label=W[2],X.ops.push(D);break}if(W[2])X.ops.pop();X.trys.pop();continue}D=Z.call(Y,X)}catch(I){D=[6,I],K=0}finally{G=W=0}if(D[0]&5)throw D[1];return{value:D[0]?D[1]:void 0,done:!0}}},ySA=function(Y,Z){for(var X in Y)if(X!=="default"&&!Object.prototype.hasOwnProperty.call(Z,X))up(Z,Y,X)},up=Object.create?function(Y,Z,X,G){if(G===void 0)G=X;var K=Object.getOwnPropertyDescriptor(Z,X);if(!K||("get"in K?!Z.__esModule:K.writable||K.configurable))K={enumerable:!0,get:function(){return Z[X]}};Object.defineProperty(Y,G,K)}:function(Y,Z,X,G){if(G===void 0)G=X;Y[G]=Z[X]},hp=function(Y){var Z=typeof Symbol==="function"&&Symbol.iterator,X=Z&&Y[Z],G=0;if(X)return X.call(Y);if(Y&&typeof Y.length==="number")return{next:function(){if(Y&&G>=Y.length)Y=void 0;return{value:Y&&Y[G++],done:!Y}}};throw TypeError(Z?"Object is not iterable.":"Symbol.iterator is not defined.")},Y5A=function(Y,Z){var X=typeof Symbol==="function"&&Y[Symbol.iterator];if(!X)return Y;var G=X.call(Y),K,W=[],H;try{while((Z===void 0||Z-- >0)&&!(K=G.next()).done)W.push(K.value)}catch(U){H={error:U}}finally{try{if(K&&!K.done&&(X=G.return))X.call(G)}finally{if(H)throw H.error}}return W},gSA=function(){for(var Y=[],Z=0;Z<arguments.length;Z++)Y=Y.concat(Y5A(arguments[Z]));return Y},hSA=function(){for(var Y=0,Z=0,X=arguments.length;Z<X;Z++)Y+=arguments[Z].length;for(var G=Array(Y),K=0,Z=0;Z<X;Z++)for(var W=arguments[Z],H=0,U=W.length;H<U;H++,K++)G[K]=W[H];return G},uSA=function(Y,Z,X){if(X||arguments.length===2){for(var G=0,K=Z.length,W;G<K;G++)if(W||!(G in Z)){if(!W)W=Array.prototype.slice.call(Z,0,G);W[G]=Z[G]}}return Y.concat(W||Array.prototype.slice.call(Z))},ER=function(Y){return this instanceof ER?(this.v=Y,this):new ER(Y)},mSA=function(Y,Z,X){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var G=X.apply(Y,Z||[]),K,W=[];return K=Object.create((typeof AsyncIterator==="function"?AsyncIterator:Object).prototype),U("next"),U("throw"),U("return",H),K[Symbol.asyncIterator]=function(){return this},K;function H(N){return function(L){return Promise.resolve(L).then(N,O)}}function U(N,L){if(G[N]){if(K[N]=function(C){return new Promise(function(R,E){W.push([N,C,R,E])>1||q(N,C)})},L)K[N]=L(K[N])}}function q(N,L){try{D(G[N](L))}catch(C){V(W[0][3],C)}}function D(N){N.value instanceof ER?Promise.resolve(N.value.v).then(I,O):V(W[0][2],N)}function I(N){q("next",N)}function O(N){q("throw",N)}function V(N,L){if(N(L),W.shift(),W.length)q(W[0][0],W[0][1])}},cSA=function(Y){var Z,X;return Z={},G("next"),G("throw",function(K){throw K}),G("return"),Z[Symbol.iterator]=function(){return this},Z;function G(K,W){Z[K]=Y[K]?function(H){return(X=!X)?{value:ER(Y[K](H)),done:!1}:W?W(H):H}:W}},dSA=function(Y){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var Z=Y[Symbol.asyncIterator],X;return Z?Z.call(Y):(Y=typeof hp==="function"?hp(Y):Y[Symbol.iterator](),X={},G("next"),G("throw"),G("return"),X[Symbol.asyncIterator]=function(){return this},X);function G(W){X[W]=Y[W]&&function(H){return new Promise(function(U,q){H=Y[W](H),K(U,q,H.done,H.value)})}}function K(W,H,U,q){Promise.resolve(q).then(function(D){W({value:D,done:U})},H)}},lSA=function(Y,Z){if(Object.defineProperty)Object.defineProperty(Y,"raw",{value:Z});else Y.raw=Z;return Y};var B=Object.create?function(Y,Z){Object.defineProperty(Y,"default",{enumerable:!0,value:Z})}:function(Y,Z){Y.default=Z},$=function(Y){return $=Object.getOwnPropertyNames||function(Z){var X=[];for(var G in Z)if(Object.prototype.hasOwnProperty.call(Z,G))X[X.length]=G;return X},$(Y)};pSA=function(Y){if(Y&&Y.__esModule)return Y;var Z={};if(Y!=null){for(var X=$(Y),G=0;G<X.length;G++)if(X[G]!=="default")up(Z,Y,X[G])}return B(Z,Y),Z},iSA=function(Y){return Y&&Y.__esModule?Y:{default:Y}},nSA=function(Y,Z,X,G){if(X==="a"&&!G)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?Y!==Z||!G:!Z.has(Y))throw TypeError("Cannot read private member from an object whose class did not declare it");return X==="m"?G:X==="a"?G.call(Y):G?G.value:Z.get(Y)},aSA=function(Y,Z,X,G,K){if(G==="m")throw TypeError("Private method is not writable");if(G==="a"&&!K)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?Y!==Z||!K:!Z.has(Y))throw TypeError("Cannot write private member to an object whose class did not declare it");return G==="a"?K.call(Y,X):K?K.value=X:Z.set(Y,X),X},rSA=function(Y,Z){if(Z===null||typeof Z!=="object"&&typeof Z!=="function")throw TypeError("Cannot use 'in' operator on non-object");return typeof Y==="function"?Z===Y:Y.has(Z)},oSA=function(Y,Z,X){if(Z!==null&&Z!==void 0){if(typeof Z!=="object"&&typeof Z!=="function")throw TypeError("Object expected.");var G,K;if(X){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");G=Z[Symbol.asyncDispose]}if(G===void 0){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");if(G=Z[Symbol.dispose],X)K=G}if(typeof G!=="function")throw TypeError("Object not disposable.");if(K)G=function(){try{K.call(this)}catch(W){return Promise.reject(W)}};Y.stack.push({value:Z,dispose:G,async:X})}else if(X)Y.stack.push({async:!0});return Z};var J=typeof SuppressedError==="function"?SuppressedError:function(Y,Z,X){var G=Error(X);return G.name="SuppressedError",G.error=Y,G.suppressed=Z,G};sSA=function(Y){function Z(W){Y.error=Y.hasError?new J(W,Y.error,"An error was suppressed during disposal."):W,Y.hasError=!0}var X,G=0;function K(){while(X=Y.stack.pop())try{if(!X.async&&G===1)return G=0,Y.stack.push(X),Promise.resolve().then(K);if(X.dispose){var W=X.dispose.call(X.value);if(X.async)return G|=2,Promise.resolve(W).then(K,function(H){return Z(H),K()})}else G|=1}catch(H){Z(H)}if(G===1)return Y.hasError?Promise.reject(Y.error):Promise.resolve();if(Y.hasError)throw Y.error}return K()},tSA=function(Y,Z){if(typeof Y==="string"&&/^\.\.?\//.test(Y))return Y.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(X,G,K,W,H){return G?Z?".jsx":".js":K&&(!W||!H)?X:K+W+"."+H.toLowerCase()+"js"});return Y},A("__extends",ESA),A("__assign",jSA),A("__rest",wSA),A("__decorate",PSA),A("__param",_SA),A("__esDecorate",TSA),A("__runInitializers",SSA),A("__propKey",kSA),A("__setFunctionName",bSA),A("__metadata",xSA),A("__awaiter",fSA),A("__generator",vSA),A("__exportStar",ySA),A("__createBinding",up),A("__values",hp),A("__read",Y5A),A("__spread",gSA),A("__spreadArrays",hSA),A("__spreadArray",uSA),A("__await",ER),A("__asyncGenerator",mSA),A("__asyncDelegator",cSA),A("__asyncValues",dSA),A("__makeTemplateObject",lSA),A("__importStar",pSA),A("__importDefault",iSA),A("__classPrivateFieldGet",nSA),A("__classPrivateFieldSet",aSA),A("__classPrivateFieldIn",rSA),A("__addDisposableResource",oSA),A("__disposeResources",sSA),A("__rewriteRelativeImportExtension",tSA)})});var QkA=$A((eSA)=>{Object.defineProperty(eSA,"__esModule",{value:!0});eSA.resolveFetch=void 0;var yEQ=(A)=>{if(A)return(...Q)=>A(...Q);return(...Q)=>fetch(...Q)};eSA.resolveFetch=yEQ});var Z5A=$A((ZkA)=>{Object.defineProperty(ZkA,"__esModule",{value:!0});ZkA.FunctionRegion=ZkA.FunctionsHttpError=ZkA.FunctionsRelayError=ZkA.FunctionsFetchError=ZkA.FunctionsError=void 0;class Ck 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}}}ZkA.FunctionsError=Ck;class $kA extends Ck{constructor(A){super("Failed to send a request to the Edge Function","FunctionsFetchError",A)}}ZkA.FunctionsFetchError=$kA;class JkA extends Ck{constructor(A){super("Relay Error invoking the Edge Function","FunctionsRelayError",A)}}ZkA.FunctionsRelayError=JkA;class YkA extends Ck{constructor(A){super("Edge Function returned a non-2xx status code","FunctionsHttpError",A)}}ZkA.FunctionsHttpError=YkA;var BkA;(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"})(BkA||(ZkA.FunctionRegion=BkA={}))});var HkA=$A((KkA)=>{Object.defineProperty(KkA,"__esModule",{value:!0});KkA.FunctionsClient=void 0;var cEQ=gZ(),dEQ=QkA(),jR=Z5A();class GkA{constructor(A,{headers:Q={},customFetch:B,region:$=jR.FunctionRegion.Any}={}){this.url=A,this.headers=Q,this.region=$,this.fetch=(0,dEQ.resolveFetch)(B)}setAuth(A){this.headers.Authorization=`Bearer ${A}`}invoke(A){return cEQ.__awaiter(this,arguments,void 0,function*(Q,B={}){var $,J;let Y,Z,X;try{let{headers:G,method:K,body:W,signal:H,timeout:U}=B,q={},{region:D}=B;if(!D)D=this.region;let I=new URL(`${this.url}/${Q}`);if(D&&D!=="any")q["x-region"]=D,I.searchParams.set("forceFunctionRegion",D);let O,V=!!G&&Object.keys(G).some((w)=>w.toLowerCase()==="content-type");if(W&&!V)if(typeof Blob<"u"&&W instanceof Blob||W instanceof ArrayBuffer)q["Content-Type"]="application/octet-stream",O=W;else if(typeof W==="string")q["Content-Type"]="text/plain",O=W;else if(typeof FormData<"u"&&W instanceof FormData)O=W;else q["Content-Type"]="application/json",O=JSON.stringify(W);else if(W&&typeof W!=="string"&&!(typeof Blob<"u"&&W instanceof Blob)&&!(W instanceof ArrayBuffer)&&!(typeof FormData<"u"&&W instanceof FormData))O=JSON.stringify(W);else O=W;let N=H;if(U)if(Z=new AbortController,Y=setTimeout(()=>Z.abort(),U),H)N=Z.signal,X=()=>Z.abort(),H.addEventListener("abort",X);else N=Z.signal;let L=yield this.fetch(I.toString(),{method:K||"POST",headers:Object.assign(Object.assign(Object.assign({},q),this.headers),G),body:O,signal:N}).catch((w)=>{throw new jR.FunctionsFetchError(w)}),C=L.headers.get("x-relay-error");if(C&&C==="true")throw new jR.FunctionsRelayError(L);if(!L.ok)throw new jR.FunctionsHttpError(L);let R=(($=L.headers.get("Content-Type"))!==null&&$!==void 0?$:"text/plain").split(";")[0].trim().toLowerCase(),E;if(R==="application/json")E=yield L.json();else if(R==="application/octet-stream"||R==="application/pdf")E=yield L.blob();else if(R==="text/event-stream")E=L;else if(R==="multipart/form-data")E=yield L.formData();else E=yield L.text();return{data:E,error:null,response:L}}catch(G){return{data:null,error:G,response:G instanceof jR.FunctionsHttpError||G instanceof jR.FunctionsRelayError?G.context:void 0}}finally{if(Y)clearTimeout(Y);if(X)(J=B.signal)===null||J===void 0||J.removeEventListener("abort",X)}})}}KkA.FunctionsClient=GkA});var FkA=$A((cq)=>{Object.defineProperty(cq,"__esModule",{value:!0});cq.FunctionRegion=cq.FunctionsRelayError=cq.FunctionsHttpError=cq.FunctionsFetchError=cq.FunctionsError=cq.FunctionsClient=void 0;var lEQ=HkA();Object.defineProperty(cq,"FunctionsClient",{enumerable:!0,get:function(){return lEQ.FunctionsClient}});var Vk=Z5A();Object.defineProperty(cq,"FunctionsError",{enumerable:!0,get:function(){return Vk.FunctionsError}});Object.defineProperty(cq,"FunctionsFetchError",{enumerable:!0,get:function(){return Vk.FunctionsFetchError}});Object.defineProperty(cq,"FunctionsHttpError",{enumerable:!0,get:function(){return Vk.FunctionsHttpError}});Object.defineProperty(cq,"FunctionsRelayError",{enumerable:!0,get:function(){return Vk.FunctionsRelayError}});Object.defineProperty(cq,"FunctionRegion",{enumerable:!0,get:function(){return Vk.FunctionRegion}})});function zkA(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",J),B()},A);function J(){clearTimeout($),B()}Q===null||Q===void 0||Q.addEventListener("abort",J)})}function nEQ(A,Q,B,$){if(!$||B>=3)return!1;if(!IkA.includes(A))return!1;if(!iEQ.includes(Q))return!1;return!0}function Nk(A){return Nk=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},Nk(A)}function sEQ(A,Q){if(Nk(A)!="object"||!A)return A;var B=A[Symbol.toPrimitive];if(B!==void 0){var $=B.call(A,Q||"default");if(Nk($)!="object")return $;throw TypeError("@@toPrimitive must return a primitive value.")}return(Q==="string"?String:Number)(A)}function tEQ(A){var Q=sEQ(A,"string");return Nk(Q)=="symbol"?Q:Q+""}function eEQ(A,Q,B){return(Q=tEQ(Q))in A?Object.defineProperty(A,Q,{value:B,enumerable:!0,configurable:!0,writable:!0}):A[Q]=B,A}function DkA(A,Q){var B=Object.keys(A);if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(A);Q&&($=$.filter(function(J){return Object.getOwnPropertyDescriptor(A,J).enumerable})),B.push.apply(B,$)}return B}function cp(A){for(var Q=1;Q<arguments.length;Q++){var B=arguments[Q]!=null?arguments[Q]:{};Q%2?DkA(Object(B),!0).forEach(function($){eEQ(A,$,B[$])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(B)):DkA(Object(B)).forEach(function($){Object.defineProperty(A,$,Object.getOwnPropertyDescriptor(B,$))})}return A}var UkA=(A)=>Math.min(1000*2**A,30000),iEQ,IkA,X5A,aEQ=class{constructor(A){var Q,B,$,J,Y;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=(J=A.urlLengthLimit)!==null&&J!==void 0?J:8000,this.retryEnabled=(Y=A.retry)!==null&&Y!==void 0?Y:!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 Z=this.headers.get("Accept");if(Z==="application/vnd.pgrst.object+json")this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped");else if(!Z||Z==="application/json")this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}let $=this.fetch,Y=(async()=>{let Z=0;while(!0){let K={};if(B.headers.forEach((H,U)=>{K[U]=H}),Z>0)K["X-Retry-Count"]=String(Z);let W;try{W=await $(B.url.toString(),{method:B.method,headers:K,body:JSON.stringify(B.body,(H,U)=>typeof U==="bigint"?U.toString():U),signal:B.signal})}catch(H){if((H===null||H===void 0?void 0:H.name)==="AbortError"||(H===null||H===void 0?void 0:H.code)==="ABORT_ERR")throw H;if(!IkA.includes(B.method))throw H;if(B.retryEnabled&&Z<3){let U=UkA(Z);Z++,await zkA(U,B.signal);continue}throw H}if(nEQ(B.method,W.status,Z,B.retryEnabled)){var X,G;let H=(X=(G=W.headers)===null||G===void 0?void 0:G.get("Retry-After"))!==null&&X!==void 0?X:null,U=H!==null?Math.max(0,parseInt(H,10)||0)*1000:UkA(Z);await W.text(),Z++,await zkA(U,B.signal);continue}return await B.processResponse(W)}})();if(!this.shouldThrowOnError)Y=Y.catch((Z)=>{var X;let G="",K="",W="",H=Z===null||Z===void 0?void 0:Z.cause;if(H){var U,q,D,I;let N=(U=H===null||H===void 0?void 0:H.message)!==null&&U!==void 0?U:"",L=(q=H===null||H===void 0?void 0:H.code)!==null&&q!==void 0?q:"";if(G=`${(D=Z===null||Z===void 0?void 0:Z.name)!==null&&D!==void 0?D:"FetchError"}: ${Z===null||Z===void 0?void 0:Z.message}`,G+=`
72
72
 
73
73
  Caused by: ${(I=H===null||H===void 0?void 0:H.name)!==null&&I!==void 0?I:"Error"}: ${N}`,L)G+=` (${L})`;if(H===null||H===void 0?void 0:H.stack)G+=`
@@ -265,7 +265,7 @@ To regain access:`),C0.error(` 1. Go to ${o7("/settings/account")}`),C0.error("
265
265
  For more information, visit: https://capgo.app/docs/webapp/2fa-enforcement/
266
266
  `),Error("2FA required for this organization")}async function NnQ(A,Q,B,$){return(await Promise.all(B.map(async(Y)=>{return await a9(A,Q,$,{orgId:Y.gid})?Y:null}))).filter((Y)=>Y!==null)}async function PHA(A,Q,B){let{error:$,data:J}=await A.rpc("get_orgs_v7");if($)throw C0.error("Cannot get the list of organizations - exiting"),C0.error(gA($)),Error("Cannot get the list of organizations");if(J.length===0)throw C0.error("Could not get organization please create an organization first"),Error("No organizations available");let Y=await NnQ(A,Q,J,B);if(Y.length===0)throw C0.error(`Could not find organization with permission: ${B}`),Error("Could not find organization with required permission");return{allOrganizations:J,allowedOrganizations:Y}}async function kr(A,Q,B){let{allOrganizations:$,allowedOrganizations:J}=await PHA(A,Q,B),Y=J.length>1?await U6({message:"Please pick the organization that you want to insert to",options:J.map((G)=>{let K=G.enforcing_2fa&&!G["2fa_has_access"]?" ⚠️ (2FA required)":"";return{value:G.gid,label:`${G.name}${K}`}})}):J[0].gid;if(VB(Y))throw C0.warn("Canceled organization selection, exiting"),new qQ("Organization selection cancelled");let Z=Y,X=$.find((G)=>G.gid===Z);if(X.enforcing_2fa&&!X["2fa_has_access"])wHA(X.name);return C0.info(`Using the organization "${X.name}" as the app owner`),X}async function F4(A,Q,B=!1){let{data:$,error:J}=await A.rpc("request_actor_user_id"),Y=($||"").toString();if(J){if(!B)C0.error(J.message);throw J}if(!Y){if(!B)C0.error("Capgo authentication failed: invalid Capgo API key or insufficient Capgo permissions.");throw Error("Capgo authentication failed: invalid Capgo API key or insufficient Capgo permissions.")}return Y}async function a9(A,Q,B,$={}){let{data:J,error:Y}=await A.rpc("cli_check_permission",{apikey:Q,permission_key:B,org_id:$.orgId??null,app_id:$.appId??null,channel_id:$.channelId??null});if(Y)throw C0.error(`Cannot check permission ${B}`),C0.error(gA(Y)),Error(`Cannot check permission ${B}`);return!!J}async function Tx(A,Q,B,$={},J={}){if(await a9(A,Q,B,$))return;let Z=J.message||`Insufficient permissions for ${B}`;if(!J.silent)C0.error(Z);throw new qQ(`Insufficient permissions for ${B}`,{permissionKey:B,...$})}async function Xj(A,Q,B,$,J,Y){await F4(A,Q,Y),await Tx(A,Q,B,{orgId:$},{message:J,silent:Y})}async function m$(A,Q,B){let{data:$,error:J}=await $1(`app/${encodeURIComponent(Q)}`,{apikey:A,method:"GET",body:void 0,supaHost:B?.supaHost,supaAnon:B?.supaAnon});if(!$?.owner_org||J){let Y=gA(J);throw C0.error(`Cannot get organization id for app id ${Q}: ${Y}`),new qQ("Cannot get organization id for app",{appId:Q,cause:Y})}return $.owner_org}function mL(A){return new Date(A||"").toLocaleString()}function E8(){if(LHA)return{pm:xL,command:Aj,installCommand:`${xL} ${Aj}`,runner:Vr};let A=O1(j5());return xL=$H(A,"npm"),Aj=hq(xL),LHA=!0,Vr=_p(A),{pm:xL,command:Aj,installCommand:`${xL} ${Aj}`,runner:Vr}}function jiA(A){xL=A.pm,Aj=A.command,Vr=A.runner,LHA=!0}function br(A,Q){return{summary:`Best fix: recreate and sync ${Q==="ios"?"iOS":"Android"} with this one-line command.`,command:`rm -rf ${Q} && ${A} cap add ${Q} && ${A} cap sync ${Q}`}}function wiA(A){return Bj(A,{withFileTypes:!0}).flatMap(($)=>{let J=N8(A,$.name);if($.isDirectory())return wiA(J);else return J.split(`node_modules${YiA}`)[1]||J})}function PiA(A){if(!p1(A))return[];try{return Bj(A,{withFileTypes:!0}).flatMap(($)=>{let J=N8(A,$.name);if($.isDirectory())return PiA(J);else return J})}catch{return[]}}function RnQ(A,Q){let B=[];if(Q==="ios"){try{let Y=Bj(A);for(let Z of Y)if(Z.endsWith(".podspec"))B.push(N8(A,Z))}catch{}let $=N8(A,"Package.swift"),J=N8(A,"ios","Package.swift");if(p1($))B.push($);if(p1(J))B.push(J)}else if(Q==="android"){let $=N8(A,"android"),J=N8($,"build.gradle"),Y=N8($,"build.gradle.kts");if(p1(J))B.push(J);if(p1(Y))B.push(Y)}return B}async function EnQ(A){let Q=N8(A,"ios"),B=N8(A,"android"),$=async(Z,X)=>{let G=p1(Z)?PiA(Z).filter((q)=>UiA.test(q)):[],K=RnQ(A,X),W=[...G,...K].sort((q,D)=>q.localeCompare(D));if(W.length===0)return;let{createHash:H}=await import("node:crypto"),U=H("sha256");for(let q of W)try{let D=JiA(A,q);U.update(D);let I=n9(q);U.update(I)}catch{}return U.digest("hex")},[J,Y]=await Promise.all([$(Q,"ios"),$(B,"android")]);return{ios_checksum:J,android_checksum:Y}}function jnQ(A){let Q=[],B=A,$=yL.parse(B).root;while(!0){if(Q.push(N8(B,"node_modules")),B===$)break;let J=s2(B);if(J===B)break;B=J}return Q}async function _HA(A,Q){let B=Q?Q.split(",").map((H)=>H.trim()).filter(Boolean):[],$;try{$=await vW("",A)}catch(H){throw C0.error("Invalid package.json, JSON parsing failed"),C0.error(`json parse error: ${gA(H)}`),H instanceof Error?H:Error("Invalid package.json")}let J=A?A.split(",")[0].trim():void 0,Y=!J?O1(j5()):yL.resolve(J).replace(R8,"");if(!$)throw C0.error("Missing dependencies section in package.json"),Error("Missing dependencies section in package.json");for(let[H,U]of Object.entries($))if(typeof U!=="string")throw C0.error(`Invalid dependency ${H}: ${U}, expected string, got ${typeof U}`),Error(`Invalid dependency ${H}: expected string version`);let Z=B.length===0?jnQ(j5()):B;if(!Z.some((H)=>p1(H))){let H=$H(Y,"npm"),U=hq(H);throw C0.error(`Missing node_modules folder at ${Z.join(", ")}, please run ${H} ${U}`),Error("Missing node_modules folder")}let G=!1,K=await YnQ(O1(j5()),A),W=await Promise.all(Array.from($.entries()).map(async([H,U])=>{let q=!1,D=!1,I=U,O=K.get(H)??U,V;for(let C of Z){let R=N8(C,H);if(p1(R)){q=!0,V=R;try{let E=N8(R,R8);if(p1(E)){let w=JSON.parse(n9(E,"utf-8"));if(w.version)I=w.version}}catch{}if(!GnQ(R))continue;try{if(wiA(R).some((w)=>UiA.test(w))){D=!0;break}}catch(E){throw C0.error(`Error reading node_modules files for ${H} package in ${C}`),C0.error(gA(E)),E instanceof Error?E:Error(`Error reading node_modules files for ${H}`)}}}if(!q){G=!0;let C=$H(Y,"npm"),R=hq(C);return C0.error(`Missing dependency ${H}, please run ${C} ${R}`),{name:H,version:I,requested_version:O}}let N,L;if(D&&V){let C=await EnQ(V);N=C.ios_checksum,L=C.android_checksum}return{name:H,version:I,requested_version:O,native:D,ios_checksum:N,android_checksum:L}}));if(G||W.some((H)=>H.native===void 0))throw C0.error("Missing dependencies or invalid dependencies"),C0.error("If you use monorepo, workspace or any special package manager you can use the --package-json [path,] and --node-modules [path,] options to make the command work properly"),Error("Missing dependencies or invalid dependencies");return W}async function _iA(A,Q,B){let{data:$,error:J}=await A.from("channels").select("version:app_versions!channels_version_fkey(checksum)").eq("name",B).eq("app_id",Q).single(),Y=$;if(J||Y===null||!Y.version||!Y.version.checksum)return null;return Y.version.checksum}function QiA(A){if(!A)throw C0.error("Error parsing native packages, perhaps the metadata does not exist in Capgo?"),Error("Error parsing native packages");for(let B of A){let $=r3A(LpA,B);if(!$.success){let J=$.error.issues.map((Y)=>`${(Y.path??[]).join(".")}: ${Y.message}`).join(", ");throw C0.error(`Invalid remote native package data: ${J}`),Error(`Invalid remote native package data: ${J}`)}}return new Map(A.map((B)=>[B.name,B]))}async function TiA(A,Q,B){let{data:$,error:J}=await A.from("channels").select(`version:app_versions!channels_version_fkey(
267
267
  native_packages
268
- )`).eq("name",B).eq("app_id",Q).maybeSingle();if(J){let Z=J.code==="PGRST116"||J.message?.includes("Cannot coerce")?`Multiple channels matched for app "${Q}" and channel "${B}". Contact support if this persists.`:J.message;throw C0.error(`Error fetching native packages: ${Z}`),Error(`Error fetching native packages: ${Z}`)}if(!$)return QiA([]);return QiA($.version?.native_packages??[])}function mB(A,Q){return A||Q?.plugins?.CapacitorUpdater?.appId||Q?.appId}function LH(A){let Q=[];if(!A.localVersion)return{compatible:!0,reasons:[],message:"Package only exists on remote (will be removed)"};if(!A.remoteVersion)return Q.push("new_plugin"),{compatible:!1,reasons:Q,message:"New native plugin added (requires app store update)"};let B=!1;try{let H=yp(A.localVersion),U=yp(A.remoteVersion);B=FSA(H,U)}catch{B=!1}if(!B)Q.push("version_mismatch");if(A.localRequestedVersion&&A.remoteRequestedVersion&&A.localRequestedVersion.trim()!==A.remoteRequestedVersion.trim())Q.push("requested_version_changed");let $=(H)=>typeof H==="string"&&H.trim().length>0,J=$(A.localIosChecksum)&&$(A.remoteIosChecksum)&&A.localIosChecksum!==A.remoteIosChecksum,Y=$(A.localAndroidChecksum)&&$(A.remoteAndroidChecksum)&&A.localAndroidChecksum!==A.remoteAndroidChecksum;if(J&&Y)Q.push("both_platforms_changed");else if(J)Q.push("ios_code_changed");else if(Y)Q.push("android_code_changed");let Z=$(A.localIosChecksum)!==$(A.remoteIosChecksum),X=$(A.localAndroidChecksum)!==$(A.remoteAndroidChecksum);if(Z||X)Q.push("platform_checksum_metadata_changed");let G=[],K=(H)=>H!=="requested_version_changed";for(let H of Q)switch(H){case"version_mismatch":G.push(`version changed: ${A.remoteVersion} → ${A.localVersion}`);break;case"requested_version_changed":G.push(`requested version changed: ${A.remoteRequestedVersion??"unknown"} → ${A.localRequestedVersion??"unknown"}`);break;case"ios_code_changed":G.push("iOS native code changed");break;case"android_code_changed":G.push("Android native code changed");break;case"both_platforms_changed":G.push("iOS and Android native code changed");break;case"platform_checksum_metadata_changed":G.push("iOS/Android checksum metadata appeared or disappeared (may be Capgo CLI change — verify native code)");break;case"new_plugin":G.push("new plugin (requires app store update)");break;case"removed_plugin":G.push("plugin removed");break}if(!Q.some(K))return{compatible:!0,reasons:Q,message:G.length>0?G.join(", "):"Compatible"};return{compatible:!1,reasons:Q,message:G.join(", ")}}function s7(A){return LH(A).compatible}async function Gj(A,Q,B,$,J){let Y=await _HA($,J),Z=await TiA(A,Q,B),X=Y.filter((K)=>!!K.native).map((K)=>{let W=Z.get(K.name);if(W)return{name:K.name,localVersion:K.version,localRequestedVersion:K.requested_version,remoteVersion:W.version,remoteRequestedVersion:W.requested_version,localIosChecksum:K.ios_checksum,remoteIosChecksum:W.ios_checksum,localAndroidChecksum:K.android_checksum,remoteAndroidChecksum:W.android_checksum};return{name:K.name,localVersion:K.version,localRequestedVersion:K.requested_version,remoteVersion:void 0,localIosChecksum:K.ios_checksum,localAndroidChecksum:K.android_checksum}}),G=[...Z].filter(([K])=>!Y.some((W)=>W.name===K)).map(([K,W])=>({name:K,localVersion:void 0,remoteVersion:W.version,remoteRequestedVersion:W.requested_version,remoteIosChecksum:W.ios_checksum,remoteAndroidChecksum:W.android_checksum}));return X.push(...G),{finalCompatibility:X,localDependencies:Y}}async function Sx(A,Q,B,$){let J=await TiA(A,Q,B),Y=$.map((X)=>{let G=J.get(X.name);if(G)return{name:X.name,localVersion:X.version,localRequestedVersion:X.requested_version,remoteVersion:G.version,remoteRequestedVersion:G.requested_version,localIosChecksum:X.ios_checksum,remoteIosChecksum:G.ios_checksum,localAndroidChecksum:X.android_checksum,remoteAndroidChecksum:G.android_checksum};return{name:X.name,localVersion:X.version,localRequestedVersion:X.requested_version,remoteVersion:void 0,localIosChecksum:X.ios_checksum,localAndroidChecksum:X.android_checksum}}),Z=[...J].filter(([X])=>!$.some((G)=>G.name===X)).map(([X,G])=>({name:X,localVersion:void 0,remoteVersion:G.version,remoteRequestedVersion:G.requested_version,remoteIosChecksum:G.ios_checksum,remoteAndroidChecksum:G.android_checksum}));return Y.push(...Z),{finalCompatibility:Y,localDependencies:$}}function SiA(A){if(!p1(A))return null;try{return JSON.parse(n9(A,"utf-8"))}catch{return null}}function Cr(A){if(!A)return!1;return/@capgo\/capacitor-updater|CapgoCapacitorUpdater|CapacitorUpdaterPlugin/.test(A)}function wnQ(A){let Q=SiA(A);if(!Q)return!1;let B=Q.packageClassList;return Array.isArray(B)&&B.includes("CapacitorUpdaterPlugin")}function PnQ(A,Q){if(!Q)return N8(A,R8);return yL.isAbsolute(Q)?Q:L$(A,Q)}function THA(A=j5(),Q){let B=PnQ(A,Q),$=yL.basename(B)===R8?s2(B):B,J=[N8($,"ios","App"),N8(A,"ios","App")].find((E)=>p1(E));if(!J)return{shouldCheck:!1,valid:!0,details:[]};let Y=SiA(B),Z={...Y?.dependencies,...Y?.devDependencies,...Y?.optionalDependencies},X=Object.hasOwn(Z,"@capgo/capacitor-updater"),G=[$,A].some((E)=>p1(N8(E,"node_modules","@capgo","capacitor-updater"))),K=N8(J,"Podfile"),W=N8(J,"CapApp-SPM","Package.swift"),H=p1(K)?n9(K,"utf-8"):void 0,U=p1(W)?n9(W,"utf-8"):void 0,q=Cr(H)||Cr(U),D=N8(J,"Podfile.lock"),I=N8(J,"App","capacitor.plugins.json"),O=N8(J,"App","capacitor.config.json"),V=p1(D)?n9(D,"utf-8"):void 0,N=p1(I)?n9(I,"utf-8"):void 0,L=Cr(V)||Cr(N)||wnQ(O);if(!(X||G||q||L))return{shouldCheck:!1,valid:!0,details:[]};let R=[];if(!q)R.push(`Missing @capgo/capacitor-updater in iOS dependency files (${K} or ${W})`);if(!L)R.push(`Missing @capgo/capacitor-updater in iOS native project outputs (${D}, ${I}, or ${O})`);return{shouldCheck:!0,valid:q&&L,details:R}}function _nQ(A,Q,B){if(!A.shouldCheck||A.valid)return;let $=br(Q,"ios");B?.(),C0.error("Capgo iOS dependency sync verification failed.");for(let J of A.details)C0.error(J);throw C0.error("Stop here to avoid testing on a broken native iOS project."),C0.warn($.summary),C0.info($.command),new qQ(aJA)}async function kiA(A,Q,B,$){let J=await l1({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(VB(J)){if(A&&Q&&B)await sq("onboarding-v2",Q,B,"canceled");throw C0.warn("Canceled Capacitor sync"),new qQ("Capacitor sync cancelled")}if(J){let Y=E8(),Z=h4();Z.start("Running the command...");let X;try{await new Promise((G,K)=>{let W=siQ(Y.runner,["cap","sync"],{stdio:"pipe"});W.on("close",(H)=>{if(H===0)G();else K(Error(`Command failed with exit code ${H}`))}),W.on("error",(H)=>{K(H)})})}catch(G){X=G,C0.error(`Failed to run Capacitor sync: ${G}`),C0.warn(`Please run "${Y.runner} cap sync" manually to ensure encrypted updates work properly`)}if($?.validateIosUpdater)_nQ(THA(j5(),$.packageJsonPath),Y.runner,()=>Z.stop("iOS sync check failed ❌"));if(X){Z.stop("Error");return}Z.stop("Capacitor sync completed ✅")}else{let Y=E8();C0.warn("⚠️ Important: If you upload encrypted bundles without syncing, updates will fail!"),C0.info(`Remember to run "${Y.runner} cap sync" before uploading encrypted bundles`)}}var CHA,VHA,GiA,Rr,C0,$j=".capgo_key",sJ=".capgo_key_v2",Er,dZ,opA="https://capgo.app",spA="https://files.capgo.app",OH="https://api.capgo.app",CD="https://console.capgo.app",KiA=120000,eiQ=20971520,AnQ=1073741824,QnQ=103809024,Rx,Ex=1e4,NHA="BundleUploadTimeoutError",R8="package.json",tpA="Cannot connect to server please try again later",gL,UiA,IHA=null,Lr=null,wr="5.10.0",Pr="6.25.0",Px="7.0.30",LHA=!1,xL="npm",Aj="install",Vr="npx";var w0=mA(()=>{Dk();WB();pG();ukA();p7();pi();Uk();kyA();Hb();ri();hYA();_b();sG();VR();l2();Gr();o3A();D8();Kr();Ur();zr();CHA=eA(M5A(),1),VHA=eA(fk(),1),GiA=eA(AxA(),1),Rr=eA(li(),1);C0={error:(A)=>Mr("error",A),info:(A)=>Mr("info",A),success:(A)=>Mr("success",A),warn:(A)=>Mr("warn",A)},Er=`${$j}.pub`,dZ=`${sJ}.pub`;Rx=[0,1000,3000,5000,1e4];gL=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i;UiA=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/});function Kj(A,Q,B={},$){let J=`${A}:${Q}`,Y=xr.get(J);if(Y)return Y;let Z=(async()=>{try{if($?.aborted)return;if(B.fetchOwnerOrg)return await B.fetchOwnerOrg(A,Q,$);if(B.createClient){let W=(await B.createClient(A,void 0,void 0,!0,!1)).from("apps").select("owner_org").eq("app_id",Q);if($)W=W.abortSignal($);let{data:H}=await W.maybeSingle();return H?.owner_org??void 0}let{data:X,error:G}=await $1(`app/${encodeURIComponent(Q)}`,{apikey:A,method:"GET",body:void 0,signal:$});if(G||!X?.owner_org)return;return X.owner_org}catch{return}})();return xr.set(J,Z),Z.then((X)=>{if(!X)xr.delete(J)}).catch(()=>{xr.delete(J)}),Z}var xr;var fr=mA(()=>{w0();xr=new Map});import{AsyncLocalStorage as TnQ}from"node:async_hooks";import{env as biA}from"node:process";function SnQ(){return wW(biA.CAPGO_DISABLE_TELEMETRY)||wW(biA.CAPGO_DISABLE_POSTHOG)}function knQ(A){vr.add(A),A.finally(()=>vr.delete(A))}async function nZ(A=2000){if(vr.size===0)return;let Q;if(await Promise.race([Promise.allSettled([...vr]),new Promise((B)=>{Q=setTimeout(B,A),Q.unref?.()})]),Q)clearTimeout(Q);for(let B of yr)B.abort();yr.clear()}function bnQ(A,Q){let B=xiA.get(A);if(B)return B;let $=(async()=>{try{let J=await m0(!0).catch(()=>{return}),Y=mB("",J?.config)||void 0;if(!Y)return{};let Z=await Kj(A,Y,{},Q);return{appId:Y,orgId:Z}}catch{return{}}})();return xiA.set(A,$),$}function E0(A){if(SnQ())return Promise.resolve();let Q=A.apikey??H4();if(!Q)return Promise.resolve();let B=new AbortController;yr.add(B);let $=(async()=>{try{let{appId:J,orgId:Y}=A;if(J===void 0&&Y===void 0){let X=await bnQ(Q,B.signal);J=X.appId,Y=X.orgId}let Z={...J?{app_id:J}:{},...A.tags??{}};await jB(Q,{channel:A.channel,event:A.event,tracking_version:2,...A.timestamp?{timestamp:A.timestamp}:{},...Y?{org_id:Y}:{},tags:Z,...A.nonPersonTags?{nonPersonTags:A.nonPersonTags}:{}},!1,B.signal).catch(()=>{})}catch{}finally{yr.delete(B)}})();return knQ($),$}function viA(A){return{flags:Object.keys(A.opts()).filter((B)=>A.getOptionValueSource(B)==="cli").sort(),positional_arg_count:A.args.length}}function yiA(A,Q,B){E0({apikey:B,channel:kHA,event:"CLI Command Invoked",tags:{command_path:A,flags:Q.flags.join(","),flags_count:Q.flags.length,positional_arg_count:Q.positional_arg_count}})}function giA(A,Q){Wj=Date.now(),bHA=A,yiA(A,Q)}function hiA(A,Q){Wj=Date.now(),bHA=A,SHA={commandPath:A,ctx:Q}}function kx(A){let Q=SHA;if(!Q)return;SHA=void 0,yiA(Q.commandPath,Q.ctx,A)}function uiA(A){E0({channel:kHA,event:"CLI Command Succeeded",tags:{command_path:A,...Wj?{duration_ms:Date.now()-Wj}:{}}})}function xHA(A,Q){E0({channel:kHA,event:"CLI Command Failed",tags:{command_path:A,error_category:Q.errorCategory,exit_code:Q.exitCode,...Wj?{duration_ms:Date.now()-Wj}:{}}})}function ciA(A,Q){return(...$)=>fiA.run(`mcp:${A}`,async()=>{let J=Date.now(),Y=!0;try{let Z=await Q(...$);if(Z&&typeof Z==="object"&&"isError"in Z&&Z.isError)Y=!1;return Z}catch(Z){throw Y=!1,Z}finally{E0({channel:miA,event:"MCP Tool Invoked",tags:{tool_name:A,success:Y,duration_ms:Date.now()-J}})}})}function diA(A){E0({channel:miA,event:"MCP Server Started",tags:{has_apikey:A,mcp_sdk_version:$6.version}})}function fnQ(A){let Q=A.durationMs>mTA;if(A.ok&&!Q)return;let B=fiA.getStore()??bHA,$={operation:cTA(A.url,A.method),method:A.method,status_code:A.status,duration_ms:A.durationMs,ok:A.ok,slow:Q};if(A.source)$.source=A.source;if(B)$.command_path=B;if(!A.ok)$.error_category=A.error!==void 0?mM(A.error):bTA(A.status);E0({apikey:A.apikey,channel:xnQ,event:"Supabase Call",tags:$})}var vr,yr,xiA,kHA="cli-usage",Wj=0,bHA="",fiA,SHA,miA="mcp",xnQ="cli-perf";var f8=mA(()=>{fZ();VR();w0();fr();Uk();pi();Uk();vr=new Set,yr=new Set;xiA=new Map;fiA=new TnQ;uTA(fnQ)});import{randomBytes as SaQ}from"node:crypto";import{appendFile as kaQ,chmod as baQ,lstat as VnA,mkdir as xaQ,readFile as NnA,rename as faQ,rm as vaQ,writeFile as yaQ}from"node:fs/promises";import{dirname as gaQ,join as haQ}from"node:path";async function vx(A){try{if((await VnA(A)).isSymbolicLink())throw Error(`Refusing to access symbolic link path: ${A}`)}catch(Q){if(Q.code!=="ENOENT")throw Q}}async function RD(A,Q){if(await vx(A),await xaQ(A,{recursive:!0,mode:Q}),!(await VnA(A)).isDirectory())throw Error(`Expected a directory at ${A}`);await baQ(A,Q)}async function RnA(A,Q,B=384){await vx(A),await kaQ(A,Q,{mode:B})}async function dY(A,Q,B={}){let $=B.mode??384;await vx(A);let J=haQ(gaQ(A),`.capgo-tmp-${SaQ(8).toString("hex")}`);try{await yaQ(J,Q,{encoding:B.encoding??"utf-8",mode:$}),await faQ(J,A)}catch(Y){throw await vaQ(J,{force:!0}),Y}}async function ir(A){return await vx(A),await NnA(A,"utf-8")}async function EnA(A){return await vx(A),await NnA(A)}var e2=()=>{};import{stderr as uaQ}from"node:process";function oHA(A){return Array.from(A,(Q)=>{let B=Q.codePointAt(0);return B<=31||B>=127&&B<=159||B>=8232&&B<=8238||B>=8294&&B<=8297?`\\u${B.toString(16).padStart(4,"0")}`:Q}).join("")}function nr(A){return new Promise((Q,B)=>{uaQ.write(A,($)=>$?B($):Q())})}var ED=(A)=>oHA(JSON.stringify(A??""));var yx=()=>{};import{Buffer as maQ}from"node:buffer";import{readFile as caQ}from"node:fs/promises";import{homedir as daQ}from"node:os";import{join as rr}from"node:path";import{cwd as _nA,env as laQ}from"node:process";function bnA(A){return A?rr(_nA(),knA):SnA}function paQ(A){return A?null:TnA}function Uj(A){let B=A.trim().match(/^(\d+)\s*([smhd])?$/i);if(!B)throw Error("output-retention must be a number with optional unit: s, m, h, d (examples: 1h, 3600s, 2d)");let $=Number.parseInt(B[1],10),J=(B[2]||"s").toLowerCase(),Z=$*(J==="s"?1:J==="m"?60:J==="h"?3600:86400);if(Z<AU)throw Error(`output-retention must be at least ${AU} seconds (1h)`);if(Z>jnA)throw Error(`output-retention must be at most ${jnA} seconds (7d)`);return Z}function w5(A){if(A===void 0)return!0;if(typeof A==="boolean")return A;let Q=A.trim().toLowerCase();if(Q==="true"||Q==="1"||Q==="yes")return!0;if(Q==="false"||Q==="0"||Q==="no")return!1;throw Error("output-upload must be true/false (examples: --output-upload, --output-upload false)")}function zj(A){if(typeof A==="string"&&A.trim()==="")throw Error("in-app-update-priority must be an integer between 0 and 5");let Q=typeof A==="number"?A:Number(A);if(!Number.isInteger(Q)||Q<0||Q>5)throw Error("in-app-update-priority must be an integer between 0 and 5");return Q}function tHA(A){let Q=A.trim().toLowerCase();if(!wnA.includes(Q))throw Error(`android-track must be one of: ${wnA.join(", ")}`);return Q}function eHA(A){let Q=A.trim(),B=Q.toLowerCase()==="inprogress"?"inProgress":Q;if(!PnA.includes(B))throw Error(`android-release-status must be one of: ${PnA.join(", ")}`);return B}async function ar(A){return(await caQ(A)).toString("base64")}function sHA(A){return A!==null&&typeof A==="object"&&!Array.isArray(A)}function iaQ(A){if(!sHA(A))return!1;for(let Q of Object.values(A)){if(!sHA(Q))return!1;for(let B of["ios","android"]){if(!Object.hasOwn(Q,B))continue;let $=Q[B];if(!sHA($)||Object.values($).some((J)=>typeof J!=="string"))return!1}}return!0}async function lL(A,Q=!1){let B=bnA(A),$;try{$=await ir(B)}catch(Y){if(Y.code==="ENOENT")return{};if(Q)throw Error(`Cannot read saved credentials file: ${ED(B)}`);return{}}let J;try{J=JSON.parse($)}catch{if(Q)throw Error(`Cannot parse saved credentials file: ${ED(B)}`);return{}}if(Q&&!iaQ(J))throw Error(`Invalid saved credentials structure: ${ED(B)}`);return J}async function v8(A,Q,B=!1){if(Q!==void 0){let Y=await lL(Q,B);if(!A){let Z=Object.keys(Y);if(Z.length===0)return null;return Y[Z[0]]||null}return Y[A]||null}let $=await lL(!0,B),J=await lL(!1,B);if(!A){let Y=Object.keys($);if(Y.length>0)return $[Y[0]]||null;let Z=Object.keys(J);if(Z.length===0)return null;return J[Z[0]]||null}return $[A]||J[A]||null}async function gx(A,Q){let B=bnA(Q),$=paQ(Q);if($)await RD($,448);await dY(B,JSON.stringify(A,null,2),{mode:384})}function u4(A){return laQ[A]}function naQ(){let A={},Q=u4("BUILD_CERTIFICATE_BASE64"),B=u4("P12_PASSWORD"),$=u4("APPLE_KEY_ID"),J=u4("APPLE_ISSUER_ID"),Y=u4("APPLE_KEY_CONTENT"),Z=u4("APP_STORE_CONNECT_TEAM_ID"),X=u4("FASTLANE_USER"),G=u4("FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD"),K=u4("APPLE_APP_ID"),W=u4("CAPGO_IOS_SCHEME"),H=u4("CAPGO_IOS_TARGET"),U=u4("CAPGO_IOS_PROVISIONING_MAP"),q=u4("CAPGO_IOS_PROVISIONING_MAP_BASE64"),D=U||(q?maQ.from(q,"base64").toString("utf-8"):void 0),O=u4("CAPGO_ANDROID_FLAVOR")?.trim()||void 0,V=u4("ANDROID_KEYSTORE_FILE"),N=u4("KEYSTORE_KEY_ALIAS"),L=u4("KEYSTORE_KEY_PASSWORD"),C=u4("KEYSTORE_STORE_PASSWORD"),R=u4("PLAY_CONFIG_JSON"),E=u4("PLAY_STORE_TRACK"),w=u4("PLAY_STORE_RELEASE_STATUS"),S=u4("PLAY_STORE_IN_APP_UPDATE_PRIORITY"),u=u4("BUILD_OUTPUT_UPLOAD_ENABLED"),k=u4("BUILD_OUTPUT_RETENTION_SECONDS"),b=u4("SKIP_BUILD_NUMBER_BUMP"),h=u4("SKIP_MARKETING_VERSION_BUMP"),r=u4("CAPGO_IOS_DISTRIBUTION"),e=u4("CAPGO_STORE_SUBMIT_REVIEW"),n=u4("CAPGO_STORE_RELEASE_NAME"),l=u4("CAPGO_STORE_RELEASE_NOTES"),c=u4("CAPGO_STORE_RELEASE_NOTES_LOCALIZED"),v=u4("CAPGO_IOS_TESTFLIGHT_GROUPS"),d=u4("CAPGO_IOS_AUTOMATIC_RELEASE");if(Q)A.BUILD_CERTIFICATE_BASE64=Q;if(B)A.P12_PASSWORD=B;if($)A.APPLE_KEY_ID=$;if(J)A.APPLE_ISSUER_ID=J;if(Y)A.APPLE_KEY_CONTENT=Y;if(Z)A.APP_STORE_CONNECT_TEAM_ID=Z;if(X)A.FASTLANE_USER=X;if(G)A.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=G;if(K)A.APPLE_APP_ID=K;if(W)A.CAPGO_IOS_SCHEME=W;if(e)A.CAPGO_STORE_SUBMIT_REVIEW=w5(e)?"true":"false";if(n?.trim())A.CAPGO_STORE_RELEASE_NAME=n.trim();if(l?.trim())A.CAPGO_STORE_RELEASE_NOTES=l.trim();if(c?.trim())A.CAPGO_STORE_RELEASE_NOTES_LOCALIZED=c.trim();if(v?.trim())A.CAPGO_IOS_TESTFLIGHT_GROUPS=v.trim();if(d)A.CAPGO_IOS_AUTOMATIC_RELEASE=w5(d)?"true":"false";if(H)A.CAPGO_IOS_TARGET=H;if(r)A.CAPGO_IOS_DISTRIBUTION=r;if(D)A.CAPGO_IOS_PROVISIONING_MAP=D;let x=O?.trim();if(x)A.CAPGO_ANDROID_FLAVOR=x;if(V)A.ANDROID_KEYSTORE_FILE=V;if(N)A.KEYSTORE_KEY_ALIAS=N;if(L)A.KEYSTORE_KEY_PASSWORD=L;if(C)A.KEYSTORE_STORE_PASSWORD=C;if(R)A.PLAY_CONFIG_JSON=R;if(E?.trim())A.PLAY_STORE_TRACK=tHA(E);if(w?.trim())A.PLAY_STORE_RELEASE_STATUS=eHA(w);if(S)A.PLAY_STORE_IN_APP_UPDATE_PRIORITY=String(zj(S));if(u)A.BUILD_OUTPUT_UPLOAD_ENABLED=w5(u)?"true":"false";if(k)A.BUILD_OUTPUT_RETENTION_SECONDS=String(Uj(k));if(b)A.SKIP_BUILD_NUMBER_BUMP=w5(b)?"true":"false";if(h)A.SKIP_MARKETING_VERSION_BUMP=w5(h)?"true":"false";return A}async function or(A,Q,B){let $=await v8(A),J=naQ(),Y={...$?.[Q]||{}};if(Object.assign(Y,J),B)Object.assign(Y,B);if(Q==="android"){let Z=!!Y.KEYSTORE_KEY_PASSWORD,X=!!Y.KEYSTORE_STORE_PASSWORD;if(Z&&!X)Y.KEYSTORE_STORE_PASSWORD=Y.KEYSTORE_KEY_PASSWORD;else if(!Z&&X)Y.KEYSTORE_KEY_PASSWORD=Y.KEYSTORE_STORE_PASSWORD}return Object.keys(Y).length>0?Y:void 0}async function AFA(A,Q,B={}){let $={...B};if(A==="ios"){if(Q.BUILD_CERTIFICATE_FILE)$.BUILD_CERTIFICATE_BASE64=await ar(Q.BUILD_CERTIFICATE_FILE);if(Q.APPLE_KEY_FILE)$.APPLE_KEY_CONTENT=await ar(Q.APPLE_KEY_FILE)}else if(A==="android"){if(Q.ANDROID_KEYSTORE_PATH)$.ANDROID_KEYSTORE_FILE=await ar(Q.ANDROID_KEYSTORE_PATH);if(Q.PLAY_CONFIG_JSON_PATH)$.PLAY_CONFIG_JSON=await ar(Q.PLAY_CONFIG_JSON_PATH)}return $}async function e6(A,Q,B,$){let J=await lL($),Y=J[A]||{};Y[Q]={...Y[Q],...B},J[A]=Y,await gx(J,$)}async function jD(A,Q,B,$){let J=await lL($),Y=J[A];if(!Y||!Y[Q])return;for(let Z of B)delete Y[Q][Z];J[A]=Y,await gx(J,$)}async function qj(A,Q,B){let $=await lL(B);if(!A){await gx({},B);return}if(!Q){delete $[A],await gx($,B);return}let J=$[A]||{};if(delete J[Q],Object.keys(J).length===0)delete $[A];else $[A]=J;await gx($,B)}async function sr(A,Q,B){return(await v8(A,B))?.[Q]||null}async function Dj(A){let Q=await lL(A);return Object.keys(Q)}function QU(){return rr(_nA(),knA)}function BU(){return SnA}var TnA,SnA,knA=".capgo-credentials.json",AU=3600,jnA=604800,wnA,PnA;var lY=mA(()=>{e2();yx();TnA=rr(daQ(),".capgo-credentials"),SnA=rr(TnA,"credentials.json");wnA=["internal","alpha","beta","production"],PnA=["draft","completed","inProgress","halted"]});import{Buffer as BFA}from"node:buffer";import{createHash as aaQ}from"node:crypto";import{readFileSync as xnA}from"node:fs";function $FA(A){let Q=xnA(A);return YFA(Q,A)}function JFA(A){let Q=BFA.from(A,"base64");return YFA(Q,"<base64 input>")}function fnA(A){let Q=xnA(A);return Oj(Q,A)}function Ij(A){let Q=BFA.from(A,"base64");return Oj(Q,"<base64 input>")}function YFA(A,Q){let J=A.indexOf("<?xml"),Y=J!==-1?A.indexOf("</plist>",J):-1;if(J===-1||Y===-1||Y<=J)throw Error(`No embedded plist found in mobileprovision file: ${Q}`);let Z=A.slice(J,Y+8).toString("utf-8"),X=tr(Z,"Name");if(!X)throw Error(`Mobileprovision file missing required 'Name' key: ${Q}`);let G=tr(Z,"UUID")||"",K=QrQ(Z,"Entitlements","application-identifier")||"",W=K.indexOf("."),H=W!==-1?K.slice(W+1):K;return{name:X,uuid:G,applicationIdentifier:K,bundleId:H}}function Oj(A,Q="<buffer input>"){let B=YFA(A,Q),$="<?xml",J="</plist>",Y=A.indexOf("<?xml"),Z=A.indexOf("</plist>",Y),X=A.slice(Y,Z+8).toString("utf-8"),G=raQ(X),K=tr(X,"ExpirationDate","date")||"",W=oaQ(X),H=saQ(X),U=ArQ(X);return{...B,teamId:G,expirationDate:K,profileType:W,certificateSha1s:H,profileEntitlements:U}}function raQ(A){let Q=A.match(/<key>TeamIdentifier<\/key>\s*<array>([\s\S]*?)<\/array>/);if(Q){let B=Q[1].match(/<string>([^<]+)<\/string>/);if(B)return B[1]}return""}function oaQ(A){if(/<key>ProvisionsAllDevices<\/key>\s*<true\s*\/>/.test(A))return"enterprise";let B=/<key>ProvisionedDevices<\/key>\s*<array>/.test(A),$=/<key>get-task-allow<\/key>\s*<true\s*\/>/.test(A);if(B){if($)return"development";return"ad_hoc"}return"app_store"}function saQ(A){let Q=A.match(/<key>DeveloperCertificates<\/key>\s*<array>([\s\S]*?)<\/array>/);if(!Q)return[];let B=[];for(let $ of Q[1].matchAll(/<data>([\s\S]*?)<\/data>/g)){let J=$[1].replace(/\s+/g,"");if(!J)continue;try{let Y=BFA.from(J,"base64"),Z=aaQ("sha1").update(Y).digest("hex").toLowerCase();B.push(Z)}catch{}}return B}function taQ(A){return A==="application-identifier"||A.endsWith(".team-identifier")}function eaQ(A){return Array.from(A.matchAll(/<string>([\s\S]*?)<\/string>/g),(Q)=>Q[1].trim())}function ArQ(A){let Q=A.match(/<key>Entitlements<\/key>\s*<dict>([\s\S]*?)<\/dict>/)?.[1];if(Q===void 0)return{};let B={},$=/<key>([\s\S]*?)<\/key>\s*(?:<(true|false)\s*\/>|<array>([\s\S]*?)<\/array>|<([a-z]+)>([\s\S]*?)<\/\4>)/g;for(let J of Q.matchAll($)){let Y=J[1].trim();if(Y in B||taQ(Y))continue;if(J[2]!==void 0)B[Y]=J[2]==="true";else if(J[3]!==void 0)B[Y]=eaQ(J[3]);else if(J[4]==="string")B[Y]=J[5].trim();else B[Y]=J[5].trim()}return B}function tr(A,Q,B="string"){let $=QFA(B),J=new RegExp(`<key>${QFA(Q)}</key>\\s*<${$}>([^<]*)</${$}>`),Y=A.match(J);return Y?Y[1]:null}function QrQ(A,Q,B){let $=new RegExp(`<key>${QFA(Q)}</key>\\s*<dict>([\\s\\S]*?)</dict>`),J=A.match($);if(!J)return null;return tr(J[1],B)}function QFA(A){return A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var wD=()=>{};var ux={};d9(ux,{writeReleaseBundleId:()=>Mj,replaceBundleIdInPbxproj:()=>hnA,readPbxproj:()=>rX,findXcodeProject:()=>aX,findSignableTargets:()=>BK});import{existsSync as ZFA,readdirSync as vnA,readFileSync as gnA,writeFileSync as BrQ}from"node:fs";import{join as hx}from"node:path";function BK(A){if(!A)return[];let Q=/\w+\s*\/\*[^*]*\*\/\s*=\s*\{[^}]*isa\s*=\s*PBXNativeTarget;[^}]*\}/g,B=[];for(let $ of A.matchAll(Q)){let J=$[0],Y=J.match(/name\s*=\s*("[^"]*"|[^;\s]+)\s*;/),Z=J.match(/productType\s*=\s*"([^"]+)"/),X=J.match(/buildConfigurationList\s*=\s*(\w+)/);if(!Y||!Z||!X)continue;let G=Y[1].replace(/^"|"$/g,""),K=Z[1],W=X[1];if(!$rQ.has(K))continue;let H=JrQ(A,W);B.push({name:G,bundleId:H,productType:K})}return B}function JrQ(A,Q){let B=new RegExp(`${XFA(Q)}\\s*\\/\\*[^*]*\\*\\/\\s*=\\s*\\{[^}]*isa\\s*=\\s*XCConfigurationList;[^}]*\\}`),$=A.match(B);if(!$)return"";let J=$[0].match(/buildConfigurations\s*=\s*\(([^)]*)\)/);if(!J)return"";let Y=Array.from(J[1].matchAll(/(\w+)/g),(X)=>X[1]);if(Y.length===0)return"";let Z="";for(let X of Y){let G=new RegExp(`${XFA(X)}\\s*\\/\\*[^*]*\\*\\/\\s*=\\s*\\{(?:[^{}]*\\{[^}]*\\})*[^}]*\\}`),K=A.match(G);if(!K)continue;let W=K[0],H=W.match(/PRODUCT_BUNDLE_IDENTIFIER\s*=\s*"?([^";\s]+)"?\s*;/);if(!H)continue;let U=W.match(/name\s*=\s*("[^"]*"|[^;\s]+)\s*;/);if((U?U[1].replace(/^"|"$/g,""):"")==="Release")return H[1];if(!Z)Z=H[1]}return Z}function aX(A){let Q=hx(A,"ios"),B=ynA(Q);if(B)return B;return ynA(A)}function ynA(A){if(!ZFA(A))return null;let Q;try{Q=vnA(A)}catch{return null}for(let B of Q)if(B.endsWith(".xcodeproj")){let $=hx(A,B,"project.pbxproj");if(ZFA($))return $}for(let B of Q){let $=hx(A,B),J;try{J=vnA($)}catch{continue}for(let Y of J)if(Y.endsWith(".xcodeproj")){let Z=hx($,Y,"project.pbxproj");if(ZFA(Z))return Z}}return null}function rX(A){let Q=aX(A);if(!Q)return null;try{return gnA(Q,"utf-8")}catch{return null}}function XFA(A){return A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hnA(A,Q,B){if(!A||!Q||Q===B)return{content:A,changed:0};let $=0,J=new RegExp(`(PRODUCT_BUNDLE_IDENTIFIER\\s*=\\s*)"?${XFA(Q)}"?(\\s*;)`,"g");return{content:A.replace(J,(Z,X,G)=>{return $++,`${X}${B}${G}`}),changed:$}}function Mj(A,Q,B,$){let J=aX(hx(A,Q))??aX(A);if(!J)return{changed:0};let Y=gnA(J,"utf-8"),{content:Z,changed:X}=hnA(Y,B,$);if(X>0)BrQ(J,Z,"utf-8");return{changed:X}}var $rQ;var t7=mA(()=>{$rQ=new Set(["com.apple.product-type.application","com.apple.product-type.app-extension","com.apple.product-type.app-extension.messages","com.apple.product-type.app-extension.messages-sticker-pack","com.apple.product-type.application.watchapp2","com.apple.product-type.watchkit2-extension","com.apple.product-type.extensionkit-extension","com.apple.product-type.application.on-demand-install-capable"])});var c0=$A((VrQ,$o)=>{(function(){function A(JA,dA){Object.defineProperty($.prototype,JA,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",dA[0],dA[1])}})}function Q(JA){if(JA===null||typeof JA!=="object")return null;return JA=MA&&JA[MA]||JA["@@iterator"],typeof JA==="function"?JA:null}function B(JA,dA){JA=(JA=JA.constructor)&&(JA.displayName||JA.name)||"ReactClass";var OQ=JA+"."+dA;fA[OQ]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",dA,JA),fA[OQ]=!0)}function $(JA,dA,OQ){this.props=JA,this.context=dA,this.refs=NA,this.updater=OQ||ZA}function J(){}function Y(JA,dA,OQ){this.props=JA,this.context=dA,this.refs=NA,this.updater=OQ||ZA}function Z(){}function X(JA){return""+JA}function G(JA){try{X(JA);var dA=!1}catch(L0){dA=!0}if(dA){dA=console;var OQ=dA.error,nQ=typeof Symbol==="function"&&Symbol.toStringTag&&JA[Symbol.toStringTag]||JA.constructor.name||"Object";return OQ.call(dA,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",nQ),X(JA)}}function K(JA){if(JA==null)return null;if(typeof JA==="function")return JA.$$typeof===jQ?null:JA.displayName||JA.name||null;if(typeof JA==="string")return JA;switch(JA){case d:return"Fragment";case m:return"Profiler";case x:return"StrictMode";case BA:return"Suspense";case zA:return"SuspenseList";case qA:return"Activity"}if(typeof JA==="object")switch(typeof JA.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),JA.$$typeof){case v:return"Portal";case g:return JA.displayName||"Context";case QA:return(JA._context.displayName||"Context")+".Consumer";case s:var dA=JA.render;return JA=JA.displayName,JA||(JA=dA.displayName||dA.name||"",JA=JA!==""?"ForwardRef("+JA+")":"ForwardRef"),JA;case YA:return dA=JA.displayName||null,dA!==null?dA:K(JA.type)||"Memo";case wA:dA=JA._payload,JA=JA._init;try{return K(JA(dA))}catch(OQ){}}return null}function W(JA){if(JA===d)return"<>";if(typeof JA==="object"&&JA!==null&&JA.$$typeof===wA)return"<...>";try{var dA=K(JA);return dA?"<"+dA+">":"<...>"}catch(OQ){return"<...>"}}function H(){var JA=X0.A;return JA===null?null:JA.getOwner()}function U(){return Error("react-stack-top-frame")}function q(JA){if(hQ.call(JA,"key")){var dA=Object.getOwnPropertyDescriptor(JA,"key").get;if(dA&&dA.isReactWarning)return!1}return JA.key!==void 0}function D(JA,dA){function OQ(){f0||(f0=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",dA))}OQ.isReactWarning=!0,Object.defineProperty(JA,"key",{get:OQ,configurable:!0})}function I(){var JA=K(this.type);return vB[JA]||(vB[JA]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),JA=this.props.ref,JA!==void 0?JA:null}function O(JA,dA,OQ,nQ,L0,yB){var DB=OQ.ref;return JA={$$typeof:c,type:JA,key:dA,props:OQ,_owner:nQ},(DB!==void 0?DB:null)!==null?Object.defineProperty(JA,"ref",{enumerable:!1,get:I}):Object.defineProperty(JA,"ref",{enumerable:!1,value:null}),JA._store={},Object.defineProperty(JA._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(JA,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(JA,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:L0}),Object.defineProperty(JA,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:yB}),Object.freeze&&(Object.freeze(JA.props),Object.freeze(JA)),JA}function V(JA,dA){return dA=O(JA.type,dA,JA.props,JA._owner,JA._debugStack,JA._debugTask),JA._store&&(dA._store.validated=JA._store.validated),dA}function N(JA){L(JA)?JA._store&&(JA._store.validated=1):typeof JA==="object"&&JA!==null&&JA.$$typeof===wA&&(JA._payload.status==="fulfilled"?L(JA._payload.value)&&JA._payload.value._store&&(JA._payload.value._store.validated=1):JA._store&&(JA._store.validated=1))}function L(JA){return typeof JA==="object"&&JA!==null&&JA.$$typeof===c}function C(JA){var dA={"=":"=0",":":"=2"};return"$"+JA.replace(/[=:]/g,function(OQ){return dA[OQ]})}function R(JA,dA){return typeof JA==="object"&&JA!==null&&JA.key!=null?(G(JA.key),C(""+JA.key)):dA.toString(36)}function E(JA){switch(JA.status){case"fulfilled":return JA.value;case"rejected":throw JA.reason;default:switch(typeof JA.status==="string"?JA.then(Z,Z):(JA.status="pending",JA.then(function(dA){JA.status==="pending"&&(JA.status="fulfilled",JA.value=dA)},function(dA){JA.status==="pending"&&(JA.status="rejected",JA.reason=dA)})),JA.status){case"fulfilled":return JA.value;case"rejected":throw JA.reason}}throw JA}function w(JA,dA,OQ,nQ,L0){var yB=typeof JA;if(yB==="undefined"||yB==="boolean")JA=null;var DB=!1;if(JA===null)DB=!0;else switch(yB){case"bigint":case"string":case"number":DB=!0;break;case"object":switch(JA.$$typeof){case c:case v:DB=!0;break;case wA:return DB=JA._init,w(DB(JA._payload),dA,OQ,nQ,L0)}}if(DB){DB=JA,L0=L0(DB);var nB=nQ===""?"."+R(DB,0):nQ;return cQ(L0)?(OQ="",nB!=null&&(OQ=nB.replace(A1,"$&/")+"/"),w(L0,dA,OQ,"",function(o4){return o4})):L0!=null&&(L(L0)&&(L0.key!=null&&(DB&&DB.key===L0.key||G(L0.key)),OQ=V(L0,OQ+(L0.key==null||DB&&DB.key===L0.key?"":(""+L0.key).replace(A1,"$&/")+"/")+nB),nQ!==""&&DB!=null&&L(DB)&&DB.key==null&&DB._store&&!DB._store.validated&&(OQ._store.validated=2),L0=OQ),dA.push(L0)),1}if(DB=0,nB=nQ===""?".":nQ+":",cQ(JA))for(var eB=0;eB<JA.length;eB++)nQ=JA[eB],yB=nB+R(nQ,eB),DB+=w(nQ,dA,OQ,yB,L0);else if(eB=Q(JA),typeof eB==="function")for(eB===JA.entries&&(M0||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),M0=!0),JA=eB.call(JA),eB=0;!(nQ=JA.next()).done;)nQ=nQ.value,yB=nB+R(nQ,eB++),DB+=w(nQ,dA,OQ,yB,L0);else if(yB==="object"){if(typeof JA.then==="function")return w(E(JA),dA,OQ,nQ,L0);throw dA=String(JA),Error("Objects are not valid as a React child (found: "+(dA==="[object Object]"?"object with keys {"+Object.keys(JA).join(", ")+"}":dA)+"). If you meant to render a collection of children, use an array instead.")}return DB}function S(JA,dA,OQ){if(JA==null)return JA;var nQ=[],L0=0;return w(JA,nQ,"","",function(yB){return dA.call(OQ,yB,L0++)}),nQ}function u(JA){if(JA._status===-1){var dA=JA._ioInfo;dA!=null&&(dA.start=dA.end=performance.now()),dA=JA._result;var OQ=dA();if(OQ.then(function(L0){if(JA._status===0||JA._status===-1){JA._status=1,JA._result=L0;var yB=JA._ioInfo;yB!=null&&(yB.end=performance.now()),OQ.status===void 0&&(OQ.status="fulfilled",OQ.value=L0)}},function(L0){if(JA._status===0||JA._status===-1){JA._status=2,JA._result=L0;var yB=JA._ioInfo;yB!=null&&(yB.end=performance.now()),OQ.status===void 0&&(OQ.status="rejected",OQ.reason=L0)}}),dA=JA._ioInfo,dA!=null){dA.value=OQ;var nQ=OQ.displayName;typeof nQ==="string"&&(dA.name=nQ)}JA._status===-1&&(JA._status=0,JA._result=OQ)}if(JA._status===1)return dA=JA._result,dA===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
268
+ )`).eq("name",B).eq("app_id",Q).maybeSingle();if(J){let Z=J.code==="PGRST116"||J.message?.includes("Cannot coerce")?`Multiple channels matched for app "${Q}" and channel "${B}". Contact support if this persists.`:J.message;throw C0.error(`Error fetching native packages: ${Z}`),Error(`Error fetching native packages: ${Z}`)}if(!$)return QiA([]);return QiA($.version?.native_packages??[])}function mB(A,Q){return A||Q?.plugins?.CapacitorUpdater?.appId||Q?.appId}function LH(A){let Q=[];if(!A.localVersion)return{compatible:!0,reasons:[],message:"Package only exists on remote (will be removed)"};if(!A.remoteVersion)return Q.push("new_plugin"),{compatible:!1,reasons:Q,message:"New native plugin added (requires app store update)"};let B=!1;try{let H=yp(A.localVersion),U=yp(A.remoteVersion);B=FSA(H,U)}catch{B=!1}if(!B)Q.push("version_mismatch");if(A.localRequestedVersion&&A.remoteRequestedVersion&&A.localRequestedVersion.trim()!==A.remoteRequestedVersion.trim())Q.push("requested_version_changed");let $=(H)=>typeof H==="string"&&H.trim().length>0,J=$(A.localIosChecksum)&&$(A.remoteIosChecksum)&&A.localIosChecksum!==A.remoteIosChecksum,Y=$(A.localAndroidChecksum)&&$(A.remoteAndroidChecksum)&&A.localAndroidChecksum!==A.remoteAndroidChecksum;if(J&&Y)Q.push("both_platforms_changed");else if(J)Q.push("ios_code_changed");else if(Y)Q.push("android_code_changed");let Z=$(A.localIosChecksum)!==$(A.remoteIosChecksum),X=$(A.localAndroidChecksum)!==$(A.remoteAndroidChecksum);if(Z||X)Q.push("platform_checksum_metadata_changed");let G=[],K=(H)=>H!=="requested_version_changed";for(let H of Q)switch(H){case"version_mismatch":G.push(`version changed: ${A.remoteVersion} → ${A.localVersion}`);break;case"requested_version_changed":G.push(`requested version changed: ${A.remoteRequestedVersion??"unknown"} → ${A.localRequestedVersion??"unknown"}`);break;case"ios_code_changed":G.push("iOS native code changed");break;case"android_code_changed":G.push("Android native code changed");break;case"both_platforms_changed":G.push("iOS and Android native code changed");break;case"platform_checksum_metadata_changed":G.push("iOS/Android checksum metadata appeared or disappeared (may be Capgo CLI change — verify native code)");break;case"new_plugin":G.push("new plugin (requires app store update)");break;case"removed_plugin":G.push("plugin removed");break}if(!Q.some(K))return{compatible:!0,reasons:Q,message:G.length>0?G.join(", "):"Compatible"};return{compatible:!1,reasons:Q,message:G.join(", ")}}function s7(A){return LH(A).compatible}async function Gj(A,Q,B,$,J){let Y=await _HA($,J),Z=await TiA(A,Q,B),X=Y.filter((K)=>!!K.native).map((K)=>{let W=Z.get(K.name);if(W)return{name:K.name,localVersion:K.version,localRequestedVersion:K.requested_version,remoteVersion:W.version,remoteRequestedVersion:W.requested_version,localIosChecksum:K.ios_checksum,remoteIosChecksum:W.ios_checksum,localAndroidChecksum:K.android_checksum,remoteAndroidChecksum:W.android_checksum};return{name:K.name,localVersion:K.version,localRequestedVersion:K.requested_version,remoteVersion:void 0,localIosChecksum:K.ios_checksum,localAndroidChecksum:K.android_checksum}}),G=[...Z].filter(([K])=>!Y.some((W)=>W.name===K)).map(([K,W])=>({name:K,localVersion:void 0,remoteVersion:W.version,remoteRequestedVersion:W.requested_version,remoteIosChecksum:W.ios_checksum,remoteAndroidChecksum:W.android_checksum}));return X.push(...G),{finalCompatibility:X,localDependencies:Y}}async function Sx(A,Q,B,$){let J=await TiA(A,Q,B),Y=$.map((X)=>{let G=J.get(X.name);if(G)return{name:X.name,localVersion:X.version,localRequestedVersion:X.requested_version,remoteVersion:G.version,remoteRequestedVersion:G.requested_version,localIosChecksum:X.ios_checksum,remoteIosChecksum:G.ios_checksum,localAndroidChecksum:X.android_checksum,remoteAndroidChecksum:G.android_checksum};return{name:X.name,localVersion:X.version,localRequestedVersion:X.requested_version,remoteVersion:void 0,localIosChecksum:X.ios_checksum,localAndroidChecksum:X.android_checksum}}),Z=[...J].filter(([X])=>!$.some((G)=>G.name===X)).map(([X,G])=>({name:X,localVersion:void 0,remoteVersion:G.version,remoteRequestedVersion:G.requested_version,remoteIosChecksum:G.ios_checksum,remoteAndroidChecksum:G.android_checksum}));return Y.push(...Z),{finalCompatibility:Y,localDependencies:$}}function SiA(A){if(!p1(A))return null;try{return JSON.parse(n9(A,"utf-8"))}catch{return null}}function Cr(A){if(!A)return!1;return/@capgo\/capacitor-updater|CapgoCapacitorUpdater|CapacitorUpdaterPlugin/.test(A)}function wnQ(A){let Q=SiA(A);if(!Q)return!1;let B=Q.packageClassList;return Array.isArray(B)&&B.includes("CapacitorUpdaterPlugin")}function PnQ(A,Q){if(!Q)return N8(A,R8);return yL.isAbsolute(Q)?Q:L$(A,Q)}function THA(A=j5(),Q){let B=PnQ(A,Q),$=yL.basename(B)===R8?s2(B):B,J=[N8($,"ios","App"),N8(A,"ios","App")].find((E)=>p1(E));if(!J)return{shouldCheck:!1,valid:!0,details:[]};let Y=SiA(B),Z={...Y?.dependencies,...Y?.devDependencies,...Y?.optionalDependencies},X=Object.hasOwn(Z,"@capgo/capacitor-updater"),G=[$,A].some((E)=>p1(N8(E,"node_modules","@capgo","capacitor-updater"))),K=N8(J,"Podfile"),W=N8(J,"CapApp-SPM","Package.swift"),H=p1(K)?n9(K,"utf-8"):void 0,U=p1(W)?n9(W,"utf-8"):void 0,q=Cr(H)||Cr(U),D=N8(J,"Podfile.lock"),I=N8(J,"App","capacitor.plugins.json"),O=N8(J,"App","capacitor.config.json"),V=p1(D)?n9(D,"utf-8"):void 0,N=p1(I)?n9(I,"utf-8"):void 0,L=Cr(V)||Cr(N)||wnQ(O);if(!(X||G||q||L))return{shouldCheck:!1,valid:!0,details:[]};let R=[];if(!q)R.push(`Missing @capgo/capacitor-updater in iOS dependency files (${K} or ${W})`);if(!L)R.push(`Missing @capgo/capacitor-updater in iOS native project outputs (${D}, ${I}, or ${O})`);return{shouldCheck:!0,valid:q&&L,details:R}}function _nQ(A,Q,B){if(!A.shouldCheck||A.valid)return;let $=br(Q,"ios");B?.(),C0.error("Capgo iOS dependency sync verification failed.");for(let J of A.details)C0.error(J);throw C0.error("Stop here to avoid testing on a broken native iOS project."),C0.warn($.summary),C0.info($.command),new qQ(aJA)}async function kiA(A,Q,B,$){let J=await l1({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(VB(J)){if(A&&Q&&B)await sq("onboarding-v2",Q,B,"canceled");throw C0.warn("Canceled Capacitor sync"),new qQ("Capacitor sync cancelled")}if(J){let Y=E8(),Z=h4();Z.start("Running the command...");let X;try{await new Promise((G,K)=>{let W=siQ(Y.runner,["cap","sync"],{stdio:"pipe"});W.on("close",(H)=>{if(H===0)G();else K(Error(`Command failed with exit code ${H}`))}),W.on("error",(H)=>{K(H)})})}catch(G){X=G,C0.error(`Failed to run Capacitor sync: ${G}`),C0.warn(`Please run "${Y.runner} cap sync" manually to ensure encrypted updates work properly`)}if($?.validateIosUpdater)_nQ(THA(j5(),$.packageJsonPath),Y.runner,()=>Z.stop("iOS sync check failed ❌"));if(X){Z.stop("Error");return}Z.stop("Capacitor sync completed ✅")}else{let Y=E8();C0.warn("⚠️ Important: If you upload encrypted bundles without syncing, updates will fail!"),C0.info(`Remember to run "${Y.runner} cap sync" before uploading encrypted bundles`)}}var CHA,VHA,GiA,Rr,C0,$j=".capgo_key",sJ=".capgo_key_v2",Er,dZ,opA="https://capgo.app",spA="https://files.capgo.app",OH="https://api.capgo.app",CD="https://console.capgo.app",KiA=120000,eiQ=20971520,AnQ=1073741824,QnQ=103809024,Rx,Ex=1e4,NHA="BundleUploadTimeoutError",R8="package.json",tpA="Cannot connect to server please try again later",gL,UiA,IHA=null,Lr=null,wr="5.10.0",Pr="6.25.0",Px="7.0.30",LHA=!1,xL="npm",Aj="install",Vr="npx";var w0=mA(()=>{Dk();WB();pG();ukA();p7();pi();Uk();kyA();Hb();ri();hYA();_b();sG();VR();l2();Gr();o3A();D8();Kr();Ur();zr();CHA=eA(M5A(),1),VHA=eA(fk(),1),GiA=eA(AxA(),1),Rr=eA(li(),1);C0={error:(A)=>Mr("error",A),info:(A)=>Mr("info",A),success:(A)=>Mr("success",A),warn:(A)=>Mr("warn",A)},Er=`${$j}.pub`,dZ=`${sJ}.pub`;Rx=[0,1000,3000,5000,1e4];gL=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i;UiA=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/});function Kj(A,Q,B={},$){let J=`${A}:${Q}`,Y=xr.get(J);if(Y)return Y;let Z=(async()=>{try{if($?.aborted)return;if(B.fetchOwnerOrg)return await B.fetchOwnerOrg(A,Q,$);if(B.createClient){let W=(await B.createClient(A,void 0,void 0,!0,!1)).from("apps").select("owner_org").eq("app_id",Q);if($)W=W.abortSignal($);let{data:H}=await W.maybeSingle();return H?.owner_org??void 0}let{data:X,error:G}=await $1(`app/${encodeURIComponent(Q)}`,{apikey:A,method:"GET",body:void 0,signal:$});if(G||!X?.owner_org)return;return X.owner_org}catch{return}})();return xr.set(J,Z),Z.then((X)=>{if(!X)xr.delete(J)}).catch(()=>{xr.delete(J)}),Z}var xr;var fr=mA(()=>{w0();xr=new Map});import{AsyncLocalStorage as TnQ}from"node:async_hooks";import{env as biA}from"node:process";function SnQ(){return wW(biA.CAPGO_DISABLE_TELEMETRY)||wW(biA.CAPGO_DISABLE_POSTHOG)}function knQ(A){vr.add(A),A.finally(()=>vr.delete(A))}async function nZ(A=2000){if(vr.size===0)return;let Q;if(await Promise.race([Promise.allSettled([...vr]),new Promise((B)=>{Q=setTimeout(B,A),Q.unref?.()})]),Q)clearTimeout(Q);for(let B of yr)B.abort();yr.clear()}function bnQ(A,Q){let B=xiA.get(A);if(B)return B;let $=(async()=>{try{let J=await m0(!0).catch(()=>{return}),Y=mB("",J?.config)||void 0;if(!Y)return{};let Z=await Kj(A,Y,{},Q);return{appId:Y,orgId:Z}}catch{return{}}})();return xiA.set(A,$),$}function E0(A){if(SnQ())return Promise.resolve();let Q=A.apikey??H4();if(!Q)return Promise.resolve();let B=new AbortController;yr.add(B);let $=(async()=>{try{let{appId:J,orgId:Y}=A;if(J===void 0&&Y===void 0){let X=await bnQ(Q,B.signal);J=X.appId,Y=X.orgId}let Z={...J?{app_id:J}:{},...A.tags??{}};await jB(Q,{channel:A.channel,event:A.event,tracking_version:2,...A.timestamp?{timestamp:A.timestamp}:{},...Y?{org_id:Y}:{},tags:Z,...A.nonPersonTags?{nonPersonTags:A.nonPersonTags}:{}},!1,B.signal).catch(()=>{})}catch{}finally{yr.delete(B)}})();return knQ($),$}function viA(A){return{flags:Object.keys(A.opts()).filter((B)=>A.getOptionValueSource(B)==="cli").sort(),positional_arg_count:A.args.length}}function yiA(A,Q,B){E0({apikey:B,channel:kHA,event:"CLI Command Invoked",tags:{command_path:A,flags:Q.flags.join(","),flags_count:Q.flags.length,positional_arg_count:Q.positional_arg_count}})}function giA(A,Q,B){Wj=Date.now(),bHA=A,yiA(A,Q,B)}function hiA(A,Q){Wj=Date.now(),bHA=A,SHA={commandPath:A,ctx:Q}}function kx(A){let Q=SHA;if(!Q)return;SHA=void 0,yiA(Q.commandPath,Q.ctx,A)}function uiA(A){E0({channel:kHA,event:"CLI Command Succeeded",tags:{command_path:A,...Wj?{duration_ms:Date.now()-Wj}:{}}})}function xHA(A,Q){E0({channel:kHA,event:"CLI Command Failed",tags:{command_path:A,error_category:Q.errorCategory,exit_code:Q.exitCode,...Wj?{duration_ms:Date.now()-Wj}:{}}})}function ciA(A,Q){return(...$)=>fiA.run(`mcp:${A}`,async()=>{let J=Date.now(),Y=!0;try{let Z=await Q(...$);if(Z&&typeof Z==="object"&&"isError"in Z&&Z.isError)Y=!1;return Z}catch(Z){throw Y=!1,Z}finally{E0({channel:miA,event:"MCP Tool Invoked",tags:{tool_name:A,success:Y,duration_ms:Date.now()-J}})}})}function diA(A){E0({channel:miA,event:"MCP Server Started",tags:{has_apikey:A,mcp_sdk_version:$6.version}})}function fnQ(A){let Q=A.durationMs>mTA;if(A.ok&&!Q)return;let B=fiA.getStore()??bHA,$={operation:cTA(A.url,A.method),method:A.method,status_code:A.status,duration_ms:A.durationMs,ok:A.ok,slow:Q};if(A.source)$.source=A.source;if(B)$.command_path=B;if(!A.ok)$.error_category=A.error!==void 0?mM(A.error):bTA(A.status);E0({apikey:A.apikey,channel:xnQ,event:"Supabase Call",tags:$})}var vr,yr,xiA,kHA="cli-usage",Wj=0,bHA="",fiA,SHA,miA="mcp",xnQ="cli-perf";var f8=mA(()=>{fZ();VR();w0();fr();Uk();pi();Uk();vr=new Set,yr=new Set;xiA=new Map;fiA=new TnQ;uTA(fnQ)});import{randomBytes as SaQ}from"node:crypto";import{appendFile as kaQ,chmod as baQ,lstat as VnA,mkdir as xaQ,readFile as NnA,rename as faQ,rm as vaQ,writeFile as yaQ}from"node:fs/promises";import{dirname as gaQ,join as haQ}from"node:path";async function vx(A){try{if((await VnA(A)).isSymbolicLink())throw Error(`Refusing to access symbolic link path: ${A}`)}catch(Q){if(Q.code!=="ENOENT")throw Q}}async function RD(A,Q){if(await vx(A),await xaQ(A,{recursive:!0,mode:Q}),!(await VnA(A)).isDirectory())throw Error(`Expected a directory at ${A}`);await baQ(A,Q)}async function RnA(A,Q,B=384){await vx(A),await kaQ(A,Q,{mode:B})}async function dY(A,Q,B={}){let $=B.mode??384;await vx(A);let J=haQ(gaQ(A),`.capgo-tmp-${SaQ(8).toString("hex")}`);try{await yaQ(J,Q,{encoding:B.encoding??"utf-8",mode:$}),await faQ(J,A)}catch(Y){throw await vaQ(J,{force:!0}),Y}}async function ir(A){return await vx(A),await NnA(A,"utf-8")}async function EnA(A){return await vx(A),await NnA(A)}var e2=()=>{};import{stderr as uaQ}from"node:process";function oHA(A){return Array.from(A,(Q)=>{let B=Q.codePointAt(0);return B<=31||B>=127&&B<=159||B>=8232&&B<=8238||B>=8294&&B<=8297?`\\u${B.toString(16).padStart(4,"0")}`:Q}).join("")}function nr(A){return new Promise((Q,B)=>{uaQ.write(A,($)=>$?B($):Q())})}var ED=(A)=>oHA(JSON.stringify(A??""));var yx=()=>{};import{Buffer as maQ}from"node:buffer";import{readFile as caQ}from"node:fs/promises";import{homedir as daQ}from"node:os";import{join as rr}from"node:path";import{cwd as _nA,env as laQ}from"node:process";function bnA(A){return A?rr(_nA(),knA):SnA}function paQ(A){return A?null:TnA}function Uj(A){let B=A.trim().match(/^(\d+)\s*([smhd])?$/i);if(!B)throw Error("output-retention must be a number with optional unit: s, m, h, d (examples: 1h, 3600s, 2d)");let $=Number.parseInt(B[1],10),J=(B[2]||"s").toLowerCase(),Z=$*(J==="s"?1:J==="m"?60:J==="h"?3600:86400);if(Z<AU)throw Error(`output-retention must be at least ${AU} seconds (1h)`);if(Z>jnA)throw Error(`output-retention must be at most ${jnA} seconds (7d)`);return Z}function w5(A){if(A===void 0)return!0;if(typeof A==="boolean")return A;let Q=A.trim().toLowerCase();if(Q==="true"||Q==="1"||Q==="yes")return!0;if(Q==="false"||Q==="0"||Q==="no")return!1;throw Error("output-upload must be true/false (examples: --output-upload, --output-upload false)")}function zj(A){if(typeof A==="string"&&A.trim()==="")throw Error("in-app-update-priority must be an integer between 0 and 5");let Q=typeof A==="number"?A:Number(A);if(!Number.isInteger(Q)||Q<0||Q>5)throw Error("in-app-update-priority must be an integer between 0 and 5");return Q}function tHA(A){let Q=A.trim().toLowerCase();if(!wnA.includes(Q))throw Error(`android-track must be one of: ${wnA.join(", ")}`);return Q}function eHA(A){let Q=A.trim(),B=Q.toLowerCase()==="inprogress"?"inProgress":Q;if(!PnA.includes(B))throw Error(`android-release-status must be one of: ${PnA.join(", ")}`);return B}async function ar(A){return(await caQ(A)).toString("base64")}function sHA(A){return A!==null&&typeof A==="object"&&!Array.isArray(A)}function iaQ(A){if(!sHA(A))return!1;for(let Q of Object.values(A)){if(!sHA(Q))return!1;for(let B of["ios","android"]){if(!Object.hasOwn(Q,B))continue;let $=Q[B];if(!sHA($)||Object.values($).some((J)=>typeof J!=="string"))return!1}}return!0}async function lL(A,Q=!1){let B=bnA(A),$;try{$=await ir(B)}catch(Y){if(Y.code==="ENOENT")return{};if(Q)throw Error(`Cannot read saved credentials file: ${ED(B)}`);return{}}let J;try{J=JSON.parse($)}catch{if(Q)throw Error(`Cannot parse saved credentials file: ${ED(B)}`);return{}}if(Q&&!iaQ(J))throw Error(`Invalid saved credentials structure: ${ED(B)}`);return J}async function v8(A,Q,B=!1){if(Q!==void 0){let Y=await lL(Q,B);if(!A){let Z=Object.keys(Y);if(Z.length===0)return null;return Y[Z[0]]||null}return Y[A]||null}let $=await lL(!0,B),J=await lL(!1,B);if(!A){let Y=Object.keys($);if(Y.length>0)return $[Y[0]]||null;let Z=Object.keys(J);if(Z.length===0)return null;return J[Z[0]]||null}return $[A]||J[A]||null}async function gx(A,Q){let B=bnA(Q),$=paQ(Q);if($)await RD($,448);await dY(B,JSON.stringify(A,null,2),{mode:384})}function u4(A){return laQ[A]}function naQ(){let A={},Q=u4("BUILD_CERTIFICATE_BASE64"),B=u4("P12_PASSWORD"),$=u4("APPLE_KEY_ID"),J=u4("APPLE_ISSUER_ID"),Y=u4("APPLE_KEY_CONTENT"),Z=u4("APP_STORE_CONNECT_TEAM_ID"),X=u4("FASTLANE_USER"),G=u4("FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD"),K=u4("APPLE_APP_ID"),W=u4("CAPGO_IOS_SCHEME"),H=u4("CAPGO_IOS_TARGET"),U=u4("CAPGO_IOS_PROVISIONING_MAP"),q=u4("CAPGO_IOS_PROVISIONING_MAP_BASE64"),D=U||(q?maQ.from(q,"base64").toString("utf-8"):void 0),O=u4("CAPGO_ANDROID_FLAVOR")?.trim()||void 0,V=u4("ANDROID_KEYSTORE_FILE"),N=u4("KEYSTORE_KEY_ALIAS"),L=u4("KEYSTORE_KEY_PASSWORD"),C=u4("KEYSTORE_STORE_PASSWORD"),R=u4("PLAY_CONFIG_JSON"),E=u4("PLAY_STORE_TRACK"),w=u4("PLAY_STORE_RELEASE_STATUS"),S=u4("PLAY_STORE_IN_APP_UPDATE_PRIORITY"),u=u4("BUILD_OUTPUT_UPLOAD_ENABLED"),k=u4("BUILD_OUTPUT_RETENTION_SECONDS"),b=u4("SKIP_BUILD_NUMBER_BUMP"),h=u4("SKIP_MARKETING_VERSION_BUMP"),r=u4("CAPGO_IOS_DISTRIBUTION"),e=u4("CAPGO_STORE_SUBMIT_REVIEW"),n=u4("CAPGO_STORE_RELEASE_NAME"),l=u4("CAPGO_STORE_RELEASE_NOTES"),c=u4("CAPGO_STORE_RELEASE_NOTES_LOCALIZED"),v=u4("CAPGO_IOS_TESTFLIGHT_GROUPS"),d=u4("CAPGO_IOS_AUTOMATIC_RELEASE");if(Q)A.BUILD_CERTIFICATE_BASE64=Q;if(B)A.P12_PASSWORD=B;if($)A.APPLE_KEY_ID=$;if(J)A.APPLE_ISSUER_ID=J;if(Y)A.APPLE_KEY_CONTENT=Y;if(Z)A.APP_STORE_CONNECT_TEAM_ID=Z;if(X)A.FASTLANE_USER=X;if(G)A.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=G;if(K)A.APPLE_APP_ID=K;if(W)A.CAPGO_IOS_SCHEME=W;if(e)A.CAPGO_STORE_SUBMIT_REVIEW=w5(e)?"true":"false";if(n?.trim())A.CAPGO_STORE_RELEASE_NAME=n.trim();if(l?.trim())A.CAPGO_STORE_RELEASE_NOTES=l.trim();if(c?.trim())A.CAPGO_STORE_RELEASE_NOTES_LOCALIZED=c.trim();if(v?.trim())A.CAPGO_IOS_TESTFLIGHT_GROUPS=v.trim();if(d)A.CAPGO_IOS_AUTOMATIC_RELEASE=w5(d)?"true":"false";if(H)A.CAPGO_IOS_TARGET=H;if(r)A.CAPGO_IOS_DISTRIBUTION=r;if(D)A.CAPGO_IOS_PROVISIONING_MAP=D;let x=O?.trim();if(x)A.CAPGO_ANDROID_FLAVOR=x;if(V)A.ANDROID_KEYSTORE_FILE=V;if(N)A.KEYSTORE_KEY_ALIAS=N;if(L)A.KEYSTORE_KEY_PASSWORD=L;if(C)A.KEYSTORE_STORE_PASSWORD=C;if(R)A.PLAY_CONFIG_JSON=R;if(E?.trim())A.PLAY_STORE_TRACK=tHA(E);if(w?.trim())A.PLAY_STORE_RELEASE_STATUS=eHA(w);if(S)A.PLAY_STORE_IN_APP_UPDATE_PRIORITY=String(zj(S));if(u)A.BUILD_OUTPUT_UPLOAD_ENABLED=w5(u)?"true":"false";if(k)A.BUILD_OUTPUT_RETENTION_SECONDS=String(Uj(k));if(b)A.SKIP_BUILD_NUMBER_BUMP=w5(b)?"true":"false";if(h)A.SKIP_MARKETING_VERSION_BUMP=w5(h)?"true":"false";return A}async function or(A,Q,B){let $=await v8(A),J=naQ(),Y={...$?.[Q]||{}};if(Object.assign(Y,J),B)Object.assign(Y,B);if(Q==="android"){let Z=!!Y.KEYSTORE_KEY_PASSWORD,X=!!Y.KEYSTORE_STORE_PASSWORD;if(Z&&!X)Y.KEYSTORE_STORE_PASSWORD=Y.KEYSTORE_KEY_PASSWORD;else if(!Z&&X)Y.KEYSTORE_KEY_PASSWORD=Y.KEYSTORE_STORE_PASSWORD}return Object.keys(Y).length>0?Y:void 0}async function AFA(A,Q,B={}){let $={...B};if(A==="ios"){if(Q.BUILD_CERTIFICATE_FILE)$.BUILD_CERTIFICATE_BASE64=await ar(Q.BUILD_CERTIFICATE_FILE);if(Q.APPLE_KEY_FILE)$.APPLE_KEY_CONTENT=await ar(Q.APPLE_KEY_FILE)}else if(A==="android"){if(Q.ANDROID_KEYSTORE_PATH)$.ANDROID_KEYSTORE_FILE=await ar(Q.ANDROID_KEYSTORE_PATH);if(Q.PLAY_CONFIG_JSON_PATH)$.PLAY_CONFIG_JSON=await ar(Q.PLAY_CONFIG_JSON_PATH)}return $}async function e6(A,Q,B,$){let J=await lL($),Y=J[A]||{};Y[Q]={...Y[Q],...B},J[A]=Y,await gx(J,$)}async function jD(A,Q,B,$){let J=await lL($),Y=J[A];if(!Y||!Y[Q])return;for(let Z of B)delete Y[Q][Z];J[A]=Y,await gx(J,$)}async function qj(A,Q,B){let $=await lL(B);if(!A){await gx({},B);return}if(!Q){delete $[A],await gx($,B);return}let J=$[A]||{};if(delete J[Q],Object.keys(J).length===0)delete $[A];else $[A]=J;await gx($,B)}async function sr(A,Q,B){return(await v8(A,B))?.[Q]||null}async function Dj(A){let Q=await lL(A);return Object.keys(Q)}function QU(){return rr(_nA(),knA)}function BU(){return SnA}var TnA,SnA,knA=".capgo-credentials.json",AU=3600,jnA=604800,wnA,PnA;var lY=mA(()=>{e2();yx();TnA=rr(daQ(),".capgo-credentials"),SnA=rr(TnA,"credentials.json");wnA=["internal","alpha","beta","production"],PnA=["draft","completed","inProgress","halted"]});import{Buffer as BFA}from"node:buffer";import{createHash as aaQ}from"node:crypto";import{readFileSync as xnA}from"node:fs";function $FA(A){let Q=xnA(A);return YFA(Q,A)}function JFA(A){let Q=BFA.from(A,"base64");return YFA(Q,"<base64 input>")}function fnA(A){let Q=xnA(A);return Oj(Q,A)}function Ij(A){let Q=BFA.from(A,"base64");return Oj(Q,"<base64 input>")}function YFA(A,Q){let J=A.indexOf("<?xml"),Y=J!==-1?A.indexOf("</plist>",J):-1;if(J===-1||Y===-1||Y<=J)throw Error(`No embedded plist found in mobileprovision file: ${Q}`);let Z=A.slice(J,Y+8).toString("utf-8"),X=tr(Z,"Name");if(!X)throw Error(`Mobileprovision file missing required 'Name' key: ${Q}`);let G=tr(Z,"UUID")||"",K=QrQ(Z,"Entitlements","application-identifier")||"",W=K.indexOf("."),H=W!==-1?K.slice(W+1):K;return{name:X,uuid:G,applicationIdentifier:K,bundleId:H}}function Oj(A,Q="<buffer input>"){let B=YFA(A,Q),$="<?xml",J="</plist>",Y=A.indexOf("<?xml"),Z=A.indexOf("</plist>",Y),X=A.slice(Y,Z+8).toString("utf-8"),G=raQ(X),K=tr(X,"ExpirationDate","date")||"",W=oaQ(X),H=saQ(X),U=ArQ(X);return{...B,teamId:G,expirationDate:K,profileType:W,certificateSha1s:H,profileEntitlements:U}}function raQ(A){let Q=A.match(/<key>TeamIdentifier<\/key>\s*<array>([\s\S]*?)<\/array>/);if(Q){let B=Q[1].match(/<string>([^<]+)<\/string>/);if(B)return B[1]}return""}function oaQ(A){if(/<key>ProvisionsAllDevices<\/key>\s*<true\s*\/>/.test(A))return"enterprise";let B=/<key>ProvisionedDevices<\/key>\s*<array>/.test(A),$=/<key>get-task-allow<\/key>\s*<true\s*\/>/.test(A);if(B){if($)return"development";return"ad_hoc"}return"app_store"}function saQ(A){let Q=A.match(/<key>DeveloperCertificates<\/key>\s*<array>([\s\S]*?)<\/array>/);if(!Q)return[];let B=[];for(let $ of Q[1].matchAll(/<data>([\s\S]*?)<\/data>/g)){let J=$[1].replace(/\s+/g,"");if(!J)continue;try{let Y=BFA.from(J,"base64"),Z=aaQ("sha1").update(Y).digest("hex").toLowerCase();B.push(Z)}catch{}}return B}function taQ(A){return A==="application-identifier"||A.endsWith(".team-identifier")}function eaQ(A){return Array.from(A.matchAll(/<string>([\s\S]*?)<\/string>/g),(Q)=>Q[1].trim())}function ArQ(A){let Q=A.match(/<key>Entitlements<\/key>\s*<dict>([\s\S]*?)<\/dict>/)?.[1];if(Q===void 0)return{};let B={},$=/<key>([\s\S]*?)<\/key>\s*(?:<(true|false)\s*\/>|<array>([\s\S]*?)<\/array>|<([a-z]+)>([\s\S]*?)<\/\4>)/g;for(let J of Q.matchAll($)){let Y=J[1].trim();if(Y in B||taQ(Y))continue;if(J[2]!==void 0)B[Y]=J[2]==="true";else if(J[3]!==void 0)B[Y]=eaQ(J[3]);else if(J[4]==="string")B[Y]=J[5].trim();else B[Y]=J[5].trim()}return B}function tr(A,Q,B="string"){let $=QFA(B),J=new RegExp(`<key>${QFA(Q)}</key>\\s*<${$}>([^<]*)</${$}>`),Y=A.match(J);return Y?Y[1]:null}function QrQ(A,Q,B){let $=new RegExp(`<key>${QFA(Q)}</key>\\s*<dict>([\\s\\S]*?)</dict>`),J=A.match($);if(!J)return null;return tr(J[1],B)}function QFA(A){return A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var wD=()=>{};var ux={};d9(ux,{writeReleaseBundleId:()=>Mj,replaceBundleIdInPbxproj:()=>hnA,readPbxproj:()=>rX,findXcodeProject:()=>aX,findSignableTargets:()=>BK});import{existsSync as ZFA,readdirSync as vnA,readFileSync as gnA,writeFileSync as BrQ}from"node:fs";import{join as hx}from"node:path";function BK(A){if(!A)return[];let Q=/\w+\s*\/\*[^*]*\*\/\s*=\s*\{[^}]*isa\s*=\s*PBXNativeTarget;[^}]*\}/g,B=[];for(let $ of A.matchAll(Q)){let J=$[0],Y=J.match(/name\s*=\s*("[^"]*"|[^;\s]+)\s*;/),Z=J.match(/productType\s*=\s*"([^"]+)"/),X=J.match(/buildConfigurationList\s*=\s*(\w+)/);if(!Y||!Z||!X)continue;let G=Y[1].replace(/^"|"$/g,""),K=Z[1],W=X[1];if(!$rQ.has(K))continue;let H=JrQ(A,W);B.push({name:G,bundleId:H,productType:K})}return B}function JrQ(A,Q){let B=new RegExp(`${XFA(Q)}\\s*\\/\\*[^*]*\\*\\/\\s*=\\s*\\{[^}]*isa\\s*=\\s*XCConfigurationList;[^}]*\\}`),$=A.match(B);if(!$)return"";let J=$[0].match(/buildConfigurations\s*=\s*\(([^)]*)\)/);if(!J)return"";let Y=Array.from(J[1].matchAll(/(\w+)/g),(X)=>X[1]);if(Y.length===0)return"";let Z="";for(let X of Y){let G=new RegExp(`${XFA(X)}\\s*\\/\\*[^*]*\\*\\/\\s*=\\s*\\{(?:[^{}]*\\{[^}]*\\})*[^}]*\\}`),K=A.match(G);if(!K)continue;let W=K[0],H=W.match(/PRODUCT_BUNDLE_IDENTIFIER\s*=\s*"?([^";\s]+)"?\s*;/);if(!H)continue;let U=W.match(/name\s*=\s*("[^"]*"|[^;\s]+)\s*;/);if((U?U[1].replace(/^"|"$/g,""):"")==="Release")return H[1];if(!Z)Z=H[1]}return Z}function aX(A){let Q=hx(A,"ios"),B=ynA(Q);if(B)return B;return ynA(A)}function ynA(A){if(!ZFA(A))return null;let Q;try{Q=vnA(A)}catch{return null}for(let B of Q)if(B.endsWith(".xcodeproj")){let $=hx(A,B,"project.pbxproj");if(ZFA($))return $}for(let B of Q){let $=hx(A,B),J;try{J=vnA($)}catch{continue}for(let Y of J)if(Y.endsWith(".xcodeproj")){let Z=hx($,Y,"project.pbxproj");if(ZFA(Z))return Z}}return null}function rX(A){let Q=aX(A);if(!Q)return null;try{return gnA(Q,"utf-8")}catch{return null}}function XFA(A){return A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hnA(A,Q,B){if(!A||!Q||Q===B)return{content:A,changed:0};let $=0,J=new RegExp(`(PRODUCT_BUNDLE_IDENTIFIER\\s*=\\s*)"?${XFA(Q)}"?(\\s*;)`,"g");return{content:A.replace(J,(Z,X,G)=>{return $++,`${X}${B}${G}`}),changed:$}}function Mj(A,Q,B,$){let J=aX(hx(A,Q))??aX(A);if(!J)return{changed:0};let Y=gnA(J,"utf-8"),{content:Z,changed:X}=hnA(Y,B,$);if(X>0)BrQ(J,Z,"utf-8");return{changed:X}}var $rQ;var t7=mA(()=>{$rQ=new Set(["com.apple.product-type.application","com.apple.product-type.app-extension","com.apple.product-type.app-extension.messages","com.apple.product-type.app-extension.messages-sticker-pack","com.apple.product-type.application.watchapp2","com.apple.product-type.watchkit2-extension","com.apple.product-type.extensionkit-extension","com.apple.product-type.application.on-demand-install-capable"])});var c0=$A((VrQ,$o)=>{(function(){function A(JA,dA){Object.defineProperty($.prototype,JA,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",dA[0],dA[1])}})}function Q(JA){if(JA===null||typeof JA!=="object")return null;return JA=MA&&JA[MA]||JA["@@iterator"],typeof JA==="function"?JA:null}function B(JA,dA){JA=(JA=JA.constructor)&&(JA.displayName||JA.name)||"ReactClass";var OQ=JA+"."+dA;fA[OQ]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",dA,JA),fA[OQ]=!0)}function $(JA,dA,OQ){this.props=JA,this.context=dA,this.refs=NA,this.updater=OQ||ZA}function J(){}function Y(JA,dA,OQ){this.props=JA,this.context=dA,this.refs=NA,this.updater=OQ||ZA}function Z(){}function X(JA){return""+JA}function G(JA){try{X(JA);var dA=!1}catch(L0){dA=!0}if(dA){dA=console;var OQ=dA.error,nQ=typeof Symbol==="function"&&Symbol.toStringTag&&JA[Symbol.toStringTag]||JA.constructor.name||"Object";return OQ.call(dA,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",nQ),X(JA)}}function K(JA){if(JA==null)return null;if(typeof JA==="function")return JA.$$typeof===jQ?null:JA.displayName||JA.name||null;if(typeof JA==="string")return JA;switch(JA){case d:return"Fragment";case m:return"Profiler";case x:return"StrictMode";case BA:return"Suspense";case zA:return"SuspenseList";case qA:return"Activity"}if(typeof JA==="object")switch(typeof JA.tag==="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),JA.$$typeof){case v:return"Portal";case g:return JA.displayName||"Context";case QA:return(JA._context.displayName||"Context")+".Consumer";case s:var dA=JA.render;return JA=JA.displayName,JA||(JA=dA.displayName||dA.name||"",JA=JA!==""?"ForwardRef("+JA+")":"ForwardRef"),JA;case YA:return dA=JA.displayName||null,dA!==null?dA:K(JA.type)||"Memo";case wA:dA=JA._payload,JA=JA._init;try{return K(JA(dA))}catch(OQ){}}return null}function W(JA){if(JA===d)return"<>";if(typeof JA==="object"&&JA!==null&&JA.$$typeof===wA)return"<...>";try{var dA=K(JA);return dA?"<"+dA+">":"<...>"}catch(OQ){return"<...>"}}function H(){var JA=X0.A;return JA===null?null:JA.getOwner()}function U(){return Error("react-stack-top-frame")}function q(JA){if(hQ.call(JA,"key")){var dA=Object.getOwnPropertyDescriptor(JA,"key").get;if(dA&&dA.isReactWarning)return!1}return JA.key!==void 0}function D(JA,dA){function OQ(){f0||(f0=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",dA))}OQ.isReactWarning=!0,Object.defineProperty(JA,"key",{get:OQ,configurable:!0})}function I(){var JA=K(this.type);return vB[JA]||(vB[JA]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),JA=this.props.ref,JA!==void 0?JA:null}function O(JA,dA,OQ,nQ,L0,yB){var DB=OQ.ref;return JA={$$typeof:c,type:JA,key:dA,props:OQ,_owner:nQ},(DB!==void 0?DB:null)!==null?Object.defineProperty(JA,"ref",{enumerable:!1,get:I}):Object.defineProperty(JA,"ref",{enumerable:!1,value:null}),JA._store={},Object.defineProperty(JA._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(JA,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(JA,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:L0}),Object.defineProperty(JA,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:yB}),Object.freeze&&(Object.freeze(JA.props),Object.freeze(JA)),JA}function V(JA,dA){return dA=O(JA.type,dA,JA.props,JA._owner,JA._debugStack,JA._debugTask),JA._store&&(dA._store.validated=JA._store.validated),dA}function N(JA){L(JA)?JA._store&&(JA._store.validated=1):typeof JA==="object"&&JA!==null&&JA.$$typeof===wA&&(JA._payload.status==="fulfilled"?L(JA._payload.value)&&JA._payload.value._store&&(JA._payload.value._store.validated=1):JA._store&&(JA._store.validated=1))}function L(JA){return typeof JA==="object"&&JA!==null&&JA.$$typeof===c}function C(JA){var dA={"=":"=0",":":"=2"};return"$"+JA.replace(/[=:]/g,function(OQ){return dA[OQ]})}function R(JA,dA){return typeof JA==="object"&&JA!==null&&JA.key!=null?(G(JA.key),C(""+JA.key)):dA.toString(36)}function E(JA){switch(JA.status){case"fulfilled":return JA.value;case"rejected":throw JA.reason;default:switch(typeof JA.status==="string"?JA.then(Z,Z):(JA.status="pending",JA.then(function(dA){JA.status==="pending"&&(JA.status="fulfilled",JA.value=dA)},function(dA){JA.status==="pending"&&(JA.status="rejected",JA.reason=dA)})),JA.status){case"fulfilled":return JA.value;case"rejected":throw JA.reason}}throw JA}function w(JA,dA,OQ,nQ,L0){var yB=typeof JA;if(yB==="undefined"||yB==="boolean")JA=null;var DB=!1;if(JA===null)DB=!0;else switch(yB){case"bigint":case"string":case"number":DB=!0;break;case"object":switch(JA.$$typeof){case c:case v:DB=!0;break;case wA:return DB=JA._init,w(DB(JA._payload),dA,OQ,nQ,L0)}}if(DB){DB=JA,L0=L0(DB);var nB=nQ===""?"."+R(DB,0):nQ;return cQ(L0)?(OQ="",nB!=null&&(OQ=nB.replace(A1,"$&/")+"/"),w(L0,dA,OQ,"",function(o4){return o4})):L0!=null&&(L(L0)&&(L0.key!=null&&(DB&&DB.key===L0.key||G(L0.key)),OQ=V(L0,OQ+(L0.key==null||DB&&DB.key===L0.key?"":(""+L0.key).replace(A1,"$&/")+"/")+nB),nQ!==""&&DB!=null&&L(DB)&&DB.key==null&&DB._store&&!DB._store.validated&&(OQ._store.validated=2),L0=OQ),dA.push(L0)),1}if(DB=0,nB=nQ===""?".":nQ+":",cQ(JA))for(var eB=0;eB<JA.length;eB++)nQ=JA[eB],yB=nB+R(nQ,eB),DB+=w(nQ,dA,OQ,yB,L0);else if(eB=Q(JA),typeof eB==="function")for(eB===JA.entries&&(M0||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),M0=!0),JA=eB.call(JA),eB=0;!(nQ=JA.next()).done;)nQ=nQ.value,yB=nB+R(nQ,eB++),DB+=w(nQ,dA,OQ,yB,L0);else if(yB==="object"){if(typeof JA.then==="function")return w(E(JA),dA,OQ,nQ,L0);throw dA=String(JA),Error("Objects are not valid as a React child (found: "+(dA==="[object Object]"?"object with keys {"+Object.keys(JA).join(", ")+"}":dA)+"). If you meant to render a collection of children, use an array instead.")}return DB}function S(JA,dA,OQ){if(JA==null)return JA;var nQ=[],L0=0;return w(JA,nQ,"","",function(yB){return dA.call(OQ,yB,L0++)}),nQ}function u(JA){if(JA._status===-1){var dA=JA._ioInfo;dA!=null&&(dA.start=dA.end=performance.now()),dA=JA._result;var OQ=dA();if(OQ.then(function(L0){if(JA._status===0||JA._status===-1){JA._status=1,JA._result=L0;var yB=JA._ioInfo;yB!=null&&(yB.end=performance.now()),OQ.status===void 0&&(OQ.status="fulfilled",OQ.value=L0)}},function(L0){if(JA._status===0||JA._status===-1){JA._status=2,JA._result=L0;var yB=JA._ioInfo;yB!=null&&(yB.end=performance.now()),OQ.status===void 0&&(OQ.status="rejected",OQ.reason=L0)}}),dA=JA._ioInfo,dA!=null){dA.value=OQ;var nQ=OQ.displayName;typeof nQ==="string"&&(dA.name=nQ)}JA._status===-1&&(JA._status=0,JA._result=OQ)}if(JA._status===1)return dA=JA._result,dA===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
269
269
 
270
270
  Your code should look like:
271
271
  const MyComponent = lazy(() => import('./MyComponent'))
@@ -1839,7 +1839,7 @@ export { CapgoNotifications }
1839
1839
  `}function dLQ(A,Q,B){let $=jt0(A,Q,{stdio:"inherit"});if($.error)throw $.error;if($.status!==0)throw Error(`${B} exited with code ${$.status}`)}function ft0(){let A=E8();f.info(`Installing notification packages with ${A.installCommand}`),dLQ(A.pm,[A.command,...kt0],"Notification package install")}function vt0(){let A=E8(),Q=XD(A.runner),B=V8(A.runner,["cap","sync"]);f.info(`Running ${B}`),dLQ(Q.command,[...Q.args,"cap","sync"],"Capacitor sync")}function lLQ(A,Q){let B=Tt0(St0(),A);if(wt0(B)&&!Q)throw Error(`${A} already exists. Re-run with --force to overwrite it.`);return B}async function yt0(A,Q,B,$){let J=lLQ(A,$);return Pt0(_t0(J),{recursive:!0}),await dY(J,xt0(Q,B),{mode:420}),J}async function pLQ(A,Q){a0("Capgo native notifications setup");let B=h4();try{let $=await m0(),J=A||bt0($);if(!J)throw Error("Missing appId. Pass it as `notifications setup com.example.app` or set it in capacitor.config.");let Y=Q.serverUrl||OH,Z=Q.file||"src/capgo-notifications.ts";if(lLQ(Z,Q.force),Q.install!==!1)ft0();B.start("Saving Capacitor notification config"),await jx("CapgoNotifications",{appId:J,serverUrl:Y}),B.stop("Capacitor notification config saved");let X=await yt0(Z,J,Y,Q.force);if(f.success(`Created ${X}`),Q.sync!==!1)vt0();f.info("Import setupCapgoNotifications(...) after your user is known, and pass your stable customer external ID."),f.info("Then configure Android and iOS push credentials in the Capgo app Notifications tab before sending production notifications."),$B("Notifications setup done")}catch($){throw B.stop("Notifications setup failed"),f.error(gA($)),$}}import{randomUUID as oEA}from"node:crypto";import{cwd as gt0}from"node:process";import{Worker as ht0}from"node:worker_threads";function ut0(A,Q,B,$){try{let J=A.optsWithGlobals(),Y=(W)=>{let H=A.registeredArguments.findIndex((U)=>U.name()===W);return H<0?void 0:A.args[H]},Z=(W)=>typeof W==="string"?W:void 0,X=$?.[0]??oEA(),G={cwd:gt0(),command:Q,attemptId:X,attemptIds:$,appId:Z(J.appId)??Y("appId"),apikey:Z(J.apikey)??Y("apikey"),capacitorConfig:Z(J.capacitorConfig),packageJson:Z(J.packageJson),mainFile:Z(J.mainFile),supaHost:Z(J.supaHost),supaAnon:Z(J.supaAnon)},K=new ht0(B,{workerData:G,stdout:!0,stderr:!0});K.stdout?.destroy(),K.stderr?.destroy(),K.on("error",()=>{}),InA(K,$??[X]),K.unref()}catch{}}function iLQ(A,Q){ut0(A,Q,new URL("./onboarding-worker.js",import.meta.url),[oEA(),oEA()])}WB();f8();var nLQ=eA(fk(),1);import rd from"node:process";var sEA=5000,mt0=new Set(["doctor","login","get-qr","app add","app delete","app list","app debug","app setting","app set","bundle upload","bundle compatibility","bundle delete","bundle list","bundle cleanup","bundle encrypt","bundle decrypt","bundle zip","channel add","channel delete","channel list","channel currentBundle","channel set","key save","key create","key delete_old","organization list","organization add","organization members","organization set","organization delete","organisation list","organisation add","organisation set","organisation delete","build request"]);function ct0(A,Q){return!!rd.stdin.isTTY&&!!rd.stdout.isTTY&&!nLQ.isCI&&mt0.has(A)&&!Q.json&&!Q.outputText&&!Q.quiet}async function aLQ(A,Q){let B=dr();if(!ct0(Q,A.optsWithGlobals())||B.size===0)return;let $,J=()=>rd.exit(130);rd.prependOnceListener("SIGINT",J);try{f.info("Waiting for background checks to finish (up to 5 seconds). Press Ctrl-C to exit immediately.");let Y=[...B.values()],Z=A.optsWithGlobals();E0({channel:"cli-usage",event:"background_checks_wait_started",apikey:typeof Z.apikey==="string"?Z.apikey:void 0,appId:typeof Z.appId==="string"?Z.appId:void 0,timestamp:new Date,nonPersonTags:{command_path:Q,pending_checks:Y.reduce((X,G)=>X+G.attemptIds.length,0),grace_period_ms:sEA,scan_attempt_ids:Y.flatMap((X)=>X.attemptIds)}}),await Promise.race([Promise.allSettled([...Y.map((X)=>X.completion),nZ(sEA)]),new Promise((X)=>{$=setTimeout(X,sEA)})])}finally{if($)clearTimeout($);rd.removeListener("SIGINT",J);for(let Y of B.keys())Y.terminate().catch(()=>{});await nZ(0)}}WB();WL();p9();import{stderr as rLQ,stdout as dt0}from"node:process";D8();w0();function oLQ(A,Q){if(A==null||A==="")return;let B=Number(A);if(!Number.isInteger(B)||B<=0)throw new qQ(`${Q} must be a positive integer`);return B}function lt0(A){let Q=oLQ(A,"--days");if(Q==null)return;let B=LEA.safeParse(Q);if(!B.success)throw new qQ("--days must be 1, 3, 7, or 30");return B.data}function pt0(A){let Q=oLQ(A,"--limit");if(Q==null)return;let B=vd.shape.limit.safeParse(Q);if(!B.success)throw new qQ("--limit must be between 1 and 100");return B.data}function it0(A){if(!A)return;if(!["slowest","fastest","newest","oldest"].includes(A))throw new qQ("--sort must be slowest, fastest, newest, or oldest");return A}function nt0(A){dt0.write(`${JSON.stringify(A,null,2)}
1840
1840
  `)}function at0(A){if(!A?.length)return;let Q=new RJ;Q.headers=["Severity","Finding","Next"],Q.rows=A.map((B)=>{let $=B.next?`${B.next.view??""}${B.next.action?` ${B.next.action}`:""}${B.next.sort?` ${B.next.sort}`:""}`:"";return[B.severity??"",B.title??"",$.trim()]}),f.info("Findings"),f.info(Q.toString());for(let B of A)if(B.detail)f.message(`${B.title}: ${B.detail}`)}async function wN(A,Q,B,$){if(!B.json)a0("Capgo Observe");try{await b8(B.json?{warn:(K)=>rLQ.write(`${K}
1841
1841
  `)}:void 0);let J=await m0(),Y=mB(Q,J?.config);if(!Y)throw new qQ("Missing app ID. Pass it as an argument or set it in capacitor.config.");let Z=$||B.device;if(A==="device"&&!Z)throw new qQ("Missing device ID. Example: npx @capgo/cli@latest observe device DEVICE_ID");let X=await o6A({appId:Y,view:A,days:lt0(B.days),action:B.action,deviceId:Z,versionName:B.versionName,sort:it0(B.sort),limit:pt0(B.limit),apikey:B.apikey,supaHost:B.supaHost,supaAnon:B.supaAnon});if(B.json){nt0(X);return}let G=X.findings;if(at0(G),typeof X.handoff_prompt==="string")f.info(X.handoff_prompt);if(A==="metrics"||A==="device"){let K=X.samples??X.events;if(K?.length){let W=new RJ;W.headers=["Time","Action","Device","Version","Duration","Route"],W.rows=K.map((H)=>[String(H.created_at??""),String(H.action??""),String(H.device_id??""),String(H.version_name??""),H.duration_ms==null?"":String(H.duration_ms),String(H.route??"")]),f.info(W.toString())}else f.warn("No samples in this window.")}else if(A==="routes"){let K=X.routes;if(K?.length){let W=new RJ;W.headers=["Route","Events","Devices","P50","P90"],W.rows=K.map((H)=>[String(H.route??""),String(H.events??""),String(H.devices??""),H.p50_ms==null?"":String(H.p50_ms),H.p90_ms==null?"":String(H.p90_ms)]),f.info(W.toString())}else f.warn("No route metadata yet. Listen to history/popstate/hashchange and send action=app_nav with metadata.route.")}else if(A==="events"){let K=X.actions;if(K?.length){let W=new RJ;W.headers=["Action","Events","Devices","Last seen"],W.rows=K.map((H)=>[String(H.action??""),String(H.total??""),String(H.device_count??""),String(H.last_seen??"")]),f.info(W.toString())}else f.warn("No observe events in this window.")}else if(A==="versions"||A==="summary"){let K=X.versions;if(K?.length){let W=new RJ;W.headers=["Version","Devices","Issue-free","Launch P90"],W.rows=K.map((H)=>[String(H.version_name??""),String(H.devices??""),H.issue_free_rate==null?"":String(H.issue_free_rate),H.launch_p90_ms==null?"":String(H.launch_p90_ms)]),f.info(W.toString())}}$B("Done")}catch(J){let Y=gA(J);if(B.json)rLQ.write(`${Y}
1842
- `);else f.error(Y);throw J}}WB();WL();f8();p9();w0();function rt0(A,Q,B){if(B)return;if(!A.length){f.error("No members found");return}let $=new RJ;$.headers=Q.hasPasswordPolicy?["Email","Role","Status","2FA Enabled","Password Policy"]:["Email","Role","Status","2FA Enabled"],$.rows=[];for(let J of A){let Y=J.is_tmp?"Invited":"Active",Z=J.has_2fa?"✓ Yes":"✗ No",X=J.password_policy_compliant?"✓ Compliant":"✗ Non-compliant",G=[J.email,J.role,Y,Z];if(Q.hasPasswordPolicy)G.push(X);$.rows.push(G)}f.success(`Members of "${Q.orgName}"`),f.success($.toString())}async function ot0(A,Q,B=!1){if(!B)a0("List organization members");await b8();let $={...Q,apikey:Q.apikey||x0()};if(!$.apikey){if(!B)f.error("Missing API key, you need to provide an API key to list members");throw Error("Missing API key")}if(!A){if(!B)f.error("Missing argument, you need to provide an organization ID");throw Error("Missing organization id")}let J=await wB($.apikey,$.supaHost,$.supaAnon);await Xj(J,$.apikey,"org.read_members",A,`Insufficient permissions to list members of organization ${A}`,B),await Jj(J,A,B);let{data:Y,error:Z}=await J.from("orgs").select("name, enforcing_2fa, password_policy_config, require_apikey_expiration, max_apikey_expiration_days, enforce_hashed_api_keys").eq("id",A).single();if(Z||!Y){if(!B)f.error(`Cannot get organization details: ${gA(Z)}`);throw Error(`Cannot get organization details: ${gA(Z)}`)}let X=Y.password_policy_config,G=X?.enabled??!1;if(!B)f.info(`Getting members of "${Y.name}" from Capgo`);let{data:K,error:W}=await $1(`organization/members?orgId=${encodeURIComponent(A)}`,{apikey:$.apikey,method:"GET",body:void 0,supaHost:$.supaHost,supaAnon:$.supaAnon});if(W){if(!B)f.error(`Cannot get organization members: ${gA(W)}`);throw Error(`Cannot get organization members: ${gA(W)}`)}let{data:H,error:U}=await J.rpc("check_org_members_2fa_enabled",{org_id:A});if(U){if(!B)if(U.message?.includes("NO_RIGHTS"))f.warn("You need super_admin rights to view 2FA status of members");else f.error(`Cannot get 2FA status: ${gA(U)}`)}let q=null;if(G){let{data:I,error:O}=await J.rpc("check_org_members_password_policy",{org_id:A});if(O){if(!B)if(O.message?.includes("NO_RIGHTS"))f.warn("You need super_admin rights to view password policy compliance status");else f.warn(`Cannot get password policy status: ${gA(O)}`)}else q=I}let D=(K||[]).map((I)=>{let O=H?.find((N)=>N.user_id===I.uid),V=q?.find((N)=>N.user_id===I.uid);return{uid:I.uid,email:I.email,role:I.role,is_tmp:I.is_tmp,has_2fa:O?.["2fa_enabled"]??!1,password_policy_compliant:V?.password_policy_compliant??!1}});if(E0({channel:"organization",event:"Org Members Listed",tags:{member_count:D.length,with_2fa_count:D.filter((I)=>I.has_2fa).length}}),!B){if(f.info(`Members found: ${D.length}`),f.info(""),f.info("Security Settings:"),Y.enforcing_2fa)f.info(" \uD83D\uDD10 2FA enforcement: ENABLED");else f.info(" 2FA enforcement: Disabled");if(G)f.info(" \uD83D\uDD11 Password policy: ENABLED"),f.info(` - Minimum length: ${X.min_length} characters`),f.info(` - Require uppercase: ${X.require_uppercase?"Yes":"No"}`),f.info(` - Require number: ${X.require_number?"Yes":"No"}`),f.info(` - Require special: ${X.require_special?"Yes":"No"}`);else f.info(" Password policy: Disabled");if(Y.require_apikey_expiration){if(f.info(" ⏰ API key expiration required: ENABLED"),Y.max_apikey_expiration_days)f.info(` - Maximum expiration: ${Y.max_apikey_expiration_days} days`)}else f.info(" API key expiration required: Disabled");if(Y.enforce_hashed_api_keys)f.info(" \uD83D\uDD12 Hashed API keys: ENABLED");else f.info(" Hashed API keys: Disabled");f.info("");let I=D.filter((V)=>!V.is_tmp),O=I.filter((V)=>!V.has_2fa);if(f.info("Member Summary:"),f.info(` Total active members: ${I.length}`),f.info(` Members with 2FA: ${I.length-O.length}`),f.info(` Members without 2FA: ${O.length}`),G){let V=I.filter((N)=>!N.password_policy_compliant);f.info(` Password policy compliant: ${I.length-V.length}`),f.info(` Password policy non-compliant: ${V.length}`)}f.info(""),rt0(D,{orgName:Y.name,hasPasswordPolicy:G},B),$B("Done ✅")}return D}async function tEA(A,Q){await ot0(A,Q,!1)}VR();PEA();WB();f8();import{exit as od,stdin as st0,stdout as tt0}from"node:process";l2();w0();var sLQ={fail(A){z7(A),od(1)},finish(A){J$(A)}},tLQ={fail(A){f.error(A),od(1)},finish(A){f.info(A)}};async function et0(){J$("Run device test canceled."),od(1)}function Ae0(){return!!st0.isTTY&&!!tt0.isTTY}function Qe0(A){f.info("Non-interactive mode: iOS device selection needs an interactive terminal."),f.info(`List devices with: ${V8(A.runner,["cap","run","ios","--list"])}`),f.info(`Run a specific device with: ${V8(A.runner,["cap","run","ios","--target","<id>"])}`),f.error("Run device test failed."),od(1)}function Be0(A,Q){let B=["cap","run",Q];return{args:B,command:V8(A.runner,B)}}async function $e0(A,Q){if(A)return lDQ(A);if(!Q)throw Error('No platform provided. Run in an interactive terminal to choose iOS or Android, or pass "ios" or "android".');let B=await U6({message:"You did not provide a platform. Which platform do you want to start on?",options:[{value:"ios",label:"iOS"},{value:"android",label:"Android"}]});if(VB(B))_TA("Run device test canceled."),od(1);return B}function Je0(A){HU({headerTitle:"\uD83D\uDCF1 Capgo Run Device",title:"Run Device",introLines:[`${A==="ios"?"iOS":"Android"} selected.`,A==="ios"?"Pick a physical device or simulator.":"Pick a device or emulator."],phaseLabel:"Device",statusLine:"Reload the list if your target is not visible yet.",tone:"blue"})}function Ye0(A,Q){let B=Y6();B.start(`Running: ${Q.command}`);let $=tNA(A.runner,Q.args,{stdio:"inherit"});if($.error||$.status!==0){if(B.stop("App failed to start ❌"),$.error)GA.error(gA($.error));GA.info(`You can run the command manually with: ${Q.command}`),sLQ.fail("Run device test failed.")}B.stop("App started ✅")}function Ze0(A,Q){f.info(`Running: ${Q.command}`);let B=tNA(A.runner,Q.args,{stdio:"inherit"});if(B.error||B.status!==0){if(B.error)f.error(gA(B.error));f.info(`You can run the command manually with: ${Q.command}`),tLQ.fail("Run device test failed.")}f.info("App started")}async function eLQ(A,Q={}){let B=Ae0(),$=B?sLQ:tLQ;try{let J=E8(),Y=await $e0(A,B);if(E0({channel:"cli-usage",event:"Run On Device",tags:{platform:Y}}),!B){let X=Be0(J,Y);if(Q.launch===!1){$.finish(`Resolved run command: ${X.command}`);return}if(Y==="ios")Qe0(J);Ze0(J,X),$.finish(`Run device test finished. Manual command: ${X.command}`);return}Je0(Y);let Z=await QRA(et0,J,Y);if(!Z.args){$.finish(`Skipped device launch. Manual command: ${Z.command}`);return}if(Q.launch===!1){$.finish(`Resolved run command: ${Z.command}`);return}Ye0(J,Z),$.finish(`Run device test finished. Manual command: ${Z.command}`)}catch(J){$.fail(`Run device test failed: ${gA(J)}`)}}D8();Ur();WB();f8();w0();async function Xe0(A,Q){let[B,$]=await Promise.all([F4(A,Q,!0),A.rpc("request_actor_email_adress")]);if($.error)throw $.error;if(!$.data)throw Error("Account email not found for this API key");return{userId:B,email:$.data}}async function ACQ(A){a0("Account details");let Q=A.apikey||x0();if(!Q)throw f.error("Missing API key, you need to provide an API key to fetch account details"),Error("Missing API key");try{let B=await wB(Q,A.supaHost,A.supaAnon),{userId:$,email:J}=await Xe0(B,Q);f.info(CG({headers:["Account ID","Account email"],rows:[[$,J]]})),E0({channel:"account",event:"Account Identity Viewed",apikey:Q,tags:{}}),$B("Done ✅")}catch(B){throw f.error(`Error getting account details ${gA(B)}`),B instanceof Error?B:Error(String(B))}}w0();var bQ={apikey:"API key to link to your account",supaHost:"Custom Supabase host URL (for self-hosting or Capgo development)",supaAnon:"Custom Supabase anon key (for self-hosting)",packageJson:"Paths to package.json files for monorepos (comma-separated)",nodeModules:"Paths to node_modules directories for monorepos (comma-separated)",capacitorConfig:"Capacitor config source to update (useful with dynamic monorepo configs)",verbose:"Enable verbose output with detailed logging",ignoreNotifyAppReady:"Skip notifyAppReady() check (not recommended — updates may roll back)",acceptIncompatible:"Accept native-package incompatibility as handled (still checks and warns, continues, skips the crash-warning email). Use this when your app already guards missing plugins at runtime.",acceptIncompatibleChannel:"Accept native-package incompatibility as handled (still checks and warns, sets the channel instead of failing). Use this when your app already guards missing plugins at runtime."};function BM(A,Q){return Q.concat([A])}z6.name($6.name).description("\uD83D\uDCE6 Manage packages and bundle versions in Capgo Cloud").version($6.version,"-v, --version","output the current version").option("--capacitor-config <path>",bQ.capacitorConfig);Fk();var PG="unknown",AjA;z6.hook("preAction",(A,Q)=>{WH(oG(Q.optsWithGlobals().capacitorConfig,Ge0(),{logError:!0})),PG=Pp(Q),AjA=Q,iTA(PG),jp(PG,Q.opts()),iLQ(Q,PG);let B=viA(Q);if(PG==="login"||PG==="init")hiA(PG,B);else giA(PG,B)});z6.hook("postAction",(A,Q)=>{try{uiA(Pp(Q))}finally{if(Pp(Q)!=="mcp")WH()}});z6.command("init [apikey] [appId]").alias("i").description(`\uD83D\uDE80 Initialize a new app in Capgo Cloud with step-by-step guidance.
1842
+ `);else f.error(Y);throw J}}WB();WL();f8();p9();w0();function rt0(A,Q,B){if(B)return;if(!A.length){f.error("No members found");return}let $=new RJ;$.headers=Q.hasPasswordPolicy?["Email","Role","Status","2FA Enabled","Password Policy"]:["Email","Role","Status","2FA Enabled"],$.rows=[];for(let J of A){let Y=J.is_tmp?"Invited":"Active",Z=J.has_2fa?"✓ Yes":"✗ No",X=J.password_policy_compliant?"✓ Compliant":"✗ Non-compliant",G=[J.email,J.role,Y,Z];if(Q.hasPasswordPolicy)G.push(X);$.rows.push(G)}f.success(`Members of "${Q.orgName}"`),f.success($.toString())}async function ot0(A,Q,B=!1){if(!B)a0("List organization members");await b8();let $={...Q,apikey:Q.apikey||x0()};if(!$.apikey){if(!B)f.error("Missing API key, you need to provide an API key to list members");throw Error("Missing API key")}if(!A){if(!B)f.error("Missing argument, you need to provide an organization ID");throw Error("Missing organization id")}let J=await wB($.apikey,$.supaHost,$.supaAnon);await Xj(J,$.apikey,"org.read_members",A,`Insufficient permissions to list members of organization ${A}`,B),await Jj(J,A,B);let{data:Y,error:Z}=await J.from("orgs").select("name, enforcing_2fa, password_policy_config, require_apikey_expiration, max_apikey_expiration_days, enforce_hashed_api_keys").eq("id",A).single();if(Z||!Y){if(!B)f.error(`Cannot get organization details: ${gA(Z)}`);throw Error(`Cannot get organization details: ${gA(Z)}`)}let X=Y.password_policy_config,G=X?.enabled??!1;if(!B)f.info(`Getting members of "${Y.name}" from Capgo`);let{data:K,error:W}=await $1(`organization/members?orgId=${encodeURIComponent(A)}`,{apikey:$.apikey,method:"GET",body:void 0,supaHost:$.supaHost,supaAnon:$.supaAnon});if(W){if(!B)f.error(`Cannot get organization members: ${gA(W)}`);throw Error(`Cannot get organization members: ${gA(W)}`)}let{data:H,error:U}=await J.rpc("check_org_members_2fa_enabled",{org_id:A});if(U){if(!B)if(U.message?.includes("NO_RIGHTS"))f.warn("You need super_admin rights to view 2FA status of members");else f.error(`Cannot get 2FA status: ${gA(U)}`)}let q=null;if(G){let{data:I,error:O}=await J.rpc("check_org_members_password_policy",{org_id:A});if(O){if(!B)if(O.message?.includes("NO_RIGHTS"))f.warn("You need super_admin rights to view password policy compliance status");else f.warn(`Cannot get password policy status: ${gA(O)}`)}else q=I}let D=(K||[]).map((I)=>{let O=H?.find((N)=>N.user_id===I.uid),V=q?.find((N)=>N.user_id===I.uid);return{uid:I.uid,email:I.email,role:I.role,is_tmp:I.is_tmp,has_2fa:O?.["2fa_enabled"]??!1,password_policy_compliant:V?.password_policy_compliant??!1}});if(E0({channel:"organization",event:"Org Members Listed",tags:{member_count:D.length,with_2fa_count:D.filter((I)=>I.has_2fa).length}}),!B){if(f.info(`Members found: ${D.length}`),f.info(""),f.info("Security Settings:"),Y.enforcing_2fa)f.info(" \uD83D\uDD10 2FA enforcement: ENABLED");else f.info(" 2FA enforcement: Disabled");if(G)f.info(" \uD83D\uDD11 Password policy: ENABLED"),f.info(` - Minimum length: ${X.min_length} characters`),f.info(` - Require uppercase: ${X.require_uppercase?"Yes":"No"}`),f.info(` - Require number: ${X.require_number?"Yes":"No"}`),f.info(` - Require special: ${X.require_special?"Yes":"No"}`);else f.info(" Password policy: Disabled");if(Y.require_apikey_expiration){if(f.info(" ⏰ API key expiration required: ENABLED"),Y.max_apikey_expiration_days)f.info(` - Maximum expiration: ${Y.max_apikey_expiration_days} days`)}else f.info(" API key expiration required: Disabled");if(Y.enforce_hashed_api_keys)f.info(" \uD83D\uDD12 Hashed API keys: ENABLED");else f.info(" Hashed API keys: Disabled");f.info("");let I=D.filter((V)=>!V.is_tmp),O=I.filter((V)=>!V.has_2fa);if(f.info("Member Summary:"),f.info(` Total active members: ${I.length}`),f.info(` Members with 2FA: ${I.length-O.length}`),f.info(` Members without 2FA: ${O.length}`),G){let V=I.filter((N)=>!N.password_policy_compliant);f.info(` Password policy compliant: ${I.length-V.length}`),f.info(` Password policy non-compliant: ${V.length}`)}f.info(""),rt0(D,{orgName:Y.name,hasPasswordPolicy:G},B),$B("Done ✅")}return D}async function tEA(A,Q){await ot0(A,Q,!1)}VR();PEA();WB();f8();import{exit as od,stdin as st0,stdout as tt0}from"node:process";l2();w0();var sLQ={fail(A){z7(A),od(1)},finish(A){J$(A)}},tLQ={fail(A){f.error(A),od(1)},finish(A){f.info(A)}};async function et0(){J$("Run device test canceled."),od(1)}function Ae0(){return!!st0.isTTY&&!!tt0.isTTY}function Qe0(A){f.info("Non-interactive mode: iOS device selection needs an interactive terminal."),f.info(`List devices with: ${V8(A.runner,["cap","run","ios","--list"])}`),f.info(`Run a specific device with: ${V8(A.runner,["cap","run","ios","--target","<id>"])}`),f.error("Run device test failed."),od(1)}function Be0(A,Q){let B=["cap","run",Q];return{args:B,command:V8(A.runner,B)}}async function $e0(A,Q){if(A)return lDQ(A);if(!Q)throw Error('No platform provided. Run in an interactive terminal to choose iOS or Android, or pass "ios" or "android".');let B=await U6({message:"You did not provide a platform. Which platform do you want to start on?",options:[{value:"ios",label:"iOS"},{value:"android",label:"Android"}]});if(VB(B))_TA("Run device test canceled."),od(1);return B}function Je0(A){HU({headerTitle:"\uD83D\uDCF1 Capgo Run Device",title:"Run Device",introLines:[`${A==="ios"?"iOS":"Android"} selected.`,A==="ios"?"Pick a physical device or simulator.":"Pick a device or emulator."],phaseLabel:"Device",statusLine:"Reload the list if your target is not visible yet.",tone:"blue"})}function Ye0(A,Q){let B=Y6();B.start(`Running: ${Q.command}`);let $=tNA(A.runner,Q.args,{stdio:"inherit"});if($.error||$.status!==0){if(B.stop("App failed to start ❌"),$.error)GA.error(gA($.error));GA.info(`You can run the command manually with: ${Q.command}`),sLQ.fail("Run device test failed.")}B.stop("App started ✅")}function Ze0(A,Q){f.info(`Running: ${Q.command}`);let B=tNA(A.runner,Q.args,{stdio:"inherit"});if(B.error||B.status!==0){if(B.error)f.error(gA(B.error));f.info(`You can run the command manually with: ${Q.command}`),tLQ.fail("Run device test failed.")}f.info("App started")}async function eLQ(A,Q={}){let B=Ae0(),$=B?sLQ:tLQ;try{let J=E8(),Y=await $e0(A,B);if(E0({channel:"cli-usage",event:"Run On Device",tags:{platform:Y}}),!B){let X=Be0(J,Y);if(Q.launch===!1){$.finish(`Resolved run command: ${X.command}`);return}if(Y==="ios")Qe0(J);Ze0(J,X),$.finish(`Run device test finished. Manual command: ${X.command}`);return}Je0(Y);let Z=await QRA(et0,J,Y);if(!Z.args){$.finish(`Skipped device launch. Manual command: ${Z.command}`);return}if(Q.launch===!1){$.finish(`Resolved run command: ${Z.command}`);return}Ye0(J,Z),$.finish(`Run device test finished. Manual command: ${Z.command}`)}catch(J){$.fail(`Run device test failed: ${gA(J)}`)}}D8();Ur();WB();f8();w0();async function Xe0(A,Q){let[B,$]=await Promise.all([F4(A,Q,!0),A.rpc("request_actor_email_adress")]);if($.error)throw $.error;if(!$.data)throw Error("Account email not found for this API key");return{userId:B,email:$.data}}async function ACQ(A){a0("Account details");let Q=A.apikey||x0();if(!Q)throw f.error("Missing API key, you need to provide an API key to fetch account details"),Error("Missing API key");try{let B=await wB(Q,A.supaHost,A.supaAnon),{userId:$,email:J}=await Xe0(B,Q);f.info(CG({headers:["Account ID","Account email"],rows:[[$,J]]})),E0({channel:"account",event:"Account Identity Viewed",apikey:Q,tags:{}}),$B("Done ✅")}catch(B){throw f.error(`Error getting account details ${gA(B)}`),B instanceof Error?B:Error(String(B))}}w0();var bQ={apikey:"API key to link to your account",supaHost:"Custom Supabase host URL (for self-hosting or Capgo development)",supaAnon:"Custom Supabase anon key (for self-hosting)",packageJson:"Paths to package.json files for monorepos (comma-separated)",nodeModules:"Paths to node_modules directories for monorepos (comma-separated)",capacitorConfig:"Capacitor config source to update (useful with dynamic monorepo configs)",verbose:"Enable verbose output with detailed logging",ignoreNotifyAppReady:"Skip notifyAppReady() check (not recommended — updates may roll back)",acceptIncompatible:"Accept native-package incompatibility as handled (still checks and warns, continues, skips the crash-warning email). Use this when your app already guards missing plugins at runtime.",acceptIncompatibleChannel:"Accept native-package incompatibility as handled (still checks and warns, sets the channel instead of failing). Use this when your app already guards missing plugins at runtime."};function BM(A,Q){return Q.concat([A])}z6.name($6.name).description("\uD83D\uDCE6 Manage packages and bundle versions in Capgo Cloud").version($6.version,"-v, --version","output the current version").option("--capacitor-config <path>",bQ.capacitorConfig);Fk();var PG="unknown",AjA;z6.hook("preAction",(A,Q)=>{WH(oG(Q.optsWithGlobals().capacitorConfig,Ge0(),{logError:!0})),PG=Pp(Q),AjA=Q,iTA(PG),jp(PG,Q.opts()),iLQ(Q,PG);let B=viA(Q);if(PG==="login"||PG==="init")hiA(PG,B);else{let $=Q.optsWithGlobals().apikey;giA(PG,B,typeof $==="string"?$:void 0)}});z6.hook("postAction",(A,Q)=>{try{uiA(Pp(Q))}finally{if(Pp(Q)!=="mcp")WH()}});z6.command("init [apikey] [appId]").alias("i").description(`\uD83D\uDE80 Initialize a new app in Capgo Cloud with step-by-step guidance.
1843
1843
 
1844
1844
  This includes adding code for updates, building, uploading your app, and verifying update functionality.
1845
1845
  Capgo bundles are web assets and can be fetched by anyone who knows the URL. Use encryption for banking, regulated, or other high-security apps.