@wix/himalaya-cli 0.1906.0 → 0.1907.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -3367,6 +3367,16 @@ function assertAppId(app2, where) {
3367
3367
  }
3368
3368
  return app2;
3369
3369
  }
3370
+ function isMediaArchiveUrl(url, metaSiteId) {
3371
+ if (typeof url !== "string" || typeof metaSiteId !== "string" || !/^[0-9a-f-]{36}$/.test(metaSiteId)) return false;
3372
+ let u2;
3373
+ try {
3374
+ u2 = new URL(url);
3375
+ } catch {
3376
+ return false;
3377
+ }
3378
+ return u2.protocol === "https:" && u2.host === `${metaSiteId}.usrfiles.com` && /^\/archives\/[A-Za-z0-9_.-]+$/.test(u2.pathname) && !u2.search && !u2.hash;
3379
+ }
3370
3380
  var BUNDLE_CACHE_CONTROL, LARGE_ASSET_REDIRECT_MAX_AGE_SEC, ASSET_LOCATION_HEADER, ASSET_LOCATION_CONTENT_TYPE, DOC_CACHE_CONTROL, PINNED_CACHE_CONTROL, APP_ID_RE;
3371
3381
  var init_contract = __esm({
3372
3382
  "../../core/serve-storage/src/contract.ts"() {
@@ -3953,6 +3963,7 @@ var init_himi_package = __esm({
3953
3963
  var ICON_VIEW_BOX, ICON_STROKE_WIDTH, ICON_FALLBACK, ICON_CATALOG, ICON_NORMALIZED_INDEX, ICON_NAMES;
3954
3964
  var init_icon_catalog_generated = __esm({
3955
3965
  "../../core/ts/src/icon-catalog.generated.ts"() {
3966
+ "use strict";
3956
3967
  init_define_HHP_CATALOG();
3957
3968
  ICON_VIEW_BOX = 24;
3958
3969
  ICON_STROKE_WIDTH = 2;
@@ -156421,10 +156432,49 @@ var init_widget_identity = __esm({
156421
156432
  }
156422
156433
  });
156423
156434
 
156424
- // ../../core/serve-storage/src/release-patch.ts
156435
+ // ../../core/serve-storage/src/release-payload-hash.ts
156425
156436
  import { createHash as createHash21 } from "node:crypto";
156437
+ function canonical2(value2) {
156438
+ if (value2 === null || typeof value2 !== "object") return JSON.stringify(value2);
156439
+ if (Array.isArray(value2)) return `[${value2.map(canonical2).join(",")}]`;
156440
+ const record6 = value2;
156441
+ return `{${Object.keys(record6).filter((key4) => record6[key4] !== void 0).sort().map((key4) => `${JSON.stringify(key4)}:${canonical2(record6[key4])}`).join(",")}}`;
156442
+ }
156443
+ function releasePayloadHash(payload) {
156444
+ const hash3 = (value2) => createHash21("sha256").update(canonical2(value2)).digest("hex");
156445
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) return hash3(payload);
156446
+ const { catalogs: _catalogBytes, ...record6 } = payload;
156447
+ const manifest2 = record6.manifest;
156448
+ if (!manifest2 || typeof manifest2 !== "object" || Array.isArray(manifest2)) return hash3(record6);
156449
+ let manifestRecord = manifest2;
156450
+ const assets = manifestRecord.assets;
156451
+ if (assets && typeof assets === "object" && !Array.isArray(assets)) manifestRecord = { ...manifestRecord, assets: unplacedAssets(assets) };
156452
+ const widgets = manifestRecord.widgets;
156453
+ if (!widgets || typeof widgets !== "object" || Array.isArray(widgets)) return hash3({ ...record6, manifest: manifestRecord });
156454
+ return hash3({ ...record6, manifest: { ...manifestRecord, widgets: stableWidgets(widgets) } });
156455
+ }
156456
+ function unplacedAssets(assets) {
156457
+ const out2 = {};
156458
+ for (const [name, value2] of Object.entries(assets)) {
156459
+ const r3 = value2;
156460
+ if (r3 && typeof r3 === "object" && r3.storage === "media") {
156461
+ const { url: _url, mediaSiteId: _site, ...rest } = r3;
156462
+ out2[name] = { ...rest, storage: "large" };
156463
+ } else out2[name] = value2;
156464
+ }
156465
+ return out2;
156466
+ }
156467
+ var init_release_payload_hash = __esm({
156468
+ "../../core/serve-storage/src/release-payload-hash.ts"() {
156469
+ init_define_HHP_CATALOG();
156470
+ init_widget_identity();
156471
+ }
156472
+ });
156473
+
156474
+ // ../../core/serve-storage/src/release-patch.ts
156475
+ import { createHash as createHash22 } from "node:crypto";
156426
156476
  function sha256hex(b3) {
156427
- return createHash21("sha256").update(b3).digest("hex");
156477
+ return createHash22("sha256").update(b3).digest("hex");
156428
156478
  }
156429
156479
  function stableStringify(value2) {
156430
156480
  if (value2 === null || typeof value2 !== "object") return JSON.stringify(value2);
@@ -156452,6 +156502,9 @@ function manifestContent(m2) {
156452
156502
  function releaseContentId(m2) {
156453
156503
  const content = manifestContent(m2);
156454
156504
  delete content.appSourceHash;
156505
+ if (content.assets && typeof content.assets === "object" && !Array.isArray(content.assets)) {
156506
+ content.assets = unplacedAssets(content.assets);
156507
+ }
156455
156508
  const widgets = content.widgets;
156456
156509
  if (widgets && typeof widgets === "object" && !Array.isArray(widgets)) content.widgets = stableWidgets(widgets);
156457
156510
  return sha256hex(stableStringify(content));
@@ -156460,6 +156513,7 @@ var init_release_patch = __esm({
156460
156513
  "../../core/serve-storage/src/release-patch.ts"() {
156461
156514
  init_define_HHP_CATALOG();
156462
156515
  init_widget_identity();
156516
+ init_release_payload_hash();
156463
156517
  init_wip_pointer();
156464
156518
  }
156465
156519
  });
@@ -160774,11 +160828,11 @@ var init_dependencies2 = __esm({
160774
160828
  });
160775
160829
 
160776
160830
  // ../../core/functions-build/src/sbom.ts
160777
- import { createHash as createHash22 } from "node:crypto";
160831
+ import { createHash as createHash23 } from "node:crypto";
160778
160832
  function createFunctionSbom(packages) {
160779
160833
  const components2 = [...packages].sort((a3, b3) => a3.name.localeCompare(b3.name)).map(({ name, version: version5, integrity: integrity2, license }) => ({ name, version: version5, integrity: integrity2, license }));
160780
160834
  const body = JSON.stringify({ format: "himalaya-sbom-v1", components: components2 });
160781
- return { format: "himalaya-sbom-v1", components: components2, hash: createHash22("sha256").update(body).digest("hex") };
160835
+ return { format: "himalaya-sbom-v1", components: components2, hash: createHash23("sha256").update(body).digest("hex") };
160782
160836
  }
160783
160837
  var init_sbom = __esm({
160784
160838
  "../../core/functions-build/src/sbom.ts"() {
@@ -160787,12 +160841,12 @@ var init_sbom = __esm({
160787
160841
  });
160788
160842
 
160789
160843
  // ../../core/functions-build/src/build.ts
160790
- import { createHash as createHash23 } from "node:crypto";
160844
+ import { createHash as createHash24 } from "node:crypto";
160791
160845
  function sha2562(value2) {
160792
- return createHash23("sha256").update(value2).digest("hex");
160846
+ return createHash24("sha256").update(value2).digest("hex");
160793
160847
  }
160794
160848
  function sri(value2) {
160795
- return `sha256-${createHash23("sha256").update(value2).digest("base64")}`;
160849
+ return `sha256-${createHash24("sha256").update(value2).digest("base64")}`;
160796
160850
  }
160797
160851
  function schemaHash(schema2) {
160798
160852
  if (!schema2) return "";
@@ -161066,7 +161120,7 @@ __export(build_exports2, {
161066
161120
  withStoreNavBundle: () => withStoreNavBundle,
161067
161121
  withoutDevOnlyAppConfig: () => withoutDevOnlyAppConfig
161068
161122
  });
161069
- import { createHash as createHash24 } from "node:crypto";
161123
+ import { createHash as createHash25 } from "node:crypto";
161070
161124
  import { readFileSync as readFileSync46, readdirSync as readdirSync26, existsSync as existsSync43, realpathSync as realpathSync6 } from "node:fs";
161071
161125
  import { dirname as dirname28, join as join38, resolve as resolve36, sep as sep13 } from "node:path";
161072
161126
  import { fileURLToPath as fileURLToPath27 } from "node:url";
@@ -161235,10 +161289,10 @@ function servesMessages(text32) {
161235
161289
  }
161236
161290
  }
161237
161291
  function sha2563(buf) {
161238
- return createHash24("sha256").update(buf).digest("hex");
161292
+ return createHash25("sha256").update(buf).digest("hex");
161239
161293
  }
161240
161294
  function sri2(buf) {
161241
- return "sha256-" + createHash24("sha256").update(buf).digest("base64");
161295
+ return "sha256-" + createHash25("sha256").update(buf).digest("base64");
161242
161296
  }
161243
161297
  async function widgetFailureDetail(res) {
161244
161298
  try {
@@ -162875,11 +162929,13 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
162875
162929
  const a3 = config.auth;
162876
162930
  const cid = a3?.config?.clientId;
162877
162931
  const siteUrl = a3?.config?.siteUrl;
162932
+ const siteId = a3?.config?.siteId;
162878
162933
  const oneAppMetaSiteId = oneAppMetaSiteIdOf(a3);
162879
162934
  return {
162880
162935
  ...a3?.providerId ? { providerId: a3.providerId } : {},
162881
162936
  ...typeof cid === "string" && cid ? { clientId: cid } : {},
162882
162937
  ...typeof siteUrl === "string" && siteUrl ? { siteUrl } : {},
162938
+ ...typeof siteId === "string" && siteId ? { siteId } : {},
162883
162939
  ...oneAppMetaSiteId ? { oneAppMetaSiteId } : {}
162884
162940
  };
162885
162941
  })()
@@ -164152,7 +164208,7 @@ __export(studio_exports, {
164152
164208
  renderStudioHtml: () => renderStudioHtml,
164153
164209
  writeStudioRecord: () => writeStudioRecord
164154
164210
  });
164155
- import { createHash as createHash25 } from "node:crypto";
164211
+ import { createHash as createHash26 } from "node:crypto";
164156
164212
  import { existsSync as existsSync46, readdirSync as readdirSync28, readFileSync as readFileSync49, realpathSync as realpathSync7, statSync as statSync11 } from "node:fs";
164157
164213
  import { basename as basename12, extname as extname3, join as join41, relative as relative11, resolve as resolve37, sep as sep14 } from "node:path";
164158
164214
  import { pathToFileURL as pathToFileURL6 } from "node:url";
@@ -164434,7 +164490,7 @@ function buildView(dir, memory2, now) {
164434
164490
  reveal: memory2.reveal ?? null
164435
164491
  };
164436
164492
  const { generatedAt: _ignored, timelineFrames: _count, ...stable } = view;
164437
- const v2 = createHash25("sha256").update(JSON.stringify(stable)).digest("hex").slice(0, 16);
164493
+ const v2 = createHash26("sha256").update(JSON.stringify(stable)).digest("hex").slice(0, 16);
164438
164494
  return { v: v2, ...view };
164439
164495
  }
164440
164496
  function writeAtomic(file2, content) {
@@ -165518,6 +165574,12 @@ var init_cli_help = __esm({
165518
165574
  --account-id: which account owns the app, when your Wix session
165519
165575
  resolves to several. The first-push auto-claim cannot guess;
165520
165576
  without it a multi-account caller is told to name one.
165577
+ --media-site <msid>: put assets over the inline cap (a game pack,
165578
+ up to 512 MB) in that Wix site's Media Manager as public files,
165579
+ instead of the plane's large asset channel. Without the flag,
165580
+ only when the plane has nowhere to keep one: then the site the
165581
+ app's Wix login names (auth siteId). Needs a Wix sign-in that
165582
+ manages that site; a re-push of the same bytes reuses the file.
165521
165583
  --no-source: do NOT archive the content package with the release.
165522
165584
  On by default, so himi pull can restore an editable copy.
165523
165585
  Never archives .himi/, .env*, node_modules/, dist/, the
@@ -166912,7 +166974,7 @@ __export(wix_owner_exports, {
166912
166974
  wixCliOnPath: () => wixCliOnPath
166913
166975
  });
166914
166976
  import { spawn as spawn3 } from "node:child_process";
166915
- import { createHash as createHash26 } from "node:crypto";
166977
+ import { createHash as createHash27 } from "node:crypto";
166916
166978
  import { accessSync as accessSync2, constants as fsConstants, statSync as statSync13 } from "node:fs";
166917
166979
  import { delimiter, join as join44 } from "node:path";
166918
166980
  function resolveSiteId(flag3) {
@@ -166937,7 +166999,7 @@ async function siteToken(msid, spawnImpl = spawn3, fetchImpl = fetch) {
166937
166999
  return await mintToken(["token", "--site", msid], `wix token --site ${msid}`, msid, spawnImpl);
166938
167000
  }
166939
167001
  function subjectFingerprint(subject) {
166940
- return createHash26("sha256").update(subject).digest("hex").slice(0, 16);
167002
+ return createHash27("sha256").update(subject).digest("hex").slice(0, 16);
166941
167003
  }
166942
167004
  async function exchangeSiteToken(subject, msid, opts = {}) {
166943
167005
  const now = opts.now ?? Date.now;
@@ -174294,7 +174356,7 @@ var init_fxp = __esm({
174294
174356
  });
174295
174357
 
174296
174358
  // ../../packages/serve/src/pkcs12.ts
174297
- import { X509Certificate, createHash as createHash27, createPrivateKey as createPrivateKey2, createPublicKey, pbkdf2Sync, createDecipheriv } from "node:crypto";
174359
+ import { X509Certificate, createHash as createHash28, createPrivateKey as createPrivateKey2, createPublicKey, pbkdf2Sync, createDecipheriv } from "node:crypto";
174298
174360
  function decodePkcs12(der, password) {
174299
174361
  try {
174300
174362
  const pfx = readSequence(der, 0);
@@ -174568,7 +174630,7 @@ function expand(src, v2) {
174568
174630
  return out2;
174569
174631
  }
174570
174632
  function sha12(data) {
174571
- return createHash27("sha1").update(data).digest();
174633
+ return createHash28("sha1").update(data).digest();
174572
174634
  }
174573
174635
  function readAt(buf, i2) {
174574
174636
  if (i2 >= buf.length) return void 0;
@@ -174658,7 +174720,7 @@ var init_pkcs12 = __esm({
174658
174720
  });
174659
174721
 
174660
174722
  // ../../packages/serve/src/customer-signing-assets.ts
174661
- import { createHash as createHash28 } from "node:crypto";
174723
+ import { createHash as createHash29 } from "node:crypto";
174662
174724
  function readValue(node4) {
174663
174725
  const [tag, children2] = Object.entries(node4)[0] ?? [];
174664
174726
  if (!tag || !Array.isArray(children2)) return refuse2("customer_profile_invalid");
@@ -174736,7 +174798,7 @@ function toBundle(assets, expected, decoded2, profileType, apns, deviceCount) {
174736
174798
  provisioningProfile: Buffer.from(assets.provisioningProfile).toString("base64"),
174737
174799
  profileSha256: sha2564(assets.provisioningProfile),
174738
174800
  certificateSha256: sha2564(decoded2.cert.raw),
174739
- certificateSha1: createHash28("sha1").update(decoded2.cert.raw).digest("hex").toUpperCase(),
174801
+ certificateSha1: createHash29("sha1").update(decoded2.cert.raw).digest("hex").toUpperCase(),
174740
174802
  expiresAt: new Date(Math.min(decoded2.expiration, Date.parse(decoded2.cert.validTo))).toISOString(),
174741
174803
  ...apns ? { apnsEnvironment: apns } : {},
174742
174804
  deviceCount
@@ -174788,7 +174850,7 @@ var init_customer_signing_assets = __esm({
174788
174850
  init_fxp();
174789
174851
  init_pkcs12();
174790
174852
  init_customer_dist_signing();
174791
- sha2564 = (bytes2) => createHash28("sha256").update(bytes2).digest("hex");
174853
+ sha2564 = (bytes2) => createHash29("sha256").update(bytes2).digest("hex");
174792
174854
  refuse2 = (code3) => {
174793
174855
  throw new CustomerSigningError(code3);
174794
174856
  };
@@ -179167,7 +179229,7 @@ __export(icon_exports, {
179167
179229
  summarize: () => summarize3,
179168
179230
  writePreparedIcon: () => writePreparedIcon
179169
179231
  });
179170
- import { createHash as createHash29 } from "node:crypto";
179232
+ import { createHash as createHash30 } from "node:crypto";
179171
179233
  import { accessSync as accessSync3, constants as constants4, existsSync as existsSync57, mkdirSync as mkdirSync28, readFileSync as readFileSync61, statSync as statSync18, writeFileSync as writeFileSync24 } from "node:fs";
179172
179234
  import { basename as basename15, dirname as dirname35, join as join49, resolve as resolve45, sep as sep16 } from "node:path";
179173
179235
  function readManifest(dir) {
@@ -179256,7 +179318,7 @@ async function iconStatus(dir) {
179256
179318
  ...base2,
179257
179319
  templateIcon: templateIconMatch(png),
179258
179320
  bytes: png.length,
179259
- sha256: createHash29("sha256").update(png).digest("hex"),
179321
+ sha256: createHash30("sha256").update(png).digest("hex"),
179260
179322
  header: pngHeader(png),
179261
179323
  byteIssues
179262
179324
  };
@@ -181013,8 +181075,8 @@ function renderBookMarkdown(book) {
181013
181075
  lines2.push(`theme: null`);
181014
181076
  }
181015
181077
  const shots = look.pages.filter((p2) => p2.screenshotLocal);
181016
- const usable = shots.filter((p2) => !looksGated(p2));
181017
- if (usable.length) {
181078
+ const usable2 = shots.filter((p2) => !looksGated(p2));
181079
+ if (usable2.length) {
181018
181080
  lines2.push(`OPEN the screenshots below before choosing tokens \u2014 judge character, then map.`);
181019
181081
  } else if (shots.length) {
181020
181082
  lines2.push(`DO NOT judge the look from these screenshots \u2014 every crawled page is an auth wall,`);
@@ -182667,9 +182729,9 @@ function base44HostSuffix(origin) {
182667
182729
  return suffix && label4.includes("-") && /^[0-9a-f]{8}$/.test(suffix) ? suffix : void 0;
182668
182730
  }
182669
182731
  function iconUrls(icons) {
182670
- const usable = icons.filter((i2) => !/svg/i.test(i2.type ?? "") && !/\.svg(\?|$)/i.test(i2.url));
182732
+ const usable2 = icons.filter((i2) => !/svg/i.test(i2.type ?? "") && !/\.svg(\?|$)/i.test(i2.url));
182671
182733
  const rank = (i2) => i2.source === "manifest" ? 2 : i2.source === "apple-touch-icon" ? 1 : 0;
182672
- const sorted3 = [...usable].sort((a3, b3) => rank(b3) - rank(a3) || b3.size - a3.size);
182734
+ const sorted3 = [...usable2].sort((a3, b3) => rank(b3) - rank(a3) || b3.size - a3.size);
182673
182735
  const out2 = [];
182674
182736
  const taken2 = /* @__PURE__ */ new Map();
182675
182737
  for (const icon of sorted3) {
@@ -183955,7 +184017,7 @@ __export(pack_exports, {
183955
184017
  unpackTo: () => unpackTo,
183956
184018
  writeZip: () => writeZip
183957
184019
  });
183958
- import { createHash as createHash30 } from "node:crypto";
184020
+ import { createHash as createHash31 } from "node:crypto";
183959
184021
  import { deflateRawSync, inflateRawSync } from "node:zlib";
183960
184022
  import { existsSync as existsSync62, mkdirSync as mkdirSync31, readFileSync as readFileSync66, readdirSync as readdirSync32, rmSync as rmSync18, statSync as statSync19, writeFileSync as writeFileSync27 } from "node:fs";
183961
184023
  import { dirname as dirname38, join as join55, resolve as resolve47 } from "node:path";
@@ -184105,11 +184167,11 @@ function gatherReleaseEntries(appDir3) {
184105
184167
  return { entries, manifest: manifest2, skipped };
184106
184168
  }
184107
184169
  function sha256Hex4(bytes2) {
184108
- return createHash30("sha256").update(bytes2).digest("hex");
184170
+ return createHash31("sha256").update(bytes2).digest("hex");
184109
184171
  }
184110
184172
  function computeContentHash(entries) {
184111
184173
  const input = packageHashInput(entries.map((e2) => ({ path: e2.path, hash: sha256Hex4(e2.bytes) })));
184112
- return "sha256-" + createHash30("sha256").update(input).digest("base64");
184174
+ return "sha256-" + createHash31("sha256").update(input).digest("base64");
184113
184175
  }
184114
184176
  function buildEntries(appDir3, app2, opts) {
184115
184177
  const { entries: released, manifest: manifest2, skipped } = gatherReleaseEntries(appDir3);
@@ -184302,7 +184364,7 @@ __export(app_source_exports, {
184302
184364
  writeConflicts: () => writeConflicts,
184303
184365
  zipAppSource: () => zipAppSource
184304
184366
  });
184305
- import { createHash as createHash31 } from "node:crypto";
184367
+ import { createHash as createHash32 } from "node:crypto";
184306
184368
  import { readdirSync as readdirSync33, lstatSync as lstatSync20, readFileSync as readFileSync67, mkdirSync as mkdirSync32, writeFileSync as writeFileSync28, existsSync as existsSync63, rmSync as rmSync19, rmdirSync as rmdirSync3, unlinkSync as unlinkSync3 } from "node:fs";
184307
184369
  import { join as join56, resolve as resolve48, sep as sep18 } from "node:path";
184308
184370
  import { createRequire as createRequire5 } from "node:module";
@@ -184423,13 +184485,13 @@ function sourceFingerprint(dir) {
184423
184485
  dir,
184424
184486
  (archivePath, hostRel) => {
184425
184487
  if (/\.md$/i.test(archivePath)) return;
184426
- files.push(`${archivePath}\0${createHash31("sha256").update(readFileSync67(join56(dir, hostRel))).digest("hex")}`);
184488
+ files.push(`${archivePath}\0${createHash32("sha256").update(readFileSync67(join56(dir, hostRel))).digest("hex")}`);
184427
184489
  },
184428
184490
  () => {
184429
184491
  }
184430
184492
  );
184431
184493
  files.sort();
184432
- return createHash31("sha256").update(files.join("\n")).digest("hex");
184494
+ return createHash32("sha256").update(files.join("\n")).digest("hex");
184433
184495
  }
184434
184496
  function largestEntries(entries, limit = 5) {
184435
184497
  return entries.map((e2) => ({
@@ -184926,7 +184988,7 @@ __export(screen_state_exports, {
184926
184988
  shotStateFor: () => shotStateFor,
184927
184989
  withHomeCaveat: () => withHomeCaveat
184928
184990
  });
184929
- import { createHash as createHash32 } from "node:crypto";
184991
+ import { createHash as createHash33 } from "node:crypto";
184930
184992
  import { lstatSync as lstatSync22, readFileSync as readFileSync69 } from "node:fs";
184931
184993
  import { join as join58 } from "node:path";
184932
184994
  function quotableLine(text32) {
@@ -185047,7 +185109,7 @@ var init_screen_state = __esm({
185047
185109
  KEEP = 40;
185048
185110
  LINE_MAX = 120;
185049
185111
  str6 = (v2) => typeof v2 === "string" && v2.trim() ? v2 : void 0;
185050
- sha256Of = (file2) => createHash32("sha256").update(readFileSync69(file2)).digest("hex");
185112
+ sha256Of = (file2) => createHash33("sha256").update(readFileSync69(file2)).digest("hex");
185051
185113
  }
185052
185114
  });
185053
185115
 
@@ -185062,7 +185124,7 @@ __export(studio_reel_exports, {
185062
185124
  thin: () => thin,
185063
185125
  utcDay: () => utcDay
185064
185126
  });
185065
- import { createHash as createHash33 } from "node:crypto";
185127
+ import { createHash as createHash34 } from "node:crypto";
185066
185128
  import { lstatSync as lstatSync23, readFileSync as readFileSync70 } from "node:fs";
185067
185129
  import { basename as basename17, join as join59 } from "node:path";
185068
185130
  function loadMemory2(dir) {
@@ -185151,7 +185213,7 @@ function inlineImages(dir, plan, budget = REEL_BUDGET_BYTES) {
185151
185213
  const st2 = lstatSync23(path2);
185152
185214
  if (!st2.isFile() || st2.nlink !== 1) return null;
185153
185215
  const bytes2 = readFileSync70(path2);
185154
- return createHash33("sha256").update(bytes2).digest("hex") === f2.slice(0, 64) && imageExtension(bytes2) === f2.slice(65) ? bytes2 : null;
185216
+ return createHash34("sha256").update(bytes2).digest("hex") === f2.slice(0, 64) && imageExtension(bytes2) === f2.slice(65) ? bytes2 : null;
185155
185217
  } catch {
185156
185218
  return null;
185157
185219
  }
@@ -185379,7 +185441,7 @@ __export(milestones_exports, {
185379
185441
  watchUrlFor: () => watchUrlFor,
185380
185442
  writeHandoverReel: () => writeHandoverReel
185381
185443
  });
185382
- import { createHash as createHash34, randomUUID as randomUUID10 } from "node:crypto";
185444
+ import { createHash as createHash35, randomUUID as randomUUID10 } from "node:crypto";
185383
185445
  import { spawn as spawn4 } from "node:child_process";
185384
185446
  import { closeSync as closeSync6, existsSync as existsSync65, lstatSync as lstatSync24, readFileSync as readFileSync72, statSync as statSync21 } from "node:fs";
185385
185447
  import { createServer as createServer3 } from "node:net";
@@ -186083,7 +186145,7 @@ var init_milestones = __esm({
186083
186145
  INIT_SOURCE_FILE = join61(".himi", "init-source.json");
186084
186146
  STARTING_POINT_REF = "starting-point";
186085
186147
  TEMPLATE_NAME2 = /^[A-Za-z0-9._-]{1,64}$/;
186086
- sha256Of2 = (file2) => createHash34("sha256").update(readFileSync72(file2)).digest("hex");
186148
+ sha256Of2 = (file2) => createHash35("sha256").update(readFileSync72(file2)).digest("hex");
186087
186149
  WATCH_REMINDER_EVERY_MS = 10 * 60 * 1e3;
186088
186150
  REMINDERS_FILE = join61(".himi", "reminders.json");
186089
186151
  pidAlive = (pid) => {
@@ -186505,7 +186567,7 @@ async function loadReleaseFromDir(app2, dir) {
186505
186567
  let assets;
186506
186568
  if (store.getAsset) {
186507
186569
  for (const rec of Object.values(manifest2.assets ?? {})) {
186508
- if (!rec?.sha256 || assets?.[rec.sha256] || rec.storage === "large") continue;
186570
+ if (!rec?.sha256 || assets?.[rec.sha256] || rec.storage === "large" || rec.storage === "media") continue;
186509
186571
  const b3 = await store.getAsset(app2, rec.sha256);
186510
186572
  if (b3) (assets ??= {})[rec.sha256] = asBuffer(b3).toString("base64");
186511
186573
  }
@@ -188585,7 +188647,7 @@ var init_social_sign_in = __esm({
188585
188647
 
188586
188648
  // ../app-icons/plan.ts
188587
188649
  import { existsSync as existsSync73, readFileSync as readFileSync80, readdirSync as readdirSync37 } from "node:fs";
188588
- import { createHash as createHash35 } from "node:crypto";
188650
+ import { createHash as createHash36 } from "node:crypto";
188589
188651
  import { inflateSync } from "node:zlib";
188590
188652
  import { dirname as dirname41, join as join71, resolve as resolve52 } from "node:path";
188591
188653
  function stripComments(src) {
@@ -188673,7 +188735,7 @@ function parseIconConfig(configTs) {
188673
188735
  return out2;
188674
188736
  }
188675
188737
  function idHash(id) {
188676
- return createHash35("sha1").update(id).digest();
188738
+ return createHash36("sha1").update(id).digest();
188677
188739
  }
188678
188740
  function deriveGlyph(id) {
188679
188741
  const h2 = idHash(id);
@@ -188857,7 +188919,7 @@ function placeholderHashes() {
188857
188919
  }
188858
188920
  function fileSha256(path2) {
188859
188921
  try {
188860
- return createHash35("sha256").update(readFileSync80(path2)).digest("hex");
188922
+ return createHash36("sha256").update(readFileSync80(path2)).digest("hex");
188861
188923
  } catch {
188862
188924
  return null;
188863
188925
  }
@@ -197208,14 +197270,14 @@ function renderBase44Types(entities, app2) {
197208
197270
  const names2 = exportNames(candidates, app2);
197209
197271
  const exportName = (e2) => names2.get(e2);
197210
197272
  const sortKey = (e2) => `${exportName(e2)}\0${physicalEntityName(e2, app2)}`;
197211
- const usable = [...candidates].sort((a3, b3) => sortKey(a3) < sortKey(b3) ? -1 : sortKey(a3) > sortKey(b3) ? 1 : 0);
197273
+ const usable2 = [...candidates].sort((a3, b3) => sortKey(a3) < sortKey(b3) ? -1 : sortKey(a3) > sortKey(b3) ? 1 : 0);
197212
197274
  const L2 = [
197213
197275
  BASE44_TYPES_HEADER,
197214
197276
  "// Source: the base44.entities block in config.ts. Re-run `himi base44 types` after editing it;",
197215
197277
  "// `himi validate` reports base44-types-stale until you do."
197216
197278
  ];
197217
197279
  const body = [];
197218
- for (const e2 of usable) {
197280
+ for (const e2 of usable2) {
197219
197281
  const name = exportName(e2);
197220
197282
  const required3 = new Set(Array.isArray(e2.required) ? e2.required : []);
197221
197283
  const builtins = new Set(BASE44_BUILTIN_FIELDS);
@@ -197227,7 +197289,7 @@ function renderBase44Types(entities, app2) {
197227
197289
  }
197228
197290
  const text32 = body.join("\n");
197229
197291
  const types2 = ["Json", "JsonObject"].filter((t2) => new RegExp(`\\b${t2}\\b`).test(text32)).map((t2) => `type ${t2}`);
197230
- if (usable.length) L2.push(`import { ${["entities", ...types2].join(", ")} } from "@himalaya/base44";`);
197292
+ if (usable2.length) L2.push(`import { ${["entities", ...types2].join(", ")} } from "@himalaya/base44";`);
197231
197293
  return [...L2, ...body].join("\n") + "\n";
197232
197294
  }
197233
197295
  async function declaredEntities(dir) {
@@ -197504,11 +197566,11 @@ __export(account_screens_lint_exports, {
197504
197566
  reachableScreens: () => reachableScreens,
197505
197567
  staticNavTargets: () => staticNavTargets
197506
197568
  });
197507
- import { createHash as createHash36 } from "node:crypto";
197569
+ import { createHash as createHash37 } from "node:crypto";
197508
197570
  import ts19 from "typescript";
197509
197571
  function memberSignInIn(bundleJs) {
197510
197572
  if (![...MEMBER_SIGN_IN_VERBS, `.wix.${HOSTED_SIGN_IN_VERB}`, WIX_PLATFORM_SIGN_IN_ID].some((v2) => bundleJs.includes(v2)) && !AUTH_SIGN_IN_GATE.test(bundleJs)) return null;
197511
- const key4 = createHash36("sha1").update(bundleJs).digest("hex");
197573
+ const key4 = createHash37("sha1").update(bundleJs).digest("hex");
197512
197574
  const cached3 = PARSED.get(key4);
197513
197575
  if (cached3 !== void 0) return cached3;
197514
197576
  const found = parseMemberSignIn(bundleJs);
@@ -197753,7 +197815,7 @@ var init_account_screens_lint = __esm({
197753
197815
 
197754
197816
  // src/commands/template.ts
197755
197817
  import { mkdtempSync as mkdtempSync5, readFileSync as readFileSync92, existsSync as existsSync84, rmSync as rmSync24 } from "node:fs";
197756
- import { createHash as createHash37 } from "node:crypto";
197818
+ import { createHash as createHash38 } from "node:crypto";
197757
197819
  import { tmpdir as tmpdir6 } from "node:os";
197758
197820
  import { join as join82, resolve as resolve57, basename as basename22 } from "node:path";
197759
197821
  function embeddedTemplateCatalog() {
@@ -198155,7 +198217,7 @@ async function templateCommand(ctx) {
198155
198217
  if (!iconPath) return void 0;
198156
198218
  try {
198157
198219
  const bytes2 = readFileSync92(iconPath);
198158
- return { bytes: bytes2, hash: createHash37("sha256").update(bytes2).digest("hex") };
198220
+ return { bytes: bytes2, hash: createHash38("sha256").update(bytes2).digest("hex") };
198159
198221
  } catch {
198160
198222
  return void 0;
198161
198223
  }
@@ -198166,7 +198228,7 @@ async function templateCommand(ctx) {
198166
198228
  template: name,
198167
198229
  app: templateAppId,
198168
198230
  published: false,
198169
- sourceHash: createHash37("sha256").update(JSON.stringify(catalogView())).digest("hex"),
198231
+ sourceHash: createHash38("sha256").update(JSON.stringify(catalogView())).digest("hex"),
198170
198232
  iconHash: launcherIcon()?.hash ?? null
198171
198233
  });
198172
198234
  return 0;
@@ -199960,7 +200022,7 @@ var init_policy = __esm({
199960
200022
 
199961
200023
  // ../pre-pr-review/scope.mjs
199962
200024
  import { execFileSync as execFileSync6 } from "node:child_process";
199963
- import { createHash as createHash38 } from "node:crypto";
200025
+ import { createHash as createHash39 } from "node:crypto";
199964
200026
  import { resolve as resolve62, dirname as dirname51, isAbsolute as isAbsolute10, join as join88 } from "node:path";
199965
200027
  import { fileURLToPath as fileURLToPath32 } from "node:url";
199966
200028
  function resolveRepoRoot2(cwd = process.cwd()) {
@@ -199988,7 +200050,7 @@ function git(args, opts = {}) {
199988
200050
  }).toString();
199989
200051
  }
199990
200052
  function diffHash(diff) {
199991
- return createHash38("sha256").update(diff).digest("hex");
200053
+ return createHash39("sha256").update(diff).digest("hex");
199992
200054
  }
199993
200055
  var REPO_ROOT7, BASE_REF;
199994
200056
  var init_scope = __esm({
@@ -200014,7 +200076,7 @@ import {
200014
200076
  rmSync as rmSync25,
200015
200077
  writeFileSync as writeFileSync38
200016
200078
  } from "node:fs";
200017
- import { createHash as createHash39 } from "node:crypto";
200079
+ import { createHash as createHash40 } from "node:crypto";
200018
200080
  import { tmpdir as tmpdir7 } from "node:os";
200019
200081
  import { basename as basename23, dirname as dirname52, join as join89, resolve as resolve63 } from "node:path";
200020
200082
  import { pathToFileURL as pathToFileURL7 } from "node:url";
@@ -200092,7 +200154,7 @@ function stagedIdentity(head2, index, worktree) {
200092
200154
  }
200093
200155
  function blobOid(contents, algorithm2) {
200094
200156
  const body = Buffer.isBuffer(contents) ? contents : Buffer.from(contents);
200095
- return createHash39(algorithm2).update(Buffer.from(`blob ${body.byteLength}\0`)).update(body).digest("hex");
200157
+ return createHash40(algorithm2).update(Buffer.from(`blob ${body.byteLength}\0`)).update(body).digest("hex");
200096
200158
  }
200097
200159
  function validationDiffHash(cwd = process.cwd()) {
200098
200160
  const root = resolveRepoRoot2(cwd);
@@ -200266,7 +200328,7 @@ var init_diff_hash = __esm({
200266
200328
  run: () => {
200267
200329
  const { repo } = selfTestRepo({ withBase: true });
200268
200330
  try {
200269
- return validationDiffHash(repo) !== createHash39("sha256").update("validation-worktree-v2\0").digest("hex");
200331
+ return validationDiffHash(repo) !== createHash40("sha256").update("validation-worktree-v2\0").digest("hex");
200270
200332
  } finally {
200271
200333
  rmSync25(repo, { recursive: true, force: true });
200272
200334
  }
@@ -200448,32 +200510,6 @@ var init_attestation_lock = __esm({
200448
200510
  }
200449
200511
  });
200450
200512
 
200451
- // ../../core/serve-storage/src/release-payload-hash.ts
200452
- import { createHash as createHash40 } from "node:crypto";
200453
- function canonical2(value2) {
200454
- if (value2 === null || typeof value2 !== "object") return JSON.stringify(value2);
200455
- if (Array.isArray(value2)) return `[${value2.map(canonical2).join(",")}]`;
200456
- const record6 = value2;
200457
- return `{${Object.keys(record6).filter((key4) => record6[key4] !== void 0).sort().map((key4) => `${JSON.stringify(key4)}:${canonical2(record6[key4])}`).join(",")}}`;
200458
- }
200459
- function releasePayloadHash(payload) {
200460
- const hash3 = (value2) => createHash40("sha256").update(canonical2(value2)).digest("hex");
200461
- if (!payload || typeof payload !== "object" || Array.isArray(payload)) return hash3(payload);
200462
- const { catalogs: _catalogBytes, ...record6 } = payload;
200463
- const manifest2 = record6.manifest;
200464
- if (!manifest2 || typeof manifest2 !== "object" || Array.isArray(manifest2)) return hash3(record6);
200465
- const manifestRecord = manifest2;
200466
- const widgets = manifestRecord.widgets;
200467
- if (!widgets || typeof widgets !== "object" || Array.isArray(widgets)) return hash3(record6);
200468
- return hash3({ ...record6, manifest: { ...manifestRecord, widgets: stableWidgets(widgets) } });
200469
- }
200470
- var init_release_payload_hash = __esm({
200471
- "../../core/serve-storage/src/release-payload-hash.ts"() {
200472
- init_define_HHP_CATALOG();
200473
- init_widget_identity();
200474
- }
200475
- });
200476
-
200477
200513
  // src/attestation.ts
200478
200514
  import { execFileSync as execFileSync7 } from "node:child_process";
200479
200515
  import { createHash as createHash41, randomBytes as randomBytes3 } from "node:crypto";
@@ -226108,9 +226144,9 @@ async function recordJob(record6, job, opts) {
226108
226144
  for (const path2 of removed)
226109
226145
  out2.warnings.push(`left ${path2} out of the record: it looks like a secret`);
226110
226146
  const raw = job.result?.ids ?? [];
226111
- const usable = (id) => typeof id === "string" && !hasSecretShape(id);
226112
- const ids2 = raw.filter(usable);
226113
- const idAt = (i2) => usable(raw[i2]) ? raw[i2] : void 0;
226147
+ const usable2 = (id) => typeof id === "string" && !hasSecretShape(id);
226148
+ const ids2 = raw.filter(usable2);
226149
+ const idAt = (i2) => usable2(raw[i2]) ? raw[i2] : void 0;
226114
226150
  const p2 = Object.fromEntries(Object.entries(params).filter(([k3]) => !APPROVAL_KEYS.includes(k3)));
226115
226151
  const c2 = { record: record6, app: app2, job, p: p2, ids: ids2, idAt, at: at2, warnings: out2.warnings };
226116
226152
  let complete = true;
@@ -235366,7 +235402,7 @@ var init_media_sets = __esm({
235366
235402
  return pollUntil(() => this.asset(id), done, { clock: this.clock, intervalMs: mediaPollInterval(1, this.pollMs), nextIntervalMs: () => mediaPollInterval(++checks + 1, this.pollMs), timeoutMs, what });
235367
235403
  }
235368
235404
  async plan(versionId, spec) {
235369
- const { sets: setPath, typeAttr, perSet, usable } = this.kind;
235405
+ const { sets: setPath, typeAttr, perSet, usable: usable2 } = this.kind;
235370
235406
  const changes = [];
235371
235407
  const locs = flatList((await this.t.list(`/v1/appStoreVersions/${encodeURIComponent(versionId)}/appStoreVersionLocalizations`)).data);
235372
235408
  for (const [locale, sets] of Object.entries(spec)) {
@@ -235383,7 +235419,7 @@ var init_media_sets = __esm({
235383
235419
  const kept = [];
235384
235420
  const deletes = [];
235385
235421
  for (const shot of shots) {
235386
- const keep = shot.sourceFileChecksum && wanted.has(shot.sourceFileChecksum) && !kept.includes(shot.sourceFileChecksum) && usable(shot);
235422
+ const keep = shot.sourceFileChecksum && wanted.has(shot.sourceFileChecksum) && !kept.includes(shot.sourceFileChecksum) && usable2(shot);
235387
235423
  const change2 = { op: keep ? "keep" : "delete", locale, displayType, fileName: shot.fileName, checksum: shot.sourceFileChecksum, id: shot.id, localizationId: loc.id, setId: set3.id };
235388
235424
  changes.push(change2);
235389
235425
  if (keep)
@@ -242549,7 +242585,7 @@ async function screenshotWrites(c2, refs, version5) {
242549
242585
  if (!segment(displayType) || !Array.isArray(files))
242550
242586
  continue;
242551
242587
  const images = [];
242552
- let usable = true;
242588
+ let usable2 = true;
242553
242589
  for (const f2 of files) {
242554
242590
  const name = f2.fileName ?? (f2.path ? basename30(f2.path) : "?");
242555
242591
  let bytes2;
@@ -242559,24 +242595,24 @@ async function screenshotWrites(c2, refs, version5) {
242559
242595
  bytes2 = new Uint8Array(await readFile19(f2.path));
242560
242596
  } catch (e2) {
242561
242597
  c2.warnings.push(`${locale} ${displayType}: could not read ${name} to record it (${message4(e2)}), so that set was left out of the record`);
242562
- usable = false;
242598
+ usable2 = false;
242563
242599
  break;
242564
242600
  }
242565
242601
  const md53 = md5Hex(bytes2);
242566
242602
  if (f2.md5 && md53 !== f2.md5.toLowerCase()) {
242567
242603
  c2.warnings.push(`${locale} ${displayType}: ${name} changed after the job (md5 differs), so that set was left out of the record`);
242568
- usable = false;
242604
+ usable2 = false;
242569
242605
  break;
242570
242606
  }
242571
242607
  if (!sniffType(bytes2)) {
242572
242608
  c2.warnings.push(`${locale} ${displayType}: ${name} is not a PNG, JPEG or WebP, so that set was left out of the record`);
242573
- usable = false;
242609
+ usable2 = false;
242574
242610
  break;
242575
242611
  }
242576
242612
  const ref = await c2.record.putBlob(bytes2, sniffType(bytes2));
242577
242613
  images.push({ ...ref, md5: md53, fileName: name });
242578
242614
  }
242579
- if (usable)
242615
+ if (usable2)
242580
242616
  writes.push({ path: APPLE.screenshots(version5, locale, displayType), schema: "apple.screenshots@1", older: REPLACE2, update: replace2({ locale, displayType, images }) });
242581
242617
  }
242582
242618
  }
@@ -242956,9 +242992,9 @@ async function recordAppleJob(record6, job, opts = {}) {
242956
242992
  if (!/^params\.\w*PasswordEnv$/.test(path2))
242957
242993
  out2.warnings.push(`left ${path2} out of the record: it looks like a secret`);
242958
242994
  const raw = job.result?.ids ?? [];
242959
- const usable = (id) => typeof id === "string" && id !== "" && !hasSecretShape(id);
242960
- const ids2 = raw.filter(usable);
242961
- const idAt = (i2) => usable(raw[i2]) ? raw[i2] : void 0;
242995
+ const usable2 = (id) => typeof id === "string" && id !== "" && !hasSecretShape(id);
242996
+ const ids2 = raw.filter(usable2);
242997
+ const idAt = (i2) => usable2(raw[i2]) ? raw[i2] : void 0;
242962
242998
  const c2 = { record: record6, app: app2, job, p: params, facts: obj21(job.plan?.facts), ids: ids2, idAt, at: at2, look, warnings: out2.warnings };
242963
242999
  let complete = true;
242964
243000
  const why = agreementOf2(job);
@@ -261676,9 +261712,9 @@ async function runInputEvidenceChild(ctx) {
261676
261712
  }
261677
261713
  }
261678
261714
  async function inputEvidenceSourceArchiveHash(dir) {
261679
- const { createHash: createHash106 } = await import("node:crypto");
261715
+ const { createHash: createHash107 } = await import("node:crypto");
261680
261716
  const { collectAppSource: collectAppSource2, zipAppSource: zipAppSource2 } = await Promise.resolve().then(() => (init_app_source(), app_source_exports));
261681
- return createHash106("sha256").update(zipAppSource2(collectAppSource2(dir).entries).toString("base64")).digest("hex");
261717
+ return createHash107("sha256").update(zipAppSource2(collectAppSource2(dir).entries).toString("base64")).digest("hex");
261682
261718
  }
261683
261719
  var init_input_evidence_isolation = __esm({
261684
261720
  "src/input-evidence-isolation.ts"() {
@@ -265912,7 +265948,7 @@ async function uploadLargeAssets(client4, app2, uploads) {
265912
265948
  return fail18(
265913
265949
  "large_assets_unavailable",
265914
265950
  `this serve plane keeps large assets in its own store, up to ${limit} bytes each, and this one is ${u2.bytes}`,
265915
- `make the asset smaller than ${limit} bytes, or an operator must set LARGE_ASSET_S3 and its key pair on the plane`,
265951
+ `make the asset smaller than ${limit} bytes, push with --media-site <metaSiteId> to keep it in that site's Media Manager, or an operator must set LARGE_ASSET_S3 and its key pair on the plane`,
265916
265952
  { status: first.status, body: j2 }
265917
265953
  );
265918
265954
  }
@@ -265920,7 +265956,7 @@ async function uploadLargeAssets(client4, app2, uploads) {
265920
265956
  return fail18(
265921
265957
  "large_assets_unavailable",
265922
265958
  "this serve plane has no large asset channel configured",
265923
- "an operator must set LARGE_ASSET_S3 and its key pair on the plane, or move the asset under the inline cap",
265959
+ "push with --media-site <metaSiteId> to keep large assets in that site's Media Manager, or an operator must set LARGE_ASSET_S3 and its key pair on the plane, or move the asset under the inline cap",
265924
265960
  { status: first.status, body: j2 }
265925
265961
  );
265926
265962
  }
@@ -267574,7 +267610,14 @@ var init_push_errors = __esm({
267574
267610
  "large_asset_upload_failed",
267575
267611
  "large_asset_missing",
267576
267612
  "large_asset_quota_exceeded",
267577
- "large_asset_tag_failed"
267613
+ "large_asset_tag_failed",
267614
+ "media_site_invalid",
267615
+ "media_site_refused",
267616
+ "media_upload_failed",
267617
+ "media_asset_unsupported",
267618
+ "media_asset_missing",
267619
+ "invalid_media_asset",
267620
+ "media_placement_live"
267578
267621
  ];
267579
267622
  UX_CODES = {
267580
267623
  absent: "ux_evidence_absent",
@@ -267594,6 +267637,119 @@ var init_push_errors = __esm({
267594
267637
  }
267595
267638
  });
267596
267639
 
267640
+ // ../serve-cli/src/media-assets.ts
267641
+ var media_assets_exports = {};
267642
+ __export(media_assets_exports, {
267643
+ isMediaArchiveName: () => isMediaArchiveName,
267644
+ mediaFileName: () => mediaFileName,
267645
+ placeLargeAssetsInMedia: () => placeLargeAssetsInMedia,
267646
+ withMediaPlacements: () => withMediaPlacements
267647
+ });
267648
+ import { createHash as createHash86 } from "node:crypto";
267649
+ function isMediaArchiveName(name) {
267650
+ return /\.zip$/i.test(name);
267651
+ }
267652
+ function mediaFileName(u2) {
267653
+ const ext = /\.([A-Za-z0-9]{1,8})$/.exec(u2.names[0] ?? "")?.[1]?.toLowerCase() ?? "bin";
267654
+ return `himi-${u2.sha256}.${ext}`;
267655
+ }
267656
+ function usable(f2, siteId, bytes2, md53) {
267657
+ return !!f2 && typeof f2.id === "string" && f2.private === false && f2.operationStatus === "READY" && String(f2.sizeInBytes) === String(bytes2) && f2.hash === md53 && isMediaArchiveUrl(fileUrl(f2), siteId);
267658
+ }
267659
+ async function placeLargeAssetsInMedia(opts) {
267660
+ const { siteId, uploads } = opts;
267661
+ let token = opts.token;
267662
+ const f2 = opts.fetchImpl ?? fetch;
267663
+ const sleep5 = opts.sleep ?? ((ms2) => new Promise((r3) => setTimeout(r3, ms2)));
267664
+ const api4 = async (path2, body, method = "POST") => {
267665
+ const call = () => f2(`${API2}/${path2}`, { method, headers: { Authorization: token, "wix-site-id": siteId, ...body ? { "Content-Type": "application/json" } : {} }, ...body ? { body: JSON.stringify(body) } : {} });
267666
+ let res = await call();
267667
+ if (res.status === 401 && opts.refreshToken) {
267668
+ const fresh = await opts.refreshToken(token);
267669
+ if (fresh && fresh !== token) {
267670
+ token = fresh;
267671
+ res = await call();
267672
+ }
267673
+ }
267674
+ return { status: res.status, ok: res.ok, json: await res.json().catch(() => ({})) };
267675
+ };
267676
+ const unsupported2 = uploads.find((u2) => !u2.names.every(isMediaArchiveName));
267677
+ if (unsupported2) {
267678
+ return { ok: false, code: "media_asset_unsupported", error: `Media Manager can keep only .zip archives for a release, not ${unsupported2.names.join(", ")}`, sha256: unsupported2.sha256, names: unsupported2.names, hint: "pack the asset in a .zip, or keep it under the inline asset cap" };
267679
+ }
267680
+ const placed = [];
267681
+ let bytesUploaded = 0;
267682
+ for (const u2 of uploads) {
267683
+ const fail18 = (code3, error, hint, status2) => ({ ok: false, code: code3, error, sha256: u2.sha256, names: u2.names, ...status2 ? { status: status2 } : {}, hint });
267684
+ const name = mediaFileName(u2);
267685
+ const bytes2 = await u2.read();
267686
+ const md53 = createHash86("md5").update(bytes2).digest("hex");
267687
+ if (createHash86("sha256").update(bytes2).digest("hex") !== u2.sha256) {
267688
+ return fail18("media_upload_failed", `the bytes of ${u2.names[0]} do not match the sha256 the release names`, "rebuild the release and push again");
267689
+ }
267690
+ const found = await api4("files/search", { search: name, mediaTypes: ["ARCHIVE", "DOCUMENT"] });
267691
+ if (found.status === 401 || found.status === 403) {
267692
+ return fail18("media_site_refused", `the site ${siteId} refused Media Manager access`, "check that you can manage that site's media (wix login), or pass another --media-site", found.status);
267693
+ }
267694
+ if (!found.ok) return fail18("media_upload_failed", "Media Manager did not answer the search for an earlier upload", "push again", found.status);
267695
+ const existing = (found.json.files ?? []).find((x2) => x2.displayName === name && usable(x2, siteId, u2.bytes, md53));
267696
+ if (existing) {
267697
+ placed.push({ sha256: u2.sha256, url: fileUrl(existing), fileId: existing.id, reused: true });
267698
+ continue;
267699
+ }
267700
+ const mint = await api4("files/generate-resumable-upload-url", { mimeType: "application/zip", fileName: name, sizeInBytes: String(u2.bytes), private: false, uploadProtocol: "TUS" });
267701
+ const uploadUrl = mint.json.uploadUrl;
267702
+ const uploadToken = mint.json.uploadToken;
267703
+ if (!mint.ok || typeof uploadUrl !== "string" || typeof uploadToken !== "string" || new URL(uploadUrl).host !== "upload.wixmp.com") {
267704
+ if (mint.status === 401 || mint.status === 403) return fail18("media_site_refused", `the site ${siteId} refused a Media Manager upload`, "check that you can manage that site's media (wix login), or pass another --media-site", mint.status);
267705
+ return fail18("media_upload_failed", "Media Manager did not grant an upload", "retry the push; if it persists, check the site's storage quota", mint.status);
267706
+ }
267707
+ const b643 = (s5) => Buffer.from(s5).toString("base64");
267708
+ const create = await f2(uploadUrl, { method: "POST", headers: { "Tus-Resumable": "1.0.0", "Upload-Length": String(u2.bytes), "Upload-Metadata": `filename ${b643(name)},acl ${b643("public")},token ${b643(uploadToken)}` } });
267709
+ const location = create.headers.get("location");
267710
+ if (create.status !== 201 || !location) return fail18("media_upload_failed", "Media Manager did not open an upload session", "retry the push", create.status);
267711
+ const session = new URL(location, uploadUrl);
267712
+ if (session.host !== "upload.wixmp.com") return fail18("media_upload_failed", "Media Manager answered with an unexpected upload host", "retry the push");
267713
+ const patch = await f2(session.toString(), { method: "PATCH", body: bytes2, headers: { "Tus-Resumable": "1.0.0", "Upload-Offset": "0", "Content-Type": "application/offset+octet-stream" } });
267714
+ if (patch.status !== 204 || patch.headers.get("upload-offset") !== String(u2.bytes)) return fail18("media_upload_failed", "Media Manager did not take all the bytes", "retry the push", patch.status);
267715
+ const finish3 = await f2(`${uploadUrl.replace(/\/+$/, "")}/${uploadToken}?${new URLSearchParams({ filename: name, acl: "public", token: uploadToken })}`, { method: "PUT", headers: { "Content-Type": "application/json" } });
267716
+ const finished = await finish3.json().catch(() => ({}));
267717
+ let file2 = finished.file;
267718
+ if (!finish3.ok || typeof file2?.id !== "string") return fail18("media_upload_failed", "Media Manager did not create the file", "retry the push", finish3.status);
267719
+ bytesUploaded += u2.bytes;
267720
+ for (let i2 = 0; i2 < READY_MAX_POLLS && file2?.operationStatus !== "READY" && file2?.operationStatus !== "FAILED"; i2++) {
267721
+ await sleep5(READY_POLL_MS);
267722
+ const got = await api4(`files/${encodeURIComponent(file2.id)}`, void 0, "GET");
267723
+ file2 = got.json.file ?? file2;
267724
+ }
267725
+ if (!usable(file2, siteId, u2.bytes, md53)) {
267726
+ return fail18("media_upload_failed", `Media Manager did not end with a public, ready archive of these bytes (status ${String(file2?.operationStatus)})`, "retry the push; a repeat finds a good earlier upload");
267727
+ }
267728
+ placed.push({ sha256: u2.sha256, url: fileUrl(file2), fileId: file2.id, reused: false });
267729
+ }
267730
+ return { ok: true, placed, bytesUploaded };
267731
+ }
267732
+ function withMediaPlacements(manifest2, siteId, placed) {
267733
+ const bySha = new Map(placed.map((p2) => [p2.sha256, p2]));
267734
+ const assets = {};
267735
+ for (const [name, rec] of Object.entries(manifest2.assets ?? {})) {
267736
+ const p2 = rec?.storage === "large" ? bySha.get(rec.sha256) : void 0;
267737
+ assets[name] = p2 ? { ...rec, storage: "media", url: p2.url, mediaSiteId: siteId } : rec;
267738
+ }
267739
+ return { ...manifest2, assets };
267740
+ }
267741
+ var API2, READY_POLL_MS, READY_MAX_POLLS, fileUrl;
267742
+ var init_media_assets = __esm({
267743
+ "../serve-cli/src/media-assets.ts"() {
267744
+ init_define_HHP_CATALOG();
267745
+ init_contract();
267746
+ API2 = "https://www.wixapis.com/site-media/v1";
267747
+ READY_POLL_MS = 2e3;
267748
+ READY_MAX_POLLS = 90;
267749
+ fileUrl = (f2) => typeof f2.media?.archive?.url === "string" ? f2.media.archive.url : f2.url;
267750
+ }
267751
+ });
267752
+
267597
267753
  // src/login-refresh.ts
267598
267754
  var login_refresh_exports = {};
267599
267755
  __export(login_refresh_exports, {
@@ -267765,7 +267921,7 @@ var init_ring_pins = __esm({
267765
267921
  });
267766
267922
 
267767
267923
  // src/commands/push.ts
267768
- import { createHash as createHash86 } from "node:crypto";
267924
+ import { createHash as createHash87 } from "node:crypto";
267769
267925
  import { existsSync as existsSync138 } from "node:fs";
267770
267926
  import { join as join172, relative as relative32 } from "node:path";
267771
267927
  function loopbackTargetWarning(base2, explicitTarget) {
@@ -267836,6 +267992,17 @@ function designSummary(output) {
267836
267992
  return "failed";
267837
267993
  }
267838
267994
  }
267995
+ async function mediaSiteToken(site, from) {
267996
+ if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(site)) {
267997
+ return { ok: false, code: "media_site_invalid", fields: { ok: false, pushed: false, site, error: `${from} must be a site's metaSiteId (a uuid), not ${JSON.stringify(site)}`, hint: "`himi site list` shows each site's id" } };
267998
+ }
267999
+ const { siteToken: siteToken2 } = await Promise.resolve().then(() => (init_wix_owner(), wix_owner_exports));
268000
+ try {
268001
+ return { ok: true, token: await siteToken2(site) };
268002
+ } catch (e2) {
268003
+ return { ok: false, code: "media_site_refused", fields: { ok: false, pushed: false, site, error: `no Wix token for site ${site} (${from}): ${e2.message}`, hint: "sign in with an account that manages that site (`wix login`), or pass another --media-site" } };
268004
+ }
268005
+ }
267839
268006
  async function pushCommand(ctx) {
267840
268007
  const { argv, io: io2, flags, uxEvidenceCode: uxEvidenceCode2, pushFailure: pushFailure2, print, contextualDefaultTarget, targetName: targetName2, client: client4, serveBase, runReleasePatch, patchBlastRadius } = ctx;
267841
268008
  const dir = contentDir(flags);
@@ -267857,7 +268024,8 @@ async function pushCommand(ctx) {
267857
268024
  }
267858
268025
  for (const [flag3, why] of [
267859
268026
  ["no-source", "a patch never archives source \u2014 the derived release inherits the base's archive"],
267860
- ["visibility", "the patch route does not stamp visibility; set it with `himi visibility` instead"]
268027
+ ["visibility", "the patch route does not stamp visibility; set it with `himi visibility` instead"],
268028
+ ["media-site", "a patch never uploads large assets \u2014 the derived release keeps the base's"]
267861
268029
  ]) {
267862
268030
  if (flags[flag3] !== void 0) {
267863
268031
  io2.error(JSON.stringify(pushFailure2("incompatible_push_flags", { error: `--${flag3} is not meaningful with --only`, message: why, usage: ONLY_USAGE })));
@@ -267883,14 +268051,14 @@ async function pushCommand(ctx) {
267883
268051
  if (pushTokenHealth.expired) {
267884
268052
  const { loadTargetsFile: loadTargetsFile2 } = await Promise.resolve().then(() => (init_config(), config_exports));
267885
268053
  const configured = loadTargetsFile2();
267886
- const usable = Object.keys(configured.targets ?? {}).filter((n2) => n2 !== pushTarget).filter((n2) => inspectControlToken(configured.targets?.[n2]?.controlToken).valid).sort().map((n2) => ({ target: n2, control: configured.targets?.[n2]?.control }));
268054
+ const usable2 = Object.keys(configured.targets ?? {}).filter((n2) => n2 !== pushTarget).filter((n2) => inspectControlToken(configured.targets?.[n2]?.controlToken).valid).sort().map((n2) => ({ target: n2, control: configured.targets?.[n2]?.control }));
267887
268055
  io2.error(JSON.stringify(pushFailure2("control_token_expired", {
267888
268056
  ok: false,
267889
268057
  pushed: false,
267890
268058
  error: "control_token_expired",
267891
268059
  target: pushTarget,
267892
- ...usable.length ? { usableTargets: usable } : {},
267893
- hint: `${pushAuthHint(401, pushToken, pushTarget, !!ownerIssue)}` + (usable.length ? ` \u2014 you are also logged in for ${usable.map((u2) => `${u2.target}${u2.control ? ` (${u2.control})` : ""}`).join(", ")}, but check the plane before switching: a different target publishes somewhere else and claims the slug there.` : "")
268060
+ ...usable2.length ? { usableTargets: usable2 } : {},
268061
+ hint: `${pushAuthHint(401, pushToken, pushTarget, !!ownerIssue)}` + (usable2.length ? ` \u2014 you are also logged in for ${usable2.map((u2) => `${u2.target}${u2.control ? ` (${u2.control})` : ""}`).join(", ")}, but check the plane before switching: a different target publishes somewhere else and claims the slug there.` : "")
267894
268062
  })));
267895
268063
  return 1;
267896
268064
  }
@@ -268063,7 +268231,7 @@ async function pushCommand(ctx) {
268063
268231
  try {
268064
268232
  const { collectAppSource: collectAppSource2, zipAppSource: zipAppSource2, PUSH_EXCLUDED_ROOTS: PUSH_EXCLUDED_ROOTS2 } = await Promise.resolve().then(() => (init_app_source(), app_source_exports));
268065
268233
  const { largeAssetSourcePaths: largeAssetSourcePaths2 } = await Promise.resolve().then(() => (init_app_assets(), app_assets_exports));
268066
- localSourceHash = createHash86("sha256").update(zipAppSource2(collectAppSource2(dir, { excludeRoots: PUSH_EXCLUDED_ROOTS2, excludePaths: largeAssetSourcePaths2(dir) }).entries).toString("base64")).digest("hex");
268234
+ localSourceHash = createHash87("sha256").update(zipAppSource2(collectAppSource2(dir, { excludeRoots: PUSH_EXCLUDED_ROOTS2, excludePaths: largeAssetSourcePaths2(dir) }).entries).toString("base64")).digest("hex");
268067
268235
  } catch {
268068
268236
  }
268069
268237
  const staleShared = staleSharedWarnings(report9);
@@ -268199,6 +268367,20 @@ async function pushCommand(ctx) {
268199
268367
  }
268200
268368
  }
268201
268369
  const extensionsBody = extensionUploads2(preparedExtensions);
268370
+ const explicitMediaSite = typeof flags["media-site"] === "string" && flags["media-site"].trim() ? flags["media-site"].trim().toLowerCase() : void 0;
268371
+ if (flags["media-site"] !== void 0 && !explicitMediaSite) {
268372
+ print(pushFailure2("media_site_invalid", { ok: false, app: app2, pushed: false, error: "--media-site needs a site's metaSiteId", hint: "`himi site list` shows each site's id" }));
268373
+ return 1;
268374
+ }
268375
+ let explicitMediaToken;
268376
+ if (explicitMediaSite) {
268377
+ const site = await mediaSiteToken(explicitMediaSite, "--media-site");
268378
+ if (!site.ok) {
268379
+ print(pushFailure2(site.code, { app: app2, ...site.fields }));
268380
+ return 1;
268381
+ }
268382
+ explicitMediaToken = site.token;
268383
+ }
268202
268384
  const uxEvidence = handoverUxEvidence(dir, {
268203
268385
  releaseId: manifest2.releaseId,
268204
268386
  releaseHash: releasePayloadHash(payload),
@@ -268338,7 +268520,37 @@ async function pushCommand(ctx) {
268338
268520
  const publishPayload = publishBodyFor(app2);
268339
268521
  const largeUploads = await largeAssetUploadsFromDir(declared, out2);
268340
268522
  let largeAssetReport;
268341
- if (largeUploads.length > 0) {
268523
+ let mediaAssetReport;
268524
+ const placeInMedia = async (site, token, uploads = largeUploads) => {
268525
+ const { placeLargeAssetsInMedia: placeLargeAssetsInMedia2, withMediaPlacements: withMediaPlacements2 } = await Promise.resolve().then(() => (init_media_assets(), media_assets_exports));
268526
+ let placed;
268527
+ try {
268528
+ const refreshToken = async (sent) => {
268529
+ const { dropExchangedSiteToken: dropExchangedSiteToken2, siteToken: siteToken2 } = await Promise.resolve().then(() => (init_wix_owner(), wix_owner_exports));
268530
+ return dropExchangedSiteToken2(site, sent) ? await siteToken2(site).catch(() => void 0) : void 0;
268531
+ };
268532
+ placed = await placeLargeAssetsInMedia2({ siteId: site, token, refreshToken, uploads });
268533
+ } catch (e2) {
268534
+ print(pushFailure2("media_upload_failed", { ok: false, app: app2, pushed: false, site, error: `the Media Manager upload did not complete: ${e2.message}`, hint: "check the connection and push again; a good earlier upload is found and reused" }));
268535
+ return 1;
268536
+ }
268537
+ if (!placed.ok) {
268538
+ const { ok: _ok, code: code3, ...rest } = placed;
268539
+ void _ok;
268540
+ print(pushFailure2(code3, { ok: false, app: app2, pushed: false, site, ...rest }));
268541
+ return 1;
268542
+ }
268543
+ publishPayload.manifest = withMediaPlacements2(publishPayload.manifest, site, placed.placed);
268544
+ const placedSize = measurePublishBody(publishPayload, meta, draft);
268545
+ const placedAdmission = admitPublishBody2(placedSize, { eligibility: eligibilityFor(app2) });
268546
+ if (!placedAdmission.ok) return refuseOversizedBody(app2, placedSize, placedAdmission.compressedUpload);
268547
+ mediaAssetReport = { site, uploaded: placed.placed.filter((p2) => !p2.reused).length, reused: placed.placed.filter((p2) => p2.reused).length, bytesUploaded: placed.bytesUploaded };
268548
+ return void 0;
268549
+ };
268550
+ if (largeUploads.length > 0 && explicitMediaSite && explicitMediaToken) {
268551
+ const failed2 = await placeInMedia(explicitMediaSite, explicitMediaToken);
268552
+ if (failed2 !== void 0) return failed2;
268553
+ } else if (largeUploads.length > 0) {
268342
268554
  const { uploadLargeAssets: uploadLargeAssets2 } = await Promise.resolve().then(() => (init_large_assets(), large_assets_exports));
268343
268555
  let up2;
268344
268556
  try {
@@ -268350,16 +268562,27 @@ async function pushCommand(ctx) {
268350
268562
  })));
268351
268563
  return 1;
268352
268564
  }
268353
- if (!up2.ok) {
268354
- const { ok: _ok, code: code3, ...rest } = up2;
268565
+ const loginSite = outcome.auth?.siteId?.trim().toLowerCase();
268566
+ const { isMediaArchiveName: isMediaArchiveName2 } = await Promise.resolve().then(() => (init_media_assets(), media_assets_exports));
268567
+ const rest = up2.ok ? [] : largeUploads.slice(Math.max(0, largeUploads.findIndex((u2) => u2.sha256 === up2.sha256)));
268568
+ if (!up2.ok && up2.code === "large_assets_unavailable" && loginSite && rest.every((u2) => u2.names.every(isMediaArchiveName2))) {
268569
+ const site = await mediaSiteToken(loginSite, "the app's Wix login (auth siteId)");
268570
+ if (!site.ok) {
268571
+ print(pushFailure2(site.code, { app: app2, ...site.fields }));
268572
+ return 1;
268573
+ }
268574
+ const failed2 = await placeInMedia(loginSite, site.token, rest);
268575
+ if (failed2 !== void 0) return failed2;
268576
+ } else if (!up2.ok) {
268577
+ const { ok: _ok, code: code3, ...rest2 } = up2;
268355
268578
  void _ok;
268356
268579
  const fed = up2.status !== void 0 ? (await Promise.resolve().then(() => (init_push_errors(), push_errors_exports))).federatedRefusal(up2.status, up2.body, pushToken) : void 0;
268357
268580
  const hint = fed?.code === "federated_not_allowed" ? `assets over the inline cap (${up2.names.join(", ")}) need a Wix sign-in (\`himi login --device --provider wix\`); accounts signed in without Wix can push a release without them \u2014 shrink or remove those assets` : fed?.hint;
268358
- if (fed) print(pushFailure2(fed.code, { ok: false, app: app2, pushed: false, ...rest, hint }));
268359
- else print(pushFailure2(code3, { ok: false, app: app2, pushed: false, ...rest }));
268581
+ if (fed) print(pushFailure2(fed.code, { ok: false, app: app2, pushed: false, ...rest2, hint }));
268582
+ else print(pushFailure2(code3, { ok: false, app: app2, pushed: false, ...rest2 }));
268360
268583
  return 1;
268361
268584
  }
268362
- largeAssetReport = { uploaded: up2.uploaded.length, alreadyStored: up2.alreadyStored.length, bytesUploaded: up2.bytesUploaded };
268585
+ if (up2.ok) largeAssetReport = { uploaded: up2.uploaded.length, alreadyStored: up2.alreadyStored.length, bytesUploaded: up2.bytesUploaded };
268363
268586
  }
268364
268587
  let r3;
268365
268588
  try {
@@ -268393,11 +268616,14 @@ async function pushCommand(ctx) {
268393
268616
  }
268394
268617
  }
268395
268618
  }
268396
- if (!r3.ok && ["large_asset_missing", "large_assets_unavailable", "large_asset_tag_failed"].includes(String(r3.json?.error))) {
268619
+ if (!r3.ok && ["large_asset_missing", "large_assets_unavailable", "large_asset_tag_failed", "media_asset_missing", "invalid_media_asset", "media_placement_live"].includes(String(r3.json?.error))) {
268397
268620
  const j2 = r3.json;
268398
268621
  const hints = {
268399
268622
  large_asset_missing: "push again: the upload is retried and already-stored assets are skipped",
268400
- large_assets_unavailable: "an operator must set LARGE_ASSET_S3 and its key pair on the plane",
268623
+ large_assets_unavailable: "an operator must set LARGE_ASSET_S3 and its key pair on the plane, or push with --media-site <metaSiteId> to keep large assets in that site's Media Manager",
268624
+ media_asset_missing: "the file is gone from the site's media or not public: push again with --media-site to upload it again (with --live if the release is live)",
268625
+ invalid_media_asset: "push with a current himi: the release names a media file that is not its site's public archive",
268626
+ media_placement_live: "this release is live: push again with --live (and --media-site) so live players get the new archive",
268401
268627
  large_asset_tag_failed: "push again; if it keeps failing, the plane's key pair lacks s3:PutObjectTagging on the large asset bucket"
268402
268628
  };
268403
268629
  print(pushFailure2(j2.error, {
@@ -268558,7 +268784,7 @@ async function pushCommand(ctx) {
268558
268784
  ...effectiveVisibility === "unlisted" ? { visibilityNote: "not listed in /v1/apps or the player picker \u2014 share it via the preview links below, or run `himi visibility public` to list it" } : {},
268559
268785
  screens: Object.keys(payload.screens).length,
268560
268786
  bundles: Object.keys(payload.bundles).length,
268561
- ...assetSummary ? { assets: { ...assetSummary, ...largeAssetReport ? { largeUpload: largeAssetReport } : {} } } : {},
268787
+ ...assetSummary ? { assets: { ...assetSummary, ...largeAssetReport ? { largeUpload: largeAssetReport } : {}, ...mediaAssetReport ? { mediaUpload: mediaAssetReport } : {} } } : {},
268562
268788
  // WHAT LEFT THIS MACHINE, and how to get it back. Silence would make both halves
268563
268789
  // invisible: nobody would know their code is stored on Wix infrastructure, and nobody
268564
268790
  // would know a restore exists.
@@ -269124,7 +269350,7 @@ var init_preview_assets_format = __esm({
269124
269350
 
269125
269351
  // src/preview-embed-cache.ts
269126
269352
  import { spawnSync as spawnSync12 } from "node:child_process";
269127
- import { createHash as createHash87 } from "node:crypto";
269353
+ import { createHash as createHash88 } from "node:crypto";
269128
269354
  import { existsSync as existsSync140, mkdirSync as mkdirSync60, readdirSync as readdirSync60, readFileSync as readFileSync162, renameSync as renameSync22, rmSync as rmSync40, writeFileSync as writeFileSync64 } from "node:fs";
269129
269355
  import { join as join174 } from "node:path";
269130
269356
  import { pathToFileURL as pathToFileURL10 } from "node:url";
@@ -269152,7 +269378,7 @@ function previewEmbedKey(repoRoot2) {
269152
269378
  if (ids2.length !== PREVIEW_EMBED_KEY_ROOTS.length) return null;
269153
269379
  const webs = appWebTrees(repoRoot2);
269154
269380
  if (!webs) return null;
269155
- return createHash87("sha256").update([...ids2, ...webs].join("\n")).digest("hex").slice(0, 24);
269381
+ return createHash88("sha256").update([...ids2, ...webs].join("\n")).digest("hex").slice(0, 24);
269156
269382
  }
269157
269383
  function entriesWithContentTypes(manifest2, lib) {
269158
269384
  return lib.manifestEntries(manifest2).map((e2) => {
@@ -270366,6 +270592,8 @@ function makeServeHandler(opts) {
270366
270592
  }
270367
270593
  const PINNED_MANIFEST_CACHE_CAP = 100;
270368
270594
  const pinnedManifestCache = /* @__PURE__ */ new Map();
270595
+ const pinnedPlacedAt = /* @__PURE__ */ new Map();
270596
+ const placesAssets = (m2) => Object.values(m2.assets ?? {}).some((r3) => r3?.storage === "media" || r3?.storage === "large");
270369
270597
  const sha256hex2 = (b3) => sha256Hex(b3);
270370
270598
  function resolvePin(request2, url) {
270371
270599
  return request2.headers.get("x-himalaya-release") || url.searchParams.get("release") || null;
@@ -270397,7 +270625,13 @@ function makeServeHandler(opts) {
270397
270625
  async function pinnedManifest(app2, releaseId) {
270398
270626
  const key4 = `${app2}
270399
270627
  ${releaseId}`;
270400
- const hit = pinnedManifestCache.get(key4);
270628
+ let hit = pinnedManifestCache.get(key4);
270629
+ const mediaAt = pinnedPlacedAt.get(key4);
270630
+ if (hit && mediaAt !== void 0 && Date.now() - mediaAt >= manifestCacheTtlMs) {
270631
+ pinnedManifestCache.delete(key4);
270632
+ pinnedPlacedAt.delete(key4);
270633
+ hit = void 0;
270634
+ }
270401
270635
  if (!app2.startsWith("site.") && hit) return hit;
270402
270636
  const store = await getStore();
270403
270637
  if (app2.startsWith("site.") && await store.isMigrationCleanupFenced?.(app2)) {
@@ -270413,9 +270647,13 @@ ${releaseId}`;
270413
270647
  if (m2) {
270414
270648
  if (pinnedManifestCache.size >= PINNED_MANIFEST_CACHE_CAP) {
270415
270649
  const oldest3 = pinnedManifestCache.keys().next().value;
270416
- if (oldest3 !== void 0) pinnedManifestCache.delete(oldest3);
270650
+ if (oldest3 !== void 0) {
270651
+ pinnedManifestCache.delete(oldest3);
270652
+ pinnedPlacedAt.delete(oldest3);
270653
+ }
270417
270654
  }
270418
270655
  pinnedManifestCache.set(key4, m2);
270656
+ if (placesAssets(m2)) pinnedPlacedAt.set(key4, Date.now());
270419
270657
  }
270420
270658
  return m2;
270421
270659
  }
@@ -271488,8 +271726,10 @@ ${releaseId}`;
271488
271726
  const record6 = Object.values(m2?.assets ?? {}).find((a3) => a3.sha256 === sha7);
271489
271727
  if (!record6) return json6(404, { error: "asset_not_found", app: app2 });
271490
271728
  const etag = strongEtagForSha256(sha7);
271491
- let location = record6.storage === "large" ? opts.largeAssetUrl?.(sha7, { contentType: record6.contentType || "application/octet-stream" }) ?? void 0 : void 0;
271492
- if (location && store.largeAssetUploadMaxBytes && store.hasAsset && await store.hasAsset(app2, sha7).catch(() => false)) location = void 0;
271729
+ const media = record6.storage === "media";
271730
+ if (media && !isMediaArchiveUrl(record6.url, record6.mediaSiteId)) return json6(502, { error: "bad_media_asset", app: app2 });
271731
+ let location = media ? record6.url : record6.storage === "large" ? opts.largeAssetUrl?.(sha7, { contentType: record6.contentType || "application/octet-stream" }) ?? void 0 : void 0;
271732
+ if (location && !media && store.largeAssetUploadMaxBytes && store.hasAsset && await store.hasAsset(app2, sha7).catch(() => false)) location = void 0;
271493
271733
  if (!location && request2.headers.get("if-none-match") === etag) {
271494
271734
  return new Response(null, { status: 304, headers: { etag, "cache-control": BUNDLE_CACHE_CONTROL } });
271495
271735
  }
@@ -273888,7 +274128,7 @@ var init_git = __esm({
273888
274128
 
273889
274129
  // src/commands/patch.ts
273890
274130
  import { readFileSync as readFileSync169, existsSync as existsSync145 } from "node:fs";
273891
- import { createHash as createHash88 } from "node:crypto";
274131
+ import { createHash as createHash89 } from "node:crypto";
273892
274132
  async function patchCommand(ctx) {
273893
274133
  const { io: io2, pos, flags, client: client4, runReleasePatch, patchBlastRadius } = ctx;
273894
274134
  const PATCH_USAGE = "himi patch screen <id> --file <d.json> | bundle --file <b.js> (--for-screen <id>[,<id>]|--no-rebind) | tokens --file <t.json> | app-config --file <c.json> ; --app <a> (--draft|--live) [--from-release <id>] [--accept-regressions] [--notes <t>]";
@@ -274041,7 +274281,7 @@ async function patchCommand(ctx) {
274041
274281
  });
274042
274282
  }
274043
274283
  const bytes2 = readFileSync169(file2);
274044
- const sha7 = createHash88("sha256").update(bytes2).digest("hex");
274284
+ const sha7 = createHash89("sha256").update(bytes2).digest("hex");
274045
274285
  const forScreens = (str3(flags["for-screen"]) ?? "").split(",").map((s5) => s5.trim()).filter(Boolean);
274046
274286
  if (flags["no-rebind"] !== void 0 && flags["no-rebind"] !== true) {
274047
274287
  io2.error(JSON.stringify({ ok: false, error: "no_rebind_takes_no_value", message: "--no-rebind is a switch and takes no value; pass it bare.", usage: PATCH_USAGE }));
@@ -278083,7 +278323,7 @@ var init_iap_catalog_api = __esm({
278083
278323
  });
278084
278324
 
278085
278325
  // ../store-release/iap-manifest.ts
278086
- import { createHash as createHash89 } from "node:crypto";
278326
+ import { createHash as createHash90 } from "node:crypto";
278087
278327
  function readTarget(reader, value2) {
278088
278328
  const obj30 = reader.object(value2, "target", TARGET_KEYS);
278089
278329
  return {
@@ -278229,7 +278469,7 @@ function canonicalJson4(value2) {
278229
278469
  return JSON.stringify(sortKeys(value2));
278230
278470
  }
278231
278471
  function sha256Digest(value2) {
278232
- return `sha256:${createHash89("sha256").update(canonicalJson4(value2)).digest("hex")}`;
278472
+ return `sha256:${createHash90("sha256").update(canonicalJson4(value2)).digest("hex")}`;
278233
278473
  }
278234
278474
  function manifestDigest(manifest2) {
278235
278475
  return sha256Digest(manifest2);
@@ -278589,7 +278829,7 @@ var init_screenshot_display_types = __esm({
278589
278829
  });
278590
278830
 
278591
278831
  // ../store-release/iap-review-screenshot.ts
278592
- import { createHash as createHash90 } from "node:crypto";
278832
+ import { createHash as createHash91 } from "node:crypto";
278593
278833
  import { basename as basename41, resolve as resolve116 } from "node:path";
278594
278834
  function pngSize2(bytes2) {
278595
278835
  const signed = PNG_SIGNATURE2.every((b3, i2) => bytes2[i2] === b3);
@@ -278608,7 +278848,7 @@ function readImageSize(bytes2) {
278608
278848
  return pngSize2(buffer) ?? jpegSize(buffer);
278609
278849
  }
278610
278850
  function md5Hex2(bytes2) {
278611
- return createHash90("md5").update(bytes2).digest("hex");
278851
+ return createHash91("md5").update(bytes2).digest("hex");
278612
278852
  }
278613
278853
  function isAppStoreScreenshotSize(file2) {
278614
278854
  return displayTypeForSize(file2.width, file2.height) !== null;
@@ -279633,11 +279873,11 @@ var init_credential_profile = __esm({
279633
279873
  });
279634
279874
 
279635
279875
  // ../store-release/iap-credentials.ts
279636
- import { createHash as createHash91 } from "node:crypto";
279876
+ import { createHash as createHash92 } from "node:crypto";
279637
279877
  import { existsSync as existsSync148, readFileSync as readFileSync173, realpathSync as realpathSync21 } from "node:fs";
279638
279878
  import { homedir as homedir19 } from "node:os";
279639
279879
  function accountFingerprint(keyId, issuerId) {
279640
- return `sha256:${createHash91("sha256").update(`${issuerId}:${keyId}`).digest("hex").slice(0, 16)}`;
279880
+ return `sha256:${createHash92("sha256").update(`${issuerId}:${keyId}`).digest("hex").slice(0, 16)}`;
279641
279881
  }
279642
279882
  function requireExplicitProfile(profileFlag, target) {
279643
279883
  const profile = profileFlag?.trim();
@@ -279709,7 +279949,7 @@ var init_iap_credentials = __esm({
279709
279949
  });
279710
279950
 
279711
279951
  // ../store-release/iap-draft.ts
279712
- import { createHash as createHash92 } from "node:crypto";
279952
+ import { createHash as createHash93 } from "node:crypto";
279713
279953
  function fit(text32, max) {
279714
279954
  const chars = [...text32];
279715
279955
  return chars.length <= max ? text32 : `${chars.slice(0, max - 1).join("").trimEnd()}${ELLIPSIS}`;
@@ -279865,7 +280105,7 @@ var init_iap_draft = __esm({
279865
280105
  TIER_DESCRIPTION = "Unlocks one item in the app";
279866
280106
  ELLIPSIS = "\u2026";
279867
280107
  entityKey = (entityType, entityId) => `${entityType}:${entityId}`;
279868
- sha4 = (text32) => createHash92("sha256").update(text32).digest("hex");
280108
+ sha4 = (text32) => createHash93("sha256").update(text32).digest("hex");
279869
280109
  ENTITIES3 = { "&amp;": "&", "&nbsp;": " ", "&lt;": "<", "&gt;": ">", "&quot;": '"', "&#39;": "'" };
279870
280110
  MAX_SUFFIX = 24;
279871
280111
  ReferenceNames = class {
@@ -282309,7 +282549,7 @@ __export(preflight_app_exports, {
282309
282549
  readXcconfigVars: () => readXcconfigVars
282310
282550
  });
282311
282551
  import { readFileSync as readFileSync177, existsSync as existsSync151, readdirSync as readdirSync63, statSync as statSync50 } from "node:fs";
282312
- import { createHash as createHash93 } from "node:crypto";
282552
+ import { createHash as createHash94 } from "node:crypto";
282313
282553
  import { dirname as dirname81, join as join189 } from "node:path";
282314
282554
  function analyze(projectYml, storeConfig, icon, account2, adopted) {
282315
282555
  const f2 = [];
@@ -282708,7 +282948,7 @@ function placeholderHashes2() {
282708
282948
  const p2 = join189(templateIos, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
282709
282949
  try {
282710
282950
  if (!statSync50(p2).isFile()) continue;
282711
- return [LEGACY_PLACEHOLDER_SHA2562, createHash93("sha256").update(readFileSync177(p2)).digest("hex")];
282951
+ return [LEGACY_PLACEHOLDER_SHA2562, createHash94("sha256").update(readFileSync177(p2)).digest("hex")];
282712
282952
  } catch {
282713
282953
  }
282714
282954
  }
@@ -282745,7 +282985,7 @@ async function appIconState(iosDir) {
282745
282985
  try {
282746
282986
  if (!statSync50(p2).isFile()) continue;
282747
282987
  const bytes2 = readFileSync177(p2);
282748
- const hash3 = createHash93("sha256").update(bytes2).digest("hex");
282988
+ const hash3 = createHash94("sha256").update(bytes2).digest("hex");
282749
282989
  const pixels = await pixelIssues(bytes2);
282750
282990
  return {
282751
282991
  exists: true,
@@ -286770,7 +287010,7 @@ var init_cms2 = __esm({
286770
287010
  });
286771
287011
 
286772
287012
  // src/data.ts
286773
- import { createHash as createHash94 } from "node:crypto";
287013
+ import { createHash as createHash95 } from "node:crypto";
286774
287014
  async function planData(options2) {
286775
287015
  const kv = [];
286776
287016
  for (const spec of options2.data?.kv ?? []) {
@@ -286835,7 +287075,7 @@ var init_data2 = __esm({
286835
287075
  url.searchParams.set("site", scope3.siteId);
286836
287076
  url.searchParams.set("environment", scope3.environment);
286837
287077
  const serialized = body === void 0 ? void 0 : JSON.stringify(body);
286838
- const idempotencyKey = serialized === void 0 ? void 0 : createHash94("sha256").update(`${scope3.app}\0${scope3.siteId}\0${scope3.environment}\0${method}\0${name}\0${serialized}`).digest("hex");
287078
+ const idempotencyKey = serialized === void 0 ? void 0 : createHash95("sha256").update(`${scope3.app}\0${scope3.siteId}\0${scope3.environment}\0${method}\0${name}\0${serialized}`).digest("hex");
286839
287079
  const response = await this.fetchImpl(url, { method, headers: { authorization: `Bearer ${this.token}`, "content-type": "application/json", ...idempotencyKey ? { "idempotency-key": idempotencyKey } : {} }, ...serialized === void 0 ? {} : { body: serialized } });
286840
287080
  if (response.status === 404 && method === "GET") return { exists: false };
286841
287081
  if (!response.ok) throw new Error(`data admin ${method} failed (${response.status}): ${(await response.text()).slice(0, 256)}`);
@@ -287110,7 +287350,7 @@ var init_site_member = __esm({
287110
287350
  });
287111
287351
 
287112
287352
  // src/notify-ping-all.ts
287113
- import { createHash as createHash95 } from "node:crypto";
287353
+ import { createHash as createHash96 } from "node:crypto";
287114
287354
  async function listApprovedMembers(input) {
287115
287355
  const first = await scanMembers(input);
287116
287356
  const second = await scanMembers(input);
@@ -287164,7 +287404,7 @@ async function scanMembers(input) {
287164
287404
  }
287165
287405
  }
287166
287406
  function campaignRequestId(campaignId, memberId) {
287167
- const bytes2 = createHash95("sha256").update(JSON.stringify(["himi-push-campaign", campaignId, memberId])).digest().subarray(0, 16);
287407
+ const bytes2 = createHash96("sha256").update(JSON.stringify(["himi-push-campaign", campaignId, memberId])).digest().subarray(0, 16);
287168
287408
  bytes2[6] = bytes2[6] & 15 | 80;
287169
287409
  bytes2[8] = bytes2[8] & 63 | 128;
287170
287410
  const hex2 = bytes2.toString("hex");
@@ -288767,7 +289007,7 @@ __export(runtime_copy_exports, {
288767
289007
  renderTs: () => renderTs,
288768
289008
  rowId: () => rowId
288769
289009
  });
288770
- import { createHash as createHash96 } from "node:crypto";
289010
+ import { createHash as createHash97 } from "node:crypto";
288771
289011
  import { existsSync as existsSync156, readFileSync as readFileSync187, writeFileSync as writeFileSync69 } from "node:fs";
288772
289012
  import { readdirSync as readdirSync64 } from "node:fs";
288773
289013
  import { dirname as dirname84, join as join196, relative as relative34, resolve as resolve122 } from "node:path";
@@ -288838,7 +289078,7 @@ export const RUNTIME_RENDERER_COPY: Readonly<Record<string, string>> = ${JSON.st
288838
289078
  `;
288839
289079
  }
288840
289080
  function rowId(key4) {
288841
- return "n_" + createHash96("sha1").update("runtime-copy:" + key4).digest("hex").slice(0, 12);
289081
+ return "n_" + createHash97("sha1").update("runtime-copy:" + key4).digest("hex").slice(0, 12);
288842
289082
  }
288843
289083
  function injectRuntimeRows(catalog4, table = loadTable()) {
288844
289084
  const prior = catalog4.messages ?? {};
@@ -288925,7 +289165,7 @@ __export(auth_gate_copy_exports, {
288925
289165
  scanProse: () => scanProse,
288926
289166
  scanThrownMessages: () => scanThrownMessages
288927
289167
  });
288928
- import { createHash as createHash97 } from "node:crypto";
289168
+ import { createHash as createHash98 } from "node:crypto";
288929
289169
  import { existsSync as existsSync157, readdirSync as readdirSync65, readFileSync as readFileSync188, writeFileSync as writeFileSync70 } from "node:fs";
288930
289170
  import { dirname as dirname85, join as join197, relative as relative35, resolve as resolve123 } from "node:path";
288931
289171
  import { fileURLToPath as fileURLToPath42 } from "node:url";
@@ -289003,7 +289243,7 @@ ${rows}
289003
289243
  `;
289004
289244
  }
289005
289245
  function rowId2(key4) {
289006
- return "n_" + createHash97("sha1").update("auth-gate:" + key4).digest("hex").slice(0, 12);
289246
+ return "n_" + createHash98("sha1").update("auth-gate:" + key4).digest("hex").slice(0, 12);
289007
289247
  }
289008
289248
  function injectGateRows(catalog4, table = loadTable2()) {
289009
289249
  const prior = catalog4.messages ?? {};
@@ -289051,7 +289291,7 @@ function loadAppTable(appDir3) {
289051
289291
  return out2;
289052
289292
  }
289053
289293
  function nativeRowId(key4) {
289054
- return "n_" + createHash97("sha1").update("app-native:" + key4).digest("hex").slice(0, 12);
289294
+ return "n_" + createHash98("sha1").update("app-native:" + key4).digest("hex").slice(0, 12);
289055
289295
  }
289056
289296
  function injectNativeRows(catalog4, table, keys2) {
289057
289297
  const prior = catalog4.messages ?? {};
@@ -289231,10 +289471,10 @@ var init_auth_gate_copy = __esm({
289231
289471
 
289232
289472
  // ../l10n/extract.ts
289233
289473
  import { resolve as resolve124, join as join198, relative as relative36, dirname as dirname86 } from "node:path";
289234
- import { createHash as createHash98 } from "node:crypto";
289474
+ import { createHash as createHash99 } from "node:crypto";
289235
289475
  import { fileURLToPath as fileURLToPath43 } from "node:url";
289236
289476
  function keyOf4(source2) {
289237
- return "h_" + createHash98("sha1").update(source2).digest("hex").slice(0, 12);
289477
+ return "h_" + createHash99("sha1").update(source2).digest("hex").slice(0, 12);
289238
289478
  }
289239
289479
  var ROOT8;
289240
289480
  var init_extract = __esm({
@@ -290285,7 +290525,7 @@ __export(generate_exports, {
290285
290525
  withHeader: () => withHeader,
290286
290526
  writeGenerated: () => writeGenerated2
290287
290527
  });
290288
- import { createHash as createHash99 } from "node:crypto";
290528
+ import { createHash as createHash100 } from "node:crypto";
290289
290529
  import { existsSync as existsSync160, mkdirSync as mkdirSync65, readdirSync as readdirSync67, readFileSync as readFileSync191, writeFileSync as writeFileSync73 } from "node:fs";
290290
290530
  import { dirname as dirname88, join as join201 } from "node:path";
290291
290531
  function withHeader(body) {
@@ -290452,7 +290692,7 @@ var init_generate2 = __esm({
290452
290692
  GENERATED_HEADER = "// @generated by himi base44 screens \u2014 sha256:";
290453
290693
  HEADER_RE = /^\/\/ @generated by himi base44 screens — sha256:([0-9a-f]{64})\n/;
290454
290694
  ENGINE_FILES = ["tier5-src/_shared/entity-list.ts", "tier5-src/_shared/entity-detail.ts", "tier5-src/_shared/entity-plan.ts", "dev/entity-screens.ts"];
290455
- sha2568 = (s5) => createHash99("sha256").update(s5).digest("hex");
290695
+ sha2568 = (s5) => createHash100("sha256").update(s5).digest("hex");
290456
290696
  planFile = (p2) => `${p2.ids.bundleDetail}-plan`;
290457
290697
  ident = (p2) => `plan_${p2.ids.detail.replace(/^b44_/, "")}`;
290458
290698
  json8 = (v2) => JSON.stringify(v2, null, 2);
@@ -296699,11 +296939,11 @@ function cleanNode(node4, path2, depth, ctx, parentType) {
296699
296939
  const inBlocks = holdsBlocks(parentType);
296700
296940
  if (node4.type !== "TEXT" || inBlocks) {
296701
296941
  const own6 = typeof node4.id === "string" ? node4.id : "";
296702
- const usable = own6 !== "" && !unusableId(own6);
296942
+ const usable2 = own6 !== "" && !unusableId(own6);
296703
296943
  if (inBlocks && !isWrapper(node4.type)) {
296704
- if (usable && !ctx.ids.has(own6)) ctx.ids.add(own6);
296944
+ if (usable2 && !ctx.ids.has(own6)) ctx.ids.add(own6);
296705
296945
  else node4.id = path2;
296706
- } else if (!usable) node4.id = path2;
296946
+ } else if (!usable2) node4.id = path2;
296707
296947
  }
296708
296948
  if (Array.isArray(node4.nodes)) node4.nodes = cleanNodes(node4.nodes, path2, depth + 1, ctx, typeof node4.type === "string" ? node4.type : "");
296709
296949
  return node4;
@@ -296963,7 +297203,7 @@ var init_one_app_page = __esm({
296963
297203
  });
296964
297204
 
296965
297205
  // src/one-app/pages.ts
296966
- import { createHash as createHash100 } from "node:crypto";
297206
+ import { createHash as createHash101 } from "node:crypto";
296967
297207
  function oneAppPagePlacements(raw) {
296968
297208
  const sections2 = object14(raw.sections);
296969
297209
  const placements = [];
@@ -297028,7 +297268,7 @@ var init_pages = __esm({
297028
297268
  init_errors4();
297029
297269
  object14 = (v2) => v2 && typeof v2 === "object" && !Array.isArray(v2) ? v2 : {};
297030
297270
  pointer2 = (s5) => s5.replaceAll("~", "~0").replaceAll("/", "~1");
297031
- hash2 = (s5) => createHash100("sha256").update(s5).digest("hex");
297271
+ hash2 = (s5) => createHash101("sha256").update(s5).digest("hex");
297032
297272
  ONE_APP_PAGES_BASE = "https://apps.wix.com/social-content/api/v1/pages/";
297033
297273
  }
297034
297274
  });
@@ -297041,7 +297281,7 @@ __export(collect_exports, {
297041
297281
  resolveSourceLocale: () => resolveSourceLocale,
297042
297282
  sourceMemberChat: () => sourceMemberChat
297043
297283
  });
297044
- import { createHash as createHash101 } from "node:crypto";
297284
+ import { createHash as createHash102 } from "node:crypto";
297045
297285
  function isObject3(value2) {
297046
297286
  return value2 !== null && typeof value2 === "object" && !Array.isArray(value2);
297047
297287
  }
@@ -297157,7 +297397,7 @@ function semanticFingerprint(structure) {
297157
297397
  }
297158
297398
  return JSON.stringify(value2);
297159
297399
  };
297160
- return createHash101("sha256").update(canonical9(structure, true)).digest("hex");
297400
+ return createHash102("sha256").update(canonical9(structure, true)).digest("hex");
297161
297401
  }
297162
297402
  async function collectOneApp(input, deps = {}) {
297163
297403
  const locale = resolveSourceLocale(input.locale);
@@ -298190,7 +298430,7 @@ var init_widget_velo = __esm({
298190
298430
  });
298191
298431
 
298192
298432
  // src/one-app/widget-inspect.ts
298193
- import { createHash as createHash102 } from "node:crypto";
298433
+ import { createHash as createHash103 } from "node:crypto";
298194
298434
  import { mkdirSync as mkdirSync69, mkdtempSync as mkdtempSync16, rmSync as rmSync51, writeFileSync as writeFileSync80, readFileSync as readFileSync197, existsSync as existsSync168, renameSync as renameSync27 } from "node:fs";
298195
298435
  import { tmpdir as tmpdir17 } from "node:os";
298196
298436
  import { join as join210 } from "node:path";
@@ -298628,7 +298868,7 @@ var init_widget_inspect = __esm({
298628
298868
  obj26 = (v2) => v2 && typeof v2 === "object" && !Array.isArray(v2) ? v2 : {};
298629
298869
  arr5 = (v2) => Array.isArray(v2) ? v2 : [];
298630
298870
  str24 = (v2) => typeof v2 === "string" ? v2 : "";
298631
- sha5 = (v2) => createHash102("sha256").update(v2).digest("hex");
298871
+ sha5 = (v2) => createHash103("sha256").update(v2).digest("hex");
298632
298872
  INSPECTION_SCHEMA = 1;
298633
298873
  VETTED_ASSET_HOSTS = ["static.parastorage.com", "siteassets.parastorage.com", "bundler-velo.parastorage.com", "static.wixstatic.com", "video.wixstatic.com"];
298634
298874
  SOURCE_MAP_HOSTS = ["bundler.wix-code.com"];
@@ -298664,7 +298904,7 @@ var init_widget_inspect = __esm({
298664
298904
  });
298665
298905
 
298666
298906
  // src/one-app/widget-tests.ts
298667
- import { createHash as createHash103 } from "node:crypto";
298907
+ import { createHash as createHash104 } from "node:crypto";
298668
298908
  import { mkdirSync as mkdirSync70, readFileSync as readFileSync198, writeFileSync as writeFileSync81 } from "node:fs";
298669
298909
  import { isAbsolute as isAbsolute22, join as join211, relative as relative38, resolve as resolve131 } from "node:path";
298670
298910
  function runWidgetTests(options2) {
@@ -298754,7 +298994,7 @@ var init_widget_tests = __esm({
298754
298994
  init_widgets_plan();
298755
298995
  init_widget_run();
298756
298996
  obj27 = (v2) => v2 && typeof v2 === "object" && !Array.isArray(v2) ? v2 : {};
298757
- sha6 = (v2) => createHash103("sha256").update(v2).digest("hex");
298997
+ sha6 = (v2) => createHash104("sha256").update(v2).digest("hex");
298758
298998
  }
298759
298999
  });
298760
299000
 
@@ -299379,7 +299619,7 @@ __export(cli_exports2, {
299379
299619
  runOneAppCommand: () => runOneAppCommand
299380
299620
  });
299381
299621
  import { closeSync as closeSync15, constants as constants13, lstatSync as lstatSync43, mkdirSync as mkdirSync71, openSync as openSync14, readFileSync as readFileSync201, realpathSync as realpathSync24, writeFileSync as writeFileSync82 } from "node:fs";
299382
- import { createHash as createHash104 } from "node:crypto";
299622
+ import { createHash as createHash105 } from "node:crypto";
299383
299623
  import { isIP as isIP2 } from "node:net";
299384
299624
  import { dirname as dirname91, join as join214, parse as parse13, resolve as resolve134 } from "node:path";
299385
299625
  function nativeSiteHost(host) {
@@ -299603,7 +299843,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
299603
299843
  throw new OneAppError("artifact_write_failed", "Could not save the migration evidence. Existing files were kept.", { stage });
299604
299844
  }
299605
299845
  artifacts[name] = path2;
299606
- hashes[name] = createHash104("sha256").update(content).digest("hex");
299846
+ hashes[name] = createHash105("sha256").update(content).digest("hex");
299607
299847
  return path2;
299608
299848
  };
299609
299849
  const progress = (nextStage) => {
@@ -302284,9 +302524,9 @@ function buildMergedContract(options2) {
302284
302524
  } catch {
302285
302525
  faces = [];
302286
302526
  }
302287
- const usable = (f2) => typeof f2?.family === "string" && f2.family.trim() !== "" && typeof f2?.file === "string" && f2.file.trim() !== "" && typeof f2?.postscriptName === "string" && f2.postscriptName.trim() !== "" && Number.isFinite(f2?.weight);
302527
+ const usable2 = (f2) => typeof f2?.family === "string" && f2.family.trim() !== "" && typeof f2?.file === "string" && f2.file.trim() !== "" && typeof f2?.postscriptName === "string" && f2.postscriptName.trim() !== "" && Number.isFinite(f2?.weight);
302288
302528
  const fonts = faces.flatMap((face) => {
302289
- if (!usable(face)) return [];
302529
+ if (!usable2(face)) return [];
302290
302530
  const rel2 = stage(face.file, `${STAGED}/${face.postscriptName}.ttf`);
302291
302531
  return rel2 ? [{ family: face.family, file: rel2, postscriptName: face.postscriptName, weight: face.weight }] : [];
302292
302532
  });
@@ -302312,7 +302552,7 @@ function catalogTypography(overlay, template) {
302312
302552
  const typography = {};
302313
302553
  const notes = [];
302314
302554
  const base2 = template && typeof template === "object" ? template : {};
302315
- const usable = (family) => typeof family === "string" && family.trim() !== "" && (family === SYSTEM_FONT_FAMILY || canonicalFamilyName(family) !== void 0);
302555
+ const usable2 = (family) => typeof family === "string" && family.trim() !== "" && (family === SYSTEM_FONT_FAMILY || canonicalFamilyName(family) !== void 0);
302316
302556
  for (const [role, token] of Object.entries(overlay ?? {})) {
302317
302557
  const family = token?.family;
302318
302558
  if (typeof family !== "string" || family.trim() === "") {
@@ -302329,7 +302569,7 @@ function catalogTypography(overlay, template) {
302329
302569
  continue;
302330
302570
  }
302331
302571
  const kept = base2[role]?.family;
302332
- const using = usable(kept) ? `the template's ${kept}` : `the template's default (${TIER1_FLOOR[0]})`;
302572
+ const using = usable2(kept) ? `the template's ${kept}` : `the template's default (${TIER1_FLOOR[0]})`;
302333
302573
  notes.push(`site font "${family}" (${role}) isn't in the font catalog; using ${using}`);
302334
302574
  }
302335
302575
  return { typography, notes };
@@ -304821,7 +305061,7 @@ __export(check_report_exports, {
304821
305061
  sendCheckResult: () => sendCheckResult,
304822
305062
  takeCheckReportTarget: () => takeCheckReportTarget
304823
305063
  });
304824
- import { createHash as createHash105, randomUUID as randomUUID20 } from "node:crypto";
305064
+ import { createHash as createHash106, randomUUID as randomUUID20 } from "node:crypto";
304825
305065
  import { request as httpRequest2 } from "node:http";
304826
305066
  import { createConnection } from "node:net";
304827
305067
  import { isAbsolute as isAbsolute24, relative as relative39, resolve as resolve137 } from "node:path";
@@ -304993,7 +305233,7 @@ function errorFindings(run4, mode) {
304993
305233
  if (mode === "functions") {
304994
305234
  return envelope.functions.map(record5).filter((f2) => f2.ok === false).map((f2) => ({
304995
305235
  // Stable per function, in the HimiReport id alphabet: the name may hold anything.
304996
- id: `test:functions:${createHash105("sha256").update(text31(f2.name) ?? "").digest("hex").slice(0, 12)}`,
305236
+ id: `test:functions:${createHash106("sha256").update(text31(f2.name) ?? "").digest("hex").slice(0, 12)}`,
304997
305237
  severity: "error",
304998
305238
  message: `function "${text31(f2.name) ?? "?"}" (${text31(f2.method) ?? "?"} ${text31(f2.path) ?? "?"}) answered HTTP ${String(f2.status)}`
304999
305239
  }));