@wix/himalaya-cli 0.1745.0 → 0.1746.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
@@ -11107,8 +11107,8 @@ function tsExtResolvePlugin() {
11107
11107
  setup(b3) {
11108
11108
  b3.onResolve({ filter: /\.js$/ }, (args) => {
11109
11109
  if (args.kind === "entry-point" || !args.path.startsWith(".")) return void 0;
11110
- const ts30 = resolve10(args.resolveDir, args.path.replace(/\.js$/, ".ts"));
11111
- return existsSync12(ts30) ? { path: ts30 } : void 0;
11110
+ const ts31 = resolve10(args.resolveDir, args.path.replace(/\.js$/, ".ts"));
11111
+ return existsSync12(ts31) ? { path: ts31 } : void 0;
11112
11112
  });
11113
11113
  }
11114
11114
  };
@@ -11897,7 +11897,7 @@ function bundleFor(file2) {
11897
11897
  const match = /^tier5-src\/([^/]+)\//.exec(file2);
11898
11898
  return match?.[1] ?? "_shared";
11899
11899
  }
11900
- function toIssue(ts30, contentDir2, diagnostic) {
11900
+ function toIssue(ts31, contentDir2, diagnostic) {
11901
11901
  const file2 = diagnostic.file ? relativeFile(contentDir2, diagnostic.file.fileName) : void 0;
11902
11902
  const position = diagnostic.file && diagnostic.start !== void 0 ? diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : void 0;
11903
11903
  return {
@@ -11905,13 +11905,13 @@ function toIssue(ts30, contentDir2, diagnostic) {
11905
11905
  ...file2 ? { file: file2 } : {},
11906
11906
  ...position ? { line: position.line + 1, column: position.character + 1 } : {},
11907
11907
  code: `TS${diagnostic.code}`,
11908
- message: ts30.flattenDiagnosticMessageText(diagnostic.messageText, "\n")
11908
+ message: ts31.flattenDiagnosticMessageText(diagnostic.messageText, "\n")
11909
11909
  };
11910
11910
  }
11911
- function confinedHost(ts30, contentDir2, options2) {
11911
+ function confinedHost(ts31, contentDir2, options2) {
11912
11912
  if (!buildConfinementRequired()) return void 0;
11913
- const host = ts30.createCompilerHost(options2);
11914
- const libDir = resolve12(ts30.getDefaultLibFilePath(options2), "..");
11913
+ const host = ts31.createCompilerHost(options2);
11914
+ const libDir = resolve12(ts31.getDefaultLibFilePath(options2), "..");
11915
11915
  const allows = confinementMatcher(contentDir2, [libDir]);
11916
11916
  const getSourceFile = host.getSourceFile.bind(host);
11917
11917
  const readFile21 = host.readFile.bind(host);
@@ -11940,7 +11940,7 @@ function confinedHost(ts30, contentDir2, options2) {
11940
11940
  }
11941
11941
  async function typecheckContentWorkers(contentDir2, options2) {
11942
11942
  if (!existsSync13(resolve12(contentDir2, "tier5-src"))) return [];
11943
- const ts30 = await compiler2();
11943
+ const ts31 = await compiler2();
11944
11944
  const config = {
11945
11945
  compilerOptions: {
11946
11946
  ...CONTENT_WORKER_COMPILER_OPTIONS,
@@ -11950,18 +11950,18 @@ async function typecheckContentWorkers(contentDir2, options2) {
11950
11950
  // The deployed authoring runtime stages TypeScript 6, which requires an explicit
11951
11951
  // acknowledgement for this compatibility `baseUrl`; the repository's TypeScript 5 lane
11952
11952
  // rejects that 6.0 value, so keep it specific to the compiler that needs it.
11953
- ...Number.parseInt(ts30.versionMajorMinor, 10) >= 6 ? { ignoreDeprecations: "6.0" } : {}
11953
+ ...Number.parseInt(ts31.versionMajorMinor, 10) >= 6 ? { ignoreDeprecations: "6.0" } : {}
11954
11954
  },
11955
11955
  include: ["tier5-src/*/index.ts", "tier5-src/_shared/**/*.ts"]
11956
11956
  };
11957
- const parsed = ts30.parseJsonConfigFileContent(config, ts30.sys, contentDir2);
11957
+ const parsed = ts31.parseJsonConfigFileContent(config, ts31.sys, contentDir2);
11958
11958
  if (parsed.fileNames.length === 0) return [];
11959
- const program = ts30.createProgram({
11959
+ const program = ts31.createProgram({
11960
11960
  rootNames: parsed.fileNames,
11961
11961
  options: parsed.options,
11962
- host: confinedHost(ts30, contentDir2, parsed.options)
11962
+ host: confinedHost(ts31, contentDir2, parsed.options)
11963
11963
  });
11964
- return [...parsed.errors, ...ts30.getPreEmitDiagnostics(program)].filter((diagnostic) => diagnostic.category === ts30.DiagnosticCategory.Error && belongsToContentWorkers(contentDir2, diagnostic)).map((diagnostic) => toIssue(ts30, contentDir2, diagnostic));
11964
+ return [...parsed.errors, ...ts31.getPreEmitDiagnostics(program)].filter((diagnostic) => diagnostic.category === ts31.DiagnosticCategory.Error && belongsToContentWorkers(contentDir2, diagnostic)).map((diagnostic) => toIssue(ts31, contentDir2, diagnostic));
11965
11965
  }
11966
11966
  var compilerPromise;
11967
11967
  var init_tier5_typecheck = __esm({
@@ -25296,22 +25296,22 @@ var init_pixels = __esm({
25296
25296
  });
25297
25297
 
25298
25298
  // ../../core/dev-server/src/declared-navigation-ast.ts
25299
- function fixedNavigations(bundleJs, ts30) {
25300
- literalTargets(bundleJs, ts30);
25299
+ function fixedNavigations(bundleJs, ts31) {
25300
+ literalTargets(bundleJs, ts31);
25301
25301
  return fixedCache.get(bundleJs) ?? /* @__PURE__ */ new Map();
25302
25302
  }
25303
- function literalTargets(bundleJs, ts30) {
25304
- const name = (n2) => n2 && (ts30.isIdentifier(n2) || ts30.isStringLiteral(n2) || ts30.isNoSubstitutionTemplateLiteral(n2)) ? n2.text : void 0;
25303
+ function literalTargets(bundleJs, ts31) {
25304
+ const name = (n2) => n2 && (ts31.isIdentifier(n2) || ts31.isStringLiteral(n2) || ts31.isNoSubstitutionTemplateLiteral(n2)) ? n2.text : void 0;
25305
25305
  const object16 = (n2) => {
25306
- while (n2 && ts30.isParenthesizedExpression(n2)) n2 = n2.expression;
25307
- return n2 && ts30.isObjectLiteralExpression(n2) ? n2 : void 0;
25306
+ while (n2 && ts31.isParenthesizedExpression(n2)) n2 = n2.expression;
25307
+ return n2 && ts31.isObjectLiteralExpression(n2) ? n2 : void 0;
25308
25308
  };
25309
25309
  const property3 = (o2, key4) => o2?.properties.find((p2) => name(p2.name) === key4);
25310
- const initializer = (p2) => p2 && ts30.isPropertyAssignment(p2) ? p2.initializer : void 0;
25311
- const callable = (n2) => !!n2 && (ts30.isArrowFunction(n2) || ts30.isFunctionExpression(n2) || ts30.isFunctionDeclaration(n2) || ts30.isMethodDeclaration(n2));
25310
+ const initializer = (p2) => p2 && ts31.isPropertyAssignment(p2) ? p2.initializer : void 0;
25311
+ const callable = (n2) => !!n2 && (ts31.isArrowFunction(n2) || ts31.isFunctionExpression(n2) || ts31.isFunctionDeclaration(n2) || ts31.isMethodDeclaration(n2));
25312
25312
  const cached3 = cache.get(bundleJs);
25313
25313
  if (cached3) return cached3;
25314
- const file2 = ts30.createSourceFile("himi-bundle.js", bundleJs, ts30.ScriptTarget.Latest, true, ts30.ScriptKind.JS);
25314
+ const file2 = ts31.createSourceFile("himi-bundle.js", bundleJs, ts31.ScriptTarget.Latest, true, ts31.ScriptKind.JS);
25315
25315
  const symbols = /* @__PURE__ */ new Map();
25316
25316
  const note = (key4, fn2) => {
25317
25317
  if (!key4) return;
@@ -25319,16 +25319,16 @@ function literalTargets(bundleJs, ts30) {
25319
25319
  symbols.set(key4, { count: (prior?.count ?? 0) + 1, fn: fn2 });
25320
25320
  };
25321
25321
  const declarations = (node3) => {
25322
- if (ts30.isFunctionDeclaration(node3)) note(name(node3.name), node3);
25323
- else if (ts30.isVariableDeclaration(node3)) note(name(node3.name), callable(node3.initializer) ? node3.initializer : void 0);
25324
- else if (ts30.isParameter(node3)) note(name(node3.name));
25325
- else if (ts30.isBindingElement(node3)) note(name(node3.name));
25326
- ts30.forEachChild(node3, declarations);
25322
+ if (ts31.isFunctionDeclaration(node3)) note(name(node3.name), node3);
25323
+ else if (ts31.isVariableDeclaration(node3)) note(name(node3.name), callable(node3.initializer) ? node3.initializer : void 0);
25324
+ else if (ts31.isParameter(node3)) note(name(node3.name));
25325
+ else if (ts31.isBindingElement(node3)) note(name(node3.name));
25326
+ ts31.forEachChild(node3, declarations);
25327
25327
  };
25328
25328
  declarations(file2);
25329
25329
  const resolve118 = (node3) => {
25330
25330
  if (callable(node3)) return node3;
25331
- if (node3 && ts30.isIdentifier(node3)) {
25331
+ if (node3 && ts31.isIdentifier(node3)) {
25332
25332
  const symbol = symbols.get(node3.text);
25333
25333
  if (symbol?.count === 1) return symbol.fn;
25334
25334
  }
@@ -25342,9 +25342,9 @@ function literalTargets(bundleJs, ts30) {
25342
25342
  const nav = {};
25343
25343
  for (const p2 of o2.properties) {
25344
25344
  const key4 = name(p2.name);
25345
- if (!ts30.isPropertyAssignment(p2) || !key4 || !NAV_KEYS.has(key4)) return void 0;
25346
- if (ts30.isStringLiteralLike(p2.initializer) && p2.initializer.text) nav[key4] = p2.initializer.text;
25347
- else if (key4 === "reset" && p2.initializer.kind === ts30.SyntaxKind.TrueKeyword) nav[key4] = true;
25345
+ if (!ts31.isPropertyAssignment(p2) || !key4 || !NAV_KEYS.has(key4)) return void 0;
25346
+ if (ts31.isStringLiteralLike(p2.initializer) && p2.initializer.text) nav[key4] = p2.initializer.text;
25347
+ else if (key4 === "reset" && p2.initializer.kind === ts31.SyntaxKind.TrueKeyword) nav[key4] = true;
25348
25348
  else return void 0;
25349
25349
  }
25350
25350
  const { screenId, presentation, tab, reset } = nav;
@@ -25355,75 +25355,75 @@ function literalTargets(bundleJs, ts30) {
25355
25355
  };
25356
25356
  const assigned = /* @__PURE__ */ new Set();
25357
25357
  const assignedNames = (n2) => {
25358
- if (ts30.isIdentifier(n2)) assigned.add(n2.text);
25359
- else ts30.forEachChild(n2, assignedNames);
25358
+ if (ts31.isIdentifier(n2)) assigned.add(n2.text);
25359
+ else ts31.forEachChild(n2, assignedNames);
25360
25360
  };
25361
25361
  const assignments = (n2) => {
25362
- if (ts30.isBinaryExpression(n2) && n2.operatorToken.kind >= ts30.SyntaxKind.FirstAssignment && n2.operatorToken.kind <= ts30.SyntaxKind.LastAssignment) assignedNames(n2.left);
25363
- else if ((ts30.isPrefixUnaryExpression(n2) || ts30.isPostfixUnaryExpression(n2)) && (n2.operator === ts30.SyntaxKind.PlusPlusToken || n2.operator === ts30.SyntaxKind.MinusMinusToken)) assignedNames(n2.operand);
25364
- else if ((ts30.isForOfStatement(n2) || ts30.isForInStatement(n2)) && !ts30.isVariableDeclarationList(n2.initializer)) assignedNames(n2.initializer);
25365
- ts30.forEachChild(n2, assignments);
25362
+ if (ts31.isBinaryExpression(n2) && n2.operatorToken.kind >= ts31.SyntaxKind.FirstAssignment && n2.operatorToken.kind <= ts31.SyntaxKind.LastAssignment) assignedNames(n2.left);
25363
+ else if ((ts31.isPrefixUnaryExpression(n2) || ts31.isPostfixUnaryExpression(n2)) && (n2.operator === ts31.SyntaxKind.PlusPlusToken || n2.operator === ts31.SyntaxKind.MinusMinusToken)) assignedNames(n2.operand);
25364
+ else if ((ts31.isForOfStatement(n2) || ts31.isForInStatement(n2)) && !ts31.isVariableDeclarationList(n2.initializer)) assignedNames(n2.initializer);
25365
+ ts31.forEachChild(n2, assignments);
25366
25366
  };
25367
25367
  assignments(file2);
25368
25368
  const plain3 = (fn2) => {
25369
- const modifiers = ts30.canHaveModifiers(fn2) ? ts30.getModifiers(fn2) ?? [] : [];
25370
- return !fn2.asteriskToken && !modifiers.some((m2) => m2.kind === ts30.SyntaxKind.AsyncKeyword);
25369
+ const modifiers = ts31.canHaveModifiers(fn2) ? ts31.getModifiers(fn2) ?? [] : [];
25370
+ return !fn2.asteriskToken && !modifiers.some((m2) => m2.kind === ts31.SyntaxKind.AsyncKeyword);
25371
25371
  };
25372
25372
  const plainParams = (fn2) => {
25373
25373
  const names2 = /* @__PURE__ */ new Set();
25374
25374
  for (const p2 of fn2.parameters) {
25375
- if (!ts30.isIdentifier(p2.name) || p2.initializer || p2.dotDotDotToken) return void 0;
25375
+ if (!ts31.isIdentifier(p2.name) || p2.initializer || p2.dotDotDotToken) return void 0;
25376
25376
  names2.add(p2.name.text);
25377
25377
  }
25378
25378
  return names2;
25379
25379
  };
25380
25380
  const provenSafe = (expr, params) => {
25381
- while (ts30.isParenthesizedExpression(expr)) expr = expr.expression;
25382
- if (ts30.isStringLiteral(expr) || ts30.isNoSubstitutionTemplateLiteral(expr) || ts30.isNumericLiteral(expr)) return true;
25383
- if (expr.kind === ts30.SyntaxKind.TrueKeyword || expr.kind === ts30.SyntaxKind.FalseKeyword || expr.kind === ts30.SyntaxKind.NullKeyword) return true;
25384
- if (ts30.isIdentifier(expr)) return params.has(expr.text);
25385
- if (ts30.isArrayLiteralExpression(expr)) {
25386
- return expr.elements.every((e2) => !ts30.isSpreadElement(e2) && !ts30.isOmittedExpression(e2) && provenSafe(e2, params));
25387
- }
25388
- if (ts30.isObjectLiteralExpression(expr)) return expr.properties.every((p2) => safeProperty(p2, params));
25381
+ while (ts31.isParenthesizedExpression(expr)) expr = expr.expression;
25382
+ if (ts31.isStringLiteral(expr) || ts31.isNoSubstitutionTemplateLiteral(expr) || ts31.isNumericLiteral(expr)) return true;
25383
+ if (expr.kind === ts31.SyntaxKind.TrueKeyword || expr.kind === ts31.SyntaxKind.FalseKeyword || expr.kind === ts31.SyntaxKind.NullKeyword) return true;
25384
+ if (ts31.isIdentifier(expr)) return params.has(expr.text);
25385
+ if (ts31.isArrayLiteralExpression(expr)) {
25386
+ return expr.elements.every((e2) => !ts31.isSpreadElement(e2) && !ts31.isOmittedExpression(e2) && provenSafe(e2, params));
25387
+ }
25388
+ if (ts31.isObjectLiteralExpression(expr)) return expr.properties.every((p2) => safeProperty(p2, params));
25389
25389
  return false;
25390
25390
  };
25391
25391
  const safeProperty = (p2, params) => {
25392
- if (ts30.isSpreadAssignment(p2)) return provenSafe(p2.expression, params);
25393
- if (ts30.isPropertyAssignment(p2)) return !ts30.isComputedPropertyName(p2.name) && provenSafe(p2.initializer, params);
25394
- if (ts30.isShorthandPropertyAssignment(p2)) return params.has(p2.name.text) && !p2.objectAssignmentInitializer;
25392
+ if (ts31.isSpreadAssignment(p2)) return provenSafe(p2.expression, params);
25393
+ if (ts31.isPropertyAssignment(p2)) return !ts31.isComputedPropertyName(p2.name) && provenSafe(p2.initializer, params);
25394
+ if (ts31.isShorthandPropertyAssignment(p2)) return params.has(p2.name.text) && !p2.objectAssignmentInitializer;
25395
25395
  return false;
25396
25396
  };
25397
25397
  const isNavigateHelper = (callee) => {
25398
- if (!ts30.isIdentifier(callee) || !/^navigate[0-9]*$/.test(callee.text) || assigned.has(callee.text)) return false;
25398
+ if (!ts31.isIdentifier(callee) || !/^navigate[0-9]*$/.test(callee.text) || assigned.has(callee.text)) return false;
25399
25399
  const symbol = symbols.get(callee.text);
25400
25400
  const helper = symbol?.count === 1 ? symbol.fn : void 0;
25401
25401
  if (!helper?.body || !plain3(helper) || helper.parameters.length !== 2 || !plainParams(helper)) return false;
25402
25402
  const [stateParam, navParam] = helper.parameters.map((p2) => name(p2.name));
25403
- const body = ts30.isBlock(helper.body) ? helper.body.statements.length === 1 && ts30.isReturnStatement(helper.body.statements[0]) ? helper.body.statements[0].expression : void 0 : helper.body;
25403
+ const body = ts31.isBlock(helper.body) ? helper.body.statements.length === 1 && ts31.isReturnStatement(helper.body.statements[0]) ? helper.body.statements[0].expression : void 0 : helper.body;
25404
25404
  const o2 = object16(body);
25405
25405
  if (!o2 || o2.properties.length !== 2 || !stateParam || !navParam) return false;
25406
25406
  const [spread, nav] = o2.properties;
25407
- return ts30.isSpreadAssignment(spread) && ts30.isIdentifier(spread.expression) && spread.expression.text === stateParam && ts30.isPropertyAssignment(nav) && name(nav.name) === "_nav" && ts30.isIdentifier(nav.initializer) && nav.initializer.text === navParam;
25407
+ return ts31.isSpreadAssignment(spread) && ts31.isIdentifier(spread.expression) && spread.expression.text === stateParam && ts31.isPropertyAssignment(nav) && name(nav.name) === "_nav" && ts31.isIdentifier(nav.initializer) && nav.initializer.text === navParam;
25408
25408
  };
25409
25409
  const fixedOf = (fn2) => {
25410
25410
  const params = plainParams(fn2);
25411
25411
  if (!fn2.body || !plain3(fn2) || !params) return void 0;
25412
25412
  let result = void 0;
25413
- if (ts30.isBlock(fn2.body)) {
25413
+ if (ts31.isBlock(fn2.body)) {
25414
25414
  const [only, ...rest] = fn2.body.statements;
25415
- if (!only || rest.length > 0 || !ts30.isReturnStatement(only)) return void 0;
25415
+ if (!only || rest.length > 0 || !ts31.isReturnStatement(only)) return void 0;
25416
25416
  result = only.expression;
25417
25417
  } else result = fn2.body;
25418
- while (result && ts30.isParenthesizedExpression(result)) result = result.expression;
25418
+ while (result && ts31.isParenthesizedExpression(result)) result = result.expression;
25419
25419
  let navNode;
25420
- if (result && ts30.isObjectLiteralExpression(result)) {
25420
+ if (result && ts31.isObjectLiteralExpression(result)) {
25421
25421
  const props2 = result.properties;
25422
25422
  const lastProp = props2[props2.length - 1];
25423
- if (!lastProp || !ts30.isPropertyAssignment(lastProp) || ts30.isComputedPropertyName(lastProp.name) || name(lastProp.name) !== "_nav") return void 0;
25423
+ if (!lastProp || !ts31.isPropertyAssignment(lastProp) || ts31.isComputedPropertyName(lastProp.name) || name(lastProp.name) !== "_nav") return void 0;
25424
25424
  if (!props2.slice(0, -1).every((p2) => safeProperty(p2, params))) return void 0;
25425
25425
  navNode = lastProp.initializer;
25426
- } else if (result && ts30.isCallExpression(result) && result.arguments.length === 2 && isNavigateHelper(result.expression)) {
25426
+ } else if (result && ts31.isCallExpression(result) && result.arguments.length === 2 && isNavigateHelper(result.expression)) {
25427
25427
  if (!provenSafe(result.arguments[0], params)) return void 0;
25428
25428
  navNode = result.arguments[1];
25429
25429
  }
@@ -25433,58 +25433,58 @@ function literalTargets(bundleJs, ts30) {
25433
25433
  return { nav, line: position.line + 1, column: position.character };
25434
25434
  };
25435
25435
  const visit = (node3) => {
25436
- if (ts30.isCallExpression(node3)) {
25437
- const callee = ts30.isPropertyAccessExpression(node3.expression) ? node3.expression.name.text : name(node3.expression);
25436
+ if (ts31.isCallExpression(node3)) {
25437
+ const callee = ts31.isPropertyAccessExpression(node3.expression) ? node3.expression.name.text : name(node3.expression);
25438
25438
  const service = node3.arguments[0];
25439
- if (callee && /^defineService[0-9]*$/.test(callee) && service && ts30.isStringLiteralLike(service)) {
25439
+ if (callee && /^defineService[0-9]*$/.test(callee) && service && ts31.isStringLiteralLike(service)) {
25440
25440
  const actions = object16(initializer(property3(object16(node3.arguments[1]), "actions")));
25441
25441
  for (const member of actions?.properties ?? []) {
25442
25442
  const action = name(member.name);
25443
- const fn2 = ts30.isMethodDeclaration(member) ? member : resolve118(ts30.isShorthandPropertyAssignment(member) ? member.name : initializer(member));
25443
+ const fn2 = ts31.isMethodDeclaration(member) ? member : resolve118(ts31.isShorthandPropertyAssignment(member) ? member.name : initializer(member));
25444
25444
  if (!action || !fn2?.body) continue;
25445
25445
  const targets = [];
25446
25446
  const target = (expr) => {
25447
25447
  const sid = initializer(property3(object16(expr), "screenId"));
25448
- if (!sid || !ts30.isStringLiteralLike(sid)) return;
25448
+ if (!sid || !ts31.isStringLiteralLike(sid)) return;
25449
25449
  const position = file2.getLineAndCharacterOfPosition(sid.getStart(file2));
25450
25450
  targets.push({ screenId: sid.text, line: position.line + 1, column: position.character });
25451
25451
  };
25452
25452
  const returned = (expr) => {
25453
25453
  if (!expr) return;
25454
- if (ts30.isParenthesizedExpression(expr) || ts30.isAwaitExpression(expr)) {
25454
+ if (ts31.isParenthesizedExpression(expr) || ts31.isAwaitExpression(expr)) {
25455
25455
  returned(expr.expression);
25456
25456
  return;
25457
25457
  }
25458
- if (ts30.isConditionalExpression(expr)) {
25458
+ if (ts31.isConditionalExpression(expr)) {
25459
25459
  returned(expr.whenTrue);
25460
25460
  returned(expr.whenFalse);
25461
25461
  return;
25462
25462
  }
25463
- if (ts30.isObjectLiteralExpression(expr)) {
25463
+ if (ts31.isObjectLiteralExpression(expr)) {
25464
25464
  target(initializer(property3(expr, "_nav")));
25465
25465
  return;
25466
25466
  }
25467
- if (ts30.isCallExpression(expr)) {
25468
- const called = ts30.isPropertyAccessExpression(expr.expression) ? expr.expression.name.text : name(expr.expression);
25467
+ if (ts31.isCallExpression(expr)) {
25468
+ const called = ts31.isPropertyAccessExpression(expr.expression) ? expr.expression.name.text : name(expr.expression);
25469
25469
  if (called && /^navigate[0-9]*$/.test(called)) target(expr.arguments[1]);
25470
25470
  }
25471
25471
  };
25472
- if (ts30.isBlock(fn2.body)) {
25472
+ if (ts31.isBlock(fn2.body)) {
25473
25473
  const returns = (part4) => {
25474
25474
  if (callable(part4)) return;
25475
- if (ts30.isReturnStatement(part4)) returned(part4.expression);
25476
- else ts30.forEachChild(part4, returns);
25475
+ if (ts31.isReturnStatement(part4)) returned(part4.expression);
25476
+ else ts31.forEachChild(part4, returns);
25477
25477
  };
25478
25478
  returns(fn2.body);
25479
25479
  } else returned(fn2.body);
25480
25480
  results.set("tier5." + service.text + "." + action, targets);
25481
- const ref = ts30.isShorthandPropertyAssignment(member) ? member.name : initializer(member);
25482
- const always = ref && ts30.isIdentifier(ref) && assigned.has(ref.text) ? void 0 : fixedOf(fn2);
25481
+ const ref = ts31.isShorthandPropertyAssignment(member) ? member.name : initializer(member);
25482
+ const always = ref && ts31.isIdentifier(ref) && assigned.has(ref.text) ? void 0 : fixedOf(fn2);
25483
25483
  if (always) fixed.set("tier5." + service.text + "." + action, always);
25484
25484
  }
25485
25485
  }
25486
25486
  }
25487
- ts30.forEachChild(node3, visit);
25487
+ ts31.forEachChild(node3, visit);
25488
25488
  };
25489
25489
  visit(file2);
25490
25490
  cache.set(bundleJs, results);
@@ -29443,7 +29443,6 @@ var init_page_worker = __esm({
29443
29443
  var ICON_VIEW_BOX, ICON_STROKE_WIDTH, ICON_FALLBACK, ICON_CATALOG, ICON_NORMALIZED_INDEX, ICON_NAMES;
29444
29444
  var init_icon_catalog_generated = __esm({
29445
29445
  "../../core/ts/src/icon-catalog.generated.ts"() {
29446
- "use strict";
29447
29446
  init_define_HHP_CATALOG();
29448
29447
  ICON_VIEW_BOX = 24;
29449
29448
  ICON_STROKE_WIDTH = 2;
@@ -55933,7 +55932,7 @@ var init_pdf = __esm({
55933
55932
  var defineProperty = Object.defineProperty;
55934
55933
  var stringSlice = uncurryThis("".slice);
55935
55934
  var replace = uncurryThis("".replace);
55936
- var join193 = uncurryThis([].join);
55935
+ var join194 = uncurryThis([].join);
55937
55936
  var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
55938
55937
  return defineProperty(function() {
55939
55938
  }, "length", { value: 8 }).length !== 8;
@@ -55960,7 +55959,7 @@ var init_pdf = __esm({
55960
55959
  }
55961
55960
  var state = enforceInternalState(value2);
55962
55961
  if (!hasOwn(state, "source")) {
55963
- state.source = join193(TEMPLATE, typeof name == "string" ? name : "");
55962
+ state.source = join194(TEMPLATE, typeof name == "string" ? name : "");
55964
55963
  }
55965
55964
  return value2;
55966
55965
  };
@@ -58483,7 +58482,7 @@ var init_pdf = __esm({
58483
58482
  var charAt = uncurryThis("".charAt);
58484
58483
  var Uint8Array2 = globalThis2.Uint8Array;
58485
58484
  var $Array = globalThis2.Array;
58486
- var join193 = uncurryThis([].join);
58485
+ var join194 = uncurryThis([].join);
58487
58486
  var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toBase64 || !(function() {
58488
58487
  try {
58489
58488
  var target = new Uint8Array2();
@@ -58529,7 +58528,7 @@ var init_pdf = __esm({
58529
58528
  result[written++] = "=";
58530
58529
  }
58531
58530
  }
58532
- return join193(result, "");
58531
+ return join194(result, "");
58533
58532
  }
58534
58533
  });
58535
58534
  },
@@ -58541,7 +58540,7 @@ var init_pdf = __esm({
58541
58540
  var anUint8Array = __webpack_require__3(4154);
58542
58541
  var notDetached = __webpack_require__3(5169);
58543
58542
  var numberToString2 = uncurryThis(1.1.toString);
58544
- var join193 = uncurryThis([].join);
58543
+ var join194 = uncurryThis([].join);
58545
58544
  var $Array = Array;
58546
58545
  var Uint8Array2 = globalThis2.Uint8Array;
58547
58546
  var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array2 || !Uint8Array2.prototype.toHex || !(function() {
@@ -58561,7 +58560,7 @@ var init_pdf = __esm({
58561
58560
  var hex2 = numberToString2(this[i2], 16);
58562
58561
  result[i2] = hex2.length === 1 ? "0" + hex2 : hex2;
58563
58562
  }
58564
- return join193(result, "");
58563
+ return join194(result, "");
58565
58564
  }
58566
58565
  });
58567
58566
  },
@@ -156881,9 +156880,9 @@ function stateOf(view) {
156881
156880
  build: b3 && view.live ? { ok: b3.ok, ms: b3.ms, screens: b3.screens, at: b3.at, run: view.live.runId } : null
156882
156881
  };
156883
156882
  }
156884
- function frameFor(state, prev, ts30, v2, key4) {
156885
- if (key4 || !prev) return { ts: ts30, v: v2, key: true, ...state };
156886
- const f2 = { ts: ts30, v: v2 };
156883
+ function frameFor(state, prev, ts31, v2, key4) {
156884
+ if (key4 || !prev) return { ts: ts31, v: v2, key: true, ...state };
156885
+ const f2 = { ts: ts31, v: v2 };
156887
156886
  if (!same2(state.step, prev.step)) f2.step = state.step;
156888
156887
  if (!same2(state.now, prev.now)) f2.now = state.now;
156889
156888
  const screens = {};
@@ -157763,8 +157762,8 @@ function materializeForPreview(appDir3, slug, displayName3) {
157763
157762
  }
157764
157763
  async function appId(dir) {
157765
157764
  try {
157766
- const { readFileSync: readFileSync181 } = await import("node:fs");
157767
- const m2 = JSON.parse(readFileSync181(join41(dir, "himalaya.content.json"), "utf8"));
157765
+ const { readFileSync: readFileSync182 } = await import("node:fs");
157766
+ const m2 = JSON.parse(readFileSync182(join41(dir, "himalaya.content.json"), "utf8"));
157768
157767
  if (m2.name) return m2.name;
157769
157768
  } catch {
157770
157769
  }
@@ -169559,7 +169558,7 @@ function specScreens(spec) {
169559
169558
  const first = line.replace(/^\|/, "").split("|")[0].trim();
169560
169559
  const tick = /^`([^`]+)`/.exec(first);
169561
169560
  const id = tick ? tick[1].trim() : first;
169562
- if (/^screen$/i.test(id)) continue;
169561
+ if (!tick && /^screen$/i.test(id)) continue;
169563
169562
  if (/^[a-z][a-z0-9_]*(?:\[[^\]]*\])?$/.test(id)) out2.push(id.replace(/\[.*$/, ""));
169564
169563
  }
169565
169564
  return [...new Set(out2)];
@@ -171472,15 +171471,15 @@ function loadMemory2(dir) {
171472
171471
  for (const t2 of m2.timeline) {
171473
171472
  if (!isObj3(t2)) continue;
171474
171473
  const file2 = historyName(t2.sha, t2.ext);
171475
- const ts30 = str5(t2.ts);
171474
+ const ts31 = str5(t2.ts);
171476
171475
  const id = str5(t2.id);
171477
- if (file2 && ts30 && id) timeline.push({ ts: ts30, id, file: file2 });
171476
+ if (file2 && ts31 && id) timeline.push({ ts: ts31, id, file: file2 });
171478
171477
  }
171479
171478
  return { createdAt: str5(m2.createdAt), shots, timeline };
171480
171479
  }
171481
- function captionAt(entries, ts30) {
171480
+ function captionAt(entries, ts31) {
171482
171481
  let best = null;
171483
- for (const e2 of entries) if (e2.ts <= ts30) best = e2;
171482
+ for (const e2 of entries) if (e2.ts <= ts31) best = e2;
171484
171483
  return best ? best.message : null;
171485
171484
  }
171486
171485
  function thin(items, max) {
@@ -171600,13 +171599,13 @@ function duration(ms2) {
171600
171599
  const m2 = Math.round(ms2 / 6e4);
171601
171600
  return m2 < 60 ? `${m2} min` : `${Math.floor(m2 / 60)} h ${m2 % 60} min`;
171602
171601
  }
171603
- function utcDay(ts30) {
171604
- const d2 = new Date(ts30);
171602
+ function utcDay(ts31) {
171603
+ const d2 = new Date(ts31);
171605
171604
  return Number.isNaN(d2.getTime()) ? "" : `${d2.toUTCString().slice(0, 16)} (UTC)`;
171606
171605
  }
171607
- function sinceStart(start, ts30) {
171606
+ function sinceStart(start, ts31) {
171608
171607
  if (!start) return "";
171609
- const s5 = Math.max(0, Math.round((Date.parse(ts30) - Date.parse(start)) / 1e3));
171608
+ const s5 = Math.max(0, Math.round((Date.parse(ts31) - Date.parse(start)) / 1e3));
171610
171609
  const h2 = Math.floor(s5 / 3600);
171611
171610
  const m2 = Math.floor(s5 % 3600 / 60);
171612
171611
  const sec = String(s5 % 60).padStart(2, "0");
@@ -171616,7 +171615,7 @@ function renderReel(plan, images) {
171616
171615
  const img = (f2, alt, cls = "") => f2 && images.has(f2) ? `<img class="${cls}" src="${images.get(f2)}" alt="${escapeHtml(alt)}">` : "";
171617
171616
  const count2 = (n2) => escapeHtml(String(Number.isSafeInteger(n2) && n2 >= 0 ? n2 : 0));
171618
171617
  const accent = ACCENT.test(plan.accent) ? plan.accent : DEFAULT_ACCENT;
171619
- const clock = (ts30) => sinceStart(plan.startedAt, ts30);
171618
+ const clock = (ts31) => sinceStart(plan.startedAt, ts31);
171620
171619
  const frames = plan.frames.filter((f2) => images.has(f2.file));
171621
171620
  const flip = frames.length ? `<section class="flip"><div class="phone">${frames.map((f2, i2) => `<img class="fr${i2 === 0 ? " on" : ""}" src="${images.get(f2.file)}" alt="${escapeHtml(plan.focusId ?? "")} at ${clock(f2.ts)}">`).join("")}</div>
171622
171621
  <div class="flipcap"><div class="t" id="ft">${frames[0] ? clock(frames[0].ts) : ""}</div><div id="fc">${escapeHtml(frames[0]?.caption ?? "")}</div><div class="bar"><div id="fb"></div></div></div></section>` : `<p class="muted">No screen versions were recorded \u2014 open the build board with <code>himi studio</code> before building to capture them.</p>`;
@@ -175478,6 +175477,7 @@ var init_glyphs = __esm({
175478
175477
  // ../app-icons/plan.ts
175479
175478
  import { existsSync as existsSync69, readFileSync as readFileSync77, readdirSync as readdirSync36 } from "node:fs";
175480
175479
  import { createHash as createHash33 } from "node:crypto";
175480
+ import { inflateSync } from "node:zlib";
175481
175481
  import { dirname as dirname37, join as join65, resolve as resolve50 } from "node:path";
175482
175482
  function stripComments(src) {
175483
175483
  let out2 = "";
@@ -175651,6 +175651,13 @@ function assertIconContract(app2, cfg) {
175651
175651
  throw new Error(`app-icons: ${app2} icon.glyph must be a lowercase snake_case name. Got "${cfg.glyph}".`);
175652
175652
  }
175653
175653
  }
175654
+ function assertGlyphScale(app2, glyphScale) {
175655
+ if (glyphScale < GLYPH_SCALE_MIN || glyphScale > GLYPH_SCALE_MAX) {
175656
+ throw new Error(
175657
+ `app-icons: ${app2} icon.glyphScale must be between ${GLYPH_SCALE_MIN} and ${GLYPH_SCALE_MAX} (Android masks the foreground layer to a circle, so a larger glyph is clipped). Got ${glyphScale}.`
175658
+ );
175659
+ }
175660
+ }
175654
175661
  function iconSpec(app2, configTs, id, tokensPathOverride) {
175655
175662
  const cfg = parseIconConfig(configTs);
175656
175663
  assertIconContract(app2, cfg);
@@ -175660,12 +175667,15 @@ function iconSpec(app2, configTs, id, tokensPathOverride) {
175660
175667
  if (!existsSync69(abs)) {
175661
175668
  throw new Error(`app-icons: ${app2} declares icon.source "${cfg.source}" but ${abs} does not exist.`);
175662
175669
  }
175670
+ const glyphScale2 = cfg.glyphScale ?? SOURCE_GLYPH_SCALE;
175671
+ assertGlyphScale(app2, glyphScale2);
175672
+ const background2 = cfg.backgroundColor ? resolveToken(app2, cfg.backgroundColor, tokens2) : pngCornerColor(readFileSync77(abs)) ?? SOURCE_FALLBACK_BACKGROUND;
175663
175673
  return {
175664
175674
  sourcePath: abs,
175665
175675
  glyph: GLYPH_NAMES[0],
175666
175676
  accent: "#000000",
175667
- background: "#000000",
175668
- glyphScale: DEFAULT_GLYPH_SCALE,
175677
+ background: background2,
175678
+ glyphScale: glyphScale2,
175669
175679
  derived: false
175670
175680
  };
175671
175681
  }
@@ -175680,11 +175690,7 @@ function iconSpec(app2, configTs, id, tokensPathOverride) {
175680
175690
  const accent = cfg.accentColor ? accentBase : rotateHue(accentBase, deriveHueDelta(id));
175681
175691
  const background = cfg.backgroundColor ? resolveToken(app2, cfg.backgroundColor, tokens2) : accent;
175682
175692
  const glyphScale = cfg.glyphScale ?? DEFAULT_GLYPH_SCALE;
175683
- if (glyphScale < GLYPH_SCALE_MIN || glyphScale > GLYPH_SCALE_MAX) {
175684
- throw new Error(
175685
- `app-icons: ${app2} icon.glyphScale must be between ${GLYPH_SCALE_MIN} and ${GLYPH_SCALE_MAX} (Android masks the foreground layer to a circle, so a larger glyph is clipped). Got ${glyphScale}.`
175686
- );
175687
- }
175693
+ assertGlyphScale(app2, glyphScale);
175688
175694
  return {
175689
175695
  glyph,
175690
175696
  accent,
@@ -175747,6 +175753,56 @@ function fileSha256(path2) {
175747
175753
  return null;
175748
175754
  }
175749
175755
  }
175756
+ function pngSize(png) {
175757
+ const PNG_MAGIC2 = Buffer.from([137, 80, 78, 71]);
175758
+ if (png.length < 24 || !png.subarray(0, 4).equals(PNG_MAGIC2)) {
175759
+ throw new Error("app-icons: not a PNG (bad magic or truncated)");
175760
+ }
175761
+ return { width: png.readUInt32BE(16), height: png.readUInt32BE(20) };
175762
+ }
175763
+ function pngCornerColor(png) {
175764
+ pngSize(png);
175765
+ const bitDepth = png[24];
175766
+ const colorType = png[25];
175767
+ const interlace = png[28];
175768
+ if (interlace !== 0) return null;
175769
+ const channels3 = { 0: 1, 2: 3, 3: 1, 4: 2, 6: 4 }[colorType];
175770
+ if (channels3 === void 0) return null;
175771
+ if (colorType === 3 ? ![1, 2, 4, 8].includes(bitDepth) : bitDepth !== 8) return null;
175772
+ const idat = [];
175773
+ let plte = null;
175774
+ let trns = null;
175775
+ for (let off = 8; off + 8 <= png.length; ) {
175776
+ const len = png.readUInt32BE(off);
175777
+ const type2 = png.toString("latin1", off + 4, off + 8);
175778
+ const data = png.subarray(off + 8, off + 8 + len);
175779
+ if (type2 === "IDAT") idat.push(data);
175780
+ if (type2 === "PLTE") plte = data;
175781
+ if (type2 === "tRNS") trns = data;
175782
+ if (type2 === "IEND") break;
175783
+ off += 12 + len;
175784
+ }
175785
+ let raw;
175786
+ try {
175787
+ raw = inflateSync(Buffer.concat(idat));
175788
+ } catch {
175789
+ return null;
175790
+ }
175791
+ if (raw.length < 1 + channels3) return null;
175792
+ const px = raw.subarray(1, 1 + channels3);
175793
+ let r3, g2, b3, alpha2;
175794
+ if (colorType === 3) {
175795
+ const index = px[0] >> 8 - bitDepth;
175796
+ if (!plte || plte.length < 3 * (index + 1)) return null;
175797
+ [r3, g2, b3] = [plte[3 * index], plte[3 * index + 1], plte[3 * index + 2]];
175798
+ alpha2 = trns && index < trns.length ? trns[index] : 255;
175799
+ } else {
175800
+ [r3, g2, b3] = channels3 >= 3 ? [px[0], px[1], px[2]] : [px[0], px[0], px[0]];
175801
+ alpha2 = channels3 === 4 ? px[3] : channels3 === 2 ? px[1] : 255;
175802
+ }
175803
+ if (alpha2 !== 255) return null;
175804
+ return `#${[r3, g2, b3].map((v2) => v2.toString(16).padStart(2, "0").toUpperCase()).join("")}`;
175805
+ }
175750
175806
  function generationAllowed(app2, configTs, opts = {}) {
175751
175807
  if (opts.force) return { allowed: true, reason: "--force" };
175752
175808
  if (/^ {2}icon\s*[:=]\s*\{/m.test(stripComments(configTs))) {
@@ -175764,7 +175820,7 @@ function generationAllowed(app2, configTs, opts = {}) {
175764
175820
  reason: "ships hand-authored art and declares no icon block (pass --force to re-skin, or add `icon: {}` to config.ts)"
175765
175821
  };
175766
175822
  }
175767
- var DEFAULT_ACCENT_TOKEN, DEFAULT_GLYPH_SCALE, GLYPH_SCALE_MIN, GLYPH_SCALE_MAX, LEGACY_PLACEHOLDER_SHA256;
175823
+ var DEFAULT_ACCENT_TOKEN, DEFAULT_GLYPH_SCALE, GLYPH_SCALE_MIN, GLYPH_SCALE_MAX, SOURCE_GLYPH_SCALE, SOURCE_FALLBACK_BACKGROUND, LEGACY_PLACEHOLDER_SHA256;
175768
175824
  var init_plan2 = __esm({
175769
175825
  "../app-icons/plan.ts"() {
175770
175826
  init_define_HHP_CATALOG();
@@ -175774,6 +175830,8 @@ var init_plan2 = __esm({
175774
175830
  DEFAULT_GLYPH_SCALE = 0.62;
175775
175831
  GLYPH_SCALE_MIN = 0.4;
175776
175832
  GLYPH_SCALE_MAX = 0.9;
175833
+ SOURCE_GLYPH_SCALE = 72 / 108;
175834
+ SOURCE_FALLBACK_BACKGROUND = "#FFFFFF";
175777
175835
  LEGACY_PLACEHOLDER_SHA256 = "d35cccc14f8df24064b7fb575b2ea35c0695813cbebe28ac9bf9856d12dacbf2";
175778
175836
  }
175779
175837
  });
@@ -195244,7 +195302,7 @@ function decodePng(bytes2, what = "image") {
195244
195302
  const stride = Math.ceil(width * bitsPerPixel / 8);
195245
195303
  let inflated;
195246
195304
  try {
195247
- inflated = inflateSync(idat, { maxOutputLength: expected });
195305
+ inflated = inflateSync2(idat, { maxOutputLength: expected });
195248
195306
  } catch (e2) {
195249
195307
  if (e2.code === "ERR_BUFFER_TOO_LARGE")
195250
195308
  throw bad2(what, `the PNG's image data inflates past the ${expected} bytes a ${width}\xD7${height} image holds`);
@@ -195349,12 +195407,12 @@ function encodePng(image, options2) {
195349
195407
  ihdr[9] = options2.alpha ? 6 : 2;
195350
195408
  return Buffer.concat([SIGNATURE, chunk("IHDR", ihdr), chunk("IDAT", deflateSync(filtered, { level: 9 })), chunk("IEND", Buffer.alloc(0))]);
195351
195409
  }
195352
- var crc322, deflateSync, inflateSync, SIGNATURE, CHANNELS, DEPTHS, PNG_MAX_SIDE, PNG_MAX_PIXELS, bad2, scanlineBytes, maxCompressed;
195410
+ var crc322, deflateSync, inflateSync2, SIGNATURE, CHANNELS, DEPTHS, PNG_MAX_SIDE, PNG_MAX_PIXELS, bad2, scanlineBytes, maxCompressed;
195353
195411
  var init_png = __esm({
195354
195412
  "../../node_modules/@wix/gplay-api/dist/png.js"() {
195355
195413
  init_define_HHP_CATALOG();
195356
195414
  init_errors3();
195357
- ({ crc32: crc322, deflateSync, inflateSync } = __ascBuiltin015);
195415
+ ({ crc32: crc322, deflateSync, inflateSync: inflateSync2 } = __ascBuiltin015);
195358
195416
  SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
195359
195417
  CHANNELS = { 0: 1, 2: 3, 3: 1, 4: 2, 6: 4 };
195360
195418
  DEPTHS = { 0: [1, 2, 4, 8, 16], 2: [8, 16], 3: [1, 2, 4, 8], 4: [8, 16], 6: [8, 16] };
@@ -219397,9 +219455,9 @@ var init_commands = __esm({
219397
219455
  summary: "Jobs in the state directory",
219398
219456
  async run(inv) {
219399
219457
  const { FileJobStore: FileJobStore2 } = await Promise.resolve().then(() => (init_dist5(), dist_exports5));
219400
- const { join: join193 } = await import("node:path");
219458
+ const { join: join194 } = await import("node:path");
219401
219459
  const runner2 = await inv.ctx.runner();
219402
- const jobs = runner2.list ? await runner2.list() : await new FileJobStore2(join193(inv.ctx.stateDir, "jobs")).list();
219460
+ const jobs = runner2.list ? await runner2.list() : await new FileJobStore2(join194(inv.ctx.stateDir, "jobs")).list();
219403
219461
  inv.print(jobs.map((j2) => ({ id: j2.id, action: j2.action, status: j2.status, actor: j2.actor, issuerId: accountKey(j2.account), created: j2.history[0]?.at })), ["id", "action", "status", "actor", "issuerId", "created"]);
219404
219462
  }
219405
219463
  },
@@ -229792,11 +229850,11 @@ __export(input_evidence_isolation_exports, {
229792
229850
  });
229793
229851
  async function installInputEvidenceIsolation(dir) {
229794
229852
  const { lstatSync: lstatSync39, readdirSync: readdirSync60 } = await import("node:fs");
229795
- const { join: join193 } = await import("node:path");
229853
+ const { join: join194 } = await import("node:path");
229796
229854
  const check = (path2) => {
229797
229855
  const stat9 = lstatSync39(path2);
229798
229856
  if (stat9.isSymbolicLink()) throw new Error("input evidence requires a content tree without symlinks");
229799
- if (stat9.isDirectory()) for (const name of readdirSync60(path2)) check(join193(path2, name));
229857
+ if (stat9.isDirectory()) for (const name of readdirSync60(path2)) check(join194(path2, name));
229800
229858
  };
229801
229859
  check(dir);
229802
229860
  const { requireBuildConfinement: requireBuildConfinement2 } = await Promise.resolve().then(() => (init_build_lib(), build_lib_exports));
@@ -243345,7 +243403,7 @@ var init_screenshot_display_types = __esm({
243345
243403
  // ../store-release/iap-review-screenshot.ts
243346
243404
  import { createHash as createHash74 } from "node:crypto";
243347
243405
  import { basename as basename35, resolve as resolve96 } from "node:path";
243348
- function pngSize(bytes2) {
243406
+ function pngSize2(bytes2) {
243349
243407
  const signed = PNG_SIGNATURE.every((b3, i2) => bytes2[i2] === b3);
243350
243408
  if (!signed || bytes2.length < 24 || bytes2.toString("ascii", 12, 16) !== "IHDR") return void 0;
243351
243409
  return { format: "png", width: bytes2.readUInt32BE(16), height: bytes2.readUInt32BE(20) };
@@ -243359,7 +243417,7 @@ function jpegSize(bytes2) {
243359
243417
  }
243360
243418
  function readImageSize(bytes2) {
243361
243419
  const buffer = Buffer.from(bytes2.buffer, bytes2.byteOffset, bytes2.byteLength);
243362
- return pngSize(buffer) ?? jpegSize(buffer);
243420
+ return pngSize2(buffer) ?? jpegSize(buffer);
243363
243421
  }
243364
243422
  function md5Hex(bytes2) {
243365
243423
  return createHash74("md5").update(bytes2).digest("hex");
@@ -247095,7 +247153,7 @@ __export(preflight_app_exports, {
247095
247153
  isValidAppStoreSize: () => isValidAppStoreSize,
247096
247154
  jpegSize: () => jpegSize2,
247097
247155
  playListingAssets: () => playListingAssets,
247098
- pngSize: () => pngSize2,
247156
+ pngSize: () => pngSize3,
247099
247157
  preflightApp: () => preflightApp,
247100
247158
  profileAccount: () => profileAccount,
247101
247159
  readXcconfigVars: () => readXcconfigVars
@@ -247330,7 +247388,7 @@ function isValidAppStoreSize(w2, h2) {
247330
247388
  function isRequired69(w2, h2) {
247331
247389
  return w2 === 1320 && h2 === 2868 || w2 === 1290 && h2 === 2796 || w2 === 2868 && h2 === 1320 || w2 === 2796 && h2 === 1290;
247332
247390
  }
247333
- function pngSize2(buf) {
247391
+ function pngSize3(buf) {
247334
247392
  if (buf.length < 24 || buf.toString("ascii", 12, 16) !== "IHDR") return null;
247335
247393
  return { w: buf.readUInt32BE(16), h: buf.readUInt32BE(20) };
247336
247394
  }
@@ -247387,7 +247445,7 @@ function analyzePlayListing(assets) {
247387
247445
  } else {
247388
247446
  const { name, bytes: bytes2 } = assets.featureGraphic;
247389
247447
  const isPng = bytes2.length > 8 && bytes2.toString("ascii", 1, 4) === "PNG";
247390
- const size = isPng ? pngSize2(bytes2) : jpegSize2(bytes2);
247448
+ const size = isPng ? pngSize3(bytes2) : jpegSize2(bytes2);
247391
247449
  if (!size) {
247392
247450
  f2.push({
247393
247451
  level: "error",
@@ -247476,7 +247534,7 @@ function listScreenshots(app2, locale = "en-US") {
247476
247534
  const flat2 = join155(storeDir(app2), "screenshots", locale);
247477
247535
  if (existsSync123(flat2)) {
247478
247536
  for (const png of readdirSync54(flat2).filter((n2) => n2.endsWith(".png"))) {
247479
- const sz = pngSize2(readFileSync149(join155(flat2, png)));
247537
+ const sz = pngSize3(readFileSync149(join155(flat2, png)));
247480
247538
  if (sz) out2.push({ name: png, w: sz.w, h: sz.h });
247481
247539
  }
247482
247540
  }
@@ -247486,7 +247544,7 @@ function listScreenshots(app2, locale = "en-US") {
247486
247544
  const d2 = join155(legacy, deviceDir);
247487
247545
  if (!statSync44(d2).isDirectory()) continue;
247488
247546
  for (const png of readdirSync54(d2).filter((n2) => n2.endsWith(".png"))) {
247489
- const sz = pngSize2(readFileSync149(join155(d2, png)));
247547
+ const sz = pngSize3(readFileSync149(join155(d2, png)));
247490
247548
  if (sz) out2.push({ name: `${deviceDir}/${png}`, w: sz.w, h: sz.h });
247491
247549
  }
247492
247550
  }
@@ -257488,7 +257546,13 @@ function generateScreens(input) {
257488
257546
  }));
257489
257547
  const taken = new Set(input.takenScreenIds ?? []);
257490
257548
  const hiddenPage = (id) => obj6(obj6(layoutItems[id]).settings).hideFromNavigation === true;
257491
- const homePage = input.homeScreenId ? str13(arr(obj6(obj6(input.navigation).target).tabs).map(obj6)[0]?.layoutItemId) || (sourceTabs.length > 1 ? tabScreenIds.map((id) => pageItems(id)[0]).find((id) => id && !hiddenPage(id)) : void 0) || items.find((id) => !hiddenPage(id)) || items[0] : void 0;
257549
+ const isForum = (sectionId) => str13(obj6(sections2[sectionId]).sectionDefinitionId).startsWith("forum_");
257550
+ const forumOnly = (id) => {
257551
+ const els = arr(obj6(layoutItems[id]).elements).map(obj6);
257552
+ return els.length > 0 && els.every((e2) => isForum(str13(e2.elementId)));
257553
+ };
257554
+ const firstPage = (screenId) => pageItems(screenId).find((page) => !forumOnly(page)) ?? pageItems(screenId)[0];
257555
+ const homePage = input.homeScreenId ? str13(arr(obj6(obj6(input.navigation).target).tabs).map(obj6).find((tab) => !forumOnly(str13(tab.layoutItemId)))?.layoutItemId) || (sourceTabs.length > 1 ? tabScreenIds.map((id) => pageItems(id).find((page) => !forumOnly(page))).find((id) => id && !hiddenPage(id)) : void 0) || items.find((id) => !hiddenPage(id) && !forumOnly(id)) || items.find((id) => !forumOnly(id)) || items[0] : void 0;
257492
257556
  if (input.homeScreenId) taken.add(input.homeScreenId);
257493
257557
  const fellBack = /* @__PURE__ */ new Set();
257494
257558
  const paramLinked = /* @__PURE__ */ new Set();
@@ -257526,7 +257590,23 @@ function generateScreens(input) {
257526
257590
  for (const layoutItemId of items) {
257527
257591
  const item2 = obj6(layoutItems[layoutItemId]);
257528
257592
  const label4 = str13(item2.title) || layoutItemId;
257529
- const elements2 = arr(item2.elements).map(obj6);
257593
+ const sourceElements = arr(item2.elements).map(obj6);
257594
+ const sourceIndex = new Map(sourceElements.map((element, position) => [element, position]));
257595
+ const elements2 = sourceElements.filter((element) => {
257596
+ const sectionId = str13(element.elementId);
257597
+ if (!isForum(sectionId)) return true;
257598
+ out2.gaps.push({
257599
+ page: label4,
257600
+ sectionId,
257601
+ sectionDefinitionId: str13(obj6(sections2[sectionId]).sectionDefinitionId),
257602
+ reason: "the retired Wix Forum is omitted; use real Wix Groups when present. Forum-to-Groups migration is not verified by this collection"
257603
+ });
257604
+ return false;
257605
+ });
257606
+ if (forumOnly(layoutItemId)) {
257607
+ out2.routes.push({ layoutItemId, label: label4, kind: "skipped", omitted: "retired_forum" });
257608
+ continue;
257609
+ }
257530
257610
  if (!elements2.length) {
257531
257611
  out2.routes.push({ layoutItemId, label: label4, kind: "empty" });
257532
257612
  continue;
@@ -257601,7 +257681,8 @@ function generateScreens(input) {
257601
257681
  }
257602
257682
  };
257603
257683
  const children2 = [];
257604
- elements2.forEach((element, index) => {
257684
+ elements2.forEach((element) => {
257685
+ const index = sourceIndex.get(element);
257605
257686
  const sectionId = str13(element.elementId);
257606
257687
  const section3 = obj6(sections2[sectionId]);
257607
257688
  const type2 = str13(section3.sectionDefinitionId);
@@ -257663,16 +257744,23 @@ function generateScreens(input) {
257663
257744
  const slugs = layoutSlugs(layoutItems);
257664
257745
  const hasTabBar = (str13(obj6(obj6(input.navigation).target).navKind) || "bottomTabs") === "bottomTabs";
257665
257746
  const pageOfScreen = new Map(sourceTabs.flatMap((tab) => {
257666
- const first = pageItems(str13(tab.screenId))[0];
257747
+ const first = firstPage(str13(tab.screenId));
257667
257748
  return first ? [[str13(tab.screenId), first]] : [];
257668
257749
  }));
257669
257750
  for (; ; ) {
257670
- const emptied = resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen, true);
257751
+ const emptied = resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen, forumOnly, true);
257671
257752
  let demoted = 0;
257672
- for (const { id: screenId, dropped } of emptied) {
257753
+ for (const { id: screenId, dropped, retired } of emptied) {
257673
257754
  const route = out2.routes.find((r3) => r3.screenId === screenId && r3.kind === "generated");
257674
257755
  if (!route) continue;
257675
257756
  demoted++;
257757
+ if (retired) {
257758
+ for (const title of dropped) out2.gaps.push({ page: route.label, sectionId: "", sectionDefinitionId: "platform_elements_button_section", reason: `the button "${title}" links to the retired Wix Forum, so the button and the page it alone filled are omitted` });
257759
+ out2.routes[out2.routes.indexOf(route)] = { layoutItemId: route.layoutItemId, label: route.label, kind: "skipped", omitted: "retired_forum" };
257760
+ delete out2.screens[screenId];
257761
+ delete out2.workers[screenId];
257762
+ continue;
257763
+ }
257676
257764
  for (const title of dropped) out2.gaps.push({ page: route.label, sectionId: "", sectionDefinitionId: "platform_elements_button_section", reason: `the button "${title}" links to a page that produced no screen, so the button is left out` });
257677
257765
  out2.unmapped.push({ page: route.label, sectionId: "", sectionDefinitionId: "platform_elements_button_section", reason: "its only content was a button linking to a page that produced no screen, so the page has nothing to show" });
257678
257766
  out2.routes[out2.routes.indexOf(route)] = { layoutItemId: route.layoutItemId, label: route.label, kind: "unmapped" };
@@ -257694,7 +257782,8 @@ function generateScreens(input) {
257694
257782
  const attempted = new Set(items);
257695
257783
  for (const sourceScreenId of Object.keys(screens0)) {
257696
257784
  const pages2 = pageItems(sourceScreenId);
257697
- const first = pages2.find((id) => obj6(obj6(layoutItems[id]).settings).hideFromNavigation !== true) ?? pages2[0];
257785
+ const visible = pages2.filter((id) => obj6(obj6(layoutItems[id]).settings).hideFromNavigation !== true);
257786
+ const first = visible.find((id) => !forumOnly(id)) ?? visible[0] ?? pages2[0];
257698
257787
  if (first ? attempted.has(first) : tabScreenIds.includes(sourceScreenId)) mapRow(`/screens/${pointerPart(sourceScreenId)}`, first ? screenOfPage.get(first) : void 0);
257699
257788
  arr(obj6(obj6(screens0[sourceScreenId]).layout).items).forEach((item2, index) => {
257700
257789
  const id = str13(obj6(item2).layoutItemId);
@@ -257707,7 +257796,7 @@ function generateScreens(input) {
257707
257796
  }
257708
257797
  const planned2 = obj6(input.navigation);
257709
257798
  const ownTabs = sourceTabs.length > 1 && !arr(obj6(planned2.target).tabs).length ? sourceTabs.flatMap((tab) => {
257710
- const layoutItemId = pageItems(str13(tab.screenId))[0];
257799
+ const layoutItemId = firstPage(str13(tab.screenId));
257711
257800
  if (!layoutItemId) {
257712
257801
  out2.gaps.push({ page: str13(tab.title).trim() || str13(tab.screenId), sectionId: "", sectionDefinitionId: "(navigation)", reason: "this bottom tab's screen has no page, so the app has no tab for it" });
257713
257802
  return [];
@@ -257716,7 +257805,7 @@ function generateScreens(input) {
257716
257805
  return layoutItemId && !hidden ? [{ layoutItemId, label: str13(tab.title).trim(), icon: str13(tab.icon) }] : [];
257717
257806
  }) : [];
257718
257807
  addNavigation(out2, ownTabs.length ? { target: { tabs: ownTabs, overflow: ownTabs.length > BOTTOM_TABS_BEFORE_MORE + 1 } } : planned2, taken);
257719
- resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen);
257808
+ resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen, forumOnly);
257720
257809
  return out2;
257721
257810
  }
257722
257811
  function markSharedTemplateParams(out2, paramLinked) {
@@ -257743,7 +257832,7 @@ function layoutSlugs(layoutItems) {
257743
257832
  for (const slug of repeated) found.delete(slug);
257744
257833
  return found;
257745
257834
  }
257746
- function resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen, dryRun = false) {
257835
+ function resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen, isForumPage, dryRun = false) {
257747
257836
  const screenOf = new Map(out2.routes.filter((r3) => r3.screenId).map((r3) => [r3.layoutItemId, r3.screenId]));
257748
257837
  const taken = /* @__PURE__ */ new Set();
257749
257838
  const tabOfScreen = new Map((hasTabBar ? out2.tabs : []).map((tab) => [tab.screenId, tabIdFor(tab, taken)]));
@@ -257766,12 +257855,17 @@ function resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen
257766
257855
  return body.type === "Button" && isPlaceholderTap(action) && !resolve118(str13(obj6(obj6(action).params).screenId));
257767
257856
  };
257768
257857
  const DEAD = Symbol("dead");
257858
+ let stats = { forum: 0, other: 0 };
257769
257859
  const walk4 = (value2, dropped) => {
257770
257860
  if (typeof value2 === "string" && value2.startsWith(ROUTE_PLACEHOLDER)) return resolve118(value2);
257771
257861
  if (Array.isArray(value2)) return value2.map((v2) => walk4(v2, dropped)).filter((v2) => v2 !== DEAD);
257772
257862
  if (value2 && typeof value2 === "object") {
257773
257863
  if (isDeadButton(value2)) {
257774
257864
  dropped.push(str13(obj6(obj6(obj6(value2).body).props).title));
257865
+ const action = obj6(obj6(obj6(obj6(value2).body).props).action);
257866
+ const named3 = str13(obj6(action.params).screenId).slice(ROUTE_PLACEHOLDER.length).split("|")[0] ?? "";
257867
+ if (isForumPage(named3) || isForumPage(slugs.get(named3) ?? "")) stats.forum++;
257868
+ else stats.other++;
257775
257869
  return DEAD;
257776
257870
  }
257777
257871
  const next = Object.fromEntries(Object.entries(value2).filter(([, v2]) => !(isPlaceholderTap(v2) && !resolve118(str13(obj6(obj6(v2).params).screenId)))).map(([k3, v2]) => [k3, isPlaceholderTap(v2) ? retarget(v2) : walk4(v2, dropped)]));
@@ -257785,8 +257879,9 @@ function resolveRoutePlaceholders(out2, fellBack, slugs, hasTabBar, pageOfScreen
257785
257879
  const emptied = [];
257786
257880
  for (const [id, screen] of Object.entries(out2.screens)) {
257787
257881
  const dropped = [];
257882
+ stats = { forum: 0, other: 0 };
257788
257883
  const walked = walk4(screen, dropped);
257789
- if (walked.payload === DEAD) emptied.push({ id, dropped });
257884
+ if (walked.payload === DEAD) emptied.push({ id, dropped, retired: stats.forum > 0 && stats.other === 0 });
257790
257885
  if (dryRun) continue;
257791
257886
  out2.screens[id] = walked.payload === DEAD ? { ...walked, payload: { ...obj6(screen.payload), body: { ...obj6(obj6(screen.payload).body), props: { ...obj6(obj6(obj6(screen.payload).body).props), children: [] } } } } : walked;
257792
257887
  if (walked.payload === DEAD) out2.unmapped.push({ page: str13(screen.title) || id, sectionId: "", sectionDefinitionId: "platform_elements_button_section", reason: "its only content was a button linking to a page that produced no screen, so the page has nothing to show" });
@@ -257820,12 +257915,25 @@ function tabsFile(result, navigation) {
257820
257915
  };
257821
257916
  }
257822
257917
  function addNavigation(out2, plan, taken) {
257823
- const tabs = arr(obj6(plan.target).tabs).map(obj6);
257824
- if (!tabs.length) return;
257918
+ const plannedTabs = arr(obj6(plan.target).tabs).map(obj6);
257919
+ if (!plannedTabs.length) return;
257825
257920
  const routeOf = new Map(out2.routes.map((r3) => [r3.layoutItemId, r3]));
257921
+ for (const tab of plannedTabs) {
257922
+ const route = routeOf.get(str13(tab.layoutItemId));
257923
+ out2.pages.push({
257924
+ layoutItemId: str13(tab.layoutItemId),
257925
+ label: str13(tab.label),
257926
+ ...route?.screenId ? { screenId: route.screenId } : {},
257927
+ ...route?.omitted ? { omitted: route.omitted } : {}
257928
+ });
257929
+ }
257930
+ const tabs = plannedTabs.filter((tab) => !routeOf.get(str13(tab.layoutItemId))?.omitted);
257931
+ if (!tabs.length) {
257932
+ out2.unmapped.push({ page: "(navigation)", sectionId: "", sectionDefinitionId: "(navigation)", reason: "every page of the navigation is the retired Wix Forum, so no page is left to open: the app needs at least one other page" });
257933
+ return;
257934
+ }
257826
257935
  const overflow = obj6(plan.target).overflow === true && tabs.length > BOTTOM_TABS_BEFORE_MORE + 1;
257827
257936
  const bottom = overflow ? tabs.slice(0, BOTTOM_TABS_BEFORE_MORE) : tabs;
257828
- for (const tab of tabs) out2.pages.push({ layoutItemId: str13(tab.layoutItemId), label: str13(tab.label), ...routeOf.get(str13(tab.layoutItemId))?.screenId ? { screenId: routeOf.get(str13(tab.layoutItemId)).screenId } : {} });
257829
257937
  for (const tab of bottom) {
257830
257938
  const route = routeOf.get(str13(tab.layoutItemId));
257831
257939
  if (route?.screenId) {
@@ -258978,8 +259086,9 @@ import ts25 from "typescript";
258978
259086
  function pagesWithoutScreen(plan, planned2) {
258979
259087
  const have = new Map((plan.pages ?? []).map((page) => [page.layoutItemId, page]));
258980
259088
  const missing4 = /* @__PURE__ */ new Map();
258981
- for (const page of plan.pages ?? []) if (!page.screenId) missing4.set(page.layoutItemId, page.label);
258982
- for (const page of planned2) if (!have.get(page.layoutItemId)?.screenId) missing4.set(page.layoutItemId, page.label);
259089
+ const omitted = (id) => have.get(id)?.omitted === "retired_forum";
259090
+ for (const page of plan.pages ?? []) if (!page.screenId && !omitted(page.layoutItemId)) missing4.set(page.layoutItemId, page.label);
259091
+ for (const page of planned2) if (!have.get(page.layoutItemId)?.screenId && !omitted(page.layoutItemId)) missing4.set(page.layoutItemId, page.label);
258983
259092
  return [...missing4].map(([layoutItemId, page]) => ({ page, layoutItemId }));
258984
259093
  }
258985
259094
  function tabIcon(source2) {
@@ -259207,16 +259316,255 @@ var init_apply_navigation = __esm({
259207
259316
  }
259208
259317
  });
259209
259318
 
259319
+ // src/one-app/starter-keep-list.ts
259320
+ import { existsSync as existsSync142, readFileSync as readFileSync170, writeFileSync as writeFileSync67 } from "node:fs";
259321
+ import { join as join178 } from "node:path";
259322
+ import ts26 from "typescript";
259323
+ function screensOpenedBy(node3, found = /* @__PURE__ */ new Set()) {
259324
+ if (Array.isArray(node3)) {
259325
+ for (const child3 of node3) screensOpenedBy(child3, found);
259326
+ return [...found];
259327
+ }
259328
+ if (typeof node3 !== "object" || node3 === null) return [...found];
259329
+ const record4 = node3;
259330
+ const target = record4.params?.screenId;
259331
+ const opens = record4.actionId === "himi.open" || typeof record4.actionId === "string" && WORKER_OPEN2.test(record4.actionId);
259332
+ if (opens && typeof target === "string" && CATALOGUE_ID.test(target)) found.add(target);
259333
+ for (const value2 of Object.values(record4)) screensOpenedBy(value2, found);
259334
+ return [...found];
259335
+ }
259336
+ function seedKeepList(facts) {
259337
+ const rows = /* @__PURE__ */ new Map();
259338
+ const add = (id, why) => {
259339
+ if (!rows.has(id)) rows.set(id, why);
259340
+ };
259341
+ for (const id of facts.generated) add(id, "generated by one-app generate");
259342
+ for (const id of facts.template) add(id, "starter screen a migrated page opens");
259343
+ for (const id of ACCOUNT_CORE) add(id, "account core");
259344
+ for (const counter of ["notifications", "cart"]) {
259345
+ if (facts.counters.includes(counter)) add(HEADER_BADGE_SPEC[counter].screenId, `top-bar ${counter} control`);
259346
+ }
259347
+ if (facts.memberChat) add("himi_inbox", "member chat: every chat door opens the Inbox");
259348
+ else if (facts.counters.includes("chat")) add(HEADER_BADGE_SPEC.chat.screenId, "top-bar chat control");
259349
+ if (facts.showsInvite) add(INVITE_SCREEN, "top-bar invite control (built by the agent)");
259350
+ return [...rows].map(([id, why]) => ({ id, why }));
259351
+ }
259352
+ function loadStarter(dir) {
259353
+ try {
259354
+ const dev = readFileSync170(join178(dir, "dev", "index.ts"), "utf8"), config = readFileSync170(join178(dir, "config.ts"), "utf8");
259355
+ const workers = listWorkers(dir);
259356
+ return { sources: { dev, config, workerDirs: workers.dirs, workerFiles: workers.files }, app: parseApp(dev, config), moduleTargets: /* @__PURE__ */ new Map() };
259357
+ } catch (error) {
259358
+ if (error instanceof TrimRefusal || error.code) return void 0;
259359
+ throw error;
259360
+ }
259361
+ }
259362
+ function routeLabel(app2, id) {
259363
+ return (app2.exact.get(id) ?? app2.templated.find((route) => route.re.test(id)))?.label;
259364
+ }
259365
+ function literalTargets2(app2, text25) {
259366
+ const found = /* @__PURE__ */ new Set();
259367
+ for (const token of literalsOf(text25)) {
259368
+ if (!/^[A-Za-z_][A-Za-z0-9_]*[_/]?$/.test(token)) continue;
259369
+ const prefix = /[_/]$/.test(token);
259370
+ const label4 = prefix ? app2.templated.find((route) => route.re.test(`${token}x`))?.label : routeLabel(app2, token);
259371
+ if (label4) found.add(label4);
259372
+ }
259373
+ return [...found];
259374
+ }
259375
+ function runtimeTargets(starter, workerTexts) {
259376
+ const { app: app2, sources, moduleTargets } = starter;
259377
+ const found = new Set(workerTexts.flatMap((text25) => literalTargets2(app2, text25)));
259378
+ for (const module of new Set(workerTexts.flatMap(sharedModulesOf))) {
259379
+ if (!moduleTargets.has(module)) moduleTargets.set(module, literalTargets2(app2, sources.workerFiles[`tier5-src/_shared/${module}.ts`] ?? ""));
259380
+ const targets = moduleTargets.get(module);
259381
+ if (targets.length <= TABLE_LIMIT) for (const label4 of targets) found.add(label4);
259382
+ }
259383
+ return [...found];
259384
+ }
259385
+ function workerTextsOf(starter, label4) {
259386
+ const route = starter.app.routes.find((r3) => r3.label === label4);
259387
+ const prefixes = (route?.bundles ?? []).map((bundle) => `tier5-src/${bundle}/`);
259388
+ return Object.entries(starter.sources.workerFiles).filter(([file2]) => prefixes.some((prefix) => file2.startsWith(prefix))).map(([, text25]) => text25);
259389
+ }
259390
+ function closeOverTrim(dir, seed2, replaced = [], alsoKept = []) {
259391
+ const starter = loadStarter(dir);
259392
+ if (!starter) return [];
259393
+ const { sources, app: app2 } = starter;
259394
+ const sample = new Set(replaced);
259395
+ const labels = new Set(app2.routes.map((route) => route.label));
259396
+ const keep = new Set([...seed2, ...alsoKept].filter((id) => labels.has(id)));
259397
+ const added = [];
259398
+ const need2 = (screen, to2, why = `opened by ${screen}`) => {
259399
+ if (sample.has(screen)) return false;
259400
+ const label4 = routeLabel(app2, to2);
259401
+ if (!label4 || keep.has(label4)) return false;
259402
+ keep.add(label4);
259403
+ added.push({ id: label4, why });
259404
+ return true;
259405
+ };
259406
+ const attempt2 = (links) => {
259407
+ try {
259408
+ return { plan: planTrim(sources, [...keep], links) };
259409
+ } catch (error) {
259410
+ if (error instanceof TrimRefusal) return { refused: error };
259411
+ throw error;
259412
+ }
259413
+ };
259414
+ const primaryIds = primaryNodeIds(app2);
259415
+ const droppedOf = (detail) => Array.isArray(detail) ? detail : [];
259416
+ const roots2 = new Set(seed2.filter((id) => labels.has(id)));
259417
+ const scanned = /* @__PURE__ */ new Set();
259418
+ const scanRuntime = () => {
259419
+ let grew = false;
259420
+ for (const label4 of roots2) {
259421
+ if (scanned.has(label4) || sample.has(label4)) continue;
259422
+ scanned.add(label4);
259423
+ for (const to2 of runtimeTargets(starter, workerTextsOf(starter, label4))) grew = need2(label4, to2, `opened at runtime by ${label4}`) || grew;
259424
+ }
259425
+ return grew;
259426
+ };
259427
+ for (let round = 0; round <= labels.size; round++) {
259428
+ let grew = scanRuntime();
259429
+ const { plan, refused: refused2 } = attempt2("drop");
259430
+ if (plan) {
259431
+ grew = droppedPrimaryTaps(droppedOf(plan.report.droppedLinks), primaryIds).map((lost2) => need2(lost2.screen, lost2.to)).includes(true) || grew;
259432
+ } else {
259433
+ const unremovable = refused2.detail.unremovable ?? [];
259434
+ const emptied = new Set(refused2.detail.dropWouldEmpty ?? []);
259435
+ grew = unremovable.map((u2) => need2(u2.screen, u2.to)).includes(true) || grew;
259436
+ if (!grew && emptied.size) {
259437
+ grew = droppedOf(attempt2().refused?.detail.droppedLinks).filter((d2) => emptied.has(d2.screen)).map((d2) => need2(d2.screen, d2.to)).includes(true);
259438
+ }
259439
+ }
259440
+ if (!grew) break;
259441
+ }
259442
+ return added;
259443
+ }
259444
+ function catalogueRange(masked) {
259445
+ const heading = /(?:^|\n)##[ \t]+Screen catalogue\b[^\n]*/i.exec(masked);
259446
+ if (!heading) return void 0;
259447
+ const start = heading.index + heading[0].length;
259448
+ const next = /\n##[ \t]/.exec(masked.slice(start));
259449
+ return { start, end: next ? start + next.index : masked.length };
259450
+ }
259451
+ function selfWrittenRows(spec) {
259452
+ const masked = maskComments(spec);
259453
+ const range = catalogueRange(masked);
259454
+ const own6 = /* @__PURE__ */ new Set();
259455
+ if (!range) return own6;
259456
+ for (const line of masked.slice(range.start, range.end).split("\n")) {
259457
+ if (!line.trim().startsWith("|")) continue;
259458
+ const cells = line.trim().replace(/^\||\|$/g, "").split("|").map((cell3) => cell3.trim());
259459
+ const id = /^`([^`]+)`/.exec(cells[0] ?? "")?.[1];
259460
+ if (id && cells.length > 1 && SELF_NOTE.test(cells[cells.length - 1] ?? "")) own6.add(id);
259461
+ }
259462
+ return own6;
259463
+ }
259464
+ function mergeCatalogue(spec, rows) {
259465
+ const have = new Set(specScreens(spec));
259466
+ const fresh = rows.filter((row2, index) => CATALOGUE_ID.test(row2.id) && !have.has(row2.id) && rows.findIndex((r3) => r3.id === row2.id) === index);
259467
+ if (!fresh.length) return { text: spec, added: [] };
259468
+ const masked = maskComments(spec);
259469
+ const range = catalogueRange(masked);
259470
+ const rowOf = (columns2, row2) => tableRow([`\`${row2.id}\``, ...Array(Math.max(columns2 - 2, 0)).fill(""), row2.why]);
259471
+ const block = (columns2) => fresh.map((row2) => rowOf(columns2, row2)).join("\n");
259472
+ const added = fresh.map((row2) => row2.id);
259473
+ if (!range) {
259474
+ const table2 = [tableRow(HEADER4), tableRow(HEADER4.map(() => "---")), block(HEADER4.length)].join("\n");
259475
+ return { text: `${spec.replace(/\n*$/, "\n")}
259476
+ ## Screen catalogue
259477
+ ${table2}
259478
+ `, added };
259479
+ }
259480
+ const { start, end: end2 } = range;
259481
+ const lines2 = masked.slice(start, end2).split("\n");
259482
+ let offset = start, lastRowEnd = -1, columns = HEADER4.length, first = true;
259483
+ for (const line of lines2) {
259484
+ if (line.trim().startsWith("|")) {
259485
+ if (first) {
259486
+ columns = line.trim().replace(/^\||\|$/g, "").split("|").length;
259487
+ first = false;
259488
+ }
259489
+ lastRowEnd = offset + line.length;
259490
+ }
259491
+ offset += line.length + 1;
259492
+ }
259493
+ if (lastRowEnd >= 0) return { text: `${spec.slice(0, lastRowEnd)}
259494
+ ${block(columns)}${spec.slice(lastRowEnd)}`, added };
259495
+ const table = [tableRow(HEADER4), tableRow(HEADER4.map(() => "---")), block(HEADER4.length)].join("\n");
259496
+ return { text: `${spec.slice(0, end2).replace(/\n*$/, "\n")}${table}
259497
+ ${spec.slice(end2).replace(/^\n*/, "\n")}`, added };
259498
+ }
259499
+ function sharedModulesOf(workerSource) {
259500
+ const file2 = ts26.createSourceFile("worker.ts", workerSource, ts26.ScriptTarget.Latest, true);
259501
+ const modules = [];
259502
+ for (const statement of file2.statements) {
259503
+ if (!ts26.isImportDeclaration(statement) || !ts26.isStringLiteral(statement.moduleSpecifier)) continue;
259504
+ const specifier = statement.moduleSpecifier.text;
259505
+ if (specifier.startsWith("../_shared/") && specifier.endsWith(".js")) modules.push(specifier.slice("../_shared/".length, -".js".length));
259506
+ }
259507
+ return modules;
259508
+ }
259509
+ function literalsOf(text25) {
259510
+ const file2 = ts26.createSourceFile("module.ts", text25, ts26.ScriptTarget.Latest, true);
259511
+ const out2 = [];
259512
+ const visit = (node3) => {
259513
+ if (ts26.isStringLiteral(node3) || ts26.isNoSubstitutionTemplateLiteral(node3) || ts26.isTemplateHead(node3)) out2.push(node3.text);
259514
+ ts26.forEachChild(node3, visit);
259515
+ };
259516
+ visit(file2);
259517
+ return out2;
259518
+ }
259519
+ function workerOpenedScreens(dir, workerSources) {
259520
+ const starter = loadStarter(dir);
259521
+ if (!starter || !workerSources.length) return [];
259522
+ return runtimeTargets(starter, workerSources).map((id) => ({ id, why: MODULE_NOTE }));
259523
+ }
259524
+ function writeStarterKeepList(contentDir2, facts) {
259525
+ const path2 = join178(contentDir2, "SPEC.md");
259526
+ const created = !existsSync142(path2);
259527
+ const starter = loadStarter(contentDir2);
259528
+ const template = facts.template.flatMap((id) => facts.generated.includes(id) || !starter ? [id] : routeLabel(starter.app, id) ?? []);
259529
+ const seed2 = [...seedKeepList({ ...facts, template }), ...workerOpenedScreens(contentDir2, facts.workers ?? [])];
259530
+ const spec = created ? SPEC_TEMPLATE : readFileSync170(path2, "utf8");
259531
+ const existing = specScreens(spec), mine = selfWrittenRows(spec);
259532
+ const closure = closeOverTrim(contentDir2, [...seed2.map((row2) => row2.id), ...existing.filter((id) => !mine.has(id))], facts.generated, existing);
259533
+ const { text: text25, added } = mergeCatalogue(spec, [...seed2, ...closure]);
259534
+ if (created || added.length) writeFileSync67(path2, text25, "utf8");
259535
+ return { path: path2, created, added, closure };
259536
+ }
259537
+ var MODULE_NOTE, ACCOUNT_CORE, CATALOGUE_ID, WORKER_OPEN2, TABLE_LIMIT, maskComments, HEADER4, tableRow, SELF_NOTE;
259538
+ var init_starter_keep_list = __esm({
259539
+ "src/one-app/starter-keep-list.ts"() {
259540
+ init_define_HHP_CATALOG();
259541
+ init_mobile_ux_contract();
259542
+ init_template_adopt();
259543
+ init_template_trim();
259544
+ init_header_badges();
259545
+ init_invite_drawer();
259546
+ MODULE_NOTE = "opened at runtime by a module a migrated page registers";
259547
+ ACCOUNT_CORE = ["himi_account", "himi_account_settings", "himi_sign_in", "himi_delete_account", "himi_app_info", "himi_appearance", "himi_app_language"];
259548
+ CATALOGUE_ID = /^[a-z][a-z0-9_]*$/;
259549
+ WORKER_OPEN2 = /^tier5\.[A-Za-z0-9_]+\.openMember$/;
259550
+ TABLE_LIMIT = 4;
259551
+ maskComments = (text25) => text25.replace(/<!--[\s\S]*?(?:-->|$)/g, (m2) => m2.replace(/[^\n]/g, " "));
259552
+ HEADER4 = ["Screen", "Job", "Primary action", "Data", "Notes"];
259553
+ tableRow = (cells) => `| ${cells.join(" | ")} |`;
259554
+ SELF_NOTE = new RegExp(String.raw`^(${MODULE_NOTE}|generated by one-app generate|starter screen a migrated page opens|account core|top-bar [a-z]+ control( \(built by the agent\))?|member chat: every chat door opens the Inbox|opened (at runtime )?by [a-z][a-z0-9_]*)$`);
259555
+ }
259556
+ });
259557
+
259210
259558
  // src/one-app/generate-cli.ts
259211
- import { existsSync as existsSync142, mkdirSync as mkdirSync63, readdirSync as readdirSync59, readFileSync as readFileSync170, rmSync as rmSync41, writeFileSync as writeFileSync67 } from "node:fs";
259212
- import { dirname as dirname77, join as join178, resolve as resolve110 } from "node:path";
259559
+ import { existsSync as existsSync143, mkdirSync as mkdirSync63, readdirSync as readdirSync59, readFileSync as readFileSync171, rmSync as rmSync41, writeFileSync as writeFileSync68 } from "node:fs";
259560
+ import { dirname as dirname77, join as join179, resolve as resolve110 } from "node:path";
259213
259561
  function removeStaleGeneratedWorkers(contentDir2, current) {
259214
- const root = join178(contentDir2, "tier5-src");
259215
- if (!existsSync142(root)) return;
259562
+ const root = join179(contentDir2, "tier5-src");
259563
+ if (!existsSync143(root)) return;
259216
259564
  for (const name of readdirSync59(root)) {
259217
259565
  if (current.has(name) || name === "_shared") continue;
259218
- const index = join178(root, name, "index.ts");
259219
- if (existsSync142(index) && readFileSync170(index, "utf8").startsWith(GENERATED_WORKER_MARKER)) rmSync41(join178(root, name), { recursive: true, force: true });
259566
+ const index = join179(root, name, "index.ts");
259567
+ if (existsSync143(index) && readFileSync171(index, "utf8").startsWith(GENERATED_WORKER_MARKER)) rmSync41(join179(root, name), { recursive: true, force: true });
259220
259568
  }
259221
259569
  }
259222
259570
  function parseArgs5(args) {
@@ -259238,11 +259586,11 @@ function parseArgs5(args) {
259238
259586
  }
259239
259587
  }
259240
259588
  if (!evidenceDir || !contentDir2) throw new Error("Both --evidence-dir and --content are required.");
259241
- return { evidenceDir: resolve110(evidenceDir), contentDir: resolve110(contentDir2), out: resolve110(out2 ?? join178(evidenceDir, "gen", "screens.json")) };
259589
+ return { evidenceDir: resolve110(evidenceDir), contentDir: resolve110(contentDir2), out: resolve110(out2 ?? join179(evidenceDir, "gen", "screens.json")) };
259242
259590
  }
259243
259591
  function claimedHome(out2) {
259244
259592
  try {
259245
- return JSON.parse(readFileSync170(homeFile(out2), "utf8")).homeScreenId === TEMPLATE_HOME_SCREEN;
259593
+ return JSON.parse(readFileSync171(homeFile(out2), "utf8")).homeScreenId === TEMPLATE_HOME_SCREEN;
259246
259594
  } catch {
259247
259595
  return false;
259248
259596
  }
@@ -259250,7 +259598,7 @@ function claimedHome(out2) {
259250
259598
  function previousOutput(out2) {
259251
259599
  const keys2 = (path2) => {
259252
259600
  try {
259253
- const value2 = JSON.parse(readFileSync170(path2, "utf8"));
259601
+ const value2 = JSON.parse(readFileSync171(path2, "utf8"));
259254
259602
  return Array.isArray(value2) ? value2.filter((v2) => typeof v2 === "string") : value2 && typeof value2 === "object" ? Object.keys(value2) : [];
259255
259603
  } catch {
259256
259604
  return [];
@@ -259285,7 +259633,7 @@ async function runOneAppGenerate(args, io2) {
259285
259633
  }
259286
259634
  const fetchedAt = (() => {
259287
259635
  try {
259288
- const m2 = JSON.parse(readFileSync170(join178(options2.evidenceDir, "manifest.json"), "utf8"));
259636
+ const m2 = JSON.parse(readFileSync171(join179(options2.evidenceDir, "manifest.json"), "utf8"));
259289
259637
  return typeof m2.source?.fetchedAt === "string" ? m2.source.fetchedAt : void 0;
259290
259638
  } catch {
259291
259639
  return void 0;
@@ -259295,7 +259643,7 @@ async function runOneAppGenerate(args, io2) {
259295
259643
  let homeScreenId;
259296
259644
  const previousIds = previousOutput(options2.out);
259297
259645
  try {
259298
- const manifest2 = JSON.parse(readFileSync170(join178(options2.contentDir, "himalaya.content.json"), "utf8"));
259646
+ const manifest2 = JSON.parse(readFileSync171(join179(options2.contentDir, "himalaya.content.json"), "utf8"));
259299
259647
  taken = new Set(Object.keys(manifest2.screens ?? {}));
259300
259648
  if (taken.has(TEMPLATE_HOME_SCREEN) && (!previousIds.includes(TEMPLATE_HOME_SCREEN) || claimedHome(options2.out))) homeScreenId = TEMPLATE_HOME_SCREEN;
259301
259649
  for (const id of previousIds) taken.delete(id);
@@ -259304,24 +259652,24 @@ async function runOneAppGenerate(args, io2) {
259304
259652
  }
259305
259653
  let result;
259306
259654
  try {
259307
- result = generateScreens({ raw, pages: pages2, business, navigation, takenScreenIds: taken, ...homeScreenId ? { homeScreenId } : {}, recipe: (name, values) => readRecipe(options2.contentDir, name, values), recipeNodes: (name, values) => readRecipeNodes(options2.contentDir, name, values), hasModule: (file2) => existsSync142(join178(options2.contentDir, "tier5-src", "_shared", `${file2}.ts`)) });
259655
+ result = generateScreens({ raw, pages: pages2, business, navigation, takenScreenIds: taken, ...homeScreenId ? { homeScreenId } : {}, recipe: (name, values) => readRecipe(options2.contentDir, name, values), recipeNodes: (name, values) => readRecipeNodes(options2.contentDir, name, values), hasModule: (file2) => existsSync143(join179(options2.contentDir, "tier5-src", "_shared", `${file2}.ts`)) });
259308
259656
  } catch (error) {
259309
259657
  if (error instanceof RecipeError) return report7(io2, false, { code: "recipe_unavailable", error: error.message });
259310
259658
  throw error;
259311
259659
  }
259312
259660
  try {
259313
259661
  mkdirSync63(dirname77(options2.out), { recursive: true });
259314
- writeFileSync67(options2.out, JSON.stringify(result.screens, null, 2) + "\n", "utf8");
259315
- writeFileSync67(idsFile(options2.out), JSON.stringify([.../* @__PURE__ */ new Set([...previousIds, ...Object.keys(result.screens)])].sort()) + "\n", "utf8");
259316
- if (homeScreenId) writeFileSync67(homeFile(options2.out), JSON.stringify({ homeScreenId }) + "\n", "utf8");
259662
+ writeFileSync68(options2.out, JSON.stringify(result.screens, null, 2) + "\n", "utf8");
259663
+ writeFileSync68(idsFile(options2.out), JSON.stringify([.../* @__PURE__ */ new Set([...previousIds, ...Object.keys(result.screens)])].sort()) + "\n", "utf8");
259664
+ if (homeScreenId) writeFileSync68(homeFile(options2.out), JSON.stringify({ homeScreenId }) + "\n", "utf8");
259317
259665
  const tabsPath = tabsFileOf(options2.out);
259318
259666
  const tabs = tabsFile(result, navigation);
259319
- if (tabs) writeFileSync67(tabsPath, JSON.stringify(tabs, null, 2) + "\n", "utf8");
259667
+ if (tabs) writeFileSync68(tabsPath, JSON.stringify(tabs, null, 2) + "\n", "utf8");
259320
259668
  else rmSync41(tabsPath, { force: true });
259321
259669
  for (const worker of Object.values(result.workers)) {
259322
- const dir = join178(options2.contentDir, "tier5-src", worker.bundle);
259670
+ const dir = join179(options2.contentDir, "tier5-src", worker.bundle);
259323
259671
  mkdirSync63(dir, { recursive: true });
259324
- writeFileSync67(join178(dir, "index.ts"), worker.source, "utf8");
259672
+ writeFileSync68(join179(dir, "index.ts"), worker.source, "utf8");
259325
259673
  }
259326
259674
  removeStaleGeneratedWorkers(options2.contentDir, new Set(Object.values(result.workers).map((w2) => w2.bundle)));
259327
259675
  } catch (error) {
@@ -259361,7 +259709,24 @@ async function runOneAppGenerate(args, io2) {
259361
259709
  } catch (error) {
259362
259710
  return report7(io2, false, { code: "output_unwritable", error: `Could not write the route rows of ONE-APP-COVERAGE.json: ${error instanceof Error ? error.message : String(error)}` });
259363
259711
  }
259364
- const body = { coverage: coverage2, templateParams, screens: Object.keys(result.screens), workers: Object.values(result.workers).map((w2) => `tier5-src/${w2.bundle}/index.ts`), routes: result.routes, tabs: result.tabs, unmapped: result.unmapped, gaps: result.gaps, evidence: { ...result.evidence, ...fetchedAt ? { fetchedAt } : {} }, out: options2.out };
259712
+ let keepList;
259713
+ try {
259714
+ const manifest2 = JSON.parse(readFileSync171(join179(options2.evidenceDir, "manifest.json"), "utf8"));
259715
+ const badgePlan = readHashedEvidenceJson(options2.evidenceDir, "header-badge-plan.json");
259716
+ const generated = Object.keys(result.screens);
259717
+ const routed = result.routes.flatMap((route) => route.kind === "template" && route.screenId ? [route.screenId] : []);
259718
+ keepList = writeStarterKeepList(options2.contentDir, {
259719
+ generated,
259720
+ template: [...routed, ...screensOpenedBy(result.screens)],
259721
+ counters: Array.isArray(badgePlan?.counters) ? badgePlan.counters.filter((c2) => typeof c2 === "string") : [],
259722
+ memberChat: manifest2.memberChat === true,
259723
+ showsInvite: sourceShowsInvite(readHashedEvidenceJson(options2.evidenceDir, "invite-plan.json")),
259724
+ workers: Object.values(result.workers).map((worker) => worker.source)
259725
+ });
259726
+ } catch (error) {
259727
+ return report7(io2, false, { code: "output_unwritable", error: `Could not write the Screen catalogue of SPEC.md: ${error instanceof Error ? error.message : String(error)}` });
259728
+ }
259729
+ const body = { starterKeepList: { path: keepList.path, created: keepList.created, added: keepList.added, closure: keepList.closure }, coverage: coverage2, templateParams, screens: Object.keys(result.screens), workers: Object.values(result.workers).map((w2) => `tier5-src/${w2.bundle}/index.ts`), routes: result.routes, tabs: result.tabs, unmapped: result.unmapped, gaps: result.gaps, evidence: { ...result.evidence, ...fetchedAt ? { fetchedAt } : {} }, out: options2.out };
259365
259730
  if (result.unmapped.length) {
259366
259731
  return report7(io2, false, {
259367
259732
  code: "sections_unmapped",
@@ -259381,6 +259746,8 @@ var init_generate_cli = __esm({
259381
259746
  init_provision();
259382
259747
  init_coverage();
259383
259748
  init_apply_navigation();
259749
+ init_invite_drawer();
259750
+ init_starter_keep_list();
259384
259751
  GENERATE_USAGE = "himi one-app generate --evidence-dir <.himi/one-app> --content <app-dir> [--out <screens.json>]";
259385
259752
  GENERATED_WORKER_MARKER = "// Generated by `himi one-app generate`";
259386
259753
  idsFile = (out2) => `${out2}.ids.json`;
@@ -259390,7 +259757,7 @@ var init_generate_cli = __esm({
259390
259757
  });
259391
259758
 
259392
259759
  // src/one-app/access.ts
259393
- import ts26 from "typescript";
259760
+ import ts27 from "typescript";
259394
259761
  import { createHash as createHash87 } from "node:crypto";
259395
259762
  function gateKey(layoutItemId) {
259396
259763
  let out2 = "g_";
@@ -259506,18 +259873,18 @@ function applyEdits(source2, edits) {
259506
259873
  return out2;
259507
259874
  }
259508
259875
  function parse7(fileName, source2) {
259509
- const file2 = ts26.createSourceFile(fileName, source2, ts26.ScriptTarget.Latest, true, ts26.ScriptKind.TS);
259876
+ const file2 = ts27.createSourceFile(fileName, source2, ts27.ScriptTarget.Latest, true, ts27.ScriptKind.TS);
259510
259877
  return file2.parseDiagnostics.length ? void 0 : file2;
259511
259878
  }
259512
259879
  function screensObject(file2) {
259513
259880
  for (const statement of file2.statements) {
259514
- if (!ts26.isVariableStatement(statement)) continue;
259881
+ if (!ts27.isVariableStatement(statement)) continue;
259515
259882
  for (const declaration2 of statement.declarationList.declarations) {
259516
- if (!ts26.isIdentifier(declaration2.name) || declaration2.name.text !== "SCREENS" || !declaration2.initializer) continue;
259883
+ if (!ts27.isIdentifier(declaration2.name) || declaration2.name.text !== "SCREENS" || !declaration2.initializer) continue;
259517
259884
  let init = declaration2.initializer;
259518
- while (ts26.isParenthesizedExpression(init) || ts26.isAsExpression(init) || ts26.isSatisfiesExpression(init)) init = init.expression;
259519
- if (ts26.isCallExpression(init) && init.arguments[0] && ts26.isObjectLiteralExpression(init.arguments[0])) return init.arguments[0];
259520
- if (ts26.isObjectLiteralExpression(init)) return init;
259885
+ while (ts27.isParenthesizedExpression(init) || ts27.isAsExpression(init) || ts27.isSatisfiesExpression(init)) init = init.expression;
259886
+ if (ts27.isCallExpression(init) && init.arguments[0] && ts27.isObjectLiteralExpression(init.arguments[0])) return init.arguments[0];
259887
+ if (ts27.isObjectLiteralExpression(init)) return init;
259521
259888
  }
259522
259889
  }
259523
259890
  return void 0;
@@ -259527,7 +259894,7 @@ function declaredScreens(source2) {
259527
259894
  const screens = file2 && screensObject(file2);
259528
259895
  if (!screens) return void 0;
259529
259896
  const out2 = /* @__PURE__ */ new Set();
259530
- for (const property3 of screens.properties) if (ts26.isPropertyAssignment(property3)) {
259897
+ for (const property3 of screens.properties) if (ts27.isPropertyAssignment(property3)) {
259531
259898
  const name = propName5(property3.name);
259532
259899
  if (name) out2.add(name);
259533
259900
  }
@@ -259536,7 +259903,7 @@ function declaredScreens(source2) {
259536
259903
  function payloadParts(source2, payload) {
259537
259904
  const parts = {};
259538
259905
  for (const property3 of payload.properties) {
259539
- if (!ts26.isPropertyAssignment(property3)) return void 0;
259906
+ if (!ts27.isPropertyAssignment(property3)) return void 0;
259540
259907
  const name = propName5(property3.name);
259541
259908
  if (!name || !PAYLOAD_KEYS.has(name)) return void 0;
259542
259909
  parts[name] = slice(source2, property3.initializer);
@@ -259549,9 +259916,9 @@ function openCase(payload, gate, source2) {
259549
259916
  if (!body || stringValue3(findProperty(body, "type")?.initializer) !== "FragmentSlot" || !props2) return "none";
259550
259917
  if (stringValue3(findProperty(props2, "casePath")?.initializer) !== accessStatePath(gate)) return "none";
259551
259918
  const cases = findProperty(props2, "cases")?.initializer;
259552
- if (!cases || !ts26.isArrayLiteralExpression(cases)) return void 0;
259919
+ if (!cases || !ts27.isArrayLiteralExpression(cases)) return void 0;
259553
259920
  for (const element of cases.elements) {
259554
- if (!ts26.isObjectLiteralExpression(element)) continue;
259921
+ if (!ts27.isObjectLiteralExpression(element)) continue;
259555
259922
  if (stringValue3(findProperty(element, "id")?.initializer) !== "open") continue;
259556
259923
  const content = objectValue(findProperty(element, "content"));
259557
259924
  return content ? payloadParts(source2, content) : void 0;
@@ -259589,7 +259956,7 @@ function applyScreens(source2, gates, context) {
259589
259956
  const conflicts = [];
259590
259957
  const hiding = gates.filter(mayHide);
259591
259958
  const visit = (current) => {
259592
- if (ts26.isPropertyAssignment(current) && propName5(current.name) === "onTap" && ts26.isObjectLiteralExpression(current.initializer) && ts26.isObjectLiteralExpression(current.parent)) {
259959
+ if (ts27.isPropertyAssignment(current) && propName5(current.name) === "onTap" && ts27.isObjectLiteralExpression(current.initializer) && ts27.isObjectLiteralExpression(current.parent)) {
259593
259960
  const params = objectValue(findProperty(current.initializer, "params"));
259594
259961
  const opens = stringValue3(findProperty(current.initializer, "actionId")?.initializer) === "himi.open" ? stringValue3(params && findProperty(params, "screenId")?.initializer) : void 0;
259595
259962
  const gate = hiding.find((item2) => item2.screenId === opens);
@@ -259601,7 +259968,7 @@ function applyScreens(source2, gates, context) {
259601
259968
  } else if (stringValue3(existing.initializer) !== accessRowHiddenPath(gate)) conflicts.push(`an entry opening ${gate.screenId} already has hiddenPath ${slice(source2, existing.initializer)}`);
259602
259969
  }
259603
259970
  }
259604
- ts26.forEachChild(current, visit);
259971
+ ts27.forEachChild(current, visit);
259605
259972
  };
259606
259973
  visit(first);
259607
259974
  if (conflicts.length) return refuse9(conflicts.join("; "));
@@ -259612,7 +259979,7 @@ function applyScreens(source2, gates, context) {
259612
259979
  const missing4 = [];
259613
259980
  const edits = [];
259614
259981
  for (const gate of gates) {
259615
- const screen = screens.properties.find((property3) => ts26.isPropertyAssignment(property3) && propName5(property3.name) === gate.screenId);
259982
+ const screen = screens.properties.find((property3) => ts27.isPropertyAssignment(property3) && propName5(property3.name) === gate.screenId);
259616
259983
  if (!screen) {
259617
259984
  missing4.push(gate.screenId);
259618
259985
  continue;
@@ -259639,7 +260006,7 @@ function applyConfig(configText, gates, options2 = {}) {
259639
260006
  const navigationProperty = app2 && findProperty(app2, "navigation");
259640
260007
  const navigation = objectValue(navigationProperty);
259641
260008
  if (!navigation) return refuse9("config.ts has no literal `navigation: {...}` in its defineApp call");
259642
- if (navigation.properties.some((property3) => !ts26.isPropertyAssignment(property3))) return refuse9("navigation has spreads or accessors, so it cannot be edited safely");
260009
+ if (navigation.properties.some((property3) => !ts27.isPropertyAssignment(property3))) return refuse9("navigation has spreads or accessors, so it cannot be edited safely");
259643
260010
  const edits = [];
259644
260011
  const bound2 = [];
259645
260012
  const conflicts = [];
@@ -259670,7 +260037,7 @@ ${indent}"navLogicBundle": ${indented(headerBadgesBundleRef(ACCESS_NAV_BUNDLE),
259670
260037
  const appBlock = objectValue(appProperty);
259671
260038
  const declared = appBlock && findProperty(appBlock, "newApp");
259672
260039
  if (appProperty && !appBlock) conflicts.push("`app` in config.ts is not an object literal, so `newApp` cannot be added to it safely");
259673
- else if (declared?.initializer.kind !== ts26.SyntaxKind.TrueKeyword) {
260040
+ else if (declared?.initializer.kind !== ts27.SyntaxKind.TrueKeyword) {
259674
260041
  if (declared) conflicts.push("`app.newApp` is declared but not `true`: the page locks need app services, which an app that already shipped older binaries cannot use yet");
259675
260042
  else if (!options2.newApp) return { ...refuse9(NEW_APP_REASON), needsNewApp: true };
259676
260043
  else if (appBlock) edits.push({ start: appBlock.getStart() + 1, end: appBlock.getStart() + 1, replacement: `
@@ -259688,7 +260055,7 @@ ${indent}"app": { "newApp": true },` });
259688
260055
  const itemsOf = (name) => {
259689
260056
  const block = objectValue(findProperty(navigation, name));
259690
260057
  const list4 = block && findProperty(block, "items")?.initializer;
259691
- return list4 && ts26.isArrayLiteralExpression(list4) ? list4.elements.filter(ts26.isObjectLiteralExpression) : [];
260058
+ return list4 && ts27.isArrayLiteralExpression(list4) ? list4.elements.filter(ts27.isObjectLiteralExpression) : [];
259692
260059
  };
259693
260060
  const screenOf = (row2) => stringValue3(findProperty(row2, "screenId")?.initializer);
259694
260061
  const tabs = itemsOf("tabBar");
@@ -259705,7 +260072,7 @@ ${indent}"app": { "newApp": true },` });
259705
260072
  const home2 = [];
259706
260073
  const found = /* @__PURE__ */ new Set();
259707
260074
  const visit = (current) => {
259708
- if (ts26.isObjectLiteralExpression(current) && findProperty(current, "label")) {
260075
+ if (ts27.isObjectLiteralExpression(current) && findProperty(current, "label")) {
259709
260076
  const screenId = stringValue3(findProperty(current, "screenId")?.initializer);
259710
260077
  const gate = hiding.find((item2) => item2.screenId === screenId);
259711
260078
  if (gate) {
@@ -259727,11 +260094,11 @@ ${indent}` });
259727
260094
  edits.push({ start: existing.getStart(), end: existing.getStart(), replacement: `"hiddenUntilResolved": true,
259728
260095
  ${indent}` });
259729
260096
  bound2.push(gate.screenId);
259730
- } else if (resolved3.initializer.kind !== ts26.SyntaxKind.TrueKeyword) conflicts.push(`the entry for ${gate.screenId} sets hiddenUntilResolved to something other than true, which would show a hidden tab before the lock is decided`);
260097
+ } else if (resolved3.initializer.kind !== ts27.SyntaxKind.TrueKeyword) conflicts.push(`the entry for ${gate.screenId} sets hiddenUntilResolved to something other than true, which would show a hidden tab before the lock is decided`);
259731
260098
  }
259732
260099
  }
259733
260100
  }
259734
- ts26.forEachChild(current, visit);
260101
+ ts27.forEachChild(current, visit);
259735
260102
  };
259736
260103
  visit(navigation);
259737
260104
  if (conflicts.length) return refuse9(conflicts.join("; "));
@@ -259747,16 +260114,16 @@ function applyLoginWall(configText, wall, options2 = {}) {
259747
260114
  const authProperty = app2 && findProperty(app2, "auth");
259748
260115
  if (!authProperty) return refuse9("config.ts has no literal `auth: ...` in its defineApp call");
259749
260116
  const init = authProperty.initializer;
259750
- const wrapped = ts26.isCallExpression(init) && ts26.isIdentifier(init.expression) && init.expression.text === LOGIN_HELPER && init.arguments.length === 1;
260117
+ const wrapped = ts27.isCallExpression(init) && ts27.isIdentifier(init.expression) && init.expression.text === LOGIN_HELPER && init.arguments.length === 1;
259751
260118
  if (wall === "none") {
259752
260119
  if (wrapped && options2.keepExisting) return { status: "unchanged", text: configText, kept: true };
259753
260120
  return wrapped ? refuse9("the app requires login (`requireLogin` in config.ts) but the source no longer does: remove it by hand, a login requirement is not taken out automatically") : { status: "unchanged", text: configText };
259754
260121
  }
259755
260122
  if (wrapped) return { status: "unchanged", text: configText };
259756
- const declared = file2.statements.some((statement) => ts26.isVariableStatement(statement) && statement.declarationList.declarations.some((declaration2) => ts26.isIdentifier(declaration2.name) && declaration2.name.text === LOGIN_HELPER));
260123
+ const declared = file2.statements.some((statement) => ts27.isVariableStatement(statement) && statement.declarationList.declarations.some((declaration2) => ts27.isIdentifier(declaration2.name) && declaration2.name.text === LOGIN_HELPER));
259757
260124
  const edits = [{ start: init.getStart(), end: init.getEnd(), replacement: `${LOGIN_HELPER}(${init.getText(file2)})` }];
259758
260125
  if (!declared) {
259759
- const imports = file2.statements.filter(ts26.isImportDeclaration);
260126
+ const imports = file2.statements.filter(ts27.isImportDeclaration);
259760
260127
  const at2 = imports.length ? imports[imports.length - 1].getEnd() : 0;
259761
260128
  edits.push({ start: at2, end: at2, replacement: `
259762
260129
 
@@ -259771,14 +260138,14 @@ function tableGates(tableText) {
259771
260138
  const file2 = parse7("access-gates-table.ts", tableText);
259772
260139
  if (!file2) return void 0;
259773
260140
  for (const statement of file2.statements) {
259774
- if (!ts26.isVariableStatement(statement)) continue;
260141
+ if (!ts27.isVariableStatement(statement)) continue;
259775
260142
  for (const declaration2 of statement.declarationList.declarations) {
259776
- if (!ts26.isIdentifier(declaration2.name) || declaration2.name.text !== "ACCESS_GATES" || !declaration2.initializer) continue;
260143
+ if (!ts27.isIdentifier(declaration2.name) || declaration2.name.text !== "ACCESS_GATES" || !declaration2.initializer) continue;
259777
260144
  let init = declaration2.initializer;
259778
- while (ts26.isParenthesizedExpression(init) || ts26.isAsExpression(init) || ts26.isSatisfiesExpression(init)) init = init.expression;
259779
- if (!ts26.isArrayLiteralExpression(init)) return void 0;
260145
+ while (ts27.isParenthesizedExpression(init) || ts27.isAsExpression(init) || ts27.isSatisfiesExpression(init)) init = init.expression;
260146
+ if (!ts27.isArrayLiteralExpression(init)) return void 0;
259780
260147
  return init.elements.flatMap((element) => {
259781
- if (!ts26.isObjectLiteralExpression(element)) return [];
260148
+ if (!ts27.isObjectLiteralExpression(element)) return [];
259782
260149
  const key4 = stringValue3(findProperty(element, "key")?.initializer);
259783
260150
  if (key4 === void 0) return [];
259784
260151
  return [{ key: key4, layoutItemId: stringValue3(findProperty(element, "layoutItemId")?.initializer) ?? "", screenId: stringValue3(findProperty(element, "screenId")?.initializer) ?? "" }];
@@ -259832,8 +260199,8 @@ var init_access = __esm({
259832
260199
  accessRowHiddenPath = (gate) => `$app:${NAV_SERVICE}.accessHidden.${gate.key}`;
259833
260200
  accessHiddenPath = (gate) => `$service:${NAV_SERVICE}.accessHidden.${gate.key}`;
259834
260201
  slice = (source2, node3) => source2.slice(node3.getStart(), node3.getEnd());
259835
- stringValue3 = (node3) => node3 && (ts26.isStringLiteral(node3) || ts26.isNoSubstitutionTemplateLiteral(node3)) ? node3.text : void 0;
259836
- objectValue = (property3) => property3 && ts26.isObjectLiteralExpression(property3.initializer) ? property3.initializer : void 0;
260202
+ stringValue3 = (node3) => node3 && (ts27.isStringLiteral(node3) || ts27.isNoSubstitutionTemplateLiteral(node3)) ? node3.text : void 0;
260203
+ objectValue = (property3) => property3 && ts27.isObjectLiteralExpression(property3.initializer) ? property3.initializer : void 0;
259837
260204
  PAYLOAD_KEYS = /* @__PURE__ */ new Set(["id", "body", "modifiers"]);
259838
260205
  indented = (value2, indent) => JSON.stringify(value2, null, 2).replaceAll("\n", `
259839
260206
  ${indent}`);
@@ -259844,8 +260211,8 @@ ${indent}`);
259844
260211
 
259845
260212
  // src/one-app/access-cli.ts
259846
260213
  import { createHash as createHash88 } from "node:crypto";
259847
- import { existsSync as existsSync143, readFileSync as readFileSync171, rmSync as rmSync42, statSync as statSync48, writeFileSync as writeFileSync68 } from "node:fs";
259848
- import { join as join179, resolve as resolve111 } from "node:path";
260214
+ import { existsSync as existsSync144, readFileSync as readFileSync172, rmSync as rmSync42, statSync as statSync48, writeFileSync as writeFileSync69 } from "node:fs";
260215
+ import { join as join180, resolve as resolve111 } from "node:path";
259849
260216
  function parseArgs6(args) {
259850
260217
  let evidenceDir;
259851
260218
  let contentDir2;
@@ -259916,7 +260283,7 @@ function parseArgs6(args) {
259916
260283
  if (!evidenceDir || !contentDir2) throw new Error("Both --evidence-dir and --content are required.");
259917
260284
  if (dryRun && check) throw new Error("--dry-run and --check are different modes: pass one.");
259918
260285
  if (screensFile) {
259919
- const parsed = JSON.parse(readFileSync171(resolve111(screensFile), "utf8"));
260286
+ const parsed = JSON.parse(readFileSync172(resolve111(screensFile), "utf8"));
259920
260287
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("--screens-file must hold a JSON object of layoutItemId: screenId.");
259921
260288
  for (const [key4, item2] of Object.entries(parsed)) {
259922
260289
  if (typeof item2 !== "string" || !item2) throw new Error(`--screens-file: ${key4} must map to a screen id.`);
@@ -259933,7 +260300,7 @@ function report8(io2, ok5, body) {
259933
260300
  function businessTitleOf(evidenceDir, given) {
259934
260301
  if (given) return given;
259935
260302
  try {
259936
- const context = JSON.parse(readFileSync171(join179(evidenceDir, "business-context.json"), "utf8"));
260303
+ const context = JSON.parse(readFileSync172(join180(evidenceDir, "business-context.json"), "utf8"));
259937
260304
  if (typeof context.displayName === "string" && context.displayName.trim()) return context.displayName.trim();
259938
260305
  } catch {
259939
260306
  }
@@ -259976,10 +260343,10 @@ function mapCoverage2(options2, plan, raw) {
259976
260343
  return { mapped, kept, conflicts, text: mapped ? JSON.stringify(coverage2, null, 2) + "\n" : void 0 };
259977
260344
  }
259978
260345
  function recordedLoginPolicy(evidenceDir) {
259979
- const manifest2 = JSON.parse(readFileSync171(join179(evidenceDir, "manifest.json"), "utf8"));
260346
+ const manifest2 = JSON.parse(readFileSync172(join180(evidenceDir, "manifest.json"), "utf8"));
259980
260347
  const expected = manifest2.sha256?.["access-policy.json"];
259981
260348
  if (expected === void 0) return void 0;
259982
- const bytes2 = readFileSync171(join179(evidenceDir, "access-policy.json"));
260349
+ const bytes2 = readFileSync172(join180(evidenceDir, "access-policy.json"));
259983
260350
  if (createHash88("sha256").update(bytes2).digest("hex") !== expected) throw new Error("access-policy.json does not match the hash recorded in manifest.json.");
259984
260351
  const value2 = JSON.parse(bytes2.toString("utf8")).visitorModeEnabled;
259985
260352
  return typeof value2 === "boolean" ? value2 : void 0;
@@ -260004,8 +260371,8 @@ async function runOneAppAccess(args, io2) {
260004
260371
  let plan;
260005
260372
  let raw;
260006
260373
  let recorded;
260007
- const tablePath = join179(options2.contentDir, "tier5-src", "_shared", "access-gates-table.ts");
260008
- const tableBefore = existsSync143(tablePath) ? readFileSync171(tablePath, "utf8") : void 0;
260374
+ const tablePath = join180(options2.contentDir, "tier5-src", "_shared", "access-gates-table.ts");
260375
+ const tableBefore = existsSync144(tablePath) ? readFileSync172(tablePath, "utf8") : void 0;
260009
260376
  const writtenGates = tableBefore === void 0 ? [] : tableGates(tableBefore);
260010
260377
  const written = writtenGates ?? [];
260011
260378
  try {
@@ -260017,16 +260384,16 @@ async function runOneAppAccess(args, io2) {
260017
260384
  }
260018
260385
  const common2 = { unmapped: plan.unmapped, warnings: plan.warnings };
260019
260386
  const decision = loginWallOf(options2, recorded);
260020
- const configPath = join179(options2.contentDir, "config.ts");
260021
- const screensPath = join179(options2.contentDir, "dev", "index.ts");
260022
- const enginePath = join179(options2.contentDir, "tier5-src", "_shared", "access-gates.ts");
260023
- const workerPath = join179(options2.contentDir, "tier5-src", ACCESS_NAV_BUNDLE, "index.ts");
260387
+ const configPath = join180(options2.contentDir, "config.ts");
260388
+ const screensPath = join180(options2.contentDir, "dev", "index.ts");
260389
+ const enginePath = join180(options2.contentDir, "tier5-src", "_shared", "access-gates.ts");
260390
+ const workerPath = join180(options2.contentDir, "tier5-src", ACCESS_NAV_BUNDLE, "index.ts");
260024
260391
  let configText;
260025
260392
  let screensText;
260026
260393
  try {
260027
260394
  for (const path2 of [configPath, screensPath]) if (!statSync48(path2).isFile()) throw new Error(`${path2} is not a file.`);
260028
- configText = readFileSync171(configPath, "utf8");
260029
- screensText = readFileSync171(screensPath, "utf8");
260395
+ configText = readFileSync172(configPath, "utf8");
260396
+ screensText = readFileSync172(screensPath, "utf8");
260030
260397
  } catch (error) {
260031
260398
  return report8(io2, false, { code: "app_uninspectable", error: `${errorText(error)} --content must be a Himi content package with config.ts and dev/index.ts.`, ...common2 });
260032
260399
  }
@@ -260059,7 +260426,7 @@ async function runOneAppAccess(args, io2) {
260059
260426
  error: `A locked page is mapped to another screen than the app carries: ${moved.map((m2) => `${m2.layoutItemId} was ${m2.from}, now ${m2.to}`).join("; ")}. The old screen is still wrapped in its lock: restore its original payload (the screen inside the lock's open case) and remove its gate by hand, or keep the earlier mapping.`
260060
260427
  });
260061
260428
  }
260062
- if (hasGates && (!existsSync143(enginePath) || !existsSync143(workerPath))) {
260429
+ if (hasGates && (!existsSync144(enginePath) || !existsSync144(workerPath))) {
260063
260430
  return report8(io2, false, {
260064
260431
  code: "access_engine_missing",
260065
260432
  gates: plan.gates,
@@ -260150,25 +260517,25 @@ async function runOneAppAccess(args, io2) {
260150
260517
  return outOfSync.length ? report8(io2, false, { code: "access_out_of_sync", outOfSync, ...summary2, error: "The app does not carry the source's locked pages and login requirement as they are now: run `himi one-app access` without --check." }) : plan.unmapped.length ? report8(io2, false, { code: "access_out_of_sync", outOfSync: [], ...summary2, error: "A locked page has no Himi screen yet, so the app does not carry it: map it with --screen and run `himi one-app access`." }) : report8(io2, true, { status: "in_sync", ...summary2 });
260151
260518
  }
260152
260519
  if (!options2.dryRun) {
260153
- const ledgerPath = join179(options2.contentDir, COVERAGE_FILE);
260520
+ const ledgerPath = join180(options2.contentDir, COVERAGE_FILE);
260154
260521
  const writes = [
260155
260522
  ...hasGates ? [{ path: tablePath, before: tableBefore, after: table }] : [],
260156
260523
  { path: configPath, before: configText, after: nextConfig },
260157
260524
  ...screensEdit?.status === "written" ? [{ path: screensPath, before: screensText, after: screensEdit.text }] : [],
260158
- ...coverage2.text ? [{ path: ledgerPath, before: existsSync143(ledgerPath) ? readFileSync171(ledgerPath, "utf8") : void 0, after: coverage2.text }] : []
260525
+ ...coverage2.text ? [{ path: ledgerPath, before: existsSync144(ledgerPath) ? readFileSync172(ledgerPath, "utf8") : void 0, after: coverage2.text }] : []
260159
260526
  ].filter((write3) => write3.before !== write3.after);
260160
260527
  const done = [];
260161
260528
  try {
260162
260529
  for (const write3 of writes) {
260163
260530
  done.push(write3);
260164
- writeFileSync68(write3.path, write3.after, "utf8");
260531
+ writeFileSync69(write3.path, write3.after, "utf8");
260165
260532
  }
260166
260533
  } catch (error) {
260167
260534
  const failed3 = [];
260168
260535
  for (const write3 of done.reverse()) {
260169
260536
  try {
260170
260537
  if (write3.before === void 0) rmSync42(write3.path, { force: true });
260171
- else if (!existsSync143(write3.path) || readFileSync171(write3.path, "utf8") !== write3.before) writeFileSync68(write3.path, write3.before, "utf8");
260538
+ else if (!existsSync144(write3.path) || readFileSync172(write3.path, "utf8") !== write3.before) writeFileSync69(write3.path, write3.before, "utf8");
260172
260539
  } catch {
260173
260540
  failed3.push(write3.path);
260174
260541
  }
@@ -260244,8 +260611,8 @@ var init_access_policy = __esm({
260244
260611
  });
260245
260612
 
260246
260613
  // src/one-app/payment-review.ts
260247
- import { readFileSync as readFileSync172 } from "node:fs";
260248
- import { join as join180, resolve as resolve112 } from "node:path";
260614
+ import { readFileSync as readFileSync173 } from "node:fs";
260615
+ import { join as join181, resolve as resolve112 } from "node:path";
260249
260616
  function preservesUnverifiedFlow(flow) {
260250
260617
  const checkout = obj11(flow.checkout);
260251
260618
  return flow.payment === "online-paid" && obj11(flow.readiness).state === "unverified" && checkout.state === "supported" && text24(checkout.evidence) && (flow.decision === void 0 || obj11(flow.decision).action === "proceed");
@@ -260334,7 +260701,7 @@ function runPaymentReview(args, io2) {
260334
260701
  const { manifest: manifest2 } = verifiedEvidence(evidenceDir);
260335
260702
  const metaSiteId = obj11(manifest2.source).metaSiteId;
260336
260703
  if (typeof metaSiteId !== "string") throw Error("Missing site binding");
260337
- const review = JSON.parse(readFileSync172(join180(evidenceDir, "payment-review.json"), "utf8"));
260704
+ const review = JSON.parse(readFileSync173(join181(evidenceDir, "payment-review.json"), "utf8"));
260338
260705
  const issues = paymentReviewIssues(review, metaSiteId);
260339
260706
  if (issues.length) return fail12("payment_decision_required", issues, 1);
260340
260707
  const warnings = obj11(review).flows.map(obj11).filter(preservesUnverifiedFlow).map((flow) => ({
@@ -260524,10 +260891,10 @@ __export(cli_exports2, {
260524
260891
  ONE_APP_WORKFLOW: () => ONE_APP_WORKFLOW,
260525
260892
  runOneAppCommand: () => runOneAppCommand
260526
260893
  });
260527
- import { closeSync as closeSync13, constants as constants12, lstatSync as lstatSync38, mkdirSync as mkdirSync64, openSync as openSync12, readFileSync as readFileSync173, realpathSync as realpathSync23, writeFileSync as writeFileSync69 } from "node:fs";
260894
+ import { closeSync as closeSync13, constants as constants12, lstatSync as lstatSync38, mkdirSync as mkdirSync64, openSync as openSync12, readFileSync as readFileSync174, realpathSync as realpathSync23, writeFileSync as writeFileSync70 } from "node:fs";
260528
260895
  import { createHash as createHash89 } from "node:crypto";
260529
260896
  import { isIP as isIP2 } from "node:net";
260530
- import { dirname as dirname78, join as join181, parse as parse8, resolve as resolve113 } from "node:path";
260897
+ import { dirname as dirname78, join as join182, parse as parse8, resolve as resolve113 } from "node:path";
260531
260898
  function nativeSiteHost(host) {
260532
260899
  if (isIP2(host.startsWith("[") ? host.slice(1, -1) : host)) return true;
260533
260900
  const labels = host.replace(/\.$/, "").split(".");
@@ -260597,7 +260964,7 @@ function readOptions(argv, cwd, commandIncluded) {
260597
260964
  const file2 = resolve113(cwd, flags["prompt-file"]);
260598
260965
  const stat9 = lstatSync38(file2);
260599
260966
  if (!stat9.isFile() || stat9.size > MAX_PROMPT_BYTES) throw new Error("invalid prompt file");
260600
- prompt2 = readFileSync173(file2, "utf8");
260967
+ prompt2 = readFileSync174(file2, "utf8");
260601
260968
  } catch {
260602
260969
  throw new OneAppError("invalid_prompt", "Use a readable text file of at most 64 KiB for --prompt-file.");
260603
260970
  }
@@ -260613,7 +260980,7 @@ function readOptions(argv, cwd, commandIncluded) {
260613
260980
  throw new OneAppError("invalid_output_path", "Pass a parent directory with --dir.");
260614
260981
  }
260615
260982
  const parentDir = resolve113(cwd, flags.dir ?? ".");
260616
- const workspace = join181(parentDir, name);
260983
+ const workspace = join182(parentDir, name);
260617
260984
  assertSafeParents(parentDir);
260618
260985
  if (pathExists(workspace)) throw new OneAppError("output_exists", "The destination already exists. Choose a new --name or --dir.");
260619
260986
  return { metaSiteId, appInstance, locale, prompt: prompt2, name, parentDir, workspace, target, topTabs };
@@ -260648,7 +261015,7 @@ function assertSafeParents(path2) {
260648
261015
  function writePrivate(path2, contents, append) {
260649
261016
  const fd = openSync12(path2, constants12.O_WRONLY | constants12.O_CREAT | constants12.O_NOFOLLOW | (append ? constants12.O_APPEND : constants12.O_EXCL), 384);
260650
261017
  try {
260651
- writeFileSync69(fd, contents, { encoding: "utf8" });
261018
+ writeFileSync70(fd, contents, { encoding: "utf8" });
260652
261019
  } finally {
260653
261020
  closeSync13(fd);
260654
261021
  }
@@ -260735,7 +261102,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
260735
261102
  const hashes = {};
260736
261103
  const diskWrite = deps.writeFile ?? writePrivate;
260737
261104
  const put = (name, content) => {
260738
- const path2 = join181(evidenceDir, name);
261105
+ const path2 = join182(evidenceDir, name);
260739
261106
  try {
260740
261107
  assertSafeParents(evidenceDir);
260741
261108
  diskWrite(path2, content, false);
@@ -260751,7 +261118,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
260751
261118
  if (!evidenceDir) return;
260752
261119
  try {
260753
261120
  assertSafeParents(evidenceDir);
260754
- diskWrite(join181(evidenceDir, "progress.jsonl"), JSON.stringify({ stage, at: now() }) + "\n", true);
261121
+ diskWrite(join182(evidenceDir, "progress.jsonl"), JSON.stringify({ stage, at: now() }) + "\n", true);
260755
261122
  } catch {
260756
261123
  throw new OneAppError("artifact_write_failed", "Could not record migration progress. Existing files were kept.", { stage });
260757
261124
  }
@@ -260772,7 +261139,7 @@ validate-payments checks site-bound payment evidence and explicit paid-flow deci
260772
261139
  assertSafeParents(options2.parentDir);
260773
261140
  mkdirSync64(options2.workspace, { mode: 448 });
260774
261141
  if (realpathSync23(options2.workspace) !== options2.workspace) throw new Error("destination changed");
260775
- evidenceDir = join181(options2.workspace, ".himi", "one-app");
261142
+ evidenceDir = join182(options2.workspace, ".himi", "one-app");
260776
261143
  mkdirSync64(evidenceDir, { recursive: true, mode: 448 });
260777
261144
  } catch (error) {
260778
261145
  if (error.code === "EEXIST") {
@@ -262977,35 +263344,35 @@ var init_analyze2 = __esm({
262977
263344
  });
262978
263345
 
262979
263346
  // src/site-analyze/site-pages-apply.ts
262980
- import { existsSync as existsSync144, readFileSync as readFileSync174 } from "node:fs";
262981
- import { join as join182 } from "node:path";
262982
- import ts27 from "typescript";
263347
+ import { existsSync as existsSync145, readFileSync as readFileSync175 } from "node:fs";
263348
+ import { join as join183 } from "node:path";
263349
+ import ts28 from "typescript";
262983
263350
  function packageScreenIds(dir) {
262984
- const dev = join182(dir, "dev", "index.ts");
262985
- const config = join182(dir, "config.ts");
262986
- if (!existsSync144(dev) || !existsSync144(config)) return void 0;
263351
+ const dev = join183(dir, "dev", "index.ts");
263352
+ const config = join183(dir, "config.ts");
263353
+ if (!existsSync145(dev) || !existsSync145(config)) return void 0;
262987
263354
  try {
262988
- const app2 = parseApp(readFileSync174(dev, "utf8"), readFileSync174(config, "utf8"));
263355
+ const app2 = parseApp(readFileSync175(dev, "utf8"), readFileSync175(config, "utf8"));
262989
263356
  return new Set(app2.routes.filter((r3) => r3.kind === "screen").map((r3) => r3.label));
262990
263357
  } catch {
262991
263358
  return void 0;
262992
263359
  }
262993
263360
  }
262994
263361
  function spliceWebsiteDrawer(source2, site, fileName = "config.ts") {
262995
- const file2 = ts27.createSourceFile(fileName, source2, ts27.ScriptTarget.Latest, true, ts27.ScriptKind.TS);
263362
+ const file2 = ts28.createSourceFile(fileName, source2, ts28.ScriptTarget.Latest, true, ts28.ScriptKind.TS);
262996
263363
  const objectOf2 = (literal3, name) => {
262997
263364
  if (!literal3) return void 0;
262998
263365
  const found = lookup(literal3, name);
262999
263366
  const value2 = found.kind === "written" ? unwrap(found.node.initializer) : void 0;
263000
- return value2 && ts27.isObjectLiteralExpression(value2) ? value2 : void 0;
263367
+ return value2 && ts28.isObjectLiteralExpression(value2) ? value2 : void 0;
263001
263368
  };
263002
263369
  const navigation = objectOf2(defineAppLiteral(file2), "navigation");
263003
263370
  if (!navigation) return { refused: "config.ts has no `navigation: { \u2026 }` object literal in its defineApp call" };
263004
263371
  const drawer = objectOf2(navigation, "drawer");
263005
263372
  const itemsProp = drawer ? lookup(drawer, "items") : void 0;
263006
263373
  const items = itemsProp?.kind === "written" ? unwrap(itemsProp.node.initializer) : void 0;
263007
- if (!items || !ts27.isArrayLiteralExpression(items)) return { refused: "`navigation.drawer.items` is not an array literal this step can rewrite" };
263008
- const commentAt = (pos) => (ts27.getLeadingCommentRanges(source2, pos) ?? []).length > 0;
263374
+ if (!items || !ts28.isArrayLiteralExpression(items)) return { refused: "`navigation.drawer.items` is not an array literal this step can rewrite" };
263375
+ const commentAt = (pos) => (ts28.getLeadingCommentRanges(source2, pos) ?? []).length > 0;
263009
263376
  if (items.elements.some((element) => commentAt(element.pos)) || commentAt(items.elements.end)) {
263010
263377
  return { refused: "`navigation.drawer.items` has comments between its rows, which rewriting the drawer would drop" };
263011
263378
  }
@@ -263034,12 +263401,12 @@ ${indent}`);
263034
263401
  }
263035
263402
  function applySitePagesToPackage(dir, site, opts = {}) {
263036
263403
  const none = (refused2) => ({ added: [], replaced: [], removed: [], rows: [], wrote: [], refused: refused2 });
263037
- const devPath = join182(dir, "dev", "index.ts");
263038
- const configPath = join182(dir, "config.ts");
263039
- if (!existsSync144(devPath) || !existsSync144(configPath)) return none("the package has no dev/index.ts + config.ts to add website pages to");
263404
+ const devPath = join183(dir, "dev", "index.ts");
263405
+ const configPath = join183(dir, "config.ts");
263406
+ if (!existsSync145(devPath) || !existsSync145(configPath)) return none("the package has no dev/index.ts + config.ts to add website pages to");
263040
263407
  let existing;
263041
263408
  try {
263042
- const app2 = parseApp(readFileSync174(devPath, "utf8"), readFileSync174(configPath, "utf8"));
263409
+ const app2 = parseApp(readFileSync175(devPath, "utf8"), readFileSync175(configPath, "utf8"));
263043
263410
  existing = app2.routes.filter((r3) => r3.kind === "screen" && isWebsiteScreenId(r3.label)).map((r3) => r3.label);
263044
263411
  } catch (e2) {
263045
263412
  return none(`the package is not in the plain-JSON shape \`himi init\` writes, which this step edits (${e2.message})`);
@@ -263049,21 +263416,21 @@ function applySitePagesToPackage(dir, site, opts = {}) {
263049
263416
  const removed = existing.filter((id) => !wanted.includes(id));
263050
263417
  const added = wanted.filter((id) => !existing.includes(id));
263051
263418
  const replaced = wanted.filter((id) => existing.includes(id));
263052
- const probe2 = spliceWebsiteDrawer(readFileSync174(configPath, "utf8"), site);
263419
+ const probe2 = spliceWebsiteDrawer(readFileSync175(configPath, "utf8"), site);
263053
263420
  if ("refused" in probe2) return none(probe2.refused);
263054
263421
  if (opts.dryRun) return { added, replaced, removed, rows: probe2.rows, wrote: [] };
263055
- const before = new Map(["dev/index.ts", "config.ts", "himalaya.content.json"].map((rel2) => [rel2, existsSync144(join182(dir, rel2)) ? readFileSync174(join182(dir, rel2), "utf8") : void 0]));
263422
+ const before = new Map(["dev/index.ts", "config.ts", "himalaya.content.json"].map((rel2) => [rel2, existsSync145(join183(dir, rel2)) ? readFileSync175(join183(dir, rel2), "utf8") : void 0]));
263056
263423
  try {
263057
263424
  if (removed.length) removeScreens(dir, removed);
263058
263425
  if (wanted.length) upsertScreens(dir, screens);
263059
- const spliced = spliceWebsiteDrawer(readFileSync174(configPath, "utf8"), site);
263426
+ const spliced = spliceWebsiteDrawer(readFileSync175(configPath, "utf8"), site);
263060
263427
  if ("refused" in spliced) throw new TrimRefusal(spliced.refused);
263061
- if (spliced.source !== readFileSync174(configPath, "utf8")) writeFileAtomic(configPath, spliced.source);
263428
+ if (spliced.source !== readFileSync175(configPath, "utf8")) writeFileAtomic(configPath, spliced.source);
263062
263429
  } catch (e2) {
263063
- for (const [rel2, text25] of before) if (text25 !== void 0 && readFileSync174(join182(dir, rel2), "utf8") !== text25) writeFileAtomic(join182(dir, rel2), text25);
263430
+ for (const [rel2, text25] of before) if (text25 !== void 0 && readFileSync175(join183(dir, rel2), "utf8") !== text25) writeFileAtomic(join183(dir, rel2), text25);
263064
263431
  return none(`stopped and restored every file: ${e2.message}`);
263065
263432
  }
263066
- const wrote = [...before].filter(([rel2, text25]) => text25 !== void 0 && readFileSync174(join182(dir, rel2), "utf8") !== text25).map(([rel2]) => join182(dir, rel2));
263433
+ const wrote = [...before].filter(([rel2, text25]) => text25 !== void 0 && readFileSync175(join183(dir, rel2), "utf8") !== text25).map(([rel2]) => join183(dir, rel2));
263067
263434
  return { added, replaced, removed, rows: probe2.rows, wrote };
263068
263435
  }
263069
263436
  var ANCHOR_ROWS;
@@ -263091,8 +263458,8 @@ var init_customer_build = __esm({
263091
263458
  });
263092
263459
 
263093
263460
  // src/site-analyze/apply.ts
263094
- import { existsSync as existsSync145, readFileSync as readFileSync175, writeFileSync as writeFileSync70, copyFileSync as copyFileSync2, mkdirSync as mkdirSync65, realpathSync as realpathSync24, statSync as statSync49 } from "node:fs";
263095
- import { dirname as dirname79, isAbsolute as isAbsolute17, join as join183, resolve as resolve114, sep as sep30 } from "node:path";
263461
+ import { existsSync as existsSync146, readFileSync as readFileSync176, writeFileSync as writeFileSync71, copyFileSync as copyFileSync2, mkdirSync as mkdirSync65, realpathSync as realpathSync24, statSync as statSync49 } from "node:fs";
263462
+ import { dirname as dirname79, isAbsolute as isAbsolute17, join as join184, resolve as resolve114, sep as sep30 } from "node:path";
263096
263463
  import { spawnSync as spawnSync11 } from "node:child_process";
263097
263464
  function inRepoBakeRefusal(repoRoot2, shell) {
263098
263465
  if (isBrandable(repoRoot2, shell)) return null;
@@ -263245,16 +263612,16 @@ function sameKnownSite(previous, next) {
263245
263612
  }
263246
263613
  function buildMergedContract(options2) {
263247
263614
  const { appDir: appDir3, packageDir, overlay } = options2;
263248
- const committedPath = join183(appDir3, "provisioning.json");
263249
- if (!existsSync145(committedPath)) {
263615
+ const committedPath = join184(appDir3, "provisioning.json");
263616
+ if (!existsSync146(committedPath)) {
263250
263617
  throw new Error(`shell has no committed provisioning.json at ${committedPath} to build a contract from`);
263251
263618
  }
263252
- const committed = JSON.parse(readFileSync175(committedPath, "utf8"));
263253
- const previousPath = join183(appDir3, LOCAL_CONTRACT_REL);
263619
+ const committed = JSON.parse(readFileSync176(committedPath, "utf8"));
263620
+ const previousPath = join184(appDir3, LOCAL_CONTRACT_REL);
263254
263621
  let evidenceOverlay = overlay;
263255
- if ((overlay.businessContact === void 0 || overlay.loyalty === void 0 || overlay.businessTimeZone === void 0) && existsSync145(previousPath)) {
263622
+ if ((overlay.businessContact === void 0 || overlay.loyalty === void 0 || overlay.businessTimeZone === void 0) && existsSync146(previousPath)) {
263256
263623
  try {
263257
- const previous = JSON.parse(readFileSync175(previousPath, "utf8"));
263624
+ const previous = JSON.parse(readFileSync176(previousPath, "utf8"));
263258
263625
  if (previous && typeof previous === "object" && !Array.isArray(previous) && sameKnownSite(previous, overlay)) {
263259
263626
  evidenceOverlay = {
263260
263627
  ...overlay,
@@ -263267,9 +263634,9 @@ function buildMergedContract(options2) {
263267
263634
  }
263268
263635
  }
263269
263636
  let keepSite = options2.keepSite === true;
263270
- if (!keepSite && options2.sitePageHost && existsSync145(previousPath)) {
263637
+ if (!keepSite && options2.sitePageHost && existsSync146(previousPath)) {
263271
263638
  try {
263272
- const carried = websiteSiteToCarry(JSON.parse(readFileSync175(previousPath, "utf8")), overlay);
263639
+ const carried = websiteSiteToCarry(JSON.parse(readFileSync176(previousPath, "utf8")), overlay);
263273
263640
  if (carried) {
263274
263641
  evidenceOverlay = { ...evidenceOverlay, site: carried };
263275
263642
  keepSite = true;
@@ -263288,8 +263655,8 @@ function buildMergedContract(options2) {
263288
263655
  };
263289
263656
  const stage = (fromRel, toRel) => {
263290
263657
  const from = contained(packageDir, fromRel);
263291
- const to2 = contained(join183(appDir3, STAGED), toRel.slice(STAGED.length + 1));
263292
- if (!from || !to2 || !existsSync145(from)) return void 0;
263658
+ const to2 = contained(join184(appDir3, STAGED), toRel.slice(STAGED.length + 1));
263659
+ if (!from || !to2 || !existsSync146(from)) return void 0;
263293
263660
  let real;
263294
263661
  let realRoot;
263295
263662
  try {
@@ -263311,11 +263678,11 @@ function buildMergedContract(options2) {
263311
263678
  };
263312
263679
  const icon = stage("media/icon.png", `${STAGED}/icon.png`);
263313
263680
  if (icon) branding.appIconPath = icon;
263314
- const facesPath = join183(packageDir, "media/fonts/faces.json");
263315
- if (existsSync145(facesPath)) {
263681
+ const facesPath = join184(packageDir, "media/fonts/faces.json");
263682
+ if (existsSync146(facesPath)) {
263316
263683
  let faces = [];
263317
263684
  try {
263318
- const parsed = JSON.parse(readFileSync175(facesPath, "utf8"));
263685
+ const parsed = JSON.parse(readFileSync176(facesPath, "utf8"));
263319
263686
  faces = Array.isArray(parsed) ? parsed : [];
263320
263687
  } catch {
263321
263688
  faces = [];
@@ -263336,11 +263703,11 @@ function buildMergedContract(options2) {
263336
263703
  merged.branding = branding;
263337
263704
  const body = `${JSON.stringify(merged, null, 2)}
263338
263705
  `;
263339
- const path2 = join183(packageDir, "provisioning.contract.json");
263340
- writeFileSync70(path2, body);
263341
- const localPath2 = join183(appDir3, LOCAL_CONTRACT_REL);
263706
+ const path2 = join184(packageDir, "provisioning.contract.json");
263707
+ writeFileSync71(path2, body);
263708
+ const localPath2 = join184(appDir3, LOCAL_CONTRACT_REL);
263342
263709
  mkdirSync65(dirname79(localPath2), { recursive: true });
263343
- writeFileSync70(localPath2, body);
263710
+ writeFileSync71(localPath2, body);
263344
263711
  staged.push(localPath2);
263345
263712
  return { path: path2, staged };
263346
263713
  }
@@ -263373,10 +263740,10 @@ function catalogTypography(overlay, template) {
263373
263740
  function staticFaqFor(overlay, overlayPath) {
263374
263741
  const own6 = overlay.faq;
263375
263742
  if (own6 !== void 0) return deriveStaticFaq(own6);
263376
- const bookPath = join183(dirname79(resolve114(overlayPath)), "book.json");
263377
- if (!existsSync145(bookPath)) return void 0;
263743
+ const bookPath = join184(dirname79(resolve114(overlayPath)), "book.json");
263744
+ if (!existsSync146(bookPath)) return void 0;
263378
263745
  try {
263379
- const book = JSON.parse(readFileSync175(bookPath, "utf8"));
263746
+ const book = JSON.parse(readFileSync176(bookPath, "utf8"));
263380
263747
  const copy = book?.copy;
263381
263748
  if (!copy || typeof copy !== "object" || copy.unavailable) return void 0;
263382
263749
  const pairs2 = deriveStaticFaq(copy.faq);
@@ -263390,10 +263757,10 @@ function staticGalleriesFor(overlay, overlayPath) {
263390
263757
  if (overlay.galleries !== void 0) return deriveStaticGalleries(
263391
263758
  overlay.galleries.map((gallery) => ({ role: "gallery", title: gallery.title, galleryImageUrls: gallery.photos }))
263392
263759
  );
263393
- const bookPath = join183(dirname79(resolve114(overlayPath)), "book.json");
263394
- if (!existsSync145(bookPath)) return void 0;
263760
+ const bookPath = join184(dirname79(resolve114(overlayPath)), "book.json");
263761
+ if (!existsSync146(bookPath)) return void 0;
263395
263762
  try {
263396
- const book = JSON.parse(readFileSync175(bookPath, "utf8"));
263763
+ const book = JSON.parse(readFileSync176(bookPath, "utf8"));
263397
263764
  if (!book.look || book.look.unavailable || !Array.isArray(book.look.pages)) return void 0;
263398
263765
  const galleries = deriveStaticGalleries(book.look.pages);
263399
263766
  return galleries.length || book.look.complete === true ? galleries : void 0;
@@ -263407,12 +263774,12 @@ async function applyOverlays(input) {
263407
263774
  assertKnownShell(shell);
263408
263775
  const pagesRefusal = input.sitePages ? sitePagesTargetRefusal({ cwd, shell }) : void 0;
263409
263776
  if (pagesRefusal) throw Object.assign(new Error(pagesRefusal.error), { exit: 2, code: pagesRefusal.code });
263410
- const overlay = JSON.parse(readFileSync175(input.overlayPath, "utf8"));
263777
+ const overlay = JSON.parse(readFileSync176(input.overlayPath, "utf8"));
263411
263778
  const sitePages = input.sitePages === true;
263412
263779
  const plan = input.sitePagesPlan;
263413
263780
  const planNote = sitePages && plan ? plan.notes[0] : void 0;
263414
263781
  const sitePagesOut = (screens) => sitePages && plan ? { sitePages: { site: plan.site, native: plan.native, skipped: plan.skipped, ...screens ? { screens } : {} } } : {};
263415
- const tokens2 = JSON.parse(readFileSync175(input.tokensPath, "utf8"));
263782
+ const tokens2 = JSON.parse(readFileSync176(input.tokensPath, "utf8"));
263416
263783
  const faq = staticFaqFor(overlay, input.overlayPath);
263417
263784
  if (faq !== void 0) overlay.faq = faq;
263418
263785
  const galleries = staticGalleriesFor(overlay, input.overlayPath);
@@ -263426,15 +263793,15 @@ async function applyOverlays(input) {
263426
263793
  if (repoRoot2) {
263427
263794
  const bakeRefusal = inRepoBakeRefusal(repoRoot2, shell);
263428
263795
  if (bakeRefusal) throw Object.assign(new Error(bakeRefusal), { exit: 2, code: APPLY_SHELL_CANNOT_BAKE });
263429
- const appDir3 = join183(repoRoot2, shellAppDir(shell));
263430
- assertOverlayNamesSite(join183(appDir3, "provisioning.json"), overlay, `shell "${shell}"`, ` --shell ${shell}`);
263796
+ const appDir3 = join184(repoRoot2, shellAppDir(shell));
263797
+ assertOverlayNamesSite(join184(appDir3, "provisioning.json"), overlay, `shell "${shell}"`, ` --shell ${shell}`);
263431
263798
  const packageDir = dirname79(resolve114(input.overlayPath));
263432
263799
  if (input.dryRun) {
263433
263800
  return {
263434
263801
  mode: "dry",
263435
263802
  target: "in-repo",
263436
263803
  wrote: [],
263437
- wouldWrite: [join183(packageDir, "provisioning.contract.json"), join183(appDir3, LOCAL_CONTRACT_REL), `${appDir3} (npm run prepare:customer)`],
263804
+ wouldWrite: [join184(packageDir, "provisioning.contract.json"), join184(appDir3, LOCAL_CONTRACT_REL), `${appDir3} (npm run prepare:customer)`],
263438
263805
  note: [planNote, "dry run: nothing written \u2014 without --dry-run this merges the contract and runs prepare:customer"].filter(Boolean).join(" \xB7 "),
263439
263806
  ...sitePagesOut()
263440
263807
  };
@@ -263461,7 +263828,7 @@ async function applyOverlays(input) {
263461
263828
  note: `${planNote ? `${planNote} \xB7 ` : ""}prepare:customer --contract with a merged contract (committed provisioning.json untouched)${unpairedInRepo ? ` \xB7 ${unpairedInRepo}` : ""}`
263462
263829
  };
263463
263830
  }
263464
- const pkgProv = join183(cwd, "provisioning.json");
263831
+ const pkgProv = join184(cwd, "provisioning.json");
263465
263832
  assertNotCommitted(pkgProv, input.forbiddenProvisioning);
263466
263833
  assertOverlayNamesSite(pkgProv, overlay, "this content package", "");
263467
263834
  if (input.dryRun) {
@@ -263474,16 +263841,16 @@ async function applyOverlays(input) {
263474
263841
  wrote: [],
263475
263842
  wouldWrite: [
263476
263843
  pkgProv,
263477
- ...existsSync145(join183(cwd, "tokens.json")) && (tokens2.colors || tokens2.typography) ? [join183(cwd, "tokens.json")] : [],
263478
- ...existsSync145(join183(cwd, "dev/index.ts")) ? [join183(cwd, "dev/index.ts")] : [],
263479
- ...touchesPackage ? [join183(cwd, "config.ts"), join183(cwd, "himalaya.content.json")] : [],
263480
- ...input.iconPath && existsSync145(input.iconPath) ? [join183(cwd, "icon.png")] : []
263844
+ ...existsSync146(join184(cwd, "tokens.json")) && (tokens2.colors || tokens2.typography) ? [join184(cwd, "tokens.json")] : [],
263845
+ ...existsSync146(join184(cwd, "dev/index.ts")) ? [join184(cwd, "dev/index.ts")] : [],
263846
+ ...touchesPackage ? [join184(cwd, "config.ts"), join184(cwd, "himalaya.content.json")] : [],
263847
+ ...input.iconPath && existsSync146(input.iconPath) ? [join184(cwd, "icon.png")] : []
263481
263848
  ],
263482
263849
  note: [planNote, pages2?.refused ? `website pages not added: ${pages2.refused}` : void 0, "dry run: nothing written"].filter(Boolean).join(" \xB7 "),
263483
263850
  ...sitePagesOut(screens)
263484
263851
  };
263485
263852
  }
263486
- const contentPath = join183(cwd, "himalaya.content.json");
263853
+ const contentPath = join184(cwd, "himalaya.content.json");
263487
263854
  const syncViewNames = (before, after) => {
263488
263855
  const content = readContentManifest(cwd);
263489
263856
  if (!content) return;
@@ -263497,8 +263864,8 @@ async function applyOverlays(input) {
263497
263864
  const recordSite = sitePages && !pagesRefused;
263498
263865
  let packageFaq = faq;
263499
263866
  let packageGalleries = galleries;
263500
- if (existsSync145(pkgProv)) {
263501
- const cur = JSON.parse(readFileSync175(pkgProv, "utf8"));
263867
+ if (existsSync146(pkgProv)) {
263868
+ const cur = JSON.parse(readFileSync176(pkgProv, "utf8"));
263502
263869
  if (galleries === void 0 && !sameKnownSite(cur, overlay)) overlay.galleries = [];
263503
263870
  const merged = deepMerge4(cur, overlay);
263504
263871
  if (overlay.businessContact !== void 0) merged.businessContact = overlay.businessContact;
@@ -263518,20 +263885,20 @@ async function applyOverlays(input) {
263518
263885
  } else {
263519
263886
  syncViewNames(cur.site, merged.site);
263520
263887
  }
263521
- writeFileSync70(pkgProv, JSON.stringify(merged, null, 2) + "\n");
263888
+ writeFileSync71(pkgProv, JSON.stringify(merged, null, 2) + "\n");
263522
263889
  wrote.push(pkgProv);
263523
263890
  } else {
263524
263891
  if (!sitePages) syncViewNames(void 0, overlay.site);
263525
263892
  const { site: _unrecorded, ...withoutSite } = overlay;
263526
- writeFileSync70(pkgProv, JSON.stringify(sitePages && !recordSite ? withoutSite : overlay, null, 2) + "\n");
263893
+ writeFileSync71(pkgProv, JSON.stringify(sitePages && !recordSite ? withoutSite : overlay, null, 2) + "\n");
263527
263894
  wrote.push(pkgProv);
263528
263895
  }
263529
263896
  if (Array.isArray(packageGalleries) && packageGalleries.length && !overlay.installedVerticals.includes("galleries")) {
263530
263897
  overlay.installedVerticals.push("galleries");
263531
263898
  }
263532
- const pkgTokens = join183(cwd, "tokens.json");
263533
- if (existsSync145(pkgTokens) && (tokens2.colors || tokens2.typography)) {
263534
- const cur = JSON.parse(readFileSync175(pkgTokens, "utf8"));
263899
+ const pkgTokens = join184(cwd, "tokens.json");
263900
+ if (existsSync146(pkgTokens) && (tokens2.colors || tokens2.typography)) {
263901
+ const cur = JSON.parse(readFileSync176(pkgTokens, "utf8"));
263535
263902
  let tokensIn = tokens2;
263536
263903
  if (tokens2.typography) {
263537
263904
  const fonts = catalogTypography(tokens2.typography, cur.typography);
@@ -263552,13 +263919,13 @@ async function applyOverlays(input) {
263552
263919
  if (primary && glow && typeof glow.color === "string") glow.color = primary;
263553
263920
  stripBrandFromIdiom(merged);
263554
263921
  }
263555
- writeFileSync70(pkgTokens, JSON.stringify(merged, null, 2) + "\n");
263922
+ writeFileSync71(pkgTokens, JSON.stringify(merged, null, 2) + "\n");
263556
263923
  wrote.push(pkgTokens);
263557
263924
  }
263558
263925
  const homeAction = homeRefreshActionId(shell);
263559
- const homeSrc = join183(cwd, "dev/index.ts");
263560
- if (homeAction && existsSync145(homeSrc)) {
263561
- const prev = readFileSync175(homeSrc, "utf8");
263926
+ const homeSrc = join184(cwd, "dev/index.ts");
263927
+ if (homeAction && existsSync146(homeSrc)) {
263928
+ const prev = readFileSync176(homeSrc, "utf8");
263562
263929
  const patched = patchBrandParams(prev, overlay, homeAction);
263563
263930
  let next = patched.src;
263564
263931
  if (!patched.foreign && faq?.length && prev.includes('"tier5.himiBrandedFaq.load"') && !prev.includes('"staticFaq"')) {
@@ -263586,7 +263953,7 @@ async function applyOverlays(input) {
263586
263953
  }
263587
263954
  }
263588
263955
  if (next !== prev) {
263589
- writeFileSync70(homeSrc, next);
263956
+ writeFileSync71(homeSrc, next);
263590
263957
  wrote.push(homeSrc);
263591
263958
  }
263592
263959
  if (patched.unparsed) {
@@ -263601,13 +263968,13 @@ async function applyOverlays(input) {
263601
263968
  if (pages2.refused) notes.push(`website pages not added: ${pages2.refused}`);
263602
263969
  else pageScreens = { added: pages2.added, replaced: pages2.replaced, removed: pages2.removed, rows: pages2.rows };
263603
263970
  }
263604
- if (!input.iconPath || !existsSync145(input.iconPath)) {
263971
+ if (!input.iconPath || !existsSync146(input.iconPath)) {
263605
263972
  const book = input.iconPath ? dirname79(dirname79(resolve114(input.iconPath))) : void 0;
263606
263973
  notes.push(
263607
263974
  book ? `no icon installed \u2014 ${siteLogoAbsence(book).hint}` : "no icon installed and no business book to say why \u2014 `himi icon generate` draws one from the accent, or `himi icon set <file.png>` installs the customer's own mark"
263608
263975
  );
263609
263976
  }
263610
- if (input.iconPath && existsSync145(input.iconPath)) {
263977
+ if (input.iconPath && existsSync146(input.iconPath)) {
263611
263978
  try {
263612
263979
  const installed3 = await installIcon(cwd, input.iconPath, { derivePlay: true });
263613
263980
  wrote.push(...installed3.wrote);
@@ -264658,7 +265025,7 @@ __export(cli_exports3, {
264658
265025
  sitePagesRefusal: () => sitePagesRefusal,
264659
265026
  targetIsSiteShell: () => targetIsSiteShell
264660
265027
  });
264661
- import { existsSync as existsSync146, readFileSync as readFileSync176 } from "node:fs";
265028
+ import { existsSync as existsSync147, readFileSync as readFileSync177 } from "node:fs";
264662
265029
  import { resolve as resolve115 } from "node:path";
264663
265030
  function sitePagesRefusal(opts) {
264664
265031
  const shell = opts.shell ?? DEFAULT_BRANDABLE_SHELL;
@@ -264748,9 +265115,9 @@ async function runSiteAnalyze(opts) {
264748
265115
  if (book?.skipped) result.warnings = [...result.warnings ?? [], book.skipped];
264749
265116
  const derived2 = deriveSiteShell({ siteUrl: result.book.input.siteUrl, look: result.book.look, kind, routes });
264750
265117
  const prevOverlayPath = resolve115(outDir, "provisioning.overlay.json");
264751
- const prevSite = existsSync146(prevOverlayPath) ? (() => {
265118
+ const prevSite = existsSync147(prevOverlayPath) ? (() => {
264752
265119
  try {
264753
- return JSON.parse(readFileSync176(prevOverlayPath, "utf8")).site;
265120
+ return JSON.parse(readFileSync177(prevOverlayPath, "utf8")).site;
264754
265121
  } catch {
264755
265122
  return void 0;
264756
265123
  }
@@ -264796,7 +265163,7 @@ async function runSiteAnalyze(opts) {
264796
265163
  }
264797
265164
  const previousOverlay = resolve115(outDir, "provisioning.overlay.json");
264798
265165
  carryOverGoals(
264799
- existsSync146(previousOverlay) ? readFileSync176(previousOverlay, "utf8") : void 0,
265166
+ existsSync147(previousOverlay) ? readFileSync177(previousOverlay, "utf8") : void 0,
264800
265167
  result.provisioningOverlay
264801
265168
  );
264802
265169
  const ownerCall = ownerAuth ? ownerTransportFrom(fetchImpl, ownerAuth) : void 0;
@@ -264859,7 +265226,7 @@ async function runSiteFunctionCli(opts) {
264859
265226
  let source2;
264860
265227
  if (opts.sourcePath) {
264861
265228
  const p2 = resolve115(opts.cwd ?? process.cwd(), opts.sourcePath);
264862
- source2 = readFileSync176(p2, "utf8");
265229
+ source2 = readFileSync177(p2, "utf8");
264863
265230
  }
264864
265231
  let body;
264865
265232
  if (opts.bodyRaw != null) {
@@ -264887,9 +265254,9 @@ async function runSiteFunctionCli(opts) {
264887
265254
  });
264888
265255
  }
264889
265256
  function base44BookRoutes(bookPath, siteUrl) {
264890
- if (!existsSync146(bookPath)) return void 0;
265257
+ if (!existsSync147(bookPath)) return void 0;
264891
265258
  try {
264892
- const book = JSON.parse(readFileSync176(bookPath, "utf8"));
265259
+ const book = JSON.parse(readFileSync177(bookPath, "utf8"));
264893
265260
  if (book.kind !== "base44-app-book" || !Array.isArray(book.routes)) return void 0;
264894
265261
  const host = (u2) => {
264895
265262
  try {
@@ -265061,7 +265428,7 @@ __export(site_create_exports, {
265061
265428
  runSiteList: () => runSiteList,
265062
265429
  writeProvisioningBinding: () => writeProvisioningBinding
265063
265430
  });
265064
- import { existsSync as existsSync147, readFileSync as readFileSync177, writeFileSync as writeFileSync71 } from "node:fs";
265431
+ import { existsSync as existsSync148, readFileSync as readFileSync178, writeFileSync as writeFileSync72 } from "node:fs";
265065
265432
  import { resolve as resolvePath4 } from "node:path";
265066
265433
  function oauthClientName(projectName) {
265067
265434
  return `${projectName} client`;
@@ -265210,7 +265577,7 @@ async function runSiteCreate(opts) {
265210
265577
  if (!wantOauthApp) return { ...base2, nextSteps: nextSteps(metaSiteId) };
265211
265578
  return { ...base2, clientId, redirectUri, nextSteps: nextSteps(metaSiteId, clientId) };
265212
265579
  }
265213
- function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync147, readFileSync: readFileSync177, writeFileSync: writeFileSync71 }) {
265580
+ function writeProvisioningBinding(target, binding2, fs2 = { existsSync: existsSync148, readFileSync: readFileSync178, writeFileSync: writeFileSync72 }) {
265214
265581
  const msid = binding2.siteId;
265215
265582
  const path2 = resolvePath4(target);
265216
265583
  const committed = committedShellProvisioning(path2);
@@ -265627,7 +265994,7 @@ var init_site_oauth_client = __esm({
265627
265994
 
265628
265995
  // src/site-analyze/velo-source.ts
265629
265996
  import path from "node:path";
265630
- import ts28 from "typescript";
265997
+ import ts29 from "typescript";
265631
265998
  function applySourceEdits(source2, edits) {
265632
265999
  const chunks = [];
265633
266000
  let cursor = 0;
@@ -265645,13 +266012,13 @@ function redactVeloSource(source2, knownSecrets = []) {
265645
266012
  /\b(?:IST\.[\w.-]+|eyJ[\w-]+\.[\w-]+\.[\w-]+|(?:sk|rk)_(?:live|test)_[\w-]+|gh[pousr]_[\w]+|github_pat_[\w]+|AKIA[A-Z0-9]{16})\b/g,
265646
266013
  REDACTED2
265647
266014
  ).replace(/\b(?:Bearer|Basic)\s+[A-Za-z0-9._~+/=-]+/gi, REDACTED2).replace(/\b([a-z][a-z0-9+.-]*:\/\/)[^\s/'"`]+:[^\s/'"`]+@/gi, "$1[REDACTED]@").replace(/([?&](?:api[-_]?key|token|secret|password|signature)=)[^&#\s'"`]+/gi, "$1[REDACTED]");
265648
- const parsed = ts28.createSourceFile("backend.ts", source2, ts28.ScriptTarget.Latest, true);
266015
+ const parsed = ts29.createSourceFile("backend.ts", source2, ts29.ScriptTarget.Latest, true);
265649
266016
  const comments = /* @__PURE__ */ new Map();
265650
266017
  const visitComments = (node3) => {
265651
266018
  for (const range of [
265652
- ...ts28.getLeadingCommentRanges(source2, node3.pos) ?? [],
265653
- ...ts28.getTrailingCommentRanges(source2, node3.pos) ?? [],
265654
- ...ts28.getTrailingCommentRanges(source2, node3.end) ?? []
266019
+ ...ts29.getLeadingCommentRanges(source2, node3.pos) ?? [],
266020
+ ...ts29.getTrailingCommentRanges(source2, node3.pos) ?? [],
266021
+ ...ts29.getTrailingCommentRanges(source2, node3.end) ?? []
265655
266022
  ]) comments.set(range.pos, range.end);
265656
266023
  for (const child3 of node3.getChildren(parsed)) visitComments(child3);
265657
266024
  };
@@ -265670,22 +266037,22 @@ function redactVeloSource(source2, knownSecrets = []) {
265670
266037
  if (/^["'`][A-Za-z0-9_+/=-]{24,}["'`]$/.test(token)) return JSON.stringify(REDACTED2);
265671
266038
  return token;
265672
266039
  };
265673
- const clean3 = ts28.createSourceFile("backend.ts", source2, ts28.ScriptTarget.Latest, true);
266040
+ const clean3 = ts29.createSourceFile("backend.ts", source2, ts29.ScriptTarget.Latest, true);
265674
266041
  const masks = [];
265675
266042
  const collectMasks = (node3) => {
265676
266043
  const start = node3.getStart(clean3);
265677
- if (ts28.isRegularExpressionLiteral(node3)) {
266044
+ if (ts29.isRegularExpressionLiteral(node3)) {
265678
266045
  masks.push({ start, end: node3.end, text: " ".repeat(node3.end - start) });
265679
- } else if (ts28.isStringLiteral(node3) || ts28.isTemplateLiteralToken(node3)) {
266046
+ } else if (ts29.isStringLiteral(node3) || ts29.isTemplateLiteralToken(node3)) {
265680
266047
  masks.push({ start, end: node3.end, text: source2.slice(start, node3.end).replace(/;/g, " ") });
265681
266048
  }
265682
- ts28.forEachChild(node3, collectMasks);
266049
+ ts29.forEachChild(node3, collectMasks);
265683
266050
  };
265684
266051
  collectMasks(clean3);
265685
266052
  const assignmentContext = applySourceEdits(source2, masks);
265686
266053
  const edits = [];
265687
266054
  const visitLiterals = (node3) => {
265688
- if (ts28.isStringLiteral(node3) || ts28.isNoSubstitutionTemplateLiteral(node3) || ts28.isTemplateExpression(node3)) {
266055
+ if (ts29.isStringLiteral(node3) || ts29.isNoSubstitutionTemplateLiteral(node3) || ts29.isTemplateExpression(node3)) {
265689
266056
  const start = node3.getStart(clean3);
265690
266057
  const text25 = source2.slice(start, node3.end);
265691
266058
  const redacted = redactLiteral(text25, start);
@@ -265694,7 +266061,7 @@ function redactVeloSource(source2, knownSecrets = []) {
265694
266061
  return;
265695
266062
  }
265696
266063
  }
265697
- ts28.forEachChild(node3, visitLiterals);
266064
+ ts29.forEachChild(node3, visitLiterals);
265698
266065
  };
265699
266066
  visitLiterals(clean3);
265700
266067
  return applySourceEdits(source2, edits);
@@ -265733,19 +266100,19 @@ function selectVeloSource(files, request2, knownSecrets = []) {
265733
266100
  selected.set(file2.path, { source: excerpt, sourceTruncated: excerpt.length < redacted.length });
265734
266101
  remaining -= excerpt.length;
265735
266102
  const dependencies = [];
265736
- const parsed = ts28.createSourceFile(file2.path, file2.content, ts28.ScriptTarget.Latest, true);
266103
+ const parsed = ts29.createSourceFile(file2.path, file2.content, ts29.ScriptTarget.Latest, true);
265737
266104
  const specifiers = [];
265738
266105
  const collectImports = (node3) => {
265739
266106
  let specifier;
265740
- if (ts28.isImportDeclaration(node3) || ts28.isExportDeclaration(node3)) {
266107
+ if (ts29.isImportDeclaration(node3) || ts29.isExportDeclaration(node3)) {
265741
266108
  specifier = node3.moduleSpecifier;
265742
- } else if (ts28.isImportEqualsDeclaration(node3) && ts28.isExternalModuleReference(node3.moduleReference)) {
266109
+ } else if (ts29.isImportEqualsDeclaration(node3) && ts29.isExternalModuleReference(node3.moduleReference)) {
265743
266110
  specifier = node3.moduleReference.expression;
265744
- } else if (ts28.isCallExpression(node3) && (node3.expression.kind === ts28.SyntaxKind.ImportKeyword || ts28.isIdentifier(node3.expression) && node3.expression.text === "require")) {
266111
+ } else if (ts29.isCallExpression(node3) && (node3.expression.kind === ts29.SyntaxKind.ImportKeyword || ts29.isIdentifier(node3.expression) && node3.expression.text === "require")) {
265745
266112
  specifier = node3.arguments[0];
265746
266113
  }
265747
- if (specifier && ts28.isStringLiteralLike(specifier)) specifiers.push(specifier.text);
265748
- ts28.forEachChild(node3, collectImports);
266114
+ if (specifier && ts29.isStringLiteralLike(specifier)) specifiers.push(specifier.text);
266115
+ ts29.forEachChild(node3, collectImports);
265749
266116
  };
265750
266117
  collectImports(parsed);
265751
266118
  for (const specifier of specifiers) {
@@ -266078,26 +266445,26 @@ __export(capture_exports, {
266078
266445
  nativeNotConfigured: () => nativeNotConfigured,
266079
266446
  variantWidth: () => variantWidth
266080
266447
  });
266081
- import { existsSync as existsSync148, mkdirSync as mkdirSync66, rmSync as rmSync43, writeFileSync as writeFileSync72 } from "node:fs";
266082
- import { join as join184 } from "node:path";
266448
+ import { existsSync as existsSync149, mkdirSync as mkdirSync66, rmSync as rmSync43, writeFileSync as writeFileSync73 } from "node:fs";
266449
+ import { join as join185 } from "node:path";
266083
266450
  import { pathToFileURL as pathToFileURL11 } from "node:url";
266084
266451
  function variantWidth(variant) {
266085
266452
  return variant === "tablet" ? renderDeviceWidths().tablet : PHONE_WIDTH;
266086
266453
  }
266087
266454
  function frameFile(outDir, screen, variant, surface) {
266088
266455
  mkdirSync66(outDir, { recursive: true });
266089
- return join184(outDir, `${screen}.${variant}.${surface}.png`);
266456
+ return join185(outDir, `${screen}.${variant}.${surface}.png`);
266090
266457
  }
266091
266458
  async function captureMockup(root, screen, entry, variant, outDir, session) {
266092
266459
  if (!entry.mockup) throw new MockupMissingError(`screen ${screen} declares no mockup in hhp.json`);
266093
266460
  const file2 = localPath(root, entry.mockup);
266094
- if (!existsSync148(file2)) throw new MockupMissingError(`screen ${screen}: mockup ${entry.mockup} does not exist`);
266461
+ if (!existsSync149(file2)) throw new MockupMissingError(`screen ${screen}: mockup ${entry.mockup} does not exist`);
266095
266462
  const own6 = session ?? new MockupSession();
266096
266463
  try {
266097
266464
  const png = await own6.shoot(file2, variant);
266098
266465
  const noReference = variant === "dark" && !await own6.stylesDark(file2);
266099
266466
  const out2 = frameFile(outDir, screen, variant, "mockup");
266100
- writeFileSync72(out2, png);
266467
+ writeFileSync73(out2, png);
266101
266468
  return { surface: "mockup", screen, variant, file: out2, ...noReference ? { noReference: true } : {} };
266102
266469
  } finally {
266103
266470
  if (!session) await own6.close();
@@ -266123,7 +266490,7 @@ async function captureWebVariant(root, variant, outDir, screens) {
266123
266490
  const built = await buildContentBundles2(root, { resolution: resolutionFlag2({}) });
266124
266491
  const out2 = /* @__PURE__ */ new Map();
266125
266492
  if (built.compileErrors.length) return compileFailureFrames(built.compileErrors, screens, variant);
266126
- const scratch = join184(outDir, `.build-${variant}`);
266493
+ const scratch = join185(outDir, `.build-${variant}`);
266127
266494
  try {
266128
266495
  const outcome = await buildReleaseFromContent2(root, scratch, {
266129
266496
  ...built.built.length || built.compileErrors.length ? { tier5Dir: bundleOutDir2(root) } : {},
@@ -266142,7 +266509,7 @@ async function captureWebVariant(root, variant, outDir, screens) {
266142
266509
  const r3 = (outcome.renders ?? []).find((x2) => x2.screenId === screen);
266143
266510
  if (r3?.pngBase64) {
266144
266511
  const file2 = frameFile(outDir, screen, variant, "web");
266145
- writeFileSync72(file2, Buffer.from(r3.pngBase64, "base64"));
266512
+ writeFileSync73(file2, Buffer.from(r3.pngBase64, "base64"));
266146
266513
  out2.set(screen, { surface: "web", screen, variant, file: file2 });
266147
266514
  } else {
266148
266515
  const reason = !r3 ? "screen did not build" : r3.pngUnavailable ? "no Playwright Chromium for the web PNG" : r3.reason ?? "web render produced no PNG";
@@ -266230,9 +266597,9 @@ var init_capture = __esm({
266230
266597
 
266231
266598
  // src/fidelity/judge.ts
266232
266599
  import { spawn as spawn9 } from "node:child_process";
266233
- import { copyFileSync as copyFileSync3, mkdtempSync as mkdtempSync12, readFileSync as readFileSync178, rmSync as rmSync44 } from "node:fs";
266600
+ import { copyFileSync as copyFileSync3, mkdtempSync as mkdtempSync12, readFileSync as readFileSync179, rmSync as rmSync44 } from "node:fs";
266234
266601
  import { tmpdir as tmpdir13 } from "node:os";
266235
- import { basename as basename38, dirname as dirname80, join as join185, resolve as resolve116 } from "node:path";
266602
+ import { basename as basename38, dirname as dirname80, join as join186, resolve as resolve116 } from "node:path";
266236
266603
  import { fileURLToPath as fileURLToPath40 } from "node:url";
266237
266604
  function parseVerdict(value2, captured) {
266238
266605
  const v2 = value2;
@@ -266272,8 +266639,8 @@ async function judgeStrip(strip3, screen, variant, opts = {}) {
266272
266639
  const judgeDir = opts.judgeDir ?? SOURCE_JUDGE_DIR;
266273
266640
  let prompt2, schema2;
266274
266641
  try {
266275
- prompt2 = readFileSync178(resolve116(judgeDir, "JUDGE.md"), "utf8");
266276
- schema2 = readFileSync178(resolve116(judgeDir, "verdict.schema.json"), "utf8");
266642
+ prompt2 = readFileSync179(resolve116(judgeDir, "JUDGE.md"), "utf8");
266643
+ schema2 = readFileSync179(resolve116(judgeDir, "verdict.schema.json"), "utf8");
266277
266644
  } catch (e2) {
266278
266645
  return cannotTell(`the judge prompt could not be read from ${judgeDir}: ${e2.message}`);
266279
266646
  }
@@ -266282,10 +266649,10 @@ async function judgeStrip(strip3, screen, variant, opts = {}) {
266282
266649
  "",
266283
266650
  `Screen \`${screen}\`, variant \`${variant}\`. Read the strip image at ./${basename38(strip3)} and judge it.`
266284
266651
  ].join("\n");
266285
- const cwd = mkdtempSync12(join185(tmpdir13(), "himi-fidelity-judge-"));
266652
+ const cwd = mkdtempSync12(join186(tmpdir13(), "himi-fidelity-judge-"));
266286
266653
  let r3;
266287
266654
  try {
266288
- copyFileSync3(strip3, join185(cwd, basename38(strip3)));
266655
+ copyFileSync3(strip3, join186(cwd, basename38(strip3)));
266289
266656
  r3 = await run3("claude", judgeArgs(schema2), { cwd, input, timeoutMs });
266290
266657
  } catch (e2) {
266291
266658
  return cannotTell(`the judge could not be prepared: ${e2.message}`);
@@ -266344,7 +266711,7 @@ var init_judge = __esm({
266344
266711
  // src/fidelity/score.ts
266345
266712
  import { spawn as spawn10 } from "node:child_process";
266346
266713
  import { mkdtempSync as mkdtempSync13, rmSync as rmSync45 } from "node:fs";
266347
- import { join as join186 } from "node:path";
266714
+ import { join as join187 } from "node:path";
266348
266715
  import { tmpdir as tmpdir14 } from "node:os";
266349
266716
  function viewportHeight(width) {
266350
266717
  return Math.round(width * 2.165);
@@ -266366,10 +266733,10 @@ async function scorePair(aFile, bFile, opts = {}) {
266366
266733
  const sizes = await Promise.all([aFile, bFile].map(async (f2) => (await magick(run3, ["identify", "-format", "%w %h", f2])).split(" ").map(Number)));
266367
266734
  const width = Math.min(sizes[0][0], sizes[1][0]);
266368
266735
  const height = Math.min(...sizes.map(([w2, h2]) => Math.round(h2 * width / w2)), viewportHeight(width));
266369
- const dir = mkdtempSync13(join186(tmpdir14(), "himi-fidelity-score-"));
266736
+ const dir = mkdtempSync13(join187(tmpdir14(), "himi-fidelity-score-"));
266370
266737
  try {
266371
266738
  const norm3 = await Promise.all([aFile, bFile].map(async (f2, i2) => {
266372
- const out2 = join186(dir, `${i2}.png`);
266739
+ const out2 = join187(dir, `${i2}.png`);
266373
266740
  const mask = opts.mask ?? { top: 0, bottom: 0 };
266374
266741
  const draw = [
266375
266742
  ...mask.top > 0 ? ["-draw", `rectangle 0,0 ${width},${mask.top - 1}`] : [],
@@ -266410,8 +266777,8 @@ var init_score = __esm({
266410
266777
  });
266411
266778
 
266412
266779
  // ../visual-proof/evidence.mjs
266413
- import { existsSync as existsSync149, rmSync as rmSync46 } from "node:fs";
266414
- function resolveCaptionFont({ exists: exists2 = existsSync149, env = process.env } = {}) {
266780
+ import { existsSync as existsSync150, rmSync as rmSync46 } from "node:fs";
266781
+ function resolveCaptionFont({ exists: exists2 = existsSync150, env = process.env } = {}) {
266415
266782
  if (env?.VISUAL_PROOF_FONT) return env.VISUAL_PROOF_FONT;
266416
266783
  return CAPTION_FONT_CANDIDATES.find((p2) => exists2(p2)) ?? null;
266417
266784
  }
@@ -266445,7 +266812,7 @@ var init_evidence = __esm({
266445
266812
 
266446
266813
  // src/fidelity/strip.ts
266447
266814
  import { mkdtempSync as mkdtempSync14, rmSync as rmSync47 } from "node:fs";
266448
- import { join as join187 } from "node:path";
266815
+ import { join as join188 } from "node:path";
266449
266816
  import { tmpdir as tmpdir15 } from "node:os";
266450
266817
  async function buildStrip(frames, out2, opts = {}) {
266451
266818
  const run3 = opts.run ?? runProcess;
@@ -266454,7 +266821,7 @@ async function buildStrip(frames, out2, opts = {}) {
266454
266821
  const { pointsize, strip: strip3 } = labelMetrics(width);
266455
266822
  const font = resolveCaptionFont();
266456
266823
  const fontArgs = font ? ["-font", font] : [];
266457
- const dir = mkdtempSync14(join187(tmpdir15(), "himi-fidelity-strip-"));
266824
+ const dir = mkdtempSync14(join188(tmpdir15(), "himi-fidelity-strip-"));
266458
266825
  const magick2 = async (args) => {
266459
266826
  const r3 = await run3("magick", args);
266460
266827
  if (r3.code !== 0) throw new Error(`magick failed building the strip: ${r3.stderr.trim() || `exit ${r3.code}`}`);
@@ -266464,7 +266831,7 @@ async function buildStrip(frames, out2, opts = {}) {
266464
266831
  for (const surface of STRIP_ORDER) {
266465
266832
  const frame = frames.find((f2) => f2.surface === surface);
266466
266833
  if (!frame) continue;
266467
- const pane = join187(dir, `${surface}.png`);
266834
+ const pane = join188(dir, `${surface}.png`);
266468
266835
  const body = frame.file ? [frame.file, "-alpha", "remove", "-resize", `${width}x`, "-crop", `${width}x${height}+0+0`, "+repage", "-background", "white", "-gravity", "north", "-extent", `${width}x${height}`] : ["-size", `${width}x${height}`, "xc:#d9d9d9", ...fontArgs, "-fill", "#333", "-pointsize", String(Math.round(pointsize * 0.8)), "-gravity", "center", "-annotate", "+0+0", `skipped: ${frame.skipped?.reason ?? "no capture"}`];
266469
266836
  const label4 = `${surface.toUpperCase()}${frame.noReference ? " (no reference)" : ""}`;
266470
266837
  await magick2([...body, "-gravity", "north", "-background", "#111", "-splice", `0x${strip3}`, ...fontArgs, "-fill", "white", "-pointsize", String(pointsize), "-annotate", "+0+4", label4, pane]);
@@ -266500,8 +266867,8 @@ __export(run_exports2, {
266500
266867
  runId: () => runId,
266501
266868
  unlinkableScreens: () => unlinkableScreens
266502
266869
  });
266503
- import { mkdirSync as mkdirSync67, writeFileSync as writeFileSync73 } from "node:fs";
266504
- import { basename as basename39, join as join188 } from "node:path";
266870
+ import { mkdirSync as mkdirSync67, writeFileSync as writeFileSync74 } from "node:fs";
266871
+ import { basename as basename39, join as join189 } from "node:path";
266505
266872
  function unlinkableScreens(config, screens, home2) {
266506
266873
  const navigation = config?.navigation;
266507
266874
  const linkables = Array.isArray(navigation?.linkableScreens) ? navigation.linkableScreens : [];
@@ -266560,8 +266927,8 @@ async function runFidelity(root, opts = {}) {
266560
266927
  if (unknown.length) throw Object.assign(new Error(`unknown screen(s): ${unknown.join(", ")}`), { code: "fidelity_unknown_screen" });
266561
266928
  const variants = opts.variants?.length ? opts.variants : VARIANTS;
266562
266929
  const run3 = opts.run ?? runId();
266563
- const dir = join188(opts.outRoot ?? join188(root, ".himi", "fidelity"), run3);
266564
- const framesDir = join188(dir, "frames");
266930
+ const dir = join189(opts.outRoot ?? join189(root, ".himi", "fidelity"), run3);
266931
+ const framesDir = join189(dir, "frames");
266565
266932
  mkdirSync67(framesDir, { recursive: true });
266566
266933
  const session = opts.capture?.mockup ? void 0 : new MockupSession();
266567
266934
  const mockup = opts.capture?.mockup ?? ((r3, s5, e2, v2, o2) => captureMockup(r3, s5, e2, v2, o2, session));
@@ -266612,7 +266979,7 @@ async function runFidelity(root, opts = {}) {
266612
266979
  let stripFile;
266613
266980
  let verdict;
266614
266981
  const judged2 = frames.filter((f2) => !f2.noReference);
266615
- const stripPath2 = join188(dir, `${screen}.${variant}.strip.png`);
266982
+ const stripPath2 = join189(dir, `${screen}.${variant}.strip.png`);
266616
266983
  if (!w2?.file || judged2.filter((f2) => f2.file).length < 2) {
266617
266984
  if (frames.some((f2) => f2.file)) stripFile = await strip3(frames, stripPath2);
266618
266985
  verdict = skippedJudge(!w2?.file ? "no web render, and web is the reference for both design and parity" : frames.some((f2) => f2.noReference) ? `the mockup does not style ${variant}, and there is no native pane to compare with web` : "fewer than two captured panes, so there is nothing to compare");
@@ -266636,7 +267003,7 @@ async function runFidelity(root, opts = {}) {
266636
267003
  await native?.restore?.();
266637
267004
  }
266638
267005
  const report9 = { app: basename39(root), run: run3, dir, rows, status: worst(rows) };
266639
- writeFileSync73(join188(dir, "report.json"), JSON.stringify(report9, null, 2) + "\n");
267006
+ writeFileSync74(join189(dir, "report.json"), JSON.stringify(report9, null, 2) + "\n");
266640
267007
  return report9;
266641
267008
  }
266642
267009
  function prCommentBody(report9) {
@@ -266690,15 +267057,15 @@ __export(native_exports, {
266690
267057
  parseAppLocales: () => parseAppLocales,
266691
267058
  parseNightMode: () => parseNightMode,
266692
267059
  parsePlistArray: () => parsePlistArray,
266693
- pngSize: () => pngSize3,
267060
+ pngSize: () => pngSize4,
266694
267061
  resumedPackages: () => resumedPackages,
266695
267062
  runWithTimeout: () => runWithTimeout,
266696
267063
  sameLocalOrigin: () => sameLocalOrigin,
266697
267064
  screenLink: () => screenLink
266698
267065
  });
266699
267066
  import { spawn as spawn11 } from "node:child_process";
266700
- import { readFileSync as readFileSync179, writeFileSync as writeFileSync74 } from "node:fs";
266701
- import { join as join189 } from "node:path";
267067
+ import { readFileSync as readFileSync180, writeFileSync as writeFileSync75 } from "node:fs";
267068
+ import { join as join190 } from "node:path";
266702
267069
  function resumedPackages(dumpsys) {
266703
267070
  const lines2 = dumpsys.split("\n").filter((l3) => /\b(?:topResumedActivity|mResumedActivity|ResumedActivity)\b/.test(l3));
266704
267071
  if (!lines2.length) return void 0;
@@ -266728,7 +267095,7 @@ function runWithTimeout(cmd, args, timeoutMs) {
266728
267095
  });
266729
267096
  });
266730
267097
  }
266731
- function pngSize3(buf) {
267098
+ function pngSize4(buf) {
266732
267099
  if (buf.length < 24 || buf.readUInt32BE(0) !== 2303741511) return void 0;
266733
267100
  return { width: buf.readUInt32BE(16), height: buf.readUInt32BE(20) };
266734
267101
  }
@@ -266753,7 +267120,7 @@ function nativeCapture(devices, opts) {
266753
267120
  return r3;
266754
267121
  };
266755
267122
  const gone = /* @__PURE__ */ new Set();
266756
- const read2 = opts.readFile ?? ((p2) => readFileSync179(p2));
267123
+ const read2 = opts.readFile ?? ((p2) => readFileSync180(p2));
266757
267124
  const sleep2 = opts.sleep ?? ((ms2) => new Promise((r3) => setTimeout(r3, ms2)));
266758
267125
  const settleMs = opts.settleMs ?? 1e3;
266759
267126
  const maxWaitMs = opts.maxWaitMs ?? 3e4;
@@ -266845,7 +267212,7 @@ function nativeCapture(devices, opts) {
266845
267212
  const container = await run3("xcrun", ["simctl", "get_app_container", id, iosBundle, "app"]);
266846
267213
  let compiled = "";
266847
267214
  if (container.code === 0) {
266848
- const plist = await run3("plutil", ["-extract", "HimalayaAPIBaseURL", "raw", "-o", "-", join189(container.stdout.toString().trim(), "Info.plist")]);
267215
+ const plist = await run3("plutil", ["-extract", "HimalayaAPIBaseURL", "raw", "-o", "-", join190(container.stdout.toString().trim(), "Info.plist")]);
266849
267216
  if (plist.code === 0) compiled = plist.stdout.toString().trim();
266850
267217
  }
266851
267218
  const rebuild = `HIMALAYA_API_BASE_URL_INFO=${opts.serveOrigin}`;
@@ -266860,7 +267227,7 @@ function nativeCapture(devices, opts) {
266860
267227
  }
266861
267228
  const r3 = await run3("adb", ["-s", id, "exec-out", "screencap", "-p"]);
266862
267229
  if (r3.code !== 0) throw new Error(`adb -s ${id} exec-out screencap -p exited ${r3.code}`);
266863
- writeFileSync74(file2, r3.stdout);
267230
+ writeFileSync75(file2, r3.stdout);
266864
267231
  return r3.stdout;
266865
267232
  }
266866
267233
  async function notInFront(platform, id) {
@@ -266916,7 +267283,7 @@ function nativeCapture(devices, opts) {
266916
267283
  }
266917
267284
  await apply2(platform, id, variant);
266918
267285
  await open3(platform, id, `himi://app/${encodeURIComponent(picker)}`);
266919
- const file2 = join189(outDir, `${screen}.${variant}.${platform}.png`);
267286
+ const file2 = join190(outDir, `${screen}.${variant}.${platform}.png`);
266920
267287
  const pickerFrame = (await settle2(platform, id, file2)).frame;
266921
267288
  await open3(platform, id, screenLink(opts.appId, screen, entry, opts.release));
266922
267289
  const { unsettled } = await settle2(platform, id, file2, pickerFrame);
@@ -266935,7 +267302,7 @@ function nativeCapture(devices, opts) {
266935
267302
  continue;
266936
267303
  }
266937
267304
  }
266938
- const size = pngSize3(read2(file2));
267305
+ const size = pngSize4(read2(file2));
266939
267306
  if (size && size.width > size.height) {
266940
267307
  frames.push({ surface: platform, screen, variant, skipped: { reason: `the ${platform} frame is landscape (${size.width}x${size.height}): turn the device upright` } });
266941
267308
  continue;
@@ -267017,15 +267384,15 @@ __export(serve_exports, {
267017
267384
  releaseProblem: () => releaseProblem,
267018
267385
  serveWorkingCopy: () => serveWorkingCopy
267019
267386
  });
267020
- import { copyFileSync as copyFileSync4, existsSync as existsSync150, mkdirSync as mkdirSync68, mkdtempSync as mkdtempSync15, rmSync as rmSync48 } from "node:fs";
267387
+ import { copyFileSync as copyFileSync4, existsSync as existsSync151, mkdirSync as mkdirSync68, mkdtempSync as mkdtempSync15, rmSync as rmSync48 } from "node:fs";
267021
267388
  import { tmpdir as tmpdir16 } from "node:os";
267022
- import { join as join190 } from "node:path";
267389
+ import { join as join191 } from "node:path";
267023
267390
  function copyFreshBundles(built, outDir, into) {
267024
267391
  mkdirSync68(into, { recursive: true });
267025
267392
  for (const name of built) {
267026
267393
  for (const file2 of [`${name}.bundle.js`, `${name}.bundle.js.map`]) {
267027
- const from = join190(outDir, file2);
267028
- if (existsSync150(from)) copyFileSync4(from, join190(into, file2));
267394
+ const from = join191(outDir, file2);
267395
+ if (existsSync151(from)) copyFileSync4(from, join191(into, file2));
267029
267396
  }
267030
267397
  }
267031
267398
  }
@@ -267041,7 +267408,7 @@ async function serveWorkingCopy(dir, port) {
267041
267408
  const { buildContentBundles: buildContentBundles2, buildReleaseFromContent: buildReleaseFromContent2 } = await loadAuthoring();
267042
267409
  const bundles = await buildContentBundles2(dir, {});
267043
267410
  if (bundles.compileErrors.length) throw new Error(`the content package's workers do not compile (${bundles.compileErrors.length} error(s)); run \`himi build\` to see them`);
267044
- const temp = mkdtempSync15(join190(tmpdir16(), "himi-fidelity-serve-"));
267411
+ const temp = mkdtempSync15(join191(tmpdir16(), "himi-fidelity-serve-"));
267045
267412
  const cleanup = () => rmSync48(temp, { recursive: true, force: true });
267046
267413
  const onSignal = () => {
267047
267414
  cleanup();
@@ -267050,12 +267417,12 @@ async function serveWorkingCopy(dir, port) {
267050
267417
  process.once("SIGINT", onSignal);
267051
267418
  process.once("SIGTERM", onSignal);
267052
267419
  try {
267053
- const tier5Dir = bundles.built.length > 0 ? join190(temp, ".tier5") : void 0;
267420
+ const tier5Dir = bundles.built.length > 0 ? join191(temp, ".tier5") : void 0;
267054
267421
  if (tier5Dir) copyFreshBundles(bundles.built, bundles.outDir, tier5Dir);
267055
267422
  const outcome = await buildReleaseFromContent2(dir, temp, { ...tier5Dir ? { tier5Dir } : {}, ...RUN_CONTENT_BUILD });
267056
267423
  const unservable = releaseProblem(outcome);
267057
267424
  if (unservable) throw new Error(unservable);
267058
- const served = await runPackage(join190(temp, app2), { port, host: "127.0.0.1", chrome: "app", open: false, workDir: temp });
267425
+ const served = await runPackage(join191(temp, app2), { port, host: "127.0.0.1", chrome: "app", open: false, workDir: temp });
267059
267426
  return { origin: served.origin, close: async () => {
267060
267427
  await served.close();
267061
267428
  cleanup();
@@ -267108,8 +267475,8 @@ __export(fidelity_exports, {
267108
267475
  himalayaRepoRoot: () => himalayaRepoRoot
267109
267476
  });
267110
267477
  import { execFileSync as execFileSync10 } from "node:child_process";
267111
- import { existsSync as existsSync151, realpathSync as realpathSync25 } from "node:fs";
267112
- import { join as join191, relative as relative33, sep as sep31 } from "node:path";
267478
+ import { existsSync as existsSync152, realpathSync as realpathSync25 } from "node:fs";
267479
+ import { join as join192, relative as relative33, sep as sep31 } from "node:path";
267113
267480
  function himalayaRepoRoot(dir) {
267114
267481
  let top;
267115
267482
  try {
@@ -267117,7 +267484,7 @@ function himalayaRepoRoot(dir) {
267117
267484
  } catch {
267118
267485
  return null;
267119
267486
  }
267120
- if (!existsSync151(join191(top, "tools/judges/fidelity/JUDGE.md"))) return null;
267487
+ if (!existsSync152(join192(top, "tools/judges/fidelity/JUDGE.md"))) return null;
267121
267488
  const rel2 = relative33(realpathSync25(top), realpathSync25(dir));
267122
267489
  return rel2.startsWith(`..${sep31}`) || rel2 === ".." ? null : top;
267123
267490
  }
@@ -267127,7 +267494,7 @@ function fidelityEnvelope(report9) {
267127
267494
  async function fidelityCommand(ctx) {
267128
267495
  const { io: io2, flags, print } = ctx;
267129
267496
  const dir = contentDir(flags);
267130
- if (!existsSync151(dir)) {
267497
+ if (!existsSync152(dir)) {
267131
267498
  io2.error(failure2("fidelity_bad_flag", `content dir ${dir} does not exist`));
267132
267499
  return 2;
267133
267500
  }
@@ -267150,7 +267517,7 @@ async function fidelityCommand(ctx) {
267150
267517
  return 2;
267151
267518
  }
267152
267519
  const { runFidelity: runFidelity2, prCommentBody: prCommentBody2 } = await Promise.resolve().then(() => (init_run3(), run_exports2));
267153
- const judgeDir = join191(repo, "tools/judges/fidelity");
267520
+ const judgeDir = join192(repo, "tools/judges/fidelity");
267154
267521
  const deviceFlags = { ios: "ios", android: "android", iosTablet: "ios-tablet", androidTablet: "android-tablet" };
267155
267522
  const bare = Object.values(deviceFlags).filter((f2) => flags[f2] !== void 0 && !str3(flags[f2]));
267156
267523
  if (bare.length) {
@@ -267256,7 +267623,7 @@ async function fidelityCommand(ctx) {
267256
267623
  else {
267257
267624
  for (const r3 of report9.rows) io2.log(`${r3.status.padEnd(4)} ${r3.screen}/${r3.variant} design=${r3.judge.design} parity=${r3.judge.parity}${r3.reasons.length ? ` \u2014 ${r3.reasons[0]}` : ""}`);
267258
267625
  io2.log(`
267259
- ${report9.status.toUpperCase()} \u2014 report: ${join191(report9.dir, "report.json")}`);
267626
+ ${report9.status.toUpperCase()} \u2014 report: ${join192(report9.dir, "report.json")}`);
267260
267627
  }
267261
267628
  return report9.status === "fail" ? 1 : 0;
267262
267629
  }
@@ -267345,9 +267712,9 @@ async function publishSizeCommand(ctx) {
267345
267712
  return fail12("build_failed", "publish-size requires the contained authoring runtime; host-realm overrides are unavailable");
267346
267713
  }
267347
267714
  const dir = contentDir2(flags);
267348
- const { existsSync: existsSync153 } = await import("node:fs");
267349
- const { join: join193 } = await import("node:path");
267350
- if (!existsSync153(join193(dir, "dev", "index.ts"))) return fail12("build_failed", "expected a content package with dev/index.ts; pass --content <dir>");
267715
+ const { existsSync: existsSync154 } = await import("node:fs");
267716
+ const { join: join194 } = await import("node:path");
267717
+ if (!existsSync154(join194(dir, "dev", "index.ts"))) return fail12("build_failed", "expected a content package with dev/index.ts; pass --content <dir>");
267351
267718
  const declared = await appId3(dir);
267352
267719
  const app2 = typeof flags.app === "string" ? flags.app : declared;
267353
267720
  if (!isValidAppId(app2)) return fail12("invalid_usage", "declared app is not a valid publish ID; pass --app <valid-slug>", { app: app2 }, 2);
@@ -267459,9 +267826,9 @@ __export(ext_impl_exports, {
267459
267826
  addExtensionToConfigSource: () => addExtensionToConfigSource,
267460
267827
  runExt: () => runExt
267461
267828
  });
267462
- import { existsSync as existsSync152, mkdirSync as mkdirSync69, readFileSync as readFileSync180, writeFileSync as writeFileSync75 } from "node:fs";
267463
- import { join as join192 } from "node:path";
267464
- import ts29 from "typescript";
267829
+ import { existsSync as existsSync153, mkdirSync as mkdirSync69, readFileSync as readFileSync181, writeFileSync as writeFileSync76 } from "node:fs";
267830
+ import { join as join193 } from "node:path";
267831
+ import ts30 from "typescript";
267465
267832
  async function runExt(ctx) {
267466
267833
  const { pos, flags, io: io2, print } = ctx;
267467
267834
  const fail12 = (code2, error, extra = {}, exit = 1) => {
@@ -267491,8 +267858,8 @@ async function runExt(ctx) {
267491
267858
  hint: `run \`himi capabilities ${catalogId}\` for how to use it, or pass --force to create the extension anyway`
267492
267859
  }, 2);
267493
267860
  }
267494
- const configPath = join192(dir, "config.ts");
267495
- if (!existsSync152(configPath)) return fail12("extensions_config_missing", `no config.ts in ${dir}; run this inside a content package (or pass --content)`);
267861
+ const configPath = join193(dir, "config.ts");
267862
+ if (!existsSync153(configPath)) return fail12("extensions_config_missing", `no config.ts in ${dir}; run this inside a content package (or pass --content)`);
267496
267863
  const declared = declaredExtensions(dir);
267497
267864
  if (declared.kind === "opaque") {
267498
267865
  return fail12("extensions_config_opaque", "config.ts `extensions` is not a literal array of names, so it cannot be edited safely; add the name to it by hand", { extension: name });
@@ -267500,8 +267867,8 @@ async function runExt(ctx) {
267500
267867
  if (!declared.names.includes(name) && declared.names.length >= MAX_EXTENSIONS) {
267501
267868
  return fail12("extension_limit", `an app may declare at most ${MAX_EXTENSIONS} extensions`, { limit: MAX_EXTENSIONS });
267502
267869
  }
267503
- const extDir = join192(dir, EXTENSIONS_DIR, name);
267504
- if (existsSync152(extDir)) return fail12("extension_exists", `${EXTENSIONS_DIR}/${name}/ already exists`, { extension: name });
267870
+ const extDir = join193(dir, EXTENSIONS_DIR, name);
267871
+ if (existsSync153(extDir)) return fail12("extension_exists", `${EXTENSIONS_DIR}/${name}/ already exists`, { extension: name });
267505
267872
  const views = [str3(flags.views), str3(flags.view)].filter(Boolean).flatMap((v2) => v2.split(",")).map((v2) => v2.trim()).filter(Boolean);
267506
267873
  const badView = views.find((v2) => !isValidViewName(v2) || CORE_TYPE_NAMES.has(v2));
267507
267874
  if (badView) {
@@ -267510,9 +267877,9 @@ async function runExt(ctx) {
267510
267877
  const pascal2 = pascalName(name);
267511
267878
  const files = [];
267512
267879
  const put = (rel2, text25) => {
267513
- const path2 = join192(extDir, rel2);
267514
- mkdirSync69(join192(path2, ".."), { recursive: true });
267515
- writeFileSync75(path2, text25, { flag: "wx" });
267880
+ const path2 = join193(extDir, rel2);
267881
+ mkdirSync69(join193(path2, ".."), { recursive: true });
267882
+ writeFileSync76(path2, text25, { flag: "wx" });
267516
267883
  files.push(`${EXTENSIONS_DIR}/${name}/${rel2}`);
267517
267884
  };
267518
267885
  put(EXTENSION_MANIFEST, `${JSON.stringify({
@@ -267568,14 +267935,14 @@ async function runExt(ctx) {
267568
267935
  return 0;
267569
267936
  }
267570
267937
  function loadModelFor(extDir) {
267571
- const parsed = parseExtensionManifest(JSON.parse(readFileSync180(join192(extDir, EXTENSION_MANIFEST), "utf8")));
267938
+ const parsed = parseExtensionManifest(JSON.parse(readFileSync181(join193(extDir, EXTENSION_MANIFEST), "utf8")));
267572
267939
  if (!parsed.ok) return { ok: false, message: parsed.problems.map((p2) => p2.message).join("; ") };
267573
- const iface = parseExtensionInterface(readFileSync180(join192(extDir, parsed.manifest.interface), "utf8"), parsed.manifest);
267940
+ const iface = parseExtensionInterface(readFileSync181(join193(extDir, parsed.manifest.interface), "utf8"), parsed.manifest);
267574
267941
  if (!iface.ok) return { ok: false, message: iface.problems.map((p2) => p2.message).join("; ") };
267575
267942
  return { ok: true, model: iface.model };
267576
267943
  }
267577
267944
  function addExtensionToConfigSource(source2, name) {
267578
- const file2 = ts29.createSourceFile("config.ts", source2, ts29.ScriptTarget.ES2022, true, ts29.ScriptKind.TS);
267945
+ const file2 = ts30.createSourceFile("config.ts", source2, ts30.ScriptTarget.ES2022, true, ts30.ScriptKind.TS);
267579
267946
  const app2 = defineAppLiteral(file2);
267580
267947
  if (!app2) throw new Error("config.ts has no defineApp({ \u2026 }) literal");
267581
267948
  const existing = declaredExtensionsNode(app2);
@@ -267593,12 +267960,12 @@ function addExtensionToConfigSource(source2, name) {
267593
267960
  }
267594
267961
  function declaredExtensionsNode(app2) {
267595
267962
  for (const p2 of app2.properties) {
267596
- if (ts29.isPropertyAssignment(p2) && p2.name && (ts29.isIdentifier(p2.name) || ts29.isStringLiteral(p2.name)) && p2.name.text === "extensions" && ts29.isArrayLiteralExpression(p2.initializer)) return p2.initializer;
267963
+ if (ts30.isPropertyAssignment(p2) && p2.name && (ts30.isIdentifier(p2.name) || ts30.isStringLiteral(p2.name)) && p2.name.text === "extensions" && ts30.isArrayLiteralExpression(p2.initializer)) return p2.initializer;
267597
267964
  }
267598
267965
  return void 0;
267599
267966
  }
267600
267967
  function addToConfig(configPath, name) {
267601
- writeFileAtomic(configPath, addExtensionToConfigSource(readFileSync180(configPath, "utf8"), name));
267968
+ writeFileAtomic(configPath, addExtensionToConfigSource(readFileSync181(configPath, "utf8"), name));
267602
267969
  }
267603
267970
  function listExtensions(dir, print) {
267604
267971
  const prepared = prepareExtensions(dir, { write: false });
@@ -271685,8 +272052,8 @@ function pushAuthHint(status, token, target, hasOwnerIssuer = true) {
271685
272052
  }
271686
272053
  async function contentVisibility(dir) {
271687
272054
  try {
271688
- const { readFileSync: readFileSync181 } = await import("node:fs");
271689
- const m2 = JSON.parse(readFileSync181(join141(dir, "himalaya.content.json"), "utf8"));
272055
+ const { readFileSync: readFileSync182 } = await import("node:fs");
272056
+ const m2 = JSON.parse(readFileSync182(join141(dir, "himalaya.content.json"), "utf8"));
271690
272057
  if (m2.visibility === "public" || m2.visibility === "unlisted") return m2.visibility;
271691
272058
  } catch {
271692
272059
  }