@pipelex/mthds-form 0.24.0 → 0.25.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.
@@ -1,9 +1,9 @@
1
- import { planFileSave, planStuffSave, splitFileName, typedFileStem } from './chunk-ICUEHNEH.js';
1
+ import { planFileSave, planStuffSave, splitFileName, typedFileStem } from './chunk-QWHUUMSB.js';
2
2
  import { seedInputs, closeOptionalStructures, openOptionalStructures } from './chunk-VH5CDQDR.js';
3
3
  import { sourceFileValue, roomForChosenFiles, roomForDroppedFiles, addChosenFiles, placeDroppedFiles, chosenFilesAdded } from './chunk-NSHGLM6A.js';
4
- import { readStuffFile } from './chunk-RRTI7AIR.js';
4
+ import { readStuffFile } from './chunk-QINLJ5RM.js';
5
5
  import { apiInputsFromRunValues, sameRunValues, runValuesFromInputs, setValueAtPath } from './chunk-ZX52CQJ4.js';
6
- import { viewableUrl, isNativeDateNode, isNativeHtmlNode, readHtmlContent, isNativeCompositeNode, readCompositeContent, isNativeValueNode, readDateContent, formatDateContent, readImageContent, readDataUrl, readDocumentContent } from './chunk-CM4KVG53.js';
6
+ import { TYPED_SCALAR_MARKERS, viewableUrl, isNativeDateNode, isNativeHtmlNode, readHtmlContent, isNativeCompositeNode, readCompositeContent, isNativePageNode, nativeVerdictOf, isNativeValueNode, readDateContent, formatDateContent, readPageContent, readYesNoContent, readRatingContent, readChoiceContent, readImageContent, readDataUrl, readDocumentContent } from './chunk-JSPF4BQP.js';
7
7
  import { buildRunFields } from './chunk-ZB4RYUKV.js';
8
8
  import { conceptCategory } from './chunk-FABY3DEY.js';
9
9
  import { acceptLabel, acceptMap, isAcceptedFile, normalizeMimeType, formatOfFilename, DOCUMENT_FORMATS, IMAGE_FORMATS } from './chunk-XCO6GTEC.js';
@@ -219,6 +219,7 @@ var DAY_YEAR = new Intl.DateTimeFormat("en-GB", {
219
219
  month: "short",
220
220
  year: "numeric"
221
221
  });
222
+ var PERCENT = new Intl.NumberFormat("en-GB", { style: "percent", maximumFractionDigits: 0 });
222
223
  function formatFileDate(date) {
223
224
  const days = calendarDaysBefore(date);
224
225
  if (days === 0) return `Today, ${TIME.format(date)}`;
@@ -281,6 +282,11 @@ var EN_FIELD_STRINGS = {
281
282
  resultViewGroup: "Result view",
282
283
  yes: "Yes",
283
284
  no: "No",
285
+ yesProbability: (share) => `Probability of yes: ${PERCENT.format(share)}`,
286
+ verdictConfidence: (share) => `Confidence: ${PERCENT.format(share)}`,
287
+ ratingLevel: (position) => `Level ${position}`,
288
+ pageNumber: (position) => `Page ${position}`,
289
+ extractedTable: "Table",
284
290
  unsupportedFileType: (formats) => `That file type is not supported. Accepted formats: ${formats}.`,
285
291
  dropFilesOrBrowse: "Drop files or click to browse",
286
292
  dropFilesToAdd: "Drop to add the files",
@@ -381,6 +387,7 @@ var DAY_YEAR2 = new Intl.DateTimeFormat("fr-FR", {
381
387
  month: "short",
382
388
  year: "numeric"
383
389
  });
390
+ var PERCENT2 = new Intl.NumberFormat("fr-FR", { style: "percent", maximumFractionDigits: 0 });
384
391
  function formatFileDate2(date) {
385
392
  const days = calendarDaysBefore(date);
386
393
  if (days === 0) return `Aujourd\u2019hui, ${TIME2.format(date)}`;
@@ -451,6 +458,11 @@ var FR_FIELD_STRINGS = {
451
458
  resultViewGroup: "Affichage du r\xE9sultat",
452
459
  yes: "Oui",
453
460
  no: "Non",
461
+ yesProbability: (share) => `Probabilit\xE9 du oui\xA0: ${PERCENT2.format(share)}`,
462
+ verdictConfidence: (share) => `Confiance\xA0: ${PERCENT2.format(share)}`,
463
+ ratingLevel: (position) => `Niveau ${position}`,
464
+ pageNumber: (position) => `Page ${position}`,
465
+ extractedTable: "Tableau",
454
466
  unsupportedFileType: (formats) => `Ce type de fichier n\u2019est pas pris en charge. Formats accept\xE9s\xA0: ${formats}.`,
455
467
  dropFilesOrBrowse: "D\xE9posez des fichiers ou cliquez pour parcourir",
456
468
  dropFilesToAdd: "D\xE9posez pour ajouter les fichiers",
@@ -1034,7 +1046,7 @@ function FilePickerBody({
1034
1046
  return next;
1035
1047
  });
1036
1048
  const choices = [...chosen.values()];
1037
- const use6 = () => {
1049
+ const use7 = () => {
1038
1050
  if (choices.length === 0) return;
1039
1051
  onUse(choices);
1040
1052
  onClose();
@@ -1139,7 +1151,7 @@ function FilePickerBody({
1139
1151
  "button",
1140
1152
  {
1141
1153
  type: "button",
1142
- onClick: use6,
1154
+ onClick: use7,
1143
1155
  disabled: choices.length === 0,
1144
1156
  className: cn(
1145
1157
  "flex h-12 w-full items-center justify-center rounded-md bg-primary px-4 text-[16px] font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-50",
@@ -2250,9 +2262,9 @@ function followingFocusable(from, skip) {
2250
2262
  }
2251
2263
  return null;
2252
2264
  }
2253
- function firstFocusable(within) {
2254
- if (!within) return null;
2255
- for (const element of within.querySelectorAll(FOCUSABLE)) {
2265
+ function firstFocusable(within2) {
2266
+ if (!within2) return null;
2267
+ for (const element of within2.querySelectorAll(FOCUSABLE)) {
2256
2268
  if (takesFocus(element)) return element;
2257
2269
  }
2258
2270
  return null;
@@ -3805,6 +3817,7 @@ function frameDocument(content, { styles, imgSrc, fontSrc }) {
3805
3817
  const head = [
3806
3818
  '<!doctype html><html><head><meta charset="utf-8">',
3807
3819
  `<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; img-src ${imgSrc}; font-src ${fontSrc}; base-uri 'none'; form-action 'none'">`,
3820
+ '<meta name="referrer" content="no-referrer">',
3808
3821
  `<style>${styles}</style></head>`
3809
3822
  ].join("");
3810
3823
  if (isWholeDocument(content.innerHtml)) return head + content.innerHtml;
@@ -4523,26 +4536,26 @@ function measureFlow(doc) {
4523
4536
  fixed.push(el);
4524
4537
  return;
4525
4538
  }
4526
- const span = spanOf(el);
4539
+ const span2 = spanOf(el);
4527
4540
  const display = style.display;
4528
4541
  if (FORCED.has(style.breakBefore) || FORCED.has(style.getPropertyValue("page-break-before"))) {
4529
- forced.push(span.top);
4542
+ forced.push(span2.top);
4530
4543
  }
4531
4544
  if (FORCED.has(style.breakAfter) || FORCED.has(style.getPropertyValue("page-break-after"))) {
4532
- forced.push(span.bottom);
4545
+ forced.push(span2.bottom);
4533
4546
  }
4534
- if (AVOIDED.has(style.breakAfter) || HEADING_TAGS.has(el.tagName)) keepAfter.push(span);
4535
- if (AVOIDED.has(style.breakBefore)) keepBefore.push(span);
4547
+ if (AVOIDED.has(style.breakAfter) || HEADING_TAGS.has(el.tagName)) keepAfter.push(span2);
4548
+ if (AVOIDED.has(style.breakBefore)) keepBefore.push(span2);
4536
4549
  const atomic = ATOMIC_TAGS.has(el.tagName) || display.startsWith("inline-");
4537
4550
  if (atomic) {
4538
- if (span.bottom > span.top) hard.push(span);
4551
+ if (span2.bottom > span2.top) hard.push(span2);
4539
4552
  return;
4540
4553
  }
4541
4554
  if (AVOIDED.has(style.breakInside) || AVOIDED.has(style.getPropertyValue("page-break-inside")) || display === "table-row") {
4542
- avoid.push(span);
4555
+ avoid.push(span2);
4543
4556
  }
4544
4557
  if (display === "table" || display === "inline-table") {
4545
- tables.push(tableBox(el, span));
4558
+ tables.push(tableBox(el, span2));
4546
4559
  }
4547
4560
  for (const child of Array.from(el.childNodes)) {
4548
4561
  if (child.nodeType === 1) walk(child);
@@ -4551,8 +4564,8 @@ function measureFlow(doc) {
4551
4564
  }
4552
4565
  }
4553
4566
  };
4554
- const tableBox = (table, span) => {
4555
- const box = { ...span };
4567
+ const tableBox = (table, span2) => {
4568
+ const box = { ...span2 };
4556
4569
  for (const part of Array.from(table.children)) {
4557
4570
  const display = win.getComputedStyle(part).display;
4558
4571
  if (display === "table-header-group" && !box.head) box.head = spanOf(part);
@@ -4565,13 +4578,13 @@ function measureFlow(doc) {
4565
4578
  const lines = [...hard].sort((a, b) => a.top - b.top);
4566
4579
  const firstLineFrom = (at) => lines.find((line) => line.top >= at - 0.5);
4567
4580
  const lastLineBefore = (at) => [...lines].reverse().find((line) => line.bottom <= at + 0.5);
4568
- for (const span of keepAfter) {
4569
- const next = firstLineFrom(span.bottom);
4570
- if (next) avoid.push({ top: span.top, bottom: next.bottom });
4581
+ for (const span2 of keepAfter) {
4582
+ const next = firstLineFrom(span2.bottom);
4583
+ if (next) avoid.push({ top: span2.top, bottom: next.bottom });
4571
4584
  }
4572
- for (const span of keepBefore) {
4573
- const previous = lastLineBefore(span.top);
4574
- const first = firstLineFrom(span.top);
4585
+ for (const span2 of keepBefore) {
4586
+ const previous = lastLineBefore(span2.top);
4587
+ const first = firstLineFrom(span2.top);
4575
4588
  if (previous && first) avoid.push({ top: previous.top, bottom: first.bottom });
4576
4589
  }
4577
4590
  for (const table of tables) {
@@ -4589,17 +4602,17 @@ function measureFlow(doc) {
4589
4602
  function lineSpans(doc, text, y) {
4590
4603
  const range = doc.createRange();
4591
4604
  range.selectNodeContents(text);
4592
- const spans = [];
4605
+ const spans2 = [];
4593
4606
  for (const rect of Array.from(range.getClientRects())) {
4594
4607
  if (rect.height === 0) continue;
4595
- const span = { top: y(rect.top), bottom: y(rect.bottom) };
4596
- const same = spans.find((line) => span.top < line.bottom && span.bottom > line.top);
4608
+ const span2 = { top: y(rect.top), bottom: y(rect.bottom) };
4609
+ const same = spans2.find((line) => span2.top < line.bottom && span2.bottom > line.top);
4597
4610
  if (same) {
4598
- same.top = Math.min(same.top, span.top);
4599
- same.bottom = Math.max(same.bottom, span.bottom);
4600
- } else spans.push(span);
4611
+ same.top = Math.min(same.top, span2.top);
4612
+ same.bottom = Math.max(same.bottom, span2.bottom);
4613
+ } else spans2.push(span2);
4601
4614
  }
4602
- return spans;
4615
+ return spans2;
4603
4616
  }
4604
4617
 
4605
4618
  // src/react/paginate.ts
@@ -4607,7 +4620,7 @@ var EPSILON = 0.5;
4607
4620
  function paginate(layout, pageHeight) {
4608
4621
  const pages = [];
4609
4622
  const end = layout.height;
4610
- const inkBottom = Math.max(0, ...layout.hard.map((span) => span.bottom));
4623
+ const inkBottom = Math.max(0, ...layout.hard.map((span2) => span2.bottom));
4611
4624
  const forced = [...layout.forced].sort((a, b) => a - b);
4612
4625
  let start = 0;
4613
4626
  for (let guard = 0; start < end - EPSILON && guard < 1e4; guard++) {
@@ -4638,12 +4651,12 @@ function paginate(layout, pageHeight) {
4638
4651
  }
4639
4652
  function bestCut(layout, start, limit) {
4640
4653
  const room = limit - start;
4641
- const hard = layout.hard.filter((span) => span.bottom - span.top <= room);
4642
- const avoid = layout.avoid.filter((span) => span.bottom - span.top <= room);
4654
+ const hard = layout.hard.filter((span2) => span2.bottom - span2.top <= room);
4655
+ const avoid = layout.avoid.filter((span2) => span2.bottom - span2.top <= room);
4643
4656
  const candidates = /* @__PURE__ */ new Set([limit]);
4644
- for (const span of [...hard, ...avoid]) {
4645
- candidates.add(span.top);
4646
- candidates.add(span.bottom);
4657
+ for (const span2 of [...hard, ...avoid]) {
4658
+ candidates.add(span2.top);
4659
+ candidates.add(span2.bottom);
4647
4660
  }
4648
4661
  for (const table of layout.tables) {
4649
4662
  candidates.add(table.top);
@@ -4651,19 +4664,19 @@ function bestCut(layout, start, limit) {
4651
4664
  }
4652
4665
  const sorted = [...candidates].filter((at) => at > start + EPSILON && at <= limit + EPSILON).sort((a, b) => b - a);
4653
4666
  for (const constraints of [[...hard, ...avoid], hard]) {
4654
- const cut = sorted.find((at) => !constraints.some((span) => inside(span, at)));
4667
+ const cut = sorted.find((at) => !constraints.some((span2) => inside(span2, at)));
4655
4668
  if (cut !== void 0) return Math.min(cut, limit);
4656
4669
  }
4657
4670
  return limit;
4658
4671
  }
4659
- function inside(span, at) {
4660
- return at > span.top + EPSILON && at < span.bottom - EPSILON;
4672
+ function inside(span2, at) {
4673
+ return at > span2.top + EPSILON && at < span2.bottom - EPSILON;
4661
4674
  }
4662
4675
  function openAt(tables, at) {
4663
4676
  return tables.filter((table) => at > table.top + EPSILON && at < (table.foot?.top ?? table.bottom) - EPSILON).sort((a, b) => a.top - b.top);
4664
4677
  }
4665
- function total(spans) {
4666
- return spans.reduce((sum, span) => sum + (span.bottom - span.top), 0);
4678
+ function total(spans2) {
4679
+ return spans2.reduce((sum, span2) => sum + (span2.bottom - span2.top), 0);
4667
4680
  }
4668
4681
 
4669
4682
  // src/react/print-media.ts
@@ -4929,10 +4942,10 @@ async function paintPage(slice, page, area, scale, quality, flow, overlay) {
4929
4942
  context.fillStyle = "#fff";
4930
4943
  context.fillRect(0, 0, canvas.width, canvas.height);
4931
4944
  let y = page.margin.top;
4932
- for (const span of [...slice.heads, slice.body, ...slice.feet]) {
4933
- const height = span.bottom - span.top;
4945
+ for (const span2 of [...slice.heads, slice.body, ...slice.feet]) {
4946
+ const height = span2.bottom - span2.top;
4934
4947
  if (height <= 0) continue;
4935
- const image = await svgImage(flow, { top: span.top, width: area.width, height }, scale);
4948
+ const image = await svgImage(flow, { top: span2.top, width: area.width, height }, scale);
4936
4949
  context.drawImage(
4937
4950
  image,
4938
4951
  page.margin.left * scale,
@@ -5524,6 +5537,710 @@ var ENTITIES = {
5524
5537
  function decode(text) {
5525
5538
  return text.replace(/&(?:amp|lt|gt|quot|#39|#x27);/g, (entity) => ENTITIES[entity] ?? entity);
5526
5539
  }
5540
+ function ExtractedPageText({ segments }) {
5541
+ return /* @__PURE__ */ jsx("div", { className: "space-y-2", children: segments.map(
5542
+ (segment, index) => segment.kind === "markdown" ? /* @__PURE__ */ jsx(Markdown, { text: segment.text }, index) : /* @__PURE__ */ jsx(ExtractedTableView, { table: segment.table }, index)
5543
+ ) });
5544
+ }
5545
+ function ExtractedTableView({ table }) {
5546
+ const s = useFieldStrings();
5547
+ const headRows = leadingHeaderRows(table);
5548
+ const head = table.rows.slice(0, headRows);
5549
+ const body = table.rows.slice(headRows);
5550
+ return /* @__PURE__ */ jsxs("figure", { className: "space-y-1.5", children: [
5551
+ table.caption && /* @__PURE__ */ jsx("figcaption", { className: "text-[12.5px] text-muted-foreground", children: table.caption }),
5552
+ table.rows.length > 0 && /* @__PURE__ */ jsx(
5553
+ "div",
5554
+ {
5555
+ role: "group",
5556
+ "aria-label": table.caption ?? s.extractedTable,
5557
+ tabIndex: 0,
5558
+ className: cn("overflow-x-auto rounded-lg border border-border", focusOutlineClass),
5559
+ children: /* @__PURE__ */ jsxs("table", { className: "min-w-full border-collapse text-[12.5px] text-foreground", children: [
5560
+ head.length > 0 && /* @__PURE__ */ jsx("thead", { children: head.map((row, rowIndex) => /* @__PURE__ */ jsx("tr", { className: "border-b border-border bg-card/40", children: row.map((cell, cellIndex) => /* @__PURE__ */ jsx(
5561
+ "th",
5562
+ {
5563
+ scope: "col",
5564
+ ...spans(cell),
5565
+ className: "whitespace-pre-line px-2.5 py-1.5 text-start align-bottom font-semibold",
5566
+ children: cell.text
5567
+ },
5568
+ cellIndex
5569
+ )) }, rowIndex)) }),
5570
+ /* @__PURE__ */ jsx("tbody", { children: body.map((row, rowIndex) => /* @__PURE__ */ jsx("tr", { className: "border-b border-border/60 last:border-b-0", children: row.map(
5571
+ (cell, cellIndex) => cell.header ? /* @__PURE__ */ jsx(
5572
+ "th",
5573
+ {
5574
+ scope: "row",
5575
+ ...spans(cell),
5576
+ className: "whitespace-pre-line px-2.5 py-1.5 text-start align-top font-semibold",
5577
+ children: cell.text
5578
+ },
5579
+ cellIndex
5580
+ ) : /* @__PURE__ */ jsx(
5581
+ "td",
5582
+ {
5583
+ ...spans(cell),
5584
+ className: "whitespace-pre-line px-2.5 py-1.5 align-top",
5585
+ children: cell.text
5586
+ },
5587
+ cellIndex
5588
+ )
5589
+ ) }, rowIndex)) })
5590
+ ] })
5591
+ }
5592
+ )
5593
+ ] });
5594
+ }
5595
+ function leadingHeaderRows(table) {
5596
+ let count = 0;
5597
+ for (const row of table.rows) {
5598
+ if (!row.every((cell) => cell.header)) break;
5599
+ count += 1;
5600
+ }
5601
+ return count === table.rows.length ? 0 : count;
5602
+ }
5603
+ function spans(cell) {
5604
+ return {
5605
+ ...cell.colSpan !== void 0 ? { colSpan: cell.colSpan } : {},
5606
+ ...cell.rowSpan !== void 0 ? { rowSpan: cell.rowSpan } : {}
5607
+ };
5608
+ }
5609
+
5610
+ // src/react/html-entities.ts
5611
+ var HTML_NAMED_ENTITIES = {
5612
+ // The XML marks, their legacy uppercase spellings, and the special marks.
5613
+ apos: 39,
5614
+ AMP: 38,
5615
+ LT: 60,
5616
+ GT: 62,
5617
+ QUOT: 34,
5618
+ COPY: 169,
5619
+ REG: 174,
5620
+ quot: 34,
5621
+ amp: 38,
5622
+ lt: 60,
5623
+ gt: 62,
5624
+ OElig: 338,
5625
+ oelig: 339,
5626
+ Scaron: 352,
5627
+ scaron: 353,
5628
+ Yuml: 376,
5629
+ circ: 710,
5630
+ tilde: 732,
5631
+ ensp: 8194,
5632
+ emsp: 8195,
5633
+ thinsp: 8201,
5634
+ zwnj: 8204,
5635
+ zwj: 8205,
5636
+ lrm: 8206,
5637
+ rlm: 8207,
5638
+ ndash: 8211,
5639
+ mdash: 8212,
5640
+ lsquo: 8216,
5641
+ rsquo: 8217,
5642
+ sbquo: 8218,
5643
+ ldquo: 8220,
5644
+ rdquo: 8221,
5645
+ bdquo: 8222,
5646
+ dagger: 8224,
5647
+ Dagger: 8225,
5648
+ permil: 8240,
5649
+ lsaquo: 8249,
5650
+ rsaquo: 8250,
5651
+ euro: 8364,
5652
+ // Latin-1.
5653
+ nbsp: 160,
5654
+ iexcl: 161,
5655
+ cent: 162,
5656
+ pound: 163,
5657
+ curren: 164,
5658
+ yen: 165,
5659
+ brvbar: 166,
5660
+ sect: 167,
5661
+ uml: 168,
5662
+ copy: 169,
5663
+ ordf: 170,
5664
+ laquo: 171,
5665
+ not: 172,
5666
+ shy: 173,
5667
+ reg: 174,
5668
+ macr: 175,
5669
+ deg: 176,
5670
+ plusmn: 177,
5671
+ sup2: 178,
5672
+ sup3: 179,
5673
+ acute: 180,
5674
+ micro: 181,
5675
+ para: 182,
5676
+ middot: 183,
5677
+ cedil: 184,
5678
+ sup1: 185,
5679
+ ordm: 186,
5680
+ raquo: 187,
5681
+ frac14: 188,
5682
+ frac12: 189,
5683
+ frac34: 190,
5684
+ iquest: 191,
5685
+ Agrave: 192,
5686
+ Aacute: 193,
5687
+ Acirc: 194,
5688
+ Atilde: 195,
5689
+ Auml: 196,
5690
+ Aring: 197,
5691
+ AElig: 198,
5692
+ Ccedil: 199,
5693
+ Egrave: 200,
5694
+ Eacute: 201,
5695
+ Ecirc: 202,
5696
+ Euml: 203,
5697
+ Igrave: 204,
5698
+ Iacute: 205,
5699
+ Icirc: 206,
5700
+ Iuml: 207,
5701
+ ETH: 208,
5702
+ Ntilde: 209,
5703
+ Ograve: 210,
5704
+ Oacute: 211,
5705
+ Ocirc: 212,
5706
+ Otilde: 213,
5707
+ Ouml: 214,
5708
+ times: 215,
5709
+ Oslash: 216,
5710
+ Ugrave: 217,
5711
+ Uacute: 218,
5712
+ Ucirc: 219,
5713
+ Uuml: 220,
5714
+ Yacute: 221,
5715
+ THORN: 222,
5716
+ szlig: 223,
5717
+ agrave: 224,
5718
+ aacute: 225,
5719
+ acirc: 226,
5720
+ atilde: 227,
5721
+ auml: 228,
5722
+ aring: 229,
5723
+ aelig: 230,
5724
+ ccedil: 231,
5725
+ egrave: 232,
5726
+ eacute: 233,
5727
+ ecirc: 234,
5728
+ euml: 235,
5729
+ igrave: 236,
5730
+ iacute: 237,
5731
+ icirc: 238,
5732
+ iuml: 239,
5733
+ eth: 240,
5734
+ ntilde: 241,
5735
+ ograve: 242,
5736
+ oacute: 243,
5737
+ ocirc: 244,
5738
+ otilde: 245,
5739
+ ouml: 246,
5740
+ divide: 247,
5741
+ oslash: 248,
5742
+ ugrave: 249,
5743
+ uacute: 250,
5744
+ ucirc: 251,
5745
+ uuml: 252,
5746
+ yacute: 253,
5747
+ thorn: 254,
5748
+ yuml: 255,
5749
+ // Symbols, mathematical marks and Greek letters.
5750
+ fnof: 402,
5751
+ Alpha: 913,
5752
+ Beta: 914,
5753
+ Gamma: 915,
5754
+ Delta: 916,
5755
+ Epsilon: 917,
5756
+ Zeta: 918,
5757
+ Eta: 919,
5758
+ Theta: 920,
5759
+ Iota: 921,
5760
+ Kappa: 922,
5761
+ Lambda: 923,
5762
+ Mu: 924,
5763
+ Nu: 925,
5764
+ Xi: 926,
5765
+ Omicron: 927,
5766
+ Pi: 928,
5767
+ Rho: 929,
5768
+ Sigma: 931,
5769
+ Tau: 932,
5770
+ Upsilon: 933,
5771
+ Phi: 934,
5772
+ Chi: 935,
5773
+ Psi: 936,
5774
+ Omega: 937,
5775
+ alpha: 945,
5776
+ beta: 946,
5777
+ gamma: 947,
5778
+ delta: 948,
5779
+ epsilon: 949,
5780
+ zeta: 950,
5781
+ eta: 951,
5782
+ theta: 952,
5783
+ iota: 953,
5784
+ kappa: 954,
5785
+ lambda: 955,
5786
+ mu: 956,
5787
+ nu: 957,
5788
+ xi: 958,
5789
+ omicron: 959,
5790
+ pi: 960,
5791
+ rho: 961,
5792
+ sigmaf: 962,
5793
+ sigma: 963,
5794
+ tau: 964,
5795
+ upsilon: 965,
5796
+ phi: 966,
5797
+ chi: 967,
5798
+ psi: 968,
5799
+ omega: 969,
5800
+ thetasym: 977,
5801
+ upsih: 978,
5802
+ piv: 982,
5803
+ bull: 8226,
5804
+ hellip: 8230,
5805
+ prime: 8242,
5806
+ Prime: 8243,
5807
+ oline: 8254,
5808
+ frasl: 8260,
5809
+ image: 8465,
5810
+ weierp: 8472,
5811
+ real: 8476,
5812
+ trade: 8482,
5813
+ alefsym: 8501,
5814
+ larr: 8592,
5815
+ uarr: 8593,
5816
+ rarr: 8594,
5817
+ darr: 8595,
5818
+ harr: 8596,
5819
+ crarr: 8629,
5820
+ lArr: 8656,
5821
+ uArr: 8657,
5822
+ rArr: 8658,
5823
+ dArr: 8659,
5824
+ hArr: 8660,
5825
+ forall: 8704,
5826
+ part: 8706,
5827
+ exist: 8707,
5828
+ empty: 8709,
5829
+ nabla: 8711,
5830
+ isin: 8712,
5831
+ notin: 8713,
5832
+ ni: 8715,
5833
+ prod: 8719,
5834
+ sum: 8721,
5835
+ minus: 8722,
5836
+ lowast: 8727,
5837
+ radic: 8730,
5838
+ prop: 8733,
5839
+ infin: 8734,
5840
+ ang: 8736,
5841
+ and: 8743,
5842
+ or: 8744,
5843
+ cap: 8745,
5844
+ cup: 8746,
5845
+ int: 8747,
5846
+ there4: 8756,
5847
+ sim: 8764,
5848
+ cong: 8773,
5849
+ asymp: 8776,
5850
+ ne: 8800,
5851
+ equiv: 8801,
5852
+ le: 8804,
5853
+ ge: 8805,
5854
+ sub: 8834,
5855
+ sup: 8835,
5856
+ nsub: 8836,
5857
+ sube: 8838,
5858
+ supe: 8839,
5859
+ oplus: 8853,
5860
+ otimes: 8855,
5861
+ perp: 8869,
5862
+ sdot: 8901,
5863
+ lceil: 8968,
5864
+ rceil: 8969,
5865
+ lfloor: 8970,
5866
+ rfloor: 8971,
5867
+ lang: 9001,
5868
+ rang: 9002,
5869
+ loz: 9674,
5870
+ spades: 9824,
5871
+ clubs: 9827,
5872
+ hearts: 9829,
5873
+ diams: 9830
5874
+ };
5875
+ var ENTITY = /&(#x[0-9a-f]+|#\d+|[a-z][a-z0-9]*);/gi;
5876
+ function decodeHtmlEntities(text) {
5877
+ return text.replace(ENTITY, (entity, body) => {
5878
+ if (body.startsWith("#")) {
5879
+ const code2 = body[1] === "x" || body[1] === "X" ? parseInt(body.slice(2), 16) : Number(body.slice(1));
5880
+ return Number.isInteger(code2) && code2 > 0 && code2 <= 1114111 ? String.fromCodePoint(code2) : entity;
5881
+ }
5882
+ const code = ownProp(HTML_NAMED_ENTITIES, body);
5883
+ return typeof code === "number" ? String.fromCodePoint(code) : entity;
5884
+ });
5885
+ }
5886
+
5887
+ // src/react/extracted-text.ts
5888
+ function splitExtractedText(text) {
5889
+ const segments = [];
5890
+ const tableRows = text.includes("|") ? pipeTableRows(text) : [];
5891
+ let markdown = "";
5892
+ let index = 0;
5893
+ while (index < text.length) {
5894
+ if (index === 0 || text[index - 1] === "\n") {
5895
+ const fenceEnd = fencedBlockEnd(text, index);
5896
+ if (fenceEnd !== void 0) {
5897
+ markdown += text.slice(index, fenceEnd);
5898
+ index = fenceEnd;
5899
+ continue;
5900
+ }
5901
+ }
5902
+ const char = text.charAt(index);
5903
+ if (char === "\\" && ESCAPABLE.test(text.charAt(index + 1))) {
5904
+ markdown += text.slice(index, index + 2);
5905
+ index += 2;
5906
+ continue;
5907
+ }
5908
+ if (char === "`") {
5909
+ const end = codeSpanEnd(text, index);
5910
+ markdown += text.slice(index, end);
5911
+ index = end;
5912
+ continue;
5913
+ }
5914
+ if (char === "<") {
5915
+ const markup = readMarkup(text, index);
5916
+ if (markup) {
5917
+ if ("table" in markup) {
5918
+ pushMarkdown(segments, markdown);
5919
+ markdown = "";
5920
+ if (markup.table) segments.push({ kind: "table", table: markup.table });
5921
+ } else if (markup.text === "\n" && within(tableRows, index)) {
5922
+ markdown += " ";
5923
+ } else {
5924
+ markdown += markup.text;
5925
+ }
5926
+ index = markup.end;
5927
+ continue;
5928
+ }
5929
+ }
5930
+ markdown += char;
5931
+ index += 1;
5932
+ }
5933
+ pushMarkdown(segments, markdown);
5934
+ return segments;
5935
+ }
5936
+ function pushMarkdown(segments, text) {
5937
+ if (text.trim() !== "") segments.push({ kind: "markdown", text });
5938
+ }
5939
+ function within(spans2, index) {
5940
+ return spans2.some(([start, end]) => index >= start && index < end);
5941
+ }
5942
+ function pipeTableRows(text) {
5943
+ const lines = [];
5944
+ for (let start = 0; ; ) {
5945
+ const newline = text.indexOf("\n", start);
5946
+ lines.push([start, newline === -1 ? text.length : newline]);
5947
+ if (newline === -1) break;
5948
+ start = newline + 1;
5949
+ }
5950
+ const lineAt = (at) => {
5951
+ const [start, end] = lines[at] ?? [0, 0];
5952
+ return text.slice(start, end);
5953
+ };
5954
+ const rows = [];
5955
+ for (let at = 1; at < lines.length; at += 1) {
5956
+ const header = lineAt(at - 1);
5957
+ const delimiter = lineAt(at);
5958
+ if (!header.includes("|") || !isDelimiterRow(delimiter)) continue;
5959
+ if (rowCells(header).length !== rowCells(delimiter).length) continue;
5960
+ let last = at;
5961
+ while (last + 1 < lines.length && lineAt(last + 1).includes("|")) last += 1;
5962
+ rows.push([lines[at - 1]?.[0] ?? 0, lines[last]?.[1] ?? text.length]);
5963
+ at = last;
5964
+ }
5965
+ return rows;
5966
+ }
5967
+ function rowCells(line) {
5968
+ let row = line.trim();
5969
+ if (row.startsWith("|")) row = row.slice(1);
5970
+ if (row.endsWith("|") && !row.endsWith("\\|")) row = row.slice(0, -1);
5971
+ const cells = [];
5972
+ let cell = "";
5973
+ for (let at = 0; at < row.length; at += 1) {
5974
+ const char = row.charAt(at);
5975
+ if (char === "\\") {
5976
+ cell += row.slice(at, at + 2);
5977
+ at += 1;
5978
+ } else if (char === "|") {
5979
+ cells.push(cell);
5980
+ cell = "";
5981
+ } else {
5982
+ cell += char;
5983
+ }
5984
+ }
5985
+ cells.push(cell);
5986
+ return cells;
5987
+ }
5988
+ function isDelimiterRow(line) {
5989
+ return line.includes("|") && rowCells(line).every((cell) => /^\s*:?-+:?\s*$/.test(cell));
5990
+ }
5991
+ var ESCAPABLE = /^[\x21-\x2f\x3a-\x40\x5b-\x60\x7b-\x7e]$/;
5992
+ var FENCE_OPEN = /[ \t]*(`{3,}|~{3,})([^\n]*)/y;
5993
+ var FENCE_LINE = /^[ \t]*(?:`{3,}|~{3,})/gm;
5994
+ function fencedBlockEnd(text, start) {
5995
+ FENCE_OPEN.lastIndex = start;
5996
+ const open = FENCE_OPEN.exec(text);
5997
+ if (!open) return void 0;
5998
+ const marker = open[1] ?? "";
5999
+ const fenceChar = marker.charAt(0);
6000
+ if (fenceChar === "`" && (open[2] ?? "").includes("`")) return void 0;
6001
+ let lineEnd = text.indexOf("\n", start);
6002
+ while (lineEnd !== -1) {
6003
+ const next = text.indexOf("\n", lineEnd + 1);
6004
+ const end = next === -1 ? text.length : next;
6005
+ const line = text.slice(lineEnd + 1, end).trim();
6006
+ if (line.length >= marker.length && [...line].every((c) => c === fenceChar)) return end;
6007
+ lineEnd = next;
6008
+ }
6009
+ return text.length;
6010
+ }
6011
+ var BLANK_LINE = /\n[ \t]*\n/g;
6012
+ function codeSpanEnd(text, start) {
6013
+ const open = backtickRun(text, start);
6014
+ BLANK_LINE.lastIndex = start;
6015
+ const blank = BLANK_LINE.exec(text);
6016
+ const limit = blank ? blank.index : text.length;
6017
+ let cursor = start + open;
6018
+ for (; ; ) {
6019
+ const next = text.indexOf("`", cursor);
6020
+ if (next === -1 || next >= limit) return start + open;
6021
+ const length = backtickRun(text, next);
6022
+ if (length === open) return next + length;
6023
+ cursor = next + length;
6024
+ }
6025
+ }
6026
+ function backtickRun(text, start) {
6027
+ let end = start;
6028
+ while (text.charAt(end) === "`") end += 1;
6029
+ return end - start;
6030
+ }
6031
+ function nextOutsideFences(text, from, pattern) {
6032
+ let cursor = from;
6033
+ for (; ; ) {
6034
+ pattern.lastIndex = cursor;
6035
+ const match = pattern.exec(text);
6036
+ if (!match) return null;
6037
+ FENCE_LINE.lastIndex = cursor;
6038
+ const fence = FENCE_LINE.exec(text);
6039
+ if (!fence || fence.index >= match.index) return match;
6040
+ cursor = fencedBlockEnd(text, fence.index) ?? fence.index + fence[0].length;
6041
+ }
6042
+ }
6043
+ var COMMENT = /<!--[\s\S]*?-->/g;
6044
+ var COMMENT_END = /-->/g;
6045
+ var TABLE_OPEN = /<table\b[^>]*>/iy;
6046
+ var TABLE_TAG = /<(\/?)table\b[^>]*>/gi;
6047
+ var HTML_TAG = /<(\/?)([a-z][a-z0-9]*)(?=[\s/>])[^<>]*>/iy;
6048
+ var BLOCK_ELEMENTS = /* @__PURE__ */ new Set([
6049
+ "address",
6050
+ "article",
6051
+ "aside",
6052
+ "blockquote",
6053
+ "body",
6054
+ "br",
6055
+ "center",
6056
+ "dd",
6057
+ "details",
6058
+ "dialog",
6059
+ "div",
6060
+ "dl",
6061
+ "dt",
6062
+ "fieldset",
6063
+ "figcaption",
6064
+ "figure",
6065
+ "footer",
6066
+ "form",
6067
+ "h1",
6068
+ "h2",
6069
+ "h3",
6070
+ "h4",
6071
+ "h5",
6072
+ "h6",
6073
+ "head",
6074
+ "header",
6075
+ "hgroup",
6076
+ "hr",
6077
+ "html",
6078
+ "legend",
6079
+ "li",
6080
+ "main",
6081
+ "nav",
6082
+ "ol",
6083
+ "option",
6084
+ "p",
6085
+ "pre",
6086
+ "section",
6087
+ "summary",
6088
+ "title",
6089
+ "ul"
6090
+ ]);
6091
+ var INLINE_ELEMENTS = /* @__PURE__ */ new Set([
6092
+ "a",
6093
+ "abbr",
6094
+ "b",
6095
+ "bdi",
6096
+ "bdo",
6097
+ "big",
6098
+ "cite",
6099
+ "code",
6100
+ "data",
6101
+ "del",
6102
+ "dfn",
6103
+ "em",
6104
+ "font",
6105
+ "i",
6106
+ "img",
6107
+ "ins",
6108
+ "kbd",
6109
+ "label",
6110
+ "mark",
6111
+ "picture",
6112
+ "q",
6113
+ "s",
6114
+ "samp",
6115
+ "small",
6116
+ "source",
6117
+ "span",
6118
+ "strike",
6119
+ "strong",
6120
+ "sub",
6121
+ "sup",
6122
+ "time",
6123
+ "tt",
6124
+ "u",
6125
+ "var",
6126
+ "wbr"
6127
+ ]);
6128
+ var RAW_TEXT_ENDS = /* @__PURE__ */ new Map([
6129
+ ["script", /<\/script\s*>/gi],
6130
+ ["style", /<\/style\s*>/gi]
6131
+ ]);
6132
+ function readMarkup(text, start) {
6133
+ if (text.startsWith("<!--", start)) {
6134
+ const close = nextOutsideFences(text, start + 4, COMMENT_END);
6135
+ return close ? { end: close.index + close[0].length, text: "" } : void 0;
6136
+ }
6137
+ TABLE_OPEN.lastIndex = start;
6138
+ if (TABLE_OPEN.test(text)) {
6139
+ const end2 = tableEnd(text, start);
6140
+ if (end2 === void 0) return void 0;
6141
+ return { end: end2, table: readTable(text.slice(start, end2).replace(COMMENT, "")) };
6142
+ }
6143
+ HTML_TAG.lastIndex = start;
6144
+ const tag = HTML_TAG.exec(text);
6145
+ if (!tag) return void 0;
6146
+ const closing = tag[1] === "/";
6147
+ const name = (tag[2] ?? "").toLowerCase();
6148
+ const end = start + tag[0].length;
6149
+ const rawTextEnd = closing ? void 0 : RAW_TEXT_ENDS.get(name);
6150
+ if (rawTextEnd) {
6151
+ rawTextEnd.lastIndex = end;
6152
+ const close = rawTextEnd.exec(text);
6153
+ return { end: close ? close.index + close[0].length : end, text: "\n" };
6154
+ }
6155
+ if (RAW_TEXT_ENDS.has(name) || BLOCK_ELEMENTS.has(name)) return { end, text: "\n" };
6156
+ if (INLINE_ELEMENTS.has(name)) return { end, text: "" };
6157
+ return void 0;
6158
+ }
6159
+ function tableEnd(text, start) {
6160
+ let depth = 0;
6161
+ let cursor = start;
6162
+ for (; ; ) {
6163
+ const tag = nextOutsideFences(text, cursor, TABLE_TAG);
6164
+ if (!tag) return void 0;
6165
+ depth += tag[1] === "/" ? -1 : 1;
6166
+ cursor = tag.index + tag[0].length;
6167
+ if (depth === 0) return cursor;
6168
+ }
6169
+ }
6170
+ var TABLE_STRUCTURE = /<(\/?)(table|caption|tr|td|th)\b([^>]*)>/gi;
6171
+ function readTable(markup) {
6172
+ let caption = "";
6173
+ let captionStart;
6174
+ const rows = [];
6175
+ let row;
6176
+ let cell;
6177
+ let depth = 0;
6178
+ const endCell = (at) => {
6179
+ if (cell && row) {
6180
+ const colSpan = span(cell.attributes, COLSPAN);
6181
+ const rowSpan = span(cell.attributes, ROWSPAN);
6182
+ row.push({
6183
+ text: cellText(markup.slice(cell.start, at)),
6184
+ header: cell.header,
6185
+ ...colSpan !== void 0 ? { colSpan } : {},
6186
+ ...rowSpan !== void 0 ? { rowSpan } : {}
6187
+ });
6188
+ }
6189
+ cell = void 0;
6190
+ };
6191
+ const endRow = (at) => {
6192
+ endCell(at);
6193
+ if (row && row.length > 0) rows.push(row);
6194
+ row = void 0;
6195
+ };
6196
+ for (const tag of markup.matchAll(TABLE_STRUCTURE)) {
6197
+ const closing = tag[1] === "/";
6198
+ const name = (tag[2] ?? "").toLowerCase();
6199
+ if (name === "table") {
6200
+ depth += closing ? -1 : 1;
6201
+ if (depth === 0) break;
6202
+ continue;
6203
+ }
6204
+ if (depth !== 1) continue;
6205
+ if (name === "caption") {
6206
+ if (!closing && caption === "" && captionStart === void 0) {
6207
+ captionStart = tag.index + tag[0].length;
6208
+ } else if (closing && captionStart !== void 0) {
6209
+ caption = cellText(markup.slice(captionStart, tag.index));
6210
+ captionStart = void 0;
6211
+ }
6212
+ continue;
6213
+ }
6214
+ if (name === "tr") {
6215
+ endRow(tag.index);
6216
+ if (!closing) row = [];
6217
+ continue;
6218
+ }
6219
+ endCell(tag.index);
6220
+ if (!closing && row) {
6221
+ cell = {
6222
+ header: name === "th",
6223
+ attributes: tag[3] ?? "",
6224
+ start: tag.index + tag[0].length
6225
+ };
6226
+ }
6227
+ }
6228
+ endRow(markup.length);
6229
+ if (rows.length === 0 && caption === "") return void 0;
6230
+ return { ...caption !== "" ? { caption } : {}, rows };
6231
+ }
6232
+ var COLSPAN = /\bcolspan\s*=\s*["']?(\d+)/i;
6233
+ var ROWSPAN = /\browspan\s*=\s*["']?(\d+)/i;
6234
+ function span(attributes, pattern) {
6235
+ const match = pattern.exec(attributes);
6236
+ const value = match ? Number(match[1]) : void 0;
6237
+ return value !== void 0 && value > 1 && value <= 1e3 ? value : void 0;
6238
+ }
6239
+ function cellText(markup) {
6240
+ return decodeHtmlEntities(
6241
+ markup.replace(/<br\s*\/?>/gi, "\n").replace(/<\/?(?:table|caption|tr|td|th)\b[^>]*>/gi, "\n").replace(/<[^>]*>/g, "")
6242
+ ).split("\n").map((line) => line.replace(/\s+/g, " ").trim()).filter((line) => line !== "").join("\n");
6243
+ }
5527
6244
  function unwrap(field, value) {
5528
6245
  if (!field.contentKey) return value;
5529
6246
  if (typeof value !== "object" || value === null || Array.isArray(value)) return value;
@@ -5901,11 +6618,13 @@ function ImageValue({
5901
6618
  value,
5902
6619
  inGallery = false,
5903
6620
  inRow = false,
5904
- compact = false
6621
+ compact = false,
6622
+ downloadable = true
5905
6623
  }) {
5906
6624
  const s = useFieldStrings();
5907
6625
  const resolve = useResolveUrl();
5908
- const file = useStuffFile("image", value);
6626
+ const stuffFile = useStuffFile("image", value);
6627
+ const file = downloadable ? stuffFile : void 0;
5909
6628
  const content = readImageContent(value);
5910
6629
  if (!content) return /* @__PURE__ */ jsx(Absent, {});
5911
6630
  const src = paintableUrl(content, resolve);
@@ -6043,7 +6762,13 @@ function LeafValue({
6043
6762
  }
6044
6763
  function RecordSummary({ field, value }) {
6045
6764
  const s = useFieldStrings();
6765
+ const presentation = useFieldPresentation();
6046
6766
  if (isNativeDateNode(field)) return /* @__PURE__ */ jsx(DateValue, { value });
6767
+ const verdict = presentation === "app" ? nativeVerdictOf(field) : void 0;
6768
+ const reading = verdict ? readVerdict(verdict, value, s) : void 0;
6769
+ if (reading) {
6770
+ return /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap text-[13px] text-foreground", children: reading.answer });
6771
+ }
6047
6772
  if (!isRecord(value) || Object.keys(value).length === 0) return /* @__PURE__ */ jsx(Absent, {});
6048
6773
  const naming = isNativeHtmlNode(field) ? void 0 : recordNameField(field.fields) ?? field.fields.find((member) => member.kind === "prose");
6049
6774
  if (naming === void 0) {
@@ -6380,42 +7105,157 @@ function ObjectTable({
6380
7105
  );
6381
7106
  }
6382
7107
  function CompositeValue({ members }) {
6383
- return /* @__PURE__ */ jsx("div", { className: "space-y-3", children: members.map((member) => /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
6384
- /* @__PURE__ */ jsx("span", { className: "font-mono text-[12px] font-semibold text-foreground", children: member.name }),
6385
- /* @__PURE__ */ jsx(NativeValue, { value: member.value })
6386
- ] }, member.name)) });
7108
+ const presentation = useFieldPresentation();
7109
+ const isApp = presentation === "app";
7110
+ return /* @__PURE__ */ jsx("div", { className: "space-y-3", children: members.map((member) => {
7111
+ const label = isApp ? humanizeFieldName(member.name) : member.name;
7112
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
7113
+ /* @__PURE__ */ jsx(
7114
+ "span",
7115
+ {
7116
+ className: cn(
7117
+ "font-semibold text-foreground",
7118
+ isApp ? "text-[13.5px]" : "font-mono text-[12px]"
7119
+ ),
7120
+ children: label
7121
+ }
7122
+ ),
7123
+ /* @__PURE__ */ jsx(NativeValue, { value: member.value, label })
7124
+ ] }, member.name);
7125
+ }) });
6387
7126
  }
6388
- function NativeValue({ value }) {
7127
+ function NativeValue({ value, label }) {
6389
7128
  if (value === null || value === void 0 || value === "") return /* @__PURE__ */ jsx(Absent, {});
6390
- const html = readHtmlContent(value);
6391
- if (html) return /* @__PURE__ */ jsx(HtmlPreview, { content: html, downloadPdf: false });
6392
- const date = readDateContent(value);
6393
- if (date) return /* @__PURE__ */ jsx("span", { className: "text-[13px] text-foreground", children: formatDateContent(date) });
6394
- const document2 = readDocumentContent(value);
6395
- if (document2?.url !== void 0) {
6396
- return /* @__PURE__ */ jsx(
6397
- FileRef,
6398
- {
6399
- url: document2.url,
6400
- ...document2.mimeType !== void 0 ? { mimeType: document2.mimeType } : {},
6401
- ...document2.filename !== void 0 ? { filename: document2.filename } : {}
6402
- }
6403
- );
7129
+ if (typeof value === "string") return /* @__PURE__ */ jsx(Markdown, { text: value });
7130
+ if (Array.isArray(value)) return /* @__PURE__ */ jsx(NativeList, { items: value, label });
7131
+ if (!isRecord(value)) return /* @__PURE__ */ jsx(Scalar, { value });
7132
+ const content = readMemberContent(value);
7133
+ switch (content?.model) {
7134
+ case "html":
7135
+ return /* @__PURE__ */ jsx(HtmlPreview, { content: content.html, downloadPdf: false });
7136
+ case "date":
7137
+ return /* @__PURE__ */ jsx("span", { className: "text-[13px] text-foreground", children: formatDateContent(content.date) });
7138
+ case "image":
7139
+ return /* @__PURE__ */ jsx(ImageValue, { value, downloadable: false });
7140
+ case "document":
7141
+ return /* @__PURE__ */ jsx(
7142
+ FileRef,
7143
+ {
7144
+ url: content.document.url,
7145
+ ...content.document.mimeType !== void 0 ? { mimeType: content.document.mimeType } : {},
7146
+ ...content.document.filename !== void 0 ? { filename: content.document.filename } : {}
7147
+ }
7148
+ );
7149
+ case "list":
7150
+ return /* @__PURE__ */ jsx(NativeList, { items: content.items, label });
7151
+ case "text":
7152
+ return content.text === "" ? /* @__PURE__ */ jsx(Absent, {}) : /* @__PURE__ */ jsx(Markdown, { text: content.text });
7153
+ case void 0:
7154
+ return /* @__PURE__ */ jsx(RawValue, { value, compact: false });
7155
+ }
7156
+ }
7157
+ function NativeList({ items, label }) {
7158
+ if (items.length === 0) return /* @__PURE__ */ jsx(Absent, {});
7159
+ if (items.every(isPlainRecord)) return /* @__PURE__ */ jsx(RecordsTable, { items, label });
7160
+ return /* @__PURE__ */ jsx("div", { className: "divide-y divide-border/60 overflow-hidden rounded-lg border border-border", children: items.map((item, index) => /* @__PURE__ */ jsx("div", { className: "bg-card/40 px-3 py-1.5", children: /* @__PURE__ */ jsx(NativeValue, { value: item, label }) }, index)) });
7161
+ }
7162
+ var TEXT_MEMBERS = /* @__PURE__ */ new Set(["text"]);
7163
+ var DATE_MEMBERS = /* @__PURE__ */ new Set(["date", "time", ...TYPED_SCALAR_MARKERS]);
7164
+ var HTML_MEMBERS = /* @__PURE__ */ new Set(["inner_html", "css_class"]);
7165
+ var DOCUMENT_MEMBERS = /* @__PURE__ */ new Set([
7166
+ "url",
7167
+ "public_url",
7168
+ "mime_type",
7169
+ "filename",
7170
+ "title",
7171
+ "snippet"
7172
+ ]);
7173
+ var IMAGE_MEMBERS = /* @__PURE__ */ new Set([
7174
+ "url",
7175
+ "public_url",
7176
+ "source_prompt",
7177
+ "source_negative_prompt",
7178
+ "caption",
7179
+ "mime_type",
7180
+ "width",
7181
+ "height",
7182
+ "filename"
7183
+ ]);
7184
+ var LIST_MEMBERS = /* @__PURE__ */ new Set(["items"]);
7185
+ function holdsOnly(record, members) {
7186
+ return Object.keys(record).every((key) => members.has(key));
7187
+ }
7188
+ function readMemberContent(record) {
7189
+ if (holdsOnly(record, HTML_MEMBERS)) {
7190
+ const html = readHtmlContent(record);
7191
+ if (html) return { model: "html", html };
6404
7192
  }
6405
- if (isRecord(value) && Array.isArray(value.items)) {
6406
- const items = value.items;
6407
- if (items.length === 0) return /* @__PURE__ */ jsx(Absent, {});
6408
- return /* @__PURE__ */ jsx("div", { className: "divide-y divide-border/60 overflow-hidden rounded-lg border border-border", children: items.map((item, index) => /* @__PURE__ */ jsx("div", { className: "bg-card/40 px-3 py-1.5", children: /* @__PURE__ */ jsx(NativeValue, { value: item }) }, index)) });
7193
+ if (holdsOnly(record, DATE_MEMBERS)) {
7194
+ const date = readDateContent(record);
7195
+ if (date) return { model: "date", date };
6409
7196
  }
6410
- if (isRecord(value)) {
6411
- const text = value.text;
6412
- if (typeof text === "string") {
6413
- return text === "" ? /* @__PURE__ */ jsx(Absent, {}) : /* @__PURE__ */ jsx(Markdown, { text });
7197
+ if (holdsOnly(record, IMAGE_MEMBERS)) {
7198
+ const image = readImageContent(record);
7199
+ if (image && (!holdsOnly(record, DOCUMENT_MEMBERS) || image.mimeType?.toLowerCase().startsWith("image/") === true)) {
7200
+ return { model: "image" };
6414
7201
  }
6415
7202
  }
6416
- if (typeof value === "string") return /* @__PURE__ */ jsx(Markdown, { text: value });
6417
- if (typeof value !== "object") return /* @__PURE__ */ jsx(Scalar, { value });
6418
- return /* @__PURE__ */ jsx(RawValue, { value, compact: false });
7203
+ if (holdsOnly(record, DOCUMENT_MEMBERS)) {
7204
+ const document2 = readDocumentContent(record);
7205
+ if (document2) return { model: "document", document: document2 };
7206
+ }
7207
+ if (holdsOnly(record, LIST_MEMBERS)) {
7208
+ const items = ownProp(record, "items");
7209
+ if (Array.isArray(items)) return { model: "list", items };
7210
+ }
7211
+ if (holdsOnly(record, TEXT_MEMBERS)) {
7212
+ const text = ownProp(record, "text");
7213
+ if (typeof text === "string") return { model: "text", text };
7214
+ }
7215
+ return void 0;
7216
+ }
7217
+ function isPlainRecord(value) {
7218
+ if (!isRecord(value) || Object.keys(value).length === 0) return false;
7219
+ return readMemberContent(value) === void 0;
7220
+ }
7221
+ function RecordsTable({
7222
+ items,
7223
+ label
7224
+ }) {
7225
+ const presentation = useFieldPresentation();
7226
+ const isApp = presentation === "app";
7227
+ const columns = [];
7228
+ for (const item of items) {
7229
+ for (const key of Object.keys(item)) if (!columns.includes(key)) columns.push(key);
7230
+ }
7231
+ const columnLabel = (column) => isApp ? humanizeFieldName(column) : column;
7232
+ return /* @__PURE__ */ jsx(
7233
+ "div",
7234
+ {
7235
+ role: "group",
7236
+ "aria-label": label,
7237
+ tabIndex: 0,
7238
+ className: cn("overflow-x-auto rounded-lg border border-border", focusOutlineClass),
7239
+ children: /* @__PURE__ */ jsxs("table", { className: "min-w-full border-collapse text-[12.5px] text-foreground", children: [
7240
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { className: "border-b border-border bg-card/40", children: columns.map((column) => /* @__PURE__ */ jsx(
7241
+ "th",
7242
+ {
7243
+ scope: "col",
7244
+ className: cn(
7245
+ "px-2.5 py-1.5 text-start align-bottom font-semibold",
7246
+ !isApp && "font-mono text-[12px]"
7247
+ ),
7248
+ children: columnLabel(column)
7249
+ },
7250
+ column
7251
+ )) }) }),
7252
+ /* @__PURE__ */ jsx("tbody", { children: items.map((item, index) => /* @__PURE__ */ jsx("tr", { className: "border-b border-border/60 last:border-b-0", children: columns.map((column) => {
7253
+ const cell = ownProp(item, column);
7254
+ return /* @__PURE__ */ jsx("td", { className: "px-2.5 py-1.5 align-top", children: typeof cell === "boolean" ? /* @__PURE__ */ jsx(Bool, { value: cell }) : typeof cell === "object" && cell !== null ? /* @__PURE__ */ jsx(NativeValue, { value: cell, label: columnLabel(column) }) : /* @__PURE__ */ jsx(Scalar, { value: cell }) }, column);
7255
+ }) }, index)) })
7256
+ ] })
7257
+ }
7258
+ );
6419
7259
  }
6420
7260
  function isRecord(value) {
6421
7261
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -6424,9 +7264,10 @@ function ScalarLines({ field, items }) {
6424
7264
  return /* @__PURE__ */ jsx("div", { className: "divide-y divide-border/60 overflow-hidden rounded-lg border border-border", children: items.map((item, index) => /* @__PURE__ */ jsx("div", { className: "bg-card/40 px-3 py-1.5", children: /* @__PURE__ */ jsx(LeafValue, { field, value: item }) }, index)) });
6425
7265
  }
6426
7266
  function ImageGallery({ items }) {
7267
+ const resolve = useResolveUrl();
6427
7268
  const anyViewable = items.some((item) => {
6428
7269
  const content = readImageContent(item);
6429
- return content ? !!(viewableUrl(content.publicUrl) ?? viewableUrl(content.url)) : false;
7270
+ return content ? paintableUrl(content, resolve) !== void 0 : false;
6430
7271
  });
6431
7272
  if (!anyViewable) return /* @__PURE__ */ jsx(FileRows, { items, kind: "image" });
6432
7273
  return /* @__PURE__ */ jsx("div", { className: "grid grid-cols-[repeat(auto-fill,minmax(140px,1fr))] gap-2", children: items.map((item, index) => /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-lg border border-border bg-card/40", children: /* @__PURE__ */ jsx(ResultAt, { segment: String(index), children: /* @__PURE__ */ jsx(ImageValue, { value: item, inGallery: true }) }) }, index)) });
@@ -6459,17 +7300,112 @@ function chooseColumns(fields, budget) {
6459
7300
  ...name ? { name } : {}
6460
7301
  };
6461
7302
  }
7303
+ var RAW_PAGE_SOURCES = "data:";
7304
+ function PageValue({ field, value, depth }) {
7305
+ const presentation = useFieldPresentation();
7306
+ const content = readPageContent(value);
7307
+ const text = content?.text;
7308
+ const segments = useMemo(() => text === void 0 ? [] : splitExtractedText(text), [text]);
7309
+ const hasText = segments.length > 0;
7310
+ const rawHtml = hasText ? void 0 : content?.rawHtml;
7311
+ const rawPage = useMemo(
7312
+ () => rawHtml === void 0 ? void 0 : { innerHtml: rawHtml },
7313
+ [rawHtml]
7314
+ );
7315
+ if (!content) return /* @__PURE__ */ jsx(Absent, {});
7316
+ const extracted = hasText || rawPage !== void 0 || content.images.length > 0;
7317
+ const showView = content.pageView !== void 0 && (presentation === "studio" || !extracted);
7318
+ if (!extracted && !showView) return /* @__PURE__ */ jsx(Absent, {});
7319
+ const viewField = field.kind === "object" ? field.fields.find((member) => member.name === "page_view") : void 0;
7320
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
7321
+ hasText && /* @__PURE__ */ jsx(ExtractedPageText, { segments }),
7322
+ rawPage && /* @__PURE__ */ jsx(
7323
+ HtmlPreview,
7324
+ {
7325
+ content: rawPage,
7326
+ downloadPdf: false,
7327
+ imgSrc: RAW_PAGE_SOURCES,
7328
+ fontSrc: RAW_PAGE_SOURCES
7329
+ }
7330
+ ),
7331
+ content.images.length > 0 && /* @__PURE__ */ jsx(ResultAt, { segment: "text_and_images", children: /* @__PURE__ */ jsx(ResultAt, { segment: "images", children: /* @__PURE__ */ jsx(ImageGallery, { items: content.images }) }) }),
7332
+ showView && /* @__PURE__ */ jsx(ResultAt, { segment: "page_view", children: presentation === "studio" && viewField ? /* @__PURE__ */ jsx(ResultField, { field: viewField, value: content.pageView, depth: depth + 1 }) : /* @__PURE__ */ jsx(ImageValue, { value: content.pageView }) })
7333
+ ] });
7334
+ }
7335
+ function readVerdict(verdict, value, s) {
7336
+ if (verdict === "yes_no") {
7337
+ const content2 = readYesNoContent(value);
7338
+ if (!content2) return void 0;
7339
+ return {
7340
+ answer: content2.yesNo ? s.yes : s.no,
7341
+ ...content2.probability !== void 0 ? { measure: s.yesProbability(content2.probability) } : {}
7342
+ };
7343
+ }
7344
+ if (verdict === "rating") {
7345
+ const content2 = readRatingContent(value);
7346
+ if (!content2) return void 0;
7347
+ return {
7348
+ // A scale that names its levels says which one in words; one that does
7349
+ // not is counted from one, as a reader counts.
7350
+ answer: content2.label ?? s.ratingLevel(content2.level + 1),
7351
+ ...content2.confidence !== void 0 ? { measure: s.verdictConfidence(content2.confidence) } : {}
7352
+ };
7353
+ }
7354
+ const content = readChoiceContent(value);
7355
+ if (!content) return void 0;
7356
+ return {
7357
+ answer: humanizeEnumValue(content.choice),
7358
+ ...content.confidence !== void 0 ? { measure: s.verdictConfidence(content.confidence) } : {}
7359
+ };
7360
+ }
7361
+ function VerdictValue({ reading, prominent }) {
7362
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
7363
+ /* @__PURE__ */ jsx(
7364
+ "p",
7365
+ {
7366
+ className: cn(
7367
+ "font-semibold text-foreground",
7368
+ prominent ? "text-[22px] leading-tight" : "text-[15px] leading-snug"
7369
+ ),
7370
+ children: reading.answer
7371
+ }
7372
+ ),
7373
+ reading.measure !== void 0 && /* @__PURE__ */ jsx("p", { className: "text-[12.5px] text-muted-foreground", children: reading.measure })
7374
+ ] });
7375
+ }
7376
+ function isLongText(value) {
7377
+ return typeof value === "string" && (value.includes("\n") || value.length > CELL_LENGTH_LIMIT);
7378
+ }
7379
+ var PanelResultContext = createContext(null);
7380
+ var TITLED_PANEL = { hostHeaded: false };
7381
+ var HOST_HEADED_PANEL = { hostHeaded: true };
7382
+ function PanelResult({
7383
+ hostHeaded,
7384
+ children
7385
+ }) {
7386
+ return /* @__PURE__ */ jsx(PanelResultContext, { value: hostHeaded ? HOST_HEADED_PANEL : TITLED_PANEL, children });
7387
+ }
6462
7388
  function ResultField(props) {
6463
7389
  const location = useResultLocation();
6464
- if (location) return /* @__PURE__ */ jsx(ResultNode, { ...props });
6465
- return /* @__PURE__ */ jsx(ResultRoot, { baseName: props.field.name, path: [props.field.name], children: /* @__PURE__ */ jsx(ResultNode, { ...props }) });
7390
+ const panel = use(PanelResultContext);
7391
+ const node = panel ? /* @__PURE__ */ jsx(PanelResultContext, { value: null, children: /* @__PURE__ */ jsx(ResultNode, { ...props, whole: true, hostHeaded: panel.hostHeaded }) }) : /* @__PURE__ */ jsx(ResultNode, { ...props });
7392
+ if (location) return node;
7393
+ return /* @__PURE__ */ jsx(ResultRoot, { baseName: props.field.name, path: [props.field.name], children: node });
6466
7394
  }
6467
- function ResultNode({ field, value, depth = 0, hideLabel = false }) {
7395
+ function ResultNode({
7396
+ field,
7397
+ value,
7398
+ depth = 0,
7399
+ hideLabel = false,
7400
+ whole = false,
7401
+ hostHeaded = false
7402
+ }) {
6468
7403
  const s = useFieldStrings();
6469
7404
  const unwrapped = unwrap(field, value);
6470
7405
  const pageDownloadShown = useFileDownloadShown("markup");
6471
7406
  const pdfShown = usePdfSaveShown();
6472
7407
  const location = useResultLocation();
7408
+ const isApp = useFieldPresentation() === "app";
6473
7409
  const header = hideLabel ? null : /* @__PURE__ */ jsx(Label2, { field, describe: true });
6474
7410
  const copyText = (field.kind === "text" || field.kind === "prose") && typeof unwrapped === "string" && unwrapped !== "" ? unwrapped : void 0;
6475
7411
  if (isNativeDateNode(field)) {
@@ -6507,9 +7443,24 @@ function ResultNode({ field, value, depth = 0, hideLabel = false }) {
6507
7443
  members && members.length > 0 ? /* @__PURE__ */ jsx(CompositeValue, { members }) : /* @__PURE__ */ jsx(Absent, {})
6508
7444
  ] });
6509
7445
  }
7446
+ if (isNativePageNode(field)) {
7447
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
7448
+ header,
7449
+ /* @__PURE__ */ jsx(PageValue, { field, value: unwrapped, depth })
7450
+ ] });
7451
+ }
7452
+ const verdict = isApp ? nativeVerdictOf(field) : void 0;
7453
+ const reading = verdict ? readVerdict(verdict, unwrapped, s) : void 0;
7454
+ if (reading) {
7455
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
7456
+ header,
7457
+ /* @__PURE__ */ jsx(VerdictValue, { reading, prominent: whole })
7458
+ ] });
7459
+ }
6510
7460
  switch (field.kind) {
6511
7461
  case "object": {
6512
7462
  const memberValue = (child) => typeof unwrapped === "object" && unwrapped !== null ? ownProp(unwrapped, child.name) : void 0;
7463
+ const sharesALine = (child) => isInlineColumn(child) && !(isApp && child.kind === "text" && isLongText(unwrap(child, memberValue(child))));
6513
7464
  return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
6514
7465
  header,
6515
7466
  /* @__PURE__ */ jsx(
@@ -6541,7 +7492,7 @@ function ResultNode({ field, value, depth = 0, hideLabel = false }) {
6541
7492
  // so does anything with chrome of its own - a table, a gallery, a
6542
7493
  // frame - which beside a label would be squeezed into whatever the
6543
7494
  // longest label left over.
6544
- isInlineColumn(child) ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
7495
+ sharesALine(child) ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
6545
7496
  /* @__PURE__ */ jsx("div", { className: "min-w-0", children: /* @__PURE__ */ jsx(Label2, { field: child, describe: true }) }),
6546
7497
  /* @__PURE__ */ jsx("div", { className: "flex min-w-0 justify-end **:data-chips:justify-end", children: /* @__PURE__ */ jsx("div", { className: "min-w-0 text-left wrap-break-word", children: /* @__PURE__ */ jsx(LeafValue, { field: child, value: memberValue(child) }) }) })
6547
7498
  ] }, child.name) : /* @__PURE__ */ jsx("div", { className: "col-span-2 min-w-0", children: /* @__PURE__ */ jsx(ResultAt, { segment: child.name, children: /* @__PURE__ */ jsx(ResultField, { field: child, value: memberValue(child), depth: depth + 1 }) }) }, child.name)
@@ -6555,7 +7506,7 @@ function ResultNode({ field, value, depth = 0, hideLabel = false }) {
6555
7506
  const items = Array.isArray(unwrapped) ? unwrapped : [];
6556
7507
  const columns = recordColumns(field.item);
6557
7508
  return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
6558
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline gap-x-2", children: [
7509
+ isApp && hostHeaded ? null : /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline gap-x-2", children: [
6559
7510
  header,
6560
7511
  /* @__PURE__ */ jsx("span", { className: "font-mono text-[10.5px] text-muted-foreground", children: s.itemsCount(items.length) })
6561
7512
  ] }),
@@ -6567,6 +7518,30 @@ function ResultNode({ field, value, depth = 0, hideLabel = false }) {
6567
7518
  // column named by it, and show a composite as JSON. The arm keyed by
6568
7519
  // concept is the one that knows what each entry is.
6569
7520
  /* @__PURE__ */ jsx("div", { className: "divide-y divide-border/60 overflow-hidden rounded-lg border border-border", children: items.map((item, index) => /* @__PURE__ */ jsx("div", { className: "bg-card/40 px-3 py-1.5", children: /* @__PURE__ */ jsx(ResultAt, { segment: String(index), children: /* @__PURE__ */ jsx(ResultField, { field: field.item, value: item, depth: depth + 1, hideLabel: true }) }) }, index)) })
7521
+ ) : isNativePageNode(field.item) ? (
7522
+ // A document's pages, one after the other, each drawn by the page
7523
+ // arm and captioned with its number: a page is a document's unit,
7524
+ // and a table of pages had a row per page and the text nowhere.
7525
+ /* @__PURE__ */ jsx("div", { className: "space-y-3", children: items.map((item, index) => (
7526
+ // An article, not a section: a named section is a landmark,
7527
+ // and a landmark's name must be unique on the page, which
7528
+ // "Page 1" is not once a host shows two results.
7529
+ /* @__PURE__ */ jsxs(
7530
+ "article",
7531
+ {
7532
+ "aria-label": s.pageNumber(index + 1),
7533
+ className: "space-y-2 rounded-lg border border-border bg-card/40 px-3.5 py-3",
7534
+ children: [
7535
+ /* @__PURE__ */ jsx("span", { className: "text-[12px] font-medium text-muted-foreground", children: s.pageNumber(index + 1) }),
7536
+ /* @__PURE__ */ jsx(ResultAt, { segment: String(index), children: /* @__PURE__ */ jsx(ResultField, { field: field.item, value: item, depth: depth + 1, hideLabel: true }) })
7537
+ ]
7538
+ },
7539
+ index
7540
+ )
7541
+ )) })
7542
+ ) : isApp && nativeVerdictOf(field.item) ? (
7543
+ // Verdicts in `app`, one per line, each drawn by the verdict arm.
7544
+ /* @__PURE__ */ jsx("div", { className: "divide-y divide-border/60 overflow-hidden rounded-lg border border-border", children: items.map((item, index) => /* @__PURE__ */ jsx("div", { className: "bg-card/40 px-3 py-1.5", children: /* @__PURE__ */ jsx(ResultAt, { segment: String(index), children: /* @__PURE__ */ jsx(ResultField, { field: field.item, value: item, depth: depth + 1, hideLabel: true }) }) }, index)) })
6570
7545
  ) : columns ? (
6571
7546
  // Same shape every row: the labels are column headers, not per-row
6572
7547
  // labels. See `ObjectTable`.
@@ -6623,7 +7598,7 @@ function ResultNode({ field, value, depth = 0, hideLabel = false }) {
6623
7598
  /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: header }),
6624
7599
  /* @__PURE__ */ jsx(CopyButton, { value: copyText, label: s.copyText })
6625
7600
  ] }),
6626
- /* @__PURE__ */ jsx(LeafValue, { field, value })
7601
+ isApp && field.kind === "text" && isLongText(unwrapped) ? /* @__PURE__ */ jsx(Markdown, { text: unwrapped }) : /* @__PURE__ */ jsx(LeafValue, { field, value })
6627
7602
  ] });
6628
7603
  }
6629
7604
  return null;
@@ -6785,6 +7760,9 @@ function StuffPanel({
6785
7760
  const labels = { rendered: s.viewRendered, json: s.viewJson };
6786
7761
  const pdfName = page && pdfShown ? pdfFileName(field, value, baseName) : void 0;
6787
7762
  const pageView = page !== void 0 && view !== "json";
7763
+ const titled = presentation !== "app" || name !== void 0 && name !== "" && !page;
7764
+ const switchShown = offered.length > 1;
7765
+ const headerShown = titled || downloadShown || switchShown || page && pdfName !== void 0;
6788
7766
  return /* @__PURE__ */ jsxs(
6789
7767
  "div",
6790
7768
  {
@@ -6799,8 +7777,9 @@ function StuffPanel({
6799
7777
  className
6800
7778
  ),
6801
7779
  children: [
6802
- /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 flex-wrap items-center justify-between gap-x-4 gap-y-1", children: [
6803
- page && presentation === "app" ? /* @__PURE__ */ jsx("div", {}) : /* @__PURE__ */ jsx("div", { className: "min-w-0 space-y-1", children: /* @__PURE__ */ jsx(ResultHeader, { field: named }) }),
7780
+ dialog,
7781
+ headerShown && /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 flex-wrap items-center justify-between gap-x-4 gap-y-1", children: [
7782
+ titled ? /* @__PURE__ */ jsx("div", { className: "min-w-0 space-y-1", children: /* @__PURE__ */ jsx(ResultHeader, { field: named }) }) : /* @__PURE__ */ jsx("div", {}),
6804
7783
  /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [
6805
7784
  page && pdfName !== void 0 && /* @__PURE__ */ jsx(
6806
7785
  PdfDownloadButton,
@@ -6828,8 +7807,7 @@ function StuffPanel({
6828
7807
  ]
6829
7808
  }
6830
7809
  ),
6831
- dialog,
6832
- offered.length > 1 && /* @__PURE__ */ jsx(
7810
+ switchShown && /* @__PURE__ */ jsx(
6833
7811
  "div",
6834
7812
  {
6835
7813
  role: "group",
@@ -6870,7 +7848,7 @@ function StuffPanel({
6870
7848
  // `ResultField`, whose page arm would add a second control row saving
6871
7849
  // the same file, and with no box around it.
6872
7850
  /* @__PURE__ */ jsx(HtmlPreview, { content: page, downloadPdf: false, bare: true, fill: true })
6873
- ) : /* @__PURE__ */ jsx(ResultRoot, { baseName, path: [field.name], children: /* @__PURE__ */ jsx(ResultField, { field, value, hideLabel: true }) })
7851
+ ) : /* @__PURE__ */ jsx(ResultRoot, { baseName, path: [field.name], children: /* @__PURE__ */ jsx(PanelResult, { hostHeaded: !titled, children: /* @__PURE__ */ jsx(ResultField, { field, value, hideLabel: true }) }) })
6874
7852
  ]
6875
7853
  }
6876
7854
  );
@@ -6882,5 +7860,5 @@ function pdfFileName(field, value, baseName) {
6882
7860
  }
6883
7861
 
6884
7862
  export { BooleanField, ConceptPill, DEFAULT_FIELD_STRINGS, DateField, DocumentField, EN_FIELD_STRINGS, EnumField, FIELD_STRINGS_BY_LOCALE, FR_FIELD_STRINGS, FieldDomIdProvider, FieldPresentationProvider, FieldRenderer, FieldShell, FieldStringsProvider, FilePicker, FilePickerEntry, FillWithExample, HtmlPreview, ImageField, JsonView, ListField, Markdown, MethodForm, NumberField, ObjectField, OptionalToggle, PdfDownloadButton, ProseField, ResultEnvProvider, ResultField, ResultRoot, SUPPORTED_LOCALES, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, StuffViewer, Switch, TextField, ToggleGroup, ToggleGroupItem, UnknownField, checkedAccentClass, cn, fieldControlClass, fieldStringsFor, focusOutlineClass, humanizeFieldName, linkTextClass, renderHtmlPdf, resolveHtmlStorageUrls, saveInBrowser, selectedBorderClass, selectedFillClass, selectedFillStrongClass, useFieldDomId, useFieldPresentation, useFieldStrings, useMethodForm, useProseImages, useResolveShareUrl, useResolveUrl, useResolvedUrl };
6885
- //# sourceMappingURL=chunk-UGKFWX7L.js.map
6886
- //# sourceMappingURL=chunk-UGKFWX7L.js.map
7863
+ //# sourceMappingURL=chunk-NA7SIQOH.js.map
7864
+ //# sourceMappingURL=chunk-NA7SIQOH.js.map