@protobase/ui 0.121.4 → 0.121.6

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 (311) hide show
  1. package/dist/account/messages.d.ts +2 -2
  2. package/dist/activity-chart/messages.d.ts +2 -2
  3. package/dist/app/change-confirm/messages.d.ts +2 -2
  4. package/dist/app/charts/messages.d.ts +2 -2
  5. package/dist/app/confirm-sign-in-messages.d.ts +2 -2
  6. package/dist/app/conversation/messages.d.ts +2 -2
  7. package/dist/app/conversation-page/conversation-message.d.ts +10 -7
  8. package/dist/app/conversation-page/conversation-message.js +107 -20
  9. package/dist/app/conversation-page/conversation-messages.d.ts +9 -3
  10. package/dist/app/conversation-page/conversation-messages.js +42 -26
  11. package/dist/app/conversation-page/conversation-page.d.ts +2 -1
  12. package/dist/app/conversation-page/conversation-page.js +51 -30
  13. package/dist/app/conversation-page/conversation-reads.d.ts +17 -3
  14. package/dist/app/conversation-page/conversation-reads.js +30 -4
  15. package/dist/app/conversation-page/delete-message-dialog.d.ts +7 -0
  16. package/dist/app/conversation-page/delete-message-dialog.js +22 -0
  17. package/dist/app/conversation-page/message-access.d.ts +19 -0
  18. package/dist/app/conversation-page/message-access.js +25 -0
  19. package/dist/app/conversation-page/message-actions-bar.d.ts +12 -0
  20. package/dist/app/conversation-page/message-actions-bar.js +57 -0
  21. package/dist/app/conversation-page/message-actions-sheet.d.ts +18 -0
  22. package/dist/app/conversation-page/message-actions-sheet.js +73 -0
  23. package/dist/app/conversation-page/message-controls.d.ts +19 -0
  24. package/dist/app/conversation-page/message-controls.js +0 -0
  25. package/dist/app/conversation-page/message-editor.d.ts +23 -0
  26. package/dist/app/conversation-page/message-editor.js +72 -0
  27. package/dist/app/conversation-page/message-press.d.ts +59 -0
  28. package/dist/app/conversation-page/message-press.js +55 -0
  29. package/dist/app/conversation-page/message-setup.d.ts +27 -0
  30. package/dist/app/conversation-page/message-setup.js +0 -0
  31. package/dist/app/conversation-page/messages.d.ts +2 -2
  32. package/dist/app/conversation-page/reaction-chips.d.ts +18 -0
  33. package/dist/app/conversation-page/reaction-chips.js +30 -0
  34. package/dist/app/conversation-page/reactions.d.ts +28 -0
  35. package/dist/app/conversation-page/reactions.js +31 -0
  36. package/dist/app/conversation-page/reply-labels.d.ts +4 -0
  37. package/dist/app/conversation-page/reply-labels.js +9 -0
  38. package/dist/app/conversation-page/thread-head.d.ts +4 -0
  39. package/dist/app/conversation-page/thread-head.js +5 -0
  40. package/dist/app/conversation-page/thread-panel.d.ts +25 -0
  41. package/dist/app/conversation-page/thread-panel.js +107 -0
  42. package/dist/app/conversation-page/thread-summary.d.ts +10 -0
  43. package/dist/app/conversation-page/thread-summary.js +26 -0
  44. package/dist/app/conversation-page/use-message-controls.d.ts +14 -0
  45. package/dist/app/conversation-page/use-message-controls.js +32 -0
  46. package/dist/app/conversation-page/use-message-press.d.ts +16 -0
  47. package/dist/app/conversation-page/use-message-press.js +88 -0
  48. package/dist/app/conversation-page/use-message-reactions.d.ts +13 -0
  49. package/dist/app/conversation-page/use-message-reactions.js +24 -0
  50. package/dist/app/conversation-page/use-message-setup.d.ts +19 -0
  51. package/dist/app/conversation-page/use-message-setup.js +33 -0
  52. package/dist/app/conversation-page/use-message-writes.d.ts +14 -0
  53. package/dist/app/conversation-page/use-message-writes.js +49 -0
  54. package/dist/app/conversation-page/use-thread-address.d.ts +13 -0
  55. package/dist/app/conversation-page/use-thread-address.js +29 -0
  56. package/dist/app/conversation-page/use-thread-head.d.ts +15 -0
  57. package/dist/app/conversation-page/use-thread-head.js +31 -0
  58. package/dist/app/create/messages.d.ts +2 -2
  59. package/dist/app/current-address.d.ts +1 -0
  60. package/dist/app/current-address.js +2 -1
  61. package/dist/app/custom-section.d.ts +1 -1
  62. package/dist/app/delete/messages.d.ts +2 -2
  63. package/dist/app/displays/list-cards.d.ts +1 -1
  64. package/dist/app/displays/messages.d.ts +2 -2
  65. package/dist/app/embedded-list/messages.d.ts +2 -2
  66. package/dist/app/export/messages.d.ts +2 -2
  67. package/dist/app/field-messages.d.ts +2 -2
  68. package/dist/app/field-types/custom-step-container/messages.d.ts +2 -2
  69. package/dist/app/field-types/runner-install/messages.d.ts +2 -2
  70. package/dist/app/field-types/widget-part.d.ts +1 -1
  71. package/dist/app/field-types/workflow/messages.d.ts +2 -2
  72. package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
  73. package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
  74. package/dist/app/file-viewers/messages.d.ts +2 -2
  75. package/dist/app/focus/messages.d.ts +2 -2
  76. package/dist/app/hand-order/messages.d.ts +2 -2
  77. package/dist/app/import/messages.d.ts +2 -2
  78. package/dist/app/list-edit/messages.d.ts +2 -2
  79. package/dist/app/list-messages.d.ts +2 -2
  80. package/dist/app/messages.d.ts +2 -2
  81. package/dist/app/meta-gate-messages.d.ts +2 -2
  82. package/dist/app/new-version/messages.d.ts +2 -2
  83. package/dist/app/pages/custom-boundary.d.ts +1 -1
  84. package/dist/app/pages/custom-chosen.d.ts +1 -1
  85. package/dist/app/pages/messages.d.ts +2 -2
  86. package/dist/app/record-chart/messages.d.ts +2 -2
  87. package/dist/app/record-messages.d.ts +2 -2
  88. package/dist/app/record-mode/shown-layout.d.ts +1 -1
  89. package/dist/app/record-row/messages.d.ts +2 -2
  90. package/dist/app/related-cards/messages.d.ts +2 -2
  91. package/dist/app/runtime/messages.d.ts +2 -2
  92. package/dist/app/saved/messages.d.ts +2 -2
  93. package/dist/app/saved/saved-list.d.ts +1 -1
  94. package/dist/app/searches/messages.d.ts +2 -2
  95. package/dist/app-shell/messages.d.ts +2 -2
  96. package/dist/assistant-dock/messages.d.ts +2 -2
  97. package/dist/auth/messages.d.ts +2 -2
  98. package/dist/calls/messages.d.ts +2 -2
  99. package/dist/compact-table/messages.d.ts +2 -2
  100. package/dist/data/query-keys.d.ts +2 -0
  101. package/dist/data/query-keys.js +7 -0
  102. package/dist/data-grid/column-spec.d.ts +1 -1
  103. package/dist/data-grid/messages.d.ts +2 -2
  104. package/dist/filter-panel/messages.d.ts +2 -2
  105. package/dist/format/messages.d.ts +2 -2
  106. package/dist/forms/messages.d.ts +2 -2
  107. package/dist/invitations/messages.d.ts +2 -2
  108. package/dist/locale/en.js +33 -1
  109. package/dist/locale/en.json.d.ts +32 -0
  110. package/dist/locale/messages.d.ts +64 -0
  111. package/dist/locale/nl.js +33 -1
  112. package/dist/locale/texts-gate.d.ts +1 -1
  113. package/dist/mailbox/messages.d.ts +2 -2
  114. package/dist/mentions/messages.d.ts +2 -2
  115. package/dist/mocks/orders.d.ts +1 -1
  116. package/dist/notifications/bell/messages.d.ts +2 -2
  117. package/dist/organizations/messages.d.ts +2 -2
  118. package/dist/package.js +1 -1
  119. package/dist/plugins/before-sign-in.d.ts +1 -1
  120. package/dist/primitives/messages.d.ts +2 -2
  121. package/dist/record-view/messages.d.ts +2 -2
  122. package/dist/shell/assets/{account-page-DUZhZTQe.js → account-page-D1S57VfK.js} +2 -2
  123. package/dist/shell/assets/{app-CWCg5I0x.js → app-2d0YQdR7.js} +7 -7
  124. package/dist/shell/assets/app-Cv0aTDUz.css +2 -0
  125. package/dist/shell/assets/{assistant-shell-BB-qTSNN.js → assistant-shell-Bb0KRa8E.js} +2 -2
  126. package/dist/shell/assets/board-display-B0hMSJLc.js +2 -0
  127. package/dist/shell/assets/calendar-display-DNTXJ2Lj.js +2 -0
  128. package/dist/shell/assets/{call-rings-CMu9LCVA.js → call-rings-D2efFDY-.js} +2 -2
  129. package/dist/shell/assets/{calls-CAwUiNFC.js → calls-mmgOyL_n.js} +2 -2
  130. package/dist/shell/assets/{circle-alert-DBbXAqFr.js → circle-alert-BWBUUk9M.js} +2 -2
  131. package/dist/shell/assets/{composed-page-CDZcDEpb.js → composed-page-jwnPyg2o.js} +2 -2
  132. package/dist/shell/assets/{composer-section-BLXex8WX.js → composer-section-raPl4Mf_.js} +2 -2
  133. package/dist/shell/assets/{connect-route-DMz3C4cs.js → connect-route-DnTRKFdW.js} +2 -2
  134. package/dist/shell/assets/{copy-field-D0wtSWzb.js → copy-field-BtAsyigB.js} +2 -2
  135. package/dist/shell/assets/create-route-CEuERj3K.js +2 -0
  136. package/dist/shell/assets/{custom-step-container-field-B2IfCGAR.js → custom-step-container-field-B1RXdjeH.js} +4 -4
  137. package/dist/shell/assets/embedded-list-BIvBUQCm.js +3 -0
  138. package/dist/shell/assets/en-_QUqgkv9.js +2 -0
  139. package/dist/shell/assets/{export-dialog-Ogugn53w.js → export-dialog-BibbA1JE.js} +2 -2
  140. package/dist/shell/assets/export-worker-BUvAe-pU.js +15 -0
  141. package/dist/shell/assets/{first-organization-page-C4-rQ_I2.js → first-organization-page-DgL_N1W1.js} +2 -2
  142. package/dist/shell/assets/{graph-view-CzTg5srj.js → graph-view-D5uSsu67.js} +2 -2
  143. package/dist/shell/assets/{group-donut-3ebIs5gF.js → group-donut-BeAjogon.js} +2 -2
  144. package/dist/shell/assets/{guest-call-page-CD0LJIht.js → guest-call-page-DXOfa3rF.js} +3 -3
  145. package/dist/shell/assets/{html-viewer-BYJGABwQ.js → html-viewer-SuYrL7fw.js} +2 -2
  146. package/dist/shell/assets/{import-dialog-BpUqiIUH.js → import-dialog-DjMoHP8N.js} +2 -2
  147. package/dist/shell/assets/import-table-dialog-45beoZDX.js +2 -0
  148. package/dist/shell/assets/{index-k2uQ-7c-.js → index-CH_1Ns3R.js} +1 -1
  149. package/dist/shell/assets/{invitations-page-BsN4z7EC.js → invitations-page-CwtY8Tbq.js} +2 -2
  150. package/dist/shell/assets/{layout-grid-DvW29fH0.js → layout-grid-DSS3tNid.js} +2 -2
  151. package/dist/shell/assets/{legend-item-CuD1ms2_.js → legend-item--JCuOrBW.js} +2 -2
  152. package/dist/shell/assets/list-page-Do4wAJXr.js +4 -0
  153. package/dist/shell/assets/{maplibre-DWK2ok5e.js → maplibre-DmuZi_YZ.js} +2 -2
  154. package/dist/shell/assets/{markdown-content-HRnOc3WU.js → markdown-content-B0lkEYGr.js} +2 -2
  155. package/dist/shell/assets/members-page-BaLe1e4J.js +2 -0
  156. package/dist/shell/assets/{message-content-ypqgAMEt.js → message-content-JJSKhX2W.js} +3 -3
  157. package/dist/shell/assets/messages-BaKmueMc.js +2 -0
  158. package/dist/shell/assets/nl-B7S2-35v.js +2 -0
  159. package/dist/shell/assets/organization-page-CIML07Cz.js +2 -0
  160. package/dist/shell/assets/organizations-page-Cctkt6cu.js +2 -0
  161. package/dist/shell/assets/parse-worker-BXZM3e8_.js +35 -0
  162. package/dist/shell/assets/{pending-invitation-row-1zBmAsKC.js → pending-invitation-row-xf_wfIQ2.js} +2 -2
  163. package/dist/shell/assets/{period-chart-Mcf3pdtE.js → period-chart-Cuw7AISK.js} +2 -2
  164. package/dist/shell/assets/{person-row-Dg1T6u1A.js → person-row-DtXuek5W.js} +2 -2
  165. package/dist/shell/assets/public-form-page-noW7JMKv.js +2 -0
  166. package/dist/shell/assets/{record-lines-B4MMhxps.js → record-lines-B-Wll3-R.js} +2 -2
  167. package/dist/shell/assets/{record-map-C8o8jmlo.js → record-map-D6Yog0Uu.js} +2 -2
  168. package/dist/shell/assets/{record-opens-Ds_etNOv.js → record-opens-Cy15Gu5o.js} +2 -2
  169. package/dist/shell/assets/record-page-Bo0pD8vx.js +3 -0
  170. package/dist/shell/assets/{record-preview-C2bjzVoh.js → record-preview-CDgsSTFF.js} +2 -2
  171. package/dist/shell/assets/{records-map-DT_SwhgY.js → records-map-CV5k8jcU.js} +2 -2
  172. package/dist/shell/assets/render-node-CtZZjLGx.js +3 -0
  173. package/dist/shell/assets/reorder-button-DHV9_n1M.js +2 -0
  174. package/dist/shell/assets/{run-trace-view-CScFddUb.js → run-trace-view-DOyzvKTV.js} +2 -2
  175. package/dist/shell/assets/{runner-install-field-DyyHVUfd.js → runner-install-field-CJberN6i.js} +2 -2
  176. package/dist/shell/assets/{runtime-update-CuLL4Qbm.js → runtime-update-DiRL2UEA.js} +2 -2
  177. package/dist/shell/assets/shared-protobase-ui-Bq-qMwVs.js +1 -0
  178. package/dist/shell/assets/{sheet-source-IXyzIyO8.js → sheet-source-xZ9l3FLl.js} +3 -3
  179. package/dist/shell/assets/sign-in-policy-page-BUKwvVFG.js +2 -0
  180. package/dist/shell/assets/start-block-queries-s1eLXHpW.js +2 -0
  181. package/dist/shell/assets/step-catalog-BvlUh62_.js +2 -0
  182. package/dist/shell/assets/{step-panel-CA5-2Doz.js → step-panel-BGJiJ7z6.js} +2 -2
  183. package/dist/shell/assets/timeline-display-B_xs7U-p.js +2 -0
  184. package/dist/shell/assets/{trash-Cd-g6Eyo.js → trash-BfWYOlBD.js} +2 -2
  185. package/dist/shell/assets/{update-set-DfPWNMBL.js → update-set-iwxyRxhm.js} +2 -2
  186. package/dist/shell/assets/use-calendar-move-Cd92WAhx.js +2 -0
  187. package/dist/shell/assets/{use-display-rows-CYGJYJrz.js → use-display-rows-HuX1NEhA.js} +2 -2
  188. package/dist/shell/assets/use-my-invitations-DaKmW2De.js +2 -0
  189. package/dist/shell/assets/{use-paged-search-cBs-xWuq.js → use-paged-search-DPuOZYVz.js} +2 -2
  190. package/dist/shell/assets/{use-run-trace-CSdKdxn9.js → use-run-trace-Dukz4W0q.js} +2 -2
  191. package/dist/shell/assets/{use-workflow-page-DGd_5JMB.js → use-workflow-page-Cgw-Aurp.js} +2 -2
  192. package/dist/shell/assets/{use-workflow-types-BQl6tPM-.js → use-workflow-types-B1NI4zqE.js} +2 -2
  193. package/dist/shell/assets/{workflow-canvas-DbLkc3zJ.js → workflow-canvas-B-IYnZVg.js} +4 -4
  194. package/dist/shell/assets/{workflow-field-DRAphvYG.js → workflow-field-BSH37gjx.js} +3 -3
  195. package/dist/shell/assets/{workflow-graph-editor-CzgoB1_t.js → workflow-graph-editor-C1U_7a-n.js} +2 -2
  196. package/dist/shell/assets/{workflow-run-field-CQf9E5e1.js → workflow-run-field-D_yV-Pdt.js} +3 -3
  197. package/dist/shell/assets/workflow-status-field-CIX3WM-W.js +2 -0
  198. package/dist/shell/assets/workflow-workbench-CoVlp47h.js +4 -0
  199. package/dist/shell/index.html +4 -4
  200. package/dist/shell/protobase.shell.json +2 -2
  201. package/dist/shell/protobase.sw.js +2 -2
  202. package/dist/shell-source-maps/assets/{account-page-DUZhZTQe.js.map → account-page-D1S57VfK.js.map} +1 -1
  203. package/dist/shell-source-maps/assets/app-2d0YQdR7.js.map +1 -0
  204. package/dist/shell-source-maps/assets/{assistant-shell-BB-qTSNN.js.map → assistant-shell-Bb0KRa8E.js.map} +1 -1
  205. package/dist/shell-source-maps/assets/{board-display-DxdFR3Wq.js.map → board-display-B0hMSJLc.js.map} +1 -1
  206. package/dist/shell-source-maps/assets/{calendar-display-uBGEfuIv.js.map → calendar-display-DNTXJ2Lj.js.map} +1 -1
  207. package/dist/shell-source-maps/assets/{call-rings-CMu9LCVA.js.map → call-rings-D2efFDY-.js.map} +1 -1
  208. package/dist/shell-source-maps/assets/{calls-CAwUiNFC.js.map → calls-mmgOyL_n.js.map} +1 -1
  209. package/dist/shell-source-maps/assets/{circle-alert-DBbXAqFr.js.map → circle-alert-BWBUUk9M.js.map} +1 -1
  210. package/dist/shell-source-maps/assets/{composed-page-CDZcDEpb.js.map → composed-page-jwnPyg2o.js.map} +1 -1
  211. package/dist/shell-source-maps/assets/{composer-section-BLXex8WX.js.map → composer-section-raPl4Mf_.js.map} +1 -1
  212. package/dist/shell-source-maps/assets/{connect-route-DMz3C4cs.js.map → connect-route-DnTRKFdW.js.map} +1 -1
  213. package/dist/shell-source-maps/assets/{copy-field-D0wtSWzb.js.map → copy-field-BtAsyigB.js.map} +1 -1
  214. package/dist/shell-source-maps/assets/{create-route-BQoMwg6m.js.map → create-route-CEuERj3K.js.map} +1 -1
  215. package/dist/shell-source-maps/assets/{custom-step-container-field-B2IfCGAR.js.map → custom-step-container-field-B1RXdjeH.js.map} +1 -1
  216. package/dist/shell-source-maps/assets/{embedded-list-BOlcwiiA.js.map → embedded-list-BIvBUQCm.js.map} +1 -1
  217. package/dist/shell-source-maps/assets/{en-BED8S1rX.js.map → en-_QUqgkv9.js.map} +1 -1
  218. package/dist/shell-source-maps/assets/{export-dialog-Ogugn53w.js.map → export-dialog-BibbA1JE.js.map} +1 -1
  219. package/dist/shell-source-maps/assets/export-worker-BUvAe-pU.js.map +1 -0
  220. package/dist/shell-source-maps/assets/{first-organization-page-C4-rQ_I2.js.map → first-organization-page-DgL_N1W1.js.map} +1 -1
  221. package/dist/shell-source-maps/assets/{graph-view-CzTg5srj.js.map → graph-view-D5uSsu67.js.map} +1 -1
  222. package/dist/shell-source-maps/assets/{group-donut-3ebIs5gF.js.map → group-donut-BeAjogon.js.map} +1 -1
  223. package/dist/shell-source-maps/assets/{guest-call-page-CD0LJIht.js.map → guest-call-page-DXOfa3rF.js.map} +1 -1
  224. package/dist/shell-source-maps/assets/{html-viewer-BYJGABwQ.js.map → html-viewer-SuYrL7fw.js.map} +1 -1
  225. package/dist/shell-source-maps/assets/{import-dialog-BpUqiIUH.js.map → import-dialog-DjMoHP8N.js.map} +1 -1
  226. package/dist/shell-source-maps/assets/{import-table-dialog-CYYjVijG.js.map → import-table-dialog-45beoZDX.js.map} +1 -1
  227. package/dist/shell-source-maps/assets/{invitations-page-BsN4z7EC.js.map → invitations-page-CwtY8Tbq.js.map} +1 -1
  228. package/dist/shell-source-maps/assets/{layout-grid-DvW29fH0.js.map → layout-grid-DSS3tNid.js.map} +1 -1
  229. package/dist/shell-source-maps/assets/{legend-item-CuD1ms2_.js.map → legend-item--JCuOrBW.js.map} +1 -1
  230. package/dist/shell-source-maps/assets/{list-page-BtuFsbiK.js.map → list-page-Do4wAJXr.js.map} +1 -1
  231. package/dist/shell-source-maps/assets/{maplibre-DWK2ok5e.js.map → maplibre-DmuZi_YZ.js.map} +1 -1
  232. package/dist/shell-source-maps/assets/{markdown-content-HRnOc3WU.js.map → markdown-content-B0lkEYGr.js.map} +1 -1
  233. package/dist/shell-source-maps/assets/{members-page-CXYBNAaR.js.map → members-page-BaLe1e4J.js.map} +1 -1
  234. package/dist/shell-source-maps/assets/{message-content-ypqgAMEt.js.map → message-content-JJSKhX2W.js.map} +1 -1
  235. package/dist/shell-source-maps/assets/{messages-QTTbTkpW.js.map → messages-BaKmueMc.js.map} +1 -1
  236. package/dist/shell-source-maps/assets/nl-B7S2-35v.js.map +1 -0
  237. package/dist/shell-source-maps/assets/{organization-page-C0iuWYaS.js.map → organization-page-CIML07Cz.js.map} +1 -1
  238. package/dist/shell-source-maps/assets/{organizations-page-BOryGu_-.js.map → organizations-page-Cctkt6cu.js.map} +1 -1
  239. package/dist/shell-source-maps/assets/parse-worker-BXZM3e8_.js.map +1 -0
  240. package/dist/shell-source-maps/assets/{pending-invitation-row-1zBmAsKC.js.map → pending-invitation-row-xf_wfIQ2.js.map} +1 -1
  241. package/dist/shell-source-maps/assets/{period-chart-Mcf3pdtE.js.map → period-chart-Cuw7AISK.js.map} +1 -1
  242. package/dist/shell-source-maps/assets/{person-row-Dg1T6u1A.js.map → person-row-DtXuek5W.js.map} +1 -1
  243. package/dist/shell-source-maps/assets/{public-form-page-DKBrB0BB.js.map → public-form-page-noW7JMKv.js.map} +1 -1
  244. package/dist/shell-source-maps/assets/{record-lines-B4MMhxps.js.map → record-lines-B-Wll3-R.js.map} +1 -1
  245. package/dist/shell-source-maps/assets/{record-map-C8o8jmlo.js.map → record-map-D6Yog0Uu.js.map} +1 -1
  246. package/dist/shell-source-maps/assets/{record-opens-Ds_etNOv.js.map → record-opens-Cy15Gu5o.js.map} +1 -1
  247. package/dist/shell-source-maps/assets/record-page-Bo0pD8vx.js.map +1 -0
  248. package/dist/shell-source-maps/assets/{record-preview-C2bjzVoh.js.map → record-preview-CDgsSTFF.js.map} +1 -1
  249. package/dist/shell-source-maps/assets/{records-map-DT_SwhgY.js.map → records-map-CV5k8jcU.js.map} +1 -1
  250. package/dist/shell-source-maps/assets/{render-node-BKYZK3FU.js.map → render-node-CtZZjLGx.js.map} +1 -1
  251. package/dist/shell-source-maps/assets/{reorder-button-DmgQZa3E.js.map → reorder-button-DHV9_n1M.js.map} +1 -1
  252. package/dist/shell-source-maps/assets/{run-trace-view-CScFddUb.js.map → run-trace-view-DOyzvKTV.js.map} +1 -1
  253. package/dist/shell-source-maps/assets/{runner-install-field-DyyHVUfd.js.map → runner-install-field-CJberN6i.js.map} +1 -1
  254. package/dist/shell-source-maps/assets/{runtime-update-CuLL4Qbm.js.map → runtime-update-DiRL2UEA.js.map} +1 -1
  255. package/dist/shell-source-maps/assets/{sheet-source-IXyzIyO8.js.map → sheet-source-xZ9l3FLl.js.map} +1 -1
  256. package/dist/shell-source-maps/assets/{sign-in-policy-page-Dto5W87n.js.map → sign-in-policy-page-BUKwvVFG.js.map} +1 -1
  257. package/dist/shell-source-maps/assets/{start-block-queries-DNegRXtD.js.map → start-block-queries-s1eLXHpW.js.map} +1 -1
  258. package/dist/shell-source-maps/assets/{step-catalog-Dw8bipyJ.js.map → step-catalog-BvlUh62_.js.map} +1 -1
  259. package/dist/shell-source-maps/assets/{step-panel-CA5-2Doz.js.map → step-panel-BGJiJ7z6.js.map} +1 -1
  260. package/dist/shell-source-maps/assets/{timeline-display-BLF3onV2.js.map → timeline-display-B_xs7U-p.js.map} +1 -1
  261. package/dist/shell-source-maps/assets/{trash-Cd-g6Eyo.js.map → trash-BfWYOlBD.js.map} +1 -1
  262. package/dist/shell-source-maps/assets/{update-set-DfPWNMBL.js.map → update-set-iwxyRxhm.js.map} +1 -1
  263. package/dist/shell-source-maps/assets/{use-calendar-move-J9sB_jXo.js.map → use-calendar-move-Cd92WAhx.js.map} +1 -1
  264. package/dist/shell-source-maps/assets/{use-display-rows-CYGJYJrz.js.map → use-display-rows-HuX1NEhA.js.map} +1 -1
  265. package/dist/shell-source-maps/assets/{use-my-invitations-DZ0rA8RK.js.map → use-my-invitations-DaKmW2De.js.map} +1 -1
  266. package/dist/shell-source-maps/assets/{use-paged-search-cBs-xWuq.js.map → use-paged-search-DPuOZYVz.js.map} +1 -1
  267. package/dist/shell-source-maps/assets/{use-run-trace-CSdKdxn9.js.map → use-run-trace-Dukz4W0q.js.map} +1 -1
  268. package/dist/shell-source-maps/assets/{use-workflow-page-DGd_5JMB.js.map → use-workflow-page-Cgw-Aurp.js.map} +1 -1
  269. package/dist/shell-source-maps/assets/{use-workflow-types-BQl6tPM-.js.map → use-workflow-types-B1NI4zqE.js.map} +1 -1
  270. package/dist/shell-source-maps/assets/{workflow-canvas-DbLkc3zJ.js.map → workflow-canvas-B-IYnZVg.js.map} +1 -1
  271. package/dist/shell-source-maps/assets/{workflow-field-DRAphvYG.js.map → workflow-field-BSH37gjx.js.map} +1 -1
  272. package/dist/shell-source-maps/assets/{workflow-graph-editor-CzgoB1_t.js.map → workflow-graph-editor-C1U_7a-n.js.map} +1 -1
  273. package/dist/shell-source-maps/assets/{workflow-run-field-CQf9E5e1.js.map → workflow-run-field-D_yV-Pdt.js.map} +1 -1
  274. package/dist/shell-source-maps/assets/{workflow-status-field-CiaCtBkf.js.map → workflow-status-field-CIX3WM-W.js.map} +1 -1
  275. package/dist/shell-source-maps/assets/{workflow-workbench-CMl69WwH.js.map → workflow-workbench-CoVlp47h.js.map} +1 -1
  276. package/dist/status/messages.d.ts +2 -2
  277. package/dist/users/messages.d.ts +2 -2
  278. package/package.json +5 -5
  279. package/dist/shell/assets/app-DLkpxjgP.css +0 -2
  280. package/dist/shell/assets/board-display-DxdFR3Wq.js +0 -2
  281. package/dist/shell/assets/calendar-display-uBGEfuIv.js +0 -2
  282. package/dist/shell/assets/create-route-BQoMwg6m.js +0 -2
  283. package/dist/shell/assets/embedded-list-BOlcwiiA.js +0 -3
  284. package/dist/shell/assets/en-BED8S1rX.js +0 -2
  285. package/dist/shell/assets/export-worker-S5xPFD_M.js +0 -15
  286. package/dist/shell/assets/import-table-dialog-CYYjVijG.js +0 -2
  287. package/dist/shell/assets/list-page-BtuFsbiK.js +0 -4
  288. package/dist/shell/assets/members-page-CXYBNAaR.js +0 -2
  289. package/dist/shell/assets/messages-QTTbTkpW.js +0 -2
  290. package/dist/shell/assets/nl-DjHVomkB.js +0 -2
  291. package/dist/shell/assets/organization-page-C0iuWYaS.js +0 -2
  292. package/dist/shell/assets/organizations-page-BOryGu_-.js +0 -2
  293. package/dist/shell/assets/parse-worker-CO_GFfU7.js +0 -35
  294. package/dist/shell/assets/public-form-page-DKBrB0BB.js +0 -2
  295. package/dist/shell/assets/record-page-DR3a2_Z8.js +0 -3
  296. package/dist/shell/assets/render-node-BKYZK3FU.js +0 -3
  297. package/dist/shell/assets/reorder-button-DmgQZa3E.js +0 -2
  298. package/dist/shell/assets/shared-protobase-ui-DOsgmmrs.js +0 -1
  299. package/dist/shell/assets/sign-in-policy-page-Dto5W87n.js +0 -2
  300. package/dist/shell/assets/start-block-queries-DNegRXtD.js +0 -2
  301. package/dist/shell/assets/step-catalog-Dw8bipyJ.js +0 -2
  302. package/dist/shell/assets/timeline-display-BLF3onV2.js +0 -2
  303. package/dist/shell/assets/use-calendar-move-J9sB_jXo.js +0 -2
  304. package/dist/shell/assets/use-my-invitations-DZ0rA8RK.js +0 -2
  305. package/dist/shell/assets/workflow-status-field-CiaCtBkf.js +0 -2
  306. package/dist/shell/assets/workflow-workbench-CMl69WwH.js +0 -4
  307. package/dist/shell-source-maps/assets/app-CWCg5I0x.js.map +0 -1
  308. package/dist/shell-source-maps/assets/export-worker-S5xPFD_M.js.map +0 -1
  309. package/dist/shell-source-maps/assets/nl-DjHVomkB.js.map +0 -1
  310. package/dist/shell-source-maps/assets/parse-worker-CO_GFfU7.js.map +0 -1
  311. package/dist/shell-source-maps/assets/record-page-DR3a2_Z8.js.map +0 -1
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/graph-view-D5uSsu67.js","assets/rolldown-runtime-DFwUHQ4A.js","assets/react-CuiNlnus.js","assets/app-2d0YQdR7.js","assets/vendor-t7Q7QbPu.js","assets/app-Cv0aTDUz.css","assets/lib-xyflow-system-hojcPWkY.js","assets/lib-d3-interpolate-C7dFwq8w.js","assets/lib-d3-color-B6XHLQii.js","assets/lib-d3-selection-C1a5EtaJ.js","assets/lib-d3-drag-CUJR_Vab.js","assets/lib-d3-dispatch-Bjkn7q4t.js","assets/lib-d3-zoom-DuEhbOrX.js","assets/lib-d3-transition-CUMO2iZu.js","assets/lib-d3-timer-CduGpaSm.js","assets/lib-d3-ease-ouQSXgQM.js","assets/lib-xyflow-react-CuNAzocq.js","assets/lib-classcat-otpLnDWv.js","assets/lib-zustand-r6mNROKr.js","assets/lib-use-sync-external-store-D4s7MiFL.js","assets/lib-xyflow-react-DLioOiRN.css","assets/use-elk-u1Ql5AOs.js","assets/lib-elkjs-ylMkguT9.js"])))=>i.map(i=>d[i]);
2
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$n as r,$o as i,A as a,Aa as o,As as s,Ba as c,Bn as l,Bs as u,Ca as d,Cn as f,Da as p,Di as m,Ds as h,Ea as g,Es as _,Fs as v,Ft as y,Go as b,Gs as x,Hc as S,Hn as C,Hr as w,Hs as T,I as E,Il as ee,Is as D,It as te,Jc as O,Jn as ne,Js as re,Ko as ie,Kr as ae,Ks as oe,La as se,Ll as ce,Ls as le,Mc as ue,Ms as de,Mt as fe,N as pe,No as k,Nt as me,O as he,On as ge,Os as A,Pi as _e,Ps as ve,Pt as ye,Qa as be,Qo as j,Qt as xe,Sa as Se,Sn as Ce,Tc as we,Ti as Te,Ts as M,Ui as Ee,Ul as De,Un as Oe,Ur as ke,Us as Ae,V as je,Va as Me,Vn as Ne,Vs as Pe,Wl as Fe,Ws as Ie,Xa as N,Xo as Le,Xt as Re,Ya as ze,Yo as Be,Ys as Ve,Za as He,Zl as Ue,Zo as P,_n as We,_r as F,_t as Ge,a as Ke,ac as qe,an as Je,ao as Ye,as as I,at as Xe,b as Ze,ba as Qe,bn as $e,c as et,ca as tt,cc as nt,cn as rt,co as it,cs as L,dc as R,dn as at,do as ot,dr as st,ds as ct,ea as lt,er as ut,es as z,fl as dt,fn as ft,fr as B,fs as pt,gn as mt,gr as ht,gt,hc as _t,hl as vt,hn as yt,hr as bt,hs as xt,ic as St,in as Ct,ir as wt,is as Tt,jn as Et,js as Dt,kc as Ot,kn as kt,ks as At,ln as jt,lo as Mt,lr as Nt,ls as Pt,ma as Ft,mc as It,ml as Lt,mr as Rt,nl as zt,ns as Bt,oc as Vt,ol as Ht,on as V,or as Ut,os as Wt,pc as H,pr as U,qc as Gt,qs as Kt,qt,ra as Jt,rc as Yt,rl as Xt,rn as Zt,rr as Qt,rs as W,sa as $t,sr as en,ta as tn,tc as nn,tn as rn,ts as G,uc as K,ul as an,un as on,v as sn,vn as cn,vo as ln,vr as un,w as dn,wn as fn,ws as q,wt as pn,x as mn,xa as hn,xi as gn,xl as _n,xn as vn,y as yn,yl as bn,yn as xn,yr as J,z as Sn,zc as Cn,zn as wn,zr as Tn}from"./app-2d0YQdR7.js";import{C as En,f as Dn,o as On,s as kn}from"./vendor-t7Q7QbPu.js";import{C as An,Ct as jn,Dt as Mn,Et as Nn,O as Pn,Ot as Fn,Q as In,St as Ln,Tt as Rn,X as zn,Z as Bn,_t as Vn,at as Hn,b as Un,ct as Wn,dt as Gn,ft as Kn,gt as qn,it as Jn,jt as Yn,k as Xn,l as Zn,lt as Qn,mt as $n,n as er,nt as tr,o as nr,ot as rr,rt as ir,st as ar,t as or,tt as sr,ut as cr,wt as lr,x as ur,xt as dr,y as fr}from"./embedded-list-BIvBUQCm.js";import{t as pr}from"./circle-alert-BWBUUk9M.js";import{t as mr}from"./page-header-Ddz2r5ic.js";import{n as hr,t as gr}from"./pending-invitation-row-xf_wfIQ2.js";import{n as _r,t as vr}from"./person-row-DtXuek5W.js";import{n as yr,t as br}from"./use-paged-search-DPuOZYVz.js";import{n as xr,t as Sr}from"./client-publisher-D39SlIhp.js";import{t as Cr}from"./copy-field-BtAsyigB.js";var wr={name:`at-sign`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]};wr.node;var Tr=Gt(wr),Er={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};Er.node;var Dr=Gt(Er),Or={name:`key-square`,size:24,node:[[`path`,{d:`M12.4 2.7a2.5 2.5 0 0 1 3.4 0l5.5 5.5a2.5 2.5 0 0 1 0 3.4l-3.7 3.7a2.5 2.5 0 0 1-3.4 0L8.7 9.8a2.5 2.5 0 0 1 0-3.4z`,key:`165ttr`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`m9.4 10.6-6.814 6.814A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814`,key:`1ubxi2`}]]};Or.node;var kr=Gt(Or),Ar={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};Ar.node;var jr=Gt(Ar),Mr={name:`plug-zap`,size:24,node:[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]],aliases:[`plug-zap-2`]};Mr.node;var Nr=Gt(Mr),Pr={name:`shield-user`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M6.376 18.91a6 6 0 0 1 11.249.003`,key:`hnjrf2`}],[`circle`,{cx:`12`,cy:`11`,r:`4`,key:`1gt34v`}]]};Pr.node;var Fr=Gt(Pr),Ir={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};Ir.node;var Lr=Gt(Ir),Rr={name:`tablet`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]};Rr.node;var zr=Gt(Rr),Br=[`done`,`error`,`running`];re(`TextField`,!1),re(`NumberField`,!1),re(`DateField`,!1),re(`BooleanField`,!1),re(`UrlField`,!1),re(`ChipField`,!1);var Vr=new Set([`TextField`,`NumberField`,`DateField`,`BooleanField`,`UrlField`,`ChipField`]),Hr=e=>typeof e!=`string`&&!e.custom&&Vr.has(e.type),Ur=e=>typeof e==`string`||Hr(e)||!e.custom&&(e.type===`Link`||e.type===`Trans`||e.type===`Text`&&[`span`,`strong`,`em`].includes(String(e.props.as))),Wr=(e,t)=>e===`BooleanField`?t!==!0&&t!==!1:e===`NumberField`||e===`UrlField`?t==null:t==null||t===``,Gr=e=>typeof e==`object`&&e?JSON.stringify(e):String(e),Kr=(e,{locales:t,options:n},r)=>{let i=typeof e==`string`&&e!==``&&!Number.isNaN(Number(e))?Number(e):e;return typeof i==`number`?i.toLocaleString(t??r,n):String(i)},qr=(e,t,n)=>{let r=e instanceof Date?e:typeof e==`string`||typeof e==`number`?new Date(e):void 0;if(!r||Number.isNaN(r.getTime()))return``;if(t.format===`relative`)return n.relative(Math.round((n.now-r.getTime())/1e3));let{showDate:i=!0,showTime:a=!1,options:o}=t,s=t.locales??n.locale;if(i&&a)return r.toLocaleString(s,o);if(a)return r.toLocaleTimeString(s,o);let c=o??(typeof e==`string`&&e.length<=10?{timeZone:`UTC`}:void 0);return r.toLocaleDateString(s,c)},Jr=(e,t,n)=>e?t.valueLabelTrue??n.yes:t.valueLabelFalse??n.no,Yr=new Set([`http:`,`https:`,`mailto:`,`tel:`]),Xr=e=>{let t=e.replace(/^[\u0000- ]+/,``).replace(/[\t\n\r]/g,``),n=/^([A-Za-z][A-Za-z0-9+.-]*):/.exec(t)?.[1];return n===void 0?t.startsWith(`/`)||!t.includes(`:`)?e:void 0:Yr.has(`${n.toLowerCase()}:`)?e:void 0},Zr=({layout:e,cardWidth:t})=>({layout:e??`stack`,cardWidth:t??`2/3`}),Qr=e=>e==null||e===``?void 0:String(e),$r=(e,t)=>e<t?-1:+(e>t),ei=({nodes:e,edges:t,key:n,edgeKey:r,fields:i})=>{let a=new Map,o=new Map;for(let t of e){let e=Qr(t[n]);if(e===void 0||a.has(e))continue;let r=i.group===void 0?void 0:t[i.group],s=Qr(r);s!==void 0&&!o.has(s)&&o.set(s,{id:s,value:r}),a.set(e,{id:e,row:t,...s!==void 0&&{group:s}})}let s=t.flatMap(e=>{let t=r.map(t=>Qr(e[t])),n=t.includes(void 0)?void 0:t.length===1?t[0]:JSON.stringify(t),o=Qr(e[i.source]),s=Qr(e[i.target]);return n===void 0||o===void 0||s===void 0||!a.has(o)||!a.has(s)?[]:[{id:n,source:o,target:s,row:e}]});return{groups:[...o.values()].sort((e,t)=>$r(e.id,t.id)),nodes:[...a.values()].sort((e,t)=>$r(e.id,t.id)),edges:s.sort((e,t)=>$r(e.source,t.source)||$r(e.target,t.target)||$r(e.id,t.id))}},Y=e(t(),1),X=e(n(),1),ti=({model:e,items:t,name:n,label:r,variant:i,className:a})=>{let{views:o}=L(),s=jn(e.name,void 0),c=Ee(),[l,u]=(0,Y.useState)(!1),d=o[e.name]?.actions?.find(e=>e.name===n);if(!d||d.run?.kind===`link`)return null;let f=t.map(t=>mt(e,t)),p=f.filter(e=>s.verdictOn(d,e)!==`skip`);if(p.length===0)return null;let m=f.length-p.length,h=dr(`actionCount`,{label:r??d.label,count:p.length}),g=e=>s.runEach(d,p,m,e);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{size:`sm`,variant:i??d.variant??`secondary`,className:a,loading:s.running===n,onClick:()=>Nn(d)?u(!0):void g(),children:h}),l&&(0,X.jsx)(Rn,{action:d,label:h,danger:i===`danger`||i===void 0&&Mn(d),records:p.map(e=>e.record),names:p.map(t=>Ln(c(e,o[e.name],t.record,t.key))),onCancel:()=>u(!1),onConfirm:()=>{u(!1),g()},onSubmit:async e=>{u(!1),await g(e)}})]})},ni=({name:e,resource:t,label:n,variant:r,className:i,about:a,onRun:o})=>{let s=st(),c=lr(t??s?.model.name??``,e,t===void 0||t===s?.model.name?s:void 0,e=>o?.(n??e.label)),[l,u]=(0,Y.useState)(!1);if(!c.action)return null;let d=n??c.action.label,f=r??c.action.variant??`secondary`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{size:`sm`,variant:f,className:i,loading:c.running,disabled:!!c.blocked,title:c.blocked,"aria-label":a===void 0?void 0:`${d}: ${a}`,onClick:()=>Nn(c.action)?u(!0):void c.run(),children:d}),l&&(0,X.jsx)(Rn,{action:c.action,label:d,danger:f===`danger`,records:c.record?[c.record]:[],onCancel:()=>u(!1),onConfirm:()=>{u(!1),c.run()},onSubmit:async e=>{await c.submit(e),u(!1)}})]})},ri=({node:e,className:t})=>{let n=V(e),r=ht(),i=r?.model;return i&&(n.resource===void 0||n.resource===i.name)?(0,X.jsx)(ti,{...n,model:i,items:r.items,className:t}):(0,X.jsx)(ni,{...n,className:t})},ii=({node:e,children:t,slots:n,className:r})=>{let{title:i,description:a}=V(e);return(0,X.jsx)(F,{title:i,description:a,actions:n.actions,className:O(`h-full`,r),children:(0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:t})})},ai=({children:e,wrap:t=(e,t)=>(0,X.jsx)(Y.Fragment,{children:e},t)})=>{let n=ht();if(!n)return null;let{model:r,items:i,planned:a}=n;return i.map((n,o)=>{let s=r?{...mt(r,n),...a&&{planned:a}}:{item:n},c=`key`in s?s.key:o;return t((0,X.jsx)(en,{value:s,row:{index:o,count:i.length},children:e}),c)})},oi=({children:e})=>(0,X.jsx)(ai,{children:e}),si=({model:e,at:t,filter:n,sort:r,limit:i=12,title:a,description:o,empty:s,actions:c,children:l,className:u})=>{let d=Zt(t),f=xn(e,{filter:n,sort:r,pageSize:i,enabled:!d}),p=d??f,m=d?d.rows:f.data?.items??[];return(0,X.jsx)(F,{title:a,description:o,actions:c,className:u,children:p.isPending?(0,X.jsx)(`div`,{className:`flex gap-3`,children:Array.from({length:3},(e,t)=>(0,X.jsx)(K,{className:`h-24 w-56`},t))}):p.error?(0,X.jsx)(J,{title:N(`couldNotLoad`),error:p.error}):m.length===0?(0,X.jsx)(un,{children:s??N(`nothingYet`)}):(0,X.jsx)(`ul`,{className:`relative -mx-4 flex snap-x gap-3 overflow-x-auto px-4 pb-1`,children:(0,X.jsx)(Rt,{value:{model:e,items:m,...d&&{planned:!0}},children:(0,X.jsx)(ai,{wrap:(e,t)=>(0,X.jsx)(`li`,{className:`flex w-60 shrink-0 snap-start flex-col gap-2 rounded-lg border border-border bg-surface p-3`,children:e},t),children:l})})})})},ci=({node:e,at:t,children:n,slots:r})=>{let{resource:i,...a}=V(e),o=L().resources[i];return o?(0,X.jsx)(si,{...a,model:o,...t!==void 0&&{at:t},actions:r.actions,children:n}):null},li=({node:e,slots:t,className:n})=>{let{resource:r,title:i,description:a,actions:o,span:s,className:c,...l}=V(e),{resources:u,views:d}=L(),f=u[r];return f?(0,X.jsx)(F,{title:i,description:a,actions:t.actions,className:O(`h-full`,n),children:(0,X.jsx)(Kn,{model:f,view:d[r],...l})}):null},ui=({model:e,query:t,className:n=`mt-4 border-t pt-4`,children:r})=>{let i=cn(e,t),a=i.isPending?(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(K,{className:`h-4 w-1/2`}),(0,X.jsx)(K,{className:`h-4 w-1/3`})]}):i.error?(0,X.jsx)(J,{title:N(`couldNotLoad`),error:i.error}):i.data?(0,X.jsx)(en,{value:i.data,children:(0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:r})}):(0,X.jsx)(un,{children:N(`nothingYet`)});return(0,X.jsx)(`div`,{className:n,children:a})},di=e=>{if(typeof e!=`string`&&typeof e!=`number`)return;let t=typeof e==`number`?e:Date.parse(e);return Number.isNaN(t)?void 0:t},fi=e=>e==null?``:String(e),pi=(e,t,n)=>n===0?0:(e-t)/n*100,mi=(e,t,n)=>{let r=new Map;for(let i of e){let e=di(i[t.start]);if(e===void 0)continue;let a=di(i[t.end]),o=Math.max(e,a??n),s=r.get(fi(i[t.lane]))??{value:i[t.lane],bars:new Map};r.set(fi(i[t.lane]),s);let c=s.bars.get(fi(i[t.bar]))??{value:i[t.bar],records:[]};s.bars.set(fi(i[t.bar]),c),c.records.push({record:i,start:e,end:o,open:a===void 0})}return r},hi=e=>{let t=[];for(let n of[...e].sort((e,t)=>e.start-t.start)){let e=t.find(e=>e.at(-1).end<=n.start);e?e.push(n):t.push([n])}return t},gi=(e,t,n)=>{let r=mi(e,t,n),i=[...r.values()].flatMap(e=>[...e.bars.values()].flatMap(e=>e.records));if(i.length===0)return{lanes:[],from:n,to:n};let a=Math.min(...i.map(e=>e.start)),o=Math.max(...i.map(e=>e.end)),s=o-a;return{lanes:[...r.entries()].map(([e,n])=>{let r=[...n.bars.entries()].map(([e,r])=>{let i=r.records.sort((e,t)=>e.start-t.start).map(({record:e,start:n,end:r,open:i})=>({record:e,value:e[t.color],start:n,end:r,open:i,left:pi(n,a,s),width:pi(r,a,s)-pi(n,a,s)})),o=i[0].start,c=Math.max(...i.map(e=>e.end));return{key:e,value:r.value,lane:n.value,start:o,end:c,left:pi(o,a,s),width:pi(c,a,s)-pi(o,a,s),segments:i}});return{key:e,value:n.value,rows:hi(r)}}),from:a,to:o}},_i=(e,t)=>{let n=e.end-e.start;return{left:pi(t.start,e.start,n),width:n===0?100:(t.end-t.start)/n*100}},vi=6e4,yi=60*vi,Z=24*yi,bi=[5*vi,15*vi,30*vi,yi,3*yi,6*yi,12*yi,Z,2*Z,7*Z,14*Z,30*Z,90*Z,365*Z],xi=365*Z,Si=(e,t,n,r,i)=>Math.floor((t+i)/n)-Math.ceil((e+r)/n)+1,Ci=(e,t,n=()=>0)=>{let r=t-e;if(r<=0)return{daily:!1,ticks:[]};let i=n(e),a=n(t),o=bi.find(n=>Si(e,t,n,i,a)<=6)??Math.ceil(r/5/xi)*xi,s=[];for(let c=Math.ceil((e+i)/o)*o;c<=t+a;c+=o){let a=c-n(c-i);a+n(a)===c&&a>=e&&a<=t&&s.push({at:a,left:pi(a,e,r)})}return{daily:o>=Z,ticks:s}},wi=e=>({lane:fi(e.lane),bar:e.key}),Ti=(e,t)=>t?e.lanes.find(e=>e.key===t.lane)?.rows.flat().find(e=>e.key===t.bar)??null:null,Ei=(e,t)=>{let n=Object.fromEntries(new Intl.DateTimeFormat(`en-US`,{timeZone:t,hourCycle:`h23`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`}).formatToParts(e).map(e=>[e.type,e.value]));return Date.UTC(Number(n.year),Number(n.month)-1,Number(n.day),Number(n.hour),Number(n.minute))-Math.floor(e/6e4)*6e4},Di=e=>e<8?`translate-x-0`:e>92?`-translate-x-full`:`-translate-x-1/2`,Oi=({from:e,to:t,dated:n})=>{let r=n?`UTC`:Ft(),i=e=>n?0:Ei(e,r),{daily:a,ticks:o}=Ci(e,t,i);return(0,X.jsx)(`div`,{"aria-hidden":`true`,className:`relative h-5 min-w-0 flex-1 border-b border-border text-xs text-muted-foreground tabular-nums`,children:o.map(e=>(0,X.jsx)(`span`,{className:`absolute bottom-1 whitespace-nowrap ${Di(e.left)}`,style:{left:`${e.left}%`},children:a?Jt(e.at+i(e.at)):tt(e.at,r)},e.at))})},ki=(e,t,n)=>{let r=String(n),i=t?.waitingValues?.includes(r)??!1,a=t?.valueColors&&Object.hasOwn(t.valueColors,r)?t.valueColors[r]:void 0;return a!==void 0&&_n(a)?{className:Tt[a],striped:i}:{color:qn(e,t,n===void 0?null:n,-1),striped:i}},Ai=e=>({...e.color!==void 0&&{backgroundColor:e.color},...e.striped&&{backgroundImage:`repeating-linear-gradient(-45deg, transparent 0 4px, color-mix(in srgb, var(--background) 55%, transparent) 4px 6px)`}}),ji=({bar:e,field:t,hints:n})=>e.segments.map((r,i)=>{let a=ki(t,n,r.value),{left:o,width:s}=_i(e,r);return(0,X.jsx)(`span`,{"aria-hidden":`true`,className:O(`absolute inset-y-0`,a.className),style:{left:`${o}%`,width:`${s}%`,...Ai(a)}},i)}),Mi=(e,t)=>t?lt(e):tn(e),Ni=(e,t,n,r,i)=>{let a=e.fields[t.start]?.type===`date`;return N(`timelineRange`,{from:Mi(n,a),to:i?N(`timelineNow`):Mi(r,a)})},Pi=(e,t,n,r)=>`${gn(t.fields[r.color],e.value,n?.fields[r.color])}: ${Ni(t,r,e.start,e.end,e.open)}`,Fi=(e,t,n,r,i)=>{let a=e.segments.some(t=>t.open&&t.end===e.end);return[`${i??gn(t.fields[r.bar],e.value,n?.fields[r.bar])}: ${Ni(t,r,e.start,e.end,a)}`,...e.segments.map(e=>Pi(e,t,n,r))].join(`; `)},Ii=`absolute inset-y-0 flex overflow-hidden rounded-sm ring-offset-1 ring-offset-background outline-none hover:ring-2 hover:ring-border-strong focus-visible:ring-2 focus-visible:ring-primary`,Li=({bar:e,model:t,view:n,fields:r,point:i,choose:a})=>{let o=L().resources[t.fields[r.bar]?.relation?.resource??``],s=Et(o??t,e.key,o!==void 0),c=Fi(e,t,n,r,o?s:void 0),l={onMouseEnter:()=>i.hover(e),onMouseLeave:()=>i.hover(null),onFocus:()=>i.focus(e),onBlur:()=>i.focus(null)},u={left:`${e.left}%`,width:`max(${e.width}%, 4px)`},d=(0,X.jsx)(ji,{bar:e,field:t.fields[r.color],hints:n?.fields[r.color]});if(!a)return(0,X.jsx)(`span`,{role:`img`,tabIndex:0,"aria-label":c,style:u,className:Ii,...l,children:d});let f=a.chosen===e.key;return(0,X.jsx)(nt,{to:a.barTo(e.key),"aria-label":c,"aria-current":f?`true`:void 0,style:u,className:O(Ii,f&&`ring-2 ring-foreground`),...l,children:d})},Ri=({shape:e,...t})=>{let{model:n,fields:r}=t,i=n.fields[r.lane];return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`div`,{className:`flex sm:pl-40`,children:(0,X.jsx)(Oi,{from:e.from,to:e.to,dated:n.fields[r.start]?.type===`date`})}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-3 sm:gap-2`,children:e.lanes.map(e=>(0,X.jsxs)(`li`,{className:`flex flex-col gap-1 sm:flex-row sm:items-center`,children:[(0,X.jsx)(`div`,{className:`min-w-0 truncate text-sm font-medium sm:w-40 sm:shrink-0 sm:pr-3`,children:(0,X.jsx)(vn,{model:n,field:i,value:e.value})}),(0,X.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 border-l border-border pl-px`,children:e.rows.map((e,n)=>(0,X.jsx)(`div`,{className:`relative h-6 overflow-x-clip`,children:e.map(e=>(0,X.jsx)(Li,{bar:e,...t},e.key))},n))})]},e.key))})]})},zi=({model:e,view:t,fields:n,value:r})=>{let i=ki(e.fields[n.color],t?.fields[n.color],r);return(0,X.jsx)(`span`,{"aria-hidden":`true`,className:O(`inline-block size-3 shrink-0 rounded-sm`,i.className),style:Ai(i)})},Bi=({values:e,...t})=>{let n=t.model.fields[t.fields.color],r=(n.enumValues??[]).filter(t=>e.has(t));return(0,X.jsx)(`ul`,{className:`flex flex-wrap gap-x-4 gap-y-1.5 text-xs text-muted-foreground`,children:r.map(e=>(0,X.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(zi,{...t,value:e}),gn(n,e,t.view?.fields[t.fields.color])]},e))})},Vi=({bar:e,...t})=>{let{model:n,view:r,fields:i}=t;if(!e)return(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:N(`timelinePoint`)});let a=e.segments.some(t=>t.open&&t.end===e.end);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[(0,X.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:(0,X.jsx)(vn,{model:n,field:n.fields[i.bar],value:e.value})}),(0,X.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:Ni(n,i,e.start,e.end,a)})]}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-0.5 text-xs text-muted-foreground`,children:e.segments.map((e,a)=>(0,X.jsxs)(`li`,{className:`flex items-center gap-1.5 tabular-nums`,children:[(0,X.jsx)(zi,{...t,value:e.value}),gn(n.fields[i.color],e.value,r?.fields[i.color]),`: `,Ni(n,i,e.start,e.end,e.open)]},a))})]})},Hi=500,Ui=(e,t,{filter:n=``,sort:r,fields:i,limit:a})=>({queryKey:[...zt.list(t.name,n,r,a,`timeline`),i.join(`,`)],queryFn:async()=>{let o=[],s;do{let c=await e.list(t.name,{filter:n||void 0,orderBy:r,pageSize:Math.min(Hi,a-o.length),fields:i,etag:!1,...s&&{pageToken:s}});o.push(...c.items),s=c.nextPageToken||void 0}while(s&&o.length<a);return{rows:o.toReversed(),cut:s!==void 0}}}),Wi=(e,{enabled:t=!0,...n})=>On({...Ui(xt(),e,n),enabled:t,placeholderData:Dn}),Gi=({model:e,view:t,fields:n,readSort:r,at:i,filter:a,limit:o=Ae,title:s,description:c,empty:l,actions:u,className:d,choose:f,details:p})=>{let[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),v=e=>e?wi(e):null,y={hover:e=>h(v(e)),focus:e=>_(v(e))},b=Zt(i),x=Wi(e,{filter:a,sort:r,fields:[...new Set([...Object.values(n),...e.primaryKey])],limit:o,enabled:!b}),S=b??x,C=b?b.rows:x.data?.rows??[],w=!b&&x.data?.cut===!0,T=gi(C,n,Date.now());return(0,X.jsxs)(F,{title:s,description:c,actions:u,className:O(`h-full`,d),children:[(()=>{if(S.isPending)return(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:Array.from({length:3},(e,t)=>(0,X.jsx)(K,{className:`h-6`},t))});if(S.error)return(0,X.jsx)(J,{title:N(`couldNotLoad`),error:S.error});if(T.lanes.length===0)return(0,X.jsx)(un,{children:l??N(`nothingYet`)});let r=new Set(C.map(e=>String(e[n.color])));return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(Bi,{model:e,view:t,fields:n,values:r}),(0,X.jsx)(Ri,{shape:T,model:e,view:t,fields:n,point:y,...f&&{choose:f}}),w&&(0,X.jsx)(un,{children:N(`timelineCut`,{count:C.length})}),(0,X.jsx)(`div`,{"aria-live":`polite`,children:(0,X.jsx)(Vi,{bar:Ti(T,m)??Ti(T,g),model:e,view:t,fields:n})})]})})(),p]})},Ki=(e,t)=>e.type===`integer`?Number(t):t,qi=({select:e,children:t,...n})=>{let{given:r,linkTo:i}=wt(),a=r[e],o=t=>i({[e]:t}),s=n.model.fields[n.fields.bar],c=a===void 0?null:(0,X.jsx)(Vt,{name:e,children:(0,X.jsx)(ui,{model:n.model,query:{filter:Vn(s,Ki(s,a),n.filter),sort:n.sort},children:t},a)});return(0,X.jsx)(Gi,{...n,choose:{barTo:o,chosen:a},details:c})},Ji=({node:e,at:t,slots:n,children:r,className:i})=>{let{className:a,resource:o,select:s,lane:c,bar:l,start:u,end:d,color:f,children:p,...m}=V(e),{resources:h,views:g}=L(),_=h[o];if(!_)return null;let v={...m,model:_,view:g[_.name],fields:{lane:c,bar:l,start:u,end:d,color:f},readSort:Ie(e),sort:x(e),...t!==void 0&&{at:t},actions:n.actions,className:i};return s===void 0?(0,X.jsx)(Gi,{...v}):(0,X.jsx)(qi,{...v,select:s,children:r})},Yi=({node:e,children:t})=>{let n=Kt(e),r=Ut(),{resources:i}=L();if(!n||!r)return t;let a=r.given[n.param],o=n.resource===void 0?void 0:i[n.resource];return a===void 0||!o?null:(0,X.jsx)(Vt,{name:n.param,children:(0,X.jsx)(ui,{model:o,query:{key:a},className:``,children:t},a)})},Xi=(0,Y.lazy)(()=>En(()=>import(`./graph-view-D5uSsu67.js`).then(e=>({default:e.GraphView})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]))),Zi=(0,X.jsx)(`div`,{className:`flex h-64 w-full items-center justify-center`,children:(0,X.jsx)(_t,{})}),Qi=({node:e,at:t,slots:n,children:r,className:i})=>{let a=V(e),o=rn(e,t),s=Ut(),c=o.nodes,l=o.edges,{label:u,group:d,status:f,source:p,target:m}=a,h=(0,Y.useMemo)(()=>({label:u,source:p,target:m,...d!==void 0&&{group:d},...f!==void 0&&{status:f}}),[u,p,m,d,f]),g=JSON.stringify([c?.rows,l?.rows,h]),_=(0,Y.useMemo)(()=>c&&l&&ei({nodes:c.rows,edges:l.rows,key:c.model.primaryKey[0],edgeKey:l.model.primaryKey,fields:h}),[g]);if(!c||!l||!_)return null;let v=c.error??l.error;if(v&&e.fallback)throw v;if(v)return(0,X.jsx)(J,{title:N(`couldNotLoad`),error:v});if(c.isPending||l.isPending)return Zi;if(_.nodes.length===0)return(0,X.jsx)(un,{children:a.empty??N(`nothingYet`)});let y=a.select,b=y!==void 0&&s?{chosen:s.given[y],linkTo:e=>s.linkTo({[y]:e})}:void 0;return(0,X.jsxs)(`div`,{className:O(`flex flex-col gap-4 lg:flex-row`,i),children:[(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,X.jsx)(Y.Suspense,{fallback:Zi,children:(0,X.jsx)(Xi,{shape:_,nodes:c,edges:l,fields:h,props:a,...b&&{select:b},...a.node!==void 0&&{content:n.node}})})}),r.length>0&&b?.chosen!==void 0&&(0,X.jsx)(`div`,{className:`min-w-0 lg:w-80 lg:shrink-0`,children:(0,X.jsx)(Yi,{node:e,children:r})})]})},Q=Xt(`app/conversation`),$i=({resource:e,field:t,values:n,placeholder:r,searchPeople:i,mentions:a})=>{let{resources:s}=L(),c=xt(),l=$e(),u=Pt(e),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)();return!s[e]||!o(u,`create`)?null:(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[p!==void 0&&(0,X.jsx)(J,{title:Q(`notSent`),error:p}),(0,X.jsx)(pn,{onSend:async(r,i)=>{f(!0),m(void 0);let o=await c.create(e,{...n,[t]:r,...a!==void 0&&{[a]:i}}).then(()=>!0,e=>(m(e),!1));return f(!1),o&&l(e),o},busy:d,placeholder:r,searchPeople:i})]})},ea=({node:e})=>{let{resource:t,field:n,values:r,placeholder:i}=V(e);return(0,X.jsx)($i,{resource:t,field:n,values:r,placeholder:i})},ta=({node:e,children:t,className:n})=>{let{open:r}=V(e);return(0,X.jsx)(`details`,{open:r,className:O(`[&[open]>summary]:mb-2`,n),children:t})},na=({children:e,className:t})=>(0,X.jsx)(`summary`,{className:O(`cursor-pointer font-medium`,t),children:e}),ra=({node:e,className:t})=>{let{source:n,emptyText:r}=V(e),i=at(n);if(i.state===`missing`)return null;if(i.state===`loading`)return(0,X.jsx)(K,{className:O(`h-24 w-full`,t)});if(i.value===null||i.value===void 0||i.value===``)return r?(0,X.jsx)(`p`,{className:O(`text-sm text-muted-foreground`,t),children:r}):null;let a=String(i.value),o=gt(a);return o?(0,X.jsx)(`div`,{className:O(`flex flex-col gap-3`,t),children:o.map((e,t)=>(0,X.jsx)(Ge,{source:e.lines,path:e.path,split:!0,className:`rounded-md border border-border`},`${t}-${e.path}`))}):(0,X.jsx)(`pre`,{className:O(`overflow-x-auto whitespace-pre-wrap break-words rounded-md border border-border bg-background p-3 font-mono text-[0.6875rem] leading-[18px]`,t),children:a})},ia=e=>e==null?``:typeof e==`object`?JSON.stringify(e):String(e),aa=(e,t)=>{if(t)return t;let n=e.split(`.`).map(e=>vt(e).toLowerCase()).join(` `);return n[0].toUpperCase()+n.slice(1)},oa=({node:e,className:t})=>{let{source:n,label:r,format:i}=V(e),{views:a}=L(),o=at(n);if(o.state===`missing`)return null;let s=o.state===`loading`?(0,X.jsx)(K,{className:`h-4 w-24`}):o.state===`plain`?ia(o.value):(0,X.jsx)(vn,{model:o.model,field:o.field,value:o.value,format:i});if(r===!1)return(0,X.jsx)(`div`,{className:t,children:s});let c=r??aa(n,o.state===`ready`?a[o.model.name]?.fields[o.field.name]?.label:void 0);return(0,X.jsxs)(`div`,{className:O(`min-w-0`,t),children:[(0,X.jsx)(`div`,{className:`text-body text-muted-foreground`,children:c}),(0,X.jsx)(`div`,{className:`mt-0.5 truncate`,children:s})]})},sa={1:``,2:`md:grid-cols-2`,3:`md:grid-cols-2 xl:grid-cols-3`,4:`sm:grid-cols-2 xl:grid-cols-4`},ca={1:``,2:`grid-cols-2`,3:`grid-cols-2 xl:grid-cols-3`,4:`grid-cols-2 xl:grid-cols-4`},la={1:``,2:`md:col-span-2`,3:`md:col-span-2 xl:col-span-3`,4:`sm:col-span-2 md:col-span-2 xl:col-span-4`},ua=e=>typeof e==`object`&&!e.custom&&e.type===`Stat`,da=({node:e,children:t,className:n})=>{let{columns:r=2}=V(e),i=e.children,a=i.length>0&&i.every(ua);return(0,X.jsx)(`div`,{className:O(`grid grid-cols-1 gap-4`,a?ca[r]:sa[r],n),children:t.map((e,t)=>{let n=i[t],r=typeof n==`object`?n.props.span:void 0;return(0,X.jsx)(`div`,{className:O(`min-w-0`,r&&la[r]),children:e},t)})})},fa=({src:e,alt:t,width:n,height:r,className:i})=>(0,X.jsx)(`img`,{src:e,alt:t??``,width:n,height:r,className:i??`max-w-full`}),pa=({width:e,height:t,space:n,theme:r})=>{let i=e??Math.ceil(n/100)*100;if(i!==0)return{width:String(i),...t!==void 0&&{height:String(t)},theme:r}},ma=e=>({staleTime:1/0,refetchOnWindowFocus:!1,...e!==void 0&&{refetchInterval:e*1e3}}),ha=e=>e instanceof Blob&&e.type.startsWith(`image/`),ga=e=>{let[t,n]=(0,Y.useState)();return(0,Y.useEffect)(()=>{if(!e)return n(void 0);let t=URL.createObjectURL(e);return n(t),()=>URL.revokeObjectURL(t)},[e]),t},_a=e=>{let[t,n]=(0,Y.useState)();return[t!==void 0&&t===e,()=>n(e)]},va=({name:e,alt:t,width:n,height:r,refresh:i,className:a})=>{let o=xt(),{theme:s}=Me(),[c,l]=Xe(),u=pa({width:n,height:r,space:l,theme:s}),d=On({queryKey:zt.image(e,u??{}),enabled:u!==void 0,placeholderData:Dn,...ma(i),queryFn:async()=>{let t=await o.invoke(e,{query:u,cache:`no-store`});if(!ha(t))throw Error(`The function "${e}" answered no picture`);return t}}),f=ga(d.data),[p,m]=_a(f),h={...n!==void 0&&{width:n},...r!==void 0&&{height:r}};return(0,X.jsx)(`div`,{ref:c,className:O(`min-w-0`,a),children:d.isError||p?t&&(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:t}):f?(0,X.jsx)(`img`,{src:f,alt:t??``,onError:m,style:h,className:n===void 0?`w-full max-w-full object-contain`:`max-w-full object-contain`}):(0,X.jsx)(K,{className:`w-full max-w-full`,style:{height:r??160,...n!==void 0&&{width:n}}})})},ya=({node:e,className:t})=>{let n=V(e);return n.src===void 0?(0,X.jsx)(va,{name:n.function,alt:n.alt,width:n.width,height:n.height,refresh:n.refresh,className:t}):(0,X.jsx)(fa,{src:n.src,alt:n.alt,width:n.width,height:n.height,className:t})},ba=e=>function({node:t,className:n}){let r=V(t),{views:i}=L(),a=at(r.source);return a.state===`missing`?null:a.state===`loading`?(0,X.jsx)(K,{className:`inline-block h-3 w-16 align-middle`}):Wr(t.type,a.value)?r.emptyText?(0,X.jsx)(`span`,{className:n,children:r.emptyText}):null:a.state===`plain`?(0,X.jsx)(`span`,{className:n,children:e({value:a.value,field:void 0,hints:void 0,props:r})}):(0,X.jsx)(`span`,{className:n,children:e({value:a.value,field:a.field,hints:i[a.model.name]?.fields[a.field.name],props:r})})},xa=({value:e,field:t,hints:n})=>t?.type===`enum`&&typeof e==`string`?Lt(e,n?.valueLabels):Gr(e),Sa=ba(xa),Ca=ba(({value:e,props:t})=>(0,X.jsx)(`span`,{className:`tabular-nums`,children:Kr(e,t,Ht())})),wa=ba(({value:e,props:t})=>{let n=qr(e,t,{locale:Ht(),now:Date.now(),relative:$t});return(0,X.jsx)(`time`,{dateTime:String(e),children:n})}),Ta=ba(({value:e,props:t})=>{let n=Jr(e,t,{yes:_e(`yes`),no:_e(`no`)});return e?(0,X.jsx)(ne,{label:n,className:`align-middle`}):(0,X.jsx)(`span`,{className:`text-faint-foreground`,children:n})}),Ea=ba(({value:e,props:t})=>{let n=String(e),r=t.content??n,i=Xr(n);return i===void 0?r:(0,X.jsx)(`a`,{href:i,className:`font-medium text-primary-text hover:underline`,.../^https?:/i.test(i)&&{target:`_blank`,rel:`noreferrer`},children:r})}),Da=ba(e=>(0,X.jsx)(kt,{value:e.value,hints:e.hints,children:xa(e)})),Oa=`font-medium text-primary-text hover:underline`,ka=({node:e,children:t,className:n})=>{let r=V(e),i={...U(B()),params:Qt()},a=r.variant?O(It({variant:r.variant}),n):n??Oa,o=e.children.some(e=>typeof e!=`string`||e.trim()!==``)?t:void 0;if(r.to){let e=De(r.to,Dt(i));return(0,X.jsx)(w,{to:e,className:a,children:o??nn(e)})}let s=r.href??``;return(0,X.jsx)(`a`,{href:s,className:a,...s.startsWith(`http`)&&{target:`_blank`,rel:`noreferrer`},children:o??s})},Aa=(e,t,n)=>Object.fromEntries(t.map(t=>{let r=e.fields[t];if(r.type===`file`)return[t,n?.[t]??null];if(n)return[t,r.type===`boolean`?!!n[t]:he(n[t])];let i=r.default&&`value`in r.default?r.default.value:void 0;return[t,r.type===`boolean`?!!i:he(i)]})),ja=(e,t,n)=>Object.fromEntries(Object.entries(t).flatMap(([t,r])=>{let i=e.fields[t];return et(r)?r.key===he(n[t])?[]:[[t,i.type===`integer`?Number(r.key):r.key]]:dn(i,r,n[t])?[[t,a(i,r)]]:[]})),Ma=({model:e,record:t,mode:n,label:r,title:i,fields:a,values:o,onClose:s})=>{let{resources:l,views:u}=L(),d=xt(),f=c(),p=$e(),m=u[e.name],[h,g]=(0,Y.useState)(()=>Aa(e,a,t?.record)),[_,v]=(0,Y.useState)({}),[y,b]=(0,Y.useState)(0),x=sn(y),[S,C]=(0,Y.useState)(),[w,T]=(0,Y.useState)(!1),[E,ee]=(0,Y.useState)(!1);St(E||w,`input-lost`);let D=async()=>{T(!0),C(void 0),await(n===`create`?d.create(e.name,{...Ke(e,l,h),...o}):d.update(e.name,t.key,ja(e,h,t.record),t.etag??`*`)).then(async()=>{await p(e.name),f.show({state:`success`,title:N(`saved`,{label:i??r})}),s()},e=>{let t=yn(e);v(t),Object.keys(t).length>0&&b(e=>e+1),C(e)}),T(!1)};return(0,X.jsx)(R,{title:i??r,onClose:s,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{onClick:s,children:N(`cancel`)}),(0,X.jsx)(H,{variant:`primary`,loading:w,onClick:()=>void D(),children:N(n===`create`?`create`:`save`)})]}),children:(0,X.jsxs)(`form`,{ref:x,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),D()},children:[S!==void 0&&Object.keys(_).length===0&&(0,X.jsx)(J,{title:N(`notSaved`),error:S}),a.map(n=>{let r=e.fields[n],i=h[n],a=r.relation?l[r.relation.resource]:void 0,o=m?.fields[n]?.label??vt(n),s=_[n];return(0,X.jsx)(Sn,{name:n,label:o,help:m?.fields[n]?.help,error:s&&Ze(r,o,s),children:(0,X.jsx)(mn,{field:r,hints:m?.fields[n],value:et(i)?i.key:i,stored:t?.record[n],relationLabel:et(i)?i.label:void 0,relationPicker:a?{target:a,view:u[a.name]}:void 0,invalid:!!_[n],resource:e.name,onChange:e=>{v(({[n]:e,...t})=>t),ee(!0),g(t=>({...t,[n]:e}))}})},n)})]})})},Na=({model:e,recordKey:t,children:n})=>{let r=cn(e,{key:t});return(0,X.jsx)(X.Fragment,{children:n(r.data??void 0)})},Pa=({node:e})=>{let t=V(e),n=st(),{resources:r}=L(),i=r[t.resource??n?.model.name??``],a=Pt(i?.name??``),[s,c]=(0,Y.useState)(!1);if(!i||!(t.mode===`create`?o(a,`create`):o(a,`update`)&&n?.permissions?.update!==!1))return null;let l=e=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{size:`sm`,variant:t.variant??`secondary`,disabled:t.mode===`edit`&&!e,onClick:()=>c(!0),children:t.label}),s&&(0,X.jsx)(Ma,{...t,model:i,record:t.mode===`edit`?e:void 0,onClose:()=>c(!1)})]});return t.mode===`edit`&&t.recordKey!==void 0?(0,X.jsx)(Na,{model:i,recordKey:t.recordKey,children:l}):l(t.mode===`edit`?n:void 0)},Fa=({node:e,children:t,slots:n,className:r})=>{let{title:i,description:a,width:o}=V(e);return(0,X.jsx)(`div`,{className:O(`flex-1`,r),children:(0,X.jsxs)(`div`,{className:O(`flex flex-col gap-6 px-4 pb-16 pt-6 md:px-10 md:py-8`,o!==`full`&&`mx-auto max-w-[1200px]`),children:[(0,X.jsx)(mr,{title:i,subtitle:a,actions:n.actions}),t]})})},Ia=(e,t)=>{let n=B(),r=typeof e==`string`?Nt(n,e):void 0,i=jt(r&&`frame`in r?r.frame:void 0,r&&`path`in r?r.path:``);return typeof e==`number`?e:e===void 0?t:r&&`item`in r?Number(r.item):i.state===`ready`?Number(i.value):i.state===`loading`?void 0:NaN},La=({node:e,className:t})=>{let{value:n,max:r,label:i}=V(e),a=Ia(n,0),o=Ia(r,100);if(a===void 0||o===void 0)return(0,X.jsx)(K,{className:`h-6 w-full`});if(!Number.isFinite(a)||!Number.isFinite(o))return null;let s=o>0?Math.min(1,Math.max(0,a/o)):0;return(0,X.jsxs)(`div`,{className:O(`min-w-0`,t),children:[(0,X.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-body`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:i}),(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[a.toLocaleString(Ht()),` / `,o.toLocaleString(Ht())]})]}),(0,X.jsx)(`div`,{role:`progressbar`,"aria-label":i,"aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":o,className:`mt-1.5 h-2 overflow-hidden rounded-full bg-muted`,children:(0,X.jsx)(`div`,{className:s>=.9?`h-full rounded-full bg-warning`:`h-full rounded-full bg-primary`,style:{width:`${s*100}%`}})})]})},Ra=({model:e,at:t,filter:n,sort:r,recordKey:i,title:a,description:o,empty:s,actions:c,children:l,className:u})=>{let d=Zt(t),f=cn(e,{filter:n,sort:r,key:i,enabled:!d}),p=d?yt(e,d):f,m=e=>p.data?(0,X.jsx)(en,{value:p.data,children:e}):void 0,h=p.isPending?(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(K,{className:`h-4 w-1/2`}),(0,X.jsx)(K,{className:`h-4 w-1/3`})]}):p.error?(0,X.jsx)(J,{title:N(`couldNotLoad`),error:p.error}):p.data?m((0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:l})):(0,X.jsx)(un,{children:s??N(`nothingYet`)});return(0,X.jsx)(F,{title:a,description:o,actions:c?m(c):void 0,className:O(`h-full`,u),children:h})},za=({node:e,at:t,children:n,slots:r,className:i})=>{let{resource:a,filter:o,sort:s,recordKey:c,title:l,description:u,empty:d}=V(e),f=L().resources[a];return f?(0,X.jsx)(Ra,{model:f,...t!==void 0&&{at:t},filter:o,sort:s,recordKey:c,title:l,description:u,empty:d,actions:r.actions,className:i,children:n}):null},Ba=Xt(`app/related-cards`),Va=({children:e})=>{let t=(0,Y.useRef)(null),[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(!1);return(0,Y.useLayoutEffect)(()=>{let e=t.current;if(!e)return;let n=()=>a(e.scrollHeight>e.parentElement.clientHeight+1);n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[n]),(0,X.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,X.jsx)(`div`,{className:O(`w-full min-w-0`,!n&&`max-h-40 overflow-hidden`),children:(0,X.jsx)(`div`,{ref:t,children:e})}),(i||n)&&(0,X.jsx)(H,{size:`sm`,variant:`ghost`,className:`-ml-2`,"aria-expanded":n,onClick:()=>r(!n),children:Ba(n?`showLess`:`showMore`)})]})},Ha=e=>e==null||e===``,Ua=({scope:e,path:t,labelled:n=!0,clamped:r=!1})=>{let{views:i}=L(),a=jt(e,t);if(a.state===`missing`||a.state===`ready`&&Ha(a.value))return null;let o=a.state===`loading`?(0,X.jsx)(K,{className:`h-4 w-24`}):(0,X.jsx)(vn,{model:a.model,field:a.field,value:a.value}),s=r?(0,X.jsx)(Va,{children:o}):o;if(!n)return(0,X.jsx)(`div`,{className:`min-w-0`,children:s});let c=aa(t,a.state===`ready`?i[a.model.name]?.fields[a.field.name]?.label:void 0);return(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`dt`,{className:`text-body text-muted-foreground`,children:c}),(0,X.jsx)(`dd`,{className:`mt-0.5`,children:s})]})},Wa=({scope:e,view:t,fields:n,time:r,tone:i,actions:a,button:o,onActed:s})=>{let c=Ee(),{resources:l}=L(),u=c(e.model,t,e.record,e.key),d=a.length>0||o!==void 0;return(0,X.jsxs)(`li`,{"data-card":e.key,className:O(`relative grid min-w-0 items-center gap-x-4 gap-y-1 rounded-lg border border-border bg-surface px-4 py-2.5`,d?`grid-cols-[minmax(0,1fr)_auto]`:`grid-cols-[minmax(0,1fr)]`),children:[i&&(0,X.jsx)(Re,{view:t,field:i,record:e.record}),(0,X.jsxs)(`div`,{className:O(`flex min-w-0 items-baseline gap-2`,d&&`col-span-2 sm:col-span-1`),children:[(0,X.jsx)(w,{to:{kind:`record`,resource:e.model.name,key:p(e.model,e.record)},className:`line-clamp-2 min-w-0 font-medium [overflow-wrap:anywhere] text-primary-text hover:underline`,children:u}),r&&(0,X.jsx)(`div`,{className:`ml-auto shrink-0 text-body whitespace-nowrap text-muted-foreground empty:hidden`,children:(0,X.jsx)(Ua,{scope:e,path:r,labelled:!1})})]}),n.length>0&&(0,X.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-y-0.5 text-body text-muted-foreground`,children:n.map(t=>(0,X.jsx)(`div`,{className:`flex max-w-full min-w-0 items-center whitespace-nowrap empty:hidden [&>div]:truncate [:not(:empty)~&]:before:mx-2 [:not(:empty)~&]:before:content-['·'_/_'']`,children:(0,X.jsx)(Ua,{scope:e,path:t,labelled:!1})},t))}),d&&(0,X.jsx)(en,{value:e,children:(0,X.jsxs)(`div`,{className:`col-start-2 flex flex-wrap items-center justify-end gap-2 sm:row-span-2 sm:row-start-1`,children:[o&&(0,X.jsx)(sr,{button:o,model:e.model,view:t,record:e.record,models:l}),a.map(e=>(0,X.jsx)(ni,{name:e,about:u,onRun:e=>s?.(e,u)},e))]})})]})},Ga=({scope:e,view:t,fields:n,tone:r,actions:i,button:a,onActed:o})=>{let s=Ee(),{resources:c}=L(),l=s(e.model,t,e.record,e.key);return(0,X.jsxs)(`li`,{"data-card":e.key,className:`relative flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-surface p-4`,children:[r&&(0,X.jsx)(Re,{view:t,field:r,record:e.record}),(0,X.jsx)(w,{to:{kind:`record`,resource:e.model.name,key:p(e.model,e.record)},className:`self-start font-medium text-primary-text hover:underline`,children:l}),n.length>0&&(0,X.jsx)(`dl`,{className:`flex flex-col gap-3`,children:n.map(t=>(0,X.jsx)(Ua,{scope:e,path:t,clamped:!0},t))}),(i.length>0||a)&&(0,X.jsx)(en,{value:e,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a&&(0,X.jsx)(sr,{button:a,model:e.model,view:t,record:e.record,models:c}),i.map(e=>(0,X.jsx)(ni,{name:e,about:l,onRun:e=>o?.(e,l)},e))]})})]})},Ka=e=>!e.disabled&&e.getAttribute(`aria-disabled`)!==`true`,qa=e=>[...e.querySelectorAll(`button`)].find(Ka)??e.querySelector(`a`),Ja=(e,t,n)=>{let r=e.indexOf(n),i=e=>t.includes(e);return e.slice(r+1).find(i)??e.slice(0,Math.max(r,0)).findLast(i)},Ya=e=>{let t=e.closest(`section`)?.querySelector(`h2`);return t&&!t.hasAttribute(`tabindex`)&&(t.tabIndex=-1),t},Xa=e=>{let t=(0,Y.useRef)(null),n=(0,Y.useRef)({current:e,previous:e}),r=(0,Y.useRef)(void 0),[i,a]=(0,Y.useState)(``),o=(e,n,i)=>{if(r.current=void 0,i.includes(e.key)||!t.current||(a(Ba(`left`,{action:e.action,title:e.title})),document.activeElement&&document.activeElement!==document.body))return;let o=Ja(n,i,e.key),s=o===void 0?void 0:t.current.querySelector(`[data-card="${CSS.escape(o)}"]`);(s?qa(s):Ya(t.current))?.focus()};return(0,Y.useEffect)(()=>{let t=n.current.current;n.current={current:e,previous:t},r.current&&o(r.current,t,e)},[e]),{root:t,acted:(e,t,i)=>{let{current:a,previous:s}=n.current;if(a.includes(e)){r.current={key:e,action:t,title:i};return}o({key:e,action:t,title:i},s,a)},announcement:i}},Za=({compact:e,limit:t})=>(0,X.jsx)(`div`,{className:e?`flex flex-col gap-2`:`flex flex-col gap-3`,children:Array.from({length:e?Math.min(t,3):2},(t,n)=>(0,X.jsx)(K,{className:e?`h-17.5 w-full max-sm:h-24`:`h-24 w-full`},n))}),Qa=({model:e,view:t,filter:n,sort:r,fields:i,actions:a,button:o,limit:s,display:c,empty:l,carousel:u,compact:f,tone:p,planned:m})=>{let h=ie(),g=cr(),_=t?.names?.plural??vt(e.name),v=r||d(e,t),y=xn(e,{filter:n,sort:v,pageSize:s,enabled:!m}),b=We(e,n,!m),x=m?m.rows:{isPending:y.isPending,error:y.error},S=m?m.rows.rows:y.data?.items,C=m?{data:m.total&&!m.total.isPending&&!m.total.error?tr(m.total):void 0}:b,T=(0,Y.useMemo)(()=>(S??[]).map(t=>mt(e,t)),[e,S]),E=Xa((0,Y.useMemo)(()=>T.map(e=>e.key),[T]));return(0,X.jsxs)(`div`,{ref:E.root,children:[(()=>{if(x.isPending)return(0,X.jsx)(Za,{compact:!!f,limit:s});if(x.error)return(0,X.jsx)(J,{title:Ba(`couldNotLoad`),error:x.error});if(T.length===0)return(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:l??Ba(`nothingYet`)});let r=T.map(e=>{let n=(t,n)=>E.acted(e.key,t,n);return f?(0,X.jsx)(Wa,{scope:e,view:t,fields:i,time:f.time,tone:p,actions:a,button:o,onActed:n},e.key):(0,X.jsx)(Ga,{scope:e,view:t,fields:i,tone:p,actions:a,button:o,onActed:n},e.key)}),d=C.data===void 0?void 0:Wn(T.length,C.data,!1);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[u===void 0?(0,X.jsx)(`ul`,{className:f?`flex flex-col gap-2`:`flex flex-col gap-3`,children:r}):(0,X.jsx)(Gn,{scroll:g,label:_,share:u,children:r}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:d}),(0,X.jsxs)(w,{to:rr(e,t,h,{filter:n,orderBy:v,display:ir(t,h,{preferred:c})}),className:`flex items-center gap-1 font-medium text-primary-text hover:underline`,children:[Qn(`viewAll`),` `,(0,X.jsx)(`span`,{className:`sr-only`,children:_.toLowerCase()}),(0,X.jsx)(Yn,{className:`size-3.5`,"aria-hidden":!0})]})]})]})})(),(0,X.jsx)(`p`,{role:`status`,className:`sr-only`,children:E.announcement})]})},$a={"1/4":1/4,"1/3":1/3,"1/2":1/2,"2/3":2/3},eo=({node:e,at:t,slots:n,className:r})=>{let i=V(e),{resource:a,filter:o=``,sort:s=``,fields:c,cardActions:l=[],limit:u=10,display:d,title:f,description:p,empty:m}=i,{layout:h,cardWidth:g}=Zr(i),{resources:_,views:v}=L(),[y,b]=Ct([t,t===void 0?void 0:`${t}#total`]),x=(0,Y.useMemo)(()=>y&&{rows:y,total:b},[y,b]),S=_[a];if(!S)return null;let C=v[S.name];return(0,X.jsx)(`section`,{className:O(`min-w-0`,r),"aria-label":f,children:(0,X.jsx)(E,{title:f,help:p,actions:n.actions,children:(0,X.jsx)(Qa,{model:S,view:C,filter:o,sort:s,fields:c??an(S,C),actions:l,limit:u,display:d,empty:m,carousel:h===`carousel`?$a[g]:void 0,...x&&{planned:x}})})})},to=({model:e,view:t,empty:n,...r})=>{let{resources:i,views:a}=L(),o=ae(i,a,e.name),s=Pn(e.name,t.listOf,!0),c=(t.names?.plural??vt(e.name)).toLowerCase();if(!o.listOf)return null;if(s.error)return(0,X.jsx)(J,{title:An(`couldNotLoadYour`,{plural:c}),error:s.error});if(!s.data)return(0,X.jsx)(K,{className:`h-24`});let l=Xn(o.model,s.data);return l?(0,X.jsx)(ur,{...r,model:o.model,view:o.view,filter:``,scope:l,list:e.name,empty:n}):(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:n??An(`noneYet`,{plural:c})})},no=({model:e,view:t,target:n,targetView:r,row:i})=>{let a=bn(p(e,i)),{name:o,chips:s,title:c,body:l}=fr({model:e,of:t.searchesOf,target:n,targetView:r,row:i,recordKey:a});return(0,X.jsxs)(`section`,{"aria-label":c,className:`flex flex-col gap-3 py-4 first:pt-0 last:pb-0`,children:[(0,X.jsx)(`h3`,{className:`text-[0.9375rem] font-semibold`,children:(0,X.jsx)(w,{to:{kind:`record`,resource:e.name,key:a},className:`hover:underline`,children:o??(0,X.jsx)(zn,{chips:s})})}),(0,X.jsx)(ur,{...l})]})},ro=({model:e,view:t,empty:n})=>{let{resources:r,views:i}=L(),a=t.searchesOf,o=r[a.resource],s=Un(e.name,!0),c=(t.names?.plural??vt(e.name)).toLowerCase();return o?s.error?(0,X.jsx)(J,{title:Bn(`couldNotLoadYour`,{plural:c}),error:s.error}):s.data?s.data.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:n??Bn(`noneYet`,{plural:c})}):(0,X.jsx)(`div`,{className:`flex flex-col divide-y`,children:s.data.map(n=>(0,X.jsx)(no,{model:e,view:t,target:o,targetView:i[a.resource],row:n},bn(p(e,n))))}):(0,X.jsx)(K,{className:`h-40`}):null},io=({node:e,slots:t,className:n})=>{let{resource:r,filter:i=``,sort:a,limit:o,display:s,title:c,description:l,empty:u}=V(e),{resources:d,views:f}=L(),p=d[r];if(!p)return null;let m=f[p.name];return(0,X.jsx)(F,{title:c,description:l,actions:t.actions,className:n,children:m?.searchesOf?(0,X.jsx)(ro,{model:p,view:m,empty:u}):m?.listOf===void 0?(0,X.jsx)(ur,{model:p,view:m,filter:i,sort:a,limit:o,display:s,empty:u}):(0,X.jsx)(to,{model:p,view:m,limit:o,display:s,empty:u})})},ao=e=>e.type===`boolean`||e.type===`enum`,oo=({model:e,fields:t,title:n,description:r,stored:i,className:a})=>{let{resources:s,views:l}=L(),u=Pt(e.name),d=xt(),f=c(),p=$e(),m=l[e.name],[h,g]=(0,Y.useState)(i),[_,v]=(0,Y.useState)(()=>Aa(e,t,i?.record)),[y,b]=(0,Y.useState)({}),[x,S]=(0,Y.useState)(),[C,w]=(0,Y.useState)(!1),T=(0,Y.useRef)(Promise.resolve()),E=(0,Y.useRef)(i),ee=Aa(e,t,void 0),D=h?o(u,`update`)&&h.permissions?.update!==!1:o(u,`create`),te=t.filter(t=>!ao(e.fields[t])),ne=te.some(t=>h?dn(e.fields[t],_[t],h.record[t]):_[t]!==ee[t]),re=async t=>{let n=E.current;if(n){let r=await d.update(e.name,n.key,ja(e,t,n.record),n.etag??`*`);return{...mt(e,r.record),etag:r.etag,permissions:r.permissions??n.permissions}}let r=await d.create(e.name,Ke(e,s,{...ee,...t}));return{...mt(e,r.record),etag:r.etag}},ie=t=>{let r=T.current.then(async()=>{w(!0),S(void 0),await re(t).then(async r=>{E.current=r,g(r),b(e=>Object.fromEntries(Object.entries(e).filter(([e])=>!Object.hasOwn(t,e)))),await p(e.name),f.show({state:`success`,title:N(`saved`,{label:n??N(`settings`)})})},e=>{b(t=>({...t,...yn(e)})),S(e)}),w(!1)});T.current=r},ae=(t,n)=>{v(e=>({...e,[t]:n})),ao(e.fields[t])&&ie({[t]:n})};return(0,X.jsx)(F,{title:n,description:r,className:O(`h-full`,a),children:(0,X.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),ne&&ie(Object.fromEntries(te.map(e=>[e,_[e]])))},children:[x!==void 0&&Object.keys(y).length===0&&(0,X.jsx)(J,{title:N(`notSaved`),error:x}),t.map(t=>{let n=e.fields[t],r=m?.fields[t]?.label??vt(t),i=y[t];return(0,X.jsx)(Sn,{name:t,label:r,help:m?.fields[t]?.help,error:i&&Ze(n,r,i),children:(0,X.jsx)(mn,{field:n,hints:m?.fields[t],value:_[t],stored:h?.record[t]??ee[t],invalid:!!i,locked:!D||n.readOnly,resource:e.name,onChange:e=>ae(t,e)})},t)}),D&&ne&&(0,X.jsx)(`div`,{children:(0,X.jsx)(H,{type:`submit`,variant:`primary`,size:`sm`,loading:C,children:N(`save`)})})]})})},so=e=>{let t=cn(e.model,{});return t.isPending?(0,X.jsx)(F,{title:e.title,description:e.description,className:e.className,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(K,{className:`h-4 w-1/2`}),(0,X.jsx)(K,{className:`h-4 w-1/3`})]})}):t.error?(0,X.jsx)(F,{title:e.title,description:e.description,className:e.className,children:(0,X.jsx)(J,{title:N(`couldNotLoad`),error:t.error})}):(0,X.jsx)(oo,{...e,stored:t.data??void 0})},co=({node:e,className:t})=>{let{resource:n,fields:r=[],className:i,...a}=V(e),o=L().resources[n];return o?(0,X.jsx)(so,{...a,model:o,fields:r.filter(e=>Object.hasOwn(o.fields,e)),stored:void 0,className:t}):null},lo=(e,t)=>uo(e,t?[t]:[]),uo=(e,t)=>{let{resources:n}=L(),r=xt(),i=JSON.stringify(e),a=(0,Y.useMemo)(()=>JSON.parse(i).map(T),[i]),o=e=>t.some(t=>`item`in t?typeof t.item==`object`&&t.item!==null&&Object.hasOwn(t.item,e):Object.hasOwn(t.model.fields,e)),s=[...new Set(a.flatMap(e=>e.ok?e.paths:[]))],c=new Map(s.flatMap(e=>{let t=u(e,o);return t===void 0?[]:[[e,t]]})),l=s.filter(e=>!c.has(e)),d=[...new Set(c.values())].flatMap(e=>n[e]?[n[e]]:[]),f=l.map(e=>Nt(t,e)),p=on(l.map((e,t)=>{let n=f[t];return n&&`frame`in n?{scope:n.frame,path:n.path}:{scope:void 0,path:e}})),m=kn({queries:d.map(e=>ft(r,e))});return a.map(e=>{if(!e.ok)return!1;let t={};for(let n of e.paths){let e=c.get(n);if(e===void 0){let e=l.indexOf(n),r=f[e];if(r&&`item`in r){t[n]=r.item;continue}let i=p[e];if(i.state===`loading`)return;i.state===`ready`&&(t[n]=i.value);continue}let r=d.findIndex(t=>t.name===e);if(r===-1)t[n]=0;else if(m[r].isPending)return;else t[n]=m[r].data??0}return Pe(e,t)})},fo=(e,t)=>typeof e.props.fallback==`string`?e.props.fallback:t.fallback,po=({node:e,children:t,slots:n,className:r})=>{let{when:i}=V(e),[a]=uo([i],B());if(a===void 0)return null;let o=a?t:fo(e,n);return o==null?null:r===void 0?(0,X.jsx)(X.Fragment,{children:o}):(0,X.jsx)(`div`,{className:r,children:o})},mo=(e,t)=>e.flatMap(e=>typeof e==`string`?[]:[String(s(e,U(t)).props.when)]),ho=({node:e,children:t,slots:n,className:r})=>{let i=B(),a=uo(mo(e.children,i),i),o=a.findIndex(e=>e!==!1);if(o!==-1&&a[o]===void 0)return null;let s=o===-1?fo(e,n):t[o];return s==null?null:r===void 0?(0,X.jsx)(X.Fragment,{children:s}):(0,X.jsx)(`div`,{className:r,children:s})},go=({children:e})=>(0,X.jsx)(X.Fragment,{children:e}),_o=`text-2xl font-semibold tracking-tight tabular-nums`,vo=({model:e,at:t,filter:n})=>{let{views:r}=L(),i=Zt(t),a=We(e,n,!i),o=i??a;if(o.isPending)return(0,X.jsx)(K,{className:`h-8 w-16`});if(o.error)return(0,X.jsx)(`span`,{className:`text-danger-text`,children:N(`couldNotCount`)});let s=i?tr(i):a.data;return(0,X.jsx)(w,{to:$n(r[e.name],e.name,n),className:`${_o} hover:text-primary-text after:absolute after:inset-0 after:content-['']`,children:s.toLocaleString(Ht())})},yo=({field:e,format:t})=>{let n=at(e);return n.state===`loading`?(0,X.jsx)(K,{className:`h-8 w-16`}):n.state===`missing`?null:n.state===`plain`?(0,X.jsx)(`span`,{className:_o,children:ia(n.value)}):(0,X.jsx)(`span`,{className:_o,children:(0,X.jsx)(vn,{model:n.model,field:n.field,value:n.value,format:t})})},bo=({node:e,at:t,className:n})=>{let{label:r,value:i,resource:a,filter:o,field:s,format:c,description:l}=V(e),{resources:u}=L(),d=a===void 0?void 0:u[a];return(0,X.jsxs)(F,{className:O(`relative h-full`,n),bodyClassName:`flex flex-col`,children:[(0,X.jsx)(`p`,{className:`text-muted-foreground break-words`,children:r}),(0,X.jsxs)(`div`,{className:`mt-auto pt-1`,children:[i!==void 0&&(0,X.jsx)(`span`,{className:_o,children:i}),d&&(0,X.jsx)(vo,{model:d,...t!==void 0&&{at:t},filter:o}),s!==void 0&&(0,X.jsx)(yo,{field:s,format:c})]}),l&&(0,X.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:l})]})},xo=(e,t,n)=>{let r=ie(),i=Jn(t),[a,o]=(0,Y.useState)(()=>Hn(localStorage,i)),s=(0,Y.useCallback)(e=>{o(e),ar(localStorage,i,e)},[i]);return[ir(e,r,{picked:a,preferred:n}),s]},So=({model:e,items:t,columns:n,button:r,title:i,description:a,empty:s,actions:c,className:l})=>{let{resources:u,views:d}=L(),f=d[e.name],{fields:p}=se(),m=o(Pt(e.name),`update`),{go:h,href:_}=ke(),y=ie(),x=!b(),S=(0,Y.useMemo)(()=>n?.map(v)??an(e,f),[n,e,f]),C=(0,Y.useMemo)(()=>rt(e,f,S,{resources:u,views:d,fieldTypes:p}),[e,f,S,u,d,p]),w=(0,Y.useMemo)(()=>y?Je(n)(C):C,[y,n,C]),T=(0,Y.useMemo)(()=>r?Zn(w,e,f,r,u,x):w,[w,e,f,r,u,x]),E=(0,Y.useMemo)(()=>t.map(t=>({...t,id:g(e,t)})),[t,e]),ee=(0,Y.useMemo)(()=>({total:E.length,rowAt:e=>E[e]}),[E]),D=nr({model:e,view:f,opens:void 0,resources:u,views:d,canUpdate:m}),te=e=>({href:_(e),onFollow:()=>h(e)});return(0,X.jsx)(F,{title:i,description:a,actions:c,className:l,children:E.length===0?(0,X.jsx)(un,{children:s??N(`nothingYet`)}):(0,X.jsx)(In,{fit:!0,columns:T,source:ee,latencyMs:0,onOpenRow:e=>h(D.address(e)),rowLink:e=>te(D.address(e)),rowActions:D.actions(te),rowNumbers:!1,selectable:!1})})},Co=e=>{let t=ht();return t?.model?(0,X.jsx)(So,{...e,model:t.model,items:t.items}):null},wo=({model:e,view:t,filter:n=``,sort:r=``,columns:i,button:a,bulk:o,limit:s=10,display:c,title:l,description:u,empty:d,actions:f,className:p,chosen:m,planned:h})=>{let[g,_]=xo(t,`page:${e.name}:${l??``}:${n}`,c),y=m?ee:g,b=(0,Y.useMemo)(()=>i?.map(v),[i]),x=(0,Y.useMemo)(()=>Je(i),[i]);return(0,X.jsxs)(F,{title:l,description:u,actions:(0,X.jsxs)(X.Fragment,{children:[!m&&(0,X.jsx)(or,{view:t,value:y,onChange:_}),f]}),className:O(`h-full`,p),children:[(0,X.jsx)(er,{model:e,view:t,filter:n,sort:r,columns:b,button:a,bulk:o,limit:s,display:y,empty:d,phoneColumns:x,...m&&{rowTo:m.rowTo,chosenKey:m.key},...h&&{planned:h}}),m?.details]})},To=({node:e,at:t,slots:n,children:r,className:i})=>{let{className:a,resource:o,select:s,children:c,...l}=V(e),{resources:u,views:d}=L(),[f,p]=Ct([t,t===void 0?void 0:`${t}#total`]),m=(0,Y.useMemo)(()=>f&&{rows:f,total:p},[f,p]);if(o===void 0)return(0,X.jsx)(Co,{...l,actions:n.actions,className:i});let h=u[o];return h?s===void 0?(0,X.jsx)(wo,{...l,model:h,view:d[h.name],actions:n.actions,className:i,...m&&{planned:m}}):(0,X.jsx)(Eo,{...l,model:h,view:d[h.name],actions:n.actions,className:i,select:s,...m&&{planned:m},children:r}):null},Eo=({select:e,children:t,...n})=>{let{given:r,linkTo:i}=wt(),a=t=>i({[e]:t}),o=r[e],s=o===void 0?null:(0,X.jsx)(Vt,{name:e,children:(0,X.jsx)(ui,{model:n.model,query:{key:o},children:t},o)});return(0,X.jsx)(wo,{...n,chosen:{rowTo:a,key:o,details:s}})},Do=({node:e,children:t,className:n})=>{let{tab:r,pathOf:i}=Se(),{navigate:a}=qe(),o=hn(e),s=Qe(o,r),c=e=>i(e===o[0]?.name?void 0:e);return(0,X.jsxs)(`div`,{className:O(`flex flex-col gap-6`,n),children:[(0,X.jsxs)(`select`,{"aria-label":N(`tabs`),value:s?.name??``,onChange:e=>a(c(e.target.value)),className:`h-9 rounded-md border border-border-strong bg-background px-2 font-medium md:hidden`,children:[!s&&(0,X.jsx)(`option`,{value:``,disabled:!0}),o.map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.label},e.name))]}),(0,X.jsx)(`nav`,{"aria-label":N(`tabs`),className:`hidden border-b md:block`,children:(0,X.jsx)(`ul`,{className:`flex gap-1`,children:o.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(Yt,{to:c(e.name),"aria-current":e===s?`page`:void 0,className:O(`-mb-px inline-flex h-9 items-center whitespace-nowrap border-b-2 px-3 font-medium transition-colors`,e===s?`border-foreground text-foreground`:`border-transparent text-muted-foreground hover:text-foreground`),children:e.label})},e.name))})}),s?(0,X.jsx)(Y.Fragment,{children:t[o.indexOf(s)]},s.name):(0,X.jsx)(He,{children:N(`noTab`,{name:r??``})})]})},Oo=({children:e})=>(0,X.jsx)(`div`,{className:`flex flex-col gap-6`,children:e}),ko=e=>e===void 0?1/0:Date.parse(e),Ao=(e,t)=>{let n=e=>e.more&&e.items.length>0?ko(e.items.at(-1).time):-1/0,r=Math.max(n(e),n(t)),i=[],a=0,o=0;for(;a<e.items.length||o<t.items.length;){let n=o>=t.items.length||a<e.items.length&&ko(e.items[a].time)>=ko(t.items[o].time)?e.items[a++]:t.items[o++];if(ko(n.time)<r)break;i.push(n)}return i},jo=({value:e,hints:t,mark:n})=>{let r=Lt(e,t?.valueLabels);return n===`done`?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,X.jsx)(S,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-success-text`}),r]}):n===`running`?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,X.jsx)(_t,{hidden:!0,className:`size-3.5 shrink-0`}),r]}):n!==`error`&&Te(t?.valueColors,e)!==`red`?r:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-danger-text`,children:[(0,X.jsx)(pr,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),r]})},Mo=({value:e})=>{let t=typeof e==`string`?wn(e):e;return t===l?(0,X.jsx)(C,{children:String(e)}):(0,X.jsx)(Ne,{value:t})},No=({label:e,children:t})=>(0,X.jsxs)(`div`,{className:`grid gap-1`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]}),Po=({call:e,statusHints:t})=>{let[n,r]=(0,Y.useState)(!1),i=(0,Y.useId)(),a=e.status!==void 0&&(0,X.jsx)(jo,{value:e.status,hints:t,mark:e.state}),o=(0,X.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:e.name}),s=e.input!==void 0||e.result!==void 0||e.error!==void 0;return(0,X.jsxs)(`div`,{"data-tool-call":!0,className:`flex min-w-0 flex-col gap-1 pl-11 text-xs text-muted-foreground`,children:[s?(0,X.jsxs)(H,{size:`sm`,variant:`ghost`,className:`-ml-2.5 self-start`,"aria-expanded":n,"aria-controls":i,onClick:()=>r(!n),children:[(0,X.jsx)(Cn,{"aria-hidden":!0,className:O(`size-3.5 transition-transform`,n&&`rotate-90`)}),o,a]}):(0,X.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[o,a]}),n&&(0,X.jsxs)(`div`,{id:i,className:`grid gap-2`,children:[e.input!==void 0&&(0,X.jsx)(No,{label:Q(`callInput`),children:(0,X.jsx)(Mo,{value:e.input})}),e.result!==void 0&&(0,X.jsx)(No,{label:Q(`callResult`),children:(0,X.jsx)(Mo,{value:e.result})}),e.error!==void 0&&(0,X.jsx)(No,{label:Q(`callError`),children:(0,X.jsx)(C,{children:e.error})})]})]})},Fo=(e,t)=>e.map(e=>({kind:`message`,row:e,time:typeof e[t]==`string`?e[t]:void 0})),Io=e=>{if(typeof e==`object`&&e&&`id`in e){let{id:t,name:n}=e;return{id:String(t),...typeof n==`string`&&{name:n}}}return{id:String(e??``),...typeof e==`string`&&{name:e}}},Lo=(e,{key:t,sender:n,text:r,status:i},a=Date.now())=>{let o=[],s;for(let c of[...e].reverse()){let e=c.time,l=s?.time!==void 0&&e!==void 0&&te(s.time,e);if(e!==void 0&&!l&&o.push({kind:`day`,key:`day:${c.kind===`call`?c.key:t(c.row)}`,label:y(e,a)}),c.kind===`call`){o.push(c),s={author:void 0,time:e};continue}let{row:u}=c,d=n===void 0?void 0:Io(u[n]),f=d?.id??``,p=i===void 0||u[i]==null||u[i]===``?void 0:String(u[i]);o.push({kind:`message`,key:t(u),...d&&{author:d},time:e,text:u[r]==null?``:String(u[r]),...p!==void 0&&{status:p},continued:l&&s?.author===f}),s={author:f,time:e}}return o},Ro=e=>Br.includes(e??``)?e:void 0,zo=e=>e==null||e===``?void 0:String(e),Bo=e=>`call:${JSON.stringify(e)}`,Vo=(e,t,n)=>{let r=zo(e[n.status]),i=Ro(r),a=n.input===void 0?void 0:e[n.input],o=n.result===void 0?void 0:e[n.result],s=n.error===void 0?void 0:zo(e[n.error]);return{kind:`call`,key:t,name:String(e[n.name]??``),time:typeof e[n.time]==`string`?e[n.time]:void 0,...r!==void 0&&{status:r},...i!==void 0&&{state:i},...a!=null&&{input:a},...o!=null&&{result:o},...s!==void 0&&{error:s}}},Ho=({planned:e,limit:t,expanded:n,expand:r,own:i})=>{if(!e)return i;let a=n&&!i.error&&i.pages<2&&(i.pages===0||i.hasNextPage),o={items:e.rows,labels:e.labels??{},hasNextPage:e.rows.length>=t,isFetchingNextPage:a,isFetchNextPageError:!1,isLoading:e.isPending};return n&&i.error&&i.pages===0?{...o,error:i.error,fetchNextPage:i.refetch,refetch:i.refetch}:n&&!a?i:{...o,error:e.error,fetchNextPage:r,refetch:r}},Uo=(e,{pageSize:t=50,enabled:n=!0,...r},i)=>{let[a,o]=(0,Y.useState)(!1),s=Tn(e,{...r,pageSize:t,enabled:n&&(!i||a)}),c=s.data?.pages.length??0,{hasNextPage:l,isFetchingNextPage:u,fetchNextPage:d,error:f}=s;return(0,Y.useEffect)(()=>{i&&a&&!f&&c===1&&l&&!u&&d()},[i,a,f,c,l,u,d]),Ho({planned:i,limit:t,expanded:a,expand:()=>o(!0),own:{...s,pages:c}})},Wo=(e,t,n)=>{let{views:r}=L(),i=e?.model.name??``,a=Uo(i,{filter:e?.filter,orderBy:e&&oe(e.fields.time),pageSize:t,enabled:e!==void 0},n);return e?{calls:a.items.map(t=>Vo(t,Bo(p(e.model,t)),e.fields)),hasNextPage:a.hasNextPage,isFetchingNextPage:a.isFetchingNextPage,list:a,statusHints:r[i]?.fields[e.fields.status]}:{calls:[],hasNextPage:!1,isFetchingNextPage:!1,list:a,statusHints:void 0}},Go=e=>e.items.length>0?`messages`:e.error?`error`:e.isLoading?`loading`:`messages`,Ko=(e,t)=>e.isLoading?t.loading:t.empty,qo=e=>e.items.length>0&&!!e.error,Jo=e=>e.isFetchNextPageError?()=>void e.fetchNextPage():()=>void e.refetch(),Yo=e=>{for(let t of e)t.hasNextPage&&t.fetchNextPage()},Xo=({model:e,filter:t,sender:n,time:i,text:a,status:o,limit:s=50,empty:c,working:l,calls:u,planned:d})=>{let{resources:f,views:h}=L(),g=_(),v=g?.state.kind===`signed-in`?g.state.user.id:void 0,y=n===void 0?[]:[n],b=r(f,h,e,y),x=Uo(e.name,{filter:t,orderBy:oe(i),pageSize:s,labels:b},d?.messages),S=Wo(u,s,d?.calls),C=Go(x);if(C===`error`)return(0,X.jsx)(J,{title:Q(`couldNotLoad`),error:x.error,onRetry:Jo(x)});if(C===`loading`)return(0,X.jsx)(`div`,{className:`p-4`,children:(0,X.jsx)(un,{children:Q(`loadingMessages`)})});let w=ut(f,e,y,x.items,x.labels),T=Ao({items:S.calls,more:S.hasNextPage},{items:Fo(w,i),more:x.hasNextPage}),E=Lo(T,{key:t=>String(p(e,t)),sender:n,time:i,text:a,status:o}),ee=o===void 0?void 0:h[e.name]?.fields[o],D=e.fields[a]!==void 0&&m(e.fields[a],h[e.name]?.fields[a]),te=E.findLast(e=>e.kind===`message`&&e.author!==void 0&&e.author.id===v);return(0,X.jsxs)(X.Fragment,{children:[qo(x)&&(0,X.jsx)(`div`,{className:`shrink-0 p-2`,children:(0,X.jsx)(J,{title:Q(`couldNotLoad`),error:x.error,onRetry:Jo(x)})}),u&&S.list.error&&(0,X.jsx)(`div`,{className:`shrink-0 p-2`,children:(0,X.jsx)(J,{title:Q(`couldNotLoadCalls`),error:S.list.error,onRetry:Jo(S.list)})}),(0,X.jsx)(fe,{length:T.length,followKey:te?.key,working:l,empty:Ko(S.list,{loading:Q(`loadingMessages`),empty:c??Q(`noMessages`)}),onLoadEarlier:x.hasNextPage||S.hasNextPage?()=>Yo([x,S.list]):void 0,loadingEarlier:x.isFetchingNextPage||S.isFetchingNextPage,children:E.map(e=>e.kind===`day`?(0,X.jsx)(ye,{label:e.label},e.key):e.kind===`call`?(0,X.jsx)(Po,{call:e,statusHints:S.statusHints},e.key):(0,X.jsx)(me,{...e.author?{author:e.author}:{alone:!0},time:e.time,continued:e.continued,footer:e.status!==void 0&&(0,X.jsx)(jo,{value:e.status,hints:ee}),children:D&&e.text!==``?(0,X.jsx)(ge,{source:e.text,className:`whitespace-normal`}):e.text},e.key))})]})},Zo=({children:e})=>(0,X.jsx)(`div`,{className:`flex h-[min(36rem,65dvh)] flex-col rounded-lg border border-border bg-background`,children:e}),Qo=({node:e,at:t,slots:n,className:r})=>{let{title:i,description:a,resource:o,filter:s,sender:c,time:l,text:u,status:d,working:f,calls:p,limit:m,empty:h}=V(e),{resources:g}=L(),[_]=uo(f===void 0?[]:[f],B()),[v,y]=Ct([t,t===void 0?void 0:`${t}#calls`]),b=g[o];if(!b)return null;let x=p&&g[p.resource];return(0,X.jsx)(`section`,{className:O(`flex min-w-0 flex-col`,r),"aria-label":i,children:(0,X.jsx)(E,{title:i,help:a,actions:n.actions,children:(0,X.jsx)(Zo,{children:(0,X.jsx)(Xo,{model:b,filter:s,sender:c,time:l,text:u,status:d,calls:p&&x&&{model:x,filter:p.filter,fields:p},limit:m,empty:h,working:f===void 0?void 0:_===!0,...(v||y)&&{planned:{messages:v,calls:y}}})})})})},$o=({children:e,className:t})=>(0,X.jsx)(`div`,{className:t,children:e}),es=({children:e,className:t})=>(0,X.jsx)(`div`,{className:O(`flex`,t),children:e}),ts=({children:e,className:t})=>(0,X.jsx)(`div`,{className:O(`flex flex-col`,t),children:e}),ns=({node:e,children:t,className:n})=>{let{as:r=`p`}=V(e);return(0,X.jsx)(r,{className:n,children:t})},rs=({node:e,children:t})=>{let{source:n}=V(e),r=de(U(B()),n),i=(0,Y.useMemo)(()=>({items:Array.isArray(r)?r:[]}),[r]);return(0,X.jsx)(Rt,{value:i,children:t})},is=({node:e,className:t})=>{let{source:n,choices:r,label:i=n,defaultValue:a}=V(e),{values:o,linkTo:s}=wt(),c=o[n];return(0,X.jsxs)(`div`,{className:O(`flex flex-wrap items-center gap-2`,t),children:[(0,X.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:i}),r?(0,X.jsx)(je,{label:i,value:c??``,options:r.map(e=>({value:String(e.id),label:e.name})),link:e=>s({[n]:a!==void 0&&e===String(a)?void 0:e})}):(0,X.jsx)(`span`,{children:c})]})},as=({model:e,filter:t,perPage:n,more:r,planned:i,expanded:a,expand:o,own:s})=>{if(t===void 0)return{read:{isPending:!1,error:null},list:{model:e,items:[]}};if(i&&!a){let t=i.rows.slice(0,n),a=r&&t.length===n?o:void 0;return{read:i,list:{model:e,items:t,planned:!0,...a&&{loadMore:a}}}}if(i&&!s.error&&s.pages<2&&(s.pages===0||s.hasNextPage))return{read:i,list:{model:e,items:i.rows.slice(0,n),planned:!0,loadMore:()=>{},loadingMore:!0}};let c=r&&s.hasNextPage?()=>void s.fetchNextPage():void 0;return{read:{isPending:s.isPending,error:s.error},list:{model:e,items:s.items,...c&&{loadMore:c,loadingMore:s.isFetchingNextPage}}}},os=({model:e,filter:t,sort:n,perPage:r,more:i,planned:a})=>{let[o,s]=(0,Y.useState)(!1),c=Tn(e.name,{filter:t,orderBy:n,pageSize:r,enabled:t!==void 0&&(!a||o)}),l=c.data?.pages.length??0,{hasNextPage:u,isFetchingNextPage:d,fetchNextPage:f,error:p}=c;return(0,Y.useEffect)(()=>{a&&o&&!p&&l===1&&u&&!d&&f()},[a,o,p,l,u,d,f]),as({model:e,filter:t,perPage:r,more:i,planned:a,expanded:o,expand:()=>s(!0),own:{pages:l,items:c.items,hasNextPage:u,isFetchingNextPage:d,isPending:c.isPending,error:p,fetchNextPage:f}})},ss=({node:e,at:t,children:n})=>{let r=V(e),i=L().resources[r.reference],a=Dt(U(B())),o=Zt(t);return i?(0,X.jsx)(cs,{model:i,...le(r,i.primaryKey[0],a),more:r.pagination===`more`,empty:r.empty,...o&&{planned:o},children:n}):null},cs=({empty:e,children:t,...n})=>{let{read:r,list:i}=os(n);return(0,X.jsx)(bt,{read:r,list:i,empty:e,children:t})},ls=({node:e,at:t,children:n})=>{let r=V(e),i=L().resources[r.reference],a=Dt(U(B())),o=Zt(t);return i?(0,X.jsx)(cs,{model:i,...D(r,i.primaryKey[0],a),more:!1,empty:r.empty,...o&&{planned:o},children:n}):null},us=({model:e,at:t,recordKey:n,link:r=`edit`,children:i,className:a})=>{let{views:o}=L(),s=Zt(t),c=cn(e,{key:n,enabled:!s}),l=s?yt(e,s):c;if(l.isPending)return(0,X.jsx)(K,{className:`h-4 w-24`});if(l.error)return(0,X.jsx)(J,{title:N(`couldNotLoad`),error:l.error});if(!l.data)return null;let u=i.length>0?(0,X.jsx)(en,{value:l.data,children:i}):dt(e,o[e.name],l.data.record,n);return r===!1?(0,X.jsx)(`span`,{className:a,children:u}):(0,X.jsx)(w,{to:{kind:`record`,resource:e.name,key:n},className:a??`font-medium text-primary-text hover:underline`,children:u})},ds=({node:e,at:t,children:n,className:r})=>{let{reference:i,source:a,link:o,empty:s}=V(e),c=L().resources[i],l=de(U(B()),a);return c?l==null||l===``?s===void 0?null:(0,X.jsx)(`span`,{className:r,children:s}):(0,X.jsx)(us,{model:c,...t!==void 0&&{at:t},recordKey:String(l),link:o,className:r,children:n}):null},fs=(e,t)=>t.map(t=>Ye(e,t)).join(`, `),$=Xt(`users`),ps=({roles:e})=>{let{session:t}=M(),[n,r]=(0,Y.useState)([]),[i,a]=(0,Y.useState)([]),o=(0,Y.useCallback)(()=>void t.users.invitations().then(a,()=>a([])),[t]);return(0,Y.useEffect)(o,[o]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(hr,{title:$(`inviteSomeone`),description:$(`inviteDescription`),onInvite:async e=>{let i=await t.users.invite({email:e,roles:n});return r([]),o(),i},incomplete:n.length===0,children:(0,X.jsx)(_r,{roles:e,selected:n,grantable:new Set(e.map(e=>e.name)),onChange:r})}),(0,X.jsx)(z,{title:$(`notAcceptedYet`),description:i.length>0?$(`sendingAgain`):$(`nobodyWaiting`),children:i.length>0&&(0,X.jsx)(`ul`,{className:`divide-y rounded-md border`,children:i.map(n=>(0,X.jsx)(gr,{email:n.email,gives:fs(e,n.roles),expiresAt:n.expiresAt,onResend:async()=>{let e=await t.users.invite({email:n.email,roles:n.roles});return o(),e},onRevoke:async()=>{await t.users.revoke(n.id),o()}},n.id))})})]})},ms=({roles:e,onCreated:t})=>{let{session:n}=M(),[r,i]=(0,Y.useState)(``),[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)([]),{busy:d,error:f,run:p}=be(),m=()=>p(async()=>{await n.users.create({email:r.trim(),name:a.trim(),roles:l,...s&&{password:s}}),i(``),o(``),c(``),u([]),t()}),h=!r.trim()||!a.trim()||l.length===0||s!==``&&s.length<12;return(0,X.jsxs)(z,{title:$(`addAnAccount`),description:$(`addDescription`),children:[(0,X.jsx)(G,{message:f}),(0,X.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,X.jsx)(k,{"aria-label":$(`email`),type:`email`,placeholder:`name@example.com`,value:r,onChange:e=>i(e.target.value),wrapperClassName:`flex-1`}),(0,X.jsx)(k,{"aria-label":$(`name`),placeholder:$(`name`),autoComplete:`off`,value:a,onChange:e=>o(e.target.value),wrapperClassName:`flex-1`})]}),(0,X.jsx)(k,{"aria-label":$(`password`),type:`password`,autoComplete:`new-password`,placeholder:$(`passwordOptional`,{length:12}),value:s,onChange:e=>c(e.target.value)}),(0,X.jsx)(_r,{roles:e,selected:l,grantable:new Set(e.map(e=>e.name)),onChange:u}),(0,X.jsx)(`div`,{children:(0,X.jsx)(H,{type:`submit`,variant:`primary`,loading:d,disabled:h,children:$(`addAccount`)})})]})]})},hs=({user:e,roles:t,self:n})=>{let{session:r}=M(),[i,a]=(0,Y.useState)(e),{busy:o,error:s,run:c,setError:l}=be(),u=e=>{if(e.length===0)return l($(`keepOneRole`));c(async()=>{await r.users.setRoles(i.id,e),a({...i,roles:e})})},d=e=>void c(async()=>{await(e?r.users.block(i.id):r.users.unblock(i.id)),a({...i,blocked:e})});return(0,X.jsx)(vr,{name:i.name,email:i.email,self:n,error:s,actions:(0,X.jsxs)(X.Fragment,{children:[i.blocked&&(0,X.jsx)(W,{tone:`red`,children:$(`blocked`)}),!n&&(i.blocked?(0,X.jsx)(H,{size:`sm`,loading:o,onClick:()=>d(!1),children:$(`unblock`)}):(0,X.jsx)(H,{size:`sm`,variant:`danger`,loading:o,onClick:()=>d(!0),children:$(`block`)}))]}),children:(0,X.jsx)(_r,{roles:t,selected:i.roles,grantable:new Set(t.map(e=>e.name)),disabled:o,onChange:u})})},gs=({roles:e,version:t})=>{let{session:n,state:r}=M(),[i,a]=(0,Y.useState)(``),o=(0,Y.useCallback)((e,t)=>n.users.search(e,t).then(e=>({items:e.users,total:e.total})),[n,t]),s=br(o,i),c=r.kind===`signed-in`?r.user.id:void 0;return(0,X.jsx)(yr,{title:$(`people`),description:$(`peopleDescription`),searchLabel:$(`findSomeone`),placeholder:$(`emailAddress`),query:i,onQuery:a,list:s,renderRow:n=>(0,X.jsx)(hs,{user:n,roles:e,self:n.id===c},`${t}/${n.id}`)})},_s=()=>{let{session:e}=M(),[t,n]=(0,Y.useState)([]),[r,i]=(0,Y.useState)();return(0,Y.useEffect)(()=>{e.users.roles().then(n,e=>i(e instanceof A?I(e):$(`couldNotReadRoles`)))},[e]),{roles:t,error:r}},vs=()=>{let{roles:e,error:t}=_s(),[n,r]=(0,Y.useState)(0);return(0,X.jsxs)(`div`,{className:`flex max-w-3xl flex-col gap-4`,children:[(0,X.jsx)(G,{message:t}),(0,X.jsx)(gs,{roles:e,version:n}),(0,X.jsx)(ps,{roles:e}),(0,X.jsx)(ms,{roles:e,onCreated:()=>r(e=>e+1)})]})},ys=({sender:e,busy:t,error:n,onSave:r,onClose:i})=>{let[a,o]=(0,Y.useState)(e?.address??``),[s,c]=(0,Y.useState)(e?.name??``),[l,u]=(0,Y.useState)(e?.signature??``),[d,f]=(0,Y.useState)(e?.isDefault??!1);return(0,X.jsxs)(R,{title:e?e.address:q(`addFromAddress`),description:q(e?`changeFromAddressDescription`:`addFromAddressDescription`),onClose:i,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{onClick:i,children:q(`cancel`)}),(0,X.jsx)(H,{variant:`primary`,loading:t,disabled:!a.trim(),onClick:()=>r({address:a.trim(),name:s.trim(),signature:l,isDefault:d}),children:q(e?`save`:`addAddress`)})]}),children:[!e&&(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[q(`fromAddress`),(0,X.jsx)(k,{autoFocus:!0,type:`email`,value:a,maxLength:254,placeholder:q(`fromAddressPlaceholder`),onChange:e=>o(e.target.value)})]}),(0,X.jsxs)(`label`,{className:`mt-3 flex flex-col gap-1.5 font-medium`,children:[q(`fromName`),(0,X.jsx)(k,{value:s,maxLength:100,placeholder:q(`fromNamePlaceholder`),onChange:e=>c(e.target.value)})]}),(0,X.jsxs)(`label`,{className:`mt-3 flex cursor-pointer items-center justify-between gap-3`,children:[(0,X.jsx)(`span`,{children:q(`defaultFromAddress`)}),(0,X.jsx)(pe,{checked:d,onChange:f,label:q(`defaultFromAddress`)})]}),(0,X.jsxs)(`label`,{className:`mt-3 flex flex-col gap-1.5 font-medium`,children:[q(`signature`),(0,X.jsx)(Oe,{value:l,maxLength:2e3,placeholder:q(`signaturePlaceholder`),onChange:e=>u(e.target.value)})]}),(0,X.jsx)(G,{message:n})]})},bs=e=>e.signature?q(`ownSignature`):q(`genericSignature`),xs=({senders:{address:e,senders:t},onAdd:n,onUpdate:r,onRemove:i})=>{let[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(),[l,u]=(0,Y.useState)(),d=(0,Y.useRef)(!1),f=t.find(e=>e.isDefault),p=()=>{u(void 0),c(void 0)},m=async e=>{if(!d.current){d.current=!0,o(!0),c(void 0);try{await e(),u(void 0)}catch(e){if(e instanceof TypeError)return c(q(`noAnswerFromServer`));if(!(e instanceof A))throw e;c(I(e))}finally{d.current=!1,o(!1)}}},h=e=>m(async()=>{let t=e.name||null,i=e.signature.trim()?e.signature:null;if(l?.kind===`change`)return r(l.sender.id,{name:t,signature:i,isDefault:e.isDefault});let a=await n({address:e.address,...t&&{name:t},...i&&{signature:i}});e.isDefault&&await r(a.id,{isDefault:!0})});return(0,X.jsxs)(`div`,{className:`mt-5 border-t pt-4`,children:[(0,X.jsx)(`h3`,{className:`font-semibold`,children:q(`fromAddresses`)}),(0,X.jsx)(`p`,{className:`mt-1 mb-3 text-muted-foreground`,children:q(`fromAddressesDescription`)}),(0,X.jsx)(G,{message:l?void 0:s}),(e||t.length>0)&&(0,X.jsxs)(`ul`,{className:`mb-3 divide-y rounded-md border`,children:[e&&(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,X.jsx)(Tr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`bdi`,{className:`block truncate font-medium`,children:e}),(0,X.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:q(`mailboxOwnAddress`)})]}),f?(0,X.jsx)(H,{size:`sm`,variant:`ghost`,loading:a,onClick:()=>void m(()=>r(f.id,{isDefault:!1})),children:q(`makeDefault`)}):(0,X.jsx)(W,{tone:`blue`,children:q(`default`)})]}),t.map(e=>(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,X.jsx)(Tr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`bdi`,{className:`block truncate font-medium`,children:e.address}),e.name&&(0,X.jsx)(`bdi`,{className:`block truncate`,children:e.name}),(0,X.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:bs(e)})]}),e.isDefault&&(0,X.jsx)(W,{tone:`blue`,children:q(`default`)}),(0,X.jsx)(H,{size:`sm`,variant:`ghost`,onClick:()=>u({kind:`change`,sender:e}),children:q(`edit`)}),(0,X.jsx)(H,{size:`sm`,variant:`ghost`,onClick:()=>u({kind:`remove`,sender:e}),children:q(`remove`)})]},e.id))]}),(0,X.jsxs)(H,{onClick:()=>u({kind:`add`}),children:[(0,X.jsx)(we,{className:`size-3.5`}),q(`addFromAddress`)]}),l?.kind===`add`&&(0,X.jsx)(ys,{busy:a,error:s,onSave:e=>void h(e),onClose:p}),l?.kind===`change`&&(0,X.jsx)(ys,{sender:l.sender,busy:a,error:s,onSave:e=>void h(e),onClose:p},l.sender.id),l?.kind===`remove`&&(0,X.jsx)(R,{title:q(`removeFromAddress`,{address:l.sender.address}),description:q(`removeFromAddressDescription`),onClose:p,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{onClick:p,children:q(`cancel`)}),(0,X.jsx)(H,{variant:`danger`,loading:a,onClick:()=>void m(()=>i(l.sender.id)),children:q(`remove`)})]}),children:(0,X.jsx)(G,{message:s})})]})},Ss=(e,t,n)=>Object.fromEntries(Fn(e,t,{code:`not_linked`}).filter(e=>e.signInOnly).map(({link:e})=>[e.id,f(`signInOnly`,{provider:n(e.provider),name:e.name})])),Cs=({links:e})=>{let{session:t,linkPersonalMail:n,signInProviders:r}=M(),{account:a}=t,[o]=(0,Y.useState)(Le),s=(0,Y.useCallback)(async()=>{let[t,n,r]=await Promise.all([a.linkedPersonalMail(e),a.linkedProviders(),a.mailSenders()]);return{mail:t,providers:n,senders:r}},[a,e]),{data:c,error:l,reload:u}=P(s,q(`couldNotReadMethods`));return c?(0,X.jsx)(i,{title:q(`mailbox`),description:q(`mailboxDescription`),providers:e.map(({id:e,name:t})=>({id:e,name:t})),linked:c.mail,notes:Ss(e,c,e=>r.find(t=>t.id===e)?.name??h(e)),reconnect:!0,onConnect:t=>n(e.find(e=>e.id===t)),error:o&&Wt(o,e.length===1?e[0].name:q(`theProvider`)),children:(0,X.jsx)(xs,{senders:c.senders,onAdd:async e=>{let t=await a.addMailSender(e);return Ce(),await u(),t},onUpdate:async(e,t)=>{await a.updateMailSender(e,t),Ce(),await u()},onRemove:async e=>{await a.removeMailSender(e),Ce(),await u()}})}):(0,X.jsx)(j,{error:l})},ws=()=>{let{personalMail:e}=M();return e.length>0?(0,X.jsx)(Cs,{links:e}):null},Ts=e=>xr(e.name)??`An unnamed app`,Es=e=>e.access.map(({role:e,organization:t})=>`as ${e||`no role`}${t?` in ${t}`:``}`).join(`, `),Ds=({apps:e,onDisconnect:t})=>{let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(),[o,s]=(0,Y.useState)(),c=async e=>{r(!0),a(void 0);try{await t(e.clientId),s(void 0)}catch(e){if(!(e instanceof A))throw e;a(I(e))}r(!1)};return(0,X.jsxs)(z,{title:`Connected apps`,description:`AI assistants and other apps you allowed to act as you here. Disconnecting one stops it within 15 minutes; it has to ask you again to come back.`,children:[(0,X.jsx)(G,{message:o?void 0:i}),e.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`No apps are connected. Add this app's MCP address to an AI assistant to connect one.`}):(0,X.jsx)(`ul`,{className:`divide-y rounded-md border`,children:e.map(e=>{let t=Sr(e.clientId);return(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,X.jsx)(Dr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`bdi`,{className:`block truncate font-medium`,children:Ts(e)}),(0,X.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[t&&`Published by ${t} · `,`Allowed `,lt(Date.parse(e.allowedAt)),` · `,Es(e)]})]}),(0,X.jsx)(H,{size:`sm`,variant:`ghost`,onClick:()=>s(e),children:`Disconnect`})]},e.clientId)})}),o&&(0,X.jsx)(R,{title:`Disconnect ${Ts(o)}?`,description:`It can no longer read or change anything as you. What it already started may keep working for up to 15 minutes.`,onClose:()=>s(void 0),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{onClick:()=>s(void 0),children:`Cancel`}),(0,X.jsx)(H,{variant:`danger`,loading:n,onClick:()=>void c(o),children:`Disconnect`})]}),children:i&&(0,X.jsx)(G,{message:i})})]})},Os=(e,t)=>{let n=new URL(`https://claude.ai/customize/connectors`);return n.searchParams.set(`modal`,`add-custom-connector`),t&&n.searchParams.set(`connectorName`,t),n.searchParams.set(`connectorUrl`,e),n.href},ks=({url:e,appName:t})=>(0,X.jsx)(z,{title:q(`mcpAddress`),description:q(`mcpAddressDescription`),children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(Cr,{value:e,copyLabel:q(`copyMcpAddress`)}),(0,X.jsxs)(`a`,{href:Os(e,t),target:`_blank`,rel:`noreferrer`,className:It(),children:[(0,X.jsx)(ue,{className:`size-3.5`}),q(`addToClaude`)]})]})}),As=()=>{let{account:e}=M().session,{data:t,error:n,reload:r}=P((0,Y.useCallback)(()=>e.connectedApps(),[e]),q(`couldNotReadMethods`));return t?(0,X.jsx)(Ds,{apps:t,onDisconnect:t=>e.disconnectApp(t).then(r)}):(0,X.jsx)(j,{error:n})},js=({url:e})=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ks,{url:e,appName:L().appName}),(0,X.jsx)(As,{})]}),Ms=()=>{let{mcp:e}=M();return e?(0,X.jsx)(js,{url:e.url}):null},Ns={30:30,90:90,365:365,never:void 0},Ps={30:`expiresIn30Days`,90:`expiresIn90Days`,365:`expiresInAYear`,never:`neverExpires`},Fs=e=>lt(Date.parse(e)),Is=e=>e?q(Date.parse(e)<=Date.now()?`expiredOn`:`expiresOn`,{date:Fs(e)}):q(`neverExpires`),Ls=e=>[q(`createdOn`,{date:Fs(e.createdAt)}),Is(e.expiresAt),e.lastUsedAt?q(`lastUsedOn`,{date:Fs(e.lastUsedAt)}):q(`notUsedYet`),e.organization?q(`actsAsIn`,{role:e.role,organization:e.organization}):q(`actsAs`,{role:e.role})].join(` · `),Rs=({tokens:e,onCreate:t,onRevoke:n})=>{let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(),[s,c]=(0,Y.useState)(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(`90`),[p,m]=(0,Y.useState)(),h=()=>{c(void 0),o(void 0),m(void 0)},g=(0,Y.useRef)(!1),_=async e=>{if(!g.current){g.current=!0,i(!0),o(void 0);try{c(await e()),m(void 0)}catch(e){if(e instanceof TypeError)return o(q(`noAnswerFromServer`));if(!(e instanceof A))throw e;e.code===`STRONG_SIGN_IN_REQUIRED`?m(`asked`):o(I(e))}finally{g.current=!1,i(!1)}}},v=()=>_(async()=>{let e=Ns[d];return{kind:`created`,created:await t({name:l.trim(),...e!==void 0&&{expiresInDays:e}})}});return(0,X.jsxs)(z,{title:q(`accessTokens`),description:q(`accessTokensDescription`),children:[(0,X.jsx)(G,{message:s?void 0:a}),e.length===0?(0,X.jsx)(`p`,{className:`mb-3 text-muted-foreground`,children:q(`noAccessTokens`)}):(0,X.jsx)(`ul`,{className:`mb-3 divide-y rounded-md border`,children:e.map(e=>(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,X.jsx)(kr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`bdi`,{className:`block truncate font-medium`,children:e.name}),(0,X.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:Ls(e)})]}),(0,X.jsx)(H,{size:`sm`,variant:`ghost`,onClick:()=>c({kind:`revoke`,token:e}),children:q(`revoke`)})]},e.id))}),(0,X.jsxs)(H,{onClick:()=>{u(``),f(`90`),c({kind:`create`})},children:[(0,X.jsx)(we,{className:`size-3.5`}),q(`newAccessToken`)]}),s?.kind===`create`&&(0,X.jsxs)(R,{title:q(`newAccessToken`),description:q(`newAccessTokenDescription`),onClose:h,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{onClick:h,children:q(`cancel`)}),(0,X.jsx)(H,{variant:`primary`,loading:r,disabled:!l.trim(),onClick:()=>void v(),children:q(`createAccessToken`)})]}),children:[(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[q(`name`),(0,X.jsx)(k,{autoFocus:!0,value:l,maxLength:100,placeholder:q(`accessTokenNamePlaceholder`),onChange:e=>u(e.target.value)})]}),(0,X.jsxs)(`label`,{className:`mt-3 flex flex-col gap-1.5 font-medium`,children:[q(`accessTokenExpiry`),(0,X.jsx)(fn,{value:d,onChange:e=>f(e.target.value),children:Object.keys(Ns).map(e=>(0,X.jsx)(`option`,{value:e,children:q(Ps[e])},e))})]}),p===`asked`&&(0,X.jsx)(ot,{purpose:`change`,minutes:15,onConfirmed:()=>m(`done`)}),p===`done`&&(0,X.jsx)(`p`,{className:`mt-2 text-muted-foreground`,children:q(`confirmedCreateAccessToken`)}),(0,X.jsx)(G,{message:a})]}),s?.kind===`created`&&(0,X.jsx)(R,{title:q(`accessTokenCreated`,{name:s.created.personalAccessToken.name}),description:q(`accessTokenCreatedDescription`),onClose:h,actions:(0,X.jsx)(H,{variant:`primary`,onClick:h,children:q(`done`)}),children:(0,X.jsx)(Cr,{value:s.created.token,copyLabel:q(`copyAccessToken`)})}),s?.kind===`revoke`&&(0,X.jsx)(R,{title:q(`revokeAccessToken`,{name:s.token.name}),description:q(`revokeAccessTokenDescription`),onClose:h,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{onClick:h,children:q(`cancel`)}),(0,X.jsx)(H,{variant:`danger`,loading:r,onClick:()=>void _(async()=>(await n(s.token.id),void 0)),children:q(`revoke`)})]}),children:(0,X.jsx)(G,{message:a})})]})},zs=()=>{let{account:e}=M().session,{data:t,error:n,reload:r}=P((0,Y.useCallback)(()=>e.personalAccessTokens(),[e]),q(`couldNotReadAccessTokens`));return t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(G,{message:n}),(0,X.jsx)(Rs,{tokens:t,onCreate:t=>e.createPersonalAccessToken(t).then(e=>(r(),e),async e=>{throw await r(),e}),onRevoke:t=>e.revokePersonalAccessToken(t).finally(r)})]}):(0,X.jsx)(j,{error:n})},Bs=()=>M().personalAccessTokens?(0,X.jsx)(zs,{}):null,Vs={revoked:`disconnectedRevoked`,queued:`disconnectedQueued`,not_revoked:`disconnectedNotRevoked`},Hs=e=>e.provider===`google`,Us=({connections:e,onConnect:t,onDisconnect:n,error:r})=>{let[i,a]=(0,Y.useState)(),[o,s]=(0,Y.useState)(r),[c,l]=(0,Y.useState)(),[u,d]=(0,Y.useState)(),f=async(e,t)=>{a(e),s(void 0),d(void 0);try{await t(),l(void 0)}catch(e){if(!(e instanceof A))throw e;s(I(e))}finally{a(void 0)}};return(0,X.jsxs)(z,{title:q(`connections`),description:q(`connectionsDescription`),children:[(0,X.jsx)(G,{message:c?void 0:o}),(0,X.jsx)(Bt,{message:u}),(0,X.jsx)(`ul`,{className:`divide-y rounded-md border`,children:e.map(e=>(0,X.jsxs)(`li`,{className:`flex flex-col gap-2 px-3 py-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(Nr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.label}),(0,X.jsx)(H,{size:`sm`,loading:i===e.key,disabled:i!==void 0,onClick:()=>void f(e.key,()=>t(e)),children:e.accounts.length>0?q(`connectAgain`,{name:e.label}):q(`connect`,{name:e.label})})]}),e.accounts.map(t=>(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 pl-7 text-sm`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 text-muted-foreground`,children:[q(`connectedOn`,{date:lt(Date.parse(t.created_at))}),` · `,(0,X.jsx)(`code`,{className:`text-xs`,children:t.id})]}),t.needs_sign_in?(0,X.jsx)(W,{tone:`amber`,children:q(`connectionNeedsSignIn`)}):(0,X.jsx)(W,{tone:`green`,children:q(`connected`)}),(0,X.jsx)(H,{size:`sm`,variant:`ghost`,onClick:()=>l({connection:e,accountId:t.id}),children:q(`disconnect`)})]}),t.used_by.length>0&&(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 pl-7 text-sm`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:q(`connectionUsedBy`)}),t.used_by.map(e=>(0,X.jsx)(qt,{resource:`workflows`,recordKey:e.id,className:`font-medium text-primary-text hover:underline`,children:e.name},e.id))]})]},t.id))]},e.key))}),c&&(0,X.jsx)(R,{title:q(`disconnectTitle`,{name:c.connection.label}),description:Hs(c.connection)?`${q(`disconnectDescription`)} ${q(`disconnectWholeGrant`)}`:q(`disconnectDescription`),onClose:()=>l(void 0),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{onClick:()=>l(void 0),children:q(`cancel`)}),(0,X.jsx)(H,{variant:`danger`,loading:i===c.accountId,onClick:()=>void f(c.accountId,async()=>d(q(Vs[await n(c.accountId)]))),children:q(`disconnect`)})]}),children:o&&(0,X.jsx)(G,{message:o})})]})},Ws=()=>{let{session:e,connectAccount:t}=M(),{account:n}=e,[r]=(0,Y.useState)(Le),{data:i,error:a,reload:o}=P((0,Y.useCallback)(()=>n.workflowConnections(),[n]),q(`couldNotReadMethods`));return i?i.length===0?null:(0,X.jsx)(Us,{connections:i,onConnect:t,onDisconnect:e=>n.disconnectAccount(e).finally(o),error:r&&Wt(r,q(`theProvider`))}):(0,X.jsx)(j,{error:a})},Gs=e=>e.code===`LAST_ADMIN`?q(`deleteAccountLastAdmin`):e.code===`ACCOUNT_LOCKED`?q(`deleteAccountLocked`):I(e),Ks=({hasPassword:e,onDelete:t,onClose:n})=>{let[r,i]=(0,Y.useState)(``),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(),[l,u]=(0,Y.useState)(!1),d=(0,Y.useId)(),f=async()=>{o(!0),c(void 0),u(!1);try{await t(e?r:void 0)}catch(e){if(!(e instanceof A))throw e;e.code===`STRONG_SIGN_IN_REQUIRED`?u(!0):c(Gs(e)),o(!1)}};return(0,X.jsxs)(R,{title:q(`deleteAccountQuestion`),description:q(`deleteAccountWarning`),onClose:n,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{onClick:n,children:q(`cancel`)}),(0,X.jsx)(H,{variant:`danger`,type:`submit`,form:d,loading:a,disabled:e&&!r,children:q(`deleteAccountConfirm`)})]}),children:[(0,X.jsxs)(`form`,{id:d,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),f()},children:[e&&(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[q(`deleteAccountPassword`),(0,X.jsx)(k,{type:`password`,name:`current-password`,autoComplete:`current-password`,autoFocus:!0,value:r,invalid:!!s,onChange:e=>i(e.target.value)})]}),(0,X.jsx)(G,{message:s})]}),l&&(0,X.jsx)(ot,{purpose:`change`,minutes:15,onConfirmed:()=>void f()})]})},qs=({hasPassword:e,staff:t,onDelete:n})=>{let[r,i]=(0,Y.useState)(!1);return(0,X.jsxs)(z,{title:q(`deleteAccount`),description:q(t?`deleteAccountStaff`:`deleteAccountDescription`),children:[!t&&(0,X.jsx)(H,{variant:`danger`,onClick:()=>i(!0),children:q(`deleteAccount`)}),r&&(0,X.jsx)(Ks,{hasPassword:e,onDelete:n,onClose:()=>i(!1)})]})},Js=()=>{let{session:e,state:t,deleteAccount:n}=M(),{account:r}=e,{data:i,error:a}=P((0,Y.useCallback)(()=>r.signInMethods(),[r]),q(`couldNotReadMethods`));return i?(0,X.jsx)(qs,{hasPassword:i.account.password,staff:t.kind===`signed-in`&&!!t.staff,onDelete:n}):(0,X.jsx)(j,{error:a})},Ys=[[/Edg(e|A|iOS)?\//,`Edge`],[/OPR\/|Opera/,`Opera`],[/SamsungBrowser\//,`Samsung Internet`],[/Firefox\/|FxiOS\//,`Firefox`],[/Chrome\/|CriOS\//,`Chrome`],[/Safari\//,`Safari`]],Xs=[[/iPhone/,`iPhone`],[/iPad/,`iPad`],[/Android/,`Android`],[/CrOS/,`ChromeOS`],[/Windows/,`Windows`],[/Mac OS X|Macintosh/,`macOS`],[/Linux/,`Linux`]],Zs=(e,t)=>e.find(([e])=>e.test(t))?.[1],Qs=e=>e?{browser:Zs(Ys,e),system:Zs(Xs,e)}:{},$s=e=>e.device?q(`deviceThrough`,{device:e.device,provider:e.name}):e.name,ec=(e,t)=>{if(e.staff)return t?q(`staffOf`,{operator:t}):q(`staff`);let{browser:n,system:r}=Qs(e.userAgent);return n&&r?q(`browserOn`,{browser:n,system:r}):r?q(`aBrowserOn`,{system:r}):n??q(`unknownDevice`)},tc=e=>{if(e.staff)return Fr;let{system:t}=Qs(e.userAgent);return t===`iPhone`||t===`Android`?Lr:t===`iPad`?zr:jr},nc=e=>[...e].sort((e,t)=>Number(t.current)-Number(e.current)||t.createdAt.localeCompare(e.createdAt)),rc=(e,t)=>e.kind===`one`?q(`signOutDevice`,{name:ec(e.session,t)}):e.kind===`link`?q(`signOutDevice`,{name:$s(e.link)}):q(`signOutOthersTitle`),ic=e=>q(e.kind===`one`?`signOutDeviceDescription`:e.kind===`link`?`signOutLinkedDeviceDescription`:`signOutOthersDescription`),ac=({sessions:e,operator:t,links:n=[],onSignOut:r,onSignOutOthers:i,onSignOutLink:a})=>{let[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(),[u,d]=(0,Y.useState)(),f=e.filter(e=>!n.some(t=>t.sessions.includes(e.token))),p=e.filter(e=>!e.current),m=e=>e.kind===`one`?r(e.session.token):e.kind===`link`?a(e.link.id):i(),h=async e=>{s(!0),l(void 0);try{await m(e),d(void 0)}catch(e){if(!(e instanceof A))throw e;l(I(e))}s(!1)},g=e=>{l(void 0),d(e)};return(0,X.jsxs)(z,{title:q(`devices`),description:q(`devicesDescription`),children:[f.length===0&&n.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:q(`noDevices`)}):(0,X.jsxs)(`ul`,{className:`divide-y rounded-md border`,children:[nc(f).map(e=>{let n=tc(e);return(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,X.jsx)(n,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`bdi`,{className:`truncate font-medium`,children:ec(e,t)}),e.current&&(0,X.jsx)(W,{tone:`green`,children:q(`thisDevice`)})]}),(0,X.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[q(`signedInFromUntil`,{from:tn(Date.parse(e.createdAt)),until:tn(Date.parse(e.expiresAt))}),!e.staff&&e.ipAddress&&` · ${e.ipAddress}`]})]}),!e.current&&(0,X.jsx)(H,{size:`sm`,variant:`ghost`,onClick:()=>g({kind:`one`,session:e}),children:q(`signOut`)})]},e.token)}),n.map(t=>{let n=e.some(e=>e.current&&t.sessions.includes(e.token));return(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,X.jsx)(Lr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`bdi`,{className:`truncate font-medium`,children:$s(t)}),n&&(0,X.jsx)(W,{tone:`green`,children:q(`thisDevice`)})]}),(0,X.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:q(`linkedOn`,{date:tn(Date.parse(t.linkedAt))})})]}),!n&&a&&(0,X.jsx)(H,{size:`sm`,variant:`ghost`,onClick:()=>g({kind:`link`,link:t}),children:q(`signOut`)})]},t.id)})]}),p.length>0&&(0,X.jsx)(H,{className:`mt-3`,onClick:()=>g({kind:`others`}),children:q(`signOutOthers`)}),u&&(0,X.jsx)(R,{title:rc(u,t),description:ic(u),onClose:()=>d(void 0),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{onClick:()=>d(void 0),children:q(`cancel`)}),(0,X.jsx)(H,{variant:`danger`,loading:o,onClick:()=>void h(u),children:q(`signOut`)})]}),children:(0,X.jsx)(G,{message:c})})]})},oc=()=>{let{session:e,staffSignIn:t,deviceLinks:n}=M(),{account:r}=e,i=(0,Y.useCallback)(async()=>{let[e,t]=await Promise.all([r.sessions(),n?r.deviceLinks():[]]);return{sessions:e,links:t}},[r,n]),{data:a,error:o,reload:s}=P(i,q(`couldNotReadDevices`));return a?(0,X.jsx)(ac,{sessions:a.sessions,links:a.links,operator:t,onSignOut:e=>r.revokeSession(e).then(s),onSignOutOthers:()=>r.revokeOtherSessions().then(s),onSignOutLink:e=>r.signOutDeviceLink(e).then(s)}):(0,X.jsx)(j,{error:o})},sc={allowed:`passkeysAllowed`,required:`passkeysRequired`,forbidden:`passkeysForbidden`},cc=({rule:e,passkeys:t,onAdd:n,onRename:r,onRemove:i})=>{let[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(),[l,u]=(0,Y.useState)(),[d,f]=(0,Y.useState)(``),[p,m]=(0,Y.useState)(),h=e===`required`&&t.length<=1,g=async e=>{o(!0),c(void 0),m(void 0);try{await e(),u(void 0)}catch(e){if(!(e instanceof A))throw e;e.code===`STRONG_SIGN_IN_REQUIRED`?m(`asked`):c(I(e))}o(!1)};return(0,X.jsxs)(z,{title:q(`passkeys`),status:e===`required`&&(0,X.jsx)(W,{tone:`blue`,children:q(`required`)}),description:q(sc[e]),children:[(0,X.jsx)(G,{message:l?void 0:s}),t.length>0&&(0,X.jsx)(`ul`,{className:`mb-3 divide-y rounded-md border`,children:t.map(e=>(0,X.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,X.jsx)(Ot,{className:`size-4 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block truncate font-medium`,children:e.name??q(`passkey`)}),(0,X.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[e.createdAt?q(`addedOn`,{date:lt(Date.parse(e.createdAt))}):q(`addedEarlier`),` · `,e.backedUp?q(`synced`):q(`oneDevice`)]})]}),(0,X.jsxs)(`span`,{className:`flex gap-1`,children:[(0,X.jsx)(H,{size:`sm`,variant:`ghost`,onClick:()=>{f(e.name??``),u({kind:`rename`,passkey:e})},children:q(`rename`)}),(0,X.jsx)(H,{size:`sm`,variant:`ghost`,disabled:h,title:h?q(`keepLastPasskey`):void 0,onClick:()=>u({kind:`remove`,passkey:e}),children:q(`remove`)})]})]},e.id))}),e!==`forbidden`&&(0,X.jsxs)(H,{loading:a&&!l,onClick:()=>void g(n),children:[(0,X.jsx)(we,{className:`size-3.5`}),q(`addPasskey`)]}),p===`asked`&&(0,X.jsx)(ot,{purpose:`change`,withPassword:!0,minutes:15,onConfirmed:()=>m(`done`)}),p===`done`&&(0,X.jsx)(`p`,{className:`mt-2 text-muted-foreground`,children:q(`confirmedAddPasskey`)}),l?.kind===`rename`&&(0,X.jsxs)(R,{title:q(`renamePasskey`),description:q(`renamePasskeyDescription`),onClose:()=>u(void 0),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{onClick:()=>u(void 0),children:q(`cancel`)}),(0,X.jsx)(H,{variant:`primary`,loading:a,disabled:!d.trim(),onClick:()=>void g(()=>r(l.passkey.id,d.trim())),children:q(`save`)})]}),children:[(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[q(`name`),(0,X.jsx)(k,{autoFocus:!0,value:d,maxLength:60,onChange:e=>f(e.target.value)})]}),(0,X.jsx)(G,{message:s})]}),l?.kind===`remove`&&(0,X.jsx)(R,{title:q(`removePasskey`),description:q(`removePasskeyDescription`,{name:l.passkey.name??q(`thisPasskey`)}),onClose:()=>u(void 0),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{onClick:()=>u(void 0),children:q(`cancel`)}),(0,X.jsx)(H,{variant:`danger`,loading:a,onClick:()=>void g(()=>i(l.passkey.id)),children:q(`remove`)})]}),children:s&&(0,X.jsx)(G,{message:s})})]})},lc=()=>{let{account:e}=M().session,t=(0,Y.useCallback)(()=>Promise.all([e.signInMethods(),e.passkeys()]),[e]),{data:n,error:r,reload:i}=P(t,q(`couldNotReadMethods`));if(!n)return(0,X.jsx)(j,{error:r});let[a,o]=n;return(0,X.jsx)(cc,{rule:a.policy.passkey,passkeys:o,onAdd:()=>e.addPasskey().then(i),onRename:(t,n)=>e.renamePasskey(t,n).then(i),onRemove:t=>e.removePasskey(t).then(i)})},uc=e=>e.code===`PASSWORD_TOO_SHORT`?q(`useAtLeast`,{length:12}):e.code===`PASSWORD_TOO_LONG`?q(`passwordTooLong`):I(e),dc=(e,t)=>{if(e.length<12)return q(`useAtLeast`,{length:12});if(e!==t)return q(`passwordsDiffer`)},fc=({hasPassword:e,onSave:t,onClose:n})=>{let[r,i]=(0,Y.useState)(``),[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(),p=(0,Y.useId)(),m=(!e||r)&&a&&s,h=async()=>{let e=dc(a,s);if(f(e),!e){u(!0);try{await t({current:r,next:a})}catch(e){if(!(e instanceof A))throw e;f(uc(e)),u(!1)}}};return(0,X.jsx)(R,{title:q(e?`changePassword`:`setPassword`),description:q(`atLeast`,{length:12}),onClose:n,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{onClick:n,children:q(`cancel`)}),(0,X.jsx)(H,{variant:`primary`,type:`submit`,form:p,loading:l,disabled:!m,children:q(`save`)})]}),children:(0,X.jsxs)(`form`,{id:p,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),h()},children:[e&&(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[q(`currentPassword`),(0,X.jsx)(k,{type:`password`,name:`current-password`,autoComplete:`current-password`,autoFocus:!0,value:r,onChange:e=>i(e.target.value)})]}),(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[q(`newPassword`),(0,X.jsx)(k,{type:`password`,name:`new-password`,autoComplete:`new-password`,autoFocus:!e,value:a,invalid:!!d,onChange:e=>o(e.target.value)})]}),(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[q(`repeatPassword`),(0,X.jsx)(k,{type:`password`,name:`repeat-password`,autoComplete:`new-password`,value:s,invalid:!!d,onChange:e=>c(e.target.value)})]}),e&&(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:q(`changeSignsOutOthers`)}),(0,X.jsx)(G,{message:d})]})})},pc=({rule:e,hasPassword:t,staff:n})=>q(n?`passwordStaff`:e===`forbidden`?`passwordForbidden`:t?`passwordIsSet`:`passwordNotSet`),mc=({rule:e,hasPassword:t,staff:n,onChange:r,onSet:i})=>{let[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(!1),l=!n&&e===`allowed`;return(0,X.jsxs)(z,{title:q(`password`),description:pc({rule:e,hasPassword:t,staff:n}),children:[(0,X.jsx)(Bt,{message:s?q(`passwordSaved`):void 0}),l&&(0,X.jsx)(H,{onClick:()=>{c(!1),o(!0)},children:q(t?`changePassword`:`setPassword`)}),a&&(0,X.jsx)(fc,{hasPassword:t,onClose:()=>o(!1),onSave:async({current:e,next:n})=>{await(t?r(e,n):i(n)),o(!1),c(!0)}})]})},hc=()=>{let{session:e,state:t}=M(),{account:n}=e,{data:r,error:i,reload:a}=P((0,Y.useCallback)(()=>n.signInMethods(),[n]),q(`couldNotReadMethods`));return r?(0,X.jsx)(mc,{rule:r.policy.password,hasPassword:r.account.password,staff:t.kind===`signed-in`&&!!t.staff,onChange:(e,t)=>n.changePassword(e,t).then(a),onSet:e=>n.setPassword(e).then(a)}):(0,X.jsx)(j,{error:i})},gc=({email:e,change:t,onDone:n,onClose:r})=>{let[i,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(),m=async e=>{d(!0),p(void 0);try{await e()}catch(e){if(!(e instanceof A))throw e;p(I(e))}d(!1)},h=i.trim(),g=()=>m(async()=>{await t.request(h),l(``),s(h)}),_=e=>m(async()=>{await t.confirm(o,e),n()});return o?(0,X.jsxs)(R,{title:q(`changeEmail`),description:q(`codeSentTo`,{email:o,minutes:10}),onClose:r,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{variant:`ghost`,onClick:()=>{s(void 0),p(void 0)},children:q(`otherAddress`)}),(0,X.jsx)(H,{variant:`primary`,loading:u,disabled:c.length<6,onClick:()=>void _(c),children:q(`changeEmail`)})]}),children:[(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[q(`code`),(0,X.jsx)(ln,{name:`code`,required:!0,autoFocus:!0,value:c,invalid:!!f,onChange:l,onComplete:e=>!u&&void _(e)})]}),(0,X.jsx)(G,{message:f})]}):(0,X.jsxs)(R,{title:q(`changeEmail`),description:q(`changeEmailDescription`),onClose:r,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{onClick:r,children:q(`cancel`)}),(0,X.jsx)(H,{variant:`primary`,loading:u,disabled:!h||h.toLowerCase()===e.toLowerCase(),onClick:()=>void g(),children:q(`sendCode`)})]}),children:[(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[q(`newEmail`),(0,X.jsx)(k,{type:`email`,autoComplete:`email`,autoFocus:!0,value:i,onChange:e=>a(e.target.value)})]}),(0,X.jsx)(G,{message:f})]})},_c=({name:e,email:t,onRename:n,emailChange:r,onEmailChanged:i})=>{let[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(),h=async()=>{f(!0),m(void 0);try{await n(l.trim()),o(!1)}catch(e){if(!(e instanceof A))throw e;m(I(e))}f(!1)};return(0,X.jsxs)(z,{title:q(`profile`),description:q(`profileDescription`),children:[(0,X.jsxs)(`dl`,{className:`mb-3 grid grid-cols-[auto_1fr] gap-x-6 gap-y-1.5`,children:[(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:q(`name`)}),(0,X.jsx)(`dd`,{className:`min-w-0 truncate font-medium`,children:e}),(0,X.jsx)(`dt`,{className:`text-muted-foreground`,children:q(`email`)}),(0,X.jsx)(`dd`,{className:`min-w-0 truncate font-medium`,children:t})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(H,{onClick:()=>{u(e),m(void 0),o(!0)},children:q(`changeName`)}),r&&(0,X.jsx)(H,{onClick:()=>c(!0),children:q(`changeEmail`)})]}),a&&(0,X.jsxs)(R,{title:q(`changeName`),description:q(`changeNameDescription`),onClose:()=>o(!1),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{onClick:()=>o(!1),children:q(`cancel`)}),(0,X.jsx)(H,{variant:`primary`,loading:d,disabled:!l.trim()||l.trim()===e,onClick:()=>void h(),children:q(`save`)})]}),children:[(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[q(`name`),(0,X.jsx)(k,{autoFocus:!0,value:l,maxLength:100,onChange:e=>u(e.target.value)})]}),(0,X.jsx)(G,{message:p})]}),s&&r&&(0,X.jsx)(gc,{email:t,change:r,onClose:()=>c(!1),onDone:()=>{c(!1),i?.()}})]})},vc=()=>{let{session:e,changeEmail:t}=M(),{data:n,loaded:r,error:i,reload:a}=P((0,Y.useCallback)(()=>e.session(),[e]),q(`couldNotReadProfile`));if(!r)return(0,X.jsx)(j,{error:i});if(!n)return null;let o=t?{request:e.account.requestEmailChange,confirm:e.account.changeEmail}:void 0;return(0,X.jsx)(_c,{name:n.name,email:n.email,onRename:t=>e.account.updateName(t).then(a),emailChange:o,onEmailChanged:a})},yc=({title:e,description:t,confirmLabel:n,danger:r,needsPassword:i,onConfirm:a,onClose:o})=>{let[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(),[p,m]=(0,Y.useState)(!1),h=async()=>{u(!0),f(void 0),m(!1);try{await a(i?s:void 0)}catch(e){if(!(e instanceof A))throw e;e.code===`STRONG_SIGN_IN_REQUIRED`?m(!0):f(I(e)),u(!1)}};return(0,X.jsxs)(R,{title:e,description:t,onClose:o,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{onClick:o,children:q(`cancel`)}),(0,X.jsx)(H,{variant:r?`danger`:`primary`,loading:l,disabled:i&&!s,onClick:()=>void h(),children:n})]}),children:[i&&(0,X.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[q(`yourPassword`),(0,X.jsx)(k,{type:`password`,autoComplete:`current-password`,autoFocus:!0,value:s,invalid:!!d,onChange:e=>c(e.target.value),onKeyDown:e=>e.key===`Enter`&&s&&void h()})]}),d&&(0,X.jsx)(`p`,{role:`alert`,className:`mt-2 text-body font-medium text-danger-text`,children:d}),p&&(0,X.jsx)(ot,{purpose:`change`,minutes:15,onConfirmed:()=>void h()})]})},bc={allowed:`twoFactorAllowed`,required:`twoFactorRequired`,forbidden:`twoFactorForbidden`},xc=e=>{let{rule:t,enabled:n,authenticatorApp:r,mail:i,needsPassword:a,onTurnOff:o,onNewBackupCodes:s,onChanged:c}=e,[l,u]=(0,Y.useState)(),d=()=>u(void 0),f=n?(0,X.jsx)(W,{tone:`green`,children:q(`on`)}):t===`required`?(0,X.jsx)(W,{tone:`amber`,children:q(`required`)}):(0,X.jsx)(W,{children:q(`off`)}),p=q(n?r?i?`twoFactorOnWithAppOrMail`:`twoFactorOnWithApp`:`twoFactorOnWithMail`:bc[t]);return l?.kind===`setup`?(0,X.jsx)(z,{title:q(`twoFactor`),status:f,description:p,children:(0,X.jsx)(`div`,{className:`max-w-sm`,children:(0,X.jsx)(it,{offerEmailedCodes:i&&!l.appOnly,needsPassword:a,onStartApp:e.onStartApp,onConfirmApp:e.onConfirmApp,onEmailedCodes:e.onEmailedCodes,onCancel:d,onDone:()=>{d(),c()}})})}):(0,X.jsxs)(z,{title:q(`twoFactor`),status:f,description:p,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[!n&&t!==`forbidden`&&(0,X.jsx)(H,{variant:`primary`,onClick:()=>u({kind:`setup`,appOnly:!1}),children:q(`turnOn`)}),n&&!r&&t!==`forbidden`&&(0,X.jsx)(H,{onClick:()=>u({kind:`setup`,appOnly:!0}),children:q(`addAuthenticator`)}),n&&r&&(0,X.jsx)(H,{onClick:()=>u({kind:`new-codes`}),children:q(`newBackupCodes`)}),n&&(0,X.jsx)(H,{variant:`danger`,disabled:t===`required`,title:t===`required`?q(`twoFactorIsRequired`):void 0,onClick:()=>u({kind:`turn-off`}),children:q(`turnOff`)})]}),l?.kind===`turn-off`&&(0,X.jsx)(yc,{title:q(`turnOffTitle`),description:q(`turnOffDescription`),confirmLabel:q(`turnOff`),danger:!0,needsPassword:a,onClose:d,onConfirm:async e=>{await o(e),d(),c()}}),l?.kind===`new-codes`&&(0,X.jsx)(yc,{title:q(`newCodesTitle`),description:q(`newCodesDescription`),confirmLabel:q(`makeNewCodes`),needsPassword:a,onClose:d,onConfirm:async e=>u({kind:`codes`,codes:await s(e)})}),l?.kind===`codes`&&(0,X.jsx)(R,{title:q(`yourNewCodes`),description:q(`keepCodesSafe`),onClose:d,actions:(0,X.jsx)(H,{variant:`primary`,onClick:d,children:q(`savedCodes`)}),children:(0,X.jsx)(Mt,{codes:l.codes})})]})},Sc=()=>{let{account:e}=M().session,{data:t,error:n,reload:r}=P((0,Y.useCallback)(()=>e.signInMethods(),[e]),q(`couldNotReadMethods`));return t?(0,X.jsx)(xc,{rule:t.policy.twoFactor,enabled:t.account.twoFactor,authenticatorApp:t.account.authenticatorApp,mail:t.mail,needsPassword:t.account.password,onStartApp:t=>e.startAuthenticatorApp(t),onConfirmApp:t=>e.confirmAuthenticatorApp(t),onEmailedCodes:t=>e.turnOnEmailedCodes(t),onTurnOff:t=>e.turnOffTwoFactor(t),onNewBackupCodes:t=>e.newBackupCodes(t),onChanged:r}):(0,X.jsx)(j,{error:n})},Cc=({problem:e,fallback:t})=>t===void 0?(0,X.jsx)(He,{children:e}):(0,X.jsxs)(X.Fragment,{children:[!1,t]}),wc=({name:e,registered:t,fallback:n,children:r})=>t?(0,X.jsx)(ze,{name:e,fallback:n===void 0?void 0:(0,X.jsx)(Cc,{problem:N.rich(`couldNotDraw`,{name:e}),fallback:n}),children:r}):(0,X.jsx)(Cc,{problem:N.rich(`noComponent`,{component:e}),fallback:n}),Tc={Page:Fa,Grid:da,Card:ii,Stat:bo,RecordCard:za,Field:oa,Diff:ra,Table:To,CardRow:ci,RecordRow:io,RecordCards:eo,Chart:li,Timeline:Ji,Graph:Qi,Progress:La,Image:ya,ModalForm:Pa,Thread:Qo,Composer:ea,Action:ri,Show:po,Switch:ho,Match:go,Link:ka,Settings:co,Tabs:Do,Tab:Oo,Users:vs,Profile:vc,Password:hc,Passkeys:lc,TwoFactor:Sc,ConnectedAccounts:Be,PersonalMail:ws,Connections:Ws,Devices:oc,ConnectedApps:Ms,PersonalAccessTokens:Bs,DeleteAccount:Js,Box:$o,Row:es,Column:ts,Text:ns,ReferenceManyField:ss,ReferenceArrayField:ls,ArrayField:rs,RecordsIterator:oi,ReferenceField:ds,SelectInput:is,Details:ta,Summary:na,TextField:Sa,NumberField:Ca,DateField:wa,BooleanField:Ta,UrlField:Ea,ChipField:Da},Ec=new Set(`Page.Grid.Card.Stat.RecordCard.Field.Diff.Table.CardRow.RecordRow.RecordCards.Chart.Timeline.Graph.Progress.Image.Thread.Link.Tabs.Settings.Show.Switch.Action.Box.Row.Column.Text.ReferenceField.SelectInput.Details.Summary.TextField.NumberField.DateField.BooleanField.UrlField.ChipField`.split(`.`)),Dc=(e,t,...n)=>e.map((e,r)=>({child:e,...t!==void 0&&{at:ve(t,...n,r)}})),Oc=({text:e})=>{let t=B(),n=Qt(),r={...U(t),params:n};return(0,X.jsx)(X.Fragment,{children:Fe(e,e=>Ue(de(r,e)))})},kc=(e,t)=>e.includes(`{{`)?(0,X.jsx)(Oc,{text:e},t):(0,X.jsx)(Y.Fragment,{children:e},t),Ac=e=>e.map(({child:e,at:t},n)=>typeof e==`string`?kc(e,n):(0,X.jsx)(Lc,{node:e,at:t},n)),jc=e=>{let t=[];for(let n of e){let e=t.at(-1);Ur(n.child)&&e&&Ur(e[0].child)?e.push(n):t.push([n])}return t.map((e,t)=>{let[n]=e;return Ur(n.child)?(0,X.jsx)(`p`,{className:`leading-6`,children:Ac(e)},t):(0,X.jsx)(Lc,{node:n.child,at:n.at},t)})},Mc=e=>Ve(e)||Array.isArray(e)&&e.length>0&&e.every(Ve),Nc=(e,t)=>Object.fromEntries(Object.entries(e.props).flatMap(([e,n])=>Mc(n)?[[e,(0,X.jsx)(X.Fragment,{children:jc(Pc(n,t,e))})]]:[])),Pc=(e,t,n)=>Array.isArray(e)?Dc(e,t,`props`,n):[{child:e,...t!==void 0&&{at:ve(t,`props`,n)}}],Fc=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ic=(e,t)=>{let n=Fc(e.props.components)?e.props.components:{},r=Object.fromEntries(Object.entries(n).flatMap(([e,t])=>Ve(t)?[[e,e=>({...t,children:[...t.children,...e]})]]:[])),i=At(t,String(e.props.i18nKey),Fc(e.props.values)?e.props.values:{},r);return Array.isArray(i)?i.map(e=>typeof e==`string`||Ve(e)?e:String(e)):[i]},Lc=({node:e,at:t})=>{let{components:n}=se(),r=B(),i=Qt(),a=ct(),o=(0,Y.useMemo)(()=>pt(s(e,{...U(r),params:i}),a),[e,r,i,a]);if(o.type===`Trans`&&!o.custom)return(0,X.jsx)(X.Fragment,{children:Ac(Ic(o,a).map(e=>({child:e})))});if(o.custom){let e=n?.[o.type],r=o.children.length>0?(0,X.jsx)(Yi,{node:o,children:jc(Dc(o.children,t,`children`))}):void 0;return(0,X.jsx)(wc,{name:o.type,registered:!!e,fallback:o.fallback&&(0,X.jsx)(X.Fragment,{children:jc(Dc(o.fallback,t,`fallback`))}),children:e&&(0,X.jsx)(xe,{node:o,...t!==void 0&&{at:t},children:(0,X.jsx)(e,{...ce(o.props),children:r})})})}let c=Tc[o.type];if(!c)return(0,X.jsx)(He,{children:N.rich(`unknownBlock`,{type:o.type})});let l=typeof o.props.className==`string`?o.props.className:void 0,u=Dc(o.children,t,`children`),d=(0,X.jsx)(c,{node:o,at:t,slots:Nc(o,t),className:l,children:o.type===`Text`||o.type===`Link`||o.type===`Summary`?Ac(u):jc(o.type===`Switch`?u.filter(({child:e})=>typeof e!=`string`):u)}),f=l===void 0||Ec.has(o.type)?d:(0,X.jsx)(`div`,{className:l,children:d});return o.fallback?(0,X.jsx)(ze,{name:o.type,resetKey:o,fallback:(0,X.jsx)(X.Fragment,{children:jc(Dc(o.fallback,t,`fallback`))}),children:f}):f};export{Jo as a,Io as c,Qa as d,Ua as f,Xo as i,xo as l,$i as m,wc as n,qo as o,Ba as p,Zo as r,Go as s,Lc as t,lo as u};
3
+ //# debugId=ad6598cb-1b19-4c72-98f1-258fbb038c12
@@ -0,0 +1,2 @@
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$l as r,$n as i,Ba as a,Da as o,Ea as s,Hc as c,La as l,Qs as u,Ur as d,Za as f,Zr as p,Zs as m,bn as h,cn as g,cs as _,dc as v,er as y,fl as b,hl as x,hs as S,nl as C,pc as w,qc as T,ri as E,rl as D,tu as O,uc as k,xi as A,yl as j,yr as M}from"./app-2d0YQdR7.js";import{h as N,o as P}from"./vendor-t7Q7QbPu.js";import{Q as F}from"./embedded-list-BIvBUQCm.js";import{n as I}from"./lib-dnd-kit-sortable-CNDSKqCD.js";import{a as L,i as R,n as z,o as B,r as ee,s as V,t as H}from"./messages-BaKmueMc.js";var U={name:`arrow-up-down`,size:24,node:[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]};U.node;var W=T(U),G={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};G.node;var K=T(G),q=e(t(),1),J=D(`app/delete`),Y=r(),X=({blockingPlural:e,noun:t})=>J(`stillPointAt`,{plural:e,noun:t}),Z=({blockedBy:e,resources:t,views:n,noun:r,key:i})=>{let{resource:a,field:o}=e;if(!t[a])return;let s=n[a]?.names?.plural??x(a),c=X({blockingPlural:s,noun:r});if(!o||i===void 0)return{text:c};let l={kind:`list`,resource:a,filter:O(Y.eq(o,i))};return{text:c,link:{label:J(`show`,{plural:s}),to:l}}},Q=e(n(),1),te=({title:e,noun:t,busy:n,onConfirm:r,onCancel:i})=>(0,Q.jsx)(v,{title:J(`confirmTitle`,{title:e}),description:J(`confirmDescription`,{noun:t,title:e}),onClose:i,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(w,{onClick:i,children:J(`cancel`)}),(0,Q.jsx)(w,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,loading:n,onClick:r,children:J(`delete`)})]})}),ne=({title:e,changes:t,busy:n,onReview:r,onDeleteAnyway:i,onCancel:a})=>(0,Q.jsx)(v,{title:J(`changedTitle`,{title:e}),description:J(`changedDescription`),onClose:a,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(w,{onClick:r,children:J(`reviewChanges`)}),(0,Q.jsx)(w,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,loading:n,onClick:i,children:J(`deleteAnyway`)})]}),children:t.length===0?(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:J(`noVisibleChanges`)}):(0,Q.jsx)(`ul`,{className:`divide-y rounded-md border`,children:t.map(e=>(0,Q.jsxs)(`li`,{className:`grid grid-cols-[96px_1fr] gap-3 px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:e.label}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground line-through`,children:e.before}),` `,(0,Q.jsx)(`span`,{className:`font-medium`,children:e.after})]})]},e.field))})}),$=e=>{if(e.stage===`confirm`)return(0,Q.jsx)(v,{title:J(`bulkConfirmTitle`,{count:e.count,noun:e.noun,plural:e.plural}),description:J(`bulkConfirmDescription`),onClose:e.onCancel,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(w,{onClick:e.onCancel,children:J(`cancel`)}),(0,Q.jsx)(w,{variant:`primary`,className:`bg-danger hover:bg-danger/90`,onClick:e.onConfirm,children:J(`deleteCount`,{count:e.count})})]})});if(e.stage===`running`)return(0,Q.jsx)(v,{title:J(`deleting`),description:J(`progress`,{done:e.done,total:e.total}),onClose:()=>void 0,actions:(0,Q.jsx)(w,{loading:!0,disabled:!0,children:J(`working`)})});let t=e.total-e.failures.length;return(0,Q.jsx)(v,{title:e.failures.length===0?J(`deleted`,{count:t}):J(`deletedOf`,{count:t,total:e.total}),description:e.failures.length===0?void 0:J(`kept`,{count:e.failures.length}),onClose:e.onClose,actions:(0,Q.jsx)(w,{variant:`primary`,onClick:e.onClose,children:J(`done`)}),children:e.failures.length>0&&(0,Q.jsx)(`ul`,{className:`max-h-48 divide-y overflow-y-auto rounded-md border`,children:e.failures.map(e=>(0,Q.jsxs)(`li`,{className:`px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:e.title}),(0,Q.jsx)(`span`,{className:`block text-xs text-danger-text`,children:e.message})]},e.title))})})},re=new Set([`updated_at`,`updatedAt`]),ie=(e,t,n,r)=>Object.values(e.fields).flatMap(e=>{if(re.has(e.name)||JSON.stringify(n[e.name]??null)===JSON.stringify(r[e.name]??null))return[];let i=t?.fields[e.name];return[{field:e.name,label:i?.label??x(e.name),before:A(e,n[e.name],i),after:A(e,r[e.name],i)}]}),ae=4,oe=({model:e,view:t,onDeleted:n,onReview:r,restore:i})=>{let o=S(),s=N(),c=a(),[l,f]=(0,q.useState)(),[p,h]=(0,q.useState)(!1),g=t?.names?.singular??x(e.name),v=t?.names?.plural??x(e.name),{resources:y,views:b}=_(),{href:C,open:w}=d(),T=(t,n)=>t.blockedBy&&Z({blockedBy:t.blockedBy,resources:y,views:b,noun:g,...e.primaryKey.length===1&&{key:n.key}}),E=()=>{for(let t of[`page`,`list`,`first-page`,`map`])s.invalidateQueries({queryKey:[t,e.name]});for(let t of[`facets`,`series`,`aggregate`,`histogram`,`count`])s.invalidateQueries({queryKey:[t,e.name]})},D=async(t,n)=>{let r=n??(await o.get(e.name,t.key)).etag;try{await o.remove(e.name,t.key,{etag:r})}catch(e){if(!(e instanceof m))throw e;return e}},O=t=>{E(),f(void 0),n?.(t),c.show({state:`success`,title:J(`deletedToast`,{title:t.title}),...e.softDelete&&i&&{action:{label:J(`undo`),onClick:()=>{i(t).then(()=>{E(),c.show({state:`success`,title:J(`restored`,{title:t.title})})},e=>{if(!u(e))throw e;E(),c.show({state:e.status===409?`success`:`error`,title:e.status===409?J(`alreadyBack`,{title:t.title}):J(`couldNotRestore`,{title:t.title}),description:e.status===409?void 0:e.message})})}}}})},k=async(n,r)=>{h(!0);try{if(!await D(n,r))return O(n);let i=(await o.get(e.name,n.key)).record;f({kind:`conflict`,target:n,fresh:i,changes:ie(e,t,n.snapshot,i)})}catch(e){if(!u(e))throw e;f(void 0);let t=T(e,n);c.show({state:`error`,title:J(`couldNotDelete`,{title:n.title}),description:t?.text??e.message,...t?.link&&{action:{label:t.link.label,href:C(t.link.to),onNavigate:w}}})}finally{h(!1)}},A=async e=>{try{return await D(e,e.etag)?{title:e.title,message:J(`changedSinceLoaded`)}:void 0}catch(t){if(!u(t))throw t;return{title:e.title,message:T(t,e)?.text??t.message}}},j=async e=>{let t=[],n=[],r=0;f({kind:`bulk-running`,done:r,total:e.length});let i=[...e];return await Promise.all(Array.from({length:Math.min(ae,e.length)},async()=>{for(let a=i.shift();a;a=i.shift()){let i=await A(a);i&&(t.push(i),n.push(a)),r+=1,f({kind:`bulk-running`,done:r,total:e.length})}})),E(),f({kind:`bulk-done`,total:e.length,failures:t}),n},M=()=>f(void 0);return{dialogs:l&&(0,Q.jsxs)(Q.Fragment,{children:[l.kind===`confirm`&&(0,Q.jsx)(te,{title:l.target.title,noun:g,busy:p,onCancel:M,onConfirm:()=>void k(l.target,l.target.etag)}),l.kind===`conflict`&&(0,Q.jsx)(ne,{title:l.target.title,changes:l.changes,busy:p,onCancel:M,onReview:()=>{M(),r?.(l.target,l.fresh)},onDeleteAnyway:()=>void k(l.target,`*`)}),l.kind===`bulk-confirm`&&(0,Q.jsx)($,{stage:`confirm`,count:l.targets.length,noun:g,plural:v,onCancel:()=>{M(),l.settle(l.targets)},onConfirm:()=>l.settle(j(l.targets))}),l.kind===`bulk-running`&&(0,Q.jsx)($,{stage:`running`,done:l.done,total:l.total}),l.kind===`bulk-done`&&(0,Q.jsx)($,{stage:`done`,total:l.total,failures:l.failures,onClose:M})]}),start:t=>e.softDelete?k(t,t.etag):f({kind:`confirm`,target:t}),startBulk:e=>new Promise(t=>f({kind:`bulk-confirm`,targets:e,settle:t}))}},se=e=>{let t=S();return e.softDelete?async n=>void await t.undelete(e.name,n.key):void 0},ce=(e,t,n)=>({order:r,index:i})=>{let a=t=>r.findIndex(n=>j(o(e,n))===t),s=t.after.find(e=>a(e.key)>i);if(s)return H(`dependsOn`,{record:n,other:s.title});let c=t.before.find(e=>a(e.key)!==-1&&a(e.key)<i);return c?H(`dependsOn`,{record:c.title,other:n}):void 0},le=(e,t,n,r)=>{let i=e[t],a;for(let o=n;o<e.length;o++){let n=r({record:i,order:I(e,t,o),index:o});if(n===void 0)return{to:o,...a!==void 0&&{reason:a}};a??=n}return{to:t,reason:a}},ue=({model:e,view:t,field:n,filter:r,fields:o,rule:c})=>{let l=S(),u=a(),d=h(),{resources:f,views:m}=_(),g=`${n} asc`,v=P({queryKey:[...C.list(e.name,r,g,500,`hand-order`),o.join(`,`)],queryFn:async()=>{let t=i(f,m,e,o),n=[],a=``;do{let i=await l.search(e.name,{filter:r||void 0,orderBy:g,pageSize:500,labels:t,...a&&{pageToken:a}});n.push(...y(f,e,o,i.items,i.labels).map((t,n)=>({...t,id:s(e,i.items[n])}))),a=i.nextPageToken}while(a);return n}}),[x,w]=(0,q.useState)(),T=(0,q.useRef)(void 0),E=(0,q.useRef)([]),D=(0,q.useRef)(void 0),O=(0,q.useRef)(Promise.resolve()),k=(0,q.useRef)(0),A=(0,q.useRef)(void 0),j=async()=>{let t=T.current,r=E.current;if(E.current=[],!t||r.length===0)return;let i=await l.batchWrite(r),a=new Map(i.results.flatMap(e=>e.op===`move`?e.records:[]).map(t=>[s(e,t.record),t])),o=z(i.results,t=>s(e,t)),c=L(e,[...a].map(([e,t])=>({...t,before:{[n]:o.get(e)}})),[n]);A.current!==void 0&&u.dismiss(A.current),A.current=u.show({state:`success`,title:V(`orderChanged`),action:{label:V(`undo`),onClick:()=>W(c)}}),T.current&&=T.current.map(e=>{let t=a.get(e.id);return t?{...e,[n]:t.record[n],etag:t.etag}:e})},M=(e,t)=>n=>{T.current=void 0,E.current=[],w(void 0),u.show(B(n,e,{place:`list`,title:t?D.current:void 0}))},N=async()=>{--k.current,!(k.current>0)&&(await d(e.name),!(k.current>0)&&(T.current=void 0,w(void 0)))},F=(n,r)=>{let i=T.current??v.data;if(!i||n===r)return;if(!e.position?.after)return H(i,n,r,c);let a=p(e,i[n]).record,o=i[n].id;R(l,e,t,a).then(n=>{let i=T.current??v.data,s=ce(e,n,b(e,t,a,o));H(i,i.findIndex(e=>e.id===o),r,e=>s(e)??c?.(e))},M(V(`couldNotChange`),!1))},H=(i,a,o,s)=>{if(a===-1||a===o)return;let c=s?U(i,a,o,s):o;a!==c&&(T.current=I(i,a,c),E.current=[...E.current,ee(e,n,r,T.current,c)],w(T.current),k.current+=1,D.current=b(e,t,p(e,i[a]).record,i[a].id),O.current=O.current.then(j).catch(M(V(`couldNotChange`),!0)).then(N))},U=(t,n,r,i)=>{let a=le(t.map(t=>p(e,t).record),n,r,i);return a.reason!==void 0&&u.show({state:`warning`,title:a.to===n?V(`notMoved`):V(`movedToPlace`,{place:a.to+1}),description:a.reason}),a.to},W=e=>{A.current!==void 0&&u.dismiss(A.current),A.current=void 0,k.current+=1,O.current=O.current.then(async()=>{await l.batchWrite(e),T.current=void 0,E.current=[],w(void 0)}).catch(M(V(`couldNotUndo`),!1)).then(N)};return{rows:x??v.data,loading:v.isPending,error:v.error,move:F}},de=({model:e,view:t,field:n,filter:r,columns:i,sort:a})=>{let{resources:s,views:c}=_(),{fields:u,dropRules:p}=l(),{go:m,href:h}=d(),v=a!==void 0,y=(0,q.useMemo)(()=>g(e,t,i,{resources:s,views:c,fieldTypes:u}).map(e=>v?e:{...e,sortable:!1}),[e,t,i.join(`,`),s,c,u,v]),x=(0,q.useMemo)(()=>E(e,t,y.map(e=>e.id)),[e,t,y]),S=t?.list?.drag?.rule,C=S===void 0?void 0:p?.[S],w=ue({model:e,view:t,field:n,filter:r,fields:x,...C&&{rule:C}}),T=w.rows,D=(0,q.useMemo)(()=>T&&{total:T.length,rowAt:e=>T[e]},[T]);if(S!==void 0&&!C)return(0,Q.jsx)(f,{children:V.rich(`noRule`,{rule:S})});if(w.loading)return(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:Array.from({length:3},(e,t)=>(0,Q.jsx)(k,{className:`h-4 w-full`},t))});if(w.error)return(0,Q.jsx)(M,{title:V(`couldNotLoad`),error:w.error});if(!D||D.total===0)return(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:V(`nothingYet`)});let O=t=>m({kind:`record`,resource:e.name,key:o(e,t)});return(0,Q.jsx)(F,{fit:!0,scroll:`parent`,columns:y,source:D,latencyMs:0,onOpenRow:O,rowLink:t=>({href:h({kind:`record`,resource:e.name,key:o(e,t)}),onFollow:()=>O(t)}),...a&&{sort:a.value,onSortChange:a.onChange},rowNumbers:!1,reorder:{label:n=>b(e,t,n,n.id),onMove:w.move}})},fe=({sorting:e,onChange:t,size:n,iconOnly:r=!1})=>{let i=V(e?`done`:`reorder`);return(0,Q.jsxs)(w,{size:n,variant:e?`primary`:`secondary`,onClick:()=>t(!e),...r&&{"aria-label":i,title:i},children:[e?(0,Q.jsx)(c,{className:`size-3.5`}):(0,Q.jsx)(W,{className:`size-3.5`}),!r&&i]})};export{K as a,oe as i,de as n,se as r,fe as t};
2
+ //# debugId=c757dfe7-d4c3-4b4a-aaa6-35c9cb6594ae
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{lc as r,vr as i}from"./app-CWCg5I0x.js";import{t as a}from"./workflow-canvas-DbLkc3zJ.js";import{a as o,i as s,n as c}from"./step-panel-CA5-2Doz.js";import{t as l}from"./use-run-trace-CSdKdxn9.js";import{t as u}from"./use-workflow-types-BQl6tPM-.js";import{n as d,t as f}from"./graph-frame-PVfWqgbJ.js";var p=e(t(),1),m=e(n(),1),h=new Map,g=({trace:e,types:t,notice:n,idle:l})=>{let{definition:u,steps:g,going:_,place:v}=e,y=(0,p.useMemo)(()=>v&&o(g,{inProgress:_,...v}),[v,g,_]),[b,x]=(0,p.useState)();if(e.error)return(0,m.jsx)(i,{error:e.error,title:s(`loadFailed`)});if(!e.run||!e.id||!u||!y)return(0,m.jsx)(r,{className:`h-[28rem] w-full max-sm:h-[22rem]`});let S=[...y].filter(([,e])=>e.status===`failed`).map(([e])=>e).sort((e,t)=>t.split(`/`).length-e.split(`/`).length)[0],C=b===void 0?S:b??void 0,w={...e.run,id:e.id,created_at:String(e.run.created_at)};return(0,m.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[!_&&g.length===0&&(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`noTrace`)}),(0,m.jsx)(f,{canvas:(0,m.jsx)(a,{definition:u,problems:h,selected:C,onSelect:e=>x(e??null),traces:y,...t&&{types:t}}),panel:(0,m.jsxs)(m.Fragment,{children:[n,C===void 0?l??(0,m.jsx)(d,{children:s(`pickNode`)}):(0,m.jsx)(c,{definition:u,run:w,selected:C,...t&&{types:t}})]})})]})},_=({runId:e})=>{let t=l(e),n=u().data;return(0,m.jsx)(g,{trace:t,...n&&{types:n}})};export{_ as RunTrace};
2
- //# debugId=9270575d-51b6-4a1e-a519-bf87d4e8bfbc
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{uc as r,yr as i}from"./app-2d0YQdR7.js";import{t as a}from"./workflow-canvas-B-IYnZVg.js";import{a as o,i as s,n as c}from"./step-panel-BGJiJ7z6.js";import{t as l}from"./use-run-trace-Dukz4W0q.js";import{t as u}from"./use-workflow-types-B1NI4zqE.js";import{n as d,t as f}from"./graph-frame-PVfWqgbJ.js";var p=e(t(),1),m=e(n(),1),h=new Map,g=({trace:e,types:t,notice:n,idle:l})=>{let{definition:u,steps:g,going:_,place:v}=e,y=(0,p.useMemo)(()=>v&&o(g,{inProgress:_,...v}),[v,g,_]),[b,x]=(0,p.useState)();if(e.error)return(0,m.jsx)(i,{error:e.error,title:s(`loadFailed`)});if(!e.run||!e.id||!u||!y)return(0,m.jsx)(r,{className:`h-[28rem] w-full max-sm:h-[22rem]`});let S=[...y].filter(([,e])=>e.status===`failed`).map(([e])=>e).sort((e,t)=>t.split(`/`).length-e.split(`/`).length)[0],C=b===void 0?S:b??void 0,w={...e.run,id:e.id,created_at:String(e.run.created_at)};return(0,m.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[!_&&g.length===0&&(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`noTrace`)}),(0,m.jsx)(f,{canvas:(0,m.jsx)(a,{definition:u,problems:h,selected:C,onSelect:e=>x(e??null),traces:y,...t&&{types:t}}),panel:(0,m.jsxs)(m.Fragment,{children:[n,C===void 0?l??(0,m.jsx)(d,{children:s(`pickNode`)}):(0,m.jsx)(c,{definition:u,run:w,selected:C,...t&&{types:t}})]})})]})},_=({runId:e})=>{let t=l(e),n=u().data;return(0,m.jsx)(g,{trace:t,...n&&{types:n}})};export{_ as RunTrace};
2
+ //# debugId=cecb3bca-4d5e-4d70-90dc-930d5d2b7d82
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Ys as r,cl as i,ea as a,fc as o,ms as s,nl as c}from"./app-CWCg5I0x.js";import{t as l}from"./copy-field-D0wtSWzb.js";var u=e(t(),1),d=c(`app/field-types/runner-install`),f=e(n(),1),p=e=>e instanceof r?e.slug===`runner-registered`?d(`registered`):e.slug===`runner-revoked`?d(`revoked`):e.status===404?d(`notYours`):d(`failed`):d(`failed`),m=({value:e})=>{let t=s(),[n,r]=(0,u.useState)(),[i,c]=(0,u.useState)(!1),[m,h]=(0,u.useState)();if(e===null)return null;let g=async()=>{c(!0),h(void 0),await t.runnerRegistration(e).then(r,e=>h(p(e))),c(!1)};return(0,f.jsxs)(`div`,{className:`grid gap-2`,children:[n&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l,{value:n.command,copyLabel:d(`copy`)}),(0,f.jsx)(`p`,{className:`text-body text-muted-foreground`,children:d(`shownOnce`,{until:a(Date.parse(n.expires_at))})})]}),m&&(0,f.jsx)(`p`,{role:`alert`,className:`text-body text-danger-text`,children:m}),(0,f.jsx)(o,{size:`sm`,variant:n?`secondary`:`primary`,className:`justify-self-start`,loading:i,onClick:()=>void g(),children:d(n?`again`:`issue`)})]})},h={of:[...i.runner_install],display:m,cell:()=>null};export{h as runnerInstallField};
2
- //# debugId=f2c87554-7dd8-4350-af4f-9cf8ba9b83c4
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Xs as r,hs as i,ll as a,pc as o,rl as s,ta as c}from"./app-2d0YQdR7.js";import{t as l}from"./copy-field-BtAsyigB.js";var u=e(t(),1),d=s(`app/field-types/runner-install`),f=e(n(),1),p=e=>e instanceof r?e.slug===`runner-registered`?d(`registered`):e.slug===`runner-revoked`?d(`revoked`):e.status===404?d(`notYours`):d(`failed`):d(`failed`),m=({value:e})=>{let t=i(),[n,r]=(0,u.useState)(),[a,s]=(0,u.useState)(!1),[m,h]=(0,u.useState)();if(e===null)return null;let g=async()=>{s(!0),h(void 0),await t.runnerRegistration(e).then(r,e=>h(p(e))),s(!1)};return(0,f.jsxs)(`div`,{className:`grid gap-2`,children:[n&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l,{value:n.command,copyLabel:d(`copy`)}),(0,f.jsx)(`p`,{className:`text-body text-muted-foreground`,children:d(`shownOnce`,{until:c(Date.parse(n.expires_at))})})]}),m&&(0,f.jsx)(`p`,{role:`alert`,className:`text-body text-danger-text`,children:m}),(0,f.jsx)(o,{size:`sm`,variant:n?`secondary`:`primary`,className:`justify-self-start`,loading:a,onClick:()=>void g(),children:d(n?`again`:`issue`)})]})},h={of:[...a.runner_install],display:m,cell:()=>null};export{h as runnerInstallField};
2
+ //# debugId=896deacd-ea28-444d-b954-2f61d567e622
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Ka as r,Kc as i,Qi as a,Qs as o,Ys as s,Zs as c,ea as l,fc as u,mc as d,nl as f,pa as p,uc as m}from"./app-CWCg5I0x.js";var h={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};h.node;var g=i(h),_=e=>typeof e==`object`&&!!e&&`error`in e&&typeof e.error==`object`&&e.error!==null&&`code`in e.error&&`message`in e.error,v=async e=>{let t=e.headers.get(`content-type`)?.includes(`json`)??!1?await e.clone().json():void 0;return _(t)?new s({type:`urn:protobase:problem:${t.error.code}`,title:e.statusText||`Request failed`,status:e.status,detail:t.error.message}):o(e)},y=e=>{let t=e.url.replace(/\/+$/,``),n=e.fetch??((e,t)=>fetch(e,t)),r=async(r,i)=>{let a=await e.token(),o=await n(`${t}${r}`,{method:i,headers:{accept:`application/json`,...a&&{authorization:`Bearer ${a}`}}});if(!o.ok)throw await v(o);return await o.json()};return{status:()=>r(``,`GET`),update:()=>r(`/update`,`POST`)}},b=e(t(),1),x=f(`app/runtime`),S=e=>!!(e?.updateAvailable&&e.indicator),C=e=>e?5e3:18e5,w=(e,t)=>{if(!e.updateStage)return x(`updatingNow`);let n=x(e.updateStage);if(!e.updateStartedAt)return n;let r=Math.max(0,Math.floor((t-Date.parse(e.updateStartedAt))/1e3));return x(`started`,{stage:n,ago:a(r)})},T=(e,t=Date.now(),n=p())=>e.updating?w(e,t):e.nextUpdateAt?x(`nextOn`,{policy:x(e.policy),when:l(Date.parse(e.nextUpdateAt),n)}):x(e.policy),E=(e,t=p())=>{let n=l(Date.parse(e.finishedAt),t),r=x(e.outcome,{version:e.toVersion,when:n});return e.message?`${r}: ${e.message}`:`${r}.`},D=e=>c(e)&&e.status<500&&e.problem.detail?e.problem.detail:c(e)&&e.status===409?x(`alreadyLatest`):c(e)&&e.status===403?x(`onlyAdmin`):x(`couldNotStart`),O=e(n(),1),k=({label:e,value:t})=>(0,O.jsxs)(`div`,{className:`flex justify-between gap-4 py-1`,children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,O.jsx)(`span`,{className:`font-medium tabular-nums`,children:t})]}),A=({status:e,requesting:t,error:n,checkError:r,onUpdate:i,onClose:a})=>{let o=e.updating?void 0:e.lastUpdate;return(0,O.jsxs)(m,{title:x(`runtimeUpdate`),description:e.updating?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,O.jsx)(d,{className:`size-3.5`}),T(e)]}):T(e),onClose:a,actions:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(u,{onClick:a,children:x(`close`)}),(0,O.jsx)(u,{variant:`primary`,loading:t,disabled:e.updating||!e.updateAvailable,onClick:i,children:e.updating?x(`updating`):x(`updateNow`)})]}),children:[(0,O.jsx)(k,{label:x(`currentVersion`),value:e.version}),(0,O.jsx)(k,{label:x(`latestVersion`),value:e.latest}),o&&(0,O.jsx)(`p`,{className:o.outcome===`failed`?`mt-3 text-danger-text`:`mt-3 text-muted-foreground`,children:E(o)}),n!==void 0&&(0,O.jsx)(`p`,{role:`alert`,className:`mt-3 text-danger-text`,children:D(n)}),r!==void 0&&(0,O.jsx)(`p`,{className:`mt-3 text-muted-foreground`,children:x(`checkFailed`)})]})},j=e=>{let t=r(),n=(0,b.useRef)(t);n.current=t;let i=t!==void 0;return(0,b.useMemo)(()=>i?y({url:e,token:()=>n.current}):void 0,[e,i])},M=e=>{let[t,n]=(0,b.useState)(),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)(),l=t?.updating??!1;return(0,b.useEffect)(()=>{if(!e)return;let t=!0,r=()=>e.status().then(e=>{t&&(n(e),c(void 0))},e=>t&&c(e));r();let i=setInterval(()=>void r(),C(l));return()=>{t=!1,clearInterval(i)}},[e,l]),{status:t,update:(0,b.useCallback)(async()=>{e&&(i(!0),o(void 0),await e.update().then(n,o),i(!1))},[e]),requesting:r,error:a,checkError:s}},N=({client:e})=>{let{status:t,update:n,requesting:r,error:i,checkError:a}=M(e),[o,s]=(0,b.useState)(!1);return!t||!o&&!S(t)?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(u,{size:`sm`,variant:`ghost`,"aria-label":x(`updateAvailable`),title:x(`updateAvailable`),onClick:()=>s(!0),className:`max-md:size-9 max-md:p-0`,children:[(0,O.jsx)(g,{className:`size-3.5 text-primary`}),(0,O.jsx)(`span`,{className:`max-md:sr-only`,children:x(`update`)})]}),o&&(0,O.jsx)(A,{status:t,requesting:r,error:i,checkError:a,onUpdate:()=>void n(),onClose:()=>s(!1)})]})},P=({url:e})=>(0,O.jsx)(N,{client:j(e)}),F=({url:e,client:t})=>t?(0,O.jsx)(N,{client:t}):(0,O.jsx)(P,{url:e});export{F as RuntimeUpdateButton};
2
- //# debugId=ae2cbe10-6e64-4458-92c8-37f28f8c326b
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$i as r,$s as i,Qs as a,Xs as o,dc as s,hc as c,ma as l,pc as u,qa as d,qc as f,rl as p,ta as m}from"./app-2d0YQdR7.js";var h={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};h.node;var g=f(h),_=e=>typeof e==`object`&&!!e&&`error`in e&&typeof e.error==`object`&&e.error!==null&&`code`in e.error&&`message`in e.error,v=async e=>{let t=e.headers.get(`content-type`)?.includes(`json`)??!1?await e.clone().json():void 0;return _(t)?new o({type:`urn:protobase:problem:${t.error.code}`,title:e.statusText||`Request failed`,status:e.status,detail:t.error.message}):i(e)},y=e=>{let t=e.url.replace(/\/+$/,``),n=e.fetch??((e,t)=>fetch(e,t)),r=async(r,i)=>{let a=await e.token(),o=await n(`${t}${r}`,{method:i,headers:{accept:`application/json`,...a&&{authorization:`Bearer ${a}`}}});if(!o.ok)throw await v(o);return await o.json()};return{status:()=>r(``,`GET`),update:()=>r(`/update`,`POST`)}},b=e(t(),1),x=p(`app/runtime`),S=e=>!!(e?.updateAvailable&&e.indicator),C=e=>e?5e3:18e5,w=(e,t)=>{if(!e.updateStage)return x(`updatingNow`);let n=x(e.updateStage);if(!e.updateStartedAt)return n;let i=Math.max(0,Math.floor((t-Date.parse(e.updateStartedAt))/1e3));return x(`started`,{stage:n,ago:r(i)})},T=(e,t=Date.now(),n=l())=>e.updating?w(e,t):e.nextUpdateAt?x(`nextOn`,{policy:x(e.policy),when:m(Date.parse(e.nextUpdateAt),n)}):x(e.policy),E=(e,t=l())=>{let n=m(Date.parse(e.finishedAt),t),r=x(e.outcome,{version:e.toVersion,when:n});return e.message?`${r}: ${e.message}`:`${r}.`},D=e=>a(e)&&e.status<500&&e.problem.detail?e.problem.detail:a(e)&&e.status===409?x(`alreadyLatest`):a(e)&&e.status===403?x(`onlyAdmin`):x(`couldNotStart`),O=e(n(),1),k=({label:e,value:t})=>(0,O.jsxs)(`div`,{className:`flex justify-between gap-4 py-1`,children:[(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,O.jsx)(`span`,{className:`font-medium tabular-nums`,children:t})]}),A=({status:e,requesting:t,error:n,checkError:r,onUpdate:i,onClose:a})=>{let o=e.updating?void 0:e.lastUpdate;return(0,O.jsxs)(s,{title:x(`runtimeUpdate`),description:e.updating?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,O.jsx)(c,{className:`size-3.5`}),T(e)]}):T(e),onClose:a,actions:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(u,{onClick:a,children:x(`close`)}),(0,O.jsx)(u,{variant:`primary`,loading:t,disabled:e.updating||!e.updateAvailable,onClick:i,children:e.updating?x(`updating`):x(`updateNow`)})]}),children:[(0,O.jsx)(k,{label:x(`currentVersion`),value:e.version}),(0,O.jsx)(k,{label:x(`latestVersion`),value:e.latest}),o&&(0,O.jsx)(`p`,{className:o.outcome===`failed`?`mt-3 text-danger-text`:`mt-3 text-muted-foreground`,children:E(o)}),n!==void 0&&(0,O.jsx)(`p`,{role:`alert`,className:`mt-3 text-danger-text`,children:D(n)}),r!==void 0&&(0,O.jsx)(`p`,{className:`mt-3 text-muted-foreground`,children:x(`checkFailed`)})]})},j=e=>{let t=d(),n=(0,b.useRef)(t);n.current=t;let r=t!==void 0;return(0,b.useMemo)(()=>r?y({url:e,token:()=>n.current}):void 0,[e,r])},M=e=>{let[t,n]=(0,b.useState)(),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)(),l=t?.updating??!1;return(0,b.useEffect)(()=>{if(!e)return;let t=!0,r=()=>e.status().then(e=>{t&&(n(e),c(void 0))},e=>t&&c(e));r();let i=setInterval(()=>void r(),C(l));return()=>{t=!1,clearInterval(i)}},[e,l]),{status:t,update:(0,b.useCallback)(async()=>{e&&(i(!0),o(void 0),await e.update().then(n,o),i(!1))},[e]),requesting:r,error:a,checkError:s}},N=({client:e})=>{let{status:t,update:n,requesting:r,error:i,checkError:a}=M(e),[o,s]=(0,b.useState)(!1);return!t||!o&&!S(t)?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(u,{size:`sm`,variant:`ghost`,"aria-label":x(`updateAvailable`),title:x(`updateAvailable`),onClick:()=>s(!0),className:`max-md:size-9 max-md:p-0`,children:[(0,O.jsx)(g,{className:`size-3.5 text-primary`}),(0,O.jsx)(`span`,{className:`max-md:sr-only`,children:x(`update`)})]}),o&&(0,O.jsx)(A,{status:t,requesting:r,error:i,checkError:a,onUpdate:()=>void n(),onClose:()=>s(!1)})]})},P=({url:e})=>(0,O.jsx)(N,{client:j(e)}),F=({url:e,client:t})=>t?(0,O.jsx)(N,{client:t}):(0,O.jsx)(P,{url:e});export{F as RuntimeUpdateButton};
2
+ //# debugId=e244bd94-100e-47a4-8ad1-538cb9101406
@@ -0,0 +1 @@
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{$ as e,$c as t,$t as n,Ar as r,At as ee,B as te,Br as i,Bt as a,Ct as o,Dr as s,Dt as c,Eo as l,Er as u,Et as d,F as f,Fa as p,Fo as m,Fr as h,Ft as g,G as _,Gi as v,H as y,Hr as b,Ht as x,Ia as S,Io as C,Ir as w,It as T,Ji as E,K as D,Ka as O,Ki as k,Lo as A,Lt as j,Mt as M,No as N,Nt as P,On as F,P as I,Pr as L,Pt as R,Q as z,Qc as B,Qi as V,Ro as H,So as U,Sr as W,St as G,Tr as K,Tt as q,U as J,Un as Y,Ur as X,Ut as Z,V as Q,Vr as ne,Vt as re,W as ie,Wa as ae,Wo as oe,Wt as se,X as ce,Xc as le,Xi as ue,Xt as de,Yc as fe,Yi as pe,Yt as me,Zc as he,Zi as ge,Zt as _e,_a as ve,_t as $,br as ye,bt as be,cc as xe,dc as Se,dr as Ce,dt as we,el as Te,en as Ee,et as De,fo as Oe,ft as ke,gs as Ae,gt as je,hc as Me,hs as Ne,ht as Pe,i as Fe,il as Ie,it as Le,kr as Re,mc as ze,mo as Be,ms as Ve,mt as He,nt as Ue,ot as We,pc as Ge,po as Ke,ps as qe,pt as Je,qa as Ye,qi as Xe,qt as Ze,r as Qe,rt as $e,t as et,tl as tt,tt as nt,ut as rt,vo as it,vt as at,wn as ot,wo as st,wr as ct,wt as lt,xo as ut,xr as dt,xt as ft,yo as pt,yt as mt,z as ht,za as gt,zr as _t}from"./app-2d0YQdR7.js";import{h as vt,o as yt}from"./vendor-t7Q7QbPu.js";export{G as ActionCard,s as ActionInputError,Ve as ApiProvider,i as App,b as AppLink,A as AppMark,ke as AssistantDock,Be as AuthLayout,ut as AvailabilityMark,Ge as Button,a as CallMark,se as CallView,D as Carousel,R as ChatDivider,P as ChatMessage,M as ChatThread,te as Choices,Oe as CodeForm,be as CompactTable,lt as Composer,Se as Dialog,$ as DiffView,ht as Field,_e as FieldBadge,ft as FieldList,dt as FileReadError,e as FocusActions,De as FocusNotice,Le as FocusPage,nt as FocusPanel,Ue as FocusSlot,I as Form,K as HtmlFrame,Qe as InPlaceForm,N as Input,H as LogoMark,F as Markdown,d as MentionBox,q as MentionedText,Q as MenuSelect,st as MenuSurface,it as OtpInput,He as PartView,x as RecordCall,Ze as RecordLink,et as RecordPicker,Ke as ResendCodeButton,pe as ResponsiveDialog,xe as RouteLink,ce as SearchPicker,f as Section,l as Segmented,ot as Select,o as SidePanel,j as SignInPrompt,Me as Spinner,U as StatusMark,Pe as StepList,Y as Textarea,de as ToneEdge,y as allowDelayMs,ze as buttonClass,g as chatDayLabel,oe as closeSidebarEvent,p as definePlugin,S as defineUi,at as diffStats,c as emptyDraft,le as extensionPointsOf,u as fileNamed,Re as isConflict,J as isFramed,C as logoTapEvent,ee as mentionedIds,B as mergeUi,mt as parseDiff,je as parsePatch,Te as pluginApi,fe as pluginsChangedEvent,tt as protobaseVersion,T as sameChatDay,Ie as showTextsIn,ct as siblingPage,pt as signedOutEvent,k as statusRefreshMs,t as uiFromModule,ne as uiReadyEvent,Ye as useApiToken,X as useAppAddress,ie as useArmedAfterFocus,we as useAssistant,rt as useAssistantClient,Je as useBackendData,Ne as useClient,n as useComponentReads,Ee as useComponentSelect,Fe as useCreateForm,L as useFacets,m as useFieldControl,W as useFileText,We as useFocusPage,z as useFocusRecord,$e as useFocusZoneFilled,_ as useGuardedPress,h as useHistogram,ue as useInbox,Ce as useLayoutRecord,_t as useList,me as useListDisplay,ge as useMarkNotificationsRead,v as useMembers,qe as useMeta,Xe as useOwnStatus,he as usePlugin,gt as usePresence,ve as usePushNotifications,yt as useQuery,vt as useQueryClient,ae as useRecord,Z as useRecordCallAddress,re as useRecordCalls,Ae as useResourceClient,w as useSeries,ye as useSiblingPage,O as useSignedInUser,E as useStatuses,V as useUnreadNotifications,r as useUpdateRecord};
@@ -1,3 +1,3 @@
1
- (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Kc as r,Nc as i,Ql as a,Zs as o,al as s,bi as c,eu as l,fc as u,il as d,j as f,lo as p,mc as m,ml as h,pl as g,qc as _,vr as ee}from"./app-CWCg5I0x.js";import{c as v,d as y,l as te,o as b,u as x}from"./list-page-BtuFsbiK.js";var S={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};S.node;var ne=r(S),C=e(t(),1),w=e(n(),1),re=e=>/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,ie=(e,t)=>{let n=[...t].sort((e,t)=>e.line-t.line).map(t=>[...e.map((e,n)=>b(t.cells[n]??null)),String(t.line),t.problems.join(`; `)]);return`${[[...e,y(`line`),y(`problems`)],...n].map(e=>e.map(re).join(`,`)).join(`\r
2
- `)}\r\n`},T=({label:e,counts:t})=>(0,w.jsx)(`dl`,{"aria-label":e,className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:t.map(([e,t])=>(0,w.jsxs)(`div`,{className:`rounded-lg border px-3 py-2`,children:[(0,w.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e}),(0,w.jsx)(`dd`,{className:`text-lg font-semibold tabular-nums`,children:t.toLocaleString(s())})]},e))}),E=(e,t)=>e?.fields[t]?.label??h(t),ae=new Set([`text`,`integer`,`bigint`,`decimal`,`boolean`,`date`,`timestamp`,`uuid`,`enum`,`relation`,`currency`,`country`]),D=(e,t)=>{let n=e.relation?t[e.relation.resource]:void 0;return n?.primaryKey.length===1?n:void 0},oe=(e,t,{json:n=!1}={})=>Object.values(e.fields).filter(r=>r.readOnly||r.name===e.tenant?!1:r.type===`json`?n:ae.has(r.type)?r.type!==`relation`||D(r,t)!==void 0:!1),se=new Set([`text`,`integer`,`bigint`,`uuid`,`date`,`currency`,`country`,`enum`]),ce=e=>{let t=e.primaryKey.length===1?[e.fields[e.primaryKey[0]]]:[],n=Object.values(e.fields).filter(t=>t.filterable&&!t.sensitive&&se.has(t.type)&&!e.primaryKey.includes(t.name));return[...t,...n]},O=(e,t)=>D(e,t),k=e=>!e.nullable&&!e.default,A=e=>e.toLowerCase().replace(/[\s_-]+/g,``),le=(e,t,n)=>{let r=new Set;return e.flatMap((e,i)=>{let a=A(e);if(a===``)return[];let o=t.find(e=>!r.has(e.name)&&(A(E(n,e.name))===a||A(e.name)===a));return o?(r.add(o.name),[{column:i,field:o.name}]):[]})},ue=(e,t,n)=>{if(e===`update`)return[];let r=new Set(n.map(e=>e.field));return t.filter(e=>k(e)&&!r.has(e.name))},j=e=>({ok:!0,value:e}),M=e=>({ok:!1,problem:e}),N=e=>`“${b(e)}”`,P=(e,t)=>{if(typeof e==`number`)return String(e);if(typeof e==`string`)return f(e,t.decimal)},de=(e,t,n)=>{let r=P(t,n);if(r===void 0)return M(y(`notNumber`,{cell:N(t)}));let[i,a=``]=r.split(`.`);if(/[1-9]/.test(a)||/e/i.test(r))return M(y(`notWholeNumber`,{cell:N(t)}));if(e.type===`bigint`)return j(String(BigInt(i)));let o=Number(i);return Number.isSafeInteger(o)?j(o):M(y(`tooLarge`,{cell:N(t)}))},fe=(e,t)=>{let n=P(e,t);return n===void 0?M(y(`notNumber`,{cell:N(e)})):j(n)},pe=new Set([`true`,`yes`,`1`]),me=new Set([`false`,`no`,`0`]),he=e=>{if(typeof e==`boolean`)return j(e);let t=typeof e==`string`||typeof e==`number`?String(e).trim().toLowerCase():``;return pe.has(t)?j(!0):me.has(t)?j(!1):M(y(`notBoolean`,{cell:N(e)}))},F=e=>String(e).padStart(2,`0`),ge=(e,t,n)=>{let r=new Date(Date.UTC(e,t-1,n));if(r.getUTCFullYear()===e&&r.getUTCMonth()===t-1&&r.getUTCDate()===n)return`${e}-${F(t)}-${F(n)}`},I=`(\\d{1,2}):(\\d{2})(?::(\\d{2})(?:\\.\\d+)?)?`,L=(e,t)=>{let n=RegExp(`^(\\d{4})[-/](\\d{1,2})[-/](\\d{1,2})(?:[T ]${I}(Z|[+-]\\d{2}:?\\d{2})?)?$`).exec(e.trim()),r=RegExp(`^(\\d{1,2})[./-](\\d{1,2})[./-](\\d{4})(?: ${I})?$`).exec(e.trim());if(!n&&!r)return;let[i,a,o]=n?[n[1],n[2],n[3]].map(Number):t===`dmy`?[r[3],r[2],r[1]].map(Number):[r[3],r[1],r[2]].map(Number),s=ge(i,a,o);if(!s)return;let[c,l,u=`0`]=n?n.slice(4,7):r.slice(4,7);if(c===void 0)return{date:s};if(!(Number(c)>23||Number(l)>59||Number(u)>59))return{date:s,time:`${F(Number(c))}:${l}:${F(Number(u))}`,zone:n?.[7]}},R=(e,t)=>{if(te(e)){let[t,n]=e.date.split(`T`);return{date:t,time:n}}return typeof e==`string`?L(e,t.dateOrder):void 0},z=(e,t)=>M(y(`notDate`,{cell:N(e),dayFirst:t.dateOrder===`dmy`})),_e=(e,t)=>{let n=R(e,t);return n?n.time&&n.time!==`00:00:00`?M(y(`hasTime`,{cell:N(e)})):j(n.date):z(e,t)},ve=(e,t)=>{let n=R(e,t);if(!n)return z(e,t);if(n.zone)return j(new Date(`${n.date}T${n.time}${n.zone===`Z`?`Z`:n.zone.replace(/^([+-]\d{2})(\d{2})$/,`$1:$2`)}`).toISOString());let[r,i,a]=n.date.split(`-`).map(Number),[o,s,c]=(n.time??`00:00:00`).split(`:`).map(Number);return j(new Date(r,i-1,a,o,s,c).toISOString())},B=e=>e.trim().toLowerCase().replace(/\s+/g,` `),ye=(e,t,n)=>{let r=e.enumValues??[],i=B(b(n)),a=r.filter(e=>B(e)===i||B(g(e,t?.valueLabels))===i);return a.length===1?j(a[0]):a.length>1?M(y(`severalValues`,{cell:N(n),values:a.map(e=>g(e,t?.valueLabels)).join(`, `)})):M(y(`notOneOf`,{cell:N(n),values:r.map(e=>g(e,t?.valueLabels)).join(`, `)}))},be=(e,t)=>typeof e==`boolean`&&!t.booleanText?M(y(`notText`,{cell:N(e)})):j(b(e)),xe=e=>x(e)?j(e.json):j(e),V=(e,t,n,r)=>{if(v(n))return e.nullable?j(null):M(y(`emptyRequired`));if(e.type===`json`)return xe(n);if(x(n))return M(y(`nestedValue`,{cell:N(n)}));switch(e.type){case`integer`:case`bigint`:return de(e,n,r);case`decimal`:return fe(n,r);case`boolean`:return he(n);case`date`:return _e(n,r);case`timestamp`:return ve(n,r);case`enum`:return ye(e,t,n);case`text`:case`uuid`:case`currency`:case`country`:return be(n,r);default:throw Error(`Not implemented: importing ${e.type} fields, which importableFields leaves out`)}},Se=(e,t)=>e[t]?.names?.singular??h(t),Ce=(e,t)=>e[t]?.names?.plural??h(t),we=(e,t,n)=>{let{model:r,resources:i,views:a}=n,o=a[r.name],s={},c={},l=[],u=[];for(let{column:n,field:d,matchBy:f}of t.columns){let p=r.fields[d],m=e.cells[n]??null,h=E(o,d),g=O(p,i);if(g&&!v(m)){let e=f??g.primaryKey[0],n=V(g.fields[e],a[g.name]?.fields[e],m,t.options);n.ok?u.push({field:d,finding:{model:g,field:e,value:n.value}}):l.push(`${h}: ${n.problem}`),s[d]=b(m);continue}let _=V(p,o?.fields[d],m,t.options);_.ok?c[d]=s[d]=_.value:l.push(`${h}: ${_.problem}`)}let d;if(t.match&&t.mode!==`create`){let n=r.fields[t.match.field],i=V({...n,nullable:!1},o?.fields[n.name],e.cells[t.match.column]??null,t.options);i.ok?d={model:r,field:n.name,value:i.value}:l.push(`${E(o,n.name)}: ${i.problem}`)}return{values:s,data:c,problems:l,relations:u,match:d}},H=(e,t)=>{let n=e.lookups.keysOf(t.model.name,t.field,t.value),r=`${E(e.views[t.model.name],t.field).toLowerCase()} “${String(t.value)}”`;return n.length===1?{key:n[0]}:n.length===0?{none:y(`noneHas`,{singular:Se(e.views,t.model.name),named:r})}:{several:y(`severalHave`,{count:n.length,plural:Ce(e.views,t.model.name),named:r})}},Te=e=>e.cells.every(v),U=async(e,t,n)=>{let{model:r,views:i}=n,a=e.filter(e=>!Te(e)).map(e=>({row:e,...we(e,t,n)})),o=new Map;for(let e of a.flatMap(e=>[...e.relations.map(e=>e.finding),...e.match?[e.match]:[]])){let t=`${e.model.name}.${e.field}`;o.has(t)||o.set(t,{model:e.model,field:e.field,values:[]}),o.get(t).values.push(e.value)}for(let{model:e,field:t,values:r}of o.values())await n.lookups.load(e,t,r);return a.map(({row:e,values:a,data:o,problems:s,relations:c,match:l})=>{let u={...o};for(let{field:e,finding:t}of c){let a=H(n,t);`key`in a?u[e]=a.key:s.push(`${E(i[r.name],e)}: ${a.none??a.several}`)}let d=l&&H(n,l);d?.several&&s.push(y(`notOneRecord`,{found:d.several})),d?.none&&t.mode===`update`&&s.push(y(`nothingToUpdate`,{found:d.none}));let f={line:e.line,cells:e.cells,values:a,problems:s};return s.length>0?f:d&&`key`in d?{...f,op:{op:`update`,resource:r.name,key:d.key,etag:`*`,data:u}}:{...f,op:{op:`create`,resource:r.name,data:u}}})},Ee=5,De=5,Oe=async(e,t)=>{let n=e.rows(t),{value:r=[]}=await n.next();await n.return(void 0);let[i,...a]=r;return{headers:(i?.cells??[]).map(b),sample:a.slice(0,Ee)}};async function*W(e,t){let n=!0;for await(let r of e.rows(t))yield n?r.slice(1):r,n=!1}var ke=async(e,t,n,r,i,a)=>{let o={rows:0,creates:0,updates:0,problems:[],preview:[]};for await(let s of W(e,t)){a?.throwIfAborted();for(let e of await U(s,n,r))o.rows++,o.preview.length<De&&o.preview.push(e),e.op?.op===`create`?o.creates++:e.op?.op===`update`?o.updates++:o.problems.push({line:e.line,cells:e.cells,problems:e.problems});i(o.rows)}return o},Ae=(e,t)=>{if(!o(e))return[e.message];let n=e.errors.filter(e=>e.field);return n.length===0?[e.message]:n.map(e=>`${E(t.views[t.model.name],e.field)}: ${e.message}`)},je=async(e,t,n,r,{client:i,onProgress:a,cancelled:s})=>{let c={created:0,updated:0,skipped:0,failed:0,notWritten:[]},l=async e=>{let t=[...e];for(;t.length>0;){let e=t.map(e=>e.op);try{let{results:t}=await i.batchWrite(e);for(let e of t)e.op===`create`?c.created++:e.op===`update`&&c.updated++;return}catch(e){let n=o(e)?e.operation:void 0;if(n===void 0||!t[n])throw e;let[i]=t.splice(n,1);c.failed++,c.notWritten.push({line:i.line,cells:i.cells,problems:Ae(e,r)})}}},u=[],d=async e=>{for(;u.length>=100||e&&u.length>0;){if(s())return!1;await l(u.splice(0,100)),a({...c})}return!0};for await(let i of W(e,t)){for(let e of await U(i,n,r))e.op?u.push(e):(c.skipped++,c.notWritten.push({line:e.line,cells:e.cells,problems:e.problems}));if(!await d(!1))return{...c,cancelled:!0}}return await d(!0)?{...c,cancelled:!1}:{...c,cancelled:!0}},G=50,K=(e,t,n)=>p(ie(t,n),y(`notImportedFile`,{name:(e??`import`).replace(/\.[^.]+$/,``)}),`text/csv`),q=({rows:e})=>(0,w.jsxs)(`ul`,{"aria-label":y(`rowsNotImported`),className:`flex flex-col gap-1 text-body`,children:[e.slice(0,G).map(e=>(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`span`,{className:`font-medium`,children:y(`rowProblems`,{line:e.line})}),` `,e.problems.join(`; `)]},e.line)),e.length>G&&(0,w.jsx)(`li`,{className:`text-muted-foreground`,children:y(`andMore`,{count:(e.length-G).toLocaleString(s())})})]}),Me=({rows:e})=>(0,w.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,w.jsx)(m,{className:`size-3.5`}),y(`checkingRows`,{count:e.toLocaleString(s())})]}),Ne=({check:e,model:t,resources:n,views:r,columns:a,headers:o,fileName:s})=>{let l=r[t.name],d=a.map(e=>t.fields[e.field]);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,w.jsx)(T,{label:y(`check`),counts:[[y(`rows`),e.rows],[y(`toCreate`),e.creates],[y(`toUpdate`),e.updates],[y(`withProblems`),e.problems.length]]}),e.preview.length>0&&(0,w.jsx)(`div`,{className:`overflow-x-auto rounded-lg border`,children:(0,w.jsxs)(`table`,{"aria-label":y(`firstRows`),className:`w-full text-left text-body`,children:[(0,w.jsx)(`thead`,{className:`bg-muted text-muted-foreground`,children:(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{className:`px-2 py-1.5 font-medium`,children:y(`row`)}),d.map(e=>(0,w.jsx)(`th`,{className:`whitespace-nowrap px-2 py-1.5 font-medium`,children:E(l,e.name)},e.name))]})}),(0,w.jsx)(`tbody`,{className:`divide-y`,children:e.preview.map(e=>(0,w.jsxs)(`tr`,{className:e.problems.length>0?`bg-danger-soft`:void 0,children:[(0,w.jsx)(`td`,{className:`px-2 py-1.5 tabular-nums text-muted-foreground`,children:e.line}),d.map(t=>(0,w.jsx)(`td`,{className:`max-w-48 truncate px-2 py-1.5`,children:O(t,n)?String(e.values[t.name]??`—`):t.name in e.values?c(t,e.values[t.name],l?.fields[t.name]):``},t.name))]},e.line))})]})}),e.problems.length>0&&(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,w.jsx)(`h3`,{className:`font-medium`,children:y(`problemRows`)}),(0,w.jsxs)(u,{size:`sm`,onClick:()=>K(s,o,e.problems),children:[(0,w.jsx)(i,{className:`size-3.5`}),y(`download`)]})]}),(0,w.jsx)(q,{rows:e.problems})]}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:y(`batches`,{size:100})})]})},Pe=[`.xlsx`,`.csv`,`.json`],Fe=[`text/csv`,`application/json`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],Ie=[`text/comma-separated-values`,`application/csv`,`text/x-csv`,`application/vnd.ms-excel`,`text/plain`,`application/octet-stream`],Le=e=>/\bAndroid\b/.test(e),Re=e=>[...Pe,...Fe,...Le(e)?Ie:[]].join(`,`),J=({label:e,name:t,value:n,options:r,onChange:i,help:a,className:o})=>{let s=(0,C.useId)();return(0,w.jsxs)(`div`,{className:_(`flex min-w-0 flex-col gap-1.5`,o),children:[(0,w.jsx)(`label`,{htmlFor:s,className:`font-medium`,children:e}),(0,w.jsx)(`select`,{id:s,"aria-label":t,value:n,onChange:e=>i(e.target.value),className:`h-8 w-full min-w-0 rounded-md border border-border-strong bg-background px-2 shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20 max-sm:min-h-11`,children:r.map(e=>(0,w.jsx)(`option`,{value:e.value,children:e.label},e.value))}),a&&(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a})]})},Y=({file:e,sheets:t,sheet:n,reading:r,onChoose:i,onSheet:a})=>{let o=(0,C.useId)();return(0,w.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,w.jsx)(`label`,{htmlFor:o,className:`font-medium`,children:y(`file`)}),(0,w.jsx)(`input`,{id:o,type:`file`,accept:Re(globalThis.navigator?.userAgent??``),disabled:r,onChange:e=>{let t=e.target.files?.[0];t&&i(t)},className:`file:mr-3 file:h-8 file:rounded-md file:border file:border-border-strong file:bg-background file:px-3 file:font-medium file:text-foreground max-sm:file:min-h-11`}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:y(`fileHint`)})]}),r&&(0,w.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,w.jsx)(m,{className:`size-3.5`}),y(`reading`,{name:e?.name??y(`theFile`)})]}),!r&&t.length>1&&(0,w.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,w.jsx)(ne,{className:`mb-2 size-4 shrink-0 text-muted-foreground`}),(0,w.jsx)(J,{className:`flex-1`,label:y(`sheet`),value:n??``,options:t.map(e=>({value:e,label:e})),onChange:a})]})]})},X=e=>e.toLocaleString(s()),ze=({progress:e,total:t,cancelling:n})=>{let r=e.created+e.updated+e.failed;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,w.jsx)(`span`,{className:`text-muted-foreground`,children:y(n?`stopping`:`saving`)}),(0,w.jsxs)(`span`,{className:`tabular-nums`,children:[X(r),` / `,X(t)]})]}),(0,w.jsx)(`div`,{role:`progressbar`,"aria-label":y(`rowsSaved`),"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":t,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width]`,style:{width:`${t>0?Math.min(100,r/t*100):0}%`}})})]})},Be=({result:e,stopped:t,headers:n,fileName:r})=>(0,w.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[t!==void 0&&(0,w.jsx)(ee,{title:y(`stopped`),error:t}),e.cancelled&&(0,w.jsx)(`p`,{role:`status`,children:y(`cancelled`)}),(0,w.jsx)(T,{label:y(`summary`),counts:[[y(`created`),e.created],[y(`updated`),e.updated],[y(`skipped`),e.skipped],[y(`failed`),e.failed]]}),e.notWritten.length>0&&(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,w.jsx)(`h3`,{className:`font-medium`,children:y(`rowsNotImported`)}),(0,w.jsxs)(u,{size:`sm`,onClick:()=>K(r,n,e.notWritten),children:[(0,w.jsx)(i,{className:`size-3.5`}),y(`download`)]})]}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:y(`notWrittenHint`)}),(0,w.jsx)(q,{rows:[...e.notWritten].sort((e,t)=>e.line-t.line)})]})]}),Ve=a(),Z=100,Q=e=>String(e),He=e=>{let t=new Map,n=(e,n)=>{let r=`${e}.${n}`;return t.has(r)||t.set(r,new Map),t.get(r)};return{load:async(t,r,i)=>{let a=n(t.name,r),o=[...new Map(i.filter(e=>!a.has(Q(e))).map(e=>[Q(e),e])).values()],s=t.primaryKey[0];for(let n=0;n<o.length;n+=Z){let i=o.slice(n,n+Z);for(let e of i)a.set(Q(e),[]);let c=l(Ve.in(r,i)),u;do{let n=await e(t.name).list(t.name,{filter:c,fields:[...new Set([s,r])],pageSize:1e3,pageToken:u});for(let e of n.items)a.get(Q(e[r]))?.push(e[s]);u=n.nextPageToken||void 0}while(u)}},keysOf:(e,t,r)=>n(e,t).get(Q(r))??[]}},Ue=500,$=()=>{let e=new Worker(new URL(`/assets/parse-worker-CO_GFfU7.js`,``+import.meta.url),{type:`module`}),t=[],n;return e.onmessage=e=>{if(n){let t=n;n=void 0,t(e.data)}else t.push(e.data)},e.onerror=e=>{e.preventDefault();let r={type:`error`,message:y(`unreadable`)};n?n(r):t.push(r)},{send:t=>e.postMessage(t),receive:()=>t.length>0?Promise.resolve(t.shift()):new Promise(e=>n=e),stop:()=>e.terminate()}},We=e=>({sheets:async()=>{let t=$();try{t.send({type:`sheets`,file:e,locale:d()});let n=await t.receive();if(n.type===`error`)throw Error(n.message);if(n.type!==`sheets`)throw Error(`The parse worker answered ${n.type} to a request for sheets`);return n.sheets}finally{t.stop()}},rows:async function*(t){let n=$();try{for(n.send({type:`read`,file:e,sheet:t,chunk:Ue,locale:d()});;){let e=await n.receive();if(e.type===`error`)throw Error(e.message);if(e.type===`end`)return;if(e.type!==`rows`)throw Error(`The parse worker answered ${e.type} to a read`);yield e.rows,n.send({type:`next`})}}finally{n.stop()}}});export{k as _,Y as a,Me as c,je as d,le as f,O as g,ce as h,Be as i,ke as l,oe as m,He as n,J as o,E as p,ze as r,Ne as s,We as t,Oe as u,ue as v};
3
- //# debugId=085f2cc8-c8ef-4c2a-b422-98fa80351388
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{$l as r,Jc as i,M as a,Pc as o,Qs as s,al as c,hc as l,hl as u,ml as d,ol as f,pc as p,qc as m,tu as h,uo as g,xi as _,yr as ee}from"./app-2d0YQdR7.js";import{c as v,d as y,l as te,o as b,u as x}from"./list-page-Do4wAJXr.js";var S={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};S.node;var ne=m(S),C=e(t(),1),w=e(n(),1),re=e=>/[",\r\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,ie=(e,t)=>{let n=[...t].sort((e,t)=>e.line-t.line).map(t=>[...e.map((e,n)=>b(t.cells[n]??null)),String(t.line),t.problems.join(`; `)]);return`${[[...e,y(`line`),y(`problems`)],...n].map(e=>e.map(re).join(`,`)).join(`\r
2
+ `)}\r\n`},T=({label:e,counts:t})=>(0,w.jsx)(`dl`,{"aria-label":e,className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:t.map(([e,t])=>(0,w.jsxs)(`div`,{className:`rounded-lg border px-3 py-2`,children:[(0,w.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:e}),(0,w.jsx)(`dd`,{className:`text-lg font-semibold tabular-nums`,children:t.toLocaleString(f())})]},e))}),E=(e,t)=>e?.fields[t]?.label??u(t),ae=new Set([`text`,`integer`,`bigint`,`decimal`,`boolean`,`date`,`timestamp`,`uuid`,`enum`,`relation`,`currency`,`country`]),D=(e,t)=>{let n=e.relation?t[e.relation.resource]:void 0;return n?.primaryKey.length===1?n:void 0},oe=(e,t,{json:n=!1}={})=>Object.values(e.fields).filter(r=>r.readOnly||r.name===e.tenant?!1:r.type===`json`?n:ae.has(r.type)?r.type!==`relation`||D(r,t)!==void 0:!1),se=new Set([`text`,`integer`,`bigint`,`uuid`,`date`,`currency`,`country`,`enum`]),ce=e=>{let t=e.primaryKey.length===1?[e.fields[e.primaryKey[0]]]:[],n=Object.values(e.fields).filter(t=>t.filterable&&!t.sensitive&&se.has(t.type)&&!e.primaryKey.includes(t.name));return[...t,...n]},O=(e,t)=>D(e,t),k=e=>!e.nullable&&!e.default,A=e=>e.toLowerCase().replace(/[\s_-]+/g,``),le=(e,t,n)=>{let r=new Set;return e.flatMap((e,i)=>{let a=A(e);if(a===``)return[];let o=t.find(e=>!r.has(e.name)&&(A(E(n,e.name))===a||A(e.name)===a));return o?(r.add(o.name),[{column:i,field:o.name}]):[]})},ue=(e,t,n)=>{if(e===`update`)return[];let r=new Set(n.map(e=>e.field));return t.filter(e=>k(e)&&!r.has(e.name))},j=e=>({ok:!0,value:e}),M=e=>({ok:!1,problem:e}),N=e=>`“${b(e)}”`,P=(e,t)=>{if(typeof e==`number`)return String(e);if(typeof e==`string`)return a(e,t.decimal)},de=(e,t,n)=>{let r=P(t,n);if(r===void 0)return M(y(`notNumber`,{cell:N(t)}));let[i,a=``]=r.split(`.`);if(/[1-9]/.test(a)||/e/i.test(r))return M(y(`notWholeNumber`,{cell:N(t)}));if(e.type===`bigint`)return j(String(BigInt(i)));let o=Number(i);return Number.isSafeInteger(o)?j(o):M(y(`tooLarge`,{cell:N(t)}))},fe=(e,t)=>{let n=P(e,t);return n===void 0?M(y(`notNumber`,{cell:N(e)})):j(n)},pe=new Set([`true`,`yes`,`1`]),me=new Set([`false`,`no`,`0`]),he=e=>{if(typeof e==`boolean`)return j(e);let t=typeof e==`string`||typeof e==`number`?String(e).trim().toLowerCase():``;return pe.has(t)?j(!0):me.has(t)?j(!1):M(y(`notBoolean`,{cell:N(e)}))},F=e=>String(e).padStart(2,`0`),ge=(e,t,n)=>{let r=new Date(Date.UTC(e,t-1,n));if(r.getUTCFullYear()===e&&r.getUTCMonth()===t-1&&r.getUTCDate()===n)return`${e}-${F(t)}-${F(n)}`},I=`(\\d{1,2}):(\\d{2})(?::(\\d{2})(?:\\.\\d+)?)?`,L=(e,t)=>{let n=RegExp(`^(\\d{4})[-/](\\d{1,2})[-/](\\d{1,2})(?:[T ]${I}(Z|[+-]\\d{2}:?\\d{2})?)?$`).exec(e.trim()),r=RegExp(`^(\\d{1,2})[./-](\\d{1,2})[./-](\\d{4})(?: ${I})?$`).exec(e.trim());if(!n&&!r)return;let[i,a,o]=n?[n[1],n[2],n[3]].map(Number):t===`dmy`?[r[3],r[2],r[1]].map(Number):[r[3],r[1],r[2]].map(Number),s=ge(i,a,o);if(!s)return;let[c,l,u=`0`]=n?n.slice(4,7):r.slice(4,7);if(c===void 0)return{date:s};if(!(Number(c)>23||Number(l)>59||Number(u)>59))return{date:s,time:`${F(Number(c))}:${l}:${F(Number(u))}`,zone:n?.[7]}},R=(e,t)=>{if(te(e)){let[t,n]=e.date.split(`T`);return{date:t,time:n}}return typeof e==`string`?L(e,t.dateOrder):void 0},z=(e,t)=>M(y(`notDate`,{cell:N(e),dayFirst:t.dateOrder===`dmy`})),_e=(e,t)=>{let n=R(e,t);return n?n.time&&n.time!==`00:00:00`?M(y(`hasTime`,{cell:N(e)})):j(n.date):z(e,t)},ve=(e,t)=>{let n=R(e,t);if(!n)return z(e,t);if(n.zone)return j(new Date(`${n.date}T${n.time}${n.zone===`Z`?`Z`:n.zone.replace(/^([+-]\d{2})(\d{2})$/,`$1:$2`)}`).toISOString());let[r,i,a]=n.date.split(`-`).map(Number),[o,s,c]=(n.time??`00:00:00`).split(`:`).map(Number);return j(new Date(r,i-1,a,o,s,c).toISOString())},B=e=>e.trim().toLowerCase().replace(/\s+/g,` `),ye=(e,t,n)=>{let r=e.enumValues??[],i=B(b(n)),a=r.filter(e=>B(e)===i||B(d(e,t?.valueLabels))===i);return a.length===1?j(a[0]):a.length>1?M(y(`severalValues`,{cell:N(n),values:a.map(e=>d(e,t?.valueLabels)).join(`, `)})):M(y(`notOneOf`,{cell:N(n),values:r.map(e=>d(e,t?.valueLabels)).join(`, `)}))},be=(e,t)=>typeof e==`boolean`&&!t.booleanText?M(y(`notText`,{cell:N(e)})):j(b(e)),xe=e=>x(e)?j(e.json):j(e),V=(e,t,n,r)=>{if(v(n))return e.nullable?j(null):M(y(`emptyRequired`));if(e.type===`json`)return xe(n);if(x(n))return M(y(`nestedValue`,{cell:N(n)}));switch(e.type){case`integer`:case`bigint`:return de(e,n,r);case`decimal`:return fe(n,r);case`boolean`:return he(n);case`date`:return _e(n,r);case`timestamp`:return ve(n,r);case`enum`:return ye(e,t,n);case`text`:case`uuid`:case`currency`:case`country`:return be(n,r);default:throw Error(`Not implemented: importing ${e.type} fields, which importableFields leaves out`)}},Se=(e,t)=>e[t]?.names?.singular??u(t),Ce=(e,t)=>e[t]?.names?.plural??u(t),we=(e,t,n)=>{let{model:r,resources:i,views:a}=n,o=a[r.name],s={},c={},l=[],u=[];for(let{column:n,field:d,matchBy:f}of t.columns){let p=r.fields[d],m=e.cells[n]??null,h=E(o,d),g=O(p,i);if(g&&!v(m)){let e=f??g.primaryKey[0],n=V(g.fields[e],a[g.name]?.fields[e],m,t.options);n.ok?u.push({field:d,finding:{model:g,field:e,value:n.value}}):l.push(`${h}: ${n.problem}`),s[d]=b(m);continue}let _=V(p,o?.fields[d],m,t.options);_.ok?c[d]=s[d]=_.value:l.push(`${h}: ${_.problem}`)}let d;if(t.match&&t.mode!==`create`){let n=r.fields[t.match.field],i=V({...n,nullable:!1},o?.fields[n.name],e.cells[t.match.column]??null,t.options);i.ok?d={model:r,field:n.name,value:i.value}:l.push(`${E(o,n.name)}: ${i.problem}`)}return{values:s,data:c,problems:l,relations:u,match:d}},H=(e,t)=>{let n=e.lookups.keysOf(t.model.name,t.field,t.value),r=`${E(e.views[t.model.name],t.field).toLowerCase()} “${String(t.value)}”`;return n.length===1?{key:n[0]}:n.length===0?{none:y(`noneHas`,{singular:Se(e.views,t.model.name),named:r})}:{several:y(`severalHave`,{count:n.length,plural:Ce(e.views,t.model.name),named:r})}},Te=e=>e.cells.every(v),U=async(e,t,n)=>{let{model:r,views:i}=n,a=e.filter(e=>!Te(e)).map(e=>({row:e,...we(e,t,n)})),o=new Map;for(let e of a.flatMap(e=>[...e.relations.map(e=>e.finding),...e.match?[e.match]:[]])){let t=`${e.model.name}.${e.field}`;o.has(t)||o.set(t,{model:e.model,field:e.field,values:[]}),o.get(t).values.push(e.value)}for(let{model:e,field:t,values:r}of o.values())await n.lookups.load(e,t,r);return a.map(({row:e,values:a,data:o,problems:s,relations:c,match:l})=>{let u={...o};for(let{field:e,finding:t}of c){let a=H(n,t);`key`in a?u[e]=a.key:s.push(`${E(i[r.name],e)}: ${a.none??a.several}`)}let d=l&&H(n,l);d?.several&&s.push(y(`notOneRecord`,{found:d.several})),d?.none&&t.mode===`update`&&s.push(y(`nothingToUpdate`,{found:d.none}));let f={line:e.line,cells:e.cells,values:a,problems:s};return s.length>0?f:d&&`key`in d?{...f,op:{op:`update`,resource:r.name,key:d.key,etag:`*`,data:u}}:{...f,op:{op:`create`,resource:r.name,data:u}}})},Ee=5,De=5,Oe=async(e,t)=>{let n=e.rows(t),{value:r=[]}=await n.next();await n.return(void 0);let[i,...a]=r;return{headers:(i?.cells??[]).map(b),sample:a.slice(0,Ee)}};async function*W(e,t){let n=!0;for await(let r of e.rows(t))yield n?r.slice(1):r,n=!1}var ke=async(e,t,n,r,i,a)=>{let o={rows:0,creates:0,updates:0,problems:[],preview:[]};for await(let s of W(e,t)){a?.throwIfAborted();for(let e of await U(s,n,r))o.rows++,o.preview.length<De&&o.preview.push(e),e.op?.op===`create`?o.creates++:e.op?.op===`update`?o.updates++:o.problems.push({line:e.line,cells:e.cells,problems:e.problems});i(o.rows)}return o},Ae=(e,t)=>{if(!s(e))return[e.message];let n=e.errors.filter(e=>e.field);return n.length===0?[e.message]:n.map(e=>`${E(t.views[t.model.name],e.field)}: ${e.message}`)},je=async(e,t,n,r,{client:i,onProgress:a,cancelled:o})=>{let c={created:0,updated:0,skipped:0,failed:0,notWritten:[]},l=async e=>{let t=[...e];for(;t.length>0;){let e=t.map(e=>e.op);try{let{results:t}=await i.batchWrite(e);for(let e of t)e.op===`create`?c.created++:e.op===`update`&&c.updated++;return}catch(e){let n=s(e)?e.operation:void 0;if(n===void 0||!t[n])throw e;let[i]=t.splice(n,1);c.failed++,c.notWritten.push({line:i.line,cells:i.cells,problems:Ae(e,r)})}}},u=[],d=async e=>{for(;u.length>=100||e&&u.length>0;){if(o())return!1;await l(u.splice(0,100)),a({...c})}return!0};for await(let i of W(e,t)){for(let e of await U(i,n,r))e.op?u.push(e):(c.skipped++,c.notWritten.push({line:e.line,cells:e.cells,problems:e.problems}));if(!await d(!1))return{...c,cancelled:!0}}return await d(!0)?{...c,cancelled:!1}:{...c,cancelled:!0}},G=50,K=(e,t,n)=>g(ie(t,n),y(`notImportedFile`,{name:(e??`import`).replace(/\.[^.]+$/,``)}),`text/csv`),q=({rows:e})=>(0,w.jsxs)(`ul`,{"aria-label":y(`rowsNotImported`),className:`flex flex-col gap-1 text-body`,children:[e.slice(0,G).map(e=>(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`span`,{className:`font-medium`,children:y(`rowProblems`,{line:e.line})}),` `,e.problems.join(`; `)]},e.line)),e.length>G&&(0,w.jsx)(`li`,{className:`text-muted-foreground`,children:y(`andMore`,{count:(e.length-G).toLocaleString(f())})})]}),Me=({rows:e})=>(0,w.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,w.jsx)(l,{className:`size-3.5`}),y(`checkingRows`,{count:e.toLocaleString(f())})]}),Ne=({check:e,model:t,resources:n,views:r,columns:i,headers:a,fileName:s})=>{let c=r[t.name],l=i.map(e=>t.fields[e.field]);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,w.jsx)(T,{label:y(`check`),counts:[[y(`rows`),e.rows],[y(`toCreate`),e.creates],[y(`toUpdate`),e.updates],[y(`withProblems`),e.problems.length]]}),e.preview.length>0&&(0,w.jsx)(`div`,{className:`overflow-x-auto rounded-lg border`,children:(0,w.jsxs)(`table`,{"aria-label":y(`firstRows`),className:`w-full text-left text-body`,children:[(0,w.jsx)(`thead`,{className:`bg-muted text-muted-foreground`,children:(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{className:`px-2 py-1.5 font-medium`,children:y(`row`)}),l.map(e=>(0,w.jsx)(`th`,{className:`whitespace-nowrap px-2 py-1.5 font-medium`,children:E(c,e.name)},e.name))]})}),(0,w.jsx)(`tbody`,{className:`divide-y`,children:e.preview.map(e=>(0,w.jsxs)(`tr`,{className:e.problems.length>0?`bg-danger-soft`:void 0,children:[(0,w.jsx)(`td`,{className:`px-2 py-1.5 tabular-nums text-muted-foreground`,children:e.line}),l.map(t=>(0,w.jsx)(`td`,{className:`max-w-48 truncate px-2 py-1.5`,children:O(t,n)?String(e.values[t.name]??`—`):t.name in e.values?_(t,e.values[t.name],c?.fields[t.name]):``},t.name))]},e.line))})]})}),e.problems.length>0&&(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,w.jsx)(`h3`,{className:`font-medium`,children:y(`problemRows`)}),(0,w.jsxs)(p,{size:`sm`,onClick:()=>K(s,a,e.problems),children:[(0,w.jsx)(o,{className:`size-3.5`}),y(`download`)]})]}),(0,w.jsx)(q,{rows:e.problems})]}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:y(`batches`,{size:100})})]})},Pe=[`.xlsx`,`.csv`,`.json`],Fe=[`text/csv`,`application/json`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],Ie=[`text/comma-separated-values`,`application/csv`,`text/x-csv`,`application/vnd.ms-excel`,`text/plain`,`application/octet-stream`],Le=e=>/\bAndroid\b/.test(e),Re=e=>[...Pe,...Fe,...Le(e)?Ie:[]].join(`,`),J=({label:e,name:t,value:n,options:r,onChange:a,help:o,className:s})=>{let c=(0,C.useId)();return(0,w.jsxs)(`div`,{className:i(`flex min-w-0 flex-col gap-1.5`,s),children:[(0,w.jsx)(`label`,{htmlFor:c,className:`font-medium`,children:e}),(0,w.jsx)(`select`,{id:c,"aria-label":t,value:n,onChange:e=>a(e.target.value),className:`h-8 w-full min-w-0 rounded-md border border-border-strong bg-background px-2 shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20 max-sm:min-h-11`,children:r.map(e=>(0,w.jsx)(`option`,{value:e.value,children:e.label},e.value))}),o&&(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o})]})},Y=({file:e,sheets:t,sheet:n,reading:r,onChoose:i,onSheet:a})=>{let o=(0,C.useId)();return(0,w.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,w.jsx)(`label`,{htmlFor:o,className:`font-medium`,children:y(`file`)}),(0,w.jsx)(`input`,{id:o,type:`file`,accept:Re(globalThis.navigator?.userAgent??``),disabled:r,onChange:e=>{let t=e.target.files?.[0];t&&i(t)},className:`file:mr-3 file:h-8 file:rounded-md file:border file:border-border-strong file:bg-background file:px-3 file:font-medium file:text-foreground max-sm:file:min-h-11`}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:y(`fileHint`)})]}),r&&(0,w.jsxs)(`p`,{className:`flex items-center gap-2 text-muted-foreground`,role:`status`,children:[(0,w.jsx)(l,{className:`size-3.5`}),y(`reading`,{name:e?.name??y(`theFile`)})]}),!r&&t.length>1&&(0,w.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,w.jsx)(ne,{className:`mb-2 size-4 shrink-0 text-muted-foreground`}),(0,w.jsx)(J,{className:`flex-1`,label:y(`sheet`),value:n??``,options:t.map(e=>({value:e,label:e})),onChange:a})]})]})},X=e=>e.toLocaleString(f()),ze=({progress:e,total:t,cancelling:n})=>{let r=e.created+e.updated+e.failed;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,w.jsx)(`span`,{className:`text-muted-foreground`,children:y(n?`stopping`:`saving`)}),(0,w.jsxs)(`span`,{className:`tabular-nums`,children:[X(r),` / `,X(t)]})]}),(0,w.jsx)(`div`,{role:`progressbar`,"aria-label":y(`rowsSaved`),"aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":t,className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,w.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width]`,style:{width:`${t>0?Math.min(100,r/t*100):0}%`}})})]})},Be=({result:e,stopped:t,headers:n,fileName:r})=>(0,w.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[t!==void 0&&(0,w.jsx)(ee,{title:y(`stopped`),error:t}),e.cancelled&&(0,w.jsx)(`p`,{role:`status`,children:y(`cancelled`)}),(0,w.jsx)(T,{label:y(`summary`),counts:[[y(`created`),e.created],[y(`updated`),e.updated],[y(`skipped`),e.skipped],[y(`failed`),e.failed]]}),e.notWritten.length>0&&(0,w.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,w.jsx)(`h3`,{className:`font-medium`,children:y(`rowsNotImported`)}),(0,w.jsxs)(p,{size:`sm`,onClick:()=>K(r,n,e.notWritten),children:[(0,w.jsx)(o,{className:`size-3.5`}),y(`download`)]})]}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:y(`notWrittenHint`)}),(0,w.jsx)(q,{rows:[...e.notWritten].sort((e,t)=>e.line-t.line)})]})]}),Ve=r(),Z=100,Q=e=>String(e),He=e=>{let t=new Map,n=(e,n)=>{let r=`${e}.${n}`;return t.has(r)||t.set(r,new Map),t.get(r)};return{load:async(t,r,i)=>{let a=n(t.name,r),o=[...new Map(i.filter(e=>!a.has(Q(e))).map(e=>[Q(e),e])).values()],s=t.primaryKey[0];for(let n=0;n<o.length;n+=Z){let i=o.slice(n,n+Z);for(let e of i)a.set(Q(e),[]);let c=h(Ve.in(r,i)),l;do{let n=await e(t.name).list(t.name,{filter:c,fields:[...new Set([s,r])],pageSize:1e3,pageToken:l});for(let e of n.items)a.get(Q(e[r]))?.push(e[s]);l=n.nextPageToken||void 0}while(l)}},keysOf:(e,t,r)=>n(e,t).get(Q(r))??[]}},Ue=500,$=()=>{let e=new Worker(new URL(`/assets/parse-worker-BXZM3e8_.js`,``+import.meta.url),{type:`module`}),t=[],n;return e.onmessage=e=>{if(n){let t=n;n=void 0,t(e.data)}else t.push(e.data)},e.onerror=e=>{e.preventDefault();let r={type:`error`,message:y(`unreadable`)};n?n(r):t.push(r)},{send:t=>e.postMessage(t),receive:()=>t.length>0?Promise.resolve(t.shift()):new Promise(e=>n=e),stop:()=>e.terminate()}},We=e=>({sheets:async()=>{let t=$();try{t.send({type:`sheets`,file:e,locale:c()});let n=await t.receive();if(n.type===`error`)throw Error(n.message);if(n.type!==`sheets`)throw Error(`The parse worker answered ${n.type} to a request for sheets`);return n.sheets}finally{t.stop()}},rows:async function*(t){let n=$();try{for(n.send({type:`read`,file:e,sheet:t,chunk:Ue,locale:c()});;){let e=await n.receive();if(e.type===`error`)throw Error(e.message);if(e.type===`end`)return;if(e.type!==`rows`)throw Error(`The parse worker answered ${e.type} to a read`);yield e.rows,n.send({type:`next`})}}finally{n.stop()}}});export{k as _,Y as a,Me as c,je as d,le as f,O as g,ce as h,Be as i,ke as l,oe as m,He as n,J as o,E as p,ze as r,Ne as s,We as t,Oe as u,ue as v};
3
+ //# debugId=3167d977-14b9-44a7-bff7-c6540077ca32
@@ -0,0 +1,2 @@
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t,t as n}from"./react-CuiNlnus.js";import{Jc as r,Os as i,Ts as a,as as o,es as s,hc as c,ol as l,pc as u,rs as d,ta as f,ts as p,ws as m}from"./app-2d0YQdR7.js";import{t as h}from"./page-header-Ddz2r5ic.js";var g=e(t(),1),_=()=>[{value:`allowed`,label:m(`on`)},{value:`forbidden`,label:m(`off`)}],v=()=>[{value:`allowed`,label:m(`optional`)},{value:`required`,label:m(`required`)},{value:`forbidden`,label:m(`off`)}],y=()=>[{method:`password`,label:m(`password`),description:m(`passwordDescription`),rules:_()},{method:`emailCode`,label:m(`emailedSignInCode`),description:m(`emailedSignInCodeDescription`),rules:_()},{method:`passkey`,label:m(`passkeys`),description:m(`passkeysPolicyDescription`),rules:v()},{method:`twoFactor`,label:m(`twoFactor`),description:m(`twoFactorPolicyDescription`),rules:v()},{method:`staffAccess`,label:m(`staffAccess`),description:m(`staffAccessDescription`),rules:[{value:`allowed`,label:m(`on`)},{value:`notify`,label:m(`emailThePerson`)},{value:`forbidden`,label:m(`off`)}]},{method:`platformSignIn`,label:m(`platformSignIn`),description:m(`platformSignInDescription`),rules:_()}],b=(e,t)=>{let n=y().find(t=>t.method===e)?.rules.find(e=>e.value===t)?.label;if(n===void 0)throw Error(`No label for the ${t} rule of ${e}`);return n},x=e(n(),1),S=({row:e,value:t,onChange:n})=>(0,x.jsx)(`span`,{role:`radiogroup`,"aria-label":e.label,className:`inline-flex h-8 shrink-0 rounded-md bg-muted p-0.5`,children:e.rules.map(e=>(0,x.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e.value===t,onClick:()=>n(e.value),className:r(`rounded px-3 text-body font-medium transition-colors`,e.value===t?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:e.label},e.value))}),C=({method:e},t,{mail:n,effective:r,policy:i})=>{if(e===`emailCode`&&!n)return m(`codeNeedsMail`);if(e===`password`&&!n&&t.password===`forbidden`)return m(`passwordStaysOn`);if(e===`staffAccess`&&!n&&t.staffAccess===`notify`)return m(`staffNeedsMail`);if(e===`platformSignIn`&&t.platformSignIn===`allowed`&&t.passkey===`required`)return m(`platformOff`);if(t[e]===i[e]&&r[e]!==i[e])return m(`appliesAs`,{rule:b(e,r[e])})},w=({operator:e,platformProviders:t=[]})=>y().flatMap(n=>n.method===`staffAccess`&&!e?[]:n.method===`platformSignIn`?t.length>0?[{...n,label:m(`platformSignInWith`,{provider:new Intl.ListFormat(l(),{type:`conjunction`}).format(t)})}]:[]:[n]),T=({state:e,onSave:t,busy:n,error:r,notice:i})=>{let[a,o]=(0,g.useState)(e.policy),s=w(e),c=s.some(({method:t})=>a[t]!==e.policy[t]);return(0,x.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),t(a)},children:[(0,x.jsx)(`ul`,{className:`divide-y rounded-lg border bg-background`,children:s.map(t=>{let n=C(t,a,e);return(0,x.jsxs)(`li`,{className:`flex flex-col gap-3 p-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`h2`,{className:`font-semibold`,children:t.label}),(0,x.jsx)(`p`,{className:`mt-0.5 text-muted-foreground`,children:t.description}),n&&(0,x.jsx)(`p`,{className:`mt-1.5 text-xs font-medium text-warning-text`,children:n})]}),(0,x.jsx)(S,{row:t,value:a[t.method],onChange:e=>o({...a,[t.method]:e})})]},t.method)})}),r&&(0,x.jsx)(`p`,{role:`alert`,className:`rounded-md bg-danger-soft px-3 py-2 text-body font-medium text-danger-text`,children:r}),i&&!c&&(0,x.jsx)(`p`,{role:`status`,className:`rounded-md bg-success-soft px-3 py-2 text-body font-medium text-success-text`,children:i}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.savedAt?e.savedBy?m(`lastSavedBy`,{name:e.savedBy,time:f(Date.parse(e.savedAt))}):m(`lastSaved`,{time:f(Date.parse(e.savedAt))}):m(`neverChanged`)}),(0,x.jsxs)(`div`,{className:`flex gap-2`,children:[c&&(0,x.jsx)(u,{onClick:()=>o(e.policy),children:m(`reset`)}),(0,x.jsx)(u,{variant:`primary`,type:`submit`,loading:n,disabled:!c,children:m(`save`)})]})]})]})},E=(e,t)=>e.endedAt?(0,x.jsx)(d,{tone:`neutral`,children:m(`stopped`,{time:f(Date.parse(e.endedAt))})}):Date.parse(e.expiresAt)<=t?(0,x.jsx)(d,{tone:`neutral`,children:m(`ended`,{time:f(Date.parse(e.expiresAt))})}):(0,x.jsx)(d,{tone:`amber`,children:m(`signedInUntil`,{time:f(Date.parse(e.expiresAt))})}),D=({signIns:e,operator:t,error:n,now:r=Date.now()})=>(0,x.jsxs)(s,{title:m(`staffSignIns`),description:m(`staffSignInsDescription`,{operator:t}),children:[(0,x.jsx)(p,{message:n}),e&&e.length===0&&(0,x.jsx)(`p`,{className:`text-muted-foreground`,children:m(`noStaffSignIns`)}),e&&e.length>0&&(0,x.jsx)(`ul`,{className:`divide-y rounded-md border`,children:e.map(e=>(0,x.jsxs)(`li`,{className:`flex flex-col gap-1.5 p-3`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,x.jsx)(`span`,{className:`font-medium break-all`,children:e.staffName?`${e.staffName} (${e.staff})`:e.staff}),(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:m(`as`)}),(0,x.jsx)(`span`,{className:`font-medium break-all`,children:e.user})]}),(0,x.jsx)(`p`,{className:`break-words`,children:e.reason}),(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,x.jsx)(`span`,{children:f(Date.parse(e.startedAt))}),E(e,r)]})]},e.id))})]}),O=({operator:e})=>{let{session:t}=a(),[n,r]=(0,g.useState)(),[s,c]=(0,g.useState)();return(0,g.useEffect)(()=>{t.staff.log().then(r,e=>c(e instanceof i?o(e):m(`couldNotReadStaffSignIns`)))},[t]),(0,x.jsx)(D,{operator:e,signIns:n,error:s})},k=()=>{let{session:e}=a(),[t,n]=(0,g.useState)(),[r,s]=(0,g.useState)(!1),[l,u]=(0,g.useState)(),[d,f]=(0,g.useState)();(0,g.useEffect)(()=>{e.signInPolicy.read().then(n,e=>u(e instanceof i?o(e):m(`couldNotReadPolicy`)))},[e]);let p=async t=>{s(!0),u(void 0),f(void 0);try{n(await e.signInPolicy.save(t)),f(m(`policySaved`))}catch(e){if(!(e instanceof i))throw e;u(o(e))}s(!1)};return(0,x.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6`,children:[(0,x.jsx)(h,{title:m(`signInPolicy`),subtitle:m(`policySubtitle`)}),t?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{state:t,busy:r,error:l,notice:d,onSave:e=>void p(e)},t.savedAt??`default`),t.operator&&(0,x.jsx)(O,{operator:t.operator})]}):l?(0,x.jsx)(`p`,{role:`alert`,className:`text-danger-text`,children:l}):(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,x.jsx)(c,{}),` `,m(`loading`)]})]})};export{k as SignInPolicyPage};
2
+ //# debugId=542b0bd5-146f-4eab-b31c-52373e470014
@@ -0,0 +1,2 @@
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t}from"./react-CuiNlnus.js";import{$n as n,As as r,Ca as i,Fs as a,Ko as o,Ks as s,La as c,Ns as l,Rr as u,an as d,ar as f,cs as p,fn as m,fr as h,hs as g,jr as _,mn as v,on as y,pn as b,rr as x,sn as S,ur as C}from"./app-2d0YQdR7.js";import{h as w}from"./vendor-t7Q7QbPu.js";import{S as T,ht as E,r as D}from"./embedded-list-BIvBUQCm.js";import{n as O}from"./record-preview-CDgsSTFF.js";var k=e(t(),1),A=e=>({queryKey:e.queryKey,start:t=>t.prefetchQuery(e)}),j=e=>({queryKey:e.queryKey,start:t=>t.prefetchInfiniteQuery(e)}),M={Table:(e,t,n)=>{let{resource:r,filter:o=``,sort:s=``,columns:c,button:l,bulk:u=!1,limit:f=10,select:p}=y(e),m=r===void 0?void 0:n.resources[r];if(!m)return[];if(t.part===`chosen`){let e=p===void 0?void 0:n.given[p];return e?[A(b(n.client,m,{key:e}))]:[]}let h=n.views[m.name],{fields:g,read:_}=S({...n,model:m,view:h,columns:c?.map(a),button:l,bulk:u,phoneColumns:d(c)});return[A(D(n,{model:m,filter:o,orderBy:s||i(m,h),limit:f,fields:g,read:_}))]},Chart:(e,t,{client:n,resources:r,views:i})=>{let{resource:a,groupBy:o,splitBy:s,sum:c,average:l,filter:u,granularity:d,range:f,limit:p}=y(e),m=r[a],h=m&&E({model:m,groupBy:o,splitBy:s,sum:c,average:l,filter:u,granularity:d,range:f,limit:p},r,i);return m&&h?[A(_(n,m.name,h))]:[]},RecordCards:(e,t,{client:n,resources:r,views:a})=>{let{resource:o,filter:s=``,sort:c=``,limit:l=10}=y(e),u=r[o];if(!u)return[];let d=c||i(u,a[u.name]);return[A(v(n,u,{filter:s,sort:d,pageSize:l})),A(m(n,u,s))]},RecordRow:(e,t,{client:n,queryClient:r,resources:i,views:a})=>{let{resource:o,filter:s=``,sort:c=``}=y(e),l=i[o];if(!l)return[];let u=a[l.name];return u?.searchesOf||u?.listOf!==void 0?[]:[A(O({queryClient:r,client:n,resources:i,views:a,model:l,...T(l,u,{filter:s,sort:c})}))]},Thread:(e,t,{client:r,resources:i,views:a})=>{let{resource:o,filter:c,sender:l,time:d,calls:f,limit:p=50}=y(e);if(t.part===`calls`){let e=f&&i[f.resource];return e?[j(u(r,e.name,{filter:f.filter,orderBy:s(f.time),pageSize:p}))]:[]}let m=i[o];if(!m)return[];let h=n(i,a,m,l===void 0?[]:[l]);return[j(u(r,m.name,{filter:c,orderBy:s(d),pageSize:p,labels:h}))]}},N=(e,t,{client:n,resources:r})=>{let i=r[t.resource];return i?[A(m(n,i))]:[]},P=(e,t,n)=>(n?.reads??[]).flatMap(n=>{let i=l(t,n.block);if(!i||i.custom)return[];if(n.part===`condition`)return N(i,n,e);if(n.split)return[];let a=M[i.type];return a?a(r(i,{stack:[],params:e.params,...e.root&&{root:e.root}}),n,e):[]}),F=({tree:e,plan:t})=>{let n=g(),r=w(),{resources:i,views:a}=p(),s=c().fields,l=o(),u=x(),d=f(),m=C(h()),_=(0,k.useMemo)(()=>P({client:n,queryClient:r,resources:i,views:a,fieldTypes:s,xs:l,params:u,given:d,...m&&{root:m}},e,t),[n,r,i,a,s,l,u,d,m,e,t]);return(0,k.useEffect)(()=>{for(let e of _)e.start(r)},[_,r]),null};export{F as t};
2
+ //# debugId=2cd5e2d7-1e95-45c8-a68c-fd70bb337775