@onequery/cli 0.1.50-alpha.1-win32-x64 → 0.1.50-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.
- package/package.json +3 -3
- package/vendor/{x86_64-pc-windows-msvc/onequery/onequery.exe → aarch64-apple-darwin/onequery/onequery} +0 -0
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/_authenticated-CGmAYz8Z.js → aarch64-apple-darwin/runtime/dashboard/assets/_authenticated-DJ_4zmt8.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/_org_slug-f6xppY7b.js → aarch64-apple-darwin/runtime/dashboard/assets/_org_slug-COtToeSC.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/audit-LQg_2-5v.js → aarch64-apple-darwin/runtime/dashboard/assets/audit-L0p_sbmf.js} +1 -1
- package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/budget-CpNnCDvc.js +1 -0
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/callback-wu4tr9JD.js → aarch64-apple-darwin/runtime/dashboard/assets/callback-DX7qJ2z3.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/connect-database-3pvIA31m.js → aarch64-apple-darwin/runtime/dashboard/assets/connect-database-veJddN9s.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/create-org-DiO7zB9V.js → aarch64-apple-darwin/runtime/dashboard/assets/create-org-DcFcmY-G.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/data-source-connection-form-C0JyH5J3.js → aarch64-apple-darwin/runtime/dashboard/assets/data-source-connection-form-DGIyt0OF.js} +2 -2
- package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/device-GZIoJtbw.js +1 -0
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/dropdown-menu-CLot8VIw.js → aarch64-apple-darwin/runtime/dashboard/assets/dropdown-menu-1lFANFIg.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/home-CZKXq9HA.js → aarch64-apple-darwin/runtime/dashboard/assets/home-BL1SSXlH.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/index-C_q-gtGv.js → aarch64-apple-darwin/runtime/dashboard/assets/index-BZrWlEXZ.js} +2 -2
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/integrations-B2b7o-ye.js → aarch64-apple-darwin/runtime/dashboard/assets/integrations-B4PT4c-V.js} +1 -1
- package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/invite._invitationId-D0BbiY9f.js +1 -0
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/routes-BTttPHZm.js → aarch64-apple-darwin/runtime/dashboard/assets/routes-jr9opiO_.js} +1 -1
- package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/signin-VOTh7Maw.js +1 -0
- package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/team-CWGusGkh.js +1 -0
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/theme-toggle-CcB6O_vF.js → aarch64-apple-darwin/runtime/dashboard/assets/theme-toggle-CdJo4s34.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/use-optimistic-mutation-BCZ8tApt.js → aarch64-apple-darwin/runtime/dashboard/assets/use-optimistic-mutation-D88ezW6g.js} +1 -1
- package/vendor/{x86_64-pc-windows-msvc/runtime/dashboard/assets/useBaseQuery-B3PCmH7w.js → aarch64-apple-darwin/runtime/dashboard/assets/useBaseQuery-C_843G5v.js} +1 -1
- package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/useQuery-jz7A3Y4u.js +1 -0
- package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/useSuspenseQuery-BXj42YYV.js +1 -0
- package/vendor/aarch64-apple-darwin/runtime/dashboard/assets/xstate-react.esm--l_MSO73.js +1 -0
- package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/index.html +1 -1
- package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/server/onequery-server.mjs +328 -320
- package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/budget-jeO_g_0N.js +0 -1
- package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/device-DJhBvm-V.js +0 -1
- package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/invite._invitationId-Dt2OlNDo.js +0 -1
- package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/signin-DNF0ckUg.js +0 -1
- package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/team-BL56C5sF.js +0 -1
- package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/useQuery-Bj5cJCZc.js +0 -1
- package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/useSuspenseQuery-ZQGYM-g4.js +0 -1
- package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/xstate-react.esm-CfqAjJyu.js +0 -1
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/CompositeItem-CZdKsA45.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/CompositeList-C9xWKWEY.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/DialogTitle-DSjY6Xud.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconArrowRight-DsOD7mDl.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconCheck-Gc24xPT2.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconChevronDown-B-39MA7-.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconChevronRight-DD16tNHZ.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconCoins-C7Nn0L6R.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconDatabase-BLZDgpcN.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconHistory-k3NVXypq.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconLoader2-CZSIppar.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconPlus-Ie-KpLOF.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/IconX-Cg43mUxH.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/Separator-Di8cGnYl.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/alert-TnJXtO0T.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/api-base-url-DIb6qukm.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/api-client-F8Y7IuHn.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/api-paths-DcYkf-C_.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/app-routes-DM5pppqD.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/auth-bootstrap-query-KhD_VRw3.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/auth-client-Dj6z7Pcl.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/avatar-DoLsibq3.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/badge-D8XKsDus.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/card-CZCl7QNy.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/checkbox-BLYovhFU.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/compiler-runtime-DCc3R3Xn.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/createReactComponent-_L2mp4Ui.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/dist-Cg-lnuP8.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/empty-DjRo5ytz.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/format-date-B5v-Ga9z.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/getDisabledMountTransitionStyles-f3pOCbyk.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/getPseudoElementBounds-BpCtHFAC.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/index-ClbN-fUj.css +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/input-DSkIbIFK.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/jsx-runtime-DG_AJzB_.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/label-CUY3W2yp.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/link-Cgvqhh5w.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/matchContext-CDajBC0L.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/organization-permissions-PidGz2SY.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/organization-query-keys-Dl2dsKXD.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/query-timing-C8VVOl1e.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/queryOptions-LX_zDC40.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/removable-DwbP0VJV.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/schemas-K0ZhTj23.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/select-BSubTgC3.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/separator-CWjuJH0f.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/settings-B3gO4YZk.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/src-Cs2YIecp.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/table-mA0t_uVk.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/textarea-B57VG43g.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useBaseUiId-Cn1kR417.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useCompositeItem-DqawtL5i.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useControlled-C1S7R-1A.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useRender-DFMo54_d.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useRouterState-DpT8luFk.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/useValueChanged-CH03vPJ5.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/utils-C8DGLIgm.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/assets/zod-BgAmwIO1.js +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/favicon.ico +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/amplitude/step1_settings_sidebar.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/amplitude/step2_projects.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/amplitude/step3_project_keys.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/amplitude/step4_api_keys.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/bigquery/step1_service_accounts.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/bigquery/step2_bigquery_roles.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/bigquery/step3_add_key_menu.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/bigquery/step4_create_json_key.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/ga4/step1_service_accounts.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/ga4/step2_create_json_key.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/ga4/step3_add_user_viewer.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/ga4/step4_property_details.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/github-token-guide/step1_signin.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/github-token-guide/step2_new_fine_grained_token_sanitized.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/github-token-guide/step3_permissions_configured_sanitized.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/github-token-guide/step4_token_created_sanitized.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/mixpanel/step1_service_accounts.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/mixpanel/step2_create_service_account.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/mixpanel/step3_credentials.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/mixpanel/step4_project_settings.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/postgresql/step1_create_user.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/postgresql/step2_connection.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/posthog/step1_project_settings.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/posthog/step2_personal_api_keys.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/posthog/step3_create_key_modal.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/rds/step1_connect.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/rds/step2_create_user.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/rds/step3_grant.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/rds/step4_info.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/sentry/step1_personal_tokens.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/sentry/step2_create_token_permissions.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/sentry/step3_organization_slug.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/images/sentry/step4_project_slug.png +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/linear.svg +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/onequery.svg +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260327065242_curious_nightmare.sql +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260403103652_slippery_hellfire_club.sql +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260403112219_gigantic_namora.sql +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260420071232_previous_justin_hammer.sql +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260420093157_spooky_cassandra_nova.sql +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260420101631_even_ogun.sql +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260425110519_smart_amazoness.sql +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/20260428033542_rename_source_query_interface_missing.sql +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260327065242_snapshot.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260403103652_snapshot.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260403112219_snapshot.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260420071232_snapshot.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260420093157_snapshot.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260420101631_snapshot.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260425110519_snapshot.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/20260428033542_snapshot.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/migrations/meta/_journal.json +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/initdb.wasm +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/pglite.data +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/pglite/pglite.wasm +0 -0
- /package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/sql-parser/sql_parser_wasm_bg.wasm +0 -0
|
@@ -1 +0,0 @@
|
|
|
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{S as o,a as s,g as c,i as l,n as u,t as d,y as f}from"./createReactComponent-_L2mp4Ui.js";import{t as p}from"./utils-C8DGLIgm.js";import{t as m}from"./IconCheck-Gc24xPT2.js";import{t as h}from"./IconCoins-C7Nn0L6R.js";import{t as g}from"./IconLoader2-CZSIppar.js";import{t as _}from"./useSuspenseQuery-ZQGYM-g4.js";import{n as v}from"./CompositeList-C9xWKWEY.js";import{d as y,n as b,t as x}from"./useBaseUiId-Cn1kR417.js";import{A as S,C,J as w,L as T,M as E,S as D,c as O,d as k,f as A,j,l as ee,m as M,p as te,s as ne,u as N,w as re,x as ie,z as ae}from"./index-C_q-gtGv.js";import{t as P}from"./input-DSkIbIFK.js";import{t as F}from"./useControlled-C1S7R-1A.js";import{t as I}from"./CompositeItem-CZdKsA45.js";import{t as L}from"./badge-D8XKsDus.js";import{a as R,i as z,n as oe,r as se,t as ce}from"./empty-DjRo5ytz.js";import{t as le}from"./label-CUY3W2yp.js";import{a as B,n as V,o as H,r as U,t as W}from"./card-CZCl7QNy.js";import{n as ue}from"./textarea-B57VG43g.js";import{a as de,i as fe,n as pe,o as G}from"./xstate-react.esm-CfqAjJyu.js";import{n as me,t as he}from"./dist-Cg-lnuP8.js";var ge=d(`outline`,`receipt-2`,`Receipt2`,[[`path`,{d:`M5 21v-16a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v16l-3 -2l-2 2l-2 -2l-2 2l-2 -2l-3 2`,key:`svg-0`}],[`path`,{d:`M14 8h-2.5a1.5 1.5 0 0 0 0 3h1a1.5 1.5 0 0 1 0 3h-2.5m2 0v1.5m0 -9v1.5`,key:`svg-1`}]]),_e=d(`outline`,`stack-2`,`Stack2`,[[`path`,{d:`M12 4l-8 4l8 4l8 -4l-8 -4`,key:`svg-0`}],[`path`,{d:`M4 12l8 4l8 -4`,key:`svg-1`}],[`path`,{d:`M4 16l8 4l8 -4`,key:`svg-2`}]]),K=r(),q=e(t()),ve=new Intl.NumberFormat(`en-US`,{currency:`USD`,maximumFractionDigits:4,minimumFractionDigits:2,style:`currency`}),ye=new Intl.NumberFormat(`en-US`);function J(e){return ve.format(e)}function be(e){return ye.format(e)}function Y(e){return e===null||!Number.isFinite(e)?``:Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,``)}function xe(e){let[t=``,...n]=e.replaceAll(/[^0-9.]/g,``).split(`.`);return n.length===0?t:`${t}.${n.join(``).slice(0,2)}`}function X(e){let t=e.trim();if(t.length===0)return null;if(!/^\d+(\.\d{0,2})?$/.test(t))return`invalid`;let n=Number(t);return!Number.isFinite(n)||n<0?`invalid`:n}function Se(e){return e===null?null:Math.round(e*100)}function Ce(e){return e.isPending||e.parsedBudgetInput===`invalid`?!0:Se(e.parsedBudgetInput)===Se(e.currentBudgetUsd)}function we(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{day:`numeric`,month:`short`,timeZone:`UTC`})}function Te(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{day:`numeric`,hour:`numeric`,minute:`2-digit`,month:`short`})}function Ee(e){return e<=0?`0%`:e<10?`${e.toFixed(1)}%`:`${Math.round(e)}%`}function De(e){return e.map((e,t)=>`${t===0?`M`:`L`}${e.x},${e.y}`).join(` `)}var Z=n();function Oe(e){let t=(0,K.c)(12),{title:n,description:r,children:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(H,{children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Z.jsx)(U,{children:r}),t[2]=r,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,Z.jsxs)(B,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=(0,Z.jsx)(V,{children:i}),t[7]=i,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,Z.jsxs)(W,{children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function ke(e){let t=(0,K.c)(10),{dailyCost:n,totalSpendUsd:r}=e,i,a;if(t[0]!==n||t[1]!==r){let e=M(n),o=e.reduce(Ae,0);i=`space-y-3`;let s;t[4]!==o||t[5]!==r?(s=e=>{let t=o<=0?0:Math.max(e.totalCostUsd/o*100,2);return(0,Z.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`min-w-0 font-medium`,children:we(e.date)}),(0,Z.jsxs)(`div`,{className:`text-right`,children:[(0,Z.jsx)(`p`,{className:`font-medium tabular-nums`,children:J(e.totalCostUsd)}),(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[Ee(k(e.totalCostUsd,r)),` `,`of spend`]})]})]}),(0,Z.jsx)(`div`,{className:`h-2 rounded-full bg-muted/60`,children:(0,Z.jsx)(`div`,{className:`h-2 rounded-full bg-primary transition-all`,style:{width:`${t}%`}})})]},e.date)},t[4]=o,t[5]=r,t[6]=s):s=t[6],a=e.map(s),t[0]=n,t[1]=r,t[2]=i,t[3]=a}else i=t[2],a=t[3];let o;return t[7]!==i||t[8]!==a?(o=(0,Z.jsx)(`div`,{className:i,children:a}),t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function Ae(e,t){return Math.max(e,t.totalCostUsd)}function je(e){let t=(0,K.c)(48),{dailyCost:n,monthlyBudgetUsd:r,totalSpendUsd:i}=e,a,o,s,c,l,u;if(t[0]!==n||t[1]!==r){let e=N({dailyCost:n,monthlyBudgetUsd:r}),i=e.reduce(Fe,100),d=Math.max(100,Math.ceil(i/25)*25),f=e.map((t,n)=>{let r=e.length===1?50:n/Math.max(e.length-1,1)*100,i=100-t.usagePercent/d*100;return{date:t.date,x:r,y:i}}),p=f.length===0?``:De(f),m=f.length===0?``:`${p} L${f.at(-1)?.x??0},100 L${f[0]?.x??0},100 Z`,h=100-100/d*100,g;t[8]===d?g=t[9]:(g=Array.from({length:4},(e,t)=>d/4*(t+1)),t[8]=d,t[9]=g);let _=g,v=e.length<=3?e:[e[0],e[Math.floor((e.length-1)/2)],e.at(-1)].filter(Pe);u=`space-y-4`,s=`rounded-lg border bg-muted/10 p-4`;let y,b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`span`,{children:`0%`}),b=(0,Z.jsx)(`span`,{children:`100% target`}),t[10]=y,t[11]=b):(y=t[10],b=t[11]);let x;t[12]===d?x=t[13]:(x=Math.round(d),t[12]=d,t[13]=x),t[14]===x?c=t[15]:(c=(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3 text-xs text-muted-foreground`,children:[y,b,(0,Z.jsxs)(`span`,{children:[x,`% scale`]})]}),t[14]=x,t[15]=c);let S;t[16]!==_||t[17]!==d?(S=_.map(e=>{let t=100-e/d*100;return(0,Z.jsx)(`line`,{x1:`0`,y1:t,x2:`100`,y2:t,stroke:`var(--color-border)`,strokeDasharray:`2 3`,strokeWidth:`0.5`},e)}),t[16]=_,t[17]=d,t[18]=S):S=t[18];let C;t[19]===h?C=t[20]:(C=(0,Z.jsx)(`line`,{x1:`0`,y1:h,x2:`100`,y2:h,stroke:`var(--color-border)`,strokeDasharray:`4 3`,strokeWidth:`0.8`}),t[19]=h,t[20]=C);let w;t[21]===m?w=t[22]:(w=m.length>0?(0,Z.jsx)(`path`,{d:m,fill:`var(--color-chart-2)`,opacity:`0.18`}):null,t[21]=m,t[22]=w),l=(0,Z.jsx)(`div`,{className:`h-64 w-full`,children:(0,Z.jsxs)(`svg`,{viewBox:`0 0 100 100`,className:`h-full w-full overflow-visible`,role:`img`,"aria-label":`Budget usage percentage graph`,preserveAspectRatio:`none`,children:[S,C,w,p.length>0?(0,Z.jsx)(`path`,{d:p,fill:`none`,stroke:`var(--color-chart-2)`,strokeWidth:`1.8`,vectorEffect:`non-scaling-stroke`}):null,f.map(Ne)]})}),a=`mt-3 flex items-center justify-between gap-3 text-xs text-muted-foreground`,o=v.map(Me),t[0]=n,t[1]=r,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l,t[7]=u}else a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7];let d;t[23]!==a||t[24]!==o?(d=(0,Z.jsx)(`div`,{className:a,children:o}),t[23]=a,t[24]=o,t[25]=d):d=t[25];let f;t[26]!==s||t[27]!==c||t[28]!==l||t[29]!==d?(f=(0,Z.jsxs)(`div`,{className:s,children:[c,l,d]}),t[26]=s,t[27]=c,t[28]=l,t[29]=d,t[30]=f):f=t[30];let p;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`Cumulative spend`}),t[31]=p):p=t[31];let m;t[32]===i?m=t[33]:(m=J(i),t[32]=i,t[33]=m);let h;t[34]===m?h=t[35]:(h=(0,Z.jsxs)(`div`,{children:[p,(0,Z.jsx)(`p`,{className:`font-medium tabular-nums`,children:m})]}),t[34]=m,t[35]=h);let g;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`Limit`}),t[36]=g):g=t[36];let _;t[37]===r?_=t[38]:(_=J(r),t[37]=r,t[38]=_);let v;t[39]===_?v=t[40]:(v=(0,Z.jsxs)(`div`,{className:`text-right`,children:[g,(0,Z.jsx)(`p`,{className:`font-medium tabular-nums`,children:_})]}),t[39]=_,t[40]=v);let y;t[41]!==h||t[42]!==v?(y=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border bg-muted/15 p-3 text-sm`,children:[h,v]}),t[41]=h,t[42]=v,t[43]=y):y=t[43];let b;return t[44]!==y||t[45]!==u||t[46]!==f?(b=(0,Z.jsxs)(`div`,{className:u,children:[f,y]}),t[44]=y,t[45]=u,t[46]=f,t[47]=b):b=t[47],b}function Me(e){return(0,Z.jsx)(`span`,{children:we(e.date)},e.date)}function Ne(e){return(0,Z.jsx)(`circle`,{cx:e.x,cy:e.y,r:`1.6`,fill:`var(--color-chart-2)`},e.date)}function Pe(e){return e!==void 0}function Fe(e,t){return Math.max(e,t.usagePercent)}function Ie(e){let t=(0,K.c)(12),{data:n,budgetLimitState:r}=e;if(n.overview.queryCount===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(ce,{className:`border`,children:(0,Z.jsxs)(se,{children:[(0,Z.jsx)(z,{variant:`icon`,children:(0,Z.jsx)(h,{size:18,stroke:1.75})}),(0,Z.jsx)(R,{children:`No query-cost data yet`}),(0,Z.jsx)(oe,{children:"Run an agent workflow that executes database queries with stats enabled, then this dashboard will populate from `data_source_query_costs`."})]})}),t[0]=e):e=t[0],e}let i;t[1]!==r.kind||t[2]!==r.monthlyBudgetUsd||t[3]!==n.dailyCost||t[4]!==n.overview.totalCostUsd?(i=(0,Z.jsx)(Oe,{title:`Budget Usage`,description:`Cumulative spend as a percentage of your monthly budget.`,children:r.kind===`unlimited`?(0,Z.jsx)(`div`,{className:`flex h-72 items-center justify-center rounded-lg border border-dashed bg-muted/10 p-6 text-center text-sm text-muted-foreground`,children:`Set a monthly budget above to see how quickly the current window is consuming your monthly budget.`}):r.kind===`blocked`?(0,Z.jsxs)(`div`,{className:`flex h-72 items-center justify-center rounded-lg border border-dashed bg-muted/10 p-6 text-center text-sm text-muted-foreground`,children:[`Monthly budget is`,` `,J(r.monthlyBudgetUsd),`. Increase the limit to chart usage against an available budget.`]}):(0,Z.jsx)(je,{dailyCost:n.dailyCost,monthlyBudgetUsd:r.monthlyBudgetUsd,totalSpendUsd:n.overview.totalCostUsd})}),t[1]=r.kind,t[2]=r.monthlyBudgetUsd,t[3]=n.dailyCost,t[4]=n.overview.totalCostUsd,t[5]=i):i=t[5];let a;t[6]!==n.dailyCost||t[7]!==n.overview.totalCostUsd?(a=(0,Z.jsx)(Oe,{title:`Daily Spend`,description:`Latest daily costs inside the selected reporting window.`,children:(0,Z.jsx)(ke,{dailyCost:n.dailyCost,totalSpendUsd:n.overview.totalCostUsd})}),t[6]=n.dailyCost,t[7]=n.overview.totalCostUsd,t[8]=a):a=t[8];let o;return t[9]!==i||t[10]!==a?(o=(0,Z.jsx)(`div`,{className:`space-y-4`,children:(0,Z.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[1.1fr_0.9fr]`,children:[i,a]})}),t[9]=i,t[10]=a,t[11]=o):o=t[11],o}var Le=q.createContext(void 0);function Re(e=!0){let t=q.useContext(Le);if(t===void 0&&!e)throw Error(f(7));return t}var ze=q.forwardRef(function(e,t){let{className:n,defaultPressed:r=!1,disabled:i=!1,form:a,onPressedChange:l,pressed:u,render:d,type:f,value:p,nativeButton:m=!0,...h}=e,g=x(p||void 0),_=Re(),v=_?.value??[],S=_?void 0:r,C=(i||_?.disabled)??!1,[w,T]=F({controlled:_?v?.indexOf(g)>-1:u,default:S,name:`Toggle`,state:`pressed`}),E=o((e,t)=>{g&&_?.setGroupValue?.(g,e,t),l?.(e,t)}),{getButtonProps:D,buttonRef:O}=c({disabled:C,native:m}),k=q.useMemo(()=>({disabled:C,pressed:w}),[C,w]),A=[O,t],j=[{"aria-pressed":w,onClick(e){let t=!w,n=b(y,e.nativeEvent);E(t,n),!n.isCanceled&&T(t)}},h,D],ee=s(`button`,e,{enabled:!_,state:k,ref:A,props:j});return _?(0,Z.jsx)(I,{tag:`button`,render:d,className:n,state:k,refs:A,props:j}):ee}),Be=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e.multiple=`data-multiple`,e}({}),Ve={multiple(e){return e?{[Be.multiple]:``}:null}},He=q.forwardRef(function(e,t){let{defaultValue:n,disabled:r=!1,loopFocus:i=!0,onValueChange:a,orientation:c=`horizontal`,multiple:l=!1,value:u,className:d,render:f,...p}=e,m=v(!0),h=q.useMemo(()=>{if(u===void 0)return n??[]},[u,n]),g=(m?.disabled??!1)||r,[_,y]=F({controlled:u,default:h,name:`ToggleGroup`,state:`value`}),b=o((e,t,n)=>{let r;if(l?(r=_.slice(),t?r.push(e):r.splice(_.indexOf(e),1)):r=t?[e]:[],Array.isArray(r)){if(a?.(r,n),n.isCanceled)return;y(r)}}),x=q.useMemo(()=>({disabled:g,multiple:l,orientation:c}),[g,c,l]),S=q.useMemo(()=>({disabled:g,orientation:c,setGroupValue:b,value:_}),[g,c,b,_]),C={role:`group`},w=s(`div`,e,{enabled:!!m,state:x,ref:t,props:[C,p],stateAttributesMapping:Ve});return(0,Z.jsx)(Le.Provider,{value:S,children:m?w:(0,Z.jsx)(ue,{render:f,className:d,state:x,refs:[t],props:[C,p],stateAttributesMapping:Ve,loopFocus:i})})}),Ue=l(`hover:text-foreground aria-pressed:bg-muted focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[state=on]:bg-muted gap-1 rounded-lg text-sm font-medium transition-all [&_svg:not([class*='size-'])]:size-4 group/toggle hover:bg-muted inline-flex items-center justify-center whitespace-nowrap outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,outline:`border-input hover:bg-muted border bg-transparent`},size:{default:`h-8 min-w-8 px-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-1.5 text-[0.8rem]`,lg:`h-9 min-w-9 px-2.5`}},defaultVariants:{variant:`default`,size:`default`}}),We=q.createContext({size:`default`,variant:`default`,spacing:0,orientation:`horizontal`});function Ge(e){let t=(0,K.c)(29),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({className:r,variant:c,size:a,spacing:o,orientation:s,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?0:o,u=s===void 0?`horizontal`:s,d;t[8]===l?d=t[9]:(d={"--gap":l},t[8]=l,t[9]=d);let f=d,m;t[10]===r?m=t[11]:(m=p(`rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch`,r),t[10]=r,t[11]=m);let h;t[12]!==u||t[13]!==a||t[14]!==l||t[15]!==c?(h={variant:c,size:a,spacing:l,orientation:u},t[12]=u,t[13]=a,t[14]=l,t[15]=c,t[16]=h):h=t[16];let g;t[17]!==n||t[18]!==h?(g=(0,Z.jsx)(We.Provider,{value:h,children:n}),t[17]=n,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==u||t[21]!==i||t[22]!==a||t[23]!==l||t[24]!==f||t[25]!==m||t[26]!==g||t[27]!==c?(_=(0,Z.jsx)(He,{"data-slot":`toggle-group`,"data-variant":c,"data-size":a,"data-spacing":l,"data-orientation":u,style:f,className:m,...i,children:g}),t[20]=u,t[21]=i,t[22]=a,t[23]=l,t[24]=f,t[25]=m,t[26]=g,t[27]=c,t[28]=_):_=t[28],_}function Ke(e){let t=(0,K.c)(19),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,variant:a,size:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?`default`:a,c=o===void 0?`default`:o,l=q.useContext(We),u=l.variant||s,d=l.size||c,f=l.spacing,m;t[6]!==r||t[7]!==l.size||t[8]!==l.variant||t[9]!==c||t[10]!==s?(m=p(`group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg shrink-0 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,Ue({variant:l.variant||s,size:l.size||c}),r),t[6]=r,t[7]=l.size,t[8]=l.variant,t[9]=c,t[10]=s,t[11]=m):m=t[11];let h;return t[12]!==n||t[13]!==l.spacing||t[14]!==i||t[15]!==u||t[16]!==d||t[17]!==m?(h=(0,Z.jsx)(ze,{"data-slot":`toggle-group-item`,"data-variant":u,"data-size":d,"data-spacing":f,className:m,...i,children:n}),t[12]=n,t[13]=l.spacing,t[14]=i,t[15]=u,t[16]=d,t[17]=m,t[18]=h):h=t[18],h}function qe(e){switch(e.kind){case`unlimited`:return`No budget set`;case`blocked`:return`No spend allowed`;case`limited`:return`${J(e.monthlyBudgetUsd)} / month`}return e}function Je(e){let t=(0,K.c)(23),{budgetLimitState:n,generatedAt:r,isWindowChangePending:i,selectedDays:a,onWindowChange:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Budget`}),t[0]=s):s=t[0];let c;t[1]===n?c=t[2]:(c=qe(n),t[1]=n,t[2]=c);let l;t[3]===c?l=t[4]:(l=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[s,(0,Z.jsx)(L,{variant:`outline`,children:c})]}),t[3]=c,t[4]=l);let u;t[5]===r?u=t[6]:(u=Te(r),t[5]=r,t[6]=u);let d=i?` Refreshing selected window...`:``,f;t[7]!==u||t[8]!==d?(f=(0,Z.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Updated `,u,d]}),t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;t[10]!==l||t[11]!==f?(p=(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[l,f]}),t[10]=l,t[11]=f,t[12]=p):p=t[12];let m;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Z.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.18em] text-muted-foreground`,children:`Window`}),t[13]=m):m=t[13];let h=String(a),g;t[14]===h?g=t[15]:(g=[h],t[14]=h,t[15]=g);let _;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=O.map(Ye),t[16]=_):_=t[16];let v;t[17]!==o||t[18]!==g?(v=(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[m,(0,Z.jsx)(Ge,{value:g,onValueChange:o,variant:`outline`,size:`sm`,"aria-label":`Budget window`,children:_})]}),t[17]=o,t[18]=g,t[19]=v):v=t[19];let y;return t[20]!==v||t[21]!==p?(y=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 xl:flex-row xl:items-end xl:justify-between`,children:[p,v]}),t[20]=v,t[21]=p,t[22]=y):y=t[22],y}function Ye(e){return(0,Z.jsxs)(Ke,{value:String(e),className:`min-w-20 justify-center`,children:[e,` days`]},e)}function Xe(e){let t=(0,K.c)(13),{children:n,tooltip:r}=e;if(!r)return n;let i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a=`More information about ${n}`,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(w,{size:14,stroke:1.75}),t[2]=o):o=t[2];let s;t[3]===a?s=t[4]:(s=(0,Z.jsx)(E,{className:`inline-flex size-4 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground`,"aria-label":a,children:o}),t[3]=a,t[4]=s);let c;t[5]===r?c=t[6]:(c=(0,Z.jsx)(j,{children:r}),t[5]=r,t[6]=c);let l;t[7]!==s||t[8]!==c?(l=(0,Z.jsxs)(S,{children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;return t[10]!==i||t[11]!==l?(u=(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[i,l]}),t[10]=i,t[11]=l,t[12]=u):u=t[12],u}function Ze(e){let t=(0,K.c)(17),{title:n,value:r,description:i,icon:a}=e,o;t[0]===a?o=t[1]:(o=(0,Z.jsx)(`div`,{className:`w-fit rounded-lg border bg-muted/30 p-2`,children:(0,Z.jsx)(a,{size:18,stroke:1.75})}),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,Z.jsx)(U,{children:n}),t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=(0,Z.jsx)(H,{className:`text-2xl`,children:r}),t[4]=r,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==o||t[10]!==l?(u=(0,Z.jsxs)(B,{className:`space-y-4`,children:[o,l]}),t[9]=o,t[10]=l,t[11]=u):u=t[11];let d;t[12]===i?d=t[13]:(d=(0,Z.jsx)(V,{className:`pt-0 text-sm text-muted-foreground`,children:i}),t[12]=i,t[13]=d);let f;return t[14]!==u||t[15]!==d?(f=(0,Z.jsxs)(W,{children:[u,d]}),t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function Qe(e){let t=(0,K.c)(31),{budgetLimitState:n,overview:r,peakSpendDay:i}=e,a;t[0]!==n.budgetUsedPercent||t[1]!==n.kind?(a=n.kind===`unlimited`?`Not set`:n.kind===`blocked`?`Blocked`:Ee(n.budgetUsedPercent),t[0]=n.budgetUsedPercent,t[1]=n.kind,t[2]=a):a=t[2];let o=a,s;t[3]!==n.kind||t[4]!==n.monthlyBudgetUsd||t[5]!==r.totalCostUsd?(s=n.kind===`unlimited`?`Set a monthly budget to track percentage use.`:n.kind===`blocked`?`${J(n.monthlyBudgetUsd)} monthly budget blocks new agent runs.`:`${J(r.totalCostUsd)} of ${J(n.monthlyBudgetUsd)} monthly budget used`,t[3]=n.kind,t[4]=n.monthlyBudgetUsd,t[5]=r.totalCostUsd,t[6]=s):s=t[6];let c=s,l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(Xe,{tooltip:`Uses actualCostUsd when available, and falls back to estimatedCostUsd when only estimated spend is recorded.`,children:`Observed Spend`}),t[7]=l):l=t[7];let u;t[8]===r.totalCostUsd?u=t[9]:(u=J(r.totalCostUsd),t[8]=r.totalCostUsd,t[9]=u);let d;t[10]===r.activeConnectionCount?d=t[11]:(d=be(r.activeConnectionCount),t[10]=r.activeConnectionCount,t[11]=d);let f;t[12]===r.activeProviderCount?f=t[13]:(f=be(r.activeProviderCount),t[12]=r.activeProviderCount,t[13]=f);let p=`${d} connections across ${f} providers`,m;t[14]!==u||t[15]!==p?(m=(0,Z.jsx)(Ze,{title:l,value:u,description:p,icon:h}),t[14]=u,t[15]=p,t[16]=m):m=t[16];let g;t[17]!==c||t[18]!==o?(g=(0,Z.jsx)(Ze,{title:`Budget Used`,value:o,description:c,icon:ge}),t[17]=c,t[18]=o,t[19]=g):g=t[19];let _;t[20]===i?_=t[21]:(_=i?J(i.totalCostUsd):`No spend`,t[20]=i,t[21]=_);let v;t[22]===i?v=t[23]:(v=i?`${we(i.date)} recorded the highest spend.`:`No observed query spend in this window`,t[22]=i,t[23]=v);let y;t[24]!==_||t[25]!==v?(y=(0,Z.jsx)(Ze,{title:`Peak Spend Day`,value:_,description:v,icon:_e}),t[24]=_,t[25]=v,t[26]=y):y=t[26];let b;return t[27]!==y||t[28]!==m||t[29]!==g?(b=(0,Z.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:[m,g,y]}),t[27]=y,t[28]=m,t[29]=g,t[30]=b):b=t[30],b}function $e(e){let t=(0,K.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=p(`border-input dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-disabled:bg-input/50 dark:has-disabled:bg-input/80 h-8 rounded-lg border transition-colors has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot][aria-invalid=true]]:ring-[3px] has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 [[data-slot=combobox-content]_&]:focus-within:border-inherit [[data-slot=combobox-content]_&]:focus-within:ring-0 group/input-group relative flex w-full min-w-0 items-center outline-none has-[>textarea]:h-auto`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var et=l(`text-muted-foreground h-auto gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4 flex cursor-text items-center justify-center select-none`,{variants:{align:{"inline-start":`pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem] order-first`,"inline-end":`pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem] order-last`,"block-start":`px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start`,"block-end":`px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start`}},defaultVariants:{align:`inline-start`}});function tt(e){let t=(0,K.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,align:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`inline-start`:i,o;t[4]!==a||t[5]!==n?(o=p(et({align:a}),n),t[4]=a,t[5]=n,t[6]=o):o=t[6];let s;return t[7]!==a||t[8]!==r||t[9]!==o?(s=(0,Z.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":a,className:o,onClick:nt,...r}),t[7]=a,t[8]=r,t[9]=o,t[10]=s):s=t[10],s}function nt(e){e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()}l(`gap-2 text-sm shadow-none flex items-center`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function rt(e){let t=(0,K.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=p(`text-muted-foreground gap-2 text-sm [&_svg:not([class*='size-'])]:size-4 flex items-center [&_svg]:pointer-events-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function it(e){let t=(0,K.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=p(`rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent flex-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(P,{"data-slot":`input-group-control`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function at(e){let t=(0,K.c)(14),{status:n,className:r}=e;if(n===`idle`)return null;let i=n===`error`&&`text-destructive`,a;t[0]!==r||t[1]!==i?(a=p(`flex items-center gap-1.5 text-xs text-muted-foreground transition-opacity`,i,r),t[0]=r,t[1]=i,t[2]=a):a=t[2];let o;t[3]===n?o=t[4]:(o=n===`saving`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(g,{size:14,className:`animate-spin`}),(0,Z.jsx)(`span`,{children:`Saving...`})]}),t[3]=n,t[4]=o);let s;t[5]===n?s=t[6]:(s=n===`saved`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(m,{size:14,className:`text-green-600`}),(0,Z.jsx)(`span`,{children:`Saved`})]}),t[5]=n,t[6]=s);let c;t[7]===n?c=t[8]:(c=n===`error`&&(0,Z.jsx)(`span`,{children:`Failed to save`}),t[7]=n,t[8]=c);let l;return t[9]!==a||t[10]!==o||t[11]!==s||t[12]!==c?(l=(0,Z.jsxs)(`div`,{className:a,children:[o,s,c]}),t[9]=a,t[10]=o,t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function ot(e){let t=(0,K.c)(68),n;bb0:{switch(e.budgetLimitState.kind){case`unlimited`:{let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(`div`,{className:`rounded-lg border border-dashed bg-muted/10 p-4 text-sm text-muted-foreground`,children:`Set a limit to track usage.`}),t[0]=e):e=t[0],n=e;break bb0}case`blocked`:{let r;t[1]===e.budgetLimitState.monthlyBudgetUsd?r=t[2]:(r=J(e.budgetLimitState.monthlyBudgetUsd),t[1]=e.budgetLimitState.monthlyBudgetUsd,t[2]=r);let i;t[3]===r?i=t[4]:(i=(0,Z.jsxs)(`div`,{className:`rounded-lg border border-dashed bg-muted/10 p-4 text-sm text-muted-foreground`,children:[`Monthly budget is`,` `,r,`. Agent runs are blocked until you raise the limit.`]}),t[3]=r,t[4]=i),n=i;break bb0}case`limited`:{let r=Math.min(e.budgetLimitState.budgetUsedPercent,100),i;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(`div`,{children:(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:`Spend vs. limit`})}),t[5]=i):i=t[5];let a;t[6]===e.totalSpendUsd?a=t[7]:(a=J(e.totalSpendUsd),t[6]=e.totalSpendUsd,t[7]=a);let o;t[8]===e.budgetLimitState.monthlyBudgetUsd?o=t[9]:(o=J(e.budgetLimitState.monthlyBudgetUsd),t[8]=e.budgetLimitState.monthlyBudgetUsd,t[9]=o);let s;t[10]!==a||t[11]!==o?(s=(0,Z.jsxs)(`p`,{className:`font-medium tabular-nums`,children:[a,` /`,` `,o]}),t[10]=a,t[11]=o,t[12]=s):s=t[12];let c;t[13]!==e.budgetLimitState.isOverBudget||t[14]!==e.budgetLimitState.remainingBudgetUsd?(c=e.budgetLimitState.isOverBudget?`${J(Math.abs(e.budgetLimitState.remainingBudgetUsd))} over`:`${J(e.budgetLimitState.remainingBudgetUsd)} remaining`,t[13]=e.budgetLimitState.isOverBudget,t[14]=e.budgetLimitState.remainingBudgetUsd,t[15]=c):c=t[15];let l;t[16]===c?l=t[17]:(l=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c}),t[16]=c,t[17]=l);let u;t[18]!==s||t[19]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[i,(0,Z.jsxs)(`div`,{className:`text-right`,children:[s,l]})]}),t[18]=s,t[19]=l,t[20]=u):u=t[20];let d=`h-2 rounded-full transition-all ${e.budgetLimitState.isOverBudget?`bg-destructive`:`bg-primary`}`,f=`${r}%`,p;t[21]===f?p=t[22]:(p={width:f},t[21]=f,t[22]=p);let m;t[23]!==p||t[24]!==d?(m=(0,Z.jsx)(`div`,{className:`h-2 rounded-full bg-muted/60`,children:(0,Z.jsx)(`div`,{className:d,style:p})}),t[23]=p,t[24]=d,t[25]=m):m=t[25];let h;t[26]===e.budgetLimitState.budgetUsedPercent?h=t[27]:(h=Ee(e.budgetLimitState.budgetUsedPercent),t[26]=e.budgetLimitState.budgetUsedPercent,t[27]=h);let g;t[28]===h?g=t[29]:(g=(0,Z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Using`,` `,h,` of the limit.`]}),t[28]=h,t[29]=g);let _;t[30]!==m||t[31]!==g||t[32]!==u?(_=(0,Z.jsxs)(`div`,{className:`space-y-3 rounded-lg border bg-muted/15 p-4`,children:[u,m,g]}),t[30]=m,t[31]=g,t[32]=u,t[33]=_):_=t[33],n=_;break bb0}}n=e.budgetLimitState}let r=n,i;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsxs)(`div`,{className:`space-y-1`,children:[(0,Z.jsx)(H,{children:`Spend Limit`}),(0,Z.jsx)(U,{children:`Cap monthly spend.`})]}),t[34]=i):i=t[34];let a;t[35]===e.saveStatus?a=t[36]:(a=(0,Z.jsx)(B,{className:`space-y-3`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[i,(0,Z.jsx)(at,{status:e.saveStatus})]})}),t[35]=e.saveStatus,t[36]=a);let o;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Z.jsx)(le,{htmlFor:`budget-target`,children:`Limit (USD)`}),t[37]=o):o=t[37];let s;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(tt,{align:`inline-start`,children:(0,Z.jsx)(rt,{children:`$`})}),t[38]=s):s=t[38];let c=!e.canEditBudget,l;t[39]===e?l=t[40]:(l=t=>e.onBudgetInputChange(xe(t.target.value)),t[39]=e,t[40]=l);let d;t[41]!==e.budgetInput||t[42]!==c||t[43]!==l?(d=(0,Z.jsxs)($e,{className:`flex-1`,children:[s,(0,Z.jsx)(it,{id:`budget-target`,inputMode:`decimal`,placeholder:`2500`,value:e.budgetInput,disabled:c,onChange:l})]}),t[41]=e.budgetInput,t[42]=c,t[43]=l,t[44]=d):d=t[44];let f=!e.canEditBudget||e.isSaveDisabled,p;t[45]!==e.onBudgetSave||t[46]!==f?(p=(0,Z.jsx)(u,{type:`button`,onClick:e.onBudgetSave,disabled:f,children:`Save`}),t[45]=e.onBudgetSave,t[46]=f,t[47]=p):p=t[47];let m=!e.canEditBudget||e.isSavePending||!e.hasBudgetConfigured&&e.budgetInput.length===0,h;t[48]!==e.onBudgetClear||t[49]!==m?(h=(0,Z.jsx)(u,{type:`button`,variant:`outline`,onClick:e.onBudgetClear,disabled:m,children:`Clear`}),t[48]=e.onBudgetClear,t[49]=m,t[50]=h):h=t[50];let g;t[51]!==h||t[52]!==p?(g=(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2 xl:shrink-0`,children:[p,h]}),t[51]=h,t[52]=p,t[53]=g):g=t[53];let _;t[54]!==g||t[55]!==d?(_=(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 xl:flex-row xl:items-center`,children:[d,g]}),t[54]=g,t[55]=d,t[56]=_):_=t[56];let v=e.canEditBudget?e.isBudgetInputInvalid?`Enter a valid non-negative USD amount.`:`Leave blank to clear the limit.`:`Only admins and owners can update the monthly spend limit.`,y;t[57]===v?y=t[58]:(y=(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:v}),t[57]=v,t[58]=y);let b;t[59]!==_||t[60]!==y?(b=(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[o,_,y]}),t[59]=_,t[60]=y,t[61]=b):b=t[61];let x;t[62]!==r||t[63]!==b?(x=(0,Z.jsxs)(V,{className:`space-y-4`,children:[b,r]}),t[62]=r,t[63]=b,t[64]=x):x=t[64];let S;return t[65]!==x||t[66]!==a?(S=(0,Z.jsxs)(W,{children:[a,x]}),t[65]=x,t[66]=a,t[67]=S):S=t[67],S}var st=2e3,ct=3e3,lt=`Failed to save monthly budget`,Q={CLEAR:`budgetSettings/clear`,INPUT_CHANGED:`budgetSettings/inputChanged`,SAVE:`budgetSettings/save`,SAVE_FAILED:`budgetSettings/saveFailed`,SAVE_SUCCEEDED:`budgetSettings/saveSucceeded`,SETTINGS_SYNCED:`budgetSettings/settingsSynced`},$={EDITING:`editing`,ERROR:`error`,SAVED:`saved`,SAVING:`saving`},ut=class extends me(`BudgetSaveError`)(){};function dt(e){return{budgetInput:Y(e),nextSaveRequestId:1,pendingSaveRequest:null,persistedBudgetUsd:e}}function ft(e){let t=X(e.budgetInput);if(t===`invalid`)throw Error(`Budget input must be valid before saving`);return t}function pt(e){return!Ce({currentBudgetUsd:e.persistedBudgetUsd,isPending:!1,parsedBudgetInput:X(e.budgetInput)})}function mt(e){return e.persistedBudgetUsd!==null||e.budgetInput.trim().length>0}function ht(e){return e===$.SAVING?`saving`:e===$.SAVED?`saved`:e===$.ERROR?`error`:`idle`}async function gt(e){return he.tryPromise({try:()=>e.saveBudget(e.nextBudgetUsd),catch:t=>new ut({cause:t,message:e.errorMessage})})}function _t(e,t={}){let n=t.savedIdleDelayMs??st,r=t.errorIdleDelayMs??ct;return de({actions:{clearPendingSaveRequest:G({pendingSaveRequest:()=>null}),updateBudgetInput:G({budgetInput:(e,t)=>t.value}),clearBudgetInput:G({budgetInput:()=>``}),syncBudgetFromSettings:G({persistedBudgetUsd:(e,t)=>t.monthlyBudgetUsd,budgetInput:(e,t)=>Y(t.monthlyBudgetUsd)}),startSaveRequest:G(({context:e})=>({nextSaveRequestId:e.nextSaveRequestId+1,pendingSaveRequest:{nextBudgetUsd:ft(e),requestId:e.nextSaveRequestId}})),storePersistedBudget:G(({context:e,event:t})=>(fe(t,Q.SAVE_SUCCEEDED),e.pendingSaveRequest?.requestId===t.requestId?{budgetInput:Y(t.monthlyBudgetUsd),persistedBudgetUsd:t.monthlyBudgetUsd}:{}))},guards:{canSave:({context:e})=>pt(e),canClear:({context:e})=>mt(e),matchesPendingSaveRequest:({context:e,event:t})=>t.type!==Q.SAVE_FAILED&&t.type!==Q.SAVE_SUCCEEDED?!1:e.pendingSaveRequest?.requestId===t.requestId},types:{}}).createMachine({context:dt(e.initialBudgetUsd),id:`budgetSettings`,initial:$.EDITING,on:{[Q.SETTINGS_SYNCED]:{actions:{type:`syncBudgetFromSettings`,params:({event:e})=>({monthlyBudgetUsd:e.monthlyBudgetUsd})}}},states:{[$.EDITING]:{on:{[Q.INPUT_CHANGED]:{actions:{type:`updateBudgetInput`,params:({event:e})=>({value:e.value})}},[Q.SAVE]:{guard:`canSave`,actions:`startSaveRequest`,target:$.SAVING},[Q.CLEAR]:{guard:`canClear`,actions:[`clearBudgetInput`,`startSaveRequest`],target:$.SAVING}}},[$.SAVING]:{on:{[Q.INPUT_CHANGED]:{actions:{type:`updateBudgetInput`,params:({event:e})=>({value:e.value})}},[Q.SAVE_SUCCEEDED]:{actions:[`storePersistedBudget`,`clearPendingSaveRequest`],guard:`matchesPendingSaveRequest`,target:$.SAVED},[Q.SAVE_FAILED]:{actions:`clearPendingSaveRequest`,guard:`matchesPendingSaveRequest`,target:$.ERROR}}},[$.SAVED]:{after:{[n]:$.EDITING},on:{[Q.INPUT_CHANGED]:{target:$.EDITING,actions:{type:`updateBudgetInput`,params:({event:e})=>({value:e.value})}},[Q.SAVE]:{guard:`canSave`,actions:`startSaveRequest`,target:$.SAVING},[Q.CLEAR]:{guard:`canClear`,actions:[`clearBudgetInput`,`startSaveRequest`],target:$.SAVING}}},[$.ERROR]:{after:{[r]:$.EDITING},on:{[Q.INPUT_CHANGED]:{target:$.EDITING,actions:{type:`updateBudgetInput`,params:({event:e})=>({value:e.value})}},[Q.SAVE]:{guard:`canSave`,actions:`startSaveRequest`,target:$.SAVING},[Q.CLEAR]:{guard:`canClear`,actions:[`clearBudgetInput`,`startSaveRequest`],target:$.SAVING}}}}})}function vt(e){let t=(0,K.c)(41),n;t[0]===e.monthlyBudgetUsd?n=t[1]:(n=()=>_t({initialBudgetUsd:e.monthlyBudgetUsd}),t[0]=e.monthlyBudgetUsd,t[1]=n);let[r]=(0,q.useState)(n),[i,a]=pe(r),o=i.context.pendingSaveRequest,s;t[2]===i?s=t[3]:(s=i.matches($.SAVING),t[2]=i,t[3]=s);let c=s,l,u;t[4]!==e.monthlyBudgetUsd||t[5]!==a?(l=()=>{a({monthlyBudgetUsd:e.monthlyBudgetUsd,type:Q.SETTINGS_SYNCED})},u=[e.monthlyBudgetUsd,a],t[4]=e.monthlyBudgetUsd,t[5]=a,t[6]=l,t[7]=u):(l=t[6],u=t[7]),(0,q.useEffect)(l,u);let d,f;t[8]!==e.errorMessage||t[9]!==e.saveBudget||t[10]!==c||t[11]!==o||t[12]!==a?(d=()=>{if(!c||o===null)return;let t=!1;return gt({errorMessage:e.errorMessage??lt,nextBudgetUsd:o.nextBudgetUsd,saveBudget:e.saveBudget}).then(e=>{if(!t){if(e.isErr()){T.error(e.error.message),a({requestId:o.requestId,type:Q.SAVE_FAILED});return}a({monthlyBudgetUsd:e.value.monthlyBudgetUsd,requestId:o.requestId,type:Q.SAVE_SUCCEEDED})}}),()=>{t=!0}},f=[e.errorMessage,e.saveBudget,c,o,a],t[8]=e.errorMessage,t[9]=e.saveBudget,t[10]=c,t[11]=o,t[12]=a,t[13]=d,t[14]=f):(d=t[13],f=t[14]),(0,q.useEffect)(d,f);let p;t[15]===a?p=t[16]:(p=e=>{a({type:Q.INPUT_CHANGED,value:e})},t[15]=a,t[16]=p);let m=p,h;t[17]===a?h=t[18]:(h=()=>{a({type:Q.SAVE})},t[17]=a,t[18]=h);let g=h,_;t[19]===a?_=t[20]:(_=()=>{a({type:Q.CLEAR})},t[19]=a,t[20]=_);let v=_,y,b,x,S,C,w;if(t[21]!==v||t[22]!==i){let e=X(i.context.budgetInput);y=i.matches($.SAVING),w=i.context.budgetInput,b=v,x=i.context.persistedBudgetUsd!==null,S=e===`invalid`,C=Ce({parsedBudgetInput:e,currentBudgetUsd:i.context.persistedBudgetUsd,isPending:y}),t[21]=v,t[22]=i,t[23]=y,t[24]=b,t[25]=x,t[26]=S,t[27]=C,t[28]=w}else y=t[23],b=t[24],x=t[25],S=t[26],C=t[27],w=t[28];let E=String(i.value),D;t[29]===E?D=t[30]:(D=ht(E),t[29]=E,t[30]=D);let O;return t[31]!==y||t[32]!==g||t[33]!==m||t[34]!==b||t[35]!==x||t[36]!==S||t[37]!==C||t[38]!==D||t[39]!==w?(O={budgetInput:w,clear:b,hasBudgetConfigured:x,isBudgetInputInvalid:S,isSaveDisabled:C,isSavePending:y,save:g,saveStatus:D,setBudgetInput:m},t[31]=y,t[32]=g,t[33]=m,t[34]=b,t[35]=x,t[36]=S,t[37]=C,t[38]=D,t[39]=w,t[40]=O):O=t[40],O}var yt=i(`/_authenticated/$org_slug/budget`);function bt(){let e=(0,K.c)(57),t=a(),n=ae(),{organizationId:r,organizationSlug:i,session:o}=yt.useRouteContext(),s=o.user.id,{days:c}=yt.useSearch(),l=(0,q.useDeferredValue)(c),u=l!==c,d;e[0]===i?d=e[1]:(d=C(i),e[0]=i,e[1]=d);let f=d,p;e[2]!==s||e[3]!==r?(p=ie(s,r),e[2]=s,e[3]=r,e[4]=p):p=e[4];let{data:m}=_(p),h;e[5]!==l||e[6]!==r?(h=ne(r,l),e[5]=l,e[6]=r,e[7]=h):h=e[7];let{data:g}=_(h),{data:v}=_(f),y;e[8]!==s||e[9]!==m?(y=D({currentUserId:s,members:m}),e[8]=s,e[9]=m,e[10]=y):y=e[10];let{canUpdateOrganizationSettings:b}=y,x;e[11]===g.dailyCost?x=e[12]:(x=te(g.dailyCost),e[11]=g.dailyCost,e[12]=x);let S=x,w=v.monthlyBudgetUsd,T;e[13]!==g.overview.totalCostUsd||e[14]!==w?(T=A({monthlyBudgetUsd:w,totalSpendUsd:g.overview.totalCostUsd}),e[13]=g.overview.totalCostUsd,e[14]=w,e[15]=T):T=e[15];let E=T,O;e[16]!==i||e[17]!==n?(O=async e=>{let t=await re(i,{monthlyBudgetUsd:e});return n.setQueryData(C(i).queryKey,t),t},e[16]=i,e[17]=n,e[18]=O):O=e[18];let k=O,j;e[19]!==k||e[20]!==v.monthlyBudgetUsd?(j={errorMessage:`Failed to save monthly budget`,monthlyBudgetUsd:v.monthlyBudgetUsd,saveBudget:k},e[19]=k,e[20]=v.monthlyBudgetUsd,e[21]=j):j=e[21];let M=vt(j),N;e[22]!==t||e[23]!==i||e[24]!==c?(N=function(e){let n=e[0];if(!n)return;let r=Number(n),a=ee.safeParse(r);!a.success||a.data===c||(0,q.startTransition)(()=>{t({params:{org_slug:i},replace:!0,search:{days:a.data},to:`/$org_slug/budget`})})},e[22]=t,e[23]=i,e[24]=c,e[25]=N):N=e[25];let P=N,F;e[26]!==E||e[27]!==g.generatedAt||e[28]!==P||e[29]!==u||e[30]!==c?(F=(0,Z.jsx)(Je,{budgetLimitState:E,generatedAt:g.generatedAt,isWindowChangePending:u,selectedDays:c,onWindowChange:P}),e[26]=E,e[27]=g.generatedAt,e[28]=P,e[29]=u,e[30]=c,e[31]=F):F=e[31];let I;e[32]!==E||e[33]!==M.budgetInput||e[34]!==M.clear||e[35]!==M.hasBudgetConfigured||e[36]!==M.isBudgetInputInvalid||e[37]!==M.isSaveDisabled||e[38]!==M.isSavePending||e[39]!==M.save||e[40]!==M.saveStatus||e[41]!==M.setBudgetInput||e[42]!==b||e[43]!==g.overview.totalCostUsd?(I=(0,Z.jsx)(ot,{budgetInput:M.budgetInput,onBudgetInputChange:M.setBudgetInput,onBudgetSave:M.save,onBudgetClear:M.clear,canEditBudget:b,saveStatus:M.saveStatus,isSavePending:M.isSavePending,isSaveDisabled:M.isSaveDisabled,hasBudgetConfigured:M.hasBudgetConfigured,isBudgetInputInvalid:M.isBudgetInputInvalid,budgetLimitState:E,totalSpendUsd:g.overview.totalCostUsd}),e[32]=E,e[33]=M.budgetInput,e[34]=M.clear,e[35]=M.hasBudgetConfigured,e[36]=M.isBudgetInputInvalid,e[37]=M.isSaveDisabled,e[38]=M.isSavePending,e[39]=M.save,e[40]=M.saveStatus,e[41]=M.setBudgetInput,e[42]=b,e[43]=g.overview.totalCostUsd,e[44]=I):I=e[44];let L;e[45]!==E||e[46]!==g.overview||e[47]!==S?(L=(0,Z.jsx)(Qe,{budgetLimitState:E,overview:g.overview,peakSpendDay:S}),e[45]=E,e[46]=g.overview,e[47]=S,e[48]=L):L=e[48];let R;e[49]!==E||e[50]!==g?(R=(0,Z.jsx)(Ie,{data:g,budgetLimitState:E}),e[49]=E,e[50]=g,e[51]=R):R=e[51];let z;return e[52]!==I||e[53]!==L||e[54]!==R||e[55]!==F?(z=(0,Z.jsxs)(`div`,{className:`space-y-8 p-8`,children:[F,I,L,R]}),e[52]=I,e[53]=L,e[54]=R,e[55]=F,e[56]=z):z=e[56],z}var xt=bt;export{xt as component};
|
|
@@ -1 +0,0 @@
|
|
|
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{t as i}from"./compiler-runtime-DCc3R3Xn.js";import{a,o}from"./api-base-url-DIb6qukm.js";import{n as s,r as c,t as l}from"./createReactComponent-_L2mp4Ui.js";import{t as u}from"./utils-C8DGLIgm.js";import{t as d}from"./IconCheck-Gc24xPT2.js";import{t as f}from"./theme-toggle-CcB6O_vF.js";import{t as p}from"./IconX-Cg43mUxH.js";import{c as m,d as h,n as g,o as _,r as v}from"./app-routes-DM5pppqD.js";import{t as y}from"./api-client-F8Y7IuHn.js";import{t as b}from"./input-DSkIbIFK.js";import{t as x}from"./label-CUY3W2yp.js";import{a as S,n as C,o as w,r as T,t as E}from"./card-CZCl7QNy.js";import{a as D,i as O,o as k,r as A,t as ee}from"./xstate-react.esm-CfqAjJyu.js";import{n as j,t as M}from"./dist-Cg-lnuP8.js";var N=l(`outline`,`key`,`Key`,[[`path`,{d:`M16.555 3.843l3.602 3.602a2.877 2.877 0 0 1 0 4.069l-2.643 2.643a2.877 2.877 0 0 1 -4.069 0l-.301 -.301l-6.558 6.558a2 2 0 0 1 -1.239 .578l-.175 .008h-1.172a1 1 0 0 1 -.993 -.883l-.007 -.117v-1.172a2 2 0 0 1 .467 -1.284l.119 -.13l.414 -.414h2v-2h2v-2l2.144 -2.144l-.301 -.301a2.877 2.877 0 0 1 0 -4.069l2.643 -2.643a2.877 2.877 0 0 1 4.069 0`,key:`svg-0`}],[`path`,{d:`M15 9h.01`,key:`svg-1`}]]),P=l(`outline`,`login-2`,`Login2`,[[`path`,{d:`M9 8v-2a2 2 0 0 1 2 -2h7a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-7a2 2 0 0 1 -2 -2v-2`,key:`svg-0`}],[`path`,{d:`M3 12h13l-3 -3`,key:`svg-1`}],[`path`,{d:`M13 15l3 -3`,key:`svg-2`}]]),F=l(`outline`,`shield-check`,`ShieldCheck`,[[`path`,{d:`M11.46 20.846a12 12 0 0 1 -7.96 -14.846a12 12 0 0 0 8.5 -3a12 12 0 0 0 8.5 3a12 12 0 0 1 -.09 7.06`,key:`svg-0`}],[`path`,{d:`M15 19l2 2l4 -4`,key:`svg-1`}]]),I=l(`outline`,`sparkles`,`Sparkles`,[[`path`,{d:`M16 18a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m0 -12a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m-7 12a6 6 0 0 1 6 -6a6 6 0 0 1 -6 -6a6 6 0 0 1 -6 6a6 6 0 0 1 6 6`,key:`svg-0`}]]),L=l(`outline`,`terminal-2`,`Terminal2`,[[`path`,{d:`M8 9l3 3l-3 3`,key:`svg-0`}],[`path`,{d:`M13 15l3 0`,key:`svg-1`}],[`path`,{d:`M3 6a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2l0 -12`,key:`svg-2`}]]),R=i(),z=e(t(),1),B=`The device code could not be verified. Try again.`,V=`The device request could not be completed. Try again.`,H=class extends j(`DeviceVerificationError`)(){},U=class extends j(`DeviceDecisionError`)(){};function W(){return{kind:`idle`}}function G(e){return{kind:`error`,message:e}}function K(){return{kind:`idle`}}function q(e){return{kind:`ready`,result:e}}function J(){return{activeUserCode:null,alert:W(),inputCode:``,navigation:null,nextAsyncRequestId:1,nextNavigationId:1,pendingDecision:null,pendingVerification:null,resultState:K(),session:{kind:`pending`}}}function Y(e){return{...J(),nextAsyncRequestId:e.nextAsyncRequestId,nextNavigationId:e.nextNavigationId}}function X(e,t,n){return{navigation:{id:e.nextNavigationId,phase:`pending`,replace:n,userCode:t},nextNavigationId:e.nextNavigationId+1}}async function te(e){let t=y();if(!e)return M.err(new H({message:`Enter the code shown in your terminal to continue.`,reason:`missing_code`}));let n=await M.tryPromise({try:()=>t.api.device.verify.$get({query:{user_code:e}}),catch:e=>new H({cause:e,message:B,reason:`request_failed`})});if(n.isErr())return console.error(`[device-auth] failed to verify device code`,{errorName:me(n.error.cause)}),M.err(n.error);let r=n.value;if(!r.ok){let e=await Z(r);return M.err(new H({message:de(e,B),reason:`response_failed`}))}let i=await Z(r);return i===null?(console.error(`[device-auth] failed to parse verify device response`),M.err(new H({message:B,reason:`response_failed`}))):M.ok({status:i.status,userCode:i.userCode})}async function ne(e){let t=y();if(!e.userCode)return M.err(new U({action:e.action,message:V,reason:`missing_code`}));let n=e.action===`approve`?t.api.device.approve.$post:t.api.device.deny.$post,r=await M.tryPromise({try:()=>n({form:{user_code:e.userCode}}),catch:t=>new U({action:e.action,cause:t,message:V,reason:`request_failed`})});if(r.isErr())return console.error(`[device-auth] failed to submit device decision`,{action:e.action,errorName:me(r.error.cause)}),M.err(r.error);let i=r.value;if(!i.ok){let t=await Z(i);return M.err(new U({action:e.action,message:de(t,V),reason:`response_failed`}))}let a=await Z(i);return a===null?(console.error(`[device-auth] failed to parse device decision response`,{action:e.action}),M.err(new U({action:e.action,message:V,reason:`response_failed`}))):M.ok({message:a.message,title:a.title,tone:e.action===`approve`?`success`:`error`})}async function Z(e){let t=await M.tryPromise(()=>e.json());return t.isErr()?null:t.value}var re=D({actions:{resetToEntry:k(({context:e})=>Y(e)),stageVerificationFromRoute:k(({context:e,event:t})=>(O(t,`deviceAuth/routeSynced`),t.userCode===null?{}:{inputCode:t.userCode,activeUserCode:t.userCode,alert:W(),nextAsyncRequestId:e.nextAsyncRequestId+1,pendingDecision:null,pendingVerification:{requestId:e.nextAsyncRequestId,userCode:t.userCode},resultState:K()})),setInputCode:k(({event:e})=>(O(e,`deviceAuth/inputChanged`),{inputCode:e.value,alert:W()})),stageVerificationFromInput:k(({context:e})=>{let t=ce(e.inputCode);return t===null?{}:{inputCode:t,activeUserCode:t,alert:W(),nextAsyncRequestId:e.nextAsyncRequestId+1,pendingDecision:null,pendingVerification:{requestId:e.nextAsyncRequestId,userCode:t},resultState:K(),...X(e,t,!1)}}),setMissingCodeError:k({alert:()=>G(`Enter the code shown in your terminal to continue.`)}),syncSession:k(({event:e})=>(O(e,`deviceAuth/sessionSynced`),{session:e.session,alert:W()})),queueClearCodeNavigation:k(({context:e})=>{let t=Y(e);return{...t,...X(t,null,!1)}}),stageApproveDecision:k(({context:e})=>({alert:W(),nextAsyncRequestId:e.nextAsyncRequestId+1,pendingDecision:{action:`approve`,requestId:e.nextAsyncRequestId,userCode:e.activeUserCode}})),stageDenyDecision:k(({context:e})=>({alert:W(),nextAsyncRequestId:e.nextAsyncRequestId+1,pendingDecision:{action:`deny`,requestId:e.nextAsyncRequestId,userCode:e.activeUserCode}})),markNavigationRunning:k(({context:e,event:t})=>(O(t,`deviceAuth/navigationStarted`),e.navigation===null||e.navigation.id!==t.id?{}:{navigation:{...e.navigation,phase:`running`}})),completeNavigation:k(({context:e,event:t})=>(O(t,`deviceAuth/navigationCompleted`),e.navigation===null||e.navigation.id!==t.id?{}:{navigation:null})),failNavigation:k(({context:e,event:t})=>(O(t,`deviceAuth/navigationFailed`),e.navigation===null||e.navigation.id!==t.id?{}:{navigation:null,alert:G(t.message)})),storeVerificationFailure:k(({context:e,event:t})=>(O(t,`deviceAuth/verificationFailed`),e.pendingVerification?.requestId===t.requestId?{alert:G(t.message),inputCode:e.activeUserCode??e.inputCode,pendingDecision:null,pendingVerification:null,resultState:K()}:{})),storeVerifiedPending:k(({context:e,event:t})=>(O(t,`deviceAuth/verificationSucceeded`),e.pendingVerification?.requestId===t.requestId?fe({context:e,resultState:K(),userCode:t.userCode}):{})),storeVerifiedApproved:k(({context:e,event:t})=>(O(t,`deviceAuth/verificationSucceeded`),e.pendingVerification?.requestId===t.requestId?fe({context:e,resultState:q({title:`Device Approved`,message:`Return to your terminal to continue. You can close this tab.`,tone:`success`}),userCode:t.userCode}):{})),storeVerifiedDenied:k(({context:e,event:t})=>(O(t,`deviceAuth/verificationSucceeded`),e.pendingVerification?.requestId===t.requestId?fe({context:e,resultState:q({title:`Device Denied`,message:`This device code has already been denied. Start onequery auth login again if you need a new code.`,tone:`error`}),userCode:t.userCode}):{})),storeDecisionFailure:k(({context:e,event:t})=>(O(t,`deviceAuth/decisionFailed`),e.pendingDecision?.requestId===t.requestId?{alert:G(t.message),inputCode:e.activeUserCode??``,pendingDecision:null,resultState:K()}:{})),storeDecisionSuccess:k(({context:e,event:t})=>(O(t,`deviceAuth/decisionSucceeded`),e.pendingDecision?.requestId===t.requestId?{alert:W(),pendingDecision:null,resultState:q({message:t.message,title:t.title,tone:t.tone})}:{}))},guards:{routeCleared:({event:e})=>e.type===`deviceAuth/routeSynced`&&e.userCode===null,routeChanged:({context:e,event:t})=>t.type===`deviceAuth/routeSynced`&&t.userCode!==null&&t.userCode!==e.activeUserCode,hasNormalizedInputCode:({context:e})=>ce(e.inputCode)!==null,sessionSignedIn:({event:e})=>e.type===`deviceAuth/sessionSynced`&&e.session.kind===`signedIn`,sessionSignedOut:({event:e})=>e.type===`deviceAuth/sessionSynced`&&e.session.kind===`signedOut`,matchesPendingVerification:({context:e,event:t})=>t.type===`deviceAuth/verificationFailed`&&e.pendingVerification?.requestId===t.requestId,matchesPendingDecision:({context:e,event:t})=>(t.type===`deviceAuth/decisionFailed`||t.type===`deviceAuth/decisionSucceeded`)&&e.pendingDecision?.requestId===t.requestId},types:{}}).createMachine({context:J(),id:`deviceAuth`,initial:`entry`,on:{"deviceAuth/routeSynced":[{guard:`routeCleared`,target:`.entry`,actions:`resetToEntry`},{guard:`routeChanged`,target:`.verifying`,actions:`stageVerificationFromRoute`}],"deviceAuth/navigationStarted":{actions:`markNavigationRunning`},"deviceAuth/navigationCompleted":{actions:`completeNavigation`},"deviceAuth/navigationFailed":{actions:`failNavigation`}},states:{entry:{on:{"deviceAuth/inputChanged":{actions:`setInputCode`},"deviceAuth/submit":[{guard:`hasNormalizedInputCode`,target:`verifying`,actions:`stageVerificationFromInput`},{actions:`setMissingCodeError`}]}},verifying:{on:{"deviceAuth/verificationFailed":{actions:`storeVerificationFailure`,guard:`matchesPendingVerification`,target:`entry`},"deviceAuth/verificationSucceeded":[{guard:({context:e,event:t})=>t.type===`deviceAuth/verificationSucceeded`&&e.pendingVerification?.requestId===t.requestId&&t.status===`pending`,target:`pending`,actions:`storeVerifiedPending`},{guard:({context:e,event:t})=>t.type===`deviceAuth/verificationSucceeded`&&e.pendingVerification?.requestId===t.requestId&&t.status===`approved`,target:`result`,actions:`storeVerifiedApproved`},{guard:({context:e,event:t})=>t.type===`deviceAuth/verificationSucceeded`&&e.pendingVerification?.requestId===t.requestId,target:`result`,actions:`storeVerifiedDenied`}]}},pending:{initial:`sessionCheck`,on:{"deviceAuth/sessionSynced":[{guard:`sessionSignedIn`,target:`.review`,actions:`syncSession`},{guard:`sessionSignedOut`,target:`.signInRequired`,actions:`syncSession`},{target:`.sessionCheck`,actions:`syncSession`}],"deviceAuth/useDifferentCode":{target:`#deviceAuth.entry`,actions:`queueClearCodeNavigation`}},states:{sessionCheck:{},signInRequired:{},review:{on:{"deviceAuth/approve":{target:`submittingDecision`,actions:`stageApproveDecision`},"deviceAuth/deny":{target:`submittingDecision`,actions:`stageDenyDecision`}}},submittingDecision:{on:{"deviceAuth/decisionFailed":{actions:`storeDecisionFailure`,guard:`matchesPendingDecision`,target:`#deviceAuth.entry`},"deviceAuth/decisionSucceeded":{actions:`storeDecisionSuccess`,guard:`matchesPendingDecision`,target:`#deviceAuth.result`}}}}},result:{on:{"deviceAuth/useDifferentCode":{target:`entry`,actions:`queueClearCodeNavigation`}}}}});function ie(e){return e.matches(`entry`)?`entry`:e.matches(`verifying`)?`verifying`:e.matches({pending:`sessionCheck`})?`sessionCheck`:e.matches({pending:`signInRequired`})?`signInRequired`:e.matches({pending:`review`})||e.matches({pending:`submittingDecision`})?`review`:`result`}function ae(e){return e.context.session.kind===`signedIn`?e.context.session.email:null}function oe(e){return e.context.alert.kind===`error`?e.context.alert.message:null}function se(e){return e.context.resultState.kind===`ready`?e.context.resultState.result:null}function ce(e){return h(e)??null}function le(e){return e.isSessionPending?{kind:`pending`}:e.email?{email:e.email,kind:`signedIn`}:{kind:`signedOut`}}function ue(e){return`Couldn't update the device URL. Try the same action again.`}function de(e,t){return e&&`error`in e,t}function fe(e){return{activeUserCode:e.userCode,alert:W(),inputCode:e.userCode,pendingDecision:null,pendingVerification:null,resultState:e.resultState,...pe(e.context.activeUserCode,e.userCode)?X(e.context,e.userCode,!0):{navigation:null,nextNavigationId:e.context.nextNavigationId}}}function pe(e,t){return t!==e}function me(e){return e instanceof Error?e.name:`unknown`}var Q=n();function he(e){return e.panelView===`entry`?{badge:`Enter code`,description:`Paste the code from your terminal to verify the device login request before approving access.`,icon:L,title:`Authorize OneQuery CLI`,tone:`primary`}:e.panelView===`verifying`?{badge:`Checking request`,description:`We’re validating the code from your terminal and loading the next step in the authorization flow.`,icon:N,title:`Checking device code`,tone:`neutral`}:e.panelView===`sessionCheck`?{badge:`Checking session`,description:`We’re checking whether you already have an active OneQuery session for this device request.`,icon:P,title:`Confirming your browser session`,tone:`neutral`}:e.panelView===`signInRequired`?{badge:`Sign in required`,description:`Sign in with the account that should own this CLI session.`,icon:P,title:`Sign in to approve this device`,tone:`primary`}:e.panelView===`review`?{badge:`Review request`,description:`Review the request and decide whether to authorize this CLI sign-in.`,icon:F,title:`Approve device login`,tone:`primary`}:e.result?.tone===`success`?{badge:`Approved`,description:e.result.message,icon:d,title:e.result.title,tone:`success`}:{badge:`Denied`,description:e.result?.message??`This device request has been denied or could not be completed.`,icon:p,title:e.result?.title??`Device Denied`,tone:`error`}}function ge(e){switch(e){case`primary`:return`border-primary/15 bg-primary/5 text-primary`;case`success`:return`border-primary/15 bg-primary/5 text-primary`;case`error`:return`border-destructive/15 bg-destructive/5 text-destructive`;case`neutral`:return`border-border bg-muted/40 text-foreground`}}function _e(e){switch(e){case`primary`:return`bg-primary/10 text-primary`;case`success`:return`bg-primary/10 text-primary`;case`error`:return`bg-destructive/10 text-destructive`;case`neutral`:return`bg-background text-foreground`}}function $(e){let t=(0,R.c)(10),{label:n,value:r,emphasis:i}=e,a=i===`error`?`border-destructive/15 bg-destructive/5`:`border-primary/15 bg-primary/5`,o;t[0]===a?o=t[1]:(o=u(`rounded-2xl border p-4`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n}),t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=(0,Q.jsx)(`p`,{className:`mt-2 font-mono text-xl font-semibold tracking-[0.32em] text-foreground sm:text-2xl`,children:r}),t[4]=r,t[5]=c);let l;return t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,Q.jsxs)(`div`,{className:o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function ve(e){let t=(0,R.c)(10),{label:n,value:r,tone:i}=e,a=i===`error`?`border-destructive/15 bg-destructive/5`:`border-border bg-muted/30`,o;t[0]===a?o=t[1]:(o=u(`rounded-2xl border p-4`,a),t[0]=a,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n}),t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=(0,Q.jsx)(`p`,{className:`mt-2 font-medium text-foreground`,children:r}),t[4]=r,t[5]=c);let l;return t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,Q.jsxs)(`div`,{className:o,children:[s,c]}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9],l}var ye=a(v);function be(){let e=(0,R.c)(59),t=o(),{orgId:n,user_code:r}=ye.useSearch(),{auth:i}=ye.useRouteContext(),a=n??null,s;e[0]===r?s=e[1]:(s=h(r??null)??null,e[0]=r,e[1]=s);let c=s,l=ee(re),u=A(l,ie),d=A(l,Oe),f=A(l,De),p=A(l,oe),g=A(l,se),_=A(l,ae),y=A(l,Ee),b=A(l,Te),x=A(l,we),S=A(l,Ce),C=A(l,Se),w=A(l,xe),T=f??c,E;e[2]!==T||e[3]!==a?(E=m(T,a),e[2]=T,e[3]=a,e[4]=E):E=e[4];let D=E,O;e[5]!==u||e[6]!==g?(O=he({panelView:u,result:g}),e[5]=u,e[6]=g,e[7]=O):O=e[7];let k=O,j,M;e[8]!==l||e[9]!==c?(j=()=>{l.send({type:`deviceAuth/routeSynced`,userCode:c})},M=[l,c],e[8]=l,e[9]=c,e[10]=j,e[11]=M):(j=e[10],M=e[11]),(0,z.useEffect)(j,M);let N,P;e[12]!==l||e[13]!==C||e[14]!==b?(N=()=>{if(!C||b===null)return;let e=!1;return te(b.userCode).then(t=>{if(!e){if(t.isErr()){l.send({message:t.error.message,requestId:b.requestId,type:`deviceAuth/verificationFailed`});return}l.send({requestId:b.requestId,status:t.value.status,type:`deviceAuth/verificationSucceeded`,userCode:t.value.userCode})}}),()=>{e=!0}},P=[l,C,b],e[12]=l,e[13]=C,e[14]=b,e[15]=N,e[16]=P):(N=e[15],P=e[16]),(0,z.useEffect)(N,P);let F;e[17]!==l||e[18]!==i.session?.user.email||e[19]!==S?(F=()=>{S&&l.send({session:le({isSessionPending:!1,email:i.session?.user.email??null}),type:`deviceAuth/sessionSynced`})},e[17]=l,e[18]=i.session?.user.email,e[19]=S,e[20]=F):F=e[20];let I=i.session?.user.email,L;e[21]!==l||e[22]!==S||e[23]!==I?(L=[l,I,S],e[21]=l,e[22]=S,e[23]=I,e[24]=L):L=e[24],(0,z.useEffect)(F,L);let B,V;e[25]!==l||e[26]!==w||e[27]!==x?(B=()=>{if(!w||x===null)return;let e=!1;return ne({action:x.action,userCode:x.userCode}).then(t=>{if(!e){if(t.isErr()){l.send({message:t.error.message,requestId:x.requestId,type:`deviceAuth/decisionFailed`});return}l.send({message:t.value.message,requestId:x.requestId,title:t.value.title,tone:t.value.tone,type:`deviceAuth/decisionSucceeded`})}}),()=>{e=!0}},V=[l,w,x],e[25]=l,e[26]=w,e[27]=x,e[28]=B,e[29]=V):(B=e[28],V=e[29]),(0,z.useEffect)(B,V);let H,U;e[30]!==l||e[31]!==t||e[32]!==y||e[33]!==a?(H=()=>{y===null||y.phase!==`pending`||(l.send({id:y.id,type:`deviceAuth/navigationStarted`}),t({replace:y.replace,search:y.userCode===null?{}:{user_code:y.userCode,...a?{orgId:a}:{}},to:v}).then(()=>{l.send({id:y.id,type:`deviceAuth/navigationCompleted`})}).catch(e=>{console.error(`[device-auth] failed to sync device route`,{errorName:ke(e),navigationId:y.id,replace:y.replace}),l.send({id:y.id,message:ue(e),type:`deviceAuth/navigationFailed`})}))},U=[l,t,y,a],e[30]=l,e[31]=t,e[32]=y,e[33]=a,e[34]=H,e[35]=U):(H=e[34],U=e[35]),(0,z.useEffect)(H,U);let W=w&&x?.action===`approve`,G=w&&x?.action===`deny`,K,q,J,Y,X;e[36]===l?(K=e[37],q=e[38],J=e[39],Y=e[40],X=e[41]):(K=()=>{l.send({type:`deviceAuth/approve`})},q=()=>{l.send({type:`deviceAuth/deny`})},J=e=>{l.send({type:`deviceAuth/inputChanged`,value:e.toUpperCase()})},Y=()=>{l.send({type:`deviceAuth/submit`})},X=()=>{l.send({type:`deviceAuth/useDifferentCode`})},e[36]=l,e[37]=K,e[38]=q,e[39]=J,e[40]=Y,e[41]=X);let Z;return e[42]!==f||e[43]!==p||e[44]!==d||e[45]!==a||e[46]!==k||e[47]!==u||e[48]!==g||e[49]!==D||e[50]!==_||e[51]!==W||e[52]!==G||e[53]!==K||e[54]!==q||e[55]!==J||e[56]!==Y||e[57]!==X?(Z={activeUserCode:f,errorMessage:p,inputCode:d,isSubmittingApprove:W,isSubmittingDeny:G,onboardingOrganizationId:a,onApprove:K,onDeny:q,onInputChange:J,onSubmit:Y,onUseDifferentCode:X,panelMeta:k,panelView:u,result:g,resumePath:D,sessionEmail:_},e[42]=f,e[43]=p,e[44]=d,e[45]=a,e[46]=k,e[47]=u,e[48]=g,e[49]=D,e[50]=_,e[51]=W,e[52]=G,e[53]=K,e[54]=q,e[55]=J,e[56]=Y,e[57]=X,e[58]=Z):Z=e[58],Z}function xe(e){return e.matches({pending:`submittingDecision`})}function Se(e){return e.matches(`verifying`)}function Ce(e){return e.matches(`pending`)}function we(e){return e.context.pendingDecision}function Te(e){return e.context.pendingVerification}function Ee(e){return e.context.navigation}function De(e){return e.context.activeUserCode}function Oe(e){return e.context.inputCode}function ke(e){return e instanceof Error?e.name:`unknown`}function Ae(e){let t=(0,R.c)(33),{controller:n}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsxs)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0`,children:[(0,Q.jsx)(`div`,{className:`absolute left-[-7rem] top-[-8rem] h-64 w-64 rounded-full bg-primary/10 blur-3xl`}),(0,Q.jsx)(`div`,{className:`absolute right-[-8rem] top-20 h-80 w-80 rounded-full bg-muted blur-3xl`}),(0,Q.jsx)(`div`,{className:`absolute inset-0 bg-[linear-gradient(to_right,rgba(127,127,127,0.06)_1px,transparent_1px),linear-gradient(to_bottom,rgba(127,127,127,0.06)_1px,transparent_1px)] bg-[size:4.5rem_4.5rem] [mask-image:linear-gradient(to_bottom,white,rgba(255,255,255,0.3))]`})]}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(`header`,{className:`relative z-10 border-b border-border/60 bg-background/80 backdrop-blur`,children:(0,Q.jsxs)(`div`,{className:`mx-auto flex h-16 w-full max-w-6xl items-center justify-between px-6`,children:[(0,Q.jsxs)(r,{to:`/`,className:`flex items-center gap-3`,children:[(0,Q.jsx)(`img`,{src:`/onequery.svg`,alt:`OneQuery`,className:`h-9 w-9 rounded-lg`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`font-semibold text-lg leading-none`,children:`OneQuery`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Device authorization`})]})]}),(0,Q.jsx)(f,{})]})}),t[1]=a):a=t[1];let o;t[2]===n.panelMeta.tone?o=t[3]:(o=u(`inline-flex items-center gap-2 rounded-full border px-3 py-1 text-xs font-medium uppercase tracking-[0.18em]`,ge(n.panelMeta.tone)),t[2]=n.panelMeta.tone,t[3]=o);let s;t[4]===n.panelMeta.tone?s=t[5]:(s=u(`flex h-6 w-6 items-center justify-center rounded-full`,_e(n.panelMeta.tone)),t[4]=n.panelMeta.tone,t[5]=s);let c;t[6]===n.panelMeta.icon?c=t[7]:(c=(0,Q.jsx)(n.panelMeta.icon,{size:14,stroke:1.9}),t[6]=n.panelMeta.icon,t[7]=c);let l;t[8]!==s||t[9]!==c?(l=(0,Q.jsx)(`div`,{className:s,children:c}),t[8]=s,t[9]=c,t[10]=l):l=t[10];let d;t[11]!==n.panelMeta.badge||t[12]!==o||t[13]!==l?(d=(0,Q.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:(0,Q.jsxs)(`div`,{className:o,children:[l,n.panelMeta.badge]})}),t[11]=n.panelMeta.badge,t[12]=o,t[13]=l,t[14]=d):d=t[14];let p;t[15]===n.panelMeta.title?p=t[16]:(p=(0,Q.jsx)(w,{className:`mt-4 text-2xl`,children:n.panelMeta.title}),t[15]=n.panelMeta.title,t[16]=p);let m;t[17]===n.panelMeta.description?m=t[18]:(m=(0,Q.jsx)(T,{className:`max-w-2xl text-base leading-7`,children:n.panelMeta.description}),t[17]=n.panelMeta.description,t[18]=m);let h;t[19]!==d||t[20]!==p||t[21]!==m?(h=(0,Q.jsxs)(S,{className:`border-b border-border/60 pb-5`,children:[d,p,m]}),t[19]=d,t[20]=p,t[21]=m,t[22]=h):h=t[22];let g;t[23]===n.errorMessage?g=t[24]:(g=n.errorMessage?(0,Q.jsx)(`div`,{className:`rounded-xl border border-destructive/20 bg-destructive/5 px-3 py-2 text-sm text-destructive`,children:n.errorMessage}):null,t[23]=n.errorMessage,t[24]=g);let _;t[25]===n?_=t[26]:(_=je(n),t[25]=n,t[26]=_);let v;t[27]!==g||t[28]!==_?(v=(0,Q.jsxs)(C,{className:`space-y-5 pt-6`,children:[g,_]}),t[27]=g,t[28]=_,t[29]=v):v=t[29];let y;return t[30]!==h||t[31]!==v?(y=(0,Q.jsxs)(`div`,{className:`relative min-h-screen overflow-hidden bg-background`,children:[i,a,(0,Q.jsx)(`main`,{className:`relative z-10 flex flex-1 items-center justify-center px-6 py-10 lg:min-h-[calc(100vh-4rem)] lg:py-14`,children:(0,Q.jsx)(`section`,{className:`w-full max-w-3xl`,children:(0,Q.jsx)(`div`,{className:`rounded-[2rem] border border-border/70 bg-background/75 p-2 shadow-2xl shadow-foreground/5 backdrop-blur`,children:(0,Q.jsxs)(E,{className:`w-full border-0 bg-card/95 shadow-none ring-0`,children:[h,v]})})})})]}),t[30]=h,t[31]=v,t[32]=y):y=t[32],y}function je(e){switch(e.panelView){case`entry`:return(0,Q.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),e.onSubmit()},className:`space-y-5`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(x,{htmlFor:`user-code`,children:`Device code`}),(0,Q.jsx)(b,{id:`user-code`,value:e.inputCode,onChange:t=>e.onInputChange(t.target.value),placeholder:`ABCD1234`,autoCapitalize:`characters`,autoComplete:`one-time-code`,required:!0,className:`h-11 font-mono text-base tracking-[0.25em] uppercase`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Enter the 8-character code shown in your terminal.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(s,{type:`submit`,className:`h-11 w-full`,children:`Continue`}),(0,Q.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:`You’ll review the request before any access is granted.`})]})]});case`verifying`:return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)($,{label:`Verifying code`,value:e.activeUserCode??e.inputCode,emphasis:`primary`}),(0,Q.jsx)(`div`,{className:`rounded-2xl border bg-muted/40 p-4`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-full bg-primary/10 text-primary`,children:(0,Q.jsx)(I,{size:18,stroke:1.75})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`font-medium`,children:`Checking request details`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`We’re validating that this device code is still active and can be approved.`})]})]})})]});case`sessionCheck`:return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)($,{label:`Ready to approve`,value:e.activeUserCode??``,emphasis:`primary`}),(0,Q.jsx)(`div`,{className:`rounded-2xl border bg-muted/40 p-4`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-full bg-muted`,children:(0,Q.jsx)(P,{size:18,stroke:1.75})}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`font-medium`,children:`Checking your browser session`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Once we know who you are, you’ll be able to approve or deny this request.`})]})]})})]});case`signInRequired`:return(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)($,{label:`Device code`,value:e.activeUserCode??``,emphasis:`primary`}),(0,Q.jsx)(r,{to:_,search:{redirect:e.resumePath},className:c({variant:`default`,size:`lg`,className:`h-11 w-full`}),children:`Sign in`}),(0,Q.jsx)(s,{type:`button`,variant:`ghost`,size:`sm`,className:`mx-auto flex h-9 px-3 text-muted-foreground`,onClick:e.onUseDifferentCode,children:`Use a different code`})]});case`review`:return e.sessionEmail?(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)($,{label:`Device code`,value:e.activeUserCode??``,emphasis:`primary`}),(0,Q.jsx)(ve,{label:`Signed in as`,value:e.sessionEmail,tone:`neutral`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row`,children:[(0,Q.jsx)(s,{type:`button`,variant:`outline`,size:`lg`,className:`h-11 flex-1`,onClick:e.onDeny,disabled:e.isSubmittingApprove||e.isSubmittingDeny,children:e.isSubmittingDeny?`Denying...`:`Deny`}),(0,Q.jsx)(s,{type:`button`,size:`lg`,className:`h-11 flex-1`,onClick:e.onApprove,disabled:e.isSubmittingApprove||e.isSubmittingDeny,children:e.isSubmittingApprove?`Approving...`:`Approve`})]})]}):null;case`result`:return e.result?(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsx)($,{label:e.result.tone===`success`?`Approved code`:`Resolved code`,value:e.activeUserCode??``,emphasis:e.result.tone}),e.result.tone===`success`&&e.onboardingOrganizationId?(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Your CLI session is ready. Connect a data source now, or come back later from the dashboard.`}),(0,Q.jsx)(r,{to:g,search:{orgId:e.onboardingOrganizationId},className:c({variant:`default`,size:`lg`,className:`h-11 w-full`}),children:`Continue setup`})]}):null]}):null}}function Me(){let e=(0,R.c)(2),t=be(),n;return e[0]===t?n=e[1]:(n=(0,Q.jsx)(Ae,{controller:t}),e[0]=t,e[1]=n),n}function Ne(){let e=(0,R.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(Me,{}),e[0]=t):t=e[0],t}var Pe=Ne;export{Pe as component};
|
package/vendor/x86_64-pc-windows-msvc/runtime/dashboard/assets/invite._invitationId-Dt2OlNDo.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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-CZSIppar.js";import{t as l}from"./IconX-Cg43mUxH.js";import{t as u}from"./auth-client-Dj6z7Pcl.js";import{a as d,i as f}from"./app-routes-DM5pppqD.js";import{O as p,k as m,z as h}from"./index-C_q-gtGv.js";import{a as g,i as _,n as v,o as y,r as b,t as x}from"./card-CZCl7QNy.js";import{a as S,i as C,n as w,o as T}from"./xstate-react.esm-CfqAjJyu.js";import{n as E,t as D}from"./dist-Cg-lnuP8.js";var O=r(),k=e(t(),1),A=i(f),j=`Failed to accept invitation`,M=`Failed to navigate. Try again from home.`,N=1500,P={kind:`home`},F={ACCEPT:`inviteAccept/accept`,ACCEPT_FAILED:`inviteAccept/acceptFailed`,ACCEPT_SUCCEEDED:`inviteAccept/acceptSucceeded`,DECLINE:`inviteAccept/decline`,GO_HOME:`inviteAccept/goHome`,NAVIGATION_COMPLETED:`inviteAccept/navigationCompleted`,NAVIGATION_FAILED:`inviteAccept/navigationFailed`,NAVIGATION_STARTED:`inviteAccept/navigationStarted`,REDIRECT_RESOLUTION_FAILED:`inviteAccept/redirectResolutionFailed`,REDIRECT_RESOLVED:`inviteAccept/redirectResolved`},I={ACCEPTING:`accepting`,ERROR:`error`,NAVIGATING:`navigating`,READY:`ready`,REFRESHING_ORGANIZATIONS:`refreshingOrganizations`,SUCCESS_PENDING_REDIRECT:`successPendingRedirect`},L=class extends E(`InviteAcceptRequestError`)(){},R=class extends E(`InviteRedirectResolutionError`)(){};function z(){return{kind:`idle`}}function B(e){return{kind:`accepted`,organizationId:e}}function ee(e){return{kind:`error`,message:e}}function V(){return{navigation:null,nextNavigationId:1,nextRequestId:1,outcome:z(),pendingAcceptRequest:null,pendingRedirectResolution:null,redirectTarget:null}}function H(e){return{...V(),nextNavigationId:e.nextNavigationId,nextRequestId:e.nextRequestId}}function U(e,t){return{...H(e),outcome:ee(t)}}function W(e,t){return{navigation:{id:e.nextNavigationId,phase:`pending`,target:t},nextNavigationId:e.nextNavigationId+1}}function G(e){return e.redirectTarget??P}async function K(e){let t=await D.tryPromise({try:()=>u.acceptInvitation({invitationId:e}),catch:e=>new L({cause:e,message:j,reason:`request_failed`})});if(t.isErr())return D.err(t.error);let n=t.value;return n.error?D.err(new L({message:Y(n.error.message,j),reason:`response_failed`})):D.ok({acceptedOrganizationId:n.data.member.organizationId})}async function q(e){let t=await D.tryPromise({try:()=>e.refetchSession(),catch:t=>new R({acceptedOrganizationId:e.acceptedOrganizationId,cause:t,message:`Failed to refresh organizations after accepting invitation`,reason:`session_refresh_failed`,...e.userId?{userId:e.userId}:{}})});if(t.isErr())return X(t.error),D.err(t.error);let n=await D.tryPromise({try:()=>e.queryClient.fetchQuery({...p(e.userId),staleTime:0}),catch:t=>new R({acceptedOrganizationId:e.acceptedOrganizationId,cause:t,message:`Failed to refresh organizations after accepting invitation`,reason:`organization_list_failed`,...e.userId?{userId:e.userId}:{}})});if(n.isErr())return X(n.error),D.err(n.error);let r=n.value.find(t=>t.id===e.acceptedOrganizationId);if(r)return D.ok({kind:`organization`,organizationSlug:m(r)});let i=await D.tryPromise({try:()=>u.getFullOrganization({query:{organizationId:e.acceptedOrganizationId}}),catch:t=>new R({acceptedOrganizationId:e.acceptedOrganizationId,cause:t,message:`Failed to load accepted organization details`,reason:`organization_lookup_failed`,...e.userId?{userId:e.userId}:{}})});if(i.isErr())return X(i.error),D.err(i.error);if(i.value.data?.slug)return D.ok({kind:`organization`,organizationSlug:i.value.data.slug});let a=new R({acceptedOrganizationId:e.acceptedOrganizationId,message:`Accepted invitation but organization was not found`,reason:`organization_missing`,...e.userId?{userId:e.userId}:{}});return X(a),D.err(a)}function J(e,t){if(!(e instanceof Error))return t;let n=e.message.trim();return n.length===0?t:n}function Y(e,t){let n=e?.trim()??``;return n.length>0?n:t}function X(e){if(e.reason===`organization_missing`){console.error(`[invite] accepted invitation but organization was not found`,{acceptedOrganizationId:e.acceptedOrganizationId,userId:e.userId});return}console.error(`[invite] accepted invitation but failed to refresh orgs`,{acceptedOrganizationId:e.acceptedOrganizationId,error:e.cause??e.message,reason:e.reason,userId:e.userId})}function Z(e={}){let t=e.successRedirectDelayMs??N;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})=>W(e,P)),queueResolvedNavigation:T(({context:e})=>W(e,G(e))),resetFlow:T(({context:e,event:t})=>(C(t,F.NAVIGATION_COMPLETED),e.navigation?.id===t.id?H(e):{})),stageAcceptRequest:T(({context:e})=>({nextRequestId:e.nextRequestId+1,outcome:z(),pendingAcceptRequest:{requestId:e.nextRequestId},redirectTarget:null})),stageRedirectResolution:T(({context:e,event:t})=>(C(t,F.ACCEPT_SUCCEEDED),e.pendingAcceptRequest?.requestId===t.requestId?{nextRequestId:e.nextRequestId+1,pendingAcceptRequest:null,pendingRedirectResolution:{acceptedOrganizationId:t.acceptedOrganizationId,requestId:e.nextRequestId}}:{})),storeAcceptError:T(({context:e,event:t})=>(C(t,F.ACCEPT_FAILED),e.pendingAcceptRequest?.requestId===t.requestId?U(e,t.message):{})),storeAcceptedOrganizationId:T(({context:e,event:t})=>(C(t,F.ACCEPT_SUCCEEDED),e.pendingAcceptRequest?.requestId===t.requestId?{outcome:B(t.acceptedOrganizationId),redirectTarget:null}:{})),storeHomeRedirectTarget:T(({context:e,event:t})=>(C(t,F.REDIRECT_RESOLUTION_FAILED),e.pendingRedirectResolution?.requestId===t.requestId?{pendingRedirectResolution:null,redirectTarget:P}:{})),storeNavigationError:T(({context:e,event:t})=>(C(t,F.NAVIGATION_FAILED),e.navigation?.id===t.id?U(e,t.message):{})),storeResolvedRedirectTarget:T(({context:e,event:t})=>(C(t,F.REDIRECT_RESOLVED),e.pendingRedirectResolution?.requestId===t.requestId?{pendingRedirectResolution:null,redirectTarget:t.redirectTarget}:{}))},guards:{matchesPendingAcceptRequest:({context:e,event:t})=>t.type!==F.ACCEPT_FAILED&&t.type!==F.ACCEPT_SUCCEEDED?!1:e.pendingAcceptRequest?.requestId===t.requestId,matchesPendingRedirectResolution:({context:e,event:t})=>t.type!==F.REDIRECT_RESOLUTION_FAILED&&t.type!==F.REDIRECT_RESOLVED?!1:e.pendingRedirectResolution?.requestId===t.requestId},types:{}}).createMachine({context:V(),id:`inviteAccept`,initial:I.READY,states:{[I.READY]:{on:{[F.ACCEPT]:{actions:`stageAcceptRequest`,target:I.ACCEPTING},[F.DECLINE]:{actions:`queueHomeNavigation`,target:I.NAVIGATING}}},[I.ACCEPTING]:{on:{[F.ACCEPT_SUCCEEDED]:{actions:[`storeAcceptedOrganizationId`,`stageRedirectResolution`],guard:`matchesPendingAcceptRequest`,target:I.REFRESHING_ORGANIZATIONS},[F.ACCEPT_FAILED]:{actions:`storeAcceptError`,guard:`matchesPendingAcceptRequest`,target:I.ERROR}}},[I.REFRESHING_ORGANIZATIONS]:{on:{[F.REDIRECT_RESOLVED]:{actions:`storeResolvedRedirectTarget`,guard:`matchesPendingRedirectResolution`,target:I.SUCCESS_PENDING_REDIRECT},[F.REDIRECT_RESOLUTION_FAILED]:{actions:`storeHomeRedirectTarget`,guard:`matchesPendingRedirectResolution`,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}}}}})}var Q=Z();function te(e){return e.matches(I.ACCEPTING)?`accepting`:e.matches(I.ERROR)||e.matches(I.NAVIGATING)&&e.context.outcome.kind===`error`?`error`:e.matches(I.REFRESHING_ORGANIZATIONS)||e.matches(I.SUCCESS_PENDING_REDIRECT)||e.matches(I.NAVIGATING)&&e.context.outcome.kind===`accepted`?`success`:`ready`}function ne(e){return e.context.outcome.kind===`error`?e.context.outcome.message:null}function re(e){return J(e,M)}function ie(){let e=(0,O.c)(42),t=a(),n=h(),{invitationId:r}=A.useParams(),{auth:i,refetchSession:o}=A.useRouteContext(),s=i.session?.user.id,c;e[0]===r?c=e[1]:(c=()=>K(r),e[0]=r,e[1]=c);let l=c,u;e[2]!==n||e[3]!==o||e[4]!==s?(u=e=>q({acceptedOrganizationId:e,queryClient:n,refetchSession:o,userId:s}),e[2]=n,e[3]=o,e[4]=s,e[5]=u):u=e[5];let f=u,[p,m]=w(Q),g=p.context.navigation,_=p.context.pendingAcceptRequest,v=p.context.pendingRedirectResolution,y;e[6]===p?y=e[7]:(y=p.matches(I.ACCEPTING),e[6]=p,e[7]=y);let b=y,x;e[8]===p?x=e[9]:(x=p.matches(I.REFRESHING_ORGANIZATIONS),e[8]=p,e[9]=x);let S=x,C,T;e[10]!==l||e[11]!==b||e[12]!==_||e[13]!==m?(C=()=>{if(!b||_===null)return;let e=!1;return l().then(t=>{if(!e){if(t.isErr()){m({message:t.error.message,requestId:_.requestId,type:F.ACCEPT_FAILED});return}m({acceptedOrganizationId:t.value.acceptedOrganizationId,requestId:_.requestId,type:F.ACCEPT_SUCCEEDED})}}),()=>{e=!0}},T=[l,b,_,m],e[10]=l,e[11]=b,e[12]=_,e[13]=m,e[14]=C,e[15]=T):(C=e[14],T=e[15]),(0,k.useEffect)(C,T);let E,D;e[16]!==S||e[17]!==v||e[18]!==f||e[19]!==m?(E=()=>{if(!S||v===null)return;let e=!1;return f(v.acceptedOrganizationId).then(t=>{if(!e){if(t.isErr()){m({requestId:v.requestId,type:F.REDIRECT_RESOLUTION_FAILED});return}m({redirectTarget:t.value,requestId:v.requestId,type:F.REDIRECT_RESOLVED})}}),()=>{e=!0}},D=[S,v,f,m],e[16]=S,e[17]=v,e[18]=f,e[19]=m,e[20]=E,e[21]=D):(E=e[20],D=e[21]),(0,k.useEffect)(E,D);let j,M;e[22]!==t||e[23]!==g||e[24]!==m?(j=()=>{g===null||g.phase!==`pending`||(m({id:g.id,type:F.NAVIGATION_STARTED}),(g.target.kind===`home`?t({to:`/`}):t({params:{org_slug:g.target.organizationSlug},to:d})).then(()=>{m({id:g.id,type:F.NAVIGATION_COMPLETED})}).catch(e=>{console.error(`[invite] failed to navigate after accepting invitation`,{error:e,navigation:g}),m({id:g.id,message:re(e),type:F.NAVIGATION_FAILED})}))},M=[t,g,m],e[22]=t,e[23]=g,e[24]=m,e[25]=j,e[26]=M):(j=e[25],M=e[26]),(0,k.useEffect)(j,M);let N,P;e[27]===m?(N=e[28],P=e[29]):(N=()=>{m({type:F.ACCEPT})},P=()=>{m({type:F.DECLINE})},e[27]=m,e[28]=N,e[29]=P);let L;e[30]===p?L=e[31]:(L=ne(p),e[30]=p,e[31]=L);let R;e[32]===m?R=e[33]:(R=()=>{m({type:F.GO_HOME})},e[32]=m,e[33]=R);let z;e[34]===p?z=e[35]:(z=te(p),e[34]=p,e[35]=z);let B;return e[36]!==N||e[37]!==P||e[38]!==L||e[39]!==R||e[40]!==z?(B={accept:N,decline:P,errorMessage:L,goHome:R,status:z},e[36]=N,e[37]=P,e[38]=L,e[39]=R,e[40]=z,e[41]=B):B=e[41],B}var $=n();function ae(){let e=(0,O.c)(28),{accept:t,decline:n,errorMessage:r,goHome:i,status:a}=ie(),u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsxs)(g,{className:`text-center`,children:[(0,$.jsx)(y,{className:`text-2xl`,children:`Organization Invitation`}),(0,$.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,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,$.jsx)(`div`,{className:`rounded-full bg-primary/10 p-4`,children:(0,$.jsx)(s,{size:48,className:`text-primary`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium`,children:`Ready to join`}),(0,$.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,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,$.jsx)(c,{size:48,className:`animate-spin text-primary`}),(0,$.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,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,$.jsx)(`div`,{className:`rounded-full bg-green-500/10 p-4`,children:(0,$.jsx)(s,{size:48,className:`text-green-500`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium text-green-600`,children:`Successfully joined!`}),(0,$.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,$.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-center`,children:[(0,$.jsx)(`div`,{className:`rounded-full bg-destructive/10 p-4`,children:(0,$.jsx)(l,{size:48,className:`text-destructive`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium text-destructive`,children:`Failed to accept invitation`}),(0,$.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,$.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,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{variant:`outline`,onClick:n,children:`Decline`}),(0,$.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,$.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,$.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,$.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:(0,$.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 oe=ae;export{oe as component};
|
|
@@ -1 +0,0 @@
|
|
|
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-CcB6O_vF.js";import{i as u,n as d}from"./auth-client-Dj6z7Pcl.js";import{t as f}from"./useQuery-Bj5cJCZc.js";import{f as p,s as m,u as h}from"./schemas-K0ZhTj23.js";import{G as g,H as _,W as v,z as y}from"./index-C_q-gtGv.js";import{t as b}from"./input-DSkIbIFK.js";import{t as x}from"./label-CUY3W2yp.js";import{a as S,n as C,o as w,r as T,t as E}from"./card-CZCl7QNy.js";import{n as D,t as O}from"./zod-BgAmwIO1.js";import{t as k}from"./auth-bootstrap-query-KhD_VRw3.js";var A=e(t(),1),j=n(),M=h({email:m(`Please enter a valid email`),password:p().min(8,`Password must be at least 8 characters`)}),N=h({email:m(`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=h({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=y(),n=i(),[a,m]=(0,A.useState)(`signin`),[z,B]=(0,A.useState)(!1),{redirect:V}=F.useSearch(),H=g(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=h({bootstrap:h({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=v({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||(m(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-4 sm: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-base sm:text-lg`,children:`OneQuery`})]}),(0,j.jsx)(l,{})]}),(0,j.jsx)(`main`,{className:`flex flex-1 items-start justify-center px-4 pb-10 pt-12 sm:items-center sm:px-6 sm:py-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 +0,0 @@
|
|
|
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{n as u,r as d,t as f}from"./checkbox-BLYovhFU.js";import{t as p}from"./IconLoader2-CZSIppar.js";import{t as m}from"./IconX-Cg43mUxH.js";import{l as h}from"./app-routes-DM5pppqD.js";import{a as g,c as _,i as v,l as y,n as b,o as x,r as S,s as C,t as w,u as T}from"./use-optimistic-mutation-BCZ8tApt.js";import{t as E}from"./useQuery-Bj5cJCZc.js";import{t as D}from"./useSuspenseQuery-ZQGYM-g4.js";import{f as O,g as k,s as A,u as j}from"./schemas-K0ZhTj23.js";import{n as M}from"./src-Cs2YIecp.js";import{a as N,r as P}from"./organization-permissions-PidGz2SY.js";import{L as F,S as I,b as ee,x as L,z as R}from"./index-C_q-gtGv.js";import{t as te}from"./input-DSkIbIFK.js";import{n as z,r as B,t as V}from"./avatar-DoLsibq3.js";import{d as H,n as U,r as ne,t as re}from"./dropdown-menu-CLot8VIw.js";import{t as ie}from"./format-date-B5v-Ga9z.js";import{t as ae}from"./badge-D8XKsDus.js";import{t as oe}from"./label-CUY3W2yp.js";import{a as se,i as W,n as ce,o as G,r as K,t as le}from"./table-mA0t_uVk.js";import{a as ue,n as de,o as fe}from"./xstate-react.esm-CfqAjJyu.js";import{r as q}from"./api-paths-DcYkf-C_.js";import{n as pe,t as me}from"./zod-BgAmwIO1.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=j({expiresAt:k().optional(),id:O(),role:O().optional()}),we=j({id:O(),role:O()}),Te=j({member:we});async function Ee(e,t){if((e.headers.get(`content-type`)??``).includes(`application/json`)){let n=await e.json().catch(()=>null),r=j({code:O().optional(),error:O().optional(),message:O().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=b(u),f=n.expiresAt?Date.parse(n.expiresAt)<Date.now():!1,h;t[10]===n.email?h=t[11]:(h=(0,Y.jsx)(K,{children:(0,Y.jsx)(`span`,{className:`font-medium`,children:n.email})}),t[10]=n.email,t[11]=h);let g;t[12]!==n.rawRole||t[13]!==n.roleNames?(g=(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]=g):g=t[14];let _=f?`text-destructive`:`text-muted-foreground`,v;t[15]===n.expiresAt?v=t[16]:(v=n.expiresAt?je(n.expiresAt):`Pending`,t[15]=n.expiresAt,t[16]=v);let y;t[17]!==_||t[18]!==v?(y=(0,Y.jsx)(K,{children:(0,Y.jsx)(`span`,{className:_,children:v})}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let x;t[20]!==a||t[21]!==d||t[22]!==f?(x=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)(p,{size:16,className:`animate-spin`}):(0,Y.jsx)(m,{size:16,stroke:2})}),t[20]=a,t[21]=d,t[22]=f,t[23]=x):x=t[23];let S;t[24]===x?S=t[25]:(S=(0,Y.jsx)(K,{className:`text-right`,children:x}),t[24]=x,t[25]=S);let C;return t[26]!==S||t[27]!==h||t[28]!==g||t[29]!==y?(C=(0,Y.jsxs)(G,{children:[h,g,y,S]}),t[26]=S,t[27]=h,t[28]=g,t[29]=y,t[30]=C):C=t[30],C}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=E(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=N(i.context.selectedRoleNames),t[4]=i.context.selectedRoleNames,t[5]=o);let s=o,c;t[6]===i.context.sourceRoleNames?c=t[7]:(c=N(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)(f,{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=j({email:A(`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),b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b={defaultValues:{email:``},resolver:me(Ue)},t[1]=b):b=t[1];let T=pe(b),E;t[2]===i?E=t[3]:(E=e=>({id:`temp-${crypto.randomUUID()}`,email:e.email,rawRole:N(e.roleNames),roleNames:[...e.roleNames],status:`pending`,expiresAt:M().toISOString(),organizationId:i,inviterId:`current-user`}),t[2]=i,t[3]=E);let D;t[4]===i?D=t[5]:(D=async e=>De({email:e.email,organizationId:i,roleNames:e.roleNames}),t[4]=i,t[5]=D);let O;t[6]!==T||t[7]!==m?(O=e=>{e?.id&&u({expiresAt:e.expiresAt??M().toISOString(),url:`${a()}${h(e.id)}`}),T.reset(),m.reset(),f(null)},t[6]=T,t[7]=m,t[8]=O):O=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]!==E||t[13]!==D||t[14]!==O||t[15]!==k.queryKey?(A={createOptimisticItem:E,errorMessage:`Failed to create invitation link`,mutationFn:D,onSuccess:O,queryKey:k.queryKey,successMessage:`Invitation link created`},t[12]=E,t[13]=D,t[14]=O,t[15]=k.queryKey,t[16]=A):A=t[16];let j=w(A),P;t[17]!==j||t[18]!==m.isSelectionEmpty||t[19]!==m.selectedRoleNames?(P=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]=P):P=t[20];let F=P,I;t[21]!==T||t[22]!==m?(I=e=>{c(e),e||(u(null),f(null),m.reset(),T.reset())},t[21]=T,t[22]=m,t[23]=I):I=t[23];let L=I,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)(y,{render:n}),t[27]=n,t[28]=B);let V;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Y.jsxs)(C,{children:[(0,Y.jsx)(_,{children:`Create Invitation Link`}),(0,Y.jsx)(g,{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]!==T||t[31]!==z||t[32]!==l||t[33]!==j||t[34]!==F||t[35]!==d||t[36]!==m.isSelectionEmpty||t[37]!==m.selectedRoleNames?(H=(0,Y.jsxs)(v,{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)(x,{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:T.handleSubmit(F),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`,...T.register(`email`)}),T.formState.errors.email&&(0,Y.jsx)(`p`,{className:`text-sm text-destructive`,children:T.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)(x,{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]=T,t[31]=z,t[32]=l,t[33]=j,t[34]=F,t[35]=d,t[36]=m.isSelectionEmpty,t[37]=m.selectedRoleNames,t[38]=H):H=t[38];let U;return t[39]!==L||t[40]!==o||t[41]!==B||t[42]!==H?(U=(0,Y.jsxs)(S,{open:o,onOpenChange:L,children:[B,H]}),t[39]=L,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=R(),a=(0,Z.useMemo)(()=>$(r.roleNames),[N(r.roleNames)]),o=Be({initialRoleNames:a});(0,Z.useEffect)(()=>{t&&o.resetToRoleNames(a)},[a,r.id,t,o.resetToRoleNames]);let c=T({mutationFn:async()=>{await ke({memberId:r.id,organizationId:r.organizationId,roleNames:o.selectedRoleNames})},onError:e=>{F.error(e.message||`Failed to update role`)},onSuccess:()=>{F.success(`Role updated`),i.invalidateQueries({queryKey:L(e,r.organizationId).queryKey}),n(!1)}});return(0,Y.jsx)(S,{open:t,onOpenChange:n,children:(0,Y.jsxs)(v,{className:`sm:max-w-[400px]`,children:[(0,Y.jsxs)(C,{children:[(0,Y.jsx)(_,{children:`Change Role`}),(0,Y.jsxs)(g,{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)(x,{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=P({roleName:`owner`,rawRole:n.rawRole}),t[0]=n.rawRole,t[1]=l);let f=l,p=n.id,m;t[2]!==n.id||t[3]!==n.organizationId?(m=async()=>{await Ae({memberId:n.id,organizationId:n.organizationId})},t[2]=n.id,t[3]=n.organizationId,t[4]=m):m=t[4];let h;t[5]!==r||t[6]!==n.organizationId?(h=L(r,n.organizationId),t[5]=r,t[6]=n.organizationId,t[7]=h):h=t[7];let g;t[8]!==n.id||t[9]!==m||t[10]!==h.queryKey?(g={errorMessage:`Failed to remove member`,itemId:p,mutationFn:m,queryKey:h.queryKey,successMessage:`Member removed`},t[8]=n.id,t[9]=m,t[10]=h.queryKey,t[11]=g):g=t[11];let _=b(g),v=i&&!f&&!c,y=i&&!f&&!c,x;t[12]===n.user.image?x=t[13]:(x=n.user.image&&(0,Y.jsx)(B,{src:n.user.image}),t[12]=n.user.image,t[13]=x);let S;t[14]===n.user.name?S=t[15]:(S=Ke(n.user.name),t[14]=n.user.name,t[15]=S);let C;t[16]===S?C=t[17]:(C=(0,Y.jsx)(z,{children:S}),t[16]=S,t[17]=C);let w;t[18]!==x||t[19]!==C?(w=(0,Y.jsxs)(V,{size:`sm`,children:[x,C]}),t[18]=x,t[19]=C,t[20]=w):w=t[20];let T;t[21]===n.user.name?T=t[22]:(T=(0,Y.jsx)(`div`,{className:`font-medium`,children:n.user.name}),t[21]=n.user.name,t[22]=T);let E;t[23]===n.user.email?E=t[24]:(E=(0,Y.jsx)(`div`,{className:`text-muted-foreground text-sm`,children:n.user.email}),t[23]=n.user.email,t[24]=E);let D;t[25]!==T||t[26]!==E?(D=(0,Y.jsxs)(`div`,{children:[T,E]}),t[25]=T,t[26]=E,t[27]=D):D=t[27];let O;t[28]!==D||t[29]!==w?(O=(0,Y.jsx)(K,{children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[w,D]})}),t[28]=D,t[29]=w,t[30]=O):O=t[30];let k;t[31]!==n.rawRole||t[32]!==n.roleNames?(k=(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]=k):k=t[33];let A;t[34]!==v||t[35]!==y||t[36]!==_?(A=(v||y)&&(0,Y.jsxs)(re,{children:[(0,Y.jsx)(H,{children:(0,Y.jsx)(s,{variant:`ghost`,size:`icon-sm`,children:(0,Y.jsx)(d,{size:16,stroke:2})})}),(0,Y.jsxs)(U,{align:`end`,children:[v&&(0,Y.jsxs)(ne,{onClick:()=>o(!0),children:[(0,Y.jsx)(ge,{size:16,stroke:2}),`Change Role`]}),y&&(0,Y.jsxs)(ne,{onClick:()=>_.mutate(),disabled:_.isPending,className:`text-destructive focus:text-destructive`,children:[(0,Y.jsx)(u,{size:16,stroke:2}),_.isPending?`Removing...`:`Remove`]})]})]}),t[34]=v,t[35]=y,t[36]=_,t[37]=A):A=t[37];let j;t[38]===A?j=t[39]:(j=(0,Y.jsx)(K,{className:`text-right`,children:A}),t[38]=A,t[39]=j);let M;t[40]!==O||t[41]!==k||t[42]!==j?(M=(0,Y.jsxs)(G,{children:[O,k,j]}),t[40]=O,t[41]=k,t[42]=j,t[43]=M):M=t[43];let N;t[44]!==r||t[45]!==n||t[46]!==a?(N=(0,Y.jsx)(Ge,{open:a,onOpenChange:o,currentUserId:r,member:n}),t[44]=r,t[45]=n,t[46]=a,t[47]=N):N=t[47];let F;return t[48]!==M||t[49]!==N?(F=(0,Y.jsxs)(Y.Fragment,{children:[M,N]}),t[48]=M,t[49]=N,t[50]=F):F=t[50],F}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=L(e.currentUserId,e.organizationId),t[0]=e.currentUserId,t[1]=e.organizationId,t[2]=n):n=t[2];let{data:r}=D(n),i;t[3]!==r||t[4]!==e.currentUserId?(i=I({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 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./useBaseQuery-B3PCmH7w.js";function n(n,r){return t(n,e,r)}export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./useBaseQuery-B3PCmH7w.js";function r(r,i){return n({...r,enabled:!0,suspense:!0,throwOnError:e,placeholderData:void 0},t,i)}export{r as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,n as t}from"./jsx-runtime-DG_AJzB_.js";import{a as n,i as r}from"./useRouterState-DpT8luFk.js";var i=e(t()),a=i.useLayoutEffect;function o(){if(typeof globalThis<`u`)return globalThis;if(typeof self<`u`)return self;if(typeof window<`u`)return window;if(typeof global<`u`)return global}function s(){let e=o();if(e.__xstate__)return e.__xstate__}var c=e=>{if(typeof window>`u`)return;let t=s();t&&t.register(e)},l=class{constructor(e){this._process=e,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){this._current&&(this._current.next=null,this._last=this._current)}enqueue(e){let t={value:e,next:null};if(this._current){this._last.next=t,this._last=t;return}this._current=t,this._last=t,this._active&&this.flush()}flush(){for(;this._current;){let e=this._current;this._process(e.value),this._current=e.next}this._last=null}},u=``,d=`#`,f=`*`,p=`xstate.init`,ee=`xstate.stop`;function te(e,t){return{type:`xstate.after.${e}.${t}`}}function m(e,t){return{type:`xstate.done.state.${e}`,output:t}}function ne(e,t){return{type:`xstate.done.actor.${e}`,output:t,actorId:e}}function re(e,t){return{type:`xstate.error.actor.${e}`,error:t,actorId:e}}function ie(e){return{type:p,input:e}}function h(e){setTimeout(()=>{throw e})}var ae=typeof Symbol==`function`&&Symbol.observable||`@@observable`;function oe(e,t){let n=ce(e),r=ce(t);return typeof r==`string`?typeof n==`string`?r===n:!1:typeof n==`string`?n in r:Object.keys(n).every(e=>e in r?oe(n[e],r[e]):!1)}function se(e){if(fe(e))return e;let t=[],n=``;for(let r=0;r<e.length;r++){switch(e.charCodeAt(r)){case 92:n+=e[r+1],r++;continue;case 46:t.push(n),n=``;continue}n+=e[r]}return t.push(n),t}function ce(e){return ct(e)?e.value:typeof e==`string`?le(se(e)):e}function le(e){if(e.length===1)return e[0];let t={},n=t;for(let t=0;t<e.length-1;t++)if(t===e.length-2)n[e[t]]=e[t+1];else{let r=n;n={},r[e[t]]=n}return t}function ue(e,t){let n={},r=Object.keys(e);for(let i=0;i<r.length;i++){let a=r[i];n[a]=t(e[a],a,e,i)}return n}function de(e){return fe(e)?e:[e]}function g(e){return e===void 0?[]:de(e)}function _(e,t,n,r){return typeof e==`function`?e({context:t,event:n,self:r}):e}function fe(e){return Array.isArray(e)}function pe(e){return e.type.startsWith(`xstate.error.actor`)}function v(e){return de(e).map(e=>e===void 0||typeof e==`string`?{target:e}:e)}function me(e){if(!(e===void 0||e===u))return g(e)}function y(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}function he(e,t){return`${t}.${e}`}function b(e,t){let n=t.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return e.implementations.actors[t];let[,r,i]=n,a=e.getStateNodeById(i).config.invoke;return(Array.isArray(a)?a[r]:a).src}function ge(e,t){if(t===e||t===f)return!0;if(!t.endsWith(`.*`))return!1;let n=t.split(`.`),r=e.split(`.`);for(let e=0;e<n.length;e++){let t=n[e],i=r[e];if(t===`*`)return e===n.length-1;if(t!==i)return!1}return!0}function _e(e,t){return`${e.sessionId}.${t}`}var ve=0;function ye(e,t){let n=new Map,r=new Map,i=new WeakMap,a=new Set,o={},{clock:s,logger:c}=t,l={schedule:(e,t,n,r,i=Math.random().toString(36).slice(2))=>{let a={source:e,target:t,event:n,delay:r,id:i,startedAt:Date.now()},c=_e(e,i);u._snapshot._scheduledEvents[c]=a,o[c]=s.setTimeout(()=>{delete o[c],delete u._snapshot._scheduledEvents[c],u._relay(e,t,n)},r)},cancel:(e,t)=>{let n=_e(e,t),r=o[n];delete o[n],delete u._snapshot._scheduledEvents[n],r!==void 0&&s.clearTimeout(r)},cancelAll:e=>{for(let t in u._snapshot._scheduledEvents){let n=u._snapshot._scheduledEvents[t];n.source===e&&l.cancel(e,n.id)}}},u={_snapshot:{_scheduledEvents:(t?.snapshot&&t.snapshot.scheduler)??{}},_bookId:()=>`x:${ve++}`,_register:(e,t)=>(n.set(e,t),e),_unregister:e=>{n.delete(e.sessionId);let t=i.get(e);t!==void 0&&(r.delete(t),i.delete(e))},get:e=>r.get(e),getAll:()=>Object.fromEntries(r.entries()),_set:(e,t)=>{let n=r.get(e);if(n&&n!==t)throw Error(`Actor with system ID '${e}' already exists.`);r.set(e,t),i.set(t,e)},inspect:e=>{let t=y(e);return a.add(t),{unsubscribe(){a.delete(t)}}},_sendInspectionEvent:t=>{if(!a.size)return;let n={...t,rootId:e.sessionId};a.forEach(e=>e.next?.(n))},_relay:(e,t,n)=>{u._sendInspectionEvent({type:`@xstate.event`,sourceRef:e,actorRef:t,event:n}),t._send(n)},scheduler:l,getSnapshot:()=>({_scheduledEvents:{...u._snapshot._scheduledEvents}}),start:()=>{let e=u._snapshot._scheduledEvents;u._snapshot._scheduledEvents={};for(let t in e){let{source:n,target:r,event:i,delay:a,id:o}=e[t];l.schedule(n,r,i,a,o)}},_clock:s,_logger:c};return u}var x=!1,S=function(e){return e[e.NotStarted=0]=`NotStarted`,e[e.Running=1]=`Running`,e[e.Stopped=2]=`Stopped`,e}({}),be={clock:{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},logger:console.log.bind(console),devTools:!1},xe=class{constructor(e,t){this.logic=e,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new l(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=S.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this.systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];let n={...be,...t},{clock:r,logger:i,parent:a,syncSnapshot:o,id:s,systemId:c,inspect:u}=n;this.system=a?a.system:ye(this,{clock:r,logger:i}),u&&!a&&this.system.inspect(y(u)),this.sessionId=this.system._bookId(),this.id=s??this.sessionId,this.logger=t?.logger??this.system._logger,this.clock=t?.clock??this.system._clock,this._parent=a,this._syncSnapshot=o,this.options=n,this.src=n.src??e,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:e=>{this._deferred.push(e)},system:this.system,stopChild:e=>{if(e._parent!==this)throw Error(`Cannot stop child actor ${e.id} of ${this.id} because it is not a child`);e._stop()},emit:e=>{let t=this.eventListeners.get(e.type),n=this.eventListeners.get(`*`);if(!t&&!n)return;let r=[...t?t.values():[],...n?n.values():[]];for(let t of r)try{t(e)}catch(e){h(e)}},actionExecutor:e=>{let t=()=>{if(this._actorScope.system._sendInspectionEvent({type:`@xstate.action`,actorRef:this,action:{type:e.type,params:e.params}}),!e.exec)return;let t=x;try{x=!0,e.exec(e.info,e.params)}finally{x=t}};this._processingStatus===S.Running?t():this._deferred.push(t)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:`@xstate.actor`,actorRef:this}),c&&(this.systemId=c,this.system._set(c,this)),this._initState(t?.snapshot??t?.state),c&&this._snapshot.status!==`active`&&this.system._unregister(this)}_initState(e){try{this._snapshot=e?this.logic.restoreSnapshot?this.logic.restoreSnapshot(e,this._actorScope):e:this.logic.getInitialSnapshot(this._actorScope,this.options?.input)}catch(e){this._snapshot={status:`error`,output:void 0,error:e}}}update(e,t){this._snapshot=e;let n;for(;n=this._deferred.shift();)try{n()}catch(t){this._deferred.length=0,this._snapshot={...e,status:`error`,error:t}}switch(this._snapshot.status){case`active`:for(let t of this.observers)try{t.next?.(e)}catch(e){h(e)}break;case`done`:for(let t of this.observers)try{t.next?.(e)}catch(e){h(e)}this._stopProcedure(),this._complete(),this._doneEvent=ne(this.id,this._snapshot.output),this._parent&&this.system._relay(this,this._parent,this._doneEvent);break;case`error`:this._error(this._snapshot.error);break}this.system._sendInspectionEvent({type:`@xstate.snapshot`,actorRef:this,event:t,snapshot:e})}subscribe(e,t,n){let r=y(e,t,n);if(this._processingStatus!==S.Stopped)this.observers.add(r);else switch(this._snapshot.status){case`done`:try{r.complete?.()}catch(e){h(e)}break;case`error`:{let e=this._snapshot.error;if(!r.error)h(e);else try{r.error(e)}catch(e){h(e)}break}}return{unsubscribe:()=>{this.observers.delete(r)}}}on(e,t){let n=this.eventListeners.get(e);n||(n=new Set,this.eventListeners.set(e,n));let r=t.bind(void 0);return n.add(r),{unsubscribe:()=>{n.delete(r)}}}select(e,t=Object.is){return{subscribe:n=>{let r=y(n),i=e(this.getSnapshot());return this.subscribe(n=>{let a=e(n);t(i,a)||(i=a,r.next?.(a))})},get:()=>e(this.getSnapshot())}}start(){if(this._processingStatus===S.Running)return this;this._syncSnapshot&&this.subscribe({next:e=>{e.status===`active`&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:e})},error:()=>{}}),this.system._register(this.sessionId,this),this.systemId&&this.system._set(this.systemId,this),this._processingStatus=S.Running;let e=ie(this.options.input);switch(this.system._sendInspectionEvent({type:`@xstate.event`,sourceRef:this._parent,actorRef:this,event:e}),this._snapshot.status){case`done`:return this.update(this._snapshot,e),this;case`error`:return this._error(this._snapshot.error),this}if(this._parent||this.system.start(),this.logic.start)try{this.logic.start(this._snapshot,this._actorScope)}catch(e){return this._snapshot={...this._snapshot,status:`error`,error:e},this._error(e),this}return this.update(this._snapshot,e),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(e){let t,n;try{t=this.logic.transition(this._snapshot,e,this._actorScope)}catch(e){n={err:e}}if(n){let{err:e}=n;this._snapshot={...this._snapshot,status:`error`,error:e},this._error(e);return}this.update(t,e),e.type===`xstate.stop`&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===S.Stopped?this:(this.mailbox.clear(),this._processingStatus===S.NotStarted?(this._processingStatus=S.Stopped,this):(this.mailbox.enqueue({type:ee}),this))}stop(){if(this._parent)throw Error(`A non-root actor cannot be stopped directly.`);return this._stop()}_complete(){for(let e of this.observers)try{e.complete?.()}catch(e){h(e)}this.observers.clear(),this.eventListeners.clear()}_reportError(e){if(!this.observers.size){this._parent||h(e),this.eventListeners.clear();return}let t=!1;for(let n of this.observers){let r=n.error;t||=!r;try{r?.(e)}catch(e){h(e)}}this.observers.clear(),this.eventListeners.clear(),t&&h(e)}_error(e){this._stopProcedure(),this._reportError(e),this._parent&&this.system._relay(this,this._parent,re(this.id,e))}_stopProcedure(){return this._processingStatus===S.Running?(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new l(this._process.bind(this)),this._processingStatus=S.Stopped,this.system._unregister(this),this):this}_send(e){this._processingStatus!==S.Stopped&&this.mailbox.enqueue(e)}send(e){this.system._relay(void 0,this,e)}attachDevTools(){let{devTools:e}=this.options;e&&(typeof e==`function`?e:c)(this)}toJSON(){return{xstate$$type:1,id:this.id}}getPersistedSnapshot(e){return this.logic.getPersistedSnapshot(this._snapshot,e)}[ae](){return this}getSnapshot(){return this._snapshot}};function C(e,...[t]){return new xe(e,t)}function Se(e,t,n,r,{sendId:i}){return[t,{sendId:typeof i==`function`?i(n,r):i},void 0]}function Ce(e,t){e.defer(()=>{e.system.scheduler.cancel(e.self,t.sendId)})}function w(e){function t(e,t){}return t.type=`xstate.cancel`,t.sendId=e,t.resolve=Se,t.execute=Ce,t}function we(e,t,n,r,{id:i,systemId:a,src:o,input:s,syncSnapshot:c}){let l=typeof o==`string`?b(t.machine,o):o,u=typeof i==`function`?i(n):i,d,f;return l&&(f=typeof s==`function`?s({context:t.context,event:n.event,self:e.self}):s,d=C(l,{id:u,src:o,parent:e.self,syncSnapshot:c,systemId:a,input:f})),[Y(t,{children:{...t.children,[u]:d}}),{id:i,systemId:a,actorRef:d,src:o,input:f},void 0]}function Te(e,{actorRef:t}){t&&e.defer(()=>{t._processingStatus!==S.Stopped&&t.start()})}function T(...[e,{id:t,systemId:n,input:r,syncSnapshot:i=!1}={}]){function a(e,t){}return a.type=`xstate.spawnChild`,a.id=t,a.systemId=n,a.src=e,a.input=r,a.syncSnapshot=i,a.resolve=we,a.execute=Te,a}function Ee(e,t,n,r,{actorRef:i}){let a=typeof i==`function`?i(n,r):i,o=typeof a==`string`?t.children[a]:a,s=t.children;return o&&(s={...s},delete s[o.id]),[Y(t,{children:s}),o,void 0]}function De(e,t){let n=t.getSnapshot();if(n&&`children`in n)for(let t of Object.values(n.children))De(e,t);e.system._unregister(t)}function Oe(e,t){if(t){if(De(e,t),t._processingStatus!==S.Running){e.stopChild(t);return}e.defer(()=>{e.stopChild(t)})}}function E(e){function t(e,t){}return t.type=`xstate.stopChild`,t.actorRef=e,t.resolve=Ee,t.execute=Oe,t}function D(e,t,n,r){let{machine:i}=r,a=typeof e==`function`,o=a?e:i.implementations.guards[typeof e==`string`?e:e.type];if(!a&&!o)throw Error(`Guard '${typeof e==`string`?e:e.type}' is not implemented.'.`);if(typeof o!=`function`)return D(o,t,n,r);let s={context:t,event:n},c=a||typeof e==`string`?void 0:`params`in e?typeof e.params==`function`?e.params({context:t,event:n}):e.params:void 0;return`check`in o?o.check(r,s,o):o(s,c)}function O(e){return e.type===`atomic`||e.type===`final`}function k(e){return Object.values(e.states).filter(e=>e.type!==`history`)}function A(e,t){let n=[];if(t===e)return n;let r=e.parent;for(;r&&r!==t;)n.push(r),r=r.parent;return n}function j(e){let t=new Set(e),n=Ae(t);for(let e of t)if(e.type===`compound`&&(!n.get(e)||!n.get(e).length))ze(e).forEach(e=>t.add(e));else if(e.type===`parallel`){for(let n of k(e))if(n.type!==`history`&&!t.has(n)){let e=ze(n);for(let n of e)t.add(n)}}for(let e of t){let n=e.parent;for(;n;)t.add(n),n=n.parent}return t}function ke(e,t){let n=t.get(e);if(!n)return{};if(e.type===`compound`){let e=n[0];if(e){if(O(e))return e.key}else return{}}let r={};for(let e of n)r[e.key]=ke(e,t);return r}function Ae(e){let t=new Map;for(let n of e)t.has(n)||t.set(n,[]),n.parent&&(t.has(n.parent)||t.set(n.parent,[]),t.get(n.parent).push(n));return t}function je(e,t){return ke(e,Ae(j(t)))}function M(e,t){return t.type===`compound`?k(t).some(t=>t.type===`final`&&e.has(t)):t.type===`parallel`?k(t).every(t=>M(e,t)):t.type===`final`}var N=e=>e[0]===d;function Me(e,t){return e.transitions.get(t)||[...e.transitions.keys()].filter(e=>ge(t,e)).sort((e,t)=>t.length-e.length).flatMap(t=>e.transitions.get(t))}function Ne(e){let t=e.config.after;if(!t)return[];let n=t=>{let n=te(t,e.id),r=n.type;return e.entry.push(X(n,{id:r,delay:t})),e.exit.push(w(r)),r};return Object.keys(t).flatMap(e=>{let r=t[e],i=typeof r==`string`?{target:r}:r,a=Number.isNaN(+e)?e:+e,o=n(a);return g(i).map(e=>({...e,event:o,delay:a}))}).map(t=>{let{delay:n}=t;return{...P(e,t.event,t),delay:n}})}function P(e,t,n){let r=me(n.target),i=n.reenter??!1,a=Le(e,r),o={...n,actions:g(n.actions),guard:n.guard,target:a,source:e,reenter:i,eventType:t,toJSON:()=>({...o,source:`#${e.id}`,target:a?a.map(e=>`#${e.id}`):void 0})};return o}function Pe(e){let t=new Map;if(e.config.on)for(let n of Object.keys(e.config.on)){if(n===``)throw Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');let r=e.config.on[n];t.set(n,v(r).map(t=>P(e,n,t)))}if(e.config.onDone){let n=`xstate.done.state.${e.id}`;t.set(n,v(e.config.onDone).map(t=>P(e,n,t)))}for(let n of e.invoke){if(n.onDone){let r=`xstate.done.actor.${n.id}`;t.set(r,v(n.onDone).map(t=>P(e,r,t)))}if(n.onError){let r=`xstate.error.actor.${n.id}`;t.set(r,v(n.onError).map(t=>P(e,r,t)))}if(n.onSnapshot){let r=`xstate.snapshot.${n.id}`;t.set(r,v(n.onSnapshot).map(t=>P(e,r,t)))}}for(let n of e.after){let e=t.get(n.eventType);e||(e=[],t.set(n.eventType,e)),e.push(n)}return t}function Fe(e){let t=[],n=r=>{Object.values(r).forEach(r=>{if(r.config.route&&r.config.id){let n=r.config.id,i=r.config.route.guard,a=(e,t)=>e.event.to===`#${n}`?i&&typeof i==`function`?i(e,t):!0:!1,o={...r.config.route,guard:a,target:`#${n}`};t.push(P(e,`xstate.route`,o))}r.states&&n(r.states)})};n(e.states),t.length>0&&e.transitions.set(`xstate.route`,t)}function Ie(e,t){let n=typeof t==`string`?e.states[t]:t?e.states[t.target]:void 0;if(!n&&t)throw Error(`Initial state node "${t}" not found on parent state node #${e.id}`);let r={source:e,actions:!t||typeof t==`string`?[]:g(t.actions),eventType:null,reenter:!1,target:n?[n]:[],toJSON:()=>({...r,source:`#${e.id}`,target:n?[`#${n.id}`]:[]})};return r}function Le(e,t){if(t!==void 0)return t.map(t=>{if(typeof t!=`string`)return t;if(N(t))return e.machine.getStateNodeById(t);let n=t[0]===`.`;if(n&&!e.parent)return L(e,t.slice(1));let r=n?e.key+t:t;if(e.parent)try{return L(e.parent,r)}catch(t){throw Error(`Invalid transition definition for state node '${e.id}':\n${t.message}`)}else throw Error(`Invalid target: "${t}" is not a valid target from the root node. Did you mean ".${t}"?`)})}function Re(e){let t=me(e.config.target);return t?{target:t.map(t=>typeof t==`string`?L(e.parent,t):t)}:e.parent.initial}function F(e){return e.type===`history`}function ze(e){let t=Be(e);for(let n of t)for(let r of A(n,e))t.add(r);return t}function Be(e){let t=new Set;function n(e){if(!t.has(e)){if(t.add(e),e.type===`compound`)n(e.initial.target[0]);else if(e.type===`parallel`)for(let t of k(e))n(t)}}return n(e),t}function I(e,t){if(N(t))return e.machine.getStateNodeById(t);if(!e.states)throw Error(`Unable to retrieve child state '${t}' from '${e.id}'; no child states exist.`);let n=e.states[t];if(!n)throw Error(`Child state '${t}' does not exist on '${e.id}'`);return n}function L(e,t){if(typeof t==`string`&&N(t))try{return e.machine.getStateNodeById(t)}catch{}let n=se(t).slice(),r=e;for(;n.length;){let e=n.shift();if(!e.length)break;r=I(r,e)}return r}function R(e,t){if(typeof t==`string`){let n=e.states[t];if(!n)throw Error(`State '${t}' does not exist on '${e.id}'`);return[e,n]}let n=Object.keys(t),r=n.map(t=>I(e,t)).filter(Boolean);return[e.machine.root,e].concat(r,n.reduce((n,r)=>{let i=I(e,r);if(!i)return n;let a=R(i,t[r]);return n.concat(a)},[]))}function Ve(e,t,n,r){let i=I(e,t).next(n,r);return!i||!i.length?e.next(n,r):i}function He(e,t,n,r){let i=Object.keys(t),a=z(I(e,i[0]),t[i[0]],n,r);return!a||!a.length?e.next(n,r):a}function Ue(e,t,n,r){let i=[];for(let a of Object.keys(t)){let o=t[a];if(!o)continue;let s=z(I(e,a),o,n,r);s&&i.push(...s)}return i.length?i:e.next(n,r)}function z(e,t,n,r){return typeof t==`string`?Ve(e,t,n,r):Object.keys(t).length===1?He(e,t,n,r):Ue(e,t,n,r)}function We(e){return Object.keys(e.states).map(t=>e.states[t]).filter(e=>e.type===`history`)}function B(e,t){let n=e;for(;n.parent&&n.parent!==t;)n=n.parent;return n.parent===t}function Ge(e,t){let n=new Set(e),r=new Set(t);for(let e of n)if(r.has(e))return!0;for(let e of r)if(n.has(e))return!0;return!1}function Ke(e,t,n){let r=new Set;for(let i of e){let e=!1,a=new Set;for(let o of r)if(Ge(H([i],t,n),H([o],t,n)))if(B(i.source,o.source))a.add(o);else{e=!0;break}if(!e){for(let e of a)r.delete(e);r.add(i)}}return Array.from(r)}function qe(e){let[t,...n]=e;for(let e of A(t,void 0))if(n.every(t=>B(t,e)))return e}function V(e,t){if(!e.target)return[];let n=new Set;for(let r of e.target)if(F(r))if(t[r.id])for(let e of t[r.id])n.add(e);else for(let e of V(Re(r),t))n.add(e);else n.add(r);return[...n]}function Je(e,t){let n=V(e,t);if(!n)return;if(!e.reenter&&n.every(t=>t===e.source||B(t,e.source)))return e.source;let r=qe(n.concat(e.source));if(r)return r;if(!e.reenter)return e.source.machine.root}function H(e,t,n){let r=new Set;for(let i of e)if(i.target?.length){let e=Je(i,n);i.reenter&&i.source===e&&r.add(e);for(let n of t)B(n,e)&&r.add(n)}return[...r]}function Ye(e,t){if(e.length!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Xe(e,t,n,r,i){return U([{target:[...Be(e)],source:e,reenter:!0,actions:[],eventType:null,toJSON:null}],t,n,r,!0,i)}function U(e,t,n,r,i,a){let o=[];if(!e.length)return[t,o];let s=n.actionExecutor;n.actionExecutor=e=>{o.push(e),s(e)};try{let s=new Set(t._nodes),c=t.historyValue,l=Ke(e,s,c),u=t;i||([u,c]=tt(u,r,n,l,s,c,a,n.actionExecutor)),u=K(u,r,n,l.flatMap(e=>e.actions),a,void 0),u=Qe(u,r,n,l,s,a,c,i);let d=[...s];u.status===`done`&&(u=K(u,r,n,d.sort((e,t)=>t.order-e.order).flatMap(e=>e.exit),a,void 0));try{return c===t.historyValue&&Ye(t._nodes,s)?[u,o]:[Y(u,{_nodes:d,historyValue:c}),o]}catch(e){throw e}}finally{n.actionExecutor=s}}function Ze(e,t,n,r,i){if(r.output===void 0)return;let a=m(i.id,i.output!==void 0&&i.parent?_(i.output,e.context,t,n.self):void 0);return _(r.output,e.context,a,n.self)}function Qe(e,t,n,r,i,a,o,s){let c=e,l=new Set,u=new Set;$e(r,o,u,l),s&&u.add(e.machine.root);let d=new Set;for(let e of[...l].sort((e,t)=>e.order-t.order)){i.add(e);let r=[];r.push(...e.entry);for(let t of e.invoke)r.push(T(t.src,{...t,syncSnapshot:!!t.onSnapshot}));if(u.has(e)){let t=e.initial.actions;r.push(...t)}if(c=K(c,t,n,r,a,e.invoke.map(e=>e.id)),e.type===`final`){let r=e.parent,o=r?.type===`parallel`?r:r?.parent,s=o||e;for(r?.type===`compound`&&a.push(m(r.id,e.output===void 0?void 0:_(e.output,c.context,t,n.self)));o?.type===`parallel`&&!d.has(o)&&M(i,o);)d.add(o),a.push(m(o.id)),s=o,o=o.parent;if(o)continue;c=Y(c,{status:`done`,output:Ze(c,t,n,c.machine.root,s)})}}return c}function $e(e,t,n,r){for(let i of e){let e=Je(i,t);for(let a of i.target||[])!F(a)&&(i.source!==a||i.source!==e||i.reenter)&&(r.add(a),n.add(a)),W(a,t,n,r);let a=V(i,t);for(let o of a){let a=A(o,e);e?.type===`parallel`&&a.push(e),et(r,t,n,a,!i.source.parent&&i.reenter?void 0:e)}}}function W(e,t,n,r){if(F(e))if(t[e.id]){let i=t[e.id];for(let e of i)r.add(e),W(e,t,n,r);for(let a of i)G(a,e.parent,r,t,n)}else{let i=Re(e);for(let a of i.target)r.add(a),i===e.parent?.initial&&n.add(e.parent),W(a,t,n,r);for(let a of i.target)G(a,e.parent,r,t,n)}else if(e.type===`compound`){let[i]=e.initial.target;F(i)||(r.add(i),n.add(i)),W(i,t,n,r),G(i,e,r,t,n)}else if(e.type===`parallel`)for(let i of k(e).filter(e=>!F(e)))[...r].some(e=>B(e,i))||(F(i)||(r.add(i),n.add(i)),W(i,t,n,r))}function et(e,t,n,r,i){for(let a of r)if((!i||B(a,i))&&e.add(a),a.type===`parallel`)for(let r of k(a).filter(e=>!F(e)))[...e].some(e=>B(e,r))||(e.add(r),W(r,t,n,e))}function G(e,t,n,r,i){et(n,r,i,A(e,t))}function tt(e,t,n,r,i,a,o,s){let c=e,l=H(r,i,a);l.sort((e,t)=>t.order-e.order);let u;for(let e of l)for(let t of We(e)){let n;n=t.history===`deep`?t=>O(t)&&B(t,e):t=>t.parent===e,u??={...a},u[t.id]=Array.from(i).filter(n)}for(let e of l)c=K(c,t,n,[...e.exit,...e.invoke.map(e=>E(e.id))],o,void 0),i.delete(e);return[c,u||a]}function nt(e,t){return e.implementations.actions[t]}function rt(e,t,n,r,i,a){let{machine:o}=e,s=e;for(let e of r){let r=typeof e==`function`,c=r?e:nt(o,typeof e==`string`?e:e.type),l={context:s.context,event:t,self:n.self,system:n.system},u=r||typeof e==`string`?void 0:`params`in e?typeof e.params==`function`?e.params({context:s.context,event:t}):e.params:void 0;if(!c||!(`resolve`in c)){n.actionExecutor({type:typeof e==`string`?e:typeof e==`object`?e.type:e.name||`(anonymous)`,info:l,params:u,exec:c});continue}let d=c,[f,p,ee]=d.resolve(n,s,l,u,c,i);s=f,`retryResolve`in d&&a?.push([d,p]),`execute`in d&&n.actionExecutor({type:d.type,info:l,params:p,exec:d.execute.bind(null,n,p)}),ee&&(s=rt(s,t,n,ee,i,a))}return s}function K(e,t,n,r,i,a){let o=a?[]:void 0,s=rt(e,t,n,r,{internalQueue:i,deferredActorIds:a},o);return o?.forEach(([e,t])=>{e.retryResolve(n,s,t)}),s}function q(e,t,n,r){let i=e,a=[];function o(e,t,r){n.system._sendInspectionEvent({type:`@xstate.microstep`,actorRef:n.self,event:t,snapshot:e[0],_transitions:r}),a.push(e)}if(t.type===`xstate.stop`)return i=Y(it(i,t,n),{status:`stopped`}),o([i,[]],t,[]),{snapshot:i,microsteps:a};let s=t;if(s.type!==p){let t=s,c=pe(t),l=at(t,i);if(c&&!l.length)return i=Y(e,{status:`error`,error:t.error}),o([i,[]],t,[]),{snapshot:i,microsteps:a};let u=U(l,e,n,s,!1,r);i=u[0],o(u,t,l)}let c=!0;for(;i.status===`active`;){let e=c?ot(i,s):[],t=e.length?i:void 0;if(!e.length){if(!r.length)break;s=r.shift(),e=at(s,i)}let a=U(e,i,n,s,!1,r);i=a[0],c=i!==t,o(a,s,e)}return i.status!==`active`&&it(i,s,n),{snapshot:i,microsteps:a}}function it(e,t,n){return K(e,t,n,Object.values(e.children).map(e=>E(e)),[],void 0)}function at(e,t){return t.machine.getTransitionData(t,e)}function ot(e,t){let n=new Set,r=e._nodes.filter(O);for(let i of r)loop:for(let r of[i].concat(A(i,void 0)))if(r.always){for(let i of r.always)if(i.guard===void 0||D(i.guard,e.context,t,e)){n.add(i);break loop}}return Ke(Array.from(n),new Set(e._nodes),e.historyValue)}function st(e,t){return je(e,[...j(R(e,t))])}function ct(e){return!!e&&typeof e==`object`&&`machine`in e&&`value`in e}var lt=function(e){return oe(e,this.value)},ut=function(e){return this.tags.has(e)},dt=function(e){let t=this.machine.getTransitionData(this,e);return!!t?.length&&t.some(e=>e.target!==void 0||e.actions.length)},ft=function(){let{_nodes:e,tags:t,machine:n,getMeta:r,toJSON:i,can:a,hasTag:o,matches:s,...c}=this;return{...c,tags:Array.from(t)}},pt=function(){return this._nodes.reduce((e,t)=>(t.meta!==void 0&&(e[t.id]=t.meta),e),{})};function J(e,t){return{status:e.status,output:e.output,error:e.error,machine:t,context:e.context,_nodes:e._nodes,value:je(t.root,e._nodes),tags:new Set(e._nodes.flatMap(e=>e.tags)),children:e.children,historyValue:e.historyValue||{},matches:lt,hasTag:ut,can:dt,getMeta:pt,toJSON:ft}}function Y(e,t={}){return J({...e,...t},e.machine)}function mt(e){if(typeof e!=`object`||!e)return{};let t={};for(let n in e){let r=e[n];Array.isArray(r)&&(t[n]=r.map(e=>({id:e.id})))}return t}function ht(e,t){let{_nodes:n,tags:r,machine:i,children:a,context:o,can:s,hasTag:c,matches:l,getMeta:u,toJSON:d,...f}=e,p={};for(let e in a){let n=a[e];p[e]={snapshot:n.getPersistedSnapshot(t),src:n.src,systemId:n.systemId,syncSnapshot:n._syncSnapshot}}return{...f,context:gt(o),children:p,historyValue:mt(f.historyValue)}}function gt(e){let t;for(let n in e){let r=e[n];if(r&&typeof r==`object`)if(`sessionId`in r&&`send`in r&&`ref`in r)t??=Array.isArray(e)?e.slice():{...e},t[n]={xstate$$type:1,id:r.id};else{let i=gt(r);i!==r&&(t??=Array.isArray(e)?e.slice():{...e},t[n]=i)}}return t??e}function _t(e,t,n,r,{event:i,id:a,delay:o},{internalQueue:s}){let c=t.machine.implementations.delays;if(typeof i==`string`)throw Error(`Only event objects may be used with raise; use raise({ type: "${i}" }) instead`);let l=typeof i==`function`?i(n,r):i,u;if(typeof o==`string`){let e=c&&c[o];u=typeof e==`function`?e(n,r):e}else u=typeof o==`function`?o(n,r):o;return typeof u!=`number`&&s.push(l),[t,{event:l,id:a,delay:u},void 0]}function vt(e,t){let{event:n,delay:r,id:i}=t;if(typeof r==`number`){e.defer(()=>{let t=e.self;e.system.scheduler.schedule(t,t,n,r,i)});return}}function X(e,t){function n(e,t){}return n.type=`xstate.raise`,n.event=e,n.id=t?.id,n.delay=t?.delay,n.resolve=_t,n.execute=vt,n}function yt(e,{machine:t,context:n},r,i){let a=(a,o)=>{if(typeof a==`string`){let s=b(t,a);if(!s)throw Error(`Actor logic '${a}' not implemented in machine '${t.id}'`);let c=C(s,{id:o?.id,parent:e.self,syncSnapshot:o?.syncSnapshot,input:typeof o?.input==`function`?o.input({context:n,event:r,self:e.self}):o?.input,src:a,systemId:o?.systemId});return i[c.id]=c,c}else return C(a,{id:o?.id,parent:e.self,syncSnapshot:o?.syncSnapshot,input:o?.input,src:a,systemId:o?.systemId})};return(t,n)=>{let r=a(t,n);return i[r.id]=r,e.defer(()=>{r._processingStatus!==S.Stopped&&r.start()}),r}}function bt(e,t,n,r,{assignment:i}){if(!t.context)throw Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");let a={},o={context:t.context,event:n.event,spawn:yt(e,t,n.event,a),self:e.self,system:e.system},s={};if(typeof i==`function`)s=i(o,r);else for(let e of Object.keys(i)){let t=i[e];s[e]=typeof t==`function`?t(o,r):t}return[Y(t,{context:Object.assign({},t.context,s),children:Object.keys(a).length?{...t.children,...a}:t.children}),void 0,void 0]}function Z(e){function t(e,t){}return t.type=`xstate.assign`,t.assignment=e,t.resolve=bt,t}var xt=new WeakMap;function Q(e,t,n){let r=xt.get(e);return r?t in r||(r[t]=n()):(r={[t]:n()},xt.set(e,r)),r[t]}var St={},$=e=>typeof e==`string`?{type:e}:typeof e==`function`?`resolve`in e?{type:e.type}:{type:e.name}:e,Ct=class e{constructor(t,n){if(this.config=t,this.key=void 0,this.id=void 0,this.type=void 0,this.path=void 0,this.states=void 0,this.history=void 0,this.entry=void 0,this.exit=void 0,this.parent=void 0,this.machine=void 0,this.meta=void 0,this.output=void 0,this.order=-1,this.description=void 0,this.tags=[],this.transitions=void 0,this.always=void 0,this.parent=n._parent,this.key=n._key,this.machine=n._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join(`.`),this.type=this.config.type||(this.config.states&&Object.keys(this.config.states).length?`compound`:this.config.history?`history`:`atomic`),this.description=this.config.description,this.order=this.machine.idMap.size,this.machine.idMap.set(this.id,this),this.states=this.config.states?ue(this.config.states,(t,n)=>new e(t,{_parent:this,_key:n,_machine:this.machine})):St,this.type===`compound`&&!this.config.initial)throw Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);this.history=this.config.history===!0?`shallow`:this.config.history||!1,this.entry=g(this.config.entry).slice(),this.exit=g(this.config.exit).slice(),this.meta=this.config.meta,this.output=this.type===`final`||!this.parent?this.config.output:void 0,this.tags=g(t.tags).slice()}_initialize(){this.transitions=Pe(this),this.config.always&&(this.always=v(this.config.always).map(e=>P(this,``,e))),Object.keys(this.states).forEach(e=>{this.states[e]._initialize()})}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.type,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map($),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(e=>`#${e.id}`),source:`#${this.id}`,actions:this.initial.actions.map($),eventType:null})}:void 0,history:this.history,states:ue(this.states,e=>e.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(e=>({...e,actions:e.actions.map($)})),entry:this.entry.map($),exit:this.exit.map($),meta:this.meta,order:this.order||-1,output:this.output,invoke:this.invoke,description:this.description,tags:this.tags}}toJSON(){return this.definition}get invoke(){return Q(this,`invoke`,()=>g(this.config.invoke).map((e,t)=>{let{src:n,systemId:r}=e,i=e.id??he(this.id,t),a=typeof n==`string`?n:`xstate.invoke.${he(this.id,t)}`;return{...e,src:a,id:i,systemId:r,toJSON(){let{onDone:t,onError:n,...r}=e;return{...r,type:`xstate.invoke`,src:a,id:i}}}}))}get on(){return Q(this,`on`,()=>[...this.transitions].flatMap(([e,t])=>t.map(t=>[e,t])).reduce((e,[t,n])=>(e[t]=e[t]||[],e[t].push(n),e),{}))}get after(){return Q(this,`delayedTransitions`,()=>Ne(this))}get initial(){return Q(this,`initial`,()=>Ie(this,this.config.initial))}next(e,t){let n=t.type,r=[],i,a=Q(this,`candidates-${n}`,()=>Me(this,n));for(let o of a){let{guard:a}=o,s=e.context,c=!1;try{c=!a||D(a,s,t,e)}catch(e){let t=typeof a==`string`?a:typeof a==`object`?a.type:void 0;throw Error(`Unable to evaluate guard ${t?`'${t}' `:``}in transition for event '${n}' in state node '${this.id}':\n${e.message}`)}if(c){r.push(...o.actions),i=o;break}}return i?[i]:void 0}get events(){return Q(this,`events`,()=>{let{states:e}=this,t=new Set(this.ownEvents);if(e)for(let n of Object.keys(e)){let r=e[n];if(r.states)for(let e of r.events)t.add(`${e}`)}return Array.from(t)})}get ownEvents(){let e=Object.keys(Object.fromEntries(this.transitions)),t=new Set(e.filter(e=>this.transitions.get(e).some(e=>!(!e.target&&!e.actions.length&&!e.reenter))));return Array.from(t)}},wt=class e{constructor(e,t){this.config=e,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.__xstatenode=!0,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=e.id||`(machine)`,this.implementations={actors:t?.actors??{},actions:t?.actions??{},delays:t?.delays??{},guards:t?.guards??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new Ct(e,{_key:this.id,_machine:this}),this.root._initialize(),Fe(this.root),this.states=this.root.states,this.events=this.root.events}provide(t){let{actions:n,guards:r,actors:i,delays:a}=this.implementations;return new e(this.config,{actions:{...n,...t.actions},guards:{...r,...t.guards},actors:{...i,...t.actors},delays:{...a,...t.delays}})}resolveState(e){let t=st(this.root,e.value),n=j(R(this.root,t));return J({_nodes:[...n],context:e.context||{},children:{},status:M(n,this.root)?`done`:e.status||`active`,output:e.output,error:e.error,historyValue:e.historyValue},this)}transition(e,t,n){return q(e,t,n,[]).snapshot}microstep(e,t,n){return q(e,t,n,[]).microsteps.map(([e])=>e)}getTransitionData(e,t){return z(this.root,e.value,e,t)||[]}_getPreInitialState(e,t,n){let{context:r}=this.config,i=J({context:typeof r!=`function`&&r?r:{},_nodes:[this.root],children:{},status:`active`},this);return typeof r==`function`?K(i,t,e,[Z(({spawn:e,event:t,self:n})=>r({spawn:e,input:t.input,self:n}))],n,void 0):i}getInitialSnapshot(e,t){let n=ie(t),r=[],i=this._getPreInitialState(e,n,r),[a]=Xe(this.root,i,e,n,r),{snapshot:o}=q(a,n,e,r);return o}start(e){Object.values(e.children).forEach(e=>{e.getSnapshot().status===`active`&&e.start()})}getStateNodeById(e){let t=se(e),n=t.slice(1),r=N(t[0])?t[0].slice(1):t[0],i=this.idMap.get(r);if(!i)throw Error(`Child state node '#${r}' does not exist on machine '${this.id}'`);return L(i,n)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(e,t){return ht(e,t)}restoreSnapshot(e,t){let n={},r=e.children;Object.keys(r).forEach(e=>{let i=r[e],a=i.snapshot,o=i.src,s=typeof o==`string`?b(this,o):o;s&&(n[e]=C(s,{id:e,parent:t.self,syncSnapshot:i.syncSnapshot,snapshot:a,src:o,systemId:i.systemId}))});function i(e,t){if(t instanceof Ct)return t;try{return e.machine.getStateNodeById(t.id)}catch{}}function a(e,t){if(!t||typeof t!=`object`)return{};let n={};for(let r in t){let a=t[r];for(let t of a){let a=i(e,t);a&&(n[r]??=[],n[r].push(a))}}return n}let o=a(this.root,e.historyValue),s=J({...e,children:n,_nodes:Array.from(j(R(this.root,e.value))),historyValue:o},this),c=new Set;function l(e,t){if(!c.has(e)){c.add(e);for(let n in e){let r=e[n];if(r&&typeof r==`object`){if(`xstate$$type`in r&&r.xstate$$type===1){e[n]=t[r.id];continue}l(r,t)}}}}return l(s.context,n),s}};function Tt(e,t,n,r,{event:i}){return[t,{event:typeof i==`function`?i(n,r):i},void 0]}function Et(e,{event:t}){e.defer(()=>e.emit(t))}function Dt(e){function t(e,t){}return t.type=`xstate.emit`,t.event=e,t.resolve=Tt,t.execute=Et,t}var Ot=function(e){return e.Parent=`#_parent`,e.Internal=`#_internal`,e}({});function kt(e,t,n,r,{to:i,event:a,id:o,delay:s},c){let l=t.machine.implementations.delays;if(typeof a==`string`)throw Error(`Only event objects may be used with sendTo; use sendTo({ type: "${a}" }) instead`);let u=typeof a==`function`?a(n,r):a,d;if(typeof s==`string`){let e=l&&l[s];d=typeof e==`function`?e(n,r):e}else d=typeof s==`function`?s(n,r):s;let f=typeof i==`function`?i(n,r):i,p;if(typeof f==`string`){if(p=f===Ot.Parent?e.self._parent:f===Ot.Internal?e.self:f.startsWith(`#_`)?t.children[f.slice(2)]:c.deferredActorIds?.includes(f)?f:t.children[f],!p)throw Error(`Unable to send event to actor '${f}' from machine '${t.machine.id}'.`)}else p=f||e.self;return[t,{to:p,targetId:typeof f==`string`?f:void 0,event:u,id:o,delay:d},void 0]}function At(e,t,n){typeof n.to==`string`&&(n.to=t.children[n.to])}function jt(e,t){e.defer(()=>{let{to:n,event:r,delay:i,id:a}=t;if(typeof i==`number`){e.system.scheduler.schedule(e.self,n,r,i,a);return}e.system._relay(e.self,n,r.type===`xstate.error`?re(e.self.id,r.data):r)})}function Mt(e,t,n){function r(e,t){}return r.type=`xstate.sendTo`,r.to=e,r.event=t,r.id=n?.id,r.delay=n?.delay,r.resolve=kt,r.retryResolve=At,r.execute=jt,r}function Nt(e,t){return Mt(Ot.Parent,e,t)}function Pt(e,t,n,r,{collect:i}){let a=[],o=function(e){a.push(e)};return o.assign=(...e)=>{a.push(Z(...e))},o.cancel=(...e)=>{a.push(w(...e))},o.raise=(...e)=>{a.push(X(...e))},o.sendTo=(...e)=>{a.push(Mt(...e))},o.sendParent=(...e)=>{a.push(Nt(...e))},o.spawnChild=(...e)=>{a.push(T(...e))},o.stopChild=(...e)=>{a.push(E(...e))},o.emit=(...e)=>{a.push(Dt(...e))},i({context:n.context,event:n.event,enqueue:o,check:e=>D(e,t.context,n.event,t),self:e.self,system:e.system},r),[t,void 0,a]}function Ft(e){function t(e,t){}return t.type=`xstate.enqueueActions`,t.collect=e,t.resolve=Pt,t}function It(e,t,n,r,{value:i,label:a}){return[t,{value:typeof i==`function`?i(n,r):i,label:a},void 0]}function Lt({logger:e},{value:t,label:n}){n?e(n,t):e(t)}function Rt(e=({context:e,event:t})=>({context:e,event:t}),t){function n(e,t){}return n.type=`xstate.log`,n.value=e,n.label=t,n.resolve=It,n.execute=Lt,n}function zt(e,t){let n=g(t);if(!n.some(t=>ge(e.type,t))){let t=n.length===1?`type matching "${n[0]}"`:`one of types matching "${n.join(`", "`)}"`;throw Error(`Expected event ${JSON.stringify(e)} to have ${t}`)}}function Bt(e,t){return new wt(e,t)}function Vt({schemas:e,actors:t,actions:n,guards:r,delays:i}){return{assign:Z,sendTo:Mt,raise:X,log:Rt,cancel:w,stopChild:E,enqueueActions:Ft,emit:Dt,spawnChild:T,createStateConfig:e=>e,createAction:e=>e,createMachine:a=>Bt({...a,schemas:e},{actors:t,actions:n,guards:r,delays:i}),extend:a=>Vt({schemas:e,actors:t,actions:{...n,...a.actions},guards:{...r,...a.guards},delays:{...i,...a.delays}})}}var Ht=r(),Ut=n(),Wt=(e,t)=>{t(e);let n=e.getSnapshot().children;n&&Object.values(n).forEach(e=>{Wt(e,t)})};function Gt(e){let t=[];Wt(e,e=>{t.push([e,e.getSnapshot()]),e.observers=new Set});let n=e.system.getSnapshot?.();e.stop(),e.system._snapshot=n,t.forEach(([e,t])=>{e._processingStatus=0,e._snapshot=t})}function Kt(e,...[t]){let[[n,r],o]=(0,i.useState)(()=>{let n=C(e,t);return[e.config,n]});if(e.config!==n){let n=C(e,{...t,snapshot:r.getPersistedSnapshot({__unsafeAllowInlineActors:!0})});o([e.config,n]),r=n}return a(()=>{r.logic.implementations=e.implementations}),r}function qt(e,...[t,n]){let r=Kt(e,t);return(0,i.useEffect)(()=>{if(!n)return;let e=r.subscribe(y(n));return()=>{e.unsubscribe()}},[n]),(0,i.useEffect)(()=>(r.start(),()=>{Gt(r)}),[r]),r}function Jt(e,t){return e===t}function Yt(e,t,n=Jt){let r=(0,i.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe({next:t,error:t});return n},[e]),a=(0,i.useCallback)(()=>{let t=e?.getSnapshot();if(t&&`status`in t&&t.status===`error`)throw t.error;return t},[e]);return(0,Ht.useSyncExternalStoreWithSelector)(r,a,a,t,n)}function Xt(e,...[t]){let n=Kt(e,t),r=(0,i.useCallback)(()=>n.getSnapshot(),[n]),a=(0,Ut.useSyncExternalStore)((0,i.useCallback)(e=>{let{unsubscribe:t}=n.subscribe({next:e,error:e});return t},[n]),r,r),o=`status`in a?a:void 0;if(o?.status===`error`)throw o.error;return(0,i.useEffect)(()=>(n.start(),()=>{Gt(n)}),[n]),[a,n.send,n]}function Zt(e,...[t]){return Xt(e,t)}export{Vt as a,zt as i,Zt as n,Z as o,Yt as r,qt as t};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/vendor/{x86_64-pc-windows-msvc → aarch64-apple-darwin}/runtime/dashboard/favicon.ico
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|