@protobase/ui 0.120.0 → 0.121.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/dist/account/blocks/personal-mail-block.js +4 -0
  2. package/dist/account/messages.d.ts +2 -2
  3. package/dist/activity-chart/messages.d.ts +2 -2
  4. package/dist/app/charts/messages.d.ts +2 -2
  5. package/dist/app/comments/messages.d.ts +2 -2
  6. package/dist/app/conversation/messages.d.ts +2 -2
  7. package/dist/app/conversation/thread-state.d.ts +1 -1
  8. package/dist/app/conversation-page/messages.d.ts +2 -2
  9. package/dist/app/create/messages.d.ts +2 -2
  10. package/dist/app/delete/messages.d.ts +2 -2
  11. package/dist/app/displays/messages.d.ts +2 -2
  12. package/dist/app/embedded-list/messages.d.ts +2 -2
  13. package/dist/app/export/builder.js +2 -1
  14. package/dist/app/export/messages.d.ts +2 -2
  15. package/dist/app/field-editor.js +8 -1
  16. package/dist/app/field-errors.js +2 -1
  17. package/dist/app/field-messages.d.ts +2 -2
  18. package/dist/app/field-types/custom-step-container/messages.d.ts +2 -2
  19. package/dist/app/field-types/workflow/messages.d.ts +2 -2
  20. package/dist/app/field-types/workflow-page/messages.d.ts +2 -2
  21. package/dist/app/field-types/workflow-page/workbench-bar.js +1 -1
  22. package/dist/app/field-types/workflow-run/messages.d.ts +2 -2
  23. package/dist/app/focus/messages.d.ts +2 -2
  24. package/dist/app/gallery/gallery-layout.d.ts +2 -2
  25. package/dist/app/gallery/messages.d.ts +2 -2
  26. package/dist/app/hand-order/messages.d.ts +2 -2
  27. package/dist/app/history/messages.d.ts +2 -2
  28. package/dist/app/import/messages.d.ts +2 -2
  29. package/dist/app/messages.d.ts +2 -2
  30. package/dist/app/pages/field-value.d.ts +1 -1
  31. package/dist/app/pages/field-value.js +3 -1
  32. package/dist/app/pages/messages.d.ts +2 -2
  33. package/dist/app/record-chart/messages.d.ts +2 -2
  34. package/dist/app/record-messages.d.ts +2 -2
  35. package/dist/app/record-mode/shown-layout.d.ts +1 -1
  36. package/dist/app/record-row/messages.d.ts +2 -2
  37. package/dist/app/related-cards/messages.d.ts +2 -2
  38. package/dist/app/runtime/messages.d.ts +2 -2
  39. package/dist/app/saved/messages.d.ts +2 -2
  40. package/dist/app/search/messages.d.ts +2 -2
  41. package/dist/app/searches/messages.d.ts +2 -2
  42. package/dist/app-shell/messages.d.ts +2 -2
  43. package/dist/assistant-dock/messages.d.ts +2 -2
  44. package/dist/auth/messages.d.ts +2 -2
  45. package/dist/calls/messages.d.ts +2 -2
  46. package/dist/data-grid/messages.d.ts +2 -2
  47. package/dist/filter-panel/messages.d.ts +2 -2
  48. package/dist/index.js +1 -1
  49. package/dist/invitations/messages.d.ts +2 -2
  50. package/dist/live/field-values.js +2 -1
  51. package/dist/locale/en.js +9 -1
  52. package/dist/locale/en.json.d.ts +8 -0
  53. package/dist/locale/messages.d.ts +16 -0
  54. package/dist/locale/nl.js +9 -1
  55. package/dist/mailbox/mail-sender-select.d.ts +23 -0
  56. package/dist/mailbox/mail-sender-select.js +81 -0
  57. package/dist/mailbox/mailbox-connect.js +1 -1
  58. package/dist/mailbox/messages.d.ts +2 -2
  59. package/dist/mailbox/sender-options-read.d.ts +14 -0
  60. package/dist/mailbox/sender-options-read.js +31 -0
  61. package/dist/mailbox/sender-options.d.ts +17 -0
  62. package/dist/mailbox/sender-options.js +17 -0
  63. package/dist/mailbox/use-sender-options.d.ts +14 -0
  64. package/dist/mailbox/use-sender-options.js +57 -0
  65. package/dist/mentions/messages.d.ts +2 -2
  66. package/dist/notifications/bell/messages.d.ts +2 -2
  67. package/dist/organizations/messages.d.ts +2 -2
  68. package/dist/package.js +1 -1
  69. package/dist/primitives/messages.d.ts +2 -2
  70. package/dist/shell/assets/{account-page-D0LQgPBu.js → account-page-BejiSHKM.js} +2 -2
  71. package/dist/shell/assets/app-BXbP4Ty1.js +34 -0
  72. package/dist/shell/assets/{assistant-shell-t6EYCEG6.js → assistant-shell-BWbl-WEv.js} +2 -2
  73. package/dist/shell/assets/board-display-CoJK20M9.js +2 -0
  74. package/dist/shell/assets/calendar-display-iYqswJgc.js +2 -0
  75. package/dist/shell/assets/{call-rings-C5ud3oUx.js → call-rings-Cwk4WNlZ.js} +2 -2
  76. package/dist/shell/assets/{calls-5vjQEKRi.js → calls-DxBhpisW.js} +2 -2
  77. package/dist/shell/assets/{circle-alert-D4sTiwNu.js → circle-alert-C9H3FqM7.js} +2 -2
  78. package/dist/shell/assets/composed-page-1q5wrcUN.js +2 -0
  79. package/dist/shell/assets/{composer-section-Dp-xM9-b.js → composer-section-CsrTm8Ss.js} +2 -2
  80. package/dist/shell/assets/{connect-route-DkjLawxM.js → connect-route-BY5fhvuR.js} +2 -2
  81. package/dist/shell/assets/{copy-field-B14w71cy.js → copy-field-CN_wHY_K.js} +2 -2
  82. package/dist/shell/assets/create-route-CkONKdX6.js +2 -0
  83. package/dist/shell/assets/{custom-step-container-field-CXzhDKB8.js → custom-step-container-field-B0adLm01.js} +4 -4
  84. package/dist/shell/assets/embedded-list-Nomt6OUK.js +3 -0
  85. package/dist/shell/assets/en-C_BQKBSV.js +2 -0
  86. package/dist/shell/assets/{export-dialog-CCnbhHYq.js → export-dialog-C7Gpq0EK.js} +2 -2
  87. package/dist/shell/assets/export-worker-C46NatsO.js +15 -0
  88. package/dist/shell/assets/{first-organization-page-NFqF-XyH.js → first-organization-page-B9Qj8EgA.js} +2 -2
  89. package/dist/shell/assets/{graph-view-CnMNqiV4.js → graph-view-BU3sYZDD.js} +2 -2
  90. package/dist/shell/assets/{group-donut-BbP0DJKg.js → group-donut-MrMdALOR.js} +2 -2
  91. package/dist/shell/assets/{guest-call-page-R7GFfBV-.js → guest-call-page-Cf-QdD6u.js} +3 -3
  92. package/dist/shell/assets/{html-viewer-DoOxyTcM.js → html-viewer-4q3cR5U2.js} +2 -2
  93. package/dist/shell/assets/{import-dialog-_5Szg-jU.js → import-dialog-CBT7GHQ6.js} +2 -2
  94. package/dist/shell/assets/{import-table-dialog-njI8BoS4.js → import-table-dialog-DNPoaf3W.js} +2 -2
  95. package/dist/shell/assets/{index-BbZazL12.js → index-CrsKmqF6.js} +1 -1
  96. package/dist/shell/assets/{invitations-page-EV-UUQ6b.js → invitations-page-T5Zl42lB.js} +2 -2
  97. package/dist/shell/assets/{layout-grid-B0-CJOlT.js → layout-grid-C0JKQ-Vr.js} +2 -2
  98. package/dist/shell/assets/{legend-item-DlKFFY7e.js → legend-item-BC8NMrG0.js} +2 -2
  99. package/dist/shell/assets/{lib-zod-B92j-KH2.js → lib-zod-CxxP7Qhu.js} +2 -2
  100. package/dist/shell/assets/list-page-Dt2tN3Li.js +4 -0
  101. package/dist/shell/assets/{maplibre-B6nwN1UZ.js → maplibre-CBGBPT2u.js} +2 -2
  102. package/dist/shell/assets/{markdown-content-C8sLopWJ.js → markdown-content-CE3gKAHx.js} +2 -2
  103. package/dist/shell/assets/members-page-RClHb_e8.js +2 -0
  104. package/dist/shell/assets/{message-content-BkvkBtPr.js → message-content-OCOwOHzz.js} +3 -3
  105. package/dist/shell/assets/messages-9TFLyKlr.js +2 -0
  106. package/dist/shell/assets/nl-DzJ_yv1H.js +2 -0
  107. package/dist/shell/assets/organization-page-BVWyQvBY.js +2 -0
  108. package/dist/shell/assets/organizations-page-Bn3IY_Zs.js +2 -0
  109. package/dist/shell/assets/parse-worker-COWuolaE.js +35 -0
  110. package/dist/shell/assets/{pending-invitation-row-D4gFapdv.js → pending-invitation-row-D58juRaB.js} +2 -2
  111. package/dist/shell/assets/{period-chart-ChFHNTEE.js → period-chart-DSnwMzgV.js} +2 -2
  112. package/dist/shell/assets/{person-row-YwRtkzbb.js → person-row-shwrR0nf.js} +2 -2
  113. package/dist/shell/assets/public-form-page-o8AZ5FHd.js +2 -0
  114. package/dist/shell/assets/{record-lines-D1wftBQA.js → record-lines-fwUdQsF7.js} +2 -2
  115. package/dist/shell/assets/{record-map-BEOxTNu4.js → record-map-3vSnFihG.js} +2 -2
  116. package/dist/shell/assets/{record-opens-C9579izg.js → record-opens-BjvGP76q.js} +2 -2
  117. package/dist/shell/assets/record-page-oAgFQCZx.js +3 -0
  118. package/dist/shell/assets/{record-preview-eCoWviA9.js → record-preview-bznf4p6C.js} +2 -2
  119. package/dist/shell/assets/{records-map-DVETi1eC.js → records-map-BZ9IztOw.js} +2 -2
  120. package/dist/shell/assets/render-node-D-4-E94O.js +3 -0
  121. package/dist/shell/assets/reorder-button-B6J3Gmzg.js +2 -0
  122. package/dist/shell/assets/{run-trace-view-DC8UUfeb.js → run-trace-view-B_bJcy_e.js} +2 -2
  123. package/dist/shell/assets/{runner-install-field-BmVLaBtB.js → runner-install-field-Dg5VV1Bz.js} +2 -2
  124. package/dist/shell/assets/{runtime-update-CTsM8FBn.js → runtime-update-CkX7qK0y.js} +2 -2
  125. package/dist/shell/assets/shared-protobase-ui-Bmj9LnMR.js +1 -0
  126. package/dist/shell/assets/{sheet-source-BbBLftOM.js → sheet-source-De92TWm8.js} +3 -3
  127. package/dist/shell/assets/sign-in-policy-page-P6Z6NlWj.js +2 -0
  128. package/dist/shell/assets/start-block-queries-sM50NWuR.js +2 -0
  129. package/dist/shell/assets/step-catalog-C6uiLqhG.js +2 -0
  130. package/dist/shell/assets/{step-panel-CEluX3Jl.js → step-panel-BtgXKvBb.js} +2 -2
  131. package/dist/shell/assets/timeline-display-CFYOr7ER.js +2 -0
  132. package/dist/shell/assets/{trash-Ba3Y5_30.js → trash-hWgXyHxA.js} +2 -2
  133. package/dist/shell/assets/{update-set-D2mI0J7M.js → update-set-jWhZWR7M.js} +2 -2
  134. package/dist/shell/assets/use-calendar-move-B902R-oH.js +2 -0
  135. package/dist/shell/assets/{use-display-rows-DIoyxucI.js → use-display-rows-DRKftIme.js} +2 -2
  136. package/dist/shell/assets/use-my-invitations-BmYWQO42.js +2 -0
  137. package/dist/shell/assets/{use-paged-search-DjnlXbQ5.js → use-paged-search-CQZq-5QD.js} +2 -2
  138. package/dist/shell/assets/{use-run-trace-2fQX9FeC.js → use-run-trace-CP67JSwu.js} +2 -2
  139. package/dist/shell/assets/{use-workflow-page-D8Vn1I90.js → use-workflow-page-DyT1T2px.js} +2 -2
  140. package/dist/shell/assets/{use-workflow-types-DpNGPeuE.js → use-workflow-types-DPCbdYrq.js} +2 -2
  141. package/dist/shell/assets/{workflow-canvas-CZ6QjuM6.js → workflow-canvas-DmxNQs0O.js} +4 -4
  142. package/dist/shell/assets/{workflow-field-CLeslVkB.js → workflow-field-DbMcq81f.js} +3 -3
  143. package/dist/shell/assets/{workflow-graph-editor-CirmaYcy.js → workflow-graph-editor-C9BYEvXl.js} +2 -2
  144. package/dist/shell/assets/{workflow-run-field-DgVAi0nl.js → workflow-run-field-jJu07psu.js} +3 -3
  145. package/dist/shell/assets/workflow-status-field-Dr5AeWYR.js +2 -0
  146. package/dist/shell/assets/workflow-workbench-DDVq899p.js +4 -0
  147. package/dist/shell/index.html +3 -3
  148. package/dist/shell/protobase.shell.json +2 -2
  149. package/dist/shell/protobase.sw.js +2 -2
  150. package/dist/shell-source-maps/assets/{account-page-D0LQgPBu.js.map → account-page-BejiSHKM.js.map} +1 -1
  151. package/dist/shell-source-maps/assets/app-BXbP4Ty1.js.map +1 -0
  152. package/dist/shell-source-maps/assets/{assistant-shell-t6EYCEG6.js.map → assistant-shell-BWbl-WEv.js.map} +1 -1
  153. package/dist/shell-source-maps/assets/{board-display-BF6sraBq.js.map → board-display-CoJK20M9.js.map} +1 -1
  154. package/dist/shell-source-maps/assets/{calendar-display-DdgRC4MC.js.map → calendar-display-iYqswJgc.js.map} +1 -1
  155. package/dist/shell-source-maps/assets/{call-rings-C5ud3oUx.js.map → call-rings-Cwk4WNlZ.js.map} +1 -1
  156. package/dist/shell-source-maps/assets/{calls-5vjQEKRi.js.map → calls-DxBhpisW.js.map} +1 -1
  157. package/dist/shell-source-maps/assets/{circle-alert-D4sTiwNu.js.map → circle-alert-C9H3FqM7.js.map} +1 -1
  158. package/dist/shell-source-maps/assets/{composed-page-BWauYpuf.js.map → composed-page-1q5wrcUN.js.map} +1 -1
  159. package/dist/shell-source-maps/assets/{composer-section-Dp-xM9-b.js.map → composer-section-CsrTm8Ss.js.map} +1 -1
  160. package/dist/shell-source-maps/assets/{connect-route-DkjLawxM.js.map → connect-route-BY5fhvuR.js.map} +1 -1
  161. package/dist/shell-source-maps/assets/{copy-field-B14w71cy.js.map → copy-field-CN_wHY_K.js.map} +1 -1
  162. package/dist/shell-source-maps/assets/{create-route-DGBe6c9T.js.map → create-route-CkONKdX6.js.map} +1 -1
  163. package/dist/shell-source-maps/assets/{custom-step-container-field-CXzhDKB8.js.map → custom-step-container-field-B0adLm01.js.map} +1 -1
  164. package/dist/shell-source-maps/assets/embedded-list-Nomt6OUK.js.map +1 -0
  165. package/dist/shell-source-maps/assets/en-C_BQKBSV.js.map +1 -0
  166. package/dist/shell-source-maps/assets/{export-dialog-CCnbhHYq.js.map → export-dialog-C7Gpq0EK.js.map} +1 -1
  167. package/dist/shell-source-maps/assets/export-worker-C46NatsO.js.map +1 -0
  168. package/dist/shell-source-maps/assets/{first-organization-page-NFqF-XyH.js.map → first-organization-page-B9Qj8EgA.js.map} +1 -1
  169. package/dist/shell-source-maps/assets/{graph-view-CnMNqiV4.js.map → graph-view-BU3sYZDD.js.map} +1 -1
  170. package/dist/shell-source-maps/assets/{group-donut-BbP0DJKg.js.map → group-donut-MrMdALOR.js.map} +1 -1
  171. package/dist/shell-source-maps/assets/{guest-call-page-R7GFfBV-.js.map → guest-call-page-Cf-QdD6u.js.map} +1 -1
  172. package/dist/shell-source-maps/assets/{html-viewer-DoOxyTcM.js.map → html-viewer-4q3cR5U2.js.map} +1 -1
  173. package/dist/shell-source-maps/assets/{import-dialog-_5Szg-jU.js.map → import-dialog-CBT7GHQ6.js.map} +1 -1
  174. package/dist/shell-source-maps/assets/{import-table-dialog-njI8BoS4.js.map → import-table-dialog-DNPoaf3W.js.map} +1 -1
  175. package/dist/shell-source-maps/assets/{invitations-page-EV-UUQ6b.js.map → invitations-page-T5Zl42lB.js.map} +1 -1
  176. package/dist/shell-source-maps/assets/{layout-grid-B0-CJOlT.js.map → layout-grid-C0JKQ-Vr.js.map} +1 -1
  177. package/dist/shell-source-maps/assets/{legend-item-DlKFFY7e.js.map → legend-item-BC8NMrG0.js.map} +1 -1
  178. package/dist/shell-source-maps/assets/lib-zod-CxxP7Qhu.js.map +1 -0
  179. package/dist/shell-source-maps/assets/{list-page-aYSJ3PHa.js.map → list-page-Dt2tN3Li.js.map} +1 -1
  180. package/dist/shell-source-maps/assets/{maplibre-B6nwN1UZ.js.map → maplibre-CBGBPT2u.js.map} +1 -1
  181. package/dist/shell-source-maps/assets/{markdown-content-C8sLopWJ.js.map → markdown-content-CE3gKAHx.js.map} +1 -1
  182. package/dist/shell-source-maps/assets/{members-page-CgBOboZQ.js.map → members-page-RClHb_e8.js.map} +1 -1
  183. package/dist/shell-source-maps/assets/{message-content-BkvkBtPr.js.map → message-content-OCOwOHzz.js.map} +1 -1
  184. package/dist/shell-source-maps/assets/{messages-CqYTV98f.js.map → messages-9TFLyKlr.js.map} +1 -1
  185. package/dist/shell-source-maps/assets/nl-DzJ_yv1H.js.map +1 -0
  186. package/dist/shell-source-maps/assets/{organization-page-CUBsrNzR.js.map → organization-page-BVWyQvBY.js.map} +1 -1
  187. package/dist/shell-source-maps/assets/{organizations-page-D_imfTUa.js.map → organizations-page-Bn3IY_Zs.js.map} +1 -1
  188. package/dist/shell-source-maps/assets/parse-worker-COWuolaE.js.map +1 -0
  189. package/dist/shell-source-maps/assets/{pending-invitation-row-D4gFapdv.js.map → pending-invitation-row-D58juRaB.js.map} +1 -1
  190. package/dist/shell-source-maps/assets/{period-chart-ChFHNTEE.js.map → period-chart-DSnwMzgV.js.map} +1 -1
  191. package/dist/shell-source-maps/assets/{person-row-YwRtkzbb.js.map → person-row-shwrR0nf.js.map} +1 -1
  192. package/dist/shell-source-maps/assets/{public-form-page-oyX-a-KA.js.map → public-form-page-o8AZ5FHd.js.map} +1 -1
  193. package/dist/shell-source-maps/assets/{record-lines-D1wftBQA.js.map → record-lines-fwUdQsF7.js.map} +1 -1
  194. package/dist/shell-source-maps/assets/{record-map-BEOxTNu4.js.map → record-map-3vSnFihG.js.map} +1 -1
  195. package/dist/shell-source-maps/assets/{record-opens-C9579izg.js.map → record-opens-BjvGP76q.js.map} +1 -1
  196. package/dist/shell-source-maps/assets/{record-page-Dhb9gzfJ.js.map → record-page-oAgFQCZx.js.map} +1 -1
  197. package/dist/shell-source-maps/assets/{record-preview-eCoWviA9.js.map → record-preview-bznf4p6C.js.map} +1 -1
  198. package/dist/shell-source-maps/assets/{records-map-DVETi1eC.js.map → records-map-BZ9IztOw.js.map} +1 -1
  199. package/dist/shell-source-maps/assets/render-node-D-4-E94O.js.map +1 -0
  200. package/dist/shell-source-maps/assets/{reorder-button-1ikk6wTV.js.map → reorder-button-B6J3Gmzg.js.map} +1 -1
  201. package/dist/shell-source-maps/assets/{run-trace-view-DC8UUfeb.js.map → run-trace-view-B_bJcy_e.js.map} +1 -1
  202. package/dist/shell-source-maps/assets/{runner-install-field-BmVLaBtB.js.map → runner-install-field-Dg5VV1Bz.js.map} +1 -1
  203. package/dist/shell-source-maps/assets/{runtime-update-CTsM8FBn.js.map → runtime-update-CkX7qK0y.js.map} +1 -1
  204. package/dist/shell-source-maps/assets/{sheet-source-BbBLftOM.js.map → sheet-source-De92TWm8.js.map} +1 -1
  205. package/dist/shell-source-maps/assets/{sign-in-policy-page-BrVvhdS0.js.map → sign-in-policy-page-P6Z6NlWj.js.map} +1 -1
  206. package/dist/shell-source-maps/assets/{start-block-queries-B1m-VmpK.js.map → start-block-queries-sM50NWuR.js.map} +1 -1
  207. package/dist/shell-source-maps/assets/{step-catalog-DXkb5LNi.js.map → step-catalog-C6uiLqhG.js.map} +1 -1
  208. package/dist/shell-source-maps/assets/{step-panel-CEluX3Jl.js.map → step-panel-BtgXKvBb.js.map} +1 -1
  209. package/dist/shell-source-maps/assets/{timeline-display-C1OXwJcu.js.map → timeline-display-CFYOr7ER.js.map} +1 -1
  210. package/dist/shell-source-maps/assets/{trash-Ba3Y5_30.js.map → trash-hWgXyHxA.js.map} +1 -1
  211. package/dist/shell-source-maps/assets/{update-set-D2mI0J7M.js.map → update-set-jWhZWR7M.js.map} +1 -1
  212. package/dist/shell-source-maps/assets/{use-calendar-move-BENhrEOz.js.map → use-calendar-move-B902R-oH.js.map} +1 -1
  213. package/dist/shell-source-maps/assets/{use-display-rows-DIoyxucI.js.map → use-display-rows-DRKftIme.js.map} +1 -1
  214. package/dist/shell-source-maps/assets/{use-my-invitations-B4h6GyJO.js.map → use-my-invitations-BmYWQO42.js.map} +1 -1
  215. package/dist/shell-source-maps/assets/{use-paged-search-DjnlXbQ5.js.map → use-paged-search-CQZq-5QD.js.map} +1 -1
  216. package/dist/shell-source-maps/assets/{use-run-trace-2fQX9FeC.js.map → use-run-trace-CP67JSwu.js.map} +1 -1
  217. package/dist/shell-source-maps/assets/{use-workflow-page-D8Vn1I90.js.map → use-workflow-page-DyT1T2px.js.map} +1 -1
  218. package/dist/shell-source-maps/assets/{use-workflow-types-DpNGPeuE.js.map → use-workflow-types-DPCbdYrq.js.map} +1 -1
  219. package/dist/shell-source-maps/assets/{workflow-canvas-CZ6QjuM6.js.map → workflow-canvas-DmxNQs0O.js.map} +1 -1
  220. package/dist/shell-source-maps/assets/{workflow-field-CLeslVkB.js.map → workflow-field-DbMcq81f.js.map} +1 -1
  221. package/dist/shell-source-maps/assets/{workflow-graph-editor-CirmaYcy.js.map → workflow-graph-editor-C9BYEvXl.js.map} +1 -1
  222. package/dist/shell-source-maps/assets/{workflow-run-field-DgVAi0nl.js.map → workflow-run-field-jJu07psu.js.map} +1 -1
  223. package/dist/shell-source-maps/assets/workflow-status-field-Dr5AeWYR.js.map +1 -0
  224. package/dist/shell-source-maps/assets/{workflow-workbench-Dy2EmMb7.js.map → workflow-workbench-DDVq899p.js.map} +1 -1
  225. package/dist/status/messages.d.ts +2 -2
  226. package/dist/users/messages.d.ts +2 -2
  227. package/package.json +5 -5
  228. package/dist/shell/assets/app-CK_M0TgA.js +0 -34
  229. package/dist/shell/assets/board-display-BF6sraBq.js +0 -2
  230. package/dist/shell/assets/calendar-display-DdgRC4MC.js +0 -2
  231. package/dist/shell/assets/composed-page-BWauYpuf.js +0 -2
  232. package/dist/shell/assets/create-route-DGBe6c9T.js +0 -2
  233. package/dist/shell/assets/embedded-list-COr7SEcU.js +0 -3
  234. package/dist/shell/assets/en-BHrKuf4K.js +0 -2
  235. package/dist/shell/assets/export-worker-CNhkzttC.js +0 -15
  236. package/dist/shell/assets/list-page-aYSJ3PHa.js +0 -4
  237. package/dist/shell/assets/members-page-CgBOboZQ.js +0 -2
  238. package/dist/shell/assets/messages-CqYTV98f.js +0 -2
  239. package/dist/shell/assets/nl-D11b5T7-.js +0 -2
  240. package/dist/shell/assets/organization-page-CUBsrNzR.js +0 -2
  241. package/dist/shell/assets/organizations-page-D_imfTUa.js +0 -2
  242. package/dist/shell/assets/parse-worker-CAcPVcu7.js +0 -35
  243. package/dist/shell/assets/public-form-page-oyX-a-KA.js +0 -2
  244. package/dist/shell/assets/record-page-Dhb9gzfJ.js +0 -3
  245. package/dist/shell/assets/render-node-CSjGRPb0.js +0 -3
  246. package/dist/shell/assets/reorder-button-1ikk6wTV.js +0 -2
  247. package/dist/shell/assets/shared-protobase-ui-DkBQh22L.js +0 -1
  248. package/dist/shell/assets/sign-in-policy-page-BrVvhdS0.js +0 -2
  249. package/dist/shell/assets/start-block-queries-B1m-VmpK.js +0 -2
  250. package/dist/shell/assets/step-catalog-DXkb5LNi.js +0 -2
  251. package/dist/shell/assets/timeline-display-C1OXwJcu.js +0 -2
  252. package/dist/shell/assets/use-calendar-move-BENhrEOz.js +0 -2
  253. package/dist/shell/assets/use-my-invitations-B4h6GyJO.js +0 -2
  254. package/dist/shell/assets/workflow-status-field-CD4Npg78.js +0 -2
  255. package/dist/shell/assets/workflow-workbench-Dy2EmMb7.js +0 -4
  256. package/dist/shell-source-maps/assets/app-CK_M0TgA.js.map +0 -1
  257. package/dist/shell-source-maps/assets/embedded-list-COr7SEcU.js.map +0 -1
  258. package/dist/shell-source-maps/assets/en-BHrKuf4K.js.map +0 -1
  259. package/dist/shell-source-maps/assets/export-worker-CNhkzttC.js.map +0 -1
  260. package/dist/shell-source-maps/assets/lib-zod-B92j-KH2.js.map +0 -1
  261. package/dist/shell-source-maps/assets/nl-D11b5T7-.js.map +0 -1
  262. package/dist/shell-source-maps/assets/parse-worker-CAcPVcu7.js.map +0 -1
  263. package/dist/shell-source-maps/assets/render-node-CSjGRPb0.js.map +0 -1
  264. package/dist/shell-source-maps/assets/workflow-status-field-CD4Npg78.js.map +0 -1
@@ -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{dt as n,ft as r,ut as i}from"./app-CK_M0TgA.js";var a=e(t(),1),o=({client:e,page:t,onClose:i})=>{let{state:o,offline:s,error:c,send:l,act:u}=n(e);return(0,a.jsx)(r,{state:o,offline:s,error:c,onSend:e=>l(e,t),onAction:u,onClose:i,client:e})},s=({url:e,...t})=>(0,a.jsx)(o,{client:i(e),...t}),c=({url:e,client:t,...n})=>t?(0,a.jsx)(o,{client:t,...n}):(0,a.jsx)(s,{url:e,...n});export{c as AssistantPanel};
2
- //# debugId=2de84602-106e-4f00-bc84-2653216cd77c
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{dt as n,lt as r,ut as i}from"./app-BXbP4Ty1.js";var a=e(t(),1),o=({client:e,page:t,onClose:r})=>{let{state:o,offline:s,error:c,send:l,act:u}=i(e);return(0,a.jsx)(n,{state:o,offline:s,error:c,onSend:e=>l(e,t),onAction:u,onClose:r,client:e})},s=({url:e,...t})=>(0,a.jsx)(o,{client:r(e),...t}),c=({url:e,client:t,...n})=>t?(0,a.jsx)(o,{client:t,...n}):(0,a.jsx)(s,{url:e,...n});export{c as AssistantPanel};
2
+ //# debugId=566e5f96-12fb-478b-80b8-fbe5824e7d6d
@@ -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{Ea as r,Ia as i,On as a,Xa as o,al as s,cs as c,di as l,fc as u,fi as d,iu as f,ja as p,ka as m,lc as h,li as g,mi as _,ml as v,ms as y,qc as b,ss as x,ui as S,vl as C,vr as w,yn as T,za as E}from"./app-BXbP4Ty1.js";import{i as D}from"./vendor-t7Q7QbPu.js";import{w as O}from"./embedded-list-Nomt6OUK.js";import{r as k}from"./record-preview-bznf4p6C.js";import{_ as A,a as j,g as M,i as N,n as ee,o as P,t as F,v as I}from"./lib-dnd-kit-core-xi-7xL_N.js";import{a as L,i as R,n as z,t as B}from"./lib-dnd-kit-sortable-CNDSKqCD.js";import{a as V,i as te,l as ne,n as H,o as U,r as W,s as G,t as K}from"./messages-9TFLyKlr.js";import{n as re,r as q,t as ie}from"./board-dnd-pi-vIUTz.js";import{t as ae}from"./use-display-rows-DRKftIme.js";var J=e=>typeof e==`number`&&Number.isInteger(e),oe=(e,t,n)=>{let r=0;for(;r<t&&J(e[r])&&(r===0||e[r]>e[r-1]);)r+=1;let i=e.length;for(;i-1>n&&J(e[i-1])&&(i===e.length||e[i-1]<e[i]);)--i;let a=Math.min(t,r),o=a===0?1:e[a-1]+1,s=Math.max(n,i-1);for(;s+1<e.length&&e[s+1]<=o+(s-a);)s+=1;return{first:a,last:s,start:o}},Y=e(t(),1),se=({model:e,by:t,value:n,fields:r,filter:i,orderBy:a})=>{let{resources:o,views:s}=x(),c=k({resources:o,views:s,model:e,columns:r,filter:d(i,t,n),orderBy:a});return ae(e,c.page,c.key,!0)},X=e(n(),1),ce=(e,t)=>{if(!t)return e;let n=new Map(e.map(e=>[e.key,e])),r=new Set(t);return[...t.flatMap(e=>n.get(e)??[]),...e.filter(e=>!r.has(e.key))]},le=({model:e,view:t,display:n,column:r,fields:i,filter:o,orderBy:c,limit:l,moves:d,movable:f,placeable:m,dragged:y})=>{let x=se({model:e,by:n.by,value:r.value,fields:i,filter:o,orderBy:c}),S=g(e,t,n),C=new Set(x.rows.map(e=>e.key)),T=new Map(d.map(e=>[e.row.key,e])),E=x.rows.filter(e=>T.has(e.key)&&T.get(e.key).to!==r.value),D=d.filter(e=>e.to===r.value&&!C.has(e.row.key)).map(e=>e.row),O=x.rows.filter(e=>!E.includes(e)).map(e=>T.has(e.key)?T.get(e.key).row:e),k=d.findLast(e=>e.to===r.value&&e.order),A=ce([...D,...O],k?.order),j=A.slice(0,l),N=x.more||A.length>j.length,{setNodeRef:ee,isOver:P}=M({id:q(r.value),data:{column:r,rows:j,more:N}}),F=x.total-E.length+D.length;if(r.value===null&&!x.loading&&F===0&&!P)return null;let I=(t?.names?.plural??v(e.name)).toLowerCase(),R=t?.fields[n.by];return(0,X.jsxs)(`section`,{ref:ee,"aria-label":`${r.label}, ${F}`,className:b(`flex w-72 shrink-0 snap-start flex-col gap-2 rounded-lg bg-surface p-2`,P&&`ring-2 ring-primary/30`),children:[(0,X.jsxs)(`header`,{className:`flex items-center justify-between gap-2 px-1 pt-0.5`,children:[(0,X.jsx)(`h2`,{className:`min-w-0 truncate text-body font-medium`,children:r.value===null?(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:r.label}):(0,X.jsx)(a,{value:r.value,hints:R,children:r.label})}),!x.loading&&(0,X.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:F.toLocaleString(s())})]}),x.loading?Array.from({length:3},(e,t)=>(0,X.jsx)(h,{className:`h-20`},t)):x.error?(0,X.jsx)(w,{title:_(`couldNotLoadRows`),error:x.error}):j.length===0?(0,X.jsx)(`p`,{className:`px-1 py-4 text-center text-xs text-muted-foreground`,children:_(`noPlural`,{plural:I})}):(0,X.jsx)(B,{id:q(r.value),items:j.map(e=>e.key),strategy:L,children:(0,X.jsx)(`ul`,{className:`-mb-2 flex flex-col`,children:j.map(n=>(0,X.jsx)(ue,{model:e,view:t,card:S,row:n,column:r,rows:j,more:N,draggable:(f||m)&&p(n.record,`update`),placeable:m,dragged:y},n.key))})}),l===void 0&&x.more&&(0,X.jsx)(u,{size:`sm`,variant:`ghost`,onClick:x.loadMore,children:_(`showMore`)})]})},ue=({model:e,view:t,card:n,row:r,column:i,rows:a,more:o,draggable:s,placeable:c,dragged:l})=>{let{setNodeRef:u,setActivatorNodeRef:d,listeners:f,isDragging:p,isOver:m,active:h,transform:g,transition:_}=R({id:r.key,data:{row:r,column:i,rows:a,more:o},disabled:{draggable:!s,droppable:!c}}),v=m&&h?.data.current?.column?.value!==i.value;return(0,X.jsx)(`li`,{ref:e=>{u(e),d(e?.querySelector(`a[data-card-link]`)??e)},...f,onDragStart:e=>e.preventDefault(),onClickCapture:e=>{l()&&(e.preventDefault(),e.stopPropagation())},style:{transform:g?`translate3d(${g.x}px, ${g.y}px, 0)`:void 0,transition:_},className:b(`relative pb-2`,s&&`cursor-grab touch-manipulation`,p&&`opacity-40`,v&&`before:absolute before:inset-x-0 before:-top-1 before:h-0.5 before:rounded-full before:bg-primary`),children:(0,X.jsx)(O,{model:e,view:t,display:n,row:r,swipe:!1})})},de=e=>e.kind===`and`?e.args.flatMap(de):[e],fe=e=>e.kind===`string`?String(e.value):void 0,pe=(e,t)=>{if(e.kind===`compare`&&e.op===`=`&&e.field.path.join(`.`)===t){let t=fe(e.value);return t===void 0?void 0:[t]}if(e.kind===`in`&&e.field.path.join(`.`)===t){let t=e.values.map(fe);return t.every(e=>e!==void 0)?t:void 0}},me=(e,t,n)=>{let r=f(e);if(!r.ok||!r.ast)return n;let i=de(r.ast).map(e=>pe(e,t)).filter(e=>e!==void 0);return n.filter(e=>i.every(t=>e.value!==null&&t.includes(e.value)))},he=(e,t)=>t!==null&&Object.hasOwn(e,t)?e[t]:void 0,ge=(e,t,n)=>{let r=e.findIndex(e=>e.key===t.key);return r===-1?[...e.slice(0,n),t,...e.slice(n)]:z(e,r,n)},Z=(e,t,n)=>{let r=e.findIndex(e=>e.key===t.key);return{order:ge(e,t,n),first:r===-1?n:Math.min(r,n),last:r===-1?n:Math.max(r,n)}},_e=(e,t,n,i,a,o,s,c,l)=>{let u=r(e,a.record),f=s.findIndex(e=>e.key===a.key),p=W(e,n,d(i,t,o.value),s.map(e=>e.record),f,c),m=l===void 0?[]:[{op:`reorder`,resource:e.name,field:n,keys:[u],start:l,etags:{[C(u)]:`*`}}];return[...(a.record[t]??null)===o.value?[]:[{op:`update`,resource:e.name,key:u,data:{[t]:o.value},etag:`*`}],...m,p]},ve=(e,t,n,i)=>{let a=t=>C(r(e,t)),o=H(i.results,a),s=new Map(n.map(e=>{let n=a(e.record);return[n,o.has(n)?{...e.record,[t]:o.get(n)}:e.record]})),c=new Map;for(let e of i.results){let t=e.op===`reorder`||e.op===`move`?e.records:e.op===`update`?[e]:[];for(let{record:e,etag:n}of t)c.set(a(e),{record:e,etag:n})}return[...c].flatMap(([e,t])=>{let n=s.get(e);return n?[{before:n,...t}]:[]})},Q=e=>e!=null&&e!==``,ye=({model:e,rank:t,rows:n,row:i,index:a,bounds:o,title:s})=>{let c=n.some(e=>e.key===i.key)?n.length-1:n.length,l;for(let u=a;u<=c;u++){let{order:a,first:d,last:f}=Z(n,i,u),p=a.map(e=>e.record[t]),m=oe(p,d,f),h=new Map(a.map((t,n)=>[C(r(e,t.record)),n>=m.first&&n<=m.last?m.start+n-m.first:p[n]])),g=e=>h.has(e.key)?h.get(e.key):e.rank,_=Number(h.get(C(r(e,i.record)))),v=o.after.filter(e=>Q(g(e))&&Number(g(e))>=_),y=o.before.find(e=>Q(g(e))&&Number(g(e))<=_),b=y?K(`dependsOn`,{record:y.title,other:s}):v[0]&&K(`dependsOn`,{record:s,other:v[0].title});if(!b)return{place:{index:u},...l!==void 0&&{reason:l}};if(l??=b,u!==c||y)continue;let x=Math.max(...v.map(e=>Number(g(e))))+1;if(o.before.every(e=>!Q(g(e))||Number(g(e))>x))return{place:{index:u,bump:x},reason:l}}return{reason:l}},be=({model:e,view:t,by:n,rank:i,filter:a,drop:o,labelOf:s,titleOf:c})=>{let l=y(),u=E(),d=T(),[f,p]=(0,Y.useState)([]),m=(0,Y.useRef)(void 0),h=e=>p(t=>t.filter(t=>t.row.key!==e)),g=i?[n,i]:[n],v=D({mutationFn:e=>e(),onError:e=>u.show(U(e,_(`couldNotUndo`),{place:`board`})),onSettled:()=>d(e.name)}),b=async(t,i)=>{let a=o&&he(o,i.value);if(!a)throw Error(`The column ${i.label} takes no cards`);let s=r(e,t.record),c=typeof t.record.etag==`string`?t.record.etag:`*`,u=await a({resource:e.name,record:t.record,recordKey:s,etag:c,to:i.value,client:l});return{landed:(await l.get(e.name,s)).record[n]??null,...u&&{undo:u}}},x=(t,n)=>({landed:n.value,undo:()=>l.batchWrite(V(e,t,g))}),S=(e,t,r)=>{let i={...e,record:{...e.record,[n]:t.value}},a=r?.map(e=>e.key);p(n=>[...n.filter(t=>t.row.key!==e.key),{row:i,to:t.value,...a&&{order:a}}])},C=async(n,r,a)=>{if(!e.position?.after)return{index:a.index};let o=await te(l,e,t,n.record),s=ye({model:e,rank:i,rows:a.rows,row:n,index:a.index,bounds:o,title:c(n)}),d=!s.place||s.place.bump===void 0&&s.place.index===a.rows.findIndex(e=>e.key===n.key);if(s.reason!==void 0&&u.show({state:`warning`,title:d?G(`notMoved`):G(`movedToPlace`,{place:s.place.index+1}),description:s.reason}),!d)return s.place.index!==a.index&&S(n,r,Z(a.rows,n,s.place.index).order),s.place},w=async(t,r,o)=>{let s=await C(t,r,o);if(!s)return;let{order:c}=Z(o.rows,t,s.index);return x(ve(e,i,c,await l.batchWrite(_e(e,n,i,a,t,r,c,o.more,s.bump))),r)},O=D({mutationFn:async({row:t,to:a,place:s})=>{if(s&&!i)throw Error(`A board places a card only by its rank`);let c=t.record[n]??null;if(o&&a.value!==c)return b(t,a);if(s)return w(t,a,s);let u=typeof t.record.etag==`string`?t.record.etag:`*`,d=await l.update(e.name,r(e,t.record),{[n]:a.value},u);return x([{before:t.record,record:d.record,etag:d.etag}],a)},onMutate:({row:e,to:t,place:n})=>S(e,t,n&&Z(n.rows,e,n.index).order),onSuccess:(e,{row:t,to:r})=>{if(!e)return;let{landed:i,undo:a}=e;m.current!==void 0&&u.dismiss(m.current),m.current=void 0;let o=t.record[n]??null,c=i===o?o===r.value?_(`orderChanged`):_(`stayedIn`,{column:s(i)}):_(`movedTo`,{column:s(i)});if(!a){u.show({state:`success`,title:c});return}let l=u.show({state:`success`,title:c,action:{label:_(`undo`),onClick:()=>{u.dismiss(l),m.current=void 0,v.mutate(a)}}});m.current=l},onError:(e,{row:t,to:r})=>{h(t.key);let i=(t.record[n]??null)===r.value?_(`couldNotReorder`):_(`couldNotMoveTo`,{to:r.label});u.show(U(e,i,{place:`board`,title:c(t)}))},onSettled:async(t,n,{row:r})=>{await d(e.name),h(r.key)}});return{moves:f,move:(e,t,n)=>O.mutate({row:e,to:t,...n&&{place:n}})}},$=(e,t)=>{let n=e.data.current;if(!n?.column||!n.rows)return;let r=n.more===!0;if(n.sortable)return{column:n.column,rows:n.rows,more:r,index:n.sortable.index};let i=n.rows.some(e=>e.key===t.key);return{column:n.column,rows:n.rows,more:r,index:i?n.rows.length-1:n.rows.length}},xe=({model:e,view:t,display:n,fields:r,filter:a,orderBy:s,limit:u})=>{let d=S(e,t,n),f=me(a,n.by,d),p=g(e,t,n),h=c(e.name),{boardDrops:v}=i(),y=t?.list?.drag,b=typeof y?.board==`string`?y.board:void 0,x=b===void 0?void 0:v?.[b],C=t=>m(h,`update`)&&(y?.board===!0?!e.fields[n.by]?.readOnly:x!==void 0&&he(x,t)!==void 0),w=f.some(e=>C(e.value)),T=l(e),E=y?.rank===!0&&T!==void 0&&ne(e,h)!==void 0,D=T?`${T} asc`:s,k=e=>d.find(t=>t.value===e)?.label??String(e),M=e=>String(e.labels[p.title]??e.record[p.title]??e.key),{moves:L,move:R}=be({model:e,view:t,by:n.by,rank:T,filter:a,drop:x,labelOf:k,titleOf:M}),[z,B]=(0,Y.useState)(),V=(0,Y.useRef)(!1),te=I(A(j,{activationConstraint:{distance:4}}),A(P,{activationConstraint:{delay:250,tolerance:5}}),A(N,{keyboardCodes:{start:[`Space`],cancel:[`Escape`],end:[`Space`,`Enter`]},coordinateGetter:ie}));if(b!==void 0&&!x)return(0,X.jsx)(o,{children:_.rich(`noDrop`,{drop:b})});let H=e=>f.find(t=>q(t.value)===e),U=e=>e.record[n.by]??null,W=(e,t)=>C(U(e))&&C(t.value),G=(e,t)=>{if(!t)return{over:_(`noColumn`)};let n=E?$(t,e):void 0;if(!n)return{over:H(t.id)?.label??_(`noColumn`)};let r=n.rows.some(t=>t.key===e.key)?n.rows.length:n.rows.length+1;return{over:_(`placeOf`,{column:n.column.label,place:n.index+1,count:r}),place:_(`place`,{column:n.column.label,place:n.index+1})}},K=(e,t)=>{let n=(E?$(t,e)?.column:void 0)??H(t.id);return n!==void 0&&n.value!==U(e)&&!W(e,n)};return(0,X.jsxs)(F,{sensors:te,collisionDetection:re,onDragStart:({active:e})=>{V.current=!0,B(e.data.current.row)},onDragEnd:({active:e,over:t})=>{B(void 0),setTimeout(()=>V.current=!1);let n=e.data.current.row;if(!t)return;let r=E?$(t,n):void 0;if(!r){let e=H(t.id);e&&e.value!==U(n)&&W(n,e)&&R(n,e);return}let i=r.rows.findIndex(e=>e.key===n.key);if(i!==-1||W(n,r.column)){if(i===-1&&x)return R(n,r.column);i!==r.index&&R(n,r.column,{rows:r.rows,more:r.more,index:r.index})}},onDragCancel:()=>{B(void 0),setTimeout(()=>V.current=!1)},accessibility:{announcements:{onDragStart:({active:e})=>_(`pickedUp`,{title:M(e.data.current.row)}),onDragOver:({active:e,over:t})=>_(`isOver`,{title:M(e.data.current.row),over:G(e.data.current.row,t).over}),onDragEnd:({active:e,over:t})=>{let n=e.data.current.row;if(!t||K(n,t))return _(`putBack`,{title:M(n)});let r=G(n,t);return _(`wasMovedTo`,{title:M(n),to:r.place??r.over})},onDragCancel:({active:e})=>_(`cancelled`,{title:M(e.data.current.row)})},screenReaderInstructions:{draggable:_(E?w?`boardAnywhere`:`boardWithin`:`boardAcross`)}},children:[(0,X.jsx)(`div`,{className:`relative min-w-0 flex-1 overflow-x-auto`,children:(0,X.jsx)(`div`,{className:`flex snap-x items-start gap-3 pb-2`,children:f.map(i=>(0,X.jsx)(le,{model:e,view:t,display:n,column:i,fields:r,filter:a,orderBy:D,limit:u,moves:L,movable:C(i.value),placeable:E,dragged:()=>V.current},q(i.value)))})}),(0,X.jsx)(ee,{children:z&&(0,X.jsx)(O,{model:e,view:t,display:p,row:z,swipe:!1})})]})};export{xe as BoardDisplay};
2
+ //# debugId=a824adb4-33d9-49cd-ae7d-3cc4a803b054
@@ -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{$i as r,Vr as i,ca as a,cs as o,ja as s,ka as c,la as l,lc as u,mi as d,pa as f,qc as p,ra as m,ta as h,ua as g,vr as _}from"./app-BXbP4Ty1.js";import{_ as v,a as y,g as b,i as ee,n as te,o as ne,t as re,v as ie}from"./lib-dnd-kit-core-xi-7xL_N.js";import{n as x}from"./board-dnd-pi-vIUTz.js";import{_ as S,a as ae,b as C,c as w,d as T,f as E,i as D,l as O,n as k,o as A,p as j,r as oe,s as M,t as N,y as P}from"./use-calendar-move-B902R-oH.js";var F=e(t(),1),I=e(n(),1),L=e=>{let t=j(e),n=e=>Date.parse(`${e}T00:00:00Z`);return e.scale===`month`?m(n(e.day)):h(n(t[0]),n(t.at(-1)))},R=({view:e,now:t,linkTo:n,onView:r})=>{let i=e.scale===`month`&&g(t,f()).startsWith(e.day.slice(0,7)),a=n=>n===`week`&&i?C(`week`,t):E({scale:n,day:e.day},t),o=(t,n)=>({view:a(t),label:n,current:e.scale===t});return(0,I.jsx)(O,{heading:L(e),unit:e.scale===`month`?`month`:`week`,previous:P(e,-1),today:C(e.scale,t),next:P(e,1),scales:[o(`month`,d(`month`)),o(`week`,d(`week`))],scalesLabel:d(`calendarScale`),linkTo:n,onView:r})},z=({day:e,count:t,children:n,more:r,inMonth:i,today:o,week:s})=>{let{setNodeRef:c,isOver:u}=b({id:w(e)}),d=Date.parse(`${e}T00:00:00Z`);return(0,I.jsxs)(`section`,{ref:c,"aria-label":`${l(d)}, ${t}`,className:p(`flex min-w-0 flex-col gap-1 bg-background p-1`,s?`min-h-28 sm:min-h-64`:`min-h-24`,!i&&`bg-surface`,u&&`ring-2 ring-inset ring-primary/30`),children:[(0,I.jsxs)(`header`,{className:p(`flex items-center gap-1 px-0.5 text-xs`,i?`text-foreground`:`text-muted-foreground`),children:[s&&(0,I.jsx)(`span`,{className:`text-muted-foreground`,children:a(d)}),(0,I.jsx)(`span`,{"aria-current":o?`date`:void 0,className:p(`inline-flex size-5 items-center justify-center rounded-full tabular-nums`,o&&`bg-primary font-medium text-primary-foreground`),children:Number(e.slice(8))})]}),n,r]})},B=3,V=({model:e,view:t,display:n,fields:l,filter:m,at:h,linkTo:b,now:C=Date.now()})=>{let[O,P]=(0,F.useState)(),L=E(b?h:O,C),V=j(L),H=oe({model:e,display:n,range:S(L),fields:l,filter:m}),{moves:U,move:W}=k(e,n),G=T(N(H.rows,U),n,e,V),K=o(e.name),se=c(K,`update`)&&[n.start,n.end].every(t=>t===void 0||!e.fields[t]?.readOnly),[q,J]=(0,F.useState)(),Y=(0,F.useRef)(!1),ce=ie(v(y,{activationConstraint:{distance:4}}),v(ne,{activationConstraint:{delay:250,tolerance:5}}),v(ee,{keyboardCodes:{start:[`Space`],cancel:[`Escape`],end:[`Space`,`Enter`]},coordinateGetter:M})),le=g(C,f()),X=L.scale===`week`,Z=e=>r(Date.parse(`${String(e).slice(w(``).length)}T00:00:00Z`)),Q=r=>A(e,t,n,r.row),ue={onDragStart:({active:e})=>d(`pickedUp`,{title:Q(e.data.current)}),onDragOver:({active:e,over:t})=>d(`isOver`,{title:Q(e.data.current),over:t?Z(t.id):d(`noDay`)}),onDragEnd:({active:e,over:t})=>t?d(`wasMovedTo`,{title:Q(e.data.current),to:Z(t.id)}):d(`putBack`,{title:Q(e.data.current)}),onDragCancel:({active:e})=>d(`cancelled`,{title:Q(e.data.current)})},$=()=>{J(void 0),setTimeout(()=>Y.current=!1)},de=({active:e})=>{Y.current=!0,J(e.data.current)},fe=({active:e,over:t})=>{$();let{row:n,day:r}=e.data.current,i=t?String(t.id).slice(w(``).length):void 0;i&&i!==r&&W(n,r,i)},pe=(e,t)=>{let n=E({scale:`week`,day:e},C),r=d(`moreHidden`,{count:t}),a=`self-start rounded px-1 text-xs text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-primary`;return b?(0,I.jsx)(i,{to:b(n),className:a,children:r}):(0,I.jsx)(`button`,{type:`button`,className:a,onClick:()=>P(n),children:r})};return(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3`,children:[(0,I.jsx)(R,{view:L,now:C,linkTo:b,onView:P}),H.error&&(0,I.jsx)(_,{title:d(`couldNotLoadRows`),error:H.error}),H.capped&&(0,I.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:d(`capped`,{limit:500,unit:L.scale})}),(0,I.jsxs)(re,{sensors:ce,collisionDetection:x,onDragStart:de,onDragEnd:fe,onDragCancel:$,accessibility:{announcements:ue,screenReaderInstructions:{draggable:d(`calendarInstructions`)}},children:[(0,I.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-border`,children:[!X&&(0,I.jsx)(`div`,{"aria-hidden":!0,className:`grid grid-cols-7 gap-px border-b border-border bg-border`,children:V.slice(0,7).map(e=>(0,I.jsx)(`span`,{className:`bg-surface px-1.5 py-1 text-xs font-medium text-muted-foreground`,children:a(Date.parse(`${e}T00:00:00Z`))},e))}),(0,I.jsx)(`div`,{className:p(`grid gap-px bg-border`,X?`grid-cols-1 sm:grid-cols-7`:`grid-cols-7`),children:V.map(r=>{let i=G.get(r),a=X?i:i.slice(0,B);return(0,I.jsx)(z,{day:r,count:i.length,inMonth:X||r.startsWith(L.day.slice(0,7)),today:r===le,week:X,more:a.length<i.length&&pe(r,i.length-a.length),children:H.loading?(0,I.jsx)(u,{className:`h-4`}):a.map(i=>(0,I.jsx)(D,{model:e,view:t,display:n,row:i,day:r,movable:se&&s(i.record,`update`),dragged:()=>Y.current},i.key))},r)})})]}),(0,I.jsx)(te,{children:q&&(0,I.jsx)(ae,{model:e,view:t,display:n,row:q.row,day:q.day})})]})]})};export{V as CalendarDisplay};
2
+ //# debugId=2262ab30-2607-4a2e-8947-c355eba89888
@@ -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}from"./react-CuiNlnus.js";import{$c as n,Br as r,Kt as i,La as a,fs as o}from"./app-CK_M0TgA.js";import{h as s,i as c,o as l}from"./vendor-t7Q7QbPu.js";var u=e(t(),1),d=[440,480],f=400,p=3e3,m=e=>{(0,u.useEffect)(()=>{if(!e||typeof AudioContext>`u`)return;let t=new AudioContext,n=()=>{let e=t.createGain();e.gain.value=.08,e.connect(t.destination);for(let[n,r]of[0,f*1.5/1e3].entries())for(let i of d){let a=t.createOscillator();a.frequency.value=i,a.connect(e),a.start(t.currentTime+r),a.stop(t.currentTime+r+f/1e3/(n+1))}};n();let r=setInterval(n,p);return()=>{clearInterval(r),t.close()}},[e])},h=(e,t)=>e.map(e=>({...e,until:t+e.remaining_ms})),g=(e,t)=>{let n=e.filter(e=>e.until>t);return{ringing:n,next:n.length===0?void 0:Math.min(...n.map(e=>e.until))}},_=e=>{let t=o(),r=s(),i=l({queryKey:n.rings,queryFn:async()=>h(await t.rings.list(),Date.now()),enabled:e});(0,u.useEffect)(()=>{if(!e)return;let i=()=>void r.invalidateQueries({queryKey:n.rings});return t.live({onChanges:e=>e.some(e=>e.resource===`$rings`)&&i(),onResync:i})},[t,r,e]);let[a,d]=(0,u.useState)(()=>Date.now()),{ringing:f,next:p}=g(i.data??[],Math.max(a,i.dataUpdatedAt));(0,u.useEffect)(()=>{if(p===void 0)return;let e=setTimeout(()=>d(Date.now()),Math.max(0,p-Date.now()));return()=>clearTimeout(e)},[p]);let m=(0,u.useCallback)(e=>r.setQueryData(n.rings,t=>t?.filter(t=>t.call!==e)),[r]);return{ringing:f,decline:c({mutationFn:e=>t.rings.decline(e),onMutate:m,onSettled:()=>r.invalidateQueries({queryKey:n.rings})}).mutate,hide:m}},v=(e,t,n)=>({state:`call`,sticky:!0,title:e.title,...e.body!==null&&{description:e.body},actions:[{label:i(`decline`),onClick:()=>n(e.call)},{label:i(`accept`),...t}]}),y=()=>{let{ringing:e,decline:t,hide:n}=_(!0),i=a(),{href:o,open:s}=r(),c=(0,u.useRef)(new Map);return m(e.length>0),(0,u.useEffect)(()=>{let r=new Set(e.map(e=>e.call));for(let[e,t]of c.current)r.has(e)||(i.dismiss(t),c.current.delete(e));for(let r of e){if(c.current.has(r.call))continue;let e={href:o({kind:`record`,resource:r.resource,key:r.key,call:`join`}),onNavigate:e=>{n(r.call),s(e)}};c.current.set(r.call,i.show({...v(r,e,t),onClose:()=>t(r.call)}))}},[e,i,o,s,t,n]),(0,u.useEffect)(()=>{let e=c.current;return()=>{for(let t of e.values())i.dismiss(t);e.clear()}},[i]),null};export{y as CallRings};
2
- //# debugId=b9b9dde8-5317-48be-a7f0-17df224bf7e0
1
+ (function(){try{var e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:protobase-app":!0})}catch{}})();import{o as e}from"./rolldown-runtime-DFwUHQ4A.js";import{i as t}from"./react-CuiNlnus.js";import{Gt as n,Hr as r,ms as i,tl as a,za as o}from"./app-BXbP4Ty1.js";import{h as s,i as c,o as l}from"./vendor-t7Q7QbPu.js";var u=e(t(),1),d=[440,480],f=400,p=3e3,m=e=>{(0,u.useEffect)(()=>{if(!e||typeof AudioContext>`u`)return;let t=new AudioContext,n=()=>{let e=t.createGain();e.gain.value=.08,e.connect(t.destination);for(let[n,r]of[0,f*1.5/1e3].entries())for(let i of d){let a=t.createOscillator();a.frequency.value=i,a.connect(e),a.start(t.currentTime+r),a.stop(t.currentTime+r+f/1e3/(n+1))}};n();let r=setInterval(n,p);return()=>{clearInterval(r),t.close()}},[e])},h=(e,t)=>e.map(e=>({...e,until:t+e.remaining_ms})),g=(e,t)=>{let n=e.filter(e=>e.until>t);return{ringing:n,next:n.length===0?void 0:Math.min(...n.map(e=>e.until))}},_=e=>{let t=i(),n=s(),r=l({queryKey:a.rings,queryFn:async()=>h(await t.rings.list(),Date.now()),enabled:e});(0,u.useEffect)(()=>{if(!e)return;let r=()=>void n.invalidateQueries({queryKey:a.rings});return t.live({onChanges:e=>e.some(e=>e.resource===`$rings`)&&r(),onResync:r})},[t,n,e]);let[o,d]=(0,u.useState)(()=>Date.now()),{ringing:f,next:p}=g(r.data??[],Math.max(o,r.dataUpdatedAt));(0,u.useEffect)(()=>{if(p===void 0)return;let e=setTimeout(()=>d(Date.now()),Math.max(0,p-Date.now()));return()=>clearTimeout(e)},[p]);let m=(0,u.useCallback)(e=>n.setQueryData(a.rings,t=>t?.filter(t=>t.call!==e)),[n]);return{ringing:f,decline:c({mutationFn:e=>t.rings.decline(e),onMutate:m,onSettled:()=>n.invalidateQueries({queryKey:a.rings})}).mutate,hide:m}},v=(e,t,r)=>({state:`call`,sticky:!0,title:e.title,...e.body!==null&&{description:e.body},actions:[{label:n(`decline`),onClick:()=>r(e.call)},{label:n(`accept`),...t}]}),y=()=>{let{ringing:e,decline:t,hide:n}=_(!0),i=o(),{href:a,open:s}=r(),c=(0,u.useRef)(new Map);return m(e.length>0),(0,u.useEffect)(()=>{let r=new Set(e.map(e=>e.call));for(let[e,t]of c.current)r.has(e)||(i.dismiss(t),c.current.delete(e));for(let r of e){if(c.current.has(r.call))continue;let e={href:a({kind:`record`,resource:r.resource,key:r.key,call:`join`}),onNavigate:e=>{n(r.call),s(e)}};c.current.set(r.call,i.show({...v(r,e,t),onClose:()=>t(r.call)}))}},[e,i,a,s,t,n]),(0,u.useEffect)(()=>{let e=c.current;return()=>{for(let t of e.values())i.dismiss(t);e.clear()}},[i]),null};export{y as CallRings};
2
+ //# debugId=b093858d-959c-409d-88aa-d01ef7ecb0db
@@ -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{al as e}from"./app-CK_M0TgA.js";var t=class extends Error{reason;constructor(e){super(`The guest request was refused: ${e}`),this.reason=e,this.name=`GuestRefused`}},n=e=>{let n=[],r=t=>new Promise((r,i)=>{n.push({resolve:r,reject:i}),e(t)});return{guests:{link:({publish:e,expiresAt:t})=>r({type:`guest-link`,publish:e,...t&&{expires_at:t.toISOString()}}),revoke:e=>r({type:`guest-link-revoke`,link:e}),admit:e=>r({type:`guest-decide`,guest:e,admit:!0}),deny:e=>r({type:`guest-decide`,guest:e,admit:!1}),remove:e=>r({type:`guest-remove`,guest:e})},receive:e=>{if(e.type!==`guest-link`&&e.type!==`guest-done`&&e.type!==`guest-refused`)return!1;let r=n.shift();return e.type===`guest-refused`?r?.reject(new t(e.reason)):r?.resolve(e.type===`guest-link`?{link:e.link,token:e.token}:void 0),!0},lost:()=>{for(let e of n.splice(0))e.reject(Error(`The link to the call was lost before the server answered`))}}},r=class extends Error{constructor(e){super(e),this.name=`PublishRefused`}},i=e=>new RTCPeerConnection(e),a=e=>{let t=[...e],n=t.find(e=>e.type===`transport`&&typeof e.selectedCandidatePairId==`string`),r=t.find(e=>e.type===`candidate-pair`&&(e.id===n?.selectedCandidatePairId||!n&&e.selected===!0||!n&&e.nominated===!0&&e.state===`succeeded`)),i=0,a=0;for(let e of t)e.type===`inbound-rtp`&&(i+=Math.max(0,Number(e.packetsLost??0)),a+=Number(e.packetsReceived??0));let o=typeof r?.currentRoundTripTime==`number`?r.currentRoundTripTime*1e3:void 0;return{...o!==void 0&&{roundTripMs:o},...i+a>0&&{lostRatio:i/(i+a)}}},o=async(e,t)=>{let n=e.connectionState,r=n===`connected`?a((await e.getStats()).values()):{};return{...t!==void 0&&{member:t},state:n,...r}},s=e=>{let t=new Map;for(let n of e.split(/\r?\nm=/).slice(1)){let e=/^a=mid:(\S+)/m.exec(n)?.[1],r=/^a=msid:(\S+) \S+/m.exec(n)?.[1];e!==void 0&&r!==void 0&&r!==`-`&&t.set(r,e)}return t},c=e=>/^o=mozilla/m.test(e),l=typeof navigator<`u`&&/Firefox\//.test(navigator.userAgent),u=(e,t)=>l===c(t)?e.polite:l,d=(e,{iceServers:t,send:n,onTracks:a,createPeerConnection:c=i})=>{let l=new Map,d=new Map,f=[],p,m=Promise.resolve(),h=(e,{track:t,stream:n})=>e.addTransceiver(t,{direction:`sendonly`,streams:[n]}).sender,g=({member:e,sid:t})=>{let n=l.get(e)?.pc,r=n?.remoteDescription&&s(n.remoteDescription.sdp).get(t);return r===void 0?void 0:n.getTransceivers().find(e=>e.mid===r)?.receiver.track},_=()=>a(f.map(e=>({...e,...g(e)&&{track:g(e)}}))),v=(e,r)=>{let i=c({iceServers:t});r.pc=i,r.senders=new Map,i.onnegotiationneeded=async()=>{let t=i.setLocalDescription();r.makingOffer=t;try{await t,r.pc===i&&n({type:`signal`,to:e,description:i.localDescription.toJSON()})}finally{r.makingOffer===t&&(r.makingOffer=void 0)}},i.onicecandidate=t=>{t.candidate&&r.pc===i&&n({type:`signal`,to:e,candidate:t.candidate.toJSON()})},i.oniceconnectionstatechange=()=>{i.iceConnectionState===`failed`&&i.restartIce()},i.ontrack=()=>_();for(let[e,t]of d)r.senders.set(e,h(i,t))},y=t=>{let n={polite:e<t,ignoreOffer:!1};return l.set(t,n),v(t,n),n},b=async(e,t)=>{await t.makingOffer,t.pc.close(),v(e,t)},x=e=>{l.get(e)?.pc.close(),l.delete(e)},S=async(e,t,r)=>{let i=l.get(e)??y(e);if(t){let n=t.type===`offer`&&(i.makingOffer!==void 0||i.pc.signalingState!==`stable`);if(i.ignoreOffer=!u(i,t.sdp)&&n,i.ignoreOffer)return;n&&!i.pc.currentRemoteDescription&&await b(e,i)}let{pc:a}=i;t&&(await a.setRemoteDescription(t),t.type===`offer`&&(await a.setLocalDescription(),n({type:`signal`,to:e,description:a.localDescription.toJSON()})),_()),r&&await a.addIceCandidate(r).catch(e=>{if(!i.ignoreOffer)throw e})},C=async e=>{switch(e.type){case`peers`:{let t=new Set(e.members);for(let e of l.keys())t.has(e)||x(e);for(let e of t)l.has(e)||y(e);return}case`signal`:return S(e.from,e.description,e.candidate);case`tracks`:f=e.tracks,_();return;case`published`:p?.resolve();return;case`publish-refused`:p?.reject(new r(e.reason));return}},w=async e=>{let t=Object.entries(e);for(let[e]of t)if(d.has(e))throw Error(`The call already sends a ${e} track: unpublish it first`);if(t.length===0)return;let r=t.map(([e,t])=>{let n=new MediaStream([t]);return[e,{track:t,sid:n.id,stream:n}]}),i=new Promise((e,t)=>p={resolve:e,reject:t});n({type:`publish`,tracks:r.map(([e,{track:t,sid:n}])=>({cid:n,kind:t.kind,source:e}))});try{await i}finally{p=void 0}for(let[e,t]of r){d.set(e,t);for(let n of l.values())n.senders.set(e,h(n.pc,t))}};return{receive:C,publish:e=>{let t=m.then(()=>w(e));return m=t.catch(()=>{}),t},unpublish:async e=>{let t=d.get(e);if(t){d.delete(e);for(let t of l.values()){let n=t.senders.get(e);n&&t.pc.signalingState!==`closed`&&t.pc.removeTrack(n),t.senders.delete(e)}n({type:`unpublish`,sid:t.sid})}},mute:(e,t)=>{let r=d.get(e);r&&(r.track.enabled=!t,n({type:`mute`,sid:r.sid,muted:t}))},restartIce:async()=>{for(let e of l.values())e.pc.restartIce()},resumeState:async e=>({participant:e,tracks:[...d].map(([e,{track:t,sid:n}])=>({cid:n,sid:n,kind:t.kind,source:e}))}),resumed:async()=>{},sending:()=>new Map([...d].map(([e,{track:t}])=>[e,{track:t,simulcast:!1}])),connections:()=>Promise.all([...l].map(([e,t])=>o(t.pc,e))),close:()=>{p?.reject(Error(`The call ended`));for(let e of[...l.keys()])x(e)}}},f=e=>{let t=!1,n=!1,r=[],i=async()=>{t=!0,n=!1,await e()},a=()=>{for(let e of r.splice(0))e()};return{request:async()=>{if(t){n=!0;return}await i()},answered:async()=>{if(t=!1,n)return i();a()},abandon:()=>{t&&(n=!0),t=!1},get pending(){return n},settled:()=>t||n?new Promise(e=>r.push(e)):Promise.resolve(),reset:()=>{t=!1,n=!1,a()}}},p=[{rid:`q`,quality:`low`,scale:4,maxBitrate:15e4},{rid:`h`,quality:`medium`,scale:2,maxBitrate:5e5},{rid:`f`,quality:`high`,scale:1,maxBitrate:12e5}],m=12e5,h=(e,t,n)=>{if(t.kind===`audio`)return{cid:t.id,kind:`audio`,source:e};let{width:r=0,height:i=0}=t.getSettings(),a=n?p.map(e=>({quality:e.quality,width:Math.round(r/e.scale),height:Math.round(i/e.scale),bitrate:e.maxBitrate})):[];return{cid:t.id,kind:`video`,source:e,width:r,height:i,...n&&{layers:a}}},g=(e,t)=>{if(e.kind!==`audio`)return t?p.map(e=>({rid:e.rid,scaleResolutionDownBy:e.scale,maxBitrate:e.maxBitrate})):[{maxBitrate:m}]},_=({iceServers:e,send:t,onTracks:n,onUnpublished:a,createPeerConnection:s=i})=>{let c=s({iceServers:e,bundlePolicy:`max-bundle`}),l=new Map,u=[],d={},p=[],m=0,_,v=Promise.resolve(),y=f(async()=>{let e=await c.createOffer();await c.setLocalDescription(e),t({type:`offer`,sdp:e.sdp,id:++m})}),b=async()=>{c.getTransceivers().length>0&&await y.request()},x=async()=>{await b(),await y.settled()},S=e=>{let t=Object.keys(d).find(t=>d[t]===e);return t===void 0?void 0:c.getTransceivers().find(e=>e.mid===t)?.receiver.track},C=()=>n(p.map(e=>({...e,...S(e.sid)&&{track:S(e.sid)}})));c.onicecandidate=e=>{e.candidate&&t({type:`candidate`,candidate:e.candidate.toJSON()})},c.oniceconnectionstatechange=()=>{c.iceConnectionState===`failed`&&w()},c.ontrack=()=>C();let w=async()=>{c.restartIce(),await x()},T=e=>{let t=l.get(e);return t?(l.delete(e),c.signalingState!==`closed`&&c.removeTrack(t.transceiver.sender),!0):!1},E=async e=>{switch(e.type){case`answer`:if(e.id!==m)return;d={...d,...e.mids},await c.setRemoteDescription({type:`answer`,sdp:e.sdp});for(let e of u.splice(0))await c.addIceCandidate(e);C(),await y.answered();return;case`candidate`:c.remoteDescription?await c.addIceCandidate(e.candidate):u.push(e.candidate);return;case`sections`:for(let t=0;t<e.audio;t++)c.addTransceiver(`audio`,{direction:`recvonly`});for(let t=0;t<e.video;t++)c.addTransceiver(`video`,{direction:`recvonly`});await b();return;case`tracks`:p=e.tracks,C();return;case`unpublished`:{let t=[...l.values()].find(t=>t.sid===e.sid);if(!t)return;T(t.source),await b(),a(t.source);return}case`published`:_?.resolve(e.tracks);return;case`publish-refused`:_?.reject(new r(e.reason));return}},D=async(e,n)=>{let r=Object.entries(e).map(([e,t])=>{if(l.has(e))throw Error(`The call already sends a ${e} track: unpublish it first`);let r=t.kind===`video`&&!!n.simulcast,i=g(t,r);return{source:e,track:t,transceiver:c.addTransceiver(t,{direction:`sendonly`,...i&&{sendEncodings:i}}),simulcast:r}});if(r.length===0)return;let i=new Promise((e,t)=>_={resolve:e,reject:t});t({type:`publish`,tracks:r.map(e=>h(e.source,e.track,e.simulcast))});try{let e=await i;for(let t of r)l.set(t.source,{...t,sid:e.find(e=>e.cid===t.track.id).sid})}catch(e){for(let e of r)e.transceiver.stop();throw e}finally{_=void 0}await x()};return{receive:E,publish:(e,t={})=>{let n=v.then(()=>D(e,t));return v=n.catch(()=>{}),n},unpublish:async e=>{T(e)&&await x()},mute:(e,n)=>{let r=l.get(e);r?.sid&&(r.track.enabled=!n,t({type:`mute`,sid:r.sid,muted:n}))},restartIce:w,resumeState:async e=>{if(c.signalingState===`have-local-offer`&&(await c.setLocalDescription({type:`rollback`}),y.abandon()),!c.localDescription||!c.remoteDescription)return;let t=[...l.values()].flatMap(e=>e.sid?[{cid:e.track.id,sid:e.sid,kind:e.track.kind,source:e.source}]:[]);return{participant:e,offer:c.localDescription.sdp,answer:c.remoteDescription.sdp,tracks:t}},resumed:async()=>{y.pending&&await b()},sending:()=>new Map([...l.values()].map(e=>[e.source,{track:e.track,simulcast:e.simulcast}])),connections:async()=>[await o(c)],close:()=>{_?.reject(Error(`The call ended`)),y.reset(),c.close()}}},v=e=>Math.min(1e4,500*2**e),y=e=>{let t=new URL(e,globalThis.location?.href);return t.protocol=t.protocol.replace(/^http/,`ws`),t.href},b={1e3:`ended`,1008:`removed`},x=new Set([1011,1013]),S=e=>{let t=e.WebSocket??WebSocket,r=e.retryDelayMs??v,i=e.maxRetries??8,a=y(e.url),o,s,c=``,l=``,u=[],f=[],p=!1,m=!1,h=!1,g=!1,S=0,C=Promise.resolve(),w,T=new Promise((e,t)=>w={resolve:e,reject:t}),E=e=>{o.readyState===t.OPEN&&o.send(JSON.stringify(e))},D=n(E),O=e.guest===void 0?{}:{guest:e.guest},k=t=>e.onState?.(t),A=(e,n)=>{p||(p=!0,s?.close(),s=void 0,(o.readyState===t.OPEN||o.readyState===t.CONNECTING)&&o.close(1e3),w.reject(n??Error(`The call was left: ${e}`)),k({state:`left`,reason:e,...n!==void 0&&{error:n}}))},j=t=>{let n={iceServers:t.iceServers,send:E,onTracks:t=>{f=t,e.onTracks?.(t)},onUnpublished:t=>e.onUnpublished?.(t),...e.createPeerConnection&&{createPeerConnection:e.createPeerConnection}};return t.mode===`peer`?d(t.participant,n):_(n)},M=async t=>{switch(t.type){case`joined`:{let e=s?.sending();s?.close(),c=t.participant,l=t.call,s=j(t),S=0,k({state:`joined`}),w.resolve(F);for(let[t,{track:n,simulcast:r}]of e??[])F.publish({[t]:n},{simulcast:r}).catch(e=>A(`ended`,e));return}case`resumed`:g=!0,S=0,k({state:`joined`}),await s?.resumed();return;case`speakers`:e.onSpeakers?.(t.speakers);return;case`members`:u=t.members,e.onMembers?.(u);return;case`left`:t.reason===`rejoin`?m=!0:A(t.reason);return;case`lobby`:e.onLobby?.({guests:t.guests,links:t.links});return;default:if(D.receive(t))return;await s?.receive(t)}},N=e=>{h=!1,g=!1,o=new t(a),o.onopen=()=>{h=!0,C=C.then(async()=>{let t=e===`resume`&&s?await s.resumeState(c):void 0;E(t?{type:`resume`,call:l,...t,...O}:{type:`join`,...O})})},o.onmessage=e=>{let t=JSON.parse(String(e.data));C=C.then(()=>M(t)).catch(e=>A(`ended`,e))},o.onclose=t=>{D.lost(),C=C.then(()=>P(e,t.code))}},P=(e,t)=>{if(p)return;if(m)return m=!1,N(`join`);let n=b[t];if(n)return A(n);if(!c&&!x.has(t))return A(`refused`);if(S++,S>i)return A(c?`ended`:`unavailable`);k(c?{state:`resuming`}:{state:`connecting`});let a=e===`resume`&&h&&!g?`join`:`resume`;setTimeout(()=>{p||N(a)},r(S-1))},F={get id(){return l},get participant(){return c},members:()=>u,publish:async(e,t)=>{if(!s)throw Error(`The call was left`);await s.publish(e,t)},unpublish:async e=>{await s?.unpublish(e)},mute:(e,t)=>s?.mute(e,t),view:(e,t)=>E(t===`hidden`?{type:`view`,sids:e,width:0,height:0,hidden:!0}:{type:`view`,sids:e,...t}),restartIce:async()=>{await s?.restartIce()},leave:()=>{p||(E({type:`leave`}),A(`ended`))},tracks:()=>f,connections:async()=>s?s.connections():[],guests:D.guests};return k({state:`connecting`}),N(`join`),T},C=class extends Error{status;constructor(e,t){super(t),this.status=e,this.name=`LobbyRefused`}},w=({systemPath:t=`/api`,fetch:n=globalThis.fetch}={})=>{let r=e(t,`lobby`),i=async e=>{let t=await n(r,{...e,credentials:`omit`,cache:`no-store`});if(!t.ok)throw new C(t.status,(await t.json().catch(()=>void 0))?.detail??t.statusText);return t},a=e=>({authorization:`Bearer ${e}`});return{socketUrl:e(t,`socket`),enter:async(e,t)=>await(await i({method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({link:e,name:t})})).json(),wait:async e=>await(await i({method:`GET`,headers:a(e)})).json(),leave:async e=>{await i({method:`DELETE`,headers:a(e)})}}};export{t as GuestRefused,C as LobbyRefused,r as PublishRefused,w as guestLobby,S as joinCall};
2
- //# debugId=39be3404-2918-4301-ab89-6c47feed9bea
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{sl as e}from"./app-BXbP4Ty1.js";var t=class extends Error{reason;constructor(e){super(`The guest request was refused: ${e}`),this.reason=e,this.name=`GuestRefused`}},n=e=>{let n=[],r=t=>new Promise((r,i)=>{n.push({resolve:r,reject:i}),e(t)});return{guests:{link:({publish:e,expiresAt:t})=>r({type:`guest-link`,publish:e,...t&&{expires_at:t.toISOString()}}),revoke:e=>r({type:`guest-link-revoke`,link:e}),admit:e=>r({type:`guest-decide`,guest:e,admit:!0}),deny:e=>r({type:`guest-decide`,guest:e,admit:!1}),remove:e=>r({type:`guest-remove`,guest:e})},receive:e=>{if(e.type!==`guest-link`&&e.type!==`guest-done`&&e.type!==`guest-refused`)return!1;let r=n.shift();return e.type===`guest-refused`?r?.reject(new t(e.reason)):r?.resolve(e.type===`guest-link`?{link:e.link,token:e.token}:void 0),!0},lost:()=>{for(let e of n.splice(0))e.reject(Error(`The link to the call was lost before the server answered`))}}},r=class extends Error{constructor(e){super(e),this.name=`PublishRefused`}},i=e=>new RTCPeerConnection(e),a=e=>{let t=[...e],n=t.find(e=>e.type===`transport`&&typeof e.selectedCandidatePairId==`string`),r=t.find(e=>e.type===`candidate-pair`&&(e.id===n?.selectedCandidatePairId||!n&&e.selected===!0||!n&&e.nominated===!0&&e.state===`succeeded`)),i=0,a=0;for(let e of t)e.type===`inbound-rtp`&&(i+=Math.max(0,Number(e.packetsLost??0)),a+=Number(e.packetsReceived??0));let o=typeof r?.currentRoundTripTime==`number`?r.currentRoundTripTime*1e3:void 0;return{...o!==void 0&&{roundTripMs:o},...i+a>0&&{lostRatio:i/(i+a)}}},o=async(e,t)=>{let n=e.connectionState,r=n===`connected`?a((await e.getStats()).values()):{};return{...t!==void 0&&{member:t},state:n,...r}},s=e=>{let t=new Map;for(let n of e.split(/\r?\nm=/).slice(1)){let e=/^a=mid:(\S+)/m.exec(n)?.[1],r=/^a=msid:(\S+) \S+/m.exec(n)?.[1];e!==void 0&&r!==void 0&&r!==`-`&&t.set(r,e)}return t},c=e=>/^o=mozilla/m.test(e),l=typeof navigator<`u`&&/Firefox\//.test(navigator.userAgent),u=(e,t)=>l===c(t)?e.polite:l,d=(e,{iceServers:t,send:n,onTracks:a,createPeerConnection:c=i})=>{let l=new Map,d=new Map,f=[],p,m=Promise.resolve(),h=(e,{track:t,stream:n})=>e.addTransceiver(t,{direction:`sendonly`,streams:[n]}).sender,g=({member:e,sid:t})=>{let n=l.get(e)?.pc,r=n?.remoteDescription&&s(n.remoteDescription.sdp).get(t);return r===void 0?void 0:n.getTransceivers().find(e=>e.mid===r)?.receiver.track},_=()=>a(f.map(e=>({...e,...g(e)&&{track:g(e)}}))),v=(e,r)=>{let i=c({iceServers:t});r.pc=i,r.senders=new Map,i.onnegotiationneeded=async()=>{let t=i.setLocalDescription();r.makingOffer=t;try{await t,r.pc===i&&n({type:`signal`,to:e,description:i.localDescription.toJSON()})}finally{r.makingOffer===t&&(r.makingOffer=void 0)}},i.onicecandidate=t=>{t.candidate&&r.pc===i&&n({type:`signal`,to:e,candidate:t.candidate.toJSON()})},i.oniceconnectionstatechange=()=>{i.iceConnectionState===`failed`&&i.restartIce()},i.ontrack=()=>_();for(let[e,t]of d)r.senders.set(e,h(i,t))},y=t=>{let n={polite:e<t,ignoreOffer:!1};return l.set(t,n),v(t,n),n},b=async(e,t)=>{await t.makingOffer,t.pc.close(),v(e,t)},x=e=>{l.get(e)?.pc.close(),l.delete(e)},S=async(e,t,r)=>{let i=l.get(e)??y(e);if(t){let n=t.type===`offer`&&(i.makingOffer!==void 0||i.pc.signalingState!==`stable`);if(i.ignoreOffer=!u(i,t.sdp)&&n,i.ignoreOffer)return;n&&!i.pc.currentRemoteDescription&&await b(e,i)}let{pc:a}=i;t&&(await a.setRemoteDescription(t),t.type===`offer`&&(await a.setLocalDescription(),n({type:`signal`,to:e,description:a.localDescription.toJSON()})),_()),r&&await a.addIceCandidate(r).catch(e=>{if(!i.ignoreOffer)throw e})},C=async e=>{switch(e.type){case`peers`:{let t=new Set(e.members);for(let e of l.keys())t.has(e)||x(e);for(let e of t)l.has(e)||y(e);return}case`signal`:return S(e.from,e.description,e.candidate);case`tracks`:f=e.tracks,_();return;case`published`:p?.resolve();return;case`publish-refused`:p?.reject(new r(e.reason));return}},w=async e=>{let t=Object.entries(e);for(let[e]of t)if(d.has(e))throw Error(`The call already sends a ${e} track: unpublish it first`);if(t.length===0)return;let r=t.map(([e,t])=>{let n=new MediaStream([t]);return[e,{track:t,sid:n.id,stream:n}]}),i=new Promise((e,t)=>p={resolve:e,reject:t});n({type:`publish`,tracks:r.map(([e,{track:t,sid:n}])=>({cid:n,kind:t.kind,source:e}))});try{await i}finally{p=void 0}for(let[e,t]of r){d.set(e,t);for(let n of l.values())n.senders.set(e,h(n.pc,t))}};return{receive:C,publish:e=>{let t=m.then(()=>w(e));return m=t.catch(()=>{}),t},unpublish:async e=>{let t=d.get(e);if(t){d.delete(e);for(let t of l.values()){let n=t.senders.get(e);n&&t.pc.signalingState!==`closed`&&t.pc.removeTrack(n),t.senders.delete(e)}n({type:`unpublish`,sid:t.sid})}},mute:(e,t)=>{let r=d.get(e);r&&(r.track.enabled=!t,n({type:`mute`,sid:r.sid,muted:t}))},restartIce:async()=>{for(let e of l.values())e.pc.restartIce()},resumeState:async e=>({participant:e,tracks:[...d].map(([e,{track:t,sid:n}])=>({cid:n,sid:n,kind:t.kind,source:e}))}),resumed:async()=>{},sending:()=>new Map([...d].map(([e,{track:t}])=>[e,{track:t,simulcast:!1}])),connections:()=>Promise.all([...l].map(([e,t])=>o(t.pc,e))),close:()=>{p?.reject(Error(`The call ended`));for(let e of[...l.keys()])x(e)}}},f=e=>{let t=!1,n=!1,r=[],i=async()=>{t=!0,n=!1,await e()},a=()=>{for(let e of r.splice(0))e()};return{request:async()=>{if(t){n=!0;return}await i()},answered:async()=>{if(t=!1,n)return i();a()},abandon:()=>{t&&(n=!0),t=!1},get pending(){return n},settled:()=>t||n?new Promise(e=>r.push(e)):Promise.resolve(),reset:()=>{t=!1,n=!1,a()}}},p=[{rid:`q`,quality:`low`,scale:4,maxBitrate:15e4},{rid:`h`,quality:`medium`,scale:2,maxBitrate:5e5},{rid:`f`,quality:`high`,scale:1,maxBitrate:12e5}],m=12e5,h=(e,t,n)=>{if(t.kind===`audio`)return{cid:t.id,kind:`audio`,source:e};let{width:r=0,height:i=0}=t.getSettings(),a=n?p.map(e=>({quality:e.quality,width:Math.round(r/e.scale),height:Math.round(i/e.scale),bitrate:e.maxBitrate})):[];return{cid:t.id,kind:`video`,source:e,width:r,height:i,...n&&{layers:a}}},g=(e,t)=>{if(e.kind!==`audio`)return t?p.map(e=>({rid:e.rid,scaleResolutionDownBy:e.scale,maxBitrate:e.maxBitrate})):[{maxBitrate:m}]},_=({iceServers:e,send:t,onTracks:n,onUnpublished:a,createPeerConnection:s=i})=>{let c=s({iceServers:e,bundlePolicy:`max-bundle`}),l=new Map,u=[],d={},p=[],m=0,_,v=Promise.resolve(),y=f(async()=>{let e=await c.createOffer();await c.setLocalDescription(e),t({type:`offer`,sdp:e.sdp,id:++m})}),b=async()=>{c.getTransceivers().length>0&&await y.request()},x=async()=>{await b(),await y.settled()},S=e=>{let t=Object.keys(d).find(t=>d[t]===e);return t===void 0?void 0:c.getTransceivers().find(e=>e.mid===t)?.receiver.track},C=()=>n(p.map(e=>({...e,...S(e.sid)&&{track:S(e.sid)}})));c.onicecandidate=e=>{e.candidate&&t({type:`candidate`,candidate:e.candidate.toJSON()})},c.oniceconnectionstatechange=()=>{c.iceConnectionState===`failed`&&w()},c.ontrack=()=>C();let w=async()=>{c.restartIce(),await x()},T=e=>{let t=l.get(e);return t?(l.delete(e),c.signalingState!==`closed`&&c.removeTrack(t.transceiver.sender),!0):!1},E=async e=>{switch(e.type){case`answer`:if(e.id!==m)return;d={...d,...e.mids},await c.setRemoteDescription({type:`answer`,sdp:e.sdp});for(let e of u.splice(0))await c.addIceCandidate(e);C(),await y.answered();return;case`candidate`:c.remoteDescription?await c.addIceCandidate(e.candidate):u.push(e.candidate);return;case`sections`:for(let t=0;t<e.audio;t++)c.addTransceiver(`audio`,{direction:`recvonly`});for(let t=0;t<e.video;t++)c.addTransceiver(`video`,{direction:`recvonly`});await b();return;case`tracks`:p=e.tracks,C();return;case`unpublished`:{let t=[...l.values()].find(t=>t.sid===e.sid);if(!t)return;T(t.source),await b(),a(t.source);return}case`published`:_?.resolve(e.tracks);return;case`publish-refused`:_?.reject(new r(e.reason));return}},D=async(e,n)=>{let r=Object.entries(e).map(([e,t])=>{if(l.has(e))throw Error(`The call already sends a ${e} track: unpublish it first`);let r=t.kind===`video`&&!!n.simulcast,i=g(t,r);return{source:e,track:t,transceiver:c.addTransceiver(t,{direction:`sendonly`,...i&&{sendEncodings:i}}),simulcast:r}});if(r.length===0)return;let i=new Promise((e,t)=>_={resolve:e,reject:t});t({type:`publish`,tracks:r.map(e=>h(e.source,e.track,e.simulcast))});try{let e=await i;for(let t of r)l.set(t.source,{...t,sid:e.find(e=>e.cid===t.track.id).sid})}catch(e){for(let e of r)e.transceiver.stop();throw e}finally{_=void 0}await x()};return{receive:E,publish:(e,t={})=>{let n=v.then(()=>D(e,t));return v=n.catch(()=>{}),n},unpublish:async e=>{T(e)&&await x()},mute:(e,n)=>{let r=l.get(e);r?.sid&&(r.track.enabled=!n,t({type:`mute`,sid:r.sid,muted:n}))},restartIce:w,resumeState:async e=>{if(c.signalingState===`have-local-offer`&&(await c.setLocalDescription({type:`rollback`}),y.abandon()),!c.localDescription||!c.remoteDescription)return;let t=[...l.values()].flatMap(e=>e.sid?[{cid:e.track.id,sid:e.sid,kind:e.track.kind,source:e.source}]:[]);return{participant:e,offer:c.localDescription.sdp,answer:c.remoteDescription.sdp,tracks:t}},resumed:async()=>{y.pending&&await b()},sending:()=>new Map([...l.values()].map(e=>[e.source,{track:e.track,simulcast:e.simulcast}])),connections:async()=>[await o(c)],close:()=>{_?.reject(Error(`The call ended`)),y.reset(),c.close()}}},v=e=>Math.min(1e4,500*2**e),y=e=>{let t=new URL(e,globalThis.location?.href);return t.protocol=t.protocol.replace(/^http/,`ws`),t.href},b={1e3:`ended`,1008:`removed`},x=new Set([1011,1013]),S=e=>{let t=e.WebSocket??WebSocket,r=e.retryDelayMs??v,i=e.maxRetries??8,a=y(e.url),o,s,c=``,l=``,u=[],f=[],p=!1,m=!1,h=!1,g=!1,S=0,C=Promise.resolve(),w,T=new Promise((e,t)=>w={resolve:e,reject:t}),E=e=>{o.readyState===t.OPEN&&o.send(JSON.stringify(e))},D=n(E),O=e.guest===void 0?{}:{guest:e.guest},k=t=>e.onState?.(t),A=(e,n)=>{p||(p=!0,s?.close(),s=void 0,(o.readyState===t.OPEN||o.readyState===t.CONNECTING)&&o.close(1e3),w.reject(n??Error(`The call was left: ${e}`)),k({state:`left`,reason:e,...n!==void 0&&{error:n}}))},j=t=>{let n={iceServers:t.iceServers,send:E,onTracks:t=>{f=t,e.onTracks?.(t)},onUnpublished:t=>e.onUnpublished?.(t),...e.createPeerConnection&&{createPeerConnection:e.createPeerConnection}};return t.mode===`peer`?d(t.participant,n):_(n)},M=async t=>{switch(t.type){case`joined`:{let e=s?.sending();s?.close(),c=t.participant,l=t.call,s=j(t),S=0,k({state:`joined`}),w.resolve(F);for(let[t,{track:n,simulcast:r}]of e??[])F.publish({[t]:n},{simulcast:r}).catch(e=>A(`ended`,e));return}case`resumed`:g=!0,S=0,k({state:`joined`}),await s?.resumed();return;case`speakers`:e.onSpeakers?.(t.speakers);return;case`members`:u=t.members,e.onMembers?.(u);return;case`left`:t.reason===`rejoin`?m=!0:A(t.reason);return;case`lobby`:e.onLobby?.({guests:t.guests,links:t.links});return;default:if(D.receive(t))return;await s?.receive(t)}},N=e=>{h=!1,g=!1,o=new t(a),o.onopen=()=>{h=!0,C=C.then(async()=>{let t=e===`resume`&&s?await s.resumeState(c):void 0;E(t?{type:`resume`,call:l,...t,...O}:{type:`join`,...O})})},o.onmessage=e=>{let t=JSON.parse(String(e.data));C=C.then(()=>M(t)).catch(e=>A(`ended`,e))},o.onclose=t=>{D.lost(),C=C.then(()=>P(e,t.code))}},P=(e,t)=>{if(p)return;if(m)return m=!1,N(`join`);let n=b[t];if(n)return A(n);if(!c&&!x.has(t))return A(`refused`);if(S++,S>i)return A(c?`ended`:`unavailable`);k(c?{state:`resuming`}:{state:`connecting`});let a=e===`resume`&&h&&!g?`join`:`resume`;setTimeout(()=>{p||N(a)},r(S-1))},F={get id(){return l},get participant(){return c},members:()=>u,publish:async(e,t)=>{if(!s)throw Error(`The call was left`);await s.publish(e,t)},unpublish:async e=>{await s?.unpublish(e)},mute:(e,t)=>s?.mute(e,t),view:(e,t)=>E(t===`hidden`?{type:`view`,sids:e,width:0,height:0,hidden:!0}:{type:`view`,sids:e,...t}),restartIce:async()=>{await s?.restartIce()},leave:()=>{p||(E({type:`leave`}),A(`ended`))},tracks:()=>f,connections:async()=>s?s.connections():[],guests:D.guests};return k({state:`connecting`}),N(`join`),T},C=class extends Error{status;constructor(e,t){super(t),this.status=e,this.name=`LobbyRefused`}},w=({systemPath:t=`/api`,fetch:n=globalThis.fetch}={})=>{let r=e(t,`lobby`),i=async e=>{let t=await n(r,{...e,credentials:`omit`,cache:`no-store`});if(!t.ok)throw new C(t.status,(await t.json().catch(()=>void 0))?.detail??t.statusText);return t},a=e=>({authorization:`Bearer ${e}`});return{socketUrl:e(t,`socket`),enter:async(e,t)=>await(await i({method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({link:e,name:t})})).json(),wait:async e=>await(await i({method:`GET`,headers:a(e)})).json(),leave:async e=>{await i({method:`DELETE`,headers:a(e)})}}};export{t as GuestRefused,C as LobbyRefused,r as PublishRefused,w as guestLobby,S as joinCall};
2
+ //# debugId=f1061a62-b168-4f9f-910d-16b7d454b68f
@@ -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{Wc as e}from"./app-CK_M0TgA.js";var t={name:`circle-alert`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`]};t.node;var n=e(t);export{n as t};
2
- //# debugId=f8b138b0-36e4-4d2e-9c6d-c25d97058462
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{Kc as e}from"./app-BXbP4Ty1.js";var t={name:`circle-alert`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`]};t.node;var n=e(t);export{n as t};
2
+ //# debugId=bd1f716a-33b1-407a-8618-4f47d8e74eb3
@@ -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{Li as n,Ya as r,ec as i,er as a,os as o,ss as s,tn as c,tr as l,va as u}from"./app-BXbP4Ty1.js";import{t as d}from"./render-node-D-4-E94O.js";import{t as f}from"./start-block-queries-sM50NWuR.js";var p=e(t(),1),m=({name:e,tab:t,params:m})=>{let h=s().pages[e];if(!h)return(0,p.jsx)(o,{title:r(`notFound`),children:r.rich(`noPage`,{page:e})});let g=t=>i(l({page:e,...t&&{tab:t},given:m??{}}));return(0,p.jsx)(u,{route:{...t&&{tab:t},pathOf:g},children:(0,p.jsx)(a,{page:e,...t&&{tab:t},tree:h.tree,...m&&{given:m},children:(0,p.jsxs)(c,{tree:h.tree,plan:h.reads,children:[(0,p.jsx)(f,{tree:h.tree,plan:h.reads}),(0,p.jsx)(n,{children:(0,p.jsx)(d,{node:h.tree,at:``})})]})})})};export{m as ComposedPage};
2
+ //# debugId=35ab9c2b-7143-4d36-a438-51fe4298f2af
@@ -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{l as n}from"./app-CK_M0TgA.js";import{m as r}from"./render-node-CSjGRPb0.js";var i=e(t(),1),a=({item:e,owner:t,recordKey:a})=>(0,i.jsx)(`div`,{className:`pb-8`,children:(0,i.jsx)(r,{resource:e.resource,field:e.text,values:{[e.field]:n(t,a)},placeholder:e.placeholder})});export{a as ComposerSection};
2
- //# debugId=e9fb133d-f9b5-474e-bd58-042bf5c0e0ad
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{l as n}from"./app-BXbP4Ty1.js";import{m as r}from"./render-node-D-4-E94O.js";var i=e(t(),1),a=({item:e,owner:t,recordKey:a})=>(0,i.jsx)(`div`,{className:`pb-8`,children:(0,i.jsx)(r,{resource:e.resource,field:e.text,values:{[e.field]:n(t,a)},placeholder:e.placeholder})});export{a as ComposerSection};
2
+ //# debugId=acad39bc-4ac7-469d-9a0d-30e98622fd3a
@@ -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{G as r,Rt as i,Ss as a,Ts as o,U as s,W as c,Zs as l,as as u,do as d,fc as f,fo as p,nc as m,ns as h,po as g,uc as _}from"./app-CK_M0TgA.js";import{n as v,t as y}from"./client-publisher-D39SlIhp.js";var b=e(t(),1),x=[`localhost`,`127.0.0.1`,`[::1]`],S=[`javascript:`,`data:`,`vbscript:`,`file:`,`blob:`,`about:`],C=e=>{if(!URL.canParse(e))return;let t=new URL(e);if(t.protocol===`https:`)return{kind:`site`,host:t.host};if(t.protocol===`http:`)return x.includes(t.hostname)?{kind:`this-computer`,port:t.port||`80`}:void 0;if(!S.includes(t.protocol))return{kind:`device-app`,uri:e.split(`?`)[0].split(`#`)[0]}},w=e=>!URL.canParse(e,`http://local`)||!S.includes(new URL(e,`http://local`).protocol),T=(e,t)=>{let n=new URL(e,t.origin);if(n.origin===t.origin&&n.pathname===t.pathname)return l(n.search).oauthQuery},E=()=>{let{params:e}=m();return(0,b.useMemo)(()=>l(e.toString()),[e])},D=e(n(),1),O={invalid_signature:`This request has expired: connect again from your app.`,STAFF_CANNOT_CONNECT:`Staff signed in as someone cannot allow apps to act for them.`,SIGN_IN_SETUP_REQUIRED:`Set up what this app requires for signing in first, then connect again from your app.`,ADDRESS_NOT_VERIFIED:`Confirm your address first: sign out, then sign in with a code emailed to you, and connect again from your app.`},k=e=>{if(!(e instanceof o))throw e;return(e.code&&O[e.code])??h(e)},A=e=>t=>{if(!w(t))throw new o(`The app asked to be sent somewhere this page will not go.`,400);e(t)},j=({target:e})=>e.kind===`site`?(0,D.jsxs)(D.Fragment,{children:[`the website `,(0,D.jsx)(`strong`,{className:`font-medium text-foreground`,children:e.host})]}):e.kind===`this-computer`?(0,D.jsxs)(D.Fragment,{children:[`an app on this computer (port `,e.port,`)`]}):(0,D.jsxs)(D.Fragment,{children:[`an app on this device that opens `,(0,D.jsx)(`code`,{className:`break-all text-foreground`,children:e.uri})]}),M=({title:e,icon:t,children:n})=>(0,D.jsx)(d,{title:e,icon:t,children:(0,D.jsx)(`p`,{className:`text-muted-foreground`,children:n})}),N=({asking:e,appName:t,appIcon:n,email:i,onAnswer:a,onSignOut:o})=>{let[s,l]=(0,b.useState)(!1),u=c(500),f=e=>{l(!0),a(e).finally(()=>l(!1))},p=r(u&&!s,()=>f(!0)),m=v(e.client.client_name),h=y(e.client.client_id),{target:g}=e;return(0,D.jsx)(d,{title:`Allow an app to act as you in ${t}?`,icon:n,size:`md`,children:(0,D.jsxs)(`section`,{"aria-label":`Allow an app`,children:[(0,D.jsxs)(`p`,{children:[`An app that calls itself`,` `,(0,D.jsxs)(`bdi`,{className:`inline-block max-w-full truncate align-bottom font-medium`,title:m,children:[`“`,m??`no name`,`”`]}),` `,`asks to act as you here.`]}),h&&(0,D.jsxs)(`p`,{className:`mt-1 text-muted-foreground`,children:[`Published by `,h,`.`]}),g?(0,D.jsxs)(`p`,{className:`mt-3 text-muted-foreground`,children:[`Allowing sends you on to `,(0,D.jsx)(j,{target:g}),`.`]}):(0,D.jsx)(`p`,{role:`alert`,className:`mt-3 text-danger-text`,children:`This app asked to be sent somewhere this page will not go, so it cannot be allowed.`}),(0,D.jsx)(`p`,{className:`mt-3 text-muted-foreground`,children:`It can then read and change what you can, with your current role and organization, until you disconnect it from your account page.`}),(0,D.jsxs)(`div`,{className:`mt-5 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,children:[(0,D.jsx)(_,{disabled:s,onClick:()=>f(!1),children:`Deny`}),g&&(0,D.jsx)(_,{variant:`primary`,loading:s,disabled:!u||s,...p,children:`Allow`})]}),(0,D.jsxs)(`p`,{className:`mt-4 border-t pt-3 text-xs text-muted-foreground`,children:[`Signed in as `,i,`.`,` `,(0,D.jsx)(`button`,{type:`button`,className:`underline underline-offset-2 hover:text-foreground`,onClick:o,children:`Not you? Sign out`})]})]})})},P=({oauthQuery:e,appName:t,appIcon:n,email:r,assign:i})=>{let{session:o,signOut:s}=a(),{path:c,basePath:l}=m(),u=A(i),d=e=>T(e,{origin:window.location.origin,pathname:`${l}${c}`}),[p,h]=(0,b.useState)({kind:`loading`}),g=e=>h({kind:`failed`,message:k(e)});(0,b.useEffect)(()=>{let t=!0;return(async()=>{let{url:n}=await o.connect.resume(e),r=d(n);if(r===void 0)return u(n);let i=new URLSearchParams(r),a=await o.connect.client(i.get(`client_id`)??``);t&&h({kind:`asking`,asking:{oauthQuery:r,client:a,target:C(i.get(`redirect_uri`)??``)}})})().catch(e=>t&&g(e)),()=>{t=!1}},[o,e]);let _=async(e,t)=>{try{let{url:n}=await o.connect.answer(e,t.oauthQuery);d(n)!==void 0&&await s(),u(n)}catch(e){g(e)}};return p.kind===`failed`?(0,D.jsx)(M,{title:`This app cannot be connected`,icon:n,children:p.message}):p.kind===`loading`?(0,D.jsxs)(`div`,{className:`flex min-h-full w-full items-center justify-center gap-2 bg-surface text-muted-foreground`,children:[(0,D.jsx)(f,{}),` Loading`]}):(0,D.jsx)(N,{asking:p.asking,appName:t,appIcon:n,email:r,onAnswer:e=>_(e,p.asking),onSignOut:()=>void s()})},F=({email:e,appName:t,appIcon:n,isFramed:r=s,assign:i=e=>window.location.assign(e)})=>{let[a]=(0,b.useState)(r),{oauthQuery:o}=E();return a?(0,D.jsxs)(M,{title:`This page cannot be used inside another site`,icon:n,children:[(0,D.jsx)(`a`,{href:window.location.href,target:`_blank`,rel:`noopener`,className:`underline underline-offset-2`,children:`Open it on its own`}),` `,`to go on.`]}):o?(0,D.jsx)(P,{oauthQuery:o,appName:t,appIcon:n,email:e,assign:i},o):(0,D.jsx)(M,{title:`Nothing to connect`,icon:n,children:`Connect again from your app.`})},I={title:`Sign in to connect an app`,description:`An app asks to act as you here. Sign in, then choose whether to allow it.`},L=()=>{let e=u(),{state:t}=a();return g(p([`Connect an app`],e.appName)),t.kind===`signed-in`?(0,D.jsx)(F,{email:t.user.email,appName:e.appName??`this app`,appIcon:e.appIcon}):(0,D.jsx)(d,{title:I.title,description:I.description,icon:e.appIcon,children:(0,D.jsx)(`div`,{className:`flex flex-col gap-2 [&>*]:min-h-10 [&>*]:w-full`,children:(0,D.jsx)(i,{prompt:I})})})};export{L as ConnectRoute};
2
- //# debugId=e48cb6b0-c4cf-4e77-844f-0cbd2c2fd832
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,Ds as i,H as a,Lt as o,U as s,W as c,fc as l,ho as u,ic as d,is as f,mc as p,mo as m,po as h,ss as g,ws as _}from"./app-BXbP4Ty1.js";import{n as v,t as y}from"./client-publisher-D39SlIhp.js";var b=e(t(),1),x=[`localhost`,`127.0.0.1`,`[::1]`],S=[`javascript:`,`data:`,`vbscript:`,`file:`,`blob:`,`about:`],C=e=>{if(!URL.canParse(e))return;let t=new URL(e);if(t.protocol===`https:`)return{kind:`site`,host:t.host};if(t.protocol===`http:`)return x.includes(t.hostname)?{kind:`this-computer`,port:t.port||`80`}:void 0;if(!S.includes(t.protocol))return{kind:`device-app`,uri:e.split(`?`)[0].split(`#`)[0]}},w=e=>!URL.canParse(e,`http://local`)||!S.includes(new URL(e,`http://local`).protocol),T=(e,t)=>{let n=new URL(e,t.origin);if(n.origin===t.origin&&n.pathname===t.pathname)return r(n.search).oauthQuery},E=()=>{let{params:e}=d();return(0,b.useMemo)(()=>r(e.toString()),[e])},D=e(n(),1),O={invalid_signature:`This request has expired: connect again from your app.`,STAFF_CANNOT_CONNECT:`Staff signed in as someone cannot allow apps to act for them.`,SIGN_IN_SETUP_REQUIRED:`Set up what this app requires for signing in first, then connect again from your app.`,ADDRESS_NOT_VERIFIED:`Confirm your address first: sign out, then sign in with a code emailed to you, and connect again from your app.`},k=e=>{if(!(e instanceof i))throw e;return(e.code&&O[e.code])??f(e)},A=e=>t=>{if(!w(t))throw new i(`The app asked to be sent somewhere this page will not go.`,400);e(t)},j=({target:e})=>e.kind===`site`?(0,D.jsxs)(D.Fragment,{children:[`the website `,(0,D.jsx)(`strong`,{className:`font-medium text-foreground`,children:e.host})]}):e.kind===`this-computer`?(0,D.jsxs)(D.Fragment,{children:[`an app on this computer (port `,e.port,`)`]}):(0,D.jsxs)(D.Fragment,{children:[`an app on this device that opens `,(0,D.jsx)(`code`,{className:`break-all text-foreground`,children:e.uri})]}),M=({title:e,icon:t,children:n})=>(0,D.jsx)(h,{title:e,icon:t,children:(0,D.jsx)(`p`,{className:`text-muted-foreground`,children:n})}),N=({asking:e,appName:t,appIcon:n,email:r,onAnswer:i,onSignOut:a})=>{let[o,u]=(0,b.useState)(!1),d=s(500),f=e=>{u(!0),i(e).finally(()=>u(!1))},p=c(d&&!o,()=>f(!0)),m=v(e.client.client_name),g=y(e.client.client_id),{target:_}=e;return(0,D.jsx)(h,{title:`Allow an app to act as you in ${t}?`,icon:n,size:`md`,children:(0,D.jsxs)(`section`,{"aria-label":`Allow an app`,children:[(0,D.jsxs)(`p`,{children:[`An app that calls itself`,` `,(0,D.jsxs)(`bdi`,{className:`inline-block max-w-full truncate align-bottom font-medium`,title:m,children:[`“`,m??`no name`,`”`]}),` `,`asks to act as you here.`]}),g&&(0,D.jsxs)(`p`,{className:`mt-1 text-muted-foreground`,children:[`Published by `,g,`.`]}),_?(0,D.jsxs)(`p`,{className:`mt-3 text-muted-foreground`,children:[`Allowing sends you on to `,(0,D.jsx)(j,{target:_}),`.`]}):(0,D.jsx)(`p`,{role:`alert`,className:`mt-3 text-danger-text`,children:`This app asked to be sent somewhere this page will not go, so it cannot be allowed.`}),(0,D.jsx)(`p`,{className:`mt-3 text-muted-foreground`,children:`It can then read and change what you can, with your current role and organization, until you disconnect it from your account page.`}),(0,D.jsxs)(`div`,{className:`mt-5 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,children:[(0,D.jsx)(l,{disabled:o,onClick:()=>f(!1),children:`Deny`}),_&&(0,D.jsx)(l,{variant:`primary`,loading:o,disabled:!d||o,...p,children:`Allow`})]}),(0,D.jsxs)(`p`,{className:`mt-4 border-t pt-3 text-xs text-muted-foreground`,children:[`Signed in as `,r,`.`,` `,(0,D.jsx)(`button`,{type:`button`,className:`underline underline-offset-2 hover:text-foreground`,onClick:a,children:`Not you? Sign out`})]})]})})},P=({oauthQuery:e,appName:t,appIcon:n,email:r,assign:i})=>{let{session:a,signOut:o}=_(),{path:s,basePath:c}=d(),l=A(i),u=e=>T(e,{origin:window.location.origin,pathname:`${c}${s}`}),[f,m]=(0,b.useState)({kind:`loading`}),h=e=>m({kind:`failed`,message:k(e)});(0,b.useEffect)(()=>{let t=!0;return(async()=>{let{url:n}=await a.connect.resume(e),r=u(n);if(r===void 0)return l(n);let i=new URLSearchParams(r),o=await a.connect.client(i.get(`client_id`)??``);t&&m({kind:`asking`,asking:{oauthQuery:r,client:o,target:C(i.get(`redirect_uri`)??``)}})})().catch(e=>t&&h(e)),()=>{t=!1}},[a,e]);let g=async(e,t)=>{try{let{url:n}=await a.connect.answer(e,t.oauthQuery);u(n)!==void 0&&await o(),l(n)}catch(e){h(e)}};return f.kind===`failed`?(0,D.jsx)(M,{title:`This app cannot be connected`,icon:n,children:f.message}):f.kind===`loading`?(0,D.jsxs)(`div`,{className:`flex min-h-full w-full items-center justify-center gap-2 bg-surface text-muted-foreground`,children:[(0,D.jsx)(p,{}),` Loading`]}):(0,D.jsx)(N,{asking:f.asking,appName:t,appIcon:n,email:r,onAnswer:e=>g(e,f.asking),onSignOut:()=>void o()})},F=({email:e,appName:t,appIcon:n,isFramed:r=a,assign:i=e=>window.location.assign(e)})=>{let[o]=(0,b.useState)(r),{oauthQuery:s}=E();return o?(0,D.jsxs)(M,{title:`This page cannot be used inside another site`,icon:n,children:[(0,D.jsx)(`a`,{href:window.location.href,target:`_blank`,rel:`noopener`,className:`underline underline-offset-2`,children:`Open it on its own`}),` `,`to go on.`]}):s?(0,D.jsx)(P,{oauthQuery:s,appName:t,appIcon:n,email:e,assign:i},s):(0,D.jsx)(M,{title:`Nothing to connect`,icon:n,children:`Connect again from your app.`})},I={title:`Sign in to connect an app`,description:`An app asks to act as you here. Sign in, then choose whether to allow it.`},L=()=>{let e=g(),{state:t}=_();return u(m([`Connect an app`],e.appName)),t.kind===`signed-in`?(0,D.jsx)(F,{email:t.user.email,appName:e.appName??`this app`,appIcon:e.appIcon}):(0,D.jsx)(h,{title:I.title,description:I.description,icon:e.appIcon,children:(0,D.jsx)(`div`,{className:`flex flex-col gap-2 [&>*]:min-h-10 [&>*]:w-full`,children:(0,D.jsx)(o,{prompt:I})})})};export{L as ConnectRoute};
2
+ //# debugId=58e5f86f-b918-40b7-a750-68f6a3603b0f
@@ -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{Mc as r,xs as i,zc as a}from"./app-CK_M0TgA.js";var o=e(t(),1),s=e(n(),1),c=({value:e,copyLabel:t})=>{let[n,c]=(0,o.useState)();return(0,o.useEffect)(()=>{if(n!==`yes`)return;let e=setTimeout(()=>c(void 0),2e3);return()=>clearTimeout(e)},[n]),(0,s.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,s.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border bg-surface py-1.5 pl-3 pr-1.5`,children:[(0,s.jsx)(`code`,{className:`min-w-0 flex-1 break-all font-mono text-xs`,children:e}),(0,s.jsx)(`button`,{type:`button`,"aria-label":n===`yes`?i(`copied`):t,onClick:()=>{if(!navigator.clipboard)return c(`refused`);navigator.clipboard.writeText(e).then(()=>c(`yes`),e=>{if(!(e instanceof DOMException))throw e;c(`refused`)})},className:`inline-flex size-8 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted pointer-coarse:size-11`,children:n===`yes`?(0,s.jsx)(a,{className:`size-4 text-success`}):(0,s.jsx)(r,{className:`size-4`})})]}),n===`refused`&&(0,s.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs font-medium text-danger-text`,children:i(`copyRefused`)})]})};export{c as t};
2
- //# debugId=75e30ef5-7327-4dea-a620-5ae0e6388128
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{Cs as r,Pc as i,Vc as a}from"./app-BXbP4Ty1.js";var o=e(t(),1),s=e(n(),1),c=({value:e,copyLabel:t})=>{let[n,c]=(0,o.useState)();return(0,o.useEffect)(()=>{if(n!==`yes`)return;let e=setTimeout(()=>c(void 0),2e3);return()=>clearTimeout(e)},[n]),(0,s.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,s.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border bg-surface py-1.5 pl-3 pr-1.5`,children:[(0,s.jsx)(`code`,{className:`min-w-0 flex-1 break-all font-mono text-xs`,children:e}),(0,s.jsx)(`button`,{type:`button`,"aria-label":n===`yes`?r(`copied`):t,onClick:()=>{if(!navigator.clipboard)return c(`refused`);navigator.clipboard.writeText(e).then(()=>c(`yes`),e=>{if(!(e instanceof DOMException))throw e;c(`refused`)})},className:`inline-flex size-8 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted pointer-coarse:size-11`,children:n===`yes`?(0,s.jsx)(a,{className:`size-4 text-success`}):(0,s.jsx)(i,{className:`size-4`})})]}),n===`refused`&&(0,s.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs font-medium text-danger-text`,children:r(`copyRefused`)})]})};export{c as t};
2
+ //# debugId=8dff01d8-fca6-4c3f-9724-d42b2173436f
@@ -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{Hr as r,N as i,P as a,R as o,Vl as s,cs as c,go as l,ka as u,ml as d,oc as f,os as p,r as m,rc as h,ss as g,zl as _}from"./app-BXbP4Ty1.js";import{ComposedPage as v}from"./composed-page-1q5wrcUN.js";import{t as y}from"./record-opens-BjvGP76q.js";var b=e(t(),1),x=e(n(),1),S=({noun:e,collection:t,sections:n,width:r,saving:s,message:c,onSubmit:u,onCancel:d,ref:f})=>(0,x.jsx)(i,{ref:f,title:l(`title`,{noun:e}),eyebrow:t,width:r,submit:l(`submit`,{noun:e}),saving:s,error:c?Error(c):void 0,errorTitle:l(`notCreated`),onSubmit:u,onCancel:d,children:n.map(e=>(0,x.jsx)(a,{title:e.title,help:e.help,children:(0,x.jsx)(`div`,{className:`grid grid-cols-1 gap-x-6 gap-y-5 sm:grid-cols-2`,children:e.fields.map(e=>(0,x.jsx)(o,{name:e.name,label:e.label,required:e.required,help:e.help,error:e.error,wide:e.wide,children:e.editor},e.name))})},e.title))}),C=({resource:e,values:t})=>{let n=g(),r=n.resources[e],i=c(e);return r?u(i,`create`)?(0,x.jsx)(w,{resource:e,values:t}):(0,x.jsx)(p,{title:l(`notAllowed`),children:l(`cannotCreate`,{plural:n.views[e]?.names?.plural.toLowerCase()??e})}):(0,x.jsx)(p,{title:f(`notFound`),children:f(`noResource`,{name:e})})},w=({resource:e,values:t})=>{let n=g().views[e],{go:i}=r(),[a,o]=(0,b.useState)(),s=m({resource:e,values:t,onCreated:(e,t)=>o(t)});h(!a&&(s.touched||s.saving),`input-lost`),(0,b.useEffect)(()=>{a&&i(a,{replace:!0})},[a,i]);let c=n?.names?.singular??d(e);return(0,x.jsx)(S,{ref:s.ref,noun:c,collection:n?.names?.plural??d(e),sections:s.sections,width:n?.recordWidth,saving:s.saving,message:s.message,onSubmit:()=>void s.submit(),onCancel:()=>i({kind:`list`,resource:e})})},T=({resource:e,values:t})=>{let n=g(),r=n.views[e];return r?.createOpens&&_(r.createOpens).every(e=>t?.[e])?(0,x.jsx)(y,{to:s(r.createOpens,t)}):r?.create?n.pages[r.create.page]?(0,x.jsx)(v,{name:r.create.page}):(0,x.jsx)(p,{title:l(`notAllowed`),children:l(`cannotCreate`,{plural:r.names?.plural.toLowerCase()??d(e)})}):(0,x.jsx)(C,{resource:e,values:t},new URLSearchParams(t).toString())};export{T as CreateRoute};
2
+ //# debugId=a438d29d-5fa3-43fa-bde0-3a3016112e14
@@ -1,6 +1,6 @@
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{Ao as r,Bn as i,Sc as a,Un as o,el as s,jo as c,mc as l,ol as u,uc as d,zn as f}from"./app-CK_M0TgA.js";var p=e(t(),1),m=e=>typeof e==`object`&&!!e&&!Array.isArray(e),h=e=>{let t=m(e)?e:{};return{dockerfile:typeof t.dockerfile==`string`?t.dockerfile:``,files:m(t.files)?Object.entries(t.files).map(([e,t])=>[e,typeof t==`string`?t:JSON.stringify(t)]):[],command:Array.isArray(t.command)?t.command.map(String):[]}},g=e=>{if(e.trimStart().startsWith(`[`))try{let t=JSON.parse(e);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?t:void 0}catch{return}},_=e=>g(e)??e.split(`
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{Gn as r,Hn as i,Mo as a,No as o,Vn as s,cl as c,fc as l,gc as u,nl as d,wc as f}from"./app-BXbP4Ty1.js";var p=e(t(),1),m=e=>typeof e==`object`&&!!e&&!Array.isArray(e),h=e=>{let t=m(e)?e:{};return{dockerfile:typeof t.dockerfile==`string`?t.dockerfile:``,files:m(t.files)?Object.entries(t.files).map(([e,t])=>[e,typeof t==`string`?t:JSON.stringify(t)]):[],command:Array.isArray(t.command)?t.command.map(String):[]}},g=e=>{if(e.trimStart().startsWith(`[`))try{let t=JSON.parse(e);return Array.isArray(t)&&t.every(e=>typeof e==`string`)?t:void 0}catch{return}},_=e=>g(e)??e.split(`
2
2
  `).filter(e=>e!==``),v=e=>e.some(e=>e.includes(`
3
3
  `))?JSON.stringify(e):e.join(`
4
- `),y=({dockerfile:e,files:t,command:n})=>({dockerfile:e,files:Object.fromEntries(t),...n.length>0&&{command:n}}),b=s(`app/field-types/custom-step-container`),x=e(n(),1),S=({title:e,children:t})=>(0,x.jsxs)(`div`,{className:`grid gap-1`,children:[(0,x.jsx)(`h5`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]}),C=({value:e})=>{if(e===null)return(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let t=h(e);return(0,x.jsxs)(`div`,{className:`grid gap-3`,children:[(0,x.jsx)(S,{title:b(`dockerfile`),children:(0,x.jsx)(f,{children:t.dockerfile})}),t.files.map(([e,t])=>(0,x.jsx)(S,{title:(0,x.jsx)(`span`,{className:`font-mono`,children:e}),children:(0,x.jsx)(f,{children:t})},e)),(0,x.jsx)(S,{title:b(`command`),children:t.command.length>0?(0,x.jsx)(f,{children:JSON.stringify(t.command)}):(0,x.jsx)(`p`,{className:`text-body text-muted-foreground`,children:b(`ownCommand`)})})]})},w=({value:e})=>{if(e===null)return null;let t=h(e);return(0,x.jsx)(o,{text:b(`summary`,{files:t.files.length,line:t.dockerfile.split(`
5
- `)[0]??``})})},T=({value:e,onChange:t,invalid:n})=>{let o=h(e),s=JSON.stringify(e??null),[u,f]=(0,p.useState)(()=>({seen:s,files:o.files,command:v(o.command)}));u.seen!==s&&f({seen:s,files:o.files,command:v(o.command)});let{files:m,command:g}=u,S=(0,p.useId)(),C=e=>{let n={files:e.files??m,command:e.command??g},r=y({dockerfile:e.dockerfile??o.dockerfile,files:n.files,command:e.command===void 0?o.command:_(e.command)});f({seen:JSON.stringify(r),...n}),t(r)},w=e=>C({files:e}),T=(e,t)=>e||b(`fileNumber`,{number:t+1});return(0,x.jsxs)(`div`,{className:`grid gap-3`,children:[(0,x.jsx)(i,{value:o.dockerfile,rows:6,invalid:n,className:`font-mono text-xs`,spellCheck:!1,onChange:e=>C({dockerfile:e.target.value})}),(0,x.jsxs)(c.Provider,{value:void 0,children:[m.map(([e,t],n)=>(0,x.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border p-2`,role:`group`,"aria-label":T(e,n),children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(r,{value:e,"aria-label":b(`path`),placeholder:b(`pathExample`),className:`font-mono`,spellCheck:!1,wrapperClassName:`flex-1`,onChange:e=>w(m.map((r,i)=>i===n?[e.target.value,t]:r))}),(0,x.jsx)(d,{type:`button`,size:`icon`,variant:`ghost`,"aria-label":b(`removeFile`,{path:T(e,n)}),onClick:()=>w(m.filter((e,t)=>t!==n)),children:(0,x.jsx)(l,{className:`size-4`})})]}),(0,x.jsx)(i,{value:t,rows:4,"aria-label":b(`fileText`,{path:T(e,n)}),className:`font-mono text-xs`,spellCheck:!1,onChange:t=>w(m.map((r,i)=>i===n?[e,t.target.value]:r))})]},n)),(0,x.jsxs)(d,{type:`button`,size:`sm`,className:`justify-self-start`,onClick:()=>w([...m,[``,``]]),children:[(0,x.jsx)(a,{className:`size-4`}),b(`addFile`)]}),(0,x.jsxs)(`div`,{className:`grid gap-1`,children:[(0,x.jsx)(`label`,{htmlFor:`${S}-command`,className:`text-xs font-medium text-muted-foreground`,children:b(`commandLines`)}),(0,x.jsx)(i,{id:`${S}-command`,value:g,rows:2,className:`font-mono text-xs`,spellCheck:!1,onChange:e=>C({command:e.target.value})})]})]})]})},E={of:[...u.custom_step_container],display:C,editor:T,cell:w,wide:!0};export{E as customStepContainerField};
6
- //# debugId=97ce10ca-07c4-403c-9311-ab0a1fd38a40
4
+ `),y=({dockerfile:e,files:t,command:n})=>({dockerfile:e,files:Object.fromEntries(t),...n.length>0&&{command:n}}),b=d(`app/field-types/custom-step-container`),x=e(n(),1),S=({title:e,children:t})=>(0,x.jsxs)(`div`,{className:`grid gap-1`,children:[(0,x.jsx)(`h5`,{className:`text-xs font-medium text-muted-foreground`,children:e}),t]}),C=({value:e})=>{if(e===null)return(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let t=h(e);return(0,x.jsxs)(`div`,{className:`grid gap-3`,children:[(0,x.jsx)(S,{title:b(`dockerfile`),children:(0,x.jsx)(s,{children:t.dockerfile})}),t.files.map(([e,t])=>(0,x.jsx)(S,{title:(0,x.jsx)(`span`,{className:`font-mono`,children:e}),children:(0,x.jsx)(s,{children:t})},e)),(0,x.jsx)(S,{title:b(`command`),children:t.command.length>0?(0,x.jsx)(s,{children:JSON.stringify(t.command)}):(0,x.jsx)(`p`,{className:`text-body text-muted-foreground`,children:b(`ownCommand`)})})]})},w=({value:e})=>{if(e===null)return null;let t=h(e);return(0,x.jsx)(r,{text:b(`summary`,{files:t.files.length,line:t.dockerfile.split(`
5
+ `)[0]??``})})},T=({value:e,onChange:t,invalid:n})=>{let r=h(e),s=JSON.stringify(e??null),[c,d]=(0,p.useState)(()=>({seen:s,files:r.files,command:v(r.command)}));c.seen!==s&&d({seen:s,files:r.files,command:v(r.command)});let{files:m,command:g}=c,S=(0,p.useId)(),C=e=>{let n={files:e.files??m,command:e.command??g},i=y({dockerfile:e.dockerfile??r.dockerfile,files:n.files,command:e.command===void 0?r.command:_(e.command)});d({seen:JSON.stringify(i),...n}),t(i)},w=e=>C({files:e}),T=(e,t)=>e||b(`fileNumber`,{number:t+1});return(0,x.jsxs)(`div`,{className:`grid gap-3`,children:[(0,x.jsx)(i,{value:r.dockerfile,rows:6,invalid:n,className:`font-mono text-xs`,spellCheck:!1,onChange:e=>C({dockerfile:e.target.value})}),(0,x.jsxs)(o.Provider,{value:void 0,children:[m.map(([e,t],n)=>(0,x.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border p-2`,role:`group`,"aria-label":T(e,n),children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(a,{value:e,"aria-label":b(`path`),placeholder:b(`pathExample`),className:`font-mono`,spellCheck:!1,wrapperClassName:`flex-1`,onChange:e=>w(m.map((r,i)=>i===n?[e.target.value,t]:r))}),(0,x.jsx)(l,{type:`button`,size:`icon`,variant:`ghost`,"aria-label":b(`removeFile`,{path:T(e,n)}),onClick:()=>w(m.filter((e,t)=>t!==n)),children:(0,x.jsx)(u,{className:`size-4`})})]}),(0,x.jsx)(i,{value:t,rows:4,"aria-label":b(`fileText`,{path:T(e,n)}),className:`font-mono text-xs`,spellCheck:!1,onChange:t=>w(m.map((r,i)=>i===n?[e,t.target.value]:r))})]},n)),(0,x.jsxs)(l,{type:`button`,size:`sm`,className:`justify-self-start`,onClick:()=>w([...m,[``,``]]),children:[(0,x.jsx)(f,{className:`size-4`}),b(`addFile`)]}),(0,x.jsxs)(`div`,{className:`grid gap-1`,children:[(0,x.jsx)(`label`,{htmlFor:`${S}-command`,className:`text-xs font-medium text-muted-foreground`,children:b(`commandLines`)}),(0,x.jsx)(i,{id:`${S}-command`,value:g,rows:2,className:`font-mono text-xs`,spellCheck:!1,onChange:e=>C({command:e.target.value})})]})]})]})},E={of:[...c.custom_step_container],display:C,editor:T,cell:w,wide:!0};export{E as customStepContainerField};
6
+ //# debugId=7469d2e6-d351-4b46-b6ac-a9b6f3818aae
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/period-chart-DSnwMzgV.js","assets/rolldown-runtime-DFwUHQ4A.js","assets/react-CuiNlnus.js","assets/app-BXbP4Ty1.js","assets/vendor-t7Q7QbPu.js","assets/app-DLkpxjgP.css","assets/lib-recharts-B1lKFZ5P.js","assets/lib-use-sync-external-store-D4s7MiFL.js","assets/lib-clsx-BBppEdNc.js","assets/lib-es-toolkit-9HrAkr3v.js","assets/lib-d3-shape-BSwuGxur.js","assets/lib-d3-path-CT8ZQkbZ.js","assets/lib-reselect-BYC6G6Ab.js","assets/lib-redux-ChC-A5Uc.js","assets/lib-immer--vWzY_El.js","assets/lib-reduxjs-toolkit-_9NgzJLa.js","assets/lib-redux-thunk-D6AwDtTm.js","assets/lib-react-redux-CLjAzhcU.js","assets/lib-decimal.js-light-Dtl_aJ-w.js","assets/lib-victory-vendor-C-WmaPT-.js","assets/lib-d3-scale-BM-TVblA.js","assets/lib-d3-array-Cuc1v5vu.js","assets/lib-internmap-O20L0ujd.js","assets/lib-d3-interpolate-C7dFwq8w.js","assets/lib-d3-color-B6XHLQii.js","assets/lib-d3-format-CvZ7dVit.js","assets/lib-d3-time-BLMe3IGs.js","assets/lib-d3-time-format-xk4cmG0i.js","assets/lib-eventemitter3-CoExthpv.js","assets/lib-react-is-BhamKBF2.js","assets/lib-tiny-invariant-D6Do54jy.js","assets/legend-item-BC8NMrG0.js","assets/group-donut-MrMdALOR.js","assets/records-map-BZ9IztOw.js","assets/maplibre-CBGBPT2u.js","assets/lib-maplibre-gl-CFGgq6sa.js","assets/lib-maplibre-gl-DBE96hFo.css","assets/lib-vis.gl-react-maplibre-1cv426UN.js","assets/lib-pmtiles-G7iEFxNu.js","assets/lib-fflate-HbhbPPwS.js","assets/board-display-CoJK20M9.js","assets/record-preview-bznf4p6C.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","assets/messages-9TFLyKlr.js","assets/board-dnd-pi-vIUTz.js","assets/use-display-rows-DRKftIme.js","assets/calendar-display-iYqswJgc.js","assets/use-calendar-move-B902R-oH.js","assets/timeline-display-CFYOr7ER.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,r as n,t as r}from"./react-CuiNlnus.js";import{$n as i,$r as a,Ai as o,An as s,B as c,Bl as l,Bs as u,Ca as d,Ci as f,Co as p,D as m,Di as h,Dn as g,Dr as _,Ds as v,Ea as y,Ei as b,Es as x,Fi as S,Gl as C,Go as w,Hc as T,Hi as E,Hr as D,Ia as O,Ii as k,Il as A,In as ee,It as j,J as te,Ja as M,Ji as N,Jr as ne,K as re,Kc as P,Kl as ie,Kn as F,Kr as ae,Lc as I,Mc as L,Mi as R,Mo as z,Oi as oe,On as se,Pi as ce,Pn as le,Po as ue,Ql as B,Qn as de,Qr as fe,R as pe,Rc as me,Rt as he,Sa as V,Si as ge,Sn as _e,Ta as ve,To as ye,Ts as be,Ul as xe,Un as Se,Ur as Ce,Vi as we,Vl as Te,Vn as Ee,Vr as De,Vs as Oe,Wl as ke,Wo as Ae,Wr as je,Xa as Me,Xl as Ne,Xn as Pe,Xr as H,Ya as U,Yl as Fe,Yr as Ie,Ys as Le,Zl as Re,Zn as ze,Zr as Be,Zs as Ve,_a as He,_i as Ue,_l as We,ai as Ge,al as W,b as Ke,bi as qe,ci as Je,cs as Ye,dn as Xe,ei as Ze,eu as Qe,fa as $e,fc as et,fl as tt,gc as nt,gi as rt,gl as it,hc as at,hl as ot,hs as st,ii as ct,is as lt,iu as ut,ja as dt,jc as ft,ji as pt,jr as mt,k as ht,ka as gt,kc as _t,lc as G,mi as K,ml as q,ms as vt,ni as yt,nl as bt,ns as xt,nu as St,oc as Ct,oi as wt,on as Tt,oo as Et,ou as Dt,pa as Ot,pc as kt,pl as At,q as jt,qc as J,qr as Mt,qt as Nt,ri as Pt,rs as Ft,s as It,sc as Lt,ss as Y,tl as Rt,ua as zt,uc as Bt,ul as Vt,vl as Ht,vr as Ut,wa as Wt,wi as Gt,xt as Kt,yc as qt,yi as Jt,yn as Yt,za as Xt,zc as Zt,zi as Qt}from"./app-BXbP4Ty1.js";import{C as $t,f as en,h as tn,i as nn,o as rn,s as an}from"./vendor-t7Q7QbPu.js";import{a as on,n as sn}from"./update-set-jWhZWR7M.js";import{t as cn}from"./layout-grid-C0JKQ-Vr.js";import{t as ln}from"./lib-tanstack-react-table-uAPG3Sdi.js";import{a as un,i as dn,n as fn,t as pn}from"./lib-tanstack-table-core-2MHQ7o_e.js";import{i as mn,r as hn,t as gn}from"./record-preview-bznf4p6C.js";import{_ as _n,a as vn,i as yn,o as bn,s as xn,t as Sn,v as Cn}from"./lib-dnd-kit-core-xi-7xL_N.js";import{a as wn,i as Tn,r as En,t as Dn}from"./lib-dnd-kit-sortable-CNDSKqCD.js";var On={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};On.node;var kn=P(On),An={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};An.node;var jn=P(An),Mn={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Mn.node;var Nn=P(Mn),Pn={name:`chart-gantt`,size:24,node:[[`path`,{d:`M10 6h8`,key:`zvc2xc`}],[`path`,{d:`M12 16h6`,key:`yi5mkt`}],[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M8 11h7`,key:`wz2hg0`}]]};Pn.node;var Fn=P(Pn),In={name:`circle-dashed`,size:24,node:[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]};In.node;var Ln=P(In),Rn={name:`columns-3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]],aliases:[`panels-left-right`]};Rn.node;var zn=P(Rn),Bn={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};Bn.node;var Vn=P(Bn),Hn={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};Hn.node;var Un=P(Hn),Wn={name:`map`,size:24,node:[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]};Wn.node;var Gn=P(Wn),Kn={name:`square-kanban`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 7v7`,key:`1x2jlm`}],[`path`,{d:`M12 7v4`,key:`xawao1`}],[`path`,{d:`M16 7v9`,key:`1hp2iy`}]],aliases:[`kanban-square`]};Kn.node;var qn=P(Kn),Jn=e(n(),1),X=e(t(),1),Z=e(r(),1),Yn=({offers:e,problem:t,onConnect:n})=>{let r=be()?.signInProviders??[],[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(),c=t?.code===`link_expired`,l=e.map(e=>e.link.name),u=e=>r.find(t=>t.id===e)?.name??x(e),d=async t=>{a(!0),s(void 0);try{await n(e.find(e=>e.link.id===t))}catch(e){if(!(e instanceof v))throw e;s(lt(e)),a(!1)}};return(0,Z.jsx)(Kt,{title:_e(c?`expiredTitle`:`missingTitle`),tone:`warning`,actions:e.map(({link:e,again:t})=>({id:e.id,label:_e(t?`connectAgain`:`connect`,{name:e.name}),style:`primary`,disabled:i})),onAction:e=>void d(e),children:(0,Z.jsxs)(`div`,{className:`space-y-1 text-body`,children:[(0,Z.jsx)(`p`,{children:_e(c?`expired`:`missing`,{names:l.join(`, `)})}),e.filter(e=>e.signInOnly).map(({link:e})=>(0,Z.jsx)(`p`,{children:_e(`signInOnly`,{provider:u(e.provider),name:e.name})},e.id)),o&&(0,Z.jsx)(`p`,{role:`alert`,className:`font-medium text-danger-text`,children:o})]})})},Xn=new Map([[`personal-mail-not-linked`,`not_linked`],[`personal-mail-link-expired`,`link_expired`]]),Zn=e=>{if(!Ve(e))return;let t=Xn.get(e.slug);if(!t)return;let{provider:n}=e.problem;return{code:t,...typeof n==`string`&&{provider:n}}},Qn=(e,t,n)=>{if(n?.code===`link_expired`){let t=e.filter(e=>e.id===n.provider);return(t.length>0?t:e).map(e=>({link:e,again:!0,signInOnly:!1}))}return!n&&t.mail.length>0?[]:e.map(e=>{let n=t.mail.includes(e.id);return{link:e,again:n,signInOnly:!n&&t.providers.includes(e.provider)}})},$n=(e,t)=>{let n=be(),r=n?.personalMail??[],i=n!==null&&r.length>0&&(t||e!==void 0),[a,o]=(0,X.useState)(),[s,c]=(0,X.useState)(),l=n?.session.account;(0,X.useEffect)(()=>{if(!i||!l)return;let e=!0;return Promise.all([l.linkedPersonalMail(r),l.linkedProviders()]).then(([t,n])=>{e&&o({mail:t,providers:n})},t=>{if(!(t instanceof v))throw t;e&&c(lt(t))}),()=>{e=!1}},[i,l,r]);let u=e=>n.linkPersonalMail(e.link);return i?s?{offers:[],error:s,connect:u}:{offers:a&&Qn(r,a,e),connect:u}:{offers:[],connect:u}},er=(e,t)=>{let n=Zn(t),r=e.mailbox===!0,{offers:i,error:a,connect:o}=$n(n,r),s=i!==void 0&&i.length>0;return{notice:s?(0,Z.jsx)(Yn,{offers:i,problem:n,onConnect:o}):a?(0,Z.jsx)(`p`,{role:`alert`,className:`text-body font-medium text-danger-text`,children:a}):void 0,explained:n!==void 0&&s,blocked:s||r&&i===void 0}},tr=(e,t)=>{let n=e.from===void 0?void 0:t?.[e.from];return Array.isArray(n)?n.filter(e=>typeof e==`string`):[]},nr=(e,t)=>e.items?e.items:[...new Set(t.flatMap(t=>tr(e,t)))],rr=(e,t,n)=>Object.fromEntries(Object.entries(t).map(([t,r])=>{let i=e.find(e=>e.name===t);return i?.kind===`checklist`?[t,i.items??tr(i,n)]:[t,r]})),ir=({label:e,boxes:t,ticked:n,onChange:r})=>{let{id:i,"aria-describedby":a,"aria-invalid":o}=ue();if(t.length===0)return(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:U(`nothingToTick`)});let s=(e,t)=>r(t?[...n,e]:n.filter(t=>t!==e));return(0,Z.jsx)(`div`,{id:i,role:`group`,"aria-label":e,"aria-describedby":a,"aria-invalid":o,children:(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1`,children:t.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded py-1.5 text-sm active:opacity-70`,children:[(0,Z.jsx)(Et,{checked:n.includes(e),onChange:t=>s(e,t),className:`mt-0.5`}),(0,Z.jsx)(`span`,{children:e})]})},e))})})},ar={WebkitTextSecurity:`disc`},or=({name:e,value:t,invalid:n,onChange:r})=>(0,Z.jsx)(z,{type:`text`,name:e,autoComplete:`off`,style:ar,autoCorrect:`off`,autoCapitalize:`off`,spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":`true`,"data-bwignore":!0,"data-form-type":`other`,"data-gramm":`false`,"data-gramm_editor":`false`,"data-enable-grammarly":`false`,value:t,invalid:n,onChange:e=>r(e.target.value)}),sr=`••••••`,cr=(e,t)=>e.flatMap(e=>{let n=t[e.name];return e.kind===`secret`&&typeof n==`string`&&n!==``?[n]:[]}),lr=(e,t)=>{let n=Array(e.length).fill(!1);for(let r of t)for(let t=e.indexOf(r);t!==-1;t=e.indexOf(r,t+1))n.fill(!0,t,t+r.length);return n},ur=(e,t)=>{let n=lr(e,t.filter(e=>e!==``)),r=``;for(let t=0;t<e.length;t++)n[t]?(t===0||!n[t-1])&&(r+=sr):r+=e[t];return r},dr=(e,t)=>{if(t.length===0)return e;if(Ve(e)){let n=t.map(e=>JSON.stringify(e).slice(1,-1));return new Le(JSON.parse(ur(JSON.stringify(e.problem),n)))}if(!(e instanceof Error))return e;let n=Error(ur(e.message,t));return n.name=e.name,n},fr=(e,t)=>Object.fromEntries(Object.entries(e).map(([e,n])=>[e,ur(n,t)])),pr={text:`text`,integer:`integer`,decimal:`decimal`,boolean:`boolean`,date:`date`,secret:`text`},mr=e=>{let t={name:e.name,column:e.name,nullable:!0,readOnly:!1,filterable:!1,sortable:!1,aliases:[]};return e.kind===`custom`||e.kind===`checklist`?{...t,type:`json`}:e.kind===`choice`?e.resource===void 0?{...t,type:`enum`,enumValues:(e.options??[]).map(e=>e.value)}:{...t,type:`relation`,relation:{resource:e.resource,columns:[e.name]}}:{...t,type:pr[e.kind]}},hr=e=>({label:e.label,...e.multiline&&{multiline:!0},...e.options&&{valueLabels:Object.fromEntries(e.options.map(e=>[e.value,e.label]))}}),gr=e=>Object.fromEntries(e.map(e=>e.kind===`custom`?[e.name,e.default??null]:e.kind===`checklist`?[e.name,[]]:e.kind===`boolean`?[e.name,!!e.default]:[e.name,m(e.default)])),_r=(e,t)=>e.kind===`custom`?t??null:e.kind===`checklist`?Array.isArray(t)?t:[]:e.kind===`secret`?typeof t==`string`&&t!==``?t:null:It(t)?t.key:e.resource===void 0?ht(mr(e),t):String(t??``)===``?null:String(t),vr=(e,t)=>{let n=Object.fromEntries(e.map(e=>[e.name,_r(e,t[e.name])])),r=on(e,n);return{shown:r,values:Object.fromEntries(Object.entries(n).filter(([e])=>r.has(e)))}},yr=/^-?\d+(\.\d+)?$/,br=/^\d{4}-\d{2}-\d{2}$/,xr=(e,t,n)=>{if(e.kind===`checklist`){let e=n.filter(e=>!(Array.isArray(t)&&t.includes(e))).length;return e===0?void 0:U(`tickEvery`,{count:e})}if(t===null||t===``)return e.required?U(`required`):void 0;if(e.kind===`integer`&&!Number.isInteger(t))return U(`wholeNumber`);if(e.kind===`decimal`&&!yr.test(String(t)))return U(`number`);if(e.kind===`date`&&!br.test(String(t)))return U(`dateFormat`);if(e.max!==void 0&&String(t).length>e.max)return U(`atMost`,{max:e.max})},Sr=(e,t,n={})=>Object.fromEntries(e.flatMap(e=>{if(!Object.hasOwn(t,e.name))return[];let r=xr(e,t[e.name],n[e.name]??[]);return r?[[e.name,r]]:[]})),Cr=({input:e,held:t,invalid:n,onChange:r,boxes:i})=>{let{resources:a,views:o}=Y(),{components:s}=O();if(e.kind===`custom`){let i=s?.[e.component??``];if(!i)throw Error(`Input "${e.name}": the app has no component "${e.component}"`);return(0,Z.jsx)(i,{input:e,value:t??null,onChange:r,invalid:n,props:e.props??{}})}if(e.kind===`checklist`)return(0,Z.jsx)(ir,{label:e.label,boxes:i,ticked:Array.isArray(t)?t:[],onChange:r});if(e.kind===`secret`)return(0,Z.jsx)(or,{name:e.name,value:typeof t==`string`?t:``,invalid:n,onChange:r});let c=e.resource===void 0?void 0:a[e.resource];return(0,Z.jsx)(Ke,{field:mr(e),hints:hr(e),value:It(t)?t.key:t,stored:void 0,relationLabel:It(t)?t.label:void 0,relationPicker:c?{target:c,view:o[c.name]}:void 0,invalid:n,onChange:r})},wr=({action:e,label:t,danger:n,records:r=[],names:i=[],onCancel:a,onSubmit:o})=>{let[s,c]=(0,X.useState)(()=>gr(e.inputs)),[l,u]=(0,X.useState)({}),[d,f]=(0,X.useState)(),[p,m]=(0,X.useState)(!1),h=(0,X.useId)(),{shown:g,values:v}=vr(e.inputs,s),y=er(e,d),b=Object.fromEntries(e.inputs.filter(e=>e.kind===`checklist`).map(e=>[e.name,nr(e,r)])),x=async()=>{let t=Sr(e.inputs,v,b);if(u(t),f(void 0),Object.keys(t).length>0||y.blocked)return;m(!0);let n=cr(e.inputs,v);await o(v).catch(t=>{u(fr(_(t,e.inputs),n)),f(dr(t,n))}),m(!1)},S=(e,t)=>{u(({[e]:t,...n})=>n),c(n=>({...n,[e]:t}))};return(0,Z.jsx)(N,{title:t,description:e.confirm,open:!0,onClose:a,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(et,{onClick:a,children:U(`cancel`)}),(0,Z.jsx)(et,{variant:n?`danger`:`primary`,type:`submit`,form:h,loading:p,disabled:y.blocked,children:t})]}),children:(0,Z.jsxs)(`form`,{id:h,className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),x()},children:[d!==void 0&&Object.keys(l).length===0&&!y.explained&&(0,Z.jsx)(Ut,{title:U(`failed`,{label:t}),error:d}),y.notice,i.length>1&&(0,Z.jsx)(`p`,{className:`text-sm`,children:U(`forRecords`,{records:i.join(`, `)})}),e.inputs.filter(e=>g.has(e.name)).map(e=>(0,Z.jsx)(pe,{label:e.label,required:e.required,help:e.help,error:l[e.name],children:(0,Z.jsx)(Cr,{input:e,held:s[e.name],invalid:!!l[e.name],onChange:t=>S(e.name,t),boxes:b[e.name]??[]})},e.name))]})})},Tr=({action:e,label:t,danger:n,onCancel:r,onConfirm:i})=>{let a=er(e,void 0);return(0,Z.jsx)(Bt,{title:`${t}?`,description:e.confirm,onClose:r,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(et,{onClick:r,children:U(`cancel`)}),(0,Z.jsx)(et,{variant:n?`danger`:`primary`,disabled:a.blocked,onClick:i,children:t})]}),children:a.notice})},Er=e=>e.variant===`danger`||e.run?.kind===`delete`,Dr=e=>!!(e.confirm||e.inputs?.length),Or=({action:e,label:t,danger:n,records:r,names:i,onCancel:a,onConfirm:o,onSubmit:s})=>{let{inputs:c}=e;return c?.length?(0,Z.jsx)(wr,{action:{...e,inputs:c},label:t,danger:n,records:r,names:i,onCancel:a,onSubmit:s}):(0,Z.jsx)(Tr,{action:e,label:t,danger:n,onCancel:a,onConfirm:o})},kr=()=>{let e=be(),t=Xt();return n=>{let r=Zn(n),i=e?.personalMail??[];if(!e||!r)return;let a=i.find(e=>e.id===r.provider)??(i.length===1?i[0]:void 0);if(!a)return;let o=async()=>{try{await e.linkPersonalMail(a)}catch(e){if(!(e instanceof v))throw e;t.show({state:`error`,title:_e(`connect`,{name:a.name}),description:lt(e)})}};return{label:_e(r.code===`link_expired`?`connectAgain`:`connect`,{name:a.name}),onClick:()=>void o()}}},Ar=(e,t)=>{if(e.when===void 0)return!0;if(!t)return!1;let n=Oe(e.when);return n.ok&&u(n,t)},jr=(e,t={})=>xe(e,e=>encodeURIComponent(Ne(Re(t,e)))),Mr=e=>{if(typeof e!=`string`||!URL.canParse(e))return;let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`?t.href:void 0},Nr=(e,t={})=>{let n=ie(e);return n===void 0?jr(e,t):Mr(Re(t,n))},Pr=e=>{e!==void 0&&(/^https?:/i.test(e)?window.open(e,`_blank`,`noopener,noreferrer`):window.location.assign(e))},Fr=e=>URL.canParse(e)?new URL(e).hostname.replace(/^www\./,``):``,Ir=(e,t)=>Object.entries(t).every(([t,n])=>Object.is(e[t],n)),Lr=(e,t,n={})=>{if(!Ar(e,t))return e.otherwise===`disable`?e:void 0;let r=e.run;if(r?.kind===`update`)return t&&!e.inputs?.length&&Ir(t,r.values)?void 0:e;if(r?.kind===`link`&&`to`in r&&Fe(r.to)!==void 0){let i=Te(r.to,t);return i.kind!==`page`&&Object.hasOwn(n,i.resource)?e:void 0}if(r?.kind!==`link`||!(`href`in r))return e;let i=Nr(r.href,t);if(i!==void 0)return e.label.includes(`{{host}}`)?{...e,label:e.label.replaceAll(C,Fr(i))}:e},Rr=async(e,t,n,r)=>{let i=e.map(e=>({record:e,verdict:t(e)})),a={done:0,skipped:i.filter(e=>e.verdict===`skip`).length,failed:0,refused:i.flatMap(e=>e.verdict===`refuse`?[e.record]:[])};for(let{record:e}of i.filter(e=>e.verdict===`run`)){let t=await n(e).then(()=>void 0,e=>({error:e}));t?r(t.error)?a.refused.push(e):(a.failed+=1,a.failed===1&&(a.error=t.error)):a.done+=1}return a},zr=e=>`“${e}”`,Br=e=>e instanceof Error?e.message:U(`somethingWrong`),Vr=(e,t,n)=>{let{views:r,resources:i}=Y(),{actions:a,components:o}=O(),s=Ye(e),c=vt(),l=st(e),u=Xt(),d=kr(),f=Yt(),{go:p}=D(),m=E(),[h,g]=(0,X.useState)(),_=(r[e]?.actions??[]).flatMap(e=>Lr(e,t?.record,i)??[]),v=(e,t)=>{let n=e.run?.kind;if((n===`update`||n===`delete`||n===`ai`)&&!t)return U(`needsRecord`);if(!Ar(e,t?.record))return e.reason??U(`doesNotApply`);if((n===`update`||n===`ai`)&&(!gt(s,`update`)||t?.permissions?.update===!1)||e.run?.kind===`ai`&&t?.permissions?.fields?.[e.run.writes]===`read`)return U(`cannotChange`);if(n===`delete`&&(!gt(s,`delete`)||t?.permissions?.delete===!1))return U(`cannotDelete`);if(!e.run&&!a?.[e.name])return U(`noHandler`,{name:e.name});let r=e.inputs?.find(e=>e.kind===`custom`&&!o?.[e.component??``]);if(r)return U(`noInputComponent`,{component:String(r.component),input:r.name})},y=e=>v(e,t),b=(e,t)=>{let{run:n}=e,r=n?.kind;return r===`update`||r===`ai`?gt(s,`update`)&&(t.permissions?.update===!1||n?.kind===`ai`&&t.permissions?.fields?.[n.writes]===`read`):r===`delete`&&gt(s,`delete`)&&t.permissions?.delete===!1},x=async(t,n,r)=>{let{run:i}=t;if(i?.kind===`link`){`to`in i?p(Te(i.to,n?.record)):Pr(Nr(i.href,n?.record));return}i?.kind===`update`?await c.update(e,n.key,sn(i.values,r??{}),n.etag??`*`):i?.kind===`delete`?await c.remove(e,n.key,{etag:n.etag}):i?.kind===`ai`?await c.generate(e,n.key,t.name):await a[t.name]({resource:e,record:n?.record,recordKey:n?.key,etag:n?.etag,client:l,navigate:p,...r&&{values:r}})},S=async(t,r,i)=>{await x(t,r,i),t.run?.kind!==`link`&&(await f(e),u.show({state:`success`,title:U(`done`,{label:t.label})}),n?.(t))},C=async(e,n=t)=>{v(e,n)||(g(e.name),await S(e,n).catch(t=>{let n=d(t);u.show({state:`error`,title:U(`failed`,{label:e.label}),description:Br(t),...n&&{action:n}})}),g(void 0))},w=async(e,n)=>{y(e)||(g(e.name),await S(e,t,rr(e.inputs??[],n,t?.record)).finally(()=>g(void 0)))},T=(e,t)=>Lr(e,t.record,i)!==void 0&&!v(e,t),k=(e,t)=>T(e,t)?`run`:Lr(e,t.record,i)!==void 0&&Ar(e,t.record)&&b(e,t)?`refuse`:`skip`;return{actions:_,blocked:y,blockedOn:v,appliesOn:T,verdictOn:k,running:h,run:C,submit:w,runEach:async(t,i,a=0,o)=>{g(t.name);let s=e=>o?rr(t.inputs??[],o,e.record):void 0,c=await Rr(i,e=>k(t,e),e=>x(t,e,s(e)),e=>e instanceof Le&&e.status===403);g(void 0),await f(e);let l=c.refused.map(t=>zr(m(t.model,r[e],t.record,t.key))),d=U(`doneOn`,{label:t.label,done:c.done,skipped:c.skipped+a,failed:c.failed,refused:l.length}),p=[l.length>0&&U(`refusedOn`,{records:l.join(`, `),count:l.length}),c.failed>0&&ur(Br(c.error),cr(t.inputs??[],o??{}))].filter(Boolean).join(` `);return u.show({state:c.failed>0||l.length>0?`error`:`success`,title:d,...p&&{description:p}}),c.done>0&&n?.(t),c}}},Hr=(e,t,n,r)=>{let i=Vr(e,n,r),a=i.actions.find(e=>e.name===t);return{action:a,record:n?.record,blocked:a?i.blocked(a):U(`noAction`,{name:t}),running:i.running===t,run:()=>a?i.run(a):Promise.resolve(),submit:e=>a?i.submit(a,e):Promise.resolve()}},Ur=bt(`app/list`),Wr=bt(`app/charts`),Gr=B(),Kr=e=>e>=0&&e<8?`var(--chart-${e+1})`:`var(--faint-foreground)`,qr=(e,t,n,r)=>{let i=String(n);if(n===null)return`var(--faint-foreground)`;let a=f(t?.valueColors,n);return a===void 0?e.type===`enum`?Kr(e.enumValues?.indexOf(i)??-1):e.type===`boolean`?Kr(+!n):Kr(r):a},Jr=(e,t,n)=>n.value===null?Wr(`notSet`):e.type===`enum`?At(String(n.value),t?.valueLabels):e.type===`boolean`?n.value?Wr(`yes`):Wr(`no`):n.label??String(n.value),Yr=(e,t,n=``)=>{let r=Qe(t===null?Gr.isNull(e.name):Gr.eq(e.name,t));return n.trim()?`(${n}) AND ${r}`:r},Xr=(e,t)=>t.kind===`count`?e.count:e[t.kind]??null,Zr=(e,t,n,r,i=``)=>e.map((e,a)=>({key:String(e.value),label:Jr(t,n,e),value:Xr(e,r),count:e.count,color:qr(t,n,e.value,a),filter:Yr(t,e.value,i)})),Qr=(e,t)=>e.map(e=>({at:Date.parse(`${String(e.value)}Z`),value:Xr(e,t),count:e.count})),$r=(e,t)=>{if(e===null)return`—`;if(t.kind===`count`)return e.toLocaleString(W());let n=t.hints?.decimals??(Number.isInteger(e)?0:2),r=e.toLocaleString(W(),{minimumFractionDigits:n,maximumFractionDigits:n});return`${t.hints?.prefix??``}${r}${t.hints?.suffix??``}`},ei=(e,t,n)=>{let r=e?.type===`relation`&&e.relation?t[e.relation.resource]:void 0;return r&&r.primaryKey.length===1?Vt(r,n[r.name]):void 0},ti=({model:e,groupBy:t,splitBy:n,sum:r,average:i,filter:a=``,granularity:o=`day`,range:s=`30d`,limit:c=10},l,u)=>{let d=e.fields[t];if(!d)return;let f=d.type===`date`||d.type===`timestamp`,p=ei(d,l,u),m=f&&n!==void 0?e.fields[n]:void 0,h=ei(m,l,u),g=m?{splitBy:m.name,splitLimit:8,...h&&{splitLabel:h}}:{},_=f?{granularity:o,range:s,timeZone:Ot(),...g}:{limit:c,...p&&{label:p}};return{groupBy:t,filter:a,...r&&{sum:r},...i&&{average:i},..._}},ni=(e,t,n)=>n?{kind:`list`,resource:t,filter:n}:e?.list?.filter?{kind:`list`,resource:t,filter:``}:{kind:`list`,resource:t},ri=({resource:e,view:t,slices:n,measure:r})=>{let i=Math.max(0,...n.map(e=>e.value??0));return(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1`,children:n.map(n=>{let a=i>0&&n.value!==null?Math.max(0,n.value)/i:0;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(De,{to:ni(t,e,n.filter),className:`group grid grid-cols-[minmax(6rem,35%)_1fr_auto] items-center gap-3 rounded-md px-1 py-1 hover:bg-muted`,title:r.kind===`count`?void 0:Wr(`records`,{count:$r(n.count,{kind:`count`})}),children:[(0,Z.jsx)(`span`,{className:`truncate group-hover:text-primary-text`,children:n.label}),(0,Z.jsx)(`span`,{className:`h-3 rounded-r bg-muted`,"aria-hidden":!0,children:(0,Z.jsx)(`span`,{className:`block h-full rounded-r`,style:{width:`${a*100}%`,background:`var(--chart-1)`}})}),(0,Z.jsx)(`span`,{className:`text-right font-medium tabular-nums`,children:$r(n.value,r)})]})},n.key)})})},ii=Qt(()=>$t(()=>import(`./period-chart-DSnwMzgV.js`).then(e=>e.PeriodChart),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31])),({compact:e})=>(0,Z.jsx)(G,{className:e?`h-24 w-full`:`h-40 w-full`})),ai=Qt(()=>$t(()=>import(`./group-donut-MrMdALOR.js`).then(e=>e.GroupDonut),__vite__mapDeps([32,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,3,4,5])),()=>(0,Z.jsx)(G,{className:`size-36 rounded-full`})),oi=1e-6,si=(e,t,n,r,i,a=``)=>{let o=t.map((e,t)=>({key:`s${t}`,label:Jr(n,r,e),color:qr(n,r,e.value,t),filter:Yr(n,e.value,a)})),s=i.kind===`count`?0:null,c=(e,t)=>{let n=e.splits?.find(e=>e.value===t);return n?i.kind===`count`?n.count:n[i.kind]??null:s},l=Qr(e,i).map((n,r)=>{let a=e[r],o=t.map(e=>c(a,e.value)),s=Object.fromEntries(o.map((e,t)=>[`s${t}`,e]));if(i.kind===`average`)return{...n,...s};let l=n.value===null?null:n.value-o.reduce((e,t)=>e+(t??0),0);return{...n,...s,other:l===null?null:l<oi?0:l}});return i.kind!==`average`&&l.some(e=>(e.other??0)>0)?{series:[...o,{key:`other`,label:Wr(`other`),color:`var(--border-strong)`}],points:l}:{series:o,points:l.map(({other:e,...t})=>t)}},ci=(e,t,n,r)=>{let i=n??r,a=i===void 0?void 0:e.fields[i];return!a||i===void 0?{kind:`count`}:{kind:n===void 0?`average`:`sum`,field:a,hints:t?.fields[i]}},li=({model:e,view:t,groupBy:n,splitBy:r,type:i=`bar`,sum:a,average:o,filter:s=``,granularity:c=`day`,range:l=`30d`,limit:u=10,empty:d=Wr(`nothingYet`)})=>{let{resources:f,views:p}=Y(),m=e.fields[n],h=m?.type===`date`||m?.type===`timestamp`,g=h&&r!==void 0?e.fields[r]:void 0,_=ti({model:e,groupBy:n,splitBy:r,sum:a,average:o,filter:s,granularity:c,range:l,limit:u},f,p),v=mt(e.name,_??{groupBy:n},_!==void 0),y=ci(e,t,a,o);if(!m)return null;if(v.isPending)return(0,Z.jsx)(G,{className:`h-36 w-full`});if(v.error)return(0,Z.jsx)(`p`,{className:`text-danger-text`,children:Wr(`couldNotLoad`)});let{groups:b}=v.data;if(b.every(e=>e.count===0))return(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:d});let x=i===`line`?`line`:`bar`;if(h&&g&&v.data.splits){let{series:n,points:r}=si(b,v.data.splits,g,t?.fields[g.name],y,s);return(0,Z.jsx)(ii,{points:r,measure:y,bucket:c,type:x,series:n,resource:e.name,view:t})}if(h)return(0,Z.jsx)(ii,{points:Qr(b,y),measure:y,bucket:c,type:x});let S=Zr(b,m,t?.fields[n],y,s);return i===`donut`?(0,Z.jsx)(ai,{resource:e.name,view:t,slices:S,measure:y}):(0,Z.jsx)(ri,{resource:e.name,view:t,slices:S,measure:y})},ui=`0.75rem`,di=e=>{if(!(e>0&&e<=1))throw Error(`An item's share of a row is above 0 and at most 1, not ${e}`);return`calc((100% + ${ui}) * ${e} - ${ui})`},fi=e=>e===void 0?{width:`min(256px, 100%)`,minWidth:`0px`}:{width:di(e),minWidth:`min(100%, 12rem)`},pi=`absolute top-1/2 z-10 hidden size-8 -translate-y-1/2 items-center justify-center rounded-full border border-border-strong bg-background shadow-pop hover:bg-muted sm:flex`,mi=({scroll:e,label:t,share:n,children:r})=>{let i=fi(n);return(0,Z.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,Z.jsx)(`ul`,{ref:e.ref,"aria-label":t,className:`relative flex snap-x snap-mandatory overflow-x-auto overflow-y-hidden overscroll-x-contain pb-1 *:w-(--snap-item-width) *:min-w-(--snap-item-min-width) *:shrink-0 *:snap-start`,style:{gap:ui,scrollbarWidth:`thin`,"--snap-item-width":i.width,"--snap-item-min-width":i.minWidth},children:r}),e.back&&(0,Z.jsx)(`button`,{type:`button`,"aria-label":at(`previous`,{label:t.toLowerCase()}),onClick:()=>e.page(-1),className:`${pi} -left-3`,children:(0,Z.jsx)(Zt,{className:`size-4`,"aria-hidden":!0})}),e.on&&(0,Z.jsx)(`button`,{type:`button`,"aria-label":at(`next`,{label:t.toLowerCase()}),onClick:()=>e.page(1),className:`${pi} -right-3`,children:(0,Z.jsx)(me,{className:`size-4`,"aria-hidden":!0})})]})},hi=(e,t)=>{let n={left:e.scrollLeft,width:e.clientWidth};return{...n,back:n.left>0,on:n.left+n.width<e.scrollWidth-1,watched:t(n)}},gi=(e,t)=>e.width===t.width&&e.back===t.back&&e.on===t.on&&e.watched===t.watched,_i=(e=()=>``)=>{let[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)({left:0,width:0,back:!1,on:!1,watched:``}),a=()=>{if(!t)return;let n=hi(t,e);i(e=>gi(e,n)?e:n)},o=(0,X.useRef)(a);return(0,X.useLayoutEffect)(()=>{o.current=a,a()}),(0,X.useLayoutEffect)(()=>{if(!t)return;let e=()=>o.current(),n=new ResizeObserver(e);return n.observe(t),t.addEventListener(`scroll`,e,{passive:!0}),()=>{n.disconnect(),t.removeEventListener(`scroll`,e)}},[t]),{ref:n,view:{left:r.left,width:r.width},back:r.back,on:r.on,page:e=>{if(!t)return;let n=parseFloat(getComputedStyle(t).columnGap)||0;t.scrollBy({left:e*Math.max(1,t.clientWidth-n),behavior:`smooth`})}}},vi=bt(`app/embedded-list`),yi=(e,t,n)=>{if(!(e>=t))return vi(n?`firstOfAbout`:`firstOf`,{shown:e,total:t.toLocaleString(W())})},bi=`protobase:embedded-display:`,xi=e=>`${bi}${e}`,Si=(e,t)=>Dt(()=>e.getItem(t)??void 0,void 0),Ci=(e,t,n)=>Dt(()=>e.setItem(t,n),void 0),wi=(e,t,{picked:n,preferred:r})=>{let i=Ie(e).map(e=>e.name);return n!==void 0&&i.includes(n)?n:ne(e,t,r!==void 0&&i.includes(r)?r:void 0)},Ti=(e,t,n,{resource:r=e.name,...i})=>Ce({kind:`list`,resource:r},i,{...je(e,t,n),display:ne(t,n)}),Ei=e=>e.total??Number(e.rows[0]?.count??0),Di=e=>e==null||e===``,Oi=e=>typeof e==`string`&&URL.canParse(e)&&new URL(e).protocol===`https:`?new URL(e).href:void 0,ki=e=>typeof e==`number`||typeof e==`boolean`||typeof e==`string`&&/^(-?\d+(\.\d+)?|true|false)$/.test(e),Ai=(e,t)=>{if(e.kind!==`list`||e.filter===void 0)return!1;let n=Object.hasOwn(t,e.resource)?t[e.resource]:void 0;if(!n)return!1;let r=ut(e.filter);return!r.ok||!r.ast?!1:St(n,r.ast).ok},ji=(e,t,n,r,i)=>{let a=it(e).find(e=>!ot(e).some(e=>Di(r[e])));if(!a)return;let o=xe(a.label,e=>{let i=t.fields[e];return i?qe(i,r[e],n?.fields[e]):String(r[e])}),s=We(a);if(`href`in s){let e=Oi(r[ie(s.href)??``]);return e===void 0?void 0:{label:o,href:e}}if(ke(s.to)!==void 0){let e=Te(s.to,r);return Ai(e,i)?{label:o,to:e}:void 0}if(l(s.to).every(e=>ki(r[e])))return{label:o,to:Te(s.to,r)}},Mi=({button:e,model:t,view:n,record:r,models:i})=>{let a=ji(e,t,n,r,i);if(!a)return null;let o=J(kt({variant:`secondary`,size:`sm`}),`min-w-0 max-w-full shrink`),s=(0,Z.jsx)(`span`,{className:`truncate`,children:a.label});return`href`in a?(0,Z.jsxs)(`a`,{href:a.href,target:`_blank`,rel:`noreferrer`,title:a.label,className:o,children:[s,(0,Z.jsxs)(`span`,{className:`sr-only`,children:[` `,Ct(`opensNewTab`)]}),(0,Z.jsx)(ft,{"aria-hidden":!0,className:`size-3.5 shrink-0`})]}):(0,Z.jsx)(De,{to:a.to,title:a.label,className:o,children:s})},Ni=dn({rowSortingFeature:pn,rowSelectionFeature:fn}),Pi=un(),Fi=e=>Pi.columns(e.map(e=>Pi.accessor(t=>e.value?e.value(t):t[e.id],{id:e.id,header:e.header,enableSorting:e.sortable??!1,cell:t=>e.render?e.render(t.row.original):Se(e,t.getValue(),t.row.original)}))),Ii=(e,t)=>e.flatMap(e=>{let n=e.available?t.filter(e.available):t;return n.length===0?[]:[{action:e,rows:n,skipped:t.length-n.length}]}),Li=async(e,t,n)=>{let r=await e.onRun(t,n);if(!r)return t;let i=new Set(r.map(e=>e.id));return t.filter(e=>!i.has(e.id))},Ri=()=>{let e=!1;return async(t,n,r)=>{if(!e){e=!0;try{return await Li(t,n,r)}finally{e=!1}}}},zi=({total:e,selectedCount:t,bulkActions:n=[],className:r})=>(0,Z.jsx)(`div`,{className:J(`flex h-9 shrink-0 items-center border-t bg-surface px-3 text-xs text-muted-foreground`,r),children:(0,Z.jsxs)(`span`,{className:`flex items-center tabular-nums`,children:[ce(e),t>0&&(0,Z.jsx)(`span`,{className:`ml-3 font-medium text-primary-text`,children:o(`selected`,{count:S(t)})}),t>0&&n.map(e=>(0,Z.jsx)(`button`,{type:`button`,onClick:e.onRun,className:J(`ml-3 rounded border bg-background px-2 py-0.5 font-medium hover:bg-muted`,e.destructive?`border-danger/40 text-danger-text`:`text-foreground`),children:e.label},e.label))]})}),Bi=(e,t)=>typeof e.label==`string`?e.label:e.label(t),Vi=(e,t)=>e.filter(e=>e.available?.(t)??!0),Hi=({row:e,actions:t})=>{let{open:n,setOpen:r,place:i,button:a,menu:s}=He();return(0,Z.jsxs)(`div`,{className:`relative flex justify-center bg-inherit`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{ref:a,type:`button`,"aria-label":o(`rowActions`),"aria-haspopup":`menu`,"aria-expanded":n,onClick:()=>r(!n),className:`inline-flex items-center justify-center rounded p-1 text-faint-foreground hover:bg-muted hover:text-foreground pointer-coarse:size-11`,children:(0,Z.jsx)(L,{className:`size-4`})}),(0,Z.jsx)(p,{open:n,title:o(`rowActions`),onClose:()=>r(!1),menu:(0,Z.jsx)(`ul`,{ref:s,role:`menu`,onClick:e=>e.stopPropagation(),style:i??{visibility:`hidden`},className:`fixed z-50 min-w-36 rounded-md border bg-background py-1 shadow-pop`,children:t.map((t,n)=>{let i=Bi(t,e),a=t.blocked?.(e),o=J(`block w-full px-3 py-1.5 text-left hover:bg-muted disabled:cursor-default disabled:opacity-60 disabled:hover:bg-transparent`,t.destructive&&`text-danger-text`);return(0,Z.jsx)(`li`,{role:`none`,children:t.link&&a===void 0?(0,Z.jsx)(Lt,{role:`menuitem`,to:t.link(e),onClick:()=>r(!1),className:o,children:i}):(0,Z.jsx)(`button`,{type:`button`,role:`menuitem`,disabled:a!==void 0,title:a,className:o,onClick:()=>{r(!1),t.onSelect?.(e)},children:i})},n)})})})]})},Ui=e=>52+Math.ceil(String(e).length*1.33)*7,Wi=.6,Gi=(e,t)=>Math.max(e.minWidth??0,e.width*t),Ki=(e,t)=>e.fixed?`${Math.max(e.minWidth??0,e.width)}px`:`minmax(${Gi(e,t)}px, ${e.width}fr)`,qi=(e,t,n=0,r=Wi)=>`${t}px ${e.map(e=>Ki(e,r)).join(` `)}${n>0?` ${n}px`:``}`,Ji=(e,t,n=0,r=Wi)=>t+n+e.reduce((e,t)=>e+(t.fixed?Math.max(t.minWidth??0,t.width):Gi(t,r)),0),Yi=()=>{let e=(0,X.useRef)(null),t=(0,X.useRef)(null),[n,r]=(0,X.useState)({scrolled:!1,more:!1}),i=(0,X.useCallback)(()=>{let t=e.current;if(!t)return;let n={scrolled:t.scrollLeft>1,more:t.scrollLeft+t.clientWidth<t.scrollWidth-1};r(e=>e.scrolled===n.scrolled&&e.more===n.more?e:n)},[]);return{ref:e,attach:(0,X.useCallback)(n=>{if(t.current?.disconnect(),t.current=null,e.current=n,!n)return;let r=new ResizeObserver(i);r.observe(n);for(let e of Array.from(n.children))r.observe(e);t.current=r,i()},[i]),onScroll:i,...n}},Xi=`protobase:pinned:`,Zi=(e,t)=>`${Xi}${e}:${t}`,Qi=(e,t)=>Dt(()=>{let n=e.getItem(t);if(n===null)return;let r=JSON.parse(n);return Array.isArray(r)&&r.every(e=>typeof e==`string`)?r:void 0},void 0),$i=(e,t,n)=>Dt(()=>e.setItem(t,JSON.stringify(n)),void 0),ea=(e,t=[])=>{let[n,r]=(0,X.useState)(()=>e?Qi(localStorage,e):void 0),i=(0,X.useCallback)(t=>{r(t),e&&$i(localStorage,e,t)},[e]);return[n??t,i]},ta=e=>{let t=e.findIndex(e=>e.title);return t<0||t>1?[]:e.slice(0,t+1).map(e=>e.id)},na=e=>Object.fromEntries(e.map(({id:e,width:t,minWidth:n,fixed:r})=>[e,{width:t,minWidth:n,fixed:r}])),ra=e=>e.map(({id:e,minWidth:t,maxWidth:n})=>`${e}:${t??``}:${n??``}`).sort().join(` `),ia=(e,t)=>{let n=ra(e),[r,i]=(0,X.useState)(),a=r?.key===n?r:void 0;!a&&t.length>0&&i({key:n,sizes:na(oe(e,t))});let o=a?.sizes;return(0,X.useMemo)(()=>o?e.map(e=>({...e,...o[e.id]})):e,[e,o])},aa=(e,t)=>Math.max(Math.min(64,e),Math.round(e+t)),oa=(e,t)=>e.map(e=>e.id in t?{...e,fixed:!0,width:t[e.id],minWidth:void 0}:e),sa=e=>Object.fromEntries([...e.querySelectorAll(`[data-col-id]`)].map(e=>[e.dataset.colId,e.offsetWidth])),ca=e=>{let[t,n]=(0,X.useState)({}),r=()=>({...e.current?sa(e.current):{},...t});return{widths:t,onPointerDown:(e,t)=>{if(t.button!==0)return;t.preventDefault();let i=r(),a=t.clientX,o=t=>n({...i,[e]:aa(i[e]??0,t.clientX-a)}),s=()=>{window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,s)},onKeyDown:(e,t)=>{let i=t.key===`ArrowRight`?16:t.key===`ArrowLeft`?-16:0;if(i===0)return;t.preventDefault();let a=r();n({...a,[e]:aa(a[e]??0,i)})}}},la=()=>parseFloat(getComputedStyle(document.documentElement).fontSize),ua=()=>(0,X.useSyncExternalStore)(e=>(window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)),la,()=>16),da=2,fa=2.25,pa=1.75,ma=2,ha=2.25,ga=(e,{compact:t,withBelow:n})=>({header:da*e,row:((t?pa:fa)+(n?ma:0))*e,footer:ha*e}),_a=e=>e===`money`||e===`number`||e===`signed`||e===`percent`,va=()=>o(`unsortable`),ya=({header:e,pinned:t,sortable:n,onTogglePin:r})=>{let{open:i,setOpen:a,place:s,button:c,menu:l}=He();return(0,Z.jsxs)(`div`,{className:`relative ml-auto shrink-0`,children:[(0,Z.jsx)(`button`,{ref:c,type:`button`,"aria-label":o(`columnMenu`,{header:e}),"aria-haspopup":`menu`,"aria-expanded":i,onClick:()=>a(!i),className:`relative inline-flex size-5 items-center justify-center rounded text-faint-foreground hover:bg-muted hover:text-foreground focus-visible:opacity-100 after:absolute after:-inset-2 after:content-[''] md:opacity-0 md:group-hover/cell:opacity-100 aria-expanded:opacity-100`,children:(0,Z.jsx)(L,{className:`size-3.5`})}),(0,Z.jsx)(p,{open:i,title:o(`columnMenu`,{header:e}),onClose:()=>a(!1),menu:(0,Z.jsxs)(`ul`,{ref:l,role:`menu`,style:s??{visibility:`hidden`},className:`fixed z-50 min-w-32 rounded-md border bg-background py-1 text-body font-normal text-foreground shadow-pop`,children:[!n&&(0,Z.jsx)(`li`,{role:`none`,children:(0,Z.jsx)(`span`,{role:`menuitem`,"aria-disabled":`true`,className:`block min-h-9 whitespace-nowrap px-3 py-1.5 text-muted-foreground`,children:va()})}),(0,Z.jsx)(`li`,{role:`none`,children:(0,Z.jsx)(`button`,{type:`button`,role:`menuitem`,className:`block min-h-9 w-full whitespace-nowrap px-3 py-1.5 text-left hover:bg-muted`,onClick:()=>{a(!1),r()},children:o(t?`unpin`:`pinToLeft`)})})]})})]})},ba=({id:e,header:t,width:n,resize:r})=>(0,Z.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":o(`resizeColumn`,{header:t}),"aria-valuemin":64,"aria-valuenow":n,tabIndex:0,onPointerDown:t=>r.onPointerDown(e,t),onKeyDown:t=>r.onKeyDown(e,t),className:`group/resize absolute inset-y-0 right-0 z-10 flex w-2 cursor-col-resize touch-none justify-end outline-none`,children:(0,Z.jsx)(`div`,{className:`h-full w-0.5 bg-transparent group-hover/resize:bg-primary group-focus-visible/resize:bg-primary group-active/resize:bg-primary`})}),xa=({sorted:e})=>e===`asc`?(0,Z.jsx)(Nn,{className:`size-3 text-foreground`}):e===`desc`?(0,Z.jsx)(kn,{className:`size-3 text-foreground`}):(0,Z.jsx)(I,{className:`size-3 opacity-0 group-hover/head:opacity-100`}),Sa=({spec:e})=>(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`truncate`,children:e.header}),e.highlight&&(0,Z.jsx)(`span`,{className:`rounded bg-primary px-1 text-[0.625rem] font-semibold uppercase leading-4 text-primary-foreground`,children:o(`new`)})]}),Ca=({cells:e,specs:t,gutter:n,selectedCount:r,selectable:i,trailing:a,minScale:s,pins:c={},lastPinned:l,scrolled:u,onTogglePin:d,resize:f,widths:p={},onClearSelection:m})=>(0,Z.jsxs)(`div`,{className:`grid h-8 shrink-0 items-center border-b bg-surface text-body font-medium text-muted-foreground`,style:{gridTemplateColumns:qi(t,n,a,s)},role:`row`,children:[(0,Z.jsxs)(`div`,{className:J(`sticky left-0 z-10 flex h-full items-center gap-2 bg-inherit pl-3`,u&&!l&&`shadow-[1px_0_0_var(--border),4px_0_6px_-2px_rgb(0_0_0/0.12)]`),style:{width:n},children:[i&&(0,Z.jsx)(Et,{checked:!1,indeterminate:r>0,label:o(r>0?`clearSelection`:`noRowsSelected`),disabled:r===0,onChange:m,className:J(r===0&&`opacity-60`)}),n>40&&(0,Z.jsx)(`span`,{className:`w-6 text-right text-faint-foreground`,children:`#`})]}),e.map(({spec:e,sorted:t,onSort:n})=>{let r=e.id in c;return(0,Z.jsxs)(`div`,{"data-col-id":e.id,style:r?{left:c[e.id]}:void 0,className:J(`group/cell flex h-full min-w-0 items-center`,r?`sticky z-10 bg-inherit`:`relative`,r&&u&&e.id===l&&`shadow-[1px_0_0_var(--border),4px_0_6px_-2px_rgb(0_0_0/0.12)]`,e.highlight&&`bg-primary-soft text-primary-text`),children:[e.sortable?(0,Z.jsxs)(`button`,{type:`button`,onClick:n,className:J(`group/head flex h-full min-w-0 flex-1 items-center gap-1 pl-3 pr-1 text-left`,_a(e.kind)&&`justify-end`,`hover:text-foreground`,t&&`text-foreground`),children:[(0,Z.jsx)(Sa,{spec:e}),(0,Z.jsx)(xa,{sorted:t})]}):(0,Z.jsx)(`div`,{title:va(),className:J(`flex h-full min-w-0 flex-1 items-center gap-1 pl-3 pr-1 text-left`,_a(e.kind)&&`justify-end`),children:(0,Z.jsx)(Sa,{spec:e})}),(0,Z.jsx)(`div`,{className:`pr-1.5`,children:(0,Z.jsx)(ya,{header:e.header,pinned:r,sortable:!!e.sortable,onTogglePin:()=>d(e.id)})}),f&&(0,Z.jsx)(ba,{id:e.id,header:e.header,width:p[e.id],resize:f})]},e.id)}),a?(0,Z.jsx)(`div`,{className:`sticky right-0 z-10 h-full bg-inherit`}):null]}),wa=e=>({gridTemplateColumns:qi(e.specs,e.gutter,e.trailing,e.minScale),height:e.height,transform:`translateY(${e.offset}px)`}),Ta=(e,t)=>J(`flex h-full min-w-0 items-center overflow-hidden whitespace-nowrap px-3`,_a(e.kind)&&`justify-end`,e.highlight&&`bg-primary-soft/60`,t.pins&&e.id in t.pins&&`sticky z-10 bg-inherit`,t.scrolled&&e.id===t.lastPinned&&`shadow-[1px_0_0_var(--border),4px_0_6px_-2px_rgb(0_0_0/0.12)]`),Ea=(e,t)=>t&&e.id in t?{left:t[e.id]}:void 0,Da=({width:e,index:t,selectable:n,selected:r,onToggle:i,edge:a})=>(0,Z.jsxs)(`div`,{onClick:n?e=>{e.stopPropagation(),i?.()}:void 0,className:J(`sticky left-0 z-10 flex h-full items-center gap-2 bg-inherit pl-3`,n&&`cursor-default`,a&&`shadow-[1px_0_0_var(--border),4px_0_6px_-2px_rgb(0_0_0/0.12)]`),style:{width:e},children:[n&&(0,Z.jsx)(Et,{checked:!!r,label:o(`selectRow`,{row:t+1})}),e>40&&(0,Z.jsx)(`span`,{className:`min-w-6 text-right text-[0.6875rem] tabular-nums text-faint-foreground`,children:S(t+1)})]}),Oa=(e,t,n)=>({gridTemplateColumns:qi(e.specs,e.gutter,e.trailing,e.minScale),height:e.height,top:e.offset,transform:t===0?void 0:`translateY(${t}px)`,transition:n}),ka=e=>t=>{t.target.closest(`a`)||e()},Aa=({cells:e,selected:t,current:n=!1,onToggle:r,onOpen:i,menu:a,handle:o,rowRef:s,dragY:c,transition:l,dragging:u,...d})=>(0,Z.jsxs)(`div`,{ref:s,role:`row`,"aria-current":n||void 0,"data-pressable":i?``:void 0,onClick:i&&ka(i),className:J(`absolute inset-x-0 top-0 grid items-center border-b`,t||n?`bg-primary-soft`:`bg-background hover:bg-surface`,i&&`cursor-pointer`,u&&`z-30 bg-surface shadow-pop`),style:c===void 0?wa(d):Oa(d,c,l),children:[o?(0,Z.jsx)(`div`,{className:J(`sticky left-0 z-10 flex h-full items-center bg-inherit pl-1.5`,d.scrolled&&!d.lastPinned&&`shadow-[1px_0_0_var(--border),4px_0_6px_-2px_rgb(0_0_0/0.12)]`),style:{width:d.gutter},children:o}):(0,Z.jsx)(Da,{width:d.gutter,index:d.index,selectable:d.selectable,selected:t,onToggle:r,edge:d.scrolled&&!d.lastPinned}),e.map(({spec:e,content:t,props:n,chosen:r,editing:i,editable:a})=>(0,Z.jsx)(`div`,{role:n?`gridcell`:`cell`,...n,className:J(Ta(e,d),n&&`scroll-mb-[calc(var(--pb-sticky-bottom,0px)+3rem)] scroll-mt-[calc(var(--pb-sticky-top,0px)+2rem)] outline-none`,a&&!i&&`cursor-default`,r&&`shadow-[inset_0_0_0_2px_var(--primary)]`,i&&`z-30 overflow-visible bg-background px-1`),style:Ea(e,d.pins),children:t},e.id)),a&&(0,Z.jsx)(`div`,{className:`sticky right-0 z-10 flex h-full items-center justify-center bg-inherit`,children:a})]}),ja=[`w-3/4`,`w-1/2`,`w-2/3`,`w-5/6`,`w-2/5`],Ma=e=>(0,Z.jsxs)(`div`,{role:`row`,"aria-busy":!0,className:`absolute inset-x-0 top-0 grid items-center border-b bg-background`,style:wa(e),children:[(0,Z.jsx)(Da,{width:e.gutter,index:e.index,selectable:!1,edge:e.scrolled&&!e.lastPinned}),e.specs.map((t,n)=>(0,Z.jsx)(`div`,{className:Ta(t,e),style:Ea(t,e.pins),children:(0,Z.jsx)(G,{className:J(`h-2.5`,ja[(e.index+n)%ja.length],_a(t.kind)&&`ml-auto`)})},t.id))]}),Na=1e7,Pa=(e,t,n)=>{let r=e*t,i=Math.min(r,Na);return{rowHeight:t,trueHeight:r,contentHeight:i,scaled:r>i,maxTop:Math.max(0,r-n),maxScroll:Math.max(0,i-n)}},Fa=(e,t)=>!e.scaled||t<=0?t:t>=e.maxScroll?e.maxTop+t-e.maxScroll:t/e.maxScroll*e.maxTop,Ia=(e,t)=>!e.scaled||t<=0?t:t>=e.maxTop?e.maxScroll+t-e.maxTop:t/e.maxTop*e.maxScroll,La=(e,t,n,r)=>{let i=t*e.rowHeight;return e.scaled?i-n+r:i},Ra=(e,t,n,r,i)=>{let a=Math.min(e,Math.max(0,Math.floor(t/n)-i)),o=Math.min(e-1,Math.floor((t+r)/n)+i);return{first:a,last:Math.max(a-1,o)}},za=e=>{let t=document.scrollingElement??document.documentElement;for(let n=e.parentElement;n&&n!==t&&n!==document.body;n=n.parentElement)if(/auto|scroll/.test(getComputedStyle(n).overflowY))return n;return t},Ba=e=>e===(document.scrollingElement??document.documentElement),Va=e=>Ba(e)?window:e,Ha=e=>Number.parseFloat(e)||0,Ua=e=>{let t=getComputedStyle(e),n=Ba(e)?{top:0,height:e.clientHeight}:{top:e.getBoundingClientRect().top+e.clientTop,height:e.clientHeight},r=Ha(t.scrollPaddingTop);return{top:n.top+r,height:Math.max(0,n.height-r-Ha(t.scrollPaddingBottom))}},Wa=6,Ga=(e,t,n)=>{let r=Pa(t,n,e.height),i=Fa(r,e.position);return{geometry:r,top:i,topIndex:Math.floor(Math.max(0,i)/n),...Ra(t,i,n,e.height,Wa)}},Ka=({total:e,rowHeight:t,initialIndex:n,inset:r=0,settle:i,ready:a=!0,onScroll:o})=>{let s=(0,X.useRef)(null),c=(0,X.useRef)(null),[l,u]=(0,X.useState)({position:0,height:0}),d=(0,X.useRef)({total:e,rowHeight:t,initialIndex:n,inset:r,ready:a,onScroll:o});d.current={total:e,rowHeight:t,initialIndex:n,inset:r,ready:a,onScroll:o};let f=(0,X.useCallback)(()=>{let e=s.current;if(!e||!c.current)return;let t=Ua(c.current),n=d.current.inset;return{position:t.top+n-e.getBoundingClientRect().top,height:Math.max(0,t.height-n)}},[]),p=(0,X.useRef)({pending:!0,laidOut:!1}),m=(0,X.useRef)(l);m.current=l;let h=(0,X.useCallback)(()=>{let e=f();if(!e)return;let t=m.current,{total:n,rowHeight:r,onScroll:i}=d.current,a=Ga(t,n,r),o=Ga(e,n,r);p.current.pending||i?.(Math.max(0,o.top));let s=!o.geometry.scaled&&a.first===o.first&&a.last===o.last&&a.topIndex===o.topIndex;(t.height!==e.height||t.position!==e.position&&!s)&&(m.current=e,u(e))},[f]),g=(0,X.useCallback)(()=>{if(!p.current.pending||!p.current.laidOut||!d.current.ready)return;let e=f(),t=c.current;if(!e||!t)return;p.current.pending=!1;let{total:n,rowHeight:r,initialIndex:i}=d.current;i>0?t.scrollTop+=Ia(Pa(n,r,e.height),i*r)-e.position:e.position>0&&(t.scrollTop=0)},[f]);(0,X.useLayoutEffect)(()=>{let e=s.current;if(!e)return;let t=za(e);c.current=t;let n=Va(t);n.addEventListener(`scroll`,h,{passive:!0}),window.addEventListener(`resize`,h,{passive:!0});let r=new ResizeObserver(()=>{p.current.laidOut=!0,g(),h()});return r.observe(t),r.observe(e),h(),()=>{n.removeEventListener(`scroll`,h),window.removeEventListener(`resize`,h),r.disconnect(),c.current=null}},[h,g]),(0,X.useLayoutEffect)(()=>{g(),h()});let _=(0,X.useCallback)(e=>{let t=f();if(!t||!c.current)return;let n=Pa(d.current.total,d.current.rowHeight,t.height);c.current.scrollTop+=Ia(n,e)-t.position,h()},[f,h]),v=(0,X.useCallback)(()=>!p.current.pending,[]),y=Ga(l,e,t),b=i?i(y.top):y.top,{first:x,last:S}=i?Ra(e,b,t,l.height,Wa):y,C=Array.from({length:S-x+1},(e,t)=>({index:x+t,offset:La(y.geometry,x+t,b,l.position)}));return{ref:s,height:l.height,top:b,geometry:y.geometry,rows:C,first:x,last:S,scrollTo:_,started:v}},qa=e=>e===`ArrowUp`||e===`ArrowDown`||e===`ArrowLeft`||e===`ArrowRight`,Ja=(e,t,n,r)=>{let i=n.indexOf(e.column);if(t===`ArrowUp`)return e.index>0?{...e,index:e.index-1}:void 0;if(t===`ArrowDown`)return e.index<r-1?{...e,index:e.index+1}:void 0;let a=n[t===`ArrowLeft`?i-1:i+1];return i>=0&&a!==void 0?{...e,column:a}:void 0},Ya=(e,t,n,r)=>{let i=t.indexOf(e);return(r===1?t.slice(i+1):t.slice(0,Math.max(0,i)).reverse()).find(n)},Xa=e=>`${e.index}:${e.column}`,Za=({editor:e,columns:t,total:n,rowAt:r,onOpenRow:i,container:a})=>{let[o,s]=(0,X.useState)(),[c,l]=(0,X.useState)(!1),u=(0,X.useRef)(!1),d=(0,X.useRef)(!1);if((0,X.useEffect)(()=>{if(!o||c||!u.current)return;u.current=!1;let e=a.current?.querySelector(`[data-cell="${Xa(o)}"]`);e&&(e.focus({preventScroll:!0}),e.scrollIntoView({block:`nearest`,inline:`nearest`}))},[o,c,a]),!e)return;let f=t=>{let n=r(t.index);return n!==void 0&&e.editable(n,t.column)},p=(e,t=!1)=>{u.current=!0,s(e),l(t&&f(e))},m=n=>{if(!o)return;let i=r(o.index),s=n&&i?Ya(o.column,t,t=>e.editable(i,t),n):void 0,c=!!a.current?.contains(document.activeElement);p(s?{...o,column:s}:o,s!==void 0),u.current=c};return{cell:(n,r,i,a)=>{let l={index:n,column:i},u=o?.index===n&&o.column===i,f=e.editable(r,i),h=u||!o&&n===0&&i===t[0];return{content:u&&c?e.render(r,i,m):a,chosen:u,editing:u&&c,editable:f,props:{"data-cell":Xa(l),tabIndex:h?0:-1,"aria-selected":u,onMouseDown:()=>{d.current=u},onFocus:e=>{e.target===e.currentTarget&&!u&&s(l)},onClick:e=>{f&&(e.stopPropagation(),d.current&&!c&&p(l,!0))},onDoubleClick:e=>{f&&(e.stopPropagation(),u&&c||p(l,!0))}}}},onKeyDown:e=>{if(c||!o||!(e.target instanceof HTMLElement)||e.target.dataset.cell!==Xa(o))return;let a=e.key===`Tab`?e.shiftKey?`ArrowLeft`:`ArrowRight`:e.key;if(qa(a)){let i=Ja(o,a,t,n);if(!i&&e.key===`Tab`)return;e.preventDefault(),i&&r(i.index)&&p(i);return}if(e.key===`Enter`||e.key===`F2`){e.preventDefault();let t=r(o.index);f(o)?p(o,!0):e.key===`Enter`&&t&&i?.(t);return}e.key===`Escape`&&s(void 0)}}},Qa=({ids:e,rowAt:t,reorder:n,children:r})=>{let i=Cn(_n(vn,{activationConstraint:{distance:4}}),_n(bn,{activationConstraint:{delay:250,tolerance:5}}),_n(yn,{coordinateGetter:En})),a=t=>e.indexOf(String(t)),s=e=>{let r=t(a(e));return r?n.label(r):o(`row`)};return(0,Z.jsx)(Sn,{sensors:i,collisionDetection:xn,onDragEnd:({active:e,over:t})=>{t&&e.id!==t.id&&n.onMove(a(e.id),a(t.id))},accessibility:{announcements:{onDragStart:({active:t})=>o(`pickedUp`,{name:s(t.id),row:a(t.id)+1,rows:e.length}),onDragOver:({active:t,over:n})=>n?o(`isOver`,{name:s(t.id),row:a(n.id)+1,rows:e.length}):void 0,onDragEnd:({active:t,over:n})=>n?o(`droppedAt`,{name:s(t.id),row:a(n.id)+1,rows:e.length}):o(`putBack`,{name:s(t.id)}),onDragCancel:({active:e})=>o(`cancelled`,{name:s(e.id),row:a(e.id)+1})},screenReaderInstructions:{draggable:o(`reorderInstructions`)}},children:(0,Z.jsx)(Dn,{items:e,strategy:wn,children:r})})},$a=({row:e,label:t,...n})=>{let{attributes:r,listeners:i,setNodeRef:a,setActivatorNodeRef:s,transform:c,transition:l,isDragging:u}=Tn({id:e.id}),d=(0,Z.jsx)(`button`,{ref:s,type:`button`,"aria-label":o(`move`,{label:t}),...r,...i,onClick:e=>e.stopPropagation(),style:{touchAction:`none`},className:`flex size-7 cursor-grab items-center justify-center rounded text-faint-foreground hover:bg-muted hover:text-foreground focus-visible:text-foreground active:cursor-grabbing pointer-coarse:size-9`,children:(0,Z.jsx)(Vn,{className:`size-4`})});return(0,Z.jsx)(Aa,{...n,rowRef:a,handle:d,dragY:c?.y??0,transition:l,dragging:u})},eo=({columns:e,source:t,naturalSort:n,initialScrollIndex:r=0,onScrollIndex:i,latencyMs:a=150,sort:o,onSortChange:s,onOpenRow:c,rowLink:l,chosenRow:u,rowActions:d,cellEditor:f,rowPatches:p,bulkActions:m,pinKey:h,defaultPinned:g,rowNumbers:_=!0,compact:v=!1,selectable:y=!0,reorder:b,fit:x=!1,scroll:S=`own`,className:C})=>{let w=y&&!b,{header:T,row:E,footer:D}=ga(ua(),{compact:v,withBelow:e.some(e=>e.below)}),O=!Ae(),k=(g??(O?[]:ta(e))).join(` `),[A,ee]=ea(h,(0,X.useMemo)(()=>k?k.split(` `):[],[k])),j=(0,X.useMemo)(()=>[...A.flatMap(t=>e.find(e=>e.id===t)??[]),...e.filter(e=>!A.includes(e.id))],[e,A]),te=j.slice(0,j.filter(e=>A.includes(e.id)).length).map(e=>e.id),{total:M}=t,[N,ne]=(0,X.useState)(n?[{id:n.columnId,desc:n.direction===`desc`}]:[]),re=o?[{id:o.columnId,desc:o.direction===`desc`}]:N,P=e=>{let t=typeof e==`function`?e(re):e,n=t[0];s&&n&&s({columnId:n.id,direction:n.desc?`desc`:`asc`}),o||ne(t)},[ie,F]=(0,X.useState)({}),ae=(0,X.useMemo)(()=>Fi(j),[j]),I=re[0],L=!!(!o&&n&&I&&I.id===n.columnId&&(I.desc?`desc`:`asc`)!==n.direction),R=t.rowAt,z=(0,X.useCallback)(e=>R(L?M-1-e:e),[R,L,M]),[oe]=(0,X.useState)(r),{ref:se,geometry:ce,rows:le,first:ue,last:B}=Ka({total:M,rowHeight:E,initialIndex:oe,inset:T,onScroll:i&&(e=>i(e/E))}),de=O||!_?40:Ui(M),fe=mn({total:M,rowAt:R?z:void 0,loadRows:t.loadRows,cachedRows:t.cachedRows,revision:t.revision,latencyMs:a},ue,B),pe=(0,X.useCallback)(e=>{let t=fe(e),n=t&&p?.get(t.id);return n?{...t,...n}:t},[fe,p]),me=le.map(({index:e,offset:t})=>({index:e,offset:t,row:pe(e)})),he=(0,X.useMemo)(()=>me.flatMap(({row:e})=>e?[e]:[]),[pe,ue,B]),V=(0,X.useRef)(null),ge=ca(V),_e=ia(j,he),ve=(0,X.useMemo)(()=>oa(_e,ge.widths),[_e,ge.widths]),ye=ln({features:Ni,columns:ae,data:he,state:{sorting:re,rowSelection:ie},onSortingChange:P,onRowSelectionChange:F,manualSorting:!0,enableMultiSort:!1,enableSortingRemoval:!1,getRowId:e=>e.id}),be=new Map(ye.getRowModel().rows.map(e=>[e.id,e])),xe=Object.keys(ie).length,Se=(0,X.useRef)(new Map),[Ce]=(0,X.useState)(Ri);for(let e of ye.getRowModel().rows)e.getIsSelected()&&Se.current.set(e.id,e.original);let we=d&&d.length>0?40:0,Te=O?1:Wi,Ee=Yi(),De=()=>{Ee.onScroll(),V.current&&Ee.ref.current&&(V.current.scrollLeft=Ee.ref.current.scrollLeft)},[Oe,ke]=(0,X.useState)({});(0,X.useLayoutEffect)(()=>{let e=V.current?.querySelector(`[role=row]`);if(!e)return;let t=de,n={};for(let r of te)n[r]=t,t+=e.querySelector(`[data-col-id="${r}"]`)?.offsetWidth??0;JSON.stringify(Oe)!==JSON.stringify(n)&&ke(n)});let je=te.at(-1),Me=e=>ee(A.includes(e)?A.filter(t=>t!==e):[...A,e]),Ne=ye.getHeaderGroups().flatMap(e=>e.headers.map(e=>({spec:j.find(t=>t.id===e.column.id),sorted:e.column.getIsSorted(),onSort:t=>e.column.getToggleSortingHandler()?.(t)}))),Pe=(0,X.useRef)(null),H=Za({editor:f,columns:(0,X.useMemo)(()=>j.map(e=>e.id),[j]),total:M,rowAt:pe,onOpenRow:c,container:Pe}),U=(j.find(e=>e.title)??j[0])?.id,Fe=Ji(ve,de,we,Te),Ie=S===`own`,Le=!x||w&&!!m?.length,Re=(0,Z.jsx)(`div`,{ref:V,className:J(`sticky z-20 shrink-0 overflow-hidden`,Ie?`top-0`:`top-[var(--pb-sticky-top,0px)]`),children:(0,Z.jsx)(`div`,{style:{minWidth:Fe},children:(0,Z.jsx)(Ca,{cells:Ne,specs:ve,gutter:de,trailing:we,minScale:Te,pins:Oe,lastPinned:je,scrolled:Ee.scrolled,onTogglePin:Me,resize:ge,widths:ge.widths,selectable:w,selectedCount:xe,onClearSelection:()=>F({})})})}),ze=me.map(({index:e,offset:t,row:n})=>{let r={specs:ve,gutter:de,index:e,offset:t,height:E,selectable:w,trailing:we,minScale:Te,scrolled:Ee.scrolled,pins:Oe,lastPinned:je},i=n?be.get(n.id):void 0;if(!i||!n)return(0,Z.jsx)(Ma,{...r},`skeleton-${e}`);let a=we?Vi(d,n):[],o={...r,selected:i.getIsSelected(),current:n.id===u,onToggle:()=>i.toggleSelected(),onOpen:c?()=>c(n):void 0,menu:a.length>0?(0,Z.jsx)(Hi,{row:n,actions:a}):void 0,cells:i.getAllCells().map(t=>{let r=j.find(e=>e.id===t.column.id),i=(0,Z.jsx)(ye.FlexRender,{cell:t}),a=!!f?.editable(n,t.column.id),o=l&&t.column.id===U&&!a?(0,Z.jsx)(Lt,{to:l(n),className:`flex min-w-0 items-center hover:underline`,children:i}):i,s=r.below?(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[o,r.below(n)]}):o;return{spec:r,...H?H.cell(e,n,t.column.id,s):{content:s}}})};return b?(0,Z.jsx)($a,{...o,row:n,label:b.label(n)},n.id):(0,Z.jsx)(Aa,{...o},n.id)}),Be=(0,Z.jsx)(`div`,{ref:Ee.attach,onScroll:De,className:`overflow-x-auto overflow-y-hidden overscroll-x-contain [-webkit-overflow-scrolling:touch]`,children:(0,Z.jsx)(`div`,{ref:se,className:`relative`,style:{minWidth:Fe,height:ce.contentHeight},children:b?(0,Z.jsx)(Qa,{ids:Array.from({length:M},(e,t)=>pe(t)?.id??`missing-${t}`),rowAt:pe,reorder:b,children:ze}):ze})});return(0,Z.jsxs)(`div`,{ref:Pe,role:`grid`,"aria-rowcount":M,onKeyDown:H?.onKeyDown,className:J(`flex flex-col rounded-lg border bg-background`,Ie?`min-h-0 overflow-hidden`:`overflow-clip`,C),style:x&&Ie?{height:T+M*E+(Le?D:0)+2}:void 0,children:[(0,Z.jsxs)(`div`,{className:J(`relative`,Ie&&`flex min-h-0 flex-1 flex-col`),children:[Ie?(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overflow-x-hidden`,children:[Re,Be]}):(0,Z.jsxs)(Z.Fragment,{children:[Re,Be]}),Ee.more&&(0,Z.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-y-0 right-0 z-20 w-8 bg-gradient-to-l from-backdrop/15 to-transparent`})]}),Le&&(0,Z.jsx)(zi,{total:M,className:Ie?void 0:`sticky bottom-[var(--pb-sticky-bottom,0px)] z-20`,selectedCount:xe,bulkActions:Ii(m??[],Object.keys(ie).flatMap(e=>Se.current.get(e)??[])).map(({action:e,rows:t,skipped:n})=>({label:e.label(t.length),destructive:e.destructive,onRun:()=>void Ce(e,t,n).then(e=>{if(!e)return;let t=new Set(e.map(e=>e.id));F(e=>Object.fromEntries(Object.entries(e).filter(([e])=>!t.has(e))));for(let e of t)Se.current.delete(e)})}))})]})},to=bt(`app/searches`),no=`inline-flex h-6 items-center rounded-full border border-primary-border bg-primary-soft px-2.5 text-xs font-medium text-primary-text`,ro=({chips:e,className:t})=>(0,Z.jsx)(`ul`,{className:J(`flex flex-wrap gap-1.5`,t),"aria-label":to(`filters`),children:e.map(e=>(0,Z.jsx)(`li`,{className:no,children:e.label},e.key))}),io=({chips:e})=>(0,Z.jsx)(`span`,{className:`flex flex-wrap gap-1.5`,children:e.map((e,t)=>(0,Z.jsxs)(`span`,{className:no,children:[t>0&&(0,Z.jsx)(`span`,{className:`sr-only`,children:`, `}),e.label]},e.key))}),ao=e=>e.map(e=>e.label).join(`, `),oo=bt(`filter-panel`),so=[`today`,`7d`,`30d`,`year`],co=new Set([`today`,`yesterday`,`24h`,`7d`,`30d`,`90d`,`month`,`quarter`,`year`]),lo=e=>co.has(e)?oo(e):void 0,uo={facets:{},toggles:[]},fo=(e,t,n)=>{let r=e.facets[t]??[],i=r.includes(n)?r.filter(e=>e!==n):[...r,n];return{...e,facets:{...e.facets,[t]:i}}},po=(e,t)=>({...e,toggles:e.toggles.includes(t)?e.toggles.filter(e=>e!==t):[...e.toggles,t]}),mo=(e,t,n)=>{let{[t]:r,...i}=e.ranges??{};return{...e,ranges:n?{...i,[t]:n}:i}},ho=(e,t)=>e.options.find(e=>e.value===t)?.label??e.labels?.[t]??t,go=(e,t)=>{let n=e.facets.flatMap(e=>(t.facets[e.id]??[]).map(t=>({key:`facet:${e.id}:${t}`,label:`${e.label}: ${ho(e,t)}`}))),r=(e.ranges??[]).flatMap(e=>{let n=t.ranges?.[e.id];return n?[{key:`range:${e.id}`,label:`${e.label}: ${e.format(n[0])} – ${e.format(n[1])}`}]:[]}),i=t.date?[{key:`date`,label:lo(t.date)??t.date}]:[],a=t.toggles.map(t=>({key:`toggle:${t}`,label:e.toggles?.find(e=>e.id===t)?.label??t}));return[...n,...r,...i,...a]},_o=(e,t)=>{if(t===`date`)return{...e,date:void 0};let[n,r,i]=t.split(`:`);if(n===`range`)return mo(e,r,void 0);if(n===`toggle`)return po(e,r);if(n===`facet`)return fo(e,r,i);throw Error(`Unknown filter chip key: ${t}`)},vo=(e,t)=>e.toLowerCase().includes(t.trim().toLowerCase()),Q=B(),yo={start:0,end:0},bo={"24h":{amount:24,unit:`h`},"7d":{amount:7,unit:`d`},"30d":{amount:30,unit:`d`},"90d":{amount:90,unit:`d`}},xo=e=>new Date(e).toISOString().replace(`.000Z`,`Z`),So=(e,t,n)=>{let r=zt(t.getTime(),n),[i,a]=[Number(r.slice(0,4)),Number(r.slice(5,7))-1],o=e=>new Date(e).toISOString().slice(0,10);return e===`year`?o(Date.UTC(i,0,1)):e===`quarter`?o(Date.UTC(i,Math.floor(a/3)*3,1)):e===`month`?o(Date.UTC(i,a,1)):e===`yesterday`?o(Date.parse(`${r}T00:00:00Z`)-864e5):r},Co=[`year`,`quarter`,`month`,`yesterday`,`today`],wo=(e,t,n)=>t===`date`?e:xo($e(e,n)),To=(e,t,n)=>t===`date`?{kind:`string`,value:wo(e,t,n),span:yo}:{kind:`timestamp`,value:wo(e,t,n),span:yo},Eo=(e,t,n,r,i)=>{if(t in bo)return[Q.gte(e,Q.ago(t))];let a=Q.gte(e,To(So(t,n,i),r,i));return t===`yesterday`?[a,Q.lt(e,To(So(`today`,n,i),r,i))]:[a]},Do=(e,t,n=new Date,r=Ot())=>{let i=e.facets.flatMap(e=>{let n=t.facets[e.id]??[];if(n.length===0)return[];if(e.flags){let t=e.options.filter(e=>n.includes(e.value)).map(e=>Q.eq(e.value,!0));return t.length===0?[]:[t.length===1?t[0]:Q.or(...t)]}return[n.length===1?Q.eq(e.id,n[0]):Q.in(e.id,n)]}),a=(e.ranges??[]).flatMap(e=>{let n=t.ranges?.[e.id];return n?[Q.gte(e.id,n[0]),Q.lte(e.id,n[1])]:[]}),o=e.dateField&&t.date?Eo(e.dateField,t.date,n,e.dateKind,r):[],s=(e.toggles??[]).filter(e=>t.toggles.includes(e.id)).map(e=>Q.eq(e.id,!0));return[...i,...a,...o,...s]},Oo=e=>e.length===0?``:Qe(Q.and(...e)),ko=(e,t,n=[],r=new Date,i=Ot())=>Oo([...Do(e,t,r,i),...n]),Ao=e=>e.kind===`and`?e.args.flatMap(Ao):[e],$=e=>e.field.path.join(`.`),jo=e=>e.kind===`compare`&&e.op===`=`&&e.value.kind===`boolean`&&e.value.value,Mo=(e,t)=>{let n=e.kind===`or`?e.args:[e];if(!n.every(jo))return;let r=n.map($),i=t.get(r[0]);return i!==void 0&&r.every(e=>t.get(e)===i)?{group:i,fields:r}:void 0},No=e=>e.kind===`number`?String(e.raw):e.kind===`string`?String(e.value):void 0,Po=(e,t,n)=>{let r=e.value;if(r.kind===`now`&&r.offset?.sign===`-`){let{amount:e,unit:t}=r.offset.duration;return Object.entries(bo).find(([,n])=>n.amount===e&&n.unit===t)?.[0]}if(r.kind===`timestamp`)return Co.find(e=>wo(So(e,t,n),`timestamp`,n)===r.value);if(r.kind===`string`)return Co.find(e=>So(e,t,n)===r.value)},Fo=(e,t,n=new Date,r=Ot())=>{let i=ut(t);if(!i.ok)return{ok:!1,errors:i.errors};let a={facets:{},toggles:[]},o=[],s=new Set(e.facets.filter(e=>!e.flags).map(e=>e.id)),c=new Map(e.facets.filter(e=>e.flags).flatMap(e=>e.options.map(t=>[t.value,e.id]))),l=new Set((e.toggles??[]).map(e=>e.id)),u=new Set((e.ranges??[]).map(e=>e.id)),d=new Map,f,p;for(let t of i.ast?Ao(i.ast):[]){let i=Mo(t,c);if(i&&!a.facets[i.group])a.facets[i.group]=i.fields;else if(t.kind===`compare`&&s.has($(t))&&t.op===`=`&&No(t.value)!==void 0)a.facets[$(t)]=[...a.facets[$(t)]??[],No(t.value)];else if(t.kind===`in`&&s.has($(t))&&t.values.every(e=>No(e)!==void 0))a.facets[$(t)]=[...a.facets[$(t)]??[],...t.values.map(e=>No(e))];else if(t.kind===`compare`&&e.dateField===$(t)&&t.op===`>=`&&Po(t,n,r)&&!a.date)a.date=Po(t,n,r),f=t;else if(t.kind===`compare`&&e.dateField===$(t)&&t.op===`<`&&(t.value.kind===`timestamp`||t.value.kind===`string`)&&t.value.value===wo(So(`today`,n,r),t.value.kind===`string`?`date`:`timestamp`,r))p=t;else if(t.kind===`compare`&&l.has($(t))&&t.op===`=`&&t.value.kind===`boolean`&&t.value.value)a.toggles.push($(t));else if(t.kind===`compare`&&u.has($(t))&&(t.op===`>=`||t.op===`<=`)&&t.value.kind===`number`){let e=d.get($(t))??{clauses:[]};t.op===`>=`?e.low=t.value.value:e.high=t.value.value,e.clauses.push(t),d.set($(t),e)}else o.push(t)}a.date===`yesterday`&&!p&&(o.push(f),a.date=void 0),p&&a.date!==`yesterday`&&o.push(p);for(let[e,t]of d)t.low!==void 0&&t.high!==void 0?a.ranges={...a.ranges,[e]:[t.low,t.high]}:o.push(...t.clauses);return{ok:!0,state:a,extras:o}},Io=[`integer`,`bigint`,`decimal`],Lo=(e,t)=>{let n=e?.fields[t]?.type;return n!==void 0&&Io.includes(n)},Ro=(e,t)=>e.kind===`range`||e.kind===`facets`&&Lo(t,e.field),zo=e=>e.secondary?{secondary:!0}:{},Bo=e=>({id:e.field,label:e.field,min:0,max:0,step:1,histogram:[],format:String,...zo(e)}),Vo=(e,t)=>{let n=e?.filters??[],r=n.find(e=>e.kind===`dateRange`);return{facets:n.flatMap(e=>e.kind===`facets`&&!Ro(e,t)?[{id:e.field,label:e.field,options:[],searchable:e.search,...t?.fields[e.field]?.type===`relation`&&{combobox:!0},...zo(e)}]:e.kind===`flags`?[{id:e.fields.join(`|`),label:e.label,options:e.fields.map(e=>({value:e,label:e,count:0})),flags:!0,...zo(e)}]:[]),ranges:n.flatMap(e=>e.kind!==`flags`&&Ro(e,t)?[Bo(e)]:[]),...r&&{dateField:r.field,...r.secondary&&{dateSecondary:!0},dateKind:t?.fields[r.field]?.type===`date`?`date`:`timestamp`,...r.presets.length>0&&{datePresets:r.presets}},toggles:n.flatMap(e=>e.kind===`toggle`?[{id:e.field,label:e.field,...zo(e)}]:[])}},Ho=(e,t)=>(e?.filters??[]).some(e=>e.kind===`range`&&e.field===t&&e.histogram),Uo=(e,t)=>{let n=e?.fields[t],r=n?.suffix??``,i=n?.currency;return i===void 0?e=>`${n?.prefix??``}${e}${r}`:e=>`${k(e*100,i).replace(`.00`,``)}${r}`},Wo=B(),Go={start:0,end:0},Ko=(e,t,n)=>{let r=Fo(Vo(t,e),n);return r.ok?Object.fromEntries(Object.entries(r.state.facets).filter(([t,n])=>e.fields[t]?.type===`relation`&&n.length>0)):{}},qo=(e,t,n)=>{let r=e=>t?.fields[e]?.label??q(e),i=Vo(t,e);return{...i,facets:i.facets.map(i=>{if(i.flags)return{...i,options:i.options.map(e=>({...e,label:r(e.value)}))};let a=e.fields[i.id]?.enumValues??[],o=e.fields[i.id]?.type===`enum`?Object.fromEntries(a.map(e=>[e,At(e,t?.fields[i.id]?.valueLabels)])):n[i.id]??{};return{...i,label:r(i.id),labels:o}}),ranges:(i.ranges??[]).map(e=>({...e,label:r(e.id),format:Uo(t,e.id)})),toggles:i.toggles?.map(e=>({...e,label:r(e.id)}))}},Jo=(e,t,n,r={})=>{let i=qo(e,t,r),a=Fo(i,n);if(!a.ok)return[{key:`unreadable`,label:to(`unreadableFilter`)}];let o=a.extras.map((e,t)=>({key:`extra:${t}`,label:e.kind===`search`?`"${e.text}"`:Qe(e)}));return[...go(i,a.state),...o]},Yo=e=>Object.fromEntries(e.facets.filter(e=>!e.flags).map(e=>[e.id,{...e.labels,...Object.fromEntries(e.options.map(e=>[e.value,e.label]))}])),Xo=(e,t,n)=>{if(typeof n!=`string`||n===``)return e;let r=Wo.gt(t,{kind:`timestamp`,value:new Date(n).toISOString(),span:Go}),i=ut(e);if(!i.ok)throw Error(`The saved filter cannot be read: ${i.errors.map(e=>e.message).join(`; `)}`);return Qe(i.ast?Wo.and(i.ast,r):r)},Zo=(e,t)=>typeof t!=`string`||t===``?!0:typeof e!=`string`||e===``?!1:new Date(e).getTime()>new Date(t).getTime(),Qo=(e,t)=>{let n=vt(),r=tn(),{resources:i,views:a}=Y(),o=a[e.name],s=Object.entries(Ko(e,o,t)),c=an({queries:s.map(([t,o])=>{let s=i[e.fields[t].relation.resource];return{queryKey:Rt.labels(`chips:${e.name}.${t}`,o.join(`,`)),enabled:s!==void 0,queryFn:async()=>Object.fromEntries(await ze(r,n,s,o,a[s.name]))}})});return Jo(e,o,t,Object.fromEntries(s.flatMap(([e],t)=>c[t]?.data?[[e,c[t].data]]:[])))},$o=({target:e,id:t})=>(0,Z.jsx)(Z.Fragment,{children:s(e,t)??t}),es=B(),ts=e=>{if(typeof e==`string`||typeof e==`number`)return e;if(e&&typeof e==`object`&&`id`in e)return ts(e.id)},ns=(e,t,n)=>n.flatMap(n=>{let r=ts(n[t]);return r===void 0?[]:[{key:Ht(y(e,n)),target:r}]}),rs=(e,t)=>e.find(e=>Ht(e.target)===t),is=(e,t)=>[...e,{key:``,target:t}],as=(e,t)=>e.filter(e=>Ht(e.target)!==t),os=(e,t)=>{let[n]=e.primaryKey;if(e.primaryKey.length!==1||n===void 0)throw Error(`${e.name} has a composite key, so its saved records cannot be listed`);let r=[...new Set(t.map(e=>e.target))];return r.length===0?void 0:es.in(n,r)},ss=(e,t)=>Rt.list(e,``,``,500,`saved:${t}`),cs=(e,t,n)=>{let r=vt(),i=Y().resources[e];return rn({queryKey:ss(e,t),enabled:n&&i!==void 0,queryFn:async()=>{let n=[],a;do{let o=await r.list(e,{pageSize:500,fields:[...i.primaryKey,t],...a&&{pageToken:a}});n.push(...o.items),a=o.nextPageToken||void 0}while(a);return ns(i,t,n)}})},ls=bt(`app/saved`),us=e=>e instanceof Error?e.message:ls(`somethingWrong`),ds=(e,t,n)=>{let r=Y(),i=vt(),a=tn(),o=Xt(),s=Yt(),{resource:c,field:l}=e,u=r.permissions[c],d=r.resources[c]!==void 0&&u!==void 0&&gt(u,`create`)&&gt(u,`delete`),f=r.signIn?.[c]?.signIn,p=cs(c,l,d),m=p.data&&rs(p.data,t),h=ss(c,l),g=nn({mutationFn:async e=>{e?await i.remove(c,e.key):await i.create(c,{[l]:n})},onMutate:async e=>{await a.cancelQueries({queryKey:h,exact:!0});let r=a.getQueryData(h);return a.setQueryData(h,(r=[])=>e?as(r,t):is(r,n)),{before:r}},onError:(e,t,n)=>{a.setQueryData(h,n?.before),o.show({state:`error`,title:ls(t?`couldNotTakeOff`:`couldNotSave`),description:us(e)})},onSettled:()=>s(c)});return{mode:d?`save`:f?`sign-in`:void 0,prompt:f,saved:m!==void 0,ready:p.data!==void 0&&!g.isPending,toggle:()=>g.mutate(m)}},fs=({favorite:e,recordKey:t,target:n,className:r})=>{let i=ds(e,t,n),[a,o]=(0,X.useState)(!1);if(!i.mode)return null;let s=e.label??ls(`favorite`),c=J(`absolute right-2 top-2 flex size-8 items-center justify-center rounded-full bg-background/85 text-foreground shadow-sm transition-colors hover:bg-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30`,r);return i.mode===`sign-in`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":s,"aria-haspopup":`dialog`,className:c,onClick:()=>o(!0),children:(0,Z.jsx)(_t,{className:`size-4`,"aria-hidden":!0})}),(0,Z.jsx)(j,{as:`dialog`,prompt:i.prompt,open:a,onClose:()=>o(!1)})]}):(0,Z.jsx)(`button`,{type:`button`,"aria-label":s,"aria-pressed":i.saved,"aria-disabled":!i.ready,className:c,onClick:()=>i.ready&&i.toggle(),children:(0,Z.jsx)(_t,{className:J(`size-4`,i.saved&&`fill-current text-danger`),"aria-hidden":!0})})},ps=6,ms=(e,t,n)=>{let r=e.bottom+ps;return{top:r+t.height>n.height-ps?Math.max(ps,e.top-ps-t.height):r,left:Math.max(ps,Math.min(e.left,n.width-ps-t.width))}},hs=(e,t)=>{let n=Be(e).find(e=>e.kind===`cards`);if(!n)return{kind:`cards`,name:`dot`,badge:t};let{photos:r,favorite:i,dots:a,...o}=n;return o},gs=(e,t,n,r)=>(e?.list?.relatedColumns??[]).filter(e=>r.includes(e.name)).flatMap(e=>{let r=t[e.resource];return r?[{column:e,fields:wt(r,n[r.name],hs(n[r.name],e.status))}]:[]}),_s=bt(`app/related-dots`),vs=(e,{values:t,label:n,singular:r,plural:i})=>{if(e.length===0)return _s(`none`,{plural:i});let a=new Map;for(let t of e)t!=null&&a.set(String(t),(a.get(String(t))??0)+1);let o=[...t,...[...a.keys()].filter(e=>!t.includes(e))].filter(e=>a.has(e)).map(e=>`${a.get(e)} ${n(e)}`),s=`${e.length} ${e.length===1?r:i}`;return o.length===0?s:`${s}: ${o.join(`, `)}`},ys=`flex shrink-0 items-center justify-center rounded-full p-0.5 pointer-coarse:p-1.5`,bs=`size-2.5 rounded-full`,xs=`flex min-w-0 items-center gap-0.5`,Ss=150,Cs=288,ws=({shown:e,row:t,target:n,view:r,column:i,Card:a,onEnter:o,onLeave:s})=>{let c=(0,X.useRef)(null),[l,u]=(0,X.useState)();return(0,X.useLayoutEffect)(()=>{c.current&&u(ms(e.dot,{width:Cs,height:c.current.offsetHeight},{width:window.innerWidth,height:window.innerHeight}))},[e]),(0,Jn.createPortal)((0,Z.jsx)(`div`,{ref:c,"data-dot-card":!0,onMouseEnter:o,onMouseLeave:s,style:{width:Cs,...l??{visibility:`hidden`,top:0,left:0}},className:`fixed z-50 rounded-lg shadow-pop`,children:(0,Z.jsx)(a,{model:n,view:r,display:hs(r,i.status),row:t})}),document.body)},Ts=({column:e,records:t,target:n,view:r,wrap:i=!1,Card:a})=>{let o=(0,X.useMemo)(()=>t.map(e=>H(n,e)),[t,n]),[s,c]=(0,X.useState)(),l=(0,X.useRef)(void 0),u=(0,X.useRef)(`mouse`),d=(0,X.useRef)(null),p=n.fields[e.status],m=r?.fields[e.status],h=t=>p?qe(p,t.record[e.status],m):``,g=tt(n,r),_=e=>e.labels[g]??String(e.record[g]??e.key),v=(r?.names?.singular??q(n.name)).toLowerCase(),y=(r?.names?.plural??q(n.name)).toLowerCase(),b=vs(o.map(t=>t.record[e.status]),{values:p?.enumValues??[],label:e=>p?qe(p,e,m):e,singular:v,plural:y}),x=()=>window.clearTimeout(l.current),S=()=>{x(),l.current=window.setTimeout(()=>c(void 0),Ss)},C=(e,t)=>{x(),c({key:e,dot:t.getBoundingClientRect()})};(0,X.useEffect)(()=>x,[]),(0,X.useEffect)(()=>{if(!s)return;let e=()=>c(void 0),t=t=>t.key===`Escape`&&e(),n=t=>{let n=t.target;!d.current?.contains(n)&&!n?.closest?.(`[data-dot-card]`)&&e()};return document.addEventListener(`keydown`,t),document.addEventListener(`pointerdown`,n),document.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,e),()=>{document.removeEventListener(`keydown`,t),document.removeEventListener(`pointerdown`,n),document.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,e)}},[s]);let w=e=>t=>{u.current===`touch`&&s?.key!==e&&(t.preventDefault(),C(e,t.currentTarget))},T=e=>{e.relatedTarget?.closest?.(`[data-dot-card]`)||S()},E=s&&o.find(e=>e.key===s.key);return(0,Z.jsxs)(`div`,{ref:d,className:J(xs,i&&`pointer-events-none flex-wrap`),onClick:e=>e.stopPropagation(),onPointerDown:e=>u.current=e.pointerType,children:[(0,Z.jsx)(`span`,{className:`sr-only`,children:b}),o.map(t=>{let r=t.record[e.status],i=f(m?.valueColors,r);return(0,Z.jsx)(De,{to:{kind:`record`,resource:n.name,key:t.key},"aria-label":`${_(t)}, ${h(t)}`,onPointerEnter:e=>e.pointerType!==`touch`&&C(t.key,e.currentTarget),onPointerLeave:e=>e.pointerType!==`touch`&&S(),onFocus:e=>e.currentTarget.matches(`:focus-visible`)&&C(t.key,e.currentTarget),onBlur:T,onClick:w(t.key),className:J(ys,`pointer-events-auto focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40`),children:(0,Z.jsx)(`span`,{"aria-hidden":!0,style:i===void 0?void 0:{backgroundColor:i},className:J(bs,i===void 0&&Ft[Gt(m?.valueColors,r)],s?.key===t.key&&`ring-2 ring-foreground/30`)})},t.key)}),s&&E&&(0,Z.jsx)(ws,{shown:s,row:E,target:n,view:r,column:e,Card:a,onEnter:x,onLeave:S})]})},Es=({count:e})=>(0,Z.jsx)(`span`,{"aria-hidden":!0,className:J(xs,`invisible flex-wrap`),children:Array.from({length:e},(e,t)=>(0,Z.jsx)(`span`,{className:ys,children:(0,Z.jsx)(`span`,{className:bs})},t))}),Ds=`flex flex-col gap-1.5`,Os=({dots:e})=>(0,Z.jsx)(`span`,{className:Ds,children:e.map(({column:e,records:t})=>(0,Z.jsx)(Es,{count:t.length},e.name))}),ks=({dots:e,Card:t})=>{let{resources:n,views:r}=Y();return(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-[calc(0.75rem+1px)] bottom-[calc(0.75rem+1px)] ${Ds}`,children:e.map(({column:e,records:i})=>{let a=n[e.resource];return a&&(0,Z.jsx)(Ts,{column:e,records:i,target:a,view:r[a.name],Card:t,wrap:!0},e.name)})})},As=(e,t,n)=>(t.dots??[]).flatMap(t=>{let r=e?.list?.relatedColumns?.find(e=>e.name===t),i=n.record[t];return r&&Array.isArray(i)&&i.length>0?[{column:r,records:i}]:[]}),js=({value:e})=>{let t=R(e,{width:320,height:240});return t?(0,Z.jsx)(F,{image:t,loading:`lazy`,className:`size-full object-cover`}):null},Ms=({children:e})=>(0,Z.jsx)(`span`,{className:`-mx-3 -mt-3 mb-1.5 block aspect-[4/3] overflow-hidden rounded-t-lg border-b border-border bg-muted`,children:e}),Ns=({value:e})=>(0,Z.jsx)(Ms,{children:(0,Z.jsx)(js,{value:e})}),Ps=10,Fs=(e,t)=>{let n=pt(e)?e.uri:void 0,r=t.filter(e=>pt(e)&&e.uri!==n);return(n===void 0?r:[e,...r]).slice(0,Ps)},Is=({photos:e,cover:t,swipe:n=!0,children:r})=>{let i=Fs(t,e),a=re(i.length),o=(0,Z.jsx)(Ms,{children:(0,Z.jsx)(jt,{"data-card-photos":!0,carousel:a,swipe:n,slides:i.map(e=>(0,Z.jsx)(js,{value:e}))})});return(0,Z.jsxs)(Z.Fragment,{children:[r(o),(0,Z.jsx)(te,{carousel:a,count:i.length,swipe:n,reveal:`group-has-[[data-card-photos]:hover]/card:opacity-100`,className:`inset-x-px top-px aspect-[4/3]`})]})},Ls=({icon:e,children:t})=>{let n=he(e);return(0,Z.jsxs)(`dd`,{className:`flex items-center gap-1 tabular-nums`,children:[n&&(0,Z.jsx)(n,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t]})},Rs=({model:e,view:t,display:n,row:r,swipe:i=!0,mark:o})=>{let{image:s,title:c,subtitle:l,amount:u,badge:d,code:f,meta:p,footer:m,flags:_}=Mt(e,t,n),v=e=>t?.fields[e]?.label??q(e),{resources:x,views:S}=Y(),C=n=>{let i=e.fields[n];if(!i)return``;let a=r.record[n],o=i.type===`relation`&&i.relation?x[i.relation.resource]:void 0;return o&&S[o.name]?.titleFrom&&a!=null?(0,Z.jsx)($o,{target:o,id:String(a)}):r.labels[n]===void 0&&b(i,t?.fields[n])&&typeof a==`string`&&a!==``?h(a):i.type===`json`&&a!=null?ge(a):t?.fields[n]?.format===`url`&&typeof a==`string`&&a!==``?Jt(e,t,n,r.record)??a:r.labels[n]??qe(i,a,t?.fields[n])},{fields:w,components:T}=O(),E=gn(e),D=n.card===void 0?void 0:T?.[n.card],k=n=>{let i=e.fields[n],a=i&&ee(w,i,t?.fields[n]);return a?(0,Z.jsx)(le,{shown:a,part:`display`,field:i,value:r.record[n],fallback:C(n)}):C(n)},A=n=>{let i=e.fields[n],a=r.record[n];return!i||!b(i,t?.fields[n])||ee(w,i,t?.fields[n])||typeof a!=`string`||a===``?k(n):(0,Z.jsx)(g,{source:a,inLink:!0})},j=n=>{let i=e.fields[n],a=t?.fields[n],o=r.record[n];return!i||a?.format!==`badge`||ee(w,i,a)||o==null||o===``?k(n):(0,Z.jsx)(se,{value:o,hints:a,children:C(n)})},te=n=>{let i=e.fields[n];if(!i)return;if(r.labels[n]!==void 0||ee(w,i,t?.fields[n]))return(0,Z.jsx)(`strong`,{className:`font-semibold text-foreground`,children:k(n)});let a=ae(i,r.record[n],t?.fields[n]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`strong`,{className:`font-semibold text-foreground`,children:a.amount}),a.suffix]})},N=D?void 0:n.photos,ne=d===void 0?void 0:r.record[d],re=_.filter(e=>r.record[e]===!0),P=s===void 0?void 0:r.record[s],ie=fe(r,u),F=a(r,f),I=Ze(r,m),L=s!==void 0||N!==void 0,R=n.favorite,z=D?[]:As(t,n,r),oe=(t,n)=>(0,Z.jsx)(De,{to:{kind:`record`,resource:e.name,key:r.key},onClick:()=>E(r.record),"data-card-link":!0,className:`${t} after:absolute after:inset-0 after:rounded-lg after:content-[''] focus-visible:outline-hidden`,children:n}),ce=(n,i)=>(0,Z.jsxs)(Z.Fragment,{children:[L&&n,(0,Z.jsxs)(`span`,{className:`flex items-start justify-between gap-2 ${R&&!L?`pr-8`:``}`,children:[i?oe(`min-w-0 truncate font-medium`,k(c)):(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:k(c)}),d!==void 0&&ne!=null&&(0,Z.jsx)(se,{value:ne,hints:t?.fields[d],children:C(d)})]}),l!==void 0&&(0,Z.jsx)(`span`,{className:t?.fields[l]?.markdown?`line-clamp-3 break-words text-muted-foreground`:t?.fields[l]?.multiline?`line-clamp-3 whitespace-pre-line break-words text-muted-foreground`:`truncate text-muted-foreground`,children:A(l)}),ie!==void 0&&(0,Z.jsx)(`span`,{className:`truncate tabular-nums text-muted-foreground`,children:te(ie)}),F!==void 0&&(0,Z.jsx)(Ee,{children:ct(e.fields[F],r.record[F])??C(F)}),p.length>0&&(0,Z.jsx)(`dl`,{className:`mt-auto flex flex-wrap items-center gap-x-3 gap-y-0.5 pt-1 text-xs text-muted-foreground`,children:Ze(r,p).map(e=>(0,Z.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Z.jsx)(`dt`,{className:`sr-only`,children:v(e)}),(0,Z.jsx)(Ls,{icon:t?.fields[e]?.icon,children:j(e)})]},e))}),re.length>0&&(0,Z.jsx)(`ul`,{className:`flex flex-wrap gap-1`,"aria-label":K(`features`),children:re.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(xt,{dot:!1,children:v(e)})},e))}),I.length>0&&(0,Z.jsx)(`span`,{className:`truncate text-xs text-muted-foreground ${p.length>0?``:`mt-auto`}`,children:I.map((e,t)=>(0,Z.jsxs)(`span`,{children:[t>0&&(0,Z.jsx)(`span`,{"aria-hidden":!0,children:` • `}),k(e)]},e))}),z.length>0&&(0,Z.jsx)(Os,{dots:z})]}),ue=e=>(0,Z.jsxs)(`div`,{className:`relative isolate flex h-full flex-col gap-1.5 rounded-lg border border-border bg-background p-3 hover:border-border-strong hover:bg-surface has-[[data-card-link]:focus-visible]:ring-2 has-[[data-card-link]:focus-visible]:ring-primary/30`,children:[o&&!L&&(0,Z.jsx)(xt,{tone:`blue`,className:`self-start`,children:o}),D?(0,Z.jsxs)(Z.Fragment,{children:[oe(`absolute inset-0`,(0,Z.jsx)(`span`,{className:`sr-only`,children:k(c)})),(0,Z.jsx)(M,{name:n.card,fallback:ce(e,!1),children:(0,Z.jsx)(D,{row:r})})]}):ce(e,!0)]});return(0,Z.jsxs)(`div`,{className:N?`group/card relative h-full`:R||o||z.length>0?`relative h-full`:`h-full`,children:[N?(0,Z.jsx)(Is,{photos:r.photos??[],cover:P,swipe:i,children:t=>ue((0,Z.jsx)(De,{to:{kind:`record`,resource:e.name,key:r.key},onClick:()=>E(r.record),tabIndex:-1,"aria-hidden":!0,className:`relative z-[1] block`,children:t}))},r.key):ue((0,Z.jsx)(Ns,{value:P})),o&&L&&(0,Z.jsx)(xt,{tone:`blue`,className:`pointer-events-none absolute top-2 left-2 shadow-sm`,children:o}),z.length>0&&(0,Z.jsx)(ks,{dots:z,Card:Rs}),R&&(0,Z.jsx)(fs,{favorite:R,recordKey:r.key,target:y(e,r.record),className:L?void 0:`right-1.5 top-1.5`})]})},zs=12,Bs=3,Vs=(e,t,n)=>{let r=Math.max(1,Math.min(256,t))+zs,i=Math.floor(Math.max(0,e)/r),a=Math.ceil((Math.max(0,e)+t)/r);return{start:Math.max(0,i-Bs),end:Math.min(n,a+Bs)}},Hs=50,Us=(e,t,n)=>({from:Math.max(0,e-Hs),to:Math.min(n,t+Hs)}),Ws=e=>`calc(${e} * (min(256px, 100%) + ${ui}) - ${ui})`,Gs=bt(`app/record-row`),Ks=({count:e})=>(0,Z.jsx)(`li`,{"aria-hidden":!0,style:{width:Ws(e),minWidth:0,scrollSnapAlign:`none`}}),qs=({model:e,view:t,display:n,source:r,label:i,isNew:a})=>{let{total:o}=r,s=e=>Vs(e.left,e.width,o),c=_i(e=>{let{start:t,end:n}=s(e);return`${t}-${n}`}),{start:l,end:u}=s(c.view),d=Us(l,u,o),f=mn({total:o,rowAt:r.rowAt,loadRows:r.loadRows,cachedRows:r.cachedRows,revision:r.revision,latencyMs:0},l,Math.max(l,u-1));return(0,Z.jsxs)(mi,{scroll:c,label:i,children:[d.from>0&&(0,Z.jsx)(Ks,{count:d.from}),Array.from({length:d.to-d.from},(r,i)=>{let s=d.from+i;if(s<l||s>=u)return(0,Z.jsx)(`li`,{"aria-hidden":!0},`place-${s}`);let c=f(s);if(!c)return(0,Z.jsx)(`li`,{"aria-hidden":!0,children:(0,Z.jsx)(G,{className:`h-full min-h-24 rounded-lg`})},`skeleton-${s}`);let p=H(e,c);return(0,Z.jsx)(`li`,{"aria-posinset":s+1,"aria-setsize":o,className:`grid grid-cols-[minmax(0,1fr)]`,children:(0,Z.jsx)(Rs,{model:e,view:t,display:n,row:p,swipe:!1,mark:a?.(p)?Gs(`new`):void 0})},p.key)}),d.to<o&&(0,Z.jsx)(Ks,{count:o-d.to})]})},Js=B(),Ys=(e,t)=>{if(!t)return e;let n=ut(e);if(!n.ok)throw Error(`The filter cannot be read: ${n.errors.map(e=>e.message).join(`; `)}`);return Qe(n.ast?Js.and(n.ast,t):t)},Xs=(e,t,{filter:n,sort:r,scope:i})=>({columns:yt(e,t,[]),filter:Ys(n,i),orderBy:r||V(e,t)}),Zs=(e,t)=>{let n=Be(e).filter(e=>e.kind===`cards`);return n.find(e=>e.name===t)??n[0]??{kind:`cards`,name:`cards`}},Qs=()=>(0,Z.jsx)(`div`,{className:`flex gap-3 overflow-hidden`,children:Array.from({length:3},(e,t)=>(0,Z.jsx)(G,{className:`h-24 w-64 shrink-0`},t))}),$s=({model:e,view:t,filter:n,sort:r=``,display:i,limit:a,chips:o=!0,empty:s,note:c,isNew:l,viewAll:u,scope:d,list:f})=>{let{resources:p,views:m}=Y(),h=w(),g=Zs(t,i),_=(0,X.useMemo)(()=>Xs(e,t,{filter:n,sort:r,scope:d}),[e,t,n,r,d]),{orderBy:v}=_,y=hn({resources:p,views:m,model:e,..._}),b=Qo(e,n),x=(t?.names?.singular??q(e.name)).toLowerCase(),S=t?.names?.plural??q(e.name),C=y.source?.total,T=(0,X.useMemo)(()=>y.source&&{...y.source,total:Math.min(y.source.total,a??1/0)},[y.source,a]);return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[o&&b.length>0||C!==void 0||c?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[o&&b.length>0?(0,Z.jsx)(ro,{chips:b}):(0,Z.jsx)(`span`,{}),(0,Z.jsxs)(`p`,{className:`flex flex-wrap gap-x-3 text-muted-foreground`,children:[c&&(0,Z.jsx)(`span`,{children:c}),C!==void 0&&(0,Z.jsx)(`span`,{className:`tabular-nums`,children:`${C.toLocaleString(W())} ${C===1?x:S.toLowerCase()}`})]})]}):null,y.isLoading?(0,Z.jsx)(Qs,{}):y.error?(0,Z.jsx)(Ut,{title:Gs(`couldNotLoad`),error:y.error}):!T||T.total===0?(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:s??Gs(`noneMatch`,{plural:S.toLowerCase()})}):(0,Z.jsx)(qs,{model:e,view:t,display:g,source:T,label:S,isNew:l}),(0,Z.jsxs)(De,{to:Ti(e,t,h,{filter:n,orderBy:v,display:g.name,savedSearch:u?.savedSearch,resource:f}),onClick:u?.onOpen,className:`flex items-center gap-1 self-end font-medium text-primary-text hover:underline`,children:[u?.label??(0,Z.jsxs)(Z.Fragment,{children:[Gs(`viewAll`),` `,(0,Z.jsx)(`span`,{className:`sr-only`,children:S.toLowerCase()})]}),(0,Z.jsx)(jn,{className:`size-3.5`,"aria-hidden":!0})]})]})},ec=e=>Rt.list(e,``,``,500,`saved-searches`),tc=(e,t)=>{let n=vt(),{resources:r,views:i}=Y(),a=r[e];return rn({queryKey:ec(e),enabled:t&&a!==void 0,queryFn:async()=>{let t=[],r;do{let o=await n.list(e,{pageSize:500,orderBy:V(a,i[e]),...r&&{pageToken:r}});t.push(...o.items),r=o.nextPageToken||void 0}while(r);return t}})},nc=({model:e,of:t,target:n,targetView:r,row:i,recordKey:a})=>{let o=vt(),s=Yt(),c=String(i[t.filter]??``),l=Qo(n,c),u=t.name===void 0?void 0:i[t.name],d=typeof u==`string`&&u!==``?u:void 0,f=t.unseen,p=nn({mutationFn:t=>o.update(e.name,a,{[f.seenAt]:t},i.etag??`*`),onSettled:()=>s(e.name)}),m=rn({...Xe(o,n,f?Xo(c,f.field,i[f.seenAt]):``),enabled:f!==void 0}),h=(r?.names?.plural??q(n.name)).toLowerCase(),g={model:n,view:r,filter:c,sort:f?`${f.field} desc`:void 0,limit:t.limit,chips:d!==void 0,empty:to(`noneMatch`,{plural:h}),note:f&&m.data===0&&to(`noNew`,{plural:h}),isNew:f&&(e=>Zo(e.record[f.field],i[f.seenAt])),viewAll:{label:to(`viewAll`),savedSearch:a,...f&&{onOpen:()=>p.mutate(new Date().toISOString())}}};return{name:d,chips:l,title:d??ao(l),body:g}},rc=({list:e,empty:t,loading:n,children:r})=>(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:e.loading?n:e.error?(0,Z.jsx)(Ut,{title:K(`couldNotLoadRows`),error:e.error}):e.rows.length===0?(0,Z.jsx)(`p`,{className:`py-8 text-center text-muted-foreground`,children:t}):r}),ic=({list:e})=>(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-3 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[e.rows.length.toLocaleString(W()),` of `,e.total.toLocaleString(W())]}),e.more&&(0,Z.jsx)(et,{size:`sm`,onClick:e.loadMore,children:K(`showMore`)})]}),ac=`grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-3`,oc=`relative flex snap-x snap-mandatory gap-3 overflow-x-auto pb-1`,sc=({model:e,view:t,display:n,list:r,row:i=!1,footer:a=!0})=>{let o=(t?.names?.plural??q(e.name)).toLowerCase();return(0,Z.jsxs)(rc,{list:r,empty:K(`noneMatch`,{plural:o}),loading:(0,Z.jsx)(`div`,{className:ac,children:Array.from({length:6},(e,t)=>(0,Z.jsx)(G,{className:`h-24`},t))}),children:[(0,Z.jsx)(`ul`,{className:i?oc:ac,"aria-label":t?.names?.plural??q(e.name),children:r.rows.map(r=>(0,Z.jsx)(`li`,{className:J(i&&`w-64 shrink-0 snap-start`),children:(0,Z.jsx)(Rs,{model:e,view:t,display:n,row:r,swipe:!i})},r.key))}),a&&(0,Z.jsx)(ic,{list:r})]})},cc=({display:e,list:t})=>{let{components:n}=O(),r=n?.[e.component];return r?(0,Z.jsx)(Nt,{value:t,children:(0,Z.jsx)(`div`,{className:`relative min-w-0 flex-1 overflow-x-auto`,children:(0,Z.jsx)(M,{name:e.component,children:(0,Z.jsx)(r,{...A(e.props??{})})})})}):(0,Z.jsx)(Me,{children:K.rich(`noComponent`,{component:e.component})})},lc=B(),uc={bounds:{south:-90,west:-180,north:90,east:180},zoom:0},dc=22,fc=e=>Math.floor(e*1e6)/1e6,pc=e=>Math.ceil(e*1e6)/1e6,mc=e=>((e+180)%360+360)%360-180,hc=(e,t)=>{let n=[lc.gte(e.latitude,fc(Math.max(t.south,-90))),lc.lte(e.latitude,pc(Math.min(t.north,90)))];if(t.east-t.west>=360)return lc.and(...n);let r=lc.gte(e.longitude,fc(mc(t.west))),i=lc.lte(e.longitude,pc(mc(t.east)));return mc(t.west)<=mc(t.east)?lc.and(...n,r,i):lc.and(...n,lc.or(r,i))},gc=(e,t,n)=>{let r=Qe(hc(t,n));return e.trim()===``?r:`(${e}) AND ${r}`},_c=e=>Math.min(Math.max(Math.floor(e),0),dc),vc=(e,t)=>{let n=[...e.map(e=>({south:e.latitude,west:e.longitude,north:e.latitude,east:e.longitude})),...t.map(e=>e.bounds)];if(n.length!==0)return{south:Math.min(...n.map(e=>e.south)),west:Math.min(...n.map(e=>e.west)),north:Math.max(...n.map(e=>e.north)),east:Math.max(...n.map(e=>e.east))}},yc=e=>{if(typeof e==`number`)return e;if(typeof e==`string`&&e.trim()!==``)return Number(e)},bc=(e,t)=>{let n=yc(e[t.latitude]),r=yc(e[t.longitude]);if(n!==void 0&&r!==void 0&&Math.abs(n)<=90&&Math.abs(r)<=180)return{latitude:n,longitude:r}},xc=6371008.8,Sc=64,Cc=(e,t)=>t.approximate===void 0?t.exact!==void 0&&e[t.exact]===!1:e[t.approximate]===!0,wc=(e,t)=>{let n=t/xc,r=e.latitude*Math.PI/180,i=e.longitude*Math.PI/180;return{type:`Polygon`,coordinates:[Array.from({length:65},(e,t)=>{let a=t%Sc/Sc*2*Math.PI,o=Math.asin(Math.sin(r)*Math.cos(n)+Math.cos(r)*Math.sin(n)*Math.cos(a));return[(i+Math.atan2(Math.sin(a)*Math.sin(n)*Math.cos(r),Math.cos(n)-Math.sin(r)*Math.sin(o)))*180/Math.PI,o*180/Math.PI]})]}},Tc=e=>Array.isArray(e)&&e.length>=2&&typeof e[0]==`number`&&typeof e[1]==`number`&&Math.abs(e[0])<=180&&Math.abs(e[1])<=90,Ec=(e,t)=>Array.isArray(e)&&e.length>=t&&e.every(Tc),Dc=e=>Array.isArray(e)&&e.length>0&&e.every(e=>Ec(e,4)),Oc=e=>Array.isArray(e)&&e.length>0&&e.every(e=>Ec(e,2)),kc=e=>{if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch(e){if(e instanceof SyntaxError)return;throw e}},Ac=e=>{let t=kc(e);if(typeof t!=`object`||!t)return;let n=t.type===`Feature`?t.geometry:t;if(typeof n!=`object`||!n)return;let{type:r,coordinates:i}=n;if(r===`Polygon`&&Dc(i)||r===`MultiPolygon`&&Array.isArray(i)&&i.length>0&&i.every(Dc)||r===`LineString`&&Ec(i,2)||r===`MultiLineString`&&Oc(i))return{type:r,coordinates:i}},jc=(e,t,n)=>{if(!Cc(e,t))return;let r=t.area===void 0?void 0:Ac(e[t.area]);if(r)return r;let i=t.radius===void 0?void 0:yc(e[t.radius]);return i!==void 0&&Number.isFinite(i)&&i>0?wc(n,i):t.defaultRadius===void 0?void 0:wc(n,t.defaultRadius)},Mc=(e,t)=>e.flatMap(e=>{let n=bc(e.record,t);if(!n)return[];if(!Cc(e.record,t))return[{key:e.key,...n}];let r=jc(e.record,t,n);return[{key:e.key,...n,approximate:!0,...r&&{area:r}}]}),Nc=(e,t)=>{let n=[];for(let r of e){let e=n.find(e=>Math.hypot(e.at.x-r.x,e.at.y-r.y)<=t);e?e.keys.push(r.key):n.push({at:r,keys:[r.key]})}return n.map(e=>({keys:e.keys,at:e.at.key}))},Pc=(e,t)=>{if(!e)return;let n=new Set(t.map(e=>e.key)),r=e.keys.filter(e=>n.has(e));if(r.length===0)return;let i=r.indexOf(e.keys[e.index]);return{keys:r,index:Math.max(i,0)}},Fc=(e,t)=>({keys:e.keys,index:((e.index+t)%e.keys.length+e.keys.length)%e.keys.length}),Ic=({model:e,view:t,display:n,fields:r,filter:a,orderBy:o,area:s})=>{let c=vt(),{resources:l,views:u}=Y(),d={latitude:n.latitude,longitude:n.longitude},f=s?gc(a,d,s.bounds):``,p=s?_c(s.zoom):0;return rn({queryKey:Rt.map(e.name,`${d.latitude},${d.longitude}`,p,f,o),enabled:s!==void 0,placeholderData:en,queryFn:async()=>{let n=await c.map(e.name,{...d,zoom:p,filter:f,orderBy:o,labels:de(l,u,e,r),photos:rt(t)});return{rows:i(l,e,r,Ue(e,n.items,n.photos),n.labels).map(t=>H(e,t)),buckets:n.buckets,total:n.totalSize}}})},Lc=(0,X.lazy)(()=>$t(()=>import(`./records-map-BZ9IztOw.js`).then(e=>({default:e.RecordsMap})),__vite__mapDeps([33,1,2,3,4,5,34,35,36,37,38,39]))),Rc=250,zc=`flex size-8 items-center justify-center rounded-full border border-border bg-background hover:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30`,Bc=({model:e,view:t,display:n,filter:r,orderBy:i,fields:a,at:o,onMove:s,footer:c=!0,flush:l=!1})=>{let u=Y().maps,d=u?.style,[f,p]=(0,X.useState)(),[m,h]=(0,X.useState)(),g=we(m,Rc),[_,v]=(0,X.useState)(o===void 0),y=Ic({model:e,view:t,display:n,fields:a,filter:r,orderBy:i,area:_?uc:g}),b=y.isPlaceholderData?void 0:y.data,x=y.data?.rows??[],S=y.data?.buckets??[],C=Mc(x,n),w=_&&b?vc(Mc(b.rows,n),b.buckets):void 0,T=Pt(t,n),E=(t?.names?.plural??q(e.name)).toLowerCase(),D=(t?.names?.singular??q(e.name)).toLowerCase(),O=Pc(f,x),k=O&&x.find(e=>e.key===O.keys[O.index]),A=new Set(C.filter(e=>e.approximate).map(e=>e.key)),ee=e=>{let t=e.filter(e=>A.has(e)).length;return e.length===1?K(t===1?`showOneApproximate`:`showOne`,{singular:D}):t===0?K(`showMany`,{count:e.length,plural:E}):t===e.length?K(`showManyApproximate`,{count:e.length,plural:E}):K(`showManySomeApproximate`,{count:e.length,plural:E,near:t})},j=e=>K(`zoomIn`,{count:e.toLocaleString(W()),noun:e===1?D:E}),te=(0,X.useRef)(null),[M,N]=(0,X.useState)(0);if((0,X.useLayoutEffect)(()=>N(te.current?.offsetHeight??0),[k?.key]),!d)return(0,Z.jsx)(Me,{children:K(`needsStyle`)});let ne=b?.total===0;return(0,Z.jsxs)(`div`,{className:J(`flex h-full min-h-[36rem] flex-1 flex-col sm:min-h-[28rem]`,l&&`max-md:-mx-5 max-md:-mb-4 max-md:min-h-0`),children:[(0,Z.jsxs)(`div`,{className:J(`relative min-h-0 flex-1 overflow-hidden rounded-lg border border-border bg-muted`,l&&`max-md:rounded-none max-md:border-0`),children:[(0,Z.jsx)(X.Suspense,{fallback:null,children:(0,Z.jsx)(Lc,{style:d,layers:u?.layers,initial:o,points:C,buckets:S,fit:w,onFitted:()=>v(!1),onMove:(e,t)=>{h(e),s?.(t)},selected:O?.keys,covered:O?M:0,onSelect:e=>p({keys:e,index:0}),onClear:()=>p(void 0),markerLabel:ee,bucketLabel:j})}),y.error&&(0,Z.jsx)(`div`,{className:`absolute inset-x-3 top-3 z-10`,children:(0,Z.jsx)(Ut,{title:K(`couldNotLoadRows`),error:y.error})}),ne&&(0,Z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-3 top-3 z-10 flex justify-center`,children:(0,Z.jsxs)(`p`,{className:`pointer-events-auto flex items-center gap-3 rounded-full border border-border bg-background px-4 py-1.5 text-muted-foreground shadow`,role:`status`,children:[K(_?`noneMatch`:`noneHere`,{plural:E}),!_&&(0,Z.jsx)(et,{size:`sm`,onClick:()=>v(!0),children:K(`showAll`)})]})}),O&&k&&(0,Z.jsx)(`div`,{ref:te,className:`pointer-events-none absolute inset-x-3 bottom-3 z-10 flex justify-center`,children:(0,Z.jsxs)(`div`,{className:`pointer-events-auto flex w-full max-w-[16rem] flex-col gap-2 sm:max-w-xs`,role:`group`,"aria-label":K(`chosen`,{singular:D}),children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[A.has(k.key)&&(0,Z.jsxs)(`span`,{className:`mr-auto flex items-center gap-1 rounded-full border border-border bg-background px-2 py-1 text-xs`,children:[(0,Z.jsx)(Ln,{className:`size-3.5`,"aria-hidden":!0}),K(`approximatePosition`)]}),O.keys.length>1&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":K(`previous`),className:zc,onClick:()=>p(Fc(O,-1)),children:(0,Z.jsx)(Zt,{className:`size-4`,"aria-hidden":!0})}),(0,Z.jsxs)(`span`,{className:`rounded-full border border-border bg-background px-2 py-1 text-xs tabular-nums`,"aria-live":`polite`,children:[O.index+1,` / `,O.keys.length]}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":K(`next`),className:zc,onClick:()=>p(Fc(O,1)),children:(0,Z.jsx)(me,{className:`size-4`,"aria-hidden":!0})})]}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":K(`close`),className:zc,onClick:()=>p(void 0),children:(0,Z.jsx)(nt,{className:`size-4`,"aria-hidden":!0})})]}),(0,Z.jsx)(`div`,{className:`shadow-lg`,children:(0,Z.jsx)(Rs,{model:e,view:t,display:T,row:k})})]})})]}),c&&(0,Z.jsx)(`p`,{className:`hidden py-3 text-xs text-muted-foreground md:block`,children:Vc(y.data,E)})]})},Vc=(e,t)=>{if(!e)return`\xA0`;let n=e.total.toLocaleString(W());return e.buckets.length===0&&e.rows.length<e.total?`${e.rows.length.toLocaleString(W())} of ${n} ${t} in view`:`${n} ${t} in view`},Hc=()=>(0,Z.jsx)(G,{className:`min-h-60 flex-1 rounded-lg`}),Uc=Qt(()=>$t(()=>import(`./board-display-CoJK20M9.js`).then(e=>e.BoardDisplay),__vite__mapDeps([40,1,2,3,4,5,41,42,43,44,45,46,47,48])),Hc),Wc=Qt(()=>$t(()=>import(`./calendar-display-iYqswJgc.js`).then(e=>e.CalendarDisplay),__vite__mapDeps([49,1,2,3,4,5,42,43,44,47,50,41,48])),Hc),Gc=Qt(()=>$t(()=>import(`./timeline-display-CFYOr7ER.js`).then(e=>e.TimelineDisplay),__vite__mapDeps([51,1,2,3,4,5,42,43,44,50,41,48])),Hc),Kc={table:qt,cards:cn,kanban:qn,board:zn,list:Un,calendar:T,timeline:Fn,map:Gn},qc=({view:e,value:t,onChange:n,menu:r=!1,choices:i=Ie(e)})=>{if(i.length<2)return null;let a=i.map(e=>({value:e.name,label:e.label,icon:e.icon===void 0?void 0:Kc[e.icon]}));return r?(0,Z.jsx)(c,{label:K(`display`),value:t,onChange:n,options:a}):(0,Z.jsx)(ye,{label:K(`display`),size:`md`,value:t,onChange:n,options:a})},Jc=[[`asc`,`ascending`],[`desc`,`descending`]],Yc=({model:e,view:t,display:n,orderBy:r,onChange:i,className:a})=>{let o=d(r),s=Je(e,t,n),c=s.includes(o.columnId)?s:[o.columnId,...s],l=e=>t?.fields[e]?.label??q(e);return(0,Z.jsx)(`select`,{"aria-label":K(`sort`),value:`${o.columnId} ${o.direction}`,onChange:e=>i(e.target.value),className:J(`h-8 rounded-md border border-border-strong bg-background px-2.5 shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20`,a),children:c.flatMap(e=>Jc.map(([t,n])=>(0,Z.jsxs)(`option`,{value:`${e} ${t}`,children:[l(e),`, `,K(n)]},`${e} ${t}`)))})},Xc=8,Zc=22,Qc=20,$c={wide:288,narrow:192},el=(e,t)=>H(e,t).record,tl=(e,t,n,r)=>i=>(0,Z.jsx)(Mi,{button:n,model:e,view:t,record:el(e,i),models:r}),nl=(e,t,n,r)=>i=>{let a=ji(n,e,t,el(e,i),r);return a?Math.ceil(a.label.length*Xc)+Zc+(`href`in a?Qc:0)+24:0},rl=(e,t,n,r,i)=>({id:`_row_button`,header:``,kind:`text`,width:152,minWidth:96,maxWidth:i,sortable:!1,render:tl(e,t,n,r),fit:nl(e,t,n,r)}),il=(e,t,n,r,i,a)=>{if(!a)return[...e,rl(t,n,r,i,$c.wide)];let[o,...s]=e;return o?[{...o,below:tl(t,n,r,i)},...s]:[rl(t,n,r,i,$c.narrow)]},al=(e,t,n)=>{let r=Object.hasOwn(e.fields,t)?e.fields[t]:void 0;return r?.type===`relation`&&r.relation!==void 0&&n[r.relation.resource]?.primaryKey.length===1},ol=(e,t,n)=>{if(e.open!==void 0)return e.open!==e.field&&al(t,e.open,n)?e.open:void 0;let r=t.primaryKey.filter(r=>r!==e.field&&r!==t.tenant&&al(t,r,n));return r.length===1?r[0]:void 0},sl=(e,t)=>{let n=e[t],r=typeof n==`object`&&n&&`id`in n?n.id:n;return typeof r==`string`||typeof r==`number`?r:void 0},cl=(e,t)=>(t?.names?.singular??q(e.name)).toLowerCase(),ll=({model:e,view:t,opens:n,resources:r,views:i,canUpdate:a})=>{let o=t=>({kind:`record`,resource:e.name,key:y(e,t)}),s=n&&e.fields[n]?.relation?.resource,c=s?r[s]:void 0,l=e=>{let t=n&&c?sl(e,n):void 0;return c&&t!==void 0?{kind:`record`,resource:c.name,key:t}:void 0},u=e=>l(e)??o(e),d=cl(e,t);return{address:u,actions:t=>{let n={label:vi(`open`,{singular:d}),link:e=>t(o(e))};if(!c)return[n];let r=e=>a&&dt(e,`update`);return[{label:vi(`open`,{singular:cl(c,i[c.name])}),available:e=>l(e)!==void 0,link:e=>t(l(e))},{label:vi(`edit`,{singular:d}),available:r,link:n=>t({kind:`record`,resource:e.name,key:y(e,n),edit:!0})},{...n,available:e=>!r(e)}]}}},ul=(e,t,{href:n,go:r})=>{if(`to`in e){let i=Te(e.to,t);return{href:n(i),onFollow:()=>r(i)}}let i=Nr(e.href,t);if(i===void 0)throw Error(`A link action without a target on the record is not shown`);return{href:i,newTab:/^https?:/i.test(i)}},dl=(e,t)=>({model:e,record:Object.fromEntries(Object.entries(H(e,t).record).filter(([t])=>Object.hasOwn(e.fields,t))),key:t.id,...typeof t.etag==`string`&&{etag:t.etag},...typeof t.permissions==`object`&&t.permissions!==null&&{permissions:t.permissions}}),fl=e=>{let{views:t,resources:n}=Y(),r=Vr(e.name,void 0),i=D(),a=E(),[o,s]=(0,X.useState)(),c=t[e.name]?.actions??[],l=c.filter(e=>!e.inputs?.length),u=async(e,t)=>`row`in e?(await r.run(e.action,e.row),[]):(await r.runEach(e.action,e.selection,e.skipped,t)).refused,d=e=>new Promise(t=>{e.action.confirm||e.action.inputs?.length?s({...e,settle:t}):t(u(e))});return{rowActions:l.map(t=>{let a=r=>Lr(t,dl(e,r).record,n),o={label:e=>a(e)?.label??t.label,destructive:Er(t)},s=t.run,c=n=>r.blockedOn(t,dl(e,n)),l=e=>a(e)!==void 0;return s?.kind===`link`?{...o,available:l,blocked:c,link:t=>ul(s,dl(e,t).record,i)}:{...o,available:l,blocked:c,onSelect:n=>void d({action:t,row:dl(e,n)})}}),bulkActions:c.filter(e=>e.bulk&&e.run?.kind!==`link`).map(t=>({label:e=>Ur(`actionCount`,{label:t.label,count:e}),destructive:Er(t),available:n=>r.verdictOn(t,dl(e,n))!==`skip`,onRun:async(n,r)=>{let i=n.map(t=>dl(e,t)),a=await d({action:t,selection:i,skipped:r});return n.filter((e,t)=>a.includes(i[t]))}})),prompt:o&&(0,Z.jsx)(Or,{action:o.action,label:`row`in o?o.action.label:Ur(`actionCount`,{label:o.action.label,count:o.selection.length}),danger:Er(o.action),records:`row`in o?[o.row.record]:o.selection.map(e=>e.record),names:`row`in o?[]:o.selection.map(n=>zr(a(e,t[e.name],n.record,n.key))),onCancel:()=>{s(void 0),o.settle(`row`in o?[o.row]:o.selection)},onConfirm:()=>{s(void 0),o.settle(u(o))},onSubmit:async e=>{s(void 0);let t=u(o,e);o.settle(t),await t}})}},pl=({client:e,queryClient:t,resources:n,views:r},{model:a,filter:o,orderBy:s,limit:c,fields:l,read:u})=>({queryKey:[...Rt.list(a.name,o,s,c,`embedded`),l.join(`,`),u?.join(`,`)??`*`],queryFn:async()=>{let d=de(n,r,a,l),f=rt(r[a.name]),p=await e.search(a.name,{filter:o||void 0,orderBy:s||void 0,pageSize:c,count:`exact`,labels:d,photos:f,fields:u});await Pe(t,e,n,r,a,l,p.items);let m=i(n,a,l,Ue(a,p.items,p.photos),p.labels).map((e,t)=>({...e,id:ve(a,p.items[t])}));return p.nextPageToken===``?{rows:m,total:m.length,estimated:!1}:{rows:m,total:p.totalSize??p.totalSizeEstimate,estimated:p.totalSize===void 0}}}),ml=(e,t=!0)=>{let{resources:n,views:r}=Y();return rn({...pl({client:vt(),queryClient:tn(),resources:n,views:r},e),placeholderData:en,enabled:t})},hl=(e,t,n,{rows:r,total:a})=>{let o=r.isPending||!!a?.isPending,s=r.error??a?.error??null;if(o||s)return{isPending:o,error:s,data:void 0};let c=i(e,t,n,Ue(t,r.rows,r.photos),r.labels).map((e,n)=>({...e,id:ve(t,r.rows[n])}));return{isPending:o,error:s,data:{rows:c,total:a?Ei(a):c.length,estimated:!1}}},gl=({view:e,value:t,onChange:n})=>(0,Z.jsx)(qc,{view:e,value:t,onChange:n,menu:!Ae()}),_l=()=>(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:Array.from({length:3},(e,t)=>(0,Z.jsx)(G,{className:`h-4 w-full`},t))}),vl=({model:e,view:t,filter:n,sort:r,columns:i,limit:a,display:o,empty:s,row:c=!1,viewAll:l,link:u=!0,opens:f,button:p,bulk:m=!1,phoneColumns:h,rowTo:g,chosenKey:_,planned:v})=>{let{resources:b,views:x}=Y(),S=gt(Ye(e.name),`update`),{fields:C}=O(),{go:T,href:E}=D(),k=w(),A=!Ae(),ee=r||V(e,t),[j,te]=(0,X.useState)(ee),{specs:M,fields:N,read:ne}=(0,X.useMemo)(()=>Tt({model:e,view:t,resources:b,views:x,fieldTypes:C,columns:i,button:p,opens:f,bulk:m,phoneColumns:h,xs:k}),[e,t,b,x,C,i?.join(`,`),p,f,m,h,k]),re=(0,X.useMemo)(()=>p?il(M,e,t,p,b,A):M,[M,e,t,p,b,A]),P=v!==void 0&&j===ee,ie=ml({model:e,filter:n,orderBy:j,limit:a,fields:N,read:ne},!P),F=(0,X.useMemo)(()=>v&&hl(b,e,N,v),[v,b,e,N]),ae=P?F:ie,I=fl(e),L=ae.data?.rows,R=(0,X.useMemo)(()=>L&&{total:L.length,rowAt:e=>L[e]},[L]),z=Ge(t,o),oe=t?.names?.plural??q(e.name),se=u&&(0,Z.jsxs)(De,{to:Ti(e,t,k,l?{filter:l.filter,orderBy:V(e,t),display:o,savedSearch:l.savedSearch}:{filter:n,orderBy:j,display:o}),onClick:l?.onOpen,className:`flex items-center gap-1 self-end font-medium text-primary-text hover:underline`,children:[l?l.label:(0,Z.jsxs)(Z.Fragment,{children:[vi(`viewAll`),` `,(0,Z.jsx)(`span`,{className:`sr-only`,children:oe.toLowerCase()})]}),(0,Z.jsx)(jn,{className:`size-3.5`,"aria-hidden":!0})]}),ce=e=>(0,Z.jsxs)(Z.Fragment,{children:[e,I.prompt]});if(ae.isPending)return ce((0,Z.jsx)(_l,{}));if(ae.error)return ce((0,Z.jsx)(Ut,{title:vi(`couldNotLoad`),error:ae.error}));let le=ae.data;if(!le||!R||R.total===0){let e=(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:s??vi(`nothingYet`)});return ce(l&&u?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e,se]}):e)}let ue={resource:e.name,rows:le.rows.map(t=>H(e,t)),total:le.total,loading:!1,error:null,more:!1,loadMore:()=>void 0},B=ll({model:e,view:t,opens:f,resources:b,views:x,canUpdate:S}),de=e=>({href:E(e),onFollow:()=>T(e)}),fe=t=>Ht(y(e,t)),pe=e=>g?g(fe(e)):de(B.address(e)),me=_===void 0?void 0:le.rows.find(e=>fe(e)===_)?.id,he=yi(R.total,le.total,le.estimated);return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[z?z.kind===`cards`?(0,Z.jsx)(sc,{model:e,view:t,display:z,list:ue,row:c||k,footer:!1}):z.kind===`map`?(0,Z.jsx)(Bc,{model:e,view:t,display:z,filter:n,orderBy:j,fields:N,footer:!1}):z.kind===`board`?(0,Z.jsx)(Uc,{model:e,view:t,display:z,fields:N,filter:n,orderBy:j,limit:a}):z.kind===`calendar`?(0,Z.jsx)(Wc,{model:e,view:t,display:z,fields:N,filter:n}):z.kind===`timeline`?(0,Z.jsx)(Gc,{model:e,view:t,display:z,fields:N,filter:n}):(0,Z.jsx)(cc,{display:z,list:ue}):(0,Z.jsx)(eo,{fit:!0,columns:re,source:R,latencyMs:0,sort:d(j),onSortChange:e=>te(Wt(e)),onOpenRow:e=>pe(e).onFollow?.(),rowLink:pe,chosenRow:me,rowActions:B.actions(de),rowNumbers:!1,selectable:m,...m&&{bulkActions:I.bulkActions}}),I.prompt,he&&u?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:he}),se]}):se]})};export{Ka as $,Qo as A,Nn as At,ho as B,Gs as C,Vr as Ct,ls as D,Er as Dt,gs as E,Dr as Et,Vo as F,po as G,_o as H,ko as I,oo as J,lo as K,Fo as L,Jo as M,kn as Mt,Uo as N,cs as O,Qn as Ot,Ho as P,eo as Q,go as R,Xs as S,zr as St,Ts as T,Or as Tt,mo as U,vo as V,fo as W,io as X,ro as Y,to as Z,bc as _,Yr as _t,ul as a,Si as at,tc as b,Wr as bt,sl as c,yi as ct,Yc as d,mi as dt,Zi as et,Uc as f,li as ft,Nc as g,qr as gt,Bc as h,ti as ht,fl as i,xi as it,Yo as j,jn as jt,os as k,Vn as kt,il as l,vi as lt,Gc as m,ni as mt,vl as n,Ei as nt,ll as o,Ti as ot,Wc as p,ii as pt,so as q,pl as r,wi as rt,ol as s,Ci as st,gl as t,Mi as tt,qc as u,_i as ut,cc as v,$r as vt,Rs as w,Hr as wt,$s as x,Ur as xt,nc as y,Qr as yt,uo as z};
3
+ //# debugId=0da26b7a-3942-4e17-a7ec-fba80304b171