@onequery/cli 0.1.49-alpha.1 → 0.1.49-darwin-x64
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 +15 -22
- package/vendor/x86_64-apple-darwin/onequery/onequery +0 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/20260327065242_curious_nightmare.sql +403 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/20260403103652_slippery_hellfire_club.sql +8 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/20260403112219_gigantic_namora.sql +1 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/20260420071232_previous_justin_hammer.sql +141 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/20260420093157_spooky_cassandra_nova.sql +29 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/20260420101631_even_ogun.sql +5 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/20260425110519_smart_amazoness.sql +8 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/20260428033542_rename_source_query_interface_missing.sql +36 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/meta/20260327065242_snapshot.json +2817 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/meta/20260403103652_snapshot.json +2864 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/meta/20260403112219_snapshot.json +2870 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/meta/20260420071232_snapshot.json +3879 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/meta/20260420093157_snapshot.json +4088 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/meta/20260420101631_snapshot.json +3250 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/meta/20260425110519_snapshot.json +3250 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/meta/20260428033542_snapshot.json +3250 -0
- package/vendor/x86_64-apple-darwin/runtime/migrations/meta/_journal.json +62 -0
- package/vendor/x86_64-apple-darwin/runtime/pglite/initdb.wasm +0 -0
- package/vendor/x86_64-apple-darwin/runtime/pglite/pglite.data +0 -0
- package/vendor/x86_64-apple-darwin/runtime/pglite/pglite.wasm +0 -0
- package/vendor/x86_64-apple-darwin/runtime/sql-parser/sql_parser_wasm_bg.wasm +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/CompositeItem-CZdKsA45.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/CompositeList-C9xWKWEY.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/DialogTitle-DSjY6Xud.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/IconArrowRight-DsOD7mDl.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/IconCheck-Gc24xPT2.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/IconChevronDown-B-39MA7-.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/IconChevronRight-DD16tNHZ.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/IconCoins-C7Nn0L6R.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/IconDatabase-BLZDgpcN.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/IconHistory-k3NVXypq.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/IconLoader2-CZSIppar.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/IconPlus-Ie-KpLOF.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/IconX-Cg43mUxH.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/Separator-Di8cGnYl.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/_authenticated-CGmAYz8Z.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/_org_slug-f6xppY7b.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/alert-TnJXtO0T.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/api-base-url-DIb6qukm.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/api-client-F8Y7IuHn.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/api-paths-DcYkf-C_.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/app-routes-DM5pppqD.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/audit-LQg_2-5v.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/auth-bootstrap-query-KhD_VRw3.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/auth-client-Dj6z7Pcl.js +3 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/avatar-DoLsibq3.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/badge-D8XKsDus.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/budget-jeO_g_0N.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/callback-wu4tr9JD.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/card-CZCl7QNy.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/checkbox-BLYovhFU.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/compiler-runtime-DCc3R3Xn.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/connect-database-3pvIA31m.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/create-org-DiO7zB9V.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/createReactComponent-_L2mp4Ui.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/data-source-connection-form-C0JyH5J3.js +173 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/device-DJhBvm-V.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/dist-Cg-lnuP8.js +3 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/dropdown-menu-CLot8VIw.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/empty-DjRo5ytz.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/format-date-B5v-Ga9z.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/getDisabledMountTransitionStyles-f3pOCbyk.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/getPseudoElementBounds-BpCtHFAC.js +12 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/home-CZKXq9HA.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/index-C_q-gtGv.js +10 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/index-ClbN-fUj.css +2 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/input-DSkIbIFK.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/integrations-B2b7o-ye.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/invite._invitationId-Dt2OlNDo.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/jsx-runtime-DG_AJzB_.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/label-CUY3W2yp.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/link-Cgvqhh5w.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/matchContext-CDajBC0L.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/organization-permissions-PidGz2SY.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/organization-query-keys-Dl2dsKXD.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/query-timing-C8VVOl1e.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/queryOptions-LX_zDC40.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/removable-DwbP0VJV.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/routes-BTttPHZm.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/schemas-K0ZhTj23.js +39 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/select-BSubTgC3.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/separator-CWjuJH0f.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/settings-B3gO4YZk.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/signin-DNF0ckUg.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/src-Cs2YIecp.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/table-mA0t_uVk.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/team-BL56C5sF.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/textarea-B57VG43g.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/theme-toggle-CcB6O_vF.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/use-optimistic-mutation-BCZ8tApt.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/useBaseQuery-B3PCmH7w.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/useBaseUiId-Cn1kR417.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/useCompositeItem-DqawtL5i.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/useControlled-C1S7R-1A.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/useQuery-Bj5cJCZc.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/useRender-DFMo54_d.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/useRouterState-DpT8luFk.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/useSuspenseQuery-ZQGYM-g4.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/useValueChanged-CH03vPJ5.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/utils-C8DGLIgm.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/xstate-react.esm-CfqAjJyu.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/assets/zod-BgAmwIO1.js +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/favicon.ico +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/amplitude/step1_settings_sidebar.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/amplitude/step2_projects.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/amplitude/step3_project_keys.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/amplitude/step4_api_keys.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/bigquery/step1_service_accounts.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/bigquery/step2_bigquery_roles.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/bigquery/step3_add_key_menu.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/bigquery/step4_create_json_key.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/ga4/step1_service_accounts.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/ga4/step2_create_json_key.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/ga4/step3_add_user_viewer.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/ga4/step4_property_details.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/github-token-guide/step1_signin.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/github-token-guide/step2_new_fine_grained_token_sanitized.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/github-token-guide/step3_permissions_configured_sanitized.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/github-token-guide/step4_token_created_sanitized.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/mixpanel/step1_service_accounts.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/mixpanel/step2_create_service_account.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/mixpanel/step3_credentials.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/mixpanel/step4_project_settings.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/postgresql/step1_create_user.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/postgresql/step2_connection.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/posthog/step1_project_settings.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/posthog/step2_personal_api_keys.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/posthog/step3_create_key_modal.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/rds/step1_connect.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/rds/step2_create_user.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/rds/step3_grant.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/rds/step4_info.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/sentry/step1_personal_tokens.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/sentry/step2_create_token_permissions.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/sentry/step3_organization_slug.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/images/sentry/step4_project_slug.png +0 -0
- package/vendor/x86_64-apple-darwin/runtime/web/index.html +47 -0
- package/vendor/x86_64-apple-darwin/runtime/web/linear.svg +1 -0
- package/vendor/x86_64-apple-darwin/runtime/web/onequery.svg +44 -0
- package/vendor/x86_64-apple-darwin/server/onequery-server.mjs +271235 -0
- package/bin/onequery.js +0 -266
- package/bin/package-constants.d.ts +0 -75
- package/bin/package-constants.js +0 -160
- package/runtime-bundle.json +0 -57
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "7",
|
|
3
|
+
"dialect": "postgresql",
|
|
4
|
+
"entries": [
|
|
5
|
+
{
|
|
6
|
+
"idx": 0,
|
|
7
|
+
"version": "7",
|
|
8
|
+
"when": 1774594362307,
|
|
9
|
+
"tag": "20260327065242_curious_nightmare",
|
|
10
|
+
"breakpoints": true
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"idx": 1,
|
|
14
|
+
"version": "7",
|
|
15
|
+
"when": 1775212612594,
|
|
16
|
+
"tag": "20260403103652_slippery_hellfire_club",
|
|
17
|
+
"breakpoints": true
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"idx": 2,
|
|
21
|
+
"version": "7",
|
|
22
|
+
"when": 1775215339838,
|
|
23
|
+
"tag": "20260403112219_gigantic_namora",
|
|
24
|
+
"breakpoints": true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"idx": 3,
|
|
28
|
+
"version": "7",
|
|
29
|
+
"when": 1776669152203,
|
|
30
|
+
"tag": "20260420071232_previous_justin_hammer",
|
|
31
|
+
"breakpoints": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"idx": 4,
|
|
35
|
+
"version": "7",
|
|
36
|
+
"when": 1776677517280,
|
|
37
|
+
"tag": "20260420093157_spooky_cassandra_nova",
|
|
38
|
+
"breakpoints": true
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"idx": 5,
|
|
42
|
+
"version": "7",
|
|
43
|
+
"when": 1776680191903,
|
|
44
|
+
"tag": "20260420101631_even_ogun",
|
|
45
|
+
"breakpoints": true
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"idx": 6,
|
|
49
|
+
"version": "7",
|
|
50
|
+
"when": 1777115119543,
|
|
51
|
+
"tag": "20260425110519_smart_amazoness",
|
|
52
|
+
"breakpoints": true
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"idx": 7,
|
|
56
|
+
"version": "7",
|
|
57
|
+
"when": 1777347342886,
|
|
58
|
+
"tag": "20260428033542_rename_source_query_interface_missing",
|
|
59
|
+
"breakpoints": true
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,d as t,f as n}from"./createReactComponent-_L2mp4Ui.js";import{t as r}from"./useCompositeItem-DqawtL5i.js";function i(i){let{render:a,className:o,state:s=n,props:c=t,refs:l=t,metadata:u,stateAttributesMapping:d,tag:f=`div`,...p}=i,{compositeProps:m,compositeRef:h}=r({metadata:u});return e(f,i,{state:s,ref:[...l,h],props:[m,...c,p],stateAttributesMapping:d})}export{i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{C as r,F as i,S as a,x as o,y as s}from"./createReactComponent-_L2mp4Ui.js";import{$ as c,it as l}from"./getDisabledMountTransitionStyles-f3pOCbyk.js";function u(e,t,n){return Math.floor(e/t)!==n}function d(e,t){return t<0||t>=e.current.length}function f(e,t){return m(e,{disabledIndices:t})}function p(e,t){return m(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function m(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.current.length-1&&y(e,a,r));return a}function h(e,{event:t,orientation:n,loopFocus:r,rtl:i,cols:a,disabledIndices:o,minIndex:s,maxIndex:f,prevIndex:p,stopEvent:h=!1}){let g=p,_=[],v={},b=!1;{let t=null,n=-1;e.current.forEach((e,r)=>{if(e==null)return;let i=e.closest(`[role="row"]`);i&&(b=!0),(i!==t||n===-1)&&(t=i,n+=1,_[n]=[]),_[n].push(r),v[r]=n})}let x=b&&_.length>0&&_.some(e=>e.length!==a);function S(t){if(!x||p===-1)return;let n=v[p];if(n==null)return;let i=_[n].indexOf(p),a=t===`up`?n-1:n+1;r&&(a<0?a=_.length-1:a>=_.length&&(a=0));let s=new Set;for(;a>=0&&a<_.length&&!s.has(a);){s.add(a);let n=_[a];if(n.length===0){a=t===`up`?a-1:a+1;continue}let c=Math.min(i,n.length-1);for(let t=c;t>=0;--t){let r=n[t];if(!y(e,r,o))return r}a=t===`up`?a-1:a+1,r&&(a<0?a=_.length-1:a>=_.length&&(a=0))}}if(t.key===`ArrowUp`){let n=S(`up`);if(n!==void 0)h&&l(t),g=n;else{if(h&&l(t),p===-1)g=f;else if(g=m(e,{startingIndex:g,amount:a,decrement:!0,disabledIndices:o}),r&&(p-a<s||g<0)){let e=p%a,t=f%a,n=f-(t-e);g=t===e?f:t>e?n:n-a}d(e,g)&&(g=p)}}if(t.key===`ArrowDown`){let n=S(`down`);n===void 0?(h&&l(t),p===-1?g=s:(g=m(e,{startingIndex:p,amount:a,disabledIndices:o}),r&&p+a>f&&(g=m(e,{startingIndex:p%a-a,amount:a,disabledIndices:o}))),d(e,g)&&(g=p)):(h&&l(t),g=n)}if(n===`both`){let n=c(p/a);t.key===(i?`ArrowLeft`:`ArrowRight`)&&(h&&l(t),p%a===a-1?r&&(g=m(e,{startingIndex:p-p%a-1,disabledIndices:o})):(g=m(e,{startingIndex:p,disabledIndices:o}),r&&u(g,a,n)&&(g=m(e,{startingIndex:p-p%a-1,disabledIndices:o}))),u(g,a,n)&&(g=p)),t.key===(i?`ArrowRight`:`ArrowLeft`)&&(h&&l(t),p%a===0?r&&(g=m(e,{startingIndex:p+(a-p%a),decrement:!0,disabledIndices:o})):(g=m(e,{startingIndex:p,decrement:!0,disabledIndices:o}),r&&u(g,a,n)&&(g=m(e,{startingIndex:p+(a-p%a),decrement:!0,disabledIndices:o}))),u(g,a,n)&&(g=p));let s=c(f/a)===n;d(e,g)&&(g=r&&s?t.key===(i?`ArrowRight`:`ArrowLeft`)?f:m(e,{startingIndex:p-p%a-1,disabledIndices:o}):p)}return g}function g(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function _(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function v(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function y(e,t,n){if(typeof n==`function`)return n(t);if(n)return n.includes(t);let r=e.current[t];return r?r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`:!1}var b=`ArrowUp`,x=`ArrowDown`,S=`ArrowLeft`,C=`ArrowRight`,w=`Home`,T=new Set([S,C]),E=new Set([S,C,w,`End`]),D=new Set([b,x]),O=new Set([b,x,w,`End`]),k=new Set([...T,...D]),A=new Set([...k,w,`End`]),j=new Set([b,x,S,C,w,`End`]),M=new Set([`Shift`,`Control`,`Alt`,`Meta`]);function N(e){return i(e)&&e.tagName===`INPUT`}function P(e){return!!(N(e)&&e.selectionStart!=null||i(e)&&e.tagName===`TEXTAREA`)}function F(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=I(e,t,`left`),a=L(e),o=L(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginRight<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=I(e,t,`top`),r=L(e),i=L(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function I(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function L(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var R=e(t()),z=R.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function B(){return R.useContext(z)}var V=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function H(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:s,unregister:c,subscribeMapChange:l,elementsRef:u,labelsRef:d,nextIndexRef:f}=B(),p=R.useRef(-1),[m,h]=R.useState(a??(i===V.GuessFromOrder?()=>{if(p.current===-1){let e=f.current;f.current+=1,p.current=e}return p.current}:-1)),g=R.useRef(null),_=R.useCallback(e=>{if(g.current=e,m!==-1&&e!==null&&(u.current[m]=e,d)){let n=t!==void 0;d.current[m]=n?t:r?.current?.textContent??e.textContent}},[m,u,d,t,r]);return o(()=>{if(a!=null)return;let e=g.current;if(e)return s(e,n),()=>{c(e)}},[a,s,c,n]),o(()=>{if(a==null)return l(e=>{let t=g.current?e.get(g.current)?.index:null;t!=null&&h(t)})},[a,l,h]),R.useMemo(()=>({ref:_,index:m}),[m,_])}var U=R.createContext(void 0);function W(e){let t=R.useContext(U);if(t===void 0&&!e)throw Error(s(69));return t}var G=n();function K(e){let{children:t,elementsRef:n,labelsRef:i,onMapChange:s}=e,c=a(s),l=R.useRef(0),u=r(J).current,d=r(q).current,[f,p]=R.useState(0),m=R.useRef(f),h=a((e,t)=>{d.set(e,t??null),m.current+=1,p(m.current)}),g=a(e=>{d.delete(e),m.current+=1,p(m.current)}),_=R.useMemo(()=>{let e=new Map;return Array.from(d.keys()).filter(e=>e.isConnected).sort(Y).forEach((t,n)=>{let r=d.get(t)??{};e.set(t,{...r,index:n})}),e},[d,f]);o(()=>{if(typeof MutationObserver!=`function`||_.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(m.current+=1,p(m.current))});return _.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[_]),o(()=>{m.current===f&&(n.current.length!==_.size&&(n.current.length=_.size),i&&i.current.length!==_.size&&(i.current.length=_.size),l.current=_.size),c(_)},[c,_,n,i,f]),o(()=>()=>{n.current=[]},[n]),o(()=>()=>{i&&(i.current=[])},[i]);let v=a(e=>(u.add(e),()=>{u.delete(e)}));o(()=>{u.forEach(e=>e(_))},[u,_]);let y=R.useMemo(()=>({register:h,unregister:g,subscribeMapChange:v,elementsRef:n,labelsRef:i,nextIndexRef:l}),[h,g,v,n,i,l]);return(0,G.jsx)(z.Provider,{value:y,children:t})}function q(){return new Map}function J(){return new Set}function Y(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}export{v as C,d as D,f as E,y as O,_ as S,p as T,O as _,A as a,g as b,S as c,j as d,w as f,D as g,M as h,H as i,C as l,E as m,W as n,x as o,T as p,V as r,k as s,K as t,b as u,P as v,h as w,m as x,F as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{C as r,S as i,a,g as o,y as s}from"./createReactComponent-_L2mp4Ui.js";import{E as c,O as l,S as u,T as d,a as f,b as p,ct as m,dt as h,f as g,g as _,h as v,l as y,m as b,o as x,p as S,u as C,y as w}from"./getDisabledMountTransitionStyles-f3pOCbyk.js";import{d as T}from"./CompositeList-C9xWKWEY.js";import{c as E,i as D,n as O,t as k}from"./useBaseUiId-Cn1kR417.js";import{a as A,i as j,l as M,n as N,r as P}from"./getPseudoElementBounds-BpCtHFAC.js";import{n as F}from"./Separator-Di8cGnYl.js";var I=e(t()),L=I.createContext(void 0);function R(e){let t=I.useContext(L);if(e===!1&&t===void 0)throw Error(s(27));return t}var z={...x,...p},B=I.forwardRef(function(e,t){let{render:n,className:r,forceRender:i=!1,...o}=e,{store:s}=R(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`),d=s.useState(`transitionStatus`);return a(`div`,e,{state:I.useMemo(()=>({open:c,transitionStatus:d}),[c,d]),ref:[s.context.backdropRef,t],stateAttributesMapping:z,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:i||!l})}),V=I.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:s=!0,...c}=e,{store:l}=R(),u=l.useState(`open`);function d(e){u&&l.setOpen(!1,O(D,e.nativeEvent))}let{getButtonProps:f,buttonRef:p}=o({disabled:i,native:s});return a(`button`,e,{state:I.useMemo(()=>({disabled:i}),[i]),ref:[t,p],props:[{onClick:d},c,f]})}),H=I.forwardRef(function(e,t){let{render:n,className:r,id:i,...o}=e,{store:s}=R(),c=k(i);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),a(`p`,e,{ref:t,props:[{id:c},o]})}),U=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),W=function(e){return e[e.open=f.open]=`open`,e[e.closed=f.closed]=`closed`,e[e.startingStyle=f.startingStyle]=`startingStyle`,e[e.endingStyle=f.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),G=I.createContext(void 0);function K(){let e=I.useContext(G);if(e===void 0)throw Error(s(26));return e}var q=n(),J={...x,...p,nestedDialogOpen(e){return e?{[W.nestedDialogOpen]:``}:null}},Y=I.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:o,...s}=e,{store:c}=R(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`);K(),w({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});function S(e){return e===`touch`?c.context.popupRef.current:!0}let C=i===void 0?S:i,E=g>0,D=a(`div`,e,{state:I.useMemo(()=>({open:_,nested:h,transitionStatus:b,nestedDialogOpen:E}),[_,h,b,E]),props:[f,{"aria-labelledby":y??void 0,"aria-describedby":l??void 0,role:x,tabIndex:-1,hidden:!m,onKeyDown(e){T.has(e.key)&&e.stopPropagation()},style:{[U.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,c.useStateSetter(`popupElement`)],stateAttributesMapping:J});return(0,q.jsx)(M,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:r,modal:p!==!1,restoreFocus:`popup`,children:D})}),X=I.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=R(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,q.jsx)(G.Provider,{value:n,children:(0,q.jsxs)(l,{ref:t,...r,children:[a&&o===!0&&(0,q.jsx)(j,{ref:i.context.internalBackdropRef,inert:A(!s)}),e.children]})}):null});function Z(e){let{store:t,parentContext:n,actionsRef:r}=e,a=t.useState(`open`),o=t.useState(`disablePointerDismissal`),s=t.useState(`modal`),l=t.useState(`popupElement`),{openMethod:u,triggerProps:d,reset:f}=N(a);v(t);let{forceUnmount:p}=_(a,t,()=>{f()}),g=i(e=>{let n=O(e);return n.preventUnmountOnClose=()=>{t.set(`preventUnmountingOnClose`,!0)},n}),b=I.useCallback(()=>{t.setOpen(!1,g(E))},[t,g]);I.useImperativeHandle(r,()=>({unmount:p,close:b}),[p,b]);let x=C({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[S,w]=I.useState(0),T=S===0,D=F(x),k=c(x,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:s===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=h(e);if(T&&!o){let e=n;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||m(e,l)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:T});P(a&&s===!0,l);let{getReferenceProps:A,getFloatingProps:j,getTriggerProps:M}=y([D,k]);t.useContextCallback(`onNestedDialogOpen`,e=>{w(e+1)}),t.useContextCallback(`onNestedDialogClose`,()=>{w(0)}),I.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(S),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[a,n,S]);let L=I.useMemo(()=>A(d),[A,d]),R=I.useMemo(()=>M(d),[M,d]),z=I.useMemo(()=>j(),[j]);t.useSyncedValues({openMethod:u,activeTriggerProps:L,inactiveTriggerProps:R,popupProps:z,floatingRootContext:x,nestedOpenDialogCount:S})}var Q={...S,modal:d(e=>e.modal),nested:d(e=>e.nested),nestedOpenDialogCount:d(e=>e.nestedOpenDialogCount),disablePointerDismissal:d(e=>e.disablePointerDismissal),openMethod:d(e=>e.openMethod),descriptionElementId:d(e=>e.descriptionElementId),titleElementId:d(e=>e.titleElementId),viewportElement:d(e=>e.viewportElement),role:d(e=>e.role)},$=class extends u{constructor(e){super(ee(e),{popupRef:I.createRef(),backdropRef:I.createRef(),internalBackdropRef:I.createRef(),triggerElements:new b,onOpenChange:void 0,onOpenChangeComplete:void 0},Q)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;let n={open:e,nativeEvent:t.event,reason:t.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit(`openchange`,n);let r={open:e},i=t.trigger?.id??null;(i||e)&&(r.activeTriggerId=i,r.activeTriggerElement=t.trigger??null),this.update(r)}};function ee(e={}){return{...g(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:`dialog`,...e}}function te(e){let{children:t,open:n,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=e,p=R(!0),m=!!p,h=r(()=>u?.store??new $({open:n??i,activeTriggerId:d===void 0?f:d,modal:c,disablePointerDismissal:s,nested:m})).current;h.useControlledProp(`open`,n,i),h.useControlledProp(`activeTriggerId`,d,f),h.useSyncedValues({disablePointerDismissal:s,nested:m,modal:c}),h.useContextCallback(`onOpenChange`,a),h.useContextCallback(`onOpenChangeComplete`,o);let g=h.useState(`payload`);Z({store:h,actionsRef:l,parentContext:p?.store.context,onOpenChange:a,triggerIdProp:d});let _=I.useMemo(()=>({store:h}),[h]);return(0,q.jsx)(L.Provider,{value:_,children:typeof t==`function`?t({payload:g}):t})}var ne=I.forwardRef(function(e,t){let{render:n,className:r,id:i,...o}=e,{store:s}=R(),c=k(i);return s.useSyncedValueWithCleanup(`titleElementId`,c),a(`h2`,e,{ref:t,props:[{id:c},o]})});export{H as a,R as c,Y as i,te as n,V as o,X as r,B as s,ne as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createReactComponent-_L2mp4Ui.js";var t=e(`outline`,`arrow-right`,`ArrowRight`,[[`path`,{d:`M5 12l14 0`,key:`svg-0`}],[`path`,{d:`M13 18l6 -6`,key:`svg-1`}],[`path`,{d:`M13 6l6 6`,key:`svg-2`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createReactComponent-_L2mp4Ui.js";var t=e(`outline`,`check`,`Check`,[[`path`,{d:`M5 12l5 5l10 -10`,key:`svg-0`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createReactComponent-_L2mp4Ui.js";var t=e(`outline`,`chevron-down`,`ChevronDown`,[[`path`,{d:`M6 9l6 6l6 -6`,key:`svg-0`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createReactComponent-_L2mp4Ui.js";var t=e(`outline`,`chevron-right`,`ChevronRight`,[[`path`,{d:`M9 6l6 6l-6 6`,key:`svg-0`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createReactComponent-_L2mp4Ui.js";var t=e(`outline`,`coins`,`Coins`,[[`path`,{d:`M9 14c0 1.657 2.686 3 6 3s6 -1.343 6 -3s-2.686 -3 -6 -3s-6 1.343 -6 3`,key:`svg-0`}],[`path`,{d:`M9 14v4c0 1.656 2.686 3 6 3s6 -1.344 6 -3v-4`,key:`svg-1`}],[`path`,{d:`M3 6c0 1.072 1.144 2.062 3 2.598s4.144 .536 6 0c1.856 -.536 3 -1.526 3 -2.598c0 -1.072 -1.144 -2.062 -3 -2.598s-4.144 -.536 -6 0c-1.856 .536 -3 1.526 -3 2.598`,key:`svg-2`}],[`path`,{d:`M3 6v10c0 .888 .772 1.45 2 2`,key:`svg-3`}],[`path`,{d:`M3 11c0 .888 .772 1.45 2 2`,key:`svg-4`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createReactComponent-_L2mp4Ui.js";var t=e(`outline`,`database`,`Database`,[[`path`,{d:`M4 6a8 3 0 1 0 16 0a8 3 0 1 0 -16 0`,key:`svg-0`}],[`path`,{d:`M4 6v6a8 3 0 0 0 16 0v-6`,key:`svg-1`}],[`path`,{d:`M4 12v6a8 3 0 0 0 16 0v-6`,key:`svg-2`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createReactComponent-_L2mp4Ui.js";var t=e(`outline`,`history`,`History`,[[`path`,{d:`M12 8l0 4l2 2`,key:`svg-0`}],[`path`,{d:`M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5`,key:`svg-1`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createReactComponent-_L2mp4Ui.js";var t=e(`outline`,`loader-2`,`Loader2`,[[`path`,{d:`M12 3a9 9 0 1 0 9 9`,key:`svg-0`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createReactComponent-_L2mp4Ui.js";var t=e(`outline`,`plus`,`Plus`,[[`path`,{d:`M12 5l0 14`,key:`svg-0`}],[`path`,{d:`M5 12l14 0`,key:`svg-1`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createReactComponent-_L2mp4Ui.js";var t=e(`outline`,`x`,`X`,[[`path`,{d:`M18 6l-12 12`,key:`svg-0`}],[`path`,{d:`M6 6l12 12`,key:`svg-1`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,n as t}from"./jsx-runtime-DG_AJzB_.js";import{a as n,f as r}from"./createReactComponent-_L2mp4Ui.js";import{V as i,ut as a}from"./getDisabledMountTransitionStyles-f3pOCbyk.js";import{v as o}from"./useBaseUiId-Cn1kR417.js";var s=e(t()),c=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function l(e,t={}){let n=`rootStore`in e?e.rootStore:e,l=n.useState(`open`),u=n.useState(`floatingId`),d=n.useState(`domReferenceElement`),f=n.useState(`floatingElement`),{enabled:p=!0,role:m=`dialog`}=t,h=o(),g=d?.id||h,_=s.useMemo(()=>a(f)?.id||u,[f,u]),v=c.get(m)??m,y=i()!=null,b=s.useMemo(()=>v===`tooltip`||m===`label`?r:{"aria-haspopup":v===`alertdialog`?`dialog`:v,"aria-expanded":`false`,...v===`listbox`&&{role:`combobox`},...v===`menu`&&y&&{role:`menuitem`},...m===`select`&&{"aria-autocomplete":`none`},...m===`combobox`&&{"aria-autocomplete":`list`}},[v,y,m]),x=s.useMemo(()=>v===`tooltip`||m===`label`?{[`aria-${m===`label`?`labelledby`:`describedby`}`]:l?_:void 0}:{...b,"aria-expanded":l?`true`:`false`,"aria-controls":l?_:void 0,...v===`menu`&&{id:g}},[v,_,l,g,m,b]),S=s.useMemo(()=>{let e={id:_,...v&&{role:v}};return v===`tooltip`||m===`label`?e:{...e,...v===`menu`&&{"aria-labelledby":g}}},[v,_,g,m]),C=s.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${_}-fui-option`}};switch(m){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[_,m]);return s.useMemo(()=>p?{reference:x,floating:S,item:C,trigger:b}:{},[p,x,S,b,C])}var u=s.forwardRef(function(e,t){let{className:r,render:i,orientation:a=`horizontal`,...o}=e;return n(`div`,e,{state:s.useMemo(()=>({orientation:a}),[a]),ref:t,props:[{role:`separator`,"aria-orientation":a},o]})});export{l as n,u as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./jsx-runtime-DG_AJzB_.js";import{t}from"./compiler-runtime-DCc3R3Xn.js";import{X as n}from"./index-C_q-gtGv.js";var r=t(),i=e();function a(){let e=(0,r.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,i.jsx)(n,{}),e[0]=t):t=e[0],t}export{a as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./link-Cgvqhh5w.js";import{t as i}from"./compiler-runtime-DCc3R3Xn.js";import{n as a,t as o}from"./useRouterState-DpT8luFk.js";import{a as s,c,o as l}from"./api-base-url-DIb6qukm.js";import{b as u,i as d,n as f,r as p,t as m}from"./createReactComponent-_L2mp4Ui.js";import{t as h}from"./utils-C8DGLIgm.js";import{t as g}from"./IconCheck-Gc24xPT2.js";import{t as _}from"./IconChevronDown-B-39MA7-.js";import{t as v}from"./IconCoins-C7Nn0L6R.js";import{t as y}from"./theme-toggle-CcB6O_vF.js";import{t as b}from"./IconHistory-k3NVXypq.js";import{t as x}from"./IconPlus-Ie-KpLOF.js";import{t as S}from"./IconX-Cg43mUxH.js";import{r as C}from"./auth-client-Dj6z7Pcl.js";import{t as w}from"./useQuery-Bj5cJCZc.js";import{t as T}from"./useSuspenseQuery-ZQGYM-g4.js";import{n as E,t as D}from"./organization-permissions-PidGz2SY.js";import{A as O,D as k,M as A,O as j,X as M,j as N,k as ee,x as te}from"./index-C_q-gtGv.js";import{t as P}from"./useRender-DFMo54_d.js";import"./input-DSkIbIFK.js";import{t as F}from"./separator-CWjuJH0f.js";import{a as I,i as L,n as R,o as z,r as B,s as V,t as H}from"./DialogTitle-DSjY6Xud.js";import{n as U,t as W}from"./avatar-DoLsibq3.js";import{c as ne,d as re,l as ie,n as ae,o as G,r as K,s as oe,t as q,u as se}from"./dropdown-menu-CLot8VIw.js";function J(e){return o({select:t=>e?.select?e.select(t.location):t.location})}var ce=m(`outline`,`home`,`Home`,[[`path`,{d:`M5 12l-2 0l9 -9l9 9l-2 0`,key:`svg-0`}],[`path`,{d:`M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7`,key:`svg-1`}],[`path`,{d:`M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6`,key:`svg-2`}]]),le=m(`outline`,`layout-sidebar`,`LayoutSidebar`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M9 4l0 16`,key:`svg-1`}]]),ue=m(`outline`,`logout`,`Logout`,[[`path`,{d:`M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2`,key:`svg-0`}],[`path`,{d:`M9 12h12l-3 -3`,key:`svg-1`}],[`path`,{d:`M18 15l3 -3`,key:`svg-2`}]]),de=m(`outline`,`plug-connected`,`PlugConnected`,[[`path`,{d:`M7 12l5 5l-1.5 1.5a3.536 3.536 0 1 1 -5 -5l1.5 -1.5`,key:`svg-0`}],[`path`,{d:`M17 12l-5 -5l1.5 -1.5a3.536 3.536 0 1 1 5 5l-1.5 1.5`,key:`svg-1`}],[`path`,{d:`M3 21l2.5 -2.5`,key:`svg-2`}],[`path`,{d:`M18.5 5.5l2.5 -2.5`,key:`svg-3`}],[`path`,{d:`M10 11l-2 2`,key:`svg-4`}],[`path`,{d:`M13 14l-2 2`,key:`svg-5`}]]),fe=m(`outline`,`settings`,`Settings`,[[`path`,{d:`M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065`,key:`svg-0`}],[`path`,{d:`M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0`,key:`svg-1`}]]),pe=m(`outline`,`users`,`Users`,[[`path`,{d:`M5 7a4 4 0 1 0 8 0a4 4 0 1 0 -8 0`,key:`svg-0`}],[`path`,{d:`M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2`,key:`svg-1`}],[`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`,key:`svg-2`}],[`path`,{d:`M21 21v-2a4 4 0 0 0 -3 -3.85`,key:`svg-3`}]]),Y=i(),X=e(t(),1),Z=n();function me(e){let t=(0,Y.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(R,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function he(e){let t=(0,Y.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,Z.jsx)(B,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function ge(e){let t=(0,Y.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=h(`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(V,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function _e(e){let t=(0,Y.c)(17),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,side:a,showCloseButton: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?`right`:a,c=o===void 0?!0:o,l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Z.jsx)(ge,{}),t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=h(`bg-background data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-50 flex flex-col gap-4 bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm`,r),t[7]=r,t[8]=u);let d;t[9]===c?d=t[10]:(d=c&&(0,Z.jsxs)(z,{"data-slot":`sheet-close`,render:(0,Z.jsx)(f,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,Z.jsx)(S,{}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[9]=c,t[10]=d);let p;return t[11]!==n||t[12]!==i||t[13]!==s||t[14]!==u||t[15]!==d?(p=(0,Z.jsxs)(he,{children:[l,(0,Z.jsxs)(L,{"data-slot":`sheet-content`,"data-side":s,className:u,...i,children:[n,d]})]}),t[11]=n,t[12]=i,t[13]=s,t[14]=u,t[15]=d,t[16]=p):p=t[16],p}function ve(e){let t=(0,Y.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=h(`gap-0.5 p-4 flex flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ye(e){let t=(0,Y.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=h(`text-foreground text-base font-medium`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(H,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function be(e){let t=(0,Y.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=h(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(I,{"data-slot":`sheet-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xe(e){let t=(0,Y.c)(3),n=e===void 0?768:e,[r,i]=X.useState(void 0),a,o;return t[0]===n?(a=t[1],o=t[2]):(a=()=>{let e=window.matchMedia(`(max-width: ${n-1}px)`),t=()=>{i(window.innerWidth<n)};return e.addEventListener(`change`,t),i(window.innerWidth<n),()=>e.removeEventListener(`change`,t)},o=[n],t[0]=n,t[1]=a,t[2]=o),X.useEffect(a,o),!!r}var Se=`sidebar_state`,Ce=3600*24*7,we=`16rem`,Te=`18rem`,Ee=`3rem`,De=`b`,Oe=X.createContext(null);function Q(){let e=X.useContext(Oe);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function ke(e){let t=(0,Y.c)(36),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]):({defaultOpen:c,open:i,onOpenChange:o,className:r,style:s,children:n,...a}=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=c===void 0?!0:c,u=xe(),[d,f]=X.useState(!1),[p,m]=X.useState(l),g=i??p,_;t[8]!==g||t[9]!==o?(_=e=>{let t=typeof e==`function`?e(g):e;o?o(t):m(t),document.cookie=`${Se}=${t}; path=/; max-age=${Ce}`},t[8]=g,t[9]=o,t[10]=_):_=t[10];let v=_,y;t[11]!==u||t[12]!==v?(y=()=>u?f(je):v(Ae),t[11]=u,t[12]=v,t[13]=y):y=t[13];let b=y,x,S;t[14]===b?(x=t[15],S=t[16]):(x=()=>{let e=e=>{e.key===De&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),b())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},S=[b],t[14]=b,t[15]=x,t[16]=S),X.useEffect(x,S);let C=g?`expanded`:`collapsed`,w;t[17]!==u||t[18]!==g||t[19]!==d||t[20]!==v||t[21]!==C||t[22]!==b?(w={state:C,open:g,setOpen:v,isMobile:u,openMobile:d,setOpenMobile:f,toggleSidebar:b},t[17]=u,t[18]=g,t[19]=d,t[20]=v,t[21]=C,t[22]=b,t[23]=w):w=t[23];let T=w,E;t[24]===s?E=t[25]:(E={"--sidebar-width":we,"--sidebar-width-icon":Ee,...s},t[24]=s,t[25]=E);let D=E,O;t[26]===r?O=t[27]:(O=h(`group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full`,r),t[26]=r,t[27]=O);let k;t[28]!==n||t[29]!==a||t[30]!==D||t[31]!==O?(k=(0,Z.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:D,className:O,...a,children:n}),t[28]=n,t[29]=a,t[30]=D,t[31]=O,t[32]=k):k=t[32];let A;return t[33]!==T||t[34]!==k?(A=(0,Z.jsx)(Oe.Provider,{value:T,children:k}),t[33]=T,t[34]=k,t[35]=A):A=t[35],A}function Ae(e){return!e}function je(e){return!e}function Me(e){let t=(0,Y.c)(46),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({side:a,variant:o,collapsible:s,className:r,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);let c=a===void 0?`left`:a,l=o===void 0?`sidebar`:o,u=s===void 0?`offExamples`:s,{isMobile:d,state:f,openMobile:p,setOpenMobile:m}=Q();if(u===`none`){let e;t[7]===r?e=t[8]:(e=h(`bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col`,r),t[7]=r,t[8]=e);let a;return t[9]!==n||t[10]!==i||t[11]!==e?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar`,className:e,...i,children:n}),t[9]=n,t[10]=i,t[11]=e,t[12]=a):a=t[12],a}if(d){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e={"--sidebar-width":Te},t[13]=e):e=t[13];let r;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsxs)(ve,{className:`sr-only`,children:[(0,Z.jsx)(ye,{children:`Sidebar`}),(0,Z.jsx)(be,{children:`Displays the mobile sidebar.`})]}),t[14]=r):r=t[14];let a;t[15]===n?a=t[16]:(a=(0,Z.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:n}),t[15]=n,t[16]=a);let o;t[17]!==c||t[18]!==a?(o=(0,Z.jsxs)(_e,{"data-sidebar":`sidebar`,"data-slot":`sidebar`,"data-mobile":`true`,className:`bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden`,style:e,side:c,children:[r,a]}),t[17]=c,t[18]=a,t[19]=o):o=t[19];let s;return t[20]!==p||t[21]!==i||t[22]!==m||t[23]!==o?(s=(0,Z.jsx)(me,{open:p,onOpenChange:m,...i,children:o}),t[20]=p,t[21]=i,t[22]=m,t[23]=o,t[24]=s):s=t[24],s}let g=f===`collapsed`?u:``,_=l===`floating`||l===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,v;t[25]===_?v=t[26]:(v=h(`transition-[width] duration-200 ease-linear relative w-(--sidebar-width) bg-transparent`,`group-data-[collapsible=offExamples]:w-0`,`group-data-[side=right]:rotate-180`,_),t[25]=_,t[26]=v);let y;t[27]===v?y=t[28]:(y=(0,Z.jsx)(`div`,{"data-slot":`sidebar-gap`,className:v}),t[27]=v,t[28]=y);let b=c===`left`?`left-0 group-data-[collapsible=offExamples]:left-[calc(var(--sidebar-width)*-1)]`:`right-0 group-data-[collapsible=offExamples]:right-[calc(var(--sidebar-width)*-1)]`,x=l===`floating`||l===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,S;t[29]!==r||t[30]!==b||t[31]!==x?(S=h(`fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex`,b,x,r),t[29]=r,t[30]=b,t[31]=x,t[32]=S):S=t[32];let C;t[33]===n?C=t[34]:(C=(0,Z.jsx)(`div`,{"data-sidebar":`sidebar`,"data-slot":`sidebar-inner`,className:`bg-sidebar group-data-[variant=floating]:ring-sidebar-border group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 flex size-full flex-col`,children:n}),t[33]=n,t[34]=C);let w;t[35]!==i||t[36]!==S||t[37]!==C?(w=(0,Z.jsx)(`div`,{"data-slot":`sidebar-container`,className:S,...i,children:C}),t[35]=i,t[36]=S,t[37]=C,t[38]=w):w=t[38];let T;return t[39]!==c||t[40]!==f||t[41]!==w||t[42]!==g||t[43]!==y||t[44]!==l?(T=(0,Z.jsxs)(`div`,{className:`group peer text-sidebar-foreground hidden md:block`,"data-state":f,"data-collapsible":g,"data-variant":l,"data-side":c,"data-slot":`sidebar`,children:[y,w]}),t[39]=c,t[40]=f,t[41]=w,t[42]=g,t[43]=y,t[44]=l,t[45]=T):T=t[45],T}function Ne(e){let t=(0,Y.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,onClick:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{toggleSidebar:a}=Q(),o;t[4]===n?o=t[5]:(o=h(n),t[4]=n,t[5]=o);let s;t[6]!==r||t[7]!==a?(s=e=>{r?.(e),a()},t[6]=r,t[7]=a,t[8]=s):s=t[8];let c,l;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(le,{}),l=(0,Z.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`}),t[9]=c,t[10]=l):(c=t[9],l=t[10]);let u;return t[11]!==i||t[12]!==o||t[13]!==s?(u=(0,Z.jsxs)(f,{"data-sidebar":`trigger`,"data-slot":`sidebar-trigger`,variant:`ghost`,size:`icon-sm`,className:o,onClick:s,...i,children:[c,l]}),t[11]=i,t[12]=o,t[13]=s,t[14]=u):u=t[14],u}function Pe(e){let t=(0,Y.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=h(`bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 relative flex w-full flex-1 flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`main`,{"data-slot":`sidebar-inset`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Fe(e){let t=(0,Y.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=h(`gap-2 p-2 flex flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-header`,"data-sidebar":`header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ie(e){let t=(0,Y.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=h(`no-scrollbar gap-0 flex min-h-0 flex-1 flex-col overflow-auto group-data-[collapsible=icon]:overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Le(e){let t=(0,Y.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=h(`p-2 relative flex w-full min-w-0 flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group`,"data-sidebar":`group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Re(e){let t=(0,Y.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=h(`text-sm w-full`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`div`,{"data-slot":`sidebar-group-content`,"data-sidebar":`group-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ze(e){let t=(0,Y.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=h(`gap-0 flex w-full min-w-0 flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`ul`,{"data-slot":`sidebar-menu`,"data-sidebar":`menu`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Be(e){let t=(0,Y.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=h(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(`li`,{"data-slot":`sidebar-menu-item`,"data-sidebar":`menu-item`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Ve=d(`ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground gap-2 rounded-md p-2 text-left text-sm transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 data-active:font-medium peer/menu-button flex w-full items-center overflow-hidden outline-hidden group/menu-button disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function He(e){let t=(0,Y.c)(15),{render:n,isActive:r,variant:i,size:a,tooltip:o,className:s,...c}=e,l=r===void 0?!1:r,d=i===void 0?`default`:i,f=a===void 0?`default`:a,{isMobile:p,state:m}=Q(),g=u({className:h(Ve({variant:d,size:f}),s)},c),_=o?A:n,v;t[0]!==l||t[1]!==f?(v={slot:`sidebar-menu-button`,sidebar:`menu-button`,size:f,active:l},t[0]=l,t[1]=f,t[2]=v):v=t[2];let y;t[3]!==g||t[4]!==_||t[5]!==v?(y={defaultTagName:`button`,props:g,render:_,state:v},t[3]=g,t[4]=_,t[5]=v,t[6]=y):y=t[6];let b=P(y);if(!o)return b;if(typeof o==`string`){let e;t[7]===o?e=t[8]:(e={children:o},t[7]=o,t[8]=e),o=e}let x=m!==`collapsed`||p,S;t[9]!==x||t[10]!==o?(S=(0,Z.jsx)(N,{side:`right`,align:`center`,hidden:x,...o}),t[9]=x,t[10]=o,t[11]=S):S=t[11];let C;return t[12]!==b||t[13]!==S?(C=(0,Z.jsxs)(O,{children:[b,S]}),t[12]=b,t[13]=S,t[14]=C):C=t[14],C}var Ue=[{icon:ce,label:`Home`,to:`/$org_slug/home`},{icon:b,label:`Audit`,to:`/$org_slug/audit`},{icon:v,label:`Budget`,to:`/$org_slug/budget`},{icon:de,label:`Integrations`,to:`/$org_slug/integrations`},{icon:pe,label:`Team`,to:`/$org_slug/team`}];function $(e,t){let n=e.replace(`/$org_slug/`,``);return n===`home`?t.endsWith(`/home`):t.includes(`/${n}`)}var We=s(`/_authenticated/$org_slug`);function Ge(e){let t=e?.trim();if(!t)return`?`;let n=t.split(/\s+/),r=n.at(0);if(!r)return`?`;let i=r.at(0);if(!i)return`?`;if(n.length===1)return i.toUpperCase();let a=n.at(-1);if(!a)return i.toUpperCase();let o=a.at(0);return o?`${i}${o}`.toUpperCase():i.toUpperCase()}function Ke(e){for(let t of Ue)if($(t.to,e))return t.label;return`OneQuery`}function qe(){let e=(0,Y.c)(23),t=J(),n=l(),r=We.useRouteContext(),i=a(),o=r.session.user,s=o?.name,c=o?.email,u;e[0]===s?u=e[1]:(u=Ge(s),e[0]=s,e[1]=u);let d=u,f;e[2]===t.pathname?f=e[3]:(f=Ke(t.pathname),e[2]=t.pathname,e[3]=f);let m=f,h;e[4]!==n||e[5]!==i?(h=async function(){await C(),await i.invalidate(),await n({to:`/`})},e[4]=n,e[5]=i,e[6]=h):h=e[6];let g=h,_,v;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Z.jsx)(Ne,{className:`-ml-1`}),v=(0,Z.jsx)(F,{orientation:`vertical`,className:`mr-2 h-4`}),e[7]=_,e[8]=v):(_=e[7],v=e[8]);let b;e[9]===m?b=e[10]:(b=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,v,(0,Z.jsx)(`span`,{className:`font-medium truncate max-w-[70vw]`,children:m})]}),e[9]=m,e[10]=b);let x;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(y,{}),e[11]=x):x=e[11];let S;e[12]!==g||e[13]!==o||e[14]!==c||e[15]!==d||e[16]!==s?(S=o&&(0,Z.jsxs)(q,{children:[(0,Z.jsxs)(re,{className:p({className:`gap-2`,size:`sm`,variant:`ghost`}),children:[(0,Z.jsx)(W,{size:`sm`,children:(0,Z.jsx)(U,{children:d})}),(0,Z.jsx)(`span`,{className:`text-sm`,children:s})]}),(0,Z.jsxs)(ae,{align:`end`,className:`min-w-56`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 px-2 py-2`,children:[(0,Z.jsx)(W,{children:(0,Z.jsx)(U,{children:d})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:s}),(0,Z.jsx)(`span`,{className:`truncate text-xs font-normal text-muted-foreground`,children:c})]})]}),(0,Z.jsx)(G,{}),(0,Z.jsxs)(K,{onClick:g,children:[(0,Z.jsx)(ue,{size:16,stroke:2}),`Sign out`]})]})]}),e[12]=g,e[13]=o,e[14]=c,e[15]=d,e[16]=s,e[17]=S):S=e[17];let w;e[18]===S?w=e[19]:(w=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[x,S]}),e[18]=S,e[19]=w);let T;return e[20]!==b||e[21]!==w?(T=(0,Z.jsxs)(`header`,{className:`sticky top-0 z-10 bg-background flex h-[var(--app-header-height)] shrink-0 items-center justify-between gap-2 border-b px-4`,children:[b,w]}),e[20]=b,e[21]=w,e[22]=T):T=e[22],T}var Je=s(`/_authenticated/$org_slug`);function Ye(e){let t=(0,Y.c)(55),{activeOrganization:n,organizations:r,menuOrgSlug:i}=e,a=l(),o=Je.useRouteContext(),s;t[0]!==o.organizationId||t[1]!==o.session.user.id?(s=te(o.session.user.id,o.organizationId),t[0]=o.organizationId,t[1]=o.session.user.id,t[2]=s):s=t[2];let c=w(s),u=n.name,d;t[3]===n.name?d=t[4]:(d=k(n.name),t[3]=n.name,t[4]=d);let f=d,m=r.length>0,h;if(t[5]!==c.data||t[6]!==o.session.user.id){let e=c.data?.find(e=>e.userId===o.session.user.id)?.rawRole;h=E({permission:`organizationUpdate`,rawRole:e}),t[5]=c.data,t[6]=o.session.user.id,t[7]=h}else h=t[7];let v=h,y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=p({className:`-mx-2 h-auto w-full justify-start gap-2 rounded-md px-2 py-1.5 text-left`,size:`sm`,variant:`ghost`}),t[8]=y):y=t[8];let b;t[9]===f?b=t[10]:(b=(0,Z.jsx)(`div`,{className:`flex size-6 items-center justify-center rounded bg-primary text-xs font-semibold text-primary-foreground`,children:f}),t[9]=f,t[10]=b);let S;t[11]===u?S=t[12]:(S=(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium`,children:u}),t[11]=u,t[12]=S);let C;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(_,{size:12,stroke:2,className:`shrink-0 opacity-50`}),t[13]=C):C=t[13];let T;t[14]===S?T=t[15]:(T=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[S,C]}),t[14]=S,t[15]=T);let D;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Z.jsx)(`div`,{className:`text-xs leading-none text-muted-foreground`,children:`Workspace`}),t[16]=D):D=t[16];let O;t[17]===T?O=t[18]:(O=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[T,D]}),t[17]=T,t[18]=O);let A;t[19]!==O||t[20]!==b?(A=(0,Z.jsx)(re,{className:y,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[b,O]})}),t[19]=O,t[20]=b,t[21]=A):A=t[21];let j;t[22]!==v||t[23]!==i||t[24]!==a?(j=v?(0,Z.jsxs)(K,{onClick:async()=>a({params:{org_slug:i},to:`/$org_slug/settings`}),children:[(0,Z.jsx)(fe,{size:16,stroke:2}),`Settings`]}):null,t[22]=v,t[23]=i,t[24]=a,t[25]=j):j=t[25];let M;t[26]!==i||t[27]!==a?(M=async()=>a({params:{org_slug:i},to:`/$org_slug/team`}),t[26]=i,t[27]=a,t[28]=M):M=t[28];let N;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(pe,{size:16,stroke:2}),t[29]=N):N=t[29];let P;t[30]===M?P=t[31]:(P=(0,Z.jsxs)(K,{onClick:M,children:[N,`Invite and manage members`]}),t[30]=M,t[31]=P);let F;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Z.jsx)(G,{}),t[32]=F):F=t[32];let I;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Z.jsx)(se,{children:`Switch organization`}),t[33]=I):I=t[33];let L;t[34]!==n.id||t[35]!==m||t[36]!==a||t[37]!==r?(L=m?r.map(e=>{let t=n.id===e.id,r=ee(e);return(0,Z.jsxs)(K,{onClick:async()=>a({params:{org_slug:r},to:`/$org_slug/home`}),children:[(0,Z.jsx)(`span`,{className:`truncate`,children:e.name}),t?(0,Z.jsx)(oe,{children:(0,Z.jsx)(g,{size:16,stroke:2})}):null]},e.id)}):(0,Z.jsx)(K,{disabled:!0,children:`No organizations`}),t[34]=n.id,t[35]=m,t[36]=a,t[37]=r,t[38]=L):L=t[38];let R;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Z.jsx)(G,{}),t[39]=R):R=t[39];let z;t[40]===a?z=t[41]:(z=async()=>a({to:`/onboarding/create-org`}),t[40]=a,t[41]=z);let B;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Z.jsx)(x,{size:16,stroke:2}),t[42]=B):B=t[42];let V;t[43]===z?V=t[44]:(V=(0,Z.jsxs)(K,{onClick:z,children:[B,`Create organization`]}),t[43]=z,t[44]=V);let H;t[45]!==L||t[46]!==V?(H=(0,Z.jsxs)(ne,{children:[I,(0,Z.jsxs)(ie,{className:`w-56`,children:[L,R,V]})]}),t[45]=L,t[46]=V,t[47]=H):H=t[47];let U;t[48]!==j||t[49]!==P||t[50]!==H?(U=(0,Z.jsxs)(ae,{align:`start`,className:`w-64`,children:[j,P,F,H]}),t[48]=j,t[49]=P,t[50]=H,t[51]=U):U=t[51];let W;return t[52]!==A||t[53]!==U?(W=(0,Z.jsx)(Fe,{className:`h-14 flex-row items-center border-b px-3`,children:(0,Z.jsxs)(q,{children:[A,U]})}),t[52]=A,t[53]=U,t[54]=W):W=t[54],W}var Xe=s(`/_authenticated/$org_slug`);function Ze(e){let t=(0,Y.c)(31),{orgSlug:n}=e,r=J(),i=Xe.useRouteContext(),a;t[0]!==i.organizationId||t[1]!==i.session.user.id?(a=te(i.session.user.id,i.organizationId),t[0]=i.organizationId,t[1]=i.session.user.id,t[2]=a):a=t[2];let o;t[3]===a?o=t[4]:(o={...a},t[3]=a,t[4]=o);let s=w(o),c,l,u,d,f,p;if(t[5]!==r||t[6]!==s.data||t[7]!==n||t[8]!==i.session.user.id){let e=s.data?.find(e=>e.userId===i.session.user.id)?.rawRole,a=D({rawRole:e}),o=Ue.filter(e=>!e.organizationAdminOnly||a);d=Ie,p=`overflow-hidden`,u=Le,l=Re,c=ze;let m;t[15]!==r||t[16]!==n?(m=e=>(0,Z.jsx)(Qe,{item:e,orgSlug:n,pathname:r.pathname},e.to),t[15]=r,t[16]=n,t[17]=m):m=t[17],f=o.map(m),t[5]=r,t[6]=s.data,t[7]=n,t[8]=i.session.user.id,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];let m;t[18]!==c||t[19]!==f?(m=(0,Z.jsx)(c,{children:f}),t[18]=c,t[19]=f,t[20]=m):m=t[20];let h;t[21]!==l||t[22]!==m?(h=(0,Z.jsx)(l,{children:m}),t[21]=l,t[22]=m,t[23]=h):h=t[23];let g;t[24]!==u||t[25]!==h?(g=(0,Z.jsx)(u,{children:h}),t[24]=u,t[25]=h,t[26]=g):g=t[26];let _;return t[27]!==d||t[28]!==p||t[29]!==g?(_=(0,Z.jsx)(d,{className:p,children:g}),t[27]=d,t[28]=p,t[29]=g,t[30]=_):_=t[30],_}function Qe(e){let t=(0,Y.c)(19),{item:n,orgSlug:i,pathname:a,onClick:o}=e,s;t[0]!==n.to||t[1]!==a?(s=$(n.to,a),t[0]=n.to,t[1]=a,t[2]=s):s=t[2];let c=s,l=c?`!bg-foreground/10 hover:!bg-foreground/10`:``,u;t[3]===i?u=t[4]:(u={org_slug:i},t[3]=i,t[4]=u);let d;t[5]!==n.to||t[6]!==u?(d=(0,Z.jsx)(r,{to:n.to,params:u}),t[5]=n.to,t[6]=u,t[7]=d):d=t[7];let f;t[8]===n.icon?f=t[9]:(f=(0,Z.jsx)(n.icon,{size:20,stroke:1.5}),t[8]=n.icon,t[9]=f);let p;t[10]===n.label?p=t[11]:(p=(0,Z.jsx)(`span`,{children:n.label}),t[10]=n.label,t[11]=p);let m;return t[12]!==c||t[13]!==o||t[14]!==l||t[15]!==d||t[16]!==f||t[17]!==p?(m=(0,Z.jsx)(Be,{children:(0,Z.jsxs)(He,{isActive:c,className:l,onClick:o,render:d,children:[f,p]})}),t[12]=c,t[13]=o,t[14]=l,t[15]=d,t[16]=f,t[17]=p,t[18]=m):m=t[18],m}var $e=s(`/_authenticated/$org_slug`);function et(e){let t=(0,Y.c)(18),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={from:`/_authenticated/$org_slug`},t[0]=r):r=t[0];let i=c(r),a=$e.useRouteContext(),o=i.org_slug??``,s;t[1]===a.session.user.id?s=t[2]:(s=j(a.session.user.id),t[1]=a.session.user.id,t[2]=s);let l=T(s).data,u=a.organization,d=a.organizationSlug,f;t[3]!==u||t[4]!==d||t[5]!==l?(f=(0,Z.jsx)(Ye,{activeOrganization:u,organizations:l,menuOrgSlug:d}),t[3]=u,t[4]=d,t[5]=l,t[6]=f):f=t[6];let p;t[7]===o?p=t[8]:(p=(0,Z.jsx)(Ze,{orgSlug:o}),t[7]=o,t[8]=p);let m;t[9]!==f||t[10]!==p?(m=(0,Z.jsxs)(Me,{children:[f,p]}),t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(qe,{}),t[12]=h):h=t[12];let g;t[13]===n?g=t[14]:(g=(0,Z.jsxs)(Pe,{className:`flex min-h-0 overflow-y-auto [--app-header-height:3.5rem]`,children:[h,(0,Z.jsx)(`main`,{className:`h-[calc(100%-var(--app-header-height))]`,children:n})]}),t[13]=n,t[14]=g);let _;return t[15]!==m||t[16]!==g?(_=(0,Z.jsxs)(ke,{className:`!h-svh`,children:[m,g]}),t[15]=m,t[16]=g,t[17]=_):_=t[17],_}function tt(){let e=(0,Y.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(et,{children:(0,Z.jsx)(M,{})}),e[0]=t):t=e[0],t}export{tt as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./jsx-runtime-DG_AJzB_.js";import{t as n}from"./compiler-runtime-DCc3R3Xn.js";import{i as r}from"./createReactComponent-_L2mp4Ui.js";import{t as i}from"./utils-C8DGLIgm.js";var a=n();e();var o=t(),s=r(`grid gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4 w-full relative group/alert`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function c(e){let t=(0,a.c)(10),n,r,c;t[0]===e?(n=t[1],r=t[2],c=t[3]):({className:n,variant:c,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=c);let l;t[4]!==n||t[5]!==c?(l=i(s({variant:c}),n),t[4]=n,t[5]=c,t[6]=l):l=t[6];let u;return t[7]!==r||t[8]!==l?(u=(0,o.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:l,...r}),t[7]=r,t[8]=l,t[9]=u):u=t[9],u}function l(e){let t=(0,a.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 s;t[3]===n?s=t[4]:(s=i(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:hover:text-foreground [&_a]:underline [&_a]:underline-offset-3`,n),t[3]=n,t[4]=s);let c;return t[5]!==r||t[6]!==s?(c=(0,o.jsx)(`div`,{"data-slot":`alert-title`,className:s,...r}),t[5]=r,t[6]=s,t[7]=c):c=t[7],c}function u(e){let t=(0,a.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 s;t[3]===n?s=t[4]:(s=i(`text-muted-foreground text-sm text-balance md:text-pretty [&_p:not(:last-child)]:mb-4 [&_a]:hover:text-foreground [&_a]:underline [&_a]:underline-offset-3`,n),t[3]=n,t[4]=s);let c;return t[5]!==r||t[6]!==s?(c=(0,o.jsx)(`div`,{"data-slot":`alert-description`,className:s,...r}),t[5]=r,t[6]=s,t[7]=c):c=t[7],c}export{u as n,l as r,c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./link-Cgvqhh5w.js";import{S as i,h as a,m as o,n as s,t as c,u as l}from"./useRouterState-DpT8luFk.js";import{a as u,i as d,n as f,s as p,t as m}from"./matchContext-CDajBC0L.js";var h=class{constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=u:this.parentRoute||i(!1,`Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`);let r=n?u:t?.path;r&&r!==`/`&&(r=o(r));let s=t?.id||r,c=n?u:l([this.parentRoute.id===`__root__`?``:this.parentRoute.id,s]);r===`__root__`&&(r=`/`),c!==`__root__`&&(c=l([`/`,c]));let d=c===`__root__`?`/`:l([this.parentRoute.fullPath,r]);this._path=r,this._id=c,this._fullPath=d,this._to=a(d)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>d({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}},g=class{constructor({id:e}){this.notFound=e=>p({routeId:this.id,...e}),this.redirect=e=>d({from:this.id,...e}),this.id=e}},_=class extends h{constructor(e){super(e)}},v=e(t(),1);function y(e){let t=v.useContext(e.from?m:f);return c({select:n=>{let r=n.matches.find(n=>e.from?e.from===n.routeId:n.id===t);if(i(!((e.shouldThrow??!0)&&!r),`Could not find ${e.from?`an active match from "${e.from}"`:`a nearest match!`}`),r!==void 0)return e.select?e.select(r):r},structuralSharing:e.structuralSharing})}function b(e){return y({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function x(e){let{select:t,...n}=e;return y({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function S(e){return y({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function C(e){return y({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function w(e){let t=s();return v.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}var T=n();function E(e){return new D({id:e})}var D=class extends g{constructor({id:e}){super({id:e}),this.useMatch=e=>y({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>y({from:this.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>C({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>S({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>x({...e,from:this.id,strict:!1}),this.useLoaderData=e=>b({...e,from:this.id,strict:!1}),this.useNavigate=()=>w({from:s().routesById[this.id].fullPath}),this.notFound=e=>p({routeId:this.id,...e}),this.Link=v.forwardRef((e,t)=>{let n=s().routesById[this.id].fullPath;return(0,T.jsx)(r,{ref:t,from:n,...e})})}},O=class extends h{constructor(e){super(e),this.useMatch=e=>y({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>y({...e,from:this.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>C({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>S({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>x({...e,from:this.id}),this.useLoaderData=e=>b({...e,from:this.id}),this.useNavigate=()=>w({from:this.fullPath}),this.Link=v.forwardRef((e,t)=>(0,T.jsx)(r,{ref:t,from:this.fullPath,...e})),this.$$typeof=Symbol.for(`react.memo`)}};function k(e){return new O(e)}function A(){return e=>M(e)}var j=class extends _{constructor(e){super(e),this.useMatch=e=>y({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>y({...e,from:this.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>C({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>S({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>x({...e,from:this.id}),this.useLoaderData=e=>b({...e,from:this.id}),this.useNavigate=()=>w({from:this.fullPath}),this.Link=v.forwardRef((e,t)=>(0,T.jsx)(r,{ref:t,from:this.fullPath,...e})),this.$$typeof=Symbol.for(`react.memo`)}};function M(e){return new j(e)}function N(){return typeof window>`u`?``:window.location.origin}function P(){return N()}export{E as a,S as c,y as d,k as i,x as l,N as n,w as o,A as r,C as s,P as t,b as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./api-base-url-DIb6qukm.js";var t=/^[\w!#$%&'*.^`|~+-]+$/,n=(e,n,r={})=>{if(!t.test(e))throw Error(`Invalid cookie name`);let i=`${e}=${n}`;if(e.startsWith(`__Secure-`)&&!r.secure)throw Error(`__Secure- Cookie must have Secure attributes`);if(e.startsWith(`__Host-`)){if(!r.secure)throw Error(`__Host- Cookie must have Secure attributes`);if(r.path!==`/`)throw Error(`__Host- Cookie must have Path attributes with "/"`);if(r.domain)throw Error(`__Host- Cookie must not have Domain attributes`)}for(let e of[`domain`,`path`])if(r[e]&&/[;\r\n]/.test(r[e]))throw Error(`${e} must not contain ";", "\\r", or "\\n"`);if(r&&typeof r.maxAge==`number`&&r.maxAge>=0){if(r.maxAge>3456e4)throw Error(`Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.`);i+=`; Max-Age=${r.maxAge|0}`}if(r.domain&&r.prefix!==`host`&&(i+=`; Domain=${r.domain}`),r.path&&(i+=`; Path=${r.path}`),r.expires){if(r.expires.getTime()-Date.now()>3456e7)throw Error(`Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.`);i+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(i+=`; HttpOnly`),r.secure&&(i+=`; Secure`),r.sameSite&&(i+=`; SameSite=${r.sameSite.charAt(0).toUpperCase()+r.sameSite.slice(1)}`),r.priority&&(i+=`; Priority=${r.priority.charAt(0).toUpperCase()+r.priority.slice(1)}`),r.partitioned){if(!r.secure)throw Error(`Partitioned Cookie must have Secure attributes`);i+=`; Partitioned`}return i},r=(e,t,r)=>(t=encodeURIComponent(t),n(e,t,r)),i=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),a=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??`);e=e.replace(t,r?`/${r}`:``)}return e},o=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.set(n,r);return t},s=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},c=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function l(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function u(e,t){if(!l(e)&&!l(t))return t;let n={...e};for(let e in t){let r=t[e];l(n[e])&&l(r)?n[e]=u(n[e],r):n[e]=r}return n}var d=(e,t)=>new Proxy(()=>{},{get(n,r){if(!(typeof r!=`string`||r===`then`))return d(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),f=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(e,t,n){this.url=e,this.method=t,this.buildSearchParams=n.buildSearchParams}fetch=async(e,t)=>{if(e){if(e.query&&(this.queryParams=this.buildSearchParams(e.query)),e.form){let t=new FormData;for(let[n,r]of Object.entries(e.form))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.append(n,r);this.rBody=t}e.json&&(this.rBody=JSON.stringify(e.json),this.cType=`application/json`),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase(),i={...e?.header,...typeof t?.headers==`function`?await t.headers():t?.headers};if(e?.cookie){let t=[];for(let[n,i]of Object.entries(e.cookie))t.push(r(n,i,{path:`/`}));i.Cookie=t.join(`,`)}this.cType&&(i[`Content-Type`]=this.cType);let o=new Headers(i??void 0),s=this.url;s=c(s),s=a(s,this.pathParams),this.queryParams&&(s=s+`?`+this.queryParams.toString()),n=this.method.toUpperCase();let l=!(n===`GET`||n===`HEAD`);return(t?.fetch||fetch)(s,{body:l?this.rBody:void 0,method:n,headers:o,...t?.init})}},p=(e,t)=>d(function n(r){let l=t?.buildSearchParams??o,d=[...r.path],p=d.slice(-3).reverse();if(p[0]===`toString`)return p[1]===`name`?p[2]||``:n.toString();if(p[0]===`valueOf`)return p[1]===`name`?p[2]||``:n;let m=``;if(/^\$/.test(p[0])){let e=d.pop();e&&(m=e.replace(/^\$/,``))}let h=i(e,d.join(`/`));if(m===`url`||m===`path`){let t=h;return r.args[0]&&(r.args[0].param&&(t=a(h,r.args[0].param)),r.args[0].query&&(t=t+`?`+l(r.args[0].query).toString())),t=c(t),m===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(m===`ws`){let e=s(r.args[0]&&r.args[0].param?a(h,r.args[0].param):h,`ws`),n=new URL(e),i=r.args[0]?.query;return i&&Object.entries(i).forEach(([e,t])=>{Array.isArray(t)?t.forEach(t=>n.searchParams.append(e,t)):n.searchParams.set(e,t)}),((...e)=>t?.webSocket!==void 0&&typeof t.webSocket==`function`?t.webSocket(...e):new WebSocket(...e))(n.toString())}let g=new f(h,m,{buildSearchParams:l});if(m){t??={};let e=u(t,{...r.args[1]});return g.fetch(r.args[0],e)}return g},[]);function m(e=``,t){return p(e,t)}function h(t=e(),n){return m(t,n)}export{h as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=`/api`,t=`${e}/auth/bootstrap-state`,n=`${e}/team/organizations`;function r(e,...t){return[n,e,...t].join(`/`)}export{t as n,r,e as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=RegExp(`^[A-Z0-9]{8}$`);function t(t){let n=t?.trim().replaceAll(`-`,``).toUpperCase();if(!(!n||!e.test(n)))return n}var n=128;function r(e){let t=e?.trim();if(t&&!(t.length>n||/\s/.test(t)))return t}var i=`/signin`,a=`/device`,o=`/auth/callback`,s=`/onboarding/connect-database`,c=`/invite/$invitationId`,l=`/$org_slug/home`;function u(e,n){let i=t(e);if(!i)return a;let o=new URLSearchParams({user_code:i}),s=r(n);return s&&o.set(`orgId`,s),`${a}?${o.toString()}`}function d(e){let t=r(e);return t?`${s}?${new URLSearchParams({orgId:t}).toString()}`:s}function f(e){return`/invite/${e}`}export{l as a,u as c,t as d,c as i,f as l,s as n,i as o,a as r,d as s,o as t,r as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,o as a}from"./api-base-url-DIb6qukm.js";import{n as o,r as s,t as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./IconArrowRight-DsOD7mDl.js";import{t as u}from"./IconChevronRight-DD16tNHZ.js";import{a as d,i as f,n as p,r as m,t as h}from"./select-BSubTgC3.js";import{t as g}from"./IconDatabase-BLZDgpcN.js";import{t as _}from"./IconHistory-k3NVXypq.js";import{t as v}from"./useQuery-Bj5cJCZc.js";import{t as y}from"./useSuspenseQuery-ZQGYM-g4.js";import{A as b,K as x,M as S,Y as C,a as w,i as T,j as E,n as D,o as O,r as k,t as A}from"./index-C_q-gtGv.js";import{t as j}from"./input-DSkIbIFK.js";import{n as M}from"./format-date-B5v-Ga9z.js";import{n as ee,r as N,t as te}from"./alert-TnJXtO0T.js";import{t as P}from"./badge-D8XKsDus.js";import{a as F,i as I,n as L,r as R,t as z}from"./empty-DjRo5ytz.js";import{t as B}from"./label-CUY3W2yp.js";import{a as V,i as H,n as U,o as W,r as G,t as K}from"./table-mA0t_uVk.js";var ne=c(`outline`,`arrow-left`,`ArrowLeft`,[[`path`,{d:`M5 12l14 0`,key:`svg-0`}],[`path`,{d:`M5 12l6 6`,key:`svg-1`}],[`path`,{d:`M5 12l6 -6`,key:`svg-2`}]]),re=c(`outline`,`clock`,`Clock`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0`,key:`svg-0`}],[`path`,{d:`M12 7v5l3 3`,key:`svg-1`}]]),q=c(`outline`,`list-details`,`ListDetails`,[[`path`,{d:`M13 5h8`,key:`svg-0`}],[`path`,{d:`M13 9h5`,key:`svg-1`}],[`path`,{d:`M13 15h8`,key:`svg-2`}],[`path`,{d:`M13 19h5`,key:`svg-3`}],[`path`,{d:`M3 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-4`}],[`path`,{d:`M3 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-5`}]]),ie=c(`outline`,`route`,`Route`,[[`path`,{d:`M3 19a2 2 0 1 0 4 0a2 2 0 0 0 -4 0`,key:`svg-0`}],[`path`,{d:`M19 7a2 2 0 1 0 0 -4a2 2 0 0 0 0 4`,key:`svg-1`}],[`path`,{d:`M11 19h5.5a3.5 3.5 0 0 0 0 -7h-8a3.5 3.5 0 0 1 0 -7h4.5`,key:`svg-2`}]]),ae=r(),oe=e(t(),1);function J(e){let t=e.trim();return t.length>0?t:void 0}function se(e){return{q:J(e.q),sourceKey:J(e.sourceKey)}}function ce(e){return{q:e.q??``,sourceKey:e.sourceKey??``}}function le(e){return`${e.q??``}\u0000${e.sourceKey??``}`}function ue(e,t){let n=se(t);return n.q!==e.q||n.sourceKey!==e.sourceKey}function de(e,t,n){return O({...e,...se(t),...n})}var Y=n(),X=i(`/_authenticated/$org_slug/audit`);function Z(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function Q(e,t=160){return e.length<=t?e:`${e.slice(0,t-1)}…`}function $(e){return e===`succeeded`?`secondary`:e===`pending`?`outline`:`destructive`}function fe(e){return e.originActor.email??`System`}function pe(e){return e.family===`query_action`?[e.metrics?.elapsedMs!==null&&e.metrics?.elapsedMs!==void 0?`${e.metrics.elapsedMs} ms`:null,e.metrics?.rowCount!==null&&e.metrics?.rowCount!==void 0?`${e.metrics.rowCount} rows`:null].filter(Boolean).join(` · `):[e.metrics?.pageCount!==null&&e.metrics?.pageCount!==void 0?`${e.metrics.pageCount} pages`:null,e.metrics?.httpStatus!==null&&e.metrics?.httpStatus!==void 0?`HTTP ${e.metrics.httpStatus}`:null].filter(Boolean).join(` · `)}function me(e){return e.family===`query_action`?Q(e.preview?.queryText??e.subtitle):Q([e.preview?.method,e.preview?.selector].filter(Boolean).join(` `)||e.subtitle)}function he(e){return e==null?`n/a`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function ge(e){return e.family===`query_action`?e.metrics?.elapsedMs?`${e.metrics.elapsedMs} ms`:`n/a`:e.metrics?.httpStatus?`HTTP ${e.metrics.httpStatus}`:`n/a`}function _e(e){return e.family===`query_action`?e.metrics?.rowCount!==null&&e.metrics?.rowCount!==void 0?`${e.metrics.rowCount.toLocaleString()} rows`:`n/a`:[e.metrics?.pageCount!==null&&e.metrics?.pageCount!==void 0?`${e.metrics.pageCount} pages`:null,he(e.metrics?.responseBytes)].filter(e=>e&&e!==`n/a`).join(` · `)}function ve(e){let t=(0,ae.c)(63),{isSelected:n,item:r,onSelect:i}=e,a;t[0]===r?a=t[1]:(a=pe(r),t[0]=r,t[1]=a);let o=a,s=n?`bg-muted/60 hover:bg-muted/60`:`hover:bg-muted/40`,c;t[2]===r.startedAt?c=t[3]:(c=M(r.startedAt),t[2]=r.startedAt,t[3]=c);let l;t[4]===c?l=t[5]:(l=(0,Y.jsx)(`div`,{className:`text-xs font-medium`,children:c}),t[4]=c,t[5]=l);let d;t[6]===r.originSurface?d=t[7]:(d=Z(r.originSurface),t[6]=r.originSurface,t[7]=d);let f;t[8]===d?f=t[9]:(f=(0,Y.jsx)(`div`,{className:`text-muted-foreground mt-1 text-xs`,children:d}),t[8]=d,t[9]=f);let p;t[10]!==l||t[11]!==f?(p=(0,Y.jsxs)(G,{className:`w-[132px] align-top`,children:[l,f]}),t[10]=l,t[11]=f,t[12]=p):p=t[12];let m;t[13]===r?m=t[14]:(m=fe(r),t[13]=r,t[14]=m);let h;t[15]===m?h=t[16]:(h=(0,Y.jsx)(`div`,{className:`max-w-[180px] truncate text-sm font-medium`,children:m}),t[15]=m,t[16]=h);let g;t[17]===r.target.sourceKey?g=t[18]:(g=(0,Y.jsx)(`div`,{className:`text-muted-foreground mt-1 text-xs`,children:r.target.sourceKey}),t[17]=r.target.sourceKey,t[18]=g);let _;t[19]!==g||t[20]!==h?(_=(0,Y.jsxs)(G,{className:`align-top whitespace-normal`,children:[h,g]}),t[19]=g,t[20]=h,t[21]=_):_=t[21];let v;t[22]===r.family?v=t[23]:(v=Z(r.family),t[22]=r.family,t[23]=v);let y;t[24]===v?y=t[25]:(y=(0,Y.jsx)(P,{variant:`outline`,children:v}),t[24]=v,t[25]=y);let b;t[26]===r.title?b=t[27]:(b=(0,Y.jsx)(`span`,{className:`text-sm font-medium`,children:r.title}),t[26]=r.title,t[27]=b);let x;t[28]!==y||t[29]!==b?(x=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[y,b]}),t[28]=y,t[29]=b,t[30]=x):x=t[30];let S;t[31]===r?S=t[32]:(S=me(r),t[31]=r,t[32]=S);let C;t[33]===S?C=t[34]:(C=(0,Y.jsx)(`div`,{className:`text-muted-foreground mt-2 text-xs font-mono break-words`,children:S}),t[33]=S,t[34]=C);let w;t[35]!==x||t[36]!==C?(w=(0,Y.jsxs)(G,{className:`min-w-[340px] align-top whitespace-normal`,children:[x,C]}),t[35]=x,t[36]=C,t[37]=w):w=t[37];let T;t[38]===r.outcome?T=t[39]:(T=$(r.outcome),t[38]=r.outcome,t[39]=T);let E;t[40]===r.outcome?E=t[41]:(E=Z(r.outcome),t[40]=r.outcome,t[41]=E);let D;t[42]!==T||t[43]!==E?(D=(0,Y.jsx)(P,{variant:T,children:E}),t[42]=T,t[43]=E,t[44]=D):D=t[44];let O;t[45]===r.phase?O=t[46]:(O=Z(r.phase),t[45]=r.phase,t[46]=O);let k;t[47]===O?k=t[48]:(k=(0,Y.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:O}),t[47]=O,t[48]=k);let A;t[49]===o?A=t[50]:(A=o?(0,Y.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:o}):null,t[49]=o,t[50]=A);let j;t[51]!==D||t[52]!==k||t[53]!==A?(j=(0,Y.jsx)(G,{className:`w-[132px] align-top whitespace-normal`,children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[D,k,A]})}),t[51]=D,t[52]=k,t[53]=A,t[54]=j):j=t[54];let ee;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Y.jsx)(G,{className:`w-8 align-top`,children:(0,Y.jsx)(u,{className:`text-muted-foreground size-4`})}),t[55]=ee):ee=t[55];let N;return t[56]!==i||t[57]!==_||t[58]!==w||t[59]!==s||t[60]!==j||t[61]!==p?(N=(0,Y.jsxs)(W,{className:s,onClick:i,children:[p,_,w,j,ee]}),t[56]=i,t[57]=_,t[58]=w,t[59]=s,t[60]=j,t[61]=p,t[62]=N):N=t[62],N}function ye(e){let t=(0,ae.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,Y.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Y.jsx)(`div`,{className:`mt-1 truncate text-sm font-medium`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Y.jsxs)(`div`,{className:`rounded-md border p-3`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function be(e){let t=(0,ae.c)(9),{title:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,Y.jsx)(`div`,{className:`border-b px-3 py-2 text-xs font-medium`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=typeof r==`string`?r:JSON.stringify(r,null,2),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,Y.jsx)(`pre`,{className:`max-h-44 overflow-auto p-3 text-xs`,children:a}),t[4]=a,t[5]=o);let s;return t[6]!==i||t[7]!==o?(s=(0,Y.jsxs)(`div`,{className:`rounded-md border`,children:[i,o]}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function xe(e){let t=(0,ae.c)(23),{item:n}=e,r;t[0]===n.outcome?r=t[1]:(r=$(n.outcome),t[0]=n.outcome,t[1]=r);let i;t[2]===n.outcome?i=t[3]:(i=Z(n.outcome),t[2]=n.outcome,t[3]=i);let a;t[4]!==r||t[5]!==i?(a=(0,Y.jsx)(P,{variant:r,children:i}),t[4]=r,t[5]=i,t[6]=a):a=t[6];let o;t[7]===n.family?o=t[8]:(o=(0,Y.jsx)(P,{variant:`outline`,children:n.family}),t[7]=n.family,t[8]=o);let s;t[9]!==a||t[10]!==o?(s=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a,o]}),t[9]=a,t[10]=o,t[11]=s):s=t[11];let c;t[12]===n.title?c=t[13]:(c=(0,Y.jsx)(`h2`,{className:`mt-3 text-xl font-semibold`,children:n.title}),t[12]=n.title,t[13]=c);let l;t[14]===n.subtitle?l=t[15]:(l=(0,Y.jsx)(`p`,{className:`text-muted-foreground mt-1 text-sm`,children:n.subtitle}),t[14]=n.subtitle,t[15]=l);let u;t[16]!==s||t[17]!==c||t[18]!==l?(u=(0,Y.jsxs)(`div`,{children:[s,c,l]}),t[16]=s,t[17]=c,t[18]=l,t[19]=u):u=t[19];let d;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Y.jsx)(`div`,{className:`rounded-md border p-4 text-sm`,children:`Loading full command and event trace…`}),t[20]=d):d=t[20];let f;return t[21]===u?f=t[22]:(f=(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[u,d]}),t[21]=u,t[22]=f),f}function Se(e){let t=(0,ae.c)(91),{detail:n,item:r}=e,i;t[0]===n.commands?i=t[1]:(i=n.commands.at(0),t[0]=n.commands,t[1]=i);let a=i,o;t[2]===n.events?o=t[3]:(o=n.events.at(-1),t[2]=n.events,t[3]=o);let s=o,c;t[4]===r.outcome?c=t[5]:(c=$(r.outcome),t[4]=r.outcome,t[5]=c);let l;t[6]===r.outcome?l=t[7]:(l=Z(r.outcome),t[6]=r.outcome,t[7]=l);let u;t[8]!==c||t[9]!==l?(u=(0,Y.jsx)(P,{variant:c,children:l}),t[8]=c,t[9]=l,t[10]=u):u=t[10];let d;t[11]===n.family?d=t[12]:(d=(0,Y.jsx)(P,{variant:`outline`,children:n.family}),t[11]=n.family,t[12]=d);let f;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Y.jsx)(P,{variant:`secondary`,children:`Projection caught up`}),t[13]=f):f=t[13];let p;t[14]!==u||t[15]!==d?(p=(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[u,d,f]}),t[14]=u,t[15]=d,t[16]=p):p=t[16];let m=n.family===`query_action`?`Query trace`:`API trace`,h;t[17]===m?h=t[18]:(h=(0,Y.jsx)(`h2`,{className:`mt-3 text-xl font-semibold`,children:m}),t[17]=m,t[18]=h);let g;t[19]===r.subtitle?g=t[20]:(g=(0,Y.jsx)(`p`,{className:`text-muted-foreground mt-1 text-sm`,children:r.subtitle}),t[19]=r.subtitle,t[20]=g);let _;t[21]!==h||t[22]!==g||t[23]!==p?(_=(0,Y.jsxs)(`div`,{children:[p,h,g]}),t[21]=h,t[22]=g,t[23]=p,t[24]=_):_=t[24];let v;t[25]===r?v=t[26]:(v=ge(r),t[25]=r,t[26]=v);let y;t[27]===v?y=t[28]:(y=(0,Y.jsx)(ye,{label:`Duration`,value:v}),t[27]=v,t[28]=y);let b;t[29]===r?b=t[30]:(b=_e(r)||`n/a`,t[29]=r,t[30]=b);let x;t[31]===b?x=t[32]:(x=(0,Y.jsx)(ye,{label:`Volume`,value:b}),t[31]=b,t[32]=x);let S;t[33]===r.target.sourceKey?S=t[34]:(S=(0,Y.jsx)(ye,{label:`Source`,value:r.target.sourceKey}),t[33]=r.target.sourceKey,t[34]=S);let C;t[35]===r?C=t[36]:(C=fe(r),t[35]=r,t[36]=C);let w;t[37]===C?w=t[38]:(w=(0,Y.jsx)(ye,{label:`Actor`,value:C}),t[37]=C,t[38]=w);let T;t[39]!==y||t[40]!==x||t[41]!==S||t[42]!==w?(T=(0,Y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 xl:grid-cols-4`,children:[y,x,S,w]}),t[39]=y,t[40]=x,t[41]=S,t[42]=w,t[43]=T):T=t[43];let E;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Y.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:`workflow_commands`}),t[44]=E):E=t[44];let D=a?.id??`No command recorded`,O;t[45]===D?O=t[46]:(O=(0,Y.jsx)(`div`,{className:`mt-1 font-mono text-xs break-all`,children:D}),t[45]=D,t[46]=O);let k=a?.requestId??`n/a`,A;t[47]===k?A=t[48]:(A=(0,Y.jsxs)(`div`,{className:`text-muted-foreground mt-2 text-xs`,children:[`Request `,k]}),t[47]=k,t[48]=A);let j;t[49]!==O||t[50]!==A?(j=(0,Y.jsxs)(`div`,{className:`rounded-md border p-3`,children:[E,O,A]}),t[49]=O,t[50]=A,t[51]=j):j=t[51];let M;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Y.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:`Last event`}),t[52]=M):M=t[52];let ee=s?.eventType??r.lastEventType,N;t[53]===ee?N=t[54]:(N=(0,Y.jsx)(`div`,{className:`mt-1 font-mono text-xs break-all`,children:ee}),t[53]=ee,t[54]=N);let te=s?.commitPosition??`n/a`,F;t[55]===te?F=t[56]:(F=(0,Y.jsxs)(`div`,{className:`text-muted-foreground mt-2 text-xs`,children:[`commit_position `,te]}),t[55]=te,t[56]=F);let I;t[57]!==N||t[58]!==F?(I=(0,Y.jsxs)(`div`,{className:`rounded-md border p-3`,children:[M,N,F]}),t[57]=N,t[58]=F,t[59]=I):I=t[59];let L;t[60]!==j||t[61]!==I?(L=(0,Y.jsxs)(`div`,{className:`grid gap-3 text-sm md:grid-cols-2`,children:[j,I]}),t[60]=j,t[61]=I,t[62]=L):L=t[62];let R;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Y.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-2`,children:[`Timeline`,`SQL`,`Payload`,`Metrics`,`Events`].map(Te)}),t[63]=R):R=t[63];let z;t[64]===n.events?z=t[65]:(z=n.events.map(we),t[64]=n.events,t[65]=z);let B;t[66]===z?B=t[67]:(B=(0,Y.jsxs)(`div`,{children:[R,(0,Y.jsx)(`div`,{className:`space-y-3`,children:z})]}),t[66]=z,t[67]=B);let V;t[68]!==n.action.pageProgress||t[69]!==n.action.queryText||t[70]!==n.action.requestDescriptor||t[71]!==n.action.sourceDescriptor||t[72]!==n.action.validatedQuery||t[73]!==n.family?(V=n.family===`query_action`?(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsx)(be,{title:`query_text`,value:n.action.queryText}),(0,Y.jsx)(be,{title:`validated_query`,value:n.action.validatedQuery??`No validated query recorded`}),(0,Y.jsx)(be,{title:`source_descriptor_json`,value:n.action.sourceDescriptor})]}):(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsx)(be,{title:`request_descriptor_json`,value:n.action.requestDescriptor}),(0,Y.jsx)(be,{title:`page_progress_json`,value:n.action.pageProgress}),(0,Y.jsx)(be,{title:`source_descriptor_json`,value:n.action.sourceDescriptor})]}),t[68]=n.action.pageProgress,t[69]=n.action.queryText,t[70]=n.action.requestDescriptor,t[71]=n.action.sourceDescriptor,t[72]=n.action.validatedQuery,t[73]=n.family,t[74]=V):V=t[74];let H=a?.decodedPayload??null,U;t[75]===H?U=t[76]:(U=(0,Y.jsx)(be,{title:`command_payload_json`,value:H}),t[75]=H,t[76]=U);let W;t[77]===n.events?W=t[78]:(W=n.events.map(Ce),t[77]=n.events,t[78]=W);let G;t[79]===W?G=t[80]:(G=(0,Y.jsx)(be,{title:`event_payloads_json`,value:W}),t[79]=W,t[80]=G);let K;t[81]!==U||t[82]!==G?(K=(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[U,G]}),t[81]=U,t[82]=G,t[83]=K):K=t[83];let ne;return t[84]!==_||t[85]!==T||t[86]!==L||t[87]!==B||t[88]!==V||t[89]!==K?(ne=(0,Y.jsxs)(`div`,{className:`space-y-5`,children:[_,T,L,B,V,K]}),t[84]=_,t[85]=T,t[86]=L,t[87]=B,t[88]=V,t[89]=K,t[90]=ne):ne=t[90],ne}function Ce(e){return{commandId:e.commandId,eventType:e.eventType,id:e.id,payload:e.decodedPayload,sequence:e.sequence}}function we(e){return(0,Y.jsxs)(`div`,{className:`grid grid-cols-[32px_minmax(0,1fr)] gap-3 rounded-md border p-3`,children:[(0,Y.jsx)(`div`,{className:`bg-muted flex size-8 items-center justify-center rounded-full text-xs font-medium`,children:e.sequence}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:Z(e.eventType)}),(0,Y.jsxs)(P,{variant:`outline`,children:[`commit_position `,e.commitPosition]}),(0,Y.jsx)(P,{variant:`outline`,children:he(e.payload.byteLength)})]}),(0,Y.jsxs)(`div`,{className:`text-muted-foreground mt-1 text-xs`,children:[M(e.occurredAt),` · command `,e.commandId]})]})]},e.id)}function Te(e,t){return(0,Y.jsx)(o,{type:`button`,variant:t===0?`secondary`:`outline`,size:`sm`,children:e},e)}function Ee(e){return e.length===0?``:e.length===1?e[0]??``:`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`}function De(e,t){return(e.family?[e.family]:k).filter(e=>e===`query_action`?t.queryAction:t.sourceApiAction).map(Z)}function Oe(e){let t=(0,ae.c)(112),{isFetching:n,itemCount:r,nextCursor:i,onRefresh:c,organizationSlug:u,projectionLag:g,search:_}=e,v=a(),y;t[0]===_?y=t[1]:(y=()=>ce(_),t[0]=_,t[1]=y);let[D,O]=(0,oe.useState)(y),A;t[2]!==D||t[3]!==_?(A=ue(_,D),t[2]=D,t[3]=_,t[4]=A):A=t[4];let M=A,P,F,I,L;if(t[5]!==D||t[6]!==M||t[7]!==v||t[8]!==u||t[9]!==g||t[10]!==_){let e=w(_.family),n=De(_,g),r;t[15]!==D||t[16]!==v||t[17]!==u||t[18]!==_?(r=function(e){(0,oe.startTransition)(()=>{v({params:{org_slug:u},replace:!0,search:de(_,D,e),to:`/$org_slug/audit`})})},t[15]=D,t[16]=v,t[17]=u,t[18]=_,t[19]=r):r=t[19],P=r;let i;t[20]===P?i=t[21]:(i=function(e){e.preventDefault(),P({cursor:void 0})},t[20]=P,t[21]=i);let a=i,s;t[22]!==v||t[23]!==u||t[24]!==_.limit?(s=function(){O({q:``,sourceKey:``}),(0,oe.startTransition)(()=>{v({params:{org_slug:u},replace:!0,search:{actionName:void 0,cursor:void 0,family:void 0,limit:_.limit,outcome:void 0,q:void 0,sourceKey:void 0},to:`/$org_slug/audit`})})},t[22]=v,t[23]=u,t[24]=_.limit,t[25]=s):s=t[25];let c=s;F=`rounded-xl border p-4`;let l;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(B,{htmlFor:`audit-search`,children:`Search`}),t[26]=l):l=t[26];let y;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>O(t=>({...t,q:e.target.value})),t[27]=y):y=t[27];let b;t[28]===D.q?b=t[29]:(b=(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[l,(0,Y.jsx)(j,{id:`audit-search`,value:D.q,onChange:y,placeholder:`Actor, query text, operation, or title`})]}),t[28]=D.q,t[29]=b);let x;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Y.jsx)(B,{htmlFor:`audit-source-key`,children:`Source Key`}),t[30]=x):x=t[30];let S;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>O(t=>({...t,sourceKey:e.target.value})),t[31]=S):S=t[31];let E;t[32]===D.sourceKey?E=t[33]:(E=(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[x,(0,Y.jsx)(j,{id:`audit-source-key`,value:D.sourceKey,onChange:S,placeholder:`warehouse`})]}),t[32]=D.sourceKey,t[33]=E);let A;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Y.jsx)(B,{htmlFor:`audit-outcome`,children:`Outcome`}),t[34]=A):A=t[34];let R=_.outcome??`all`,z;t[35]===P?z=t[36]:(z=e=>{P({cursor:void 0,outcome:e&&e!==`all`?e:void 0})},t[35]=P,t[36]=z);let V;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Y.jsx)(f,{id:`audit-outcome`,className:`w-full`,children:(0,Y.jsx)(d,{})}),t[37]=V):V=t[37];let H;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Y.jsxs)(p,{children:[(0,Y.jsx)(m,{value:`all`,children:`All outcomes`}),T.map(je)]}),t[38]=H):H=t[38];let U;t[39]!==R||t[40]!==z?(U=(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[A,(0,Y.jsxs)(h,{value:R,onValueChange:z,children:[V,H]})]}),t[39]=R,t[40]=z,t[41]=U):U=t[41];let W;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Y.jsx)(B,{htmlFor:`audit-family`,children:`Family`}),t[42]=W):W=t[42];let G=_.family??`all`,K;t[43]===P?K=t[44]:(K=e=>{P({cursor:void 0,family:e&&e!==`all`?e:void 0})},t[43]=P,t[44]=K);let ne;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Y.jsx)(f,{id:`audit-family`,className:`w-full`,children:(0,Y.jsx)(d,{})}),t[45]=ne):ne=t[45];let re;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Y.jsxs)(p,{children:[(0,Y.jsx)(m,{value:`all`,children:`All families`}),k.map(Ae)]}),t[46]=re):re=t[46];let q;t[47]!==G||t[48]!==K?(q=(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[W,(0,Y.jsxs)(h,{value:G,onValueChange:K,children:[ne,re]})]}),t[47]=G,t[48]=K,t[49]=q):q=t[49];let ie;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Y.jsx)(B,{htmlFor:`audit-action-name`,children:`Action`}),t[50]=ie):ie=t[50];let ae=_.actionName??`all`,J;t[51]===P?J=t[52]:(J=e=>{P({actionName:e&&e!==`all`?e:void 0,cursor:void 0})},t[51]=P,t[52]=J);let se;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Y.jsx)(f,{id:`audit-action-name`,className:`w-full`,children:(0,Y.jsx)(d,{})}),t[53]=se):se=t[53];let ce;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Y.jsx)(m,{value:`all`,children:`All actions`}),t[54]=ce):ce=t[54];let le=e.map(ke),ue;t[55]===le?ue=t[56]:(ue=(0,Y.jsxs)(p,{children:[ce,le]}),t[55]=le,t[56]=ue);let X;t[57]!==ae||t[58]!==J||t[59]!==ue?(X=(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[ie,(0,Y.jsxs)(h,{value:ae,onValueChange:J,children:[se,ue]})]}),t[57]=ae,t[58]=J,t[59]=ue,t[60]=X):X=t[60];let Z=!M,Q;t[61]===Z?Q=t[62]:(Q=(0,Y.jsx)(`div`,{className:`flex items-end`,children:(0,Y.jsx)(o,{type:`submit`,className:`w-full lg:w-auto`,disabled:Z,children:`Apply`})}),t[61]=Z,t[62]=Q);let $;t[63]===c?$=t[64]:($=(0,Y.jsx)(`div`,{className:`flex items-end`,children:(0,Y.jsx)(o,{type:`button`,variant:`ghost`,className:`w-full lg:w-auto`,onClick:c,children:`Clear`})}),t[63]=c,t[64]=$),t[65]!==a||t[66]!==b||t[67]!==E||t[68]!==U||t[69]!==q||t[70]!==X||t[71]!==Q||t[72]!==$?(I=(0,Y.jsxs)(`form`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1.2fr)_minmax(0,0.8fr)_180px_180px_180px_auto_auto]`,onSubmit:a,children:[b,E,U,q,X,Q,$]}),t[65]=a,t[66]=b,t[67]=E,t[68]=U,t[69]=q,t[70]=X,t[71]=Q,t[72]=$,t[73]=I):I=t[73],L=n.length>0?(0,Y.jsxs)(te,{className:`mt-4 border-amber-300/60 bg-amber-50/80 text-amber-950`,children:[(0,Y.jsx)(C,{className:`size-4`}),(0,Y.jsx)(N,{children:`Audit feed is still catching up`}),(0,Y.jsxs)(ee,{children:[`Recent `,Ee(n),` events may not appear yet. This page will refresh while the feed catches up.`]})]}):null,t[5]=D,t[6]=M,t[7]=v,t[8]=u,t[9]=g,t[10]=_,t[11]=P,t[12]=F,t[13]=I,t[14]=L}else P=t[11],F=t[12],I=t[13],L=t[14];let R=_.cursor?` · viewing older results`:` · newest first`,z=M?` · apply search filters to paginate`:``,V=n?` · updating`:``,H;t[74]!==r||t[75]!==R||t[76]!==z||t[77]!==V?(H=(0,Y.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[r,` entries on this page`,R,z,V]}),t[74]=r,t[75]=R,t[76]=z,t[77]=V,t[78]=H):H=t[78];let U;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(U=s({size:`icon`,variant:`outline`}),t[79]=U):U=t[79];let W=n?`animate-spin`:void 0,G;t[80]===W?G=t[81]:(G=(0,Y.jsx)(x,{className:W,size:16,stroke:2}),t[80]=W,t[81]=G);let K;t[82]!==n||t[83]!==c||t[84]!==G?(K=(0,Y.jsx)(S,{"aria-label":`Refresh audit feed`,className:U,disabled:n,onClick:c,type:`button`,children:G}),t[82]=n,t[83]=c,t[84]=G,t[85]=K):K=t[85];let re;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Y.jsx)(E,{children:`Refresh audit feed`}),t[86]=re):re=t[86];let q;t[87]===K?q=t[88]:(q=(0,Y.jsxs)(b,{children:[K,re]}),t[87]=K,t[88]=q);let ie;t[89]!==P||t[90]!==_.cursor?(ie=_.cursor?(0,Y.jsxs)(o,{type:`button`,variant:`outline`,onClick:()=>P({cursor:void 0}),children:[(0,Y.jsx)(ne,{size:16,stroke:2}),`Newest`]}):null,t[89]=P,t[90]=_.cursor,t[91]=ie):ie=t[91];let J;t[92]!==M||t[93]!==P||t[94]!==i?(J=()=>{!i||M||P({cursor:i})},t[92]=M,t[93]=P,t[94]=i,t[95]=J):J=t[95];let se=!i||M,le;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,Y.jsx)(l,{size:16,stroke:2}),t[96]=le):le=t[96];let X;t[97]!==J||t[98]!==se?(X=(0,Y.jsxs)(o,{type:`button`,variant:`outline`,onClick:J,disabled:se,children:[`Older`,le]}),t[97]=J,t[98]=se,t[99]=X):X=t[99];let Z;t[100]!==q||t[101]!==ie||t[102]!==X?(Z=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[q,ie,X]}),t[100]=q,t[101]=ie,t[102]=X,t[103]=Z):Z=t[103];let Q;t[104]!==Z||t[105]!==H?(Q=(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[H,Z]}),t[104]=Z,t[105]=H,t[106]=Q):Q=t[106];let $;return t[107]!==Q||t[108]!==F||t[109]!==I||t[110]!==L?($=(0,Y.jsxs)(`section`,{className:F,children:[I,L,Q]}),t[107]=Q,t[108]=F,t[109]=I,t[110]=L,t[111]=$):$=t[111],$}function ke(e){return(0,Y.jsx)(m,{value:e,children:Z(e)},e)}function Ae(e){return(0,Y.jsx)(m,{value:e,children:Z(e)},e)}function je(e){return(0,Y.jsx)(m,{value:e,children:Z(e)},e)}function Me(){let e=(0,ae.c)(39),{organizationSlug:t,session:n}=X.useRouteContext(),r=X.useSearch(),i;e[0]!==t||e[1]!==r||e[2]!==n.user.id?(i=D(n.user.id,t,r),e[0]=t,e[1]=r,e[2]=n.user.id,e[3]=i):i=e[3];let{data:a,isFetching:o,refetch:s}=y(i),c;e[4]===a.items[0]?.id?c=e[5]:(c=()=>a.items[0]?.id??null,e[4]=a.items[0]?.id,e[5]=c);let[l,u]=(0,oe.useState)(c),d;e[6]!==a.items||e[7]!==l?(d=a.items.find(e=>e.id===l)??a.items[0]??null,e[6]=a.items,e[7]=l,e[8]=d):d=e[8];let f=d,p=f?.family??`query_action`,m=f?.familyActionId??`__none__`,h;e[9]!==t||e[10]!==m||e[11]!==p||e[12]!==n.user.id?(h=A(n.user.id,t,p,m),e[9]=t,e[10]=m,e[11]=p,e[12]=n.user.id,e[13]=h):h=e[13];let b=f!==null,x;e[14]!==h||e[15]!==b?(x={...h,enabled:b},e[14]=h,e[15]=b,e[16]=x):x=e[16];let S=v(x),w;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h1`,{className:`text-3xl font-bold`,children:`Audit`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground mt-2`,children:`Trace query and source API workflows from command intake through raw events, payloads, metrics, and projection state.`})]}),e[17]=w):w=e[17];let T;e[18]===r?T=e[19]:(T=le(r),e[18]=r,e[19]=T);let E;e[20]===s?E=e[21]:(E=()=>{s()},e[20]=s,e[21]=E);let O;e[22]!==a.items.length||e[23]!==a.nextCursor||e[24]!==a.projectionLag||e[25]!==o||e[26]!==t||e[27]!==r||e[28]!==T||e[29]!==E?(O=(0,Y.jsx)(Oe,{isFetching:o,itemCount:a.items.length,nextCursor:a.nextCursor,onRefresh:E,organizationSlug:t,projectionLag:a.projectionLag,search:r},T),e[22]=a.items.length,e[23]=a.nextCursor,e[24]=a.projectionLag,e[25]=o,e[26]=t,e[27]=r,e[28]=T,e[29]=E,e[30]=O):O=e[30];let k;e[31]!==a.items||e[32]!==a.projectedThrough||e[33]!==S||e[34]!==f?(k=a.items.length===0?(0,Y.jsx)(z,{className:`border`,children:(0,Y.jsxs)(R,{children:[(0,Y.jsx)(I,{variant:`icon`,children:(0,Y.jsx)(_,{size:18,stroke:1.75})}),(0,Y.jsx)(F,{children:`No audit entries matched these filters`}),(0,Y.jsx)(L,{children:`Try clearing the filters or waiting for new workflow activity in this organization.`})]})}):(0,Y.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1.05fr)_minmax(440px,0.95fr)]`,children:[(0,Y.jsxs)(`section`,{className:`min-w-0 rounded-md border`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between border-b px-4 py-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`font-semibold`,children:`Trace feed`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Newest audited actions with source, actor, status, and shape.`})]}),(0,Y.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 text-xs`,children:[(0,Y.jsx)(q,{size:16,stroke:1.75}),a.projectedThrough.queryAction||a.projectedThrough.sourceApiAction?`Projection caught up`:`Projection pending`]})]}),(0,Y.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Y.jsxs)(K,{children:[(0,Y.jsx)(V,{children:(0,Y.jsxs)(W,{children:[(0,Y.jsx)(H,{children:`When`}),(0,Y.jsx)(H,{children:`Actor / source`}),(0,Y.jsx)(H,{children:`Activity`}),(0,Y.jsx)(H,{children:`Status`}),(0,Y.jsx)(H,{})]})}),(0,Y.jsx)(U,{children:a.items.map(e=>(0,Y.jsx)(ve,{isSelected:f?.id===e.id,item:e,onSelect:()=>u(e.id)},e.id))})]})})]}),(0,Y.jsxs)(`aside`,{className:`min-w-0 rounded-md border`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between border-b px-4 py-3`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h2`,{className:`font-semibold`,children:`Trace detail`}),(0,Y.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Commands, event log, payload bytes, and action fold state.`})]}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(ie,{className:`text-muted-foreground size-4`}),(0,Y.jsx)(g,{className:`text-muted-foreground size-4`}),(0,Y.jsx)(re,{className:`text-muted-foreground size-4`})]})]}),(0,Y.jsxs)(`div`,{className:`max-h-[calc(100vh-220px)] overflow-auto p-4`,children:[f&&S.isPending?(0,Y.jsx)(xe,{item:f}):null,f&&S.isError?(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(xe,{item:f}),(0,Y.jsxs)(te,{variant:`destructive`,children:[(0,Y.jsx)(C,{className:`size-4`}),(0,Y.jsx)(N,{children:`Failed to load trace detail`}),(0,Y.jsx)(ee,{children:S.error.message})]})]}):null,f&&S.data?(0,Y.jsx)(Se,{detail:S.data,item:f}):null]})]})]}),e[31]=a.items,e[32]=a.projectedThrough,e[33]=S,e[34]=f,e[35]=k):k=e[35];let j;return e[36]!==k||e[37]!==O?(j=(0,Y.jsxs)(`div`,{className:`space-y-8 p-8`,children:[w,O,k]}),e[36]=k,e[37]=O,e[38]=j):j=e[38],j}var Ne=Me;export{Ne as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./api-base-url-DIb6qukm.js";import{t}from"./queryOptions-LX_zDC40.js";import{a as n}from"./query-timing-C8VVOl1e.js";import{i as r,n as i,u as a}from"./schemas-K0ZhTj23.js";import{n as o}from"./api-paths-DcYkf-C_.js";var s=a({emailDeliveryMode:i([`manual-link`,`smtp`]),hasUsers:r(),publicSignupAllowed:r(),signupMode:i([`first-user`,`invite-only`])});async function c(){let t=await fetch(`${e()}${o}`,{credentials:`include`});if(!t.ok)throw Error(`Failed to load auth bootstrap state`);let n=await t.json().catch(()=>null);return s.parse(n)}function l(){return t({queryFn:c,queryKey:[`auth`,`bootstrap-state`],staleTime:n})}export{l as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e,n as t}from"./jsx-runtime-DG_AJzB_.js";import{t as n}from"./api-base-url-DIb6qukm.js";function r(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{code:e,message:t,toString:()=>e}]))}r({FAILED_TO_CREATE_USER:`Failed to create user`,USER_ALREADY_EXISTS:`User already exists.`,USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:`User already exists. Use another email.`,YOU_CANNOT_BAN_YOURSELF:`You cannot ban yourself`,YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE:`You are not allowed to change users role`,YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS:`You are not allowed to create users`,YOU_ARE_NOT_ALLOWED_TO_LIST_USERS:`You are not allowed to list users`,YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS:`You are not allowed to list users sessions`,YOU_ARE_NOT_ALLOWED_TO_BAN_USERS:`You are not allowed to ban users`,YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS:`You are not allowed to impersonate users`,YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS:`You are not allowed to revoke users sessions`,YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS:`You are not allowed to delete users`,YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD:`You are not allowed to set users password`,BANNED_USER:`You have been banned from this application`,YOU_ARE_NOT_ALLOWED_TO_GET_USER:`You are not allowed to get user`,NO_DATA_TO_UPDATE:`No data to update`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS:`You are not allowed to update users`,YOU_CANNOT_REMOVE_YOURSELF:`You cannot remove yourself`,YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE:`You are not allowed to set a non-existent role value`,YOU_CANNOT_IMPERSONATE_ADMINS:`You cannot impersonate admins`,INVALID_ROLE_TYPE:`Invalid role type`}),r({USER_NOT_FOUND:`User not found`,FAILED_TO_CREATE_USER:`Failed to create user`,FAILED_TO_CREATE_SESSION:`Failed to create session`,FAILED_TO_UPDATE_USER:`Failed to update user`,FAILED_TO_GET_SESSION:`Failed to get session`,INVALID_PASSWORD:`Invalid password`,INVALID_EMAIL:`Invalid email`,INVALID_EMAIL_OR_PASSWORD:`Invalid email or password`,INVALID_USER:`Invalid user`,SOCIAL_ACCOUNT_ALREADY_LINKED:`Social account already linked`,PROVIDER_NOT_FOUND:`Provider not found`,INVALID_TOKEN:`Invalid token`,TOKEN_EXPIRED:`Token expired`,ID_TOKEN_NOT_SUPPORTED:`id_token not supported`,FAILED_TO_GET_USER_INFO:`Failed to get user info`,USER_EMAIL_NOT_FOUND:`User email not found`,EMAIL_NOT_VERIFIED:`Email not verified`,PASSWORD_TOO_SHORT:`Password too short`,PASSWORD_TOO_LONG:`Password too long`,USER_ALREADY_EXISTS:`User already exists.`,USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:`User already exists. Use another email.`,EMAIL_CAN_NOT_BE_UPDATED:`Email can not be updated`,CREDENTIAL_ACCOUNT_NOT_FOUND:`Credential account not found`,SESSION_EXPIRED:`Session expired. Re-authenticate to perform this action.`,FAILED_TO_UNLINK_LAST_ACCOUNT:`You can't unlink your last account`,ACCOUNT_NOT_FOUND:`Account not found`,USER_ALREADY_HAS_PASSWORD:`User already has a password. Provide that to delete the account.`,CROSS_SITE_NAVIGATION_LOGIN_BLOCKED:`Cross-site navigation login blocked. This request appears to be a CSRF attack.`,VERIFICATION_EMAIL_NOT_ENABLED:`Verification email isn't enabled`,EMAIL_ALREADY_VERIFIED:`Email is already verified`,EMAIL_MISMATCH:`Email mismatch`,SESSION_NOT_FRESH:`Session is not fresh`,LINKED_ACCOUNT_ALREADY_EXISTS:`Linked account already exists`,INVALID_ORIGIN:`Invalid origin`,INVALID_CALLBACK_URL:`Invalid callbackURL`,INVALID_REDIRECT_URL:`Invalid redirectURL`,INVALID_ERROR_CALLBACK_URL:`Invalid errorCallbackURL`,INVALID_NEW_USER_CALLBACK_URL:`Invalid newUserCallbackURL`,MISSING_OR_NULL_ORIGIN:`Missing or null Origin`,CALLBACK_URL_REQUIRED:`callbackURL is required`,FAILED_TO_CREATE_VERIFICATION:`Unable to create verification`,FIELD_NOT_ALLOWED:`Field not allowed to be set`,ASYNC_VALIDATION_NOT_SUPPORTED:`Async validation is not supported`,VALIDATION_ERROR:`Validation Error`,MISSING_FIELD:`Field is required`,METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED:`POST method requires deferSessionRefresh to be enabled in session config`,BODY_MUST_BE_AN_OBJECT:`Body must be an object`,PASSWORD_ALREADY_SET:`User already has a password set`});function i(){let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,`writable`)?e.writable:e.set!==void 0}function a(e){let t=e.split(`
|
|
2
|
+
at `);return t.length<=1?e:(t.splice(1,1),t.join(`
|
|
3
|
+
at `))}function o(e,t){class n extends e{#e;constructor(...e){if(i()){let t=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...e),Error.stackTraceLimit=t}else super(...e);let t=Error().stack;t&&(this.#e=a(t.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(n.prototype,`constructor`,{get(){return t},enumerable:!1,configurable:!0}),n}var s={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511};o(class extends Error{constructor(e=`INTERNAL_SERVER_ERROR`,t=void 0,n={},r=typeof e==`number`?e:s[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=n,this.statusCode=r,this.name=`APIError`,this.status=e,this.headers=n,this.statusCode=r,this.body=t}},Error);var c=class extends Error{constructor(e,t){super(e,t),this.name=`BetterAuthError`,this.message=e,this.stack=``}};function l(e){return{authorize(t,n=`AND`){let r=!1;for(let[i,a]of Object.entries(t)){let t=e[i];if(!t)return{success:!1,error:`You are not allowed to access resource: ${i}`};if(Array.isArray(a))r=a.every(e=>t.includes(e));else if(typeof a==`object`){let e=a;r=e.connector===`OR`?e.actions.some(e=>t.includes(e)):e.actions.every(e=>t.includes(e))}else throw new c(`Invalid access control request`);if(r&&n===`OR`)return{success:r};if(!r&&n===`AND`)return{success:!1,error:`unauthorized to access resource "${i}"`}}return r?{success:r}:{success:!1,error:`Not authorized`}},statements:e}}function u(e){return{newRole(e){return l(e)},statements:e}}var d=u({user:[`create`,`list`,`set-role`,`ban`,`impersonate`,`impersonate-admins`,`delete`,`set-password`,`get`,`update`],session:[`list`,`revoke`,`delete`]});d.newRole({user:[`create`,`list`,`set-role`,`ban`,`impersonate`,`delete`,`set-password`,`get`,`update`],session:[`list`,`revoke`,`delete`]}),d.newRole({user:[],session:[]}),r({INVALID_EMAIL_FORMAT:`Email was not generated in a valid format`,FAILED_TO_CREATE_USER:`Failed to create user`,COULD_NOT_CREATE_SESSION:`Could not create session`,ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY:`Anonymous users cannot sign in again anonymously`,FAILED_TO_DELETE_ANONYMOUS_USER:`Failed to delete anonymous user`,USER_IS_NOT_ANONYMOUS:`User is not anonymous`,DELETE_ANONYMOUS_USER_DISABLED:`Deleting anonymous users is disabled`}),r({OTP_EXPIRED:`OTP expired`,INVALID_OTP:`Invalid OTP`,TOO_MANY_ATTEMPTS:`Too many attempts`}),r({INVALID_OAUTH_CONFIGURATION:`Invalid OAuth configuration`,TOKEN_URL_NOT_FOUND:`Invalid OAuth configuration. Token URL not found.`,PROVIDER_CONFIG_NOT_FOUND:`No config found for provider`,PROVIDER_ID_REQUIRED:`Provider ID is required`,INVALID_OAUTH_CONFIG:`Invalid OAuth configuration.`,SESSION_REQUIRED:`Session is required`,ISSUER_MISMATCH:`OAuth issuer mismatch. The authorization server issuer does not match the expected value (RFC 9207).`,ISSUER_MISSING:`OAuth issuer parameter missing. The authorization server did not include the required iss parameter (RFC 9207).`}),r({INVALID_SESSION_TOKEN:`Invalid session token`});var f=r({YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_ORGANIZATION:`You are not allowed to create a new organization`,YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_ORGANIZATIONS:`You have reached the maximum number of organizations`,ORGANIZATION_ALREADY_EXISTS:`Organization already exists`,ORGANIZATION_SLUG_ALREADY_TAKEN:`Organization slug already taken`,ORGANIZATION_NOT_FOUND:`Organization not found`,USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION:`User is not a member of the organization`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION:`You are not allowed to update this organization`,YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_ORGANIZATION:`You are not allowed to delete this organization`,NO_ACTIVE_ORGANIZATION:`No active organization`,USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION:`User is already a member of this organization`,MEMBER_NOT_FOUND:`Member not found`,ROLE_NOT_FOUND:`Role not found`,YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM:`You are not allowed to create a new team`,TEAM_ALREADY_EXISTS:`Team already exists`,TEAM_NOT_FOUND:`Team not found`,YOU_CANNOT_LEAVE_THE_ORGANIZATION_AS_THE_ONLY_OWNER:`You cannot leave the organization as the only owner`,YOU_CANNOT_LEAVE_THE_ORGANIZATION_WITHOUT_AN_OWNER:`You cannot leave the organization without an owner`,YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_MEMBER:`You are not allowed to delete this member`,YOU_ARE_NOT_ALLOWED_TO_INVITE_USERS_TO_THIS_ORGANIZATION:`You are not allowed to invite users to this organization`,USER_IS_ALREADY_INVITED_TO_THIS_ORGANIZATION:`User is already invited to this organization`,INVITATION_NOT_FOUND:`Invitation not found`,YOU_ARE_NOT_THE_RECIPIENT_OF_THE_INVITATION:`You are not the recipient of the invitation`,EMAIL_VERIFICATION_REQUIRED_BEFORE_ACCEPTING_OR_REJECTING_INVITATION:`Email verification required before accepting or rejecting invitation`,YOU_ARE_NOT_ALLOWED_TO_CANCEL_THIS_INVITATION:`You are not allowed to cancel this invitation`,INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION:`Inviter is no longer a member of the organization`,YOU_ARE_NOT_ALLOWED_TO_INVITE_USER_WITH_THIS_ROLE:`You are not allowed to invite a user with this role`,FAILED_TO_RETRIEVE_INVITATION:`Failed to retrieve invitation`,YOU_HAVE_REACHED_THE_MAXIMUM_NUMBER_OF_TEAMS:`You have reached the maximum number of teams`,UNABLE_TO_REMOVE_LAST_TEAM:`Unable to remove last team`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_MEMBER:`You are not allowed to update this member`,ORGANIZATION_MEMBERSHIP_LIMIT_REACHED:`Organization membership limit reached`,YOU_ARE_NOT_ALLOWED_TO_CREATE_TEAMS_IN_THIS_ORGANIZATION:`You are not allowed to create teams in this organization`,YOU_ARE_NOT_ALLOWED_TO_DELETE_TEAMS_IN_THIS_ORGANIZATION:`You are not allowed to delete teams in this organization`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_TEAM:`You are not allowed to update this team`,YOU_ARE_NOT_ALLOWED_TO_DELETE_THIS_TEAM:`You are not allowed to delete this team`,INVITATION_LIMIT_REACHED:`Invitation limit reached`,TEAM_MEMBER_LIMIT_REACHED:`Team member limit reached`,USER_IS_NOT_A_MEMBER_OF_THE_TEAM:`User is not a member of the team`,YOU_CAN_NOT_ACCESS_THE_MEMBERS_OF_THIS_TEAM:`You are not allowed to list the members of this team`,YOU_DO_NOT_HAVE_AN_ACTIVE_TEAM:`You do not have an active team`,YOU_ARE_NOT_ALLOWED_TO_CREATE_A_NEW_TEAM_MEMBER:`You are not allowed to create a new member`,YOU_ARE_NOT_ALLOWED_TO_REMOVE_A_TEAM_MEMBER:`You are not allowed to remove a team member`,YOU_ARE_NOT_ALLOWED_TO_ACCESS_THIS_ORGANIZATION:`You are not allowed to access this organization as an owner`,YOU_ARE_NOT_A_MEMBER_OF_THIS_ORGANIZATION:`You are not a member of this organization`,MISSING_AC_INSTANCE:`Dynamic Access Control requires a pre-defined ac instance on the server auth plugin. Read server logs for more information`,YOU_MUST_BE_IN_AN_ORGANIZATION_TO_CREATE_A_ROLE:`You must be in an organization to create a role`,YOU_ARE_NOT_ALLOWED_TO_CREATE_A_ROLE:`You are not allowed to create a role`,YOU_ARE_NOT_ALLOWED_TO_UPDATE_A_ROLE:`You are not allowed to update a role`,YOU_ARE_NOT_ALLOWED_TO_DELETE_A_ROLE:`You are not allowed to delete a role`,YOU_ARE_NOT_ALLOWED_TO_READ_A_ROLE:`You are not allowed to read a role`,YOU_ARE_NOT_ALLOWED_TO_LIST_A_ROLE:`You are not allowed to list a role`,YOU_ARE_NOT_ALLOWED_TO_GET_A_ROLE:`You are not allowed to get a role`,TOO_MANY_ROLES:`This organization has too many roles`,INVALID_RESOURCE:`The provided permission includes an invalid resource`,ROLE_NAME_IS_ALREADY_TAKEN:`That role name is already taken`,CANNOT_DELETE_A_PRE_DEFINED_ROLE:`Cannot delete a pre-defined role`,ROLE_IS_ASSIGNED_TO_MEMBERS:`Cannot delete a role that is assigned to members. Please reassign the members to a different role first`}),p=[],m=0,h=4,g=0,_=e=>{let t=[],n={get(){return n.lc||n.listen(()=>{})(),n.value},init:e,lc:0,listen(e){return n.lc=t.push(e),()=>{for(let t=m+h;t<p.length;)p[t]===e?p.splice(t,h):t+=h;let r=t.indexOf(e);~r&&(t.splice(r,1),--n.lc||n.off())}},notify(e,r){g++;let i=!p.length;for(let i of t)p.push(i,n.value,e,r);if(i){for(m=0;m<p.length;m+=h)p[m](p[m+1],p[m+2],p[m+3]);p.length=0}},off(){},set(e){let t=n.value;t!==e&&(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return n},v=5,y=6,b=10,ee=(e,t,n,r)=>(e.events=e.events||{},e.events[n+b]||(e.events[n+b]=r(t=>{e.events[n].reduceRight((e,t)=>(t(e),e),{shared:{},...t})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let r=e.events[n],i=r.indexOf(t);r.splice(i,1),r.length||(delete e.events[n],e.events[n+b](),delete e.events[n+b])}),te=1e3,x=(e,t)=>ee(e,n=>{let r=t(n);r&&e.events[y].push(r)},v,t=>{let n=e.listen;e.listen=(...r)=>(!e.lc&&!e.active&&(e.active=!0,t()),n(...r));let r=e.off;return e.events[y]=[],e.off=()=>{r(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let t of e.events[y])t();e.events[y]=[]}},te)},()=>{e.listen=n,e.off=r}});function ne(e,t,n){let r=new Set(t).add(void 0);return e.listen((e,t,i)=>{r.has(i)&&n(e,t,i)})}var re=()=>typeof window>`u`,S=(e,t,n,r)=>{let i=_({data:null,error:null,isPending:!0,isRefetching:!1,refetch:e=>a(e)}),a=async e=>new Promise(a=>{let o=typeof r==`function`?r({data:i.get().data,error:i.get().error,isPending:i.get().isPending}):r;n(t,{...o,query:{...o?.query,...e?.query},async onSuccess(e){i.set({data:e.data,error:null,isPending:!1,isRefetching:!1,refetch:i.value.refetch}),await o?.onSuccess?.(e)},async onError(e){let{request:t}=e,n=typeof t.retry==`number`?t.retry:t.retry?.attempts,r=t.retryAttempt||0;if(n&&r<n)return;let a=e.error.status===401;i.set({error:e.error,data:a?null:i.get().data,isPending:!1,isRefetching:!1,refetch:i.value.refetch}),await o?.onError?.(e)},async onRequest(e){let t=i.get();i.set({isPending:t.data===null,data:t.data,error:null,isRefetching:!0,refetch:i.value.refetch}),await o?.onRequest?.(e)}}).catch(e=>{i.set({error:e,data:i.get().data,isPending:!1,isRefetching:!1,refetch:i.value.refetch})}).finally(()=>{a(void 0)})});e=Array.isArray(e)?e:[e];let o=!1;for(let t of e)t.subscribe(async()=>{re()||(o?await a():x(i,()=>{let e=setTimeout(async()=>{o||=(await a(),!0)},0);return()=>{i.off(),t.off(),clearTimeout(e)}}))});return i},C=Symbol.for(`better-auth:broadcast-channel`),ie=()=>Math.floor(Date.now()/1e3),ae=class{listeners=new Set;name;constructor(e=`better-auth.message`){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>`u`))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:ie()}))}catch{}}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=e=>{if(e.key!==this.name)return;let t=JSON.parse(e.newValue??`{}`);t?.event!==`session`||!t?.data||this.listeners.forEach(e=>e(t))};return window.addEventListener(`storage`,e),()=>{window.removeEventListener(`storage`,e)}}};function w(e=`better-auth.message`){return globalThis[C]||(globalThis[C]=new ae(e)),globalThis[C]}var T=Symbol.for(`better-auth:focus-manager`),oe=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||typeof document>`u`||window.addEventListener===void 0)return()=>{};let e=()=>{document.visibilityState===`visible`&&this.setFocused(!0)};return document.addEventListener(`visibilitychange`,e,!1),()=>{document.removeEventListener(`visibilitychange`,e,!1)}}};function se(){return globalThis[T]||(globalThis[T]=new oe),globalThis[T]}var E=Symbol.for(`better-auth:online-manager`),ce=class{listeners=new Set;isOnline=typeof navigator<`u`?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>`u`||window.addEventListener===void 0)return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener(`online`,e,!1),window.addEventListener(`offline`,t,!1),()=>{window.removeEventListener(`online`,e,!1),window.removeEventListener(`offline`,t,!1)}}};function D(){return globalThis[E]||(globalThis[E]=new ce),globalThis[E]}var le={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},ue=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,de={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:1/0,"-infinity":-1/0},fe=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function pe(e){return e instanceof Date&&!isNaN(e.getTime())}function me(e){let t=fe.exec(e);if(!t)return null;let[,n,r,i,a,o,s,c,l,u,d]=t,f=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(i,10),parseInt(a,10),parseInt(o,10),parseInt(s,10),c?parseInt(c.padEnd(3,`0`),10):0));if(l){let e=(parseInt(u,10)*60+parseInt(d,10))*(l===`+`?-1:1);f.setUTCMinutes(f.getUTCMinutes()+e)}return pe(f)?f:null}function he(e,t={}){let{strict:n=!1,warnings:r=!1,reviver:i,parseDates:a=!0}=t;if(typeof e!=`string`)return e;let o=e.trim();if(o.length>0&&o[0]===`"`&&o.endsWith(`"`)&&!o.slice(1,-1).includes(`"`))return o.slice(1,-1);let s=o.toLowerCase();if(s.length<=9&&s in de)return de[s];if(!ue.test(o)){if(n)throw SyntaxError(`[better-json] Invalid JSON`);return e}if(Object.entries(le).some(([e,t])=>{let n=t.test(o);return n&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${e} pattern`),n})&&n)throw Error(`[better-json] Potential prototype pollution attempt detected`);try{return JSON.parse(o,(e,t)=>{if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){r&&console.warn(`[better-json] Dropping "${e}" key to prevent prototype pollution`);return}if(a&&typeof t==`string`){let e=me(t);if(e)return e}return i?i(e,t):t})}catch(t){if(n)throw t;return e}}function ge(e,t={strict:!0}){return he(e,t)}var O=()=>Math.floor(Date.now()/1e3),_e=5;function ve(e){let{sessionAtom:t,sessionSignal:n,$fetch:r,options:i={}}=e,a=i.sessionOptions?.refetchInterval??0,o=i.sessionOptions?.refetchOnWindowFocus??!0,s=i.sessionOptions?.refetchWhenOffline??!1,c={lastSync:0,lastSessionRequest:0,cachedSession:void 0},l=()=>s||D().isOnline,u=e=>{if(!l())return;if(e?.event===`storage`){c.lastSync=O(),n.set(!n.get());return}let i=t.get(),a=()=>{c.lastSessionRequest=O(),r(`/get-session`).then(async e=>{let a=e.data,o=e.error||null;if(a?.needsRefresh)try{let e=await r(`/get-session`,{method:`POST`});a=e.data,o=e.error||null}catch{}let s=a?.session&&a?.user?a:null;t.set({...i,data:s,error:o}),c.lastSync=O(),n.set(!n.get())}).catch(()=>{})};if(e?.event===`poll`){a();return}if(e?.event===`visibilitychange`){if(O()-c.lastSessionRequest<_e)return;c.lastSessionRequest=O()}if(e?.event===`visibilitychange`){a();return}(i?.data===null||i?.data===void 0)&&(c.lastSync=O(),n.set(!n.get()))},d=e=>{w().post({event:`session`,data:{trigger:e},clientId:Math.random().toString(36).substring(7)})},f=()=>{a&&a>0&&(c.pollInterval=setInterval(()=>{t.get()?.data&&u({event:`poll`})},a*1e3))},p=()=>{c.unsubscribeBroadcast=w().subscribe(()=>{u({event:`storage`})})},m=()=>{o&&(c.unsubscribeFocus=se().subscribe(()=>{u({event:`visibilitychange`})}))},h=()=>{c.unsubscribeOnline=D().subscribe(e=>{e&&u({event:`visibilitychange`})})};return{init:()=>{f(),p(),m(),h(),w().setup(),se().setup(),D().setup()},cleanup:()=>{c.pollInterval&&=(clearInterval(c.pollInterval),void 0),c.unsubscribeBroadcast&&=(c.unsubscribeBroadcast(),void 0),c.unsubscribeFocus&&=(c.unsubscribeFocus(),void 0),c.unsubscribeOnline&&=(c.unsubscribeOnline(),void 0),c.lastSync=0,c.lastSessionRequest=0,c.cachedSession=void 0},triggerRefetch:u,broadcastSessionUpdate:d}}var k=Object.create(null),A=e=>({}),j=new Proxy(k,{get(e,t){return A()[t]??k[t]},has(e,t){return t in A()||t in k},set(e,t,n){let r=A(!0);return r[t]=n,!0},deleteProperty(e,t){if(!t)return!1;let n=A(!0);return delete n[t],!0},ownKeys(){let e=A(!0);return Object.keys(e)}});function M(e,t){return typeof process<`u`?{}[e]??t:typeof Deno<`u`?Deno.env.get(e)??t:typeof Bun<`u`?Bun.env[e]??t:t}Object.freeze({get BETTER_AUTH_SECRET(){return M(`BETTER_AUTH_SECRET`)},get AUTH_SECRET(){return M(`AUTH_SECRET`)},get BETTER_AUTH_TELEMETRY(){return M(`BETTER_AUTH_TELEMETRY`)},get BETTER_AUTH_TELEMETRY_ID(){return M(`BETTER_AUTH_TELEMETRY_ID`)},get NODE_ENV(){return M(`NODE_ENV`,`development`)},get PACKAGE_VERSION(){return M(`PACKAGE_VERSION`,`0.0.0`)},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return M(`BETTER_AUTH_TELEMETRY_ENDPOINT`,``)}});var N=1,P=4,F=8,I=24,L={eterm:P,cons25:P,console:P,cygwin:P,dtterm:P,gnome:P,hurd:P,jfbterm:P,konsole:P,kterm:P,mlterm:P,mosh:I,putty:P,st:P,"rxvt-unicode-24bit":I,terminator:I,"xterm-kitty":I},ye=new Map(Object.entries({APPVEYOR:F,BUILDKITE:F,CIRCLECI:I,DRONE:F,GITEA_ACTIONS:I,GITHUB_ACTIONS:I,GITLAB_CI:F,TRAVIS:F})),be=[/ansi/,/color/,/linux/,/direct/,/^con[0-9]*x[0-9]/,/^rxvt/,/^screen/,/^xterm/,/^vt100/,/^vt220/];function xe(){if(M(`FORCE_COLOR`)!==void 0)switch(M(`FORCE_COLOR`)){case``:case`1`:case`true`:return P;case`2`:return F;case`3`:return I;default:return N}if(M(`NODE_DISABLE_COLORS`)!==void 0&&M(`NODE_DISABLE_COLORS`)!==``||M(`NO_COLOR`)!==void 0&&M(`NO_COLOR`)!==``||M(`TERM`)===`dumb`)return N;if(M(`TMUX`))return I;if(`TF_BUILD`in j&&`AGENT_NAME`in j)return P;if(`CI`in j){for(let{0:e,1:t}of ye)if(e in j)return t;return M(`CI_NAME`)===`codeship`?F:N}if(`TEAMCITY_VERSION`in j)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.exec(M(`TEAMCITY_VERSION`))===null?N:P;switch(M(`TERM_PROGRAM`)){case`iTerm.app`:return!M(`TERM_PROGRAM_VERSION`)||/^[0-2]\./.exec(M(`TERM_PROGRAM_VERSION`))!==null?F:I;case`HyperTerm`:case`MacTerm`:return I;case`Apple_Terminal`:return F}if(M(`COLORTERM`)===`truecolor`||M(`COLORTERM`)===`24bit`)return I;if(M(`TERM`)){if(/truecolor/.exec(M(`TERM`))!==null)return I;if(/^xterm-256/.exec(M(`TERM`))!==null)return F;let e=M(`TERM`).toLowerCase();if(L[e])return L[e];if(be.some(t=>t.exec(e)!==null))return P}return M(`COLORTERM`)?P:N}var R={reset:`\x1B[0m`,bright:`\x1B[1m`,dim:`\x1B[2m`,undim:`\x1B[22m`,underscore:`\x1B[4m`,blink:`\x1B[5m`,reverse:`\x1B[7m`,hidden:`\x1B[8m`,fg:{black:`\x1B[30m`,red:`\x1B[31m`,green:`\x1B[32m`,yellow:`\x1B[33m`,blue:`\x1B[34m`,magenta:`\x1B[35m`,cyan:`\x1B[36m`,white:`\x1B[37m`},bg:{black:`\x1B[40m`,red:`\x1B[41m`,green:`\x1B[42m`,yellow:`\x1B[43m`,blue:`\x1B[44m`,magenta:`\x1B[45m`,cyan:`\x1B[46m`,white:`\x1B[47m`}},z=[`debug`,`info`,`success`,`warn`,`error`];function Se(e,t){return z.indexOf(t)>=z.indexOf(e)}var Ce={info:R.fg.blue,success:R.fg.green,warn:R.fg.yellow,error:R.fg.red,debug:R.fg.magenta},we=(e,t,n)=>{let r=new Date().toISOString();return n?`${R.dim}${r}${R.reset} ${Ce[e]}${e.toUpperCase()}${R.reset} ${R.bright}[Better Auth]:${R.reset} ${t}`:`${r} ${e.toUpperCase()} [Better Auth]: ${t}`};(e=>{let t=e?.disabled!==!0,n=e?.level??`warn`,r=e?.disableColors===void 0?xe()!==1:!e.disableColors,i=(i,a,o=[])=>{if(!t||!Se(n,i))return;let s=we(i,a,r);if(!e||typeof e.log!=`function`){i===`error`?console.error(s,...o):i===`warn`?console.warn(s,...o):console.log(s,...o);return}e.log(i===`success`?`info`:i,a,...o)};return{...Object.fromEntries(z.map(e=>[e,(...[t,...n])=>i(e,t,n)])),get level(){return n}}})();function Te(e){try{return(new URL(e).pathname.replace(/\/+$/,``)||`/`)!==`/`}catch{throw new c(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function Ee(e){try{let t=new URL(e);if(t.protocol!==`http:`&&t.protocol!==`https:`)throw new c(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof c?t:new c(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function B(e,t=`/api/auth`){if(Ee(e),Te(e))return e;let n=e.replace(/\/+$/,``);return!t||t===`/`?n:(t=t.startsWith(`/`)?t:`/${t}`,`${n}${t}`)}function De(e,t){return!e||e.trim()===``?!1:t===`proto`?e===`http`||e===`https`:t===`host`?[/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(t=>t.test(e))?!1:/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e):!1}function Oe(e,t,n,r,i){if(e)return B(e,t);if(r!==!1){let e=j.BETTER_AUTH_URL||j.NEXT_PUBLIC_BETTER_AUTH_URL||j.PUBLIC_BETTER_AUTH_URL||j.NUXT_PUBLIC_BETTER_AUTH_URL||j.NUXT_PUBLIC_AUTH_URL||(j.BASE_URL===`/`?void 0:j.BASE_URL);if(e)return B(e,t)}let a=n?.headers.get(`x-forwarded-host`),o=n?.headers.get(`x-forwarded-proto`);if(a&&o&&i&&De(o,`proto`)&&De(a,`host`))try{return B(`${o}://${a}`,t)}catch{}if(n){let e=ke(n.url);if(!e)throw new c(`Could not get origin from request. Please provide a valid base URL.`);return B(e,t)}if(typeof window<`u`&&window.location)return B(window.location.origin,t)}function ke(e){try{let t=new URL(e);return t.origin===`null`?null:t.origin}catch{return null}}var Ae={id:`redirect`,name:`Redirect`,hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&typeof window<`u`&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};function je(e,t){let n=_(!1),r=S(n,`/get-session`,e,{method:`GET`}),i=()=>{};return x(r,()=>{let a=ve({sessionAtom:r,sessionSignal:n,$fetch:e,options:t});return a.init(),i=a.broadcastSessionUpdate,()=>{a.cleanup()}}),{session:r,$sessionSignal:n,broadcastSessionUpdate:e=>i(e)}}function V(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function H(e,t,n=`.`,r){if(!V(t))return H(e,{},n,r);let i={...t};for(let t of Object.keys(e)){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:V(a)&&V(i[t])?i[t]=H(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function Me(e){return(...t)=>t.reduce((t,n)=>H(t,n,``,e),{})}var Ne=Me(),Pe=Object.defineProperty,Fe=Object.defineProperties,Ie=Object.getOwnPropertyDescriptors,Le=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,ze=Object.prototype.propertyIsEnumerable,Be=(e,t,n)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t)=>{for(var n in t||={})Re.call(t,n)&&Be(e,n,t[n]);if(Le)for(var n of Le(t))ze.call(t,n)&&Be(e,n,t[n]);return e},W=(e,t)=>Fe(e,Ie(t)),Ve=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n,Error.captureStackTrace(this,this.constructor)}},He=async(e,t)=>{let n=t||{},r={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:n,hooks:r};for(let i of t?.plugins||[]){if(i.init){let r=await i.init?.call(i,e.toString(),t);n=r.options||n,e=r.url}r.onRequest.push(i.hooks?.onRequest),r.onResponse.push(i.hooks?.onResponse),r.onSuccess.push(i.hooks?.onSuccess),r.onError.push(i.hooks?.onError),r.onRetry.push(i.hooks?.onRetry)}return{url:e,options:n,hooks:r}},G=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},Ue=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function We(e){if(typeof e==`number`)return new G({type:`linear`,attempts:e,delay:1e3});switch(e.type){case`linear`:return new G(e);case`exponential`:return new Ue(e);default:throw Error(`Invalid retry strategy`)}}var Ge=async e=>{let t={},n=async e=>typeof e==`function`?await e():e;if(e?.auth){if(e.auth.type===`Bearer`){let r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type===`Basic`){let[r,i]=await Promise.all([n(e.auth.username),n(e.auth.password)]);if(!r||!i)return t;t.authorization=`Basic ${btoa(`${r}:${i}`)}`}else if(e.auth.type===`Custom`){let[r,i]=await Promise.all([n(e.auth.prefix),n(e.auth.value)]);if(!i)return t;t.authorization=`${r??``} ${i}`}}return t},Ke=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function qe(e){let t=e.headers.get(`content-type`),n=new Set([`image/svg`,`application/xml`,`application/xhtml`,`application/html`]);if(!t)return`json`;let r=t.split(`;`).shift()||``;return Ke.test(r)?`json`:n.has(r)||r.startsWith(`text/`)?`text`:`blob`}function Je(e){try{return JSON.parse(e),!0}catch{return!1}}function K(e){if(e===void 0)return!1;let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===null?!0:t===`object`?Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name===`Object`||typeof e.toJSON==`function`:!1}function q(e){try{return JSON.parse(e)}catch{return e}}function J(e){return typeof e==`function`}function Ye(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<`u`&&J(globalThis.fetch))return globalThis.fetch;if(typeof window<`u`&&J(window.fetch))return window.fetch;throw Error(`No fetch implementation found`)}async function Xe(e){let t=new Headers(e?.headers),n=await Ge(e);for(let[e,r]of Object.entries(n||{}))t.set(e,r);if(!t.has(`content-type`)){let n=Ze(e?.body);n&&t.set(`content-type`,n)}return t}function Ze(e){return K(e)?`application/json`:null}function Qe(e){if(!e?.body)return null;let t=new Headers(e?.headers);if(K(e.body)&&!t.has(`content-type`)){for(let[t,n]of Object.entries(e?.body))n instanceof Date&&(e.body[t]=n.toISOString());return JSON.stringify(e.body)}return t.has(`content-type`)&&t.get(`content-type`)===`application/x-www-form-urlencoded`&&K(e.body)?new URLSearchParams(e.body).toString():e.body}function $e(e,t){if(t?.method)return t.method.toUpperCase();if(e.startsWith(`@`)){let n=e.split(`@`)[1]?.split(`/`)[0];return nt.includes(n)?n.toUpperCase():t?.body?`POST`:`GET`}return t?.body?`POST`:`GET`}function et(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var tt=class e extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,e.prototype)}};async function Y(e,t){let n=await e[`~standard`].validate(t);if(n.issues)throw new tt(n.issues);return n.value}var nt=[`get`,`post`,`put`,`patch`,`delete`],rt=e=>({id:`apply-schema`,name:`Apply Schema`,version:`1.0.0`,async init(t,n){let r=e.plugins?.find(e=>e.schema?.config?t.startsWith(e.schema.config.baseURL||``)||t.startsWith(e.schema.config.prefix||``):!1)?.schema||e.schema;if(r){let e=t;r.config?.prefix&&e.startsWith(r.config.prefix)&&(e=e.replace(r.config.prefix,``),r.config.baseURL&&(t=t.replace(r.config.prefix,r.config.baseURL))),r.config?.baseURL&&e.startsWith(r.config.baseURL)&&(e=e.replace(r.config.baseURL,``));let i=r.schema[e];if(i){let e=W(U({},n),{method:i.method,output:i.output});return n?.disableValidation||(e=W(U({},e),{body:i.input?await Y(i.input,n?.body):n?.body,params:i.params?await Y(i.params,n?.params):n?.params,query:i.query?await Y(i.query,n?.query):n?.query})),{url:t,options:e}}}return{url:t,options:n}}}),it=e=>{async function t(t,n){let r=W(U(U({},e),n),{plugins:[...e?.plugins||[],rt(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await X(t,r)}catch(e){return{data:null,error:{status:500,statusText:`Fetch Error`,message:`Fetch related error. Captured by catchAllError option. See error property for more details.`,error:e}}}return await X(t,r)}return t};function at(e,t){let{baseURL:n,params:r,query:i}=t||{query:{},params:{},baseURL:``},a=e.startsWith(`http`)?e.split(`/`).slice(0,3).join(`/`):n||``;if(e.startsWith(`@`)){let t=e.toString().split(`@`)[1].split(`/`)[0];nt.includes(t)&&(e=e.replace(`@${t}/`,`/`))}a.endsWith(`/`)||(a+=`/`);let[o,s]=e.replace(a,``).split(`?`),c=new URLSearchParams(s);for(let[e,t]of Object.entries(i||{})){if(t==null)continue;let n;if(typeof t==`string`)n=t;else if(Array.isArray(t)){for(let n of t)c.append(e,n);continue}else n=JSON.stringify(t);c.set(e,n)}if(r)if(Array.isArray(r)){let e=o.split(`/`).filter(e=>e.startsWith(`:`));for(let[t,n]of e.entries()){let e=r[t];o=o.replace(n,e)}}else for(let[e,t]of Object.entries(r))o=o.replace(`:${e}`,String(t));o=o.split(`/`).map(encodeURIComponent).join(`/`),o.startsWith(`/`)&&(o=o.slice(1));let l=c.toString();return l=l.length>0?`?${l}`.replace(/\+/g,`%20`):``,a.startsWith(`http`)?new URL(`${o}${l}`,a):`${a}${o}${l}`}var X=async(e,t)=>{let{hooks:n,url:r,options:i}=await He(e,t),a=Ye(i),o=new AbortController,s=i.signal??o.signal,c=at(r,i),l=Qe(i),u=await Xe(i),d=$e(r,i),f=W(U({},i),{url:c,headers:u,body:l,method:d,signal:s});for(let e of n.onRequest)if(e){let t=await e(f);typeof t==`object`&&t&&(f=t)}(`pipeTo`in f&&typeof f.pipeTo==`function`||typeof t?.body?.pipe==`function`)&&(`duplex`in f||(f.duplex=`half`));let{clearTimeout:p}=et(i,o),m=await a(f.url,f);p();let h={response:m,request:f};for(let e of n.onResponse)if(e){let n=await e(W(U({},h),{response:t?.hookOptions?.cloneResponse?m.clone():m}));n instanceof Response?m=n:typeof n==`object`&&n&&(m=n.response)}if(m.ok){if(f.method===`HEAD`)return{data:``,error:null};let e=qe(m),r={data:null,response:m,request:f};if(e===`json`||e===`text`){let e=await m.text();r.data=await(f.jsonParser??q)(e)}else r.data=await m[e]();f?.output&&f.output&&!f.disableValidation&&(r.data=await Y(f.output,r.data));for(let e of n.onSuccess)e&&await e(W(U({},r),{response:t?.hookOptions?.cloneResponse?m.clone():m}));return t?.throw?r.data:{data:r.data,error:null}}let g=t?.jsonParser??q,_=await m.text(),v=Je(_),y=v?await g(_):null,b={response:m,responseText:_,request:f,error:W(U({},y),{status:m.status,statusText:m.statusText})};for(let e of n.onError)e&&await e(W(U({},b),{response:t?.hookOptions?.cloneResponse?m.clone():m}));if(t?.retry){let r=We(t.retry),i=t.retryAttempt??0;if(await r.shouldAttemptRetry(i,m)){for(let e of n.onRetry)e&&await e(h);let a=r.getDelay(i);return await new Promise(e=>setTimeout(e,a)),await X(e,W(U({},t),{retryAttempt:i+1}))}}if(t?.throw)throw new Ve(m.status,m.statusText,v?y:_);return{data:null,error:W(U({},y),{status:m.status,statusText:m.statusText})}},ot=e=>{if(typeof process>`u`)return;let t=e??`/api/auth`;if({}.NEXT_PUBLIC_AUTH_URL)return{}.NEXT_PUBLIC_AUTH_URL;if(typeof window>`u`){if({}.NEXTAUTH_URL)try{return{}.NEXTAUTH_URL}catch{}if({}.VERCEL_URL)try{let e={}.VERCEL_URL.startsWith(`http`)?``:`https://`;return`${new URL(`${e}${{}.VERCEL_URL}`).origin}${t}`}catch{}}},st=(e,t)=>{let n=`credentials`in Request.prototype,r=Oe(e?.baseURL,e?.basePath,void 0,t)??ot(e?.basePath)??`/api/auth`,i=e?.plugins?.flatMap(e=>e.fetchPlugins).filter(e=>e!==void 0)||[],a={id:`lifecycle-hooks`,name:`lifecycle-hooks`,hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:o,onError:s,onRequest:c,onResponse:l,...u}=e?.fetchOptions||{},d=it({baseURL:r,...n?{credentials:`include`}:{},method:`GET`,jsonParser(e){return e?ge(e,{strict:!1}):null},customFetchImpl:fetch,...u,plugins:[a,...u.plugins||[],...e?.disableDefaultFetchPlugins?[]:[Ae],...i]}),{$sessionSignal:f,session:p,broadcastSessionUpdate:m}=je(d,e),h=e?.plugins||[],g={},_={$sessionSignal:f,session:p},v={"/sign-out":`POST`,"/revoke-sessions":`POST`,"/revoke-other-sessions":`POST`,"/delete-user":`POST`},y=[{signal:`$sessionSignal`,matcher(e){return e===`/sign-out`||e===`/update-user`||e===`/update-session`||e===`/sign-up/email`||e===`/sign-in/email`||e===`/delete-user`||e===`/verify-email`||e===`/revoke-sessions`||e===`/revoke-session`||e===`/change-email`},callback(e){e===`/sign-out`?m(`signout`):(e===`/update-user`||e===`/update-session`)&&m(`updateUser`)}}];for(let e of h)e.getAtoms&&Object.assign(_,e.getAtoms?.(d)),e.pathMethods&&Object.assign(v,e.pathMethods),e.atomListeners&&y.push(...e.atomListeners);let b={notify:e=>{_[e].set(!_[e].get())},listen:(e,t)=>{_[e].subscribe(t)},atoms:_};for(let t of h)t.getActions&&(g=Ne(t.getActions?.(d,b,e)??{},g));return{get baseURL(){return r},pluginsActions:g,pluginsAtoms:_,pluginPathMethods:v,atomListeners:y,$fetch:d,$store:b}};function ct(e){return typeof e==`object`&&!!e&&`get`in e&&typeof e.get==`function`&&`lc`in e&&typeof e.lc==`number`}function lt(e,t,n){let r=t[e],{fetchOptions:i,query:a,...o}=n||{};return r||(i?.method?i.method:o&&Object.keys(o).length>0?`POST`:`GET`)}function ut(e,t,n,r,i){function a(o=[]){return new Proxy(function(){},{get(t,n){if(typeof n!=`string`||n===`then`||n===`catch`||n===`finally`)return;let r=[...o,n],i=e;for(let e of r)if(i&&typeof i==`object`&&e in i)i=i[e];else{i=void 0;break}return typeof i==`function`||ct(i)?i:a(r)},apply:async(e,a,s)=>{let c=`/`+o.map(e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)).join(`/`),l=s[0]||{},u=s[1]||{},{query:d,fetchOptions:f,...p}=l,m={...u,...f},h=lt(c,n,l);return await t(c,{...m,body:h===`GET`?void 0:{...p,...m?.body||{}},query:d||m?.query,method:h,async onSuccess(e){if(await m?.onSuccess?.(e),!i||m.disableSignal)return;let t=i.filter(e=>e.matcher(c));if(!t.length)return;let n=new Set;for(let e of t){let t=r[e.signal];if(!t)return;if(n.has(e.signal))continue;n.add(e.signal);let i=t.get();setTimeout(()=>{t.set(!i)},10),e.callback?.(c)}}})}})}return a()}function dt(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Z=u({organization:[`update`,`delete`],member:[`create`,`update`,`delete`],invitation:[`create`,`cancel`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),ft=Z.newRole({organization:[`update`],invitation:[`create`,`cancel`],member:[`create`,`update`,`delete`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),pt=Z.newRole({organization:[`update`,`delete`],member:[`create`,`update`,`delete`],invitation:[`create`,`cancel`],team:[`create`,`update`,`delete`],ac:[`create`,`read`,`update`,`delete`]}),mt=Z.newRole({organization:[],member:[],invitation:[],team:[],ac:[`read`]}),ht={admin:ft,owner:pt,member:mt},gt=(e,t)=>{if(!e.permissions)return!1;let n=e.role.split(`,`),r=e.options.creatorRole||`owner`,i=n.includes(r),a=e.allowCreatorAllPermissions||!1;if(i&&a)return!0;for(let r of n)if(t[r]?.authorize(e.permissions)?.success)return!0;return!1},_t=e=>gt(e,e.options.roles||ht),vt=e=>{let t=_(!1),n=_(!1),r=_(!1),i=_(!1),a={admin:ft,member:mt,owner:pt,...e?.roles};return{id:`organization`,$InferServerPlugin:{},getActions:(t,n,r)=>({$Infer:{ActiveOrganization:{},Organization:{},Invitation:{},Member:{},Team:{}},organization:{checkRolePermission:t=>_t({role:t.role,options:{ac:e?.ac,roles:a},permissions:t.permissions})}}),getAtoms:e=>{let a=S(t,`/organization/list`,e,{method:`GET`});return{$listOrg:t,$activeOrgSignal:n,$activeMemberSignal:r,$activeMemberRoleSignal:i,activeOrganization:S([n],`/organization/get-full-organization`,e,()=>({method:`GET`})),listOrganizations:a,activeMember:S([n,r],`/organization/get-active-member`,e,{method:`GET`}),activeMemberRole:S([n,i],`/organization/get-active-member-role`,e,{method:`GET`})}},pathMethods:{"/organization/get-full-organization":`GET`,"/organization/list-user-teams":`GET`},atomListeners:[{matcher(e){return e===`/organization/create`||e===`/organization/delete`||e===`/organization/update`},signal:`$listOrg`},{matcher(e){return e.startsWith(`/organization`)},signal:`$activeOrgSignal`},{matcher(e){return e.startsWith(`/organization/set-active`)||e===`/organization/create`||e===`/organization/delete`||e===`/organization/remove-member`||e===`/organization/leave`||e===`/organization/accept-invitation`},signal:`$sessionSignal`},{matcher(e){return e.includes(`/organization/update-member-role`)||e.startsWith(`/organization/set-active`)},signal:`$activeMemberSignal`},{matcher(e){return e.includes(`/organization/update-member-role`)||e.startsWith(`/organization/set-active`)},signal:`$activeMemberRoleSignal`}],$ERROR_CODES:f}};r({INVALID_PHONE_NUMBER:`Invalid phone number`,PHONE_NUMBER_EXIST:`Phone number already exists`,PHONE_NUMBER_NOT_EXIST:`phone number isn't registered`,INVALID_PHONE_NUMBER_OR_PASSWORD:`Invalid phone number or password`,UNEXPECTED_ERROR:`Unexpected error`,OTP_NOT_FOUND:`OTP not found`,OTP_EXPIRED:`OTP expired`,INVALID_OTP:`Invalid OTP`,PHONE_NUMBER_NOT_VERIFIED:`Phone number not verified`,PHONE_NUMBER_CANNOT_BE_UPDATED:`Phone number cannot be updated`,SEND_OTP_NOT_IMPLEMENTED:`sendOTP not implemented`,TOO_MANY_ATTEMPTS:`Too many attempts`}),r({OTP_NOT_ENABLED:`OTP not enabled`,OTP_HAS_EXPIRED:`OTP has expired`,TOTP_NOT_ENABLED:`TOTP not enabled`,TWO_FACTOR_NOT_ENABLED:`Two factor isn't enabled`,BACKUP_CODES_NOT_ENABLED:`Backup codes aren't enabled`,INVALID_BACKUP_CODE:`Invalid backup code`,INVALID_CODE:`Invalid code`,TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE:`Too many attempts. Please request a new code.`,INVALID_TWO_FACTOR_COOKIE:`Invalid two factor cookie`}),r({INVALID_USERNAME_OR_PASSWORD:`Invalid username or password`,EMAIL_NOT_VERIFIED:`Email not verified`,UNEXPECTED_ERROR:`Unexpected error`,USERNAME_IS_ALREADY_TAKEN:`Username is already taken. Please try another.`,USERNAME_TOO_SHORT:`Username is too short`,USERNAME_TOO_LONG:`Username is too long`,INVALID_USERNAME:`Username is invalid`,INVALID_DISPLAY_USERNAME:`Display username is invalid`});var Q=e(t(),1);function yt(e,t={}){let n=(0,Q.useRef)(e.get()),{keys:r,deps:i=[e,r]}=t,a=(0,Q.useCallback)(t=>{let i=e=>{n.current!==e&&(n.current=e,t())};return i(e.value),r?.length?ne(e,r,i):e.listen(i)},i),o=()=>n.current;return(0,Q.useSyncExternalStore)(a,o,o)}function bt(e){return`use${dt(e)}`}function xt(e){let{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:i,$store:a,atomListeners:o}=st(e),s={};for(let[e,t]of Object.entries(r))s[bt(e)]=()=>yt(t);return ut({...n,...s,$fetch:i,$store:a},i,t,r,o)}var $=xt({baseURL:n(),plugins:[vt()]}),{useSession:St}=$,{signIn:Ct}=$,{signOut:wt}=$,{signUp:Tt}=$,{organization:Et}=$;$.getSession;export{St as a,Tt as i,Ct as n,wt as r,Et as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{S as i,a,p as o,x as s,y as c}from"./createReactComponent-_L2mp4Ui.js";import{t as l}from"./utils-C8DGLIgm.js";import{Et as u}from"./getDisabledMountTransitionStyles-f3pOCbyk.js";var d=e(t()),f=d.createContext(void 0);function p(){let e=d.useContext(f);if(e===void 0)throw Error(c(13));return e}var m={imageLoadingStatus:()=>null},h=n(),g=d.forwardRef(function(e,t){let{className:n,render:r,...i}=e,[o,s]=d.useState(`idle`),c=d.useMemo(()=>({imageLoadingStatus:o}),[o]),l=d.useMemo(()=>({imageLoadingStatus:o,setImageLoadingStatus:s}),[o,s]),u=a(`span`,e,{state:c,ref:t,props:i,stateAttributesMapping:m});return(0,h.jsx)(f.Provider,{value:l,children:u})});function _(e,{referrerPolicy:t,crossOrigin:n}){let[r,i]=d.useState(`idle`);return s(()=>{if(!e)return i(`error`),o;let r=!0,a=new window.Image,s=e=>()=>{r&&i(e)};return i(`loading`),a.onload=s(`loaded`),a.onerror=s(`error`),t&&(a.referrerPolicy=t),a.crossOrigin=n??null,a.src=e,()=>{r=!1}},[e,n,t]),r}var v=d.forwardRef(function(e,t){let{className:n,render:r,onLoadingStatusChange:o,referrerPolicy:c,crossOrigin:l,...u}=e,f=p(),h=_(e.src,{referrerPolicy:c,crossOrigin:l}),g=i(e=>{o?.(e),f.setImageLoadingStatus(e)});return s(()=>{h!==`idle`&&g(h)},[h,g]),a(`img`,e,{state:d.useMemo(()=>({imageLoadingStatus:h}),[h]),ref:t,props:u,stateAttributesMapping:m,enabled:h===`loaded`})}),y=d.forwardRef(function(e,t){let{className:n,render:r,delay:i,...o}=e,{imageLoadingStatus:s}=p(),[c,l]=d.useState(i===void 0),f=u();return d.useEffect(()=>(i!==void 0&&f.start(i,()=>l(!0)),f.clear),[f,i]),a(`span`,e,{state:d.useMemo(()=>({imageLoadingStatus:s}),[s]),ref:t,props:o,stateAttributesMapping:m,enabled:s!==`loaded`&&c})}),b=r();function x(e){let t=(0,b.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,size:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]===n?o=t[5]:(o=l(`size-8 rounded-full after:rounded-full data-[size=lg]:size-10 data-[size=sm]:size-6 after:border-border group/avatar relative flex shrink-0 select-none after:absolute after:inset-0 after:border after:mix-blend-darken dark:after:mix-blend-lighten`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,h.jsx)(g,{"data-slot":`avatar`,"data-size":a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function S(e){let t=(0,b.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`rounded-full aspect-square size-full object-cover`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,h.jsx)(v,{"data-slot":`avatar-image`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function C(e){let t=(0,b.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(`bg-muted text-muted-foreground rounded-full flex size-full items-center justify-center text-sm group-data-[size=sm]/avatar:text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,h.jsx)(y,{"data-slot":`avatar-fallback`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}export{C as n,S as r,x as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./compiler-runtime-DCc3R3Xn.js";import{b as t,i as n}from"./createReactComponent-_L2mp4Ui.js";import{t as r}from"./utils-C8DGLIgm.js";import{t as i}from"./useRender-DFMo54_d.js";var a=e(),o=n(`h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-colors overflow-hidden group/badge`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function s(e){let n=(0,a.c)(13),s,c,l,u,d;if(n[0]!==e){let{className:a,variant:f,render:p,...m}=e;s=p,d=f===void 0?`default`:f,u=i,c=`span`,l=t({className:r(o({className:a,variant:d}))},m),n[0]=e,n[1]=s,n[2]=c,n[3]=l,n[4]=u,n[5]=d}else s=n[1],c=n[2],l=n[3],u=n[4],d=n[5];let f;n[6]===d?f=n[7]:(f={slot:`badge`,variant:d},n[6]=d,n[7]=f);let p;return n[8]!==s||n[9]!==c||n[10]!==l||n[11]!==f?(p={defaultTagName:c,props:l,render:s,state:f},n[8]=s,n[9]=c,n[10]=l,n[11]=f,n[12]=p):p=n[12],u(p)}export{s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-DG_AJzB_.js";import{t as r}from"./compiler-runtime-DCc3R3Xn.js";import{a as i,o as a}from"./api-base-url-DIb6qukm.js";import{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};
|