@shipstatic/ship 2.1.0 → 2.2.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 CHANGED
@@ -62,7 +62,7 @@ ship ./dist --json
62
62
  "via": "cli",
63
63
  "created": 1743552000,
64
64
  "expires": 1743811200,
65
- "claim": "https://my.shipstatic.com/claim/abc123"
65
+ "claim": "https://my.shipstatic.com/claim/1234567890abcdef1234567890abcdef"
66
66
  }
67
67
  ```
68
68
 
package/dist/browser.d.ts CHANGED
@@ -863,14 +863,17 @@ declare class ShipError extends Error {
863
863
  */
864
864
  declare function isShipError(error: unknown): error is ShipError;
865
865
  /**
866
- * Plan-based platform limits returned by the `/limits` endpoint.
866
+ * What the platform will refuse, returned by the `/limits` endpoint.
867
867
  *
868
- * The SDK fetches these once on first API call to drive client-side
869
- * file-size / file-count / total-size validation that mirrors what the API
870
- * would enforce server-side. Limits vary by account plan.
868
+ * The SDK fetches this once on first API call to drive client-side validation
869
+ * that mirrors what the API would enforce server-side. The caps vary by
870
+ * account plan; the blocklist does not.
871
871
  *
872
- * These are the *platform's* posted caps for the current account — server
873
- * truth delivered at runtime, never hard-coded on the client.
872
+ * These are the *platform's* posted rules for the current account — server
873
+ * truth delivered at runtime, never hard-coded on the client. That is the
874
+ * whole point of the shape: a rule the server owns and may change reaches the
875
+ * client as data, so a pinned client cannot enforce a policy the platform has
876
+ * moved on from (`npm/types/CLAUDE.md`, "Validation: format vs policy").
874
877
  *
875
878
  * A report: it answers a question and carries only the answer (`CLAUDE.md`,
876
879
  * "A report answers a question").
@@ -882,38 +885,61 @@ interface PlatformLimits {
882
885
  maxFilesCount: number;
883
886
  /** Maximum total size in bytes across all files in a deployment. */
884
887
  maxTotalSize: number;
888
+ /**
889
+ * Lowercase extensions, without the dot, that the platform refuses to host
890
+ * (`exe`, `dmg`, …). Owned and evolved by the API — see
891
+ * `cloudflare/api/src/lib/blocklist.ts`.
892
+ *
893
+ * **Optional, and the absence is load-bearing.** An API deployed before this
894
+ * field existed sends nothing, so a client MUST read absence as "no
895
+ * client-side check" rather than as an empty policy. The hint fails open,
896
+ * the boundary fails closed: the server refuses the file either way, and a
897
+ * client that guessed would only ever be wrong in the direction that refuses
898
+ * a file the platform accepts.
899
+ *
900
+ * The optionality follows the additive-evolution law and retires with its
901
+ * reason: once every environment serves the field, it hardens to required at
902
+ * the entity's next natural break, and the clients' fail-open spellings
903
+ * retire with it (tracked in root `backlog.md`).
904
+ */
905
+ readonly blockedExtensions?: readonly string[];
885
906
  }
886
907
  /**
887
- * Blocked file extensions files that cannot be uploaded.
908
+ * Whether a file is one the platform refuses to host.
888
909
  *
889
- * We accept any file type by default and derive Content-Type from the
890
- * extension at serve time (via mime-db in the API worker). Unknown extensions
891
- * are served as `application/octet-stream` with `X-Content-Type-Options: nosniff`.
910
+ * **The list is not this package's, and that separation is the point.** What
911
+ * counts as a blocked extension is hosting POLICY it evolves, it is enforced
912
+ * at one security boundary, and `virus.exe` is a perfectly well-formed
913
+ * filename that breaks nothing about the upload→serve round-trip. So the API
914
+ * owns the list (`cloudflare/api/src/lib/blocklist.ts`) and delivers it as
915
+ * `PlatformLimits.blockedExtensions`; a client passes what it was given.
892
916
  *
893
- * The blocklist targets file types that pose direct security risks when hosted:
894
- * executables, disk images, malware vectors, dangerous scripts, and shortcuts.
895
- */
896
- declare const BLOCKED_EXTENSIONS: ReadonlySet<string>;
897
- /**
898
- * Check if a filename has a blocked extension.
899
- * Extracts the extension from the filename and checks against the blocklist.
900
- * Case-insensitive. Returns false for files without extensions.
917
+ * What lives here is the MATCHING RULE, and it earns its place by the
918
+ * constellation law's own test. The list's drift is loud in both directions —
919
+ * a stale client uploads a file the API refuses by name, on the first try.
920
+ * A second *matcher* drifts SILENTLY in the one direction that matters: a
921
+ * client stricter than the server refuses a legal file without the server ever
922
+ * being asked, and no error names it. Two holders, silent drift, one owner.
923
+ *
924
+ * The `blocked` collection is required rather than defaulted: this predicate
925
+ * guards a security boundary in the API, and a defaulted-empty argument there
926
+ * would block nothing while reading as though it did. Callers holding a
927
+ * possibly-absent wire field spell the fail-open themselves.
901
928
  *
902
929
  * @example
903
- * isBlockedExtension('virus.exe') // true
904
- * isBlockedExtension('app.dmg') // true
905
- * isBlockedExtension('style.css') // false
906
- * isBlockedExtension('data.custom') // false
907
- * isBlockedExtension('README') // false
930
+ * isBlockedExtension('virus.exe', ['exe']) // true
931
+ * isBlockedExtension('virus.EXE', ['exe']) // true — case-insensitive
932
+ * isBlockedExtension('style.css', ['exe']) // false
933
+ * isBlockedExtension('README', ['exe']) // false — no extension
908
934
  */
909
- declare function isBlockedExtension(filename: string): boolean;
935
+ declare function isBlockedExtension(filename: string, blocked: ReadonlySet<string> | readonly string[]): boolean;
910
936
  /**
911
937
  * The `accept` attribute value for a browser file picker offering web files.
912
938
  *
913
- * **This is a hint, never a rule.** `BLOCKED_EXTENSIONS` is the platform's
914
- * gate and the only thing that decides what may be hosted; this constant
915
- * decides what a *file dialog* shows first. The two are not two halves of one
916
- * policy, and this one must never be consulted to accept or reject a file.
939
+ * **This is a hint, never a rule.** The API's blocklist is the platform's gate
940
+ * and the only thing that decides what may be hosted; this constant decides
941
+ * what a *file dialog* shows first. The two are not two halves of one policy,
942
+ * and this one must never be consulted to accept or reject a file.
917
943
  *
918
944
  * The distinction is structural, not stylistic. `accept` can express only an
919
945
  * allowlist, while the platform's rule is a blocklist — so this list is
@@ -924,9 +950,12 @@ declare function isBlockedExtension(filename: string): boolean;
924
950
  * dropzone and the picker must reach the same verdict on the same files, and
925
951
  * they do — because the verdict is `validateFiles`, downstream of both.
926
952
  *
927
- * Kept beside `BLOCKED_EXTENSIONS` so one file holds both, which is what lets
928
- * `tests/validation-constants.test.ts` fence the invariant that matters: the
929
- * picker must never offer a file the platform will refuse.
953
+ * The invariant that matters the picker must never offer a file the platform
954
+ * will refuse — is fenced where the authority lives, in the API's own suite
955
+ * (`cloudflare/api/tests/lib/blocklist.test.ts`), which reads this published
956
+ * string and holds it against the list it owns. It sat here until the
957
+ * blocklist became the API's, and moving it was the price of that: a fence
958
+ * belongs with whichever side can change and break it.
930
959
  */
931
960
  declare const WEB_FILE_ACCEPT: string;
932
961
  /**
@@ -2358,13 +2387,22 @@ declare function validateDeployPath(deployPath: string, sourceIdentifier: string
2358
2387
  /**
2359
2388
  * Validate a deploy file's name and extension.
2360
2389
  * Rejects unsafe filenames (shell/URL-dangerous chars, reserved names)
2361
- * and blocked file extensions (.exe, .msi, .dll, etc.).
2390
+ * and file extensions the platform refuses to host.
2391
+ *
2392
+ * **The blocklist is the platform's, delivered — not this package's.** It
2393
+ * arrives as `PlatformLimits.blockedExtensions` from `GET /limits`, which the
2394
+ * client has already fetched by the time any file is processed. That is what
2395
+ * keeps a pinned CLI from enforcing a policy the platform has moved on from,
2396
+ * in either direction. Callers pass `[]` when the API sent no list (one that
2397
+ * predates the field): the check then does nothing and the API refuses the
2398
+ * file at the boundary, which is the correct place for it to be refused.
2362
2399
  *
2363
2400
  * @param deployPath - The deployment path to validate
2364
2401
  * @param sourceIdentifier - Human-readable identifier for error messages
2365
- * @throws {ShipError} If the filename is unsafe or extension is blocked
2402
+ * @param blockedExtensions - The platform's blocklist, from `/limits`
2403
+ * @throws {ShipError} If the filename is unsafe or the extension is blocked
2366
2404
  */
2367
- declare function validateDeployFile(deployPath: string, sourceIdentifier: string): void;
2405
+ declare function validateDeployFile(deployPath: string, sourceIdentifier: string, blockedExtensions: readonly string[]): void;
2368
2406
 
2369
2407
  /**
2370
2408
  * Utility functions for string manipulation.
@@ -2448,4 +2486,4 @@ declare class Ship extends Ship$1 {
2448
2486
  protected getDeployBodyCreator(): DeployBodyCreator;
2449
2487
  }
2450
2488
 
2451
- export { API_KEY, API_PATHS, AUTH_BASE_PATH, type Account, type AccountDeleteResponse, type AccountGetResponse, type AccountKeyResponse, type AccountOverrides, AccountPlan, type AccountPlanType, type AccountResource, type AccountUsage, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, BLOCKED_EXTENSIONS, type BillingCancelResponse, type BillingStatus, CALLER, type CheckoutSession, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_FIELDS, DEPLOY_TOKEN, type DeployBody, type DeployBodyContext, type DeployBodyCreator, type DeployFile, type DeployInput, 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, 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, OAuthScope, type OAuthScopeType, PASSWORD_CONSTRAINTS, PUBLIC_DEPLOYMENT_TTL_SECONDS, type PingResponse, type PlatformLimits, type ResourceContext, SHIP_ENV, type SPACheckDebug, type SPACheckRequest, type SPACheckResponse, SPA_CHECK_CONSTRAINTS, SPA_DEFAULT_CONFIG, type SetupInstructionsResponse, Ship, type ShipClientOptions, ShipError, type ShipEvents, type StaticFile, type Token, type TokenCreateOptions, type TokenCreateResponse, type TokenDeleteResponse, TokenKind, type TokenKindType, type TokenListResponse, type TokenProvider, type TokenResource, 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, formatFileSize, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isCustomDomain, isDeployment, isPlatformDomain, isShipError, normalizeVia, optimizeDeployPaths, pluralize, processFilesForBrowser, serializeLabels, validateApiKey, validateApiUrl, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validatePassword, validateToken };
2489
+ export { API_KEY, API_PATHS, AUTH_BASE_PATH, type Account, type AccountDeleteResponse, type AccountGetResponse, type AccountKeyResponse, type AccountOverrides, AccountPlan, type AccountPlanType, type AccountResource, type AccountUsage, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, type BillingCancelResponse, type BillingStatus, CALLER, type CheckoutSession, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_FIELDS, DEPLOY_TOKEN, type DeployBody, type DeployBodyContext, type DeployBodyCreator, type DeployFile, type DeployInput, 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, 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, OAuthScope, type OAuthScopeType, PASSWORD_CONSTRAINTS, PUBLIC_DEPLOYMENT_TTL_SECONDS, type PingResponse, type PlatformLimits, type ResourceContext, SHIP_ENV, type SPACheckDebug, type SPACheckRequest, type SPACheckResponse, SPA_CHECK_CONSTRAINTS, SPA_DEFAULT_CONFIG, type SetupInstructionsResponse, Ship, type ShipClientOptions, ShipError, type ShipEvents, type StaticFile, type Token, type TokenCreateOptions, type TokenCreateResponse, type TokenDeleteResponse, TokenKind, type TokenKindType, type TokenListResponse, type TokenProvider, type TokenResource, 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, formatFileSize, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isCustomDomain, isDeployment, isPlatformDomain, isShipError, normalizeVia, optimizeDeployPaths, pluralize, processFilesForBrowser, serializeLabels, validateApiKey, validateApiUrl, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validatePassword, validateToken };
package/dist/browser.js CHANGED
@@ -1,2 +1,2 @@
1
- var Je=Object.create;var B=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var Ze=Object.getOwnPropertyNames;var et=Object.getPrototypeOf,tt=Object.prototype.hasOwnProperty;var nt=(t,r,e)=>r in t?B(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e;var P=(t,r)=>()=>(t&&(r=t(t=0)),r);var ye=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports),rt=(t,r)=>{for(var e in r)B(t,e,{get:r[e],enumerable:!0})},it=(t,r,e,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let p of Ze(r))!tt.call(t,p)&&p!==e&&B(t,p,{get:()=>r[p],enumerable:!(a=Qe(r,p))||a.enumerable});return t};var H=(t,r,e)=>(e=t!=null?Je(et(t)):{},it(r||!t||!t.__esModule?B(e,"default",{value:t,enumerable:!0}):e,t));var G=(t,r,e)=>nt(t,typeof r!="symbol"?r+"":r,e);function Ft(t){if(!t||typeof t!="string")return;let r=t.trim().toLowerCase();return Object.values(st).includes(r)?r:void 0}function Ee(t){if(t==null)return;if(typeof t!="string")throw f.validation("Idempotency key must be a string.");let r=t.trim();if(!r)throw f.validation("Idempotency key must not be empty.");if(r.length>z.MAX_LENGTH)throw f.validation(`Idempotency key must be at most ${z.MAX_LENGTH} characters.`);return r}function pt(t){return typeof t.code=="string"?!0:t instanceof TypeError&&t.message.includes("fetch")}function Ae(t){return t!==null&&typeof t=="object"&&"name"in t&&t.name==="ShipError"&&"status"in t}function V(t){let r=t.lastIndexOf(".");if(r===-1||r===t.length-1)return!1;let e=t.slice(r+1).toLowerCase();return ct.has(e)}function De(t){return dt.test(t)}function K(t){return t.replace(/\\/g,"/").split("/").filter(Boolean).some(e=>ft.has(e))}function mt(t){return t.startsWith(Te.PREFIX)?F.API_KEY:t.startsWith(Se.PREFIX)?F.DEPLOY_TOKEN:F.OPAQUE}function Ie(t){let r=t.charCodeAt(0)===65279?t.slice(1):t,e;try{e=JSON.parse(r)}catch(a){throw f.config(`invalid JSON format in config: ${a.message}`,{filePath:_})}if(e===null||typeof e!="object"||Array.isArray(e))throw f.config(`${_} must contain a JSON object`,{filePath:_})}function be(t,r,e){if(!t.startsWith(r.PREFIX))throw f.validation(`${e} must start with "${r.PREFIX}"`);if(t.length!==r.TOTAL_LENGTH)throw f.validation(`${e} must be ${r.TOTAL_LENGTH} characters total (${r.PREFIX} + ${r.HEX_LENGTH} hex chars)`);let a=t.slice(r.PREFIX.length);if(!new RegExp(`^[a-f0-9]{${r.HEX_LENGTH}}$`,"i").test(a))throw f.validation(`${e} must contain ${r.HEX_LENGTH} hexadecimal characters after "${r.PREFIX}" prefix`)}function ht(t){be(t,Te,"API key")}function yt(t){be(t,Se,"Deploy token")}function ee(t){switch(mt(t)){case F.API_KEY:ht(t);return;case F.DEPLOY_TOKEN:yt(t);return;case F.OPAQUE:if(!t)throw f.validation("Token must be a non-empty string")}}function we(t){if(!t||t.length>$.MAX_LENGTH||!$.PATTERN.test(t))throw f.validation(`Caller must be 1-${$.MAX_LENGTH} characters: letters, digits, dots, underscores, or hyphens`)}function Bt(t){try{let r=new URL(t);if(!["http:","https:"].includes(r.protocol))throw f.validation("API URL must use http:// or https:// protocol");if(r.pathname!=="/"&&r.pathname!=="")throw f.validation("API URL must not contain a path");if(r.search||r.hash)throw f.validation("API URL must not contain query parameters or fragments")}catch(r){throw Ae(r)?r:f.validation("API URL must be a valid URL")}}function Ht(t){return/^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(t)}function Pe(t,r){return t.endsWith(`.${r}`)}function Vt(t,r){return!Pe(t,r)}function Kt(t,r){return Pe(t,r)?t.slice(0,-(r.length+1)):null}function jt(t){return`https://${t}`}function Yt(t){return`https://${t}`}function qt(t){return!t||t.length===0?null:JSON.stringify(t)}function Xt(t){if(!t)return[];try{let r=JSON.parse(t);return Array.isArray(r)?r:[]}catch{return[]}}function ne(t){if(t==null)return;if(typeof t!="string")throw f.validation("Password must be a string");let r=t.trim();if(r.length<k.MIN_LENGTH||r.length>k.MAX_LENGTH)throw f.validation(`Password must be between ${k.MIN_LENGTH} and ${k.MAX_LENGTH} characters`);return r}var vt,st,Ot,z,Ct,T,L,A,ot,Z,at,lt,f,ct,ut,$t,dt,ft,Ut,ge,Te,Se,$,F,Mt,_,Re,j,te,Gt,kt,zt,S,v,Le,k,R=P(()=>{"use strict";vt={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},st={WEB:"web",SDK:"sdk",CLI:"cli",MCP:"mcp",GIT:"git",N8N:"n8n",GPT:"gpt",VSC:"vsc"},Ot={PENDING:"pending",PARTIAL:"partial",SUCCESS:"success",PAUSED:"paused"},z={HEADER:"Idempotency-Key",MAX_LENGTH:256,WINDOW_SECONDS:1440*60};Ct={FREE:"free",STANDARD:"standard",SPONSORED:"sponsored",ENTERPRISE:"enterprise",SUSPENDED:"suspended",TERMINATING:"terminating",TERMINATED:"terminated"},T={DEPLOYMENTS:"/deployments",DEPLOYMENT:t=>`/deployments/${t}`,DEPLOYMENT_CONFIG:t=>`/deployments/${t}/config`,DOMAINS:"/domains",DOMAIN:t=>`/domains/${t}`,DOMAIN_VERIFY:t=>`/domains/${t}/verify`,DOMAIN_DNS:t=>`/domains/${t}/dns`,DOMAIN_RECORDS:t=>`/domains/${t}/records`,DOMAIN_SHARE:t=>`/domains/${t}/share`,DOMAIN_PROPAGATION:t=>`/domains/${t}/propagation`,DOMAINS_VALIDATE:"/domains/validate",TOKENS:"/tokens",TOKEN:t=>`/tokens/${t}`,ACCOUNT:"/account",ACCOUNT_KEY:"/account/key",ACCOUNT_CLAIM:"/account/claim",ACTIVITIES:"/activities",LABELS:"/labels",LIMITS:"/limits",PING:"/ping",SETUP:"/setup",SPA_CHECK:"/spa-check",UPLOAD:"/upload"},L={FILES:"files[]",CHECKSUMS:"checksums",LABELS:"labels",VIA:"via",PASSWORD:"password",BUILD:"build",PRERENDER:"prerender",SPA:"spa",CAPTCHA:"captcha"},A={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",Network:"network_error",Cancelled:"operation_cancelled",File:"file_error",Config:"config_error"},ot=new Set([A.Network,A.Cancelled,A.File,A.Config]),Z={client:new Set([A.Business,A.Cancelled,A.Config,A.File,A.Forbidden,A.NotFound,A.RateLimit,A.Validation]),network:new Set([A.Network]),auth:new Set([A.Authentication])},at=new Set(Object.values(A).filter(t=>!ot.has(t))),lt=200;f=class t extends Error{constructor(e,a,p,u){super(a);G(this,"type");G(this,"status");G(this,"details");this.type=e,this.status=p,this.details=u,this.name="ShipError"}toResponse(){let e=this.details,a=this.type===A.Authentication&&e?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:a}}static async fromHttpResponse(e,a){let p,u,h;try{if(e.headers.get("content-type")?.includes("application/json")){let m=await e.json();if(m&&typeof m=="object"){let E=m;typeof E.message=="string"?p=E.message:typeof E.error=="string"&&(p=E.error),u=E.details,typeof E.error=="string"&&at.has(E.error)&&(h=E.error)}}else{let m=(await e.text()).trim();m&&!m.startsWith("<")&&m.length<=lt&&(p=m)}}catch{}let y=e.headers.get("retry-after");if(y!==null){let g=y.trim(),m=/^\d+$/.test(g)?Number(g):Math.ceil((Date.parse(g)-Date.now())/1e3);if(Number.isFinite(m)&&m>=0){let E=u&&typeof u=="object"?u:{};E.retryAfter===void 0&&(u={...E,retryAfter:m})}}p=p||`${a||"Request"} failed with status ${e.status}`;let d=h??(e.status===401?A.Authentication:e.status===403?A.Forbidden:e.status===429?A.RateLimit:A.Api);return new t(d,p,e.status,u)}static fromFetchError(e,a){if(Ae(e))return e;let p=a||"Request";return e instanceof Error?e.name==="AbortError"?t.cancelled(`${p} was cancelled`):pt(e)?t.network(`${p} failed: ${e.message}`,{cause:e}):new t(A.Api,`${p} failed: ${e.message}`):new t(A.Api,`${p} failed: Unknown error`)}static validation(e,a){return new t(A.Validation,e,400,a)}static notFound(e,a){let p=a?`${e} ${a} not found`:`${e} not found`;return new t(A.NotFound,p,404)}static forbidden(e,a){return new t(A.Forbidden,e,403,a)}static rateLimit(e="Too many requests",a){return new t(A.RateLimit,e,429,a)}static authentication(e="Authentication required",a){return new t(A.Authentication,e,401,a)}static business(e,a=400,p){return new t(A.Business,e,a,p)}static network(e,a){return new t(A.Network,e,void 0,a)}static cancelled(e,a){return new t(A.Cancelled,e,void 0,a)}static file(e,a){return new t(A.File,e,void 0,a)}static config(e,a){return new t(A.Config,e,void 0,a)}static api(e,a=500,p){return new t(A.Api,e,a,p)}static maintenance(e,a){return new t(A.Maintenance,e,503,a)}isClientError(){return Z.client.has(this.type)?!0:this.status!==void 0&&this.status>=400&&this.status<500}isNetworkError(){return Z.network.has(this.type)}isAuthError(){return Z.auth.has(this.type)}isType(e){return this.type===e}};ct=new Set(["exe","msi","dll","scr","bat","cmd","com","pif","app","deb","rpm","pkg","mpkg","dmg","iso","img","cab","cpl","chm","ps1","vbs","vbe","ws","wsf","wsc","wsh","reg","jar","jnlp","apk","crx","lnk","inf","hta"]);ut=["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"],$t=ut.map(t=>`.${t}`).join(","),dt=/[\x00-\x1f\x7f#?%\\<>"]/;ft=new Set(["node_modules","package.json"]);Ut="/auth",ge={SESSION:"session",API_KEY:"apiKey",TOKEN:"token",AGENT:"agent",OAUTH:"oauth",WEBHOOK:"webhook",SYSTEM:"system"},Te={PREFIX:"ship-",HEX_LENGTH:32,TOTAL_LENGTH:37,HINT_LENGTH:4},Se={PREFIX:"deploy-",HEX_LENGTH:32,TOTAL_LENGTH:39},$={HEADER:"X-Caller",MAX_LENGTH:128,PATTERN:/^[a-zA-Z0-9._-]+$/},F={API_KEY:ge.API_KEY,DEPLOY_TOKEN:ge.TOKEN,OPAQUE:"opaque"};Mt={ACCOUNT_READ:"account:read",DEPLOYMENTS_READ:"deployments:read",DEPLOYMENTS_WRITE:"deployments:write",DOMAINS_READ:"domains:read",DOMAINS_WRITE:"domains:write"},_="ship.json",Re={rewrites:[{source:"/(.*)",destination:"/index.html"}]},j={INDEX_FILE:"index.html",MAX_INDEX_BYTES:100*1024};te="https://api.shipstatic.com",Gt={TOKEN:"SHIP_TOKEN",API_URL:"SHIP_API_URL"},kt="https://my.shipstatic.com/api-key",zt=4320*60,S={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:"._-"},Le=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;k={MIN_LENGTH:6,MAX_LENGTH:128}});var Oe=ye((Ne,ve)=>{"use strict";(function(t){if(typeof Ne=="object")ve.exports=t();else if(typeof define=="function"&&define.amd)define(t);else{var r;try{r=window}catch{r=self}r.SparkMD5=t()}})(function(t){"use strict";var r=function(c,l){return c+l&4294967295},e=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function a(c,l,i,n,o,s){return l=r(r(l,c),r(n,s)),r(l<<o|l>>>32-o,i)}function p(c,l){var i=c[0],n=c[1],o=c[2],s=c[3];i+=(n&o|~n&s)+l[0]-680876936|0,i=(i<<7|i>>>25)+n|0,s+=(i&n|~i&o)+l[1]-389564586|0,s=(s<<12|s>>>20)+i|0,o+=(s&i|~s&n)+l[2]+606105819|0,o=(o<<17|o>>>15)+s|0,n+=(o&s|~o&i)+l[3]-1044525330|0,n=(n<<22|n>>>10)+o|0,i+=(n&o|~n&s)+l[4]-176418897|0,i=(i<<7|i>>>25)+n|0,s+=(i&n|~i&o)+l[5]+1200080426|0,s=(s<<12|s>>>20)+i|0,o+=(s&i|~s&n)+l[6]-1473231341|0,o=(o<<17|o>>>15)+s|0,n+=(o&s|~o&i)+l[7]-45705983|0,n=(n<<22|n>>>10)+o|0,i+=(n&o|~n&s)+l[8]+1770035416|0,i=(i<<7|i>>>25)+n|0,s+=(i&n|~i&o)+l[9]-1958414417|0,s=(s<<12|s>>>20)+i|0,o+=(s&i|~s&n)+l[10]-42063|0,o=(o<<17|o>>>15)+s|0,n+=(o&s|~o&i)+l[11]-1990404162|0,n=(n<<22|n>>>10)+o|0,i+=(n&o|~n&s)+l[12]+1804603682|0,i=(i<<7|i>>>25)+n|0,s+=(i&n|~i&o)+l[13]-40341101|0,s=(s<<12|s>>>20)+i|0,o+=(s&i|~s&n)+l[14]-1502002290|0,o=(o<<17|o>>>15)+s|0,n+=(o&s|~o&i)+l[15]+1236535329|0,n=(n<<22|n>>>10)+o|0,i+=(n&s|o&~s)+l[1]-165796510|0,i=(i<<5|i>>>27)+n|0,s+=(i&o|n&~o)+l[6]-1069501632|0,s=(s<<9|s>>>23)+i|0,o+=(s&n|i&~n)+l[11]+643717713|0,o=(o<<14|o>>>18)+s|0,n+=(o&i|s&~i)+l[0]-373897302|0,n=(n<<20|n>>>12)+o|0,i+=(n&s|o&~s)+l[5]-701558691|0,i=(i<<5|i>>>27)+n|0,s+=(i&o|n&~o)+l[10]+38016083|0,s=(s<<9|s>>>23)+i|0,o+=(s&n|i&~n)+l[15]-660478335|0,o=(o<<14|o>>>18)+s|0,n+=(o&i|s&~i)+l[4]-405537848|0,n=(n<<20|n>>>12)+o|0,i+=(n&s|o&~s)+l[9]+568446438|0,i=(i<<5|i>>>27)+n|0,s+=(i&o|n&~o)+l[14]-1019803690|0,s=(s<<9|s>>>23)+i|0,o+=(s&n|i&~n)+l[3]-187363961|0,o=(o<<14|o>>>18)+s|0,n+=(o&i|s&~i)+l[8]+1163531501|0,n=(n<<20|n>>>12)+o|0,i+=(n&s|o&~s)+l[13]-1444681467|0,i=(i<<5|i>>>27)+n|0,s+=(i&o|n&~o)+l[2]-51403784|0,s=(s<<9|s>>>23)+i|0,o+=(s&n|i&~n)+l[7]+1735328473|0,o=(o<<14|o>>>18)+s|0,n+=(o&i|s&~i)+l[12]-1926607734|0,n=(n<<20|n>>>12)+o|0,i+=(n^o^s)+l[5]-378558|0,i=(i<<4|i>>>28)+n|0,s+=(i^n^o)+l[8]-2022574463|0,s=(s<<11|s>>>21)+i|0,o+=(s^i^n)+l[11]+1839030562|0,o=(o<<16|o>>>16)+s|0,n+=(o^s^i)+l[14]-35309556|0,n=(n<<23|n>>>9)+o|0,i+=(n^o^s)+l[1]-1530992060|0,i=(i<<4|i>>>28)+n|0,s+=(i^n^o)+l[4]+1272893353|0,s=(s<<11|s>>>21)+i|0,o+=(s^i^n)+l[7]-155497632|0,o=(o<<16|o>>>16)+s|0,n+=(o^s^i)+l[10]-1094730640|0,n=(n<<23|n>>>9)+o|0,i+=(n^o^s)+l[13]+681279174|0,i=(i<<4|i>>>28)+n|0,s+=(i^n^o)+l[0]-358537222|0,s=(s<<11|s>>>21)+i|0,o+=(s^i^n)+l[3]-722521979|0,o=(o<<16|o>>>16)+s|0,n+=(o^s^i)+l[6]+76029189|0,n=(n<<23|n>>>9)+o|0,i+=(n^o^s)+l[9]-640364487|0,i=(i<<4|i>>>28)+n|0,s+=(i^n^o)+l[12]-421815835|0,s=(s<<11|s>>>21)+i|0,o+=(s^i^n)+l[15]+530742520|0,o=(o<<16|o>>>16)+s|0,n+=(o^s^i)+l[2]-995338651|0,n=(n<<23|n>>>9)+o|0,i+=(o^(n|~s))+l[0]-198630844|0,i=(i<<6|i>>>26)+n|0,s+=(n^(i|~o))+l[7]+1126891415|0,s=(s<<10|s>>>22)+i|0,o+=(i^(s|~n))+l[14]-1416354905|0,o=(o<<15|o>>>17)+s|0,n+=(s^(o|~i))+l[5]-57434055|0,n=(n<<21|n>>>11)+o|0,i+=(o^(n|~s))+l[12]+1700485571|0,i=(i<<6|i>>>26)+n|0,s+=(n^(i|~o))+l[3]-1894986606|0,s=(s<<10|s>>>22)+i|0,o+=(i^(s|~n))+l[10]-1051523|0,o=(o<<15|o>>>17)+s|0,n+=(s^(o|~i))+l[1]-2054922799|0,n=(n<<21|n>>>11)+o|0,i+=(o^(n|~s))+l[8]+1873313359|0,i=(i<<6|i>>>26)+n|0,s+=(n^(i|~o))+l[15]-30611744|0,s=(s<<10|s>>>22)+i|0,o+=(i^(s|~n))+l[6]-1560198380|0,o=(o<<15|o>>>17)+s|0,n+=(s^(o|~i))+l[13]+1309151649|0,n=(n<<21|n>>>11)+o|0,i+=(o^(n|~s))+l[4]-145523070|0,i=(i<<6|i>>>26)+n|0,s+=(n^(i|~o))+l[11]-1120210379|0,s=(s<<10|s>>>22)+i|0,o+=(i^(s|~n))+l[2]+718787259|0,o=(o<<15|o>>>17)+s|0,n+=(s^(o|~i))+l[9]-343485551|0,n=(n<<21|n>>>11)+o|0,c[0]=i+c[0]|0,c[1]=n+c[1]|0,c[2]=o+c[2]|0,c[3]=s+c[3]|0}function u(c){var l=[],i;for(i=0;i<64;i+=4)l[i>>2]=c.charCodeAt(i)+(c.charCodeAt(i+1)<<8)+(c.charCodeAt(i+2)<<16)+(c.charCodeAt(i+3)<<24);return l}function h(c){var l=[],i;for(i=0;i<64;i+=4)l[i>>2]=c[i]+(c[i+1]<<8)+(c[i+2]<<16)+(c[i+3]<<24);return l}function y(c){var l=c.length,i=[1732584193,-271733879,-1732584194,271733878],n,o,s,b,x,N;for(n=64;n<=l;n+=64)p(i,u(c.substring(n-64,n)));for(c=c.substring(n-64),o=c.length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0;n<o;n+=1)s[n>>2]|=c.charCodeAt(n)<<(n%4<<3);if(s[n>>2]|=128<<(n%4<<3),n>55)for(p(i,s),n=0;n<16;n+=1)s[n]=0;return b=l*8,b=b.toString(16).match(/(.*?)(.{0,8})$/),x=parseInt(b[2],16),N=parseInt(b[1],16)||0,s[14]=x,s[15]=N,p(i,s),i}function d(c){var l=c.length,i=[1732584193,-271733879,-1732584194,271733878],n,o,s,b,x,N;for(n=64;n<=l;n+=64)p(i,h(c.subarray(n-64,n)));for(c=n-64<l?c.subarray(n-64):new Uint8Array(0),o=c.length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0;n<o;n+=1)s[n>>2]|=c[n]<<(n%4<<3);if(s[n>>2]|=128<<(n%4<<3),n>55)for(p(i,s),n=0;n<16;n+=1)s[n]=0;return b=l*8,b=b.toString(16).match(/(.*?)(.{0,8})$/),x=parseInt(b[2],16),N=parseInt(b[1],16)||0,s[14]=x,s[15]=N,p(i,s),i}function g(c){var l="",i;for(i=0;i<4;i+=1)l+=e[c>>i*8+4&15]+e[c>>i*8&15];return l}function m(c){var l;for(l=0;l<c.length;l+=1)c[l]=g(c[l]);return c.join("")}m(y("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(r=function(c,l){var i=(c&65535)+(l&65535),n=(c>>16)+(l>>16)+(i>>16);return n<<16|i&65535}),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function c(l,i){return l=l|0||0,l<0?Math.max(l+i,0):Math.min(l,i)}ArrayBuffer.prototype.slice=function(l,i){var n=this.byteLength,o=c(l,n),s=n,b,x,N,he;return i!==t&&(s=c(i,n)),o>s?new ArrayBuffer(0):(b=s-o,x=new ArrayBuffer(b),N=new Uint8Array(x),he=new Uint8Array(this,o,b),N.set(he),x)}})();function E(c){return/[\u0080-\uFFFF]/.test(c)&&(c=unescape(encodeURIComponent(c))),c}function I(c,l){var i=c.length,n=new ArrayBuffer(i),o=new Uint8Array(n),s;for(s=0;s<i;s+=1)o[s]=c.charCodeAt(s);return l?o:n}function w(c){return String.fromCharCode.apply(null,new Uint8Array(c))}function C(c,l,i){var n=new Uint8Array(c.byteLength+l.byteLength);return n.set(new Uint8Array(c)),n.set(new Uint8Array(l),c.byteLength),i?n:n.buffer}function O(c){var l=[],i=c.length,n;for(n=0;n<i-1;n+=2)l.push(parseInt(c.substr(n,2),16));return String.fromCharCode.apply(String,l)}function D(){this.reset()}return D.prototype.append=function(c){return this.appendBinary(E(c)),this},D.prototype.appendBinary=function(c){this._buff+=c,this._length+=c.length;var l=this._buff.length,i;for(i=64;i<=l;i+=64)p(this._hash,u(this._buff.substring(i-64,i)));return this._buff=this._buff.substring(i-64),this},D.prototype.end=function(c){var l=this._buff,i=l.length,n,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],s;for(n=0;n<i;n+=1)o[n>>2]|=l.charCodeAt(n)<<(n%4<<3);return this._finish(o,i),s=m(this._hash),c&&(s=O(s)),this.reset(),s},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(c){return this._buff=c.buff,this._length=c.length,this._hash=c.hash,this},D.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},D.prototype._finish=function(c,l){var i=l,n,o,s;if(c[i>>2]|=128<<(i%4<<3),i>55)for(p(this._hash,c),i=0;i<16;i+=1)c[i]=0;n=this._length*8,n=n.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(n[2],16),s=parseInt(n[1],16)||0,c[14]=o,c[15]=s,p(this._hash,c)},D.hash=function(c,l){return D.hashBinary(E(c),l)},D.hashBinary=function(c,l){var i=y(c),n=m(i);return l?O(n):n},D.ArrayBuffer=function(){this.reset()},D.ArrayBuffer.prototype.append=function(c){var l=C(this._buff.buffer,c,!0),i=l.length,n;for(this._length+=c.byteLength,n=64;n<=i;n+=64)p(this._hash,h(l.subarray(n-64,n)));return this._buff=n-64<i?new Uint8Array(l.buffer.slice(n-64)):new Uint8Array(0),this},D.ArrayBuffer.prototype.end=function(c){var l=this._buff,i=l.length,n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o,s;for(o=0;o<i;o+=1)n[o>>2]|=l[o]<<(o%4<<3);return this._finish(n,i),s=m(this._hash),c&&(s=O(s)),this.reset(),s},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 c=D.prototype.getState.call(this);return c.buff=w(c.buff),c},D.ArrayBuffer.prototype.setState=function(c){return c.buff=I(c.buff,!0),D.prototype.setState.call(this,c)},D.ArrayBuffer.prototype.destroy=D.prototype.destroy,D.ArrayBuffer.prototype._finish=D.prototype._finish,D.ArrayBuffer.hash=function(c,l){var i=d(new Uint8Array(c)),n=m(i);return l?O(n):n},D})});var X=ye((an,Fe)=>{"use strict";Fe.exports={}});async function Tt(t){let r=(await Promise.resolve().then(()=>H(Oe(),1))).default,e=new r.ArrayBuffer,a=2097152;for(let p=0;p<t.size;p+=a){let u=Math.min(p+a,t.size);e.append(await t.slice(p,u).arrayBuffer())}return{md5:e.end()}}async function St(t){let{createHash:r}=await Promise.resolve().then(()=>H(X(),1)),e=r("md5");return e.update(t),{md5:e.digest("hex")}}async function Rt(t){let{createHash:r}=await Promise.resolve().then(()=>H(X(),1)),{createReadStream:e}=await Promise.resolve().then(()=>H(X(),1));return new Promise((a,p)=>{let u=r("md5"),h=e(t);h.on("error",y=>p(f.file(`Failed to read file for MD5: ${y.message}`,{filePath:t}))),h.on("data",y=>u.update(y)),h.on("end",()=>a({md5:u.digest("hex")}))})}async function M(t){if(t instanceof Blob)return Tt(t);if(typeof Buffer<"u"&&Buffer.isBuffer(t))return St(t);if(typeof t=="string")return Rt(t);throw f.business("Invalid input for MD5 calculation")}var W=P(()=>{"use strict";R()});function Q(t){return t.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var Ge=P(()=>{"use strict"});function ke(t,r={}){if(r.flatten===!1)return t.map(a=>({path:Q(a),name:ie(a)}));let e=bt(t);return t.map(a=>{let p=Q(a);if(e){let u=e.endsWith("/")?e:`${e}/`;p.startsWith(u)&&(p=p.substring(u.length))}return p||(p=ie(a)),{path:p,name:ie(a)}})}function bt(t){if(!t.length)return"";let e=t.map(u=>Q(u)).map(u=>u.split("/")),a=[],p=Math.min(...e.map(u=>u.length));for(let u=0;u<p-1;u++){let h=e[0][u];if(e.every(y=>y[u]===h))a.push(h);else break}return a.join("/")}function ie(t){return t.split(/[/\\]/).pop()||t}var se=P(()=>{"use strict";Ge()});function Pn(t){oe=t}function wt(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function ze(){return oe||wt()}var oe,ae=P(()=>{"use strict";oe=null});function le(t,r=1){if(t===0)return"0 Bytes";let e=1024,a=["Bytes","KB","MB","GB"],p=Math.floor(Math.log(t)/Math.log(e));return`${parseFloat((t/e**p).toFixed(r))} ${a[p]}`}function pe(t){if(De(t))return{valid:!1,reason:"File name contains unsafe characters"};if(t.startsWith(" ")||t.endsWith(" "))return{valid:!1,reason:"File name cannot start/end with spaces"};if(t.endsWith("."))return{valid:!1,reason:"File name cannot end with dots"};let r=/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|$)/i,e=t.split("/").pop()||t;return r.test(e)?{valid:!1,reason:"File name uses a reserved system name"}:t.includes("..")?{valid:!1,reason:"File name contains path traversal pattern"}:{valid:!0}}function _n(t,r){let e=[],a=[],p=[];if(t.length===0){let d={file:"(no files)",message:"At least one file must be provided"};return e.push(d),{files:[],validFiles:[],errors:e,warnings:[],canDeploy:!1}}for(let d of t)if(K(d.name))return e.push({file:d.name,message:"Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder"}),{files:t.map(g=>({...g,status:S.VALIDATION_FAILED,statusMessage:"Unbuilt project detected"})),validFiles:[],errors:e,warnings:[],canDeploy:!1};if(t.length>r.maxFilesCount){let d={file:`(${t.length} files)`,message:`File count (${t.length}) exceeds limit of ${r.maxFilesCount}`};return e.push(d),{files:t.map(g=>({...g,status:S.VALIDATION_FAILED,statusMessage:d.message})),validFiles:[],errors:e,warnings:[],canDeploy:!1}}let u=0;for(let d of t){let g=S.READY,m="Ready for upload",E=d.name?pe(d.name):{valid:!1,reason:"File name cannot be empty"};if(d.status===S.PROCESSING_ERROR)g=S.VALIDATION_FAILED,m=d.statusMessage||"File failed during processing",e.push({file:d.name,message:m});else if(d.size===0){g=S.EXCLUDED,m="File is empty (0 bytes) and cannot be deployed due to storage limitations",a.push({file:d.name,message:m}),p.push({...d,status:g,statusMessage:m});continue}else d.size<0?(g=S.VALIDATION_FAILED,m="File size must be positive",e.push({file:d.name,message:m})):!d.name||d.name.trim().length===0?(g=S.VALIDATION_FAILED,m="File name cannot be empty",e.push({file:d.name||"(empty)",message:m})):d.name.includes("\0")?(g=S.VALIDATION_FAILED,m="File name contains invalid characters (null byte)",e.push({file:d.name,message:m})):E.valid?V(d.name)?(g=S.VALIDATION_FAILED,m=`File extension not allowed: "${d.name}"`,e.push({file:d.name,message:m})):d.size>r.maxFileSize?(g=S.VALIDATION_FAILED,m=`File size (${le(d.size)}) exceeds limit of ${le(r.maxFileSize)}`,e.push({file:d.name,message:m})):(u+=d.size,u>r.maxTotalSize&&(g=S.VALIDATION_FAILED,m=`Total size would exceed limit of ${le(r.maxTotalSize)}`,e.push({file:d.name,message:m}))):(g=S.VALIDATION_FAILED,m=E.reason||"Invalid file name",e.push({file:d.name,message:m}));p.push({...d,status:g,statusMessage:m})}e.length>0&&(p=p.map(d=>d.status===S.EXCLUDED?d:{...d,status:S.VALIDATION_FAILED,statusMessage:d.status===S.VALIDATION_FAILED?d.statusMessage:"Deployment failed due to validation errors in bundle"}));let h=e.length===0?p.filter(d=>d.status===S.READY):[],y=e.length===0;return{files:p,validFiles:h,errors:e,warnings:a,canDeploy:y}}function Pt(t){return t.filter(r=>r.status===S.READY)}function Nn(t){return Pt(t).length>0}var ce=P(()=>{"use strict";R()});function Ve(t){return xt.test(t)}var Lt,xt,Ke=P(()=>{"use strict";Lt=["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^[Dd]esktop\\.ini$","@eaDir$"],xt=new RegExp(Lt.join("|"))});function je(t,r){if(!t||t.length===0)return[];if(!r?.allowUnbuilt&&t.find(a=>a&&K(a)))throw f.business("Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder");return t.filter(e=>{if(!e)return!1;let a=e.replace(/\\/g,"/").split("/").filter(Boolean);if(a.length===0)return!0;let p=a[a.length-1];if(Ve(p))return!1;for(let h of a)if(h!==".well-known"&&(h.startsWith(".")||h.length>255))return!1;let u=a.slice(0,-1);for(let h of u)if(_t.some(y=>h.toLowerCase()===y.toLowerCase()))return!1;return!0})}var _t,ue=P(()=>{"use strict";R();Ke();_t=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function Ye(t,r){if(t.includes("\0")||t.includes("/../")||t.startsWith("../")||t.endsWith("/.."))throw f.business(`Security error: Unsafe file path "${t}" for file: ${r}`)}function qe(t,r){let e=pe(t);if(!e.valid)throw f.business(e.reason||"Invalid file name");if(V(t))throw f.business(`File extension not allowed: "${r}"`)}var de=P(()=>{"use strict";R();ce()});var We={};rt(We,{processFilesForBrowser:()=>Xe});async function Xe(t,r={},e){if(ze()!=="browser")throw f.business("processFilesForBrowser can only be called in a browser environment.");let a=t.map(E=>E.webkitRelativePath||E.name),p=r.build||r.prerender,u=ke(a,{flatten:r.pathDetect!==!1}),h=u.map(E=>E.path),y=new Set(je(h,{allowUnbuilt:p})),d=[];for(let E=0;E<t.length;E++)y.has(h[E])&&d.push({file:t[E],deployPath:u[E].path});if(d.length===0)return[];if(p){let E=[];for(let I=0;I<d.length;I++){let{file:w,deployPath:C}=d[I];if(w.size===0)continue;let{md5:O}=await M(w);E.push({path:C,content:w,size:w.size,md5:O})}return E}if(!e)throw f.config("Platform limits not provided. processFilesForBrowser requires the limits argument for deploy-mode validation \u2014 pass `ship.getLimits()` result.");let g=[],m=0;for(let E=0;E<d.length;E++){let{file:I,deployPath:w}=d[E];if(Ye(w,I.name),I.size===0)continue;if(qe(w,I.name),I.size>e.maxFileSize)throw f.business(`File ${I.name} is too large. Maximum allowed size is ${e.maxFileSize/(1024*1024)}MB.`);if(m+=I.size,m>e.maxTotalSize)throw f.business(`Total deploy size is too large. Maximum allowed is ${e.maxTotalSize/(1024*1024)}MB.`);let{md5:C}=await M(I);g.push({path:w,content:I,size:I.size,md5:C})}if(g.length>e.maxFilesCount)throw f.business(`Too many files to deploy. Maximum allowed is ${e.maxFilesCount} files.`);return g}var fe=P(()=>{"use strict";R();se();ae();ue();W();de()});R();R();R();var Y=class{constructor(){this.handlers=new Map}on(r,e){this.handlers.has(r)||this.handlers.set(r,new Set),this.handlers.get(r)?.add(e)}off(r,e){let a=this.handlers.get(r);a&&(a.delete(e),a.size===0&&this.handlers.delete(r))}emit(r,...e){let a=this.handlers.get(r);if(!a)return;let p=Array.from(a);for(let u of p)try{u(...e)}catch(h){a.delete(u),r!=="error"&&setTimeout(()=>{let y=h instanceof Error?h:new Error(String(h));this.emit("error",y,String(r))},0)}}};R();R();function U(t){if(t==null)return;if(t.length===0)return t;if(t.length>v.MAX_COUNT)throw f.validation(`Maximum ${v.MAX_COUNT} labels allowed`);let r=t.map((a,p)=>{if(typeof a!="string")throw f.validation(`Label at index ${p} must be a string`);let u=a.trim().toLowerCase();if(u.length<v.MIN_LENGTH)throw f.validation(`Labels must be at least ${v.MIN_LENGTH} characters long`);if(u.length>v.MAX_LENGTH)throw f.validation(`Labels must be no more than ${v.MAX_LENGTH} characters long`);if(!Le.test(u))throw f.validation(`Labels must start and end with alphanumeric characters, with optional separators (${v.SEPARATORS}) between segments`);return u}),e=[...new Set(r)];if(e.length!==r.length)throw f.validation("Duplicate labels are not allowed");return e}async function xe(t){let r=t.find(p=>p.path===_||p.path===`/${_}`);if(!r)return;let e=r.content,a=typeof e.text=="function"?await e.text():r.content.toString("utf8");Ie(a)}var gt=3e4,_e=3e5,Et=3e5,At=_e+Et,Dt="sdk";function re(t){let r=new URLSearchParams;t?.limit!==void 0&&r.set("limit",String(t.limit)),t?.cursor!==void 0&&r.set("cursor",t.cursor);let e=r.toString();return e?`?${e}`:""}var q=class extends Y{constructor(e){super();this.globalHeaders={};this.apiUrl=e.apiUrl||te,this.getAuthHeadersCallback=e.getAuthHeaders,this.session=e.session??!1,this.caller=e.caller,this.timeout=e.timeout??gt,this.deployTimeout=e.timeout??_e,this.deployBuildTimeout=e.timeout??At,this.fetch=e.fetch??globalThis.fetch.bind(globalThis),this.createDeployBody=e.createDeployBody,this.deployEndpoint=e.deployEndpoint||T.DEPLOYMENTS}setGlobalHeaders(e){this.globalHeaders=e}async executeRequest(e,a,p,u=this.timeout){let h=()=>{};try{let y=await this.mergeHeaders(a.headers),d=this.createTimeoutSignal(a.signal,u);h=d.cleanup;let g={...a,headers:y,credentials:this.session&&!y.Authorization?"include":void 0,signal:d.signal};this.emit("request",e,g);let m=await this.fetch(e,g);if(h(),!m.ok)throw await f.fromHttpResponse(m,p);return this.emit("response",this.safeClone(m),e),{data:await this.parseResponse(this.safeClone(m)),status:m.status}}catch(y){h();let d=f.fromFetchError(y,p);throw this.emit("error",d,e),d}}async request(e,a,p,u){let{data:h}=await this.executeRequest(e,a,p,u);return h}async requestWithStatus(e,a,p){return this.executeRequest(e,a,p)}async mergeHeaders(e={}){return{...this.globalHeaders,...this.caller?{[$.HEADER]:this.caller}:{},...await this.getAuthHeadersCallback(),...e}}createTimeoutSignal(e,a=this.timeout){let p=new AbortController,u=setTimeout(()=>p.abort(),a);if(e){let h=()=>p.abort();e.addEventListener("abort",h),e.aborted&&p.abort()}return{signal:p.signal,cleanup:()=>clearTimeout(u)}}safeClone(e){try{return e.clone()}catch{return e}}async parseResponse(e){if(!(e.headers.get("Content-Length")==="0"||e.status===204))return e.json()}async deploy(e,a={}){if(!e.length)throw f.business("No files to deploy");for(let g of e)if(!g.md5)throw f.file(`MD5 checksum missing for file: ${g.path}`,{filePath:g.path});ne(a.password);let p=Ee(a.idempotencyKey),u=U(a.labels);await xe(e);let h=a.build||a.prerender||a.spa?{build:a.build,prerender:a.prerender,spa:a.spa}:void 0,{body:y,headers:d}=await this.createDeployBody(e,{labels:u,via:a.via??Dt,password:a.password,flags:h,captcha:a.captcha});return this.request(`${this.apiUrl}${this.deployEndpoint}`,{method:"POST",body:y,headers:p?{...d,[z.HEADER]:p}:d,signal:a.signal||null},"Deploy",a.build||a.prerender?this.deployBuildTimeout:this.deployTimeout)}async listDeployments(e){return this.request(`${this.apiUrl}${T.DEPLOYMENTS}${re(e)}`,{method:"GET"},"List deployments")}async getDeployment(e){return this.request(`${this.apiUrl}${T.DEPLOYMENT(encodeURIComponent(e))}`,{method:"GET"},"Get deployment")}async updateDeploymentLabels(e,a){let p=U(a);return this.request(`${this.apiUrl}${T.DEPLOYMENT(encodeURIComponent(e))}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({labels:p})},"Update deployment labels")}async deleteDeployment(e){return this.request(`${this.apiUrl}${T.DEPLOYMENT(encodeURIComponent(e))}`,{method:"DELETE"},"Delete deployment")}async setDomain(e,a,p){let u=U(p),h={};a&&(h.deployment=a),u!==void 0&&(h.labels=u);let{data:y,status:d}=await this.requestWithStatus(`${this.apiUrl}${T.DOMAIN(encodeURIComponent(e))}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)},"Set domain");return{...y,isCreate:d===201}}async listDomains(e){return this.request(`${this.apiUrl}${T.DOMAINS}${re(e)}`,{method:"GET"},"List domains")}async getDomain(e){return this.request(`${this.apiUrl}${T.DOMAIN(encodeURIComponent(e))}`,{method:"GET"},"Get domain")}async deleteDomain(e){return this.request(`${this.apiUrl}${T.DOMAIN(encodeURIComponent(e))}`,{method:"DELETE"},"Delete domain")}async verifyDomain(e){return this.request(`${this.apiUrl}${T.DOMAIN_VERIFY(encodeURIComponent(e))}`,{method:"POST"},"Verify domain")}async getDomainDns(e){return this.request(`${this.apiUrl}${T.DOMAIN_DNS(encodeURIComponent(e))}`,{method:"GET"},"Get domain DNS")}async getDomainRecords(e){return this.request(`${this.apiUrl}${T.DOMAIN_RECORDS(encodeURIComponent(e))}`,{method:"GET"},"Get domain records")}async getDomainShare(e){return this.request(`${this.apiUrl}${T.DOMAIN_SHARE(encodeURIComponent(e))}`,{method:"GET"},"Get domain share")}async validateDomain(e){return this.request(`${this.apiUrl}${T.DOMAINS_VALIDATE}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:e})},"Validate domain")}async createToken(e,a){let p=U(a),u={};return e!==void 0&&(u.ttl=e),p!==void 0&&(u.labels=p),this.request(`${this.apiUrl}${T.TOKENS}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)},"Create token")}async listTokens(e){return this.request(`${this.apiUrl}${T.TOKENS}${re(e)}`,{method:"GET"},"List tokens")}async deleteToken(e){return this.request(`${this.apiUrl}${T.TOKEN(encodeURIComponent(e))}`,{method:"DELETE"},"Delete token")}async getToken(e){return this.request(`${this.apiUrl}${T.TOKEN(encodeURIComponent(e))}`,{method:"GET"},"Get token")}async getAccount(){return this.request(`${this.apiUrl}${T.ACCOUNT}`,{method:"GET"},"Get account")}async getLimits(){return this.request(`${this.apiUrl}${T.LIMITS}`,{method:"GET"},"Get limits")}async ping(){return this.request(`${this.apiUrl}${T.PING}`,{method:"GET"},"Ping")}async checkSPA(e,a={}){let p=e.find(d=>d.path===j.INDEX_FILE||d.path===`/${j.INDEX_FILE}`);if(!p||p.size>j.MAX_INDEX_BYTES)return!1;let u;if(typeof Buffer<"u"&&Buffer.isBuffer(p.content))u=p.content.toString("utf-8");else if(typeof Blob<"u"&&p.content instanceof Blob)u=await p.content.text();else if(typeof File<"u"&&p.content instanceof File)u=await p.content.text();else return!1;let h={files:e.map(d=>d.path),index:u};return(await this.request(`${this.apiUrl}${T.SPA_CHECK}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)},"SPA check")).isSPA}};R();R();W();async function It(){let t=JSON.stringify(Re,null,2),r;typeof Buffer<"u"?r=Buffer.from(t,"utf-8"):r=new Blob([t],{type:"application/json"});let{md5:e}=await M(r);return{path:_,content:r,size:t.length,md5:e}}async function Ce(t,r,e){if(e.spaDetect===!1||e.spa||e.build||e.prerender||t.some(a=>a.path===_))return t;try{if(await r.checkSPA(t,e)){let p=await It();return[...t,p]}}catch{}return t}function $e(t){let{getApi:r,ensureInit:e,processInput:a}=t;return{upload:async(p,u={})=>{if(await e(),!a)throw f.config("processInput function is not provided.");let h=r(),y=await a(p,u);return y=await Ce(y,h,u),h.deploy(y,u)},list:async p=>(await e(),r().listDeployments(p)),get:async p=>(await e(),r().getDeployment(p)),set:async(p,u)=>(await e(),r().updateDeploymentLabels(p,u.labels)),delete:async p=>(await e(),r().deleteDeployment(p))}}function Ue(t){let{getApi:r,ensureInit:e}=t;return{set:async(a,p={})=>(await e(),r().setDomain(a,p.deployment,p.labels)),list:async a=>(await e(),r().listDomains(a)),get:async a=>(await e(),r().getDomain(a)),delete:async a=>(await e(),r().deleteDomain(a)),verify:async a=>(await e(),r().verifyDomain(a)),validate:async a=>(await e(),r().validateDomain(a)),dns:async a=>(await e(),r().getDomainDns(a)),records:async a=>(await e(),r().getDomainRecords(a)),share:async a=>(await e(),r().getDomainShare(a))}}function Me(t){let{getApi:r,ensureInit:e}=t;return{get:async()=>(await e(),r().getAccount())}}function Be(t){let{getApi:r,ensureInit:e}=t;return{create:async(a={})=>(await e(),r().createToken(a.ttl,a.labels)),list:async a=>(await e(),r().listTokens(a)),get:async a=>(await e(),r().getToken(a)),delete:async a=>(await e(),r().deleteToken(a))}}var J=class{constructor(r={}){this.initPromise=null;this.platformLimits=null;this.credential=null;if(r={...r,apiUrl:r.apiUrl||void 0,token:r.token||void 0,caller:r.caller||void 0},this.clientOptions=r,r.caller!==void 0&&we(r.caller),r.token&&r.session)throw f.config("Provide either `token` or `session`, not both.");typeof r.token=="string"?(ee(r.token),this.credential=r.token):r.token&&(this.credential=r.token),this.http=new q({...r,getAuthHeaders:()=>this.getAuthHeaders(),createDeployBody:this.getDeployBodyCreator()});let e={getApi:()=>this.http,ensureInit:()=>this.ensureInitialized()};this.deployments=$e({...e,processInput:(a,p)=>this.processInput(a,p)}),this.domains=Ue(e),this.account=Me(e),this.tokens=Be(e)}async ensureInitialized(){return this.initPromise||(this.initPromise=this.fetchPlatformLimits()),this.initPromise}async fetchPlatformLimits(){try{this.platformLimits=await this.http.getLimits()}catch(r){throw this.initPromise=null,r}}async ping(){return await this.ensureInitialized(),this.http.ping()}async deploy(r,e){return this.deployments.upload(r,e)}async whoami(){return this.account.get()}async getLimits(){return this.platformLimits?this.platformLimits:(await this.ensureInitialized(),this.platformLimits)}on(r,e){this.http.on(r,e)}off(r,e){this.http.off(r,e)}setHeaders(r){this.http.setGlobalHeaders(r)}clearHeaders(){this.http.setGlobalHeaders({})}setToken(r){if(this.clientOptions.session)throw f.config("Provide either `token` or `session`, not both.");if(typeof r=="string"){if(!r)throw f.business("Invalid token provided. Token must be a non-empty string.");ee(r),this.credential=r;return}if(typeof r!="function")throw f.business("Invalid token provided. Token must be a non-empty string or a provider function.");this.credential=r}async getAuthHeaders(){if(this.credential===null)return{};let r=typeof this.credential=="function"?await this.credential():this.credential;if(!r)throw f.authentication("Token provider returned no token.");if(typeof r!="string")throw f.authentication("Token provider returned a non-string value.");return{Authorization:`Bearer ${r}`}}};R();async function He(t,r={}){let{labels:e,via:a,password:p,flags:u,captcha:h}=r,y=new FormData,d=[];for(let g of t){if(!(g.content instanceof File||g.content instanceof Blob))throw f.file(`Unsupported file.content type for browser: ${g.path}`,{filePath:g.path});if(!g.md5)throw f.file(`File missing md5 checksum: ${g.path}`,{filePath:g.path});let m=new File([g.content],g.path,{type:"application/octet-stream"});y.append(L.FILES,m),d.push(g.md5)}return y.append(L.CHECKSUMS,JSON.stringify(d)),e&&e.length>0&&y.append(L.LABELS,JSON.stringify(e)),a&&y.append(L.VIA,a),p&&y.append(L.PASSWORD,p),u?.build&&y.append(L.BUILD,"true"),u?.prerender&&y.append(L.PRERENDER,"true"),u?.spa&&y.append(L.SPA,"true"),h&&y.append(L.CAPTCHA,h),{body:y,headers:{}}}R();R();se();ae();ce();ue();W();de();function Hn(t,r,e,a=!0){let p=t===1?r:e;return a?`${t} ${p}`:p}fe();var me=class extends J{async deploy(r,e){return super.deploy(r,e)}async processInput(r,e){if(!Array.isArray(r)||!r.every(p=>p instanceof File))throw f.business("Invalid input type for browser environment. Expected File[].");if(r.length===0)throw f.business("No files to deploy.");let{processFilesForBrowser:a}=await Promise.resolve().then(()=>(fe(),We));return a(r,e,this.platformLimits??void 0)}getDeployBodyCreator(){return He}},cr=me;export{Te as API_KEY,T as API_PATHS,Ut as AUTH_BASE_PATH,Ct as AccountPlan,q as ApiHttp,ge as AuthMethod,ct as BLOCKED_EXTENSIONS,$ as CALLER,te as DEFAULT_API,_ as DEPLOYMENT_CONFIG_FILENAME,L as DEPLOY_FIELDS,Se as DEPLOY_TOKEN,vt as DeploymentStatus,st as DeploymentVia,Ot as DomainStatus,A as ErrorType,S as FILE_VALIDATION_STATUS,S as FileValidationStatus,z as IDEMPOTENCY_KEY_CONSTRAINTS,_t as JUNK_DIRECTORIES,v as LABEL_CONSTRAINTS,Le as LABEL_PATTERN,kt as MY_API_KEY_URL,Mt as OAuthScope,k as PASSWORD_CONSTRAINTS,zt as PUBLIC_DEPLOYMENT_TTL_SECONDS,Gt as SHIP_ENV,j as SPA_CHECK_CONSTRAINTS,Re as SPA_DEFAULT_CONFIG,me as Ship,f as ShipError,F as TokenKind,ft as UNBUILT_PROJECT_MARKERS,dt as UNSAFE_FILENAME_CHARS,$t as WEB_FILE_ACCEPT,Pn as __setTestEnvironment,Nn as allValidFilesReady,Ie as assertShipJsonSyntax,M as calculateMD5,mt as classifyToken,Me as createAccountResource,$e as createDeploymentResource,Ue as createDomainResource,Be as createTokenResource,cr as default,Xt as deserializeLabels,Kt as extractSubdomain,je as filterJunk,le as formatFileSize,jt as generateDeploymentUrl,Yt as generateDomainUrl,ze as getENV,Pt as getValidFiles,K as hasUnbuiltMarker,De as hasUnsafeChars,V as isBlockedExtension,Vt as isCustomDomain,Ht as isDeployment,Pe as isPlatformDomain,Ae as isShipError,Ft as normalizeVia,ke as optimizeDeployPaths,Hn as pluralize,Xe as processFilesForBrowser,qt as serializeLabels,ht as validateApiKey,Bt as validateApiUrl,we as validateCaller,qe as validateDeployFile,Ye as validateDeployPath,yt as validateDeployToken,pe as validateFileName,_n as validateFiles,Ee as validateIdempotencyKey,ne as validatePassword,ee as validateToken};
1
+ var Je=Object.create;var B=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var Ze=Object.getOwnPropertyNames;var et=Object.getPrototypeOf,tt=Object.prototype.hasOwnProperty;var nt=(t,r,e)=>r in t?B(t,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[r]=e;var L=(t,r)=>()=>(t&&(r=t(t=0)),r);var ye=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports),rt=(t,r)=>{for(var e in r)B(t,e,{get:r[e],enumerable:!0})},it=(t,r,e,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let p of Ze(r))!tt.call(t,p)&&p!==e&&B(t,p,{get:()=>r[p],enumerable:!(a=Qe(r,p))||a.enumerable});return t};var H=(t,r,e)=>(e=t!=null?Je(et(t)):{},it(r||!t||!t.__esModule?B(e,"default",{value:t,enumerable:!0}):e,t));var G=(t,r,e)=>nt(t,typeof r!="symbol"?r+"":r,e);function Ft(t){if(!t||typeof t!="string")return;let r=t.trim().toLowerCase();return Object.values(st).includes(r)?r:void 0}function Ee(t){if(t==null)return;if(typeof t!="string")throw f.validation("Idempotency key must be a string.");let r=t.trim();if(!r)throw f.validation("Idempotency key must not be empty.");if(r.length>z.MAX_LENGTH)throw f.validation(`Idempotency key must be at most ${z.MAX_LENGTH} characters.`);return r}function pt(t){return typeof t.code=="string"?!0:t instanceof TypeError&&t.message.includes("fetch")}function Ae(t){return t!==null&&typeof t=="object"&&"name"in t&&t.name==="ShipError"&&"status"in t}function ut(t){let r=t.replace(/\\/g,"/").split("/").pop()??"",e=r.lastIndexOf(".");return e<=0||e===r.length-1?null:r.slice(e+1).toLowerCase()}function V(t,r){let e=ut(t);return e===null?!1:Array.isArray(r)?r.includes(e):r.has(e)}function De(t){return dt.test(t)}function K(t){return t.replace(/\\/g,"/").split("/").filter(Boolean).some(e=>ft.has(e))}function mt(t){return t.startsWith(Te.PREFIX)?C.API_KEY:t.startsWith(Se.PREFIX)?C.DEPLOY_TOKEN:C.OPAQUE}function Ie(t){let r=t.charCodeAt(0)===65279?t.slice(1):t,e;try{e=JSON.parse(r)}catch(a){throw f.config(`invalid JSON format in config: ${a.message}`,{filePath:N})}if(e===null||typeof e!="object"||Array.isArray(e))throw f.config(`${N} must contain a JSON object`,{filePath:N})}function be(t,r,e){if(!t.startsWith(r.PREFIX))throw f.validation(`${e} must start with "${r.PREFIX}"`);if(t.length!==r.TOTAL_LENGTH)throw f.validation(`${e} must be ${r.TOTAL_LENGTH} characters total (${r.PREFIX} + ${r.HEX_LENGTH} hex chars)`);let a=t.slice(r.PREFIX.length);if(!new RegExp(`^[a-f0-9]{${r.HEX_LENGTH}}$`,"i").test(a))throw f.validation(`${e} must contain ${r.HEX_LENGTH} hexadecimal characters after "${r.PREFIX}" prefix`)}function ht(t){be(t,Te,"API key")}function yt(t){be(t,Se,"Deploy token")}function ee(t){switch(mt(t)){case C.API_KEY:ht(t);return;case C.DEPLOY_TOKEN:yt(t);return;case C.OPAQUE:if(!t)throw f.validation("Token must be a non-empty string")}}function we(t){if(!t||t.length>$.MAX_LENGTH||!$.PATTERN.test(t))throw f.validation(`Caller must be 1-${$.MAX_LENGTH} characters: letters, digits, dots, underscores, or hyphens`)}function Bt(t){try{let r=new URL(t);if(!["http:","https:"].includes(r.protocol))throw f.validation("API URL must use http:// or https:// protocol");if(r.pathname!=="/"&&r.pathname!=="")throw f.validation("API URL must not contain a path");if(r.search||r.hash)throw f.validation("API URL must not contain query parameters or fragments")}catch(r){throw Ae(r)?r:f.validation("API URL must be a valid URL")}}function Ht(t){return/^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(t)}function Pe(t,r){return t.endsWith(`.${r}`)}function Vt(t,r){return!Pe(t,r)}function Kt(t,r){return Pe(t,r)?t.slice(0,-(r.length+1)):null}function jt(t){return`https://${t}`}function Yt(t){return`https://${t}`}function qt(t){return!t||t.length===0?null:JSON.stringify(t)}function Xt(t){if(!t)return[];try{let r=JSON.parse(t);return Array.isArray(r)?r:[]}catch{return[]}}function ne(t){if(t==null)return;if(typeof t!="string")throw f.validation("Password must be a string");let r=t.trim();if(r.length<k.MIN_LENGTH||r.length>k.MAX_LENGTH)throw f.validation(`Password must be between ${k.MIN_LENGTH} and ${k.MAX_LENGTH} characters`);return r}var vt,st,Ot,z,Ct,D,x,E,ot,Z,at,lt,f,ct,$t,dt,ft,Ut,ge,Te,Se,$,C,Mt,N,Re,j,te,Gt,kt,zt,R,F,Le,k,I=L(()=>{"use strict";vt={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},st={WEB:"web",SDK:"sdk",CLI:"cli",MCP:"mcp",GIT:"git",N8N:"n8n",GPT:"gpt",VSC:"vsc"},Ot={PENDING:"pending",PARTIAL:"partial",SUCCESS:"success",PAUSED:"paused"},z={HEADER:"Idempotency-Key",MAX_LENGTH:256,WINDOW_SECONDS:1440*60};Ct={FREE:"free",STANDARD:"standard",SPONSORED:"sponsored",ENTERPRISE:"enterprise",SUSPENDED:"suspended",TERMINATING:"terminating",TERMINATED:"terminated"},D={DEPLOYMENTS:"/deployments",DEPLOYMENT:t=>`/deployments/${t}`,DEPLOYMENT_CONFIG:t=>`/deployments/${t}/config`,DOMAINS:"/domains",DOMAIN:t=>`/domains/${t}`,DOMAIN_VERIFY:t=>`/domains/${t}/verify`,DOMAIN_DNS:t=>`/domains/${t}/dns`,DOMAIN_RECORDS:t=>`/domains/${t}/records`,DOMAIN_SHARE:t=>`/domains/${t}/share`,DOMAIN_PROPAGATION:t=>`/domains/${t}/propagation`,DOMAINS_VALIDATE:"/domains/validate",TOKENS:"/tokens",TOKEN:t=>`/tokens/${t}`,ACCOUNT:"/account",ACCOUNT_KEY:"/account/key",ACCOUNT_CLAIM:"/account/claim",ACTIVITIES:"/activities",LABELS:"/labels",LIMITS:"/limits",PING:"/ping",SETUP:"/setup",SPA_CHECK:"/spa-check",UPLOAD:"/upload"},x={FILES:"files[]",CHECKSUMS:"checksums",LABELS:"labels",VIA:"via",PASSWORD:"password",BUILD:"build",PRERENDER:"prerender",SPA:"spa",CAPTCHA:"captcha"},E={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",Network:"network_error",Cancelled:"operation_cancelled",File:"file_error",Config:"config_error"},ot=new Set([E.Network,E.Cancelled,E.File,E.Config]),Z={client:new Set([E.Business,E.Cancelled,E.Config,E.File,E.Forbidden,E.NotFound,E.RateLimit,E.Validation]),network:new Set([E.Network]),auth:new Set([E.Authentication])},at=new Set(Object.values(E).filter(t=>!ot.has(t))),lt=200;f=class t extends Error{constructor(e,a,p,c){super(a);G(this,"type");G(this,"status");G(this,"details");this.type=e,this.status=p,this.details=c,this.name="ShipError"}toResponse(){let e=this.details,a=this.type===E.Authentication&&e?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:a}}static async fromHttpResponse(e,a){let p,c,h;try{if(e.headers.get("content-type")?.includes("application/json")){let m=await e.json();if(m&&typeof m=="object"){let T=m;typeof T.message=="string"?p=T.message:typeof T.error=="string"&&(p=T.error),c=T.details,typeof T.error=="string"&&at.has(T.error)&&(h=T.error)}}else{let m=(await e.text()).trim();m&&!m.startsWith("<")&&m.length<=lt&&(p=m)}}catch{}let y=e.headers.get("retry-after");if(y!==null){let g=y.trim(),m=/^\d+$/.test(g)?Number(g):Math.ceil((Date.parse(g)-Date.now())/1e3);if(Number.isFinite(m)&&m>=0){let T=c&&typeof c=="object"?c:{};T.retryAfter===void 0&&(c={...T,retryAfter:m})}}p=p||`${a||"Request"} failed with status ${e.status}`;let d=h??(e.status===401?E.Authentication:e.status===403?E.Forbidden:e.status===429?E.RateLimit:E.Api);return new t(d,p,e.status,c)}static fromFetchError(e,a){if(Ae(e))return e;let p=a||"Request";return e instanceof Error?e.name==="AbortError"?t.cancelled(`${p} was cancelled`):pt(e)?t.network(`${p} failed: ${e.message}`,{cause:e}):new t(E.Api,`${p} failed: ${e.message}`):new t(E.Api,`${p} failed: Unknown error`)}static validation(e,a){return new t(E.Validation,e,400,a)}static notFound(e,a){let p=a?`${e} ${a} not found`:`${e} not found`;return new t(E.NotFound,p,404)}static forbidden(e,a){return new t(E.Forbidden,e,403,a)}static rateLimit(e="Too many requests",a){return new t(E.RateLimit,e,429,a)}static authentication(e="Authentication required",a){return new t(E.Authentication,e,401,a)}static business(e,a=400,p){return new t(E.Business,e,a,p)}static network(e,a){return new t(E.Network,e,void 0,a)}static cancelled(e,a){return new t(E.Cancelled,e,void 0,a)}static file(e,a){return new t(E.File,e,void 0,a)}static config(e,a){return new t(E.Config,e,void 0,a)}static api(e,a=500,p){return new t(E.Api,e,a,p)}static maintenance(e,a){return new t(E.Maintenance,e,503,a)}isClientError(){return Z.client.has(this.type)?!0:this.status!==void 0&&this.status>=400&&this.status<500}isNetworkError(){return Z.network.has(this.type)}isAuthError(){return Z.auth.has(this.type)}isType(e){return this.type===e}};ct=["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"],$t=ct.map(t=>`.${t}`).join(","),dt=/[\x00-\x1f\x7f#?%\\<>"]/;ft=new Set(["node_modules","package.json"]);Ut="/auth",ge={SESSION:"session",API_KEY:"apiKey",TOKEN:"token",AGENT:"agent",OAUTH:"oauth",WEBHOOK:"webhook",SYSTEM:"system"},Te={PREFIX:"ship-",HEX_LENGTH:32,TOTAL_LENGTH:37,HINT_LENGTH:4},Se={PREFIX:"deploy-",HEX_LENGTH:32,TOTAL_LENGTH:39},$={HEADER:"X-Caller",MAX_LENGTH:128,PATTERN:/^[a-zA-Z0-9._-]+$/},C={API_KEY:ge.API_KEY,DEPLOY_TOKEN:ge.TOKEN,OPAQUE:"opaque"};Mt={ACCOUNT_READ:"account:read",DEPLOYMENTS_READ:"deployments:read",DEPLOYMENTS_WRITE:"deployments:write",DOMAINS_READ:"domains:read",DOMAINS_WRITE:"domains:write"},N="ship.json",Re={rewrites:[{source:"/(.*)",destination:"/index.html"}]},j={INDEX_FILE:"index.html",MAX_INDEX_BYTES:100*1024};te="https://api.shipstatic.com",Gt={TOKEN:"SHIP_TOKEN",API_URL:"SHIP_API_URL"},kt="https://my.shipstatic.com/api-key",zt=4320*60,R={PENDING:"pending",PROCESSING_ERROR:"processing_error",EXCLUDED:"excluded",VALIDATION_FAILED:"validation_failed",READY:"ready"};F={MIN_LENGTH:3,MAX_LENGTH:25,MAX_COUNT:10,SEPARATORS:"._-"},Le=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;k={MIN_LENGTH:6,MAX_LENGTH:128}});var Oe=ye((Ne,ve)=>{"use strict";(function(t){if(typeof Ne=="object")ve.exports=t();else if(typeof define=="function"&&define.amd)define(t);else{var r;try{r=window}catch{r=self}r.SparkMD5=t()}})(function(t){"use strict";var r=function(u,l){return u+l&4294967295},e=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function a(u,l,i,n,o,s){return l=r(r(l,u),r(n,s)),r(l<<o|l>>>32-o,i)}function p(u,l){var i=u[0],n=u[1],o=u[2],s=u[3];i+=(n&o|~n&s)+l[0]-680876936|0,i=(i<<7|i>>>25)+n|0,s+=(i&n|~i&o)+l[1]-389564586|0,s=(s<<12|s>>>20)+i|0,o+=(s&i|~s&n)+l[2]+606105819|0,o=(o<<17|o>>>15)+s|0,n+=(o&s|~o&i)+l[3]-1044525330|0,n=(n<<22|n>>>10)+o|0,i+=(n&o|~n&s)+l[4]-176418897|0,i=(i<<7|i>>>25)+n|0,s+=(i&n|~i&o)+l[5]+1200080426|0,s=(s<<12|s>>>20)+i|0,o+=(s&i|~s&n)+l[6]-1473231341|0,o=(o<<17|o>>>15)+s|0,n+=(o&s|~o&i)+l[7]-45705983|0,n=(n<<22|n>>>10)+o|0,i+=(n&o|~n&s)+l[8]+1770035416|0,i=(i<<7|i>>>25)+n|0,s+=(i&n|~i&o)+l[9]-1958414417|0,s=(s<<12|s>>>20)+i|0,o+=(s&i|~s&n)+l[10]-42063|0,o=(o<<17|o>>>15)+s|0,n+=(o&s|~o&i)+l[11]-1990404162|0,n=(n<<22|n>>>10)+o|0,i+=(n&o|~n&s)+l[12]+1804603682|0,i=(i<<7|i>>>25)+n|0,s+=(i&n|~i&o)+l[13]-40341101|0,s=(s<<12|s>>>20)+i|0,o+=(s&i|~s&n)+l[14]-1502002290|0,o=(o<<17|o>>>15)+s|0,n+=(o&s|~o&i)+l[15]+1236535329|0,n=(n<<22|n>>>10)+o|0,i+=(n&s|o&~s)+l[1]-165796510|0,i=(i<<5|i>>>27)+n|0,s+=(i&o|n&~o)+l[6]-1069501632|0,s=(s<<9|s>>>23)+i|0,o+=(s&n|i&~n)+l[11]+643717713|0,o=(o<<14|o>>>18)+s|0,n+=(o&i|s&~i)+l[0]-373897302|0,n=(n<<20|n>>>12)+o|0,i+=(n&s|o&~s)+l[5]-701558691|0,i=(i<<5|i>>>27)+n|0,s+=(i&o|n&~o)+l[10]+38016083|0,s=(s<<9|s>>>23)+i|0,o+=(s&n|i&~n)+l[15]-660478335|0,o=(o<<14|o>>>18)+s|0,n+=(o&i|s&~i)+l[4]-405537848|0,n=(n<<20|n>>>12)+o|0,i+=(n&s|o&~s)+l[9]+568446438|0,i=(i<<5|i>>>27)+n|0,s+=(i&o|n&~o)+l[14]-1019803690|0,s=(s<<9|s>>>23)+i|0,o+=(s&n|i&~n)+l[3]-187363961|0,o=(o<<14|o>>>18)+s|0,n+=(o&i|s&~i)+l[8]+1163531501|0,n=(n<<20|n>>>12)+o|0,i+=(n&s|o&~s)+l[13]-1444681467|0,i=(i<<5|i>>>27)+n|0,s+=(i&o|n&~o)+l[2]-51403784|0,s=(s<<9|s>>>23)+i|0,o+=(s&n|i&~n)+l[7]+1735328473|0,o=(o<<14|o>>>18)+s|0,n+=(o&i|s&~i)+l[12]-1926607734|0,n=(n<<20|n>>>12)+o|0,i+=(n^o^s)+l[5]-378558|0,i=(i<<4|i>>>28)+n|0,s+=(i^n^o)+l[8]-2022574463|0,s=(s<<11|s>>>21)+i|0,o+=(s^i^n)+l[11]+1839030562|0,o=(o<<16|o>>>16)+s|0,n+=(o^s^i)+l[14]-35309556|0,n=(n<<23|n>>>9)+o|0,i+=(n^o^s)+l[1]-1530992060|0,i=(i<<4|i>>>28)+n|0,s+=(i^n^o)+l[4]+1272893353|0,s=(s<<11|s>>>21)+i|0,o+=(s^i^n)+l[7]-155497632|0,o=(o<<16|o>>>16)+s|0,n+=(o^s^i)+l[10]-1094730640|0,n=(n<<23|n>>>9)+o|0,i+=(n^o^s)+l[13]+681279174|0,i=(i<<4|i>>>28)+n|0,s+=(i^n^o)+l[0]-358537222|0,s=(s<<11|s>>>21)+i|0,o+=(s^i^n)+l[3]-722521979|0,o=(o<<16|o>>>16)+s|0,n+=(o^s^i)+l[6]+76029189|0,n=(n<<23|n>>>9)+o|0,i+=(n^o^s)+l[9]-640364487|0,i=(i<<4|i>>>28)+n|0,s+=(i^n^o)+l[12]-421815835|0,s=(s<<11|s>>>21)+i|0,o+=(s^i^n)+l[15]+530742520|0,o=(o<<16|o>>>16)+s|0,n+=(o^s^i)+l[2]-995338651|0,n=(n<<23|n>>>9)+o|0,i+=(o^(n|~s))+l[0]-198630844|0,i=(i<<6|i>>>26)+n|0,s+=(n^(i|~o))+l[7]+1126891415|0,s=(s<<10|s>>>22)+i|0,o+=(i^(s|~n))+l[14]-1416354905|0,o=(o<<15|o>>>17)+s|0,n+=(s^(o|~i))+l[5]-57434055|0,n=(n<<21|n>>>11)+o|0,i+=(o^(n|~s))+l[12]+1700485571|0,i=(i<<6|i>>>26)+n|0,s+=(n^(i|~o))+l[3]-1894986606|0,s=(s<<10|s>>>22)+i|0,o+=(i^(s|~n))+l[10]-1051523|0,o=(o<<15|o>>>17)+s|0,n+=(s^(o|~i))+l[1]-2054922799|0,n=(n<<21|n>>>11)+o|0,i+=(o^(n|~s))+l[8]+1873313359|0,i=(i<<6|i>>>26)+n|0,s+=(n^(i|~o))+l[15]-30611744|0,s=(s<<10|s>>>22)+i|0,o+=(i^(s|~n))+l[6]-1560198380|0,o=(o<<15|o>>>17)+s|0,n+=(s^(o|~i))+l[13]+1309151649|0,n=(n<<21|n>>>11)+o|0,i+=(o^(n|~s))+l[4]-145523070|0,i=(i<<6|i>>>26)+n|0,s+=(n^(i|~o))+l[11]-1120210379|0,s=(s<<10|s>>>22)+i|0,o+=(i^(s|~n))+l[2]+718787259|0,o=(o<<15|o>>>17)+s|0,n+=(s^(o|~i))+l[9]-343485551|0,n=(n<<21|n>>>11)+o|0,u[0]=i+u[0]|0,u[1]=n+u[1]|0,u[2]=o+u[2]|0,u[3]=s+u[3]|0}function c(u){var l=[],i;for(i=0;i<64;i+=4)l[i>>2]=u.charCodeAt(i)+(u.charCodeAt(i+1)<<8)+(u.charCodeAt(i+2)<<16)+(u.charCodeAt(i+3)<<24);return l}function h(u){var l=[],i;for(i=0;i<64;i+=4)l[i>>2]=u[i]+(u[i+1]<<8)+(u[i+2]<<16)+(u[i+3]<<24);return l}function y(u){var l=u.length,i=[1732584193,-271733879,-1732584194,271733878],n,o,s,w,_,O;for(n=64;n<=l;n+=64)p(i,c(u.substring(n-64,n)));for(u=u.substring(n-64),o=u.length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0;n<o;n+=1)s[n>>2]|=u.charCodeAt(n)<<(n%4<<3);if(s[n>>2]|=128<<(n%4<<3),n>55)for(p(i,s),n=0;n<16;n+=1)s[n]=0;return w=l*8,w=w.toString(16).match(/(.*?)(.{0,8})$/),_=parseInt(w[2],16),O=parseInt(w[1],16)||0,s[14]=_,s[15]=O,p(i,s),i}function d(u){var l=u.length,i=[1732584193,-271733879,-1732584194,271733878],n,o,s,w,_,O;for(n=64;n<=l;n+=64)p(i,h(u.subarray(n-64,n)));for(u=n-64<l?u.subarray(n-64):new Uint8Array(0),o=u.length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0;n<o;n+=1)s[n>>2]|=u[n]<<(n%4<<3);if(s[n>>2]|=128<<(n%4<<3),n>55)for(p(i,s),n=0;n<16;n+=1)s[n]=0;return w=l*8,w=w.toString(16).match(/(.*?)(.{0,8})$/),_=parseInt(w[2],16),O=parseInt(w[1],16)||0,s[14]=_,s[15]=O,p(i,s),i}function g(u){var l="",i;for(i=0;i<4;i+=1)l+=e[u>>i*8+4&15]+e[u>>i*8&15];return l}function m(u){var l;for(l=0;l<u.length;l+=1)u[l]=g(u[l]);return u.join("")}m(y("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(r=function(u,l){var i=(u&65535)+(l&65535),n=(u>>16)+(l>>16)+(i>>16);return n<<16|i&65535}),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function u(l,i){return l=l|0||0,l<0?Math.max(l+i,0):Math.min(l,i)}ArrayBuffer.prototype.slice=function(l,i){var n=this.byteLength,o=u(l,n),s=n,w,_,O,he;return i!==t&&(s=u(i,n)),o>s?new ArrayBuffer(0):(w=s-o,_=new ArrayBuffer(w),O=new Uint8Array(_),he=new Uint8Array(this,o,w),O.set(he),_)}})();function T(u){return/[\u0080-\uFFFF]/.test(u)&&(u=unescape(encodeURIComponent(u))),u}function S(u,l){var i=u.length,n=new ArrayBuffer(i),o=new Uint8Array(n),s;for(s=0;s<i;s+=1)o[s]=u.charCodeAt(s);return l?o:n}function b(u){return String.fromCharCode.apply(null,new Uint8Array(u))}function P(u,l,i){var n=new Uint8Array(u.byteLength+l.byteLength);return n.set(new Uint8Array(u)),n.set(new Uint8Array(l),u.byteLength),i?n:n.buffer}function v(u){var l=[],i=u.length,n;for(n=0;n<i-1;n+=2)l.push(parseInt(u.substr(n,2),16));return String.fromCharCode.apply(String,l)}function A(){this.reset()}return A.prototype.append=function(u){return this.appendBinary(T(u)),this},A.prototype.appendBinary=function(u){this._buff+=u,this._length+=u.length;var l=this._buff.length,i;for(i=64;i<=l;i+=64)p(this._hash,c(this._buff.substring(i-64,i)));return this._buff=this._buff.substring(i-64),this},A.prototype.end=function(u){var l=this._buff,i=l.length,n,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],s;for(n=0;n<i;n+=1)o[n>>2]|=l.charCodeAt(n)<<(n%4<<3);return this._finish(o,i),s=m(this._hash),u&&(s=v(s)),this.reset(),s},A.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},A.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},A.prototype.setState=function(u){return this._buff=u.buff,this._length=u.length,this._hash=u.hash,this},A.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},A.prototype._finish=function(u,l){var i=l,n,o,s;if(u[i>>2]|=128<<(i%4<<3),i>55)for(p(this._hash,u),i=0;i<16;i+=1)u[i]=0;n=this._length*8,n=n.toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(n[2],16),s=parseInt(n[1],16)||0,u[14]=o,u[15]=s,p(this._hash,u)},A.hash=function(u,l){return A.hashBinary(T(u),l)},A.hashBinary=function(u,l){var i=y(u),n=m(i);return l?v(n):n},A.ArrayBuffer=function(){this.reset()},A.ArrayBuffer.prototype.append=function(u){var l=P(this._buff.buffer,u,!0),i=l.length,n;for(this._length+=u.byteLength,n=64;n<=i;n+=64)p(this._hash,h(l.subarray(n-64,n)));return this._buff=n-64<i?new Uint8Array(l.buffer.slice(n-64)):new Uint8Array(0),this},A.ArrayBuffer.prototype.end=function(u){var l=this._buff,i=l.length,n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o,s;for(o=0;o<i;o+=1)n[o>>2]|=l[o]<<(o%4<<3);return this._finish(n,i),s=m(this._hash),u&&(s=v(s)),this.reset(),s},A.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},A.ArrayBuffer.prototype.getState=function(){var u=A.prototype.getState.call(this);return u.buff=b(u.buff),u},A.ArrayBuffer.prototype.setState=function(u){return u.buff=S(u.buff,!0),A.prototype.setState.call(this,u)},A.ArrayBuffer.prototype.destroy=A.prototype.destroy,A.ArrayBuffer.prototype._finish=A.prototype._finish,A.ArrayBuffer.hash=function(u,l){var i=d(new Uint8Array(u)),n=m(i);return l?v(n):n},A})});var X=ye((an,Fe)=>{"use strict";Fe.exports={}});async function Tt(t){let r=(await Promise.resolve().then(()=>H(Oe(),1))).default,e=new r.ArrayBuffer,a=2097152;for(let p=0;p<t.size;p+=a){let c=Math.min(p+a,t.size);e.append(await t.slice(p,c).arrayBuffer())}return{md5:e.end()}}async function St(t){let{createHash:r}=await Promise.resolve().then(()=>H(X(),1)),e=r("md5");return e.update(t),{md5:e.digest("hex")}}async function Rt(t){let{createHash:r}=await Promise.resolve().then(()=>H(X(),1)),{createReadStream:e}=await Promise.resolve().then(()=>H(X(),1));return new Promise((a,p)=>{let c=r("md5"),h=e(t);h.on("error",y=>p(f.file(`Failed to read file for MD5: ${y.message}`,{filePath:t}))),h.on("data",y=>c.update(y)),h.on("end",()=>a({md5:c.digest("hex")}))})}async function M(t){if(t instanceof Blob)return Tt(t);if(typeof Buffer<"u"&&Buffer.isBuffer(t))return St(t);if(typeof t=="string")return Rt(t);throw f.business("Invalid input for MD5 calculation")}var W=L(()=>{"use strict";I()});function Q(t){return t.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var Ge=L(()=>{"use strict"});function ke(t,r={}){if(r.flatten===!1)return t.map(a=>({path:Q(a),name:ie(a)}));let e=bt(t);return t.map(a=>{let p=Q(a);if(e){let c=e.endsWith("/")?e:`${e}/`;p.startsWith(c)&&(p=p.substring(c.length))}return p||(p=ie(a)),{path:p,name:ie(a)}})}function bt(t){if(!t.length)return"";let e=t.map(c=>Q(c)).map(c=>c.split("/")),a=[],p=Math.min(...e.map(c=>c.length));for(let c=0;c<p-1;c++){let h=e[0][c];if(e.every(y=>y[c]===h))a.push(h);else break}return a.join("/")}function ie(t){return t.split(/[/\\]/).pop()||t}var se=L(()=>{"use strict";Ge()});function Pn(t){oe=t}function wt(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function ze(){return oe||wt()}var oe,ae=L(()=>{"use strict";oe=null});function le(t,r=1){if(t===0)return"0 Bytes";let e=1024,a=["Bytes","KB","MB","GB"],p=Math.floor(Math.log(t)/Math.log(e));return`${parseFloat((t/e**p).toFixed(r))} ${a[p]}`}function pe(t){if(De(t))return{valid:!1,reason:"File name contains unsafe characters"};if(t.startsWith(" ")||t.endsWith(" "))return{valid:!1,reason:"File name cannot start/end with spaces"};if(t.endsWith("."))return{valid:!1,reason:"File name cannot end with dots"};let r=/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|$)/i,e=t.split("/").pop()||t;return r.test(e)?{valid:!1,reason:"File name uses a reserved system name"}:t.includes("..")?{valid:!1,reason:"File name contains path traversal pattern"}:{valid:!0}}function _n(t,r){let e=[],a=[],p=[];if(t.length===0){let d={file:"(no files)",message:"At least one file must be provided"};return e.push(d),{files:[],validFiles:[],errors:e,warnings:[],canDeploy:!1}}for(let d of t)if(K(d.name))return e.push({file:d.name,message:"Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder"}),{files:t.map(g=>({...g,status:R.VALIDATION_FAILED,statusMessage:"Unbuilt project detected"})),validFiles:[],errors:e,warnings:[],canDeploy:!1};if(t.length>r.maxFilesCount){let d={file:`(${t.length} files)`,message:`File count (${t.length}) exceeds limit of ${r.maxFilesCount}`};return e.push(d),{files:t.map(g=>({...g,status:R.VALIDATION_FAILED,statusMessage:d.message})),validFiles:[],errors:e,warnings:[],canDeploy:!1}}let c=0;for(let d of t){let g=R.READY,m="Ready for upload",T=d.name?pe(d.name):{valid:!1,reason:"File name cannot be empty"};if(d.status===R.PROCESSING_ERROR)g=R.VALIDATION_FAILED,m=d.statusMessage||"File failed during processing",e.push({file:d.name,message:m});else if(d.size===0){g=R.EXCLUDED,m="File is empty (0 bytes) and cannot be deployed due to storage limitations",a.push({file:d.name,message:m}),p.push({...d,status:g,statusMessage:m});continue}else d.size<0?(g=R.VALIDATION_FAILED,m="File size must be positive",e.push({file:d.name,message:m})):!d.name||d.name.trim().length===0?(g=R.VALIDATION_FAILED,m="File name cannot be empty",e.push({file:d.name||"(empty)",message:m})):d.name.includes("\0")?(g=R.VALIDATION_FAILED,m="File name contains invalid characters (null byte)",e.push({file:d.name,message:m})):T.valid?V(d.name,r.blockedExtensions??[])?(g=R.VALIDATION_FAILED,m=`File extension not allowed: "${d.name}"`,e.push({file:d.name,message:m})):d.size>r.maxFileSize?(g=R.VALIDATION_FAILED,m=`File size (${le(d.size)}) exceeds limit of ${le(r.maxFileSize)}`,e.push({file:d.name,message:m})):(c+=d.size,c>r.maxTotalSize&&(g=R.VALIDATION_FAILED,m=`Total size would exceed limit of ${le(r.maxTotalSize)}`,e.push({file:d.name,message:m}))):(g=R.VALIDATION_FAILED,m=T.reason||"Invalid file name",e.push({file:d.name,message:m}));p.push({...d,status:g,statusMessage:m})}e.length>0&&(p=p.map(d=>d.status===R.EXCLUDED?d:{...d,status:R.VALIDATION_FAILED,statusMessage:d.status===R.VALIDATION_FAILED?d.statusMessage:"Deployment failed due to validation errors in bundle"}));let h=e.length===0?p.filter(d=>d.status===R.READY):[],y=e.length===0;return{files:p,validFiles:h,errors:e,warnings:a,canDeploy:y}}function Pt(t){return t.filter(r=>r.status===R.READY)}function Nn(t){return Pt(t).length>0}var ue=L(()=>{"use strict";I()});function Ve(t){return xt.test(t)}var Lt,xt,Ke=L(()=>{"use strict";Lt=["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^[Dd]esktop\\.ini$","@eaDir$"],xt=new RegExp(Lt.join("|"))});function je(t,r){if(!t||t.length===0)return[];if(!r?.allowUnbuilt&&t.find(a=>a&&K(a)))throw f.business("Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder");return t.filter(e=>{if(!e)return!1;let a=e.replace(/\\/g,"/").split("/").filter(Boolean);if(a.length===0)return!0;let p=a[a.length-1];if(Ve(p))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(_t.some(y=>h.toLowerCase()===y.toLowerCase()))return!1;return!0})}var _t,ce=L(()=>{"use strict";I();Ke();_t=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function Ye(t,r){if(t.includes("\0")||t.includes("/../")||t.startsWith("../")||t.endsWith("/.."))throw f.business(`Security error: Unsafe file path "${t}" for file: ${r}`)}function qe(t,r,e){let a=pe(t);if(!a.valid)throw f.business(a.reason||"Invalid file name");if(V(t,e))throw f.business(`File extension not allowed: "${r}"`)}var de=L(()=>{"use strict";I();ue()});var We={};rt(We,{processFilesForBrowser:()=>Xe});async function Xe(t,r={},e){if(ze()!=="browser")throw f.business("processFilesForBrowser can only be called in a browser environment.");let a=t.map(S=>S.webkitRelativePath||S.name),p=r.build||r.prerender,c=ke(a,{flatten:r.pathDetect!==!1}),h=c.map(S=>S.path),y=new Set(je(h,{allowUnbuilt:p})),d=[];for(let S=0;S<t.length;S++)y.has(h[S])&&d.push({file:t[S],deployPath:c[S].path});if(d.length===0)return[];if(p){let S=[];for(let b=0;b<d.length;b++){let{file:P,deployPath:v}=d[b];if(P.size===0)continue;let{md5:A}=await M(P);S.push({path:v,content:P,size:P.size,md5:A})}return S}if(!e)throw f.config("Platform limits not provided. processFilesForBrowser requires the limits argument for deploy-mode validation \u2014 pass `ship.getLimits()` result.");let g=[],m=0,T=e.blockedExtensions??[];for(let S=0;S<d.length;S++){let{file:b,deployPath:P}=d[S];if(Ye(P,b.name),b.size===0)continue;if(qe(P,b.name,T),b.size>e.maxFileSize)throw f.business(`File ${b.name} is too large. Maximum allowed size is ${e.maxFileSize/(1024*1024)}MB.`);if(m+=b.size,m>e.maxTotalSize)throw f.business(`Total deploy size is too large. Maximum allowed is ${e.maxTotalSize/(1024*1024)}MB.`);let{md5:v}=await M(b);g.push({path:P,content:b,size:b.size,md5:v})}if(g.length>e.maxFilesCount)throw f.business(`Too many files to deploy. Maximum allowed is ${e.maxFilesCount} files.`);return g}var fe=L(()=>{"use strict";I();se();ae();ce();W();de()});I();I();I();var Y=class{constructor(){this.handlers=new Map}on(r,e){this.handlers.has(r)||this.handlers.set(r,new Set),this.handlers.get(r)?.add(e)}off(r,e){let a=this.handlers.get(r);a&&(a.delete(e),a.size===0&&this.handlers.delete(r))}emit(r,...e){let a=this.handlers.get(r);if(!a)return;let p=Array.from(a);for(let c of p)try{c(...e)}catch(h){a.delete(c),r!=="error"&&setTimeout(()=>{let y=h instanceof Error?h:new Error(String(h));this.emit("error",y,String(r))},0)}}};I();I();function U(t){if(t==null)return;if(t.length===0)return t;if(t.length>F.MAX_COUNT)throw f.validation(`Maximum ${F.MAX_COUNT} labels allowed`);let r=t.map((a,p)=>{if(typeof a!="string")throw f.validation(`Label at index ${p} must be a string`);let c=a.trim().toLowerCase();if(c.length<F.MIN_LENGTH)throw f.validation(`Labels must be at least ${F.MIN_LENGTH} characters long`);if(c.length>F.MAX_LENGTH)throw f.validation(`Labels must be no more than ${F.MAX_LENGTH} characters long`);if(!Le.test(c))throw f.validation(`Labels must start and end with alphanumeric characters, with optional separators (${F.SEPARATORS}) between segments`);return c}),e=[...new Set(r)];if(e.length!==r.length)throw f.validation("Duplicate labels are not allowed");return e}async function xe(t){let r=t.find(p=>p.path===N||p.path===`/${N}`);if(!r)return;let e=r.content,a=typeof e.text=="function"?await e.text():r.content.toString("utf8");Ie(a)}var gt=3e4,_e=3e5,Et=3e5,At=_e+Et,Dt="sdk";function re(t){let r=new URLSearchParams;t?.limit!==void 0&&r.set("limit",String(t.limit)),t?.cursor!==void 0&&r.set("cursor",t.cursor);let e=r.toString();return e?`?${e}`:""}var q=class extends Y{constructor(e){super();this.globalHeaders={};this.apiUrl=e.apiUrl||te,this.getAuthHeadersCallback=e.getAuthHeaders,this.session=e.session??!1,this.caller=e.caller,this.timeout=e.timeout??gt,this.deployTimeout=e.timeout??_e,this.deployBuildTimeout=e.timeout??At,this.fetch=e.fetch??globalThis.fetch.bind(globalThis),this.createDeployBody=e.createDeployBody,this.deployEndpoint=e.deployEndpoint||D.DEPLOYMENTS}setGlobalHeaders(e){this.globalHeaders=e}async executeRequest(e,a,p,c=this.timeout){let h=()=>{};try{let y=await this.mergeHeaders(a.headers),d=this.createTimeoutSignal(a.signal,c);h=d.cleanup;let g={...a,headers:y,credentials:this.session&&!y.Authorization?"include":void 0,signal:d.signal};this.emit("request",e,g);let m=await this.fetch(e,g);if(h(),!m.ok)throw await f.fromHttpResponse(m,p);return this.emit("response",this.safeClone(m),e),{data:await this.parseResponse(this.safeClone(m)),status:m.status}}catch(y){h();let d=f.fromFetchError(y,p);throw this.emit("error",d,e),d}}async request(e,a,p,c){let{data:h}=await this.executeRequest(e,a,p,c);return h}async requestWithStatus(e,a,p){return this.executeRequest(e,a,p)}async mergeHeaders(e={}){return{...this.globalHeaders,...this.caller?{[$.HEADER]:this.caller}:{},...await this.getAuthHeadersCallback(),...e}}createTimeoutSignal(e,a=this.timeout){let p=new AbortController,c=setTimeout(()=>p.abort(),a);if(e){let h=()=>p.abort();e.addEventListener("abort",h),e.aborted&&p.abort()}return{signal:p.signal,cleanup:()=>clearTimeout(c)}}safeClone(e){try{return e.clone()}catch{return e}}async parseResponse(e){if(!(e.headers.get("Content-Length")==="0"||e.status===204))return e.json()}async deploy(e,a={}){if(!e.length)throw f.business("No files to deploy");for(let g of e)if(!g.md5)throw f.file(`MD5 checksum missing for file: ${g.path}`,{filePath:g.path});ne(a.password);let p=Ee(a.idempotencyKey),c=U(a.labels);await xe(e);let h=a.build||a.prerender||a.spa?{build:a.build,prerender:a.prerender,spa:a.spa}:void 0,{body:y,headers:d}=await this.createDeployBody(e,{labels:c,via:a.via??Dt,password:a.password,flags:h,captcha:a.captcha});return this.request(`${this.apiUrl}${this.deployEndpoint}`,{method:"POST",body:y,headers:p?{...d,[z.HEADER]:p}:d,signal:a.signal||null},"Deploy",a.build||a.prerender?this.deployBuildTimeout:this.deployTimeout)}async listDeployments(e){return this.request(`${this.apiUrl}${D.DEPLOYMENTS}${re(e)}`,{method:"GET"},"List deployments")}async getDeployment(e){return this.request(`${this.apiUrl}${D.DEPLOYMENT(encodeURIComponent(e))}`,{method:"GET"},"Get deployment")}async updateDeploymentLabels(e,a){let p=U(a);return this.request(`${this.apiUrl}${D.DEPLOYMENT(encodeURIComponent(e))}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({labels:p})},"Update deployment labels")}async deleteDeployment(e){return this.request(`${this.apiUrl}${D.DEPLOYMENT(encodeURIComponent(e))}`,{method:"DELETE"},"Delete deployment")}async setDomain(e,a,p){let c=U(p),h={};a&&(h.deployment=a),c!==void 0&&(h.labels=c);let{data:y,status:d}=await this.requestWithStatus(`${this.apiUrl}${D.DOMAIN(encodeURIComponent(e))}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)},"Set domain");return{...y,isCreate:d===201}}async listDomains(e){return this.request(`${this.apiUrl}${D.DOMAINS}${re(e)}`,{method:"GET"},"List domains")}async getDomain(e){return this.request(`${this.apiUrl}${D.DOMAIN(encodeURIComponent(e))}`,{method:"GET"},"Get domain")}async deleteDomain(e){return this.request(`${this.apiUrl}${D.DOMAIN(encodeURIComponent(e))}`,{method:"DELETE"},"Delete domain")}async verifyDomain(e){return this.request(`${this.apiUrl}${D.DOMAIN_VERIFY(encodeURIComponent(e))}`,{method:"POST"},"Verify domain")}async getDomainDns(e){return this.request(`${this.apiUrl}${D.DOMAIN_DNS(encodeURIComponent(e))}`,{method:"GET"},"Get domain DNS")}async getDomainRecords(e){return this.request(`${this.apiUrl}${D.DOMAIN_RECORDS(encodeURIComponent(e))}`,{method:"GET"},"Get domain records")}async getDomainShare(e){return this.request(`${this.apiUrl}${D.DOMAIN_SHARE(encodeURIComponent(e))}`,{method:"GET"},"Get domain share")}async validateDomain(e){return this.request(`${this.apiUrl}${D.DOMAINS_VALIDATE}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:e})},"Validate domain")}async createToken(e,a){let p=U(a),c={};return e!==void 0&&(c.ttl=e),p!==void 0&&(c.labels=p),this.request(`${this.apiUrl}${D.TOKENS}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)},"Create token")}async listTokens(e){return this.request(`${this.apiUrl}${D.TOKENS}${re(e)}`,{method:"GET"},"List tokens")}async deleteToken(e){return this.request(`${this.apiUrl}${D.TOKEN(encodeURIComponent(e))}`,{method:"DELETE"},"Delete token")}async getToken(e){return this.request(`${this.apiUrl}${D.TOKEN(encodeURIComponent(e))}`,{method:"GET"},"Get token")}async getAccount(){return this.request(`${this.apiUrl}${D.ACCOUNT}`,{method:"GET"},"Get account")}async getLimits(){return this.request(`${this.apiUrl}${D.LIMITS}`,{method:"GET"},"Get limits")}async ping(){return this.request(`${this.apiUrl}${D.PING}`,{method:"GET"},"Ping")}async checkSPA(e,a={}){let p=e.find(d=>d.path===j.INDEX_FILE||d.path===`/${j.INDEX_FILE}`);if(!p||p.size>j.MAX_INDEX_BYTES)return!1;let c;if(typeof Buffer<"u"&&Buffer.isBuffer(p.content))c=p.content.toString("utf-8");else if(typeof Blob<"u"&&p.content instanceof Blob)c=await p.content.text();else if(typeof File<"u"&&p.content instanceof File)c=await p.content.text();else return!1;let h={files:e.map(d=>d.path),index:c};return(await this.request(`${this.apiUrl}${D.SPA_CHECK}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)},"SPA check")).isSPA}};I();I();W();async function It(){let t=JSON.stringify(Re,null,2),r;typeof Buffer<"u"?r=Buffer.from(t,"utf-8"):r=new Blob([t],{type:"application/json"});let{md5:e}=await M(r);return{path:N,content:r,size:t.length,md5:e}}async function Ce(t,r,e){if(e.spaDetect===!1||e.spa||e.build||e.prerender||t.some(a=>a.path===N))return t;try{if(await r.checkSPA(t,e)){let p=await It();return[...t,p]}}catch{}return t}function $e(t){let{getApi:r,ensureInit:e,processInput:a}=t;return{upload:async(p,c={})=>{if(await e(),!a)throw f.config("processInput function is not provided.");let h=r(),y=await a(p,c);return y=await Ce(y,h,c),h.deploy(y,c)},list:async p=>(await e(),r().listDeployments(p)),get:async p=>(await e(),r().getDeployment(p)),set:async(p,c)=>(await e(),r().updateDeploymentLabels(p,c.labels)),delete:async p=>(await e(),r().deleteDeployment(p))}}function Ue(t){let{getApi:r,ensureInit:e}=t;return{set:async(a,p={})=>(await e(),r().setDomain(a,p.deployment,p.labels)),list:async a=>(await e(),r().listDomains(a)),get:async a=>(await e(),r().getDomain(a)),delete:async a=>(await e(),r().deleteDomain(a)),verify:async a=>(await e(),r().verifyDomain(a)),validate:async a=>(await e(),r().validateDomain(a)),dns:async a=>(await e(),r().getDomainDns(a)),records:async a=>(await e(),r().getDomainRecords(a)),share:async a=>(await e(),r().getDomainShare(a))}}function Me(t){let{getApi:r,ensureInit:e}=t;return{get:async()=>(await e(),r().getAccount())}}function Be(t){let{getApi:r,ensureInit:e}=t;return{create:async(a={})=>(await e(),r().createToken(a.ttl,a.labels)),list:async a=>(await e(),r().listTokens(a)),get:async a=>(await e(),r().getToken(a)),delete:async a=>(await e(),r().deleteToken(a))}}var J=class{constructor(r={}){this.initPromise=null;this.platformLimits=null;this.credential=null;if(r={...r,apiUrl:r.apiUrl||void 0,token:r.token||void 0,caller:r.caller||void 0},this.clientOptions=r,r.caller!==void 0&&we(r.caller),r.token&&r.session)throw f.config("Provide either `token` or `session`, not both.");typeof r.token=="string"?(ee(r.token),this.credential=r.token):r.token&&(this.credential=r.token),this.http=new q({...r,getAuthHeaders:()=>this.getAuthHeaders(),createDeployBody:this.getDeployBodyCreator()});let e={getApi:()=>this.http,ensureInit:()=>this.ensureInitialized()};this.deployments=$e({...e,processInput:(a,p)=>this.processInput(a,p)}),this.domains=Ue(e),this.account=Me(e),this.tokens=Be(e)}async ensureInitialized(){return this.initPromise||(this.initPromise=this.fetchPlatformLimits()),this.initPromise}async fetchPlatformLimits(){try{this.platformLimits=await this.http.getLimits()}catch(r){throw this.initPromise=null,r}}async ping(){return await this.ensureInitialized(),this.http.ping()}async deploy(r,e){return this.deployments.upload(r,e)}async whoami(){return this.account.get()}async getLimits(){return this.platformLimits?this.platformLimits:(await this.ensureInitialized(),this.platformLimits)}on(r,e){this.http.on(r,e)}off(r,e){this.http.off(r,e)}setHeaders(r){this.http.setGlobalHeaders(r)}clearHeaders(){this.http.setGlobalHeaders({})}setToken(r){if(this.clientOptions.session)throw f.config("Provide either `token` or `session`, not both.");if(typeof r=="string"){if(!r)throw f.business("Invalid token provided. Token must be a non-empty string.");ee(r),this.credential=r;return}if(typeof r!="function")throw f.business("Invalid token provided. Token must be a non-empty string or a provider function.");this.credential=r}async getAuthHeaders(){if(this.credential===null)return{};let r=typeof this.credential=="function"?await this.credential():this.credential;if(!r)throw f.authentication("Token provider returned no token.");if(typeof r!="string")throw f.authentication("Token provider returned a non-string value.");return{Authorization:`Bearer ${r}`}}};I();async function He(t,r={}){let{labels:e,via:a,password:p,flags:c,captcha:h}=r,y=new FormData,d=[];for(let g of t){if(!(g.content instanceof File||g.content instanceof Blob))throw f.file(`Unsupported file.content type for browser: ${g.path}`,{filePath:g.path});if(!g.md5)throw f.file(`File missing md5 checksum: ${g.path}`,{filePath:g.path});let m=new File([g.content],g.path,{type:"application/octet-stream"});y.append(x.FILES,m),d.push(g.md5)}return y.append(x.CHECKSUMS,JSON.stringify(d)),e&&e.length>0&&y.append(x.LABELS,JSON.stringify(e)),a&&y.append(x.VIA,a),p&&y.append(x.PASSWORD,p),c?.build&&y.append(x.BUILD,"true"),c?.prerender&&y.append(x.PRERENDER,"true"),c?.spa&&y.append(x.SPA,"true"),h&&y.append(x.CAPTCHA,h),{body:y,headers:{}}}I();I();se();ae();ue();ce();W();de();function Hn(t,r,e,a=!0){let p=t===1?r:e;return a?`${t} ${p}`:p}fe();var me=class extends J{async deploy(r,e){return super.deploy(r,e)}async processInput(r,e){if(!Array.isArray(r)||!r.every(p=>p instanceof File))throw f.business("Invalid input type for browser environment. Expected File[].");if(r.length===0)throw f.business("No files to deploy.");let{processFilesForBrowser:a}=await Promise.resolve().then(()=>(fe(),We));return a(r,e,this.platformLimits??void 0)}getDeployBodyCreator(){return He}},ur=me;export{Te as API_KEY,D as API_PATHS,Ut as AUTH_BASE_PATH,Ct as AccountPlan,q as ApiHttp,ge as AuthMethod,$ as CALLER,te as DEFAULT_API,N as DEPLOYMENT_CONFIG_FILENAME,x as DEPLOY_FIELDS,Se as DEPLOY_TOKEN,vt as DeploymentStatus,st as DeploymentVia,Ot as DomainStatus,E as ErrorType,R as FILE_VALIDATION_STATUS,R as FileValidationStatus,z as IDEMPOTENCY_KEY_CONSTRAINTS,_t as JUNK_DIRECTORIES,F as LABEL_CONSTRAINTS,Le as LABEL_PATTERN,kt as MY_API_KEY_URL,Mt as OAuthScope,k as PASSWORD_CONSTRAINTS,zt as PUBLIC_DEPLOYMENT_TTL_SECONDS,Gt as SHIP_ENV,j as SPA_CHECK_CONSTRAINTS,Re as SPA_DEFAULT_CONFIG,me as Ship,f as ShipError,C as TokenKind,ft as UNBUILT_PROJECT_MARKERS,dt as UNSAFE_FILENAME_CHARS,$t as WEB_FILE_ACCEPT,Pn as __setTestEnvironment,Nn as allValidFilesReady,Ie as assertShipJsonSyntax,M as calculateMD5,mt as classifyToken,Me as createAccountResource,$e as createDeploymentResource,Ue as createDomainResource,Be as createTokenResource,ur as default,Xt as deserializeLabels,Kt as extractSubdomain,je as filterJunk,le as formatFileSize,jt as generateDeploymentUrl,Yt as generateDomainUrl,ze as getENV,Pt as getValidFiles,K as hasUnbuiltMarker,De as hasUnsafeChars,V as isBlockedExtension,Vt as isCustomDomain,Ht as isDeployment,Pe as isPlatformDomain,Ae as isShipError,Ft as normalizeVia,ke as optimizeDeployPaths,Hn as pluralize,Xe as processFilesForBrowser,qt as serializeLabels,ht as validateApiKey,Bt as validateApiUrl,we as validateCaller,qe as validateDeployFile,Ye as validateDeployPath,yt as validateDeployToken,pe as validateFileName,_n as validateFiles,Ee as validateIdempotencyKey,ne as validatePassword,ee as validateToken};
2
2
  //# sourceMappingURL=browser.js.map