@mulmoclaude/collection-plugin 0.3.0 → 0.4.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.
Files changed (61) hide show
  1. package/dist/core/errorMessage.d.ts +5 -0
  2. package/dist/core/errorMessage.d.ts.map +1 -0
  3. package/dist/core/promptSafety.d.ts +2 -0
  4. package/dist/core/promptSafety.d.ts.map +1 -0
  5. package/dist/core/shortHexId.d.ts +9 -0
  6. package/dist/core/shortHexId.d.ts.map +1 -0
  7. package/dist/core/uiTypes.d.ts +26 -1
  8. package/dist/core/uiTypes.d.ts.map +1 -1
  9. package/dist/index.cjs +45 -126
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.ts +3 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +2 -86
  14. package/dist/index.js.map +1 -1
  15. package/dist/{calendarGrid-DZeLwBj9.cjs → promptSafety-BSO2gdsg.cjs} +184 -1
  16. package/dist/promptSafety-BSO2gdsg.cjs.map +1 -0
  17. package/dist/{calendarGrid-ggmFTZju.js → promptSafety-DShN_VCG.js} +113 -2
  18. package/dist/promptSafety-DShN_VCG.js.map +1 -0
  19. package/dist/style.css +544 -1
  20. package/dist/vue/collectionViewMode.d.ts +12 -0
  21. package/dist/vue/collectionViewMode.d.ts.map +1 -0
  22. package/dist/vue/components/CollectionCustomView.vue.d.ts +9 -0
  23. package/dist/vue/components/CollectionCustomView.vue.d.ts.map +1 -0
  24. package/dist/vue/components/CollectionView.vue.d.ts +41 -0
  25. package/dist/vue/components/CollectionView.vue.d.ts.map +1 -0
  26. package/dist/vue/components/CollectionViewConfigModal.vue.d.ts +16 -0
  27. package/dist/vue/components/CollectionViewConfigModal.vue.d.ts.map +1 -0
  28. package/dist/vue/components/CollectionsIndexView.vue.d.ts +4 -0
  29. package/dist/vue/components/CollectionsIndexView.vue.d.ts.map +1 -0
  30. package/dist/vue/components/FeedsView.vue.d.ts +4 -0
  31. package/dist/vue/components/FeedsView.vue.d.ts.map +1 -0
  32. package/dist/vue/index.d.ts +7 -1
  33. package/dist/vue/index.d.ts.map +1 -1
  34. package/dist/vue/lang/de.d.ts +4 -0
  35. package/dist/vue/lang/de.d.ts.map +1 -0
  36. package/dist/vue/lang/en.d.ts +98 -0
  37. package/dist/vue/lang/en.d.ts.map +1 -0
  38. package/dist/vue/lang/es.d.ts +4 -0
  39. package/dist/vue/lang/es.d.ts.map +1 -0
  40. package/dist/vue/lang/fr.d.ts +4 -0
  41. package/dist/vue/lang/fr.d.ts.map +1 -0
  42. package/dist/vue/lang/index.d.ts +111 -0
  43. package/dist/vue/lang/index.d.ts.map +1 -0
  44. package/dist/vue/lang/ja.d.ts +4 -0
  45. package/dist/vue/lang/ja.d.ts.map +1 -0
  46. package/dist/vue/lang/ko.d.ts +4 -0
  47. package/dist/vue/lang/ko.d.ts.map +1 -0
  48. package/dist/vue/lang/ptBR.d.ts +4 -0
  49. package/dist/vue/lang/ptBR.d.ts.map +1 -0
  50. package/dist/vue/lang/zh.d.ts +4 -0
  51. package/dist/vue/lang/zh.d.ts.map +1 -0
  52. package/dist/vue/uiContext.d.ts +143 -4
  53. package/dist/vue/uiContext.d.ts.map +1 -1
  54. package/dist/vue/useCollectionRendering.d.ts.map +1 -1
  55. package/dist/vue.cjs +3327 -238
  56. package/dist/vue.cjs.map +1 -1
  57. package/dist/vue.js +3297 -217
  58. package/dist/vue.js.map +1 -1
  59. package/package.json +1 -1
  60. package/dist/calendarGrid-DZeLwBj9.cjs.map +0 -1
  61. package/dist/calendarGrid-ggmFTZju.js.map +0 -1
package/dist/vue.js CHANGED
@@ -1,7 +1,7 @@
1
- import { M as resolveEnumColor, T as fieldVisible, _ as labelFieldFor, g as itemLabelOf, h as itemIdOf, i as buildMonthGrid, m as ymdKey, n as assignLanes, r as bucketRecords, s as daySlice, t as MINUTES_PER_DAY, x as emptyRow } from "./calendarGrid-ggmFTZju.js";
1
+ import { A as buildUpdatedRecord, C as dateSortValue, D as numericSortValue, E as nextSortDirection, F as rowFromItem, I as actionVisible, L as fieldVisible, M as draftToRecord, N as emptyRow, O as sortItems, P as firstMissingRequiredField, T as isSortableField, W as resolveEnumColor, _ as ymdKey, a as assignLanes, b as labelFieldFor, i as MINUTES_PER_DAY, j as coerceInlineValue, k as stringSortValue, l as dateOf, n as shortHexId, o as bucketRecords, r as errorMessage, s as buildMonthGrid, t as defangForPrompt, u as daySlice, v as itemIdOf, w as enumSortValue, x as boolSortValue, y as itemLabelOf } from "./promptSafety-DShN_VCG.js";
2
2
  import { t as deriveAll } from "./deriveAll-BHcs1erT.js";
3
- import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, toDisplayString, unref, useModel, vModelCheckbox, vModelDynamic, vModelSelect, vModelText, withCtx, withDirectives, withKeys, withModifiers } from "vue";
4
- import { useI18n } from "vue-i18n";
3
+ import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, effectScope, mergeModels, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, toDisplayString, unref, useModel, vModelCheckbox, vModelDynamic, vModelSelect, vModelText, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
4
+ import { createI18n } from "vue-i18n";
5
5
  import draggable from "vuedraggable";
6
6
  //#region src/vue/uiContext.ts
7
7
  var current = null;
@@ -66,10 +66,20 @@ function useCollectionRendering(collection, locale) {
66
66
  const embedTargets = new Set(uniqueEmbedTargets(schema));
67
67
  const allTargets = [...new Set([...refTargets, ...embedTargets])];
68
68
  if (allTargets.length === 0) return;
69
- const results = await Promise.all(allTargets.map((target) => collectionUi().fetchCollectionDetail(target).then((result) => ({
70
- target,
71
- result
72
- }))));
69
+ const binding = collectionUi();
70
+ const results = await Promise.all(allTargets.map(async (target) => {
71
+ try {
72
+ return {
73
+ target,
74
+ result: await binding.fetchCollectionDetail(target)
75
+ };
76
+ } catch {
77
+ return {
78
+ target,
79
+ result: { ok: false }
80
+ };
81
+ }
82
+ }));
73
83
  if (collection.value?.slug !== expectedSlug) return;
74
84
  const nextRef = {};
75
85
  const nextRefRecords = {};
@@ -256,6 +266,73 @@ function useCollectionRendering(collection, locale) {
256
266
  };
257
267
  }
258
268
  //#endregion
269
+ //#region src/vue/collectionViewMode.ts
270
+ var STORAGE_KEY = "collection_view_modes";
271
+ var SORT_STORAGE_KEY = "collection_sorts";
272
+ var BUILT_IN_MODES = [
273
+ "table",
274
+ "calendar",
275
+ "kanban"
276
+ ];
277
+ /** A persisted mode is valid if it's a known built-in OR any `custom:<id>`
278
+ * key (the id is validated against the live schema at render time, so an
279
+ * unknown custom id simply collapses to the table there). Takes `unknown`
280
+ * and type-guards `string` first: a corrupted localStorage entry could hold a
281
+ * number/object, and calling `.startsWith` on that would throw. */
282
+ function isValidViewMode(value) {
283
+ return typeof value === "string" && (BUILT_IN_MODES.includes(value) || value.startsWith("custom:"));
284
+ }
285
+ function readAll() {
286
+ try {
287
+ const raw = localStorage.getItem(STORAGE_KEY);
288
+ if (!raw) return {};
289
+ const parsed = JSON.parse(raw);
290
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
291
+ } catch {
292
+ return {};
293
+ }
294
+ }
295
+ function readCollectionViewMode(slug) {
296
+ const stored = readAll()[slug];
297
+ return isValidViewMode(stored) ? stored : null;
298
+ }
299
+ function writeCollectionViewMode(slug, view) {
300
+ try {
301
+ const all = readAll();
302
+ all[slug] = view;
303
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(all));
304
+ } catch {}
305
+ }
306
+ function isSortState(value) {
307
+ if (!value || typeof value !== "object") return false;
308
+ const rec = value;
309
+ return typeof rec.field === "string" && (rec.direction === "asc" || rec.direction === "desc");
310
+ }
311
+ function readAllSorts() {
312
+ try {
313
+ const raw = localStorage.getItem(SORT_STORAGE_KEY);
314
+ if (!raw) return {};
315
+ const parsed = JSON.parse(raw);
316
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
317
+ const out = {};
318
+ for (const [slug, value] of Object.entries(parsed)) if (isSortState(value)) out[slug] = value;
319
+ return out;
320
+ } catch {
321
+ return {};
322
+ }
323
+ }
324
+ function readCollectionSort(slug) {
325
+ return readAllSorts()[slug] ?? null;
326
+ }
327
+ /** Persist (or, when `sort` is null, clear) the slug's active column sort. */
328
+ function writeCollectionSort(slug, sort) {
329
+ try {
330
+ const all = Object.fromEntries(Object.entries(readAllSorts()).filter(([key]) => key !== slug));
331
+ if (sort) all[slug] = sort;
332
+ localStorage.setItem(SORT_STORAGE_KEY, JSON.stringify(all));
333
+ } catch {}
334
+ }
335
+ //#endregion
259
336
  //#region src/vue/components/CollectionRecordModal.vue
260
337
  var CollectionRecordModal_default = /* @__PURE__ */ defineComponent({
261
338
  __name: "CollectionRecordModal",
@@ -326,31 +403,826 @@ var CollectionRecordModal_default = /* @__PURE__ */ defineComponent({
326
403
  }
327
404
  });
328
405
  //#endregion
406
+ //#region src/vue/lang/index.ts
407
+ var i18n = createI18n({
408
+ legacy: false,
409
+ locale: "en",
410
+ fallbackLocale: "en",
411
+ messages: {
412
+ en: {
413
+ collectionsView: {
414
+ addCollectionLabel: "Collection",
415
+ addCollectionPrompt: "Help me create a new collection. First read `config/helps/collection-skills.md` for the schema-driven collection conventions. Then use the `presentForm` tool (do not use AskUserQuestion) to ask me what kind of data I want to track, and author the schema.json and SKILL.md from my answers.",
416
+ addFeedTitle: "Add a feed",
417
+ addFeedHint: "Paste a feed or API URL — I'll fetch it and work out the title and fields for you.",
418
+ addFeedPrompt: "Add a new data-source feed from this URL: {url}\n\nFirst Read `config/helps/feeds.md` and follow it exactly. Fetch that URL yourself, inspect the response to infer a sensible title and fields, then author `feeds/<slug>/schema.json` as the help describes — do NOT ask me any questions; work it all out from the data. Opening the feed loads its items automatically; when you're done, tell me it's registered (no need to mention Refresh).",
419
+ title: "Collections",
420
+ backToIndex: "Back to collections",
421
+ indexEmpty: "No collections installed. Star a skill that ships a schema from the Skills page to see it here.",
422
+ editItem: "Edit",
423
+ openItem: "Open {id}",
424
+ confirmDelete: "Delete this item? This cannot be undone.",
425
+ deleteFeed: "Delete feed",
426
+ confirmDeleteFeed: "Delete the \"{title}\" feed and all its fetched records? This cannot be undone.",
427
+ deleteCollection: "Delete collection",
428
+ confirmDeleteCollection: "Delete the entire \"{title}\" collection, including all its records? A restorable backup is archived first.",
429
+ itemsEmpty: "No items yet. Click + to add one.",
430
+ notFound: "Collection not found",
431
+ loadFailed: "Failed to load",
432
+ requiredField: "This field is required",
433
+ selectPlaceholder: "Select…",
434
+ inlineSaveFailed: "Couldn't save change: {error}",
435
+ addRow: "Add row",
436
+ removeRow: "Remove row",
437
+ noRows: "No rows yet",
438
+ tableSummary: "{count} items",
439
+ embedMissing: "No “{id}” record found in {collection}.",
440
+ embedCreate: "Set it up",
441
+ searchPlaceholder: "Search records…",
442
+ searchSummary: "Showing {shown} of {total}",
443
+ noMatchingItems: "No matching items",
444
+ clearSearch: "Clear search",
445
+ sortBy: "Sort by {field}",
446
+ openCollection: "Open {title}",
447
+ createTitle: "Add new",
448
+ derivedLabel: "Derived",
449
+ embedMissingTitle: "Embedded reference missing",
450
+ chat: "Chat",
451
+ refreshFeed: "Refresh",
452
+ refreshFailed: "Refresh failed: {error}",
453
+ feedChatSeed: "The \"{slug}\" feed is defined by the schema at `feeds/{slug}/schema.json` and its records live in `{dataPath}/` (one `<id>.json` per record). Using that schema and data, respond to this request: {message}",
454
+ feedsTitle: "Data-source feeds",
455
+ feedsEmpty: "No feeds registered yet.",
456
+ chatTitle: "Start a chat",
457
+ chatPlaceholder: "Describe what you want to do with this collection…",
458
+ chatStart: "Start chat",
459
+ viewToggle: "View",
460
+ viewTable: "Table",
461
+ viewCalendar: "Calendar",
462
+ calendarFieldLabel: "Calendar date field",
463
+ calendarPrevMonth: "Previous month",
464
+ calendarNextMonth: "Next month",
465
+ calendarToday: "Today",
466
+ calendarNoDate: "No date",
467
+ calendarCreateOn: "Create on {date}",
468
+ dayViewOpen: "Open day view for {date}",
469
+ dayViewAllDay: "All day",
470
+ dayViewEmpty: "No items on this day",
471
+ dayViewClose: "Close day view",
472
+ viewKanban: "Kanban",
473
+ kanbanFieldLabel: "Kanban group field",
474
+ kanbanUncategorized: "Uncategorized",
475
+ kanbanOpenCard: "Open {label}",
476
+ addView: "Add view",
477
+ config: {
478
+ open: "Collection settings",
479
+ title: "{title} · settings",
480
+ viewsHeading: "Custom views",
481
+ deleteView: "Delete {label}",
482
+ confirmDelete: "Delete the \"{label}\" view? This removes its HTML file and unregisters it.",
483
+ empty: "No custom views yet."
484
+ },
485
+ customViewLoading: "Loading view…",
486
+ customViewError: "Couldn't load this view: {error}",
487
+ addViewPrompt: "I want to add a custom view to the \"{title}\" collection. Ask me what I want to see or edit, then author the HTML view file at {base}/views/your-view.html and register it in {base}/schema.json under `views[]` (capabilities [\"read\"] for a read-only view, [\"read\",\"write\"] if it edits records). Follow the custom-view help for the data contract.",
488
+ repair: "Repair",
489
+ dataIssuesDetected: "{count} record file(s) have data problems and may be missing from this view.",
490
+ repairPrompt: "The \"{title}\" collection has {count} record file(s) with data problems that keep them from appearing. Fix each one — Read the file, correct it, then Write it back:\n{issues}\n\nWhen you're done, call presentCollection to confirm the records load.",
491
+ source: {
492
+ user: "User",
493
+ project: "Project"
494
+ }
495
+ },
496
+ common: {
497
+ add: "Add",
498
+ cancel: "Cancel",
499
+ loading: "Loading...",
500
+ no: "No",
501
+ remove: "Remove",
502
+ save: "Save",
503
+ saving: "Saving...",
504
+ yes: "Yes"
505
+ }
506
+ },
507
+ ja: {
508
+ collectionsView: {
509
+ addCollectionLabel: "コレクション",
510
+ addCollectionPrompt: "新しいコレクションを作成したいです。まず `config/helps/collection-skills.md` を読んでスキーマ駆動コレクションの規約を確認してください。次に `presentForm` ツールを使って(AskUserQuestion は使わないで)どんなデータを管理したいか質問し、その回答をもとに schema.json と SKILL.md を作成してください。",
511
+ addFeedTitle: "フィードを追加",
512
+ addFeedHint: "フィードまたは API の URL を貼り付けてください。取得してタイトルとフィールドを自動で判断します。",
513
+ addFeedPrompt: "次の URL からデータソースフィードを追加してください: {url}\n\nまず `config/helps/feeds.md` を読み、その指示に正確に従ってください。その URL を自分で取得してレスポンスを調べ、ふさわしいタイトルとフィールドを推測し、ヘルプの説明どおりに `feeds/<slug>/schema.json` を作成してください。私には質問せず、データからすべて判断してください。フィードを開くとアイテムは自動で読み込まれます。完了したら登録できたことを伝えてください(Refresh を押すよう案内する必要はありません)。",
514
+ title: "コレクション",
515
+ backToIndex: "コレクション一覧に戻る",
516
+ indexEmpty: "インストール済みのコレクションがありません。スキーマを含むスキルを Skills ページからスター付けすると、ここに表示されます。",
517
+ editItem: "編集",
518
+ openItem: "{id} を開く",
519
+ confirmDelete: "この項目を削除しますか?元に戻せません。",
520
+ deleteFeed: "フィードを削除",
521
+ confirmDeleteFeed: "フィード「{title}」と取得済みのすべてのレコードを削除しますか?この操作は取り消せません。",
522
+ deleteCollection: "コレクションを削除",
523
+ confirmDeleteCollection: "コレクション「{title}」とそのすべてのレコードを削除しますか?削除前に復元可能なバックアップが保存されます。",
524
+ itemsEmpty: "まだ項目がありません。+ を押して追加してください。",
525
+ notFound: "コレクションが見つかりません",
526
+ loadFailed: "読み込みに失敗しました",
527
+ requiredField: "この項目は必須です",
528
+ selectPlaceholder: "選択…",
529
+ inlineSaveFailed: "変更を保存できませんでした: {error}",
530
+ addRow: "行を追加",
531
+ removeRow: "行を削除",
532
+ noRows: "行がありません",
533
+ tableSummary: "{count}件",
534
+ embedMissing: "{collection} に「{id}」のレコードが見つかりません。",
535
+ embedCreate: "設定する",
536
+ searchPlaceholder: "レコードを検索…",
537
+ searchSummary: "{total} 件中 {shown} 件を表示",
538
+ noMatchingItems: "一致する項目がありません",
539
+ clearSearch: "検索をクリア",
540
+ sortBy: "{field}で並べ替え",
541
+ openCollection: "{title} を開く",
542
+ createTitle: "新規追加",
543
+ derivedLabel: "計算値",
544
+ embedMissingTitle: "埋め込み参照が見つかりません",
545
+ chat: "チャット",
546
+ refreshFeed: "更新",
547
+ refreshFailed: "更新に失敗しました: {error}",
548
+ feedChatSeed: "フィード「{slug}」はスキーマ `feeds/{slug}/schema.json` で定義され、レコードは `{dataPath}/`(1 レコードにつき `<id>.json` 1 ファイル)に保存されています。このスキーマとデータを使って、次のリクエストに応えてください: {message}",
549
+ feedsTitle: "データソースフィード",
550
+ feedsEmpty: "登録されたフィードはありません。",
551
+ chatTitle: "チャットを開始",
552
+ chatPlaceholder: "このコレクションで行いたいことを入力してください…",
553
+ chatStart: "チャットを開始",
554
+ viewToggle: "表示",
555
+ viewTable: "テーブル",
556
+ viewCalendar: "カレンダー",
557
+ calendarFieldLabel: "カレンダーの日付フィールド",
558
+ calendarPrevMonth: "前の月",
559
+ calendarNextMonth: "次の月",
560
+ calendarToday: "今日",
561
+ calendarNoDate: "日付なし",
562
+ calendarCreateOn: "{date} に作成",
563
+ dayViewOpen: "{date} の日表示を開く",
564
+ dayViewAllDay: "終日",
565
+ dayViewEmpty: "この日の項目はありません",
566
+ dayViewClose: "日表示を閉じる",
567
+ viewKanban: "カンバン",
568
+ kanbanFieldLabel: "カンバンのグループフィールド",
569
+ kanbanUncategorized: "未分類",
570
+ kanbanOpenCard: "{label} を開く",
571
+ addView: "ビューを追加",
572
+ config: {
573
+ open: "コレクション設定",
574
+ title: "{title} · 設定",
575
+ viewsHeading: "カスタムビュー",
576
+ deleteView: "{label} を削除",
577
+ confirmDelete: "ビュー「{label}」を削除しますか? HTML ファイルを削除し、登録を解除します。",
578
+ empty: "カスタムビューはまだありません。"
579
+ },
580
+ customViewLoading: "ビューを読み込み中…",
581
+ customViewError: "このビューを読み込めませんでした: {error}",
582
+ addViewPrompt: "「{title}」コレクションにカスタムビューを追加したい。何を見たい/編集したいか質問してから、HTML ビューファイルを {base}/views/your-view.html に作成し、{base}/schema.json の `views[]` に登録して(読み取り専用なら capabilities [\"read\"]、レコードを編集するなら [\"read\",\"write\"])。データ契約は custom-view ヘルプに従ってください。",
583
+ repair: "修復",
584
+ dataIssuesDetected: "{count} 件のレコードファイルにデータの問題があり、この表示に出てこない可能性があります。",
585
+ repairPrompt: "コレクション「{title}」に、表示されない原因となるデータの問題を持つレコードファイルが {count} 件あります。それぞれを修正してください — ファイルを Read し、修正してから Write し直します:\n{issues}\n\n完了したら presentCollection を呼び出して、レコードが読み込めることを確認してください。",
586
+ source: {
587
+ user: "ユーザー",
588
+ project: "プロジェクト"
589
+ }
590
+ },
591
+ common: {
592
+ add: "追加",
593
+ cancel: "キャンセル",
594
+ loading: "読み込み中...",
595
+ no: "いいえ",
596
+ remove: "削除",
597
+ save: "保存",
598
+ saving: "保存中...",
599
+ yes: "はい"
600
+ }
601
+ },
602
+ zh: {
603
+ collectionsView: {
604
+ addCollectionLabel: "集合",
605
+ addCollectionPrompt: "帮我创建一个新的集合。请先阅读 `config/helps/collection-skills.md` 了解基于 schema 的集合约定。然后使用 `presentForm` 工具(不要使用 AskUserQuestion)询问我想跟踪哪种数据,并根据我的回答编写 schema.json 和 SKILL.md。",
606
+ addFeedTitle: "添加订阅源",
607
+ addFeedHint: "粘贴订阅源或 API 的 URL,我会抓取并自动推断标题和字段。",
608
+ addFeedPrompt: "从以下 URL 添加一个数据源订阅:{url}\n\n请先阅读 `config/helps/feeds.md` 并严格按其说明操作。自己抓取该 URL 并检查响应,推断合适的标题和字段,然后按帮助说明编写 `feeds/<slug>/schema.json`。不要向我提问——完全根据数据判断。打开订阅源会自动加载条目。完成后告诉我已注册(无需提示点击 Refresh)。",
609
+ title: "集合",
610
+ backToIndex: "返回集合列表",
611
+ indexEmpty: "尚未安装任何集合。在「技能」页面对带有 schema 的技能加星即可在此显示。",
612
+ editItem: "编辑",
613
+ openItem: "打开 {id}",
614
+ confirmDelete: "删除此项?此操作无法撤销。",
615
+ deleteFeed: "删除订阅源",
616
+ confirmDeleteFeed: "删除订阅源「{title}」及其所有已抓取的记录?此操作无法撤销。",
617
+ deleteCollection: "删除集合",
618
+ confirmDeleteCollection: "删除整个“{title}”集合及其所有记录?删除前会先归档一份可恢复的备份。",
619
+ itemsEmpty: "暂无项目。点击 + 添加一个。",
620
+ notFound: "未找到集合",
621
+ loadFailed: "加载失败",
622
+ requiredField: "此字段为必填项",
623
+ selectPlaceholder: "请选择…",
624
+ inlineSaveFailed: "无法保存更改:{error}",
625
+ addRow: "添加行",
626
+ removeRow: "删除行",
627
+ noRows: "暂无行",
628
+ tableSummary: "{count} 项",
629
+ embedMissing: "在 {collection} 中找不到「{id}」记录。",
630
+ embedCreate: "去设置",
631
+ searchPlaceholder: "搜索记录…",
632
+ searchSummary: "显示 {total} 条中的 {shown} 条",
633
+ noMatchingItems: "没有匹配的项目",
634
+ clearSearch: "清除搜索",
635
+ sortBy: "按{field}排序",
636
+ openCollection: "打开 {title}",
637
+ createTitle: "新增",
638
+ derivedLabel: "派生",
639
+ embedMissingTitle: "缺少嵌入引用",
640
+ chat: "对话",
641
+ refreshFeed: "刷新",
642
+ refreshFailed: "刷新失败:{error}",
643
+ feedChatSeed: "订阅源“{slug}”由 schema `feeds/{slug}/schema.json` 定义,其记录保存在 `{dataPath}/`(每条记录一个 `<id>.json` 文件)。请使用该 schema 和数据来响应以下请求:{message}",
644
+ feedsTitle: "数据源订阅",
645
+ feedsEmpty: "尚未注册任何订阅源。",
646
+ chatTitle: "开始对话",
647
+ chatPlaceholder: "描述你想对这个集合做什么…",
648
+ chatStart: "开始对话",
649
+ viewToggle: "视图",
650
+ viewTable: "表格",
651
+ viewCalendar: "日历",
652
+ calendarFieldLabel: "日历日期字段",
653
+ calendarPrevMonth: "上个月",
654
+ calendarNextMonth: "下个月",
655
+ calendarToday: "今天",
656
+ calendarNoDate: "无日期",
657
+ calendarCreateOn: "在 {date} 创建",
658
+ dayViewOpen: "打开 {date} 的日视图",
659
+ dayViewAllDay: "全天",
660
+ dayViewEmpty: "当天没有项目",
661
+ dayViewClose: "关闭日视图",
662
+ viewKanban: "看板",
663
+ kanbanFieldLabel: "看板分组字段",
664
+ kanbanUncategorized: "未分类",
665
+ kanbanOpenCard: "打开 {label}",
666
+ addView: "添加视图",
667
+ config: {
668
+ open: "集合设置",
669
+ title: "{title} · 设置",
670
+ viewsHeading: "自定义视图",
671
+ deleteView: "删除 {label}",
672
+ confirmDelete: "删除视图“{label}”?这将删除其 HTML 文件并取消注册。",
673
+ empty: "暂无自定义视图。"
674
+ },
675
+ customViewLoading: "正在加载视图…",
676
+ customViewError: "无法加载此视图:{error}",
677
+ addViewPrompt: "我想为“{title}”集合添加一个自定义视图。先问我想查看或编辑什么,然后在 {base}/views/your-view.html 创建 HTML 视图文件,并在 {base}/schema.json 的 `views[]` 中注册(只读视图用 capabilities [\"read\"],需要编辑记录则用 [\"read\",\"write\"])。数据契约请遵循 custom-view 帮助文档。",
678
+ repair: "修复",
679
+ dataIssuesDetected: "有 {count} 个记录文件存在数据问题,可能未显示在此视图中。",
680
+ repairPrompt: "集合 {title} 有 {count} 个记录文件存在导致无法显示的数据问题。请逐一修复——用 Read 读取该文件,更正后再用 Write 写回:\n{issues}\n\n完成后,调用 presentCollection 确认记录可以正常加载。",
681
+ source: {
682
+ user: "用户",
683
+ project: "项目"
684
+ }
685
+ },
686
+ common: {
687
+ add: "添加",
688
+ cancel: "取消",
689
+ loading: "加载中...",
690
+ no: "否",
691
+ remove: "移除",
692
+ save: "保存",
693
+ saving: "保存中...",
694
+ yes: "是"
695
+ }
696
+ },
697
+ ko: {
698
+ collectionsView: {
699
+ addCollectionLabel: "컬렉션",
700
+ addCollectionPrompt: "새 컬렉션을 만들고 싶어요. 먼저 `config/helps/collection-skills.md`를 읽고 스키마 기반 컬렉션 규칙을 확인하세요. 그런 다음 `presentForm` 도구를 사용해(AskUserQuestion은 사용하지 말고) 어떤 데이터를 관리하고 싶은지 물어보고, 제 답변을 바탕으로 schema.json과 SKILL.md를 작성해 주세요.",
701
+ addFeedTitle: "피드 추가",
702
+ addFeedHint: "피드 또는 API URL을 붙여넣으세요. 가져와서 제목과 필드를 자동으로 추론합니다.",
703
+ addFeedPrompt: "다음 URL에서 데이터 소스 피드를 추가하세요: {url}\n\n먼저 `config/helps/feeds.md`를 읽고 그대로 따르세요. 해당 URL을 직접 가져와 응답을 살펴보고 적절한 제목과 필드를 추론한 다음, 도움말 설명대로 `feeds/<slug>/schema.json`을 작성하세요. 저에게 질문하지 말고 데이터에서 모두 판단하세요. 피드를 열면 항목이 자동으로 로드됩니다. 완료되면 등록되었다고 알려주세요(Refresh를 누르라고 안내할 필요 없음).",
704
+ title: "컬렉션",
705
+ backToIndex: "컬렉션 목록으로 돌아가기",
706
+ indexEmpty: "설치된 컬렉션이 없습니다. Skills 페이지에서 스키마를 포함한 스킬에 별표를 추가하면 여기에 표시됩니다.",
707
+ editItem: "편집",
708
+ openItem: "{id} 열기",
709
+ confirmDelete: "이 항목을 삭제하시겠습니까? 되돌릴 수 없습니다.",
710
+ deleteFeed: "피드 삭제",
711
+ confirmDeleteFeed: "\"{title}\" 피드와 가져온 모든 레코드를 삭제하시겠습니까? 이 작업은 되돌릴 수 없습니다.",
712
+ deleteCollection: "컬렉션 삭제",
713
+ confirmDeleteCollection: "\"{title}\" 컬렉션과 모든 레코드를 삭제하시겠습니까? 삭제 전에 복원 가능한 백업이 보관됩니다.",
714
+ itemsEmpty: "아직 항목이 없습니다. + 를 눌러 추가하세요.",
715
+ notFound: "컬렉션을 찾을 수 없습니다",
716
+ loadFailed: "불러오기에 실패했습니다",
717
+ requiredField: "이 필드는 필수입니다",
718
+ selectPlaceholder: "선택…",
719
+ inlineSaveFailed: "변경 사항을 저장하지 못했습니다: {error}",
720
+ addRow: "행 추가",
721
+ removeRow: "행 삭제",
722
+ noRows: "행이 없습니다",
723
+ tableSummary: "{count}개",
724
+ embedMissing: "{collection}에 '{id}' 레코드가 없습니다.",
725
+ embedCreate: "설정하기",
726
+ searchPlaceholder: "레코드 검색…",
727
+ searchSummary: "{total}개 중 {shown}개 표시",
728
+ noMatchingItems: "일치하는 항목이 없습니다",
729
+ clearSearch: "검색 지우기",
730
+ sortBy: "{field} 기준 정렬",
731
+ openCollection: "{title} 열기",
732
+ createTitle: "새로 추가",
733
+ derivedLabel: "파생",
734
+ embedMissingTitle: "임베드된 참조 없음",
735
+ chat: "채팅",
736
+ refreshFeed: "새로고침",
737
+ refreshFailed: "새로고침 실패: {error}",
738
+ feedChatSeed: "“{slug}” 피드는 스키마 `feeds/{slug}/schema.json`로 정의되며, 레코드는 `{dataPath}/`(레코드당 `<id>.json` 파일 하나)에 저장됩니다. 이 스키마와 데이터를 사용하여 다음 요청에 응답하세요: {message}",
739
+ feedsTitle: "데이터 소스 피드",
740
+ feedsEmpty: "등록된 피드가 없습니다.",
741
+ chatTitle: "채팅 시작",
742
+ chatPlaceholder: "이 컬렉션으로 하고 싶은 작업을 설명하세요…",
743
+ chatStart: "채팅 시작",
744
+ viewToggle: "보기",
745
+ viewTable: "표",
746
+ viewCalendar: "캘린더",
747
+ calendarFieldLabel: "캘린더 날짜 필드",
748
+ calendarPrevMonth: "이전 달",
749
+ calendarNextMonth: "다음 달",
750
+ calendarToday: "오늘",
751
+ calendarNoDate: "날짜 없음",
752
+ calendarCreateOn: "{date}에 생성",
753
+ dayViewOpen: "{date} 일 보기 열기",
754
+ dayViewAllDay: "종일",
755
+ dayViewEmpty: "이 날에는 항목이 없습니다",
756
+ dayViewClose: "일 보기 닫기",
757
+ viewKanban: "칸반",
758
+ kanbanFieldLabel: "칸반 그룹 필드",
759
+ kanbanUncategorized: "미분류",
760
+ kanbanOpenCard: "{label} 열기",
761
+ addView: "보기 추가",
762
+ config: {
763
+ open: "컬렉션 설정",
764
+ title: "{title} · 설정",
765
+ viewsHeading: "사용자 지정 보기",
766
+ deleteView: "{label} 삭제",
767
+ confirmDelete: "“{label}” 보기를 삭제할까요? HTML 파일을 삭제하고 등록을 해제합니다.",
768
+ empty: "아직 사용자 지정 보기가 없습니다."
769
+ },
770
+ customViewLoading: "보기를 불러오는 중…",
771
+ customViewError: "이 보기를 불러오지 못했습니다: {error}",
772
+ addViewPrompt: "{title} 컬렉션에 사용자 지정 보기를 추가하고 싶어요. 무엇을 보거나 편집하고 싶은지 먼저 물어본 뒤, {base}/views/your-view.html 에 HTML 보기 파일을 만들고 {base}/schema.json의 `views[]`에 등록해 주세요(읽기 전용 보기는 capabilities [\"read\"], 레코드를 편집하면 [\"read\",\"write\"]). 데이터 계약은 custom-view 도움말을 따르세요.",
773
+ repair: "복구",
774
+ dataIssuesDetected: "{count}개의 레코드 파일에 데이터 문제가 있어 이 보기에 표시되지 않을 수 있습니다.",
775
+ repairPrompt: "{title} 컬렉션에 표시되지 않는 원인이 되는 데이터 문제가 있는 레코드 파일이 {count}개 있습니다. 각 파일을 수정하세요 — Read로 파일을 읽고 수정한 뒤 Write로 다시 저장하세요:\n{issues}\n\n완료되면 presentCollection을 호출하여 레코드가 로드되는지 확인하세요.",
776
+ source: {
777
+ user: "사용자",
778
+ project: "프로젝트"
779
+ }
780
+ },
781
+ common: {
782
+ add: "추가",
783
+ cancel: "취소",
784
+ loading: "불러오는 중...",
785
+ no: "아니오",
786
+ remove: "삭제",
787
+ save: "저장",
788
+ saving: "저장 중...",
789
+ yes: "예"
790
+ }
791
+ },
792
+ es: {
793
+ collectionsView: {
794
+ addCollectionLabel: "Colección",
795
+ addCollectionPrompt: "Ayúdame a crear una nueva colección. Primero lee `config/helps/collection-skills.md` para conocer las convenciones de las colecciones basadas en esquemas. Luego usa la herramienta `presentForm` (no uses AskUserQuestion) para preguntarme qué tipo de datos quiero registrar, y crea el schema.json y el SKILL.md a partir de mis respuestas.",
796
+ addFeedTitle: "Añadir un feed",
797
+ addFeedHint: "Pega la URL de un feed o una API; la obtendré y deduciré el título y los campos por ti.",
798
+ addFeedPrompt: "Añade una nueva fuente de datos (feed) desde esta URL: {url}\n\nPrimero lee `config/helps/feeds.md` y síguelo exactamente. Obtén esa URL tú mismo, inspecciona la respuesta para deducir un título adecuado y los campos, y luego crea `feeds/<slug>/schema.json` como indica la ayuda. NO me hagas preguntas: dedúcelo todo a partir de los datos. Al abrir el feed sus elementos se cargan automáticamente; cuando termines, dime que está registrado (no hace falta mencionar Refresh).",
799
+ title: "Colecciones",
800
+ backToIndex: "Volver a colecciones",
801
+ indexEmpty: "No hay colecciones instaladas. Marca con estrella una skill que incluya un schema desde la página Skills para verla aquí.",
802
+ editItem: "Editar",
803
+ openItem: "Abrir {id}",
804
+ confirmDelete: "¿Eliminar este elemento? Esta acción no se puede deshacer.",
805
+ deleteFeed: "Eliminar feed",
806
+ confirmDeleteFeed: "¿Eliminar el feed \"{title}\" y todos sus registros descargados? Esta acción no se puede deshacer.",
807
+ deleteCollection: "Eliminar colección",
808
+ confirmDeleteCollection: "¿Eliminar toda la colección \"{title}\", incluidos todos sus registros? Antes se archiva una copia de seguridad restaurable.",
809
+ itemsEmpty: "Aún no hay elementos. Pulsa + para añadir uno.",
810
+ notFound: "Colección no encontrada",
811
+ loadFailed: "Error al cargar",
812
+ requiredField: "Este campo es obligatorio",
813
+ selectPlaceholder: "Seleccionar…",
814
+ inlineSaveFailed: "No se pudo guardar el cambio: {error}",
815
+ addRow: "Añadir fila",
816
+ removeRow: "Quitar fila",
817
+ noRows: "Aún no hay filas",
818
+ tableSummary: "{count} elementos",
819
+ embedMissing: "No se encontró el registro «{id}» en {collection}.",
820
+ embedCreate: "Configurarlo",
821
+ searchPlaceholder: "Buscar registros…",
822
+ searchSummary: "Mostrando {shown} de {total}",
823
+ noMatchingItems: "No hay elementos coincidentes",
824
+ clearSearch: "Borrar búsqueda",
825
+ sortBy: "Ordenar por {field}",
826
+ openCollection: "Abrir {title}",
827
+ createTitle: "Añadir nuevo",
828
+ derivedLabel: "Derivado",
829
+ embedMissingTitle: "Falta la referencia incrustada",
830
+ chat: "Chat",
831
+ refreshFeed: "Actualizar",
832
+ refreshFailed: "Error al actualizar: {error}",
833
+ feedChatSeed: "El feed «{slug}» está definido por el esquema `feeds/{slug}/schema.json` y sus registros se guardan en `{dataPath}/` (un archivo `<id>.json` por registro). Usa ese esquema y esos datos para responder a esta solicitud: {message}",
834
+ feedsTitle: "Fuentes de datos",
835
+ feedsEmpty: "Aún no hay fuentes registradas.",
836
+ chatTitle: "Iniciar un chat",
837
+ chatPlaceholder: "Describe qué quieres hacer con esta colección…",
838
+ chatStart: "Iniciar chat",
839
+ viewToggle: "Vista",
840
+ viewTable: "Tabla",
841
+ viewCalendar: "Calendario",
842
+ calendarFieldLabel: "Campo de fecha del calendario",
843
+ calendarPrevMonth: "Mes anterior",
844
+ calendarNextMonth: "Mes siguiente",
845
+ calendarToday: "Hoy",
846
+ calendarNoDate: "Sin fecha",
847
+ calendarCreateOn: "Crear el {date}",
848
+ dayViewOpen: "Abrir vista de día para {date}",
849
+ dayViewAllDay: "Todo el día",
850
+ dayViewEmpty: "No hay elementos este día",
851
+ dayViewClose: "Cerrar vista de día",
852
+ viewKanban: "Kanban",
853
+ kanbanFieldLabel: "Campo de agrupación Kanban",
854
+ kanbanUncategorized: "Sin categoría",
855
+ kanbanOpenCard: "Abrir {label}",
856
+ addView: "Añadir vista",
857
+ config: {
858
+ open: "Ajustes de la colección",
859
+ title: "{title} · ajustes",
860
+ viewsHeading: "Vistas personalizadas",
861
+ deleteView: "Eliminar {label}",
862
+ confirmDelete: "¿Eliminar la vista \"{label}\"? Se borrará su archivo HTML y se anulará su registro.",
863
+ empty: "Aún no hay vistas personalizadas."
864
+ },
865
+ customViewLoading: "Cargando vista…",
866
+ customViewError: "No se pudo cargar esta vista: {error}",
867
+ addViewPrompt: "Quiero añadir una vista personalizada a la colección «{title}». Pregúntame qué quiero ver o editar, luego crea el archivo HTML de la vista en {base}/views/your-view.html y regístralo en {base}/schema.json dentro de `views[]` (capabilities [\"read\"] para una vista de solo lectura, [\"read\",\"write\"] si edita registros). Sigue la ayuda custom-view para el contrato de datos.",
868
+ repair: "Reparar",
869
+ dataIssuesDetected: "{count} archivo(s) de registro tienen problemas de datos y podrían no aparecer en esta vista.",
870
+ repairPrompt: "La colección {title} tiene {count} archivo(s) de registro con problemas de datos que impiden que aparezcan. Corrige cada uno: lee el archivo con Read, corrígelo y vuelve a escribirlo con Write:\n{issues}\n\nCuando termines, llama a presentCollection para confirmar que los registros se cargan.",
871
+ source: {
872
+ user: "Usuario",
873
+ project: "Proyecto"
874
+ }
875
+ },
876
+ common: {
877
+ add: "Añadir",
878
+ cancel: "Cancelar",
879
+ loading: "Cargando...",
880
+ no: "No",
881
+ remove: "Quitar",
882
+ save: "Guardar",
883
+ saving: "Guardando...",
884
+ yes: "Sí"
885
+ }
886
+ },
887
+ "pt-BR": {
888
+ collectionsView: {
889
+ addCollectionLabel: "Coleção",
890
+ addCollectionPrompt: "Ajude-me a criar uma nova coleção. Primeiro leia `config/helps/collection-skills.md` para conhecer as convenções de coleções baseadas em esquema. Depois use a ferramenta `presentForm` (não use AskUserQuestion) para perguntar que tipo de dados quero acompanhar, e crie o schema.json e o SKILL.md a partir das minhas respostas.",
891
+ addFeedTitle: "Adicionar um feed",
892
+ addFeedHint: "Cole a URL de um feed ou API; vou buscá-la e deduzir o título e os campos para você.",
893
+ addFeedPrompt: "Adicione um novo feed de fonte de dados a partir desta URL: {url}\n\nPrimeiro leia `config/helps/feeds.md` e siga-o exatamente. Busque essa URL você mesmo, inspecione a resposta para deduzir um título adequado e os campos, e então crie `feeds/<slug>/schema.json` como a ajuda descreve. NÃO me faça perguntas: deduza tudo a partir dos dados. Ao abrir o feed os itens são carregados automaticamente; quando terminar, diga-me que está registrado (não precisa mencionar Refresh).",
894
+ title: "Coleções",
895
+ backToIndex: "Voltar para coleções",
896
+ indexEmpty: "Nenhuma coleção instalada. Marque com estrela uma skill que inclua um schema na página Skills para vê-la aqui.",
897
+ editItem: "Editar",
898
+ openItem: "Abrir {id}",
899
+ confirmDelete: "Excluir este item? Esta ação não pode ser desfeita.",
900
+ deleteFeed: "Excluir feed",
901
+ confirmDeleteFeed: "Excluir o feed \"{title}\" e todos os seus registros baixados? Esta ação não pode ser desfeita.",
902
+ deleteCollection: "Excluir coleção",
903
+ confirmDeleteCollection: "Excluir toda a coleção \"{title}\", incluindo todos os seus registros? Um backup restaurável é arquivado antes.",
904
+ itemsEmpty: "Ainda não há itens. Clique em + para adicionar um.",
905
+ notFound: "Coleção não encontrada",
906
+ loadFailed: "Falha ao carregar",
907
+ requiredField: "Este campo é obrigatório",
908
+ selectPlaceholder: "Selecionar…",
909
+ inlineSaveFailed: "Não foi possível salvar a alteração: {error}",
910
+ addRow: "Adicionar linha",
911
+ removeRow: "Remover linha",
912
+ noRows: "Ainda não há linhas",
913
+ tableSummary: "{count} itens",
914
+ embedMissing: "Nenhum registro '{id}' encontrado em {collection}.",
915
+ embedCreate: "Configurar",
916
+ searchPlaceholder: "Buscar registros…",
917
+ searchSummary: "Mostrando {shown} de {total}",
918
+ noMatchingItems: "Nenhum item correspondente",
919
+ clearSearch: "Limpar busca",
920
+ sortBy: "Ordenar por {field}",
921
+ openCollection: "Abrir {title}",
922
+ createTitle: "Adicionar novo",
923
+ derivedLabel: "Derivado",
924
+ embedMissingTitle: "Referência incorporada ausente",
925
+ chat: "Chat",
926
+ refreshFeed: "Atualizar",
927
+ refreshFailed: "Falha ao atualizar: {error}",
928
+ feedChatSeed: "O feed \"{slug}\" é definido pelo esquema `feeds/{slug}/schema.json` e seus registros ficam em `{dataPath}/` (um arquivo `<id>.json` por registro). Use esse esquema e esses dados para responder a esta solicitação: {message}",
929
+ feedsTitle: "Feeds de dados",
930
+ feedsEmpty: "Nenhum feed registrado ainda.",
931
+ chatTitle: "Iniciar um chat",
932
+ chatPlaceholder: "Descreva o que você quer fazer com esta coleção…",
933
+ chatStart: "Iniciar chat",
934
+ viewToggle: "Visualização",
935
+ viewTable: "Tabela",
936
+ viewCalendar: "Calendário",
937
+ calendarFieldLabel: "Campo de data do calendário",
938
+ calendarPrevMonth: "Mês anterior",
939
+ calendarNextMonth: "Próximo mês",
940
+ calendarToday: "Hoje",
941
+ calendarNoDate: "Sem data",
942
+ calendarCreateOn: "Criar em {date}",
943
+ dayViewOpen: "Abrir visualização do dia para {date}",
944
+ dayViewAllDay: "Dia inteiro",
945
+ dayViewEmpty: "Nenhum item neste dia",
946
+ dayViewClose: "Fechar visualização do dia",
947
+ viewKanban: "Kanban",
948
+ kanbanFieldLabel: "Campo de agrupamento do Kanban",
949
+ kanbanUncategorized: "Sem categoria",
950
+ kanbanOpenCard: "Abrir {label}",
951
+ addView: "Adicionar visualização",
952
+ config: {
953
+ open: "Configurações da coleção",
954
+ title: "{title} · configurações",
955
+ viewsHeading: "Visualizações personalizadas",
956
+ deleteView: "Excluir {label}",
957
+ confirmDelete: "Excluir a visualização \"{label}\"? Isso remove o arquivo HTML e cancela o registro.",
958
+ empty: "Ainda não há visualizações personalizadas."
959
+ },
960
+ customViewLoading: "Carregando visualização…",
961
+ customViewError: "Não foi possível carregar esta visualização: {error}",
962
+ addViewPrompt: "Quero adicionar uma visualização personalizada à coleção \"{title}\". Pergunte o que eu quero ver ou editar, depois crie o arquivo HTML da visualização em {base}/views/your-view.html e registre-o em {base}/schema.json em `views[]` (capabilities [\"read\"] para uma visualização somente leitura, [\"read\",\"write\"] se editar registros). Siga a ajuda custom-view para o contrato de dados.",
963
+ repair: "Reparar",
964
+ dataIssuesDetected: "{count} arquivo(s) de registro têm problemas de dados e podem não aparecer nesta visualização.",
965
+ repairPrompt: "A coleção {title} tem {count} arquivo(s) de registro com problemas de dados que impedem que apareçam. Corrija cada um: leia o arquivo com Read, corrija-o e grave-o novamente com Write:\n{issues}\n\nQuando terminar, chame presentCollection para confirmar que os registros carregam.",
966
+ source: {
967
+ user: "Usuário",
968
+ project: "Projeto"
969
+ }
970
+ },
971
+ common: {
972
+ add: "Adicionar",
973
+ cancel: "Cancelar",
974
+ loading: "Carregando...",
975
+ no: "Não",
976
+ remove: "Remover",
977
+ save: "Salvar",
978
+ saving: "Salvando...",
979
+ yes: "Sim"
980
+ }
981
+ },
982
+ fr: {
983
+ collectionsView: {
984
+ addCollectionLabel: "Collection",
985
+ addCollectionPrompt: "Aide-moi à créer une nouvelle collection. Lis d'abord `config/helps/collection-skills.md` pour les conventions des collections basées sur un schéma. Utilise ensuite l'outil `presentForm` (n'utilise pas AskUserQuestion) pour me demander quel type de données je veux suivre, et crée le schema.json et le SKILL.md à partir de mes réponses.",
986
+ addFeedTitle: "Ajouter un flux",
987
+ addFeedHint: "Collez l'URL d'un flux ou d'une API ; je la récupère et déduis le titre et les champs pour vous.",
988
+ addFeedPrompt: "Ajoute un nouveau flux de source de données depuis cette URL : {url}\n\nLis d'abord `config/helps/feeds.md` et suis-le exactement. Récupère cette URL toi-même, inspecte la réponse pour déduire un titre pertinent et les champs, puis crée `feeds/<slug>/schema.json` comme l'explique l'aide. Ne me pose AUCUNE question — déduis tout à partir des données. À l'ouverture du flux, ses éléments se chargent automatiquement ; quand tu as terminé, dis-moi qu'il est enregistré (inutile de mentionner Refresh).",
989
+ title: "Collections",
990
+ backToIndex: "Retour aux collections",
991
+ indexEmpty: "Aucune collection installée. Mettez une étoile sur une compétence avec un schema depuis la page Skills pour la voir ici.",
992
+ editItem: "Modifier",
993
+ openItem: "Ouvrir {id}",
994
+ confirmDelete: "Supprimer cet élément ? Cette action est irréversible.",
995
+ deleteFeed: "Supprimer le flux",
996
+ confirmDeleteFeed: "Supprimer le flux « {title} » et tous ses enregistrements récupérés ? Cette action est irréversible.",
997
+ deleteCollection: "Supprimer la collection",
998
+ confirmDeleteCollection: "Supprimer toute la collection « {title} », y compris tous ses enregistrements ? Une sauvegarde restaurable est archivée au préalable.",
999
+ itemsEmpty: "Aucun élément pour l'instant. Cliquez sur + pour en ajouter un.",
1000
+ notFound: "Collection introuvable",
1001
+ loadFailed: "Échec du chargement",
1002
+ requiredField: "Ce champ est obligatoire",
1003
+ selectPlaceholder: "Sélectionner…",
1004
+ inlineSaveFailed: "Impossible d'enregistrer la modification : {error}",
1005
+ addRow: "Ajouter une ligne",
1006
+ removeRow: "Supprimer la ligne",
1007
+ noRows: "Aucune ligne pour l'instant",
1008
+ tableSummary: "{count} éléments",
1009
+ embedMissing: "Aucun enregistrement « {id} » trouvé dans {collection}.",
1010
+ embedCreate: "Le configurer",
1011
+ searchPlaceholder: "Rechercher des enregistrements…",
1012
+ searchSummary: "Affichage de {shown} sur {total}",
1013
+ noMatchingItems: "Aucun élément correspondant",
1014
+ clearSearch: "Effacer la recherche",
1015
+ sortBy: "Trier par {field}",
1016
+ openCollection: "Ouvrir {title}",
1017
+ createTitle: "Ajouter",
1018
+ derivedLabel: "Calculé",
1019
+ embedMissingTitle: "Référence intégrée manquante",
1020
+ chat: "Discussion",
1021
+ refreshFeed: "Actualiser",
1022
+ refreshFailed: "Échec de l'actualisation : {error}",
1023
+ feedChatSeed: "Le flux « {slug} » est défini par le schéma `feeds/{slug}/schema.json` et ses enregistrements se trouvent dans `{dataPath}/` (un fichier `<id>.json` par enregistrement). Utilise ce schéma et ces données pour répondre à cette demande : {message}",
1024
+ feedsTitle: "Flux de données",
1025
+ feedsEmpty: "Aucun flux enregistré pour le moment.",
1026
+ chatTitle: "Démarrer une discussion",
1027
+ chatPlaceholder: "Décrivez ce que vous voulez faire avec cette collection…",
1028
+ chatStart: "Démarrer la discussion",
1029
+ viewToggle: "Affichage",
1030
+ viewTable: "Tableau",
1031
+ viewCalendar: "Calendrier",
1032
+ calendarFieldLabel: "Champ de date du calendrier",
1033
+ calendarPrevMonth: "Mois précédent",
1034
+ calendarNextMonth: "Mois suivant",
1035
+ calendarToday: "Aujourd'hui",
1036
+ calendarNoDate: "Sans date",
1037
+ calendarCreateOn: "Créer le {date}",
1038
+ dayViewOpen: "Ouvrir la vue du jour pour {date}",
1039
+ dayViewAllDay: "Toute la journée",
1040
+ dayViewEmpty: "Aucun élément ce jour",
1041
+ dayViewClose: "Fermer la vue du jour",
1042
+ viewKanban: "Kanban",
1043
+ kanbanFieldLabel: "Champ de regroupement Kanban",
1044
+ kanbanUncategorized: "Non classé",
1045
+ kanbanOpenCard: "Ouvrir {label}",
1046
+ addView: "Ajouter une vue",
1047
+ config: {
1048
+ open: "Paramètres de la collection",
1049
+ title: "{title} · paramètres",
1050
+ viewsHeading: "Vues personnalisées",
1051
+ deleteView: "Supprimer {label}",
1052
+ confirmDelete: "Supprimer la vue « {label} » ? Cela supprime son fichier HTML et la désenregistre.",
1053
+ empty: "Aucune vue personnalisée pour le moment."
1054
+ },
1055
+ customViewLoading: "Chargement de la vue…",
1056
+ customViewError: "Impossible de charger cette vue : {error}",
1057
+ addViewPrompt: "Je veux ajouter une vue personnalisée à la collection « {title} ». Demande-moi ce que je veux voir ou modifier, puis crée le fichier HTML de la vue dans {base}/views/your-view.html et enregistre-le dans {base}/schema.json sous `views[]` (capabilities [\"read\"] pour une vue en lecture seule, [\"read\",\"write\"] si elle modifie des enregistrements). Suis l'aide custom-view pour le contrat de données.",
1058
+ repair: "Réparer",
1059
+ dataIssuesDetected: "{count} fichier(s) d'enregistrement présentent des problèmes de données et peuvent être absents de cette vue.",
1060
+ repairPrompt: "La collection « {title} » comporte {count} fichier(s) d'enregistrement présentant des problèmes de données qui les empêchent d'apparaître. Corrigez chacun : lisez le fichier avec Read, corrigez-le, puis réécrivez-le avec Write :\n{issues}\n\nUne fois terminé, appelez presentCollection pour confirmer que les enregistrements se chargent.",
1061
+ source: {
1062
+ user: "Utilisateur",
1063
+ project: "Projet"
1064
+ }
1065
+ },
1066
+ common: {
1067
+ add: "Ajouter",
1068
+ cancel: "Annuler",
1069
+ loading: "Chargement...",
1070
+ no: "Non",
1071
+ remove: "Supprimer",
1072
+ save: "Enregistrer",
1073
+ saving: "Enregistrement...",
1074
+ yes: "Oui"
1075
+ }
1076
+ },
1077
+ de: {
1078
+ collectionsView: {
1079
+ addCollectionLabel: "Sammlung",
1080
+ addCollectionPrompt: "Hilf mir, eine neue Sammlung zu erstellen. Lies zuerst `config/helps/collection-skills.md` für die Konventionen schemabasierter Sammlungen. Verwende dann das Tool `presentForm` (nutze nicht AskUserQuestion), um mich zu fragen, welche Art von Daten ich verfolgen möchte, und erstelle die schema.json und SKILL.md aus meinen Antworten.",
1081
+ addFeedTitle: "Feed hinzufügen",
1082
+ addFeedHint: "Füge die URL eines Feeds oder einer API ein; ich rufe sie ab und ermittle Titel und Felder für dich.",
1083
+ addFeedPrompt: "Füge einen neuen Datenquellen-Feed von dieser URL hinzu: {url}\n\nLies zuerst `config/helps/feeds.md` und befolge es genau. Rufe diese URL selbst ab, untersuche die Antwort, um einen sinnvollen Titel und die Felder abzuleiten, und erstelle dann `feeds/<slug>/schema.json` wie in der Hilfe beschrieben. Stelle mir KEINE Fragen - leite alles aus den Daten ab. Beim Öffnen des Feeds werden seine Einträge automatisch geladen; sag mir Bescheid, wenn er registriert ist (Refresh muss nicht erwähnt werden).",
1084
+ title: "Sammlungen",
1085
+ backToIndex: "Zurück zu Sammlungen",
1086
+ indexEmpty: "Keine Sammlungen installiert. Markiere auf der Skills-Seite eine Skill mit Schema, um sie hier zu sehen.",
1087
+ editItem: "Bearbeiten",
1088
+ openItem: "{id} öffnen",
1089
+ confirmDelete: "Diesen Eintrag löschen? Das kann nicht rückgängig gemacht werden.",
1090
+ deleteFeed: "Feed löschen",
1091
+ confirmDeleteFeed: "Den Feed {title} und alle abgerufenen Datensätze löschen? Dies kann nicht rückgängig gemacht werden.",
1092
+ deleteCollection: "Sammlung löschen",
1093
+ confirmDeleteCollection: "Die gesamte Sammlung „{title}“ einschließlich aller Datensätze löschen? Zuvor wird eine wiederherstellbare Sicherung archiviert.",
1094
+ itemsEmpty: "Noch keine Einträge. Klicke auf +, um einen hinzuzufügen.",
1095
+ notFound: "Sammlung nicht gefunden",
1096
+ loadFailed: "Laden fehlgeschlagen",
1097
+ requiredField: "Dieses Feld ist erforderlich",
1098
+ selectPlaceholder: "Auswählen…",
1099
+ inlineSaveFailed: "Änderung konnte nicht gespeichert werden: {error}",
1100
+ addRow: "Zeile hinzufügen",
1101
+ removeRow: "Zeile entfernen",
1102
+ noRows: "Noch keine Zeilen",
1103
+ tableSummary: "{count} Einträge",
1104
+ embedMissing: "Kein Datensatz {id} in {collection} gefunden.",
1105
+ embedCreate: "Einrichten",
1106
+ searchPlaceholder: "Datensätze suchen…",
1107
+ searchSummary: "{shown} von {total} werden angezeigt",
1108
+ noMatchingItems: "Keine passenden Einträge",
1109
+ clearSearch: "Suche zurücksetzen",
1110
+ sortBy: "Nach {field} sortieren",
1111
+ openCollection: "{title} öffnen",
1112
+ createTitle: "Neu hinzufügen",
1113
+ derivedLabel: "Abgeleitet",
1114
+ embedMissingTitle: "Eingebettete Referenz fehlt",
1115
+ chat: "Chat",
1116
+ refreshFeed: "Aktualisieren",
1117
+ refreshFailed: "Aktualisierung fehlgeschlagen: {error}",
1118
+ feedChatSeed: "Der Feed {slug} ist durch das Schema `feeds/{slug}/schema.json` definiert und seine Datensätze liegen in `{dataPath}/` (eine `<id>.json`-Datei pro Datensatz). Nutze dieses Schema und diese Daten, um auf die folgende Anfrage zu antworten: {message}",
1119
+ feedsTitle: "Datenquellen-Feeds",
1120
+ feedsEmpty: "Noch keine Feeds registriert.",
1121
+ chatTitle: "Chat starten",
1122
+ chatPlaceholder: "Beschreibe, was du mit dieser Sammlung tun möchtest…",
1123
+ chatStart: "Chat starten",
1124
+ viewToggle: "Ansicht",
1125
+ viewTable: "Tabelle",
1126
+ viewCalendar: "Kalender",
1127
+ calendarFieldLabel: "Kalender-Datumsfeld",
1128
+ calendarPrevMonth: "Voriger Monat",
1129
+ calendarNextMonth: "Nächster Monat",
1130
+ calendarToday: "Heute",
1131
+ calendarNoDate: "Kein Datum",
1132
+ calendarCreateOn: "Am {date} erstellen",
1133
+ dayViewOpen: "Tagesansicht für {date} öffnen",
1134
+ dayViewAllDay: "Ganztägig",
1135
+ dayViewEmpty: "Keine Einträge an diesem Tag",
1136
+ dayViewClose: "Tagesansicht schließen",
1137
+ viewKanban: "Kanban",
1138
+ kanbanFieldLabel: "Kanban-Gruppierungsfeld",
1139
+ kanbanUncategorized: "Nicht kategorisiert",
1140
+ kanbanOpenCard: "{label} öffnen",
1141
+ addView: "Ansicht hinzufügen",
1142
+ config: {
1143
+ open: "Sammlungseinstellungen",
1144
+ title: "{title} · Einstellungen",
1145
+ viewsHeading: "Benutzerdefinierte Ansichten",
1146
+ deleteView: "{label} löschen",
1147
+ confirmDelete: "Ansicht {label} löschen? Die HTML-Datei wird entfernt und die Registrierung aufgehoben.",
1148
+ empty: "Noch keine benutzerdefinierten Ansichten."
1149
+ },
1150
+ customViewLoading: "Ansicht wird geladen…",
1151
+ customViewError: "Diese Ansicht konnte nicht geladen werden: {error}",
1152
+ addViewPrompt: "Ich möchte der Sammlung {title} eine benutzerdefinierte Ansicht hinzufügen. Frag mich, was ich sehen oder bearbeiten möchte, erstelle dann die HTML-Ansichtsdatei unter {base}/views/your-view.html und registriere sie in {base}/schema.json unter `views[]` (capabilities [\"read\"] für eine schreibgeschützte Ansicht, [\"read\",\"write\"] wenn sie Datensätze bearbeitet). Folge der custom-view-Hilfe für den Datenvertrag.",
1153
+ repair: "Reparieren",
1154
+ dataIssuesDetected: "{count} Datensatzdatei(en) haben Datenprobleme und fehlen möglicherweise in dieser Ansicht.",
1155
+ repairPrompt: "Die Sammlung {title} hat {count} Datensatzdatei(en) mit Datenproblemen, die ihr Erscheinen verhindern. Korrigiere jede — die Datei mit Read lesen, korrigieren und mit Write zurückschreiben:\n{issues}\n\nRufe anschließend presentCollection auf, um zu bestätigen, dass die Datensätze geladen werden.",
1156
+ source: {
1157
+ user: "Benutzer",
1158
+ project: "Projekt"
1159
+ }
1160
+ },
1161
+ common: {
1162
+ add: "Hinzufügen",
1163
+ cancel: "Abbrechen",
1164
+ loading: "Wird geladen...",
1165
+ no: "Nein",
1166
+ remove: "Entfernen",
1167
+ save: "Speichern",
1168
+ saving: "Wird gespeichert...",
1169
+ yes: "Ja"
1170
+ }
1171
+ }
1172
+ }
1173
+ });
1174
+ var syncScope = effectScope(true);
1175
+ var syncing = false;
1176
+ /** Mirror this instance's locale to the host's (via the binding) exactly once,
1177
+ * in a detached effect so it lives for the app's lifetime rather than a single
1178
+ * component's. Called lazily on the first `useT()` — by then App.vue's setup has
1179
+ * configured the binding, so `collectionUi()` resolves. */
1180
+ function ensureLocaleSync() {
1181
+ if (syncing) return;
1182
+ syncing = true;
1183
+ syncScope.run(() => {
1184
+ watchEffect(() => {
1185
+ i18n.global.locale.value = collectionUi().localeTag();
1186
+ });
1187
+ });
1188
+ }
1189
+ /** The plugin's i18n composable — a drop-in for vue-i18n's `useI18n()` over the
1190
+ * plugin's own self-contained instance. Returns `{ t, locale }` (destructured at
1191
+ * the call site, exactly like `useI18n()`), with `t` reading the plugin's keys
1192
+ * and `locale` the reactive tag for date/number formatting. */
1193
+ function useCollectionI18n() {
1194
+ ensureLocaleSync();
1195
+ return {
1196
+ t: i18n.global.t,
1197
+ locale: i18n.global.locale
1198
+ };
1199
+ }
1200
+ //#endregion
329
1201
  //#region src/vue/components/CollectionEmbedView.vue?vue&type=script&setup=true&lang.ts
330
- var _hoisted_1$4 = { class: "flex items-center justify-between text-[10px] font-bold text-indigo-600/90 tracking-wider uppercase" };
331
- var _hoisted_2$4 = { class: "flex items-center gap-1.5" };
332
- var _hoisted_3$4 = { class: "bg-indigo-100/60 text-indigo-700 px-1.5 py-0.5 rounded font-mono font-medium lowercase" };
333
- var _hoisted_4$4 = { class: "grid gap-x-4 gap-y-3 grid-cols-2" };
334
- var _hoisted_5$4 = { class: "text-[10px] font-semibold text-slate-400 uppercase tracking-wide" };
335
- var _hoisted_6$4 = ["data-testid"];
336
- var _hoisted_7$4 = {
1202
+ var _hoisted_1$9 = { class: "flex items-center justify-between text-[10px] font-bold text-indigo-600/90 tracking-wider uppercase" };
1203
+ var _hoisted_2$9 = { class: "flex items-center gap-1.5" };
1204
+ var _hoisted_3$9 = { class: "bg-indigo-100/60 text-indigo-700 px-1.5 py-0.5 rounded font-mono font-medium lowercase" };
1205
+ var _hoisted_4$9 = { class: "grid gap-x-4 gap-y-3 grid-cols-2" };
1206
+ var _hoisted_5$8 = { class: "text-[10px] font-semibold text-slate-400 uppercase tracking-wide" };
1207
+ var _hoisted_6$8 = ["data-testid"];
1208
+ var _hoisted_7$8 = {
337
1209
  key: 0,
338
1210
  class: "material-icons text-emerald-600 text-sm align-middle"
339
1211
  };
340
- var _hoisted_8$4 = {
1212
+ var _hoisted_8$8 = {
341
1213
  key: 1,
342
1214
  class: "text-slate-300"
343
1215
  };
344
- var _hoisted_9$4 = {
1216
+ var _hoisted_9$8 = {
345
1217
  key: 1,
346
1218
  class: "whitespace-pre-wrap font-normal text-slate-600"
347
1219
  };
348
- var _hoisted_10$4 = { key: 2 };
349
- var _hoisted_11$4 = ["data-testid"];
350
- var _hoisted_12$3 = { class: "flex items-start gap-3" };
351
- var _hoisted_13$3 = { class: "flex-1 min-w-0" };
352
- var _hoisted_14$2 = { class: "text-xs font-semibold text-red-800 uppercase tracking-wider mb-1" };
353
- var _hoisted_15$2 = ["data-testid"];
1220
+ var _hoisted_10$8 = { key: 2 };
1221
+ var _hoisted_11$8 = ["data-testid"];
1222
+ var _hoisted_12$7 = { class: "flex items-start gap-3" };
1223
+ var _hoisted_13$6 = { class: "flex-1 min-w-0" };
1224
+ var _hoisted_14$5 = { class: "text-xs font-semibold text-red-800 uppercase tracking-wider mb-1" };
1225
+ var _hoisted_15$5 = ["data-testid"];
354
1226
  //#endregion
355
1227
  //#region src/vue/components/CollectionEmbedView.vue
356
1228
  var CollectionEmbedView_default = /* @__PURE__ */ defineComponent({
@@ -360,7 +1232,7 @@ var CollectionEmbedView_default = /* @__PURE__ */ defineComponent({
360
1232
  fieldKey: {}
361
1233
  },
362
1234
  setup(__props) {
363
- const { t } = useI18n();
1235
+ const { t } = useCollectionI18n();
364
1236
  return (_ctx, _cache) => {
365
1237
  const _component_router_link = resolveComponent("router-link");
366
1238
  return __props.view.found ? (openBlock(), createBlock(_component_router_link, {
@@ -374,15 +1246,15 @@ var CollectionEmbedView_default = /* @__PURE__ */ defineComponent({
374
1246
  }, {
375
1247
  default: withCtx(() => [
376
1248
  _cache[1] || (_cache[1] = createElementVNode("div", { class: "absolute left-0 top-0 bottom-0 w-1 bg-indigo-500 rounded-l-xl transition-all duration-300 group-hover:w-1.5 group-hover:bg-indigo-600" }, null, -1)),
377
- createElementVNode("div", _hoisted_1$4, [createElementVNode("div", _hoisted_2$4, [_cache[0] || (_cache[0] = createElementVNode("span", { class: "material-icons text-sm" }, "link", -1)), createElementVNode("span", null, toDisplayString(__props.view.targetSlug), 1)]), createElementVNode("span", _hoisted_3$4, toDisplayString(__props.view.recordId), 1)]),
378
- createElementVNode("div", _hoisted_4$4, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.view.rows, (row) => {
1249
+ createElementVNode("div", _hoisted_1$9, [createElementVNode("div", _hoisted_2$9, [_cache[0] || (_cache[0] = createElementVNode("span", { class: "material-icons text-sm" }, "link", -1)), createElementVNode("span", null, toDisplayString(__props.view.targetSlug), 1)]), createElementVNode("span", _hoisted_3$9, toDisplayString(__props.view.recordId), 1)]),
1250
+ createElementVNode("div", _hoisted_4$9, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.view.rows, (row) => {
379
1251
  return openBlock(), createElementBlock("div", {
380
1252
  key: row.key,
381
1253
  class: "space-y-0.5"
382
- }, [createElementVNode("div", _hoisted_5$4, toDisplayString(row.label), 1), createElementVNode("div", {
1254
+ }, [createElementVNode("div", _hoisted_5$8, toDisplayString(row.label), 1), createElementVNode("div", {
383
1255
  class: "text-xs text-slate-700 font-medium break-words",
384
1256
  "data-testid": `collections-embed-${__props.fieldKey}-${row.key}`
385
- }, [row.type === "boolean" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [row.value === true ? (openBlock(), createElementBlock("span", _hoisted_7$4, "check_circle")) : (openBlock(), createElementBlock("span", _hoisted_8$4, "—"))], 64)) : row.type === "markdown" ? (openBlock(), createElementBlock("p", _hoisted_9$4, toDisplayString(row.display), 1)) : (openBlock(), createElementBlock("span", _hoisted_10$4, toDisplayString(row.display), 1))], 8, _hoisted_6$4)]);
1257
+ }, [row.type === "boolean" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [row.value === true ? (openBlock(), createElementBlock("span", _hoisted_7$8, "check_circle")) : (openBlock(), createElementBlock("span", _hoisted_8$8, "—"))], 64)) : row.type === "markdown" ? (openBlock(), createElementBlock("p", _hoisted_9$8, toDisplayString(row.display), 1)) : (openBlock(), createElementBlock("span", _hoisted_10$8, toDisplayString(row.display), 1))], 8, _hoisted_6$8)]);
386
1258
  }), 128))])
387
1259
  ]),
388
1260
  _: 1
@@ -390,15 +1262,15 @@ var CollectionEmbedView_default = /* @__PURE__ */ defineComponent({
390
1262
  key: 1,
391
1263
  class: "relative rounded-xl border border-red-100 bg-red-50/30 p-4 pl-5 shadow-sm",
392
1264
  "data-testid": `collections-embed-${__props.fieldKey}`
393
- }, [_cache[4] || (_cache[4] = createElementVNode("div", { class: "absolute left-0 top-0 bottom-0 w-1 bg-red-400 rounded-l-xl" }, null, -1)), createElementVNode("div", _hoisted_12$3, [_cache[3] || (_cache[3] = createElementVNode("span", { class: "material-icons text-red-500 text-lg mt-0.5" }, "error_outline", -1)), createElementVNode("div", _hoisted_13$3, [
394
- createElementVNode("p", _hoisted_14$2, toDisplayString(unref(t)("collectionsView.embedMissingTitle")), 1),
1265
+ }, [_cache[4] || (_cache[4] = createElementVNode("div", { class: "absolute left-0 top-0 bottom-0 w-1 bg-red-400 rounded-l-xl" }, null, -1)), createElementVNode("div", _hoisted_12$7, [_cache[3] || (_cache[3] = createElementVNode("span", { class: "material-icons text-red-500 text-lg mt-0.5" }, "error_outline", -1)), createElementVNode("div", _hoisted_13$6, [
1266
+ createElementVNode("p", _hoisted_14$5, toDisplayString(unref(t)("collectionsView.embedMissingTitle")), 1),
395
1267
  createElementVNode("p", {
396
1268
  class: "text-xs text-red-600",
397
1269
  "data-testid": `collections-embed-missing-${__props.fieldKey}`
398
1270
  }, toDisplayString(unref(t)("collectionsView.embedMissing", {
399
1271
  collection: __props.view.targetSlug,
400
1272
  id: __props.view.recordId
401
- })), 9, _hoisted_15$2),
1273
+ })), 9, _hoisted_15$5),
402
1274
  __props.view.targetSlug ? (openBlock(), createBlock(_component_router_link, {
403
1275
  key: 0,
404
1276
  to: { path: `/collections/${__props.view.targetSlug}` },
@@ -407,40 +1279,40 @@ var CollectionEmbedView_default = /* @__PURE__ */ defineComponent({
407
1279
  default: withCtx(() => [createElementVNode("span", null, toDisplayString(unref(t)("collectionsView.embedCreate")), 1), _cache[2] || (_cache[2] = createElementVNode("span", { class: "material-icons text-xs" }, "arrow_forward", -1))]),
408
1280
  _: 1
409
1281
  }, 8, ["to"])) : createCommentVNode("", true)
410
- ])])], 8, _hoisted_11$4));
1282
+ ])])], 8, _hoisted_11$8));
411
1283
  };
412
1284
  }
413
1285
  });
414
1286
  //#endregion
415
1287
  //#region src/vue/components/CollectionCalendarView.vue?vue&type=script&setup=true&lang.ts
416
- var _hoisted_1$3 = {
1288
+ var _hoisted_1$8 = {
417
1289
  class: "flex flex-col gap-3",
418
1290
  "data-testid": "collection-calendar"
419
1291
  };
420
- var _hoisted_2$3 = { class: "flex items-center gap-2" };
421
- var _hoisted_3$3 = ["aria-label"];
422
- var _hoisted_4$3 = ["aria-label"];
423
- var _hoisted_5$3 = {
1292
+ var _hoisted_2$8 = { class: "flex items-center gap-2" };
1293
+ var _hoisted_3$8 = ["aria-label"];
1294
+ var _hoisted_4$8 = ["aria-label"];
1295
+ var _hoisted_5$7 = {
424
1296
  class: "text-sm font-bold text-slate-800 flex-1",
425
1297
  "data-testid": "collection-calendar-month"
426
1298
  };
427
- var _hoisted_6$3 = { class: "grid grid-cols-7 gap-1 text-[10px] font-bold text-slate-400 uppercase tracking-wider select-none" };
428
- var _hoisted_7$3 = { class: "grid grid-cols-7 gap-1" };
429
- var _hoisted_8$3 = [
1299
+ var _hoisted_6$7 = { class: "grid grid-cols-7 gap-1 text-[10px] font-bold text-slate-400 uppercase tracking-wider select-none" };
1300
+ var _hoisted_7$7 = { class: "grid grid-cols-7 gap-1" };
1301
+ var _hoisted_8$7 = [
430
1302
  "aria-label",
431
1303
  "data-testid",
432
1304
  "onClick",
433
1305
  "onKeydown"
434
1306
  ];
435
- var _hoisted_9$3 = { class: "flex items-center justify-end" };
436
- var _hoisted_10$3 = ["data-testid", "onClick"];
437
- var _hoisted_11$3 = {
1307
+ var _hoisted_9$7 = { class: "flex items-center justify-end" };
1308
+ var _hoisted_10$7 = ["data-testid", "onClick"];
1309
+ var _hoisted_11$7 = {
438
1310
  key: 0,
439
1311
  class: "flex flex-wrap items-center gap-1.5 pt-1",
440
1312
  "data-testid": "collection-calendar-no-date"
441
1313
  };
442
- var _hoisted_12$2 = { class: "text-[10px] font-bold text-slate-400 uppercase tracking-wider mr-1" };
443
- var _hoisted_13$2 = ["data-testid", "onClick"];
1314
+ var _hoisted_12$6 = { class: "text-[10px] font-bold text-slate-400 uppercase tracking-wider mr-1" };
1315
+ var _hoisted_13$5 = ["data-testid", "onClick"];
444
1316
  /** Sort key for ordering a day's chips by start time: earliest first, with
445
1317
  * clock-less all-day records sinking to the bottom (matching the day view). */
446
1318
  var DAY_CHIP_DEFAULT = "bg-indigo-50 text-indigo-700 border-indigo-100 hover:bg-indigo-100";
@@ -462,7 +1334,7 @@ var CollectionCalendarView_default = /* @__PURE__ */ defineComponent({
462
1334
  setup(__props, { emit: __emit }) {
463
1335
  const props = __props;
464
1336
  const emit = __emit;
465
- const { t, locale } = useI18n();
1337
+ const { t, locale } = useCollectionI18n();
466
1338
  const now = /* @__PURE__ */ new Date();
467
1339
  const viewYear = ref(now.getFullYear());
468
1340
  const viewMonth = ref(now.getMonth() + 1);
@@ -554,23 +1426,23 @@ var CollectionCalendarView_default = /* @__PURE__ */ defineComponent({
554
1426
  viewMonth.value = now.getMonth() + 1;
555
1427
  }
556
1428
  return (_ctx, _cache) => {
557
- return openBlock(), createElementBlock("div", _hoisted_1$3, [
558
- createElementVNode("div", _hoisted_2$3, [
1429
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
1430
+ createElementVNode("div", _hoisted_2$8, [
559
1431
  createElementVNode("button", {
560
1432
  type: "button",
561
1433
  class: "h-8 w-8 flex items-center justify-center rounded text-slate-500 hover:bg-slate-100 transition-colors",
562
1434
  "aria-label": unref(t)("collectionsView.calendarPrevMonth"),
563
1435
  "data-testid": "collection-calendar-prev",
564
1436
  onClick: _cache[0] || (_cache[0] = ($event) => stepMonth(-1))
565
- }, [..._cache[2] || (_cache[2] = [createElementVNode("span", { class: "material-icons text-lg" }, "chevron_left", -1)])], 8, _hoisted_3$3),
1437
+ }, [..._cache[2] || (_cache[2] = [createElementVNode("span", { class: "material-icons text-lg" }, "chevron_left", -1)])], 8, _hoisted_3$8),
566
1438
  createElementVNode("button", {
567
1439
  type: "button",
568
1440
  class: "h-8 w-8 flex items-center justify-center rounded text-slate-500 hover:bg-slate-100 transition-colors",
569
1441
  "aria-label": unref(t)("collectionsView.calendarNextMonth"),
570
1442
  "data-testid": "collection-calendar-next",
571
1443
  onClick: _cache[1] || (_cache[1] = ($event) => stepMonth(1))
572
- }, [..._cache[3] || (_cache[3] = [createElementVNode("span", { class: "material-icons text-lg" }, "chevron_right", -1)])], 8, _hoisted_4$3),
573
- createElementVNode("h3", _hoisted_5$3, toDisplayString(monthLabel.value), 1),
1444
+ }, [..._cache[3] || (_cache[3] = [createElementVNode("span", { class: "material-icons text-lg" }, "chevron_right", -1)])], 8, _hoisted_4$8),
1445
+ createElementVNode("h3", _hoisted_5$7, toDisplayString(monthLabel.value), 1),
574
1446
  createElementVNode("button", {
575
1447
  type: "button",
576
1448
  class: "h-8 px-2.5 flex items-center gap-1 rounded border border-slate-200 bg-white text-slate-600 hover:bg-slate-50 text-xs font-bold transition-colors",
@@ -578,13 +1450,13 @@ var CollectionCalendarView_default = /* @__PURE__ */ defineComponent({
578
1450
  onClick: goToday
579
1451
  }, toDisplayString(unref(t)("collectionsView.calendarToday")), 1)
580
1452
  ]),
581
- createElementVNode("div", _hoisted_6$3, [(openBlock(true), createElementBlock(Fragment, null, renderList(weekdayLabels.value, (label, idx) => {
1453
+ createElementVNode("div", _hoisted_6$7, [(openBlock(true), createElementBlock(Fragment, null, renderList(weekdayLabels.value, (label, idx) => {
582
1454
  return openBlock(), createElementBlock("div", {
583
1455
  key: idx,
584
1456
  class: "px-1 py-1 text-center"
585
1457
  }, toDisplayString(label), 1);
586
1458
  }), 128))]),
587
- createElementVNode("div", _hoisted_7$3, [(openBlock(true), createElementBlock(Fragment, null, renderList(cells.value, ({ cell, entries }) => {
1459
+ createElementVNode("div", _hoisted_7$7, [(openBlock(true), createElementBlock(Fragment, null, renderList(cells.value, ({ cell, entries }) => {
588
1460
  return openBlock(), createElementBlock("div", {
589
1461
  key: cell.key,
590
1462
  class: normalizeClass(["min-h-[5.5rem] rounded-lg border p-1 flex flex-col gap-1 overflow-hidden transition-colors cursor-pointer hover:border-indigo-300 focus:outline-none focus:ring-2 focus:ring-indigo-500/30", cell.inMonth ? "bg-white border-slate-200" : "bg-slate-50/50 border-slate-100"]),
@@ -594,24 +1466,24 @@ var CollectionCalendarView_default = /* @__PURE__ */ defineComponent({
594
1466
  "data-testid": `collection-calendar-day-${cell.key}`,
595
1467
  onClick: ($event) => emit("openDay", cell.ymd),
596
1468
  onKeydown: [withKeys(withModifiers(($event) => emit("openDay", cell.ymd), ["self", "prevent"]), ["enter"]), withKeys(withModifiers(($event) => emit("openDay", cell.ymd), ["self", "prevent"]), ["space"])]
597
- }, [createElementVNode("div", _hoisted_9$3, [createElementVNode("span", { class: normalizeClass(["text-[11px] font-bold h-5 min-w-5 px-1 inline-flex items-center justify-center rounded-full", cell.key === unref(todayKey) ? "bg-indigo-600 text-white" : cell.inMonth ? "text-slate-500" : "text-slate-300"]) }, toDisplayString(cell.ymd.day), 3)]), (openBlock(true), createElementBlock(Fragment, null, renderList(entries, (entry) => {
1469
+ }, [createElementVNode("div", _hoisted_9$7, [createElementVNode("span", { class: normalizeClass(["text-[11px] font-bold h-5 min-w-5 px-1 inline-flex items-center justify-center rounded-full", cell.key === unref(todayKey) ? "bg-indigo-600 text-white" : cell.inMonth ? "text-slate-500" : "text-slate-300"]) }, toDisplayString(cell.ymd.day), 3)]), (openBlock(true), createElementBlock(Fragment, null, renderList(entries, (entry) => {
598
1470
  return openBlock(), createElementBlock("button", {
599
1471
  key: entry.id,
600
1472
  type: "button",
601
1473
  class: normalizeClass(["text-left text-[11px] leading-tight font-semibold truncate rounded px-1.5 py-0.5 border transition-colors", chipClass(entry, DAY_CHIP_DEFAULT)]),
602
1474
  "data-testid": `collection-calendar-chip-${entry.id}`,
603
1475
  onClick: withModifiers(($event) => emit("select", entry.id), ["stop"])
604
- }, toDisplayString(entry.label), 11, _hoisted_10$3);
605
- }), 128))], 42, _hoisted_8$3);
1476
+ }, toDisplayString(entry.label), 11, _hoisted_10$7);
1477
+ }), 128))], 42, _hoisted_8$7);
606
1478
  }), 128))]),
607
- bucketed.value.noDate.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_11$3, [createElementVNode("span", _hoisted_12$2, toDisplayString(unref(t)("collectionsView.calendarNoDate")), 1), (openBlock(true), createElementBlock(Fragment, null, renderList(undatedEntries.value, (entry) => {
1479
+ bucketed.value.noDate.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_11$7, [createElementVNode("span", _hoisted_12$6, toDisplayString(unref(t)("collectionsView.calendarNoDate")), 1), (openBlock(true), createElementBlock(Fragment, null, renderList(undatedEntries.value, (entry) => {
608
1480
  return openBlock(), createElementBlock("button", {
609
1481
  key: entry.id,
610
1482
  type: "button",
611
1483
  class: normalizeClass(["text-[11px] font-semibold truncate rounded px-1.5 py-0.5 border transition-colors", chipClass(entry, UNDATED_CHIP_DEFAULT)]),
612
1484
  "data-testid": `collection-calendar-undated-${entry.id}`,
613
1485
  onClick: ($event) => emit("select", entry.id)
614
- }, toDisplayString(entry.label), 11, _hoisted_13$2);
1486
+ }, toDisplayString(entry.label), 11, _hoisted_13$5);
615
1487
  }), 128))])) : createCommentVNode("", true)
616
1488
  ]);
617
1489
  };
@@ -619,40 +1491,40 @@ var CollectionCalendarView_default = /* @__PURE__ */ defineComponent({
619
1491
  });
620
1492
  //#endregion
621
1493
  //#region src/vue/components/CollectionDayView.vue?vue&type=script&setup=true&lang.ts
622
- var _hoisted_1$2 = { class: "flex items-center gap-2 border-b border-slate-200 px-4 py-3" };
623
- var _hoisted_2$2 = {
1494
+ var _hoisted_1$7 = { class: "flex items-center gap-2 border-b border-slate-200 px-4 py-3" };
1495
+ var _hoisted_2$7 = {
624
1496
  class: "flex-1 text-sm font-bold text-slate-800",
625
1497
  "data-testid": "collection-day-view-title"
626
1498
  };
627
- var _hoisted_3$2 = ["aria-label"];
628
- var _hoisted_4$2 = ["aria-label"];
629
- var _hoisted_5$2 = {
1499
+ var _hoisted_3$7 = ["aria-label"];
1500
+ var _hoisted_4$7 = ["aria-label"];
1501
+ var _hoisted_5$6 = {
630
1502
  key: 0,
631
1503
  class: "px-4 py-10 text-center text-sm text-slate-400"
632
1504
  };
633
- var _hoisted_6$2 = { class: "absolute -top-2 left-0 w-10 pr-1 text-right text-[10px] tabular-nums text-slate-400" };
634
- var _hoisted_7$2 = {
1505
+ var _hoisted_6$6 = { class: "absolute -top-2 left-0 w-10 pr-1 text-right text-[10px] tabular-nums text-slate-400" };
1506
+ var _hoisted_7$6 = {
635
1507
  class: "absolute inset-y-0 right-0",
636
1508
  style: { "left": "2.75rem" }
637
1509
  };
638
- var _hoisted_8$2 = ["data-testid", "onClick"];
639
- var _hoisted_9$2 = { class: "block truncate text-[11px] font-semibold leading-tight" };
640
- var _hoisted_10$2 = {
1510
+ var _hoisted_8$6 = ["data-testid", "onClick"];
1511
+ var _hoisted_9$6 = { class: "block truncate text-[11px] font-semibold leading-tight" };
1512
+ var _hoisted_10$6 = {
641
1513
  key: 0,
642
1514
  "aria-hidden": "true"
643
1515
  };
644
- var _hoisted_11$2 = {
1516
+ var _hoisted_11$6 = {
645
1517
  key: 1,
646
1518
  "aria-hidden": "true"
647
1519
  };
648
- var _hoisted_12$1 = {
1520
+ var _hoisted_12$5 = {
649
1521
  key: 2,
650
1522
  class: "flex flex-wrap items-center gap-1.5 border-t border-slate-200 px-4 py-2",
651
1523
  "data-testid": "collection-day-view-all-day"
652
1524
  };
653
- var _hoisted_13$1 = { class: "mr-1 text-[10px] font-bold uppercase tracking-wider text-slate-400" };
654
- var _hoisted_14$1 = ["data-testid", "onClick"];
655
- var _hoisted_15$1 = {
1525
+ var _hoisted_13$4 = { class: "mr-1 text-[10px] font-bold uppercase tracking-wider text-slate-400" };
1526
+ var _hoisted_14$4 = ["data-testid", "onClick"];
1527
+ var _hoisted_15$4 = {
656
1528
  key: 0,
657
1529
  class: "min-w-0 flex-1 overflow-y-auto",
658
1530
  "data-testid": "collection-day-view-detail"
@@ -688,7 +1560,7 @@ var CollectionDayView_default = /* @__PURE__ */ defineComponent({
688
1560
  setup(__props, { emit: __emit }) {
689
1561
  const props = __props;
690
1562
  const emit = __emit;
691
- const { t, locale } = useI18n();
1563
+ const { t, locale } = useCollectionI18n();
692
1564
  const TOTAL_HEIGHT = HOUR_PX * 24;
693
1565
  const PX_PER_MIN = HOUR_PX / 60;
694
1566
  const scrollEl = ref(null);
@@ -811,8 +1683,8 @@ var CollectionDayView_default = /* @__PURE__ */ defineComponent({
811
1683
  role: "dialog",
812
1684
  "aria-modal": "true"
813
1685
  }, [createElementVNode("div", { class: normalizeClass(["flex min-h-0 flex-col", __props.showDetail ? "w-80 shrink-0 border-r border-slate-200" : "w-full"]) }, [
814
- createElementVNode("div", _hoisted_1$2, [
815
- createElementVNode("h3", _hoisted_2$2, toDisplayString(dayLabel.value), 1),
1686
+ createElementVNode("div", _hoisted_1$7, [
1687
+ createElementVNode("h3", _hoisted_2$7, toDisplayString(dayLabel.value), 1),
816
1688
  __props.canCreate ? (openBlock(), createElementBlock("button", {
817
1689
  key: 0,
818
1690
  type: "button",
@@ -820,16 +1692,16 @@ var CollectionDayView_default = /* @__PURE__ */ defineComponent({
820
1692
  "aria-label": unref(t)("collectionsView.calendarCreateOn", { date: dayKey.value }),
821
1693
  "data-testid": "collection-day-view-create",
822
1694
  onClick: onCreate
823
- }, [..._cache[3] || (_cache[3] = [createElementVNode("span", { class: "material-icons text-lg" }, "add", -1)])], 8, _hoisted_3$2)) : createCommentVNode("", true),
1695
+ }, [..._cache[3] || (_cache[3] = [createElementVNode("span", { class: "material-icons text-lg" }, "add", -1)])], 8, _hoisted_3$7)) : createCommentVNode("", true),
824
1696
  createElementVNode("button", {
825
1697
  type: "button",
826
1698
  class: "h-8 w-8 flex items-center justify-center rounded text-slate-500 hover:bg-slate-100 transition-colors",
827
1699
  "aria-label": unref(t)("collectionsView.dayViewClose"),
828
1700
  "data-testid": "collection-day-view-close",
829
1701
  onClick: _cache[0] || (_cache[0] = ($event) => emit("close"))
830
- }, [..._cache[4] || (_cache[4] = [createElementVNode("span", { class: "material-icons text-lg" }, "close", -1)])], 8, _hoisted_4$2)
1702
+ }, [..._cache[4] || (_cache[4] = [createElementVNode("span", { class: "material-icons text-lg" }, "close", -1)])], 8, _hoisted_4$7)
831
1703
  ]),
832
- timedEntries.value.length === 0 && allDayEntries.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_5$2, toDisplayString(unref(t)("collectionsView.dayViewEmpty")), 1)) : (openBlock(), createElementBlock("div", {
1704
+ timedEntries.value.length === 0 && allDayEntries.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_5$6, toDisplayString(unref(t)("collectionsView.dayViewEmpty")), 1)) : (openBlock(), createElementBlock("div", {
833
1705
  key: 1,
834
1706
  ref_key: "scrollEl",
835
1707
  ref: scrollEl,
@@ -843,8 +1715,8 @@ var CollectionDayView_default = /* @__PURE__ */ defineComponent({
843
1715
  key: hour,
844
1716
  class: "absolute left-0 right-0 border-t border-slate-100",
845
1717
  style: normalizeStyle({ top: `${(hour - 1) * HOUR_PX}px` })
846
- }, [createElementVNode("span", _hoisted_6$2, toDisplayString(hourLabel(hour - 1)), 1)], 4);
847
- }), 64)), createElementVNode("div", _hoisted_7$2, [(openBlock(true), createElementBlock(Fragment, null, renderList(timedEntries.value, (entry) => {
1718
+ }, [createElementVNode("span", _hoisted_6$6, toDisplayString(hourLabel(hour - 1)), 1)], 4);
1719
+ }), 64)), createElementVNode("div", _hoisted_7$6, [(openBlock(true), createElementBlock(Fragment, null, renderList(timedEntries.value, (entry) => {
848
1720
  return openBlock(), createElementBlock("button", {
849
1721
  key: entry.id,
850
1722
  type: "button",
@@ -852,56 +1724,56 @@ var CollectionDayView_default = /* @__PURE__ */ defineComponent({
852
1724
  style: normalizeStyle(entry.style),
853
1725
  "data-testid": `collection-day-view-chip-${entry.id}`,
854
1726
  onClick: ($event) => onSelect(entry.id)
855
- }, [createElementVNode("span", _hoisted_9$2, [
856
- entry.slice.bleedsBefore ? (openBlock(), createElementBlock("span", _hoisted_10$2, "▲ ")) : createCommentVNode("", true),
1727
+ }, [createElementVNode("span", _hoisted_9$6, [
1728
+ entry.slice.bleedsBefore ? (openBlock(), createElementBlock("span", _hoisted_10$6, "▲ ")) : createCommentVNode("", true),
857
1729
  createTextVNode(toDisplayString(entry.label), 1),
858
- entry.slice.bleedsAfter ? (openBlock(), createElementBlock("span", _hoisted_11$2, " ▼")) : createCommentVNode("", true)
1730
+ entry.slice.bleedsAfter ? (openBlock(), createElementBlock("span", _hoisted_11$6, " ▼")) : createCommentVNode("", true)
859
1731
  ]), (openBlock(true), createElementBlock(Fragment, null, renderList(entry.secondary, (text, i) => {
860
1732
  return openBlock(), createElementBlock("span", {
861
1733
  key: i,
862
1734
  class: "block truncate text-[10px] leading-tight opacity-70"
863
1735
  }, toDisplayString(text), 1);
864
- }), 128))], 14, _hoisted_8$2);
1736
+ }), 128))], 14, _hoisted_8$6);
865
1737
  }), 128))])], 4)], 512)),
866
- allDayEntries.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_12$1, [createElementVNode("span", _hoisted_13$1, toDisplayString(unref(t)("collectionsView.dayViewAllDay")), 1), (openBlock(true), createElementBlock(Fragment, null, renderList(allDayEntries.value, (entry) => {
1738
+ allDayEntries.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_12$5, [createElementVNode("span", _hoisted_13$4, toDisplayString(unref(t)("collectionsView.dayViewAllDay")), 1), (openBlock(true), createElementBlock(Fragment, null, renderList(allDayEntries.value, (entry) => {
867
1739
  return openBlock(), createElementBlock("button", {
868
1740
  key: entry.id,
869
1741
  type: "button",
870
1742
  class: normalizeClass(["truncate rounded border px-1.5 py-0.5 text-[11px] font-semibold transition-colors", allDayChipClass(entry)]),
871
1743
  "data-testid": `collection-day-view-allday-${entry.id}`,
872
1744
  onClick: ($event) => onSelect(entry.id)
873
- }, toDisplayString(entry.label), 11, _hoisted_14$1);
1745
+ }, toDisplayString(entry.label), 11, _hoisted_14$4);
874
1746
  }), 128))])) : createCommentVNode("", true)
875
- ], 2), __props.showDetail ? (openBlock(), createElementBlock("div", _hoisted_15$1, [renderSlot(_ctx.$slots, "detail")])) : createCommentVNode("", true)], 2)], 32);
1747
+ ], 2), __props.showDetail ? (openBlock(), createElementBlock("div", _hoisted_15$4, [renderSlot(_ctx.$slots, "detail")])) : createCommentVNode("", true)], 2)], 32);
876
1748
  };
877
1749
  }
878
1750
  });
879
1751
  //#endregion
880
1752
  //#region src/vue/components/CollectionKanbanView.vue?vue&type=script&setup=true&lang.ts
881
- var _hoisted_1$1 = {
1753
+ var _hoisted_1$6 = {
882
1754
  class: "h-full overflow-x-auto overflow-y-hidden",
883
1755
  "data-testid": "collection-kanban"
884
1756
  };
885
- var _hoisted_2$1 = { class: "flex gap-3 h-full p-1 min-w-max" };
886
- var _hoisted_3$1 = ["data-testid"];
887
- var _hoisted_4$1 = { class: "flex items-center justify-between px-3 py-2 border-b border-slate-200" };
888
- var _hoisted_5$1 = { class: "flex items-center gap-2 min-w-0" };
889
- var _hoisted_6$1 = ["title"];
890
- var _hoisted_7$1 = { class: "text-[11px] text-slate-400 shrink-0" };
891
- var _hoisted_8$1 = [
1757
+ var _hoisted_2$6 = { class: "flex gap-3 h-full p-1 min-w-max" };
1758
+ var _hoisted_3$6 = ["data-testid"];
1759
+ var _hoisted_4$6 = { class: "flex items-center justify-between px-3 py-2 border-b border-slate-200" };
1760
+ var _hoisted_5$5 = { class: "flex items-center gap-2 min-w-0" };
1761
+ var _hoisted_6$5 = ["title"];
1762
+ var _hoisted_7$5 = { class: "text-[11px] text-slate-400 shrink-0" };
1763
+ var _hoisted_8$5 = [
892
1764
  "data-testid",
893
1765
  "aria-label",
894
1766
  "onClick",
895
1767
  "onKeydown"
896
1768
  ];
897
- var _hoisted_9$1 = { class: "flex items-start gap-2" };
898
- var _hoisted_10$1 = [
1769
+ var _hoisted_9$5 = { class: "flex items-start gap-2" };
1770
+ var _hoisted_10$5 = [
899
1771
  "checked",
900
1772
  "aria-label",
901
1773
  "data-testid",
902
1774
  "onChange"
903
1775
  ];
904
- var _hoisted_11$1 = { class: "text-sm font-medium text-slate-800 truncate" };
1776
+ var _hoisted_11$5 = { class: "text-sm font-medium text-slate-800 truncate" };
905
1777
  var UNCATEGORIZED = "";
906
1778
  //#endregion
907
1779
  //#region src/vue/components/CollectionKanbanView.vue
@@ -918,7 +1790,7 @@ var CollectionKanbanView_default = /* @__PURE__ */ defineComponent({
918
1790
  setup(__props, { emit: __emit }) {
919
1791
  const props = __props;
920
1792
  const emit = __emit;
921
- const { t } = useI18n();
1793
+ const { t } = useCollectionI18n();
922
1794
  /** The Uncategorized column uses the empty string as its sentinel value. */
923
1795
  const groupSpec = computed(() => props.schema.fields[props.groupField]);
924
1796
  /** Declared enum values become columns in order, with a trailing
@@ -999,15 +1871,15 @@ var CollectionKanbanView_default = /* @__PURE__ */ defineComponent({
999
1871
  emit("move", itemId(item), next);
1000
1872
  }
1001
1873
  return (_ctx, _cache) => {
1002
- return openBlock(), createElementBlock("div", _hoisted_1$1, [createElementVNode("div", _hoisted_2$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(columns.value, (column) => {
1874
+ return openBlock(), createElementBlock("div", _hoisted_1$6, [createElementVNode("div", _hoisted_2$6, [(openBlock(true), createElementBlock(Fragment, null, renderList(columns.value, (column) => {
1003
1875
  return openBlock(), createElementBlock("div", {
1004
1876
  key: column.value,
1005
1877
  "data-testid": `collection-kanban-column-${column.value || "uncategorized"}`,
1006
1878
  class: "w-72 shrink-0 flex flex-col bg-slate-100 rounded-lg"
1007
- }, [createElementVNode("div", _hoisted_4$1, [createElementVNode("div", _hoisted_5$1, [createElementVNode("span", { class: normalizeClass(["w-2 h-2 rounded-full shrink-0", unref(resolveEnumColor)(__props.schema, __props.groupField, column.value).dot]) }, null, 2), createElementVNode("span", {
1879
+ }, [createElementVNode("div", _hoisted_4$6, [createElementVNode("div", _hoisted_5$5, [createElementVNode("span", { class: normalizeClass(["w-2 h-2 rounded-full shrink-0", unref(resolveEnumColor)(__props.schema, __props.groupField, column.value).dot]) }, null, 2), createElementVNode("span", {
1008
1880
  class: "font-semibold text-xs text-slate-600 truncate",
1009
1881
  title: column.label
1010
- }, toDisplayString(column.label), 9, _hoisted_6$1)]), createElementVNode("span", _hoisted_7$1, toDisplayString(itemsByColumn(column.value).length), 1)]), createVNode(unref(draggable), {
1882
+ }, toDisplayString(column.label), 9, _hoisted_6$5)]), createElementVNode("span", _hoisted_7$5, toDisplayString(itemsByColumn(column.value).length), 1)]), createVNode(unref(draggable), {
1011
1883
  "model-value": itemsByColumn(column.value),
1012
1884
  "item-key": __props.schema.primaryKey,
1013
1885
  group: "collection-kanban-cards",
@@ -1023,7 +1895,7 @@ var CollectionKanbanView_default = /* @__PURE__ */ defineComponent({
1023
1895
  class: normalizeClass(["bg-white border border-slate-200 rounded shadow-sm p-2 cursor-grab hover:shadow active:cursor-grabbing focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400", [itemId(element) === __props.selected ? "ring-2 ring-indigo-500 border-indigo-300" : "", notifyAccentClass(element)]]),
1024
1896
  onClick: ($event) => emit("select", itemId(element)),
1025
1897
  onKeydown: [withKeys(withModifiers((e) => !e.repeat && emit("select", itemId(element)), ["prevent", "self"]), ["enter"]), withKeys(withModifiers((e) => !e.repeat && emit("select", itemId(element)), ["prevent", "self"]), ["space"])]
1026
- }, [createElementVNode("div", _hoisted_9$1, [cardToggle.value ? (openBlock(), createElementBlock("input", {
1898
+ }, [createElementVNode("div", _hoisted_9$5, [cardToggle.value ? (openBlock(), createElementBlock("input", {
1027
1899
  key: 0,
1028
1900
  type: "checkbox",
1029
1901
  checked: cardChecked(element),
@@ -1032,124 +1904,124 @@ var CollectionKanbanView_default = /* @__PURE__ */ defineComponent({
1032
1904
  "data-testid": `collection-kanban-toggle-${itemId(element)}`,
1033
1905
  onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"])),
1034
1906
  onChange: ($event) => onCardToggle(element)
1035
- }, null, 40, _hoisted_10$1)) : createCommentVNode("", true), createElementVNode("div", _hoisted_11$1, toDisplayString(itemLabel(element)), 1)])], 42, _hoisted_8$1)]),
1907
+ }, null, 40, _hoisted_10$5)) : createCommentVNode("", true), createElementVNode("div", _hoisted_11$5, toDisplayString(itemLabel(element)), 1)])], 42, _hoisted_8$5)]),
1036
1908
  _: 1
1037
1909
  }, 8, [
1038
1910
  "model-value",
1039
1911
  "item-key",
1040
1912
  "onChange"
1041
- ])], 8, _hoisted_3$1);
1913
+ ])], 8, _hoisted_3$6);
1042
1914
  }), 128))])]);
1043
1915
  };
1044
1916
  }
1045
1917
  });
1046
1918
  //#endregion
1047
1919
  //#region src/vue/components/CollectionRecordPanel.vue?vue&type=script&setup=true&lang.ts
1048
- var _hoisted_1 = { class: "flex items-center gap-2 mb-4" };
1049
- var _hoisted_2 = { class: "flex-1 min-w-0" };
1050
- var _hoisted_3 = { class: "block text-[9px] font-bold text-slate-400 uppercase tracking-wider" };
1051
- var _hoisted_4 = ["data-testid"];
1052
- var _hoisted_5 = ["disabled"];
1053
- var _hoisted_6 = {
1920
+ var _hoisted_1$5 = { class: "flex items-center gap-2 mb-4" };
1921
+ var _hoisted_2$5 = { class: "flex-1 min-w-0" };
1922
+ var _hoisted_3$5 = { class: "block text-[9px] font-bold text-slate-400 uppercase tracking-wider" };
1923
+ var _hoisted_4$5 = ["data-testid"];
1924
+ var _hoisted_5$4 = ["disabled"];
1925
+ var _hoisted_6$4 = {
1054
1926
  key: 1,
1055
1927
  class: "flex items-center gap-2"
1056
1928
  };
1057
- var _hoisted_7 = [
1929
+ var _hoisted_7$4 = [
1058
1930
  "disabled",
1059
1931
  "data-testid",
1060
1932
  "onClick"
1061
1933
  ];
1062
- var _hoisted_8 = {
1934
+ var _hoisted_8$4 = {
1063
1935
  key: 0,
1064
1936
  class: "material-icons text-sm"
1065
1937
  };
1066
- var _hoisted_9 = ["aria-label"];
1067
- var _hoisted_10 = {
1938
+ var _hoisted_9$4 = ["aria-label"];
1939
+ var _hoisted_10$4 = {
1068
1940
  key: 0,
1069
1941
  class: "mb-3 text-xs font-semibold text-red-600 bg-red-50 border border-red-100 p-2.5 rounded-xl shadow-sm",
1070
1942
  "data-testid": "collections-detail-action-error"
1071
1943
  };
1072
- var _hoisted_11 = { class: "grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-4 bg-white rounded-2xl border border-slate-200/60 p-6 shadow-sm" };
1073
- var _hoisted_12 = ["for"];
1074
- var _hoisted_13 = {
1944
+ var _hoisted_11$4 = { class: "grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-4 bg-white rounded-2xl border border-slate-200/60 p-6 shadow-sm" };
1945
+ var _hoisted_12$4 = ["for"];
1946
+ var _hoisted_13$3 = {
1075
1947
  key: 0,
1076
1948
  class: "text-rose-500 font-bold"
1077
1949
  };
1078
- var _hoisted_14 = {
1950
+ var _hoisted_14$3 = {
1079
1951
  key: 0,
1080
1952
  class: "inline-flex items-center gap-2.5 text-sm text-slate-700 cursor-pointer select-none"
1081
1953
  };
1082
- var _hoisted_15 = [
1954
+ var _hoisted_15$3 = [
1083
1955
  "id",
1084
1956
  "onUpdate:modelValue",
1085
1957
  "data-testid",
1086
1958
  "onChange"
1087
1959
  ];
1088
- var _hoisted_16 = [
1960
+ var _hoisted_16$2 = [
1089
1961
  "id",
1090
1962
  "onUpdate:modelValue",
1091
1963
  "required",
1092
1964
  "data-testid"
1093
1965
  ];
1094
- var _hoisted_17 = { value: "" };
1095
- var _hoisted_18 = ["value"];
1096
- var _hoisted_19 = [
1966
+ var _hoisted_17$2 = { value: "" };
1967
+ var _hoisted_18$2 = ["value"];
1968
+ var _hoisted_19$2 = [
1097
1969
  "id",
1098
1970
  "onUpdate:modelValue",
1099
1971
  "required",
1100
1972
  "data-testid"
1101
1973
  ];
1102
- var _hoisted_20 = { value: "" };
1103
- var _hoisted_21 = ["value"];
1104
- var _hoisted_22 = ["data-testid"];
1105
- var _hoisted_23 = {
1974
+ var _hoisted_20$2 = { value: "" };
1975
+ var _hoisted_21$2 = ["value"];
1976
+ var _hoisted_22$2 = ["data-testid"];
1977
+ var _hoisted_23$2 = {
1106
1978
  key: 0,
1107
1979
  class: "overflow-hidden border border-slate-200 rounded-lg shadow-sm"
1108
1980
  };
1109
- var _hoisted_24 = { class: "w-full text-xs text-slate-600 bg-white" };
1110
- var _hoisted_25 = { class: "bg-slate-50 border-b border-slate-200 text-slate-500 font-bold uppercase tracking-wider" };
1111
- var _hoisted_26 = { class: "divide-y divide-slate-100" };
1112
- var _hoisted_27 = ["onUpdate:modelValue", "onChange"];
1113
- var _hoisted_28 = ["onUpdate:modelValue", "required"];
1114
- var _hoisted_29 = { value: "" };
1115
- var _hoisted_30 = ["value"];
1116
- var _hoisted_31 = ["onUpdate:modelValue", "required"];
1117
- var _hoisted_32 = { value: "" };
1118
- var _hoisted_33 = ["value"];
1119
- var _hoisted_34 = {
1981
+ var _hoisted_24$1 = { class: "w-full text-xs text-slate-600 bg-white" };
1982
+ var _hoisted_25$1 = { class: "bg-slate-50 border-b border-slate-200 text-slate-500 font-bold uppercase tracking-wider" };
1983
+ var _hoisted_26$1 = { class: "divide-y divide-slate-100" };
1984
+ var _hoisted_27$1 = ["onUpdate:modelValue", "onChange"];
1985
+ var _hoisted_28$1 = ["onUpdate:modelValue", "required"];
1986
+ var _hoisted_29$1 = { value: "" };
1987
+ var _hoisted_30$1 = ["value"];
1988
+ var _hoisted_31$1 = ["onUpdate:modelValue", "required"];
1989
+ var _hoisted_32$1 = { value: "" };
1990
+ var _hoisted_33$1 = ["value"];
1991
+ var _hoisted_34$1 = {
1120
1992
  key: 3,
1121
1993
  class: "relative flex items-center"
1122
1994
  };
1123
- var _hoisted_35 = { class: "absolute left-1.5 text-[10px] text-slate-400 font-bold pr-1 border-r border-slate-200" };
1124
- var _hoisted_36 = ["onUpdate:modelValue", "required"];
1125
- var _hoisted_37 = [
1995
+ var _hoisted_35$1 = { class: "absolute left-1.5 text-[10px] text-slate-400 font-bold pr-1 border-r border-slate-200" };
1996
+ var _hoisted_36$1 = ["onUpdate:modelValue", "required"];
1997
+ var _hoisted_37$1 = [
1126
1998
  "onUpdate:modelValue",
1127
1999
  "type",
1128
2000
  "required"
1129
2001
  ];
1130
- var _hoisted_38 = { class: "text-center px-1" };
1131
- var _hoisted_39 = [
2002
+ var _hoisted_38$1 = { class: "text-center px-1" };
2003
+ var _hoisted_39$1 = [
1132
2004
  "aria-label",
1133
2005
  "data-testid",
1134
2006
  "onClick"
1135
2007
  ];
1136
- var _hoisted_40 = {
2008
+ var _hoisted_40$1 = {
1137
2009
  key: 1,
1138
2010
  class: "text-xs text-slate-400 italic"
1139
2011
  };
1140
- var _hoisted_41 = ["data-testid", "onClick"];
1141
- var _hoisted_42 = {
2012
+ var _hoisted_41$1 = ["data-testid", "onClick"];
2013
+ var _hoisted_42$1 = {
1142
2014
  key: 4,
1143
2015
  class: "relative flex items-center"
1144
2016
  };
1145
- var _hoisted_43 = { class: "absolute left-3 text-slate-400 font-bold text-xs select-none pr-1.5 border-r border-slate-200" };
1146
- var _hoisted_44 = [
2017
+ var _hoisted_43$1 = { class: "absolute left-3 text-slate-400 font-bold text-xs select-none pr-1.5 border-r border-slate-200" };
2018
+ var _hoisted_44$1 = [
1147
2019
  "id",
1148
2020
  "onUpdate:modelValue",
1149
2021
  "required",
1150
2022
  "data-testid"
1151
2023
  ];
1152
- var _hoisted_45 = [
2024
+ var _hoisted_45$1 = [
1153
2025
  "id",
1154
2026
  "onUpdate:modelValue",
1155
2027
  "type",
@@ -1157,77 +2029,77 @@ var _hoisted_45 = [
1157
2029
  "disabled",
1158
2030
  "data-testid"
1159
2031
  ];
1160
- var _hoisted_46 = [
2032
+ var _hoisted_46$1 = [
1161
2033
  "id",
1162
2034
  "onUpdate:modelValue",
1163
2035
  "rows",
1164
2036
  "required",
1165
2037
  "data-testid"
1166
2038
  ];
1167
- var _hoisted_47 = ["data-testid"];
1168
- var _hoisted_48 = {
2039
+ var _hoisted_47$1 = ["data-testid"];
2040
+ var _hoisted_48$1 = {
1169
2041
  key: 0,
1170
2042
  class: "inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-semibold bg-emerald-50 text-emerald-700 border border-emerald-200/40"
1171
2043
  };
1172
- var _hoisted_49 = {
2044
+ var _hoisted_49$1 = {
1173
2045
  key: 1,
1174
2046
  class: "inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-semibold bg-slate-50 text-slate-400 border border-slate-200/20"
1175
2047
  };
1176
- var _hoisted_50 = {
2048
+ var _hoisted_50$1 = {
1177
2049
  key: 0,
1178
2050
  class: "inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-semibold bg-emerald-50 text-emerald-700 border border-emerald-200/40"
1179
2051
  };
1180
- var _hoisted_51 = {
2052
+ var _hoisted_51$1 = {
1181
2053
  key: 1,
1182
2054
  class: "inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-semibold bg-slate-50 text-slate-400 border border-slate-200/20"
1183
2055
  };
1184
- var _hoisted_52 = {
2056
+ var _hoisted_52$1 = {
1185
2057
  key: 2,
1186
2058
  class: "text-slate-300"
1187
2059
  };
1188
- var _hoisted_53 = {
2060
+ var _hoisted_53$1 = {
1189
2061
  key: 3,
1190
2062
  class: "font-semibold text-slate-900 tabular-nums text-sm"
1191
2063
  };
1192
- var _hoisted_54 = {
2064
+ var _hoisted_54$1 = {
1193
2065
  key: 4,
1194
2066
  class: "inline-block truncate tabular-nums font-bold text-indigo-900 bg-indigo-50/50 px-2 py-0.5 rounded border border-indigo-100/50"
1195
2067
  };
1196
- var _hoisted_55 = {
2068
+ var _hoisted_55$1 = {
1197
2069
  key: 5,
1198
2070
  class: "border border-slate-200/80 rounded-xl overflow-hidden shadow-sm mt-1"
1199
2071
  };
1200
- var _hoisted_56 = { class: "w-full text-[11px] text-slate-600 bg-white" };
1201
- var _hoisted_57 = { class: "bg-slate-50 border-b border-slate-200 text-slate-500 font-bold uppercase tracking-wider" };
1202
- var _hoisted_58 = { class: "divide-y divide-slate-100" };
1203
- var _hoisted_59 = {
2072
+ var _hoisted_56$1 = { class: "w-full text-[11px] text-slate-600 bg-white" };
2073
+ var _hoisted_57$1 = { class: "bg-slate-50 border-b border-slate-200 text-slate-500 font-bold uppercase tracking-wider" };
2074
+ var _hoisted_58$1 = { class: "divide-y divide-slate-100" };
2075
+ var _hoisted_59$1 = {
1204
2076
  key: 0,
1205
2077
  class: "material-icons text-emerald-600 text-base"
1206
2078
  };
1207
- var _hoisted_60 = {
2079
+ var _hoisted_60$1 = {
1208
2080
  key: 1,
1209
2081
  class: "text-slate-300"
1210
2082
  };
1211
- var _hoisted_61 = {
2083
+ var _hoisted_61$1 = {
1212
2084
  key: 6,
1213
2085
  class: "text-slate-400 italic"
1214
2086
  };
1215
- var _hoisted_62 = {
2087
+ var _hoisted_62$1 = {
1216
2088
  key: 7,
1217
2089
  class: "bg-slate-50 rounded-xl p-4 border border-slate-200/60 text-slate-600 text-xs whitespace-pre-wrap leading-relaxed max-h-[30vh] overflow-y-auto"
1218
2090
  };
1219
- var _hoisted_63 = [
2091
+ var _hoisted_63$1 = [
1220
2092
  "src",
1221
2093
  "alt",
1222
2094
  "data-testid"
1223
2095
  ];
1224
- var _hoisted_64 = ["href", "data-testid"];
1225
- var _hoisted_65 = ["href", "data-testid"];
1226
- var _hoisted_66 = {
2096
+ var _hoisted_64$1 = ["href", "data-testid"];
2097
+ var _hoisted_65$1 = ["href", "data-testid"];
2098
+ var _hoisted_66$1 = {
1227
2099
  key: 13,
1228
2100
  class: "text-slate-800 font-semibold"
1229
2101
  };
1230
- var _hoisted_67 = {
2102
+ var _hoisted_67$1 = {
1231
2103
  key: 0,
1232
2104
  class: "col-span-full text-xs font-semibold text-red-600 bg-red-50 border border-red-100 p-2.5 rounded-xl"
1233
2105
  };
@@ -1266,7 +2138,7 @@ var CollectionRecordPanel_default = /* @__PURE__ */ defineComponent({
1266
2138
  const props = __props;
1267
2139
  const editing = useModel(__props, "editing");
1268
2140
  const emit = __emit;
1269
- const { t } = useI18n();
2141
+ const { t } = useCollectionI18n();
1270
2142
  const embedViews = computed(() => props.render.embedViews.value);
1271
2143
  /** The record the read-only displays render from: the live draft while
1272
2144
  * editing (so non-editable cells like derived/embed preview the in-flight
@@ -1349,10 +2221,10 @@ var CollectionRecordPanel_default = /* @__PURE__ */ defineComponent({
1349
2221
  onSubmit: _cache[4] || (_cache[4] = withModifiers(($event) => emit("submit"), ["prevent"]))
1350
2222
  }, {
1351
2223
  default: withCtx(() => [
1352
- createElementVNode("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("span", _hoisted_3, toDisplayString(__props.collection.title), 1), createElementVNode("h2", {
2224
+ createElementVNode("div", _hoisted_1$5, [createElementVNode("div", _hoisted_2$5, [createElementVNode("span", _hoisted_3$5, toDisplayString(__props.collection.title), 1), createElementVNode("h2", {
1353
2225
  class: "text-base font-bold text-slate-800 truncate",
1354
2226
  "data-testid": editing.value ? "collections-edit-title" : "collections-detail-title"
1355
- }, toDisplayString(headerTitle.value), 9, _hoisted_4)]), editing.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("button", {
2227
+ }, toDisplayString(headerTitle.value), 9, _hoisted_4$5)]), editing.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("button", {
1356
2228
  type: "button",
1357
2229
  class: "h-8 px-2.5 rounded text-xs font-bold text-slate-500 hover:bg-slate-200/50 transition-colors",
1358
2230
  "data-testid": "collections-editor-cancel",
@@ -1362,7 +2234,7 @@ var CollectionRecordPanel_default = /* @__PURE__ */ defineComponent({
1362
2234
  class: "h-8 px-2.5 rounded bg-indigo-600 text-white font-bold text-xs hover:bg-indigo-700 disabled:opacity-50 transition-all shadow-sm shadow-indigo-600/10",
1363
2235
  disabled: __props.saving,
1364
2236
  "data-testid": "collections-editor-save"
1365
- }, toDisplayString(__props.saving ? unref(t)("common.saving") : unref(t)("common.save")), 9, _hoisted_5)], 64)) : (openBlock(), createElementBlock("div", _hoisted_6, [
2237
+ }, toDisplayString(__props.saving ? unref(t)("common.saving") : unref(t)("common.save")), 9, _hoisted_5$4)], 64)) : (openBlock(), createElementBlock("div", _hoisted_6$4, [
1366
2238
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.visibleActions, (action) => {
1367
2239
  return openBlock(), createElementBlock("button", {
1368
2240
  key: action.id,
@@ -1371,7 +2243,7 @@ var CollectionRecordPanel_default = /* @__PURE__ */ defineComponent({
1371
2243
  disabled: __props.actionPending,
1372
2244
  "data-testid": `collections-detail-action-${action.id}`,
1373
2245
  onClick: ($event) => emit("runAction", action)
1374
- }, [action.icon ? (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString(action.icon), 1)) : createCommentVNode("", true), createElementVNode("span", null, toDisplayString(action.label), 1)], 8, _hoisted_7);
2246
+ }, [action.icon ? (openBlock(), createElementBlock("span", _hoisted_8$4, toDisplayString(action.icon), 1)) : createCommentVNode("", true), createElementVNode("span", null, toDisplayString(action.label), 1)], 8, _hoisted_7$4);
1375
2247
  }), 128)),
1376
2248
  createElementVNode("button", {
1377
2249
  type: "button",
@@ -1391,57 +2263,57 @@ var CollectionRecordPanel_default = /* @__PURE__ */ defineComponent({
1391
2263
  "aria-label": unref(t)("common.close"),
1392
2264
  "data-testid": "collections-detail-close",
1393
2265
  onClick: _cache[3] || (_cache[3] = ($event) => emit("close"))
1394
- }, [..._cache[7] || (_cache[7] = [createElementVNode("span", { class: "material-icons text-lg" }, "close", -1)])], 8, _hoisted_9)
2266
+ }, [..._cache[7] || (_cache[7] = [createElementVNode("span", { class: "material-icons text-lg" }, "close", -1)])], 8, _hoisted_9$4)
1395
2267
  ]))]),
1396
- !editing.value && __props.actionError ? (openBlock(), createElementBlock("p", _hoisted_10, toDisplayString(__props.actionError), 1)) : createCommentVNode("", true),
1397
- createElementVNode("div", _hoisted_11, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.collection.schema.fields, (field, key) => {
2268
+ !editing.value && __props.actionError ? (openBlock(), createElementBlock("p", _hoisted_10$4, toDisplayString(__props.actionError), 1)) : createCommentVNode("", true),
2269
+ createElementVNode("div", _hoisted_11$4, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.collection.schema.fields, (field, key) => {
1398
2270
  return openBlock(), createElementBlock(Fragment, { key }, [cellVisible(field) ? (openBlock(), createElementBlock("div", {
1399
2271
  key: 0,
1400
2272
  class: normalizeClass(["flex flex-col gap-1.5", colSpanClass(field)])
1401
2273
  }, [createElementVNode("label", {
1402
2274
  class: "text-[10px] font-bold text-slate-400 uppercase tracking-wider flex items-center gap-1",
1403
2275
  for: `collections-field-${key}`
1404
- }, [createTextVNode(toDisplayString(field.label) + " ", 1), editing.value && field.required ? (openBlock(), createElementBlock("span", _hoisted_13, "*")) : createCommentVNode("", true)], 8, _hoisted_12), editing.value && isEditableType(field.type) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [field.type === "boolean" ? (openBlock(), createElementBlock("label", _hoisted_14, [withDirectives(createElementVNode("input", {
2276
+ }, [createTextVNode(toDisplayString(field.label) + " ", 1), editing.value && field.required ? (openBlock(), createElementBlock("span", _hoisted_13$3, "*")) : createCommentVNode("", true)], 8, _hoisted_12$4), editing.value && isEditableType(field.type) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [field.type === "boolean" ? (openBlock(), createElementBlock("label", _hoisted_14$3, [withDirectives(createElementVNode("input", {
1405
2277
  id: `collections-field-${key}`,
1406
2278
  "onUpdate:modelValue": ($event) => editing.value.bool[key] = $event,
1407
2279
  type: "checkbox",
1408
2280
  class: "h-5 w-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500/20 cursor-pointer",
1409
2281
  "data-testid": `collections-input-${key}`,
1410
2282
  onChange: ($event) => markBoolTouched(String(key))
1411
- }, null, 40, _hoisted_15), [[vModelCheckbox, editing.value.bool[key]]]), createElementVNode("span", { class: normalizeClass(["text-xs font-semibold", editing.value.bool[key] ? "text-indigo-600" : "text-slate-500"]) }, toDisplayString(editing.value.bool[key] ? unref(t)("common.yes") : unref(t)("common.no")), 3)])) : field.type === "ref" && field.to && __props.render.refOptions(field.to).length > 0 ? withDirectives((openBlock(), createElementBlock("select", {
2283
+ }, null, 40, _hoisted_15$3), [[vModelCheckbox, editing.value.bool[key]]]), createElementVNode("span", { class: normalizeClass(["text-xs font-semibold", editing.value.bool[key] ? "text-indigo-600" : "text-slate-500"]) }, toDisplayString(editing.value.bool[key] ? unref(t)("common.yes") : unref(t)("common.no")), 3)])) : field.type === "ref" && field.to && __props.render.refOptions(field.to).length > 0 ? withDirectives((openBlock(), createElementBlock("select", {
1412
2284
  key: 1,
1413
2285
  id: `collections-field-${key}`,
1414
2286
  "onUpdate:modelValue": ($event) => editing.value.text[key] = $event,
1415
2287
  required: isFieldRequiredInUi(field),
1416
2288
  class: "w-full rounded-xl border border-slate-200 px-3 py-2 text-xs bg-slate-50 hover:bg-slate-50/50 focus:bg-white focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20 focus:outline-none transition-all cursor-pointer font-medium text-slate-700",
1417
2289
  "data-testid": `collections-input-${key}`
1418
- }, [createElementVNode("option", _hoisted_17, toDisplayString(unref(t)("collectionsView.selectPlaceholder")), 1), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.render.refOptions(field.to), (opt) => {
2290
+ }, [createElementVNode("option", _hoisted_17$2, toDisplayString(unref(t)("collectionsView.selectPlaceholder")), 1), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.render.refOptions(field.to), (opt) => {
1419
2291
  return openBlock(), createElementBlock("option", {
1420
2292
  key: opt.slug,
1421
2293
  value: opt.slug
1422
- }, toDisplayString(opt.display), 9, _hoisted_18);
1423
- }), 128))], 8, _hoisted_16)), [[vModelSelect, editing.value.text[key]]]) : field.type === "enum" && Array.isArray(field.values) && field.values.length > 0 ? withDirectives((openBlock(), createElementBlock("select", {
2294
+ }, toDisplayString(opt.display), 9, _hoisted_18$2);
2295
+ }), 128))], 8, _hoisted_16$2)), [[vModelSelect, editing.value.text[key]]]) : field.type === "enum" && Array.isArray(field.values) && field.values.length > 0 ? withDirectives((openBlock(), createElementBlock("select", {
1424
2296
  key: 2,
1425
2297
  id: `collections-field-${key}`,
1426
2298
  "onUpdate:modelValue": ($event) => editing.value.text[key] = $event,
1427
2299
  required: isFieldRequiredInUi(field),
1428
2300
  class: normalizeClass(["w-full rounded-xl border px-3 py-2 text-xs focus:bg-white focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20 focus:outline-none transition-all cursor-pointer font-medium", enumControlClass(String(key), editing.value.text[key])]),
1429
2301
  "data-testid": `collections-input-${key}`
1430
- }, [createElementVNode("option", _hoisted_20, toDisplayString(unref(t)("collectionsView.selectPlaceholder")), 1), (openBlock(true), createElementBlock(Fragment, null, renderList(field.values, (value) => {
2302
+ }, [createElementVNode("option", _hoisted_20$2, toDisplayString(unref(t)("collectionsView.selectPlaceholder")), 1), (openBlock(true), createElementBlock(Fragment, null, renderList(field.values, (value) => {
1431
2303
  return openBlock(), createElementBlock("option", {
1432
2304
  key: value,
1433
2305
  value
1434
- }, toDisplayString(value), 9, _hoisted_21);
1435
- }), 128))], 10, _hoisted_19)), [[vModelSelect, editing.value.text[key]]]) : field.type === "table" && field.of ? (openBlock(), createElementBlock("div", {
2306
+ }, toDisplayString(value), 9, _hoisted_21$2);
2307
+ }), 128))], 10, _hoisted_19$2)), [[vModelSelect, editing.value.text[key]]]) : field.type === "table" && field.of ? (openBlock(), createElementBlock("div", {
1436
2308
  key: 3,
1437
2309
  class: "border border-slate-200 bg-slate-50/30 rounded-xl p-4 space-y-3",
1438
2310
  "data-testid": `collections-table-${key}`
1439
- }, [editing.value.table[key] && editing.value.table[key].length > 0 ? (openBlock(), createElementBlock("div", _hoisted_23, [createElementVNode("table", _hoisted_24, [createElementVNode("thead", _hoisted_25, [createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(field.of, (subField, subKey) => {
2311
+ }, [editing.value.table[key] && editing.value.table[key].length > 0 ? (openBlock(), createElementBlock("div", _hoisted_23$2, [createElementVNode("table", _hoisted_24$1, [createElementVNode("thead", _hoisted_25$1, [createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(field.of, (subField, subKey) => {
1440
2312
  return openBlock(), createElementBlock("th", {
1441
2313
  key: subKey,
1442
2314
  class: "text-left px-3 py-2 font-bold"
1443
2315
  }, toDisplayString(subField.label), 1);
1444
- }), 128)), _cache[8] || (_cache[8] = createElementVNode("th", { class: "w-9" }, null, -1))])]), createElementVNode("tbody", _hoisted_26, [(openBlock(true), createElementBlock(Fragment, null, renderList(editing.value.table[key], (row, rowIdx) => {
2316
+ }), 128)), _cache[8] || (_cache[8] = createElementVNode("th", { class: "w-9" }, null, -1))])]), createElementVNode("tbody", _hoisted_26$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(editing.value.table[key], (row, rowIdx) => {
1445
2317
  return openBlock(), createElementBlock("tr", {
1446
2318
  key: rowIdx,
1447
2319
  class: "hover:bg-slate-50/50"
@@ -1455,52 +2327,52 @@ var CollectionRecordPanel_default = /* @__PURE__ */ defineComponent({
1455
2327
  type: "checkbox",
1456
2328
  class: "h-4 w-4 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500/20 cursor-pointer",
1457
2329
  onChange: ($event) => markRowBoolTouched(row, String(subKey))
1458
- }, null, 40, _hoisted_27)), [[vModelCheckbox, row.bool[subKey]]]) : subField.type === "enum" && Array.isArray(subField.values) && subField.values.length > 0 ? withDirectives((openBlock(), createElementBlock("select", {
2330
+ }, null, 40, _hoisted_27$1)), [[vModelCheckbox, row.bool[subKey]]]) : subField.type === "enum" && Array.isArray(subField.values) && subField.values.length > 0 ? withDirectives((openBlock(), createElementBlock("select", {
1459
2331
  key: 1,
1460
2332
  "onUpdate:modelValue": ($event) => row.text[subKey] = $event,
1461
2333
  required: subField.required,
1462
2334
  class: "w-full rounded-lg border border-slate-200 px-2 py-1 text-xs focus:border-indigo-500 focus:outline-none cursor-pointer bg-slate-50 font-medium"
1463
- }, [createElementVNode("option", _hoisted_29, toDisplayString(unref(t)("collectionsView.selectPlaceholder")), 1), (openBlock(true), createElementBlock(Fragment, null, renderList(subField.values, (value) => {
2335
+ }, [createElementVNode("option", _hoisted_29$1, toDisplayString(unref(t)("collectionsView.selectPlaceholder")), 1), (openBlock(true), createElementBlock(Fragment, null, renderList(subField.values, (value) => {
1464
2336
  return openBlock(), createElementBlock("option", {
1465
2337
  key: value,
1466
2338
  value
1467
- }, toDisplayString(value), 9, _hoisted_30);
1468
- }), 128))], 8, _hoisted_28)), [[vModelSelect, row.text[subKey]]]) : subField.type === "ref" && subField.to && __props.render.refOptions(subField.to).length > 0 ? withDirectives((openBlock(), createElementBlock("select", {
2339
+ }, toDisplayString(value), 9, _hoisted_30$1);
2340
+ }), 128))], 8, _hoisted_28$1)), [[vModelSelect, row.text[subKey]]]) : subField.type === "ref" && subField.to && __props.render.refOptions(subField.to).length > 0 ? withDirectives((openBlock(), createElementBlock("select", {
1469
2341
  key: 2,
1470
2342
  "onUpdate:modelValue": ($event) => row.text[subKey] = $event,
1471
2343
  required: subField.required,
1472
2344
  class: "w-full rounded-lg border border-slate-200 px-2 py-1 text-xs focus:border-indigo-500 focus:outline-none cursor-pointer bg-slate-50 font-medium"
1473
- }, [createElementVNode("option", _hoisted_32, toDisplayString(unref(t)("collectionsView.selectPlaceholder")), 1), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.render.refOptions(subField.to), (opt) => {
2345
+ }, [createElementVNode("option", _hoisted_32$1, toDisplayString(unref(t)("collectionsView.selectPlaceholder")), 1), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.render.refOptions(subField.to), (opt) => {
1474
2346
  return openBlock(), createElementBlock("option", {
1475
2347
  key: opt.slug,
1476
2348
  value: opt.slug
1477
- }, toDisplayString(opt.display), 9, _hoisted_33);
1478
- }), 128))], 8, _hoisted_31)), [[vModelSelect, row.text[subKey]]]) : subField.type === "money" ? (openBlock(), createElementBlock("div", _hoisted_34, [createElementVNode("span", _hoisted_35, toDisplayString(__props.render.currencySymbol(__props.render.resolveCurrency(subField, __props.liveRecord))), 1), withDirectives(createElementVNode("input", {
2349
+ }, toDisplayString(opt.display), 9, _hoisted_33$1);
2350
+ }), 128))], 8, _hoisted_31$1)), [[vModelSelect, row.text[subKey]]]) : subField.type === "money" ? (openBlock(), createElementBlock("div", _hoisted_34$1, [createElementVNode("span", _hoisted_35$1, toDisplayString(__props.render.currencySymbol(__props.render.resolveCurrency(subField, __props.liveRecord))), 1), withDirectives(createElementVNode("input", {
1479
2351
  "onUpdate:modelValue": ($event) => row.text[subKey] = $event,
1480
2352
  type: "number",
1481
2353
  step: "0.01",
1482
2354
  required: subField.required,
1483
2355
  class: "w-full rounded-lg border border-slate-200 pl-6 pr-1.5 py-1 text-xs focus:border-indigo-500 focus:outline-none font-semibold text-slate-800"
1484
- }, null, 8, _hoisted_36), [[vModelText, row.text[subKey]]])])) : withDirectives((openBlock(), createElementBlock("input", {
2356
+ }, null, 8, _hoisted_36$1), [[vModelText, row.text[subKey]]])])) : withDirectives((openBlock(), createElementBlock("input", {
1485
2357
  key: 4,
1486
2358
  "onUpdate:modelValue": ($event) => row.text[subKey] = $event,
1487
2359
  type: __props.render.inputTypeFor(subField.type),
1488
2360
  required: subField.required,
1489
2361
  class: "w-full rounded-lg border border-slate-200 px-2 py-1 text-xs focus:border-indigo-500 focus:outline-none font-medium text-slate-700"
1490
- }, null, 8, _hoisted_37)), [[vModelDynamic, row.text[subKey]]])]);
1491
- }), 128)), createElementVNode("td", _hoisted_38, [createElementVNode("button", {
2362
+ }, null, 8, _hoisted_37$1)), [[vModelDynamic, row.text[subKey]]])]);
2363
+ }), 128)), createElementVNode("td", _hoisted_38$1, [createElementVNode("button", {
1492
2364
  type: "button",
1493
2365
  class: "h-7 w-7 flex items-center justify-center rounded-lg text-slate-400 hover:text-rose-600 hover:bg-rose-50 transition-colors",
1494
2366
  "aria-label": unref(t)("collectionsView.removeRow"),
1495
2367
  "data-testid": `collections-table-${key}-remove-${rowIdx}`,
1496
2368
  onClick: ($event) => removeTableRow(String(key), rowIdx)
1497
- }, [..._cache[9] || (_cache[9] = [createElementVNode("span", { class: "material-icons text-base" }, "close", -1)])], 8, _hoisted_39)])]);
1498
- }), 128))])])])) : (openBlock(), createElementBlock("p", _hoisted_40, toDisplayString(unref(t)("collectionsView.noRows")), 1)), createElementVNode("button", {
2369
+ }, [..._cache[9] || (_cache[9] = [createElementVNode("span", { class: "material-icons text-base" }, "close", -1)])], 8, _hoisted_39$1)])]);
2370
+ }), 128))])])])) : (openBlock(), createElementBlock("p", _hoisted_40$1, toDisplayString(unref(t)("collectionsView.noRows")), 1)), createElementVNode("button", {
1499
2371
  type: "button",
1500
2372
  class: "inline-flex items-center gap-1 text-xs text-indigo-600 hover:text-indigo-800 font-bold hover:underline",
1501
2373
  "data-testid": `collections-table-${key}-add`,
1502
2374
  onClick: ($event) => addTableRow(String(key), field.of)
1503
- }, [_cache[10] || (_cache[10] = createElementVNode("span", { class: "material-icons text-xs" }, "add", -1)), createElementVNode("span", null, toDisplayString(unref(t)("collectionsView.addRow")), 1)], 8, _hoisted_41)], 8, _hoisted_22)) : field.type === "money" ? (openBlock(), createElementBlock("div", _hoisted_42, [createElementVNode("div", _hoisted_43, toDisplayString(__props.render.currencySymbol(__props.render.resolveCurrency(field, __props.liveRecord))), 1), withDirectives(createElementVNode("input", {
2375
+ }, [_cache[10] || (_cache[10] = createElementVNode("span", { class: "material-icons text-xs" }, "add", -1)), createElementVNode("span", null, toDisplayString(unref(t)("collectionsView.addRow")), 1)], 8, _hoisted_41$1)], 8, _hoisted_22$2)) : field.type === "money" ? (openBlock(), createElementBlock("div", _hoisted_42$1, [createElementVNode("div", _hoisted_43$1, toDisplayString(__props.render.currencySymbol(__props.render.resolveCurrency(field, __props.liveRecord))), 1), withDirectives(createElementVNode("input", {
1504
2376
  id: `collections-field-${key}`,
1505
2377
  "onUpdate:modelValue": ($event) => editing.value.text[key] = $event,
1506
2378
  type: "number",
@@ -1508,7 +2380,7 @@ var CollectionRecordPanel_default = /* @__PURE__ */ defineComponent({
1508
2380
  required: isFieldRequiredInUi(field),
1509
2381
  class: "w-full rounded-xl border border-slate-200 pl-11 pr-3 py-2 text-xs focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20 focus:outline-none font-semibold text-slate-800 transition-all",
1510
2382
  "data-testid": `collections-input-${key}`
1511
- }, null, 8, _hoisted_44), [[vModelText, editing.value.text[key]]])])) : [
2383
+ }, null, 8, _hoisted_44$1), [[vModelText, editing.value.text[key]]])])) : [
1512
2384
  "string",
1513
2385
  "email",
1514
2386
  "number",
@@ -1526,7 +2398,7 @@ var CollectionRecordPanel_default = /* @__PURE__ */ defineComponent({
1526
2398
  disabled: field.primary === true && (editing.value.mode === "edit" || __props.isSingleton),
1527
2399
  class: "w-full rounded-xl border border-slate-200 px-3 py-2 text-xs focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20 focus:outline-none disabled:bg-slate-100 disabled:text-slate-400 font-medium text-slate-700 transition-all",
1528
2400
  "data-testid": `collections-input-${key}`
1529
- }, null, 8, _hoisted_45)), [[vModelDynamic, editing.value.text[key]]]) : withDirectives((openBlock(), createElementBlock("textarea", {
2401
+ }, null, 8, _hoisted_45$1)), [[vModelDynamic, editing.value.text[key]]]) : withDirectives((openBlock(), createElementBlock("textarea", {
1530
2402
  key: 6,
1531
2403
  id: `collections-field-${key}`,
1532
2404
  "onUpdate:modelValue": ($event) => editing.value.text[key] = $event,
@@ -1534,11 +2406,11 @@ var CollectionRecordPanel_default = /* @__PURE__ */ defineComponent({
1534
2406
  required: isFieldRequiredInUi(field),
1535
2407
  class: "w-full rounded-xl border border-slate-200 px-3 py-2 text-xs focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20 focus:outline-none font-medium text-slate-700 transition-all",
1536
2408
  "data-testid": `collections-input-${key}`
1537
- }, null, 8, _hoisted_46)), [[vModelText, editing.value.text[key]]])], 64)) : (openBlock(), createElementBlock("div", {
2409
+ }, null, 8, _hoisted_46$1)), [[vModelText, editing.value.text[key]]])], 64)) : (openBlock(), createElementBlock("div", {
1538
2410
  key: 1,
1539
2411
  class: "text-xs font-medium text-slate-700 break-words",
1540
2412
  "data-testid": `collections-detail-value-${key}`
1541
- }, [field.type === "toggle" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [field.field !== void 0 && String(detailRecord.value[field.field] ?? "") === field.onValue ? (openBlock(), createElementBlock("span", _hoisted_48, [_cache[11] || (_cache[11] = createElementVNode("span", { class: "h-1.5 w-1.5 rounded-full bg-emerald-500" }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("common.yes")), 1)])) : (openBlock(), createElementBlock("span", _hoisted_49, toDisplayString(unref(t)("common.no")), 1))], 64)) : field.type === "boolean" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [detailRecord.value[key] === true ? (openBlock(), createElementBlock("span", _hoisted_50, [_cache[12] || (_cache[12] = createElementVNode("span", { class: "h-1.5 w-1.5 rounded-full bg-emerald-500" }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("common.yes")), 1)])) : detailRecord.value[key] === false ? (openBlock(), createElementBlock("span", _hoisted_51, toDisplayString(unref(t)("common.no")), 1)) : (openBlock(), createElementBlock("span", _hoisted_52, "—"))], 64)) : field.type === "ref" && field.to && typeof detailRecord.value[key] === "string" && detailRecord.value[key] ? (openBlock(), createBlock(_component_router_link, {
2413
+ }, [field.type === "toggle" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [field.field !== void 0 && String(detailRecord.value[field.field] ?? "") === field.onValue ? (openBlock(), createElementBlock("span", _hoisted_48$1, [_cache[11] || (_cache[11] = createElementVNode("span", { class: "h-1.5 w-1.5 rounded-full bg-emerald-500" }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("common.yes")), 1)])) : (openBlock(), createElementBlock("span", _hoisted_49$1, toDisplayString(unref(t)("common.no")), 1))], 64)) : field.type === "boolean" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [detailRecord.value[key] === true ? (openBlock(), createElementBlock("span", _hoisted_50$1, [_cache[12] || (_cache[12] = createElementVNode("span", { class: "h-1.5 w-1.5 rounded-full bg-emerald-500" }, null, -1)), createTextVNode(" " + toDisplayString(unref(t)("common.yes")), 1)])) : detailRecord.value[key] === false ? (openBlock(), createElementBlock("span", _hoisted_51$1, toDisplayString(unref(t)("common.no")), 1)) : (openBlock(), createElementBlock("span", _hoisted_52$1, "—"))], 64)) : field.type === "ref" && field.to && typeof detailRecord.value[key] === "string" && detailRecord.value[key] ? (openBlock(), createBlock(_component_router_link, {
1542
2414
  key: 2,
1543
2415
  to: {
1544
2416
  path: `/collections/${field.to}`,
@@ -1549,12 +2421,12 @@ var CollectionRecordPanel_default = /* @__PURE__ */ defineComponent({
1549
2421
  }, {
1550
2422
  default: withCtx(() => [createTextVNode(toDisplayString(__props.render.refDisplay(field.to, String(detailRecord.value[key]))), 1)]),
1551
2423
  _: 2
1552
- }, 1032, ["to", "data-testid"])) : field.type === "money" ? (openBlock(), createElementBlock("span", _hoisted_53, toDisplayString(__props.render.formatMoney(detailRecord.value[key], __props.render.resolveCurrency(field, detailRecord.value), __props.locale)), 1)) : field.type === "derived" ? (openBlock(), createElementBlock("span", _hoisted_54, toDisplayString(__props.render.derivedDisplay(field, __props.render.evaluateDerivedAgainstItem(field, String(key), detailRecord.value), detailRecord.value)), 1)) : field.type === "table" && field.of && __props.render.hasTableRows(detailRecord.value[key]) ? (openBlock(), createElementBlock("div", _hoisted_55, [createElementVNode("table", _hoisted_56, [createElementVNode("thead", _hoisted_57, [createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(field.of, (subField, subKey) => {
2424
+ }, 1032, ["to", "data-testid"])) : field.type === "money" ? (openBlock(), createElementBlock("span", _hoisted_53$1, toDisplayString(__props.render.formatMoney(detailRecord.value[key], __props.render.resolveCurrency(field, detailRecord.value), __props.locale)), 1)) : field.type === "derived" ? (openBlock(), createElementBlock("span", _hoisted_54$1, toDisplayString(__props.render.derivedDisplay(field, __props.render.evaluateDerivedAgainstItem(field, String(key), detailRecord.value), detailRecord.value)), 1)) : field.type === "table" && field.of && __props.render.hasTableRows(detailRecord.value[key]) ? (openBlock(), createElementBlock("div", _hoisted_55$1, [createElementVNode("table", _hoisted_56$1, [createElementVNode("thead", _hoisted_57$1, [createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(field.of, (subField, subKey) => {
1553
2425
  return openBlock(), createElementBlock("th", {
1554
2426
  key: subKey,
1555
2427
  class: "text-left px-4 py-2 font-bold"
1556
2428
  }, toDisplayString(subField.label), 1);
1557
- }), 128))])]), createElementVNode("tbody", _hoisted_58, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.render.tableRows(detailRecord.value[key]), (row, rowIdx) => {
2429
+ }), 128))])]), createElementVNode("tbody", _hoisted_58$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.render.tableRows(detailRecord.value[key]), (row, rowIdx) => {
1558
2430
  return openBlock(), createElementBlock("tr", {
1559
2431
  key: rowIdx,
1560
2432
  class: "hover:bg-slate-50/50"
@@ -1562,12 +2434,12 @@ var CollectionRecordPanel_default = /* @__PURE__ */ defineComponent({
1562
2434
  return openBlock(), createElementBlock("td", {
1563
2435
  key: subKey,
1564
2436
  class: "px-4 py-2 align-middle font-medium"
1565
- }, [subField.type === "boolean" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [row[subKey] === true ? (openBlock(), createElementBlock("span", _hoisted_59, "check_circle")) : (openBlock(), createElementBlock("span", _hoisted_60, "—"))], 64)) : (openBlock(), createElementBlock("span", {
2437
+ }, [subField.type === "boolean" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [row[subKey] === true ? (openBlock(), createElementBlock("span", _hoisted_59$1, "check_circle")) : (openBlock(), createElementBlock("span", _hoisted_60$1, "—"))], 64)) : (openBlock(), createElementBlock("span", {
1566
2438
  key: 1,
1567
2439
  class: normalizeClass([subField.type === "money" ? "font-bold text-slate-800 tabular-nums" : ""])
1568
2440
  }, toDisplayString(__props.render.formatSubCell(subField, row[subKey], detailRecord.value)), 3))]);
1569
2441
  }), 128))]);
1570
- }), 128))])])])) : field.type === "table" ? (openBlock(), createElementBlock("span", _hoisted_61, toDisplayString(unref(t)("collectionsView.noRows")), 1)) : field.type === "markdown" ? (openBlock(), createElementBlock("div", _hoisted_62, toDisplayString(__props.render.detailText(detailRecord.value[key])), 1)) : field.type === "embed" && embedViews.value[key] ? (openBlock(), createBlock(CollectionEmbedView_default, {
2442
+ }), 128))])])])) : field.type === "table" ? (openBlock(), createElementBlock("span", _hoisted_61$1, toDisplayString(unref(t)("collectionsView.noRows")), 1)) : field.type === "markdown" ? (openBlock(), createElementBlock("div", _hoisted_62$1, toDisplayString(__props.render.detailText(detailRecord.value[key])), 1)) : field.type === "embed" && embedViews.value[key] ? (openBlock(), createBlock(CollectionEmbedView_default, {
1571
2443
  key: 8,
1572
2444
  view: embedViews.value[key],
1573
2445
  "field-key": String(key)
@@ -1577,21 +2449,21 @@ var CollectionRecordPanel_default = /* @__PURE__ */ defineComponent({
1577
2449
  alt: field.label,
1578
2450
  class: "max-h-64 max-w-full object-contain rounded-lg border border-slate-200 bg-slate-50",
1579
2451
  "data-testid": `collections-detail-image-${key}`
1580
- }, null, 8, _hoisted_63)) : field.type !== "file" && __props.render.isExternalUrl(detailRecord.value[key]) ? (openBlock(), createElementBlock("a", {
2452
+ }, null, 8, _hoisted_63$1)) : field.type !== "file" && __props.render.isExternalUrl(detailRecord.value[key]) ? (openBlock(), createElementBlock("a", {
1581
2453
  key: 10,
1582
2454
  href: String(detailRecord.value[key]),
1583
2455
  target: "_blank",
1584
2456
  rel: "noopener noreferrer",
1585
2457
  class: "text-blue-600 hover:text-blue-800 font-semibold hover:underline break-all",
1586
2458
  "data-testid": `collections-detail-url-${key}`
1587
- }, toDisplayString(String(detailRecord.value[key])), 9, _hoisted_64)) : field.type === "file" && __props.render.artifactUrl(detailRecord.value[key]) ? (openBlock(), createElementBlock("a", {
2459
+ }, toDisplayString(String(detailRecord.value[key])), 9, _hoisted_64$1)) : field.type === "file" && __props.render.artifactUrl(detailRecord.value[key]) ? (openBlock(), createElementBlock("a", {
1588
2460
  key: 11,
1589
2461
  href: __props.render.artifactUrl(detailRecord.value[key]) ?? void 0,
1590
2462
  target: "_blank",
1591
2463
  rel: "noopener noreferrer",
1592
2464
  class: "text-blue-600 hover:text-blue-800 font-semibold hover:underline break-all",
1593
2465
  "data-testid": `collections-detail-file-${key}`
1594
- }, toDisplayString(String(detailRecord.value[key])), 9, _hoisted_65)) : field.type === "file" && __props.render.fileRoutePath(detailRecord.value[key]) ? (openBlock(), createBlock(_component_router_link, {
2466
+ }, toDisplayString(String(detailRecord.value[key])), 9, _hoisted_65$1)) : field.type === "file" && __props.render.fileRoutePath(detailRecord.value[key]) ? (openBlock(), createBlock(_component_router_link, {
1595
2467
  key: 12,
1596
2468
  to: __props.render.fileRoutePath(detailRecord.value[key]) ?? "",
1597
2469
  class: "text-blue-600 hover:text-blue-800 font-semibold hover:underline break-all",
@@ -1599,8 +2471,8 @@ var CollectionRecordPanel_default = /* @__PURE__ */ defineComponent({
1599
2471
  }, {
1600
2472
  default: withCtx(() => [createTextVNode(toDisplayString(String(detailRecord.value[key])), 1)]),
1601
2473
  _: 2
1602
- }, 1032, ["to", "data-testid"])) : (openBlock(), createElementBlock("span", _hoisted_66, toDisplayString(__props.render.formatCell(detailRecord.value[key], field.type)), 1))], 8, _hoisted_47))], 2)) : createCommentVNode("", true)], 64);
1603
- }), 128)), editing.value && __props.saveError ? (openBlock(), createElementBlock("p", _hoisted_67, toDisplayString(__props.saveError), 1)) : createCommentVNode("", true)])
2474
+ }, 1032, ["to", "data-testid"])) : (openBlock(), createElementBlock("span", _hoisted_66$1, toDisplayString(__props.render.formatCell(detailRecord.value[key], field.type)), 1))], 8, _hoisted_47$1))], 2)) : createCommentVNode("", true)], 64);
2475
+ }), 128)), editing.value && __props.saveError ? (openBlock(), createElementBlock("p", _hoisted_67$1, toDisplayString(__props.saveError), 1)) : createCommentVNode("", true)])
1604
2476
  ]),
1605
2477
  _: 1
1606
2478
  }, 40, ["data-testid"]);
@@ -1608,6 +2480,2214 @@ var CollectionRecordPanel_default = /* @__PURE__ */ defineComponent({
1608
2480
  }
1609
2481
  });
1610
2482
  //#endregion
1611
- export { CollectionCalendarView_default as CollectionCalendarView, CollectionDayView_default as CollectionDayView, CollectionEmbedView_default as CollectionEmbedView, CollectionKanbanView_default as CollectionKanbanView, CollectionRecordModal_default as CollectionRecordModal, CollectionRecordPanel_default as CollectionRecordPanel, collectionUi, configureCollectionUi, useCollectionRendering };
2483
+ //#region src/vue/components/CollectionViewConfigModal.vue?vue&type=script&setup=true&lang.ts
2484
+ var _hoisted_1$4 = {
2485
+ "data-testid": "collection-config-modal",
2486
+ class: "flex flex-col overflow-hidden"
2487
+ };
2488
+ var _hoisted_2$4 = { class: "flex items-center justify-between gap-2 border-b border-slate-100 px-5 py-3" };
2489
+ var _hoisted_3$4 = { class: "text-sm font-bold text-slate-700" };
2490
+ var _hoisted_4$4 = ["title", "aria-label"];
2491
+ var _hoisted_5$3 = { class: "overflow-y-auto px-5 py-4" };
2492
+ var _hoisted_6$3 = { class: "mb-2 text-[10px] font-bold uppercase tracking-wider text-slate-400" };
2493
+ var _hoisted_7$3 = {
2494
+ key: 0,
2495
+ class: "mb-3 rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs font-medium text-rose-600",
2496
+ "data-testid": "collection-config-error"
2497
+ };
2498
+ var _hoisted_8$3 = {
2499
+ key: 1,
2500
+ class: "flex flex-col gap-1"
2501
+ };
2502
+ var _hoisted_9$3 = { class: "material-icons text-base text-slate-400" };
2503
+ var _hoisted_10$3 = { class: "flex-1 truncate text-sm font-semibold text-slate-700" };
2504
+ var _hoisted_11$3 = [
2505
+ "title",
2506
+ "aria-label",
2507
+ "data-testid",
2508
+ "disabled",
2509
+ "onClick"
2510
+ ];
2511
+ var _hoisted_12$3 = {
2512
+ key: 2,
2513
+ class: "text-xs text-slate-400",
2514
+ "data-testid": "collection-config-empty"
2515
+ };
2516
+ //#endregion
2517
+ //#region src/vue/components/CollectionViewConfigModal.vue
2518
+ var CollectionViewConfigModal_default = /* @__PURE__ */ defineComponent({
2519
+ __name: "CollectionViewConfigModal",
2520
+ props: {
2521
+ slug: {},
2522
+ title: {},
2523
+ views: {}
2524
+ },
2525
+ emits: ["close", "changed"],
2526
+ setup(__props, { emit: __emit }) {
2527
+ const props = __props;
2528
+ const emit = __emit;
2529
+ const { t } = useCollectionI18n();
2530
+ const deleting = ref(null);
2531
+ const error = ref(null);
2532
+ async function onDelete(view) {
2533
+ if (!await collectionUi().confirm({
2534
+ message: t("collectionsView.config.confirmDelete", { label: view.label }),
2535
+ confirmText: t("common.remove"),
2536
+ cancelText: t("common.cancel"),
2537
+ variant: "danger"
2538
+ })) return;
2539
+ error.value = null;
2540
+ deleting.value = view.id;
2541
+ try {
2542
+ const result = await collectionUi().deleteView(props.slug, view.id);
2543
+ if (!result.ok) {
2544
+ error.value = result.error;
2545
+ return;
2546
+ }
2547
+ emit("changed");
2548
+ } catch (err) {
2549
+ error.value = errorMessage(err);
2550
+ } finally {
2551
+ deleting.value = null;
2552
+ }
2553
+ }
2554
+ return (_ctx, _cache) => {
2555
+ return openBlock(), createBlock(CollectionRecordModal_default, { onClose: _cache[1] || (_cache[1] = ($event) => emit("close")) }, {
2556
+ default: withCtx(() => [createElementVNode("div", _hoisted_1$4, [createElementVNode("header", _hoisted_2$4, [createElementVNode("h2", _hoisted_3$4, toDisplayString(unref(t)("collectionsView.config.title", { title: __props.title })), 1), createElementVNode("button", {
2557
+ type: "button",
2558
+ class: "h-8 w-8 flex items-center justify-center rounded text-slate-400 hover:bg-slate-50 hover:text-slate-600",
2559
+ title: unref(t)("common.close"),
2560
+ "aria-label": unref(t)("common.close"),
2561
+ "data-testid": "collection-config-close",
2562
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("close"))
2563
+ }, [..._cache[2] || (_cache[2] = [createElementVNode("span", { class: "material-icons text-sm" }, "close", -1)])], 8, _hoisted_4$4)]), createElementVNode("div", _hoisted_5$3, [
2564
+ createElementVNode("h3", _hoisted_6$3, toDisplayString(unref(t)("collectionsView.config.viewsHeading")), 1),
2565
+ error.value ? (openBlock(), createElementBlock("p", _hoisted_7$3, toDisplayString(error.value), 1)) : createCommentVNode("", true),
2566
+ __props.views.length > 0 ? (openBlock(), createElementBlock("ul", _hoisted_8$3, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.views, (view) => {
2567
+ return openBlock(), createElementBlock("li", {
2568
+ key: view.id,
2569
+ class: "flex items-center gap-2 rounded border border-slate-200 bg-white px-3 py-2"
2570
+ }, [
2571
+ createElementVNode("span", _hoisted_9$3, toDisplayString(view.icon || "dashboard_customize"), 1),
2572
+ createElementVNode("span", _hoisted_10$3, toDisplayString(view.label), 1),
2573
+ createElementVNode("button", {
2574
+ type: "button",
2575
+ class: "h-8 w-8 flex items-center justify-center rounded border border-rose-200 bg-white text-rose-600 hover:bg-rose-50 disabled:opacity-50",
2576
+ title: unref(t)("collectionsView.config.deleteView", { label: view.label }),
2577
+ "aria-label": unref(t)("collectionsView.config.deleteView", { label: view.label }),
2578
+ "data-testid": `collection-view-delete-${view.id}`,
2579
+ disabled: deleting.value !== null,
2580
+ onClick: ($event) => onDelete(view)
2581
+ }, [..._cache[3] || (_cache[3] = [createElementVNode("span", { class: "material-icons text-sm" }, "delete_forever", -1)])], 8, _hoisted_11$3)
2582
+ ]);
2583
+ }), 128))])) : (openBlock(), createElementBlock("p", _hoisted_12$3, toDisplayString(unref(t)("collectionsView.config.empty")), 1))
2584
+ ])])]),
2585
+ _: 1
2586
+ });
2587
+ };
2588
+ }
2589
+ });
2590
+ //#endregion
2591
+ //#region src/vue/components/CollectionCustomView.vue?vue&type=script&setup=true&lang.ts
2592
+ var _hoisted_1$3 = { class: "custom-view-container" };
2593
+ var _hoisted_2$3 = {
2594
+ key: 0,
2595
+ class: "custom-view-message",
2596
+ role: "alert",
2597
+ "data-testid": "collection-custom-view-error"
2598
+ };
2599
+ var _hoisted_3$3 = {
2600
+ key: 1,
2601
+ class: "custom-view-message",
2602
+ "data-testid": "collection-custom-view-loading"
2603
+ };
2604
+ var _hoisted_4$3 = ["title", "srcdoc"];
2605
+ var REMINT_LEAD_MS = 6e4;
2606
+ var MIN_REMINT_DELAY_MS = 1e4;
2607
+ var CollectionCustomView_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
2608
+ __name: "CollectionCustomView",
2609
+ props: {
2610
+ slug: {},
2611
+ view: {}
2612
+ },
2613
+ setup(__props) {
2614
+ const { t } = useCollectionI18n();
2615
+ const props = __props;
2616
+ const loading = ref(true);
2617
+ const error = ref(null);
2618
+ const srcdoc = ref(null);
2619
+ let refreshTimer;
2620
+ function clearRefresh() {
2621
+ if (refreshTimer !== void 0) {
2622
+ clearTimeout(refreshTimer);
2623
+ refreshTimer = void 0;
2624
+ }
2625
+ }
2626
+ function scheduleRefresh(expMs) {
2627
+ clearRefresh();
2628
+ const delay = Math.max(expMs - Date.now() - REMINT_LEAD_MS, MIN_REMINT_DELAY_MS);
2629
+ refreshTimer = setTimeout(() => void load(), delay);
2630
+ }
2631
+ let loadSeq = 0;
2632
+ async function load() {
2633
+ clearRefresh();
2634
+ const seq = ++loadSeq;
2635
+ const stale = () => seq !== loadSeq;
2636
+ loading.value = true;
2637
+ error.value = null;
2638
+ srcdoc.value = null;
2639
+ const binding = collectionUi();
2640
+ try {
2641
+ const mint = await binding.mintViewToken(props.slug, props.view.id);
2642
+ if (stale()) return;
2643
+ if (!mint.ok) {
2644
+ error.value = mint.error;
2645
+ return;
2646
+ }
2647
+ scheduleRefresh(mint.data.exp);
2648
+ const resp = await binding.fetchViewHtml(props.slug, props.view.id);
2649
+ if (stale()) return;
2650
+ if (!resp.ok) {
2651
+ error.value = `HTTP ${resp.status}`;
2652
+ return;
2653
+ }
2654
+ srcdoc.value = binding.buildViewSrcdoc(resp.html, {
2655
+ slug: props.slug,
2656
+ token: mint.data.token,
2657
+ dataUrl: mint.data.dataUrl,
2658
+ origin: window.location.origin
2659
+ });
2660
+ } catch (err) {
2661
+ if (!stale()) error.value = errorMessage(err);
2662
+ } finally {
2663
+ if (!stale()) loading.value = false;
2664
+ }
2665
+ }
2666
+ watch([() => props.slug, () => props.view.id], () => void load(), { immediate: true });
2667
+ onBeforeUnmount(clearRefresh);
2668
+ return (_ctx, _cache) => {
2669
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [error.value ? (openBlock(), createElementBlock("div", _hoisted_2$3, toDisplayString(unref(t)("collectionsView.customViewError", { error: error.value })), 1)) : loading.value ? (openBlock(), createElementBlock("div", _hoisted_3$3, toDisplayString(unref(t)("collectionsView.customViewLoading")), 1)) : srcdoc.value ? (openBlock(), createElementBlock("iframe", {
2670
+ key: __props.view.id,
2671
+ "data-testid": "collection-custom-view-iframe",
2672
+ title: __props.view.label,
2673
+ srcdoc: srcdoc.value,
2674
+ sandbox: "allow-scripts allow-popups allow-popups-to-escape-sandbox",
2675
+ class: "w-full h-full border-0"
2676
+ }, null, 8, _hoisted_4$3)) : createCommentVNode("", true)]);
2677
+ };
2678
+ }
2679
+ });
2680
+ //#endregion
2681
+ //#region \0plugin-vue:export-helper
2682
+ var _plugin_vue_export_helper_default = (sfc, props) => {
2683
+ const target = sfc.__vccOpts || sfc;
2684
+ for (const [key, val] of props) target[key] = val;
2685
+ return target;
2686
+ };
2687
+ //#endregion
2688
+ //#region src/vue/components/CollectionCustomView.vue
2689
+ var CollectionCustomView_default = /* @__PURE__ */ _plugin_vue_export_helper_default(CollectionCustomView_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-3ab71997"]]);
2690
+ //#endregion
2691
+ //#region src/vue/components/CollectionView.vue?vue&type=script&setup=true&lang.ts
2692
+ var _hoisted_1$2 = { class: "h-full flex flex-col bg-slate-50/30" };
2693
+ var _hoisted_2$2 = { class: "flex items-center gap-3 px-6 py-2 border-b border-slate-200 bg-white" };
2694
+ var _hoisted_3$2 = ["title", "aria-label"];
2695
+ var _hoisted_4$2 = {
2696
+ key: 1,
2697
+ class: "h-9 w-9 flex items-center justify-center rounded-xl bg-indigo-50 text-indigo-600 border border-indigo-100"
2698
+ };
2699
+ var _hoisted_5$2 = { class: "material-symbols-outlined text-xl" };
2700
+ var _hoisted_6$2 = { class: "flex-1 min-w-0" };
2701
+ var _hoisted_7$2 = { class: "text-base font-bold text-slate-800 truncate" };
2702
+ var _hoisted_8$2 = {
2703
+ key: 0,
2704
+ class: "block text-[10px] text-slate-400 font-bold uppercase tracking-wider"
2705
+ };
2706
+ var _hoisted_9$2 = ["disabled"];
2707
+ var _hoisted_10$2 = { class: "material-icons text-sm" };
2708
+ var _hoisted_11$2 = [
2709
+ "disabled",
2710
+ "data-testid",
2711
+ "onClick"
2712
+ ];
2713
+ var _hoisted_12$2 = {
2714
+ key: 0,
2715
+ class: "material-icons text-sm"
2716
+ };
2717
+ var _hoisted_13$2 = ["title", "aria-label"];
2718
+ var _hoisted_14$2 = ["title", "aria-label"];
2719
+ var _hoisted_15$2 = {
2720
+ key: 0,
2721
+ class: "px-6 py-3 bg-white border-b border-slate-100 flex items-center justify-between gap-4"
2722
+ };
2723
+ var _hoisted_16$1 = {
2724
+ key: 0,
2725
+ class: "relative flex-1 max-w-md"
2726
+ };
2727
+ var _hoisted_17$1 = ["placeholder", "aria-label"];
2728
+ var _hoisted_18$1 = ["aria-label"];
2729
+ var _hoisted_19$1 = { class: "flex items-center gap-2" };
2730
+ var _hoisted_20$1 = ["aria-label"];
2731
+ var _hoisted_21$1 = ["aria-pressed"];
2732
+ var _hoisted_22$1 = ["aria-pressed"];
2733
+ var _hoisted_23$1 = ["aria-pressed"];
2734
+ var _hoisted_24 = [
2735
+ "aria-pressed",
2736
+ "data-testid",
2737
+ "onClick"
2738
+ ];
2739
+ var _hoisted_25 = { class: "material-icons text-sm" };
2740
+ var _hoisted_26 = ["title", "aria-label"];
2741
+ var _hoisted_27 = ["title", "aria-label"];
2742
+ var _hoisted_28 = ["value", "aria-label"];
2743
+ var _hoisted_29 = ["value"];
2744
+ var _hoisted_30 = ["value", "aria-label"];
2745
+ var _hoisted_31 = ["value"];
2746
+ var _hoisted_32 = {
2747
+ key: 3,
2748
+ class: "text-[10px] text-slate-400 font-bold uppercase tracking-wider select-none"
2749
+ };
2750
+ var _hoisted_33 = {
2751
+ key: 1,
2752
+ class: "mx-6 mt-4 rounded-xl border border-amber-200 bg-amber-50/60 p-4 text-sm text-amber-900 shadow-sm flex items-center gap-3",
2753
+ "data-testid": "collections-data-issues"
2754
+ };
2755
+ var _hoisted_34 = { class: "flex-1" };
2756
+ var _hoisted_35 = { class: "flex-1 overflow-auto" };
2757
+ var _hoisted_36 = {
2758
+ key: 0,
2759
+ class: "flex flex-col items-center justify-center py-20 text-sm text-slate-500 gap-3"
2760
+ };
2761
+ var _hoisted_37 = {
2762
+ key: 1,
2763
+ class: "m-6 rounded-xl border border-red-200 bg-red-50/50 p-4 text-sm text-red-800 shadow-sm flex items-center gap-3"
2764
+ };
2765
+ var _hoisted_38 = { key: 2 };
2766
+ var _hoisted_39 = {
2767
+ key: 3,
2768
+ class: "p-4"
2769
+ };
2770
+ var _hoisted_40 = {
2771
+ key: 4,
2772
+ class: "h-full flex flex-col"
2773
+ };
2774
+ var _hoisted_41 = {
2775
+ key: 0,
2776
+ class: "m-3 mb-0 rounded-xl border border-red-200 bg-red-50/50 p-4 text-sm text-red-800 shadow-sm flex items-center gap-3",
2777
+ "data-testid": "collections-inline-error"
2778
+ };
2779
+ var _hoisted_42 = { class: "flex-1" };
2780
+ var _hoisted_43 = ["aria-label"];
2781
+ var _hoisted_44 = { class: "flex-1 min-h-0 px-3 py-2" };
2782
+ var _hoisted_45 = {
2783
+ key: 5,
2784
+ class: "h-full",
2785
+ "data-testid": "collection-custom-view-body"
2786
+ };
2787
+ var _hoisted_46 = {
2788
+ key: 6,
2789
+ class: "flex flex-col items-center justify-center py-20 text-sm text-slate-400 gap-2"
2790
+ };
2791
+ var _hoisted_47 = { class: "font-semibold text-slate-600" };
2792
+ var _hoisted_48 = {
2793
+ key: 7,
2794
+ class: "flex flex-col items-center justify-center py-20 text-sm text-slate-400 gap-2"
2795
+ };
2796
+ var _hoisted_49 = { class: "font-semibold text-slate-600" };
2797
+ var _hoisted_50 = {
2798
+ key: 8,
2799
+ class: "overflow-x-auto [container-type:inline-size]"
2800
+ };
2801
+ var _hoisted_51 = {
2802
+ key: 0,
2803
+ class: "m-4 rounded-xl border border-red-200 bg-red-50/50 p-4 text-sm text-red-800 shadow-sm flex items-center gap-3",
2804
+ "data-testid": "collections-inline-error"
2805
+ };
2806
+ var _hoisted_52 = { class: "flex-1" };
2807
+ var _hoisted_53 = ["aria-label"];
2808
+ var _hoisted_54 = { class: "min-w-full text-xs" };
2809
+ var _hoisted_55 = { class: "bg-slate-50 border-b border-slate-200" };
2810
+ var _hoisted_56 = ["aria-sort"];
2811
+ var _hoisted_57 = { class: "flex items-center gap-1" };
2812
+ var _hoisted_58 = ["title"];
2813
+ var _hoisted_59 = [
2814
+ "data-testid",
2815
+ "aria-label",
2816
+ "onClick",
2817
+ "onPointerenter"
2818
+ ];
2819
+ var _hoisted_60 = { class: "material-icons text-base align-middle" };
2820
+ var _hoisted_61 = { class: "divide-y divide-slate-100 bg-white" };
2821
+ var _hoisted_62 = [
2822
+ "aria-label",
2823
+ "data-testid",
2824
+ "onClick",
2825
+ "onKeydown"
2826
+ ];
2827
+ var _hoisted_63 = [
2828
+ "checked",
2829
+ "disabled",
2830
+ "data-testid",
2831
+ "aria-label",
2832
+ "onChange"
2833
+ ];
2834
+ var _hoisted_64 = [
2835
+ "checked",
2836
+ "disabled",
2837
+ "data-testid",
2838
+ "aria-label",
2839
+ "onChange"
2840
+ ];
2841
+ var _hoisted_65 = {
2842
+ key: 2,
2843
+ class: "block truncate"
2844
+ };
2845
+ var _hoisted_66 = [
2846
+ "value",
2847
+ "disabled",
2848
+ "data-testid",
2849
+ "aria-label",
2850
+ "onChange"
2851
+ ];
2852
+ var _hoisted_67 = {
2853
+ key: 0,
2854
+ value: ""
2855
+ };
2856
+ var _hoisted_68 = ["value"];
2857
+ var _hoisted_69 = {
2858
+ key: 4,
2859
+ class: "block truncate tabular-nums font-semibold text-slate-900"
2860
+ };
2861
+ var _hoisted_70 = {
2862
+ key: 5,
2863
+ class: "inline-flex items-center gap-1 px-2 py-0.5 rounded-lg text-[10px] font-bold bg-slate-100 text-slate-600 border border-slate-200/40"
2864
+ };
2865
+ var _hoisted_71 = {
2866
+ key: 6,
2867
+ class: "inline-block truncate tabular-nums font-bold text-indigo-900 bg-indigo-50/50 px-1.5 py-0.5 rounded border border-indigo-100/50"
2868
+ };
2869
+ var _hoisted_72 = ["href", "data-testid"];
2870
+ var _hoisted_73 = ["href", "data-testid"];
2871
+ var _hoisted_74 = {
2872
+ key: 10,
2873
+ class: "block truncate text-slate-600"
2874
+ };
2875
+ var _hoisted_75 = { class: "bg-white rounded-2xl shadow-2xl w-full max-w-xl flex flex-col border border-slate-200 overflow-hidden" };
2876
+ var _hoisted_76 = { class: "px-6 py-4 border-b border-slate-100 flex items-center gap-3 bg-slate-50/50" };
2877
+ var _hoisted_77 = { class: "flex-1" };
2878
+ var _hoisted_78 = {
2879
+ id: "collections-chat-title",
2880
+ class: "text-sm font-bold text-slate-800 uppercase tracking-wide"
2881
+ };
2882
+ var _hoisted_79 = { class: "text-xs text-slate-400 font-semibold" };
2883
+ var _hoisted_80 = ["aria-label"];
2884
+ var _hoisted_81 = { class: "px-6 py-5" };
2885
+ var _hoisted_82 = ["placeholder", "onKeydown"];
2886
+ var _hoisted_83 = { class: "px-6 py-3.5 border-t border-slate-100 flex items-center justify-end gap-2 bg-slate-50/50" };
2887
+ var _hoisted_84 = ["disabled"];
2888
+ //#endregion
2889
+ //#region src/vue/components/CollectionView.vue
2890
+ var CollectionView_default = /* @__PURE__ */ defineComponent({
2891
+ __name: "CollectionView",
2892
+ props: {
2893
+ slug: {},
2894
+ selected: {},
2895
+ sendTextMessage: { type: Function },
2896
+ initialView: {},
2897
+ initialAnchorField: {},
2898
+ initialGroupField: {}
2899
+ },
2900
+ emits: ["select", "viewStateChange"],
2901
+ setup(__props, { emit: __emit }) {
2902
+ const props = __props;
2903
+ const emit = __emit;
2904
+ const { t, locale } = useCollectionI18n();
2905
+ const cui = collectionUi();
2906
+ const { confirm: openConfirm, unpin, pinToggle, startChat } = cui;
2907
+ const appApi = { startNewChat: startChat };
2908
+ /** Embedded when a `slug` prop is supplied; standalone (route-driven)
2909
+ * otherwise. Switches the slug/selected source and the open/close
2910
+ * navigation behaviour. */
2911
+ const embedded = computed(() => props.slug !== void 0);
2912
+ /** Active collection slug: the prop in embedded mode, else the route
2913
+ * param. */
2914
+ const activeSlug = computed(() => {
2915
+ if (props.slug !== void 0) return props.slug;
2916
+ const slug = cui.routeSlug();
2917
+ return slug !== void 0 && slug.length > 0 ? slug : void 0;
2918
+ });
2919
+ /** Active open-record id: the prop in embedded mode (may be undefined),
2920
+ * else the `?selected=` query. */
2921
+ const activeSelected = computed(() => {
2922
+ if (embedded.value) return props.selected;
2923
+ return cui.routeSelectedId();
2924
+ });
2925
+ const collection = ref(null);
2926
+ const items = ref([]);
2927
+ const loading = ref(true);
2928
+ const loadError = ref(null);
2929
+ const dataIssues = ref([]);
2930
+ const notifiedSeverities = computed(() => {
2931
+ const slug = collection.value?.slug;
2932
+ return slug ? cui.notifiedSeverities(slug) : /* @__PURE__ */ new Map();
2933
+ });
2934
+ /** True while a feed collection's manual refresh is in flight. */
2935
+ const refreshing = ref(false);
2936
+ /** Slug already auto-refreshed on first open — prevents a reload loop
2937
+ * (the auto-refresh reloads the view, which would re-trigger otherwise). */
2938
+ const autoRefreshedSlug = ref(null);
2939
+ const editing = ref(null);
2940
+ /** The record currently shown in read-only "open" mode. Distinct
2941
+ * from `editing`: open mode renders formatted values (no inputs)
2942
+ * and is what a `/collections/<slug>?selected=<id>` deep link
2943
+ * lands on. Mutually exclusive with `editing` in practice —
2944
+ * `editFromView` hands off from one to the other. */
2945
+ const viewing = ref(null);
2946
+ /** The calendar day whose time-allocation popup is open, or null. The
2947
+ * selected record (`viewing`) renders in that popup's right pane; a record
2948
+ * with no resolvable day falls back to the panel below the grid. */
2949
+ const openDay = ref(null);
2950
+ const saving = ref(false);
2951
+ const saveError = ref(null);
2952
+ /** Error from an inline table-cell edit (checkbox/dropdown). Distinct
2953
+ * from `saveError` (rendered only inside the detail panel, which is
2954
+ * closed during inline editing) — shown as a banner above the table. */
2955
+ const inlineError = ref(null);
2956
+ /** Per-load snapshot of enum cells that had NO value when fetched
2957
+ * (keyed `<rowId>:<fieldKey>`). Only these cells offer the empty
2958
+ * placeholder option in their inline dropdown — a cell that already
2959
+ * has a value can't be blanked inline (use the edit form for that). */
2960
+ const enumOriginallyEmpty = ref(/* @__PURE__ */ new Set());
2961
+ /** Rows with an inline cell save in flight (by `rowId`). While a row is
2962
+ * here its inline controls are disabled, so two quick edits to the same
2963
+ * row can't race two full-record PUTs — an older PUT landing last would
2964
+ * otherwise clobber the newer field on disk while the UI shows the
2965
+ * newer optimistic value (Codex PR #1599 P2). */
2966
+ const inlineSavingRows = ref(/* @__PURE__ */ new Set());
2967
+ const actionPending = ref(false);
2968
+ const actionError = ref(null);
2969
+ const collectionActionPending = ref(false);
2970
+ const chatOpen = ref(false);
2971
+ const chatMessage = ref("");
2972
+ const chatInputEl = ref(null);
2973
+ const render = useCollectionRendering(collection, locale);
2974
+ const { refRecordCache, refDisplay, formatMoney, resolveCurrency, derivedDisplay, evaluateDerivedAgainstItem, formatCell, isExternalUrl, artifactUrl, fileRoutePath } = render;
2975
+ const searchQuery = ref("");
2976
+ /** Case-insensitive substring match across an item's scalar fields.
2977
+ * Object-valued fields (table rows, nested records) are skipped —
2978
+ * they don't render as searchable text in the list table. */
2979
+ function itemMatchesQuery(item, query) {
2980
+ return Object.values(item).some((val) => {
2981
+ if (val === void 0 || val === null || typeof val === "object") return false;
2982
+ return String(val).toLowerCase().includes(query);
2983
+ });
2984
+ }
2985
+ const filteredItems = computed(() => {
2986
+ const query = searchQuery.value.trim().toLowerCase();
2987
+ if (!query) return items.value;
2988
+ return items.value.filter((item) => itemMatchesQuery(item, query));
2989
+ });
2990
+ function storedSortFor(slug) {
2991
+ return slug && readCollectionSort(slug) || null;
2992
+ }
2993
+ const sortState = ref(storedSortFor(activeSlug.value));
2994
+ const hoveredSortKey = ref(null);
2995
+ function sortDirectionFor(key) {
2996
+ return sortState.value?.field === key ? sortState.value.direction : null;
2997
+ }
2998
+ /** The direction whose visuals to render: on hover, preview the next
2999
+ * click's state; otherwise show the column's actual state. */
3000
+ function effectiveSortDir(key) {
3001
+ const current = sortDirectionFor(key);
3002
+ return hoveredSortKey.value === key ? nextSortDirection(current) : current;
3003
+ }
3004
+ /** Cycle a column none → asc → desc → none; activating one clears the rest. */
3005
+ function cycleSort(key) {
3006
+ const next = nextSortDirection(sortDirectionFor(key));
3007
+ sortState.value = next ? {
3008
+ field: key,
3009
+ direction: next
3010
+ } : null;
3011
+ }
3012
+ function sortIconName(key) {
3013
+ return effectiveSortDir(key) === "desc" ? "arrow_downward" : "arrow_upward";
3014
+ }
3015
+ function sortButtonClass(key) {
3016
+ return effectiveSortDir(key) ? "text-slate-600" : "text-slate-300";
3017
+ }
3018
+ /** ARIA `aria-sort` token for a column's header cell. */
3019
+ function sortAriaValue(key) {
3020
+ const dir = sortDirectionFor(key);
3021
+ return dir === "asc" ? "ascending" : dir === "desc" ? "descending" : "none";
3022
+ }
3023
+ /** Comparable value for scalar fields that key off the raw cell value. */
3024
+ function scalarSortValue(field, raw) {
3025
+ switch (field.type) {
3026
+ case "number":
3027
+ case "money": return numericSortValue(raw);
3028
+ case "date":
3029
+ case "datetime": return dateSortValue(raw);
3030
+ case "enum": return enumSortValue(field.values, raw);
3031
+ case "boolean": return boolSortValue(raw === true);
3032
+ case "ref": return field.to && typeof raw === "string" && raw ? stringSortValue(refDisplay(field.to, raw)) : stringSortValue(raw);
3033
+ default: return stringSortValue(raw);
3034
+ }
3035
+ }
3036
+ /** Comparable value for one row under the active field. Toggle and derived
3037
+ * need the whole record; every other type keys off the raw cell. */
3038
+ function sortValueOf(field, key, item) {
3039
+ if (field.type === "toggle") return boolSortValue(toggleChecked(item, field));
3040
+ if (field.type === "derived") return derivedSortValue(field, key, item);
3041
+ return scalarSortValue(field, item[key]);
3042
+ }
3043
+ /** Derived rows sort by their display type: money/number → numeric,
3044
+ * date/datetime → epoch, anything else → the enriched value as a string. */
3045
+ function derivedSortValue(field, key, item) {
3046
+ const { display } = field;
3047
+ if (display === void 0 || display === "number" || display === "money") return numericSortValue(evaluateDerivedAgainstItem(field, key, item));
3048
+ const enriched = collection.value ? render.deriveAll(collection.value.schema, item, render.refRecordCache.value) : item;
3049
+ if (display === "date" || display === "datetime") return dateSortValue(enriched[key]);
3050
+ return stringSortValue(enriched[key]);
3051
+ }
3052
+ const sortedItems = computed(() => {
3053
+ const state = sortState.value;
3054
+ const field = state ? collection.value?.schema.fields[state.field] : void 0;
3055
+ if (!state || !field) return filteredItems.value;
3056
+ return sortItems(filteredItems.value, state.direction, (item) => sortValueOf(field, state.field, item));
3057
+ });
3058
+ /** Stringified primary-key value for a row (the row's stable identity). */
3059
+ function rowId(item) {
3060
+ const primaryKey = collection.value?.schema.primaryKey;
3061
+ return primaryKey ? String(item[primaryKey] ?? "") : "";
3062
+ }
3063
+ /** Stable key for one cell in the `enumOriginallyEmpty` snapshot. */
3064
+ function cellKey(rowIdValue, fieldKey) {
3065
+ return `${rowIdValue}:${fieldKey}`;
3066
+ }
3067
+ /** Build the set of enum cells that were empty in the freshly-fetched
3068
+ * records — the only cells whose inline dropdown offers an empty option. */
3069
+ function snapshotEmptyEnums(schema, records) {
3070
+ const empty = /* @__PURE__ */ new Set();
3071
+ const enumKeys = Object.entries(schema.fields).filter(([, field]) => field.type === "enum").map(([fieldKey]) => fieldKey);
3072
+ if (enumKeys.length === 0) return empty;
3073
+ for (const record of records) {
3074
+ const recordId = String(record[schema.primaryKey] ?? "");
3075
+ for (const fieldKey of enumKeys) if (record[fieldKey] == null || record[fieldKey] === "") empty.add(cellKey(recordId, fieldKey));
3076
+ }
3077
+ return empty;
3078
+ }
3079
+ /** Whether an inline enum dropdown should render its empty placeholder
3080
+ * option: only for cells with no value at load time. */
3081
+ function showEnumPlaceholder(item, fieldKey) {
3082
+ return enumOriginallyEmpty.value.has(cellKey(rowId(item), fieldKey));
3083
+ }
3084
+ /** Tailwind fill/text/border classes tinting an inline enum `<select>` by its
3085
+ * current value's colour (palette, or notification red/amber/grey when the
3086
+ * field is the schema's notifyWhen target). */
3087
+ function enumControlClass(fieldKey, value) {
3088
+ const schema = collection.value?.schema;
3089
+ if (!schema) return "";
3090
+ const cls = resolveEnumColor(schema, fieldKey, value);
3091
+ return `${cls.badge} ${cls.border}`;
3092
+ }
3093
+ /** This row is the one open in read-only detail. */
3094
+ function isRowOpen(item) {
3095
+ return viewing.value !== null && rowId(viewing.value) === rowId(item);
3096
+ }
3097
+ /** This row is the one being edited (highlights it in the list while the
3098
+ * edit modal is open). Create mode has no backing row, so nothing matches. */
3099
+ function isEditingRow(item) {
3100
+ const draft = editing.value;
3101
+ if (!draft || draft.mode === "create") return false;
3102
+ return draft.originalId === rowId(item);
3103
+ }
3104
+ /** Re-run a feed collection's retrieval now, then reload its records.
3105
+ * Only reachable when `schema.ingest` is present (button is gated). */
3106
+ async function refreshFeed() {
3107
+ const current = collection.value;
3108
+ if (!current?.schema.ingest || refreshing.value) return;
3109
+ refreshing.value = true;
3110
+ inlineError.value = null;
3111
+ const result = await cui.refreshCollection(current.slug);
3112
+ refreshing.value = false;
3113
+ if (!result.ok) {
3114
+ loadError.value = result.error;
3115
+ return;
3116
+ }
3117
+ await loadCollection(current.slug);
3118
+ if (result.data.errors.length > 0) inlineError.value = t("collectionsView.refreshFailed", { error: result.data.errors.join("; ") });
3119
+ }
3120
+ /** Collection-level header actions. No `when` predicate (no record). */
3121
+ const collectionActions = computed(() => collection.value?.schema.collectionActions ?? []);
3122
+ /** Run a collection-level action: ask the server to assemble the seed
3123
+ * prompt (a progress summary of all records + the template), then start
3124
+ * a new chat in the action's role with it. Generic — no domain knowledge. */
3125
+ async function runCollectionAction(action) {
3126
+ const current = collection.value;
3127
+ if (!current || collectionActionPending.value) return;
3128
+ collectionActionPending.value = true;
3129
+ inlineError.value = null;
3130
+ const result = await cui.runCollectionAction(current.slug, action.id);
3131
+ collectionActionPending.value = false;
3132
+ if (!result.ok) {
3133
+ inlineError.value = result.error;
3134
+ return;
3135
+ }
3136
+ if (props.sendTextMessage) {
3137
+ props.sendTextMessage(result.data.prompt);
3138
+ return;
3139
+ }
3140
+ appApi.startNewChat(result.data.prompt, result.data.role);
3141
+ }
3142
+ /** Report the server-detected record data problems back to the LLM so it
3143
+ * fixes the offending files. Mirrors the `presentCollection` validation
3144
+ * path (`dispatchPresentCollection`), but user-initiated via the Repair
3145
+ * button instead of fired automatically after a write. Dispatches into
3146
+ * the current chat when embedded, else seeds a new General chat. */
3147
+ function repairCollection() {
3148
+ const current = collection.value;
3149
+ if (!current || dataIssues.value.length === 0) return;
3150
+ const lines = dataIssues.value.map((issue) => `- ${defangForPrompt(issue.file)}: ${defangForPrompt(issue.problem)}`).join("\n");
3151
+ const prompt = t("collectionsView.repairPrompt", {
3152
+ title: current.title,
3153
+ count: dataIssues.value.length,
3154
+ issues: lines
3155
+ });
3156
+ if (props.sendTextMessage) {
3157
+ props.sendTextMessage(prompt);
3158
+ return;
3159
+ }
3160
+ appApi.startNewChat(prompt, cui.generalRoleId);
3161
+ }
3162
+ /** Actions whose optional `when` predicate matches the open record.
3163
+ * Status-driven buttons (e.g. invoice "Record payment") stay hidden
3164
+ * until the record reaches the matching state. */
3165
+ const visibleActions = computed(() => {
3166
+ const record = viewing.value;
3167
+ if (!record) return [];
3168
+ return (collection.value?.schema.actions ?? []).filter((action) => actionVisible(action, record));
3169
+ });
3170
+ /** Run a schema-declared action on the open record: ask the server to
3171
+ * assemble the seed prompt, then start a new chat in the action's
3172
+ * role with it. Generic — no knowledge of what the action does. */
3173
+ async function runAction(action) {
3174
+ if (!collection.value || !viewing.value) return;
3175
+ const itemId = String(viewing.value[collection.value.schema.primaryKey] ?? "");
3176
+ if (!itemId) return;
3177
+ actionPending.value = true;
3178
+ actionError.value = null;
3179
+ const result = await cui.runItemAction(collection.value.slug, itemId, action.id);
3180
+ actionPending.value = false;
3181
+ if (!result.ok) {
3182
+ actionError.value = result.error;
3183
+ return;
3184
+ }
3185
+ if (props.sendTextMessage) {
3186
+ props.sendTextMessage(result.data.prompt);
3187
+ return;
3188
+ }
3189
+ appApi.startNewChat(result.data.prompt, result.data.role);
3190
+ }
3191
+ /** Open the chat modal, blanking any prior draft and focusing the input. */
3192
+ function openChat() {
3193
+ chatMessage.value = "";
3194
+ chatOpen.value = true;
3195
+ nextTick(() => chatInputEl.value?.focus());
3196
+ }
3197
+ function closeChat() {
3198
+ chatOpen.value = false;
3199
+ }
3200
+ /** Build the chat seed text for the current view.
3201
+ *
3202
+ * A collection IS a skill, so its slug doubles as a slash command:
3203
+ * "I want to create an item" on `mc_worklog` becomes
3204
+ * `/mc_worklog I want to create an item`.
3205
+ *
3206
+ * A feed is data-only — it has NO skill, so `/<slug>` would resolve to
3207
+ * nothing. Instead, point the agent at the feed's schema + records
3208
+ * (`feeds/<slug>/schema.json` and `<dataPath>/`) and let it act on the
3209
+ * request directly. */
3210
+ function buildChatSeed(slug, message) {
3211
+ const schema = collection.value?.schema;
3212
+ if (!schema?.ingest) return `/${slug} ${message}`;
3213
+ return t("collectionsView.feedChatSeed", {
3214
+ slug,
3215
+ dataPath: schema.dataPath ?? `data/feeds/${slug}`,
3216
+ message
3217
+ });
3218
+ }
3219
+ /** Start a new general-role chat seeded from the current view. */
3220
+ function submitChat() {
3221
+ if (!collection.value) return;
3222
+ const message = chatMessage.value.trim();
3223
+ if (!message) return;
3224
+ closeChat();
3225
+ const text = buildChatSeed(collection.value.slug, message);
3226
+ if (props.sendTextMessage) {
3227
+ props.sendTextMessage(text);
3228
+ return;
3229
+ }
3230
+ appApi.startNewChat(text, cui.generalRoleId);
3231
+ }
3232
+ async function loadCollection(slug) {
3233
+ const requestedKind = !embedded.value && cui.isFeedRoute() ? "feed" : "collection";
3234
+ loading.value = true;
3235
+ loadError.value = null;
3236
+ collection.value = null;
3237
+ items.value = [];
3238
+ dataIssues.value = [];
3239
+ searchQuery.value = "";
3240
+ render.resetLinkedCaches();
3241
+ viewing.value = null;
3242
+ openDay.value = null;
3243
+ const result = await cui.fetchCollectionDetail(slug);
3244
+ loading.value = false;
3245
+ if (!result.ok) {
3246
+ loadError.value = result.status === 404 ? "not-found" : result.error;
3247
+ if (result.status === 404 && !embedded.value && activeSlug.value === slug) unpin(requestedKind, slug);
3248
+ return;
3249
+ }
3250
+ collection.value = result.data.collection;
3251
+ items.value = result.data.items;
3252
+ dataIssues.value = result.data.issues ?? [];
3253
+ enumOriginallyEmpty.value = snapshotEmptyEnums(result.data.collection.schema, result.data.items);
3254
+ await render.loadLinkedCollections(result.data.collection.schema, slug);
3255
+ if (collection.value?.slug === slug) {
3256
+ syncViewToSelected();
3257
+ maybeOpenCalendarForSelected();
3258
+ }
3259
+ maybeAutoRefreshFeed(slug);
3260
+ }
3261
+ function maybeAutoRefreshFeed(slug) {
3262
+ if (embedded.value) return;
3263
+ const current = collection.value;
3264
+ if (current?.slug !== slug || !current.schema.ingest) return;
3265
+ if (items.value.length > 0 || autoRefreshedSlug.value === slug) return;
3266
+ autoRefreshedSlug.value = slug;
3267
+ refreshFeed();
3268
+ }
3269
+ /** Schema fields excluding display-only `embed` fields — used by the
3270
+ * list table only (a whole embedded record doesn't fit a table cell,
3271
+ * and it'd be identical in every row). The detail modal and the edit
3272
+ * form iterate the full `schema.fields` so embeds render there too. */
3273
+ const listColumnFields = computed(() => collection.value ? Object.entries(collection.value.schema.fields).filter(([key, field]) => field.type !== "embed" && field.type !== "image" && key !== collection.value?.schema.primaryKey) : []);
3274
+ /** True when the current collection declares `schema.singleton` —
3275
+ * exactly one record, its primary key fixed to the declared value. */
3276
+ const isSingleton = computed(() => Boolean(collection.value?.schema.singleton));
3277
+ /** Whether the Add button should show. Always for a normal collection;
3278
+ * for a singleton only until its one record exists. */
3279
+ const canCreate = computed(() => {
3280
+ if (!collection.value) return false;
3281
+ return !(isSingleton.value && items.value.length > 0);
3282
+ });
3283
+ const canDeleteCollection = computed(() => {
3284
+ const current = collection.value;
3285
+ if (!current) return false;
3286
+ return current.source === "project" && !current.slug.startsWith("mc-");
3287
+ });
3288
+ const isFeed = computed(() => Boolean(collection.value?.schema.ingest));
3289
+ const canDeleteFeed = computed(() => isFeed.value && !embedded.value);
3290
+ const isFeedRoute = computed(() => !embedded.value && cui.isFeedRoute());
3291
+ /** The view to open with: the embedded card's restored `initialView` if
3292
+ * present (its own persisted state wins), else the slug's stored
3293
+ * preference, else "table". Embedded cards READ the store but never WRITE
3294
+ * it (the persist watch only emits `viewStateChange` for them), so a stale
3295
+ * card re-rendering can't clobber the shared preference. */
3296
+ function initialViewMode() {
3297
+ if (props.initialView) return props.initialView;
3298
+ const slug = activeSlug.value;
3299
+ return slug && readCollectionViewMode(slug) || "table";
3300
+ }
3301
+ const view = ref(initialViewMode());
3302
+ /** `date` / `datetime` fields in declaration order — the calendar can anchor
3303
+ * on any (a `datetime` anchor also carries the clock for the day view). */
3304
+ const dateFields = computed(() => collection.value ? Object.entries(collection.value.schema.fields).filter(([, field]) => field.type === "date" || field.type === "datetime").map(([key]) => key) : []);
3305
+ /** Whether the table ↔ calendar toggle is offered. */
3306
+ const hasCalendar = computed(() => dateFields.value.length > 0);
3307
+ /** `enum` fields in declaration order — the kanban can group on any. */
3308
+ const enumFields = computed(() => collection.value ? Object.entries(collection.value.schema.fields).filter(([, field]) => field.type === "enum").map(([key]) => key) : []);
3309
+ /** Whether the kanban toggle is offered (needs an `enum` field to group on). */
3310
+ const hasKanban = computed(() => enumFields.value.length > 0);
3311
+ /** The effective view, collapsing any stale mode whose enabling field
3312
+ * vanished (e.g. `view = "kanban"` after switching to an enum-less
3313
+ * collection) back to "table". Single source of truth for the toggle and
3314
+ * the body branches. */
3315
+ /** Custom (LLM-authored) HTML views declared on the schema. */
3316
+ const customViews = computed(() => collection.value?.schema.views ?? []);
3317
+ const hasCustomViews = computed(() => customViews.value.length > 0);
3318
+ const activeView = computed(() => {
3319
+ if (view.value === "calendar" && hasCalendar.value) return "calendar";
3320
+ if (view.value === "kanban" && hasKanban.value) return "kanban";
3321
+ if (view.value.startsWith("custom:")) {
3322
+ const viewId = view.value.slice(7);
3323
+ if (customViews.value.some((entry) => entry.id === viewId)) return view.value;
3324
+ }
3325
+ return "table";
3326
+ });
3327
+ /** The selected custom view's spec, or null when a built-in view is active. */
3328
+ const activeCustomView = computed(() => {
3329
+ const mode = activeView.value;
3330
+ if (!mode.startsWith("custom:")) return null;
3331
+ const viewId = mode.slice(7);
3332
+ return customViews.value.find((entry) => entry.id === viewId) ?? null;
3333
+ });
3334
+ /** Narrow a (possibly custom) mode to a built-in one, used where only the
3335
+ * built-in views are representable (the embedded card's viewState). */
3336
+ function builtInViewOrTable(mode) {
3337
+ return mode === "calendar" || mode === "kanban" ? mode : "table";
3338
+ }
3339
+ /** Whether to offer the "+" (author a new custom view) button. Standalone
3340
+ * page only (the seed starts a chat). Feeds qualify too — their views are
3341
+ * authored under feeds/<slug>/ and the seed prompt points there. */
3342
+ const canAddCustomView = computed(() => Boolean(collection.value) && !embedded.value);
3343
+ /** Seed a chat asking Claude to author a new custom view for this collection.
3344
+ * Reuses the same chat-seed path as collection actions — the host injects a
3345
+ * templated prompt; Claude asks, authors the HTML, and registers it. The
3346
+ * authoring base is source-aware: a feed lives under `feeds/<slug>/`, every
3347
+ * other collection under the `data/skills/<slug>/` staging dir. */
3348
+ function addCustomView() {
3349
+ const current = collection.value;
3350
+ if (!current) return;
3351
+ const base = current.schema.ingest ? `feeds/${current.slug}` : `data/skills/${current.slug}`;
3352
+ const prompt = t("collectionsView.addViewPrompt", {
3353
+ title: current.title,
3354
+ base
3355
+ });
3356
+ if (props.sendTextMessage) {
3357
+ props.sendTextMessage(prompt);
3358
+ return;
3359
+ }
3360
+ appApi.startNewChat(prompt, cui.generalRoleId);
3361
+ }
3362
+ const configOpen = ref(false);
3363
+ /** Whether to offer the config gear. Standalone page only, and only when
3364
+ * there's a deletable custom view to manage — i.e. the collection is one
3365
+ * whose views the server will delete (project non-preset, or a feed; never a
3366
+ * read-only user-scope skill). Mirrors the server's refusal rules. */
3367
+ const canConfigureViews = computed(() => !embedded.value && hasCustomViews.value && (canDeleteCollection.value || isFeed.value));
3368
+ /** Reload the collection after the config modal deletes a view so the toggle
3369
+ * row + the modal's own list reflect the removal. */
3370
+ async function onViewsChanged() {
3371
+ const current = collection.value;
3372
+ if (current) await loadCollection(current.slug);
3373
+ }
3374
+ /** True when the calendar is the active body. */
3375
+ const calendarActive = computed(() => activeView.value === "calendar");
3376
+ /** True when the kanban is the active body. */
3377
+ const kanbanActive = computed(() => activeView.value === "kanban");
3378
+ const kanbanOverride = ref(props.initialGroupField ?? null);
3379
+ const kanbanGroupField = computed(() => {
3380
+ if (kanbanOverride.value && enumFields.value.includes(kanbanOverride.value)) return kanbanOverride.value;
3381
+ const hint = collection.value?.schema.kanbanField;
3382
+ if (hint && enumFields.value.includes(hint)) return hint;
3383
+ return enumFields.value[0] ?? "";
3384
+ });
3385
+ const anchorOverride = ref(props.initialAnchorField ?? null);
3386
+ const calendarAnchorField = computed(() => {
3387
+ if (anchorOverride.value && dateFields.value.includes(anchorOverride.value)) return anchorOverride.value;
3388
+ const hint = collection.value?.schema.calendarField;
3389
+ if (hint && dateFields.value.includes(hint)) return hint;
3390
+ return dateFields.value[0] ?? "";
3391
+ });
3392
+ const calendarEndField = computed(() => {
3393
+ const schema = collection.value?.schema;
3394
+ if (!schema?.calendarEndField) return void 0;
3395
+ return calendarAnchorField.value === schema.calendarField ? schema.calendarEndField : void 0;
3396
+ });
3397
+ const calendarTimeField = computed(() => {
3398
+ const schema = collection.value?.schema;
3399
+ if (!schema?.calendarTimeField) return void 0;
3400
+ return calendarAnchorField.value === schema.calendarField ? schema.calendarTimeField : void 0;
3401
+ });
3402
+ function setView(next) {
3403
+ view.value = next;
3404
+ }
3405
+ /** Select a custom view by id (builds the `custom:<id>` mode key). */
3406
+ function setCustomView(viewId) {
3407
+ view.value = `custom:${viewId}`;
3408
+ }
3409
+ /** Selector-key for a custom view, for active-state comparison in the template. */
3410
+ function customViewKey(viewId) {
3411
+ return `custom:${viewId}`;
3412
+ }
3413
+ /** A short, slug-safe id not already used by a loaded record. Collisions
3414
+ * are astronomically unlikely (32 bits), but we still re-roll a few
3415
+ * times against the in-memory set before giving up and using the last
3416
+ * candidate (the server's overwrite guard is the final backstop). */
3417
+ function generateUniqueItemId(primaryKey) {
3418
+ const existing = new Set(items.value.map((item) => String(item[primaryKey] ?? "")));
3419
+ let candidate = shortHexId();
3420
+ for (let attempt = 0; attempt < 8 && existing.has(candidate); attempt++) candidate = shortHexId();
3421
+ return candidate;
3422
+ }
3423
+ function openCreate() {
3424
+ if (!collection.value) return;
3425
+ const text = {};
3426
+ const bool = {};
3427
+ const boolOriginallyPresent = {};
3428
+ const boolTouched = {};
3429
+ const table = {};
3430
+ for (const [key, field] of Object.entries(collection.value.schema.fields)) if (field.type === "boolean") {
3431
+ bool[key] = false;
3432
+ boolOriginallyPresent[key] = false;
3433
+ boolTouched[key] = false;
3434
+ } else if (field.type === "table") table[key] = [];
3435
+ else if (field.type !== "derived" && field.type !== "embed" && field.type !== "toggle") text[key] = "";
3436
+ const { singleton, primaryKey } = collection.value.schema;
3437
+ if (singleton) text[primaryKey] = singleton;
3438
+ else if (primaryKey in text) text[primaryKey] = generateUniqueItemId(primaryKey);
3439
+ viewing.value = null;
3440
+ editing.value = {
3441
+ mode: "create",
3442
+ text,
3443
+ bool,
3444
+ boolOriginallyPresent,
3445
+ boolTouched,
3446
+ table,
3447
+ originalId: null
3448
+ };
3449
+ saveError.value = null;
3450
+ }
3451
+ function openEdit(item) {
3452
+ if (!collection.value) return;
3453
+ const text = {};
3454
+ const bool = {};
3455
+ const boolOriginallyPresent = {};
3456
+ const boolTouched = {};
3457
+ const table = {};
3458
+ for (const [key, field] of Object.entries(collection.value.schema.fields)) {
3459
+ const raw = item[key];
3460
+ if (field.type === "boolean") {
3461
+ bool[key] = raw === true;
3462
+ boolOriginallyPresent[key] = typeof raw === "boolean";
3463
+ boolTouched[key] = false;
3464
+ } else if (field.type === "table" && field.of) {
3465
+ const sub = field.of;
3466
+ table[key] = (Array.isArray(raw) ? raw : []).filter((row) => Boolean(row) && typeof row === "object" && !Array.isArray(row)).map((row) => rowFromItem(row, sub));
3467
+ } else if (field.type !== "derived" && field.type !== "embed" && field.type !== "toggle") text[key] = raw === void 0 || raw === null ? "" : String(raw);
3468
+ }
3469
+ const primaryRaw = item[collection.value.schema.primaryKey];
3470
+ const originalId = typeof primaryRaw === "string" ? primaryRaw : String(primaryRaw ?? "");
3471
+ viewing.value = null;
3472
+ editing.value = {
3473
+ mode: "edit",
3474
+ text,
3475
+ bool,
3476
+ boolOriginallyPresent,
3477
+ boolTouched,
3478
+ table,
3479
+ originalId
3480
+ };
3481
+ saveError.value = null;
3482
+ }
3483
+ function closeEditor() {
3484
+ editing.value = null;
3485
+ saving.value = false;
3486
+ saveError.value = null;
3487
+ }
3488
+ /** Cancel the editor. Edit → reopen the record's read-only detail (don't
3489
+ * collapse the panel); create → just close (no prior detail to show). */
3490
+ function cancelEditor() {
3491
+ const draft = editing.value;
3492
+ const returnTo = draft && draft.mode === "edit" ? draft.originalId : null;
3493
+ closeEditor();
3494
+ if (returnTo) {
3495
+ const item = findItemById(returnTo);
3496
+ if (item) showDetail(item);
3497
+ }
3498
+ }
3499
+ /** Open mode (read-only detail). Toggles: clicking the already-open row
3500
+ * collapses it. Opening a row cancels any in-progress edit (one panel
3501
+ * open at a time). In embedded mode, report the open id so the host
3502
+ * card can persist it in `viewState`. */
3503
+ function openView(item) {
3504
+ if (isRowOpen(item) && !editing.value) {
3505
+ closeView();
3506
+ return;
3507
+ }
3508
+ if (editing.value) closeEditor();
3509
+ showDetail(item);
3510
+ }
3511
+ /** Open the read-only detail for a record WITHOUT the click-toggle. Used
3512
+ * when reopening detail programmatically (after save / cancel), where
3513
+ * `openView`'s "click the open row to collapse" guard would otherwise
3514
+ * immediately close a row the embedded `viewState` sync just reopened. */
3515
+ function showDetail(item) {
3516
+ viewing.value = item;
3517
+ actionError.value = null;
3518
+ if (embedded.value && collection.value) emit("select", String(item[collection.value.schema.primaryKey] ?? ""));
3519
+ }
3520
+ /** Close open mode. Embedded mode reports the close via `select(null)`
3521
+ * (the card clears its `viewState`); standalone mode drops the
3522
+ * `?selected=` query param so a refresh / back-button doesn't reopen
3523
+ * the record and the URL reflects the closed state. */
3524
+ function closeView() {
3525
+ viewing.value = null;
3526
+ actionError.value = null;
3527
+ if (embedded.value) {
3528
+ emit("select", null);
3529
+ return;
3530
+ }
3531
+ if (cui.routeSelectedId() !== void 0) cui.setSelectedId(null);
3532
+ }
3533
+ /** Backdrop click / Escape on the shared record modal. While editing this
3534
+ * cancels the draft (reopening the detail, matching the in-panel Cancel
3535
+ * button — so a stray click never silently discards edits); while viewing
3536
+ * it closes the detail. */
3537
+ function closeRecordModal() {
3538
+ if (editing.value) {
3539
+ cancelEditor();
3540
+ return;
3541
+ }
3542
+ closeView();
3543
+ }
3544
+ /** Hand off from open mode to the editor for the same record. */
3545
+ function editFromView() {
3546
+ const item = viewing.value;
3547
+ if (!item) return;
3548
+ viewing.value = null;
3549
+ openEdit(item);
3550
+ }
3551
+ function findItemById(itemId) {
3552
+ if (!collection.value) return void 0;
3553
+ const { primaryKey } = collection.value.schema;
3554
+ return items.value.find((item) => String(item[primaryKey] ?? "") === itemId);
3555
+ }
3556
+ /** Reconcile the open-mode view with the `?selected=<id>` query —
3557
+ * the single source of truth for which record is open. Opens the
3558
+ * matching record, or closes the modal when the param is absent /
3559
+ * empty / points at an id that isn't loaded (deleted record, stale
3560
+ * link). Keeping `viewing` in lockstep with the URL means browser
3561
+ * back / forward and a removed param both close the modal instead
3562
+ * of leaving stale UI on screen (Codex P2 + CodeRabbit on #1502). */
3563
+ function syncViewToSelected() {
3564
+ const selected = activeSelected.value;
3565
+ if (typeof selected !== "string" || selected.length === 0) {
3566
+ viewing.value = null;
3567
+ return;
3568
+ }
3569
+ viewing.value = findItemById(selected) ?? null;
3570
+ }
3571
+ /** Title for the open-mode header: the record's primary-key value
3572
+ * (e.g. `INV-2026-0001`), falling back to the collection title.
3573
+ * Non-string primary keys (numeric ids) are stringified rather
3574
+ * than discarded (CodeRabbit on #1502). */
3575
+ const viewTitle = computed(() => {
3576
+ if (!viewing.value || !collection.value) return "";
3577
+ const pkValue = viewing.value[collection.value.schema.primaryKey];
3578
+ if (pkValue === void 0 || pkValue === null || pkValue === "") return collection.value.title ?? "";
3579
+ return String(pkValue);
3580
+ });
3581
+ /** Live computed record from the current draft. Drives derived
3582
+ * field displays in the form so subtotal/tax/total update as
3583
+ * the user edits line items. */
3584
+ const liveRecord = computed(() => {
3585
+ if (!collection.value || !editing.value) return null;
3586
+ return draftToRecord(editing.value, collection.value.schema);
3587
+ });
3588
+ /** Live record with derived fields resolved (drives the form's
3589
+ * read-only derived inputs). Derivation lives in the shared
3590
+ * rendering composable; this binds it to the current draft. */
3591
+ const liveDerived = computed(() => {
3592
+ if (!collection.value || !liveRecord.value) return null;
3593
+ return render.deriveAll(collection.value.schema, liveRecord.value, refRecordCache.value);
3594
+ });
3595
+ /** Short summary for a `table`-typed cell in the main collection
3596
+ * table. Counts rows; nothing fancier yet (per-row preview is
3597
+ * hard to fit in a single cell). */
3598
+ function tableSummary(value) {
3599
+ if (!Array.isArray(value)) return "—";
3600
+ if (value.length === 0) return "—";
3601
+ return t("collectionsView.tableSummary", { count: value.length });
3602
+ }
3603
+ async function saveEditor() {
3604
+ if (!collection.value || !editing.value) return;
3605
+ const { slug, schema } = collection.value;
3606
+ const draft = editing.value;
3607
+ saveError.value = null;
3608
+ const missing = firstMissingRequiredField(draft, schema);
3609
+ if (missing) {
3610
+ saveError.value = `${missing}: ${t("collectionsView.requiredField")}`;
3611
+ return;
3612
+ }
3613
+ saving.value = true;
3614
+ const record = draftToRecord(draft, schema);
3615
+ const result = draft.mode === "create" ? await cui.createItem(slug, record) : await cui.updateItem(slug, draft.originalId ?? "", record);
3616
+ saving.value = false;
3617
+ if (!result.ok) {
3618
+ saveError.value = result.error;
3619
+ return;
3620
+ }
3621
+ const savedId = result.data.itemId;
3622
+ closeEditor();
3623
+ await loadCollection(slug);
3624
+ const saved = findItemById(savedId);
3625
+ if (saved) showDetail(saved);
3626
+ }
3627
+ /** Write a single cell's value directly onto the live `items` entry.
3628
+ * Reactive in Vue 3 (proxy), so the bound checkbox/select re-renders.
3629
+ * `undefined` (enum cleared to the placeholder) renders as the empty
3630
+ * option; the PUT body omits the key via `buildUpdatedRecord`. */
3631
+ function applyInlineValue(item, key, value) {
3632
+ item[key] = value;
3633
+ }
3634
+ /** True while this row has an inline cell save in flight — its inline
3635
+ * controls render disabled to serialize edits (one PUT per row). */
3636
+ function isRowInlineSaving(item) {
3637
+ return inlineSavingRows.value.has(rowId(item));
3638
+ }
3639
+ /** Inline table-cell edit (boolean checkbox / enum dropdown): optimistic
3640
+ * update, then PUT the full record. Gated per row so a second edit can't
3641
+ * race the in-flight one. On failure, roll the cell back and surface the
3642
+ * error. Bypasses the detail/edit panel entirely. */
3643
+ async function commitInlineEdit(item, key, field, raw) {
3644
+ if (!collection.value) return;
3645
+ const { slug } = collection.value;
3646
+ const itemId = rowId(item);
3647
+ if (!itemId || inlineSavingRows.value.has(itemId)) return;
3648
+ const previous = item[key];
3649
+ const coerced = coerceInlineValue(field, raw);
3650
+ applyInlineValue(item, key, coerced);
3651
+ inlineError.value = null;
3652
+ inlineSavingRows.value.add(itemId);
3653
+ const result = await cui.updateItem(slug, itemId, buildUpdatedRecord(item, key, coerced));
3654
+ inlineSavingRows.value.delete(itemId);
3655
+ if (!result.ok) {
3656
+ applyInlineValue(item, key, previous);
3657
+ inlineError.value = result.error;
3658
+ }
3659
+ }
3660
+ /** Whether a `toggle` field reads as checked: its projected enum field
3661
+ * currently equals `onValue`. The toggle stores nothing itself. */
3662
+ function toggleChecked(item, field) {
3663
+ return field.field !== void 0 && String(item[field.field] ?? "") === field.onValue;
3664
+ }
3665
+ /** Flip a `toggle`: write the projected enum field to `offValue` when
3666
+ * currently checked, else `onValue`. Reuses the inline-edit PUT path
3667
+ * (optimistic + rollback) — the toggle has no value of its own. */
3668
+ function commitToggle(item, field) {
3669
+ const targetKey = field.field;
3670
+ if (!targetKey || !collection.value) return;
3671
+ const enumField = collection.value.schema.fields[targetKey];
3672
+ if (!enumField) return;
3673
+ const next = toggleChecked(item, field) ? field.offValue : field.onValue;
3674
+ if (next === void 0) return;
3675
+ commitInlineEdit(item, targetKey, enumField, next);
3676
+ }
3677
+ async function confirmDelete(item) {
3678
+ if (!collection.value) return;
3679
+ const { slug } = collection.value;
3680
+ const { primaryKey } = collection.value.schema;
3681
+ const idRaw = item[primaryKey];
3682
+ const itemId = typeof idRaw === "string" ? idRaw : String(idRaw ?? "");
3683
+ if (!itemId) return;
3684
+ if (!await openConfirm({
3685
+ message: t("collectionsView.confirmDelete"),
3686
+ confirmText: t("common.remove"),
3687
+ cancelText: t("common.cancel"),
3688
+ variant: "danger"
3689
+ })) return;
3690
+ const result = await cui.deleteItem(slug, itemId);
3691
+ if (!result.ok) {
3692
+ loadError.value = result.error;
3693
+ return;
3694
+ }
3695
+ await loadCollection(slug);
3696
+ }
3697
+ async function confirmCollectionDelete() {
3698
+ const current = collection.value;
3699
+ if (!current) return;
3700
+ const { slug, title } = current;
3701
+ if (!await openConfirm({
3702
+ message: t("collectionsView.confirmDeleteCollection", { title }),
3703
+ confirmText: t("common.remove"),
3704
+ cancelText: t("common.cancel"),
3705
+ variant: "danger"
3706
+ })) return;
3707
+ const result = await cui.deleteCollection(slug);
3708
+ if (!result.ok) {
3709
+ loadError.value = result.error;
3710
+ return;
3711
+ }
3712
+ cui.gotoIndex("collection");
3713
+ }
3714
+ function goBack() {
3715
+ cui.gotoIndex(isFeedRoute.value ? "feed" : "collection");
3716
+ }
3717
+ async function confirmFeedDelete() {
3718
+ const current = collection.value;
3719
+ if (!current) return;
3720
+ const { slug, title } = current;
3721
+ if (!await openConfirm({
3722
+ message: t("collectionsView.confirmDeleteFeed", { title }),
3723
+ confirmText: t("common.remove"),
3724
+ cancelText: t("common.cancel"),
3725
+ variant: "danger"
3726
+ })) return;
3727
+ const result = await cui.deleteFeed(slug);
3728
+ if (!result.ok) {
3729
+ loadError.value = result.error;
3730
+ return;
3731
+ }
3732
+ cui.gotoIndex("feed");
3733
+ }
3734
+ /** Open the create form with the clicked calendar day prefilled into the
3735
+ * anchor field. The calendar day view's + affordance; the create flow itself
3736
+ * is the same one the Add button uses. A `datetime` anchor renders as a
3737
+ * `datetime-local` input, which rejects a bare `YYYY-MM-DD` — seed midnight
3738
+ * so the chosen day actually survives the prefill. */
3739
+ function createOnDate(iso) {
3740
+ if (!canCreate.value) return;
3741
+ openCreate();
3742
+ const anchor = calendarAnchorField.value;
3743
+ if (!editing.value || !anchor) return;
3744
+ const anchorType = collection.value?.schema.fields[anchor]?.type;
3745
+ editing.value.text[anchor] = anchorType === "datetime" ? `${iso}T00:00` : iso;
3746
+ }
3747
+ /** The civil day a record sits on, from its calendar anchor field (handles
3748
+ * both `date` and `datetime`). Null for undated records. */
3749
+ function dayOfItem(item) {
3750
+ return dateOf(item[calendarAnchorField.value]);
3751
+ }
3752
+ /** Mirror the open record into the `?selected=<id>` query (standalone mode)
3753
+ * so the calendar's day-view + selection is a copy-pasteable link. In-app
3754
+ * selection didn't previously touch the URL; the calendar now does. */
3755
+ function writeSelectedToUrl(itemId) {
3756
+ if (embedded.value || cui.routeSelectedId() === itemId) return;
3757
+ cui.setSelectedId(itemId);
3758
+ }
3759
+ /** Calendar chip / kanban card click → open that record's detail. In the
3760
+ * calendar it opens the day (time-allocation) popup on the record's day with
3761
+ * the detail in the right pane; an undated record falls back to the panel
3762
+ * below the grid. Unlike `openView`, this never toggles — a second click on
3763
+ * the same record keeps it open. */
3764
+ function onCalendarSelect(itemId) {
3765
+ if (!itemId) {
3766
+ closeView();
3767
+ return;
3768
+ }
3769
+ const item = findItemById(itemId);
3770
+ if (!item) return;
3771
+ if (editing.value) closeEditor();
3772
+ if (calendarActive.value) openDay.value = dayOfItem(item);
3773
+ showDetail(item);
3774
+ writeSelectedToUrl(itemId);
3775
+ }
3776
+ /** A calendar day cell was activated → open its popup on a clean slate
3777
+ * (clear any prior selection so the popup opens timeline-only). */
3778
+ function onOpenDay(day) {
3779
+ if (editing.value) closeEditor();
3780
+ closeView();
3781
+ openDay.value = day;
3782
+ }
3783
+ /** Close the day popup: drop the open day, the selection, AND any in-progress
3784
+ * draft together. Clearing `editing` matters because the shared record modal
3785
+ * shows whenever `editing` is set and no day is open — so without this, an
3786
+ * edit/create started inside the day popup would re-appear in the centred
3787
+ * modal the instant the popup closed (Codex P2 on #1656). */
3788
+ function onDayClose() {
3789
+ openDay.value = null;
3790
+ if (editing.value) closeEditor();
3791
+ closeView();
3792
+ }
3793
+ /** Deep-link entry: a `?selected=<id>` link to a calendar-capable collection
3794
+ * opens in calendar view with the popup focused on the record's day. Runs
3795
+ * on load / slug change only (not on in-app selection), so table users
3796
+ * aren't forced into the calendar. */
3797
+ function maybeOpenCalendarForSelected() {
3798
+ if (embedded.value || !hasCalendar.value || !viewing.value) return;
3799
+ const day = dayOfItem(viewing.value);
3800
+ if (!day) return;
3801
+ view.value = "calendar";
3802
+ openDay.value = day;
3803
+ }
3804
+ /** Kanban card dropped in a column → set the record's group field to the
3805
+ * column value (the empty string clears it for the Uncategorized column).
3806
+ * Reuses the inline-edit path (optimistic write + PUT + rollback). */
3807
+ function onKanbanMove(itemId, value) {
3808
+ const item = findItemById(itemId);
3809
+ const key = kanbanGroupField.value;
3810
+ const field = collection.value?.schema.fields[key];
3811
+ if (!item || !field) return;
3812
+ commitInlineEdit(item, key, field, value);
3813
+ }
3814
+ watch(activeSlug, (slug, prevSlug) => {
3815
+ if (prevSlug !== void 0 && slug !== prevSlug) {
3816
+ view.value = slug && readCollectionViewMode(slug) || "table";
3817
+ anchorOverride.value = null;
3818
+ kanbanOverride.value = null;
3819
+ sortState.value = storedSortFor(slug);
3820
+ }
3821
+ if (slug) loadCollection(slug);
3822
+ else {
3823
+ collection.value = null;
3824
+ items.value = [];
3825
+ enumOriginallyEmpty.value = /* @__PURE__ */ new Set();
3826
+ inlineSavingRows.value = /* @__PURE__ */ new Set();
3827
+ searchQuery.value = "";
3828
+ loading.value = false;
3829
+ }
3830
+ }, { immediate: true });
3831
+ watch([
3832
+ activeView,
3833
+ calendarAnchorField,
3834
+ kanbanGroupField,
3835
+ sortState,
3836
+ loading
3837
+ ], () => {
3838
+ if (embedded.value) emit("viewStateChange", {
3839
+ view: builtInViewOrTable(activeView.value),
3840
+ anchorField: calendarAnchorField.value,
3841
+ groupField: kanbanGroupField.value
3842
+ });
3843
+ if (activeSlug.value && !loading.value && collection.value) {
3844
+ if (!embedded.value) writeCollectionViewMode(activeSlug.value, activeView.value);
3845
+ writeCollectionSort(activeSlug.value, sortState.value);
3846
+ }
3847
+ });
3848
+ watch(activeSelected, () => {
3849
+ if (loading.value || !collection.value) return;
3850
+ syncViewToSelected();
3851
+ openDay.value = viewing.value ? dayOfItem(viewing.value) : null;
3852
+ });
3853
+ return (_ctx, _cache) => {
3854
+ const _component_router_link = resolveComponent("router-link");
3855
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
3856
+ createElementVNode("header", _hoisted_2$2, [
3857
+ !embedded.value ? (openBlock(), createElementBlock("button", {
3858
+ key: 0,
3859
+ type: "button",
3860
+ class: "h-8 w-8 flex items-center justify-center rounded text-slate-500 hover:bg-slate-50 hover:text-slate-800 transition-colors",
3861
+ title: unref(t)("collectionsView.backToIndex"),
3862
+ "aria-label": unref(t)("collectionsView.backToIndex"),
3863
+ "data-testid": "collections-back",
3864
+ onClick: goBack
3865
+ }, [..._cache[25] || (_cache[25] = [createElementVNode("span", { class: "material-icons text-lg" }, "arrow_back", -1)])], 8, _hoisted_3$2)) : createCommentVNode("", true),
3866
+ collection.value ? (openBlock(), createElementBlock("div", _hoisted_4$2, [createElementVNode("span", _hoisted_5$2, toDisplayString(collection.value.icon), 1)])) : createCommentVNode("", true),
3867
+ createElementVNode("div", _hoisted_6$2, [createElementVNode("h1", _hoisted_7$2, toDisplayString(collection.value?.title ?? unref(t)("collectionsView.title")), 1), collection.value ? (openBlock(), createElementBlock("span", _hoisted_8$2, toDisplayString(collection.value.slug), 1)) : createCommentVNode("", true)]),
3868
+ collection.value && !embedded.value ? (openBlock(), createBlock(resolveDynamicComponent(unref(pinToggle)), {
3869
+ key: 2,
3870
+ kind: isFeedRoute.value ? "feed" : "collection",
3871
+ slug: collection.value.slug,
3872
+ title: collection.value.title,
3873
+ icon: collection.value.icon
3874
+ }, null, 8, [
3875
+ "kind",
3876
+ "slug",
3877
+ "title",
3878
+ "icon"
3879
+ ])) : createCommentVNode("", true),
3880
+ collection.value?.schema.ingest ? (openBlock(), createElementBlock("button", {
3881
+ key: 3,
3882
+ type: "button",
3883
+ class: "h-8 px-2.5 flex items-center gap-1 rounded border border-indigo-200 bg-white hover:bg-indigo-50 text-indigo-600 font-bold text-xs transition-colors disabled:opacity-50",
3884
+ disabled: refreshing.value,
3885
+ "data-testid": "collections-refresh-feed",
3886
+ onClick: refreshFeed
3887
+ }, [createElementVNode("span", _hoisted_10$2, toDisplayString(refreshing.value ? "hourglass_empty" : "refresh"), 1), createElementVNode("span", null, toDisplayString(unref(t)("collectionsView.refreshFeed")), 1)], 8, _hoisted_9$2)) : createCommentVNode("", true),
3888
+ collection.value ? (openBlock(), createElementBlock("button", {
3889
+ key: 4,
3890
+ type: "button",
3891
+ class: "h-8 px-2.5 flex items-center gap-1 rounded border border-indigo-200 bg-white hover:bg-indigo-50 text-indigo-600 font-bold text-xs transition-colors",
3892
+ "data-testid": "collections-chat",
3893
+ onClick: openChat
3894
+ }, [_cache[26] || (_cache[26] = createElementVNode("span", { class: "material-icons text-sm" }, "forum", -1)), createElementVNode("span", null, toDisplayString(unref(t)("collectionsView.chat")), 1)])) : createCommentVNode("", true),
3895
+ (openBlock(true), createElementBlock(Fragment, null, renderList(collectionActions.value, (action) => {
3896
+ return openBlock(), createElementBlock("button", {
3897
+ key: action.id,
3898
+ type: "button",
3899
+ class: "h-8 px-2.5 flex items-center gap-1 rounded border border-indigo-200 bg-white hover:bg-indigo-50 text-indigo-600 font-bold text-xs transition-colors disabled:opacity-50",
3900
+ disabled: collectionActionPending.value,
3901
+ "data-testid": `collections-action-${action.id}`,
3902
+ onClick: ($event) => runCollectionAction(action)
3903
+ }, [action.icon ? (openBlock(), createElementBlock("span", _hoisted_12$2, toDisplayString(action.icon), 1)) : createCommentVNode("", true), createElementVNode("span", null, toDisplayString(action.label), 1)], 8, _hoisted_11$2);
3904
+ }), 128)),
3905
+ canCreate.value && !calendarActive.value ? (openBlock(), createElementBlock("button", {
3906
+ key: 5,
3907
+ type: "button",
3908
+ class: "h-8 px-2.5 flex items-center gap-1 rounded bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs transition-colors shadow-sm",
3909
+ "data-testid": "collections-add-item",
3910
+ onClick: openCreate
3911
+ }, [_cache[27] || (_cache[27] = createElementVNode("span", { class: "material-icons text-sm" }, "add", -1)), createElementVNode("span", null, toDisplayString(unref(t)("common.add")), 1)])) : createCommentVNode("", true),
3912
+ canDeleteCollection.value && !embedded.value ? (openBlock(), createElementBlock("button", {
3913
+ key: 6,
3914
+ type: "button",
3915
+ class: "h-8 w-8 flex items-center justify-center rounded border border-rose-200 bg-white text-rose-600 hover:bg-rose-50 transition-colors",
3916
+ title: unref(t)("collectionsView.deleteCollection"),
3917
+ "aria-label": unref(t)("collectionsView.deleteCollection"),
3918
+ "data-testid": "collections-delete",
3919
+ onClick: confirmCollectionDelete
3920
+ }, [..._cache[28] || (_cache[28] = [createElementVNode("span", { class: "material-icons text-sm" }, "delete_forever", -1)])], 8, _hoisted_13$2)) : createCommentVNode("", true),
3921
+ canDeleteFeed.value && !embedded.value ? (openBlock(), createElementBlock("button", {
3922
+ key: 7,
3923
+ type: "button",
3924
+ class: "h-8 w-8 flex items-center justify-center rounded border border-rose-200 bg-white text-rose-600 hover:bg-rose-50 transition-colors",
3925
+ title: unref(t)("collectionsView.deleteFeed"),
3926
+ "aria-label": unref(t)("collectionsView.deleteFeed"),
3927
+ "data-testid": "feeds-delete",
3928
+ onClick: confirmFeedDelete
3929
+ }, [..._cache[29] || (_cache[29] = [createElementVNode("span", { class: "material-icons text-sm" }, "delete_forever", -1)])], 8, _hoisted_14$2)) : createCommentVNode("", true)
3930
+ ]),
3931
+ collection.value && (items.value.length > 0 || hasCalendar.value || hasKanban.value || hasCustomViews.value || canAddCustomView.value) ? (openBlock(), createElementBlock("div", _hoisted_15$2, [items.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_16$1, [
3932
+ _cache[31] || (_cache[31] = createElementVNode("span", { class: "absolute inset-y-0 left-0 flex items-center pl-3 text-slate-400 pointer-events-none" }, [createElementVNode("span", { class: "material-icons text-lg" }, "search")], -1)),
3933
+ withDirectives(createElementVNode("input", {
3934
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event),
3935
+ type: "text",
3936
+ placeholder: unref(t)("collectionsView.searchPlaceholder"),
3937
+ "aria-label": unref(t)("collectionsView.searchPlaceholder"),
3938
+ class: "w-full bg-slate-50 border border-slate-200/80 rounded-xl pl-9 pr-8 py-1.5 text-xs placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-500 focus:bg-white transition-all font-medium"
3939
+ }, null, 8, _hoisted_17$1), [[vModelText, searchQuery.value]]),
3940
+ searchQuery.value ? (openBlock(), createElementBlock("button", {
3941
+ key: 0,
3942
+ type: "button",
3943
+ "aria-label": unref(t)("collectionsView.clearSearch"),
3944
+ class: "absolute inset-y-0 right-0 flex items-center pr-2.5 text-slate-400 hover:text-slate-600",
3945
+ onClick: _cache[1] || (_cache[1] = ($event) => searchQuery.value = "")
3946
+ }, [..._cache[30] || (_cache[30] = [createElementVNode("span", { class: "material-icons text-sm" }, "close", -1)])], 8, _hoisted_18$1)) : createCommentVNode("", true)
3947
+ ])) : createCommentVNode("", true), createElementVNode("div", _hoisted_19$1, [
3948
+ hasCalendar.value || hasKanban.value || hasCustomViews.value || canAddCustomView.value ? (openBlock(), createElementBlock("div", {
3949
+ key: 0,
3950
+ class: "flex gap-0.5",
3951
+ role: "group",
3952
+ "aria-label": unref(t)("collectionsView.viewToggle")
3953
+ }, [
3954
+ createElementVNode("button", {
3955
+ type: "button",
3956
+ class: normalizeClass(["h-8 px-2.5 flex items-center gap-1 rounded text-xs font-bold transition-colors", activeView.value === "table" ? "bg-indigo-600 text-white" : "bg-white text-slate-500 border border-slate-200 hover:bg-slate-50"]),
3957
+ "aria-pressed": activeView.value === "table",
3958
+ "data-testid": "collection-view-toggle-table",
3959
+ onClick: _cache[2] || (_cache[2] = ($event) => setView("table"))
3960
+ }, [_cache[32] || (_cache[32] = createElementVNode("span", { class: "material-icons text-sm" }, "table_rows", -1)), createElementVNode("span", null, toDisplayString(unref(t)("collectionsView.viewTable")), 1)], 10, _hoisted_21$1),
3961
+ hasCalendar.value ? (openBlock(), createElementBlock("button", {
3962
+ key: 0,
3963
+ type: "button",
3964
+ class: normalizeClass(["h-8 px-2.5 flex items-center gap-1 rounded text-xs font-bold transition-colors", activeView.value === "calendar" ? "bg-indigo-600 text-white" : "bg-white text-slate-500 border border-slate-200 hover:bg-slate-50"]),
3965
+ "aria-pressed": activeView.value === "calendar",
3966
+ "data-testid": "collection-view-toggle-calendar",
3967
+ onClick: _cache[3] || (_cache[3] = ($event) => setView("calendar"))
3968
+ }, [_cache[33] || (_cache[33] = createElementVNode("span", { class: "material-icons text-sm" }, "calendar_month", -1)), createElementVNode("span", null, toDisplayString(unref(t)("collectionsView.viewCalendar")), 1)], 10, _hoisted_22$1)) : createCommentVNode("", true),
3969
+ hasKanban.value ? (openBlock(), createElementBlock("button", {
3970
+ key: 1,
3971
+ type: "button",
3972
+ class: normalizeClass(["h-8 px-2.5 flex items-center gap-1 rounded text-xs font-bold transition-colors", activeView.value === "kanban" ? "bg-indigo-600 text-white" : "bg-white text-slate-500 border border-slate-200 hover:bg-slate-50"]),
3973
+ "aria-pressed": activeView.value === "kanban",
3974
+ "data-testid": "collection-view-toggle-kanban",
3975
+ onClick: _cache[4] || (_cache[4] = ($event) => setView("kanban"))
3976
+ }, [_cache[34] || (_cache[34] = createElementVNode("span", { class: "material-icons text-sm" }, "view_kanban", -1)), createElementVNode("span", null, toDisplayString(unref(t)("collectionsView.viewKanban")), 1)], 10, _hoisted_23$1)) : createCommentVNode("", true),
3977
+ (openBlock(true), createElementBlock(Fragment, null, renderList(customViews.value, (cv) => {
3978
+ return openBlock(), createElementBlock("button", {
3979
+ key: cv.id,
3980
+ type: "button",
3981
+ class: normalizeClass(["h-8 px-2.5 flex items-center gap-1 rounded text-xs font-bold transition-colors", activeView.value === customViewKey(cv.id) ? "bg-indigo-600 text-white" : "bg-white text-slate-500 border border-slate-200 hover:bg-slate-50"]),
3982
+ "aria-pressed": activeView.value === customViewKey(cv.id),
3983
+ "data-testid": `collection-view-custom-${cv.id}`,
3984
+ onClick: ($event) => setCustomView(cv.id)
3985
+ }, [createElementVNode("span", _hoisted_25, toDisplayString(cv.icon || "dashboard_customize"), 1), createElementVNode("span", null, toDisplayString(cv.label), 1)], 10, _hoisted_24);
3986
+ }), 128)),
3987
+ canAddCustomView.value ? (openBlock(), createElementBlock("button", {
3988
+ key: 2,
3989
+ type: "button",
3990
+ class: "h-8 w-8 flex items-center justify-center rounded bg-white text-slate-500 border border-slate-200 hover:bg-slate-50",
3991
+ title: unref(t)("collectionsView.addView"),
3992
+ "aria-label": unref(t)("collectionsView.addView"),
3993
+ "data-testid": "collection-view-add",
3994
+ onClick: addCustomView
3995
+ }, [..._cache[35] || (_cache[35] = [createElementVNode("span", { class: "material-icons text-sm" }, "add", -1)])], 8, _hoisted_26)) : createCommentVNode("", true),
3996
+ canConfigureViews.value ? (openBlock(), createElementBlock("button", {
3997
+ key: 3,
3998
+ type: "button",
3999
+ class: "h-8 w-8 flex items-center justify-center rounded bg-white text-slate-500 border border-slate-200 hover:bg-slate-50",
4000
+ title: unref(t)("collectionsView.config.open"),
4001
+ "aria-label": unref(t)("collectionsView.config.open"),
4002
+ "data-testid": "collection-config-open",
4003
+ onClick: _cache[5] || (_cache[5] = ($event) => configOpen.value = true)
4004
+ }, [..._cache[36] || (_cache[36] = [createElementVNode("span", { class: "material-icons text-sm" }, "settings", -1)])], 8, _hoisted_27)) : createCommentVNode("", true)
4005
+ ], 8, _hoisted_20$1)) : createCommentVNode("", true),
4006
+ calendarActive.value && dateFields.value.length > 1 ? (openBlock(), createElementBlock("select", {
4007
+ key: 1,
4008
+ value: calendarAnchorField.value,
4009
+ class: "h-8 px-2 rounded border border-slate-200 bg-white text-xs font-semibold text-slate-600 focus:outline-none focus:border-indigo-500 cursor-pointer",
4010
+ "aria-label": unref(t)("collectionsView.calendarFieldLabel"),
4011
+ "data-testid": "collection-calendar-field",
4012
+ onChange: _cache[6] || (_cache[6] = ($event) => anchorOverride.value = $event.target.value)
4013
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(dateFields.value, (key) => {
4014
+ return openBlock(), createElementBlock("option", {
4015
+ key,
4016
+ value: key
4017
+ }, toDisplayString(collection.value?.schema.fields[key]?.label ?? key), 9, _hoisted_29);
4018
+ }), 128))], 40, _hoisted_28)) : createCommentVNode("", true),
4019
+ kanbanActive.value && enumFields.value.length > 1 ? (openBlock(), createElementBlock("select", {
4020
+ key: 2,
4021
+ value: kanbanGroupField.value,
4022
+ class: "h-8 px-2 rounded border border-slate-200 bg-white text-xs font-semibold text-slate-600 focus:outline-none focus:border-indigo-500 cursor-pointer",
4023
+ "aria-label": unref(t)("collectionsView.kanbanFieldLabel"),
4024
+ "data-testid": "collection-kanban-field",
4025
+ onChange: _cache[7] || (_cache[7] = ($event) => kanbanOverride.value = $event.target.value)
4026
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(enumFields.value, (key) => {
4027
+ return openBlock(), createElementBlock("option", {
4028
+ key,
4029
+ value: key
4030
+ }, toDisplayString(collection.value?.schema.fields[key]?.label ?? key), 9, _hoisted_31);
4031
+ }), 128))], 40, _hoisted_30)) : createCommentVNode("", true),
4032
+ items.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_32, toDisplayString(unref(t)("collectionsView.searchSummary", {
4033
+ shown: filteredItems.value.length,
4034
+ total: items.value.length
4035
+ })), 1)) : createCommentVNode("", true)
4036
+ ])])) : createCommentVNode("", true),
4037
+ collection.value && dataIssues.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_33, [
4038
+ _cache[38] || (_cache[38] = createElementVNode("span", { class: "material-icons text-amber-600" }, "warning", -1)),
4039
+ createElementVNode("span", _hoisted_34, toDisplayString(unref(t)("collectionsView.dataIssuesDetected", { count: dataIssues.value.length })), 1),
4040
+ createElementVNode("button", {
4041
+ type: "button",
4042
+ class: "h-8 px-2.5 flex items-center gap-1 rounded border border-amber-300 bg-white hover:bg-amber-100 text-amber-700 font-bold text-xs transition-colors",
4043
+ "data-testid": "collections-repair",
4044
+ onClick: repairCollection
4045
+ }, [_cache[37] || (_cache[37] = createElementVNode("span", { class: "material-icons text-sm" }, "build", -1)), createElementVNode("span", null, toDisplayString(unref(t)("collectionsView.repair")), 1)])
4046
+ ])) : createCommentVNode("", true),
4047
+ createElementVNode("div", _hoisted_35, [loading.value ? (openBlock(), createElementBlock("div", _hoisted_36, [_cache[39] || (_cache[39] = createElementVNode("div", { class: "h-8 w-8 border-2 border-indigo-600/20 border-t-indigo-600 rounded-full animate-spin" }, null, -1)), createElementVNode("span", null, toDisplayString(unref(t)("common.loading")), 1)])) : loadError.value ? (openBlock(), createElementBlock("div", _hoisted_37, [_cache[40] || (_cache[40] = createElementVNode("span", { class: "material-icons text-red-600" }, "error", -1)), createElementVNode("span", null, toDisplayString(loadError.value === "not-found" ? unref(t)("collectionsView.notFound") : `${unref(t)("collectionsView.loadFailed")}: ${loadError.value}`), 1)])) : !collection.value ? (openBlock(), createElementBlock("div", _hoisted_38)) : calendarActive.value ? (openBlock(), createElementBlock("div", _hoisted_39, [createVNode(CollectionCalendarView_default, {
4048
+ schema: collection.value.schema,
4049
+ items: filteredItems.value,
4050
+ "anchor-field": calendarAnchorField.value,
4051
+ "end-field": calendarEndField.value,
4052
+ "time-field": calendarTimeField.value,
4053
+ "color-field": hasKanban.value ? kanbanGroupField.value : "",
4054
+ selected: viewing.value ? String(viewing.value[collection.value.schema.primaryKey] ?? "") : void 0,
4055
+ onSelect: onCalendarSelect,
4056
+ onOpenDay
4057
+ }, null, 8, [
4058
+ "schema",
4059
+ "items",
4060
+ "anchor-field",
4061
+ "end-field",
4062
+ "time-field",
4063
+ "color-field",
4064
+ "selected"
4065
+ ]), openDay.value ? (openBlock(), createBlock(CollectionDayView_default, {
4066
+ key: 0,
4067
+ schema: collection.value.schema,
4068
+ items: filteredItems.value,
4069
+ day: openDay.value,
4070
+ "anchor-field": calendarAnchorField.value,
4071
+ "end-field": calendarEndField.value,
4072
+ "time-field": calendarTimeField.value,
4073
+ "color-field": hasKanban.value ? kanbanGroupField.value : "",
4074
+ selected: viewing.value ? String(viewing.value[collection.value.schema.primaryKey] ?? "") : void 0,
4075
+ "can-create": canCreate.value,
4076
+ "show-detail": Boolean(viewing.value || editing.value),
4077
+ onSelect: onCalendarSelect,
4078
+ onCreateOn: createOnDate,
4079
+ onClose: onDayClose
4080
+ }, {
4081
+ detail: withCtx(() => [createVNode(CollectionRecordPanel_default, {
4082
+ editing: editing.value,
4083
+ "onUpdate:editing": _cache[8] || (_cache[8] = ($event) => editing.value = $event),
4084
+ collection: collection.value,
4085
+ viewing: viewing.value,
4086
+ saving: saving.value,
4087
+ "save-error": saveError.value,
4088
+ "action-error": actionError.value,
4089
+ "action-pending": actionPending.value,
4090
+ "visible-actions": visibleActions.value,
4091
+ "live-record": liveRecord.value,
4092
+ "live-derived": liveDerived.value,
4093
+ "view-title": viewTitle.value,
4094
+ "is-singleton": isSingleton.value,
4095
+ render: unref(render),
4096
+ locale: unref(locale),
4097
+ onSubmit: saveEditor,
4098
+ onCancel: cancelEditor,
4099
+ onEdit: editFromView,
4100
+ onClose: onDayClose,
4101
+ onDelete: _cache[9] || (_cache[9] = ($event) => viewing.value && confirmDelete(viewing.value)),
4102
+ onRunAction: runAction
4103
+ }, null, 8, [
4104
+ "editing",
4105
+ "collection",
4106
+ "viewing",
4107
+ "saving",
4108
+ "save-error",
4109
+ "action-error",
4110
+ "action-pending",
4111
+ "visible-actions",
4112
+ "live-record",
4113
+ "live-derived",
4114
+ "view-title",
4115
+ "is-singleton",
4116
+ "render",
4117
+ "locale"
4118
+ ])]),
4119
+ _: 1
4120
+ }, 8, [
4121
+ "schema",
4122
+ "items",
4123
+ "day",
4124
+ "anchor-field",
4125
+ "end-field",
4126
+ "time-field",
4127
+ "color-field",
4128
+ "selected",
4129
+ "can-create",
4130
+ "show-detail"
4131
+ ])) : createCommentVNode("", true)])) : kanbanActive.value ? (openBlock(), createElementBlock("div", _hoisted_40, [inlineError.value ? (openBlock(), createElementBlock("div", _hoisted_41, [
4132
+ _cache[42] || (_cache[42] = createElementVNode("span", { class: "material-icons text-red-600" }, "error", -1)),
4133
+ createElementVNode("span", _hoisted_42, toDisplayString(unref(t)("collectionsView.inlineSaveFailed", { error: inlineError.value })), 1),
4134
+ createElementVNode("button", {
4135
+ type: "button",
4136
+ class: "h-8 w-8 flex items-center justify-center rounded text-red-600 hover:bg-red-100",
4137
+ "aria-label": unref(t)("common.close"),
4138
+ onClick: _cache[10] || (_cache[10] = ($event) => inlineError.value = null)
4139
+ }, [..._cache[41] || (_cache[41] = [createElementVNode("span", { class: "material-icons text-base" }, "close", -1)])], 8, _hoisted_43)
4140
+ ])) : createCommentVNode("", true), createElementVNode("div", _hoisted_44, [createVNode(CollectionKanbanView_default, {
4141
+ schema: collection.value.schema,
4142
+ items: filteredItems.value,
4143
+ "group-field": kanbanGroupField.value,
4144
+ selected: viewing.value ? String(viewing.value[collection.value.schema.primaryKey] ?? "") : void 0,
4145
+ notified: notifiedSeverities.value,
4146
+ onSelect: onCalendarSelect,
4147
+ onMove: onKanbanMove
4148
+ }, null, 8, [
4149
+ "schema",
4150
+ "items",
4151
+ "group-field",
4152
+ "selected",
4153
+ "notified"
4154
+ ])])])) : activeCustomView.value ? (openBlock(), createElementBlock("div", _hoisted_45, [createVNode(CollectionCustomView_default, {
4155
+ slug: collection.value.slug,
4156
+ view: activeCustomView.value
4157
+ }, null, 8, ["slug", "view"])])) : items.value.length === 0 && editing.value?.mode !== "create" ? (openBlock(), createElementBlock("div", _hoisted_46, [_cache[43] || (_cache[43] = createElementVNode("span", { class: "material-icons text-4xl text-slate-300" }, "folder_open", -1)), createElementVNode("p", _hoisted_47, toDisplayString(unref(t)("collectionsView.itemsEmpty")), 1)])) : filteredItems.value.length === 0 && editing.value?.mode !== "create" ? (openBlock(), createElementBlock("div", _hoisted_48, [
4158
+ _cache[44] || (_cache[44] = createElementVNode("span", { class: "material-icons text-4xl text-slate-300" }, "search_off", -1)),
4159
+ createElementVNode("p", _hoisted_49, toDisplayString(unref(t)("collectionsView.noMatchingItems")), 1),
4160
+ createElementVNode("button", {
4161
+ type: "button",
4162
+ class: "text-xs text-indigo-600 font-semibold hover:underline",
4163
+ onClick: _cache[11] || (_cache[11] = ($event) => searchQuery.value = "")
4164
+ }, toDisplayString(unref(t)("collectionsView.clearSearch")), 1)
4165
+ ])) : (openBlock(), createElementBlock("div", _hoisted_50, [inlineError.value ? (openBlock(), createElementBlock("div", _hoisted_51, [
4166
+ _cache[46] || (_cache[46] = createElementVNode("span", { class: "material-icons text-red-600" }, "error", -1)),
4167
+ createElementVNode("span", _hoisted_52, toDisplayString(unref(t)("collectionsView.inlineSaveFailed", { error: inlineError.value })), 1),
4168
+ createElementVNode("button", {
4169
+ type: "button",
4170
+ class: "h-8 w-8 flex items-center justify-center rounded text-red-600 hover:bg-red-100",
4171
+ "aria-label": unref(t)("common.close"),
4172
+ onClick: _cache[12] || (_cache[12] = ($event) => inlineError.value = null)
4173
+ }, [..._cache[45] || (_cache[45] = [createElementVNode("span", { class: "material-icons text-base" }, "close", -1)])], 8, _hoisted_53)
4174
+ ])) : createCommentVNode("", true), createElementVNode("table", _hoisted_54, [createElementVNode("thead", null, [createElementVNode("tr", _hoisted_55, [(openBlock(true), createElementBlock(Fragment, null, renderList(listColumnFields.value, ([key, field]) => {
4175
+ return openBlock(), createElementBlock("th", {
4176
+ key,
4177
+ "aria-sort": unref(isSortableField)(field) ? sortAriaValue(key) : void 0,
4178
+ class: "px-5 py-3 font-bold text-slate-500 text-left uppercase tracking-wider whitespace-nowrap"
4179
+ }, [createElementVNode("div", _hoisted_57, [createElementVNode("span", {
4180
+ class: "truncate max-w-[14rem]",
4181
+ title: field.label
4182
+ }, toDisplayString(field.label), 9, _hoisted_58), unref(isSortableField)(field) ? (openBlock(), createElementBlock("button", {
4183
+ key: 0,
4184
+ type: "button",
4185
+ class: normalizeClass(["inline-flex items-center justify-center rounded p-0.5 -my-1 leading-none transition-colors", sortButtonClass(key)]),
4186
+ "data-testid": `collections-sort-${key}`,
4187
+ "aria-label": unref(t)("collectionsView.sortBy", { field: field.label }),
4188
+ onClick: withModifiers(($event) => cycleSort(key), ["stop"]),
4189
+ onPointerenter: ($event) => hoveredSortKey.value = key,
4190
+ onPointerleave: _cache[13] || (_cache[13] = ($event) => hoveredSortKey.value = null)
4191
+ }, [createElementVNode("span", _hoisted_60, toDisplayString(sortIconName(key)), 1)], 42, _hoisted_59)) : createCommentVNode("", true)])], 8, _hoisted_56);
4192
+ }), 128))])]), createElementVNode("tbody", _hoisted_61, [(openBlock(true), createElementBlock(Fragment, null, renderList(sortedItems.value, (item) => {
4193
+ return openBlock(), createElementBlock("tr", {
4194
+ key: String(item[collection.value.schema.primaryKey] ?? ""),
4195
+ class: normalizeClass(["hover:bg-slate-50/70 cursor-pointer transition-colors focus:outline-none focus:bg-indigo-50/30", isRowOpen(item) || isEditingRow(item) ? "bg-indigo-50/40" : ""]),
4196
+ role: "button",
4197
+ tabindex: "0",
4198
+ "aria-label": unref(t)("collectionsView.openItem", { id: String(item[collection.value.schema.primaryKey] ?? "") }),
4199
+ "data-testid": `collections-row-${item[collection.value.schema.primaryKey]}`,
4200
+ onClick: ($event) => openView(item),
4201
+ onKeydown: [withKeys(withModifiers(($event) => openView(item), ["self"]), ["enter"]), withKeys(withModifiers(($event) => openView(item), ["self", "prevent"]), ["space"])]
4202
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(listColumnFields.value, ([key, field]) => {
4203
+ return openBlock(), createElementBlock("td", {
4204
+ key,
4205
+ class: "px-5 py-2 text-slate-700 align-middle max-w-xs font-medium"
4206
+ }, [unref(fieldVisible)(field, item) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [field.type === "toggle" ? (openBlock(), createElementBlock("input", {
4207
+ key: 0,
4208
+ type: "checkbox",
4209
+ checked: toggleChecked(item, field),
4210
+ disabled: isRowInlineSaving(item),
4211
+ class: "h-5 w-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500/20 cursor-pointer align-middle disabled:opacity-50 disabled:cursor-not-allowed",
4212
+ "data-testid": `collections-inline-toggle-${key}-${item[collection.value.schema.primaryKey]}`,
4213
+ "aria-label": field.label,
4214
+ onClick: _cache[14] || (_cache[14] = withModifiers(() => {}, ["stop"])),
4215
+ onChange: ($event) => commitToggle(item, field)
4216
+ }, null, 40, _hoisted_63)) : field.type === "boolean" ? (openBlock(), createElementBlock("input", {
4217
+ key: 1,
4218
+ type: "checkbox",
4219
+ checked: item[key] === true,
4220
+ disabled: isRowInlineSaving(item),
4221
+ class: "h-5 w-5 rounded border-slate-300 text-indigo-600 focus:ring-indigo-500/20 cursor-pointer align-middle disabled:opacity-50 disabled:cursor-not-allowed",
4222
+ "data-testid": `collections-inline-bool-${key}-${item[collection.value.schema.primaryKey]}`,
4223
+ "aria-label": field.label,
4224
+ onClick: _cache[15] || (_cache[15] = withModifiers(() => {}, ["stop"])),
4225
+ onChange: ($event) => commitInlineEdit(item, String(key), field, $event.target.checked)
4226
+ }, null, 40, _hoisted_64)) : field.type === "ref" && field.to && typeof item[key] === "string" && item[key] ? (openBlock(), createElementBlock("span", _hoisted_65, [createVNode(_component_router_link, {
4227
+ to: {
4228
+ path: `/collections/${field.to}`,
4229
+ query: { selected: String(item[key]) }
4230
+ },
4231
+ class: "text-indigo-600 hover:text-indigo-800 hover:underline font-semibold",
4232
+ "data-testid": `collections-ref-link-${key}-${item[key]}`,
4233
+ onClick: _cache[16] || (_cache[16] = withModifiers(() => {}, ["stop"]))
4234
+ }, {
4235
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(refDisplay)(field.to, String(item[key]))), 1)]),
4236
+ _: 2
4237
+ }, 1032, ["to", "data-testid"])])) : field.type === "enum" && Array.isArray(field.values) && field.values.length > 0 ? (openBlock(), createElementBlock("select", {
4238
+ key: 3,
4239
+ value: item[key] == null ? "" : String(item[key]),
4240
+ disabled: isRowInlineSaving(item),
4241
+ class: normalizeClass(["rounded-lg border px-2 py-0.5 text-[11px] font-semibold focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20 focus:outline-none cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed", enumControlClass(String(key), item[key])]),
4242
+ "data-testid": `collections-inline-enum-${key}-${item[collection.value.schema.primaryKey]}`,
4243
+ "aria-label": field.label,
4244
+ onClick: _cache[17] || (_cache[17] = withModifiers(() => {}, ["stop"])),
4245
+ onChange: ($event) => commitInlineEdit(item, String(key), field, $event.target.value)
4246
+ }, [showEnumPlaceholder(item, String(key)) ? (openBlock(), createElementBlock("option", _hoisted_67, toDisplayString(unref(t)("collectionsView.selectPlaceholder")), 1)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(field.values, (value) => {
4247
+ return openBlock(), createElementBlock("option", {
4248
+ key: value,
4249
+ value
4250
+ }, toDisplayString(value), 9, _hoisted_68);
4251
+ }), 128))], 42, _hoisted_66)) : field.type === "money" ? (openBlock(), createElementBlock("span", _hoisted_69, toDisplayString(unref(formatMoney)(item[key], unref(resolveCurrency)(field, item), unref(locale))), 1)) : field.type === "table" ? (openBlock(), createElementBlock("span", _hoisted_70, [_cache[47] || (_cache[47] = createElementVNode("span", { class: "material-icons text-[11px]" }, "list", -1)), createElementVNode("span", null, toDisplayString(tableSummary(item[key])), 1)])) : field.type === "derived" ? (openBlock(), createElementBlock("span", _hoisted_71, toDisplayString(unref(derivedDisplay)(field, unref(evaluateDerivedAgainstItem)(field, String(key), item), item)), 1)) : field.type !== "file" && unref(isExternalUrl)(item[key]) ? (openBlock(), createElementBlock("a", {
4252
+ key: 7,
4253
+ href: String(item[key]),
4254
+ target: "_blank",
4255
+ rel: "noopener noreferrer",
4256
+ class: "block truncate text-blue-600 hover:text-blue-800 hover:underline font-semibold",
4257
+ "data-testid": `collections-url-link-${key}-${item[collection.value.schema.primaryKey]}`,
4258
+ onClick: _cache[18] || (_cache[18] = withModifiers(() => {}, ["stop"]))
4259
+ }, toDisplayString(String(item[key])), 9, _hoisted_72)) : field.type === "file" && unref(artifactUrl)(item[key]) ? (openBlock(), createElementBlock("a", {
4260
+ key: 8,
4261
+ href: unref(artifactUrl)(item[key]) ?? void 0,
4262
+ target: "_blank",
4263
+ rel: "noopener noreferrer",
4264
+ class: "block truncate text-blue-600 hover:text-blue-800 hover:underline font-semibold",
4265
+ "data-testid": `collections-file-link-${key}-${item[collection.value.schema.primaryKey]}`,
4266
+ onClick: _cache[19] || (_cache[19] = withModifiers(() => {}, ["stop"]))
4267
+ }, toDisplayString(String(item[key])), 9, _hoisted_73)) : field.type === "file" && unref(fileRoutePath)(item[key]) ? (openBlock(), createBlock(_component_router_link, {
4268
+ key: 9,
4269
+ to: unref(fileRoutePath)(item[key]) ?? "",
4270
+ class: "block truncate text-blue-600 hover:text-blue-800 hover:underline font-semibold",
4271
+ "data-testid": `collections-file-link-${key}-${item[collection.value.schema.primaryKey]}`,
4272
+ onClick: _cache[20] || (_cache[20] = withModifiers(() => {}, ["stop"]))
4273
+ }, {
4274
+ default: withCtx(() => [createTextVNode(toDisplayString(String(item[key])), 1)]),
4275
+ _: 2
4276
+ }, 1032, ["to", "data-testid"])) : (openBlock(), createElementBlock("span", _hoisted_74, toDisplayString(unref(formatCell)(item[key], field.type)), 1))], 64)) : createCommentVNode("", true)]);
4277
+ }), 128))], 42, _hoisted_62);
4278
+ }), 128))])])]))]),
4279
+ collection.value && (viewing.value || editing.value) && !(calendarActive.value && openDay.value) ? (openBlock(), createBlock(CollectionRecordModal_default, {
4280
+ key: 2,
4281
+ onClose: closeRecordModal
4282
+ }, {
4283
+ default: withCtx(() => [createVNode(CollectionRecordPanel_default, {
4284
+ editing: editing.value,
4285
+ "onUpdate:editing": _cache[21] || (_cache[21] = ($event) => editing.value = $event),
4286
+ collection: collection.value,
4287
+ viewing: viewing.value,
4288
+ saving: saving.value,
4289
+ "save-error": saveError.value,
4290
+ "action-error": actionError.value,
4291
+ "action-pending": actionPending.value,
4292
+ "visible-actions": visibleActions.value,
4293
+ "live-record": liveRecord.value,
4294
+ "live-derived": liveDerived.value,
4295
+ "view-title": viewTitle.value,
4296
+ "is-singleton": isSingleton.value,
4297
+ render: unref(render),
4298
+ locale: unref(locale),
4299
+ onSubmit: saveEditor,
4300
+ onCancel: cancelEditor,
4301
+ onEdit: editFromView,
4302
+ onClose: closeView,
4303
+ onDelete: _cache[22] || (_cache[22] = ($event) => viewing.value && confirmDelete(viewing.value)),
4304
+ onRunAction: runAction
4305
+ }, null, 8, [
4306
+ "editing",
4307
+ "collection",
4308
+ "viewing",
4309
+ "saving",
4310
+ "save-error",
4311
+ "action-error",
4312
+ "action-pending",
4313
+ "visible-actions",
4314
+ "live-record",
4315
+ "live-derived",
4316
+ "view-title",
4317
+ "is-singleton",
4318
+ "render",
4319
+ "locale"
4320
+ ])]),
4321
+ _: 1
4322
+ })) : createCommentVNode("", true),
4323
+ configOpen.value && collection.value ? (openBlock(), createBlock(CollectionViewConfigModal_default, {
4324
+ key: 3,
4325
+ slug: collection.value.slug,
4326
+ title: collection.value.title,
4327
+ views: customViews.value,
4328
+ onChanged: onViewsChanged,
4329
+ onClose: _cache[23] || (_cache[23] = ($event) => configOpen.value = false)
4330
+ }, null, 8, [
4331
+ "slug",
4332
+ "title",
4333
+ "views"
4334
+ ])) : createCommentVNode("", true),
4335
+ chatOpen.value && collection.value ? (openBlock(), createElementBlock("div", {
4336
+ key: 4,
4337
+ class: "fixed inset-0 z-30 flex items-center justify-center bg-slate-900/60 backdrop-blur-sm p-4 transition-all duration-300",
4338
+ role: "dialog",
4339
+ "aria-modal": "true",
4340
+ "aria-labelledby": "collections-chat-title",
4341
+ "data-testid": "collections-chat-modal",
4342
+ onClick: withModifiers(closeChat, ["self"]),
4343
+ onKeydown: withKeys(closeChat, ["esc"])
4344
+ }, [createElementVNode("div", _hoisted_75, [
4345
+ createElementVNode("header", _hoisted_76, [
4346
+ _cache[49] || (_cache[49] = createElementVNode("div", { class: "h-9 w-9 flex items-center justify-center rounded-xl bg-indigo-50 text-indigo-600 border border-indigo-100/50" }, [createElementVNode("span", { class: "material-icons text-lg" }, "forum")], -1)),
4347
+ createElementVNode("div", _hoisted_77, [createElementVNode("h2", _hoisted_78, toDisplayString(unref(t)("collectionsView.chatTitle")), 1), createElementVNode("span", _hoisted_79, toDisplayString(collection.value.title), 1)]),
4348
+ createElementVNode("button", {
4349
+ type: "button",
4350
+ class: "h-8 w-8 flex items-center justify-center rounded text-slate-400 hover:bg-slate-200/50 hover:text-slate-600 transition-colors",
4351
+ "aria-label": unref(t)("common.close"),
4352
+ "data-testid": "collections-chat-close",
4353
+ onClick: closeChat
4354
+ }, [..._cache[48] || (_cache[48] = [createElementVNode("span", { class: "material-icons text-lg" }, "close", -1)])], 8, _hoisted_80)
4355
+ ]),
4356
+ createElementVNode("div", _hoisted_81, [withDirectives(createElementVNode("textarea", {
4357
+ ref_key: "chatInputEl",
4358
+ ref: chatInputEl,
4359
+ "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => chatMessage.value = $event),
4360
+ rows: "4",
4361
+ placeholder: unref(t)("collectionsView.chatPlaceholder"),
4362
+ class: "w-full bg-slate-50 border border-slate-200/80 rounded-xl px-3 py-2.5 text-sm placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-500 focus:bg-white transition-all resize-none",
4363
+ "data-testid": "collections-chat-input",
4364
+ onKeydown: [withKeys(withModifiers(submitChat, ["meta"]), ["enter"]), withKeys(withModifiers(submitChat, ["ctrl"]), ["enter"])]
4365
+ }, null, 40, _hoisted_82), [[vModelText, chatMessage.value]])]),
4366
+ createElementVNode("footer", _hoisted_83, [createElementVNode("button", {
4367
+ type: "button",
4368
+ class: "h-8 px-2.5 rounded text-xs font-bold text-slate-500 hover:bg-slate-200/50 transition-colors",
4369
+ "data-testid": "collections-chat-cancel",
4370
+ onClick: closeChat
4371
+ }, toDisplayString(unref(t)("common.cancel")), 1), createElementVNode("button", {
4372
+ type: "button",
4373
+ class: "h-8 px-2.5 rounded bg-indigo-600 text-white font-bold text-xs hover:bg-indigo-700 disabled:opacity-50 transition-all shadow-sm shadow-indigo-600/10",
4374
+ disabled: !chatMessage.value.trim(),
4375
+ "data-testid": "collections-chat-send",
4376
+ onClick: submitChat
4377
+ }, toDisplayString(unref(t)("collectionsView.chatStart")), 9, _hoisted_84)])
4378
+ ])], 32)) : createCommentVNode("", true)
4379
+ ]);
4380
+ };
4381
+ }
4382
+ });
4383
+ //#endregion
4384
+ //#region src/vue/components/CollectionsIndexView.vue?vue&type=script&setup=true&lang.ts
4385
+ var _hoisted_1$1 = {
4386
+ class: "h-full overflow-y-auto bg-slate-50/50 px-6 py-6",
4387
+ "data-testid": "collections-view-root"
4388
+ };
4389
+ var _hoisted_2$1 = { class: "max-w-4xl mx-auto" };
4390
+ var _hoisted_3$1 = { class: "flex items-center justify-between mb-6" };
4391
+ var _hoisted_4$1 = { class: "text-xl font-semibold text-slate-800" };
4392
+ var _hoisted_5$1 = {
4393
+ key: 0,
4394
+ class: "flex flex-col items-center justify-center py-20 text-sm text-slate-500 gap-3"
4395
+ };
4396
+ var _hoisted_6$1 = {
4397
+ key: 1,
4398
+ class: "rounded-xl border border-red-200 bg-red-50/50 p-4 text-sm text-red-800 shadow-sm flex items-center gap-3"
4399
+ };
4400
+ var _hoisted_7$1 = {
4401
+ key: 2,
4402
+ class: "rounded-xl border border-slate-200 bg-white px-6 py-12 text-center text-sm text-slate-500 shadow-sm"
4403
+ };
4404
+ var _hoisted_8$1 = { class: "font-medium text-slate-700" };
4405
+ var _hoisted_9$1 = {
4406
+ key: 3,
4407
+ class: "grid gap-4 sm:grid-cols-2"
4408
+ };
4409
+ var _hoisted_10$1 = [
4410
+ "aria-label",
4411
+ "data-testid",
4412
+ "onClick",
4413
+ "onKeydown"
4414
+ ];
4415
+ var _hoisted_11$1 = { class: "material-symbols-outlined text-2xl" };
4416
+ var _hoisted_12$1 = { class: "flex-1 min-w-0" };
4417
+ var _hoisted_13$1 = { class: "block font-semibold text-slate-800 text-[15px] group-hover:text-indigo-950 transition-colors truncate" };
4418
+ var _hoisted_14$1 = { class: "block text-[10px] text-slate-400 mt-1 tracking-wider font-semibold uppercase flex items-center gap-1.5" };
4419
+ var _hoisted_15$1 = { class: "text-[10px] bg-slate-100 px-1 rounded lowercase text-slate-500 font-mono font-normal" };
4420
+ //#endregion
4421
+ //#region src/vue/components/CollectionsIndexView.vue
4422
+ var CollectionsIndexView_default = /* @__PURE__ */ defineComponent({
4423
+ __name: "CollectionsIndexView",
4424
+ setup(__props) {
4425
+ const { t } = useCollectionI18n();
4426
+ const cui = collectionUi();
4427
+ const { pinToggle, reconcileShortcuts } = cui;
4428
+ const collections = ref([]);
4429
+ const loading = ref(true);
4430
+ const loadError = ref(null);
4431
+ async function loadCollections() {
4432
+ loading.value = true;
4433
+ loadError.value = null;
4434
+ const result = await cui.listCollections();
4435
+ loading.value = false;
4436
+ if (!result.ok) {
4437
+ loadError.value = result.error;
4438
+ return;
4439
+ }
4440
+ collections.value = result.data.collections.filter((collection) => collection.source !== "feed");
4441
+ reconcileShortcuts("collection", collections.value.map((collection) => ({
4442
+ slug: collection.slug,
4443
+ title: collection.title,
4444
+ icon: collection.icon
4445
+ })));
4446
+ }
4447
+ function openCollection(slug) {
4448
+ cui.gotoDetail("collection", slug);
4449
+ }
4450
+ function startCreateCollectionChat() {
4451
+ cui.startChat(t("collectionsView.addCollectionPrompt"), cui.generalRoleId);
4452
+ }
4453
+ onMounted(loadCollections);
4454
+ return (_ctx, _cache) => {
4455
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [createElementVNode("div", _hoisted_2$1, [createElementVNode("div", _hoisted_3$1, [createElementVNode("h1", _hoisted_4$1, toDisplayString(unref(t)("collectionsView.title")), 1), createElementVNode("button", {
4456
+ type: "button",
4457
+ class: "h-8 px-2.5 flex items-center gap-1 rounded bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs transition-colors shadow-sm",
4458
+ "data-testid": "collections-add-collection",
4459
+ onClick: startCreateCollectionChat
4460
+ }, [_cache[0] || (_cache[0] = createElementVNode("span", { class: "material-icons text-sm" }, "add", -1)), createElementVNode("span", null, toDisplayString(unref(t)("collectionsView.addCollectionLabel")), 1)])]), loading.value ? (openBlock(), createElementBlock("div", _hoisted_5$1, [_cache[1] || (_cache[1] = createElementVNode("div", { class: "h-8 w-8 border-2 border-indigo-600/20 border-t-indigo-600 rounded-full animate-spin" }, null, -1)), createElementVNode("span", null, toDisplayString(unref(t)("common.loading")), 1)])) : loadError.value ? (openBlock(), createElementBlock("div", _hoisted_6$1, [_cache[2] || (_cache[2] = createElementVNode("span", { class: "material-icons text-red-600" }, "error", -1)), createElementVNode("span", null, toDisplayString(unref(t)("collectionsView.loadFailed")) + ": " + toDisplayString(loadError.value), 1)])) : collections.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_7$1, [_cache[3] || (_cache[3] = createElementVNode("span", { class: "material-icons text-4xl text-slate-300 mb-2" }, "dashboard_customize", -1)), createElementVNode("p", _hoisted_8$1, toDisplayString(unref(t)("collectionsView.indexEmpty")), 1)])) : (openBlock(), createElementBlock("div", _hoisted_9$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(collections.value, (collection) => {
4461
+ return openBlock(), createElementBlock("div", {
4462
+ key: collection.slug,
4463
+ class: "group relative rounded-xl border border-slate-200 bg-white p-5 shadow-sm hover:shadow-md hover:border-indigo-300 transition-all duration-300 cursor-pointer flex items-center gap-4 focus:outline-none focus:ring-2 focus:ring-indigo-500/20",
4464
+ role: "button",
4465
+ tabindex: "0",
4466
+ "aria-label": unref(t)("collectionsView.openCollection", { title: collection.title }),
4467
+ "data-testid": `collections-index-card-${collection.slug}`,
4468
+ onClick: ($event) => openCollection(collection.slug),
4469
+ onKeydown: [withKeys(withModifiers(($event) => openCollection(collection.slug), ["self"]), ["enter"]), withKeys(withModifiers(($event) => openCollection(collection.slug), ["self", "prevent"]), ["space"])]
4470
+ }, [
4471
+ createElementVNode("div", { class: normalizeClass(["absolute left-0 top-0 bottom-0 w-1 rounded-l-xl transition-all duration-300 group-hover:w-1.5", collection.source === "project" ? "bg-indigo-600" : "bg-violet-600"]) }, null, 2),
4472
+ createElementVNode("div", { class: normalizeClass(["h-12 w-12 flex items-center justify-center rounded-xl transition-all duration-300 group-hover:scale-105 shadow-sm", collection.source === "project" ? "bg-indigo-50 text-indigo-600 group-hover:bg-indigo-100/80 border border-indigo-100/50" : "bg-violet-50 text-violet-600 group-hover:bg-violet-100/80 border border-violet-100/50"]) }, [createElementVNode("span", _hoisted_11$1, toDisplayString(collection.icon), 1)], 2),
4473
+ createElementVNode("div", _hoisted_12$1, [createElementVNode("span", _hoisted_13$1, toDisplayString(collection.title), 1), createElementVNode("span", _hoisted_14$1, [
4474
+ createElementVNode("span", { class: normalizeClass(["h-1.5 w-1.5 rounded-full", collection.source === "project" ? "bg-indigo-500" : "bg-violet-500"]) }, null, 2),
4475
+ createTextVNode(" " + toDisplayString(unref(t)(`collectionsView.source.${collection.source}`)) + " · ", 1),
4476
+ createElementVNode("code", _hoisted_15$1, toDisplayString(collection.slug), 1)
4477
+ ])]),
4478
+ (openBlock(), createBlock(resolveDynamicComponent(unref(pinToggle)), {
4479
+ kind: "collection",
4480
+ slug: collection.slug,
4481
+ title: collection.title,
4482
+ icon: collection.icon
4483
+ }, null, 8, [
4484
+ "slug",
4485
+ "title",
4486
+ "icon"
4487
+ ])),
4488
+ _cache[4] || (_cache[4] = createElementVNode("div", { class: "h-8 w-8 flex items-center justify-center rounded-lg bg-slate-50 group-hover:bg-indigo-50 text-slate-400 group-hover:text-indigo-600 transition-all duration-300" }, [createElementVNode("span", { class: "material-icons text-lg transition-transform duration-300 group-hover:translate-x-0.5" }, "chevron_right")], -1))
4489
+ ], 40, _hoisted_10$1);
4490
+ }), 128))]))])]);
4491
+ };
4492
+ }
4493
+ });
4494
+ //#endregion
4495
+ //#region src/vue/components/FeedsView.vue?vue&type=script&setup=true&lang.ts
4496
+ var _hoisted_1 = {
4497
+ class: "h-full overflow-y-auto bg-slate-50/50 px-6 py-6",
4498
+ "data-testid": "feeds-view-root"
4499
+ };
4500
+ var _hoisted_2 = { class: "max-w-4xl mx-auto" };
4501
+ var _hoisted_3 = { class: "flex items-center justify-between mb-6" };
4502
+ var _hoisted_4 = { class: "text-xl font-semibold text-slate-800" };
4503
+ var _hoisted_5 = {
4504
+ key: 0,
4505
+ class: "mb-4 flex items-center gap-2 rounded-xl border border-red-200 bg-red-50/50 p-3 text-sm text-red-800 shadow-sm",
4506
+ "data-testid": "feeds-refresh-error"
4507
+ };
4508
+ var _hoisted_6 = {
4509
+ key: 1,
4510
+ class: "flex flex-col items-center justify-center py-20 text-sm text-slate-500 gap-3"
4511
+ };
4512
+ var _hoisted_7 = {
4513
+ key: 2,
4514
+ class: "rounded-xl border border-red-200 bg-red-50/50 p-4 text-sm text-red-800 shadow-sm flex items-center gap-3"
4515
+ };
4516
+ var _hoisted_8 = {
4517
+ key: 3,
4518
+ class: "rounded-xl border border-slate-200 bg-white px-6 py-12 text-center text-sm text-slate-500 shadow-sm"
4519
+ };
4520
+ var _hoisted_9 = { class: "font-medium text-slate-700" };
4521
+ var _hoisted_10 = {
4522
+ key: 4,
4523
+ class: "grid gap-4 sm:grid-cols-2"
4524
+ };
4525
+ var _hoisted_11 = [
4526
+ "data-testid",
4527
+ "onClick",
4528
+ "onKeydown"
4529
+ ];
4530
+ var _hoisted_12 = { class: "h-12 w-12 flex items-center justify-center rounded-xl bg-indigo-50 text-indigo-600 border border-indigo-100/50" };
4531
+ var _hoisted_13 = { class: "material-symbols-outlined text-2xl" };
4532
+ var _hoisted_14 = { class: "flex-1 min-w-0" };
4533
+ var _hoisted_15 = { class: "block font-semibold text-slate-800 text-[15px] truncate" };
4534
+ var _hoisted_16 = { class: "block text-[10px] text-slate-400 mt-1 tracking-wider font-semibold uppercase" };
4535
+ var _hoisted_17 = [
4536
+ "disabled",
4537
+ "title",
4538
+ "aria-label",
4539
+ "data-testid",
4540
+ "onClick"
4541
+ ];
4542
+ var _hoisted_18 = { class: "material-icons text-lg" };
4543
+ var _hoisted_19 = { class: "w-full max-w-md rounded-xl bg-white p-5 shadow-xl" };
4544
+ var _hoisted_20 = { class: "text-sm font-semibold text-slate-800 mb-1" };
4545
+ var _hoisted_21 = { class: "text-xs text-slate-500 mb-3" };
4546
+ var _hoisted_22 = { class: "mt-4 flex justify-end gap-2" };
4547
+ var _hoisted_23 = ["disabled"];
4548
+ //#endregion
4549
+ //#region src/vue/components/FeedsView.vue
4550
+ var FeedsView_default = /* @__PURE__ */ defineComponent({
4551
+ __name: "FeedsView",
4552
+ setup(__props) {
4553
+ const { t } = useCollectionI18n();
4554
+ const cui = collectionUi();
4555
+ const { pinToggle, reconcileShortcuts } = cui;
4556
+ const feeds = ref([]);
4557
+ const loading = ref(true);
4558
+ const loadError = ref(null);
4559
+ const refreshingSlug = ref(null);
4560
+ /** Non-destructive banner for a per-feed Refresh that failed (the
4561
+ * endpoint reports retriever errors via `errors` even on HTTP 200). */
4562
+ const refreshError = ref(null);
4563
+ const addOpen = ref(false);
4564
+ const addUrl = ref("");
4565
+ const addInputEl = ref(null);
4566
+ async function load() {
4567
+ loading.value = true;
4568
+ loadError.value = null;
4569
+ const result = await cui.listFeeds();
4570
+ loading.value = false;
4571
+ if (!result.ok) {
4572
+ loadError.value = result.error;
4573
+ return;
4574
+ }
4575
+ feeds.value = result.data.feeds;
4576
+ reconcileShortcuts("feed", feeds.value.map((feed) => ({
4577
+ slug: feed.slug,
4578
+ title: feed.title,
4579
+ icon: feed.icon || "dynamic_feed"
4580
+ })));
4581
+ }
4582
+ function open(slug) {
4583
+ cui.gotoDetail("feed", slug);
4584
+ }
4585
+ async function refresh(slug) {
4586
+ refreshingSlug.value = slug;
4587
+ refreshError.value = null;
4588
+ const result = await cui.refreshCollection(slug);
4589
+ refreshingSlug.value = null;
4590
+ if (!result.ok) {
4591
+ refreshError.value = t("collectionsView.refreshFailed", { error: result.error });
4592
+ return;
4593
+ }
4594
+ await load();
4595
+ if (result.data.errors.length > 0) refreshError.value = t("collectionsView.refreshFailed", { error: result.data.errors.join("; ") });
4596
+ }
4597
+ function startAddFeedChat() {
4598
+ addUrl.value = "";
4599
+ addOpen.value = true;
4600
+ nextTick(() => addInputEl.value?.focus());
4601
+ }
4602
+ function closeAdd() {
4603
+ addOpen.value = false;
4604
+ }
4605
+ function submitAdd() {
4606
+ const url = addUrl.value.trim();
4607
+ if (!url) return;
4608
+ addOpen.value = false;
4609
+ cui.startChat(t("collectionsView.addFeedPrompt", { url }), cui.personalRoleId);
4610
+ }
4611
+ function formatTime(iso) {
4612
+ const date = new Date(iso);
4613
+ return Number.isNaN(date.getTime()) ? iso : date.toLocaleString();
4614
+ }
4615
+ onMounted(load);
4616
+ return (_ctx, _cache) => {
4617
+ return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [
4618
+ createElementVNode("div", _hoisted_3, [createElementVNode("h1", _hoisted_4, toDisplayString(unref(t)("collectionsView.feedsTitle")), 1), createElementVNode("button", {
4619
+ type: "button",
4620
+ class: "h-8 px-2.5 flex items-center gap-1 rounded bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs transition-colors shadow-sm",
4621
+ "data-testid": "feeds-add",
4622
+ onClick: startAddFeedChat
4623
+ }, [_cache[1] || (_cache[1] = createElementVNode("span", { class: "material-icons text-sm" }, "add", -1)), createElementVNode("span", null, toDisplayString(unref(t)("common.add")), 1)])]),
4624
+ refreshError.value ? (openBlock(), createElementBlock("div", _hoisted_5, [_cache[2] || (_cache[2] = createElementVNode("span", { class: "material-icons text-base text-red-600" }, "error", -1)), createElementVNode("span", null, toDisplayString(refreshError.value), 1)])) : createCommentVNode("", true),
4625
+ loading.value ? (openBlock(), createElementBlock("div", _hoisted_6, [_cache[3] || (_cache[3] = createElementVNode("div", { class: "h-8 w-8 border-2 border-indigo-600/20 border-t-indigo-600 rounded-full animate-spin" }, null, -1)), createElementVNode("span", null, toDisplayString(unref(t)("common.loading")), 1)])) : loadError.value ? (openBlock(), createElementBlock("div", _hoisted_7, [_cache[4] || (_cache[4] = createElementVNode("span", { class: "material-icons text-red-600" }, "error", -1)), createElementVNode("span", null, toDisplayString(unref(t)("collectionsView.loadFailed")) + ": " + toDisplayString(loadError.value), 1)])) : feeds.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_8, [_cache[5] || (_cache[5] = createElementVNode("span", { class: "material-icons text-4xl text-slate-300 mb-2" }, "dynamic_feed", -1)), createElementVNode("p", _hoisted_9, toDisplayString(unref(t)("collectionsView.feedsEmpty")), 1)])) : (openBlock(), createElementBlock("div", _hoisted_10, [(openBlock(true), createElementBlock(Fragment, null, renderList(feeds.value, (feed) => {
4626
+ return openBlock(), createElementBlock("div", {
4627
+ key: feed.slug,
4628
+ class: "group relative rounded-xl border border-slate-200 bg-white p-5 shadow-sm hover:shadow-md hover:border-indigo-300 transition-all duration-300 cursor-pointer flex items-center gap-4 focus:outline-none focus:ring-2 focus:ring-indigo-500/20",
4629
+ role: "button",
4630
+ tabindex: "0",
4631
+ "data-testid": `feeds-card-${feed.slug}`,
4632
+ onClick: ($event) => open(feed.slug),
4633
+ onKeydown: [withKeys(withModifiers(($event) => open(feed.slug), ["self"]), ["enter"]), withKeys(withModifiers(($event) => open(feed.slug), ["self", "prevent"]), ["space"])]
4634
+ }, [
4635
+ createElementVNode("div", _hoisted_12, [createElementVNode("span", _hoisted_13, toDisplayString(feed.icon || "dynamic_feed"), 1)]),
4636
+ createElementVNode("div", _hoisted_14, [createElementVNode("span", _hoisted_15, toDisplayString(feed.title), 1), createElementVNode("span", _hoisted_16, [createTextVNode(toDisplayString(feed.kind) + " · " + toDisplayString(feed.schedule) + " ", 1), feed.lastFetchedAt ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(" · " + toDisplayString(formatTime(feed.lastFetchedAt)), 1)], 64)) : createCommentVNode("", true)])]),
4637
+ (openBlock(), createBlock(resolveDynamicComponent(unref(pinToggle)), {
4638
+ kind: "feed",
4639
+ slug: feed.slug,
4640
+ title: feed.title,
4641
+ icon: feed.icon || "dynamic_feed"
4642
+ }, null, 8, [
4643
+ "slug",
4644
+ "title",
4645
+ "icon"
4646
+ ])),
4647
+ createElementVNode("button", {
4648
+ type: "button",
4649
+ class: "h-8 w-8 flex items-center justify-center rounded-lg bg-slate-50 hover:bg-indigo-50 text-slate-400 hover:text-indigo-600 transition-all duration-300 disabled:opacity-50",
4650
+ disabled: refreshingSlug.value === feed.slug,
4651
+ title: unref(t)("collectionsView.refreshFeed"),
4652
+ "aria-label": unref(t)("collectionsView.refreshFeed"),
4653
+ "data-testid": `feeds-refresh-${feed.slug}`,
4654
+ onClick: withModifiers(($event) => refresh(feed.slug), ["stop"])
4655
+ }, [createElementVNode("span", _hoisted_18, toDisplayString(refreshingSlug.value === feed.slug ? "hourglass_empty" : "refresh"), 1)], 8, _hoisted_17)
4656
+ ], 40, _hoisted_11);
4657
+ }), 128))]))
4658
+ ]), addOpen.value ? (openBlock(), createElementBlock("div", {
4659
+ key: 0,
4660
+ class: "fixed inset-0 z-40 flex items-center justify-center bg-black/30 p-4",
4661
+ onClick: withModifiers(closeAdd, ["self"])
4662
+ }, [createElementVNode("div", _hoisted_19, [
4663
+ createElementVNode("h2", _hoisted_20, toDisplayString(unref(t)("collectionsView.addFeedTitle")), 1),
4664
+ createElementVNode("p", _hoisted_21, toDisplayString(unref(t)("collectionsView.addFeedHint")), 1),
4665
+ withDirectives(createElementVNode("input", {
4666
+ ref_key: "addInputEl",
4667
+ ref: addInputEl,
4668
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => addUrl.value = $event),
4669
+ type: "url",
4670
+ placeholder: "https://example.com/feed.xml",
4671
+ class: "w-full rounded border border-slate-200 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-500",
4672
+ "data-testid": "feeds-add-url",
4673
+ onKeydown: [withKeys(submitAdd, ["enter"]), withKeys(closeAdd, ["esc"])]
4674
+ }, null, 544), [[vModelText, addUrl.value]]),
4675
+ createElementVNode("div", _hoisted_22, [createElementVNode("button", {
4676
+ type: "button",
4677
+ class: "h-8 px-3 rounded text-xs font-medium text-slate-600 hover:bg-slate-100",
4678
+ onClick: closeAdd
4679
+ }, toDisplayString(unref(t)("common.cancel")), 1), createElementVNode("button", {
4680
+ type: "button",
4681
+ class: "h-8 px-3 rounded bg-indigo-600 hover:bg-indigo-700 text-white text-xs font-bold disabled:opacity-50",
4682
+ disabled: !addUrl.value.trim(),
4683
+ "data-testid": "feeds-add-submit",
4684
+ onClick: submitAdd
4685
+ }, toDisplayString(unref(t)("common.add")), 9, _hoisted_23)])
4686
+ ])])) : createCommentVNode("", true)]);
4687
+ };
4688
+ }
4689
+ });
4690
+ //#endregion
4691
+ export { CollectionCalendarView_default as CollectionCalendarView, CollectionCustomView_default as CollectionCustomView, CollectionDayView_default as CollectionDayView, CollectionEmbedView_default as CollectionEmbedView, CollectionKanbanView_default as CollectionKanbanView, CollectionRecordModal_default as CollectionRecordModal, CollectionRecordPanel_default as CollectionRecordPanel, CollectionView_default as CollectionView, CollectionViewConfigModal_default as CollectionViewConfigModal, CollectionsIndexView_default as CollectionsIndexView, FeedsView_default as FeedsView, collectionUi, configureCollectionUi, readCollectionSort, readCollectionViewMode, useCollectionRendering, writeCollectionSort, writeCollectionViewMode };
1612
4692
 
1613
4693
  //# sourceMappingURL=vue.js.map