@protobase/ui 0.120.0 → 0.121.1

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 (264) hide show
  1. package/dist/account/blocks/personal-mail-block.js +4 -0
  2. package/dist/account/messages.d.ts +2 -2
  3. package/dist/activity-chart/messages.d.ts +2 -2
  4. package/dist/app/charts/messages.d.ts +2 -2
  5. package/dist/app/comments/messages.d.ts +2 -2
  6. package/dist/app/conversation/messages.d.ts +2 -2
  7. package/dist/app/conversation/thread-state.d.ts +1 -1
  8. package/dist/app/conversation-page/messages.d.ts +2 -2
  9. package/dist/app/create/messages.d.ts +2 -2
  10. package/dist/app/delete/messages.d.ts +2 -2
  11. package/dist/app/displays/messages.d.ts +2 -2
  12. package/dist/app/embedded-list/messages.d.ts +2 -2
  13. package/dist/app/export/builder.js +2 -1
  14. package/dist/app/export/messages.d.ts +2 -2
  15. package/dist/app/field-editor.js +8 -1
  16. package/dist/app/field-errors.js +2 -1
  17. package/dist/app/field-messages.d.ts +2 -2
  18. package/dist/app/field-types/custom-step-container/messages.d.ts +2 -2
  19. package/dist/app/field-types/workflow/messages.d.ts +2 -2
  20. package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
  21. package/dist/app/field-types/workflow-page/workbench-bar.js +1 -1
  22. package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
  23. package/dist/app/focus/messages.d.ts +2 -2
  24. package/dist/app/gallery/gallery-layout.d.ts +2 -2
  25. package/dist/app/gallery/messages.d.ts +2 -2
  26. package/dist/app/hand-order/messages.d.ts +2 -2
  27. package/dist/app/history/messages.d.ts +2 -2
  28. package/dist/app/import/messages.d.ts +2 -2
  29. package/dist/app/messages.d.ts +2 -2
  30. package/dist/app/pages/field-value.d.ts +1 -1
  31. package/dist/app/pages/field-value.js +3 -1
  32. package/dist/app/pages/messages.d.ts +2 -2
  33. package/dist/app/record-chart/messages.d.ts +2 -2
  34. package/dist/app/record-messages.d.ts +2 -2
  35. package/dist/app/record-mode/shown-layout.d.ts +1 -1
  36. package/dist/app/record-row/messages.d.ts +2 -2
  37. package/dist/app/related-cards/messages.d.ts +2 -2
  38. package/dist/app/runtime/messages.d.ts +2 -2
  39. package/dist/app/saved/messages.d.ts +2 -2
  40. package/dist/app/search/messages.d.ts +2 -2
  41. package/dist/app/searches/messages.d.ts +2 -2
  42. package/dist/app-shell/messages.d.ts +2 -2
  43. package/dist/assistant-dock/messages.d.ts +2 -2
  44. package/dist/auth/messages.d.ts +2 -2
  45. package/dist/calls/messages.d.ts +2 -2
  46. package/dist/data-grid/messages.d.ts +2 -2
  47. package/dist/filter-panel/messages.d.ts +2 -2
  48. package/dist/index.js +1 -1
  49. package/dist/invitations/messages.d.ts +2 -2
  50. package/dist/live/field-values.js +2 -1
  51. package/dist/locale/en.js +9 -1
  52. package/dist/locale/en.json.d.ts +8 -0
  53. package/dist/locale/messages.d.ts +16 -0
  54. package/dist/locale/nl.js +9 -1
  55. package/dist/mailbox/mail-sender-select.d.ts +23 -0
  56. package/dist/mailbox/mail-sender-select.js +81 -0
  57. package/dist/mailbox/mailbox-connect.js +1 -1
  58. package/dist/mailbox/messages.d.ts +2 -2
  59. package/dist/mailbox/sender-options-read.d.ts +14 -0
  60. package/dist/mailbox/sender-options-read.js +31 -0
  61. package/dist/mailbox/sender-options.d.ts +17 -0
  62. package/dist/mailbox/sender-options.js +17 -0
  63. package/dist/mailbox/use-sender-options.d.ts +14 -0
  64. package/dist/mailbox/use-sender-options.js +57 -0
  65. package/dist/mentions/messages.d.ts +2 -2
  66. package/dist/notifications/bell/messages.d.ts +2 -2
  67. package/dist/organizations/messages.d.ts +2 -2
  68. package/dist/package.js +1 -1
  69. package/dist/primitives/messages.d.ts +2 -2
  70. package/dist/shell/assets/{account-page-D0LQgPBu.js → account-page-BejiSHKM.js} +2 -2
  71. package/dist/shell/assets/app-BXbP4Ty1.js +34 -0
  72. package/dist/shell/assets/{assistant-shell-t6EYCEG6.js → assistant-shell-BWbl-WEv.js} +2 -2
  73. package/dist/shell/assets/board-display-CoJK20M9.js +2 -0
  74. package/dist/shell/assets/calendar-display-iYqswJgc.js +2 -0
  75. package/dist/shell/assets/{call-rings-C5ud3oUx.js → call-rings-Cwk4WNlZ.js} +2 -2
  76. package/dist/shell/assets/{calls-5vjQEKRi.js → calls-DxBhpisW.js} +2 -2
  77. package/dist/shell/assets/{circle-alert-D4sTiwNu.js → circle-alert-C9H3FqM7.js} +2 -2
  78. package/dist/shell/assets/composed-page-1q5wrcUN.js +2 -0
  79. package/dist/shell/assets/{composer-section-Dp-xM9-b.js → composer-section-CsrTm8Ss.js} +2 -2
  80. package/dist/shell/assets/{connect-route-DkjLawxM.js → connect-route-BY5fhvuR.js} +2 -2
  81. package/dist/shell/assets/{copy-field-B14w71cy.js → copy-field-CN_wHY_K.js} +2 -2
  82. package/dist/shell/assets/create-route-CkONKdX6.js +2 -0
  83. package/dist/shell/assets/{custom-step-container-field-CXzhDKB8.js → custom-step-container-field-B0adLm01.js} +4 -4
  84. package/dist/shell/assets/embedded-list-Nomt6OUK.js +3 -0
  85. package/dist/shell/assets/en-C_BQKBSV.js +2 -0
  86. package/dist/shell/assets/{export-dialog-CCnbhHYq.js → export-dialog-C7Gpq0EK.js} +2 -2
  87. package/dist/shell/assets/export-worker-C46NatsO.js +15 -0
  88. package/dist/shell/assets/{first-organization-page-NFqF-XyH.js → first-organization-page-B9Qj8EgA.js} +2 -2
  89. package/dist/shell/assets/{graph-view-CnMNqiV4.js → graph-view-BU3sYZDD.js} +2 -2
  90. package/dist/shell/assets/{group-donut-BbP0DJKg.js → group-donut-MrMdALOR.js} +2 -2
  91. package/dist/shell/assets/{guest-call-page-R7GFfBV-.js → guest-call-page-Cf-QdD6u.js} +3 -3
  92. package/dist/shell/assets/{html-viewer-DoOxyTcM.js → html-viewer-4q3cR5U2.js} +2 -2
  93. package/dist/shell/assets/{import-dialog-_5Szg-jU.js → import-dialog-CBT7GHQ6.js} +2 -2
  94. package/dist/shell/assets/{import-table-dialog-njI8BoS4.js → import-table-dialog-DNPoaf3W.js} +2 -2
  95. package/dist/shell/assets/{index-BbZazL12.js → index-CrsKmqF6.js} +1 -1
  96. package/dist/shell/assets/{invitations-page-EV-UUQ6b.js → invitations-page-T5Zl42lB.js} +2 -2
  97. package/dist/shell/assets/{layout-grid-B0-CJOlT.js → layout-grid-C0JKQ-Vr.js} +2 -2
  98. package/dist/shell/assets/{legend-item-DlKFFY7e.js → legend-item-BC8NMrG0.js} +2 -2
  99. package/dist/shell/assets/{lib-zod-B92j-KH2.js → lib-zod-CxxP7Qhu.js} +2 -2
  100. package/dist/shell/assets/list-page-Dt2tN3Li.js +4 -0
  101. package/dist/shell/assets/{maplibre-B6nwN1UZ.js → maplibre-CBGBPT2u.js} +2 -2
  102. package/dist/shell/assets/{markdown-content-C8sLopWJ.js → markdown-content-CE3gKAHx.js} +2 -2
  103. package/dist/shell/assets/members-page-RClHb_e8.js +2 -0
  104. package/dist/shell/assets/{message-content-BkvkBtPr.js → message-content-OCOwOHzz.js} +3 -3
  105. package/dist/shell/assets/messages-9TFLyKlr.js +2 -0
  106. package/dist/shell/assets/nl-DzJ_yv1H.js +2 -0
  107. package/dist/shell/assets/organization-page-BVWyQvBY.js +2 -0
  108. package/dist/shell/assets/organizations-page-Bn3IY_Zs.js +2 -0
  109. package/dist/shell/assets/parse-worker-COWuolaE.js +35 -0
  110. package/dist/shell/assets/{pending-invitation-row-D4gFapdv.js → pending-invitation-row-D58juRaB.js} +2 -2
  111. package/dist/shell/assets/{period-chart-ChFHNTEE.js → period-chart-DSnwMzgV.js} +2 -2
  112. package/dist/shell/assets/{person-row-YwRtkzbb.js → person-row-shwrR0nf.js} +2 -2
  113. package/dist/shell/assets/public-form-page-o8AZ5FHd.js +2 -0
  114. package/dist/shell/assets/{record-lines-D1wftBQA.js → record-lines-fwUdQsF7.js} +2 -2
  115. package/dist/shell/assets/{record-map-BEOxTNu4.js → record-map-3vSnFihG.js} +2 -2
  116. package/dist/shell/assets/{record-opens-C9579izg.js → record-opens-BjvGP76q.js} +2 -2
  117. package/dist/shell/assets/record-page-oAgFQCZx.js +3 -0
  118. package/dist/shell/assets/{record-preview-eCoWviA9.js → record-preview-bznf4p6C.js} +2 -2
  119. package/dist/shell/assets/{records-map-DVETi1eC.js → records-map-BZ9IztOw.js} +2 -2
  120. package/dist/shell/assets/render-node-D-4-E94O.js +3 -0
  121. package/dist/shell/assets/reorder-button-B6J3Gmzg.js +2 -0
  122. package/dist/shell/assets/{run-trace-view-DC8UUfeb.js → run-trace-view-B_bJcy_e.js} +2 -2
  123. package/dist/shell/assets/{runner-install-field-BmVLaBtB.js → runner-install-field-Dg5VV1Bz.js} +2 -2
  124. package/dist/shell/assets/{runtime-update-CTsM8FBn.js → runtime-update-CkX7qK0y.js} +2 -2
  125. package/dist/shell/assets/shared-protobase-ui-Bmj9LnMR.js +1 -0
  126. package/dist/shell/assets/{sheet-source-BbBLftOM.js → sheet-source-De92TWm8.js} +3 -3
  127. package/dist/shell/assets/sign-in-policy-page-P6Z6NlWj.js +2 -0
  128. package/dist/shell/assets/start-block-queries-sM50NWuR.js +2 -0
  129. package/dist/shell/assets/step-catalog-C6uiLqhG.js +2 -0
  130. package/dist/shell/assets/{step-panel-CEluX3Jl.js → step-panel-BtgXKvBb.js} +2 -2
  131. package/dist/shell/assets/timeline-display-CFYOr7ER.js +2 -0
  132. package/dist/shell/assets/{trash-Ba3Y5_30.js → trash-hWgXyHxA.js} +2 -2
  133. package/dist/shell/assets/{update-set-D2mI0J7M.js → update-set-jWhZWR7M.js} +2 -2
  134. package/dist/shell/assets/use-calendar-move-B902R-oH.js +2 -0
  135. package/dist/shell/assets/{use-display-rows-DIoyxucI.js → use-display-rows-DRKftIme.js} +2 -2
  136. package/dist/shell/assets/use-my-invitations-BmYWQO42.js +2 -0
  137. package/dist/shell/assets/{use-paged-search-DjnlXbQ5.js → use-paged-search-CQZq-5QD.js} +2 -2
  138. package/dist/shell/assets/{use-run-trace-2fQX9FeC.js → use-run-trace-CP67JSwu.js} +2 -2
  139. package/dist/shell/assets/{use-workflow-page-D8Vn1I90.js → use-workflow-page-DyT1T2px.js} +2 -2
  140. package/dist/shell/assets/{use-workflow-types-DpNGPeuE.js → use-workflow-types-DPCbdYrq.js} +2 -2
  141. package/dist/shell/assets/{workflow-canvas-CZ6QjuM6.js → workflow-canvas-DmxNQs0O.js} +4 -4
  142. package/dist/shell/assets/{workflow-field-CLeslVkB.js → workflow-field-DbMcq81f.js} +3 -3
  143. package/dist/shell/assets/{workflow-graph-editor-CirmaYcy.js → workflow-graph-editor-C9BYEvXl.js} +2 -2
  144. package/dist/shell/assets/{workflow-run-field-DgVAi0nl.js → workflow-run-field-jJu07psu.js} +3 -3
  145. package/dist/shell/assets/workflow-status-field-Dr5AeWYR.js +2 -0
  146. package/dist/shell/assets/workflow-workbench-DDVq899p.js +4 -0
  147. package/dist/shell/index.html +3 -3
  148. package/dist/shell/protobase.shell.json +2 -2
  149. package/dist/shell/protobase.sw.js +2 -2
  150. package/dist/shell-source-maps/assets/{account-page-D0LQgPBu.js.map → account-page-BejiSHKM.js.map} +1 -1
  151. package/dist/shell-source-maps/assets/app-BXbP4Ty1.js.map +1 -0
  152. package/dist/shell-source-maps/assets/{assistant-shell-t6EYCEG6.js.map → assistant-shell-BWbl-WEv.js.map} +1 -1
  153. package/dist/shell-source-maps/assets/{board-display-BF6sraBq.js.map → board-display-CoJK20M9.js.map} +1 -1
  154. package/dist/shell-source-maps/assets/{calendar-display-DdgRC4MC.js.map → calendar-display-iYqswJgc.js.map} +1 -1
  155. package/dist/shell-source-maps/assets/{call-rings-C5ud3oUx.js.map → call-rings-Cwk4WNlZ.js.map} +1 -1
  156. package/dist/shell-source-maps/assets/{calls-5vjQEKRi.js.map → calls-DxBhpisW.js.map} +1 -1
  157. package/dist/shell-source-maps/assets/{circle-alert-D4sTiwNu.js.map → circle-alert-C9H3FqM7.js.map} +1 -1
  158. package/dist/shell-source-maps/assets/{composed-page-BWauYpuf.js.map → composed-page-1q5wrcUN.js.map} +1 -1
  159. package/dist/shell-source-maps/assets/{composer-section-Dp-xM9-b.js.map → composer-section-CsrTm8Ss.js.map} +1 -1
  160. package/dist/shell-source-maps/assets/{connect-route-DkjLawxM.js.map → connect-route-BY5fhvuR.js.map} +1 -1
  161. package/dist/shell-source-maps/assets/{copy-field-B14w71cy.js.map → copy-field-CN_wHY_K.js.map} +1 -1
  162. package/dist/shell-source-maps/assets/{create-route-DGBe6c9T.js.map → create-route-CkONKdX6.js.map} +1 -1
  163. package/dist/shell-source-maps/assets/{custom-step-container-field-CXzhDKB8.js.map → custom-step-container-field-B0adLm01.js.map} +1 -1
  164. package/dist/shell-source-maps/assets/embedded-list-Nomt6OUK.js.map +1 -0
  165. package/dist/shell-source-maps/assets/en-C_BQKBSV.js.map +1 -0
  166. package/dist/shell-source-maps/assets/{export-dialog-CCnbhHYq.js.map → export-dialog-C7Gpq0EK.js.map} +1 -1
  167. package/dist/shell-source-maps/assets/export-worker-C46NatsO.js.map +1 -0
  168. package/dist/shell-source-maps/assets/{first-organization-page-NFqF-XyH.js.map → first-organization-page-B9Qj8EgA.js.map} +1 -1
  169. package/dist/shell-source-maps/assets/{graph-view-CnMNqiV4.js.map → graph-view-BU3sYZDD.js.map} +1 -1
  170. package/dist/shell-source-maps/assets/{group-donut-BbP0DJKg.js.map → group-donut-MrMdALOR.js.map} +1 -1
  171. package/dist/shell-source-maps/assets/{guest-call-page-R7GFfBV-.js.map → guest-call-page-Cf-QdD6u.js.map} +1 -1
  172. package/dist/shell-source-maps/assets/{html-viewer-DoOxyTcM.js.map → html-viewer-4q3cR5U2.js.map} +1 -1
  173. package/dist/shell-source-maps/assets/{import-dialog-_5Szg-jU.js.map → import-dialog-CBT7GHQ6.js.map} +1 -1
  174. package/dist/shell-source-maps/assets/{import-table-dialog-njI8BoS4.js.map → import-table-dialog-DNPoaf3W.js.map} +1 -1
  175. package/dist/shell-source-maps/assets/{invitations-page-EV-UUQ6b.js.map → invitations-page-T5Zl42lB.js.map} +1 -1
  176. package/dist/shell-source-maps/assets/{layout-grid-B0-CJOlT.js.map → layout-grid-C0JKQ-Vr.js.map} +1 -1
  177. package/dist/shell-source-maps/assets/{legend-item-DlKFFY7e.js.map → legend-item-BC8NMrG0.js.map} +1 -1
  178. package/dist/shell-source-maps/assets/lib-zod-CxxP7Qhu.js.map +1 -0
  179. package/dist/shell-source-maps/assets/{list-page-aYSJ3PHa.js.map → list-page-Dt2tN3Li.js.map} +1 -1
  180. package/dist/shell-source-maps/assets/{maplibre-B6nwN1UZ.js.map → maplibre-CBGBPT2u.js.map} +1 -1
  181. package/dist/shell-source-maps/assets/{markdown-content-C8sLopWJ.js.map → markdown-content-CE3gKAHx.js.map} +1 -1
  182. package/dist/shell-source-maps/assets/{members-page-CgBOboZQ.js.map → members-page-RClHb_e8.js.map} +1 -1
  183. package/dist/shell-source-maps/assets/{message-content-BkvkBtPr.js.map → message-content-OCOwOHzz.js.map} +1 -1
  184. package/dist/shell-source-maps/assets/{messages-CqYTV98f.js.map → messages-9TFLyKlr.js.map} +1 -1
  185. package/dist/shell-source-maps/assets/nl-DzJ_yv1H.js.map +1 -0
  186. package/dist/shell-source-maps/assets/{organization-page-CUBsrNzR.js.map → organization-page-BVWyQvBY.js.map} +1 -1
  187. package/dist/shell-source-maps/assets/{organizations-page-D_imfTUa.js.map → organizations-page-Bn3IY_Zs.js.map} +1 -1
  188. package/dist/shell-source-maps/assets/parse-worker-COWuolaE.js.map +1 -0
  189. package/dist/shell-source-maps/assets/{pending-invitation-row-D4gFapdv.js.map → pending-invitation-row-D58juRaB.js.map} +1 -1
  190. package/dist/shell-source-maps/assets/{period-chart-ChFHNTEE.js.map → period-chart-DSnwMzgV.js.map} +1 -1
  191. package/dist/shell-source-maps/assets/{person-row-YwRtkzbb.js.map → person-row-shwrR0nf.js.map} +1 -1
  192. package/dist/shell-source-maps/assets/{public-form-page-oyX-a-KA.js.map → public-form-page-o8AZ5FHd.js.map} +1 -1
  193. package/dist/shell-source-maps/assets/{record-lines-D1wftBQA.js.map → record-lines-fwUdQsF7.js.map} +1 -1
  194. package/dist/shell-source-maps/assets/{record-map-BEOxTNu4.js.map → record-map-3vSnFihG.js.map} +1 -1
  195. package/dist/shell-source-maps/assets/{record-opens-C9579izg.js.map → record-opens-BjvGP76q.js.map} +1 -1
  196. package/dist/shell-source-maps/assets/{record-page-Dhb9gzfJ.js.map → record-page-oAgFQCZx.js.map} +1 -1
  197. package/dist/shell-source-maps/assets/{record-preview-eCoWviA9.js.map → record-preview-bznf4p6C.js.map} +1 -1
  198. package/dist/shell-source-maps/assets/{records-map-DVETi1eC.js.map → records-map-BZ9IztOw.js.map} +1 -1
  199. package/dist/shell-source-maps/assets/render-node-D-4-E94O.js.map +1 -0
  200. package/dist/shell-source-maps/assets/{reorder-button-1ikk6wTV.js.map → reorder-button-B6J3Gmzg.js.map} +1 -1
  201. package/dist/shell-source-maps/assets/{run-trace-view-DC8UUfeb.js.map → run-trace-view-B_bJcy_e.js.map} +1 -1
  202. package/dist/shell-source-maps/assets/{runner-install-field-BmVLaBtB.js.map → runner-install-field-Dg5VV1Bz.js.map} +1 -1
  203. package/dist/shell-source-maps/assets/{runtime-update-CTsM8FBn.js.map → runtime-update-CkX7qK0y.js.map} +1 -1
  204. package/dist/shell-source-maps/assets/{sheet-source-BbBLftOM.js.map → sheet-source-De92TWm8.js.map} +1 -1
  205. package/dist/shell-source-maps/assets/{sign-in-policy-page-BrVvhdS0.js.map → sign-in-policy-page-P6Z6NlWj.js.map} +1 -1
  206. package/dist/shell-source-maps/assets/{start-block-queries-B1m-VmpK.js.map → start-block-queries-sM50NWuR.js.map} +1 -1
  207. package/dist/shell-source-maps/assets/{step-catalog-DXkb5LNi.js.map → step-catalog-C6uiLqhG.js.map} +1 -1
  208. package/dist/shell-source-maps/assets/{step-panel-CEluX3Jl.js.map → step-panel-BtgXKvBb.js.map} +1 -1
  209. package/dist/shell-source-maps/assets/{timeline-display-C1OXwJcu.js.map → timeline-display-CFYOr7ER.js.map} +1 -1
  210. package/dist/shell-source-maps/assets/{trash-Ba3Y5_30.js.map → trash-hWgXyHxA.js.map} +1 -1
  211. package/dist/shell-source-maps/assets/{update-set-D2mI0J7M.js.map → update-set-jWhZWR7M.js.map} +1 -1
  212. package/dist/shell-source-maps/assets/{use-calendar-move-BENhrEOz.js.map → use-calendar-move-B902R-oH.js.map} +1 -1
  213. package/dist/shell-source-maps/assets/{use-display-rows-DIoyxucI.js.map → use-display-rows-DRKftIme.js.map} +1 -1
  214. package/dist/shell-source-maps/assets/{use-my-invitations-B4h6GyJO.js.map → use-my-invitations-BmYWQO42.js.map} +1 -1
  215. package/dist/shell-source-maps/assets/{use-paged-search-DjnlXbQ5.js.map → use-paged-search-CQZq-5QD.js.map} +1 -1
  216. package/dist/shell-source-maps/assets/{use-run-trace-2fQX9FeC.js.map → use-run-trace-CP67JSwu.js.map} +1 -1
  217. package/dist/shell-source-maps/assets/{use-workflow-page-D8Vn1I90.js.map → use-workflow-page-DyT1T2px.js.map} +1 -1
  218. package/dist/shell-source-maps/assets/{use-workflow-types-DpNGPeuE.js.map → use-workflow-types-DPCbdYrq.js.map} +1 -1
  219. package/dist/shell-source-maps/assets/{workflow-canvas-CZ6QjuM6.js.map → workflow-canvas-DmxNQs0O.js.map} +1 -1
  220. package/dist/shell-source-maps/assets/{workflow-field-CLeslVkB.js.map → workflow-field-DbMcq81f.js.map} +1 -1
  221. package/dist/shell-source-maps/assets/{workflow-graph-editor-CirmaYcy.js.map → workflow-graph-editor-C9BYEvXl.js.map} +1 -1
  222. package/dist/shell-source-maps/assets/{workflow-run-field-DgVAi0nl.js.map → workflow-run-field-jJu07psu.js.map} +1 -1
  223. package/dist/shell-source-maps/assets/workflow-status-field-Dr5AeWYR.js.map +1 -0
  224. package/dist/shell-source-maps/assets/{workflow-workbench-Dy2EmMb7.js.map → workflow-workbench-DDVq899p.js.map} +1 -1
  225. package/dist/status/messages.d.ts +2 -2
  226. package/dist/users/messages.d.ts +2 -2
  227. package/package.json +5 -5
  228. package/dist/shell/assets/app-CK_M0TgA.js +0 -34
  229. package/dist/shell/assets/board-display-BF6sraBq.js +0 -2
  230. package/dist/shell/assets/calendar-display-DdgRC4MC.js +0 -2
  231. package/dist/shell/assets/composed-page-BWauYpuf.js +0 -2
  232. package/dist/shell/assets/create-route-DGBe6c9T.js +0 -2
  233. package/dist/shell/assets/embedded-list-COr7SEcU.js +0 -3
  234. package/dist/shell/assets/en-BHrKuf4K.js +0 -2
  235. package/dist/shell/assets/export-worker-CNhkzttC.js +0 -15
  236. package/dist/shell/assets/list-page-aYSJ3PHa.js +0 -4
  237. package/dist/shell/assets/members-page-CgBOboZQ.js +0 -2
  238. package/dist/shell/assets/messages-CqYTV98f.js +0 -2
  239. package/dist/shell/assets/nl-D11b5T7-.js +0 -2
  240. package/dist/shell/assets/organization-page-CUBsrNzR.js +0 -2
  241. package/dist/shell/assets/organizations-page-D_imfTUa.js +0 -2
  242. package/dist/shell/assets/parse-worker-CAcPVcu7.js +0 -35
  243. package/dist/shell/assets/public-form-page-oyX-a-KA.js +0 -2
  244. package/dist/shell/assets/record-page-Dhb9gzfJ.js +0 -3
  245. package/dist/shell/assets/render-node-CSjGRPb0.js +0 -3
  246. package/dist/shell/assets/reorder-button-1ikk6wTV.js +0 -2
  247. package/dist/shell/assets/shared-protobase-ui-DkBQh22L.js +0 -1
  248. package/dist/shell/assets/sign-in-policy-page-BrVvhdS0.js +0 -2
  249. package/dist/shell/assets/start-block-queries-B1m-VmpK.js +0 -2
  250. package/dist/shell/assets/step-catalog-DXkb5LNi.js +0 -2
  251. package/dist/shell/assets/timeline-display-C1OXwJcu.js +0 -2
  252. package/dist/shell/assets/use-calendar-move-BENhrEOz.js +0 -2
  253. package/dist/shell/assets/use-my-invitations-B4h6GyJO.js +0 -2
  254. package/dist/shell/assets/workflow-status-field-CD4Npg78.js +0 -2
  255. package/dist/shell/assets/workflow-workbench-Dy2EmMb7.js +0 -4
  256. package/dist/shell-source-maps/assets/app-CK_M0TgA.js.map +0 -1
  257. package/dist/shell-source-maps/assets/embedded-list-COr7SEcU.js.map +0 -1
  258. package/dist/shell-source-maps/assets/en-BHrKuf4K.js.map +0 -1
  259. package/dist/shell-source-maps/assets/export-worker-CNhkzttC.js.map +0 -1
  260. package/dist/shell-source-maps/assets/lib-zod-B92j-KH2.js.map +0 -1
  261. package/dist/shell-source-maps/assets/nl-D11b5T7-.js.map +0 -1
  262. package/dist/shell-source-maps/assets/parse-worker-CAcPVcu7.js.map +0 -1
  263. package/dist/shell-source-maps/assets/render-node-CSjGRPb0.js.map +0 -1
  264. package/dist/shell-source-maps/assets/workflow-status-field-CD4Npg78.js.map +0 -1
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/graph-view-BU3sYZDD.js","assets/rolldown-runtime-DFwUHQ4A.js","assets/react-CuiNlnus.js","assets/app-BXbP4Ty1.js","assets/vendor-t7Q7QbPu.js","assets/app-DLkpxjgP.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{$i as r,$n as i,$o as a,An as o,As as s,B as c,Ba as l,Bn as u,Bs as d,C as f,Cn as p,Cs as m,Ct as h,D as g,Dn as _,Ds as v,Ea as y,Ei as b,Es as x,F as S,Fl as C,Fs as w,Ft as T,Go as E,Gr as ee,Gs as te,Hi as ne,Hl as re,Hn as ie,Hr as ae,Hs as oe,Ia as se,Il as ce,Is as le,Ja as ue,Jo as de,Js as fe,Kc as D,Ks as pe,Kt as me,M as he,Mo as O,Mt as ge,Ni as _e,Ns as ve,Nt as ye,Oc as be,On as xe,Os as Se,Ps as Ce,Pt as we,Qn as Te,Qo as Ee,R as De,Rc as Oe,Rn as ke,Rr as Ae,Sa as je,Sn as Me,Ta as Ne,Ts as Pe,Ul as Fe,Us as Ie,Vc as Le,Vn as Re,Vr as ze,Vs as Be,Wo as Ve,Ws as He,Xa as Ue,Xl as We,Xo as k,Ya as A,Yo as Ge,Yt as Ke,Za as qe,Zo as j,Zt as Je,_ as Ye,_n as Xe,_o as Ze,_r as M,ac as Qe,al as $e,an as N,ar as et,as as tt,b as nt,ba as rt,bi as it,bl as at,bn as ot,cn as st,co as ct,cr as lt,cs as ut,dl as dt,dn as ft,dr as P,ds as pt,ea as mt,ec as ht,en as gt,es as F,fc as I,fr as L,gn as _t,gr as R,gt as vt,hn as yt,hr as bt,ht as xt,i as St,ic as Ct,in as wt,io as Tt,is as z,it as Et,jc as Dt,js as Ot,jt as kt,k as At,ka as jt,ks as Mt,lc as B,ll as Nt,ln as Pt,mc as Ft,ml as It,mn as Lt,mr as Rt,ms as zt,na as Bt,nc as Vt,nl as Ht,nn as V,nr as Ut,ns as H,oa as Wt,or as Gt,pa as Kt,pc as qt,pl as Jt,pr as Yt,qc as U,qn as Xt,qs as Zt,rc as Qt,rn as $t,rr as en,rs as tn,s as nn,sa as rn,sc as an,sn as on,so as sn,ss as W,tl as cn,ts as ln,uc as G,un,uo as dn,ur as fn,us as pn,v as mn,vl as hn,vn as gn,vr as K,wc as _n,wi as vn,ws as q,xa as yn,xn as bn,y as xn,ya as Sn,yn as Cn,za as wn,zn as Tn,zs as En}from"./app-BXbP4Ty1.js";import{C as Dn,f as On,o as kn,s as An}from"./vendor-t7Q7QbPu.js";import{C as jn,Ct as Mn,Dt as Nn,Et as Pn,O as Fn,Ot as In,Q as Ln,St as Rn,Tt as zn,X as Bn,Z as Vn,_t as Hn,at as Un,b as Wn,ct as Gn,dt as Kn,ft as qn,gt as Jn,it as Yn,jt as Xn,k as Zn,l as Qn,lt as $n,mt as er,n as tr,nt as nr,o as rr,ot as ir,rt as ar,st as or,t as sr,tt as cr,ut as lr,wt as ur,x as dr,xt as fr,y as pr}from"./embedded-list-Nomt6OUK.js";import{t as mr}from"./circle-alert-C9H3FqM7.js";import{t as hr}from"./page-header-Ddz2r5ic.js";import{n as gr,t as _r}from"./pending-invitation-row-D58juRaB.js";import{n as vr,t as yr}from"./person-row-shwrR0nf.js";import{n as br,t as xr}from"./use-paged-search-CQZq-5QD.js";import{n as Sr,t as Cr}from"./client-publisher-D39SlIhp.js";import{t as wr}from"./copy-field-CN_wHY_K.js";var Tr={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`}]]};Tr.node;var Er=D(Tr),Dr={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`}]]};Dr.node;var Or=D(Dr),kr={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`}]]};kr.node;var Ar=D(kr),jr={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`}]]};jr.node;var Mr=D(jr),Nr={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`]};Nr.node;var Pr=D(Nr),Fr={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`}]]};Fr.node;var Ir=D(Fr),Lr={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`}]]};Lr.node;var Rr=D(Lr),zr={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`}]]};zr.node;var Br=D(zr),Vr=[`done`,`error`,`running`];Zt(`TextField`,!1),Zt(`NumberField`,!1),Zt(`DateField`,!1),Zt(`BooleanField`,!1),Zt(`UrlField`,!1),Zt(`ChipField`,!1);var Hr=new Set([`TextField`,`NumberField`,`DateField`,`BooleanField`,`UrlField`,`ChipField`]),Ur=e=>typeof e!=`string`&&!e.custom&&Hr.has(e.type),Wr=e=>typeof e==`string`||Ur(e)||!e.custom&&(e.type===`Link`||e.type===`Trans`||e.type===`Text`&&[`span`,`strong`,`em`].includes(String(e.props.as))),Gr=(e,t)=>e===`BooleanField`?t!==!0&&t!==!1:e===`NumberField`||e===`UrlField`?t==null:t==null||t===``,Kr=e=>typeof e==`object`&&e?JSON.stringify(e):String(e),qr=(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)},Jr=(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)},Yr=(e,t,n)=>e?t.valueLabelTrue??n.yes:t.valueLabelFalse??n.no,Xr=new Set([`http:`,`https:`,`mailto:`,`tel:`]),Zr=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:Xr.has(`${n.toLowerCase()}:`)?e:void 0},Qr=({layout:e,cardWidth:t})=>({layout:e??`stack`,cardWidth:t??`2/3`}),$r=e=>e==null||e===``?void 0:String(e),ei=(e,t)=>e<t?-1:+(e>t),ti=({nodes:e,edges:t,key:n,edgeKey:r,fields:i})=>{let a=new Map,o=new Map;for(let t of e){let e=$r(t[n]);if(e===void 0||a.has(e))continue;let r=i.group===void 0?void 0:t[i.group],s=$r(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=>$r(e[t])),n=t.includes(void 0)?void 0:t.length===1?t[0]:JSON.stringify(t),o=$r(e[i.source]),s=$r(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)=>ei(e.id,t.id)),nodes:[...a.values()].sort((e,t)=>ei(e.id,t.id)),edges:s.sort((e,t)=>ei(e.source,t.source)||ei(e.target,t.target)||ei(e.id,t.id))}},J=e(t(),1),Y=e(n(),1),ni=({model:e,items:t,name:n,label:r,variant:i,className:a})=>{let{views:o}=W(),s=Mn(e.name,void 0),c=ne(),[l,u]=(0,J.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=>yt(e,t)),p=f.filter(e=>s.verdictOn(d,e)!==`skip`);if(p.length===0)return null;let m=f.length-p.length,h=fr(`actionCount`,{label:r??d.label,count:p.length}),g=e=>s.runEach(d,p,m,e);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{size:`sm`,variant:i??d.variant??`secondary`,className:a,loading:s.running===n,onClick:()=>Pn(d)?u(!0):void g(),children:h}),l&&(0,Y.jsx)(zn,{action:d,label:h,danger:i===`danger`||i===void 0&&Nn(d),records:p.map(e=>e.record),names:p.map(t=>Rn(c(e,o[e.name],t.record,t.key))),onCancel:()=>u(!1),onConfirm:()=>{u(!1),g()},onSubmit:async e=>{u(!1),await g(e)}})]})},ri=({name:e,resource:t,label:n,variant:r,className:i,about:a,onRun:o})=>{let s=fn(),c=ur(t??s?.model.name??``,e,t===void 0||t===s?.model.name?s:void 0,e=>o?.(n??e.label)),[l,u]=(0,J.useState)(!1);if(!c.action)return null;let d=n??c.action.label,f=r??c.action.variant??`secondary`;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{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:()=>Pn(c.action)?u(!0):void c.run(),children:d}),l&&(0,Y.jsx)(zn,{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)}})]})},ii=({node:e,className:t})=>{let n=N(e),r=bt(),i=r?.model;return i&&(n.resource===void 0||n.resource===i.name)?(0,Y.jsx)(ni,{...n,model:i,items:r.items,className:t}):(0,Y.jsx)(ri,{...n,className:t})},ai=({node:e,children:t,slots:n,className:r})=>{let{title:i,description:a}=N(e);return(0,Y.jsx)(R,{title:i,description:a,actions:n.actions,className:U(`h-full`,r),children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-3`,children:t})})},oi=({children:e,wrap:t=(e,t)=>(0,Y.jsx)(J.Fragment,{children:e},t)})=>{let n=bt();if(!n)return null;let{model:r,items:i,planned:a}=n;return i.map((n,o)=>{let s=r?{...yt(r,n),...a&&{planned:a}}:{item:n},c=`key`in s?s.key:o;return t((0,Y.jsx)(Gt,{value:s,row:{index:o,count:i.length},children:e}),c)})},si=({children:e})=>(0,Y.jsx)(oi,{children:e}),ci=({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=V(t),f=gn(e,{filter:n,sort:r,pageSize:i,enabled:!d}),p=d??f,m=d?d.rows:f.data?.items??[];return(0,Y.jsx)(R,{title:a,description:o,actions:c,className:u,children:p.isPending?(0,Y.jsx)(`div`,{className:`flex gap-3`,children:Array.from({length:3},(e,t)=>(0,Y.jsx)(B,{className:`h-24 w-56`},t))}):p.error?(0,Y.jsx)(K,{title:A(`couldNotLoad`),error:p.error}):m.length===0?(0,Y.jsx)(M,{children:s??A(`nothingYet`)}):(0,Y.jsx)(`ul`,{className:`relative -mx-4 flex snap-x gap-3 overflow-x-auto px-4 pb-1`,children:(0,Y.jsx)(Yt,{value:{model:e,items:m,...d&&{planned:!0}},children:(0,Y.jsx)(oi,{wrap:(e,t)=>(0,Y.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})})})})},li=({node:e,at:t,children:n,slots:r})=>{let{resource:i,...a}=N(e),o=W().resources[i];return o?(0,Y.jsx)(ci,{...a,model:o,...t!==void 0&&{at:t},actions:r.actions,children:n}):null},ui=({node:e,slots:t,className:n})=>{let{resource:r,title:i,description:a,actions:o,span:s,className:c,...l}=N(e),{resources:u,views:d}=W(),f=u[r];return f?(0,Y.jsx)(R,{title:i,description:a,actions:t.actions,className:U(`h-full`,n),children:(0,Y.jsx)(qn,{model:f,view:d[r],...l})}):null},di=({model:e,query:t,className:n=`mt-4 border-t pt-4`,children:r})=>{let i=Xe(e,t),a=i.isPending?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(B,{className:`h-4 w-1/2`}),(0,Y.jsx)(B,{className:`h-4 w-1/3`})]}):i.error?(0,Y.jsx)(K,{title:A(`couldNotLoad`),error:i.error}):i.data?(0,Y.jsx)(Gt,{value:i.data,children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-3`,children:r})}):(0,Y.jsx)(M,{children:A(`nothingYet`)});return(0,Y.jsx)(`div`,{className:n,children:a})},fi=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},pi=e=>e==null?``:String(e),X=(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=fi(i[t.start]);if(e===void 0)continue;let a=fi(i[t.end]),o=Math.max(e,a??n),s=r.get(pi(i[t.lane]))??{value:i[t.lane],bars:new Map};r.set(pi(i[t.lane]),s);let c=s.bars.get(pi(i[t.bar]))??{value:i[t.bar],records:[]};s.bars.set(pi(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:X(n,a,s),width:X(r,a,s)-X(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:X(o,a,s),width:X(c,a,s)-X(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:X(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:X(a,e,r)})}return{daily:o>=Z,ticks:s}},wi=e=>({lane:pi(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`:Kt(),i=e=>n?0:Ei(e,r),{daily:a,ticks:o}=Ci(e,t,i);return(0,Y.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,Y.jsx)(`span`,{className:`absolute bottom-1 whitespace-nowrap ${Di(e.left)}`,style:{left:`${e.left}%`},children:a?Bt(e.at+i(e.at)):rn(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&&at(a)?{className:tn[a],striped:i}:{color:Jn(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,Y.jsx)(`span`,{"aria-hidden":`true`,className:U(`absolute inset-y-0`,a.className),style:{left:`${o}%`,width:`${s}%`,...Ai(a)}},i)}),Mi=(e,t)=>t?r(e):mt(e),Ni=(e,t,n,r,i)=>{let a=e.fields[t.start]?.type===`date`;return A(`timelineRange`,{from:Mi(n,a),to:i?A(`timelineNow`):Mi(r,a)})},Pi=(e,t,n,r)=>`${it(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??it(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 s=W().resources[t.fields[r.bar]?.relation?.resource??``],c=o(s??t,e.key,s!==void 0),l=Fi(e,t,n,r,s?c:void 0),u={onMouseEnter:()=>i.hover(e),onMouseLeave:()=>i.hover(null),onFocus:()=>i.focus(e),onBlur:()=>i.focus(null)},d={left:`${e.left}%`,width:`max(${e.width}%, 4px)`},f=(0,Y.jsx)(ji,{bar:e,field:t.fields[r.color],hints:n?.fields[r.color]});if(!a)return(0,Y.jsx)(`span`,{role:`img`,tabIndex:0,"aria-label":l,style:d,className:Ii,...u,children:f});let p=a.chosen===e.key;return(0,Y.jsx)(an,{to:a.barTo(e.key),"aria-label":l,"aria-current":p?`true`:void 0,style:d,className:U(Ii,p&&`ring-2 ring-foreground`),...u,children:f})},Ri=({shape:e,...t})=>{let{model:n,fields:r}=t,i=n.fields[r.lane];return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`div`,{className:`flex sm:pl-40`,children:(0,Y.jsx)(Oi,{from:e.from,to:e.to,dated:n.fields[r.start]?.type===`date`})}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-3 sm:gap-2`,children:e.lanes.map(e=>(0,Y.jsxs)(`li`,{className:`flex flex-col gap-1 sm:flex-row sm:items-center`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 truncate text-sm font-medium sm:w-40 sm:shrink-0 sm:pr-3`,children:(0,Y.jsx)(ot,{model:n,field:i,value:e.value})}),(0,Y.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,Y.jsx)(`div`,{className:`relative h-6 overflow-x-clip`,children:e.map(e=>(0,Y.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,Y.jsx)(`span`,{"aria-hidden":`true`,className:U(`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,Y.jsx)(`ul`,{className:`flex flex-wrap gap-x-4 gap-y-1.5 text-xs text-muted-foreground`,children:r.map(e=>(0,Y.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(zi,{...t,value:e}),it(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,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:A(`timelinePoint`)});let a=e.segments.some(t=>t.open&&t.end===e.end);return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Y.jsxs)(`p`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:(0,Y.jsx)(ot,{model:n,field:n.fields[i.bar],value:e.value})}),(0,Y.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:Ni(n,i,e.start,e.end,a)})]}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-0.5 text-xs text-muted-foreground`,children:e.segments.map((e,a)=>(0,Y.jsxs)(`li`,{className:`flex items-center gap-1.5 tabular-nums`,children:[(0,Y.jsx)(zi,{...t,value:e.value}),it(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:[...cn.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})=>kn({...Ui(zt(),e,n),enabled:t,placeholderData:On}),Gi=({model:e,view:t,fields:n,readSort:r,at:i,filter:a,limit:o=oe,title:s,description:c,empty:l,actions:u,className:d,choose:f,details:p})=>{let[m,h]=(0,J.useState)(null),[g,_]=(0,J.useState)(null),v=e=>e?wi(e):null,y={hover:e=>h(v(e)),focus:e=>_(v(e))},b=V(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,Y.jsxs)(R,{title:s,description:c,actions:u,className:U(`h-full`,d),children:[(()=>{if(S.isPending)return(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:Array.from({length:3},(e,t)=>(0,Y.jsx)(B,{className:`h-6`},t))});if(S.error)return(0,Y.jsx)(K,{title:A(`couldNotLoad`),error:S.error});if(T.lanes.length===0)return(0,Y.jsx)(M,{children:l??A(`nothingYet`)});let r=new Set(C.map(e=>String(e[n.color])));return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Y.jsx)(Bi,{model:e,view:t,fields:n,values:r}),(0,Y.jsx)(Ri,{shape:T,model:e,view:t,fields:n,point:y,...f&&{choose:f}}),w&&(0,Y.jsx)(M,{children:A(`timelineCut`,{count:C.length})}),(0,Y.jsx)(`div`,{"aria-live":`polite`,children:(0,Y.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}=en(),a=r[e],o=t=>i({[e]:t}),s=n.model.fields[n.fields.bar],c=a===void 0?null:(0,Y.jsx)(Qe,{name:e,children:(0,Y.jsx)(di,{model:n.model,query:{filter:Hn(s,Ki(s,a),n.filter),sort:n.sort},children:t},a)});return(0,Y.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}=N(e),{resources:h,views:g}=W(),_=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:He(e),...t!==void 0&&{at:t},actions:n.actions,className:i};return s===void 0?(0,Y.jsx)(Gi,{...v}):(0,Y.jsx)(qi,{...v,select:s,children:r})},Yi=({node:e,children:t})=>{let n=pe(e),r=et(),{resources:i}=W();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,Y.jsx)(Qe,{name:n.param,children:(0,Y.jsx)(di,{model:o,query:{key:a},className:``,children:t},a)})},Xi=(0,J.lazy)(()=>Dn(()=>import(`./graph-view-BU3sYZDD.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,Y.jsx)(`div`,{className:`flex h-64 w-full items-center justify-center`,children:(0,Y.jsx)(Ft,{})}),Qi=({node:e,at:t,slots:n,children:r,className:i})=>{let a=N(e),o=gt(e,t),s=et(),c=o.nodes,l=o.edges,{label:u,group:d,status:f,source:p,target:m}=a,h=(0,J.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,J.useMemo)(()=>c&&l&&ti({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,Y.jsx)(K,{title:A(`couldNotLoad`),error:v});if(c.isPending||l.isPending)return Zi;if(_.nodes.length===0)return(0,Y.jsx)(M,{children:a.empty??A(`nothingYet`)});let y=a.select,b=y!==void 0&&s?{chosen:s.given[y],linkTo:e=>s.linkTo({[y]:e})}:void 0;return(0,Y.jsxs)(`div`,{className:U(`flex flex-col gap-4 lg:flex-row`,i),children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Y.jsx)(J.Suspense,{fallback:Zi,children:(0,Y.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,Y.jsx)(`div`,{className:`min-w-0 lg:w-80 lg:shrink-0`,children:(0,Y.jsx)(Yi,{node:e,children:r})})]})},Q=Ht(`app/conversation`),$i=({resource:e,field:t,values:n,placeholder:r,searchPeople:i,mentions:a})=>{let{resources:o}=W(),s=zt(),c=Cn(),l=ut(e),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)();return!o[e]||!jt(l,`create`)?null:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[f!==void 0&&(0,Y.jsx)(K,{title:Q(`notSent`),error:f}),(0,Y.jsx)(h,{onSend:async(r,i)=>{d(!0),p(void 0);let o=await s.create(e,{...n,[t]:r,...a!==void 0&&{[a]:i}}).then(()=>!0,e=>(p(e),!1));return d(!1),o&&c(e),o},busy:u,placeholder:r,searchPeople:i})]})},ea=({node:e})=>{let{resource:t,field:n,values:r,placeholder:i}=N(e);return(0,Y.jsx)($i,{resource:t,field:n,values:r,placeholder:i})},ta=({node:e,children:t,className:n})=>{let{open:r}=N(e);return(0,Y.jsx)(`details`,{open:r,className:U(`[&[open]>summary]:mb-2`,n),children:t})},na=({children:e,className:t})=>(0,Y.jsx)(`summary`,{className:U(`cursor-pointer font-medium`,t),children:e}),ra=({node:e,className:t})=>{let{source:n,emptyText:r}=N(e),i=un(n);if(i.state===`missing`)return null;if(i.state===`loading`)return(0,Y.jsx)(B,{className:U(`h-24 w-full`,t)});if(i.value===null||i.value===void 0||i.value===``)return r?(0,Y.jsx)(`p`,{className:U(`text-sm text-muted-foreground`,t),children:r}):null;let a=String(i.value),o=xt(a);return o?(0,Y.jsx)(`div`,{className:U(`flex flex-col gap-3`,t),children:o.map((e,t)=>(0,Y.jsx)(vt,{source:e.lines,path:e.path,split:!0,className:`rounded-md border border-border`},`${t}-${e.path}`))}):(0,Y.jsx)(`pre`,{className:U(`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=>It(e).toLowerCase()).join(` `);return n[0].toUpperCase()+n.slice(1)},oa=({node:e,className:t})=>{let{source:n,label:r,format:i}=N(e),{views:a}=W(),o=un(n);if(o.state===`missing`)return null;let s=o.state===`loading`?(0,Y.jsx)(B,{className:`h-4 w-24`}):o.state===`plain`?ia(o.value):(0,Y.jsx)(ot,{model:o.model,field:o.field,value:o.value,format:i});if(r===!1)return(0,Y.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,Y.jsxs)(`div`,{className:U(`min-w-0`,t),children:[(0,Y.jsx)(`div`,{className:`text-body text-muted-foreground`,children:c}),(0,Y.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}=N(e),i=e.children,a=i.length>0&&i.every(ua);return(0,Y.jsx)(`div`,{className:U(`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,Y.jsx)(`div`,{className:U(`min-w-0`,r&&la[r]),children:e},t)})})},fa=({src:e,alt:t,width:n,height:r,className:i})=>(0,Y.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,J.useState)();return(0,J.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,J.useState)();return[t!==void 0&&t===e,()=>n(e)]},va=({name:e,alt:t,width:n,height:r,refresh:i,className:a})=>{let o=zt(),{theme:s}=l(),[c,u]=Et(),d=pa({width:n,height:r,space:u,theme:s}),f=kn({queryKey:cn.image(e,d??{}),enabled:d!==void 0,placeholderData:On,...ma(i),queryFn:async()=>{let t=await o.invoke(e,{query:d,cache:`no-store`});if(!ha(t))throw Error(`The function "${e}" answered no picture`);return t}}),p=ga(f.data),[m,h]=_a(p),g={...n!==void 0&&{width:n},...r!==void 0&&{height:r}};return(0,Y.jsx)(`div`,{ref:c,className:U(`min-w-0`,a),children:f.isError||m?t&&(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:t}):p?(0,Y.jsx)(`img`,{src:p,alt:t??``,onError:h,style:g,className:n===void 0?`w-full max-w-full object-contain`:`max-w-full object-contain`}):(0,Y.jsx)(B,{className:`w-full max-w-full`,style:{height:r??160,...n!==void 0&&{width:n}}})})},ya=({node:e,className:t})=>{let n=N(e);return n.src===void 0?(0,Y.jsx)(va,{name:n.function,alt:n.alt,width:n.width,height:n.height,refresh:n.refresh,className:t}):(0,Y.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=N(t),{views:i}=W(),a=un(r.source);return a.state===`missing`?null:a.state===`loading`?(0,Y.jsx)(B,{className:`inline-block h-3 w-16 align-middle`}):Gr(t.type,a.value)?r.emptyText?(0,Y.jsx)(`span`,{className:n,children:r.emptyText}):null:a.state===`plain`?(0,Y.jsx)(`span`,{className:n,children:e({value:a.value,field:void 0,hints:void 0,props:r})}):(0,Y.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`?Jt(e,n?.valueLabels):Kr(e),Sa=ba(xa),Ca=ba(({value:e,props:t})=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:qr(e,t,$e())})),wa=ba(({value:e,props:t})=>{let n=Jr(e,t,{locale:$e(),now:Date.now(),relative:Wt});return(0,Y.jsx)(`time`,{dateTime:String(e),children:n})}),Ta=ba(({value:e,props:t})=>{let n=Yr(e,t,{yes:_e(`yes`),no:_e(`no`)});return e?(0,Y.jsx)(Xt,{label:n,className:`align-middle`}):(0,Y.jsx)(`span`,{className:`text-faint-foreground`,children:n})}),Ea=ba(({value:e,props:t})=>{let n=String(e),r=t.content??n,i=Zr(n);return i===void 0?r:(0,Y.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,Y.jsx)(xe,{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=N(e),i={...L(P()),params:Ut()},a=r.variant?U(qt({variant:r.variant}),n):n??Oa,o=e.children.some(e=>typeof e!=`string`||e.trim()!==``)?t:void 0;if(r.to){let e=re(r.to,s(i));return(0,Y.jsx)(ze,{to:e,className:a,children:o??ht(e)})}let c=r.href??``;return(0,Y.jsx)(`a`,{href:c,className:a,...c.startsWith(`http`)&&{target:`_blank`,rel:`noreferrer`},children:o??c})},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]:g(n[t])];let i=r.default&&`value`in r.default?r.default.value:void 0;return[t,r.type===`boolean`?!!i:g(i)]})),ja=(e,t,n)=>Object.fromEntries(Object.entries(t).flatMap(([t,r])=>{let i=e.fields[t];return nn(r)?r.key===g(n[t])?[]:[[t,i.type===`integer`?Number(r.key):r.key]]:f(i,r,n[t])?[[t,At(i,r)]]:[]})),Ma=({model:e,record:t,mode:n,label:r,title:i,fields:a,values:o,onClose:s})=>{let{resources:c,views:l}=W(),u=zt(),d=wn(),f=Cn(),p=l[e.name],[m,h]=(0,J.useState)(()=>Aa(e,a,t?.record)),[g,_]=(0,J.useState)({}),[v,y]=(0,J.useState)(0),b=Ye(v),[x,S]=(0,J.useState)(),[C,w]=(0,J.useState)(!1),[T,E]=(0,J.useState)(!1);Qt(T||C,`input-lost`);let ee=async()=>{w(!0),S(void 0),await(n===`create`?u.create(e.name,{...St(e,c,m),...o}):u.update(e.name,t.key,ja(e,m,t.record),t.etag??`*`)).then(async()=>{await f(e.name),d.show({state:`success`,title:A(`saved`,{label:i??r})}),s()},e=>{let t=mn(e);_(t),Object.keys(t).length>0&&y(e=>e+1),S(e)}),w(!1)};return(0,Y.jsx)(G,{title:i??r,onClose:s,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{onClick:s,children:A(`cancel`)}),(0,Y.jsx)(I,{variant:`primary`,loading:C,onClick:()=>void ee(),children:A(n===`create`?`create`:`save`)})]}),children:(0,Y.jsxs)(`form`,{ref:b,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),ee()},children:[x!==void 0&&Object.keys(g).length===0&&(0,Y.jsx)(K,{title:A(`notSaved`),error:x}),a.map(n=>{let r=e.fields[n],i=m[n],a=r.relation?c[r.relation.resource]:void 0,o=p?.fields[n]?.label??It(n),s=g[n];return(0,Y.jsx)(De,{name:n,label:o,help:p?.fields[n]?.help,error:s&&xn(r,o,s),children:(0,Y.jsx)(nt,{field:r,hints:p?.fields[n],value:nn(i)?i.key:i,stored:t?.record[n],relationLabel:nn(i)?i.label:void 0,relationPicker:a?{target:a,view:l[a.name]}:void 0,invalid:!!g[n],resource:e.name,onChange:e=>{_(({[n]:e,...t})=>t),E(!0),h(t=>({...t,[n]:e}))}})},n)})]})})},Na=({model:e,recordKey:t,children:n})=>{let r=Xe(e,{key:t});return(0,Y.jsx)(Y.Fragment,{children:n(r.data??void 0)})},Pa=({node:e})=>{let t=N(e),n=fn(),{resources:r}=W(),i=r[t.resource??n?.model.name??``],a=ut(i?.name??``),[o,s]=(0,J.useState)(!1);if(!i||!(t.mode===`create`?jt(a,`create`):jt(a,`update`)&&n?.permissions?.update!==!1))return null;let c=e=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{size:`sm`,variant:t.variant??`secondary`,disabled:t.mode===`edit`&&!e,onClick:()=>s(!0),children:t.label}),o&&(0,Y.jsx)(Ma,{...t,model:i,record:t.mode===`edit`?e:void 0,onClose:()=>s(!1)})]});return t.mode===`edit`&&t.recordKey!==void 0?(0,Y.jsx)(Na,{model:i,recordKey:t.recordKey,children:c}):c(t.mode===`edit`?n:void 0)},Fa=({node:e,children:t,slots:n,className:r})=>{let{title:i,description:a,width:o}=N(e);return(0,Y.jsx)(`div`,{className:U(`flex-1`,r),children:(0,Y.jsxs)(`div`,{className:U(`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,Y.jsx)(hr,{title:i,subtitle:a,actions:n.actions}),t]})})},Ia=(e,t)=>{let n=P(),r=typeof e==`string`?lt(n,e):void 0,i=st(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}=N(e),a=Ia(n,0),o=Ia(r,100);if(a===void 0||o===void 0)return(0,Y.jsx)(B,{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,Y.jsxs)(`div`,{className:U(`min-w-0`,t),children:[(0,Y.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 text-body`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:i}),(0,Y.jsxs)(`span`,{className:`tabular-nums`,children:[a.toLocaleString($e()),` / `,o.toLocaleString($e())]})]}),(0,Y.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,Y.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=V(t),f=Xe(e,{filter:n,sort:r,key:i,enabled:!d}),p=d?Lt(e,d):f,m=e=>p.data?(0,Y.jsx)(Gt,{value:p.data,children:e}):void 0,h=p.isPending?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(B,{className:`h-4 w-1/2`}),(0,Y.jsx)(B,{className:`h-4 w-1/3`})]}):p.error?(0,Y.jsx)(K,{title:A(`couldNotLoad`),error:p.error}):p.data?m((0,Y.jsx)(`div`,{className:`flex flex-col gap-3`,children:l})):(0,Y.jsx)(M,{children:s??A(`nothingYet`)});return(0,Y.jsx)(R,{title:a,description:o,actions:c?m(c):void 0,className:U(`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}=N(e),f=W().resources[a];return f?(0,Y.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=Ht(`app/related-cards`),Va=({children:e})=>{let t=(0,J.useRef)(null),[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(!1);return(0,J.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,Y.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,Y.jsx)(`div`,{className:U(`w-full min-w-0`,!n&&`max-h-40 overflow-hidden`),children:(0,Y.jsx)(`div`,{ref:t,children:e})}),(i||n)&&(0,Y.jsx)(I,{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}=W(),a=st(e,t);if(a.state===`missing`||a.state===`ready`&&Ha(a.value))return null;let o=a.state===`loading`?(0,Y.jsx)(B,{className:`h-4 w-24`}):(0,Y.jsx)(ot,{model:a.model,field:a.field,value:a.value}),s=r?(0,Y.jsx)(Va,{children:o}):o;if(!n)return(0,Y.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,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`dt`,{className:`text-body text-muted-foreground`,children:c}),(0,Y.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=ne(),{resources:l}=W(),u=c(e.model,t,e.record,e.key),d=a.length>0||o!==void 0;return(0,Y.jsxs)(`li`,{"data-card":e.key,className:U(`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,Y.jsx)(Ke,{view:t,field:i,record:e.record}),(0,Y.jsxs)(`div`,{className:U(`flex min-w-0 items-baseline gap-2`,d&&`col-span-2 sm:col-span-1`),children:[(0,Y.jsx)(ze,{to:{kind:`record`,resource:e.model.name,key:y(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,Y.jsx)(`div`,{className:`ml-auto shrink-0 text-body whitespace-nowrap text-muted-foreground empty:hidden`,children:(0,Y.jsx)(Ua,{scope:e,path:r,labelled:!1})})]}),n.length>0&&(0,Y.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,Y.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,Y.jsx)(Ua,{scope:e,path:t,labelled:!1})},t))}),d&&(0,Y.jsx)(Gt,{value:e,children:(0,Y.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,Y.jsx)(cr,{button:o,model:e.model,view:t,record:e.record,models:l}),a.map(e=>(0,Y.jsx)(ri,{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=ne(),{resources:c}=W(),l=s(e.model,t,e.record,e.key);return(0,Y.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,Y.jsx)(Ke,{view:t,field:r,record:e.record}),(0,Y.jsx)(ze,{to:{kind:`record`,resource:e.model.name,key:y(e.model,e.record)},className:`self-start font-medium text-primary-text hover:underline`,children:l}),n.length>0&&(0,Y.jsx)(`dl`,{className:`flex flex-col gap-3`,children:n.map(t=>(0,Y.jsx)(Ua,{scope:e,path:t,clamped:!0},t))}),(i.length>0||a)&&(0,Y.jsx)(Gt,{value:e,children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a&&(0,Y.jsx)(cr,{button:a,model:e.model,view:t,record:e.record,models:c}),i.map(e=>(0,Y.jsx)(ri,{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,J.useRef)(null),n=(0,J.useRef)({current:e,previous:e}),r=(0,J.useRef)(void 0),[i,a]=(0,J.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,J.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,Y.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,Y.jsx)(B,{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:d,tone:f,planned:p})=>{let m=E(),h=lr(),g=t?.names?.plural??It(e.name),_=r||je(e,t),v=gn(e,{filter:n,sort:_,pageSize:s,enabled:!p}),y=_t(e,n,!p),b=p?p.rows:{isPending:v.isPending,error:v.error},x=p?p.rows.rows:v.data?.items,S=p?{data:p.total&&!p.total.isPending&&!p.total.error?nr(p.total):void 0}:y,C=(0,J.useMemo)(()=>(x??[]).map(t=>yt(e,t)),[e,x]),w=Xa((0,J.useMemo)(()=>C.map(e=>e.key),[C]));return(0,Y.jsxs)(`div`,{ref:w.root,children:[(()=>{if(b.isPending)return(0,Y.jsx)(Za,{compact:!!d,limit:s});if(b.error)return(0,Y.jsx)(K,{title:Ba(`couldNotLoad`),error:b.error});if(C.length===0)return(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:l??Ba(`nothingYet`)});let r=C.map(e=>{let n=(t,n)=>w.acted(e.key,t,n);return d?(0,Y.jsx)(Wa,{scope:e,view:t,fields:i,time:d.time,tone:f,actions:a,button:o,onActed:n},e.key):(0,Y.jsx)(Ga,{scope:e,view:t,fields:i,tone:f,actions:a,button:o,onActed:n},e.key)}),p=S.data===void 0?void 0:Gn(C.length,S.data,!1);return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[u===void 0?(0,Y.jsx)(`ul`,{className:d?`flex flex-col gap-2`:`flex flex-col gap-3`,children:r}):(0,Y.jsx)(Kn,{scroll:h,label:g,share:u,children:r}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:p}),(0,Y.jsxs)(ze,{to:ir(e,t,m,{filter:n,orderBy:_,display:ar(t,m,{preferred:c})}),className:`flex items-center gap-1 font-medium text-primary-text hover:underline`,children:[$n(`viewAll`),` `,(0,Y.jsx)(`span`,{className:`sr-only`,children:g.toLowerCase()}),(0,Y.jsx)(Xn,{className:`size-3.5`,"aria-hidden":!0})]})]})]})})(),(0,Y.jsx)(`p`,{role:`status`,className:`sr-only`,children:w.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=N(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}=Qr(i),{resources:_,views:v}=W(),[y,b]=$t([t,t===void 0?void 0:`${t}#total`]),x=(0,J.useMemo)(()=>y&&{rows:y,total:b},[y,b]),C=_[a];if(!C)return null;let w=v[C.name];return(0,Y.jsx)(`section`,{className:U(`min-w-0`,r),"aria-label":f,children:(0,Y.jsx)(S,{title:f,help:p,actions:n.actions,children:(0,Y.jsx)(Qa,{model:C,view:w,filter:o,sort:s,fields:c??Nt(C,w),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}=W(),o=ee(i,a,e.name),s=Fn(e.name,t.listOf,!0),c=(t.names?.plural??It(e.name)).toLowerCase();if(!o.listOf)return null;if(s.error)return(0,Y.jsx)(K,{title:jn(`couldNotLoadYour`,{plural:c}),error:s.error});if(!s.data)return(0,Y.jsx)(B,{className:`h-24`});let l=Zn(o.model,s.data);return l?(0,Y.jsx)(dr,{...r,model:o.model,view:o.view,filter:``,scope:l,list:e.name,empty:n}):(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:n??jn(`noneYet`,{plural:c})})},no=({model:e,view:t,target:n,targetView:r,row:i})=>{let a=hn(y(e,i)),{name:o,chips:s,title:c,body:l}=pr({model:e,of:t.searchesOf,target:n,targetView:r,row:i,recordKey:a});return(0,Y.jsxs)(`section`,{"aria-label":c,className:`flex flex-col gap-3 py-4 first:pt-0 last:pb-0`,children:[(0,Y.jsx)(`h3`,{className:`text-[0.9375rem] font-semibold`,children:(0,Y.jsx)(ze,{to:{kind:`record`,resource:e.name,key:a},className:`hover:underline`,children:o??(0,Y.jsx)(Bn,{chips:s})})}),(0,Y.jsx)(dr,{...l})]})},ro=({model:e,view:t,empty:n})=>{let{resources:r,views:i}=W(),a=t.searchesOf,o=r[a.resource],s=Wn(e.name,!0),c=(t.names?.plural??It(e.name)).toLowerCase();return o?s.error?(0,Y.jsx)(K,{title:Vn(`couldNotLoadYour`,{plural:c}),error:s.error}):s.data?s.data.length===0?(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:n??Vn(`noneYet`,{plural:c})}):(0,Y.jsx)(`div`,{className:`flex flex-col divide-y`,children:s.data.map(n=>(0,Y.jsx)(no,{model:e,view:t,target:o,targetView:i[a.resource],row:n},hn(y(e,n))))}):(0,Y.jsx)(B,{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}=N(e),{resources:d,views:f}=W(),p=d[r];if(!p)return null;let m=f[p.name];return(0,Y.jsx)(R,{title:c,description:l,actions:t.actions,className:n,children:m?.searchesOf?(0,Y.jsx)(ro,{model:p,view:m,empty:u}):m?.listOf===void 0?(0,Y.jsx)(dr,{model:p,view:m,filter:i,sort:a,limit:o,display:s,empty:u}):(0,Y.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:o,views:s}=W(),c=ut(e.name),l=zt(),u=wn(),d=Cn(),p=s[e.name],[m,h]=(0,J.useState)(i),[g,_]=(0,J.useState)(()=>Aa(e,t,i?.record)),[v,y]=(0,J.useState)({}),[b,x]=(0,J.useState)(),[S,C]=(0,J.useState)(!1),w=(0,J.useRef)(Promise.resolve()),T=(0,J.useRef)(i),E=Aa(e,t,void 0),ee=m?jt(c,`update`)&&m.permissions?.update!==!1:jt(c,`create`),te=t.filter(t=>!ao(e.fields[t])),ne=te.some(t=>m?f(e.fields[t],g[t],m.record[t]):g[t]!==E[t]),re=async t=>{let n=T.current;if(n){let r=await l.update(e.name,n.key,ja(e,t,n.record),n.etag??`*`);return{...yt(e,r.record),etag:r.etag,permissions:r.permissions??n.permissions}}let r=await l.create(e.name,St(e,o,{...E,...t}));return{...yt(e,r.record),etag:r.etag}},ie=t=>{let r=w.current.then(async()=>{C(!0),x(void 0),await re(t).then(async r=>{T.current=r,h(r),y(e=>Object.fromEntries(Object.entries(e).filter(([e])=>!Object.hasOwn(t,e)))),await d(e.name),u.show({state:`success`,title:A(`saved`,{label:n??A(`settings`)})})},e=>{y(t=>({...t,...mn(e)})),x(e)}),C(!1)});w.current=r},ae=(t,n)=>{_(e=>({...e,[t]:n})),ao(e.fields[t])&&ie({[t]:n})};return(0,Y.jsx)(R,{title:n,description:r,className:U(`h-full`,a),children:(0,Y.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),ne&&ie(Object.fromEntries(te.map(e=>[e,g[e]])))},children:[b!==void 0&&Object.keys(v).length===0&&(0,Y.jsx)(K,{title:A(`notSaved`),error:b}),t.map(t=>{let n=e.fields[t],r=p?.fields[t]?.label??It(t),i=v[t];return(0,Y.jsx)(De,{name:t,label:r,help:p?.fields[t]?.help,error:i&&xn(n,r,i),children:(0,Y.jsx)(nt,{field:n,hints:p?.fields[t],value:g[t],stored:m?.record[t]??E[t],invalid:!!i,locked:!ee||n.readOnly,resource:e.name,onChange:e=>ae(t,e)})},t)}),ee&&ne&&(0,Y.jsx)(`div`,{children:(0,Y.jsx)(I,{type:`submit`,variant:`primary`,size:`sm`,loading:S,children:A(`save`)})})]})})},so=e=>{let t=Xe(e.model,{});return t.isPending?(0,Y.jsx)(R,{title:e.title,description:e.description,className:e.className,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(B,{className:`h-4 w-1/2`}),(0,Y.jsx)(B,{className:`h-4 w-1/3`})]})}):t.error?(0,Y.jsx)(R,{title:e.title,description:e.description,className:e.className,children:(0,Y.jsx)(K,{title:A(`couldNotLoad`),error:t.error})}):(0,Y.jsx)(oo,{...e,stored:t.data??void 0})},co=({node:e,className:t})=>{let{resource:n,fields:r=[],className:i,...a}=N(e),o=W().resources[n];return o?(0,Y.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}=W(),r=zt(),i=JSON.stringify(e),a=(0,J.useMemo)(()=>JSON.parse(i).map(Be),[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=En(e,o);return t===void 0?[]:[[e,t]]})),l=s.filter(e=>!c.has(e)),u=[...new Set(c.values())].flatMap(e=>n[e]?[n[e]]:[]),f=l.map(e=>lt(t,e)),p=Pt(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=An({queries:u.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=u.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 d(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}=N(e),[a]=uo([i],P());if(a===void 0)return null;let o=a?t:fo(e,n);return o==null?null:r===void 0?(0,Y.jsx)(Y.Fragment,{children:o}):(0,Y.jsx)(`div`,{className:r,children:o})},mo=(e,t)=>e.flatMap(e=>typeof e==`string`?[]:[String(Mt(e,L(t)).props.when)]),ho=({node:e,children:t,slots:n,className:r})=>{let i=P(),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,Y.jsx)(Y.Fragment,{children:s}):(0,Y.jsx)(`div`,{className:r,children:s})},go=({children:e})=>(0,Y.jsx)(Y.Fragment,{children:e}),_o=`text-2xl font-semibold tracking-tight tabular-nums`,vo=({model:e,at:t,filter:n})=>{let{views:r}=W(),i=V(t),a=_t(e,n,!i),o=i??a;if(o.isPending)return(0,Y.jsx)(B,{className:`h-8 w-16`});if(o.error)return(0,Y.jsx)(`span`,{className:`text-danger-text`,children:A(`couldNotCount`)});let s=i?nr(i):a.data;return(0,Y.jsx)(ze,{to:er(r[e.name],e.name,n),className:`${_o} hover:text-primary-text after:absolute after:inset-0 after:content-['']`,children:s.toLocaleString($e())})},yo=({field:e,format:t})=>{let n=un(e);return n.state===`loading`?(0,Y.jsx)(B,{className:`h-8 w-16`}):n.state===`missing`?null:n.state===`plain`?(0,Y.jsx)(`span`,{className:_o,children:ia(n.value)}):(0,Y.jsx)(`span`,{className:_o,children:(0,Y.jsx)(ot,{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}=N(e),{resources:u}=W(),d=a===void 0?void 0:u[a];return(0,Y.jsxs)(R,{className:U(`relative h-full`,n),bodyClassName:`flex flex-col`,children:[(0,Y.jsx)(`p`,{className:`text-muted-foreground break-words`,children:r}),(0,Y.jsxs)(`div`,{className:`mt-auto pt-1`,children:[i!==void 0&&(0,Y.jsx)(`span`,{className:_o,children:i}),d&&(0,Y.jsx)(vo,{model:d,...t!==void 0&&{at:t},filter:o}),s!==void 0&&(0,Y.jsx)(yo,{field:s,format:c})]}),l&&(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:l})]})},xo=(e,t,n)=>{let r=E(),i=Yn(t),[a,o]=(0,J.useState)(()=>Un(localStorage,i)),s=(0,J.useCallback)(e=>{o(e),or(localStorage,i,e)},[i]);return[ar(e,r,{picked:a,preferred:n}),s]},So=({model:e,items:t,columns:n,button:r,title:i,description:a,empty:o,actions:s,className:c})=>{let{resources:l,views:u}=W(),d=u[e.name],{fields:f}=se(),p=jt(ut(e.name),`update`),{go:m,href:h}=ae(),g=E(),_=!Ve(),v=(0,J.useMemo)(()=>n?.map(Ce)??Nt(e,d),[n,e,d]),y=(0,J.useMemo)(()=>on(e,d,v,{resources:l,views:u,fieldTypes:f}),[e,d,v,l,u,f]),b=(0,J.useMemo)(()=>g?wt(n)(y):y,[g,n,y]),x=(0,J.useMemo)(()=>r?Qn(b,e,d,r,l,_):b,[b,e,d,r,l,_]),S=(0,J.useMemo)(()=>t.map(t=>({...t,id:Ne(e,t)})),[t,e]),C=(0,J.useMemo)(()=>({total:S.length,rowAt:e=>S[e]}),[S]),w=rr({model:e,view:d,opens:void 0,resources:l,views:u,canUpdate:p}),T=e=>({href:h(e),onFollow:()=>m(e)});return(0,Y.jsx)(R,{title:i,description:a,actions:s,className:c,children:S.length===0?(0,Y.jsx)(M,{children:o??A(`nothingYet`)}):(0,Y.jsx)(Ln,{fit:!0,columns:x,source:C,latencyMs:0,onOpenRow:e=>m(w.address(e)),rowLink:e=>T(w.address(e)),rowActions:w.actions(T),rowNumbers:!1,selectable:!1})})},Co=e=>{let t=bt();return t?.model?(0,Y.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),v=m?C:g,y=(0,J.useMemo)(()=>i?.map(Ce),[i]),b=(0,J.useMemo)(()=>wt(i),[i]);return(0,Y.jsxs)(R,{title:l,description:u,actions:(0,Y.jsxs)(Y.Fragment,{children:[!m&&(0,Y.jsx)(sr,{view:t,value:v,onChange:_}),f]}),className:U(`h-full`,p),children:[(0,Y.jsx)(tr,{model:e,view:t,filter:n,sort:r,columns:y,button:a,bulk:o,limit:s,display:v,empty:d,phoneColumns:b,...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}=N(e),{resources:u,views:d}=W(),[f,p]=$t([t,t===void 0?void 0:`${t}#total`]),m=(0,J.useMemo)(()=>f&&{rows:f,total:p},[f,p]);if(o===void 0)return(0,Y.jsx)(Co,{...l,actions:n.actions,className:i});let h=u[o];return h?s===void 0?(0,Y.jsx)(wo,{...l,model:h,view:d[h.name],actions:n.actions,className:i,...m&&{planned:m}}):(0,Y.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}=en(),a=t=>i({[e]:t}),o=r[e],s=o===void 0?null:(0,Y.jsx)(Qe,{name:e,children:(0,Y.jsx)(di,{model:n.model,query:{key:o},children:t},o)});return(0,Y.jsx)(wo,{...n,chosen:{rowTo:a,key:o,details:s}})},Do=({node:e,children:t,className:n})=>{let{tab:r,pathOf:i}=yn(),{navigate:a}=Ct(),o=rt(e),s=Sn(o,r),c=e=>i(e===o[0]?.name?void 0:e);return(0,Y.jsxs)(`div`,{className:U(`flex flex-col gap-6`,n),children:[(0,Y.jsxs)(`select`,{"aria-label":A(`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,Y.jsx)(`option`,{value:``,disabled:!0}),o.map(e=>(0,Y.jsx)(`option`,{value:e.name,children:e.label},e.name))]}),(0,Y.jsx)(`nav`,{"aria-label":A(`tabs`),className:`hidden border-b md:block`,children:(0,Y.jsx)(`ul`,{className:`flex gap-1`,children:o.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(Vt,{to:c(e.name),"aria-current":e===s?`page`:void 0,className:U(`-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,Y.jsx)(J.Fragment,{children:t[o.indexOf(s)]},s.name):(0,Y.jsx)(Ue,{children:A(`noTab`,{name:r??``})})]})},Oo=({children:e})=>(0,Y.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=Jt(e,t?.valueLabels);return n===`done`?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(Le,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-success-text`}),r]}):n===`running`?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Y.jsx)(Ft,{hidden:!0,className:`size-3.5 shrink-0`}),r]}):n!==`error`&&vn(t?.valueColors,e)!==`red`?r:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-danger-text`,children:[(0,Y.jsx)(mr,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),r]})},Mo=({value:e})=>{let t=typeof e==`string`?ke(e):e;return t===Tn?(0,Y.jsx)(Re,{children:String(e)}):(0,Y.jsx)(u,{value:t})},No=({label:e,children:t})=>(0,Y.jsxs)(`div`,{className:`grid gap-1`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]}),Po=({call:e,statusHints:t})=>{let[n,r]=(0,J.useState)(!1),i=(0,J.useId)(),a=e.status!==void 0&&(0,Y.jsx)(jo,{value:e.status,hints:t,mark:e.state}),o=(0,Y.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,Y.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,Y.jsxs)(I,{size:`sm`,variant:`ghost`,className:`-ml-2.5 self-start`,"aria-expanded":n,"aria-controls":i,onClick:()=>r(!n),children:[(0,Y.jsx)(Oe,{"aria-hidden":!0,className:U(`size-3.5 transition-transform`,n&&`rotate-90`)}),o,a]}):(0,Y.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[o,a]}),n&&(0,Y.jsxs)(`div`,{id:i,className:`grid gap-2`,children:[e.input!==void 0&&(0,Y.jsx)(No,{label:Q(`callInput`),children:(0,Y.jsx)(Mo,{value:e.input})}),e.result!==void 0&&(0,Y.jsx)(No,{label:Q(`callResult`),children:(0,Y.jsx)(Mo,{value:e.result})}),e.error!==void 0&&(0,Y.jsx)(No,{label:Q(`callError`),children:(0,Y.jsx)(Re,{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&&T(s.time,e);if(e!==void 0&&!l&&o.push({kind:`day`,key:`day:${c.kind===`call`?c.key:t(c.row)}`,label:we(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=>Vr.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,J.useState)(!1),s=Ae(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,J.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}=W(),i=e?.model.name??``,a=Uo(i,{filter:e?.filter,orderBy:e&&te(e.fields.time),pageSize:t,enabled:e!==void 0},n);return e?{calls:a.items.map(t=>Vo(t,Bo(y(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:r,text:a,status:o,limit:s=50,empty:c,working:l,calls:u,planned:d})=>{let{resources:f,views:p}=W(),m=Pe(),h=m?.state.kind===`signed-in`?m.state.user.id:void 0,g=n===void 0?[]:[n],v=Te(f,p,e,g),x=Uo(e.name,{filter:t,orderBy:te(r),pageSize:s,labels:v},d?.messages),S=Wo(u,s,d?.calls),C=Go(x);if(C===`error`)return(0,Y.jsx)(K,{title:Q(`couldNotLoad`),error:x.error,onRetry:Jo(x)});if(C===`loading`)return(0,Y.jsx)(`div`,{className:`p-4`,children:(0,Y.jsx)(M,{children:Q(`loadingMessages`)})});let w=i(f,e,g,x.items,x.labels),T=Ao({items:S.calls,more:S.hasNextPage},{items:Fo(w,r),more:x.hasNextPage}),E=Lo(T,{key:t=>String(y(e,t)),sender:n,time:r,text:a,status:o}),ee=o===void 0?void 0:p[e.name]?.fields[o],ne=e.fields[a]!==void 0&&b(e.fields[a],p[e.name]?.fields[a]),re=E.findLast(e=>e.kind===`message`&&e.author!==void 0&&e.author.id===h);return(0,Y.jsxs)(Y.Fragment,{children:[qo(x)&&(0,Y.jsx)(`div`,{className:`shrink-0 p-2`,children:(0,Y.jsx)(K,{title:Q(`couldNotLoad`),error:x.error,onRetry:Jo(x)})}),u&&S.list.error&&(0,Y.jsx)(`div`,{className:`shrink-0 p-2`,children:(0,Y.jsx)(K,{title:Q(`couldNotLoadCalls`),error:S.list.error,onRetry:Jo(S.list)})}),(0,Y.jsx)(kt,{length:T.length,followKey:re?.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,Y.jsx)(ye,{label:e.label},e.key):e.kind===`call`?(0,Y.jsx)(Po,{call:e,statusHints:S.statusHints},e.key):(0,Y.jsx)(ge,{...e.author?{author:e.author}:{alone:!0},time:e.time,continued:e.continued,footer:e.status!==void 0&&(0,Y.jsx)(jo,{value:e.status,hints:ee}),children:ne&&e.text!==``?(0,Y.jsx)(_,{source:e.text,className:`whitespace-normal`}):e.text},e.key))})]})},Zo=({children:e})=>(0,Y.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}=N(e),{resources:g}=W(),[_]=uo(f===void 0?[]:[f],P()),[v,y]=$t([t,t===void 0?void 0:`${t}#calls`]),b=g[o];if(!b)return null;let x=p&&g[p.resource];return(0,Y.jsx)(`section`,{className:U(`flex min-w-0 flex-col`,r),"aria-label":i,children:(0,Y.jsx)(S,{title:i,help:a,actions:n.actions,children:(0,Y.jsx)(Zo,{children:(0,Y.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,Y.jsx)(`div`,{className:t,children:e}),es=({children:e,className:t})=>(0,Y.jsx)(`div`,{className:U(`flex`,t),children:e}),ts=({children:e,className:t})=>(0,Y.jsx)(`div`,{className:U(`flex flex-col`,t),children:e}),ns=({node:e,children:t,className:n})=>{let{as:r=`p`}=N(e);return(0,Y.jsx)(r,{className:n,children:t})},rs=({node:e,children:t})=>{let{source:n}=N(e),r=Ot(L(P()),n),i=(0,J.useMemo)(()=>({items:Array.isArray(r)?r:[]}),[r]);return(0,Y.jsx)(Yt,{value:i,children:t})},is=({node:e,className:t})=>{let{source:n,choices:r,label:i=n,defaultValue:a}=N(e),{values:o,linkTo:s}=en(),l=o[n];return(0,Y.jsxs)(`div`,{className:U(`flex flex-wrap items-center gap-2`,t),children:[(0,Y.jsx)(`span`,{className:`font-medium text-muted-foreground`,children:i}),r?(0,Y.jsx)(c,{label:i,value:l??``,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,Y.jsx)(`span`,{children:l})]})},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,J.useState)(!1),c=Ae(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,J.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=N(e),i=W().resources[r.reference],a=s(L(P())),o=V(t);return i?(0,Y.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,Y.jsx)(Rt,{read:r,list:i,empty:e,children:t})},ls=({node:e,at:t,children:n})=>{let r=N(e),i=W().resources[r.reference],a=s(L(P())),o=V(t);return i?(0,Y.jsx)(cs,{model:i,...w(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}=W(),s=V(t),c=Xe(e,{key:n,enabled:!s}),l=s?Lt(e,s):c;if(l.isPending)return(0,Y.jsx)(B,{className:`h-4 w-24`});if(l.error)return(0,Y.jsx)(K,{title:A(`couldNotLoad`),error:l.error});if(!l.data)return null;let u=i.length>0?(0,Y.jsx)(Gt,{value:l.data,children:i}):dt(e,o[e.name],l.data.record,n);return r===!1?(0,Y.jsx)(`span`,{className:a,children:u}):(0,Y.jsx)(ze,{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}=N(e),c=W().resources[i],l=Ot(L(P()),a);return c?l==null||l===``?s===void 0?null:(0,Y.jsx)(`span`,{className:r,children:s}):(0,Y.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=>Tt(e,t)).join(`, `),$=Ht(`users`),ps=({roles:e})=>{let{session:t}=q(),[n,r]=(0,J.useState)([]),[i,o]=(0,J.useState)([]),s=(0,J.useCallback)(()=>void t.users.invitations().then(o,()=>o([])),[t]);return(0,J.useEffect)(s,[s]),(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(gr,{title:$(`inviteSomeone`),description:$(`inviteDescription`),onInvite:async e=>{let i=await t.users.invite({email:e,roles:n});return r([]),s(),i},incomplete:n.length===0,children:(0,Y.jsx)(vr,{roles:e,selected:n,grantable:new Set(e.map(e=>e.name)),onChange:r})}),(0,Y.jsx)(a,{title:$(`notAcceptedYet`),description:i.length>0?$(`sendingAgain`):$(`nobodyWaiting`),children:i.length>0&&(0,Y.jsx)(`ul`,{className:`divide-y rounded-md border`,children:i.map(n=>(0,Y.jsx)(_r,{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 s(),e},onRevoke:async()=>{await t.users.revoke(n.id),s()}},n.id))})})]})},ms=({roles:e,onCreated:t})=>{let{session:n}=q(),[r,i]=(0,J.useState)(``),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)([]),{busy:f,error:p,run:m}=qe(),h=()=>m(async()=>{await n.users.create({email:r.trim(),name:o.trim(),roles:u,...c&&{password:c}}),i(``),s(``),l(``),d([]),t()}),g=!r.trim()||!o.trim()||u.length===0||c!==``&&c.length<12;return(0,Y.jsxs)(a,{title:$(`addAnAccount`),description:$(`addDescription`),children:[(0,Y.jsx)(F,{message:p}),(0,Y.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,Y.jsx)(O,{"aria-label":$(`email`),type:`email`,placeholder:`name@example.com`,value:r,onChange:e=>i(e.target.value),wrapperClassName:`flex-1`}),(0,Y.jsx)(O,{"aria-label":$(`name`),placeholder:$(`name`),autoComplete:`off`,value:o,onChange:e=>s(e.target.value),wrapperClassName:`flex-1`})]}),(0,Y.jsx)(O,{"aria-label":$(`password`),type:`password`,autoComplete:`new-password`,placeholder:$(`passwordOptional`,{length:12}),value:c,onChange:e=>l(e.target.value)}),(0,Y.jsx)(vr,{roles:e,selected:u,grantable:new Set(e.map(e=>e.name)),onChange:d}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(I,{type:`submit`,variant:`primary`,loading:f,disabled:g,children:$(`addAccount`)})})]})]})},hs=({user:e,roles:t,self:n})=>{let{session:r}=q(),[i,a]=(0,J.useState)(e),{busy:o,error:s,run:c,setError:l}=qe(),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,Y.jsx)(yr,{name:i.name,email:i.email,self:n,error:s,actions:(0,Y.jsxs)(Y.Fragment,{children:[i.blocked&&(0,Y.jsx)(H,{tone:`red`,children:$(`blocked`)}),!n&&(i.blocked?(0,Y.jsx)(I,{size:`sm`,loading:o,onClick:()=>d(!1),children:$(`unblock`)}):(0,Y.jsx)(I,{size:`sm`,variant:`danger`,loading:o,onClick:()=>d(!0),children:$(`block`)}))]}),children:(0,Y.jsx)(vr,{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}=q(),[i,a]=(0,J.useState)(``),o=(0,J.useCallback)((e,t)=>n.users.search(e,t).then(e=>({items:e.users,total:e.total})),[n,t]),s=xr(o,i),c=r.kind===`signed-in`?r.user.id:void 0;return(0,Y.jsx)(br,{title:$(`people`),description:$(`peopleDescription`),searchLabel:$(`findSomeone`),placeholder:$(`emailAddress`),query:i,onQuery:a,list:s,renderRow:n=>(0,Y.jsx)(hs,{user:n,roles:e,self:n.id===c},`${t}/${n.id}`)})},_s=()=>{let{session:e}=q(),[t,n]=(0,J.useState)([]),[r,i]=(0,J.useState)();return(0,J.useEffect)(()=>{e.users.roles().then(n,e=>i(e instanceof v?z(e):$(`couldNotReadRoles`)))},[e]),{roles:t,error:r}},vs=()=>{let{roles:e,error:t}=_s(),[n,r]=(0,J.useState)(0);return(0,Y.jsxs)(`div`,{className:`flex max-w-3xl flex-col gap-4`,children:[(0,Y.jsx)(F,{message:t}),(0,Y.jsx)(gs,{roles:e,version:n}),(0,Y.jsx)(ps,{roles:e}),(0,Y.jsx)(ms,{roles:e,onCreated:()=>r(e=>e+1)})]})},ys=({sender:e,busy:t,error:n,onSave:r,onClose:i})=>{let[a,o]=(0,J.useState)(e?.address??``),[s,c]=(0,J.useState)(e?.name??``),[l,u]=(0,J.useState)(e?.signature??``),[d,f]=(0,J.useState)(e?.isDefault??!1);return(0,Y.jsxs)(G,{title:e?e.address:m(`addFromAddress`),description:m(e?`changeFromAddressDescription`:`addFromAddressDescription`),onClose:i,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{onClick:i,children:m(`cancel`)}),(0,Y.jsx)(I,{variant:`primary`,loading:t,disabled:!a.trim(),onClick:()=>r({address:a.trim(),name:s.trim(),signature:l,isDefault:d}),children:m(e?`save`:`addAddress`)})]}),children:[!e&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[m(`fromAddress`),(0,Y.jsx)(O,{autoFocus:!0,type:`email`,value:a,maxLength:254,placeholder:m(`fromAddressPlaceholder`),onChange:e=>o(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:`mt-3 flex flex-col gap-1.5 font-medium`,children:[m(`fromName`),(0,Y.jsx)(O,{value:s,maxLength:100,placeholder:m(`fromNamePlaceholder`),onChange:e=>c(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:`mt-3 flex cursor-pointer items-center justify-between gap-3`,children:[(0,Y.jsx)(`span`,{children:m(`defaultFromAddress`)}),(0,Y.jsx)(he,{checked:d,onChange:f,label:m(`defaultFromAddress`)})]}),(0,Y.jsxs)(`label`,{className:`mt-3 flex flex-col gap-1.5 font-medium`,children:[m(`signature`),(0,Y.jsx)(ie,{value:l,maxLength:2e3,placeholder:m(`signaturePlaceholder`),onChange:e=>u(e.target.value)})]}),(0,Y.jsx)(F,{message:n})]})},bs=e=>e.signature?m(`ownSignature`):m(`genericSignature`),xs=({senders:{address:e,senders:t},onAdd:n,onUpdate:r,onRemove:i})=>{let[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(),[l,u]=(0,J.useState)(),d=(0,J.useRef)(!1),f=t.find(e=>e.isDefault),p=()=>{u(void 0),c(void 0)},h=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(m(`noAnswerFromServer`));if(!(e instanceof v))throw e;c(z(e))}finally{d.current=!1,o(!1)}}},g=e=>h(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,Y.jsxs)(`div`,{className:`mt-5 border-t pt-4`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold`,children:m(`fromAddresses`)}),(0,Y.jsx)(`p`,{className:`mt-1 mb-3 text-muted-foreground`,children:m(`fromAddressesDescription`)}),(0,Y.jsx)(F,{message:l?void 0:s}),(e||t.length>0)&&(0,Y.jsxs)(`ul`,{className:`mb-3 divide-y rounded-md border`,children:[e&&(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,Y.jsx)(Er,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`bdi`,{className:`block truncate font-medium`,children:e}),(0,Y.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:m(`mailboxOwnAddress`)})]}),f?(0,Y.jsx)(I,{size:`sm`,variant:`ghost`,loading:a,onClick:()=>void h(()=>r(f.id,{isDefault:!1})),children:m(`makeDefault`)}):(0,Y.jsx)(H,{tone:`blue`,children:m(`default`)})]}),t.map(e=>(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,Y.jsx)(Er,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`bdi`,{className:`block truncate font-medium`,children:e.address}),e.name&&(0,Y.jsx)(`bdi`,{className:`block truncate`,children:e.name}),(0,Y.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:bs(e)})]}),e.isDefault&&(0,Y.jsx)(H,{tone:`blue`,children:m(`default`)}),(0,Y.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>u({kind:`change`,sender:e}),children:m(`edit`)}),(0,Y.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>u({kind:`remove`,sender:e}),children:m(`remove`)})]},e.id))]}),(0,Y.jsxs)(I,{onClick:()=>u({kind:`add`}),children:[(0,Y.jsx)(_n,{className:`size-3.5`}),m(`addFromAddress`)]}),l?.kind===`add`&&(0,Y.jsx)(ys,{busy:a,error:s,onSave:e=>void g(e),onClose:p}),l?.kind===`change`&&(0,Y.jsx)(ys,{sender:l.sender,busy:a,error:s,onSave:e=>void g(e),onClose:p},l.sender.id),l?.kind===`remove`&&(0,Y.jsx)(G,{title:m(`removeFromAddress`,{address:l.sender.address}),description:m(`removeFromAddressDescription`),onClose:p,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{onClick:p,children:m(`cancel`)}),(0,Y.jsx)(I,{variant:`danger`,loading:a,onClick:()=>void h(()=>i(l.sender.id)),children:m(`remove`)})]}),children:(0,Y.jsx)(F,{message:s})})]})},Ss=(e,t,n)=>Object.fromEntries(In(e,t,{code:`not_linked`}).filter(e=>e.signInOnly).map(({link:e})=>[e.id,Me(`signInOnly`,{provider:n(e.provider),name:e.name})])),Cs=({links:e})=>{let{session:t,linkPersonalMail:n,signInProviders:r}=q(),{account:i}=t,[a]=(0,J.useState)(Ge),o=(0,J.useCallback)(async()=>{let[t,n,r]=await Promise.all([i.linkedPersonalMail(e),i.linkedProviders(),i.mailSenders()]);return{mail:t,providers:n,senders:r}},[i,e]),{data:s,error:c,reload:l}=k(o,m(`couldNotReadMethods`));return s?(0,Y.jsx)(Ee,{title:m(`mailbox`),description:m(`mailboxDescription`),providers:e.map(({id:e,name:t})=>({id:e,name:t})),linked:s.mail,notes:Ss(e,s,e=>r.find(t=>t.id===e)?.name??x(e)),reconnect:!0,onConnect:t=>n(e.find(e=>e.id===t)),error:a&&tt(a,e.length===1?e[0].name:m(`theProvider`)),children:(0,Y.jsx)(xs,{senders:s.senders,onAdd:async e=>{let t=await i.addMailSender(e);return bn(),await l(),t},onUpdate:async(e,t)=>{await i.updateMailSender(e,t),bn(),await l()},onRemove:async e=>{await i.removeMailSender(e),bn(),await l()}})}):(0,Y.jsx)(j,{error:c})},ws=()=>{let{personalMail:e}=q();return e.length>0?(0,Y.jsx)(Cs,{links:e}):null},Ts=e=>Sr(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,i]=(0,J.useState)(!1),[o,s]=(0,J.useState)(),[c,l]=(0,J.useState)(),u=async e=>{i(!0),s(void 0);try{await t(e.clientId),l(void 0)}catch(e){if(!(e instanceof v))throw e;s(z(e))}i(!1)};return(0,Y.jsxs)(a,{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,Y.jsx)(F,{message:c?void 0:o}),e.length===0?(0,Y.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,Y.jsx)(`ul`,{className:`divide-y rounded-md border`,children:e.map(e=>{let t=Cr(e.clientId);return(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,Y.jsx)(Or,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`bdi`,{className:`block truncate font-medium`,children:Ts(e)}),(0,Y.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[t&&`Published by ${t} · `,`Allowed `,r(Date.parse(e.allowedAt)),` · `,Es(e)]})]}),(0,Y.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>l(e),children:`Disconnect`})]},e.clientId)})}),c&&(0,Y.jsx)(G,{title:`Disconnect ${Ts(c)}?`,description:`It can no longer read or change anything as you. What it already started may keep working for up to 15 minutes.`,onClose:()=>l(void 0),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{onClick:()=>l(void 0),children:`Cancel`}),(0,Y.jsx)(I,{variant:`danger`,loading:n,onClick:()=>void u(c),children:`Disconnect`})]}),children:o&&(0,Y.jsx)(F,{message:o})})]})},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,Y.jsx)(a,{title:m(`mcpAddress`),description:m(`mcpAddressDescription`),children:(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(wr,{value:e,copyLabel:m(`copyMcpAddress`)}),(0,Y.jsxs)(`a`,{href:Os(e,t),target:`_blank`,rel:`noreferrer`,className:qt(),children:[(0,Y.jsx)(Dt,{className:`size-3.5`}),m(`addToClaude`)]})]})}),As=()=>{let{account:e}=q().session,{data:t,error:n,reload:r}=k((0,J.useCallback)(()=>e.connectedApps(),[e]),m(`couldNotReadMethods`));return t?(0,Y.jsx)(Ds,{apps:t,onDisconnect:t=>e.disconnectApp(t).then(r)}):(0,Y.jsx)(j,{error:n})},js=({url:e})=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ks,{url:e,appName:W().appName}),(0,Y.jsx)(As,{})]}),Ms=()=>{let{mcp:e}=q();return e?(0,Y.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=>r(Date.parse(e)),Is=e=>e?m(Date.parse(e)<=Date.now()?`expiredOn`:`expiresOn`,{date:Fs(e)}):m(`neverExpires`),Ls=e=>[m(`createdOn`,{date:Fs(e.createdAt)}),Is(e.expiresAt),e.lastUsedAt?m(`lastUsedOn`,{date:Fs(e.lastUsedAt)}):m(`notUsedYet`),e.organization?m(`actsAsIn`,{role:e.role,organization:e.organization}):m(`actsAs`,{role:e.role})].join(` · `),Rs=({tokens:e,onCreate:t,onRevoke:n})=>{let[r,i]=(0,J.useState)(!1),[o,s]=(0,J.useState)(),[c,l]=(0,J.useState)(),[u,d]=(0,J.useState)(``),[f,h]=(0,J.useState)(`90`),[g,_]=(0,J.useState)(),y=()=>{l(void 0),s(void 0),_(void 0)},b=(0,J.useRef)(!1),x=async e=>{if(!b.current){b.current=!0,i(!0),s(void 0);try{l(await e()),_(void 0)}catch(e){if(e instanceof TypeError)return s(m(`noAnswerFromServer`));if(!(e instanceof v))throw e;e.code===`STRONG_SIGN_IN_REQUIRED`?_(`asked`):s(z(e))}finally{b.current=!1,i(!1)}}},S=()=>x(async()=>{let e=Ns[f];return{kind:`created`,created:await t({name:u.trim(),...e!==void 0&&{expiresInDays:e}})}});return(0,Y.jsxs)(a,{title:m(`accessTokens`),description:m(`accessTokensDescription`),children:[(0,Y.jsx)(F,{message:c?void 0:o}),e.length===0?(0,Y.jsx)(`p`,{className:`mb-3 text-muted-foreground`,children:m(`noAccessTokens`)}):(0,Y.jsx)(`ul`,{className:`mb-3 divide-y rounded-md border`,children:e.map(e=>(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,Y.jsx)(Ar,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`bdi`,{className:`block truncate font-medium`,children:e.name}),(0,Y.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:Ls(e)})]}),(0,Y.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>l({kind:`revoke`,token:e}),children:m(`revoke`)})]},e.id))}),(0,Y.jsxs)(I,{onClick:()=>{d(``),h(`90`),l({kind:`create`})},children:[(0,Y.jsx)(_n,{className:`size-3.5`}),m(`newAccessToken`)]}),c?.kind===`create`&&(0,Y.jsxs)(G,{title:m(`newAccessToken`),description:m(`newAccessTokenDescription`),onClose:y,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{onClick:y,children:m(`cancel`)}),(0,Y.jsx)(I,{variant:`primary`,loading:r,disabled:!u.trim(),onClick:()=>void S(),children:m(`createAccessToken`)})]}),children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[m(`name`),(0,Y.jsx)(O,{autoFocus:!0,value:u,maxLength:100,placeholder:m(`accessTokenNamePlaceholder`),onChange:e=>d(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:`mt-3 flex flex-col gap-1.5 font-medium`,children:[m(`accessTokenExpiry`),(0,Y.jsx)(p,{value:f,onChange:e=>h(e.target.value),children:Object.keys(Ns).map(e=>(0,Y.jsx)(`option`,{value:e,children:m(Ps[e])},e))})]}),g===`asked`&&(0,Y.jsx)(dn,{purpose:`change`,minutes:15,onConfirmed:()=>_(`done`)}),g===`done`&&(0,Y.jsx)(`p`,{className:`mt-2 text-muted-foreground`,children:m(`confirmedCreateAccessToken`)}),(0,Y.jsx)(F,{message:o})]}),c?.kind===`created`&&(0,Y.jsx)(G,{title:m(`accessTokenCreated`,{name:c.created.personalAccessToken.name}),description:m(`accessTokenCreatedDescription`),onClose:y,actions:(0,Y.jsx)(I,{variant:`primary`,onClick:y,children:m(`done`)}),children:(0,Y.jsx)(wr,{value:c.created.token,copyLabel:m(`copyAccessToken`)})}),c?.kind===`revoke`&&(0,Y.jsx)(G,{title:m(`revokeAccessToken`,{name:c.token.name}),description:m(`revokeAccessTokenDescription`),onClose:y,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{onClick:y,children:m(`cancel`)}),(0,Y.jsx)(I,{variant:`danger`,loading:r,onClick:()=>void x(async()=>(await n(c.token.id),void 0)),children:m(`revoke`)})]}),children:(0,Y.jsx)(F,{message:o})})]})},zs=()=>{let{account:e}=q().session,{data:t,error:n,reload:r}=k((0,J.useCallback)(()=>e.personalAccessTokens(),[e]),m(`couldNotReadAccessTokens`));return t?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(F,{message:n}),(0,Y.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,Y.jsx)(j,{error:n})},Bs=()=>q().personalAccessTokens?(0,Y.jsx)(zs,{}):null,Vs={revoked:`disconnectedRevoked`,queued:`disconnectedQueued`,not_revoked:`disconnectedNotRevoked`},Hs=e=>e.provider===`google`,Us=({connections:e,onConnect:t,onDisconnect:n,error:i})=>{let[o,s]=(0,J.useState)(),[c,l]=(0,J.useState)(i),[u,d]=(0,J.useState)(),[f,p]=(0,J.useState)(),h=async(e,t)=>{s(e),l(void 0),p(void 0);try{await t(),d(void 0)}catch(e){if(!(e instanceof v))throw e;l(z(e))}finally{s(void 0)}};return(0,Y.jsxs)(a,{title:m(`connections`),description:m(`connectionsDescription`),children:[(0,Y.jsx)(F,{message:u?void 0:c}),(0,Y.jsx)(ln,{message:f}),(0,Y.jsx)(`ul`,{className:`divide-y rounded-md border`,children:e.map(e=>(0,Y.jsxs)(`li`,{className:`flex flex-col gap-2 px-3 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Y.jsx)(Pr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.label}),(0,Y.jsx)(I,{size:`sm`,loading:o===e.key,disabled:o!==void 0,onClick:()=>void h(e.key,()=>t(e)),children:e.accounts.length>0?m(`connectAgain`,{name:e.label}):m(`connect`,{name:e.label})})]}),e.accounts.map(t=>(0,Y.jsxs)(J.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 pl-7 text-sm`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1 text-muted-foreground`,children:[m(`connectedOn`,{date:r(Date.parse(t.created_at))}),` · `,(0,Y.jsx)(`code`,{className:`text-xs`,children:t.id})]}),t.needs_sign_in?(0,Y.jsx)(H,{tone:`amber`,children:m(`connectionNeedsSignIn`)}):(0,Y.jsx)(H,{tone:`green`,children:m(`connected`)}),(0,Y.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>d({connection:e,accountId:t.id}),children:m(`disconnect`)})]}),t.used_by.length>0&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 pl-7 text-sm`,children:[(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:m(`connectionUsedBy`)}),t.used_by.map(e=>(0,Y.jsx)(me,{resource:`workflows`,recordKey:e.id,className:`font-medium text-primary-text hover:underline`,children:e.name},e.id))]})]},t.id))]},e.key))}),u&&(0,Y.jsx)(G,{title:m(`disconnectTitle`,{name:u.connection.label}),description:Hs(u.connection)?`${m(`disconnectDescription`)} ${m(`disconnectWholeGrant`)}`:m(`disconnectDescription`),onClose:()=>d(void 0),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{onClick:()=>d(void 0),children:m(`cancel`)}),(0,Y.jsx)(I,{variant:`danger`,loading:o===u.accountId,onClick:()=>void h(u.accountId,async()=>p(m(Vs[await n(u.accountId)]))),children:m(`disconnect`)})]}),children:c&&(0,Y.jsx)(F,{message:c})})]})},Ws=()=>{let{session:e,connectAccount:t}=q(),{account:n}=e,[r]=(0,J.useState)(Ge),{data:i,error:a,reload:o}=k((0,J.useCallback)(()=>n.workflowConnections(),[n]),m(`couldNotReadMethods`));return i?i.length===0?null:(0,Y.jsx)(Us,{connections:i,onConnect:t,onDisconnect:e=>n.disconnectAccount(e).finally(o),error:r&&tt(r,m(`theProvider`))}):(0,Y.jsx)(j,{error:a})},Gs=e=>e.code===`LAST_ADMIN`?m(`deleteAccountLastAdmin`):e.code===`ACCOUNT_LOCKED`?m(`deleteAccountLocked`):z(e),Ks=({hasPassword:e,onDelete:t,onClose:n})=>{let[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(),[l,u]=(0,J.useState)(!1),d=(0,J.useId)(),f=async()=>{o(!0),c(void 0),u(!1);try{await t(e?r:void 0)}catch(e){if(!(e instanceof v))throw e;e.code===`STRONG_SIGN_IN_REQUIRED`?u(!0):c(Gs(e)),o(!1)}};return(0,Y.jsxs)(G,{title:m(`deleteAccountQuestion`),description:m(`deleteAccountWarning`),onClose:n,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{onClick:n,children:m(`cancel`)}),(0,Y.jsx)(I,{variant:`danger`,type:`submit`,form:d,loading:a,disabled:e&&!r,children:m(`deleteAccountConfirm`)})]}),children:[(0,Y.jsxs)(`form`,{id:d,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),f()},children:[e&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[m(`deleteAccountPassword`),(0,Y.jsx)(O,{type:`password`,name:`current-password`,autoComplete:`current-password`,autoFocus:!0,value:r,invalid:!!s,onChange:e=>i(e.target.value)})]}),(0,Y.jsx)(F,{message:s})]}),l&&(0,Y.jsx)(dn,{purpose:`change`,minutes:15,onConfirmed:()=>void f()})]})},qs=({hasPassword:e,staff:t,onDelete:n})=>{let[r,i]=(0,J.useState)(!1);return(0,Y.jsxs)(a,{title:m(`deleteAccount`),description:m(t?`deleteAccountStaff`:`deleteAccountDescription`),children:[!t&&(0,Y.jsx)(I,{variant:`danger`,onClick:()=>i(!0),children:m(`deleteAccount`)}),r&&(0,Y.jsx)(Ks,{hasPassword:e,onDelete:n,onClose:()=>i(!1)})]})},Js=()=>{let{session:e,state:t,deleteAccount:n}=q(),{account:r}=e,{data:i,error:a}=k((0,J.useCallback)(()=>r.signInMethods(),[r]),m(`couldNotReadMethods`));return i?(0,Y.jsx)(qs,{hasPassword:i.account.password,staff:t.kind===`signed-in`&&!!t.staff,onDelete:n}):(0,Y.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?m(`deviceThrough`,{device:e.device,provider:e.name}):e.name,ec=(e,t)=>{if(e.staff)return t?m(`staffOf`,{operator:t}):m(`staff`);let{browser:n,system:r}=Qs(e.userAgent);return n&&r?m(`browserOn`,{browser:n,system:r}):r?m(`aBrowserOn`,{system:r}):n??m(`unknownDevice`)},tc=e=>{if(e.staff)return Ir;let{system:t}=Qs(e.userAgent);return t===`iPhone`||t===`Android`?Rr:t===`iPad`?Br:Mr},nc=e=>[...e].sort((e,t)=>Number(t.current)-Number(e.current)||t.createdAt.localeCompare(e.createdAt)),rc=(e,t)=>e.kind===`one`?m(`signOutDevice`,{name:ec(e.session,t)}):e.kind===`link`?m(`signOutDevice`,{name:$s(e.link)}):m(`signOutOthersTitle`),ic=e=>m(e.kind===`one`?`signOutDeviceDescription`:e.kind===`link`?`signOutLinkedDeviceDescription`:`signOutOthersDescription`),ac=({sessions:e,operator:t,links:n=[],onSignOut:r,onSignOutOthers:i,onSignOutLink:o})=>{let[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(),[d,f]=(0,J.useState)(),p=e.filter(e=>!n.some(t=>t.sessions.includes(e.token))),h=e.filter(e=>!e.current),g=e=>e.kind===`one`?r(e.session.token):e.kind===`link`?o(e.link.id):i(),_=async e=>{c(!0),u(void 0);try{await g(e),f(void 0)}catch(e){if(!(e instanceof v))throw e;u(z(e))}c(!1)},y=e=>{u(void 0),f(e)};return(0,Y.jsxs)(a,{title:m(`devices`),description:m(`devicesDescription`),children:[p.length===0&&n.length===0?(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:m(`noDevices`)}):(0,Y.jsxs)(`ul`,{className:`divide-y rounded-md border`,children:[nc(p).map(e=>{let n=tc(e);return(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,Y.jsx)(n,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`bdi`,{className:`truncate font-medium`,children:ec(e,t)}),e.current&&(0,Y.jsx)(H,{tone:`green`,children:m(`thisDevice`)})]}),(0,Y.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[m(`signedInFromUntil`,{from:mt(Date.parse(e.createdAt)),until:mt(Date.parse(e.expiresAt))}),!e.staff&&e.ipAddress&&` · ${e.ipAddress}`]})]}),!e.current&&(0,Y.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>y({kind:`one`,session:e}),children:m(`signOut`)})]},e.token)}),n.map(t=>{let n=e.some(e=>e.current&&t.sessions.includes(e.token));return(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,Y.jsx)(Rr,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`bdi`,{className:`truncate font-medium`,children:$s(t)}),n&&(0,Y.jsx)(H,{tone:`green`,children:m(`thisDevice`)})]}),(0,Y.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:m(`linkedOn`,{date:mt(Date.parse(t.linkedAt))})})]}),!n&&o&&(0,Y.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>y({kind:`link`,link:t}),children:m(`signOut`)})]},t.id)})]}),h.length>0&&(0,Y.jsx)(I,{className:`mt-3`,onClick:()=>y({kind:`others`}),children:m(`signOutOthers`)}),d&&(0,Y.jsx)(G,{title:rc(d,t),description:ic(d),onClose:()=>f(void 0),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{onClick:()=>f(void 0),children:m(`cancel`)}),(0,Y.jsx)(I,{variant:`danger`,loading:s,onClick:()=>void _(d),children:m(`signOut`)})]}),children:(0,Y.jsx)(F,{message:l})})]})},oc=()=>{let{session:e,staffSignIn:t,deviceLinks:n}=q(),{account:r}=e,i=(0,J.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}=k(i,m(`couldNotReadDevices`));return a?(0,Y.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,Y.jsx)(j,{error:o})},sc={allowed:`passkeysAllowed`,required:`passkeysRequired`,forbidden:`passkeysForbidden`},cc=({rule:e,passkeys:t,onAdd:n,onRename:i,onRemove:o})=>{let[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(),[d,f]=(0,J.useState)(),[p,h]=(0,J.useState)(``),[g,_]=(0,J.useState)(),y=e===`required`&&t.length<=1,b=async e=>{c(!0),u(void 0),_(void 0);try{await e(),f(void 0)}catch(e){if(!(e instanceof v))throw e;e.code===`STRONG_SIGN_IN_REQUIRED`?_(`asked`):u(z(e))}c(!1)};return(0,Y.jsxs)(a,{title:m(`passkeys`),status:e===`required`&&(0,Y.jsx)(H,{tone:`blue`,children:m(`required`)}),description:m(sc[e]),children:[(0,Y.jsx)(F,{message:d?void 0:l}),t.length>0&&(0,Y.jsx)(`ul`,{className:`mb-3 divide-y rounded-md border`,children:t.map(e=>(0,Y.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 px-3 py-2.5`,children:[(0,Y.jsx)(be,{className:`size-4 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate font-medium`,children:e.name??m(`passkey`)}),(0,Y.jsxs)(`span`,{className:`block text-xs text-muted-foreground`,children:[e.createdAt?m(`addedOn`,{date:r(Date.parse(e.createdAt))}):m(`addedEarlier`),` · `,e.backedUp?m(`synced`):m(`oneDevice`)]})]}),(0,Y.jsxs)(`span`,{className:`flex gap-1`,children:[(0,Y.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{h(e.name??``),f({kind:`rename`,passkey:e})},children:m(`rename`)}),(0,Y.jsx)(I,{size:`sm`,variant:`ghost`,disabled:y,title:y?m(`keepLastPasskey`):void 0,onClick:()=>f({kind:`remove`,passkey:e}),children:m(`remove`)})]})]},e.id))}),e!==`forbidden`&&(0,Y.jsxs)(I,{loading:s&&!d,onClick:()=>void b(n),children:[(0,Y.jsx)(_n,{className:`size-3.5`}),m(`addPasskey`)]}),g===`asked`&&(0,Y.jsx)(dn,{purpose:`change`,withPassword:!0,minutes:15,onConfirmed:()=>_(`done`)}),g===`done`&&(0,Y.jsx)(`p`,{className:`mt-2 text-muted-foreground`,children:m(`confirmedAddPasskey`)}),d?.kind===`rename`&&(0,Y.jsxs)(G,{title:m(`renamePasskey`),description:m(`renamePasskeyDescription`),onClose:()=>f(void 0),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{onClick:()=>f(void 0),children:m(`cancel`)}),(0,Y.jsx)(I,{variant:`primary`,loading:s,disabled:!p.trim(),onClick:()=>void b(()=>i(d.passkey.id,p.trim())),children:m(`save`)})]}),children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[m(`name`),(0,Y.jsx)(O,{autoFocus:!0,value:p,maxLength:60,onChange:e=>h(e.target.value)})]}),(0,Y.jsx)(F,{message:l})]}),d?.kind===`remove`&&(0,Y.jsx)(G,{title:m(`removePasskey`),description:m(`removePasskeyDescription`,{name:d.passkey.name??m(`thisPasskey`)}),onClose:()=>f(void 0),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{onClick:()=>f(void 0),children:m(`cancel`)}),(0,Y.jsx)(I,{variant:`danger`,loading:s,onClick:()=>void b(()=>o(d.passkey.id)),children:m(`remove`)})]}),children:l&&(0,Y.jsx)(F,{message:l})})]})},lc=()=>{let{account:e}=q().session,t=(0,J.useCallback)(()=>Promise.all([e.signInMethods(),e.passkeys()]),[e]),{data:n,error:r,reload:i}=k(t,m(`couldNotReadMethods`));if(!n)return(0,Y.jsx)(j,{error:r});let[a,o]=n;return(0,Y.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`?m(`useAtLeast`,{length:12}):e.code===`PASSWORD_TOO_LONG`?m(`passwordTooLong`):z(e),dc=(e,t)=>{if(e.length<12)return m(`useAtLeast`,{length:12});if(e!==t)return m(`passwordsDiffer`)},fc=({hasPassword:e,onSave:t,onClose:n})=>{let[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(),p=(0,J.useId)(),h=(!e||r)&&a&&s,g=async()=>{let e=dc(a,s);if(f(e),!e){u(!0);try{await t({current:r,next:a})}catch(e){if(!(e instanceof v))throw e;f(uc(e)),u(!1)}}};return(0,Y.jsx)(G,{title:m(e?`changePassword`:`setPassword`),description:m(`atLeast`,{length:12}),onClose:n,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{onClick:n,children:m(`cancel`)}),(0,Y.jsx)(I,{variant:`primary`,type:`submit`,form:p,loading:l,disabled:!h,children:m(`save`)})]}),children:(0,Y.jsxs)(`form`,{id:p,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),g()},children:[e&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[m(`currentPassword`),(0,Y.jsx)(O,{type:`password`,name:`current-password`,autoComplete:`current-password`,autoFocus:!0,value:r,onChange:e=>i(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[m(`newPassword`),(0,Y.jsx)(O,{type:`password`,name:`new-password`,autoComplete:`new-password`,autoFocus:!e,value:a,invalid:!!d,onChange:e=>o(e.target.value)})]}),(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[m(`repeatPassword`),(0,Y.jsx)(O,{type:`password`,name:`repeat-password`,autoComplete:`new-password`,value:s,invalid:!!d,onChange:e=>c(e.target.value)})]}),e&&(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:m(`changeSignsOutOthers`)}),(0,Y.jsx)(F,{message:d})]})})},pc=({rule:e,hasPassword:t,staff:n})=>m(n?`passwordStaff`:e===`forbidden`?`passwordForbidden`:t?`passwordIsSet`:`passwordNotSet`),mc=({rule:e,hasPassword:t,staff:n,onChange:r,onSet:i})=>{let[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(!1),u=!n&&e===`allowed`;return(0,Y.jsxs)(a,{title:m(`password`),description:pc({rule:e,hasPassword:t,staff:n}),children:[(0,Y.jsx)(ln,{message:c?m(`passwordSaved`):void 0}),u&&(0,Y.jsx)(I,{onClick:()=>{l(!1),s(!0)},children:m(t?`changePassword`:`setPassword`)}),o&&(0,Y.jsx)(fc,{hasPassword:t,onClose:()=>s(!1),onSave:async({current:e,next:n})=>{await(t?r(e,n):i(n)),s(!1),l(!0)}})]})},hc=()=>{let{session:e,state:t}=q(),{account:n}=e,{data:r,error:i,reload:a}=k((0,J.useCallback)(()=>n.signInMethods(),[n]),m(`couldNotReadMethods`));return r?(0,Y.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,Y.jsx)(j,{error:i})},gc=({email:e,change:t,onDone:n,onClose:r})=>{let[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(),[c,l]=(0,J.useState)(``),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(),h=async e=>{d(!0),p(void 0);try{await e()}catch(e){if(!(e instanceof v))throw e;p(z(e))}d(!1)},g=i.trim(),_=()=>h(async()=>{await t.request(g),l(``),s(g)}),y=e=>h(async()=>{await t.confirm(o,e),n()});return o?(0,Y.jsxs)(G,{title:m(`changeEmail`),description:m(`codeSentTo`,{email:o,minutes:10}),onClose:r,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{variant:`ghost`,onClick:()=>{s(void 0),p(void 0)},children:m(`otherAddress`)}),(0,Y.jsx)(I,{variant:`primary`,loading:u,disabled:c.length<6,onClick:()=>void y(c),children:m(`changeEmail`)})]}),children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[m(`code`),(0,Y.jsx)(Ze,{name:`code`,required:!0,autoFocus:!0,value:c,invalid:!!f,onChange:l,onComplete:e=>!u&&void y(e)})]}),(0,Y.jsx)(F,{message:f})]}):(0,Y.jsxs)(G,{title:m(`changeEmail`),description:m(`changeEmailDescription`),onClose:r,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{onClick:r,children:m(`cancel`)}),(0,Y.jsx)(I,{variant:`primary`,loading:u,disabled:!g||g.toLowerCase()===e.toLowerCase(),onClick:()=>void _(),children:m(`sendCode`)})]}),children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[m(`newEmail`),(0,Y.jsx)(O,{type:`email`,autoComplete:`email`,autoFocus:!0,value:i,onChange:e=>a(e.target.value)})]}),(0,Y.jsx)(F,{message:f})]})},_c=({name:e,email:t,onRename:n,emailChange:r,onEmailChanged:i})=>{let[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(!1),[h,g]=(0,J.useState)(),_=async()=>{p(!0),g(void 0);try{await n(u.trim()),s(!1)}catch(e){if(!(e instanceof v))throw e;g(z(e))}p(!1)};return(0,Y.jsxs)(a,{title:m(`profile`),description:m(`profileDescription`),children:[(0,Y.jsxs)(`dl`,{className:`mb-3 grid grid-cols-[auto_1fr] gap-x-6 gap-y-1.5`,children:[(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:m(`name`)}),(0,Y.jsx)(`dd`,{className:`min-w-0 truncate font-medium`,children:e}),(0,Y.jsx)(`dt`,{className:`text-muted-foreground`,children:m(`email`)}),(0,Y.jsx)(`dd`,{className:`min-w-0 truncate font-medium`,children:t})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsx)(I,{onClick:()=>{d(e),g(void 0),s(!0)},children:m(`changeName`)}),r&&(0,Y.jsx)(I,{onClick:()=>l(!0),children:m(`changeEmail`)})]}),o&&(0,Y.jsxs)(G,{title:m(`changeName`),description:m(`changeNameDescription`),onClose:()=>s(!1),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{onClick:()=>s(!1),children:m(`cancel`)}),(0,Y.jsx)(I,{variant:`primary`,loading:f,disabled:!u.trim()||u.trim()===e,onClick:()=>void _(),children:m(`save`)})]}),children:[(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[m(`name`),(0,Y.jsx)(O,{autoFocus:!0,value:u,maxLength:100,onChange:e=>d(e.target.value)})]}),(0,Y.jsx)(F,{message:h})]}),c&&r&&(0,Y.jsx)(gc,{email:t,change:r,onClose:()=>l(!1),onDone:()=>{l(!1),i?.()}})]})},vc=()=>{let{session:e,changeEmail:t}=q(),{data:n,loaded:r,error:i,reload:a}=k((0,J.useCallback)(()=>e.session(),[e]),m(`couldNotReadProfile`));if(!r)return(0,Y.jsx)(j,{error:i});if(!n)return null;let o=t?{request:e.account.requestEmailChange,confirm:e.account.changeEmail}:void 0;return(0,Y.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,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(),[p,h]=(0,J.useState)(!1),g=async()=>{u(!0),f(void 0),h(!1);try{await a(i?s:void 0)}catch(e){if(!(e instanceof v))throw e;e.code===`STRONG_SIGN_IN_REQUIRED`?h(!0):f(z(e)),u(!1)}};return(0,Y.jsxs)(G,{title:e,description:t,onClose:o,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(I,{onClick:o,children:m(`cancel`)}),(0,Y.jsx)(I,{variant:r?`danger`:`primary`,loading:l,disabled:i&&!s,onClick:()=>void g(),children:n})]}),children:[i&&(0,Y.jsxs)(`label`,{className:`flex flex-col gap-1.5 font-medium`,children:[m(`yourPassword`),(0,Y.jsx)(O,{type:`password`,autoComplete:`current-password`,autoFocus:!0,value:s,invalid:!!d,onChange:e=>c(e.target.value),onKeyDown:e=>e.key===`Enter`&&s&&void g()})]}),d&&(0,Y.jsx)(`p`,{role:`alert`,className:`mt-2 text-body font-medium text-danger-text`,children:d}),p&&(0,Y.jsx)(dn,{purpose:`change`,minutes:15,onConfirmed:()=>void g()})]})},bc={allowed:`twoFactorAllowed`,required:`twoFactorRequired`,forbidden:`twoFactorForbidden`},xc=e=>{let{rule:t,enabled:n,authenticatorApp:r,mail:i,needsPassword:o,onTurnOff:s,onNewBackupCodes:c,onChanged:l}=e,[u,d]=(0,J.useState)(),f=()=>d(void 0),p=n?(0,Y.jsx)(H,{tone:`green`,children:m(`on`)}):t===`required`?(0,Y.jsx)(H,{tone:`amber`,children:m(`required`)}):(0,Y.jsx)(H,{children:m(`off`)}),h=m(n?r?i?`twoFactorOnWithAppOrMail`:`twoFactorOnWithApp`:`twoFactorOnWithMail`:bc[t]);return u?.kind===`setup`?(0,Y.jsx)(a,{title:m(`twoFactor`),status:p,description:h,children:(0,Y.jsx)(`div`,{className:`max-w-sm`,children:(0,Y.jsx)(sn,{offerEmailedCodes:i&&!u.appOnly,needsPassword:o,onStartApp:e.onStartApp,onConfirmApp:e.onConfirmApp,onEmailedCodes:e.onEmailedCodes,onCancel:f,onDone:()=>{f(),l()}})})}):(0,Y.jsxs)(a,{title:m(`twoFactor`),status:p,description:h,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[!n&&t!==`forbidden`&&(0,Y.jsx)(I,{variant:`primary`,onClick:()=>d({kind:`setup`,appOnly:!1}),children:m(`turnOn`)}),n&&!r&&t!==`forbidden`&&(0,Y.jsx)(I,{onClick:()=>d({kind:`setup`,appOnly:!0}),children:m(`addAuthenticator`)}),n&&r&&(0,Y.jsx)(I,{onClick:()=>d({kind:`new-codes`}),children:m(`newBackupCodes`)}),n&&(0,Y.jsx)(I,{variant:`danger`,disabled:t===`required`,title:t===`required`?m(`twoFactorIsRequired`):void 0,onClick:()=>d({kind:`turn-off`}),children:m(`turnOff`)})]}),u?.kind===`turn-off`&&(0,Y.jsx)(yc,{title:m(`turnOffTitle`),description:m(`turnOffDescription`),confirmLabel:m(`turnOff`),danger:!0,needsPassword:o,onClose:f,onConfirm:async e=>{await s(e),f(),l()}}),u?.kind===`new-codes`&&(0,Y.jsx)(yc,{title:m(`newCodesTitle`),description:m(`newCodesDescription`),confirmLabel:m(`makeNewCodes`),needsPassword:o,onClose:f,onConfirm:async e=>d({kind:`codes`,codes:await c(e)})}),u?.kind===`codes`&&(0,Y.jsx)(G,{title:m(`yourNewCodes`),description:m(`keepCodesSafe`),onClose:f,actions:(0,Y.jsx)(I,{variant:`primary`,onClick:f,children:m(`savedCodes`)}),children:(0,Y.jsx)(ct,{codes:u.codes})})]})},Sc=()=>{let{account:e}=q().session,{data:t,error:n,reload:r}=k((0,J.useCallback)(()=>e.signInMethods(),[e]),m(`couldNotReadMethods`));return t?(0,Y.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,Y.jsx)(j,{error:n})},Cc=({problem:e,fallback:t})=>t===void 0?(0,Y.jsx)(Ue,{children:e}):(0,Y.jsxs)(Y.Fragment,{children:[!1,t]}),wc=({name:e,registered:t,fallback:n,children:r})=>t?(0,Y.jsx)(ue,{name:e,fallback:n===void 0?void 0:(0,Y.jsx)(Cc,{problem:A.rich(`couldNotDraw`,{name:e}),fallback:n}),children:r}):(0,Y.jsx)(Cc,{problem:A.rich(`noComponent`,{component:e}),fallback:n}),Tc={Page:Fa,Grid:da,Card:ai,Stat:bo,RecordCard:za,Field:oa,Diff:ra,Table:To,CardRow:li,RecordRow:io,RecordCards:eo,Chart:ui,Timeline:Ji,Graph:Qi,Progress:La,Image:ya,ModalForm:Pa,Thread:Qo,Composer:ea,Action:ii,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:de,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:si,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=P(),n=Ut(),r={...L(t),params:n};return(0,Y.jsx)(Y.Fragment,{children:Fe(e,e=>We(Ot(r,e)))})},kc=(e,t)=>e.includes(`{{`)?(0,Y.jsx)(Oc,{text:e},t):(0,Y.jsx)(J.Fragment,{children:e},t),Ac=e=>e.map(({child:e,at:t},n)=>typeof e==`string`?kc(e,n):(0,Y.jsx)(Lc,{node:e,at:t},n)),jc=e=>{let t=[];for(let n of e){let e=t.at(-1);Wr(n.child)&&e&&Wr(e[0].child)?e.push(n):t.push([n])}return t.map((e,t)=>{let[n]=e;return Wr(n.child)?(0,Y.jsx)(`p`,{className:`leading-6`,children:Ac(e)},t):(0,Y.jsx)(Lc,{node:n.child,at:n.at},t)})},Mc=e=>fe(e)||Array.isArray(e)&&e.length>0&&e.every(fe),Nc=(e,t)=>Object.fromEntries(Object.entries(e.props).flatMap(([e,n])=>Mc(n)?[[e,(0,Y.jsx)(Y.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])=>fe(t)?[[e,e=>({...t,children:[...t.children,...e]})]]:[])),i=Se(t,String(e.props.i18nKey),Fc(e.props.values)?e.props.values:{},r);return Array.isArray(i)?i.map(e=>typeof e==`string`||fe(e)?e:String(e)):[i]},Lc=({node:e,at:t})=>{let{components:n}=se(),r=P(),i=Ut(),a=pn(),o=(0,J.useMemo)(()=>pt(Mt(e,{...L(r),params:i}),a),[e,r,i,a]);if(o.type===`Trans`&&!o.custom)return(0,Y.jsx)(Y.Fragment,{children:Ac(Ic(o,a).map(e=>({child:e})))});if(o.custom){let e=n?.[o.type],r=o.children.length>0?(0,Y.jsx)(Yi,{node:o,children:jc(Dc(o.children,t,`children`))}):void 0;return(0,Y.jsx)(wc,{name:o.type,registered:!!e,fallback:o.fallback&&(0,Y.jsx)(Y.Fragment,{children:jc(Dc(o.fallback,t,`fallback`))}),children:e&&(0,Y.jsx)(Je,{node:o,...t!==void 0&&{at:t},children:(0,Y.jsx)(e,{...ce(o.props),children:r})})})}let s=Tc[o.type];if(!s)return(0,Y.jsx)(Ue,{children:A.rich(`unknownBlock`,{type:o.type})});let c=typeof o.props.className==`string`?o.props.className:void 0,l=Dc(o.children,t,`children`),u=(0,Y.jsx)(s,{node:o,at:t,slots:Nc(o,t),className:c,children:o.type===`Text`||o.type===`Link`||o.type===`Summary`?Ac(l):jc(o.type===`Switch`?l.filter(({child:e})=>typeof e!=`string`):l)}),d=c===void 0||Ec.has(o.type)?u:(0,Y.jsx)(`div`,{className:c,children:u});return o.fallback?(0,Y.jsx)(ue,{name:o.type,resetKey:o,fallback:(0,Y.jsx)(Y.Fragment,{children:jc(Dc(o.fallback,t,`fallback`))}),children:d}):d};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=fee3e13d-e0ed-45c3-909a-f1805d5f9b33
@@ -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{$n as r,Ea as i,Hr as a,Ia as o,Kc as s,Ql as c,Qn as l,Ta as u,Vc as d,Xa as f,Xr as p,Xs as m,Zs as h,bi as g,dl as _,eu as v,fc as y,lc as b,ml as x,ms as S,ni as C,nl as w,sn as T,ss as E,tl as D,uc as O,vl as k,vr as A,yn as j,za as M}from"./app-BXbP4Ty1.js";import{h as N,o as P}from"./vendor-t7Q7QbPu.js";import{Q as F}from"./embedded-list-Nomt6OUK.js";import{n as I}from"./lib-dnd-kit-sortable-CNDSKqCD.js";import{a as L,i as R,n as z,o as ee,r as B,s as V,t as H}from"./messages-9TFLyKlr.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=s(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=s(G),q=e(t(),1),J=w(`app/delete`),Y=c(),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:v(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)(O,{title:J(`confirmTitle`,{title:e}),description:J(`confirmDescription`,{noun:t,title:e}),onClose:i,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{onClick:i,children:J(`cancel`)}),(0,Q.jsx)(y,{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)(O,{title:J(`changedTitle`,{title:e}),description:J(`changedDescription`),onClose:a,actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{onClick:r,children:J(`reviewChanges`)}),(0,Q.jsx)(y,{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)(O,{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)(y,{onClick:e.onCancel,children:J(`cancel`)}),(0,Q.jsx)(y,{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)(O,{title:J(`deleting`),description:J(`progress`,{done:e.done,total:e.total}),onClose:()=>void 0,actions:(0,Q.jsx)(y,{loading:!0,disabled:!0,children:J(`working`)})});let t=e.total-e.failures.length;return(0,Q.jsx)(O,{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)(y,{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:g(e,n[e.name],i),after:g(e,r[e.name],i)}]}),ae=4,oe=({model:e,view:t,onDeleted:n,onReview:r,restore:i})=>{let o=S(),s=N(),c=M(),[l,u]=(0,q.useState)(),[d,f]=(0,q.useState)(!1),p=t?.names?.singular??x(e.name),g=t?.names?.plural??x(e.name),{resources:_,views:v}=E(),{href:y,open:b}=a(),C=(t,n)=>t.blockedBy&&Z({blockedBy:t.blockedBy,resources:_,views:v,noun:p,...e.primaryKey.length===1&&{key:n.key}}),w=()=>{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]})},T=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}},D=t=>{w(),u(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(()=>{w(),c.show({state:`success`,title:J(`restored`,{title:t.title})})},e=>{if(!h(e))throw e;w(),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})})}}}})},O=async(n,r)=>{f(!0);try{if(!await T(n,r))return D(n);let i=(await o.get(e.name,n.key)).record;u({kind:`conflict`,target:n,fresh:i,changes:ie(e,t,n.snapshot,i)})}catch(e){if(!h(e))throw e;u(void 0);let t=C(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:y(t.link.to),onNavigate:b}}})}finally{f(!1)}},k=async e=>{try{return await T(e,e.etag)?{title:e.title,message:J(`changedSinceLoaded`)}:void 0}catch(t){if(!h(t))throw t;return{title:e.title,message:C(t,e)?.text??t.message}}},A=async e=>{let t=[],n=[],r=0;u({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 k(a);i&&(t.push(i),n.push(a)),r+=1,u({kind:`bulk-running`,done:r,total:e.length})}})),w(),u({kind:`bulk-done`,total:e.length,failures:t}),n},j=()=>u(void 0);return{dialogs:l&&(0,Q.jsxs)(Q.Fragment,{children:[l.kind===`confirm`&&(0,Q.jsx)(te,{title:l.target.title,noun:p,busy:d,onCancel:j,onConfirm:()=>void O(l.target,l.target.etag)}),l.kind===`conflict`&&(0,Q.jsx)(ne,{title:l.target.title,changes:l.changes,busy:d,onCancel:j,onReview:()=>{j(),r?.(l.target,l.fresh)},onDeleteAnyway:()=>void O(l.target,`*`)}),l.kind===`bulk-confirm`&&(0,Q.jsx)($,{stage:`confirm`,count:l.targets.length,noun:p,plural:g,onCancel:()=>{j(),l.settle(l.targets)},onConfirm:()=>l.settle(A(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:j})]}),start:t=>e.softDelete?O(t,t.etag):u({kind:`confirm`,target:t}),startBulk:e=>new Promise(t=>u({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:a})=>{let o=t=>r.findIndex(n=>k(i(e,n))===t),s=t.after.find(e=>o(e.key)>a);if(s)return H(`dependsOn`,{record:n,other:s.title});let c=t.before.find(e=>o(e.key)!==-1&&o(e.key)<a);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:i,fields:a,rule:o})=>{let s=S(),c=M(),d=j(),{resources:f,views:m}=E(),h=`${n} asc`,g=P({queryKey:[...D.list(e.name,i,h,500,`hand-order`),a.join(`,`)],queryFn:async()=>{let t=l(f,m,e,a),n=[],o=``;do{let c=await s.search(e.name,{filter:i||void 0,orderBy:h,pageSize:500,labels:t,...o&&{pageToken:o}});n.push(...r(f,e,a,c.items,c.labels).map((t,n)=>({...t,id:u(e,c.items[n])}))),o=c.nextPageToken}while(o);return n}}),[v,y]=(0,q.useState)(),b=(0,q.useRef)(void 0),x=(0,q.useRef)([]),C=(0,q.useRef)(void 0),w=(0,q.useRef)(Promise.resolve()),T=(0,q.useRef)(0),O=(0,q.useRef)(void 0),k=async()=>{let t=b.current,r=x.current;if(x.current=[],!t||r.length===0)return;let i=await s.batchWrite(r),a=new Map(i.results.flatMap(e=>e.op===`move`?e.records:[]).map(t=>[u(e,t.record),t])),o=z(i.results,t=>u(e,t)),l=L(e,[...a].map(([e,t])=>({...t,before:{[n]:o.get(e)}})),[n]);O.current!==void 0&&c.dismiss(O.current),O.current=c.show({state:`success`,title:V(`orderChanged`),action:{label:V(`undo`),onClick:()=>W(l)}}),b.current&&=b.current.map(e=>{let t=a.get(e.id);return t?{...e,[n]:t.record[n],etag:t.etag}:e})},A=(e,t)=>n=>{b.current=void 0,x.current=[],y(void 0),c.show(ee(n,e,{place:`list`,title:t?C.current:void 0}))},N=async()=>{--T.current,!(T.current>0)&&(await d(e.name),!(T.current>0)&&(b.current=void 0,y(void 0)))},F=(n,r)=>{let i=b.current??g.data;if(!i||n===r)return;if(!e.position?.after)return H(i,n,r,o);let a=p(e,i[n]).record,c=i[n].id;R(s,e,t,a).then(n=>{let i=b.current??g.data,s=ce(e,n,_(e,t,a,c));H(i,i.findIndex(e=>e.id===c),r,e=>s(e)??o?.(e))},A(V(`couldNotChange`),!1))},H=(r,a,o,s)=>{if(a===-1||a===o)return;let c=s?U(r,a,o,s):o;a!==c&&(b.current=I(r,a,c),x.current=[...x.current,B(e,n,i,b.current,c)],y(b.current),T.current+=1,C.current=_(e,t,p(e,r[a]).record,r[a].id),w.current=w.current.then(k).catch(A(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&&c.show({state:`warning`,title:a.to===n?V(`notMoved`):V(`movedToPlace`,{place:a.to+1}),description:a.reason}),a.to},W=e=>{O.current!==void 0&&c.dismiss(O.current),O.current=void 0,T.current+=1,w.current=w.current.then(async()=>{await s.batchWrite(e),b.current=void 0,x.current=[],y(void 0)}).catch(A(V(`couldNotUndo`),!1)).then(N)};return{rows:v??g.data,loading:g.isPending,error:g.error,move:F}},de=({model:e,view:t,field:n,filter:r,columns:s,sort:c})=>{let{resources:l,views:u}=E(),{fields:d,dropRules:p}=o(),{go:m,href:h}=a(),g=c!==void 0,v=(0,q.useMemo)(()=>T(e,t,s,{resources:l,views:u,fieldTypes:d}).map(e=>g?e:{...e,sortable:!1}),[e,t,s.join(`,`),l,u,d,g]),y=(0,q.useMemo)(()=>C(e,t,v.map(e=>e.id)),[e,t,v]),x=t?.list?.drag?.rule,S=x===void 0?void 0:p?.[x],w=ue({model:e,view:t,field:n,filter:r,fields:y,...S&&{rule:S}}),D=w.rows,O=(0,q.useMemo)(()=>D&&{total:D.length,rowAt:e=>D[e]},[D]);if(x!==void 0&&!S)return(0,Q.jsx)(f,{children:V.rich(`noRule`,{rule:x})});if(w.loading)return(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:Array.from({length:3},(e,t)=>(0,Q.jsx)(b,{className:`h-4 w-full`},t))});if(w.error)return(0,Q.jsx)(A,{title:V(`couldNotLoad`),error:w.error});if(!O||O.total===0)return(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:V(`nothingYet`)});let k=t=>m({kind:`record`,resource:e.name,key:i(e,t)});return(0,Q.jsx)(F,{fit:!0,scroll:`parent`,columns:v,source:O,latencyMs:0,onOpenRow:k,rowLink:t=>({href:h({kind:`record`,resource:e.name,key:i(e,t)}),onFollow:()=>k(t)}),...c&&{sort:c.value,onSortChange:c.onChange},rowNumbers:!1,reorder:{label:n=>_(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)(y,{size:n,variant:e?`primary`:`secondary`,onClick:()=>t(!e),...r&&{"aria-label":i,title:i},children:[e?(0,Q.jsx)(d,{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=7a2771a6-ce08-44cd-9d8d-25ad4e31e766
@@ -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{gr as r,sc as i}from"./app-CK_M0TgA.js";import{t as a}from"./workflow-canvas-CZ6QjuM6.js";import{a as o,i as s,n as c}from"./step-panel-CEluX3Jl.js";import{t as l}from"./use-run-trace-2fQX9FeC.js";import{t as u}from"./use-workflow-types-DpNGPeuE.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)(r,{error:e.error,title:s(`loadFailed`)});if(!e.run||!e.id||!u||!y)return(0,m.jsx)(i,{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=c2f1451f-79b7-4b2d-8c30-d4434fae87c6
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-BXbP4Ty1.js";import{t as a}from"./workflow-canvas-DmxNQs0O.js";import{a as o,i as s,n as c}from"./step-panel-BtgXKvBb.js";import{t as l}from"./use-run-trace-CP67JSwu.js";import{t as u}from"./use-workflow-types-DPCbdYrq.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=7f6c9732-fde1-4eae-a5c1-29a22943a3ee
@@ -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{Qi as r,el as i,fs as a,ol as o,qs as s,uc as c}from"./app-CK_M0TgA.js";import{t as l}from"./copy-field-B14w71cy.js";var u=e(t(),1),d=i(`app/field-types/runner-install`),f=e(n(),1),p=e=>e instanceof s?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=a(),[n,i]=(0,u.useState)(),[o,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(i,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:r(Date.parse(n.expires_at))})})]}),m&&(0,f.jsx)(`p`,{role:`alert`,className:`text-body text-danger-text`,children:m}),(0,f.jsx)(c,{size:`sm`,variant:n?`secondary`:`primary`,className:`justify-self-start`,loading:o,onClick:()=>void g(),children:d(n?`again`:`issue`)})]})},h={of:[...o.runner_install],display:m,cell:()=>null};export{h as runnerInstallField};
2
- //# debugId=6654b681-b416-4e29-a6f5-f2643ab6d294
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-BXbP4Ty1.js";import{t as l}from"./copy-field-CN_wHY_K.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=e0e55575-073b-4a88-bc33-6ab0e5f44d62
@@ -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{Qi as r,Wa as i,Wc as a,Xi as o,Xs as s,Ys as c,cc as l,da as u,el as d,fc as f,qs as p,uc as m}from"./app-CK_M0TgA.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=a(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 p({type:`urn:protobase:problem:${t.error.code}`,title:e.statusText||`Request failed`,status:e.status,detail:t.error.message}):s(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=d(`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:o(r)})},T=(e,t=Date.now(),n=u())=>e.updating?w(e,t):e.nextUpdateAt?x(`nextOn`,{policy:x(e.policy),when:r(Date.parse(e.nextUpdateAt),n)}):x(e.policy),E=(e,t=u())=>{let n=r(Date.parse(e.finishedAt),t),i=x(e.outcome,{version:e.toVersion,when:n});return e.message?`${i}: ${e.message}`:`${i}.`},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)(l,{title:x(`runtimeUpdate`),description:e.updating?(0,O.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,O.jsx)(f,{className:`size-3.5`}),T(e)]}):T(e),onClose:a,actions:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(m,{onClick:a,children:x(`close`)}),(0,O.jsx)(m,{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=i(),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)(m,{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=93b0cf05-0675-4b72-967d-b9878e9f6d60
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-BXbP4Ty1.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=a45fba8a-d329-43c7-bc33-70b88fb0557c
@@ -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,B as r,Br as ee,Bt as te,Cn as i,Co as a,Cr as o,Ct as s,Dn as c,Er as l,Et as u,Fa as d,Fo as f,Fr as p,Ft as m,G as h,Ga as g,Gi as _,H as v,Hn as y,Hr as b,Ht as x,Io as S,It as C,Jc as w,Ji as T,Jt as E,Ka as D,Ki as O,Kt as k,Lo as A,Mo as j,Mt as M,N,Nr as P,Nt as F,Or as I,P as L,Pa as R,Po as z,Pr as B,Pt as V,Q as H,Qc as U,Qt as W,R as G,Ra as K,Rr as q,St as J,To as Y,Tr as X,Tt as Z,U as Q,Ua as ne,Uo as re,Ut as ie,V as ae,Vr as oe,Vt as se,W as ce,Wi as le,Xc as ue,Xi as de,Xt as fe,Y as pe,Yc as me,Yi as he,Yt as ge,Z as _e,Zc as ve,Zi as $,_o as ye,_t as be,at as xe,bo as Se,br as Ce,bt as we,do as Te,dt as Ee,el as De,et as Oe,fc as ke,fo as Ae,fs as je,ft as Me,ga as Ne,gt as Pe,hs as Fe,ht as Ie,jt as Le,kr as Re,kt as ze,lt as Be,mc as Ve,ms as He,mt as Ue,n as We,nt as Ge,pc as Ke,po as qe,ps as Je,pt as Ye,qi as Xe,r as Ze,rl as Qe,rt as $e,sc as et,t as tt,tt as nt,uc as rt,ur as it,ut as at,vo as ot,vt as st,wr as ct,wt as lt,xo as ut,xr as dt,xt as ft,yr as pt,yt as mt,z as ht,zr as gt,zt as _t}from"./app-BXbP4Ty1.js";import{h as vt,o as yt}from"./vendor-t7Q7QbPu.js";export{ft as ActionCard,l as ActionInputError,Je as ApiProvider,gt as App,oe as AppLink,S as AppMark,Ee as AssistantDock,qe as AuthLayout,Se as AvailabilityMark,ke as Button,_t as CallMark,ie as CallView,h as Carousel,F as ChatDivider,M as ChatMessage,Le as ChatThread,ht as Choices,Te as CodeForm,mt as CompactTable,s as Composer,rt as Dialog,Pe as DiffView,G as Field,fe as FieldBadge,we as FieldList,Ce as FileReadError,H as FocusActions,e as FocusNotice,$e as FocusPage,Oe as FocusPanel,nt as FocusSlot,N as Form,ct as HtmlFrame,We as InPlaceForm,j as Input,A as LogoMark,c as Markdown,Z as MentionBox,lt as MentionedText,r as MenuSelect,a as MenuSurface,ye as OtpInput,Ye as PartView,se as RecordCall,k as RecordLink,tt as RecordPicker,Ae as ResendCodeButton,T as ResponsiveDialog,et as RouteLink,pe as SearchPicker,L as Section,Y as Segmented,i as Select,J as SidePanel,C as SignInPrompt,Ve as Spinner,ut as StatusMark,Ue as StepList,y as Textarea,ge as ToneEdge,ae as allowDelayMs,Ke as buttonClass,V as chatDayLabel,re as closeSidebarEvent,R as definePlugin,d as defineUi,be as diffStats,u as emptyDraft,me as extensionPointsOf,X as fileNamed,I as isConflict,v as isFramed,f as logoTapEvent,ze as mentionedIds,ve as mergeUi,st as parseDiff,Ie as parsePatch,t as pluginApi,w as pluginsChangedEvent,De as protobaseVersion,m as sameChatDay,Qe as showTextsIn,o as siblingPage,ot as signedOutEvent,_ as statusRefreshMs,U as uiFromModule,ee as uiReadyEvent,D as useApiToken,b as useAppAddress,Q as useArmedAfterFocus,at as useAssistant,Be as useAssistantClient,Me as useBackendData,He as useClient,W as useComponentReads,n as useComponentSelect,Ze as useCreateForm,P as useFacets,z as useFieldControl,dt as useFileText,xe as useFocusPage,_e as useFocusRecord,Ge as useFocusZoneFilled,ce as useGuardedPress,B as useHistogram,he as useInbox,it as useLayoutRecord,q as useList,E as useListDisplay,de as useMarkNotificationsRead,le as useMembers,je as useMeta,O as useOwnStatus,ue as usePlugin,K as usePresence,Ne as usePushNotifications,yt as useQuery,vt as useQueryClient,ne as useRecord,x as useRecordCallAddress,te as useRecordCalls,Fe as useResourceClient,p as useSeries,pt as useSiblingPage,g as useSignedInUser,Xe as useStatuses,$ as useUnreadNotifications,Re 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{Gc as r,Ql as i,Wc as a,Xl as o,Ys as s,dl as c,fc as l,fl as u,gr as d,j as f,jc as p,nl as m,rl as h,so as g,uc as _,vi as ee}from"./app-CK_M0TgA.js";import{c as v,d as y,l as te,o as b,u as x}from"./list-page-aYSJ3PHa.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=a(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(h())})]},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 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(c(e,t?.valueLabels))===i);return a.length===1?j(a[0]):a.length>1?M(y(`severalValues`,{cell:N(n),values:a.map(e=>c(e,t?.valueLabels)).join(`, `)})):M(y(`notOneOf`,{cell:N(n),values:r.map(e=>c(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(h())})})]}),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(h())})]}),Ne=({check:e,model:t,resources:n,views:r,columns:i,headers:a,fileName:o})=>{let s=r[t.name],c=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`)}),c.map(e=>(0,w.jsx)(`th`,{className:`whitespace-nowrap px-2 py-1.5 font-medium`,children:E(s,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}),c.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?ee(t,e.values[t.name],s?.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)(_,{size:`sm`,onClick:()=>K(o,a,e.problems),children:[(0,w.jsx)(p,{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:i,onChange:a,help:o,className:s})=>{let c=(0,C.useId)();return(0,w.jsxs)(`div`,{className:r(`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:i.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(h()),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)(d,{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)(_,{size:`sm`,onClick:()=>K(r,n,e.notWritten),children:[(0,w.jsx)(p,{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=o(),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,a)=>{let o=n(t.name,r),s=[...new Map(a.filter(e=>!o.has(Q(e))).map(e=>[Q(e),e])).values()],c=t.primaryKey[0];for(let n=0;n<s.length;n+=Z){let a=s.slice(n,n+Z);for(let e of a)o.set(Q(e),[]);let l=i(Ve.in(r,a)),u;do{let n=await e(t.name).list(t.name,{filter:l,fields:[...new Set([c,r])],pageSize:1e3,pageToken:u});for(let e of n.items)o.get(Q(e[r]))?.push(e[c]);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-CAcPVcu7.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:m()});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:m()});;){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=5b04b7ed-38ca-45c4-a118-a4403d666f31
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-BXbP4Ty1.js";import{c as v,d as y,l as te,o as b,u as x}from"./list-page-Dt2tN3Li.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-COWuolaE.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=def764d6-9bc2-41f6-a287-a5cac3c74ccf
@@ -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{$o as r,Cs as i,Ds as a,al as o,ea as s,es as c,fc as l,is as u,mc as d,ns as f,qc as p,ws as m}from"./app-BXbP4Ty1.js";import{t as h}from"./page-header-Ddz2r5ic.js";var g=e(t(),1),_=()=>[{value:`allowed`,label:i(`on`)},{value:`forbidden`,label:i(`off`)}],v=()=>[{value:`allowed`,label:i(`optional`)},{value:`required`,label:i(`required`)},{value:`forbidden`,label:i(`off`)}],y=()=>[{method:`password`,label:i(`password`),description:i(`passwordDescription`),rules:_()},{method:`emailCode`,label:i(`emailedSignInCode`),description:i(`emailedSignInCodeDescription`),rules:_()},{method:`passkey`,label:i(`passkeys`),description:i(`passkeysPolicyDescription`),rules:v()},{method:`twoFactor`,label:i(`twoFactor`),description:i(`twoFactorPolicyDescription`),rules:v()},{method:`staffAccess`,label:i(`staffAccess`),description:i(`staffAccessDescription`),rules:[{value:`allowed`,label:i(`on`)},{value:`notify`,label:i(`emailThePerson`)},{value:`forbidden`,label:i(`off`)}]},{method:`platformSignIn`,label:i(`platformSignIn`),description:i(`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:p(`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:a})=>{if(e===`emailCode`&&!n)return i(`codeNeedsMail`);if(e===`password`&&!n&&t.password===`forbidden`)return i(`passwordStaysOn`);if(e===`staffAccess`&&!n&&t.staffAccess===`notify`)return i(`staffNeedsMail`);if(e===`platformSignIn`&&t.platformSignIn===`allowed`&&t.passkey===`required`)return i(`platformOff`);if(t[e]===a[e]&&r[e]!==a[e])return i(`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:i(`platformSignInWith`,{provider:new Intl.ListFormat(o(),{type:`conjunction`}).format(t)})}]:[]:[n]),T=({state:e,onSave:t,busy:n,error:r,notice:a})=>{let[o,c]=(0,g.useState)(e.policy),u=w(e),d=u.some(({method:t})=>o[t]!==e.policy[t]);return(0,x.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),t(o)},children:[(0,x.jsx)(`ul`,{className:`divide-y rounded-lg border bg-background`,children:u.map(t=>{let n=C(t,o,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:o[t.method],onChange:e=>c({...o,[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}),a&&!d&&(0,x.jsx)(`p`,{role:`status`,className:`rounded-md bg-success-soft px-3 py-2 text-body font-medium text-success-text`,children:a}),(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?i(`lastSavedBy`,{name:e.savedBy,time:s(Date.parse(e.savedAt))}):i(`lastSaved`,{time:s(Date.parse(e.savedAt))}):i(`neverChanged`)}),(0,x.jsxs)(`div`,{className:`flex gap-2`,children:[d&&(0,x.jsx)(l,{onClick:()=>c(e.policy),children:i(`reset`)}),(0,x.jsx)(l,{variant:`primary`,type:`submit`,loading:n,disabled:!d,children:i(`save`)})]})]})]})},E=(e,t)=>e.endedAt?(0,x.jsx)(f,{tone:`neutral`,children:i(`stopped`,{time:s(Date.parse(e.endedAt))})}):Date.parse(e.expiresAt)<=t?(0,x.jsx)(f,{tone:`neutral`,children:i(`ended`,{time:s(Date.parse(e.expiresAt))})}):(0,x.jsx)(f,{tone:`amber`,children:i(`signedInUntil`,{time:s(Date.parse(e.expiresAt))})}),D=({signIns:e,operator:t,error:n,now:a=Date.now()})=>(0,x.jsxs)(r,{title:i(`staffSignIns`),description:i(`staffSignInsDescription`,{operator:t}),children:[(0,x.jsx)(c,{message:n}),e&&e.length===0&&(0,x.jsx)(`p`,{className:`text-muted-foreground`,children:i(`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:i(`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:s(Date.parse(e.startedAt))}),E(e,a)]})]},e.id))})]}),O=({operator:e})=>{let{session:t}=m(),[n,r]=(0,g.useState)(),[o,s]=(0,g.useState)();return(0,g.useEffect)(()=>{t.staff.log().then(r,e=>s(e instanceof a?u(e):i(`couldNotReadStaffSignIns`)))},[t]),(0,x.jsx)(D,{operator:e,signIns:n,error:o})},k=()=>{let{session:e}=m(),[t,n]=(0,g.useState)(),[r,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(),[l,f]=(0,g.useState)();(0,g.useEffect)(()=>{e.signInPolicy.read().then(n,e=>c(e instanceof a?u(e):i(`couldNotReadPolicy`)))},[e]);let p=async t=>{o(!0),c(void 0),f(void 0);try{n(await e.signInPolicy.save(t)),f(i(`policySaved`))}catch(e){if(!(e instanceof a))throw e;c(u(e))}o(!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:i(`signInPolicy`),subtitle:i(`policySubtitle`)}),t?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(T,{state:t,busy:r,error:s,notice:l,onSave:e=>void p(e)},t.savedAt??`default`),t.operator&&(0,x.jsx)(O,{operator:t.operator})]}):s?(0,x.jsx)(`p`,{role:`alert`,className:`text-danger-text`,children:s}):(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,x.jsx)(d,{}),` `,i(`loading`)]})]})};export{k as SignInPolicyPage};
2
+ //# debugId=0fe99e8d-9568-456f-bbe0-7d9599824b20
@@ -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{Ar as n,Go as r,Gs as i,Ia as a,Lr as o,Ms as s,Ps as c,Qn as l,Sa as u,an as d,dn as f,dr as p,fn as m,in as h,ir as g,ks as _,lr as v,ms as y,nr as b,on as x,pn as S,ss as C}from"./app-BXbP4Ty1.js";import{h as w}from"./vendor-t7Q7QbPu.js";import{S as T,ht as E,r as D}from"./embedded-list-Nomt6OUK.js";import{n as O}from"./record-preview-bznf4p6C.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:i=``,sort:a=``,columns:o,button:s,bulk:l=!1,limit:f=10,select:p}=d(e),g=r===void 0?void 0:n.resources[r];if(!g)return[];if(t.part===`chosen`){let e=p===void 0?void 0:n.given[p];return e?[A(m(n.client,g,{key:e}))]:[]}let _=n.views[g.name],{fields:v,read:y}=x({...n,model:g,view:_,columns:o?.map(c),button:s,bulk:l,phoneColumns:h(o)});return[A(D(n,{model:g,filter:i,orderBy:a||u(g,_),limit:f,fields:v,read:y}))]},Chart:(e,t,{client:r,resources:i,views:a})=>{let{resource:o,groupBy:s,splitBy:c,sum:l,average:u,filter:f,granularity:p,range:m,limit:h}=d(e),g=i[o],_=g&&E({model:g,groupBy:s,splitBy:c,sum:l,average:u,filter:f,granularity:p,range:m,limit:h},i,a);return g&&_?[A(n(r,g.name,_))]:[]},RecordCards:(e,t,{client:n,resources:r,views:i})=>{let{resource:a,filter:o=``,sort:s=``,limit:c=10}=d(e),l=r[a];if(!l)return[];let p=s||u(l,i[l.name]);return[A(S(n,l,{filter:o,sort:p,pageSize:c})),A(f(n,l,o))]},RecordRow:(e,t,{client:n,queryClient:r,resources:i,views:a})=>{let{resource:o,filter:s=``,sort:c=``}=d(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:n,resources:r,views:a})=>{let{resource:s,filter:c,sender:u,time:f,calls:p,limit:m=50}=d(e);if(t.part===`calls`){let e=p&&r[p.resource];return e?[j(o(n,e.name,{filter:p.filter,orderBy:i(p.time),pageSize:m}))]:[]}let h=r[s];if(!h)return[];let g=l(r,a,h,u===void 0?[]:[u]);return[j(o(n,h.name,{filter:c,orderBy:i(f),pageSize:m,labels:g}))]}},N=(e,t,{client:n,resources:r})=>{let i=r[t.resource];return i?[A(f(n,i))]:[]},P=(e,t,n)=>(n?.reads??[]).flatMap(n=>{let r=s(t,n.block);if(!r||r.custom)return[];if(n.part===`condition`)return N(r,n,e);if(n.split)return[];let i=M[r.type];return i?i(_(r,{stack:[],params:e.params,...e.root&&{root:e.root}}),n,e):[]}),F=({tree:e,plan:t})=>{let n=y(),i=w(),{resources:o,views:s}=C(),c=a().fields,l=r(),u=b(),d=g(),f=v(p()),m=(0,k.useMemo)(()=>P({client:n,queryClient:i,resources:o,views:s,fieldTypes:c,xs:l,params:u,given:d,...f&&{root:f}},e,t),[n,i,o,s,c,l,u,d,f,e,t]);return(0,k.useEffect)(()=>{for(let e of m)e.start(i)},[m,i]),null};export{F as t};
2
+ //# debugId=2c339d0d-5ae4-42b1-ba1f-5dcab3db9603