@wix/himalaya-cli 0.1369.0 → 0.1371.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
@@ -28688,8 +28688,17 @@ var init_wix_cache_defaults_generated = __esm({
28688
28688
  });
28689
28689
 
28690
28690
  // ../../core/dev-server/src/wix-cache-policy.ts
28691
+ function rulePath(pathPrefix) {
28692
+ const m2 = /^https?:\/\/[^/]+(\/.*)?$/i.exec(pathPrefix);
28693
+ return m2 ? m2[1] ?? "/" : pathPrefix;
28694
+ }
28695
+ function originOf(pathPrefix) {
28696
+ const m2 = /^(https?:\/\/[^/]+)/i.exec(pathPrefix);
28697
+ return m2 ? m2[1] : null;
28698
+ }
28691
28699
  function clampRule(rule, denyPrefixes, maxTTL) {
28692
- const denied2 = denyPrefixes.some((p2) => rule.pathPrefix.startsWith(p2));
28700
+ const path2 = rulePath(rule.pathPrefix);
28701
+ const denied2 = denyPrefixes.some((p2) => path2.startsWith(p2));
28693
28702
  return {
28694
28703
  ...rule,
28695
28704
  cacheable: rule.cacheable && !denied2,
@@ -28712,10 +28721,11 @@ function resolveWixCachePolicy(appName2, declared) {
28712
28721
  const legacy = CACHE_OVERRIDES[appName2] ?? [];
28713
28722
  const appLevel = [...own4, ...legacy];
28714
28723
  const defaults = declared?.platformDefaults === false ? [] : PLATFORM_DEFAULT_WIX_CACHE_RULES.filter((d2) => !appLevel.some((a2) => shadows(a2, d2)));
28715
- const denies = [
28716
- ...[...PLATFORM_DENY_PREFIXES, ...PERSONAL_DATA_PREFIXES].map((pathPrefix) => ({ method: null, pathPrefix, cacheable: false, ttl: 0, swr: 0, tag: null })),
28717
- ...PERSONAL_DATA_READS.map(([method, pathPrefix]) => ({ method, pathPrefix, cacheable: false, ttl: 0, swr: 0, tag: null }))
28718
- ];
28724
+ const origins = ["", ...new Set(appLevel.map((r2) => originOf(r2.pathPrefix)).filter((o2) => !!o2))];
28725
+ const denies = origins.flatMap((origin) => [
28726
+ ...[...PLATFORM_DENY_PREFIXES, ...PERSONAL_DATA_PREFIXES].map((p2) => ({ method: null, pathPrefix: origin + p2, cacheable: false, ttl: 0, swr: 0, tag: null })),
28727
+ ...PERSONAL_DATA_READS.map(([method, p2]) => ({ method, pathPrefix: origin + p2, cacheable: false, ttl: 0, swr: 0, tag: null }))
28728
+ ]);
28719
28729
  const rules = [...appLevel, ...defaults, ...denies].map((r2) => clampRule(r2, PLATFORM_DENY_PREFIXES, PLATFORM_MAX_TTL));
28720
28730
  return { rules, defaultCacheable: declared?.defaultCacheable ?? false };
28721
28731
  }
@@ -33216,7 +33226,89 @@ function wixClientIdOf(appConfigJson) {
33216
33226
  if (typeof clientId !== "string" || !clientId) return { error: "no_client_id" };
33217
33227
  return { clientId };
33218
33228
  }
33219
- var WIX_API, ONE_APP_SESSION, OWNER_SCOPED_WIX_HOST, WIX_FORWARDABLE_HEADERS, OWNER_REFRESH_MARGIN_MS, OWNER_RENEW_MIN_AGE_MS, OWNER_MINT_TIMEOUT_MS, OwnerInstanceCache, OWNER_SITES_QUERY_PATH, OWNER_SITES_COUNT_PATH, OwnerSitesCache;
33229
+ function isForwardableWixSessionCookie(name) {
33230
+ return name === "wixSession2" || name.startsWith("session3") || name === "XSRF-TOKEN" || name === "petri_ovr" || name.toLowerCase() === "svsession" || name === "wixUIDX";
33231
+ }
33232
+ function forwardableWixSessionCookies(cookieHeader) {
33233
+ const pairs = (cookieHeader ?? "").split(/;\s*/).filter((pair) => {
33234
+ const eq = pair.indexOf("=");
33235
+ return eq > 0 && isForwardableWixSessionCookie(pair.slice(0, eq).trim());
33236
+ });
33237
+ return pairs.some((pair) => pair.startsWith("wixSession2=")) ? pairs.join("; ") : "";
33238
+ }
33239
+ function wixAccountSignInUrl(postLogin) {
33240
+ const signIn = new URL("https://users.wix.com/signin");
33241
+ signIn.searchParams.set("postLogin", postLogin);
33242
+ return signIn.toString();
33243
+ }
33244
+ function allowedAccountTarget(method, url) {
33245
+ let target;
33246
+ try {
33247
+ target = new URL(url);
33248
+ } catch {
33249
+ return null;
33250
+ }
33251
+ if (target.protocol !== "https:" || target.port !== "" && target.port !== "443" || target.username || target.password) return null;
33252
+ const host = target.hostname.toLowerCase();
33253
+ const verb = method.toUpperCase();
33254
+ return ACCOUNT_FORWARD_ALLOWLIST.some((e2) => e2.host === host && e2.method === verb && e2.path === target.pathname) ? target : null;
33255
+ }
33256
+ function isAccountJoinCall(method, url) {
33257
+ const target = allowedAccountTarget(method, url);
33258
+ return !!target && ACCOUNT_JOIN_PATHS.has(target.pathname);
33259
+ }
33260
+ async function wixAccountCall(method, url, body, sessionCookie, fetchImpl = fetch, forwardedHeaders = {}, memberInstance) {
33261
+ const target = allowedAccountTarget(method, url);
33262
+ if (!target) throw new Error("not an allowlisted account endpoint");
33263
+ const xsrf = /(?:^|;\s*)XSRF-TOKEN=([^;]+)/.exec(sessionCookie)?.[1];
33264
+ const res = await fetchImpl(target.toString(), {
33265
+ method: method.toUpperCase(),
33266
+ headers: {
33267
+ ...forwardedHeaders,
33268
+ Cookie: sessionCookie,
33269
+ Accept: "application/json",
33270
+ ...xsrf ? { "x-xsrf-token": xsrf } : {},
33271
+ ...memberInstance ? { Authorization: memberInstance } : {},
33272
+ ...body ? { "Content-Type": "application/json" } : {}
33273
+ },
33274
+ body: method.toUpperCase() === "GET" || method.toUpperCase() === "HEAD" ? void 0 : body,
33275
+ redirect: "manual"
33276
+ });
33277
+ return { status: res.status, body: await res.text() };
33278
+ }
33279
+ function instancePayload(instance) {
33280
+ const part = instance.split(".")[1];
33281
+ if (!part) return null;
33282
+ try {
33283
+ const b64 = part.replace(/-/g, "+").replace(/_/g, "/").padEnd(Math.ceil(part.length / 4) * 4, "=");
33284
+ const parsed = JSON.parse(decodeURIComponent(Array.from(atob(b64), (c2) => `%${c2.charCodeAt(0).toString(16).padStart(2, "0")}`).join("")));
33285
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
33286
+ } catch {
33287
+ return null;
33288
+ }
33289
+ }
33290
+ function memberInstanceRejection(instance, metaSiteId) {
33291
+ const p2 = instancePayload(instance);
33292
+ if (!p2) return "undecodable instance";
33293
+ if (typeof p2.metaSiteId !== "string" || !p2.metaSiteId) return "no metaSiteId";
33294
+ if (p2.metaSiteId !== metaSiteId) return "instance is for another site";
33295
+ if (typeof p2.siteMemberId !== "string" || !p2.siteMemberId) return "no siteMemberId";
33296
+ if (p2.uid !== p2.siteMemberId) return "uid is not the site member";
33297
+ if (p2.permissions !== void 0) return "a User instance, not a Member one";
33298
+ return null;
33299
+ }
33300
+ function memberInstanceRefreshAt(instance, now, fallbackMs = 12e4) {
33301
+ const raw = instancePayload(instance)?.expirationDate;
33302
+ const expiry = typeof raw === "string" ? Date.parse(raw) : NaN;
33303
+ return Number.isFinite(expiry) ? Math.max(now, expiry - MEMBER_REFRESH_MARGIN_MS) : now + fallbackMs;
33304
+ }
33305
+ function memberInstanceRefusal(e2) {
33306
+ if (e2 instanceof NotSiteMember) return { status: 403, body: { error: "NotSiteMember", metaSiteId: e2.metaSiteId, reason: e2.reason } };
33307
+ if (e2 instanceof AccountSessionExpired) return { status: 401, body: { error: "AccountSessionExpired", metaSiteId: e2.metaSiteId, reason: e2.reason } };
33308
+ if (e2 instanceof SiteInstanceUnavailable) return { status: 502, body: { error: "SiteInstanceUnavailable", metaSiteId: e2.metaSiteId, reason: e2.reason } };
33309
+ return { status: 502, body: { error: "SiteInstanceUnavailable" } };
33310
+ }
33311
+ var WIX_API, ONE_APP_SESSION, OWNER_SCOPED_WIX_HOST, WIX_FORWARDABLE_HEADERS, OWNER_REFRESH_MARGIN_MS, OWNER_RENEW_MIN_AGE_MS, OWNER_MINT_TIMEOUT_MS, OwnerInstanceCache, OWNER_SITES_QUERY_PATH, OWNER_SITES_COUNT_PATH, OwnerSitesCache, ACCOUNT_FORWARD_ALLOWLIST, ACCOUNT_JOIN_PATHS, NotSiteMember, AccountSessionExpired, SiteInstanceUnavailable, MEMBER_REFRESH_MARGIN_MS, MEMBER_NEGATIVE_TTL_MS, MEMBER_TRANSIENT_TTL_MS, MemberInstanceCache;
33220
33312
  var init_wix_bridge = __esm({
33221
33313
  "../../core/serve-runtime/src/wix-bridge.ts"() {
33222
33314
  init_sha256();
@@ -33365,6 +33457,166 @@ ${cookieHeader}`);
33365
33457
  this.cache.delete(this.key(cookieHeader, limit));
33366
33458
  }
33367
33459
  };
33460
+ ACCOUNT_FORWARD_ALLOWLIST = [
33461
+ // My Sites (my-sites.ts)
33462
+ { host: "apps.wix.com", method: "GET", path: "/_api/app-state/v1/user/state" },
33463
+ { host: "apps.wix.com", method: "GET", path: "/wixapp/api/v1/businesses/recent" },
33464
+ { host: "manage.wix.com", method: "POST", path: "/_serverless/mobile-apps-editor-middleware/spaces-businesses" },
33465
+ { host: "apps.wix.com", method: "GET", path: "/api/v1/mobile-platform-facade/business/pending" },
33466
+ { host: "apps.wix.com", method: "POST", path: "/api/v1/mobile-platform-facade/business/pinned" },
33467
+ { host: "apps.wix.com", method: "POST", path: "/api/v1/mobile-platform-facade/business/hidden" },
33468
+ { host: "apps.wix.com", method: "POST", path: "/growth/v1/business/pending/cancel" },
33469
+ { host: "www.wixapis.com", method: "POST", path: OWNER_SITES_QUERY_PATH },
33470
+ // Site open (site-open.ts)
33471
+ { host: "apps.wix.com", method: "GET", path: "/wixapp/api/v1/business" },
33472
+ // Join, invite, leave (join.ts)
33473
+ { host: "apps.wix.com", method: "GET", path: "/clubs/api/v1/invites/details" },
33474
+ { host: "apps.wix.com", method: "POST", path: "/clubs/api/v1/business/join/details" },
33475
+ { host: "apps.wix.com", method: "POST", path: "/clubs/api/v1/invites/accept" },
33476
+ { host: "apps.wix.com", method: "POST", path: "/clubs/api/v1/business/join" },
33477
+ { host: "apps.wix.com", method: "POST", path: "/clubs/api/v1/invites" },
33478
+ { host: "apps.wix.com", method: "DELETE", path: "/api/v1/mobile-platform-facade/members/me" }
33479
+ ];
33480
+ ACCOUNT_JOIN_PATHS = /* @__PURE__ */ new Set(["/clubs/api/v1/invites/accept", "/clubs/api/v1/business/join"]);
33481
+ NotSiteMember = class extends Error {
33482
+ constructor(metaSiteId, reason) {
33483
+ super(`NotSiteMember(metaSiteId: ${metaSiteId}): ${reason}`);
33484
+ this.metaSiteId = metaSiteId;
33485
+ this.reason = reason;
33486
+ this.name = "NotSiteMember";
33487
+ }
33488
+ code = "NotSiteMember";
33489
+ };
33490
+ AccountSessionExpired = class extends Error {
33491
+ constructor(metaSiteId, reason) {
33492
+ super(`AccountSessionExpired(metaSiteId: ${metaSiteId}): ${reason}`);
33493
+ this.metaSiteId = metaSiteId;
33494
+ this.reason = reason;
33495
+ this.name = "AccountSessionExpired";
33496
+ }
33497
+ code = "AccountSessionExpired";
33498
+ };
33499
+ SiteInstanceUnavailable = class extends Error {
33500
+ constructor(metaSiteId, reason) {
33501
+ super(`SiteInstanceUnavailable(metaSiteId: ${metaSiteId}): ${reason}`);
33502
+ this.metaSiteId = metaSiteId;
33503
+ this.reason = reason;
33504
+ this.name = "SiteInstanceUnavailable";
33505
+ }
33506
+ code = "SiteInstanceUnavailable";
33507
+ };
33508
+ MEMBER_REFRESH_MARGIN_MS = 6e4;
33509
+ MEMBER_NEGATIVE_TTL_MS = 1e4;
33510
+ MEMBER_TRANSIENT_TTL_MS = 3e3;
33511
+ MemberInstanceCache = class {
33512
+ constructor(fetchImpl = fetch, mintTimeoutMs = OWNER_MINT_TIMEOUT_MS) {
33513
+ this.fetchImpl = fetchImpl;
33514
+ this.mintTimeoutMs = mintTimeoutMs;
33515
+ }
33516
+ cache = /* @__PURE__ */ new Map();
33517
+ inflight = /* @__PURE__ */ new Map();
33518
+ refusals = /* @__PURE__ */ new Map();
33519
+ /** Per session: bumped by `forgetSession` / `forgetRefusals`. A mint that started under an older
33520
+ * generation still answers its own callers, but writes nothing back — otherwise a mint in flight
33521
+ * across a sign-out re-caches the signed-out instance, and one in flight across a join re-caches
33522
+ * the `NotSiteMember` the join just made stale. */
33523
+ generations = /* @__PURE__ */ new Map();
33524
+ session(sessionCookie) {
33525
+ return sha256Hex(/(?:^|;\s*)wixSession2=([^;]*)/.exec(sessionCookie)?.[1] ?? sessionCookie);
33526
+ }
33527
+ key(msid, session) {
33528
+ return sha256Hex(`${msid}
33529
+ Member
33530
+ ${session}`);
33531
+ }
33532
+ /** The site's Member instance for this session. Throws `NotSiteMember` or `SiteInstanceUnavailable`.
33533
+ * `force`: Wix refused the instance this cache handed out (a 401) — mint a new one. */
33534
+ async instance(msid, sessionCookie, opts = {}) {
33535
+ const now = opts.now ?? Date.now();
33536
+ const session = this.session(sessionCookie);
33537
+ const key2 = this.key(msid, session);
33538
+ const generation = this.generations.get(session) ?? 0;
33539
+ const pending = this.inflight.get(key2);
33540
+ if (pending && pending.generation === generation) return (await pending.mint).instance;
33541
+ const refused2 = this.refusals.get(key2);
33542
+ if (refused2 && refused2.until > now && !opts.force) throw refused2.error;
33543
+ const hit = this.cache.get(key2);
33544
+ if (hit && !opts.force && hit.refreshAt > now) return hit.instance;
33545
+ const mint = this.mint(key2, msid, sessionCookie, session, now, generation).finally(() => {
33546
+ if (this.inflight.get(key2)?.mint === mint) this.inflight.delete(key2);
33547
+ });
33548
+ this.inflight.set(key2, { mint, generation });
33549
+ return (await mint).instance;
33550
+ }
33551
+ /** Drop everything held for this session — instances and refusals alike: its sign-out or expiry
33552
+ * (RFC 0071 §6, sign-out purges every per-site instance). */
33553
+ forgetSession(sessionCookie) {
33554
+ const session = this.session(sessionCookie);
33555
+ for (const [key2, entry] of this.cache) if (entry.session === session) this.cache.delete(key2);
33556
+ this.forgetRefusals(sessionCookie);
33557
+ }
33558
+ /** Drop every refusal held for this session — after a join, which makes them stale. */
33559
+ forgetRefusals(sessionCookie) {
33560
+ const session = this.session(sessionCookie);
33561
+ this.generations.set(session, (this.generations.get(session) ?? 0) + 1);
33562
+ for (const [key2, refusal] of this.refusals) if (refusal.session === session) this.refusals.delete(key2);
33563
+ }
33564
+ async mint(key2, msid, sessionCookie, session, now, generation) {
33565
+ const current = () => (this.generations.get(session) ?? 0) === generation;
33566
+ const refuse7 = (error, ttl2) => {
33567
+ if (!current()) throw error;
33568
+ this.cache.delete(key2);
33569
+ this.refusals.set(key2, { error, until: now + ttl2, session });
33570
+ throw error;
33571
+ };
33572
+ const abort = new AbortController();
33573
+ let timer;
33574
+ const timedOut = new Promise((_2, reject) => {
33575
+ timer = setTimeout(() => {
33576
+ abort.abort();
33577
+ reject(new Error(`timed out after ${this.mintTimeoutMs}ms`));
33578
+ }, this.mintTimeoutMs);
33579
+ });
33580
+ const xsrf = /(?:^|;\s*)XSRF-TOKEN=([^;]+)/.exec(sessionCookie)?.[1];
33581
+ let status;
33582
+ let text9;
33583
+ try {
33584
+ const res = await Promise.race([
33585
+ this.fetchImpl(`${ONE_APP_SESSION}/${msid}/signed-instance?signed_instance_type=Member`, {
33586
+ method: "GET",
33587
+ headers: { Cookie: sessionCookie, Accept: "application/json", ...xsrf ? { "x-xsrf-token": xsrf } : {} },
33588
+ signal: abort.signal,
33589
+ redirect: "manual"
33590
+ }),
33591
+ timedOut
33592
+ ]);
33593
+ status = res.status;
33594
+ text9 = await Promise.race([res.text(), timedOut]);
33595
+ } catch (e2) {
33596
+ return refuse7(new SiteInstanceUnavailable(msid, `mint failed: ${e2?.message ?? e2}`), MEMBER_TRANSIENT_TTL_MS);
33597
+ } finally {
33598
+ clearTimeout(timer);
33599
+ }
33600
+ if (status === 403 || status === 404) return refuse7(new NotSiteMember(msid, `mint refused (${status})`), MEMBER_NEGATIVE_TTL_MS);
33601
+ if (status === 401) return refuse7(new AccountSessionExpired(msid, `mint refused (${status})`), MEMBER_TRANSIENT_TTL_MS);
33602
+ let instance;
33603
+ try {
33604
+ instance = JSON.parse(text9).signedInstance;
33605
+ } catch {
33606
+ }
33607
+ if (status < 200 || status >= 300 || typeof instance !== "string" || !instance) {
33608
+ return refuse7(new SiteInstanceUnavailable(msid, `mint failed (${status})`), MEMBER_TRANSIENT_TTL_MS);
33609
+ }
33610
+ const rejection = memberInstanceRejection(instance, msid);
33611
+ if (rejection) return refuse7(new NotSiteMember(msid, rejection), MEMBER_NEGATIVE_TTL_MS);
33612
+ const entry = { instance, refreshAt: memberInstanceRefreshAt(instance, now), session };
33613
+ if (current()) {
33614
+ this.refusals.delete(key2);
33615
+ this.cache.set(key2, entry);
33616
+ }
33617
+ return entry;
33618
+ }
33619
+ };
33368
33620
  }
33369
33621
  });
33370
33622
 
@@ -34144,6 +34396,238 @@ var init_aria_realtime_dev = __esm({
34144
34396
  }
34145
34397
  });
34146
34398
 
34399
+ // ../../core/serve-runtime/src/wix-account.ts
34400
+ function unwrapString(v2) {
34401
+ if (typeof v2 === "string") return v2;
34402
+ if (v2 && typeof v2 === "object" && typeof v2.value === "string") {
34403
+ return v2.value;
34404
+ }
34405
+ return void 0;
34406
+ }
34407
+ function hasWixSession(cookieHeader) {
34408
+ return !!cookieHeader && /(?:^|;\s*)wixSession2=/.test(cookieHeader);
34409
+ }
34410
+ function normalizeWixAuthorization(raw) {
34411
+ if (!raw) return null;
34412
+ const trimmed = raw.trim();
34413
+ if (!trimmed) return null;
34414
+ const bearer = /^Bearer\s+(.+)$/i.exec(trimmed);
34415
+ const value = (bearer ? bearer[1] : trimmed).trim();
34416
+ if (!value) return null;
34417
+ if (/^(?:Bearer|Basic|Digest|Negotiate|NTLM)$/i.test(value)) return null;
34418
+ if (/^Basic\s/i.test(value)) return null;
34419
+ return value;
34420
+ }
34421
+ async function resolveWixAccounts(cookieHeader, fetchImpl = fetch, authorization) {
34422
+ const hasCookie = hasWixSession(cookieHeader);
34423
+ const auth = hasCookie ? null : normalizeWixAuthorization(authorization);
34424
+ if (!auth && !hasCookie) return { ok: false, reason: "no_session" };
34425
+ const cookie = cookieHeader ?? "";
34426
+ const xsrf = /(?:^|;\s*)XSRF-TOKEN=([^;]+)/.exec(cookie)?.[1];
34427
+ let res;
34428
+ try {
34429
+ res = await fetchImpl(`${ACCOUNT_SERVER}/v1/users/my_accounts`, {
34430
+ method: "GET",
34431
+ headers: auth ? { Authorization: auth, Accept: "application/json" } : {
34432
+ Cookie: cookie,
34433
+ Accept: "application/json",
34434
+ ...xsrf ? { "x-xsrf-token": xsrf } : {}
34435
+ }
34436
+ });
34437
+ } catch (err) {
34438
+ return { ok: false, reason: "upstream_failed", status: 0, detail: err.message };
34439
+ }
34440
+ if (auth && res.status === 428) return resolveAccountCredential(auth, fetchImpl);
34441
+ if (res.status === 428 || res.status === 401 || res.status === 403) {
34442
+ return { ok: false, reason: "no_session" };
34443
+ }
34444
+ const text9 = await res.text();
34445
+ if (!res.ok) {
34446
+ return { ok: false, reason: "upstream_failed", status: res.status, detail: text9.slice(0, 200) };
34447
+ }
34448
+ let parsed;
34449
+ try {
34450
+ parsed = JSON.parse(text9);
34451
+ } catch {
34452
+ return { ok: false, reason: "upstream_failed", status: res.status, detail: "unparseable_body" };
34453
+ }
34454
+ if (!parsed || !Array.isArray(parsed.accounts)) {
34455
+ return { ok: false, reason: "upstream_failed", status: res.status, detail: "no_accounts_array" };
34456
+ }
34457
+ const accounts = [];
34458
+ for (const raw of parsed.accounts) {
34459
+ const account = toWixAccount(raw);
34460
+ if (account) accounts.push(account);
34461
+ }
34462
+ if (accounts.length === 0) return { ok: false, reason: "no_session" };
34463
+ return { ok: true, accounts };
34464
+ }
34465
+ function toWixAccount(raw) {
34466
+ if (!raw || typeof raw !== "object") return void 0;
34467
+ const a2 = raw;
34468
+ const accountId = typeof a2.accountId === "string" ? a2.accountId : void 0;
34469
+ if (!accountId) return void 0;
34470
+ return {
34471
+ accountId,
34472
+ ...typeof a2.slug === "string" ? { slug: a2.slug } : {},
34473
+ ...typeof a2.status === "string" ? { status: a2.status } : {},
34474
+ ...typeof a2.accountOwner === "string" ? { accountOwner: a2.accountOwner } : {},
34475
+ ...unwrapString(a2.accountName) ? { name: unwrapString(a2.accountName) } : {}
34476
+ };
34477
+ }
34478
+ async function resolveAccountCredential(auth, fetchImpl) {
34479
+ let res;
34480
+ try {
34481
+ res = await fetchImpl(`${ACCOUNT_SERVER}/v1/accounts/my_account`, {
34482
+ method: "GET",
34483
+ headers: { Authorization: auth, Accept: "application/json" }
34484
+ });
34485
+ } catch (err) {
34486
+ return { ok: false, reason: "upstream_failed", status: 0, detail: err.message };
34487
+ }
34488
+ if (res.status === 428 || res.status === 401 || res.status === 403 || res.status === 404) {
34489
+ return { ok: false, reason: "no_session" };
34490
+ }
34491
+ const text9 = await res.text();
34492
+ if (!res.ok) {
34493
+ return { ok: false, reason: "upstream_failed", status: res.status, detail: text9.slice(0, 200) };
34494
+ }
34495
+ let parsed;
34496
+ try {
34497
+ parsed = JSON.parse(text9);
34498
+ } catch {
34499
+ return { ok: false, reason: "upstream_failed", status: res.status, detail: "unparseable_body" };
34500
+ }
34501
+ const account = toWixAccount(parsed && typeof parsed === "object" ? parsed.account : void 0);
34502
+ if (!account) return { ok: false, reason: "upstream_failed", status: res.status, detail: "no_account" };
34503
+ return { ok: true, accounts: [account] };
34504
+ }
34505
+ var ACCOUNT_SERVER;
34506
+ var init_wix_account = __esm({
34507
+ "../../core/serve-runtime/src/wix-account.ts"() {
34508
+ ACCOUNT_SERVER = "https://www.wix.com/_api/account-server";
34509
+ }
34510
+ });
34511
+
34512
+ // ../../core/dev-server/src/person-session-auth.ts
34513
+ import { join as pathJoin } from "node:path";
34514
+ import { homedir as homedir5 } from "node:os";
34515
+ function isWixSessionExpired(token, nowMs = Date.now()) {
34516
+ try {
34517
+ const raw = token.startsWith("JWT.") ? token.slice(4) : token;
34518
+ const mid = raw.split(".")[1];
34519
+ if (!mid) return false;
34520
+ const payload = JSON.parse(Buffer.from(mid, "base64url").toString("utf8"));
34521
+ const data = typeof payload.data === "string" ? JSON.parse(payload.data) : payload.data;
34522
+ const wxexp = data?.wxexp;
34523
+ if (!wxexp || typeof wxexp !== "string") return false;
34524
+ const expMs = Date.parse(wxexp);
34525
+ if (Number.isNaN(expMs)) return false;
34526
+ return expMs <= nowMs;
34527
+ } catch {
34528
+ return false;
34529
+ }
34530
+ }
34531
+ var AUTOMATION_KEY_PATH, DPX_SESSION_PATH, DEFAULT_PERSON_EMAIL;
34532
+ var init_person_session_auth = __esm({
34533
+ "../../core/dev-server/src/person-session-auth.ts"() {
34534
+ AUTOMATION_KEY_PATH = pathJoin(homedir5(), ".argus", "automation_master_key");
34535
+ DPX_SESSION_PATH = pathJoin(homedir5(), ".dpx", "session", "wix-session");
34536
+ DEFAULT_PERSON_EMAIL = process.env.WIX_PERSON_SESSION_EMAIL ?? "bookingsowner@test.com";
34537
+ }
34538
+ });
34539
+
34540
+ // ../../core/dev-server/src/wix-account-session.ts
34541
+ import { readFileSync as readFileSync44 } from "node:fs";
34542
+ import { homedir as homedir6 } from "node:os";
34543
+ import { join as pathJoin2 } from "node:path";
34544
+ import { createHash as createHash16 } from "node:crypto";
34545
+ function captureAccountSession(req, opts = {}) {
34546
+ const env = opts.env ?? process.env;
34547
+ const now = opts.now ?? Date.now();
34548
+ const live3 = (cookie) => {
34549
+ const ws2 = /(?:^|;\s*)wixSession2=([^;]+)/.exec(cookie)?.[1];
34550
+ if (!ws2) return false;
34551
+ let value = ws2;
34552
+ try {
34553
+ value = decodeURIComponent(ws2);
34554
+ } catch {
34555
+ }
34556
+ return !isWixSessionExpired(value, now);
34557
+ };
34558
+ const fromRequest = forwardableWixSessionCookies(req.headers.cookie);
34559
+ if (fromRequest && live3(fromRequest)) return { cookie: fromRequest, source: "cookie" };
34560
+ if (!opts.machineSession) return null;
34561
+ const fromEnv = forwardableWixSessionCookies(env.HIMI_WEB_ACCOUNT_COOKIE);
34562
+ if (fromEnv && live3(fromEnv)) return { cookie: fromEnv, source: "env" };
34563
+ let fromFile = "";
34564
+ try {
34565
+ fromFile = readFileSync44(opts.dpxSessionPath ?? pathJoin2(homedir6(), ".dpx", "session", "wix-session"), "utf8").trim();
34566
+ } catch {
34567
+ }
34568
+ if (fromFile && /^[^;\s=]+$/.test(fromFile)) {
34569
+ const cookie = `wixSession2=${fromFile}`;
34570
+ if (live3(cookie)) return { cookie, source: "file" };
34571
+ }
34572
+ return null;
34573
+ }
34574
+ function isLocalDeveloperRequest(req) {
34575
+ if (!LOOPBACK_PEERS.has(req.socket?.remoteAddress ?? "")) return false;
34576
+ const hostname3 = (req.headers.host ?? "").replace(/:\d+$/, "").toLowerCase();
34577
+ return hostname3 === "localhost" || hostname3 === "127.0.0.1" || hostname3 === "[::1]";
34578
+ }
34579
+ async function accountPrincipal(cookie, fetchImpl = fetch) {
34580
+ const identity = await resolveWixAccounts(cookie, fetchImpl);
34581
+ if (!identity.ok) return { ok: false, reason: identity.reason };
34582
+ const ids = identity.accounts.map((a2) => a2.accountId).sort().join("\n");
34583
+ return { ok: true, principal: `acct_${createHash16("sha256").update(ids).digest("hex").slice(0, 32)}` };
34584
+ }
34585
+ function safeAccountReturn(raw, requestHost, requestProto = "http") {
34586
+ if (typeof raw !== "string" || !raw) return "/";
34587
+ if (raw.startsWith("/") && !raw.startsWith("//") && !raw.startsWith("/\\")) {
34588
+ const base = "http://placeholder.invalid";
34589
+ try {
34590
+ const url = new URL(raw, base);
34591
+ if (url.origin !== base || url.pathname.startsWith("//")) return "/";
34592
+ return `${url.pathname}${url.search}${url.hash}`;
34593
+ } catch {
34594
+ return "/";
34595
+ }
34596
+ }
34597
+ try {
34598
+ const url = new URL(raw);
34599
+ if (url.protocol !== "http:" && url.protocol !== "https:") return "/";
34600
+ if (url.username || url.password) return "/";
34601
+ return !!requestHost && url.host === requestHost && url.protocol === `${requestProto}:` ? url.toString() : "/";
34602
+ } catch {
34603
+ return "/";
34604
+ }
34605
+ }
34606
+ function isWixAccountOrigin(host) {
34607
+ const hostname3 = (host ?? "").replace(/:\d+$/, "").toLowerCase();
34608
+ return hostname3 === "wix.com" || hostname3.endsWith(".wix.com");
34609
+ }
34610
+ function withAccountOutcome(target, outcome) {
34611
+ const absolute = /^https?:\/\//i.test(target);
34612
+ const url = new URL(target, "http://placeholder.invalid");
34613
+ url.searchParams.set("webwix_account", outcome);
34614
+ return absolute ? url.toString() : `${url.pathname}${url.search}${url.hash}`;
34615
+ }
34616
+ function isWixAccountModeApp(app) {
34617
+ const auth = app?.meta.auth;
34618
+ return auth?.providerId === "wix-native" && auth.config?.mode === "account";
34619
+ }
34620
+ var LOOPBACK_PEERS, ACCOUNT_SESSION_HINT;
34621
+ var init_wix_account_session = __esm({
34622
+ "../../core/dev-server/src/wix-account-session.ts"() {
34623
+ init_wix_bridge();
34624
+ init_wix_account();
34625
+ init_person_session_auth();
34626
+ LOOPBACK_PEERS = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "::ffff:127.0.0.1"]);
34627
+ ACCOUNT_SESSION_HINT = "Wix sign-in cannot redirect back to this origin. Set HIMI_WEB_ACCOUNT_COOKIE to your *.wix.com session cookies, or provision ~/.dpx/session/wix-session (docs/wix-authentication.md).";
34628
+ }
34629
+ });
34630
+
34147
34631
  // ../../core/serve-runtime/src/flag-assignments.ts
34148
34632
  function bad(error) {
34149
34633
  return new Response(JSON.stringify({ error }), { status: 400, headers: { "content-type": JSON_CT, "cache-control": "no-store" } });
@@ -34206,9 +34690,9 @@ var init_flag_assignments = __esm({
34206
34690
  });
34207
34691
 
34208
34692
  // ../../core/dev-server/src/images.ts
34209
- import { createHash as createHash16 } from "node:crypto";
34693
+ import { createHash as createHash17 } from "node:crypto";
34210
34694
  function svgFor(productId, title, sku) {
34211
- const seedHex = createHash16("sha1").update(productId + ":" + title).digest("hex");
34695
+ const seedHex = createHash17("sha1").update(productId + ":" + title).digest("hex");
34212
34696
  const h2 = (n2) => parseInt(seedHex.slice(n2, n2 + 2), 16);
34213
34697
  const hue1 = h2(0) % 360;
34214
34698
  const hue2 = (hue1 + 30 + h2(2) % 60) % 360;
@@ -34240,7 +34724,7 @@ function escapeXml(s2) {
34240
34724
  return s2.replace(/[<>&"']/g, (c2) => ({ "<": "&lt;", ">": "&gt;", "&": "&amp;", '"': "&quot;", "'": "&apos;" })[c2] ?? c2);
34241
34725
  }
34242
34726
  function wixPhotoSvg(category, seed2) {
34243
- const seedHex = createHash16("sha1").update(category + ":" + seed2).digest("hex");
34727
+ const seedHex = createHash17("sha1").update(category + ":" + seed2).digest("hex");
34244
34728
  const h2 = (n2) => parseInt(seedHex.slice(n2, n2 + 2), 16);
34245
34729
  const palette2 = paletteForCategory(category, h2);
34246
34730
  const glyph = glyphForCategory(category);
@@ -34365,9 +34849,9 @@ var init_stable_ids = __esm({
34365
34849
 
34366
34850
  // ../../core/dev-server/src/preview.ts
34367
34851
  import { spawn as spawn4 } from "node:child_process";
34368
- import { createHash as createHash17 } from "node:crypto";
34369
- import { existsSync as existsSync43, createReadStream, statSync as statSync11, readFileSync as readFileSync44, renameSync as renameSync9, unlinkSync as unlinkSync3 } from "node:fs";
34370
- import { homedir as homedir5, tmpdir as tmpdir2 } from "node:os";
34852
+ import { createHash as createHash18 } from "node:crypto";
34853
+ import { existsSync as existsSync43, createReadStream, statSync as statSync11, readFileSync as readFileSync45, renameSync as renameSync9, unlinkSync as unlinkSync3 } from "node:fs";
34854
+ import { homedir as homedir7, tmpdir as tmpdir2 } from "node:os";
34371
34855
  import { resolve as resolvePath, dirname as dirname27 } from "node:path";
34372
34856
  import { fileURLToPath as fileURLToPath18 } from "node:url";
34373
34857
  function firstExisting(paths) {
@@ -34381,7 +34865,7 @@ function macosWinlistBin() {
34381
34865
  }
34382
34866
  function macosWinlistSourceHash() {
34383
34867
  try {
34384
- return createHash17("sha1").update(readFileSync44(MACOS_WINLIST)).digest("hex").slice(0, 12);
34868
+ return createHash18("sha1").update(readFileSync45(MACOS_WINLIST)).digest("hex").slice(0, 12);
34385
34869
  } catch {
34386
34870
  return "missing";
34387
34871
  }
@@ -34526,7 +35010,7 @@ async function captureFrame(params, format = "png") {
34526
35010
  const tmp = resolvePath(tmpdir2(), `himalaya-macos-preview-${windowId}-${process.pid}-${++macosCaptureSeq}.png`);
34527
35011
  try {
34528
35012
  await runner.capture(SCREENCAPTURE_BIN, ["-o", "-x", `-l${windowId}`, tmp]);
34529
- return { buf: readFileSync44(tmp), mime: "image/png" };
35013
+ return { buf: readFileSync45(tmp), mime: "image/png" };
34530
35014
  } finally {
34531
35015
  try {
34532
35016
  unlinkSync3(tmp);
@@ -35188,7 +35672,7 @@ var init_preview2 = __esm({
35188
35672
  };
35189
35673
  runner = defaultRunner2;
35190
35674
  ADB_BIN = process.env.HIMALAYA_ADB_PATH ?? firstExisting([
35191
- resolvePath(homedir5(), "Library/Android/sdk/platform-tools/adb"),
35675
+ resolvePath(homedir7(), "Library/Android/sdk/platform-tools/adb"),
35192
35676
  "/Users/Shared/Android/sdk/platform-tools/adb",
35193
35677
  "/opt/android-sdk/platform-tools/adb"
35194
35678
  ]) ?? "adb";
@@ -35237,9 +35721,9 @@ var init_preview2 = __esm({
35237
35721
  });
35238
35722
 
35239
35723
  // ../../core/dev-server/src/tier4-integrity.ts
35240
- import { createHash as createHash18 } from "node:crypto";
35724
+ import { createHash as createHash19 } from "node:crypto";
35241
35725
  function computeSri(bytes2) {
35242
- const digest2 = createHash18("sha384").update(bytes2).digest("base64");
35726
+ const digest2 = createHash19("sha384").update(bytes2).digest("base64");
35243
35727
  return `sha384-${digest2}`;
35244
35728
  }
35245
35729
  function parseManifestIntegrity(manifest) {
@@ -35254,7 +35738,7 @@ var init_tier4_integrity = __esm({
35254
35738
  });
35255
35739
 
35256
35740
  // ../../core/dev-server/src/tier4-verifier.ts
35257
- import { readFileSync as readFileSync45, existsSync as existsSync44 } from "node:fs";
35741
+ import { readFileSync as readFileSync46, existsSync as existsSync44 } from "node:fs";
35258
35742
  import { resolve as resolve34 } from "node:path";
35259
35743
  var TierFourVerifier;
35260
35744
  var init_tier4_verifier = __esm({
@@ -35272,7 +35756,7 @@ var init_tier4_verifier = __esm({
35272
35756
  const expected = this.expectedSri(bundleId, relPath);
35273
35757
  if (!expected) return { ok: true };
35274
35758
  const path2 = resolve34(this.tier4Root, bundleId, relPath);
35275
- const bytes2 = providedBytes ?? (existsSync44(path2) ? readFileSync45(path2) : null);
35759
+ const bytes2 = providedBytes ?? (existsSync44(path2) ? readFileSync46(path2) : null);
35276
35760
  if (!bytes2) return { ok: false, reason: "file not found" };
35277
35761
  if (computeSri(bytes2) !== expected) return { ok: false, reason: "sri mismatch" };
35278
35762
  return { ok: true };
@@ -35282,7 +35766,7 @@ var init_tier4_verifier = __esm({
35282
35766
  if (cached3) return cached3;
35283
35767
  const manifestPath = resolve34(this.tier4Root, bundleId, "manifest.json");
35284
35768
  if (!existsSync44(manifestPath)) return void 0;
35285
- const manifest = JSON.parse(readFileSync45(manifestPath, "utf8"));
35769
+ const manifest = JSON.parse(readFileSync46(manifestPath, "utf8"));
35286
35770
  cached3 = { integrity: parseManifestIntegrity(manifest) };
35287
35771
  this.cache.set(bundleId, cached3);
35288
35772
  return cached3;
@@ -35346,13 +35830,13 @@ var init_net_mocks_rollover = __esm({
35346
35830
  });
35347
35831
 
35348
35832
  // ../../core/dev-server/src/player-proxy.ts
35349
- import { readFileSync as readFileSync46 } from "node:fs";
35350
- import { homedir as homedir6 } from "node:os";
35833
+ import { readFileSync as readFileSync47 } from "node:fs";
35834
+ import { homedir as homedir8 } from "node:os";
35351
35835
  import { dirname as dirname28, join as join42 } from "node:path";
35352
35836
  import { fileURLToPath as fileURLToPath19 } from "node:url";
35353
35837
  function readJson2(path2) {
35354
35838
  try {
35355
- return JSON.parse(readFileSync46(path2, "utf8"));
35839
+ return JSON.parse(readFileSync47(path2, "utf8"));
35356
35840
  } catch {
35357
35841
  return void 0;
35358
35842
  }
@@ -35364,7 +35848,7 @@ function ledgerDevServerPort(tenant) {
35364
35848
  return typeof port === "number" ? port : void 0;
35365
35849
  }
35366
35850
  function loadSupervisorRegistry() {
35367
- const home = process.env.HIMALAYA_HOME ?? join42(homedir6(), ".himalaya");
35851
+ const home = process.env.HIMALAYA_HOME ?? join42(homedir8(), ".himalaya");
35368
35852
  const reg = readJson2(join42(home, "instances.json"));
35369
35853
  return { instances: reg?.instances && typeof reg.instances === "object" ? reg.instances : {} };
35370
35854
  }
@@ -35424,7 +35908,7 @@ function tenantPrefixed(url, hostApp, method = "GET") {
35424
35908
  return tenantsOf(hostApp).includes(tenant) ? { tenant, url: tenantUrl } : null;
35425
35909
  }
35426
35910
  function forwardedBaseUrl(req) {
35427
- if (!LOOPBACK_PEERS.has(req.socket?.remoteAddress ?? "")) return null;
35911
+ if (!LOOPBACK_PEERS2.has(req.socket?.remoteAddress ?? "")) return null;
35428
35912
  const first = (h2) => (Array.isArray(h2) ? h2[0] : h2)?.split(",", 1)[0]?.trim() ?? "";
35429
35913
  const host = first(req.headers["x-forwarded-host"]);
35430
35914
  if (!host || !/^[A-Za-z0-9.\-:[\]]+$/.test(host)) return null;
@@ -35573,7 +36057,7 @@ async function proxyToServe(base, req, res, opts = {}) {
35573
36057
  res.writeHead(upstream.status, outHeaders);
35574
36058
  res.end(buf);
35575
36059
  }
35576
- var PLAYER_APP_ID, HOSTED_TENANTS, TENANT_PREFIX, LOOPBACK_PEERS, STRIP_RESPONSE_HEADERS, STRIP_REQUEST_HEADERS;
36060
+ var PLAYER_APP_ID, HOSTED_TENANTS, TENANT_PREFIX, LOOPBACK_PEERS2, STRIP_RESPONSE_HEADERS, STRIP_REQUEST_HEADERS;
35577
36061
  var init_player_proxy = __esm({
35578
36062
  "../../core/dev-server/src/player-proxy.ts"() {
35579
36063
  init_config();
@@ -35583,7 +36067,7 @@ var init_player_proxy = __esm({
35583
36067
  "himi-spaces-lite": ["himi-branded-lite"]
35584
36068
  };
35585
36069
  TENANT_PREFIX = "/__tenant/";
35586
- LOOPBACK_PEERS = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "::ffff:127.0.0.1"]);
36070
+ LOOPBACK_PEERS2 = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "::ffff:127.0.0.1"]);
35587
36071
  STRIP_RESPONSE_HEADERS = /* @__PURE__ */ new Set([
35588
36072
  "connection",
35589
36073
  "keep-alive",
@@ -128622,12 +129106,12 @@ var init_render_descriptor = __esm({
128622
129106
  });
128623
129107
 
128624
129108
  // ../../core/dev-server/src/render-fonts.ts
128625
- import { existsSync as existsSync45, readFileSync as readFileSync47 } from "node:fs";
129109
+ import { existsSync as existsSync45, readFileSync as readFileSync48 } from "node:fs";
128626
129110
  import { extname, join as join43 } from "node:path";
128627
129111
  function servedFontFaces(appDir3, tokens2) {
128628
129112
  try {
128629
129113
  const policyPath = join43(appDir3, "fonts.json");
128630
- const policy = existsSync45(policyPath) ? JSON.parse(readFileSync47(policyPath, "utf8")) : {};
129114
+ const policy = existsSync45(policyPath) ? JSON.parse(readFileSync48(policyPath, "utf8")) : {};
128631
129115
  let plan = planFonts(tokens2, policy);
128632
129116
  if (!hasVendoredFloor()) plan = { ...plan, families: plan.families.filter((f2) => !isHostProvided(f2.name)) };
128633
129117
  if (plan.families.length === 0) return void 0;
@@ -128648,7 +129132,7 @@ async function faceBytes(face, catalog3, opts) {
128648
129132
  try {
128649
129133
  if (opts.source) {
128650
129134
  const path2 = opts.source(face.file, face.sha256);
128651
- return path2 ? readFileSync47(path2) : null;
129135
+ return path2 ? readFileSync48(path2) : null;
128652
129136
  }
128653
129137
  const bytes2 = await catalogFaceBytes(face.sha256, { catalog: catalog3, ...opts.fetchFace ? { fetchFace: opts.fetchFace } : {} });
128654
129138
  return bytes2 ?? null;
@@ -128714,7 +129198,7 @@ async function idiomFontFaceCss(idiomContext) {
128714
129198
  const bundled = idiomControls2(controlIdiomFor2(idiomContext)).font.bundled;
128715
129199
  if (!bundled) return "";
128716
129200
  try {
128717
- const bytes2 = readFileSync47(new URL(`../../web-host/public/${bundled.file}`, import.meta.url));
129201
+ const bytes2 = readFileSync48(new URL(`../../web-host/public/${bundled.file}`, import.meta.url));
128718
129202
  return `@font-face { font-family: "${bundled.family}"; font-weight: 100 900; font-style: normal; src: url(data:font/ttf;base64,${bytes2.toString("base64")}) format("truetype"); }`;
128719
129203
  } catch {
128720
129204
  return "";
@@ -128757,7 +129241,7 @@ var init_tier = __esm({
128757
129241
  });
128758
129242
 
128759
129243
  // ../../core/dev-server/src/flags/index.ts
128760
- import { readFileSync as readFileSync48 } from "node:fs";
129244
+ import { readFileSync as readFileSync49 } from "node:fs";
128761
129245
  import { resolve as resolve35 } from "node:path";
128762
129246
  function selectProvider(config, store) {
128763
129247
  const local = new LocalFlagProvider(store, () => config?.overrides);
@@ -128853,7 +129337,7 @@ var init_flags2 = __esm({
128853
129337
  if (now - this.lastFetch < this.ttlMs) return;
128854
129338
  this.lastFetch = now;
128855
129339
  try {
128856
- const defs = JSON.parse(readFileSync48(resolve35(appDir3, "flags.json"), "utf8"));
129340
+ const defs = JSON.parse(readFileSync49(resolve35(appDir3, "flags.json"), "utf8"));
128857
129341
  if (Array.isArray(defs) && defs.length > 0) store.replaceAll(defs);
128858
129342
  } catch {
128859
129343
  }
@@ -128903,19 +129387,19 @@ var init_motion_flags = __esm({
128903
129387
  });
128904
129388
 
128905
129389
  // ../../core/dev-server/src/kits.ts
128906
- import { readdirSync as readdirSync24, readFileSync as readFileSync49 } from "node:fs";
129390
+ import { readdirSync as readdirSync24, readFileSync as readFileSync50 } from "node:fs";
128907
129391
  import { resolve as resolve36, join as join44 } from "node:path";
128908
129392
  import { fileURLToPath as fileURLToPath20 } from "node:url";
128909
129393
  function listKits() {
128910
129394
  return readdirSync24(CATALOG).filter((f2) => f2.endsWith(".json")).map((f2) => {
128911
- const { tokens: tokens2, ...meta } = JSON.parse(readFileSync49(join44(CATALOG, f2), "utf8"));
129395
+ const { tokens: tokens2, ...meta } = JSON.parse(readFileSync50(join44(CATALOG, f2), "utf8"));
128912
129396
  return meta;
128913
129397
  });
128914
129398
  }
128915
129399
  function readKit(id) {
128916
129400
  if (!/^[a-z0-9-]+$/.test(id)) return null;
128917
129401
  try {
128918
- return JSON.parse(readFileSync49(join44(CATALOG, `${id}.json`), "utf8"));
129402
+ return JSON.parse(readFileSync50(join44(CATALOG, `${id}.json`), "utf8"));
128919
129403
  } catch {
128920
129404
  return null;
128921
129405
  }
@@ -128946,7 +129430,7 @@ __export(widgets_exports, {
128946
129430
  viewWidgetId: () => viewWidgetId,
128947
129431
  widgetRealm: () => widgetRealm
128948
129432
  });
128949
- import { createHash as createHash19 } from "node:crypto";
129433
+ import { createHash as createHash20 } from "node:crypto";
128950
129434
  import { inspect } from "node:util";
128951
129435
  async function widgetRealm() {
128952
129436
  if (!realmPromise) {
@@ -129002,7 +129486,7 @@ function dropEntry(cache, key2) {
129002
129486
  cache.bytes -= entry.bytes;
129003
129487
  }
129004
129488
  function produceCacheKey(bundleJs, timeoutMs, clock) {
129005
- const digest2 = createHash19("sha256").update(bundleJs).digest("base64");
129489
+ const digest2 = createHash20("sha256").update(bundleJs).digest("base64");
129006
129490
  return `${timeoutMs}|${clock === void 0 ? "live" : Math.trunc(clock)}|${digest2}`;
129007
129491
  }
129008
129492
  function cachedProduce(evaluator, key2) {
@@ -129393,7 +129877,7 @@ function contentEtag(snapshot2) {
129393
129877
  // Lever A — a timeline change must bump the etag (frame values/times are content).
129394
129878
  frames: snapshot2.frames ?? null
129395
129879
  });
129396
- return "sha256-" + createHash19("sha256").update(canonical4).digest("base64");
129880
+ return "sha256-" + createHash20("sha256").update(canonical4).digest("base64");
129397
129881
  }
129398
129882
  async function buildWidgetSnapshot(bundleJs, widgetId, opts = {}) {
129399
129883
  const { widgets } = await extractWidgets(bundleJs, opts);
@@ -129650,7 +130134,7 @@ __export(config_exports2, {
129650
130134
  serializeRolloutYaml: () => serializeRolloutYaml,
129651
130135
  validateOverlayPatch: () => validateOverlayPatch
129652
130136
  });
129653
- import { mkdirSync as mkdirSync22, readFileSync as readFileSync50, writeFileSync as writeFileSync19 } from "node:fs";
130137
+ import { mkdirSync as mkdirSync22, readFileSync as readFileSync51, writeFileSync as writeFileSync19 } from "node:fs";
129654
130138
  import { dirname as dirname29, join as join45, resolve as resolve37 } from "node:path";
129655
130139
  import { fileURLToPath as fileURLToPath21 } from "node:url";
129656
130140
  function strip(line) {
@@ -129718,7 +130202,7 @@ function appConfigPath(app, file2, root = REPO_ROOT6) {
129718
130202
  for (const base of ["apps", "test-apps"]) {
129719
130203
  const p2 = join45(root, base, app, file2);
129720
130204
  try {
129721
- readFileSync50(p2);
130205
+ readFileSync51(p2);
129722
130206
  return p2;
129723
130207
  } catch {
129724
130208
  }
@@ -129771,7 +130255,7 @@ function validateOverlayPatch(patch) {
129771
130255
  }
129772
130256
  function readJsonAt(app, file2, root) {
129773
130257
  try {
129774
- return JSON.parse(readFileSync50(appConfigPath(app, file2, root), "utf8"));
130258
+ return JSON.parse(readFileSync51(appConfigPath(app, file2, root), "utf8"));
129775
130259
  } catch {
129776
130260
  return null;
129777
130261
  }
@@ -129809,14 +130293,14 @@ function saveLocalFlags(app, defs, root = REPO_ROOT6) {
129809
130293
  }
129810
130294
  function loadRollout(app) {
129811
130295
  try {
129812
- return parseRolloutYaml(readFileSync50(appConfigPath(app, "rollout.yaml"), "utf8"));
130296
+ return parseRolloutYaml(readFileSync51(appConfigPath(app, "rollout.yaml"), "utf8"));
129813
130297
  } catch {
129814
130298
  return null;
129815
130299
  }
129816
130300
  }
129817
130301
  function loadRevocations(app) {
129818
130302
  try {
129819
- return parseRevocationsYaml(readFileSync50(appConfigPath(app, "revocations.yaml"), "utf8")).revoked;
130303
+ return parseRevocationsYaml(readFileSync51(appConfigPath(app, "revocations.yaml"), "utf8")).revoked;
129820
130304
  } catch {
129821
130305
  return [];
129822
130306
  }
@@ -129894,9 +130378,9 @@ var init_config2 = __esm({
129894
130378
  // ../../core/dev-server/src/index.ts
129895
130379
  import { createServer as createServer3 } from "node:http";
129896
130380
  import { readFile, stat } from "node:fs/promises";
129897
- import { readFileSync as readFileSync51, existsSync as existsSync46, watch, mkdirSync as mkdirSync23, rmSync as rmSync11 } from "node:fs";
130381
+ import { readFileSync as readFileSync52, existsSync as existsSync46, watch, mkdirSync as mkdirSync23, rmSync as rmSync11 } from "node:fs";
129898
130382
  import { basename as basename10, dirname as dirname30, extname as extname2, join as join46, relative as relative8, resolve as resolve38, normalize as normalize3, sep as sep10 } from "node:path";
129899
- import { createHash as createHash20, randomUUID as randomUUID5 } from "node:crypto";
130383
+ import { createHash as createHash21, randomUUID as randomUUID5 } from "node:crypto";
129900
130384
  import { fileURLToPath as fileURLToPath22, pathToFileURL as pathToFileURL6 } from "node:url";
129901
130385
  function readLogicBundle(read, tier5Dir, name) {
129902
130386
  return read(tier5Dir ?? TIER5_ROOT2, name) ?? (tier5Dir && tier5Dir !== TIER5_ROOT2 ? read(TIER5_ROOT2, name) : void 0);
@@ -129942,7 +130426,7 @@ async function readBody2(req) {
129942
130426
  return Buffer.concat(chunks).toString("utf-8");
129943
130427
  }
129944
130428
  function makeEtag(body) {
129945
- return `"${createHash20("sha256").update(body).digest("hex").slice(0, 32)}"`;
130429
+ return `"${createHash21("sha256").update(body).digest("hex").slice(0, 32)}"`;
129946
130430
  }
129947
130431
  function servedTokensPath(app) {
129948
130432
  return app.module.designTokensPath ?? resolve38(app.dir, uiConfig(app.module.config).designTokensPath ?? "tokens.json");
@@ -129950,7 +130434,7 @@ function servedTokensPath(app) {
129950
130434
  function readAppTokens(state) {
129951
130435
  if (!state.app) return null;
129952
130436
  try {
129953
- const parsed = JSON.parse(readFileSync51(servedTokensPath(state.app), "utf8"));
130437
+ const parsed = JSON.parse(readFileSync52(servedTokensPath(state.app), "utf8"));
129954
130438
  delete parsed._meta;
129955
130439
  return parsed;
129956
130440
  } catch {
@@ -129962,7 +130446,7 @@ function effectiveAppConfigOverride(state) {
129962
130446
  if (state.app) {
129963
130447
  try {
129964
130448
  gitOverlay = JSON.parse(
129965
- readFileSync51(resolve38(state.app.dir, "app-config.overlay.json"), "utf8")
130449
+ readFileSync52(resolve38(state.app.dir, "app-config.overlay.json"), "utf8")
129966
130450
  );
129967
130451
  } catch {
129968
130452
  }
@@ -130031,7 +130515,7 @@ function handleL10nRequest(req, res, state) {
130031
130515
  let messages;
130032
130516
  try {
130033
130517
  messages = Object.fromEntries(
130034
- keyMap(parseCatalog(readFileSync51(path2, "utf8")), { sourceFallback: tag === sourceLocale })
130518
+ keyMap(parseCatalog(readFileSync52(path2, "utf8")), { sourceFallback: tag === sourceLocale })
130035
130519
  );
130036
130520
  } catch {
130037
130521
  return sendJson(res, 500, { error: "catalog_unreadable", app, tag }, cors);
@@ -130433,8 +130917,8 @@ async function buildDescriptorForScreenId(state, screenId, query = new URLSearch
130433
130917
  function bundleIntegritySync(name, dir) {
130434
130918
  for (const root of dir ? [dir, TIER5_ROOT2] : [TIER5_ROOT2]) {
130435
130919
  try {
130436
- const bytes2 = readFileSync51(resolve38(root, `${name}.bundle.js`));
130437
- return "sha256-" + createHash20("sha256").update(bytes2).digest("base64");
130920
+ const bytes2 = readFileSync52(resolve38(root, `${name}.bundle.js`));
130921
+ return "sha256-" + createHash21("sha256").update(bytes2).digest("base64");
130438
130922
  } catch {
130439
130923
  }
130440
130924
  }
@@ -130855,7 +131339,7 @@ function tokensAreDerived(state) {
130855
131339
  }
130856
131340
  function servedTokensHash(app) {
130857
131341
  try {
130858
- return createHash20("sha256").update(readFileSync51(servedTokensPath(app))).digest("hex");
131342
+ return createHash21("sha256").update(readFileSync52(servedTokensPath(app))).digest("hex");
130859
131343
  } catch {
130860
131344
  return "";
130861
131345
  }
@@ -131066,6 +131550,13 @@ function resolveWebWixAuth(app) {
131066
131550
  redirectUri: WEBWIX_REDIRECT
131067
131551
  });
131068
131552
  }
131553
+ function rotateWebWixSession(req, res, state, session) {
131554
+ const current = req.headers.cookie?.match(new RegExp(`(?:^|;\\s*)${WEBWIX_COOKIE}=([^;]+)`))?.[1];
131555
+ if (current && state.wixWebSessions.get(current) === session) state.wixWebSessions.set(current, {});
131556
+ const id = randomUUID5();
131557
+ state.wixWebSessions.set(id, session);
131558
+ res.setHeader("set-cookie", `${WEBWIX_COOKIE}=${id}; Path=/; HttpOnly; SameSite=Lax`);
131559
+ }
131069
131560
  function webWixSession(req, res, state) {
131070
131561
  const requestedId = req.headers.cookie?.match(new RegExp(`(?:^|;\\s*)${WEBWIX_COOKIE}=([^;]+)`))?.[1];
131071
131562
  const id = requestedId && state.wixWebSessions.has(requestedId) ? requestedId : randomUUID5();
@@ -131260,20 +131751,68 @@ async function handleWebWix(req, res, state) {
131260
131751
  session.memberToken = memberToken;
131261
131752
  session.visitorToken = visitorToken;
131262
131753
  session.email = String(b2.email ?? "");
131754
+ if (session.account) webAccountMemberInstances.forgetSession(session.account.cookie);
131755
+ session.account = void 0;
131263
131756
  return reply(200, { ok: true, email: session.email });
131264
131757
  } catch (e2) {
131265
131758
  return reply(200, { ok: false, error: String(e2?.message ?? e2) });
131266
131759
  }
131267
131760
  }
131761
+ const accountApp = isWixAccountModeApp(state.app);
131762
+ if (path2 === "/v1/__webwix/account/login" || path2 === "/v1/__webwix/account/callback") {
131763
+ if (!accountApp) return reply(404, { error: "webwix_account_unsupported" });
131764
+ const query = new URL(req.url ?? "", "http://localhost").searchParams;
131765
+ const forwardedHost = req.headers["x-forwarded-host"];
131766
+ const requestHost = (Array.isArray(forwardedHost) ? forwardedHost[0] : forwardedHost) ?? req.headers.host;
131767
+ const forwardedProto = req.headers["x-forwarded-proto"];
131768
+ const proto = (Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto) === "https" ? "https" : "http";
131769
+ const back = safeAccountReturn(query.get("return"), requestHost, proto);
131770
+ const wixOrigin = isWixAccountOrigin(requestHost);
131771
+ const signInUrl = wixOrigin ? wixAccountSignInUrl(`${proto}://${requestHost}/v1/__webwix/account/callback?return=${encodeURIComponent(back)}`) : void 0;
131772
+ const machineSession = path2 === "/v1/__webwix/account/login" && !wixOrigin && isLocalDeveloperRequest(req);
131773
+ const establish = async () => {
131774
+ const captured = captureAccountSession(req, { machineSession });
131775
+ if (!captured) return { ok: false, error: "webwix_account_no_session" };
131776
+ const who = await accountPrincipal(captured.cookie);
131777
+ if (!who.ok) return { ok: false, error: who.reason === "no_session" ? "webwix_account_no_session" : "webwix_account_upstream_failed" };
131778
+ session.account = { cookie: captured.cookie, principal: who.principal };
131779
+ session.memberToken = void 0;
131780
+ session.email = void 0;
131781
+ rotateWebWixSession(req, res, state, session);
131782
+ return { ok: true, principal: who.principal };
131783
+ };
131784
+ res.setHeader("cache-control", "no-store");
131785
+ if (path2 === "/v1/__webwix/account/login" && req.method === "GET" && signInUrl) {
131786
+ res.statusCode = 302;
131787
+ res.setHeader("location", signInUrl);
131788
+ return void res.end();
131789
+ }
131790
+ if (path2 === "/v1/__webwix/account/login" && req.method === "POST") {
131791
+ const outcome = await establish();
131792
+ return outcome.ok ? reply(200, { ok: true, authenticated: true, userId: outcome.principal }) : reply(outcome.error === "webwix_account_no_session" ? 401 : 502, {
131793
+ ok: false,
131794
+ error: outcome.error,
131795
+ ...signInUrl ? { signInUrl } : { hint: ACCOUNT_SESSION_HINT }
131796
+ });
131797
+ }
131798
+ if (req.method === "GET") {
131799
+ const outcome = await establish();
131800
+ res.statusCode = 302;
131801
+ res.setHeader("location", withAccountOutcome(back, outcome.ok ? "signed_in" : outcome.error));
131802
+ return void res.end();
131803
+ }
131804
+ return reply(405, { error: "method_not_allowed" });
131805
+ }
131268
131806
  if (path2 === "/v1/__webwix/call" && req.method === "POST") {
131269
131807
  const b2 = await readJson9();
131270
131808
  const ownerRung = b2.ownerMsid !== void 0 || b2.checkOwnerSession === true;
131809
+ const accountRung = !ownerRung && accountApp && !!session.account;
131271
131810
  const msid = String(b2.ownerMsid ?? "");
131272
131811
  const cookie = req.headers.cookie ?? "";
131273
131812
  const method = String(b2.method ?? "GET").toUpperCase();
131274
131813
  const requestedPath = String(b2.path ?? "/");
131275
131814
  const started = Date.now();
131276
- const capability = ownerRung ? "wix_api.web.owner" : "wix_api.web";
131815
+ const capability = ownerRung ? "wix_api.web.owner" : accountRung ? "wix_api.web.account" : "wix_api.web";
131277
131816
  const refuseEarly = (status, error, parsed) => {
131278
131817
  recordWixTraffic(state.wix, state.appName, state.adminUrl, {
131279
131818
  ts: started,
@@ -131300,6 +131839,7 @@ async function handleWebWix(req, res, state) {
131300
131839
  }
131301
131840
  const body = b2.body === void 0 ? void 0 : typeof b2.body === "string" ? b2.body : JSON.stringify(b2.body);
131302
131841
  const forwardedHeaders = normalizeWixForwardedHeaders(b2.headers, requestedPath);
131842
+ const logged = accountApp ? new URL(`${target.origin}${target.pathname}`) : target;
131303
131843
  const record2 = (source, status, respBody, mockRuleId, respHeaders) => {
131304
131844
  const redactBodies = source === "proxy" || mockRuleId === UNMATCHED_FAIL_CLOSED_ID;
131305
131845
  recordWixTraffic(state.wix, state.appName, state.adminUrl, {
@@ -131308,7 +131848,7 @@ async function handleWebWix(req, res, state) {
131308
131848
  capability,
131309
131849
  host: target.host,
131310
131850
  method,
131311
- url: target.toString(),
131851
+ url: logged.toString(),
131312
131852
  path: target.pathname,
131313
131853
  status,
131314
131854
  durationMs: Date.now() - started,
@@ -131318,7 +131858,7 @@ async function handleWebWix(req, res, state) {
131318
131858
  mockRuleId
131319
131859
  });
131320
131860
  };
131321
- if (b2.checkOwnerSession !== true && state.wix.mode === "mock" && (!ownerRung || failsClosed(state.wix))) {
131861
+ if (b2.checkOwnerSession !== true && state.wix.mode === "mock" && (!ownerRung && !accountRung || failsClosed(state.wix))) {
131322
131862
  const matchCtx = { host: target.host, query: Object.fromEntries(target.searchParams.entries()), headers: forwardedHeaders, body };
131323
131863
  let match = matchRuleEx(state.wix.rules, method, target.pathname, matchCtx);
131324
131864
  if (match && (match.rule.kind ?? "mock") !== "mock") {
@@ -131338,6 +131878,44 @@ async function handleWebWix(req, res, state) {
131338
131878
  return reply(200, { status: refusal.status, body: refusal.body });
131339
131879
  }
131340
131880
  }
131881
+ if (accountRung && session.account) {
131882
+ const account = session.account;
131883
+ const absolute = /^[a-z][a-z0-9+.-]*:\/\//i.test(requestedPath);
131884
+ const allowed2 = absolute && !!allowedAccountTarget(method, requestedPath);
131885
+ const siteId = Object.entries(forwardedHeaders).find(([name]) => name.toLowerCase() === "wix-site-id")?.[1]?.trim() ?? "";
131886
+ if (allowed2 || !absolute && siteId) {
131887
+ if (siteId && !isSafeMsid(siteId)) return refuseEarly(400, "webwix_account_bad_site_id", logged);
131888
+ res.setHeader("cache-control", "no-store");
131889
+ const send2 = async (force) => {
131890
+ const instance = siteId ? await webAccountMemberInstances.instance(siteId, account.cookie, { force }) : void 0;
131891
+ return allowed2 ? wixAccountCall(method, requestedPath, body, account.cookie, fetch, forwardedHeaders, instance) : wixVisitorCall(method, requestedPath, body, instance ?? "", fetch, forwardedHeaders);
131892
+ };
131893
+ try {
131894
+ let result = await send2(false);
131895
+ if (result.status === 401 && siteId) result = await send2(true);
131896
+ if (result.status >= 200 && result.status < 300 && isAccountJoinCall(method, requestedPath)) {
131897
+ webAccountMemberInstances.forgetRefusals(account.cookie);
131898
+ }
131899
+ record2("proxy", result.status, result.body);
131900
+ return reply(200, result);
131901
+ } catch (e2) {
131902
+ if (e2 instanceof AccountSessionExpired) {
131903
+ webAccountMemberInstances.forgetSession(account.cookie);
131904
+ if (session.account === account) session.account = void 0;
131905
+ }
131906
+ if (e2 instanceof NotSiteMember || e2 instanceof SiteInstanceUnavailable || e2 instanceof AccountSessionExpired) {
131907
+ const refusal = memberInstanceRefusal(e2);
131908
+ record2("proxy", refusal.status, void 0);
131909
+ return reply(refusal.status, refusal.body);
131910
+ }
131911
+ record2("proxy", 502, void 0);
131912
+ return reply(502, { error: "webwix_bridge_upstream_failed" });
131913
+ }
131914
+ }
131915
+ }
131916
+ if (accountApp && !ownerRung && !session.account && /^[a-z][a-z0-9+.-]*:\/\//i.test(requestedPath) && allowedAccountTarget(method, requestedPath)) {
131917
+ return refuseEarly(401, "webwix_account_signed_out", logged);
131918
+ }
131341
131919
  if (ownerRung) {
131342
131920
  try {
131343
131921
  if (b2.checkOwnerSession !== true && method === "POST" && isOwnerSitesPath(requestedPath)) {
@@ -131393,11 +131971,16 @@ async function handleWebWix(req, res, state) {
131393
131971
  }
131394
131972
  }
131395
131973
  if (path2 === "/v1/__webwix/logout" && req.method === "POST") {
131974
+ if (session.account) webAccountMemberInstances.forgetSession(session.account.cookie);
131396
131975
  session.memberToken = void 0;
131397
131976
  session.email = void 0;
131977
+ session.account = void 0;
131398
131978
  return reply(200, { ok: true });
131399
131979
  }
131400
131980
  if (path2 === "/v1/__webwix/identity" && (req.method === "GET" || req.method === "POST")) {
131981
+ if (accountApp && session.account) {
131982
+ return reply(200, { authenticated: true, mode: "account", userId: session.account.principal, email: "" });
131983
+ }
131401
131984
  if (!session.memberToken) return reply(200, { authenticated: false, userId: null, email: "" });
131402
131985
  const userId = await readMemberId(session.memberToken);
131403
131986
  const preferenceIdentity = session.email?.trim().toLowerCase() || userId;
@@ -131406,7 +131989,7 @@ async function handleWebWix(req, res, state) {
131406
131989
  userId: userId ?? session.email ?? null,
131407
131990
  email: session.email ?? "",
131408
131991
  preferenceContext: preferenceIdentity ? {
131409
- accountId: `m_${createHash20("sha256").update(preferenceIdentity).digest("hex")}`,
131992
+ accountId: `m_${createHash21("sha256").update(preferenceIdentity).digest("hex")}`,
131410
131993
  // Headless client IDs are site-bound and come from the server's app
131411
131994
  // configuration, never the URL's user-supplied business parameter.
131412
131995
  businessId: auth.clientId
@@ -131427,6 +132010,8 @@ async function handleWebWix(req, res, state) {
131427
132010
  session.memberToken = memberToken;
131428
132011
  session.visitorToken = visitorToken;
131429
132012
  session.email = String(b2.email ?? "");
132013
+ if (session.account) webAccountMemberInstances.forgetSession(session.account.cookie);
132014
+ session.account = void 0;
131430
132015
  return reply(200, { ok: true, email: session.email });
131431
132016
  } catch (e2) {
131432
132017
  return reply(200, { ok: false, error: String(e2?.message ?? e2) });
@@ -132125,7 +132710,7 @@ async function readBundleFile(name, dir) {
132125
132710
  if (!roots.some((root) => path2.startsWith(root))) continue;
132126
132711
  try {
132127
132712
  const bytes2 = await readFile(path2);
132128
- const integrity2 = "sha256-" + createHash20("sha256").update(bytes2).digest("base64");
132713
+ const integrity2 = "sha256-" + createHash21("sha256").update(bytes2).digest("base64");
132129
132714
  return { bytes: bytes2, integrity: integrity2 };
132130
132715
  } catch {
132131
132716
  }
@@ -132290,12 +132875,12 @@ function readActionHandlerManifest(app) {
132290
132875
  let decls;
132291
132876
  let bytes2;
132292
132877
  try {
132293
- decls = JSON.parse(readFileSync51(manifestPath, "utf8"));
132294
- bytes2 = readFileSync51(bundlePath);
132878
+ decls = JSON.parse(readFileSync52(manifestPath, "utf8"));
132879
+ bytes2 = readFileSync52(bundlePath);
132295
132880
  } catch {
132296
132881
  return { handlers: [] };
132297
132882
  }
132298
- const integrity2 = "sha256-" + createHash20("sha256").update(bytes2).digest("base64");
132883
+ const integrity2 = "sha256-" + createHash21("sha256").update(bytes2).digest("base64");
132299
132884
  const bundleUrl = `/v1/action-handler-bundles/${app}`;
132300
132885
  return { handlers: decls.map((d2) => ({ id: d2.id, policy: d2.policy, description: d2.description, bundleUrl, integrity: integrity2 })) };
132301
132886
  }
@@ -132308,7 +132893,7 @@ async function handleActionHandlerBundleGet(res, app) {
132308
132893
  if (!path2.startsWith(ACTION_HANDLERS_ROOT)) return sendJson(res, 404, { error: "not_found" });
132309
132894
  try {
132310
132895
  const bytes2 = await readFile(path2);
132311
- const integrity2 = "sha256-" + createHash20("sha256").update(bytes2).digest("base64");
132896
+ const integrity2 = "sha256-" + createHash21("sha256").update(bytes2).digest("base64");
132312
132897
  res.setHeader("content-type", "application/javascript; charset=utf-8");
132313
132898
  res.setHeader("cache-control", "max-age=300");
132314
132899
  res.setHeader("x-himalaya-bundle-integrity", integrity2);
@@ -132610,7 +133195,7 @@ function createDevServer(opts = {}) {
132610
133195
  const q2 = new URLSearchParams(url.split("?")[1] ?? "");
132611
133196
  const assetApp = q2.get("app") ?? state.appName;
132612
133197
  const assetDir = state.app && assetApp === state.app.name ? state.app.dir : resolveAppDir(assetApp);
132613
- const hit = assetDir ? collectAssets(assetDir).find((a2) => assetSha256(readFileSync51(a2.path)) === sha2) : void 0;
133198
+ const hit = assetDir ? collectAssets(assetDir).find((a2) => assetSha256(readFileSync52(a2.path)) === sha2) : void 0;
132614
133199
  if (!hit && assetDir) {
132615
133200
  const fontBytes = await fontFaceBytesBySha(assetDir, sha2);
132616
133201
  if (fontBytes) {
@@ -132633,7 +133218,7 @@ function createDevServer(opts = {}) {
132633
133218
  res.end(JSON.stringify({ error: "asset_not_found", app: assetApp, sha: sha2 }));
132634
133219
  return;
132635
133220
  }
132636
- const bytes2 = readFileSync51(hit.path);
133221
+ const bytes2 = readFileSync52(hit.path);
132637
133222
  res.writeHead(200, {
132638
133223
  "content-type": hit.contentType,
132639
133224
  "content-length": String(bytes2.length),
@@ -132726,7 +133311,7 @@ function createDevServer(opts = {}) {
132726
133311
  if (url === "/v1/schema/screen-descriptor.json" && req.method === "GET") {
132727
133312
  try {
132728
133313
  const schemaPath = resolve38(ROOT6, "core/schema/generated/screen-descriptor.schema.json");
132729
- const body = readFileSync51(schemaPath, "utf8");
133314
+ const body = readFileSync52(schemaPath, "utf8");
132730
133315
  return send(res, 200, body, {
132731
133316
  "content-type": "application/schema+json; charset=utf-8",
132732
133317
  "cache-control": "no-store",
@@ -132777,7 +133362,7 @@ function createDevServer(opts = {}) {
132777
133362
  try {
132778
133363
  const { parseRevocationsYaml: parseRevocationsYaml2 } = await Promise.resolve().then(() => (init_config2(), config_exports2));
132779
133364
  revoked = parseRevocationsYaml2(
132780
- readFileSync51(resolve38(state.app.dir, "revocations.yaml"), "utf8")
133365
+ readFileSync52(resolve38(state.app.dir, "revocations.yaml"), "utf8")
132781
133366
  ).revoked;
132782
133367
  } catch {
132783
133368
  }
@@ -132990,7 +133575,7 @@ ${err.message}`);
132990
133575
  });
132991
133576
  return httpServer;
132992
133577
  }
132993
- var ROOT6, TIER3_ROOT, TIER4_ROOT, tier4Verifier, TIER5_ROOT2, ACTION_HANDLERS_ROOT, SAMPLES_ROOT, TELEMETRY_BUFFER_CAP, overrideHistorySeq, CACHE_CONTROL, TIER5_SRC_ROOT, HMR_TMP_DIR, appReloadSeq, appReloadChain, WEBWIX_CLIENT_ID, WEBWIX_REDIRECT, WEBWIX_COOKIE, webOwnerPreviewInstances, MIME, widgetOverrides;
133578
+ var ROOT6, TIER3_ROOT, TIER4_ROOT, tier4Verifier, TIER5_ROOT2, ACTION_HANDLERS_ROOT, SAMPLES_ROOT, TELEMETRY_BUFFER_CAP, overrideHistorySeq, CACHE_CONTROL, TIER5_SRC_ROOT, HMR_TMP_DIR, appReloadSeq, appReloadChain, WEBWIX_CLIENT_ID, WEBWIX_REDIRECT, WEBWIX_COOKIE, webOwnerPreviewInstances, webAccountMemberInstances, MIME, widgetOverrides;
132994
133579
  var init_src6 = __esm({
132995
133580
  "../../core/dev-server/src/index.ts"() {
132996
133581
  init_inject();
@@ -133004,6 +133589,7 @@ var init_src6 = __esm({
133004
133589
  init_aria_realtime_dev();
133005
133590
  init_wix_member_login();
133006
133591
  init_wix_bridge();
133592
+ init_wix_account_session();
133007
133593
  init_flag_assignments();
133008
133594
  init_images();
133009
133595
  init_l10n();
@@ -133052,6 +133638,7 @@ var init_src6 = __esm({
133052
133638
  WEBWIX_REDIRECT = "himalaya-demo-app://oauth/callback";
133053
133639
  WEBWIX_COOKIE = "himi_webwix_session";
133054
133640
  webOwnerPreviewInstances = new OwnerInstanceCache(fetch);
133641
+ webAccountMemberInstances = new MemberInstanceCache(fetch);
133055
133642
  MIME = {
133056
133643
  ".html": "text/html; charset=utf-8",
133057
133644
  ".css": "text/css; charset=utf-8",
@@ -133071,9 +133658,9 @@ var init_src6 = __esm({
133071
133658
  });
133072
133659
 
133073
133660
  // ../../core/serve-storage/src/release-patch.ts
133074
- import { createHash as createHash21 } from "node:crypto";
133661
+ import { createHash as createHash22 } from "node:crypto";
133075
133662
  function sha256hex(b2) {
133076
- return createHash21("sha256").update(b2).digest("hex");
133663
+ return createHash22("sha256").update(b2).digest("hex");
133077
133664
  }
133078
133665
  function stableStringify(value) {
133079
133666
  if (value === null || typeof value !== "object") return JSON.stringify(value);
@@ -136004,11 +136591,11 @@ var init_dependencies = __esm({
136004
136591
  });
136005
136592
 
136006
136593
  // ../../core/functions-build/src/sbom.ts
136007
- import { createHash as createHash22 } from "node:crypto";
136594
+ import { createHash as createHash23 } from "node:crypto";
136008
136595
  function createFunctionSbom(packages) {
136009
136596
  const components2 = [...packages].sort((a2, b2) => a2.name.localeCompare(b2.name)).map(({ name, version: version4, integrity: integrity2, license }) => ({ name, version: version4, integrity: integrity2, license }));
136010
136597
  const body = JSON.stringify({ format: "himalaya-sbom-v1", components: components2 });
136011
- return { format: "himalaya-sbom-v1", components: components2, hash: createHash22("sha256").update(body).digest("hex") };
136598
+ return { format: "himalaya-sbom-v1", components: components2, hash: createHash23("sha256").update(body).digest("hex") };
136012
136599
  }
136013
136600
  var init_sbom = __esm({
136014
136601
  "../../core/functions-build/src/sbom.ts"() {
@@ -136016,12 +136603,12 @@ var init_sbom = __esm({
136016
136603
  });
136017
136604
 
136018
136605
  // ../../core/functions-build/src/build.ts
136019
- import { createHash as createHash23 } from "node:crypto";
136606
+ import { createHash as createHash24 } from "node:crypto";
136020
136607
  function sha2563(value) {
136021
- return createHash23("sha256").update(value).digest("hex");
136608
+ return createHash24("sha256").update(value).digest("hex");
136022
136609
  }
136023
136610
  function sri(value) {
136024
- return `sha256-${createHash23("sha256").update(value).digest("base64")}`;
136611
+ return `sha256-${createHash24("sha256").update(value).digest("base64")}`;
136025
136612
  }
136026
136613
  function schemaHash(schema) {
136027
136614
  if (!schema) return "";
@@ -136215,8 +136802,8 @@ __export(build_exports2, {
136215
136802
  withStoreNavBundle: () => withStoreNavBundle,
136216
136803
  withoutDevOnlyAppConfig: () => withoutDevOnlyAppConfig
136217
136804
  });
136218
- import { createHash as createHash24 } from "node:crypto";
136219
- import { readFileSync as readFileSync52, readdirSync as readdirSync25, existsSync as existsSync47 } from "node:fs";
136805
+ import { createHash as createHash25 } from "node:crypto";
136806
+ import { readFileSync as readFileSync53, readdirSync as readdirSync25, existsSync as existsSync47 } from "node:fs";
136220
136807
  import { dirname as dirname31, join as join47, resolve as resolve39 } from "node:path";
136221
136808
  import { fileURLToPath as fileURLToPath23 } from "node:url";
136222
136809
  import { createRequire as createRequire2 } from "node:module";
@@ -136262,7 +136849,7 @@ function l10nLintOptions(locale, appDir3) {
136262
136849
  const path2 = join47(appDir3, "l10n", `${tag}.json`);
136263
136850
  if (!existsSync47(path2)) continue;
136264
136851
  try {
136265
- const parsed = JSON.parse(readFileSync52(path2, "utf8"));
136852
+ const parsed = JSON.parse(readFileSync53(path2, "utf8"));
136266
136853
  for (const m2 of Object.values(parsed.messages ?? {})) {
136267
136854
  if (typeof m2?.source === "string" && typeof m2.translation === "string" && m2.translation.length > 0) {
136268
136855
  catalog3.add(m2.source);
@@ -136298,10 +136885,10 @@ function servesMessages(text9) {
136298
136885
  }
136299
136886
  }
136300
136887
  function sha2564(buf) {
136301
- return createHash24("sha256").update(buf).digest("hex");
136888
+ return createHash25("sha256").update(buf).digest("hex");
136302
136889
  }
136303
136890
  function sri2(buf) {
136304
- return "sha256-" + createHash24("sha256").update(buf).digest("base64");
136891
+ return "sha256-" + createHash25("sha256").update(buf).digest("base64");
136305
136892
  }
136306
136893
  async function widgetFailureDetail(res) {
136307
136894
  try {
@@ -136629,7 +137216,7 @@ async function buildReleaseFromContent(contentDir2, dest, opts = {}) {
136629
137216
  function readTokensForLint(preloaded) {
136630
137217
  try {
136631
137218
  const tokenPath = preloaded.module.designTokensPath ?? resolve39(preloaded.dir, uiConfig(preloaded.module.config).designTokensPath ?? "tokens.json");
136632
- const parsed = JSON.parse(readFileSync52(tokenPath, "utf8"));
137219
+ const parsed = JSON.parse(readFileSync53(tokenPath, "utf8"));
136633
137220
  delete parsed._meta;
136634
137221
  return parsed;
136635
137222
  } catch {
@@ -136651,7 +137238,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136651
137238
  };
136652
137239
  const readBundle = (name) => {
136653
137240
  const path2 = bundlePath(name);
136654
- return path2 ? readFileSync52(path2, "utf8") : void 0;
137241
+ return path2 ? readFileSync53(path2, "utf8") : void 0;
136655
137242
  };
136656
137243
  const collect2 = opts.collect;
136657
137244
  const config = preloaded.module.config;
@@ -136797,11 +137384,11 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136797
137384
  };
136798
137385
  checkRegistry(preloaded.module.actions);
136799
137386
  const contentManifestPath2 = join47(preloaded.dir, "himalaya.content.json");
136800
- const contentManifest = existsSync47(contentManifestPath2) ? JSON.parse(readFileSync52(contentManifestPath2, "utf8")) : void 0;
137387
+ const contentManifest = existsSync47(contentManifestPath2) ? JSON.parse(readFileSync53(contentManifestPath2, "utf8")) : void 0;
136801
137388
  let screenMetadata = parseScreenMetadata(contentManifest?.screens);
136802
137389
  if (contentManifest?.shell === "brandy" && screenMetadata) {
136803
137390
  const provisioningPath2 = join47(preloaded.dir, "provisioning.json");
136804
- if (existsSync47(provisioningPath2)) screenMetadata = siteViewMetadataForBuild(screenMetadata, JSON.parse(readFileSync52(provisioningPath2, "utf8")).site);
137391
+ if (existsSync47(provisioningPath2)) screenMetadata = siteViewMetadataForBuild(screenMetadata, JSON.parse(readFileSync53(provisioningPath2, "utf8")).site);
136805
137392
  }
136806
137393
  await store.reset(app);
136807
137394
  const bundles = {};
@@ -136838,7 +137425,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136838
137425
  try {
136839
137426
  const path2 = bundlePath(name);
136840
137427
  if (!path2) return null;
136841
- bytes2 = readFileSync52(path2);
137428
+ bytes2 = readFileSync53(path2);
136842
137429
  } catch {
136843
137430
  return null;
136844
137431
  }
@@ -136862,7 +137449,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136862
137449
  for (const [name, file2] of [["spec", "SPEC.md"], ["mobile-ux", "MOBILE-UX.md"]]) {
136863
137450
  const path2 = join47(preloaded.dir, file2);
136864
137451
  if (!existsSync47(path2)) continue;
136865
- const bytes2 = readFileSync52(path2);
137452
+ const bytes2 = readFileSync53(path2);
136866
137453
  if (bytes2.length === 0 || bytes2.length > MAX_AUTHORING_DOC_BYTES) {
136867
137454
  throw new Error(`${file2} must be non-empty and at most ${MAX_AUTHORING_DOC_BYTES} bytes to ship with a release.`);
136868
137455
  }
@@ -136877,7 +137464,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136877
137464
  const iconPath = resolveAppDirIcon(preloaded.dir);
136878
137465
  if (iconPath) {
136879
137466
  try {
136880
- const bytes2 = readFileSync52(iconPath);
137467
+ const bytes2 = readFileSync53(iconPath);
136881
137468
  await store.putIcon(app, bytes2);
136882
137469
  iconHash = sha2564(bytes2);
136883
137470
  } catch {
@@ -136899,7 +137486,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136899
137486
  }
136900
137487
  const seenAssetSha = /* @__PURE__ */ new Set();
136901
137488
  for (const a2 of collected) {
136902
- const bytes2 = readFileSync52(a2.path);
137489
+ const bytes2 = readFileSync53(a2.path);
136903
137490
  const hash2 = sha2564(bytes2);
136904
137491
  if (!seenAssetSha.has(hash2)) {
136905
137492
  await store.putAsset(app, hash2, bytes2, a2.contentType);
@@ -136921,7 +137508,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136921
137508
  const fontWarnings = [];
136922
137509
  try {
136923
137510
  const appTokens = readTokensForLint(preloaded) ?? {};
136924
- const policy = existsSync47(join47(preloaded.dir, "fonts.json")) ? JSON.parse(readFileSync52(join47(preloaded.dir, "fonts.json"), "utf8")) : {};
137511
+ const policy = existsSync47(join47(preloaded.dir, "fonts.json")) ? JSON.parse(readFileSync53(join47(preloaded.dir, "fonts.json"), "utf8")) : {};
136925
137512
  fontPlan = planFonts(appTokens, policy);
136926
137513
  } catch (err) {
136927
137514
  throw new Error(
@@ -136937,7 +137524,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136937
137524
  `[release-build] ${family.name} face ${face.postScriptName} has no local bytes (sha ${face.sha256.slice(0, 12)}\u2026), so the release would declare a face the asset route cannot serve. Run \`npm run fonts:catalog\` to warm the cache before publishing.`
136938
137525
  );
136939
137526
  }
136940
- const bytes2 = readFileSync52(src);
137527
+ const bytes2 = readFileSync53(src);
136941
137528
  const hash2 = sha2564(bytes2);
136942
137529
  if (hash2 !== face.sha256) {
136943
137530
  throw new Error(
@@ -136987,7 +137574,7 @@ async function buildFromLoaded(preloaded, dest, opts = {}) {
136987
137574
  if (store.putAsset) {
136988
137575
  for (const face of collectBrandFonts(preloaded.dir)) {
136989
137576
  try {
136990
- const bytes2 = readFileSync52(face.path);
137577
+ const bytes2 = readFileSync53(face.path);
136991
137578
  if (bytes2.length === 0) continue;
136992
137579
  const hash2 = sha2564(bytes2);
136993
137580
  await store.putAsset(app, hash2, bytes2, "font/ttf");
@@ -137454,7 +138041,7 @@ async function buildFunctionsOnlyRelease(preloaded, dest) {
137454
138041
  const candidates = [".ts", ".js", ".mts", ".mjs"].map((extension) => join47(preloaded.dir, "functions", `${definition.name}${extension}`));
137455
138042
  const source = candidates.find((candidate) => existsSync47(candidate));
137456
138043
  if (!source) throw new Error(`missing source for function ${definition.name}; expected functions/${definition.name}.ts`);
137457
- sources[definition.name] = readFileSync52(source, "utf8");
138044
+ sources[definition.name] = readFileSync53(source, "utf8");
137458
138045
  }
137459
138046
  const built = await buildFunctions(config.functions.functions, sources);
137460
138047
  const bundles = {};
@@ -138089,7 +138676,7 @@ __export(build_changes_exports, {
138089
138676
  diffTokens: () => diffTokens,
138090
138677
  headline: () => headline
138091
138678
  });
138092
- import { existsSync as existsSync48, readdirSync as readdirSync26, readFileSync as readFileSync53 } from "node:fs";
138679
+ import { existsSync as existsSync48, readdirSync as readdirSync26, readFileSync as readFileSync54 } from "node:fs";
138093
138680
  import { join as join48 } from "node:path";
138094
138681
  function componentsOf(descriptor) {
138095
138682
  const out2 = /* @__PURE__ */ new Map();
@@ -138229,7 +138816,7 @@ var init_build_changes = __esm({
138229
138816
  scalar2 = (v2) => typeof v2 === "string" || typeof v2 === "number" || typeof v2 === "boolean";
138230
138817
  readJson3 = (path2) => {
138231
138818
  try {
138232
- return JSON.parse(readFileSync53(path2, "utf8"));
138819
+ return JSON.parse(readFileSync54(path2, "utf8"));
138233
138820
  } catch {
138234
138821
  return void 0;
138235
138822
  }
@@ -138246,7 +138833,7 @@ var init_build_changes = __esm({
138246
138833
  });
138247
138834
 
138248
138835
  // src/studio-timeline.ts
138249
- import { existsSync as existsSync49, readFileSync as readFileSync54 } from "node:fs";
138836
+ import { existsSync as existsSync49, readFileSync as readFileSync55 } from "node:fs";
138250
138837
  import { join as join49 } from "node:path";
138251
138838
  function stateOf(view) {
138252
138839
  const j2 = view.journal[0];
@@ -138317,7 +138904,7 @@ function readTimeline(dir) {
138317
138904
  const file2 = join49(dir, TIMELINE_FILE);
138318
138905
  if (!existsSync49(file2)) return [];
138319
138906
  const out2 = [];
138320
- for (const line of readFileSync54(file2, "utf8").split("\n")) {
138907
+ for (const line of readFileSync55(file2, "utf8").split("\n")) {
138321
138908
  if (!line.trim()) continue;
138322
138909
  try {
138323
138910
  const f2 = JSON.parse(line);
@@ -138410,8 +138997,8 @@ __export(studio_exports, {
138410
138997
  renderStudioHtml: () => renderStudioHtml,
138411
138998
  writeStudioRecord: () => writeStudioRecord
138412
138999
  });
138413
- import { createHash as createHash25 } from "node:crypto";
138414
- import { existsSync as existsSync50, readdirSync as readdirSync27, readFileSync as readFileSync55, realpathSync as realpathSync8, statSync as statSync12 } from "node:fs";
139000
+ import { createHash as createHash26 } from "node:crypto";
139001
+ import { existsSync as existsSync50, readdirSync as readdirSync27, readFileSync as readFileSync56, realpathSync as realpathSync8, statSync as statSync12 } from "node:fs";
138415
139002
  import { basename as basename11, extname as extname3, join as join50, relative as relative9, resolve as resolve40, sep as sep11 } from "node:path";
138416
139003
  import { pathToFileURL as pathToFileURL7 } from "node:url";
138417
139004
  function realInside(dir, abs) {
@@ -138442,7 +139029,7 @@ function archiveFile(dir, memory, abs) {
138442
139029
  }
138443
139030
  let archived;
138444
139031
  try {
138445
- archived = archiveBytes(dir, readFileSync55(real));
139032
+ archived = archiveBytes(dir, readFileSync56(real));
138446
139033
  } catch {
138447
139034
  return null;
138448
139035
  }
@@ -138692,7 +139279,7 @@ function buildView(dir, memory, now) {
138692
139279
  reveal: memory.reveal ?? null
138693
139280
  };
138694
139281
  const { generatedAt: _ignored, timelineFrames: _count, ...stable } = view;
138695
- const v2 = createHash25("sha256").update(JSON.stringify(stable)).digest("hex").slice(0, 16);
139282
+ const v2 = createHash26("sha256").update(JSON.stringify(stable)).digest("hex").slice(0, 16);
138696
139283
  return { v: v2, ...view };
138697
139284
  }
138698
139285
  function writeAtomic(file2, content) {
@@ -138770,7 +139357,7 @@ var init_studio = __esm({
138770
139357
  MAX_NAV_EDGES = 40;
138771
139358
  readJson4 = (file2) => {
138772
139359
  try {
138773
- return JSON.parse(readFileSync55(file2, "utf8"));
139360
+ return JSON.parse(readFileSync56(file2, "utf8"));
138774
139361
  } catch {
138775
139362
  return null;
138776
139363
  }
@@ -139334,11 +139921,11 @@ __export(captcha_exports, {
139334
139921
  captchaContentInput: () => captchaContentInput,
139335
139922
  runCaptcha: () => runCaptcha
139336
139923
  });
139337
- import { readFileSync as readFileSync56 } from "node:fs";
139924
+ import { readFileSync as readFileSync57 } from "node:fs";
139338
139925
  import { resolve as resolve41 } from "node:path";
139339
139926
  function readObject(path2) {
139340
139927
  try {
139341
- return JSON.parse(readFileSync56(path2, "utf8"));
139928
+ return JSON.parse(readFileSync57(path2, "utf8"));
139342
139929
  } catch {
139343
139930
  return {};
139344
139931
  }
@@ -139408,7 +139995,7 @@ __export(preflight_exports, {
139408
139995
  parseStoreConfig: () => parseStoreConfig,
139409
139996
  requireEnv: () => requireEnv
139410
139997
  });
139411
- import { existsSync as existsSync51, readFileSync as readFileSync57 } from "node:fs";
139998
+ import { existsSync as existsSync51, readFileSync as readFileSync58 } from "node:fs";
139412
139999
  import { isAbsolute as isAbsolute4, relative as relative10, resolve as resolve42 } from "node:path";
139413
140000
  function isInsideRepo(p2) {
139414
140001
  const rel = relative10(REPO_ROOT3, resolve42(p2));
@@ -139468,7 +140055,7 @@ function loadStoreConfig(app) {
139468
140055
  if (!existsSync51(p2)) {
139469
140056
  throw new Error(`No store config at ${p2}. Create apps/${app}/store/store.config.yaml first (see /setup-store-signing).`);
139470
140057
  }
139471
- return parseStoreConfig(readFileSync57(p2, "utf8"));
140058
+ return parseStoreConfig(readFileSync58(p2, "utf8"));
139472
140059
  }
139473
140060
  var init_preflight = __esm({
139474
140061
  "../store-release/preflight.ts"() {
@@ -145538,7 +146125,7 @@ var init_fxp = __esm({
145538
146125
  });
145539
146126
 
145540
146127
  // ../../packages/serve/src/pkcs12.ts
145541
- import { X509Certificate, createHash as createHash26, createPrivateKey as createPrivateKey2, createPublicKey, pbkdf2Sync, createDecipheriv } from "node:crypto";
146128
+ import { X509Certificate, createHash as createHash27, createPrivateKey as createPrivateKey2, createPublicKey, pbkdf2Sync, createDecipheriv } from "node:crypto";
145542
146129
  function decodePkcs12(der, password) {
145543
146130
  try {
145544
146131
  const pfx = readSequence(der, 0);
@@ -145812,7 +146399,7 @@ function expand(src, v2) {
145812
146399
  return out2;
145813
146400
  }
145814
146401
  function sha12(data) {
145815
- return createHash26("sha1").update(data).digest();
146402
+ return createHash27("sha1").update(data).digest();
145816
146403
  }
145817
146404
  function readAt(buf, i2) {
145818
146405
  if (i2 >= buf.length) return void 0;
@@ -145901,7 +146488,7 @@ var init_pkcs12 = __esm({
145901
146488
  });
145902
146489
 
145903
146490
  // ../../packages/serve/src/customer-signing-assets.ts
145904
- import { createHash as createHash27 } from "node:crypto";
146491
+ import { createHash as createHash28 } from "node:crypto";
145905
146492
  function readValue(node) {
145906
146493
  const [tag, children] = Object.entries(node)[0] ?? [];
145907
146494
  if (!tag || !Array.isArray(children)) return refuse3("customer_profile_invalid");
@@ -145979,7 +146566,7 @@ function toBundle(assets, expected, decoded, profileType, apns, deviceCount) {
145979
146566
  provisioningProfile: Buffer.from(assets.provisioningProfile).toString("base64"),
145980
146567
  profileSha256: sha2565(assets.provisioningProfile),
145981
146568
  certificateSha256: sha2565(decoded.cert.raw),
145982
- certificateSha1: createHash27("sha1").update(decoded.cert.raw).digest("hex").toUpperCase(),
146569
+ certificateSha1: createHash28("sha1").update(decoded.cert.raw).digest("hex").toUpperCase(),
145983
146570
  expiresAt: new Date(Math.min(decoded.expiration, Date.parse(decoded.cert.validTo))).toISOString(),
145984
146571
  ...apns ? { apnsEnvironment: apns } : {},
145985
146572
  deviceCount
@@ -146030,7 +146617,7 @@ var init_customer_signing_assets = __esm({
146030
146617
  init_fxp();
146031
146618
  init_pkcs12();
146032
146619
  init_customer_dist_signing();
146033
- sha2565 = (bytes2) => createHash27("sha256").update(bytes2).digest("hex");
146620
+ sha2565 = (bytes2) => createHash28("sha256").update(bytes2).digest("hex");
146034
146621
  refuse3 = (code) => {
146035
146622
  throw new CustomerSigningError(code);
146036
146623
  };
@@ -146197,11 +146784,11 @@ var init_customer_signing_inspect = __esm({
146197
146784
  });
146198
146785
 
146199
146786
  // src/push-onboarding.ts
146200
- import { existsSync as existsSync52, mkdirSync as mkdirSync24, readFileSync as readFileSync58, statSync as statSync13, writeFileSync as writeFileSync20, chmodSync as chmodSync2 } from "node:fs";
146787
+ import { existsSync as existsSync52, mkdirSync as mkdirSync24, readFileSync as readFileSync59, statSync as statSync13, writeFileSync as writeFileSync20, chmodSync as chmodSync2 } from "node:fs";
146201
146788
  import { basename as basename12, dirname as dirname32, join as join51, resolve as resolve43 } from "node:path";
146202
146789
  function readJson5(path2) {
146203
146790
  try {
146204
- const parsed = JSON.parse(readFileSync58(path2, "utf8"));
146791
+ const parsed = JSON.parse(readFileSync59(path2, "utf8"));
146205
146792
  return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
146206
146793
  } catch {
146207
146794
  return {};
@@ -146286,7 +146873,7 @@ function readKeyFile(path2) {
146286
146873
  }
146287
146874
  let body;
146288
146875
  try {
146289
- body = readFileSync58(path2, "utf8");
146876
+ body = readFileSync59(path2, "utf8");
146290
146877
  } catch {
146291
146878
  return { ok: false, code: "key_file_unreadable", reason: "cannot read the selected key file; check its path and file permissions" };
146292
146879
  }
@@ -146444,7 +147031,7 @@ var signing_inspect_exports = {};
146444
147031
  __export(signing_inspect_exports, {
146445
147032
  runSigningInspect: () => runSigningInspect
146446
147033
  });
146447
- import { existsSync as existsSync53, readFileSync as readFileSync59, statSync as statSync14 } from "node:fs";
147034
+ import { existsSync as existsSync53, readFileSync as readFileSync60, statSync as statSync14 } from "node:fs";
146448
147035
  import { isAbsolute as isAbsolute5, resolve as resolve44 } from "node:path";
146449
147036
  function fail3(io2, code, fields = {}) {
146450
147037
  io2.error(JSON.stringify({ ok: false, code, ...fields }));
@@ -146541,9 +147128,9 @@ async function runSigningInspect(pos, flags, io2, deps = {}) {
146541
147128
  return fail3(io2, "signing_inspect_local_assets_unreadable", { error: "cert or profile file is unexpectedly large" });
146542
147129
  }
146543
147130
  assets = {
146544
- certificate: readFileSync59(certPath),
147131
+ certificate: readFileSync60(certPath),
146545
147132
  certificatePassword: text4(flags["cert-password"]),
146546
- provisioningProfile: readFileSync59(profilePath2)
147133
+ provisioningProfile: readFileSync60(profilePath2)
146547
147134
  };
146548
147135
  }
146549
147136
  try {
@@ -146828,7 +147415,7 @@ __export(config_push_edit_exports, {
146828
147415
  enablePushInConfig: () => enablePushInConfig,
146829
147416
  previewPushConfigEdit: () => previewPushConfigEdit
146830
147417
  });
146831
- import { readFileSync as readFileSync60 } from "node:fs";
147418
+ import { readFileSync as readFileSync61 } from "node:fs";
146832
147419
  import { basename as basename13 } from "node:path";
146833
147420
  import ts6 from "typescript";
146834
147421
  function enablePushInConfig(source, options) {
@@ -146948,7 +147535,7 @@ function noLiteralInstruction(pingAppName) {
146948
147535
  function previewPushConfigEdit(dir, options) {
146949
147536
  const path2 = configEntry(dir);
146950
147537
  if (!path2) return void 0;
146951
- const { applied, instructions } = enablePushInConfig(readFileSync60(path2, "utf8"), { ...options, fileName: basename13(path2) });
147538
+ const { applied, instructions } = enablePushInConfig(readFileSync61(path2, "utf8"), { ...options, fileName: basename13(path2) });
146952
147539
  return { wouldApply: applied, instructions };
146953
147540
  }
146954
147541
  async function applyPushConfigEdit(dir, options, validate4) {
@@ -146957,7 +147544,7 @@ async function applyPushConfigEdit(dir, options, validate4) {
146957
147544
  const fileName = basename13(path2);
146958
147545
  const refuse7 = (why) => ({ changed: false, pushOn: false, applied: [], instructions: [why] });
146959
147546
  if (isSymlink2(path2)) return refuse7(`${fileName} is a symlink, so it was not edited: turn push on in the file it points to.`);
146960
- const original = readFileSync60(path2, "utf8");
147547
+ const original = readFileSync61(path2, "utf8");
146961
147548
  const edit = enablePushInConfig(original, { ...options, fileName });
146962
147549
  const { applied, instructions, pushOn } = edit;
146963
147550
  if (!edit.changed) return { changed: false, pushOn, applied, instructions };
@@ -147275,9 +147862,9 @@ __export(pack_exports, {
147275
147862
  unpackTo: () => unpackTo,
147276
147863
  writeZip: () => writeZip
147277
147864
  });
147278
- import { createHash as createHash28 } from "node:crypto";
147865
+ import { createHash as createHash29 } from "node:crypto";
147279
147866
  import { deflateRawSync, inflateRawSync } from "node:zlib";
147280
- import { existsSync as existsSync54, mkdirSync as mkdirSync25, readFileSync as readFileSync61, readdirSync as readdirSync28, rmSync as rmSync12, statSync as statSync15, writeFileSync as writeFileSync21 } from "node:fs";
147867
+ import { existsSync as existsSync54, mkdirSync as mkdirSync25, readFileSync as readFileSync62, readdirSync as readdirSync28, rmSync as rmSync12, statSync as statSync15, writeFileSync as writeFileSync21 } from "node:fs";
147281
147868
  import { dirname as dirname33, join as join53, resolve as resolve46 } from "node:path";
147282
147869
  function writeZip(entries) {
147283
147870
  const sorted2 = entries.slice().sort((a2, b2) => a2.path < b2.path ? -1 : a2.path > b2.path ? 1 : 0);
@@ -147372,7 +147959,7 @@ function inflateEntry(buf, entry) {
147372
147959
  return bytes2;
147373
147960
  }
147374
147961
  function readIf(path2) {
147375
- return existsSync54(path2) && statSync15(path2).isFile() ? readFileSync61(path2) : null;
147962
+ return existsSync54(path2) && statSync15(path2).isFile() ? readFileSync62(path2) : null;
147376
147963
  }
147377
147964
  function listDir(dir) {
147378
147965
  return existsSync54(dir) ? readdirSync28(dir).filter((f2) => statSync15(join53(dir, f2)).isFile()) : [];
@@ -147425,11 +148012,11 @@ function gatherReleaseEntries(appDir3) {
147425
148012
  return { entries, manifest, skipped };
147426
148013
  }
147427
148014
  function sha256Hex4(bytes2) {
147428
- return createHash28("sha256").update(bytes2).digest("hex");
148015
+ return createHash29("sha256").update(bytes2).digest("hex");
147429
148016
  }
147430
148017
  function computeContentHash(entries) {
147431
148018
  const input = packageHashInput(entries.map((e2) => ({ path: e2.path, hash: sha256Hex4(e2.bytes) })));
147432
- return "sha256-" + createHash28("sha256").update(input).digest("base64");
148019
+ return "sha256-" + createHash29("sha256").update(input).digest("base64");
147433
148020
  }
147434
148021
  function buildEntries(appDir3, app, opts) {
147435
148022
  const { entries: released, manifest, skipped } = gatherReleaseEntries(appDir3);
@@ -147522,7 +148109,7 @@ function openPackageBuffer(buf) {
147522
148109
  return openFromEntries(readZip(buf), { requireHeader: true });
147523
148110
  }
147524
148111
  function openPackageFile(file2) {
147525
- return openPackageBuffer(readFileSync61(file2));
148112
+ return openPackageBuffer(readFileSync62(file2));
147526
148113
  }
147527
148114
  function openPackageDir(dir) {
147528
148115
  const root = resolve46(dir);
@@ -147533,7 +148120,7 @@ function openPackageDir(dir) {
147533
148120
  const childRel = rel ? `${rel}/${name}` : name;
147534
148121
  const childAbs = join53(abs, name);
147535
148122
  if (statSync15(childAbs).isDirectory()) walk2(childRel);
147536
- else if (isSafeEntryName(childRel)) entries.set(childRel, readFileSync61(childAbs));
148123
+ else if (isSafeEntryName(childRel)) entries.set(childRel, readFileSync62(childAbs));
147537
148124
  }
147538
148125
  };
147539
148126
  if (!existsSync54(root)) throw new Error(`no such package directory: ${root}`);
@@ -147620,8 +148207,8 @@ __export(app_source_exports, {
147620
148207
  writeConflicts: () => writeConflicts,
147621
148208
  zipAppSource: () => zipAppSource
147622
148209
  });
147623
- import { createHash as createHash29 } from "node:crypto";
147624
- import { readdirSync as readdirSync29, lstatSync as lstatSync15, readFileSync as readFileSync62, mkdirSync as mkdirSync26, writeFileSync as writeFileSync22, existsSync as existsSync55, rmSync as rmSync13, rmdirSync as rmdirSync2, unlinkSync as unlinkSync4 } from "node:fs";
148210
+ import { createHash as createHash30 } from "node:crypto";
148211
+ import { readdirSync as readdirSync29, lstatSync as lstatSync15, readFileSync as readFileSync63, mkdirSync as mkdirSync26, writeFileSync as writeFileSync22, existsSync as existsSync55, rmSync as rmSync13, rmdirSync as rmdirSync2, unlinkSync as unlinkSync4 } from "node:fs";
147625
148212
  import { join as join54, resolve as resolve47, sep as sep13 } from "node:path";
147626
148213
  import { createRequire as createRequire3 } from "node:module";
147627
148214
  import { deflateRawSync as deflateRawSync2 } from "node:zlib";
@@ -147655,7 +148242,7 @@ function collectAppSource(dir) {
147655
148242
  const skipped = [];
147656
148243
  walkSourceTree(
147657
148244
  dir,
147658
- (archivePath, hostRel) => entries.push({ path: archivePath, bytes: readFileSync62(join54(dir, hostRel)) }),
148245
+ (archivePath, hostRel) => entries.push({ path: archivePath, bytes: readFileSync63(join54(dir, hostRel)) }),
147659
148246
  (hostRel) => skipped.push(hostRel)
147660
148247
  );
147661
148248
  entries.sort((a2, b2) => a2.path < b2.path ? -1 : a2.path > b2.path ? 1 : 0);
@@ -147736,13 +148323,13 @@ function sourceFingerprint(dir) {
147736
148323
  dir,
147737
148324
  (archivePath, hostRel) => {
147738
148325
  if (/\.md$/i.test(archivePath)) return;
147739
- files.push(`${archivePath}\0${createHash29("sha256").update(readFileSync62(join54(dir, hostRel))).digest("hex")}`);
148326
+ files.push(`${archivePath}\0${createHash30("sha256").update(readFileSync63(join54(dir, hostRel))).digest("hex")}`);
147740
148327
  },
147741
148328
  () => {
147742
148329
  }
147743
148330
  );
147744
148331
  files.sort();
147745
- return createHash29("sha256").update(files.join("\n")).digest("hex");
148332
+ return createHash30("sha256").update(files.join("\n")).digest("hex");
147746
148333
  }
147747
148334
  function largestEntries(entries, limit = 5) {
147748
148335
  return entries.map((e2) => ({
@@ -147949,7 +148536,7 @@ __export(run_watch_exports, {
147949
148536
  watchedContentDir: () => watchedContentDir,
147950
148537
  writeRunRecord: () => writeRunRecord
147951
148538
  });
147952
- import { closeSync as closeSync4, constants as constants2, existsSync as existsSync56, fstatSync, lstatSync as lstatSync16, statSync as statSync16, readdirSync as readdirSync30, mkdirSync as mkdirSync27, openSync as openSync4, readFileSync as readFileSync63, realpathSync as realpathSync9, renameSync as renameSync10, rmSync as rmSync14, writeFileSync as writeFileSync23, watch as fsWatch } from "node:fs";
148539
+ import { closeSync as closeSync4, constants as constants2, existsSync as existsSync56, fstatSync, lstatSync as lstatSync16, statSync as statSync16, readdirSync as readdirSync30, mkdirSync as mkdirSync27, openSync as openSync4, readFileSync as readFileSync64, realpathSync as realpathSync9, renameSync as renameSync10, rmSync as rmSync14, writeFileSync as writeFileSync23, watch as fsWatch } from "node:fs";
147953
148540
  import { randomUUID as randomUUID6 } from "node:crypto";
147954
148541
  import { extname as extname4, join as join55, resolve as resolve48, sep as sep14 } from "node:path";
147955
148542
  function diffReleases(prev, next) {
@@ -148207,7 +148794,7 @@ function readConfined(root, rel) {
148207
148794
  const fd = openSync4(at2, constants2.O_RDONLY | (constants2.O_NOFOLLOW ?? 0));
148208
148795
  try {
148209
148796
  if (!fstatSync(fd).isFile()) return null;
148210
- return readFileSync63(fd);
148797
+ return readFileSync64(fd);
148211
148798
  } finally {
148212
148799
  closeSync4(fd);
148213
148800
  }
@@ -148264,8 +148851,8 @@ __export(screen_state_exports, {
148264
148851
  shotStateFor: () => shotStateFor,
148265
148852
  withHomeCaveat: () => withHomeCaveat
148266
148853
  });
148267
- import { createHash as createHash30 } from "node:crypto";
148268
- import { lstatSync as lstatSync17, readFileSync as readFileSync64 } from "node:fs";
148854
+ import { createHash as createHash31 } from "node:crypto";
148855
+ import { lstatSync as lstatSync17, readFileSync as readFileSync65 } from "node:fs";
148269
148856
  import { join as join56 } from "node:path";
148270
148857
  function quotableLine(text9) {
148271
148858
  if (!text9) return void 0;
@@ -148325,7 +148912,7 @@ function readRecord(dir) {
148325
148912
  const file2 = join56(dir, SHOT_STATES_FILE);
148326
148913
  try {
148327
148914
  if (!lstatSync17(file2).isFile()) return {};
148328
- const r2 = JSON.parse(readFileSync64(file2, "utf8"));
148915
+ const r2 = JSON.parse(readFileSync65(file2, "utf8"));
148329
148916
  return r2.v === 1 && r2.shots && typeof r2.shots === "object" ? r2.shots : {};
148330
148917
  } catch {
148331
148918
  return {};
@@ -148384,7 +148971,7 @@ var init_screen_state = __esm({
148384
148971
  KEEP = 40;
148385
148972
  LINE_MAX = 120;
148386
148973
  str3 = (v2) => typeof v2 === "string" && v2.trim() ? v2 : void 0;
148387
- sha256Of = (file2) => createHash30("sha256").update(readFileSync64(file2)).digest("hex");
148974
+ sha256Of = (file2) => createHash31("sha256").update(readFileSync65(file2)).digest("hex");
148388
148975
  }
148389
148976
  });
148390
148977
 
@@ -148399,8 +148986,8 @@ __export(studio_reel_exports, {
148399
148986
  thin: () => thin,
148400
148987
  utcDay: () => utcDay
148401
148988
  });
148402
- import { createHash as createHash31 } from "node:crypto";
148403
- import { lstatSync as lstatSync18, readFileSync as readFileSync65 } from "node:fs";
148989
+ import { createHash as createHash32 } from "node:crypto";
148990
+ import { lstatSync as lstatSync18, readFileSync as readFileSync66 } from "node:fs";
148404
148991
  import { basename as basename14, join as join57 } from "node:path";
148405
148992
  function loadMemory2(dir) {
148406
148993
  const m2 = readJson6(join57(dir, ".himi", "studio", "memory.json"));
@@ -148487,8 +149074,8 @@ function inlineImages(dir, plan, budget = REEL_BUDGET_BYTES) {
148487
149074
  const path2 = join57(dir, HISTORY_DIR, f2);
148488
149075
  const st2 = lstatSync18(path2);
148489
149076
  if (!st2.isFile() || st2.nlink !== 1) return null;
148490
- const bytes2 = readFileSync65(path2);
148491
- return createHash31("sha256").update(bytes2).digest("hex") === f2.slice(0, 64) && imageExtension(bytes2) === f2.slice(65) ? bytes2 : null;
149077
+ const bytes2 = readFileSync66(path2);
149078
+ return createHash32("sha256").update(bytes2).digest("hex") === f2.slice(0, 64) && imageExtension(bytes2) === f2.slice(65) ? bytes2 : null;
148492
149079
  } catch {
148493
149080
  return null;
148494
149081
  }
@@ -148621,7 +149208,7 @@ var init_studio_reel = __esm({
148621
149208
  mimeOf = (file2) => MIME2[file2.slice(65)] ?? "image/png";
148622
149209
  readJson6 = (file2) => {
148623
149210
  try {
148624
- return JSON.parse(readFileSync65(file2, "utf8"));
149211
+ return JSON.parse(readFileSync66(file2, "utf8"));
148625
149212
  } catch {
148626
149213
  return null;
148627
149214
  }
@@ -148638,12 +149225,12 @@ var init_studio_reel = __esm({
148638
149225
  });
148639
149226
 
148640
149227
  // src/home-screen-id.ts
148641
- import { readFileSync as readFileSync66 } from "node:fs";
149228
+ import { readFileSync as readFileSync67 } from "node:fs";
148642
149229
  import { join as join58 } from "node:path";
148643
149230
  function homeScreenIdOf(dir) {
148644
149231
  let src;
148645
149232
  try {
148646
- src = readFileSync66(join58(dir, "dev", "index.ts"), "utf8");
149233
+ src = readFileSync67(join58(dir, "dev", "index.ts"), "utf8");
148647
149234
  } catch {
148648
149235
  return null;
148649
149236
  }
@@ -148709,9 +149296,9 @@ __export(milestones_exports, {
148709
149296
  watchUrlFor: () => watchUrlFor,
148710
149297
  writeHandoverReel: () => writeHandoverReel
148711
149298
  });
148712
- import { createHash as createHash32, randomUUID as randomUUID7 } from "node:crypto";
149299
+ import { createHash as createHash33, randomUUID as randomUUID7 } from "node:crypto";
148713
149300
  import { spawn as spawn5 } from "node:child_process";
148714
- import { closeSync as closeSync5, existsSync as existsSync57, lstatSync as lstatSync19, readFileSync as readFileSync67, statSync as statSync17 } from "node:fs";
149301
+ import { closeSync as closeSync5, existsSync as existsSync57, lstatSync as lstatSync19, readFileSync as readFileSync68, statSync as statSync17 } from "node:fs";
148715
149302
  import { createServer as createServer4 } from "node:net";
148716
149303
  import { basename as basename15, dirname as dirname34, isAbsolute as isAbsolute6, join as join59, relative as relative11, resolve as resolve49, sep as sep15 } from "node:path";
148717
149304
  function homeShotPath(dir, home) {
@@ -149057,7 +149644,7 @@ function lastDraft(dir) {
149057
149644
  try {
149058
149645
  const file2 = join59(dir, LAST_DRAFT_FILE);
149059
149646
  if (!lstatSync19(file2).isFile()) return null;
149060
- const r2 = JSON.parse(readFileSync67(file2, "utf8"));
149647
+ const r2 = JSON.parse(readFileSync68(file2, "utf8"));
149061
149648
  const m2 = r2.manifest;
149062
149649
  if (r2.v !== 1 || typeof r2.releaseId !== "string" || !m2 || typeof m2.screens !== "object" || !m2.screens || typeof m2.bundles !== "object" || !m2.bundles) return null;
149063
149650
  return { releaseId: r2.releaseId, manifest: m2 };
@@ -149119,7 +149706,7 @@ function readInitSource(dir) {
149119
149706
  const file2 = join59(dir, INIT_SOURCE_FILE);
149120
149707
  try {
149121
149708
  if (!lstatSync19(file2).isFile()) return null;
149122
- const r2 = JSON.parse(readFileSync67(file2, "utf8"));
149709
+ const r2 = JSON.parse(readFileSync68(file2, "utf8"));
149123
149710
  if (r2.v !== 1 || typeof r2.fingerprint !== "string" || !/^[0-9a-f]{64}$/.test(r2.fingerprint) || typeof r2.newestMs !== "number") return null;
149124
149711
  return {
149125
149712
  v: 1,
@@ -149207,7 +149794,7 @@ function readInitWatch(dir) {
149207
149794
  const file2 = join59(dir, INIT_WATCH_FILE);
149208
149795
  try {
149209
149796
  if (!lstatSync19(file2).isFile()) return null;
149210
- const r2 = JSON.parse(readFileSync67(file2, "utf8"));
149797
+ const r2 = JSON.parse(readFileSync68(file2, "utf8"));
149211
149798
  if (r2.v !== 1 || typeof r2.pid !== "number" || !Number.isInteger(r2.pid) || r2.pid < 1) return null;
149212
149799
  if (typeof r2.url !== "string" || !/^http:\/\/127\.0\.0\.1:\d+\//.test(r2.url) || typeof r2.board !== "string" || typeof r2.log !== "string" || typeof r2.startedAt !== "string") return null;
149213
149800
  if (r2.root !== runRootId(dir)) return null;
@@ -149239,7 +149826,7 @@ function watchReminder(dir, opts = {}) {
149239
149826
  const file2 = join59(dir, REMINDERS_FILE);
149240
149827
  let last = Number.NaN;
149241
149828
  try {
149242
- if (lstatSync19(file2).isFile()) last = Date.parse(JSON.parse(readFileSync67(file2, "utf8")).watch ?? "");
149829
+ if (lstatSync19(file2).isFile()) last = Date.parse(JSON.parse(readFileSync68(file2, "utf8")).watch ?? "");
149243
149830
  } catch {
149244
149831
  }
149245
149832
  if (Number.isFinite(last) && now - last >= 0 && now - last < WATCH_REMINDER_EVERY_MS) return void 0;
@@ -149399,7 +149986,7 @@ var init_milestones = __esm({
149399
149986
  INIT_SOURCE_FILE = join59(".himi", "init-source.json");
149400
149987
  STARTING_POINT_REF = "starting-point";
149401
149988
  TEMPLATE_NAME = /^[A-Za-z0-9._-]{1,64}$/;
149402
- sha256Of2 = (file2) => createHash32("sha256").update(readFileSync67(file2)).digest("hex");
149989
+ sha256Of2 = (file2) => createHash33("sha256").update(readFileSync68(file2)).digest("hex");
149403
149990
  WATCH_REMINDER_EVERY_MS = 10 * 60 * 1e3;
149404
149991
  REMINDERS_FILE = join59(".himi", "reminders.json");
149405
149992
  pidAlive = (pid) => {
@@ -149446,7 +150033,7 @@ __export(template_sweep_exports, {
149446
150033
  sweepCopy: () => sweepCopy,
149447
150034
  sweepPairs: () => sweepPairs
149448
150035
  });
149449
- import { readFileSync as readFileSync68, writeFileSync as writeFileSync24 } from "node:fs";
150036
+ import { readFileSync as readFileSync69, writeFileSync as writeFileSync24 } from "node:fs";
149450
150037
  import { join as join60 } from "node:path";
149451
150038
  import ts7 from "typescript";
149452
150039
  function isCopy(node, file2) {
@@ -149488,7 +150075,7 @@ function sweepCopy(dir, pairs, dryRun) {
149488
150075
  const next = /* @__PURE__ */ new Map();
149489
150076
  const replaced = pairs.map(([from, to2]) => ({ from, to: to2, files: {} }));
149490
150077
  for (const f2 of files) {
149491
- const text9 = readFileSync68(join60(dir, f2), "utf8");
150078
+ const text9 = readFileSync69(join60(dir, f2), "utf8");
149492
150079
  if (!pairs.some(([from]) => text9.includes(from) || text9.includes(JSON.stringify(from).slice(1, -1)))) continue;
149493
150080
  const kind = f2.endsWith(".json") ? ts7.ScriptKind.JSON : f2.endsWith("x") ? ts7.ScriptKind.TSX : ts7.ScriptKind.TS;
149494
150081
  const sf2 = ts7.createSourceFile(f2, text9, ts7.ScriptTarget.Latest, true, kind);
@@ -149517,8 +150104,8 @@ function sweepCopy(dir, pairs, dryRun) {
149517
150104
  if (errors.length) throw new TrimRefusal(`the sweep would break ${f2} \u2014 nothing written: ${errors[0]}`);
149518
150105
  next.set(f2, out2);
149519
150106
  }
149520
- const dev = next.get("dev/index.ts") ?? readFileSync68(join60(dir, "dev", "index.ts"), "utf8");
149521
- const config = next.get("config.ts") ?? readFileSync68(join60(dir, "config.ts"), "utf8");
150107
+ const dev = next.get("dev/index.ts") ?? readFileSync69(join60(dir, "dev", "index.ts"), "utf8");
150108
+ const config = next.get("config.ts") ?? readFileSync69(join60(dir, "config.ts"), "utf8");
149522
150109
  try {
149523
150110
  parseApp(dev, config);
149524
150111
  } catch (e2) {
@@ -149526,7 +150113,7 @@ function sweepCopy(dir, pairs, dryRun) {
149526
150113
  }
149527
150114
  if (!dryRun) for (const [f2, t2] of next) writeFileSync24(join60(dir, f2), t2);
149528
150115
  const g2 = new RegExp(PLACEHOLDER.source, `${PLACEHOLDER.flags.replace("g", "")}g`);
149529
- const placeholdersLeft = all.reduce((n2, f2) => n2 + [...(next.get(f2) ?? readFileSync68(join60(dir, f2), "utf8")).matchAll(g2)].length, 0);
150116
+ const placeholdersLeft = all.reduce((n2, f2) => n2 + [...(next.get(f2) ?? readFileSync69(join60(dir, f2), "utf8")).matchAll(g2)].length, 0);
149530
150117
  return {
149531
150118
  ok: true,
149532
150119
  dryRun,
@@ -149543,7 +150130,7 @@ function sweepPairs(set, mapFile) {
149543
150130
  pairs.push([s2.slice(0, at2), s2.slice(at2 + 2)]);
149544
150131
  }
149545
150132
  if (mapFile) {
149546
- const map = JSON.parse(readFileSync68(mapFile, "utf8"));
150133
+ const map = JSON.parse(readFileSync69(mapFile, "utf8"));
149547
150134
  for (const [k2, v2] of Object.entries(map)) {
149548
150135
  if (typeof v2 !== "string") throw new TrimRefusal(`--map ${mapFile}: "${k2}" must map to a string`);
149549
150136
  pairs.push([k2, v2]);
@@ -149788,18 +150375,18 @@ __export(template_recommend_exports, {
149788
150375
  recommendTemplates: () => recommendTemplates,
149789
150376
  verticalsFromBook: () => verticalsFromBook
149790
150377
  });
149791
- import { existsSync as existsSync58, readFileSync as readFileSync69 } from "node:fs";
150378
+ import { existsSync as existsSync58, readFileSync as readFileSync70 } from "node:fs";
149792
150379
  import { join as join61 } from "node:path";
149793
150380
  function verticalsFromBook(path2) {
149794
150381
  const dir = existsSync58(join61(path2, "book.json")) || existsSync58(join61(path2, "provisioning.overlay.json")) ? path2 : join61(path2, ".himi", "business-book");
149795
150382
  const overlay = join61(dir, "provisioning.overlay.json");
149796
150383
  if (existsSync58(overlay)) {
149797
- const v2 = JSON.parse(readFileSync69(overlay, "utf8")).installedVerticals;
150384
+ const v2 = JSON.parse(readFileSync70(overlay, "utf8")).installedVerticals;
149798
150385
  if (Array.isArray(v2) && v2.length) return v2.filter((x2) => typeof x2 === "string");
149799
150386
  }
149800
150387
  const book = join61(dir, "book.json");
149801
150388
  if (existsSync58(book)) {
149802
- const probes = JSON.parse(readFileSync69(book, "utf8")).probes;
150389
+ const probes = JSON.parse(readFileSync70(book, "utf8")).probes;
149803
150390
  if (Array.isArray(probes)) return installedFromProbes(probes);
149804
150391
  }
149805
150392
  throw new Error(`no book.json / provisioning.overlay.json under ${path2} \u2014 run \`himi site analyze\` first, or pass --verticals`);
@@ -150209,7 +150796,7 @@ __export(eject_exports, {
150209
150796
  EJECTABLE: () => EJECTABLE,
150210
150797
  ejectModule: () => ejectModule
150211
150798
  });
150212
- import { existsSync as existsSync59, mkdirSync as mkdirSync28, readFileSync as readFileSync70, writeFileSync as writeFileSync25 } from "node:fs";
150799
+ import { existsSync as existsSync59, mkdirSync as mkdirSync28, readFileSync as readFileSync71, writeFileSync as writeFileSync25 } from "node:fs";
150213
150800
  import { dirname as dirname35, join as join62, relative as relative12, resolve as resolve50, sep as sep16 } from "node:path";
150214
150801
  function locate(repoRootOrCwd, mod) {
150215
150802
  const inRepo = resolve50(repoRootOrCwd, `stdlib/flows/${mod}/src/index.ts`);
@@ -150253,7 +150840,7 @@ function ejectModule(opts) {
150253
150840
  // gate still applies. Ejecting buys layout and flow, never the floor.
150254
150841
 
150255
150842
  `;
150256
- const normalized = readFileSync70(found.path, "utf8").replace(
150843
+ const normalized = readFileSync71(found.path, "utf8").replace(
150257
150844
  /(["'])@himalaya\/([a-z0-9-]+(?:\/[a-z0-9-]+)?)\1/g,
150258
150845
  (_m, q2, sub) => `${q2}@wix/himalaya/${sub}${q2}`
150259
150846
  );
@@ -150261,7 +150848,7 @@ function ejectModule(opts) {
150261
150848
  const rewired = [];
150262
150849
  for (const f2 of files) {
150263
150850
  if (!existsSync59(f2)) continue;
150264
- const before = readFileSync70(f2, "utf8");
150851
+ const before = readFileSync71(f2, "utf8");
150265
150852
  let after = before;
150266
150853
  let rel = relative12(dirname35(f2), target).split(sep16).join("/").replace(/\.tsx?$/, ".js");
150267
150854
  if (!rel.startsWith(".")) rel = `./${rel}`;
@@ -150381,7 +150968,7 @@ var init_app_map = __esm({
150381
150968
  });
150382
150969
 
150383
150970
  // src/wix-writes.ts
150384
- import { existsSync as existsSync60, readFileSync as readFileSync71 } from "node:fs";
150971
+ import { existsSync as existsSync60, readFileSync as readFileSync72 } from "node:fs";
150385
150972
  import { join as join63 } from "node:path";
150386
150973
  function isProvenRead(method, path2) {
150387
150974
  if (/[#\x00-\x1F\x7F]/.test(path2)) return false;
@@ -150504,7 +151091,7 @@ function readDataAccess(dir) {
150504
151091
  if (!existsSync60(p2)) continue;
150505
151092
  let text9;
150506
151093
  try {
150507
- text9 = readFileSync71(p2, "utf8");
151094
+ text9 = readFileSync72(p2, "utf8");
150508
151095
  } catch {
150509
151096
  continue;
150510
151097
  }
@@ -150618,14 +151205,14 @@ __export(test_exports, {
150618
151205
  scopeDescriptors: () => scopeDescriptors,
150619
151206
  writeRecordedMocks: () => writeRecordedMocks
150620
151207
  });
150621
- import { existsSync as existsSync61, mkdirSync as mkdirSync29, readFileSync as readFileSync72, writeFileSync as writeFileSync26 } from "node:fs";
151208
+ import { existsSync as existsSync61, mkdirSync as mkdirSync29, readFileSync as readFileSync73, writeFileSync as writeFileSync26 } from "node:fs";
150622
151209
  import { join as join64, resolve as resolve51 } from "node:path";
150623
151210
  function readTestConfig(dir) {
150624
151211
  const p2 = resolve51(dir, TEST_CONFIG_FILE);
150625
151212
  if (!existsSync61(p2)) return {};
150626
151213
  let parsed;
150627
151214
  try {
150628
- parsed = JSON.parse(readFileSync72(p2, "utf8"));
151215
+ parsed = JSON.parse(readFileSync73(p2, "utf8"));
150629
151216
  } catch (e2) {
150630
151217
  throw new Error(`${TEST_CONFIG_FILE} is not valid JSON \u2014 ${e2.message}`);
150631
151218
  }
@@ -150672,7 +151259,7 @@ function readTestConfig(dir) {
150672
151259
  function readNetRules(path2) {
150673
151260
  let parsed;
150674
151261
  try {
150675
- parsed = JSON.parse(readFileSync72(path2, "utf8"));
151262
+ parsed = JSON.parse(readFileSync73(path2, "utf8"));
150676
151263
  } catch (e2) {
150677
151264
  throw new Error(`--net ${path2} could not be read as JSON \u2014 ${e2.message}`);
150678
151265
  }
@@ -150709,7 +151296,7 @@ function readCannedResponses() {
150709
151296
  ];
150710
151297
  for (const url of candidates) {
150711
151298
  try {
150712
- const parsed = JSON.parse(readFileSync72(url, "utf8"));
151299
+ const parsed = JSON.parse(readFileSync73(url, "utf8"));
150713
151300
  const byKey = {};
150714
151301
  for (const [k2, v2] of Object.entries(parsed)) {
150715
151302
  if (!k2.startsWith("//")) byKey[k2] = v2;
@@ -151346,14 +151933,14 @@ var mobile_ux_lint_exports = {};
151346
151933
  __export(mobile_ux_lint_exports, {
151347
151934
  mobileUxIssues: () => mobileUxIssues
151348
151935
  });
151349
- import { existsSync as existsSync62, readFileSync as readFileSync73 } from "node:fs";
151936
+ import { existsSync as existsSync62, readFileSync as readFileSync74 } from "node:fs";
151350
151937
  import { join as join65 } from "node:path";
151351
151938
  function mobileUxIssues(dir, strict) {
151352
151939
  const file2 = join65(dir, "MOBILE-UX.md");
151353
151940
  if (!existsSync62(file2)) return [];
151354
151941
  let text9;
151355
151942
  try {
151356
- text9 = readFileSync73(file2, "utf8");
151943
+ text9 = readFileSync74(file2, "utf8");
151357
151944
  } catch {
151358
151945
  return [];
151359
151946
  }
@@ -152203,10 +152790,10 @@ var init_calls = __esm({
152203
152790
  });
152204
152791
 
152205
152792
  // ../../core/functions-runtime/src/queue.ts
152206
- import { createHash as createHash33 } from "node:crypto";
152793
+ import { createHash as createHash34 } from "node:crypto";
152207
152794
  function inputSchemaHash(definition) {
152208
152795
  const schema = definition.input;
152209
- return schema ? createHash33("sha256").update(JSON.stringify(schema.descriptor ?? { kind: schema.kind, optional: schema.optional === true })).digest("hex") : "";
152796
+ return schema ? createHash34("sha256").update(JSON.stringify(schema.descriptor ?? { kind: schema.kind, optional: schema.optional === true })).digest("hex") : "";
152210
152797
  }
152211
152798
  function createFunctionEnqueueCapability(options) {
152212
152799
  return {
@@ -152272,14 +152859,14 @@ var init_queue = __esm({
152272
152859
  });
152273
152860
 
152274
152861
  // ../../core/data-resources/src/plan.ts
152275
- import { createHash as createHash34 } from "node:crypto";
152862
+ import { createHash as createHash35 } from "node:crypto";
152276
152863
  function canonical3(value) {
152277
152864
  if (Array.isArray(value)) return `[${value.map(canonical3).join(",")}]`;
152278
152865
  if (value && typeof value === "object") return `{${Object.entries(value).sort(([a2], [b2]) => a2.localeCompare(b2)).map(([key2, item]) => `${JSON.stringify(key2)}:${canonical3(item)}`).join(",")}}`;
152279
152866
  return JSON.stringify(value);
152280
152867
  }
152281
152868
  function hashResourcePlan(plan) {
152282
- return createHash34("sha256").update(canonical3(plan)).digest("hex");
152869
+ return createHash35("sha256").update(canonical3(plan)).digest("hex");
152283
152870
  }
152284
152871
  function finalize(input) {
152285
152872
  return { ...input, hash: hashResourcePlan(input) };
@@ -153034,7 +153621,7 @@ __export(functions_exports, {
153034
153621
  resolveFunctionsTarget: () => resolveFunctionsTarget,
153035
153622
  runRemoteFunctionOperation: () => runRemoteFunctionOperation
153036
153623
  });
153037
- import { readFileSync as readFileSync74, existsSync as existsSync63 } from "node:fs";
153624
+ import { readFileSync as readFileSync75, existsSync as existsSync63 } from "node:fs";
153038
153625
  import { join as join66, resolve as resolve52 } from "node:path";
153039
153626
  function resolveFunctionsTarget(input) {
153040
153627
  const explicitUrl = input.functionsUrl?.trim();
@@ -153056,7 +153643,7 @@ async function loadFunctionsApp(dir) {
153056
153643
  for (const definition of config.functions.functions) {
153057
153644
  const source = [".ts", ".js", ".mts", ".mjs"].map((extension) => join66(loaded.dir, "functions", `${definition.name}${extension}`)).find(existsSync63);
153058
153645
  if (!source) throw new Error(`missing source for function ${definition.name}; expected functions/${definition.name}.ts`);
153059
- sources[definition.name] = readFileSync74(source, "utf8");
153646
+ sources[definition.name] = readFileSync75(source, "utf8");
153060
153647
  }
153061
153648
  const data = config.cms || config.data ? mergeDataResources(config) : void 0;
153062
153649
  const dataErrors = validateDataResources(data, loaded.name).filter((issue2) => issue2.severity === "error");
@@ -153244,7 +153831,7 @@ var init_cli_bridge = __esm({
153244
153831
  });
153245
153832
 
153246
153833
  // src/mcp/file-tools.ts
153247
- import { closeSync as closeSync6, constants as constants3, lstatSync as lstatSync20, mkdirSync as mkdirSync30, openSync as openSync5, readdirSync as readdirSync31, readFileSync as readFileSync75, realpathSync as realpathSync10, renameSync as renameSync11, rmSync as rmSync15, statSync as statSync18, writeSync, existsSync as existsSync64 } from "node:fs";
153834
+ import { closeSync as closeSync6, constants as constants3, lstatSync as lstatSync20, mkdirSync as mkdirSync30, openSync as openSync5, readdirSync as readdirSync31, readFileSync as readFileSync76, realpathSync as realpathSync10, renameSync as renameSync11, rmSync as rmSync15, statSync as statSync18, writeSync, existsSync as existsSync64 } from "node:fs";
153248
153835
  import { randomBytes as randomBytes4 } from "node:crypto";
153249
153836
  import { dirname as dirname36, isAbsolute as isAbsolute7, join as join67, relative as relative13, resolve as resolve53, sep as sep17 } from "node:path";
153250
153837
  import * as z2 from "zod";
@@ -153417,7 +154004,7 @@ function fileTools() {
153417
154004
  if (!existsSync64(p2) || !lstatSync20(p2).isFile()) return refuse5("not_found", `no file "${String(a2.path)}"`);
153418
154005
  const size = statSync18(p2).size;
153419
154006
  if (size > MAX_FILE_BYTES) return refuse5("too_large", `"${String(a2.path)}" is ${size} bytes \u2014 over the ${MAX_FILE_BYTES}-byte read limit`);
153420
- return ok({ ok: true, path: a2.path, bytes: size, content: readFileSync75(p2, "utf8") });
154007
+ return ok({ ok: true, path: a2.path, bytes: size, content: readFileSync76(p2, "utf8") });
153421
154008
  }
153422
154009
  },
153423
154010
  {
@@ -154029,7 +154616,7 @@ __export(server_exports, {
154029
154616
  protectStdout: () => protectStdout,
154030
154617
  startMcpServer: () => startMcpServer
154031
154618
  });
154032
- import { mkdirSync as mkdirSync31, readFileSync as readFileSync76 } from "node:fs";
154619
+ import { mkdirSync as mkdirSync31, readFileSync as readFileSync77 } from "node:fs";
154033
154620
  import { fileURLToPath as fileURLToPath24 } from "node:url";
154034
154621
  import { McpServer } from "@modelcontextprotocol/server";
154035
154622
  import { serveStdio, StdioServerTransport } from "@modelcontextprotocol/server/stdio";
@@ -154089,7 +154676,7 @@ async function startMcpServer(opts) {
154089
154676
  status: (dir) => previewStatus(dir, previewDeps),
154090
154677
  stop: (dir) => stopPreview(dir, previewDeps)
154091
154678
  },
154092
- readFile: (p2) => readFileSync76(p2),
154679
+ readFile: (p2) => readFileSync77(p2),
154093
154680
  login: createLoginSession({ ...defaultLoginDeps, selfCommand: previewDeps.selfCommand, ...opts.login }),
154094
154681
  ...opts.workspace ? { workspaceBoundary: opts.workspace } : {}
154095
154682
  };
@@ -154133,7 +154720,7 @@ __export(native_decode_exports, {
154133
154720
  runNativeDecode: () => runNativeDecode
154134
154721
  });
154135
154722
  import { execFileSync as execFileSync5, spawnSync as spawnSync2 } from "node:child_process";
154136
- import { existsSync as existsSync65, mkdtempSync as mkdtempSync2, readFileSync as readFileSync77, rmSync as rmSync16, writeFileSync as writeFileSync27 } from "node:fs";
154723
+ import { existsSync as existsSync65, mkdtempSync as mkdtempSync2, readFileSync as readFileSync78, rmSync as rmSync16, writeFileSync as writeFileSync27 } from "node:fs";
154137
154724
  import { tmpdir as tmpdir3 } from "node:os";
154138
154725
  import { join as join68 } from "node:path";
154139
154726
  import { fileURLToPath as fileURLToPath25 } from "node:url";
@@ -154169,7 +154756,7 @@ function detectNativeDecode(options = {}) {
154169
154756
  }
154170
154757
  function localPropertiesSdk(harnessDir) {
154171
154758
  try {
154172
- const match = readFileSync77(join68(harnessDir, "local.properties"), "utf8").match(/^sdk\.dir\s*=\s*(.+)$/m);
154759
+ const match = readFileSync78(join68(harnessDir, "local.properties"), "utf8").match(/^sdk\.dir\s*=\s*(.+)$/m);
154173
154760
  return match?.[1]?.trim().replace(/\\([ :\\])/g, "$1") ?? null;
154174
154761
  } catch {
154175
154762
  return null;
@@ -154320,7 +154907,7 @@ function runAndroidNativeDecode(options) {
154320
154907
  stdio: ["ignore", "ignore", "pipe"],
154321
154908
  encoding: "utf8"
154322
154909
  });
154323
- const stdout = readFileSync77(outputPath, "utf8");
154910
+ const stdout = readFileSync78(outputPath, "utf8");
154324
154911
  return {
154325
154912
  platform: "android",
154326
154913
  verdicts: parseNativeDecodeOutput(stdout, options.descriptors.map((descriptor) => descriptor.screenId), "android"),
@@ -154389,8 +154976,8 @@ __export(browser_authoring_exports, {
154389
154976
  sdkSubpathReader: () => sdkSubpathReader
154390
154977
  });
154391
154978
  import { createServer as createServer5 } from "node:http";
154392
- import { createHash as createHash35, randomBytes as randomBytes5 } from "node:crypto";
154393
- import { existsSync as existsSync66, readdirSync as readdirSync32, readFileSync as readFileSync78, realpathSync as realpathSync11, statSync as statSync19 } from "node:fs";
154979
+ import { createHash as createHash36, randomBytes as randomBytes5 } from "node:crypto";
154980
+ import { existsSync as existsSync66, readdirSync as readdirSync32, readFileSync as readFileSync79, realpathSync as realpathSync11, statSync as statSync19 } from "node:fs";
154394
154981
  import { join as join69, posix as posix3, relative as relative14, sep as sep18 } from "node:path";
154395
154982
  function humanMs(ms2) {
154396
154983
  return ms2 < 1e3 ? `${ms2}ms` : `${Math.round(ms2 / 1e3)}s`;
@@ -154409,7 +154996,7 @@ function collectWorkerSources(tier5SrcDir, bundleName) {
154409
154996
  if (statSync19(childAbs).isDirectory()) {
154410
154997
  walk2(childAbs, childRel);
154411
154998
  } else if (/\.(ts|tsx|js|mjs|json)$/.test(name)) {
154412
- files[childRel] = readFileSync78(childAbs, "utf8");
154999
+ files[childRel] = readFileSync79(childAbs, "utf8");
154413
155000
  }
154414
155001
  }
154415
155002
  };
@@ -154443,7 +155030,7 @@ function collectRelativeSiblings(files, tier5SrcDir) {
154443
155030
  if (!existsSync66(abs) || statSync19(abs).isDirectory()) continue;
154444
155031
  const key2 = `/tier5-src/${relative14(tier5SrcDir, abs).split(sep18).join(posix3.sep)}`;
154445
155032
  if (key2 in files) break;
154446
- files[key2] = readFileSync78(abs, "utf8");
155033
+ files[key2] = readFileSync79(abs, "utf8");
154447
155034
  queue.push(key2);
154448
155035
  break;
154449
155036
  }
@@ -154478,7 +155065,7 @@ function collectSdkModules(files, resolveSubpath) {
154478
155065
  function sdkSubpathReader(resolve62) {
154479
155066
  return (sub) => {
154480
155067
  try {
154481
- return readFileSync78(resolve62(`@wix/himalaya/${sub}`), "utf8");
155068
+ return readFileSync79(resolve62(`@wix/himalaya/${sub}`), "utf8");
154482
155069
  } catch {
154483
155070
  return null;
154484
155071
  }
@@ -154488,7 +155075,7 @@ function encodeJob(job) {
154488
155075
  return Buffer.from(JSON.stringify(job), "utf8").toString("base64");
154489
155076
  }
154490
155077
  function mintToken2(payload, nonce = randomBytes5(16).toString("hex")) {
154491
- const digest2 = createHash35("sha256").update(payload, "utf8").digest("base64url");
155078
+ const digest2 = createHash36("sha256").update(payload, "utf8").digest("base64url");
154492
155079
  return `${nonce}.${digest2}`;
154493
155080
  }
154494
155081
  function defaultOpenBrowser2(url) {
@@ -154650,7 +155237,7 @@ __export(coverage_exports, {
154650
155237
  suppressedNativeKeys: () => suppressedNativeKeys,
154651
155238
  trendAndStore: () => trendAndStore
154652
155239
  });
154653
- import { existsSync as existsSync67, mkdirSync as mkdirSync32, readFileSync as readFileSync79, writeFileSync as writeFileSync28 } from "node:fs";
155240
+ import { existsSync as existsSync67, mkdirSync as mkdirSync32, readFileSync as readFileSync80, writeFileSync as writeFileSync28 } from "node:fs";
154654
155241
  import { dirname as dirname37, join as join70 } from "node:path";
154655
155242
  function suppressedNativeKeys(oracle) {
154656
155243
  return [...oracle.ios ? [] : ["native-decode|ios"], ...oracle.android ? [] : ["native-decode|android"]];
@@ -154835,7 +155422,7 @@ function trendAndStore(dir, entries, suppressed) {
154835
155422
  let previous = null;
154836
155423
  try {
154837
155424
  if (existsSync67(p2)) {
154838
- const parsed = JSON.parse(readFileSync79(p2, "utf8"));
155425
+ const parsed = JSON.parse(readFileSync80(p2, "utf8"));
154839
155426
  if (Array.isArray(parsed.keys)) previous = parsed.keys.filter((k2) => typeof k2 === "string");
154840
155427
  }
154841
155428
  } catch {
@@ -154878,7 +155465,7 @@ function diffAndStoreObservations(dir, current) {
154878
155465
  let previous = null;
154879
155466
  try {
154880
155467
  if (existsSync67(p2)) {
154881
- const parsed = JSON.parse(readFileSync79(p2, "utf8"));
155468
+ const parsed = JSON.parse(readFileSync80(p2, "utf8"));
154882
155469
  if (parsed.screens && typeof parsed.screens === "object" && !Array.isArray(parsed.screens) && Object.values(parsed.screens).every(
154883
155470
  (v2) => Array.isArray(v2) && v2.every((l2) => typeof l2 === "string")
154884
155471
  )) {
@@ -154939,7 +155526,7 @@ __export(design_kits_exports, {
154939
155526
  kitsDir: () => kitsDir,
154940
155527
  listKits: () => listKits2
154941
155528
  });
154942
- import { existsSync as existsSync68, readFileSync as readFileSync80, readdirSync as readdirSync33 } from "node:fs";
155529
+ import { existsSync as existsSync68, readFileSync as readFileSync81, readdirSync as readdirSync33 } from "node:fs";
154943
155530
  import { join as join71, basename as basename16 } from "node:path";
154944
155531
  import { fileURLToPath as fileURLToPath26 } from "node:url";
154945
155532
  function kitsDir() {
@@ -154967,7 +155554,7 @@ In a published @wix/himalaya-cli this is a packaging bug \u2014 the kits should
154967
155554
  if (!kits.includes(name)) {
154968
155555
  return { ok: false, kit: name, kits, problems: [`no design kit named "${name}". Available: ${kits.join(", ")}`] };
154969
155556
  }
154970
- const raw = readFileSync80(join71(dir, `${name}.json`), "utf8");
155557
+ const raw = readFileSync81(join71(dir, `${name}.json`), "utf8");
154971
155558
  let parsed;
154972
155559
  try {
154973
155560
  parsed = JSON.parse(raw);
@@ -155007,11 +155594,11 @@ __export(assets_exports, {
155007
155594
  removeAssetPayload: () => removeAssetPayload,
155008
155595
  verifyReport: () => verifyReport
155009
155596
  });
155010
- import { readFileSync as readFileSync81 } from "node:fs";
155597
+ import { readFileSync as readFileSync82 } from "node:fs";
155011
155598
  import { basename as basename17 } from "node:path";
155012
155599
  function declaredAssets(dir) {
155013
155600
  return collectAssets(dir).map((a2) => {
155014
- const bytes2 = readFileSync81(a2.path);
155601
+ const bytes2 = readFileSync82(a2.path);
155015
155602
  return {
155016
155603
  name: a2.name,
155017
155604
  sha256: assetSha256(bytes2),
@@ -155088,7 +155675,7 @@ function verifyReport(dir, app, manifest) {
155088
155675
  };
155089
155676
  }
155090
155677
  function addAssetPayload(manifest, filePath, opts) {
155091
- const bytes2 = readFileSync81(filePath);
155678
+ const bytes2 = readFileSync82(filePath);
155092
155679
  const name = opts.name ?? basename17(filePath);
155093
155680
  const sha2566 = assetSha256(bytes2);
155094
155681
  const record2 = {
@@ -156882,7 +157469,7 @@ __export(run_exports, {
156882
157469
  runPackage: () => runPackage,
156883
157470
  withoutProdServe: () => withoutProdServe
156884
157471
  });
156885
- import { cpSync as cpSync2, existsSync as existsSync69, mkdirSync as mkdirSync33, mkdtempSync as mkdtempSync3, readFileSync as readFileSync82, rmSync as rmSync17, statSync as statSync20 } from "node:fs";
157472
+ import { cpSync as cpSync2, existsSync as existsSync69, mkdirSync as mkdirSync33, mkdtempSync as mkdtempSync3, readFileSync as readFileSync83, rmSync as rmSync17, statSync as statSync20 } from "node:fs";
156886
157473
  import { networkInterfaces as osNetworkInterfaces, tmpdir as tmpdir4 } from "node:os";
156887
157474
  import { dirname as dirname38, join as join72 } from "node:path";
156888
157475
  import { fileURLToPath as fileURLToPath27 } from "node:url";
@@ -156942,7 +157529,7 @@ async function resolvePackage(source, workDir) {
156942
157529
  }
156943
157530
  throw new Error(`${source} is a directory but has no release-manifest.json \u2014 is it a package?`);
156944
157531
  }
156945
- const bytes2 = isUrl2 ? await fetchBytes(source) : readFileSync82(source);
157532
+ const bytes2 = isUrl2 ? await fetchBytes(source) : readFileSync83(source);
156946
157533
  const root = workDir ?? mkdtempSync3(join72(tmpdir4(), "himi-run-"));
156947
157534
  const { app, appDir: appDir3 } = unpackTo(bytes2, root);
156948
157535
  const opened = openPackageDir(appDir3);
@@ -156973,7 +157560,7 @@ async function loadPreviewAssets() {
156973
157560
  ];
156974
157561
  for (const path2 of candidates) {
156975
157562
  if (!existsSync69(path2)) continue;
156976
- const blob = readFileSync82(path2);
157563
+ const blob = readFileSync83(path2);
156977
157564
  return mod.assemblePreviewAssetsFromBlob(new Uint8Array(blob.buffer, blob.byteOffset, blob.byteLength));
156978
157565
  }
156979
157566
  return /* @__PURE__ */ new Map();
@@ -157110,7 +157697,7 @@ __export(run_browser_exports, {
157110
157697
  runInBrowser: () => runInBrowser
157111
157698
  });
157112
157699
  import { createServer as createServer7 } from "node:http";
157113
- import { existsSync as existsSync70, readFileSync as readFileSync83 } from "node:fs";
157700
+ import { existsSync as existsSync70, readFileSync as readFileSync84 } from "node:fs";
157114
157701
  import { spawnSync as spawnSync3 } from "node:child_process";
157115
157702
  import { dirname as dirname39, resolve as resolve55 } from "node:path";
157116
157703
  import { fileURLToPath as fileURLToPath28 } from "node:url";
@@ -157218,7 +157805,7 @@ async function runInBrowser(releaseRoot, app, header, opts = {}) {
157218
157805
  }
157219
157806
  let bytes2;
157220
157807
  try {
157221
- bytes2 = readFileSync83(resolve55(stagedDir(), name));
157808
+ bytes2 = readFileSync84(resolve55(stagedDir(), name));
157222
157809
  } catch (e2) {
157223
157810
  res.writeHead(503, { "content-type": "application/json" });
157224
157811
  res.end(JSON.stringify({ error: "browser_plane_unstaged", file: name, detail: String(e2) }));
@@ -157271,14 +157858,14 @@ var hhp_preview_exports = {};
157271
157858
  __export(hhp_preview_exports, {
157272
157859
  hhpPreviewResponse: () => hhpPreviewResponse
157273
157860
  });
157274
- import { existsSync as existsSync71, readFileSync as readFileSync84 } from "node:fs";
157861
+ import { existsSync as existsSync71, readFileSync as readFileSync85 } from "node:fs";
157275
157862
  import { join as join73 } from "node:path";
157276
157863
  function hhpPreviewResponse(root, request) {
157277
157864
  if (new URL(request.url).pathname !== "/__himi/hhp-preview" || !existsSync71(join73(root, "hhp.json"))) return null;
157278
157865
  if (request.method !== "GET") return new Response(null, { status: 405 });
157279
157866
  try {
157280
157867
  const file2 = localPath(root, ".himi/hhp-preview.json");
157281
- const authored2 = existsSync71(file2) ? JSON.parse(readFileSync84(file2, "utf8")) : {};
157868
+ const authored2 = existsSync71(file2) ? JSON.parse(readFileSync85(file2, "utf8")) : {};
157282
157869
  if (authored2.mockCapabilities && (!Array.isArray(authored2.mockCapabilities) || authored2.mockCapabilities.some((v2) => typeof v2 !== "string"))) throw new Error("mockCapabilities must be a string array.");
157283
157870
  const fixtures = authored2.fixtures ?? {};
157284
157871
  if (typeof fixtures !== "object" || Array.isArray(fixtures) || fixtures === null) throw new Error("fixtures must be an object.");
@@ -157428,7 +158015,7 @@ var init_embedded_bundles = __esm({
157428
158015
  });
157429
158016
 
157430
158017
  // ../store-release/register-bundle.ts
157431
- import { readFileSync as readFileSync85 } from "node:fs";
158018
+ import { readFileSync as readFileSync86 } from "node:fs";
157432
158019
  import { createPrivateKey as createPrivateKey4, sign as sign2 } from "node:crypto";
157433
158020
  function b64url2(b2) {
157434
158021
  return Buffer.from(b2).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
@@ -157446,7 +158033,7 @@ function bundleIdBody(identifier, name, platform = "IOS") {
157446
158033
  async function registerBundleId(opts) {
157447
158034
  const env = requireEnv(["ASC_KEY_ID", "ASC_ISSUER_ID", "ASC_KEY_PATH"]);
157448
158035
  assertCredentialOutsideRepo("ASC_KEY_PATH", env.ASC_KEY_PATH);
157449
- const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync85(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
158036
+ const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync86(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
157450
158037
  const res = await fetch(`${ASC_API}/v1/bundleIds`, {
157451
158038
  method: "POST",
157452
158039
  headers: { Authorization: `Bearer ${jwt}`, "Content-Type": "application/json" },
@@ -157476,7 +158063,7 @@ async function main() {
157476
158063
  }
157477
158064
  const ni2 = rest.indexOf("--name");
157478
158065
  const name = ni2 >= 0 ? rest[ni2 + 1] : cfg.app ?? app;
157479
- const yml = readFileSync85(iosProjectYml(app), "utf8");
158066
+ const yml = readFileSync86(iosProjectYml(app), "utf8");
157480
158067
  for (const { id, label: label2 } of [{ id: identifier, label: name }, ...embeddedBundles(yml).map((b2) => ({
157481
158068
  id: embeddedBundleId(identifier, b2),
157482
158069
  label: `${name} ${embeddedAppIdLabel(b2)}`
@@ -157887,7 +158474,7 @@ var init_iap_api = __esm({
157887
158474
  });
157888
158475
 
157889
158476
  // ../store-release/iap-manifest.ts
157890
- import { createHash as createHash36 } from "node:crypto";
158477
+ import { createHash as createHash37 } from "node:crypto";
157891
158478
  function readTarget(reader, value) {
157892
158479
  const obj3 = reader.object(value, "target", TARGET_KEYS);
157893
158480
  return {
@@ -158031,7 +158618,7 @@ function canonicalJson(value) {
158031
158618
  return JSON.stringify(sortKeys(value));
158032
158619
  }
158033
158620
  function sha256Digest(value) {
158034
- return `sha256:${createHash36("sha256").update(canonicalJson(value)).digest("hex")}`;
158621
+ return `sha256:${createHash37("sha256").update(canonicalJson(value)).digest("hex")}`;
158035
158622
  }
158036
158623
  function manifestDigest(manifest) {
158037
158624
  return sha256Digest(manifest);
@@ -158885,13 +159472,13 @@ __export(credential_profile_exports, {
158885
159472
  profilePath: () => profilePath,
158886
159473
  resolveStoreCredentials: () => resolveStoreCredentials
158887
159474
  });
158888
- import { existsSync as existsSync72, readFileSync as readFileSync86 } from "node:fs";
158889
- import { homedir as homedir7 } from "node:os";
159475
+ import { existsSync as existsSync72, readFileSync as readFileSync87 } from "node:fs";
159476
+ import { homedir as homedir9 } from "node:os";
158890
159477
  import { join as join74 } from "node:path";
158891
- function credentialsDir(home = homedir7()) {
159478
+ function credentialsDir(home = homedir9()) {
158892
159479
  return join74(home, ".himalaya", "store-credentials");
158893
159480
  }
158894
- function profilePath(name, home = homedir7()) {
159481
+ function profilePath(name, home = homedir9()) {
158895
159482
  if (!PROFILE_NAME.test(name)) {
158896
159483
  throw new Error(
158897
159484
  `credential profile ${JSON.stringify(name)} is not a profile name \u2014 use letters, digits, ".", "_" or "-" starting with a letter or digit. It names ${join74(credentialsDir(home), "<name>.json")}; it is never a path.`
@@ -158927,8 +159514,8 @@ function namedProfile(cfg, profileFlag) {
158927
159514
  function resolveStoreCredentials(opts) {
158928
159515
  const { app, cfg } = opts;
158929
159516
  const env = opts.env ?? process.env;
158930
- const home = opts.home ?? homedir7();
158931
- const read = opts.readProfile ?? ((p2) => readFileSync86(p2, "utf8"));
159517
+ const home = opts.home ?? homedir9();
159518
+ const read = opts.readProfile ?? ((p2) => readFileSync87(p2, "utf8"));
158932
159519
  const exists = opts.profileExists ?? existsSync72;
158933
159520
  const ios = cfg.ios ?? {};
158934
159521
  const flagName = opts.profileFlag?.trim();
@@ -158994,11 +159581,11 @@ var init_credential_profile = __esm({
158994
159581
  });
158995
159582
 
158996
159583
  // ../store-release/iap-credentials.ts
158997
- import { createHash as createHash37 } from "node:crypto";
158998
- import { existsSync as existsSync73, readFileSync as readFileSync87, realpathSync as realpathSync12 } from "node:fs";
158999
- import { homedir as homedir8 } from "node:os";
159584
+ import { createHash as createHash38 } from "node:crypto";
159585
+ import { existsSync as existsSync73, readFileSync as readFileSync88, realpathSync as realpathSync12 } from "node:fs";
159586
+ import { homedir as homedir10 } from "node:os";
159000
159587
  function accountFingerprint(keyId, issuerId) {
159001
- return `sha256:${createHash37("sha256").update(`${issuerId}:${keyId}`).digest("hex").slice(0, 16)}`;
159588
+ return `sha256:${createHash38("sha256").update(`${issuerId}:${keyId}`).digest("hex").slice(0, 16)}`;
159002
159589
  }
159003
159590
  function requireExplicitProfile(profileFlag, target) {
159004
159591
  const profile = profileFlag?.trim();
@@ -159028,8 +159615,8 @@ function canonicalKeyPath(path2, profile, realpath) {
159028
159615
  }
159029
159616
  function resolveIapCredentials(options) {
159030
159617
  const { target } = options;
159031
- const home = options.home ?? homedir8();
159032
- const readFile3 = options.readFile ?? ((p2) => readFileSync87(p2, "utf8"));
159618
+ const home = options.home ?? homedir10();
159619
+ const readFile3 = options.readFile ?? ((p2) => readFileSync88(p2, "utf8"));
159033
159620
  const realpath = options.realpath ?? realpathSync12;
159034
159621
  const profile = requireExplicitProfile(options.profileFlag, target);
159035
159622
  const creds = resolveStoreCredentials({
@@ -159075,7 +159662,7 @@ var init_wix_payments_contract = __esm({
159075
159662
  });
159076
159663
 
159077
159664
  // ../store-release/iap-draft.ts
159078
- import { createHash as createHash38 } from "node:crypto";
159665
+ import { createHash as createHash39 } from "node:crypto";
159079
159666
  function fit(text9, max) {
159080
159667
  const chars = [...text9];
159081
159668
  return chars.length <= max ? text9 : `${chars.slice(0, max - 1).join("").trimEnd()}${ELLIPSIS}`;
@@ -159213,7 +159800,7 @@ var init_iap_draft = __esm({
159213
159800
  TIER_DESCRIPTION = "Unlocks one item in the app";
159214
159801
  ELLIPSIS = "\u2026";
159215
159802
  entityKey = (entityType, entityId) => `${entityType}:${entityId}`;
159216
- sha = (text9) => createHash38("sha256").update(text9).digest("hex");
159803
+ sha = (text9) => createHash39("sha256").update(text9).digest("hex");
159217
159804
  ENTITIES = { "&amp;": "&", "&nbsp;": " ", "&lt;": "<", "&gt;": ">", "&quot;": '"', "&#39;": "'" };
159218
159805
  MAX_SUFFIX = 24;
159219
159806
  ReferenceNames = class {
@@ -159351,7 +159938,7 @@ __export(version_exports, {
159351
159938
  stampTargetVersion: () => stampTargetVersion,
159352
159939
  stampVersionKeys: () => stampVersionKeys
159353
159940
  });
159354
- import { readFileSync as readFileSync88, writeFileSync as writeFileSync29 } from "node:fs";
159941
+ import { readFileSync as readFileSync89, writeFileSync as writeFileSync29 } from "node:fs";
159355
159942
  function readIosVersion(projectYml) {
159356
159943
  const marketing = matchScalar(projectYml, "CFBundleShortVersionString");
159357
159944
  const build3 = matchScalar(projectYml, "CFBundleVersion");
@@ -159498,8 +160085,8 @@ function setAndroidVersion(gradle, v2) {
159498
160085
  function bumpVersion(app, opts) {
159499
160086
  const iosPath = iosProjectYml(app);
159500
160087
  const gradlePath = androidGradle(app);
159501
- const iosYml = readFileSync88(iosPath, "utf8");
159502
- const gradle = readFileSync88(gradlePath, "utf8");
160088
+ const iosYml = readFileSync89(iosPath, "utf8");
160089
+ const gradle = readFileSync89(gradlePath, "utf8");
159503
160090
  const current = readIosVersion(iosYml);
159504
160091
  const next = {
159505
160092
  marketing: opts.marketing ?? current.marketing,
@@ -159529,7 +160116,7 @@ var init_store_spec = __esm({
159529
160116
  });
159530
160117
 
159531
160118
  // src/iap-config-edit.ts
159532
- import { existsSync as existsSync74, readFileSync as readFileSync89 } from "node:fs";
160119
+ import { existsSync as existsSync74, readFileSync as readFileSync90 } from "node:fs";
159533
160120
  import { basename as basename18, join as join75 } from "node:path";
159534
160121
  import ts8 from "typescript";
159535
160122
  function bindPurchasesAppInConfig(source, options) {
@@ -159611,14 +160198,14 @@ function withStoreBundle(dir, options) {
159611
160198
  if (options.storeBundleId) return options;
159612
160199
  const path2 = join75(dir, "store", "store.config.yaml");
159613
160200
  if (!existsSync74(path2)) return options;
159614
- const storeBundleId = parseStoreConfig(readFileSync89(path2, "utf8")).ios?.bundleId;
160201
+ const storeBundleId = parseStoreConfig(readFileSync90(path2, "utf8")).ios?.bundleId;
159615
160202
  return storeBundleId ? { ...options, storeBundleId } : options;
159616
160203
  }
159617
160204
  function previewIapConfigEdit(dir, options) {
159618
160205
  const path2 = configEntry(dir);
159619
160206
  if (!path2) return void 0;
159620
160207
  if (isSymlink2(path2)) return { path: path2, changed: false, applied: [], conflicts: [], instructions: [`${basename18(path2)} is a symlink, so it would not be edited: add the purchases app in the file it points to.`] };
159621
- const { changed, applied, conflicts, instructions } = bindPurchasesAppInConfig(readFileSync89(path2, "utf8"), { ...withStoreBundle(dir, options), fileName: basename18(path2) });
160208
+ const { changed, applied, conflicts, instructions } = bindPurchasesAppInConfig(readFileSync90(path2, "utf8"), { ...withStoreBundle(dir, options), fileName: basename18(path2) });
159622
160209
  return { path: path2, changed, applied, conflicts, instructions };
159623
160210
  }
159624
160211
  async function applyIapConfigEdit(dir, options, validate4) {
@@ -159627,7 +160214,7 @@ async function applyIapConfigEdit(dir, options, validate4) {
159627
160214
  const fileName = basename18(path2);
159628
160215
  const refuse7 = (why) => ({ path: path2, changed: false, applied: [], conflicts: [], instructions: [why] });
159629
160216
  if (isSymlink2(path2)) return refuse7(`${fileName} is a symlink, so it was not edited: add the purchases app in the file it points to.`);
159630
- const original = readFileSync89(path2, "utf8");
160217
+ const original = readFileSync90(path2, "utf8");
159631
160218
  const edit = bindPurchasesAppInConfig(original, { ...withStoreBundle(dir, options), fileName });
159632
160219
  const { applied, conflicts, instructions } = edit;
159633
160220
  if (!edit.changed) return { path: path2, changed: false, applied, conflicts, instructions };
@@ -160100,8 +160687,8 @@ __export(store_iap_exports, {
160100
160687
  runStoreIap: () => runStoreIap
160101
160688
  });
160102
160689
  import { randomUUID as randomUUID8 } from "node:crypto";
160103
- import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync34, readFileSync as readFileSync90, realpathSync as realpathSync13, rmSync as rmSync18, writeFileSync as writeFileSync30 } from "node:fs";
160104
- import { homedir as homedir9, hostname } from "node:os";
160690
+ import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync34, readFileSync as readFileSync91, realpathSync as realpathSync13, rmSync as rmSync18, writeFileSync as writeFileSync30 } from "node:fs";
160691
+ import { homedir as homedir11, hostname } from "node:os";
160105
160692
  import { join as join76 } from "node:path";
160106
160693
  function scrubDeep(value, scrub) {
160107
160694
  if (typeof value === "string") return scrub(value);
@@ -160558,7 +161145,7 @@ function fileJournal(path2) {
160558
161145
  }
160559
161146
  function readLockSummary(path2) {
160560
161147
  try {
160561
- const { pid, host, at: at2 } = JSON.parse(readFileSync90(path2, "utf8"));
161148
+ const { pid, host, at: at2 } = JSON.parse(readFileSync91(path2, "utf8"));
160562
161149
  return `pid ${pid} on ${host} since ${at2}`;
160563
161150
  } catch {
160564
161151
  return "unreadable lock";
@@ -160578,7 +161165,7 @@ function acquireApplyLock(dir, appleAppId) {
160578
161165
  return () => {
160579
161166
  let current = "";
160580
161167
  try {
160581
- current = readFileSync90(path2, "utf8");
161168
+ current = readFileSync91(path2, "utf8");
160582
161169
  } catch {
160583
161170
  return;
160584
161171
  }
@@ -160586,7 +161173,7 @@ function acquireApplyLock(dir, appleAppId) {
160586
161173
  };
160587
161174
  }
160588
161175
  function stateDir(appleAppId) {
160589
- const dir = join76(homedir9(), ".himalaya", "store-iap", appleAppId);
161176
+ const dir = join76(homedir11(), ".himalaya", "store-iap", appleAppId);
160590
161177
  mkdirSync34(dir, { recursive: true, mode: 448 });
160591
161178
  return dir;
160592
161179
  }
@@ -160602,7 +161189,7 @@ async function confirmOnTerminal(question) {
160602
161189
  }
160603
161190
  function defaultStoreIapDeps() {
160604
161191
  return {
160605
- readFile: (path2) => readFileSync90(path2, "utf8"),
161192
+ readFile: (path2) => readFileSync91(path2, "utf8"),
160606
161193
  writeFileAtomic,
160607
161194
  resolveCredentials: ({ profileFlag, target }) => resolveIapCredentials({ profileFlag, target }),
160608
161195
  createApi: (key2) => createIapApi(createAscClient({ key: key2 })),
@@ -161084,8 +161671,8 @@ __export(preflight_app_exports, {
161084
161671
  preflightApp: () => preflightApp,
161085
161672
  profileAccount: () => profileAccount
161086
161673
  });
161087
- import { readFileSync as readFileSync91, existsSync as existsSync75, readdirSync as readdirSync34, statSync as statSync21 } from "node:fs";
161088
- import { createHash as createHash39 } from "node:crypto";
161674
+ import { readFileSync as readFileSync92, existsSync as existsSync75, readdirSync as readdirSync34, statSync as statSync21 } from "node:fs";
161675
+ import { createHash as createHash40 } from "node:crypto";
161089
161676
  import { join as join77 } from "node:path";
161090
161677
  function analyze(projectYml, storeConfig, icon, account) {
161091
161678
  const f2 = [];
@@ -161150,8 +161737,8 @@ function profileAccount(app, storeConfig, opts = {}) {
161150
161737
  }
161151
161738
  }
161152
161739
  async function preflightApp(app, opts = {}) {
161153
- const projectYml = existsSync75(iosProjectYml(app)) ? readFileSync91(iosProjectYml(app), "utf8") : "";
161154
- const storeConfig = existsSync75(storeConfigPath(app)) ? readFileSync91(storeConfigPath(app), "utf8") : "";
161740
+ const projectYml = existsSync75(iosProjectYml(app)) ? readFileSync92(iosProjectYml(app), "utf8") : "";
161741
+ const storeConfig = existsSync75(storeConfigPath(app)) ? readFileSync92(storeConfigPath(app), "utf8") : "";
161155
161742
  if (!storeConfig) return [{ level: "error", message: `no apps/${app}/store/store.config.yaml \u2014 run /setup-store-signing first.` }];
161156
161743
  const findings = analyze(
161157
161744
  projectYml,
@@ -161310,7 +161897,7 @@ function playListingAssets(app, locale = "en-US") {
161310
161897
  for (const name of names) {
161311
161898
  const p2 = join77(dir, name);
161312
161899
  try {
161313
- if (statSync21(p2).isFile()) return { name, bytes: readFileSync91(p2) };
161900
+ if (statSync21(p2).isFile()) return { name, bytes: readFileSync92(p2) };
161314
161901
  } catch {
161315
161902
  }
161316
161903
  }
@@ -161350,7 +161937,7 @@ function listScreenshots(app, locale = "en-US") {
161350
161937
  const flat = join77(storeDir(app), "screenshots", locale);
161351
161938
  if (existsSync75(flat)) {
161352
161939
  for (const png of readdirSync34(flat).filter((n2) => n2.endsWith(".png"))) {
161353
- const sz = pngSize(readFileSync91(join77(flat, png)));
161940
+ const sz = pngSize(readFileSync92(join77(flat, png)));
161354
161941
  if (sz) out2.push({ name: png, w: sz.w, h: sz.h });
161355
161942
  }
161356
161943
  }
@@ -161360,7 +161947,7 @@ function listScreenshots(app, locale = "en-US") {
161360
161947
  const d2 = join77(legacy, deviceDir);
161361
161948
  if (!statSync21(d2).isDirectory()) continue;
161362
161949
  for (const png of readdirSync34(d2).filter((n2) => n2.endsWith(".png"))) {
161363
- const sz = pngSize(readFileSync91(join77(d2, png)));
161950
+ const sz = pngSize(readFileSync92(join77(d2, png)));
161364
161951
  if (sz) out2.push({ name: `${deviceDir}/${png}`, w: sz.w, h: sz.h });
161365
161952
  }
161366
161953
  }
@@ -161374,7 +161961,7 @@ function placeholderHashes2() {
161374
161961
  const p2 = join77(templateIos, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
161375
161962
  try {
161376
161963
  if (!statSync21(p2).isFile()) continue;
161377
- return [LEGACY_PLACEHOLDER_SHA2562, createHash39("sha256").update(readFileSync91(p2)).digest("hex")];
161964
+ return [LEGACY_PLACEHOLDER_SHA2562, createHash40("sha256").update(readFileSync92(p2)).digest("hex")];
161378
161965
  } catch {
161379
161966
  }
161380
161967
  }
@@ -161410,8 +161997,8 @@ async function appIconState(iosDir) {
161410
161997
  const p2 = join77(iosDir, target, "Assets.xcassets", "AppIcon.appiconset", "icon_1024.png");
161411
161998
  try {
161412
161999
  if (!statSync21(p2).isFile()) continue;
161413
- const bytes2 = readFileSync91(p2);
161414
- const hash2 = createHash39("sha256").update(bytes2).digest("hex");
162000
+ const bytes2 = readFileSync92(p2);
162001
+ const hash2 = createHash40("sha256").update(bytes2).digest("hex");
161415
162002
  const pixels = await pixelIssues(bytes2);
161416
162003
  return {
161417
162004
  exists: true,
@@ -161477,7 +162064,7 @@ __export(asc_status_exports, {
161477
162064
  ascStatus: () => ascStatus,
161478
162065
  buildVerdict: () => buildVerdict
161479
162066
  });
161480
- import { readFileSync as readFileSync92 } from "node:fs";
162067
+ import { readFileSync as readFileSync93 } from "node:fs";
161481
162068
  function buildVerdict(builds) {
161482
162069
  if (!builds.length) {
161483
162070
  return "NO builds registered \u2014 if you uploaded recently and it's been >15 min, the binary was REJECTED IN PROCESSING (reason is email-only; run validate-binary.ts / scan-purpose-strings.ts to reproduce it).";
@@ -161491,7 +162078,7 @@ function buildVerdict(builds) {
161491
162078
  function client(creds) {
161492
162079
  const env = creds ?? requireEnv(["ASC_KEY_ID", "ASC_ISSUER_ID", "ASC_KEY_PATH"]);
161493
162080
  assertCredentialOutsideRepo("ASC_KEY_PATH", env.ASC_KEY_PATH);
161494
- const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync92(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
162081
+ const jwt = ascJwt(env.ASC_KEY_ID, env.ASC_ISSUER_ID, readFileSync93(env.ASC_KEY_PATH, "utf8"), Math.floor(Date.now() / 1e3));
161495
162082
  return async (path2) => {
161496
162083
  const r2 = await fetch(`${ASC}${path2}`, { headers: { Authorization: `Bearer ${jwt}` } });
161497
162084
  return { status: r2.status, json: await r2.json().catch(() => ({})) };
@@ -161756,7 +162343,7 @@ __export(secrets_exports, {
161756
162343
  runRemoteSecretsCommand: () => runRemoteSecretsCommand,
161757
162344
  runSecretsCommand: () => runSecretsCommand
161758
162345
  });
161759
- import { readFileSync as readFileSync93 } from "node:fs";
162346
+ import { readFileSync as readFileSync94 } from "node:fs";
161760
162347
  function environment(value) {
161761
162348
  if (value === "preview" || value === "production") return value;
161762
162349
  throw new Error("--environment must be preview or production");
@@ -161787,7 +162374,7 @@ async function runSecretsCommand(operation, flags, io2, options = {}) {
161787
162374
  io2.log(JSON.stringify(await vault.list({ app, environment: env })));
161788
162375
  return 0;
161789
162376
  }
161790
- const value = options.readValue ? options.readValue() : readFileSync93(0, "utf8").replace(/\r?\n$/, "");
162377
+ const value = options.readValue ? options.readValue() : readFileSync94(0, "utf8").replace(/\r?\n$/, "");
161791
162378
  if (operation === "set") await vault.set({ app, environment: env, name, value });
161792
162379
  else if (operation === "rotate") await vault.rotate({ app, environment: env, name, value });
161793
162380
  else throw new Error(`unknown secrets operation ${operation}`);
@@ -161816,7 +162403,7 @@ async function runRemoteSecretsCommand(operation, flags, io2, options) {
161816
162403
  }
161817
162404
  let body;
161818
162405
  if (operation !== "list") {
161819
- const value = options.readValue ? options.readValue() : readFileSync93(0, "utf8").replace(/\r?\n$/, "");
162406
+ const value = options.readValue ? options.readValue() : readFileSync94(0, "utf8").replace(/\r?\n$/, "");
161820
162407
  body = JSON.stringify({ value });
161821
162408
  }
161822
162409
  const response = await (options.fetchImpl ?? fetch)(url, { method: operation === "list" ? "GET" : operation === "set" ? "PUT" : "POST", headers: headers2, body });
@@ -162010,7 +162597,7 @@ var init_site_member = __esm({
162010
162597
  });
162011
162598
 
162012
162599
  // src/notify-ping-all.ts
162013
- import { createHash as createHash40 } from "node:crypto";
162600
+ import { createHash as createHash41 } from "node:crypto";
162014
162601
  async function listApprovedMembers(input) {
162015
162602
  const first = await scanMembers(input);
162016
162603
  const second = await scanMembers(input);
@@ -162064,7 +162651,7 @@ async function scanMembers(input) {
162064
162651
  }
162065
162652
  }
162066
162653
  function campaignRequestId(campaignId, memberId) {
162067
- const bytes2 = createHash40("sha256").update(JSON.stringify(["himi-push-campaign", campaignId, memberId])).digest().subarray(0, 16);
162654
+ const bytes2 = createHash41("sha256").update(JSON.stringify(["himi-push-campaign", campaignId, memberId])).digest().subarray(0, 16);
162068
162655
  bytes2[6] = bytes2[6] & 15 | 80;
162069
162656
  bytes2[8] = bytes2[8] & 63 | 128;
162070
162657
  const hex2 = bytes2.toString("hex");
@@ -162314,15 +162901,15 @@ __export(notify_exports, {
162314
162901
  runNotify: () => runNotify,
162315
162902
  saveAdminSession: () => saveAdminSession
162316
162903
  });
162317
- import { chmodSync as chmodSync3, mkdirSync as mkdirSync35, readFileSync as readFileSync94, writeFileSync as writeFileSync31 } from "node:fs";
162318
- import { homedir as homedir10 } from "node:os";
162904
+ import { chmodSync as chmodSync3, mkdirSync as mkdirSync35, readFileSync as readFileSync95, writeFileSync as writeFileSync31 } from "node:fs";
162905
+ import { homedir as homedir12 } from "node:os";
162319
162906
  import { dirname as dirname41, join as join78 } from "node:path";
162320
162907
  function defaultSessionsPath() {
162321
- return process.env.HIMI_ADMIN_SESSIONS_FILE ?? join78(homedir10(), ".himalaya", "admin-sessions.json");
162908
+ return process.env.HIMI_ADMIN_SESSIONS_FILE ?? join78(homedir12(), ".himalaya", "admin-sessions.json");
162322
162909
  }
162323
162910
  function loadSessionsFile(path2 = defaultSessionsPath()) {
162324
162911
  try {
162325
- return JSON.parse(readFileSync94(path2, "utf8"));
162912
+ return JSON.parse(readFileSync95(path2, "utf8"));
162326
162913
  } catch {
162327
162914
  return {};
162328
162915
  }
@@ -162699,20 +163286,20 @@ __export(base44_auth_exports, {
162699
163286
  usableBase44Auth: () => usableBase44Auth,
162700
163287
  writeBase44Session: () => writeBase44Session
162701
163288
  });
162702
- import { chmodSync as chmodSync4, existsSync as existsSync76, mkdirSync as mkdirSync36, readFileSync as readFileSync95, rmSync as rmSync19, writeFileSync as writeFileSync32 } from "node:fs";
162703
- import { homedir as homedir11 } from "node:os";
163289
+ import { chmodSync as chmodSync4, existsSync as existsSync76, mkdirSync as mkdirSync36, readFileSync as readFileSync96, rmSync as rmSync19, writeFileSync as writeFileSync32 } from "node:fs";
163290
+ import { homedir as homedir13 } from "node:os";
162704
163291
  import { dirname as dirname42, join as join79 } from "node:path";
162705
163292
  function base44ApiBase(env = process.env) {
162706
163293
  return (env.BASE44_API_URL?.trim() || "https://app.base44.com").replace(/\/+$/, "");
162707
163294
  }
162708
- function base44SessionPath(home = homedir11()) {
163295
+ function base44SessionPath(home = homedir13()) {
162709
163296
  return join79(home, ".himi", "base44", "session.json");
162710
163297
  }
162711
163298
  function readBase44Session(home) {
162712
163299
  const p2 = base44SessionPath(home);
162713
163300
  if (!existsSync76(p2)) return void 0;
162714
163301
  try {
162715
- const s2 = JSON.parse(readFileSync95(p2, "utf8"));
163302
+ const s2 = JSON.parse(readFileSync96(p2, "utf8"));
162716
163303
  return typeof s2.accessToken === "string" && s2.accessToken ? s2 : void 0;
162717
163304
  } catch {
162718
163305
  return void 0;
@@ -162822,10 +163409,10 @@ async function base44DeviceLogin(opts) {
162822
163409
  }
162823
163410
  throw new Error("the Base44 sign-in code expired before it was approved \u2014 run `himi base44 login` again");
162824
163411
  }
162825
- function importBase44CliSession(home = homedir11(), env = process.env) {
163412
+ function importBase44CliSession(home = homedir13(), env = process.env) {
162826
163413
  const src = join79(home, ".base44", "auth", "auth.json");
162827
163414
  if (!existsSync76(src)) throw new Error(`no Base44 CLI session at ${src} \u2014 run \`npx base44 login\` first, or use \`himi base44 login\``);
162828
- const a2 = JSON.parse(readFileSync95(src, "utf8"));
163415
+ const a2 = JSON.parse(readFileSync96(src, "utf8"));
162829
163416
  if (typeof a2.accessToken !== "string" || !a2.accessToken) throw new Error(`${src} holds no access token`);
162830
163417
  const session = {
162831
163418
  accessToken: a2.accessToken,
@@ -166129,11 +166716,11 @@ var init_analyze = __esm({
166129
166716
  });
166130
166717
 
166131
166718
  // src/base44-analyze/write-artifacts.ts
166132
- import { existsSync as existsSync77, mkdirSync as mkdirSync38, readFileSync as readFileSync96, rmSync as rmSync20, writeFileSync as writeFileSync34 } from "node:fs";
166719
+ import { existsSync as existsSync77, mkdirSync as mkdirSync38, readFileSync as readFileSync97, rmSync as rmSync20, writeFileSync as writeFileSync34 } from "node:fs";
166133
166720
  import { dirname as dirname43, join as join81, resolve as resolve57, sep as sep19 } from "node:path";
166134
166721
  function isBookFolder(dir) {
166135
166722
  try {
166136
- return JSON.parse(readFileSync96(join81(dir, "book.json"), "utf8")).kind === "base44-app-book";
166723
+ return JSON.parse(readFileSync97(join81(dir, "book.json"), "utf8")).kind === "base44-app-book";
166137
166724
  } catch {
166138
166725
  return false;
166139
166726
  }
@@ -171549,7 +172136,7 @@ var init_customer_build = __esm({
171549
172136
  });
171550
172137
 
171551
172138
  // src/site-analyze/apply.ts
171552
- import { existsSync as existsSync78, readFileSync as readFileSync97, writeFileSync as writeFileSync36, copyFileSync as copyFileSync2, mkdirSync as mkdirSync40, realpathSync as realpathSync14, statSync as statSync22 } from "node:fs";
172139
+ import { existsSync as existsSync78, readFileSync as readFileSync98, writeFileSync as writeFileSync36, copyFileSync as copyFileSync2, mkdirSync as mkdirSync40, realpathSync as realpathSync14, statSync as statSync22 } from "node:fs";
171553
172140
  import { dirname as dirname44, isAbsolute as isAbsolute8, join as join83, resolve as resolve59, sep as sep20 } from "node:path";
171554
172141
  import { spawnSync as spawnSync4 } from "node:child_process";
171555
172142
  function unpairedRedirectNote(overlay) {
@@ -171672,7 +172259,7 @@ function buildMergedContract(options) {
171672
172259
  if (!existsSync78(committedPath)) {
171673
172260
  throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
171674
172261
  }
171675
- const committed = JSON.parse(readFileSync97(committedPath, "utf8"));
172262
+ const committed = JSON.parse(readFileSync98(committedPath, "utf8"));
171676
172263
  const merged = mergeCustomerOwned(committed, overlay);
171677
172264
  const overlayFontFamily = (overlay.branding ?? {}).fontFamily;
171678
172265
  const branding = merged.branding ?? {};
@@ -171711,7 +172298,7 @@ function buildMergedContract(options) {
171711
172298
  if (existsSync78(facesPath)) {
171712
172299
  let faces = [];
171713
172300
  try {
171714
- const parsed = JSON.parse(readFileSync97(facesPath, "utf8"));
172301
+ const parsed = JSON.parse(readFileSync98(facesPath, "utf8"));
171715
172302
  faces = Array.isArray(parsed) ? parsed : [];
171716
172303
  } catch {
171717
172304
  faces = [];
@@ -171772,7 +172359,7 @@ function staticFaqFor(overlay, overlayPath) {
171772
172359
  const bookPath = join83(dirname44(resolve59(overlayPath)), "book.json");
171773
172360
  if (!existsSync78(bookPath)) return void 0;
171774
172361
  try {
171775
- const book = JSON.parse(readFileSync97(bookPath, "utf8"));
172362
+ const book = JSON.parse(readFileSync98(bookPath, "utf8"));
171776
172363
  const copy = book?.copy;
171777
172364
  if (!copy || typeof copy !== "object" || copy.unavailable) return void 0;
171778
172365
  const pairs = deriveStaticFaq(copy.faq);
@@ -171789,7 +172376,7 @@ function staticGalleriesFor(overlay, overlayPath) {
171789
172376
  const bookPath = join83(dirname44(resolve59(overlayPath)), "book.json");
171790
172377
  if (!existsSync78(bookPath)) return void 0;
171791
172378
  try {
171792
- const book = JSON.parse(readFileSync97(bookPath, "utf8"));
172379
+ const book = JSON.parse(readFileSync98(bookPath, "utf8"));
171793
172380
  if (!book.look || book.look.unavailable || !Array.isArray(book.look.pages)) return void 0;
171794
172381
  const galleries = deriveStaticGalleries(book.look.pages);
171795
172382
  return galleries.length || book.look.complete === true ? galleries : void 0;
@@ -171801,8 +172388,8 @@ async function applyOverlays(input) {
171801
172388
  const cwd = resolve59(input.cwd);
171802
172389
  const shell = input.shell ?? DEFAULT_BRANDABLE_SHELL;
171803
172390
  assertKnownShell(shell);
171804
- const overlay = JSON.parse(readFileSync97(input.overlayPath, "utf8"));
171805
- const tokens2 = JSON.parse(readFileSync97(input.tokensPath, "utf8"));
172391
+ const overlay = JSON.parse(readFileSync98(input.overlayPath, "utf8"));
172392
+ const tokens2 = JSON.parse(readFileSync98(input.tokensPath, "utf8"));
171806
172393
  const faq = staticFaqFor(overlay, input.overlayPath);
171807
172394
  if (faq !== void 0) overlay.faq = faq;
171808
172395
  const galleries = staticGalleriesFor(overlay, input.overlayPath);
@@ -171821,7 +172408,7 @@ async function applyOverlays(input) {
171821
172408
  }
171822
172409
  const appDir3 = join83(repoRoot2, shellAppDir(shell));
171823
172410
  const committedPath = join83(appDir3, "provisioning.json");
171824
- const committedSite = existsSync78(committedPath) ? JSON.parse(readFileSync97(committedPath, "utf8")).site : void 0;
172411
+ const committedSite = existsSync78(committedPath) ? JSON.parse(readFileSync98(committedPath, "utf8")).site : void 0;
171825
172412
  if (committedSite !== void 0 && overlay.site === void 0) {
171826
172413
  throw new Error(
171827
172414
  `shell "${shell}" is a site shell: its contract names the customer's website (a \`site\` block), and this overlay has none. Re-run \`himi site analyze --url <site> --shell ${shell}\` to derive the site's page map (edit \`site.pages\` in provisioning.overlay.json if needed), then --apply.`
@@ -171863,7 +172450,7 @@ async function applyOverlays(input) {
171863
172450
  let packageFaq = faq;
171864
172451
  let packageGalleries = galleries;
171865
172452
  if (existsSync78(pkgProv)) {
171866
- const cur = JSON.parse(readFileSync97(pkgProv, "utf8"));
172453
+ const cur = JSON.parse(readFileSync98(pkgProv, "utf8"));
171867
172454
  if (galleries === void 0 && !sameKnownSite(cur, overlay)) overlay.galleries = [];
171868
172455
  const merged = deepMerge4(cur, overlay);
171869
172456
  packageFaq = merged.faq;
@@ -171881,7 +172468,7 @@ async function applyOverlays(input) {
171881
172468
  }
171882
172469
  const pkgTokens = join83(cwd, "tokens.json");
171883
172470
  if (existsSync78(pkgTokens) && (tokens2.colors || tokens2.typography)) {
171884
- const cur = JSON.parse(readFileSync97(pkgTokens, "utf8"));
172471
+ const cur = JSON.parse(readFileSync98(pkgTokens, "utf8"));
171885
172472
  let tokensIn = tokens2;
171886
172473
  if (tokens2.typography) {
171887
172474
  const fonts = catalogTypography(tokens2.typography, cur.typography);
@@ -171908,7 +172495,7 @@ async function applyOverlays(input) {
171908
172495
  const homeAction = homeRefreshActionId(shell);
171909
172496
  const homeSrc = join83(cwd, "dev/index.ts");
171910
172497
  if (homeAction && existsSync78(homeSrc)) {
171911
- const prev = readFileSync97(homeSrc, "utf8");
172498
+ const prev = readFileSync98(homeSrc, "utf8");
171912
172499
  const patched = patchBrandParams(prev, overlay, homeAction);
171913
172500
  let next = patched.src;
171914
172501
  if (!patched.foreign && faq?.length && prev.includes('"tier5.himiBrandedFaq.load"') && !prev.includes('"staticFaq"')) {
@@ -172907,7 +173494,7 @@ __export(cli_exports2, {
172907
173494
  runSiteAnalyze: () => runSiteAnalyze,
172908
173495
  runSiteFunctionCli: () => runSiteFunctionCli
172909
173496
  });
172910
- import { existsSync as existsSync79, readFileSync as readFileSync98 } from "node:fs";
173497
+ import { existsSync as existsSync79, readFileSync as readFileSync99 } from "node:fs";
172911
173498
  import { resolve as resolve60 } from "node:path";
172912
173499
  function applyNeedsClient(shell) {
172913
173500
  if (shell === void 0 || !SHELL_NAMES2.includes(shell)) return true;
@@ -172966,7 +173553,7 @@ async function runSiteAnalyze(opts) {
172966
173553
  const prevOverlayPath = resolve60(outDir, "provisioning.overlay.json");
172967
173554
  const prevSite = existsSync79(prevOverlayPath) ? (() => {
172968
173555
  try {
172969
- return JSON.parse(readFileSync98(prevOverlayPath, "utf8")).site;
173556
+ return JSON.parse(readFileSync99(prevOverlayPath, "utf8")).site;
172970
173557
  } catch {
172971
173558
  return void 0;
172972
173559
  }
@@ -172985,7 +173572,7 @@ async function runSiteAnalyze(opts) {
172985
173572
  }
172986
173573
  const previousOverlay = resolve60(outDir, "provisioning.overlay.json");
172987
173574
  carryOverGoals(
172988
- existsSync79(previousOverlay) ? readFileSync98(previousOverlay, "utf8") : void 0,
173575
+ existsSync79(previousOverlay) ? readFileSync99(previousOverlay, "utf8") : void 0,
172989
173576
  result.provisioningOverlay
172990
173577
  );
172991
173578
  const ownerCall = ownerAuth ? ownerTransportFrom(fetchImpl, ownerAuth) : void 0;
@@ -173043,7 +173630,7 @@ async function runSiteFunctionCli(opts) {
173043
173630
  let source;
173044
173631
  if (opts.sourcePath) {
173045
173632
  const p2 = resolve60(opts.cwd ?? process.cwd(), opts.sourcePath);
173046
- source = readFileSync98(p2, "utf8");
173633
+ source = readFileSync99(p2, "utf8");
173047
173634
  }
173048
173635
  let body;
173049
173636
  if (opts.bodyRaw != null) {
@@ -173073,7 +173660,7 @@ async function runSiteFunctionCli(opts) {
173073
173660
  function base44BookRoutes(bookPath, siteUrl) {
173074
173661
  if (!existsSync79(bookPath)) return void 0;
173075
173662
  try {
173076
- const book = JSON.parse(readFileSync98(bookPath, "utf8"));
173663
+ const book = JSON.parse(readFileSync99(bookPath, "utf8"));
173077
173664
  if (book.kind !== "base44-app-book" || !Array.isArray(book.routes)) return void 0;
173078
173665
  const host = (u2) => {
173079
173666
  try {
@@ -173213,7 +173800,7 @@ function explainAuthFailure(err) {
173213
173800
  return `${err.status} from the \`wix token\` identity \u2014 your Wix user may not be allowed to provision on this account. Generate an API key with site-provisioning permission at ${API_KEYS_URL}, then export WIX_API_KEY and WIX_ACCOUNT_ID and retry.`;
173214
173801
  }
173215
173802
  var API_BASE2, API_KEYS_URL, TOKEN_RE2, TOKEN_MINT_TIMEOUT_MS2, cached2, DEFAULT_TIMEOUT_MS5;
173216
- var init_wix_account = __esm({
173803
+ var init_wix_account2 = __esm({
173217
173804
  "src/wix-account.ts"() {
173218
173805
  init_wix_owner();
173219
173806
  API_BASE2 = "https://www.wixapis.com";
@@ -173328,7 +173915,7 @@ __export(site_create_exports, {
173328
173915
  runSiteList: () => runSiteList,
173329
173916
  writeProvisioningBinding: () => writeProvisioningBinding
173330
173917
  });
173331
- import { existsSync as existsSync80, readFileSync as readFileSync99, writeFileSync as writeFileSync37 } from "node:fs";
173918
+ import { existsSync as existsSync80, readFileSync as readFileSync100, writeFileSync as writeFileSync37 } from "node:fs";
173332
173919
  import { resolve as resolvePath2 } from "node:path";
173333
173920
  function oauthClientName(projectName) {
173334
173921
  return `${projectName} client`;
@@ -173477,7 +174064,7 @@ async function runSiteCreate(opts) {
173477
174064
  if (!wantOauthApp) return { ...base, nextSteps: nextSteps(metaSiteId) };
173478
174065
  return { ...base, clientId, redirectUri, nextSteps: nextSteps(metaSiteId, clientId) };
173479
174066
  }
173480
- function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync80, readFileSync: readFileSync99, writeFileSync: writeFileSync37 }) {
174067
+ function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync80, readFileSync: readFileSync100, writeFileSync: writeFileSync37 }) {
173481
174068
  const msid = binding2.siteId;
173482
174069
  const path2 = resolvePath2(target);
173483
174070
  const committed = committedShellProvisioning(path2);
@@ -173561,7 +174148,7 @@ var init_site_create = __esm({
173561
174148
  "src/site-create.ts"() {
173562
174149
  init_shell_quote();
173563
174150
  init_wix_owner();
173564
- init_wix_account();
174151
+ init_wix_account2();
173565
174152
  init_wix_verticals();
173566
174153
  init_apply2();
173567
174154
  init_types2();
@@ -174174,11 +174761,11 @@ var init_context = __esm({
174174
174761
  });
174175
174762
 
174176
174763
  // src/cli.ts
174177
- import { mkdtempSync as mkdtempSync5, readFileSync as readFileSync100, mkdirSync as mkdirSync41, writeFileSync as writeFileSync38, existsSync as existsSync81, rmSync as rmSync22, readdirSync as readdirSync35, statSync as statSync23, lstatSync as lstatSync21, accessSync, constants as constants4, renameSync as renameSync12, cpSync as cpSync3 } from "node:fs";
174764
+ import { mkdtempSync as mkdtempSync5, readFileSync as readFileSync101, mkdirSync as mkdirSync41, writeFileSync as writeFileSync38, existsSync as existsSync81, rmSync as rmSync22, readdirSync as readdirSync35, statSync as statSync23, lstatSync as lstatSync21, accessSync, constants as constants4, renameSync as renameSync12, cpSync as cpSync3 } from "node:fs";
174178
174765
  import { execFile as execFile2, execFileSync as execFileSync7, spawnSync as spawnSync5, spawn as spawn7 } from "node:child_process";
174179
174766
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
174180
- import { createHash as createHash41, randomUUID as randomUUID11 } from "node:crypto";
174181
- import { tmpdir as tmpdir6, homedir as homedir12, hostname as hostname2 } from "node:os";
174767
+ import { createHash as createHash42, randomUUID as randomUUID11 } from "node:crypto";
174768
+ import { tmpdir as tmpdir6, homedir as homedir14, hostname as hostname2 } from "node:os";
174182
174769
  import { join as join84, resolve as resolve61, relative as relative15, basename as basename19, dirname as dirname45 } from "node:path";
174183
174770
  import { fileURLToPath as fileURLToPath29 } from "node:url";
174184
174771
 
@@ -176253,7 +176840,7 @@ var num3 = (v2) => typeof v2 === "string" && v2 !== "" && Number.isFinite(Number
176253
176840
  function embeddedTemplateCatalog() {
176254
176841
  return availableTemplates().map((name) => {
176255
176842
  const path2 = join84(templateSourceDir(name), TEMPLATE_META_FILE);
176256
- const meta = JSON.parse(readFileSync100(path2, "utf8"));
176843
+ const meta = JSON.parse(readFileSync101(path2, "utf8"));
176257
176844
  if (!meta || typeof meta.title !== "string" || typeof meta.description !== "string" || !Array.isArray(meta.tags)) {
176258
176845
  throw new Error(`${path2} must be { title: string, description: string, tags: string[], category?: string }`);
176259
176846
  }
@@ -177131,7 +177718,7 @@ var COMMANDS2 = [
177131
177718
  ];
177132
177719
  function cliVersion() {
177133
177720
  try {
177134
- return JSON.parse(readFileSync100(new URL("../package.json", import.meta.url), "utf8")).version ?? "unknown";
177721
+ return JSON.parse(readFileSync101(new URL("../package.json", import.meta.url), "utf8")).version ?? "unknown";
177135
177722
  } catch {
177136
177723
  return "unknown";
177137
177724
  }
@@ -177169,7 +177756,7 @@ function createScopedRegistryResolver(exec = execNpmConfig) {
177169
177756
  const configured = async (key2) => {
177170
177757
  const timeout = deadline - Date.now();
177171
177758
  if (timeout <= 0) throw new Error("npm config: out of budget");
177172
- const raw = String(await exec("npm", ["config", "get", key2], { cwd: homedir12(), timeout })).trim();
177759
+ const raw = String(await exec("npm", ["config", "get", key2], { cwd: homedir14(), timeout })).trim();
177173
177760
  return raw && raw !== "undefined" ? raw : void 0;
177174
177761
  };
177175
177762
  const effective = normalizeRegistry(await configured("@wix:registry") ?? await configured("registry"));
@@ -177256,7 +177843,7 @@ function ageInDays(publishedAt, now = Date.now()) {
177256
177843
  }
177257
177844
  function packageVersion(path2) {
177258
177845
  try {
177259
- const version4 = JSON.parse(readFileSync100(path2, "utf8")).version;
177846
+ const version4 = JSON.parse(readFileSync101(path2, "utf8")).version;
177260
177847
  return typeof version4 === "string" && version4 ? version4 : void 0;
177261
177848
  } catch {
177262
177849
  return void 0;
@@ -177322,11 +177909,11 @@ var UPDATE_RETRY_AFTER_FAILURE_MS = 60 * 60 * 1e3;
177322
177909
  var UPDATE_SNOOZE_MS = 24 * 60 * 60 * 1e3;
177323
177910
  var UPDATE_REEXEC_ENV = "HIMI_UPDATED_ONCE";
177324
177911
  function updateCachePath(env = process.env) {
177325
- return env.HIMI_UPDATE_CACHE_FILE ?? join84(homedir12(), ".himalaya", "update-check.json");
177912
+ return env.HIMI_UPDATE_CACHE_FILE ?? join84(homedir14(), ".himalaya", "update-check.json");
177326
177913
  }
177327
177914
  function readUpdateCache(path2) {
177328
177915
  try {
177329
- const parsed = JSON.parse(readFileSync100(path2, "utf8"));
177916
+ const parsed = JSON.parse(readFileSync101(path2, "utf8"));
177330
177917
  return parsed && typeof parsed === "object" ? parsed : {};
177331
177918
  } catch {
177332
177919
  return {};
@@ -177388,7 +177975,7 @@ function createUpdateRunner(spawn8 = spawnSync5) {
177388
177975
  // parse — the agent case this whole feature exists for (#2985 review). And no stdin: an
177389
177976
  // install needs none, and must not consume input piped to the command we are about to re-run.
177390
177977
  stdio: ["ignore", 2, 2],
177391
- cwd: homedir12()
177978
+ cwd: homedir14()
177392
177979
  });
177393
177980
  if (result.error) return { ok: false, detail: result.error.message };
177394
177981
  return result.status === 0 ? { ok: true } : { ok: false, detail: `npm exited ${result.status}` };
@@ -177447,7 +178034,7 @@ function staleUpdateLockFile(cachePath, now) {
177447
178034
  for (const path2 of [`${cachePath}.lock.break`, `${cachePath}.lock`]) {
177448
178035
  let content;
177449
178036
  try {
177450
- content = readFileSync100(path2, "utf8");
178037
+ content = readFileSync101(path2, "utf8");
177451
178038
  } catch {
177452
178039
  continue;
177453
178040
  }
@@ -177470,7 +178057,7 @@ function acquireUpdateLock(cachePath, now, hooks = {}) {
177470
178057
  const mine = lockStamp(now);
177471
178058
  const readLock = (path2) => {
177472
178059
  try {
177473
- return readFileSync100(path2, "utf8");
178060
+ return readFileSync101(path2, "utf8");
177474
178061
  } catch {
177475
178062
  return void 0;
177476
178063
  }
@@ -177561,7 +178148,7 @@ function createUpdateRefreshSpawner(spawnFn = spawn7, execArgv = process.execArg
177561
178148
  const child = spawnFn(process.execPath, [...loaderArgs(execArgv), fileURLToPath29(import.meta.url), UPDATE_REFRESH_COMMAND], {
177562
178149
  detached: true,
177563
178150
  stdio: "ignore",
177564
- cwd: homedir12(),
178151
+ cwd: homedir14(),
177565
178152
  env: process.env
177566
178153
  });
177567
178154
  child.on("error", () => {
@@ -178171,7 +178758,7 @@ async function nativeConfigAdvisories(app, configSource) {
178171
178758
  const { iosProjectYml: iosProjectYml2 } = await Promise.resolve().then(() => (init_paths2(), paths_exports));
178172
178759
  const { androidOptedIn: androidOptedIn3, LABEL_IOS_SPLASH: LABEL_IOS_SPLASH2 } = await Promise.resolve().then(() => (init_splash(), splash_exports));
178173
178760
  const iosYmlPath = iosProjectYml2(app);
178174
- const iosYml = existsSync81(iosYmlPath) ? readFileSync100(iosYmlPath, "utf8") : "";
178761
+ const iosYml = existsSync81(iosYmlPath) ? readFileSync101(iosYmlPath, "utf8") : "";
178175
178762
  let optedIn = iosYml.includes(LABEL_IOS_SPLASH2);
178176
178763
  if (!optedIn) {
178177
178764
  const { androidManifestPath: androidManifestPath3 } = await Promise.resolve().then(() => (init_gen_native_config(), gen_native_config_exports));
@@ -178185,7 +178772,7 @@ async function nativeConfigAdvisories(app, configSource) {
178185
178772
  }
178186
178773
  function readConfigSource(dir) {
178187
178774
  try {
178188
- return readFileSync100(join84(dir, "config.ts"), "utf8");
178775
+ return readFileSync101(join84(dir, "config.ts"), "utf8");
178189
178776
  } catch {
178190
178777
  return null;
178191
178778
  }
@@ -178393,8 +178980,8 @@ function materializeForPreview(appDir3, slug, displayName2) {
178393
178980
  }
178394
178981
  async function appId(dir) {
178395
178982
  try {
178396
- const { readFileSync: readFileSync101 } = await import("node:fs");
178397
- const m2 = JSON.parse(readFileSync101(join84(dir, "himalaya.content.json"), "utf8"));
178983
+ const { readFileSync: readFileSync102 } = await import("node:fs");
178984
+ const m2 = JSON.parse(readFileSync102(join84(dir, "himalaya.content.json"), "utf8"));
178398
178985
  if (m2.name) return m2.name;
178399
178986
  } catch {
178400
178987
  }
@@ -178402,8 +178989,8 @@ async function appId(dir) {
178402
178989
  }
178403
178990
  async function contentVisibility(dir) {
178404
178991
  try {
178405
- const { readFileSync: readFileSync101 } = await import("node:fs");
178406
- const m2 = JSON.parse(readFileSync101(join84(dir, "himalaya.content.json"), "utf8"));
178992
+ const { readFileSync: readFileSync102 } = await import("node:fs");
178993
+ const m2 = JSON.parse(readFileSync102(join84(dir, "himalaya.content.json"), "utf8"));
178407
178994
  if (m2.visibility === "public" || m2.visibility === "unlisted") return m2.visibility;
178408
178995
  } catch {
178409
178996
  }
@@ -178897,7 +179484,7 @@ async function producedWidgetFamilies(dir) {
178897
179484
  let js2;
178898
179485
  for (const candidate of [`${name}.bundle.js`, `${name}.js`, name]) {
178899
179486
  try {
178900
- js2 = readFileSync100(join84(outDir, candidate), "utf8");
179487
+ js2 = readFileSync101(join84(outDir, candidate), "utf8");
178901
179488
  break;
178902
179489
  } catch {
178903
179490
  }
@@ -179467,13 +180054,13 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
179467
180054
  if (adding) {
179468
180055
  const from = str9(flags.from);
179469
180056
  if (!from) throw new TrimRefusal2('--add <id> needs --from <file> holding the whole new SCREENS entry (` "<id>": { "screenId": "<id>", \u2026 },`)');
179470
- print(adopt.addScreen(dir, adding, readFileSync100(from, "utf8"), { parent: str9(flags.parent), tab: str9(flags.tab), displayName: str9(flags["display-name"]) }));
180057
+ print(adopt.addScreen(dir, adding, readFileSync101(from, "utf8"), { parent: str9(flags.parent), tab: str9(flags.tab), displayName: str9(flags["display-name"]) }));
179471
180058
  return 0;
179472
180059
  }
179473
180060
  if (target) {
179474
180061
  const from = str9(flags.from);
179475
180062
  if (!from) throw new TrimRefusal2("--write <id> needs --from <file> holding the whole entry, as --show prints it");
179476
- print(adopt.replaceScreen(dir, target, readFileSync100(from, "utf8")));
180063
+ print(adopt.replaceScreen(dir, target, readFileSync101(from, "utf8")));
179477
180064
  return 0;
179478
180065
  }
179479
180066
  if (show) {
@@ -179625,7 +180212,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
179625
180212
  const sourceDir = resolve61(str9(flags["source-dir"]) ?? appDir3);
179626
180213
  let meta;
179627
180214
  try {
179628
- meta = JSON.parse(readFileSync100(join84(sourceDir, TEMPLATE_META_FILE), "utf8"));
180215
+ meta = JSON.parse(readFileSync101(join84(sourceDir, TEMPLATE_META_FILE), "utf8"));
179629
180216
  } catch {
179630
180217
  io2.error(JSON.stringify({ error: `no ${TEMPLATE_META_FILE} in ${sourceDir} \u2014 a template must declare { title, description, tags } to be published`, hint: `add ${TEMPLATE_META_FILE} next to himalaya.content.json (or pass --source-dir <dir>)` }));
179631
180218
  return 2;
@@ -179635,7 +180222,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
179635
180222
  return 2;
179636
180223
  }
179637
180224
  try {
179638
- const appearance = extractTemplateAppearance(JSON.parse(readFileSync100(join84(sourceDir, "tokens.json"), "utf8")));
180225
+ const appearance = extractTemplateAppearance(JSON.parse(readFileSync101(join84(sourceDir, "tokens.json"), "utf8")));
179639
180226
  meta = { ...appearance, ...meta };
179640
180227
  } catch {
179641
180228
  }
@@ -179714,9 +180301,9 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
179714
180301
  let iconHash;
179715
180302
  if (iconPath) {
179716
180303
  try {
179717
- const bytes2 = readFileSync100(iconPath);
180304
+ const bytes2 = readFileSync101(iconPath);
179718
180305
  payload.icon = bytes2.toString("base64");
179719
- iconHash = createHash41("sha256").update(bytes2).digest("hex");
180306
+ iconHash = createHash42("sha256").update(bytes2).digest("hex");
179720
180307
  } catch {
179721
180308
  }
179722
180309
  }
@@ -179927,16 +180514,16 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
179927
180514
  return 2;
179928
180515
  }
179929
180516
  const { readdirSync: readdirSync36, existsSync: fileExists } = await import("node:fs");
179930
- const { join: pathJoin } = await import("node:path");
180517
+ const { join: pathJoin3 } = await import("node:path");
179931
180518
  const targets = [];
179932
- const t5 = pathJoin(dir, "tier5-src");
180519
+ const t5 = pathJoin3(dir, "tier5-src");
179933
180520
  if (fileExists(t5)) {
179934
180521
  for (const d2 of readdirSync36(t5, { withFileTypes: true })) {
179935
- if (d2.isDirectory()) targets.push(pathJoin(t5, d2.name, "index.ts"));
180522
+ if (d2.isDirectory()) targets.push(pathJoin3(t5, d2.name, "index.ts"));
179936
180523
  }
179937
180524
  }
179938
180525
  for (const f2 of ["dev/index.ts", "dev/index.tsx"]) {
179939
- const c2 = pathJoin(dir, f2);
180526
+ const c2 = pathJoin3(dir, f2);
179940
180527
  if (fileExists(c2)) targets.push(c2);
179941
180528
  }
179942
180529
  const res = ejectModule2({
@@ -180018,7 +180605,7 @@ ${doNow.map((l2) => ` ${l2}`).join("\n")}`);
180018
180605
  const path2 = dpxSessionTokenPath();
180019
180606
  let raw;
180020
180607
  try {
180021
- raw = readFileSync100(path2, "utf8");
180608
+ raw = readFileSync101(path2, "utf8");
180022
180609
  } catch {
180023
180610
  throw new Error(`no DPX BO session at ${path2}; run dpx auth login, write dpx auth token to that path, then himi login --dpx --target bo`);
180024
180611
  }
@@ -180875,7 +181462,7 @@ ${[...afterRun.next, ...testReminder ? [testReminder] : []].join("\n")}`);
180875
181462
  return 2;
180876
181463
  }
180877
181464
  try {
180878
- const raw = stateArg.trim().startsWith("{") ? stateArg : readFileSync100(stateArg.replace(/^@/, ""), "utf8");
181465
+ const raw = stateArg.trim().startsWith("{") ? stateArg : readFileSync101(stateArg.replace(/^@/, ""), "utf8");
180879
181466
  injectedState = JSON.parse(raw);
180880
181467
  } catch (e2) {
180881
181468
  io2.error(JSON.stringify({ error: `--state must be inline JSON or a path to a .json file \u2014 ${e2.message}` }));
@@ -180890,7 +181477,7 @@ ${[...afterRun.next, ...testReminder ? [testReminder] : []].join("\n")}`);
180890
181477
  return 2;
180891
181478
  }
180892
181479
  try {
180893
- const raw = inputArg.trim().startsWith("{") ? inputArg : readFileSync100(inputArg.replace(/^@/, ""), "utf8");
181480
+ const raw = inputArg.trim().startsWith("{") ? inputArg : readFileSync101(inputArg.replace(/^@/, ""), "utf8");
180894
181481
  const parsed = JSON.parse(raw);
180895
181482
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("must be a JSON object");
180896
181483
  injectedInput = parsed;
@@ -181575,7 +182162,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
181575
182162
  let localSourceHash;
181576
182163
  try {
181577
182164
  const { collectAppSource: collectAppSource2, zipAppSource: zipAppSource2 } = await Promise.resolve().then(() => (init_app_source(), app_source_exports));
181578
- localSourceHash = createHash41("sha256").update(zipAppSource2(collectAppSource2(dir).entries).toString("base64")).digest("hex");
182165
+ localSourceHash = createHash42("sha256").update(zipAppSource2(collectAppSource2(dir).entries).toString("base64")).digest("hex");
181579
182166
  } catch {
181580
182167
  }
181581
182168
  return runReleasePatch({
@@ -182259,7 +182846,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
182259
182846
  }));
182260
182847
  return 1;
182261
182848
  }
182262
- const archive = readFileSync100(resolve61(file2));
182849
+ const archive = readFileSync101(resolve61(file2));
182263
182850
  const result = await client2().createPackageShare({
182264
182851
  app: opened.header.app,
182265
182852
  releaseId: opened.header.releaseId,
@@ -182465,7 +183052,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
182465
183052
  if (watchKit && bus) {
182466
183053
  const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2, bundleOutDir: bundleOutDir2 } = await loadAuthoring();
182467
183054
  const live3 = join84(running.releaseRoot, running.app);
182468
- const manifestOf = (tree) => JSON.parse(readFileSync100(join84(tree, "release-manifest.json"), "utf8"));
183055
+ const manifestOf = (tree) => JSON.parse(readFileSync101(join84(tree, "release-manifest.json"), "utf8"));
182469
183056
  let current = manifestOf(live3);
182470
183057
  const failed3 = async (message) => {
182471
183058
  if (stopping) return;
@@ -183185,7 +183772,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
183185
183772
  lintNote: "`himi patch` sends a raw file. Nothing here built or linted your app \u2014 `himi push --only <selector>` is the same edit with the full lint gate in front of it."
183186
183773
  };
183187
183774
  if (kind === "tokens" || kind === "app-config") {
183188
- const body = readFileSync100(file2, "utf8");
183775
+ const body = readFileSync101(file2, "utf8");
183189
183776
  const patch2 = kind === "tokens" ? { tokens: body } : { appConfig: body };
183190
183777
  return runReleasePatch({
183191
183778
  ...common,
@@ -183200,7 +183787,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
183200
183787
  io2.error(JSON.stringify({ error: "patch screen needs a <screenId>", usage: PATCH_USAGE }));
183201
183788
  return 2;
183202
183789
  }
183203
- const descriptor = readFileSync100(file2, "utf8");
183790
+ const descriptor = readFileSync101(file2, "utf8");
183204
183791
  try {
183205
183792
  JSON.parse(descriptor);
183206
183793
  } catch (e2) {
@@ -183240,8 +183827,8 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
183240
183827
  extra: { kind, screen: id, file: { path: file2, bytes: Buffer.byteLength(descriptor, "utf8") } }
183241
183828
  });
183242
183829
  }
183243
- const bytes2 = readFileSync100(file2);
183244
- const sha2 = createHash41("sha256").update(bytes2).digest("hex");
183830
+ const bytes2 = readFileSync101(file2);
183831
+ const sha2 = createHash42("sha256").update(bytes2).digest("hex");
183245
183832
  const forScreens = (str9(flags["for-screen"]) ?? "").split(",").map((s2) => s2.trim()).filter(Boolean);
183246
183833
  if (flags["no-rebind"] !== void 0 && flags["no-rebind"] !== true) {
183247
183834
  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 }));
@@ -183384,7 +183971,7 @@ default (no --glyph): ${DEFAULT_GLYPH2} \u2014 a mark that claims nothing, so th
183384
183971
  }
183385
183972
  let def;
183386
183973
  try {
183387
- const parsed = JSON.parse(arg.startsWith("@") ? readFileSync100(arg.slice(1), "utf8") : arg);
183974
+ const parsed = JSON.parse(arg.startsWith("@") ? readFileSync101(arg.slice(1), "utf8") : arg);
183388
183975
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
183389
183976
  io2.error(JSON.stringify({ error: "invalid_definition", problems: [`--definition must be a JSON object, got ${Array.isArray(parsed) ? "an array" : parsed === null ? "null" : typeof parsed}`] }));
183390
183977
  return 2;
@@ -184246,7 +184833,7 @@ ${label2}`);
184246
184833
  const dpxPath = dpxSessionTokenPath();
184247
184834
  let dpx;
184248
184835
  try {
184249
- dpx = readFileSync100(dpxPath, "utf8").trim();
184836
+ dpx = readFileSync101(dpxPath, "utf8").trim();
184250
184837
  } catch {
184251
184838
  io2.error(JSON.stringify({ error: `no dpx session at ${dpxPath} \u2014 run \`dpx auth login\` then \`dpx auth token > ${dpxPath}\` (dpx 2.x keeps its own state in ~/.dpx/auth.json and does NOT write the legacy session file), or omit --dpx` }));
184252
184839
  return 1;
@@ -184709,7 +185296,7 @@ ${report3.ok ? "OK \u2014 data + serve plane reachable." : typeof report3.hint =
184709
185296
  const path2 = dpxSessionTokenPath();
184710
185297
  let raw;
184711
185298
  try {
184712
- raw = readFileSync100(path2, "utf8");
185299
+ raw = readFileSync101(path2, "utf8");
184713
185300
  } catch {
184714
185301
  io2.error(JSON.stringify({ error: `no DPX BO session at ${path2}` }));
184715
185302
  return 1;