@shipstatic/ship 3.4.0-beta.8 → 3.4.0-beta.9

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
@@ -335,7 +335,7 @@ Exit code is non-zero on failure, and with `--json` the error goes to **stderr**
335
335
  ```json
336
336
  {
337
337
  "error": "validation_failed",
338
- "message": "File \"index.html\" is too large. Maximum 20 MB allowed.",
338
+ "message": "File \"setup.exe\" has an extension that is not allowed.",
339
339
  "status": 400
340
340
  }
341
341
  ```
@@ -5,7 +5,7 @@ Their copyright notices travel with that copy, and are reproduced here in
5
5
  full. This file is GENERATED from the build's own metafile — edit the
6
6
  bundle, not this list.
7
7
 
8
- ## @shipstatic/types 3.8.0-beta.8
8
+ ## @shipstatic/types 3.8.0-beta.9
9
9
 
10
10
  License: MIT
11
11
 
package/dist/browser.d.ts CHANGED
@@ -724,7 +724,7 @@ type AccountPlanType = (typeof AccountPlan)[keyof typeof AccountPlan];
724
724
  * than the 403 uses.
725
725
  *
726
726
  * All three are counts plans SELL, and every plan publishes a number for each.
727
- * A platform subdomain (`my-app.shipstatic.com`) is among them: the namespace
727
+ * A platform domain (`my-app.shipstatic.com`) is among them: the namespace
728
728
  * is the platform's, so every plan bounds how many names one account may take
729
729
  * from it — which is not the address every deployment gets by construction
730
730
  * (`happy-cat-abc1234.shipstatic.com`), one per deployment and bounded by
@@ -1478,7 +1478,27 @@ interface PlatformLimits {
1478
1478
  * retire with it (tracked in root `backlog.md`).
1479
1479
  */
1480
1480
  readonly blockedExtensions?: readonly string[];
1481
+ /**
1482
+ * The way forward past each limit, in the API's own words, for the account
1483
+ * that asked: `"Upgrade to Pro for more."` where a sold plan allows more,
1484
+ * `"Please contact support if you need more."` where none does. The API
1485
+ * writes it with the same function its own refusals use, so a client that
1486
+ * refuses a file before uploading it appends this sentence to its refusal
1487
+ * verbatim and says exactly what the server would have said. Which plans
1488
+ * exist, which are sold and what an account's grant raises are the server's
1489
+ * to know; a client never learns a plan name from this field, only a
1490
+ * sentence. An anonymous caller is answered the free plan's sentence, as it
1491
+ * is the free plan's numbers.
1492
+ *
1493
+ * **Optional, and the absence is load-bearing**, as `blockedExtensions`
1494
+ * above: an API deployed before this field existed sends nothing, and a
1495
+ * client then appends nothing. It hardens to required at the entity's next
1496
+ * natural break, with the blocklist.
1497
+ */
1498
+ readonly suggestions?: Readonly<Record<PlatformLimitKey, string>>;
1481
1499
  }
1500
+ /** The three request limits, named as `PlatformLimits` names them. */
1501
+ type PlatformLimitKey = 'maxFileSize' | 'maxFilesCount' | 'maxTotalSize';
1482
1502
  /**
1483
1503
  * Whether a file is one the platform refuses to host.
1484
1504
  *
@@ -2777,7 +2797,7 @@ interface UploadedFile {
2777
2797
  */
2778
2798
  declare function isPlatformDomain(domain: string, platformDomain: string): boolean;
2779
2799
  /**
2780
- * Check if a domain is a custom domain (not a platform subdomain).
2800
+ * Check if a domain is a custom domain (not a platform domain).
2781
2801
  * Custom domains are billable and require DNS verification.
2782
2802
  *
2783
2803
  * @example isCustomDomain("example.com", "shipstatic.com") → true
@@ -3675,7 +3695,9 @@ declare function calculateMD5(input: Blob | Buffer | string): Promise<MD5Result>
3675
3695
  * limit, and reads without a prefix. The family is subject first: `File
3676
3696
  * "<path>" <verdict>. Maximum <limit> allowed.`, and `File name "<path>" …`
3677
3697
  * where the name is the subject. The total-size rule's subject is the set of
3678
- * files, which is why it names no path.
3698
+ * files, which is why it names no path. A limit's sentence ends with the way
3699
+ * forward the API delivered for it (`withWayForward`), so the whole reads
3700
+ * `File "x" is too large. Maximum 20 MB allowed. Upgrade to Pro for more.`
3679
3701
  *
3680
3702
  * **Wording follows the API where a choice existed**, so the deferred Phase B
3681
3703
  * (promoting this table to `@shipstatic/types` with the API consuming it) has
@@ -3828,4 +3850,4 @@ declare class Ship extends Ship$1 {
3828
3850
  protected processInput(input: DeployInput, options: DeploymentOptions, limits: PlatformLimits): Promise<StaticFile[]>;
3829
3851
  }
3830
3852
 
3831
- export { ACCOUNT_HEADER, API_KEY, API_PATHS, AUTH_BASE_PATH, type Account, type AccountAccess, type AccountDeleteResponse, type AccountKeyResponse, AccountPlan, type AccountPlanType, AccountRefusal, type AccountRefusalType, type AccountResource, type AccountRole, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, BUILD_SETTINGS, type BillingInterval, type BillingPortalSession, type BillingSyncResponse, type BuildFailureDetails, CALLER, type Caps, type ConsoleErrand, type ConsolePaths, type ConsoleSection, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_FIELDS, DEPLOY_FILE_GRAMMAR, DEPLOY_TOKEN, type DeployBodyContext, type DeployFile, type DeployFileEncoding, type DeployFileSpec, type DeployInput, type DeployTransport, type Deployment, type DeploymentCreateResponse, type DeploymentDeleteResponse, type DeploymentListResponse, type DeploymentOptions, type DeploymentResource, type DeploymentResourceContext, type DeploymentSetOptions, DeploymentStatus, type DeploymentStatusType, type DeploymentUploadOptions, DeploymentVia, type DeploymentViaType, type DnsLookup, type DnsProvider, type DnsRecord, type DnsRecordType, type Domain, type DomainDeleteResponse, type DomainDnsResponse, type DomainListResponse, type DomainRecordsResponse, type DomainResource, type DomainSetOptions, type DomainSetResult, type DomainShareResponse, DomainStatus, type DomainStatusType, type DomainValidateResponse, DomainVerification, type DomainVerificationType, type DomainVerifyResponse, type ErrorResponse, ErrorType, type ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, type Fetch, type FileValidationResult, FileValidationStatus, type FileValidationStatusType, IDEMPOTENCY_KEY_CONSTRAINTS, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, type LabelsResponse, type ListOptions, type ListResponse, type MD5Result, MY_API_KEY_URL, OAUTH_TOKEN, OAuthScope, type OAuthScopeType, PASSWORD_CONSTRAINTS, PUBLIC_DEPLOYMENT_TTL_SECONDS, type PingResponse, type Plan, type PlanChangeRefusalDetails, type PlanChangeRequest, type PlanChangeResponse, type PlanDestination, type PlansResponse, type PlatformLimits, type RequestResult, type ResourceContext, SECTIONS, SETUP_TROUBLESHOOTING_ANCHOR, SHIP_ENV, SHIP_VIA_ENV, SIGN_IN_RETURN_PARAM, type SPACheckDebug, type SPACheckRequest, type SPACheckResponse, SPA_CHECK_CONSTRAINTS, SPA_DEFAULT_CONFIG, type ScheduledChange, type SettingsFragment, type SetupInstructionsResponse, Ship, type ShipClientOptions, ShipError, type ShipEvents, type ShipRequestInit, type StaticFile, TTL_CONSTRAINTS, type Token, type TokenCreateOptions, type TokenCreateResponse, type TokenDeleteResponse, TokenKind, type TokenKindType, type TokenListResponse, type TokenProvider, type TokenResource, type Transport, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, USER_VISIBLE_EVENTS, type UploadedFile, type UserVisibleActivityEvent, type ValidatableFile, type ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, accountOfPath, allValidFilesReady, assertShipJsonSyntax, billingReturnOf, calculateMD5, classifyToken, consolePaths, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, deserializeLabels, doors, errandOf, extractSubdomain, filterJunk, formatDuration, formatFileSize, formatTimeRemaining, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isClaimPath, isCustomDomain, isDeployment, isInvitationPath, isPlatformDomain, isShipError, isUpgradePath, normalizeVia, optimizeDeployPaths, personName, personShortName, pluralize, processFilesForBrowser, readBearerValue, serializeLabels, validateApiKey, validateApiUrl, validateBuildCommand, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validateOAuthToken, validateOutputDir, validatePassword, validateToken, validateTtl };
3853
+ export { ACCOUNT_HEADER, API_KEY, API_PATHS, AUTH_BASE_PATH, type Account, type AccountAccess, type AccountDeleteResponse, type AccountKeyResponse, AccountPlan, type AccountPlanType, AccountRefusal, type AccountRefusalType, type AccountResource, type AccountRole, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, BUILD_SETTINGS, type BillingInterval, type BillingPortalSession, type BillingSyncResponse, type BuildFailureDetails, CALLER, type Caps, type ConsoleErrand, type ConsolePaths, type ConsoleSection, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_FIELDS, DEPLOY_FILE_GRAMMAR, DEPLOY_TOKEN, type DeployBodyContext, type DeployFile, type DeployFileEncoding, type DeployFileSpec, type DeployInput, type DeployTransport, type Deployment, type DeploymentCreateResponse, type DeploymentDeleteResponse, type DeploymentListResponse, type DeploymentOptions, type DeploymentResource, type DeploymentResourceContext, type DeploymentSetOptions, DeploymentStatus, type DeploymentStatusType, type DeploymentUploadOptions, DeploymentVia, type DeploymentViaType, type DnsLookup, type DnsProvider, type DnsRecord, type DnsRecordType, type Domain, type DomainDeleteResponse, type DomainDnsResponse, type DomainListResponse, type DomainRecordsResponse, type DomainResource, type DomainSetOptions, type DomainSetResult, type DomainShareResponse, DomainStatus, type DomainStatusType, type DomainValidateResponse, DomainVerification, type DomainVerificationType, type DomainVerifyResponse, type ErrorResponse, ErrorType, type ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, type Fetch, type FileValidationResult, FileValidationStatus, type FileValidationStatusType, IDEMPOTENCY_KEY_CONSTRAINTS, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, type LabelsResponse, type ListOptions, type ListResponse, type MD5Result, MY_API_KEY_URL, OAUTH_TOKEN, OAuthScope, type OAuthScopeType, PASSWORD_CONSTRAINTS, PUBLIC_DEPLOYMENT_TTL_SECONDS, type PingResponse, type Plan, type PlanChangeRefusalDetails, type PlanChangeRequest, type PlanChangeResponse, type PlanDestination, type PlansResponse, type PlatformLimitKey, type PlatformLimits, type RequestResult, type ResourceContext, SECTIONS, SETUP_TROUBLESHOOTING_ANCHOR, SHIP_ENV, SHIP_VIA_ENV, SIGN_IN_RETURN_PARAM, type SPACheckDebug, type SPACheckRequest, type SPACheckResponse, SPA_CHECK_CONSTRAINTS, SPA_DEFAULT_CONFIG, type ScheduledChange, type SettingsFragment, type SetupInstructionsResponse, Ship, type ShipClientOptions, ShipError, type ShipEvents, type ShipRequestInit, type StaticFile, TTL_CONSTRAINTS, type Token, type TokenCreateOptions, type TokenCreateResponse, type TokenDeleteResponse, TokenKind, type TokenKindType, type TokenListResponse, type TokenProvider, type TokenResource, type Transport, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, USER_VISIBLE_EVENTS, type UploadedFile, type UserVisibleActivityEvent, type ValidatableFile, type ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, accountOfPath, allValidFilesReady, assertShipJsonSyntax, billingReturnOf, calculateMD5, classifyToken, consolePaths, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, deserializeLabels, doors, errandOf, extractSubdomain, filterJunk, formatDuration, formatFileSize, formatTimeRemaining, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isClaimPath, isCustomDomain, isDeployment, isInvitationPath, isPlatformDomain, isShipError, isUpgradePath, normalizeVia, optimizeDeployPaths, personName, personShortName, pluralize, processFilesForBrowser, readBearerValue, serializeLabels, validateApiKey, validateApiUrl, validateBuildCommand, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validateOAuthToken, validateOutputDir, validatePassword, validateToken, validateTtl };
package/dist/browser.js CHANGED
@@ -1,2 +1,2 @@
1
- var ht=Object.create;var H=Object.defineProperty;var yt=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var Et=Object.getPrototypeOf,At=Object.prototype.hasOwnProperty;var Tt=(e,n,t)=>n in e?H(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var _=(e,n)=>()=>(e&&(n=e(e=0)),n);var _e=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),St=(e,n)=>{for(var t in n)H(e,t,{get:n[t],enumerable:!0})},Dt=(e,n,t,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of gt(n))!At.call(e,l)&&l!==t&&H(e,l,{get:()=>n[l],enumerable:!(s=yt(n,l))||s.enumerable});return e};var G=(e,n,t)=>(t=e!=null?ht(Et(e)):{},Dt(n||!e||!e.__esModule?H(t,"default",{value:e,enumerable:!0}):t,e));var k=(e,n,t)=>Tt(e,typeof n!="symbol"?n+"":n,t);function An(e){if(!e||typeof e!="string")return;let n=e.trim().toLowerCase();return Object.values(Rt).includes(n)?n:void 0}function Oe(e){if(e==null)return;if(typeof e!="string")throw m.validation("Idempotency key must be a string.");let n=e.trim();if(!n)throw m.validation("Idempotency key must not be empty.");if(n.length>v.MAX_LENGTH)throw m.validation(`Idempotency key must be at most ${v.MAX_LENGTH} characters.`);return n}function Dn(e){return e.name?.trim()||e.email}function Rn(e){return e.name?.trim().split(" ")[0]||e.email}function Nt(e){let n=e.code;return n==="ERR_INVALID_URL"?!1:typeof n=="string"?!0:e instanceof TypeError?!/\burl\b/i.test(e.message):!1}function xe(e){return e!==null&&typeof e=="object"&&"name"in e&&e.name==="ShipError"&&"status"in e}function Lt(e){let n=e.replace(/\\/g,"/").split("/").pop()??"",t=n.lastIndexOf(".");return t<=0||t===n.length-1?null:n.slice(t+1).toLowerCase()}function Pe(e,n){let t=Lt(e);return t===null?!1:Array.isArray(n)?n.includes(t):n.has(t)}function Ce(e){return Ot.test(e)}function z(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(t=>xt.has(t))}function Pt(e){return e.startsWith(ve.PREFIX)?P.API_KEY:e.startsWith(Fe.PREFIX)?P.DEPLOY_TOKEN:e.startsWith(Me.PREFIX)?P.OAUTH:P.OPAQUE}function wn(e){return e.slice(0,se.length).toLowerCase()!==se?null:e.slice(se.length)||null}function $e(e){let n=e.charCodeAt(0)===65279?e.slice(1):e,t;try{t=JSON.parse(n)}catch(s){throw m.config(`invalid JSON format in config: ${s.message}`,{filePath:w})}if(t===null||typeof t!="object"||Array.isArray(t))throw m.config(`${w} must contain a JSON object`,{filePath:w})}function le(e,n,t){if(!e.startsWith(n.PREFIX))throw m.validation(`${t} must start with "${n.PREFIX}"`);if(e.length!==n.TOTAL_LENGTH)throw m.validation(`${t} must be ${n.TOTAL_LENGTH} characters total (${n.PREFIX} + ${n.HEX_LENGTH} hex chars)`);let s=e.slice(n.PREFIX.length);if(!new RegExp(`^[a-f0-9]{${n.HEX_LENGTH}}$`,"i").test(s))throw m.validation(`${t} must contain ${n.HEX_LENGTH} hexadecimal characters after "${n.PREFIX}" prefix`)}function Ct(e){le(e,ve,"API key")}function vt(e){le(e,Fe,"Deploy token")}function Ft(e){le(e,Me,"OAuth access token")}function ue(e){switch(Pt(e)){case P.API_KEY:Ct(e);return;case P.DEPLOY_TOKEN:vt(e);return;case P.OAUTH:Ft(e);return;case P.OPAQUE:if(!e)throw m.validation("Token must be a non-empty string")}}function Be(e){if(!e||e.length>M.MAX_LENGTH||!M.PATTERN.test(e))throw m.validation(`Caller must be 1-${M.MAX_LENGTH} characters: letters, digits, dots, underscores, or hyphens`)}function xn(e){try{let n=new URL(e);if(!["http:","https:"].includes(n.protocol))throw m.validation("API URL must use http:// or https:// protocol");if(n.pathname!=="/"&&n.pathname!=="")throw m.validation("API URL must not contain a path");if(n.search||n.hash)throw m.validation("API URL must not contain query parameters or fragments")}catch(n){throw xe(n)?n:m.validation("API URL must be a valid URL")}}function Pn(e){return/^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(e)}function ce(e){if(e!=null){if(typeof e!="number"||!Number.isFinite(e))throw m.validation("TTL must be a number of seconds");if(!Number.isInteger(e))throw m.validation("TTL must be a whole number of seconds");if(e<V.MIN_SECONDS||e>V.MAX_SECONDS)throw m.validation(`TTL must be between ${V.MIN_SECONDS} and ${V.MAX_SECONDS} seconds`);return e}}function Bt(e){let n=e?`/${e}`:"",t=s=>`${n}${s}`;return{dashboard:()=>n||"/",newSite:()=>t("/new"),deployments:Object.assign(()=>t("/deployments"),{upload:()=>t("/deployments/upload")}),domains:Object.assign(()=>t("/domains"),{connect:s=>t(`/domains/${s}/connect`),deployment:s=>t(`/domains/${s}/deployment`)}),settings:s=>t(s?`/settings#${s}`:"/settings"),settingsAfterBilling:()=>t(`/settings?${Ne("portal")}`),upgrade:s=>t(s?`/upgrade/${s}`:"/upgrade"),success:()=>t("/success"),successAfterCheckout:()=>t(`/success?${Ne("checkout")}`),apiKey:()=>t("/api-key")}}function vn(e){let n=new URLSearchParams(e);for(let[t,[s,l]]of Object.entries(He))if(n.get(s)===l)return t;return null}function q(e){let n=e.split(/[?#]/)[0].toLowerCase(),[t="",s=""]=n.split("/").filter(Boolean);return Ht(t)?{kind:"door",door:t}:t===$t?{kind:"admin"}:t===""||we(t)?{kind:"account",account:null,section:t===""?null:t}:{kind:"account",account:t,section:we(s)?s:null}}function Fn(e){let n=q(e);return n.kind==="account"?n.account:null}function Mn(e){return Gt(e)?"claim":kt(e)?"invite":Vt(e)?"upgrade":null}function Kt(e){let n=Math.round(e/60);if(!(n>=1))return"less than a minute";if(n<120)return ae(n,"minute");let t=Math.round(e/3600);return t<48?ae(t,"hour"):ae(Math.round(e/86400),"day")}function Gn(e,n=Date.now()/1e3){let t=e-n;return t>0?Kt(t):null}function ae(e,n){return`${e} ${n}${e===1?"":"s"}`}function $(e,n=1){if(e===0)return"0 Bytes";let t=1024,s=["Bytes","KB","MB","GB"],l=Math.floor(Math.log(e)/Math.log(t));return`${Number.parseFloat((e/t**l).toFixed(n))} ${s[l]}`}function Ge(e,n){return e.endsWith(`.${n}`)}function Vn(e,n){return!Ge(e,n)}function Kn(e,n){return Ge(e,n)?e.slice(0,-(n.length+1)):null}function zn(e){return`https://${e}`}function Xn(e){return`https://${e}`}function qn(e){return!e||e.length===0?null:JSON.stringify(e)}function jn(e){if(!e)return[];try{let n=JSON.parse(e);return Array.isArray(n)?n:[]}catch{return[]}}function Ve(e){if(e==null||e==="")return;if(typeof e!="string")throw m.validation("Build command must be a string");let n=e.trim();if(n.length===0||n.length>U.COMMAND_MAX_LENGTH)throw m.validation(`Build command must be between 1 and ${U.COMMAND_MAX_LENGTH} characters`);if(/[\x00-\x1f\x7f]/.test(n))throw m.validation("Build command must be a single line");return n}function Ke(e){if(e==null||e==="")return;if(typeof e!="string")throw m.validation("Output folder must be a string");let n=e.trim().replace(/\/+$/,"");if(n.length===0||n.length>U.OUTPUT_DIR_MAX_LENGTH)throw m.validation(`Output folder must be between 1 and ${U.OUTPUT_DIR_MAX_LENGTH} characters`);if(!U.OUTPUT_DIR_PATTERN.test(n)||n.split("/").some(t=>t===".."||t==="."))throw m.validation("Output folder must be a relative path inside the project, like dist or dist/site");return n}function de(e){if(e==null)return;if(typeof e!="string")throw m.validation("Password must be a string");let n=e.trim();if(n.length<K.MIN_LENGTH||n.length>K.MAX_LENGTH)throw m.validation(`Password must be between ${K.MIN_LENGTH} and ${K.MAX_LENGTH} characters`);return n}var hn,Rt,yn,gn,En,v,Tn,Sn,T,I,bn,g,bt,ie,It,_t,m,wt,In,Ot,xt,_n,Nn,oe,ve,Fe,Me,M,Ln,P,se,On,w,Ue,X,V,Mt,Ut,$t,He,Ne,Le,Cn,Ht,we,Gt,kt,Vt,pe,Un,$n,Bn,Hn,kn,R,C,ke,U,K,D=_(()=>{"use strict";hn={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},Rt={WEB:"web",SDK:"sdk",CLI:"cli",MCP:"mcp",GIT:"git",N8N:"n8n",GPT:"gpt",VSC:"vsc",CLD:"cld",CRS:"crs",GMN:"gmn",API:"api"},yn={LIVE:"live",UNLINKED:"unlinked",UNVERIFIED:"unverified",PAUSED:"paused"},gn={PENDING:"pending",PARTIAL:"partial",VERIFIED:"verified"},En="troubleshooting",v={HEADER:"Idempotency-Key",MAX_LENGTH:256,WINDOW_SECONDS:1440*60};Tn={FREE:"free",PRO:"pro",TEAM:"team",SCALE:"scale",SPONSORED:"sponsored"},Sn={PAUSED:"paused",UNKNOWN:"unknown"};T={DEPLOYMENTS:"/deployments",DEPLOYMENT:e=>`/deployments/${e}`,DEPLOYMENT_CONFIG:e=>`/deployments/${e}/config`,DOMAINS:"/domains",DOMAIN:e=>`/domains/${e}`,DOMAIN_VERIFY:e=>`/domains/${e}/verify`,DOMAIN_DNS:e=>`/domains/${e}/dns`,DOMAIN_RECORDS:e=>`/domains/${e}/records`,DOMAIN_SHARE:e=>`/domains/${e}/share`,DOMAIN_PROPAGATION:e=>`/domains/${e}/propagation`,DOMAINS_VALIDATE:"/domains/validate",TOKENS:"/tokens",TOKEN:e=>`/tokens/${e}`,ACCOUNT:"/account",ACCOUNT_KEY:"/account/key",ACCOUNT_CLAIM:"/account/claim",ACTIVITIES:"/activities",LABELS:"/labels",LIMITS:"/limits",PLANS:"/plans",PING:"/ping",SETUP:"/setup",SPA_CHECK:"/spa-check",UPLOAD:"/upload"},I={FILES:"files[]",CHECKSUMS:"checksums",LABELS:"labels",VIA:"via",PASSWORD:"password",TTL:"ttl",BUILD:"build",PRERENDER:"prerender",SPA:"spa",BUILD_COMMAND:"buildCommand",OUTPUT_DIR:"outputDir",CAPTCHA:"captcha"},bn={PATH:"path",CONTENT:"content",ENCODING:"encoding",DEFAULT_ENCODING:"utf-8",ENCODINGS:["utf-8","base64"]},g={Validation:"validation_failed",NotFound:"not_found",Forbidden:"forbidden",RateLimit:"rate_limit_exceeded",Authentication:"authentication_failed",Business:"business_logic_error",Api:"internal_server_error",Maintenance:"maintenance",Build:"build_failed",Network:"network_error",Timeout:"timeout_error",Cancelled:"operation_cancelled",File:"file_error",Config:"config_error"},bt=new Set([g.Network,g.Timeout,g.Cancelled,g.File,g.Config]),ie={client:new Set([g.Build,g.Business,g.Cancelled,g.Config,g.File,g.Forbidden,g.NotFound,g.RateLimit,g.Validation]),network:new Set([g.Network,g.Timeout]),auth:new Set([g.Authentication])},It=new Set(Object.values(g).filter(e=>!bt.has(e))),_t=200;m=class e extends Error{constructor(t,s,l,p){super(s);k(this,"type");k(this,"status");k(this,"details");this.type=t,this.status=l,this.details=p,this.name="ShipError"}toResponse(){let t=this.details,s=this.type===g.Authentication&&t?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:s}}static async fromHttpResponse(t,s){let l,p,h;try{if(t.headers.get("content-type")?.includes("application/json")){let f=await t.json();if(f&&typeof f=="object"){let A=f;typeof A.message=="string"?l=A.message:typeof A.error=="string"&&(l=A.error),p=A.details,typeof A.error=="string"&&It.has(A.error)&&(h=A.error)}}else{let f=(await t.text()).trim();f&&!f.startsWith("<")&&f.length<=_t&&(l=f)}}catch{}let y=t.headers.get("retry-after");if(y!==null){let E=y.trim(),f=/^\d+$/.test(E)?Number(E):Math.ceil((Date.parse(E)-Date.now())/1e3);if(Number.isFinite(f)&&f>=0){let A=p&&typeof p=="object"?p:{};A.retryAfter===void 0&&(p={...A,retryAfter:f})}}l=l||`${s||"Request"} failed with status ${t.status}`;let d=h??(t.status===401?g.Authentication:t.status===403?g.Forbidden:t.status===429?g.RateLimit:g.Api);return new e(d,l,t.status,p)}static fromFetchError(t,s){if(xe(t))return t;let l=s||"Request",p=t?.name;return p==="AbortError"?e.cancelled(`${l} was cancelled`):p==="TimeoutError"?e.timeout(`${l} timed out`,{cause:t}):t instanceof Error?Nt(t)?e.network(`${l} failed: ${t.message}`,{cause:t}):new e(g.Api,`${l} failed: ${t.message}`):new e(g.Api,`${l} failed: Unknown error`)}static validation(t,s){return new e(g.Validation,t,400,s)}static notFound(t,s){let l=s?`${t} ${s} not found`:`${t} not found`;return new e(g.NotFound,l,404)}static forbidden(t,s){return new e(g.Forbidden,t,403,s)}static rateLimit(t="Too many requests",s){return new e(g.RateLimit,t,429,s)}static authentication(t="Authentication required",s){return new e(g.Authentication,t,401,s)}static business(t,s=400,l){return new e(g.Business,t,s,l)}static network(t,s){return new e(g.Network,t,void 0,s)}static timeout(t,s){return new e(g.Timeout,t,void 0,s)}static cancelled(t,s){return new e(g.Cancelled,t,void 0,s)}static file(t,s){return new e(g.File,t,void 0,s)}static config(t,s){return new e(g.Config,t,void 0,s)}static api(t,s=500,l){return new e(g.Api,t,s,l)}static maintenance(t,s){return new e(g.Maintenance,t,503,s)}static build(t,s){return new e(g.Build,t,422,s)}isClientError(){return ie.client.has(this.type)?!0:this.status!==void 0&&this.status>=400&&this.status<500}isNetworkError(){return ie.network.has(this.type)}isAuthError(){return ie.auth.has(this.type)}isType(t){return this.type===t}};wt=["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"],In=wt.map(e=>`.${e}`).join(","),Ot=/[\x00-\x1f\x7f#?%\\<>"]/;xt=new Set(["node_modules","package.json"]);_n="/auth",Nn="signing-in",oe={SESSION:"session",API_KEY:"apiKey",TOKEN:"token",AGENT:"agent",OAUTH:"oauth",SYSTEM:"system"},ve={PREFIX:"ship-",HEX_LENGTH:32,TOTAL_LENGTH:37,HINT_LENGTH:4},Fe={PREFIX:"deploy-",HEX_LENGTH:32,TOTAL_LENGTH:39},Me={PREFIX:"oauth-",HEX_LENGTH:32,TOTAL_LENGTH:38},M={HEADER:"X-Caller",MAX_LENGTH:128,PATTERN:/^[a-zA-Z0-9._-]+$/},Ln="X-Account",P={API_KEY:oe.API_KEY,DEPLOY_TOKEN:oe.TOKEN,OAUTH:oe.OAUTH,OPAQUE:"opaque"};se="bearer ";On={ACCOUNT_READ:"account:read",DEPLOYMENTS_READ:"deployments:read",DEPLOYMENTS_WRITE:"deployments:write",DOMAINS_READ:"domains:read",DOMAINS_WRITE:"domains:write"},w="ship.json",Ue={rewrites:[{source:"/(.*)",destination:"/index.html"}]},X={INDEX_FILE:"index.html",MAX_INDEX_BYTES:100*1024};V={MIN_SECONDS:1,MAX_SECONDS:365*24*60*60};Mt={new:{owner:!1},deployments:{owner:!1},domains:{owner:!1},settings:{owner:!1},upgrade:{owner:!0},success:{owner:!0},"api-key":{owner:!0}},Ut=["login","register","logout","invitations","claim","consent"],$t="admin",He={checkout:["upgrading","true"],portal:["billing","returned"]},Ne=e=>He[e].join("="),Le=(e,n)=>n?`${e}?next=${encodeURIComponent(n)}`:e;Cn={login:e=>Le("/login",e),register:e=>Le("/register",e),logout:()=>"/logout",invitation:e=>`/invitations/${e}`,claim:e=>`/claim/${e}`,consent:()=>"/consent"};Ht=e=>Ut.includes(e),we=e=>Object.hasOwn(Mt,e);Gt=e=>{let n=q(e);return n.kind==="door"&&n.door==="claim"},kt=e=>{let n=q(e);return n.kind==="door"&&n.door==="invitations"},Vt=e=>{let n=q(e);return n.kind==="account"&&n.section==="upgrade"};pe="https://api.shipstatic.com",Un={TOKEN:"SHIP_TOKEN",API_URL:"SHIP_API_URL"},$n="SHIP_VIA",Bn=`https://my.shipstatic.com${Bt().apiKey()}`,Hn=4320*60;kn=["account.create","account.update","account.delete","account.key.generate","account.plan.transition","deployment.create","deployment.update","deployment.delete","deployment.claim","domain.create","domain.update","domain.delete","domain.verify","token.create","token.consume","token.delete","member.join","member.leave","consent.grant"],R={PENDING:"pending",PROCESSING_ERROR:"processing_error",EXCLUDED:"excluded",VALIDATION_FAILED:"validation_failed",READY:"ready"};C={MIN_LENGTH:3,MAX_LENGTH:25,MAX_COUNT:10,SEPARATORS:"._-"},ke=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;U={COMMAND_MAX_LENGTH:200,OUTPUT_DIR_MAX_LENGTH:100,OUTPUT_DIR_PATTERN:/^[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/};K={MIN_LENGTH:6,MAX_LENGTH:128}});var Ye=_e((qe,je)=>{"use strict";(function(e){if(typeof qe=="object")je.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var n;try{n=window}catch{n=self}n.SparkMD5=e()}})(function(e){"use strict";var n=function(c,u){return c+u&4294967295},t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function s(c,u,i,r,a,o){return u=n(n(u,c),n(r,o)),n(u<<a|u>>>32-a,i)}function l(c,u){var i=c[0],r=c[1],a=c[2],o=c[3];i+=(r&a|~r&o)+u[0]-680876936|0,i=(i<<7|i>>>25)+r|0,o+=(i&r|~i&a)+u[1]-389564586|0,o=(o<<12|o>>>20)+i|0,a+=(o&i|~o&r)+u[2]+606105819|0,a=(a<<17|a>>>15)+o|0,r+=(a&o|~a&i)+u[3]-1044525330|0,r=(r<<22|r>>>10)+a|0,i+=(r&a|~r&o)+u[4]-176418897|0,i=(i<<7|i>>>25)+r|0,o+=(i&r|~i&a)+u[5]+1200080426|0,o=(o<<12|o>>>20)+i|0,a+=(o&i|~o&r)+u[6]-1473231341|0,a=(a<<17|a>>>15)+o|0,r+=(a&o|~a&i)+u[7]-45705983|0,r=(r<<22|r>>>10)+a|0,i+=(r&a|~r&o)+u[8]+1770035416|0,i=(i<<7|i>>>25)+r|0,o+=(i&r|~i&a)+u[9]-1958414417|0,o=(o<<12|o>>>20)+i|0,a+=(o&i|~o&r)+u[10]-42063|0,a=(a<<17|a>>>15)+o|0,r+=(a&o|~a&i)+u[11]-1990404162|0,r=(r<<22|r>>>10)+a|0,i+=(r&a|~r&o)+u[12]+1804603682|0,i=(i<<7|i>>>25)+r|0,o+=(i&r|~i&a)+u[13]-40341101|0,o=(o<<12|o>>>20)+i|0,a+=(o&i|~o&r)+u[14]-1502002290|0,a=(a<<17|a>>>15)+o|0,r+=(a&o|~a&i)+u[15]+1236535329|0,r=(r<<22|r>>>10)+a|0,i+=(r&o|a&~o)+u[1]-165796510|0,i=(i<<5|i>>>27)+r|0,o+=(i&a|r&~a)+u[6]-1069501632|0,o=(o<<9|o>>>23)+i|0,a+=(o&r|i&~r)+u[11]+643717713|0,a=(a<<14|a>>>18)+o|0,r+=(a&i|o&~i)+u[0]-373897302|0,r=(r<<20|r>>>12)+a|0,i+=(r&o|a&~o)+u[5]-701558691|0,i=(i<<5|i>>>27)+r|0,o+=(i&a|r&~a)+u[10]+38016083|0,o=(o<<9|o>>>23)+i|0,a+=(o&r|i&~r)+u[15]-660478335|0,a=(a<<14|a>>>18)+o|0,r+=(a&i|o&~i)+u[4]-405537848|0,r=(r<<20|r>>>12)+a|0,i+=(r&o|a&~o)+u[9]+568446438|0,i=(i<<5|i>>>27)+r|0,o+=(i&a|r&~a)+u[14]-1019803690|0,o=(o<<9|o>>>23)+i|0,a+=(o&r|i&~r)+u[3]-187363961|0,a=(a<<14|a>>>18)+o|0,r+=(a&i|o&~i)+u[8]+1163531501|0,r=(r<<20|r>>>12)+a|0,i+=(r&o|a&~o)+u[13]-1444681467|0,i=(i<<5|i>>>27)+r|0,o+=(i&a|r&~a)+u[2]-51403784|0,o=(o<<9|o>>>23)+i|0,a+=(o&r|i&~r)+u[7]+1735328473|0,a=(a<<14|a>>>18)+o|0,r+=(a&i|o&~i)+u[12]-1926607734|0,r=(r<<20|r>>>12)+a|0,i+=(r^a^o)+u[5]-378558|0,i=(i<<4|i>>>28)+r|0,o+=(i^r^a)+u[8]-2022574463|0,o=(o<<11|o>>>21)+i|0,a+=(o^i^r)+u[11]+1839030562|0,a=(a<<16|a>>>16)+o|0,r+=(a^o^i)+u[14]-35309556|0,r=(r<<23|r>>>9)+a|0,i+=(r^a^o)+u[1]-1530992060|0,i=(i<<4|i>>>28)+r|0,o+=(i^r^a)+u[4]+1272893353|0,o=(o<<11|o>>>21)+i|0,a+=(o^i^r)+u[7]-155497632|0,a=(a<<16|a>>>16)+o|0,r+=(a^o^i)+u[10]-1094730640|0,r=(r<<23|r>>>9)+a|0,i+=(r^a^o)+u[13]+681279174|0,i=(i<<4|i>>>28)+r|0,o+=(i^r^a)+u[0]-358537222|0,o=(o<<11|o>>>21)+i|0,a+=(o^i^r)+u[3]-722521979|0,a=(a<<16|a>>>16)+o|0,r+=(a^o^i)+u[6]+76029189|0,r=(r<<23|r>>>9)+a|0,i+=(r^a^o)+u[9]-640364487|0,i=(i<<4|i>>>28)+r|0,o+=(i^r^a)+u[12]-421815835|0,o=(o<<11|o>>>21)+i|0,a+=(o^i^r)+u[15]+530742520|0,a=(a<<16|a>>>16)+o|0,r+=(a^o^i)+u[2]-995338651|0,r=(r<<23|r>>>9)+a|0,i+=(a^(r|~o))+u[0]-198630844|0,i=(i<<6|i>>>26)+r|0,o+=(r^(i|~a))+u[7]+1126891415|0,o=(o<<10|o>>>22)+i|0,a+=(i^(o|~r))+u[14]-1416354905|0,a=(a<<15|a>>>17)+o|0,r+=(o^(a|~i))+u[5]-57434055|0,r=(r<<21|r>>>11)+a|0,i+=(a^(r|~o))+u[12]+1700485571|0,i=(i<<6|i>>>26)+r|0,o+=(r^(i|~a))+u[3]-1894986606|0,o=(o<<10|o>>>22)+i|0,a+=(i^(o|~r))+u[10]-1051523|0,a=(a<<15|a>>>17)+o|0,r+=(o^(a|~i))+u[1]-2054922799|0,r=(r<<21|r>>>11)+a|0,i+=(a^(r|~o))+u[8]+1873313359|0,i=(i<<6|i>>>26)+r|0,o+=(r^(i|~a))+u[15]-30611744|0,o=(o<<10|o>>>22)+i|0,a+=(i^(o|~r))+u[6]-1560198380|0,a=(a<<15|a>>>17)+o|0,r+=(o^(a|~i))+u[13]+1309151649|0,r=(r<<21|r>>>11)+a|0,i+=(a^(r|~o))+u[4]-145523070|0,i=(i<<6|i>>>26)+r|0,o+=(r^(i|~a))+u[11]-1120210379|0,o=(o<<10|o>>>22)+i|0,a+=(i^(o|~r))+u[2]+718787259|0,a=(a<<15|a>>>17)+o|0,r+=(o^(a|~i))+u[9]-343485551|0,r=(r<<21|r>>>11)+a|0,c[0]=i+c[0]|0,c[1]=r+c[1]|0,c[2]=a+c[2]|0,c[3]=o+c[3]|0}function p(c){var u=[],i;for(i=0;i<64;i+=4)u[i>>2]=c.charCodeAt(i)+(c.charCodeAt(i+1)<<8)+(c.charCodeAt(i+2)<<16)+(c.charCodeAt(i+3)<<24);return u}function h(c){var u=[],i;for(i=0;i<64;i+=4)u[i>>2]=c[i]+(c[i+1]<<8)+(c[i+2]<<16)+(c[i+3]<<24);return u}function y(c){var u=c.length,i=[1732584193,-271733879,-1732584194,271733878],r,a,o,b,L,x;for(r=64;r<=u;r+=64)l(i,p(c.substring(r-64,r)));for(c=c.substring(r-64),a=c.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<a;r+=1)o[r>>2]|=c.charCodeAt(r)<<(r%4<<3);if(o[r>>2]|=128<<(r%4<<3),r>55)for(l(i,o),r=0;r<16;r+=1)o[r]=0;return b=u*8,b=b.toString(16).match(/(.*?)(.{0,8})$/),L=parseInt(b[2],16),x=parseInt(b[1],16)||0,o[14]=L,o[15]=x,l(i,o),i}function d(c){var u=c.length,i=[1732584193,-271733879,-1732584194,271733878],r,a,o,b,L,x;for(r=64;r<=u;r+=64)l(i,h(c.subarray(r-64,r)));for(c=r-64<u?c.subarray(r-64):new Uint8Array(0),a=c.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<a;r+=1)o[r>>2]|=c[r]<<(r%4<<3);if(o[r>>2]|=128<<(r%4<<3),r>55)for(l(i,o),r=0;r<16;r+=1)o[r]=0;return b=u*8,b=b.toString(16).match(/(.*?)(.{0,8})$/),L=parseInt(b[2],16),x=parseInt(b[1],16)||0,o[14]=L,o[15]=x,l(i,o),i}function E(c){var u="",i;for(i=0;i<4;i+=1)u+=t[c>>i*8+4&15]+t[c>>i*8&15];return u}function f(c){var u;for(u=0;u<c.length;u+=1)c[u]=E(c[u]);return c.join("")}f(y("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(n=function(c,u){var i=(c&65535)+(u&65535),r=(c>>16)+(u>>16)+(i>>16);return r<<16|i&65535}),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function c(u,i){return u=u|0||0,u<0?Math.max(u+i,0):Math.min(u,i)}ArrayBuffer.prototype.slice=function(u,i){var r=this.byteLength,a=c(u,r),o=r,b,L,x,Ie;return i!==e&&(o=c(i,r)),a>o?new ArrayBuffer(0):(b=o-a,L=new ArrayBuffer(b),x=new Uint8Array(L),Ie=new Uint8Array(this,a,b),x.set(Ie),L)}})();function A(c){return/[\u0080-\uFFFF]/.test(c)&&(c=unescape(encodeURIComponent(c))),c}function N(c,u){var i=c.length,r=new ArrayBuffer(i),a=new Uint8Array(r),o;for(o=0;o<i;o+=1)a[o]=c.charCodeAt(o);return u?a:r}function F(c){return String.fromCharCode.apply(null,new Uint8Array(c))}function re(c,u,i){var r=new Uint8Array(c.byteLength+u.byteLength);return r.set(new Uint8Array(c)),r.set(new Uint8Array(u),c.byteLength),i?r:r.buffer}function O(c){var u=[],i=c.length,r;for(r=0;r<i-1;r+=2)u.push(parseInt(c.substr(r,2),16));return String.fromCharCode.apply(String,u)}function S(){this.reset()}return S.prototype.append=function(c){return this.appendBinary(A(c)),this},S.prototype.appendBinary=function(c){this._buff+=c,this._length+=c.length;var u=this._buff.length,i;for(i=64;i<=u;i+=64)l(this._hash,p(this._buff.substring(i-64,i)));return this._buff=this._buff.substring(i-64),this},S.prototype.end=function(c){var u=this._buff,i=u.length,r,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o;for(r=0;r<i;r+=1)a[r>>2]|=u.charCodeAt(r)<<(r%4<<3);return this._finish(a,i),o=f(this._hash),c&&(o=O(o)),this.reset(),o},S.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},S.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},S.prototype.setState=function(c){return this._buff=c.buff,this._length=c.length,this._hash=c.hash,this},S.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},S.prototype._finish=function(c,u){var i=u,r,a,o;if(c[i>>2]|=128<<(i%4<<3),i>55)for(l(this._hash,c),i=0;i<16;i+=1)c[i]=0;r=this._length*8,r=r.toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(r[2],16),o=parseInt(r[1],16)||0,c[14]=a,c[15]=o,l(this._hash,c)},S.hash=function(c,u){return S.hashBinary(A(c),u)},S.hashBinary=function(c,u){var i=y(c),r=f(i);return u?O(r):r},S.ArrayBuffer=function(){this.reset()},S.ArrayBuffer.prototype.append=function(c){var u=re(this._buff.buffer,c,!0),i=u.length,r;for(this._length+=c.byteLength,r=64;r<=i;r+=64)l(this._hash,h(u.subarray(r-64,r)));return this._buff=r-64<i?new Uint8Array(u.buffer.slice(r-64)):new Uint8Array(0),this},S.ArrayBuffer.prototype.end=function(c){var u=this._buff,i=u.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],a,o;for(a=0;a<i;a+=1)r[a>>2]|=u[a]<<(a%4<<3);return this._finish(r,i),o=f(this._hash),c&&(o=O(o)),this.reset(),o},S.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},S.ArrayBuffer.prototype.getState=function(){var c=S.prototype.getState.call(this);return c.buff=F(c.buff),c},S.ArrayBuffer.prototype.setState=function(c){return c.buff=N(c.buff,!0),S.prototype.setState.call(this,c)},S.ArrayBuffer.prototype.destroy=S.prototype.destroy,S.ArrayBuffer.prototype._finish=S.prototype._finish,S.ArrayBuffer.hash=function(c,u){var i=d(new Uint8Array(c)),r=f(i);return u?O(r):r},S})});var W=_e((rr,We)=>{"use strict";We.exports={}});async function Zt(e){let n=(await Promise.resolve().then(()=>G(Ye(),1))).default,t=new n.ArrayBuffer,s=2097152;for(let l=0;l<e.size;l+=s){let p=Math.min(l+s,e.size);t.append(await e.slice(l,p).arrayBuffer())}return{md5:t.end()}}async function en(e){let{createHash:n}=await Promise.resolve().then(()=>G(W(),1)),t=n("md5");return t.update(e),{md5:t.digest("hex")}}async function tn(e){let{createHash:n}=await Promise.resolve().then(()=>G(W(),1)),{createReadStream:t}=await Promise.resolve().then(()=>G(W(),1));return new Promise((s,l)=>{let p=n("md5"),h=t(e);h.on("error",y=>l(m.file(`Failed to read file for MD5: ${y.message}`,{filePath:e}))),h.on("data",y=>p.update(y)),h.on("end",()=>s({md5:p.digest("hex")}))})}async function J(e){if(e instanceof Blob)return Zt(e);if(typeof Buffer<"u"&&Buffer.isBuffer(e))return en(e);if(typeof e=="string")return tn(e);throw m.business("Invalid input for MD5 calculation")}var Q=_(()=>{"use strict";D()});function te(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var rt=_(()=>{"use strict"});function it(e,n={}){if(n.flatten===!1)return e.map(s=>({path:te(s),name:me(s)}));let t=sn(e);return e.map(s=>{let l=te(s);if(t){let p=t.endsWith("/")?t:`${t}/`;l.startsWith(p)&&(l=l.substring(p.length))}return l||(l=me(s)),{path:l,name:me(s)}})}function sn(e){if(!e.length)return"";let t=e.map(p=>te(p)).map(p=>p.split("/")),s=[],l=Math.min(...t.map(p=>p.length));for(let p=0;p<l-1;p++){let h=t[0][p];if(t.every(y=>y[p]===h))s.push(h);else break}return s.join("/")}function me(e){return e.split(/[/\\]/).pop()||e}var he=_(()=>{"use strict";rt()});function _r(e){ye=e}function an(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function ot(){return ye||an()}var ye,ge=_(()=>{"use strict";ye=null});function ne(e,n){return ln.find(t=>t.broken(e,n))}var ln,Ae=_(()=>{"use strict";D();Te();ln=[{name:"name",broken:({path:e})=>!Ee(e).valid,sentence:({path:e})=>Ee(e).reason??`File name "${e}" is invalid.`},{name:"extension",broken:({path:e},n)=>Pe(e,n.blockedExtensions??[]),sentence:({path:e})=>`File "${e}" has an extension that is not allowed.`},{name:"fileSize",broken:({size:e},n)=>e>n.maxFileSize,sentence:({path:e},n)=>`File "${e}" is too large. Maximum ${$(n.maxFileSize)} allowed.`},{name:"totalSize",broken:({totalSize:e},n)=>e>n.maxTotalSize,sentence:({totalSize:e},n)=>`Files add up to ${$(e)}. Maximum ${$(n.maxTotalSize)} allowed.`}]});function Ee(e){let n=l=>({valid:!1,reason:`File name "${e}" ${l}.`});if(Ce(e))return n("contains unsafe characters");if(e.startsWith(" ")||e.endsWith(" "))return n("cannot start or end with spaces");if(e.endsWith("."))return n("cannot end with dots");let t=/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|$)/i,s=e.split("/").pop()||e;return t.test(s)?n("uses a reserved system name"):e.includes("..")?n("contains a path traversal pattern"):{valid:!0}}function Cr(e,n){let t=[],s=[],l=[];if(e.length===0){let d={file:"(no files)",message:"At least one file must be provided."};return t.push(d),{files:[],validFiles:[],errors:t,warnings:[],canDeploy:!1}}for(let d of e)if(z(d.name))return t.push({file:d.name,message:"Unbuilt project detected. Deploy your build output (dist/, build/, out/), not the project folder."}),{files:e.map(E=>({...E,status:R.VALIDATION_FAILED,statusMessage:"Unbuilt project detected"})),validFiles:[],errors:t,warnings:[],canDeploy:!1};if(e.length>n.maxFilesCount){let d={file:`(${e.length} files)`,message:`Too many files (${e.length}). Maximum ${n.maxFilesCount} files allowed.`};return t.push(d),{files:e.map(E=>({...E,status:R.VALIDATION_FAILED,statusMessage:d.message})),validFiles:[],errors:t,warnings:[],canDeploy:!1}}let p=0;for(let d of e){let E=R.READY,f="Ready for upload";if(d.status===R.PROCESSING_ERROR)E=R.VALIDATION_FAILED,f=d.statusMessage||`File "${d.name}" could not be read.`,t.push({file:d.name,message:f});else if(d.size===0){E=R.EXCLUDED,f=`File "${d.name}" is empty, so it is excluded.`,s.push({file:d.name,message:f}),l.push({...d,status:E,statusMessage:f});continue}else if(d.size<0)E=R.VALIDATION_FAILED,f=`File "${d.name}" reports a negative size.`,t.push({file:d.name,message:f});else if(!d.name||d.name.trim().length===0)E=R.VALIDATION_FAILED,f="File name cannot be empty.",t.push({file:d.name||"(empty)",message:f});else if(d.name.includes("\0"))E=R.VALIDATION_FAILED,f=`File name "${d.name}" contains invalid characters (null byte).`,t.push({file:d.name,message:f});else{let A={path:d.name,size:d.size,totalSize:p+d.size},N=ne(A,n);N?(E=R.VALIDATION_FAILED,f=N.sentence(A,n),t.push({file:N.name==="totalSize"?`(${e.length} files)`:d.name,message:f})):p=A.totalSize}l.push({...d,status:E,statusMessage:f})}t.length>0&&(l=l.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=t.length===0?l.filter(d=>d.status===R.READY):[],y=t.length===0;return{files:l,validFiles:h,errors:t,warnings:s,canDeploy:y}}function un(e){return e.filter(n=>n.status===R.READY)}function vr(e){return un(e).length>0}var Te=_(()=>{"use strict";D();Ae();D()});function st(e){return pn.test(e)}var cn,pn,at=_(()=>{"use strict";cn=["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^[Dd]esktop\\.ini$","@eaDir$"],pn=new RegExp(cn.join("|"))});function lt(e,n){if(!e||e.length===0)return[];if(!n?.allowUnbuilt&&e.find(s=>s&&z(s)))throw m.business("Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder");return e.filter(t=>{if(!t)return!1;let s=t.replace(/\\/g,"/").split("/").filter(Boolean);if(s.length===0)return!0;let l=s[s.length-1];if(st(l))return!1;for(let h of s)if(h!==".well-known"&&(h.startsWith(".")||h.length>255))return!1;let p=s.slice(0,-1);for(let h of p)if(dn.some(y=>h.toLowerCase()===y.toLowerCase()))return!1;return!0})}var dn,Se=_(()=>{"use strict";D();at();dn=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function ut(e,n){if(e.includes("\0")||e.includes("/../")||e.startsWith("../")||e.endsWith("/.."))throw m.business(`Security error: Unsafe file path "${e}" for file: ${n}`)}function ct(e,n){let t=ne(e,n);if(t)throw m.business(t.sentence(e,n))}var De=_(()=>{"use strict";D();Ae()});async function pt(e,n={},t){let s=!!(n.build||n.prerender),l=it(e.map(f=>f.path),{flatten:n.pathDetect!==!1}).map(f=>f.path),p=new Set(lt(l,{allowUnbuilt:s})),h=e.map((f,A)=>({source:f,deployPath:l[A]})).filter(({deployPath:f})=>p.has(f));if(h.length===0)return[];let y=s?null:fn(t),d=[],E=0;for(let{source:f,deployPath:A}of h){if(y&&ut(A,f.origin),f.size===0)continue;y&&(E+=f.size,ct({path:A,size:f.size,totalSize:E},y));let N=await f.read(),{md5:F}=await J(N);d.push({path:A,content:N,size:f.size,md5:F})}if(y&&d.length>y.maxFilesCount)throw m.business(`Too many files to deploy. Maximum allowed is ${y.maxFilesCount} files.`);return d}function fn(e){if(!e)throw m.config("Platform limits not provided. Deploy-mode validation requires the limits argument \u2014 pass `ship.getLimits()` result.");return e}var dt=_(()=>{"use strict";D();he();Se();Q();De()});var mt={};St(mt,{processFilesForBrowser:()=>ft});async function ft(e,n={},t){if(ot()!=="browser")throw m.business("processFilesForBrowser can only be called in a browser environment.");return pt(e.map(s=>({path:s.webkitRelativePath||s.name,origin:s.name,size:s.size,read:async()=>s})),n,t)}var Re=_(()=>{"use strict";D();dt();ge()});D();D();D();var j=class{constructor(){this.handlers=new Map}on(n,t){this.handlers.has(n)||this.handlers.set(n,new Set),this.handlers.get(n)?.add(t)}off(n,t){let s=this.handlers.get(n);s&&(s.delete(t),s.size===0&&this.handlers.delete(n))}emit(n,...t){let s=this.handlers.get(n);if(!s)return;let l=Array.from(s);for(let p of l)try{p(...t)}catch(h){s.delete(p),n!=="error"&&setTimeout(()=>{let y=h instanceof Error?h:new Error(String(h));this.emit("error",y,String(n))},0)}}};var zt=3e4,Xt=2,qt=300,jt=2e3,Yt=new Set([500,502,503,504]);function Wt(e,n){return new Promise((t,s)=>{if(n?.aborted){s(n.reason);return}let l=()=>{clearTimeout(h),n?.removeEventListener("abort",p)},p=()=>{l(),s(n?.reason)},h=setTimeout(()=>{l(),t()},e);n?.addEventListener("abort",p)})}var ze=3e5,Jt=3e5,Qt=ze+Jt,Y=class extends j{constructor(t){super();this.globalHeaders={};this.apiUrl=t.apiUrl||pe,this.getAuthHeadersCallback=t.getAuthHeaders,this.session=t.session??!1,this.caller=t.caller,this.timeout=t.timeout??zt,this.maxRetries=Math.max(0,t.maxRetries??Xt),this.fetch=t.fetch??globalThis.fetch.bind(globalThis),this.deploy={endpoint:t.deployEndpoint||T.DEPLOYMENTS,timeout:t.timeout??ze,buildTimeout:t.timeout??Qt}}setGlobalHeaders(t){this.globalHeaders=t}async executeRequest(t,s,l,p=this.timeout){for(let h=0;;h++)try{return await this.attemptOnce(t,s,l,p)}catch(y){let d=m.fromFetchError(y,l);if(h>=this.maxRetries||!this.isRetryable(d,s))throw this.emit("error",d,t),d;this.emit("retry",d,t,h+1);let E=Math.min(jt,qt*2**h);try{await Wt(Math.random()*E,s.signal)}catch(f){let A=m.fromFetchError(f,l);throw this.emit("error",A,t),A}}}isRetryable(t,s){if(s.signal?.aborted||t.isType(g.Maintenance)||t.isType(g.Cancelled)||!(t.isNetworkError()||t.status!==void 0&&Yt.has(t.status)))return!1;let p=(s.method??"GET").toUpperCase();return p==="GET"||p==="HEAD"?!0:p==="PUT"||p==="DELETE"?!1:this.hasIdempotencyKey(s.headers)}hasIdempotencyKey(t){if(!t)return!1;let s=v.HEADER.toLowerCase();return Object.keys(t).some(l=>l.toLowerCase()===s)}async attemptOnce(t,s,l,p=this.timeout){let h=()=>{};try{let y=await this.mergeHeaders(s.headers),d=this.createTimeoutSignal(s.signal,p);h=d.cleanup;let E={...s,headers:y,credentials:this.session&&!y.Authorization?"include":void 0,signal:d.signal};this.emit("request",t,E);let f=await this.fetch(t,E);if(h(),!f.ok)throw await m.fromHttpResponse(f,l);return this.emit("response",this.safeClone(f),t),{data:await this.parseResponse(this.safeClone(f)),status:f.status}}catch(y){throw h(),m.fromFetchError(y,l)}}async request(t,s,l,p){let{data:h}=await this.executeRequest(`${this.apiUrl}${t}`,s,l,p);return h}async requestWithStatus(t,s,l){return this.executeRequest(`${this.apiUrl}${t}`,s,l)}async mergeHeaders(t={}){return{...this.globalHeaders,...this.caller?{[M.HEADER]:this.caller}:{},...await this.getAuthHeadersCallback(),...t}}createTimeoutSignal(t,s=this.timeout){let l=new AbortController,p=setTimeout(()=>l.abort(new DOMException(`Timed out after ${s}ms`,"TimeoutError")),s),h=t?()=>l.abort(t.reason):void 0;return t&&h&&(t.addEventListener("abort",h),t.aborted&&l.abort(t.reason)),{signal:l.signal,cleanup:()=>{clearTimeout(p),t&&h&&t.removeEventListener("abort",h)}}}safeClone(t){try{return t.clone()}catch{return t}}async parseResponse(t){if(!(t.headers.get("Content-Length")==="0"||t.status===204))return t.json()}};D();D();async function Xe(e,n={}){let{labels:t,via:s,password:l,ttl:p,flags:h,captcha:y}=n,d=new FormData,E=[];for(let f of e){if(typeof f.content=="string"||f.content===null||f.content===void 0)throw m.file(`Unsupported file.content type: ${f.path}`,{filePath:f.path});if(!f.md5)throw m.file(`File missing md5 checksum: ${f.path}`,{filePath:f.path});d.append(I.FILES,new File([f.content],f.path,{type:"application/octet-stream"})),E.push(f.md5)}return d.append(I.CHECKSUMS,JSON.stringify(E)),t&&t.length>0&&d.append(I.LABELS,JSON.stringify(t)),s&&d.append(I.VIA,s),l&&d.append(I.PASSWORD,l),p!==void 0&&d.append(I.TTL,String(p)),h?.build&&d.append(I.BUILD,"true"),h?.prerender&&d.append(I.PRERENDER,"true"),h?.spa&&d.append(I.SPA,"true"),h?.buildCommand&&d.append(I.BUILD_COMMAND,h.buildCommand),h?.outputDir&&d.append(I.OUTPUT_DIR,h.outputDir),y&&d.append(I.CAPTCHA,y),d}D();Q();async function nn(){let e=JSON.stringify(Ue,null,2),n;typeof Buffer<"u"?n=Buffer.from(e,"utf-8"):n=new Blob([e],{type:"application/json"});let{md5:t}=await J(n);return{path:w,content:n,size:e.length,md5:t}}async function rn(e,n,t){let s=e.find(y=>y.path===X.INDEX_FILE||y.path===`/${X.INDEX_FILE}`);if(!s||s.size>X.MAX_INDEX_BYTES)return!1;let l;if(typeof Buffer<"u"&&Buffer.isBuffer(s.content))l=s.content.toString("utf-8");else if(typeof Blob<"u"&&s.content instanceof Blob)l=await s.content.text();else if(typeof File<"u"&&s.content instanceof File)l=await s.content.text();else return!1;let p={files:e.map(y=>y.path),index:l};return(await n.request(T.SPA_CHECK,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p),signal:t??null},"SPA check")).isSPA}async function Je(e,n,t){if(t.spaDetect===!1||t.spa||t.build||t.prerender||e.some(s=>s.path===w))return e;try{if(await rn(e,n,t.signal)){let l=await nn();return[...e,l]}}catch(s){if(t.signal?.aborted)throw s}return e}D();D();function B(e){if(e==null)return;if(e.length===0)return e;if(e.length>C.MAX_COUNT)throw m.validation(`Maximum ${C.MAX_COUNT} labels allowed`);let n=e.map((s,l)=>{if(typeof s!="string")throw m.validation(`Label at index ${l} must be a string`);let p=s.trim().toLowerCase();if(p.length<C.MIN_LENGTH)throw m.validation(`Labels must be at least ${C.MIN_LENGTH} characters long`);if(p.length>C.MAX_LENGTH)throw m.validation(`Labels must be no more than ${C.MAX_LENGTH} characters long`);if(!ke.test(p))throw m.validation(`Labels must start and end with alphanumeric characters, with optional separators (${C.SEPARATORS}) between segments`);return p}),t=[...new Set(n)];if(t.length!==n.length)throw m.validation("Duplicate labels are not allowed");return t}async function Qe(e){let n=e.find(l=>l.path===w||l.path===`/${w}`);if(!n)return;let t=n.content,s=typeof t.text=="function"?await t.text():n.content.toString("utf8");$e(s)}var Z={"Content-Type":"application/json"},on="sdk";function fe(e){let n=new URLSearchParams;e?.limit!==void 0&&n.set("limit",String(e.limit)),e?.cursor!==void 0&&n.set("cursor",e.cursor);let t=n.toString();return t?`?${t}`:""}function Ze(e){let{getApi:n,processInput:t}=e;return{upload:async(s,l={})=>{if(!t)throw m.config("processInput function is not provided.");let p=n(),h=await t(s,l),y=await Je(h,p,l);if(!y.length)throw m.business("No files to deploy");for(let O of y)if(!O.md5)throw m.file(`MD5 checksum missing for file: ${O.path}`,{filePath:O.path});de(l.password);let d=ce(l.ttl),E=Oe(l.idempotencyKey),f=B(l.labels);await Qe(y);let A=Ve(l.buildCommand),N=Ke(l.outputDir),F=l.build||l.prerender||l.spa?{build:l.build,prerender:l.prerender,spa:l.spa,buildCommand:A,outputDir:N}:void 0,re=await Xe(y,{labels:f,via:l.via??on,password:l.password,ttl:d,flags:F,captcha:l.captcha});return p.request(p.deploy.endpoint,{method:"POST",body:re,...E?{headers:{[v.HEADER]:E}}:{},signal:l.signal||null},"Deploy",l.build||l.prerender?p.deploy.buildTimeout:p.deploy.timeout)},list:async s=>n().request(`${T.DEPLOYMENTS}${fe(s)}`,{method:"GET"},"List deployments"),get:async s=>n().request(T.DEPLOYMENT(encodeURIComponent(s)),{method:"GET"},"Get deployment"),set:async(s,l)=>n().request(T.DEPLOYMENT(encodeURIComponent(s)),{method:"PATCH",headers:Z,body:JSON.stringify({labels:B(l.labels)})},"Update deployment labels"),delete:async s=>n().request(T.DEPLOYMENT(encodeURIComponent(s)),{method:"DELETE"},"Delete deployment")}}function et(e){let{getApi:n}=e;return{set:async(t,s={})=>{let l=B(s.labels),p={};s.deployment&&(p.deployment=s.deployment),l!==void 0&&(p.labels=l);let{data:h,status:y}=await n().requestWithStatus(T.DOMAIN(encodeURIComponent(t)),{method:"PUT",headers:Z,body:JSON.stringify(p)},"Set domain");return{...h,isCreate:y===201}},list:async t=>n().request(`${T.DOMAINS}${fe(t)}`,{method:"GET"},"List domains"),get:async t=>n().request(T.DOMAIN(encodeURIComponent(t)),{method:"GET"},"Get domain"),delete:async t=>n().request(T.DOMAIN(encodeURIComponent(t)),{method:"DELETE"},"Delete domain"),verify:async t=>n().request(T.DOMAIN_VERIFY(encodeURIComponent(t)),{method:"POST"},"Verify domain"),validate:async t=>n().request(T.DOMAINS_VALIDATE,{method:"POST",headers:Z,body:JSON.stringify({domain:t})},"Validate domain"),dns:async t=>n().request(T.DOMAIN_DNS(encodeURIComponent(t)),{method:"GET"},"Get domain DNS"),records:async t=>n().request(T.DOMAIN_RECORDS(encodeURIComponent(t)),{method:"GET"},"Get domain records"),share:async t=>n().request(T.DOMAIN_SHARE(encodeURIComponent(t)),{method:"GET"},"Get domain share")}}function tt(e){let{getApi:n}=e;return{get:async()=>n().request(T.ACCOUNT,{method:"GET"},"Get account")}}function nt(e){let{getApi:n}=e;return{create:async(t={})=>{let s=ce(t.ttl),l=B(t.labels),p={};return s!==void 0&&(p.ttl=s),l!==void 0&&(p.labels=l),n().request(T.TOKENS,{method:"POST",headers:Z,body:JSON.stringify(p)},"Create token")},list:async t=>n().request(`${T.TOKENS}${fe(t)}`,{method:"GET"},"List tokens"),get:async t=>n().request(T.TOKEN(encodeURIComponent(t)),{method:"GET"},"Get token"),delete:async t=>n().request(T.TOKEN(encodeURIComponent(t)),{method:"DELETE"},"Delete token")}}var ee=class{constructor(n={}){this.credential=null;if(n={...n,apiUrl:n.apiUrl||void 0,token:n.token||void 0,caller:n.caller||void 0},this.clientOptions=n,n.caller!==void 0&&Be(n.caller),n.token&&n.session)throw m.config("Provide either `token` or `session`, not both.");typeof n.token=="string"?(ue(n.token),this.credential=n.token):n.token&&(this.credential=n.token),this.http=new Y({...n,getAuthHeaders:()=>this.getAuthHeaders()});let t={getApi:()=>this.http};this.deployments=Ze({...t,processInput:async(s,l)=>this.processInput(s,l,await this.getLimits({signal:l.signal}))}),this.domains=et(t),this.account=tt(t),this.tokens=nt(t)}async ping(){return this.http.request(T.PING,{method:"GET"},"Ping")}async deploy(n,t){return this.deployments.upload(n,t)}async whoami(){return this.account.get()}async getLimits(n={}){return this.http.request(T.LIMITS,{method:"GET",signal:n.signal??null},"Get limits")}on(n,t){this.http.on(n,t)}off(n,t){this.http.off(n,t)}setHeaders(n){this.http.setGlobalHeaders(n)}clearHeaders(){this.http.setGlobalHeaders({})}setToken(n){if(this.clientOptions.session)throw m.config("Provide either `token` or `session`, not both.");if(typeof n=="string"){if(!n)throw m.business("Invalid token provided. Token must be a non-empty string.");ue(n),this.credential=n;return}if(typeof n!="function")throw m.business("Invalid token provided. Token must be a non-empty string or a provider function.");this.credential=n}async getAuthHeaders(){if(this.credential===null)return{};let n=typeof this.credential=="function"?await this.credential():this.credential;if(!n)throw m.authentication("Token provider returned no token.");if(typeof n!="string")throw m.authentication("Token provider returned a non-string value.");return{Authorization:`Bearer ${n}`}}};D();D();he();ge();Te();Se();Q();De();function Kr(e,n,t,s=!0){let l=e===1?n:t;return s?`${e} ${l}`:l}Re();var be=class extends ee{async deploy(n,t){return super.deploy(n,t)}async processInput(n,t,s){if(!Array.isArray(n)||!n.every(p=>p instanceof File))throw m.business("Invalid input type for browser environment. Expected File[].");if(n.length===0)throw m.business("No files to deploy.");let{processFilesForBrowser:l}=await Promise.resolve().then(()=>(Re(),mt));return l(n,t,s)}},yi=be;export{Ln as ACCOUNT_HEADER,ve as API_KEY,T as API_PATHS,_n as AUTH_BASE_PATH,Tn as AccountPlan,Sn as AccountRefusal,Y as ApiHttp,oe as AuthMethod,U as BUILD_SETTINGS,M as CALLER,pe as DEFAULT_API,w as DEPLOYMENT_CONFIG_FILENAME,I as DEPLOY_FIELDS,bn as DEPLOY_FILE_GRAMMAR,Fe as DEPLOY_TOKEN,hn as DeploymentStatus,Rt as DeploymentVia,yn as DomainStatus,gn as DomainVerification,g as ErrorType,R as FILE_VALIDATION_STATUS,R as FileValidationStatus,v as IDEMPOTENCY_KEY_CONSTRAINTS,dn as JUNK_DIRECTORIES,C as LABEL_CONSTRAINTS,ke as LABEL_PATTERN,Bn as MY_API_KEY_URL,Me as OAUTH_TOKEN,On as OAuthScope,K as PASSWORD_CONSTRAINTS,Hn as PUBLIC_DEPLOYMENT_TTL_SECONDS,Mt as SECTIONS,En as SETUP_TROUBLESHOOTING_ANCHOR,Un as SHIP_ENV,$n as SHIP_VIA_ENV,Nn as SIGN_IN_RETURN_PARAM,X as SPA_CHECK_CONSTRAINTS,Ue as SPA_DEFAULT_CONFIG,be as Ship,m as ShipError,V as TTL_CONSTRAINTS,P as TokenKind,xt as UNBUILT_PROJECT_MARKERS,Ot as UNSAFE_FILENAME_CHARS,kn as USER_VISIBLE_EVENTS,In as WEB_FILE_ACCEPT,_r as __setTestEnvironment,Fn as accountOfPath,vr as allValidFilesReady,$e as assertShipJsonSyntax,vn as billingReturnOf,J as calculateMD5,Pt as classifyToken,Bt as consolePaths,tt as createAccountResource,Ze as createDeploymentResource,et as createDomainResource,nt as createTokenResource,yi as default,jn as deserializeLabels,Cn as doors,Mn as errandOf,Kn as extractSubdomain,lt as filterJunk,Kt as formatDuration,$ as formatFileSize,Gn as formatTimeRemaining,zn as generateDeploymentUrl,Xn as generateDomainUrl,ot as getENV,un as getValidFiles,z as hasUnbuiltMarker,Ce as hasUnsafeChars,Pe as isBlockedExtension,Gt as isClaimPath,Vn as isCustomDomain,Pn as isDeployment,kt as isInvitationPath,Ge as isPlatformDomain,xe as isShipError,Vt as isUpgradePath,An as normalizeVia,it as optimizeDeployPaths,Dn as personName,Rn as personShortName,Kr as pluralize,ft as processFilesForBrowser,wn as readBearerValue,qn as serializeLabels,Ct as validateApiKey,xn as validateApiUrl,Ve as validateBuildCommand,Be as validateCaller,ct as validateDeployFile,ut as validateDeployPath,vt as validateDeployToken,Ee as validateFileName,Cr as validateFiles,Oe as validateIdempotencyKey,Ft as validateOAuthToken,Ke as validateOutputDir,de as validatePassword,ue as validateToken,ce as validateTtl};
1
+ var yt=Object.create;var H=Object.defineProperty;var gt=Object.getOwnPropertyDescriptor;var Et=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,Tt=Object.prototype.hasOwnProperty;var St=(e,n,t)=>n in e?H(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var _=(e,n)=>()=>(e&&(n=e(e=0)),n);var Ne=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),Dt=(e,n)=>{for(var t in n)H(e,t,{get:n[t],enumerable:!0})},Rt=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of Et(n))!Tt.call(e,l)&&l!==t&&H(e,l,{get:()=>n[l],enumerable:!(o=gt(n,l))||o.enumerable});return e};var G=(e,n,t)=>(t=e!=null?yt(At(e)):{},Rt(n||!e||!e.__esModule?H(t,"default",{value:e,enumerable:!0}):t,e));var k=(e,n,t)=>St(e,typeof n!="symbol"?n+"":n,t);function Tn(e){if(!e||typeof e!="string")return;let n=e.trim().toLowerCase();return Object.values(bt).includes(n)?n:void 0}function Oe(e){if(e==null)return;if(typeof e!="string")throw m.validation("Idempotency key must be a string.");let n=e.trim();if(!n)throw m.validation("Idempotency key must not be empty.");if(n.length>v.MAX_LENGTH)throw m.validation(`Idempotency key must be at most ${v.MAX_LENGTH} characters.`);return n}function Rn(e){return e.name?.trim()||e.email}function bn(e){return e.name?.trim().split(" ")[0]||e.email}function Lt(e){let n=e.code;return n==="ERR_INVALID_URL"?!1:typeof n=="string"?!0:e instanceof TypeError?!/\burl\b/i.test(e.message):!1}function Pe(e){return e!==null&&typeof e=="object"&&"name"in e&&e.name==="ShipError"&&"status"in e}function wt(e){let n=e.replace(/\\/g,"/").split("/").pop()??"",t=n.lastIndexOf(".");return t<=0||t===n.length-1?null:n.slice(t+1).toLowerCase()}function Ce(e,n){let t=wt(e);return t===null?!1:Array.isArray(n)?n.includes(t):n.has(t)}function ve(e){return Ot.test(e)}function z(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(t=>Pt.has(t))}function Ct(e){return e.startsWith(Fe.PREFIX)?P.API_KEY:e.startsWith(Me.PREFIX)?P.DEPLOY_TOKEN:e.startsWith(Ue.PREFIX)?P.OAUTH:P.OPAQUE}function xn(e){return e.slice(0,ae.length).toLowerCase()!==ae?null:e.slice(ae.length)||null}function Be(e){let n=e.charCodeAt(0)===65279?e.slice(1):e,t;try{t=JSON.parse(n)}catch(o){throw m.config(`invalid JSON format in config: ${o.message}`,{filePath:w})}if(t===null||typeof t!="object"||Array.isArray(t))throw m.config(`${w} must contain a JSON object`,{filePath:w})}function ue(e,n,t){if(!e.startsWith(n.PREFIX))throw m.validation(`${t} must start with "${n.PREFIX}"`);if(e.length!==n.TOTAL_LENGTH)throw m.validation(`${t} must be ${n.TOTAL_LENGTH} characters total (${n.PREFIX} + ${n.HEX_LENGTH} hex chars)`);let o=e.slice(n.PREFIX.length);if(!new RegExp(`^[a-f0-9]{${n.HEX_LENGTH}}$`,"i").test(o))throw m.validation(`${t} must contain ${n.HEX_LENGTH} hexadecimal characters after "${n.PREFIX}" prefix`)}function vt(e){ue(e,Fe,"API key")}function Ft(e){ue(e,Me,"Deploy token")}function Mt(e){ue(e,Ue,"OAuth access token")}function ce(e){switch(Ct(e)){case P.API_KEY:vt(e);return;case P.DEPLOY_TOKEN:Ft(e);return;case P.OAUTH:Mt(e);return;case P.OPAQUE:if(!e)throw m.validation("Token must be a non-empty string")}}function He(e){if(!e||e.length>M.MAX_LENGTH||!M.PATTERN.test(e))throw m.validation(`Caller must be 1-${M.MAX_LENGTH} characters: letters, digits, dots, underscores, or hyphens`)}function Pn(e){try{let n=new URL(e);if(!["http:","https:"].includes(n.protocol))throw m.validation("API URL must use http:// or https:// protocol");if(n.pathname!=="/"&&n.pathname!=="")throw m.validation("API URL must not contain a path");if(n.search||n.hash)throw m.validation("API URL must not contain query parameters or fragments")}catch(n){throw Pe(n)?n:m.validation("API URL must be a valid URL")}}function Cn(e){return/^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(e)}function pe(e){if(e!=null){if(typeof e!="number"||!Number.isFinite(e))throw m.validation("TTL must be a number of seconds");if(!Number.isInteger(e))throw m.validation("TTL must be a whole number of seconds");if(e<K.MIN_SECONDS||e>K.MAX_SECONDS)throw m.validation(`TTL must be between ${K.MIN_SECONDS} and ${K.MAX_SECONDS} seconds`);return e}}function Ht(e){let n=e?`/${e}`:"",t=o=>`${n}${o}`;return{dashboard:()=>n||"/",newSite:()=>t("/new"),deployments:Object.assign(()=>t("/deployments"),{upload:()=>t("/deployments/upload")}),domains:Object.assign(()=>t("/domains"),{connect:o=>t(`/domains/${o}/connect`),deployment:o=>t(`/domains/${o}/deployment`)}),settings:o=>t(o?`/settings#${o}`:"/settings"),settingsAfterBilling:()=>t(`/settings?${Le("portal")}`),upgrade:o=>t(o?`/upgrade/${o}`:"/upgrade"),success:()=>t("/success"),successAfterCheckout:()=>t(`/success?${Le("checkout")}`),apiKey:()=>t("/api-key")}}function Fn(e){let n=new URLSearchParams(e);for(let[t,[o,l]]of Object.entries(Ge))if(n.get(o)===l)return t;return null}function q(e){let n=e.split(/[?#]/)[0].toLowerCase(),[t="",o=""]=n.split("/").filter(Boolean);return Gt(t)?{kind:"door",door:t}:t===Bt?{kind:"admin"}:t===""||xe(t)?{kind:"account",account:null,section:t===""?null:t}:{kind:"account",account:t,section:xe(o)?o:null}}function Mn(e){let n=q(e);return n.kind==="account"?n.account:null}function Un(e){return kt(e)?"claim":Kt(e)?"invite":Vt(e)?"upgrade":null}function zt(e){let n=Math.round(e/60);if(!(n>=1))return"less than a minute";if(n<120)return le(n,"minute");let t=Math.round(e/3600);return t<48?le(t,"hour"):le(Math.round(e/86400),"day")}function kn(e,n=Date.now()/1e3){let t=e-n;return t>0?zt(t):null}function le(e,n){return`${e} ${n}${e===1?"":"s"}`}function $(e,n=1){if(e===0)return"0 Bytes";let t=1024,o=["Bytes","KB","MB","GB"],l=Math.floor(Math.log(e)/Math.log(t));return`${Number.parseFloat((e/t**l).toFixed(n))} ${o[l]}`}function ke(e,n){return e.endsWith(`.${n}`)}function Vn(e,n){return!ke(e,n)}function zn(e,n){return ke(e,n)?e.slice(0,-(n.length+1)):null}function Xn(e){return`https://${e}`}function qn(e){return`https://${e}`}function jn(e){return!e||e.length===0?null:JSON.stringify(e)}function Yn(e){if(!e)return[];try{let n=JSON.parse(e);return Array.isArray(n)?n:[]}catch{return[]}}function Ve(e){if(e==null||e==="")return;if(typeof e!="string")throw m.validation("Build command must be a string");let n=e.trim();if(n.length===0||n.length>U.COMMAND_MAX_LENGTH)throw m.validation(`Build command must be between 1 and ${U.COMMAND_MAX_LENGTH} characters`);if(/[\x00-\x1f\x7f]/.test(n))throw m.validation("Build command must be a single line");return n}function ze(e){if(e==null||e==="")return;if(typeof e!="string")throw m.validation("Output folder must be a string");let n=e.trim().replace(/\/+$/,"");if(n.length===0||n.length>U.OUTPUT_DIR_MAX_LENGTH)throw m.validation(`Output folder must be between 1 and ${U.OUTPUT_DIR_MAX_LENGTH} characters`);if(!U.OUTPUT_DIR_PATTERN.test(n)||n.split("/").some(t=>t===".."||t==="."))throw m.validation("Output folder must be a relative path inside the project, like dist or dist/site");return n}function fe(e){if(e==null)return;if(typeof e!="string")throw m.validation("Password must be a string");let n=e.trim();if(n.length<V.MIN_LENGTH||n.length>V.MAX_LENGTH)throw m.validation(`Password must be between ${V.MIN_LENGTH} and ${V.MAX_LENGTH} characters`);return n}var yn,bt,gn,En,An,v,Sn,Dn,T,I,In,g,It,oe,_t,Nt,m,xt,_n,Ot,Pt,Nn,Ln,se,Fe,Me,Ue,M,wn,P,ae,On,w,$e,X,K,Ut,$t,Bt,Ge,Le,we,vn,Gt,xe,kt,Kt,Vt,de,$n,Bn,Hn,Gn,Kn,R,C,Ke,U,V,D=_(()=>{"use strict";yn={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},bt={WEB:"web",SDK:"sdk",CLI:"cli",MCP:"mcp",GIT:"git",N8N:"n8n",GPT:"gpt",VSC:"vsc",CLD:"cld",CRS:"crs",GMN:"gmn",API:"api"},gn={LIVE:"live",UNLINKED:"unlinked",UNVERIFIED:"unverified",PAUSED:"paused"},En={PENDING:"pending",PARTIAL:"partial",VERIFIED:"verified"},An="troubleshooting",v={HEADER:"Idempotency-Key",MAX_LENGTH:256,WINDOW_SECONDS:1440*60};Sn={FREE:"free",PRO:"pro",TEAM:"team",SCALE:"scale",SPONSORED:"sponsored"},Dn={PAUSED:"paused",UNKNOWN:"unknown"};T={DEPLOYMENTS:"/deployments",DEPLOYMENT:e=>`/deployments/${e}`,DEPLOYMENT_CONFIG:e=>`/deployments/${e}/config`,DOMAINS:"/domains",DOMAIN:e=>`/domains/${e}`,DOMAIN_VERIFY:e=>`/domains/${e}/verify`,DOMAIN_DNS:e=>`/domains/${e}/dns`,DOMAIN_RECORDS:e=>`/domains/${e}/records`,DOMAIN_SHARE:e=>`/domains/${e}/share`,DOMAIN_PROPAGATION:e=>`/domains/${e}/propagation`,DOMAINS_VALIDATE:"/domains/validate",TOKENS:"/tokens",TOKEN:e=>`/tokens/${e}`,ACCOUNT:"/account",ACCOUNT_KEY:"/account/key",ACCOUNT_CLAIM:"/account/claim",ACTIVITIES:"/activities",LABELS:"/labels",LIMITS:"/limits",PLANS:"/plans",PING:"/ping",SETUP:"/setup",SPA_CHECK:"/spa-check",UPLOAD:"/upload"},I={FILES:"files[]",CHECKSUMS:"checksums",LABELS:"labels",VIA:"via",PASSWORD:"password",TTL:"ttl",BUILD:"build",PRERENDER:"prerender",SPA:"spa",BUILD_COMMAND:"buildCommand",OUTPUT_DIR:"outputDir",CAPTCHA:"captcha"},In={PATH:"path",CONTENT:"content",ENCODING:"encoding",DEFAULT_ENCODING:"utf-8",ENCODINGS:["utf-8","base64"]},g={Validation:"validation_failed",NotFound:"not_found",Forbidden:"forbidden",RateLimit:"rate_limit_exceeded",Authentication:"authentication_failed",Business:"business_logic_error",Api:"internal_server_error",Maintenance:"maintenance",Build:"build_failed",Network:"network_error",Timeout:"timeout_error",Cancelled:"operation_cancelled",File:"file_error",Config:"config_error"},It=new Set([g.Network,g.Timeout,g.Cancelled,g.File,g.Config]),oe={client:new Set([g.Build,g.Business,g.Cancelled,g.Config,g.File,g.Forbidden,g.NotFound,g.RateLimit,g.Validation]),network:new Set([g.Network,g.Timeout]),auth:new Set([g.Authentication])},_t=new Set(Object.values(g).filter(e=>!It.has(e))),Nt=200;m=class e extends Error{constructor(t,o,l,p){super(o);k(this,"type");k(this,"status");k(this,"details");this.type=t,this.status=l,this.details=p,this.name="ShipError"}toResponse(){let t=this.details,o=this.type===g.Authentication&&t?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:o}}static async fromHttpResponse(t,o){let l,p,h;try{if(t.headers.get("content-type")?.includes("application/json")){let f=await t.json();if(f&&typeof f=="object"){let A=f;typeof A.message=="string"?l=A.message:typeof A.error=="string"&&(l=A.error),p=A.details,typeof A.error=="string"&&_t.has(A.error)&&(h=A.error)}}else{let f=(await t.text()).trim();f&&!f.startsWith("<")&&f.length<=Nt&&(l=f)}}catch{}let y=t.headers.get("retry-after");if(y!==null){let E=y.trim(),f=/^\d+$/.test(E)?Number(E):Math.ceil((Date.parse(E)-Date.now())/1e3);if(Number.isFinite(f)&&f>=0){let A=p&&typeof p=="object"?p:{};A.retryAfter===void 0&&(p={...A,retryAfter:f})}}l=l||`${o||"Request"} failed with status ${t.status}`;let d=h??(t.status===401?g.Authentication:t.status===403?g.Forbidden:t.status===429?g.RateLimit:g.Api);return new e(d,l,t.status,p)}static fromFetchError(t,o){if(Pe(t))return t;let l=o||"Request",p=t?.name;return p==="AbortError"?e.cancelled(`${l} was cancelled`):p==="TimeoutError"?e.timeout(`${l} timed out`,{cause:t}):t instanceof Error?Lt(t)?e.network(`${l} failed: ${t.message}`,{cause:t}):new e(g.Api,`${l} failed: ${t.message}`):new e(g.Api,`${l} failed: Unknown error`)}static validation(t,o){return new e(g.Validation,t,400,o)}static notFound(t,o){let l=o?`${t} ${o} not found`:`${t} not found`;return new e(g.NotFound,l,404)}static forbidden(t,o){return new e(g.Forbidden,t,403,o)}static rateLimit(t="Too many requests",o){return new e(g.RateLimit,t,429,o)}static authentication(t="Authentication required",o){return new e(g.Authentication,t,401,o)}static business(t,o=400,l){return new e(g.Business,t,o,l)}static network(t,o){return new e(g.Network,t,void 0,o)}static timeout(t,o){return new e(g.Timeout,t,void 0,o)}static cancelled(t,o){return new e(g.Cancelled,t,void 0,o)}static file(t,o){return new e(g.File,t,void 0,o)}static config(t,o){return new e(g.Config,t,void 0,o)}static api(t,o=500,l){return new e(g.Api,t,o,l)}static maintenance(t,o){return new e(g.Maintenance,t,503,o)}static build(t,o){return new e(g.Build,t,422,o)}isClientError(){return oe.client.has(this.type)?!0:this.status!==void 0&&this.status>=400&&this.status<500}isNetworkError(){return oe.network.has(this.type)}isAuthError(){return oe.auth.has(this.type)}isType(t){return this.type===t}};xt=["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"],_n=xt.map(e=>`.${e}`).join(","),Ot=/[\x00-\x1f\x7f#?%\\<>"]/;Pt=new Set(["node_modules","package.json"]);Nn="/auth",Ln="signing-in",se={SESSION:"session",API_KEY:"apiKey",TOKEN:"token",AGENT:"agent",OAUTH:"oauth",SYSTEM:"system"},Fe={PREFIX:"ship-",HEX_LENGTH:32,TOTAL_LENGTH:37,HINT_LENGTH:4},Me={PREFIX:"deploy-",HEX_LENGTH:32,TOTAL_LENGTH:39},Ue={PREFIX:"oauth-",HEX_LENGTH:32,TOTAL_LENGTH:38},M={HEADER:"X-Caller",MAX_LENGTH:128,PATTERN:/^[a-zA-Z0-9._-]+$/},wn="X-Account",P={API_KEY:se.API_KEY,DEPLOY_TOKEN:se.TOKEN,OAUTH:se.OAUTH,OPAQUE:"opaque"};ae="bearer ";On={ACCOUNT_READ:"account:read",DEPLOYMENTS_READ:"deployments:read",DEPLOYMENTS_WRITE:"deployments:write",DOMAINS_READ:"domains:read",DOMAINS_WRITE:"domains:write"},w="ship.json",$e={rewrites:[{source:"/(.*)",destination:"/index.html"}]},X={INDEX_FILE:"index.html",MAX_INDEX_BYTES:100*1024};K={MIN_SECONDS:1,MAX_SECONDS:365*24*60*60};Ut={new:{owner:!1},deployments:{owner:!1},domains:{owner:!1},settings:{owner:!1},upgrade:{owner:!0},success:{owner:!0},"api-key":{owner:!0}},$t=["login","register","logout","invitations","claim","consent"],Bt="admin",Ge={checkout:["upgrading","true"],portal:["billing","returned"]},Le=e=>Ge[e].join("="),we=(e,n)=>n?`${e}?next=${encodeURIComponent(n)}`:e;vn={login:e=>we("/login",e),register:e=>we("/register",e),logout:()=>"/logout",invitation:e=>`/invitations/${e}`,claim:e=>`/claim/${e}`,consent:()=>"/consent"};Gt=e=>$t.includes(e),xe=e=>Object.hasOwn(Ut,e);kt=e=>{let n=q(e);return n.kind==="door"&&n.door==="claim"},Kt=e=>{let n=q(e);return n.kind==="door"&&n.door==="invitations"},Vt=e=>{let n=q(e);return n.kind==="account"&&n.section==="upgrade"};de="https://api.shipstatic.com",$n={TOKEN:"SHIP_TOKEN",API_URL:"SHIP_API_URL"},Bn="SHIP_VIA",Hn=`https://my.shipstatic.com${Ht().apiKey()}`,Gn=4320*60;Kn=["account.create","account.update","account.delete","account.key.generate","account.plan.transition","deployment.create","deployment.update","deployment.delete","deployment.claim","domain.create","domain.update","domain.delete","domain.verify","token.create","token.consume","token.delete","member.join","member.leave","consent.grant"],R={PENDING:"pending",PROCESSING_ERROR:"processing_error",EXCLUDED:"excluded",VALIDATION_FAILED:"validation_failed",READY:"ready"};C={MIN_LENGTH:3,MAX_LENGTH:25,MAX_COUNT:10,SEPARATORS:"._-"},Ke=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;U={COMMAND_MAX_LENGTH:200,OUTPUT_DIR_MAX_LENGTH:100,OUTPUT_DIR_PATTERN:/^[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/};V={MIN_LENGTH:6,MAX_LENGTH:128}});var We=Ne((je,Ye)=>{"use strict";(function(e){if(typeof je=="object")Ye.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var n;try{n=window}catch{n=self}n.SparkMD5=e()}})(function(e){"use strict";var n=function(c,u){return c+u&4294967295},t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function o(c,u,i,r,a,s){return u=n(n(u,c),n(r,s)),n(u<<a|u>>>32-a,i)}function l(c,u){var i=c[0],r=c[1],a=c[2],s=c[3];i+=(r&a|~r&s)+u[0]-680876936|0,i=(i<<7|i>>>25)+r|0,s+=(i&r|~i&a)+u[1]-389564586|0,s=(s<<12|s>>>20)+i|0,a+=(s&i|~s&r)+u[2]+606105819|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&i)+u[3]-1044525330|0,r=(r<<22|r>>>10)+a|0,i+=(r&a|~r&s)+u[4]-176418897|0,i=(i<<7|i>>>25)+r|0,s+=(i&r|~i&a)+u[5]+1200080426|0,s=(s<<12|s>>>20)+i|0,a+=(s&i|~s&r)+u[6]-1473231341|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&i)+u[7]-45705983|0,r=(r<<22|r>>>10)+a|0,i+=(r&a|~r&s)+u[8]+1770035416|0,i=(i<<7|i>>>25)+r|0,s+=(i&r|~i&a)+u[9]-1958414417|0,s=(s<<12|s>>>20)+i|0,a+=(s&i|~s&r)+u[10]-42063|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&i)+u[11]-1990404162|0,r=(r<<22|r>>>10)+a|0,i+=(r&a|~r&s)+u[12]+1804603682|0,i=(i<<7|i>>>25)+r|0,s+=(i&r|~i&a)+u[13]-40341101|0,s=(s<<12|s>>>20)+i|0,a+=(s&i|~s&r)+u[14]-1502002290|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&i)+u[15]+1236535329|0,r=(r<<22|r>>>10)+a|0,i+=(r&s|a&~s)+u[1]-165796510|0,i=(i<<5|i>>>27)+r|0,s+=(i&a|r&~a)+u[6]-1069501632|0,s=(s<<9|s>>>23)+i|0,a+=(s&r|i&~r)+u[11]+643717713|0,a=(a<<14|a>>>18)+s|0,r+=(a&i|s&~i)+u[0]-373897302|0,r=(r<<20|r>>>12)+a|0,i+=(r&s|a&~s)+u[5]-701558691|0,i=(i<<5|i>>>27)+r|0,s+=(i&a|r&~a)+u[10]+38016083|0,s=(s<<9|s>>>23)+i|0,a+=(s&r|i&~r)+u[15]-660478335|0,a=(a<<14|a>>>18)+s|0,r+=(a&i|s&~i)+u[4]-405537848|0,r=(r<<20|r>>>12)+a|0,i+=(r&s|a&~s)+u[9]+568446438|0,i=(i<<5|i>>>27)+r|0,s+=(i&a|r&~a)+u[14]-1019803690|0,s=(s<<9|s>>>23)+i|0,a+=(s&r|i&~r)+u[3]-187363961|0,a=(a<<14|a>>>18)+s|0,r+=(a&i|s&~i)+u[8]+1163531501|0,r=(r<<20|r>>>12)+a|0,i+=(r&s|a&~s)+u[13]-1444681467|0,i=(i<<5|i>>>27)+r|0,s+=(i&a|r&~a)+u[2]-51403784|0,s=(s<<9|s>>>23)+i|0,a+=(s&r|i&~r)+u[7]+1735328473|0,a=(a<<14|a>>>18)+s|0,r+=(a&i|s&~i)+u[12]-1926607734|0,r=(r<<20|r>>>12)+a|0,i+=(r^a^s)+u[5]-378558|0,i=(i<<4|i>>>28)+r|0,s+=(i^r^a)+u[8]-2022574463|0,s=(s<<11|s>>>21)+i|0,a+=(s^i^r)+u[11]+1839030562|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^i)+u[14]-35309556|0,r=(r<<23|r>>>9)+a|0,i+=(r^a^s)+u[1]-1530992060|0,i=(i<<4|i>>>28)+r|0,s+=(i^r^a)+u[4]+1272893353|0,s=(s<<11|s>>>21)+i|0,a+=(s^i^r)+u[7]-155497632|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^i)+u[10]-1094730640|0,r=(r<<23|r>>>9)+a|0,i+=(r^a^s)+u[13]+681279174|0,i=(i<<4|i>>>28)+r|0,s+=(i^r^a)+u[0]-358537222|0,s=(s<<11|s>>>21)+i|0,a+=(s^i^r)+u[3]-722521979|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^i)+u[6]+76029189|0,r=(r<<23|r>>>9)+a|0,i+=(r^a^s)+u[9]-640364487|0,i=(i<<4|i>>>28)+r|0,s+=(i^r^a)+u[12]-421815835|0,s=(s<<11|s>>>21)+i|0,a+=(s^i^r)+u[15]+530742520|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^i)+u[2]-995338651|0,r=(r<<23|r>>>9)+a|0,i+=(a^(r|~s))+u[0]-198630844|0,i=(i<<6|i>>>26)+r|0,s+=(r^(i|~a))+u[7]+1126891415|0,s=(s<<10|s>>>22)+i|0,a+=(i^(s|~r))+u[14]-1416354905|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~i))+u[5]-57434055|0,r=(r<<21|r>>>11)+a|0,i+=(a^(r|~s))+u[12]+1700485571|0,i=(i<<6|i>>>26)+r|0,s+=(r^(i|~a))+u[3]-1894986606|0,s=(s<<10|s>>>22)+i|0,a+=(i^(s|~r))+u[10]-1051523|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~i))+u[1]-2054922799|0,r=(r<<21|r>>>11)+a|0,i+=(a^(r|~s))+u[8]+1873313359|0,i=(i<<6|i>>>26)+r|0,s+=(r^(i|~a))+u[15]-30611744|0,s=(s<<10|s>>>22)+i|0,a+=(i^(s|~r))+u[6]-1560198380|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~i))+u[13]+1309151649|0,r=(r<<21|r>>>11)+a|0,i+=(a^(r|~s))+u[4]-145523070|0,i=(i<<6|i>>>26)+r|0,s+=(r^(i|~a))+u[11]-1120210379|0,s=(s<<10|s>>>22)+i|0,a+=(i^(s|~r))+u[2]+718787259|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~i))+u[9]-343485551|0,r=(r<<21|r>>>11)+a|0,c[0]=i+c[0]|0,c[1]=r+c[1]|0,c[2]=a+c[2]|0,c[3]=s+c[3]|0}function p(c){var u=[],i;for(i=0;i<64;i+=4)u[i>>2]=c.charCodeAt(i)+(c.charCodeAt(i+1)<<8)+(c.charCodeAt(i+2)<<16)+(c.charCodeAt(i+3)<<24);return u}function h(c){var u=[],i;for(i=0;i<64;i+=4)u[i>>2]=c[i]+(c[i+1]<<8)+(c[i+2]<<16)+(c[i+3]<<24);return u}function y(c){var u=c.length,i=[1732584193,-271733879,-1732584194,271733878],r,a,s,b,L,O;for(r=64;r<=u;r+=64)l(i,p(c.substring(r-64,r)));for(c=c.substring(r-64),a=c.length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<a;r+=1)s[r>>2]|=c.charCodeAt(r)<<(r%4<<3);if(s[r>>2]|=128<<(r%4<<3),r>55)for(l(i,s),r=0;r<16;r+=1)s[r]=0;return b=u*8,b=b.toString(16).match(/(.*?)(.{0,8})$/),L=parseInt(b[2],16),O=parseInt(b[1],16)||0,s[14]=L,s[15]=O,l(i,s),i}function d(c){var u=c.length,i=[1732584193,-271733879,-1732584194,271733878],r,a,s,b,L,O;for(r=64;r<=u;r+=64)l(i,h(c.subarray(r-64,r)));for(c=r-64<u?c.subarray(r-64):new Uint8Array(0),a=c.length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<a;r+=1)s[r>>2]|=c[r]<<(r%4<<3);if(s[r>>2]|=128<<(r%4<<3),r>55)for(l(i,s),r=0;r<16;r+=1)s[r]=0;return b=u*8,b=b.toString(16).match(/(.*?)(.{0,8})$/),L=parseInt(b[2],16),O=parseInt(b[1],16)||0,s[14]=L,s[15]=O,l(i,s),i}function E(c){var u="",i;for(i=0;i<4;i+=1)u+=t[c>>i*8+4&15]+t[c>>i*8&15];return u}function f(c){var u;for(u=0;u<c.length;u+=1)c[u]=E(c[u]);return c.join("")}f(y("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(n=function(c,u){var i=(c&65535)+(u&65535),r=(c>>16)+(u>>16)+(i>>16);return r<<16|i&65535}),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function c(u,i){return u=u|0||0,u<0?Math.max(u+i,0):Math.min(u,i)}ArrayBuffer.prototype.slice=function(u,i){var r=this.byteLength,a=c(u,r),s=r,b,L,O,_e;return i!==e&&(s=c(i,r)),a>s?new ArrayBuffer(0):(b=s-a,L=new ArrayBuffer(b),O=new Uint8Array(L),_e=new Uint8Array(this,a,b),O.set(_e),L)}})();function A(c){return/[\u0080-\uFFFF]/.test(c)&&(c=unescape(encodeURIComponent(c))),c}function N(c,u){var i=c.length,r=new ArrayBuffer(i),a=new Uint8Array(r),s;for(s=0;s<i;s+=1)a[s]=c.charCodeAt(s);return u?a:r}function F(c){return String.fromCharCode.apply(null,new Uint8Array(c))}function ie(c,u,i){var r=new Uint8Array(c.byteLength+u.byteLength);return r.set(new Uint8Array(c)),r.set(new Uint8Array(u),c.byteLength),i?r:r.buffer}function x(c){var u=[],i=c.length,r;for(r=0;r<i-1;r+=2)u.push(parseInt(c.substr(r,2),16));return String.fromCharCode.apply(String,u)}function S(){this.reset()}return S.prototype.append=function(c){return this.appendBinary(A(c)),this},S.prototype.appendBinary=function(c){this._buff+=c,this._length+=c.length;var u=this._buff.length,i;for(i=64;i<=u;i+=64)l(this._hash,p(this._buff.substring(i-64,i)));return this._buff=this._buff.substring(i-64),this},S.prototype.end=function(c){var u=this._buff,i=u.length,r,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],s;for(r=0;r<i;r+=1)a[r>>2]|=u.charCodeAt(r)<<(r%4<<3);return this._finish(a,i),s=f(this._hash),c&&(s=x(s)),this.reset(),s},S.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},S.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},S.prototype.setState=function(c){return this._buff=c.buff,this._length=c.length,this._hash=c.hash,this},S.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},S.prototype._finish=function(c,u){var i=u,r,a,s;if(c[i>>2]|=128<<(i%4<<3),i>55)for(l(this._hash,c),i=0;i<16;i+=1)c[i]=0;r=this._length*8,r=r.toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(r[2],16),s=parseInt(r[1],16)||0,c[14]=a,c[15]=s,l(this._hash,c)},S.hash=function(c,u){return S.hashBinary(A(c),u)},S.hashBinary=function(c,u){var i=y(c),r=f(i);return u?x(r):r},S.ArrayBuffer=function(){this.reset()},S.ArrayBuffer.prototype.append=function(c){var u=ie(this._buff.buffer,c,!0),i=u.length,r;for(this._length+=c.byteLength,r=64;r<=i;r+=64)l(this._hash,h(u.subarray(r-64,r)));return this._buff=r-64<i?new Uint8Array(u.buffer.slice(r-64)):new Uint8Array(0),this},S.ArrayBuffer.prototype.end=function(c){var u=this._buff,i=u.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],a,s;for(a=0;a<i;a+=1)r[a>>2]|=u[a]<<(a%4<<3);return this._finish(r,i),s=f(this._hash),c&&(s=x(s)),this.reset(),s},S.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},S.ArrayBuffer.prototype.getState=function(){var c=S.prototype.getState.call(this);return c.buff=F(c.buff),c},S.ArrayBuffer.prototype.setState=function(c){return c.buff=N(c.buff,!0),S.prototype.setState.call(this,c)},S.ArrayBuffer.prototype.destroy=S.prototype.destroy,S.ArrayBuffer.prototype._finish=S.prototype._finish,S.ArrayBuffer.hash=function(c,u){var i=d(new Uint8Array(c)),r=f(i);return u?x(r):r},S})});var W=Ne((ir,Je)=>{"use strict";Je.exports={}});async function en(e){let n=(await Promise.resolve().then(()=>G(We(),1))).default,t=new n.ArrayBuffer,o=2097152;for(let l=0;l<e.size;l+=o){let p=Math.min(l+o,e.size);t.append(await e.slice(l,p).arrayBuffer())}return{md5:t.end()}}async function tn(e){let{createHash:n}=await Promise.resolve().then(()=>G(W(),1)),t=n("md5");return t.update(e),{md5:t.digest("hex")}}async function nn(e){let{createHash:n}=await Promise.resolve().then(()=>G(W(),1)),{createReadStream:t}=await Promise.resolve().then(()=>G(W(),1));return new Promise((o,l)=>{let p=n("md5"),h=t(e);h.on("error",y=>l(m.file(`Failed to read file for MD5: ${y.message}`,{filePath:e}))),h.on("data",y=>p.update(y)),h.on("end",()=>o({md5:p.digest("hex")}))})}async function J(e){if(e instanceof Blob)return en(e);if(typeof Buffer<"u"&&Buffer.isBuffer(e))return tn(e);if(typeof e=="string")return nn(e);throw m.business("Invalid input for MD5 calculation")}var Q=_(()=>{"use strict";D()});function te(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var it=_(()=>{"use strict"});function ot(e,n={}){if(n.flatten===!1)return e.map(o=>({path:te(o),name:he(o)}));let t=an(e);return e.map(o=>{let l=te(o);if(t){let p=t.endsWith("/")?t:`${t}/`;l.startsWith(p)&&(l=l.substring(p.length))}return l||(l=he(o)),{path:l,name:he(o)}})}function an(e){if(!e.length)return"";let t=e.map(p=>te(p)).map(p=>p.split("/")),o=[],l=Math.min(...t.map(p=>p.length));for(let p=0;p<l-1;p++){let h=t[0][p];if(t.every(y=>y[p]===h))o.push(h);else break}return o.join("/")}function he(e){return e.split(/[/\\]/).pop()||e}var ye=_(()=>{"use strict";it()});function Nr(e){ge=e}function ln(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function st(){return ge||ln()}var ge,Ee=_(()=>{"use strict";ge=null});function ne(e,n,t){let o=n.suggestions?.[t];return o?`${e} ${o}`:e}function re(e,n){return un.find(t=>t.broken(e,n))}var un,Te=_(()=>{"use strict";D();Se();un=[{name:"name",broken:({path:e})=>!Ae(e).valid,sentence:({path:e})=>Ae(e).reason??`File name "${e}" is invalid.`},{name:"extension",broken:({path:e},n)=>Ce(e,n.blockedExtensions??[]),sentence:({path:e})=>`File "${e}" has an extension that is not allowed.`},{name:"fileSize",broken:({size:e},n)=>e>n.maxFileSize,sentence:({path:e},n)=>ne(`File "${e}" is too large. Maximum ${$(n.maxFileSize)} allowed.`,n,"maxFileSize")},{name:"totalSize",broken:({totalSize:e},n)=>e>n.maxTotalSize,sentence:({totalSize:e},n)=>ne(`Files add up to ${$(e)}. Maximum ${$(n.maxTotalSize)} allowed.`,n,"maxTotalSize")}]});function Ae(e){let n=l=>({valid:!1,reason:`File name "${e}" ${l}.`});if(ve(e))return n("contains unsafe characters");if(e.startsWith(" ")||e.endsWith(" "))return n("cannot start or end with spaces");if(e.endsWith("."))return n("cannot end with dots");let t=/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|$)/i,o=e.split("/").pop()||e;return t.test(o)?n("uses a reserved system name"):e.includes("..")?n("contains a path traversal pattern"):{valid:!0}}function vr(e,n){let t=[],o=[],l=[];if(e.length===0){let d={file:"(no files)",message:"At least one file must be provided."};return t.push(d),{files:[],validFiles:[],errors:t,warnings:[],canDeploy:!1}}for(let d of e)if(z(d.name))return t.push({file:d.name,message:"Unbuilt project detected. Deploy your build output (dist/, build/, out/), not the project folder."}),{files:e.map(E=>({...E,status:R.VALIDATION_FAILED,statusMessage:"Unbuilt project detected"})),validFiles:[],errors:t,warnings:[],canDeploy:!1};if(e.length>n.maxFilesCount){let d={file:`(${e.length} files)`,message:ne(`Too many files (${e.length}). Maximum ${n.maxFilesCount} files allowed.`,n,"maxFilesCount")};return t.push(d),{files:e.map(E=>({...E,status:R.VALIDATION_FAILED,statusMessage:d.message})),validFiles:[],errors:t,warnings:[],canDeploy:!1}}let p=0;for(let d of e){let E=R.READY,f="Ready for upload";if(d.status===R.PROCESSING_ERROR)E=R.VALIDATION_FAILED,f=d.statusMessage||`File "${d.name}" could not be read.`,t.push({file:d.name,message:f});else if(d.size===0){E=R.EXCLUDED,f=`File "${d.name}" is empty, so it is excluded.`,o.push({file:d.name,message:f}),l.push({...d,status:E,statusMessage:f});continue}else if(d.size<0)E=R.VALIDATION_FAILED,f=`File "${d.name}" reports a negative size.`,t.push({file:d.name,message:f});else if(!d.name||d.name.trim().length===0)E=R.VALIDATION_FAILED,f="File name cannot be empty.",t.push({file:d.name||"(empty)",message:f});else if(d.name.includes("\0"))E=R.VALIDATION_FAILED,f=`File name "${d.name}" contains invalid characters (null byte).`,t.push({file:d.name,message:f});else{let A={path:d.name,size:d.size,totalSize:p+d.size},N=re(A,n);N?(E=R.VALIDATION_FAILED,f=N.sentence(A,n),t.push({file:N.name==="totalSize"?`(${e.length} files)`:d.name,message:f})):p=A.totalSize}l.push({...d,status:E,statusMessage:f})}t.length>0&&(l=l.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=t.length===0?l.filter(d=>d.status===R.READY):[],y=t.length===0;return{files:l,validFiles:h,errors:t,warnings:o,canDeploy:y}}function cn(e){return e.filter(n=>n.status===R.READY)}function Fr(e){return cn(e).length>0}var Se=_(()=>{"use strict";D();Te();D()});function at(e){return dn.test(e)}var pn,dn,lt=_(()=>{"use strict";pn=["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^[Dd]esktop\\.ini$","@eaDir$"],dn=new RegExp(pn.join("|"))});function ut(e,n){if(!e||e.length===0)return[];if(!n?.allowUnbuilt&&e.find(o=>o&&z(o)))throw m.business("Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder");return e.filter(t=>{if(!t)return!1;let o=t.replace(/\\/g,"/").split("/").filter(Boolean);if(o.length===0)return!0;let l=o[o.length-1];if(at(l))return!1;for(let h of o)if(h!==".well-known"&&(h.startsWith(".")||h.length>255))return!1;let p=o.slice(0,-1);for(let h of p)if(fn.some(y=>h.toLowerCase()===y.toLowerCase()))return!1;return!0})}var fn,De=_(()=>{"use strict";D();lt();fn=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function ct(e,n){if(e.includes("\0")||e.includes("/../")||e.startsWith("../")||e.endsWith("/.."))throw m.business(`Security error: Unsafe file path "${e}" for file: ${n}`)}function pt(e,n){let t=re(e,n);if(t)throw m.business(t.sentence(e,n))}var Re=_(()=>{"use strict";D();Te()});async function dt(e,n={},t){let o=!!(n.build||n.prerender),l=ot(e.map(f=>f.path),{flatten:n.pathDetect!==!1}).map(f=>f.path),p=new Set(ut(l,{allowUnbuilt:o})),h=e.map((f,A)=>({source:f,deployPath:l[A]})).filter(({deployPath:f})=>p.has(f));if(h.length===0)return[];let y=o?null:mn(t),d=[],E=0;for(let{source:f,deployPath:A}of h){if(y&&ct(A,f.origin),f.size===0)continue;y&&(E+=f.size,pt({path:A,size:f.size,totalSize:E},y));let N=await f.read(),{md5:F}=await J(N);d.push({path:A,content:N,size:f.size,md5:F})}if(y&&d.length>y.maxFilesCount)throw m.business(`Too many files to deploy. Maximum allowed is ${y.maxFilesCount} files.`);return d}function mn(e){if(!e)throw m.config("Platform limits not provided. Deploy-mode validation requires the limits argument \u2014 pass `ship.getLimits()` result.");return e}var ft=_(()=>{"use strict";D();ye();De();Q();Re()});var ht={};Dt(ht,{processFilesForBrowser:()=>mt});async function mt(e,n={},t){if(st()!=="browser")throw m.business("processFilesForBrowser can only be called in a browser environment.");return dt(e.map(o=>({path:o.webkitRelativePath||o.name,origin:o.name,size:o.size,read:async()=>o})),n,t)}var be=_(()=>{"use strict";D();ft();Ee()});D();D();D();var j=class{constructor(){this.handlers=new Map}on(n,t){this.handlers.has(n)||this.handlers.set(n,new Set),this.handlers.get(n)?.add(t)}off(n,t){let o=this.handlers.get(n);o&&(o.delete(t),o.size===0&&this.handlers.delete(n))}emit(n,...t){let o=this.handlers.get(n);if(!o)return;let l=Array.from(o);for(let p of l)try{p(...t)}catch(h){o.delete(p),n!=="error"&&setTimeout(()=>{let y=h instanceof Error?h:new Error(String(h));this.emit("error",y,String(n))},0)}}};var Xt=3e4,qt=2,jt=300,Yt=2e3,Wt=new Set([500,502,503,504]);function Jt(e,n){return new Promise((t,o)=>{if(n?.aborted){o(n.reason);return}let l=()=>{clearTimeout(h),n?.removeEventListener("abort",p)},p=()=>{l(),o(n?.reason)},h=setTimeout(()=>{l(),t()},e);n?.addEventListener("abort",p)})}var Xe=3e5,Qt=3e5,Zt=Xe+Qt,Y=class extends j{constructor(t){super();this.globalHeaders={};this.apiUrl=t.apiUrl||de,this.getAuthHeadersCallback=t.getAuthHeaders,this.session=t.session??!1,this.caller=t.caller,this.timeout=t.timeout??Xt,this.maxRetries=Math.max(0,t.maxRetries??qt),this.fetch=t.fetch??globalThis.fetch.bind(globalThis),this.deploy={endpoint:t.deployEndpoint||T.DEPLOYMENTS,timeout:t.timeout??Xe,buildTimeout:t.timeout??Zt}}setGlobalHeaders(t){this.globalHeaders=t}async executeRequest(t,o,l,p=this.timeout){for(let h=0;;h++)try{return await this.attemptOnce(t,o,l,p)}catch(y){let d=m.fromFetchError(y,l);if(h>=this.maxRetries||!this.isRetryable(d,o))throw this.emit("error",d,t),d;this.emit("retry",d,t,h+1);let E=Math.min(Yt,jt*2**h);try{await Jt(Math.random()*E,o.signal)}catch(f){let A=m.fromFetchError(f,l);throw this.emit("error",A,t),A}}}isRetryable(t,o){if(o.signal?.aborted||t.isType(g.Maintenance)||t.isType(g.Cancelled)||!(t.isNetworkError()||t.status!==void 0&&Wt.has(t.status)))return!1;let p=(o.method??"GET").toUpperCase();return p==="GET"||p==="HEAD"?!0:p==="PUT"||p==="DELETE"?!1:this.hasIdempotencyKey(o.headers)}hasIdempotencyKey(t){if(!t)return!1;let o=v.HEADER.toLowerCase();return Object.keys(t).some(l=>l.toLowerCase()===o)}async attemptOnce(t,o,l,p=this.timeout){let h=()=>{};try{let y=await this.mergeHeaders(o.headers),d=this.createTimeoutSignal(o.signal,p);h=d.cleanup;let E={...o,headers:y,credentials:this.session&&!y.Authorization?"include":void 0,signal:d.signal};this.emit("request",t,E);let f=await this.fetch(t,E);if(h(),!f.ok)throw await m.fromHttpResponse(f,l);return this.emit("response",this.safeClone(f),t),{data:await this.parseResponse(this.safeClone(f)),status:f.status}}catch(y){throw h(),m.fromFetchError(y,l)}}async request(t,o,l,p){let{data:h}=await this.executeRequest(`${this.apiUrl}${t}`,o,l,p);return h}async requestWithStatus(t,o,l){return this.executeRequest(`${this.apiUrl}${t}`,o,l)}async mergeHeaders(t={}){return{...this.globalHeaders,...this.caller?{[M.HEADER]:this.caller}:{},...await this.getAuthHeadersCallback(),...t}}createTimeoutSignal(t,o=this.timeout){let l=new AbortController,p=setTimeout(()=>l.abort(new DOMException(`Timed out after ${o}ms`,"TimeoutError")),o),h=t?()=>l.abort(t.reason):void 0;return t&&h&&(t.addEventListener("abort",h),t.aborted&&l.abort(t.reason)),{signal:l.signal,cleanup:()=>{clearTimeout(p),t&&h&&t.removeEventListener("abort",h)}}}safeClone(t){try{return t.clone()}catch{return t}}async parseResponse(t){if(!(t.headers.get("Content-Length")==="0"||t.status===204))return t.json()}};D();D();async function qe(e,n={}){let{labels:t,via:o,password:l,ttl:p,flags:h,captcha:y}=n,d=new FormData,E=[];for(let f of e){if(typeof f.content=="string"||f.content===null||f.content===void 0)throw m.file(`Unsupported file.content type: ${f.path}`,{filePath:f.path});if(!f.md5)throw m.file(`File missing md5 checksum: ${f.path}`,{filePath:f.path});d.append(I.FILES,new File([f.content],f.path,{type:"application/octet-stream"})),E.push(f.md5)}return d.append(I.CHECKSUMS,JSON.stringify(E)),t&&t.length>0&&d.append(I.LABELS,JSON.stringify(t)),o&&d.append(I.VIA,o),l&&d.append(I.PASSWORD,l),p!==void 0&&d.append(I.TTL,String(p)),h?.build&&d.append(I.BUILD,"true"),h?.prerender&&d.append(I.PRERENDER,"true"),h?.spa&&d.append(I.SPA,"true"),h?.buildCommand&&d.append(I.BUILD_COMMAND,h.buildCommand),h?.outputDir&&d.append(I.OUTPUT_DIR,h.outputDir),y&&d.append(I.CAPTCHA,y),d}D();Q();async function rn(){let e=JSON.stringify($e,null,2),n;typeof Buffer<"u"?n=Buffer.from(e,"utf-8"):n=new Blob([e],{type:"application/json"});let{md5:t}=await J(n);return{path:w,content:n,size:e.length,md5:t}}async function on(e,n,t){let o=e.find(y=>y.path===X.INDEX_FILE||y.path===`/${X.INDEX_FILE}`);if(!o||o.size>X.MAX_INDEX_BYTES)return!1;let l;if(typeof Buffer<"u"&&Buffer.isBuffer(o.content))l=o.content.toString("utf-8");else if(typeof Blob<"u"&&o.content instanceof Blob)l=await o.content.text();else if(typeof File<"u"&&o.content instanceof File)l=await o.content.text();else return!1;let p={files:e.map(y=>y.path),index:l};return(await n.request(T.SPA_CHECK,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p),signal:t??null},"SPA check")).isSPA}async function Qe(e,n,t){if(t.spaDetect===!1||t.spa||t.build||t.prerender||e.some(o=>o.path===w))return e;try{if(await on(e,n,t.signal)){let l=await rn();return[...e,l]}}catch(o){if(t.signal?.aborted)throw o}return e}D();D();function B(e){if(e==null)return;if(e.length===0)return e;if(e.length>C.MAX_COUNT)throw m.validation(`Maximum ${C.MAX_COUNT} labels allowed`);let n=e.map((o,l)=>{if(typeof o!="string")throw m.validation(`Label at index ${l} must be a string`);let p=o.trim().toLowerCase();if(p.length<C.MIN_LENGTH)throw m.validation(`Labels must be at least ${C.MIN_LENGTH} characters long`);if(p.length>C.MAX_LENGTH)throw m.validation(`Labels must be no more than ${C.MAX_LENGTH} characters long`);if(!Ke.test(p))throw m.validation(`Labels must start and end with alphanumeric characters, with optional separators (${C.SEPARATORS}) between segments`);return p}),t=[...new Set(n)];if(t.length!==n.length)throw m.validation("Duplicate labels are not allowed");return t}async function Ze(e){let n=e.find(l=>l.path===w||l.path===`/${w}`);if(!n)return;let t=n.content,o=typeof t.text=="function"?await t.text():n.content.toString("utf8");Be(o)}var Z={"Content-Type":"application/json"},sn="sdk";function me(e){let n=new URLSearchParams;e?.limit!==void 0&&n.set("limit",String(e.limit)),e?.cursor!==void 0&&n.set("cursor",e.cursor);let t=n.toString();return t?`?${t}`:""}function et(e){let{getApi:n,processInput:t}=e;return{upload:async(o,l={})=>{if(!t)throw m.config("processInput function is not provided.");let p=n(),h=await t(o,l),y=await Qe(h,p,l);if(!y.length)throw m.business("No files to deploy");for(let x of y)if(!x.md5)throw m.file(`MD5 checksum missing for file: ${x.path}`,{filePath:x.path});fe(l.password);let d=pe(l.ttl),E=Oe(l.idempotencyKey),f=B(l.labels);await Ze(y);let A=Ve(l.buildCommand),N=ze(l.outputDir),F=l.build||l.prerender||l.spa?{build:l.build,prerender:l.prerender,spa:l.spa,buildCommand:A,outputDir:N}:void 0,ie=await qe(y,{labels:f,via:l.via??sn,password:l.password,ttl:d,flags:F,captcha:l.captcha});return p.request(p.deploy.endpoint,{method:"POST",body:ie,...E?{headers:{[v.HEADER]:E}}:{},signal:l.signal||null},"Deploy",l.build||l.prerender?p.deploy.buildTimeout:p.deploy.timeout)},list:async o=>n().request(`${T.DEPLOYMENTS}${me(o)}`,{method:"GET"},"List deployments"),get:async o=>n().request(T.DEPLOYMENT(encodeURIComponent(o)),{method:"GET"},"Get deployment"),set:async(o,l)=>n().request(T.DEPLOYMENT(encodeURIComponent(o)),{method:"PATCH",headers:Z,body:JSON.stringify({labels:B(l.labels)})},"Update deployment labels"),delete:async o=>n().request(T.DEPLOYMENT(encodeURIComponent(o)),{method:"DELETE"},"Delete deployment")}}function tt(e){let{getApi:n}=e;return{set:async(t,o={})=>{let l=B(o.labels),p={};o.deployment&&(p.deployment=o.deployment),l!==void 0&&(p.labels=l);let{data:h,status:y}=await n().requestWithStatus(T.DOMAIN(encodeURIComponent(t)),{method:"PUT",headers:Z,body:JSON.stringify(p)},"Set domain");return{...h,isCreate:y===201}},list:async t=>n().request(`${T.DOMAINS}${me(t)}`,{method:"GET"},"List domains"),get:async t=>n().request(T.DOMAIN(encodeURIComponent(t)),{method:"GET"},"Get domain"),delete:async t=>n().request(T.DOMAIN(encodeURIComponent(t)),{method:"DELETE"},"Delete domain"),verify:async t=>n().request(T.DOMAIN_VERIFY(encodeURIComponent(t)),{method:"POST"},"Verify domain"),validate:async t=>n().request(T.DOMAINS_VALIDATE,{method:"POST",headers:Z,body:JSON.stringify({domain:t})},"Validate domain"),dns:async t=>n().request(T.DOMAIN_DNS(encodeURIComponent(t)),{method:"GET"},"Get domain DNS"),records:async t=>n().request(T.DOMAIN_RECORDS(encodeURIComponent(t)),{method:"GET"},"Get domain records"),share:async t=>n().request(T.DOMAIN_SHARE(encodeURIComponent(t)),{method:"GET"},"Get domain share")}}function nt(e){let{getApi:n}=e;return{get:async()=>n().request(T.ACCOUNT,{method:"GET"},"Get account")}}function rt(e){let{getApi:n}=e;return{create:async(t={})=>{let o=pe(t.ttl),l=B(t.labels),p={};return o!==void 0&&(p.ttl=o),l!==void 0&&(p.labels=l),n().request(T.TOKENS,{method:"POST",headers:Z,body:JSON.stringify(p)},"Create token")},list:async t=>n().request(`${T.TOKENS}${me(t)}`,{method:"GET"},"List tokens"),get:async t=>n().request(T.TOKEN(encodeURIComponent(t)),{method:"GET"},"Get token"),delete:async t=>n().request(T.TOKEN(encodeURIComponent(t)),{method:"DELETE"},"Delete token")}}var ee=class{constructor(n={}){this.credential=null;if(n={...n,apiUrl:n.apiUrl||void 0,token:n.token||void 0,caller:n.caller||void 0},this.clientOptions=n,n.caller!==void 0&&He(n.caller),n.token&&n.session)throw m.config("Provide either `token` or `session`, not both.");typeof n.token=="string"?(ce(n.token),this.credential=n.token):n.token&&(this.credential=n.token),this.http=new Y({...n,getAuthHeaders:()=>this.getAuthHeaders()});let t={getApi:()=>this.http};this.deployments=et({...t,processInput:async(o,l)=>this.processInput(o,l,await this.getLimits({signal:l.signal}))}),this.domains=tt(t),this.account=nt(t),this.tokens=rt(t)}async ping(){return this.http.request(T.PING,{method:"GET"},"Ping")}async deploy(n,t){return this.deployments.upload(n,t)}async whoami(){return this.account.get()}async getLimits(n={}){return this.http.request(T.LIMITS,{method:"GET",signal:n.signal??null},"Get limits")}on(n,t){this.http.on(n,t)}off(n,t){this.http.off(n,t)}setHeaders(n){this.http.setGlobalHeaders(n)}clearHeaders(){this.http.setGlobalHeaders({})}setToken(n){if(this.clientOptions.session)throw m.config("Provide either `token` or `session`, not both.");if(typeof n=="string"){if(!n)throw m.business("Invalid token provided. Token must be a non-empty string.");ce(n),this.credential=n;return}if(typeof n!="function")throw m.business("Invalid token provided. Token must be a non-empty string or a provider function.");this.credential=n}async getAuthHeaders(){if(this.credential===null)return{};let n=typeof this.credential=="function"?await this.credential():this.credential;if(!n)throw m.authentication("Token provider returned no token.");if(typeof n!="string")throw m.authentication("Token provider returned a non-string value.");return{Authorization:`Bearer ${n}`}}};D();D();ye();Ee();Se();De();Q();Re();function zr(e,n,t,o=!0){let l=e===1?n:t;return o?`${e} ${l}`:l}be();var Ie=class extends ee{async deploy(n,t){return super.deploy(n,t)}async processInput(n,t,o){if(!Array.isArray(n)||!n.every(p=>p instanceof File))throw m.business("Invalid input type for browser environment. Expected File[].");if(n.length===0)throw m.business("No files to deploy.");let{processFilesForBrowser:l}=await Promise.resolve().then(()=>(be(),ht));return l(n,t,o)}},gi=Ie;export{wn as ACCOUNT_HEADER,Fe as API_KEY,T as API_PATHS,Nn as AUTH_BASE_PATH,Sn as AccountPlan,Dn as AccountRefusal,Y as ApiHttp,se as AuthMethod,U as BUILD_SETTINGS,M as CALLER,de as DEFAULT_API,w as DEPLOYMENT_CONFIG_FILENAME,I as DEPLOY_FIELDS,In as DEPLOY_FILE_GRAMMAR,Me as DEPLOY_TOKEN,yn as DeploymentStatus,bt as DeploymentVia,gn as DomainStatus,En as DomainVerification,g as ErrorType,R as FILE_VALIDATION_STATUS,R as FileValidationStatus,v as IDEMPOTENCY_KEY_CONSTRAINTS,fn as JUNK_DIRECTORIES,C as LABEL_CONSTRAINTS,Ke as LABEL_PATTERN,Hn as MY_API_KEY_URL,Ue as OAUTH_TOKEN,On as OAuthScope,V as PASSWORD_CONSTRAINTS,Gn as PUBLIC_DEPLOYMENT_TTL_SECONDS,Ut as SECTIONS,An as SETUP_TROUBLESHOOTING_ANCHOR,$n as SHIP_ENV,Bn as SHIP_VIA_ENV,Ln as SIGN_IN_RETURN_PARAM,X as SPA_CHECK_CONSTRAINTS,$e as SPA_DEFAULT_CONFIG,Ie as Ship,m as ShipError,K as TTL_CONSTRAINTS,P as TokenKind,Pt as UNBUILT_PROJECT_MARKERS,Ot as UNSAFE_FILENAME_CHARS,Kn as USER_VISIBLE_EVENTS,_n as WEB_FILE_ACCEPT,Nr as __setTestEnvironment,Mn as accountOfPath,Fr as allValidFilesReady,Be as assertShipJsonSyntax,Fn as billingReturnOf,J as calculateMD5,Ct as classifyToken,Ht as consolePaths,nt as createAccountResource,et as createDeploymentResource,tt as createDomainResource,rt as createTokenResource,gi as default,Yn as deserializeLabels,vn as doors,Un as errandOf,zn as extractSubdomain,ut as filterJunk,zt as formatDuration,$ as formatFileSize,kn as formatTimeRemaining,Xn as generateDeploymentUrl,qn as generateDomainUrl,st as getENV,cn as getValidFiles,z as hasUnbuiltMarker,ve as hasUnsafeChars,Ce as isBlockedExtension,kt as isClaimPath,Vn as isCustomDomain,Cn as isDeployment,Kt as isInvitationPath,ke as isPlatformDomain,Pe as isShipError,Vt as isUpgradePath,Tn as normalizeVia,ot as optimizeDeployPaths,Rn as personName,bn as personShortName,zr as pluralize,mt as processFilesForBrowser,xn as readBearerValue,jn as serializeLabels,vt as validateApiKey,Pn as validateApiUrl,Ve as validateBuildCommand,He as validateCaller,pt as validateDeployFile,ct as validateDeployPath,Ft as validateDeployToken,Ae as validateFileName,vr as validateFiles,Oe as validateIdempotencyKey,Mt as validateOAuthToken,ze as validateOutputDir,fe as validatePassword,ce as validateToken,pe as validateTtl};
2
2
  //# sourceMappingURL=browser.js.map