@protobase/ui 0.118.0 → 0.119.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (302) hide show
  1. package/dist/account/messages.d.ts +2 -2
  2. package/dist/app/app.js +67 -31
  3. package/dist/app/change-confirm/messages.d.ts +2 -2
  4. package/dist/app/charts/chart-params.js +1 -1
  5. package/dist/app/charts/messages.d.ts +2 -2
  6. package/dist/app/comments/messages.d.ts +2 -2
  7. package/dist/app/conversation/thread-state.d.ts +1 -1
  8. package/dist/app/create/messages.d.ts +2 -2
  9. package/dist/app/delete/messages.d.ts +2 -2
  10. package/dist/app/displays/calendar-event.js +1 -1
  11. package/dist/app/displays/messages.d.ts +2 -2
  12. package/dist/app/displays/use-calendar-move.js +1 -1
  13. package/dist/app/embedded-list/messages.d.ts +2 -2
  14. package/dist/app/export/messages.d.ts +2 -2
  15. package/dist/app/field-messages.d.ts +2 -2
  16. package/dist/app/field-types/runner-install/messages.d.ts +2 -2
  17. package/dist/app/field-types/workflow/definition.d.ts +1 -1
  18. package/dist/app/field-types/workflow/messages.d.ts +2 -2
  19. package/dist/app/field-types/workflow/pins/pin-text.d.ts +1 -1
  20. package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
  21. package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
  22. package/dist/app/field-types/workflow-status/messages.d.ts +2 -2
  23. package/dist/app/focus/messages.d.ts +2 -2
  24. package/dist/app/gallery/messages.d.ts +2 -2
  25. package/dist/app/hand-order/messages.d.ts +2 -2
  26. package/dist/app/history/messages.d.ts +2 -2
  27. package/dist/app/import/messages.d.ts +2 -2
  28. package/dist/app/lazy-routes.d.ts +4 -0
  29. package/dist/app/lazy-routes.js +2 -1
  30. package/dist/app/list-messages.d.ts +2 -2
  31. package/dist/app/list-page.js +1 -1
  32. package/dist/app/messages.d.ts +2 -2
  33. package/dist/app/meta-gate-messages.d.ts +2 -2
  34. package/dist/app/nav-recent.js +1 -1
  35. package/dist/app/new-version/messages.d.ts +2 -2
  36. package/dist/app/opened-address.d.ts +9 -0
  37. package/dist/app/opened-address.js +14 -0
  38. package/dist/app/pages/messages.d.ts +2 -2
  39. package/dist/app/record-chart/messages.d.ts +2 -2
  40. package/dist/app/record-messages.d.ts +2 -2
  41. package/dist/app/record-opens.d.ts +1 -6
  42. package/dist/app/record-opens.js +2 -12
  43. package/dist/app/record-page.js +2 -1
  44. package/dist/app/record-row/messages.d.ts +2 -2
  45. package/dist/app/related-cards/messages.d.ts +2 -2
  46. package/dist/app/runtime/messages.d.ts +2 -2
  47. package/dist/app/saved/messages.d.ts +2 -2
  48. package/dist/app/saved/use-favorite.d.ts +1 -1
  49. package/dist/app/search/messages.d.ts +2 -2
  50. package/dist/app/search/search-model.d.ts +7 -3
  51. package/dist/app/search/search-model.js +13 -6
  52. package/dist/app/searches/messages.d.ts +2 -2
  53. package/dist/app/searches/update-search-dialog.js +1 -1
  54. package/dist/app/searches/use-save-search.d.ts +1 -1
  55. package/dist/app/start-record.d.ts +22 -0
  56. package/dist/app/start-record.js +33 -0
  57. package/dist/app/use-nav-recent.d.ts +2 -2
  58. package/dist/app/use-nav-recent.js +8 -3
  59. package/dist/app/use-start-address.d.ts +21 -0
  60. package/dist/app/use-start-address.js +49 -0
  61. package/dist/app-shell/messages.d.ts +2 -2
  62. package/dist/app-shell/profile-menu.d.ts +2 -0
  63. package/dist/app-shell/profile-menu.js +1 -1
  64. package/dist/assistant-dock/messages.d.ts +2 -2
  65. package/dist/auth/messages.d.ts +2 -2
  66. package/dist/calls/messages.d.ts +2 -2
  67. package/dist/carousel/messages.d.ts +2 -2
  68. package/dist/chat/messages.d.ts +2 -2
  69. package/dist/data/query-keys.d.ts +4 -0
  70. package/dist/data/query-keys.js +11 -0
  71. package/dist/data/start-cache/restored-state.d.ts +7 -0
  72. package/dist/data/start-cache/restored-state.js +5 -1
  73. package/dist/data-grid/messages.d.ts +2 -2
  74. package/dist/filter-panel/messages.d.ts +2 -2
  75. package/dist/forms/messages.d.ts +2 -2
  76. package/dist/inline-child-table/messages.d.ts +2 -2
  77. package/dist/invitations/messages.d.ts +2 -2
  78. package/dist/locale/en.js +38 -21
  79. package/dist/locale/en.json.d.ts +17 -0
  80. package/dist/locale/messages.d.ts +34 -0
  81. package/dist/locale/nl.js +38 -21
  82. package/dist/mentions/messages.d.ts +2 -2
  83. package/dist/mocks/orders.d.ts +1 -1
  84. package/dist/notifications/bell/messages.d.ts +2 -2
  85. package/dist/organizations/all-organizations.js +5 -3
  86. package/dist/organizations/first-organization-page.d.ts +21 -0
  87. package/dist/organizations/first-organization-page.js +125 -0
  88. package/dist/organizations/invitations-page.js +3 -1
  89. package/dist/organizations/members-page.js +5 -2
  90. package/dist/organizations/messages.d.ts +2 -2
  91. package/dist/organizations/my-invitation-row.d.ts +11 -0
  92. package/dist/organizations/my-invitation-row.js +34 -0
  93. package/dist/organizations/new-organization-form.d.ts +10 -0
  94. package/dist/organizations/new-organization-form.js +76 -0
  95. package/dist/organizations/organization-page.js +9 -6
  96. package/dist/organizations/organization-paths.d.ts +7 -2
  97. package/dist/organizations/organization-paths.js +14 -8
  98. package/dist/organizations/organization-word.d.ts +14 -0
  99. package/dist/organizations/organization-word.js +22 -0
  100. package/dist/organizations/organizations-page.d.ts +0 -2
  101. package/dist/organizations/organizations-page.js +31 -98
  102. package/dist/organizations/use-my-invitations.d.ts +17 -0
  103. package/dist/organizations/use-my-invitations.js +30 -0
  104. package/dist/organizations/use-organizations.d.ts +4 -0
  105. package/dist/organizations/use-organizations.js +8 -3
  106. package/dist/package.js +1 -1
  107. package/dist/plugins/messages.d.ts +2 -2
  108. package/dist/primitives/messages.d.ts +2 -2
  109. package/dist/record-view/messages.d.ts +2 -2
  110. package/dist/record-view/use-autosave.d.ts +1 -1
  111. package/dist/shell/assets/{account-page-DOXkanFO.js → account-page-BQp5_GhJ.js} +2 -2
  112. package/dist/shell/assets/app-Bu6FwwHZ.js +34 -0
  113. package/dist/shell/assets/{app-Dq5eubgK.css → app-xwgcmboV.css} +1 -1
  114. package/dist/shell/assets/{assistant-shell-Drpmyy7B.js → assistant-shell-BZIclUxo.js} +2 -2
  115. package/dist/shell/assets/board-display-i-mb2Cpu.js +2 -0
  116. package/dist/shell/assets/calendar-display-DeNTjhbB.js +2 -0
  117. package/dist/shell/assets/{call-rings-C7f5skja.js → call-rings-BJF7hAje.js} +2 -2
  118. package/dist/shell/assets/{calls-Ca2RAgzS.js → calls-BcTDHAo3.js} +2 -2
  119. package/dist/shell/assets/{circle-alert-B5-CtUEU.js → circle-alert-lCeGgu8R.js} +2 -2
  120. package/dist/shell/assets/{composed-page-BMYkHKrZ.js → composed-page-DNJnwQvq.js} +2 -2
  121. package/dist/shell/assets/{composer-section-CHUNzdVu.js → composer-section-Ca3NwGut.js} +2 -2
  122. package/dist/shell/assets/{connect-route-B_u1trIm.js → connect-route-S-wzFft6.js} +2 -2
  123. package/dist/shell/assets/{copy-field-9SzlccPw.js → copy-field-BlILh8XJ.js} +2 -2
  124. package/dist/shell/assets/create-route-BzX8GS_M.js +2 -0
  125. package/dist/shell/assets/{custom-step-container-field-BqLAbXaI.js → custom-step-container-field-0KjqrW7Y.js} +4 -4
  126. package/dist/shell/assets/embedded-list-DJUmoyQF.js +3 -0
  127. package/dist/shell/assets/{en-wsBk87ZG.js → en-BrEwbNhJ.js} +2 -2
  128. package/dist/shell/assets/{export-dialog-DG5H_BHu.js → export-dialog-DB5gIvOy.js} +2 -2
  129. package/dist/shell/assets/export-worker-DuHOhIiP.js +15 -0
  130. package/dist/shell/assets/first-organization-page-CBSCVXlw.js +2 -0
  131. package/dist/shell/assets/{graph-view-DFeWGm5G.js → graph-view-AIzSVa3P.js} +2 -2
  132. package/dist/shell/assets/{group-donut-D9vSqco5.js → group-donut-9Eg3TrZC.js} +2 -2
  133. package/dist/shell/assets/{guest-call-page-DIEo-q93.js → guest-call-page-CuUFfdZa.js} +3 -3
  134. package/dist/shell/assets/{html-viewer-F2craD8b.js → html-viewer-CFbk369s.js} +2 -2
  135. package/dist/shell/assets/{import-dialog-C6QghYOc.js → import-dialog-DWGqsC2-.js} +2 -2
  136. package/dist/shell/assets/import-table-dialog-BNe0eZoG.js +2 -0
  137. package/dist/shell/assets/{index-lcg5mDSu.js → index-dMJn1vs1.js} +1 -1
  138. package/dist/shell/assets/invitations-page-AmDwJw-A.js +2 -0
  139. package/dist/shell/assets/{layout-grid-XTZwSFbV.js → layout-grid-CxTl_dur.js} +2 -2
  140. package/dist/shell/assets/{legend-item-BoeI6b5Y.js → legend-item-DXXBS_hw.js} +2 -2
  141. package/dist/shell/assets/list-page-CXrB1As-.js +4 -0
  142. package/dist/shell/assets/{maplibre-CLloBp_X.js → maplibre-Cd9zd3y9.js} +2 -2
  143. package/dist/shell/assets/{markdown-content-CEV942Pa.js → markdown-content-CqKm2ku9.js} +2 -2
  144. package/dist/shell/assets/members-page-Da7ADmBH.js +2 -0
  145. package/dist/shell/assets/messages-ZaTNJ5q-.js +2 -0
  146. package/dist/shell/assets/{nl-nieWXCy1.js → nl-Dto12ewP.js} +2 -2
  147. package/dist/shell/assets/organization-page-CfK6Dim2.js +2 -0
  148. package/dist/shell/assets/organizations-page-B0QsHpBE.js +2 -0
  149. package/dist/shell/assets/parse-worker-BRxyLV_D.js +35 -0
  150. package/dist/shell/assets/{pending-invitation-row-T-_gptFs.js → pending-invitation-row-Bcf8ttkD.js} +2 -2
  151. package/dist/shell/assets/{period-chart-BLA0qneK.js → period-chart-Ckx_KTsu.js} +2 -2
  152. package/dist/shell/assets/{person-row-CB2jyi4a.js → person-row-4RzpLZJE.js} +2 -2
  153. package/dist/shell/assets/public-form-page-BQR19Cet.js +2 -0
  154. package/dist/shell/assets/{record-lines-C-s6d1b-.js → record-lines-BmaATx8t.js} +2 -2
  155. package/dist/shell/assets/{record-map-1LgfFbVl.js → record-map-BnCgDA0b.js} +2 -2
  156. package/dist/shell/assets/{record-opens-DayPkcEp.js → record-opens-DrMa-fHq.js} +2 -2
  157. package/dist/shell/assets/record-page-DHgth2rZ.js +3 -0
  158. package/dist/shell/assets/{record-preview-DYLddBgR.js → record-preview-Dcgb16a2.js} +2 -2
  159. package/dist/shell/assets/{records-map-Dbzp06m5.js → records-map-Clj4sGQc.js} +2 -2
  160. package/dist/shell/assets/render-node-DSmBsYMg.js +3 -0
  161. package/dist/shell/assets/reorder-button-DaTBmXBl.js +2 -0
  162. package/dist/shell/assets/{run-trace-view-C7Fa31YF.js → run-trace-view-DlxVKKf8.js} +2 -2
  163. package/dist/shell/assets/{runner-install-field-Bpj6cGb0.js → runner-install-field-Bo_itrWB.js} +2 -2
  164. package/dist/shell/assets/{runtime-update-CZ31fRYM.js → runtime-update-D8Ly6R1y.js} +2 -2
  165. package/dist/shell/assets/shared-protobase-ui-BzbF8jUw.js +1 -0
  166. package/dist/shell/assets/{sheet-source-CpQBUfMu.js → sheet-source-BYMMaydU.js} +3 -3
  167. package/dist/shell/assets/sign-in-policy-page-Bw2A76AY.js +2 -0
  168. package/dist/shell/assets/start-block-queries-BCn7NH98.js +2 -0
  169. package/dist/shell/assets/step-catalog-DeHAX9pK.js +2 -0
  170. package/dist/shell/assets/{step-panel-BNu4CT-a.js → step-panel-Df4GlchE.js} +2 -2
  171. package/dist/shell/assets/timeline-display-BijL0a02.js +2 -0
  172. package/dist/shell/assets/{trash-DGtnZxzc.js → trash-CM78fU0k.js} +2 -2
  173. package/dist/shell/assets/{update-set-DmSoOUGC.js → update-set-BmW6qYcW.js} +2 -2
  174. package/dist/shell/assets/use-calendar-move-DdkPJiaa.js +2 -0
  175. package/dist/shell/assets/{use-display-rows-QMseygYe.js → use-display-rows-DAUXr6DH.js} +2 -2
  176. package/dist/shell/assets/use-my-invitations-Cy6qlxUU.js +2 -0
  177. package/dist/shell/assets/{use-paged-search-CI7t7XI0.js → use-paged-search-BXLXKyHF.js} +2 -2
  178. package/dist/shell/assets/{use-run-trace-D0jDOrL8.js → use-run-trace-D9muWJxD.js} +2 -2
  179. package/dist/shell/assets/{use-workflow-page-BMjBBt83.js → use-workflow-page-DSt6Ws-R.js} +2 -2
  180. package/dist/shell/assets/{use-workflow-types-8ZRuZVuJ.js → use-workflow-types-BcmFpA4n.js} +2 -2
  181. package/dist/shell/assets/{workflow-canvas-DtTiaGIh.js → workflow-canvas-B2SGJgTS.js} +4 -4
  182. package/dist/shell/assets/{workflow-field-2I9HpR3s.js → workflow-field-DN0iAPqC.js} +3 -3
  183. package/dist/shell/assets/{workflow-graph-editor-DJoriSTb.js → workflow-graph-editor-DQYfPu8C.js} +2 -2
  184. package/dist/shell/assets/{workflow-run-field-BB6DMeK0.js → workflow-run-field-Bau9h_Pu.js} +3 -3
  185. package/dist/shell/assets/workflow-status-field-CBRUOn6n.js +2 -0
  186. package/dist/shell/assets/workflow-workbench-B2GjHXy6.js +4 -0
  187. package/dist/shell/index.html +4 -4
  188. package/dist/shell/protobase.shell.json +2 -2
  189. package/dist/shell/protobase.sw.js +2 -2
  190. package/dist/shell-source-maps/assets/{account-page-DOXkanFO.js.map → account-page-BQp5_GhJ.js.map} +1 -1
  191. package/dist/shell-source-maps/assets/app-Bu6FwwHZ.js.map +1 -0
  192. package/dist/shell-source-maps/assets/{assistant-shell-Drpmyy7B.js.map → assistant-shell-BZIclUxo.js.map} +1 -1
  193. package/dist/shell-source-maps/assets/{board-display-D9PUmRbl.js.map → board-display-i-mb2Cpu.js.map} +1 -1
  194. package/dist/shell-source-maps/assets/{calendar-display-B8J8DI5J.js.map → calendar-display-DeNTjhbB.js.map} +1 -1
  195. package/dist/shell-source-maps/assets/{call-rings-C7f5skja.js.map → call-rings-BJF7hAje.js.map} +1 -1
  196. package/dist/shell-source-maps/assets/{calls-Ca2RAgzS.js.map → calls-BcTDHAo3.js.map} +1 -1
  197. package/dist/shell-source-maps/assets/{circle-alert-B5-CtUEU.js.map → circle-alert-lCeGgu8R.js.map} +1 -1
  198. package/dist/shell-source-maps/assets/{composed-page-BMYkHKrZ.js.map → composed-page-DNJnwQvq.js.map} +1 -1
  199. package/dist/shell-source-maps/assets/{composer-section-CHUNzdVu.js.map → composer-section-Ca3NwGut.js.map} +1 -1
  200. package/dist/shell-source-maps/assets/{connect-route-B_u1trIm.js.map → connect-route-S-wzFft6.js.map} +1 -1
  201. package/dist/shell-source-maps/assets/{copy-field-9SzlccPw.js.map → copy-field-BlILh8XJ.js.map} +1 -1
  202. package/dist/shell-source-maps/assets/{create-route-rbublA-_.js.map → create-route-BzX8GS_M.js.map} +1 -1
  203. package/dist/shell-source-maps/assets/{custom-step-container-field-BqLAbXaI.js.map → custom-step-container-field-0KjqrW7Y.js.map} +1 -1
  204. package/dist/shell-source-maps/assets/{embedded-list-CdFZ5TIe.js.map → embedded-list-DJUmoyQF.js.map} +1 -1
  205. package/dist/shell-source-maps/assets/en-BrEwbNhJ.js.map +1 -0
  206. package/dist/shell-source-maps/assets/{export-dialog-DG5H_BHu.js.map → export-dialog-DB5gIvOy.js.map} +1 -1
  207. package/dist/shell-source-maps/assets/export-worker-DuHOhIiP.js.map +1 -0
  208. package/dist/shell-source-maps/assets/first-organization-page-CBSCVXlw.js.map +1 -0
  209. package/dist/shell-source-maps/assets/{graph-view-DFeWGm5G.js.map → graph-view-AIzSVa3P.js.map} +1 -1
  210. package/dist/shell-source-maps/assets/{group-donut-D9vSqco5.js.map → group-donut-9Eg3TrZC.js.map} +1 -1
  211. package/dist/shell-source-maps/assets/{guest-call-page-DIEo-q93.js.map → guest-call-page-CuUFfdZa.js.map} +1 -1
  212. package/dist/shell-source-maps/assets/{html-viewer-F2craD8b.js.map → html-viewer-CFbk369s.js.map} +1 -1
  213. package/dist/shell-source-maps/assets/{import-dialog-C6QghYOc.js.map → import-dialog-DWGqsC2-.js.map} +1 -1
  214. package/dist/shell-source-maps/assets/{import-table-dialog-BzpzE7wd.js.map → import-table-dialog-BNe0eZoG.js.map} +1 -1
  215. package/dist/shell-source-maps/assets/invitations-page-AmDwJw-A.js.map +1 -0
  216. package/dist/shell-source-maps/assets/{layout-grid-XTZwSFbV.js.map → layout-grid-CxTl_dur.js.map} +1 -1
  217. package/dist/shell-source-maps/assets/{legend-item-BoeI6b5Y.js.map → legend-item-DXXBS_hw.js.map} +1 -1
  218. package/dist/shell-source-maps/assets/{list-page-C7h-_WJY.js.map → list-page-CXrB1As-.js.map} +1 -1
  219. package/dist/shell-source-maps/assets/{maplibre-CLloBp_X.js.map → maplibre-Cd9zd3y9.js.map} +1 -1
  220. package/dist/shell-source-maps/assets/{markdown-content-CEV942Pa.js.map → markdown-content-CqKm2ku9.js.map} +1 -1
  221. package/dist/shell-source-maps/assets/members-page-Da7ADmBH.js.map +1 -0
  222. package/dist/shell-source-maps/assets/{messages-lXPHUGLV.js.map → messages-ZaTNJ5q-.js.map} +1 -1
  223. package/dist/shell-source-maps/assets/nl-Dto12ewP.js.map +1 -0
  224. package/dist/shell-source-maps/assets/organization-page-CfK6Dim2.js.map +1 -0
  225. package/dist/shell-source-maps/assets/organizations-page-B0QsHpBE.js.map +1 -0
  226. package/dist/shell-source-maps/assets/parse-worker-BRxyLV_D.js.map +1 -0
  227. package/dist/shell-source-maps/assets/{pending-invitation-row-T-_gptFs.js.map → pending-invitation-row-Bcf8ttkD.js.map} +1 -1
  228. package/dist/shell-source-maps/assets/{period-chart-BLA0qneK.js.map → period-chart-Ckx_KTsu.js.map} +1 -1
  229. package/dist/shell-source-maps/assets/{person-row-CB2jyi4a.js.map → person-row-4RzpLZJE.js.map} +1 -1
  230. package/dist/shell-source-maps/assets/{public-form-page-CvtOJGMY.js.map → public-form-page-BQR19Cet.js.map} +1 -1
  231. package/dist/shell-source-maps/assets/{record-lines-C-s6d1b-.js.map → record-lines-BmaATx8t.js.map} +1 -1
  232. package/dist/shell-source-maps/assets/{record-map-1LgfFbVl.js.map → record-map-BnCgDA0b.js.map} +1 -1
  233. package/dist/shell-source-maps/assets/record-opens-DrMa-fHq.js.map +1 -0
  234. package/dist/shell-source-maps/assets/{record-page-BMFIEvdR.js.map → record-page-DHgth2rZ.js.map} +1 -1
  235. package/dist/shell-source-maps/assets/{record-preview-DYLddBgR.js.map → record-preview-Dcgb16a2.js.map} +1 -1
  236. package/dist/shell-source-maps/assets/{records-map-Dbzp06m5.js.map → records-map-Clj4sGQc.js.map} +1 -1
  237. package/dist/shell-source-maps/assets/{render-node-DEeBoZ9i.js.map → render-node-DSmBsYMg.js.map} +1 -1
  238. package/dist/shell-source-maps/assets/{reorder-button-BauUDONv.js.map → reorder-button-DaTBmXBl.js.map} +1 -1
  239. package/dist/shell-source-maps/assets/{run-trace-view-C7Fa31YF.js.map → run-trace-view-DlxVKKf8.js.map} +1 -1
  240. package/dist/shell-source-maps/assets/{runner-install-field-Bpj6cGb0.js.map → runner-install-field-Bo_itrWB.js.map} +1 -1
  241. package/dist/shell-source-maps/assets/{runtime-update-CZ31fRYM.js.map → runtime-update-D8Ly6R1y.js.map} +1 -1
  242. package/dist/shell-source-maps/assets/{sheet-source-CpQBUfMu.js.map → sheet-source-BYMMaydU.js.map} +1 -1
  243. package/dist/shell-source-maps/assets/{sign-in-policy-page-BumL1ZPK.js.map → sign-in-policy-page-Bw2A76AY.js.map} +1 -1
  244. package/dist/shell-source-maps/assets/{start-block-queries-DYE83u9M.js.map → start-block-queries-BCn7NH98.js.map} +1 -1
  245. package/dist/shell-source-maps/assets/{step-catalog-DAHY1jbn.js.map → step-catalog-DeHAX9pK.js.map} +1 -1
  246. package/dist/shell-source-maps/assets/{step-panel-BNu4CT-a.js.map → step-panel-Df4GlchE.js.map} +1 -1
  247. package/dist/shell-source-maps/assets/{timeline-display-Dj7rfbX5.js.map → timeline-display-BijL0a02.js.map} +1 -1
  248. package/dist/shell-source-maps/assets/{trash-DGtnZxzc.js.map → trash-CM78fU0k.js.map} +1 -1
  249. package/dist/shell-source-maps/assets/{update-set-DmSoOUGC.js.map → update-set-BmW6qYcW.js.map} +1 -1
  250. package/dist/shell-source-maps/assets/{use-calendar-move-r5AsNTri.js.map → use-calendar-move-DdkPJiaa.js.map} +1 -1
  251. package/dist/shell-source-maps/assets/{use-display-rows-QMseygYe.js.map → use-display-rows-DAUXr6DH.js.map} +1 -1
  252. package/dist/shell-source-maps/assets/use-my-invitations-Cy6qlxUU.js.map +1 -0
  253. package/dist/shell-source-maps/assets/{use-paged-search-CI7t7XI0.js.map → use-paged-search-BXLXKyHF.js.map} +1 -1
  254. package/dist/shell-source-maps/assets/{use-run-trace-D0jDOrL8.js.map → use-run-trace-D9muWJxD.js.map} +1 -1
  255. package/dist/shell-source-maps/assets/{use-workflow-page-BMjBBt83.js.map → use-workflow-page-DSt6Ws-R.js.map} +1 -1
  256. package/dist/shell-source-maps/assets/{use-workflow-types-8ZRuZVuJ.js.map → use-workflow-types-BcmFpA4n.js.map} +1 -1
  257. package/dist/shell-source-maps/assets/{workflow-canvas-DtTiaGIh.js.map → workflow-canvas-B2SGJgTS.js.map} +1 -1
  258. package/dist/shell-source-maps/assets/{workflow-field-2I9HpR3s.js.map → workflow-field-DN0iAPqC.js.map} +1 -1
  259. package/dist/shell-source-maps/assets/{workflow-graph-editor-DJoriSTb.js.map → workflow-graph-editor-DQYfPu8C.js.map} +1 -1
  260. package/dist/shell-source-maps/assets/{workflow-run-field-BB6DMeK0.js.map → workflow-run-field-Bau9h_Pu.js.map} +1 -1
  261. package/dist/shell-source-maps/assets/workflow-status-field-CBRUOn6n.js.map +1 -0
  262. package/dist/shell-source-maps/assets/{workflow-workbench-PnPXVcoE.js.map → workflow-workbench-B2GjHXy6.js.map} +1 -1
  263. package/dist/status/messages.d.ts +2 -2
  264. package/dist/users/messages.d.ts +2 -2
  265. package/package.json +5 -5
  266. package/dist/shell/assets/app-B48LQpC1.js +0 -34
  267. package/dist/shell/assets/board-display-D9PUmRbl.js +0 -2
  268. package/dist/shell/assets/calendar-display-B8J8DI5J.js +0 -2
  269. package/dist/shell/assets/create-route-rbublA-_.js +0 -2
  270. package/dist/shell/assets/embedded-list-CdFZ5TIe.js +0 -3
  271. package/dist/shell/assets/export-worker-CQwKM8Oc.js +0 -15
  272. package/dist/shell/assets/import-table-dialog-BzpzE7wd.js +0 -2
  273. package/dist/shell/assets/invitations-page-nBjy3DSn.js +0 -2
  274. package/dist/shell/assets/list-page-C7h-_WJY.js +0 -4
  275. package/dist/shell/assets/members-page-D1uMhOZR.js +0 -2
  276. package/dist/shell/assets/messages-lXPHUGLV.js +0 -2
  277. package/dist/shell/assets/organization-page-RMZnMPR0.js +0 -2
  278. package/dist/shell/assets/organizations-page-Ce6Nwl7X.js +0 -2
  279. package/dist/shell/assets/parse-worker-BN8cVWIa.js +0 -35
  280. package/dist/shell/assets/public-form-page-CvtOJGMY.js +0 -2
  281. package/dist/shell/assets/record-page-BMFIEvdR.js +0 -3
  282. package/dist/shell/assets/render-node-DEeBoZ9i.js +0 -3
  283. package/dist/shell/assets/reorder-button-BauUDONv.js +0 -2
  284. package/dist/shell/assets/shared-protobase-ui-BGJ_UVNP.js +0 -1
  285. package/dist/shell/assets/sign-in-policy-page-BumL1ZPK.js +0 -2
  286. package/dist/shell/assets/start-block-queries-DYE83u9M.js +0 -2
  287. package/dist/shell/assets/step-catalog-DAHY1jbn.js +0 -2
  288. package/dist/shell/assets/timeline-display-Dj7rfbX5.js +0 -2
  289. package/dist/shell/assets/use-calendar-move-r5AsNTri.js +0 -2
  290. package/dist/shell/assets/workflow-status-field-L_mimjzo.js +0 -2
  291. package/dist/shell/assets/workflow-workbench-PnPXVcoE.js +0 -4
  292. package/dist/shell-source-maps/assets/app-B48LQpC1.js.map +0 -1
  293. package/dist/shell-source-maps/assets/en-wsBk87ZG.js.map +0 -1
  294. package/dist/shell-source-maps/assets/export-worker-CQwKM8Oc.js.map +0 -1
  295. package/dist/shell-source-maps/assets/invitations-page-nBjy3DSn.js.map +0 -1
  296. package/dist/shell-source-maps/assets/members-page-D1uMhOZR.js.map +0 -1
  297. package/dist/shell-source-maps/assets/nl-nieWXCy1.js.map +0 -1
  298. package/dist/shell-source-maps/assets/organization-page-RMZnMPR0.js.map +0 -1
  299. package/dist/shell-source-maps/assets/organizations-page-Ce6Nwl7X.js.map +0 -1
  300. package/dist/shell-source-maps/assets/parse-worker-BN8cVWIa.js.map +0 -1
  301. package/dist/shell-source-maps/assets/record-opens-DayPkcEp.js.map +0 -1
  302. package/dist/shell-source-maps/assets/workflow-status-field-L_mimjzo.js.map +0 -1
@@ -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{t}from"./react-CuiNlnus.js";import{Da as n,Ka as r,Oa as i,Yo as a,Zs as o,co as s,sc as c,ys as l}from"./app-Bu6FwwHZ.js";import{n as u,r as d,t as f}from"./use-my-invitations-Cy6qlxUU.js";var p=e(t(),1),m=`font-medium text-primary-text hover:underline`,h=({email:e,onSignOut:t,children:n})=>{let r=i();return(0,p.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2 border-t pt-4 text-center text-muted-foreground`,children:[n,(0,p.jsx)(`p`,{className:`break-words`,children:r(`signedInAs`,{email:e})}),(0,p.jsx)(`button`,{type:`button`,onClick:t,className:`self-center font-medium text-muted-foreground hover:text-foreground hover:underline`,children:r(`signOut`)})]})},g=({path:e,basePath:t,email:g,mayCreate:_,seesAll:v,onSignOut:y})=>{let{session:b,organizations:x}=l(),S=i(),C=f(),{busy:w,error:T,run:E}=r(),D=()=>n(t),O=v&&(0,p.jsx)(o,{to:`/-/organizations`,className:m,children:S(`allOrganizations`)}),k=(0,p.jsx)(h,{email:g,onSignOut:y,children:O});if(C.state===`loading`)return(0,p.jsx)(`div`,{className:`min-h-full`,"aria-busy":!0});if(C.state===`failed`)return(0,p.jsxs)(s,{title:S(`invitationsNotLoaded`),description:S(`invitationsNotLoadedHelp`),children:[(0,p.jsx)(c,{variant:`primary`,className:`min-h-10 w-full`,onClick:C.retry,children:S(`tryAgain`)}),k]});let A=C.invitations;return A.length>0&&(e!==`/-/first-organization/new`||!_)?(0,p.jsxs)(s,{title:S(`invitedTitle`),description:S(_?`invitedSubtitle`:`invitedSubtitleJoinOnly`),children:[(0,p.jsx)(a,{message:T}),(0,p.jsx)(`ul`,{className:`divide-y rounded-md border`,children:A.map(e=>(0,p.jsx)(d,{invitation:e,t:S,busy:w,onJoin:()=>void E(async()=>{await b.organizations.acceptMine(e.id),D()})},e.id))}),_&&(0,p.jsx)(`p`,{className:`mt-4 text-center`,children:(0,p.jsx)(o,{to:`/-/first-organization/new`,className:m,children:S(`createInstead`)})}),k]}):_?(0,p.jsxs)(s,{title:S(`createTitle`),...x?.createDescription&&{description:x.createDescription},children:[(0,p.jsx)(u,{autoFocus:!0,onCreated:D}),A.length>0&&(0,p.jsx)(`p`,{className:`mt-4 text-center`,children:(0,p.jsx)(o,{to:`/-/first-organization`,className:m,children:S(`backToInvitations`)})}),k]}):(0,p.jsx)(s,{title:S(`notInAnyTitle`),description:S(`notInAny`,{email:g}),children:k})};export{g as FirstOrganizationPage};
2
+ //# debugId=81482557-9708-4c16-847c-fed7ae8e9fa6
@@ -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{Ds as r,Js as i,Jt as a,Ts as o,Yt as s,bi as c,mn as l,nr as u,vs as d,ws as f,yi as p}from"./app-B48LQpC1.js";import{a as m,r as h}from"./lib-xyflow-system-hojcPWkY.js";import{a as g,c as _,n as v,o as y,r as b}from"./lib-xyflow-react-CuNAzocq.js";import{t as x}from"./use-elk-u1Ql5AOs.js";var S=e(t(),1),C={neutral:`var(--color-border-strong)`,blue:`var(--color-primary)`,green:`var(--color-success)`,amber:`var(--color-warning)`,red:`var(--color-danger)`,violet:`var(--color-violet)`},w={dashed:`6 4`,dotted:`1.5 4`},T=e=>Object.fromEntries(o.flatMap(t=>typeof e[t]==`string`?[[t,f(e[t])]]:[])),E=(e,t)=>{if(!e?.ok)return!1;let n={stack:[{record:t}]};return r(e,Object.fromEntries(e.paths.map(e=>[e,d(n,e)])))},D=(e,t,n,r)=>{let i=t.edgeStatus,a=i===void 0?void 0:r?.fields[i]?.valueColors,o=i===void 0?void 0:e.row[i],s=i===void 0||o==null?C.neutral:p(a,o)??C[c(a,o)],l=E(n.dotted,e.row)?w.dotted:E(n.dashed,e.row)?w.dashed:void 0,u=t.edgeLabel===void 0?void 0:e.row[t.edgeLabel],d=t.edgeLabel===void 0?void 0:r?.fields[t.edgeLabel]?.valueLabels,f=u==null||u===``?void 0:d?.[String(u)]??String(u);return{stroke:s,animated:E(n.animated,e.row),...l&&{dash:l},...f!==void 0&&{label:f}}},O={width:200,height:64},k={top:32,side:16,bottom:16},A=`[top=${k.top},left=${k.side},bottom=${k.bottom},right=${k.side}]`,j=48,M=e=>`group:${e}`,N=e=>`node:${e}`,P=e=>e.layout===`force`?{"elk.algorithm":`force`,"elk.randomSeed":`1`,"elk.spacing.nodeNode":`40`}:{"elk.algorithm":`layered`,"elk.direction":e.direction===`right`?`RIGHT`:`DOWN`,"elk.layered.spacing.nodeNodeBetweenLayers":`56`,"elk.spacing.nodeNode":`32`},F=(e,t)=>e.nodes.filter(e=>!t.positions.has(e.id)),I=(e,t)=>{let n=F(e,t);if(n.length===0)return;let r=P(t),i=e=>({id:N(e),...t.sizes.get(e)??O}),a=e.groups.flatMap(e=>{let t=n.filter(t=>t.group===e.id);return t.length===0?[]:[{id:M(e.id),layoutOptions:{...r,"elk.padding":A},children:t.map(e=>i(e.id))}]}),o=n.filter(e=>e.group===void 0).map(e=>i(e.id)),s=new Set(n.map(e=>e.id)),c=e.edges.filter(e=>s.has(e.source)&&s.has(e.target)&&e.source!==e.target).map(e=>({id:`edge:${e.id}`,sources:[N(e.source)],targets:[N(e.target)]}));return{id:`root`,layoutOptions:{...r,...t.layout===`layered`&&{"elk.hierarchyHandling":`INCLUDE_CHILDREN`}},children:[...a,...o],edges:c}},L=e=>{if(e.length===0)return;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y));return{x:t,y:n,width:Math.max(...e.map(e=>e.x+e.width))-t,height:Math.max(...e.map(e=>e.y+e.height))-n}},R=(e,t,n)=>{let r=new Map;for(let n of e.nodes){let e=t.positions.get(n.id);e&&r.set(n.id,{...e,...t.sizes.get(n.id)??O})}let i=new Map,a=(e,t,n)=>{for(let r of e.children??[]){let e={x:t+(r.x??0),y:n+(r.y??0)};r.id.startsWith(`node:`)?i.set(r.id.slice(5),{...e,width:r.width??O.width,height:r.height??O.height}):a(r,e.x,e.y)}};n&&a(n,0,0);let o=L([...r.values()]),s=L([...i.values()]),c=o&&s?{x:o.x-s.x,y:o.y+o.height+j-s.y}:{x:0,y:0};for(let[e,t]of i)r.set(e,{...t,x:t.x+c.x,y:t.y+c.y});let l=new Map;for(let t of e.groups){let n=L(e.nodes.filter(e=>e.group===t.id&&r.has(e.id)).map(e=>r.get(e.id)));n&&l.set(t.id,{x:n.x-k.side,y:n.y-k.top,width:n.width+2*k.side,height:n.height+k.top+k.bottom})}let u=L([...r.values(),...l.values()])??{x:0,y:0,width:0,height:0},d=e=>({...e,x:e.x-u.x,y:e.y-u.y});return{nodes:new Map([...r].map(([e,t])=>[e,d(t)])),groups:new Map([...l].map(([e,t])=>[e,d(t)])),width:u.width,height:u.height}},z=e(n(),1),B=`pointer-events-none !min-h-0 !min-w-0 !border-0 !bg-transparent`,V=({sides:e})=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(b,{type:`target`,position:e===`vertical`?m.Top:m.Left,isConnectable:!1,className:B}),(0,z.jsx)(b,{type:`source`,position:e===`vertical`?m.Bottom:m.Right,isConnectable:!1,className:B})]}),H=e=>`relative rounded-lg border bg-surface text-body ${e?`border-primary ring-2 ring-primary/40`:`border-border`}`,U=({data:e})=>{let{model:t,view:n,fields:r,row:o,content:c,to:d,chosen:f,sides:p}=e,m=String(o[r.label]??``),h=r.status&&(0,z.jsx)(a,{view:n,field:r.status,record:o});return c===void 0?(0,z.jsxs)(`div`,{"data-chosen":f||void 0,className:`${H(f)} flex size-full flex-col justify-center gap-1 px-3 py-2`,children:[(0,z.jsx)(V,{sides:p}),h,d?(0,z.jsx)(i,{to:d,"aria-current":f||void 0,className:`pointer-events-auto line-clamp-2 min-w-0 font-medium [overflow-wrap:anywhere] text-primary-text hover:underline`,children:m}):(0,z.jsx)(`span`,{className:`line-clamp-2 min-w-0 font-medium [overflow-wrap:anywhere]`,children:m}),r.status&&(0,z.jsx)(`div`,{className:`flex`,children:(0,z.jsx)(s,{model:t,view:n,field:r.status,record:o})})]}):(0,z.jsxs)(`div`,{"data-chosen":f||void 0,className:`${H(f)} flex w-full flex-col gap-1 px-3 py-2`,children:[(0,z.jsx)(V,{sides:p}),h,d&&(0,z.jsx)(i,{to:d,"aria-label":m,"aria-current":f||void 0,className:`pointer-events-auto absolute inset-0 rounded-lg hover:bg-muted/40`}),(0,z.jsx)(`div`,{className:`relative min-w-0 [overflow-wrap:anywhere] [&_a]:pointer-events-auto`,children:(0,z.jsx)(u,{value:l(t,o),children:c})})]})},W=({data:e})=>(0,z.jsx)(`div`,{className:`size-full rounded-xl border border-dashed border-border-strong bg-muted/40`,children:e.fields.group&&(0,z.jsx)(`div`,{className:`flex px-2 pt-1 text-xs`,children:(0,z.jsx)(s,{model:e.model,view:e.view,field:e.fields.group,record:e.row})})}),G=(e,t)=>{let n=I(e,t),r=x(),i=JSON.stringify([n,e.nodes.map(e=>e.id),e.groups.map(e=>e.id),[...t.positions],[...t.sizes]]),a=(0,S.useMemo)(()=>n?void 0:R(e,t),[i]),[o,s]=(0,S.useState)(),[c,l]=(0,S.useState)();if((0,S.useEffect)(()=>{if(!r||!n)return;let a=!0;return r.layout(n).then(n=>{a&&s({signature:i,layout:R(e,t,n)})},e=>{a&&l(e instanceof Error?e:Error(String(e)))}),()=>{a=!1}},[r,i]),c)throw c;return a||o?.layout},K={record:U,"group-box":W},q=256,J=`min(40rem, 70vh)`,Y={minZoom:.6,maxZoom:1},X={"--xy-edge-stroke":`var(--color-border-strong)`,"--xy-edge-stroke-width":`1.5`,"--xy-background-color":`transparent`,"--xy-edge-label-background-color":`var(--color-surface)`,"--xy-edge-label-color":`var(--color-muted-foreground)`,"--xy-controls-button-background-color":`var(--color-surface)`,"--xy-controls-button-background-color-hover":`var(--color-muted)`,"--xy-controls-button-color":`var(--color-foreground)`,"--xy-controls-button-color-hover":`var(--color-foreground)`,"--xy-controls-button-border-color":`var(--color-border)`,"--xy-attribution-background-color":`transparent`},Z=e=>typeof e==`number`&&Number.isFinite(e)?e:typeof e==`string`&&e.trim()!==``&&Number.isFinite(Number(e))?Number(e):void 0,Q=({shape:e,nodes:t,fields:n,select:r,content:i},a,o)=>{let s={model:t.model,view:t.view,fields:n},c=e.groups.flatMap(t=>{let n=a?.groups.get(t.id),r=e.nodes.find(e=>e.group===t.id).row;return n?[{id:`group:${t.id}`,type:`group-box`,position:{x:n.x,y:n.y},width:n.width,height:n.height,zIndex:-1,data:{...s,row:r},draggable:!1,selectable:!1,focusable:!1}]:[]}),l=e.nodes.map(e=>{let t=a?.nodes.get(e.id),n=r?.chosen===e.id;return{id:`node:${e.id}`,type:`record`,position:t?{x:t.x,y:t.y}:{x:0,y:0},...i===void 0?{width:O.width,height:O.height}:{style:{width:224}},data:{...s,row:e.row,chosen:n,sides:o,...i!==void 0&&{content:i},...r&&{to:r.linkTo(e.id)}},draggable:!1,selectable:!1}});return[...c,...l]},$=({shape:e,edges:t,props:n},r)=>{let i=T(n);return e.edges.map(e=>{let a=D(e,n,i,t.view);return{id:`edge:${e.id}`,source:`node:${e.source}`,target:`node:${e.target}`,...r&&{type:`straight`},markerEnd:{type:h.ArrowClosed,color:a.stroke},style:{stroke:a.stroke,...a.dash&&{strokeDasharray:a.dash}},animated:a.animated,...a.label!==void 0&&{label:a.label,labelBgPadding:[4,2],labelBgBorderRadius:4},focusable:!1,selectable:!1}})},ee=({layout:e})=>{let t=_();return(0,S.useEffect)(()=>{if(!e)return;let n=requestAnimationFrame(()=>void t.fitView(Y));return()=>cancelAnimationFrame(n)},[t,e]),null},te=e=>{let{shape:t,content:n}=e,[r,i]=(0,S.useState)(new Map),a=(0,S.useMemo)(()=>new Map(t.nodes.map(e=>[e.id,n===void 0?O:{width:224,height:r.get(e.id)?.height??O.height}])),[t,n,r]),o=(0,S.useMemo)(()=>{let{x:n,y:r}=e.props;return n===void 0||r===void 0?new Map:new Map(t.nodes.flatMap(e=>{let t={x:Z(e.row[n]),y:Z(e.row[r])};return t.x===void 0||t.y===void 0?[]:[[e.id,t]]}))},[t,e.props.x,e.props.y]),s=e.props.layout??`layered`,c=e.props.direction??`down`,l=G(t,{layout:s,direction:c,sizes:a,positions:o}),u=l!==void 0&&(n===void 0||t.nodes.every(e=>r.has(e.id))),d=Q(e,l,s===`layered`&&c===`right`?`horizontal`:`vertical`),f=(0,S.useMemo)(()=>$(e,s===`force`),[t,e.edges.view,e.props,s]),p=e=>{let t=e.flatMap(e=>e.type===`dimensions`&&e.dimensions&&e.id.startsWith(`node:`)?[[e.id.slice(5),e.dimensions]]:[]);t.length!==0&&i(e=>{let n=new Map(e);for(let[e,r]of t)n.set(e,{width:Math.round(r.width),height:Math.round(r.height)});return n.size===e.size&&[...n].every(([t,n])=>e.get(t)?.height===n.height)?e:n})};return(0,z.jsx)(`div`,{className:`w-full`,style:{...X,aspectRatio:l?`${Math.max(l.width,1)} / ${Math.max(l.height,1)}`:void 0,minHeight:q,maxHeight:J,...!u&&{opacity:0}},children:(0,z.jsxs)(y,{nodes:d,edges:f,nodeTypes:K,onNodesChange:n===void 0?void 0:p,fitView:!0,fitViewOptions:Y,minZoom:.1,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,edgesFocusable:!1,zoomOnScroll:!1,zoomOnDoubleClick:!1,preventScrolling:!1,zoomOnPinch:!0,panOnDrag:!0,children:[(0,z.jsx)(ee,{layout:u?l:void 0}),(0,z.jsx)(v,{showInteractive:!1})]})})},ne=e=>(0,z.jsx)(g,{children:(0,z.jsx)(te,{...e})});export{ne as GraphView};
2
- //# debugId=c57961a6-e463-4ccf-a80d-86a3fe99a8bd
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{Es as r,Fs as i,Jt as a,Ms as o,Ns as s,Yt as c,bi as l,mn as u,nc as d,nr as f,yi as p}from"./app-Bu6FwwHZ.js";import{a as m,r as h}from"./lib-xyflow-system-hojcPWkY.js";import{a as g,c as _,n as v,o as y,r as b}from"./lib-xyflow-react-CuNAzocq.js";import{t as x}from"./use-elk-u1Ql5AOs.js";var S=e(t(),1),C={neutral:`var(--color-border-strong)`,blue:`var(--color-primary)`,green:`var(--color-success)`,amber:`var(--color-warning)`,red:`var(--color-danger)`,violet:`var(--color-violet)`},w={dashed:`6 4`,dotted:`1.5 4`},T=e=>Object.fromEntries(s.flatMap(t=>typeof e[t]==`string`?[[t,o(e[t])]]:[])),E=(e,t)=>{if(!e?.ok)return!1;let n={stack:[{record:t}]};return i(e,Object.fromEntries(e.paths.map(e=>[e,r(n,e)])))},D=(e,t,n,r)=>{let i=t.edgeStatus,a=i===void 0?void 0:r?.fields[i]?.valueColors,o=i===void 0?void 0:e.row[i],s=i===void 0||o==null?C.neutral:p(a,o)??C[l(a,o)],c=E(n.dotted,e.row)?w.dotted:E(n.dashed,e.row)?w.dashed:void 0,u=t.edgeLabel===void 0?void 0:e.row[t.edgeLabel],d=t.edgeLabel===void 0?void 0:r?.fields[t.edgeLabel]?.valueLabels,f=u==null||u===``?void 0:d?.[String(u)]??String(u);return{stroke:s,animated:E(n.animated,e.row),...c&&{dash:c},...f!==void 0&&{label:f}}},O={width:200,height:64},k={top:32,side:16,bottom:16},A=`[top=${k.top},left=${k.side},bottom=${k.bottom},right=${k.side}]`,j=48,M=e=>`group:${e}`,N=e=>`node:${e}`,P=e=>e.layout===`force`?{"elk.algorithm":`force`,"elk.randomSeed":`1`,"elk.spacing.nodeNode":`40`}:{"elk.algorithm":`layered`,"elk.direction":e.direction===`right`?`RIGHT`:`DOWN`,"elk.layered.spacing.nodeNodeBetweenLayers":`56`,"elk.spacing.nodeNode":`32`},F=(e,t)=>e.nodes.filter(e=>!t.positions.has(e.id)),I=(e,t)=>{let n=F(e,t);if(n.length===0)return;let r=P(t),i=e=>({id:N(e),...t.sizes.get(e)??O}),a=e.groups.flatMap(e=>{let t=n.filter(t=>t.group===e.id);return t.length===0?[]:[{id:M(e.id),layoutOptions:{...r,"elk.padding":A},children:t.map(e=>i(e.id))}]}),o=n.filter(e=>e.group===void 0).map(e=>i(e.id)),s=new Set(n.map(e=>e.id)),c=e.edges.filter(e=>s.has(e.source)&&s.has(e.target)&&e.source!==e.target).map(e=>({id:`edge:${e.id}`,sources:[N(e.source)],targets:[N(e.target)]}));return{id:`root`,layoutOptions:{...r,...t.layout===`layered`&&{"elk.hierarchyHandling":`INCLUDE_CHILDREN`}},children:[...a,...o],edges:c}},L=e=>{if(e.length===0)return;let t=Math.min(...e.map(e=>e.x)),n=Math.min(...e.map(e=>e.y));return{x:t,y:n,width:Math.max(...e.map(e=>e.x+e.width))-t,height:Math.max(...e.map(e=>e.y+e.height))-n}},R=(e,t,n)=>{let r=new Map;for(let n of e.nodes){let e=t.positions.get(n.id);e&&r.set(n.id,{...e,...t.sizes.get(n.id)??O})}let i=new Map,a=(e,t,n)=>{for(let r of e.children??[]){let e={x:t+(r.x??0),y:n+(r.y??0)};r.id.startsWith(`node:`)?i.set(r.id.slice(5),{...e,width:r.width??O.width,height:r.height??O.height}):a(r,e.x,e.y)}};n&&a(n,0,0);let o=L([...r.values()]),s=L([...i.values()]),c=o&&s?{x:o.x-s.x,y:o.y+o.height+j-s.y}:{x:0,y:0};for(let[e,t]of i)r.set(e,{...t,x:t.x+c.x,y:t.y+c.y});let l=new Map;for(let t of e.groups){let n=L(e.nodes.filter(e=>e.group===t.id&&r.has(e.id)).map(e=>r.get(e.id)));n&&l.set(t.id,{x:n.x-k.side,y:n.y-k.top,width:n.width+2*k.side,height:n.height+k.top+k.bottom})}let u=L([...r.values(),...l.values()])??{x:0,y:0,width:0,height:0},d=e=>({...e,x:e.x-u.x,y:e.y-u.y});return{nodes:new Map([...r].map(([e,t])=>[e,d(t)])),groups:new Map([...l].map(([e,t])=>[e,d(t)])),width:u.width,height:u.height}},z=e(n(),1),B=`pointer-events-none !min-h-0 !min-w-0 !border-0 !bg-transparent`,V=({sides:e})=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(b,{type:`target`,position:e===`vertical`?m.Top:m.Left,isConnectable:!1,className:B}),(0,z.jsx)(b,{type:`source`,position:e===`vertical`?m.Bottom:m.Right,isConnectable:!1,className:B})]}),H=e=>`relative rounded-lg border bg-surface text-body ${e?`border-primary ring-2 ring-primary/40`:`border-border`}`,U=({data:e})=>{let{model:t,view:n,fields:r,row:i,content:o,to:s,chosen:l,sides:p}=e,m=String(i[r.label]??``),h=r.status&&(0,z.jsx)(a,{view:n,field:r.status,record:i});return o===void 0?(0,z.jsxs)(`div`,{"data-chosen":l||void 0,className:`${H(l)} flex size-full flex-col justify-center gap-1 px-3 py-2`,children:[(0,z.jsx)(V,{sides:p}),h,s?(0,z.jsx)(d,{to:s,"aria-current":l||void 0,className:`pointer-events-auto line-clamp-2 min-w-0 font-medium [overflow-wrap:anywhere] text-primary-text hover:underline`,children:m}):(0,z.jsx)(`span`,{className:`line-clamp-2 min-w-0 font-medium [overflow-wrap:anywhere]`,children:m}),r.status&&(0,z.jsx)(`div`,{className:`flex`,children:(0,z.jsx)(c,{model:t,view:n,field:r.status,record:i})})]}):(0,z.jsxs)(`div`,{"data-chosen":l||void 0,className:`${H(l)} flex w-full flex-col gap-1 px-3 py-2`,children:[(0,z.jsx)(V,{sides:p}),h,s&&(0,z.jsx)(d,{to:s,"aria-label":m,"aria-current":l||void 0,className:`pointer-events-auto absolute inset-0 rounded-lg hover:bg-muted/40`}),(0,z.jsx)(`div`,{className:`relative min-w-0 [overflow-wrap:anywhere] [&_a]:pointer-events-auto`,children:(0,z.jsx)(f,{value:u(t,i),children:o})})]})},W=({data:e})=>(0,z.jsx)(`div`,{className:`size-full rounded-xl border border-dashed border-border-strong bg-muted/40`,children:e.fields.group&&(0,z.jsx)(`div`,{className:`flex px-2 pt-1 text-xs`,children:(0,z.jsx)(c,{model:e.model,view:e.view,field:e.fields.group,record:e.row})})}),G=(e,t)=>{let n=I(e,t),r=x(),i=JSON.stringify([n,e.nodes.map(e=>e.id),e.groups.map(e=>e.id),[...t.positions],[...t.sizes]]),a=(0,S.useMemo)(()=>n?void 0:R(e,t),[i]),[o,s]=(0,S.useState)(),[c,l]=(0,S.useState)();if((0,S.useEffect)(()=>{if(!r||!n)return;let a=!0;return r.layout(n).then(n=>{a&&s({signature:i,layout:R(e,t,n)})},e=>{a&&l(e instanceof Error?e:Error(String(e)))}),()=>{a=!1}},[r,i]),c)throw c;return a||o?.layout},K={record:U,"group-box":W},q=256,J=`min(40rem, 70vh)`,Y={minZoom:.6,maxZoom:1},X={"--xy-edge-stroke":`var(--color-border-strong)`,"--xy-edge-stroke-width":`1.5`,"--xy-background-color":`transparent`,"--xy-edge-label-background-color":`var(--color-surface)`,"--xy-edge-label-color":`var(--color-muted-foreground)`,"--xy-controls-button-background-color":`var(--color-surface)`,"--xy-controls-button-background-color-hover":`var(--color-muted)`,"--xy-controls-button-color":`var(--color-foreground)`,"--xy-controls-button-color-hover":`var(--color-foreground)`,"--xy-controls-button-border-color":`var(--color-border)`,"--xy-attribution-background-color":`transparent`},Z=e=>typeof e==`number`&&Number.isFinite(e)?e:typeof e==`string`&&e.trim()!==``&&Number.isFinite(Number(e))?Number(e):void 0,Q=({shape:e,nodes:t,fields:n,select:r,content:i},a,o)=>{let s={model:t.model,view:t.view,fields:n},c=e.groups.flatMap(t=>{let n=a?.groups.get(t.id),r=e.nodes.find(e=>e.group===t.id).row;return n?[{id:`group:${t.id}`,type:`group-box`,position:{x:n.x,y:n.y},width:n.width,height:n.height,zIndex:-1,data:{...s,row:r},draggable:!1,selectable:!1,focusable:!1}]:[]}),l=e.nodes.map(e=>{let t=a?.nodes.get(e.id),n=r?.chosen===e.id;return{id:`node:${e.id}`,type:`record`,position:t?{x:t.x,y:t.y}:{x:0,y:0},...i===void 0?{width:O.width,height:O.height}:{style:{width:224}},data:{...s,row:e.row,chosen:n,sides:o,...i!==void 0&&{content:i},...r&&{to:r.linkTo(e.id)}},draggable:!1,selectable:!1}});return[...c,...l]},$=({shape:e,edges:t,props:n},r)=>{let i=T(n);return e.edges.map(e=>{let a=D(e,n,i,t.view);return{id:`edge:${e.id}`,source:`node:${e.source}`,target:`node:${e.target}`,...r&&{type:`straight`},markerEnd:{type:h.ArrowClosed,color:a.stroke},style:{stroke:a.stroke,...a.dash&&{strokeDasharray:a.dash}},animated:a.animated,...a.label!==void 0&&{label:a.label,labelBgPadding:[4,2],labelBgBorderRadius:4},focusable:!1,selectable:!1}})},ee=({layout:e})=>{let t=_();return(0,S.useEffect)(()=>{if(!e)return;let n=requestAnimationFrame(()=>void t.fitView(Y));return()=>cancelAnimationFrame(n)},[t,e]),null},te=e=>{let{shape:t,content:n}=e,[r,i]=(0,S.useState)(new Map),a=(0,S.useMemo)(()=>new Map(t.nodes.map(e=>[e.id,n===void 0?O:{width:224,height:r.get(e.id)?.height??O.height}])),[t,n,r]),o=(0,S.useMemo)(()=>{let{x:n,y:r}=e.props;return n===void 0||r===void 0?new Map:new Map(t.nodes.flatMap(e=>{let t={x:Z(e.row[n]),y:Z(e.row[r])};return t.x===void 0||t.y===void 0?[]:[[e.id,t]]}))},[t,e.props.x,e.props.y]),s=e.props.layout??`layered`,c=e.props.direction??`down`,l=G(t,{layout:s,direction:c,sizes:a,positions:o}),u=l!==void 0&&(n===void 0||t.nodes.every(e=>r.has(e.id))),d=Q(e,l,s===`layered`&&c===`right`?`horizontal`:`vertical`),f=(0,S.useMemo)(()=>$(e,s===`force`),[t,e.edges.view,e.props,s]),p=e=>{let t=e.flatMap(e=>e.type===`dimensions`&&e.dimensions&&e.id.startsWith(`node:`)?[[e.id.slice(5),e.dimensions]]:[]);t.length!==0&&i(e=>{let n=new Map(e);for(let[e,r]of t)n.set(e,{width:Math.round(r.width),height:Math.round(r.height)});return n.size===e.size&&[...n].every(([t,n])=>e.get(t)?.height===n.height)?e:n})};return(0,z.jsx)(`div`,{className:`w-full`,style:{...X,aspectRatio:l?`${Math.max(l.width,1)} / ${Math.max(l.height,1)}`:void 0,minHeight:q,maxHeight:J,...!u&&{opacity:0}},children:(0,z.jsxs)(y,{nodes:d,edges:f,nodeTypes:K,onNodesChange:n===void 0?void 0:p,fitView:!0,fitViewOptions:Y,minZoom:.1,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,edgesFocusable:!1,zoomOnScroll:!1,zoomOnDoubleClick:!1,preventScrolling:!1,zoomOnPinch:!0,panOnDrag:!0,children:[(0,z.jsx)(ee,{layout:u?l:void 0}),(0,z.jsx)(v,{showInteractive:!1})]})})},ne=e=>(0,z.jsx)(g,{children:(0,z.jsx)(te,{...e})});export{ne as GraphView};
2
+ //# debugId=00233495-6b73-4a3b-a86a-39c85be25439
@@ -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{t}from"./react-CuiNlnus.js";import{vt as n}from"./embedded-list-CdFZ5TIe.js";import{d as r,f as i,l as a,t as o,u as s}from"./lib-recharts-B1lKFZ5P.js";import{t as c}from"./legend-item-BoeI6b5Y.js";var l=e(t(),1),u=(e,t)=>t>0?`${Math.round(e/t*100)}%`:``,d=({active:e,payload:t,measure:r})=>{let i=t?.[0]?.payload;return!e||!i?null:(0,l.jsxs)(`div`,{className:`rounded-md border bg-background px-2.5 py-1.5 text-xs shadow-pop`,children:[(0,l.jsx)(`div`,{className:`text-muted-foreground`,children:i.label}),(0,l.jsx)(`div`,{className:`font-semibold tabular-nums`,children:n(i.value,r)})]})},f=({resource:e,view:t,slices:f,measure:p})=>{let m=f.filter(e=>e.value!==null&&e.value>0),h=m.reduce((e,t)=>e+t.value,0);return(0,l.jsxs)(`div`,{className:`flex flex-col items-center gap-4 sm:flex-row sm:items-center`,children:[(0,l.jsx)(`div`,{className:`size-36 shrink-0`,children:(0,l.jsx)(i,{width:`100%`,height:`100%`,children:(0,l.jsxs)(o,{children:[(0,l.jsx)(a,{data:m,dataKey:`value`,nameKey:`label`,innerRadius:`62%`,outerRadius:`100%`,paddingAngle:+(m.length>1),stroke:`var(--background)`,strokeWidth:2,isAnimationActive:!1,children:m.map(e=>(0,l.jsx)(s,{fill:e.color},e.key))}),(0,l.jsx)(r,{content:(0,l.jsx)(d,{measure:p}),isAnimationActive:!1})]})})}),(0,l.jsx)(`ul`,{className:`flex w-full min-w-0 flex-col gap-0.5`,children:f.map(r=>(0,l.jsxs)(c,{resource:e,view:t,filter:r.filter,color:r.color,label:r.label,children:[(0,l.jsx)(`span`,{className:`font-medium tabular-nums`,children:n(r.value,p)}),(0,l.jsx)(`span`,{className:`w-9 text-right text-xs text-muted-foreground tabular-nums`,children:u(r.value??0,h)})]},r.key))})]})};export{f as GroupDonut};
2
- //# debugId=fdbd2a9c-a398-4309-a0c3-0958a6d3d6d4
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{t}from"./react-CuiNlnus.js";import{vt as n}from"./embedded-list-DJUmoyQF.js";import{d as r,f as i,l as a,t as o,u as s}from"./lib-recharts-B1lKFZ5P.js";import{t as c}from"./legend-item-DXXBS_hw.js";var l=e(t(),1),u=(e,t)=>t>0?`${Math.round(e/t*100)}%`:``,d=({active:e,payload:t,measure:r})=>{let i=t?.[0]?.payload;return!e||!i?null:(0,l.jsxs)(`div`,{className:`rounded-md border bg-background px-2.5 py-1.5 text-xs shadow-pop`,children:[(0,l.jsx)(`div`,{className:`text-muted-foreground`,children:i.label}),(0,l.jsx)(`div`,{className:`font-semibold tabular-nums`,children:n(i.value,r)})]})},f=({resource:e,view:t,slices:f,measure:p})=>{let m=f.filter(e=>e.value!==null&&e.value>0),h=m.reduce((e,t)=>e+t.value,0);return(0,l.jsxs)(`div`,{className:`flex flex-col items-center gap-4 sm:flex-row sm:items-center`,children:[(0,l.jsx)(`div`,{className:`size-36 shrink-0`,children:(0,l.jsx)(i,{width:`100%`,height:`100%`,children:(0,l.jsxs)(o,{children:[(0,l.jsx)(a,{data:m,dataKey:`value`,nameKey:`label`,innerRadius:`62%`,outerRadius:`100%`,paddingAngle:+(m.length>1),stroke:`var(--background)`,strokeWidth:2,isAnimationActive:!1,children:m.map(e=>(0,l.jsx)(s,{fill:e.color},e.key))}),(0,l.jsx)(r,{content:(0,l.jsx)(d,{measure:p}),isAnimationActive:!1})]})})}),(0,l.jsx)(`ul`,{className:`flex w-full min-w-0 flex-col gap-0.5`,children:f.map(r=>(0,l.jsxs)(c,{resource:e,view:t,filter:r.filter,color:r.color,label:r.label,children:[(0,l.jsx)(`span`,{className:`font-medium tabular-nums`,children:n(r.value,p)}),(0,l.jsx)(`span`,{className:`w-9 text-right text-xs text-muted-foreground tabular-nums`,children:u(r.value??0,h)})]},r.key))})]})};export{f as GroupDonut};
2
+ //# debugId=3d120dd3-ad90-4997-be6d-2fba0a8a9a4b
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/calls-Ca2RAgzS.js","assets/app-B48LQpC1.js","assets/rolldown-runtime-DFwUHQ4A.js","assets/react-CuiNlnus.js","assets/vendor-t7Q7QbPu.js","assets/app-Dq5eubgK.css"])))=>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{$s as r,Ht as i,Pa as a,So as o,Ut as s,Wt as c,qc as l}from"./app-B48LQpC1.js";import{C as u}from"./vendor-t7Q7QbPu.js";var d=e(t(),1),f=e(n(),1),p=({link:e,systemPath:t,base:n})=>{let[p,m]=(0,d.useState)(``),[h,g]=(0,d.useState)(),[_,v]=(0,d.useState)(!1),y=(0,d.useCallback)(async n=>{let{guestLobby:r}=await u(async()=>{let{guestLobby:e}=await import(`./calls-Ca2RAgzS.js`);return{guestLobby:e}},__vite__mapDeps([0,1,2,3,4,5]));return s(r({systemPath:t}),e,h,n)},[t,e,h]),b=e=>{e.preventDefault(),p.trim()&&g(p.trim())},x=a(n,e);return _?(0,f.jsx)(`p`,{role:`status`,className:`flex min-h-[100dvh] items-center justify-center bg-background p-4 text-sm text-foreground`,children:c(`youLeft`)}):h===void 0?(0,f.jsx)(`main`,{className:`flex min-h-[100dvh] items-center justify-center bg-background p-4`,children:(0,f.jsxs)(`form`,{onSubmit:b,className:`flex w-full max-w-sm flex-col gap-3`,children:[(0,f.jsx)(`p`,{className:`text-sm text-foreground`,children:c(`guestIntro`)}),(0,f.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm text-foreground`,children:[c(`yourName`),(0,f.jsx)(o,{autoFocus:!0,autoComplete:`name`,maxLength:60,value:p,onChange:e=>m(e.target.value)})]}),(0,f.jsx)(r,{type:`submit`,variant:`primary`,disabled:!p.trim(),children:c(`continue`)})]})}):(0,f.jsx)(`main`,{className:`h-[100dvh]`,children:(0,f.jsx)(i,{url:l(t,`socket`),admission:y,name:h,nameOf:()=>c(`someone`),leave:{href:x,onFollow:()=>v(!0)}})})};export{p as GuestCallPage};
3
- //# debugId=c8128faa-f77b-4a61-8891-e813f673987e
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/calls-BcTDHAo3.js","assets/app-Bu6FwwHZ.js","assets/rolldown-runtime-DFwUHQ4A.js","assets/react-CuiNlnus.js","assets/vendor-t7Q7QbPu.js","assets/app-xwgcmboV.css"])))=>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{Do as r,Ht as i,Ia as a,Ut as o,Wt as s,sc as c,tl as l}from"./app-Bu6FwwHZ.js";import{C as u}from"./vendor-t7Q7QbPu.js";var d=e(t(),1),f=e(n(),1),p=({link:e,systemPath:t,base:n})=>{let[p,m]=(0,d.useState)(``),[h,g]=(0,d.useState)(),[_,v]=(0,d.useState)(!1),y=(0,d.useCallback)(async n=>{let{guestLobby:r}=await u(async()=>{let{guestLobby:e}=await import(`./calls-BcTDHAo3.js`);return{guestLobby:e}},__vite__mapDeps([0,1,2,3,4,5]));return o(r({systemPath:t}),e,h,n)},[t,e,h]),b=e=>{e.preventDefault(),p.trim()&&g(p.trim())},x=a(n,e);return _?(0,f.jsx)(`p`,{role:`status`,className:`flex min-h-[100dvh] items-center justify-center bg-background p-4 text-sm text-foreground`,children:s(`youLeft`)}):h===void 0?(0,f.jsx)(`main`,{className:`flex min-h-[100dvh] items-center justify-center bg-background p-4`,children:(0,f.jsxs)(`form`,{onSubmit:b,className:`flex w-full max-w-sm flex-col gap-3`,children:[(0,f.jsx)(`p`,{className:`text-sm text-foreground`,children:s(`guestIntro`)}),(0,f.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm text-foreground`,children:[s(`yourName`),(0,f.jsx)(r,{autoFocus:!0,autoComplete:`name`,maxLength:60,value:p,onChange:e=>m(e.target.value)})]}),(0,f.jsx)(c,{type:`submit`,variant:`primary`,disabled:!p.trim(),children:s(`continue`)})]})}):(0,f.jsx)(`main`,{className:`h-[100dvh]`,children:(0,f.jsx)(i,{url:l(t,`socket`),admission:y,name:h,nameOf:()=>s(`someone`),leave:{href:x,onFollow:()=>v(!0)}})})};export{p as GuestCallPage};
3
+ //# debugId=ae5057dd-65ae-4078-8847-b16b0bb424a8
@@ -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{Rr as r,Sn as i,_r as a,br as o,hr as s,vr as c}from"./app-B48LQpC1.js";var l=e(t(),1),u=e=>window.open(e,`_blank`,`noopener,noreferrer`),d=()=>{let e=c(),{go:t,href:n}=r(),i=(0,l.useCallback)(t=>({kind:`record`,resource:e,key:t.key,file:t.field}),[e]);return{address:(0,l.useCallback)(e=>e.kind===`external`?e.url:new URL(n(i(e.file)),window.location.href).href,[i,n]),follow:(0,l.useCallback)((e,{newTab:r})=>{if(e.kind===`external`){u(e.url);return}let a=i(e.file);if(r){u(n(a));return}t(a)},[i,t,n])}},f=e(n(),1),p=({file:e,siblings:t})=>{let n=a(e),{address:r,follow:c}=d(),l=s(n.data,t,r);if(n.error)throw n.error;return l?(0,f.jsx)(o,{html:l.html,title:e.name,links:l.links,onLink:c}):(0,f.jsx)(i,{name:e.name})};export{p as HtmlViewer};
2
- //# debugId=05d9cada-0fc6-4087-bfef-0ef83706415c
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{Rr as r,Sn as i,_r as a,br as o,hr as s,vr as c}from"./app-Bu6FwwHZ.js";var l=e(t(),1),u=e=>window.open(e,`_blank`,`noopener,noreferrer`),d=()=>{let e=c(),{go:t,href:n}=r(),i=(0,l.useCallback)(t=>({kind:`record`,resource:e,key:t.key,file:t.field}),[e]);return{address:(0,l.useCallback)(e=>e.kind===`external`?e.url:new URL(n(i(e.file)),window.location.href).href,[i,n]),follow:(0,l.useCallback)((e,{newTab:r})=>{if(e.kind===`external`){u(e.url);return}let a=i(e.file);if(r){u(n(a));return}t(a)},[i,t,n])}},f=e(n(),1),p=({file:e,siblings:t})=>{let n=a(e),{address:r,follow:c}=d(),l=s(n.data,t,r);if(n.error)throw n.error;return l?(0,f.jsx)(o,{html:l.html,title:e.name,links:l.links,onLink:c}):(0,f.jsx)(i,{name:e.name})};export{p as HtmlViewer};
2
+ //# debugId=856e4dfa-f6ca-4706-b69b-3f4442f8dc45
@@ -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{$s as r,A as i,Gc as a,ac as o,el as s,ho as c,mr as l,os as u,qi as d}from"./app-B48LQpC1.js";import{h as f}from"./vendor-t7Q7QbPu.js";import{_ as p,a as m,c as h,d as g,f as _,g as v,h as y,i as b,l as x,m as S,n as C,o as w,p as T,r as E,s as D,t as O,u as k,v as A}from"./sheet-source-CpQBUfMu.js";import{d as j,o as M,s as N}from"./list-page-C7h-_WJY.js";var P=e(n(),1),F=()=>[{value:`create`,label:j(`create`)},{value:`update`,label:j(`update`)},{value:`upsert`,label:j(`upsert`)}],I={create:`createHint`,update:`updateHint`,upsert:`upsertHint`},L=``,R=({flow:e,model:t,resources:n,views:r,canUpdate:i})=>{let a=r[t.name],s=e.head?.headers??[],l=e.head?.sample??[],u=A(e.mode,e.fields,e.columns),d=[{value:L,label:j(`doNotImport`)},...e.fields.map(e=>({value:e.name,label:`${T(a,e.name)}${p(e)?` *`:``}`}))],f=s.map((e,t)=>({value:String(t),label:N(s,t)})),m=y(t);return(0,P.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[i&&(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(`span`,{className:`font-medium`,children:j(`rows`)}),(0,P.jsx)(`div`,{children:(0,P.jsx)(c,{label:j(`whatEachRowDoes`),size:`md`,value:e.mode,options:F(),onChange:e.setMode})}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j(I[e.mode])})]}),e.mode!==`create`&&(0,P.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,P.jsx)(w,{label:j(`findBy`),value:e.match?.field??L,options:[{value:L,label:j(`chooseField`)},...m.map(e=>({value:e.name,label:T(a,e.name)}))],onChange:t=>e.setMatch(t?{field:t,column:e.match?.column??0}:void 0),help:j(`findByHint`)}),(0,P.jsx)(w,{label:j(`foundInColumn`),value:e.match?String(e.match.column):L,options:[{value:L,label:j(`chooseColumn`)},...f],onChange:t=>e.setMatch(t&&e.match?{...e.match,column:Number(t)}:e.match)})]}),(0,P.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,P.jsx)(w,{label:j(`numbers`),value:e.options.decimal,options:[{value:`.`,label:`1,234.56`},{value:`,`,label:`1.234,56`}],onChange:t=>e.setOptions({...e.options,decimal:t})}),(0,P.jsx)(w,{label:j(`dates`),value:e.options.dateOrder,options:[{value:`dmy`,label:j(`dayFirst`)},{value:`mdy`,label:j(`monthFirst`)}],onChange:t=>e.setOptions({...e.options,dateOrder:t}),help:j(`datesHint`)})]}),e.mode!==`update`&&(0,P.jsx)(`p`,{className:`-mb-3 text-xs text-muted-foreground`,children:j(`requiredMarked`)}),(0,P.jsx)(`section`,{"aria-label":j(`columns`),className:`flex flex-col divide-y divide-border border-y`,children:s.map((i,o)=>{let c=e.columns.find(e=>e.column===o),u=c?t.fields[c.field]:void 0,f=u?v(u,n):void 0,p=l.map(e=>M(e.cells[o]??null)).filter(e=>e!==``).slice(0,3),m=N(s,o);return(0,P.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 py-3 sm:grid-cols-2 sm:gap-4`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`p`,{className:`truncate font-medium`,children:m}),(0,P.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:p.length>0?p.join(`, `):j(`emptyInFirstRows`)})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,P.jsx)(w,{label:j(`field`),name:j(`fieldFor`,{name:m}),value:c?.field??L,options:d,onChange:t=>e.mapColumn(o,t||void 0)}),f&&(0,P.jsx)(w,{label:j(`foundBy`),name:j(`pluralFoundBy`,{plural:r[f.name]?.names?.plural??T(a,u.name)}),value:c.matchBy??f.primaryKey[0],options:y(f).map(e=>({value:e.name,label:T(r[f.name],e.name)})),onChange:t=>e.matchColumnBy(o,t)})]})]},o)})}),u.length>0&&(0,P.jsxs)(`p`,{role:`alert`,className:`flex gap-2 rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-warning-text`,children:[(0,P.jsx)(o,{className:`mt-0.5 size-4 shrink-0`}),(0,P.jsx)(`span`,{children:j(`noColumnFills`,{fields:u.map(e=>T(a,e.name)).join(`, `)})})]})]})},z=e(t(),1),B=e=>{let t=i(e),n=new Intl.DateTimeFormat(e).formatToParts(new Date(2026,3,3)).map(e=>e.type);return{decimal:t,dateOrder:n.indexOf(`month`)<n.indexOf(`day`)?`mdy`:`dmy`}},V=e=>/\.json$/i.test(e.name)||e.type.split(`;`)[0].trim().toLowerCase()===`application/json`,H={created:0,updated:0,skipped:0,failed:0,notWritten:[]},U=({model:e,resources:t,views:n,sourceFor:r=O})=>{let i=u(),a=f(),o=n[e.name],[s,c]=(0,z.useState)({kind:`file`,reading:!1}),[l,d]=(0,z.useState)(),[p,m]=(0,z.useState)(),h=p?V(p.file):!1,v=(0,z.useMemo)(()=>S(e,t,{json:h}),[e,t,h]),[b,w]=(0,z.useState)(),[T,E]=(0,z.useState)(),[D,A]=(0,z.useState)(`create`),[j,M]=(0,z.useState)([]),[N,P]=(0,z.useState)(),[F,I]=(0,z.useState)(()=>B()),L=(0,z.useRef)(!1),R=(0,z.useRef)(void 0),U=e=>t=>{d(t),c(e)},W=n=>{d(void 0),c({kind:`file`,reading:!0});let i=r(n);i.sheets().then(r=>{if(m({file:n,source:i,sheets:r}),w(r[0]),r.length<=1)return G(i,r[0],S(e,t,{json:V(n)}));c({kind:`file`,reading:!1})}).catch(U({kind:`file`,reading:!1}))},G=async(t,n,r)=>{c({kind:`file`,reading:!0});let i=await k(t,n);E(i),M(_(i.headers,r,o));let a=y(e)[0],s=a?_(i.headers,[a],o)[0]:void 0;P(a&&s?{field:a.name,column:s.column}:void 0),c({kind:`map`})},K=()=>{p&&(d(void 0),G(p.source,b,v).catch(U({kind:`file`,reading:!1})))},q=(e,t)=>M(n=>{let r=n.filter(n=>n.column!==e&&n.field!==t);return t?[...r,{column:e,field:t}].sort((e,t)=>e.column-t.column):r}),J=(e,t)=>M(n=>n.map(n=>n.column===e?{...n,matchBy:t}:n)),Y=()=>({mode:D,columns:j,match:D===`create`?void 0:N,options:F}),X=()=>({model:e,resources:t,views:n,lookups:C(i)});return{step:s,error:l,file:p?.file,sheets:p?.sheets??[],sheet:b,setSheet:w,head:T,fields:v,mode:D,setMode:A,columns:j,mapColumn:q,matchColumnBy:J,match:N,setMatch:P,options:F,setOptions:I,choose:W,openSheet:K,check:()=>{if(!p)return;d(void 0);let e=new AbortController;R.current=e,c({kind:`checking`,rows:0}),x(p.source,b,Y(),X(),e=>c({kind:`checking`,rows:e}),e.signal).then(t=>{e.signal.aborted||c({kind:`checked`,check:t})}).catch(t=>{e.signal.aborted||U({kind:`map`})(t)})},back:()=>{R.current?.abort(),d(void 0),c({kind:`map`})},start:t=>{if(!p)return;d(void 0),L.current=!1,c({kind:`importing`,progress:H,total:t,cancelling:!1});let n=H;g(p.source,b,Y(),X(),{client:i(e.name),onProgress:e=>{n=e,c({kind:`importing`,progress:e,total:t,cancelling:L.current})},cancelled:()=>L.current}).then(e=>c({kind:`done`,result:e})).catch(e=>c({kind:`done`,result:{...n,cancelled:!1},stopped:e})).finally(()=>{for(let t of[`page`,`list`,`first-page`,`map`,`facets`,`series`,`aggregate`,`count`])a.invalidateQueries({queryKey:[t,e.name]})})},cancel:()=>{L.current=!0,c(e=>e.kind===`importing`?{...e,cancelling:!0}:e)},stop:()=>R.current?.abort()}},W=e=>e.step.kind===`file`?j(`couldNotReadFile`):j(`couldNotCheck`),G=e=>e.columns.length===0?!1:e.mode===`create`?A(`create`,e.fields,e.columns).length===0:e.match!==void 0,K=({model:e,resources:t,views:n,canUpdate:i,onClose:o,sourceFor:c})=>{let u=U({model:e,resources:t,views:n,sourceFor:c}),f=n[e.name]?.names?.plural??s(e.name),{step:p}=u,g=u.head?.headers??[],_=()=>{p.kind!==`importing`&&(u.stop(),o())},v=(0,P.jsx)(r,{onClick:_,children:j(`cancel`)});return(0,P.jsx)(d,{open:!0,wide:!0,title:j(`importPlural`,{plural:f}),description:u.file&&p.kind!==`file`?u.file.name:void 0,onClose:_,actions:(()=>{switch(p.kind){case`file`:return(0,P.jsxs)(P.Fragment,{children:[v,u.sheets.length>1&&(0,P.jsx)(r,{variant:`primary`,loading:p.reading,onClick:u.openSheet,children:j(`next`)})]});case`map`:return(0,P.jsxs)(P.Fragment,{children:[v,(0,P.jsx)(r,{variant:`primary`,disabled:!G(u),onClick:u.check,children:j(`checkRows`)})]});case`checking`:return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(r,{onClick:u.back,children:j(`back`)}),(0,P.jsx)(r,{variant:`primary`,loading:!0,children:j(`checking`)})]});case`checked`:{let e=p.check.creates+p.check.updates;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(r,{onClick:u.back,children:j(`back`)}),(0,P.jsx)(r,{variant:`primary`,disabled:e===0,onClick:()=>u.start(e),children:j(`importRows`,{count:e.toLocaleString(a()),rows:e})})]})}case`importing`:return(0,P.jsx)(r,{variant:`danger`,disabled:p.cancelling,onClick:u.cancel,children:j(`cancelImport`)});case`done`:return(0,P.jsx)(r,{variant:`primary`,onClick:o,children:j(`done`)})}})(),children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u.error!==void 0&&(0,P.jsx)(l,{title:W(u),error:u.error}),(()=>{switch(p.kind){case`file`:return(0,P.jsx)(m,{file:u.file,sheets:u.sheets,sheet:u.sheet,reading:p.reading,onChoose:u.choose,onSheet:u.setSheet});case`map`:return(0,P.jsx)(R,{flow:u,model:e,resources:t,views:n,canUpdate:i});case`checking`:return(0,P.jsx)(h,{rows:p.rows});case`checked`:return(0,P.jsx)(D,{check:p.check,model:e,resources:t,views:n,columns:u.columns,headers:g,fileName:u.file?.name});case`importing`:return(0,P.jsx)(E,{progress:p.progress,total:p.total,cancelling:p.cancelling});case`done`:return(0,P.jsx)(b,{result:p.result,stopped:p.stopped,headers:g,fileName:u.file?.name})}})()]})})};export{K as ImportDialog};
2
- //# debugId=ba420858-39c7-4faa-b20f-57abda4a5b54
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{$c as r,A as i,Ui as a,bo as o,cl as s,ds as c,mr as l,pc as u,sc as d}from"./app-Bu6FwwHZ.js";import{h as f}from"./vendor-t7Q7QbPu.js";import{_ as p,a as m,c as h,d as g,f as _,g as v,h as y,i as b,l as x,m as S,n as C,o as w,p as T,r as E,s as D,t as O,u as k,v as A}from"./sheet-source-BYMMaydU.js";import{d as j,o as M,s as N}from"./list-page-CXrB1As-.js";var P=e(n(),1),F=()=>[{value:`create`,label:j(`create`)},{value:`update`,label:j(`update`)},{value:`upsert`,label:j(`upsert`)}],I={create:`createHint`,update:`updateHint`,upsert:`upsertHint`},L=``,R=({flow:e,model:t,resources:n,views:r,canUpdate:i})=>{let a=r[t.name],s=e.head?.headers??[],c=e.head?.sample??[],l=A(e.mode,e.fields,e.columns),d=[{value:L,label:j(`doNotImport`)},...e.fields.map(e=>({value:e.name,label:`${T(a,e.name)}${p(e)?` *`:``}`}))],f=s.map((e,t)=>({value:String(t),label:N(s,t)})),m=y(t);return(0,P.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[i&&(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(`span`,{className:`font-medium`,children:j(`rows`)}),(0,P.jsx)(`div`,{children:(0,P.jsx)(o,{label:j(`whatEachRowDoes`),size:`md`,value:e.mode,options:F(),onChange:e.setMode})}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:j(I[e.mode])})]}),e.mode!==`create`&&(0,P.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,P.jsx)(w,{label:j(`findBy`),value:e.match?.field??L,options:[{value:L,label:j(`chooseField`)},...m.map(e=>({value:e.name,label:T(a,e.name)}))],onChange:t=>e.setMatch(t?{field:t,column:e.match?.column??0}:void 0),help:j(`findByHint`)}),(0,P.jsx)(w,{label:j(`foundInColumn`),value:e.match?String(e.match.column):L,options:[{value:L,label:j(`chooseColumn`)},...f],onChange:t=>e.setMatch(t&&e.match?{...e.match,column:Number(t)}:e.match)})]}),(0,P.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,P.jsx)(w,{label:j(`numbers`),value:e.options.decimal,options:[{value:`.`,label:`1,234.56`},{value:`,`,label:`1.234,56`}],onChange:t=>e.setOptions({...e.options,decimal:t})}),(0,P.jsx)(w,{label:j(`dates`),value:e.options.dateOrder,options:[{value:`dmy`,label:j(`dayFirst`)},{value:`mdy`,label:j(`monthFirst`)}],onChange:t=>e.setOptions({...e.options,dateOrder:t}),help:j(`datesHint`)})]}),e.mode!==`update`&&(0,P.jsx)(`p`,{className:`-mb-3 text-xs text-muted-foreground`,children:j(`requiredMarked`)}),(0,P.jsx)(`section`,{"aria-label":j(`columns`),className:`flex flex-col divide-y divide-border border-y`,children:s.map((i,o)=>{let l=e.columns.find(e=>e.column===o),u=l?t.fields[l.field]:void 0,f=u?v(u,n):void 0,p=c.map(e=>M(e.cells[o]??null)).filter(e=>e!==``).slice(0,3),m=N(s,o);return(0,P.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 py-3 sm:grid-cols-2 sm:gap-4`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`p`,{className:`truncate font-medium`,children:m}),(0,P.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:p.length>0?p.join(`, `):j(`emptyInFirstRows`)})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,P.jsx)(w,{label:j(`field`),name:j(`fieldFor`,{name:m}),value:l?.field??L,options:d,onChange:t=>e.mapColumn(o,t||void 0)}),f&&(0,P.jsx)(w,{label:j(`foundBy`),name:j(`pluralFoundBy`,{plural:r[f.name]?.names?.plural??T(a,u.name)}),value:l.matchBy??f.primaryKey[0],options:y(f).map(e=>({value:e.name,label:T(r[f.name],e.name)})),onChange:t=>e.matchColumnBy(o,t)})]})]},o)})}),l.length>0&&(0,P.jsxs)(`p`,{role:`alert`,className:`flex gap-2 rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-warning-text`,children:[(0,P.jsx)(u,{className:`mt-0.5 size-4 shrink-0`}),(0,P.jsx)(`span`,{children:j(`noColumnFills`,{fields:l.map(e=>T(a,e.name)).join(`, `)})})]})]})},z=e(t(),1),B=e=>{let t=i(e),n=new Intl.DateTimeFormat(e).formatToParts(new Date(2026,3,3)).map(e=>e.type);return{decimal:t,dateOrder:n.indexOf(`month`)<n.indexOf(`day`)?`mdy`:`dmy`}},V=e=>/\.json$/i.test(e.name)||e.type.split(`;`)[0].trim().toLowerCase()===`application/json`,H={created:0,updated:0,skipped:0,failed:0,notWritten:[]},U=({model:e,resources:t,views:n,sourceFor:r=O})=>{let i=c(),a=f(),o=n[e.name],[s,l]=(0,z.useState)({kind:`file`,reading:!1}),[u,d]=(0,z.useState)(),[p,m]=(0,z.useState)(),h=p?V(p.file):!1,v=(0,z.useMemo)(()=>S(e,t,{json:h}),[e,t,h]),[b,w]=(0,z.useState)(),[T,E]=(0,z.useState)(),[D,A]=(0,z.useState)(`create`),[j,M]=(0,z.useState)([]),[N,P]=(0,z.useState)(),[F,I]=(0,z.useState)(()=>B()),L=(0,z.useRef)(!1),R=(0,z.useRef)(void 0),U=e=>t=>{d(t),l(e)},W=n=>{d(void 0),l({kind:`file`,reading:!0});let i=r(n);i.sheets().then(r=>{if(m({file:n,source:i,sheets:r}),w(r[0]),r.length<=1)return G(i,r[0],S(e,t,{json:V(n)}));l({kind:`file`,reading:!1})}).catch(U({kind:`file`,reading:!1}))},G=async(t,n,r)=>{l({kind:`file`,reading:!0});let i=await k(t,n);E(i),M(_(i.headers,r,o));let a=y(e)[0],s=a?_(i.headers,[a],o)[0]:void 0;P(a&&s?{field:a.name,column:s.column}:void 0),l({kind:`map`})},K=()=>{p&&(d(void 0),G(p.source,b,v).catch(U({kind:`file`,reading:!1})))},q=(e,t)=>M(n=>{let r=n.filter(n=>n.column!==e&&n.field!==t);return t?[...r,{column:e,field:t}].sort((e,t)=>e.column-t.column):r}),J=(e,t)=>M(n=>n.map(n=>n.column===e?{...n,matchBy:t}:n)),Y=()=>({mode:D,columns:j,match:D===`create`?void 0:N,options:F}),X=()=>({model:e,resources:t,views:n,lookups:C(i)});return{step:s,error:u,file:p?.file,sheets:p?.sheets??[],sheet:b,setSheet:w,head:T,fields:v,mode:D,setMode:A,columns:j,mapColumn:q,matchColumnBy:J,match:N,setMatch:P,options:F,setOptions:I,choose:W,openSheet:K,check:()=>{if(!p)return;d(void 0);let e=new AbortController;R.current=e,l({kind:`checking`,rows:0}),x(p.source,b,Y(),X(),e=>l({kind:`checking`,rows:e}),e.signal).then(t=>{e.signal.aborted||l({kind:`checked`,check:t})}).catch(t=>{e.signal.aborted||U({kind:`map`})(t)})},back:()=>{R.current?.abort(),d(void 0),l({kind:`map`})},start:t=>{if(!p)return;d(void 0),L.current=!1,l({kind:`importing`,progress:H,total:t,cancelling:!1});let n=H;g(p.source,b,Y(),X(),{client:i(e.name),onProgress:e=>{n=e,l({kind:`importing`,progress:e,total:t,cancelling:L.current})},cancelled:()=>L.current}).then(e=>l({kind:`done`,result:e})).catch(e=>l({kind:`done`,result:{...n,cancelled:!1},stopped:e})).finally(()=>{for(let t of[`page`,`list`,`first-page`,`map`,`facets`,`series`,`aggregate`,`count`])a.invalidateQueries({queryKey:[t,e.name]})})},cancel:()=>{L.current=!0,l(e=>e.kind===`importing`?{...e,cancelling:!0}:e)},stop:()=>R.current?.abort()}},W=e=>e.step.kind===`file`?j(`couldNotReadFile`):j(`couldNotCheck`),G=e=>e.columns.length===0?!1:e.mode===`create`?A(`create`,e.fields,e.columns).length===0:e.match!==void 0,K=({model:e,resources:t,views:n,canUpdate:i,onClose:o,sourceFor:c})=>{let u=U({model:e,resources:t,views:n,sourceFor:c}),f=n[e.name]?.names?.plural??s(e.name),{step:p}=u,g=u.head?.headers??[],_=()=>{p.kind!==`importing`&&(u.stop(),o())},v=(0,P.jsx)(d,{onClick:_,children:j(`cancel`)});return(0,P.jsx)(a,{open:!0,wide:!0,title:j(`importPlural`,{plural:f}),description:u.file&&p.kind!==`file`?u.file.name:void 0,onClose:_,actions:(()=>{switch(p.kind){case`file`:return(0,P.jsxs)(P.Fragment,{children:[v,u.sheets.length>1&&(0,P.jsx)(d,{variant:`primary`,loading:p.reading,onClick:u.openSheet,children:j(`next`)})]});case`map`:return(0,P.jsxs)(P.Fragment,{children:[v,(0,P.jsx)(d,{variant:`primary`,disabled:!G(u),onClick:u.check,children:j(`checkRows`)})]});case`checking`:return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(d,{onClick:u.back,children:j(`back`)}),(0,P.jsx)(d,{variant:`primary`,loading:!0,children:j(`checking`)})]});case`checked`:{let e=p.check.creates+p.check.updates;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(d,{onClick:u.back,children:j(`back`)}),(0,P.jsx)(d,{variant:`primary`,disabled:e===0,onClick:()=>u.start(e),children:j(`importRows`,{count:e.toLocaleString(r()),rows:e})})]})}case`importing`:return(0,P.jsx)(d,{variant:`danger`,disabled:p.cancelling,onClick:u.cancel,children:j(`cancelImport`)});case`done`:return(0,P.jsx)(d,{variant:`primary`,onClick:o,children:j(`done`)})}})(),children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u.error!==void 0&&(0,P.jsx)(l,{title:W(u),error:u.error}),(()=>{switch(p.kind){case`file`:return(0,P.jsx)(m,{file:u.file,sheets:u.sheets,sheet:u.sheet,reading:p.reading,onChoose:u.choose,onSheet:u.setSheet});case`map`:return(0,P.jsx)(R,{flow:u,model:e,resources:t,views:n,canUpdate:i});case`checking`:return(0,P.jsx)(h,{rows:p.rows});case`checked`:return(0,P.jsx)(D,{check:p.check,model:e,resources:t,views:n,columns:u.columns,headers:g,fileName:u.file?.name});case`importing`:return(0,P.jsx)(E,{progress:p.progress,total:p.total,cancelling:p.cancelling});case`done`:return(0,P.jsx)(b,{result:p.result,stopped:p.stopped,headers:g,fileName:u.file?.name})}})()]})})};export{K as ImportDialog};
2
+ //# debugId=d61aab02-dbeb-4d58-93f0-0ecebf3a622e
@@ -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{Do as r,Lr as i,R as a,Rr as o,Ui as s,Yc as c,cc as l,ds as u,mr as d,pc as f,sc as p}from"./app-Bu6FwwHZ.js";import{h as m}from"./vendor-t7Q7QbPu.js";import{a as h,c as g,d as _,i as v,n as y,o as b,p as x,r as S,t as C}from"./sheet-source-BYMMaydU.js";import{a as ee,c as w,d as T,h as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./list-page-CXrB1As-.js";var N=e=>e===null||typeof e==`string`&&e.trim()===``,P=/^-?(0|[1-9]\d*)$/,F=/^-?(0|[1-9]\d*)\.\d+$/,I=/^(\d{4})-(\d{2})-(\d{2})$/,L=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,6})?)?(Z|[+-]\d{2}:\d{2})?$/,R=e=>{let t=I.exec(e);if(!t)return!1;let[n,r,i]=[Number(t[1]),Number(t[2]),Number(t[3])],a=new Date(Date.UTC(n,r-1,i));return a.getUTCFullYear()===n&&a.getUTCMonth()===r-1&&a.getUTCDate()===i},z=e=>{if(P.test(e))return`whole`;if(F.test(e))return`decimal`;if(/^(true|false)$/i.test(e))return`boolean`;if(R(e))return`date`;let t=L.exec(e);return!t?.[1]||!R(t[1])||Number(t[2])>23||Number(t[3])>59||Number(t[4]??0)>59?`text`:t[5]?`zoned`:`local`},B=e=>typeof e==`boolean`?`boolean`:typeof e==`number`?Number.isInteger(e)?`whole`:`decimal`:typeof e==`string`?z(e.trim()):`json`in e?`json`:e.date.includes(`T`)?`local`:`date`,V=e=>typeof e==`number`?e.toLocaleString(`en-US`,{useGrouping:!1,maximumFractionDigits:100}):e.trim(),H=1e3,te=2147483647n,ne={boolean:`boolean`,date:`date`,local:`timestamp`,zoned:`timestamp`,json:`json`},re=()=>{let e=new Set,t=1,n=0,r=!1,i=0,a=a=>{if(a===null||N(a))return;typeof a==`string`&&(i=Math.max(i,a.length));let o=B(a);if(e.add(o),o!==`whole`&&o!==`decimal`)return;let[s=``,c=``]=V(a).replace(`-`,``).split(`.`);if(t=Math.max(t,s.length),n=Math.max(n,c.length),o===`whole`&&!r){let e=BigInt(V(a));r=(e<0n?-e-1n:e)>te}},o=()=>{let e=Math.min(H,Math.max(t,15)+n);return{type:`decimal`,precision:e,scale:Math.min(n,e)}};return{add:a,type:()=>{if(e.has(`json`))return{type:`json`};let t=e.size===1?[...e][0]:void 0;return t===`whole`?r?o():{type:`integer`}:e.size===2&&e.has(`whole`)&&e.has(`decimal`)||t===`decimal`?o():t&&t!==`text`?{type:ne[t]}:{type:i>500?`long_text`:`text`}},decimal:o}},ie=e=>{switch(e){case`integer`:return[`integer`,`decimal`,`text`,`long_text`];case`decimal`:case`boolean`:case`date`:case`timestamp`:return[e,`text`,`long_text`];case`text`:return[`text`,`long_text`];case`long_text`:case`json`:return[e]}},U=(e,t)=>{let n=e[t],r=e[O];return{table:e=>({label:x(n,e),help:n?.fields[e]?.help}),field:e=>({label:x(r,e),help:r?.fields[e]?.help}),type:e=>r?.fields.type?.valueLabels?.[e]??e}},W=(e,t,n)=>e===`form`?T(`nameForm`,{max:n}):T(e===`reserved_word`?`nameReservedWord`:`nameReservedField`,{name:t}),G=e=>{if(e.trim()===``)return T(`needed`);if(e.trim().length>200)return T(`labelTooLong`,{max:200})},K=(e,t,n)=>{let r=E(e.name,`table`,n),i={name:r?W(r,e.name,n):t.has(e.name)?T(`nameTaken`,{name:e.name}):void 0,pluralLabel:G(e.pluralLabel),singularLabel:G(e.singularLabel),fields:{}},a=D(e);a.length===0&&(i.noFields=T(`noFields`));let o=new Set;for(let e of a){let t=E(e.name,`field`),n=t?W(t,e.name,63):o.has(e.name)?T(`nameTwice`,{name:e.name}):void 0;o.add(e.name);let r=G(e.label);(n||r)&&(i.fields[e.column]={...n&&{name:n},...r&&{label:r}})}return i},q=e=>!!(e.name||e.pluralLabel||e.singularLabel||e.noFields||Object.keys(e.fields).length>0),J=e(n(),1),Y=``,ae=({field:e,column:t,examples:n,problems:i,texts:o,onChange:s})=>{let c=o.field(`type`),l=o.field(`label`),u=o.field(`name`),d=ie(e.inferred.type).map(e=>({value:e,label:o.type(e)})),f=e.include&&e.type===`decimal`;return(0,J.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 py-3 sm:grid-cols-2 sm:gap-4`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`truncate font-medium`,children:t}),(0,J.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:n.length>0?n.join(`, `):T(`emptyInFirstRows`)})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,J.jsx)(b,{label:c.label,name:T(`typeFor`,{name:t}),value:e.include?e.type:Y,options:[...d,{value:Y,label:T(`doNotImport`)}],onChange:e=>s(e===Y?{include:!1}:{include:!0,type:e}),help:f?T(`decimalSize`,{precision:e.decimal.precision,scale:e.decimal.scale}):void 0}),e.include&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(a,{label:l.label,error:i?.label,required:!0,children:(0,J.jsx)(r,{wrapperClassName:`max-sm:min-h-11`,"aria-label":T(`labelFor`,{name:t}),value:e.label,onChange:e=>s({label:e.target.value})})}),(0,J.jsx)(a,{label:u.label,error:i?.name,required:!0,children:(0,J.jsx)(r,{wrapperClassName:`max-sm:min-h-11`,className:`font-mono`,"aria-label":T(`nameFor`,{name:t}),autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1,value:e.name,onChange:e=>s({name:e.target.value})})})]})]})]})},X=``,Z=({proposal:e,problems:t,texts:n,onChange:i})=>{let o=D(e).filter(e=>e.type===`text`),s=n.table(`plural_label`),c=n.table(`singular_label`),l=n.table(`name`),u=n.table(`title_field`);return(0,J.jsxs)(`section`,{"aria-label":T(`newTable`),className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,J.jsx)(a,{label:s.label,help:s.help,error:t.pluralLabel,required:!0,children:(0,J.jsx)(r,{wrapperClassName:`max-sm:min-h-11`,value:e.pluralLabel,onChange:e=>i({pluralLabel:e.target.value})})}),(0,J.jsx)(a,{label:c.label,help:c.help,error:t.singularLabel,required:!0,children:(0,J.jsx)(r,{wrapperClassName:`max-sm:min-h-11`,value:e.singularLabel,onChange:e=>i({singularLabel:e.target.value})})}),(0,J.jsx)(a,{label:l.label,help:l.help,error:t.name,required:!0,children:(0,J.jsx)(r,{wrapperClassName:`max-sm:min-h-11`,className:`font-mono`,autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1,value:e.name,onChange:e=>i({name:e.target.value})})}),(0,J.jsx)(b,{label:u.label,value:e.titleField??X,options:[{value:X,label:T(`noTitle`)},...o.map(e=>({value:e.name,label:e.label||e.name}))],onChange:e=>i({titleField:e||void 0}),help:u.help})]})},oe=({flow:e,problems:t,texts:n})=>{let{proposal:r,read:i}=e;return!r||!i?null:(0,J.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,J.jsx)(Z,{proposal:r,problems:t,texts:n,onChange:e.changeTable}),(0,J.jsx)(`p`,{className:`-mb-3 text-xs text-muted-foreground`,children:T(`typesFromCells`,{rows:i.rows})}),(0,J.jsx)(`section`,{"aria-label":T(`columns`),className:`flex flex-col divide-y divide-border border-y`,children:r.fields.map(r=>(0,J.jsx)(ae,{field:r,column:j(i.headers,r.column),examples:i.sample.map(e=>k(e.cells[r.column]??null)).filter(e=>e!==``).slice(0,3),problems:t.fields[r.column],texts:n,onChange:t=>e.change(r.column,t)},r.column))}),t.noFields&&(0,J.jsxs)(`p`,{role:`alert`,className:`flex gap-2 rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-warning-text`,children:[(0,J.jsx)(f,{className:`mt-0.5 size-4 shrink-0`}),(0,J.jsx)(`span`,{children:t.noFields})]})]})},Q=e(t(),1),se=5,ce=async(e,t,n,r)=>{let i,a=[],o=[],s=0;for await(let c of e.rows(t)){r?.throwIfAborted();for(let e of c){if(!i){i=e.cells.map(k),a=i.map(()=>re());continue}e.cells.every(w)||(s++,o.length<se&&o.push(e),a.forEach((t,n)=>t.add(e.cells[n]??null)))}n(s)}return{headers:i??[],types:a.map(e=>e.type()),decimals:a.map(e=>e.decimal()),sample:o,rows:s}},$={created:0,updated:0,skipped:0,failed:0,notWritten:[]},le={decimal:`.`,dateOrder:`dmy`,booleanText:!0},ue=({tables:e,resources:t,sourceFor:n=C})=>{let r=u(),i=m(),{go:a}=o(),s=e.tenant!==void 0,l=s?42:63,d=(0,Q.useMemo)(()=>new Set(s?[]:Object.keys(t)),[s,t]),[f,p]=(0,Q.useState)({kind:`file`,reading:!1}),[h,g]=(0,Q.useState)(),[v,b]=(0,Q.useState)(),[x,S]=(0,Q.useState)(),[w,T]=(0,Q.useState)(),[E,O]=(0,Q.useState)(),[k,j]=(0,Q.useState)(),N=(0,Q.useRef)(!1),P=(0,Q.useRef)(void 0),F=e=>t=>{g(t),p(e)},I=(e,t,n)=>{let r=new AbortController;P.current=r,p({kind:`reading`,rows:0}),ce(t,n,e=>p({kind:`reading`,rows:e}),r.signal).then(t=>{r.signal.aborted||(T(t),O(ee(e.name,t,d,l)),p({kind:`fields`}))}).catch(e=>{r.signal.aborted||F({kind:`file`,reading:!1})(e)})},L=e=>{g(void 0),p({kind:`file`,reading:!0});let t=n(e);t.sheets().then(n=>{if(b({file:e,source:t,sheets:n}),S(n[0]),n.length<=1)return I(e,t,n[0]);p({kind:`file`,reading:!1})}).catch(F({kind:`file`,reading:!1}))},R=()=>{v&&(g(void 0),I(v.file,v.source,x))},z=(e,t)=>O(n=>n&&A(n,e,t)),B=e=>O(t=>t&&{...t,...e}),V=async e=>{await i.refetchQueries({queryKey:c.meta});let t=i.getQueryData(c.meta),n=t?.resources[e];if(!t||!n)throw Error(`The server does not serve the new table ${e} yet`);return{model:n,resources:t.resources,views:t.views}},H=async(e,t)=>{if(!v||!w)return;let n={...await V(e),lookups:y(r)},i={mode:`create`,columns:D(t).map(e=>({column:e.column,field:e.name})),options:le};N.current=!1;let o=$;p({kind:`importing`,progress:$,total:w.rows,cancelling:!1});let s=await _(v.source,x,i,n,{client:r(e),onProgress:e=>{o=e,p({kind:`importing`,progress:e,total:w.rows,cancelling:N.current})},cancelled:()=>N.current}).catch(e=>({...o,cancelled:!1,stopped:e})),c=`stopped`in s?s.stopped:void 0;if(c===void 0&&!s.cancelled&&s.notWritten.length===0)return a({kind:`list`,resource:e});p({kind:`done`,result:s,stopped:c})};return{step:f,error:h,file:v?.file,sheets:v?.sheets??[],sheet:x,setSheet:S,read:w,proposal:E,table:k,taken:d,maxTableBytes:l,choose:L,openSheet:R,change:z,changeTable:B,create:()=>{E&&(g(void 0),p({kind:`creating`}),r(e.name).batchWrite(M(e.name,E)).then(({results:e})=>{let[t]=e,n=t?.op===`create`?String(t.record.table_name):E.name;return j(n),H(n,E).catch(e=>p({kind:`done`,result:{...$,cancelled:!1},stopped:e}))},F({kind:`fields`})))},cancel:()=>{N.current=!0,p(e=>e.kind===`importing`?{...e,cancelling:!0}:e)},back:()=>{P.current?.abort(),g(void 0),p({kind:`file`,reading:!1})},stop:()=>P.current?.abort()}},de=e=>e.step.kind===`fields`?T(`couldNotMakeTable`):T(`couldNotReadFile`),fe=({tables:e,resources:t,views:n,onClose:r,sourceFor:a})=>{let o=ue({tables:e,resources:t,sourceFor:a}),c=U(n,e.name),{step:u,proposal:f}=o,m=f?K(f,o.taken,o.maxTableBytes):void 0,_=o.read?.headers??[],y=u.kind===`creating`||u.kind===`importing`,b=()=>{y||(o.stop(),r())},x=(0,J.jsx)(p,{onClick:b,children:T(`cancel`)});return(0,J.jsx)(s,{open:!0,wide:!0,title:T(`tableFromFile`),description:o.file&&u.kind!==`file`?o.file.name:void 0,onClose:b,actions:(()=>{switch(u.kind){case`file`:return(0,J.jsxs)(J.Fragment,{children:[x,o.sheets.length>1&&(0,J.jsx)(p,{variant:`primary`,loading:u.reading,onClick:o.openSheet,children:T(`next`)})]});case`reading`:return(0,J.jsx)(p,{onClick:o.back,children:T(`back`)});case`fields`:case`creating`:{let e=o.read?.rows??0;return(0,J.jsxs)(J.Fragment,{children:[x,(0,J.jsx)(p,{variant:`primary`,loading:u.kind===`creating`,disabled:!m||q(m),onClick:o.create,children:T(`makeTable`,{rows:e})})]})}case`importing`:return(0,J.jsx)(p,{variant:`danger`,disabled:u.cancelling,onClick:o.cancel,children:T(`cancelImport`)});case`done`:return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(p,{onClick:r,children:T(`done`)}),o.table&&(0,J.jsx)(i,{to:{kind:`list`,resource:o.table},className:l({variant:`primary`}),children:T(`openTable`)})]})}})(),children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[o.error!==void 0&&(0,J.jsx)(d,{title:de(o),error:o.error}),(()=>{switch(u.kind){case`file`:return(0,J.jsx)(h,{file:o.file,sheets:o.sheets,sheet:o.sheet,reading:u.reading,onChoose:o.choose,onSheet:o.setSheet});case`reading`:return(0,J.jsx)(g,{rows:u.rows});case`fields`:case`creating`:return m&&(0,J.jsx)(oe,{flow:o,problems:m,texts:c});case`importing`:return(0,J.jsx)(S,{progress:u.progress,total:u.total,cancelling:u.cancelling});case`done`:return(0,J.jsx)(v,{result:u.result,stopped:u.stopped,headers:_,fileName:o.file?.name})}})()]})})};export{fe as ImportTableDialog};
2
+ //# debugId=4d7b4799-a062-430e-adf6-05ef46abef57
@@ -1 +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"./app-B48LQpC1.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();
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"./app-Bu6FwwHZ.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();
@@ -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{$a as r,Jo as i,Oa as a,Ya as o,Za as s,eo as c,ys as l}from"./app-Bu6FwwHZ.js";import{t as u}from"./page-header-Ddz2r5ic.js";import{n as d,t as f}from"./pending-invitation-row-Bcf8ttkD.js";import{n as p}from"./person-row-4RzpLZJE.js";import{assignableOrganizationRoles as m}from"./members-page-Da7ADmBH.js";var h=e(t(),1),g=e(n(),1),_=({current:e,onSent:t})=>{let{session:n,organizations:r}=l(),i=a(),u=r?.roles??[],[f,_]=(0,h.useState)(`member`),[v,y]=(0,h.useState)([]);return(0,g.jsx)(d,{title:c(`inviteSomeone`),description:c(`inviteDescription`),onInvite:async r=>{let i=await n.organizations.invite(e.organization.id,{email:r,role:f,appRoles:v});return y([]),t(),i},beside:(0,g.jsx)(`select`,{"aria-label":i(`organizationRole`),value:f,onChange:e=>_(e.target.value),className:`h-8 rounded-md border border-border-strong bg-background px-2`,children:m(e).map(e=>(0,g.jsx)(`option`,{value:e,children:s(e)},e))}),children:(0,g.jsx)(p,{roles:u.filter(e=>e.membership),selected:v,grantable:o(u,e),onChange:y})})},v=({invitation:e,organizationId:t,onChanged:n})=>{let{session:i,organizations:a}=l(),o=e.appRoles.map(e=>r(a?.roles??[],e));return(0,g.jsx)(f,{email:e.email,gives:`${s(e.role)}${o.length>0?` · ${o.join(`, `)}`:``}`,expiresAt:e.expiresAt,onResend:async()=>{let r=await i.organizations.resend(t,e);return n(),r},onRevoke:async()=>{await i.organizations.revoke(e.id),n()}})},y=({current:e})=>{let{session:t}=l(),[n,r]=(0,h.useState)([]),a=e?.organization?.id,o=(0,h.useCallback)(()=>{a&&t.organizations.invitations(a).then(e=>r(e.filter(e=>e.status===`pending`)),()=>r([]))},[t,a]);return(0,h.useEffect)(o,[o]),!e?.organization||!a?null:(0,g.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6`,children:[(0,g.jsx)(u,{title:c(`invitations`),subtitle:c(`peopleInvited`,{organization:e.organization.name})}),(0,g.jsx)(_,{current:e,onSent:o}),(0,g.jsx)(i,{title:c(`notAcceptedYet`),description:n.length>0?c(`sendingAgain`):c(`nobodyWaiting`),children:n.length>0&&(0,g.jsx)(`ul`,{className:`divide-y rounded-md border`,children:n.map(e=>(0,g.jsx)(v,{invitation:e,organizationId:a,onChanged:o},e.id))})})]})};export{y as InvitationsPage};
2
+ //# debugId=00983c09-c3e0-4aa3-b75d-dd6b43051bf4
@@ -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{Nc as e}from"./app-B48LQpC1.js";var t={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};t.node;var n=e(t);export{n as t};
2
- //# debugId=174d9c12-15b5-48bc-812b-ee86b1ad7966
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{Vc as e}from"./app-Bu6FwwHZ.js";var t={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};t.node;var n=e(t);export{n as t};
2
+ //# debugId=b14e5fdd-babe-404e-8b21-1e051003da6a
@@ -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{t}from"./react-CuiNlnus.js";import{Lr as n}from"./app-B48LQpC1.js";import{mt as r}from"./embedded-list-CdFZ5TIe.js";var i=e(t(),1),a=`flex items-center gap-2 rounded-md px-1 py-0.5`,o=({resource:e,view:t,filter:o,color:s,label:c,children:l})=>{let u=(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`span`,{className:`size-2.5 shrink-0 rounded-full`,style:{background:s},"aria-hidden":!0}),(0,i.jsx)(`span`,{className:`min-w-0 flex-1 truncate group-hover:text-primary-text`,children:c}),l]});return(0,i.jsx)(`li`,{children:o===void 0?(0,i.jsx)(`div`,{className:a,children:u}):(0,i.jsx)(n,{to:r(t,e,o),className:`group ${a} hover:bg-muted`,children:u})})};export{o as t};
2
- //# debugId=01a1e23a-6f96-4a94-befb-3702d53b2851
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{t}from"./react-CuiNlnus.js";import{Lr as n}from"./app-Bu6FwwHZ.js";import{mt as r}from"./embedded-list-DJUmoyQF.js";var i=e(t(),1),a=`flex items-center gap-2 rounded-md px-1 py-0.5`,o=({resource:e,view:t,filter:o,color:s,label:c,children:l})=>{let u=(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`span`,{className:`size-2.5 shrink-0 rounded-full`,style:{background:s},"aria-hidden":!0}),(0,i.jsx)(`span`,{className:`min-w-0 flex-1 truncate group-hover:text-primary-text`,children:c}),l]});return(0,i.jsx)(`li`,{children:o===void 0?(0,i.jsx)(`div`,{className:a,children:u}):(0,i.jsx)(n,{to:r(t,e,o),className:`group ${a} hover:bg-muted`,children:u})})};export{o as t};
2
+ //# debugId=d75c14bf-8708-484f-bc9f-f72b7173e04e
@@ -0,0 +1,4 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/import-dialog-DWGqsC2-.js","assets/rolldown-runtime-DFwUHQ4A.js","assets/react-CuiNlnus.js","assets/app-Bu6FwwHZ.js","assets/vendor-t7Q7QbPu.js","assets/app-xwgcmboV.css","assets/sheet-source-BYMMaydU.js","assets/import-table-dialog-BNe0eZoG.js","assets/export-dialog-DB5gIvOy.js","assets/embedded-list-DJUmoyQF.js","assets/update-set-BmW6qYcW.js","assets/layout-grid-CxTl_dur.js","assets/lib-tanstack-react-table-uAPG3Sdi.js","assets/lib-tanstack-store-KbP08Dw1.js","assets/lib-tanstack-react-store-BKI8EKbh.js","assets/lib-use-sync-external-store-D4s7MiFL.js","assets/lib-tanstack-table-core-2MHQ7o_e.js","assets/record-preview-Dcgb16a2.js","assets/lib-dnd-kit-core-xi-7xL_N.js","assets/lib-dnd-kit-utilities-Bvr0fWXF.js","assets/lib-dnd-kit-accessibility-AUTLnqh4.js","assets/lib-dnd-kit-sortable-CNDSKqCD.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{$s as r,Bo as i,C as a,Ca as o,Co as s,Do as c,Ea as l,Eo as u,Fc as d,Fi as f,Ft as p,Gn as m,Hc as h,Ic as g,Jn as _,Kl as v,Kr as y,Ks as b,Li as x,Lo as S,Lr as C,M as w,Mr as T,Nn as E,O as ee,Oc as te,Pa as D,Qc as ne,Ql as re,Qr as ie,Rc as ae,Ri as oe,Rr as se,S as ce,Sa as le,T as O,Ti as k,Tn as ue,Ui as de,Vc as A,Vr as j,Wl as M,Wn as N,Xc as fe,Xl as pe,Yc as P,Zr as me,_a as he,b as ge,bo as _e,ca as ve,cc as ye,cl as F,dc as be,fc as xe,fl as Se,hc as Ce,ic as I,il as we,ja as Te,ji as L,jr as Ee,k as De,kn as Oe,kt as R,ls as z,lt as ke,mi as Ae,mr as je,ns as Me,ol as Ne,qn as B,ri as Pe,rl as Fe,rs as Ie,sc as V,si as Le,sl as H,tc as U,to as Re,ts as ze,ui as Be,un as Ve,va as He,vl as Ue,vn as We,wa as W,wo as Ge,xa as Ke,ya as qe,yc as Je,yo as Ye,ys as Xe,zo as Ze}from"./app-Bu6FwwHZ.js";import{C as Qe,f as $e,h as et,i as G,o as tt,s as K}from"./vendor-t7Q7QbPu.js";import{n as nt}from"./view-chart-ChBtewKd.js";import{$ as rt,A as it,B as at,D as ot,E as st,F as ct,G as lt,H as ut,I as dt,J as q,K as ft,L as pt,M as mt,N as ht,O as gt,P as _t,Q as vt,R as yt,T as bt,U as xt,V as St,W as Ct,X as wt,Y as Tt,Z as J,b as Et,d as Dt,et as Ot,f as kt,ft as At,h as jt,i as Mt,j as Nt,k as Pt,m as Ft,n as It,p as Lt,pt as Rt,q as zt,u as Bt,v as Vt,w as Ht,x as Ut,xt as Y,y as Wt,z as Gt}from"./embedded-list-DJUmoyQF.js";import{a as Kt,i as qt,n as Jt,r as Yt,t as Xt}from"./reorder-button-DaTBmXBl.js";import{t as Zt}from"./trash-CM78fU0k.js";import{t as Qt}from"./page-header-Ddz2r5ic.js";import{i as $t,r as en,t as tn}from"./record-preview-Dcgb16a2.js";import{c as nn,l as rn}from"./messages-ZaTNJ5q-.js";import{t as an}from"./use-display-rows-DAUXr6DH.js";var on=new Set(`all.analyse.analyze.and.any.array.as.asc.asymmetric.both.case.cast.check.collate.column.constraint.create.current_catalog.current_date.current_role.current_time.current_timestamp.current_user.default.deferrable.desc.distinct.do.else.end.except.false.fetch.for.foreign.from.grant.group.having.in.initially.intersect.into.lateral.leading.limit.localtime.localtimestamp.not.null.offset.on.only.or.order.placing.primary.references.returning.select.session_user.some.symmetric.system_user.table.then.to.trailing.true.union.unique.user.using.variadic.when.where.window.with`.split(`.`)),sn=/^[a-z][a-z0-9_]*$/,cn=[`id`,`etag`,`organization_id`],ln=e=>sn.test(e)&&new TextEncoder().encode(e).length<=63,un=(e,t,n=63)=>{if(typeof e!=`string`||!ln(e)||new TextEncoder().encode(e).length>n)return`form`;if(on.has(e))return`reserved_word`;if(t===`field`&&cn.includes(e))return`reserved_field`},dn={name:`bookmark-check`,size:24,node:[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}],[`path`,{d:`m9 10 2 2 4-4`,key:`1gnqz4`}]]};dn.node;var fn=A(dn),pn={name:`bookmark-plus`,size:24,node:[[`path`,{d:`M12 7v6`,key:`lw1j43`}],[`path`,{d:`M15 10H9`,key:`o6yqo3`}],[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]};pn.node;var mn=A(pn),hn={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};hn.node;var gn=A(hn),_n={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};_n.node;var vn=A(_n),yn={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};yn.node;var bn=A(yn),xn=e=>e.normalize(`NFKD`).replace(/[̀-ͯ]/g,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``),Sn=(e,t,n)=>(/^[a-z]/.test(e)?e:`${t}_${e}`).slice(0,n).replace(/_+$/,``),Cn=(e,t,n)=>{let r=e;for(let i=2;t.has(r)||on.has(r);i++){let t=`_${i}`;r=`${e.slice(0,n-t.length).replace(/_+$/,``)}${t}`}return r},wn=e=>e<26?String.fromCharCode(97+e):wn(Math.floor(e/26)-1)+wn(e%26),Tn=e=>{let t=new Set(cn);return e.map((e,n)=>{let r=xn(e),i=Cn(r===``?`column_${wn(n)}`:Sn(r,`column`,63),t,63);return t.add(i),i})},En=(e,t=[],n=63)=>{let r=xn(e.replace(/\.(csv|tsv|txt|xlsx|json)$/i,``));if(r!==``)return Cn(Sn(r,`table`,n),new Set(t),n)},X=e(n(),1),Dn=`inline-flex h-6 items-center gap-1 rounded-full border border-primary-border bg-primary-soft pl-2.5 pr-1.5 text-xs font-medium text-primary-text`,On=({chips:e,lockedLabels:t=[],onRemove:n,onClear:r,scroll:i})=>e.length===0&&t.length===0?null:(0,X.jsxs)(`div`,{className:i?`flex flex-nowrap items-center gap-1.5 overflow-x-auto pb-1 [&>*]:shrink-0`:`flex flex-wrap items-center gap-1.5`,children:[t.map(e=>(0,X.jsxs)(`span`,{className:`inline-flex h-6 items-center gap-1.5 rounded-full border border-border-strong bg-muted px-2.5 text-xs font-medium text-foreground`,children:[(0,X.jsx)(gn,{className:`size-3 text-muted-foreground`}),e]},e)),e.map(e=>(0,X.jsxs)(`span`,{className:Dn,children:[e.label,(0,X.jsx)(`button`,{type:`button`,"aria-label":q(`remove`,{label:e.label}),onClick:()=>n(e.key),className:`rounded-full p-0.5 hover:bg-primary-border/60`,children:(0,X.jsx)(be,{className:`size-3`})})]},e.key)),e.length>0&&(0,X.jsx)(`button`,{type:`button`,onClick:r,className:`ml-1 text-xs font-medium text-muted-foreground hover:text-foreground`,children:q(`clearAll`)})]}),kn=({value:e,presets:t=zt,onChange:n})=>(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(t=>{let r=ft(t);return(0,X.jsx)(`button`,{type:`button`,disabled:!r,title:r?void 0:q(`unknownPreset`,{id:t}),onClick:()=>n(e===t?void 0:t),className:h(`h-7 rounded-md border px-2.5 text-body font-medium transition-colors`,!r&&`border-dashed text-danger-text`,e===t?`border-primary-border bg-primary-soft text-primary-text`:`border-border-strong bg-background text-muted-foreground hover:bg-muted`),children:r??q(`unsupported`,{id:t})},t)})}),An=(e,t)=>e.onSearch?e.options:e.options.filter(e=>St(e.label,t)),jn=(e,t,n)=>t===0?-1:n===`ArrowDown`?e<0?0:(e+1)%t:e<0?t-1:(e-1+t)%t,Z=e(t(),1),Mn=({config:e,selected:t,onToggle:n,inline:r=!1})=>{let i=(0,Z.useId)(),a=(0,Z.useRef)(null),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(-1),f=r||c,p=An(e,o),m=(0,Z.useRef)(e.onSearch);m.current=e.onSearch,(0,Z.useEffect)(()=>()=>m.current?.(``),[]);let _=t=>{s(t),d(-1),e.onSearch?.(t)};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`div`,{className:`flex min-h-8 cursor-text flex-wrap items-center gap-1 rounded-md border border-border-strong bg-background px-2 py-1 shadow-sm focus-within:border-primary focus-within:ring-2 focus-within:ring-primary/20`,onClick:()=>a.current?.focus(),children:[(0,X.jsx)(Ce,{className:`size-3.5 shrink-0 text-muted-foreground`}),t.map(t=>(0,X.jsx)(E,{label:at(e,t),onRemove:()=>n(t)},t)),(0,X.jsx)(`input`,{ref:a,autoFocus:r,role:`combobox`,"aria-label":e.label,"aria-expanded":f,"aria-controls":`${i}-options`,"aria-autocomplete":`list`,"aria-activedescendant":p[u]?`${i}-${u}`:void 0,placeholder:t.length>0?``:q(`searchIn`,{label:e.label}),className:`h-6 min-w-16 flex-1 bg-transparent text-foreground outline-none placeholder:text-faint-foreground`,value:o,onChange:e=>_(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),d(jn(u,p.length,e.key));return}if(e.key===`Enter`&&p[u]){e.preventDefault(),n(p[u].value);return}if(e.key===`Backspace`&&o===``&&t.length>0){n(t[t.length-1]);return}e.key===`Escape`&&o!==``&&(e.stopPropagation(),_(``))},onFocus:()=>l(!0),onBlur:()=>{l(!1),d(-1),!r&&o!==``&&_(``)}})]}),f&&(0,X.jsxs)(`ul`,{id:`${i}-options`,role:`listbox`,"aria-label":e.label,"aria-multiselectable":!0,className:h(`flex max-h-60 flex-col gap-px overflow-y-auto`,!r&&`rounded-md border bg-background p-1 shadow-sm`),children:[p.map((e,r)=>{let a=t.includes(e.value);return(0,X.jsxs)(`li`,{id:`${i}-${r}`,role:`option`,"aria-selected":a,tabIndex:-1,className:h(`flex cursor-pointer items-center gap-2 rounded px-1.5 py-1 hover:bg-muted`,r===u&&`bg-muted`),onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.value),children:[(0,X.jsx)(`span`,{className:h(`inline-flex size-4 shrink-0 items-center justify-center rounded border`,a?`border-primary bg-primary text-primary-foreground`:`border-border-strong bg-background`),children:a&&(0,X.jsx)(g,{className:`size-3`,strokeWidth:3})}),(0,X.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.count!==void 0&&(0,X.jsx)(`span`,{className:`text-xs tabular-nums text-faint-foreground`,children:L(e.count)})]},e.value)}),e.failed&&(0,X.jsx)(`li`,{className:`px-1.5 py-1 text-xs text-danger-text`,children:q(`couldNotLoadCounts`)}),!e.failed&&p.length===0&&(0,X.jsx)(`li`,{className:`px-1.5 py-1 text-xs text-faint-foreground`,children:q(`noMatches`)})]})]})},Nn=({config:e,selected:t,onToggle:n})=>{let[r,i]=(0,Z.useState)(``),a=e.options.filter(e=>St(e.label,r));return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.searchable&&(0,X.jsx)(c,{wrapperClassName:`mb-1 h-7`,leading:(0,X.jsx)(Ce,{className:`size-3.5`}),placeholder:q(`searchIn`,{label:e.label}),value:r,onChange:e=>i(e.target.value)}),a.map(e=>(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-1 py-1 hover:bg-muted`,children:[(0,X.jsx)(Re,{checked:t.includes(e.value),onChange:()=>n(e.value),label:e.label}),(0,X.jsx)(`span`,{className:`flex-1 truncate`,children:e.label}),e.count!==void 0&&(0,X.jsx)(`span`,{className:`text-xs tabular-nums text-faint-foreground`,children:L(e.count)})]},e.value)),e.failed&&(0,X.jsx)(`span`,{className:`px-1 py-1 text-xs text-danger-text`,children:q(`couldNotLoadCounts`)}),!e.failed&&a.length===0&&(0,X.jsx)(`span`,{className:`px-1 py-1 text-xs text-faint-foreground`,children:q(`noMatches`)})]})},Pn=({label:e,activeCount:t,width:n=240,defaultOpen:r=!1,children:i})=>{let[a,o]=(0,Z.useState)(r),[c,l]=(0,Z.useState)({width:n}),f=(0,Z.useRef)(null),p=(0,Z.useRef)(null);(0,Z.useLayoutEffect)(()=>{if(!a||!f.current)return;let e=f.current.getBoundingClientRect(),t=document.documentElement.clientWidth,r=Math.min(n,s(t));l({width:r,right:e.left+r>t?e.right-Ge(e.right,r,t):void 0})},[a,n]);let m=u(a,f,p,c);return(0,Z.useEffect)(()=>{if(!a)return;let e=e=>{e.target instanceof Node&&!f.current?.contains(e.target)&&o(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[a]),(0,X.jsxs)(`div`,{ref:f,className:`relative`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":a,onClick:()=>o(!a),className:h(`inline-flex h-8 items-center gap-1.5 rounded-md border bg-background px-2.5 font-medium shadow-sm transition-colors hover:bg-muted`,t>0?`border-primary-border text-primary-text`:`border-border-strong text-foreground`),children:[e,t>0&&(0,X.jsx)(`span`,{className:`rounded-full bg-primary px-1.5 text-[0.6875rem] leading-4 text-primary-foreground`,children:t}),(0,X.jsx)(d,{className:`size-3.5 text-muted-foreground`})]}),a&&(0,X.jsx)(`div`,{ref:p,className:h(`absolute top-full z-30 mt-1.5 rounded-lg border bg-background p-3 shadow-pop`,c.right===void 0&&`left-0`),style:{...c,...m},children:typeof i==`function`?i(()=>o(!1)):i})]})},Fn=({title:e,children:t})=>(0,X.jsxs)(`section`,{className:`flex flex-col gap-2 border-b py-3 last:border-b-0`,children:[(0,X.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e}),t]}),In=({items:e,onPick:t,close:n})=>{let r=(0,Z.useRef)([]);return(0,Z.useEffect)(()=>r.current[0]?.focus(),[]),(0,X.jsx)(`ul`,{role:`menu`,"aria-label":q(`moreFilters`),onKeyDown:t=>{if(t.key===`Escape`)return n();let i=R(t.key,r.current.indexOf(document.activeElement),e.length);i!==void 0&&(t.preventDefault(),r.current[i]?.focus())},className:`-mx-3 -my-3`,children:e.map((e,i)=>(0,X.jsx)(`li`,{role:`none`,children:(0,X.jsx)(`button`,{ref:e=>{r.current[i]=e},type:`button`,role:`menuitem`,className:ke,onClick:()=>{n(),t(e.key)},children:e.label})},e.key))})},Ln=({items:e,onPick:t})=>e.length===0?null:(0,X.jsx)(Pn,{label:q(`moreFilters`),activeCount:0,children:n=>(0,X.jsx)(In,{items:e,onPick:t,close:n})}),Rn=(e,t,n,r,i)=>{let a=n+(r-n)*e/t;return n+(r-n)*(e+1)/t>i[0]&&a<i[1]},zn=(e,t,n)=>n===t?0:(e-t)/(n-t),Bn=(e,t,n)=>t===0?[Math.min(n,e[1]),e[1]]:[e[0],Math.max(n,e[0])],Vn=1e3,Hn=({config:e,value:t,onChange:n})=>{let{min:r,max:i,step:a,histogram:o,format:s}=e,[c,l]=(0,Z.useState)(),u=c??t??[r,i],d=Math.max(...o),f=()=>{c&&(l(void 0),n(c[0]===r&&c[1]===i?void 0:c))},p=x(c,Vn);return(0,Z.useEffect)(()=>{p&&f()},[p]),e.failed?(0,X.jsx)(`p`,{className:`text-xs text-danger-text`,children:q(`couldNotLoadCounts`)}):(0,X.jsxs)(`div`,{className:`w-full`,children:[(0,X.jsxs)(`div`,{className:`px-[7px]`,children:[o.length>0&&(0,X.jsx)(`div`,{className:`mb-1 flex h-12 items-end gap-0.5`,children:o.map((e,t)=>(0,X.jsx)(`span`,{className:h(`flex-1 rounded-t-sm`,Rn(t,o.length,r,i,u)?`bg-primary/70`:`bg-border`),style:{height:`${Math.max(6,e/d*100)}%`}},t))}),(0,X.jsxs)(`div`,{className:`relative h-4`,children:[(0,X.jsx)(`span`,{className:`absolute inset-x-0 top-1/2 h-1 -translate-y-1/2 rounded-full bg-border`}),(0,X.jsx)(`span`,{className:`absolute top-1/2 h-1 -translate-y-1/2 rounded-full bg-primary`,style:{left:`${zn(u[0],r,i)*100}%`,right:`${100-zn(u[1],r,i)*100}%`}})]})]}),(0,X.jsx)(`div`,{className:`relative -mt-4 h-4`,children:[0,1].map(t=>(0,X.jsx)(`input`,{type:`range`,className:`pb-range`,"aria-label":q(t===0?`minimum`:`maximum`,{label:e.label}),min:r,max:i,step:a,value:u[t],onChange:e=>l(Bn(u,t,Number(e.target.value))),onPointerUp:f,onTouchEnd:f,onBlur:f},t))}),(0,X.jsxs)(`div`,{className:`mt-2 flex justify-between text-xs tabular-nums text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:s(u[0])}),(0,X.jsx)(`span`,{children:s(u[1])})]})]})},Un=e=>[...new Set(e.map(e=>e.key.split(`:`).slice(0,2).join(`:`)))],Wn=(e,t)=>{let n=t.filter(t=>!e.includes(t));return n.length===0?e:[...e,...n]},Gn=(e,t)=>{let n=[...e.facets.map(e=>({key:`facet:${e.id}`,label:e.label,secondary:e.secondary})),...(e.ranges??[]).map(e=>({key:`range:${e.id}`,label:e.label,secondary:e.secondary})),...e.datePresets?[{key:`date`,label:q(`date`),secondary:e.dateSecondary}]:[],...(e.toggles??[]).map(e=>({key:`toggle:${e.id}`,label:e.label,secondary:e.secondary}))],r=new Set,i=[];for(let e of n)!e.secondary||t.includes(e.key)?r.add(e.key):i.push({key:e.key,label:e.label});return{shown:r,more:i}},Kn=({label:e,checked:t,onChange:n})=>(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-center justify-between gap-3 py-1`,children:[(0,X.jsx)(`span`,{children:e}),(0,X.jsx)(w,{checked:t,onChange:n,label:e})]}),qn=(e,t)=>e.some(e=>e.length>0)||!!t,Jn=({groups:e,trailing:t})=>{if(!qn(e,t))return null;let n=e.filter(e=>e.length>0);return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n.map((e,t)=>(0,X.jsxs)(Z.Fragment,{children:[t>0&&(0,X.jsx)(`span`,{className:`mx-1 h-5 w-px bg-border`}),e]},t)),t&&(0,X.jsx)(`div`,{className:`flex min-w-32 flex-1 justify-end`,children:t})]})},Yn=(e,t,n)=>{let[r,i]=(0,Z.useState)(t??Gt);return[e??r,e=>{i(e),n?.(e)}]},Xn=({config:e,layout:t,value:n,defaultValue:r,onChange:i,lockedLabels:a,defaultOpenMenu:o,fullWidth:s,leading:c,trailing:l})=>{let[u,d]=Yn(n,r,i),f=yt(e,u),p=Un(f),[m,h]=(0,Z.useState)(()=>p),[g,_]=(0,Z.useState)();(0,Z.useEffect)(()=>h(e=>Wn(e,p)),[p.join(`,`)]);let v=(0,X.jsx)(On,{chips:f,lockedLabels:a,onRemove:e=>d(ut(u,e)),onClear:()=>d(Gt)}),y=(e,t=!1)=>{let n=u.facets[e.id]??[],r=t=>d(Ct(u,e.id,t));return e.combobox?(0,X.jsx)(Mn,{config:e,selected:n,onToggle:r,inline:t}):(0,X.jsx)(Nn,{config:e,selected:n,onToggle:r})},b=e.ranges??[],x=e=>(0,X.jsx)(Hn,{config:e,value:u.ranges?.[e.id],onChange:t=>d(xt(u,e.id,t))}),S=e.datePresets&&(0,X.jsx)(kn,{value:u.date,presets:Array.isArray(e.datePresets)?e.datePresets:void 0,onChange:e=>d({...u,date:e})}),C=(e.toggles??[]).map(e=>(0,X.jsx)(Kn,{label:e.label,checked:u.toggles.includes(e.id),onChange:()=>d(lt(u,e.id))},e.id));if(t===`panel`)return(0,X.jsxs)(`aside`,{className:s?`flex w-full flex-col gap-1`:`flex w-64 shrink-0 flex-col gap-1 overflow-y-auto rounded-lg border bg-background px-4 py-3`,children:[(0,X.jsx)(`div`,{className:`flex items-center justify-between pb-1`,children:(0,X.jsx)(`h2`,{className:`font-semibold`,children:q(`filters`)})}),(f.length>0||(a?.length??0)>0)&&(0,X.jsx)(`div`,{className:`border-b pb-3`,children:v}),c,e.facets.map(e=>(0,X.jsx)(Fn,{title:e.label,children:y(e)},e.id)),b.map(e=>(0,X.jsx)(Fn,{title:e.label,children:x(e)},e.id)),S&&(0,X.jsx)(Fn,{title:q(`date`),children:S}),C.length>0&&(0,X.jsx)(Fn,{title:q(`showOnly`),children:C})]});let{shown:w,more:T}=Gn(e,m),E=e=>{h(t=>Wn(t,[e])),_(e)},ee=[...e.facets.filter(e=>w.has(`facet:${e.id}`)).map(e=>(0,X.jsx)(Pn,{label:e.label,activeCount:(u.facets[e.id]??[]).length,width:e.combobox?280:void 0,defaultOpen:o===e.id||g===`facet:${e.id}`,children:y(e,!0)},e.id)),...b.filter(e=>w.has(`range:${e.id}`)).map(e=>(0,X.jsx)(Pn,{label:e.label,activeCount:+!!u.ranges?.[e.id],width:280,defaultOpen:o===e.id||g===`range:${e.id}`,children:x(e)},`range:${e.id}`)),...S&&w.has(`date`)?[(0,X.jsx)(Z.Fragment,{children:S},`date`)]:[]],te=(e.toggles??[]).filter(e=>w.has(`toggle:${e.id}`)).map(e=>(0,X.jsx)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:(0,X.jsx)(Kn,{label:e.label,checked:u.toggles.includes(e.id),onChange:()=>d(lt(u,e.id))})},e.id)),D=[c?[(0,X.jsx)(Z.Fragment,{children:c},`leading`)]:[],ee,te,T.length>0?[(0,X.jsx)(Ln,{items:T,onPick:E},`more`)]:[]];return!qn(D,l)&&f.length===0&&!a?.length?null:(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(Jn,{groups:D,trailing:l}),v]})},Q=fe(`app/export`),Zn=()=>new DOMException(Q(`cancelled`),`AbortError`),Qn=async({client:e,resource:t,filters:n,orderBy:r,plan:i,labels:a,limit:o,port:s,sink:c,signal:l,onProgress:u})=>{let d=i.columns.map(e=>e.name),f=0;try{await c.write(await s.send({kind:`start`,plan:i,locale:ne()}));for(let[i,p]of n.entries()){let m=``;do{let h=await e.search(t,{filter:p,orderBy:r,pageSize:500,pageToken:m,fields:d,labels:a});if(l.aborted)throw Zn();let g=h.items.slice(0,o-f);if(await c.write(await s.send({kind:`page`,records:g,labels:h.labels??{}})),f+=g.length,u(f),m=h.nextPageToken,f>=o)return await $n(s,c),{rows:f,truncated:g.length<h.items.length||m!==``||i+1<n.length}}while(m!==``)}return await $n(s,c),{rows:f,truncated:!1}}catch(e){throw await c.abort(),e}finally{s.close()}},$n=async(e,t)=>{await t.write(await e.send({kind:`finish`})),await t.close()},er=1048575,tr=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
3
+ `,nr=`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,rr=`http://schemas.openxmlformats.org/package/2006/relationships`;`${tr}`,`${tr}${rr}${nr}`,`${tr}${rr}${nr}${nr}`,new TextEncoder;var ir=M(),ar=e=>e?.export!==!1,or=e=>Object.values(e.fields).flatMap(e=>e.sensitive?[]:[e.name]),sr=(e,t)=>{let n=new Set(or(e));return Fe(e,t).filter(e=>n.has(e))},cr=(e,t,n)=>Object.fromEntries(Ae(e,t,[],n).map(e=>[e.id,e.header])),lr=(e,t,n)=>{let r=cr(e,t,n);return n.flatMap(n=>{let i=e.fields[n];return i?[{name:n,header:r[n],field:i,hints:t?.fields[n]??{}}]:[]})},ur=(e,t)=>{let n=e?.export?e.export.maxRows??1/0:1/0;return Math.min(n,t===`xlsx`?er:1/0)},dr=e=>e.primaryKey.length===1,fr=(e,t)=>{let[n]=e.primaryKey;if(!n||e.primaryKey.length!==1)throw Error(`Not implemented: selected rows are exported by a single-field key`);let r=[];for(let e=0;e<t.length;e+=500)r.push(v(ir.in(n,t.slice(e,e+500))));return r},pr=e=>{if(e.kind!==`counting`)return e.kind===`exact`?e.rows:Math.max(e.rows,10001)},mr=fe(`app/import`),hr=e=>typeof e==`object`&&!!e&&`date`in e,gr=e=>typeof e==`object`&&!!e&&`json`in e,_r=e=>e===null||typeof e==`string`&&e.trim()===``,vr=e=>e===null?``:hr(e)?e.date.replace(`T`,` `):gr(e)?JSON.stringify(e.json):typeof e==`boolean`?e?`TRUE`:`FALSE`:String(e),yr=e=>e<26?String.fromCharCode(65+e):yr(Math.floor(e/26)-1)+yr(e%26),br=(e,t)=>e[t]?.trim()?e[t]:mr(`column`,{letters:yr(t)}),xr=(e,t,n,r)=>{let i=Tn(t.headers),a=t.headers.map((e,n)=>({column:n,include:!0,name:i[n],label:br(t.headers,n).trim(),type:t.types[n].type,inferred:t.types[n],decimal:t.decimals[n]}));return{name:En(e,n,r)??``,pluralLabel:e.replace(/\.[^.]+$/,``).trim(),singularLabel:``,titleField:a.find(e=>e.type===`text`)?.name,fields:a}},Sr=e=>e.fields.filter(e=>e.include),Cr=(e,t,n)=>{let r=e.fields.find(e=>e.column===t),i=e.fields.map(e=>e.column===t?{...e,...n}:e),a=i.find(e=>e.column===t),o=r?.name===e.titleField,s=a.include&&a.type===`text`;return o?{...e,fields:i,titleField:s?a.name:void 0}:{...e,fields:i}},wr=`user_table_fields`,Tr=`table`,Er=(e,t)=>{let n=Sr(t).map((e,t)=>({op:`create`,resource:wr,data:{table_id:{$ref:Tr},name:e.name,label:e.label.trim(),type:e.type,position:t+1,...e.type===`decimal`&&{precision:e.decimal.precision,scale:e.decimal.scale}}})),r=t.titleField?[{op:`update`,resource:e,key:{$ref:Tr},etag:`*`,data:{title_field:t.titleField}}]:[];return[{op:`create`,resource:e,ref:Tr,data:{name:t.name,singular_label:t.singularLabel.trim(),plural_label:t.pluralLabel.trim()}},...n,...r]},Dr=(e,t)=>{let n=new Map(t.map(e=>[e.value,e.count]));return e.map(([e,t])=>({value:e,label:t,...n.get(e)!==void 0&&{count:n.get(e)}}))},Or=(e,t)=>[...new Set(t.filter(t=>!e.includes(t)))],kr=M(),Ar=(e,t,n)=>{let r=z(),[i,a]=(0,Z.useState)({}),o=e=>!!e?.search?.length&&e.primaryKey.length===1,s=e=>{let n=t[e.name];return[e.primaryKey[0],...n?.titleFrom?n.titleFrom.fields:[we(e,n)]]},c=(e,r)=>{let i=t[e.name],a=String(r[e.primaryKey[0]]);return[a,i?.titleFrom?n(e,i,r,a):String(r[we(e,i)])]},l=K({queries:e.map(({id:e,target:t})=>{let n=(i[e]??``).trim();return{queryKey:[`reference-search`,e,t?.name??``,n],enabled:o(t)&&n!==``,placeholderData:$e,queryFn:async()=>(await r.list(t.name,{filter:v(kr.search(n)),fields:s(t),pageSize:20})).items}})});return e.map(({id:e,target:t},n)=>{if(!o(t))return{};let r=t=>a(n=>({...n,[e]:t}));return(i[e]??``).trim()===``?{onSearch:r}:{onSearch:r,matches:(l[n]?.data??[]).map(e=>c(t,e))}})},jr=24,Mr=({model:e,resources:t,views:n,view:r,state:i,extras:a,titleOf:o})=>{let s=z(),c=T(s),l=et(),u=ct(r,e),d=e=>r?.fields[e]?.label??F(e),f=n=>{let r=e.fields[n];return r?.type===`relation`&&r.relation?t[r.relation.resource]:void 0},p=e=>!!(e&&n[e.name]?.titleFrom),h=u.facets.flatMap(e=>(e.flags?e.options.map(e=>e.value):[e.id]).map(t=>({group:e.id,field:t}))),g=K({queries:h.map(({group:t,field:r})=>{let o=dt(u,{...i,facets:{...i.facets,[t]:[]}},a),s=f(r),l=s?.primaryKey.length===1&&!p(s)?we(s,n[s.name]):void 0;return{queryKey:P.facets(e.name,r,o),queryFn:()=>c.facets(e.name,r,{filter:o,limit:50,...l&&{label:l}})}})}),_=(e,t)=>g[h.findIndex(n=>n.group===e&&n.field===t)],v=(e,t)=>_(e,t)?.data,y=e=>(v(e,e)??[]).flatMap(e=>e.value===null?[]:[String(e.value)]),b=K({queries:u.facets.map(t=>{let r=f(t.id),a=Or(y(t.id),i.facets[t.id]??[]);return{queryKey:P.labels(`facet:${e.name}.${t.id}`,a.join(`,`)),enabled:!!r&&!p(r)&&a.length>0,queryFn:async()=>[...await B(l,s,r,a,n[r.name])]}})}),x=K({queries:u.facets.map(t=>{let r=f(t.id),a=r&&p(r)?N(r,n[r.name]):void 0,o=[...new Set([...y(t.id),...i.facets[t.id]??[]])];return{queryKey:P.labels(`facet-title:${e.name}.${t.id}`,o.join(`,`)),enabled:a!==void 0&&o.length>0,queryFn:async()=>[...await m(s,r,a,o)]}})}),S=(e,t)=>{let r=f(e);return(x[t]?.data??[]).map(([e,t])=>[e,o(r,n[r.name],t,e)])},C=Ar(u.facets.map(e=>({id:e.id,target:e.combobox?f(e.id):void 0})),n,o),w=u.ranges??[],E=K({queries:w.map(t=>{let n=dt(u,xt(i,t.id,void 0),a),o=_t(r,t.id)?jr:1;return{queryKey:P.histogram(e.name,t.id,o,n),queryFn:()=>c.histogram(e.name,t.id,{filter:n,buckets:o})}})});return{facets:u.facets.map((t,n)=>{if(t.flags){let e=e=>{let n=v(t.id,e);return n&&{count:n.find(e=>String(e.value)===`true`)?.count??0}},n=t.options.map(({value:t})=>({value:t,label:d(t),...e(t)})),r=t.options.some(({value:e})=>_(t.id,e)?.isError);return{...t,options:n,...r&&{failed:r}}}let i=e.fields[t.id],a=(v(t.id,t.id)??[]).flatMap(e=>e.label===void 0?[]:[[String(e.value),e.label]]),o=i?.type===`enum`?(i.enumValues??[]).map(e=>[e,H(e,r?.fields[t.id]?.valueLabels)]):[],s=new Map([...o,...a,...b[n]?.data??[],...S(t.id,n)]),c=(v(t.id,t.id)??[]).flatMap(e=>e.value===null?[]:[{value:String(e.value),label:s.get(String(e.value))??String(e.value),count:e.count}]),l=C[n],u=_(t.id,t.id)?.isError;return{...t,label:d(t.id),...u&&{failed:u},options:l.matches?Dr(l.matches,c):c,...s.size>0&&{labels:Object.fromEntries(s)},...l.onSearch&&{onSearch:l.onSearch}}}),ranges:w.flatMap((e,t)=>{let n=E[t];if(n?.isError)return[{...e,label:d(e.id),min:0,max:0,step:1,histogram:[],format:ht(r,e.id),failed:!0}];let i=n?.data;return!i||i.min===null||i.max===null?[]:[{...e,label:d(e.id),min:Math.floor(i.min),max:Math.ceil(i.max),step:Math.max(1,Math.round((i.max-i.min)/100)),histogram:_t(r,e.id)?i.buckets.map(e=>e.count):[],format:ht(r,e.id)}]}),...u.dateField&&{datePresets:u.datePresets??!0,dateField:u.dateField,dateKind:u.dateKind,...u.dateSecondary&&{dateSecondary:!0}},toggles:u.toggles?.map(e=>({...e,label:d(e.id)}))}},Nr=f(()=>Qe(()=>import(`./import-dialog-DWGqsC2-.js`).then(e=>e.ImportDialog),__vite__mapDeps([0,1,2,3,4,5,6]))),Pr=f(()=>Qe(()=>import(`./import-table-dialog-BNe0eZoG.js`).then(e=>e.ImportTableDialog),__vite__mapDeps([7,1,2,3,4,5,6]))),Fr=({model:e})=>{let{resources:t,views:n}=Me(),r=Ie(e.name),i=Ie(wr),[a,o]=(0,Z.useState)(!1),s=n[e.name]?.import;return s===!1||!W(r,`create`)||s===`table`&&!W(i,`create`)?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(V,{onClick:()=>o(!0),"aria-haspopup":`dialog`,children:[(0,X.jsx)(xe,{className:`size-3.5`}),mr(s===`table`?`fromFile`:`import`)]}),a&&s===`table`&&(0,X.jsx)(Pr,{tables:e,resources:t,views:n,onClose:()=>o(!1)}),a&&s!==`table`&&(0,X.jsx)(Nr,{model:e,resources:t,views:n,canUpdate:W(r,`update`),onClose:()=>o(!1)})]})},Ir=()=>{let e=new Worker(new URL(`/assets/export-worker-DuHOhIiP.js`,``+import.meta.url),{type:`module`,name:`protobase-export`}),t=[];return e.onmessage=e=>t.shift()?.resolve(e.data.bytes),e.onerror=e=>{e.preventDefault();let n=Error(Q(`couldNotBuild`,{message:e.message}));for(let e of t.splice(0))e.reject(n)},{send:n=>new Promise((r,i)=>{t.push({resolve:r,reject:i}),e.postMessage(n)}),close:()=>e.terminate()}},Lr={xlsx:{mime:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,extension:`.xlsx`,description:`workbook`},csv:{mime:`text/csv`,extension:`.csv`,description:`csvFile`}},Rr=/[\\/:*?"<>|\u0000-\u001f]/g,zr=(e,t,n=new Date)=>{let r=[n.getFullYear(),String(n.getMonth()+1).padStart(2,`0`),String(n.getDate()).padStart(2,`0`)].join(`-`);return`${e.replace(Rr,` `).trim()} ${r}${Lr[t].extension}`},Br=8e6,Vr=(e,t)=>{let n=new Blob([],{type:Lr[t].mime}),r=[],i=0,a=()=>{n=new Blob([n,...r],{type:Lr[t].mime}),r=[],i=0};return{write:async e=>{e.length!==0&&(r.push(e),i+=e.length,i>=Br&&a())},close:async()=>{a();let t=URL.createObjectURL(n),r=document.createElement(`a`);r.href=t,r.download=e,r.click(),setTimeout(()=>URL.revokeObjectURL(t),6e4)},abort:async()=>{r=[],n=new Blob([])}}},Hr=()=>globalThis.showSaveFilePicker,Ur=()=>typeof Hr()==`function`,Wr=async(e,t)=>{let n=Hr();if(!n)throw Error(`This browser cannot save a file as it is built`);let r=Lr[t],i;try{i=await n({suggestedName:e,types:[{description:Q(r.description),accept:{[r.mime]:[r.extension]}}]})}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;throw e}let a=await i.createWritable();return{write:async e=>{e.length>0&&await a.write(e)},close:()=>a.close(),abort:()=>a.abort()}},Gr=f(()=>Qe(()=>import(`./export-dialog-DB5gIvOy.js`).then(e=>e.ExportDialog),__vite__mapDeps([8,1,2,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21]))),Kr=f(()=>Qe(()=>import(`./export-dialog-DB5gIvOy.js`).then(e=>e.ExportProgressDialog),__vite__mapDeps([8,1,2,3,4,5,9,10,11,12,13,14,15,16,17,18,19,20,21]))),qr=(e,t)=>Ur()?Wr(e,t):Promise.resolve(Vr(e,t)),Jr=(e,t)=>{let n=t[e.primaryKey[0]];return typeof n==`object`&&n&&`id`in n?n.id:n},Yr=({model:e,view:t,resources:n,views:r,plural:i,filter:a,orderBy:o,createPort:s=Ir,createSink:c=qr})=>{let l=z(),u=D(),[d,f]=(0,Z.useState)({kind:`closed`}),p=(0,Z.useRef)(void 0),m=(0,Z.useRef)(void 0),h=tt({queryKey:P.exportCount(e.name,a),enabled:d.kind===`settings`,queryFn:async()=>{let t=await l.list(e.name,{filter:a||void 0,pageSize:1,count:`exact`,fields:e.primaryKey});return t.totalSize===void 0?{kind:`estimate`,rows:t.totalSizeEstimate}:{kind:`exact`,rows:t.totalSize}}}).data??{kind:`counting`},g=(e,t=m.current)=>{let n=m.current;n&&n===t&&(m.current=void 0,n.settle(e?[]:n.rows))},v=(t=[])=>(g(!1),f({kind:`settings`,selected:dr(e)?t.map(t=>Jr(e,t)):[]}),new Promise(e=>{m.current={rows:t,settle:e}})),y=()=>{f({kind:`closed`}),g(!1)},x=async(d,v)=>{let y=zr(i,d.format),x=await c(y,d.format);if(!x)return;let S=m.current,C=ur(t,d.format),w=d.scope===`selected`?v.length:pr(h),T=w===void 0?void 0:Math.min(w,C),E=new AbortController;p.current=E,f({kind:`running`,done:0,total:T});try{let c=await Qn({client:l,resource:e.name,filters:d.scope===`selected`?fr(e,v):[a],orderBy:o,plan:{format:d.format,mode:d.mode,name:i,columns:lr(e,t,d.columns)},labels:d.mode===`shown`?_(n,r,e,d.columns):{},limit:C,port:s(),sink:x,signal:E.signal,onProgress:e=>E.signal.aborted||f({kind:`running`,done:e,total:T})});u.show({state:`success`,title:Q(`exported`,{count:L(c.rows),plural:i}),description:c.truncated?Q(`truncated`,{name:y,count:L(c.rows)}):y}),g(!0,S)}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;if(!b(e))throw e;u.show({state:`error`,title:Q(`couldNotExport`,{plural:i}),description:e.message})}finally{p.current=void 0,f(e=>e.kind===`running`?{kind:`closed`}:e),g(!1,S)}},S=()=>{p.current?.abort(),y()},C=or(e),w=cr(e,t,C);return{open:v,dialogs:d.kind===`settings`?(0,X.jsx)(Gr,{plural:i,view:t,fields:C.map(e=>({name:e,label:w[e]})),initialColumns:sr(e,t),count:h,selected:d.selected.length>0?d.selected.length:void 0,open:!0,onExport:e=>void x(e,d.selected),onClose:y}):d.kind===`running`?(0,X.jsx)(Kr,{plural:i,done:d.done,total:d.total,onCancel:S}):null}},Xr=({state:e,onClearSearch:t,onClearFilters:n,create:r})=>(0,X.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-8 text-center text-muted-foreground`,children:[(0,X.jsx)(`p`,{children:e.message}),(e.clearSearch||e.clearFilters||e.create&&r)&&(0,X.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[e.clearSearch&&(0,X.jsx)(V,{onClick:t,children:Y(`clearSearch`)}),e.clearFilters&&(0,X.jsx)(V,{onClick:n,children:Y(`clearFilters`)}),e.create&&r]})]}),Zr=({plural:e,search:t,filtered:n,scoped:r,canCreate:i})=>t?{message:Y(`noMatchSearch`,{plural:e,search:t}),clearSearch:!0,clearFilters:n,create:!1}:n?{message:Y(`noMatchFilters`,{plural:e}),clearSearch:!1,clearFilters:!0,create:!1}:r?{message:Y(`noMatch`,{plural:e}),clearSearch:!1,clearFilters:!1,create:!1}:{message:Y(`noneYet`,{plural:e}),clearSearch:!1,clearFilters:!1,create:i},Qr=(e,t)=>{},$r=({windowMs:e=1e3,comebacks:t=2,onHold:n=Qr}={})=>{let r,i=[],a;return(o,s)=>{if(a?.among.has(o))return a.value;if(a&&(a=void 0,i=[]),o===r||(r=o,i=i.filter(t=>s-t.at<=e),i.push({value:o,at:s,comeback:i.some(e=>e.value===o)}),i.filter(e=>e.comeback).length<t))return o;let c=new Set(i.slice(-2*t).map(e=>e.value));return a={value:Math.min(...c),among:c},n(a.value,[...c]),a.value}},ei=e=>Math.max(1,Math.floor((e+12)/252)),ti=(e,t)=>Math.max(0,(e-(t-1)*12)/t),ni=(e,t,n,r)=>({start:e*n,end:Math.max(0,Math.min(r,(t+1)*n)-1)}),ri=(e,t,n)=>{let r=e/t.rowHeight;return t.columns===n.columns?r*n.rowHeight:Math.floor(Math.floor(r)*t.columns/n.columns)*n.rowHeight},ii=(e,t)=>{let n=e/t.rowHeight;return Math.floor(n)*t.columns+n%1},ai=(e,t)=>Math.floor(Math.floor(e)/t)+e%1,oi=8,si=(e,t,n)=>{let r=e.get(t);if(r!==void 0&&r>=n)return e;let i=new Map(e);i.delete(t),i.set(t,n);for(let e of i.keys()){if(i.size<=oi)break;i.delete(e)}return i},ci=({source:e,label:t,initialIndex:n,onScrollIndex:r,minHeight:i,children:a})=>{let{total:o}=e,[s]=(0,Z.useState)(n),[c,l]=(0,Z.useState)(0),u=ei(c),d=ti(c,u),[f,p]=(0,Z.useState)(()=>new Map),m=Math.ceil(Math.max(i(d),f.get(d)??0)),h=m+12,g={columns:u,rowHeight:h},_=(0,Z.useRef)({layout:g,top:0}),v=_.current.top>0&&(_.current.layout.columns!==u||_.current.layout.rowHeight!==h),y=e=>v?ri(_.current.top,_.current.layout,g):e,b=d>0&&f.has(d),x=rt({total:Math.ceil(o/u),rowHeight:h,initialIndex:ai(s,u),settle:y,ready:b,onScroll:e=>r(ii(e,g))});(0,Z.useLayoutEffect)(()=>{v&&x.scrollTo(x.top),_.current={layout:g,top:x.started()?x.top:0}});let S=ni(x.first,x.last,u,o),C=$t({total:o,rowAt:e.rowAt,loadRows:e.loadRows,cachedRows:e.cachedRows,revision:e.revision,latencyMs:0},S.start,S.end),[w]=(0,Z.useState)(()=>$r());(0,Z.useLayoutEffect)(()=>{let e=x.ref.current;if(!e)return;let t=()=>l(w(e.clientWidth,performance.now())),n=new ResizeObserver(t);return n.observe(e),t(),()=>n.disconnect()},[w]);let T=(0,Z.useRef)(d);T.current=d;let[E]=(0,Z.useState)(()=>new ResizeObserver(e=>{let t=Math.max(...e.map(e=>e.borderBoxSize[0]?.blockSize??e.contentRect.height)),n=T.current;p(e=>si(e,n,t))}));(0,Z.useLayoutEffect)(()=>()=>E.disconnect(),[E]),(0,Z.useLayoutEffect)(()=>{let e=x.ref.current;if(b||d===0||!e)return;let t=[...e.querySelectorAll(`:scope > li[aria-posinset]`)];if(t.length===0)return;let n=Math.max(...t.map(e=>e.getBoundingClientRect().height));p(e=>si(e,d,n))});let ee=(0,Z.useCallback)(e=>{if(e)return E.observe(e),()=>E.unobserve(e)},[E]);return(0,X.jsx)(`ul`,{ref:x.ref,className:`relative min-w-0 flex-auto`,"aria-label":t,style:{height:x.geometry.contentHeight},children:x.rows.flatMap(({index:e,offset:t})=>Array.from({length:u},(n,r)=>{let i=e*u+r;if(i>=o)return[];let s=C(i),c={top:t,left:r*(d+12),width:d,minHeight:m};return s?(0,X.jsx)(`li`,{ref:ee,"aria-posinset":i+1,"aria-setsize":o,className:`absolute grid grid-cols-[minmax(0,1fr)]`,style:c,children:a(s)},s.id):(0,X.jsx)(`li`,{"aria-hidden":!0,className:`absolute grid grid-cols-[minmax(0,1fr)]`,style:c,children:(0,X.jsx)(I,{className:`h-full rounded-lg`})},`skeleton-${i}`)}))})},li=`grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-3`,ui=e=>e*.75,di=44,fi=({model:e,view:t,display:n,list:r,empty:i})=>{let a=t?.names?.plural??F(e.name),o=n.card===void 0&&(n.image!==void 0||n.photos!==void 0);return r.isLoading?(0,X.jsx)(`div`,{"aria-busy":!0,className:`min-h-0 flex-1 overflow-hidden ${li}`,children:Array.from({length:6},(e,t)=>(0,X.jsx)(I,{className:`h-24`},t))}):r.error?(0,X.jsx)(je,{title:Be(`couldNotLoadRows`),error:r.error}):!r.source||r.source.total===0?i??(0,X.jsx)(`p`,{className:`py-8 text-center text-muted-foreground`,children:Be(`noneMatch`,{plural:a.toLowerCase()})}):(0,X.jsx)(ci,{source:r.source,label:a,initialIndex:r.initialIndex,onScrollIndex:r.onScrollIndex,minHeight:e=>(o?ui(e):0)+di,children:r=>(0,X.jsx)(Ht,{model:e,view:t,display:n,row:y(e,r)})})},pi=`protobase:list-places`,mi=50,hi=(e,t)=>`${e} ${t}`,gi=e=>{if(typeof e!=`object`||!e)return!1;let{entry:t,url:n,place:r}=e;return typeof t==`string`&&typeof n==`string`&&typeof r==`number`&&Number.isFinite(r)&&r>=0},_i=e=>re(()=>{let t=e.getItem(pi);if(t===null)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(gi):[]},[]),vi=e=>{let t=new Map(_i(e).map(e=>[hi(e.entry,e.url),e]));return{placeOf:(e,n)=>{let r=t.get(hi(e,n));return r?r.place:[...t.values()].findLast(e=>e.url===n)?.place??0},save:(e,n,r)=>{let i=hi(e,n);t.delete(i),t.set(i,{entry:e,url:n,place:r});for(let e of[...t.keys()].slice(0,Math.max(0,t.size-mi)))t.delete(e)},persist:()=>re(()=>e.setItem(pi,JSON.stringify([...t.values()])),void 0)}},yi={getItem:()=>null,setItem:()=>{}},bi,xi=()=>bi??=vi(re(()=>window.sessionStorage,void 0)??yi),Si=()=>{let{entry:e,path:t,params:n}=r(),i=`${t}?${n.toString()}`,a=xi();(0,Z.useEffect)(()=>{let e=()=>a.persist(),t=()=>document.visibilityState===`hidden`&&a.persist();return window.addEventListener(`pagehide`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,t),a.persist()}},[a]);let o=(0,Z.useCallback)(t=>a.save(e,i,t),[a,e,i]);return{initialIndex:a.placeOf(e,i),remember:o}},Ci=e=>e.reduce((e,t)=>e+t.count,0),wi=e=>{let t=Math.floor(e.length/2),n=Ci(e.slice(0,t)),r=Ci(e.slice(e.length-t));return n===0?0:(r-n)/n*100},Ti=fe(`activity-chart`),Ei=({title:e,defaultGranularity:t=`day`,data:n,granularity:r,onGranularityChange:i,periodLabel:a,state:o,className:s})=>{let[c,l]=(0,Z.useState)(t),u=r??c,d=i??l,f=wi(n),p=n.map(({at:e,count:t})=>({at:e,value:t,count:t}));return(0,X.jsxs)(`section`,{className:h(`rounded-lg border bg-background px-4 pb-2 pt-3`,s),children:[(0,X.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,X.jsx)(`h2`,{className:`font-semibold`,children:e}),o===void 0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`font-semibold tabular-nums`,children:L(Ci(n))}),(0,X.jsxs)(`span`,{className:h(`text-xs font-medium tabular-nums`,f>=0?`text-success-text`:`text-danger-text`),children:[f>=0?`+`:`−`,Math.abs(f).toFixed(1),`%`]})]}),(0,X.jsx)(`span`,{className:`hidden text-xs text-muted-foreground sm:inline`,children:a??`last ${u===`day`?`30 days`:`12 weeks`}`})]}),(0,X.jsx)(_e,{value:u,onChange:d,options:[{value:`day`,label:Ti(`day`)},{value:`week`,label:Ti(`week`)}]})]}),(0,X.jsxs)(`div`,{className:`mt-2`,children:[o===`failed`&&(0,X.jsx)(`p`,{className:`py-6 text-danger-text`,children:Ti(`couldNotLoad`)}),o===`loading`&&(0,X.jsx)(I,{className:`h-24 w-full`}),o===void 0&&(0,X.jsx)(Rt,{points:p,measure:{kind:`count`},bucket:u,type:`bar`,compact:!0})]})]})},Di={"7d":`last 7 days`,"30d":`last 30 days`,"90d":`last 90 days`,"1y":`last year`,all:`all time`},Oi=({resource:e,chart:t,title:n,filter:r})=>{let[i,a]=(0,Z.useState)(t.granularity===`week`?`week`:`day`),o=i===`week`?`90d`:t.range,s=Ee(e,{field:t.field,range:o,granularity:i,filter:r,timeZone:ve()}),c=s.data?.points.map(e=>({at:Date.parse(`${e.bucket}Z`),count:e.count}))??[];return(0,X.jsx)(Ei,{title:n,data:c,granularity:i,onGranularityChange:a,periodLabel:i===`week`?`last 12 weeks`:Di[o],state:s.isError?`failed`:s.isPending?`loading`:void 0})},ki=(e,t,n)=>{let r=e.sum??e.average;if(r===void 0)return n;let i=t?.fields[r]?.label??F(r);return e.sum===void 0?U(`average`,{label:i}):`${i}`},Ai=({model:e,view:t,chart:n,plural:r,filter:i})=>{let a=t?.fields[n.groupBy]?.label??F(n.groupBy);return(0,X.jsxs)(`section`,{className:`rounded-lg border bg-background px-4 pb-3 pt-3`,"aria-label":`${ki(n,t,r)} by ${a.toLowerCase()}`,children:[(0,X.jsxs)(`h2`,{className:`mb-2 font-semibold`,children:[ki(n,t,r),` by `,a.toLowerCase()]}),(0,X.jsx)(At,{model:e,view:t,groupBy:n.groupBy,type:n.type,sum:n.sum,average:n.average,limit:n.limit,filter:i})]})},ji=({value:e,onCommit:t,placeholder:n,className:r})=>{let[i,a]=(0,Z.useState)(e);return(0,Z.useEffect)(()=>a(e),[e]),(0,Z.useEffect)(()=>{if(i===e)return;let n=setTimeout(()=>t(i),350);return()=>clearTimeout(n)},[i,e,t]),(0,X.jsx)(c,{wrapperClassName:h(`min-w-0 flex-1 sm:w-72 sm:flex-initial`,r),leading:(0,X.jsx)(Ce,{className:`size-4`}),placeholder:n,"aria-label":Y(`search`),value:i,onChange:e=>a(e.target.value),onKeyDown:e=>e.key===`Enter`&&t(i)})},Mi=(e,t,n,r,i)=>{let a=n?.list?.relatedColumns??[];if(a.length===0)return e;let o=new Map(e.map(e=>[e.id,e]));return Fe(t,n).flatMap(e=>{let t=o.get(e);if(t)return[t];let n=a.find(t=>t.name===e),s=n&&r[n.resource];if(!n||!s)return[];let c=n.label??F(n.name);return[{id:n.name,header:c,kind:`text`,width:160,minWidth:k(c,!1),sortable:!1,render:e=>(0,X.jsx)(bt,{column:n,records:e[n.name]??[],target:s,view:i[s.name],Card:Ht})}]})},Ni=({model:e,view:t,target:n,children:r})=>{let i=gt(e.name,t.listOf,!0),a=t.names?.plural??F(e.name),o=e=>(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[(0,X.jsx)(Qt,{title:a,subtitle:t.help}),e]});if(i.error)return o((0,X.jsx)(je,{title:ot(`couldNotLoadYour`,{plural:a.toLowerCase()}),error:i.error}));if(!i.data)return o((0,X.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-3`,children:Array.from({length:3},(e,t)=>(0,X.jsx)(I,{className:`h-24`},t))}));let s=Pt(n,i.data);return s?r(s):o((0,X.jsx)(`p`,{className:`py-8 text-center text-muted-foreground`,children:ot(`noneYet`,{plural:a.toLowerCase()})}))},Pi=({title:e,chips:t,label:n,required:r,initial:i=``,busy:a,onSave:o,onClose:s})=>{let l=(0,Z.useId)(),[u,d]=(0,Z.useState)(i),f=`${l}-form`;return(0,X.jsx)(de,{open:!0,title:e,onClose:s,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(V,{onClick:s,children:J(`cancel`)}),(0,X.jsx)(V,{type:`submit`,form:f,variant:`primary`,loading:a,children:J(`save`)})]}),children:(0,X.jsxs)(`form`,{id:f,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),o(u.trim()===``?null:u.trim())},children:[t.length>0&&(0,X.jsx)(Tt,{chips:t}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,X.jsx)(`label`,{htmlFor:l,className:`font-medium`,children:n}),!r&&(0,X.jsx)(`span`,{id:`${l}-hint`,className:`text-xs text-muted-foreground`,children:J(`optional`)})]}),(0,X.jsx)(c,{id:l,value:u,required:r,pattern:r?`.*\\S.*`:void 0,"aria-describedby":r?void 0:`${l}-hint`,autoFocus:!0,autoComplete:`off`,onChange:e=>d(e.target.value)})]})]})})},$=M(),Fi={start:0,end:0},Ii=(e,t)=>$.and(t,{kind:`present`,field:e.field,span:Fi}),Li=e=>{switch(e.kind){case`and`:case`or`:return{...e,args:e.args.map(Li)};case`not`:return Ri(e.arg);case`search`:case`present`:case`isNull`:case`related`:return e;default:return Ii(e,e)}},Ri=e=>{switch(e.kind){case`and`:return $.or(...e.args.map(Ri));case`or`:return $.and(...e.args.map(Ri));case`not`:return Li(e.arg);case`search`:case`present`:case`isNull`:case`related`:return $.not(e);default:return Ii(e,$.not(e))}},zi=e=>{let t=pe(e);if(!t.ok)throw Error(`The filter cannot be read: ${t.errors.map(e=>e.message).join(`; `)}`);return t.ast},Bi=e=>e.kind===`and`||e.kind===`or`?e.args.some(Bi):e.kind===`not`?Bi(e.arg):e.kind===`related`,Vi=(e,t)=>![zi(e),zi(t)].some(e=>e&&Bi(e)),Hi=(e,t)=>{let n=zi(e);if(!n)return null;let r=zi(t),i=$.not(Li(n));return v(r?$.and(r,i):i)},Ui=(e,t)=>Hi(t,e),Wi=e=>e.key.startsWith(`extra:`)?`extra:${e.label}`:e.key,Gi=(e,t)=>{let n=new Map(e.map(e=>[Wi(e),e])),r=new Map(t.map(e=>[Wi(e),e])),i=e.filter(e=>!r.has(Wi(e))).map(e=>({kind:`removed`,label:e.label})),a=t.flatMap(e=>{let t=n.get(Wi(e));return t&&t.label!==e.label?[{kind:`changed`,label:e.label,before:t.label}]:[]}),o=t.filter(e=>!n.has(Wi(e))).map(e=>({kind:`added`,label:e.label}));return[...i,...a,...o]},Ki=(e,t,n,r)=>{let i=e-t;if(i===0)return J(`asMany`,{plural:r});let a=Math.abs(i)===1?n:r;return i>0?J(`more`,{count:i,noun:a}):J(`fewer`,{count:-i,noun:a})},qi=12,Ji={added:{word:`added`,className:`text-success-text`},removed:{word:`removed`,className:`text-danger-text`},changed:{word:`changed`,className:`text-primary-text`}},Yi=({changes:e})=>(0,X.jsx)(`ul`,{"aria-label":J(`filterChanges`),className:`divide-y rounded-md border`,children:e.map(e=>(0,X.jsxs)(`li`,{className:`grid grid-cols-[72px_1fr] gap-3 px-3 py-2`,children:[(0,X.jsx)(`span`,{className:`font-medium ${Ji[e.kind].className}`,children:J(Ji[e.kind].word)}),e.kind===`changed`?(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`text-muted-foreground line-through`,children:e.before}),` `,(0,X.jsx)(`span`,{className:`font-medium`,children:e.label})]}):(0,X.jsx)(`span`,{className:e.kind===`removed`?`text-muted-foreground line-through`:`font-medium`,children:e.label})]},`${e.kind}:${e.label}`))}),Xi=(e,t)=>{let n=tt({...Ve(z(),e,t??``),enabled:t!==null});return t===null?0:n.data},Zi=(e,t,n)=>`${e} ${e===1?t:n}`,Qi=({model:e,view:t,title:n,filter:r,total:i,plural:a})=>{let o=t?.list?.displays?.find(e=>e.kind===`cards`);return(0,X.jsxs)(`section`,{"aria-label":n,className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`h3`,{className:`font-semibold`,children:[n,` `,(0,X.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,i??`…`,`)`]})]}),i!==void 0&&i>qi&&(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:J(`firstOf`,{limit:qi,total:i})}),r===null||i===0?(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:J(`noPlural`,{plural:a})}):(0,X.jsx)(It,{model:e,view:t,filter:r,sort:he(e,t),limit:qi,display:o?.name??`table`,row:!0,link:!1,empty:`No ${a}.`})]})},$i=({model:e,view:t,before:n,after:r})=>{let i=(0,Z.useMemo)(()=>Hi(n,r),[n,r]),a=(0,Z.useMemo)(()=>Ui(n,r),[n,r]),o=Xi(e,i),s=Xi(e,a),c=(t?.names?.singular??F(e.name)).toLowerCase(),l=(t?.names?.plural??F(e.name)).toLowerCase();return(0,X.jsxs)(X.Fragment,{children:[o!==void 0&&s!==void 0?(0,X.jsxs)(`p`,{children:[(0,X.jsx)(`span`,{className:`font-semibold`,children:Ki(o,s,c,l)}),(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[`: `,J(`addedRemoved`,{added:Zi(o,c,l),removed:s})]})]}):(0,X.jsx)(I,{className:`h-4 w-48`}),(0,X.jsx)(Qi,{model:e,view:t,title:J(`added`),filter:i,total:o,plural:l}),(0,X.jsx)(Qi,{model:e,view:t,title:J(`removed`),filter:a,total:s,plural:l})]})},ea=({model:e,view:t,title:n,before:r,after:i,saveNewLabel:a,updating:o,creating:s,onUpdate:c,onSaveNew:l,onCancel:u})=>{let d=Gi(it(e,r),it(e,i));return(0,X.jsx)(de,{open:!0,wide:!0,title:n,onClose:u,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(V,{onClick:u,children:J(`cancel`)}),(0,X.jsx)(V,{loading:s,disabled:o,onClick:l,children:a}),(0,X.jsx)(V,{variant:`primary`,loading:o,disabled:s,onClick:c,children:J(`update`)})]}),children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[d.length>0&&(0,X.jsx)(Yi,{changes:d}),Vi(r,i)?(0,X.jsx)($i,{model:e,view:t,before:r,after:i}):(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:J(`noRecordsDiff`)})]})})},ta=()=>{let{address:e,set:t}=se();return{key:e?.kind===`list`?e.savedSearch:void 0,open:e=>t({savedSearch:e})}},na=e=>e instanceof Error?e.message:J(`somethingWrong`),ra=(e,t)=>{let n=Me(),r=z(),i=D(),a=We(),{href:o,open:s}=se(),c=ta(),{resource:l}=e,u=n.resources[l],d=n.views[l]?.searchesOf,f=n.permissions[l],p=u!==void 0&&d!==void 0&&f!==void 0&&W(f,`create`)&&W(f,`delete`),m=n.signIn?.[l]?.signIn,h=Et(l,p),g=e=>Se(Ke(u,e)),_=d&&h.data?.find(e=>e[d.filter]===t),v=_||c.key===void 0||!f||!W(f,`update`)?void 0:h.data?.find(e=>g(e)===c.key),y=n.views[l]?.names,b=y?.plural??`saved searches`,x=d?.name===void 0?void 0:u?.fields[d.name],S=G({mutationFn:e=>r.create(l,{[d.filter]:t,...d.name&&{[d.name]:e}}),onSuccess:e=>{c.open(g(e.record)),i.show({state:`success`,title:J(`searchSaved`),action:{label:J(`openPlural`,{plural:b}),href:o({kind:`list`,resource:l}),onNavigate:s}})},onError:e=>i.show({state:`error`,title:J(`couldNotSave`),description:na(e)}),onSettled:()=>a(l)}),C=G({mutationFn:e=>r.remove(l,g(e)),onError:e=>i.show({state:`error`,title:J(`couldNotTakeOff`),description:na(e)}),onSettled:()=>a(l)}),w=G({mutationFn:e=>r.update(l,g(e),{[d.filter]:t},e.etag??`*`),onSuccess:()=>i.show({state:`success`,title:J(`searchUpdated`)}),onError:e=>i.show({state:`error`,title:J(`couldNotUpdate`),description:na(e)}),onSettled:()=>a(l)}),T=S.isPending||C.isPending||w.isPending;return{mode:p?`save`:m?`sign-in`:void 0,prompt:m,saved:_!==void 0,opened:v&&{filter:String(v[d.filter]??``),name:d.name&&typeof v[d.name]==`string`&&v[d.name]!==``?String(v[d.name]):void 0},noun:(y?.singular??F(l)).toLowerCase(),naming:x&&{label:n.views[l]?.fields[x.name]?.label??F(x.name),required:!x.nullable},ready:h.data!==void 0&&!T,updating:w.isPending,creating:S.isPending,remove:()=>_&&C.mutate(_),saveNew:(e,t)=>S.mutate(e,t),update:e=>v&&w.mutate(v,e)}},ia=({model:e,view:t,search:n,filter:r,chips:i,className:a})=>{let o=ra(n,r),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)();if(!o.mode)return null;let m=n.label??J(`saveSearch`);if(o.mode===`sign-in`)return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(V,{className:a,"aria-haspopup":`dialog`,onClick:()=>c(!0),children:[(0,X.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0}),m]}),(0,X.jsx)(p,{as:`dialog`,prompt:o.prompt,open:s,onClose:()=>c(!1)})]});let h=e=>{u(!1),o.naming?f(e):o.saveNew(null)},g=d!==void 0&&o.naming&&(0,X.jsx)(Pi,{title:d,chips:i,label:o.naming.label,required:o.naming.required,busy:o.creating,onSave:e=>o.saveNew(e,{onSuccess:()=>f(void 0)}),onClose:()=>f(void 0)}),_=o.opened;if(_){let n=J(`saveAsNew`,{noun:o.noun});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(V,{className:a,"aria-haspopup":`dialog`,"aria-disabled":!o.ready,onClick:()=>o.ready&&u(!0),children:[(0,X.jsx)(vn,{className:`size-3.5`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`max-w-60 truncate`,children:J(`updateName`,{name:_.name??o.noun})})]}),(0,X.jsxs)(V,{className:a,"aria-haspopup":o.naming?`dialog`:void 0,"aria-disabled":!o.ready,onClick:()=>o.ready&&h(n),children:[(0,X.jsx)(mn,{className:`size-3.5`,"aria-hidden":!0}),n]}),l&&(0,X.jsx)(ea,{model:e,view:t,title:_.name?J(`updateNameQuestion`,{name:_.name}):J(`updateNounQuestion`,{noun:o.noun}),before:_.filter,after:r,saveNewLabel:n,updating:o.updating,creating:o.creating,onUpdate:()=>o.update({onSuccess:()=>u(!1)}),onSaveNew:()=>h(n),onCancel:()=>u(!1)}),g]})}let v=o.saved?fn:ae;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(V,{className:a,"aria-pressed":o.saved,"aria-haspopup":!o.saved&&o.naming?`dialog`:void 0,"aria-disabled":!o.ready,onClick:()=>o.ready&&(o.saved?o.remove():h(m)),children:[(0,X.jsx)(v,{className:o.saved?`size-3.5 text-primary`:`size-3.5`,"aria-hidden":!0}),m]}),g]})},aa=e=>e instanceof Error?e.message:J(`somethingWrong`),oa=({model:e,view:t,name:n,value:r,onChange:i})=>{let a=(0,Z.useId)(),o=e.fields[n],s=t.fields[n],c=s?.label??F(n);if(o?.type===`boolean`)return(0,X.jsx)(w,{checked:r===!0,onChange:i,label:c});if(o?.type!==`enum`)throw Error(`Not implemented: "${n}" is ${o?.type??`unknown`}, and a saved search's controls are enums or booleans`);return(0,X.jsxs)(`label`,{htmlFor:a,className:`flex items-center gap-2 text-muted-foreground`,children:[c,(0,X.jsx)(`select`,{id:a,value:String(r??``),onChange:e=>i(e.target.value),className:`h-8 rounded-md border border-border-strong bg-background px-2 text-foreground shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20`,children:(o.enumValues??[]).map(e=>(0,X.jsx)(`option`,{value:e,children:H(e,s?.valueLabels)},e))})]})},sa=(e,t,n)=>Object.entries(n).map(([n,r])=>`${t.fields[n]?.label??F(n)}: ${e.fields[n]?.type===`boolean`?J(r===!0?`on`:`off`):H(String(r),t.fields[n]?.valueLabels)}`).join(`, `),ca=({model:e,view:t,recordKey:n,title:r,row:i,fields:a})=>{let o=z(),s=D(),c=We(),l=G({mutationFn:t=>o.update(e.name,n,t,i.etag??`*`),onSuccess:(n,i)=>s.show({state:`success`,title:J(`saved`,{title:r}),description:sa(e,t,i)}),onError:e=>s.show({state:`error`,title:J(`couldNotChange`),description:aa(e)}),onSettled:()=>c(e.name)});return(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-3`,children:a.map(n=>(0,X.jsx)(oa,{model:e,view:t,name:n,value:l.isPending&&n in(l.variables??{})?l.variables[n]:i[n],onChange:e=>l.mutate({[n]:e})},n))})},la=e=>e instanceof Error?e.message:J(`somethingWrong`),ua=({model:e,view:t,of:n,target:r,targetView:i,row:a,recordKey:o,canRename:s,onDelete:c})=>{let l=z(),u=D(),d=We(),[f,p]=(0,Z.useState)(!1),{name:m,chips:h,title:g,body:_}=Wt({model:e,of:n,target:r,targetView:i,row:a,recordKey:o}),v=G({mutationFn:t=>l.update(e.name,o,{[n.name]:t},a.etag??`*`),onSuccess:()=>p(!1),onError:e=>u.show({state:`error`,title:J(`couldNotRename`),description:la(e)}),onSettled:()=>d(e.name)}),y=n.name===void 0?void 0:e.fields[n.name];return(0,X.jsxs)(`section`,{"aria-label":g,className:`flex flex-col gap-3 rounded-lg border bg-surface p-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:(0,X.jsx)(C,{to:{kind:`record`,resource:e.name,key:o},className:`hover:underline`,children:m??(0,X.jsx)(wt,{chips:h})})})}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n.controls&&(0,X.jsx)(ca,{model:e,view:t,recordKey:o,title:g,row:a,fields:n.controls}),s&&y&&(0,X.jsx)(V,{variant:`ghost`,"aria-label":J(`renameTitle`,{title:g}),"aria-haspopup":`dialog`,onClick:()=>p(!0),children:(0,X.jsx)(Kt,{className:`size-3.5`,"aria-hidden":!0})}),c&&(0,X.jsx)(V,{variant:`ghost`,"aria-label":J(`deleteTitle`,{title:g}),onClick:()=>c(g),children:(0,X.jsx)(Zt,{className:`size-3.5`,"aria-hidden":!0})})]})]}),f&&y&&(0,X.jsx)(Pi,{title:J(`renameTitle`,{title:g}),chips:h,label:t.fields[y.name]?.label??F(y.name),required:!y.nullable,initial:m,busy:v.isPending,onSave:e=>v.mutate(e),onClose:()=>p(!1)}),(0,X.jsx)(Ut,{..._})]})},da=({model:e,view:t})=>{let{resources:n,views:r}=Me(),i=t.searchesOf,a=n[i.resource],o=r[i.resource],s=Et(e.name,!0),c=Ie(e.name),l=qt({model:e,view:t}),u=t.names?.plural??F(e.name),d=e=>(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[l.dialogs,(0,X.jsx)(Qt,{title:u,subtitle:t.help}),e]});if(!a)return d((0,X.jsx)(ze,{title:J(`notFound`),children:J.rich(`noResource`,{resource:i.resource})}));if(s.error)return d((0,X.jsx)(je,{title:J(`couldNotLoadYour`,{plural:u.toLowerCase()}),error:s.error}));if(!s.data)return d((0,X.jsx)(`div`,{className:`flex flex-col gap-3`,children:Array.from({length:2},(e,t)=>(0,X.jsx)(I,{className:`h-56`},t))}));if(s.data.length===0){let e=(o?.names?.plural??F(a.name)).toLowerCase();return d((0,X.jsx)(`p`,{className:`py-8 text-center text-muted-foreground`,children:J.rich(`noSavedYet`,{plural:u.toLowerCase(),list:(0,X.jsx)(C,{to:{kind:`list`,resource:a.name},className:`font-medium text-primary-text hover:underline`,children:e})})}))}return d((0,X.jsx)(`div`,{className:`flex flex-col gap-4`,children:s.data.map(n=>{let r=Se(Ke(e,n)),s=W(c,`delete`)?e=>void l.start({key:r,title:e,etag:n.etag,snapshot:n}):void 0;return(0,X.jsx)(ua,{model:e,view:t,of:i,target:a,targetView:o,row:n,recordKey:r,canRename:W(c,`update`),onDelete:s},r)})}))},fa=({field:e,hints:t,resource:n,stored:r,onSave:i,close:o})=>{let[s,c]=(0,Z.useState)(()=>ee(e,r)),l=(0,Z.useRef)(null),u=(0,Z.useRef)(!1),d=!t?.widget&&(e.type===`boolean`||e.type===`enum`);(0,Z.useEffect)(()=>{l.current?.querySelector(`input, select, textarea, button, [tabindex]`)?.focus()},[]);let f=(t,n,c=s)=>{u.current||(u.current=!0,t&&a(e,c,r)&&i(De(e,c)),o(n))};return(0,X.jsx)(`div`,{ref:l,className:`w-full min-w-0`,onKeyDown:e=>{ce(e.target)||(e.key===`Enter`?(e.preventDefault(),f(!0)):e.key===`Tab`?(e.preventDefault(),f(!0,e.shiftKey?-1:1)):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),f(!1)))},onBlur:e=>{!l.current?.contains(e.relatedTarget)&&!ce(e.relatedTarget)&&f(!0)},children:(0,X.jsx)(ge,{field:e,hints:t,value:s,stored:r,resource:n,onChange:e=>{c(e),d&&f(!0,void 0,e)}})})},pa=fe(`app/list-edit`),ma=e=>{let t=z(),n=et(),r=D(),[i,a]=(0,Z.useState)(new Map),o=(0,Z.useRef)(i),s=(0,Z.useRef)(new Map),c=(e,t)=>{o.current=new Map(o.current).set(e,{...o.current.get(e),...t}),a(o.current)},l=async(i,a,s)=>{let l=Ke(e,i),u=String(o.current.get(i.id)?.etag??i.etag);try{let r=await t.update(e.name,l,{[a]:s},u);c(i.id,{[a]:r.record[a],etag:r.etag}),n.setQueryData(P.record(e.name,Se(l)),r),n.invalidateQueries({queryKey:[`page`,e.name]}),n.invalidateQueries({queryKey:[`list`,e.name]}),n.invalidateQueries({queryKey:[`map`,e.name]}),n.invalidateQueries({queryKey:[`count`,e.name]})}catch(n){if(!b(n))throw c(i.id,{[a]:i[a]}),n;let o=n.status===412,s=o?await t.get(e.name,l):void 0;c(i.id,s?{[a]:s.record[a],etag:s.etag}:{[a]:i[a]});let u=n.errors.find(e=>e.field===a)?.message??n.message;r.show({state:`error`,title:pa(o?`changedBySomeoneElse`:`couldNotSave`),description:u})}};return{patches:i,save:(e,t,n)=>{c(e.id,{[t]:n});let r=(s.current.get(e.id)??Promise.resolve()).then(()=>l(e,t,n));return s.current.set(e.id,r.catch(()=>void 0)),r}}},ha=(e,t,n)=>{let r=ma(e),i=t?.list?.editable??[];return{editor:i.length>0&&W(n,`update`)?{editable:(t,n)=>i.includes(n)&&e.fields[n]!==void 0&&O(e.fields[n])&&l(t,`update`),render:(n,i,a)=>(0,X.jsx)(fa,{field:e.fields[i],hints:t?.fields[i],resource:e.name,stored:n[i],onSave:e=>void r.save(n,i,e),close:a})}:void 0,patches:r.patches}},ga=M(),_a=e=>e.find(e=>e.kind===`search`),va=({address:e})=>{let{resources:t,views:n,signIn:r}=Me(),i=t[e.resource],a=r?.[e.resource];if(!i)return a?(0,X.jsx)(p,{as:`page`,prompt:a.signIn}):(0,X.jsx)(ze,{title:U(`notFound`),children:U(`noResource`,{name:e.resource})});let o=Ue(n[e.resource],e.list);if(e.list!==void 0&&!o)return(0,X.jsx)(ze,{title:U(`notFound`),children:Y(`noList`,{name:e.list})});if(o?.searchesOf)return(0,X.jsx)(da,{model:i,view:o});let s=j(t,n,e.resource,e.list);if(o&&s.listOf){let t=s.model;return(0,X.jsx)(Ni,{model:i,view:o,target:t,children:n=>(0,X.jsx)(ya,{model:t,address:e,scope:n,heading:{title:o.names?.plural??F(i.name),subtitle:o.help}})})}return(0,X.jsx)(ya,{model:i,address:e})},ya=({model:e,address:t,scope:n,heading:r})=>{let a=Me(),{set:s,listTo:c,go:u,href:d}=se(),f=e.name,p=Ue(a.views[f],t.list),m=(0,Z.useMemo)(()=>ct(p,e),[p,e]),{fields:h}=Te(),g=(0,Z.useMemo)(()=>Mi(ue(Oe(Ae(e,p),e,p,h),e,a.resources,a.views),e,p,a.resources,a.views),[e,p,h,a.resources,a.views]),_=t.filter,v=(0,Z.useMemo)(()=>pt(m,_),[m,_]),b=v.ok?v.state:Gt,x=v.ok?v.extras:[],{orderBy:w,filterLayout:T}=t,E=Ze(),ee=i(),[D,ne]=(0,Z.useState)(!1),re=n?[...x,n]:x,ae=oe(),ce=Mr({model:e,resources:a.resources,views:a.views,view:p,state:b,extras:re,titleOf:ae}),O=n?dt(m,b,re):v.ok?_:``,k=(0,Z.useMemo)(()=>ie(e,p,g.map(e=>e.id)),[e,p,g]),de=(0,Z.useMemo)(()=>st(p,a.resources,a.views,k),[p,a.resources,a.views,k]),A=en({resources:a.resources,views:a.views,model:e,columns:k,filter:O,orderBy:w,related:de}),j=Pe(e,p,t.display),M=Ie(f),N=n?void 0:rn(e,M),[fe,pe]=(0,Z.useState)(!1),P=fe&&N!==void 0,he=!j&&!P&&nn(p,N,w,O),ge=P||j?.kind!==`map`;S(ge);let _e=an(e,A.page,A.key,j?.kind===`custom`),ve=Si(),be=Ne(e,p),xe=e=>({key:e.id,title:String(typeof e[be]==`object`?e[be].name:e[be]??e.id),etag:typeof e.etag==`string`?e.etag:void 0,snapshot:e}),Se=p?.names?.singular??F(f),Ce=ha(e,p,M),{state:I}=Xe(),we=Yt(e),L=qt({model:e,view:p,restore:we,onReview:e=>u({kind:`record`,resource:f,key:e.key})}),Ee=Mt(e),De=p?.actions.some(e=>e.run?.kind===`delete`)??!1,R=(e,t=x)=>s({filter:dt(m,e,t)}),z=_a(x),ke=e=>{let t=x.filter(e=>e.kind!==`search`);R(b,e?[...t,ga.search(e)]:t)},B=p?.names?.plural??F(f),H=j?.kind===`calendar`||j?.kind===`timeline`||j?.kind===`board`&&Le(e)?void 0:j,U=H&&(0,X.jsx)(Dt,{model:e,view:p,display:H,orderBy:w,onChange:e=>s({orderBy:e})}),Re=e.search?.length?(0,X.jsx)(ji,{value:z?.kind===`search`?z.text:``,onCommit:ke,placeholder:Y(`searchPlural`,{plural:B}),className:E?void 0:`min-h-11`}):null,ze=(0,X.jsx)(Xn,{layout:T,config:ce,value:b,onChange:R,leading:T===`bar`?U:void 0,trailing:Re}),Be=T===`bar`?ze:(0,X.jsx)(Jn,{groups:[U?[U]:[]],trailing:Re}),Ve=yt(ce,b),We=(0,X.jsx)(On,{scroll:!0,chips:Ve,onRemove:e=>R(ut(b,e)),onClear:()=>R(Gt)}),Ge=H&&(0,X.jsx)(Fn,{title:Y(`sort`),children:(0,X.jsx)(Dt,{model:e,view:p,display:H,orderBy:w,onChange:e=>s({orderBy:e}),className:`min-h-11 w-full`})}),Qe=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(V,{className:`min-h-11`,onClick:()=>ne(!0),"aria-haspopup":`dialog`,children:[(0,X.jsx)(bn,{className:`size-3.5`}),Ve.length>0?Y(`filtersCount`,{count:Ve.length}):Y(`filters`)]}),Re??(0,X.jsx)(`div`,{className:`min-w-0 flex-1`,children:We})]}),Re&&We,(0,X.jsx)(Ye,{title:Y(`filters`),open:D,onClose:()=>ne(!1),children:(0,X.jsx)(Xn,{layout:`panel`,fullWidth:!0,config:ce,value:b,onChange:R,leading:Ge})})]}),$e=!n&&o(p,a.pages,M)&&(0,X.jsxs)(C,{to:{kind:`create`,resource:f},className:ye({variant:`primary`}),children:[(0,X.jsx)(Je,{className:`size-3.5`}),Y(`newRecord`,{singular:Se})]}),et=p?.saveSearch&&!n&&v.ok&&_&&(0,X.jsx)(ia,{model:e,view:p,search:p.saveSearch,filter:_,chips:mt(e,p,_,Nt(ce))}),G=!n&&(0,X.jsx)(Fr,{model:e}),tt=Yr({model:e,view:p,resources:a.resources,views:a.views,plural:B,filter:O,orderBy:w}),K=ar(p)&&(0,X.jsxs)(V,{onClick:()=>tt.open(),...!E&&{"aria-label":Y(`export`),title:Y(`export`)},children:[(0,X.jsx)(te,{className:`size-3.5`}),E&&Y(`export`)]}),rt=N&&!he&&(0,X.jsx)(Xt,{sorting:P,onChange:pe,iconOnly:!E}),it=t=>!P&&(0,X.jsx)(Bt,{view:p,choices:me(e,p,ee),value:j?.name??`table`,onChange:e=>s({display:e}),menu:t}),at=tn(e),ot=t=>{at(y(e,t).record),u({kind:`record`,resource:f,key:Ke(e,t)})},lt=async e=>{let t=e.map(xe),n=await L.startBulk(t);return e.filter((e,r)=>n.includes(t[r]))},q=A.source?(0,X.jsx)(vt,{columns:g,source:A.source,sort:He(w),onSortChange:e=>s({orderBy:qe(e)}),onOpenRow:ot,rowLink:t=>({href:d({kind:`record`,resource:f,key:Ke(e,t)}),onFollow:()=>ot(t)}),cellEditor:Ce.editor,rowPatches:Ce.patches,initialScrollIndex:ve.initialIndex,onScrollIndex:ve.remember,rowActions:[{label:Y(`openRecord`,{singular:Se}),onSelect:ot},...Ee.rowActions,...W(M,`delete`)&&!De?[{label:Y(`delete`),destructive:!0,available:e=>l(e,`delete`),onSelect:e=>void L.start(xe(e))}]:[]],bulkActions:[...ar(p)&&dr(e)?[{label:e=>Y(`exportCount`,{count:e}),onRun:e=>tt.open(e)}]:[],...Ee.bulkActions,...W(M,`delete`)?[{label:e=>Y(`deleteCount`,{count:e}),destructive:!0,onRun:e=>lt(e)}]:[]],rowNumbers:!1,pinKey:I.kind===`signed-in`?Ot(I.user.id,le(f,t.list)):void 0,scroll:`parent`,className:`flex-1`}):(0,X.jsx)(`div`,{"aria-busy":!0,className:`flex-1 rounded-lg border bg-surface`}),ft={...A,initialIndex:ve.initialIndex,onScrollIndex:ve.remember},ht=Zr({plural:B,search:z?.kind===`search`?z.text:``,filtered:Ve.length>0,scoped:!!n||x.some(e=>e.kind!==`search`),canCreate:!!$e}),gt=(0,X.jsx)(Xr,{state:ht,onClearSearch:()=>ke(``),onClearFilters:()=>R(Gt),create:$e}),_t=P?(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:Y(`dragToSort`)}),(0,X.jsx)(Jt,{model:e,view:p,field:N,filter:``,columns:Fe(e,p)})]}):he?(0,X.jsx)(Jt,{model:e,view:p,field:N,filter:``,columns:Fe(e,p),sort:{value:He(w),onChange:e=>s({orderBy:qe(e)})}}):j?j.kind===`cards`?(0,X.jsx)(fi,{model:e,view:p,display:j,list:ft,empty:gt},A.key.join(` `)):j.kind===`map`?(0,X.jsx)(jt,{model:e,view:p,display:j,filter:O,orderBy:w,fields:k,at:t.map,onMove:e=>s({map:e}),flush:!0}):j.kind===`board`?(0,X.jsx)(kt,{model:e,view:p,display:j,fields:k,filter:O,orderBy:w}):j.kind===`calendar`?(0,X.jsx)(Lt,{model:e,view:p,display:j,fields:k,filter:O,at:t.calendar,linkTo:e=>c({calendar:e})}):j.kind===`timeline`?(0,X.jsx)(Ft,{model:e,view:p,display:j,fields:k,filter:O,at:t.timeline,linkTo:e=>c({timeline:e})}):(0,X.jsx)(Vt,{display:j,list:_e}):A.source?.total===0&&!A.error?gt:q;return(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-5 py-4`,children:[L.dialogs,tt.dialogs,Ee.prompt,(0,X.jsx)(Qt,{title:r?.title??B,subtitle:r?r.subtitle:p?.help,subtitleBelow:!0,actions:(0,X.jsxs)(X.Fragment,{children:[it(!E),rt,et,G,K,$e]})}),!v.ok&&(0,X.jsx)(je,{title:Y(`unreadableFilter`),error:Error(v.errors.map(e=>e.message).join(`; `))}),A.error&&!j&&!P&&(0,X.jsx)(je,{title:Y(`couldNotLoadRows`),error:A.error}),p?.chart&&!P&&(nt(p.chart)?(0,X.jsx)(Ai,{model:e,view:p,chart:p.chart,plural:B,filter:O}):(0,X.jsx)(Oi,{resource:f,chart:p.chart,title:Y(`created`,{plural:B}),filter:O})),!P&&(E?Be:Qe),E&&T===`panel`&&!P?(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-4`,children:[(0,X.jsx)(`div`,{className:ge?`sticky top-[calc(var(--pb-sticky-top,0px)+1rem)] flex max-h-[calc(100dvh-var(--pb-sticky-top,0px)-var(--pb-sticky-bottom,0px)-2rem)] shrink-0 self-start`:`flex shrink-0`,children:ze}),_t]}):_t]})};export{va as ListPage,xr as a,_r as c,mr as d,pr as f,un as h,Sr as i,hr as l,Q as m,wr as n,vr as o,ur as p,Cr as r,br as s,Er as t,gr as u};
4
+ //# debugId=97ac1d40-b3ee-4916-8279-10a99e1bdf93
@@ -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{Hc as r,Hl as i,Nc as a,ho as o}from"./app-B48LQpC1.js";import{i as s,n as c,r as l,t as u}from"./lib-maplibre-gl-CFGgq6sa.js";import{n as d,o as f,t as p}from"./lib-vis.gl-react-maplibre-1cv426UN.js";import{t as m}from"./lib-pmtiles-G7iEFxNu.js";var h={name:`map-pin`,size:24,node:[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]};h.node;var g=a(h),_=e(t(),1),v=`protobase:map-layer`,y=(e,t)=>e.find(e=>e.id===t),b=e=>i(()=>e.getItem(v),null),x=(e,t)=>i(()=>t===void 0?e.removeItem(v):e.setItem(v,t),void 0),S=r(`app/map`),C=e(n(),1),w=``,T=({layers:e,below:t})=>{let[n,r]=(0,_.useState)(()=>b(localStorage)),{current:i}=f();if(!e||e.length===0)return null;let a=y(e,n),s=e=>{let t=e===w?void 0:e;x(localStorage,t),r(t??null)},c=t&&i?.getLayer(t)?t:void 0;return(0,C.jsxs)(C.Fragment,{children:[a&&(0,C.jsx)(d,{id:`map-layer-${a.id}`,type:`raster`,tiles:[a.tiles],tileSize:256,attribution:a.attribution,maxzoom:a.maxzoom??22,...a.bounds&&{bounds:a.bounds},children:(0,C.jsx)(p,{id:`map-layer-${a.id}`,type:`raster`,...c&&{beforeId:c}})},a.id),(0,C.jsx)(`div`,{className:`absolute left-2.5 top-2.5 z-10 rounded-md shadow`,children:(0,C.jsx)(o,{label:S(`mapLayer`),value:a?.id??w,onChange:s,options:[{value:w,label:S(`map`)},...e.map(e=>({value:e.id,label:e.label}))]})})]})};l(u),c(`pmtiles`,new m().tile);var E=s;export{T as n,g as r,E as t};
2
- //# debugId=8b968069-fd74-4b04-aa3e-81d71cc16d5f
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{Ql as r,Vc as i,Xc as a,bo as o}from"./app-Bu6FwwHZ.js";import{i as s,n as c,r as l,t as u}from"./lib-maplibre-gl-CFGgq6sa.js";import{n as d,o as f,t as p}from"./lib-vis.gl-react-maplibre-1cv426UN.js";import{t as m}from"./lib-pmtiles-G7iEFxNu.js";var h={name:`map-pin`,size:24,node:[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]};h.node;var g=i(h),_=e(t(),1),v=`protobase:map-layer`,y=(e,t)=>e.find(e=>e.id===t),b=e=>r(()=>e.getItem(v),null),x=(e,t)=>r(()=>t===void 0?e.removeItem(v):e.setItem(v,t),void 0),S=a(`app/map`),C=e(n(),1),w=``,T=({layers:e,below:t})=>{let[n,r]=(0,_.useState)(()=>b(localStorage)),{current:i}=f();if(!e||e.length===0)return null;let a=y(e,n),s=e=>{let t=e===w?void 0:e;x(localStorage,t),r(t??null)},c=t&&i?.getLayer(t)?t:void 0;return(0,C.jsxs)(C.Fragment,{children:[a&&(0,C.jsx)(d,{id:`map-layer-${a.id}`,type:`raster`,tiles:[a.tiles],tileSize:256,attribution:a.attribution,maxzoom:a.maxzoom??22,...a.bounds&&{bounds:a.bounds},children:(0,C.jsx)(p,{id:`map-layer-${a.id}`,type:`raster`,...c&&{beforeId:c}})},a.id),(0,C.jsx)(`div`,{className:`absolute left-2.5 top-2.5 z-10 rounded-md shadow`,children:(0,C.jsx)(o,{label:S(`mapLayer`),value:a?.id??w,onChange:s,options:[{value:w,label:S(`map`)},...e.map(e=>({value:e.id,label:e.label}))]})})]})};l(u),c(`pmtiles`,new m().tile);var E=s;export{T as n,g as r,E as t};
2
+ //# debugId=9df73777-cbd5-428c-b832-b9f127899468
@@ -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{L as r,Pc as i}from"./app-B48LQpC1.js";import{t as a}from"./lib-dompurify-Dr60P-Rn.js";import{t as o}from"./lib-marked-Bg9_sE-m.js";var s=e(t(),1),c=(e,t)=>t===0?e:Math.min(6,Math.max(t+1,e+t-1)),l={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},u=e=>e.replace(/[&<>"']/g,e=>l[e]),d=/^([a-z][a-z0-9+.-]*):/i,f=new Set([`http`,`https`,`mailto`,`tel`]),p=new Set([`http`,`https`]),m=/[\u0000-\u0020\u007f]/g,h=(e,t)=>{let n=d.exec(e.replace(m,``))?.[1]?.toLowerCase();if(n!==void 0&&!t.has(n))return null;try{return encodeURI(e).replace(/%25/g,`%`)}catch(e){if(e instanceof URIError)return null;throw e}},g=e=>e?` title="${u(e)}"`:``,_=({inLink:e=!1})=>new o({gfm:!0,breaks:!0,renderer:{html:({text:e,block:t})=>t?`<p>${u(e)}</p>`:u(e),link({href:t,title:n,tokens:r}){let i=this.parser.parseInline(r),a=e?null:h(t,f);return a===null?i:`<a href="${u(a)}"${g(n)} target="_blank" rel="noopener noreferrer nofollow">${i}</a>`},image({href:t,title:n,text:r}){let i=e?null:h(t,p);return i===null?u(r):`<img src="${u(i)}" alt="${u(r)}"${g(n)} loading="lazy">`}}}),v={inLink:_({inLink:!0}),page:_({})},y=(e,{inLink:t=!1,headingsUnder:n=0}={})=>{let r=t?v.inLink:v.page,i=r.lexer(e);return r.walkTokens(i,e=>{e.type===`heading`&&(e.depth=c(e.depth,n))}),r.parser(i)},b=e(n(),1),x=i(`break-words [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,`[&_p]:my-2 [&_ul]:my-2 [&_ol]:my-2 [&_pre]:my-2 [&_blockquote]:my-2 [&_table]:my-2 [&_hr]:my-3`,`[&_h1]:mt-4 [&_h1]:mb-2 [&_h1]:text-lg [&_h1]:font-semibold [&_h2]:mt-4 [&_h2]:mb-2 [&_h2]:text-base [&_h2]:font-semibold`,`[&_h3]:mt-3 [&_h3]:mb-1 [&_h3]:font-semibold [&_h4]:mt-3 [&_h4]:mb-1 [&_h4]:font-semibold [&_h5]:font-semibold [&_h6]:font-semibold`,`[&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5 [&_li:has(>input)]:list-none [&_li>input]:mr-1.5 [&_li>input]:-ml-5 [&_li>input]:align-middle`,`[&_a]:text-primary-text [&_a]:underline [&_a]:underline-offset-2 hover:[&_a]:text-primary-hover`,`[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.9em]`,`[&_pre]:whitespace-pre-wrap [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre_code]:bg-transparent [&_pre_code]:p-0`,`[&_blockquote]:border-l-2 [&_blockquote]:border-border-strong [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground`,`[&_table]:w-full [&_table]:border-collapse [&_th]:border [&_th]:border-border [&_th]:bg-surface [&_th]:px-2 [&_th]:py-1 [&_th]:text-left [&_th]:font-semibold`,`[&_td]:border [&_td]:border-border [&_td]:px-2 [&_td]:py-1 [&_td]:[overflow-wrap:anywhere]`,`[&_hr]:border-border [&_img]:inline [&_img]:max-w-full [&_img]:rounded [&_del]:text-muted-foreground`),S=i(`[&_*]:my-0 [&_h1]:font-semibold [&_h2]:font-semibold [&_h3]:font-semibold [&_ul]:list-inside [&_ol]:list-inside [&_pre]:whitespace-pre-wrap [&_code]:font-mono [&_code]:text-[0.9em]`),C=({source:e,inLink:t=!1,className:n})=>{let o=r(),c=(0,s.useMemo)(()=>a.sanitize(y(e,{inLink:t,headingsUnder:o}),{ADD_ATTR:[`target`]}),[e,t,o]);return(0,b.jsx)(`div`,{className:i(t?S:x,n),dangerouslySetInnerHTML:{__html:c}})};export{C as MarkdownContent};
2
- //# debugId=8457de36-3da4-4575-926a-16ecd390a734
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{Hc as r,L as i}from"./app-Bu6FwwHZ.js";import{t as a}from"./lib-dompurify-Dr60P-Rn.js";import{t as o}from"./lib-marked-Bg9_sE-m.js";var s=e(t(),1),c=(e,t)=>t===0?e:Math.min(6,Math.max(t+1,e+t-1)),l={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},u=e=>e.replace(/[&<>"']/g,e=>l[e]),d=/^([a-z][a-z0-9+.-]*):/i,f=new Set([`http`,`https`,`mailto`,`tel`]),p=new Set([`http`,`https`]),m=/[\u0000-\u0020\u007f]/g,h=(e,t)=>{let n=d.exec(e.replace(m,``))?.[1]?.toLowerCase();if(n!==void 0&&!t.has(n))return null;try{return encodeURI(e).replace(/%25/g,`%`)}catch(e){if(e instanceof URIError)return null;throw e}},g=e=>e?` title="${u(e)}"`:``,_=({inLink:e=!1})=>new o({gfm:!0,breaks:!0,renderer:{html:({text:e,block:t})=>t?`<p>${u(e)}</p>`:u(e),link({href:t,title:n,tokens:r}){let i=this.parser.parseInline(r),a=e?null:h(t,f);return a===null?i:`<a href="${u(a)}"${g(n)} target="_blank" rel="noopener noreferrer nofollow">${i}</a>`},image({href:t,title:n,text:r}){let i=e?null:h(t,p);return i===null?u(r):`<img src="${u(i)}" alt="${u(r)}"${g(n)} loading="lazy">`}}}),v={inLink:_({inLink:!0}),page:_({})},y=(e,{inLink:t=!1,headingsUnder:n=0}={})=>{let r=t?v.inLink:v.page,i=r.lexer(e);return r.walkTokens(i,e=>{e.type===`heading`&&(e.depth=c(e.depth,n))}),r.parser(i)},b=e(n(),1),x=r(`break-words [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,`[&_p]:my-2 [&_ul]:my-2 [&_ol]:my-2 [&_pre]:my-2 [&_blockquote]:my-2 [&_table]:my-2 [&_hr]:my-3`,`[&_h1]:mt-4 [&_h1]:mb-2 [&_h1]:text-lg [&_h1]:font-semibold [&_h2]:mt-4 [&_h2]:mb-2 [&_h2]:text-base [&_h2]:font-semibold`,`[&_h3]:mt-3 [&_h3]:mb-1 [&_h3]:font-semibold [&_h4]:mt-3 [&_h4]:mb-1 [&_h4]:font-semibold [&_h5]:font-semibold [&_h6]:font-semibold`,`[&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5 [&_li:has(>input)]:list-none [&_li>input]:mr-1.5 [&_li>input]:-ml-5 [&_li>input]:align-middle`,`[&_a]:text-primary-text [&_a]:underline [&_a]:underline-offset-2 hover:[&_a]:text-primary-hover`,`[&_code]:rounded [&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.9em]`,`[&_pre]:whitespace-pre-wrap [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre_code]:bg-transparent [&_pre_code]:p-0`,`[&_blockquote]:border-l-2 [&_blockquote]:border-border-strong [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground`,`[&_table]:w-full [&_table]:border-collapse [&_th]:border [&_th]:border-border [&_th]:bg-surface [&_th]:px-2 [&_th]:py-1 [&_th]:text-left [&_th]:font-semibold`,`[&_td]:border [&_td]:border-border [&_td]:px-2 [&_td]:py-1 [&_td]:[overflow-wrap:anywhere]`,`[&_hr]:border-border [&_img]:inline [&_img]:max-w-full [&_img]:rounded [&_del]:text-muted-foreground`),S=r(`[&_*]:my-0 [&_h1]:font-semibold [&_h2]:font-semibold [&_h3]:font-semibold [&_ul]:list-inside [&_ol]:list-inside [&_pre]:whitespace-pre-wrap [&_code]:font-mono [&_code]:text-[0.9em]`),C=({source:e,inLink:t=!1,className:n})=>{let o=i(),c=(0,s.useMemo)(()=>a.sanitize(y(e,{inLink:t,headingsUnder:o}),{ADD_ATTR:[`target`]}),[e,t,o]);return(0,b.jsx)(`div`,{className:r(t?S:x,n),dangerouslySetInnerHTML:{__html:c}})};export{C as MarkdownContent};
2
+ //# debugId=aa2a6da4-bbdd-412b-8f6c-d66d08d74ff0
@@ -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,Jo as i,Ka as a,Ma as o,Oa as s,Ss as c,Ya as l,Yc as u,Yo as d,Za as f,eo as p,go as m,lc as h,sc as g,ys as _}from"./app-Bu6FwwHZ.js";import{o as v}from"./vendor-t7Q7QbPu.js";import{t as y}from"./page-header-Ddz2r5ic.js";import{n as b,t as x}from"./person-row-4RzpLZJE.js";var S=e(t(),1),C=e(n(),1),w=e=>e?.role===`owner`?[`owner`,`admin`,`member`]:[`admin`,`member`],T=({member:e,current:t,status:n,presence:r,onChanged:i})=>{let{session:o,organizations:c}=_(),u=s(),d=t.organization.id,{busy:h,error:v,run:y}=a(),S=c?.roles??[],T=e.id===t.memberId,E=w(t),D=e.role===`owner`&&t.role!==`owner`,O=S.filter(e=>e.membership);return(0,C.jsx)(x,{name:e.name,email:e.email,self:T,error:v,...(n||r)&&{status:(0,C.jsx)(m,{status:n,presence:r})},actions:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`select`,{"aria-label":u(`roleOf`,{name:e.name}),value:e.role,disabled:h||D,onChange:t=>void y(async()=>{await o.organizations.setRole(d,e.id,t.target.value),i()}),className:`h-7 rounded-md border border-border-strong bg-background px-2 text-body`,children:(D?[e.role]:E).map(e=>(0,C.jsx)(`option`,{value:e,children:f(e)},e))}),!T&&(0,C.jsx)(g,{size:`sm`,variant:`danger`,loading:h,disabled:D,onClick:()=>void y(async()=>{await o.organizations.removeMember(d,e.id),i()}),children:p(`remove`)})]}),children:(0,C.jsx)(b,{roles:O,selected:e.appRoles,grantable:l(S,t),disabled:h,onChange:t=>void y(async()=>{await o.organizations.setAppRoles(e.id,t),i()})})})},E=({current:e,statuses:t,presence:n})=>{let{session:a}=_(),l=s(),f=e?.organization?.id,m=v({queryKey:u.organizationMembers(f??``),queryFn:()=>a.organizations.members(f),enabled:!!f,retry:!1}),g=m.data,b=m.error?m.error instanceof c?r(m.error):p(`couldNotReadMembers`):void 0,{refetch:x}=m,w=(0,S.useCallback)(()=>void x(),[x]);return e?.organization?(0,C.jsxs)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-6 md:px-6`,children:[(0,C.jsx)(y,{title:p(`members`),subtitle:p(`whoWorks`,{organization:e.organization.name})}),(0,C.jsxs)(i,{title:p(`members`),description:l(`membersDescription`),children:[(0,C.jsx)(d,{message:b}),g?(0,C.jsx)(`ul`,{className:`divide-y rounded-md border`,children:g.map(r=>(0,C.jsx)(T,{member:r,current:e,status:t?.find(e=>e.userId===r.userId),presence:o(n,r.userId),onChanged:w},`${r.id}/${r.role}/${r.appRoles.join()}`))}):!b&&(0,C.jsxs)(`div`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,C.jsx)(h,{}),` `,p(`loading`)]})]})]}):null};export{E as MembersPage,w as assignableOrganizationRoles};
2
+ //# debugId=daec00e6-0476-4205-b7dd-4fc44b290550
@@ -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{Gl as e,Kl as t,Ks as n,Xc as r,al as i,fl as a,li as o,va as s,wa as c,xa as l}from"./app-Bu6FwwHZ.js";var u=(e,t)=>{let n=e.position;if(!n||!c(t,`update`))return;let r=e.fields[n.field];return r&&!r.readOnly?n.field:void 0},d=(e,t)=>e.position?.within===void 0?u(e,t):void 0,f=(e,t,n)=>t.position?.within!==void 0&&e.field===t.position.within&&!e.through&&!e.from&&!e.filter?u(t,n):void 0,p=(e,t,n,r)=>{if(t===void 0||e?.list?.drag?.rank!==!0||r!==``)return!1;let i=s(n);return i.columnId===t&&i.direction===`asc`},m=r(`app/hand-order`),h=(e,t,{title:r,place:i})=>!n(e)||e.status!==412?{state:`error`,title:t,description:o(e)}:r===void 0?{state:`warning`,title:t,description:m(`orderChangedSince`,{place:i})}:{state:`warning`,title:m(`notSaved`,{title:r}),description:m(`orderChangedThere`,{place:i})},g=(e,t,n)=>t.flatMap(({before:t,record:r,etag:i})=>{let a=n.filter(e=>Object.hasOwn(t,e)&&t[e]!==r[e]);return a.length===0?[]:[{op:`update`,resource:e.name,key:l(e,r),data:Object.fromEntries(a.map(e=>[e,t[e]])),etag:i}]}),_=async(e,t,n)=>{let r=[],i=``;do{let a=await e.search(t,{filter:n,pageSize:100,...i&&{pageToken:i}});r.push(...a.items),i=a.nextPageToken}while(i);return r},v=(e,t)=>t===void 0?e:`(${e}) AND (${t})`,y=async(n,r,o,s)=>{let c=r.position?.after;if(!c)return{after:[],before:[]};let u=r.primaryKey[0],d=l(r,s),f=e=>a([e]),p=await _(n,c.resource,v(t(e.or(e.eq(c.field,d),e.eq(c.key,d))),c.filter)),m=(e,t)=>p.flatMap(n=>f(n[e])===f(d)&&f(n[t])!==f(d)?[n[t]]:[]),h=m(c.field,c.key),g=m(c.key,c.field),[y,b]=await Promise.all([_(n,r.name,v(t(e.in(u,[d,...h])),c.while)),g.length===0?[]:_(n,r.name,t(e.in(u,g)))]),x=e=>{let t=a(l(r,e));return{key:t,rank:e[r.position.field],title:i(r,o,e,t)}},S=y.some(e=>f(e[u])===f(d));return{after:y.filter(e=>f(e[u])!==f(d)).map(x),before:S?b.map(x):[]}},b=(e,t,n,r,i,a=!1)=>{let o=t=>r[t]?l(e,r[t]):null,s=a&&i===r.length-1;return{op:`move`,resource:e.name,field:t,key:l(e,r[i]),after:o(i-1),...!s&&{before:o(i+1)},...n&&{filter:n}}},x=(e,t)=>{let n=new Map;for(let r of e)if(r.op===`reorder`||r.op===`move`)for(let e of r.records){let r=t(e.record);n.has(r)||n.set(r,e.previous)}return n},S=r(`app/rank-after`);export{g as a,p as c,y as i,d as l,x as n,h as o,b as r,m as s,S as t,f as u};
2
+ //# debugId=19693349-e6af-4f1a-a8b1-1bf14a707592