ppbase 0.2.0__tar.gz → 0.2.1__tar.gz
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.
- {ppbase-0.2.0 → ppbase-0.2.1}/PKG-INFO +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/_id_-Pu_jMC0a.js → ppbase-0.2.1/ppbase/admin/dist/assets/_id_-FhBtVpIr.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/arrow-right-CgCr8c2W.js → ppbase-0.2.1/ppbase/admin/dist/assets/arrow-right-oDCr_rj8.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/badge-C6hyvsqs.js → ppbase-0.2.1/ppbase/admin/dist/assets/badge-DrRXUb2i.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/breadcrumb-6Vz71xKn.js → ppbase-0.2.1/ppbase/admin/dist/assets/breadcrumb-CRswEvYD.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/button-C5aajgad.js → ppbase-0.2.1/ppbase/admin/dist/assets/button-BTb_K7ly.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/check-CuCqnFF-.js → ppbase-0.2.1/ppbase/admin/dist/assets/check-B5gBbN7b.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/checkbox-CLwk6s6M.js → ppbase-0.2.1/ppbase/admin/dist/assets/checkbox-Bzr8Mz_N.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/chevron-left-Ci-HD8IR.js → ppbase-0.2.1/ppbase/admin/dist/assets/chevron-left-CCM-Ctmg.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/collection-editor-erVMWk8F.js → ppbase-0.2.1/ppbase/admin/dist/assets/collection-editor-DEyrDfRW.js +2 -2
- ppbase-0.2.1/ppbase/admin/dist/assets/dashboard-D4491lbj.js +11 -0
- ppbase-0.2.0/ppbase/admin/dist/assets/empty-state-CPbmIvrt.js → ppbase-0.2.1/ppbase/admin/dist/assets/empty-state-CcADzW37.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/index-DZMmAkOt.js → ppbase-0.2.1/ppbase/admin/dist/assets/index-CBybCNw9.js +2 -2
- ppbase-0.2.0/ppbase/admin/dist/assets/index-Cg9z_5Ly.js → ppbase-0.2.1/ppbase/admin/dist/assets/index-CQBLo7m8.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/index-wpCXILSV.js → ppbase-0.2.1/ppbase/admin/dist/assets/index-dilaKgIE.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/input-CN42eX62.js → ppbase-0.2.1/ppbase/admin/dist/assets/input-BqURNT6_.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/label-DZF4Za2r.js → ppbase-0.2.1/ppbase/admin/dist/assets/label-DN_udu84.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/layout-KubtLzyt.js → ppbase-0.2.1/ppbase/admin/dist/assets/layout-BtS6Z6Mp.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/loading-spinner-Cb7ZCF94.js → ppbase-0.2.1/ppbase/admin/dist/assets/loading-spinner-CYvUxGAE.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/login-BDxsaquT.js → ppbase-0.2.1/ppbase/admin/dist/assets/login-CtnkSvA1.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/logs-CGwws_xK.js → ppbase-0.2.1/ppbase/admin/dist/assets/logs-wQwpAVxN.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/migrations-BmUeorw2.js → ppbase-0.2.1/ppbase/admin/dist/assets/migrations-Dlrt43QA.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/refresh-cw-C9bEvihq.js → ppbase-0.2.1/ppbase/admin/dist/assets/refresh-cw-GHDEIP9d.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/select-DS-a7suw.js → ppbase-0.2.1/ppbase/admin/dist/assets/select-43JIRBNM.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/settings-DUZf_xhu.js → ppbase-0.2.1/ppbase/admin/dist/assets/settings-CxZsoeTc.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/setup-C-U_6zJP.js → ppbase-0.2.1/ppbase/admin/dist/assets/setup-BVZXJmMR.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/sheet-CwKntfmT.js → ppbase-0.2.1/ppbase/admin/dist/assets/sheet-BqcXrPMk.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/table-2-Bl4qYSkw.js → ppbase-0.2.1/ppbase/admin/dist/assets/table-2-BPWm54Rc.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/use-logs-CkJrZR5-.js → ppbase-0.2.1/ppbase/admin/dist/assets/use-logs-DP2t67_K.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/use-migrations-AvruOxml.js → ppbase-0.2.1/ppbase/admin/dist/assets/use-migrations-DAeB_wNl.js +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/use-settings-yH7Lb7vN.js → ppbase-0.2.1/ppbase/admin/dist/assets/use-settings-PsGP45fr.js +1 -1
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/admin/dist/index.html +1 -1
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/app.py +35 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/ext/flask_like_pb.py +104 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/ext/registry.py +53 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/services/filter_parser.py +98 -36
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/services/record_service.py +72 -57
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase.egg-info/PKG-INFO +1 -1
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase.egg-info/SOURCES.txt +30 -30
- {ppbase-0.2.0 → ppbase-0.2.1}/pyproject.toml +1 -1
- ppbase-0.2.0/ppbase/admin/dist/assets/dashboard-DUazcPaR.js +0 -11
- {ppbase-0.2.0 → ppbase-0.2.1}/README.md +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/__init__.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/__main__.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/admin/dist/assets/index-C_wtr7YT.css +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/admin/dist/fonts/Inter-Variable.woff2 +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/api/__init__.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/api/admins.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/api/collections.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/api/deps.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/api/files.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/api/health.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/api/logs.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/api/migrations.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/api/realtime.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/api/record_auth.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/api/records.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/api/router.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/api/settings.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/config.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/core/__init__.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/core/id_generator.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/db/__init__.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/db/bootstrap.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/db/engine.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/db/ensure_db.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/db/schema_manager.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/db/system_tables.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/ext/__init__.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/ext/events.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/ext/hooks.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/ext/loading.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/ext/record_repository.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/middleware/__init__.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/middleware/auth.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/middleware/cors.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/middleware/rate_limit.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/middleware/request_logger.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/models/__init__.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/models/collection.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/models/field_types.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/models/record.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/services/__init__.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/services/admin_service.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/services/auth_service.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/services/collection_service.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/services/expand_service.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/services/file_storage.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/services/mail_service.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/services/migration_generator.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/services/migration_runner.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/services/oauth2_service.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/services/realtime_service.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/services/record_auth_service.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/services/rule_engine.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/services/setup_service.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase/storage/__init__.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase.egg-info/dependency_links.txt +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase.egg-info/entry_points.txt +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase.egg-info/requires.txt +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/ppbase.egg-info/top_level.txt +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/setup.cfg +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/tests/test_deps_optional_auth.py +0 -0
- {ppbase-0.2.0 → ppbase-0.2.1}/tests/test_oauth2_base_url.py +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Y,B as Z,E as Re,M as fe,Q as ge,R as Q,r as o,j as e,g as ae,T as Ie,U as Ae,V as Ee,W as $e,C as je,s as Te,t as ye,I as Se,X as Le,Y as as,Z as rs,_ as Me,h as Oe,q as ls,$ as _,k as is,a0 as os,x as cs,J as ds,S as ms}from"./index-
|
|
1
|
+
import{c as Y,B as Z,E as Re,M as fe,Q as ge,R as Q,r as o,j as e,g as ae,T as Ie,U as Ae,V as Ee,W as $e,C as je,s as Te,t as ye,I as Se,X as Le,Y as as,Z as rs,_ as Me,h as Oe,q as ls,$ as _,k as is,a0 as os,x as cs,J as ds,S as ms}from"./index-CBybCNw9.js";import{C as us,B as hs}from"./breadcrumb-CRswEvYD.js";import{B as F}from"./button-BTb_K7ly.js";import{I as H}from"./input-BqURNT6_.js";import{C as re}from"./checkbox-Bzr8Mz_N.js";import{F as ne,g as oe,D as ze,a as qe,b as Ue,c as ps,d as pe,e as ke,f as ue,h as _e,E as xs,C as fs}from"./collection-editor-DEyrDfRW.js";import{T as we,a as be,b as J,c as V,d as ve,e as O,C as Be,E as gs}from"./empty-state-CcADzW37.js";import{C as Ne}from"./chevron-left-CCM-Ctmg.js";import{L as E}from"./label-DN_udu84.js";import{S as He,a as Ve,b as Je,c as Ke,d as js,e as ys}from"./sheet-BqcXrPMk.js";import{L as ie}from"./loading-spinner-CYvUxGAE.js";import{B as ce}from"./badge-DrRXUb2i.js";import{S as ws,a as bs,b as vs,c as Ns,d as Cs}from"./select-43JIRBNM.js";import{R as Ss}from"./refresh-cw-GHDEIP9d.js";import"./index-CQBLo7m8.js";import"./check-B5gBbN7b.js";/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o,g as n}from"./index-
|
|
1
|
+
import{j as o,g as n}from"./index-CBybCNw9.js";import{a}from"./button-BTb_K7ly.js";const s=a("inline-flex items-center rounded-lg border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow-sm hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function u({className:r,variant:e,...t}){return o.jsx("div",{className:n(s({variant:e}),r),...t})}export{u as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,g as a}from"./index-
|
|
1
|
+
import{j as e,g as a}from"./index-CBybCNw9.js";function x({left:t,right:s}){return e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 px-6 py-4 md:px-8 md:py-4.5 border-b bg-white shrink-0 shadow-sm",children:[e.jsx("div",{className:"flex items-center gap-3 min-w-0",children:t}),s&&e.jsx("div",{className:"flex items-center gap-2.5 flex-shrink-0 flex-wrap",children:s})]})}function o({items:t,children:s}){return e.jsxs("div",{className:"flex items-center gap-2 text-[15px] md:text-[16px] min-w-0 flex-wrap",children:[t.map((n,r)=>e.jsxs("span",{className:"flex items-center gap-2",children:[r>0&&e.jsx("span",{className:"text-muted-foreground/40 font-light select-none",children:"/"}),e.jsx("span",{className:a("truncate max-w-[200px] sm:max-w-none transition-colors",n.active?"font-semibold text-foreground":"text-muted-foreground cursor-pointer hover:text-foreground"),onClick:n.onClick,title:n.label,children:n.label})]},r)),s]})}export{o as B,x as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as m,ao as E,a1 as S,ap as V,g as j}from"./index-
|
|
1
|
+
import{r as a,j as m,ao as E,a1 as S,ap as V,g as j}from"./index-CBybCNw9.js";var w=Symbol.for("react.lazy"),y=E[" use ".trim().toString()];function N(e){return typeof e=="object"&&e!==null&&"then"in e}function x(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===w&&"_payload"in e&&N(e._payload)}function R(e){const n=P(e),t=a.forwardRef((o,r)=>{let{children:i,...u}=o;x(i)&&typeof y=="function"&&(i=y(i._payload));const l=a.Children.toArray(i),f=l.find(A);if(f){const s=f.props.children,d=l.map(c=>c===f?a.Children.count(s)>1?a.Children.only(null):a.isValidElement(s)?s.props.children:null:c);return m.jsx(n,{...u,ref:r,children:a.isValidElement(s)?a.cloneElement(s,void 0,d):null})}return m.jsx(n,{...u,ref:r,children:i})});return t.displayName=`${e}.Slot`,t}var O=R("Slot");function P(e){const n=a.forwardRef((t,o)=>{let{children:r,...i}=t;if(x(r)&&typeof y=="function"&&(r=y(r._payload)),a.isValidElement(r)){const u=$(r),l=k(i,r.props);return r.type!==a.Fragment&&(l.ref=o?S(o,u):u),a.cloneElement(r,l)}return a.Children.count(r)>1?a.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var z=Symbol("radix.slottable");function A(e){return a.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===z}function k(e,n){const t={...n};for(const o in n){const r=e[o],i=n[o];/^on[A-Z]/.test(o)?r&&i?t[o]=(...l)=>{const f=i(...l);return r(...l),f}:r&&(t[o]=r):o==="style"?t[o]={...r,...i}:o==="className"&&(t[o]=[r,i].filter(Boolean).join(" "))}return{...e,...t}}function $(e){var o,r;let n=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,t=n&&"isReactWarning"in n&&n.isReactWarning;return t?e.ref:(n=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}const b=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,h=V,T=(e,n)=>t=>{var o;if((n==null?void 0:n.variants)==null)return h(e,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:r,defaultVariants:i}=n,u=Object.keys(r).map(s=>{const d=t==null?void 0:t[s],c=i==null?void 0:i[s];if(d===null)return null;const v=b(d)||b(c);return r[s][v]}),l=t&&Object.entries(t).reduce((s,d)=>{let[c,v]=d;return v===void 0||(s[c]=v),s},{}),f=n==null||(o=n.compoundVariants)===null||o===void 0?void 0:o.reduce((s,d)=>{let{class:c,className:v,..._}=d;return Object.entries(_).every(C=>{let[g,p]=C;return Array.isArray(p)?p.includes({...i,...l}[g]):{...i,...l}[g]===p})?[...s,c,v]:s},[]);return h(e,u,f,t==null?void 0:t.class,t==null?void 0:t.className)},W=T("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg font-medium transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 active:scale-[0.98]",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90 hover:shadow-md",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground hover:border-slate-300",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-11 px-5 py-2.5 text-[15px] [&_svg]:size-[18px]",sm:"h-9 rounded-md px-3.5 text-sm [&_svg]:size-4",lg:"h-12 rounded-xl px-7 text-base [&_svg]:size-5",icon:"h-11 w-11 [&_svg]:size-[18px]"}},defaultVariants:{variant:"default",size:"default"}}),B=a.forwardRef(({className:e,variant:n,size:t,asChild:o=!1,...r},i)=>{const u=o?O:"button";return m.jsx(u,{className:j(W({variant:n,size:t,className:e})),ref:i,...r})});B.displayName="Button";export{B,T as a,R as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as c,u as q,P as y,d as R,f as L,b as O,a as B,a2 as Te,e as z,g as F}from"./index-DZMmAkOt.js";import{e as ye,u as H,g as we}from"./select-DS-a7suw.js";import{u as Ee}from"./index-Cg9z_5Ly.js";import{C as _e}from"./check-CuCqnFF-.js";var D="rovingFocusGroup.onEntryFocus",Fe={bubbles:!1,cancelable:!0},N="RovingFocusGroup",[G,Y,Ne]=ye(N),[Se,X]=L(N,[Ne]),[Pe,je]=Se(N),J=a.forwardRef((e,t)=>c.jsx(G.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(G.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(Ae,{...e,ref:t})})}));J.displayName=N;var Ae=a.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,orientation:n,loop:u=!1,dir:r,currentTabStopId:i,defaultCurrentTabStopId:b,onCurrentTabStopIdChange:m,onEntryFocus:v,preventScrollOnEntryFocus:s=!1,...d}=e,p=a.useRef(null),T=O(t,p),x=H(r),[k,l]=B({prop:i,defaultProp:b??null,onChange:m,caller:N}),[f,g]=a.useState(!1),h=Te(v),I=Y(o),_=a.useRef(!1),[A,S]=a.useState(0);return a.useEffect(()=>{const C=p.current;if(C)return C.addEventListener(D,h),()=>C.removeEventListener(D,h)},[h]),c.jsx(Pe,{scope:o,orientation:n,dir:x,loop:u,currentTabStopId:k,onItemFocus:a.useCallback(C=>l(C),[l]),onItemShiftTab:a.useCallback(()=>g(!0),[]),onFocusableItemAdd:a.useCallback(()=>S(C=>C+1),[]),onFocusableItemRemove:a.useCallback(()=>S(C=>C-1),[]),children:c.jsx(y.div,{tabIndex:f||A===0?-1:0,"data-orientation":n,...d,ref:T,style:{outline:"none",...e.style},onMouseDown:R(e.onMouseDown,()=>{_.current=!0}),onFocus:R(e.onFocus,C=>{const xe=!_.current;if(C.target===C.currentTarget&&xe&&!f){const V=new CustomEvent(D,Fe);if(C.currentTarget.dispatchEvent(V),!V.defaultPrevented){const M=I().filter(E=>E.focusable),Ie=M.find(E=>E.active),ke=M.find(E=>E.id===k),Re=[Ie,ke,...M].filter(Boolean).map(E=>E.ref.current);Z(Re,s)}}_.current=!1}),onBlur:R(e.onBlur,()=>g(!1))})})}),Q="RovingFocusGroupItem",W=a.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,focusable:n=!0,active:u=!1,tabStopId:r,children:i,...b}=e,m=q(),v=r||m,s=je(Q,o),d=s.currentTabStopId===v,p=Y(o),{onFocusableItemAdd:T,onFocusableItemRemove:x,currentTabStopId:k}=s;return a.useEffect(()=>{if(n)return T(),()=>x()},[n,T,x]),c.jsx(G.ItemSlot,{scope:o,id:v,focusable:n,active:u,children:c.jsx(y.span,{tabIndex:d?0:-1,"data-orientation":s.orientation,...b,ref:t,onMouseDown:R(e.onMouseDown,l=>{n?s.onItemFocus(v):l.preventDefault()}),onFocus:R(e.onFocus,()=>s.onItemFocus(v)),onKeyDown:R(e.onKeyDown,l=>{if(l.key==="Tab"&&l.shiftKey){s.onItemShiftTab();return}if(l.target!==l.currentTarget)return;const f=Ge(l,s.orientation,s.dir);if(f!==void 0){if(l.metaKey||l.ctrlKey||l.altKey||l.shiftKey)return;l.preventDefault();let h=p().filter(I=>I.focusable).map(I=>I.ref.current);if(f==="last")h.reverse();else if(f==="prev"||f==="next"){f==="prev"&&h.reverse();const I=h.indexOf(l.currentTarget);h=s.loop?Le(h,I+1):h.slice(I+1)}setTimeout(()=>Z(h))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:k!=null}):i})})});W.displayName=Q;var Me={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function De(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Ge(e,t,o){const n=De(e.key,o);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Me[n]}function Z(e,t=!1){const o=document.activeElement;for(const n of e)if(n===o||(n.focus({preventScroll:t}),document.activeElement!==o))return}function Le(e,t){return e.map((o,n)=>e[(t+n)%e.length])}var Oe=J,Be=W,P="Tabs",[Ke]=L(P,[X]),ee=X(),[Ue,K]=Ke(P),te=a.forwardRef((e,t)=>{const{__scopeTabs:o,value:n,onValueChange:u,defaultValue:r,orientation:i="horizontal",dir:b,activationMode:m="automatic",...v}=e,s=H(b),[d,p]=B({prop:n,onChange:u,defaultProp:r??"",caller:P});return c.jsx(Ue,{scope:o,baseId:q(),value:d,onValueChange:p,orientation:i,dir:s,activationMode:m,children:c.jsx(y.div,{dir:s,"data-orientation":i,...v,ref:t})})});te.displayName=P;var oe="TabsList",ne=a.forwardRef((e,t)=>{const{__scopeTabs:o,loop:n=!0,...u}=e,r=K(oe,o),i=ee(o);return c.jsx(Oe,{asChild:!0,...i,orientation:r.orientation,dir:r.dir,loop:n,children:c.jsx(y.div,{role:"tablist","aria-orientation":r.orientation,...u,ref:t})})});ne.displayName=oe;var re="TabsTrigger",ae=a.forwardRef((e,t)=>{const{__scopeTabs:o,value:n,disabled:u=!1,...r}=e,i=K(re,o),b=ee(o),m=ie(i.baseId,n),v=ue(i.baseId,n),s=n===i.value;return c.jsx(Be,{asChild:!0,...b,focusable:!u,active:s,children:c.jsx(y.button,{type:"button",role:"tab","aria-selected":s,"aria-controls":v,"data-state":s?"active":"inactive","data-disabled":u?"":void 0,disabled:u,id:m,...r,ref:t,onMouseDown:R(e.onMouseDown,d=>{!u&&d.button===0&&d.ctrlKey===!1?i.onValueChange(n):d.preventDefault()}),onKeyDown:R(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&i.onValueChange(n)}),onFocus:R(e.onFocus,()=>{const d=i.activationMode!=="manual";!s&&!u&&d&&i.onValueChange(n)})})})});ae.displayName=re;var se="TabsContent",ce=a.forwardRef((e,t)=>{const{__scopeTabs:o,value:n,forceMount:u,children:r,...i}=e,b=K(se,o),m=ie(b.baseId,n),v=ue(b.baseId,n),s=n===b.value,d=a.useRef(s);return a.useEffect(()=>{const p=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(p)},[]),c.jsx(z,{present:u||s,children:({present:p})=>c.jsx(y.div,{"data-state":s?"active":"inactive","data-orientation":b.orientation,role:"tabpanel","aria-labelledby":m,hidden:!p,id:v,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:p&&r})})});ce.displayName=se;function ie(e,t){return`${e}-trigger-${t}`}function ue(e,t){return`${e}-content-${t}`}var $e=te,de=ne,le=ae,fe=ce;const nt=$e,Ve=a.forwardRef(({className:e,...t},o)=>c.jsx(de,{ref:o,className:F("inline-flex h-11 items-center justify-center rounded-xl bg-muted p-1 text-muted-foreground gap-0.5",e),...t}));Ve.displayName=de.displayName;const qe=a.forwardRef(({className:e,...t},o)=>c.jsx(le,{ref:o,className:F("inline-flex items-center justify-center whitespace-nowrap rounded-lg px-5 py-2 text-[14px] font-medium ring-offset-background transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));qe.displayName=le.displayName;const ze=a.forwardRef(({className:e,...t},o)=>c.jsx(fe,{ref:o,className:F("mt-3 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 animate-fade-in",e),...t}));ze.displayName=fe.displayName;var j="Checkbox",[He]=L(j),[Ye,U]=He(j);function Xe(e){const{__scopeCheckbox:t,checked:o,children:n,defaultChecked:u,disabled:r,form:i,name:b,onCheckedChange:m,required:v,value:s="on",internal_do_not_use_render:d}=e,[p,T]=B({prop:o,defaultProp:u??!1,onChange:m,caller:j}),[x,k]=a.useState(null),[l,f]=a.useState(null),g=a.useRef(!1),h=x?!!i||!!x.closest("form"):!0,I={checked:p,disabled:r,setChecked:T,control:x,setControl:k,name:b,form:i,value:s,hasConsumerStoppedPropagationRef:g,required:v,defaultChecked:w(u)?!1:u,isFormControl:h,bubbleInput:l,setBubbleInput:f};return c.jsx(Ye,{scope:t,...I,children:Je(d)?d(I):n})}var be="CheckboxTrigger",pe=a.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:o,...n},u)=>{const{control:r,value:i,disabled:b,checked:m,required:v,setControl:s,setChecked:d,hasConsumerStoppedPropagationRef:p,isFormControl:T,bubbleInput:x}=U(be,e),k=O(u,s),l=a.useRef(m);return a.useEffect(()=>{const f=r==null?void 0:r.form;if(f){const g=()=>d(l.current);return f.addEventListener("reset",g),()=>f.removeEventListener("reset",g)}},[r,d]),c.jsx(y.button,{type:"button",role:"checkbox","aria-checked":w(m)?"mixed":m,"aria-required":v,"data-state":Ce(m),"data-disabled":b?"":void 0,disabled:b,value:i,...n,ref:k,onKeyDown:R(t,f=>{f.key==="Enter"&&f.preventDefault()}),onClick:R(o,f=>{d(g=>w(g)?!0:!g),x&&T&&(p.current=f.isPropagationStopped(),p.current||f.stopPropagation())})})});pe.displayName=be;var $=a.forwardRef((e,t)=>{const{__scopeCheckbox:o,name:n,checked:u,defaultChecked:r,required:i,disabled:b,value:m,onCheckedChange:v,form:s,...d}=e;return c.jsx(Xe,{__scopeCheckbox:o,checked:u,defaultChecked:r,disabled:b,required:i,onCheckedChange:v,name:n,form:s,value:m,internal_do_not_use_render:({isFormControl:p})=>c.jsxs(c.Fragment,{children:[c.jsx(pe,{...d,ref:t,__scopeCheckbox:o}),p&&c.jsx(he,{__scopeCheckbox:o})]})})});$.displayName=j;var me="CheckboxIndicator",ve=a.forwardRef((e,t)=>{const{__scopeCheckbox:o,forceMount:n,...u}=e,r=U(me,o);return c.jsx(z,{present:n||w(r.checked)||r.checked===!0,children:c.jsx(y.span,{"data-state":Ce(r.checked),"data-disabled":r.disabled?"":void 0,...u,ref:t,style:{pointerEvents:"none",...e.style}})})});ve.displayName=me;var ge="CheckboxBubbleInput",he=a.forwardRef(({__scopeCheckbox:e,...t},o)=>{const{control:n,hasConsumerStoppedPropagationRef:u,checked:r,defaultChecked:i,required:b,disabled:m,name:v,value:s,form:d,bubbleInput:p,setBubbleInput:T}=U(ge,e),x=O(o,T),k=we(r),l=Ee(n);a.useEffect(()=>{const g=p;if(!g)return;const h=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(h,"checked").set,A=!u.current;if(k!==r&&_){const S=new Event("click",{bubbles:A});g.indeterminate=w(r),_.call(g,w(r)?!1:r),g.dispatchEvent(S)}},[p,k,r,u]);const f=a.useRef(w(r)?!1:r);return c.jsx(y.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??f.current,required:b,disabled:m,name:v,value:s,form:d,...t,tabIndex:-1,ref:x,style:{...t.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});he.displayName=ge;function Je(e){return typeof e=="function"}function w(e){return e==="indeterminate"}function Ce(e){return w(e)?"indeterminate":e?"checked":"unchecked"}const Qe=a.forwardRef(({className:e,...t},o)=>c.jsx($,{ref:o,className:F("peer h-5 w-5 shrink-0 rounded-md border-2 border-primary shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground transition-all duration-150",e),...t,children:c.jsx(ve,{className:F("flex items-center justify-center text-current"),children:c.jsx(_e,{className:"h-3.5 w-3.5 stroke-[3]"})})}));Qe.displayName=$.displayName;export{Qe as C,Be as I,Oe as R,nt as T,Ve as a,qe as b,X as c,ze as d};
|
|
1
|
+
import{r as a,j as c,u as q,P as y,d as R,f as L,b as O,a as B,a2 as Te,e as z,g as F}from"./index-CBybCNw9.js";import{e as ye,u as H,g as we}from"./select-43JIRBNM.js";import{u as Ee}from"./index-CQBLo7m8.js";import{C as _e}from"./check-B5gBbN7b.js";var D="rovingFocusGroup.onEntryFocus",Fe={bubbles:!1,cancelable:!0},N="RovingFocusGroup",[G,Y,Ne]=ye(N),[Se,X]=L(N,[Ne]),[Pe,je]=Se(N),J=a.forwardRef((e,t)=>c.jsx(G.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(G.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(Ae,{...e,ref:t})})}));J.displayName=N;var Ae=a.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,orientation:n,loop:u=!1,dir:r,currentTabStopId:i,defaultCurrentTabStopId:b,onCurrentTabStopIdChange:m,onEntryFocus:v,preventScrollOnEntryFocus:s=!1,...d}=e,p=a.useRef(null),T=O(t,p),x=H(r),[k,l]=B({prop:i,defaultProp:b??null,onChange:m,caller:N}),[f,g]=a.useState(!1),h=Te(v),I=Y(o),_=a.useRef(!1),[A,S]=a.useState(0);return a.useEffect(()=>{const C=p.current;if(C)return C.addEventListener(D,h),()=>C.removeEventListener(D,h)},[h]),c.jsx(Pe,{scope:o,orientation:n,dir:x,loop:u,currentTabStopId:k,onItemFocus:a.useCallback(C=>l(C),[l]),onItemShiftTab:a.useCallback(()=>g(!0),[]),onFocusableItemAdd:a.useCallback(()=>S(C=>C+1),[]),onFocusableItemRemove:a.useCallback(()=>S(C=>C-1),[]),children:c.jsx(y.div,{tabIndex:f||A===0?-1:0,"data-orientation":n,...d,ref:T,style:{outline:"none",...e.style},onMouseDown:R(e.onMouseDown,()=>{_.current=!0}),onFocus:R(e.onFocus,C=>{const xe=!_.current;if(C.target===C.currentTarget&&xe&&!f){const V=new CustomEvent(D,Fe);if(C.currentTarget.dispatchEvent(V),!V.defaultPrevented){const M=I().filter(E=>E.focusable),Ie=M.find(E=>E.active),ke=M.find(E=>E.id===k),Re=[Ie,ke,...M].filter(Boolean).map(E=>E.ref.current);Z(Re,s)}}_.current=!1}),onBlur:R(e.onBlur,()=>g(!1))})})}),Q="RovingFocusGroupItem",W=a.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:o,focusable:n=!0,active:u=!1,tabStopId:r,children:i,...b}=e,m=q(),v=r||m,s=je(Q,o),d=s.currentTabStopId===v,p=Y(o),{onFocusableItemAdd:T,onFocusableItemRemove:x,currentTabStopId:k}=s;return a.useEffect(()=>{if(n)return T(),()=>x()},[n,T,x]),c.jsx(G.ItemSlot,{scope:o,id:v,focusable:n,active:u,children:c.jsx(y.span,{tabIndex:d?0:-1,"data-orientation":s.orientation,...b,ref:t,onMouseDown:R(e.onMouseDown,l=>{n?s.onItemFocus(v):l.preventDefault()}),onFocus:R(e.onFocus,()=>s.onItemFocus(v)),onKeyDown:R(e.onKeyDown,l=>{if(l.key==="Tab"&&l.shiftKey){s.onItemShiftTab();return}if(l.target!==l.currentTarget)return;const f=Ge(l,s.orientation,s.dir);if(f!==void 0){if(l.metaKey||l.ctrlKey||l.altKey||l.shiftKey)return;l.preventDefault();let h=p().filter(I=>I.focusable).map(I=>I.ref.current);if(f==="last")h.reverse();else if(f==="prev"||f==="next"){f==="prev"&&h.reverse();const I=h.indexOf(l.currentTarget);h=s.loop?Le(h,I+1):h.slice(I+1)}setTimeout(()=>Z(h))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:k!=null}):i})})});W.displayName=Q;var Me={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function De(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Ge(e,t,o){const n=De(e.key,o);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Me[n]}function Z(e,t=!1){const o=document.activeElement;for(const n of e)if(n===o||(n.focus({preventScroll:t}),document.activeElement!==o))return}function Le(e,t){return e.map((o,n)=>e[(t+n)%e.length])}var Oe=J,Be=W,P="Tabs",[Ke]=L(P,[X]),ee=X(),[Ue,K]=Ke(P),te=a.forwardRef((e,t)=>{const{__scopeTabs:o,value:n,onValueChange:u,defaultValue:r,orientation:i="horizontal",dir:b,activationMode:m="automatic",...v}=e,s=H(b),[d,p]=B({prop:n,onChange:u,defaultProp:r??"",caller:P});return c.jsx(Ue,{scope:o,baseId:q(),value:d,onValueChange:p,orientation:i,dir:s,activationMode:m,children:c.jsx(y.div,{dir:s,"data-orientation":i,...v,ref:t})})});te.displayName=P;var oe="TabsList",ne=a.forwardRef((e,t)=>{const{__scopeTabs:o,loop:n=!0,...u}=e,r=K(oe,o),i=ee(o);return c.jsx(Oe,{asChild:!0,...i,orientation:r.orientation,dir:r.dir,loop:n,children:c.jsx(y.div,{role:"tablist","aria-orientation":r.orientation,...u,ref:t})})});ne.displayName=oe;var re="TabsTrigger",ae=a.forwardRef((e,t)=>{const{__scopeTabs:o,value:n,disabled:u=!1,...r}=e,i=K(re,o),b=ee(o),m=ie(i.baseId,n),v=ue(i.baseId,n),s=n===i.value;return c.jsx(Be,{asChild:!0,...b,focusable:!u,active:s,children:c.jsx(y.button,{type:"button",role:"tab","aria-selected":s,"aria-controls":v,"data-state":s?"active":"inactive","data-disabled":u?"":void 0,disabled:u,id:m,...r,ref:t,onMouseDown:R(e.onMouseDown,d=>{!u&&d.button===0&&d.ctrlKey===!1?i.onValueChange(n):d.preventDefault()}),onKeyDown:R(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&i.onValueChange(n)}),onFocus:R(e.onFocus,()=>{const d=i.activationMode!=="manual";!s&&!u&&d&&i.onValueChange(n)})})})});ae.displayName=re;var se="TabsContent",ce=a.forwardRef((e,t)=>{const{__scopeTabs:o,value:n,forceMount:u,children:r,...i}=e,b=K(se,o),m=ie(b.baseId,n),v=ue(b.baseId,n),s=n===b.value,d=a.useRef(s);return a.useEffect(()=>{const p=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(p)},[]),c.jsx(z,{present:u||s,children:({present:p})=>c.jsx(y.div,{"data-state":s?"active":"inactive","data-orientation":b.orientation,role:"tabpanel","aria-labelledby":m,hidden:!p,id:v,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:p&&r})})});ce.displayName=se;function ie(e,t){return`${e}-trigger-${t}`}function ue(e,t){return`${e}-content-${t}`}var $e=te,de=ne,le=ae,fe=ce;const nt=$e,Ve=a.forwardRef(({className:e,...t},o)=>c.jsx(de,{ref:o,className:F("inline-flex h-11 items-center justify-center rounded-xl bg-muted p-1 text-muted-foreground gap-0.5",e),...t}));Ve.displayName=de.displayName;const qe=a.forwardRef(({className:e,...t},o)=>c.jsx(le,{ref:o,className:F("inline-flex items-center justify-center whitespace-nowrap rounded-lg px-5 py-2 text-[14px] font-medium ring-offset-background transition-all duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));qe.displayName=le.displayName;const ze=a.forwardRef(({className:e,...t},o)=>c.jsx(fe,{ref:o,className:F("mt-3 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 animate-fade-in",e),...t}));ze.displayName=fe.displayName;var j="Checkbox",[He]=L(j),[Ye,U]=He(j);function Xe(e){const{__scopeCheckbox:t,checked:o,children:n,defaultChecked:u,disabled:r,form:i,name:b,onCheckedChange:m,required:v,value:s="on",internal_do_not_use_render:d}=e,[p,T]=B({prop:o,defaultProp:u??!1,onChange:m,caller:j}),[x,k]=a.useState(null),[l,f]=a.useState(null),g=a.useRef(!1),h=x?!!i||!!x.closest("form"):!0,I={checked:p,disabled:r,setChecked:T,control:x,setControl:k,name:b,form:i,value:s,hasConsumerStoppedPropagationRef:g,required:v,defaultChecked:w(u)?!1:u,isFormControl:h,bubbleInput:l,setBubbleInput:f};return c.jsx(Ye,{scope:t,...I,children:Je(d)?d(I):n})}var be="CheckboxTrigger",pe=a.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:o,...n},u)=>{const{control:r,value:i,disabled:b,checked:m,required:v,setControl:s,setChecked:d,hasConsumerStoppedPropagationRef:p,isFormControl:T,bubbleInput:x}=U(be,e),k=O(u,s),l=a.useRef(m);return a.useEffect(()=>{const f=r==null?void 0:r.form;if(f){const g=()=>d(l.current);return f.addEventListener("reset",g),()=>f.removeEventListener("reset",g)}},[r,d]),c.jsx(y.button,{type:"button",role:"checkbox","aria-checked":w(m)?"mixed":m,"aria-required":v,"data-state":Ce(m),"data-disabled":b?"":void 0,disabled:b,value:i,...n,ref:k,onKeyDown:R(t,f=>{f.key==="Enter"&&f.preventDefault()}),onClick:R(o,f=>{d(g=>w(g)?!0:!g),x&&T&&(p.current=f.isPropagationStopped(),p.current||f.stopPropagation())})})});pe.displayName=be;var $=a.forwardRef((e,t)=>{const{__scopeCheckbox:o,name:n,checked:u,defaultChecked:r,required:i,disabled:b,value:m,onCheckedChange:v,form:s,...d}=e;return c.jsx(Xe,{__scopeCheckbox:o,checked:u,defaultChecked:r,disabled:b,required:i,onCheckedChange:v,name:n,form:s,value:m,internal_do_not_use_render:({isFormControl:p})=>c.jsxs(c.Fragment,{children:[c.jsx(pe,{...d,ref:t,__scopeCheckbox:o}),p&&c.jsx(he,{__scopeCheckbox:o})]})})});$.displayName=j;var me="CheckboxIndicator",ve=a.forwardRef((e,t)=>{const{__scopeCheckbox:o,forceMount:n,...u}=e,r=U(me,o);return c.jsx(z,{present:n||w(r.checked)||r.checked===!0,children:c.jsx(y.span,{"data-state":Ce(r.checked),"data-disabled":r.disabled?"":void 0,...u,ref:t,style:{pointerEvents:"none",...e.style}})})});ve.displayName=me;var ge="CheckboxBubbleInput",he=a.forwardRef(({__scopeCheckbox:e,...t},o)=>{const{control:n,hasConsumerStoppedPropagationRef:u,checked:r,defaultChecked:i,required:b,disabled:m,name:v,value:s,form:d,bubbleInput:p,setBubbleInput:T}=U(ge,e),x=O(o,T),k=we(r),l=Ee(n);a.useEffect(()=>{const g=p;if(!g)return;const h=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(h,"checked").set,A=!u.current;if(k!==r&&_){const S=new Event("click",{bubbles:A});g.indeterminate=w(r),_.call(g,w(r)?!1:r),g.dispatchEvent(S)}},[p,k,r,u]);const f=a.useRef(w(r)?!1:r);return c.jsx(y.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??f.current,required:b,disabled:m,name:v,value:s,form:d,...t,tabIndex:-1,ref:x,style:{...t.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});he.displayName=ge;function Je(e){return typeof e=="function"}function w(e){return e==="indeterminate"}function Ce(e){return w(e)?"indeterminate":e?"checked":"unchecked"}const Qe=a.forwardRef(({className:e,...t},o)=>c.jsx($,{ref:o,className:F("peer h-5 w-5 shrink-0 rounded-md border-2 border-primary shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground transition-all duration-150",e),...t,children:c.jsx(ve,{className:F("flex items-center justify-center text-current"),children:c.jsx(_e,{className:"h-3.5 w-3.5 stroke-[3]"})})}));Qe.displayName=$.displayName;export{Qe as C,Be as I,Oe as R,nt as T,Ve as a,qe as b,X as c,ze as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as Ee,j as e,g as $,r as c,a1 as Me,a2 as Ke,f as We,e as ye,a3 as Wt,b as xe,d as E,P as ie,a4 as zt,a5 as qt,a6 as Ht,a7 as Xt,a8 as Yt,D as Jt,a as Qt,u as Fe,C as Zt,_ as ze,S as en,E as tn,a9 as nn,q as sn,t as an,X as rn,aa as on,ab as ln,ac as cn,$ as z}from"./index-
|
|
1
|
+
import{c as Ee,j as e,g as $,r as c,a1 as Me,a2 as Ke,f as We,e as ye,a3 as Wt,b as xe,d as E,P as ie,a4 as zt,a5 as qt,a6 as Ht,a7 as Xt,a8 as Yt,D as Jt,a as Qt,u as Fe,C as Zt,_ as ze,S as en,E as tn,a9 as nn,q as sn,t as an,X as rn,aa as on,ab as ln,ac as cn,$ as z}from"./index-CBybCNw9.js";import{S as dn,a as un,b as pn,c as mn,e as xn}from"./sheet-BqcXrPMk.js";import{B as J}from"./button-BTb_K7ly.js";import{I as D}from"./input-BqURNT6_.js";import{L as b}from"./label-DN_udu84.js";import{u as fn,e as hn,S as ae,a as re,b as oe,c as le,d as T,C as gn,f as vn}from"./select-43JIRBNM.js";import{R as bn,A as jn,c as qe,C as Nn,b as yn}from"./index-CQBLo7m8.js";import{c as He,I as wn,R as Cn,C as ce,T as Rn,a as Sn,b as ve,d as be}from"./checkbox-Bzr8Mz_N.js";import{C as En}from"./check-B5gBbN7b.js";import{C as Mn}from"./empty-state-CcADzW37.js";import{B as Xe}from"./badge-DrRXUb2i.js";import{L as Ue}from"./loading-spinner-CYvUxGAE.js";/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -16,4 +16,4 @@ import{c as Ee,j as e,g as $,r as c,a1 as Me,a2 as Ke,f as We,e as ye,a3 as Wt,b
|
|
|
16
16
|
*/const An=Ee("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);function Dn({type:t,className:a}){const s={base:"bg-blue-100 text-blue-700",auth:"bg-green-100 text-green-700",view:"bg-amber-100 text-amber-700"};return e.jsx("span",{className:$("inline-flex items-center rounded-md px-2 py-0.5 text-xs font-medium",s[t]||"bg-slate-100 text-slate-600",a),children:t})}function _n(t){const a=Pn(t),s=c.forwardRef((n,r)=>{const{children:o,...l}=n,i=c.Children.toArray(o),u=i.find(kn);if(u){const x=u.props.children,m=i.map(d=>d===u?c.Children.count(x)>1?c.Children.only(null):c.isValidElement(x)?x.props.children:null:d);return e.jsx(a,{...l,ref:r,children:c.isValidElement(x)?c.cloneElement(x,void 0,m):null})}return e.jsx(a,{...l,ref:r,children:o})});return s.displayName=`${t}.Slot`,s}function Pn(t){const a=c.forwardRef((s,n)=>{const{children:r,...o}=s;if(c.isValidElement(r)){const l=Fn(r),i=On(o,r.props);return r.type!==c.Fragment&&(i.ref=n?Me(n,l):l),c.cloneElement(r,i)}return c.Children.count(r)>1?c.Children.only(null):null});return a.displayName=`${t}.SlotClone`,a}var Ln=Symbol("radix.slottable");function kn(t){return c.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Ln}function On(t,a){const s={...a};for(const n in a){const r=t[n],o=a[n];/^on[A-Z]/.test(n)?r&&o?s[n]=(...i)=>{const u=o(...i);return r(...i),u}:r&&(s[n]=r):n==="style"?s[n]={...r,...o}:n==="className"&&(s[n]=[r,o].filter(Boolean).join(" "))}return{...t,...s}}function Fn(t){var n,r;let a=(n=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:n.get,s=a&&"isReactWarning"in a&&a.isReactWarning;return s?t.ref:(a=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,s=a&&"isReactWarning"in a&&a.isReactWarning,s?t.props.ref:t.props.ref||t.ref)}var Se=["Enter"," "],Un=["ArrowDown","PageUp","Home"],Ye=["ArrowUp","PageDown","End"],Gn=[...Un,...Ye],$n={ltr:[...Se,"ArrowRight"],rtl:[...Se,"ArrowLeft"]},Vn={ltr:["ArrowLeft"],rtl:["ArrowRight"]},fe="Menu",[pe,Bn,Kn]=hn(fe),[ee,Je]=We(fe,[Kn,qe,He]),we=qe(),Qe=He(),[Wn,te]=ee(fe),[zn,he]=ee(fe),Ze=t=>{const{__scopeMenu:a,open:s=!1,children:n,dir:r,onOpenChange:o,modal:l=!0}=t,i=we(a),[u,x]=c.useState(null),m=c.useRef(!1),d=Ke(o),p=fn(r);return c.useEffect(()=>{const N=()=>{m.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>m.current=!1;return document.addEventListener("keydown",N,{capture:!0}),()=>{document.removeEventListener("keydown",N,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),e.jsx(bn,{...i,children:e.jsx(Wn,{scope:a,open:s,onOpenChange:d,content:u,onContentChange:x,children:e.jsx(zn,{scope:a,onClose:c.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:m,dir:p,modal:l,children:n})})})};Ze.displayName=fe;var qn="MenuAnchor",Ie=c.forwardRef((t,a)=>{const{__scopeMenu:s,...n}=t,r=we(s);return e.jsx(jn,{...r,...n,ref:a})});Ie.displayName=qn;var Te="MenuPortal",[Hn,et]=ee(Te,{forceMount:void 0}),tt=t=>{const{__scopeMenu:a,forceMount:s,children:n,container:r}=t,o=te(Te,a);return e.jsx(Hn,{scope:a,forceMount:s,children:e.jsx(ye,{present:s||o.open,children:e.jsx(Wt,{asChild:!0,container:r,children:n})})})};tt.displayName=Te;var K="MenuContent",[Xn,Ae]=ee(K),nt=c.forwardRef((t,a)=>{const s=et(K,t.__scopeMenu),{forceMount:n=s.forceMount,...r}=t,o=te(K,t.__scopeMenu),l=he(K,t.__scopeMenu);return e.jsx(pe.Provider,{scope:t.__scopeMenu,children:e.jsx(ye,{present:n||o.open,children:e.jsx(pe.Slot,{scope:t.__scopeMenu,children:l.modal?e.jsx(Yn,{...r,ref:a}):e.jsx(Jn,{...r,ref:a})})})})}),Yn=c.forwardRef((t,a)=>{const s=te(K,t.__scopeMenu),n=c.useRef(null),r=xe(a,n);return c.useEffect(()=>{const o=n.current;if(o)return zt(o)},[]),e.jsx(De,{...t,ref:r,trapFocus:s.open,disableOutsidePointerEvents:s.open,disableOutsideScroll:!0,onFocusOutside:E(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>s.onOpenChange(!1)})}),Jn=c.forwardRef((t,a)=>{const s=te(K,t.__scopeMenu);return e.jsx(De,{...t,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>s.onOpenChange(!1)})}),Qn=_n("MenuContent.ScrollLock"),De=c.forwardRef((t,a)=>{const{__scopeMenu:s,loop:n=!1,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:i,onEntryFocus:u,onEscapeKeyDown:x,onPointerDownOutside:m,onFocusOutside:d,onInteractOutside:p,onDismiss:N,disableOutsideScroll:y,...C}=t,V=te(K,s),L=he(K,s),O=we(s),F=Qe(s),H=Bn(s),[X,Q]=c.useState(null),q=c.useRef(null),g=xe(a,q,V.onContentChange),v=c.useRef(0),w=c.useRef(""),_=c.useRef(0),P=c.useRef(null),A=c.useRef("right"),h=c.useRef(0),R=y?Xt:c.Fragment,M=y?{as:Qn,allowPinchZoom:!0}:void 0,U=f=>{var ne,ke;const I=w.current+f,j=H().filter(Y=>!Y.disabled),S=document.activeElement,B=(ne=j.find(Y=>Y.ref.current===S))==null?void 0:ne.textValue,Z=j.map(Y=>Y.textValue),de=ds(Z,I,B),W=(ke=j.find(Y=>Y.textValue===de))==null?void 0:ke.ref.current;(function Y(Oe){w.current=Oe,window.clearTimeout(v.current),Oe!==""&&(v.current=window.setTimeout(()=>Y(""),1e3))})(I),W&&setTimeout(()=>W.focus())};c.useEffect(()=>()=>window.clearTimeout(v.current),[]),Ht();const G=c.useCallback(f=>{var j,S;return A.current===((j=P.current)==null?void 0:j.side)&&ps(f,(S=P.current)==null?void 0:S.area)},[]);return e.jsx(Xn,{scope:s,searchRef:w,onItemEnter:c.useCallback(f=>{G(f)&&f.preventDefault()},[G]),onItemLeave:c.useCallback(f=>{var I;G(f)||((I=q.current)==null||I.focus(),Q(null))},[G]),onTriggerLeave:c.useCallback(f=>{G(f)&&f.preventDefault()},[G]),pointerGraceTimerRef:_,onPointerGraceIntentChange:c.useCallback(f=>{P.current=f},[]),children:e.jsx(R,{...M,children:e.jsx(Yt,{asChild:!0,trapped:r,onMountAutoFocus:E(o,f=>{var I;f.preventDefault(),(I=q.current)==null||I.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:e.jsx(Jt,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:x,onPointerDownOutside:m,onFocusOutside:d,onInteractOutside:p,onDismiss:N,children:e.jsx(Cn,{asChild:!0,...F,dir:L.dir,orientation:"vertical",loop:n,currentTabStopId:X,onCurrentTabStopIdChange:Q,onEntryFocus:E(u,f=>{L.isUsingKeyboardRef.current||f.preventDefault()}),preventScrollOnEntryFocus:!0,children:e.jsx(Nn,{role:"menu","aria-orientation":"vertical","data-state":vt(V.open),"data-radix-menu-content":"",dir:L.dir,...O,...C,ref:g,style:{outline:"none",...C.style},onKeyDown:E(C.onKeyDown,f=>{const j=f.target.closest("[data-radix-menu-content]")===f.currentTarget,S=f.ctrlKey||f.altKey||f.metaKey,B=f.key.length===1;j&&(f.key==="Tab"&&f.preventDefault(),!S&&B&&U(f.key));const Z=q.current;if(f.target!==Z||!Gn.includes(f.key))return;f.preventDefault();const W=H().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);Ye.includes(f.key)&&W.reverse(),cs(W)}),onBlur:E(t.onBlur,f=>{f.currentTarget.contains(f.target)||(window.clearTimeout(v.current),w.current="")}),onPointerMove:E(t.onPointerMove,me(f=>{const I=f.target,j=h.current!==f.clientX;if(f.currentTarget.contains(I)&&j){const S=f.clientX>h.current?"right":"left";A.current=S,h.current=f.clientX}}))})})})})})})});nt.displayName=K;var Zn="MenuGroup",_e=c.forwardRef((t,a)=>{const{__scopeMenu:s,...n}=t;return e.jsx(ie.div,{role:"group",...n,ref:a})});_e.displayName=Zn;var es="MenuLabel",st=c.forwardRef((t,a)=>{const{__scopeMenu:s,...n}=t;return e.jsx(ie.div,{...n,ref:a})});st.displayName=es;var je="MenuItem",Ge="menu.itemSelect",Ce=c.forwardRef((t,a)=>{const{disabled:s=!1,onSelect:n,...r}=t,o=c.useRef(null),l=he(je,t.__scopeMenu),i=Ae(je,t.__scopeMenu),u=xe(a,o),x=c.useRef(!1),m=()=>{const d=o.current;if(!s&&d){const p=new CustomEvent(Ge,{bubbles:!0,cancelable:!0});d.addEventListener(Ge,N=>n==null?void 0:n(N),{once:!0}),qt(d,p),p.defaultPrevented?x.current=!1:l.onClose()}};return e.jsx(at,{...r,ref:u,disabled:s,onClick:E(t.onClick,m),onPointerDown:d=>{var p;(p=t.onPointerDown)==null||p.call(t,d),x.current=!0},onPointerUp:E(t.onPointerUp,d=>{var p;x.current||(p=d.currentTarget)==null||p.click()}),onKeyDown:E(t.onKeyDown,d=>{const p=i.searchRef.current!=="";s||p&&d.key===" "||Se.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});Ce.displayName=je;var at=c.forwardRef((t,a)=>{const{__scopeMenu:s,disabled:n=!1,textValue:r,...o}=t,l=Ae(je,s),i=Qe(s),u=c.useRef(null),x=xe(a,u),[m,d]=c.useState(!1),[p,N]=c.useState("");return c.useEffect(()=>{const y=u.current;y&&N((y.textContent??"").trim())},[o.children]),e.jsx(pe.ItemSlot,{scope:s,disabled:n,textValue:r??p,children:e.jsx(wn,{asChild:!0,...i,focusable:!n,children:e.jsx(ie.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:x,onPointerMove:E(t.onPointerMove,me(y=>{n?l.onItemLeave(y):(l.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:E(t.onPointerLeave,me(y=>l.onItemLeave(y))),onFocus:E(t.onFocus,()=>d(!0)),onBlur:E(t.onBlur,()=>d(!1))})})})}),ts="MenuCheckboxItem",rt=c.forwardRef((t,a)=>{const{checked:s=!1,onCheckedChange:n,...r}=t;return e.jsx(dt,{scope:t.__scopeMenu,checked:s,children:e.jsx(Ce,{role:"menuitemcheckbox","aria-checked":Ne(s)?"mixed":s,...r,ref:a,"data-state":Le(s),onSelect:E(r.onSelect,()=>n==null?void 0:n(Ne(s)?!0:!s),{checkForDefaultPrevented:!1})})})});rt.displayName=ts;var ot="MenuRadioGroup",[ns,ss]=ee(ot,{value:void 0,onValueChange:()=>{}}),lt=c.forwardRef((t,a)=>{const{value:s,onValueChange:n,...r}=t,o=Ke(n);return e.jsx(ns,{scope:t.__scopeMenu,value:s,onValueChange:o,children:e.jsx(_e,{...r,ref:a})})});lt.displayName=ot;var ct="MenuRadioItem",it=c.forwardRef((t,a)=>{const{value:s,...n}=t,r=ss(ct,t.__scopeMenu),o=s===r.value;return e.jsx(dt,{scope:t.__scopeMenu,checked:o,children:e.jsx(Ce,{role:"menuitemradio","aria-checked":o,...n,ref:a,"data-state":Le(o),onSelect:E(n.onSelect,()=>{var l;return(l=r.onValueChange)==null?void 0:l.call(r,s)},{checkForDefaultPrevented:!1})})})});it.displayName=ct;var Pe="MenuItemIndicator",[dt,as]=ee(Pe,{checked:!1}),ut=c.forwardRef((t,a)=>{const{__scopeMenu:s,forceMount:n,...r}=t,o=as(Pe,s);return e.jsx(ye,{present:n||Ne(o.checked)||o.checked===!0,children:e.jsx(ie.span,{...r,ref:a,"data-state":Le(o.checked)})})});ut.displayName=Pe;var rs="MenuSeparator",pt=c.forwardRef((t,a)=>{const{__scopeMenu:s,...n}=t;return e.jsx(ie.div,{role:"separator","aria-orientation":"horizontal",...n,ref:a})});pt.displayName=rs;var os="MenuArrow",mt=c.forwardRef((t,a)=>{const{__scopeMenu:s,...n}=t,r=we(s);return e.jsx(yn,{...r,...n,ref:a})});mt.displayName=os;var ls="MenuSub",[Da,xt]=ee(ls),ue="MenuSubTrigger",ft=c.forwardRef((t,a)=>{const s=te(ue,t.__scopeMenu),n=he(ue,t.__scopeMenu),r=xt(ue,t.__scopeMenu),o=Ae(ue,t.__scopeMenu),l=c.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:u}=o,x={__scopeMenu:t.__scopeMenu},m=c.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return c.useEffect(()=>m,[m]),c.useEffect(()=>{const d=i.current;return()=>{window.clearTimeout(d),u(null)}},[i,u]),e.jsx(Ie,{asChild:!0,...x,children:e.jsx(at,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":r.contentId,"data-state":vt(s.open),...t,ref:Me(a,r.onTriggerChange),onClick:d=>{var p;(p=t.onClick)==null||p.call(t,d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),s.open||s.onOpenChange(!0))},onPointerMove:E(t.onPointerMove,me(d=>{o.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!s.open&&!l.current&&(o.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{s.onOpenChange(!0),m()},100))})),onPointerLeave:E(t.onPointerLeave,me(d=>{var N,y;m();const p=(N=s.content)==null?void 0:N.getBoundingClientRect();if(p){const C=(y=s.content)==null?void 0:y.dataset.side,V=C==="right",L=V?-5:5,O=p[V?"left":"right"],F=p[V?"right":"left"];o.onPointerGraceIntentChange({area:[{x:d.clientX+L,y:d.clientY},{x:O,y:p.top},{x:F,y:p.top},{x:F,y:p.bottom},{x:O,y:p.bottom}],side:C}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(d),d.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:E(t.onKeyDown,d=>{var N;const p=o.searchRef.current!=="";t.disabled||p&&d.key===" "||$n[n.dir].includes(d.key)&&(s.onOpenChange(!0),(N=s.content)==null||N.focus(),d.preventDefault())})})})});ft.displayName=ue;var ht="MenuSubContent",gt=c.forwardRef((t,a)=>{const s=et(K,t.__scopeMenu),{forceMount:n=s.forceMount,...r}=t,o=te(K,t.__scopeMenu),l=he(K,t.__scopeMenu),i=xt(ht,t.__scopeMenu),u=c.useRef(null),x=xe(a,u);return e.jsx(pe.Provider,{scope:t.__scopeMenu,children:e.jsx(ye,{present:n||o.open,children:e.jsx(pe.Slot,{scope:t.__scopeMenu,children:e.jsx(De,{id:i.contentId,"aria-labelledby":i.triggerId,...r,ref:x,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{var d;l.isUsingKeyboardRef.current&&((d=u.current)==null||d.focus()),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:E(t.onFocusOutside,m=>{m.target!==i.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:E(t.onEscapeKeyDown,m=>{l.onClose(),m.preventDefault()}),onKeyDown:E(t.onKeyDown,m=>{var N;const d=m.currentTarget.contains(m.target),p=Vn[l.dir].includes(m.key);d&&p&&(o.onOpenChange(!1),(N=i.trigger)==null||N.focus(),m.preventDefault())})})})})})});gt.displayName=ht;function vt(t){return t?"open":"closed"}function Ne(t){return t==="indeterminate"}function Le(t){return Ne(t)?"indeterminate":t?"checked":"unchecked"}function cs(t){const a=document.activeElement;for(const s of t)if(s===a||(s.focus(),document.activeElement!==a))return}function is(t,a){return t.map((s,n)=>t[(a+n)%t.length])}function ds(t,a,s){const r=a.length>1&&Array.from(a).every(x=>x===a[0])?a[0]:a,o=s?t.indexOf(s):-1;let l=is(t,Math.max(o,0));r.length===1&&(l=l.filter(x=>x!==s));const u=l.find(x=>x.toLowerCase().startsWith(r.toLowerCase()));return u!==s?u:void 0}function us(t,a){const{x:s,y:n}=t;let r=!1;for(let o=0,l=a.length-1;o<a.length;l=o++){const i=a[o],u=a[l],x=i.x,m=i.y,d=u.x,p=u.y;m>n!=p>n&&s<(d-x)*(n-m)/(p-m)+x&&(r=!r)}return r}function ps(t,a){if(!a)return!1;const s={x:t.clientX,y:t.clientY};return us(s,a)}function me(t){return a=>a.pointerType==="mouse"?t(a):void 0}var ms=Ze,xs=Ie,fs=tt,hs=nt,gs=_e,vs=st,bs=Ce,js=rt,Ns=lt,ys=it,ws=ut,Cs=pt,Rs=mt,Ss=ft,Es=gt,Re="DropdownMenu",[Ms]=We(Re,[Je]),k=Je(),[Is,bt]=Ms(Re),jt=t=>{const{__scopeDropdownMenu:a,children:s,dir:n,open:r,defaultOpen:o,onOpenChange:l,modal:i=!0}=t,u=k(a),x=c.useRef(null),[m,d]=Qt({prop:r,defaultProp:o??!1,onChange:l,caller:Re});return e.jsx(Is,{scope:a,triggerId:Fe(),triggerRef:x,contentId:Fe(),open:m,onOpenChange:d,onOpenToggle:c.useCallback(()=>d(p=>!p),[d]),modal:i,children:e.jsx(ms,{...u,open:m,onOpenChange:d,dir:n,modal:i,children:s})})};jt.displayName=Re;var Nt="DropdownMenuTrigger",yt=c.forwardRef((t,a)=>{const{__scopeDropdownMenu:s,disabled:n=!1,...r}=t,o=bt(Nt,s),l=k(s);return e.jsx(xs,{asChild:!0,...l,children:e.jsx(ie.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...r,ref:Me(a,o.triggerRef),onPointerDown:E(t.onPointerDown,i=>{!n&&i.button===0&&i.ctrlKey===!1&&(o.onOpenToggle(),o.open||i.preventDefault())}),onKeyDown:E(t.onKeyDown,i=>{n||(["Enter"," "].includes(i.key)&&o.onOpenToggle(),i.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});yt.displayName=Nt;var Ts="DropdownMenuPortal",wt=t=>{const{__scopeDropdownMenu:a,...s}=t,n=k(a);return e.jsx(fs,{...n,...s})};wt.displayName=Ts;var Ct="DropdownMenuContent",Rt=c.forwardRef((t,a)=>{const{__scopeDropdownMenu:s,...n}=t,r=bt(Ct,s),o=k(s),l=c.useRef(!1);return e.jsx(hs,{id:r.contentId,"aria-labelledby":r.triggerId,...o,...n,ref:a,onCloseAutoFocus:E(t.onCloseAutoFocus,i=>{var u;l.current||(u=r.triggerRef.current)==null||u.focus(),l.current=!1,i.preventDefault()}),onInteractOutside:E(t.onInteractOutside,i=>{const u=i.detail.originalEvent,x=u.button===0&&u.ctrlKey===!0,m=u.button===2||x;(!r.modal||m)&&(l.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Rt.displayName=Ct;var As="DropdownMenuGroup",Ds=c.forwardRef((t,a)=>{const{__scopeDropdownMenu:s,...n}=t,r=k(s);return e.jsx(gs,{...r,...n,ref:a})});Ds.displayName=As;var _s="DropdownMenuLabel",St=c.forwardRef((t,a)=>{const{__scopeDropdownMenu:s,...n}=t,r=k(s);return e.jsx(vs,{...r,...n,ref:a})});St.displayName=_s;var Ps="DropdownMenuItem",Et=c.forwardRef((t,a)=>{const{__scopeDropdownMenu:s,...n}=t,r=k(s);return e.jsx(bs,{...r,...n,ref:a})});Et.displayName=Ps;var Ls="DropdownMenuCheckboxItem",Mt=c.forwardRef((t,a)=>{const{__scopeDropdownMenu:s,...n}=t,r=k(s);return e.jsx(js,{...r,...n,ref:a})});Mt.displayName=Ls;var ks="DropdownMenuRadioGroup",Os=c.forwardRef((t,a)=>{const{__scopeDropdownMenu:s,...n}=t,r=k(s);return e.jsx(Ns,{...r,...n,ref:a})});Os.displayName=ks;var Fs="DropdownMenuRadioItem",It=c.forwardRef((t,a)=>{const{__scopeDropdownMenu:s,...n}=t,r=k(s);return e.jsx(ys,{...r,...n,ref:a})});It.displayName=Fs;var Us="DropdownMenuItemIndicator",Tt=c.forwardRef((t,a)=>{const{__scopeDropdownMenu:s,...n}=t,r=k(s);return e.jsx(ws,{...r,...n,ref:a})});Tt.displayName=Us;var Gs="DropdownMenuSeparator",At=c.forwardRef((t,a)=>{const{__scopeDropdownMenu:s,...n}=t,r=k(s);return e.jsx(Cs,{...r,...n,ref:a})});At.displayName=Gs;var $s="DropdownMenuArrow",Vs=c.forwardRef((t,a)=>{const{__scopeDropdownMenu:s,...n}=t,r=k(s);return e.jsx(Rs,{...r,...n,ref:a})});Vs.displayName=$s;var Bs="DropdownMenuSubTrigger",Dt=c.forwardRef((t,a)=>{const{__scopeDropdownMenu:s,...n}=t,r=k(s);return e.jsx(Ss,{...r,...n,ref:a})});Dt.displayName=Bs;var Ks="DropdownMenuSubContent",_t=c.forwardRef((t,a)=>{const{__scopeDropdownMenu:s,...n}=t,r=k(s);return e.jsx(Es,{...r,...n,ref:a,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});_t.displayName=Ks;var Ws=jt,zs=yt,qs=wt,Pt=Rt,Lt=St,kt=Et,Ot=Mt,Ft=It,Ut=Tt,Gt=At,$t=Dt,Vt=_t;const Hs=Ws,Xs=zs,Ys=c.forwardRef(({className:t,inset:a,children:s,...n},r)=>e.jsxs($t,{ref:r,className:$("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",a&&"pl-8",t),...n,children:[s,e.jsx(Zt,{className:"ml-auto h-4 w-4"})]}));Ys.displayName=$t.displayName;const Js=c.forwardRef(({className:t,...a},s)=>e.jsx(Vt,{ref:s,className:$("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a}));Js.displayName=Vt.displayName;const Bt=c.forwardRef(({className:t,sideOffset:a=4,...s},n)=>e.jsx(qs,{children:e.jsx(Pt,{ref:n,sideOffset:a,className:$("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s})}));Bt.displayName=Pt.displayName;const Kt=c.forwardRef(({className:t,inset:a,...s},n)=>e.jsx(kt,{ref:n,className:$("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",t),...s}));Kt.displayName=kt.displayName;const Qs=c.forwardRef(({className:t,children:a,checked:s,...n},r)=>e.jsxs(Ot,{ref:r,className:$("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:s,...n,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ut,{children:e.jsx(En,{className:"h-4 w-4"})})}),a]}));Qs.displayName=Ot.displayName;const Zs=c.forwardRef(({className:t,children:a,...s},n)=>e.jsxs(Ft,{ref:n,className:$("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...s,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ut,{children:e.jsx(In,{className:"h-2 w-2 fill-current"})})}),a]}));Zs.displayName=Ft.displayName;const ea=c.forwardRef(({className:t,inset:a,...s},n)=>e.jsx(Lt,{ref:n,className:$("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",t),...s}));ea.displayName=Lt.displayName;const ta=c.forwardRef(({className:t,...a},s)=>e.jsx(Gt,{ref:s,className:$("-mx-1 my-1 h-px bg-muted",t),...a}));ta.displayName=Gt.displayName;const na=["text","editor","number","bool","email","url","date","select","json","file","relation"],ge={text:{label:"Plain text",icon:"T",bg:"#eff6ff",color:"#1d4ed8",badgeClass:"bg-blue-100 text-blue-700"},editor:{label:"Rich editor",icon:"R",bg:"#f8fafc",color:"#475569",badgeClass:"bg-slate-100 text-slate-600"},number:{label:"Number",icon:"#",bg:"#f5f3ff",color:"#7c3aed",badgeClass:"bg-purple-100 text-purple-700"},bool:{label:"Bool",icon:"◉",bg:"#ecfdf5",color:"#059669",badgeClass:"bg-green-100 text-green-700"},email:{label:"Email",icon:"@",bg:"#eef2ff",color:"#4f46e5",badgeClass:"bg-indigo-100 text-indigo-700"},url:{label:"URL",icon:"U",bg:"#eef2ff",color:"#4f46e5",badgeClass:"bg-indigo-100 text-indigo-700"},date:{label:"Datetime",icon:"⊞",bg:"#fffbeb",color:"#d97706",badgeClass:"bg-amber-100 text-amber-700"},select:{label:"Select",icon:"S",bg:"#fdf4ff",color:"#a855f7",badgeClass:"bg-purple-100 text-purple-700"},json:{label:"JSON",icon:"J",bg:"#f0fdf4",color:"#16a34a",badgeClass:"bg-green-100 text-green-700"},file:{label:"File",icon:"F",bg:"#fff7ed",color:"#ea580c",badgeClass:"bg-orange-100 text-orange-700"},relation:{label:"Relation",icon:"L",bg:"#fef2f2",color:"#dc2626",badgeClass:"bg-red-100 text-red-700"},autoId:{label:"ID",icon:"~>",bg:"#f0f0f0",color:"#64748b",badgeClass:"bg-slate-100 text-slate-600"},autodate:{label:"Autodate",icon:"⊞",bg:"#f5f3ff",color:"#7c3aed",badgeClass:"bg-purple-100 text-purple-600"}};function _a(t){return t==="id"?"autoId":t==="created"||t==="updated"?"autodate":"text"}function se({icon:t,bg:a,color:s,name:n,badges:r}){return e.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2 text-muted-foreground",children:[e.jsx("span",{className:"inline-flex items-center justify-center rounded text-xs font-semibold shrink-0",style:{width:22,height:22,backgroundColor:a,color:s,fontSize:11},children:t}),e.jsx("span",{className:"text-sm text-muted-foreground",children:n}),r&&r.length>0&&e.jsx("span",{className:"flex items-center gap-1 ml-auto",children:r.map((o,l)=>e.jsx(Xe,{variant:"outline",className:o.variant==="green"?"bg-green-100 text-green-700 border-green-200 text-[10px] px-1.5 py-0":"bg-red-100 text-red-700 border-red-200 text-[10px] px-1.5 py-0",children:o.label},l))})]})}function $e({name:t,info:a}){const s=ge.date;return e.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2",children:[e.jsx("span",{className:"inline-flex items-center justify-center rounded text-xs font-semibold shrink-0",style:{width:22,height:22,backgroundColor:s.bg,color:s.color,fontSize:11},children:s.icon}),e.jsx("span",{className:"text-sm text-muted-foreground",children:t}),e.jsx("span",{className:"ml-auto",children:e.jsx("span",{className:"text-[11px] text-muted-foreground bg-muted rounded px-1.5 py-0.5",children:a})})]})}function sa({type:t}){const a=ge;return e.jsxs("div",{className:"rounded-lg border bg-muted/30 mb-3",children:[e.jsx(se,{icon:"T",bg:a.text.bg,color:a.text.color,name:"id",badges:[{label:"Nonempty",variant:"green"}]}),t==="auth"&&e.jsxs(e.Fragment,{children:[e.jsx(se,{icon:"P",bg:"#f8fafc",color:"#475569",name:"password",badges:[{label:"Nonempty",variant:"green"},{label:"Hidden",variant:"red"}]}),e.jsx(se,{icon:"T",bg:a.text.bg,color:a.text.color,name:"tokenKey",badges:[{label:"Nonempty",variant:"green"},{label:"Hidden",variant:"red"}]}),e.jsx(se,{icon:"@",bg:a.email.bg,color:a.email.color,name:"email",badges:[{label:"Nonempty",variant:"green"}]}),e.jsx(se,{icon:"B",bg:a.bool.bg,color:a.bool.color,name:"emailVisibility"}),e.jsx(se,{icon:"B",bg:a.bool.bg,color:a.bool.color,name:"verified"})]}),e.jsx($e,{name:"created",info:"Create"}),e.jsx($e,{name:"updated",info:"Create/Update"})]})}function aa({type:t,className:a,inline:s}){const n=ge[t];if(!n)return e.jsx("span",{className:a,children:t});const r=s?"18px":"22px",o=s?"9px":"11px";return e.jsx("span",{className:$("shrink-0",a),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:r,height:r,borderRadius:"4px",fontSize:o,fontWeight:600,backgroundColor:n.bg,color:n.color,lineHeight:1},title:n.label,children:n.icon})}function Ve({value:t,onChange:a,placeholder:s="Type and press Enter",className:n}){const[r,o]=c.useState(""),l=c.useRef(null),i=d=>{const p=d.trim().replace(/,$/,"").trim();p&&(t.includes(p)||a([...t,p]))},u=d=>{a(t.filter((p,N)=>N!==d))},x=d=>{(d.key==="Enter"||d.key===",")&&(d.preventDefault(),i(r),o("")),d.key==="Backspace"&&!r&&t.length>0&&u(t.length-1)},m=()=>{r.trim()&&(i(r),o(""))};return e.jsxs("div",{className:$("flex flex-wrap items-center gap-1.5 rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm focus-within:ring-1 focus-within:ring-ring min-h-[36px]",n),onClick:()=>{var d;return(d=l.current)==null?void 0:d.focus()},children:[t.map((d,p)=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-secondary px-2 py-0.5 text-xs font-medium",children:[d,e.jsx("button",{type:"button",className:"ml-0.5 rounded-sm hover:bg-muted-foreground/20 p-0.5",onClick:N=>{N.stopPropagation(),u(p)},children:e.jsx(ze,{className:"h-3 w-3"})})]},`${d}-${p}`)),e.jsx("input",{ref:l,type:"text",value:r,onChange:d=>o(d.target.value),onKeyDown:x,onBlur:m,placeholder:t.length===0?s:"",className:"flex-1 min-w-[80px] bg-transparent outline-none placeholder:text-muted-foreground text-sm"})]})}function ra({field:t,onChange:a,collections:s}){const n=t.options||{},r=(l,i)=>t[l]??n[l]??i,o=(l,i)=>{a({...t,[l]:i})};return e.jsxs("div",{className:"space-y-4 border-t pt-3 mt-2 px-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{id:`req-${t.name}-${t.type}`,checked:!!t.required,onCheckedChange:l=>a({...t,required:!!l})}),e.jsx(b,{htmlFor:`req-${t.name}-${t.type}`,className:"text-sm font-normal",children:"Required"})]}),oa(t.type,t,r,o,a,s)]})}function oa(t,a,s,n,r,o){switch(t){case"text":return e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Min length"}),e.jsx(D,{type:"number",min:0,placeholder:"0",value:s("min")??"",onChange:l=>n("min",l.target.value?parseInt(l.target.value):void 0)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Max length"}),e.jsx(D,{type:"number",min:0,placeholder:"5000",value:s("max")??"",onChange:l=>n("max",l.target.value?parseInt(l.target.value):void 0)})]}),e.jsxs("div",{className:"col-span-2 space-y-1.5",children:[e.jsxs(b,{className:"text-xs",children:["Pattern ",e.jsx("span",{className:"text-muted-foreground",children:"(regex)"})]}),e.jsx(D,{type:"text",placeholder:"e.g. ^[a-z]+$",value:s("pattern")??"",onChange:l=>n("pattern",l.target.value||void 0)})]})]});case"number":return e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Min value"}),e.jsx(D,{type:"number",step:"any",placeholder:"No limit",value:s("min")??"",onChange:l=>n("min",l.target.value!==""?parseFloat(l.target.value):void 0)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Max value"}),e.jsx(D,{type:"number",step:"any",placeholder:"No limit",value:s("max")??"",onChange:l=>n("max",l.target.value!==""?parseFloat(l.target.value):void 0)})]}),e.jsxs("div",{className:"col-span-2 flex items-center gap-2",children:[e.jsx(ce,{id:"onlyInt",checked:!!s("onlyInt"),onCheckedChange:l=>n("onlyInt",!!l||void 0)}),e.jsx(b,{htmlFor:"onlyInt",className:"text-sm font-normal",children:"Integer only"})]})]});case"select":return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Values"}),e.jsx(Ve,{value:s("values")??[],onChange:l=>n("values",l),placeholder:"Type a value and press Enter"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Press Enter or comma to add a value."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Max select"}),e.jsxs(ae,{value:String(s("maxSelect")??1),onValueChange:l=>n("maxSelect",parseInt(l)),children:[e.jsx(re,{className:"w-[200px]",children:e.jsx(oe,{})}),e.jsxs(le,{children:[e.jsx(T,{value:"1",children:"Single (1)"}),e.jsx(T,{value:"2",children:"Multiple (2)"}),e.jsx(T,{value:"3",children:"Multiple (3)"}),e.jsx(T,{value:"5",children:"Multiple (5)"}),e.jsx(T,{value:"10",children:"Multiple (10)"}),e.jsx(T,{value:"999",children:"Unlimited"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Single allows only 1 value; multiple stores as array."})]})]});case"relation":return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Related collection"}),e.jsxs(ae,{value:s("collectionId")??"",onValueChange:l=>n("collectionId",l||void 0),children:[e.jsx(re,{children:e.jsx(oe,{placeholder:"-- Select a collection --"})}),e.jsx(le,{children:o.map(l=>e.jsx(T,{value:l.id,children:l.name},l.id))})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The collection this field links to."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Max select"}),e.jsxs(ae,{value:String(s("maxSelect")??1),onValueChange:l=>n("maxSelect",parseInt(l)),children:[e.jsx(re,{children:e.jsx(oe,{})}),e.jsxs(le,{children:[e.jsx(T,{value:"1",children:"Single (1)"}),e.jsx(T,{value:"5",children:"Multiple (5)"}),e.jsx(T,{value:"10",children:"Multiple (10)"}),e.jsx(T,{value:"999",children:"Unlimited"})]})]})]}),e.jsx("div",{className:"flex items-end pb-1",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{id:"cascadeDelete",checked:!!s("cascadeDelete"),onCheckedChange:l=>n("cascadeDelete",!!l||void 0)}),e.jsx(b,{htmlFor:"cascadeDelete",className:"text-sm font-normal",children:"Cascade delete"})]})})]})]});case"file":{const l=s("mimeTypes")??[];return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Max file size"}),e.jsxs(ae,{value:String(s("maxSize")??5242880),onValueChange:i=>n("maxSize",parseInt(i)),children:[e.jsx(re,{children:e.jsx(oe,{})}),e.jsxs(le,{children:[e.jsx(T,{value:"1048576",children:"1 MB"}),e.jsx(T,{value:"5242880",children:"5 MB"}),e.jsx(T,{value:"10485760",children:"10 MB"}),e.jsx(T,{value:"52428800",children:"50 MB"}),e.jsx(T,{value:"104857600",children:"100 MB"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Max files"}),e.jsxs(ae,{value:String(s("maxSelect")??1),onValueChange:i=>n("maxSelect",parseInt(i)),children:[e.jsx(re,{children:e.jsx(oe,{})}),e.jsxs(le,{children:[e.jsx(T,{value:"1",children:"Single (1)"}),e.jsx(T,{value:"5",children:"Multiple (5)"}),e.jsx(T,{value:"10",children:"Multiple (10)"}),e.jsx(T,{value:"99",children:"Multiple (99)"})]})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(b,{className:"text-xs",children:["Allowed MIME types ",e.jsx("span",{className:"text-muted-foreground",children:"(empty = all)"})]}),e.jsx(Ve,{value:l,onChange:i=>n("mimeTypes",i),placeholder:"e.g. image/jpeg, application/pdf"}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(J,{type:"button",variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>{const i=["image/jpeg","image/png","image/webp","image/gif"],u=[...new Set([...l,...i])];n("mimeTypes",u)},children:"Images"}),e.jsx(J,{type:"button",variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>{const i=["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],u=[...new Set([...l,...i])];n("mimeTypes",u)},children:"Documents"}),e.jsx(J,{type:"button",variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>{const i=["video/mp4","video/webm"],u=[...new Set([...l,...i])];n("mimeTypes",u)},children:"Videos"})]})]})]})}case"email":case"url":return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(b,{className:"text-xs",children:["Only domains ",e.jsx("span",{className:"text-muted-foreground",children:"(allowlist)"})]}),e.jsx(D,{type:"text",placeholder:"e.g. example.com, company.org",value:(s("onlyDomains")??[]).join(", "),onChange:l=>{const i=l.target.value.trim();n("onlyDomains",i?i.split(",").map(u=>u.trim()).filter(Boolean):void 0)}}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Comma-separated. Leave empty to allow all."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(b,{className:"text-xs",children:["Except domains ",e.jsx("span",{className:"text-muted-foreground",children:"(blocklist)"})]}),e.jsx(D,{type:"text",placeholder:"e.g. spam.com, test.org",value:(s("exceptDomains")??[]).join(", "),onChange:l=>{const i=l.target.value.trim();n("exceptDomains",i?i.split(",").map(u=>u.trim()).filter(Boolean):void 0)}}),e.jsx("p",{className:"text-xs text-muted-foreground",children:'Mutually exclusive with "only domains".'})]})]});case"date":return e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Min date"}),e.jsx(D,{type:"datetime-local",value:s("min")??"",onChange:l=>n("min",l.target.value||void 0)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Max date"}),e.jsx(D,{type:"datetime-local",value:s("max")??"",onChange:l=>n("max",l.target.value||void 0)})]})]});case"json":return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Max size (bytes)"}),e.jsx(D,{type:"number",min:1,placeholder:"1048576",value:s("maxSize")??"",onChange:l=>n("maxSize",l.target.value?parseInt(l.target.value):void 0)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Default: 1 MB (1048576 bytes)."})]});case"editor":return e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Max size (bytes)"}),e.jsx(D,{type:"number",min:1,placeholder:"5242880",value:s("maxSize")??"",onChange:l=>n("maxSize",l.target.value?parseInt(l.target.value):void 0)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Default: 5 MB."})]}),e.jsx("div",{className:"flex items-end pb-1",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{id:"convertURLs",checked:!!s("convertURLs"),onCheckedChange:l=>n("convertURLs",!!l||void 0)}),e.jsx(b,{htmlFor:"convertURLs",className:"text-sm font-normal",children:"Convert URLs"})]})})]});case"bool":default:return null}}function la({field:t,onChange:a,onRemove:s,collections:n}){const[r,o]=c.useState(!t.name);ge[t.type];const i=(()=>{const u=t.options||{};switch(t.type){case"relation":{const x=t.collectionId||u.collectionId||"";if(x){const m=n.find(d=>d.id===x);if(m)return m.name}return x||""}case"select":{const x=t.values||u.values||[];return x.length===0?"":x.slice(0,3).join(", ")+(x.length>3?"...":"")}default:return""}})();return e.jsxs("div",{className:"border rounded-lg mb-2 bg-background",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[e.jsx(aa,{type:t.type}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(D,{type:"text",placeholder:"Field name",value:t.name,onChange:u=>a({...t,name:u.target.value}),className:"h-7 text-sm border-0 shadow-none px-1 focus-visible:ring-0"})}),i&&e.jsx("span",{className:"text-xs text-muted-foreground truncate max-w-[120px]",children:i}),t.required&&e.jsx(Xe,{variant:"outline",className:"bg-green-100 text-green-700 border-green-200 text-[10px] px-1.5 py-0",children:"Required"}),e.jsx(J,{type:"button",variant:"ghost",size:"sm",className:`h-7 w-7 p-0 ${r?"text-primary":"text-muted-foreground"}`,onClick:()=>o(!r),children:e.jsx(en,{className:"h-3.5 w-3.5"})}),e.jsx(J,{type:"button",variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive",onClick:s,children:e.jsx(ze,{className:"h-3.5 w-3.5"})})]}),r&&e.jsx("div",{className:"px-3 pb-3",children:e.jsx(ra,{field:t,onChange:a,collections:n})})]})}function ca({fields:t,onChange:a,collections:s}){const n=(o,l)=>{const i=[...t];i[o]=l,a(i)},r=o=>{a(t.filter((l,i)=>i!==o))};return e.jsx("div",{children:t.map((o,l)=>e.jsx(la,{field:o,onChange:i=>n(l,i),onRemove:()=>r(l),collections:s},`${o.type}-${l}`))})}function ia({onSelect:t,onClose:a}){return e.jsx("div",{className:"rounded-lg border bg-background p-3 mb-3 shadow-sm",children:e.jsx("div",{className:"grid grid-cols-3 gap-2",children:na.map(s=>{const n=ge[s];return n?e.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md px-3 py-2 text-sm hover:bg-muted transition-colors text-left",onClick:()=>{t(s),a()},children:[e.jsx("span",{className:"inline-flex items-center justify-center rounded text-xs font-semibold shrink-0",style:{width:22,height:22,backgroundColor:n.bg,color:n.color,fontSize:11},children:n.icon}),e.jsx("span",{className:"whitespace-nowrap",children:n.label})]},s):null})})})}function da(){return tn({queryKey:["database-tables"],queryFn:nn,staleTime:300*1e3})}function ua(t){if(!t)return`
|
|
17
17
|
`;let a=t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");const s=/('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*")|(--.*)(\/\*[\s\S]*?\*\/)|(\b(?:SELECT|FROM|WHERE|AND|OR|NOT|IN|IS|NULL|AS|ON|JOIN|LEFT|RIGHT|INNER|OUTER|FULL|CROSS|ORDER|BY|GROUP|HAVING|LIMIT|OFFSET|UNION|ALL|INSERT|INTO|VALUES|UPDATE|SET|DELETE|CREATE|DROP|ALTER|TABLE|VIEW|INDEX|DISTINCT|COUNT|SUM|AVG|MIN|MAX|CASE|WHEN|THEN|ELSE|END|BETWEEN|LIKE|ILIKE|EXISTS|TRUE|FALSE|ASC|DESC|NULLS|FIRST|LAST|COALESCE|CAST|WITH|RECURSIVE|OVER|PARTITION|ROW_NUMBER|RANK|DENSE_RANK|LATERAL|FILTER|ARRAY_AGG|STRING_AGG|JSON_AGG|JSONB_AGG|NOW|CURRENT_TIMESTAMP|EXTRACT|INTERVAL|DATE|TIMESTAMP|TIMESTAMPTZ|INTEGER|TEXT|BOOLEAN|DOUBLE|PRECISION|VARCHAR|JSONB)\b)|(\b\d+(?:\.\d+)?\b)|(\*)/gi;let n="",r=0;for(const o of a.matchAll(s))n+=a.substring(r,o.index),o[1]?n+=`<span class="sql-hl-string">${o[0]}</span>`:o[2]?n+=`<span class="sql-hl-comment">${o[0]}</span>`:o[3]?n+=`<span class="sql-hl-comment">${o[0]}</span>`:o[4]?n+=`<span class="sql-hl-keyword">${o[0].toUpperCase()}</span>`:o[5]?n+=`<span class="sql-hl-number">${o[0]}</span>`:o[6]&&(n+=`<span class="sql-hl-star">${o[0]}</span>`),r=(o.index??0)+o[0].length;return n+=a.substring(r),n+`
|
|
18
18
|
`}const Be=["SELECT","FROM","WHERE","AND","OR","NOT","IN","IS","NULL","AS","ON","JOIN","LEFT","RIGHT","INNER","OUTER","FULL","CROSS","ORDER","BY","GROUP","HAVING","LIMIT","OFFSET","UNION","ALL","INSERT","INTO","VALUES","UPDATE","SET","DELETE","CREATE","DROP","ALTER","TABLE","VIEW","INDEX","DISTINCT","COUNT","SUM","AVG","MIN","MAX","CASE","WHEN","THEN","ELSE","END","BETWEEN","LIKE","ILIKE","EXISTS","TRUE","FALSE","ASC","DESC","NULLS","FIRST","LAST","COALESCE","CAST","WITH","RECURSIVE","OVER","PARTITION","ROW_NUMBER","RANK","DENSE_RANK","LATERAL","FILTER","ARRAY_AGG","STRING_AGG","JSON_AGG","JSONB_AGG","NOW","CURRENT_TIMESTAMP","EXTRACT","INTERVAL","DATE","TIMESTAMP","TIMESTAMPTZ","INTEGER","TEXT","BOOLEAN","DOUBLE","PRECISION","VARCHAR","JSONB"],pa={table:{icon:"T",className:"bg-blue-100 text-blue-700"},column:{icon:"C",className:"bg-green-100 text-green-700"},keyword:{icon:"K",className:"bg-purple-100 text-purple-700"}};function ma({items:t,activeIndex:a,onSelect:s,position:n}){const r=c.useRef(null);return c.useEffect(()=>{var l;const o=(l=r.current)==null?void 0:l.querySelector('[data-active="true"]');o&&o.scrollIntoView({block:"nearest"})},[a]),t.length===0?null:e.jsx("div",{ref:r,className:"absolute z-50 bg-popover border rounded-md shadow-lg max-h-[200px] overflow-y-auto min-w-[200px]",style:{left:Math.min(n.left,280),top:n.top+20},children:t.map((o,l)=>{const i=pa[o.kind];return e.jsxs("div",{"data-active":l===a,className:$("flex items-center gap-2 px-2 py-1 text-sm cursor-pointer",l===a?"bg-accent text-accent-foreground":"hover:bg-muted"),onMouseDown:u=>{u.preventDefault(),s(l)},children:[e.jsx("span",{className:$("inline-flex items-center justify-center rounded text-[10px] font-bold w-5 h-5 shrink-0",i.className),children:i.icon}),e.jsx("span",{className:"truncate",children:o.label}),o.detail&&e.jsx("span",{className:"ml-auto text-xs text-muted-foreground truncate",children:o.detail})]},`${o.kind}-${o.label}-${l}`)})})}function xa({value:t,onChange:a,placeholder:s="SELECT id, created, updated FROM posts WHERE published = true"}){const{data:n=[]}=da(),r=c.useRef(null),o=c.useRef(null),l=c.useRef(null),[i,u]=c.useState([]),[x,m]=c.useState(0),[d,p]=c.useState(!1),[N,y]=c.useState({left:0,top:0}),C=(t||"").split(`
|
|
19
|
-
`).length,V=c.useCallback(()=>{r.current&&o.current&&(o.current.scrollTop=r.current.scrollTop,o.current.scrollLeft=r.current.scrollLeft)},[]),L=c.useCallback(()=>{p(!1),u([])},[]),O=c.useCallback(()=>{const g=r.current;if(!g)return{left:0,top:0};const v=document.createElement("div"),w=getComputedStyle(g),_=["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","padding","paddingLeft","paddingTop","border","whiteSpace","wordWrap","overflowWrap","tabSize"];v.style.position="absolute",v.style.visibility="hidden",v.style.whiteSpace="pre-wrap",v.style.wordWrap="break-word",v.style.width=w.width;for(const M of _)v.style[M]=w.getPropertyValue(M.replace(/([A-Z])/g,"-$1").toLowerCase());const P=g.value.substring(0,g.selectionStart);v.textContent=P;const A=document.createElement("span");A.textContent=g.value.substring(g.selectionStart)||".",v.appendChild(A),document.body.appendChild(v);const h=A.offsetLeft-g.scrollLeft,R=A.offsetTop-g.scrollTop;return document.body.removeChild(v),{left:h,top:R}},[]),F=c.useCallback((g,v)=>{const w=g.substring(0,v),_=w.match(/[\w.]*$/);if(!_||!_[0])return[];const P=_[0],A=[],h={},R=/(?:FROM|JOIN)\s+(\w+)(?:\s+AS\s+(\w+)|\s+(\w+)(?=\s*(?:ON|WHERE|JOIN|LEFT|RIGHT|INNER|OUTER|FULL|CROSS|GROUP|ORDER|LIMIT|HAVING|UNION|,|\)|$)))/gi;let M;for(;(M=R.exec(g))!==null;){const j=M[1].toLowerCase(),S=(M[2]||M[3]||"").toLowerCase();S&&S!==j&&(new Set(Be.map(Z=>Z.toLowerCase())).has(S)||(h[S]=j))}if(P.includes(".")){const j=P.split("."),S=j[0].toLowerCase(),B=(j[1]||"").toLowerCase(),Z=h[S]||S,de=n.find(W=>W.name.toLowerCase()===Z);if(de)for(const W of de.columns)W.name.toLowerCase().startsWith(B)&&A.push({label:W.name,kind:"column",detail:W.type});return A}const U=P.toLowerCase(),f=w.substring(0,w.length-P.length).trimEnd().toUpperCase().split(/\s+/).pop()||"",I=["FROM","JOIN","INTO","TABLE","UPDATE"].includes(f);for(const j of n)j.name.toLowerCase().startsWith(U)&&A.push({label:j.name,kind:"table",detail:`${j.columns.length} cols`});if(!I)for(const j of n)for(const S of j.columns)S.name.toLowerCase().startsWith(U)&&(A.find(B=>B.label===S.name&&B.kind==="column")||A.push({label:S.name,kind:"column",detail:`${j.name}.${S.type}`}));if(!I)for(const j of Be)j.toLowerCase().startsWith(U)&&U.length>=1&&A.push({label:j,kind:"keyword"});return A.sort((j,S)=>{const B={table:I?0:1,column:I?2:0,keyword:3};return(B[j.kind]??9)-(B[S.kind]??9)}),A.slice(0,12)},[n]),H=c.useCallback(g=>{if(g.length===0){L();return}u(g),m(0),p(!0),y(O())},[L,O]),X=c.useCallback(g=>{const v=i[g];if(!v)return;const w=r.current;if(!w)return;const _=w.selectionStart,P=w.value,h=P.substring(0,_).match(/[\w.]*$/),R=h?_-h[0].length:_;let M=v.label;if(h&&h[0].includes(".")){const G=h[0].lastIndexOf(".");M=h[0].substring(0,G+1)+v.label}const U=P.substring(0,R)+M+P.substring(_);a(U),L(),requestAnimationFrame(()=>{const G=R+M.length;w.selectionStart=w.selectionEnd=G,w.focus()})},[i,a,L]),Q=c.useCallback(g=>{a(g);const v=r.current;v&&requestAnimationFrame(()=>{const w=v.selectionStart,_=F(g,w);H(_)})},[a,F,H]),q=c.useCallback(g=>{if((g.ctrlKey||g.metaKey)&&g.key===" "){g.preventDefault();const v=r.current;if(!v)return;const w=F(v.value,v.selectionStart);H(w);return}if(g.key==="Tab"&&!d){g.preventDefault();const v=r.current;if(!v)return;const w=v.selectionStart,_=t.substring(0,w)+" "+t.substring(w);a(_),requestAnimationFrame(()=>{v.selectionStart=v.selectionEnd=w+2});return}if(d){if(g.key==="ArrowDown"){g.preventDefault(),m(v=>(v+1)%i.length);return}if(g.key==="ArrowUp"){g.preventDefault(),m(v=>(v-1+i.length)%i.length);return}if(g.key==="Enter"||g.key==="Tab"){g.preventDefault(),X(x);return}if(g.key==="Escape"){g.preventDefault(),L();return}}},[d,i.length,x,t,a,F,H,X,L]);return e.jsxs("div",{ref:l,className:"relative rounded-md border bg-background font-mono text-sm overflow-hidden",style:{minHeight:120},children:[e.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-10 bg-muted/50 text-right pr-2 pt-[9px] text-xs text-muted-foreground select-none overflow-hidden leading-[1.5]","aria-hidden":"true",children:Array.from({length:C},(g,v)=>e.jsx("div",{children:v+1},v))}),e.jsx("pre",{ref:o,className:"absolute inset-0 pl-12 pt-[9px] pr-3 pb-2 m-0 pointer-events-none overflow-auto whitespace-pre-wrap break-words leading-[1.5] text-sm","aria-hidden":"true",children:e.jsx("code",{dangerouslySetInnerHTML:{__html:ua(t)}})}),e.jsx("textarea",{ref:r,className:"relative w-full min-h-[120px] pl-12 pt-2 pr-3 pb-2 bg-transparent text-transparent caret-foreground resize-y outline-none leading-[1.5] text-sm",spellCheck:!1,autoComplete:"off",autoCapitalize:"off",placeholder:s,value:t,onChange:g=>Q(g.target.value),onScroll:V,onKeyDown:q,onBlur:()=>setTimeout(L,150)}),d&&e.jsx(ma,{items:i,activeIndex:x,onSelect:X,position:N})]})}const fa=["google","github","gitlab","discord","facebook"],ha={enabled:!1,mappedFields:{name:"name",username:"username",avatarURL:"avatar"},providers:[]};function ga({name:t,config:a,onChange:s}){const[n,r]=c.useState(!1),o=!!a,l=()=>{o?(s(null),r(!1)):(s({name:t,clientId:"",clientSecret:""}),r(!0))};return e.jsxs("div",{className:"rounded-md border bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 cursor-pointer select-none",onClick:()=>o&&r(i=>!i),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ce,{checked:o,onCheckedChange:l,onClick:i=>i.stopPropagation()}),e.jsx("span",{className:"font-medium capitalize",children:t})]}),o&&e.jsx("button",{type:"button",className:"text-muted-foreground",onClick:i=>{i.stopPropagation(),r(u=>!u)},children:n?e.jsx(gn,{className:"h-4 w-4"}):e.jsx(vn,{className:"h-4 w-4"})})]}),o&&n&&e.jsxs("div",{className:"border-t px-4 py-3 space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Client ID"}),e.jsx(D,{placeholder:"Client ID",value:(a==null?void 0:a.clientId)??"",onChange:i=>s({...a,clientId:i.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Client Secret"}),e.jsx(D,{type:"password",placeholder:"Client Secret",value:(a==null?void 0:a.clientSecret)??"",onChange:i=>s({...a,clientSecret:i.target.value})})]})]})]})}function va({opts:t,setOpts:a}){const s=Object.fromEntries(t.providers.map(r=>[r.name,r])),n=(r,o)=>{const l=t.providers.filter(i=>i.name!==r);o&&l.push(o),a({...t,providers:l})};return e.jsxs("div",{className:"space-y-4 pt-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ce,{id:"oauth2-enabled",checked:t.enabled,onCheckedChange:r=>a({...t,enabled:!!r})}),e.jsx(b,{htmlFor:"oauth2-enabled",className:"cursor-pointer",children:"Enable OAuth2"})]}),t.enabled&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure OAuth2 providers for this collection."}),fa.map(r=>e.jsx(ga,{name:r,config:s[r],onChange:o=>n(r,o)},r)),e.jsxs("div",{className:"pt-2 space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Mapped fields"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:["name","username","avatarURL"].map(r=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(b,{className:"text-xs capitalize",children:r}),e.jsx(D,{className:"h-8 text-xs",placeholder:r,value:t.mappedFields[r]??"",onChange:o=>a({...t,mappedFields:{...t.mappedFields,[r]:o.target.value}})})]},r))})]})]})]})}function ba({type:t,fields:a,setFields:s,rules:n,setRules:r,viewQuery:o,setViewQuery:l,oauth2Options:i,setOAuth2Options:u}){const[x,m]=c.useState(!1),{data:d=[]}=sn(),p=i??ha,N=t==="view"?"query":"fields",y=C=>{s([...a,{name:"",type:C,required:!1}]),m(!1)};return e.jsxs(Rn,{defaultValue:N,children:[e.jsxs(Sn,{children:[t!=="view"&&e.jsx(ve,{value:"fields",children:"Fields"}),e.jsx(ve,{value:"api-rules",children:"API Rules"}),t==="auth"&&e.jsx(ve,{value:"options",children:"Options"}),t==="view"&&e.jsx(ve,{value:"query",children:"Query"})]}),t!=="view"&&e.jsxs(be,{value:"fields",className:"space-y-3",children:[e.jsx(sa,{type:t}),e.jsx(ca,{fields:a,onChange:s,collections:d}),x&&e.jsx(ia,{onSelect:y,onClose:()=>m(!1)}),e.jsxs(J,{type:"button",variant:"outline",className:"w-full border-dashed",onClick:()=>m(!x),children:[e.jsx(an,{className:"h-3 w-3 mr-2"}),"New field"]})]}),e.jsxs(be,{value:"api-rules",className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-sm",children:"List/Search rule"}),e.jsx(D,{placeholder:"Leave empty for public access, or enter a filter expression",value:n.listRule,onChange:C=>r({...n,listRule:C.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-sm",children:"View rule"}),e.jsx(D,{placeholder:"Leave empty for public access",value:n.viewRule,onChange:C=>r({...n,viewRule:C.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-sm",children:"Create rule"}),e.jsx(D,{placeholder:"Leave empty for public access",value:n.createRule,onChange:C=>r({...n,createRule:C.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-sm",children:"Update rule"}),e.jsx(D,{placeholder:"Leave empty for public access",value:n.updateRule,onChange:C=>r({...n,updateRule:C.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-sm",children:"Delete rule"}),e.jsx(D,{placeholder:"Leave empty for public access",value:n.deleteRule,onChange:C=>r({...n,deleteRule:C.target.value})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Leave empty for public access. Use filter expressions (e.g. ",e.jsx("code",{className:"bg-muted px-1 rounded text-[11px]",children:"user = @request.auth.id"}),") to restrict access."]})]}),t==="auth"&&e.jsx(be,{value:"options",children:u?e.jsx(va,{opts:p,setOpts:u}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Auth collection options will appear here."})}),t==="view"&&e.jsxs(be,{value:"query",className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(b,{className:"text-sm",children:["Select query ",e.jsx("span",{className:"text-muted-foreground",children:"*"})]}),e.jsx(xa,{value:o,onChange:l}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["SQL SELECT query that defines this view. Must include id, created, and updated columns. Press ",e.jsx("kbd",{className:"bg-muted px-1 rounded text-[11px] border",children:"Ctrl+Space"})," for autocomplete."]})]}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1.5 pl-5 list-disc",children:[e.jsxs("li",{children:["Wildcard columns (",e.jsx("code",{className:"bg-muted px-1 rounded text-[11px]",children:"*"}),") are not supported."]}),e.jsxs("li",{children:["The query must have a unique ",e.jsx("code",{className:"bg-muted px-1 rounded text-[11px]",children:"id"})," column.",e.jsx("br",{}),"If your query doesn't have a suitable one, you can use"," ",e.jsx("code",{className:"bg-muted px-1 rounded text-[11px]",children:"(ROW_NUMBER() OVER()) as id"}),"."]}),e.jsxs("li",{children:["Expressions must be aliased with a valid formatted field name, e.g."," ",e.jsx("code",{className:"bg-muted px-1 rounded text-[11px]",children:"MAX(balance) as maxBalance"}),"."]}),e.jsxs("li",{children:["Combined/multi-spaced expressions must be wrapped in parenthesis, e.g.",e.jsx("br",{}),e.jsx("code",{className:"bg-muted px-1 rounded text-[11px]",children:"(MAX(balance) + 1) as maxBalance"}),"."]})]})]})]})}function Pa({open:t,onClose:a,onDelete:s,mode:n,collectionId:r}){const{data:o,isLoading:l}=rn(n==="edit"?r:void 0),i=on(),u=ln(),x=cn(),[m,d]=c.useState(""),[p,N]=c.useState("base"),[y,C]=c.useState([]),[V,L]=c.useState(""),[O,F]=c.useState({listRule:"",viewRule:"",createRule:"",updateRule:"",deleteRule:""}),[H,X]=c.useState(!1),[Q,q]=c.useState({enabled:!1,mappedFields:{name:"name",username:"username",avatarURL:"avatar"},providers:[]});c.useEffect(()=>{var h,R;n==="edit"&&o&&(d(o.name),N(o.type),C(o.fields||o.schema||[]),F({listRule:o.listRule??"",viewRule:o.viewRule??"",createRule:o.createRule??"",updateRule:o.updateRule??"",deleteRule:o.deleteRule??""}),o.type==="view"&&((h=o.options)!=null&&h.query)&&L(o.options.query),o.type==="auth"&&((R=o.options)!=null&&R.oauth2)&&q(o.options.oauth2))},[n,o]),c.useEffect(()=>{n==="create"&&t&&(d(""),N("base"),C([]),L(""),F({listRule:"",viewRule:"",createRule:"",updateRule:"",deleteRule:""}),q({enabled:!1,mappedFields:{name:"name",username:"username",avatarURL:"avatar"},providers:[]}))},[n,t]);const g=()=>{var h,R,M;if(!m.trim())return z.error("Please enter a collection name."),!1;if(p==="view"&&!V.trim())return z.error("Please enter a view query."),!1;if(p!=="view"){const U=new Set;for(const[G,f]of y.entries()){const I=((h=f.name)==null?void 0:h.trim())??"";if(!I)return z.error(`Field #${G+1} must have a name.`),!1;const j=I.toLowerCase();if(U.has(j))return z.error(`Field "${I}" is duplicated. Field names must be unique.`),!1;if(U.add(j),f.type==="select"&&(f.values||((R=f.options)==null?void 0:R.values)||[]).length===0)return z.error(`Select field "${I}" must have at least one value.`),!1;if(f.type==="relation"&&!(f.collectionId||((M=f.options)==null?void 0:M.collectionId)))return z.error(`Relation field "${I}" must have a target collection.`),!1}}return!0},v=()=>{const h={name:m.trim(),type:p};if(p==="view")h.options={query:V.trim()};else if(p==="auth")h.options={oauth2:Q};else{const M=y.filter(U=>U.name.trim());h.schema=M}const R=M=>M.trim()===""?"":M.trim();return h.listRule=R(O.listRule),h.viewRule=R(O.viewRule),h.createRule=R(O.createRule),h.updateRule=R(O.updateRule),h.deleteRule=R(O.deleteRule),h},w=async()=>{if(!g())return;const h=v();try{n==="create"?(await i.mutateAsync(h),z.success(`Collection "${m}" created.`)):(await u.mutateAsync({idOrName:r,data:h}),z.success(`Collection "${m}" updated.`)),a()}catch(R){const M=R instanceof Error?R.message:"Operation failed.";z.error(M)}},_=async()=>{if(r)try{await x.mutateAsync(r),z.success(`Collection "${m}" deleted.`),X(!1),s==null||s(),a()}catch(h){const R=h instanceof Error?h.message:"Failed to delete collection.";z.error(R)}},P=i.isPending||u.isPending,A=(o==null?void 0:o.system)===!0;return e.jsxs(e.Fragment,{children:[e.jsx(dn,{open:t,onOpenChange:h=>!h&&a(),children:e.jsxs(un,{side:"right",className:"w-full sm:max-w-[700px] flex flex-col overflow-hidden",children:[e.jsxs(pn,{className:"shrink-0 px-6 pt-6 pb-4 flex flex-row items-center justify-between pr-8",children:[e.jsx(mn,{children:n==="create"?"New collection":"Edit collection"}),n==="edit"&&!A&&e.jsxs(Hs,{children:[e.jsx(Xs,{asChild:!0,children:e.jsx(J,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:e.jsx(Tn,{className:"h-4 w-4"})})}),e.jsx(Bt,{align:"end",children:e.jsxs(Kt,{className:"text-destructive focus:text-destructive",onClick:()=>X(!0),children:[e.jsx(An,{className:"h-4 w-4 mr-2"}),"Delete collection"]})})]})]}),e.jsx("div",{className:"border-t shrink-0"}),n==="edit"&&l?e.jsx(Ue,{fullPage:!0}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex-1 overflow-y-auto px-6 space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(b,{children:["Name ",e.jsx("span",{className:"text-muted-foreground",children:"*"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(D,{className:"flex-1",placeholder:'e.g. "posts"',value:m,onChange:h=>d(h.target.value),disabled:A}),n==="create"?e.jsxs(ae,{value:p,onValueChange:h=>N(h),children:[e.jsx(re,{className:"w-[140px]",children:e.jsx(oe,{})}),e.jsxs(le,{children:[e.jsx(T,{value:"base",children:"Type: Base"}),e.jsx(T,{value:"auth",children:"Type: Auth"}),e.jsx(T,{value:"view",children:"Type: View"})]})]}):e.jsx(Dn,{type:p})]})]}),e.jsx(ba,{type:p,fields:y,setFields:C,rules:O,setRules:F,viewQuery:V,setViewQuery:L,oauth2Options:p==="auth"?Q:void 0,setOAuth2Options:p==="auth"?q:void 0})]}),e.jsx("div",{className:"border-t shrink-0"}),e.jsxs(xn,{className:"shrink-0 px-6 py-2.5",children:[e.jsx(J,{variant:"outline",onClick:a,disabled:P,children:"Cancel"}),!A&&e.jsxs(J,{onClick:w,disabled:P,children:[P&&e.jsx(Ue,{size:"sm",className:"mr-2"}),n==="create"?"Create":"Save changes"]})]})]})]})}),e.jsx(Mn,{open:H,onOpenChange:X,title:"Delete Collection",description:`Are you sure you want to delete the collection "${m}"? This action cannot be undone and all associated records will be permanently deleted.`,confirmLabel:"Delete permanently",variant:"destructive",onConfirm:_})]})}export{Pa as C,Hs as D,Tn as E,aa as F,Dn as T,Xs as a,Bt as b,ea as c,ta as d,Qs as e,Kt as f,_a as g,An as h};
|
|
19
|
+
`).length,V=c.useCallback(()=>{r.current&&o.current&&(o.current.scrollTop=r.current.scrollTop,o.current.scrollLeft=r.current.scrollLeft)},[]),L=c.useCallback(()=>{p(!1),u([])},[]),O=c.useCallback(()=>{const g=r.current;if(!g)return{left:0,top:0};const v=document.createElement("div"),w=getComputedStyle(g),_=["fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","padding","paddingLeft","paddingTop","border","whiteSpace","wordWrap","overflowWrap","tabSize"];v.style.position="absolute",v.style.visibility="hidden",v.style.whiteSpace="pre-wrap",v.style.wordWrap="break-word",v.style.width=w.width;for(const M of _)v.style[M]=w.getPropertyValue(M.replace(/([A-Z])/g,"-$1").toLowerCase());const P=g.value.substring(0,g.selectionStart);v.textContent=P;const A=document.createElement("span");A.textContent=g.value.substring(g.selectionStart)||".",v.appendChild(A),document.body.appendChild(v);const h=A.offsetLeft-g.scrollLeft,R=A.offsetTop-g.scrollTop;return document.body.removeChild(v),{left:h,top:R}},[]),F=c.useCallback((g,v)=>{const w=g.substring(0,v),_=w.match(/[\w.]*$/);if(!_||!_[0])return[];const P=_[0],A=[],h={},R=/(?:FROM|JOIN)\s+(\w+)(?:\s+AS\s+(\w+)|\s+(\w+)(?=\s*(?:ON|WHERE|JOIN|LEFT|RIGHT|INNER|OUTER|FULL|CROSS|GROUP|ORDER|LIMIT|HAVING|UNION|,|\)|$)))/gi;let M;for(;(M=R.exec(g))!==null;){const j=M[1].toLowerCase(),S=(M[2]||M[3]||"").toLowerCase();S&&S!==j&&(new Set(Be.map(Z=>Z.toLowerCase())).has(S)||(h[S]=j))}if(P.includes(".")){const j=P.split("."),S=j[0].toLowerCase(),B=(j[1]||"").toLowerCase(),Z=h[S]||S,de=n.find(W=>W.name.toLowerCase()===Z);if(de)for(const W of de.columns)W.name.toLowerCase().startsWith(B)&&A.push({label:W.name,kind:"column",detail:W.type});return A}const U=P.toLowerCase(),f=w.substring(0,w.length-P.length).trimEnd().toUpperCase().split(/\s+/).pop()||"",I=["FROM","JOIN","INTO","TABLE","UPDATE"].includes(f);for(const j of n)j.name.toLowerCase().startsWith(U)&&A.push({label:j.name,kind:"table",detail:`${j.columns.length} cols`});if(!I)for(const j of n)for(const S of j.columns)S.name.toLowerCase().startsWith(U)&&(A.find(B=>B.label===S.name&&B.kind==="column")||A.push({label:S.name,kind:"column",detail:`${j.name}.${S.type}`}));if(!I)for(const j of Be)j.toLowerCase().startsWith(U)&&U.length>=1&&A.push({label:j,kind:"keyword"});return A.sort((j,S)=>{const B={table:I?0:1,column:I?2:0,keyword:3};return(B[j.kind]??9)-(B[S.kind]??9)}),A.slice(0,12)},[n]),H=c.useCallback(g=>{if(g.length===0){L();return}u(g),m(0),p(!0),y(O())},[L,O]),X=c.useCallback(g=>{const v=i[g];if(!v)return;const w=r.current;if(!w)return;const _=w.selectionStart,P=w.value,h=P.substring(0,_).match(/[\w.]*$/),R=h?_-h[0].length:_;let M=v.label;if(h&&h[0].includes(".")){const G=h[0].lastIndexOf(".");M=h[0].substring(0,G+1)+v.label}const U=P.substring(0,R)+M+P.substring(_);a(U),L(),requestAnimationFrame(()=>{const G=R+M.length;w.selectionStart=w.selectionEnd=G,w.focus()})},[i,a,L]),Q=c.useCallback(g=>{a(g);const v=r.current;v&&requestAnimationFrame(()=>{const w=v.selectionStart,_=F(g,w);H(_)})},[a,F,H]),q=c.useCallback(g=>{if((g.ctrlKey||g.metaKey)&&g.key===" "){g.preventDefault();const v=r.current;if(!v)return;const w=F(v.value,v.selectionStart);H(w);return}if(g.key==="Tab"&&!d){g.preventDefault();const v=r.current;if(!v)return;const w=v.selectionStart,_=t.substring(0,w)+" "+t.substring(w);a(_),requestAnimationFrame(()=>{v.selectionStart=v.selectionEnd=w+2});return}if(d){if(g.key==="ArrowDown"){g.preventDefault(),m(v=>(v+1)%i.length);return}if(g.key==="ArrowUp"){g.preventDefault(),m(v=>(v-1+i.length)%i.length);return}if(g.key==="Enter"||g.key==="Tab"){g.preventDefault(),X(x);return}if(g.key==="Escape"){g.preventDefault(),L();return}}},[d,i.length,x,t,a,F,H,X,L]);return e.jsxs("div",{ref:l,className:"relative rounded-md border bg-background font-mono text-sm overflow-hidden",style:{minHeight:120},children:[e.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-10 bg-muted/50 text-right pr-2 pt-[9px] text-xs text-muted-foreground select-none overflow-hidden leading-[1.5]","aria-hidden":"true",children:Array.from({length:C},(g,v)=>e.jsx("div",{children:v+1},v))}),e.jsx("pre",{ref:o,className:"absolute inset-0 pl-12 pt-[9px] pr-3 pb-2 m-0 pointer-events-none overflow-auto whitespace-pre-wrap break-words leading-[1.5] text-sm","aria-hidden":"true",children:e.jsx("code",{dangerouslySetInnerHTML:{__html:ua(t)}})}),e.jsx("textarea",{ref:r,className:"relative w-full min-h-[120px] pl-12 pt-2 pr-3 pb-2 bg-transparent text-transparent caret-foreground resize-y outline-none leading-[1.5] text-sm",spellCheck:!1,autoComplete:"off",autoCapitalize:"off",placeholder:s,value:t,onChange:g=>Q(g.target.value),onScroll:V,onKeyDown:q,onBlur:()=>setTimeout(L,150)}),d&&e.jsx(ma,{items:i,activeIndex:x,onSelect:X,position:N})]})}const fa=["google","github","gitlab","discord","facebook"],ha={enabled:!1,mappedFields:{name:"name",username:"username",avatarURL:"avatar"},providers:[]};function ga({name:t,config:a,onChange:s}){const[n,r]=c.useState(!1),o=!!a,l=()=>{o?(s(null),r(!1)):(s({name:t,clientId:"",clientSecret:""}),r(!0))};return e.jsxs("div",{className:"rounded-md border bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 cursor-pointer select-none",onClick:()=>o&&r(i=>!i),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ce,{checked:o,onCheckedChange:l,onClick:i=>i.stopPropagation()}),e.jsx("span",{className:"font-medium capitalize",children:t})]}),o&&e.jsx("button",{type:"button",className:"text-muted-foreground",onClick:i=>{i.stopPropagation(),r(u=>!u)},children:n?e.jsx(gn,{className:"h-4 w-4"}):e.jsx(vn,{className:"h-4 w-4"})})]}),o&&n&&e.jsxs("div",{className:"border-t px-4 py-3 space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Client ID"}),e.jsx(D,{placeholder:"Client ID",value:(a==null?void 0:a.clientId)??"",onChange:i=>s({...a,clientId:i.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-xs",children:"Client Secret"}),e.jsx(D,{type:"password",placeholder:"Client Secret",value:(a==null?void 0:a.clientSecret)??"",onChange:i=>s({...a,clientSecret:i.target.value})})]})]})]})}function va({opts:t,setOpts:a}){const s=Object.fromEntries(t.providers.map(r=>[r.name,r])),n=(r,o)=>{const l=t.providers.filter(i=>i.name!==r);o&&l.push(o),a({...t,providers:l})};return e.jsxs("div",{className:"space-y-4 pt-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ce,{id:"oauth2-enabled",checked:t.enabled,onCheckedChange:r=>a({...t,enabled:!!r})}),e.jsx(b,{htmlFor:"oauth2-enabled",className:"cursor-pointer",children:"Enable OAuth2"})]}),t.enabled&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure OAuth2 providers for this collection."}),fa.map(r=>e.jsx(ga,{name:r,config:s[r],onChange:o=>n(r,o)},r)),e.jsxs("div",{className:"pt-2 space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Mapped fields"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:["name","username","avatarURL"].map(r=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(b,{className:"text-xs capitalize",children:r}),e.jsx(D,{className:"h-8 text-xs",placeholder:r,value:t.mappedFields[r]??"",onChange:o=>a({...t,mappedFields:{...t.mappedFields,[r]:o.target.value}})})]},r))})]})]})]})}function ba({type:t,fields:a,setFields:s,rules:n,setRules:r,viewQuery:o,setViewQuery:l,oauth2Options:i,setOAuth2Options:u}){const[x,m]=c.useState(!1),{data:d=[]}=sn(),p=i??ha,N=t==="view"?"query":"fields",y=C=>{s([...a,{name:"",type:C,required:!1}]),m(!1)};return e.jsxs(Rn,{defaultValue:N,children:[e.jsxs(Sn,{children:[t!=="view"&&e.jsx(ve,{value:"fields",children:"Fields"}),e.jsx(ve,{value:"api-rules",children:"API Rules"}),t==="auth"&&e.jsx(ve,{value:"options",children:"Options"}),t==="view"&&e.jsx(ve,{value:"query",children:"Query"})]}),t!=="view"&&e.jsxs(be,{value:"fields",className:"space-y-3",children:[e.jsx(sa,{type:t}),e.jsx(ca,{fields:a,onChange:s,collections:d}),x&&e.jsx(ia,{onSelect:y,onClose:()=>m(!1)}),e.jsxs(J,{type:"button",variant:"outline",className:"w-full border-dashed",onClick:()=>m(!x),children:[e.jsx(an,{className:"h-3 w-3 mr-2"}),"New field"]})]}),e.jsxs(be,{value:"api-rules",className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-sm",children:"List/Search rule"}),e.jsx(D,{placeholder:"Leave empty for public access, or enter a filter expression",value:n.listRule,onChange:C=>r({...n,listRule:C.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-sm",children:"View rule"}),e.jsx(D,{placeholder:"Leave empty for public access",value:n.viewRule,onChange:C=>r({...n,viewRule:C.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-sm",children:"Create rule"}),e.jsx(D,{placeholder:"Leave empty for public access",value:n.createRule,onChange:C=>r({...n,createRule:C.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-sm",children:"Update rule"}),e.jsx(D,{placeholder:"Leave empty for public access",value:n.updateRule,onChange:C=>r({...n,updateRule:C.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{className:"text-sm",children:"Delete rule"}),e.jsx(D,{placeholder:"Leave empty for public access",value:n.deleteRule,onChange:C=>r({...n,deleteRule:C.target.value})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Leave empty for public access. Use filter expressions (e.g. ",e.jsx("code",{className:"bg-muted px-1 rounded text-[11px]",children:"user = @request.auth.id"}),") to restrict access."]})]}),t==="auth"&&e.jsx(be,{value:"options",children:u?e.jsx(va,{opts:p,setOpts:u}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Auth collection options will appear here."})}),t==="view"&&e.jsxs(be,{value:"query",className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(b,{className:"text-sm",children:["Select query ",e.jsx("span",{className:"text-muted-foreground",children:"*"})]}),e.jsx(xa,{value:o,onChange:l}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["SQL SELECT query that defines this view. Must include id, created, and updated columns. Press ",e.jsx("kbd",{className:"bg-muted px-1 rounded text-[11px] border",children:"Ctrl+Space"})," for autocomplete."]})]}),e.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1.5 pl-5 list-disc",children:[e.jsxs("li",{children:["Wildcard columns (",e.jsx("code",{className:"bg-muted px-1 rounded text-[11px]",children:"*"}),") are not supported."]}),e.jsxs("li",{children:["The query must have a unique ",e.jsx("code",{className:"bg-muted px-1 rounded text-[11px]",children:"id"})," column.",e.jsx("br",{}),"If your query doesn't have a suitable one, you can use"," ",e.jsx("code",{className:"bg-muted px-1 rounded text-[11px]",children:"(ROW_NUMBER() OVER()) as id"}),"."]}),e.jsxs("li",{children:["Expressions must be aliased with a valid formatted field name, e.g."," ",e.jsx("code",{className:"bg-muted px-1 rounded text-[11px]",children:"MAX(balance) as maxBalance"}),"."]}),e.jsxs("li",{children:["Combined/multi-spaced expressions must be wrapped in parenthesis, e.g.",e.jsx("br",{}),e.jsx("code",{className:"bg-muted px-1 rounded text-[11px]",children:"(MAX(balance) + 1) as maxBalance"}),"."]})]})]})]})}function Pa({open:t,onClose:a,onDelete:s,mode:n,collectionId:r}){const{data:o,isLoading:l}=rn(n==="edit"?r:void 0),i=on(),u=ln(),x=cn(),[m,d]=c.useState(""),[p,N]=c.useState("base"),[y,C]=c.useState([]),[V,L]=c.useState(""),[O,F]=c.useState({listRule:"",viewRule:"",createRule:"",updateRule:"",deleteRule:""}),[H,X]=c.useState(!1),[Q,q]=c.useState({enabled:!1,mappedFields:{name:"name",username:"username",avatarURL:"avatar"},providers:[]});c.useEffect(()=>{var h,R;n==="edit"&&o&&(d(o.name),N(o.type),C(o.fields||o.schema||[]),F({listRule:o.listRule??"",viewRule:o.viewRule??"",createRule:o.createRule??"",updateRule:o.updateRule??"",deleteRule:o.deleteRule??""}),o.type==="view"&&((h=o.options)!=null&&h.query)&&L(o.options.query),o.type==="auth"&&((R=o.options)!=null&&R.oauth2)&&q(o.options.oauth2))},[n,o]),c.useEffect(()=>{n==="create"&&t&&(d(""),N("base"),C([]),L(""),F({listRule:"",viewRule:"",createRule:"",updateRule:"",deleteRule:""}),q({enabled:!1,mappedFields:{name:"name",username:"username",avatarURL:"avatar"},providers:[]}))},[n,t]);const g=()=>{var h,R,M;if(!m.trim())return z.error("Please enter a collection name."),!1;if(p==="view"&&!V.trim())return z.error("Please enter a view query."),!1;if(p!=="view"){const U=new Set;for(const[G,f]of y.entries()){const I=((h=f.name)==null?void 0:h.trim())??"";if(!I)return z.error(`Field #${G+1} must have a name.`),!1;const j=I.toLowerCase();if(U.has(j))return z.error(`Field "${I}" is duplicated. Field names must be unique.`),!1;if(U.add(j),f.type==="select"&&(f.values||((R=f.options)==null?void 0:R.values)||[]).length===0)return z.error(`Select field "${I}" must have at least one value.`),!1;if(f.type==="relation"&&!(f.collectionId||((M=f.options)==null?void 0:M.collectionId)))return z.error(`Relation field "${I}" must have a target collection.`),!1}}return!0},v=()=>{const h={name:m.trim(),type:p};if(p==="view")h.options={query:V.trim()};else{const M=y.filter(U=>U.name.trim());h.schema=M,p==="auth"&&(h.options={oauth2:Q})}const R=M=>M.trim()===""?"":M.trim();return h.listRule=R(O.listRule),h.viewRule=R(O.viewRule),h.createRule=R(O.createRule),h.updateRule=R(O.updateRule),h.deleteRule=R(O.deleteRule),h},w=async()=>{if(!g())return;const h=v();try{n==="create"?(await i.mutateAsync(h),z.success(`Collection "${m}" created.`)):(await u.mutateAsync({idOrName:r,data:h}),z.success(`Collection "${m}" updated.`)),a()}catch(R){const M=R instanceof Error?R.message:"Operation failed.";z.error(M)}},_=async()=>{if(r)try{await x.mutateAsync(r),z.success(`Collection "${m}" deleted.`),X(!1),s==null||s(),a()}catch(h){const R=h instanceof Error?h.message:"Failed to delete collection.";z.error(R)}},P=i.isPending||u.isPending,A=(o==null?void 0:o.system)===!0;return e.jsxs(e.Fragment,{children:[e.jsx(dn,{open:t,onOpenChange:h=>!h&&a(),children:e.jsxs(un,{side:"right",className:"w-full sm:max-w-[700px] flex flex-col overflow-hidden",children:[e.jsxs(pn,{className:"shrink-0 px-6 pt-6 pb-4 flex flex-row items-center justify-between pr-8",children:[e.jsx(mn,{children:n==="create"?"New collection":"Edit collection"}),n==="edit"&&!A&&e.jsxs(Hs,{children:[e.jsx(Xs,{asChild:!0,children:e.jsx(J,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:e.jsx(Tn,{className:"h-4 w-4"})})}),e.jsx(Bt,{align:"end",children:e.jsxs(Kt,{className:"text-destructive focus:text-destructive",onClick:()=>X(!0),children:[e.jsx(An,{className:"h-4 w-4 mr-2"}),"Delete collection"]})})]})]}),e.jsx("div",{className:"border-t shrink-0"}),n==="edit"&&l?e.jsx(Ue,{fullPage:!0}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex-1 overflow-y-auto px-6 space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(b,{children:["Name ",e.jsx("span",{className:"text-muted-foreground",children:"*"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(D,{className:"flex-1",placeholder:'e.g. "posts"',value:m,onChange:h=>d(h.target.value),disabled:A}),n==="create"?e.jsxs(ae,{value:p,onValueChange:h=>N(h),children:[e.jsx(re,{className:"w-[140px]",children:e.jsx(oe,{})}),e.jsxs(le,{children:[e.jsx(T,{value:"base",children:"Type: Base"}),e.jsx(T,{value:"auth",children:"Type: Auth"}),e.jsx(T,{value:"view",children:"Type: View"})]})]}):e.jsx(Dn,{type:p})]})]}),e.jsx(ba,{type:p,fields:y,setFields:C,rules:O,setRules:F,viewQuery:V,setViewQuery:L,oauth2Options:p==="auth"?Q:void 0,setOAuth2Options:p==="auth"?q:void 0})]}),e.jsx("div",{className:"border-t shrink-0"}),e.jsxs(xn,{className:"shrink-0 px-6 py-2.5",children:[e.jsx(J,{variant:"outline",onClick:a,disabled:P,children:"Cancel"}),!A&&e.jsxs(J,{onClick:w,disabled:P,children:[P&&e.jsx(Ue,{size:"sm",className:"mr-2"}),n==="create"?"Create":"Save changes"]})]})]})]})}),e.jsx(Mn,{open:H,onOpenChange:X,title:"Delete Collection",description:`Are you sure you want to delete the collection "${m}"? This action cannot be undone and all associated records will be permanently deleted.`,confirmLabel:"Delete permanently",variant:"destructive",onConfirm:_})]})}export{Pa as C,Hs as D,Tn as E,aa as F,Dn as T,Xs as a,Bt as b,ea as c,ta as d,Qs as e,Kt as f,_a as g,An as h};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{c as $,B as Y,E as Z,r as w,q as ee,j as e,A as E,w as n,t as F,p as t,F as se,I as v,J as te,G as R,S as ae,K as ne,H as re}from"./index-CBybCNw9.js";import{C as ie,B as le}from"./breadcrumb-CRswEvYD.js";import{B as r}from"./button-BTb_K7ly.js";import{u as oe,a as ce}from"./use-logs-DP2t67_K.js";import{u as de,a as he}from"./use-migrations-DAeB_wNl.js";import{u as me}from"./use-settings-PsGP45fr.js";import{T as xe}from"./table-2-BPWm54Rc.js";import{A as y}from"./arrow-right-oDCr_rj8.js";/**
|
|
2
|
+
* @license lucide-react v0.468.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const ge=$("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
|
|
7
|
+
* @license lucide-react v0.468.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const ue=$("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);async function pe(){return Y.request("GET","/api/health")}function fe(){return Z({queryKey:["health"],queryFn:pe,retry:!1,refetchOnWindowFocus:!1})}function m({label:o,value:d,detail:h,icon:x,tone:l}){const c={indigo:"bg-indigo-50 text-indigo-600 border-indigo-100",green:"bg-emerald-50 text-emerald-600 border-emerald-100",amber:"bg-amber-50 text-amber-600 border-amber-100",slate:"bg-slate-100 text-slate-600 border-slate-200"}[l];return e.jsx("div",{className:"rounded-xl border bg-white p-4 shadow-sm card-lift",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:o}),e.jsx("p",{className:"mt-2 text-3xl font-semibold tracking-tight tabular-nums",children:d}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:h})]}),e.jsx("span",{className:`inline-flex h-10 w-10 items-center justify-center rounded-lg border ${c}`,children:e.jsx(x,{className:"h-5 w-5"})})]})})}function Le(){var A;const[o,d]=w.useState(!1),[h,x]=w.useState(null),{data:l=[],isLoading:c,refetch:P}=ee(),{data:i,isLoading:B,refetch:q}=oe(),{data:g,isLoading:I,refetch:O}=ce({page:1,perPage:5,sort:"-created",filter:"status>=400"}),{data:a,isLoading:T,refetch:z}=de(),{data:u,refetch:H}=he(),{data:p,isLoading:je,refetch:W}=me(),{data:f,isLoading:D,isError:S,refetch:G}=fe(),Q=l.length,j=l.filter(s=>s.type==="auth").length,U=l.filter(s=>s.type==="view").length,_=l.filter(s=>s.type==="base").length,C=[...l].sort((s,N)=>new Date(N.updated).getTime()-new Date(s.updated).getTime()).slice(0,6),k=(g==null?void 0:g.items)??[],K=String(((A=p==null?void 0:p.meta)==null?void 0:A.appName)||"PPBase"),V=(u==null?void 0:u.totalItems)??0,J=i!=null&&i.total?i.errors/i.total*100:0,M=((a==null?void 0:a.pending)??0)>0,b=!S&&(f==null?void 0:f.code)===200,L=w.useMemo(()=>{const s=[];return b||s.push({title:"API health check failed",detail:"Dashboard cannot confirm backend readiness.",href:"/logs",tone:"danger"}),M&&s.push({title:`${(a==null?void 0:a.pending)??0} migration(s) pending`,detail:"Apply pending migrations to keep schema and code in sync.",href:"/migrations",tone:"warn"}),j===0&&s.push({title:"No auth collection configured",detail:"Create at least one auth collection for user sign-in flows.",href:"/collections?new=1",tone:"warn"}),s},[b,M,a==null?void 0:a.pending,j]),X=async()=>{d(!0);try{await Promise.all([P(),q(),O(),z(),H(),W(),G()]),x(new Date)}finally{d(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(ie,{left:e.jsx(le,{items:[{label:"Dashboard",active:!0}]}),right:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(r,{variant:"outline",size:"sm",onClick:X,disabled:o,children:[e.jsx(E,{className:`h-4 w-4 ${o?"animate-spin":""}`}),o?"Refreshing...":"Refresh overview"]}),e.jsx(r,{asChild:!0,size:"sm",children:e.jsxs(n,{to:"/collections?new=1",onMouseEnter:()=>t("collections"),onFocus:()=>t("collections"),children:[e.jsx(F,{className:"h-4 w-4"}),"New collection"]})})]})}),e.jsx("div",{className:"flex-1 overflow-auto p-4 md:p-6",children:e.jsxs("div",{className:"mx-auto max-w-7xl space-y-6",children:[e.jsx("section",{className:"rounded-2xl border bg-gradient-to-r from-indigo-600 to-indigo-500 p-6 text-white shadow-md animate-enter-up",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-indigo-100",children:"Admin Overview"}),e.jsx("h1",{className:"mt-1 text-2xl font-semibold tracking-tight",children:K}),e.jsx("p",{className:"mt-2 text-sm text-indigo-100",children:"Track collections, health, logs and migrations in one place."})]}),e.jsxs("div",{className:"rounded-xl bg-white/10 px-4 py-3 text-sm backdrop-blur",children:[e.jsx("p",{className:"text-indigo-100",children:"System status"}),e.jsx("div",{className:"mt-1 flex items-center gap-2",children:D?e.jsx("span",{className:"text-white",children:"Checking..."}):b?e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"h-4 w-4 text-emerald-200"}),e.jsx("span",{className:"font-semibold text-white",children:"Healthy"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:"h-4 w-4 text-amber-200"}),e.jsx("span",{className:"font-semibold text-white",children:"Attention required"})]})}),e.jsx("p",{className:"mt-1 text-xs text-indigo-100",children:h?`Updated ${v(h.toISOString())}`:"Use refresh to reload data"})]})]})}),L.length>0&&e.jsxs("section",{className:"rounded-xl border border-amber-200 bg-amber-50 p-4 animate-enter-up animate-enter-delay-1",children:[e.jsx("h2",{className:"mb-3 text-sm font-semibold text-amber-900",children:"Attention required"}),e.jsx("div",{className:"space-y-2",children:L.map((s,N)=>e.jsxs(n,{to:s.href,className:`block rounded-lg border bg-white px-3 py-2.5 hover:bg-slate-50 ${s.tone==="danger"?"border-red-200":"border-amber-200"}`,onMouseEnter:()=>{s.href.startsWith("/logs")&&t("logs"),s.href.startsWith("/migrations")&&t("migrations"),s.href.startsWith("/collections")&&t("collections")},onFocus:()=>{s.href.startsWith("/logs")&&t("logs"),s.href.startsWith("/migrations")&&t("migrations"),s.href.startsWith("/collections")&&t("collections")},children:[e.jsx("p",{className:"text-sm font-semibold text-slate-900",children:s.title}),e.jsx("p",{className:"text-xs text-slate-600",children:s.detail})]},`${s.title}-${N}`))})]}),e.jsxs("section",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-4 animate-enter-up animate-enter-delay-1",children:[e.jsx(m,{label:"Collections",value:c?"...":Q,detail:`${_} base, ${j} auth`,icon:te,tone:"indigo"}),e.jsx(m,{label:"View Collections",value:c?"...":U,detail:"SQL view-backed collections",icon:xe,tone:"slate"}),e.jsx(m,{label:"Requests",value:B?"...":(i==null?void 0:i.total)??0,detail:`error rate ${J.toFixed(1)}%`,icon:ge,tone:"green"}),e.jsx(m,{label:"Migrations Pending",value:T?"...":(a==null?void 0:a.pending)??0,detail:`Applied ${(a==null?void 0:a.applied)??0} / ${V}`,icon:R,tone:"amber"})]}),e.jsxs("section",{className:"grid grid-cols-1 gap-4 lg:grid-cols-3 animate-enter-up animate-enter-delay-2",children:[e.jsxs("div",{className:"rounded-xl border bg-white p-5 shadow-sm lg:col-span-1 card-lift",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h2",{className:"text-base font-semibold",children:"Recent collections"}),e.jsx(r,{asChild:!0,variant:"ghost",size:"sm",children:e.jsxs(n,{to:"/collections",onMouseEnter:()=>t("collections"),onFocus:()=>t("collections"),children:["Open",e.jsx(y,{className:"h-4 w-4"})]})})]}),c?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(s=>e.jsx("div",{className:"h-14 rounded-lg skeleton-shimmer"},s))}):C.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No collections yet."}):e.jsx("div",{className:"space-y-2",children:C.map(s=>e.jsxs(n,{to:`/collections/${s.id}`,className:"flex items-center justify-between rounded-lg border border-slate-200 px-3 py-2.5 text-sm hover:bg-slate-50 transition-all duration-200 hover:shadow-sm",onMouseEnter:()=>t("records"),onFocus:()=>t("records"),children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground",children:s.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.type," · ",v(s.updated)]})]}),e.jsx(y,{className:"h-4 w-4 text-muted-foreground"})]},s.id))})]}),e.jsxs("div",{className:"rounded-xl border bg-white p-5 shadow-sm lg:col-span-1 card-lift",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h2",{className:"text-base font-semibold",children:"Recent errors"}),e.jsx(r,{asChild:!0,variant:"ghost",size:"sm",children:e.jsxs(n,{to:"/logs",onMouseEnter:()=>t("logs"),onFocus:()=>t("logs"),children:["Open",e.jsx(y,{className:"h-4 w-4"})]})})]}),I?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(s=>e.jsx("div",{className:"h-14 rounded-lg skeleton-shimmer"},s))}):k.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No error logs recorded."}):e.jsx("div",{className:"space-y-2",children:k.map(s=>e.jsxs("div",{className:"rounded-lg border border-red-100 bg-red-50/40 px-3 py-2.5 transition-all duration-200 hover:shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("p",{className:"truncate text-sm font-medium text-slate-900",children:[s.method," ",s.url]}),e.jsx("span",{className:"rounded-md bg-red-100 px-2 py-0.5 text-xs font-semibold text-red-700",children:s.status})]}),e.jsx("p",{className:"mt-1 text-xs text-slate-600",children:v(s.created)})]},s.id))})]}),e.jsxs("div",{className:"rounded-xl border bg-white p-5 shadow-sm lg:col-span-1 card-lift",children:[e.jsx("h2",{className:"mb-4 text-base font-semibold",children:"Quick actions"}),e.jsxs("div",{className:"grid grid-cols-1 gap-2.5",children:[e.jsx(r,{asChild:!0,variant:"outline",className:"justify-start",children:e.jsxs(n,{to:"/collections?new=1",onMouseEnter:()=>t("collections"),onFocus:()=>t("collections"),children:[e.jsx(F,{className:"h-4 w-4"}),"Create collection"]})}),e.jsx(r,{asChild:!0,variant:"outline",className:"justify-start",children:e.jsxs(n,{to:"/migrations",onMouseEnter:()=>t("migrations"),onFocus:()=>t("migrations"),children:[e.jsx(R,{className:"h-4 w-4"}),"Review migrations"]})}),e.jsx(r,{asChild:!0,variant:"outline",className:"justify-start",children:e.jsxs(n,{to:"/logs",onMouseEnter:()=>t("logs"),onFocus:()=>t("logs"),children:[e.jsx(E,{className:"h-4 w-4"}),"Inspect logs"]})}),e.jsx(r,{asChild:!0,variant:"outline",className:"justify-start",children:e.jsxs(n,{to:"/settings",onMouseEnter:()=>t("settings"),onFocus:()=>t("settings"),children:[e.jsx(ae,{className:"h-4 w-4"}),"Update settings"]})})]}),e.jsxs("div",{className:"mt-4 rounded-lg border border-slate-200 bg-slate-50 p-3",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Access control"}),e.jsxs("p",{className:"mt-1 text-sm text-slate-700",children:["Superuser management collection:"," ",e.jsx(n,{to:"/collections/_superusers",className:"font-medium text-indigo-600 hover:underline",onMouseEnter:()=>t("records"),onFocus:()=>t("records"),children:"_superusers"})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs text-slate-500",children:[e.jsx(ne,{className:"h-3.5 w-3.5"}),"Admin-only area"]}),e.jsx(r,{asChild:!0,variant:"ghost",size:"sm",className:"mt-2 justify-start px-0",children:e.jsxs("a",{href:"/api/docs",target:"_blank",rel:"noreferrer",children:[e.jsx(re,{className:"h-4 w-4"}),"Open API docs"]})})]})]})]})]})})]})}export{Le as DashboardPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,j as e,g as r,T as p,U as u,Y as h,V as j,W as g,Z as N}from"./index-
|
|
1
|
+
import{r as l,j as e,g as r,T as p,U as u,Y as h,V as j,W as g,Z as N}from"./index-CBybCNw9.js";import{B as i}from"./button-BTb_K7ly.js";import{L as y}from"./loading-spinner-CYvUxGAE.js";const T=l.forwardRef(({className:a,...s},t)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:t,className:r("w-full caption-bottom text-[15px]",a),...s})}));T.displayName="Table";const w=l.forwardRef(({className:a,...s},t)=>e.jsx("thead",{ref:t,className:r("[&_tr]:border-b bg-slate-50/80",a),...s}));w.displayName="TableHeader";const C=l.forwardRef(({className:a,...s},t)=>e.jsx("tbody",{ref:t,className:r("[&_tr:last-child]:border-0",a),...s}));C.displayName="TableBody";const R=l.forwardRef(({className:a,...s},t)=>e.jsx("tfoot",{ref:t,className:r("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...s}));R.displayName="TableFooter";const v=l.forwardRef(({className:a,...s},t)=>e.jsx("tr",{ref:t,className:r("border-b transition-all duration-150 hover:bg-slate-50 data-[state=selected]:bg-indigo-50/40",a),...s}));v.displayName="TableRow";const k=l.forwardRef(({className:a,...s},t)=>e.jsx("th",{ref:t,className:r("h-12 px-4 text-left align-middle text-[11px] font-bold uppercase tracking-widest text-slate-500 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...s}));k.displayName="TableHead";const D=l.forwardRef(({className:a,...s},t)=>e.jsx("td",{ref:t,className:r("px-4 py-3.5 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...s}));D.displayName="TableCell";const H=l.forwardRef(({className:a,...s},t)=>e.jsx("caption",{ref:t,className:r("mt-4 text-sm text-muted-foreground",a),...s}));H.displayName="TableCaption";function F({open:a,onOpenChange:s,title:t,description:o,confirmLabel:c="Confirm",cancelLabel:m="Cancel",variant:x="default",onConfirm:f}){const[d,n]=l.useState(!1),b=async()=>{n(!0);try{await f()}finally{n(!1)}};return e.jsx(p,{open:a,onOpenChange:s,children:e.jsxs(u,{children:[e.jsxs(h,{children:[e.jsx(j,{children:t}),e.jsx(g,{children:o})]}),e.jsxs(N,{children:[e.jsx(i,{variant:"outline",onClick:()=>s(!1),disabled:d,children:m}),e.jsxs(i,{variant:x==="destructive"?"destructive":"default",onClick:b,disabled:d,children:[d&&e.jsx(y,{size:"sm",className:"mr-2"}),c]})]})]})})}function S({icon:a,title:s,description:t,action:o}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center",children:[a&&e.jsx("div",{className:"flex items-center justify-center w-12 h-12 rounded-full bg-muted text-muted-foreground mb-4",children:a}),e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-1",children:s}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4 max-w-sm",children:t}),o&&e.jsx(i,{onClick:o.onClick,children:o.label})]})}export{F as C,S as E,T,w as a,v as b,k as c,C as d,D as e,R as f};
|