@crvy/rprtr 0.0.4 → 0.0.7

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/index.js CHANGED
@@ -5554,280 +5554,6 @@ if (dev_fallback_default) {
5554
5554
  throw_rune_error("$bindable");
5555
5555
  }
5556
5556
 
5557
- // node_modules/svelte/src/version.js
5558
- var PUBLIC_VERSION = "5";
5559
-
5560
- // node_modules/svelte/src/internal/disclose-version.js
5561
- if (typeof window !== "undefined") {
5562
- ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add(PUBLIC_VERSION);
5563
- }
5564
-
5565
- // src/types.ts
5566
- function isDefined(value) {
5567
- return value !== null && value !== void 0;
5568
- }
5569
- function isTest(x) {
5570
- if (x === null || typeof x !== "object") return false;
5571
- const hasId = "id" in x;
5572
- const hasTitlePath = "titlePath" in x;
5573
- return hasId && hasTitlePath && typeof x.id === "string" && Array.isArray(x.titlePath);
5574
- }
5575
- function getChildrenArray(children) {
5576
- if (children === void 0) return [];
5577
- return Object.values(children).filter(isDefined);
5578
- }
5579
- function getChildrenEntries(children) {
5580
- if (children === void 0) return [];
5581
- return Object.entries(children).filter((entry) => isDefined(entry[1]));
5582
- }
5583
- function getChildrenKeys(children) {
5584
- if (children === void 0) return [];
5585
- return Object.keys(children);
5586
- }
5587
-
5588
- // src/client/helpers/status.ts
5589
- var testStatuses = ["unknown", "pending", "running", "failed", "approved", "success", "retrying"];
5590
- function isTestStatus(value) {
5591
- return testStatuses.some((s) => s === value);
5592
- }
5593
- var statusUpdatesMap = /* @__PURE__ */ new Map([
5594
- [void 0, /(unknown|success|approved|failed|pending|running)/],
5595
- ["unknown", /(success|approved|failed|pending|running)/],
5596
- ["success", /(approved|failed|pending|running)/],
5597
- ["approved", /(failed|pending|running)/],
5598
- ["failed", /(pending|running)/],
5599
- ["pending", /running/]
5600
- ]);
5601
- function calcStatus(oldStatus, newStatus) {
5602
- return newStatus !== void 0 && statusUpdatesMap.get(oldStatus)?.test(newStatus) === true ? newStatus : oldStatus;
5603
- }
5604
- function countTestsStatus(suite) {
5605
- let successCount = 0;
5606
- let failedCount = 0;
5607
- let approvedCount = 0;
5608
- let pendingCount = 0;
5609
- const cases = getChildrenArray(suite.children);
5610
- let suiteOrTest;
5611
- while (suiteOrTest = cases.pop()) {
5612
- if (isTest(suiteOrTest)) {
5613
- if (!hasScreenshots(suiteOrTest)) continue;
5614
- if (suiteOrTest.status === "approved") approvedCount++;
5615
- if (suiteOrTest.status === "success") successCount++;
5616
- if (suiteOrTest.status === "failed") failedCount++;
5617
- if (suiteOrTest.status === "pending") pendingCount++;
5618
- } else {
5619
- cases.push(...getChildrenArray(suiteOrTest.children));
5620
- }
5621
- }
5622
- return { approvedCount, successCount, failedCount, pendingCount };
5623
- }
5624
- function getFailedTests(suite) {
5625
- return getChildrenArray(suite.children).flatMap((suiteOrTest) => {
5626
- if (isTest(suiteOrTest)) return suiteOrTest.status === "failed" ? suiteOrTest : [];
5627
- return getFailedTests(suiteOrTest);
5628
- });
5629
- }
5630
- function hasScreenshots(item) {
5631
- if (isTest(item)) {
5632
- return item.results?.some((r2) => r2.images !== void 0 && Object.keys(r2.images).length > 0) ?? false;
5633
- }
5634
- return getChildrenArray(item.children).some((child2) => hasScreenshots(child2));
5635
- }
5636
-
5637
- // src/client/helpers/path.ts
5638
- function getTestPath(test) {
5639
- return [...test.titlePath, test.title, test.browser].filter(isDefined);
5640
- }
5641
- function getSuiteByPath(suite, path) {
5642
- return path.reduce(
5643
- (suiteOrTest, pathToken) => isTest(suiteOrTest) ? suiteOrTest : suiteOrTest?.children?.[pathToken],
5644
- suite
5645
- );
5646
- }
5647
- function getTestByPath(suite, path) {
5648
- const test = getSuiteByPath(suite, path) ?? suite;
5649
- return isTest(test) ? test : null;
5650
- }
5651
- function setSearchParams(testPath) {
5652
- const params = new URLSearchParams();
5653
- testPath.forEach((p, i) => {
5654
- params.set(`testPath[${i}]`, p);
5655
- });
5656
- window.history.pushState({ testPath }, "", `?${params.toString()}`);
5657
- }
5658
- function getTestPathFromSearch() {
5659
- const params = new URLSearchParams(window.location.search);
5660
- const path = [];
5661
- let i = 0;
5662
- while (params.has(`testPath[${i}]`)) {
5663
- path.push(params.get(`testPath[${i}]`));
5664
- i++;
5665
- }
5666
- return path;
5667
- }
5668
- function parseFilterString(value) {
5669
- let status = null;
5670
- const subStrings = [];
5671
- value.split(" ").filter((s) => s !== "").map((word) => word.toLowerCase()).forEach((word) => {
5672
- const match = /^status:(failed|success|pending|approved)$/i.exec(word);
5673
- if (match !== null) {
5674
- const matchedStatus = match[1];
5675
- if (matchedStatus !== void 0 && isTestStatus(matchedStatus)) {
5676
- status = matchedStatus;
5677
- return;
5678
- }
5679
- }
5680
- subStrings.push(word);
5681
- });
5682
- return { status, subStrings };
5683
- }
5684
- function treeifyTests(testsById) {
5685
- const rootSuite = {
5686
- path: [],
5687
- skip: false,
5688
- opened: true,
5689
- checked: true,
5690
- indeterminate: false,
5691
- children: {}
5692
- };
5693
- Object.values(testsById).forEach((test) => {
5694
- if (test === void 0) return;
5695
- const titlePath = test.titlePath ?? [];
5696
- const browser = test.browser ?? "";
5697
- const title = test.title;
5698
- const pathParts = [...titlePath, title, browser].filter((p) => p !== void 0 && p !== "");
5699
- const [browserName, ...testPathParts] = pathParts.reverse();
5700
- if (browserName === void 0) return;
5701
- const lastSuite = testPathParts.reverse().reduce((suite, token) => {
5702
- suite.children = suite.children ?? {};
5703
- suite.children[token] ??= {
5704
- path: [...suite.path, token],
5705
- skip: false,
5706
- opened: false,
5707
- checked: true,
5708
- indeterminate: false,
5709
- children: {}
5710
- };
5711
- const subSuite = suite.children[token];
5712
- if (subSuite === void 0 || isTest(subSuite)) return suite;
5713
- subSuite.status = calcStatus(subSuite.status, test.status);
5714
- suite.status = calcStatus(suite.status, subSuite.status);
5715
- if (test.skip === false) subSuite.skip = false;
5716
- return subSuite;
5717
- }, rootSuite);
5718
- lastSuite.children = lastSuite.children ?? {};
5719
- lastSuite.children[browserName] = {
5720
- ...test,
5721
- checked: true
5722
- };
5723
- });
5724
- return rootSuite;
5725
- }
5726
- function mergeTreeState(target, source2) {
5727
- target.opened = source2.opened;
5728
- target.checked = source2.checked;
5729
- target.indeterminate = source2.indeterminate;
5730
- for (const [key2, targetChild] of getChildrenEntries(target.children)) {
5731
- const sourceChild = source2.children?.[key2];
5732
- if (targetChild === void 0 || sourceChild === void 0) continue;
5733
- if (!isTest(targetChild) && !isTest(sourceChild)) {
5734
- mergeTreeState(targetChild, sourceChild);
5735
- } else if (isTest(targetChild) && isTest(sourceChild)) {
5736
- targetChild.checked = sourceChild.checked;
5737
- }
5738
- }
5739
- }
5740
-
5741
- // src/client/helpers/suite.ts
5742
- function checkTests(suiteOrTest, checked) {
5743
- suiteOrTest.checked = checked;
5744
- if (!isTest(suiteOrTest)) {
5745
- suiteOrTest.indeterminate = false;
5746
- getChildrenArray(suiteOrTest.children).forEach((child2) => {
5747
- checkTests(child2, checked);
5748
- });
5749
- }
5750
- }
5751
- function updateChecked(suite) {
5752
- const children = getChildrenArray(suite.children).filter((child2) => child2.skip === false);
5753
- const checkedEvery = children.every((test) => test.checked);
5754
- const checkedSome = children.some((test) => test.checked);
5755
- const indeterminate = children.some((test) => isTest(test) ? false : test.indeterminate) || !checkedEvery && checkedSome;
5756
- const checked = indeterminate || suite.checked === checkedEvery ? suite.checked : checkedEvery;
5757
- suite.checked = checked;
5758
- suite.indeterminate = indeterminate;
5759
- }
5760
- function checkSuite(suite, path, checked) {
5761
- const subSuite = getSuiteByPath(suite, path);
5762
- if (subSuite) checkTests(subSuite, checked);
5763
- path.slice(0, -1).map((_, index2, tokens) => tokens.slice(0, tokens.length - index2)).forEach((parentPath) => {
5764
- const parentSuite = getSuiteByPath(suite, parentPath);
5765
- if (isTest(parentSuite)) return;
5766
- if (parentSuite) updateChecked(parentSuite);
5767
- });
5768
- updateChecked(suite);
5769
- }
5770
- function openSuite(suite, path, opened) {
5771
- const subSuite = path.reduce(
5772
- (suiteOrTest, pathToken) => {
5773
- if (suiteOrTest && !isTest(suiteOrTest)) {
5774
- if (opened) suiteOrTest.opened = opened;
5775
- return suiteOrTest.children?.[pathToken];
5776
- }
5777
- },
5778
- suite
5779
- );
5780
- if (subSuite && !isTest(subSuite)) subSuite.opened = opened;
5781
- }
5782
- function filterTests(suite, filter) {
5783
- const { status, subStrings } = filter;
5784
- if (!status && !subStrings.length) return suite;
5785
- const filteredSuite = { ...suite, children: {} };
5786
- getChildrenEntries(suite.children).forEach(([title, suiteOrTest]) => {
5787
- if (suiteOrTest.skip === true) return;
5788
- if (!status && subStrings.some((sub) => title.toLowerCase().includes(sub))) {
5789
- filteredSuite.children = filteredSuite.children ?? {};
5790
- filteredSuite.children[title] = suiteOrTest;
5791
- } else if (isTest(suiteOrTest)) {
5792
- if (status && suiteOrTest.status && ["pending", "running", status].includes(suiteOrTest.status)) {
5793
- filteredSuite.children = filteredSuite.children ?? {};
5794
- filteredSuite.children[title] = suiteOrTest;
5795
- }
5796
- } else {
5797
- const filteredSubSuite = filterTests(suiteOrTest, filter);
5798
- if (getChildrenKeys(filteredSubSuite.children).length === 0) return;
5799
- filteredSuite.children = filteredSuite.children ?? {};
5800
- filteredSuite.children[title] = filteredSubSuite;
5801
- }
5802
- });
5803
- return filteredSuite;
5804
- }
5805
- function flattenSuite(suite) {
5806
- if (!suite.opened) return [];
5807
- return getChildrenEntries(suite.children).flatMap(([title, subSuite]) => [
5808
- { title, suite: subSuite },
5809
- ...isTest(subSuite) ? [] : flattenSuite(subSuite)
5810
- ]);
5811
- }
5812
- function recalcSuiteStatuses(root10, testPath) {
5813
- const ancestorPaths = testPath.slice(0, -1).map((_, index2, tokens) => tokens.slice(0, tokens.length - index2));
5814
- for (const parentPath of ancestorPaths) {
5815
- const parentSuite = getSuiteByPath(root10, parentPath);
5816
- if (parentSuite && !isTest(parentSuite)) {
5817
- parentSuite.status = getChildrenArray(parentSuite.children).map(({ status }) => status).reduce(calcStatus);
5818
- }
5819
- }
5820
- root10.status = getChildrenArray(root10.children).map(({ status }) => status).reduce(calcStatus);
5821
- }
5822
- function recalcAllSuiteStatuses(suite) {
5823
- for (const child2 of getChildrenArray(suite.children)) {
5824
- if (!isTest(child2)) {
5825
- recalcAllSuiteStatuses(child2);
5826
- }
5827
- }
5828
- suite.status = getChildrenArray(suite.children).map(({ status }) => status).reduce(calcStatus);
5829
- }
5830
-
5831
5557
  // node_modules/zod/v4/classic/external.js
5832
5558
  var external_exports = {};
5833
5559
  __export(external_exports, {
@@ -19505,215 +19231,555 @@ function convertSchema(schema, ctx) {
19505
19231
  const anyOfUnion = z.union(options);
19506
19232
  baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
19507
19233
  }
19508
- if (schema.oneOf && Array.isArray(schema.oneOf)) {
19509
- const options = schema.oneOf.map((s) => convertSchema(s, ctx));
19510
- const oneOfUnion = z.xor(options);
19511
- baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
19234
+ if (schema.oneOf && Array.isArray(schema.oneOf)) {
19235
+ const options = schema.oneOf.map((s) => convertSchema(s, ctx));
19236
+ const oneOfUnion = z.xor(options);
19237
+ baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
19238
+ }
19239
+ if (schema.allOf && Array.isArray(schema.allOf)) {
19240
+ if (schema.allOf.length === 0) {
19241
+ baseSchema = hasExplicitType ? baseSchema : z.any();
19242
+ } else {
19243
+ let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
19244
+ const startIdx = hasExplicitType ? 0 : 1;
19245
+ for (let i = startIdx; i < schema.allOf.length; i++) {
19246
+ result = z.intersection(result, convertSchema(schema.allOf[i], ctx));
19247
+ }
19248
+ baseSchema = result;
19249
+ }
19250
+ }
19251
+ if (schema.nullable === true && ctx.version === "openapi-3.0") {
19252
+ baseSchema = z.nullable(baseSchema);
19253
+ }
19254
+ if (schema.readOnly === true) {
19255
+ baseSchema = z.readonly(baseSchema);
19256
+ }
19257
+ const extraMeta = {};
19258
+ const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
19259
+ for (const key2 of coreMetadataKeys) {
19260
+ if (key2 in schema) {
19261
+ extraMeta[key2] = schema[key2];
19262
+ }
19263
+ }
19264
+ const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
19265
+ for (const key2 of contentMetadataKeys) {
19266
+ if (key2 in schema) {
19267
+ extraMeta[key2] = schema[key2];
19268
+ }
19269
+ }
19270
+ for (const key2 of Object.keys(schema)) {
19271
+ if (!RECOGNIZED_KEYS.has(key2)) {
19272
+ extraMeta[key2] = schema[key2];
19273
+ }
19274
+ }
19275
+ if (Object.keys(extraMeta).length > 0) {
19276
+ ctx.registry.add(baseSchema, extraMeta);
19277
+ }
19278
+ return baseSchema;
19279
+ }
19280
+ function fromJSONSchema(schema, params) {
19281
+ if (typeof schema === "boolean") {
19282
+ return schema ? z.any() : z.never();
19283
+ }
19284
+ const version2 = detectVersion(schema, params?.defaultTarget);
19285
+ const defs = schema.$defs || schema.definitions || {};
19286
+ const ctx = {
19287
+ version: version2,
19288
+ defs,
19289
+ refs: /* @__PURE__ */ new Map(),
19290
+ processing: /* @__PURE__ */ new Set(),
19291
+ rootSchema: schema,
19292
+ registry: params?.registry ?? globalRegistry
19293
+ };
19294
+ return convertSchema(schema, ctx);
19295
+ }
19296
+
19297
+ // node_modules/zod/v4/classic/coerce.js
19298
+ var coerce_exports = {};
19299
+ __export(coerce_exports, {
19300
+ bigint: () => bigint3,
19301
+ boolean: () => boolean3,
19302
+ date: () => date4,
19303
+ number: () => number3,
19304
+ string: () => string3
19305
+ });
19306
+ function string3(params) {
19307
+ return _coercedString(ZodString, params);
19308
+ }
19309
+ function number3(params) {
19310
+ return _coercedNumber(ZodNumber, params);
19311
+ }
19312
+ function boolean3(params) {
19313
+ return _coercedBoolean(ZodBoolean, params);
19314
+ }
19315
+ function bigint3(params) {
19316
+ return _coercedBigint(ZodBigInt, params);
19317
+ }
19318
+ function date4(params) {
19319
+ return _coercedDate(ZodDate, params);
19320
+ }
19321
+
19322
+ // node_modules/zod/v4/classic/external.js
19323
+ config(en_default());
19324
+
19325
+ // src/schemas.ts
19326
+ var LocationSchema = external_exports.object({
19327
+ file: external_exports.string(),
19328
+ line: external_exports.number()
19329
+ });
19330
+ var VisualSourceSchema = external_exports.enum(["comparison", "baseline-only", "declared-only"]);
19331
+ var ImagesSchema = external_exports.object({
19332
+ actual: external_exports.string().optional(),
19333
+ expect: external_exports.string().optional(),
19334
+ diff: external_exports.string().optional(),
19335
+ error: external_exports.string().optional(),
19336
+ source: VisualSourceSchema.optional()
19337
+ });
19338
+ var ScreenshotDeclarationSchema = external_exports.discriminatedUnion("kind", [
19339
+ external_exports.object({
19340
+ visualName: external_exports.string(),
19341
+ kind: external_exports.literal("named"),
19342
+ declaredName: external_exports.string(),
19343
+ snapshotBaseName: external_exports.string(),
19344
+ occurrenceIndex: external_exports.number()
19345
+ }),
19346
+ external_exports.object({
19347
+ visualName: external_exports.string(),
19348
+ kind: external_exports.literal("unnamed"),
19349
+ occurrenceIndex: external_exports.number()
19350
+ })
19351
+ ]);
19352
+ var AttachmentSchema = external_exports.object({
19353
+ name: external_exports.string(),
19354
+ path: external_exports.string(),
19355
+ contentType: external_exports.string()
19356
+ });
19357
+ var TestStatusSchema = external_exports.enum(["unknown", "pending", "running", "failed", "approved", "success", "retrying"]);
19358
+ var TestResultStatusSchema = external_exports.enum(["failed", "success", "pending"]);
19359
+ var TestResultSchema = external_exports.object({
19360
+ status: TestResultStatusSchema,
19361
+ retries: external_exports.number(),
19362
+ images: external_exports.record(external_exports.string(), ImagesSchema).optional(),
19363
+ visualDeclarations: external_exports.array(ScreenshotDeclarationSchema).optional(),
19364
+ error: external_exports.string().optional(),
19365
+ duration: external_exports.number().optional()
19366
+ });
19367
+ var TestDataSchema = external_exports.object({
19368
+ id: external_exports.string(),
19369
+ titlePath: external_exports.array(external_exports.string()),
19370
+ browser: external_exports.string(),
19371
+ title: external_exports.string(),
19372
+ skip: external_exports.union([external_exports.boolean(), external_exports.string()]).optional(),
19373
+ retries: external_exports.number().optional(),
19374
+ status: TestStatusSchema.optional(),
19375
+ results: external_exports.array(TestResultSchema).optional(),
19376
+ approved: external_exports.record(external_exports.string(), external_exports.number()).nullable().optional(),
19377
+ attachments: external_exports.array(AttachmentSchema).optional(),
19378
+ location: LocationSchema.optional()
19379
+ });
19380
+ var CrvyRprtrTestSchema = TestDataSchema.extend({
19381
+ checked: external_exports.boolean()
19382
+ });
19383
+ var CrvyRprtrSuiteSchema = external_exports.lazy(
19384
+ () => external_exports.object({
19385
+ path: external_exports.array(external_exports.string()),
19386
+ skip: external_exports.boolean(),
19387
+ status: TestStatusSchema.optional(),
19388
+ opened: external_exports.boolean(),
19389
+ checked: external_exports.boolean(),
19390
+ indeterminate: external_exports.boolean(),
19391
+ children: external_exports.record(external_exports.string(), external_exports.union([CrvyRprtrSuiteSchema, CrvyRprtrTestSchema])).optional()
19392
+ })
19393
+ );
19394
+ var WebSocketMessageSchema = external_exports.object({
19395
+ type: external_exports.enum(["test-begin", "test-end", "run-end", "approve", "sync"]),
19396
+ data: external_exports.unknown()
19397
+ });
19398
+ var TestBeginDataSchema = external_exports.object({
19399
+ id: external_exports.string(),
19400
+ title: external_exports.string(),
19401
+ titlePath: external_exports.array(external_exports.string()),
19402
+ browser: external_exports.string(),
19403
+ location: LocationSchema
19404
+ });
19405
+ var TestEndDataSchema = external_exports.object({
19406
+ id: external_exports.string(),
19407
+ status: external_exports.enum(["passed", "failed", "skipped"]),
19408
+ attachments: external_exports.array(AttachmentSchema),
19409
+ visualNames: external_exports.array(external_exports.string()).default([]),
19410
+ visualDeclarations: external_exports.preprocess(
19411
+ (value) => value === null ? void 0 : value,
19412
+ external_exports.array(ScreenshotDeclarationSchema).optional()
19413
+ ),
19414
+ error: external_exports.string().optional(),
19415
+ duration: external_exports.number().optional()
19416
+ });
19417
+ var ReportDataSchema = external_exports.object({
19418
+ isRunning: external_exports.boolean(),
19419
+ tests: external_exports.record(external_exports.string(), TestDataSchema),
19420
+ browsers: external_exports.array(external_exports.string()),
19421
+ isUpdateMode: external_exports.boolean(),
19422
+ screenshotDir: external_exports.string()
19423
+ });
19424
+ var LoadedReportDataSchema = external_exports.object({
19425
+ tests: external_exports.record(external_exports.string(), TestDataSchema).optional(),
19426
+ isUpdateMode: external_exports.boolean().optional()
19427
+ });
19428
+ var OfflineEventSchema = external_exports.object({
19429
+ type: external_exports.enum(["test-begin", "test-end", "run-end"]),
19430
+ data: external_exports.unknown(),
19431
+ timestamp: external_exports.number(),
19432
+ workerIndex: external_exports.number()
19433
+ });
19434
+ var OfflineReportSchema = external_exports.object({
19435
+ version: external_exports.number(),
19436
+ generatedAt: external_exports.string(),
19437
+ workers: external_exports.number(),
19438
+ events: external_exports.array(OfflineEventSchema)
19439
+ });
19440
+ var ApproveRequestBodySchema = external_exports.object({
19441
+ id: external_exports.string(),
19442
+ retry: external_exports.number(),
19443
+ image: external_exports.string()
19444
+ });
19445
+ var ReportApiResponseSchema = external_exports.object({
19446
+ tests: external_exports.record(external_exports.string(), TestDataSchema),
19447
+ isUpdateMode: external_exports.boolean().optional()
19448
+ });
19449
+ var ClientBootstrapDataSchema = external_exports.object({
19450
+ report: ReportApiResponseSchema.extend({
19451
+ isUpdateMode: external_exports.boolean()
19452
+ }),
19453
+ liveUpdates: external_exports.boolean(),
19454
+ approvalEnabled: external_exports.boolean(),
19455
+ approvalMessage: external_exports.string().optional()
19456
+ });
19457
+ var ImagesViewModeSchema = external_exports.enum(["side-by-side", "swap", "slide", "blend"]);
19458
+ function safeParse3(schema, data) {
19459
+ const result = schema.safeParse(data);
19460
+ if (result.success) {
19461
+ return result.data;
19462
+ }
19463
+ return null;
19464
+ }
19465
+
19466
+ // src/approval-api.ts
19467
+ var ApprovalResponseBodySchema = external_exports.object({
19468
+ success: external_exports.boolean(),
19469
+ error: external_exports.string().optional()
19470
+ });
19471
+ var BulkApprovalResponseBodySchema = external_exports.object({
19472
+ success: external_exports.boolean(),
19473
+ approved: external_exports.number(),
19474
+ unresolved: external_exports.number(),
19475
+ failed: external_exports.number()
19476
+ });
19477
+ var failedApprovalResult = { success: false };
19478
+ var failedBulkApprovalResult = {
19479
+ success: false,
19480
+ approved: 0,
19481
+ unresolved: 0,
19482
+ failed: 0
19483
+ };
19484
+ async function readJsonBody(response) {
19485
+ try {
19486
+ return await response.json();
19487
+ } catch {
19488
+ return null;
19489
+ }
19490
+ }
19491
+ async function readApproveResult(response) {
19492
+ const body = safeParse3(ApprovalResponseBodySchema, await readJsonBody(response));
19493
+ return body !== null && response.ok && body.success ? body : failedApprovalResult;
19494
+ }
19495
+ async function readApproveAllResult(response) {
19496
+ const body = safeParse3(BulkApprovalResponseBodySchema, await readJsonBody(response));
19497
+ if (body === null) {
19498
+ return failedBulkApprovalResult;
19512
19499
  }
19513
- if (schema.allOf && Array.isArray(schema.allOf)) {
19514
- if (schema.allOf.length === 0) {
19515
- baseSchema = hasExplicitType ? baseSchema : z.any();
19500
+ return {
19501
+ success: response.ok && body.success,
19502
+ approved: body.approved,
19503
+ unresolved: body.unresolved,
19504
+ failed: body.failed
19505
+ };
19506
+ }
19507
+ function isBulkApprovalOptimisticSafe(result) {
19508
+ return result.success && result.unresolved === 0 && result.failed === 0;
19509
+ }
19510
+
19511
+ // node_modules/svelte/src/version.js
19512
+ var PUBLIC_VERSION = "5";
19513
+
19514
+ // node_modules/svelte/src/internal/disclose-version.js
19515
+ if (typeof window !== "undefined") {
19516
+ ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add(PUBLIC_VERSION);
19517
+ }
19518
+
19519
+ // src/types.ts
19520
+ function isDefined(value) {
19521
+ return value !== null && value !== void 0;
19522
+ }
19523
+ function isTest(x) {
19524
+ if (x === null || typeof x !== "object") return false;
19525
+ const hasId = "id" in x;
19526
+ const hasTitlePath = "titlePath" in x;
19527
+ return hasId && hasTitlePath && typeof x.id === "string" && Array.isArray(x.titlePath);
19528
+ }
19529
+ function getChildrenArray(children) {
19530
+ if (children === void 0) return [];
19531
+ return Object.values(children).filter(isDefined);
19532
+ }
19533
+ function getChildrenEntries(children) {
19534
+ if (children === void 0) return [];
19535
+ return Object.entries(children).filter((entry) => isDefined(entry[1]));
19536
+ }
19537
+ function getChildrenKeys(children) {
19538
+ if (children === void 0) return [];
19539
+ return Object.keys(children);
19540
+ }
19541
+
19542
+ // src/client/helpers/status.ts
19543
+ var testStatuses = ["unknown", "pending", "running", "failed", "approved", "success", "retrying"];
19544
+ function isTestStatus(value) {
19545
+ return testStatuses.some((s) => s === value);
19546
+ }
19547
+ var statusUpdatesMap = /* @__PURE__ */ new Map([
19548
+ [void 0, /(unknown|success|approved|failed|pending|running)/],
19549
+ ["unknown", /(success|approved|failed|pending|running)/],
19550
+ ["success", /(approved|failed|pending|running)/],
19551
+ ["approved", /(failed|pending|running)/],
19552
+ ["failed", /(pending|running)/],
19553
+ ["pending", /running/]
19554
+ ]);
19555
+ function calcStatus(oldStatus, newStatus) {
19556
+ return newStatus !== void 0 && statusUpdatesMap.get(oldStatus)?.test(newStatus) === true ? newStatus : oldStatus;
19557
+ }
19558
+ function countTestsStatus(suite) {
19559
+ let successCount = 0;
19560
+ let failedCount = 0;
19561
+ let approvedCount = 0;
19562
+ let pendingCount = 0;
19563
+ const cases = getChildrenArray(suite.children);
19564
+ let suiteOrTest;
19565
+ while (suiteOrTest = cases.pop()) {
19566
+ if (isTest(suiteOrTest)) {
19567
+ if (!hasScreenshots(suiteOrTest)) continue;
19568
+ if (suiteOrTest.status === "approved") approvedCount++;
19569
+ if (suiteOrTest.status === "success") successCount++;
19570
+ if (suiteOrTest.status === "failed") failedCount++;
19571
+ if (suiteOrTest.status === "pending") pendingCount++;
19516
19572
  } else {
19517
- let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
19518
- const startIdx = hasExplicitType ? 0 : 1;
19519
- for (let i = startIdx; i < schema.allOf.length; i++) {
19520
- result = z.intersection(result, convertSchema(schema.allOf[i], ctx));
19521
- }
19522
- baseSchema = result;
19573
+ cases.push(...getChildrenArray(suiteOrTest.children));
19523
19574
  }
19524
19575
  }
19525
- if (schema.nullable === true && ctx.version === "openapi-3.0") {
19526
- baseSchema = z.nullable(baseSchema);
19527
- }
19528
- if (schema.readOnly === true) {
19529
- baseSchema = z.readonly(baseSchema);
19576
+ return { approvedCount, successCount, failedCount, pendingCount };
19577
+ }
19578
+ function getFailedTests(suite) {
19579
+ return getChildrenArray(suite.children).flatMap((suiteOrTest) => {
19580
+ if (isTest(suiteOrTest)) return suiteOrTest.status === "failed" ? suiteOrTest : [];
19581
+ return getFailedTests(suiteOrTest);
19582
+ });
19583
+ }
19584
+ function hasScreenshots(item) {
19585
+ if (isTest(item)) {
19586
+ return item.results?.some((r2) => r2.images !== void 0 && Object.keys(r2.images).length > 0) ?? false;
19530
19587
  }
19531
- const extraMeta = {};
19532
- const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
19533
- for (const key2 of coreMetadataKeys) {
19534
- if (key2 in schema) {
19535
- extraMeta[key2] = schema[key2];
19536
- }
19588
+ return getChildrenArray(item.children).some((child2) => hasScreenshots(child2));
19589
+ }
19590
+
19591
+ // src/client/helpers/path.ts
19592
+ function getTestPath(test) {
19593
+ return [...test.titlePath, test.title, test.browser].filter(isDefined);
19594
+ }
19595
+ function getSuiteByPath(suite, path) {
19596
+ return path.reduce(
19597
+ (suiteOrTest, pathToken) => isTest(suiteOrTest) ? suiteOrTest : suiteOrTest?.children?.[pathToken],
19598
+ suite
19599
+ );
19600
+ }
19601
+ function getTestByPath(suite, path) {
19602
+ const test = getSuiteByPath(suite, path) ?? suite;
19603
+ return isTest(test) ? test : null;
19604
+ }
19605
+ function setSearchParams(testPath) {
19606
+ const params = new URLSearchParams();
19607
+ testPath.forEach((p, i) => {
19608
+ params.set(`testPath[${i}]`, p);
19609
+ });
19610
+ window.history.pushState({ testPath }, "", `?${params.toString()}`);
19611
+ }
19612
+ function getTestPathFromSearch() {
19613
+ const params = new URLSearchParams(window.location.search);
19614
+ const path = [];
19615
+ let i = 0;
19616
+ while (params.has(`testPath[${i}]`)) {
19617
+ path.push(params.get(`testPath[${i}]`));
19618
+ i++;
19537
19619
  }
19538
- const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
19539
- for (const key2 of contentMetadataKeys) {
19540
- if (key2 in schema) {
19541
- extraMeta[key2] = schema[key2];
19620
+ return path;
19621
+ }
19622
+ function parseFilterString(value) {
19623
+ let status = null;
19624
+ const subStrings = [];
19625
+ value.split(" ").filter((s) => s !== "").map((word) => word.toLowerCase()).forEach((word) => {
19626
+ const match = /^status:(failed|success|pending|approved)$/i.exec(word);
19627
+ if (match !== null) {
19628
+ const matchedStatus = match[1];
19629
+ if (matchedStatus !== void 0 && isTestStatus(matchedStatus)) {
19630
+ status = matchedStatus;
19631
+ return;
19632
+ }
19542
19633
  }
19543
- }
19544
- for (const key2 of Object.keys(schema)) {
19545
- if (!RECOGNIZED_KEYS.has(key2)) {
19546
- extraMeta[key2] = schema[key2];
19634
+ subStrings.push(word);
19635
+ });
19636
+ return { status, subStrings };
19637
+ }
19638
+ function treeifyTests(testsById) {
19639
+ const rootSuite = {
19640
+ path: [],
19641
+ skip: false,
19642
+ opened: true,
19643
+ checked: true,
19644
+ indeterminate: false,
19645
+ children: {}
19646
+ };
19647
+ Object.values(testsById).forEach((test) => {
19648
+ if (test === void 0) return;
19649
+ const titlePath = test.titlePath ?? [];
19650
+ const browser = test.browser ?? "";
19651
+ const title = test.title;
19652
+ const pathParts = [...titlePath, title, browser].filter((p) => p !== void 0 && p !== "");
19653
+ const [browserName, ...testPathParts] = pathParts.reverse();
19654
+ if (browserName === void 0) return;
19655
+ const lastSuite = testPathParts.reverse().reduce((suite, token) => {
19656
+ suite.children = suite.children ?? {};
19657
+ suite.children[token] ??= {
19658
+ path: [...suite.path, token],
19659
+ skip: false,
19660
+ opened: false,
19661
+ checked: true,
19662
+ indeterminate: false,
19663
+ children: {}
19664
+ };
19665
+ const subSuite = suite.children[token];
19666
+ if (subSuite === void 0 || isTest(subSuite)) return suite;
19667
+ subSuite.status = calcStatus(subSuite.status, test.status);
19668
+ suite.status = calcStatus(suite.status, subSuite.status);
19669
+ if (test.skip === false) subSuite.skip = false;
19670
+ return subSuite;
19671
+ }, rootSuite);
19672
+ lastSuite.children = lastSuite.children ?? {};
19673
+ lastSuite.children[browserName] = {
19674
+ ...test,
19675
+ checked: true
19676
+ };
19677
+ });
19678
+ return rootSuite;
19679
+ }
19680
+ function mergeTreeState(target, source2) {
19681
+ target.opened = source2.opened;
19682
+ target.checked = source2.checked;
19683
+ target.indeterminate = source2.indeterminate;
19684
+ for (const [key2, targetChild] of getChildrenEntries(target.children)) {
19685
+ const sourceChild = source2.children?.[key2];
19686
+ if (targetChild === void 0 || sourceChild === void 0) continue;
19687
+ if (!isTest(targetChild) && !isTest(sourceChild)) {
19688
+ mergeTreeState(targetChild, sourceChild);
19689
+ } else if (isTest(targetChild) && isTest(sourceChild)) {
19690
+ targetChild.checked = sourceChild.checked;
19547
19691
  }
19548
19692
  }
19549
- if (Object.keys(extraMeta).length > 0) {
19550
- ctx.registry.add(baseSchema, extraMeta);
19551
- }
19552
- return baseSchema;
19553
19693
  }
19554
- function fromJSONSchema(schema, params) {
19555
- if (typeof schema === "boolean") {
19556
- return schema ? z.any() : z.never();
19694
+
19695
+ // src/client/helpers/suite.ts
19696
+ function checkTests(suiteOrTest, checked) {
19697
+ suiteOrTest.checked = checked;
19698
+ if (!isTest(suiteOrTest)) {
19699
+ suiteOrTest.indeterminate = false;
19700
+ getChildrenArray(suiteOrTest.children).forEach((child2) => {
19701
+ checkTests(child2, checked);
19702
+ });
19557
19703
  }
19558
- const version2 = detectVersion(schema, params?.defaultTarget);
19559
- const defs = schema.$defs || schema.definitions || {};
19560
- const ctx = {
19561
- version: version2,
19562
- defs,
19563
- refs: /* @__PURE__ */ new Map(),
19564
- processing: /* @__PURE__ */ new Set(),
19565
- rootSchema: schema,
19566
- registry: params?.registry ?? globalRegistry
19567
- };
19568
- return convertSchema(schema, ctx);
19569
19704
  }
19570
-
19571
- // node_modules/zod/v4/classic/coerce.js
19572
- var coerce_exports = {};
19573
- __export(coerce_exports, {
19574
- bigint: () => bigint3,
19575
- boolean: () => boolean3,
19576
- date: () => date4,
19577
- number: () => number3,
19578
- string: () => string3
19579
- });
19580
- function string3(params) {
19581
- return _coercedString(ZodString, params);
19705
+ function updateChecked(suite) {
19706
+ const children = getChildrenArray(suite.children).filter((child2) => child2.skip === false);
19707
+ const checkedEvery = children.every((test) => test.checked);
19708
+ const checkedSome = children.some((test) => test.checked);
19709
+ const indeterminate = children.some((test) => isTest(test) ? false : test.indeterminate) || !checkedEvery && checkedSome;
19710
+ const checked = indeterminate || suite.checked === checkedEvery ? suite.checked : checkedEvery;
19711
+ suite.checked = checked;
19712
+ suite.indeterminate = indeterminate;
19713
+ }
19714
+ function checkSuite(suite, path, checked) {
19715
+ const subSuite = getSuiteByPath(suite, path);
19716
+ if (subSuite) checkTests(subSuite, checked);
19717
+ path.slice(0, -1).map((_, index2, tokens) => tokens.slice(0, tokens.length - index2)).forEach((parentPath) => {
19718
+ const parentSuite = getSuiteByPath(suite, parentPath);
19719
+ if (isTest(parentSuite)) return;
19720
+ if (parentSuite) updateChecked(parentSuite);
19721
+ });
19722
+ updateChecked(suite);
19582
19723
  }
19583
- function number3(params) {
19584
- return _coercedNumber(ZodNumber, params);
19724
+ function openSuite(suite, path, opened) {
19725
+ const subSuite = path.reduce(
19726
+ (suiteOrTest, pathToken) => {
19727
+ if (suiteOrTest && !isTest(suiteOrTest)) {
19728
+ if (opened) suiteOrTest.opened = opened;
19729
+ return suiteOrTest.children?.[pathToken];
19730
+ }
19731
+ },
19732
+ suite
19733
+ );
19734
+ if (subSuite && !isTest(subSuite)) subSuite.opened = opened;
19585
19735
  }
19586
- function boolean3(params) {
19587
- return _coercedBoolean(ZodBoolean, params);
19736
+ function filterTests(suite, filter) {
19737
+ const { status, subStrings } = filter;
19738
+ if (!status && !subStrings.length) return suite;
19739
+ const filteredSuite = { ...suite, children: {} };
19740
+ getChildrenEntries(suite.children).forEach(([title, suiteOrTest]) => {
19741
+ if (suiteOrTest.skip === true) return;
19742
+ if (!status && subStrings.some((sub) => title.toLowerCase().includes(sub))) {
19743
+ filteredSuite.children = filteredSuite.children ?? {};
19744
+ filteredSuite.children[title] = suiteOrTest;
19745
+ } else if (isTest(suiteOrTest)) {
19746
+ if (status && suiteOrTest.status && ["pending", "running", status].includes(suiteOrTest.status)) {
19747
+ filteredSuite.children = filteredSuite.children ?? {};
19748
+ filteredSuite.children[title] = suiteOrTest;
19749
+ }
19750
+ } else {
19751
+ const filteredSubSuite = filterTests(suiteOrTest, filter);
19752
+ if (getChildrenKeys(filteredSubSuite.children).length === 0) return;
19753
+ filteredSuite.children = filteredSuite.children ?? {};
19754
+ filteredSuite.children[title] = filteredSubSuite;
19755
+ }
19756
+ });
19757
+ return filteredSuite;
19588
19758
  }
19589
- function bigint3(params) {
19590
- return _coercedBigint(ZodBigInt, params);
19759
+ function flattenSuite(suite) {
19760
+ if (!suite.opened) return [];
19761
+ return getChildrenEntries(suite.children).flatMap(([title, subSuite]) => [
19762
+ { title, suite: subSuite },
19763
+ ...isTest(subSuite) ? [] : flattenSuite(subSuite)
19764
+ ]);
19591
19765
  }
19592
- function date4(params) {
19593
- return _coercedDate(ZodDate, params);
19766
+ function recalcSuiteStatuses(root10, testPath) {
19767
+ const ancestorPaths = testPath.slice(0, -1).map((_, index2, tokens) => tokens.slice(0, tokens.length - index2));
19768
+ for (const parentPath of ancestorPaths) {
19769
+ const parentSuite = getSuiteByPath(root10, parentPath);
19770
+ if (parentSuite && !isTest(parentSuite)) {
19771
+ parentSuite.status = getChildrenArray(parentSuite.children).map(({ status }) => status).reduce(calcStatus);
19772
+ }
19773
+ }
19774
+ root10.status = getChildrenArray(root10.children).map(({ status }) => status).reduce(calcStatus);
19594
19775
  }
19595
-
19596
- // node_modules/zod/v4/classic/external.js
19597
- config(en_default());
19598
-
19599
- // src/schemas.ts
19600
- var LocationSchema = external_exports.object({
19601
- file: external_exports.string(),
19602
- line: external_exports.number()
19603
- });
19604
- var ImagesSchema = external_exports.object({
19605
- actual: external_exports.string(),
19606
- expect: external_exports.string().optional(),
19607
- diff: external_exports.string().optional(),
19608
- error: external_exports.string().optional()
19609
- });
19610
- var AttachmentSchema = external_exports.object({
19611
- name: external_exports.string(),
19612
- path: external_exports.string(),
19613
- contentType: external_exports.string()
19614
- });
19615
- var TestStatusSchema = external_exports.enum(["unknown", "pending", "running", "failed", "approved", "success", "retrying"]);
19616
- var TestResultSchema = external_exports.object({
19617
- status: external_exports.enum(["failed", "success"]),
19618
- retries: external_exports.number(),
19619
- // eslint-disable-next-line typescript/no-unsafe-type-assertion
19620
- images: external_exports.record(external_exports.string(), ImagesSchema).optional(),
19621
- error: external_exports.string().optional(),
19622
- duration: external_exports.number().optional()
19623
- });
19624
- var TestDataSchema = external_exports.object({
19625
- id: external_exports.string(),
19626
- titlePath: external_exports.array(external_exports.string()),
19627
- browser: external_exports.string(),
19628
- title: external_exports.string(),
19629
- skip: external_exports.union([external_exports.boolean(), external_exports.string()]).optional(),
19630
- retries: external_exports.number().optional(),
19631
- status: TestStatusSchema.optional(),
19632
- results: external_exports.array(TestResultSchema).optional(),
19633
- approved: external_exports.record(external_exports.string(), external_exports.number()).nullable().optional(),
19634
- attachments: external_exports.array(AttachmentSchema).optional(),
19635
- location: LocationSchema.optional()
19636
- });
19637
- var CrvyRprtrTestSchema = TestDataSchema.extend({
19638
- checked: external_exports.boolean()
19639
- });
19640
- var CrvyRprtrSuiteSchema = external_exports.lazy(
19641
- () => external_exports.object({
19642
- path: external_exports.array(external_exports.string()),
19643
- skip: external_exports.boolean(),
19644
- status: TestStatusSchema.optional(),
19645
- opened: external_exports.boolean(),
19646
- checked: external_exports.boolean(),
19647
- indeterminate: external_exports.boolean(),
19648
- // eslint-disable-next-line typescript/no-unsafe-type-assertion
19649
- children: external_exports.record(external_exports.string(), external_exports.union([CrvyRprtrSuiteSchema, CrvyRprtrTestSchema])).optional()
19650
- })
19651
- );
19652
- var WebSocketMessageSchema = external_exports.object({
19653
- type: external_exports.enum(["test-begin", "test-end", "run-end", "approve", "sync"]),
19654
- data: external_exports.unknown()
19655
- });
19656
- var TestBeginDataSchema = external_exports.object({
19657
- id: external_exports.string(),
19658
- title: external_exports.string(),
19659
- titlePath: external_exports.array(external_exports.string()),
19660
- browser: external_exports.string(),
19661
- location: LocationSchema
19662
- });
19663
- var TestEndDataSchema = external_exports.object({
19664
- id: external_exports.string(),
19665
- status: external_exports.enum(["passed", "failed", "skipped"]),
19666
- attachments: external_exports.array(AttachmentSchema),
19667
- error: external_exports.string().optional(),
19668
- duration: external_exports.number().optional()
19669
- });
19670
- var ReportDataSchema = external_exports.object({
19671
- isRunning: external_exports.boolean(),
19672
- tests: external_exports.record(external_exports.string(), TestDataSchema),
19673
- browsers: external_exports.array(external_exports.string()),
19674
- isUpdateMode: external_exports.boolean(),
19675
- screenshotDir: external_exports.string()
19676
- });
19677
- var LoadedReportDataSchema = external_exports.object({
19678
- tests: external_exports.record(external_exports.string(), TestDataSchema).optional(),
19679
- isUpdateMode: external_exports.boolean().optional()
19680
- });
19681
- var OfflineEventSchema = external_exports.object({
19682
- type: external_exports.enum(["test-begin", "test-end", "run-end"]),
19683
- data: external_exports.unknown(),
19684
- timestamp: external_exports.number(),
19685
- workerIndex: external_exports.number()
19686
- });
19687
- var OfflineReportSchema = external_exports.object({
19688
- version: external_exports.number(),
19689
- generatedAt: external_exports.string(),
19690
- workers: external_exports.number(),
19691
- events: external_exports.array(OfflineEventSchema)
19692
- });
19693
- var ApproveRequestBodySchema = external_exports.object({
19694
- id: external_exports.string(),
19695
- retry: external_exports.number(),
19696
- image: external_exports.string()
19697
- });
19698
- var ReportApiResponseSchema = external_exports.object({
19699
- tests: external_exports.record(external_exports.string(), TestDataSchema),
19700
- isUpdateMode: external_exports.boolean().optional()
19701
- });
19702
- var ClientBootstrapDataSchema = external_exports.object({
19703
- report: ReportApiResponseSchema.extend({
19704
- isUpdateMode: external_exports.boolean()
19705
- }),
19706
- liveUpdates: external_exports.boolean(),
19707
- approvalEnabled: external_exports.boolean(),
19708
- approvalMessage: external_exports.string().optional()
19709
- });
19710
- var ImagesViewModeSchema = external_exports.enum(["side-by-side", "swap", "slide", "blend"]);
19711
- function safeParse3(schema, data) {
19712
- const result = schema.safeParse(data);
19713
- if (result.success) {
19714
- return result.data;
19776
+ function recalcAllSuiteStatuses(suite) {
19777
+ for (const child2 of getChildrenArray(suite.children)) {
19778
+ if (!isTest(child2)) {
19779
+ recalcAllSuiteStatuses(child2);
19780
+ }
19715
19781
  }
19716
- return null;
19782
+ suite.status = getChildrenArray(suite.children).map(({ status }) => status).reduce(calcStatus);
19717
19783
  }
19718
19784
 
19719
19785
  // src/client/viewMode.ts
@@ -20216,13 +20282,15 @@ function SlideView($$anchor, $$props) {
20216
20282
  delegate(["input"]);
20217
20283
 
20218
20284
  // src/client/components/SideBySideView.svelte
20219
- var root_14 = from_html(`<div class="flex-1 flex flex-col bg-surface-panel rounded-md overflow-hidden min-w-0 border-2 border-green-500/60"><h3 class="m-0 px-3 py-2 text-xs font-bold bg-green-500/25 text-green-800 dark:text-green-200 uppercase tracking-wider">Expected</h3> <div class="flex items-center justify-center p-2"><img alt="Expected" class="w-auto max-w-full object-contain mx-auto" loading="lazy"/></div></div>`);
20220
- var root_24 = from_html(`<div class="flex-1 flex flex-col bg-surface-panel rounded-md overflow-hidden min-w-0 border-2 border-yellow-500/60"><h3 class="m-0 px-3 py-2 text-xs font-bold bg-yellow-500/25 text-yellow-800 dark:text-yellow-200 uppercase tracking-wider">Diff</h3> <div class="flex items-center justify-center p-2"><img alt="Diff" class="w-auto max-w-full object-contain mx-auto" loading="lazy"/></div></div>`);
20221
- var root_32 = from_html(`<div class="flex-1 flex flex-col bg-surface-panel rounded-md overflow-hidden min-w-0 border-2 border-red-500/60"><h3 class="m-0 px-3 py-2 text-xs font-bold bg-red-500/25 text-red-800 dark:text-red-200 uppercase tracking-wider">Actual</h3> <div class="flex items-center justify-center p-2"><img alt="Actual" class="w-auto max-w-full object-contain mx-auto" loading="lazy"/></div></div>`);
20285
+ var root_24 = from_html(`<div class="px-3 py-2 text-xs text-fg-muted border-t border-edge/70">Copied from the snapshot on disk.</div>`);
20286
+ var root_14 = from_html(`<div class="flex-1 flex flex-col bg-surface-panel rounded-md overflow-hidden min-w-0 border-2 border-green-500/60"><h3 class="m-0 px-3 py-2 text-xs font-bold bg-green-500/25 text-green-800 dark:text-green-200 uppercase tracking-wider"> </h3> <div class="flex items-center justify-center p-2"><img alt="Expected" class="w-auto max-w-full object-contain mx-auto" loading="lazy"/></div> <!></div>`);
20287
+ var root_32 = from_html(`<div class="flex-1 flex flex-col bg-surface-panel rounded-md overflow-hidden min-w-0 border-2 border-yellow-500/60"><h3 class="m-0 px-3 py-2 text-xs font-bold bg-yellow-500/25 text-yellow-800 dark:text-yellow-200 uppercase tracking-wider">Diff</h3> <div class="flex items-center justify-center p-2"><img alt="Diff" class="w-auto max-w-full object-contain mx-auto" loading="lazy"/></div></div>`);
20288
+ var root_42 = from_html(`<div class="flex-1 flex flex-col bg-surface-panel rounded-md overflow-hidden min-w-0 border-2 border-red-500/60"><h3 class="m-0 px-3 py-2 text-xs font-bold bg-red-500/25 text-red-800 dark:text-red-200 uppercase tracking-wider">Actual</h3> <div class="flex items-center justify-center p-2"><img alt="Actual" class="w-auto max-w-full object-contain mx-auto" loading="lazy"/></div></div>`);
20222
20289
  var root3 = from_html(`<div><!> <!> <!></div>`);
20223
20290
  function SideBySideView($$anchor, $$props) {
20224
20291
  push($$props, true);
20225
20292
  let isLandscape = state(false);
20293
+ let expectedLabel = user_derived(() => $$props.image.source === "baseline-only" && !$$props.image.actual && !$$props.image.diff ? "Baseline" : "Expected");
20226
20294
  user_effect(() => {
20227
20295
  const src = $$props.image.diff ?? $$props.image.expect ?? $$props.image.actual;
20228
20296
  if (!src) return;
@@ -20238,47 +20306,63 @@ function SideBySideView($$anchor, $$props) {
20238
20306
  let classes;
20239
20307
  var node = child(div);
20240
20308
  {
20241
- var consequent = ($$anchor2) => {
20309
+ var consequent_1 = ($$anchor2) => {
20242
20310
  var div_1 = root_14();
20243
- var div_2 = sibling(child(div_1), 2);
20311
+ var h3 = child(div_1);
20312
+ var text2 = child(h3, true);
20313
+ reset(h3);
20314
+ var div_2 = sibling(h3, 2);
20244
20315
  var img_1 = child(div_2);
20245
20316
  reset(div_2);
20317
+ var node_1 = sibling(div_2, 2);
20318
+ {
20319
+ var consequent = ($$anchor3) => {
20320
+ var div_3 = root_24();
20321
+ append($$anchor3, div_3);
20322
+ };
20323
+ if_block(node_1, ($$render) => {
20324
+ if ($$props.image.source === "baseline-only" && !$$props.image.actual && !$$props.image.diff) $$render(consequent);
20325
+ });
20326
+ }
20246
20327
  reset(div_1);
20247
- template_effect(() => set_attribute2(img_1, "src", $$props.image.expect));
20328
+ template_effect(() => {
20329
+ set_text(text2, get2(expectedLabel));
20330
+ set_attribute2(img_1, "src", $$props.image.expect);
20331
+ });
20248
20332
  append($$anchor2, div_1);
20249
20333
  };
20250
20334
  if_block(node, ($$render) => {
20251
- if ($$props.image.expect) $$render(consequent);
20335
+ if ($$props.image.expect) $$render(consequent_1);
20252
20336
  });
20253
20337
  }
20254
- var node_1 = sibling(node, 2);
20338
+ var node_2 = sibling(node, 2);
20255
20339
  {
20256
- var consequent_1 = ($$anchor2) => {
20257
- var div_3 = root_24();
20258
- var div_4 = sibling(child(div_3), 2);
20259
- var img_2 = child(div_4);
20340
+ var consequent_2 = ($$anchor2) => {
20341
+ var div_4 = root_32();
20342
+ var div_5 = sibling(child(div_4), 2);
20343
+ var img_2 = child(div_5);
20344
+ reset(div_5);
20260
20345
  reset(div_4);
20261
- reset(div_3);
20262
20346
  template_effect(() => set_attribute2(img_2, "src", $$props.image.diff));
20263
- append($$anchor2, div_3);
20347
+ append($$anchor2, div_4);
20264
20348
  };
20265
- if_block(node_1, ($$render) => {
20266
- if ($$props.image.diff) $$render(consequent_1);
20349
+ if_block(node_2, ($$render) => {
20350
+ if ($$props.image.diff) $$render(consequent_2);
20267
20351
  });
20268
20352
  }
20269
- var node_2 = sibling(node_1, 2);
20353
+ var node_3 = sibling(node_2, 2);
20270
20354
  {
20271
- var consequent_2 = ($$anchor2) => {
20272
- var div_5 = root_32();
20273
- var div_6 = sibling(child(div_5), 2);
20274
- var img_3 = child(div_6);
20355
+ var consequent_3 = ($$anchor2) => {
20356
+ var div_6 = root_42();
20357
+ var div_7 = sibling(child(div_6), 2);
20358
+ var img_3 = child(div_7);
20359
+ reset(div_7);
20275
20360
  reset(div_6);
20276
- reset(div_5);
20277
20361
  template_effect(() => set_attribute2(img_3, "src", $$props.image.actual));
20278
- append($$anchor2, div_5);
20362
+ append($$anchor2, div_6);
20279
20363
  };
20280
- if_block(node_2, ($$render) => {
20281
- if ($$props.image.actual) $$render(consequent_2);
20364
+ if_block(node_3, ($$render) => {
20365
+ if ($$props.image.actual) $$render(consequent_3);
20282
20366
  });
20283
20367
  }
20284
20368
  reset(div);
@@ -20425,14 +20509,20 @@ function BlendView($$anchor, $$props) {
20425
20509
 
20426
20510
  // src/client/components/ResultsPage.svelte
20427
20511
  var root_27 = from_html(`<button> </button>`);
20428
- var root_42 = from_html(`<button> </button>`);
20512
+ var root_43 = from_html(`<button> </button>`);
20429
20513
  var root_34 = from_html(`<div class="flex gap-1 flex-wrap justify-center mt-1"></div>`);
20430
20514
  var root_52 = from_html(`<div class="flex-1 flex items-center justify-center text-fg-muted text-base">No image to display</div>`);
20431
- var root_102 = from_html(`<div class="flex flex-col bg-surface-panel rounded-md overflow-hidden min-w-0 border-2 border-red-500/60"><h3 class="m-0 px-3 py-2 text-xs font-bold bg-red-500/25 text-red-800 dark:text-red-200 uppercase tracking-wider">Actual</h3> <div class="flex items-center justify-center p-2"><img alt="Actual" class="w-auto max-w-full object-contain mx-auto" loading="lazy"/></div></div>`);
20432
- var root_82 = from_html(`<div class="flex flex-col gap-3"><!></div>`);
20433
- var root_142 = from_html(`<button> </button>`);
20434
- var root_152 = from_html(`<span class="px-1 text-fg-muted text-xs"></span>`);
20435
- var root_122 = from_html(`<div class="py-2 px-5 bg-surface-alt border-t border-edge flex items-center justify-center gap-1 shrink-0"><button aria-label="Previous retry">&#8249;</button> <div class="flex gap-0.5 items-center"></div> <button aria-label="Next retry">&#8250;</button></div>`);
20515
+ var root_62 = from_html(`<div class="max-w-xl w-full rounded-md border border-edge bg-surface-panel px-5 py-6 text-center"><h3 class="m-0 text-sm font-semibold text-fg-bright uppercase tracking-wide">Passed Visual Assertion</h3> <p class="mt-3 text-sm leading-6 text-fg-muted">Playwright reported this screenshot assertion, but did not emit an actual, expected, or diff artifact for the passing comparison.</p></div>`);
20516
+ var root_82 = from_html(`<div class="mx-auto max-w-2xl w-full rounded-md border border-info/40 bg-info/10 px-4 py-3 text-sm text-fg">Baseline copied from the stored snapshot. Playwright did not emit a passed actual image for this comparison.</div>`);
20517
+ var root_7 = from_html(`<div class="w-full flex flex-col gap-3"><!> <!></div>`);
20518
+ var root_112 = from_html(`<div class="mx-auto max-w-2xl w-full rounded-md border border-info/40 bg-info/10 px-4 py-3 text-sm text-fg">Baseline copied from the stored snapshot. Playwright did not emit a passed actual image for this comparison.</div>`);
20519
+ var root_132 = from_html(`<div class="flex flex-col bg-surface-panel rounded-md overflow-hidden min-w-0 border-2 border-red-500/60"><h3 class="m-0 px-3 py-2 text-xs font-bold bg-red-500/25 text-red-800 dark:text-red-200 uppercase tracking-wider">Actual</h3> <div class="flex items-center justify-center p-2"><img alt="Actual" class="w-auto max-w-full object-contain mx-auto" loading="lazy"/></div></div>`);
20520
+ var root_102 = from_html(`<div class="flex flex-col gap-3"><!> <!></div>`);
20521
+ var root_152 = from_html(`<div class="mx-auto max-w-2xl w-full rounded-md border border-info/40 bg-info/10 px-4 py-3 text-sm text-fg">Baseline copied from the stored snapshot. Playwright did not emit a passed actual image for this comparison.</div>`);
20522
+ var root_142 = from_html(`<div class="w-full flex flex-col gap-3"><!> <!></div>`);
20523
+ var root_18 = from_html(`<button> </button>`);
20524
+ var root_19 = from_html(`<span class="px-1 text-fg-muted text-xs"></span>`);
20525
+ var root_162 = from_html(`<div class="py-2 px-5 bg-surface-alt border-t border-edge flex items-center justify-center gap-1 shrink-0"><button aria-label="Previous retry">&#8249;</button> <div class="flex gap-0.5 items-center"></div> <button aria-label="Next retry">&#8250;</button></div>`);
20436
20526
  var root6 = from_html(`<div class="flex flex-col h-full"><div class="py-3 px-5 max-md:px-3 bg-surface-alt border-b border-edge flex items-center gap-2 shrink-0"><div class="flex shrink-0 mr-3"><!></div> <div class="flex-1 flex flex-col items-center min-w-0 pr-10"><h2 class="text-base text-fg-bright m-0 font-medium whitespace-nowrap overflow-hidden text-ellipsis text-pretty max-w-full"> </h2> <!></div></div> <div class="flex-1 overflow-auto min-h-0"><div class="min-h-full p-4 max-md:p-2 flex justify-center items-center"><!></div></div> <!></div>`);
20437
20527
  function ResultsPage($$anchor, $$props) {
20438
20528
  push($$props, true);
@@ -20441,6 +20531,8 @@ function ResultsPage($$anchor, $$props) {
20441
20531
  let imageNames = user_derived(() => get2(result)?.images ? Object.keys(get2(result).images) : []);
20442
20532
  let totalRetries = user_derived(() => $$props.test.results?.length ?? 0);
20443
20533
  let hasDiffAndExpect = user_derived(() => Boolean(get2(image)?.diff && get2(image)?.expect));
20534
+ let isBaselineOnly = user_derived(() => get2(image)?.source === "baseline-only");
20535
+ let isDeclaredOnly = user_derived(() => get2(image)?.source === "declared-only");
20444
20536
  let imagesWithError = user_derived(() => get2(result)?.images ? Object.keys(get2(result).images).filter((name) => get2(result).status !== "success" && $$props.test.approved?.[name] !== $$props.retry - 1 && get2(result).images?.[name]?.diff !== null) : []);
20445
20537
  let imagesApproved = user_derived(() => get2(result)?.images ? Object.keys(get2(result).images).filter((name) => $$props.test.approved?.[name] === $$props.retry - 1) : []);
20446
20538
  function handleKeydown(e) {
@@ -20501,7 +20593,7 @@ function ResultsPage($$anchor, $$props) {
20501
20593
  var consequent_1 = ($$anchor2) => {
20502
20594
  var div_4 = root_34();
20503
20595
  each(div_4, 21, () => get2(imageNames), index, ($$anchor3, name) => {
20504
- var button_1 = root_42();
20596
+ var button_1 = root_43();
20505
20597
  var text_2 = child(button_1, true);
20506
20598
  reset(button_1);
20507
20599
  template_effect(
@@ -20534,24 +20626,52 @@ function ResultsPage($$anchor, $$props) {
20534
20626
  append($$anchor2, div_7);
20535
20627
  };
20536
20628
  var consequent_3 = ($$anchor2) => {
20537
- SideBySideView($$anchor2, {
20629
+ var div_8 = root_62();
20630
+ append($$anchor2, div_8);
20631
+ };
20632
+ var consequent_5 = ($$anchor2) => {
20633
+ var div_9 = root_7();
20634
+ var node_4 = child(div_9);
20635
+ {
20636
+ var consequent_4 = ($$anchor3) => {
20637
+ var div_10 = root_82();
20638
+ append($$anchor3, div_10);
20639
+ };
20640
+ if_block(node_4, ($$render) => {
20641
+ if (get2(isBaselineOnly)) $$render(consequent_4);
20642
+ });
20643
+ }
20644
+ var node_5 = sibling(node_4, 2);
20645
+ SideBySideView(node_5, {
20538
20646
  get image() {
20539
20647
  return get2(image);
20540
20648
  }
20541
20649
  });
20650
+ reset(div_9);
20651
+ append($$anchor2, div_9);
20542
20652
  };
20543
- var consequent_4 = ($$anchor2) => {
20653
+ var consequent_6 = ($$anchor2) => {
20544
20654
  SwapView($$anchor2, {
20545
20655
  get image() {
20546
20656
  return get2(image);
20547
20657
  }
20548
20658
  });
20549
20659
  };
20550
- var consequent_7 = ($$anchor2) => {
20551
- var div_8 = root_82();
20552
- var node_4 = child(div_8);
20660
+ var consequent_10 = ($$anchor2) => {
20661
+ var div_11 = root_102();
20662
+ var node_6 = child(div_11);
20553
20663
  {
20554
- var consequent_5 = ($$anchor3) => {
20664
+ var consequent_7 = ($$anchor3) => {
20665
+ var div_12 = root_112();
20666
+ append($$anchor3, div_12);
20667
+ };
20668
+ if_block(node_6, ($$render) => {
20669
+ if (get2(isBaselineOnly)) $$render(consequent_7);
20670
+ });
20671
+ }
20672
+ var node_7 = sibling(node_6, 2);
20673
+ {
20674
+ var consequent_8 = ($$anchor3) => {
20555
20675
  SlideView($$anchor3, {
20556
20676
  get actual() {
20557
20677
  return get2(image).actual;
@@ -20564,52 +20684,67 @@ function ResultsPage($$anchor, $$props) {
20564
20684
  }
20565
20685
  });
20566
20686
  };
20567
- var consequent_6 = ($$anchor3) => {
20568
- var div_9 = root_102();
20569
- var div_10 = sibling(child(div_9), 2);
20570
- var img = child(div_10);
20571
- reset(div_10);
20572
- reset(div_9);
20687
+ var consequent_9 = ($$anchor3) => {
20688
+ var div_13 = root_132();
20689
+ var div_14 = sibling(child(div_13), 2);
20690
+ var img = child(div_14);
20691
+ reset(div_14);
20692
+ reset(div_13);
20573
20693
  template_effect(() => set_attribute2(img, "src", get2(image).actual));
20574
- append($$anchor3, div_9);
20694
+ append($$anchor3, div_13);
20575
20695
  };
20576
- if_block(node_4, ($$render) => {
20577
- if (get2(image).actual && get2(image).expect && get2(image).diff) $$render(consequent_5);
20578
- else if (get2(image).actual) $$render(consequent_6, 1);
20696
+ if_block(node_7, ($$render) => {
20697
+ if (get2(image).actual && get2(image).expect && get2(image).diff) $$render(consequent_8);
20698
+ else if (get2(image).actual) $$render(consequent_9, 1);
20579
20699
  });
20580
20700
  }
20581
- reset(div_8);
20582
- append($$anchor2, div_8);
20701
+ reset(div_11);
20702
+ append($$anchor2, div_11);
20583
20703
  };
20584
- var consequent_8 = ($$anchor2) => {
20585
- BlendView($$anchor2, {
20704
+ var consequent_12 = ($$anchor2) => {
20705
+ var div_15 = root_142();
20706
+ var node_8 = child(div_15);
20707
+ {
20708
+ var consequent_11 = ($$anchor3) => {
20709
+ var div_16 = root_152();
20710
+ append($$anchor3, div_16);
20711
+ };
20712
+ if_block(node_8, ($$render) => {
20713
+ if (get2(isBaselineOnly)) $$render(consequent_11);
20714
+ });
20715
+ }
20716
+ var node_9 = sibling(node_8, 2);
20717
+ BlendView(node_9, {
20586
20718
  get image() {
20587
20719
  return get2(image);
20588
20720
  }
20589
20721
  });
20722
+ reset(div_15);
20723
+ append($$anchor2, div_15);
20590
20724
  };
20591
20725
  if_block(node_3, ($$render) => {
20592
20726
  if (!get2(image)) $$render(consequent_2);
20593
- else if ($$props.viewMode === "side-by-side" || !get2(hasDiffAndExpect)) $$render(consequent_3, 1);
20594
- else if ($$props.viewMode === "swap") $$render(consequent_4, 2);
20595
- else if ($$props.viewMode === "slide") $$render(consequent_7, 3);
20596
- else if ($$props.viewMode === "blend") $$render(consequent_8, 4);
20727
+ else if (get2(isDeclaredOnly)) $$render(consequent_3, 1);
20728
+ else if ($$props.viewMode === "side-by-side" || !get2(hasDiffAndExpect)) $$render(consequent_5, 2);
20729
+ else if ($$props.viewMode === "swap") $$render(consequent_6, 3);
20730
+ else if ($$props.viewMode === "slide") $$render(consequent_10, 4);
20731
+ else if ($$props.viewMode === "blend") $$render(consequent_12, 5);
20597
20732
  });
20598
20733
  }
20599
20734
  reset(div_6);
20600
20735
  reset(div_5);
20601
- var node_5 = sibling(div_5, 2);
20736
+ var node_10 = sibling(div_5, 2);
20602
20737
  {
20603
- var consequent_11 = ($$anchor2) => {
20604
- var div_11 = root_122();
20605
- var button_2 = child(div_11);
20606
- var div_12 = sibling(button_2, 2);
20607
- each(div_12, 21, () => Array.from({ length: get2(totalRetries) }, (_, i) => i + 1), index, ($$anchor3, page) => {
20608
- var fragment_5 = comment();
20609
- var node_6 = first_child(fragment_5);
20738
+ var consequent_15 = ($$anchor2) => {
20739
+ var div_17 = root_162();
20740
+ var button_2 = child(div_17);
20741
+ var div_18 = sibling(button_2, 2);
20742
+ each(div_18, 21, () => Array.from({ length: get2(totalRetries) }, (_, i) => i + 1), index, ($$anchor3, page) => {
20743
+ var fragment_3 = comment();
20744
+ var node_11 = first_child(fragment_3);
20610
20745
  {
20611
- var consequent_9 = ($$anchor4) => {
20612
- var button_3 = root_142();
20746
+ var consequent_13 = ($$anchor4) => {
20747
+ var button_3 = root_18();
20613
20748
  var text_3 = child(button_3, true);
20614
20749
  reset(button_3);
20615
20750
  template_effect(
@@ -20625,21 +20760,21 @@ function ResultsPage($$anchor, $$props) {
20625
20760
  append($$anchor4, button_3);
20626
20761
  };
20627
20762
  var d = user_derived(() => get2(totalRetries) <= 7 || get2(page) === 1 || get2(page) === get2(totalRetries) || Math.abs(get2(page) - $$props.retry) <= 1);
20628
- var consequent_10 = ($$anchor4) => {
20629
- var span = root_152();
20763
+ var consequent_14 = ($$anchor4) => {
20764
+ var span = root_19();
20630
20765
  span.textContent = "\u2026";
20631
20766
  append($$anchor4, span);
20632
20767
  };
20633
- if_block(node_6, ($$render) => {
20634
- if (get2(d)) $$render(consequent_9);
20635
- else if (get2(page) === 2 || get2(page) === get2(totalRetries) - 1) $$render(consequent_10, 1);
20768
+ if_block(node_11, ($$render) => {
20769
+ if (get2(d)) $$render(consequent_13);
20770
+ else if (get2(page) === 2 || get2(page) === get2(totalRetries) - 1) $$render(consequent_14, 1);
20636
20771
  });
20637
20772
  }
20638
- append($$anchor3, fragment_5);
20773
+ append($$anchor3, fragment_3);
20639
20774
  });
20640
- reset(div_12);
20641
- var button_4 = sibling(div_12, 2);
20642
- reset(div_11);
20775
+ reset(div_18);
20776
+ var button_4 = sibling(div_18, 2);
20777
+ reset(div_17);
20643
20778
  template_effect(
20644
20779
  ($0, $1) => {
20645
20780
  set_class(button_2, 1, $0);
@@ -20654,10 +20789,10 @@ function ResultsPage($$anchor, $$props) {
20654
20789
  );
20655
20790
  delegated("click", button_2, () => $$props.onRetryChange($$props.retry - 1));
20656
20791
  delegated("click", button_4, () => $$props.onRetryChange($$props.retry + 1));
20657
- append($$anchor2, div_11);
20792
+ append($$anchor2, div_17);
20658
20793
  };
20659
- if_block(node_5, ($$render) => {
20660
- if (get2(totalRetries) > 1) $$render(consequent_11);
20794
+ if_block(node_10, ($$render) => {
20795
+ if (get2(totalRetries) > 1) $$render(consequent_15);
20661
20796
  });
20662
20797
  }
20663
20798
  reset(div);
@@ -20864,8 +20999,9 @@ function App($$anchor, $$props) {
20864
20999
  }
20865
21000
  }
20866
21001
  async function handleImageApprove() {
20867
- if (!get2(openedTest)?.id || !get2(canApprove)) return;
20868
- await $$props.onApprove(get2(openedTest).id, get2(retry) - 1, get2(imageName));
21002
+ if (!get2(openedTest)?.id || !get2(canApprove)) return false;
21003
+ const approvalResult = await $$props.onApprove(get2(openedTest).id, get2(retry) - 1, get2(imageName));
21004
+ if (!approvalResult.success) return false;
20869
21005
  if (!get2(openedTest).approved) get2(openedTest).approved = {};
20870
21006
  get2(openedTest).approved[get2(imageName)] = get2(retry) - 1;
20871
21007
  const result = get2(openedTest).results?.[get2(retry) - 1];
@@ -20876,16 +21012,19 @@ function App($$anchor, $$props) {
20876
21012
  recalcSuiteStatuses(get2(tests), getTestPath(get2(openedTest)));
20877
21013
  }
20878
21014
  }
21015
+ return true;
20879
21016
  }
20880
21017
  async function handleApproveAndGoNext() {
20881
- await handleImageApprove();
20882
- handleGoToNextFailed();
21018
+ if (await handleImageApprove()) {
21019
+ handleGoToNextFailed();
21020
+ }
20883
21021
  }
20884
21022
  function getAllTests(suite) {
20885
21023
  return Object.values(suite.children).filter(isDefined).flatMap((child2) => isTest(child2) ? [child2] : getAllTests(child2));
20886
21024
  }
20887
21025
  async function handleApproveAllTests() {
20888
- await $$props.onApproveAll();
21026
+ const approvalResult = await $$props.onApproveAll();
21027
+ if (!isBulkApprovalOptimisticSafe(approvalResult)) return;
20889
21028
  getAllTests(get2(tests)).forEach((test) => {
20890
21029
  if (!test.results?.length) return;
20891
21030
  const lastIdx = test.results.length - 1;
@@ -21078,14 +21217,16 @@ async function loadReportData() {
21078
21217
  };
21079
21218
  }
21080
21219
  var handleApprove = async (id, retry, image) => {
21081
- await fetch("/api/approve", {
21220
+ const response = await fetch("/api/approve", {
21082
21221
  method: "POST",
21083
21222
  headers: { "Content-Type": "application/json" },
21084
21223
  body: JSON.stringify({ id, retry, image })
21085
21224
  });
21225
+ return readApproveResult(response);
21086
21226
  };
21087
21227
  var handleApproveAll = async () => {
21088
- await fetch("/api/approve-all", { method: "POST" });
21228
+ const response = await fetch("/api/approve-all", { method: "POST" });
21229
+ return readApproveAllResult(response);
21089
21230
  };
21090
21231
  var root9 = document.getElementById("root");
21091
21232
  root9.innerHTML = `<div style="display:flex;align-items:center;justify-content:center;height:100vh;color:#808080;font-size:14px">Loading\u2026</div>`;