@shipstatic/ship 3.2.0 → 3.3.0-beta.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/SKILL.md +1 -1
- package/THIRD-PARTY-LICENSES.md +1 -1
- package/dist/browser.d.ts +58 -24
- package/dist/browser.js +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -24
- package/dist/index.d.ts +58 -24
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/SKILL.md
CHANGED
|
@@ -180,7 +180,7 @@ Verification is async — DNS propagation takes minutes to hours. Check with `sh
|
|
|
180
180
|
| `live` | It serves the linked deployment | Nothing |
|
|
181
181
|
| `paused` | The plan has no room for it, so it serves nothing | Delete another domain, or upgrade the plan |
|
|
182
182
|
|
|
183
|
-
`verification` is the DNS detail under `unverified`: `pending` (
|
|
183
|
+
`verification` is the DNS detail under `unverified`: `pending` (the CNAME does not point here, so nothing is served), `partial` (a `www` domain's CNAME does and its apex A record does not, so the site is served and `example.com` does not redirect yet), `verified` (every required record does). `verified` is when that happened, `verifications` how many attempts, `paused` when serving stopped.
|
|
184
184
|
|
|
185
185
|
### Upsert operations
|
|
186
186
|
|
package/THIRD-PARTY-LICENSES.md
CHANGED
package/dist/browser.d.ts
CHANGED
|
@@ -284,11 +284,19 @@ type DomainStatusType = (typeof DomainStatus)[keyof typeof DomainStatus];
|
|
|
284
284
|
/**
|
|
285
285
|
* The DNS fact: how far the platform's one verifying act has got.
|
|
286
286
|
*
|
|
287
|
-
* - `pending`:
|
|
288
|
-
* - `partial`:
|
|
289
|
-
* apex A record,
|
|
290
|
-
* - `verified`:
|
|
291
|
-
* records to configure.
|
|
287
|
+
* - `pending`: the site's CNAME does not point at the platform.
|
|
288
|
+
* - `partial`: it does, and the rest does not. Only a `www` domain has a
|
|
289
|
+
* rest, the apex A record, which serves nothing but the redirect to `www`.
|
|
290
|
+
* - `verified`: every required record does. Platform names are born here,
|
|
291
|
+
* having no records to configure.
|
|
292
|
+
*
|
|
293
|
+
* **The CNAME divides the three because it is the record that serves the
|
|
294
|
+
* site.** `partial` says the site is served and only the redirect is missing;
|
|
295
|
+
* an apex A record without the CNAME serves nothing, so it is `pending`. The
|
|
296
|
+
* verifier's drift line depends on exactly that: on a domain that has verified
|
|
297
|
+
* before, a move into `pending` is the site no longer being served, and it is
|
|
298
|
+
* the drift the operator is told about (`cloudflare/consumer`'s
|
|
299
|
+
* `verifyDnsMapping`).
|
|
292
300
|
*
|
|
293
301
|
* Written by the DNS verifier and at birth, and by nothing else. **It is the
|
|
294
302
|
* only field that says whether DNS is verified NOW**: its sibling instant
|
|
@@ -474,7 +482,12 @@ interface DomainDnsResponse {
|
|
|
474
482
|
* The link is FINISHED, on the deployment claim's grammar: the API composes
|
|
475
483
|
* it from the salted setup hash and the one environment dimension it owns,
|
|
476
484
|
* and no client ever parses or assembles one. What a client receives is the
|
|
477
|
-
* setup URL, ready to hand off.
|
|
485
|
+
* setup URL, ready to hand off. The one thing a client may add is a fragment
|
|
486
|
+
* naming a section of the page it opens, {@link SETUP_TROUBLESHOOTING_ANCHOR}:
|
|
487
|
+
* that addresses a place in the instructions, not the instructions. Refused
|
|
488
|
+
* (2026-09-26): answering the section's link as a second field here. It would
|
|
489
|
+
* be one more field on every surface that relays this response (the SDK, the
|
|
490
|
+
* CLI, both MCPs, n8n) to carry one anchor that only the console reads.
|
|
478
491
|
*
|
|
479
492
|
* `/admin/domains/:domain/share` answers the same shape, which is the admin
|
|
480
493
|
* law working: the operator surface is the public grammar with a prefix.
|
|
@@ -488,6 +501,20 @@ interface DomainShareResponse {
|
|
|
488
501
|
/** The shareable setup link, carrying the salted hash that authorizes the share */
|
|
489
502
|
readonly url: string;
|
|
490
503
|
}
|
|
504
|
+
/**
|
|
505
|
+
* The anchor of the troubleshooting section on a domain's setup instructions
|
|
506
|
+
* page, so a link can open the page there: `${share.url}#troubleshooting`.
|
|
507
|
+
*
|
|
508
|
+
* The API's instructions template gives the section this id and the console's
|
|
509
|
+
* connect page links to it: two repos, one spelling, which is why it lives
|
|
510
|
+
* here. The section is written for the domain's own DNS provider, which is why
|
|
511
|
+
* the console sends a stuck reader to it rather than to the general docs. If
|
|
512
|
+
* the spellings ever diverged, nothing would fail: the link would open the page
|
|
513
|
+
* at its top and nobody would be told, the silent-drift class this
|
|
514
|
+
* constitution exists to delete ({@link SIGN_IN_RETURN_PARAM} is the same shape
|
|
515
|
+
* one domain over).
|
|
516
|
+
*/
|
|
517
|
+
declare const SETUP_TROUBLESHOOTING_ANCHOR = "troubleshooting";
|
|
491
518
|
/**
|
|
492
519
|
* Response for domain DNS records
|
|
493
520
|
*
|
|
@@ -735,17 +762,15 @@ interface Caps {
|
|
|
735
762
|
*/
|
|
736
763
|
readonly customDomains: number;
|
|
737
764
|
/**
|
|
738
|
-
*
|
|
739
|
-
*
|
|
740
|
-
*
|
|
741
|
-
* additive-evolution law: responses older than 3.1 carry no seats, and a
|
|
742
|
-
* consumer reads one seat and one owner where the field is absent.
|
|
765
|
+
* Members of the account, the owner included: one membership row each, so
|
|
766
|
+
* a pending invitation is not yet a member. As `usage` it is how many the
|
|
767
|
+
* account has, as `caps` how many its plan allows.
|
|
743
768
|
*/
|
|
744
|
-
readonly
|
|
769
|
+
readonly members: number;
|
|
745
770
|
}
|
|
746
771
|
/**
|
|
747
772
|
* A person's standing in an account. `owner` founded it and alone manages
|
|
748
|
-
* billing, credentials,
|
|
773
|
+
* billing, credentials, members and deletion; `member` uses its resources
|
|
749
774
|
* exactly as the owner does. These are Better Auth's own organization roles,
|
|
750
775
|
* and the only two the platform makes reachable.
|
|
751
776
|
*/
|
|
@@ -753,8 +778,8 @@ type AccountRole = 'owner' | 'member';
|
|
|
753
778
|
/**
|
|
754
779
|
* Whether the credential's standing currently admits it to the account's
|
|
755
780
|
* resources. The owner is always `active`; a member is `active` while the
|
|
756
|
-
* account fits its
|
|
757
|
-
* the plan allows, until the owner upgrades or removes
|
|
781
|
+
* account fits its members cap and `paused` while it holds more members than
|
|
782
|
+
* the plan allows, until the owner upgrades or removes members. The state
|
|
758
783
|
* is derived on every request and never stored, and a paused member still
|
|
759
784
|
* reads the account, switches accounts and leaves; every other request is
|
|
760
785
|
* refused (403, `details.account: 'paused'`). A key or a deploy token is
|
|
@@ -794,7 +819,7 @@ interface Account {
|
|
|
794
819
|
/** What the account currently holds — see {@link Caps}. */
|
|
795
820
|
readonly usage: Caps;
|
|
796
821
|
/**
|
|
797
|
-
* What the account is allowed to hold
|
|
822
|
+
* What the account is allowed to hold, under the same keys as
|
|
798
823
|
* {@link usage}, so the pair divides. These are the account's EFFECTIVE
|
|
799
824
|
* caps: its plan's numbers, plus whatever the operator granted it
|
|
800
825
|
* individually.
|
|
@@ -802,9 +827,9 @@ interface Account {
|
|
|
802
827
|
readonly caps: Caps;
|
|
803
828
|
/**
|
|
804
829
|
* The credential's standing in this account. Optional by the
|
|
805
|
-
* additive-evolution law: a response that predates
|
|
806
|
-
* and a consumer reads `owner`, because every account then had
|
|
807
|
-
*
|
|
830
|
+
* additive-evolution law: a response that predates members names no
|
|
831
|
+
* role, and a consumer reads `owner`, because every account then had
|
|
832
|
+
* exactly one member. A key or a deploy token carries the owner's authority and reports
|
|
808
833
|
* `owner` too.
|
|
809
834
|
*/
|
|
810
835
|
readonly role?: AccountRole;
|
|
@@ -812,10 +837,20 @@ interface Account {
|
|
|
812
837
|
* Whether that standing admits the credential today: see
|
|
813
838
|
* {@link AccountAccess}. The API derives it from the same row that yields
|
|
814
839
|
* {@link role}, so a console reads it here rather than re-deriving it from
|
|
815
|
-
* the
|
|
816
|
-
* that predates
|
|
840
|
+
* the member counts. Optional by the additive-evolution law: a response
|
|
841
|
+
* that predates members is always `active`.
|
|
817
842
|
*/
|
|
818
843
|
readonly access?: AccountAccess;
|
|
844
|
+
/**
|
|
845
|
+
* Whether the account's MEMBERS are admitted today: `paused` while it holds
|
|
846
|
+
* more members than its plan allows, until the owner upgrades or removes
|
|
847
|
+
* members. It is {@link access} for everyone who is not the owner, published
|
|
848
|
+
* for the account so the one person it never pauses can be told; the API
|
|
849
|
+
* derives both from one rule, so a console reads the pause here rather than
|
|
850
|
+
* re-deriving it from the member counts. Optional by the additive-evolution
|
|
851
|
+
* law: a response that predates it is `active`.
|
|
852
|
+
*/
|
|
853
|
+
readonly members?: AccountAccess;
|
|
819
854
|
/** Unix timestamp (seconds) when account was created */
|
|
820
855
|
readonly created: number;
|
|
821
856
|
/** Unix timestamp (seconds) when account was activated (first deployment), null if not yet activated */
|
|
@@ -1538,8 +1573,7 @@ declare const SIGN_IN_RETURN_PARAM = "signing-in";
|
|
|
1538
1573
|
*
|
|
1539
1574
|
* Client populations: `SESSION` (first-party cookie), `API_KEY` (`ship-`
|
|
1540
1575
|
* key), `TOKEN` (`deploy-` deploy token), `AGENT` (anonymous, no credential:
|
|
1541
|
-
* public deploys are granted the public-account identity per request,
|
|
1542
|
-
* captcha-verified share-link setup open audits as this population),
|
|
1576
|
+
* public deploys are granted the public-account identity per request),
|
|
1543
1577
|
* `OAUTH` (delegated access token). The one server population:
|
|
1544
1578
|
* `SYSTEM` (scheduled/background jobs). Webhook receipt is deliberately not
|
|
1545
1579
|
* a population: a signed delivery is verified, never authorized — it acts
|
|
@@ -3600,4 +3634,4 @@ declare class Ship extends Ship$1 {
|
|
|
3600
3634
|
protected processInput(input: DeployInput, options: DeploymentOptions): Promise<StaticFile[]>;
|
|
3601
3635
|
}
|
|
3602
3636
|
|
|
3603
|
-
export { ACCOUNT_HEADER, API_KEY, API_PATHS, AUTH_BASE_PATH, type Account, type AccountAccess, type AccountDeleteResponse, type AccountGetResponse, type AccountKeyResponse, AccountPlan, type AccountPlanType, type AccountResource, type AccountRole, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, BUILD_SETTINGS, type BillingInterval, type BillingPortalSession, type BillingSyncResponse, type BuildFailureDetails, CALLER, type Caps, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_FIELDS, DEPLOY_FILE_GRAMMAR, DEPLOY_TOKEN, type DeployBodyContext, type DeployFile, type DeployFileEncoding, type DeployFileSpec, type DeployInput, type DeployTransport, type Deployment, type DeploymentCreateResponse, type DeploymentDeleteResponse, type DeploymentListResponse, type DeploymentOptions, type DeploymentResource, type DeploymentResourceContext, type DeploymentSetOptions, DeploymentStatus, type DeploymentStatusType, type DeploymentUploadOptions, DeploymentVia, type DeploymentViaType, type DnsLookup, type DnsProvider, type DnsRecord, type DnsRecordType, type Domain, type DomainDeleteResponse, type DomainDnsResponse, type DomainListResponse, type DomainRecordsResponse, type DomainResource, type DomainSetOptions, type DomainSetResult, type DomainShareResponse, DomainStatus, type DomainStatusType, type DomainValidateResponse, DomainVerification, type DomainVerificationType, type DomainVerifyResponse, type ErrorResponse, ErrorType, type ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, type Fetch, type FileValidationResult, FileValidationStatus, type FileValidationStatusType, IDEMPOTENCY_KEY_CONSTRAINTS, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, type LabelsResponse, type ListOptions, type ListResponse, type MD5Result, MY_API_KEY_URL, OAUTH_TOKEN, OAuthScope, type OAuthScopeType, PASSWORD_CONSTRAINTS, PUBLIC_DEPLOYMENT_TTL_SECONDS, type PingResponse, type Plan, type PlanChangeRequest, type PlanChangeResponse, type PlanDestination, type PlansResponse, type PlatformLimits, type RequestResult, type ResourceContext, SHIP_ENV, SHIP_VIA_ENV, SIGN_IN_RETURN_PARAM, type SPACheckDebug, type SPACheckRequest, type SPACheckResponse, SPA_CHECK_CONSTRAINTS, SPA_DEFAULT_CONFIG, type ScheduledChange, type SetupInstructionsResponse, Ship, type ShipClientOptions, ShipError, type ShipEvents, type ShipRequestInit, type StaticFile, TTL_CONSTRAINTS, type Token, type TokenCreateOptions, type TokenCreateResponse, type TokenDeleteResponse, TokenKind, type TokenKindType, type TokenListResponse, type TokenProvider, type TokenResource, type Transport, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, type UploadedFile, type UserVisibleActivityEvent, type ValidatableFile, type ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, allValidFilesReady, assertShipJsonSyntax, calculateMD5, classifyToken, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, deserializeLabels, extractSubdomain, filterJunk, formatDuration, formatFileSize, formatTimeRemaining, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isCustomDomain, isDeployment, isPlatformDomain, isShipError, normalizeVia, optimizeDeployPaths, pluralize, processFilesForBrowser, readBearerValue, serializeLabels, validateApiKey, validateApiUrl, validateBuildCommand, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validateOAuthToken, validateOutputDir, validatePassword, validateToken, validateTtl };
|
|
3637
|
+
export { ACCOUNT_HEADER, API_KEY, API_PATHS, AUTH_BASE_PATH, type Account, type AccountAccess, type AccountDeleteResponse, type AccountGetResponse, type AccountKeyResponse, AccountPlan, type AccountPlanType, type AccountResource, type AccountRole, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, BUILD_SETTINGS, type BillingInterval, type BillingPortalSession, type BillingSyncResponse, type BuildFailureDetails, CALLER, type Caps, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_FIELDS, DEPLOY_FILE_GRAMMAR, DEPLOY_TOKEN, type DeployBodyContext, type DeployFile, type DeployFileEncoding, type DeployFileSpec, type DeployInput, type DeployTransport, type Deployment, type DeploymentCreateResponse, type DeploymentDeleteResponse, type DeploymentListResponse, type DeploymentOptions, type DeploymentResource, type DeploymentResourceContext, type DeploymentSetOptions, DeploymentStatus, type DeploymentStatusType, type DeploymentUploadOptions, DeploymentVia, type DeploymentViaType, type DnsLookup, type DnsProvider, type DnsRecord, type DnsRecordType, type Domain, type DomainDeleteResponse, type DomainDnsResponse, type DomainListResponse, type DomainRecordsResponse, type DomainResource, type DomainSetOptions, type DomainSetResult, type DomainShareResponse, DomainStatus, type DomainStatusType, type DomainValidateResponse, DomainVerification, type DomainVerificationType, type DomainVerifyResponse, type ErrorResponse, ErrorType, type ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, type Fetch, type FileValidationResult, FileValidationStatus, type FileValidationStatusType, IDEMPOTENCY_KEY_CONSTRAINTS, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, type LabelsResponse, type ListOptions, type ListResponse, type MD5Result, MY_API_KEY_URL, OAUTH_TOKEN, OAuthScope, type OAuthScopeType, PASSWORD_CONSTRAINTS, PUBLIC_DEPLOYMENT_TTL_SECONDS, type PingResponse, type Plan, type PlanChangeRequest, type PlanChangeResponse, type PlanDestination, type PlansResponse, type PlatformLimits, type RequestResult, type ResourceContext, SETUP_TROUBLESHOOTING_ANCHOR, SHIP_ENV, SHIP_VIA_ENV, SIGN_IN_RETURN_PARAM, type SPACheckDebug, type SPACheckRequest, type SPACheckResponse, SPA_CHECK_CONSTRAINTS, SPA_DEFAULT_CONFIG, type ScheduledChange, type SetupInstructionsResponse, Ship, type ShipClientOptions, ShipError, type ShipEvents, type ShipRequestInit, type StaticFile, TTL_CONSTRAINTS, type Token, type TokenCreateOptions, type TokenCreateResponse, type TokenDeleteResponse, TokenKind, type TokenKindType, type TokenListResponse, type TokenProvider, type TokenResource, type Transport, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, type UploadedFile, type UserVisibleActivityEvent, type ValidatableFile, type ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, allValidFilesReady, assertShipJsonSyntax, calculateMD5, classifyToken, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, deserializeLabels, extractSubdomain, filterJunk, formatDuration, formatFileSize, formatTimeRemaining, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isCustomDomain, isDeployment, isPlatformDomain, isShipError, normalizeVia, optimizeDeployPaths, pluralize, processFilesForBrowser, readBearerValue, serializeLabels, validateApiKey, validateApiUrl, validateBuildCommand, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validateOAuthToken, validateOutputDir, validatePassword, validateToken, validateTtl };
|
package/dist/browser.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var pt=Object.create;var B=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var ft=Object.getOwnPropertyNames;var dt=Object.getPrototypeOf,mt=Object.prototype.hasOwnProperty;var ht=(e,n,t)=>n in e?B(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var _=(e,n)=>()=>(e&&(n=e(e=0)),n);var Ie=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),yt=(e,n)=>{for(var t in n)B(e,t,{get:n[t],enumerable:!0})},Et=(e,n,t,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of ft(n))!mt.call(e,l)&&l!==t&&B(e,l,{get:()=>n[l],enumerable:!(a=ct(n,l))||a.enumerable});return e};var G=(e,n,t)=>(t=e!=null?pt(dt(e)):{},Et(n||!e||!e.__esModule?B(t,"default",{value:e,enumerable:!0}):t,e));var z=(e,n,t)=>ht(e,typeof n!="symbol"?n+"":n,t);function on(e){if(!e||typeof e!="string")return;let n=e.trim().toLowerCase();return Object.values(gt).includes(n)?n:void 0}function _e(e){if(e==null)return;if(typeof e!="string")throw d.validation("Idempotency key must be a string.");let n=e.trim();if(!n)throw d.validation("Idempotency key must not be empty.");if(n.length>F.MAX_LENGTH)throw d.validation(`Idempotency key must be at most ${F.MAX_LENGTH} characters.`);return n}function St(e){let n=e.code;return n==="ERR_INVALID_URL"?!1:typeof n=="string"?!0:e instanceof TypeError?!/\burl\b/i.test(e.message):!1}function Le(e){return e!==null&&typeof e=="object"&&"name"in e&&e.name==="ShipError"&&"status"in e}function Rt(e){let n=e.replace(/\\/g,"/").split("/").pop()??"",t=n.lastIndexOf(".");return t<=0||t===n.length-1?null:n.slice(t+1).toLowerCase()}function Ne(e,n){let t=Rt(e);return t===null?!1:Array.isArray(n)?n.includes(t):n.has(t)}function Pe(e){return It.test(e)}function K(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(t=>_t.has(t))}function Lt(e){return e.startsWith(we.PREFIX)?O.API_KEY:e.startsWith(xe.PREFIX)?O.DEPLOY_TOKEN:e.startsWith(Oe.PREFIX)?O.OAUTH:O.OPAQUE}function fn(e){return e.slice(0,oe.length).toLowerCase()!==oe?null:e.slice(oe.length)||null}function Fe(e){let n=e.charCodeAt(0)===65279?e.slice(1):e,t;try{t=JSON.parse(n)}catch(a){throw d.config(`invalid JSON format in config: ${a.message}`,{filePath:P})}if(t===null||typeof t!="object"||Array.isArray(t))throw d.config(`${P} must contain a JSON object`,{filePath:P})}function ae(e,n,t){if(!e.startsWith(n.PREFIX))throw d.validation(`${t} must start with "${n.PREFIX}"`);if(e.length!==n.TOTAL_LENGTH)throw d.validation(`${t} must be ${n.TOTAL_LENGTH} characters total (${n.PREFIX} + ${n.HEX_LENGTH} hex chars)`);let a=e.slice(n.PREFIX.length);if(!new RegExp(`^[a-f0-9]{${n.HEX_LENGTH}}$`,"i").test(a))throw d.validation(`${t} must contain ${n.HEX_LENGTH} hexadecimal characters after "${n.PREFIX}" prefix`)}function Nt(e){ae(e,we,"API key")}function Pt(e){ae(e,xe,"Deploy token")}function wt(e){ae(e,Oe,"OAuth access token")}function le(e){switch(Lt(e)){case O.API_KEY:Nt(e);return;case O.DEPLOY_TOKEN:Pt(e);return;case O.OAUTH:wt(e);return;case O.OPAQUE:if(!e)throw d.validation("Token must be a non-empty string")}}function Ce(e){if(!e||e.length>M.MAX_LENGTH||!M.PATTERN.test(e))throw d.validation(`Caller must be 1-${M.MAX_LENGTH} characters: letters, digits, dots, underscores, or hyphens`)}function mn(e){try{let n=new URL(e);if(!["http:","https:"].includes(n.protocol))throw d.validation("API URL must use http:// or https:// protocol");if(n.pathname!=="/"&&n.pathname!=="")throw d.validation("API URL must not contain a path");if(n.search||n.hash)throw d.validation("API URL must not contain query parameters or fragments")}catch(n){throw Le(n)?n:d.validation("API URL must be a valid URL")}}function hn(e){return/^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(e)}function ue(e){if(e!=null){if(typeof e!="number"||!Number.isFinite(e))throw d.validation("TTL must be a number of seconds");if(!Number.isInteger(e))throw d.validation("TTL must be a whole number of seconds");if(e<k.MIN_SECONDS||e>k.MAX_SECONDS)throw d.validation(`TTL must be between ${k.MIN_SECONDS} and ${k.MAX_SECONDS} seconds`);return e}}function xt(e){let n=Math.round(e/60);if(!(n>=1))return"less than a minute";if(n<120)return se(n,"minute");let t=Math.round(e/3600);return t<48?se(t,"hour"):se(Math.round(e/86400),"day")}function Tn(e,n=Date.now()/1e3){let t=e-n;return t>0?xt(t):null}function se(e,n){return`${e} ${n}${e===1?"":"s"}`}function $(e,n=1){if(e===0)return"0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],l=Math.floor(Math.log(e)/Math.log(t));return`${Number.parseFloat((e/t**l).toFixed(n))} ${a[l]}`}function Me(e,n){return e.endsWith(`.${n}`)}function Dn(e,n){return!Me(e,n)}function Sn(e,n){return Me(e,n)?e.slice(0,-(n.length+1)):null}function Rn(e){return`https://${e}`}function bn(e){return`https://${e}`}function In(e){return!e||e.length===0?null:JSON.stringify(e)}function _n(e){if(!e)return[];try{let n=JSON.parse(e);return Array.isArray(n)?n:[]}catch{return[]}}function $e(e){if(e==null||e==="")return;if(typeof e!="string")throw d.validation("Build command must be a string");let n=e.trim();if(n.length===0||n.length>U.COMMAND_MAX_LENGTH)throw d.validation(`Build command must be between 1 and ${U.COMMAND_MAX_LENGTH} characters`);if(/[\x00-\x1f\x7f]/.test(n))throw d.validation("Build command must be a single line");return n}function He(e){if(e==null||e==="")return;if(typeof e!="string")throw d.validation("Output folder must be a string");let n=e.trim().replace(/\/+$/,"");if(n.length===0||n.length>U.OUTPUT_DIR_MAX_LENGTH)throw d.validation(`Output folder must be between 1 and ${U.OUTPUT_DIR_MAX_LENGTH} characters`);if(!U.OUTPUT_DIR_PATTERN.test(n)||n.split("/").some(t=>t===".."||t==="."))throw d.validation("Output folder must be a relative path inside the project, like dist or dist/site");return n}function ce(e){if(e==null)return;if(typeof e!="string")throw d.validation("Password must be a string");let n=e.trim();if(n.length<V.MIN_LENGTH||n.length>V.MAX_LENGTH)throw d.validation(`Password must be between ${V.MIN_LENGTH} and ${V.MAX_LENGTH} characters`);return n}var tn,gt,nn,rn,F,sn,T,I,an,y,At,re,Tt,Dt,d,bt,ln,It,_t,un,pn,ie,we,xe,Oe,M,cn,O,oe,dn,P,ve,X,k,pe,yn,En,gn,An,R,v,Ue,U,V,S=_(()=>{"use strict";tn={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},gt={WEB:"web",SDK:"sdk",CLI:"cli",MCP:"mcp",GIT:"git",N8N:"n8n",GPT:"gpt",VSC:"vsc",CLD:"cld",CRS:"crs",GMN:"gmn",API:"api"},nn={LIVE:"live",UNLINKED:"unlinked",UNVERIFIED:"unverified",PAUSED:"paused"},rn={PENDING:"pending",PARTIAL:"partial",VERIFIED:"verified"},F={HEADER:"Idempotency-Key",MAX_LENGTH:256,WINDOW_SECONDS:1440*60};sn={FREE:"free",PRO:"pro",TEAM:"team",SCALE:"scale",SPONSORED:"sponsored"},T={DEPLOYMENTS:"/deployments",DEPLOYMENT:e=>`/deployments/${e}`,DEPLOYMENT_CONFIG:e=>`/deployments/${e}/config`,DOMAINS:"/domains",DOMAIN:e=>`/domains/${e}`,DOMAIN_VERIFY:e=>`/domains/${e}/verify`,DOMAIN_DNS:e=>`/domains/${e}/dns`,DOMAIN_RECORDS:e=>`/domains/${e}/records`,DOMAIN_SHARE:e=>`/domains/${e}/share`,DOMAIN_PROPAGATION:e=>`/domains/${e}/propagation`,DOMAINS_VALIDATE:"/domains/validate",TOKENS:"/tokens",TOKEN:e=>`/tokens/${e}`,ACCOUNT:"/account",ACCOUNT_KEY:"/account/key",ACCOUNT_CLAIM:"/account/claim",ACTIVITIES:"/activities",LABELS:"/labels",LIMITS:"/limits",PLANS:"/plans",PING:"/ping",SETUP:"/setup",SPA_CHECK:"/spa-check",UPLOAD:"/upload"},I={FILES:"files[]",CHECKSUMS:"checksums",LABELS:"labels",VIA:"via",PASSWORD:"password",TTL:"ttl",BUILD:"build",PRERENDER:"prerender",SPA:"spa",BUILD_COMMAND:"buildCommand",OUTPUT_DIR:"outputDir",CAPTCHA:"captcha"},an={PATH:"path",CONTENT:"content",ENCODING:"encoding",DEFAULT_ENCODING:"utf-8",ENCODINGS:["utf-8","base64"]},y={Validation:"validation_failed",NotFound:"not_found",Forbidden:"forbidden",RateLimit:"rate_limit_exceeded",Authentication:"authentication_failed",Business:"business_logic_error",Api:"internal_server_error",Maintenance:"maintenance",Build:"build_failed",Network:"network_error",Timeout:"timeout_error",Cancelled:"operation_cancelled",File:"file_error",Config:"config_error"},At=new Set([y.Network,y.Timeout,y.Cancelled,y.File,y.Config]),re={client:new Set([y.Build,y.Business,y.Cancelled,y.Config,y.File,y.Forbidden,y.NotFound,y.RateLimit,y.Validation]),network:new Set([y.Network,y.Timeout]),auth:new Set([y.Authentication])},Tt=new Set(Object.values(y).filter(e=>!At.has(e))),Dt=200;d=class e extends Error{constructor(t,a,l,c){super(a);z(this,"type");z(this,"status");z(this,"details");this.type=t,this.status=l,this.details=c,this.name="ShipError"}toResponse(){let t=this.details,a=this.type===y.Authentication&&t?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:a}}static async fromHttpResponse(t,a){let l,c,h;try{if(t.headers.get("content-type")?.includes("application/json")){let f=await t.json();if(f&&typeof f=="object"){let A=f;typeof A.message=="string"?l=A.message:typeof A.error=="string"&&(l=A.error),c=A.details,typeof A.error=="string"&&Tt.has(A.error)&&(h=A.error)}}else{let f=(await t.text()).trim();f&&!f.startsWith("<")&&f.length<=Dt&&(l=f)}}catch{}let E=t.headers.get("retry-after");if(E!==null){let g=E.trim(),f=/^\d+$/.test(g)?Number(g):Math.ceil((Date.parse(g)-Date.now())/1e3);if(Number.isFinite(f)&&f>=0){let A=c&&typeof c=="object"?c:{};A.retryAfter===void 0&&(c={...A,retryAfter:f})}}l=l||`${a||"Request"} failed with status ${t.status}`;let m=h??(t.status===401?y.Authentication:t.status===403?y.Forbidden:t.status===429?y.RateLimit:y.Api);return new e(m,l,t.status,c)}static fromFetchError(t,a){if(Le(t))return t;let l=a||"Request",c=t?.name;return c==="AbortError"?e.cancelled(`${l} was cancelled`):c==="TimeoutError"?e.timeout(`${l} timed out`,{cause:t}):t instanceof Error?St(t)?e.network(`${l} failed: ${t.message}`,{cause:t}):new e(y.Api,`${l} failed: ${t.message}`):new e(y.Api,`${l} failed: Unknown error`)}static validation(t,a){return new e(y.Validation,t,400,a)}static notFound(t,a){let l=a?`${t} ${a} not found`:`${t} not found`;return new e(y.NotFound,l,404)}static forbidden(t,a){return new e(y.Forbidden,t,403,a)}static rateLimit(t="Too many requests",a){return new e(y.RateLimit,t,429,a)}static authentication(t="Authentication required",a){return new e(y.Authentication,t,401,a)}static business(t,a=400,l){return new e(y.Business,t,a,l)}static network(t,a){return new e(y.Network,t,void 0,a)}static timeout(t,a){return new e(y.Timeout,t,void 0,a)}static cancelled(t,a){return new e(y.Cancelled,t,void 0,a)}static file(t,a){return new e(y.File,t,void 0,a)}static config(t,a){return new e(y.Config,t,void 0,a)}static api(t,a=500,l){return new e(y.Api,t,a,l)}static maintenance(t,a){return new e(y.Maintenance,t,503,a)}static build(t,a){return new e(y.Build,t,422,a)}isClientError(){return re.client.has(this.type)?!0:this.status!==void 0&&this.status>=400&&this.status<500}isNetworkError(){return re.network.has(this.type)}isAuthError(){return re.auth.has(this.type)}isType(t){return this.type===t}};bt=["html","htm","xhtml","xml","txt","md","markdown","pdf","csv","json","jsonc","webmanifest","map","toml","yaml","yml","rss","atom","css","scss","sass","less","js","mjs","cjs","jsx","ts","tsx","wasm","vue","svelte","png","jpg","jpeg","gif","webp","avif","svg","ico","bmp","tif","tiff","heic","heif","woff","woff2","ttf","otf","eot","mp3","wav","ogg","oga","opus","m4a","aac","flac","weba","mp4","webm","ogv","mov","m4v","avi","glb","gltf","usdz","vtt","srt","zip"],ln=bt.map(e=>`.${e}`).join(","),It=/[\x00-\x1f\x7f#?%\\<>"]/;_t=new Set(["node_modules","package.json"]);un="/auth",pn="signing-in",ie={SESSION:"session",API_KEY:"apiKey",TOKEN:"token",AGENT:"agent",OAUTH:"oauth",SYSTEM:"system"},we={PREFIX:"ship-",HEX_LENGTH:32,TOTAL_LENGTH:37,HINT_LENGTH:4},xe={PREFIX:"deploy-",HEX_LENGTH:32,TOTAL_LENGTH:39},Oe={PREFIX:"oauth-",HEX_LENGTH:32,TOTAL_LENGTH:38},M={HEADER:"X-Caller",MAX_LENGTH:128,PATTERN:/^[a-zA-Z0-9._-]+$/},cn="X-Account",O={API_KEY:ie.API_KEY,DEPLOY_TOKEN:ie.TOKEN,OAUTH:ie.OAUTH,OPAQUE:"opaque"};oe="bearer ";dn={ACCOUNT_READ:"account:read",DEPLOYMENTS_READ:"deployments:read",DEPLOYMENTS_WRITE:"deployments:write",DOMAINS_READ:"domains:read",DOMAINS_WRITE:"domains:write"},P="ship.json",ve={rewrites:[{source:"/(.*)",destination:"/index.html"}]},X={INDEX_FILE:"index.html",MAX_INDEX_BYTES:100*1024};k={MIN_SECONDS:1,MAX_SECONDS:365*24*60*60};pe="https://api.shipstatic.com",yn={TOKEN:"SHIP_TOKEN",API_URL:"SHIP_API_URL"},En="SHIP_VIA",gn="https://my.shipstatic.com/api-key",An=4320*60;R={PENDING:"pending",PROCESSING_ERROR:"processing_error",EXCLUDED:"excluded",VALIDATION_FAILED:"validation_failed",READY:"ready"};v={MIN_LENGTH:3,MAX_LENGTH:25,MAX_COUNT:10,SEPARATORS:"._-"},Ue=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;U={COMMAND_MAX_LENGTH:200,OUTPUT_DIR_MAX_LENGTH:100,OUTPUT_DIR_PATTERN:/^[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/};V={MIN_LENGTH:6,MAX_LENGTH:128}});var Ve=Ie((ze,ke)=>{"use strict";(function(e){if(typeof ze=="object")ke.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var n;try{n=window}catch{n=self}n.SparkMD5=e()}})(function(e){"use strict";var n=function(p,u){return p+u&4294967295},t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function a(p,u,i,r,s,o){return u=n(n(u,p),n(r,o)),n(u<<s|u>>>32-s,i)}function l(p,u){var i=p[0],r=p[1],s=p[2],o=p[3];i+=(r&s|~r&o)+u[0]-680876936|0,i=(i<<7|i>>>25)+r|0,o+=(i&r|~i&s)+u[1]-389564586|0,o=(o<<12|o>>>20)+i|0,s+=(o&i|~o&r)+u[2]+606105819|0,s=(s<<17|s>>>15)+o|0,r+=(s&o|~s&i)+u[3]-1044525330|0,r=(r<<22|r>>>10)+s|0,i+=(r&s|~r&o)+u[4]-176418897|0,i=(i<<7|i>>>25)+r|0,o+=(i&r|~i&s)+u[5]+1200080426|0,o=(o<<12|o>>>20)+i|0,s+=(o&i|~o&r)+u[6]-1473231341|0,s=(s<<17|s>>>15)+o|0,r+=(s&o|~s&i)+u[7]-45705983|0,r=(r<<22|r>>>10)+s|0,i+=(r&s|~r&o)+u[8]+1770035416|0,i=(i<<7|i>>>25)+r|0,o+=(i&r|~i&s)+u[9]-1958414417|0,o=(o<<12|o>>>20)+i|0,s+=(o&i|~o&r)+u[10]-42063|0,s=(s<<17|s>>>15)+o|0,r+=(s&o|~s&i)+u[11]-1990404162|0,r=(r<<22|r>>>10)+s|0,i+=(r&s|~r&o)+u[12]+1804603682|0,i=(i<<7|i>>>25)+r|0,o+=(i&r|~i&s)+u[13]-40341101|0,o=(o<<12|o>>>20)+i|0,s+=(o&i|~o&r)+u[14]-1502002290|0,s=(s<<17|s>>>15)+o|0,r+=(s&o|~s&i)+u[15]+1236535329|0,r=(r<<22|r>>>10)+s|0,i+=(r&o|s&~o)+u[1]-165796510|0,i=(i<<5|i>>>27)+r|0,o+=(i&s|r&~s)+u[6]-1069501632|0,o=(o<<9|o>>>23)+i|0,s+=(o&r|i&~r)+u[11]+643717713|0,s=(s<<14|s>>>18)+o|0,r+=(s&i|o&~i)+u[0]-373897302|0,r=(r<<20|r>>>12)+s|0,i+=(r&o|s&~o)+u[5]-701558691|0,i=(i<<5|i>>>27)+r|0,o+=(i&s|r&~s)+u[10]+38016083|0,o=(o<<9|o>>>23)+i|0,s+=(o&r|i&~r)+u[15]-660478335|0,s=(s<<14|s>>>18)+o|0,r+=(s&i|o&~i)+u[4]-405537848|0,r=(r<<20|r>>>12)+s|0,i+=(r&o|s&~o)+u[9]+568446438|0,i=(i<<5|i>>>27)+r|0,o+=(i&s|r&~s)+u[14]-1019803690|0,o=(o<<9|o>>>23)+i|0,s+=(o&r|i&~r)+u[3]-187363961|0,s=(s<<14|s>>>18)+o|0,r+=(s&i|o&~i)+u[8]+1163531501|0,r=(r<<20|r>>>12)+s|0,i+=(r&o|s&~o)+u[13]-1444681467|0,i=(i<<5|i>>>27)+r|0,o+=(i&s|r&~s)+u[2]-51403784|0,o=(o<<9|o>>>23)+i|0,s+=(o&r|i&~r)+u[7]+1735328473|0,s=(s<<14|s>>>18)+o|0,r+=(s&i|o&~i)+u[12]-1926607734|0,r=(r<<20|r>>>12)+s|0,i+=(r^s^o)+u[5]-378558|0,i=(i<<4|i>>>28)+r|0,o+=(i^r^s)+u[8]-2022574463|0,o=(o<<11|o>>>21)+i|0,s+=(o^i^r)+u[11]+1839030562|0,s=(s<<16|s>>>16)+o|0,r+=(s^o^i)+u[14]-35309556|0,r=(r<<23|r>>>9)+s|0,i+=(r^s^o)+u[1]-1530992060|0,i=(i<<4|i>>>28)+r|0,o+=(i^r^s)+u[4]+1272893353|0,o=(o<<11|o>>>21)+i|0,s+=(o^i^r)+u[7]-155497632|0,s=(s<<16|s>>>16)+o|0,r+=(s^o^i)+u[10]-1094730640|0,r=(r<<23|r>>>9)+s|0,i+=(r^s^o)+u[13]+681279174|0,i=(i<<4|i>>>28)+r|0,o+=(i^r^s)+u[0]-358537222|0,o=(o<<11|o>>>21)+i|0,s+=(o^i^r)+u[3]-722521979|0,s=(s<<16|s>>>16)+o|0,r+=(s^o^i)+u[6]+76029189|0,r=(r<<23|r>>>9)+s|0,i+=(r^s^o)+u[9]-640364487|0,i=(i<<4|i>>>28)+r|0,o+=(i^r^s)+u[12]-421815835|0,o=(o<<11|o>>>21)+i|0,s+=(o^i^r)+u[15]+530742520|0,s=(s<<16|s>>>16)+o|0,r+=(s^o^i)+u[2]-995338651|0,r=(r<<23|r>>>9)+s|0,i+=(s^(r|~o))+u[0]-198630844|0,i=(i<<6|i>>>26)+r|0,o+=(r^(i|~s))+u[7]+1126891415|0,o=(o<<10|o>>>22)+i|0,s+=(i^(o|~r))+u[14]-1416354905|0,s=(s<<15|s>>>17)+o|0,r+=(o^(s|~i))+u[5]-57434055|0,r=(r<<21|r>>>11)+s|0,i+=(s^(r|~o))+u[12]+1700485571|0,i=(i<<6|i>>>26)+r|0,o+=(r^(i|~s))+u[3]-1894986606|0,o=(o<<10|o>>>22)+i|0,s+=(i^(o|~r))+u[10]-1051523|0,s=(s<<15|s>>>17)+o|0,r+=(o^(s|~i))+u[1]-2054922799|0,r=(r<<21|r>>>11)+s|0,i+=(s^(r|~o))+u[8]+1873313359|0,i=(i<<6|i>>>26)+r|0,o+=(r^(i|~s))+u[15]-30611744|0,o=(o<<10|o>>>22)+i|0,s+=(i^(o|~r))+u[6]-1560198380|0,s=(s<<15|s>>>17)+o|0,r+=(o^(s|~i))+u[13]+1309151649|0,r=(r<<21|r>>>11)+s|0,i+=(s^(r|~o))+u[4]-145523070|0,i=(i<<6|i>>>26)+r|0,o+=(r^(i|~s))+u[11]-1120210379|0,o=(o<<10|o>>>22)+i|0,s+=(i^(o|~r))+u[2]+718787259|0,s=(s<<15|s>>>17)+o|0,r+=(o^(s|~i))+u[9]-343485551|0,r=(r<<21|r>>>11)+s|0,p[0]=i+p[0]|0,p[1]=r+p[1]|0,p[2]=s+p[2]|0,p[3]=o+p[3]|0}function c(p){var u=[],i;for(i=0;i<64;i+=4)u[i>>2]=p.charCodeAt(i)+(p.charCodeAt(i+1)<<8)+(p.charCodeAt(i+2)<<16)+(p.charCodeAt(i+3)<<24);return u}function h(p){var u=[],i;for(i=0;i<64;i+=4)u[i>>2]=p[i]+(p[i+1]<<8)+(p[i+2]<<16)+(p[i+3]<<24);return u}function E(p){var u=p.length,i=[1732584193,-271733879,-1732584194,271733878],r,s,o,b,N,x;for(r=64;r<=u;r+=64)l(i,c(p.substring(r-64,r)));for(p=p.substring(r-64),s=p.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<s;r+=1)o[r>>2]|=p.charCodeAt(r)<<(r%4<<3);if(o[r>>2]|=128<<(r%4<<3),r>55)for(l(i,o),r=0;r<16;r+=1)o[r]=0;return b=u*8,b=b.toString(16).match(/(.*?)(.{0,8})$/),N=parseInt(b[2],16),x=parseInt(b[1],16)||0,o[14]=N,o[15]=x,l(i,o),i}function m(p){var u=p.length,i=[1732584193,-271733879,-1732584194,271733878],r,s,o,b,N,x;for(r=64;r<=u;r+=64)l(i,h(p.subarray(r-64,r)));for(p=r-64<u?p.subarray(r-64):new Uint8Array(0),s=p.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<s;r+=1)o[r>>2]|=p[r]<<(r%4<<3);if(o[r>>2]|=128<<(r%4<<3),r>55)for(l(i,o),r=0;r<16;r+=1)o[r]=0;return b=u*8,b=b.toString(16).match(/(.*?)(.{0,8})$/),N=parseInt(b[2],16),x=parseInt(b[1],16)||0,o[14]=N,o[15]=x,l(i,o),i}function g(p){var u="",i;for(i=0;i<4;i+=1)u+=t[p>>i*8+4&15]+t[p>>i*8&15];return u}function f(p){var u;for(u=0;u<p.length;u+=1)p[u]=g(p[u]);return p.join("")}f(E("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(n=function(p,u){var i=(p&65535)+(u&65535),r=(p>>16)+(u>>16)+(i>>16);return r<<16|i&65535}),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function p(u,i){return u=u|0||0,u<0?Math.max(u+i,0):Math.min(u,i)}ArrayBuffer.prototype.slice=function(u,i){var r=this.byteLength,s=p(u,r),o=r,b,N,x,be;return i!==e&&(o=p(i,r)),s>o?new ArrayBuffer(0):(b=o-s,N=new ArrayBuffer(b),x=new Uint8Array(N),be=new Uint8Array(this,s,b),x.set(be),N)}})();function A(p){return/[\u0080-\uFFFF]/.test(p)&&(p=unescape(encodeURIComponent(p))),p}function L(p,u){var i=p.length,r=new ArrayBuffer(i),s=new Uint8Array(r),o;for(o=0;o<i;o+=1)s[o]=p.charCodeAt(o);return u?s:r}function C(p){return String.fromCharCode.apply(null,new Uint8Array(p))}function ne(p,u,i){var r=new Uint8Array(p.byteLength+u.byteLength);return r.set(new Uint8Array(p)),r.set(new Uint8Array(u),p.byteLength),i?r:r.buffer}function w(p){var u=[],i=p.length,r;for(r=0;r<i-1;r+=2)u.push(parseInt(p.substr(r,2),16));return String.fromCharCode.apply(String,u)}function D(){this.reset()}return D.prototype.append=function(p){return this.appendBinary(A(p)),this},D.prototype.appendBinary=function(p){this._buff+=p,this._length+=p.length;var u=this._buff.length,i;for(i=64;i<=u;i+=64)l(this._hash,c(this._buff.substring(i-64,i)));return this._buff=this._buff.substring(i-64),this},D.prototype.end=function(p){var u=this._buff,i=u.length,r,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o;for(r=0;r<i;r+=1)s[r>>2]|=u.charCodeAt(r)<<(r%4<<3);return this._finish(s,i),o=f(this._hash),p&&(o=w(o)),this.reset(),o},D.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},D.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},D.prototype.setState=function(p){return this._buff=p.buff,this._length=p.length,this._hash=p.hash,this},D.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},D.prototype._finish=function(p,u){var i=u,r,s,o;if(p[i>>2]|=128<<(i%4<<3),i>55)for(l(this._hash,p),i=0;i<16;i+=1)p[i]=0;r=this._length*8,r=r.toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(r[2],16),o=parseInt(r[1],16)||0,p[14]=s,p[15]=o,l(this._hash,p)},D.hash=function(p,u){return D.hashBinary(A(p),u)},D.hashBinary=function(p,u){var i=E(p),r=f(i);return u?w(r):r},D.ArrayBuffer=function(){this.reset()},D.ArrayBuffer.prototype.append=function(p){var u=ne(this._buff.buffer,p,!0),i=u.length,r;for(this._length+=p.byteLength,r=64;r<=i;r+=64)l(this._hash,h(u.subarray(r-64,r)));return this._buff=r-64<i?new Uint8Array(u.buffer.slice(r-64)):new Uint8Array(0),this},D.ArrayBuffer.prototype.end=function(p){var u=this._buff,i=u.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],s,o;for(s=0;s<i;s+=1)r[s>>2]|=u[s]<<(s%4<<3);return this._finish(r,i),o=f(this._hash),p&&(o=w(o)),this.reset(),o},D.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},D.ArrayBuffer.prototype.getState=function(){var p=D.prototype.getState.call(this);return p.buff=C(p.buff),p},D.ArrayBuffer.prototype.setState=function(p){return p.buff=L(p.buff,!0),D.prototype.setState.call(this,p)},D.ArrayBuffer.prototype.destroy=D.prototype.destroy,D.ArrayBuffer.prototype._finish=D.prototype._finish,D.ArrayBuffer.hash=function(p,u){var i=m(new Uint8Array(p)),r=f(i);return u?w(r):r},D})});var j=Ie((Cn,Ke)=>{"use strict";Ke.exports={}});async function Bt(e){let n=(await Promise.resolve().then(()=>G(Ve(),1))).default,t=new n.ArrayBuffer,a=2097152;for(let l=0;l<e.size;l+=a){let c=Math.min(l+a,e.size);t.append(await e.slice(l,c).arrayBuffer())}return{md5:t.end()}}async function Gt(e){let{createHash:n}=await Promise.resolve().then(()=>G(j(),1)),t=n("md5");return t.update(e),{md5:t.digest("hex")}}async function zt(e){let{createHash:n}=await Promise.resolve().then(()=>G(j(),1)),{createReadStream:t}=await Promise.resolve().then(()=>G(j(),1));return new Promise((a,l)=>{let c=n("md5"),h=t(e);h.on("error",E=>l(d.file(`Failed to read file for MD5: ${E.message}`,{filePath:e}))),h.on("data",E=>c.update(E)),h.on("end",()=>a({md5:c.digest("hex")}))})}async function W(e){if(e instanceof Blob)return Bt(e);if(typeof Buffer<"u"&&Buffer.isBuffer(e))return Gt(e);if(typeof e=="string")return zt(e);throw d.business("Invalid input for MD5 calculation")}var J=_(()=>{"use strict";S()});function ee(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var Qe=_(()=>{"use strict"});function Ze(e,n={}){if(n.flatten===!1)return e.map(a=>({path:ee(a),name:de(a)}));let t=Xt(e);return e.map(a=>{let l=ee(a);if(t){let c=t.endsWith("/")?t:`${t}/`;l.startsWith(c)&&(l=l.substring(c.length))}return l||(l=de(a)),{path:l,name:de(a)}})}function Xt(e){if(!e.length)return"";let t=e.map(c=>ee(c)).map(c=>c.split("/")),a=[],l=Math.min(...t.map(c=>c.length));for(let c=0;c<l-1;c++){let h=t[0][c];if(t.every(E=>E[c]===h))a.push(h);else break}return a.join("/")}function de(e){return e.split(/[/\\]/).pop()||e}var me=_(()=>{"use strict";Qe()});function ir(e){he=e}function qt(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function et(){return he||qt()}var he,ye=_(()=>{"use strict";he=null});function te(e,n){return Yt.find(t=>t.broken(e,n))}var Yt,ge=_(()=>{"use strict";S();Ae();Yt=[{name:"name",broken:({path:e})=>!Ee(e).valid,sentence:({path:e})=>Ee(e).reason??"Invalid file name"},{name:"extension",broken:({path:e},n)=>Ne(e,n.blockedExtensions??[]),sentence:({path:e})=>`File extension not allowed: "${e}"`},{name:"fileSize",broken:({size:e},n)=>e>n.maxFileSize,sentence:({path:e},n)=>`File "${e}" too large. Maximum ${$(n.maxFileSize)} allowed`},{name:"totalSize",broken:({totalSize:e},n)=>e>n.maxTotalSize,sentence:({totalSize:e},n)=>`Total upload size too large. ${$(e)} exceeds maximum of ${$(n.maxTotalSize)}`}]});function Ee(e){if(Pe(e))return{valid:!1,reason:"File name contains unsafe characters"};if(e.startsWith(" ")||e.endsWith(" "))return{valid:!1,reason:"File name cannot start/end with spaces"};if(e.endsWith("."))return{valid:!1,reason:"File name cannot end with dots"};let n=/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|$)/i,t=e.split("/").pop()||e;return n.test(t)?{valid:!1,reason:"File name uses a reserved system name"}:e.includes("..")?{valid:!1,reason:"File name contains path traversal pattern"}:{valid:!0}}function cr(e,n){let t=[],a=[],l=[];if(e.length===0){let m={file:"(no files)",message:"At least one file must be provided"};return t.push(m),{files:[],validFiles:[],errors:t,warnings:[],canDeploy:!1}}for(let m of e)if(K(m.name))return t.push({file:m.name,message:"Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder"}),{files:e.map(g=>({...g,status:R.VALIDATION_FAILED,statusMessage:"Unbuilt project detected"})),validFiles:[],errors:t,warnings:[],canDeploy:!1};if(e.length>n.maxFilesCount){let m={file:`(${e.length} files)`,message:`File count (${e.length}) exceeds limit of ${n.maxFilesCount}`};return t.push(m),{files:e.map(g=>({...g,status:R.VALIDATION_FAILED,statusMessage:m.message})),validFiles:[],errors:t,warnings:[],canDeploy:!1}}let c=0;for(let m of e){let g=R.READY,f="Ready for upload";if(m.status===R.PROCESSING_ERROR)g=R.VALIDATION_FAILED,f=m.statusMessage||"File failed during processing",t.push({file:m.name,message:f});else if(m.size===0){g=R.EXCLUDED,f="File is empty (0 bytes) and cannot be deployed due to storage limitations",a.push({file:m.name,message:f}),l.push({...m,status:g,statusMessage:f});continue}else if(m.size<0)g=R.VALIDATION_FAILED,f="File size must be positive",t.push({file:m.name,message:f});else if(!m.name||m.name.trim().length===0)g=R.VALIDATION_FAILED,f="File name cannot be empty",t.push({file:m.name||"(empty)",message:f});else if(m.name.includes("\0"))g=R.VALIDATION_FAILED,f="File name contains invalid characters (null byte)",t.push({file:m.name,message:f});else{let A={path:m.name,size:m.size,totalSize:c+m.size},L=te(A,n);L?(g=R.VALIDATION_FAILED,f=L.sentence(A,n),t.push({file:L.name==="totalSize"?`(${e.length} files)`:m.name,message:f})):c=A.totalSize}l.push({...m,status:g,statusMessage:f})}t.length>0&&(l=l.map(m=>m.status===R.EXCLUDED?m:{...m,status:R.VALIDATION_FAILED,statusMessage:m.status===R.VALIDATION_FAILED?m.statusMessage:"Deployment failed due to validation errors in bundle"}));let h=t.length===0?l.filter(m=>m.status===R.READY):[],E=t.length===0;return{files:l,validFiles:h,errors:t,warnings:a,canDeploy:E}}function jt(e){return e.filter(n=>n.status===R.READY)}function fr(e){return jt(e).length>0}var Ae=_(()=>{"use strict";S();ge();S()});function tt(e){return Jt.test(e)}var Wt,Jt,nt=_(()=>{"use strict";Wt=["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^[Dd]esktop\\.ini$","@eaDir$"],Jt=new RegExp(Wt.join("|"))});function rt(e,n){if(!e||e.length===0)return[];if(!n?.allowUnbuilt&&e.find(a=>a&&K(a)))throw d.business("Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder");return e.filter(t=>{if(!t)return!1;let a=t.replace(/\\/g,"/").split("/").filter(Boolean);if(a.length===0)return!0;let l=a[a.length-1];if(tt(l))return!1;for(let h of a)if(h!==".well-known"&&(h.startsWith(".")||h.length>255))return!1;let c=a.slice(0,-1);for(let h of c)if(Qt.some(E=>h.toLowerCase()===E.toLowerCase()))return!1;return!0})}var Qt,Te=_(()=>{"use strict";S();nt();Qt=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function it(e,n){if(e.includes("\0")||e.includes("/../")||e.startsWith("../")||e.endsWith("/.."))throw d.business(`Security error: Unsafe file path "${e}" for file: ${n}`)}function ot(e,n){let t=te(e,n);if(t)throw d.business(t.sentence(e,n))}var De=_(()=>{"use strict";S();ge()});async function st(e,n={},t){let a=!!(n.build||n.prerender),l=Ze(e.map(f=>f.path),{flatten:n.pathDetect!==!1}).map(f=>f.path),c=new Set(rt(l,{allowUnbuilt:a})),h=e.map((f,A)=>({source:f,deployPath:l[A]})).filter(({deployPath:f})=>c.has(f));if(h.length===0)return[];let E=a?null:Zt(t),m=[],g=0;for(let{source:f,deployPath:A}of h){if(E&&it(A,f.origin),f.size===0)continue;E&&(g+=f.size,ot({path:A,size:f.size,totalSize:g},E));let L=await f.read(),{md5:C}=await W(L);m.push({path:A,content:L,size:f.size,md5:C})}if(E&&m.length>E.maxFilesCount)throw d.business(`Too many files to deploy. Maximum allowed is ${E.maxFilesCount} files.`);return m}function Zt(e){if(!e)throw d.config("Platform limits not provided. Deploy-mode validation requires the limits argument \u2014 pass `ship.getLimits()` result.");return e}var at=_(()=>{"use strict";S();me();Te();J();De()});var ut={};yt(ut,{processFilesForBrowser:()=>lt});async function lt(e,n={},t){if(et()!=="browser")throw d.business("processFilesForBrowser can only be called in a browser environment.");return st(e.map(a=>({path:a.webkitRelativePath||a.name,origin:a.name,size:a.size,read:async()=>a})),n,t)}var Se=_(()=>{"use strict";S();at();ye()});S();S();S();var q=class{constructor(){this.handlers=new Map}on(n,t){this.handlers.has(n)||this.handlers.set(n,new Set),this.handlers.get(n)?.add(t)}off(n,t){let a=this.handlers.get(n);a&&(a.delete(t),a.size===0&&this.handlers.delete(n))}emit(n,...t){let a=this.handlers.get(n);if(!a)return;let l=Array.from(a);for(let c of l)try{c(...t)}catch(h){a.delete(c),n!=="error"&&setTimeout(()=>{let E=h instanceof Error?h:new Error(String(h));this.emit("error",E,String(n))},0)}}};var Ot=3e4,vt=2,Ft=300,Ct=2e3,Mt=new Set([500,502,503,504]);function Ut(e,n){return new Promise((t,a)=>{if(n?.aborted){a(n.reason);return}let l=()=>{clearTimeout(h),n?.removeEventListener("abort",c)},c=()=>{l(),a(n?.reason)},h=setTimeout(()=>{l(),t()},e);n?.addEventListener("abort",c)})}var Be=3e5,$t=3e5,Ht=Be+$t,Y=class extends q{constructor(t){super();this.globalHeaders={};this.apiUrl=t.apiUrl||pe,this.getAuthHeadersCallback=t.getAuthHeaders,this.session=t.session??!1,this.caller=t.caller,this.timeout=t.timeout??Ot,this.maxRetries=Math.max(0,t.maxRetries??vt),this.fetch=t.fetch??globalThis.fetch.bind(globalThis),this.deploy={endpoint:t.deployEndpoint||T.DEPLOYMENTS,timeout:t.timeout??Be,buildTimeout:t.timeout??Ht}}setGlobalHeaders(t){this.globalHeaders=t}async executeRequest(t,a,l,c=this.timeout){for(let h=0;;h++)try{return await this.attemptOnce(t,a,l,c)}catch(E){let m=d.fromFetchError(E,l);if(h>=this.maxRetries||!this.isRetryable(m,a))throw this.emit("error",m,t),m;this.emit("retry",m,t,h+1);let g=Math.min(Ct,Ft*2**h);try{await Ut(Math.random()*g,a.signal)}catch(f){let A=d.fromFetchError(f,l);throw this.emit("error",A,t),A}}}isRetryable(t,a){if(a.signal?.aborted||t.isType(y.Maintenance)||t.isType(y.Cancelled)||!(t.isNetworkError()||t.status!==void 0&&Mt.has(t.status)))return!1;let c=(a.method??"GET").toUpperCase();return c==="GET"||c==="HEAD"?!0:c==="PUT"||c==="DELETE"?!1:this.hasIdempotencyKey(a.headers)}hasIdempotencyKey(t){if(!t)return!1;let a=F.HEADER.toLowerCase();return Object.keys(t).some(l=>l.toLowerCase()===a)}async attemptOnce(t,a,l,c=this.timeout){let h=()=>{};try{let E=await this.mergeHeaders(a.headers),m=this.createTimeoutSignal(a.signal,c);h=m.cleanup;let g={...a,headers:E,credentials:this.session&&!E.Authorization?"include":void 0,signal:m.signal};this.emit("request",t,g);let f=await this.fetch(t,g);if(h(),!f.ok)throw await d.fromHttpResponse(f,l);return this.emit("response",this.safeClone(f),t),{data:await this.parseResponse(this.safeClone(f)),status:f.status}}catch(E){throw h(),d.fromFetchError(E,l)}}async request(t,a,l,c){let{data:h}=await this.executeRequest(`${this.apiUrl}${t}`,a,l,c);return h}async requestWithStatus(t,a,l){return this.executeRequest(`${this.apiUrl}${t}`,a,l)}async mergeHeaders(t={}){return{...this.globalHeaders,...this.caller?{[M.HEADER]:this.caller}:{},...await this.getAuthHeadersCallback(),...t}}createTimeoutSignal(t,a=this.timeout){let l=new AbortController,c=setTimeout(()=>l.abort(new DOMException(`Timed out after ${a}ms`,"TimeoutError")),a),h=t?()=>l.abort(t.reason):void 0;return t&&h&&(t.addEventListener("abort",h),t.aborted&&l.abort(t.reason)),{signal:l.signal,cleanup:()=>{clearTimeout(c),t&&h&&t.removeEventListener("abort",h)}}}safeClone(t){try{return t.clone()}catch{return t}}async parseResponse(t){if(!(t.headers.get("Content-Length")==="0"||t.status===204))return t.json()}};S();S();async function Ge(e,n={}){let{labels:t,via:a,password:l,ttl:c,flags:h,captcha:E}=n,m=new FormData,g=[];for(let f of e){if(typeof f.content=="string"||f.content===null||f.content===void 0)throw d.file(`Unsupported file.content type: ${f.path}`,{filePath:f.path});if(!f.md5)throw d.file(`File missing md5 checksum: ${f.path}`,{filePath:f.path});m.append(I.FILES,new File([f.content],f.path,{type:"application/octet-stream"})),g.push(f.md5)}return m.append(I.CHECKSUMS,JSON.stringify(g)),t&&t.length>0&&m.append(I.LABELS,JSON.stringify(t)),a&&m.append(I.VIA,a),l&&m.append(I.PASSWORD,l),c!==void 0&&m.append(I.TTL,String(c)),h?.build&&m.append(I.BUILD,"true"),h?.prerender&&m.append(I.PRERENDER,"true"),h?.spa&&m.append(I.SPA,"true"),h?.buildCommand&&m.append(I.BUILD_COMMAND,h.buildCommand),h?.outputDir&&m.append(I.OUTPUT_DIR,h.outputDir),E&&m.append(I.CAPTCHA,E),m}S();J();async function kt(){let e=JSON.stringify(ve,null,2),n;typeof Buffer<"u"?n=Buffer.from(e,"utf-8"):n=new Blob([e],{type:"application/json"});let{md5:t}=await W(n);return{path:P,content:n,size:e.length,md5:t}}async function Vt(e,n){let t=e.find(h=>h.path===X.INDEX_FILE||h.path===`/${X.INDEX_FILE}`);if(!t||t.size>X.MAX_INDEX_BYTES)return!1;let a;if(typeof Buffer<"u"&&Buffer.isBuffer(t.content))a=t.content.toString("utf-8");else if(typeof Blob<"u"&&t.content instanceof Blob)a=await t.content.text();else if(typeof File<"u"&&t.content instanceof File)a=await t.content.text();else return!1;let l={files:e.map(h=>h.path),index:a};return(await n.request(T.SPA_CHECK,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)},"SPA check")).isSPA}async function Xe(e,n,t){if(t.spaDetect===!1||t.spa||t.build||t.prerender||e.some(a=>a.path===P))return e;try{if(await Vt(e,n)){let l=await kt();return[...e,l]}}catch{}return e}S();S();function H(e){if(e==null)return;if(e.length===0)return e;if(e.length>v.MAX_COUNT)throw d.validation(`Maximum ${v.MAX_COUNT} labels allowed`);let n=e.map((a,l)=>{if(typeof a!="string")throw d.validation(`Label at index ${l} must be a string`);let c=a.trim().toLowerCase();if(c.length<v.MIN_LENGTH)throw d.validation(`Labels must be at least ${v.MIN_LENGTH} characters long`);if(c.length>v.MAX_LENGTH)throw d.validation(`Labels must be no more than ${v.MAX_LENGTH} characters long`);if(!Ue.test(c))throw d.validation(`Labels must start and end with alphanumeric characters, with optional separators (${v.SEPARATORS}) between segments`);return c}),t=[...new Set(n)];if(t.length!==n.length)throw d.validation("Duplicate labels are not allowed");return t}async function qe(e){let n=e.find(l=>l.path===P||l.path===`/${P}`);if(!n)return;let t=n.content,a=typeof t.text=="function"?await t.text():n.content.toString("utf8");Fe(a)}var Q={"Content-Type":"application/json"},Kt="sdk";function fe(e){let n=new URLSearchParams;e?.limit!==void 0&&n.set("limit",String(e.limit)),e?.cursor!==void 0&&n.set("cursor",e.cursor);let t=n.toString();return t?`?${t}`:""}function Ye(e){let{getApi:n,processInput:t}=e;return{upload:async(a,l={})=>{if(!t)throw d.config("processInput function is not provided.");let c=n(),h=await t(a,l),E=await Xe(h,c,l);if(!E.length)throw d.business("No files to deploy");for(let w of E)if(!w.md5)throw d.file(`MD5 checksum missing for file: ${w.path}`,{filePath:w.path});ce(l.password);let m=ue(l.ttl),g=_e(l.idempotencyKey),f=H(l.labels);await qe(E);let A=$e(l.buildCommand),L=He(l.outputDir),C=l.build||l.prerender||l.spa?{build:l.build,prerender:l.prerender,spa:l.spa,buildCommand:A,outputDir:L}:void 0,ne=await Ge(E,{labels:f,via:l.via??Kt,password:l.password,ttl:m,flags:C,captcha:l.captcha});return c.request(c.deploy.endpoint,{method:"POST",body:ne,...g?{headers:{[F.HEADER]:g}}:{},signal:l.signal||null},"Deploy",l.build||l.prerender?c.deploy.buildTimeout:c.deploy.timeout)},list:async a=>n().request(`${T.DEPLOYMENTS}${fe(a)}`,{method:"GET"},"List deployments"),get:async a=>n().request(T.DEPLOYMENT(encodeURIComponent(a)),{method:"GET"},"Get deployment"),set:async(a,l)=>n().request(T.DEPLOYMENT(encodeURIComponent(a)),{method:"PATCH",headers:Q,body:JSON.stringify({labels:H(l.labels)})},"Update deployment labels"),delete:async a=>n().request(T.DEPLOYMENT(encodeURIComponent(a)),{method:"DELETE"},"Delete deployment")}}function je(e){let{getApi:n}=e;return{set:async(t,a={})=>{let l=H(a.labels),c={};a.deployment&&(c.deployment=a.deployment),l!==void 0&&(c.labels=l);let{data:h,status:E}=await n().requestWithStatus(T.DOMAIN(encodeURIComponent(t)),{method:"PUT",headers:Q,body:JSON.stringify(c)},"Set domain");return{...h,isCreate:E===201}},list:async t=>n().request(`${T.DOMAINS}${fe(t)}`,{method:"GET"},"List domains"),get:async t=>n().request(T.DOMAIN(encodeURIComponent(t)),{method:"GET"},"Get domain"),delete:async t=>n().request(T.DOMAIN(encodeURIComponent(t)),{method:"DELETE"},"Delete domain"),verify:async t=>n().request(T.DOMAIN_VERIFY(encodeURIComponent(t)),{method:"POST"},"Verify domain"),validate:async t=>n().request(T.DOMAINS_VALIDATE,{method:"POST",headers:Q,body:JSON.stringify({domain:t})},"Validate domain"),dns:async t=>n().request(T.DOMAIN_DNS(encodeURIComponent(t)),{method:"GET"},"Get domain DNS"),records:async t=>n().request(T.DOMAIN_RECORDS(encodeURIComponent(t)),{method:"GET"},"Get domain records"),share:async t=>n().request(T.DOMAIN_SHARE(encodeURIComponent(t)),{method:"GET"},"Get domain share")}}function We(e){let{getApi:n}=e;return{get:async()=>n().request(T.ACCOUNT,{method:"GET"},"Get account")}}function Je(e){let{getApi:n}=e;return{create:async(t={})=>{let a=ue(t.ttl),l=H(t.labels),c={};return a!==void 0&&(c.ttl=a),l!==void 0&&(c.labels=l),n().request(T.TOKENS,{method:"POST",headers:Q,body:JSON.stringify(c)},"Create token")},list:async t=>n().request(`${T.TOKENS}${fe(t)}`,{method:"GET"},"List tokens"),get:async t=>n().request(T.TOKEN(encodeURIComponent(t)),{method:"GET"},"Get token"),delete:async t=>n().request(T.TOKEN(encodeURIComponent(t)),{method:"DELETE"},"Delete token")}}var Z=class{constructor(n={}){this.initPromise=null;this.platformLimits=null;this.credential=null;if(n={...n,apiUrl:n.apiUrl||void 0,token:n.token||void 0,caller:n.caller||void 0},this.clientOptions=n,n.caller!==void 0&&Ce(n.caller),n.token&&n.session)throw d.config("Provide either `token` or `session`, not both.");typeof n.token=="string"?(le(n.token),this.credential=n.token):n.token&&(this.credential=n.token),this.http=new Y({...n,getAuthHeaders:()=>this.getAuthHeaders()});let t={getApi:()=>this.http};this.deployments=Ye({...t,processInput:async(a,l)=>(await this.ensureInitialized(),this.processInput(a,l))}),this.domains=je(t),this.account=We(t),this.tokens=Je(t)}async ensureInitialized(){return this.initPromise||(this.initPromise=this.fetchPlatformLimits()),this.initPromise}async fetchPlatformLimits(){try{this.platformLimits=await this.http.request(T.LIMITS,{method:"GET"},"Get limits")}catch(n){throw this.initPromise=null,n}}async ping(){return this.http.request(T.PING,{method:"GET"},"Ping")}async deploy(n,t){return this.deployments.upload(n,t)}async whoami(){return this.account.get()}async getLimits(){return this.platformLimits?this.platformLimits:(await this.ensureInitialized(),this.platformLimits)}on(n,t){this.http.on(n,t)}off(n,t){this.http.off(n,t)}setHeaders(n){this.http.setGlobalHeaders(n)}clearHeaders(){this.http.setGlobalHeaders({})}setToken(n){if(this.clientOptions.session)throw d.config("Provide either `token` or `session`, not both.");if(typeof n=="string"){if(!n)throw d.business("Invalid token provided. Token must be a non-empty string.");le(n),this.credential=n;return}if(typeof n!="function")throw d.business("Invalid token provided. Token must be a non-empty string or a provider function.");this.credential=n}async getAuthHeaders(){if(this.credential===null)return{};let n=typeof this.credential=="function"?await this.credential():this.credential;if(!n)throw d.authentication("Token provider returned no token.");if(typeof n!="string")throw d.authentication("Token provider returned a non-string value.");return{Authorization:`Bearer ${n}`}}};S();S();me();ye();Ae();Te();J();De();function Sr(e,n,t,a=!0){let l=e===1?n:t;return a?`${e} ${l}`:l}Se();var Re=class extends Z{async deploy(n,t){return super.deploy(n,t)}async processInput(n,t){if(!Array.isArray(n)||!n.every(l=>l instanceof File))throw d.business("Invalid input type for browser environment. Expected File[].");if(n.length===0)throw d.business("No files to deploy.");let{processFilesForBrowser:a}=await Promise.resolve().then(()=>(Se(),ut));return a(n,t,this.platformLimits??void 0)}},Yr=Re;export{cn as ACCOUNT_HEADER,we as API_KEY,T as API_PATHS,un as AUTH_BASE_PATH,sn as AccountPlan,Y as ApiHttp,ie as AuthMethod,U as BUILD_SETTINGS,M as CALLER,pe as DEFAULT_API,P as DEPLOYMENT_CONFIG_FILENAME,I as DEPLOY_FIELDS,an as DEPLOY_FILE_GRAMMAR,xe as DEPLOY_TOKEN,tn as DeploymentStatus,gt as DeploymentVia,nn as DomainStatus,rn as DomainVerification,y as ErrorType,R as FILE_VALIDATION_STATUS,R as FileValidationStatus,F as IDEMPOTENCY_KEY_CONSTRAINTS,Qt as JUNK_DIRECTORIES,v as LABEL_CONSTRAINTS,Ue as LABEL_PATTERN,gn as MY_API_KEY_URL,Oe as OAUTH_TOKEN,dn as OAuthScope,V as PASSWORD_CONSTRAINTS,An as PUBLIC_DEPLOYMENT_TTL_SECONDS,yn as SHIP_ENV,En as SHIP_VIA_ENV,pn as SIGN_IN_RETURN_PARAM,X as SPA_CHECK_CONSTRAINTS,ve as SPA_DEFAULT_CONFIG,Re as Ship,d as ShipError,k as TTL_CONSTRAINTS,O as TokenKind,_t as UNBUILT_PROJECT_MARKERS,It as UNSAFE_FILENAME_CHARS,ln as WEB_FILE_ACCEPT,ir as __setTestEnvironment,fr as allValidFilesReady,Fe as assertShipJsonSyntax,W as calculateMD5,Lt as classifyToken,We as createAccountResource,Ye as createDeploymentResource,je as createDomainResource,Je as createTokenResource,Yr as default,_n as deserializeLabels,Sn as extractSubdomain,rt as filterJunk,xt as formatDuration,$ as formatFileSize,Tn as formatTimeRemaining,Rn as generateDeploymentUrl,bn as generateDomainUrl,et as getENV,jt as getValidFiles,K as hasUnbuiltMarker,Pe as hasUnsafeChars,Ne as isBlockedExtension,Dn as isCustomDomain,hn as isDeployment,Me as isPlatformDomain,Le as isShipError,on as normalizeVia,Ze as optimizeDeployPaths,Sr as pluralize,lt as processFilesForBrowser,fn as readBearerValue,In as serializeLabels,Nt as validateApiKey,mn as validateApiUrl,$e as validateBuildCommand,Ce as validateCaller,ot as validateDeployFile,it as validateDeployPath,Pt as validateDeployToken,Ee as validateFileName,cr as validateFiles,_e as validateIdempotencyKey,wt as validateOAuthToken,He as validateOutputDir,ce as validatePassword,le as validateToken,ue as validateTtl};
|
|
1
|
+
var pt=Object.create;var B=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var ft=Object.getOwnPropertyNames;var dt=Object.getPrototypeOf,mt=Object.prototype.hasOwnProperty;var ht=(e,n,t)=>n in e?B(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var _=(e,n)=>()=>(e&&(n=e(e=0)),n);var Ie=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),yt=(e,n)=>{for(var t in n)B(e,t,{get:n[t],enumerable:!0})},Et=(e,n,t,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of ft(n))!mt.call(e,l)&&l!==t&&B(e,l,{get:()=>n[l],enumerable:!(a=ct(n,l))||a.enumerable});return e};var G=(e,n,t)=>(t=e!=null?pt(dt(e)):{},Et(n||!e||!e.__esModule?B(t,"default",{value:e,enumerable:!0}):t,e));var z=(e,n,t)=>ht(e,typeof n!="symbol"?n+"":n,t);function sn(e){if(!e||typeof e!="string")return;let n=e.trim().toLowerCase();return Object.values(gt).includes(n)?n:void 0}function _e(e){if(e==null)return;if(typeof e!="string")throw d.validation("Idempotency key must be a string.");let n=e.trim();if(!n)throw d.validation("Idempotency key must not be empty.");if(n.length>F.MAX_LENGTH)throw d.validation(`Idempotency key must be at most ${F.MAX_LENGTH} characters.`);return n}function Dt(e){let n=e.code;return n==="ERR_INVALID_URL"?!1:typeof n=="string"?!0:e instanceof TypeError?!/\burl\b/i.test(e.message):!1}function Le(e){return e!==null&&typeof e=="object"&&"name"in e&&e.name==="ShipError"&&"status"in e}function Rt(e){let n=e.replace(/\\/g,"/").split("/").pop()??"",t=n.lastIndexOf(".");return t<=0||t===n.length-1?null:n.slice(t+1).toLowerCase()}function Ne(e,n){let t=Rt(e);return t===null?!1:Array.isArray(n)?n.includes(t):n.has(t)}function Pe(e){return It.test(e)}function K(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(t=>_t.has(t))}function Lt(e){return e.startsWith(we.PREFIX)?x.API_KEY:e.startsWith(Oe.PREFIX)?x.DEPLOY_TOKEN:e.startsWith(xe.PREFIX)?x.OAUTH:x.OPAQUE}function dn(e){return e.slice(0,oe.length).toLowerCase()!==oe?null:e.slice(oe.length)||null}function Fe(e){let n=e.charCodeAt(0)===65279?e.slice(1):e,t;try{t=JSON.parse(n)}catch(a){throw d.config(`invalid JSON format in config: ${a.message}`,{filePath:P})}if(t===null||typeof t!="object"||Array.isArray(t))throw d.config(`${P} must contain a JSON object`,{filePath:P})}function ae(e,n,t){if(!e.startsWith(n.PREFIX))throw d.validation(`${t} must start with "${n.PREFIX}"`);if(e.length!==n.TOTAL_LENGTH)throw d.validation(`${t} must be ${n.TOTAL_LENGTH} characters total (${n.PREFIX} + ${n.HEX_LENGTH} hex chars)`);let a=e.slice(n.PREFIX.length);if(!new RegExp(`^[a-f0-9]{${n.HEX_LENGTH}}$`,"i").test(a))throw d.validation(`${t} must contain ${n.HEX_LENGTH} hexadecimal characters after "${n.PREFIX}" prefix`)}function Nt(e){ae(e,we,"API key")}function Pt(e){ae(e,Oe,"Deploy token")}function wt(e){ae(e,xe,"OAuth access token")}function le(e){switch(Lt(e)){case x.API_KEY:Nt(e);return;case x.DEPLOY_TOKEN:Pt(e);return;case x.OAUTH:wt(e);return;case x.OPAQUE:if(!e)throw d.validation("Token must be a non-empty string")}}function Ce(e){if(!e||e.length>M.MAX_LENGTH||!M.PATTERN.test(e))throw d.validation(`Caller must be 1-${M.MAX_LENGTH} characters: letters, digits, dots, underscores, or hyphens`)}function hn(e){try{let n=new URL(e);if(!["http:","https:"].includes(n.protocol))throw d.validation("API URL must use http:// or https:// protocol");if(n.pathname!=="/"&&n.pathname!=="")throw d.validation("API URL must not contain a path");if(n.search||n.hash)throw d.validation("API URL must not contain query parameters or fragments")}catch(n){throw Le(n)?n:d.validation("API URL must be a valid URL")}}function yn(e){return/^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(e)}function ue(e){if(e!=null){if(typeof e!="number"||!Number.isFinite(e))throw d.validation("TTL must be a number of seconds");if(!Number.isInteger(e))throw d.validation("TTL must be a whole number of seconds");if(e<k.MIN_SECONDS||e>k.MAX_SECONDS)throw d.validation(`TTL must be between ${k.MIN_SECONDS} and ${k.MAX_SECONDS} seconds`);return e}}function Ot(e){let n=Math.round(e/60);if(!(n>=1))return"less than a minute";if(n<120)return se(n,"minute");let t=Math.round(e/3600);return t<48?se(t,"hour"):se(Math.round(e/86400),"day")}function Sn(e,n=Date.now()/1e3){let t=e-n;return t>0?Ot(t):null}function se(e,n){return`${e} ${n}${e===1?"":"s"}`}function H(e,n=1){if(e===0)return"0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],l=Math.floor(Math.log(e)/Math.log(t));return`${Number.parseFloat((e/t**l).toFixed(n))} ${a[l]}`}function Me(e,n){return e.endsWith(`.${n}`)}function Dn(e,n){return!Me(e,n)}function Rn(e,n){return Me(e,n)?e.slice(0,-(n.length+1)):null}function bn(e){return`https://${e}`}function In(e){return`https://${e}`}function _n(e){return!e||e.length===0?null:JSON.stringify(e)}function Ln(e){if(!e)return[];try{let n=JSON.parse(e);return Array.isArray(n)?n:[]}catch{return[]}}function He(e){if(e==null||e==="")return;if(typeof e!="string")throw d.validation("Build command must be a string");let n=e.trim();if(n.length===0||n.length>U.COMMAND_MAX_LENGTH)throw d.validation(`Build command must be between 1 and ${U.COMMAND_MAX_LENGTH} characters`);if(/[\x00-\x1f\x7f]/.test(n))throw d.validation("Build command must be a single line");return n}function $e(e){if(e==null||e==="")return;if(typeof e!="string")throw d.validation("Output folder must be a string");let n=e.trim().replace(/\/+$/,"");if(n.length===0||n.length>U.OUTPUT_DIR_MAX_LENGTH)throw d.validation(`Output folder must be between 1 and ${U.OUTPUT_DIR_MAX_LENGTH} characters`);if(!U.OUTPUT_DIR_PATTERN.test(n)||n.split("/").some(t=>t===".."||t==="."))throw d.validation("Output folder must be a relative path inside the project, like dist or dist/site");return n}function ce(e){if(e==null)return;if(typeof e!="string")throw d.validation("Password must be a string");let n=e.trim();if(n.length<V.MIN_LENGTH||n.length>V.MAX_LENGTH)throw d.validation(`Password must be between ${V.MIN_LENGTH} and ${V.MAX_LENGTH} characters`);return n}var tn,gt,nn,rn,on,F,an,A,I,ln,y,Tt,re,At,St,d,bt,un,It,_t,pn,cn,ie,we,Oe,xe,M,fn,x,oe,mn,P,ve,X,k,pe,En,gn,Tn,An,R,v,Ue,U,V,D=_(()=>{"use strict";tn={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},gt={WEB:"web",SDK:"sdk",CLI:"cli",MCP:"mcp",GIT:"git",N8N:"n8n",GPT:"gpt",VSC:"vsc",CLD:"cld",CRS:"crs",GMN:"gmn",API:"api"},nn={LIVE:"live",UNLINKED:"unlinked",UNVERIFIED:"unverified",PAUSED:"paused"},rn={PENDING:"pending",PARTIAL:"partial",VERIFIED:"verified"},on="troubleshooting",F={HEADER:"Idempotency-Key",MAX_LENGTH:256,WINDOW_SECONDS:1440*60};an={FREE:"free",PRO:"pro",TEAM:"team",SCALE:"scale",SPONSORED:"sponsored"},A={DEPLOYMENTS:"/deployments",DEPLOYMENT:e=>`/deployments/${e}`,DEPLOYMENT_CONFIG:e=>`/deployments/${e}/config`,DOMAINS:"/domains",DOMAIN:e=>`/domains/${e}`,DOMAIN_VERIFY:e=>`/domains/${e}/verify`,DOMAIN_DNS:e=>`/domains/${e}/dns`,DOMAIN_RECORDS:e=>`/domains/${e}/records`,DOMAIN_SHARE:e=>`/domains/${e}/share`,DOMAIN_PROPAGATION:e=>`/domains/${e}/propagation`,DOMAINS_VALIDATE:"/domains/validate",TOKENS:"/tokens",TOKEN:e=>`/tokens/${e}`,ACCOUNT:"/account",ACCOUNT_KEY:"/account/key",ACCOUNT_CLAIM:"/account/claim",ACTIVITIES:"/activities",LABELS:"/labels",LIMITS:"/limits",PLANS:"/plans",PING:"/ping",SETUP:"/setup",SPA_CHECK:"/spa-check",UPLOAD:"/upload"},I={FILES:"files[]",CHECKSUMS:"checksums",LABELS:"labels",VIA:"via",PASSWORD:"password",TTL:"ttl",BUILD:"build",PRERENDER:"prerender",SPA:"spa",BUILD_COMMAND:"buildCommand",OUTPUT_DIR:"outputDir",CAPTCHA:"captcha"},ln={PATH:"path",CONTENT:"content",ENCODING:"encoding",DEFAULT_ENCODING:"utf-8",ENCODINGS:["utf-8","base64"]},y={Validation:"validation_failed",NotFound:"not_found",Forbidden:"forbidden",RateLimit:"rate_limit_exceeded",Authentication:"authentication_failed",Business:"business_logic_error",Api:"internal_server_error",Maintenance:"maintenance",Build:"build_failed",Network:"network_error",Timeout:"timeout_error",Cancelled:"operation_cancelled",File:"file_error",Config:"config_error"},Tt=new Set([y.Network,y.Timeout,y.Cancelled,y.File,y.Config]),re={client:new Set([y.Build,y.Business,y.Cancelled,y.Config,y.File,y.Forbidden,y.NotFound,y.RateLimit,y.Validation]),network:new Set([y.Network,y.Timeout]),auth:new Set([y.Authentication])},At=new Set(Object.values(y).filter(e=>!Tt.has(e))),St=200;d=class e extends Error{constructor(t,a,l,c){super(a);z(this,"type");z(this,"status");z(this,"details");this.type=t,this.status=l,this.details=c,this.name="ShipError"}toResponse(){let t=this.details,a=this.type===y.Authentication&&t?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:a}}static async fromHttpResponse(t,a){let l,c,h;try{if(t.headers.get("content-type")?.includes("application/json")){let f=await t.json();if(f&&typeof f=="object"){let T=f;typeof T.message=="string"?l=T.message:typeof T.error=="string"&&(l=T.error),c=T.details,typeof T.error=="string"&&At.has(T.error)&&(h=T.error)}}else{let f=(await t.text()).trim();f&&!f.startsWith("<")&&f.length<=St&&(l=f)}}catch{}let E=t.headers.get("retry-after");if(E!==null){let g=E.trim(),f=/^\d+$/.test(g)?Number(g):Math.ceil((Date.parse(g)-Date.now())/1e3);if(Number.isFinite(f)&&f>=0){let T=c&&typeof c=="object"?c:{};T.retryAfter===void 0&&(c={...T,retryAfter:f})}}l=l||`${a||"Request"} failed with status ${t.status}`;let m=h??(t.status===401?y.Authentication:t.status===403?y.Forbidden:t.status===429?y.RateLimit:y.Api);return new e(m,l,t.status,c)}static fromFetchError(t,a){if(Le(t))return t;let l=a||"Request",c=t?.name;return c==="AbortError"?e.cancelled(`${l} was cancelled`):c==="TimeoutError"?e.timeout(`${l} timed out`,{cause:t}):t instanceof Error?Dt(t)?e.network(`${l} failed: ${t.message}`,{cause:t}):new e(y.Api,`${l} failed: ${t.message}`):new e(y.Api,`${l} failed: Unknown error`)}static validation(t,a){return new e(y.Validation,t,400,a)}static notFound(t,a){let l=a?`${t} ${a} not found`:`${t} not found`;return new e(y.NotFound,l,404)}static forbidden(t,a){return new e(y.Forbidden,t,403,a)}static rateLimit(t="Too many requests",a){return new e(y.RateLimit,t,429,a)}static authentication(t="Authentication required",a){return new e(y.Authentication,t,401,a)}static business(t,a=400,l){return new e(y.Business,t,a,l)}static network(t,a){return new e(y.Network,t,void 0,a)}static timeout(t,a){return new e(y.Timeout,t,void 0,a)}static cancelled(t,a){return new e(y.Cancelled,t,void 0,a)}static file(t,a){return new e(y.File,t,void 0,a)}static config(t,a){return new e(y.Config,t,void 0,a)}static api(t,a=500,l){return new e(y.Api,t,a,l)}static maintenance(t,a){return new e(y.Maintenance,t,503,a)}static build(t,a){return new e(y.Build,t,422,a)}isClientError(){return re.client.has(this.type)?!0:this.status!==void 0&&this.status>=400&&this.status<500}isNetworkError(){return re.network.has(this.type)}isAuthError(){return re.auth.has(this.type)}isType(t){return this.type===t}};bt=["html","htm","xhtml","xml","txt","md","markdown","pdf","csv","json","jsonc","webmanifest","map","toml","yaml","yml","rss","atom","css","scss","sass","less","js","mjs","cjs","jsx","ts","tsx","wasm","vue","svelte","png","jpg","jpeg","gif","webp","avif","svg","ico","bmp","tif","tiff","heic","heif","woff","woff2","ttf","otf","eot","mp3","wav","ogg","oga","opus","m4a","aac","flac","weba","mp4","webm","ogv","mov","m4v","avi","glb","gltf","usdz","vtt","srt","zip"],un=bt.map(e=>`.${e}`).join(","),It=/[\x00-\x1f\x7f#?%\\<>"]/;_t=new Set(["node_modules","package.json"]);pn="/auth",cn="signing-in",ie={SESSION:"session",API_KEY:"apiKey",TOKEN:"token",AGENT:"agent",OAUTH:"oauth",SYSTEM:"system"},we={PREFIX:"ship-",HEX_LENGTH:32,TOTAL_LENGTH:37,HINT_LENGTH:4},Oe={PREFIX:"deploy-",HEX_LENGTH:32,TOTAL_LENGTH:39},xe={PREFIX:"oauth-",HEX_LENGTH:32,TOTAL_LENGTH:38},M={HEADER:"X-Caller",MAX_LENGTH:128,PATTERN:/^[a-zA-Z0-9._-]+$/},fn="X-Account",x={API_KEY:ie.API_KEY,DEPLOY_TOKEN:ie.TOKEN,OAUTH:ie.OAUTH,OPAQUE:"opaque"};oe="bearer ";mn={ACCOUNT_READ:"account:read",DEPLOYMENTS_READ:"deployments:read",DEPLOYMENTS_WRITE:"deployments:write",DOMAINS_READ:"domains:read",DOMAINS_WRITE:"domains:write"},P="ship.json",ve={rewrites:[{source:"/(.*)",destination:"/index.html"}]},X={INDEX_FILE:"index.html",MAX_INDEX_BYTES:100*1024};k={MIN_SECONDS:1,MAX_SECONDS:365*24*60*60};pe="https://api.shipstatic.com",En={TOKEN:"SHIP_TOKEN",API_URL:"SHIP_API_URL"},gn="SHIP_VIA",Tn="https://my.shipstatic.com/api-key",An=4320*60;R={PENDING:"pending",PROCESSING_ERROR:"processing_error",EXCLUDED:"excluded",VALIDATION_FAILED:"validation_failed",READY:"ready"};v={MIN_LENGTH:3,MAX_LENGTH:25,MAX_COUNT:10,SEPARATORS:"._-"},Ue=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;U={COMMAND_MAX_LENGTH:200,OUTPUT_DIR_MAX_LENGTH:100,OUTPUT_DIR_PATTERN:/^[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/};V={MIN_LENGTH:6,MAX_LENGTH:128}});var Ve=Ie((ze,ke)=>{"use strict";(function(e){if(typeof ze=="object")ke.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var n;try{n=window}catch{n=self}n.SparkMD5=e()}})(function(e){"use strict";var n=function(p,u){return p+u&4294967295},t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function a(p,u,i,r,s,o){return u=n(n(u,p),n(r,o)),n(u<<s|u>>>32-s,i)}function l(p,u){var i=p[0],r=p[1],s=p[2],o=p[3];i+=(r&s|~r&o)+u[0]-680876936|0,i=(i<<7|i>>>25)+r|0,o+=(i&r|~i&s)+u[1]-389564586|0,o=(o<<12|o>>>20)+i|0,s+=(o&i|~o&r)+u[2]+606105819|0,s=(s<<17|s>>>15)+o|0,r+=(s&o|~s&i)+u[3]-1044525330|0,r=(r<<22|r>>>10)+s|0,i+=(r&s|~r&o)+u[4]-176418897|0,i=(i<<7|i>>>25)+r|0,o+=(i&r|~i&s)+u[5]+1200080426|0,o=(o<<12|o>>>20)+i|0,s+=(o&i|~o&r)+u[6]-1473231341|0,s=(s<<17|s>>>15)+o|0,r+=(s&o|~s&i)+u[7]-45705983|0,r=(r<<22|r>>>10)+s|0,i+=(r&s|~r&o)+u[8]+1770035416|0,i=(i<<7|i>>>25)+r|0,o+=(i&r|~i&s)+u[9]-1958414417|0,o=(o<<12|o>>>20)+i|0,s+=(o&i|~o&r)+u[10]-42063|0,s=(s<<17|s>>>15)+o|0,r+=(s&o|~s&i)+u[11]-1990404162|0,r=(r<<22|r>>>10)+s|0,i+=(r&s|~r&o)+u[12]+1804603682|0,i=(i<<7|i>>>25)+r|0,o+=(i&r|~i&s)+u[13]-40341101|0,o=(o<<12|o>>>20)+i|0,s+=(o&i|~o&r)+u[14]-1502002290|0,s=(s<<17|s>>>15)+o|0,r+=(s&o|~s&i)+u[15]+1236535329|0,r=(r<<22|r>>>10)+s|0,i+=(r&o|s&~o)+u[1]-165796510|0,i=(i<<5|i>>>27)+r|0,o+=(i&s|r&~s)+u[6]-1069501632|0,o=(o<<9|o>>>23)+i|0,s+=(o&r|i&~r)+u[11]+643717713|0,s=(s<<14|s>>>18)+o|0,r+=(s&i|o&~i)+u[0]-373897302|0,r=(r<<20|r>>>12)+s|0,i+=(r&o|s&~o)+u[5]-701558691|0,i=(i<<5|i>>>27)+r|0,o+=(i&s|r&~s)+u[10]+38016083|0,o=(o<<9|o>>>23)+i|0,s+=(o&r|i&~r)+u[15]-660478335|0,s=(s<<14|s>>>18)+o|0,r+=(s&i|o&~i)+u[4]-405537848|0,r=(r<<20|r>>>12)+s|0,i+=(r&o|s&~o)+u[9]+568446438|0,i=(i<<5|i>>>27)+r|0,o+=(i&s|r&~s)+u[14]-1019803690|0,o=(o<<9|o>>>23)+i|0,s+=(o&r|i&~r)+u[3]-187363961|0,s=(s<<14|s>>>18)+o|0,r+=(s&i|o&~i)+u[8]+1163531501|0,r=(r<<20|r>>>12)+s|0,i+=(r&o|s&~o)+u[13]-1444681467|0,i=(i<<5|i>>>27)+r|0,o+=(i&s|r&~s)+u[2]-51403784|0,o=(o<<9|o>>>23)+i|0,s+=(o&r|i&~r)+u[7]+1735328473|0,s=(s<<14|s>>>18)+o|0,r+=(s&i|o&~i)+u[12]-1926607734|0,r=(r<<20|r>>>12)+s|0,i+=(r^s^o)+u[5]-378558|0,i=(i<<4|i>>>28)+r|0,o+=(i^r^s)+u[8]-2022574463|0,o=(o<<11|o>>>21)+i|0,s+=(o^i^r)+u[11]+1839030562|0,s=(s<<16|s>>>16)+o|0,r+=(s^o^i)+u[14]-35309556|0,r=(r<<23|r>>>9)+s|0,i+=(r^s^o)+u[1]-1530992060|0,i=(i<<4|i>>>28)+r|0,o+=(i^r^s)+u[4]+1272893353|0,o=(o<<11|o>>>21)+i|0,s+=(o^i^r)+u[7]-155497632|0,s=(s<<16|s>>>16)+o|0,r+=(s^o^i)+u[10]-1094730640|0,r=(r<<23|r>>>9)+s|0,i+=(r^s^o)+u[13]+681279174|0,i=(i<<4|i>>>28)+r|0,o+=(i^r^s)+u[0]-358537222|0,o=(o<<11|o>>>21)+i|0,s+=(o^i^r)+u[3]-722521979|0,s=(s<<16|s>>>16)+o|0,r+=(s^o^i)+u[6]+76029189|0,r=(r<<23|r>>>9)+s|0,i+=(r^s^o)+u[9]-640364487|0,i=(i<<4|i>>>28)+r|0,o+=(i^r^s)+u[12]-421815835|0,o=(o<<11|o>>>21)+i|0,s+=(o^i^r)+u[15]+530742520|0,s=(s<<16|s>>>16)+o|0,r+=(s^o^i)+u[2]-995338651|0,r=(r<<23|r>>>9)+s|0,i+=(s^(r|~o))+u[0]-198630844|0,i=(i<<6|i>>>26)+r|0,o+=(r^(i|~s))+u[7]+1126891415|0,o=(o<<10|o>>>22)+i|0,s+=(i^(o|~r))+u[14]-1416354905|0,s=(s<<15|s>>>17)+o|0,r+=(o^(s|~i))+u[5]-57434055|0,r=(r<<21|r>>>11)+s|0,i+=(s^(r|~o))+u[12]+1700485571|0,i=(i<<6|i>>>26)+r|0,o+=(r^(i|~s))+u[3]-1894986606|0,o=(o<<10|o>>>22)+i|0,s+=(i^(o|~r))+u[10]-1051523|0,s=(s<<15|s>>>17)+o|0,r+=(o^(s|~i))+u[1]-2054922799|0,r=(r<<21|r>>>11)+s|0,i+=(s^(r|~o))+u[8]+1873313359|0,i=(i<<6|i>>>26)+r|0,o+=(r^(i|~s))+u[15]-30611744|0,o=(o<<10|o>>>22)+i|0,s+=(i^(o|~r))+u[6]-1560198380|0,s=(s<<15|s>>>17)+o|0,r+=(o^(s|~i))+u[13]+1309151649|0,r=(r<<21|r>>>11)+s|0,i+=(s^(r|~o))+u[4]-145523070|0,i=(i<<6|i>>>26)+r|0,o+=(r^(i|~s))+u[11]-1120210379|0,o=(o<<10|o>>>22)+i|0,s+=(i^(o|~r))+u[2]+718787259|0,s=(s<<15|s>>>17)+o|0,r+=(o^(s|~i))+u[9]-343485551|0,r=(r<<21|r>>>11)+s|0,p[0]=i+p[0]|0,p[1]=r+p[1]|0,p[2]=s+p[2]|0,p[3]=o+p[3]|0}function c(p){var u=[],i;for(i=0;i<64;i+=4)u[i>>2]=p.charCodeAt(i)+(p.charCodeAt(i+1)<<8)+(p.charCodeAt(i+2)<<16)+(p.charCodeAt(i+3)<<24);return u}function h(p){var u=[],i;for(i=0;i<64;i+=4)u[i>>2]=p[i]+(p[i+1]<<8)+(p[i+2]<<16)+(p[i+3]<<24);return u}function E(p){var u=p.length,i=[1732584193,-271733879,-1732584194,271733878],r,s,o,b,N,O;for(r=64;r<=u;r+=64)l(i,c(p.substring(r-64,r)));for(p=p.substring(r-64),s=p.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<s;r+=1)o[r>>2]|=p.charCodeAt(r)<<(r%4<<3);if(o[r>>2]|=128<<(r%4<<3),r>55)for(l(i,o),r=0;r<16;r+=1)o[r]=0;return b=u*8,b=b.toString(16).match(/(.*?)(.{0,8})$/),N=parseInt(b[2],16),O=parseInt(b[1],16)||0,o[14]=N,o[15]=O,l(i,o),i}function m(p){var u=p.length,i=[1732584193,-271733879,-1732584194,271733878],r,s,o,b,N,O;for(r=64;r<=u;r+=64)l(i,h(p.subarray(r-64,r)));for(p=r-64<u?p.subarray(r-64):new Uint8Array(0),s=p.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<s;r+=1)o[r>>2]|=p[r]<<(r%4<<3);if(o[r>>2]|=128<<(r%4<<3),r>55)for(l(i,o),r=0;r<16;r+=1)o[r]=0;return b=u*8,b=b.toString(16).match(/(.*?)(.{0,8})$/),N=parseInt(b[2],16),O=parseInt(b[1],16)||0,o[14]=N,o[15]=O,l(i,o),i}function g(p){var u="",i;for(i=0;i<4;i+=1)u+=t[p>>i*8+4&15]+t[p>>i*8&15];return u}function f(p){var u;for(u=0;u<p.length;u+=1)p[u]=g(p[u]);return p.join("")}f(E("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(n=function(p,u){var i=(p&65535)+(u&65535),r=(p>>16)+(u>>16)+(i>>16);return r<<16|i&65535}),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function p(u,i){return u=u|0||0,u<0?Math.max(u+i,0):Math.min(u,i)}ArrayBuffer.prototype.slice=function(u,i){var r=this.byteLength,s=p(u,r),o=r,b,N,O,be;return i!==e&&(o=p(i,r)),s>o?new ArrayBuffer(0):(b=o-s,N=new ArrayBuffer(b),O=new Uint8Array(N),be=new Uint8Array(this,s,b),O.set(be),N)}})();function T(p){return/[\u0080-\uFFFF]/.test(p)&&(p=unescape(encodeURIComponent(p))),p}function L(p,u){var i=p.length,r=new ArrayBuffer(i),s=new Uint8Array(r),o;for(o=0;o<i;o+=1)s[o]=p.charCodeAt(o);return u?s:r}function C(p){return String.fromCharCode.apply(null,new Uint8Array(p))}function ne(p,u,i){var r=new Uint8Array(p.byteLength+u.byteLength);return r.set(new Uint8Array(p)),r.set(new Uint8Array(u),p.byteLength),i?r:r.buffer}function w(p){var u=[],i=p.length,r;for(r=0;r<i-1;r+=2)u.push(parseInt(p.substr(r,2),16));return String.fromCharCode.apply(String,u)}function S(){this.reset()}return S.prototype.append=function(p){return this.appendBinary(T(p)),this},S.prototype.appendBinary=function(p){this._buff+=p,this._length+=p.length;var u=this._buff.length,i;for(i=64;i<=u;i+=64)l(this._hash,c(this._buff.substring(i-64,i)));return this._buff=this._buff.substring(i-64),this},S.prototype.end=function(p){var u=this._buff,i=u.length,r,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o;for(r=0;r<i;r+=1)s[r>>2]|=u.charCodeAt(r)<<(r%4<<3);return this._finish(s,i),o=f(this._hash),p&&(o=w(o)),this.reset(),o},S.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},S.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},S.prototype.setState=function(p){return this._buff=p.buff,this._length=p.length,this._hash=p.hash,this},S.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},S.prototype._finish=function(p,u){var i=u,r,s,o;if(p[i>>2]|=128<<(i%4<<3),i>55)for(l(this._hash,p),i=0;i<16;i+=1)p[i]=0;r=this._length*8,r=r.toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(r[2],16),o=parseInt(r[1],16)||0,p[14]=s,p[15]=o,l(this._hash,p)},S.hash=function(p,u){return S.hashBinary(T(p),u)},S.hashBinary=function(p,u){var i=E(p),r=f(i);return u?w(r):r},S.ArrayBuffer=function(){this.reset()},S.ArrayBuffer.prototype.append=function(p){var u=ne(this._buff.buffer,p,!0),i=u.length,r;for(this._length+=p.byteLength,r=64;r<=i;r+=64)l(this._hash,h(u.subarray(r-64,r)));return this._buff=r-64<i?new Uint8Array(u.buffer.slice(r-64)):new Uint8Array(0),this},S.ArrayBuffer.prototype.end=function(p){var u=this._buff,i=u.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],s,o;for(s=0;s<i;s+=1)r[s>>2]|=u[s]<<(s%4<<3);return this._finish(r,i),o=f(this._hash),p&&(o=w(o)),this.reset(),o},S.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},S.ArrayBuffer.prototype.getState=function(){var p=S.prototype.getState.call(this);return p.buff=C(p.buff),p},S.ArrayBuffer.prototype.setState=function(p){return p.buff=L(p.buff,!0),S.prototype.setState.call(this,p)},S.ArrayBuffer.prototype.destroy=S.prototype.destroy,S.ArrayBuffer.prototype._finish=S.prototype._finish,S.ArrayBuffer.hash=function(p,u){var i=m(new Uint8Array(p)),r=f(i);return u?w(r):r},S})});var j=Ie((Mn,Ke)=>{"use strict";Ke.exports={}});async function Bt(e){let n=(await Promise.resolve().then(()=>G(Ve(),1))).default,t=new n.ArrayBuffer,a=2097152;for(let l=0;l<e.size;l+=a){let c=Math.min(l+a,e.size);t.append(await e.slice(l,c).arrayBuffer())}return{md5:t.end()}}async function Gt(e){let{createHash:n}=await Promise.resolve().then(()=>G(j(),1)),t=n("md5");return t.update(e),{md5:t.digest("hex")}}async function zt(e){let{createHash:n}=await Promise.resolve().then(()=>G(j(),1)),{createReadStream:t}=await Promise.resolve().then(()=>G(j(),1));return new Promise((a,l)=>{let c=n("md5"),h=t(e);h.on("error",E=>l(d.file(`Failed to read file for MD5: ${E.message}`,{filePath:e}))),h.on("data",E=>c.update(E)),h.on("end",()=>a({md5:c.digest("hex")}))})}async function W(e){if(e instanceof Blob)return Bt(e);if(typeof Buffer<"u"&&Buffer.isBuffer(e))return Gt(e);if(typeof e=="string")return zt(e);throw d.business("Invalid input for MD5 calculation")}var J=_(()=>{"use strict";D()});function ee(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var Qe=_(()=>{"use strict"});function Ze(e,n={}){if(n.flatten===!1)return e.map(a=>({path:ee(a),name:de(a)}));let t=Xt(e);return e.map(a=>{let l=ee(a);if(t){let c=t.endsWith("/")?t:`${t}/`;l.startsWith(c)&&(l=l.substring(c.length))}return l||(l=de(a)),{path:l,name:de(a)}})}function Xt(e){if(!e.length)return"";let t=e.map(c=>ee(c)).map(c=>c.split("/")),a=[],l=Math.min(...t.map(c=>c.length));for(let c=0;c<l-1;c++){let h=t[0][c];if(t.every(E=>E[c]===h))a.push(h);else break}return a.join("/")}function de(e){return e.split(/[/\\]/).pop()||e}var me=_(()=>{"use strict";Qe()});function or(e){he=e}function qt(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function et(){return he||qt()}var he,ye=_(()=>{"use strict";he=null});function te(e,n){return Yt.find(t=>t.broken(e,n))}var Yt,ge=_(()=>{"use strict";D();Te();Yt=[{name:"name",broken:({path:e})=>!Ee(e).valid,sentence:({path:e})=>Ee(e).reason??"Invalid file name"},{name:"extension",broken:({path:e},n)=>Ne(e,n.blockedExtensions??[]),sentence:({path:e})=>`File extension not allowed: "${e}"`},{name:"fileSize",broken:({size:e},n)=>e>n.maxFileSize,sentence:({path:e},n)=>`File "${e}" too large. Maximum ${H(n.maxFileSize)} allowed`},{name:"totalSize",broken:({totalSize:e},n)=>e>n.maxTotalSize,sentence:({totalSize:e},n)=>`Total upload size too large. ${H(e)} exceeds maximum of ${H(n.maxTotalSize)}`}]});function Ee(e){if(Pe(e))return{valid:!1,reason:"File name contains unsafe characters"};if(e.startsWith(" ")||e.endsWith(" "))return{valid:!1,reason:"File name cannot start/end with spaces"};if(e.endsWith("."))return{valid:!1,reason:"File name cannot end with dots"};let n=/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|$)/i,t=e.split("/").pop()||e;return n.test(t)?{valid:!1,reason:"File name uses a reserved system name"}:e.includes("..")?{valid:!1,reason:"File name contains path traversal pattern"}:{valid:!0}}function fr(e,n){let t=[],a=[],l=[];if(e.length===0){let m={file:"(no files)",message:"At least one file must be provided"};return t.push(m),{files:[],validFiles:[],errors:t,warnings:[],canDeploy:!1}}for(let m of e)if(K(m.name))return t.push({file:m.name,message:"Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder"}),{files:e.map(g=>({...g,status:R.VALIDATION_FAILED,statusMessage:"Unbuilt project detected"})),validFiles:[],errors:t,warnings:[],canDeploy:!1};if(e.length>n.maxFilesCount){let m={file:`(${e.length} files)`,message:`File count (${e.length}) exceeds limit of ${n.maxFilesCount}`};return t.push(m),{files:e.map(g=>({...g,status:R.VALIDATION_FAILED,statusMessage:m.message})),validFiles:[],errors:t,warnings:[],canDeploy:!1}}let c=0;for(let m of e){let g=R.READY,f="Ready for upload";if(m.status===R.PROCESSING_ERROR)g=R.VALIDATION_FAILED,f=m.statusMessage||"File failed during processing",t.push({file:m.name,message:f});else if(m.size===0){g=R.EXCLUDED,f="File is empty (0 bytes) and cannot be deployed due to storage limitations",a.push({file:m.name,message:f}),l.push({...m,status:g,statusMessage:f});continue}else if(m.size<0)g=R.VALIDATION_FAILED,f="File size must be positive",t.push({file:m.name,message:f});else if(!m.name||m.name.trim().length===0)g=R.VALIDATION_FAILED,f="File name cannot be empty",t.push({file:m.name||"(empty)",message:f});else if(m.name.includes("\0"))g=R.VALIDATION_FAILED,f="File name contains invalid characters (null byte)",t.push({file:m.name,message:f});else{let T={path:m.name,size:m.size,totalSize:c+m.size},L=te(T,n);L?(g=R.VALIDATION_FAILED,f=L.sentence(T,n),t.push({file:L.name==="totalSize"?`(${e.length} files)`:m.name,message:f})):c=T.totalSize}l.push({...m,status:g,statusMessage:f})}t.length>0&&(l=l.map(m=>m.status===R.EXCLUDED?m:{...m,status:R.VALIDATION_FAILED,statusMessage:m.status===R.VALIDATION_FAILED?m.statusMessage:"Deployment failed due to validation errors in bundle"}));let h=t.length===0?l.filter(m=>m.status===R.READY):[],E=t.length===0;return{files:l,validFiles:h,errors:t,warnings:a,canDeploy:E}}function jt(e){return e.filter(n=>n.status===R.READY)}function dr(e){return jt(e).length>0}var Te=_(()=>{"use strict";D();ge();D()});function tt(e){return Jt.test(e)}var Wt,Jt,nt=_(()=>{"use strict";Wt=["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^[Dd]esktop\\.ini$","@eaDir$"],Jt=new RegExp(Wt.join("|"))});function rt(e,n){if(!e||e.length===0)return[];if(!n?.allowUnbuilt&&e.find(a=>a&&K(a)))throw d.business("Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder");return e.filter(t=>{if(!t)return!1;let a=t.replace(/\\/g,"/").split("/").filter(Boolean);if(a.length===0)return!0;let l=a[a.length-1];if(tt(l))return!1;for(let h of a)if(h!==".well-known"&&(h.startsWith(".")||h.length>255))return!1;let c=a.slice(0,-1);for(let h of c)if(Qt.some(E=>h.toLowerCase()===E.toLowerCase()))return!1;return!0})}var Qt,Ae=_(()=>{"use strict";D();nt();Qt=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function it(e,n){if(e.includes("\0")||e.includes("/../")||e.startsWith("../")||e.endsWith("/.."))throw d.business(`Security error: Unsafe file path "${e}" for file: ${n}`)}function ot(e,n){let t=te(e,n);if(t)throw d.business(t.sentence(e,n))}var Se=_(()=>{"use strict";D();ge()});async function st(e,n={},t){let a=!!(n.build||n.prerender),l=Ze(e.map(f=>f.path),{flatten:n.pathDetect!==!1}).map(f=>f.path),c=new Set(rt(l,{allowUnbuilt:a})),h=e.map((f,T)=>({source:f,deployPath:l[T]})).filter(({deployPath:f})=>c.has(f));if(h.length===0)return[];let E=a?null:Zt(t),m=[],g=0;for(let{source:f,deployPath:T}of h){if(E&&it(T,f.origin),f.size===0)continue;E&&(g+=f.size,ot({path:T,size:f.size,totalSize:g},E));let L=await f.read(),{md5:C}=await W(L);m.push({path:T,content:L,size:f.size,md5:C})}if(E&&m.length>E.maxFilesCount)throw d.business(`Too many files to deploy. Maximum allowed is ${E.maxFilesCount} files.`);return m}function Zt(e){if(!e)throw d.config("Platform limits not provided. Deploy-mode validation requires the limits argument \u2014 pass `ship.getLimits()` result.");return e}var at=_(()=>{"use strict";D();me();Ae();J();Se()});var ut={};yt(ut,{processFilesForBrowser:()=>lt});async function lt(e,n={},t){if(et()!=="browser")throw d.business("processFilesForBrowser can only be called in a browser environment.");return st(e.map(a=>({path:a.webkitRelativePath||a.name,origin:a.name,size:a.size,read:async()=>a})),n,t)}var De=_(()=>{"use strict";D();at();ye()});D();D();D();var q=class{constructor(){this.handlers=new Map}on(n,t){this.handlers.has(n)||this.handlers.set(n,new Set),this.handlers.get(n)?.add(t)}off(n,t){let a=this.handlers.get(n);a&&(a.delete(t),a.size===0&&this.handlers.delete(n))}emit(n,...t){let a=this.handlers.get(n);if(!a)return;let l=Array.from(a);for(let c of l)try{c(...t)}catch(h){a.delete(c),n!=="error"&&setTimeout(()=>{let E=h instanceof Error?h:new Error(String(h));this.emit("error",E,String(n))},0)}}};var xt=3e4,vt=2,Ft=300,Ct=2e3,Mt=new Set([500,502,503,504]);function Ut(e,n){return new Promise((t,a)=>{if(n?.aborted){a(n.reason);return}let l=()=>{clearTimeout(h),n?.removeEventListener("abort",c)},c=()=>{l(),a(n?.reason)},h=setTimeout(()=>{l(),t()},e);n?.addEventListener("abort",c)})}var Be=3e5,Ht=3e5,$t=Be+Ht,Y=class extends q{constructor(t){super();this.globalHeaders={};this.apiUrl=t.apiUrl||pe,this.getAuthHeadersCallback=t.getAuthHeaders,this.session=t.session??!1,this.caller=t.caller,this.timeout=t.timeout??xt,this.maxRetries=Math.max(0,t.maxRetries??vt),this.fetch=t.fetch??globalThis.fetch.bind(globalThis),this.deploy={endpoint:t.deployEndpoint||A.DEPLOYMENTS,timeout:t.timeout??Be,buildTimeout:t.timeout??$t}}setGlobalHeaders(t){this.globalHeaders=t}async executeRequest(t,a,l,c=this.timeout){for(let h=0;;h++)try{return await this.attemptOnce(t,a,l,c)}catch(E){let m=d.fromFetchError(E,l);if(h>=this.maxRetries||!this.isRetryable(m,a))throw this.emit("error",m,t),m;this.emit("retry",m,t,h+1);let g=Math.min(Ct,Ft*2**h);try{await Ut(Math.random()*g,a.signal)}catch(f){let T=d.fromFetchError(f,l);throw this.emit("error",T,t),T}}}isRetryable(t,a){if(a.signal?.aborted||t.isType(y.Maintenance)||t.isType(y.Cancelled)||!(t.isNetworkError()||t.status!==void 0&&Mt.has(t.status)))return!1;let c=(a.method??"GET").toUpperCase();return c==="GET"||c==="HEAD"?!0:c==="PUT"||c==="DELETE"?!1:this.hasIdempotencyKey(a.headers)}hasIdempotencyKey(t){if(!t)return!1;let a=F.HEADER.toLowerCase();return Object.keys(t).some(l=>l.toLowerCase()===a)}async attemptOnce(t,a,l,c=this.timeout){let h=()=>{};try{let E=await this.mergeHeaders(a.headers),m=this.createTimeoutSignal(a.signal,c);h=m.cleanup;let g={...a,headers:E,credentials:this.session&&!E.Authorization?"include":void 0,signal:m.signal};this.emit("request",t,g);let f=await this.fetch(t,g);if(h(),!f.ok)throw await d.fromHttpResponse(f,l);return this.emit("response",this.safeClone(f),t),{data:await this.parseResponse(this.safeClone(f)),status:f.status}}catch(E){throw h(),d.fromFetchError(E,l)}}async request(t,a,l,c){let{data:h}=await this.executeRequest(`${this.apiUrl}${t}`,a,l,c);return h}async requestWithStatus(t,a,l){return this.executeRequest(`${this.apiUrl}${t}`,a,l)}async mergeHeaders(t={}){return{...this.globalHeaders,...this.caller?{[M.HEADER]:this.caller}:{},...await this.getAuthHeadersCallback(),...t}}createTimeoutSignal(t,a=this.timeout){let l=new AbortController,c=setTimeout(()=>l.abort(new DOMException(`Timed out after ${a}ms`,"TimeoutError")),a),h=t?()=>l.abort(t.reason):void 0;return t&&h&&(t.addEventListener("abort",h),t.aborted&&l.abort(t.reason)),{signal:l.signal,cleanup:()=>{clearTimeout(c),t&&h&&t.removeEventListener("abort",h)}}}safeClone(t){try{return t.clone()}catch{return t}}async parseResponse(t){if(!(t.headers.get("Content-Length")==="0"||t.status===204))return t.json()}};D();D();async function Ge(e,n={}){let{labels:t,via:a,password:l,ttl:c,flags:h,captcha:E}=n,m=new FormData,g=[];for(let f of e){if(typeof f.content=="string"||f.content===null||f.content===void 0)throw d.file(`Unsupported file.content type: ${f.path}`,{filePath:f.path});if(!f.md5)throw d.file(`File missing md5 checksum: ${f.path}`,{filePath:f.path});m.append(I.FILES,new File([f.content],f.path,{type:"application/octet-stream"})),g.push(f.md5)}return m.append(I.CHECKSUMS,JSON.stringify(g)),t&&t.length>0&&m.append(I.LABELS,JSON.stringify(t)),a&&m.append(I.VIA,a),l&&m.append(I.PASSWORD,l),c!==void 0&&m.append(I.TTL,String(c)),h?.build&&m.append(I.BUILD,"true"),h?.prerender&&m.append(I.PRERENDER,"true"),h?.spa&&m.append(I.SPA,"true"),h?.buildCommand&&m.append(I.BUILD_COMMAND,h.buildCommand),h?.outputDir&&m.append(I.OUTPUT_DIR,h.outputDir),E&&m.append(I.CAPTCHA,E),m}D();J();async function kt(){let e=JSON.stringify(ve,null,2),n;typeof Buffer<"u"?n=Buffer.from(e,"utf-8"):n=new Blob([e],{type:"application/json"});let{md5:t}=await W(n);return{path:P,content:n,size:e.length,md5:t}}async function Vt(e,n){let t=e.find(h=>h.path===X.INDEX_FILE||h.path===`/${X.INDEX_FILE}`);if(!t||t.size>X.MAX_INDEX_BYTES)return!1;let a;if(typeof Buffer<"u"&&Buffer.isBuffer(t.content))a=t.content.toString("utf-8");else if(typeof Blob<"u"&&t.content instanceof Blob)a=await t.content.text();else if(typeof File<"u"&&t.content instanceof File)a=await t.content.text();else return!1;let l={files:e.map(h=>h.path),index:a};return(await n.request(A.SPA_CHECK,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)},"SPA check")).isSPA}async function Xe(e,n,t){if(t.spaDetect===!1||t.spa||t.build||t.prerender||e.some(a=>a.path===P))return e;try{if(await Vt(e,n)){let l=await kt();return[...e,l]}}catch{}return e}D();D();function $(e){if(e==null)return;if(e.length===0)return e;if(e.length>v.MAX_COUNT)throw d.validation(`Maximum ${v.MAX_COUNT} labels allowed`);let n=e.map((a,l)=>{if(typeof a!="string")throw d.validation(`Label at index ${l} must be a string`);let c=a.trim().toLowerCase();if(c.length<v.MIN_LENGTH)throw d.validation(`Labels must be at least ${v.MIN_LENGTH} characters long`);if(c.length>v.MAX_LENGTH)throw d.validation(`Labels must be no more than ${v.MAX_LENGTH} characters long`);if(!Ue.test(c))throw d.validation(`Labels must start and end with alphanumeric characters, with optional separators (${v.SEPARATORS}) between segments`);return c}),t=[...new Set(n)];if(t.length!==n.length)throw d.validation("Duplicate labels are not allowed");return t}async function qe(e){let n=e.find(l=>l.path===P||l.path===`/${P}`);if(!n)return;let t=n.content,a=typeof t.text=="function"?await t.text():n.content.toString("utf8");Fe(a)}var Q={"Content-Type":"application/json"},Kt="sdk";function fe(e){let n=new URLSearchParams;e?.limit!==void 0&&n.set("limit",String(e.limit)),e?.cursor!==void 0&&n.set("cursor",e.cursor);let t=n.toString();return t?`?${t}`:""}function Ye(e){let{getApi:n,processInput:t}=e;return{upload:async(a,l={})=>{if(!t)throw d.config("processInput function is not provided.");let c=n(),h=await t(a,l),E=await Xe(h,c,l);if(!E.length)throw d.business("No files to deploy");for(let w of E)if(!w.md5)throw d.file(`MD5 checksum missing for file: ${w.path}`,{filePath:w.path});ce(l.password);let m=ue(l.ttl),g=_e(l.idempotencyKey),f=$(l.labels);await qe(E);let T=He(l.buildCommand),L=$e(l.outputDir),C=l.build||l.prerender||l.spa?{build:l.build,prerender:l.prerender,spa:l.spa,buildCommand:T,outputDir:L}:void 0,ne=await Ge(E,{labels:f,via:l.via??Kt,password:l.password,ttl:m,flags:C,captcha:l.captcha});return c.request(c.deploy.endpoint,{method:"POST",body:ne,...g?{headers:{[F.HEADER]:g}}:{},signal:l.signal||null},"Deploy",l.build||l.prerender?c.deploy.buildTimeout:c.deploy.timeout)},list:async a=>n().request(`${A.DEPLOYMENTS}${fe(a)}`,{method:"GET"},"List deployments"),get:async a=>n().request(A.DEPLOYMENT(encodeURIComponent(a)),{method:"GET"},"Get deployment"),set:async(a,l)=>n().request(A.DEPLOYMENT(encodeURIComponent(a)),{method:"PATCH",headers:Q,body:JSON.stringify({labels:$(l.labels)})},"Update deployment labels"),delete:async a=>n().request(A.DEPLOYMENT(encodeURIComponent(a)),{method:"DELETE"},"Delete deployment")}}function je(e){let{getApi:n}=e;return{set:async(t,a={})=>{let l=$(a.labels),c={};a.deployment&&(c.deployment=a.deployment),l!==void 0&&(c.labels=l);let{data:h,status:E}=await n().requestWithStatus(A.DOMAIN(encodeURIComponent(t)),{method:"PUT",headers:Q,body:JSON.stringify(c)},"Set domain");return{...h,isCreate:E===201}},list:async t=>n().request(`${A.DOMAINS}${fe(t)}`,{method:"GET"},"List domains"),get:async t=>n().request(A.DOMAIN(encodeURIComponent(t)),{method:"GET"},"Get domain"),delete:async t=>n().request(A.DOMAIN(encodeURIComponent(t)),{method:"DELETE"},"Delete domain"),verify:async t=>n().request(A.DOMAIN_VERIFY(encodeURIComponent(t)),{method:"POST"},"Verify domain"),validate:async t=>n().request(A.DOMAINS_VALIDATE,{method:"POST",headers:Q,body:JSON.stringify({domain:t})},"Validate domain"),dns:async t=>n().request(A.DOMAIN_DNS(encodeURIComponent(t)),{method:"GET"},"Get domain DNS"),records:async t=>n().request(A.DOMAIN_RECORDS(encodeURIComponent(t)),{method:"GET"},"Get domain records"),share:async t=>n().request(A.DOMAIN_SHARE(encodeURIComponent(t)),{method:"GET"},"Get domain share")}}function We(e){let{getApi:n}=e;return{get:async()=>n().request(A.ACCOUNT,{method:"GET"},"Get account")}}function Je(e){let{getApi:n}=e;return{create:async(t={})=>{let a=ue(t.ttl),l=$(t.labels),c={};return a!==void 0&&(c.ttl=a),l!==void 0&&(c.labels=l),n().request(A.TOKENS,{method:"POST",headers:Q,body:JSON.stringify(c)},"Create token")},list:async t=>n().request(`${A.TOKENS}${fe(t)}`,{method:"GET"},"List tokens"),get:async t=>n().request(A.TOKEN(encodeURIComponent(t)),{method:"GET"},"Get token"),delete:async t=>n().request(A.TOKEN(encodeURIComponent(t)),{method:"DELETE"},"Delete token")}}var Z=class{constructor(n={}){this.initPromise=null;this.platformLimits=null;this.credential=null;if(n={...n,apiUrl:n.apiUrl||void 0,token:n.token||void 0,caller:n.caller||void 0},this.clientOptions=n,n.caller!==void 0&&Ce(n.caller),n.token&&n.session)throw d.config("Provide either `token` or `session`, not both.");typeof n.token=="string"?(le(n.token),this.credential=n.token):n.token&&(this.credential=n.token),this.http=new Y({...n,getAuthHeaders:()=>this.getAuthHeaders()});let t={getApi:()=>this.http};this.deployments=Ye({...t,processInput:async(a,l)=>(await this.ensureInitialized(),this.processInput(a,l))}),this.domains=je(t),this.account=We(t),this.tokens=Je(t)}async ensureInitialized(){return this.initPromise||(this.initPromise=this.fetchPlatformLimits()),this.initPromise}async fetchPlatformLimits(){try{this.platformLimits=await this.http.request(A.LIMITS,{method:"GET"},"Get limits")}catch(n){throw this.initPromise=null,n}}async ping(){return this.http.request(A.PING,{method:"GET"},"Ping")}async deploy(n,t){return this.deployments.upload(n,t)}async whoami(){return this.account.get()}async getLimits(){return this.platformLimits?this.platformLimits:(await this.ensureInitialized(),this.platformLimits)}on(n,t){this.http.on(n,t)}off(n,t){this.http.off(n,t)}setHeaders(n){this.http.setGlobalHeaders(n)}clearHeaders(){this.http.setGlobalHeaders({})}setToken(n){if(this.clientOptions.session)throw d.config("Provide either `token` or `session`, not both.");if(typeof n=="string"){if(!n)throw d.business("Invalid token provided. Token must be a non-empty string.");le(n),this.credential=n;return}if(typeof n!="function")throw d.business("Invalid token provided. Token must be a non-empty string or a provider function.");this.credential=n}async getAuthHeaders(){if(this.credential===null)return{};let n=typeof this.credential=="function"?await this.credential():this.credential;if(!n)throw d.authentication("Token provider returned no token.");if(typeof n!="string")throw d.authentication("Token provider returned a non-string value.");return{Authorization:`Bearer ${n}`}}};D();D();me();ye();Te();Ae();J();Se();function Rr(e,n,t,a=!0){let l=e===1?n:t;return a?`${e} ${l}`:l}De();var Re=class extends Z{async deploy(n,t){return super.deploy(n,t)}async processInput(n,t){if(!Array.isArray(n)||!n.every(l=>l instanceof File))throw d.business("Invalid input type for browser environment. Expected File[].");if(n.length===0)throw d.business("No files to deploy.");let{processFilesForBrowser:a}=await Promise.resolve().then(()=>(De(),ut));return a(n,t,this.platformLimits??void 0)}},jr=Re;export{fn as ACCOUNT_HEADER,we as API_KEY,A as API_PATHS,pn as AUTH_BASE_PATH,an as AccountPlan,Y as ApiHttp,ie as AuthMethod,U as BUILD_SETTINGS,M as CALLER,pe as DEFAULT_API,P as DEPLOYMENT_CONFIG_FILENAME,I as DEPLOY_FIELDS,ln as DEPLOY_FILE_GRAMMAR,Oe as DEPLOY_TOKEN,tn as DeploymentStatus,gt as DeploymentVia,nn as DomainStatus,rn as DomainVerification,y as ErrorType,R as FILE_VALIDATION_STATUS,R as FileValidationStatus,F as IDEMPOTENCY_KEY_CONSTRAINTS,Qt as JUNK_DIRECTORIES,v as LABEL_CONSTRAINTS,Ue as LABEL_PATTERN,Tn as MY_API_KEY_URL,xe as OAUTH_TOKEN,mn as OAuthScope,V as PASSWORD_CONSTRAINTS,An as PUBLIC_DEPLOYMENT_TTL_SECONDS,on as SETUP_TROUBLESHOOTING_ANCHOR,En as SHIP_ENV,gn as SHIP_VIA_ENV,cn as SIGN_IN_RETURN_PARAM,X as SPA_CHECK_CONSTRAINTS,ve as SPA_DEFAULT_CONFIG,Re as Ship,d as ShipError,k as TTL_CONSTRAINTS,x as TokenKind,_t as UNBUILT_PROJECT_MARKERS,It as UNSAFE_FILENAME_CHARS,un as WEB_FILE_ACCEPT,or as __setTestEnvironment,dr as allValidFilesReady,Fe as assertShipJsonSyntax,W as calculateMD5,Lt as classifyToken,We as createAccountResource,Ye as createDeploymentResource,je as createDomainResource,Je as createTokenResource,jr as default,Ln as deserializeLabels,Rn as extractSubdomain,rt as filterJunk,Ot as formatDuration,H as formatFileSize,Sn as formatTimeRemaining,bn as generateDeploymentUrl,In as generateDomainUrl,et as getENV,jt as getValidFiles,K as hasUnbuiltMarker,Pe as hasUnsafeChars,Ne as isBlockedExtension,Dn as isCustomDomain,yn as isDeployment,Me as isPlatformDomain,Le as isShipError,sn as normalizeVia,Ze as optimizeDeployPaths,Rr as pluralize,lt as processFilesForBrowser,dn as readBearerValue,_n as serializeLabels,Nt as validateApiKey,hn as validateApiUrl,He as validateBuildCommand,Ce as validateCaller,ot as validateDeployFile,it as validateDeployPath,Pt as validateDeployToken,Ee as validateFileName,fr as validateFiles,_e as validateIdempotencyKey,wt as validateOAuthToken,$e as validateOutputDir,ce as validatePassword,le as validateToken,ue as validateTtl};
|
|
2
2
|
//# sourceMappingURL=browser.js.map
|