@onequery/cli 0.1.29-win32-x64 → 0.1.30-darwin-arm64

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 (139) hide show
  1. package/package.json +3 -3
  2. package/vendor/{x86_64-pc-windows-msvc/onequery/onequery.exe → aarch64-apple-darwin/onequery/onequery} +0 -0
  3. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/DialogTitle-BJlYCa5c.js → aarch64-apple-darwin/runtime/web/assets/DialogTitle-C3t5rzfv.js} +1 -1
  4. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/_authenticated-CHLPI9oN.js → aarch64-apple-darwin/runtime/web/assets/_authenticated-B_5gYcSE.js} +1 -1
  5. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/_org_slug-HoXlK1R3.js → aarch64-apple-darwin/runtime/web/assets/_org_slug-ZRAZX4yf.js} +1 -1
  6. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/audit--ek8_q35.js → aarch64-apple-darwin/runtime/web/assets/audit-0ySkceEm.js} +1 -1
  7. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/budget-Bj3eT1Wo.js → aarch64-apple-darwin/runtime/web/assets/budget-M88BhFjM.js} +1 -1
  8. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/callback-DW6L7hdM.js → aarch64-apple-darwin/runtime/web/assets/callback-oibt7Zzh.js} +1 -1
  9. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/connect-database-D1iqUOZ8.js → aarch64-apple-darwin/runtime/web/assets/connect-database-C2ki17Gk.js} +1 -1
  10. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/create-org-DHTB-ZMP.js → aarch64-apple-darwin/runtime/web/assets/create-org-gZvjpMQY.js} +1 -1
  11. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/data-source-connection-form-BIvkRhNA.js → aarch64-apple-darwin/runtime/web/assets/data-source-connection-form-DwwJ0tPU.js} +1 -1
  12. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/device-CsKoP4ux.js → aarch64-apple-darwin/runtime/web/assets/device-CmX_h31L.js} +1 -1
  13. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/dropdown-menu-C4YyrGG8.js → aarch64-apple-darwin/runtime/web/assets/dropdown-menu-BIqdY_8v.js} +1 -1
  14. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/home-BREzJOD8.js → aarch64-apple-darwin/runtime/web/assets/home-c0b9mo1B.js} +1 -1
  15. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/index-Cjh47nVg.js → aarch64-apple-darwin/runtime/web/assets/index-CbFJKkNs.js} +2 -2
  16. package/vendor/aarch64-apple-darwin/runtime/web/assets/index-CqvU4VXr.css +2 -0
  17. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/integrations-BtbKfGm9.js → aarch64-apple-darwin/runtime/web/assets/integrations-Dt8NPrZT.js} +1 -1
  18. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/invite._invitationId-BkG9RVd1.js → aarch64-apple-darwin/runtime/web/assets/invite._invitationId-DQAVR32l.js} +1 -1
  19. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/routes-L09Qx-Z1.js → aarch64-apple-darwin/runtime/web/assets/routes-C1hIhGRp.js} +1 -1
  20. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/signin-3LSA5ctW.js → aarch64-apple-darwin/runtime/web/assets/signin-GSh_tL5l.js} +1 -1
  21. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/team-zuaynN87.js → aarch64-apple-darwin/runtime/web/assets/team-C8CHyB14.js} +1 -1
  22. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/theme-toggle-Dbe9t-ev.js → aarch64-apple-darwin/runtime/web/assets/theme-toggle-XEe6wWso.js} +1 -1
  23. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/use-optimistic-mutation-BT87RwFY.js → aarch64-apple-darwin/runtime/web/assets/use-optimistic-mutation-Uf_9TxpA.js} +1 -1
  24. package/vendor/{x86_64-pc-windows-msvc/runtime/web/assets/useBaseQuery-BTzAZwMy.js → aarch64-apple-darwin/runtime/web/assets/useBaseQuery-C6Svq4OV.js} +1 -1
  25. package/vendor/aarch64-apple-darwin/runtime/web/assets/useQuery-DcPzWABw.js +1 -0
  26. package/vendor/aarch64-apple-darwin/runtime/web/assets/useSuspenseQuery-BanVmJgY.js +1 -0
  27. package/vendor/aarch64-apple-darwin/runtime/web/favicon.ico +0 -0
  28. package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/index.html +3 -2
  29. package/vendor/aarch64-apple-darwin/runtime/web/onequery.svg +44 -0
  30. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/index-FAyK3-UK.css +0 -2
  31. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/useQuery-lzNVvWVk.js +0 -1
  32. package/vendor/x86_64-pc-windows-msvc/runtime/web/assets/useSuspenseQuery-BLzbXzA6.js +0 -1
  33. package/vendor/x86_64-pc-windows-msvc/runtime/web/onequery.svg +0 -14
  34. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260327065242_curious_nightmare.sql +0 -0
  35. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260403103652_slippery_hellfire_club.sql +0 -0
  36. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260403112219_gigantic_namora.sql +0 -0
  37. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260327065242_snapshot.json +0 -0
  38. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260403103652_snapshot.json +0 -0
  39. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260403112219_snapshot.json +0 -0
  40. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/_journal.json +0 -0
  41. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/initdb.wasm +0 -0
  42. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/pglite.data +0 -0
  43. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/pglite.wasm +0 -0
  44. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/sql-parser/sql_parser_wasm_bg.wasm +0 -0
  45. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/CompositeItem-D3nXGtvr.js +0 -0
  46. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/CompositeList-CX7HHxYw.js +0 -0
  47. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconArrowRight-DsOD7mDl.js +0 -0
  48. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconCheck-Gc24xPT2.js +0 -0
  49. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconChevronDown-B-39MA7-.js +0 -0
  50. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconCoins-C7Nn0L6R.js +0 -0
  51. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconHistory-BqAd-xl2.js +0 -0
  52. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconLoader2-B3B6M8nQ.js +0 -0
  53. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconPlus-C3-kRhGX.js +0 -0
  54. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/IconX-BQkA009b.js +0 -0
  55. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/Separator-vw4jPN_6.js +0 -0
  56. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/api-base-url-DIb6qukm.js +0 -0
  57. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/api-client-w1GRwBWy.js +0 -0
  58. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/api-paths-ClEWWGwS.js +0 -0
  59. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/app-routes-CnJncMlZ.js +0 -0
  60. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/auth-bootstrap-query-CrWpT3WV.js +0 -0
  61. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/auth-client-BlMeXgb4.js +0 -0
  62. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/avatar-B8g7WJsq.js +0 -0
  63. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/badge-C1_ZMBRy.js +0 -0
  64. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/card-Bsy6azfK.js +0 -0
  65. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/checkbox-CJcCVDm9.js +0 -0
  66. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/compiler-runtime-DCc3R3Xn.js +0 -0
  67. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/createReactComponent-_L2mp4Ui.js +0 -0
  68. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/empty-COnWCwda.js +0 -0
  69. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/format-date-Ctrh7my1.js +0 -0
  70. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/getDisabledMountTransitionStyles-BYKRz4ha.js +0 -0
  71. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/getPseudoElementBounds-InhM-dWf.js +0 -0
  72. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/input-CG_cIxvO.js +0 -0
  73. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  74. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  75. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  76. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  77. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  78. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  79. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  80. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/jsx-runtime-DG_AJzB_.js +0 -0
  81. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/label-CWOhoN_L.js +0 -0
  82. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/link-Cgvqhh5w.js +0 -0
  83. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/matchContext-CDajBC0L.js +0 -0
  84. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/organization-permissions-BQQ5PJbI.js +0 -0
  85. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/organization-query-keys-DwLucsD_.js +0 -0
  86. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/query-timing-LGzitMXx.js +0 -0
  87. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/queryOptions-BHw87wTZ.js +0 -0
  88. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/removable-BfDesq3B.js +0 -0
  89. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/schemas-MsKXD_XQ.js +0 -0
  90. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/select-D6km4Obp.js +0 -0
  91. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/separator-CWltZvB_.js +0 -0
  92. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/settings-5_Ep5M2N.js +0 -0
  93. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/src-DCIPwIx0.js +0 -0
  94. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/table-DCvfJyLS.js +0 -0
  95. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/textarea-DiU04l_U.js +0 -0
  96. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useBaseUiId-BLFGpnYJ.js +0 -0
  97. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useCompositeItem-BsMHgRi0.js +0 -0
  98. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useControlled-B8q0aJoo.js +0 -0
  99. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useRender-B2c9_UYd.js +0 -0
  100. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useRouterState-DpT8luFk.js +0 -0
  101. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/useValueChanged-CqxkrqWn.js +0 -0
  102. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/utils-C8DGLIgm.js +0 -0
  103. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/xstate-react.esm-BlF76DuP.js +0 -0
  104. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/assets/zod-C2fx2RN8.js +0 -0
  105. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step1_settings_sidebar.png +0 -0
  106. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step2_projects.png +0 -0
  107. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step3_project_keys.png +0 -0
  108. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/amplitude/step4_api_keys.png +0 -0
  109. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step1_service_accounts.png +0 -0
  110. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step2_bigquery_roles.png +0 -0
  111. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step3_add_key_menu.png +0 -0
  112. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/bigquery/step4_create_json_key.png +0 -0
  113. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step1_service_accounts.png +0 -0
  114. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step2_create_json_key.png +0 -0
  115. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step3_add_user_viewer.png +0 -0
  116. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/ga4/step4_property_details.png +0 -0
  117. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step1_signin.png +0 -0
  118. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step2_new_fine_grained_token_sanitized.png +0 -0
  119. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step3_permissions_configured_sanitized.png +0 -0
  120. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/github-token-guide/step4_token_created_sanitized.png +0 -0
  121. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step1_service_accounts.png +0 -0
  122. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step2_create_service_account.png +0 -0
  123. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step3_credentials.png +0 -0
  124. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/mixpanel/step4_project_settings.png +0 -0
  125. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/postgresql/step1_create_user.png +0 -0
  126. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/postgresql/step2_connection.png +0 -0
  127. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/posthog/step1_project_settings.png +0 -0
  128. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/posthog/step2_personal_api_keys.png +0 -0
  129. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/posthog/step3_create_key_modal.png +0 -0
  130. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step1_connect.png +0 -0
  131. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step2_create_user.png +0 -0
  132. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step3_grant.png +0 -0
  133. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/rds/step4_info.png +0 -0
  134. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step1_personal_tokens.png +0 -0
  135. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step2_create_token_permissions.png +0 -0
  136. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step3_organization_slug.png +0 -0
  137. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/images/sentry/step4_project_slug.png +0 -0
  138. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/web/linear.svg +0 -0
  139. /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/server/onequery-server.mjs +0 -0
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,o as a}from"./api-base-url-DIb6qukm.js";import{n as o}from"./createReactComponent-_L2mp4Ui.js";import{t as s}from"./IconCheck-Gc24xPT2.js";import{t as c}from"./IconLoader2-B3B6M8nQ.js";import{t as l}from"./IconX-BQkA009b.js";import{t as u}from"./auth-client-BlMeXgb4.js";import{a as d,i as f}from"./app-routes-CnJncMlZ.js";import{E as p,T as m,U as h}from"./index-Cjh47nVg.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./card-Bsy6azfK.js";import{a as S,i as C,n as w,o as T,s as E}from"./xstate-react.esm-BlF76DuP.js";var D=r(),O=e(t(),1),k=i(f),A=`Failed to accept invitation`,j=`Failed to navigate. Try again from home.`,M=1500,N=`Invite accept actor is not configured`,P={kind:`home`},F={ACCEPT:`inviteAccept/accept`,DECLINE:`inviteAccept/decline`,GO_HOME:`inviteAccept/goHome`,NAVIGATION_COMPLETED:`inviteAccept/navigationCompleted`,NAVIGATION_FAILED:`inviteAccept/navigationFailed`,NAVIGATION_STARTED:`inviteAccept/navigationStarted`},I={ACCEPTING:`accepting`,ERROR:`error`,NAVIGATING:`navigating`,READY:`ready`,REFRESHING_ORGANIZATIONS:`refreshingOrganizations`,SUCCESS_PENDING_REDIRECT:`successPendingRedirect`};function L(){return{acceptedOrganizationId:null,errorMessage:null,navigation:null,nextNavigationId:1,redirectTarget:null}}function R(e){return{...L(),nextNavigationId:e.nextNavigationId}}function z(e,t){return{...R(e),errorMessage:t}}function B(e,t){return{navigation:{id:e.nextNavigationId,phase:`pending`,target:t},nextNavigationId:e.nextNavigationId+1}}function V(e){if(e.acceptedOrganizationId===null)throw Error(`Accepted organization ID is required`);return e.acceptedOrganizationId}function H(e){return e.redirectTarget??P}function U(e,t){if(!(e instanceof Error))return t;let n=e.message.trim();return n.length===0?t:n}function W(e){let t=e.successRedirectDelayMs??M;return S({actions:{markNavigationRunning:T(({context:e,event:t})=>(C(t,F.NAVIGATION_STARTED),e.navigation?.id===t.id?{navigation:{...e.navigation,phase:`running`}}:{})),queueHomeNavigation:T(({context:e})=>B(e,P)),queueResolvedNavigation:T(({context:e})=>B(e,H(e))),resetFlow:T(({context:e,event:t})=>(C(t,F.NAVIGATION_COMPLETED),e.navigation?.id===t.id?R(e):{})),storeAcceptError:T({acceptedOrganizationId:()=>null,errorMessage:(e,t)=>t.message,navigation:()=>null,redirectTarget:()=>null}),storeAcceptedOrganizationId:T({acceptedOrganizationId:(e,t)=>t.acceptedOrganizationId,errorMessage:()=>null,redirectTarget:()=>null}),storeHomeRedirectTarget:T({redirectTarget:()=>P}),storeNavigationError:T(({context:e,event:t})=>(C(t,F.NAVIGATION_FAILED),e.navigation?.id===t.id?z(e,t.message):{})),storeResolvedRedirectTarget:T({redirectTarget:(e,t)=>t.redirectTarget})},actors:{acceptInvitation:E(async()=>{throw Error(N)}),resolveRedirect:E(async()=>{throw Error(N)})},types:{}}).createMachine({context:L(),id:`inviteAccept`,initial:I.READY,states:{[I.READY]:{on:{[F.ACCEPT]:I.ACCEPTING,[F.DECLINE]:{actions:`queueHomeNavigation`,target:I.NAVIGATING}}},[I.ACCEPTING]:{invoke:{src:`acceptInvitation`,onDone:{actions:{type:`storeAcceptedOrganizationId`,params:({event:e})=>({acceptedOrganizationId:e.output.acceptedOrganizationId})},target:I.REFRESHING_ORGANIZATIONS},onError:{actions:{type:`storeAcceptError`,params:({event:e})=>({message:U(e.error,A)})},target:I.ERROR}}},[I.REFRESHING_ORGANIZATIONS]:{invoke:{src:`resolveRedirect`,input:({context:e})=>({acceptedOrganizationId:V(e)}),onDone:{actions:{type:`storeResolvedRedirectTarget`,params:({event:e})=>({redirectTarget:e.output})},target:I.SUCCESS_PENDING_REDIRECT},onError:{actions:`storeHomeRedirectTarget`,target:I.SUCCESS_PENDING_REDIRECT}}},[I.SUCCESS_PENDING_REDIRECT]:{after:{[t]:{actions:`queueResolvedNavigation`,target:I.NAVIGATING}}},[I.NAVIGATING]:{on:{[F.NAVIGATION_COMPLETED]:{actions:`resetFlow`,target:I.READY},[F.NAVIGATION_FAILED]:{actions:`storeNavigationError`,target:I.ERROR},[F.NAVIGATION_STARTED]:{actions:`markNavigationRunning`}}},[I.ERROR]:{on:{[F.GO_HOME]:{actions:`queueHomeNavigation`,target:I.NAVIGATING}}}}}).provide({actors:{acceptInvitation:E(async()=>e.acceptInvitation()),resolveRedirect:E(async({input:t})=>e.resolveRedirect(t.acceptedOrganizationId))}})}function G(e){return e.matches(I.ACCEPTING)?`accepting`:e.matches(I.ERROR)||e.matches(I.NAVIGATING)&&e.context.acceptedOrganizationId===null&&e.context.errorMessage!==null?`error`:e.matches(I.REFRESHING_ORGANIZATIONS)||e.matches(I.SUCCESS_PENDING_REDIRECT)||e.matches(I.NAVIGATING)&&e.context.acceptedOrganizationId!==null?`success`:`ready`}function K(e){return U(e,j)}function q(){let e=a(),t=h(),{invitationId:n}=k.useParams(),{auth:r,refetchSession:i}=k.useRouteContext(),o=r.session?.user.id,s=(0,O.useCallback)(async()=>{let e=await u.acceptInvitation({invitationId:n});if(e.error)throw Error(e.error.message);return{acceptedOrganizationId:e.data.member.organizationId}},[n]),c=(0,O.useCallback)(async e=>{try{await i();let n=(await t.fetchQuery({...m(o),staleTime:0})).find(t=>t.id===e);if(n)return{kind:`organization`,organizationSlug:p(n)};let r=await u.getFullOrganization({query:{organizationId:e}});if(r.data?.slug)return{kind:`organization`,organizationSlug:r.data.slug};console.error(`[invite] accepted invitation but organization was not found`,{acceptedOrganizationId:e,userId:o})}catch(t){console.error(`[invite] accepted invitation but failed to refresh orgs`,{acceptedOrganizationId:e,error:t,userId:o})}return P},[t,i,o]),[l,f]=w((0,O.useMemo)(()=>W({acceptInvitation:s,resolveRedirect:c}),[s,c])),g=l.context.navigation;return(0,O.useEffect)(()=>{g===null||g.phase!==`pending`||(f({id:g.id,type:F.NAVIGATION_STARTED}),(g.target.kind===`home`?e({to:`/`}):e({params:{org_slug:g.target.organizationSlug},to:d})).then(()=>{f({id:g.id,type:F.NAVIGATION_COMPLETED})}).catch(e=>{console.error(`[invite] failed to navigate after accepting invitation`,{error:e,navigation:g}),f({id:g.id,message:K(e),type:F.NAVIGATION_FAILED})}))},[e,g,f]),{accept:()=>{f({type:F.ACCEPT})},decline:()=>{f({type:F.DECLINE})},errorMessage:l.context.errorMessage,goHome:()=>{f({type:F.GO_HOME})},status:G(l)}}var J=n();function Y(){let e=(0,D.c)(28),{accept:t,decline:n,errorMessage:r,goHome:i,status:a}=q(),u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,J.jsxs)(g,{className:`text-center`,children:[(0,J.jsx)(y,{className:`text-2xl`,children:`Organization Invitation`}),(0,J.jsx)(b,{children:`You've been invited to join an organization`})]}),e[0]=u):u=e[0];let d;e[1]===a?d=e[2]:(d=a===`ready`&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,J.jsx)(`div`,{className:`rounded-full bg-primary/10 p-4`,children:(0,J.jsx)(s,{size:48,className:`text-primary`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`font-medium`,children:`Ready to join`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Click the button below to accept the invitation and join the organization.`})]})]}),e[1]=a,e[2]=d);let f;e[3]===a?f=e[4]:(f=a===`accepting`&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,J.jsx)(c,{size:48,className:`animate-spin text-primary`}),(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`Accepting invitation...`})]}),e[3]=a,e[4]=f);let p;e[5]===a?p=e[6]:(p=a===`success`&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,J.jsx)(`div`,{className:`rounded-full bg-green-500/10 p-4`,children:(0,J.jsx)(s,{size:48,className:`text-green-500`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`font-medium text-green-600`,children:`Successfully joined!`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Redirecting to your dashboard...`})]})]}),e[5]=a,e[6]=p);let m;e[7]!==r||e[8]!==a?(m=a===`error`&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,J.jsx)(`div`,{className:`rounded-full bg-destructive/10 p-4`,children:(0,J.jsx)(l,{size:48,className:`text-destructive`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`font-medium text-destructive`,children:`Failed to accept invitation`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:r||`The invitation may have expired or already been used.`})]})]}),e[7]=r,e[8]=a,e[9]=m):m=e[9];let h;e[10]!==d||e[11]!==f||e[12]!==p||e[13]!==m?(h=(0,J.jsxs)(v,{className:`flex justify-center py-8`,children:[d,f,p,m]}),e[10]=d,e[11]=f,e[12]=p,e[13]=m,e[14]=h):h=e[14];let S;e[15]!==t||e[16]!==n||e[17]!==a?(S=a===`ready`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(o,{variant:`outline`,onClick:n,children:`Decline`}),(0,J.jsx)(o,{onClick:t,children:`Accept Invitation`})]}),e[15]=t,e[16]=n,e[17]=a,e[18]=S):S=e[18];let C;e[19]!==i||e[20]!==a?(C=a===`error`&&(0,J.jsx)(o,{variant:`outline`,onClick:i,children:`Go to Home`}),e[19]=i,e[20]=a,e[21]=C):C=e[21];let w;e[22]!==S||e[23]!==C?(w=(0,J.jsxs)(_,{className:`flex justify-center gap-4`,children:[S,C]}),e[22]=S,e[23]=C,e[24]=w):w=e[24];let T;return e[25]!==h||e[26]!==w?(T=(0,J.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:(0,J.jsxs)(x,{className:`w-full max-w-md`,children:[u,h,w]})}),e[25]=h,e[26]=w,e[27]=T):T=e[27],T}var X=Y;export{X as component};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,o as a}from"./api-base-url-DIb6qukm.js";import{n as o}from"./createReactComponent-_L2mp4Ui.js";import{t as s}from"./IconCheck-Gc24xPT2.js";import{t as c}from"./IconLoader2-B3B6M8nQ.js";import{t as l}from"./IconX-BQkA009b.js";import{t as u}from"./auth-client-BlMeXgb4.js";import{a as d,i as f}from"./app-routes-CnJncMlZ.js";import{E as p,T as m,U as h}from"./index-CbFJKkNs.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./card-Bsy6azfK.js";import{a as S,i as C,n as w,o as T,s as E}from"./xstate-react.esm-BlF76DuP.js";var D=r(),O=e(t(),1),k=i(f),A=`Failed to accept invitation`,j=`Failed to navigate. Try again from home.`,M=1500,N=`Invite accept actor is not configured`,P={kind:`home`},F={ACCEPT:`inviteAccept/accept`,DECLINE:`inviteAccept/decline`,GO_HOME:`inviteAccept/goHome`,NAVIGATION_COMPLETED:`inviteAccept/navigationCompleted`,NAVIGATION_FAILED:`inviteAccept/navigationFailed`,NAVIGATION_STARTED:`inviteAccept/navigationStarted`},I={ACCEPTING:`accepting`,ERROR:`error`,NAVIGATING:`navigating`,READY:`ready`,REFRESHING_ORGANIZATIONS:`refreshingOrganizations`,SUCCESS_PENDING_REDIRECT:`successPendingRedirect`};function L(){return{acceptedOrganizationId:null,errorMessage:null,navigation:null,nextNavigationId:1,redirectTarget:null}}function R(e){return{...L(),nextNavigationId:e.nextNavigationId}}function z(e,t){return{...R(e),errorMessage:t}}function B(e,t){return{navigation:{id:e.nextNavigationId,phase:`pending`,target:t},nextNavigationId:e.nextNavigationId+1}}function V(e){if(e.acceptedOrganizationId===null)throw Error(`Accepted organization ID is required`);return e.acceptedOrganizationId}function H(e){return e.redirectTarget??P}function U(e,t){if(!(e instanceof Error))return t;let n=e.message.trim();return n.length===0?t:n}function W(e){let t=e.successRedirectDelayMs??M;return S({actions:{markNavigationRunning:T(({context:e,event:t})=>(C(t,F.NAVIGATION_STARTED),e.navigation?.id===t.id?{navigation:{...e.navigation,phase:`running`}}:{})),queueHomeNavigation:T(({context:e})=>B(e,P)),queueResolvedNavigation:T(({context:e})=>B(e,H(e))),resetFlow:T(({context:e,event:t})=>(C(t,F.NAVIGATION_COMPLETED),e.navigation?.id===t.id?R(e):{})),storeAcceptError:T({acceptedOrganizationId:()=>null,errorMessage:(e,t)=>t.message,navigation:()=>null,redirectTarget:()=>null}),storeAcceptedOrganizationId:T({acceptedOrganizationId:(e,t)=>t.acceptedOrganizationId,errorMessage:()=>null,redirectTarget:()=>null}),storeHomeRedirectTarget:T({redirectTarget:()=>P}),storeNavigationError:T(({context:e,event:t})=>(C(t,F.NAVIGATION_FAILED),e.navigation?.id===t.id?z(e,t.message):{})),storeResolvedRedirectTarget:T({redirectTarget:(e,t)=>t.redirectTarget})},actors:{acceptInvitation:E(async()=>{throw Error(N)}),resolveRedirect:E(async()=>{throw Error(N)})},types:{}}).createMachine({context:L(),id:`inviteAccept`,initial:I.READY,states:{[I.READY]:{on:{[F.ACCEPT]:I.ACCEPTING,[F.DECLINE]:{actions:`queueHomeNavigation`,target:I.NAVIGATING}}},[I.ACCEPTING]:{invoke:{src:`acceptInvitation`,onDone:{actions:{type:`storeAcceptedOrganizationId`,params:({event:e})=>({acceptedOrganizationId:e.output.acceptedOrganizationId})},target:I.REFRESHING_ORGANIZATIONS},onError:{actions:{type:`storeAcceptError`,params:({event:e})=>({message:U(e.error,A)})},target:I.ERROR}}},[I.REFRESHING_ORGANIZATIONS]:{invoke:{src:`resolveRedirect`,input:({context:e})=>({acceptedOrganizationId:V(e)}),onDone:{actions:{type:`storeResolvedRedirectTarget`,params:({event:e})=>({redirectTarget:e.output})},target:I.SUCCESS_PENDING_REDIRECT},onError:{actions:`storeHomeRedirectTarget`,target:I.SUCCESS_PENDING_REDIRECT}}},[I.SUCCESS_PENDING_REDIRECT]:{after:{[t]:{actions:`queueResolvedNavigation`,target:I.NAVIGATING}}},[I.NAVIGATING]:{on:{[F.NAVIGATION_COMPLETED]:{actions:`resetFlow`,target:I.READY},[F.NAVIGATION_FAILED]:{actions:`storeNavigationError`,target:I.ERROR},[F.NAVIGATION_STARTED]:{actions:`markNavigationRunning`}}},[I.ERROR]:{on:{[F.GO_HOME]:{actions:`queueHomeNavigation`,target:I.NAVIGATING}}}}}).provide({actors:{acceptInvitation:E(async()=>e.acceptInvitation()),resolveRedirect:E(async({input:t})=>e.resolveRedirect(t.acceptedOrganizationId))}})}function G(e){return e.matches(I.ACCEPTING)?`accepting`:e.matches(I.ERROR)||e.matches(I.NAVIGATING)&&e.context.acceptedOrganizationId===null&&e.context.errorMessage!==null?`error`:e.matches(I.REFRESHING_ORGANIZATIONS)||e.matches(I.SUCCESS_PENDING_REDIRECT)||e.matches(I.NAVIGATING)&&e.context.acceptedOrganizationId!==null?`success`:`ready`}function K(e){return U(e,j)}function q(){let e=a(),t=h(),{invitationId:n}=k.useParams(),{auth:r,refetchSession:i}=k.useRouteContext(),o=r.session?.user.id,s=(0,O.useCallback)(async()=>{let e=await u.acceptInvitation({invitationId:n});if(e.error)throw Error(e.error.message);return{acceptedOrganizationId:e.data.member.organizationId}},[n]),c=(0,O.useCallback)(async e=>{try{await i();let n=(await t.fetchQuery({...m(o),staleTime:0})).find(t=>t.id===e);if(n)return{kind:`organization`,organizationSlug:p(n)};let r=await u.getFullOrganization({query:{organizationId:e}});if(r.data?.slug)return{kind:`organization`,organizationSlug:r.data.slug};console.error(`[invite] accepted invitation but organization was not found`,{acceptedOrganizationId:e,userId:o})}catch(t){console.error(`[invite] accepted invitation but failed to refresh orgs`,{acceptedOrganizationId:e,error:t,userId:o})}return P},[t,i,o]),[l,f]=w((0,O.useMemo)(()=>W({acceptInvitation:s,resolveRedirect:c}),[s,c])),g=l.context.navigation;return(0,O.useEffect)(()=>{g===null||g.phase!==`pending`||(f({id:g.id,type:F.NAVIGATION_STARTED}),(g.target.kind===`home`?e({to:`/`}):e({params:{org_slug:g.target.organizationSlug},to:d})).then(()=>{f({id:g.id,type:F.NAVIGATION_COMPLETED})}).catch(e=>{console.error(`[invite] failed to navigate after accepting invitation`,{error:e,navigation:g}),f({id:g.id,message:K(e),type:F.NAVIGATION_FAILED})}))},[e,g,f]),{accept:()=>{f({type:F.ACCEPT})},decline:()=>{f({type:F.DECLINE})},errorMessage:l.context.errorMessage,goHome:()=>{f({type:F.GO_HOME})},status:G(l)}}var J=n();function Y(){let e=(0,D.c)(28),{accept:t,decline:n,errorMessage:r,goHome:i,status:a}=q(),u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,J.jsxs)(g,{className:`text-center`,children:[(0,J.jsx)(y,{className:`text-2xl`,children:`Organization Invitation`}),(0,J.jsx)(b,{children:`You've been invited to join an organization`})]}),e[0]=u):u=e[0];let d;e[1]===a?d=e[2]:(d=a===`ready`&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,J.jsx)(`div`,{className:`rounded-full bg-primary/10 p-4`,children:(0,J.jsx)(s,{size:48,className:`text-primary`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`font-medium`,children:`Ready to join`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Click the button below to accept the invitation and join the organization.`})]})]}),e[1]=a,e[2]=d);let f;e[3]===a?f=e[4]:(f=a===`accepting`&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,J.jsx)(c,{size:48,className:`animate-spin text-primary`}),(0,J.jsx)(`p`,{className:`text-muted-foreground`,children:`Accepting invitation...`})]}),e[3]=a,e[4]=f);let p;e[5]===a?p=e[6]:(p=a===`success`&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,J.jsx)(`div`,{className:`rounded-full bg-green-500/10 p-4`,children:(0,J.jsx)(s,{size:48,className:`text-green-500`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`font-medium text-green-600`,children:`Successfully joined!`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:`Redirecting to your dashboard...`})]})]}),e[5]=a,e[6]=p);let m;e[7]!==r||e[8]!==a?(m=a===`error`&&(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,J.jsx)(`div`,{className:`rounded-full bg-destructive/10 p-4`,children:(0,J.jsx)(l,{size:48,className:`text-destructive`})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`font-medium text-destructive`,children:`Failed to accept invitation`}),(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:r||`The invitation may have expired or already been used.`})]})]}),e[7]=r,e[8]=a,e[9]=m):m=e[9];let h;e[10]!==d||e[11]!==f||e[12]!==p||e[13]!==m?(h=(0,J.jsxs)(v,{className:`flex justify-center py-8`,children:[d,f,p,m]}),e[10]=d,e[11]=f,e[12]=p,e[13]=m,e[14]=h):h=e[14];let S;e[15]!==t||e[16]!==n||e[17]!==a?(S=a===`ready`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(o,{variant:`outline`,onClick:n,children:`Decline`}),(0,J.jsx)(o,{onClick:t,children:`Accept Invitation`})]}),e[15]=t,e[16]=n,e[17]=a,e[18]=S):S=e[18];let C;e[19]!==i||e[20]!==a?(C=a===`error`&&(0,J.jsx)(o,{variant:`outline`,onClick:i,children:`Go to Home`}),e[19]=i,e[20]=a,e[21]=C):C=e[21];let w;e[22]!==S||e[23]!==C?(w=(0,J.jsxs)(_,{className:`flex justify-center gap-4`,children:[S,C]}),e[22]=S,e[23]=C,e[24]=w):w=e[24];let T;return e[25]!==h||e[26]!==w?(T=(0,J.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:(0,J.jsxs)(x,{className:`w-full max-w-md`,children:[u,h,w]})}),e[25]=h,e[26]=w,e[27]=T):T=e[27],T}var X=Y;export{X as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./link-Cgvqhh5w.js";import{t as n}from"./compiler-runtime-DCc3R3Xn.js";import{r,t as i}from"./createReactComponent-_L2mp4Ui.js";import{t as a}from"./utils-C8DGLIgm.js";import{t as o}from"./theme-toggle-Dbe9t-ev.js";import{o as s}from"./app-routes-CnJncMlZ.js";import{X as c}from"./index-Cjh47nVg.js";var l=i(`outline`,`git-compare`,`GitCompare`,[[`path`,{d:`M4 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M16 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M11 6h5a2 2 0 0 1 2 2v8`,key:`svg-2`}],[`path`,{d:`M14 9l-3 -3l3 -3`,key:`svg-3`}],[`path`,{d:`M13 18h-5a2 2 0 0 1 -2 -2v-8`,key:`svg-4`}],[`path`,{d:`M10 15l3 3l-3 3`,key:`svg-5`}]]),u=i(`outline`,`robot`,`Robot`,[[`path`,{d:`M6 6a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -4`,key:`svg-0`}],[`path`,{d:`M12 2v2`,key:`svg-1`}],[`path`,{d:`M9 12v9`,key:`svg-2`}],[`path`,{d:`M15 12v9`,key:`svg-3`}],[`path`,{d:`M5 16l4 -2`,key:`svg-4`}],[`path`,{d:`M15 14l4 2`,key:`svg-5`}],[`path`,{d:`M9 18h6`,key:`svg-6`}],[`path`,{d:`M10 8v.01`,key:`svg-7`}],[`path`,{d:`M14 8v.01`,key:`svg-8`}]]),d=n(),f=e();function p(){let e=(0,d.c)(3),n,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`h2`,{className:`text-3xl font-semibold tracking-tight`,children:`Get started in minutes`}),i=(0,f.jsx)(`p`,{className:`mt-4 max-w-lg text-muted-foreground`,children:`Self-host for free with a single command, or try the managed cloud version.`}),e[0]=n,e[1]=i):(n=e[0],i=e[1]);let o;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsx)(`div`,{className:`mx-auto max-w-6xl px-6 py-24`,children:(0,f.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[n,i,(0,f.jsx)(t,{to:s,className:a(r({size:`lg`}),`mt-8 px-8`),children:`Start Free`})]})})}),e[2]=o):o=e[2],o}var m=[{description:`Connect databases, analytics tools, and connectors without stitching together a custom control plane.`,icon:u,title:`Unified Access`},{description:`Run consistent workflows across databases, analytics, GitHub, and more from the same workspace.`,icon:l,title:`Cross-Source Coverage`},{description:`Manage data source connectivity, budgets, and team access from a single operational surface.`,icon:c,title:`Operational Control`}];function h(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`h2`,{className:`text-3xl font-semibold tracking-tight`,children:`One workspace for connected data`}),(0,f.jsx)(`p`,{className:`mt-4 text-muted-foreground`,children:`Replace scattered setup steps with a single, consistent control plane.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsxs)(`div`,{className:`mx-auto max-w-6xl px-6 py-24`,children:[t,(0,f.jsx)(`div`,{className:`mt-16 grid gap-8 md:grid-cols-3`,children:m.map(g)})]})}),e[1]=n):n=e[1],n}function g(e){return(0,f.jsxs)(`div`,{className:`flex flex-col rounded-lg border border-border p-6`,children:[(0,f.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-md bg-muted`,children:(0,f.jsx)(e.icon,{size:20,stroke:1.5,className:`size-5`})}),(0,f.jsx)(`h3`,{className:`mt-4 font-semibold`,children:e.title}),(0,f.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.description})]},e.title)}function _(){let e=(0,d.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(`footer`,{className:`border-t border-border`,children:(0,f.jsx)(`div`,{className:`mx-auto flex max-w-6xl items-center justify-center px-6 py-8`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:`flex h-6 w-6 items-center justify-center rounded bg-foreground text-background text-xs font-bold`,children:`V`}),(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`OneQuery - Autonomous Data Workspace`})]})})}),e[0]=t):t=e[0],t}function v(){let e=(0,d.c)(3),n,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`h1`,{className:`max-w-4xl text-4xl font-bold tracking-tight sm:text-5xl md:text-6xl`,children:`Your autonomous data workspace`}),i=(0,f.jsx)(`p`,{className:`mt-6 max-w-2xl text-lg text-muted-foreground md:text-xl`,children:`Connect your data sources, query them from one place, and keep your team aligned on the systems that matter. OneQuery gives you a clean control plane for operating your data access.`}),e[0]=n,e[1]=i):(n=e[0],i=e[1]);let o;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,f.jsx)(`section`,{className:`mx-auto max-w-6xl px-6 py-24 md:py-32`,children:(0,f.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[n,i,(0,f.jsx)(t,{to:s,className:a(r({size:`lg`}),`mt-10 px-8`),children:`Get Started`})]})}),e[2]=o):o=e[2],o}var y=[`PostgreSQL`,`MySQL`,`BigQuery`,`Google Analytics`,`Amplitude`,`Mixpanel`,`PostHog`,`GitHub`,`Linear`];function b(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`h2`,{className:`text-3xl font-semibold tracking-tight`,children:`Connect your stack`}),(0,f.jsx)(`p`,{className:`mt-4 text-muted-foreground`,children:`OneQuery integrates with the tools you already use.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsxs)(`div`,{className:`mx-auto max-w-6xl px-6 py-24`,children:[t,(0,f.jsx)(`div`,{className:`mt-12 flex flex-wrap items-center justify-center gap-x-8 gap-y-4`,children:y.map(x)})]})}),e[1]=n):n=e[1],n}function x(e){return(0,f.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:e},e)}function S(){let e=(0,d.c)(4),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsxs)(t,{to:`/`,className:`flex items-center gap-2`,children:[(0,f.jsx)(`img`,{src:`/onequery.svg`,alt:`OneQuery`,className:`h-8 w-8`}),(0,f.jsx)(`span`,{className:`font-semibold text-lg`,children:`OneQuery`})]}),e[0]=n):n=e[0];let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,f.jsx)(o,{}),e[1]=i):i=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,f.jsx)(t,{to:s,className:a(r({size:`sm`,variant:`ghost`}),`hidden sm:inline-flex`),children:`Sign in`}),e[2]=c):c=e[2];let l;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,f.jsx)(`header`,{className:`sticky top-0 z-50 w-full border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:(0,f.jsxs)(`div`,{className:`mx-auto flex h-14 max-w-6xl items-center justify-between px-6`,children:[n,(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,c,(0,f.jsx)(t,{to:s,className:r({size:`sm`,variant:`default`}),children:`Get Started`})]})]})}),e[3]=l):l=e[3],l}function C(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(S,{}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsxs)(`div`,{className:`flex h-screen flex-col overflow-y-auto`,children:[t,(0,f.jsxs)(`main`,{className:`flex-1`,children:[(0,f.jsx)(v,{}),(0,f.jsx)(h,{}),(0,f.jsx)(b,{}),(0,f.jsx)(p,{})]}),(0,f.jsx)(_,{})]}),e[1]=n):n=e[1],n}var w=C;export{w as component};
1
+ import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./link-Cgvqhh5w.js";import{t as n}from"./compiler-runtime-DCc3R3Xn.js";import{r,t as i}from"./createReactComponent-_L2mp4Ui.js";import{t as a}from"./utils-C8DGLIgm.js";import{t as o}from"./theme-toggle-XEe6wWso.js";import{o as s}from"./app-routes-CnJncMlZ.js";import{X as c}from"./index-CbFJKkNs.js";var l=i(`outline`,`git-compare`,`GitCompare`,[[`path`,{d:`M4 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M16 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M11 6h5a2 2 0 0 1 2 2v8`,key:`svg-2`}],[`path`,{d:`M14 9l-3 -3l3 -3`,key:`svg-3`}],[`path`,{d:`M13 18h-5a2 2 0 0 1 -2 -2v-8`,key:`svg-4`}],[`path`,{d:`M10 15l3 3l-3 3`,key:`svg-5`}]]),u=i(`outline`,`robot`,`Robot`,[[`path`,{d:`M6 6a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -4`,key:`svg-0`}],[`path`,{d:`M12 2v2`,key:`svg-1`}],[`path`,{d:`M9 12v9`,key:`svg-2`}],[`path`,{d:`M15 12v9`,key:`svg-3`}],[`path`,{d:`M5 16l4 -2`,key:`svg-4`}],[`path`,{d:`M15 14l4 2`,key:`svg-5`}],[`path`,{d:`M9 18h6`,key:`svg-6`}],[`path`,{d:`M10 8v.01`,key:`svg-7`}],[`path`,{d:`M14 8v.01`,key:`svg-8`}]]),d=n(),f=e();function p(){let e=(0,d.c)(3),n,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`h2`,{className:`text-3xl font-semibold tracking-tight`,children:`Get started in minutes`}),i=(0,f.jsx)(`p`,{className:`mt-4 max-w-lg text-muted-foreground`,children:`Self-host for free with a single command, or try the managed cloud version.`}),e[0]=n,e[1]=i):(n=e[0],i=e[1]);let o;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsx)(`div`,{className:`mx-auto max-w-6xl px-6 py-24`,children:(0,f.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[n,i,(0,f.jsx)(t,{to:s,className:a(r({size:`lg`}),`mt-8 px-8`),children:`Start Free`})]})})}),e[2]=o):o=e[2],o}var m=[{description:`Connect databases, analytics tools, and connectors without stitching together a custom control plane.`,icon:u,title:`Unified Access`},{description:`Run consistent workflows across databases, analytics, GitHub, and more from the same workspace.`,icon:l,title:`Cross-Source Coverage`},{description:`Manage data source connectivity, budgets, and team access from a single operational surface.`,icon:c,title:`Operational Control`}];function h(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`h2`,{className:`text-3xl font-semibold tracking-tight`,children:`One workspace for connected data`}),(0,f.jsx)(`p`,{className:`mt-4 text-muted-foreground`,children:`Replace scattered setup steps with a single, consistent control plane.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsxs)(`div`,{className:`mx-auto max-w-6xl px-6 py-24`,children:[t,(0,f.jsx)(`div`,{className:`mt-16 grid gap-8 md:grid-cols-3`,children:m.map(g)})]})}),e[1]=n):n=e[1],n}function g(e){return(0,f.jsxs)(`div`,{className:`flex flex-col rounded-lg border border-border p-6`,children:[(0,f.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-md bg-muted`,children:(0,f.jsx)(e.icon,{size:20,stroke:1.5,className:`size-5`})}),(0,f.jsx)(`h3`,{className:`mt-4 font-semibold`,children:e.title}),(0,f.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.description})]},e.title)}function _(){let e=(0,d.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(`footer`,{className:`border-t border-border`,children:(0,f.jsx)(`div`,{className:`mx-auto flex max-w-6xl items-center justify-center px-6 py-8`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:`flex h-6 w-6 items-center justify-center rounded bg-foreground text-background text-xs font-bold`,children:`V`}),(0,f.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`OneQuery - Autonomous Data Workspace`})]})})}),e[0]=t):t=e[0],t}function v(){let e=(0,d.c)(3),n,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`h1`,{className:`max-w-4xl text-4xl font-bold tracking-tight sm:text-5xl md:text-6xl`,children:`Your autonomous data workspace`}),i=(0,f.jsx)(`p`,{className:`mt-6 max-w-2xl text-lg text-muted-foreground md:text-xl`,children:`Connect your data sources, query them from one place, and keep your team aligned on the systems that matter. OneQuery gives you a clean control plane for operating your data access.`}),e[0]=n,e[1]=i):(n=e[0],i=e[1]);let o;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,f.jsx)(`section`,{className:`mx-auto max-w-6xl px-6 py-24 md:py-32`,children:(0,f.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[n,i,(0,f.jsx)(t,{to:s,className:a(r({size:`lg`}),`mt-10 px-8`),children:`Get Started`})]})}),e[2]=o):o=e[2],o}var y=[`PostgreSQL`,`MySQL`,`BigQuery`,`Google Analytics`,`Amplitude`,`Mixpanel`,`PostHog`,`GitHub`,`Linear`];function b(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`h2`,{className:`text-3xl font-semibold tracking-tight`,children:`Connect your stack`}),(0,f.jsx)(`p`,{className:`mt-4 text-muted-foreground`,children:`OneQuery integrates with the tools you already use.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsx)(`section`,{className:`border-t border-border`,children:(0,f.jsxs)(`div`,{className:`mx-auto max-w-6xl px-6 py-24`,children:[t,(0,f.jsx)(`div`,{className:`mt-12 flex flex-wrap items-center justify-center gap-x-8 gap-y-4`,children:y.map(x)})]})}),e[1]=n):n=e[1],n}function x(e){return(0,f.jsx)(`div`,{className:`text-sm font-medium text-muted-foreground`,children:e},e)}function S(){let e=(0,d.c)(4),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsxs)(t,{to:`/`,className:`flex items-center gap-2`,children:[(0,f.jsx)(`img`,{src:`/onequery.svg`,alt:`OneQuery`,className:`h-8 w-8`}),(0,f.jsx)(`span`,{className:`font-semibold text-lg`,children:`OneQuery`})]}),e[0]=n):n=e[0];let i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,f.jsx)(o,{}),e[1]=i):i=e[1];let c;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,f.jsx)(t,{to:s,className:a(r({size:`sm`,variant:`ghost`}),`hidden sm:inline-flex`),children:`Sign in`}),e[2]=c):c=e[2];let l;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,f.jsx)(`header`,{className:`sticky top-0 z-50 w-full border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`,children:(0,f.jsxs)(`div`,{className:`mx-auto flex h-14 max-w-6xl items-center justify-between px-6`,children:[n,(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,c,(0,f.jsx)(t,{to:s,className:r({size:`sm`,variant:`default`}),children:`Get Started`})]})]})}),e[3]=l):l=e[3],l}function C(){let e=(0,d.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,f.jsx)(S,{}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,f.jsxs)(`div`,{className:`flex h-screen flex-col overflow-y-auto`,children:[t,(0,f.jsxs)(`main`,{className:`flex-1`,children:[(0,f.jsx)(v,{}),(0,f.jsx)(h,{}),(0,f.jsx)(b,{}),(0,f.jsx)(p,{})]}),(0,f.jsx)(_,{})]}),e[1]=n):n=e[1],n}var w=C;export{w as component};
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./link-Cgvqhh5w.js";import{n as i}from"./useRouterState-DpT8luFk.js";import{a,o,t as s}from"./api-base-url-DIb6qukm.js";import{n as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./theme-toggle-Dbe9t-ev.js";import{i as u,n as d}from"./auth-client-BlMeXgb4.js";import{t as f}from"./useQuery-lzNVvWVk.js";import{d as p,l as m,o as h}from"./schemas-MsKXD_XQ.js";import{J as g,K as _,U as v,Y as y}from"./index-Cjh47nVg.js";import{t as b}from"./input-CG_cIxvO.js";import{t as x}from"./label-CWOhoN_L.js";import{a as S,n as C,o as w,r as T,t as E}from"./card-Bsy6azfK.js";import{n as D,t as O}from"./zod-C2fx2RN8.js";import{t as k}from"./auth-bootstrap-query-CrWpT3WV.js";var A=e(t(),1),j=n(),M=m({email:h(`Please enter a valid email`),password:p().min(8,`Password must be at least 8 characters`)}),N=m({email:h(`Please enter a valid email`),name:p().min(2,`Name must be at least 2 characters`),password:p().min(8,`Password must be at least 8 characters`)}),P=N.extend({organizationName:p().min(2,`Organization name must be at least 2 characters`),organizationSlug:p().min(2,`Organization slug must be at least 2 characters`).regex(/^[a-z0-9-]+$/,`Organization slug can only contain lowercase letters, numbers, and hyphens`)}),F=a(`/signin`);function I(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,`-`).replaceAll(/^-|-$/g,``)}function L(e,t){if(!(e instanceof Error))return t;let n=e.message.trim();return n.length>0?n:t}async function R(e){let t=await e.json().catch(()=>null),n=m({error:p().optional(),message:p().optional()}).safeParse(t);return n.data?.error??n.data?.message??`Failed to complete bootstrap`}function z(){let e=o(),t=v(),n=i(),[a,h]=(0,A.useState)(`signin`),[z,B]=(0,A.useState)(!1),{redirect:V}=F.useSearch(),H=y(V),U=f(k()).data,W=U?.signupMode===`first-user`,G=W?`signup`:a,K=D({defaultValues:{email:``,password:``},resolver:O(M)}),q=D({defaultValues:{name:``,email:``,password:``},resolver:O(N)}),J=D({defaultValues:{email:``,name:``,organizationName:``,organizationSlug:``,password:``},resolver:O(P)}),Y=typeof window>`u`?`your-host`:window.location.host;async function X(t){B(!0);try{let r=await d.email({email:t.email,password:t.password});if(r.error){console.error(`[auth] sign-in failed`,{error:r.error}),K.setError(`root`,{message:r.error.message??`Invalid email or password`}),B(!1);return}await n.invalidate(),await e({to:H.path})}catch(e){console.error(`[auth] sign-in failed`,{error:e}),K.setError(`root`,{message:L(e,`Couldn't sign in right now. Try again.`)}),B(!1)}}async function Z(t){B(!0);try{let n=await u.email({email:t.email,name:t.name,password:t.password});if(n.error){console.error(`[auth] sign-up failed`,{error:n.error}),q.setError(`root`,{message:n.error.message??`Failed to create account`}),B(!1);return}await e({to:_(V)})}catch(e){console.error(`[auth] sign-up failed`,{error:e}),q.setError(`root`,{message:L(e,`Couldn't create your account right now. Try again.`)}),B(!1)}}async function Q(r){B(!0);try{let i=await fetch(`${s()}/api/bootstrap/complete`,{body:JSON.stringify(r),credentials:`include`,headers:{"content-type":`application/json`},method:`POST`});if(!i.ok){J.setError(`root`,{message:await R(i)}),B(!1);return}let a=m({bootstrap:m({organizationId:p().min(1)})}).safeParse(await i.json().catch(()=>null));if(!a.success){J.setError(`root`,{message:`Bootstrap completed, but the response was invalid`}),B(!1);return}let o=g({organizationId:a.data.bootstrap.organizationId,redirectPath:V});await t.invalidateQueries({queryKey:k().queryKey}),await n.invalidate({sync:!0}),await e({to:_(o)})}catch(e){console.error(`[auth] bootstrap failed`,{error:e}),J.setError(`root`,{message:L(e,`Couldn't finish setup right now. Try again.`)}),B(!1)}}function $(){W||(h(a===`signin`?`signup`:`signin`),K.reset(),q.reset())}let ee=J.watch(`organizationName`);return(0,j.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,j.jsxs)(`header`,{className:`flex h-14 items-center justify-between px-6`,children:[(0,j.jsxs)(r,{to:`/`,className:`flex items-center gap-2`,children:[(0,j.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-md bg-foreground text-background font-bold`,children:`V`}),(0,j.jsx)(`span`,{className:`font-semibold text-lg`,children:`OneQuery`})]}),(0,j.jsx)(l,{})]}),(0,j.jsx)(`main`,{className:`flex flex-1 items-center justify-center p-6`,children:(0,j.jsxs)(E,{className:`w-full max-w-sm`,children:[(0,j.jsxs)(S,{className:`text-center`,children:[(0,j.jsx)(w,{className:`text-xl`,children:G===`signin`?`Sign in to OneQuery`:W?`Create the initial owner account`:`Create an account`}),(0,j.jsx)(T,{children:G===`signin`?`Enter your email and password to continue`:W?`Finish the first-run bootstrap by creating the owner account for this self-hosted server.`:U?.signupMode===`invite-only`?`Use the email address that received an invitation from your OneQuery admin.`:`Enter your details to get started`})]}),(0,j.jsx)(C,{children:G===`signin`?(0,j.jsxs)(`form`,{onSubmit:K.handleSubmit(X),className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`email`,children:`Email`}),(0,j.jsx)(b,{id:`email`,type:`email`,placeholder:`user@example.com`,autoComplete:`email`,...K.register(`email`)}),K.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`password`,children:`Password`}),(0,j.jsx)(b,{id:`password`,type:`password`,placeholder:`Enter your password`,autoComplete:`current-password`,...K.register(`password`)}),K.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.password.message})]}),K.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.root.message}),(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z,children:z?`Signing in...`:`Sign in`}),(0,j.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[U?.signupMode===`invite-only`?`Need an account? Ask an admin for an invitation, then use the invited email to sign up.`:`Don't have an account? `,U?.signupMode===`invite-only`?(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`I have an invitation`}):(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`Sign up`})]})]}):W?(0,j.jsxs)(`form`,{onSubmit:J.handleSubmit(Q),className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-name`,children:`Your name`}),(0,j.jsx)(b,{id:`bootstrap-name`,type:`text`,placeholder:`Jane Doe`,autoComplete:`name`,...J.register(`name`)}),J.formState.errors.name&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.name.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-email`,children:`Email`}),(0,j.jsx)(b,{id:`bootstrap-email`,type:`email`,placeholder:`owner@example.com`,autoComplete:`email`,...J.register(`email`)}),J.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-organization-name`,children:`Organization name`}),(0,j.jsx)(b,{id:`bootstrap-organization-name`,type:`text`,placeholder:`Acme Inc.`,...J.register(`organizationName`,{onChange:e=>{J.setValue(`organizationSlug`,I(e.target.value))}})}),J.formState.errors.organizationName&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.organizationName.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-organization-slug`,children:`URL slug`}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[Y,`/`]}),(0,j.jsx)(b,{id:`bootstrap-organization-slug`,placeholder:`acme`,...J.register(`organizationSlug`),className:`flex-1`})]}),J.formState.errors.organizationSlug&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.organizationSlug.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-password`,children:`Password`}),(0,j.jsx)(b,{id:`bootstrap-password`,type:`password`,placeholder:`Create a password`,autoComplete:`new-password`,...J.register(`password`)}),J.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.password.message})]}),J.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.root.message}),(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This setup screen is only available until the first owner account is created.`}),(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z||ee.trim().length===0,children:z?`Creating owner...`:`Create owner account`})]}):(0,j.jsxs)(`form`,{onSubmit:q.handleSubmit(Z),className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`name`,children:`Name`}),(0,j.jsx)(b,{id:`name`,type:`text`,placeholder:`John Doe`,autoComplete:`name`,...q.register(`name`)}),q.formState.errors.name&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.name.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`signup-email`,children:`Email`}),(0,j.jsx)(b,{id:`signup-email`,type:`email`,placeholder:`user@example.com`,autoComplete:`email`,...q.register(`email`)}),q.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`signup-password`,children:`Password`}),(0,j.jsx)(b,{id:`signup-password`,type:`password`,placeholder:`Create a password`,autoComplete:`new-password`,...q.register(`password`)}),q.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.password.message})]}),q.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.root.message}),U?.signupMode===`invite-only`?(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Account creation is limited to email addresses with a pending organization invitation.`}):null,(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z,children:z?`Creating account...`:W?`Create owner account`:`Create account`}),W?null:(0,j.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[`Already have an account?`,` `,(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`Sign in`})]})]})})]})})]})}var B=z;export{B as component};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./link-Cgvqhh5w.js";import{n as i}from"./useRouterState-DpT8luFk.js";import{a,o,t as s}from"./api-base-url-DIb6qukm.js";import{n as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./theme-toggle-XEe6wWso.js";import{i as u,n as d}from"./auth-client-BlMeXgb4.js";import{t as f}from"./useQuery-DcPzWABw.js";import{d as p,l as m,o as h}from"./schemas-MsKXD_XQ.js";import{J as g,K as _,U as v,Y as y}from"./index-CbFJKkNs.js";import{t as b}from"./input-CG_cIxvO.js";import{t as x}from"./label-CWOhoN_L.js";import{a as S,n as C,o as w,r as T,t as E}from"./card-Bsy6azfK.js";import{n as D,t as O}from"./zod-C2fx2RN8.js";import{t as k}from"./auth-bootstrap-query-CrWpT3WV.js";var A=e(t(),1),j=n(),M=m({email:h(`Please enter a valid email`),password:p().min(8,`Password must be at least 8 characters`)}),N=m({email:h(`Please enter a valid email`),name:p().min(2,`Name must be at least 2 characters`),password:p().min(8,`Password must be at least 8 characters`)}),P=N.extend({organizationName:p().min(2,`Organization name must be at least 2 characters`),organizationSlug:p().min(2,`Organization slug must be at least 2 characters`).regex(/^[a-z0-9-]+$/,`Organization slug can only contain lowercase letters, numbers, and hyphens`)}),F=a(`/signin`);function I(e){return e.toLowerCase().replaceAll(/[^a-z0-9]+/g,`-`).replaceAll(/^-|-$/g,``)}function L(e,t){if(!(e instanceof Error))return t;let n=e.message.trim();return n.length>0?n:t}async function R(e){let t=await e.json().catch(()=>null),n=m({error:p().optional(),message:p().optional()}).safeParse(t);return n.data?.error??n.data?.message??`Failed to complete bootstrap`}function z(){let e=o(),t=v(),n=i(),[a,h]=(0,A.useState)(`signin`),[z,B]=(0,A.useState)(!1),{redirect:V}=F.useSearch(),H=y(V),U=f(k()).data,W=U?.signupMode===`first-user`,G=W?`signup`:a,K=D({defaultValues:{email:``,password:``},resolver:O(M)}),q=D({defaultValues:{name:``,email:``,password:``},resolver:O(N)}),J=D({defaultValues:{email:``,name:``,organizationName:``,organizationSlug:``,password:``},resolver:O(P)}),Y=typeof window>`u`?`your-host`:window.location.host;async function X(t){B(!0);try{let r=await d.email({email:t.email,password:t.password});if(r.error){console.error(`[auth] sign-in failed`,{error:r.error}),K.setError(`root`,{message:r.error.message??`Invalid email or password`}),B(!1);return}await n.invalidate(),await e({to:H.path})}catch(e){console.error(`[auth] sign-in failed`,{error:e}),K.setError(`root`,{message:L(e,`Couldn't sign in right now. Try again.`)}),B(!1)}}async function Z(t){B(!0);try{let n=await u.email({email:t.email,name:t.name,password:t.password});if(n.error){console.error(`[auth] sign-up failed`,{error:n.error}),q.setError(`root`,{message:n.error.message??`Failed to create account`}),B(!1);return}await e({to:_(V)})}catch(e){console.error(`[auth] sign-up failed`,{error:e}),q.setError(`root`,{message:L(e,`Couldn't create your account right now. Try again.`)}),B(!1)}}async function Q(r){B(!0);try{let i=await fetch(`${s()}/api/bootstrap/complete`,{body:JSON.stringify(r),credentials:`include`,headers:{"content-type":`application/json`},method:`POST`});if(!i.ok){J.setError(`root`,{message:await R(i)}),B(!1);return}let a=m({bootstrap:m({organizationId:p().min(1)})}).safeParse(await i.json().catch(()=>null));if(!a.success){J.setError(`root`,{message:`Bootstrap completed, but the response was invalid`}),B(!1);return}let o=g({organizationId:a.data.bootstrap.organizationId,redirectPath:V});await t.invalidateQueries({queryKey:k().queryKey}),await n.invalidate({sync:!0}),await e({to:_(o)})}catch(e){console.error(`[auth] bootstrap failed`,{error:e}),J.setError(`root`,{message:L(e,`Couldn't finish setup right now. Try again.`)}),B(!1)}}function $(){W||(h(a===`signin`?`signup`:`signin`),K.reset(),q.reset())}let ee=J.watch(`organizationName`);return(0,j.jsxs)(`div`,{className:`flex min-h-screen flex-col`,children:[(0,j.jsxs)(`header`,{className:`flex h-14 items-center justify-between px-6`,children:[(0,j.jsxs)(r,{to:`/`,className:`flex items-center gap-2`,children:[(0,j.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-md bg-foreground text-background font-bold`,children:`V`}),(0,j.jsx)(`span`,{className:`font-semibold text-lg`,children:`OneQuery`})]}),(0,j.jsx)(l,{})]}),(0,j.jsx)(`main`,{className:`flex flex-1 items-center justify-center p-6`,children:(0,j.jsxs)(E,{className:`w-full max-w-sm`,children:[(0,j.jsxs)(S,{className:`text-center`,children:[(0,j.jsx)(w,{className:`text-xl`,children:G===`signin`?`Sign in to OneQuery`:W?`Create the initial owner account`:`Create an account`}),(0,j.jsx)(T,{children:G===`signin`?`Enter your email and password to continue`:W?`Finish the first-run bootstrap by creating the owner account for this self-hosted server.`:U?.signupMode===`invite-only`?`Use the email address that received an invitation from your OneQuery admin.`:`Enter your details to get started`})]}),(0,j.jsx)(C,{children:G===`signin`?(0,j.jsxs)(`form`,{onSubmit:K.handleSubmit(X),className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`email`,children:`Email`}),(0,j.jsx)(b,{id:`email`,type:`email`,placeholder:`user@example.com`,autoComplete:`email`,...K.register(`email`)}),K.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`password`,children:`Password`}),(0,j.jsx)(b,{id:`password`,type:`password`,placeholder:`Enter your password`,autoComplete:`current-password`,...K.register(`password`)}),K.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.password.message})]}),K.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:K.formState.errors.root.message}),(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z,children:z?`Signing in...`:`Sign in`}),(0,j.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[U?.signupMode===`invite-only`?`Need an account? Ask an admin for an invitation, then use the invited email to sign up.`:`Don't have an account? `,U?.signupMode===`invite-only`?(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`I have an invitation`}):(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`Sign up`})]})]}):W?(0,j.jsxs)(`form`,{onSubmit:J.handleSubmit(Q),className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-name`,children:`Your name`}),(0,j.jsx)(b,{id:`bootstrap-name`,type:`text`,placeholder:`Jane Doe`,autoComplete:`name`,...J.register(`name`)}),J.formState.errors.name&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.name.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-email`,children:`Email`}),(0,j.jsx)(b,{id:`bootstrap-email`,type:`email`,placeholder:`owner@example.com`,autoComplete:`email`,...J.register(`email`)}),J.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-organization-name`,children:`Organization name`}),(0,j.jsx)(b,{id:`bootstrap-organization-name`,type:`text`,placeholder:`Acme Inc.`,...J.register(`organizationName`,{onChange:e=>{J.setValue(`organizationSlug`,I(e.target.value))}})}),J.formState.errors.organizationName&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.organizationName.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-organization-slug`,children:`URL slug`}),(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[Y,`/`]}),(0,j.jsx)(b,{id:`bootstrap-organization-slug`,placeholder:`acme`,...J.register(`organizationSlug`),className:`flex-1`})]}),J.formState.errors.organizationSlug&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.organizationSlug.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`bootstrap-password`,children:`Password`}),(0,j.jsx)(b,{id:`bootstrap-password`,type:`password`,placeholder:`Create a password`,autoComplete:`new-password`,...J.register(`password`)}),J.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.password.message})]}),J.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:J.formState.errors.root.message}),(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This setup screen is only available until the first owner account is created.`}),(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z||ee.trim().length===0,children:z?`Creating owner...`:`Create owner account`})]}):(0,j.jsxs)(`form`,{onSubmit:q.handleSubmit(Z),className:`space-y-4`,children:[(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`name`,children:`Name`}),(0,j.jsx)(b,{id:`name`,type:`text`,placeholder:`John Doe`,autoComplete:`name`,...q.register(`name`)}),q.formState.errors.name&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.name.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`signup-email`,children:`Email`}),(0,j.jsx)(b,{id:`signup-email`,type:`email`,placeholder:`user@example.com`,autoComplete:`email`,...q.register(`email`)}),q.formState.errors.email&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.email.message})]}),(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(x,{htmlFor:`signup-password`,children:`Password`}),(0,j.jsx)(b,{id:`signup-password`,type:`password`,placeholder:`Create a password`,autoComplete:`new-password`,...q.register(`password`)}),q.formState.errors.password&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.password.message})]}),q.formState.errors.root&&(0,j.jsx)(`p`,{className:`text-sm text-destructive`,children:q.formState.errors.root.message}),U?.signupMode===`invite-only`?(0,j.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Account creation is limited to email addresses with a pending organization invitation.`}):null,(0,j.jsx)(c,{type:`submit`,className:`w-full`,disabled:z,children:z?`Creating account...`:W?`Create owner account`:`Create account`}),W?null:(0,j.jsxs)(`p`,{className:`text-center text-sm text-muted-foreground`,children:[`Already have an account?`,` `,(0,j.jsx)(`button`,{type:`button`,onClick:$,className:`text-foreground underline underline-offset-4 hover:text-foreground/80`,children:`Sign in`})]})]})})]})})]})}var B=z;export{B as component};
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,n as a,t as o}from"./api-base-url-DIb6qukm.js";import{n as s,t as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./IconCheck-Gc24xPT2.js";import{d as u,n as d,r as f,t as p}from"./dropdown-menu-C4YyrGG8.js";import{n as m,r as h,t as g}from"./checkbox-CJcCVDm9.js";import{t as _}from"./IconLoader2-B3B6M8nQ.js";import{t as v}from"./IconX-BQkA009b.js";import{l as y}from"./app-routes-CnJncMlZ.js";import{a as b,c as x,i as S,l as C,n as w,o as T,r as E,s as D,t as O,u as k}from"./use-optimistic-mutation-BT87RwFY.js";import{t as A}from"./useQuery-lzNVvWVk.js";import{t as j}from"./useSuspenseQuery-BLzbXzA6.js";import{d as M,l as N,m as P,o as F}from"./schemas-MsKXD_XQ.js";import{n as I}from"./src-DCIPwIx0.js";import{a as L,r as R}from"./organization-permissions-BQQ5PJbI.js";import{U as z,V as B,_ as ee,v as V,y as H}from"./index-Cjh47nVg.js";import{t as te}from"./input-CG_cIxvO.js";import{n as U,r as ne,t as re}from"./avatar-B8g7WJsq.js";import{t as ie}from"./format-date-Ctrh7my1.js";import{t as ae}from"./badge-C1_ZMBRy.js";import{t as oe}from"./label-CWOhoN_L.js";import{a as se,i as W,n as ce,o as G,r as K,t as le}from"./table-DCvfJyLS.js";import{a as ue,n as de,o as fe}from"./xstate-react.esm-BlF76DuP.js";import{r as q}from"./api-paths-ClEWWGwS.js";import{n as pe,t as me}from"./zod-C2fx2RN8.js";var he=c(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),ge=c(`outline`,`user-edit`,`UserEdit`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h3.5`,key:`svg-1`}],[`path`,{d:`M18.42 15.61a2.1 2.1 0 0 1 2.97 2.97l-3.39 3.42h-3v-3l3.42 -3.39`,key:`svg-2`}]]),_e=c(`outline`,`user-plus`,`UserPlus`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M16 19h6`,key:`svg-1`}],[`path`,{d:`M19 16v6`,key:`svg-2`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h4`,key:`svg-3`}]]),J=r(),Y=n();function ve(e){switch(e){case`owner`:return`default`;case`admin`:return`secondary`;case`member`:return`outline`}}function ye(e){switch(e){case`owner`:return`Owner`;case`admin`:return`Admin`;case`member`:return`Member`}}function be(e){let t=(0,J.c)(7),{role:n}=e,r;t[0]===n?r=t[1]:(r=ve(n),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=ye(n),t[2]=n,t[3]=i);let a;return t[4]!==r||t[5]!==i?(a=(0,Y.jsx)(ae,{variant:r,children:i}),t[4]=r,t[5]=i,t[6]=a):a=t[6],a}function xe(e){let t=(0,J.c)(9),{roleNames:n,rawRole:r,emptyLabel:i}=e;if(n.length===0){let e;t[0]!==i||t[1]!==r?(e=r?.trim()||i,t[0]=i,t[1]=r,t[2]=e):e=t[2];let n=e,a;return t[3]===n?a=t[4]:(a=n?(0,Y.jsx)(ae,{variant:`outline`,children:n}):null,t[3]=n,t[4]=a),a}let a;t[5]===n?a=t[6]:(a=n.map(Se),t[5]=n,t[6]=a);let o;return t[7]===a?o=t[8]:(o=(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:a}),t[7]=a,t[8]=o),o}function Se(e){return(0,Y.jsx)(be,{role:e},e)}var Ce=N({expiresAt:P().optional(),id:M(),role:M().optional()}),we=N({id:M(),role:M()}),Te=N({member:we});async function Ee(e,t){if((e.headers.get(`content-type`)??``).includes(`application/json`)){let n=await e.json().catch(()=>null),r=N({code:M().optional(),error:M().optional(),message:M().optional()}).safeParse(n);if(r.success)return r.data.error??r.data.message??t}return await e.text().catch(()=>``)||t}async function X(e){let t=await fetch(`${o()}${e.path}`,{body:e.body?JSON.stringify(e.body):void 0,credentials:`include`,headers:{"Content-Type":`application/json`},method:e.method});if(!t.ok)throw Error(await Ee(t,e.errorMessage));let n=await t.json().catch(()=>null),r=e.successSchema.safeParse(n);if(!r.success)throw Error(e.errorMessage);return r.data}async function De(e){return X({body:{email:e.email,role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to create invitation link`,method:`POST`,path:q(e.organizationId,`invitations`),successSchema:Ce})}async function Oe(e){return X({errorMessage:`Failed to cancel invitation`,method:`DELETE`,path:q(e.organizationId,`invitations`,e.invitationId),successSchema:Ce})}async function ke(e){return X({body:{role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to update role`,method:`PATCH`,path:q(e.organizationId,`members`,e.memberId,`role`),successSchema:we})}async function Ae(e){return X({errorMessage:`Failed to remove member`,method:`DELETE`,path:q(e.organizationId,`members`,e.memberId),successSchema:Te})}function je(e){let t=Date.parse(e)-Date.now();if(t<0)return`Expired`;let n=Math.floor(t/(1e3*60*60*24)),r=Math.floor(t%(1e3*60*60*24)/(1e3*60*60));return n>0?`Expires in ${n}d`:r>0?`Expires in ${r}h`:`Expires soon`}function Me(e){let t=(0,J.c)(31),{invitation:n,currentUserId:r,organizationId:i,canManageInvitationMutations:a}=e,o=n.id,c;t[0]!==n.id||t[1]!==i?(c=async()=>{await Oe({invitationId:n.id,organizationId:i})},t[0]=n.id,t[1]=i,t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==n.organizationId?(l=ee(r,n.organizationId),t[3]=r,t[4]=n.organizationId,t[5]=l):l=t[5];let u;t[6]!==n.id||t[7]!==c||t[8]!==l.queryKey?(u={errorMessage:`Failed to cancel invitation`,itemId:o,mutationFn:c,queryKey:l.queryKey,successMessage:`Invitation cancelled`},t[6]=n.id,t[7]=c,t[8]=l.queryKey,t[9]=u):u=t[9];let d=w(u),f=n.expiresAt?Date.parse(n.expiresAt)<Date.now():!1,p;t[10]===n.email?p=t[11]:(p=(0,Y.jsx)(K,{children:(0,Y.jsx)(`span`,{className:`font-medium`,children:n.email})}),t[10]=n.email,t[11]=p);let m;t[12]!==n.rawRole||t[13]!==n.roleNames?(m=(0,Y.jsx)(K,{children:(0,Y.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole,emptyLabel:`Member`})}),t[12]=n.rawRole,t[13]=n.roleNames,t[14]=m):m=t[14];let h=f?`text-destructive`:`text-muted-foreground`,g;t[15]===n.expiresAt?g=t[16]:(g=n.expiresAt?je(n.expiresAt):`Pending`,t[15]=n.expiresAt,t[16]=g);let y;t[17]!==h||t[18]!==g?(y=(0,Y.jsx)(K,{children:(0,Y.jsx)(`span`,{className:h,children:g})}),t[17]=h,t[18]=g,t[19]=y):y=t[19];let b;t[20]!==a||t[21]!==d||t[22]!==f?(b=a&&!f&&(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,onClick:()=>d.mutate(),disabled:d.isPending,title:`Cancel invitation`,children:d.isPending?(0,Y.jsx)(_,{size:16,className:`animate-spin`}):(0,Y.jsx)(v,{size:16,stroke:2})}),t[20]=a,t[21]=d,t[22]=f,t[23]=b):b=t[23];let x;t[24]===b?x=t[25]:(x=(0,Y.jsx)(K,{className:`text-right`,children:b}),t[24]=b,t[25]=x);let S;return t[26]!==x||t[27]!==p||t[28]!==m||t[29]!==y?(S=(0,Y.jsxs)(G,{children:[p,m,y,x]}),t[26]=x,t[27]=p,t[28]=m,t[29]=y,t[30]=S):S=t[30],S}function Ne(e){let t=(0,J.c)(31),{currentUserId:n,organizationId:r,canManageInvitationMutations:i}=e,a;t[0]!==n||t[1]!==r?(a=ee(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=A(a);if(o.isPending){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`Loading invitations...`}),t[3]=e):e=t[3],e}if(o.isLoadingError){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-destructive`,children:`Failed to load invitations.`}),t[4]=e):e=t[4],e}let s=o.data,c,l,u,d,f,p;if(t[5]!==i||t[6]!==n||t[7]!==s||t[8]!==r){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=s.filter(Pe);if(e.length===0){let e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No pending invitations.`}),t[15]=e):e=t[15],p=e;break bb0}f=`rounded-md border`,l=le,t[16]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(se,{children:(0,Y.jsxs)(G,{children:[(0,Y.jsx)(W,{children:`Email`}),(0,Y.jsx)(W,{children:`Role`}),(0,Y.jsx)(W,{children:`Status`}),(0,Y.jsx)(W,{className:`text-right w-[50px]`})]})}),t[16]=d):d=t[16],c=ce;let a;t[17]!==i||t[18]!==n||t[19]!==r?(a=e=>(0,Y.jsx)(Me,{invitation:e,currentUserId:n,organizationId:r,canManageInvitationMutations:i},e.id),t[17]=i,t[18]=n,t[19]=r,t[20]=a):a=t[20],u=e.map(a)}t[5]=i,t[6]=n,t[7]=s,t[8]=r,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f,t[14]=p}else c=t[9],l=t[10],u=t[11],d=t[12],f=t[13],p=t[14];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[21]!==c||t[22]!==u?(m=(0,Y.jsx)(c,{children:u}),t[21]=c,t[22]=u,t[23]=m):m=t[23];let h;t[24]!==l||t[25]!==d||t[26]!==m?(h=(0,Y.jsxs)(l,{children:[d,m]}),t[24]=l,t[25]=d,t[26]=m,t[27]=h):h=t[27];let g;return t[28]!==f||t[29]!==h?(g=(0,Y.jsx)(`div`,{className:f,children:h}),t[28]=f,t[29]=h,t[30]=g):g=t[30],g}function Pe(e){return e.status===`pending`}var Z=e(t(),1);function Fe(e){let t=(0,J.c)(11),{value:n,className:r}=e,[i,a]=(0,Z.useState)(!1),o,c;t[0]===i?(o=t[1],c=t[2]):(o=()=>{if(!i)return;let e=setTimeout(()=>{a(!1)},2e3);return()=>clearTimeout(e)},c=[i],t[0]=i,t[1]=o,t[2]=c),(0,Z.useEffect)(o,c);let u;t[3]===n?u=t[4]:(u=()=>{navigator.clipboard.writeText(n),a(!0)},t[3]=n,t[4]=u);let d=u,f;t[5]===i?f=t[6]:(f=i?(0,Y.jsx)(l,{size:16,stroke:2}):(0,Y.jsx)(he,{size:16,stroke:2}),t[5]=i,t[6]=f);let p;return t[7]!==r||t[8]!==d||t[9]!==f?(p=(0,Y.jsx)(s,{type:`button`,variant:`outline`,size:`icon`,onClick:d,title:`Copy`,className:r,children:f}),t[7]=r,t[8]=d,t[9]=f,t[10]=p):p=t[10],p}var Ie=[`admin`,`member`],Le=[{label:`Admin`,value:`admin`},{label:`Member`,value:`member`}],Re=[`member`],Q={RESET:`teamRoleSelection/reset`,SOURCE_ROLE_NAMES_SYNCED:`teamRoleSelection/sourceRoleNamesSynced`,TOGGLE_ROLE:`teamRoleSelection/toggleRole`};function $(e){let t=new Set;for(let n of e)(n===`admin`||n===`member`)&&t.add(n);return Ie.filter(e=>t.has(e))}var ze=ue({actions:{resetSelectedRoleNames:fe({selectedRoleNames:({context:e})=>e.sourceRoleNames}),syncSourceRoleNames:fe({selectedRoleNames:(e,t)=>[...t.roleNames],sourceRoleNames:(e,t)=>[...t.roleNames]}),toggleRoleName:fe({selectedRoleNames:({context:e},t)=>{let n=new Set(e.selectedRoleNames);return n.has(t.roleName)?n.delete(t.roleName):n.add(t.roleName),Ie.filter(e=>n.has(e))}})},types:{}}).createMachine({context:({input:e})=>{let t=$(e.initialRoleNames);return{selectedRoleNames:t,sourceRoleNames:t}},id:`teamRoleSelection`,initial:`ready`,on:{[Q.RESET]:{actions:`resetSelectedRoleNames`},[Q.SOURCE_ROLE_NAMES_SYNCED]:{actions:{type:`syncSourceRoleNames`,params:({event:e})=>({roleNames:$(e.roleNames)})}},[Q.TOGGLE_ROLE]:{actions:{type:`toggleRoleName`,params:({event:e})=>({roleName:e.roleName})}}},states:{ready:{}}});function Be(e){let t=(0,J.c)(21),n;t[0]===e.initialRoleNames?n=t[1]:(n=$(e.initialRoleNames),t[0]=e.initialRoleNames,t[1]=n);let r;t[2]===n?r=t[3]:(r={input:{initialRoleNames:n}},t[2]=n,t[3]=r);let[i,a]=de(ze,r),o;t[4]===i.context.selectedRoleNames?o=t[5]:(o=L(i.context.selectedRoleNames),t[4]=i.context.selectedRoleNames,t[5]=o);let s=o,c;t[6]===i.context.sourceRoleNames?c=t[7]:(c=L(i.context.sourceRoleNames),t[6]=i.context.sourceRoleNames,t[7]=c);let l=s!==c,u=i.context.selectedRoleNames.length===0,d;t[8]===a?d=t[9]:(d=()=>{a({type:Q.RESET})},t[8]=a,t[9]=d);let f=d,p;t[10]===a?p=t[11]:(p=e=>{a({type:Q.SOURCE_ROLE_NAMES_SYNCED,roleNames:e})},t[10]=a,t[11]=p);let m=p,h;t[12]===a?h=t[13]:(h=e=>{a({type:Q.TOGGLE_ROLE,roleName:e})},t[12]=a,t[13]=h);let g=h,_;return t[14]!==i.context.selectedRoleNames||t[15]!==g||t[16]!==l||t[17]!==u||t[18]!==f||t[19]!==m?(_={hasChanges:l,isSelectionEmpty:u,reset:f,resetToRoleNames:m,selectedRoleNames:i.context.selectedRoleNames,toggleRole:g},t[14]=i.context.selectedRoleNames,t[15]=g,t[16]=l,t[17]=u,t[18]=f,t[19]=m,t[20]=_):_=t[20],_}function Ve(e){return e instanceof HTMLElement&&e.closest(`[data-slot="checkbox"]`)!==null}function He(e){let t=(0,J.c)(12),{errorMessage:n,helperText:r,onToggleRole:i,selectedRoleNames:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(oe,{children:`Roles`}),t[0]=o):o=t[0];let s;t[1]!==i||t[2]!==a?(s=Le.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 rounded-md border px-3 py-2 text-left hover:bg-accent/40`,onClick:t=>{Ve(t.target)||i(e.value)},children:[(0,Y.jsx)(g,{checked:a.includes(e.value),onCheckedChange:()=>i(e.value)}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`p`,{className:`font-medium`,children:e.label})})]},e.value)),t[1]=i,t[2]=a,t[3]=s):s=t[3];let c;t[4]===s?c=t[5]:(c=(0,Y.jsx)(`div`,{className:`space-y-2`,children:s}),t[4]=s,t[5]=c);let l;t[6]!==n||t[7]!==r?(l=n?(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:n}):(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r}),t[6]=n,t[7]=r,t[8]=l):l=t[8];let u;return t[9]!==c||t[10]!==l?(u=(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[o,c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11],u}var Ue=N({email:F(`Please enter a valid email address`)});function We(e){let t=(0,J.c)(44),{children:n,currentUserId:r,organizationId:i}=e,[o,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={initialRoleNames:Re},t[0]=p):p=t[0];let m=Be(p),h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h={defaultValues:{email:``},resolver:me(Ue)},t[1]=h):h=t[1];let g=pe(h),_;t[2]===i?_=t[3]:(_=e=>({id:`temp-${crypto.randomUUID()}`,email:e.email,rawRole:L(e.roleNames),roleNames:[...e.roleNames],status:`pending`,expiresAt:I().toISOString(),organizationId:i,inviterId:`current-user`}),t[2]=i,t[3]=_);let v;t[4]===i?v=t[5]:(v=async e=>De({email:e.email,organizationId:i,roleNames:e.roleNames}),t[4]=i,t[5]=v);let w;t[6]!==g||t[7]!==m?(w=e=>{e?.id&&u({expiresAt:e.expiresAt??I().toISOString(),url:`${a()}${y(e.id)}`}),g.reset(),m.reset(),f(null)},t[6]=g,t[7]=m,t[8]=w):w=t[8];let k;t[9]!==r||t[10]!==i?(k=ee(r,i),t[9]=r,t[10]=i,t[11]=k):k=t[11];let A;t[12]!==_||t[13]!==v||t[14]!==w||t[15]!==k.queryKey?(A={createOptimisticItem:_,errorMessage:`Failed to create invitation link`,mutationFn:v,onSuccess:w,queryKey:k.queryKey,successMessage:`Invitation link created`},t[12]=_,t[13]=v,t[14]=w,t[15]=k.queryKey,t[16]=A):A=t[16];let j=O(A),M;t[17]!==j||t[18]!==m.isSelectionEmpty||t[19]!==m.selectedRoleNames?(M=e=>{if(m.isSelectionEmpty){f(`Select at least one role`);return}j.mutate({...e,roleNames:m.selectedRoleNames})},t[17]=j,t[18]=m.isSelectionEmpty,t[19]=m.selectedRoleNames,t[20]=M):M=t[20];let N=M,P;t[21]!==g||t[22]!==m?(P=e=>{c(e),e||(u(null),f(null),m.reset(),g.reset())},t[21]=g,t[22]=m,t[23]=P):P=t[23];let F=P,R;t[24]!==d||t[25]!==m?(R=e=>{d&&f(null),m.toggleRole(e)},t[24]=d,t[25]=m,t[26]=R):R=t[26];let z=R,B;t[27]===n?B=t[28]:(B=(0,Y.jsx)(C,{render:n}),t[27]=n,t[28]=B);let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Y.jsxs)(D,{children:[(0,Y.jsx)(x,{children:`Create Invitation Link`}),(0,Y.jsx)(b,{children:`Create a shareable invitation link for this organization. The recipient will sign in with an existing account or create their own before accepting.`})]}),t[29]=V):V=t[29];let H;t[30]!==g||t[31]!==z||t[32]!==l||t[33]!==j||t[34]!==N||t[35]!==d||t[36]!==m.isSelectionEmpty||t[37]!==m.selectedRoleNames?(H=(0,Y.jsxs)(S,{className:`sm:max-w-[400px]`,children:[V,l?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`space-y-2 pt-4`,children:[(0,Y.jsx)(oe,{children:`Invitation Link`}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(te,{value:l.url,readOnly:!0,className:`flex-1 text-sm`}),(0,Y.jsx)(Fe,{value:l.url})]}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Share this link with the invitee. They'll accept it after signing in or creating an account. The link expires on`,` `,ie(l.expiresAt),`.`]})]}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>u(null),children:`Create Another Link`}),(0,Y.jsx)(s,{type:`button`,onClick:()=>c(!1),children:`Done`})]})]}):(0,Y.jsxs)(`form`,{onSubmit:g.handleSubmit(N),className:`space-y-4 pt-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(oe,{htmlFor:`email`,children:`Email Address`}),(0,Y.jsx)(te,{id:`email`,type:`email`,placeholder:`colleague@example.com`,...g.register(`email`)}),g.formState.errors.email&&(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:g.formState.errors.email.message})]}),(0,Y.jsx)(He,{errorMessage:d,helperText:`Select one or more roles for this invitation.`,onToggleRole:z,selectedRoleNames:m.selectedRoleNames}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>c(!1),children:`Cancel`}),(0,Y.jsx)(s,{type:`submit`,disabled:j.isPending||m.isSelectionEmpty,children:j.isPending?`Creating Link...`:`Create Invitation Link`})]})]})]}),t[30]=g,t[31]=z,t[32]=l,t[33]=j,t[34]=N,t[35]=d,t[36]=m.isSelectionEmpty,t[37]=m.selectedRoleNames,t[38]=H):H=t[38];let U;return t[39]!==F||t[40]!==o||t[41]!==B||t[42]!==H?(U=(0,Y.jsxs)(E,{open:o,onOpenChange:F,children:[B,H]}),t[39]=F,t[40]=o,t[41]=B,t[42]=H,t[43]=U):U=t[43],U}function Ge({currentUserId:e,open:t,onOpenChange:n,member:r}){let i=z(),a=(0,Z.useMemo)(()=>$(r.roleNames),[L(r.roleNames)]),o=Be({initialRoleNames:a});(0,Z.useEffect)(()=>{t&&o.resetToRoleNames(a)},[a,r.id,t,o.resetToRoleNames]);let c=k({mutationFn:async()=>{await ke({memberId:r.id,organizationId:r.organizationId,roleNames:o.selectedRoleNames})},onError:e=>{B.error(e.message||`Failed to update role`)},onSuccess:()=>{B.success(`Role updated`),i.invalidateQueries({queryKey:V(e,r.organizationId).queryKey}),n(!1)}});return(0,Y.jsx)(E,{open:t,onOpenChange:n,children:(0,Y.jsxs)(S,{className:`sm:max-w-[400px]`,children:[(0,Y.jsxs)(D,{children:[(0,Y.jsx)(x,{children:`Change Role`}),(0,Y.jsxs)(b,{children:[`Update the role for `,r.user.name]})]}),(0,Y.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),!o.hasChanges){n(!1);return}c.mutate()},className:`space-y-4 pt-4`,children:[(0,Y.jsx)(He,{helperText:`Select one or more roles for this member.`,onToggleRole:o.toggleRole,selectedRoleNames:o.selectedRoleNames}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Y.jsx)(s,{type:`submit`,disabled:c.isPending||o.isSelectionEmpty,children:c.isPending?`Updating...`:`Update Role`})]})]})]})})}function Ke(e){return e.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2)}function qe(e){let t=(0,J.c)(51),{member:n,currentUserId:r,canManageMemberMutations:i}=e,[a,o]=(0,Z.useState)(!1),c=n.userId===r,l;t[0]===n.rawRole?l=t[1]:(l=R({roleName:`owner`,rawRole:n.rawRole}),t[0]=n.rawRole,t[1]=l);let g=l,_=n.id,v;t[2]!==n.id||t[3]!==n.organizationId?(v=async()=>{await Ae({memberId:n.id,organizationId:n.organizationId})},t[2]=n.id,t[3]=n.organizationId,t[4]=v):v=t[4];let y;t[5]!==r||t[6]!==n.organizationId?(y=V(r,n.organizationId),t[5]=r,t[6]=n.organizationId,t[7]=y):y=t[7];let b;t[8]!==n.id||t[9]!==v||t[10]!==y.queryKey?(b={errorMessage:`Failed to remove member`,itemId:_,mutationFn:v,queryKey:y.queryKey,successMessage:`Member removed`},t[8]=n.id,t[9]=v,t[10]=y.queryKey,t[11]=b):b=t[11];let x=w(b),S=i&&!g&&!c,C=i&&!g&&!c,T;t[12]===n.user.image?T=t[13]:(T=n.user.image&&(0,Y.jsx)(ne,{src:n.user.image}),t[12]=n.user.image,t[13]=T);let E;t[14]===n.user.name?E=t[15]:(E=Ke(n.user.name),t[14]=n.user.name,t[15]=E);let D;t[16]===E?D=t[17]:(D=(0,Y.jsx)(U,{children:E}),t[16]=E,t[17]=D);let O;t[18]!==T||t[19]!==D?(O=(0,Y.jsxs)(re,{size:`sm`,children:[T,D]}),t[18]=T,t[19]=D,t[20]=O):O=t[20];let k;t[21]===n.user.name?k=t[22]:(k=(0,Y.jsx)(`div`,{className:`font-medium`,children:n.user.name}),t[21]=n.user.name,t[22]=k);let A;t[23]===n.user.email?A=t[24]:(A=(0,Y.jsx)(`div`,{className:`text-muted-foreground text-sm`,children:n.user.email}),t[23]=n.user.email,t[24]=A);let j;t[25]!==k||t[26]!==A?(j=(0,Y.jsxs)(`div`,{children:[k,A]}),t[25]=k,t[26]=A,t[27]=j):j=t[27];let M;t[28]!==j||t[29]!==O?(M=(0,Y.jsx)(K,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[O,j]})}),t[28]=j,t[29]=O,t[30]=M):M=t[30];let N;t[31]!==n.rawRole||t[32]!==n.roleNames?(N=(0,Y.jsx)(K,{children:(0,Y.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole})}),t[31]=n.rawRole,t[32]=n.roleNames,t[33]=N):N=t[33];let P;t[34]!==S||t[35]!==C||t[36]!==x?(P=(S||C)&&(0,Y.jsxs)(p,{children:[(0,Y.jsx)(u,{children:(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,children:(0,Y.jsx)(h,{size:16,stroke:2})})}),(0,Y.jsxs)(d,{align:`end`,children:[S&&(0,Y.jsxs)(f,{onClick:()=>o(!0),children:[(0,Y.jsx)(ge,{size:16,stroke:2}),`Change Role`]}),C&&(0,Y.jsxs)(f,{onClick:()=>x.mutate(),disabled:x.isPending,className:`text-destructive focus:text-destructive`,children:[(0,Y.jsx)(m,{size:16,stroke:2}),x.isPending?`Removing...`:`Remove`]})]})]}),t[34]=S,t[35]=C,t[36]=x,t[37]=P):P=t[37];let F;t[38]===P?F=t[39]:(F=(0,Y.jsx)(K,{className:`text-right`,children:P}),t[38]=P,t[39]=F);let I;t[40]!==M||t[41]!==N||t[42]!==F?(I=(0,Y.jsxs)(G,{children:[M,N,F]}),t[40]=M,t[41]=N,t[42]=F,t[43]=I):I=t[43];let L;t[44]!==r||t[45]!==n||t[46]!==a?(L=(0,Y.jsx)(Ge,{open:a,onOpenChange:o,currentUserId:r,member:n}),t[44]=r,t[45]=n,t[46]=a,t[47]=L):L=t[47];let z;return t[48]!==I||t[49]!==L?(z=(0,Y.jsxs)(Y.Fragment,{children:[I,L]}),t[48]=I,t[49]=L,t[50]=z):z=t[50],z}function Je(e){let t=(0,J.c)(11),{members:n,currentUserId:r,canManageMemberMutations:i}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No members found.`}),t[0]=e):e=t[0],e}let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(se,{children:(0,Y.jsxs)(G,{children:[(0,Y.jsx)(W,{children:`Member`}),(0,Y.jsx)(W,{children:`Role`}),(0,Y.jsx)(W,{className:`text-right w-[50px]`})]})}),t[1]=a):a=t[1];let o;if(t[2]!==i||t[3]!==r||t[4]!==n){let e;t[6]!==i||t[7]!==r?(e=e=>(0,Y.jsx)(qe,{member:e,currentUserId:r,canManageMemberMutations:i},e.id),t[6]=i,t[7]=r,t[8]=e):e=t[8],o=n.map(e),t[2]=i,t[3]=r,t[4]=n,t[5]=o}else o=t[5];let s;return t[9]===o?s=t[10]:(s=(0,Y.jsx)(`div`,{className:`rounded-md border`,children:(0,Y.jsxs)(le,{children:[a,(0,Y.jsx)(ce,{children:o})]})}),t[9]=o,t[10]=s),s}var Ye=i(`/_authenticated/$org_slug/team`);function Xe(e){let t=(0,J.c)(27),n;t[0]!==e.currentUserId||t[1]!==e.organizationId?(n=V(e.currentUserId,e.organizationId),t[0]=e.currentUserId,t[1]=e.organizationId,t[2]=n):n=t[2];let{data:r}=j(n),i;t[3]!==r||t[4]!==e.currentUserId?(i=H({currentUserId:e.currentUserId,members:r}),t[3]=r,t[4]=e.currentUserId,t[5]=i):i=t[5];let{canInviteMembers:a,canManageMembershipMutations:o,canReadInvitations:c}=i,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Members`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`People who have access to this organization. Invite teammates to let them join with their own account.`})]}),t[6]=l):l=t[6];let u;t[7]!==a||t[8]!==o||t[9]!==e.currentUserId||t[10]!==e.organizationId?(u=a?(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:o?(0,Y.jsx)(We,{currentUserId:e.currentUserId,organizationId:e.organizationId,children:(0,Y.jsxs)(s,{children:[(0,Y.jsx)(_e,{size:16,stroke:2}),`Create Invitation Link`]})}):null}):null,t[7]=a,t[8]=o,t[9]=e.currentUserId,t[10]=e.organizationId,t[11]=u):u=t[11];let d;t[12]===u?d=t[13]:(d=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[l,u]}),t[12]=u,t[13]=d);let f;t[14]!==o||t[15]!==r||t[16]!==e.currentUserId?(f=(0,Y.jsx)(Je,{members:r,currentUserId:e.currentUserId,canManageMemberMutations:o}),t[14]=o,t[15]=r,t[16]=e.currentUserId,t[17]=f):f=t[17];let p;t[18]!==o||t[19]!==c||t[20]!==e.currentUserId||t[21]!==e.organizationId?(p=c?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold mb-2`,children:`Pending Invitations`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:`Invitations that haven't been accepted yet.`}),(0,Y.jsx)(Ne,{currentUserId:e.currentUserId,organizationId:e.organizationId,canManageInvitationMutations:o})]}):null,t[18]=o,t[19]=c,t[20]=e.currentUserId,t[21]=e.organizationId,t[22]=p):p=t[22];let m;return t[23]!==d||t[24]!==f||t[25]!==p?(m=(0,Y.jsxs)(`div`,{className:`space-y-8`,children:[d,f,p]}),t[23]=d,t[24]=f,t[25]=p,t[26]=m):m=t[26],m}function Ze(){let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsxs)(`div`,{className:`mb-8`,children:[(0,Y.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Team`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground mt-2`,children:`Manage your members and create invitation links for new teammates.`})]}),e[0]=t):t=e[0],t}function Qe(){let e=(0,J.c)(4),{organizationId:t,session:n}=Ye.useRouteContext(),r=n.user.id,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(Ze,{}),e[0]=i):i=e[0];let a;return e[1]!==r||e[2]!==t?(a=(0,Y.jsxs)(`div`,{className:`p-8`,children:[i,(0,Y.jsx)(Xe,{organizationId:t,currentUserId:r})]}),e[1]=r,e[2]=t,e[3]=a):a=e[3],a}var $e=Qe;export{$e as component};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,n as a,t as o}from"./api-base-url-DIb6qukm.js";import{n as s,t as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./IconCheck-Gc24xPT2.js";import{d as u,n as d,r as f,t as p}from"./dropdown-menu-BIqdY_8v.js";import{n as m,r as h,t as g}from"./checkbox-CJcCVDm9.js";import{t as _}from"./IconLoader2-B3B6M8nQ.js";import{t as v}from"./IconX-BQkA009b.js";import{l as y}from"./app-routes-CnJncMlZ.js";import{a as b,c as x,i as S,l as C,n as w,o as T,r as E,s as D,t as O,u as k}from"./use-optimistic-mutation-Uf_9TxpA.js";import{t as A}from"./useQuery-DcPzWABw.js";import{t as j}from"./useSuspenseQuery-BanVmJgY.js";import{d as M,l as N,m as P,o as F}from"./schemas-MsKXD_XQ.js";import{n as I}from"./src-DCIPwIx0.js";import{a as L,r as R}from"./organization-permissions-BQQ5PJbI.js";import{U as z,V as B,_ as ee,v as V,y as H}from"./index-CbFJKkNs.js";import{t as te}from"./input-CG_cIxvO.js";import{n as U,r as ne,t as re}from"./avatar-B8g7WJsq.js";import{t as ie}from"./format-date-Ctrh7my1.js";import{t as ae}from"./badge-C1_ZMBRy.js";import{t as oe}from"./label-CWOhoN_L.js";import{a as se,i as W,n as ce,o as G,r as K,t as le}from"./table-DCvfJyLS.js";import{a as ue,n as de,o as fe}from"./xstate-react.esm-BlF76DuP.js";import{r as q}from"./api-paths-ClEWWGwS.js";import{n as pe,t as me}from"./zod-C2fx2RN8.js";var he=c(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),ge=c(`outline`,`user-edit`,`UserEdit`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h3.5`,key:`svg-1`}],[`path`,{d:`M18.42 15.61a2.1 2.1 0 0 1 2.97 2.97l-3.39 3.42h-3v-3l3.42 -3.39`,key:`svg-2`}]]),_e=c(`outline`,`user-plus`,`UserPlus`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M16 19h6`,key:`svg-1`}],[`path`,{d:`M19 16v6`,key:`svg-2`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h4`,key:`svg-3`}]]),J=r(),Y=n();function ve(e){switch(e){case`owner`:return`default`;case`admin`:return`secondary`;case`member`:return`outline`}}function ye(e){switch(e){case`owner`:return`Owner`;case`admin`:return`Admin`;case`member`:return`Member`}}function be(e){let t=(0,J.c)(7),{role:n}=e,r;t[0]===n?r=t[1]:(r=ve(n),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=ye(n),t[2]=n,t[3]=i);let a;return t[4]!==r||t[5]!==i?(a=(0,Y.jsx)(ae,{variant:r,children:i}),t[4]=r,t[5]=i,t[6]=a):a=t[6],a}function xe(e){let t=(0,J.c)(9),{roleNames:n,rawRole:r,emptyLabel:i}=e;if(n.length===0){let e;t[0]!==i||t[1]!==r?(e=r?.trim()||i,t[0]=i,t[1]=r,t[2]=e):e=t[2];let n=e,a;return t[3]===n?a=t[4]:(a=n?(0,Y.jsx)(ae,{variant:`outline`,children:n}):null,t[3]=n,t[4]=a),a}let a;t[5]===n?a=t[6]:(a=n.map(Se),t[5]=n,t[6]=a);let o;return t[7]===a?o=t[8]:(o=(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:a}),t[7]=a,t[8]=o),o}function Se(e){return(0,Y.jsx)(be,{role:e},e)}var Ce=N({expiresAt:P().optional(),id:M(),role:M().optional()}),we=N({id:M(),role:M()}),Te=N({member:we});async function Ee(e,t){if((e.headers.get(`content-type`)??``).includes(`application/json`)){let n=await e.json().catch(()=>null),r=N({code:M().optional(),error:M().optional(),message:M().optional()}).safeParse(n);if(r.success)return r.data.error??r.data.message??t}return await e.text().catch(()=>``)||t}async function X(e){let t=await fetch(`${o()}${e.path}`,{body:e.body?JSON.stringify(e.body):void 0,credentials:`include`,headers:{"Content-Type":`application/json`},method:e.method});if(!t.ok)throw Error(await Ee(t,e.errorMessage));let n=await t.json().catch(()=>null),r=e.successSchema.safeParse(n);if(!r.success)throw Error(e.errorMessage);return r.data}async function De(e){return X({body:{email:e.email,role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to create invitation link`,method:`POST`,path:q(e.organizationId,`invitations`),successSchema:Ce})}async function Oe(e){return X({errorMessage:`Failed to cancel invitation`,method:`DELETE`,path:q(e.organizationId,`invitations`,e.invitationId),successSchema:Ce})}async function ke(e){return X({body:{role:e.roleNames.length===1?e.roleNames[0]:[...e.roleNames]},errorMessage:`Failed to update role`,method:`PATCH`,path:q(e.organizationId,`members`,e.memberId,`role`),successSchema:we})}async function Ae(e){return X({errorMessage:`Failed to remove member`,method:`DELETE`,path:q(e.organizationId,`members`,e.memberId),successSchema:Te})}function je(e){let t=Date.parse(e)-Date.now();if(t<0)return`Expired`;let n=Math.floor(t/(1e3*60*60*24)),r=Math.floor(t%(1e3*60*60*24)/(1e3*60*60));return n>0?`Expires in ${n}d`:r>0?`Expires in ${r}h`:`Expires soon`}function Me(e){let t=(0,J.c)(31),{invitation:n,currentUserId:r,organizationId:i,canManageInvitationMutations:a}=e,o=n.id,c;t[0]!==n.id||t[1]!==i?(c=async()=>{await Oe({invitationId:n.id,organizationId:i})},t[0]=n.id,t[1]=i,t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==n.organizationId?(l=ee(r,n.organizationId),t[3]=r,t[4]=n.organizationId,t[5]=l):l=t[5];let u;t[6]!==n.id||t[7]!==c||t[8]!==l.queryKey?(u={errorMessage:`Failed to cancel invitation`,itemId:o,mutationFn:c,queryKey:l.queryKey,successMessage:`Invitation cancelled`},t[6]=n.id,t[7]=c,t[8]=l.queryKey,t[9]=u):u=t[9];let d=w(u),f=n.expiresAt?Date.parse(n.expiresAt)<Date.now():!1,p;t[10]===n.email?p=t[11]:(p=(0,Y.jsx)(K,{children:(0,Y.jsx)(`span`,{className:`font-medium`,children:n.email})}),t[10]=n.email,t[11]=p);let m;t[12]!==n.rawRole||t[13]!==n.roleNames?(m=(0,Y.jsx)(K,{children:(0,Y.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole,emptyLabel:`Member`})}),t[12]=n.rawRole,t[13]=n.roleNames,t[14]=m):m=t[14];let h=f?`text-destructive`:`text-muted-foreground`,g;t[15]===n.expiresAt?g=t[16]:(g=n.expiresAt?je(n.expiresAt):`Pending`,t[15]=n.expiresAt,t[16]=g);let y;t[17]!==h||t[18]!==g?(y=(0,Y.jsx)(K,{children:(0,Y.jsx)(`span`,{className:h,children:g})}),t[17]=h,t[18]=g,t[19]=y):y=t[19];let b;t[20]!==a||t[21]!==d||t[22]!==f?(b=a&&!f&&(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,onClick:()=>d.mutate(),disabled:d.isPending,title:`Cancel invitation`,children:d.isPending?(0,Y.jsx)(_,{size:16,className:`animate-spin`}):(0,Y.jsx)(v,{size:16,stroke:2})}),t[20]=a,t[21]=d,t[22]=f,t[23]=b):b=t[23];let x;t[24]===b?x=t[25]:(x=(0,Y.jsx)(K,{className:`text-right`,children:b}),t[24]=b,t[25]=x);let S;return t[26]!==x||t[27]!==p||t[28]!==m||t[29]!==y?(S=(0,Y.jsxs)(G,{children:[p,m,y,x]}),t[26]=x,t[27]=p,t[28]=m,t[29]=y,t[30]=S):S=t[30],S}function Ne(e){let t=(0,J.c)(31),{currentUserId:n,organizationId:r,canManageInvitationMutations:i}=e,a;t[0]!==n||t[1]!==r?(a=ee(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=A(a);if(o.isPending){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`Loading invitations...`}),t[3]=e):e=t[3],e}if(o.isLoadingError){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-destructive`,children:`Failed to load invitations.`}),t[4]=e):e=t[4],e}let s=o.data,c,l,u,d,f,p;if(t[5]!==i||t[6]!==n||t[7]!==s||t[8]!==r){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=s.filter(Pe);if(e.length===0){let e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No pending invitations.`}),t[15]=e):e=t[15],p=e;break bb0}f=`rounded-md border`,l=le,t[16]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(se,{children:(0,Y.jsxs)(G,{children:[(0,Y.jsx)(W,{children:`Email`}),(0,Y.jsx)(W,{children:`Role`}),(0,Y.jsx)(W,{children:`Status`}),(0,Y.jsx)(W,{className:`text-right w-[50px]`})]})}),t[16]=d):d=t[16],c=ce;let a;t[17]!==i||t[18]!==n||t[19]!==r?(a=e=>(0,Y.jsx)(Me,{invitation:e,currentUserId:n,organizationId:r,canManageInvitationMutations:i},e.id),t[17]=i,t[18]=n,t[19]=r,t[20]=a):a=t[20],u=e.map(a)}t[5]=i,t[6]=n,t[7]=s,t[8]=r,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f,t[14]=p}else c=t[9],l=t[10],u=t[11],d=t[12],f=t[13],p=t[14];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[21]!==c||t[22]!==u?(m=(0,Y.jsx)(c,{children:u}),t[21]=c,t[22]=u,t[23]=m):m=t[23];let h;t[24]!==l||t[25]!==d||t[26]!==m?(h=(0,Y.jsxs)(l,{children:[d,m]}),t[24]=l,t[25]=d,t[26]=m,t[27]=h):h=t[27];let g;return t[28]!==f||t[29]!==h?(g=(0,Y.jsx)(`div`,{className:f,children:h}),t[28]=f,t[29]=h,t[30]=g):g=t[30],g}function Pe(e){return e.status===`pending`}var Z=e(t(),1);function Fe(e){let t=(0,J.c)(11),{value:n,className:r}=e,[i,a]=(0,Z.useState)(!1),o,c;t[0]===i?(o=t[1],c=t[2]):(o=()=>{if(!i)return;let e=setTimeout(()=>{a(!1)},2e3);return()=>clearTimeout(e)},c=[i],t[0]=i,t[1]=o,t[2]=c),(0,Z.useEffect)(o,c);let u;t[3]===n?u=t[4]:(u=()=>{navigator.clipboard.writeText(n),a(!0)},t[3]=n,t[4]=u);let d=u,f;t[5]===i?f=t[6]:(f=i?(0,Y.jsx)(l,{size:16,stroke:2}):(0,Y.jsx)(he,{size:16,stroke:2}),t[5]=i,t[6]=f);let p;return t[7]!==r||t[8]!==d||t[9]!==f?(p=(0,Y.jsx)(s,{type:`button`,variant:`outline`,size:`icon`,onClick:d,title:`Copy`,className:r,children:f}),t[7]=r,t[8]=d,t[9]=f,t[10]=p):p=t[10],p}var Ie=[`admin`,`member`],Le=[{label:`Admin`,value:`admin`},{label:`Member`,value:`member`}],Re=[`member`],Q={RESET:`teamRoleSelection/reset`,SOURCE_ROLE_NAMES_SYNCED:`teamRoleSelection/sourceRoleNamesSynced`,TOGGLE_ROLE:`teamRoleSelection/toggleRole`};function $(e){let t=new Set;for(let n of e)(n===`admin`||n===`member`)&&t.add(n);return Ie.filter(e=>t.has(e))}var ze=ue({actions:{resetSelectedRoleNames:fe({selectedRoleNames:({context:e})=>e.sourceRoleNames}),syncSourceRoleNames:fe({selectedRoleNames:(e,t)=>[...t.roleNames],sourceRoleNames:(e,t)=>[...t.roleNames]}),toggleRoleName:fe({selectedRoleNames:({context:e},t)=>{let n=new Set(e.selectedRoleNames);return n.has(t.roleName)?n.delete(t.roleName):n.add(t.roleName),Ie.filter(e=>n.has(e))}})},types:{}}).createMachine({context:({input:e})=>{let t=$(e.initialRoleNames);return{selectedRoleNames:t,sourceRoleNames:t}},id:`teamRoleSelection`,initial:`ready`,on:{[Q.RESET]:{actions:`resetSelectedRoleNames`},[Q.SOURCE_ROLE_NAMES_SYNCED]:{actions:{type:`syncSourceRoleNames`,params:({event:e})=>({roleNames:$(e.roleNames)})}},[Q.TOGGLE_ROLE]:{actions:{type:`toggleRoleName`,params:({event:e})=>({roleName:e.roleName})}}},states:{ready:{}}});function Be(e){let t=(0,J.c)(21),n;t[0]===e.initialRoleNames?n=t[1]:(n=$(e.initialRoleNames),t[0]=e.initialRoleNames,t[1]=n);let r;t[2]===n?r=t[3]:(r={input:{initialRoleNames:n}},t[2]=n,t[3]=r);let[i,a]=de(ze,r),o;t[4]===i.context.selectedRoleNames?o=t[5]:(o=L(i.context.selectedRoleNames),t[4]=i.context.selectedRoleNames,t[5]=o);let s=o,c;t[6]===i.context.sourceRoleNames?c=t[7]:(c=L(i.context.sourceRoleNames),t[6]=i.context.sourceRoleNames,t[7]=c);let l=s!==c,u=i.context.selectedRoleNames.length===0,d;t[8]===a?d=t[9]:(d=()=>{a({type:Q.RESET})},t[8]=a,t[9]=d);let f=d,p;t[10]===a?p=t[11]:(p=e=>{a({type:Q.SOURCE_ROLE_NAMES_SYNCED,roleNames:e})},t[10]=a,t[11]=p);let m=p,h;t[12]===a?h=t[13]:(h=e=>{a({type:Q.TOGGLE_ROLE,roleName:e})},t[12]=a,t[13]=h);let g=h,_;return t[14]!==i.context.selectedRoleNames||t[15]!==g||t[16]!==l||t[17]!==u||t[18]!==f||t[19]!==m?(_={hasChanges:l,isSelectionEmpty:u,reset:f,resetToRoleNames:m,selectedRoleNames:i.context.selectedRoleNames,toggleRole:g},t[14]=i.context.selectedRoleNames,t[15]=g,t[16]=l,t[17]=u,t[18]=f,t[19]=m,t[20]=_):_=t[20],_}function Ve(e){return e instanceof HTMLElement&&e.closest(`[data-slot="checkbox"]`)!==null}function He(e){let t=(0,J.c)(12),{errorMessage:n,helperText:r,onToggleRole:i,selectedRoleNames:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Y.jsx)(oe,{children:`Roles`}),t[0]=o):o=t[0];let s;t[1]!==i||t[2]!==a?(s=Le.map(e=>(0,Y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 rounded-md border px-3 py-2 text-left hover:bg-accent/40`,onClick:t=>{Ve(t.target)||i(e.value)},children:[(0,Y.jsx)(g,{checked:a.includes(e.value),onCheckedChange:()=>i(e.value)}),(0,Y.jsx)(`div`,{children:(0,Y.jsx)(`p`,{className:`font-medium`,children:e.label})})]},e.value)),t[1]=i,t[2]=a,t[3]=s):s=t[3];let c;t[4]===s?c=t[5]:(c=(0,Y.jsx)(`div`,{className:`space-y-2`,children:s}),t[4]=s,t[5]=c);let l;t[6]!==n||t[7]!==r?(l=n?(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:n}):(0,Y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r}),t[6]=n,t[7]=r,t[8]=l):l=t[8];let u;return t[9]!==c||t[10]!==l?(u=(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[o,c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11],u}var Ue=N({email:F(`Please enter a valid email address`)});function We(e){let t=(0,J.c)(44),{children:n,currentUserId:r,organizationId:i}=e,[o,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={initialRoleNames:Re},t[0]=p):p=t[0];let m=Be(p),h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h={defaultValues:{email:``},resolver:me(Ue)},t[1]=h):h=t[1];let g=pe(h),_;t[2]===i?_=t[3]:(_=e=>({id:`temp-${crypto.randomUUID()}`,email:e.email,rawRole:L(e.roleNames),roleNames:[...e.roleNames],status:`pending`,expiresAt:I().toISOString(),organizationId:i,inviterId:`current-user`}),t[2]=i,t[3]=_);let v;t[4]===i?v=t[5]:(v=async e=>De({email:e.email,organizationId:i,roleNames:e.roleNames}),t[4]=i,t[5]=v);let w;t[6]!==g||t[7]!==m?(w=e=>{e?.id&&u({expiresAt:e.expiresAt??I().toISOString(),url:`${a()}${y(e.id)}`}),g.reset(),m.reset(),f(null)},t[6]=g,t[7]=m,t[8]=w):w=t[8];let k;t[9]!==r||t[10]!==i?(k=ee(r,i),t[9]=r,t[10]=i,t[11]=k):k=t[11];let A;t[12]!==_||t[13]!==v||t[14]!==w||t[15]!==k.queryKey?(A={createOptimisticItem:_,errorMessage:`Failed to create invitation link`,mutationFn:v,onSuccess:w,queryKey:k.queryKey,successMessage:`Invitation link created`},t[12]=_,t[13]=v,t[14]=w,t[15]=k.queryKey,t[16]=A):A=t[16];let j=O(A),M;t[17]!==j||t[18]!==m.isSelectionEmpty||t[19]!==m.selectedRoleNames?(M=e=>{if(m.isSelectionEmpty){f(`Select at least one role`);return}j.mutate({...e,roleNames:m.selectedRoleNames})},t[17]=j,t[18]=m.isSelectionEmpty,t[19]=m.selectedRoleNames,t[20]=M):M=t[20];let N=M,P;t[21]!==g||t[22]!==m?(P=e=>{c(e),e||(u(null),f(null),m.reset(),g.reset())},t[21]=g,t[22]=m,t[23]=P):P=t[23];let F=P,R;t[24]!==d||t[25]!==m?(R=e=>{d&&f(null),m.toggleRole(e)},t[24]=d,t[25]=m,t[26]=R):R=t[26];let z=R,B;t[27]===n?B=t[28]:(B=(0,Y.jsx)(C,{render:n}),t[27]=n,t[28]=B);let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Y.jsxs)(D,{children:[(0,Y.jsx)(x,{children:`Create Invitation Link`}),(0,Y.jsx)(b,{children:`Create a shareable invitation link for this organization. The recipient will sign in with an existing account or create their own before accepting.`})]}),t[29]=V):V=t[29];let H;t[30]!==g||t[31]!==z||t[32]!==l||t[33]!==j||t[34]!==N||t[35]!==d||t[36]!==m.isSelectionEmpty||t[37]!==m.selectedRoleNames?(H=(0,Y.jsxs)(S,{className:`sm:max-w-[400px]`,children:[V,l?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`space-y-2 pt-4`,children:[(0,Y.jsx)(oe,{children:`Invitation Link`}),(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(te,{value:l.url,readOnly:!0,className:`flex-1 text-sm`}),(0,Y.jsx)(Fe,{value:l.url})]}),(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Share this link with the invitee. They'll accept it after signing in or creating an account. The link expires on`,` `,ie(l.expiresAt),`.`]})]}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>u(null),children:`Create Another Link`}),(0,Y.jsx)(s,{type:`button`,onClick:()=>c(!1),children:`Done`})]})]}):(0,Y.jsxs)(`form`,{onSubmit:g.handleSubmit(N),className:`space-y-4 pt-4`,children:[(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(oe,{htmlFor:`email`,children:`Email Address`}),(0,Y.jsx)(te,{id:`email`,type:`email`,placeholder:`colleague@example.com`,...g.register(`email`)}),g.formState.errors.email&&(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:g.formState.errors.email.message})]}),(0,Y.jsx)(He,{errorMessage:d,helperText:`Select one or more roles for this invitation.`,onToggleRole:z,selectedRoleNames:m.selectedRoleNames}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>c(!1),children:`Cancel`}),(0,Y.jsx)(s,{type:`submit`,disabled:j.isPending||m.isSelectionEmpty,children:j.isPending?`Creating Link...`:`Create Invitation Link`})]})]})]}),t[30]=g,t[31]=z,t[32]=l,t[33]=j,t[34]=N,t[35]=d,t[36]=m.isSelectionEmpty,t[37]=m.selectedRoleNames,t[38]=H):H=t[38];let U;return t[39]!==F||t[40]!==o||t[41]!==B||t[42]!==H?(U=(0,Y.jsxs)(E,{open:o,onOpenChange:F,children:[B,H]}),t[39]=F,t[40]=o,t[41]=B,t[42]=H,t[43]=U):U=t[43],U}function Ge({currentUserId:e,open:t,onOpenChange:n,member:r}){let i=z(),a=(0,Z.useMemo)(()=>$(r.roleNames),[L(r.roleNames)]),o=Be({initialRoleNames:a});(0,Z.useEffect)(()=>{t&&o.resetToRoleNames(a)},[a,r.id,t,o.resetToRoleNames]);let c=k({mutationFn:async()=>{await ke({memberId:r.id,organizationId:r.organizationId,roleNames:o.selectedRoleNames})},onError:e=>{B.error(e.message||`Failed to update role`)},onSuccess:()=>{B.success(`Role updated`),i.invalidateQueries({queryKey:V(e,r.organizationId).queryKey}),n(!1)}});return(0,Y.jsx)(E,{open:t,onOpenChange:n,children:(0,Y.jsxs)(S,{className:`sm:max-w-[400px]`,children:[(0,Y.jsxs)(D,{children:[(0,Y.jsx)(x,{children:`Change Role`}),(0,Y.jsxs)(b,{children:[`Update the role for `,r.user.name]})]}),(0,Y.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),!o.hasChanges){n(!1);return}c.mutate()},className:`space-y-4 pt-4`,children:[(0,Y.jsx)(He,{helperText:`Select one or more roles for this member.`,onToggleRole:o.toggleRole,selectedRoleNames:o.selectedRoleNames}),(0,Y.jsxs)(T,{children:[(0,Y.jsx)(s,{type:`button`,variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Y.jsx)(s,{type:`submit`,disabled:c.isPending||o.isSelectionEmpty,children:c.isPending?`Updating...`:`Update Role`})]})]})]})})}function Ke(e){return e.split(` `).map(e=>e[0]).join(``).toUpperCase().slice(0,2)}function qe(e){let t=(0,J.c)(51),{member:n,currentUserId:r,canManageMemberMutations:i}=e,[a,o]=(0,Z.useState)(!1),c=n.userId===r,l;t[0]===n.rawRole?l=t[1]:(l=R({roleName:`owner`,rawRole:n.rawRole}),t[0]=n.rawRole,t[1]=l);let g=l,_=n.id,v;t[2]!==n.id||t[3]!==n.organizationId?(v=async()=>{await Ae({memberId:n.id,organizationId:n.organizationId})},t[2]=n.id,t[3]=n.organizationId,t[4]=v):v=t[4];let y;t[5]!==r||t[6]!==n.organizationId?(y=V(r,n.organizationId),t[5]=r,t[6]=n.organizationId,t[7]=y):y=t[7];let b;t[8]!==n.id||t[9]!==v||t[10]!==y.queryKey?(b={errorMessage:`Failed to remove member`,itemId:_,mutationFn:v,queryKey:y.queryKey,successMessage:`Member removed`},t[8]=n.id,t[9]=v,t[10]=y.queryKey,t[11]=b):b=t[11];let x=w(b),S=i&&!g&&!c,C=i&&!g&&!c,T;t[12]===n.user.image?T=t[13]:(T=n.user.image&&(0,Y.jsx)(ne,{src:n.user.image}),t[12]=n.user.image,t[13]=T);let E;t[14]===n.user.name?E=t[15]:(E=Ke(n.user.name),t[14]=n.user.name,t[15]=E);let D;t[16]===E?D=t[17]:(D=(0,Y.jsx)(U,{children:E}),t[16]=E,t[17]=D);let O;t[18]!==T||t[19]!==D?(O=(0,Y.jsxs)(re,{size:`sm`,children:[T,D]}),t[18]=T,t[19]=D,t[20]=O):O=t[20];let k;t[21]===n.user.name?k=t[22]:(k=(0,Y.jsx)(`div`,{className:`font-medium`,children:n.user.name}),t[21]=n.user.name,t[22]=k);let A;t[23]===n.user.email?A=t[24]:(A=(0,Y.jsx)(`div`,{className:`text-muted-foreground text-sm`,children:n.user.email}),t[23]=n.user.email,t[24]=A);let j;t[25]!==k||t[26]!==A?(j=(0,Y.jsxs)(`div`,{children:[k,A]}),t[25]=k,t[26]=A,t[27]=j):j=t[27];let M;t[28]!==j||t[29]!==O?(M=(0,Y.jsx)(K,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[O,j]})}),t[28]=j,t[29]=O,t[30]=M):M=t[30];let N;t[31]!==n.rawRole||t[32]!==n.roleNames?(N=(0,Y.jsx)(K,{children:(0,Y.jsx)(xe,{roleNames:n.roleNames,rawRole:n.rawRole})}),t[31]=n.rawRole,t[32]=n.roleNames,t[33]=N):N=t[33];let P;t[34]!==S||t[35]!==C||t[36]!==x?(P=(S||C)&&(0,Y.jsxs)(p,{children:[(0,Y.jsx)(u,{children:(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,children:(0,Y.jsx)(h,{size:16,stroke:2})})}),(0,Y.jsxs)(d,{align:`end`,children:[S&&(0,Y.jsxs)(f,{onClick:()=>o(!0),children:[(0,Y.jsx)(ge,{size:16,stroke:2}),`Change Role`]}),C&&(0,Y.jsxs)(f,{onClick:()=>x.mutate(),disabled:x.isPending,className:`text-destructive focus:text-destructive`,children:[(0,Y.jsx)(m,{size:16,stroke:2}),x.isPending?`Removing...`:`Remove`]})]})]}),t[34]=S,t[35]=C,t[36]=x,t[37]=P):P=t[37];let F;t[38]===P?F=t[39]:(F=(0,Y.jsx)(K,{className:`text-right`,children:P}),t[38]=P,t[39]=F);let I;t[40]!==M||t[41]!==N||t[42]!==F?(I=(0,Y.jsxs)(G,{children:[M,N,F]}),t[40]=M,t[41]=N,t[42]=F,t[43]=I):I=t[43];let L;t[44]!==r||t[45]!==n||t[46]!==a?(L=(0,Y.jsx)(Ge,{open:a,onOpenChange:o,currentUserId:r,member:n}),t[44]=r,t[45]=n,t[46]=a,t[47]=L):L=t[47];let z;return t[48]!==I||t[49]!==L?(z=(0,Y.jsxs)(Y.Fragment,{children:[I,L]}),t[48]=I,t[49]=L,t[50]=z):z=t[50],z}function Je(e){let t=(0,J.c)(11),{members:n,currentUserId:r,canManageMemberMutations:i}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Y.jsx)(`div`,{className:`text-center py-8 text-muted-foreground`,children:`No members found.`}),t[0]=e):e=t[0],e}let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(se,{children:(0,Y.jsxs)(G,{children:[(0,Y.jsx)(W,{children:`Member`}),(0,Y.jsx)(W,{children:`Role`}),(0,Y.jsx)(W,{className:`text-right w-[50px]`})]})}),t[1]=a):a=t[1];let o;if(t[2]!==i||t[3]!==r||t[4]!==n){let e;t[6]!==i||t[7]!==r?(e=e=>(0,Y.jsx)(qe,{member:e,currentUserId:r,canManageMemberMutations:i},e.id),t[6]=i,t[7]=r,t[8]=e):e=t[8],o=n.map(e),t[2]=i,t[3]=r,t[4]=n,t[5]=o}else o=t[5];let s;return t[9]===o?s=t[10]:(s=(0,Y.jsx)(`div`,{className:`rounded-md border`,children:(0,Y.jsxs)(le,{children:[a,(0,Y.jsx)(ce,{children:o})]})}),t[9]=o,t[10]=s),s}var Ye=i(`/_authenticated/$org_slug/team`);function Xe(e){let t=(0,J.c)(27),n;t[0]!==e.currentUserId||t[1]!==e.organizationId?(n=V(e.currentUserId,e.organizationId),t[0]=e.currentUserId,t[1]=e.organizationId,t[2]=n):n=t[2];let{data:r}=j(n),i;t[3]!==r||t[4]!==e.currentUserId?(i=H({currentUserId:e.currentUserId,members:r}),t[3]=r,t[4]=e.currentUserId,t[5]=i):i=t[5];let{canInviteMembers:a,canManageMembershipMutations:o,canReadInvitations:c}=i,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold`,children:`Members`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`People who have access to this organization. Invite teammates to let them join with their own account.`})]}),t[6]=l):l=t[6];let u;t[7]!==a||t[8]!==o||t[9]!==e.currentUserId||t[10]!==e.organizationId?(u=a?(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:o?(0,Y.jsx)(We,{currentUserId:e.currentUserId,organizationId:e.organizationId,children:(0,Y.jsxs)(s,{children:[(0,Y.jsx)(_e,{size:16,stroke:2}),`Create Invitation Link`]})}):null}):null,t[7]=a,t[8]=o,t[9]=e.currentUserId,t[10]=e.organizationId,t[11]=u):u=t[11];let d;t[12]===u?d=t[13]:(d=(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[l,u]}),t[12]=u,t[13]=d);let f;t[14]!==o||t[15]!==r||t[16]!==e.currentUserId?(f=(0,Y.jsx)(Je,{members:r,currentUserId:e.currentUserId,canManageMemberMutations:o}),t[14]=o,t[15]=r,t[16]=e.currentUserId,t[17]=f):f=t[17];let p;t[18]!==o||t[19]!==c||t[20]!==e.currentUserId||t[21]!==e.organizationId?(p=c?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`text-xl font-semibold mb-2`,children:`Pending Invitations`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground mb-4`,children:`Invitations that haven't been accepted yet.`}),(0,Y.jsx)(Ne,{currentUserId:e.currentUserId,organizationId:e.organizationId,canManageInvitationMutations:o})]}):null,t[18]=o,t[19]=c,t[20]=e.currentUserId,t[21]=e.organizationId,t[22]=p):p=t[22];let m;return t[23]!==d||t[24]!==f||t[25]!==p?(m=(0,Y.jsxs)(`div`,{className:`space-y-8`,children:[d,f,p]}),t[23]=d,t[24]=f,t[25]=p,t[26]=m):m=t[26],m}function Ze(){let e=(0,J.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsxs)(`div`,{className:`mb-8`,children:[(0,Y.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Team`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground mt-2`,children:`Manage your members and create invitation links for new teammates.`})]}),e[0]=t):t=e[0],t}function Qe(){let e=(0,J.c)(4),{organizationId:t,session:n}=Ye.useRouteContext(),r=n.user.id,i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Y.jsx)(Ze,{}),e[0]=i):i=e[0];let a;return e[1]!==r||e[2]!==t?(a=(0,Y.jsxs)(`div`,{className:`p-8`,children:[i,(0,Y.jsx)(Xe,{organizationId:t,currentUserId:r})]}),e[1]=r,e[2]=t,e[3]=a):a=e[3],a}var $e=Qe;export{$e as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./compiler-runtime-DCc3R3Xn.js";import{n,t as r}from"./createReactComponent-_L2mp4Ui.js";import{a as i,d as a,i as o,n as s,t as c}from"./dropdown-menu-C4YyrGG8.js";import{H as l}from"./index-Cjh47nVg.js";var u=r(`outline`,`device-desktop`,`DeviceDesktop`,[[`path`,{d:`M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10`,key:`svg-0`}],[`path`,{d:`M7 20h10`,key:`svg-1`}],[`path`,{d:`M9 16v4`,key:`svg-2`}],[`path`,{d:`M15 16v4`,key:`svg-3`}]]),d=r(`outline`,`moon`,`Moon`,[[`path`,{d:`M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008`,key:`svg-0`}]]),f=r(`outline`,`sun`,`Sun`,[[`path`,{d:`M8 12a4 4 0 1 0 8 0a4 4 0 1 0 -8 0`,key:`svg-0`}],[`path`,{d:`M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7`,key:`svg-1`}]]),p=t(),m=e();function h(){let e=(0,p.c)(8),{theme:t,setTheme:r}=l(),h;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,m.jsx)(n,{variant:`ghost`,size:`icon`}),e[0]=h):h=e[0];let g;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,m.jsxs)(a,{render:h,"aria-label":`Toggle theme`,children:[(0,m.jsx)(f,{size:16,stroke:2,className:`rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,m.jsx)(d,{size:16,stroke:2,className:`absolute rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`})]}),e[1]=g):g=e[1];let _;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,m.jsxs)(i,{value:`light`,children:[(0,m.jsx)(f,{size:16,stroke:2,className:`mr-2`}),`Light`]}),e[2]=_):_=e[2];let v;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,m.jsxs)(i,{value:`dark`,children:[(0,m.jsx)(d,{size:16,stroke:2,className:`mr-2`}),`Dark`]}),e[3]=v):v=e[3];let y;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,m.jsxs)(i,{value:`system`,children:[(0,m.jsx)(u,{size:16,stroke:2,className:`mr-2`}),`System`]}),e[4]=y):y=e[4];let b;return e[5]!==r||e[6]!==t?(b=(0,m.jsxs)(c,{children:[g,(0,m.jsx)(s,{align:`end`,children:(0,m.jsxs)(o,{value:t,onValueChange:r,children:[_,v,y]})})]}),e[5]=r,e[6]=t,e[7]=b):b=e[7],b}export{h as t};
1
+ import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./compiler-runtime-DCc3R3Xn.js";import{n,t as r}from"./createReactComponent-_L2mp4Ui.js";import{a as i,d as a,i as o,n as s,t as c}from"./dropdown-menu-BIqdY_8v.js";import{H as l}from"./index-CbFJKkNs.js";var u=r(`outline`,`device-desktop`,`DeviceDesktop`,[[`path`,{d:`M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10`,key:`svg-0`}],[`path`,{d:`M7 20h10`,key:`svg-1`}],[`path`,{d:`M9 16v4`,key:`svg-2`}],[`path`,{d:`M15 16v4`,key:`svg-3`}]]),d=r(`outline`,`moon`,`Moon`,[[`path`,{d:`M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008`,key:`svg-0`}]]),f=r(`outline`,`sun`,`Sun`,[[`path`,{d:`M8 12a4 4 0 1 0 8 0a4 4 0 1 0 -8 0`,key:`svg-0`}],[`path`,{d:`M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7`,key:`svg-1`}]]),p=t(),m=e();function h(){let e=(0,p.c)(8),{theme:t,setTheme:r}=l(),h;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,m.jsx)(n,{variant:`ghost`,size:`icon`}),e[0]=h):h=e[0];let g;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,m.jsxs)(a,{render:h,"aria-label":`Toggle theme`,children:[(0,m.jsx)(f,{size:16,stroke:2,className:`rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,m.jsx)(d,{size:16,stroke:2,className:`absolute rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`})]}),e[1]=g):g=e[1];let _;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,m.jsxs)(i,{value:`light`,children:[(0,m.jsx)(f,{size:16,stroke:2,className:`mr-2`}),`Light`]}),e[2]=_):_=e[2];let v;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,m.jsxs)(i,{value:`dark`,children:[(0,m.jsx)(d,{size:16,stroke:2,className:`mr-2`}),`Dark`]}),e[3]=v):v=e[3];let y;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,m.jsxs)(i,{value:`system`,children:[(0,m.jsx)(u,{size:16,stroke:2,className:`mr-2`}),`System`]}),e[4]=y):y=e[4];let b;return e[5]!==r||e[6]!==t?(b=(0,m.jsxs)(c,{children:[g,(0,m.jsx)(s,{align:`end`,children:(0,m.jsxs)(o,{value:t,onValueChange:r,children:[_,v,y]})})]}),e[5]=r,e[6]=t,e[7]=b):b=e[7],b}export{h as t};
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,g as a,n as o,o as s,y as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./utils-C8DGLIgm.js";import{t as u}from"./IconX-BQkA009b.js";import{A as d,E as f,T as p,b as m,m as h,o as g}from"./removable-BfDesq3B.js";import{c as _,l as v}from"./getDisabledMountTransitionStyles-BYKRz4ha.js";import{t as y}from"./useBaseUiId-BLFGpnYJ.js";import{c as b}from"./getPseudoElementBounds-InhM-dWf.js";import{U as x,V as S,W as C,z as w}from"./index-Cjh47nVg.js";import{a as T,c as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./DialogTitle-BJlYCa5c.js";var N=class extends d{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),p(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&h(t.mutationKey)!==h(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??C();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){g.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},P=e(t(),1);function F(e,t){let n=x(t),[r]=P.useState(()=>new N(n,e));P.useEffect(()=>{r.setOptions(e)},[r,e]);let i=P.useSyncExternalStore(P.useCallback(e=>r.subscribe(g.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=P.useCallback((e,t)=>{r.mutate(e,t).catch(m)},[r]);if(i.error&&f(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var I=P.forwardRef(function(e,t){let{render:n,className:r,disabled:o=!1,nativeButton:l=!0,id:u,payload:d,handle:f,...p}=e,m=E(!0),h=f?.store??m?.store;if(!h)throw Error(c(79));let g=y(u),x=h.useState(`floatingRootContext`),S=h.useState(`isOpenedByTrigger`,g),C=P.useRef(null),{registerTrigger:T,isMountedByThisTrigger:D}=w(g,C,h,{payload:d}),{getButtonProps:O,buttonRef:k}=a({disabled:o,native:l}),A=v([b(x,{enabled:x!=null})]),j=P.useMemo(()=>({disabled:o,open:S}),[o,S]),M=h.useState(`triggerProps`,D);return i(`button`,e,{state:j,ref:[k,t,T,C],props:[A.getReferenceProps(),M,{[s]:``,id:g},p,O],stateAttributesMapping:_})}),L=r(),R=n();function z(e){let t=(0,L.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,R.jsx)(O,{"data-slot":`dialog`,...n}),t[2]=n,t[3]=r),r}function B(e){let t=(0,L.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,R.jsx)(I,{"data-slot":`dialog-trigger`,...n}),t[2]=n,t[3]=r),r}function V(e){let t=(0,L.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,R.jsx)(A,{"data-slot":`dialog-portal`,...n}),t[2]=n,t[3]=r),r}function H(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(j,{"data-slot":`dialog-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function U(e){let t=(0,L.c)(20),n,r,i,a,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5]):({className:r,children:n,showCloseButton:s,overlayClassName:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s);let c=s===void 0?!0:s,d;t[6]===i?d=t[7]:(d=(0,R.jsx)(H,{className:i}),t[6]=i,t[7]=d);let f;t[8]===r?f=t[9]:(f=l(`bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-xl p-4 text-sm ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none`,r),t[8]=r,t[9]=f);let p;t[10]===c?p=t[11]:(p=c&&(0,R.jsxs)(k,{"data-slot":`dialog-close`,render:(0,R.jsx)(o,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,R.jsx)(u,{}),(0,R.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[10]=c,t[11]=p);let m;t[12]!==n||t[13]!==a||t[14]!==f||t[15]!==p?(m=(0,R.jsxs)(D,{"data-slot":`dialog-content`,className:f,...a,children:[n,p]}),t[12]=n,t[13]=a,t[14]=f,t[15]=p,t[16]=m):m=t[16];let h;return t[17]!==d||t[18]!==m?(h=(0,R.jsxs)(V,{children:[d,m]}),t[17]=d,t[18]=m,t[19]=h):h=t[19],h}function W(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`gap-2 flex flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(`div`,{"data-slot":`dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function G(e){let t=(0,L.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,showCloseButton:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let s=a===void 0?!1:a,c;t[5]===r?c=t[6]:(c=l(`bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,r),t[5]=r,t[6]=c);let u;t[7]===s?u=t[8]:(u=s&&(0,R.jsx)(k,{render:(0,R.jsx)(o,{variant:`outline`}),children:`Close`}),t[7]=s,t[8]=u);let d;return t[9]!==n||t[10]!==i||t[11]!==c||t[12]!==u?(d=(0,R.jsxs)(`div`,{"data-slot":`dialog-footer`,className:c,...i,children:[n,u]}),t[9]=n,t[10]=i,t[11]=c,t[12]=u,t[13]=d):d=t[13],d}function K(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`text-sm leading-none font-medium`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(M,{"data-slot":`dialog-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function q(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(T,{"data-slot":`dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function J(e){let t=(0,L.c)(27),{mutationFn:n,queryKey:r,optimisticUpdate:i,onSuccess:a,onError:o,successMessage:s,errorMessage:c}=e,l=x(),u;t[0]!==c||t[1]!==o||t[2]!==l||t[3]!==r?(u=(e,t,n)=>{n?.previousData!==void 0&&l.setQueryData(r,n.previousData);let i=c??(e.message?e.message:`Operation failed`);S.error(i),o?.(e,t)},t[0]=c,t[1]=o,t[2]=l,t[3]=r,t[4]=u):u=t[4];let d;t[5]!==i||t[6]!==l||t[7]!==r?(d=async e=>{await l.cancelQueries({queryKey:r});let t=l.getQueryData(r);return t!==void 0&&l.setQueryData(r,t=>t===void 0?t:i(t,e)),{previousData:t}},t[5]=i,t[6]=l,t[7]=r,t[8]=d):d=t[8];let f;t[9]!==l||t[10]!==r?(f=()=>{l.invalidateQueries({queryKey:r})},t[9]=l,t[10]=r,t[11]=f):f=t[11];let p;t[12]!==a||t[13]!==s?(p=(e,t)=>{s&&S.success(s),a?.(e,t)},t[12]=a,t[13]=s,t[14]=p):p=t[14];let m;t[15]!==n||t[16]!==u||t[17]!==d||t[18]!==f||t[19]!==p?(m={mutationFn:n,onError:u,onMutate:d,onSettled:f,onSuccess:p},t[15]=n,t[16]=u,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h=F(m),g=h.mutate,_=h.mutateAsync,v;return t[21]!==h.isError||t[22]!==h.isPending||t[23]!==h.isSuccess||t[24]!==g||t[25]!==_?(v={isError:h.isError,isPending:h.isPending,isSuccess:h.isSuccess,mutate:g,mutateAsync:_},t[21]=h.isError,t[22]=h.isPending,t[23]=h.isSuccess,t[24]=g,t[25]=_,t[26]=v):v=t[26],v}function Y({mutationFn:e,queryKey:t,itemId:n,getId:r=e=>e.id,onSuccess:i,onError:a,successMessage:o,errorMessage:s=`Failed to delete`}){return J({errorMessage:s,mutationFn:async()=>e(),onError:a?e=>a(e):void 0,onSuccess:i?e=>i(e):void 0,optimisticUpdate:e=>e.filter(e=>r(e)!==n),queryKey:t,successMessage:o})}function X(e){let t=(0,L.c)(10),{mutationFn:n,queryKey:r,createOptimisticItem:i,onSuccess:a,onError:o,successMessage:s,errorMessage:c}=e,l;t[0]===i?l=t[1]:(l=(e,t)=>[...e,i(t)],t[0]=i,t[1]=l);let u;return t[2]!==c||t[3]!==n||t[4]!==o||t[5]!==a||t[6]!==r||t[7]!==s||t[8]!==l?(u={errorMessage:c,mutationFn:n,onError:o,onSuccess:a,optimisticUpdate:l,queryKey:r,successMessage:s},t[2]=c,t[3]=n,t[4]=o,t[5]=a,t[6]=r,t[7]=s,t[8]=l,t[9]=u):u=t[9],J(u)}export{q as a,K as c,U as i,B as l,Y as n,G as o,z as r,W as s,X as t,F as u};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,g as a,n as o,o as s,y as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./utils-C8DGLIgm.js";import{t as u}from"./IconX-BQkA009b.js";import{A as d,E as f,T as p,b as m,m as h,o as g}from"./removable-BfDesq3B.js";import{c as _,l as v}from"./getDisabledMountTransitionStyles-BYKRz4ha.js";import{t as y}from"./useBaseUiId-BLFGpnYJ.js";import{c as b}from"./getPseudoElementBounds-InhM-dWf.js";import{U as x,V as S,W as C,z as w}from"./index-CbFJKkNs.js";import{a as T,c as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./DialogTitle-C3t5rzfv.js";var N=class extends d{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),p(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&h(t.mutationKey)!==h(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??C();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){g.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},P=e(t(),1);function F(e,t){let n=x(t),[r]=P.useState(()=>new N(n,e));P.useEffect(()=>{r.setOptions(e)},[r,e]);let i=P.useSyncExternalStore(P.useCallback(e=>r.subscribe(g.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=P.useCallback((e,t)=>{r.mutate(e,t).catch(m)},[r]);if(i.error&&f(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var I=P.forwardRef(function(e,t){let{render:n,className:r,disabled:o=!1,nativeButton:l=!0,id:u,payload:d,handle:f,...p}=e,m=E(!0),h=f?.store??m?.store;if(!h)throw Error(c(79));let g=y(u),x=h.useState(`floatingRootContext`),S=h.useState(`isOpenedByTrigger`,g),C=P.useRef(null),{registerTrigger:T,isMountedByThisTrigger:D}=w(g,C,h,{payload:d}),{getButtonProps:O,buttonRef:k}=a({disabled:o,native:l}),A=v([b(x,{enabled:x!=null})]),j=P.useMemo(()=>({disabled:o,open:S}),[o,S]),M=h.useState(`triggerProps`,D);return i(`button`,e,{state:j,ref:[k,t,T,C],props:[A.getReferenceProps(),M,{[s]:``,id:g},p,O],stateAttributesMapping:_})}),L=r(),R=n();function z(e){let t=(0,L.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,R.jsx)(O,{"data-slot":`dialog`,...n}),t[2]=n,t[3]=r),r}function B(e){let t=(0,L.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,R.jsx)(I,{"data-slot":`dialog-trigger`,...n}),t[2]=n,t[3]=r),r}function V(e){let t=(0,L.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,R.jsx)(A,{"data-slot":`dialog-portal`,...n}),t[2]=n,t[3]=r),r}function H(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(j,{"data-slot":`dialog-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function U(e){let t=(0,L.c)(20),n,r,i,a,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],s=t[5]):({className:r,children:n,showCloseButton:s,overlayClassName:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s);let c=s===void 0?!0:s,d;t[6]===i?d=t[7]:(d=(0,R.jsx)(H,{className:i}),t[6]=i,t[7]=d);let f;t[8]===r?f=t[9]:(f=l(`bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-xl p-4 text-sm ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none`,r),t[8]=r,t[9]=f);let p;t[10]===c?p=t[11]:(p=c&&(0,R.jsxs)(k,{"data-slot":`dialog-close`,render:(0,R.jsx)(o,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,R.jsx)(u,{}),(0,R.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[10]=c,t[11]=p);let m;t[12]!==n||t[13]!==a||t[14]!==f||t[15]!==p?(m=(0,R.jsxs)(D,{"data-slot":`dialog-content`,className:f,...a,children:[n,p]}),t[12]=n,t[13]=a,t[14]=f,t[15]=p,t[16]=m):m=t[16];let h;return t[17]!==d||t[18]!==m?(h=(0,R.jsxs)(V,{children:[d,m]}),t[17]=d,t[18]=m,t[19]=h):h=t[19],h}function W(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`gap-2 flex flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(`div`,{"data-slot":`dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function G(e){let t=(0,L.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,showCloseButton:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let s=a===void 0?!1:a,c;t[5]===r?c=t[6]:(c=l(`bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,r),t[5]=r,t[6]=c);let u;t[7]===s?u=t[8]:(u=s&&(0,R.jsx)(k,{render:(0,R.jsx)(o,{variant:`outline`}),children:`Close`}),t[7]=s,t[8]=u);let d;return t[9]!==n||t[10]!==i||t[11]!==c||t[12]!==u?(d=(0,R.jsxs)(`div`,{"data-slot":`dialog-footer`,className:c,...i,children:[n,u]}),t[9]=n,t[10]=i,t[11]=c,t[12]=u,t[13]=d):d=t[13],d}function K(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`text-sm leading-none font-medium`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(M,{"data-slot":`dialog-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function q(e){let t=(0,L.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(T,{"data-slot":`dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function J(e){let t=(0,L.c)(27),{mutationFn:n,queryKey:r,optimisticUpdate:i,onSuccess:a,onError:o,successMessage:s,errorMessage:c}=e,l=x(),u;t[0]!==c||t[1]!==o||t[2]!==l||t[3]!==r?(u=(e,t,n)=>{n?.previousData!==void 0&&l.setQueryData(r,n.previousData);let i=c??(e.message?e.message:`Operation failed`);S.error(i),o?.(e,t)},t[0]=c,t[1]=o,t[2]=l,t[3]=r,t[4]=u):u=t[4];let d;t[5]!==i||t[6]!==l||t[7]!==r?(d=async e=>{await l.cancelQueries({queryKey:r});let t=l.getQueryData(r);return t!==void 0&&l.setQueryData(r,t=>t===void 0?t:i(t,e)),{previousData:t}},t[5]=i,t[6]=l,t[7]=r,t[8]=d):d=t[8];let f;t[9]!==l||t[10]!==r?(f=()=>{l.invalidateQueries({queryKey:r})},t[9]=l,t[10]=r,t[11]=f):f=t[11];let p;t[12]!==a||t[13]!==s?(p=(e,t)=>{s&&S.success(s),a?.(e,t)},t[12]=a,t[13]=s,t[14]=p):p=t[14];let m;t[15]!==n||t[16]!==u||t[17]!==d||t[18]!==f||t[19]!==p?(m={mutationFn:n,onError:u,onMutate:d,onSettled:f,onSuccess:p},t[15]=n,t[16]=u,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h=F(m),g=h.mutate,_=h.mutateAsync,v;return t[21]!==h.isError||t[22]!==h.isPending||t[23]!==h.isSuccess||t[24]!==g||t[25]!==_?(v={isError:h.isError,isPending:h.isPending,isSuccess:h.isSuccess,mutate:g,mutateAsync:_},t[21]=h.isError,t[22]=h.isPending,t[23]=h.isSuccess,t[24]=g,t[25]=_,t[26]=v):v=t[26],v}function Y({mutationFn:e,queryKey:t,itemId:n,getId:r=e=>e.id,onSuccess:i,onError:a,successMessage:o,errorMessage:s=`Failed to delete`}){return J({errorMessage:s,mutationFn:async()=>e(),onError:a?e=>a(e):void 0,onSuccess:i?e=>i(e):void 0,optimisticUpdate:e=>e.filter(e=>r(e)!==n),queryKey:t,successMessage:o})}function X(e){let t=(0,L.c)(10),{mutationFn:n,queryKey:r,createOptimisticItem:i,onSuccess:a,onError:o,successMessage:s,errorMessage:c}=e,l;t[0]===i?l=t[1]:(l=(e,t)=>[...e,i(t)],t[0]=i,t[1]=l);let u;return t[2]!==c||t[3]!==n||t[4]!==o||t[5]!==a||t[6]!==r||t[7]!==s||t[8]!==l?(u={errorMessage:c,mutationFn:n,onError:o,onSuccess:a,optimisticUpdate:l,queryKey:r,successMessage:s},t[2]=c,t[3]=n,t[4]=o,t[5]=a,t[6]=r,t[7]=s,t[8]=l,t[9]=u):u=t[9],J(u)}export{q as a,K as c,U as i,B as l,Y as n,G as o,z as r,W as s,X as t,F as u};
@@ -1 +1 @@
1
- import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{A as r,C as i,E as a,O as o,S as s,T as c,_ as l,b as u,c as d,g as f,k as p,o as m,s as h,w as g}from"./removable-BfDesq3B.js";import{G as _,U as v}from"./index-Cjh47nVg.js";var y=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=h(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),x(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return S(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return S(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!c(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&C(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let a=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||a!==this.#p)&&this.#v(a)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return T(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(f||this.#r.isStale||!l(e))return;let t=o(this.#r.dataUpdatedAt,e)+1;this.#d=p.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(f||i(this.options.enabled,this.#t)===!1||!l(this.#p)||this.#p===0)&&(this.#f=p.setInterval(()=>{(this.options.refetchIntervalInBackground||d.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(p.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(p.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,a=this.#r,o=this.#i,c=this.#a,l=e===n?this.#n:e.state,{state:u}=e,d={...u},f=!1,p;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&x(e,t),o=i&&C(e,n,t,r);(a||o)&&(d={...d,..._(u.data,e.options)}),t._optimisticResults===`isRestoring`&&(d.fetchStatus=`idle`)}let{error:m,errorUpdatedAt:g,status:v}=d;p=d.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&v===`pending`){let e;a?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=a.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(v=`success`,p=s(a?.data,e,t),f=!0)}if(t.select&&p!==void 0&&!y)if(a&&p===o?.data&&t.select===this.#c)p=this.#l;else try{this.#c=t.select,p=t.select(p),p=s(a?.data,p,t),this.#l=p,this.#s=null}catch(e){this.#s=e}this.#s&&(m=this.#s,p=this.#l,g=Date.now(),v=`error`);let b=d.fetchStatus===`fetching`,S=v===`pending`,T=v===`error`,E=S&&b,D=p!==void 0,O={status:v,fetchStatus:d.fetchStatus,isPending:S,isSuccess:v===`success`,isError:T,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:b,isRefetching:b&&!S,isLoadingError:T&&!D,isPaused:d.fetchStatus===`paused`,isPlaceholderData:f,isRefetchError:T&&D,isStale:w(e,t),refetch:this.refetch,promise:this.#o,isEnabled:i(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{i(this.#o=O.promise=h())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!c(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){m.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function b(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function x(e,t){return b(e,t)||e.state.data!==void 0&&S(e,t,t.refetchOnMount)}function S(e,t,n){if(i(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&w(e,t)}return!1}function C(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&w(e,n)}function w(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}function T(e,t){return!c(e.getCurrentResult(),t)}var E=e(t(),1),D=E.createContext(!1),O=()=>E.useContext(D);D.Provider,n();function k(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var A=E.createContext(k()),j=()=>E.useContext(A),M=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?a(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},N=e=>{E.useEffect(()=>{e.clearReset()},[e])},P=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||a(n,[e.error,r])),F=(e,t)=>t.state.data===void 0,I=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},L=(e,t)=>e.isLoading&&e.isFetching&&!t,R=(e,t)=>e?.suspense&&t.isPending,z=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function B(e,t,n){let r=O(),i=j(),a=v(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,I(o),M(o,i,s),N(i);let c=!a.getQueryCache().get(o.queryHash),[l]=E.useState(()=>new t(a,o)),d=l.getOptimisticResult(o),p=!r&&e.subscribed!==!1;if(E.useSyncExternalStore(E.useCallback(e=>{let t=p?l.subscribe(m.batchCalls(e)):u;return l.updateResult(),t},[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),E.useEffect(()=>{l.setOptions(o)},[o,l]),R(o,d))throw z(o,l,i);if(P({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!f&&L(d,r)&&(c?z(o,l,i):s?.promise)?.catch(u).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?d:l.trackResult(d)}export{F as n,y as r,B as t};
1
+ import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{A as r,C as i,E as a,O as o,S as s,T as c,_ as l,b as u,c as d,g as f,k as p,o as m,s as h,w as g}from"./removable-BfDesq3B.js";import{G as _,U as v}from"./index-CbFJKkNs.js";var y=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=h(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),x(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return S(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return S(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!c(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&C(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let a=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||a!==this.#p)&&this.#v(a)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return T(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(f||this.#r.isStale||!l(e))return;let t=o(this.#r.dataUpdatedAt,e)+1;this.#d=p.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(f||i(this.options.enabled,this.#t)===!1||!l(this.#p)||this.#p===0)&&(this.#f=p.setInterval(()=>{(this.options.refetchIntervalInBackground||d.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(p.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(p.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,a=this.#r,o=this.#i,c=this.#a,l=e===n?this.#n:e.state,{state:u}=e,d={...u},f=!1,p;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&x(e,t),o=i&&C(e,n,t,r);(a||o)&&(d={...d,..._(u.data,e.options)}),t._optimisticResults===`isRestoring`&&(d.fetchStatus=`idle`)}let{error:m,errorUpdatedAt:g,status:v}=d;p=d.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&v===`pending`){let e;a?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=a.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(v=`success`,p=s(a?.data,e,t),f=!0)}if(t.select&&p!==void 0&&!y)if(a&&p===o?.data&&t.select===this.#c)p=this.#l;else try{this.#c=t.select,p=t.select(p),p=s(a?.data,p,t),this.#l=p,this.#s=null}catch(e){this.#s=e}this.#s&&(m=this.#s,p=this.#l,g=Date.now(),v=`error`);let b=d.fetchStatus===`fetching`,S=v===`pending`,T=v===`error`,E=S&&b,D=p!==void 0,O={status:v,fetchStatus:d.fetchStatus,isPending:S,isSuccess:v===`success`,isError:T,isInitialLoading:E,isLoading:E,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:b,isRefetching:b&&!S,isLoadingError:T&&!D,isPaused:d.fetchStatus===`paused`,isPlaceholderData:f,isRefetchError:T&&D,isStale:w(e,t),refetch:this.refetch,promise:this.#o,isEnabled:i(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{i(this.#o=O.promise=h())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!c(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){m.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function b(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function x(e,t){return b(e,t)||e.state.data!==void 0&&S(e,t,t.refetchOnMount)}function S(e,t,n){if(i(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&w(e,t)}return!1}function C(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&w(e,n)}function w(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}function T(e,t){return!c(e.getCurrentResult(),t)}var E=e(t(),1),D=E.createContext(!1),O=()=>E.useContext(D);D.Provider,n();function k(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var A=E.createContext(k()),j=()=>E.useContext(A),M=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?a(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},N=e=>{E.useEffect(()=>{e.clearReset()},[e])},P=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||a(n,[e.error,r])),F=(e,t)=>t.state.data===void 0,I=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},L=(e,t)=>e.isLoading&&e.isFetching&&!t,R=(e,t)=>e?.suspense&&t.isPending,z=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function B(e,t,n){let r=O(),i=j(),a=v(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,I(o),M(o,i,s),N(i);let c=!a.getQueryCache().get(o.queryHash),[l]=E.useState(()=>new t(a,o)),d=l.getOptimisticResult(o),p=!r&&e.subscribed!==!1;if(E.useSyncExternalStore(E.useCallback(e=>{let t=p?l.subscribe(m.batchCalls(e)):u;return l.updateResult(),t},[l,p]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),E.useEffect(()=>{l.setOptions(o)},[o,l]),R(o,d))throw z(o,l,i);if(P({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!f&&L(d,r)&&(c?z(o,l,i):s?.promise)?.catch(u).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?d:l.trackResult(d)}export{F as n,y as r,B as t};
@@ -0,0 +1 @@
1
+ import{r as e,t}from"./useBaseQuery-C6Svq4OV.js";function n(n,r){return t(n,e,r)}export{n as t};
@@ -0,0 +1 @@
1
+ import{n as e,r as t,t as n}from"./useBaseQuery-C6Svq4OV.js";function r(r,i){return n({...r,enabled:!0,suspense:!0,throwOnError:e,placeholderData:void 0},t,i)}export{r as t};
@@ -2,6 +2,7 @@
2
2
  <html lang="en" suppressHydrationWarning>
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
+ <link rel="icon" href="/favicon.ico" sizes="any" />
5
6
  <link rel="icon" type="image/svg+xml" href="/onequery.svg" />
6
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
8
  <title>OneQuery - Autonomous Data Workspace</title>
@@ -17,7 +18,7 @@
17
18
  }
18
19
  })();
19
20
  </script>
20
- <script type="module" crossorigin src="/assets/index-Cjh47nVg.js"></script>
21
+ <script type="module" crossorigin src="/assets/index-CbFJKkNs.js"></script>
21
22
  <link rel="modulepreload" crossorigin href="/assets/jsx-runtime-DG_AJzB_.js">
22
23
  <link rel="modulepreload" crossorigin href="/assets/useRouterState-DpT8luFk.js">
23
24
  <link rel="modulepreload" crossorigin href="/assets/link-Cgvqhh5w.js">
@@ -38,7 +39,7 @@
38
39
  <link rel="modulepreload" crossorigin href="/assets/schemas-MsKXD_XQ.js">
39
40
  <link rel="modulepreload" crossorigin href="/assets/src-DCIPwIx0.js">
40
41
  <link rel="modulepreload" crossorigin href="/assets/organization-permissions-BQQ5PJbI.js">
41
- <link rel="stylesheet" crossorigin href="/assets/index-FAyK3-UK.css">
42
+ <link rel="stylesheet" crossorigin href="/assets/index-CqvU4VXr.css">
42
43
  </head>
43
44
  <body>
44
45
  <div id="root"></div>
@@ -0,0 +1,44 @@
1
+ <svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g filter="url(#filter0_i_3691_8)">
3
+ <rect width="1024" height="1024" rx="50" fill="#121212"/>
4
+ </g>
5
+ <g filter="url(#filter1_dii_3691_8)">
6
+ <path d="M777.575 213.695C783.436 202.511 797.012 204.944 804.988 213.542C832.07 242.697 844.414 274.301 845.576 313.7C848.976 344.016 823.928 378.134 823.25 405.147C822.932 417.962 836.272 455.924 839.521 471.767C851.891 531.527 845.876 588.692 825.112 638.649C792.672 716.609 724.307 777.001 633.845 802.289C627.887 803.957 606.993 811.264 595.681 811.435C593.659 809.678 591.988 808.175 590.504 806.643C586.797 802.819 584.197 798.806 582.475 790.577C576.462 761.851 565.572 742.488 552.5 728.694C539.535 715.013 524.906 707.352 512.631 701.389C508.167 699.222 502.791 701.083 500.622 705.546C498.454 710.01 500.316 715.386 504.779 717.555C516.696 723.343 528.84 729.853 539.456 741.055C549.965 752.144 559.467 768.381 564.884 794.259C565.643 797.883 566.583 801.067 567.7 803.926C567.753 804.136 567.807 804.347 567.859 804.559C568.149 805.72 568.921 807.208 570.01 808.942C571.697 812.075 573.668 814.807 575.934 817.361C583.391 827.554 592.744 840.549 589.301 849.25C588.633 850.884 587.512 852.367 585.832 853.646L584.542 854.182C542.454 871.307 492.199 854.982 457.768 825.212C431.931 801.036 417.374 772.448 409.011 747.292C406.283 738.743 404.159 730.282 402.055 721.389C399.947 711.286 398.787 702.566 398.055 696.033C397.502 691.101 393.056 687.55 388.124 688.102C383.193 688.655 379.642 693.102 380.194 698.033C382.587 719.381 389.53 765.525 419.415 808.243C264.274 766.874 185.888 636.408 218.245 482.062C226.539 442.525 234.708 410.908 214.29 373.915C196.651 341.967 174.56 301.709 185.259 264.218C186.771 258.868 188.641 252.993 191.078 247.297C195.502 236.986 201.796 227.277 211.234 222.362C235.523 208.496 259.135 228.196 283.424 228.569C288.013 228.638 301.104 224.629 306.261 223.288C366.037 207.819 430.169 240.224 458.067 294.166C466.748 310.948 472.457 330.939 475.886 349.532C480.932 375.439 476.578 404.566 488.784 428.814C499.857 451.32 516.309 451.209 538.151 448.97C586.522 443.979 632.599 455.551 676.573 475.112C700.641 485.826 719.637 490.181 736.806 475.75C743.138 470.136 747.058 455.627 744.338 444.233C744.077 442.94 743.732 441.633 743.292 440.314C735.412 416.771 706.146 412.54 686.543 403.595C653.338 388.444 634.328 360.699 621.361 327.645C617.085 316.968 609.257 291.712 613.977 280.836C615.037 278.449 616.976 276.563 619.378 275.572L619.306 275.522C619.345 275.506 619.383 275.488 619.421 275.472L619.394 275.453C619.723 275.372 620.051 275.292 620.378 275.214C621.001 275.02 621.634 274.878 622.276 274.785C657.082 267.268 688.732 280.794 711.874 297.722C715.549 300.029 719.387 303.229 723.06 306.696C730.398 313.128 736.473 319.608 741.021 325.271C742.984 323.682 745.749 322.3 747.576 322.311C747.571 322.281 747.566 322.25 747.561 322.22C747.58 322.217 747.6 322.215 747.619 322.212C743.222 294.634 746.649 273.762 755.471 253.188C760.956 240.422 768.516 227.767 777.575 213.695Z" fill="#D8E0E7"/>
7
+ <path d="M227.901 687.868C229.805 691.273 231.785 694.637 233.84 697.959C258.318 737.525 293.134 770.418 336.718 794.536C335.102 806.372 332.651 818.69 328.812 823.594C307.454 845.298 270.708 812.382 256.939 795.102C240.65 774.647 227.423 735.101 227.901 687.868Z" fill="#D8E0E7"/>
8
+ <path d="M336.017 256.593C349.178 253.234 362.587 261.197 365.933 274.357C369.292 287.532 361.315 300.928 348.141 304.273C334.98 307.619 321.598 299.656 318.253 286.495C314.907 273.334 322.856 259.952 336.017 256.593Z" fill="#121212"/>
9
+ </g>
10
+ <defs>
11
+ <filter id="filter0_i_3691_8" x="0" y="0" width="1028" height="1028" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
12
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
13
+ <feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
14
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
15
+ <feOffset dx="4" dy="4"/>
16
+ <feGaussianBlur stdDeviation="2"/>
17
+ <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
18
+ <feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.3 0"/>
19
+ <feBlend mode="normal" in2="shape" result="effect1_innerShadow_3691_8"/>
20
+ </filter>
21
+ <filter id="filter1_dii_3691_8" x="158.451" y="194.176" width="711.458" height="702.963" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
22
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
23
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
24
+ <feOffset dy="12"/>
25
+ <feGaussianBlur stdDeviation="12"/>
26
+ <feComposite in2="hardAlpha" operator="out"/>
27
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
28
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_3691_8"/>
29
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_3691_8" result="shape"/>
30
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
31
+ <feOffset dx="2" dy="3"/>
32
+ <feGaussianBlur stdDeviation="1.5"/>
33
+ <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
34
+ <feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/>
35
+ <feBlend mode="normal" in2="shape" result="effect2_innerShadow_3691_8"/>
36
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
37
+ <feOffset dx="-1" dy="-2"/>
38
+ <feGaussianBlur stdDeviation="1.5"/>
39
+ <feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/>
40
+ <feColorMatrix type="matrix" values="0 0 0 0 0.272434 0 0 0 0 0.290815 0 0 0 0 0.382724 0 0 0 0.36 0"/>
41
+ <feBlend mode="normal" in2="effect2_innerShadow_3691_8" result="effect3_innerShadow_3691_8"/>
42
+ </filter>
43
+ </defs>
44
+ </svg>