@capgo/cli 8.32.0 → 8.32.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 mB=mA(()=>{dBA();dBA();SBA();PBA();TP=AQ(xBA(),1);lBA=TKQ(),SKQ=K$("◆","*"),jMA=K$("■","x"),wMA=K$("▲","x"),iBA=K$("◇","o"),bKQ=K$("┌","T"),M4=K$("│","|"),FF=K$("└","—"),Eq0=K$("┐","T"),Rq0=K$("┘","—"),pBA=K$("●",">"),Mu=K$("○"," "),jq0=K$("◻","[•]"),wq0=K$("◼","[+]"),Pq0=K$("◻","[ ]"),xKQ=K$("▪","•"),_q0=K$("─","-"),Tq0=K$("╮","+"),kq0=K$("├","+"),Sq0=K$("╯","+"),bq0=K$("╰","+"),xq0=K$("╭","+"),fKQ=K$("●","•"),vKQ=K$("◆","*"),yKQ=K$("▲","!"),gKQ=K$("■","x");fq0=[`${M0("dim","↑/↓")} to navigate`,`${M0("dim","Space:")} select`,`${M0("dim","Enter:")} confirm`],T={message:(A=[],{symbol:Q=M0("gray",M4),secondarySymbol:B=M0("gray",M4),output:$=process.stdout,spacing:J=1,withGuide:Y}={})=>{let Z=[],X=Y??OJ.withGuide,G=X?B:"",K=X?`${Q} `:"",W=X?`${B} `:"";for(let U=0;U<J;U++)Z.push(G);let F=Array.isArray(A)?A:A.split(`
68
68
  `);if(F.length>0){let[U,...q]=F;U.length>0?Z.push(`${K}${U}`):Z.push(X?Q:"");for(let z of q)z.length>0?Z.push(`${W}${z}`):Z.push(X?B:"")}$.write(`${Z.join(`
69
69
  `)}
70
- `)},info:(A,Q)=>{T.message(A,{...Q,symbol:M0("blue",fKQ)})},success:(A,Q)=>{T.message(A,{...Q,symbol:M0("green",vKQ)})},step:(A,Q)=>{T.message(A,{...Q,symbol:M0("green",iBA)})},warn:(A,Q)=>{T.message(A,{...Q,symbol:M0("yellow",yKQ)})},warning:(A,Q)=>{T.warn(A,Q)},error:(A,Q)=>{T.message(A,{...Q,symbol:M0("red",gKQ)})}},vq0={light:K$("─","-"),heavy:K$("━","="),block:K$("█","#")},dKQ=[`${M0("dim","↑/↓")} to navigate`,`${M0("dim","Enter:")} confirm`],yq0=`${M0("gray",M4)} `});var M$;var aX=mA(()=>{M$={name:"@capgo/cli",type:"module",version:"8.32.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/capgo.git",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test: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","test:credentials":"bun test/test-credentials.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test: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:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:init-replay":"bun test/test-init-replay.mjs","test:capacitor-config-target":"bun test/test-capacitor-config-target.mjs","test:init-monorepo-targeting":"bun run test:capacitor-config-target && 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:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:fail-on-incompatible && bun run test:native-dependencies && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test: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:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-monorepo-targeting && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:init-replay && 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:platform-flow-contract && bun run test:tail-engine-shared && bun run test:prescan && bun run test:android-reporting-api && 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: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: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","test:android-reporting-api":"bun test/test-android-reporting-api.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: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"},dependencies:{"@inkjs/ui":"^2.0.0","@rrweb/types":"^2.1.1","@xterm/addon-serialize":"^0.14.0","@xterm/headless":"^6.0.0","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",zod:"^4.4.3","@standard-schema/spec":"^1.1.0"},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","@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.1",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",typescript:"6.0.3",ws:"^8.21.1"}}});function rKQ(A){if(A&&typeof A==="object"&&"status"in A){let Q=A.status;if(typeof Q==="number")return Q}return}function sKQ(A){if(A instanceof Error)return A.message;if(typeof A==="string")return A;return""}function kP(A){if(A&&typeof A==="object"&&"code"in A){let $=A.code;if(typeof $==="string"&&$.startsWith("commander."))return"commander"}let Q=rKQ(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=sKQ(A).toLowerCase();if(/econnrefused|enotfound|fetch failed|network|socket|dns/.test(B))return"network_error";if(/timed out|timeout|etimedout|aborted/.test(B))return"timeout";if(/invalid|must be|required|not allowed|malformed|validation/.test(B))return"validation_error";return"unknown"}function bMA(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 eKQ}from"node:async_hooks";function nL(A,Q){return vMA.run(A,()=>Promise.resolve(Q()))}function AWQ(){return vMA.getStore()}function SP(){yMA=!0}function gMA(){return yMA}function uMA(A){hMA=A}function fMA(A){try{hMA?.(A)}catch{}}function cMA(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).replace(/^\/+|\/+$/g,"");return K?`${Q} functions:${K}`:`${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 QWQ(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 dMA(){return async(Q,B)=>{let $=(B?.method??"GET").toUpperCase(),J=typeof Q==="string"?Q:Q instanceof URL?Q.href:Q.url,Y=AWQ(),Z=QWQ(B),X=Date.now();try{let G=await globalThis.fetch(Q,B);return fMA({url:J,method:$,status:G.status,ok:G.ok,durationMs:Date.now()-X,source:Y,apikey:Z}),G}catch(G){throw fMA({url:J,method:$,status:0,ok:!1,durationMs:Date.now()-X,source:Y,apikey:Z,error:G}),G}}}var vMA,yMA=!1,hMA,mMA=5000;var bP=mA(()=>{vMA=new eKQ});import{homedir as lMA,platform as BWQ,release as $WQ}from"node:os";import{arch as JWQ,cwd as pMA,env as TI,version as YWQ}from"node:process";function OK(A){return A==="1"||A?.toLowerCase()==="true"||A?.toLowerCase()==="yes"}function KWQ(){if(OK(TI.CAPGO_DISABLE_TELEMETRY)||OK(TI.CAPGO_DISABLE_POSTHOG))return;return TI.CAPGO_CLI_POSTHOG_API_KEY?.trim()||TI.POSTHOG_API_KEY?.trim()||XWQ}function WWQ(A){let Q=A.replace(/\/+$/,"");if(Q.endsWith("/i/v0/e"))return`${Q}/`;let B=Q.replace(/\/capture$/,"/");return new URL("i/v0/e/",B.endsWith("/")?B:`${B}/`).toString()}function HWQ(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 FWQ(A){let Q=A,B=pMA(),$=lMA();if(B)Q=Q.replaceAll(B,"<cwd>");if($)Q=Q.replaceAll($,"~");return Q}function DWQ(A){let Q=A,B=pMA(),$=lMA();if(B)Q=Q.replaceAll(B,"<cwd>");if($)Q=Q.replaceAll($,"~");return Q.replace(/<cwd>\/[^\s"',)]+/g,"<cwd>/<path>").replace(/~\/[^\s"',)]+/g,"~/<path>").replace(/[\w.%+-]+@[\w.-]+\.[A-Z]{2,}/gi,"<email>").replace(/(https?:\/\/)([^/\s:@]+):([^/\s@]+)@/gi,"$1<redacted>@").replace(/\b[a-z][\w-]*(?:\.[\w-]+){2,}\b/gi,"<app_id>").replace(/\b[a-z]:\\[^\s"',)]+/gi,"<path>").replace(/(^|[\s"'(])\/[^\s"',)]+/g,"$1<path>").replace(/(--(?:token|api[-_]?key|key|password|secret|private[-_]?key|jwt|session|auth)(?:=|\s+))("[^"]+"|'[^']+'|\S+)/gi,"$1<redacted>").replace(/\b((?:token|api[-_]?key|password|secret|authorization)\s*[:=]\s*)[^\s,;]+/gi,"$1<redacted>")}function UWQ(A,Q){let B=A?.split(`
70
+ `)},info:(A,Q)=>{T.message(A,{...Q,symbol:M0("blue",fKQ)})},success:(A,Q)=>{T.message(A,{...Q,symbol:M0("green",vKQ)})},step:(A,Q)=>{T.message(A,{...Q,symbol:M0("green",iBA)})},warn:(A,Q)=>{T.message(A,{...Q,symbol:M0("yellow",yKQ)})},warning:(A,Q)=>{T.warn(A,Q)},error:(A,Q)=>{T.message(A,{...Q,symbol:M0("red",gKQ)})}},vq0={light:K$("─","-"),heavy:K$("━","="),block:K$("█","#")},dKQ=[`${M0("dim","↑/↓")} to navigate`,`${M0("dim","Enter:")} confirm`],yq0=`${M0("gray",M4)} `});var M$;var aX=mA(()=>{M$={name:"@capgo/cli",type:"module",version:"8.32.1",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/capgo.git",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test: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","test:credentials":"bun test/test-credentials.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test: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:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:init-replay":"bun test/test-init-replay.mjs","test:capacitor-config-target":"bun test/test-capacitor-config-target.mjs","test:init-monorepo-targeting":"bun run test:capacitor-config-target && 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:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:fail-on-incompatible && bun run test:native-dependencies && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test: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:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-monorepo-targeting && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:init-replay && 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:platform-flow-contract && bun run test:tail-engine-shared && bun run test:prescan && bun run test:android-reporting-api && 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: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: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","test:android-reporting-api":"bun test/test-android-reporting-api.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: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"},dependencies:{"@inkjs/ui":"^2.0.0","@rrweb/types":"^2.1.1","@xterm/addon-serialize":"^0.14.0","@xterm/headless":"^6.0.0","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",zod:"^4.4.3","@standard-schema/spec":"^1.1.0"},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","@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.1",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",typescript:"6.0.3",ws:"^8.21.1"}}});function rKQ(A){if(A&&typeof A==="object"&&"status"in A){let Q=A.status;if(typeof Q==="number")return Q}return}function sKQ(A){if(A instanceof Error)return A.message;if(typeof A==="string")return A;return""}function kP(A){if(A&&typeof A==="object"&&"code"in A){let $=A.code;if(typeof $==="string"&&$.startsWith("commander."))return"commander"}let Q=rKQ(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=sKQ(A).toLowerCase();if(/econnrefused|enotfound|fetch failed|network|socket|dns/.test(B))return"network_error";if(/timed out|timeout|etimedout|aborted/.test(B))return"timeout";if(/invalid|must be|required|not allowed|malformed|validation/.test(B))return"validation_error";return"unknown"}function bMA(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 eKQ}from"node:async_hooks";function nL(A,Q){return vMA.run(A,()=>Promise.resolve(Q()))}function AWQ(){return vMA.getStore()}function SP(){yMA=!0}function gMA(){return yMA}function uMA(A){hMA=A}function fMA(A){try{hMA?.(A)}catch{}}function cMA(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).replace(/^\/+|\/+$/g,"");return K?`${Q} functions:${K}`:`${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 QWQ(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 dMA(){return async(Q,B)=>{let $=(B?.method??"GET").toUpperCase(),J=typeof Q==="string"?Q:Q instanceof URL?Q.href:Q.url,Y=AWQ(),Z=QWQ(B),X=Date.now();try{let G=await globalThis.fetch(Q,B);return fMA({url:J,method:$,status:G.status,ok:G.ok,durationMs:Date.now()-X,source:Y,apikey:Z}),G}catch(G){throw fMA({url:J,method:$,status:0,ok:!1,durationMs:Date.now()-X,source:Y,apikey:Z,error:G}),G}}}var vMA,yMA=!1,hMA,mMA=5000;var bP=mA(()=>{vMA=new eKQ});import{homedir as lMA,platform as BWQ,release as $WQ}from"node:os";import{arch as JWQ,cwd as pMA,env as TI,version as YWQ}from"node:process";function OK(A){return A==="1"||A?.toLowerCase()==="true"||A?.toLowerCase()==="yes"}function KWQ(){if(OK(TI.CAPGO_DISABLE_TELEMETRY)||OK(TI.CAPGO_DISABLE_POSTHOG))return;return TI.CAPGO_CLI_POSTHOG_API_KEY?.trim()||TI.POSTHOG_API_KEY?.trim()||XWQ}function WWQ(A){let Q=A.replace(/\/+$/,"");if(Q.endsWith("/i/v0/e"))return`${Q}/`;let B=Q.replace(/\/capture$/,"/");return new URL("i/v0/e/",B.endsWith("/")?B:`${B}/`).toString()}function HWQ(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 FWQ(A){let Q=A,B=pMA(),$=lMA();if(B)Q=Q.replaceAll(B,"<cwd>");if($)Q=Q.replaceAll($,"~");return Q}function DWQ(A){let Q=A,B=pMA(),$=lMA();if(B)Q=Q.replaceAll(B,"<cwd>");if($)Q=Q.replaceAll($,"~");return Q.replace(/<cwd>\/[^\s"',)]+/g,"<cwd>/<path>").replace(/~\/[^\s"',)]+/g,"~/<path>").replace(/[\w.%+-]+@[\w.-]+\.[A-Z]{2,}/gi,"<email>").replace(/(https?:\/\/)([^/\s:@]+):([^/\s@]+)@/gi,"$1<redacted>@").replace(/\b[a-z][\w-]*(?:\.[\w-]+){2,}\b/gi,"<app_id>").replace(/\b[a-z]:\\[^\s"',)]+/gi,"<path>").replace(/(^|[\s"'(])\/[^\s"',)]+/g,"$1<path>").replace(/(--(?:token|api[-_]?key|key|password|secret|private[-_]?key|jwt|session|auth)(?:=|\s+))("[^"]+"|'[^']+'|\S+)/gi,"$1<redacted>").replace(/\b((?:token|api[-_]?key|password|secret|authorization)\s*[:=]\s*)[^\s,;]+/gi,"$1<redacted>")}function UWQ(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 F=Y.lastIndexOf(" "),U=F===-1?"":Y.slice(F+1);if(/:\d+:\d+$/.test(U))Z=Y.slice(0,F).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:FWQ(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 zWQ(A){if(!A||typeof A!=="object"||!("code"in A))return;let{code:Q}=A;return typeof Q==="string"?Q:void 0}function iMA(A){return!zWQ(A)?.startsWith("commander.")}function Pu(A){let Q=[],B=A;while(B?.parent){let $=B.name();if($)Q.push($);B=B.parent}return Q.reverse().join(" ")||"unknown"}async function rBA(A){let Q=KWQ();if(!Q)return!1;let B=TI.CAPGO_CLI_POSTHOG_API_HOST?.trim()||TI.POSTHOG_API_HOST?.trim()||ZWQ,$;try{$=WWQ(B)}catch{return!1}let J=HWQ(A.error),Y=DWQ(J.message),Z=`cli:${M$.version}:${A.functionName}`,X=UWQ(J.stack,A.functionName),G=X[0],K=[Z,A.kind,J.name||"Error",G?.function||A.functionName,G&&"filename"in G?G.filename:"unknown",String(A.status??1)].join(":"),W={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:K,architecture:JWQ,cli_version:M$.version,error_kind:A.kind,function_name:A.functionName,is_ci:Boolean(TI.CI),node_version:YWQ,os_platform:BWQ(),os_release:$WQ(),runtime:"cli",status:A.status},timestamp:new Date().toISOString()};try{let F=new AbortController,U=setTimeout(()=>F.abort(),GWQ);try{return(await fetch($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W),signal:F.signal})).ok}finally{clearTimeout(U)}}catch{return!1}}var ZWQ="https://eu.i.posthog.com/i/v0/e/",XWQ="phc_NXDyDajQaTQVwb25DEhIVZfxVUn4R0Y348Z7vWYHZUi",GWQ=1500;var xP=mA(()=>{aX()});import{existsSync as t7}from"fs";var B2=(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(t7(B)||t7($))return"bun";if(t7(J)||t7(Y))return"pnpm";if(t7(Z))return"yarn";if(t7(X)||t7(G))return"npm";return Q},_u=(A=B2(),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"}},nMA=(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(t7(B)||t7($))return"bunx";if(t7(J)||t7(Y))return"pnpm exec";if(t7(Z))return"yarn dlx";if(t7(X)||t7(G))return"npx";return Q};var sBA=()=>{};function Tu(A,Q){if(isNaN(A)||isNaN(Q))throw Error("Cannot compare against non-numbers");return A===Q?0:A<Q?-1:1}function rMA(A=[],Q=[]){if(A.length&&!Q.length)return-1;if(!A.length&&Q.length)return 1;return 0}function ku(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 eBA(A){return typeof A==="number"&&!Number.isNaN(A)&&(!Number.isFinite(A)||0<=A&&A<=Number.MAX_SAFE_INTEGER)}function e7(A){return A.split(".").filter(Boolean).map((Q)=>{if(OWQ.test(Q)){let B=Number(Q);if(eBA(B))return B}return Q})}function iW(A){return A.split(".").filter(Boolean)}function bu(A,Q){let B=Number(A);if(!eBA(B))throw TypeError(Q);return B}function UF(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 aL="0|[1-9]\\d*",qWQ="\\d*[a-zA-Z-][a-zA-Z0-9-]*",IWQ,aMA,sMA,oMA="[0-9A-Za-z-]+",tMA,eMA,ALA,QLA="(?:<|>)?=?",CWQ="x|X|\\*",tBA,Su,BLA,$LA,A1A=256,OWQ;var oZ=mA(()=>{IWQ=`(?<major>${aL})\\.(?<minor>${aL})\\.(?<patch>${aL})`,aMA=`(?:${aL}|${qWQ})`,sMA=`(?:-(?<prerelease>${aMA}(?:\\.${aMA})*))`,tMA=`(?:\\+(?<buildmetadata>${oMA}(?:\\.${oMA})*))`,eMA=`v?${IWQ}${sMA}?${tMA}?`,ALA=new RegExp(`^${eMA}$`),tBA=`${aL}|${CWQ}`,Su=`[v=\\s]*(?<major>${tBA})(?:\\.(?<minor>${tBA})(?:\\.(?<patch>${tBA})${sMA}?${tMA}?)?)?`,BLA=new RegExp(`^(?<operator>~>?|\\^|${QLA})\\s*${Su}$`),$LA=new RegExp(`^(?<operator>${QLA})\\s*(${eMA})$|^$`);OWQ=new RegExp(`^${aL}$`)});function iY(A,Q){if(A===Q)return 0;return Tu(A.major,Q.major)||Tu(A.minor,Q.minor)||Tu(A.patch,Q.patch)||rMA(A.prerelease,Q.prerelease)||ku(A.prerelease,Q.prerelease)}var oX=mA(()=>{oZ()});function JLA(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(ku(A.prerelease,Q.prerelease)!==0)return"prerelease"}var YLA=mA(()=>{oZ()});function Q1A(A){return A.toFixed(0)}function V5(A){let Q=Q1A(A.major),B=Q1A(A.minor),$=Q1A(A.patch),J=A.prerelease?.join(".")??"",Y=A.build?.join(".")??"";return[[`${Q}.${B}.${$}`,J].filter((G)=>G).join("-"),Y].filter((G)=>G).join("+")}function MWQ(A,Q){if(UF(Q))return!0;let B=iY(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 xu(A,Q){for(let B of Q)if(!MWQ(A,B))return!1;if(!A.prerelease?.length)return!0;for(let B of Q){if(UF(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 fu=mA(()=>{oZ();oX()});function fP(A,Q){return Q.some((B)=>xu(A,B))}var vP=mA(()=>{fu()});function LWQ(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 yP(A=[],Q){let B=LWQ(A);if(!Q)return B;let $=e7(Q);if($.every((J)=>typeof J==="string")){if($.every((J,Y)=>J===B[Y])&&typeof B[$.length]==="number")return B;$=[...$,0]}return $}function $2(A,Q,B={}){let $=B.build!==void 0?iW(B.build):A.build??[];switch(Q){case"premajor":return{major:A.major+1,minor:0,patch:0,prerelease:yP(A.prerelease,B.prerelease),build:$};case"preminor":return{major:A.major,minor:A.minor+1,patch:0,prerelease:yP(A.prerelease,B.prerelease),build:$};case"prepatch":return{major:A.major,minor:A.minor,patch:A.patch+1,prerelease:yP(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:yP(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:yP(A.prerelease,B.prerelease),build:$};default:throw TypeError(`Cannot increment version: invalid argument ${Q}`)}}var ZLA=mA(()=>{oZ()});var vu,oL;var gP=mA(()=>{vu={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},oL={operator:void 0,...vu}});var B1A=mA(()=>{gP();oZ()});function $1A(A,Q){return iY(A,Q)>0}var J1A=mA(()=>{oX()});var XLA=mA(()=>{vP();J1A()});function rZ(A,Q){return iY(A,Q)<0}var Y1A=mA(()=>{oX()});var GLA=mA(()=>{vP();Y1A()});function NWQ(A){let B=A.match($LA)?.groups;if(!B)return null;let{operator:$}=B;return{operator:$||void 0,...vu}}function b$(A){return!A||A.toLowerCase()==="x"||A==="*"}function VWQ(A){if(b$(A.major))return;if(b$(A.minor))return{operator:">=",major:+A.major,minor:0,patch:0,prerelease:[],build:[]};if(b$(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?e7(A.prerelease):[],build:[]}}function EWQ(A){if(b$(A.major))return;if(b$(A.minor))return{operator:"<",major:+A.major+1,minor:0,patch:0,prerelease:[],build:[]};if(b$(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:e7(A.prerelease),build:[]};return{operator:"<=",major:+A.major,minor:+A.minor,patch:+A.patch,prerelease:[],build:[]}}function RWQ(A){let Q=A.match(new RegExp(`^${Su}`)),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(`^${Su}\\s*$`))?.groups,G=VWQ(B),K=EWQ(X);return[G,K].filter(Boolean)}function jWQ(A){let Q=b$(A.major),B=b$(A.minor),$=b$(A.patch),J=+A.major,Y=+A.minor,Z=+A.patch;if(Q)return[oL];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=e7(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 wWQ(A){let Q=b$(A.major),B=b$(A.minor),$=b$(A.patch),J=+A.major,Y=+A.minor,Z=+A.patch;if(Q)return[oL];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=e7(A.prerelease??"");return[{operator:">=",major:J,minor:Y,patch:Z,prerelease:X},{operator:"<",major:J,minor:Y+1,patch:0}]}function PWQ(A){let Q=b$(A.major),B=b$(A.minor),$=b$(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=e7(A.prerelease??""),G=iW(A.build??"");return[{operator:"<",major:J,minor:Y,patch:Z,prerelease:X,build:G}]}function _WQ(A){let Q=b$(A.minor),B=b$(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=e7(A.prerelease??""),X=iW(A.build??"");return[{operator:"<=",major:$,minor:J,patch:Y,prerelease:Z,build:X}]}function TWQ(A){let Q=b$(A.major),B=b$(A.minor),$=b$(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=e7(A.prerelease??""),G=iW(A.build??"");return[{operator:">",major:J,minor:Y,patch:Z,prerelease:X,build:G}]}function kWQ(A){let Q=b$(A.major),B=b$(A.minor),$=b$(A.patch),J=+A.major,Y=+A.minor,Z=+A.patch;if(Q)return[oL];if(B)return[{operator:">=",major:J,minor:0,patch:0}];if($)return[{operator:">=",major:J,minor:Y,patch:0}];let X=e7(A.prerelease??""),G=iW(A.build??"");return[{operator:">=",major:J,minor:Y,patch:Z,prerelease:X,build:G}]}function SWQ(A){let Q=b$(A.major),B=b$(A.minor),$=b$(A.patch),J=+A.major,Y=+A.minor,Z=+A.patch;if(Q)return[oL];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=e7(A.prerelease??""),G=iW(A.build??"");return[{operator:A.operator==="="?"=":void 0,major:J,minor:Y,patch:Z,prerelease:X,build:G}]}function bWQ(A){let Q=A.match(BLA)?.groups;if(!Q)return NWQ(A);switch(Q.operator){case"^":return jWQ(Q);case"~":case"~>":return wWQ(Q);case"<":return PWQ(Q);case"<=":return _WQ(Q);case">":return TWQ(Q);case">=":return kWQ(Q);default:return SWQ(Q)}}function xWQ(A){return A.split(/\s+/).flatMap(bWQ)}function yu(A){let Q=A.replaceAll(/(?<=[<>=~^])(\s+)/g,"").split(/\s*\|\|\s*/).map((B)=>RWQ(B)||xWQ(B));if(Q.some((B)=>B.includes(null)))throw TypeError(`Cannot parse version range: range "${A}" is invalid`);return Q}var Z1A=mA(()=>{oZ();gP()});function O1(A){if(typeof A!=="string")throw TypeError(`Cannot parse version as version must be a string: received ${typeof A}`);if(A.length>A1A)throw TypeError(`Cannot parse version as version length is too long: length is ${A.length}, max length is ${A1A}`);A=A.trim();let Q=A.match(ALA)?.groups;if(!Q)throw TypeError(`Cannot parse version: ${A}`);let B=bu(Q.major,`Cannot parse version ${A}: invalid major version`),$=bu(Q.minor,`Cannot parse version ${A}: invalid minor version`),J=bu(Q.patch,`Cannot parse version ${A}: invalid patch version`),Y=Q.prerelease?e7(Q.prerelease):[],Z=Q.buildmetadata?iW(Q.buildmetadata):[];return{major:B,minor:$,patch:J,prerelease:Y,build:Z}}var gu=mA(()=>{oZ();oZ()});function KLA(A,Q){let B=A.operator,$=Q.operator;if(B===void 0){if(UF(A))return!0;return fP(A,[[Q]])}if($===void 0){if(UF(Q))return!0;return fP(Q,[[A]])}let J=iY(A,Q);return(B===">="||B===">")&&($===">="||$===">")||(B==="<="||B==="<")&&($==="<="||$==="<")||J===0&&((B===">="||B==="<=")&&($===">="||$==="<="))||J===-1&&(B===">="||B===">")&&($==="<="||$==="<")||J===1&&(B==="<="||B==="<")&&($===">="||$===">")}function fWQ(A){return A.every((Q)=>{return Q.some((B)=>vWQ(B))})}function vWQ(A){for(let Q=0;Q<A.length-1;Q++){let B=A[Q];for(let $ of A.slice(Q+1))if(!KLA(B,$))return!1}return!0}function WLA(A,Q){return fWQ([A,Q])&&A.some((B)=>{return Q.some(($)=>{return B.every((J)=>{return $.every((Y)=>KLA(J,Y))})})})}var HLA=mA(()=>{oZ();oX();vP()});var FLA=mA(()=>{Z1A()});var DLA=mA(()=>{gP();gP();B1A()});function hP(A){try{return O1(A),!0}catch{return!1}}var ULA=mA(()=>{gu()});var zLA=mA(()=>{gu()});var qLA=mA(()=>{oZ()});var ILA=mA(()=>{oX()});var CLA=mA(()=>{oX()});var OLA=mA(()=>{fu();oZ();oX()});function X1A(A,Q){return iY(A,Q)>=0}var MLA=mA(()=>{oX()});var LLA=mA(()=>{fu();oZ();oX()});var NLA=mA(()=>{oX()});var MK=mA(()=>{oX();YLA();vP();ZLA();B1A();XLA();GLA();Z1A();gu();HLA();FLA();DLA();ULA();zLA();qLA();ILA();CLA();J1A();OLA();MLA();Y1A();LLA();NLA()});var AZ=FA((HO0,mu)=>{var VLA,ELA,RLA,jLA,wLA,PLA,_LA,TLA,kLA,SLA,bLA,xLA,fLA,hu,G1A,vLA,yLA,gLA,rL,hLA,uLA,mLA,cLA,dLA,lLA,pLA,iLA,nLA,uu,aLA,oLA,rLA;(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 mu==="object"&&typeof HO0==="object")A(B(Q,B(HO0)));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]};VLA=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)},ELA=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},RLA=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},jLA=function(Y,Z,X,G){var K=arguments.length,W=K<3?Z:G===null?G=Object.getOwnPropertyDescriptor(Z,X):G,F;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(F=Y[U])W=(K<3?F(W):K>3?F(Z,X,W):F(Z,X))||W;return K>3&&W&&Object.defineProperty(Z,X,W),W},wLA=function(Y,Z){return function(X,G){Z(X,G,Y)}},PLA=function(Y,Z,X,G,K,W){function F(j){if(j!==void 0&&typeof j!=="function")throw TypeError("Function expected");return j}var U=G.kind,q=U==="getter"?"get":U==="setter"?"set":"value",z=!Z&&Y?G.static?Y:Y.prototype:null,I=Z||(z?Object.getOwnPropertyDescriptor(z,G.name):{}),C,N=!1;for(var V=X.length-1;V>=0;V--){var M={};for(var L in G)M[L]=L==="access"?{}:G[L];for(var L in G.access)M.access[L]=G.access[L];M.addInitializer=function(j){if(N)throw TypeError("Cannot add initializers after decoration has completed");W.push(F(j||null))};var R=(0,X[V])(U==="accessor"?{get:I.get,set:I.set}:I[q],M);if(U==="accessor"){if(R===void 0)continue;if(R===null||typeof R!=="object")throw TypeError("Object expected");if(C=F(R.get))I.get=C;if(C=F(R.set))I.set=C;if(C=F(R.init))K.unshift(C)}else if(C=F(R))if(U==="field")K.unshift(C);else I[q]=C}if(z)Object.defineProperty(z,G.name,I);N=!0},_LA=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},TLA=function(Y){return typeof Y==="symbol"?Y:"".concat(Y)},kLA=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})},SLA=function(Y,Z){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Y,Z)},bLA=function(Y,Z,X,G){function K(W){return W instanceof X?W:new X(function(F){F(W)})}return new(X||(X=Promise))(function(W,F){function U(I){try{z(G.next(I))}catch(C){F(C)}}function q(I){try{z(G.throw(I))}catch(C){F(C)}}function z(I){I.done?W(I.value):K(I.value).then(U,q)}z((G=G.apply(Y,Z||[])).next())})},xLA=function(Y,Z){var X={label:0,sent:function(){if(W[0]&1)throw W[1];return W[1]},trys:[],ops:[]},G,K,W,F=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return F.next=U(0),F.throw=U(1),F.return=U(2),typeof Symbol==="function"&&(F[Symbol.iterator]=function(){return this}),F;function U(z){return function(I){return q([z,I])}}function q(z){if(G)throw TypeError("Generator is already executing.");while(F&&(F=0,z[0]&&(X=0)),X)try{if(G=1,K&&(W=z[0]&2?K.return:z[0]?K.throw||((W=K.return)&&W.call(K),0):K.next)&&!(W=W.call(K,z[1])).done)return W;if(K=0,W)z=[z[0]&2,W.value];switch(z[0]){case 0:case 1:W=z;break;case 4:return X.label++,{value:z[1],done:!1};case 5:X.label++,K=z[1],z=[0];continue;case 7:z=X.ops.pop(),X.trys.pop();continue;default:if((W=X.trys,!(W=W.length>0&&W[W.length-1]))&&(z[0]===6||z[0]===2)){X=0;continue}if(z[0]===3&&(!W||z[1]>W[0]&&z[1]<W[3])){X.label=z[1];break}if(z[0]===6&&X.label<W[1]){X.label=W[1],W=z;break}if(W&&X.label<W[2]){X.label=W[2],X.ops.push(z);break}if(W[2])X.ops.pop();X.trys.pop();continue}z=Z.call(Y,X)}catch(I){z=[6,I],K=0}finally{G=W=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}},fLA=function(Y,Z){for(var X in Y)if(X!=="default"&&!Object.prototype.hasOwnProperty.call(Z,X))uu(Z,Y,X)},uu=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]},hu=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.")},G1A=function(Y,Z){var X=typeof Symbol==="function"&&Y[Symbol.iterator];if(!X)return Y;var G=X.call(Y),K,W=[],F;try{while((Z===void 0||Z-- >0)&&!(K=G.next()).done)W.push(K.value)}catch(U){F={error:U}}finally{try{if(K&&!K.done&&(X=G.return))X.call(G)}finally{if(F)throw F.error}}return W},vLA=function(){for(var Y=[],Z=0;Z<arguments.length;Z++)Y=Y.concat(G1A(arguments[Z]));return Y},yLA=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],F=0,U=W.length;F<U;F++,K++)G[K]=W[F];return G},gLA=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))},rL=function(Y){return this instanceof rL?(this.v=Y,this):new rL(Y)},hLA=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",F),K[Symbol.asyncIterator]=function(){return this},K;function F(V){return function(M){return Promise.resolve(M).then(V,C)}}function U(V,M){if(G[V]){if(K[V]=function(L){return new Promise(function(R,j){W.push([V,L,R,j])>1||q(V,L)})},M)K[V]=M(K[V])}}function q(V,M){try{z(G[V](M))}catch(L){N(W[0][3],L)}}function z(V){V.value instanceof rL?Promise.resolve(V.value.v).then(I,C):N(W[0][2],V)}function I(V){q("next",V)}function C(V){q("throw",V)}function N(V,M){if(V(M),W.shift(),W.length)q(W[0][0],W[0][1])}},uLA=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(F){return(X=!X)?{value:rL(Y[K](F)),done:!1}:W?W(F):F}:W}},mLA=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 hu==="function"?hu(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(F){return new Promise(function(U,q){F=Y[W](F),K(U,q,F.done,F.value)})}}function K(W,F,U,q){Promise.resolve(q).then(function(z){W({value:z,done:U})},F)}},cLA=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)};dLA=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")uu(Z,Y,X[G])}return B(Z,Y),Z},lLA=function(Y){return Y&&Y.__esModule?Y:{default:Y}},pLA=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)},iLA=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},nLA=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)},aLA=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};oLA=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(F){return Z(F),K()})}else G|=1}catch(F){Z(F)}if(G===1)return Y.hasError?Promise.reject(Y.error):Promise.resolve();if(Y.hasError)throw Y.error}return K()},rLA=function(Y,Z){if(typeof Y==="string"&&/^\.\.?\//.test(Y))return Y.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(X,G,K,W,F){return G?Z?".jsx":".js":K&&(!W||!F)?X:K+W+"."+F.toLowerCase()+"js"});return Y},A("__extends",VLA),A("__assign",ELA),A("__rest",RLA),A("__decorate",jLA),A("__param",wLA),A("__esDecorate",PLA),A("__runInitializers",_LA),A("__propKey",TLA),A("__setFunctionName",kLA),A("__metadata",SLA),A("__awaiter",bLA),A("__generator",xLA),A("__exportStar",fLA),A("__createBinding",uu),A("__values",hu),A("__read",G1A),A("__spread",vLA),A("__spreadArrays",yLA),A("__spreadArray",gLA),A("__await",rL),A("__asyncGenerator",hLA),A("__asyncDelegator",uLA),A("__asyncValues",mLA),A("__makeTemplateObject",cLA),A("__importStar",dLA),A("__importDefault",lLA),A("__classPrivateFieldGet",pLA),A("__classPrivateFieldSet",iLA),A("__classPrivateFieldIn",nLA),A("__addDisposableResource",aLA),A("__disposeResources",oLA),A("__rewriteRelativeImportExtension",rLA)})});var eLA=FA((sLA)=>{Object.defineProperty(sLA,"__esModule",{value:!0});sLA.resolveFetch=void 0;var yWQ=(A)=>{if(A)return(...Q)=>A(...Q);return(...Q)=>fetch(...Q)};sLA.resolveFetch=yWQ});var K1A=FA((JNA)=>{Object.defineProperty(JNA,"__esModule",{value:!0});JNA.FunctionRegion=JNA.FunctionsHttpError=JNA.FunctionsRelayError=JNA.FunctionsFetchError=JNA.FunctionsError=void 0;class uP 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}}}JNA.FunctionsError=uP;class QNA extends uP{constructor(A){super("Failed to send a request to the Edge Function","FunctionsFetchError",A)}}JNA.FunctionsFetchError=QNA;class BNA extends uP{constructor(A){super("Relay Error invoking the Edge Function","FunctionsRelayError",A)}}JNA.FunctionsRelayError=BNA;class $NA extends uP{constructor(A){super("Edge Function returned a non-2xx status code","FunctionsHttpError",A)}}JNA.FunctionsHttpError=$NA;var ANA;(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"})(ANA||(JNA.FunctionRegion=ANA={}))});var KNA=FA((XNA)=>{Object.defineProperty(XNA,"__esModule",{value:!0});XNA.FunctionsClient=void 0;var cWQ=AZ(),dWQ=eLA(),sL=K1A();class ZNA{constructor(A,{headers:Q={},customFetch:B,region:$=sL.FunctionRegion.Any}={}){this.url=A,this.headers=Q,this.region=$,this.fetch=(0,dWQ.resolveFetch)(B)}setAuth(A){this.headers.Authorization=`Bearer ${A}`}invoke(A){return cWQ.__awaiter(this,arguments,void 0,function*(Q,B={}){var $,J;let Y,Z,X;try{let{headers:G,method:K,body:W,signal:F,timeout:U}=B,q={},{region:z}=B;if(!z)z=this.region;let I=new URL(`${this.url}/${Q}`);if(z&&z!=="any")q["x-region"]=z,I.searchParams.set("forceFunctionRegion",z);let C,N=!!G&&Object.keys(G).some((w)=>w.toLowerCase()==="content-type");if(W&&!N)if(typeof Blob<"u"&&W instanceof Blob||W instanceof ArrayBuffer)q["Content-Type"]="application/octet-stream",C=W;else if(typeof W==="string")q["Content-Type"]="text/plain",C=W;else if(typeof FormData<"u"&&W instanceof FormData)C=W;else q["Content-Type"]="application/json",C=JSON.stringify(W);else if(W&&typeof W!=="string"&&!(typeof Blob<"u"&&W instanceof Blob)&&!(W instanceof ArrayBuffer)&&!(typeof FormData<"u"&&W instanceof FormData))C=JSON.stringify(W);else C=W;let V=F;if(U)if(Z=new AbortController,Y=setTimeout(()=>Z.abort(),U),F)V=Z.signal,X=()=>Z.abort(),F.addEventListener("abort",X);else V=Z.signal;let M=yield this.fetch(I.toString(),{method:K||"POST",headers:Object.assign(Object.assign(Object.assign({},q),this.headers),G),body:C,signal:V}).catch((w)=>{throw new sL.FunctionsFetchError(w)}),L=M.headers.get("x-relay-error");if(L&&L==="true")throw new sL.FunctionsRelayError(M);if(!M.ok)throw new sL.FunctionsHttpError(M);let R=(($=M.headers.get("Content-Type"))!==null&&$!==void 0?$:"text/plain").split(";")[0].trim().toLowerCase(),j;if(R==="application/json")j=yield M.json();else if(R==="application/octet-stream"||R==="application/pdf")j=yield M.blob();else if(R==="text/event-stream")j=M;else if(R==="multipart/form-data")j=yield M.formData();else j=yield M.text();return{data:j,error:null,response:M}}catch(G){return{data:null,error:G,response:G instanceof sL.FunctionsHttpError||G instanceof sL.FunctionsRelayError?G.context:void 0}}finally{if(Y)clearTimeout(Y);if(X)(J=B.signal)===null||J===void 0||J.removeEventListener("abort",X)}})}}XNA.FunctionsClient=ZNA});var WNA=FA((J2)=>{Object.defineProperty(J2,"__esModule",{value:!0});J2.FunctionRegion=J2.FunctionsRelayError=J2.FunctionsHttpError=J2.FunctionsFetchError=J2.FunctionsError=J2.FunctionsClient=void 0;var lWQ=KNA();Object.defineProperty(J2,"FunctionsClient",{enumerable:!0,get:function(){return lWQ.FunctionsClient}});var mP=K1A();Object.defineProperty(J2,"FunctionsError",{enumerable:!0,get:function(){return mP.FunctionsError}});Object.defineProperty(J2,"FunctionsFetchError",{enumerable:!0,get:function(){return mP.FunctionsFetchError}});Object.defineProperty(J2,"FunctionsHttpError",{enumerable:!0,get:function(){return mP.FunctionsHttpError}});Object.defineProperty(J2,"FunctionsRelayError",{enumerable:!0,get:function(){return mP.FunctionsRelayError}});Object.defineProperty(J2,"FunctionRegion",{enumerable:!0,get:function(){return mP.FunctionRegion}})});function FNA(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 nWQ(A,Q,B,$){if(!$||B>=3)return!1;if(!zNA.includes(A))return!1;if(!iWQ.includes(Q))return!1;return!0}function cP(A){return cP=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},cP(A)}function sWQ(A,Q){if(cP(A)!="object"||!A)return A;var B=A[Symbol.toPrimitive];if(B!==void 0){var $=B.call(A,Q||"default");if(cP($)!="object")return $;throw TypeError("@@toPrimitive must return a primitive value.")}return(Q==="string"?String:Number)(A)}function tWQ(A){var Q=sWQ(A,"string");return cP(Q)=="symbol"?Q:Q+""}function eWQ(A,Q,B){return(Q=tWQ(Q))in A?Object.defineProperty(A,Q,{value:B,enumerable:!0,configurable:!0,writable:!0}):A[Q]=B,A}function UNA(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 cu(A){for(var Q=1;Q<arguments.length;Q++){var B=arguments[Q]!=null?arguments[Q]:{};Q%2?UNA(Object(B),!0).forEach(function($){eWQ(A,$,B[$])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(B)):UNA(Object(B)).forEach(function($){Object.defineProperty(A,$,Object.getOwnPropertyDescriptor(B,$))})}return A}var HNA=(A)=>Math.min(1000*2**A,30000),iWQ,zNA,W1A,aWQ=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((F,U)=>{K[U]=F}),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,(F,U)=>typeof U==="bigint"?U.toString():U),signal:B.signal})}catch(F){if((F===null||F===void 0?void 0:F.name)==="AbortError"||(F===null||F===void 0?void 0:F.code)==="ABORT_ERR")throw F;if(!zNA.includes(B.method))throw F;if(B.retryEnabled&&Z<3){let U=HNA(Z);Z++,await FNA(U,B.signal);continue}throw F}if(nWQ(B.method,W.status,Z,B.retryEnabled)){var X,G;let F=(X=(G=W.headers)===null||G===void 0?void 0:G.get("Retry-After"))!==null&&X!==void 0?X:null,U=F!==null?Math.max(0,parseInt(F,10)||0)*1000:HNA(Z);await W.text(),Z++,await FNA(U,B.signal);continue}return await B.processResponse(W)}})();if(!this.shouldThrowOnError)Y=Y.catch((Z)=>{var X;let G="",K="",W="",F=Z===null||Z===void 0?void 0:Z.cause;if(F){var U,q,z,I;let V=(U=F===null||F===void 0?void 0:F.message)!==null&&U!==void 0?U:"",M=(q=F===null||F===void 0?void 0:F.code)!==null&&q!==void 0?q:"";if(G=`${(z=Z===null||Z===void 0?void 0:Z.name)!==null&&z!==void 0?z:"FetchError"}: ${Z===null||Z===void 0?void 0:Z.message}`,G+=`
72
72
 
73
73
  Caused by: ${(I=F===null||F===void 0?void 0:F.name)!==null&&I!==void 0?I:"Error"}: ${V}`,M)G+=` (${M})`;if(F===null||F===void 0?void 0:F.stack)G+=`
@@ -563,8 +563,8 @@ Minimum version required to store current data is: `+Y+`.
563
563
  `)){let J=$.trim();if(!J||J.startsWith("#")||J.startsWith("//"))continue;let Y=J.indexOf("=");if(Y>0)B[J.slice(0,Y).trim()]=J.slice(Y+1).trim()}return B}function DeA(A){let Q=i6(Ij(A,"android","capacitor.settings.gradle"));if(!Q)return 0;return(Q.match(/^\s*include\s+':/gm)??[]).length}function zW(A){return i6(Ij(A,"android","app","build.gradle"))??i6(Ij(A,"android","app","build.gradle.kts"))}function cv(A){let Q=zW(A);if(!Q)return null;return LM(Q).match(/applicationId\s*[=( ]\s*["']([\w.]+)["']/)?.[1]??null}function HeA(A,Q){let B=A.match(new RegExp(`(?:^|[\\s;{}])${Q}\\s*\\{`));if(B?.index===void 0)return null;let $=A.indexOf("{",B.index+B[0].length-1);if($===-1)return null;let J=0;for(let Y=$;Y<A.length;Y++)if(A[Y]==="{")J++;else if(A[Y]==="}"){if(J--,J===0)return A.slice($+1,Y)}return null}function X10(A,Q){let B=A.match(new RegExp(`(?:^|[\\s;{}])${Q}\\s*\\{`));if(B?.index===void 0)return A;let $=A.indexOf("{",B.index+B[0].length-1);if($===-1)return A;let J=0;for(let Y=$;Y<A.length;Y++)if(A[Y]==="{")J++;else if(A[Y]==="}"){if(J--,J===0)return A.slice(0,B.index)+" "+A.slice(Y+1)}return A.slice(0,B.index)}function G10(A,Q){let B=0,$=0;for(let J=0;J<A.length;J++){let Y=A[J];if(Y==="{"){if(B===0){let Z=A.slice($,J),X=Z.match(/(?:create|register)\s*\(\s*["'](\w+)["']\s*\)\s*$/),G=Z.match(/val\s+(\w+)\s+by\s+creating\s*$/),K=Z.match(/(?:^|[\s;}])(\w+)\s*$/);if((X?.[1]??G?.[1]??K?.[1])===Q){let F=0;for(let U=J;U<A.length;U++)if(A[U]==="{")F++;else if(A[U]==="}"){if(F--,F===0)return A.slice(J+1,U)}return null}}B++}else if(Y==="}"){if(B=Math.max(0,B-1),B===0)$=J+1}else if(B===0&&(Y===`
564
564
  `||Y===";"))$=J+1}return null}function UeA(A,Q){let B=cv(A),$=zW(A),J=$===null?null:LM($),Y=J!==null&&HeA(J,"productFlavors")!==null;if(!Q){if(Y)return{packageName:B,ambiguous:!0};return{packageName:B,ambiguous:!1}}if(J===null)return{packageName:B,ambiguous:!0};let Z=HeA(J,"productFlavors");if(Z===null)return{packageName:B,ambiguous:!0};let X=G10(Z,Q);if(X===null)return{packageName:B,ambiguous:!0};let G=X.match(/applicationId\s*[=( ]\s*["']([\w.]+)["']/);if(G)return{packageName:G[1],ambiguous:!1};let K=X.match(/applicationIdSuffix\s*[=( ]\s*["']([\w.]+)["']/);if(K){if(B===null)return{packageName:null,ambiguous:!0};let W=K[1].startsWith(".")?"":".";return{packageName:B+W+K[1],ambiguous:!1}}return{packageName:B,ambiguous:!1}}function LM(A){return A.replace(/\/\*[\s\S]*?\*\//g," ").replace(/\/\/[^\n]*/g,"")}function W10(A){let Q=i6(Ij(A,"android","variables.gradle")),B={};if(!Q)return B;let $=LM(Q),J=$.search(/\bext\s*\{/),Y=J===-1?$:H10($,J);for(let Z of Y.matchAll(/([A-Za-z_]\w*)\s*=\s*(\d+)\b/g))B[Z[1]]=Number(Z[2]);return B}function H10(A,Q){let B=A.indexOf("{",Q);if(B===-1)return"";let $=0;for(let J=B;J<A.length;J++)if(A[J]==="{")$++;else if(A[J]==="}"){if($--,$===0)return A.slice(B+1,J)}return A.slice(B+1)}function V3(A,Q){let B=K10[Q],$=zW(A);if($){let Z=B.replace(/Version$/,""),X=new RegExp(`\\b(?:${B}|${Z})\\s*[=\\s]\\s*(\\d+)\\b`),K=X10(LM($),"productFlavors").match(X);if(K)return Number(K[1])}let J=W10(A)[B];if(typeof J==="number")return J;let Y=i6(Ij(A,"android","app","src","main","AndroidManifest.xml"));if(Y){let X=Y.replace(/<!--[\s\S]*?-->/g," ").match(new RegExp(`android:${B}\\s*=\\s*"(\\d+)"`));if(X)return Number(X[1])}return null}var K10;var Lq=mA(()=>{K10={minSdk:"minSdkVersion",targetSdk:"targetSdkVersion",compileSdk:"compileSdkVersion"}});function pr(A){return A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function cD(A,Q){let B=new RegExp(`<key>${pr(Q)}</key>\\s*<string>([\\s\\S]*?)</string>`);return A.match(B)?.[1]??null}function ir(A,Q){let B=new RegExp(`<key>${pr(Q)}</key>\\s*<(true|false)\\s*/>`),$=A.match(B);if(!$)return null;return $[1]==="true"}function NM(A,Q){return A.includes(`<key>${Q}</key>`)}function dD(A,Q){let B=new RegExp(`<key>${pr(Q)}</key>\\s*<array>([\\s\\S]*?)</array>`),$=A.match(B)?.[1];if($===void 0)return[];let J=[];for(let Y of $.matchAll(/<string>([\s\S]*?)<\/string>/g))J.push(Y[1].trim());return J}function zeA(A,Q){let B=new RegExp(`<key>${pr(Q)}</key>\\s*<dict>`),$=A.match(B);if($?.index===void 0)return null;let J=$.index+$[0].length,Y=/<dict>|<\/dict>/g;Y.lastIndex=J;let Z=1;for(let X=Y.exec(A);X!==null;X=Y.exec(A))if(X[0]==="<dict>")Z++;else if(Z--,Z===0)return A.slice(J,X.index);return null}import{existsSync as F10,readFileSync as D10}from"node:fs";import{join as U10}from"node:path";var nr,z10,q10,qeA;var e3A=mA(()=>{nr=/^[a-z][a-z0-9+.-]*$/i,z10=["NSCameraUsageDescription","NSMicrophoneUsageDescription","NSPhotoLibraryUsageDescription","NSLocationWhenInUseUsageDescription","NSLocationAlwaysAndWhenInUseUsageDescription","NSContactsUsageDescription","NSFaceIDUsageDescription","NSBluetoothAlwaysUsageDescription"],q10=new Set(["","todo","tbd","description","usage description","lorem ipsum"]),qeA={id:"ios/infoplist-sanity",platforms:["ios"],async run(A){let Q=U10(A.projectDir,"ios","App","App","Info.plist");if(!F10(Q))return[];let B=D10(Q,"utf8"),$=[];if(!B.includes("<key>CFBundleVersion</key>"))$.push({id:"ios/infoplist-sanity",severity:"warning",title:"Info.plist has no CFBundleVersion",fix:"Add CFBundleVersion (build number) — App Store uploads require it"});if(!B.includes("<key>CFBundleShortVersionString</key>"))$.push({id:"ios/infoplist-sanity",severity:"warning",title:"Info.plist has no CFBundleShortVersionString",fix:"Add the marketing version (e.g. 1.0.0)"});let J=B.match(/<key>CFBundleURLSchemes<\/key>\s*<array>([\s\S]*?)<\/array>/g)??[];for(let Y of J)for(let Z of Y.matchAll(/<string>([\s\S]*?)<\/string>/g)){let X=Z[1].trim();if(X&&!nr.test(X))$.push({id:"ios/infoplist-sanity",severity:"error",title:`Invalid URL scheme "${X}" — App Store upload will reject it`,detail:'Schemes must match RFC 3986: letters, digits, "+", "-", "." only (no underscores)',fix:'Rename the scheme (e.g. replace "_" with "-") in Info.plist and your deep-link config'})}for(let Y of z10){if(!B.includes(`<key>${Y}</key>`))continue;let Z=cD(B,Y);if(Z===null||q10.has(Z.trim().toLowerCase())||Z.trim().length<8)$.push({id:"ios/infoplist-sanity",severity:"warning",title:`${Y} is empty or placeholder text`,fix:"App Review rejects vague purpose strings — describe the actual user-facing reason"})}return $}}});import{join as I10}from"node:path";function VM(A){if(Cj.has(A))return Cj.get(A)??null;let Q=I10(A,"android","app","src","main","AndroidManifest.xml"),B=i6(Q),$=B===null?null:{raw:B,path:Q};return O10(A,$),$}function O10(A,Q){if(Cj.size>=C10)Cj.delete(Cj.keys().next().value);Cj.set(A,Q)}function dv(A){return A.replace(/<!--[\s\S]*?-->/g,(Q)=>" ".repeat(Q.length))}function jZ(A){let Q=[];for(let B of A.matchAll(M10)){let $=B[0],J=B[1],Y={};for(let X of(B[2]??"").matchAll(L10))Y[X[1]]=X[2]??X[3]??"";let Z=B.index;Q.push({tag:J,attrs:Y,start:Z,end:Z+$.length,rawOpenTag:$})}return Q}function IeA(A){return{android:/xmlns:android\s*=\s*"http:\/\/schemas\.android\.com\/apk\/res\/android"/.test(A),tools:/xmlns:tools\s*=\s*"http:\/\/schemas\.android\.com\/tools"/.test(A)}}function CeA(A,Q,B){if(A===Q)return 0;if(Math.abs(A.length-Q.length)>B)return B+1;let $=Array.from({length:Q.length+1},(Y,Z)=>Z),J=Array(Q.length+1);for(let Y=1;Y<=A.length;Y++){J[0]=Y;let Z=J[0];for(let X=1;X<=Q.length;X++){let G=A[Y-1]===Q[X-1]?0:1;if(J[X]=Math.min($[X]+1,J[X-1]+1,$[X-1]+G),J[X]<Z)Z=J[X]}if(Z>B)return B+1;for(let X=0;X<=Q.length;X++)$[X]=J[X]}return $[Q.length]}var C10=8,Cj,M10,L10,AFA;var QFA=mA(()=>{Lq();e3A();Cj=new Map;M10=/<([a-z][\w:-]*)((?:\s+[\w:.-]+\s*=\s*(?:"[^"]*"|'[^']*'))*)\s*\/?>/gi,L10=/([\w:.-]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;AFA=new Set(["manifest","application","activity","activity-alias","service","provider","receiver","instrumentation","intent","meta-data","action","category","data","uses-permission","uses-permission-sdk-23","permission","permission-tree","permission-group","uses-feature","uses-library","uses-native-library","uses-sdk","uses-configuration","supports-screens","compatible-screens","supports-gl-texture","grant-uri-permission","path-permission","queries","package","profileable","property"])});function qW(A){return VM(A.projectDir)!==null}function LX(A){let Q=VM(A.projectDir);return Q===null?null:dv(Q.raw)}function MeA(A,Q){if(Q.rawOpenTag.trimEnd().endsWith("/>"))return"";let B=A.indexOf(`</${Q.tag}>`,Q.end);return A.slice(Q.end,B===-1?A.length:B)}function R10(A){return A!==void 0&&A!=="true"&&A!=="false"}function j10(A,Q){let B=cv(A.projectDir);if(B)return B;return Q.match(/<manifest\b[^>]*\spackage\s*=\s*"([\w.]+)"/)?.[1]??null}function w10(A,Q){if(A.startsWith("."))return Q+A;if(!A.includes("."))return`${Q}.${A}`;return A}function BFA(A){return{id:"android/manifest-deeplink-valid",severity:"warning",title:A,fix:"Give deep-link <data> a valid lowercase RFC-3986 scheme + host; only use autoVerify on http/https filters with a host."}}function xeA(A){let Q=[],B=/<intent-filter\b[^>]*>/g;for(let $ of A.matchAll(B)){let Y=$.index+$[0].length,Z=A.indexOf("</intent-filter>",Y),X=A.slice(Y,Z===-1?A.length:Z);if(/android\.intent\.action\.VIEW/.test(X)&&/android\.intent\.category\.BROWSABLE/.test(X))Q.push({openTag:$[0],body:X})}return Q}function P10(A){return xeA(A).length>0}var N10,LeA,NeA,OeA="http://schemas.android.com/apk/res/android",VeA,V10,EeA,E10,ReA,jeA,weA,PeA,_eA,TeA,keA,SeA,beA;var feA=mA(()=>{Lq();QFA();N10=new Set(["activity","activity-alias","service","receiver","provider"]);LeA={id:"android/manifest-well-formed",platforms:["android"],appliesTo:qW,async run(A){let Q=LX(A);if(Q===null)return[];let B=(X)=>[{id:"android/manifest-well-formed",severity:"error",title:X,fix:"Manifest must have exactly one <application> nested in <manifest>; remove the duplicate/extra block or close the unclosed tag."}];if((Q.match(/<manifest\b/g)??[]).length>1)return B("AndroidManifest.xml declares more than one <manifest> root element");if(!/<\/manifest>/.test(Q))return B("AndroidManifest.xml is missing its closing </manifest> tag");let $=jZ(Q).filter((X)=>X.tag==="application"&&!X.rawOpenTag.trimEnd().endsWith("/>")).length,J=(Q.match(/<\/application>/g)??[]).length,Y=jZ(Q).filter((X)=>X.tag==="application"&&X.rawOpenTag.trimEnd().endsWith("/>")).length,Z=$+Y;if(Z!==1)return B(`AndroidManifest.xml must have exactly one <application> element (found ${Z})`);if($!==J)return B("AndroidManifest.xml has an unclosed <application> element");return[]}},NeA={id:"android/manifest-tag-typo",platforms:["android"],appliesTo:qW,async run(A){let Q=LX(A);if(Q===null)return[];let B=[],$=new Set;for(let J of jZ(Q)){let Y=J.tag;if(AFA.has(Y)||Y.includes(":")||$.has(Y))continue;let Z=null;for(let X of AFA)if(CeA(Y,X,1)===1){Z=X;break}if(Z===null)continue;$.add(Y),B.push({id:"android/manifest-tag-typo",severity:"error",title:`Unknown manifest tag <${Y}> — did you mean <${Z}>?`,fix:"Rename the misspelled tag to the suggested valid manifest element."})}return B}},VeA={id:"android/manifest-namespace-uri",platforms:["android"],appliesTo:qW,async run(A){let Q=LX(A);if(Q===null)return[];let B=IeA(Q),$=/\bandroid:[\w.-]+\s*=/.test(Q),J=/\btools:[\w.-]+\s*=/.test(Q),Y=Q.match(/xmlns:android\s*=\s*"([^"]*)"/),Z=[];if(Y&&Y[1]!==OeA)Z.push({id:"android/manifest-namespace-uri",severity:"error",title:"xmlns:android declares the wrong namespace URI",detail:`expected "${OeA}"`,fix:"Declare the exact xmlns:android (and xmlns:tools when tools: attrs used) URI on <manifest>."});else if($&&!B.android)Z.push({id:"android/manifest-namespace-uri",severity:"error",title:"android:-prefixed attributes are used but xmlns:android is not declared",fix:"Declare the exact xmlns:android (and xmlns:tools when tools: attrs used) URI on <manifest>."});if(J&&!B.tools)Z.push({id:"android/manifest-namespace-uri",severity:"error",title:"tools:-prefixed attributes are used but xmlns:tools is not declared",fix:'Declare xmlns:tools="http://schemas.android.com/tools" on <manifest>.'});return Z}},V10=new Set(["name","exported","label","icon","theme","permission","authorities","debuggable","allowBackup","targetSdkVersion","minSdkVersion","value"]),EeA={id:"android/manifest-missing-prefix",platforms:["android"],appliesTo:qW,async run(A){let Q=LX(A);if(Q===null)return[];let B=new Set;for(let $ of jZ(Q)){if($.tag==="manifest"||$.tag==="queries")continue;for(let J of Object.keys($.attrs)){if(J.includes(":"))continue;if(V10.has(J))B.add(J)}}if(B.size===0)return[];return[{id:"android/manifest-missing-prefix",severity:"error",title:"Manifest attribute is missing the android: namespace prefix",detail:`bare attribute(s): ${[...B].sort().join(", ")}`,fix:"Prefix with android: (e.g. android:name, android:exported)."}]}},E10=new Set(["activity","activity-alias","service","receiver"]);ReA={id:"android/manifest-exported-missing",platforms:["android"],appliesTo:(A)=>{if(VM(A.projectDir)===null)return!1;let Q=V3(A.projectDir,"targetSdk");return Q===null||Q>=31},async run(A){let Q=LX(A);if(Q===null)return[];let B=jZ(Q),$=[];for(let J of B){if(!E10.has(J.tag))continue;let Y=MeA(Q,J),Z=/<intent-filter\b/.test(Y),X=J.attrs["android:exported"]!==void 0,G=J.attrs["android:exported"];if(/android\.intent\.category\.LAUNCHER/.test(Y)&&/android\.intent\.action\.MAIN/.test(Y)&&G!=="true"&&!R10(G)){$.push({id:"android/manifest-exported-missing",severity:"error",title:'The MAIN/LAUNCHER activity must declare android:exported="true"',detail:`<${J.tag} android:name="${J.attrs["android:name"]??""}">`,fix:'Add android:exported="true" to launcher/deep-link components and ="false" to internal components that have intent-filters.'});continue}if(Z&&!X)$.push({id:"android/manifest-exported-missing",severity:"error",title:`<${J.tag}> has an intent-filter but no android:exported (required on Android 12+)`,detail:`<${J.tag} android:name="${J.attrs["android:name"]??""}">`,fix:'Add android:exported="true" to launcher/deep-link components and ="false" to internal components that have intent-filters.'})}return $}},jeA={id:"android/manifest-multiple-uses-sdk",platforms:["android"],appliesTo:qW,async run(A){let Q=LX(A);if(Q===null)return[];let B=(Q.match(/<uses-sdk\b/g)??[]).length;if(B<=1)return[];return[{id:"android/manifest-multiple-uses-sdk",severity:"error",title:`AndroidManifest.xml declares ${B} <uses-sdk> elements`,fix:"Keep at most one <uses-sdk>; prefer setting SDKs in android/variables.gradle."}]}};weA={id:"android/manifest-duplicate-component",platforms:["android"],appliesTo:qW,async run(A){let Q=LX(A);if(Q===null)return[];let B=j10(A,Q),$=(Z)=>Z==="activity-alias"?"activity":Z,J=new Map;for(let Z of jZ(Q)){if(!N10.has(Z.tag))continue;let X=Z.attrs["android:name"];if(!X)continue;if((X.startsWith(".")||!X.includes("."))&&B===null)continue;let K=B===null?X:w10(X,B),W=$(Z.tag),F=J.get(W)??new Map;F.set(K,(F.get(K)??0)+1),J.set(W,F)}let Y=[];for(let[,Z]of J)for(let[X,G]of Z)if(G>=2)Y.push({id:"android/manifest-duplicate-component",severity:"error",title:`Component android:name="${X}" is declared ${G} times`,fix:"Remove the duplicate declaration; each component android:name must be unique."});return Y}},PeA={id:"android/manifest-unique-permission",platforms:["android"],appliesTo:qW,async run(A){let Q=LX(A);if(Q===null)return[];let B=new Map;for(let J of jZ(Q)){if(J.tag!=="permission"&&J.tag!=="permission-group")continue;let Y=J.attrs["android:name"];if(Y)B.set(Y,(B.get(Y)??0)+1)}let $=[];for(let[J,Y]of B)if(Y>1)$.push({id:"android/manifest-unique-permission",severity:"error",title:`Custom permission "${J}" is declared ${Y} times`,fix:"Declare each custom <permission> name exactly once."});return $}},_eA={id:"android/manifest-hardcoded-debuggable",platforms:["android"],appliesTo:qW,async run(A){let Q=LX(A);if(Q===null)return[];let $=jZ(Q).find((J)=>J.tag==="application")?.attrs["android:debuggable"];if($===void 0)return[];if($==="true")return[{id:"android/manifest-hardcoded-debuggable",severity:"error",title:'android:debuggable="true" in the manifest — Play rejects debuggable release uploads',fix:"Remove android:debuggable from the manifest; the release build type sets it automatically."}];return[{id:"android/manifest-hardcoded-debuggable",severity:"warning",title:'android:debuggable="false" in the manifest is redundant — Gradle owns this',fix:"Remove android:debuggable from the manifest; the release build type sets it automatically."}]}},TeA={id:"android/manifest-mock-location",platforms:["android"],appliesTo:qW,async run(A){let Q=LX(A);if(Q===null)return[];if(!jZ(Q).some(($)=>$.tag==="uses-permission"&&$.attrs["android:name"]==="android.permission.ACCESS_MOCK_LOCATION"))return[];return[{id:"android/manifest-mock-location",severity:"error",title:"ACCESS_MOCK_LOCATION is a test-only permission and must not ship",fix:"Remove the test-only ACCESS_MOCK_LOCATION permission."}]}},keA={id:"android/manifest-exported-unprotected",platforms:["android"],appliesTo:qW,async run(A){let Q=LX(A);if(Q===null)return[];let B=V3(A.projectDir,"targetSdk"),$=B!==null&&B<31,J=[];for(let Y of jZ(Q)){if(Y.tag!=="service"&&Y.tag!=="receiver"&&Y.tag!=="provider")continue;let Z=Y.attrs["android:exported"],X=MeA(Q,Y),G=/<intent-filter\b/.test(X);if(!(Z==="true"||Z===void 0&&$&&G))continue;if(Y.attrs["android:permission"]===void 0)J.push({id:"android/manifest-exported-unprotected",severity:"warning",title:`Exported <${Y.tag}> "${Y.attrs["android:name"]??""}" has no android:permission`,fix:'Add android:permission to the exported component, or set android:exported="false"; narrow over-broad grant-uri paths.'});if(Y.tag==="provider"&&Y.attrs["android:grantUriPermissions"]==="true"){if(jZ(X).some((F)=>F.tag==="grant-uri-permission"&&(F.attrs["android:path"]==="/"||F.attrs["android:pathPattern"]===".*")))J.push({id:"android/manifest-exported-unprotected",severity:"warning",title:`Exported <provider> "${Y.attrs["android:name"]??""}" grants URI permission over an over-broad path`,fix:'Add android:permission to the exported component, or set android:exported="false"; narrow over-broad grant-uri paths.'})}}return J}},SeA={id:"android/manifest-query-all-packages",platforms:["android"],appliesTo:qW,async run(A){let Q=LX(A);if(Q===null)return[];if(!jZ(Q).some(($)=>$.tag==="uses-permission"&&$.attrs["android:name"]==="android.permission.QUERY_ALL_PACKAGES"))return[];return[{id:"android/manifest-query-all-packages",severity:"warning",title:"QUERY_ALL_PACKAGES requires Play package-visibility justification",fix:"Use a scoped <queries> element, or justify via Play's permission-declaration form.",docsUrl:"https://support.google.com/googleplay/android-developer/answer/10158779"}]}},beA={id:"android/manifest-deeplink-valid",platforms:["android"],appliesTo:(A)=>{let Q=VM(A.projectDir);if(Q===null)return!1;return P10(dv(Q.raw))},async run(A){let Q=LX(A);if(Q===null)return[];let B=[];for(let $ of xeA(Q)){let J=/android:autoVerify\s*=\s*"true"/.test($.openTag),Y=[],Z=!1,X=!1;for(let G of jZ($.body)){if(G.tag!=="data")continue;if(G.attrs["android:host"]!==void 0)Z=!0;let K=G.attrs["android:scheme"];if(K===void 0)continue;if(Y.push(K),K==="http"||K==="https")X=!0}for(let G of Y){let K=G==="http"||G==="https";if(J&&!K)B.push(BFA(`autoVerify deep link uses a non-http(s) scheme "${G}"`));else if(!K&&!nr.test(G))B.push(BFA(`deep-link android:scheme "${G}" is not a valid RFC-3986 scheme`))}if(J&&X&&!Z)B.push(BFA("autoVerify http(s) deep link has no android:host"))}return B}}});function lv(A,Q){if(A.length>10485760){let B=(A.length/1024/1024).toFixed(0);throw Error(`credential blob is ${B} MB of base64 — not a valid ${Q} (limit 10 MB)`)}}import{createHash as _10}from"node:crypto";function k10(A){if(A.length>=4&&A.readUInt32BE(0)===T10)return"jks";if(A.length>=1&&A[0]===48)return"pkcs12";return"unknown"}function S10(A,Q){let B=A.subarray(0,A.length-20),$=A.subarray(A.length-20),J=Buffer.from(Q,"utf16le").swap16(),Z=_10("sha1").update(Buffer.concat([J,Buffer.from("Mighty Aphrodite","utf8"),B])).digest().equals($),X=[],G=[],K=8,W=A.readUInt32BE(K);K+=4;for(let F=0;F<W&&K<B.length;F++){let U=A.readUInt32BE(K);K+=4;let q=A.readUInt16BE(K);if(K+=2,X.push(A.subarray(K,K+q).toString("utf8")),K+=q,K+=8,U===1){let z=A.readUInt32BE(K);K+=4+z;let I=A.readUInt32BE(K);K+=4;for(let C=0;C<I;C++){let N=A.readUInt16BE(K);K+=2+N;let V=A.readUInt32BE(K);K+=4,G.push(A.subarray(K,K+V)),K+=V}}else{let z=A.readUInt16BE(K);K+=2+z;let I=A.readUInt32BE(K);K+=4,G.push(A.subarray(K,K+I)),K+=I}}return{passwordOk:Z,aliases:X,certsDer:G}}function yeA(A,Q){let B=`${Q}\x00${A}`,$=pv.get(B);if($){if($.error!==void 0)throw $.error;return $.value}try{let J=x10(A,Q);return veA(B,{value:J}),J}catch(J){throw veA(B,{error:J}),J}}function veA(A,Q){if(pv.size>=b10)pv.delete(pv.keys().next().value);pv.set(A,Q)}function x10(A,Q){lv(A,"keystore");let B=Buffer.from(A,"base64"),$=k10(B);if($==="jks"){let J=S10(B,Q);if(!J.passwordOk)throw Error("JKS integrity check failed — wrong store password");let Y=null;for(let Z of J.certsDer)try{let X=iG.default.pki.certificateFromAsn1(iG.default.asn1.fromDer(iG.default.util.createBuffer(Z.toString("binary"))));if(!Y||X.validity.notAfter<Y)Y=X.validity.notAfter}catch{}return{kind:$,aliases:J.aliases,notAfter:Y}}if($==="pkcs12"){let Y=iG.default.pkcs12.pkcs12FromAsn1(iG.default.asn1.fromDer(B.toString("binary")),Q).getBags({bagType:iG.default.pki.oids.certBag})[iG.default.pki.oids.certBag]??[],Z=Y.map((G)=>G.attributes?.friendlyName?.[0]??"").filter(Boolean),X=null;for(let G of Y)if(G.cert&&(!X||G.cert.validity.notAfter<X))X=G.cert.validity.notAfter;return{kind:$,aliases:Z,notAfter:X}}throw Error("Unrecognized keystore format (expected JKS or PKCS12)")}var iG,T10=4277010157,b10=4,pv,geA=(A)=>Boolean(A.credentials?.ANDROID_KEYSTORE_FILE),heA=(A)=>A.credentials?.KEYSTORE_STORE_PASSWORD??A.credentials?.KEYSTORE_KEY_PASSWORD??"",ueA,f10,meA;var ceA=mA(()=>{iG=AQ(oR(),1);pv=new Map;ueA={id:"android/keystore-opens",platforms:["android"],appliesTo:geA,async run(A){let Q;try{Q=yeA(A.credentials.ANDROID_KEYSTORE_FILE,heA(A))}catch(J){let Y=J instanceof Error?J.message:String(J);return[{id:"android/keystore-opens",severity:"error",title:/password|mac|integrity/i.test(Y)?"The keystore cannot be opened with the saved store password":"The saved keystore is not a valid JKS/PKCS12 file",detail:Y,fix:"Verify the keystore file and --keystore-store-password, then re-run `build credentials save`"}]}let B=A.credentials?.KEYSTORE_KEY_ALIAS,$=Q.kind==="jks"||Q.aliases.length>0;if(B&&$&&!Q.aliases.includes(B))return[{id:"android/keystore-opens",severity:"error",title:`Key alias "${B}" not found in the keystore`,detail:`available aliases: ${Q.aliases.join(", ")||"(none)"}`,fix:"Use one of the existing aliases or the correct keystore file"}];return[]}},f10=new Date("2033-10-01"),meA={id:"android/keystore-expiry",platforms:["android"],appliesTo:geA,async run(A){let Q;try{Q=yeA(A.credentials.ANDROID_KEYSTORE_FILE,heA(A))}catch{return[]}if(Q.notAfter&&Q.notAfter<f10)return[{id:"android/keystore-expiry",severity:"warning",title:`Signing certificate validity ends ${Q.notAfter.toISOString().slice(0,10)} — Play requires validity through Oct 2033 for new apps`,fix:"Generate a keystore with ≥25y validity (keytool -validity 10000) for new apps"}];return[]}}});import{join as v10}from"node:path";function Oj(A){let Q=i6(v10(A,"package.json"));if(Q===null)return null;let B;try{let Y=JSON.parse(Q);B={...Y.devDependencies,...Y.dependencies}}catch{return null}let $=B["@capacitor/core"]??B["@capacitor/ios"]??B["@capacitor/android"];if(typeof $!=="string")return null;let J=$.match(/(\d+)/);return J?Number(J[1]):null}var $FA=mA(()=>{Lq()});function iv(A){return A.platform==="android"&&Boolean(A.credentials?.PLAY_CONFIG_JSON)}function E3(A){if(A.platform!=="ios")return!1;if((A.distributionMode??"app_store")!=="app_store")return!1;let B=A.credentials;return Boolean(B?.APPLE_KEY_ID&&B?.APPLE_ISSUER_ID&&B?.APPLE_KEY_CONTENT)}import{existsSync as nv}from"node:fs";import{join as lD}from"node:path";function y10(A){let Q=i6(lD(A.projectDir,"package.json"));if(!Q)return!1;try{return Object.keys(JSON.parse(Q).dependencies??{}).some(($)=>$.startsWith("cordova-plugin-")||$.startsWith("@awesome-cordova-plugins/"))}catch{return!1}}function h10(A){let Q=A?.match(/-Xmx(\d+)([mMgG])/);if(!Q)return null;let B=Number.parseInt(Q[1],10);return/g/i.test(Q[2])?B*1024:B}function or(A,Q){let B=A.match(new RegExp(`(?:^|[\\s;{}])${Q}\\s*\\{`));if(B?.index===void 0)return null;let $=A.indexOf("{",B.index+B[0].length-1),J=0;for(let Y=$;Y<A.length;Y++)if(A[Y]==="{")J++;else if(A[Y]==="}"){if(J--,J===0)return A.slice($+1,Y)}return null}function seA(A){let Q=[],B=0,$=0;for(let J=0;J<A.length;J++){let Y=A[J];if(Y==="{"){if(B===0){let Z=A.slice($,J),X=Z.match(/(?:create|register)\s*\(\s*["'](\w+)["']\s*\)\s*$/),G=Z.match(/val\s+(\w+)\s+by\s+creating\s*$/),K=Z.match(/(?:^|[\s;}])(\w+)\s*$/),W=X?.[1]??G?.[1]??K?.[1];if(W)Q.push(W)}B++}else if(Y==="}"){if(B=Math.max(0,B-1),B===0)$=J+1}else if(B===0&&(Y===`
565
565
  `||Y===";"))$=J+1}return Q}function av(A){let Q=zW(A);return Q===null?null:LM(Q)}function leA(A){let Q=av(A);if(Q===null)return null;let B=or(Q,"productFlavors");if(B===null)return null;let $=seA(B).filter((J)=>J!=="dimension");if($.length===0)return null;return{gradle:Q,block:B,flavors:$}}function m10(A){let Q=av(A);if(Q===null)return!1;let B=Q.match(u10);if(B?.index===void 0)return!1;let $=0;for(let J=0;J<B.index;J++)if(Q[J]==="{")$++;else if(Q[J]==="}")$=Math.max(0,$-1);return $===0}function d10(A){return A.startsWith("/")||/^[A-Za-z]:\\/.test(A)}function i10(A){return l10[A]??p10}function n10(A){let Q=av(A);if(Q===null)return{code:!1,name:!1};return{code:/versionCode\s*[=\s]\s*\S/.test(Q),name:/versionName\s*[=\s]\s*["']/.test(Q)||/versionName\s*[=\s]\s*\w/.test(Q)}}function a10(A){let Q=i6(lD(A,"android","app","src","main","AndroidManifest.xml"));if(Q===null)return{code:!1,name:!1};return{code:/android:versionCode\s*=\s*"/.test(Q),name:/android:versionName\s*=\s*"/.test(Q)}}var aeA,deA=30,g10=2048,oeA,reA,teA,eeA,AAQ,QAQ,BAQ,$AQ,u10,JAQ,c10,YAQ,peA,ZAQ,ieA=34,ar=35,neA="https://developer.android.com/google/play/requirements/target-sdk",XAQ,l10,p10=24,GAQ,KAQ;var WAQ=mA(()=>{Lq();QFA();$FA();aeA={id:"android/cordova-vars-present",platforms:["android"],appliesTo:y10,async run(A){let Q=lD(A.projectDir,"android","capacitor-cordova-android-plugins","cordova.variables.gradle");if(nv(Q))return[];return[{id:"android/cordova-vars-present",severity:"error",title:"cordova.variables.gradle is missing — the cloud build cannot compile your Cordova plugins",detail:"This generated file is gitignored; `cap copy` does not create it, only `cap sync` does",fix:"Run `npx cap sync android` before requesting the build"}]}};oeA={id:"android/gradle-props-heuristics",platforms:["android"],async run(A){let Q=DeA(A.projectDir),B=FeA(A.projectDir),$=[],J=B["org.gradle.parallel"]==="true";if(Q>deA&&!J)$.push({id:"android/gradle-props-heuristics",severity:"warning",title:`${Q} Gradle modules build serially — org.gradle.parallel is not enabled`,fix:"Add `org.gradle.parallel=true` (and `org.gradle.caching=true`) to android/gradle.properties"});if(J&&B["org.gradle.workers.max"]==="1")$.push({id:"android/gradle-props-heuristics",severity:"warning",title:"org.gradle.workers.max=1 makes org.gradle.parallel=true a no-op",fix:"Remove the workers.max cap (or raise it) so parallel project execution can work"});let Y=h10(B["org.gradle.jvmargs"]);if(Q>deA&&Y!==null&&Y<g10)$.push({id:"android/gradle-props-heuristics",severity:"warning",title:`Gradle heap -Xmx${Y}m is small for ${Q} modules — D8/R8 may stall or OOM`,fix:"Raise org.gradle.jvmargs, e.g. `-Xmx4096m -XX:MaxMetaspaceSize=1024m`"});return $}},reA={id:"android/play-sa-json",platforms:["android"],appliesTo:(A)=>Boolean(A.credentials?.PLAY_CONFIG_JSON),async run(A){let Q;try{Q=JSON.parse(Buffer.from(A.credentials.PLAY_CONFIG_JSON,"base64").toString("utf8"))}catch{Q=void 0}if(!Q||typeof Q!=="object"||Array.isArray(Q))return[{id:"android/play-sa-json",severity:"error",title:"PLAY_CONFIG_JSON does not decode to valid JSON",fix:"Base64-encode the raw service-account .json file"}];let B=Q;if(B.type!=="service_account")return[{id:"android/play-sa-json",severity:"error",title:"PLAY_CONFIG_JSON is not a service-account key",detail:`type: ${String(B.type)}`,fix:"Create a service-account key in Google Cloud Console (IAM → Service Accounts → Keys)"}];let $=["private_key","client_email"].filter((J)=>!B[J]);if($.length>0)return[{id:"android/play-sa-json",severity:"error",title:"Service-account JSON is incomplete",detail:`missing: ${$.join(", ")}`,fix:"Re-download the key file — it must contain private_key and client_email"}];return[]}};teA={id:"android/flavor-exists",platforms:["android"],appliesTo:(A)=>Boolean(A.androidFlavor),async run(A){let Q=zW(A.projectDir);if(!Q)return[];let B=or(Q,"productFlavors");if(B===null)return[{id:"android/flavor-exists",severity:"error",title:`--android-flavor "${A.androidFlavor}" passed but build.gradle declares no productFlavors`,fix:"Drop the flag or add the flavor to android/app/build.gradle"}];let $=seA(B).filter((J)=>J!=="dimension");if($.length===0)return[];if(!$.includes(A.androidFlavor))return[{id:"android/flavor-exists",severity:"error",title:`Product flavor "${A.androidFlavor}" not found in build.gradle`,detail:`declared flavors: ${$.join(", ")}`,fix:"Use one of the declared flavors or add the missing one"}];return[]}},eeA={id:"android/agp8-package-attr",platforms:["android"],async run(A){let Q=VM(A.projectDir),B=zW(A.projectDir);if(!Q||!B)return[];let $=dv(Q.raw),J=/<manifest[^>]*\spackage\s*=\s*"/.test($),Y=/namespace\s*[=( ]\s*["']/.test(LM(B));if(J&&Y)return[{id:"android/agp8-package-attr",severity:"error",title:"AndroidManifest.xml still has a package= attribute — AGP 8+ fails the build",detail:"build.gradle declares `namespace`, so the manifest attribute is forbidden",fix:'Delete the package="…" attribute from android/app/src/main/AndroidManifest.xml'}];return[]}};AAQ={id:"android/applicationid-present",platforms:["android"],appliesTo:(A)=>zW(A.projectDir)!==null,async run(A){let Q=av(A.projectDir);if(Q===null)return[];if(/(?:^|[\s;{(])applicationId\s*[=(\s]\s*["'][\w.]+["']/.test(Q))return[];let B=or(Q,"productFlavors");if(B!==null&&/applicationId(?:Suffix)?/.test(B))return[];return[{id:"android/applicationid-present",severity:"error",title:"No applicationId is declared in android/app/build.gradle",detail:"Capacitor needs a defaultConfig (or per-flavor) applicationId to assemble the APK/AAB",fix:'Add `applicationId "your.app.id"` to defaultConfig (or per flavor); it must match the Capacitor appId'}]}},QAQ={id:"android/capacitor-build-gradle-applied",platforms:["android"],appliesTo:(A)=>zW(A.projectDir)!==null,async run(A){let Q=av(A.projectDir);if(Q===null)return[];let B=/apply\s+from:\s*["']capacitor\.build\.gradle["']/.test(Q),$=nv(lD(A.projectDir,"android","app","capacitor.build.gradle"));if(B&&$)return[];if(B&&!$)return[{id:"android/capacitor-build-gradle-applied",severity:"error",title:"app/build.gradle applies capacitor.build.gradle but the file is missing",detail:"This generated file is created by `cap sync`, not `cap copy`",fix:"Run `npx cap sync android` to regenerate android/app/capacitor.build.gradle"}];return[{id:"android/capacitor-build-gradle-applied",severity:"error",title:"app/build.gradle never applies capacitor.build.gradle",detail:'Without `apply from: "capacitor.build.gradle"` the Capacitor plugin dependencies are not wired in',fix:"Run `npx cap sync android`; ensure app/build.gradle has `apply from: 'capacitor.build.gradle'`"}]}},BAQ={id:"android/gradle-wrapper-present",platforms:["android"],appliesTo:(A)=>nv(lD(A.projectDir,"android")),async run(A){let Q=i6(lD(A.projectDir,"android","gradle","wrapper","gradle-wrapper.properties"));if(Q===null)return[{id:"android/gradle-wrapper-present",severity:"error",title:"The Gradle wrapper is missing — android/gradle/wrapper/gradle-wrapper.properties not found",detail:"The cloud builder runs `./gradlew`, which needs the committed wrapper",fix:"Restore it: `npx cap sync android` or `gradle wrapper`; commit android/gradle/wrapper/ + android/gradlew"}];if(!/^distributionUrl=\S+/m.test(Q))return[{id:"android/gradle-wrapper-present",severity:"error",title:"gradle-wrapper.properties has no distributionUrl — Gradle cannot bootstrap",fix:"Add a distributionUrl line (e.g. via `gradle wrapper`) or re-run `npx cap sync android`"}];return[]}};$AQ={id:"android/flavor-dimensions",platforms:["android"],appliesTo:(A)=>leA(A.projectDir)!==null,async run(A){let Q=leA(A.projectDir);if(Q===null)return[];if(/flavorDimensions?\s*[=(\s]\s*["']/.test(Q.gradle))return[];let B=Q.flavors.filter(($)=>{let J=or(Q.block,$);return J===null||!/(?:^|[\s;{])dimension\s+["']/.test(J)});if(B.length===0)return[];return[{id:"android/flavor-dimensions",severity:"error",title:"Product flavors are missing a dimension and no top-level flavorDimensions is declared",detail:`flavors without a dimension: ${B.join(", ")}`,fix:'Add `flavorDimensions "default"` and give every flavor `dimension "default"`'}]}},u10=/(?:apply\s+plugin:\s*["']com\.google\.gms\.google-services["']|id\s*[("']+com\.google\.gms\.google-services)/;JAQ={id:"android/google-services-file",platforms:["android"],appliesTo:(A)=>zW(A.projectDir)!==null&&m10(A.projectDir),async run(A){if(nv(lD(A.projectDir,"android","app","google-services.json")))return[];return[{id:"android/google-services-file",severity:"error",title:"com.google.gms.google-services is applied unconditionally but google-services.json is missing",detail:"The unguarded plugin apply fails the build when the config file is absent",fix:"Supply android/app/google-services.json to the cloud build (it is gitignored), or guard/remove the gms apply"}]}},c10=/^(sdk|ndk)\.dir\s*=\s*(.+)$/gm;YAQ={id:"android/local-properties-committed",platforms:["android"],appliesTo:(A)=>nv(lD(A.projectDir,"android","local.properties")),async run(A){let Q=i6(lD(A.projectDir,"android","local.properties"));if(Q===null)return[];let B=[];for(let $ of Q.matchAll(c10)){let J=`${$[1]}.dir`;if(d10($[2].trim()))B.push({id:"android/local-properties-committed",severity:"warning",title:"android/local.properties is committed with a machine-specific SDK path",detail:`local.properties pins an absolute ${J}`,fix:"Remove android/local.properties from VCS and gitignore it; the cloud builder sets its own SDK location"})}return B}},peA=[{dim:"compileSdk",label:"compileSdkVersion",floor:34},{dim:"targetSdk",label:"targetSdkVersion",floor:34},{dim:"minSdk",label:"minSdkVersion",floor:23}],ZAQ={id:"android/sdk-floors",platforms:["android"],appliesTo:(A)=>peA.some(({dim:Q})=>V3(A.projectDir,Q)!==null),async run(A){let Q=[];for(let{dim:B,label:$,floor:J}of peA){let Y=V3(A.projectDir,B);if(Y===null||Y>=J)continue;Q.push({id:"android/sdk-floors",severity:"warning",title:`${B} ${Y} is below the recommended floor (${J})`,fix:`Raise ${$} to at least ${J} in android/variables.gradle`})}return Q}},XAQ={id:"android/target-sdk-play",platforms:["android"],appliesTo:(A)=>V3(A.projectDir,"targetSdk")!==null,async run(A){let Q=V3(A.projectDir,"targetSdk");if(Q===null||Q>=ar)return[];if(Q<ieA)return[{id:"android/target-sdk-play",severity:"error",title:`targetSdk ${Q} is below Play's minimum (${ieA}) — you cannot publish or stay available`,fix:`Set targetSdkVersion = ${ar} in android/variables.gradle`,docsUrl:neA}];let B=iv(A);return[{id:"android/target-sdk-play",severity:B?"error":"warning",title:`targetSdk ${Q} is behind Play's submission requirement (${ar})`,detail:B?"Play rejects new apps and updates below this target":"Approaching enforcement — raise before your next submission",fix:`Set targetSdkVersion = ${ar} in android/variables.gradle`,docsUrl:neA}]}},l10={6:22,7:23,8:24};GAQ={id:"android/min-sdk-capacitor",platforms:["android"],appliesTo:(A)=>Oj(A.projectDir)!==null&&V3(A.projectDir,"minSdk")!==null,async run(A){let Q=Oj(A.projectDir),B=V3(A.projectDir,"minSdk");if(Q===null||B===null)return[];let $=i10(Q);if(B>=$)return[];return[{id:"android/min-sdk-capacitor",severity:"error",title:`minSdk ${B} is below the Capacitor ${Q} floor`,detail:`Capacitor ${Q} requires minSdkVersion >= ${$}`,fix:`Raise minSdkVersion to at least ${$} in android/variables.gradle`}]}};KAQ={id:"android/version-fields",platforms:["android"],appliesTo:(A)=>zW(A.projectDir)!==null,async run(A){let Q=n10(A.projectDir),B=a10(A.projectDir),$=Q.code||B.code,J=Q.name||B.name,Y=[];if(!$){let Z=iv(A);Y.push({id:"android/version-fields",severity:Z?"error":"warning",title:"No versionCode found in app/build.gradle or AndroidManifest.xml",detail:Z?"Google Play rejects an upload without an integer versionCode":"A versionCode is required to assemble a release artifact",fix:"Set versionCode (integer) in android/app/build.gradle defaultConfig (or via the CLI build-number bump)"})}if(!J)Y.push({id:"android/version-fields",severity:"warning",title:"No versionName found in app/build.gradle or AndroidManifest.xml",fix:"Set versionName in android/app/build.gradle defaultConfig"});return Y}}});var o10,HAQ;var FAQ=mA(()=>{o10={ios:["BUILD_CERTIFICATE_BASE64","CAPGO_IOS_PROVISIONING_MAP","APP_STORE_CONNECT_TEAM_ID"],android:["ANDROID_KEYSTORE_FILE","KEYSTORE_KEY_ALIAS"]},HAQ={id:"shared/credentials-saved",platforms:["ios","android"],async run(A){let Q=A.credentials;if(!Q||Object.keys(Q).length===0)return[{id:"shared/credentials-saved",severity:"error",title:`No ${A.platform} build credentials found`,fix:`Save them first: npx @capgo/cli build credentials save --appId ${A.appId} --platform ${A.platform}`}];let B=o10[A.platform].filter(($)=>!Q[$]);if(A.platform==="android"&&!Q.KEYSTORE_STORE_PASSWORD&&!Q.KEYSTORE_KEY_PASSWORD)B.push("KEYSTORE_STORE_PASSWORD (or KEYSTORE_KEY_PASSWORD)");if(B.length>0)return[{id:"shared/credentials-saved",severity:"error",title:`Incomplete ${A.platform} credentials`,detail:`missing: ${B.join(", ")}`,fix:"Re-run `build credentials save` with the missing values"}];return[]}}});function Mj(A){return A&&Array.isArray(A.value)?A.value:[]}function rr(A){if(!A||A.type!==n6.default.asn1.Type.OID||typeof A.value!=="string")return null;try{return n6.default.asn1.derToOid(A.value)}catch{return null}}function A80(A){let Q=Mj(A);if(rr(Q[0])!==n6.default.pki.oids.pkcs8ShroudedKeyBag)return null;let B=Mj(Q[1])[0],$=Mj(B)[0],J=Mj($),Y=rr(J[0]);if(!Y)return null;let Z=Mj(J[1]),X=Mj(Z[1]);return{algorithmOid:Y,encryptionSchemeOid:rr(X[0])}}function JFA(A,Q,B=0){if(B>32)return;let $=A80(A);if($){Q.push($);return}if(Array.isArray(A.value))for(let J of A.value)JFA(J,Q,B+1);else if(A.type===n6.default.asn1.Type.OCTETSTRING&&A.value.length>0)try{JFA(n6.default.asn1.fromDer(A.value),Q,B+1)}catch{}}function Q80(A){if(!Array.isArray(A.value))return null;let Q=A.value[2];if(!Q||!Array.isArray(Q.value))return null;let B=Q.value[0];if(!B||!Array.isArray(B.value))return null;let $=B.value[0];if(!$||!Array.isArray($.value))return null;return rr($.value[0])}function B80(A){try{return n6.default.asn1.fromDer(n6.default.util.decode64(A))}catch{throw new YFA}}function $80(A){lv(A,"certificate");let Q=B80(A),B=[];JFA(Q,B);let $=new Set,J=Q80(Q);if(J!==r10)$.add(J===n6.default.pki.oids.sha256?"SHA-256 MAC":"non-SHA-1 MAC");if(B.length===0)$.add("missing PBESv1 SHA-1/3DES private-key encryption");for(let Y of B){if(Y.algorithmOid===t10)continue;if(Y.algorithmOid===s10)$.add(e10.has(Y.encryptionSchemeOid??"")?"PBES2/AES private-key encryption":"PBES2 private-key encryption");else $.add("unsupported private-key encryption")}return[...$]}function DAQ(A){let Q=A.attributes?.localKeyId?.[0];return typeof Q==="string"?n6.default.util.bytesToHex(Q):null}function J80(A,Q){let B=[...A.getBags({bagType:n6.default.pki.oids.pkcs8ShroudedKeyBag})[n6.default.pki.oids.pkcs8ShroudedKeyBag]??[],...A.getBags({bagType:n6.default.pki.oids.keyBag})[n6.default.pki.oids.keyBag]??[]],$=new Set(B.map((Y)=>DAQ(Y)).filter((Y)=>Y!==null));if($.size>0){let Y=Q.find((Z)=>{let X=DAQ(Z);return X!==null&&$.has(X)});if(Y?.cert)return Y.cert}let J=Q.find((Y)=>{if(!Y.cert)return!1;return!Y.cert.getExtension("basicConstraints")?.cA});if(J?.cert)return J.cert;return Q[0]?.cert}function sr(A,Q){let B=`${Q}\x00${A}`,$=ov.get(B);if($){if($.error!==void 0)throw $.error;return $.value}try{let J=Z80(A,Q);return UAQ(B,{value:J}),J}catch(J){throw UAQ(B,{error:J}),J}}function UAQ(A,Q){if(ov.size>=Y80)ov.delete(ov.keys().next().value);ov.set(A,Q)}function Z80(A,Q){lv(A,"certificate");let B=n6.default.util.decode64(A),$=n6.default.asn1.fromDer(B),J=n6.default.pkcs12.pkcs12FromAsn1($,Q),Y=J.getBags({bagType:n6.default.pki.oids.certBag})[n6.default.pki.oids.certBag]??[],Z=J80(J,Y);if(!Z)throw Error("no certificate inside the P12");let X=n6.default.asn1.toDer(n6.default.pki.certificateToAsn1(Z)).getBytes(),G=n6.default.md.sha1.create();return G.update(X),{cert:Z,sha1:G.digest().toHex().toLowerCase()}}var n6,r10="1.3.14.3.2.26",s10="1.2.840.113549.1.5.13",t10="1.2.840.113549.1.12.1.3",e10,YFA,Y80=4,ov,Lj=(A,Q)=>Boolean(A.credentials?.[Q]),zAQ,qAQ,X80=2592000000,IAQ,G80,K80,CAQ;var ZFA=mA(()=>{n6=AQ(oR(),1),e10=new Set(["2.16.840.1.101.3.4.1.2","2.16.840.1.101.3.4.1.22","2.16.840.1.101.3.4.1.42"]);YFA=class YFA extends Error{constructor(){super("malformed PKCS12 ASN.1");this.name="MalformedP12Error"}};ov=new Map;zAQ={id:"ios/p12-opens",platforms:["ios"],appliesTo:(A)=>Lj(A,"BUILD_CERTIFICATE_BASE64"),async run(A){try{return sr(A.credentials.BUILD_CERTIFICATE_BASE64,A.credentials.P12_PASSWORD??""),[]}catch(Q){let B=Q instanceof Error?Q.message:String(Q);return[{id:"ios/p12-opens",severity:"error",title:/mac|hmac|password|invalid/i.test(B)?"The P12 certificate cannot be opened with the saved password":"The saved certificate is not a valid P12 file",detail:B,fix:"Re-export the .p12 and re-run `build credentials save` with the correct --p12-password"}]}}},qAQ={id:"ios/p12-legacy-encryption",platforms:["ios"],appliesTo:(A)=>Lj(A,"BUILD_CERTIFICATE_BASE64"),async run(A){let Q;try{Q=$80(A.credentials.BUILD_CERTIFICATE_BASE64)}catch(B){if(B instanceof YFA)return[];throw B}if(Q.length===0)return[];return[{id:"ios/p12-legacy-encryption",severity:"error",title:"The P12 certificate uses encryption that the macOS build runner cannot import",detail:`Detected ${Q.join(" and ")}. Fastlane security import may report a wrong password even when the password is correct.`,fix:"Re-export the .p12 with PBESv1 SHA-1/3DES encryption and a SHA-1 MAC, then re-run `build credentials save`."}]}},IAQ={id:"ios/p12-expiry",platforms:["ios"],appliesTo:(A)=>Lj(A,"BUILD_CERTIFICATE_BASE64"),async run(A){let Q;try{Q=sr(A.credentials.BUILD_CERTIFICATE_BASE64,A.credentials.P12_PASSWORD??"")}catch{return[]}let B=Q.cert.validity.notAfter,$=B.getTime()-Date.now();if($<=0)return[{id:"ios/p12-expiry",severity:"error",title:`Signing certificate expired on ${B.toISOString().slice(0,10)}`,fix:"Create a new distribution certificate in the Apple Developer portal and re-save credentials"}];if($<X80)return[{id:"ios/p12-expiry",severity:"warning",title:`Signing certificate expires in ${Math.ceil($/86400000)} day(s) (${B.toISOString().slice(0,10)})`,fix:"Renew it soon to avoid build interruptions"}];return[]}},G80=/^[A-Z0-9]{10}$/,K80=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,CAQ={id:"ios/asc-key-valid",platforms:["ios"],appliesTo:(A)=>Lj(A,"APPLE_KEY_CONTENT")||Lj(A,"APPLE_KEY_ID")||Lj(A,"APPLE_ISSUER_ID"),async run(A){let Q=[],{APPLE_KEY_ID:B,APPLE_ISSUER_ID:$,APPLE_KEY_CONTENT:J}=A.credentials??{};if(B&&!G80.test(B))Q.push({id:"ios/asc-key-valid",severity:"error",title:"APPLE_KEY_ID is not a 10-char App Store Connect key ID",detail:`got a ${B.length}-char value (expected 10 uppercase letters/digits)`});if($&&!K80.test($))Q.push({id:"ios/asc-key-valid",severity:"error",title:"APPLE_ISSUER_ID is not a UUID",detail:`got a ${$.length}-char value (expected a UUID like 12345678-1234-1234-1234-123456789012)`,fix:"Copy the Issuer ID from App Store Connect → Users and Access → Integrations"});if(J){let Y="";try{Y=n6.default.util.decode64(J)}catch{}if(!Y.includes("-----BEGIN PRIVATE KEY-----"))Q.push({id:"ios/asc-key-valid",severity:"error",title:"APPLE_KEY_CONTENT does not decode to a .p8 private key PEM",fix:"Base64-encode the raw AuthKey_XXXX.p8 file content"})}return Q}}});function R3(A){let Q=A.credentials?.CAPGO_IOS_PROVISIONING_MAP;if(!Q)return[];try{let B=JSON.parse(Q);if(!B||typeof B!=="object"||Array.isArray(B))return[];let $=[];for(let[J,Y]of Object.entries(B))if(typeof Y==="string")$.push({bundleId:J,base64:Y});else if(Y&&typeof Y==="object"&&typeof Y.profile==="string"){let Z=Y;$.push({bundleId:J,base64:Z.profile,name:Z.name})}return $}catch{return[]}}function tr(A){try{return vl(A)}catch{return null}}function MAQ(A,Q){if(A==="*")return!0;if(A.endsWith(".*"))return Q.startsWith(A.slice(0,-1));return A===Q}var W80=2592000000,rv=(A)=>R3(A).length>0,OAQ,LAQ,NAQ,VAQ,EAQ;var er=mA(()=>{PC();ZFA();OAQ={id:"ios/profile-expiry",platforms:["ios"],appliesTo:rv,async run(A){let Q=[];for(let{bundleId:B,base64:$}of R3(A)){let J=tr($);if(!J?.expirationDate)continue;let Y=new Date(J.expirationDate).getTime()-Date.now();if(Y<=0)Q.push({id:"ios/profile-expiry",severity:"error",title:`Provisioning profile for "${B}" expired on ${J.expirationDate.slice(0,10)}`,fix:"Regenerate the profile in the Apple Developer portal and re-save credentials"});else if(Y<W80)Q.push({id:"ios/profile-expiry",severity:"warning",title:`Provisioning profile for "${B}" expires in ${Math.ceil(Y/86400000)} day(s)`})}return Q}};LAQ={id:"ios/profile-bundle-match",platforms:["ios"],appliesTo:rv,async run(A){let Q=[];for(let{bundleId:B,base64:$}of R3(A)){let J=tr($);if(J?.bundleId&&!MAQ(J.bundleId,B))Q.push({id:"ios/profile-bundle-match",severity:"error",title:`Provisioning profile mapped to "${B}" is for a different bundle id`,detail:`profile: ${J.bundleId} — assigned to: ${B}`,fix:"Use a profile generated for this bundle id (or a wildcard profile)"})}return Q}},NAQ={id:"ios/profile-type-vs-mode",platforms:["ios"],appliesTo:(A)=>rv(A)&&Boolean(A.distributionMode),async run(A){let Q=[];for(let{bundleId:B,base64:$}of R3(A)){let J=tr($);if(!J||J.profileType==="unknown")continue;if(J.profileType!==A.distributionMode)Q.push({id:"ios/profile-type-vs-mode",severity:"error",title:`Profile for "${B}" is ${J.profileType} but the build requests ${A.distributionMode}`,fix:A.distributionMode==="app_store"?"Generate an App Store distribution profile, or build with --ios-distribution ad_hoc":"Generate an Ad Hoc profile, or switch --ios-distribution"})}return Q}},VAQ={id:"ios/cert-profile-pairing",platforms:["ios"],appliesTo:(A)=>rv(A)&&Boolean(A.credentials?.BUILD_CERTIFICATE_BASE64),async run(A){let Q;try{Q=sr(A.credentials.BUILD_CERTIFICATE_BASE64,A.credentials.P12_PASSWORD??"").sha1}catch{return[]}let B=[];for(let{bundleId:$,base64:J}of R3(A)){let Y=tr(J);if(!Y||Y.certificateSha1s.length===0)continue;if(!Y.certificateSha1s.includes(Q))B.push({id:"ios/cert-profile-pairing",severity:"error",title:`Your signing certificate is not included in the provisioning profile for "${$}"`,detail:`cert sha1 ${Q} not in [${Y.certificateSha1s.join(", ")}]`,fix:"Regenerate the profile selecting this distribution certificate, then re-save credentials"})}return B}},EAQ={id:"ios/targets-covered",platforms:["ios"],appliesTo:rv,async run(A){let{findSignableTargets:Q,readPbxproj:B}=await Promise.resolve().then(() => (GZ(),yl)),$=B(A.projectDir);if(!$)return[];let J=Q($),Y=R3(A),Z=J.filter((X)=>X.bundleId&&!Y.some((G)=>MAQ(G.bundleId,X.bundleId)));if(Z.length===0)return[];return[{id:"ios/targets-covered",severity:"error",title:`${Z.length} signable target(s) have no provisioning profile mapped`,detail:`uncovered: ${Z.map((X)=>`${X.name} (${X.bundleId})`).join(", ")}`,fix:'Add --ios-provisioning-profile "bundleId=/path/to/profile.mobileprovision" for each and re-save credentials'}]}}});function As(A){return A.config?.server}function XFA(A){let Q=As(A)?.url;return typeof Q==="string"&&Q!==""?Q:null}function U80(A){if(F80.test(A))return"points at localhost / 127.0.0.1";if(H80.test(A))return"points at a private LAN IP (live-reload)";if(D80.test(A))return"points at a dev tunnel host (ngrok / cloudflare / localtunnel)";if(/^http:\/\//i.test(A))return"uses cleartext http://";return null}function z80(A){if(A==="*")return!0;return/^\*\.[a-z0-9-]+$/i.test(A)}function RAQ(A){let Q=As(A)?.allowNavigation;if(!Array.isArray(Q))return[];return Q.filter((B)=>typeof B==="string"&&z80(B))}var H80,F80,D80,jAQ,wAQ,PAQ;var _AQ=mA(()=>{H80=/^https?:\/\/(?:10\.|172\.(?:1[6-9]|2\d|3[01])\.|192\.168\.)/i,F80=/^https?:\/\/(?:localhost|127\.0\.0\.1)(?:[:/]|$)/i,D80=/^https?:\/\/[^/]*\.(?:ngrok\.io|ngrok-free\.app|trycloudflare\.com|loca\.lt)(?:[:/]|$)/i;jAQ={id:"ios/capacitor-server-url-shipped",platforms:["ios"],appliesTo:(A)=>XFA(A)!==null,async run(A){let Q=XFA(A);if(Q===null)return[];let B=E3(A),$=U80(Q),J=$?`server.url ${$} — this ships a live-reload/remote endpoint into the build`:"server.url ships a remote endpoint into the build instead of the bundled web assets";return[{id:"ios/capacitor-server-url-shipped",severity:B?"error":"warning",title:"capacitor.config server.url is set — the build will load a remote URL instead of bundled assets",detail:J,fix:"Remove the server.url live-reload block before a production build; build web assets and run `npx cap sync`"}]}},wAQ={id:"ios/capacitor-server-cleartext",platforms:["ios"],appliesTo:(A)=>As(A)?.cleartext===!0,async run(A){if(As(A)?.cleartext!==!0)return[];let Q=XFA(A),B=Q!==null&&/^http:\/\//i.test(Q);return[{id:"ios/capacitor-server-cleartext",severity:B?"error":"warning",title:"capacitor.config server.cleartext is enabled — arbitrary cleartext HTTP traffic is allowed",detail:B?"paired with a cleartext http:// server.url":void 0,fix:"Remove server.cleartext (or set it false) for production; use https or a scoped ATS exception"}]}};PAQ={id:"ios/capacitor-allow-navigation-wildcard",platforms:["ios"],appliesTo:(A)=>RAQ(A).length>0,async run(A){let Q=RAQ(A);if(Q.length===0)return[];return[{id:"ios/capacitor-allow-navigation-wildcard",severity:"warning",title:"capacitor.config server.allowNavigation contains a blanket wildcard",detail:`wildcard entr(y/ies): ${Q.join(", ")}`,fix:'Restrict allowNavigation to specific hosts; remove blanket "*" / "*.<tld>" entries'}]}}});function I80(A){return A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function C80(A){return A.match(/buildSettings\s*=\s*\{([\s\S]*?)\n\s*\};/)?.[1]??""}function O80(A){let Q={};for(let B of A.split(`
566
- `)){let $=B.match(/^\s*([A-Z0-9_]+(?:\[[^\]]*\])?)\s*=\s*(.+?);\s*$/i);if(!$)continue;let J=$[1],Y=$[2].trim();if(Y.startsWith("("))continue;if(Y.length>=2&&Y.startsWith('"')&&Y.endsWith('"'))Y=Y.slice(1,-1);Q[J]=Y}return Q}function GFA(A){if(!A)return[];let Q=/(\w+)\s*\/\*[^*]*\*\/\s*=\s*\{[^{}]*isa\s*=\s*XCBuildConfiguration;(?:[^{}]*\{[^}]*\})*[^}]*\}/g,B=[];for(let $ of A.matchAll(Q)){let J=$[0],Y=$[1],Z=J.match(/\bname\s*=\s*("[^"]*"|[^;\s]+)\s*;/),X=Z?Z[1].replace(/^"|"$/g,""):"";B.push({id:Y,name:X,settings:O80(C80(J))})}return B}function M80(A){let Q=A.match(/isa\s*=\s*PBXProject;[\s\S]*?buildConfigurationList\s*=\s*(\w+)/)?.[1];if(!Q)return new Set;return TAQ(A,Q)}function TAQ(A,Q){let B=new RegExp(`${I80(Q)}\\s*\\/\\*[^*]*\\*\\/\\s*=\\s*\\{[^}]*isa\\s*=\\s*XCConfigurationList;[^}]*\\}`),$=A.match(B)?.[0];if(!$)return new Set;let J=$.match(/buildConfigurations\s*=\s*\(([^)]*)\)/);if(!J)return new Set;return new Set(Array.from(J[1].matchAll(/(\w+)/g),(Y)=>Y[1]))}function KFA(A){let Q=M80(A);return GFA(A).map((B)=>({name:B.name,settings:B.settings,isProjectLevel:Q.has(B.id)}))}function sv(A,Q){let B=null;for(let $ of GFA(A)){let J=$.settings[Q];if(J===void 0)continue;if($.name==="Release")return J;if(B===null)B=J}return B}function tv(A,Q){let B=A.match(/^\$\(([A-Z0-9_]+)\)$/i),$=A.match(/^\$\{([A-Z0-9_]+)\}$/i),J=B?.[1]??$?.[1];if(!J)return A;return sv(Q,J)??A}function pD(A){if(!A)return[];let Q=XH(A);if(Q.length===0)return[];let B=new Map,$=/\w+\s*\/\*[^*]*\*\/\s*=\s*\{[^}]*isa\s*=\s*PBXNativeTarget;[^}]*\}/g;for(let Z of A.matchAll($)){let X=Z[0],G=X.match(/\bname\s*=\s*("[^"]*"|[^;\s]+)\s*;/),K=X.match(/buildConfigurationList\s*=\s*(\w+)/);if(!G||!K)continue;B.set(G[1].replace(/^"|"$/g,""),K[1])}let J=GFA(A),Y=new Map(J.map((Z)=>[Z.id,Z]));return Q.map((Z)=>{let X=B.get(Z.name),G=X?TAQ(A,X):new Set,K=Array.from(G).map((W)=>Y.get(W)).filter((W)=>W!==void 0).map((W)=>({name:W.name,settings:W.settings}));return{target:Z,configs:K}})}function ev(A){let Q=[],B=($)=>{if($===void 0)return;let J=Number.parseFloat($);if(!Number.isNaN(J))Q.push(J)};for(let $ of KFA(A))if($.isProjectLevel)B($.settings.IPHONEOS_DEPLOYMENT_TARGET);for(let{target:$,configs:J}of pD(A)){if($.productType!==q80)continue;for(let Y of J)B(Y.settings.IPHONEOS_DEPLOYMENT_TARGET)}return Q.length>0?Math.min(...Q):null}var q80="com.apple.product-type.application";var Nj=mA(()=>{GZ()});import{existsSync as L80,readFileSync as SAQ}from"node:fs";import{dirname as kAQ,isAbsolute as N80,join as V80,resolve as E80}from"node:path";function j80(A,Q){return A.find((B)=>B.name==="Release")?.settings[Q]??A.find((B)=>B.name==="Debug")?.settings[Q]??A.find((B)=>B.settings[Q]!==void 0)?.settings[Q]}function w80(A,Q){let B=bK(A);if(!B)return;let $;try{$=SAQ(B,"utf8")}catch{return}let J=pD($).filter(({target:K})=>K.productType===R80),Y=J.find(({target:K,configs:W})=>K.bundleId===Q||W.some((F)=>F.settings.PRODUCT_BUNDLE_IDENTIFIER===Q))??J[0],Z=Y?j80(Y.configs,"CODE_SIGN_ENTITLEMENTS"):void 0;if(Z===void 0)return;let X=kAQ(kAQ(B)),G=Z.replace(/\$\((?:SRCROOT|SOURCE_ROOT|PROJECT_DIR)\)|\$\{(?:SRCROOT|SOURCE_ROOT|PROJECT_DIR)\}/g,X);if(/\$\([^)]+\)|\$\{[^}]+\}/.test(G))return null;return N80(G)?G:E80(X,G)}function iD(A,Q){let B=w80(A,Q);if(B===null)return null;let $=B??V80(A,"ios","App","App","App.entitlements");if(!L80($))return null;try{return{raw:SAQ($,"utf8")}}catch{return null}}function WFA(A,Q){return cD(A,Q)}function Vj(A,Q){return dD(A,Q)}var R80="com.apple.product-type.application";var bAQ=mA(()=>{GZ();Nj()});import{existsSync as P80,readFileSync as _80}from"node:fs";import{join as T80}from"node:path";function HFA(A){return R3(A).find((Q)=>Q.bundleId===A.appId)}function b80(A){let Q=T80(A,"ios","App","App","Info.plist");if(!P80(Q))return!1;try{return dD(_80(Q,"utf8"),"UIBackgroundModes").includes("remote-notification")}catch{return!1}}function hAQ(A){try{return vl(A).profileEntitlements}catch{return{}}}function f80(A){return x80.has(A)||A.endsWith(".team-identifier")}function v80(A){return A==="*"||A==="$(AppIdentifierPrefix)*"||/^\$\(\w+\)\*$/.test(A)||/^[A-Z0-9]{10}\.\*$/.test(A)}function vAQ(A){if(xAQ.test(A))return A.replace(xAQ,"");if(fAQ.test(A))return A.replace(fAQ,"");return A}function y80(A){let Q=[],B=/<key>([\s\S]*?)<\/key>\s*<(array|string|true|false|dict|integer|real|data|date)(\/)?\s*>/g,$=B.exec(A);while($!==null){let J=$[1].trim(),Y=$[2],Z=$[3]==="/";if(Q.push({key:J,isArray:Y==="array"}),!Z&&(Y==="dict"||Y==="array")){let X=g80(A,Y,$.index+$[0].length);if(X>B.lastIndex)B.lastIndex=X}$=B.exec(A)}return Q}function g80(A,Q,B){let $=new RegExp(`<${Q}>|</${Q}>`,"g");$.lastIndex=B;let J=1;for(let Y=$.exec(A);Y!==null;Y=$.exec(A))if(Y[0]===`<${Q}>`)J++;else if(--J===0)return $.lastIndex;return A.length}var k80=(A)=>HFA(A)!==void 0,S80=(A)=>iD(A.projectDir,A.appId)!==null,x80,xAQ,fAQ,uAQ,mAQ,h80,yAQ="com.apple.developer.associated-domains",cAQ,gAQ="com.apple.security.application-groups",u80,dAQ;var lAQ=mA(()=>{PC();bAQ();er();x80=new Set(["aps-environment","get-task-allow","application-identifier"]);xAQ=/^\$\((?:AppIdentifierPrefix|TeamIdentifierPrefix)\)/,fAQ=/^[A-Z0-9]{10}\./;uAQ={id:"ios/entitlements-vs-profile-capability",platforms:["ios"],appliesTo:(A)=>k80(A)&&S80(A),async run(A){let Q=iD(A.projectDir,A.appId),B=HFA(A);if(!Q||!B)return[];let $=y80(Q.raw).filter((Y)=>!f80(Y.key));if($.length===0)return[];let J=[];for(let{bundleId:Y,base64:Z}of[B]){let X=hAQ(Z);for(let{key:G,isArray:K}of $)if(K){let W=Vj(Q.raw,G),F=X[G],U=Array.isArray(F)?F:typeof F==="string"?[F]:[];if(U.some(v80))continue;let q=new Set(U.map(vAQ)),z=W.filter((I)=>!q.has(vAQ(I)));if(z.length>0)J.push({id:"ios/entitlements-vs-profile-capability",severity:"error",title:`Entitlement "${G}" is not fully covered by the provisioning profile for "${Y}"`,detail:`uncovered ${G} value(s): ${z.join(", ")}`,fix:"Enable the capability for this App ID in the Apple Developer portal, regenerate the profile, and re-save credentials (or remove the unused entitlement)"})}else if(!(G in X))J.push({id:"ios/entitlements-vs-profile-capability",severity:"error",title:`Entitlement "${G}" is declared by the app but not granted by the provisioning profile for "${Y}"`,detail:`missing capability: ${G}`,fix:"Enable the capability for this App ID in the Apple Developer portal, regenerate the profile, and re-save credentials (or remove the unused entitlement)"})}return J}},mAQ={id:"ios/entitlements-aps-environment-vs-mode",platforms:["ios"],appliesTo:(A)=>{let Q=iD(A.projectDir,A.appId);return Q!==null&&WFA(Q.raw,"aps-environment")!==null&&Boolean(A.distributionMode)},async run(A){let Q=iD(A.projectDir,A.appId);if(!Q)return[];let B=WFA(Q.raw,"aps-environment");if(B===null)return[];let $=HFA(A),J=$?hAQ($.base64)["aps-environment"]:void 0,Y=typeof J==="string"&&J!==B,Z=[];if(A.distributionMode==="app_store"&&B==="development"&&!Y){let X=b80(A.projectDir);Z.push({id:"ios/entitlements-aps-environment-vs-mode",severity:X?"error":"warning",title:'aps-environment is "development" but the build distributes to the App Store / TestFlight',detail:X?"The app declares the remote-notification background mode, so it needs a production push environment for App Store / TestFlight":"App Store and TestFlight push needs a production environment; this is the default Capacitor leftover and is harmless unless the app uses push notifications",fix:"Set aps-environment=production in App.entitlements and use a production push profile (or remove aps-environment if the app does not use push)"})}else if(A.distributionMode==="ad_hoc"&&B==="production"&&!Y)Z.push({id:"ios/entitlements-aps-environment-vs-mode",severity:"warning",title:'aps-environment is "production" for an ad_hoc build',detail:"ad_hoc builds usually use the development push environment (production is valid but uncommon)",fix:"Use aps-environment=development for ad_hoc unless you intend production APNs"});if($&&Y)Z.push({id:"ios/entitlements-aps-environment-vs-mode",severity:"error",title:`aps-environment differs between App.entitlements and the provisioning profile for "${$.bundleId}"`,detail:`app: ${B} — profile: ${J}`,fix:"Align aps-environment in App.entitlements with the push profile (or regenerate the profile)"});return Z}},h80=/^(?:applinks|webcredentials|activitycontinuation|appclips):[a-z0-9.-]+(?:\?mode=(?:developer|managed))?$/i,cAQ={id:"ios/entitlements-associated-domains-format",platforms:["ios"],appliesTo:(A)=>{let Q=iD(A.projectDir,A.appId);return Q!==null&&Vj(Q.raw,yAQ).length>0},async run(A){let Q=iD(A.projectDir,A.appId);if(!Q)return[];let B=[];for(let $ of Vj(Q.raw,yAQ)){if(/^(?:applinks|webcredentials|activitycontinuation|appclips):\*$/i.test($))continue;if(!h80.test($))B.push($)}if(B.length===0)return[];return[{id:"ios/entitlements-associated-domains-format",severity:"warning",title:`${B.length} associated-domains entr(y/ies) have an invalid format`,detail:`invalid: ${B.join(", ")}`,fix:'Use the "service:domain" form (e.g. applinks:example.com) — no scheme, path, or trailing slash'}]}},u80=/^group\.[a-z0-9.-]+$/,dAQ={id:"ios/entitlements-app-groups-format",platforms:["ios"],appliesTo:(A)=>{let Q=iD(A.projectDir,A.appId);return Q!==null&&Vj(Q.raw,gAQ).length>0},async run(A){let Q=iD(A.projectDir,A.appId);if(!Q)return[];let B=Vj(Q.raw,gAQ).filter(($)=>!u80.test($));if(B.length===0)return[];return[{id:"ios/entitlements-app-groups-format",severity:"warning",title:`${B.length} app group identifier(s) have an invalid format`,detail:`invalid: ${B.join(", ")}`,fix:'Name app groups "group.<reverse-dns>" (lowercase, no whitespace) and register them in the portal'}]}}});import{existsSync as m80,readFileSync as c80}from"node:fs";import{join as d80}from"node:path";function pAQ(A){let Q=d80(A,...l80);return m80(Q)?Q:null}function nG(A){let Q=pAQ(A);if(!Q)return null;try{return c80(Q,"utf8")}catch{return null}}function Ay(A){return ZX(A)??""}function Qs(A){return A.startsWith("$(")||A.startsWith("${")}function p80(A){let Q=A.config?.server;if(Q===null||typeof Q!=="object")return!1;let B=Q;return B.cleartext===!0||typeof B.url==="string"&&B.url.length>0}var l80,j3=(A)=>pAQ(A.projectDir)!==null,i80,n80,a80,iAQ,o80,r80,nAQ,aAQ,oAQ,rAQ,sAQ,tAQ,eAQ,AQQ,QQQ,s80,BQQ;var $QQ=mA(()=>{GZ();Nj();l80=["ios","App","App","Info.plist"];i80=/^\d+\.\d+(?:\.\d+)?$/,n80=/^\d+(?:\.\d+){0,2}$/,a80=/^[a-z0-9][a-z0-9-]*(?:\.[a-z0-9-]+)+$/i,iAQ=["UIInterfaceOrientationPortrait","UIInterfaceOrientationPortraitUpsideDown","UIInterfaceOrientationLandscapeLeft","UIInterfaceOrientationLandscapeRight"],o80=new Set(iAQ),r80=new Set(["audio","location","voip","fetch","remote-notification","processing","bluetooth-central","bluetooth-peripheral","external-accessory","newsstand-content"]),nAQ={id:"ios/plist-bundle-id-format",platforms:["ios"],appliesTo:j3,async run(A){let Q=nG(A.projectDir);if(Q===null)return[];let B=cD(Q,"CFBundleIdentifier");if(B===null)return[{id:"ios/plist-bundle-id-format",severity:"error",title:"Info.plist has no CFBundleIdentifier",fix:"Set a valid reverse-DNS PRODUCT_BUNDLE_IDENTIFIER (no spaces, underscores, or wildcards)."}];let $=tv(B,Ay(A.projectDir));if(Qs($))return[];if(!a80.test($))return[{id:"ios/plist-bundle-id-format",severity:"error",title:`Invalid bundle identifier "${$}"`,detail:"Bundle ids must be reverse-DNS (≥2 dot-separated segments) with no spaces, underscores, or wildcards.",fix:"Set a valid reverse-DNS PRODUCT_BUNDLE_IDENTIFIER (no spaces, underscores, or wildcards)."}];return[]}},aAQ={id:"ios/plist-version-short-format",platforms:["ios"],appliesTo:j3,async run(A){let Q=nG(A.projectDir);if(Q===null)return[];let B=cD(Q,"CFBundleShortVersionString");if(B===null)return[];let $=tv(B,Ay(A.projectDir));if(Qs($))return[];if(!i80.test($))return[{id:"ios/plist-version-short-format",severity:"error",title:`CFBundleShortVersionString "${$}" is not a valid version (ITMS-90060)`,detail:"The marketing version must be two or three dot-separated integers (e.g. 1.4 or 1.4.2) — no letters or pre-release suffixes.",fix:"Set CFBundleShortVersionString or its build setting to two or three dot-separated integers (e.g. 1.4.2)."}];return[]}},oAQ={id:"ios/plist-version-build-format",platforms:["ios"],appliesTo:j3,async run(A){let Q=nG(A.projectDir);if(Q===null)return[];let B=cD(Q,"CFBundleVersion");if(B===null)return[];let $=tv(B,Ay(A.projectDir));if(Qs($))return[];if(!n80.test($))return[{id:"ios/plist-version-build-format",severity:"error",title:`CFBundleVersion "${$}" is not a valid build number`,detail:"The build number must be numeric, ≤3 dot-separated integers (e.g. 42 or 1.4.42).",fix:"Set CURRENT_PROJECT_VERSION numeric, ≤3 integers (e.g. 42 or 1.4.42)."}];return[]}},rAQ={id:"ios/plist-encryption-compliance",platforms:["ios"],appliesTo:(A)=>j3(A)&&E3(A),async run(A){let Q=nG(A.projectDir);if(Q===null)return[];if(NM(Q,"ITSAppUsesNonExemptEncryption"))return[];return[{id:"ios/plist-encryption-compliance",severity:"warning",title:"Info.plist is missing ITSAppUsesNonExemptEncryption",detail:'Without this key, App Store Connect shows a "Missing Compliance" prompt on every upload.',fix:"Add ITSAppUsesNonExemptEncryption=<false/> (correct for most Capacitor apps) to stop the per-upload Missing Compliance prompt."}]}},sAQ={id:"ios/plist-ats-arbitrary-loads",platforms:["ios"],appliesTo:j3,async run(A){let Q=nG(A.projectDir);if(Q===null)return[];let B=zeA(Q,"NSAppTransportSecurity");if(B===null)return[];if(ir(B,"NSAllowsArbitraryLoads")!==!0)return[];let $=E3(A)&&p80(A);return[{id:"ios/plist-ats-arbitrary-loads",severity:$?"error":"warning",title:"NSAllowsArbitraryLoads is enabled (App Transport Security disabled)",detail:$?"Uploading with arbitrary loads enabled and a dev server (cleartext / server.url) still configured ships an insecure release.":"NSAllowsArbitraryLoads disables App Transport Security for all hosts.",fix:"Remove NSAllowsArbitraryLoads (or set <false/>); use scoped NSExceptionDomains; remove server.url/cleartext before release."}]}},tAQ={id:"ios/plist-launch-storyboard",platforms:["ios"],appliesTo:j3,async run(A){let Q=nG(A.projectDir);if(Q===null)return[];if(NM(Q,"UILaunchStoryboardName")||NM(Q,"UILaunchScreen"))return[];return[{id:"ios/plist-launch-storyboard",severity:"error",title:"Info.plist declares no launch screen (ITMS-90475/90096)",detail:"App Store upload requires a launch storyboard or a UILaunchScreen dictionary.",fix:"Add UILaunchStoryboardName=LaunchScreen (Capacitor default) or a UILaunchScreen dict."}]}},eAQ={id:"ios/plist-orientations-multitasking",platforms:["ios"],appliesTo(A){if(!j3(A))return!1;let Q=nG(A.projectDir);if(Q===null)return!1;if(ir(Q,"UIRequiresFullScreen")===!0)return!1;let B=sv(Ay(A.projectDir),"TARGETED_DEVICE_FAMILY");if(B===null)return!1;return B.split(",").map(($)=>$.trim()).includes("2")},async run(A){let Q=nG(A.projectDir);if(Q===null)return[];let B=dD(Q,"UISupportedInterfaceOrientations~ipad");if(!NM(Q,"UISupportedInterfaceOrientations~ipad"))B=dD(Q,"UISupportedInterfaceOrientations");let $=new Set(B),J=iAQ.filter((Y)=>!$.has(Y));if(J.length===0)return[];return[{id:"ios/plist-orientations-multitasking",severity:"warning",title:`iPad multitasking requires all four orientations — missing ${J.join(", ")} (ITMS-90474)`,detail:"An iPad-capable app that supports multitasking must declare all four interface orientations for iPad.",fix:"Add all four orientations to UISupportedInterfaceOrientations~ipad, or add UIRequiresFullScreen=<true/>."}]}},AQQ={id:"ios/plist-orientations-present",platforms:["ios"],appliesTo:j3,async run(A){let Q=nG(A.projectDir);if(Q===null)return[];let B=dD(Q,"UISupportedInterfaceOrientations");if(B.length===0)return[{id:"ios/plist-orientations-present",severity:"warning",title:"Info.plist declares no UISupportedInterfaceOrientations",detail:"Declare at least one supported interface orientation for iPhone.",fix:"Declare ≥1 valid UIInterfaceOrientation* value."}];let $=B.find((J)=>!o80.has(J));if($!==void 0)return[{id:"ios/plist-orientations-present",severity:"warning",title:`Invalid interface orientation "${$}"`,detail:"Each entry must be one of UIInterfaceOrientationPortrait, PortraitUpsideDown, LandscapeLeft, LandscapeRight.",fix:"Declare ≥1 valid UIInterfaceOrientation* value."}];return[]}},QQQ={id:"ios/plist-display-name",platforms:["ios"],appliesTo:j3,async run(A){let Q=nG(A.projectDir);if(Q===null)return[];let B=Ay(A.projectDir),$=(J)=>{let Y=cD(Q,J);if(Y===null)return null;let Z=tv(Y,B);if(Qs(Z)||Z.trim()==="")return null;return Z};if($("CFBundleDisplayName")!==null||$("CFBundleName")!==null)return[];return[{id:"ios/plist-display-name",severity:"warning",title:"Info.plist has no resolvable app display name",detail:"Neither CFBundleDisplayName nor CFBundleName resolves to a non-empty value.",fix:"Set CFBundleDisplayName or ensure PRODUCT_NAME resolves."}]}},s80=["NSLocationWhenInUseUsageDescription","NSLocationAlwaysAndWhenInUseUsageDescription","NSLocationAlwaysUsageDescription","NSLocationUsageDescription"],BQQ={id:"ios/plist-background-modes-sanity",platforms:["ios"],appliesTo(A){if(!j3(A))return!1;let Q=nG(A.projectDir);return Q!==null&&NM(Q,"UIBackgroundModes")},async run(A){let Q=nG(A.projectDir);if(Q===null)return[];let B=dD(Q,"UIBackgroundModes"),$=[],J=B.filter((Y)=>!r80.has(Y));if(J.length>0)$.push({id:"ios/plist-background-modes-sanity",severity:"warning",title:`Unknown UIBackgroundModes value(s): ${J.join(", ")}`,detail:"Background modes must be one of Apple's documented UIBackgroundModes tokens.",fix:"Remove unused background modes; add matching usage strings/capabilities."});if(B.includes("location")&&E3(A)){if(!s80.some((Z)=>NM(Q,Z)))$.push({id:"ios/plist-background-modes-sanity",severity:"warning",title:'UIBackgroundModes declares "location" without a location usage description (Guideline 2.5.4)',detail:"App Review rejects background location without an NSLocation*UsageDescription string.",fix:"Add the matching NSLocation*UsageDescription, or remove the location background mode."})}return $}}});import{readFileSync as t80}from"node:fs";import{join as e80}from"node:path";function Qy(A){try{return JSON.parse(t80(A,"utf8"))}catch{return null}}function By(A,Q){let B=(Q?sv(Q,"ASSETCATALOG_COMPILER_APPICON_NAME"):null)??"AppIcon";return e80(A,"ios","App","App","Assets.xcassets",`${B}.appiconset`)}function A40(A){return(A??"").trim()}function JQQ(A){return(A?.images??[]).some((Q)=>A40(Q.size)==="1024x1024"||Q.role==="marketing")}var YQQ=mA(()=>{Nj()});import{existsSync as Nq}from"node:fs";import{join as NX}from"node:path";function ZQQ(A){return NX(A,"ios","App","Podfile")}function DFA(A){return NX(A,"ios","App","CapApp-SPM","Package.swift")}function UFA(A){return Nq(ZQQ(A.projectDir))}function zFA(A){return Nq(DFA(A.projectDir))}function Bs(A){return ZX(A.projectDir)}function FFA(A){if(A.platform!=="ios")return!1;if((A.distributionMode??"app_store")!=="app_store")return!1;let B=A.credentials;return Boolean(B?.APPLE_KEY_ID&&B?.APPLE_ISSUER_ID&&B?.APPLE_KEY_CONTENT)}var XQQ,GQQ,KQQ,WQQ,HQQ,FQQ,DQQ,UQQ,Q40,zQQ;var qQQ=mA(()=>{YQQ();Nj();GZ();Lq();XQQ={id:"ios/pods-not-installed",platforms:["ios"],appliesTo:UFA,async run(A){let Q=NX(A.projectDir,"ios","App"),B=Nq(NX(Q,"Pods")),$=Nq(NX(Q,"App.xcworkspace"));if(B&&$)return[];let J=[];if(!B)J.push("ios/App/Pods");if(!$)J.push("ios/App/App.xcworkspace");return[{id:"ios/pods-not-installed",severity:"warning",title:"CocoaPods is not installed (missing Pods/ or App.xcworkspace)",detail:`A Podfile exists but ${J.join(" and ")} ${J.length>1?"are":"is"} missing. The cloud build runs pod install and recovers, but local Xcode builds will fail.`,fix:"Run `npx cap sync ios` (or `pod install`) and commit Pods/ + App.xcworkspace."}]}},GQQ={id:"ios/pods-lock-missing",platforms:["ios"],appliesTo:UFA,async run(A){if(i6(NX(A.projectDir,"ios","App","Podfile.lock"))!==null)return[];return[{id:"ios/pods-lock-missing",severity:"warning",title:"Podfile.lock is missing - pod versions are not pinned",detail:"Without Podfile.lock the cloud build resolves pod versions fresh, which can drift from your local versions.",fix:"Run `pod install` and commit Podfile.lock."}]}},KQQ={id:"ios/pods-capacitor-missing",platforms:["ios"],appliesTo:UFA,async run(A){let Q=i6(ZQQ(A.projectDir));if(Q===null)return[];if(/pod\s+['"]Capacitor['"]/.test(Q)||/capacitor_pods/.test(Q)||/@capacitor\/ios/.test(Q))return[];return[{id:"ios/pods-capacitor-missing",severity:"warning",title:"Podfile does not appear to wire the Capacitor pod",detail:"No `pod 'Capacitor'`, `capacitor_pods` helper, or `@capacitor/ios` reference was found. If this is intentional (custom pod names) you can ignore this.",fix:"Run `npx cap sync ios` then `pod install`."}]}},WQQ={id:"ios/spm-package-resolved-missing",platforms:["ios"],appliesTo:zFA,async run(A){let Q=NX(A.projectDir,"ios","App","App.xcodeproj","project.xcworkspace","xcshareddata","swiftpm","Package.resolved"),B=NX(A.projectDir,"ios","App","CapApp-SPM","Package.resolved");if(Nq(Q)||Nq(B))return[];return[{id:"ios/spm-package-resolved-missing",severity:"warning",title:"Swift Package Manager Package.resolved is missing",detail:"No Package.resolved found under the xcodeproj or CapApp-SPM. The cloud build resolves packages during build_app, but committing Package.resolved pins versions for reproducible builds.",fix:"Run `xcodebuild -resolvePackageDependencies` (or open in Xcode) and commit Package.resolved."}]}},HQQ={id:"ios/spm-capacitor-dependency-missing",platforms:["ios"],appliesTo:zFA,async run(A){let Q=i6(DFA(A.projectDir));if(Q===null)return[];let B=/capacitor-swift-pm/.test(Q),$=/\.product\(\s*name:\s*['"]Capacitor['"]/.test(Q);if(B&&$)return[];return[{id:"ios/spm-capacitor-dependency-missing",severity:"warning",title:"Package.swift does not declare the Capacitor SPM dependency",detail:'Expected a capacitor-swift-pm package dependency and a `.product(name: "Capacitor", ...)` target dependency. If your project uses a non-standard layout you can ignore this.',fix:"Run `npx cap sync ios` to regenerate Package.swift."}]}},FQQ={id:"ios/appicon-empty-or-placeholder",platforms:["ios"],async run(A){let Q=By(A.projectDir,Bs(A)??void 0);if(!Nq(Q))return[{id:"ios/appicon-empty-or-placeholder",severity:"error",title:"AppIcon.appiconset is missing",detail:`Expected an app-icon asset set at ${Q.replace(A.projectDir,".")} but the directory does not exist.`,fix:"Run `npx @capacitor/assets generate` (or add the icon set in Xcode)."}];let B=Qy(NX(Q,"Contents.json"));if(B===null)return[{id:"ios/appicon-empty-or-placeholder",severity:"error",title:"AppIcon Contents.json is missing or malformed",detail:"The app-icon Contents.json could not be parsed as JSON.",fix:"Regenerate the icon set (`npx @capacitor/assets generate`) or fix the malformed Contents.json."}];if((B.images??[]).some((J)=>J.filename?.trim()))return[];return[{id:"ios/appicon-empty-or-placeholder",severity:FFA(A)?"error":"warning",title:"AppIcon.appiconset declares no icon images",detail:FFA(A)?"The icon set has no images - App Store upload will reject it (ITMS-90704).":"The icon set has no images. The build tolerates this for ad_hoc/development, but App Store upload would reject it.",fix:"Run `npx @capacitor/assets generate` so the set has at least the 1024x1024 icon."}]}},DQQ={id:"ios/appicon-referenced-file-missing",platforms:["ios"],appliesTo(A){let Q=By(A.projectDir,ZX(A.projectDir)??void 0);return Qy(NX(Q,"Contents.json"))!==null},async run(A){let Q=By(A.projectDir,Bs(A)??void 0),B=Qy(NX(Q,"Contents.json"));if(B===null)return[];let $=[];for(let J of B.images??[]){let Y=J.filename?.trim();if(!Y)continue;if(!Nq(NX(Q,Y)))$.push(Y)}if($.length===0)return[];return[{id:"ios/appicon-referenced-file-missing",severity:"error",title:"AppIcon Contents.json references icon file(s) missing from disk",detail:`actool will fail the build: missing ${$.join(", ")}.`,fix:"Regenerate the icons (`npx @capacitor/assets generate`) or commit the referenced PNG(s)."}]}},UQQ={id:"ios/appicon-marketing-missing",platforms:["ios"],appliesTo:FFA,async run(A){let Q=By(A.projectDir,Bs(A)??void 0),B=Qy(NX(Q,"Contents.json"));if(B===null)return[];if(JQQ(B))return[];return[{id:"ios/appicon-marketing-missing",severity:"error",title:"App Store marketing icon (1024x1024) is missing",detail:"App Store upload requires a 1024x1024 marketing icon in the AppIcon set (ITMS-90704).",fix:"Add a 1024x1024 PNG (no alpha) marketing icon and reference it in Contents.json."}]}},Q40=/\.iOS\(\.v(\d+)\)/,zQQ={id:"ios/spm-deployment-target-consistency",platforms:["ios"],appliesTo(A){if(!zFA(A))return!1;let Q=ZX(A.projectDir);if(Q===null)return!1;return ev(Q)!==null},async run(A){let Q=Bs(A);if(Q===null)return[];let B=ev(Q);if(B===null)return[];let $=i6(DFA(A.projectDir));if($===null)return[];let J=$.match(Q40);if(!J)return[];let Y=Number.parseFloat(J[1]);if(Number.isNaN(Y)||B>=Y)return[];return[{id:"ios/spm-deployment-target-consistency",severity:"warning",title:"IPHONEOS_DEPLOYMENT_TARGET is below the Package.swift iOS minimum",detail:`The Xcode app target builds for iOS ${B} but Package.swift requires iOS ${Y} (.iOS(.v${Y})).`,fix:`Raise IPHONEOS_DEPLOYMENT_TARGET to >= ${Y}, or run \`npx cap sync ios\`.`}]}}});function wZ(A){return ZX(A.projectDir)}function qFA(A){return XH(A).filter((Q)=>Q.productType===B40)}function Y40(A){return $40[A]??J40}function IQQ(A){return ev(A)}function $s(A,Q){let B=A.find((J)=>J.name==="Release")?.settings[Q];if(B!==void 0)return B;let $=A.find((J)=>J.name==="Debug")?.settings[Q];if($!==void 0)return $;for(let J of A)if(J.settings[Q]!==void 0)return J.settings[Q];return}function OQQ(A){let Q=[];for(let{target:B,configs:$}of pD(A)){if($s($,"CODE_SIGN_STYLE")===void 0)continue;let Y=$s($,"DEVELOPMENT_TEAM");if(Y===void 0||Y.trim()==="")Q.push(B.name)}return Q}function Z40(A){let Q=[];for(let{target:B,configs:$}of pD(A)){let J=$.map((Z)=>Z.settings.PRODUCT_BUNDLE_IDENTIFIER).filter((Z)=>Z!==void 0);if(J.length<2)continue;let Y=Array.from(new Set(J));if(Y.length>=2)Q.push({name:B.name,values:Y})}return Q}function MQQ(A){return KFA(A).filter((Q)=>Q.settings.ENABLE_BITCODE==="YES").map((Q)=>Q.isProjectLevel?`project ${Q.name}`:Q.name)}function X40(A){let Q=[];for(let{target:B,configs:$}of pD(A)){let J=$s($,"SWIFT_VERSION");if(J===void 0)continue;let Y=J.match(/^\s*(\d+(?:\.\d+)?)/),Z=Y?Number.parseFloat(Y[1]):Number.NaN;if(Number.isNaN(Z)||Z<5)Q.push({name:B.name,value:J})}return Q}var B40="com.apple.product-type.application",$40,J40=14,LQQ,CQQ=(A)=>R3(A).length>0,NQQ,VQQ,EQQ,RQQ,jQQ,wQQ;var PQQ=mA(()=>{GZ();$FA();Nj();er();$40={5:13,6:13,7:14,8:14};LQQ={id:"ios/xcode-deployment-target-capacitor",platforms:["ios"],appliesTo:(A)=>{if(Oj(A.projectDir)===null)return!1;let Q=wZ(A);return Q!==null&&IQQ(Q)!==null},async run(A){let Q=wZ(A);if(!Q)return[];let B=Oj(A.projectDir),$=IQQ(Q);if(B===null||$===null)return[];let J=Y40(B);if($>=J)return[];return[{id:"ios/xcode-deployment-target-capacitor",severity:"error",title:`IPHONEOS_DEPLOYMENT_TARGET ${$} is below the Capacitor ${B} floor (${J})`,detail:`Capacitor ${B} requires iOS deployment target >= ${J}; the build will fail otherwise.`,fix:`Raise IPHONEOS_DEPLOYMENT_TARGET to >= ${J} (project + app target) and the Podfile platform line if present.`}]}};NQQ={id:"ios/xcode-signing-team",platforms:["ios"],appliesTo:(A)=>{if(CQQ(A))return!1;let Q=wZ(A);return Q!==null&&OQQ(Q).length>0},async run(A){if(CQQ(A))return[];let Q=wZ(A);if(!Q)return[];let B=OQQ(Q);if(B.length===0)return[];return[{id:"ios/xcode-signing-team",severity:E3(A)?"error":"warning",title:`${B.length} signable target(s) set a code-signing style but no DEVELOPMENT_TEAM`,detail:`targets without a team: ${B.join(", ")}`,fix:"Set DEVELOPMENT_TEAM in Xcode (Signing & Capabilities), or supply signing creds/profiles to the cloud build so it switches to managed-manual signing."}]}};VQQ={id:"ios/xcode-bundle-id-mismatch-across-configs",platforms:["ios"],appliesTo:(A)=>{let Q=wZ(A);return Q!==null&&pD(Q).some((B)=>{return B.configs.map((J)=>J.settings.PRODUCT_BUNDLE_IDENTIFIER).filter((J)=>J!==void 0).length>=2})},async run(A){let Q=wZ(A);if(!Q)return[];let B=Z40(Q);if(B.length===0)return[];return[{id:"ios/xcode-bundle-id-mismatch-across-configs",severity:"warning",title:`PRODUCT_BUNDLE_IDENTIFIER differs across build configs in ${B.length} target(s)`,detail:B.map(($)=>`${$.name}: ${$.values.join(" vs ")}`).join("; "),fix:"Align PRODUCT_BUNDLE_IDENTIFIER across Debug/Release (or ignore if a Debug suffix is intentional)."}]}};EQQ={id:"ios/xcode-enable-bitcode-leftover",platforms:["ios"],appliesTo:(A)=>{let Q=wZ(A);return Q!==null&&MQQ(Q).length>0},async run(A){let Q=wZ(A);if(!Q)return[];let B=MQQ(Q);if(B.length===0)return[];return[{id:"ios/xcode-enable-bitcode-leftover",severity:"warning",title:"ENABLE_BITCODE = YES is set (deprecated since Xcode 14)",detail:`present in: ${B.join(", ")}`,fix:"Set ENABLE_BITCODE = NO or delete it — Xcode 14+ ignores bitcode and Apple no longer accepts it."}]}};RQQ={id:"ios/xcode-swift-version-sanity",platforms:["ios"],appliesTo:(A)=>{let Q=wZ(A);return Q!==null&&pD(Q).some((B)=>$s(B.configs,"SWIFT_VERSION")!==void 0)},async run(A){let Q=wZ(A);if(!Q)return[];let B=X40(Q);if(B.length===0)return[];return[{id:"ios/xcode-swift-version-sanity",severity:"warning",title:`SWIFT_VERSION is below 5 (or unparseable) in ${B.length} target(s)`,detail:B.map(($)=>`${$.name}: ${$.value}`).join("; "),fix:"Set SWIFT_VERSION = 5.0 (or your intended Swift >= 5) for the affected target(s)."}]}},jQQ={id:"ios/xcode-no-app-target",platforms:["ios"],appliesTo:(A)=>wZ(A)!==null,async run(A){let Q=wZ(A);if(!Q)return[];if(qFA(Q).length>0)return[];return[{id:"ios/xcode-no-app-target",severity:"error",title:"No application target found in the Xcode project",detail:"The pbxproj parsed but contains no com.apple.product-type.application target — the build has nothing to archive.",fix:"Run `npx cap sync ios`, or restore the application target in Xcode."}]}},wQQ={id:"ios/xcode-multiple-app-targets",platforms:["ios"],appliesTo:(A)=>{let Q=wZ(A);return Q!==null&&qFA(Q).length>1},async run(A){let Q=wZ(A);if(!Q)return[];let B=qFA(Q);if(B.length<=1)return[];return[{id:"ios/xcode-multiple-app-targets",severity:"warning",title:`${B.length} application targets found — the build may sign/archive the wrong one`,detail:`app targets: ${B.map(($)=>`${$.name} (${$.bundleId})`).join(", ")}`,fix:"Keep a single application target, remove the duplicate, or pass the intended scheme to the build."}]}}});import{createRequire as G40}from"node:module";import{existsSync as Ej}from"node:fs";import{dirname as K40,join as w3}from"node:path";function W40(A){let Q=i6(w3(A,"package.json"));if(!Q)return[];let B;try{B=JSON.parse(Q)}catch{return[]}let $=new Set(["@capacitor/core","@capacitor/cli","@capacitor/ios","@capacitor/android","@capacitor/assets","@capacitor/synapse"]);return Object.keys(B.dependencies??{}).filter((J)=>J.startsWith("@capacitor/")&&!$.has(J))}function H40(A){return A.replace(/^@/,"").replace(/\//g,"-")}function F40(A,Q){try{let $=G40(w3(A,"package.json")).resolve(`${Q}/package.json`);return Ej(w3(K40($),"android"))}catch{return!1}}var _QQ,TQQ,kQQ;var SQQ=mA(()=>{Lq();_QQ={id:"shared/cap-sync-stale",platforms:["ios","android"],async run(A){let Q=[],B=A.config?.webDir??"dist";if(!Ej(w3(A.projectDir,B)))return Q.push({id:"shared/cap-sync-stale",severity:"error",title:`webDir "${B}" does not exist — web assets were never built`,fix:"Run your web build (e.g. `npm run build`) then `npx cap sync` before requesting a build"}),Q;let $=W40(A.projectDir),J=$.filter((Z)=>F40(A.projectDir,Z)),Y=z9(A.config,A.platform);if(A.platform==="android"&&J.length>0){let Z=i6(w3(A.projectDir,Y,"capacitor.settings.gradle"));if(Z===null)Q.push({id:"shared/cap-sync-stale",severity:"error",title:`${Y}/capacitor.settings.gradle is missing — \`npx cap sync android\` was never run`,fix:"Run `npx cap sync android`"});else{let X=J.filter((G)=>!Z.includes(`:${H40(G)}`));if(X.length>0)Q.push({id:"shared/cap-sync-stale",severity:"error",title:`${X.length} Capacitor plugin(s) not synced into the Android project`,detail:`missing from capacitor.settings.gradle: ${X.join(", ")}`,fix:"Run `npx cap sync android` (sync, not copy — copy does not regenerate plugin projects)"})}}if(A.platform==="ios"&&$.length>0){let Z=Ej(w3(A.projectDir,Y,"App","Podfile")),X=Ej(w3(A.projectDir,Y,"App","CapApp-SPM","Package.swift"));if(!Z&&!X)Q.push({id:"shared/cap-sync-stale",severity:"error",title:`${Y}/App sync artifacts are missing — \`npx cap sync ios\` was never run`,detail:`expected ${Y}/App/Podfile (CocoaPods) or ${Y}/App/CapApp-SPM/Package.swift (SPM)`,fix:"Run `npx cap sync ios`"})}return Q}},TQQ={id:"shared/node-linker-layout",platforms:["ios","android"],async run(A){let Q=w3(A.projectDir,"node_modules");if(Ej(w3(Q,".bun")))return[{id:"shared/node-linker-layout",severity:"error",title:'bun isolated node_modules layout detected — Capacitor Gradle/Pod paths will not resolve ("No variants exist")',fix:"Reinstall with `bun install --linker=hoisted`"}];if(Ej(w3(Q,".pnpm")))return[{id:"shared/node-linker-layout",severity:"warning",title:"pnpm symlinked node_modules layout detected — Capacitor native builds often need a hoisted layout",fix:"If the build fails resolving @capacitor/* paths, set `node-linker=hoisted` in .npmrc and reinstall"}];return[]}},kQQ={id:"shared/bundle-id-consistency",platforms:["ios","android"],async run(A){let Q=A.config?.appId??A.appId;if(A.platform==="android"){let Z=cv(A.projectDir);if(Z&&Z!==Q)return[{id:"shared/bundle-id-consistency",severity:"warning",title:"Gradle applicationId differs from the Capacitor appId",detail:`capacitor.config appId: ${Q} — android/app/build.gradle applicationId: ${Z}`,fix:"Align them (or pass the intended appId explicitly to `build request`)"}];return[]}let{findSignableTargets:B,readPbxproj:$}=await Promise.resolve().then(() => (GZ(),yl)),J=$(A.projectDir);if(!J)return[];let Y=B(J);if(Y.length>0&&!Y.some((Z)=>Z.bundleId===Q))return[{id:"shared/bundle-id-consistency",severity:"warning",title:"No Xcode target uses the Capacitor appId as its bundle identifier",detail:`capacitor appId: ${Q} — targets: ${Y.map((Z)=>`${Z.name}=${Z.bundleId}`).join(", ")}`,fix:"Align PRODUCT_BUNDLE_IDENTIFIER with the appId, or build with the intended appId"}];return[]}}});var bQQ,xQQ;var fQQ=mA(()=>{bQQ={id:"shared/apikey-permission",platforms:["ios","android"],remote:!0,async run(A){let{data:Q,error:B}=await A.supabase.rpc("cli_check_permission",{apikey:A.apikey??"",permission_key:"app.build_native",org_id:null,app_id:A.appId,channel_id:null});if(B)return[{id:"shared/apikey-permission",severity:"info",title:"Could not verify build permission (network/API error)",detail:B.message}];if(Q!==!0)return[{id:"shared/apikey-permission",severity:"error",title:`This apikey lacks the app.build_native permission for ${A.appId}`,fix:"Use an apikey from the org that owns the app (role with native-build rights), or fix the appId"}];return[]}},xQQ={id:"shared/app-exists",platforms:["ios","android"],remote:!0,async run(A){let{data:Q,error:B}=await A.supabase.from("apps").select("app_id").eq("app_id",A.appId).maybeSingle();if(B)return[{id:"shared/app-exists",severity:"info",title:"Could not verify app existence (network/API error)",detail:B.message}];if(!Q)return[{id:"shared/app-exists",severity:"error",title:`App ${A.appId} is not visible to this apikey`,detail:"Either the app does not exist or it belongs to an org this key cannot access",fix:`Create it (npx @capgo/cli app add ${A.appId}) or pass the right appId / apikey`}];return[]}}});function I40(A){let Q;try{Q=JSON.parse(A.toString("utf-8"))}catch(J){throw Error(`Service account file is not valid JSON: ${J instanceof Error?J.message:String(J)}`)}if(!Q||typeof Q!=="object")throw Error("Service account file is not a JSON object.");let B=Q;if(B.type!=="service_account")throw Error(`Expected "type": "service_account" — found ${JSON.stringify(B.type)}. This file is not a service account key.`);let $=["client_email","private_key","project_id","token_uri"];for(let J of $){let Y=B[J];if(typeof Y!=="string"||Y.length===0)throw Error(`Service account JSON is missing required field "${J}".`)}if(!q40.has(B.token_uri))throw Error("Service account JSON has an unsupported token_uri. Expected a Google OAuth token endpoint.");return{type:"service_account",client_email:B.client_email,private_key:B.private_key,project_id:B.project_id,token_uri:B.token_uri,private_key_id:typeof B.private_key_id==="string"?B.private_key_id:void 0,client_id:typeof B.client_id==="string"?B.client_id:void 0}}function C40(A){let Q=Math.floor(Date.now()/1000);return yQQ.default.sign({iss:A.client_email,scope:D40,aud:A.token_uri,exp:Q+U40,iat:Q},A.private_key,{algorithm:"RS256",header:{alg:"RS256",typ:"JWT",kid:A.private_key_id??""}})}async function O40(A){let Q=new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:A.assertion}),B=await IFA({url:A.key.token_uri,init:{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:Q.toString()},signal:A.signal,timeoutMs:A.timeoutMs,fetchImpl:A.fetchImpl}),$=await B.text();if(!B.ok){let Y=`${B.status} ${B.statusText}`;try{let Z=JSON.parse($);if(Z.error)Y=Z.error_description?`${Z.error}: ${Z.error_description}`:Z.error}catch{}if(B.status>=500||B.status<400)throw new $y(`Google's token endpoint returned ${Y}. Try again in a moment.`);throw Error(`Google rejected the service account credentials (${Y}). The private key may be revoked or invalid.`)}let J;try{J=JSON.parse($)}catch{throw new $y(`Google's token endpoint returned a non-JSON response (${B.status}).`)}if(typeof J.access_token!=="string"||J.access_token.length===0)throw new $y("Google's token response was missing an access_token field.");return J.access_token}async function IFA(A){let Q=new AbortController,B=setTimeout(()=>Q.abort(),A.timeoutMs),$,J=null;if(A.signal){let Y=new AbortController;if(J=()=>Y.abort(),A.signal.addEventListener("abort",J,{once:!0}),Q.signal.addEventListener("abort",J,{once:!0}),A.signal.aborted||Q.signal.aborted)Y.abort();$=Y.signal}else $=Q.signal;try{return await A.fetchImpl(A.url,{...A.init,signal:$})}finally{if(clearTimeout(B),J)A.signal?.removeEventListener("abort",J),Q.signal.removeEventListener("abort",J)}}async function M40(A){let Q=`${vQQ}/applications/${encodeURIComponent(A.packageName)}/edits`,B;try{B=await IFA({url:Q,init:{method:"POST",headers:{Authorization:`Bearer ${A.accessToken}`,"Content-Type":"application/json",Accept:"application/json"},body:"{}"},signal:A.signal,timeoutMs:A.timeoutMs,fetchImpl:A.fetchImpl})}catch(Z){return{kind:"network",detail:Z instanceof Error?Z.message:String(Z)}}let $=await B.text();if(wB(`probeAppAccess: POST ${Q} → HTTP ${B.status} ${B.statusText}${B.ok?"":` :: ${$.slice(0,300)}`}`),B.status===401||B.status===403||B.status===404)return{kind:"no-access",detail:L40($)??`${B.status} ${B.statusText}`};if(!B.ok)return{kind:"network",detail:`${B.status} ${B.statusText}: ${$.slice(0,200)}`};let J;try{J=JSON.parse($)}catch{return{kind:"network",detail:"Play API returned non-JSON on edits.insert"}}if(typeof J.id!=="string"||J.id.length===0)return{kind:"network",detail:"Play API returned no edit id"};let Y=`${vQQ}/applications/${encodeURIComponent(A.packageName)}/edits/${encodeURIComponent(J.id)}`;try{await IFA({url:Y,init:{method:"DELETE",headers:{Authorization:`Bearer ${A.accessToken}`}},signal:A.signal,timeoutMs:A.timeoutMs,fetchImpl:A.fetchImpl})}catch{}return{kind:"ok"}}function L40(A){try{let Q=JSON.parse(A);if(Q.error?.message)return Q.error.status?`${Q.error.status}: ${Q.error.message}`:Q.error.message}catch{}return null}async function P3(A){let Q=A.timeoutMs??z40,B=A.fetchImpl??globalThis.fetch.bind(globalThis),$;try{$=I40(A.jsonBytes)}catch(Z){return{ok:!1,kind:"shape-error",message:Z instanceof Error?Z.message:String(Z)}}if(A.signal?.aborted)return{ok:!1,kind:"network-error",message:"Validation cancelled."};let J;try{let Z=C40($);J=await O40({key:$,assertion:Z,signal:A.signal,timeoutMs:Q,fetchImpl:B})}catch(Z){let X=Z instanceof Error?Z.message:String(Z),G=Z?.name==="AbortError",K=Z instanceof $y,W=/timeout|timed out|network|fetch failed|ENOTFOUND|EAI_AGAIN|ECONNRESET|ECONNREFUSED/i.test(X);if(G||K||W)return{ok:!1,kind:"network-error",message:X};return{ok:!1,kind:"token-error",message:X}}if(A.signal?.aborted)return{ok:!1,kind:"network-error",message:"Validation cancelled."};let Y=await M40({accessToken:J,packageName:A.packageName,signal:A.signal,timeoutMs:Q,fetchImpl:B});if(Y.kind==="ok")return{ok:!0,serviceAccountEmail:$.client_email,projectId:$.project_id};if(Y.kind==="no-access")return{ok:!1,kind:"no-app-access",serviceAccountEmail:$.client_email,message:`Service account "${$.client_email}" cannot access package "${A.packageName}" on Google Play (${Y.detail}). Open Play Console → Users and permissions, invite the service account email, and grant access to this app.`};return{ok:!1,kind:"network-error",message:Y.detail}}var yQQ,D40="https://www.googleapis.com/auth/androidpublisher",vQQ="https://androidpublisher.googleapis.com/androidpublisher/v3",U40=3600,z40=30000,q40,$y;var Jy=mA(()=>{T5();yQQ=AQ(No(),1),q40=new Set(["https://oauth2.googleapis.com/token","https://accounts.google.com/o/oauth2/token","https://www.googleapis.com/oauth2/v4/token"]);$y=class $y extends Error{constructor(A){super(A);this.name="TokenExchangeTransientError"}}});function CFA(A,Q){if(typeof A!=="string")return;let B=GG(A);for(let $ of Q)if($)B=B.replaceAll($,"[REDACTED IDENTIFIER]");return B=B.replace(/\p{Cc}+/gu," ").replace(/\s+/g," ").trim(),B?B.slice(0,R40):void 0}async function gQQ(A){let Q=A.fetchImpl??globalThis.fetch.bind(globalThis),B=A.timeoutMs??V40;if(A.signal?.aborted)return{ok:!1,kind:"network",message:"App Store Connect check cancelled."};let $;try{$=rR(A.keyId,A.issuerId,A.p8Pem)}catch{return{ok:!1,kind:"auth-error",message:"Could not sign the App Store Connect request - the .p8 key, Key ID, or Issuer ID is invalid."}}let J=new AbortController,Y=setTimeout(()=>J.abort(),B),Z=()=>J.abort();A.signal?.addEventListener("abort",Z,{once:!0});let G=`/apps${A.bundleId?`?filter[bundleId]=${encodeURIComponent(A.bundleId)}&limit=1`:"?limit=1"}`;try{let K=await Q(`${N40}${G}`,{signal:J.signal,headers:{Authorization:`Bearer ${$}`,"Content-Type":"application/json"}}),W=await K.json().catch(()=>null);if(!K.ok){let F=(W?.errors??[])[0];wB(`apple-access GET ${G}: HTTP ${K.status} ${K.statusText} ${JSON.stringify(W?.errors??null)} | ${WG(K.headers)}`);let U=new FM(K.status,F?`Apple API error (${K.status}): ${F.title} - ${F.detail} (${F.code})`:`Apple API error: HTTP ${K.status} ${K.statusText}`,F?.code),q=xHA(U),z=[A.keyId,A.issuerId],I={status:K.status,code:CFA(F?.code,z),title:CFA(F?.title,z),detail:CFA(F?.detail,z)};if(q.is401or403)return{ok:!1,kind:"auth-error",message:q.message,...I};return{ok:!1,kind:"network",message:`App Store Connect returned HTTP ${K.status}.`,...I}}if(wB(`apple-access GET ${G}: HTTP ${K.status} | ${WG(K.headers)}`),A.bundleId){if(!fHA(W).some((q)=>q.bundleId===A.bundleId))return{ok:!1,kind:"no-app-access",message:`The App Store Connect API key cannot see an app with bundle id ${A.bundleId}.`}}return{ok:!0}}catch(K){let W=K instanceof Error?K.message:String(K);if(K?.name==="AbortError"||J.signal.aborted||E40.test(W))return{ok:!1,kind:"network",message:"Could not reach App Store Connect (network error or timeout)."};return{ok:!1,kind:"network",message:"App Store Connect check failed unexpectedly."}}finally{clearTimeout(Y),A.signal?.removeEventListener("abort",Z)}}var N40="https://api.appstoreconnect.apple.com/v1",V40=7000,E40,R40=500;var hQQ=mA(()=>{T5();sC();tR();E40=/timeout|timed out|network|fetch failed|aborted|ENOTFOUND|EAI_AGAIN|ECONNRESET|ECONNREFUSED/i});import{Buffer as j40}from"node:buffer";function lQQ(A){return[[A.code?`[${A.code}]`:"",A.title??""].filter(Boolean).join(" "),A.detail].filter(Boolean).join(" - ")||A.message}function T40(A){return Boolean(A.status===403&&(A.code&&w40.has(A.code)||/\bPLA_NOT_ACCEPTED\b|required agreement|program license agreement/i.test(`${A.code??""} ${A.title??""} ${A.detail??""}`)))}function k40(A){if(A.status===401)return!0;if(A.status!==403)return!1;return P40.test(A.code??"")||_40.test(`${A.title??""} ${A.detail??""}`)}function S40(A){let Q=lQQ(A);if(T40(A))return{id:"ios/asc-key-access",severity:"error",enforceAfter:uQQ,title:"Apple requires an App Store Connect agreement (HTTP 403)",detail:Q,fix:"Ask the Account Holder to accept pending agreements in App Store Connect → Business, then retry."};if(k40(A))return{id:"ios/asc-key-access",severity:"error",enforceAfter:uQQ,title:`App Store Connect authentication failed during preflight (HTTP ${A.status})`,detail:Q,fix:cQQ};if(A.status===403)return{id:"ios/asc-key-access",severity:"warning",title:"Apple denied the App Store Connect preflight request (HTTP 403)",detail:`${Q} This /v1/apps probe differs from the TestFlight upload path, so the build may still succeed.`,fix:"Review Apple's reason and confirm the key can access the target app. Use --fail-on-warnings only if this probe must be strict."};if(A.status!==void 0)return{id:"ios/asc-key-access",severity:"warning",title:`App Store Connect preflight returned HTTP ${A.status}`,detail:Q,fix:"Retry the preflight. The build will still attempt the upload because this response does not prove the credentials are invalid."};return{id:"ios/asc-key-access",severity:"error",title:"Could not authenticate the App Store Connect API key",detail:Q,fix:cQQ}}function pQQ(A){let Q=new AbortController,B=setTimeout(()=>Q.abort(),A);return{signal:Q.signal,clear:()=>clearTimeout(B)}}function b40(A){return{id:"android/play-sa-access",platforms:["android"],appliesTo:(Q)=>iv(Q),async run(Q){let B=Q.credentials?.PLAY_CONFIG_JSON;if(!B)return[];let $=UeA(Q.projectDir,Q.androidFlavor),J=$.packageName??Q.config?.appId??Q.appId,Y=j40.from(B,"base64"),{signal:Z,clear:X}=pQQ(Js),G;try{G=await A({jsonBytes:Y,packageName:J,signal:Z,timeoutMs:Js})}finally{X()}if(G.ok)return[];switch(G.kind){case"no-app-access":return[{id:"android/play-sa-access",severity:$.ambiguous?"warning":"error",title:"The Play service account cannot access this app",detail:G.message,fix:mQQ}];case"token-error":return[{id:"android/play-sa-access",severity:"error",title:"Google rejected the Play service-account key",detail:"The service-account JSON failed to authenticate with Google. Re-download a fresh key from the Google Cloud console.",fix:mQQ}];case"network-error":return[{id:"android/play-sa-access",severity:"info",title:"Could not verify Play service-account access (network error or timeout)",detail:"The build will still attempt the upload; this check is best-effort and skipped offline."}];case"shape-error":return[{id:"android/play-sa-access",severity:"info",title:"Skipped Play access check (service-account JSON shape problem)",detail:"See the android/play-sa-json finding for the shape error."}];default:return[]}}}}function x40(A){return{id:"ios/asc-key-access",platforms:["ios"],appliesTo:(Q)=>E3(Q),async run(Q){let{APPLE_KEY_ID:B,APPLE_ISSUER_ID:$,APPLE_KEY_CONTENT:J}=Q.credentials??{};if(!B||!$||!J)return[];let Y="";try{Y=dQQ.default.util.decode64(J)}catch{return[]}if(!Y.includes("-----BEGIN PRIVATE KEY-----"))return[];let Z=await f40(Q),{signal:X,clear:G}=pQQ(Js),K;try{K=await A({keyId:B,issuerId:$,p8Pem:Y,bundleId:Z,signal:X,timeoutMs:Js})}finally{G()}if(K.ok)return[];switch(K.kind){case"auth-error":return[S40(K)];case"no-app-access":return[{id:"ios/asc-key-access",severity:"warning",title:"The App Store Connect API key cannot see this app",detail:K.message,fix:"Confirm the app exists in App Store Connect and the API key role can access it, or fix the bundle identifier."}];case"network":return[{id:"ios/asc-key-access",severity:"warning",title:K.status?`App Store Connect preflight returned HTTP ${K.status}`:"Could not verify App Store Connect access (network error or timeout)",detail:K.status?`${lQQ(K)} The build will still attempt the upload.`:"The build will still attempt the upload; retry when network access is available."}];default:return[]}}}}async function f40(A){try{let{findSignableTargets:Q,readPbxproj:B}=await Promise.resolve().then(() => (GZ(),yl)),$=B(A.projectDir);if(!$)return A.config?.appId??A.appId;let J=Q($),Y=A.config?.appId??A.appId;return(J.find((X)=>X.bundleId===Y)??J[0])?.bundleId??Y}catch{return A.config?.appId??A.appId}}var dQQ,Js=7000,uQQ="2026-08-17T00:00:00.000Z",mQQ="Invite the service-account email in Play Console -> Users and permissions, then grant it release access for this app.",cQQ="App Store Connect rejected the API key - check the Key ID / Issuer ID / .p8 and that the key has Admin or Developer access (or sign the pending agreement).",w40,P40,_40,iQQ,nQQ;var aQQ=mA(()=>{Jy();hQQ();Lq();dQQ=AQ(oR(),1),w40=new Set(["FORBIDDEN.REQUIRED_AGREEMENTS_MISSING_OR_EXPIRED","FORBIDDEN_ERROR.PLA_NOT_ACCEPTED"]),P40=/(?:^|[._-])(NOT_AUTHORIZED|UNAUTHORIZED|AUTHENTICATION(?:_ERROR)?|INVALID_(?:TOKEN|CREDENTIALS?))(?:$|[._-])/i,_40=/authentication credentials? (?:are )?(?:missing or invalid)|invalid (?:bearer )?token|token (?:is )?(?:invalid|expired)/i;iQQ=b40(P3),nQQ=x40(gQQ)});var v40="2026-08-14T00:00:00.000Z",y40="2026-08-17T00:00:00.000Z",g40,oQQ;var rQQ=mA(()=>{feA();ceA();WAQ();FAQ();ZFA();e3A();er();_AQ();lAQ();$QQ();qQQ();PQQ();SQQ();fQQ();aQQ();g40=[nAQ,aAQ,oAQ,rAQ,sAQ,tAQ,eAQ,AQQ,QQQ,BQQ,LQQ,NQQ,VQQ,EQQ,RQQ,jQQ,wQQ,uAQ,mAQ,cAQ,dAQ,jAQ,wAQ,PAQ,XQQ,GQQ,KQQ,WQQ,HQQ,FQQ,DQQ,UQQ,zQQ].map((A)=>({...A,enforceAfter:v40})),oQQ=[bQQ,xQQ,HAQ,_QQ,TQQ,kQQ,zAQ,{...qAQ,enforceAfter:y40},IAQ,OAQ,LAQ,NAQ,VAQ,EAQ,qeA,CAQ,ueA,meA,aeA,oeA,reA,teA,eeA,LeA,NeA,VeA,EeA,ReA,jeA,weA,PeA,_eA,TeA,keA,SeA,beA,AAQ,QAQ,BAQ,$AQ,JAQ,YAQ,ZAQ,XAQ,GAQ,KAQ,iQQ,nQQ,...g40]});import{env as h40,stdout as u40}from"node:process";function d40(){return Boolean(u40.isTTY)&&!h40.NO_COLOR}function OFA(A,Q={}){let B=Q.color??d40(),$=Q.now??new Date,J=(U,q)=>B?`${U}${q}${PY.reset}`:q,Y=[];for(let U of m40)for(let q of A.findings.filter((z)=>z.severity===U)){let z=!mv(q,$),I=z?U==="error"?"✖ CRITICAL — INFORMATION ONLY":`${sQQ[U].trim()} — INFORMATION ONLY`:sQQ[U];if(Y.push(`${J(c40[U],I)} ${q.title} ${J(PY.dim,`[${q.id}]`)}`),q.detail)Y.push(J(PY.dim,` ${q.detail}`));if(q.fix)Y.push(J(PY.dim,` fix: ${q.fix}`));if(q.docsUrl)Y.push(J(PY.dim,` docs: ${q.docsUrl}`));if(z&&q.enforceAfter){let C=U==="error"?"this critical finding is information only now and will fail builds":"this finding is information only now and can affect build outcomes";Y.push(J(PY.dim,` rollout: ${C} starting ${s3A(q.enforceAfter)}`))}}let{error:Z,warning:X,info:G}=A.counts;Y.push("");let K=`prescan: ${A.checksRun} checks in ${A.durationMs}ms — ${Z} error(s), ${X} warning(s), ${G} info`,W=Z>0?PY.red:X>0?PY.yellow:PY.dim;Y.push(J(W,K));let F=zj(A,$);if(F.length>0)Y.push(J(PY.dim,`rollout: ${F.length} finding(s) are information only until their enforcement deadline`));if(Q.verbose)Y.push(J(PY.dim,`remote checks skipped: ${A.skippedRemote}`));return Y.join(`
567
- `)}function tQQ(A){let Q=A.findings.map((B)=>{let $={id:B.id,severity:B.severity,title:B.title};if(B.detail)$.detail=B.detail;if(B.fix)$.fix=B.fix;if(B.docsUrl)$.docsUrl=B.docsUrl;if(B.enforceAfter)$.enforceAfter=B.enforceAfter;return $});return JSON.stringify({version:1,counts:A.counts,checksRun:A.checksRun,durationMs:A.durationMs,skippedRemote:A.skippedRemote,findings:Q},null,2)}var m40,sQQ,PY,c40;var eQQ=mA(()=>{m40=["error","warning","info"],sQQ={error:"✖ ERROR",warning:"⚠ WARN ",info:"ℹ INFO "},PY={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",dim:"\x1B[2m",bold:"\x1B[1m"},c40={error:PY.bold+PY.red,warning:PY.bold+PY.yellow,info:PY.dim}});var LFA={};a9(LFA,{validateFlags:()=>A0Q,runPrescanGate:()=>i40,prescanCommand:()=>MFA,exitCodeFor:()=>Q0Q,executePrescan:()=>B0Q});import{cwd as l40,exit as p40}from"node:process";function A0Q(A){if(A.failOnWarnings&&A.ignoreFatal)throw Error("--ignore-fatal and --fail-on-warnings are contradictory — pick one")}function Q0Q(A,Q,B=[]){if(Q.ignoreFatal)return 0;let $=qj({counts:A,findings:B},Q.now);if($.error>0)return 1;if($.warning>0&&Q.failOnWarnings)return 2;return 0}async function B0Q(A,Q){let B=Q.platform;if(B!=="ios"&&B!=="android")throw Error("--platform must be ios or android");let $=Q.apikey??m4(),J;if($)try{J=await CB($,Q.supaHost,Q.supaAnon,!0)}catch{}let Y=await $eA({appId:A,platform:B,projectDir:Q.path??l40(),distributionMode:Q.iosDist,androidFlavor:Q.androidFlavor,apikey:$,supabase:J,credentials:Q.credentials});return{report:await XeA(Y,oQQ),apikey:$}}async function MFA(A,Q){if(A0Q(Q),!Q.json)FB("Capgo build prescan");let{report:B,apikey:$}=await B0Q(A,Q);if(Q.json)console.log(tQQ(B));else{T.message(OFA(B,{verbose:Q.verbose,now:Q.now}));let J=t3A(B,Q);DB(J==="block"?"Prescan found blocking problems — fix them before building.":"Prescan finished.")}if($){let J=qj(B,Q.now),Y=zj(B,Q.now).length;await jB($,{channel:"build",event:"Prescan run",icon:"\uD83D\uDEE1️",tags:{source:"standalone",result:J.error>0?Q.ignoreFatal?"bypassed":"blocked":J.warning>0?Q.failOnWarnings?"blocked":"warned":Y>0?"information-only":"clean","app-id":A??"unknown",platform:Q.platform??"unknown",errors:String(B.counts.error),warnings:String(B.counts.warning),"finding-ids":B.findings.filter((Z)=>Z.severity!=="info").map((Z)=>Z.id).join(",").slice(0,200),"information-only-findings":String(Y)},notify:!1},Q.verbose).catch(()=>{})}p40(Q0Q(B.counts,Q,B.findings))}async function i40(A,Q){if(!A.enabled)return{decision:"proceed",report:null,crashed:!1,informationOnlyFindings:0};let B=()=>{},$=A.print??(A.silent?B:(G)=>T.message(G)),J=A.warn??(A.silent?B:(G)=>T.warn(G)),Y;try{Y=await Q()}catch(G){return J(`prescan crashed and was skipped: ${G instanceof Error?G.message:String(G)}`),{decision:"proceed",report:null,crashed:!0,informationOnlyFindings:0}}if(Y.findings.length>0)$(OFA(Y,{now:A.now}));let Z=t3A(Y,{ignoreFatal:A.ignoreFatal,failOnWarnings:A.failOnWarnings,now:A.now}),X;if(Z==="ask")X=A.interactive===!1?"proceed":await KeA("ask",{silent:A.silent});else X=Z;return{decision:X,report:Y,crashed:!1,informationOnlyFindings:zj(Y,A.now).length}}var Ys=mA(()=>{mB();AB();JeA();GeA();WeA();rQQ();eQQ()});var Ut=FA((nZ0)=>{nZ0.isInteger=(A)=>{if(typeof A==="number")return Number.isInteger(A);if(typeof A==="string"&&A.trim()!=="")return Number.isInteger(Number(A));return!1};nZ0.find=(A,Q)=>A.nodes.find((B)=>B.type===Q);nZ0.exceedsLimit=(A,Q,B=1,$)=>{if($===!1)return!1;if(!nZ0.isInteger(A)||!nZ0.isInteger(Q))return!1;return(Number(Q)-Number(A))/Number(B)>=$};nZ0.escapeNode=(A,Q=0,B)=>{let $=A.nodes[Q];if(!$)return;if(B&&$.type===B||$.type==="open"||$.type==="close"){if($.escaped!==!0)$.value="\\"+$.value,$.escaped=!0}};nZ0.encloseBrace=(A)=>{if(A.type!=="brace")return!1;if(A.commas>>0+A.ranges>>0===0)return A.invalid=!0,!0;return!1};nZ0.isInvalidBrace=(A)=>{if(A.type!=="brace")return!1;if(A.invalid===!0||A.dollar)return!0;if(A.commas>>0+A.ranges>>0===0)return A.invalid=!0,!0;if(A.open!==!0||A.close!==!0)return A.invalid=!0,!0;return!1};nZ0.isOpenOrClose=(A)=>{if(A.type==="open"||A.type==="close")return!0;return A.open===!0||A.close===!0};nZ0.reduce=(A)=>A.reduce((Q,B)=>{if(B.type==="text")Q.push(B.value);if(B.type==="range")B.type="text";return Q},[]);nZ0.flatten=(...A)=>{let Q=[],B=($)=>{for(let J=0;J<$.length;J++){let Y=$[J];if(Array.isArray(Y)){B(Y);continue}if(Y!==void 0)Q.push(Y)}return Q};return B(A),Q}});var zt=FA((FpB,z$Q)=>{var U$Q=Ut();z$Q.exports=(A,Q={})=>{let B=($,J={})=>{let Y=Q.escapeInvalid&&U$Q.isInvalidBrace(J),Z=$.invalid===!0&&Q.escapeInvalid===!0,X="";if($.value){if((Y||Z)&&U$Q.isOpenOrClose($))return"\\"+$.value;return $.value}if($.value)return $.value;if($.nodes)for(let G of $.nodes)X+=B(G);return X};return B(A)}});var I$Q=FA((DpB,q$Q)=>{/*!
566
+ `)){let $=B.match(/^\s*([A-Z0-9_]+(?:\[[^\]]*\])?)\s*=\s*(.+?);\s*$/i);if(!$)continue;let J=$[1],Y=$[2].trim();if(Y.startsWith("("))continue;if(Y.length>=2&&Y.startsWith('"')&&Y.endsWith('"'))Y=Y.slice(1,-1);Q[J]=Y}return Q}function GFA(A){if(!A)return[];let Q=/(\w+)\s*\/\*[^*]*\*\/\s*=\s*\{[^{}]*isa\s*=\s*XCBuildConfiguration;(?:[^{}]*\{[^}]*\})*[^}]*\}/g,B=[];for(let $ of A.matchAll(Q)){let J=$[0],Y=$[1],Z=J.match(/\bname\s*=\s*("[^"]*"|[^;\s]+)\s*;/),X=Z?Z[1].replace(/^"|"$/g,""):"";B.push({id:Y,name:X,settings:O80(C80(J))})}return B}function M80(A){let Q=A.match(/isa\s*=\s*PBXProject;[\s\S]*?buildConfigurationList\s*=\s*(\w+)/)?.[1];if(!Q)return new Set;return TAQ(A,Q)}function TAQ(A,Q){let B=new RegExp(`${I80(Q)}\\s*\\/\\*[^*]*\\*\\/\\s*=\\s*\\{[^}]*isa\\s*=\\s*XCConfigurationList;[^}]*\\}`),$=A.match(B)?.[0];if(!$)return new Set;let J=$.match(/buildConfigurations\s*=\s*\(([^)]*)\)/);if(!J)return new Set;return new Set(Array.from(J[1].matchAll(/(\w+)/g),(Y)=>Y[1]))}function KFA(A){let Q=M80(A);return GFA(A).map((B)=>({name:B.name,settings:B.settings,isProjectLevel:Q.has(B.id)}))}function sv(A,Q){let B=null;for(let $ of GFA(A)){let J=$.settings[Q];if(J===void 0)continue;if($.name==="Release")return J;if(B===null)B=J}return B}function tv(A,Q){let B=A.match(/^\$\(([A-Z0-9_]+)\)$/i),$=A.match(/^\$\{([A-Z0-9_]+)\}$/i),J=B?.[1]??$?.[1];if(!J)return A;return sv(Q,J)??A}function pD(A){if(!A)return[];let Q=XH(A);if(Q.length===0)return[];let B=new Map,$=/\w+\s*\/\*[^*]*\*\/\s*=\s*\{[^}]*isa\s*=\s*PBXNativeTarget;[^}]*\}/g;for(let Z of A.matchAll($)){let X=Z[0],G=X.match(/\bname\s*=\s*("[^"]*"|[^;\s]+)\s*;/),K=X.match(/buildConfigurationList\s*=\s*(\w+)/);if(!G||!K)continue;B.set(G[1].replace(/^"|"$/g,""),K[1])}let J=GFA(A),Y=new Map(J.map((Z)=>[Z.id,Z]));return Q.map((Z)=>{let X=B.get(Z.name),G=X?TAQ(A,X):new Set,K=Array.from(G).map((W)=>Y.get(W)).filter((W)=>W!==void 0).map((W)=>({name:W.name,settings:W.settings}));return{target:Z,configs:K}})}function ev(A){let Q=[],B=($)=>{if($===void 0)return;let J=Number.parseFloat($);if(!Number.isNaN(J))Q.push(J)};for(let $ of KFA(A))if($.isProjectLevel)B($.settings.IPHONEOS_DEPLOYMENT_TARGET);for(let{target:$,configs:J}of pD(A)){if($.productType!==q80)continue;for(let Y of J)B(Y.settings.IPHONEOS_DEPLOYMENT_TARGET)}return Q.length>0?Math.min(...Q):null}var q80="com.apple.product-type.application";var Nj=mA(()=>{GZ()});import{existsSync as L80,readFileSync as SAQ}from"node:fs";import{dirname as kAQ,isAbsolute as N80,join as V80,resolve as E80}from"node:path";function j80(A,Q){return A.find((B)=>B.name==="Release")?.settings[Q]??A.find((B)=>B.name==="Debug")?.settings[Q]??A.find((B)=>B.settings[Q]!==void 0)?.settings[Q]}function w80(A,Q){let B=bK(A);if(!B)return;let $;try{$=SAQ(B,"utf8")}catch{return}let J=pD($).filter(({target:K})=>K.productType===R80),Y=J.find(({target:K,configs:W})=>K.bundleId===Q||W.some((F)=>F.settings.PRODUCT_BUNDLE_IDENTIFIER===Q))??J[0],Z=Y?j80(Y.configs,"CODE_SIGN_ENTITLEMENTS"):void 0;if(Z===void 0)return;let X=kAQ(kAQ(B)),G=Z.replace(/\$\((?:SRCROOT|SOURCE_ROOT|PROJECT_DIR)\)|\$\{(?:SRCROOT|SOURCE_ROOT|PROJECT_DIR)\}/g,X);if(/\$\([^)]+\)|\$\{[^}]+\}/.test(G))return null;return N80(G)?G:E80(X,G)}function iD(A,Q){let B=w80(A,Q);if(B===null)return null;let $=B??V80(A,"ios","App","App","App.entitlements");if(!L80($))return null;try{return{raw:SAQ($,"utf8")}}catch{return null}}function WFA(A,Q){return cD(A,Q)}function Vj(A,Q){return dD(A,Q)}var R80="com.apple.product-type.application";var bAQ=mA(()=>{GZ();Nj()});import{existsSync as P80,readFileSync as _80}from"node:fs";import{join as T80}from"node:path";function HFA(A){return R3(A).find((Q)=>Q.bundleId===A.appId)}function b80(A){let Q=T80(A,"ios","App","App","Info.plist");if(!P80(Q))return!1;try{return dD(_80(Q,"utf8"),"UIBackgroundModes").includes("remote-notification")}catch{return!1}}function hAQ(A){try{return vl(A).profileEntitlements}catch{return{}}}function f80(A){return x80.has(A)||A.endsWith(".team-identifier")}function v80(A){return A==="*"||A==="$(AppIdentifierPrefix)*"||/^\$\(\w+\)\*$/.test(A)||/^[A-Z0-9]{10}\.\*$/.test(A)}function vAQ(A){if(xAQ.test(A))return A.replace(xAQ,"");if(fAQ.test(A))return A.replace(fAQ,"");return A}function y80(A){let Q=[],B=/<key>([\s\S]*?)<\/key>\s*<(array|string|true|false|dict|integer|real|data|date)(\/)?\s*>/g,$=B.exec(A);while($!==null){let J=$[1].trim(),Y=$[2],Z=$[3]==="/";if(Q.push({key:J,isArray:Y==="array"}),!Z&&(Y==="dict"||Y==="array")){let X=g80(A,Y,$.index+$[0].length);if(X>B.lastIndex)B.lastIndex=X}$=B.exec(A)}return Q}function g80(A,Q,B){let $=new RegExp(`<${Q}>|</${Q}>`,"g");$.lastIndex=B;let J=1;for(let Y=$.exec(A);Y!==null;Y=$.exec(A))if(Y[0]===`<${Q}>`)J++;else if(--J===0)return $.lastIndex;return A.length}var k80=(A)=>HFA(A)!==void 0,S80=(A)=>iD(A.projectDir,A.appId)!==null,x80,xAQ,fAQ,uAQ,mAQ,h80,yAQ="com.apple.developer.associated-domains",cAQ,gAQ="com.apple.security.application-groups",u80,dAQ;var lAQ=mA(()=>{PC();bAQ();er();x80=new Set(["aps-environment","get-task-allow","application-identifier"]);xAQ=/^\$\((?:AppIdentifierPrefix|TeamIdentifierPrefix)\)/,fAQ=/^[A-Z0-9]{10}\./;uAQ={id:"ios/entitlements-vs-profile-capability",platforms:["ios"],appliesTo:(A)=>k80(A)&&S80(A),async run(A){let Q=iD(A.projectDir,A.appId),B=HFA(A);if(!Q||!B)return[];let $=y80(Q.raw).filter((Y)=>!f80(Y.key));if($.length===0)return[];let J=[];for(let{bundleId:Y,base64:Z}of[B]){let X=hAQ(Z);for(let{key:G,isArray:K}of $)if(K){let W=Vj(Q.raw,G),F=X[G],U=Array.isArray(F)?F:typeof F==="string"?[F]:[];if(U.some(v80))continue;let q=new Set(U.map(vAQ)),z=W.filter((I)=>!q.has(vAQ(I)));if(z.length>0)J.push({id:"ios/entitlements-vs-profile-capability",severity:"error",title:`Entitlement "${G}" is not fully covered by the provisioning profile for "${Y}"`,detail:`uncovered ${G} value(s): ${z.join(", ")}`,fix:"Enable the capability for this App ID in the Apple Developer portal, regenerate the profile, and re-save credentials (or remove the unused entitlement)"})}else if(!(G in X))J.push({id:"ios/entitlements-vs-profile-capability",severity:"error",title:`Entitlement "${G}" is declared by the app but not granted by the provisioning profile for "${Y}"`,detail:`missing capability: ${G}`,fix:"Enable the capability for this App ID in the Apple Developer portal, regenerate the profile, and re-save credentials (or remove the unused entitlement)"})}return J}},mAQ={id:"ios/entitlements-aps-environment-vs-mode",platforms:["ios"],appliesTo:(A)=>{let Q=iD(A.projectDir,A.appId);return Q!==null&&WFA(Q.raw,"aps-environment")!==null&&Boolean(A.distributionMode)},async run(A){let Q=iD(A.projectDir,A.appId);if(!Q)return[];let B=WFA(Q.raw,"aps-environment");if(B===null)return[];let $=HFA(A),J=$?hAQ($.base64)["aps-environment"]:void 0,Y=typeof J==="string"&&J!==B,Z=[];if(A.distributionMode==="app_store"&&B==="development"&&!Y){let X=b80(A.projectDir);Z.push({id:"ios/entitlements-aps-environment-vs-mode",severity:X?"error":"warning",title:'aps-environment is "development" but the build distributes to the App Store / TestFlight',detail:X?"The app declares the remote-notification background mode, so it needs a production push environment for App Store / TestFlight":"App Store and TestFlight push needs a production environment; this is the default Capacitor leftover and is harmless unless the app uses push notifications",fix:"Set aps-environment=production in App.entitlements and use a production push profile (or remove aps-environment if the app does not use push)"})}else if(A.distributionMode==="ad_hoc"&&B==="production"&&!Y)Z.push({id:"ios/entitlements-aps-environment-vs-mode",severity:"warning",title:'aps-environment is "production" for an ad_hoc build',detail:"ad_hoc builds usually use the development push environment (production is valid but uncommon)",fix:"Use aps-environment=development for ad_hoc unless you intend production APNs"});if($&&Y)Z.push({id:"ios/entitlements-aps-environment-vs-mode",severity:"error",title:`aps-environment differs between App.entitlements and the provisioning profile for "${$.bundleId}"`,detail:`app: ${B} — profile: ${J}`,fix:"Align aps-environment in App.entitlements with the push profile (or regenerate the profile)"});return Z}},h80=/^(?:applinks|webcredentials|activitycontinuation|appclips):[a-z0-9.-]+(?:\?mode=(?:developer|managed))?$/i,cAQ={id:"ios/entitlements-associated-domains-format",platforms:["ios"],appliesTo:(A)=>{let Q=iD(A.projectDir,A.appId);return Q!==null&&Vj(Q.raw,yAQ).length>0},async run(A){let Q=iD(A.projectDir,A.appId);if(!Q)return[];let B=[];for(let $ of Vj(Q.raw,yAQ)){if(/^(?:applinks|webcredentials|activitycontinuation|appclips):\*$/i.test($))continue;if(!h80.test($))B.push($)}if(B.length===0)return[];return[{id:"ios/entitlements-associated-domains-format",severity:"warning",title:`${B.length} associated-domains entr(y/ies) have an invalid format`,detail:`invalid: ${B.join(", ")}`,fix:'Use the "service:domain" form (e.g. applinks:example.com) — no scheme, path, or trailing slash'}]}},u80=/^group\.[a-z0-9.-]+$/,dAQ={id:"ios/entitlements-app-groups-format",platforms:["ios"],appliesTo:(A)=>{let Q=iD(A.projectDir,A.appId);return Q!==null&&Vj(Q.raw,gAQ).length>0},async run(A){let Q=iD(A.projectDir,A.appId);if(!Q)return[];let B=Vj(Q.raw,gAQ).filter(($)=>!u80.test($));if(B.length===0)return[];return[{id:"ios/entitlements-app-groups-format",severity:"warning",title:`${B.length} app group identifier(s) have an invalid format`,detail:`invalid: ${B.join(", ")}`,fix:'Name app groups "group.<reverse-dns>" (lowercase, no whitespace) and register them in the portal'}]}}});import{existsSync as m80,readFileSync as c80}from"node:fs";import{join as d80}from"node:path";function pAQ(A){let Q=d80(A,...l80);return m80(Q)?Q:null}function nG(A){let Q=pAQ(A);if(!Q)return null;try{return c80(Q,"utf8")}catch{return null}}function Ay(A){return ZX(A)??""}function Qs(A){return A.startsWith("$(")||A.startsWith("${")}function p80(A){let Q=A.config?.server;if(Q===null||typeof Q!=="object")return!1;let B=Q;return B.cleartext===!0||typeof B.url==="string"&&B.url.length>0}var l80,j3=(A)=>pAQ(A.projectDir)!==null,i80,n80,a80,iAQ,o80,r80,nAQ,aAQ,oAQ,rAQ,sAQ,tAQ,eAQ,AQQ,QQQ,s80,BQQ;var $QQ=mA(()=>{GZ();Nj();l80=["ios","App","App","Info.plist"];i80=/^\d+\.\d+(?:\.\d+)?$/,n80=/^\d+(?:\.\d+){0,2}$/,a80=/^[a-z0-9][a-z0-9-]*(?:\.[a-z0-9-]+)+$/i,iAQ=["UIInterfaceOrientationPortrait","UIInterfaceOrientationPortraitUpsideDown","UIInterfaceOrientationLandscapeLeft","UIInterfaceOrientationLandscapeRight"],o80=new Set(iAQ),r80=new Set(["audio","location","voip","fetch","remote-notification","processing","bluetooth-central","bluetooth-peripheral","external-accessory","newsstand-content"]),nAQ={id:"ios/plist-bundle-id-format",platforms:["ios"],appliesTo:j3,async run(A){let Q=nG(A.projectDir);if(Q===null)return[];let B=cD(Q,"CFBundleIdentifier");if(B===null)return[{id:"ios/plist-bundle-id-format",severity:"error",title:"Info.plist has no CFBundleIdentifier",fix:"Set a valid reverse-DNS PRODUCT_BUNDLE_IDENTIFIER (no spaces, underscores, or wildcards)."}];let $=tv(B,Ay(A.projectDir));if(Qs($))return[];if(!a80.test($))return[{id:"ios/plist-bundle-id-format",severity:"error",title:`Invalid bundle identifier "${$}"`,detail:"Bundle ids must be reverse-DNS (≥2 dot-separated segments) with no spaces, underscores, or wildcards.",fix:"Set a valid reverse-DNS PRODUCT_BUNDLE_IDENTIFIER (no spaces, underscores, or wildcards)."}];return[]}},aAQ={id:"ios/plist-version-short-format",platforms:["ios"],appliesTo:j3,async run(A){let Q=nG(A.projectDir);if(Q===null)return[];let B=cD(Q,"CFBundleShortVersionString");if(B===null)return[];let $=tv(B,Ay(A.projectDir));if(Qs($))return[];if(!i80.test($))return[{id:"ios/plist-version-short-format",severity:"error",title:`CFBundleShortVersionString "${$}" is not a valid version (ITMS-90060)`,detail:"The marketing version must be two or three dot-separated integers (e.g. 1.4 or 1.4.2) — no letters or pre-release suffixes.",fix:"Set CFBundleShortVersionString or its build setting to two or three dot-separated integers (e.g. 1.4.2)."}];return[]}},oAQ={id:"ios/plist-version-build-format",platforms:["ios"],appliesTo:j3,async run(A){let Q=nG(A.projectDir);if(Q===null)return[];let B=cD(Q,"CFBundleVersion");if(B===null)return[];let $=tv(B,Ay(A.projectDir));if(Qs($))return[];if(!n80.test($))return[{id:"ios/plist-version-build-format",severity:"error",title:`CFBundleVersion "${$}" is not a valid build number`,detail:"The build number must be numeric, ≤3 dot-separated integers (e.g. 42 or 1.4.42).",fix:"Set CURRENT_PROJECT_VERSION numeric, ≤3 integers (e.g. 42 or 1.4.42)."}];return[]}},rAQ={id:"ios/plist-encryption-compliance",platforms:["ios"],appliesTo:(A)=>j3(A)&&E3(A),async run(A){let Q=nG(A.projectDir);if(Q===null)return[];if(NM(Q,"ITSAppUsesNonExemptEncryption"))return[];return[{id:"ios/plist-encryption-compliance",severity:"warning",title:"Info.plist is missing ITSAppUsesNonExemptEncryption",detail:'Without this key, App Store Connect shows a "Missing Compliance" prompt on every upload.',fix:"Add ITSAppUsesNonExemptEncryption=<false/> (correct for most Capacitor apps) to stop the per-upload Missing Compliance prompt."}]}},sAQ={id:"ios/plist-ats-arbitrary-loads",platforms:["ios"],appliesTo:j3,async run(A){let Q=nG(A.projectDir);if(Q===null)return[];let B=zeA(Q,"NSAppTransportSecurity");if(B===null)return[];if(ir(B,"NSAllowsArbitraryLoads")!==!0)return[];let $=E3(A)&&p80(A);return[{id:"ios/plist-ats-arbitrary-loads",severity:$?"error":"warning",title:"NSAllowsArbitraryLoads is enabled (App Transport Security disabled)",detail:$?"Uploading with arbitrary loads enabled and a dev server (cleartext / server.url) still configured ships an insecure release.":"NSAllowsArbitraryLoads disables App Transport Security for all hosts.",fix:"Remove NSAllowsArbitraryLoads (or set <false/>); use scoped NSExceptionDomains; remove server.url/cleartext before release."}]}},tAQ={id:"ios/plist-launch-storyboard",platforms:["ios"],appliesTo:j3,async run(A){let Q=nG(A.projectDir);if(Q===null)return[];if(NM(Q,"UILaunchStoryboardName")||NM(Q,"UILaunchScreen"))return[];return[{id:"ios/plist-launch-storyboard",severity:"error",title:"Info.plist declares no launch screen (ITMS-90475/90096)",detail:"App Store upload requires a launch storyboard or a UILaunchScreen dictionary.",fix:"Add UILaunchStoryboardName=LaunchScreen (Capacitor default) or a UILaunchScreen dict."}]}},eAQ={id:"ios/plist-orientations-multitasking",platforms:["ios"],appliesTo(A){if(!j3(A))return!1;let Q=nG(A.projectDir);if(Q===null)return!1;if(ir(Q,"UIRequiresFullScreen")===!0)return!1;let B=sv(Ay(A.projectDir),"TARGETED_DEVICE_FAMILY");if(B===null)return!1;return B.split(",").map(($)=>$.trim()).includes("2")},async run(A){let Q=nG(A.projectDir);if(Q===null)return[];let B=dD(Q,"UISupportedInterfaceOrientations~ipad");if(!NM(Q,"UISupportedInterfaceOrientations~ipad"))B=dD(Q,"UISupportedInterfaceOrientations");let $=new Set(B),J=iAQ.filter((Y)=>!$.has(Y));if(J.length===0)return[];return[{id:"ios/plist-orientations-multitasking",severity:"warning",title:`iPad multitasking requires all four orientations — missing ${J.join(", ")} (ITMS-90474)`,detail:"An iPad-capable app that supports multitasking must declare all four interface orientations for iPad.",fix:"Add all four orientations to UISupportedInterfaceOrientations~ipad, or add UIRequiresFullScreen=<true/>."}]}},AQQ={id:"ios/plist-orientations-present",platforms:["ios"],appliesTo:j3,async run(A){let Q=nG(A.projectDir);if(Q===null)return[];let B=dD(Q,"UISupportedInterfaceOrientations");if(B.length===0)return[{id:"ios/plist-orientations-present",severity:"warning",title:"Info.plist declares no UISupportedInterfaceOrientations",detail:"Declare at least one supported interface orientation for iPhone.",fix:"Declare ≥1 valid UIInterfaceOrientation* value."}];let $=B.find((J)=>!o80.has(J));if($!==void 0)return[{id:"ios/plist-orientations-present",severity:"warning",title:`Invalid interface orientation "${$}"`,detail:"Each entry must be one of UIInterfaceOrientationPortrait, PortraitUpsideDown, LandscapeLeft, LandscapeRight.",fix:"Declare ≥1 valid UIInterfaceOrientation* value."}];return[]}},QQQ={id:"ios/plist-display-name",platforms:["ios"],appliesTo:j3,async run(A){let Q=nG(A.projectDir);if(Q===null)return[];let B=Ay(A.projectDir),$=(J)=>{let Y=cD(Q,J);if(Y===null)return null;let Z=tv(Y,B);if(Qs(Z)||Z.trim()==="")return null;return Z};if($("CFBundleDisplayName")!==null||$("CFBundleName")!==null)return[];return[{id:"ios/plist-display-name",severity:"warning",title:"Info.plist has no resolvable app display name",detail:"Neither CFBundleDisplayName nor CFBundleName resolves to a non-empty value.",fix:"Set CFBundleDisplayName or ensure PRODUCT_NAME resolves."}]}},s80=["NSLocationWhenInUseUsageDescription","NSLocationAlwaysAndWhenInUseUsageDescription","NSLocationAlwaysUsageDescription","NSLocationUsageDescription"],BQQ={id:"ios/plist-background-modes-sanity",platforms:["ios"],appliesTo(A){if(!j3(A))return!1;let Q=nG(A.projectDir);return Q!==null&&NM(Q,"UIBackgroundModes")},async run(A){let Q=nG(A.projectDir);if(Q===null)return[];let B=dD(Q,"UIBackgroundModes"),$=[],J=B.filter((Y)=>!r80.has(Y));if(J.length>0)$.push({id:"ios/plist-background-modes-sanity",severity:"warning",title:`Unknown UIBackgroundModes value(s): ${J.join(", ")}`,detail:"Background modes must be one of Apple's documented UIBackgroundModes tokens.",fix:"Remove unused background modes; add matching usage strings/capabilities."});if(B.includes("location")&&E3(A)){if(!s80.some((Z)=>NM(Q,Z)))$.push({id:"ios/plist-background-modes-sanity",severity:"warning",title:'UIBackgroundModes declares "location" without a location usage description (Guideline 2.5.4)',detail:"App Review rejects background location without an NSLocation*UsageDescription string.",fix:"Add the matching NSLocation*UsageDescription, or remove the location background mode."})}return $}}});import{readFileSync as t80}from"node:fs";import{join as e80}from"node:path";function Qy(A){try{return JSON.parse(t80(A,"utf8"))}catch{return null}}function By(A,Q){let B=(Q?sv(Q,"ASSETCATALOG_COMPILER_APPICON_NAME"):null)??"AppIcon";return e80(A,"ios","App","App","Assets.xcassets",`${B}.appiconset`)}function A40(A){return(A??"").trim()}function JQQ(A){return(A?.images??[]).some((Q)=>A40(Q.size)==="1024x1024"||Q.role==="marketing")}var YQQ=mA(()=>{Nj()});import{existsSync as Nq}from"node:fs";import{join as NX}from"node:path";function ZQQ(A){return NX(A,"ios","App","Podfile")}function DFA(A){return NX(A,"ios","App","CapApp-SPM","Package.swift")}function UFA(A){return Nq(ZQQ(A.projectDir))}function zFA(A){return Nq(DFA(A.projectDir))}function Bs(A){return ZX(A.projectDir)}function FFA(A){if(A.platform!=="ios")return!1;if((A.distributionMode??"app_store")!=="app_store")return!1;let B=A.credentials;return Boolean(B?.APPLE_KEY_ID&&B?.APPLE_ISSUER_ID&&B?.APPLE_KEY_CONTENT)}var XQQ,GQQ,KQQ,WQQ,HQQ,FQQ,DQQ,UQQ,Q40,zQQ;var qQQ=mA(()=>{YQQ();Nj();GZ();Lq();XQQ={id:"ios/pods-not-installed",platforms:["ios"],appliesTo:UFA,async run(A){let Q=NX(A.projectDir,"ios","App"),B=Nq(NX(Q,"Pods")),$=Nq(NX(Q,"App.xcworkspace"));if(B&&$)return[];let J=[];if(!B)J.push("ios/App/Pods");if(!$)J.push("ios/App/App.xcworkspace");return[{id:"ios/pods-not-installed",severity:"warning",title:"CocoaPods is not installed (missing Pods/ or App.xcworkspace)",detail:`A Podfile exists but ${J.join(" and ")} ${J.length>1?"are":"is"} missing. The cloud build runs pod install and recovers, but local Xcode builds will fail.`,fix:"Run `npx cap sync ios` (or `pod install`) and commit Pods/ + App.xcworkspace."}]}},GQQ={id:"ios/pods-lock-missing",platforms:["ios"],appliesTo:UFA,async run(A){if(i6(NX(A.projectDir,"ios","App","Podfile.lock"))!==null)return[];return[{id:"ios/pods-lock-missing",severity:"warning",title:"Podfile.lock is missing - pod versions are not pinned",detail:"Without Podfile.lock the cloud build resolves pod versions fresh, which can drift from your local versions.",fix:"Run `pod install` and commit Podfile.lock."}]}},KQQ={id:"ios/pods-capacitor-missing",platforms:["ios"],appliesTo:UFA,async run(A){let Q=i6(ZQQ(A.projectDir));if(Q===null)return[];if(/pod\s+['"]Capacitor['"]/.test(Q)||/capacitor_pods/.test(Q)||/@capacitor\/ios/.test(Q))return[];return[{id:"ios/pods-capacitor-missing",severity:"warning",title:"Podfile does not appear to wire the Capacitor pod",detail:"No `pod 'Capacitor'`, `capacitor_pods` helper, or `@capacitor/ios` reference was found. If this is intentional (custom pod names) you can ignore this.",fix:"Run `npx cap sync ios` then `pod install`."}]}},WQQ={id:"ios/spm-package-resolved-missing",platforms:["ios"],appliesTo:zFA,async run(A){let Q=NX(A.projectDir,"ios","App","App.xcodeproj","project.xcworkspace","xcshareddata","swiftpm","Package.resolved"),B=NX(A.projectDir,"ios","App","CapApp-SPM","Package.resolved");if(Nq(Q)||Nq(B))return[];return[{id:"ios/spm-package-resolved-missing",severity:"warning",title:"Swift Package Manager Package.resolved is missing",detail:"No Package.resolved found under the xcodeproj or CapApp-SPM. The cloud build resolves packages during build_app, but committing Package.resolved pins versions for reproducible builds.",fix:"Run `xcodebuild -resolvePackageDependencies` (or open in Xcode) and commit Package.resolved."}]}},HQQ={id:"ios/spm-capacitor-dependency-missing",platforms:["ios"],appliesTo:zFA,async run(A){let Q=i6(DFA(A.projectDir));if(Q===null)return[];let B=/capacitor-swift-pm/.test(Q),$=/\.product\(\s*name:\s*['"]Capacitor['"]/.test(Q);if(B&&$)return[];return[{id:"ios/spm-capacitor-dependency-missing",severity:"warning",title:"Package.swift does not declare the Capacitor SPM dependency",detail:'Expected a capacitor-swift-pm package dependency and a `.product(name: "Capacitor", ...)` target dependency. If your project uses a non-standard layout you can ignore this.',fix:"Run `npx cap sync ios` to regenerate Package.swift."}]}},FQQ={id:"ios/appicon-empty-or-placeholder",platforms:["ios"],async run(A){let Q=By(A.projectDir,Bs(A)??void 0);if(!Nq(Q))return[{id:"ios/appicon-empty-or-placeholder",severity:"error",title:"AppIcon.appiconset is missing",detail:`Expected an app-icon asset set at ${Q.replace(A.projectDir,".")} but the directory does not exist.`,fix:"Run `npx @capacitor/assets generate` (or add the icon set in Xcode)."}];let B=Qy(NX(Q,"Contents.json"));if(B===null)return[{id:"ios/appicon-empty-or-placeholder",severity:"error",title:"AppIcon Contents.json is missing or malformed",detail:"The app-icon Contents.json could not be parsed as JSON.",fix:"Regenerate the icon set (`npx @capacitor/assets generate`) or fix the malformed Contents.json."}];if((B.images??[]).some((J)=>J.filename?.trim()))return[];return[{id:"ios/appicon-empty-or-placeholder",severity:FFA(A)?"error":"warning",title:"AppIcon.appiconset declares no icon images",detail:FFA(A)?"The icon set has no images - App Store upload will reject it (ITMS-90704).":"The icon set has no images. The build tolerates this for ad_hoc/development, but App Store upload would reject it.",fix:"Run `npx @capacitor/assets generate` so the set has at least the 1024x1024 icon."}]}},DQQ={id:"ios/appicon-referenced-file-missing",platforms:["ios"],appliesTo(A){let Q=By(A.projectDir,ZX(A.projectDir)??void 0);return Qy(NX(Q,"Contents.json"))!==null},async run(A){let Q=By(A.projectDir,Bs(A)??void 0),B=Qy(NX(Q,"Contents.json"));if(B===null)return[];let $=[];for(let J of B.images??[]){let Y=J.filename?.trim();if(!Y)continue;if(!Nq(NX(Q,Y)))$.push(Y)}if($.length===0)return[];return[{id:"ios/appicon-referenced-file-missing",severity:"error",title:"AppIcon Contents.json references icon file(s) missing from disk",detail:`actool will fail the build: missing ${$.join(", ")}.`,fix:"Regenerate the icons (`npx @capacitor/assets generate`) or commit the referenced PNG(s)."}]}},UQQ={id:"ios/appicon-marketing-missing",platforms:["ios"],appliesTo:FFA,async run(A){let Q=By(A.projectDir,Bs(A)??void 0),B=Qy(NX(Q,"Contents.json"));if(B===null)return[];if(JQQ(B))return[];return[{id:"ios/appicon-marketing-missing",severity:"error",title:"App Store marketing icon (1024x1024) is missing",detail:"App Store upload requires a 1024x1024 marketing icon in the AppIcon set (ITMS-90704).",fix:"Add a 1024x1024 PNG (no alpha) marketing icon and reference it in Contents.json."}]}},Q40=/\.iOS\(\.v(\d+)\)/,zQQ={id:"ios/spm-deployment-target-consistency",platforms:["ios"],appliesTo(A){if(!zFA(A))return!1;let Q=ZX(A.projectDir);if(Q===null)return!1;return ev(Q)!==null},async run(A){let Q=Bs(A);if(Q===null)return[];let B=ev(Q);if(B===null)return[];let $=i6(DFA(A.projectDir));if($===null)return[];let J=$.match(Q40);if(!J)return[];let Y=Number.parseFloat(J[1]);if(Number.isNaN(Y)||B>=Y)return[];return[{id:"ios/spm-deployment-target-consistency",severity:"warning",title:"IPHONEOS_DEPLOYMENT_TARGET is below the Package.swift iOS minimum",detail:`The Xcode app target builds for iOS ${B} but Package.swift requires iOS ${Y} (.iOS(.v${Y})).`,fix:`Raise IPHONEOS_DEPLOYMENT_TARGET to >= ${Y}, or run \`npx cap sync ios\`.`}]}}});function wZ(A){return ZX(A.projectDir)}function qFA(A){return XH(A).filter((Q)=>Q.productType===B40)}function Y40(A){return $40[A]??J40}function IQQ(A){return ev(A)}function $s(A,Q){let B=A.find((J)=>J.name==="Release")?.settings[Q];if(B!==void 0)return B;let $=A.find((J)=>J.name==="Debug")?.settings[Q];if($!==void 0)return $;for(let J of A)if(J.settings[Q]!==void 0)return J.settings[Q];return}function OQQ(A){let Q=[];for(let{target:B,configs:$}of pD(A)){if($s($,"CODE_SIGN_STYLE")===void 0)continue;let Y=$s($,"DEVELOPMENT_TEAM");if(Y===void 0||Y.trim()==="")Q.push(B.name)}return Q}function Z40(A){let Q=[];for(let{target:B,configs:$}of pD(A)){let J=$.map((Z)=>Z.settings.PRODUCT_BUNDLE_IDENTIFIER).filter((Z)=>Z!==void 0);if(J.length<2)continue;let Y=Array.from(new Set(J));if(Y.length>=2)Q.push({name:B.name,values:Y})}return Q}function MQQ(A){return KFA(A).filter((Q)=>Q.settings.ENABLE_BITCODE==="YES").map((Q)=>Q.isProjectLevel?`project ${Q.name}`:Q.name)}function X40(A){let Q=[];for(let{target:B,configs:$}of pD(A)){let J=$s($,"SWIFT_VERSION");if(J===void 0)continue;let Y=J.match(/^\s*(\d+(?:\.\d+)?)/),Z=Y?Number.parseFloat(Y[1]):Number.NaN;if(Number.isNaN(Z)||Z<5)Q.push({name:B.name,value:J})}return Q}var B40="com.apple.product-type.application",$40,J40=14,LQQ,CQQ=(A)=>R3(A).length>0,NQQ,VQQ,EQQ,RQQ,jQQ,wQQ;var PQQ=mA(()=>{GZ();$FA();Nj();er();$40={5:13,6:13,7:14,8:14};LQQ={id:"ios/xcode-deployment-target-capacitor",platforms:["ios"],appliesTo:(A)=>{if(Oj(A.projectDir)===null)return!1;let Q=wZ(A);return Q!==null&&IQQ(Q)!==null},async run(A){let Q=wZ(A);if(!Q)return[];let B=Oj(A.projectDir),$=IQQ(Q);if(B===null||$===null)return[];let J=Y40(B);if($>=J)return[];return[{id:"ios/xcode-deployment-target-capacitor",severity:"error",title:`IPHONEOS_DEPLOYMENT_TARGET ${$} is below the Capacitor ${B} floor (${J})`,detail:`Capacitor ${B} requires iOS deployment target >= ${J}; the build will fail otherwise.`,fix:`Raise IPHONEOS_DEPLOYMENT_TARGET to >= ${J} (project + app target) and the Podfile platform line if present.`}]}};NQQ={id:"ios/xcode-signing-team",platforms:["ios"],appliesTo:(A)=>{if(CQQ(A))return!1;let Q=wZ(A);return Q!==null&&OQQ(Q).length>0},async run(A){if(CQQ(A))return[];let Q=wZ(A);if(!Q)return[];let B=OQQ(Q);if(B.length===0)return[];return[{id:"ios/xcode-signing-team",severity:E3(A)?"error":"warning",title:`${B.length} signable target(s) set a code-signing style but no DEVELOPMENT_TEAM`,detail:`targets without a team: ${B.join(", ")}`,fix:"Set DEVELOPMENT_TEAM in Xcode (Signing & Capabilities), or supply signing creds/profiles to the cloud build so it switches to managed-manual signing."}]}};VQQ={id:"ios/xcode-bundle-id-mismatch-across-configs",platforms:["ios"],appliesTo:(A)=>{let Q=wZ(A);return Q!==null&&pD(Q).some((B)=>{return B.configs.map((J)=>J.settings.PRODUCT_BUNDLE_IDENTIFIER).filter((J)=>J!==void 0).length>=2})},async run(A){let Q=wZ(A);if(!Q)return[];let B=Z40(Q);if(B.length===0)return[];return[{id:"ios/xcode-bundle-id-mismatch-across-configs",severity:"warning",title:`PRODUCT_BUNDLE_IDENTIFIER differs across build configs in ${B.length} target(s)`,detail:B.map(($)=>`${$.name}: ${$.values.join(" vs ")}`).join("; "),fix:"Align PRODUCT_BUNDLE_IDENTIFIER across Debug/Release (or ignore if a Debug suffix is intentional)."}]}};EQQ={id:"ios/xcode-enable-bitcode-leftover",platforms:["ios"],appliesTo:(A)=>{let Q=wZ(A);return Q!==null&&MQQ(Q).length>0},async run(A){let Q=wZ(A);if(!Q)return[];let B=MQQ(Q);if(B.length===0)return[];return[{id:"ios/xcode-enable-bitcode-leftover",severity:"warning",title:"ENABLE_BITCODE = YES is set (deprecated since Xcode 14)",detail:`present in: ${B.join(", ")}`,fix:"Set ENABLE_BITCODE = NO or delete it — Xcode 14+ ignores bitcode and Apple no longer accepts it."}]}};RQQ={id:"ios/xcode-swift-version-sanity",platforms:["ios"],appliesTo:(A)=>{let Q=wZ(A);return Q!==null&&pD(Q).some((B)=>$s(B.configs,"SWIFT_VERSION")!==void 0)},async run(A){let Q=wZ(A);if(!Q)return[];let B=X40(Q);if(B.length===0)return[];return[{id:"ios/xcode-swift-version-sanity",severity:"warning",title:`SWIFT_VERSION is below 5 (or unparseable) in ${B.length} target(s)`,detail:B.map(($)=>`${$.name}: ${$.value}`).join("; "),fix:"Set SWIFT_VERSION = 5.0 (or your intended Swift >= 5) for the affected target(s)."}]}},jQQ={id:"ios/xcode-no-app-target",platforms:["ios"],appliesTo:(A)=>wZ(A)!==null,async run(A){let Q=wZ(A);if(!Q)return[];if(qFA(Q).length>0)return[];return[{id:"ios/xcode-no-app-target",severity:"error",title:"No application target found in the Xcode project",detail:"The pbxproj parsed but contains no com.apple.product-type.application target — the build has nothing to archive.",fix:"Run `npx cap sync ios`, or restore the application target in Xcode."}]}},wQQ={id:"ios/xcode-multiple-app-targets",platforms:["ios"],appliesTo:(A)=>{let Q=wZ(A);return Q!==null&&qFA(Q).length>1},async run(A){let Q=wZ(A);if(!Q)return[];let B=qFA(Q);if(B.length<=1)return[];return[{id:"ios/xcode-multiple-app-targets",severity:"warning",title:`${B.length} application targets found — the build may sign/archive the wrong one`,detail:`app targets: ${B.map(($)=>`${$.name} (${$.bundleId})`).join(", ")}`,fix:"Keep a single application target, remove the duplicate, or pass the intended scheme to the build."}]}}});import{createRequire as G40}from"node:module";import{existsSync as Ej}from"node:fs";import{dirname as K40,join as w3}from"node:path";function W40(A){let Q=i6(w3(A,"package.json"));if(!Q)return[];let B;try{B=JSON.parse(Q)}catch{return[]}let $=new Set(["@capacitor/core","@capacitor/cli","@capacitor/ios","@capacitor/android","@capacitor/assets","@capacitor/synapse"]);return Object.keys(B.dependencies??{}).filter((J)=>J.startsWith("@capacitor/")&&!$.has(J))}function H40(A){return A.replace(/^@/,"").replace(/\//g,"-")}function F40(A,Q){try{let $=G40(w3(A,"package.json")).resolve(`${Q}/package.json`);return Ej(w3(K40($),"android"))}catch{return!1}}var _QQ,TQQ,kQQ;var SQQ=mA(()=>{Lq();_QQ={id:"shared/cap-sync-stale",platforms:["ios","android"],async run(A){let Q=[],B=A.config?.webDir??"dist";if(!Ej(w3(A.projectDir,B)))return Q.push({id:"shared/cap-sync-stale",severity:"error",title:`webDir "${B}" does not exist — web assets were never built`,fix:"Run your web build (e.g. `npm run build`) then `npx cap sync` before requesting a build"}),Q;let $=W40(A.projectDir),J=$.filter((Z)=>F40(A.projectDir,Z)),Y=z9(A.config,A.platform);if(A.platform==="android"&&J.length>0){let Z=i6(w3(A.projectDir,Y,"capacitor.settings.gradle"));if(Z===null)Q.push({id:"shared/cap-sync-stale",severity:"error",title:`${Y}/capacitor.settings.gradle is missing — \`npx cap sync android\` was never run`,fix:"Run `npx cap sync android`"});else{let X=J.filter((G)=>!Z.includes(`:${H40(G)}`));if(X.length>0)Q.push({id:"shared/cap-sync-stale",severity:"error",title:`${X.length} Capacitor plugin(s) not synced into the Android project`,detail:`missing from capacitor.settings.gradle: ${X.join(", ")}`,fix:"Run `npx cap sync android` (sync, not copy — copy does not regenerate plugin projects)"})}}if(A.platform==="ios"&&$.length>0){let Z=Ej(w3(A.projectDir,Y,"App","Podfile")),X=Ej(w3(A.projectDir,Y,"App","CapApp-SPM","Package.swift"));if(!Z&&!X)Q.push({id:"shared/cap-sync-stale",severity:"error",title:`${Y}/App sync artifacts are missing — \`npx cap sync ios\` was never run`,detail:`expected ${Y}/App/Podfile (CocoaPods) or ${Y}/App/CapApp-SPM/Package.swift (SPM)`,fix:"Run `npx cap sync ios`"})}return Q}},TQQ={id:"shared/node-linker-layout",platforms:["ios","android"],async run(A){let Q=w3(A.projectDir,"node_modules");if(Ej(w3(Q,".bun")))return[{id:"shared/node-linker-layout",severity:"error",title:'bun isolated node_modules layout detected — Capacitor Gradle/Pod paths will not resolve ("No variants exist")',fix:"Reinstall with `bun install --linker=hoisted`"}];if(Ej(w3(Q,".pnpm")))return[{id:"shared/node-linker-layout",severity:"warning",title:"pnpm symlinked node_modules layout detected — Capacitor native builds often need a hoisted layout",fix:"If the build fails resolving @capacitor/* paths, set `node-linker=hoisted` in .npmrc and reinstall"}];return[]}},kQQ={id:"shared/bundle-id-consistency",platforms:["ios","android"],async run(A){let Q=A.config?.appId??A.appId;if(A.platform==="android"){let Z=cv(A.projectDir);if(Z&&Z!==Q)return[{id:"shared/bundle-id-consistency",severity:"warning",title:"Gradle applicationId differs from the Capacitor appId",detail:`capacitor.config appId: ${Q} — android/app/build.gradle applicationId: ${Z}`,fix:"Align them (or pass the intended appId explicitly to `build request`)"}];return[]}let{findSignableTargets:B,readPbxproj:$}=await Promise.resolve().then(() => (GZ(),yl)),J=$(A.projectDir);if(!J)return[];let Y=B(J);if(Y.length>0&&!Y.some((Z)=>Z.bundleId===Q))return[{id:"shared/bundle-id-consistency",severity:"warning",title:"No Xcode target uses the Capacitor appId as its bundle identifier",detail:`capacitor appId: ${Q} — targets: ${Y.map((Z)=>`${Z.name}=${Z.bundleId}`).join(", ")}`,fix:"Align PRODUCT_BUNDLE_IDENTIFIER with the appId, or build with the intended appId"}];return[]}}});var bQQ,xQQ;var fQQ=mA(()=>{bQQ={id:"shared/apikey-permission",platforms:["ios","android"],remote:!0,async run(A){let{data:Q,error:B}=await A.supabase.rpc("cli_check_permission",{apikey:A.apikey??"",permission_key:"app.build_native",org_id:null,app_id:A.appId,channel_id:null});if(B)return[{id:"shared/apikey-permission",severity:"info",title:"Could not verify build permission (network/API error)",detail:B.message}];if(Q!==!0)return[{id:"shared/apikey-permission",severity:"error",title:`This apikey lacks the app.build_native permission for ${A.appId}`,fix:"Use an apikey from the org that owns the app (role with native-build rights), or fix the appId"}];return[]}},xQQ={id:"shared/app-exists",platforms:["ios","android"],remote:!0,async run(A){let{data:Q,error:B}=await A.supabase.from("apps").select("app_id").eq("app_id",A.appId).maybeSingle();if(B)return[{id:"shared/app-exists",severity:"info",title:"Could not verify app existence (network/API error)",detail:B.message}];if(!Q)return[{id:"shared/app-exists",severity:"error",title:`App ${A.appId} is not visible to this apikey`,detail:"Either the app does not exist or it belongs to an org this key cannot access",fix:`Create it (npx @capgo/cli app add ${A.appId}) or pass the right appId / apikey`}];return[]}}});function I40(A){let Q;try{Q=JSON.parse(A.toString("utf-8"))}catch(J){throw Error(`Service account file is not valid JSON: ${J instanceof Error?J.message:String(J)}`)}if(!Q||typeof Q!=="object")throw Error("Service account file is not a JSON object.");let B=Q;if(B.type!=="service_account")throw Error(`Expected "type": "service_account" — found ${JSON.stringify(B.type)}. This file is not a service account key.`);let $=["client_email","private_key","project_id","token_uri"];for(let J of $){let Y=B[J];if(typeof Y!=="string"||Y.length===0)throw Error(`Service account JSON is missing required field "${J}".`)}if(!q40.has(B.token_uri))throw Error("Service account JSON has an unsupported token_uri. Expected a Google OAuth token endpoint.");return{type:"service_account",client_email:B.client_email,private_key:B.private_key,project_id:B.project_id,token_uri:B.token_uri,private_key_id:typeof B.private_key_id==="string"?B.private_key_id:void 0,client_id:typeof B.client_id==="string"?B.client_id:void 0}}function C40(A){let Q=Math.floor(Date.now()/1000);return yQQ.default.sign({iss:A.client_email,scope:D40,aud:A.token_uri,exp:Q+U40,iat:Q},A.private_key,{algorithm:"RS256",header:{alg:"RS256",typ:"JWT",kid:A.private_key_id??""}})}async function O40(A){let Q=new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:jwt-bearer",assertion:A.assertion}),B=await IFA({url:A.key.token_uri,init:{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:Q.toString()},signal:A.signal,timeoutMs:A.timeoutMs,fetchImpl:A.fetchImpl}),$=await B.text();if(!B.ok){let Y=`${B.status} ${B.statusText}`;try{let Z=JSON.parse($);if(Z.error)Y=Z.error_description?`${Z.error}: ${Z.error_description}`:Z.error}catch{}if(B.status>=500||B.status<400)throw new $y(`Google's token endpoint returned ${Y}. Try again in a moment.`);throw Error(`Google rejected the service account credentials (${Y}). The private key may be revoked or invalid.`)}let J;try{J=JSON.parse($)}catch{throw new $y(`Google's token endpoint returned a non-JSON response (${B.status}).`)}if(typeof J.access_token!=="string"||J.access_token.length===0)throw new $y("Google's token response was missing an access_token field.");return J.access_token}async function IFA(A){let Q=new AbortController,B=setTimeout(()=>Q.abort(),A.timeoutMs),$,J=null;if(A.signal){let Y=new AbortController;if(J=()=>Y.abort(),A.signal.addEventListener("abort",J,{once:!0}),Q.signal.addEventListener("abort",J,{once:!0}),A.signal.aborted||Q.signal.aborted)Y.abort();$=Y.signal}else $=Q.signal;try{return await A.fetchImpl(A.url,{...A.init,signal:$})}finally{if(clearTimeout(B),J)A.signal?.removeEventListener("abort",J),Q.signal.removeEventListener("abort",J)}}async function M40(A){let Q=`${vQQ}/applications/${encodeURIComponent(A.packageName)}/edits`,B;try{B=await IFA({url:Q,init:{method:"POST",headers:{Authorization:`Bearer ${A.accessToken}`,"Content-Type":"application/json",Accept:"application/json"},body:"{}"},signal:A.signal,timeoutMs:A.timeoutMs,fetchImpl:A.fetchImpl})}catch(Z){return{kind:"network",detail:Z instanceof Error?Z.message:String(Z)}}let $=await B.text();if(wB(`probeAppAccess: POST ${Q} → HTTP ${B.status} ${B.statusText}${B.ok?"":` :: ${$.slice(0,300)}`}`),B.status===401||B.status===403||B.status===404)return{kind:"no-access",detail:L40($)??`${B.status} ${B.statusText}`};if(!B.ok)return{kind:"network",detail:`${B.status} ${B.statusText}: ${$.slice(0,200)}`};let J;try{J=JSON.parse($)}catch{return{kind:"network",detail:"Play API returned non-JSON on edits.insert"}}if(typeof J.id!=="string"||J.id.length===0)return{kind:"network",detail:"Play API returned no edit id"};let Y=`${vQQ}/applications/${encodeURIComponent(A.packageName)}/edits/${encodeURIComponent(J.id)}`;try{await IFA({url:Y,init:{method:"DELETE",headers:{Authorization:`Bearer ${A.accessToken}`}},signal:A.signal,timeoutMs:A.timeoutMs,fetchImpl:A.fetchImpl})}catch{}return{kind:"ok"}}function L40(A){try{let Q=JSON.parse(A);if(Q.error?.message)return Q.error.status?`${Q.error.status}: ${Q.error.message}`:Q.error.message}catch{}return null}async function P3(A){let Q=A.timeoutMs??z40,B=A.fetchImpl??globalThis.fetch.bind(globalThis),$;try{$=I40(A.jsonBytes)}catch(Z){return{ok:!1,kind:"shape-error",message:Z instanceof Error?Z.message:String(Z)}}if(A.signal?.aborted)return{ok:!1,kind:"network-error",message:"Validation cancelled."};let J;try{let Z=C40($);J=await O40({key:$,assertion:Z,signal:A.signal,timeoutMs:Q,fetchImpl:B})}catch(Z){let X=Z instanceof Error?Z.message:String(Z),G=Z?.name==="AbortError",K=Z instanceof $y,W=/timeout|timed out|network|fetch failed|ENOTFOUND|EAI_AGAIN|ECONNRESET|ECONNREFUSED/i.test(X);if(G||K||W)return{ok:!1,kind:"network-error",message:X};return{ok:!1,kind:"token-error",message:X}}if(A.signal?.aborted)return{ok:!1,kind:"network-error",message:"Validation cancelled."};let Y=await M40({accessToken:J,packageName:A.packageName,signal:A.signal,timeoutMs:Q,fetchImpl:B});if(Y.kind==="ok")return{ok:!0,serviceAccountEmail:$.client_email,projectId:$.project_id};if(Y.kind==="no-access")return{ok:!1,kind:"no-app-access",serviceAccountEmail:$.client_email,message:`Service account "${$.client_email}" cannot access package "${A.packageName}" on Google Play (${Y.detail}). Open Play Console → Users and permissions, invite the service account email, and grant access to this app.`};return{ok:!1,kind:"network-error",message:Y.detail}}var yQQ,D40="https://www.googleapis.com/auth/androidpublisher",vQQ="https://androidpublisher.googleapis.com/androidpublisher/v3",U40=3600,z40=30000,q40,$y;var Jy=mA(()=>{T5();yQQ=AQ(No(),1),q40=new Set(["https://oauth2.googleapis.com/token","https://accounts.google.com/o/oauth2/token","https://www.googleapis.com/oauth2/v4/token"]);$y=class $y extends Error{constructor(A){super(A);this.name="TokenExchangeTransientError"}}});function CFA(A,Q){if(typeof A!=="string")return;let B=GG(A);for(let $ of Q)if($)B=B.replaceAll($,"[REDACTED IDENTIFIER]");return B=B.replace(/\p{Cc}+/gu," ").replace(/\s+/g," ").trim(),B?B.slice(0,R40):void 0}async function gQQ(A){let Q=A.fetchImpl??globalThis.fetch.bind(globalThis),B=A.timeoutMs??V40;if(A.signal?.aborted)return{ok:!1,kind:"network",message:"App Store Connect check cancelled."};let $;try{$=rR(A.keyId,A.issuerId,A.p8Pem)}catch{return{ok:!1,kind:"auth-error",message:"Could not sign the App Store Connect request - the .p8 key, Key ID, or Issuer ID is invalid."}}let J=new AbortController,Y=setTimeout(()=>J.abort(),B),Z=()=>J.abort();A.signal?.addEventListener("abort",Z,{once:!0});let G=`/apps${A.bundleId?`?filter[bundleId]=${encodeURIComponent(A.bundleId)}&limit=1`:"?limit=1"}`;try{let K=await Q(`${N40}${G}`,{signal:J.signal,headers:{Authorization:`Bearer ${$}`,"Content-Type":"application/json"}}),W=await K.json().catch(()=>null);if(!K.ok){let F=(W?.errors??[])[0];wB(`apple-access GET ${G}: HTTP ${K.status} ${K.statusText} ${JSON.stringify(W?.errors??null)} | ${WG(K.headers)}`);let U=new FM(K.status,F?`Apple API error (${K.status}): ${F.title} - ${F.detail} (${F.code})`:`Apple API error: HTTP ${K.status} ${K.statusText}`,F?.code),q=xHA(U),z=[A.keyId,A.issuerId],I={status:K.status,code:CFA(F?.code,z),title:CFA(F?.title,z),detail:CFA(F?.detail,z)};if(q.is401or403)return{ok:!1,kind:"auth-error",message:q.message,...I};return{ok:!1,kind:"network",message:`App Store Connect returned HTTP ${K.status}.`,...I}}if(wB(`apple-access GET ${G}: HTTP ${K.status} | ${WG(K.headers)}`),A.bundleId){if(!fHA(W).some((q)=>q.bundleId===A.bundleId))return{ok:!1,kind:"no-app-access",message:`The App Store Connect API key cannot see an app with bundle id ${A.bundleId}.`}}return{ok:!0}}catch(K){let W=K instanceof Error?K.message:String(K);if(K?.name==="AbortError"||J.signal.aborted||E40.test(W))return{ok:!1,kind:"network",message:"Could not reach App Store Connect (network error or timeout)."};return{ok:!1,kind:"network",message:"App Store Connect check failed unexpectedly."}}finally{clearTimeout(Y),A.signal?.removeEventListener("abort",Z)}}var N40="https://api.appstoreconnect.apple.com/v1",V40=7000,E40,R40=500;var hQQ=mA(()=>{T5();sC();tR();E40=/timeout|timed out|network|fetch failed|aborted|ENOTFOUND|EAI_AGAIN|ECONNRESET|ECONNREFUSED/i});import{Buffer as j40}from"node:buffer";function lQQ(A){return[[A.code?`[${A.code}]`:"",A.title??""].filter(Boolean).join(" "),A.detail].filter(Boolean).join(" - ")||A.message}function T40(A){return Boolean(A.status===403&&(A.code&&w40.has(A.code)||/\bPLA_NOT_ACCEPTED\b|required agreement|program license agreement/i.test(`${A.code??""} ${A.title??""} ${A.detail??""}`)))}function k40(A){if(A.status===401)return!0;if(A.status!==403)return!1;return P40.test(A.code??"")||_40.test(`${A.title??""} ${A.detail??""}`)}function S40(A){let Q=lQQ(A);if(T40(A))return{id:"ios/asc-key-access",severity:"error",enforceAfter:uQQ,title:"Apple requires an App Store Connect agreement (HTTP 403)",detail:Q,fix:"Ask the Account Holder to accept pending agreements in App Store Connect → Business, then retry."};if(k40(A))return{id:"ios/asc-key-access",severity:"error",enforceAfter:uQQ,title:`App Store Connect authentication failed during preflight (HTTP ${A.status})`,detail:Q,fix:cQQ};if(A.status===403)return{id:"ios/asc-key-access",severity:"warning",title:"Apple denied the App Store Connect preflight request (HTTP 403)",detail:`${Q} This /v1/apps probe differs from the TestFlight upload path, so the build may still succeed.`,fix:"Review Apple's reason and confirm the key can access the target app. Use --fail-on-warnings only if this probe must be strict."};if(A.status!==void 0)return{id:"ios/asc-key-access",severity:"warning",title:`App Store Connect preflight returned HTTP ${A.status}`,detail:Q,fix:"Retry the preflight. The build will still attempt the upload because this response does not prove the credentials are invalid."};return{id:"ios/asc-key-access",severity:"error",title:"Could not authenticate the App Store Connect API key",detail:Q,fix:cQQ}}function pQQ(A){let Q=new AbortController,B=setTimeout(()=>Q.abort(),A);return{signal:Q.signal,clear:()=>clearTimeout(B)}}function b40(A){return{id:"android/play-sa-access",platforms:["android"],appliesTo:(Q)=>iv(Q),async run(Q){let B=Q.credentials?.PLAY_CONFIG_JSON;if(!B)return[];let $=UeA(Q.projectDir,Q.androidFlavor),J=$.packageName??Q.config?.appId??Q.appId,Y=j40.from(B,"base64"),{signal:Z,clear:X}=pQQ(Js),G;try{G=await A({jsonBytes:Y,packageName:J,signal:Z,timeoutMs:Js})}finally{X()}if(G.ok)return[];switch(G.kind){case"no-app-access":return[{id:"android/play-sa-access",severity:$.ambiguous?"warning":"error",title:"The Play service account cannot access this app",detail:G.message,fix:mQQ}];case"token-error":return[{id:"android/play-sa-access",severity:"error",title:"Google rejected the Play service-account key",detail:"The service-account JSON failed to authenticate with Google. Re-download a fresh key from the Google Cloud console.",fix:mQQ}];case"network-error":return[{id:"android/play-sa-access",severity:"info",title:"Could not verify Play service-account access (network error or timeout)",detail:"The build will still attempt the upload; this check is best-effort and skipped offline."}];case"shape-error":return[{id:"android/play-sa-access",severity:"info",title:"Skipped Play access check (service-account JSON shape problem)",detail:"See the android/play-sa-json finding for the shape error."}];default:return[]}}}}function x40(A){return{id:"ios/asc-key-access",platforms:["ios"],appliesTo:(Q)=>E3(Q),async run(Q){let{APPLE_KEY_ID:B,APPLE_ISSUER_ID:$,APPLE_KEY_CONTENT:J}=Q.credentials??{};if(!B||!$||!J)return[];let Y="";try{Y=dQQ.default.util.decode64(J)}catch{return[]}if(!Y.includes("-----BEGIN PRIVATE KEY-----"))return[];let Z=await f40(Q),{signal:X,clear:G}=pQQ(Js),K;try{K=await A({keyId:B,issuerId:$,p8Pem:Y,bundleId:Z,signal:X,timeoutMs:Js})}finally{G()}if(K.ok)return[];switch(K.kind){case"auth-error":return[S40(K)];case"no-app-access":return[{id:"ios/asc-key-access",severity:"warning",title:"The App Store Connect API key cannot see this app",detail:K.message,fix:"Confirm the app exists in App Store Connect and the API key role can access it, or fix the bundle identifier."}];case"network":return[{id:"ios/asc-key-access",severity:"warning",title:K.status?`App Store Connect preflight returned HTTP ${K.status}`:"Could not verify App Store Connect access (network error or timeout)",detail:K.status?`${lQQ(K)} The build will still attempt the upload.`:"The build will still attempt the upload; retry when network access is available."}];default:return[]}}}}async function f40(A){try{let{findSignableTargets:Q,readPbxproj:B}=await Promise.resolve().then(() => (GZ(),yl)),$=B(A.projectDir);if(!$)return A.config?.appId??A.appId;let J=Q($),Y=A.config?.appId??A.appId;return(J.find((X)=>X.bundleId===Y)??J[0])?.bundleId??Y}catch{return A.config?.appId??A.appId}}var dQQ,Js=7000,uQQ="2026-08-17T00:00:00.000Z",mQQ="Invite the service-account email in Play Console -> Users and permissions, then grant it release access for this app.",cQQ="App Store Connect rejected the API key - check the Key ID / Issuer ID / .p8 and that the key has Admin or Developer access (or sign the pending agreement).",w40,P40,_40,iQQ,nQQ;var aQQ=mA(()=>{Jy();hQQ();Lq();dQQ=AQ(oR(),1),w40=new Set(["FORBIDDEN.REQUIRED_AGREEMENTS_MISSING_OR_EXPIRED","FORBIDDEN_ERROR.PLA_NOT_ACCEPTED"]),P40=/(?:^|[._-])(NOT_AUTHORIZED|UNAUTHORIZED|AUTHENTICATION(?:_ERROR)?|INVALID_(?:TOKEN|CREDENTIALS?))(?:$|[._-])/i,_40=/authentication credentials? (?:are )?(?:missing or invalid)|invalid (?:bearer )?token|token (?:is )?(?:invalid|expired)/i;iQQ=b40(P3),nQQ=x40(gQQ)});var v40="2026-08-14T00:00:00.000Z",y40="2026-08-17T00:00:00.000Z",g40,oQQ;var rQQ=mA(()=>{feA();ceA();WAQ();FAQ();ZFA();e3A();er();_AQ();lAQ();$QQ();qQQ();PQQ();SQQ();fQQ();aQQ();g40=[nAQ,aAQ,oAQ,rAQ,sAQ,tAQ,eAQ,AQQ,QQQ,BQQ,LQQ,NQQ,VQQ,EQQ,RQQ,jQQ,wQQ,uAQ,mAQ,cAQ,dAQ,jAQ,wAQ,PAQ,XQQ,GQQ,KQQ,WQQ,HQQ,FQQ,DQQ,UQQ,zQQ].map((A)=>({...A,enforceAfter:v40})),oQQ=[bQQ,xQQ,HAQ,_QQ,TQQ,kQQ,zAQ,{...qAQ,enforceAfter:y40},IAQ,OAQ,LAQ,NAQ,VAQ,EAQ,qeA,CAQ,ueA,meA,aeA,oeA,reA,teA,eeA,LeA,NeA,VeA,EeA,ReA,jeA,weA,PeA,_eA,TeA,keA,SeA,beA,AAQ,QAQ,BAQ,$AQ,JAQ,YAQ,ZAQ,XAQ,GAQ,KAQ,iQQ,nQQ,...g40]});import{env as h40,stdout as u40}from"node:process";function d40(){return Boolean(u40.isTTY)&&!h40.NO_COLOR}function OFA(A,Q={}){let B=Q.color??d40(),$=Q.now??new Date,J=(U,q)=>B?`${U}${q}${PY.reset}`:q,Y=[];for(let U of m40)for(let q of A.findings.filter((z)=>z.severity===U)){let z=!mv(q,$),I=z?U==="error"?"✖ CRITICAL — INFORMATION ONLY":`${sQQ[U].trim()} — INFORMATION ONLY`:sQQ[U];if(Y.push(`${J(c40[U],I)} ${q.title} ${J(PY.dim,`[${q.id}]`)}`),q.detail)Y.push(J(PY.dim,` ${q.detail}`));if(q.fix)Y.push(J(PY.dim,` fix: ${q.fix}`));if(q.docsUrl)Y.push(J(PY.dim,` docs: ${q.docsUrl}`));if(z&&q.enforceAfter&&!(Q.ignoreFatal&&U==="error")){let C=U==="error"?"this critical finding is information only now and will fail builds":"this finding is information only now and can affect build outcomes";Y.push(J(PY.dim,` rollout: ${C} starting ${s3A(q.enforceAfter)}`))}}let{error:Z,warning:X,info:G}=A.counts;Y.push("");let K=`prescan: ${A.checksRun} checks in ${A.durationMs}ms — ${Z} error(s), ${X} warning(s), ${G} info`,W=Z>0?PY.red:X>0?PY.yellow:PY.dim;Y.push(J(W,K));let F=zj(A,$).filter((U)=>!(Q.ignoreFatal&&U.severity==="error"));if(F.length>0)Y.push(J(PY.dim,`rollout: ${F.length} finding(s) are information only until their enforcement deadline`));if(Q.verbose)Y.push(J(PY.dim,`remote checks skipped: ${A.skippedRemote}`));return Y.join(`
567
+ `)}function tQQ(A){let Q=A.findings.map((B)=>{let $={id:B.id,severity:B.severity,title:B.title};if(B.detail)$.detail=B.detail;if(B.fix)$.fix=B.fix;if(B.docsUrl)$.docsUrl=B.docsUrl;if(B.enforceAfter)$.enforceAfter=B.enforceAfter;return $});return JSON.stringify({version:1,counts:A.counts,checksRun:A.checksRun,durationMs:A.durationMs,skippedRemote:A.skippedRemote,findings:Q},null,2)}var m40,sQQ,PY,c40;var eQQ=mA(()=>{m40=["error","warning","info"],sQQ={error:"✖ ERROR",warning:"⚠ WARN ",info:"ℹ INFO "},PY={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",dim:"\x1B[2m",bold:"\x1B[1m"},c40={error:PY.bold+PY.red,warning:PY.bold+PY.yellow,info:PY.dim}});var LFA={};a9(LFA,{validateFlags:()=>A0Q,runPrescanGate:()=>i40,prescanCommand:()=>MFA,exitCodeFor:()=>Q0Q,executePrescan:()=>B0Q});import{cwd as l40,exit as p40}from"node:process";function A0Q(A){if(A.failOnWarnings&&A.ignoreFatal)throw Error("--ignore-fatal and --fail-on-warnings are contradictory — pick one")}function Q0Q(A,Q,B=[]){if(Q.ignoreFatal)return 0;let $=qj({counts:A,findings:B},Q.now);if($.error>0)return 1;if($.warning>0&&Q.failOnWarnings)return 2;return 0}async function B0Q(A,Q){let B=Q.platform;if(B!=="ios"&&B!=="android")throw Error("--platform must be ios or android");let $=Q.apikey??m4(),J;if($)try{J=await CB($,Q.supaHost,Q.supaAnon,!0)}catch{}let Y=await $eA({appId:A,platform:B,projectDir:Q.path??l40(),distributionMode:Q.iosDist,androidFlavor:Q.androidFlavor,apikey:$,supabase:J,credentials:Q.credentials});return{report:await XeA(Y,oQQ),apikey:$}}async function MFA(A,Q){if(A0Q(Q),!Q.json)FB("Capgo build prescan");let{report:B,apikey:$}=await B0Q(A,Q);if(Q.json)console.log(tQQ(B));else{T.message(OFA(B,{verbose:Q.verbose,now:Q.now,ignoreFatal:Q.ignoreFatal}));let J=t3A(B,Q);DB(J==="block"?"Prescan found blocking problems — fix them before building.":"Prescan finished.")}if($){let J=qj(B,Q.now),Y=zj(B,Q.now).length;await jB($,{channel:"build",event:"Prescan run",icon:"\uD83D\uDEE1️",tags:{source:"standalone",result:J.error>0?Q.ignoreFatal?"bypassed":"blocked":J.warning>0?Q.failOnWarnings?"blocked":"warned":Y>0?"information-only":"clean","app-id":A??"unknown",platform:Q.platform??"unknown",errors:String(B.counts.error),warnings:String(B.counts.warning),"finding-ids":B.findings.filter((Z)=>Z.severity!=="info").map((Z)=>Z.id).join(",").slice(0,200),"information-only-findings":String(Y)},notify:!1},Q.verbose).catch(()=>{})}p40(Q0Q(B.counts,Q,B.findings))}async function i40(A,Q){if(!A.enabled)return{decision:"proceed",report:null,crashed:!1,informationOnlyFindings:0};let B=()=>{},$=A.print??(A.silent?B:(G)=>T.message(G)),J=A.warn??(A.silent?B:(G)=>T.warn(G)),Y;try{Y=await Q()}catch(G){return J(`prescan crashed and was skipped: ${G instanceof Error?G.message:String(G)}`),{decision:"proceed",report:null,crashed:!0,informationOnlyFindings:0}}if(Y.findings.length>0)$(OFA(Y,{now:A.now,ignoreFatal:A.ignoreFatal}));let Z=t3A(Y,{ignoreFatal:A.ignoreFatal,failOnWarnings:A.failOnWarnings,now:A.now}),X;if(Z==="ask")X=A.interactive===!1?"proceed":await KeA("ask",{silent:A.silent});else X=Z;return{decision:X,report:Y,crashed:!1,informationOnlyFindings:zj(Y,A.now).length}}var Ys=mA(()=>{mB();AB();JeA();GeA();WeA();rQQ();eQQ()});var Ut=FA((nZ0)=>{nZ0.isInteger=(A)=>{if(typeof A==="number")return Number.isInteger(A);if(typeof A==="string"&&A.trim()!=="")return Number.isInteger(Number(A));return!1};nZ0.find=(A,Q)=>A.nodes.find((B)=>B.type===Q);nZ0.exceedsLimit=(A,Q,B=1,$)=>{if($===!1)return!1;if(!nZ0.isInteger(A)||!nZ0.isInteger(Q))return!1;return(Number(Q)-Number(A))/Number(B)>=$};nZ0.escapeNode=(A,Q=0,B)=>{let $=A.nodes[Q];if(!$)return;if(B&&$.type===B||$.type==="open"||$.type==="close"){if($.escaped!==!0)$.value="\\"+$.value,$.escaped=!0}};nZ0.encloseBrace=(A)=>{if(A.type!=="brace")return!1;if(A.commas>>0+A.ranges>>0===0)return A.invalid=!0,!0;return!1};nZ0.isInvalidBrace=(A)=>{if(A.type!=="brace")return!1;if(A.invalid===!0||A.dollar)return!0;if(A.commas>>0+A.ranges>>0===0)return A.invalid=!0,!0;if(A.open!==!0||A.close!==!0)return A.invalid=!0,!0;return!1};nZ0.isOpenOrClose=(A)=>{if(A.type==="open"||A.type==="close")return!0;return A.open===!0||A.close===!0};nZ0.reduce=(A)=>A.reduce((Q,B)=>{if(B.type==="text")Q.push(B.value);if(B.type==="range")B.type="text";return Q},[]);nZ0.flatten=(...A)=>{let Q=[],B=($)=>{for(let J=0;J<$.length;J++){let Y=$[J];if(Array.isArray(Y)){B(Y);continue}if(Y!==void 0)Q.push(Y)}return Q};return B(A),Q}});var zt=FA((FpB,z$Q)=>{var U$Q=Ut();z$Q.exports=(A,Q={})=>{let B=($,J={})=>{let Y=Q.escapeInvalid&&U$Q.isInvalidBrace(J),Z=$.invalid===!0&&Q.escapeInvalid===!0,X="";if($.value){if((Y||Z)&&U$Q.isOpenOrClose($))return"\\"+$.value;return $.value}if($.value)return $.value;if($.nodes)for(let G of $.nodes)X+=B(G);return X};return B(A)}});var I$Q=FA((DpB,q$Q)=>{/*!
568
568
  * is-number <https://github.com/jonschlinkert/is-number>
569
569
  *
570
570
  * Copyright (c) 2014-present, Jon Schlinkert.
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
3
  "type": "module",
4
- "version": "8.32.0",
4
+ "version": "8.32.1",
5
5
  "description": "A CLI to upload to capgo servers",
6
6
  "author": "Martin martin@capgo.app",
7
7
  "license": "Apache 2.0",
@@ -3,5 +3,6 @@ export declare function renderTerminalReport(report: PrescanReport, opts?: {
3
3
  verbose?: boolean;
4
4
  color?: boolean;
5
5
  now?: Date;
6
+ ignoreFatal?: boolean;
6
7
  }): string;
7
8
  export declare function renderJsonReport(report: PrescanReport): string;
package/dist/src/sdk.js CHANGED
@@ -109,7 +109,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
109
109
  `)}),D.__defineSetter__("stack",function(J){return[J].concat(D.stack).join(`
110
110
 
111
111
  `)}),D}});var sd=A((AE$,td)=>{var d9=s("constants"),Zv0=process.cwd,OW=null,Fv0=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!OW)OW=Zv0.call(process);return OW};try{process.cwd()}catch($){}if(typeof process.chdir==="function"){if(VW=process.chdir,process.chdir=function($){OW=null,VW.call(process,$)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,VW)}var VW;td.exports=Uv0;function Uv0($){if(d9.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./))D($);if(!$.lutimes)J($);if($.chown=Y($.chown),$.fchown=Y($.fchown),$.lchown=Y($.lchown),$.chmod=X($.chmod),$.fchmod=X($.fchmod),$.lchmod=X($.lchmod),$.chownSync=Z($.chownSync),$.fchownSync=Z($.fchownSync),$.lchownSync=Z($.lchownSync),$.chmodSync=Q($.chmodSync),$.fchmodSync=Q($.fchmodSync),$.lchmodSync=Q($.lchmodSync),$.stat=F($.stat),$.fstat=F($.fstat),$.lstat=F($.lstat),$.statSync=U($.statSync),$.fstatSync=U($.fstatSync),$.lstatSync=U($.lstatSync),$.chmod&&!$.lchmod)$.lchmod=function(q,W,z){if(z)process.nextTick(z)},$.lchmodSync=function(){};if($.chown&&!$.lchown)$.lchown=function(q,W,z,H){if(H)process.nextTick(H)},$.lchownSync=function(){};if(Fv0==="win32")$.rename=typeof $.rename!=="function"?$.rename:function(q){function W(z,H,O){var V=Date.now(),K=0;q(z,H,function L(E){if(E&&(E.code==="EACCES"||E.code==="EPERM"||E.code==="EBUSY")&&Date.now()-V<60000){if(setTimeout(function(){$.stat(H,function(N,M){if(N&&N.code==="ENOENT")q(z,H,L);else O(E)})},K),K<100)K+=10;return}if(O)O(E)})}if(Object.setPrototypeOf)Object.setPrototypeOf(W,q);return W}($.rename);$.read=typeof $.read!=="function"?$.read:function(q){function W(z,H,O,V,K,L){var E;if(L&&typeof L==="function"){var N=0;E=function(M,w,R){if(M&&M.code==="EAGAIN"&&N<10)return N++,q.call($,z,H,O,V,K,E);L.apply(this,arguments)}}return q.call($,z,H,O,V,K,E)}if(Object.setPrototypeOf)Object.setPrototypeOf(W,q);return W}($.read),$.readSync=typeof $.readSync!=="function"?$.readSync:function(q){return function(W,z,H,O,V){var K=0;while(!0)try{return q.call($,W,z,H,O,V)}catch(L){if(L.code==="EAGAIN"&&K<10){K++;continue}throw L}}}($.readSync);function D(q){q.lchmod=function(W,z,H){q.open(W,d9.O_WRONLY|d9.O_SYMLINK,z,function(O,V){if(O){if(H)H(O);return}q.fchmod(V,z,function(K){q.close(V,function(L){if(H)H(K||L)})})})},q.lchmodSync=function(W,z){var H=q.openSync(W,d9.O_WRONLY|d9.O_SYMLINK,z),O=!0,V;try{V=q.fchmodSync(H,z),O=!1}finally{if(O)try{q.closeSync(H)}catch(K){}else q.closeSync(H)}return V}}function J(q){if(d9.hasOwnProperty("O_SYMLINK")&&q.futimes)q.lutimes=function(W,z,H,O){q.open(W,d9.O_SYMLINK,function(V,K){if(V){if(O)O(V);return}q.futimes(K,z,H,function(L){q.close(K,function(E){if(O)O(L||E)})})})},q.lutimesSync=function(W,z,H){var O=q.openSync(W,d9.O_SYMLINK),V,K=!0;try{V=q.futimesSync(O,z,H),K=!1}finally{if(K)try{q.closeSync(O)}catch(L){}else q.closeSync(O)}return V};else if(q.futimes)q.lutimes=function(W,z,H,O){if(O)process.nextTick(O)},q.lutimesSync=function(){}}function X(q){if(!q)return q;return function(W,z,H){return q.call($,W,z,function(O){if(G(O))O=null;if(H)H.apply(this,arguments)})}}function Q(q){if(!q)return q;return function(W,z){try{return q.call($,W,z)}catch(H){if(!G(H))throw H}}}function Y(q){if(!q)return q;return function(W,z,H,O){return q.call($,W,z,H,function(V){if(G(V))V=null;if(O)O.apply(this,arguments)})}}function Z(q){if(!q)return q;return function(W,z,H){try{return q.call($,W,z,H)}catch(O){if(!G(O))throw O}}}function F(q){if(!q)return q;return function(W,z,H){if(typeof z==="function")H=z,z=null;function O(V,K){if(K){if(K.uid<0)K.uid+=4294967296;if(K.gid<0)K.gid+=4294967296}if(H)H.apply(this,arguments)}return z?q.call($,W,z,O):q.call($,W,O)}}function U(q){if(!q)return q;return function(W,z){var H=z?q.call($,W,z):q.call($,W);if(H){if(H.uid<0)H.uid+=4294967296;if(H.gid<0)H.gid+=4294967296}return H}}function G(q){if(!q)return!0;if(q.code==="ENOSYS")return!0;var W=!process.getuid||process.getuid()!==0;if(W){if(q.code==="EINVAL"||q.code==="EPERM")return!0}return!1}}});var Dc=A((IE$,$c)=>{var ed=s("stream").Stream;$c.exports=Gv0;function Gv0($){return{ReadStream:D,WriteStream:J};function D(X,Q){if(!(this instanceof D))return new D(X,Q);ed.call(this);var Y=this;this.path=X,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,Q=Q||{};var Z=Object.keys(Q);for(var F=0,U=Z.length;F<U;F++){var G=Z[F];this[G]=Q[G]}if(this.encoding)this.setEncoding(this.encoding);if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!=="number")throw TypeError("end must be a Number");if(this.start>this.end)throw Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){Y._read()});return}$.open(this.path,this.flags,this.mode,function(q,W){if(q){Y.emit("error",q),Y.readable=!1;return}Y.fd=W,Y.emit("open",W),Y._read()})}function J(X,Q){if(!(this instanceof J))return new J(X,Q);ed.call(this),this.path=X,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,Q=Q||{};var Y=Object.keys(Q);for(var Z=0,F=Y.length;Z<F;Z++){var U=Y[Z];this[U]=Q[U]}if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.start<0)throw Error("start must be >= zero");this.pos=this.start}if(this.busy=!1,this._queue=[],this.fd===null)this._open=$.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush()}}});var Xc=A((jE$,Jc)=>{Jc.exports=Wv0;var qv0=Object.getPrototypeOf||function($){return $.__proto__};function Wv0($){if($===null||typeof $!=="object")return $;if($ instanceof Object)var D={__proto__:qv0($)};else var D=Object.create(null);return Object.getOwnPropertyNames($).forEach(function(J){Object.defineProperty(D,J,Object.getOwnPropertyDescriptor($,J))}),D}});var y1=A((TE$,uw)=>{var T1=s("fs"),zv0=sd(),Hv0=Dc(),Ov0=Xc(),KW=s("util"),WD,MW;if(typeof Symbol==="function"&&typeof Symbol.for==="function")WD=Symbol.for("graceful-fs.queue"),MW=Symbol.for("graceful-fs.previous");else WD="___graceful-fs.queue",MW="___graceful-fs.previous";function Vv0(){}function Yc($,D){Object.defineProperty($,WD,{get:function(){return D}})}var EJ=Vv0;if(KW.debuglog)EJ=KW.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))EJ=function(){var $=KW.format.apply(KW,arguments);$="GFS4: "+$.split(/\n/).join(`
112
- GFS4: `),console.error($)};if(!T1[WD]){if(vw=global[WD]||[],Yc(T1,vw),T1.close=function($){function D(J,X){return $.call(T1,J,function(Q){if(!Q)Qc();if(typeof X==="function")X.apply(this,arguments)})}return Object.defineProperty(D,MW,{value:$}),D}(T1.close),T1.closeSync=function($){function D(J){$.apply(T1,arguments),Qc()}return Object.defineProperty(D,MW,{value:$}),D}(T1.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){EJ(T1[WD]),s("assert").equal(T1[WD].length,0)})}var vw;if(!global[WD])Yc(global,T1[WD]);uw.exports=_w(Ov0(T1));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!T1.__patched)uw.exports=_w(T1),T1.__patched=!0;function _w($){zv0($),$.gracefulify=_w,$.createReadStream=w,$.createWriteStream=R;var D=$.readFile;$.readFile=J;function J(I,_,x){if(typeof _==="function")x=_,_=null;return c(I,_,x);function c(d,D0,b,j){return D(d,D0,function(T){if(T&&(T.code==="EMFILE"||T.code==="ENFILE"))xX([c,[d,D0,b],T,j||Date.now(),Date.now()]);else if(typeof b==="function")b.apply(this,arguments)})}}var X=$.writeFile;$.writeFile=Q;function Q(I,_,x,c){if(typeof x==="function")c=x,x=null;return d(I,_,x,c);function d(D0,b,j,T,u){return X(D0,b,j,function(m){if(m&&(m.code==="EMFILE"||m.code==="ENFILE"))xX([d,[D0,b,j,T],m,u||Date.now(),Date.now()]);else if(typeof T==="function")T.apply(this,arguments)})}}var Y=$.appendFile;if(Y)$.appendFile=Z;function Z(I,_,x,c){if(typeof x==="function")c=x,x=null;return d(I,_,x,c);function d(D0,b,j,T,u){return Y(D0,b,j,function(m){if(m&&(m.code==="EMFILE"||m.code==="ENFILE"))xX([d,[D0,b,j,T],m,u||Date.now(),Date.now()]);else if(typeof T==="function")T.apply(this,arguments)})}}var F=$.copyFile;if(F)$.copyFile=U;function U(I,_,x,c){if(typeof x==="function")c=x,x=0;return d(I,_,x,c);function d(D0,b,j,T,u){return F(D0,b,j,function(m){if(m&&(m.code==="EMFILE"||m.code==="ENFILE"))xX([d,[D0,b,j,T],m,u||Date.now(),Date.now()]);else if(typeof T==="function")T.apply(this,arguments)})}}var G=$.readdir;$.readdir=W;var q=/^v[0-5]\./;function W(I,_,x){if(typeof _==="function")x=_,_=null;var c=q.test(process.version)?function(b,j,T,u){return G(b,d(b,j,T,u))}:function(b,j,T,u){return G(b,j,d(b,j,T,u))};return c(I,_,x);function d(D0,b,j,T){return function(u,m){if(u&&(u.code==="EMFILE"||u.code==="ENFILE"))xX([c,[D0,b,j],u,T||Date.now(),Date.now()]);else{if(m&&m.sort)m.sort();if(typeof j==="function")j.call(this,u,m)}}}}if(process.version.substr(0,4)==="v0.8"){var z=Hv0($);L=z.ReadStream,N=z.WriteStream}var H=$.ReadStream;if(H)L.prototype=Object.create(H.prototype),L.prototype.open=E;var O=$.WriteStream;if(O)N.prototype=Object.create(O.prototype),N.prototype.open=M;Object.defineProperty($,"ReadStream",{get:function(){return L},set:function(I){L=I},enumerable:!0,configurable:!0}),Object.defineProperty($,"WriteStream",{get:function(){return N},set:function(I){N=I},enumerable:!0,configurable:!0});var V=L;Object.defineProperty($,"FileReadStream",{get:function(){return V},set:function(I){V=I},enumerable:!0,configurable:!0});var K=N;Object.defineProperty($,"FileWriteStream",{get:function(){return K},set:function(I){K=I},enumerable:!0,configurable:!0});function L(I,_){if(this instanceof L)return H.apply(this,arguments),this;else return L.apply(Object.create(L.prototype),arguments)}function E(){var I=this;v(I.path,I.flags,I.mode,function(_,x){if(_){if(I.autoClose)I.destroy();I.emit("error",_)}else I.fd=x,I.emit("open",x),I.read()})}function N(I,_){if(this instanceof N)return O.apply(this,arguments),this;else return N.apply(Object.create(N.prototype),arguments)}function M(){var I=this;v(I.path,I.flags,I.mode,function(_,x){if(_)I.destroy(),I.emit("error",_);else I.fd=x,I.emit("open",x)})}function w(I,_){return new $.ReadStream(I,_)}function R(I,_){return new $.WriteStream(I,_)}var S=$.open;$.open=v;function v(I,_,x,c){if(typeof x==="function")c=x,x=null;return d(I,_,x,c);function d(D0,b,j,T,u){return S(D0,b,j,function(m,i){if(m&&(m.code==="EMFILE"||m.code==="ENFILE"))xX([d,[D0,b,j,T],m,u||Date.now(),Date.now()]);else if(typeof T==="function")T.apply(this,arguments)})}}return $}function xX($){EJ("ENQUEUE",$[0].name,$[1]),T1[WD].push($),kw()}var NW;function Qc(){var $=Date.now();for(var D=0;D<T1[WD].length;++D)if(T1[WD][D].length>2)T1[WD][D][3]=$,T1[WD][D][4]=$;kw()}function kw(){if(clearTimeout(NW),NW=void 0,T1[WD].length===0)return;var $=T1[WD].shift(),D=$[0],J=$[1],X=$[2],Q=$[3],Y=$[4];if(Q===void 0)EJ("RETRY",D.name,J),D.apply(null,J);else if(Date.now()-Q>=60000){EJ("TIMEOUT",D.name,J);var Z=J.pop();if(typeof Z==="function")Z.call(null,X)}else{var F=Date.now()-Y,U=Math.max(Y-Q,1),G=Math.min(U*1.2,100);if(F>=G)EJ("RETRY",D.name,J),D.apply(null,J.concat([Q]));else T1[WD].push($)}if(NW===void 0)NW=setTimeout(kw,0)}});var Fc=A((CE$,Zc)=>{function n6($,D){if(typeof D==="boolean")D={forever:D};if(this._originalTimeouts=JSON.parse(JSON.stringify($)),this._timeouts=$,this._options=D||{},this._maxRetryTime=D&&D.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}Zc.exports=n6;n6.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};n6.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};n6.prototype.retry=function($){if(this._timeout)clearTimeout(this._timeout);if(!$)return!1;var D=new Date().getTime();if($&&D-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push($);var J=this._timeouts.shift();if(J===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),J=this._timeouts.shift();else return!1;var X=this,Q=setTimeout(function(){if(X._attempts++,X._operationTimeoutCb){if(X._timeout=setTimeout(function(){X._operationTimeoutCb(X._attempts)},X._operationTimeout),X._options.unref)X._timeout.unref()}X._fn(X._attempts)},J);if(this._options.unref)Q.unref();return!0};n6.prototype.attempt=function($,D){if(this._fn=$,D){if(D.timeout)this._operationTimeout=D.timeout;if(D.cb)this._operationTimeoutCb=D.cb}var J=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){J._operationTimeoutCb()},J._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};n6.prototype.try=function($){console.log("Using RetryOperation.try() is deprecated"),this.attempt($)};n6.prototype.start=function($){console.log("Using RetryOperation.start() is deprecated"),this.attempt($)};n6.prototype.start=n6.prototype.try;n6.prototype.errors=function(){return this._errors};n6.prototype.attempts=function(){return this._attempts};n6.prototype.mainError=function(){if(this._errors.length===0)return null;var $={},D=null,J=0;for(var X=0;X<this._errors.length;X++){var Q=this._errors[X],Y=Q.message,Z=($[Y]||0)+1;if($[Y]=Z,Z>=J)D=Q,J=Z}return D}});var Gc=A((Nv0)=>{var Kv0=Fc();Nv0.operation=function($){var D=Nv0.timeouts($);return new Kv0(D,{forever:$&&$.forever,unref:$&&$.unref,maxRetryTime:$&&$.maxRetryTime})};Nv0.timeouts=function($){if($ instanceof Array)return[].concat($);var D={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var J in $)D[J]=$[J];if(D.minTimeout>D.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var X=[];for(var Q=0;Q<D.retries;Q++)X.push(this.createTimeout(Q,D));if($&&$.forever&&!X.length)X.push(this.createTimeout(Q,D));return X.sort(function(Y,Z){return Y-Z}),X};Nv0.createTimeout=function($,D){var J=D.randomize?Math.random()+1:1,X=Math.round(J*D.minTimeout*Math.pow(D.factor,$));return X=Math.min(X,D.maxTimeout),X};Nv0.wrap=function($,D,J){if(D instanceof Array)J=D,D=null;if(!J){J=[];for(var X in $)if(typeof $[X]==="function")J.push(X)}for(var Q=0;Q<J.length;Q++){var Y=J[Q],Z=$[Y];$[Y]=function(U){var G=Nv0.operation(D),q=Array.prototype.slice.call(arguments,1),W=q.pop();q.push(function(z){if(G.retry(z))return;if(z)arguments[0]=G.mainError();W.apply(this,arguments)}),G.attempt(function(){U.apply($,q)})}.bind($,Z),$[Y].options=D}}});var qc=A((SE$,LW)=>{LW.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")LW.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")LW.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var EW=A((xE$,_X)=>{var B1=global.process,RJ=function($){return $&&typeof $==="object"&&typeof $.removeListener==="function"&&typeof $.emit==="function"&&typeof $.reallyExit==="function"&&typeof $.listeners==="function"&&typeof $.kill==="function"&&typeof $.pid==="number"&&typeof $.on==="function"};if(!RJ(B1))_X.exports=function(){return function(){}};else{if(yw=s("assert"),AJ=qc(),fw=/^win/i.test(B1.platform),vX=s("events"),typeof vX!=="function")vX=vX.EventEmitter;if(B1.__signal_exit_emitter__)a1=B1.__signal_exit_emitter__;else a1=B1.__signal_exit_emitter__=new vX,a1.count=0,a1.emitted={};if(!a1.infinite)a1.setMaxListeners(1/0),a1.infinite=!0;_X.exports=function($,D){if(!RJ(global.process))return function(){};if(yw.equal(typeof $,"function","a callback must be provided for exit handler"),IJ===!1)wW();var J="exit";if(D&&D.alwaysLast)J="afterexit";var X=function(){if(a1.removeListener(J,$),a1.listeners("exit").length===0&&a1.listeners("afterexit").length===0)zF()};return a1.on(J,$),X},zF=function(){if(!IJ||!RJ(global.process))return;IJ=!1,AJ.forEach(function(D){try{B1.removeListener(D,HF[D])}catch(J){}}),B1.emit=OF,B1.reallyExit=BW,a1.count-=1},_X.exports.unload=zF,c9=function(D,J,X){if(a1.emitted[D])return;a1.emitted[D]=!0,a1.emit(D,J,X)},HF={},AJ.forEach(function($){HF[$]=function(){if(!RJ(global.process))return;var J=B1.listeners($);if(J.length===a1.count){if(zF(),c9("exit",null,$),c9("afterexit",null,$),fw&&$==="SIGHUP")$="SIGINT";B1.kill(B1.pid,$)}}}),_X.exports.signals=function(){return AJ},IJ=!1,wW=function(){if(IJ||!RJ(global.process))return;IJ=!0,a1.count+=1,AJ=AJ.filter(function(D){try{return B1.on(D,HF[D]),!0}catch(J){return!1}}),B1.emit=bw,B1.reallyExit=hw},_X.exports.load=wW,BW=B1.reallyExit,hw=function(D){if(!RJ(global.process))return;B1.exitCode=D||0,c9("exit",B1.exitCode,null),c9("afterexit",B1.exitCode,null),BW.call(B1,B1.exitCode)},OF=B1.emit,bw=function(D,J){if(D==="exit"&&RJ(global.process)){if(J!==void 0)B1.exitCode=J;var X=OF.apply(this,arguments);return c9("exit",B1.exitCode,null),c9("afterexit",B1.exitCode,null),X}else return OF.apply(this,arguments)}}var yw,AJ,fw,vX,a1,zF,c9,HF,IJ,wW,BW,hw,OF,bw});var zc=A((Rv0,gw)=>{var Wc=Symbol();function Bv0($,D,J){let X=D[Wc];if(X)return D.stat($,(Y,Z)=>{if(Y)return J(Y);J(null,Z.mtime,X)});let Q=new Date(Math.ceil(Date.now()/1000)*1000+5);D.utimes($,Q,Q,(Y)=>{if(Y)return J(Y);D.stat($,(Z,F)=>{if(Z)return J(Z);let U=F.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty(D,Wc,{value:U}),J(null,F.mtime,U)})})}function Ev0($){let D=Date.now();if($==="s")D=Math.ceil(D/1000)*1000;return new Date(D)}Rv0.probe=Bv0;Rv0.getMtime=Ev0});var Nc=A((vv0,KF)=>{var jv0=s("path"),cw=y1(),Tv0=Gc(),Cv0=EW(),Hc=zc(),o8={};function VF($,D){return D.lockfilePath||`${$}.lock`}function lw($,D,J){if(!D.realpath)return J(null,jv0.resolve($));D.fs.realpath($,J)}function dw($,D,J){let X=VF($,D);D.fs.mkdir(X,(Q)=>{if(!Q)return Hc.probe(X,D.fs,(Y,Z,F)=>{if(Y)return D.fs.rmdir(X,()=>{}),J(Y);J(null,Z,F)});if(Q.code!=="EEXIST")return J(Q);if(D.stale<=0)return J(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:$}));D.fs.stat(X,(Y,Z)=>{if(Y){if(Y.code==="ENOENT")return dw($,{...D,stale:0},J);return J(Y)}if(!Oc(Z,D))return J(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:$}));Vc($,D,(F)=>{if(F)return J(F);dw($,{...D,stale:0},J)})})})}function Oc($,D){return $.mtime.getTime()<Date.now()-D.stale}function Vc($,D,J){D.fs.rmdir(VF($,D),(X)=>{if(X&&X.code!=="ENOENT")return J(X);J()})}function RW($,D){let J=o8[$];if(J.updateTimeout)return;if(J.updateDelay=J.updateDelay||D.update,J.updateTimeout=setTimeout(()=>{J.updateTimeout=null,D.fs.stat(J.lockfilePath,(X,Q)=>{let Y=J.lastUpdate+D.stale<Date.now();if(X){if(X.code==="ENOENT"||Y)return mw($,J,Object.assign(X,{code:"ECOMPROMISED"}));return J.updateDelay=1000,RW($,D)}if(J.mtime.getTime()!==Q.mtime.getTime())return mw($,J,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let F=Hc.getMtime(J.mtimePrecision);D.fs.utimes(J.lockfilePath,F,F,(U)=>{let G=J.lastUpdate+D.stale<Date.now();if(J.released)return;if(U){if(U.code==="ENOENT"||G)return mw($,J,Object.assign(U,{code:"ECOMPROMISED"}));return J.updateDelay=1000,RW($,D)}J.mtime=F,J.lastUpdate=Date.now(),J.updateDelay=null,RW($,D)})})},J.updateDelay),J.updateTimeout.unref)J.updateTimeout.unref()}function mw($,D,J){if(D.released=!0,D.updateTimeout)clearTimeout(D.updateTimeout);if(o8[$]===D)delete o8[$];D.options.onCompromised(J)}function Pv0($,D,J){D={stale:1e4,update:null,realpath:!0,retries:0,fs:cw,onCompromised:(X)=>{throw X},...D},D.retries=D.retries||0,D.retries=typeof D.retries==="number"?{retries:D.retries}:D.retries,D.stale=Math.max(D.stale||0,2000),D.update=D.update==null?D.stale/2:D.update||0,D.update=Math.max(Math.min(D.update,D.stale/2),1000),lw($,D,(X,Q)=>{if(X)return J(X);let Y=Tv0.operation(D.retries);Y.attempt(()=>{dw(Q,D,(Z,F,U)=>{if(Y.retry(Z))return;if(Z)return J(Y.mainError());let G=o8[Q]={lockfilePath:VF(Q,D),mtime:F,mtimePrecision:U,options:D,lastUpdate:Date.now()};RW(Q,D),J(null,(q)=>{if(G.released)return q&&q(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));Kc(Q,{...D,realpath:!1},q)})})})})}function Kc($,D,J){D={fs:cw,realpath:!0,...D},lw($,D,(X,Q)=>{if(X)return J(X);let Y=o8[Q];if(!Y)return J(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));Y.updateTimeout&&clearTimeout(Y.updateTimeout),Y.released=!0,delete o8[Q],Vc(Q,D,J)})}function Sv0($,D,J){D={stale:1e4,realpath:!0,fs:cw,...D},D.stale=Math.max(D.stale||0,2000),lw($,D,(X,Q)=>{if(X)return J(X);D.fs.stat(VF(Q,D),(Y,Z)=>{if(Y)return Y.code==="ENOENT"?J(null,!1):J(Y);return J(null,!Oc(Z,D))})})}function xv0(){return o8}Cv0(()=>{for(let $ in o8){let D=o8[$].options;try{D.fs.rmdirSync(VF($,D))}catch(J){}}});vv0.lock=Pv0;vv0.unlock=Kc;vv0.check=Sv0;vv0.getLocks=xv0});var Lc=A((vE$,Mc)=>{var fv0=y1();function hv0($){let D=["mkdir","realpath","stat","rmdir","utimes"],J={...$};return D.forEach((X)=>{J[X]=(...Q)=>{let Y=Q.pop(),Z;try{Z=$[`${X}Sync`](...Q)}catch(F){return Y(F)}Y(null,Z)}}),J}function bv0($){return(...D)=>new Promise((J,X)=>{D.push((Q,Y)=>{if(Q)X(Q);else J(Y)}),$(...D)})}function gv0($){return(...D)=>{let J,X;if(D.push((Q,Y)=>{J=Q,X=Y}),$(...D),J)throw J;return X}}function mv0($){if($={...$},$.fs=hv0($.fs||fv0),typeof $.retries==="number"&&$.retries>0||$.retries&&typeof $.retries.retries==="number"&&$.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return $}Mc.exports={toPromise:bv0,toSync:gv0,toSyncOptions:mv0}});var Bc=A((_E$,l9)=>{var kX=Nc(),{toPromise:AW,toSync:IW,toSyncOptions:nw}=Lc();async function wc($,D){let J=await AW(kX.lock)($,D);return AW(J)}function dv0($,D){let J=IW(kX.lock)($,nw(D));return IW(J)}function cv0($,D){return AW(kX.unlock)($,D)}function lv0($,D){return IW(kX.unlock)($,nw(D))}function nv0($,D){return AW(kX.check)($,D)}function iv0($,D){return IW(kX.check)($,nw(D))}l9.exports=wc;l9.exports.lock=wc;l9.exports.unlock=cv0;l9.exports.lockSync=dv0;l9.exports.unlockSync=lv0;l9.exports.check=nv0;l9.exports.checkSync=iv0});var Cc=A((jc)=>{Object.defineProperty(jc,"__esModule",{value:!0});jc.canStoreURLs=jc.FileUrlStorage=void 0;var Ec=s("fs"),pv0=ov0(ad()),Rc=rv0(Bc());function Ic($){if(typeof WeakMap!="function")return null;var D=new WeakMap,J=new WeakMap;return(Ic=function(X){return X?J:D})($)}function rv0($,D){if(!D&&$&&$.__esModule)return $;if($===null||typeof $!="object"&&typeof $!="function")return{default:$};var J=Ic(D);if(J&&J.has($))return J.get($);var X={__proto__:null},Q=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Y in $)if(Y!=="default"&&{}.hasOwnProperty.call($,Y)){var Z=Q?Object.getOwnPropertyDescriptor($,Y):null;Z&&(Z.get||Z.set)?Object.defineProperty(X,Y,Z):X[Y]=$[Y]}return X.default=$,J&&J.set($,X),X}function ov0($){return $&&$.__esModule?$:{default:$}}function NF($){return NF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D},NF($)}function av0($,D){if(!($ instanceof D))throw TypeError("Cannot call a class as a function")}function Ac($,D){for(var J=0;J<D.length;J++){var X=D[J];if(X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X)X.writable=!0;Object.defineProperty($,sv0(X.key),X)}}function tv0($,D,J){if(D)Ac($.prototype,D);if(J)Ac($,J);return Object.defineProperty($,"prototype",{writable:!1}),$}function sv0($){var D=ev0($,"string");return NF(D)=="symbol"?D:D+""}function ev0($,D){if(NF($)!="object"||!$)return $;var J=$[Symbol.toPrimitive];if(J!==void 0){var X=J.call($,D||"default");if(NF(X)!="object")return X;throw TypeError("@@toPrimitive must return a primitive value.")}return(D==="string"?String:Number)($)}var kE$=jc.canStoreURLs=!0,uE$=jc.FileUrlStorage=function(){function $(D){av0(this,$),this.path=D}return tv0($,[{key:"findAllUploads",value:function(){var J=this;return new Promise(function(X,Q){J._getItems("tus::",function(Y,Z){if(Y)Q(Y);else X(Z)})})}},{key:"findUploadsByFingerprint",value:function(J){var X=this;return new Promise(function(Q,Y){X._getItems("tus::".concat(J),function(Z,F){if(Z)Y(Z);else Q(F)})})}},{key:"removeUpload",value:function(J){var X=this;return new Promise(function(Q,Y){X._removeItem(J,function(Z){if(Z)Y(Z);else Q()})})}},{key:"addUpload",value:function(J,X){var Q=this,Y=Math.round(Math.random()*1000000000000),Z="tus::".concat(J,"::").concat(Y);return new Promise(function(F,U){Q._setItem(Z,X,function(G){if(G)U(G);else F(Z)})})}},{key:"_setItem",value:function(J,X,Q){var Y=this;Rc.lock(this.path,this._lockfileOptions()).then(function(Z){Q=Y._releaseAndCb(Z,Q),Y._getData(function(F,U){if(F){Q(F);return}U[J]=X,Y._writeData(U,function(G){return Q(G)})})}).catch(Q)}},{key:"_getItems",value:function(J,X){this._getData(function(Q,Y){if(Q){X(Q);return}var Z=Object.keys(Y).filter(function(F){return F.startsWith(J)}).map(function(F){var U=Y[F];return U.urlStorageKey=F,U});X(null,Z)})}},{key:"_removeItem",value:function(J,X){var Q=this;Rc.lock(this.path,this._lockfileOptions()).then(function(Y){X=Q._releaseAndCb(Y,X),Q._getData(function(Z,F){if(Z){X(Z);return}delete F[J],Q._writeData(F,function(U){return X(U)})})}).catch(X)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(J,X){return function(Q){if(Q){J().then(function(){return X(Q)}).catch(function(Y){return X((0,pv0.default)([Q,Y]))});return}J().then(X).catch(X)}}},{key:"_writeData",value:function(J,X){var Q={encoding:"utf8",mode:432,flag:"w"};(0,Ec.writeFile)(this.path,JSON.stringify(J),Q,function(Y){return X(Y)})}},{key:"_getData",value:function(J){(0,Ec.readFile)(this.path,"utf8",function(X,Q){if(X){if(X.code==="ENOENT")J(null,{});else J(X);return}try{Q=!Q.trim().length?{}:JSON.parse(Q)}catch(Y){J(Y);return}J(null,Q)})}}])}()});var TW=A((n9)=>{Object.defineProperty(n9,"__esModule",{value:!0});Object.defineProperty(n9,"DefaultHttpStack",{enumerable:!0,get:function(){return vc.default}});Object.defineProperty(n9,"DetailedError",{enumerable:!0,get:function(){return D_0.default}});Object.defineProperty(n9,"FileUrlStorage",{enumerable:!0,get:function(){return _c.FileUrlStorage}});Object.defineProperty(n9,"StreamSource",{enumerable:!0,get:function(){return Z_0.default}});n9.Upload=void 0;Object.defineProperty(n9,"canStoreURLs",{enumerable:!0,get:function(){return _c.canStoreURLs}});n9.defaultOptions=void 0;Object.defineProperty(n9,"enableDebugLog",{enumerable:!0,get:function(){return J_0.enableDebugLog}});n9.isSupported=void 0;var D_0=jJ(nL()),J_0=iL(),X_0=jJ(Bg()),iw=jJ($m()),Q_0=jJ(wm()),Y_0=jJ(Im()),vc=jJ(mm()),Z_0=jJ(Xw()),_c=Cc();function jJ($){return $&&$.__esModule?$:{default:$}}function yX($){return yX=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D},yX($)}function F_0($,D){if(!($ instanceof D))throw TypeError("Cannot call a class as a function")}function Pc($,D){for(var J=0;J<D.length;J++){var X=D[J];if(X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X)X.writable=!0;Object.defineProperty($,uc(X.key),X)}}function U_0($,D,J){if(D)Pc($.prototype,D);if(J)Pc($,J);return Object.defineProperty($,"prototype",{writable:!1}),$}function G_0($,D,J){return D=jW(D),q_0($,kc()?Reflect.construct(D,J||[],jW($).constructor):D.apply($,J))}function q_0($,D){if(D&&(yX(D)==="object"||typeof D==="function"))return D;else if(D!==void 0)throw TypeError("Derived constructors may only return object or undefined");return W_0($)}function W_0($){if($===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return $}function kc(){try{var $=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(D){}return(kc=function(){return!!$})()}function jW($){return jW=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(J){return J.__proto__||Object.getPrototypeOf(J)},jW($)}function z_0($,D){if(typeof D!=="function"&&D!==null)throw TypeError("Super expression must either be null or a function");if($.prototype=Object.create(D&&D.prototype,{constructor:{value:$,writable:!0,configurable:!0}}),Object.defineProperty($,"prototype",{writable:!1}),D)pw($,D)}function pw($,D){return pw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(X,Q){return X.__proto__=Q,X},pw($,D)}function Sc($,D){var J=Object.keys($);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols($);D&&(X=X.filter(function(Q){return Object.getOwnPropertyDescriptor($,Q).enumerable})),J.push.apply(J,X)}return J}function uX($){for(var D=1;D<arguments.length;D++){var J=arguments[D]!=null?arguments[D]:{};D%2?Sc(Object(J),!0).forEach(function(X){H_0($,X,J[X])}):Object.getOwnPropertyDescriptors?Object.defineProperties($,Object.getOwnPropertyDescriptors(J)):Sc(Object(J)).forEach(function(X){Object.defineProperty($,X,Object.getOwnPropertyDescriptor(J,X))})}return $}function H_0($,D,J){if(D=uc(D),D in $)Object.defineProperty($,D,{value:J,enumerable:!0,configurable:!0,writable:!0});else $[D]=J;return $}function uc($){var D=O_0($,"string");return yX(D)=="symbol"?D:D+""}function O_0($,D){if(yX($)!="object"||!$)return $;var J=$[Symbol.toPrimitive];if(J!==void 0){var X=J.call($,D||"default");if(yX(X)!="object")return X;throw TypeError("@@toPrimitive must return a primitive value.")}return(D==="string"?String:Number)($)}var xc=n9.defaultOptions=uX(uX({},iw.default.defaultOptions),{},{httpStack:new vc.default,fileReader:new Q_0.default,urlStorage:new X_0.default,fingerprint:Y_0.default}),fE$=n9.Upload=function($){function D(){var J=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return F_0(this,D),X=uX(uX({},xc),X),G_0(this,D,[J,X])}return z_0(D,$),U_0(D,null,[{key:"terminate",value:function(X){var Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Q=uX(uX({},xc),Q),iw.default.terminate(X,Q)}}])}(iw.default),hE$=n9.isSupported=!0});var zD;var a8=a(()=>{zD={name:"@capgo/cli",type:"module",version:"8.32.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/capgo.git",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test: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","test:credentials":"bun test/test-credentials.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test: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:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:init-replay":"bun test/test-init-replay.mjs","test:capacitor-config-target":"bun test/test-capacitor-config-target.mjs","test:init-monorepo-targeting":"bun run test:capacitor-config-target && 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:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:fail-on-incompatible && bun run test:native-dependencies && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test: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:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-monorepo-targeting && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:init-replay && 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:platform-flow-contract && bun run test:tail-engine-shared && bun run test:prescan && bun run test:android-reporting-api && 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: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: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","test:android-reporting-api":"bun test/test-android-reporting-api.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: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"},dependencies:{"@inkjs/ui":"^2.0.0","@rrweb/types":"^2.1.1","@xterm/addon-serialize":"^0.14.0","@xterm/headless":"^6.0.0","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",zod:"^4.4.3","@standard-schema/spec":"^1.1.0"},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","@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.1",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",typescript:"6.0.3",ws:"^8.21.1"}}});import{platform as K_0,release as N_0}from"node:os";import{arch as M_0,version as L_0}from"node:process";function rw(){return bc}function ow(){let $={cli_version:zD.version,node_version:L_0,os_platform:K_0(),os_arch:M_0,os_release:N_0(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||"undefined",is_ci:MF.isCI,is_tty:Boolean(process.stdout.isTTY),invocation_source:bc};if(MF.name)$.ci_provider=MF.name;return $}var MF,bc="cli";var aw=a(()=>{a8();MF=j$(hL(),1)});import{AsyncLocalStorage as w_0}from"node:async_hooks";function fX($,D){return mc.run($,()=>Promise.resolve(D()))}function B_0(){return mc.getStore()}function dc(){return E_0}function lc($){cc=$}function gc($){try{cc?.($)}catch{}}function ic($,D){let J;try{J=new URL($).pathname}catch{J=$.split("?")[0]}let X="/functions/v1/",Q=J.indexOf(X);if(Q>=0){let G=J.slice(Q+X.length).replace(/^\/+|\/+$/g,"");return G?`${D} functions:${G}`:`${D} functions`}let Y="/rest/v1/",Z=J.indexOf(Y),F=Z>=0?J.slice(Z+Y.length):J.replace(/^\//,"");if(F.startsWith("rpc/"))return`rpc:${F.slice(4).split("/")[0]}`;let U=F.split("/")[0]||J;return`${D} ${U}`}function R_0($){let D=$?.headers;if(!D)return;let J=D.get;if(typeof J==="function")return J.call(D,"capgkey")??void 0;if(Array.isArray(D))return D.find(([X])=>X.toLowerCase()==="capgkey")?.[1];return D.capgkey}function pc(){return async(D,J)=>{let X=(J?.method??"GET").toUpperCase(),Q=typeof D==="string"?D:D instanceof URL?D.href:D.url,Y=B_0(),Z=R_0(J),F=Date.now();try{let U=await globalThis.fetch(D,J);return gc({url:Q,method:X,status:U.status,ok:U.ok,durationMs:Date.now()-F,source:Y,apikey:Z}),U}catch(U){throw gc({url:Q,method:X,status:0,ok:!1,durationMs:Date.now()-F,source:Y,apikey:Z,error:U}),U}}}var mc,E_0=!1,cc,nc=5000;var CW=a(()=>{mc=new w_0});function rc($,D){let X=["normal","bold","dim","italic","underline","strikethrough"].indexOf($),Q="\x1B[";return"\x1B["+X+"m"+D+"\x1B[0m"}var T6;var oc=a(()=>{T6=class T6{title=null;headers=[];rows=[];static narrowTheme={top:["╔","═","╤","╗"],row:["║"," ","│","║"],div:["╟","─","┼","╢"],bot:["╚","═","╧","╝"]};static wideTheme={top:["╔═","═","═╤═","═╗"],row:["║ "," "," │ "," ║"],div:["╟─","─","─┼─","─╢"],bot:["╚═","═","═╧═","═╝"]};static roundTheme={top:["╭─","─","─┬─","─╮"],row:["│ "," "," │ "," │"],div:["├─","─","─┼─","─┤"],bot:["╰─","─","─┴─","─╯"]};theme=T6.wideTheme;columnWidth(){let $=[this.headers,...this.rows].filter((J)=>J.length>0),D=$[0].map((J)=>this.cast(J).length);for(let J of $.slice(1))for(let X=0;X<D.length;X++){let Q=this.cast(J[X]).length;if(Q>D[X])D[X]=Q}return D}cast($){if(typeof $==="object")return"obj";if($!==void 0&&typeof $.toString==="function")return $.toString();else return""}renderTitle(){return"[ "+this.title+" ]"}renderLine($){let D=this.columnWidth();return $[0]+D.map((J)=>$[1].repeat(J)).join($[2])+$[3]}renderCell($,D,J=!1){let X=this.cast($),Q=J?rc("bold",X):X,Y=D-X.length,Z=this.theme.row[1];switch(typeof $){case"number":return Z.repeat(Y)+Q;case"string":return Q+Z.repeat(Y);case"boolean":case"object":return Z.repeat(Math.ceil(Y/2))+rc("italic",X)+Z.repeat(Math.floor(Y/2));default:return Z.repeat(Y)}}renderRow($,D=!1){let J=this.theme.row,X=this.columnWidth();return J[0]+$.map((Q,Y)=>this.renderCell(Q,X[Y],D)).join(J[2])+J[3]}toString(){let $=this.theme,D=this.headers.length>0,J=this.rows.length>0;return[this.title?this.renderTitle():"",D||J?this.renderLine($.top):"",D?this.renderRow(this.headers,!0):"",D&&J?this.renderLine($.div):"",...this.rows.map((X)=>this.renderRow(X)),D||J?this.renderLine($.bot):""].filter((X)=>X.length>0).join(`
112
+ GFS4: `),console.error($)};if(!T1[WD]){if(vw=global[WD]||[],Yc(T1,vw),T1.close=function($){function D(J,X){return $.call(T1,J,function(Q){if(!Q)Qc();if(typeof X==="function")X.apply(this,arguments)})}return Object.defineProperty(D,MW,{value:$}),D}(T1.close),T1.closeSync=function($){function D(J){$.apply(T1,arguments),Qc()}return Object.defineProperty(D,MW,{value:$}),D}(T1.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){EJ(T1[WD]),s("assert").equal(T1[WD].length,0)})}var vw;if(!global[WD])Yc(global,T1[WD]);uw.exports=_w(Ov0(T1));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!T1.__patched)uw.exports=_w(T1),T1.__patched=!0;function _w($){zv0($),$.gracefulify=_w,$.createReadStream=w,$.createWriteStream=R;var D=$.readFile;$.readFile=J;function J(I,_,x){if(typeof _==="function")x=_,_=null;return c(I,_,x);function c(d,D0,b,j){return D(d,D0,function(T){if(T&&(T.code==="EMFILE"||T.code==="ENFILE"))xX([c,[d,D0,b],T,j||Date.now(),Date.now()]);else if(typeof b==="function")b.apply(this,arguments)})}}var X=$.writeFile;$.writeFile=Q;function Q(I,_,x,c){if(typeof x==="function")c=x,x=null;return d(I,_,x,c);function d(D0,b,j,T,u){return X(D0,b,j,function(m){if(m&&(m.code==="EMFILE"||m.code==="ENFILE"))xX([d,[D0,b,j,T],m,u||Date.now(),Date.now()]);else if(typeof T==="function")T.apply(this,arguments)})}}var Y=$.appendFile;if(Y)$.appendFile=Z;function Z(I,_,x,c){if(typeof x==="function")c=x,x=null;return d(I,_,x,c);function d(D0,b,j,T,u){return Y(D0,b,j,function(m){if(m&&(m.code==="EMFILE"||m.code==="ENFILE"))xX([d,[D0,b,j,T],m,u||Date.now(),Date.now()]);else if(typeof T==="function")T.apply(this,arguments)})}}var F=$.copyFile;if(F)$.copyFile=U;function U(I,_,x,c){if(typeof x==="function")c=x,x=0;return d(I,_,x,c);function d(D0,b,j,T,u){return F(D0,b,j,function(m){if(m&&(m.code==="EMFILE"||m.code==="ENFILE"))xX([d,[D0,b,j,T],m,u||Date.now(),Date.now()]);else if(typeof T==="function")T.apply(this,arguments)})}}var G=$.readdir;$.readdir=W;var q=/^v[0-5]\./;function W(I,_,x){if(typeof _==="function")x=_,_=null;var c=q.test(process.version)?function(b,j,T,u){return G(b,d(b,j,T,u))}:function(b,j,T,u){return G(b,j,d(b,j,T,u))};return c(I,_,x);function d(D0,b,j,T){return function(u,m){if(u&&(u.code==="EMFILE"||u.code==="ENFILE"))xX([c,[D0,b,j],u,T||Date.now(),Date.now()]);else{if(m&&m.sort)m.sort();if(typeof j==="function")j.call(this,u,m)}}}}if(process.version.substr(0,4)==="v0.8"){var z=Hv0($);L=z.ReadStream,N=z.WriteStream}var H=$.ReadStream;if(H)L.prototype=Object.create(H.prototype),L.prototype.open=E;var O=$.WriteStream;if(O)N.prototype=Object.create(O.prototype),N.prototype.open=M;Object.defineProperty($,"ReadStream",{get:function(){return L},set:function(I){L=I},enumerable:!0,configurable:!0}),Object.defineProperty($,"WriteStream",{get:function(){return N},set:function(I){N=I},enumerable:!0,configurable:!0});var V=L;Object.defineProperty($,"FileReadStream",{get:function(){return V},set:function(I){V=I},enumerable:!0,configurable:!0});var K=N;Object.defineProperty($,"FileWriteStream",{get:function(){return K},set:function(I){K=I},enumerable:!0,configurable:!0});function L(I,_){if(this instanceof L)return H.apply(this,arguments),this;else return L.apply(Object.create(L.prototype),arguments)}function E(){var I=this;v(I.path,I.flags,I.mode,function(_,x){if(_){if(I.autoClose)I.destroy();I.emit("error",_)}else I.fd=x,I.emit("open",x),I.read()})}function N(I,_){if(this instanceof N)return O.apply(this,arguments),this;else return N.apply(Object.create(N.prototype),arguments)}function M(){var I=this;v(I.path,I.flags,I.mode,function(_,x){if(_)I.destroy(),I.emit("error",_);else I.fd=x,I.emit("open",x)})}function w(I,_){return new $.ReadStream(I,_)}function R(I,_){return new $.WriteStream(I,_)}var S=$.open;$.open=v;function v(I,_,x,c){if(typeof x==="function")c=x,x=null;return d(I,_,x,c);function d(D0,b,j,T,u){return S(D0,b,j,function(m,i){if(m&&(m.code==="EMFILE"||m.code==="ENFILE"))xX([d,[D0,b,j,T],m,u||Date.now(),Date.now()]);else if(typeof T==="function")T.apply(this,arguments)})}}return $}function xX($){EJ("ENQUEUE",$[0].name,$[1]),T1[WD].push($),kw()}var NW;function Qc(){var $=Date.now();for(var D=0;D<T1[WD].length;++D)if(T1[WD][D].length>2)T1[WD][D][3]=$,T1[WD][D][4]=$;kw()}function kw(){if(clearTimeout(NW),NW=void 0,T1[WD].length===0)return;var $=T1[WD].shift(),D=$[0],J=$[1],X=$[2],Q=$[3],Y=$[4];if(Q===void 0)EJ("RETRY",D.name,J),D.apply(null,J);else if(Date.now()-Q>=60000){EJ("TIMEOUT",D.name,J);var Z=J.pop();if(typeof Z==="function")Z.call(null,X)}else{var F=Date.now()-Y,U=Math.max(Y-Q,1),G=Math.min(U*1.2,100);if(F>=G)EJ("RETRY",D.name,J),D.apply(null,J.concat([Q]));else T1[WD].push($)}if(NW===void 0)NW=setTimeout(kw,0)}});var Fc=A((CE$,Zc)=>{function n6($,D){if(typeof D==="boolean")D={forever:D};if(this._originalTimeouts=JSON.parse(JSON.stringify($)),this._timeouts=$,this._options=D||{},this._maxRetryTime=D&&D.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}Zc.exports=n6;n6.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};n6.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};n6.prototype.retry=function($){if(this._timeout)clearTimeout(this._timeout);if(!$)return!1;var D=new Date().getTime();if($&&D-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push($);var J=this._timeouts.shift();if(J===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),J=this._timeouts.shift();else return!1;var X=this,Q=setTimeout(function(){if(X._attempts++,X._operationTimeoutCb){if(X._timeout=setTimeout(function(){X._operationTimeoutCb(X._attempts)},X._operationTimeout),X._options.unref)X._timeout.unref()}X._fn(X._attempts)},J);if(this._options.unref)Q.unref();return!0};n6.prototype.attempt=function($,D){if(this._fn=$,D){if(D.timeout)this._operationTimeout=D.timeout;if(D.cb)this._operationTimeoutCb=D.cb}var J=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){J._operationTimeoutCb()},J._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};n6.prototype.try=function($){console.log("Using RetryOperation.try() is deprecated"),this.attempt($)};n6.prototype.start=function($){console.log("Using RetryOperation.start() is deprecated"),this.attempt($)};n6.prototype.start=n6.prototype.try;n6.prototype.errors=function(){return this._errors};n6.prototype.attempts=function(){return this._attempts};n6.prototype.mainError=function(){if(this._errors.length===0)return null;var $={},D=null,J=0;for(var X=0;X<this._errors.length;X++){var Q=this._errors[X],Y=Q.message,Z=($[Y]||0)+1;if($[Y]=Z,Z>=J)D=Q,J=Z}return D}});var Gc=A((Nv0)=>{var Kv0=Fc();Nv0.operation=function($){var D=Nv0.timeouts($);return new Kv0(D,{forever:$&&$.forever,unref:$&&$.unref,maxRetryTime:$&&$.maxRetryTime})};Nv0.timeouts=function($){if($ instanceof Array)return[].concat($);var D={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var J in $)D[J]=$[J];if(D.minTimeout>D.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var X=[];for(var Q=0;Q<D.retries;Q++)X.push(this.createTimeout(Q,D));if($&&$.forever&&!X.length)X.push(this.createTimeout(Q,D));return X.sort(function(Y,Z){return Y-Z}),X};Nv0.createTimeout=function($,D){var J=D.randomize?Math.random()+1:1,X=Math.round(J*D.minTimeout*Math.pow(D.factor,$));return X=Math.min(X,D.maxTimeout),X};Nv0.wrap=function($,D,J){if(D instanceof Array)J=D,D=null;if(!J){J=[];for(var X in $)if(typeof $[X]==="function")J.push(X)}for(var Q=0;Q<J.length;Q++){var Y=J[Q],Z=$[Y];$[Y]=function(U){var G=Nv0.operation(D),q=Array.prototype.slice.call(arguments,1),W=q.pop();q.push(function(z){if(G.retry(z))return;if(z)arguments[0]=G.mainError();W.apply(this,arguments)}),G.attempt(function(){U.apply($,q)})}.bind($,Z),$[Y].options=D}}});var qc=A((SE$,LW)=>{LW.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")LW.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")LW.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var EW=A((xE$,_X)=>{var B1=global.process,RJ=function($){return $&&typeof $==="object"&&typeof $.removeListener==="function"&&typeof $.emit==="function"&&typeof $.reallyExit==="function"&&typeof $.listeners==="function"&&typeof $.kill==="function"&&typeof $.pid==="number"&&typeof $.on==="function"};if(!RJ(B1))_X.exports=function(){return function(){}};else{if(yw=s("assert"),AJ=qc(),fw=/^win/i.test(B1.platform),vX=s("events"),typeof vX!=="function")vX=vX.EventEmitter;if(B1.__signal_exit_emitter__)a1=B1.__signal_exit_emitter__;else a1=B1.__signal_exit_emitter__=new vX,a1.count=0,a1.emitted={};if(!a1.infinite)a1.setMaxListeners(1/0),a1.infinite=!0;_X.exports=function($,D){if(!RJ(global.process))return function(){};if(yw.equal(typeof $,"function","a callback must be provided for exit handler"),IJ===!1)wW();var J="exit";if(D&&D.alwaysLast)J="afterexit";var X=function(){if(a1.removeListener(J,$),a1.listeners("exit").length===0&&a1.listeners("afterexit").length===0)zF()};return a1.on(J,$),X},zF=function(){if(!IJ||!RJ(global.process))return;IJ=!1,AJ.forEach(function(D){try{B1.removeListener(D,HF[D])}catch(J){}}),B1.emit=OF,B1.reallyExit=BW,a1.count-=1},_X.exports.unload=zF,c9=function(D,J,X){if(a1.emitted[D])return;a1.emitted[D]=!0,a1.emit(D,J,X)},HF={},AJ.forEach(function($){HF[$]=function(){if(!RJ(global.process))return;var J=B1.listeners($);if(J.length===a1.count){if(zF(),c9("exit",null,$),c9("afterexit",null,$),fw&&$==="SIGHUP")$="SIGINT";B1.kill(B1.pid,$)}}}),_X.exports.signals=function(){return AJ},IJ=!1,wW=function(){if(IJ||!RJ(global.process))return;IJ=!0,a1.count+=1,AJ=AJ.filter(function(D){try{return B1.on(D,HF[D]),!0}catch(J){return!1}}),B1.emit=bw,B1.reallyExit=hw},_X.exports.load=wW,BW=B1.reallyExit,hw=function(D){if(!RJ(global.process))return;B1.exitCode=D||0,c9("exit",B1.exitCode,null),c9("afterexit",B1.exitCode,null),BW.call(B1,B1.exitCode)},OF=B1.emit,bw=function(D,J){if(D==="exit"&&RJ(global.process)){if(J!==void 0)B1.exitCode=J;var X=OF.apply(this,arguments);return c9("exit",B1.exitCode,null),c9("afterexit",B1.exitCode,null),X}else return OF.apply(this,arguments)}}var yw,AJ,fw,vX,a1,zF,c9,HF,IJ,wW,BW,hw,OF,bw});var zc=A((Rv0,gw)=>{var Wc=Symbol();function Bv0($,D,J){let X=D[Wc];if(X)return D.stat($,(Y,Z)=>{if(Y)return J(Y);J(null,Z.mtime,X)});let Q=new Date(Math.ceil(Date.now()/1000)*1000+5);D.utimes($,Q,Q,(Y)=>{if(Y)return J(Y);D.stat($,(Z,F)=>{if(Z)return J(Z);let U=F.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty(D,Wc,{value:U}),J(null,F.mtime,U)})})}function Ev0($){let D=Date.now();if($==="s")D=Math.ceil(D/1000)*1000;return new Date(D)}Rv0.probe=Bv0;Rv0.getMtime=Ev0});var Nc=A((vv0,KF)=>{var jv0=s("path"),cw=y1(),Tv0=Gc(),Cv0=EW(),Hc=zc(),o8={};function VF($,D){return D.lockfilePath||`${$}.lock`}function lw($,D,J){if(!D.realpath)return J(null,jv0.resolve($));D.fs.realpath($,J)}function dw($,D,J){let X=VF($,D);D.fs.mkdir(X,(Q)=>{if(!Q)return Hc.probe(X,D.fs,(Y,Z,F)=>{if(Y)return D.fs.rmdir(X,()=>{}),J(Y);J(null,Z,F)});if(Q.code!=="EEXIST")return J(Q);if(D.stale<=0)return J(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:$}));D.fs.stat(X,(Y,Z)=>{if(Y){if(Y.code==="ENOENT")return dw($,{...D,stale:0},J);return J(Y)}if(!Oc(Z,D))return J(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:$}));Vc($,D,(F)=>{if(F)return J(F);dw($,{...D,stale:0},J)})})})}function Oc($,D){return $.mtime.getTime()<Date.now()-D.stale}function Vc($,D,J){D.fs.rmdir(VF($,D),(X)=>{if(X&&X.code!=="ENOENT")return J(X);J()})}function RW($,D){let J=o8[$];if(J.updateTimeout)return;if(J.updateDelay=J.updateDelay||D.update,J.updateTimeout=setTimeout(()=>{J.updateTimeout=null,D.fs.stat(J.lockfilePath,(X,Q)=>{let Y=J.lastUpdate+D.stale<Date.now();if(X){if(X.code==="ENOENT"||Y)return mw($,J,Object.assign(X,{code:"ECOMPROMISED"}));return J.updateDelay=1000,RW($,D)}if(J.mtime.getTime()!==Q.mtime.getTime())return mw($,J,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let F=Hc.getMtime(J.mtimePrecision);D.fs.utimes(J.lockfilePath,F,F,(U)=>{let G=J.lastUpdate+D.stale<Date.now();if(J.released)return;if(U){if(U.code==="ENOENT"||G)return mw($,J,Object.assign(U,{code:"ECOMPROMISED"}));return J.updateDelay=1000,RW($,D)}J.mtime=F,J.lastUpdate=Date.now(),J.updateDelay=null,RW($,D)})})},J.updateDelay),J.updateTimeout.unref)J.updateTimeout.unref()}function mw($,D,J){if(D.released=!0,D.updateTimeout)clearTimeout(D.updateTimeout);if(o8[$]===D)delete o8[$];D.options.onCompromised(J)}function Pv0($,D,J){D={stale:1e4,update:null,realpath:!0,retries:0,fs:cw,onCompromised:(X)=>{throw X},...D},D.retries=D.retries||0,D.retries=typeof D.retries==="number"?{retries:D.retries}:D.retries,D.stale=Math.max(D.stale||0,2000),D.update=D.update==null?D.stale/2:D.update||0,D.update=Math.max(Math.min(D.update,D.stale/2),1000),lw($,D,(X,Q)=>{if(X)return J(X);let Y=Tv0.operation(D.retries);Y.attempt(()=>{dw(Q,D,(Z,F,U)=>{if(Y.retry(Z))return;if(Z)return J(Y.mainError());let G=o8[Q]={lockfilePath:VF(Q,D),mtime:F,mtimePrecision:U,options:D,lastUpdate:Date.now()};RW(Q,D),J(null,(q)=>{if(G.released)return q&&q(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));Kc(Q,{...D,realpath:!1},q)})})})})}function Kc($,D,J){D={fs:cw,realpath:!0,...D},lw($,D,(X,Q)=>{if(X)return J(X);let Y=o8[Q];if(!Y)return J(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));Y.updateTimeout&&clearTimeout(Y.updateTimeout),Y.released=!0,delete o8[Q],Vc(Q,D,J)})}function Sv0($,D,J){D={stale:1e4,realpath:!0,fs:cw,...D},D.stale=Math.max(D.stale||0,2000),lw($,D,(X,Q)=>{if(X)return J(X);D.fs.stat(VF(Q,D),(Y,Z)=>{if(Y)return Y.code==="ENOENT"?J(null,!1):J(Y);return J(null,!Oc(Z,D))})})}function xv0(){return o8}Cv0(()=>{for(let $ in o8){let D=o8[$].options;try{D.fs.rmdirSync(VF($,D))}catch(J){}}});vv0.lock=Pv0;vv0.unlock=Kc;vv0.check=Sv0;vv0.getLocks=xv0});var Lc=A((vE$,Mc)=>{var fv0=y1();function hv0($){let D=["mkdir","realpath","stat","rmdir","utimes"],J={...$};return D.forEach((X)=>{J[X]=(...Q)=>{let Y=Q.pop(),Z;try{Z=$[`${X}Sync`](...Q)}catch(F){return Y(F)}Y(null,Z)}}),J}function bv0($){return(...D)=>new Promise((J,X)=>{D.push((Q,Y)=>{if(Q)X(Q);else J(Y)}),$(...D)})}function gv0($){return(...D)=>{let J,X;if(D.push((Q,Y)=>{J=Q,X=Y}),$(...D),J)throw J;return X}}function mv0($){if($={...$},$.fs=hv0($.fs||fv0),typeof $.retries==="number"&&$.retries>0||$.retries&&typeof $.retries.retries==="number"&&$.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return $}Mc.exports={toPromise:bv0,toSync:gv0,toSyncOptions:mv0}});var Bc=A((_E$,l9)=>{var kX=Nc(),{toPromise:AW,toSync:IW,toSyncOptions:nw}=Lc();async function wc($,D){let J=await AW(kX.lock)($,D);return AW(J)}function dv0($,D){let J=IW(kX.lock)($,nw(D));return IW(J)}function cv0($,D){return AW(kX.unlock)($,D)}function lv0($,D){return IW(kX.unlock)($,nw(D))}function nv0($,D){return AW(kX.check)($,D)}function iv0($,D){return IW(kX.check)($,nw(D))}l9.exports=wc;l9.exports.lock=wc;l9.exports.unlock=cv0;l9.exports.lockSync=dv0;l9.exports.unlockSync=lv0;l9.exports.check=nv0;l9.exports.checkSync=iv0});var Cc=A((jc)=>{Object.defineProperty(jc,"__esModule",{value:!0});jc.canStoreURLs=jc.FileUrlStorage=void 0;var Ec=s("fs"),pv0=ov0(ad()),Rc=rv0(Bc());function Ic($){if(typeof WeakMap!="function")return null;var D=new WeakMap,J=new WeakMap;return(Ic=function(X){return X?J:D})($)}function rv0($,D){if(!D&&$&&$.__esModule)return $;if($===null||typeof $!="object"&&typeof $!="function")return{default:$};var J=Ic(D);if(J&&J.has($))return J.get($);var X={__proto__:null},Q=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Y in $)if(Y!=="default"&&{}.hasOwnProperty.call($,Y)){var Z=Q?Object.getOwnPropertyDescriptor($,Y):null;Z&&(Z.get||Z.set)?Object.defineProperty(X,Y,Z):X[Y]=$[Y]}return X.default=$,J&&J.set($,X),X}function ov0($){return $&&$.__esModule?$:{default:$}}function NF($){return NF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D},NF($)}function av0($,D){if(!($ instanceof D))throw TypeError("Cannot call a class as a function")}function Ac($,D){for(var J=0;J<D.length;J++){var X=D[J];if(X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X)X.writable=!0;Object.defineProperty($,sv0(X.key),X)}}function tv0($,D,J){if(D)Ac($.prototype,D);if(J)Ac($,J);return Object.defineProperty($,"prototype",{writable:!1}),$}function sv0($){var D=ev0($,"string");return NF(D)=="symbol"?D:D+""}function ev0($,D){if(NF($)!="object"||!$)return $;var J=$[Symbol.toPrimitive];if(J!==void 0){var X=J.call($,D||"default");if(NF(X)!="object")return X;throw TypeError("@@toPrimitive must return a primitive value.")}return(D==="string"?String:Number)($)}var kE$=jc.canStoreURLs=!0,uE$=jc.FileUrlStorage=function(){function $(D){av0(this,$),this.path=D}return tv0($,[{key:"findAllUploads",value:function(){var J=this;return new Promise(function(X,Q){J._getItems("tus::",function(Y,Z){if(Y)Q(Y);else X(Z)})})}},{key:"findUploadsByFingerprint",value:function(J){var X=this;return new Promise(function(Q,Y){X._getItems("tus::".concat(J),function(Z,F){if(Z)Y(Z);else Q(F)})})}},{key:"removeUpload",value:function(J){var X=this;return new Promise(function(Q,Y){X._removeItem(J,function(Z){if(Z)Y(Z);else Q()})})}},{key:"addUpload",value:function(J,X){var Q=this,Y=Math.round(Math.random()*1000000000000),Z="tus::".concat(J,"::").concat(Y);return new Promise(function(F,U){Q._setItem(Z,X,function(G){if(G)U(G);else F(Z)})})}},{key:"_setItem",value:function(J,X,Q){var Y=this;Rc.lock(this.path,this._lockfileOptions()).then(function(Z){Q=Y._releaseAndCb(Z,Q),Y._getData(function(F,U){if(F){Q(F);return}U[J]=X,Y._writeData(U,function(G){return Q(G)})})}).catch(Q)}},{key:"_getItems",value:function(J,X){this._getData(function(Q,Y){if(Q){X(Q);return}var Z=Object.keys(Y).filter(function(F){return F.startsWith(J)}).map(function(F){var U=Y[F];return U.urlStorageKey=F,U});X(null,Z)})}},{key:"_removeItem",value:function(J,X){var Q=this;Rc.lock(this.path,this._lockfileOptions()).then(function(Y){X=Q._releaseAndCb(Y,X),Q._getData(function(Z,F){if(Z){X(Z);return}delete F[J],Q._writeData(F,function(U){return X(U)})})}).catch(X)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(J,X){return function(Q){if(Q){J().then(function(){return X(Q)}).catch(function(Y){return X((0,pv0.default)([Q,Y]))});return}J().then(X).catch(X)}}},{key:"_writeData",value:function(J,X){var Q={encoding:"utf8",mode:432,flag:"w"};(0,Ec.writeFile)(this.path,JSON.stringify(J),Q,function(Y){return X(Y)})}},{key:"_getData",value:function(J){(0,Ec.readFile)(this.path,"utf8",function(X,Q){if(X){if(X.code==="ENOENT")J(null,{});else J(X);return}try{Q=!Q.trim().length?{}:JSON.parse(Q)}catch(Y){J(Y);return}J(null,Q)})}}])}()});var TW=A((n9)=>{Object.defineProperty(n9,"__esModule",{value:!0});Object.defineProperty(n9,"DefaultHttpStack",{enumerable:!0,get:function(){return vc.default}});Object.defineProperty(n9,"DetailedError",{enumerable:!0,get:function(){return D_0.default}});Object.defineProperty(n9,"FileUrlStorage",{enumerable:!0,get:function(){return _c.FileUrlStorage}});Object.defineProperty(n9,"StreamSource",{enumerable:!0,get:function(){return Z_0.default}});n9.Upload=void 0;Object.defineProperty(n9,"canStoreURLs",{enumerable:!0,get:function(){return _c.canStoreURLs}});n9.defaultOptions=void 0;Object.defineProperty(n9,"enableDebugLog",{enumerable:!0,get:function(){return J_0.enableDebugLog}});n9.isSupported=void 0;var D_0=jJ(nL()),J_0=iL(),X_0=jJ(Bg()),iw=jJ($m()),Q_0=jJ(wm()),Y_0=jJ(Im()),vc=jJ(mm()),Z_0=jJ(Xw()),_c=Cc();function jJ($){return $&&$.__esModule?$:{default:$}}function yX($){return yX=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D},yX($)}function F_0($,D){if(!($ instanceof D))throw TypeError("Cannot call a class as a function")}function Pc($,D){for(var J=0;J<D.length;J++){var X=D[J];if(X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X)X.writable=!0;Object.defineProperty($,uc(X.key),X)}}function U_0($,D,J){if(D)Pc($.prototype,D);if(J)Pc($,J);return Object.defineProperty($,"prototype",{writable:!1}),$}function G_0($,D,J){return D=jW(D),q_0($,kc()?Reflect.construct(D,J||[],jW($).constructor):D.apply($,J))}function q_0($,D){if(D&&(yX(D)==="object"||typeof D==="function"))return D;else if(D!==void 0)throw TypeError("Derived constructors may only return object or undefined");return W_0($)}function W_0($){if($===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return $}function kc(){try{var $=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(D){}return(kc=function(){return!!$})()}function jW($){return jW=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(J){return J.__proto__||Object.getPrototypeOf(J)},jW($)}function z_0($,D){if(typeof D!=="function"&&D!==null)throw TypeError("Super expression must either be null or a function");if($.prototype=Object.create(D&&D.prototype,{constructor:{value:$,writable:!0,configurable:!0}}),Object.defineProperty($,"prototype",{writable:!1}),D)pw($,D)}function pw($,D){return pw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(X,Q){return X.__proto__=Q,X},pw($,D)}function Sc($,D){var J=Object.keys($);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols($);D&&(X=X.filter(function(Q){return Object.getOwnPropertyDescriptor($,Q).enumerable})),J.push.apply(J,X)}return J}function uX($){for(var D=1;D<arguments.length;D++){var J=arguments[D]!=null?arguments[D]:{};D%2?Sc(Object(J),!0).forEach(function(X){H_0($,X,J[X])}):Object.getOwnPropertyDescriptors?Object.defineProperties($,Object.getOwnPropertyDescriptors(J)):Sc(Object(J)).forEach(function(X){Object.defineProperty($,X,Object.getOwnPropertyDescriptor(J,X))})}return $}function H_0($,D,J){if(D=uc(D),D in $)Object.defineProperty($,D,{value:J,enumerable:!0,configurable:!0,writable:!0});else $[D]=J;return $}function uc($){var D=O_0($,"string");return yX(D)=="symbol"?D:D+""}function O_0($,D){if(yX($)!="object"||!$)return $;var J=$[Symbol.toPrimitive];if(J!==void 0){var X=J.call($,D||"default");if(yX(X)!="object")return X;throw TypeError("@@toPrimitive must return a primitive value.")}return(D==="string"?String:Number)($)}var xc=n9.defaultOptions=uX(uX({},iw.default.defaultOptions),{},{httpStack:new vc.default,fileReader:new Q_0.default,urlStorage:new X_0.default,fingerprint:Y_0.default}),fE$=n9.Upload=function($){function D(){var J=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return F_0(this,D),X=uX(uX({},xc),X),G_0(this,D,[J,X])}return z_0(D,$),U_0(D,null,[{key:"terminate",value:function(X){var Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Q=uX(uX({},xc),Q),iw.default.terminate(X,Q)}}])}(iw.default),hE$=n9.isSupported=!0});var zD;var a8=a(()=>{zD={name:"@capgo/cli",type:"module",version:"8.32.1",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/capgo.git",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test: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","test:credentials":"bun test/test-credentials.mjs","test:asc-key-protocol":"bun test/test-asc-key-protocol.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test: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:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:init-replay":"bun test/test-init-replay.mjs","test:capacitor-config-target":"bun test/test-capacitor-config-target.mjs","test:init-monorepo-targeting":"bun run test:capacitor-config-target && 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:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun run test:helper-dce && bun run test:version-detection:setup && bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:fail-on-incompatible && bun run test:native-dependencies && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test: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:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-monorepo-targeting && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:init-replay && 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:platform-flow-contract && bun run test:tail-engine-shared && bun run test:prescan && bun run test:android-reporting-api && 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: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: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","test:android-reporting-api":"bun test/test-android-reporting-api.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: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"},dependencies:{"@inkjs/ui":"^2.0.0","@rrweb/types":"^2.1.1","@xterm/addon-serialize":"^0.14.0","@xterm/headless":"^6.0.0","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",zod:"^4.4.3","@standard-schema/spec":"^1.1.0"},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","@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.1",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",typescript:"6.0.3",ws:"^8.21.1"}}});import{platform as K_0,release as N_0}from"node:os";import{arch as M_0,version as L_0}from"node:process";function rw(){return bc}function ow(){let $={cli_version:zD.version,node_version:L_0,os_platform:K_0(),os_arch:M_0,os_release:N_0(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||"undefined",is_ci:MF.isCI,is_tty:Boolean(process.stdout.isTTY),invocation_source:bc};if(MF.name)$.ci_provider=MF.name;return $}var MF,bc="cli";var aw=a(()=>{a8();MF=j$(hL(),1)});import{AsyncLocalStorage as w_0}from"node:async_hooks";function fX($,D){return mc.run($,()=>Promise.resolve(D()))}function B_0(){return mc.getStore()}function dc(){return E_0}function lc($){cc=$}function gc($){try{cc?.($)}catch{}}function ic($,D){let J;try{J=new URL($).pathname}catch{J=$.split("?")[0]}let X="/functions/v1/",Q=J.indexOf(X);if(Q>=0){let G=J.slice(Q+X.length).replace(/^\/+|\/+$/g,"");return G?`${D} functions:${G}`:`${D} functions`}let Y="/rest/v1/",Z=J.indexOf(Y),F=Z>=0?J.slice(Z+Y.length):J.replace(/^\//,"");if(F.startsWith("rpc/"))return`rpc:${F.slice(4).split("/")[0]}`;let U=F.split("/")[0]||J;return`${D} ${U}`}function R_0($){let D=$?.headers;if(!D)return;let J=D.get;if(typeof J==="function")return J.call(D,"capgkey")??void 0;if(Array.isArray(D))return D.find(([X])=>X.toLowerCase()==="capgkey")?.[1];return D.capgkey}function pc(){return async(D,J)=>{let X=(J?.method??"GET").toUpperCase(),Q=typeof D==="string"?D:D instanceof URL?D.href:D.url,Y=B_0(),Z=R_0(J),F=Date.now();try{let U=await globalThis.fetch(D,J);return gc({url:Q,method:X,status:U.status,ok:U.ok,durationMs:Date.now()-F,source:Y,apikey:Z}),U}catch(U){throw gc({url:Q,method:X,status:0,ok:!1,durationMs:Date.now()-F,source:Y,apikey:Z,error:U}),U}}}var mc,E_0=!1,cc,nc=5000;var CW=a(()=>{mc=new w_0});function rc($,D){let X=["normal","bold","dim","italic","underline","strikethrough"].indexOf($),Q="\x1B[";return"\x1B["+X+"m"+D+"\x1B[0m"}var T6;var oc=a(()=>{T6=class T6{title=null;headers=[];rows=[];static narrowTheme={top:["╔","═","╤","╗"],row:["║"," ","│","║"],div:["╟","─","┼","╢"],bot:["╚","═","╧","╝"]};static wideTheme={top:["╔═","═","═╤═","═╗"],row:["║ "," "," │ "," ║"],div:["╟─","─","─┼─","─╢"],bot:["╚═","═","═╧═","═╝"]};static roundTheme={top:["╭─","─","─┬─","─╮"],row:["│ "," "," │ "," │"],div:["├─","─","─┼─","─┤"],bot:["╰─","─","─┴─","─╯"]};theme=T6.wideTheme;columnWidth(){let $=[this.headers,...this.rows].filter((J)=>J.length>0),D=$[0].map((J)=>this.cast(J).length);for(let J of $.slice(1))for(let X=0;X<D.length;X++){let Q=this.cast(J[X]).length;if(Q>D[X])D[X]=Q}return D}cast($){if(typeof $==="object")return"obj";if($!==void 0&&typeof $.toString==="function")return $.toString();else return""}renderTitle(){return"[ "+this.title+" ]"}renderLine($){let D=this.columnWidth();return $[0]+D.map((J)=>$[1].repeat(J)).join($[2])+$[3]}renderCell($,D,J=!1){let X=this.cast($),Q=J?rc("bold",X):X,Y=D-X.length,Z=this.theme.row[1];switch(typeof $){case"number":return Z.repeat(Y)+Q;case"string":return Q+Z.repeat(Y);case"boolean":case"object":return Z.repeat(Math.ceil(Y/2))+rc("italic",X)+Z.repeat(Math.floor(Y/2));default:return Z.repeat(Y)}}renderRow($,D=!1){let J=this.theme.row,X=this.columnWidth();return J[0]+$.map((Q,Y)=>this.renderCell(Q,X[Y],D)).join(J[2])+J[3]}toString(){let $=this.theme,D=this.headers.length>0,J=this.rows.length>0;return[this.title?this.renderTitle():"",D||J?this.renderLine($.top):"",D?this.renderRow(this.headers,!0):"",D&&J?this.renderLine($.div):"",...this.rows.map((X)=>this.renderRow(X)),D||J?this.renderLine($.bot):""].filter((X)=>X.length>0).join(`
113
113
  `)}}});var hX=a(()=>{oc()});async function PW($){try{let J=`https://registry.npmjs.org/${encodeURIComponent($.toLowerCase())}`,X=await fetch(J,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});if(!X.ok)return null;return(await X.json())["dist-tags"]?.latest||null}catch{return null}}async function A_0(){let $=await PW("@capgo/cli")??"",D=$?.split(".")[0]??"";return{currentVersion:zD.version,latestVersion:$,isOutdated:!!$&&$!==zD.version,majorVersion:D}}async function Z1(){let{isOutdated:$,currentVersion:D,latestVersion:J,majorVersion:X}=await A_0();if($)B.warning(`\uD83D\uDEA8 You are using @capgo/cli@${D} it's not the latest version.
114
114
  Please use @capgo/cli@${J}" or @capgo/cli@${X} to keep up to date with the latest features and bug fixes.`)}var bD=a(()=>{F$();a8()});async function ac($,D,J,X,Q,Y="✅",Z){await n0(J,{channel:$,event:X,icon:Y,org_id:D,tracking_version:2,...Q||Z?{tags:{...Q?{"app-id":Q}:{},...Z}}:{},notify:!1})}var tc=a(()=>{F$();hX();bD();D$()});var tw=A((ZR$,sc)=>{var bX=1000,gX=bX*60,mX=gX*60,TJ=mX*24,I_0=TJ*7,j_0=TJ*365.25;sc.exports=function($,D){D=D||{};var J=typeof $;if(J==="string"&&$.length>0)return T_0($);else if(J==="number"&&isFinite($))return D.long?P_0($):C_0($);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify($))};function T_0($){if($=String($),$.length>100)return;var D=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec($);if(!D)return;var J=parseFloat(D[1]),X=(D[2]||"ms").toLowerCase();switch(X){case"years":case"year":case"yrs":case"yr":case"y":return J*j_0;case"weeks":case"week":case"w":return J*I_0;case"days":case"day":case"d":return J*TJ;case"hours":case"hour":case"hrs":case"hr":case"h":return J*mX;case"minutes":case"minute":case"mins":case"min":case"m":return J*gX;case"seconds":case"second":case"secs":case"sec":case"s":return J*bX;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return J;default:return}}function C_0($){var D=Math.abs($);if(D>=TJ)return Math.round($/TJ)+"d";if(D>=mX)return Math.round($/mX)+"h";if(D>=gX)return Math.round($/gX)+"m";if(D>=bX)return Math.round($/bX)+"s";return $+"ms"}function P_0($){var D=Math.abs($);if(D>=TJ)return SW($,D,TJ,"day");if(D>=mX)return SW($,D,mX,"hour");if(D>=gX)return SW($,D,gX,"minute");if(D>=bX)return SW($,D,bX,"second");return $+" ms"}function SW($,D,J,X){var Q=D>=J*1.5;return Math.round($/J)+" "+X+(Q?"s":"")}});var sw=A((FR$,ec)=>{function S_0($){J.debug=J,J.default=J,J.coerce=U,J.disable=Z,J.enable=Q,J.enabled=F,J.humanize=tw(),J.destroy=G,Object.keys($).forEach((q)=>{J[q]=$[q]}),J.names=[],J.skips=[],J.formatters={};function D(q){let W=0;for(let z=0;z<q.length;z++)W=(W<<5)-W+q.charCodeAt(z),W|=0;return J.colors[Math.abs(W)%J.colors.length]}J.selectColor=D;function J(q){let W,z=null,H,O;function V(...K){if(!V.enabled)return;let L=V,E=Number(new Date),N=E-(W||E);if(L.diff=N,L.prev=W,L.curr=E,W=E,K[0]=J.coerce(K[0]),typeof K[0]!=="string")K.unshift("%O");let M=0;K[0]=K[0].replace(/%([a-zA-Z%])/g,(R,S)=>{if(R==="%%")return"%";M++;let v=J.formatters[S];if(typeof v==="function"){let I=K[M];R=v.call(L,I),K.splice(M,1),M--}return R}),J.formatArgs.call(L,K),(L.log||J.log).apply(L,K)}if(V.namespace=q,V.useColors=J.useColors(),V.color=J.selectColor(q),V.extend=X,V.destroy=J.destroy,Object.defineProperty(V,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(z!==null)return z;if(H!==J.namespaces)H=J.namespaces,O=J.enabled(q);return O},set:(K)=>{z=K}}),typeof J.init==="function")J.init(V);return V}function X(q,W){let z=J(this.namespace+(typeof W>"u"?":":W)+q);return z.log=this.log,z}function Q(q){J.save(q),J.namespaces=q,J.names=[],J.skips=[];let W=(typeof q==="string"?q:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let z of W)if(z[0]==="-")J.skips.push(z.slice(1));else J.names.push(z)}function Y(q,W){let z=0,H=0,O=-1,V=0;while(z<q.length)if(H<W.length&&(W[H]===q[z]||W[H]==="*"))if(W[H]==="*")O=H,V=z,H++;else z++,H++;else if(O!==-1)H=O+1,V++,z=V;else return!1;while(H<W.length&&W[H]==="*")H++;return H===W.length}function Z(){let q=[...J.names,...J.skips.map((W)=>"-"+W)].join(",");return J.enable(""),q}function F(q){for(let W of J.skips)if(Y(q,W))return!1;for(let W of J.names)if(Y(q,W))return!0;return!1}function U(q){if(q instanceof Error)return q.stack||q.message;return q}function G(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return J.enable(J.load()),J}ec.exports=S_0});var Dl=A(($l,xW)=>{$l.formatArgs=v_0;$l.save=__0;$l.load=k_0;$l.useColors=x_0;$l.storage=u_0();$l.destroy=(()=>{let $=!1;return()=>{if(!$)$=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();$l.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function x_0(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let $;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&($=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt($[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function v_0($){if($[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+$[0]+(this.useColors?"%c ":" ")+"+"+xW.exports.humanize(this.diff),!this.useColors)return;let D="color: "+this.color;$.splice(1,0,D,"color: inherit");let J=0,X=0;$[0].replace(/%[a-zA-Z%]/g,(Q)=>{if(Q==="%%")return;if(J++,Q==="%c")X=J}),$.splice(X,0,D)}$l.log=console.debug||console.log||(()=>{});function __0($){try{if($)$l.storage.setItem("debug",$);else $l.storage.removeItem("debug")}catch(D){}}function k_0(){let $;try{$=$l.storage.getItem("debug")||$l.storage.getItem("DEBUG")}catch(D){}if(!$&&typeof process<"u"&&"env"in process)$=process.env.DEBUG;return $}function u_0(){try{return localStorage}catch($){}}xW.exports=sw()($l);var{formatters:y_0}=xW.exports;y_0.j=function($){try{return JSON.stringify($)}catch(D){return"[UnexpectedJSONParseError]: "+D.message}}});var Xl=A((GR$,Jl)=>{Jl.exports=($,D=process.argv)=>{let J=$.startsWith("-")?"":$.length===1?"-":"--",X=D.indexOf(J+$),Q=D.indexOf("--");return X!==-1&&(Q===-1||X<Q)}});var Zl=A((qR$,Yl)=>{var l_0=s("os"),Ql=s("tty"),i6=Xl(),{env:DD}=process,i9;if(i6("no-color")||i6("no-colors")||i6("color=false")||i6("color=never"))i9=0;else if(i6("color")||i6("colors")||i6("color=true")||i6("color=always"))i9=1;if("FORCE_COLOR"in DD)if(DD.FORCE_COLOR==="true")i9=1;else if(DD.FORCE_COLOR==="false")i9=0;else i9=DD.FORCE_COLOR.length===0?1:Math.min(parseInt(DD.FORCE_COLOR,10),3);function ew($){if($===0)return!1;return{level:$,hasBasic:!0,has256:$>=2,has16m:$>=3}}function $B($,D){if(i9===0)return 0;if(i6("color=16m")||i6("color=full")||i6("color=truecolor"))return 3;if(i6("color=256"))return 2;if($&&!D&&i9===void 0)return 0;let J=i9||0;if(DD.TERM==="dumb")return J;if(process.platform==="win32"){let X=l_0.release().split(".");if(Number(X[0])>=10&&Number(X[2])>=10586)return Number(X[2])>=14931?3:2;return 1}if("CI"in DD){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((X)=>(X in DD))||DD.CI_NAME==="codeship")return 1;return J}if("TEAMCITY_VERSION"in DD)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(DD.TEAMCITY_VERSION)?1:0;if(DD.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in DD){let X=parseInt((DD.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(DD.TERM_PROGRAM){case"iTerm.app":return X>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(DD.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(DD.TERM))return 1;if("COLORTERM"in DD)return 1;return J}function n_0($){let D=$B($,$&&$.isTTY);return ew(D)}Yl.exports={supportsColor:n_0,stdout:ew($B(!0,Ql.isatty(1))),stderr:ew($B(!0,Ql.isatty(2)))}});var ql=A((Ul,_W)=>{var i_0=s("tty"),vW=s("util");Ul.init=e_0;Ul.log=a_0;Ul.formatArgs=r_0;Ul.save=t_0;Ul.load=s_0;Ul.useColors=p_0;Ul.destroy=vW.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Ul.colors=[6,2,3,4,5,1];try{let $=Zl();if($&&($.stderr||$).level>=2)Ul.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch($){}Ul.inspectOpts=Object.keys(process.env).filter(($)=>{return/^debug_/i.test($)}).reduce(($,D)=>{let J=D.substring(6).toLowerCase().replace(/_([a-z])/g,(Q,Y)=>{return Y.toUpperCase()}),X=process.env[D];if(/^(yes|on|true|enabled)$/i.test(X))X=!0;else if(/^(no|off|false|disabled)$/i.test(X))X=!1;else if(X==="null")X=null;else X=Number(X);return $[J]=X,$},{});function p_0(){return"colors"in Ul.inspectOpts?Boolean(Ul.inspectOpts.colors):i_0.isatty(process.stderr.fd)}function r_0($){let{namespace:D,useColors:J}=this;if(J){let X=this.color,Q="\x1B[3"+(X<8?X:"8;5;"+X),Y=` ${Q};1m${D} \x1B[0m`;$[0]=Y+$[0].split(`
115
115
  `).join(`
@@ -457,8 +457,8 @@ Private-MAC: `+E.digest().toHex()+`\r
457
457
  - The key has "Admin" or "Developer" access`;var hO0=a(()=>{_O0();OY();kO0=j$(F_(),1);G_=class G_ extends Error{status;code;constructor($,D,J){super(D);this.name="AppleApiHttpError",this.status=$,this.code=J}};Lz$=`Apple is blocking App Store Connect API access because your developer account has a required agreement that is unsigned or has expired.
458
458
  - Sign in as the Account Holder at https://appstoreconnect.apple.com
459
459
  - Open "Business" (Agreements, Tax, and Banking) and accept the pending or updated agreement
460
- `+" - Then run this step again — your API key is valid, so no key changes are needed"});function q_($,D){if(typeof $!=="string")return;let J=zY($);for(let X of D)if(X)J=J.replaceAll(X,"[REDACTED IDENTIFIER]");return J=J.replace(/\p{Cc}+/gu," ").replace(/\s+/g," ").trim(),J?J.slice(0,Az$):void 0}async function bO0($){let D=$.fetchImpl??globalThis.fetch.bind(globalThis),J=$.timeoutMs??Ez$;if($.signal?.aborted)return{ok:!1,kind:"network",message:"App Store Connect check cancelled."};let X;try{X=uO0($.keyId,$.issuerId,$.p8Pem)}catch{return{ok:!1,kind:"auth-error",message:"Could not sign the App Store Connect request - the .p8 key, Key ID, or Issuer ID is invalid."}}let Q=new AbortController,Y=setTimeout(()=>Q.abort(),J),Z=()=>Q.abort();$.signal?.addEventListener("abort",Z,{once:!0});let U=`/apps${$.bundleId?`?filter[bundleId]=${encodeURIComponent($.bundleId)}&limit=1`:"?limit=1"}`;try{let G=await D(`${Bz$}${U}`,{signal:Q.signal,headers:{Authorization:`Bearer ${X}`,"Content-Type":"application/json"}}),q=await G.json().catch(()=>null);if(!G.ok){let W=(q?.errors??[])[0];u6(`apple-access GET ${U}: HTTP ${G.status} ${G.statusText} ${JSON.stringify(q?.errors??null)} | ${oV(G.headers)}`);let z=new G_(G.status,W?`Apple API error (${G.status}): ${W.title} - ${W.detail} (${W.code})`:`Apple API error: HTTP ${G.status} ${G.statusText}`,W?.code),H=yO0(z),O=[$.keyId,$.issuerId],V={status:G.status,code:q_(W?.code,O),title:q_(W?.title,O),detail:q_(W?.detail,O)};if(H.is401or403)return{ok:!1,kind:"auth-error",message:H.message,...V};return{ok:!1,kind:"network",message:`App Store Connect returned HTTP ${G.status}.`,...V}}if(u6(`apple-access GET ${U}: HTTP ${G.status} | ${oV(G.headers)}`),$.bundleId){if(!fO0(q).some((H)=>H.bundleId===$.bundleId))return{ok:!1,kind:"no-app-access",message:`The App Store Connect API key cannot see an app with bundle id ${$.bundleId}.`}}return{ok:!0}}catch(G){let q=G instanceof Error?G.message:String(G);if(G?.name==="AbortError"||Q.signal.aborted||Rz$.test(q))return{ok:!1,kind:"network",message:"Could not reach App Store Connect (network error or timeout)."};return{ok:!1,kind:"network",message:"App Store Connect check failed unexpectedly."}}finally{clearTimeout(Y),$.signal?.removeEventListener("abort",Z)}}var Bz$="https://api.appstoreconnect.apple.com/v1",Ez$=7000,Rz$,Az$=500;var gO0=a(()=>{OY();nV();hO0();Rz$=/timeout|timed out|network|fetch failed|aborted|ENOTFOUND|EAI_AGAIN|ECONNRESET|ECONNREFUSED/i});import{Buffer as Iz$}from"node:buffer";function nO0($){return[[$.code?`[${$.code}]`:"",$.title??""].filter(Boolean).join(" "),$.detail].filter(Boolean).join(" - ")||$.message}function Pz$($){return Boolean($.status===403&&($.code&&jz$.has($.code)||/\bPLA_NOT_ACCEPTED\b|required agreement|program license agreement/i.test(`${$.code??""} ${$.title??""} ${$.detail??""}`)))}function Sz$($){if($.status===401)return!0;if($.status!==403)return!1;return Tz$.test($.code??"")||Cz$.test(`${$.title??""} ${$.detail??""}`)}function xz$($){let D=nO0($);if(Pz$($))return{id:"ios/asc-key-access",severity:"error",enforceAfter:mO0,title:"Apple requires an App Store Connect agreement (HTTP 403)",detail:D,fix:"Ask the Account Holder to accept pending agreements in App Store Connect → Business, then retry."};if(Sz$($))return{id:"ios/asc-key-access",severity:"error",enforceAfter:mO0,title:`App Store Connect authentication failed during preflight (HTTP ${$.status})`,detail:D,fix:cO0};if($.status===403)return{id:"ios/asc-key-access",severity:"warning",title:"Apple denied the App Store Connect preflight request (HTTP 403)",detail:`${D} This /v1/apps probe differs from the TestFlight upload path, so the build may still succeed.`,fix:"Review Apple's reason and confirm the key can access the target app. Use --fail-on-warnings only if this probe must be strict."};if($.status!==void 0)return{id:"ios/asc-key-access",severity:"warning",title:`App Store Connect preflight returned HTTP ${$.status}`,detail:D,fix:"Retry the preflight. The build will still attempt the upload because this response does not prove the credentials are invalid."};return{id:"ios/asc-key-access",severity:"error",title:"Could not authenticate the App Store Connect API key",detail:D,fix:cO0}}function iO0($){let D=new AbortController,J=setTimeout(()=>D.abort(),$);return{signal:D.signal,clear:()=>clearTimeout(J)}}function vz$($){return{id:"android/play-sa-access",platforms:["android"],appliesTo:(D)=>Yq(D),async run(D){let J=D.credentials?.PLAY_CONFIG_JSON;if(!J)return[];let X=wF0(D.projectDir,D.androidFlavor),Q=X.packageName??D.config?.appId??D.appId,Y=Iz$.from(J,"base64"),{signal:Z,clear:F}=iO0(mN),U;try{U=await $({jsonBytes:Y,packageName:Q,signal:Z,timeoutMs:mN})}finally{F()}if(U.ok)return[];switch(U.kind){case"no-app-access":return[{id:"android/play-sa-access",severity:X.ambiguous?"warning":"error",title:"The Play service account cannot access this app",detail:U.message,fix:dO0}];case"token-error":return[{id:"android/play-sa-access",severity:"error",title:"Google rejected the Play service-account key",detail:"The service-account JSON failed to authenticate with Google. Re-download a fresh key from the Google Cloud console.",fix:dO0}];case"network-error":return[{id:"android/play-sa-access",severity:"info",title:"Could not verify Play service-account access (network error or timeout)",detail:"The build will still attempt the upload; this check is best-effort and skipped offline."}];case"shape-error":return[{id:"android/play-sa-access",severity:"info",title:"Skipped Play access check (service-account JSON shape problem)",detail:"See the android/play-sa-json finding for the shape error."}];default:return[]}}}}function _z$($){return{id:"ios/asc-key-access",platforms:["ios"],appliesTo:(D)=>S8(D),async run(D){let{APPLE_KEY_ID:J,APPLE_ISSUER_ID:X,APPLE_KEY_CONTENT:Q}=D.credentials??{};if(!J||!X||!Q)return[];let Y="";try{Y=lO0.default.util.decode64(Q)}catch{return[]}if(!Y.includes("-----BEGIN PRIVATE KEY-----"))return[];let Z=await kz$(D),{signal:F,clear:U}=iO0(mN),G;try{G=await $({keyId:J,issuerId:X,p8Pem:Y,bundleId:Z,signal:F,timeoutMs:mN})}finally{U()}if(G.ok)return[];switch(G.kind){case"auth-error":return[xz$(G)];case"no-app-access":return[{id:"ios/asc-key-access",severity:"warning",title:"The App Store Connect API key cannot see this app",detail:G.message,fix:"Confirm the app exists in App Store Connect and the API key role can access it, or fix the bundle identifier."}];case"network":return[{id:"ios/asc-key-access",severity:"warning",title:G.status?`App Store Connect preflight returned HTTP ${G.status}`:"Could not verify App Store Connect access (network error or timeout)",detail:G.status?`${nO0(G)} The build will still attempt the upload.`:"The build will still attempt the upload; retry when network access is available."}];default:return[]}}}}async function kz$($){try{let{findSignableTargets:D,readPbxproj:J}=await Promise.resolve().then(() => (u4(),ZK)),X=J($.projectDir);if(!X)return $.config?.appId??$.appId;let Q=D(X),Y=$.config?.appId??$.appId;return(Q.find((F)=>F.bundleId===Y)??Q[0])?.bundleId??Y}catch{return $.config?.appId??$.appId}}var lO0,mN=7000,mO0="2026-08-17T00:00:00.000Z",dO0="Invite the service-account email in Play Console -> Users and permissions, then grant it release access for this app.",cO0="App Store Connect rejected the API key - check the Key ID / Issuer ID / .p8 and that the key has Admin or Developer access (or sign the pending agreement).",jz$,Tz$,Cz$,pO0,rO0;var oO0=a(()=>{vO0();gO0();k7();lO0=j$(Jq(),1),jz$=new Set(["FORBIDDEN.REQUIRED_AGREEMENTS_MISSING_OR_EXPIRED","FORBIDDEN_ERROR.PLA_NOT_ACCEPTED"]),Tz$=/(?:^|[._-])(NOT_AUTHORIZED|UNAUTHORIZED|AUTHENTICATION(?:_ERROR)?|INVALID_(?:TOKEN|CREDENTIALS?))(?:$|[._-])/i,Cz$=/authentication credentials? (?:are )?(?:missing or invalid)|invalid (?:bearer )?token|token (?:is )?(?:invalid|expired)/i;pO0=vz$(xO0),rO0=_z$(bO0)});var uz$="2026-08-14T00:00:00.000Z",yz$="2026-08-17T00:00:00.000Z",fz$,aO0;var tO0=a(()=>{mF0();Yq0();Tq0();Pq0();Wv();Dx();ZN();iq0();F30();w30();_30();n30();o30();s30();oO0();fz$=[q30,W30,z30,H30,O30,V30,K30,N30,M30,L30,h30,b30,g30,m30,d30,c30,l30,X30,Q30,Y30,Z30,cq0,lq0,nq0,A30,I30,j30,T30,C30,P30,S30,x30,v30].map(($)=>({...$,enforceAfter:uz$})),aO0=[a30,t30,Cq0,i30,p30,r30,vq0,{..._q0,enforceAfter:yz$},kq0,yq0,hq0,bq0,gq0,mq0,EF0,uq0,Xq0,Qq0,Wq0,zq0,Hq0,Vq0,Kq0,TF0,CF0,PF0,SF0,xF0,vF0,_F0,kF0,uF0,yF0,fF0,hF0,bF0,Nq0,Mq0,Lq0,wq0,Bq0,Eq0,Rq0,Aq0,Iq0,jq0,pO0,rO0,...fz$]});import{env as hz$,stdout as bz$}from"node:process";function dz$(){return Boolean(bz$.isTTY)&&!hz$.NO_COLOR}function W_($,D={}){let J=D.color??dz$(),X=D.now??new Date,Q=(z,H)=>J?`${z}${H}${vD.reset}`:H,Y=[];for(let z of gz$)for(let H of $.findings.filter((O)=>O.severity===z)){let O=!hG(H,X),V=O?z==="error"?"✖ CRITICAL — INFORMATION ONLY":`${sO0[z].trim()} — INFORMATION ONLY`:sO0[z];if(Y.push(`${Q(mz$[z],V)} ${H.title} ${Q(vD.dim,`[${H.id}]`)}`),H.detail)Y.push(Q(vD.dim,` ${H.detail}`));if(H.fix)Y.push(Q(vD.dim,` fix: ${H.fix}`));if(H.docsUrl)Y.push(Q(vD.dim,` docs: ${H.docsUrl}`));if(O&&H.enforceAfter){let K=z==="error"?"this critical finding is information only now and will fail builds":"this finding is information only now and can affect build outcomes";Y.push(Q(vD.dim,` rollout: ${K} starting ${eS(H.enforceAfter)}`))}}let{error:Z,warning:F,info:U}=$.counts;Y.push("");let G=`prescan: ${$.checksRun} checks in ${$.durationMs}ms — ${Z} error(s), ${F} warning(s), ${U} info`,q=Z>0?vD.red:F>0?vD.yellow:vD.dim;Y.push(Q(q,G));let W=RY($,X);if(W.length>0)Y.push(Q(vD.dim,`rollout: ${W.length} finding(s) are information only until their enforcement deadline`));if(D.verbose)Y.push(Q(vD.dim,`remote checks skipped: ${$.skippedRemote}`));return Y.join(`
461
- `)}function eO0($){let D=$.findings.map((J)=>{let X={id:J.id,severity:J.severity,title:J.title};if(J.detail)X.detail=J.detail;if(J.fix)X.fix=J.fix;if(J.docsUrl)X.docsUrl=J.docsUrl;if(J.enforceAfter)X.enforceAfter=J.enforceAfter;return X});return JSON.stringify({version:1,counts:$.counts,checksRun:$.checksRun,durationMs:$.durationMs,skippedRemote:$.skippedRemote,findings:D},null,2)}var gz$,sO0,vD,mz$;var $V0=a(()=>{gz$=["error","warning","info"],sO0={error:"✖ ERROR",warning:"⚠ WARN ",info:"ℹ INFO "},vD={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",dim:"\x1B[2m",bold:"\x1B[1m"},mz$={error:vD.bold+vD.red,warning:vD.bold+vD.yellow,info:vD.dim}});var z_={};kD(z_,{validateFlags:()=>DV0,runPrescanGate:()=>iz$,prescanCommand:()=>nz$,exitCodeFor:()=>JV0,executePrescan:()=>XV0});import{cwd as cz$,exit as lz$}from"node:process";function DV0($){if($.failOnWarnings&&$.ignoreFatal)throw Error("--ignore-fatal and --fail-on-warnings are contradictory — pick one")}function JV0($,D,J=[]){if(D.ignoreFatal)return 0;let X=AY({counts:$,findings:J},D.now);if(X.error>0)return 1;if(X.warning>0&&D.failOnWarnings)return 2;return 0}async function XV0($,D){let J=D.platform;if(J!=="ios"&&J!=="android")throw Error("--platform must be ios or android");let X=D.apikey??NV(),Q;if(X)try{Q=await t0(X,D.supaHost,D.supaAnon,!0)}catch{}let Y=await GF0({appId:$,platform:J,projectDir:D.path??cz$(),distributionMode:D.iosDist,androidFlavor:D.androidFlavor,apikey:X,supabase:Q,credentials:D.credentials});return{report:await HF0(Y,aO0),apikey:X}}async function nz$($,D){if(DV0(D),!D.json)g0("Capgo build prescan");let{report:J,apikey:X}=await XV0($,D);if(D.json)console.log(eO0(J));else{B.message(W_(J,{verbose:D.verbose,now:D.now}));let Q=$x(J,D);l0(Q==="block"?"Prescan found blocking problems — fix them before building.":"Prescan finished.")}if(X){let Q=AY(J,D.now),Y=RY(J,D.now).length;await n0(X,{channel:"build",event:"Prescan run",icon:"\uD83D\uDEE1️",tags:{source:"standalone",result:Q.error>0?D.ignoreFatal?"bypassed":"blocked":Q.warning>0?D.failOnWarnings?"blocked":"warned":Y>0?"information-only":"clean","app-id":$??"unknown",platform:D.platform??"unknown",errors:String(J.counts.error),warnings:String(J.counts.warning),"finding-ids":J.findings.filter((Z)=>Z.severity!=="info").map((Z)=>Z.id).join(",").slice(0,200),"information-only-findings":String(Y)},notify:!1},D.verbose).catch(()=>{})}lz$(JV0(J.counts,D,J.findings))}async function iz$($,D){if(!$.enabled)return{decision:"proceed",report:null,crashed:!1,informationOnlyFindings:0};let J=()=>{},X=$.print??($.silent?J:(U)=>B.message(U)),Q=$.warn??($.silent?J:(U)=>B.warn(U)),Y;try{Y=await D()}catch(U){return Q(`prescan crashed and was skipped: ${U instanceof Error?U.message:String(U)}`),{decision:"proceed",report:null,crashed:!0,informationOnlyFindings:0}}if(Y.findings.length>0)X(W_(Y,{now:$.now}));let Z=$x(Y,{ignoreFatal:$.ignoreFatal,failOnWarnings:$.failOnWarnings,now:$.now}),F;if(Z==="ask")F=$.interactive===!1?"proceed":await VF0("ask",{silent:$.silent});else F=Z;return{decision:F,report:Y,crashed:!1,informationOnlyFindings:RY(Y,$.now).length}}var H_=a(()=>{F$();D$();qF0();OF0();KF0();tO0();$V0()});var XM=A((uO$)=>{uO$.isInteger=($)=>{if(typeof $==="number")return Number.isInteger($);if(typeof $==="string"&&$.trim()!=="")return Number.isInteger(Number($));return!1};uO$.find=($,D)=>$.nodes.find((J)=>J.type===D);uO$.exceedsLimit=($,D,J=1,X)=>{if(X===!1)return!1;if(!uO$.isInteger($)||!uO$.isInteger(D))return!1;return(Number(D)-Number($))/Number(J)>=X};uO$.escapeNode=($,D=0,J)=>{let X=$.nodes[D];if(!X)return;if(J&&X.type===J||X.type==="open"||X.type==="close"){if(X.escaped!==!0)X.value="\\"+X.value,X.escaped=!0}};uO$.encloseBrace=($)=>{if($.type!=="brace")return!1;if($.commas>>0+$.ranges>>0===0)return $.invalid=!0,!0;return!1};uO$.isInvalidBrace=($)=>{if($.type!=="brace")return!1;if($.invalid===!0||$.dollar)return!0;if($.commas>>0+$.ranges>>0===0)return $.invalid=!0,!0;if($.open!==!0||$.close!==!0)return $.invalid=!0,!0;return!1};uO$.isOpenOrClose=($)=>{if($.type==="open"||$.type==="close")return!0;return $.open===!0||$.close===!0};uO$.reduce=($)=>$.reduce((D,J)=>{if(J.type==="text")D.push(J.value);if(J.type==="range")J.type="text";return D},[]);uO$.flatten=(...$)=>{let D=[],J=(X)=>{for(let Q=0;Q<X.length;Q++){let Y=X[Q];if(Array.isArray(Y)){J(Y);continue}if(Y!==void 0)D.push(Y)}return D};return J($),D}});var QM=A((xl$,WK0)=>{var qK0=XM();WK0.exports=($,D={})=>{let J=(X,Q={})=>{let Y=D.escapeInvalid&&qK0.isInvalidBrace(Q),Z=X.invalid===!0&&D.escapeInvalid===!0,F="";if(X.value){if((Y||Z)&&qK0.isOpenOrClose(X))return"\\"+X.value;return X.value}if(X.value)return X.value;if(X.nodes)for(let U of X.nodes)F+=J(U);return F};return J($)}});var HK0=A((vl$,zK0)=>{/*!
460
+ `+" - Then run this step again — your API key is valid, so no key changes are needed"});function q_($,D){if(typeof $!=="string")return;let J=zY($);for(let X of D)if(X)J=J.replaceAll(X,"[REDACTED IDENTIFIER]");return J=J.replace(/\p{Cc}+/gu," ").replace(/\s+/g," ").trim(),J?J.slice(0,Az$):void 0}async function bO0($){let D=$.fetchImpl??globalThis.fetch.bind(globalThis),J=$.timeoutMs??Ez$;if($.signal?.aborted)return{ok:!1,kind:"network",message:"App Store Connect check cancelled."};let X;try{X=uO0($.keyId,$.issuerId,$.p8Pem)}catch{return{ok:!1,kind:"auth-error",message:"Could not sign the App Store Connect request - the .p8 key, Key ID, or Issuer ID is invalid."}}let Q=new AbortController,Y=setTimeout(()=>Q.abort(),J),Z=()=>Q.abort();$.signal?.addEventListener("abort",Z,{once:!0});let U=`/apps${$.bundleId?`?filter[bundleId]=${encodeURIComponent($.bundleId)}&limit=1`:"?limit=1"}`;try{let G=await D(`${Bz$}${U}`,{signal:Q.signal,headers:{Authorization:`Bearer ${X}`,"Content-Type":"application/json"}}),q=await G.json().catch(()=>null);if(!G.ok){let W=(q?.errors??[])[0];u6(`apple-access GET ${U}: HTTP ${G.status} ${G.statusText} ${JSON.stringify(q?.errors??null)} | ${oV(G.headers)}`);let z=new G_(G.status,W?`Apple API error (${G.status}): ${W.title} - ${W.detail} (${W.code})`:`Apple API error: HTTP ${G.status} ${G.statusText}`,W?.code),H=yO0(z),O=[$.keyId,$.issuerId],V={status:G.status,code:q_(W?.code,O),title:q_(W?.title,O),detail:q_(W?.detail,O)};if(H.is401or403)return{ok:!1,kind:"auth-error",message:H.message,...V};return{ok:!1,kind:"network",message:`App Store Connect returned HTTP ${G.status}.`,...V}}if(u6(`apple-access GET ${U}: HTTP ${G.status} | ${oV(G.headers)}`),$.bundleId){if(!fO0(q).some((H)=>H.bundleId===$.bundleId))return{ok:!1,kind:"no-app-access",message:`The App Store Connect API key cannot see an app with bundle id ${$.bundleId}.`}}return{ok:!0}}catch(G){let q=G instanceof Error?G.message:String(G);if(G?.name==="AbortError"||Q.signal.aborted||Rz$.test(q))return{ok:!1,kind:"network",message:"Could not reach App Store Connect (network error or timeout)."};return{ok:!1,kind:"network",message:"App Store Connect check failed unexpectedly."}}finally{clearTimeout(Y),$.signal?.removeEventListener("abort",Z)}}var Bz$="https://api.appstoreconnect.apple.com/v1",Ez$=7000,Rz$,Az$=500;var gO0=a(()=>{OY();nV();hO0();Rz$=/timeout|timed out|network|fetch failed|aborted|ENOTFOUND|EAI_AGAIN|ECONNRESET|ECONNREFUSED/i});import{Buffer as Iz$}from"node:buffer";function nO0($){return[[$.code?`[${$.code}]`:"",$.title??""].filter(Boolean).join(" "),$.detail].filter(Boolean).join(" - ")||$.message}function Pz$($){return Boolean($.status===403&&($.code&&jz$.has($.code)||/\bPLA_NOT_ACCEPTED\b|required agreement|program license agreement/i.test(`${$.code??""} ${$.title??""} ${$.detail??""}`)))}function Sz$($){if($.status===401)return!0;if($.status!==403)return!1;return Tz$.test($.code??"")||Cz$.test(`${$.title??""} ${$.detail??""}`)}function xz$($){let D=nO0($);if(Pz$($))return{id:"ios/asc-key-access",severity:"error",enforceAfter:mO0,title:"Apple requires an App Store Connect agreement (HTTP 403)",detail:D,fix:"Ask the Account Holder to accept pending agreements in App Store Connect → Business, then retry."};if(Sz$($))return{id:"ios/asc-key-access",severity:"error",enforceAfter:mO0,title:`App Store Connect authentication failed during preflight (HTTP ${$.status})`,detail:D,fix:cO0};if($.status===403)return{id:"ios/asc-key-access",severity:"warning",title:"Apple denied the App Store Connect preflight request (HTTP 403)",detail:`${D} This /v1/apps probe differs from the TestFlight upload path, so the build may still succeed.`,fix:"Review Apple's reason and confirm the key can access the target app. Use --fail-on-warnings only if this probe must be strict."};if($.status!==void 0)return{id:"ios/asc-key-access",severity:"warning",title:`App Store Connect preflight returned HTTP ${$.status}`,detail:D,fix:"Retry the preflight. The build will still attempt the upload because this response does not prove the credentials are invalid."};return{id:"ios/asc-key-access",severity:"error",title:"Could not authenticate the App Store Connect API key",detail:D,fix:cO0}}function iO0($){let D=new AbortController,J=setTimeout(()=>D.abort(),$);return{signal:D.signal,clear:()=>clearTimeout(J)}}function vz$($){return{id:"android/play-sa-access",platforms:["android"],appliesTo:(D)=>Yq(D),async run(D){let J=D.credentials?.PLAY_CONFIG_JSON;if(!J)return[];let X=wF0(D.projectDir,D.androidFlavor),Q=X.packageName??D.config?.appId??D.appId,Y=Iz$.from(J,"base64"),{signal:Z,clear:F}=iO0(mN),U;try{U=await $({jsonBytes:Y,packageName:Q,signal:Z,timeoutMs:mN})}finally{F()}if(U.ok)return[];switch(U.kind){case"no-app-access":return[{id:"android/play-sa-access",severity:X.ambiguous?"warning":"error",title:"The Play service account cannot access this app",detail:U.message,fix:dO0}];case"token-error":return[{id:"android/play-sa-access",severity:"error",title:"Google rejected the Play service-account key",detail:"The service-account JSON failed to authenticate with Google. Re-download a fresh key from the Google Cloud console.",fix:dO0}];case"network-error":return[{id:"android/play-sa-access",severity:"info",title:"Could not verify Play service-account access (network error or timeout)",detail:"The build will still attempt the upload; this check is best-effort and skipped offline."}];case"shape-error":return[{id:"android/play-sa-access",severity:"info",title:"Skipped Play access check (service-account JSON shape problem)",detail:"See the android/play-sa-json finding for the shape error."}];default:return[]}}}}function _z$($){return{id:"ios/asc-key-access",platforms:["ios"],appliesTo:(D)=>S8(D),async run(D){let{APPLE_KEY_ID:J,APPLE_ISSUER_ID:X,APPLE_KEY_CONTENT:Q}=D.credentials??{};if(!J||!X||!Q)return[];let Y="";try{Y=lO0.default.util.decode64(Q)}catch{return[]}if(!Y.includes("-----BEGIN PRIVATE KEY-----"))return[];let Z=await kz$(D),{signal:F,clear:U}=iO0(mN),G;try{G=await $({keyId:J,issuerId:X,p8Pem:Y,bundleId:Z,signal:F,timeoutMs:mN})}finally{U()}if(G.ok)return[];switch(G.kind){case"auth-error":return[xz$(G)];case"no-app-access":return[{id:"ios/asc-key-access",severity:"warning",title:"The App Store Connect API key cannot see this app",detail:G.message,fix:"Confirm the app exists in App Store Connect and the API key role can access it, or fix the bundle identifier."}];case"network":return[{id:"ios/asc-key-access",severity:"warning",title:G.status?`App Store Connect preflight returned HTTP ${G.status}`:"Could not verify App Store Connect access (network error or timeout)",detail:G.status?`${nO0(G)} The build will still attempt the upload.`:"The build will still attempt the upload; retry when network access is available."}];default:return[]}}}}async function kz$($){try{let{findSignableTargets:D,readPbxproj:J}=await Promise.resolve().then(() => (u4(),ZK)),X=J($.projectDir);if(!X)return $.config?.appId??$.appId;let Q=D(X),Y=$.config?.appId??$.appId;return(Q.find((F)=>F.bundleId===Y)??Q[0])?.bundleId??Y}catch{return $.config?.appId??$.appId}}var lO0,mN=7000,mO0="2026-08-17T00:00:00.000Z",dO0="Invite the service-account email in Play Console -> Users and permissions, then grant it release access for this app.",cO0="App Store Connect rejected the API key - check the Key ID / Issuer ID / .p8 and that the key has Admin or Developer access (or sign the pending agreement).",jz$,Tz$,Cz$,pO0,rO0;var oO0=a(()=>{vO0();gO0();k7();lO0=j$(Jq(),1),jz$=new Set(["FORBIDDEN.REQUIRED_AGREEMENTS_MISSING_OR_EXPIRED","FORBIDDEN_ERROR.PLA_NOT_ACCEPTED"]),Tz$=/(?:^|[._-])(NOT_AUTHORIZED|UNAUTHORIZED|AUTHENTICATION(?:_ERROR)?|INVALID_(?:TOKEN|CREDENTIALS?))(?:$|[._-])/i,Cz$=/authentication credentials? (?:are )?(?:missing or invalid)|invalid (?:bearer )?token|token (?:is )?(?:invalid|expired)/i;pO0=vz$(xO0),rO0=_z$(bO0)});var uz$="2026-08-14T00:00:00.000Z",yz$="2026-08-17T00:00:00.000Z",fz$,aO0;var tO0=a(()=>{mF0();Yq0();Tq0();Pq0();Wv();Dx();ZN();iq0();F30();w30();_30();n30();o30();s30();oO0();fz$=[q30,W30,z30,H30,O30,V30,K30,N30,M30,L30,h30,b30,g30,m30,d30,c30,l30,X30,Q30,Y30,Z30,cq0,lq0,nq0,A30,I30,j30,T30,C30,P30,S30,x30,v30].map(($)=>({...$,enforceAfter:uz$})),aO0=[a30,t30,Cq0,i30,p30,r30,vq0,{..._q0,enforceAfter:yz$},kq0,yq0,hq0,bq0,gq0,mq0,EF0,uq0,Xq0,Qq0,Wq0,zq0,Hq0,Vq0,Kq0,TF0,CF0,PF0,SF0,xF0,vF0,_F0,kF0,uF0,yF0,fF0,hF0,bF0,Nq0,Mq0,Lq0,wq0,Bq0,Eq0,Rq0,Aq0,Iq0,jq0,pO0,rO0,...fz$]});import{env as hz$,stdout as bz$}from"node:process";function dz$(){return Boolean(bz$.isTTY)&&!hz$.NO_COLOR}function W_($,D={}){let J=D.color??dz$(),X=D.now??new Date,Q=(z,H)=>J?`${z}${H}${vD.reset}`:H,Y=[];for(let z of gz$)for(let H of $.findings.filter((O)=>O.severity===z)){let O=!hG(H,X),V=O?z==="error"?"✖ CRITICAL — INFORMATION ONLY":`${sO0[z].trim()} — INFORMATION ONLY`:sO0[z];if(Y.push(`${Q(mz$[z],V)} ${H.title} ${Q(vD.dim,`[${H.id}]`)}`),H.detail)Y.push(Q(vD.dim,` ${H.detail}`));if(H.fix)Y.push(Q(vD.dim,` fix: ${H.fix}`));if(H.docsUrl)Y.push(Q(vD.dim,` docs: ${H.docsUrl}`));if(O&&H.enforceAfter&&!(D.ignoreFatal&&z==="error")){let K=z==="error"?"this critical finding is information only now and will fail builds":"this finding is information only now and can affect build outcomes";Y.push(Q(vD.dim,` rollout: ${K} starting ${eS(H.enforceAfter)}`))}}let{error:Z,warning:F,info:U}=$.counts;Y.push("");let G=`prescan: ${$.checksRun} checks in ${$.durationMs}ms — ${Z} error(s), ${F} warning(s), ${U} info`,q=Z>0?vD.red:F>0?vD.yellow:vD.dim;Y.push(Q(q,G));let W=RY($,X).filter((z)=>!(D.ignoreFatal&&z.severity==="error"));if(W.length>0)Y.push(Q(vD.dim,`rollout: ${W.length} finding(s) are information only until their enforcement deadline`));if(D.verbose)Y.push(Q(vD.dim,`remote checks skipped: ${$.skippedRemote}`));return Y.join(`
461
+ `)}function eO0($){let D=$.findings.map((J)=>{let X={id:J.id,severity:J.severity,title:J.title};if(J.detail)X.detail=J.detail;if(J.fix)X.fix=J.fix;if(J.docsUrl)X.docsUrl=J.docsUrl;if(J.enforceAfter)X.enforceAfter=J.enforceAfter;return X});return JSON.stringify({version:1,counts:$.counts,checksRun:$.checksRun,durationMs:$.durationMs,skippedRemote:$.skippedRemote,findings:D},null,2)}var gz$,sO0,vD,mz$;var $V0=a(()=>{gz$=["error","warning","info"],sO0={error:"✖ ERROR",warning:"⚠ WARN ",info:"ℹ INFO "},vD={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",dim:"\x1B[2m",bold:"\x1B[1m"},mz$={error:vD.bold+vD.red,warning:vD.bold+vD.yellow,info:vD.dim}});var z_={};kD(z_,{validateFlags:()=>DV0,runPrescanGate:()=>iz$,prescanCommand:()=>nz$,exitCodeFor:()=>JV0,executePrescan:()=>XV0});import{cwd as cz$,exit as lz$}from"node:process";function DV0($){if($.failOnWarnings&&$.ignoreFatal)throw Error("--ignore-fatal and --fail-on-warnings are contradictory — pick one")}function JV0($,D,J=[]){if(D.ignoreFatal)return 0;let X=AY({counts:$,findings:J},D.now);if(X.error>0)return 1;if(X.warning>0&&D.failOnWarnings)return 2;return 0}async function XV0($,D){let J=D.platform;if(J!=="ios"&&J!=="android")throw Error("--platform must be ios or android");let X=D.apikey??NV(),Q;if(X)try{Q=await t0(X,D.supaHost,D.supaAnon,!0)}catch{}let Y=await GF0({appId:$,platform:J,projectDir:D.path??cz$(),distributionMode:D.iosDist,androidFlavor:D.androidFlavor,apikey:X,supabase:Q,credentials:D.credentials});return{report:await HF0(Y,aO0),apikey:X}}async function nz$($,D){if(DV0(D),!D.json)g0("Capgo build prescan");let{report:J,apikey:X}=await XV0($,D);if(D.json)console.log(eO0(J));else{B.message(W_(J,{verbose:D.verbose,now:D.now,ignoreFatal:D.ignoreFatal}));let Q=$x(J,D);l0(Q==="block"?"Prescan found blocking problems — fix them before building.":"Prescan finished.")}if(X){let Q=AY(J,D.now),Y=RY(J,D.now).length;await n0(X,{channel:"build",event:"Prescan run",icon:"\uD83D\uDEE1️",tags:{source:"standalone",result:Q.error>0?D.ignoreFatal?"bypassed":"blocked":Q.warning>0?D.failOnWarnings?"blocked":"warned":Y>0?"information-only":"clean","app-id":$??"unknown",platform:D.platform??"unknown",errors:String(J.counts.error),warnings:String(J.counts.warning),"finding-ids":J.findings.filter((Z)=>Z.severity!=="info").map((Z)=>Z.id).join(",").slice(0,200),"information-only-findings":String(Y)},notify:!1},D.verbose).catch(()=>{})}lz$(JV0(J.counts,D,J.findings))}async function iz$($,D){if(!$.enabled)return{decision:"proceed",report:null,crashed:!1,informationOnlyFindings:0};let J=()=>{},X=$.print??($.silent?J:(U)=>B.message(U)),Q=$.warn??($.silent?J:(U)=>B.warn(U)),Y;try{Y=await D()}catch(U){return Q(`prescan crashed and was skipped: ${U instanceof Error?U.message:String(U)}`),{decision:"proceed",report:null,crashed:!0,informationOnlyFindings:0}}if(Y.findings.length>0)X(W_(Y,{now:$.now,ignoreFatal:$.ignoreFatal}));let Z=$x(Y,{ignoreFatal:$.ignoreFatal,failOnWarnings:$.failOnWarnings,now:$.now}),F;if(Z==="ask")F=$.interactive===!1?"proceed":await VF0("ask",{silent:$.silent});else F=Z;return{decision:F,report:Y,crashed:!1,informationOnlyFindings:RY(Y,$.now).length}}var H_=a(()=>{F$();D$();qF0();OF0();KF0();tO0();$V0()});var XM=A((uO$)=>{uO$.isInteger=($)=>{if(typeof $==="number")return Number.isInteger($);if(typeof $==="string"&&$.trim()!=="")return Number.isInteger(Number($));return!1};uO$.find=($,D)=>$.nodes.find((J)=>J.type===D);uO$.exceedsLimit=($,D,J=1,X)=>{if(X===!1)return!1;if(!uO$.isInteger($)||!uO$.isInteger(D))return!1;return(Number(D)-Number($))/Number(J)>=X};uO$.escapeNode=($,D=0,J)=>{let X=$.nodes[D];if(!X)return;if(J&&X.type===J||X.type==="open"||X.type==="close"){if(X.escaped!==!0)X.value="\\"+X.value,X.escaped=!0}};uO$.encloseBrace=($)=>{if($.type!=="brace")return!1;if($.commas>>0+$.ranges>>0===0)return $.invalid=!0,!0;return!1};uO$.isInvalidBrace=($)=>{if($.type!=="brace")return!1;if($.invalid===!0||$.dollar)return!0;if($.commas>>0+$.ranges>>0===0)return $.invalid=!0,!0;if($.open!==!0||$.close!==!0)return $.invalid=!0,!0;return!1};uO$.isOpenOrClose=($)=>{if($.type==="open"||$.type==="close")return!0;return $.open===!0||$.close===!0};uO$.reduce=($)=>$.reduce((D,J)=>{if(J.type==="text")D.push(J.value);if(J.type==="range")J.type="text";return D},[]);uO$.flatten=(...$)=>{let D=[],J=(X)=>{for(let Q=0;Q<X.length;Q++){let Y=X[Q];if(Array.isArray(Y)){J(Y);continue}if(Y!==void 0)D.push(Y)}return D};return J($),D}});var QM=A((xl$,WK0)=>{var qK0=XM();WK0.exports=($,D={})=>{let J=(X,Q={})=>{let Y=D.escapeInvalid&&qK0.isInvalidBrace(Q),Z=X.invalid===!0&&D.escapeInvalid===!0,F="";if(X.value){if((Y||Z)&&qK0.isOpenOrClose(X))return"\\"+X.value;return X.value}if(X.value)return X.value;if(X.nodes)for(let U of X.nodes)F+=J(U);return F};return J($)}});var HK0=A((vl$,zK0)=>{/*!
462
462
  * is-number <https://github.com/jonschlinkert/is-number>
463
463
  *
464
464
  * Copyright (c) 2014-present, Jon Schlinkert.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
3
  "type": "module",
4
- "version": "8.32.0",
4
+ "version": "8.32.1",
5
5
  "description": "A CLI to upload to capgo servers",
6
6
  "author": "Martin martin@capgo.app",
7
7
  "license": "Apache 2.0",