@object-ui/fields 0.5.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/fields/src/__tests__/datetime-timezone.test.d.ts +0 -0
  2. package/dist/fields/src/__tests__/extreme-inputs.test.d.ts +0 -0
  3. package/dist/fields/src/__tests__/form-variants.test.d.ts +0 -0
  4. package/dist/fields/src/__tests__/validation-feedback.test.d.ts +0 -0
  5. package/dist/fields/src/fields-edge-cases.stories.d.ts +45 -0
  6. package/dist/fields/src/index.d.ts +2 -1
  7. package/dist/fields/src/widgets/BooleanField.d.ts +4 -0
  8. package/dist/fields/src/widgets/DateField.d.ts +4 -0
  9. package/dist/fields/src/widgets/DateTimeField.d.ts +4 -0
  10. package/dist/fields/src/widgets/EmailField.d.ts +4 -0
  11. package/dist/fields/src/widgets/FileField.d.ts +4 -0
  12. package/dist/fields/src/widgets/ImageField.d.ts +4 -0
  13. package/dist/fields/src/widgets/LocationField.d.ts +4 -0
  14. package/dist/fields/src/widgets/NumberField.d.ts +4 -0
  15. package/dist/fields/src/widgets/PasswordField.d.ts +4 -0
  16. package/dist/fields/src/widgets/PercentField.d.ts +4 -0
  17. package/dist/fields/src/widgets/PhoneField.d.ts +4 -0
  18. package/dist/fields/src/widgets/SelectField.d.ts +4 -0
  19. package/dist/fields/src/widgets/TextAreaField.d.ts +4 -0
  20. package/dist/fields/src/widgets/TextField.d.ts +4 -0
  21. package/dist/fields/src/widgets/TimeField.d.ts +4 -0
  22. package/dist/fields/src/widgets/UrlField.d.ts +4 -0
  23. package/dist/index.cjs +3 -3
  24. package/dist/index.js +216 -197
  25. package/package.json +9 -9
  26. package/src/__tests__/datetime-timezone.test.tsx +770 -0
  27. package/src/__tests__/extreme-inputs.test.tsx +567 -0
  28. package/src/__tests__/form-variants.test.tsx +306 -0
  29. package/src/__tests__/validation-feedback.test.tsx +352 -0
  30. package/src/fields-edge-cases.stories.tsx +407 -0
  31. package/src/index.tsx +36 -11
  32. package/src/widgets/BooleanField.tsx +4 -0
  33. package/src/widgets/DateField.tsx +4 -0
  34. package/src/widgets/DateTimeField.tsx +4 -0
  35. package/src/widgets/EmailField.tsx +4 -0
  36. package/src/widgets/FileField.tsx +4 -0
  37. package/src/widgets/ImageField.tsx +4 -0
  38. package/src/widgets/LocationField.tsx +4 -0
  39. package/src/widgets/NumberField.tsx +4 -0
  40. package/src/widgets/PasswordField.tsx +4 -0
  41. package/src/widgets/PercentField.tsx +4 -0
  42. package/src/widgets/PhoneField.tsx +4 -0
  43. package/src/widgets/SelectField.tsx +4 -0
  44. package/src/widgets/SignatureField.tsx +1 -1
  45. package/src/widgets/TextAreaField.tsx +4 -0
  46. package/src/widgets/TextField.tsx +4 -0
  47. package/src/widgets/TimeField.tsx +4 -0
  48. package/src/widgets/UrlField.tsx +4 -0
@@ -0,0 +1,45 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ /**
3
+ * **Field Widgets – Edge Cases** from `@object-ui/fields`.
4
+ *
5
+ * Stories that exercise boundary conditions: empty values, overflow text,
6
+ * RTL content, emoji-only input, error states, disabled state, and readonly
7
+ * variants across multiple field types.
8
+ */
9
+ declare const meta: {
10
+ title: string;
11
+ parameters: {
12
+ layout: string;
13
+ };
14
+ tags: string[];
15
+ argTypes: {
16
+ readonly: {
17
+ control: "boolean";
18
+ description: string;
19
+ };
20
+ disabled: {
21
+ control: "boolean";
22
+ description: string;
23
+ };
24
+ };
25
+ };
26
+ export default meta;
27
+ type Story = StoryObj<any>;
28
+ export declare const EmptyText: Story;
29
+ export declare const NullNumber: Story;
30
+ export declare const EmptySelect: Story;
31
+ export declare const LongText: Story;
32
+ export declare const LongTextArea: Story;
33
+ export declare const LongUrl: Story;
34
+ export declare const RTLText: Story;
35
+ export declare const RTLTextArea: Story;
36
+ export declare const EmojiText: Story;
37
+ export declare const EmojiEmail: Story;
38
+ export declare const ErrorText: Story;
39
+ export declare const ErrorNumber: Story;
40
+ export declare const ErrorSelect: Story;
41
+ export declare const DisabledText: Story;
42
+ export declare const DisabledNumber: Story;
43
+ export declare const DisabledSelect: Story;
44
+ export declare const DisabledBoolean: Story;
45
+ export declare const ReadonlyGallery: Story;
@@ -15,6 +15,7 @@ export interface CellRendererProps {
15
15
  export declare function formatCurrency(value: number, currency?: string): string;
16
16
  /**
17
17
  * Format percent value
18
+ * Handles both decimal (0.8 = 80%) and whole number (80 = 80%) inputs.
18
19
  */
19
20
  export declare function formatPercent(value: number, precision?: number): string;
20
21
  /**
@@ -38,7 +39,7 @@ export declare function NumberCellRenderer({ value, field }: CellRendererProps):
38
39
  */
39
40
  export declare function CurrencyCellRenderer({ value, field }: CellRendererProps): React.ReactElement;
40
41
  /**
41
- * Percent field cell renderer
42
+ * Percent field cell renderer with mini progress bar
42
43
  */
43
44
  export declare function PercentCellRenderer({ value, field }: CellRendererProps): React.ReactElement;
44
45
  /**
@@ -1,2 +1,6 @@
1
1
  import { FieldWidgetProps } from './types';
2
+ /**
3
+ * BooleanField - Toggle input supporting switch and checkbox variants
4
+ * Renders as Switch or Checkbox based on field widget configuration
5
+ */
2
6
  export declare function BooleanField({ value, onChange, field, readonly, ...props }: FieldWidgetProps<boolean>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,6 @@
1
1
  import { FieldWidgetProps } from './types';
2
+ /**
3
+ * DateField - Date picker input widget
4
+ * Uses native date input and displays locale-formatted date in readonly mode
5
+ */
2
6
  export declare function DateField({ value, onChange, field, readonly, ...props }: FieldWidgetProps<string>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,6 @@
1
1
  import { FieldWidgetProps } from './types';
2
+ /**
3
+ * DateTimeField - Combined date and time picker widget
4
+ * Displays both date and time in locale format when readonly
5
+ */
2
6
  export declare function DateTimeField({ value, onChange, field, readonly, ...props }: FieldWidgetProps<string>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,6 @@
1
1
  import { FieldWidgetProps } from './types';
2
+ /**
3
+ * EmailField - Email address input with mailto link in readonly mode
4
+ * Renders as a clickable mailto link when readonly, standard email input otherwise
5
+ */
2
6
  export declare function EmailField({ value, onChange, field, readonly, errorMessage, ...props }: FieldWidgetProps<string>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,6 @@
1
1
  import { FieldWidgetProps } from './types';
2
+ /**
3
+ * FileField - File upload widget with drag-and-drop support
4
+ * Supports single and multiple file uploads with configurable accepted file types
5
+ */
2
6
  export declare function FileField({ value, onChange, field, readonly, ...props }: FieldWidgetProps<any>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,6 @@
1
1
  import { FieldWidgetProps } from './types';
2
+ /**
3
+ * ImageField - Image upload widget with preview thumbnails
4
+ * Supports single and multiple image uploads with drag-and-drop and preview display
5
+ */
2
6
  export declare function ImageField({ value, onChange, field, readonly, ...props }: FieldWidgetProps<any>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,6 @@
1
1
  import { FieldWidgetProps } from './types';
2
+ /**
3
+ * LocationField - Geographic coordinate input for latitude and longitude
4
+ * Stores location as { latitude, longitude } object and displays as comma-separated pair
5
+ */
2
6
  export declare function LocationField({ value, onChange, field, readonly, ...props }: FieldWidgetProps<any>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,6 @@
1
1
  import { FieldWidgetProps } from './types';
2
+ /**
3
+ * NumberField - Numeric input with optional decimal precision
4
+ * Supports min/max/step constraints and configurable decimal precision
5
+ */
2
6
  export declare function NumberField({ value, onChange, field, readonly, ...props }: FieldWidgetProps<number>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,6 @@
1
1
  import { FieldWidgetProps } from './types';
2
+ /**
3
+ * PasswordField - Secure password input with visibility toggle
4
+ * Includes show/hide toggle button and masks value in readonly mode
5
+ */
2
6
  export declare function PasswordField({ value, onChange, field, readonly, className, ...props }: FieldWidgetProps<string>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,6 @@
1
1
  import { FieldWidgetProps } from './types';
2
+ /**
3
+ * PercentField - Percentage input with configurable decimal precision
4
+ * Stores values as decimals (0-1) and displays as percentages (0-100%)
5
+ */
2
6
  export declare function PercentField({ value, onChange, field, readonly, errorMessage, className, ...props }: FieldWidgetProps<number>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,6 @@
1
1
  import { FieldWidgetProps } from './types';
2
+ /**
3
+ * PhoneField - Telephone number input with tel link in readonly mode
4
+ * Renders as a clickable tel link when readonly, standard phone input otherwise
5
+ */
2
6
  export declare function PhoneField({ value, onChange, field, readonly, errorMessage, ...props }: FieldWidgetProps<string>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,6 @@
1
1
  import { FieldWidgetProps } from './types';
2
+ /**
3
+ * SelectField - Dropdown selection widget with configurable options
4
+ * Renders options from field metadata with support for placeholder and readonly display
5
+ */
2
6
  export declare function SelectField({ value, onChange, field, readonly, ...props }: FieldWidgetProps<string>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,6 @@
1
1
  import { FieldWidgetProps } from './types';
2
+ /**
3
+ * TextAreaField - Multi-line text input widget
4
+ * Supports configurable row count and preserves whitespace in readonly mode
5
+ */
2
6
  export declare function TextAreaField({ value, onChange, field, readonly, errorMessage, ...props }: FieldWidgetProps<string>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,6 @@
1
1
  import { FieldWidgetProps } from './types';
2
+ /**
3
+ * TextField - Standard single-line or multi-line text input
4
+ * Automatically renders as a textarea when rows are configured in field metadata
5
+ */
2
6
  export declare function TextField({ value, onChange, field, readonly, ...props }: FieldWidgetProps<string>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,6 @@
1
1
  import { FieldWidgetProps } from './types';
2
+ /**
3
+ * TimeField - Time picker input widget
4
+ * Uses native time input for hour and minute selection
5
+ */
2
6
  export declare function TimeField({ value, onChange, field, readonly, ...props }: FieldWidgetProps<string>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,6 @@
1
1
  import { FieldWidgetProps } from './types';
2
+ /**
3
+ * UrlField - URL input with clickable link in readonly mode
4
+ * Validates URLs to only render http/https links for security
5
+ */
2
6
  export declare function UrlField({ value, onChange, field, readonly, errorMessage, ...props }: FieldWidgetProps<string>): import("react/jsx-runtime").JSX.Element;
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),b=require("@object-ui/core"),d=require("@object-ui/components"),F=require("lucide-react");var M={exports:{}},k={};var Ie;function pt(){if(Ie)return k;Ie=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function n(s,a,l){var i=null;if(l!==void 0&&(i=""+l),a.key!==void 0&&(i=""+a.key),"key"in a){l={};for(var o in a)o!=="key"&&(l[o]=a[o])}else l=a;return a=l.ref,{$$typeof:e,type:s,key:i,ref:a!==void 0?a:null,props:l}}return k.Fragment=r,k.jsx=n,k.jsxs=n,k}var $={};var Ue;function ht(){return Ue||(Ue=1,process.env.NODE_ENV!=="production"&&(function(){function e(m){if(m==null)return null;if(typeof m=="function")return m.$$typeof===mt?null:m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case P:return"Fragment";case R:return"Profiler";case N:return"StrictMode";case ot:return"Suspense";case ct:return"SuspenseList";case ut:return"Activity"}if(typeof m=="object")switch(typeof m.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),m.$$typeof){case v:return"Portal";case L:return m.displayName||"Context";case A:return(m._context.displayName||"Context")+".Consumer";case it:var j=m.render;return m=m.displayName,m||(m=j.displayName||j.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case dt:return j=m.displayName||null,j!==null?j:e(m.type)||"Memo";case B:j=m._payload,m=m._init;try{return e(m(j))}catch{}}return null}function r(m){return""+m}function n(m){try{r(m);var j=!1}catch{j=!0}if(j){j=console;var _=j.error,S=typeof Symbol=="function"&&Symbol.toStringTag&&m[Symbol.toStringTag]||m.constructor.name||"Object";return _.call(j,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",S),r(m)}}function s(m){if(m===P)return"<>";if(typeof m=="object"&&m!==null&&m.$$typeof===B)return"<...>";try{var j=e(m);return j?"<"+j+">":"<...>"}catch{return"<...>"}}function a(){var m=V.A;return m===null?null:m.getOwner()}function l(){return Error("react-stack-top-frame")}function i(m){if(Ae.call(m,"key")){var j=Object.getOwnPropertyDescriptor(m,"key").get;if(j&&j.isReactWarning)return!1}return m.key!==void 0}function o(m,j){function _(){ke||(ke=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",j))}_.isReactWarning=!0,Object.defineProperty(m,"key",{get:_,configurable:!0})}function c(){var m=e(this.type);return $e[m]||($e[m]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),m=this.props.ref,m!==void 0?m:null}function f(m,j,_,S,E,q){var w=_.ref;return m={$$typeof:g,type:m,key:j,props:_,_owner:S},(w!==void 0?w:null)!==null?Object.defineProperty(m,"ref",{enumerable:!1,get:c}):Object.defineProperty(m,"ref",{enumerable:!1,value:null}),m._store={},Object.defineProperty(m._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(m,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(m,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:E}),Object.defineProperty(m,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.freeze&&(Object.freeze(m.props),Object.freeze(m)),m}function h(m,j,_,S,E,q){var w=j.children;if(w!==void 0)if(S)if(ft(w)){for(S=0;S<w.length;S++)p(w[S]);Object.freeze&&Object.freeze(w)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else p(w);if(Ae.call(j,"key")){w=e(m);var O=Object.keys(j).filter(function(xt){return xt!=="key"});S=0<O.length?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}",Me[w+S]||(O=0<O.length?"{"+O.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),b=require("@object-ui/core"),d=require("@object-ui/components"),F=require("lucide-react");var M={exports:{}},k={};var Ie;function pt(){if(Ie)return k;Ie=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function a(s,n,l){var i=null;if(l!==void 0&&(i=""+l),n.key!==void 0&&(i=""+n.key),"key"in n){l={};for(var o in n)o!=="key"&&(l[o]=n[o])}else l=n;return n=l.ref,{$$typeof:e,type:s,key:i,ref:n!==void 0?n:null,props:l}}return k.Fragment=r,k.jsx=a,k.jsxs=a,k}var $={};var Ue;function ht(){return Ue||(Ue=1,process.env.NODE_ENV!=="production"&&(function(){function e(m){if(m==null)return null;if(typeof m=="function")return m.$$typeof===mt?null:m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case P:return"Fragment";case R:return"Profiler";case N:return"StrictMode";case ot:return"Suspense";case ct:return"SuspenseList";case ut:return"Activity"}if(typeof m=="object")switch(typeof m.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),m.$$typeof){case v:return"Portal";case L:return m.displayName||"Context";case A:return(m._context.displayName||"Context")+".Consumer";case it:var j=m.render;return m=m.displayName,m||(m=j.displayName||j.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case dt:return j=m.displayName||null,j!==null?j:e(m.type)||"Memo";case B:j=m._payload,m=m._init;try{return e(m(j))}catch{}}return null}function r(m){return""+m}function a(m){try{r(m);var j=!1}catch{j=!0}if(j){j=console;var _=j.error,S=typeof Symbol=="function"&&Symbol.toStringTag&&m[Symbol.toStringTag]||m.constructor.name||"Object";return _.call(j,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",S),r(m)}}function s(m){if(m===P)return"<>";if(typeof m=="object"&&m!==null&&m.$$typeof===B)return"<...>";try{var j=e(m);return j?"<"+j+">":"<...>"}catch{return"<...>"}}function n(){var m=V.A;return m===null?null:m.getOwner()}function l(){return Error("react-stack-top-frame")}function i(m){if(Ae.call(m,"key")){var j=Object.getOwnPropertyDescriptor(m,"key").get;if(j&&j.isReactWarning)return!1}return m.key!==void 0}function o(m,j){function _(){ke||(ke=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",j))}_.isReactWarning=!0,Object.defineProperty(m,"key",{get:_,configurable:!0})}function c(){var m=e(this.type);return $e[m]||($e[m]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),m=this.props.ref,m!==void 0?m:null}function f(m,j,_,S,E,q){var w=_.ref;return m={$$typeof:g,type:m,key:j,props:_,_owner:S},(w!==void 0?w:null)!==null?Object.defineProperty(m,"ref",{enumerable:!1,get:c}):Object.defineProperty(m,"ref",{enumerable:!1,value:null}),m._store={},Object.defineProperty(m._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(m,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(m,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:E}),Object.defineProperty(m,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.freeze&&(Object.freeze(m.props),Object.freeze(m)),m}function h(m,j,_,S,E,q){var w=j.children;if(w!==void 0)if(S)if(ft(w)){for(S=0;S<w.length;S++)p(w[S]);Object.freeze&&Object.freeze(w)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else p(w);if(Ae.call(j,"key")){w=e(m);var O=Object.keys(j).filter(function(xt){return xt!=="key"});S=0<O.length?"{key: someKey, "+O.join(": ..., ")+": ...}":"{key: someKey}",Me[w+S]||(O=0<O.length?"{"+O.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,S,w,O,w),Me[w+S]=!0)}if(w=null,_!==void 0&&(n(_),w=""+_),i(j)&&(n(j.key),w=""+j.key),"key"in j){_={};for(var J in j)J!=="key"&&(_[J]=j[J])}else _=j;return w&&o(_,typeof m=="function"?m.displayName||m.name||"Unknown":m),f(m,w,_,a(),E,q)}function p(m){u(m)?m._store&&(m._store.validated=1):typeof m=="object"&&m!==null&&m.$$typeof===B&&(m._payload.status==="fulfilled"?u(m._payload.value)&&m._payload.value._store&&(m._payload.value._store.validated=1):m._store&&(m._store.validated=1))}function u(m){return typeof m=="object"&&m!==null&&m.$$typeof===g}var x=C,g=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),L=Symbol.for("react.context"),it=Symbol.for("react.forward_ref"),ot=Symbol.for("react.suspense"),ct=Symbol.for("react.suspense_list"),dt=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),ut=Symbol.for("react.activity"),mt=Symbol.for("react.client.reference"),V=x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ae=Object.prototype.hasOwnProperty,ft=Array.isArray,Y=console.createTask?console.createTask:function(){return null};x={react_stack_bottom_frame:function(m){return m()}};var ke,$e={},ze=x.react_stack_bottom_frame.bind(x,l)(),Ee=Y(s(l)),Me={};$.Fragment=P,$.jsx=function(m,j,_){var S=1e4>V.recentlyCreatedOwnerStacks++;return h(m,j,_,!1,S?Error("react-stack-top-frame"):ze,S?Y(s(m)):Ee)},$.jsxs=function(m,j,_){var S=1e4>V.recentlyCreatedOwnerStacks++;return h(m,j,_,!0,S?Error("react-stack-top-frame"):ze,S?Y(s(m)):Ee)}})()),$}var De;function gt(){return De||(De=1,process.env.NODE_ENV==="production"?M.exports=pt():M.exports=ht()),M.exports}var t=gt();function H({value:e,onChange:r,field:n,readonly:s,...a}){const l=n||a.schema;if(s)return t.jsx("span",{className:"text-sm",children:e||"-"});const i=l?.rows,{inputType:o,...c}=a;return i&&i>1?t.jsx(d.Textarea,{...c,value:e||"",onChange:f=>r(f.target.value),placeholder:l?.placeholder,disabled:s||c.disabled}):t.jsx(d.Input,{...c,type:l?.type==="password"?"password":"text",value:e||"",onChange:f=>r(f.target.value),placeholder:l?.placeholder,disabled:s||c.disabled})}const bt=Object.freeze(Object.defineProperty({__proto__:null,TextField:H},Symbol.toStringTag,{value:"Module"}));function Z({value:e,onChange:r,field:n,readonly:s,...a}){if(s)return t.jsx("span",{className:"text-sm",children:e??"-"});const l=n||a.schema,i=l?.precision,{inputType:o,...c}=a;return t.jsx(d.Input,{...c,type:"number",value:e??"",onChange:f=>{const h=f.target.value;r(h===""?null:Number(h))},placeholder:l?.placeholder,disabled:s||c.disabled,step:i?Math.pow(10,-i):"any"})}const jt=Object.freeze(Object.defineProperty({__proto__:null,NumberField:Z},Symbol.toStringTag,{value:"Module"}));function K({value:e,onChange:r,field:n,readonly:s,...a}){const l=n||a.schema,i=l?.widget,o=C.useId(),c=l?.name||o,f=l?.label||"Checkbox";if(s)return t.jsx("span",{className:"text-sm",children:e?"Yes":"No"});const{inputType:h,...p}=a;return i==="checkbox"?t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(d.Checkbox,{...p,id:c,checked:!!e,onCheckedChange:u=>r(!!u),disabled:s||p.disabled}),t.jsx(d.Label,{htmlFor:c,children:f})]}):t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(d.Switch,{...p,id:c,checked:!!e,onCheckedChange:r,disabled:s||p.disabled}),t.jsx(d.Label,{htmlFor:c,children:f})]})}const yt=Object.freeze(Object.defineProperty({__proto__:null,BooleanField:K},Symbol.toStringTag,{value:"Module"}));function ee({value:e,onChange:r,field:n,readonly:s,...a}){const l=n||a.schema,i=l?.options||[];if(s){const o=i.find(c=>c.value===e);return t.jsx("span",{className:"text-sm",children:o?.label||e||"-"})}return t.jsxs(d.Select,{...a,value:e,onValueChange:r,disabled:s||a.disabled,children:[t.jsx(d.SelectTrigger,{className:a.className,id:a.id,children:t.jsx(d.SelectValue,{placeholder:l?.placeholder||"Select an option"})}),t.jsx(d.SelectContent,{position:"popper",children:i.map(o=>t.jsx(d.SelectItem,{value:o.value,children:o.label},o.value))})]})}const Nt=Object.freeze(Object.defineProperty({__proto__:null,SelectField:ee},Symbol.toStringTag,{value:"Module"}));function te({value:e,onChange:r,field:n,readonly:s,...a}){if(s)return t.jsx("span",{className:"text-sm",children:e?new Date(e).toLocaleDateString():"-"});const{inputType:l,...i}=a;return t.jsx(d.Input,{...i,type:"date",value:e||"",onChange:o=>r(o.target.value),disabled:s||i.disabled})}const vt=Object.freeze(Object.defineProperty({__proto__:null,DateField:te},Symbol.toStringTag,{value:"Module"}));function re({value:e,onChange:r,field:n,readonly:s,errorMessage:a,...l}){const i=n||l.schema;if(s)return e?t.jsx("a",{href:`mailto:${e}`,className:"text-sm text-blue-600 hover:text-blue-800 hover:underline",children:e}):t.jsx("span",{className:"text-sm",children:"-"});const{inputType:o,...c}=l;return t.jsx(d.Input,{...c,type:"email",value:e||"",onChange:f=>r(f.target.value),placeholder:i?.placeholder||"email@example.com",disabled:s||c.disabled,"aria-invalid":!!a})}const Ft=Object.freeze(Object.defineProperty({__proto__:null,EmailField:re},Symbol.toStringTag,{value:"Module"}));function se({value:e,onChange:r,field:n,readonly:s,errorMessage:a,...l}){const i=n||l.schema;if(s)return e?t.jsx("a",{href:`tel:${e}`,className:"text-sm text-blue-600 hover:text-blue-800 hover:underline",children:e}):t.jsx("span",{className:"text-sm",children:"-"});const{inputType:o,...c}=l;return t.jsx(d.Input,{...c,type:"tel",value:e||"",onChange:f=>r(f.target.value),placeholder:i?.placeholder||"(555) 123-4567",disabled:s||c.disabled,"aria-invalid":!!a})}const _t=Object.freeze(Object.defineProperty({__proto__:null,PhoneField:se},Symbol.toStringTag,{value:"Module"}));function ne({value:e,onChange:r,field:n,readonly:s,errorMessage:a,...l}){const i=n||l.schema;if(s)return e?e.startsWith("http://")||e.startsWith("https://")?t.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:text-blue-800 hover:underline",children:e}):t.jsx("span",{className:"text-sm",children:e}):t.jsx("span",{className:"text-sm",children:"-"});const{inputType:o,...c}=l;return t.jsx(d.Input,{...c,type:"url",value:e||"",onChange:f=>r(f.target.value),placeholder:i?.placeholder||"https://example.com",disabled:s||c.disabled,"aria-invalid":!!a})}const Ct=Object.freeze(Object.defineProperty({__proto__:null,UrlField:ne},Symbol.toStringTag,{value:"Module"}));function St(e,r="USD"){try{return new Intl.NumberFormat("en-US",{style:"currency",currency:r}).format(e)}catch{return`${r} ${e.toFixed(2)}`}}function ae({value:e,onChange:r,field:n,readonly:s,errorMessage:a,className:l,...i}){const o=n||i.schema,c=o?.currency||"USD",f=o?.precision??2;if(s)return e==null?t.jsx("span",{className:"text-sm",children:"-"}):t.jsx("span",{className:"text-sm font-medium tabular-nums",children:St(Number(e),c)});const h=p=>{const u=parseFloat(p.target.value);isNaN(u)||r(parseFloat(u.toFixed(f)))};return t.jsxs("div",{className:"relative",children:[t.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",children:c==="USD"?"$":c}),t.jsx(d.Input,{...i,type:"number",value:e??"",onChange:p=>{const u=p.target.value===""?null:parseFloat(p.target.value);r(u)},onBlur:h,placeholder:o?.placeholder||"0.00",disabled:s||i.disabled,className:`pl-8 ${l||""}`,step:Math.pow(10,-f).toFixed(f),"aria-invalid":!!a})]})}const wt=Object.freeze(Object.defineProperty({__proto__:null,CurrencyField:ae},Symbol.toStringTag,{value:"Module"}));function le({value:e,onChange:r,field:n,readonly:s,errorMessage:a,...l}){if(s)return t.jsx("div",{className:"text-sm whitespace-pre-wrap",children:e||"-"});const i=n||l.schema,o=i?.rows||4,c=i?.max_length,{inputType:f,...h}=l;return t.jsxs("div",{className:"relative",children:[t.jsx(d.Textarea,{...h,value:e||"",onChange:p=>r(p.target.value),placeholder:i?.placeholder,disabled:s||h.disabled,rows:o,maxLength:c,"aria-invalid":!!a}),c&&t.jsxs("div",{className:"absolute bottom-2 right-2 text-xs text-gray-400","aria-live":"polite","aria-label":`Character count: ${(e||"").length} of ${c}`,children:[(e||"").length,"/",c]})]})}const Rt=Object.freeze(Object.defineProperty({__proto__:null,TextAreaField:le},Symbol.toStringTag,{value:"Module"}));function I({value:e,onChange:r,field:n,readonly:s,errorMessage:a,...l}){if(s)return t.jsx("div",{className:"text-sm prose prose-sm max-w-none",children:e||"-"});const i=n||l.schema,o=i?.rows||8,c=i?.format||"markdown";return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500",children:[t.jsxs("span",{children:["Format: ",c]}),t.jsx("span",{className:"italic",children:"Rich text editor (basic)"})]}),t.jsx(d.Textarea,{value:e||"",onChange:f=>r(f.target.value),placeholder:i?.placeholder||"Enter text...",disabled:s||l.disabled,rows:o,className:`font-mono text-sm ${l.className||""}`,"aria-invalid":!!a})]})}const Le=Object.freeze(Object.defineProperty({__proto__:null,RichTextField:I},Symbol.toStringTag,{value:"Module"}));function ie({value:e,onChange:r,field:n,readonly:s,...a}){const[l,i]=C.useState(!1),[o,c]=C.useState(""),f=n||a.schema,h=f?.options||[],p=f.multiple||!1,u=f.display_field||"label",x=h.filter(N=>N.label.toLowerCase().includes(o.toLowerCase())),g=p?(Array.isArray(e)?e:[]).map(N=>h.find(R=>R.value===N)).filter(Boolean):e?[h.find(N=>N.value===e)].filter(Boolean):[],v=N=>{if(p){const R=Array.isArray(e)?e:[],A=R.includes(N.value);r(A?R.filter(L=>L!==N.value):[...R,N.value])}else r(N.value),i(!1)},P=N=>{if(p){const R=Array.isArray(e)?e:[];r(R.filter(A=>A!==N))}else r(null)};return s?g.length?p?t.jsx("div",{className:"flex flex-wrap gap-1",children:g.map((N,R)=>t.jsx(d.Badge,{variant:"outline",children:N?.[u]||N?.label},R))}):t.jsx("span",{className:"text-sm",children:g[0]?.[u]||g[0]?.label}):t.jsx("span",{className:"text-sm",children:"-"}):t.jsxs("div",{className:"space-y-2",children:[g.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1",children:g.map((N,R)=>t.jsxs(d.Badge,{variant:"outline",className:"gap-1",children:[N?.[u]||N?.label,t.jsx("button",{onClick:()=>P(N?.value),className:"ml-1 hover:text-destructive",type:"button","aria-label":`Remove ${N?.[u]||N?.label}`,children:t.jsx(F.X,{className:"size-3"})})]},R))}),t.jsxs(d.Dialog,{open:l,onOpenChange:i,children:[t.jsx(d.DialogTrigger,{asChild:!0,children:t.jsxs(d.Button,{variant:"outline",className:"w-full justify-start text-left font-normal",type:"button",children:[t.jsx(F.Search,{className:"mr-2 size-4"}),g.length===0?f?.placeholder||"Select...":p?`${g.length} selected`:"Change selection"]})}),t.jsxs(d.DialogContent,{className:"max-w-md",children:[t.jsx(d.DialogHeader,{children:t.jsxs(d.DialogTitle,{children:[f?.label||"Select"," ",p&&"(multiple)"]})}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(d.Input,{placeholder:"Search...",value:o,onChange:N=>c(N.target.value),className:"w-full"}),t.jsx("div",{className:"max-h-64 overflow-y-auto space-y-1",children:x.length===0?t.jsx("p",{className:"text-sm text-gray-500 text-center py-4",children:"No options found"}):x.map(N=>{const R=p?(Array.isArray(e)?e:[]).includes(N.value):e===N.value;return t.jsxs("button",{onClick:()=>v(N),className:`w-full text-left px-3 py-2 rounded-md text-sm hover:bg-gray-100 flex items-center justify-between ${R?"bg-blue-50 text-blue-700":""}`,type:"button",children:[t.jsx("span",{children:N.label}),R&&t.jsx(d.Badge,{variant:"default",className:"ml-2",children:"Selected"})]},N.value)})})]})]})]})]})}const Pt=Object.freeze(Object.defineProperty({__proto__:null,LookupField:ie},Symbol.toStringTag,{value:"Module"}));function oe({value:e,onChange:r,field:n,readonly:s,...a}){if(s){if(!e)return t.jsx("span",{className:"text-sm",children:"-"});const o=new Date(e);return t.jsxs("span",{className:"text-sm",children:[o.toLocaleDateString()," ",o.toLocaleTimeString()]})}const{inputType:l,...i}=a;return t.jsx(d.Input,{...i,type:"datetime-local",value:e||"",onChange:o=>r(o.target.value),disabled:s||i.disabled})}const Tt=Object.freeze(Object.defineProperty({__proto__:null,DateTimeField:oe},Symbol.toStringTag,{value:"Module"}));function ce({value:e,onChange:r,field:n,readonly:s,...a}){if(s)return t.jsx("span",{className:"text-sm",children:e||"-"});const{inputType:l,...i}=a;return t.jsx(d.Input,{...i,type:"time",value:e||"",onChange:o=>r(o.target.value),disabled:s||i.disabled})}const Ot=Object.freeze(Object.defineProperty({__proto__:null,TimeField:ce},Symbol.toStringTag,{value:"Module"}));function de({value:e,onChange:r,field:n,readonly:s,errorMessage:a,className:l,...i}){const o=n||i.schema,c=o?.precision??2;if(s)return e==null?t.jsx("span",{className:"text-sm",children:"-"}):t.jsxs("span",{className:"text-sm font-medium tabular-nums",children:[(e*100).toFixed(c),"%"]});const f=e!=null?e*100:"",h=p=>{if(p.target.value===""){r(null);return}const u=parseFloat(p.target.value),x=isNaN(u)?null:u/100;r(x)};return t.jsxs("div",{className:"relative",children:[t.jsx(d.Input,{...i,type:"number",value:f,onChange:h,placeholder:o?.placeholder||"0",disabled:s||i.disabled,className:`pr-8 ${l||""}`,step:Math.pow(10,-c).toFixed(c),"aria-invalid":!!a}),t.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",children:"%"})]})}const At=Object.freeze(Object.defineProperty({__proto__:null,PercentField:de},Symbol.toStringTag,{value:"Module"}));function ue({value:e,onChange:r,field:n,readonly:s,className:a,...l}){const[i,o]=C.useState(!1),c=n||l.schema;if(s)return t.jsx("span",{className:"text-sm",children:"••••••••"});const{inputType:f,...h}=l;return t.jsxs("div",{className:"relative",children:[t.jsx(d.Input,{...h,type:i?"text":"password",value:e||"",onChange:p=>r(p.target.value),placeholder:c?.placeholder,disabled:s||h.disabled,className:`pr-10 ${a||""}`}),t.jsx(d.Button,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>o(!i),tabIndex:-1,children:i?t.jsx(F.EyeOff,{className:"size-4 text-gray-500"}):t.jsx(F.Eye,{className:"size-4 text-gray-500"})})]})}const kt=Object.freeze(Object.defineProperty({__proto__:null,PasswordField:ue},Symbol.toStringTag,{value:"Module"}));function me({value:e,onChange:r,field:n,readonly:s,...a}){const l=C.useRef(null),i=n||a.schema,o=i?.multiple||!1,c=i?.accept?i.accept.join(","):void 0;if(s){if(!e)return t.jsx("span",{className:"text-sm",children:"-"});const u=Array.isArray(e)?e:[e];return t.jsx("div",{className:"flex flex-wrap gap-2",children:u.map((x,g)=>t.jsx("span",{className:"text-sm truncate max-w-xs",children:x.name||x.original_name||"File"},g))})}const f=e?Array.isArray(e)?e:[e]:[],h=u=>{const x=Array.from(u.target.files||[]);if(x.length===0)return;const g=x.map(v=>({name:v.name,original_name:v.name,size:v.size,mime_type:v.type,url:URL.createObjectURL(v)}));r(o?[...f,...g]:g[0])},p=u=>{if(o){const x=f.filter((g,v)=>v!==u);r(x.length>0?x:null)}else r(null)};return t.jsxs("div",{className:a.className,children:[t.jsx("input",{ref:l,type:"file",multiple:o,accept:c,onChange:h,className:"hidden"}),t.jsxs("div",{className:"space-y-2",children:[f.length>0&&t.jsx("div",{className:"space-y-1",children:f.map((u,x)=>t.jsxs("div",{className:"flex items-center justify-between gap-2 p-2 bg-gray-50 rounded-md border border-gray-200",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[t.jsx(F.File,{className:"size-4 text-gray-500 flex-shrink-0"}),t.jsx("span",{className:"text-sm truncate",children:u.name||u.original_name||"File"}),u.size&&t.jsxs("span",{className:"text-xs text-gray-500",children:["(",(u.size/1024).toFixed(1)," KB)"]})]}),t.jsx(d.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>p(x),className:"h-6 w-6 p-0",children:t.jsx(F.X,{className:"size-3"})})]},x))}),t.jsxs(d.Button,{type:"button",variant:"outline",onClick:()=>l.current?.click(),className:"w-full",children:[t.jsx(F.Upload,{className:"size-4 mr-2"}),f.length>0?"Add More Files":"Upload File"]})]})]})}const $t=Object.freeze(Object.defineProperty({__proto__:null,FileField:me},Symbol.toStringTag,{value:"Module"}));function fe({value:e,onChange:r,field:n,readonly:s,...a}){const l=C.useRef(null),i=n||a.schema,o=i?.multiple||!1,c=i?.accept?i.accept.join(","):"image/*";if(s){if(!e)return t.jsx("span",{className:"text-sm",children:"-"});const u=Array.isArray(e)?e:[e];return t.jsx("div",{className:"flex flex-wrap gap-2",children:u.map((x,g)=>t.jsx("img",{src:x.url||"",alt:x.name||`Image ${g+1}`,className:"size-20 rounded-md object-cover border border-gray-200"},g))})}const f=e?Array.isArray(e)?e:[e]:[],h=u=>{const x=Array.from(u.target.files||[]);if(x.length===0)return;const g=x.map(v=>({name:v.name,original_name:v.name,size:v.size,mime_type:v.type,url:URL.createObjectURL(v)}));r(o?[...f,...g]:g[0])},p=u=>{if(o){const x=f.filter((g,v)=>v!==u);r(x.length>0?x:null)}else r(null)};return t.jsxs("div",{className:a.className,children:[t.jsx("input",{ref:l,type:"file",multiple:o,accept:c,onChange:h,className:"hidden"}),t.jsxs("div",{className:"space-y-2",children:[f.length>0&&t.jsx("div",{className:"grid grid-cols-4 gap-2",children:f.map((u,x)=>t.jsxs("div",{className:"relative group",children:[t.jsx("img",{src:u.url||"",alt:u.name||`Image ${x+1}`,className:"size-20 rounded-md object-cover border border-gray-200"}),t.jsx(d.Button,{type:"button",variant:"destructive",size:"sm",onClick:()=>p(x),className:"absolute top-1 right-1 h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(F.X,{className:"size-3"})})]},x))}),t.jsxs(d.Button,{type:"button",variant:"outline",onClick:()=>l.current?.click(),className:"w-full",children:[t.jsx(F.Image,{className:"size-4 mr-2"}),f.length>0?"Add More Images":"Upload Image"]})]})]})}const zt=Object.freeze(Object.defineProperty({__proto__:null,ImageField:fe},Symbol.toStringTag,{value:"Module"}));function xe({value:e,onChange:r,field:n,readonly:s,...a}){const l=n||a.schema,i=e&&typeof e=="object"?`${e.latitude||0}, ${e.longitude||0}`:"";if(s)return t.jsx("span",{className:"text-sm",children:i||"-"});const o=c=>{const f=c.target.value;if(!f.trim()){r(null);return}const h=f.split(",").map(p=>p.trim());if(h.length===2){const p=parseFloat(h[0]),u=parseFloat(h[1]);!isNaN(p)&&!isNaN(u)&&r({latitude:p,longitude:u})}};return t.jsx(d.Input,{type:"text",value:i,onChange:o,placeholder:l?.placeholder||"latitude, longitude",disabled:s||a.disabled,className:a.className})}const Et=Object.freeze(Object.defineProperty({__proto__:null,LocationField:xe},Symbol.toStringTag,{value:"Module"}));function pe({value:e,field:r,...n}){const a=(r||n.schema)?.return_type||"text";let l="-";return e!=null&&(a==="number"||a==="currency"?l=typeof e=="number"?e.toFixed(2):String(e):a==="boolean"?l=e?"Yes":"No":a==="date"?l=new Date(e).toLocaleDateString():l=String(e)),t.jsx("span",{className:`text-sm font-mono text-gray-700 ${n.className||""}`,children:l})}const Mt=Object.freeze(Object.defineProperty({__proto__:null,FormulaField:pe},Symbol.toStringTag,{value:"Module"}));function he({value:e,field:r,...n}){const a=(r||n.schema)?.summary_type||"count";let l="-";return e!=null&&(a==="count"?l=String(e):["sum","avg","min","max"].includes(a)?l=typeof e=="number"?e.toFixed(2):String(e):l=String(e)),t.jsx("span",{className:`text-sm font-medium tabular-nums text-gray-700 ${n.className||""}`,children:l})}const It=Object.freeze(Object.defineProperty({__proto__:null,SummaryField:he},Symbol.toStringTag,{value:"Module"}));function ge({value:e,field:r,...n}){const s=e!=null?String(e):"-";return t.jsx("span",{className:`text-sm font-mono text-gray-700 ${n.className||""}`,children:s})}const Ut=Object.freeze(Object.defineProperty({__proto__:null,AutoNumberField:ge},Symbol.toStringTag,{value:"Module"}));function U({value:e,onChange:r,field:n,readonly:s,...a}){const i=(n||a.schema)?.multiple||!1;if(s){if(!e)return t.jsx("span",{className:"text-sm",children:"-"});const f=Array.isArray(e)?e:[e];return t.jsxs("div",{className:"flex -space-x-2",children:[f.slice(0,3).map((h,p)=>{const u=h.name||h.username||"User",x=u.split(" ").map(g=>g[0]).join("").toUpperCase().slice(0,2);return t.jsx(d.Avatar,{className:"size-8 border-2 border-white",title:u,children:t.jsx(d.AvatarFallback,{className:"bg-blue-500 text-white text-xs",children:x})},p)}),f.length>3&&t.jsx(d.Avatar,{className:"size-8 border-2 border-white",children:t.jsxs(d.AvatarFallback,{className:"bg-gray-200 text-gray-600 text-xs",children:["+",f.length-3]})})]})}const o=e?Array.isArray(e)?e:[e]:[],c=f=>{if(i){const h=o.filter((p,u)=>u!==f);r(h.length>0?h:null)}else r(null)};return t.jsxs("div",{className:a.className,children:[o.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:o.map((f,h)=>{const p=f.name||f.username||"User",u=p.split(" ").map(x=>x[0]).join("").toUpperCase().slice(0,2);return t.jsxs(d.Badge,{variant:"outline",className:"gap-2 pr-1",children:[t.jsx(d.Avatar,{className:"size-5",children:t.jsx(d.AvatarFallback,{className:"bg-blue-500 text-white text-xs",children:u})}),t.jsx("span",{className:"text-sm",children:p}),t.jsx("button",{type:"button",onClick:()=>c(h),className:"ml-1 rounded-full hover:bg-gray-200 p-0.5",children:t.jsx(F.X,{className:"size-3"})})]},h)})}),t.jsx("div",{className:"text-sm text-gray-500 italic",children:"User selection component requires integration with user management system"})]})}const Be=Object.freeze(Object.defineProperty({__proto__:null,UserField:U},Symbol.toStringTag,{value:"Module"}));function be({value:e,onChange:r,field:n,readonly:s,...a}){const l=n||a.schema,i=()=>e==null?"":JSON.stringify(e,null,2),[o,c]=C.useState(i),[f,h]=C.useState(null);if(C.useEffect(()=>{try{if(e==null){c("");return}const u=o?JSON.parse(o):null;JSON.stringify(u)!==JSON.stringify(e)&&c(JSON.stringify(e,null,2))}catch{c(JSON.stringify(e,null,2))}},[e,o]),s)return e?t.jsx("pre",{className:d.cn("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40",a.className),children:JSON.stringify(e,null,2)}):t.jsx("span",{className:"text-sm",children:"-"});const p=u=>{const x=u.target.value;if(c(x),h(null),!x.trim()){r(null);return}try{const g=JSON.parse(x);r(g)}catch{h("Invalid JSON")}};return t.jsxs("div",{className:"space-y-1",children:[t.jsx(d.Textarea,{value:o,onChange:p,placeholder:l?.placeholder||`{
6
+ <%s key={someKey} {...props} />`,S,w,O,w),Me[w+S]=!0)}if(w=null,_!==void 0&&(a(_),w=""+_),i(j)&&(a(j.key),w=""+j.key),"key"in j){_={};for(var J in j)J!=="key"&&(_[J]=j[J])}else _=j;return w&&o(_,typeof m=="function"?m.displayName||m.name||"Unknown":m),f(m,w,_,n(),E,q)}function p(m){u(m)?m._store&&(m._store.validated=1):typeof m=="object"&&m!==null&&m.$$typeof===B&&(m._payload.status==="fulfilled"?u(m._payload.value)&&m._payload.value._store&&(m._payload.value._store.validated=1):m._store&&(m._store.validated=1))}function u(m){return typeof m=="object"&&m!==null&&m.$$typeof===g}var x=C,g=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),L=Symbol.for("react.context"),it=Symbol.for("react.forward_ref"),ot=Symbol.for("react.suspense"),ct=Symbol.for("react.suspense_list"),dt=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),ut=Symbol.for("react.activity"),mt=Symbol.for("react.client.reference"),V=x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ae=Object.prototype.hasOwnProperty,ft=Array.isArray,Y=console.createTask?console.createTask:function(){return null};x={react_stack_bottom_frame:function(m){return m()}};var ke,$e={},ze=x.react_stack_bottom_frame.bind(x,l)(),Ee=Y(s(l)),Me={};$.Fragment=P,$.jsx=function(m,j,_){var S=1e4>V.recentlyCreatedOwnerStacks++;return h(m,j,_,!1,S?Error("react-stack-top-frame"):ze,S?Y(s(m)):Ee)},$.jsxs=function(m,j,_){var S=1e4>V.recentlyCreatedOwnerStacks++;return h(m,j,_,!0,S?Error("react-stack-top-frame"):ze,S?Y(s(m)):Ee)}})()),$}var De;function gt(){return De||(De=1,process.env.NODE_ENV==="production"?M.exports=pt():M.exports=ht()),M.exports}var t=gt();function H({value:e,onChange:r,field:a,readonly:s,...n}){const l=a||n.schema;if(s)return t.jsx("span",{className:"text-sm",children:e||"-"});const i=l?.rows,{inputType:o,...c}=n;return i&&i>1?t.jsx(d.Textarea,{...c,value:e||"",onChange:f=>r(f.target.value),placeholder:l?.placeholder,disabled:s||c.disabled}):t.jsx(d.Input,{...c,type:l?.type==="password"?"password":"text",value:e||"",onChange:f=>r(f.target.value),placeholder:l?.placeholder,disabled:s||c.disabled})}const bt=Object.freeze(Object.defineProperty({__proto__:null,TextField:H},Symbol.toStringTag,{value:"Module"}));function Z({value:e,onChange:r,field:a,readonly:s,...n}){if(s)return t.jsx("span",{className:"text-sm",children:e??"-"});const l=a||n.schema,i=l?.precision,{inputType:o,...c}=n;return t.jsx(d.Input,{...c,type:"number",value:e??"",onChange:f=>{const h=f.target.value;r(h===""?null:Number(h))},placeholder:l?.placeholder,disabled:s||c.disabled,step:i?Math.pow(10,-i):"any"})}const jt=Object.freeze(Object.defineProperty({__proto__:null,NumberField:Z},Symbol.toStringTag,{value:"Module"}));function K({value:e,onChange:r,field:a,readonly:s,...n}){const l=a||n.schema,i=l?.widget,o=C.useId(),c=l?.name||o,f=l?.label||"Checkbox";if(s)return t.jsx("span",{className:"text-sm",children:e?"Yes":"No"});const{inputType:h,...p}=n;return i==="checkbox"?t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(d.Checkbox,{...p,id:c,checked:!!e,onCheckedChange:u=>r(!!u),disabled:s||p.disabled}),t.jsx(d.Label,{htmlFor:c,children:f})]}):t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(d.Switch,{...p,id:c,checked:!!e,onCheckedChange:r,disabled:s||p.disabled}),t.jsx(d.Label,{htmlFor:c,children:f})]})}const yt=Object.freeze(Object.defineProperty({__proto__:null,BooleanField:K},Symbol.toStringTag,{value:"Module"}));function ee({value:e,onChange:r,field:a,readonly:s,...n}){const l=a||n.schema,i=l?.options||[];if(s){const o=i.find(c=>c.value===e);return t.jsx("span",{className:"text-sm",children:o?.label||e||"-"})}return t.jsxs(d.Select,{...n,value:e,onValueChange:r,disabled:s||n.disabled,children:[t.jsx(d.SelectTrigger,{className:n.className,id:n.id,children:t.jsx(d.SelectValue,{placeholder:l?.placeholder||"Select an option"})}),t.jsx(d.SelectContent,{position:"popper",children:i.map(o=>t.jsx(d.SelectItem,{value:o.value,children:o.label},o.value))})]})}const Nt=Object.freeze(Object.defineProperty({__proto__:null,SelectField:ee},Symbol.toStringTag,{value:"Module"}));function te({value:e,onChange:r,field:a,readonly:s,...n}){if(s)return t.jsx("span",{className:"text-sm",children:e?new Date(e).toLocaleDateString():"-"});const{inputType:l,...i}=n;return t.jsx(d.Input,{...i,type:"date",value:e||"",onChange:o=>r(o.target.value),disabled:s||i.disabled})}const vt=Object.freeze(Object.defineProperty({__proto__:null,DateField:te},Symbol.toStringTag,{value:"Module"}));function re({value:e,onChange:r,field:a,readonly:s,errorMessage:n,...l}){const i=a||l.schema;if(s)return e?t.jsx("a",{href:`mailto:${e}`,className:"text-sm text-blue-600 hover:text-blue-800 hover:underline",children:e}):t.jsx("span",{className:"text-sm",children:"-"});const{inputType:o,...c}=l;return t.jsx(d.Input,{...c,type:"email",value:e||"",onChange:f=>r(f.target.value),placeholder:i?.placeholder||"email@example.com",disabled:s||c.disabled,"aria-invalid":!!n})}const Ft=Object.freeze(Object.defineProperty({__proto__:null,EmailField:re},Symbol.toStringTag,{value:"Module"}));function se({value:e,onChange:r,field:a,readonly:s,errorMessage:n,...l}){const i=a||l.schema;if(s)return e?t.jsx("a",{href:`tel:${e}`,className:"text-sm text-blue-600 hover:text-blue-800 hover:underline",children:e}):t.jsx("span",{className:"text-sm",children:"-"});const{inputType:o,...c}=l;return t.jsx(d.Input,{...c,type:"tel",value:e||"",onChange:f=>r(f.target.value),placeholder:i?.placeholder||"(555) 123-4567",disabled:s||c.disabled,"aria-invalid":!!n})}const _t=Object.freeze(Object.defineProperty({__proto__:null,PhoneField:se},Symbol.toStringTag,{value:"Module"}));function ne({value:e,onChange:r,field:a,readonly:s,errorMessage:n,...l}){const i=a||l.schema;if(s)return e?e.startsWith("http://")||e.startsWith("https://")?t.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:text-blue-800 hover:underline",children:e}):t.jsx("span",{className:"text-sm",children:e}):t.jsx("span",{className:"text-sm",children:"-"});const{inputType:o,...c}=l;return t.jsx(d.Input,{...c,type:"url",value:e||"",onChange:f=>r(f.target.value),placeholder:i?.placeholder||"https://example.com",disabled:s||c.disabled,"aria-invalid":!!n})}const Ct=Object.freeze(Object.defineProperty({__proto__:null,UrlField:ne},Symbol.toStringTag,{value:"Module"}));function St(e,r="USD"){try{return new Intl.NumberFormat("en-US",{style:"currency",currency:r}).format(e)}catch{return`${r} ${e.toFixed(2)}`}}function ae({value:e,onChange:r,field:a,readonly:s,errorMessage:n,className:l,...i}){const o=a||i.schema,c=o?.currency||"USD",f=o?.precision??2;if(s)return e==null?t.jsx("span",{className:"text-sm",children:"-"}):t.jsx("span",{className:"text-sm font-medium tabular-nums",children:St(Number(e),c)});const h=p=>{const u=parseFloat(p.target.value);isNaN(u)||r(parseFloat(u.toFixed(f)))};return t.jsxs("div",{className:"relative",children:[t.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",children:c==="USD"?"$":c}),t.jsx(d.Input,{...i,type:"number",value:e??"",onChange:p=>{const u=p.target.value===""?null:parseFloat(p.target.value);r(u)},onBlur:h,placeholder:o?.placeholder||"0.00",disabled:s||i.disabled,className:`pl-8 ${l||""}`,step:Math.pow(10,-f).toFixed(f),"aria-invalid":!!n})]})}const wt=Object.freeze(Object.defineProperty({__proto__:null,CurrencyField:ae},Symbol.toStringTag,{value:"Module"}));function le({value:e,onChange:r,field:a,readonly:s,errorMessage:n,...l}){if(s)return t.jsx("div",{className:"text-sm whitespace-pre-wrap",children:e||"-"});const i=a||l.schema,o=i?.rows||4,c=i?.max_length,{inputType:f,...h}=l;return t.jsxs("div",{className:"relative",children:[t.jsx(d.Textarea,{...h,value:e||"",onChange:p=>r(p.target.value),placeholder:i?.placeholder,disabled:s||h.disabled,rows:o,maxLength:c,"aria-invalid":!!n}),c&&t.jsxs("div",{className:"absolute bottom-2 right-2 text-xs text-gray-400","aria-live":"polite","aria-label":`Character count: ${(e||"").length} of ${c}`,children:[(e||"").length,"/",c]})]})}const Rt=Object.freeze(Object.defineProperty({__proto__:null,TextAreaField:le},Symbol.toStringTag,{value:"Module"}));function I({value:e,onChange:r,field:a,readonly:s,errorMessage:n,...l}){if(s)return t.jsx("div",{className:"text-sm prose prose-sm max-w-none",children:e||"-"});const i=a||l.schema,o=i?.rows||8,c=i?.format||"markdown";return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500",children:[t.jsxs("span",{children:["Format: ",c]}),t.jsx("span",{className:"italic",children:"Rich text editor (basic)"})]}),t.jsx(d.Textarea,{value:e||"",onChange:f=>r(f.target.value),placeholder:i?.placeholder||"Enter text...",disabled:s||l.disabled,rows:o,className:`font-mono text-sm ${l.className||""}`,"aria-invalid":!!n})]})}const Le=Object.freeze(Object.defineProperty({__proto__:null,RichTextField:I},Symbol.toStringTag,{value:"Module"}));function ie({value:e,onChange:r,field:a,readonly:s,...n}){const[l,i]=C.useState(!1),[o,c]=C.useState(""),f=a||n.schema,h=f?.options||[],p=f.multiple||!1,u=f.display_field||"label",x=h.filter(N=>N.label.toLowerCase().includes(o.toLowerCase())),g=p?(Array.isArray(e)?e:[]).map(N=>h.find(R=>R.value===N)).filter(Boolean):e?[h.find(N=>N.value===e)].filter(Boolean):[],v=N=>{if(p){const R=Array.isArray(e)?e:[],A=R.includes(N.value);r(A?R.filter(L=>L!==N.value):[...R,N.value])}else r(N.value),i(!1)},P=N=>{if(p){const R=Array.isArray(e)?e:[];r(R.filter(A=>A!==N))}else r(null)};return s?g.length?p?t.jsx("div",{className:"flex flex-wrap gap-1",children:g.map((N,R)=>t.jsx(d.Badge,{variant:"outline",children:N?.[u]||N?.label},R))}):t.jsx("span",{className:"text-sm",children:g[0]?.[u]||g[0]?.label}):t.jsx("span",{className:"text-sm",children:"-"}):t.jsxs("div",{className:"space-y-2",children:[g.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1",children:g.map((N,R)=>t.jsxs(d.Badge,{variant:"outline",className:"gap-1",children:[N?.[u]||N?.label,t.jsx("button",{onClick:()=>P(N?.value),className:"ml-1 hover:text-destructive",type:"button","aria-label":`Remove ${N?.[u]||N?.label}`,children:t.jsx(F.X,{className:"size-3"})})]},R))}),t.jsxs(d.Dialog,{open:l,onOpenChange:i,children:[t.jsx(d.DialogTrigger,{asChild:!0,children:t.jsxs(d.Button,{variant:"outline",className:"w-full justify-start text-left font-normal",type:"button",children:[t.jsx(F.Search,{className:"mr-2 size-4"}),g.length===0?f?.placeholder||"Select...":p?`${g.length} selected`:"Change selection"]})}),t.jsxs(d.DialogContent,{className:"max-w-md",children:[t.jsx(d.DialogHeader,{children:t.jsxs(d.DialogTitle,{children:[f?.label||"Select"," ",p&&"(multiple)"]})}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(d.Input,{placeholder:"Search...",value:o,onChange:N=>c(N.target.value),className:"w-full"}),t.jsx("div",{className:"max-h-64 overflow-y-auto space-y-1",children:x.length===0?t.jsx("p",{className:"text-sm text-gray-500 text-center py-4",children:"No options found"}):x.map(N=>{const R=p?(Array.isArray(e)?e:[]).includes(N.value):e===N.value;return t.jsxs("button",{onClick:()=>v(N),className:`w-full text-left px-3 py-2 rounded-md text-sm hover:bg-gray-100 flex items-center justify-between ${R?"bg-blue-50 text-blue-700":""}`,type:"button",children:[t.jsx("span",{children:N.label}),R&&t.jsx(d.Badge,{variant:"default",className:"ml-2",children:"Selected"})]},N.value)})})]})]})]})]})}const Pt=Object.freeze(Object.defineProperty({__proto__:null,LookupField:ie},Symbol.toStringTag,{value:"Module"}));function oe({value:e,onChange:r,field:a,readonly:s,...n}){if(s){if(!e)return t.jsx("span",{className:"text-sm",children:"-"});const o=new Date(e);return t.jsxs("span",{className:"text-sm",children:[o.toLocaleDateString()," ",o.toLocaleTimeString()]})}const{inputType:l,...i}=n;return t.jsx(d.Input,{...i,type:"datetime-local",value:e||"",onChange:o=>r(o.target.value),disabled:s||i.disabled})}const Tt=Object.freeze(Object.defineProperty({__proto__:null,DateTimeField:oe},Symbol.toStringTag,{value:"Module"}));function ce({value:e,onChange:r,field:a,readonly:s,...n}){if(s)return t.jsx("span",{className:"text-sm",children:e||"-"});const{inputType:l,...i}=n;return t.jsx(d.Input,{...i,type:"time",value:e||"",onChange:o=>r(o.target.value),disabled:s||i.disabled})}const Ot=Object.freeze(Object.defineProperty({__proto__:null,TimeField:ce},Symbol.toStringTag,{value:"Module"}));function de({value:e,onChange:r,field:a,readonly:s,errorMessage:n,className:l,...i}){const o=a||i.schema,c=o?.precision??2;if(s)return e==null?t.jsx("span",{className:"text-sm",children:"-"}):t.jsxs("span",{className:"text-sm font-medium tabular-nums",children:[(e*100).toFixed(c),"%"]});const f=e!=null?e*100:"",h=p=>{if(p.target.value===""){r(null);return}const u=parseFloat(p.target.value),x=isNaN(u)?null:u/100;r(x)};return t.jsxs("div",{className:"relative",children:[t.jsx(d.Input,{...i,type:"number",value:f,onChange:h,placeholder:o?.placeholder||"0",disabled:s||i.disabled,className:`pr-8 ${l||""}`,step:Math.pow(10,-c).toFixed(c),"aria-invalid":!!n}),t.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",children:"%"})]})}const At=Object.freeze(Object.defineProperty({__proto__:null,PercentField:de},Symbol.toStringTag,{value:"Module"}));function ue({value:e,onChange:r,field:a,readonly:s,className:n,...l}){const[i,o]=C.useState(!1),c=a||l.schema;if(s)return t.jsx("span",{className:"text-sm",children:"••••••••"});const{inputType:f,...h}=l;return t.jsxs("div",{className:"relative",children:[t.jsx(d.Input,{...h,type:i?"text":"password",value:e||"",onChange:p=>r(p.target.value),placeholder:c?.placeholder,disabled:s||h.disabled,className:`pr-10 ${n||""}`}),t.jsx(d.Button,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>o(!i),tabIndex:-1,children:i?t.jsx(F.EyeOff,{className:"size-4 text-gray-500"}):t.jsx(F.Eye,{className:"size-4 text-gray-500"})})]})}const kt=Object.freeze(Object.defineProperty({__proto__:null,PasswordField:ue},Symbol.toStringTag,{value:"Module"}));function me({value:e,onChange:r,field:a,readonly:s,...n}){const l=C.useRef(null),i=a||n.schema,o=i?.multiple||!1,c=i?.accept?i.accept.join(","):void 0;if(s){if(!e)return t.jsx("span",{className:"text-sm",children:"-"});const u=Array.isArray(e)?e:[e];return t.jsx("div",{className:"flex flex-wrap gap-2",children:u.map((x,g)=>t.jsx("span",{className:"text-sm truncate max-w-xs",children:x.name||x.original_name||"File"},g))})}const f=e?Array.isArray(e)?e:[e]:[],h=u=>{const x=Array.from(u.target.files||[]);if(x.length===0)return;const g=x.map(v=>({name:v.name,original_name:v.name,size:v.size,mime_type:v.type,url:URL.createObjectURL(v)}));r(o?[...f,...g]:g[0])},p=u=>{if(o){const x=f.filter((g,v)=>v!==u);r(x.length>0?x:null)}else r(null)};return t.jsxs("div",{className:n.className,children:[t.jsx("input",{ref:l,type:"file",multiple:o,accept:c,onChange:h,className:"hidden"}),t.jsxs("div",{className:"space-y-2",children:[f.length>0&&t.jsx("div",{className:"space-y-1",children:f.map((u,x)=>t.jsxs("div",{className:"flex items-center justify-between gap-2 p-2 bg-gray-50 rounded-md border border-gray-200",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[t.jsx(F.File,{className:"size-4 text-gray-500 flex-shrink-0"}),t.jsx("span",{className:"text-sm truncate",children:u.name||u.original_name||"File"}),u.size&&t.jsxs("span",{className:"text-xs text-gray-500",children:["(",(u.size/1024).toFixed(1)," KB)"]})]}),t.jsx(d.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>p(x),className:"h-6 w-6 p-0",children:t.jsx(F.X,{className:"size-3"})})]},x))}),t.jsxs(d.Button,{type:"button",variant:"outline",onClick:()=>l.current?.click(),className:"w-full",children:[t.jsx(F.Upload,{className:"size-4 mr-2"}),f.length>0?"Add More Files":"Upload File"]})]})]})}const $t=Object.freeze(Object.defineProperty({__proto__:null,FileField:me},Symbol.toStringTag,{value:"Module"}));function fe({value:e,onChange:r,field:a,readonly:s,...n}){const l=C.useRef(null),i=a||n.schema,o=i?.multiple||!1,c=i?.accept?i.accept.join(","):"image/*";if(s){if(!e)return t.jsx("span",{className:"text-sm",children:"-"});const u=Array.isArray(e)?e:[e];return t.jsx("div",{className:"flex flex-wrap gap-2",children:u.map((x,g)=>t.jsx("img",{src:x.url||"",alt:x.name||`Image ${g+1}`,className:"size-20 rounded-md object-cover border border-gray-200"},g))})}const f=e?Array.isArray(e)?e:[e]:[],h=u=>{const x=Array.from(u.target.files||[]);if(x.length===0)return;const g=x.map(v=>({name:v.name,original_name:v.name,size:v.size,mime_type:v.type,url:URL.createObjectURL(v)}));r(o?[...f,...g]:g[0])},p=u=>{if(o){const x=f.filter((g,v)=>v!==u);r(x.length>0?x:null)}else r(null)};return t.jsxs("div",{className:n.className,children:[t.jsx("input",{ref:l,type:"file",multiple:o,accept:c,onChange:h,className:"hidden"}),t.jsxs("div",{className:"space-y-2",children:[f.length>0&&t.jsx("div",{className:"grid grid-cols-4 gap-2",children:f.map((u,x)=>t.jsxs("div",{className:"relative group",children:[t.jsx("img",{src:u.url||"",alt:u.name||`Image ${x+1}`,className:"size-20 rounded-md object-cover border border-gray-200"}),t.jsx(d.Button,{type:"button",variant:"destructive",size:"sm",onClick:()=>p(x),className:"absolute top-1 right-1 h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(F.X,{className:"size-3"})})]},x))}),t.jsxs(d.Button,{type:"button",variant:"outline",onClick:()=>l.current?.click(),className:"w-full",children:[t.jsx(F.Image,{className:"size-4 mr-2"}),f.length>0?"Add More Images":"Upload Image"]})]})]})}const zt=Object.freeze(Object.defineProperty({__proto__:null,ImageField:fe},Symbol.toStringTag,{value:"Module"}));function xe({value:e,onChange:r,field:a,readonly:s,...n}){const l=a||n.schema,i=e&&typeof e=="object"?`${e.latitude||0}, ${e.longitude||0}`:"";if(s)return t.jsx("span",{className:"text-sm",children:i||"-"});const o=c=>{const f=c.target.value;if(!f.trim()){r(null);return}const h=f.split(",").map(p=>p.trim());if(h.length===2){const p=parseFloat(h[0]),u=parseFloat(h[1]);!isNaN(p)&&!isNaN(u)&&r({latitude:p,longitude:u})}};return t.jsx(d.Input,{type:"text",value:i,onChange:o,placeholder:l?.placeholder||"latitude, longitude",disabled:s||n.disabled,className:n.className})}const Et=Object.freeze(Object.defineProperty({__proto__:null,LocationField:xe},Symbol.toStringTag,{value:"Module"}));function pe({value:e,field:r,...a}){const n=(r||a.schema)?.return_type||"text";let l="-";return e!=null&&(n==="number"||n==="currency"?l=typeof e=="number"?e.toFixed(2):String(e):n==="boolean"?l=e?"Yes":"No":n==="date"?l=new Date(e).toLocaleDateString():l=String(e)),t.jsx("span",{className:`text-sm font-mono text-gray-700 ${a.className||""}`,children:l})}const Mt=Object.freeze(Object.defineProperty({__proto__:null,FormulaField:pe},Symbol.toStringTag,{value:"Module"}));function he({value:e,field:r,...a}){const n=(r||a.schema)?.summary_type||"count";let l="-";return e!=null&&(n==="count"?l=String(e):["sum","avg","min","max"].includes(n)?l=typeof e=="number"?e.toFixed(2):String(e):l=String(e)),t.jsx("span",{className:`text-sm font-medium tabular-nums text-gray-700 ${a.className||""}`,children:l})}const It=Object.freeze(Object.defineProperty({__proto__:null,SummaryField:he},Symbol.toStringTag,{value:"Module"}));function ge({value:e,field:r,...a}){const s=e!=null?String(e):"-";return t.jsx("span",{className:`text-sm font-mono text-gray-700 ${a.className||""}`,children:s})}const Ut=Object.freeze(Object.defineProperty({__proto__:null,AutoNumberField:ge},Symbol.toStringTag,{value:"Module"}));function U({value:e,onChange:r,field:a,readonly:s,...n}){const i=(a||n.schema)?.multiple||!1;if(s){if(!e)return t.jsx("span",{className:"text-sm",children:"-"});const f=Array.isArray(e)?e:[e];return t.jsxs("div",{className:"flex -space-x-2",children:[f.slice(0,3).map((h,p)=>{const u=h.name||h.username||"User",x=u.split(" ").map(g=>g[0]).join("").toUpperCase().slice(0,2);return t.jsx(d.Avatar,{className:"size-8 border-2 border-white",title:u,children:t.jsx(d.AvatarFallback,{className:"bg-blue-500 text-white text-xs",children:x})},p)}),f.length>3&&t.jsx(d.Avatar,{className:"size-8 border-2 border-white",children:t.jsxs(d.AvatarFallback,{className:"bg-gray-200 text-gray-600 text-xs",children:["+",f.length-3]})})]})}const o=e?Array.isArray(e)?e:[e]:[],c=f=>{if(i){const h=o.filter((p,u)=>u!==f);r(h.length>0?h:null)}else r(null)};return t.jsxs("div",{className:n.className,children:[o.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:o.map((f,h)=>{const p=f.name||f.username||"User",u=p.split(" ").map(x=>x[0]).join("").toUpperCase().slice(0,2);return t.jsxs(d.Badge,{variant:"outline",className:"gap-2 pr-1",children:[t.jsx(d.Avatar,{className:"size-5",children:t.jsx(d.AvatarFallback,{className:"bg-blue-500 text-white text-xs",children:u})}),t.jsx("span",{className:"text-sm",children:p}),t.jsx("button",{type:"button",onClick:()=>c(h),className:"ml-1 rounded-full hover:bg-gray-200 p-0.5",children:t.jsx(F.X,{className:"size-3"})})]},h)})}),t.jsx("div",{className:"text-sm text-gray-500 italic",children:"User selection component requires integration with user management system"})]})}const Be=Object.freeze(Object.defineProperty({__proto__:null,UserField:U},Symbol.toStringTag,{value:"Module"}));function be({value:e,onChange:r,field:a,readonly:s,...n}){const l=a||n.schema,i=()=>e==null?"":JSON.stringify(e,null,2),[o,c]=C.useState(i),[f,h]=C.useState(null);if(C.useEffect(()=>{try{if(e==null){c("");return}const u=o?JSON.parse(o):null;JSON.stringify(u)!==JSON.stringify(e)&&c(JSON.stringify(e,null,2))}catch{c(JSON.stringify(e,null,2))}},[e,o]),s)return e?t.jsx("pre",{className:d.cn("text-xs bg-gray-50 p-2 rounded border border-gray-200 overflow-auto max-h-40",n.className),children:JSON.stringify(e,null,2)}):t.jsx("span",{className:"text-sm",children:"-"});const p=u=>{const x=u.target.value;if(c(x),h(null),!x.trim()){r(null);return}try{const g=JSON.parse(x);r(g)}catch{h("Invalid JSON")}};return t.jsxs("div",{className:"space-y-1",children:[t.jsx(d.Textarea,{value:o,onChange:p,placeholder:l?.placeholder||`{
7
7
  "key": "value"
8
- }`,disabled:s||a.disabled,className:d.cn("font-mono text-xs",f?"border-red-500 focus-visible:ring-red-500":"",a.className),rows:6}),f&&t.jsx("p",{className:"text-xs text-red-500",children:f})]})}const Dt=Object.freeze(Object.defineProperty({__proto__:null,ObjectField:be},Symbol.toStringTag,{value:"Module"}));function je({value:e,field:r,...n}){const a=(r||n.schema)?.dimensions||(Array.isArray(e)?e.length:0);if(!e||!Array.isArray(e))return t.jsx("span",{className:"text-sm text-gray-500",children:"-"});const l=e.slice(0,3).map(i=>{const o=Number(i);return isNaN(o)?"0":o.toFixed(4)}).join(", ");return t.jsxs("div",{className:`text-sm ${n.className||""}`,children:[t.jsxs("span",{className:"font-mono text-gray-700",children:["[",l,"...]"]}),t.jsxs("span",{className:"text-gray-500 ml-2",children:["(",a,"D)"]})]})}const Lt=Object.freeze(Object.defineProperty({__proto__:null,VectorField:je},Symbol.toStringTag,{value:"Module"}));function ye({value:e,field:r,readonly:n,...s}){const l=(r||s.schema)?.columns||[];return!e||!Array.isArray(e)?t.jsx("span",{className:"text-sm text-gray-500",children:"-"}):n?t.jsx("div",{className:d.cn("text-sm",s.className),children:t.jsxs("span",{className:"text-gray-700",children:[e.length," rows"]})}):t.jsxs("div",{className:d.cn("border border-gray-200 rounded-md overflow-hidden",s.className),children:[t.jsx("div",{className:"overflow-auto max-h-60",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"bg-gray-50 border-b border-gray-200",children:t.jsx("tr",{children:l.map((i,o)=>t.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-gray-700",children:i.label||i.name},o))})}),t.jsx("tbody",{className:"divide-y divide-gray-200",children:e.slice(0,5).map((i,o)=>t.jsx("tr",{className:"hover:bg-gray-50",children:l.map((c,f)=>t.jsx("td",{className:"px-3 py-2 text-gray-900",children:i[c.name]!=null?String(i[c.name]):"-"},f))},o))})]})}),e.length>5&&t.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs text-gray-500 border-t border-gray-200",children:["Showing 5 of ",e.length," rows"]})]})}const Bt=Object.freeze(Object.defineProperty({__proto__:null,GridField:ye},Symbol.toStringTag,{value:"Module"}));function Ne({value:e,onChange:r,field:n,readonly:s,...a}){const l=n||a.schema;return s?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-6 h-6 rounded border border-input",style:{backgroundColor:e||"#000000"}}),t.jsx("span",{className:"text-sm",children:e||"-"})]}):t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"color",value:e||"#000000",onChange:i=>r(i.target.value),disabled:s||a.disabled,className:"w-10 h-10 rounded border border-input cursor-pointer"}),t.jsx(d.Input,{type:"text",value:e||"",onChange:i=>r(i.target.value),placeholder:l?.placeholder||"#000000",disabled:s||a.disabled,className:a.className,pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"})]})}const Vt=Object.freeze(Object.defineProperty({__proto__:null,ColorField:Ne},Symbol.toStringTag,{value:"Module"}));function ve({value:e,onChange:r,field:n,readonly:s,...a}){const l=n||a.schema,i=l?.min??0,o=l?.max??100,c=l?.step??1;return s?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-medium",children:e??i}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:["/ ",o]})]}):t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(d.Slider,{value:[e??i],onValueChange:f=>r(f[0]),min:i,max:o,step:c,disabled:s||a.disabled,className:a.className}),t.jsx("span",{className:"text-sm font-medium w-12 text-right",children:e??i})]})}const Yt=Object.freeze(Object.defineProperty({__proto__:null,SliderField:ve},Symbol.toStringTag,{value:"Module"}));function Fe({value:e,onChange:r,field:n,readonly:s,className:a,...l}){const o=(n||l.schema)?.max??5,c=e??0,[f,h]=C.useState(null),p=f!==null?f:c;return s?t.jsxs("div",{className:d.cn("flex items-center gap-1",a),children:[Array.from({length:o},(u,x)=>t.jsx(F.Star,{className:`w-5 h-5 ${x<c?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},x)),t.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[c," / ",o]})]}):t.jsxs("div",{className:d.cn("flex items-center gap-1",a),children:[Array.from({length:o},(u,x)=>t.jsx("button",{type:"button",onClick:()=>r(x+1),onMouseEnter:()=>h(x+1),onMouseLeave:()=>h(null),className:"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",disabled:s||l.disabled,children:t.jsx(F.Star,{className:`w-5 h-5 transition-colors ${x<p?"fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500":"text-muted-foreground hover:text-yellow-400"}`})},x)),t.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[c," / ",o]})]})}const qt=Object.freeze(Object.defineProperty({__proto__:null,RatingField:Fe},Symbol.toStringTag,{value:"Module"}));function _e({value:e,onChange:r,field:n,readonly:s,...a}){const l=n||a.schema,i=l?.language??"javascript";return s?t.jsx("pre",{className:d.cn("text-sm bg-muted p-2 rounded overflow-x-auto border",a.className),children:t.jsx("code",{children:e||"-"})}):t.jsx(d.Textarea,{value:e||"",onChange:o=>r(o.target.value),placeholder:l?.placeholder||`// Write ${i} code here...`,disabled:s||a.disabled,className:d.cn("font-mono text-sm",a.className),rows:12,spellCheck:!1})}const Jt=Object.freeze(Object.defineProperty({__proto__:null,CodeField:_e},Symbol.toStringTag,{value:"Module"}));function Ce({value:e,onChange:r,field:n,readonly:s,...a}){const[l,i]=C.useState(!1),o=C.useRef(null),c=n||a.schema,f=u=>{const x=u.target.files?.[0];if(!x)return;if(!x.type.startsWith("image/")){console.error("Please select an image file");return}if(x.size>5*1024*1024){console.error("File size must be less than 5MB");return}const g=new FileReader;g.onloadend=()=>{r(g.result)},g.readAsDataURL(x)},h=()=>{r("")},p=()=>(c?.defaultName||c?.label||"User").split(" ").map(x=>x[0]).join("").toUpperCase().slice(0,2);return s?t.jsxs(d.Avatar,{className:"w-16 h-16",children:[e&&t.jsx(d.AvatarImage,{src:e,alt:c?.label}),t.jsx(d.AvatarFallback,{children:p()})]}):t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"relative",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[t.jsxs(d.Avatar,{className:"w-16 h-16",children:[e&&t.jsx(d.AvatarImage,{src:e,alt:c?.label}),t.jsx(d.AvatarFallback,{children:p()})]}),!s&&l&&e&&t.jsx("button",{type:"button",onClick:h,className:"absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-1 hover:bg-destructive/90",children:t.jsx(F.X,{className:"w-3 h-3"})})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("input",{ref:o,type:"file",accept:"image/*",onChange:f,className:"hidden"}),t.jsxs(d.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>o.current?.click(),disabled:s||a.disabled,children:[t.jsx(F.Upload,{className:"w-4 h-4 mr-2"}),e?"Change":"Upload"," Avatar"]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"PNG, JPG up to 5MB"})]})]})}const Gt=Object.freeze(Object.defineProperty({__proto__:null,AvatarField:Ce},Symbol.toStringTag,{value:"Module"}));function Se({value:e,onChange:r,field:n,readonly:s,...a}){const l=e||{},i=(c,f)=>{r({...l,[c]:f})},o=c=>[c.street,c.city,[c.state,c.zipCode].filter(Boolean).join(" "),c.country].filter(Boolean).join(", ")||"-";return s?t.jsx("span",{className:"text-sm",children:o(l)}):t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{children:[t.jsx(d.Label,{htmlFor:"street",className:"text-xs",children:"Street Address"}),t.jsx(d.Input,{id:"street",type:"text",value:l.street||"",onChange:c=>i("street",c.target.value),placeholder:"123 Main St",disabled:s||a.disabled,className:a.className})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx(d.Label,{htmlFor:"city",className:"text-xs",children:"City"}),t.jsx(d.Input,{id:"city",type:"text",value:l.city||"",onChange:c=>i("city",c.target.value),placeholder:"San Francisco",disabled:s||a.disabled})]}),t.jsxs("div",{children:[t.jsx(d.Label,{htmlFor:"state",className:"text-xs",children:"State / Province"}),t.jsx(d.Input,{id:"state",type:"text",value:l.state||"",onChange:c=>i("state",c.target.value),placeholder:"CA",disabled:s||a.disabled})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx(d.Label,{htmlFor:"zipCode",className:"text-xs",children:"ZIP / Postal Code"}),t.jsx(d.Input,{id:"zipCode",type:"text",value:l.zipCode||"",onChange:c=>i("zipCode",c.target.value),placeholder:"94102",disabled:s||a.disabled})]}),t.jsxs("div",{children:[t.jsx(d.Label,{htmlFor:"country",className:"text-xs",children:"Country"}),t.jsx(d.Input,{id:"country",type:"text",value:l.country||"",onChange:c=>i("country",c.target.value),placeholder:"United States",disabled:s||a.disabled})]})]})]})}const Qt=Object.freeze(Object.defineProperty({__proto__:null,AddressField:Se},Symbol.toStringTag,{value:"Module"}));function we({value:e,onChange:r,field:n,readonly:s,...a}){const[l,i]=C.useState(!1),o=e||{},c=(u,x)=>{r({...o,[u]:x?Number(x):void 0})},f=()=>{if(!navigator.geolocation){console.error("Geolocation is not supported by this browser");return}i(!0),navigator.geolocation.getCurrentPosition(u=>{r({latitude:u.coords.latitude,longitude:u.coords.longitude,accuracy:u.coords.accuracy}),i(!1)},u=>{console.error("Error getting location:",u.message),i(!1)},{enableHighAccuracy:!0,timeout:5e3,maximumAge:0})},h=u=>!u.latitude||!u.longitude?"-":`${u.latitude.toFixed(6)}, ${u.longitude.toFixed(6)}`,p=()=>{if(!o.latitude||!o.longitude)return;const u=`https://www.google.com/maps?q=${o.latitude},${o.longitude}`;window.open(u,"_blank")};return s?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(F.MapPin,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:h(o)}),o.latitude&&o.longitude&&t.jsx(d.Button,{type:"button",variant:"link",size:"sm",onClick:p,className:"p-0 h-auto",children:"View on map"})]}):t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(d.Button,{type:"button",variant:"outline",size:"sm",onClick:f,disabled:s||l,children:[t.jsx(F.Crosshair,{className:"w-4 h-4 mr-2"}),l?"Getting location...":"Use Current Location"]}),o.latitude&&o.longitude&&t.jsxs(d.Button,{type:"button",variant:"link",size:"sm",onClick:p,children:[t.jsx(F.MapPin,{className:"w-4 h-4 mr-2"}),"View on map"]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx(d.Label,{htmlFor:"latitude",className:"text-xs",children:"Latitude"}),t.jsx(d.Input,{id:"latitude",type:"number",value:o.latitude??"",onChange:u=>c("latitude",u.target.value),placeholder:"37.7749",disabled:s||a.disabled,step:"any",className:a.className})]}),t.jsxs("div",{children:[t.jsx(d.Label,{htmlFor:"longitude",className:"text-xs",children:"Longitude"}),t.jsx(d.Input,{id:"longitude",type:"number",value:o.longitude??"",onChange:u=>c("longitude",u.target.value),placeholder:"-122.4194",disabled:s||a.disabled,step:"any"})]})]}),o.accuracy&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Accuracy: ±",o.accuracy.toFixed(0),"m"]})]})}const Wt=Object.freeze(Object.defineProperty({__proto__:null,GeolocationField:we},Symbol.toStringTag,{value:"Module"}));function Re({value:e,onChange:r,readonly:n}){const s=C.useRef(null),[a,l]=C.useState(!1),[i,o]=C.useState(!e);C.useEffect(()=>{if(e&&s.current){const x=s.current.getContext("2d");if(x){const g=new Image;g.onload=()=>{x.drawImage(g,0,0),o(!1)},g.src=e}}},[e]);const c=u=>{if(n)return;l(!0),o(!1);const x=s.current;if(!x)return;const g=x.getContext("2d");if(!g)return;const v=x.getBoundingClientRect(),P="touches"in u?u.touches[0].clientX-v.left:u.clientX-v.left,N="touches"in u?u.touches[0].clientY-v.top:u.clientY-v.top;g.beginPath(),g.moveTo(P,N)},f=u=>{if(!a||n)return;const x=s.current;if(!x)return;const g=x.getContext("2d");if(!g)return;const v=x.getBoundingClientRect(),P="touches"in u?u.touches[0].clientX-v.left:u.clientX-v.left,N="touches"in u?u.touches[0].clientY-v.top:u.clientY-v.top;g.lineTo(P,N),g.strokeStyle="#000",g.lineWidth=2,g.lineCap="round",g.lineJoin="round",g.stroke()},h=()=>{if(!a)return;l(!1);const u=s.current;if(!u)return;const x=u.toDataURL("image/png");r(x)},p=()=>{const u=s.current;if(!u)return;const x=u.getContext("2d");x&&(x.clearRect(0,0,u.width,u.height),o(!0),r(""))};return n&&e?t.jsx("div",{className:"border rounded p-2 bg-white",children:t.jsx("img",{src:e,alt:"Signature",className:"max-w-full h-auto"})}):n&&!e?t.jsx("span",{className:"text-sm text-muted-foreground",children:"No signature"}):t.jsxs("div",{className:"space-y-2",children:[t.jsx("div",{className:"border rounded bg-white",children:t.jsx("canvas",{ref:s,width:400,height:200,className:"w-full touch-none cursor-crosshair",onMouseDown:c,onMouseMove:f,onMouseUp:h,onMouseLeave:h,onTouchStart:c,onTouchMove:f,onTouchEnd:h})}),t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:i?"Sign above":"Signature captured"}),t.jsxs(d.Button,{type:"button",variant:"outline",size:"sm",onClick:p,disabled:n||i,children:[t.jsx(F.Eraser,{className:"w-4 h-4 mr-2"}),"Clear"]})]})]})}const Xt=Object.freeze(Object.defineProperty({__proto__:null,SignatureField:Re},Symbol.toStringTag,{value:"Module"}));function Pe({value:e,onChange:r,field:n,readonly:s,...a}){const[l,i]=C.useState(!1),o=n||a.schema,c=h=>`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(h)}`,f=()=>{e&&navigator.clipboard.writeText(e)};return s?t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-sm flex-1 truncate",children:e||"-"}),e&&t.jsxs(d.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>i(!l),children:[t.jsx(F.QrCode,{className:"w-4 h-4 mr-2"}),l?"Hide":"Show"," QR"]})]}):t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(d.Input,{type:"text",value:e||"",onChange:h=>r(h.target.value),placeholder:o?.placeholder||"Enter text for QR code",disabled:s||a.disabled,className:a.className}),e&&t.jsxs(t.Fragment,{children:[t.jsx(d.Button,{type:"button",variant:"outline",size:"sm",onClick:f,children:t.jsx(F.Copy,{className:"w-4 h-4"})}),t.jsx(d.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>i(!l),children:t.jsx(F.QrCode,{className:"w-4 h-4"})})]})]}),l&&e&&t.jsx("div",{className:"border rounded p-4 bg-white flex justify-center",children:t.jsx("img",{src:c(e),alt:"QR Code",className:"w-48 h-48"})}),e&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["QR code contains: ",e.length," characters"]})]})}const Ht=Object.freeze(Object.defineProperty({__proto__:null,QRCodeField:Pe},Symbol.toStringTag,{value:"Module"}));function Te({value:e,onChange:r,field:n,readonly:s,className:a,...l}){const i=e||[],o=n||l.schema,c=()=>{const p={id:`new-${Date.now()}`,label:"New Related Record"};r([...i,p])},f=p=>{r(i.filter(u=>u.id!==p))},h=p=>{console.log("View detail:",p)};return s?t.jsxs("div",{className:d.cn("space-y-2",a),children:[i.length===0?t.jsx("span",{className:"text-sm text-muted-foreground",children:"No related records"}):i.map(p=>t.jsxs("div",{className:"flex items-center justify-between p-2 border rounded hover:bg-muted/50",children:[t.jsx("span",{className:"text-sm",children:p.label}),t.jsx(d.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>h(p),children:t.jsx(F.ExternalLink,{className:"w-4 h-4"})})]},p.id)),t.jsxs("p",{className:"text-xs text-muted-foreground",children:[i.length," ",i.length===1?"record":"records"]})]}):t.jsxs("div",{className:d.cn("space-y-3",a),children:[t.jsxs("div",{className:"space-y-2",children:[i.map(p=>t.jsxs("div",{className:"flex items-center justify-between gap-2 p-2 border rounded hover:bg-muted/50",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[t.jsx(d.Badge,{variant:"outline",children:p.id}),t.jsx("span",{className:"text-sm flex-1",children:p.label})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(d.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>h(p),children:t.jsx(F.ExternalLink,{className:"w-4 h-4"})}),t.jsx(d.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>f(p.id),disabled:l.disabled,children:t.jsx(F.X,{className:"w-4 h-4"})})]})]},p.id)),i.length===0&&t.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded bg-muted/20",children:"No related records"})]}),t.jsxs(d.Button,{type:"button",variant:"outline",className:"w-full",onClick:c,disabled:l.disabled,children:[t.jsx(F.Plus,{className:"w-4 h-4 mr-2"}),"Add ",o?.label||"Record"]})]})}const Zt=Object.freeze(Object.defineProperty({__proto__:null,MasterDetailField:Te},Symbol.toStringTag,{value:"Module"}));function Ve(e,r="USD"){try{return new Intl.NumberFormat("en-US",{style:"currency",currency:r}).format(e)}catch{return`${r} ${e.toFixed(2)}`}}function Ye(e,r=2){return`${(e*100).toFixed(r)}%`}function qe(e,r){if(!e)return"-";const n=typeof e=="string"?new Date(e):e;return isNaN(n.getTime())?"-":n.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function Je(e){if(!e)return"-";const r=typeof e=="string"?new Date(e):e;return isNaN(r.getTime())?"-":r.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function T({value:e}){return t.jsx("span",{className:"truncate",children:e||"-"})}function Ge({value:e,field:r}){if(e==null)return t.jsx("span",{children:"-"});const s=r.precision??0,a=typeof e=="number"?e.toFixed(s):e;return t.jsx("span",{className:"tabular-nums",children:a})}function Qe({value:e,field:r}){if(e==null)return t.jsx("span",{children:"-"});const s=r.currency||"USD",a=Ve(Number(e),s);return t.jsx("span",{className:"tabular-nums font-medium",children:a})}function We({value:e,field:r}){if(e==null)return t.jsx("span",{children:"-"});const s=r.precision??2,a=Ye(Number(e),s);return t.jsx("span",{className:"tabular-nums",children:a})}function Xe({value:e}){return t.jsx("div",{className:"flex items-center",children:e?t.jsxs(d.Badge,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200 gap-1",children:[t.jsx(F.Check,{className:"size-3"}),"True"]}):t.jsxs(d.Badge,{variant:"outline",className:"bg-gray-50 text-gray-500 border-gray-200 gap-1",children:[t.jsx(F.X,{className:"size-3"}),"False"]})})}function He({value:e,field:r}){const s=qe(e,r.format);return t.jsx("span",{className:"tabular-nums",children:s})}function Ze({value:e}){const r=Je(e);return t.jsx("span",{className:"tabular-nums text-sm",children:r})}function z({value:e,field:r}){const s=r.options||[];if(!e)return t.jsx("span",{children:"-"});const a=c=>{const f={gray:"bg-gray-100 text-gray-800 border-gray-300",red:"bg-red-100 text-red-800 border-red-300",orange:"bg-orange-100 text-orange-800 border-orange-300",yellow:"bg-yellow-100 text-yellow-800 border-yellow-300",green:"bg-green-100 text-green-800 border-green-300",blue:"bg-blue-100 text-blue-800 border-blue-300",indigo:"bg-indigo-100 text-indigo-800 border-indigo-300",purple:"bg-purple-100 text-purple-800 border-purple-300",pink:"bg-pink-100 text-pink-800 border-pink-300"};return f[c||"blue"]||f.blue};if(Array.isArray(e))return t.jsx("div",{className:"flex flex-wrap gap-1",children:e.map((c,f)=>{const h=s.find(x=>x.value===c),p=h?.label||c,u=a(h?.color);return t.jsx(d.Badge,{variant:"outline",className:u,children:p},f)})});const l=s.find(c=>c.value===e),i=l?.label||e,o=a(l?.color);return t.jsx(d.Badge,{variant:"outline",className:o,children:i})}function Ke({value:e}){return e?t.jsx(d.Button,{variant:"link",className:"p-0 h-auto font-normal text-blue-600 hover:text-blue-800",asChild:!0,children:t.jsx("a",{href:`mailto:${e}`,onClick:r=>r.stopPropagation(),children:e})}):t.jsx("span",{children:"-"})}function et({value:e}){return e?t.jsx(d.Button,{variant:"link",className:"p-0 h-auto font-normal text-blue-600 hover:text-blue-800",asChild:!0,children:t.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),children:e})}):t.jsx("span",{children:"-"})}function tt({value:e}){return e?t.jsx("a",{href:`tel:${e}`,className:"text-blue-600 hover:text-blue-800",onClick:r=>r.stopPropagation(),children:e}):t.jsx("span",{children:"-"})}function rt({value:e,field:r}){if(!e)return t.jsx("span",{children:"-"});if(r.multiple,Array.isArray(e)){const a=e.length;return t.jsxs("span",{className:"text-sm text-gray-600",children:[a," ",a===1?"file":"files"]})}const s=e.name||e.original_name||"File";return t.jsx("span",{className:"text-sm truncate",children:s})}function st({value:e}){return e?Array.isArray(e)?t.jsxs("div",{className:"flex -space-x-2",children:[e.slice(0,3).map((r,n)=>t.jsx("img",{src:r.url||"",alt:r.name||`Image ${n+1}`,className:"size-8 rounded-md border-2 border-white object-cover"},n)),e.length>3&&t.jsxs("div",{className:"size-8 rounded-md border-2 border-white bg-gray-100 flex items-center justify-center text-xs font-medium text-gray-600",children:["+",e.length-3]})]}):t.jsx("img",{src:e.url||"",alt:e.name||"Image",className:"size-10 rounded-md object-cover"}):t.jsx("span",{children:"-"})}function Oe({value:e}){if(!e)return t.jsx("span",{children:"-"});if(Array.isArray(e))return t.jsx("div",{className:"flex flex-wrap gap-1",children:e.map((r,n)=>{const s=r.name||r.label||r._id||String(r);return t.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-800",children:s},n)})});if(typeof e=="object"&&e!==null){const r=e.name||e.label||e._id||"[Object]";return t.jsx("span",{className:"truncate",children:r})}return t.jsx("span",{className:"truncate",children:String(e)})}function G({value:e}){return t.jsx("span",{className:"text-gray-700 font-mono text-sm",children:e!=null?String(e):"-"})}function Q({value:e}){if(!e)return t.jsx("span",{children:"-"});if(Array.isArray(e))return t.jsxs("div",{className:"flex -space-x-2",children:[e.slice(0,3).map((s,a)=>{const l=s.name||s.username||"User",i=l.split(" ").map(o=>o[0]).join("").toUpperCase().slice(0,2);return t.jsx(d.Avatar,{className:"size-8 border-2 border-white",title:l,children:t.jsx(d.AvatarFallback,{className:"bg-blue-500 text-white text-xs",children:i})},a)}),e.length>3&&t.jsx(d.Avatar,{className:"size-8 border-2 border-white",children:t.jsxs(d.AvatarFallback,{className:"bg-gray-200 text-gray-600 text-xs",children:["+",e.length-3]})})]});const r=e.name||e.username||"User",n=r.split(" ").map(s=>s[0]).join("").toUpperCase().slice(0,2);return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(d.Avatar,{className:"size-8",children:t.jsx(d.AvatarFallback,{className:"bg-blue-500 text-white text-xs",children:n})}),t.jsx("span",{className:"truncate",children:r})]})}const W=new Map;function D(e,r){W.set(e,r)}function Kt(e){return W.has(e)?W.get(e):{text:T,textarea:T,markdown:T,html:T,number:Ge,currency:Qe,percent:We,boolean:Xe,date:He,datetime:Ze,time:T,select:z,lookup:z,master_detail:z,email:Ke,url:et,phone:tt,file:rt,image:st,formula:G,summary:G,auto_number:T,user:Q,owner:Q,password:()=>t.jsx("span",{children:"••••••"}),location:T,object:()=>t.jsx("span",{className:"text-gray-500 italic",children:"[Object]"}),vector:()=>t.jsx("span",{className:"text-gray-500 italic",children:"[Vector]"}),grid:()=>t.jsx("span",{className:"text-gray-500 italic",children:"[Grid]"})}[e]||T}D("lookup",Oe);D("master_detail",Oe);D("select",z);function er(e){return{text:"field:text",textarea:"field:textarea",markdown:"field:markdown",html:"field:html",number:"field:number",currency:"field:currency",percent:"field:percent",date:"field:date",datetime:"field:datetime",time:"field:time",boolean:"field:boolean",select:"field:select",lookup:"field:lookup",master_detail:"field:master_detail",email:"field:email",phone:"field:phone",url:"field:url",file:"field:file",image:"field:image",password:"field:password",location:"field:location",formula:"field:formula",summary:"field:summary",auto_number:"field:auto_number"}[e]||"field:text"}function tr(e){if(e<0||!Number.isFinite(e)||e===0)return"0 B";const r=["B","KB","MB","GB","TB"];let n=e,s=0;for(;n>=1024&&s<r.length-1;)n/=1024,s++;return`${n.toFixed(s>0?1:0)} ${r[s]}`}function rr(e){const r={};return e.required&&(r.required=typeof e.required_message=="string"?e.required_message:`${e.label||e.name} is required`),e.min_length&&(r.minLength={value:e.min_length,message:e.min_length_message||`Minimum length is ${e.min_length} characters`}),e.max_length&&(r.maxLength={value:e.max_length,message:e.max_length_message||`Maximum length is ${e.max_length} characters`}),e.min!==void 0&&(r.min={value:e.min,message:e.min_message||`Minimum value is ${e.min}`}),e.max!==void 0&&(r.max={value:e.max,message:e.max_message||`Maximum value is ${e.max}`}),e.pattern&&(r.pattern={value:typeof e.pattern=="string"?new RegExp(e.pattern):e.pattern,message:e.pattern_message||"Invalid format"}),e.type==="email"&&(r.pattern={value:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,message:"Please enter a valid email address"}),e.type==="url"&&(r.pattern={value:/^https?:\/\/.+/,message:"Please enter a valid URL"}),e.validate&&(r.validate=e.validate),Object.keys(r).length>0?r:void 0}function X(e,r){if(!e)return!0;if(e.field&&e.value!==void 0){const n=r[e.field];if(e.operator==="="||e.operator==="==")return n===e.value;if(e.operator==="!=")return n!==e.value;if(e.operator===">")return n>e.value;if(e.operator===">=")return n>=e.value;if(e.operator==="<")return n<e.value;if(e.operator==="<=")return n<=e.value;if(e.operator==="in")return Array.isArray(e.value)&&e.value.includes(n)}return e.and&&Array.isArray(e.and)?e.and.every(n=>X(n,r)):e.or&&Array.isArray(e.or)?e.or.some(n=>X(n,r)):!0}function y(e){const r=({schema:n,className:s,value:a,...l})=>{const[i,o]=C.useState(a??n?.value??""),c={name:n?.name||"field",label:n?.label,type:n?.type,placeholder:n?.placeholder,required:n?.required,readonly:n?.readonly||n?.readOnly,help:n?.help,description:n?.description,defaultValue:n?.defaultValue||n?.value,...n},f=C.useCallback(p=>{o(p),l.onChange&&l.onChange(p)},[l]),h=n?.readonly||n?.readOnly||!1;return t.jsxs("div",{className:"grid w-full items-center gap-1.5","data-obj-id":n?.id,"data-obj-type":n?.type,children:[n?.label&&t.jsx("label",{htmlFor:n.id,className:n.required?"after:content-['*'] after:ml-0.5 after:text-red-500":"",children:n.label}),t.jsx(e,{value:i,onChange:f,field:c,readonly:h,className:s}),n?.description&&t.jsx("p",{className:"text-sm text-gray-500",children:n.description})]})};return r.displayName=`FieldRenderer(${e.displayName||e.name||"Component"})`,r}const nt={text:()=>Promise.resolve().then(()=>bt).then(e=>({default:e.TextField})),textarea:()=>Promise.resolve().then(()=>Rt).then(e=>({default:e.TextAreaField})),number:()=>Promise.resolve().then(()=>jt).then(e=>({default:e.NumberField})),boolean:()=>Promise.resolve().then(()=>yt).then(e=>({default:e.BooleanField})),select:()=>Promise.resolve().then(()=>Nt).then(e=>({default:e.SelectField})),date:()=>Promise.resolve().then(()=>vt).then(e=>({default:e.DateField})),datetime:()=>Promise.resolve().then(()=>Tt).then(e=>({default:e.DateTimeField})),time:()=>Promise.resolve().then(()=>Ot).then(e=>({default:e.TimeField})),email:()=>Promise.resolve().then(()=>Ft).then(e=>({default:e.EmailField})),phone:()=>Promise.resolve().then(()=>_t).then(e=>({default:e.PhoneField})),url:()=>Promise.resolve().then(()=>Ct).then(e=>({default:e.UrlField})),currency:()=>Promise.resolve().then(()=>wt).then(e=>({default:e.CurrencyField})),percent:()=>Promise.resolve().then(()=>At).then(e=>({default:e.PercentField})),password:()=>Promise.resolve().then(()=>kt).then(e=>({default:e.PasswordField})),markdown:()=>Promise.resolve().then(()=>Le).then(e=>({default:e.RichTextField})),html:()=>Promise.resolve().then(()=>Le).then(e=>({default:e.RichTextField})),lookup:()=>Promise.resolve().then(()=>Pt).then(e=>({default:e.LookupField})),master_detail:()=>Promise.resolve().then(()=>Zt).then(e=>({default:e.MasterDetailField})),file:()=>Promise.resolve().then(()=>$t).then(e=>({default:e.FileField})),image:()=>Promise.resolve().then(()=>zt).then(e=>({default:e.ImageField})),location:()=>Promise.resolve().then(()=>Et).then(e=>({default:e.LocationField})),formula:()=>Promise.resolve().then(()=>Mt).then(e=>({default:e.FormulaField})),summary:()=>Promise.resolve().then(()=>It).then(e=>({default:e.SummaryField})),auto_number:()=>Promise.resolve().then(()=>Ut).then(e=>({default:e.AutoNumberField})),user:()=>Promise.resolve().then(()=>Be).then(e=>({default:e.UserField})),owner:()=>Promise.resolve().then(()=>Be).then(e=>({default:e.UserField})),object:()=>Promise.resolve().then(()=>Dt).then(e=>({default:e.ObjectField})),vector:()=>Promise.resolve().then(()=>Lt).then(e=>({default:e.VectorField})),grid:()=>Promise.resolve().then(()=>Bt).then(e=>({default:e.GridField})),color:()=>Promise.resolve().then(()=>Vt).then(e=>({default:e.ColorField})),slider:()=>Promise.resolve().then(()=>Yt).then(e=>({default:e.SliderField})),rating:()=>Promise.resolve().then(()=>qt).then(e=>({default:e.RatingField})),code:()=>Promise.resolve().then(()=>Jt).then(e=>({default:e.CodeField})),avatar:()=>Promise.resolve().then(()=>Gt).then(e=>({default:e.AvatarField})),address:()=>Promise.resolve().then(()=>Qt).then(e=>({default:e.AddressField})),geolocation:()=>Promise.resolve().then(()=>Wt).then(e=>({default:e.GeolocationField})),signature:()=>Promise.resolve().then(()=>Xt).then(e=>({default:e.SignatureField})),qrcode:()=>Promise.resolve().then(()=>Ht).then(e=>({default:e.QRCodeField}))};function at(e){const r=nt[e];if(!r){console.warn(`Unknown field type: ${e}`);return}const n=C.lazy(r);b.ComponentRegistry.register(e,n,{namespace:"field"})}function lt(){Object.keys(nt).forEach(e=>{at(e)})}function sr(){b.ComponentRegistry.register("text",y(H),{namespace:"field"}),b.ComponentRegistry.register("textarea",y(le),{namespace:"field"}),b.ComponentRegistry.register("number",y(Z),{namespace:"field"}),b.ComponentRegistry.register("boolean",y(K),{namespace:"field"}),b.ComponentRegistry.register("select",y(ee),{namespace:"field"}),b.ComponentRegistry.register("date",y(te),{namespace:"field"}),b.ComponentRegistry.register("datetime",y(oe),{namespace:"field"}),b.ComponentRegistry.register("time",y(ce),{namespace:"field"}),b.ComponentRegistry.register("email",y(re),{namespace:"field"}),b.ComponentRegistry.register("phone",y(se),{namespace:"field"}),b.ComponentRegistry.register("url",y(ne),{namespace:"field"}),b.ComponentRegistry.register("currency",y(ae),{namespace:"field"}),b.ComponentRegistry.register("percent",y(de),{namespace:"field"}),b.ComponentRegistry.register("password",y(ue),{namespace:"field"}),b.ComponentRegistry.register("markdown",y(I),{namespace:"field"}),b.ComponentRegistry.register("html",y(I),{namespace:"field"}),b.ComponentRegistry.register("lookup",y(ie),{namespace:"field"}),b.ComponentRegistry.register("master_detail",y(Te),{namespace:"field"}),b.ComponentRegistry.register("file",y(me),{namespace:"field"}),b.ComponentRegistry.register("image",y(fe),{namespace:"field"}),b.ComponentRegistry.register("location",y(xe),{namespace:"field"}),b.ComponentRegistry.register("formula",y(pe),{namespace:"field"}),b.ComponentRegistry.register("summary",y(he),{namespace:"field"}),b.ComponentRegistry.register("auto_number",y(ge),{namespace:"field"}),b.ComponentRegistry.register("user",y(U),{namespace:"field"}),b.ComponentRegistry.register("owner",y(U),{namespace:"field"}),b.ComponentRegistry.register("object",y(be),{namespace:"field"}),b.ComponentRegistry.register("vector",y(je),{namespace:"field"}),b.ComponentRegistry.register("grid",y(ye),{namespace:"field"}),b.ComponentRegistry.register("color",y(Ne),{namespace:"field"}),b.ComponentRegistry.register("slider",y(ve),{namespace:"field"}),b.ComponentRegistry.register("rating",y(Fe),{namespace:"field"}),b.ComponentRegistry.register("code",y(_e),{namespace:"field"}),b.ComponentRegistry.register("avatar",y(Ce),{namespace:"field"}),b.ComponentRegistry.register("address",y(Se),{namespace:"field"}),b.ComponentRegistry.register("geolocation",y(we),{namespace:"field"}),b.ComponentRegistry.register("signature",y(Re),{namespace:"field"}),b.ComponentRegistry.register("qrcode",y(Pe),{namespace:"field"})}lt();exports.AddressField=Se;exports.AutoNumberField=ge;exports.AvatarField=Ce;exports.BooleanCellRenderer=Xe;exports.BooleanField=K;exports.CodeField=_e;exports.ColorField=Ne;exports.CurrencyCellRenderer=Qe;exports.CurrencyField=ae;exports.DateCellRenderer=He;exports.DateField=te;exports.DateTimeCellRenderer=Ze;exports.DateTimeField=oe;exports.EmailCellRenderer=Ke;exports.EmailField=re;exports.FileCellRenderer=rt;exports.FileField=me;exports.FormulaCellRenderer=G;exports.FormulaField=pe;exports.GeolocationField=we;exports.GridField=ye;exports.ImageCellRenderer=st;exports.ImageField=fe;exports.LocationField=xe;exports.LookupCellRenderer=Oe;exports.LookupField=ie;exports.MasterDetailField=Te;exports.NumberCellRenderer=Ge;exports.NumberField=Z;exports.ObjectField=be;exports.PasswordField=ue;exports.PercentCellRenderer=We;exports.PercentField=de;exports.PhoneCellRenderer=tt;exports.PhoneField=se;exports.QRCodeField=Pe;exports.RatingField=Fe;exports.RichTextField=I;exports.SelectCellRenderer=z;exports.SelectField=ee;exports.SignatureField=Re;exports.SliderField=ve;exports.SummaryField=he;exports.TextAreaField=le;exports.TextCellRenderer=T;exports.TextField=H;exports.TimeField=ce;exports.UrlCellRenderer=et;exports.UrlField=ne;exports.UserCellRenderer=Q;exports.UserField=U;exports.VectorField=je;exports.buildValidationRules=rr;exports.evaluateCondition=X;exports.formatCurrency=Ve;exports.formatDate=qe;exports.formatDateTime=Je;exports.formatFileSize=tr;exports.formatPercent=Ye;exports.getCellRenderer=Kt;exports.mapFieldTypeToFormType=er;exports.registerAllFields=lt;exports.registerField=at;exports.registerFieldRenderer=D;exports.registerFields=sr;
8
+ }`,disabled:s||n.disabled,className:d.cn("font-mono text-xs",f?"border-red-500 focus-visible:ring-red-500":"",n.className),rows:6}),f&&t.jsx("p",{className:"text-xs text-red-500",children:f})]})}const Dt=Object.freeze(Object.defineProperty({__proto__:null,ObjectField:be},Symbol.toStringTag,{value:"Module"}));function je({value:e,field:r,...a}){const n=(r||a.schema)?.dimensions||(Array.isArray(e)?e.length:0);if(!e||!Array.isArray(e))return t.jsx("span",{className:"text-sm text-gray-500",children:"-"});const l=e.slice(0,3).map(i=>{const o=Number(i);return isNaN(o)?"0":o.toFixed(4)}).join(", ");return t.jsxs("div",{className:`text-sm ${a.className||""}`,children:[t.jsxs("span",{className:"font-mono text-gray-700",children:["[",l,"...]"]}),t.jsxs("span",{className:"text-gray-500 ml-2",children:["(",n,"D)"]})]})}const Lt=Object.freeze(Object.defineProperty({__proto__:null,VectorField:je},Symbol.toStringTag,{value:"Module"}));function ye({value:e,field:r,readonly:a,...s}){const l=(r||s.schema)?.columns||[];return!e||!Array.isArray(e)?t.jsx("span",{className:"text-sm text-gray-500",children:"-"}):a?t.jsx("div",{className:d.cn("text-sm",s.className),children:t.jsxs("span",{className:"text-gray-700",children:[e.length," rows"]})}):t.jsxs("div",{className:d.cn("border border-gray-200 rounded-md overflow-hidden",s.className),children:[t.jsx("div",{className:"overflow-auto max-h-60",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"bg-gray-50 border-b border-gray-200",children:t.jsx("tr",{children:l.map((i,o)=>t.jsx("th",{className:"px-3 py-2 text-left text-xs font-medium text-gray-700",children:i.label||i.name},o))})}),t.jsx("tbody",{className:"divide-y divide-gray-200",children:e.slice(0,5).map((i,o)=>t.jsx("tr",{className:"hover:bg-gray-50",children:l.map((c,f)=>t.jsx("td",{className:"px-3 py-2 text-gray-900",children:i[c.name]!=null?String(i[c.name]):"-"},f))},o))})]})}),e.length>5&&t.jsxs("div",{className:"bg-gray-50 px-3 py-2 text-xs text-gray-500 border-t border-gray-200",children:["Showing 5 of ",e.length," rows"]})]})}const Bt=Object.freeze(Object.defineProperty({__proto__:null,GridField:ye},Symbol.toStringTag,{value:"Module"}));function Ne({value:e,onChange:r,field:a,readonly:s,...n}){const l=a||n.schema;return s?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-6 h-6 rounded border border-input",style:{backgroundColor:e||"#000000"}}),t.jsx("span",{className:"text-sm",children:e||"-"})]}):t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"color",value:e||"#000000",onChange:i=>r(i.target.value),disabled:s||n.disabled,className:"w-10 h-10 rounded border border-input cursor-pointer"}),t.jsx(d.Input,{type:"text",value:e||"",onChange:i=>r(i.target.value),placeholder:l?.placeholder||"#000000",disabled:s||n.disabled,className:n.className,pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"})]})}const Vt=Object.freeze(Object.defineProperty({__proto__:null,ColorField:Ne},Symbol.toStringTag,{value:"Module"}));function ve({value:e,onChange:r,field:a,readonly:s,...n}){const l=a||n.schema,i=l?.min??0,o=l?.max??100,c=l?.step??1;return s?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm font-medium",children:e??i}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:["/ ",o]})]}):t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(d.Slider,{value:[e??i],onValueChange:f=>r(f[0]),min:i,max:o,step:c,disabled:s||n.disabled,className:n.className}),t.jsx("span",{className:"text-sm font-medium w-12 text-right",children:e??i})]})}const Yt=Object.freeze(Object.defineProperty({__proto__:null,SliderField:ve},Symbol.toStringTag,{value:"Module"}));function Fe({value:e,onChange:r,field:a,readonly:s,className:n,...l}){const o=(a||l.schema)?.max??5,c=e??0,[f,h]=C.useState(null),p=f!==null?f:c;return s?t.jsxs("div",{className:d.cn("flex items-center gap-1",n),children:[Array.from({length:o},(u,x)=>t.jsx(F.Star,{className:`w-5 h-5 ${x<c?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},x)),t.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[c," / ",o]})]}):t.jsxs("div",{className:d.cn("flex items-center gap-1",n),children:[Array.from({length:o},(u,x)=>t.jsx("button",{type:"button",onClick:()=>r(x+1),onMouseEnter:()=>h(x+1),onMouseLeave:()=>h(null),className:"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded",disabled:s||l.disabled,children:t.jsx(F.Star,{className:`w-5 h-5 transition-colors ${x<p?"fill-yellow-400 text-yellow-400 hover:fill-yellow-500 hover:text-yellow-500":"text-muted-foreground hover:text-yellow-400"}`})},x)),t.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[c," / ",o]})]})}const qt=Object.freeze(Object.defineProperty({__proto__:null,RatingField:Fe},Symbol.toStringTag,{value:"Module"}));function _e({value:e,onChange:r,field:a,readonly:s,...n}){const l=a||n.schema,i=l?.language??"javascript";return s?t.jsx("pre",{className:d.cn("text-sm bg-muted p-2 rounded overflow-x-auto border",n.className),children:t.jsx("code",{children:e||"-"})}):t.jsx(d.Textarea,{value:e||"",onChange:o=>r(o.target.value),placeholder:l?.placeholder||`// Write ${i} code here...`,disabled:s||n.disabled,className:d.cn("font-mono text-sm",n.className),rows:12,spellCheck:!1})}const Jt=Object.freeze(Object.defineProperty({__proto__:null,CodeField:_e},Symbol.toStringTag,{value:"Module"}));function Ce({value:e,onChange:r,field:a,readonly:s,...n}){const[l,i]=C.useState(!1),o=C.useRef(null),c=a||n.schema,f=u=>{const x=u.target.files?.[0];if(!x)return;if(!x.type.startsWith("image/")){console.error("Please select an image file");return}if(x.size>5*1024*1024){console.error("File size must be less than 5MB");return}const g=new FileReader;g.onloadend=()=>{r(g.result)},g.readAsDataURL(x)},h=()=>{r("")},p=()=>(c?.defaultName||c?.label||"User").split(" ").map(x=>x[0]).join("").toUpperCase().slice(0,2);return s?t.jsxs(d.Avatar,{className:"w-16 h-16",children:[e&&t.jsx(d.AvatarImage,{src:e,alt:c?.label}),t.jsx(d.AvatarFallback,{children:p()})]}):t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"relative",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[t.jsxs(d.Avatar,{className:"w-16 h-16",children:[e&&t.jsx(d.AvatarImage,{src:e,alt:c?.label}),t.jsx(d.AvatarFallback,{children:p()})]}),!s&&l&&e&&t.jsx("button",{type:"button",onClick:h,className:"absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-1 hover:bg-destructive/90",children:t.jsx(F.X,{className:"w-3 h-3"})})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("input",{ref:o,type:"file",accept:"image/*",onChange:f,className:"hidden"}),t.jsxs(d.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>o.current?.click(),disabled:s||n.disabled,children:[t.jsx(F.Upload,{className:"w-4 h-4 mr-2"}),e?"Change":"Upload"," Avatar"]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"PNG, JPG up to 5MB"})]})]})}const Gt=Object.freeze(Object.defineProperty({__proto__:null,AvatarField:Ce},Symbol.toStringTag,{value:"Module"}));function Se({value:e,onChange:r,field:a,readonly:s,...n}){const l=e||{},i=(c,f)=>{r({...l,[c]:f})},o=c=>[c.street,c.city,[c.state,c.zipCode].filter(Boolean).join(" "),c.country].filter(Boolean).join(", ")||"-";return s?t.jsx("span",{className:"text-sm",children:o(l)}):t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{children:[t.jsx(d.Label,{htmlFor:"street",className:"text-xs",children:"Street Address"}),t.jsx(d.Input,{id:"street",type:"text",value:l.street||"",onChange:c=>i("street",c.target.value),placeholder:"123 Main St",disabled:s||n.disabled,className:n.className})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx(d.Label,{htmlFor:"city",className:"text-xs",children:"City"}),t.jsx(d.Input,{id:"city",type:"text",value:l.city||"",onChange:c=>i("city",c.target.value),placeholder:"San Francisco",disabled:s||n.disabled})]}),t.jsxs("div",{children:[t.jsx(d.Label,{htmlFor:"state",className:"text-xs",children:"State / Province"}),t.jsx(d.Input,{id:"state",type:"text",value:l.state||"",onChange:c=>i("state",c.target.value),placeholder:"CA",disabled:s||n.disabled})]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx(d.Label,{htmlFor:"zipCode",className:"text-xs",children:"ZIP / Postal Code"}),t.jsx(d.Input,{id:"zipCode",type:"text",value:l.zipCode||"",onChange:c=>i("zipCode",c.target.value),placeholder:"94102",disabled:s||n.disabled})]}),t.jsxs("div",{children:[t.jsx(d.Label,{htmlFor:"country",className:"text-xs",children:"Country"}),t.jsx(d.Input,{id:"country",type:"text",value:l.country||"",onChange:c=>i("country",c.target.value),placeholder:"United States",disabled:s||n.disabled})]})]})]})}const Qt=Object.freeze(Object.defineProperty({__proto__:null,AddressField:Se},Symbol.toStringTag,{value:"Module"}));function we({value:e,onChange:r,field:a,readonly:s,...n}){const[l,i]=C.useState(!1),o=e||{},c=(u,x)=>{r({...o,[u]:x?Number(x):void 0})},f=()=>{if(!navigator.geolocation){console.error("Geolocation is not supported by this browser");return}i(!0),navigator.geolocation.getCurrentPosition(u=>{r({latitude:u.coords.latitude,longitude:u.coords.longitude,accuracy:u.coords.accuracy}),i(!1)},u=>{console.error("Error getting location:",u.message),i(!1)},{enableHighAccuracy:!0,timeout:5e3,maximumAge:0})},h=u=>!u.latitude||!u.longitude?"-":`${u.latitude.toFixed(6)}, ${u.longitude.toFixed(6)}`,p=()=>{if(!o.latitude||!o.longitude)return;const u=`https://www.google.com/maps?q=${o.latitude},${o.longitude}`;window.open(u,"_blank")};return s?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(F.MapPin,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:h(o)}),o.latitude&&o.longitude&&t.jsx(d.Button,{type:"button",variant:"link",size:"sm",onClick:p,className:"p-0 h-auto",children:"View on map"})]}):t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(d.Button,{type:"button",variant:"outline",size:"sm",onClick:f,disabled:s||l,children:[t.jsx(F.Crosshair,{className:"w-4 h-4 mr-2"}),l?"Getting location...":"Use Current Location"]}),o.latitude&&o.longitude&&t.jsxs(d.Button,{type:"button",variant:"link",size:"sm",onClick:p,children:[t.jsx(F.MapPin,{className:"w-4 h-4 mr-2"}),"View on map"]})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{children:[t.jsx(d.Label,{htmlFor:"latitude",className:"text-xs",children:"Latitude"}),t.jsx(d.Input,{id:"latitude",type:"number",value:o.latitude??"",onChange:u=>c("latitude",u.target.value),placeholder:"37.7749",disabled:s||n.disabled,step:"any",className:n.className})]}),t.jsxs("div",{children:[t.jsx(d.Label,{htmlFor:"longitude",className:"text-xs",children:"Longitude"}),t.jsx(d.Input,{id:"longitude",type:"number",value:o.longitude??"",onChange:u=>c("longitude",u.target.value),placeholder:"-122.4194",disabled:s||n.disabled,step:"any"})]})]}),o.accuracy&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Accuracy: ±",o.accuracy.toFixed(0),"m"]})]})}const Wt=Object.freeze(Object.defineProperty({__proto__:null,GeolocationField:we},Symbol.toStringTag,{value:"Module"}));function Re({value:e,onChange:r,readonly:a}){const s=C.useRef(null),[n,l]=C.useState(!1),[i,o]=C.useState(!e);C.useEffect(()=>{if(e&&s.current){const x=s.current.getContext("2d");if(x){const g=new Image;g.onload=()=>{x.drawImage(g,0,0),o(!1)},g.src=e}}},[e]);const c=u=>{if(a)return;l(!0),o(!1);const x=s.current;if(!x)return;const g=x.getContext("2d");if(!g)return;const v=x.getBoundingClientRect(),P="touches"in u?u.touches[0].clientX-v.left:u.clientX-v.left,N="touches"in u?u.touches[0].clientY-v.top:u.clientY-v.top;g.beginPath(),g.moveTo(P,N)},f=u=>{if(!n||a)return;const x=s.current;if(!x)return;const g=x.getContext("2d");if(!g)return;const v=x.getBoundingClientRect(),P="touches"in u?u.touches[0].clientX-v.left:u.clientX-v.left,N="touches"in u?u.touches[0].clientY-v.top:u.clientY-v.top;g.lineTo(P,N),g.strokeStyle="#000",g.lineWidth=2,g.lineCap="round",g.lineJoin="round",g.stroke()},h=()=>{if(!n)return;l(!1);const u=s.current;if(!u)return;const x=u.toDataURL("image/png");r(x)},p=()=>{const u=s.current;if(!u)return;const x=u.getContext("2d");x&&(x.clearRect(0,0,u.width,u.height),o(!0),r(""))};return a&&e?t.jsx("div",{className:"border rounded p-2 bg-white",children:t.jsx("img",{src:e,alt:"Signature",loading:"lazy",className:"max-w-full h-auto"})}):a&&!e?t.jsx("span",{className:"text-sm text-muted-foreground",children:"No signature"}):t.jsxs("div",{className:"space-y-2",children:[t.jsx("div",{className:"border rounded bg-white",children:t.jsx("canvas",{ref:s,width:400,height:200,className:"w-full touch-none cursor-crosshair",onMouseDown:c,onMouseMove:f,onMouseUp:h,onMouseLeave:h,onTouchStart:c,onTouchMove:f,onTouchEnd:h})}),t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:i?"Sign above":"Signature captured"}),t.jsxs(d.Button,{type:"button",variant:"outline",size:"sm",onClick:p,disabled:a||i,children:[t.jsx(F.Eraser,{className:"w-4 h-4 mr-2"}),"Clear"]})]})]})}const Xt=Object.freeze(Object.defineProperty({__proto__:null,SignatureField:Re},Symbol.toStringTag,{value:"Module"}));function Pe({value:e,onChange:r,field:a,readonly:s,...n}){const[l,i]=C.useState(!1),o=a||n.schema,c=h=>`https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(h)}`,f=()=>{e&&navigator.clipboard.writeText(e)};return s?t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-sm flex-1 truncate",children:e||"-"}),e&&t.jsxs(d.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>i(!l),children:[t.jsx(F.QrCode,{className:"w-4 h-4 mr-2"}),l?"Hide":"Show"," QR"]})]}):t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(d.Input,{type:"text",value:e||"",onChange:h=>r(h.target.value),placeholder:o?.placeholder||"Enter text for QR code",disabled:s||n.disabled,className:n.className}),e&&t.jsxs(t.Fragment,{children:[t.jsx(d.Button,{type:"button",variant:"outline",size:"sm",onClick:f,children:t.jsx(F.Copy,{className:"w-4 h-4"})}),t.jsx(d.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>i(!l),children:t.jsx(F.QrCode,{className:"w-4 h-4"})})]})]}),l&&e&&t.jsx("div",{className:"border rounded p-4 bg-white flex justify-center",children:t.jsx("img",{src:c(e),alt:"QR Code",className:"w-48 h-48"})}),e&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:["QR code contains: ",e.length," characters"]})]})}const Ht=Object.freeze(Object.defineProperty({__proto__:null,QRCodeField:Pe},Symbol.toStringTag,{value:"Module"}));function Te({value:e,onChange:r,field:a,readonly:s,className:n,...l}){const i=e||[],o=a||l.schema,c=()=>{const p={id:`new-${Date.now()}`,label:"New Related Record"};r([...i,p])},f=p=>{r(i.filter(u=>u.id!==p))},h=p=>{console.log("View detail:",p)};return s?t.jsxs("div",{className:d.cn("space-y-2",n),children:[i.length===0?t.jsx("span",{className:"text-sm text-muted-foreground",children:"No related records"}):i.map(p=>t.jsxs("div",{className:"flex items-center justify-between p-2 border rounded hover:bg-muted/50",children:[t.jsx("span",{className:"text-sm",children:p.label}),t.jsx(d.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>h(p),children:t.jsx(F.ExternalLink,{className:"w-4 h-4"})})]},p.id)),t.jsxs("p",{className:"text-xs text-muted-foreground",children:[i.length," ",i.length===1?"record":"records"]})]}):t.jsxs("div",{className:d.cn("space-y-3",n),children:[t.jsxs("div",{className:"space-y-2",children:[i.map(p=>t.jsxs("div",{className:"flex items-center justify-between gap-2 p-2 border rounded hover:bg-muted/50",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[t.jsx(d.Badge,{variant:"outline",children:p.id}),t.jsx("span",{className:"text-sm flex-1",children:p.label})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(d.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>h(p),children:t.jsx(F.ExternalLink,{className:"w-4 h-4"})}),t.jsx(d.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>f(p.id),disabled:l.disabled,children:t.jsx(F.X,{className:"w-4 h-4"})})]})]},p.id)),i.length===0&&t.jsx("div",{className:"text-sm text-muted-foreground text-center py-4 border border-dashed rounded bg-muted/20",children:"No related records"})]}),t.jsxs(d.Button,{type:"button",variant:"outline",className:"w-full",onClick:c,disabled:l.disabled,children:[t.jsx(F.Plus,{className:"w-4 h-4 mr-2"}),"Add ",o?.label||"Record"]})]})}const Zt=Object.freeze(Object.defineProperty({__proto__:null,MasterDetailField:Te},Symbol.toStringTag,{value:"Module"}));function Ve(e,r="USD"){try{return new Intl.NumberFormat("en-US",{style:"currency",currency:r}).format(e)}catch{return`${r} ${e.toFixed(2)}`}}function Ye(e,r=0){return`${(e>-1&&e<1?e*100:e).toFixed(r)}%`}function qe(e,r){if(!e)return"-";const a=typeof e=="string"?new Date(e):e;return isNaN(a.getTime())?"-":a.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function Je(e){if(!e)return"-";const r=typeof e=="string"?new Date(e):e;return isNaN(r.getTime())?"-":r.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function T({value:e}){return t.jsx("span",{className:"truncate",children:e||"-"})}function Ge({value:e,field:r}){if(e==null)return t.jsx("span",{className:"text-muted-foreground",children:"-"});const s=r.precision??0,n=typeof e=="number"?new Intl.NumberFormat("en-US",{minimumFractionDigits:s,maximumFractionDigits:s}).format(e):e;return t.jsx("span",{className:"tabular-nums",children:n})}function Qe({value:e,field:r}){if(e==null)return t.jsx("span",{className:"text-muted-foreground",children:"-"});const s=r.currency||"USD",n=Ve(Number(e),s);return t.jsx("span",{className:"tabular-nums font-medium whitespace-nowrap",children:n})}function We({value:e,field:r}){if(e==null)return t.jsx("span",{className:"text-muted-foreground",children:"-"});const s=r.precision??0,n=Number(e),l=Ye(n,s),i=n>-1&&n<1?n*100:n,o=Math.max(0,Math.min(100,i));return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"h-1.5 w-16 rounded-full bg-muted overflow-hidden flex-shrink-0",role:"progressbar","aria-valuenow":o,"aria-valuemin":0,"aria-valuemax":100,children:t.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${o}%`}})}),t.jsx("span",{className:"tabular-nums whitespace-nowrap",children:l})]})}function Xe({value:e}){return t.jsx("div",{className:"flex items-center",children:e?t.jsxs(d.Badge,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200 gap-1",children:[t.jsx(F.Check,{className:"size-3"}),"True"]}):t.jsxs(d.Badge,{variant:"outline",className:"bg-gray-50 text-gray-500 border-gray-200 gap-1",children:[t.jsx(F.X,{className:"size-3"}),"False"]})})}function He({value:e,field:r}){const s=qe(e,r.format);return t.jsx("span",{className:"tabular-nums",children:s})}function Ze({value:e}){const r=Je(e);return t.jsx("span",{className:"tabular-nums text-sm",children:r})}function z({value:e,field:r}){const s=r.options||[];if(!e)return t.jsx("span",{children:"-"});const n=c=>{const f={gray:"bg-gray-100 text-gray-800 border-gray-300",red:"bg-red-100 text-red-800 border-red-300",orange:"bg-orange-100 text-orange-800 border-orange-300",yellow:"bg-yellow-100 text-yellow-800 border-yellow-300",green:"bg-green-100 text-green-800 border-green-300",blue:"bg-blue-100 text-blue-800 border-blue-300",indigo:"bg-indigo-100 text-indigo-800 border-indigo-300",purple:"bg-purple-100 text-purple-800 border-purple-300",pink:"bg-pink-100 text-pink-800 border-pink-300"};return f[c||"blue"]||f.blue};if(Array.isArray(e))return t.jsx("div",{className:"flex flex-wrap gap-1",children:e.map((c,f)=>{const h=s.find(x=>x.value===c),p=h?.label||c,u=n(h?.color);return t.jsx(d.Badge,{variant:"outline",className:u,children:p},f)})});const l=s.find(c=>c.value===e),i=l?.label||e,o=n(l?.color);return t.jsx(d.Badge,{variant:"outline",className:o,children:i})}function Ke({value:e}){return e?t.jsx(d.Button,{variant:"link",className:"p-0 h-auto font-normal text-blue-600 hover:text-blue-800",asChild:!0,children:t.jsx("a",{href:`mailto:${e}`,onClick:r=>r.stopPropagation(),children:e})}):t.jsx("span",{children:"-"})}function et({value:e}){return e?t.jsx(d.Button,{variant:"link",className:"p-0 h-auto font-normal text-blue-600 hover:text-blue-800",asChild:!0,children:t.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),children:e})}):t.jsx("span",{children:"-"})}function tt({value:e}){return e?t.jsx("a",{href:`tel:${e}`,className:"text-blue-600 hover:text-blue-800",onClick:r=>r.stopPropagation(),children:e}):t.jsx("span",{children:"-"})}function rt({value:e,field:r}){if(!e)return t.jsx("span",{children:"-"});if(r.multiple,Array.isArray(e)){const n=e.length;return t.jsxs("span",{className:"text-sm text-gray-600",children:[n," ",n===1?"file":"files"]})}const s=e.name||e.original_name||"File";return t.jsx("span",{className:"text-sm truncate",children:s})}function st({value:e}){return e?Array.isArray(e)?t.jsxs("div",{className:"flex -space-x-2",children:[e.slice(0,3).map((r,a)=>t.jsx("img",{src:r.url||"",alt:r.name||`Image ${a+1}`,className:"size-8 rounded-md border-2 border-white object-cover"},a)),e.length>3&&t.jsxs("div",{className:"size-8 rounded-md border-2 border-white bg-gray-100 flex items-center justify-center text-xs font-medium text-gray-600",children:["+",e.length-3]})]}):t.jsx("img",{src:e.url||"",alt:e.name||"Image",className:"size-10 rounded-md object-cover"}):t.jsx("span",{children:"-"})}function Oe({value:e}){if(!e)return t.jsx("span",{children:"-"});if(Array.isArray(e))return t.jsx("div",{className:"flex flex-wrap gap-1",children:e.map((r,a)=>{const s=r.name||r.label||r._id||String(r);return t.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-800",children:s},a)})});if(typeof e=="object"&&e!==null){const r=e.name||e.label||e._id||"[Object]";return t.jsx("span",{className:"truncate",children:r})}return t.jsx("span",{className:"truncate",children:String(e)})}function G({value:e}){return t.jsx("span",{className:"text-gray-700 font-mono text-sm",children:e!=null?String(e):"-"})}function Q({value:e}){if(!e)return t.jsx("span",{children:"-"});if(Array.isArray(e))return t.jsxs("div",{className:"flex -space-x-2",children:[e.slice(0,3).map((s,n)=>{const l=s.name||s.username||"User",i=l.split(" ").map(o=>o[0]).join("").toUpperCase().slice(0,2);return t.jsx(d.Avatar,{className:"size-8 border-2 border-white",title:l,children:t.jsx(d.AvatarFallback,{className:"bg-blue-500 text-white text-xs",children:i})},n)}),e.length>3&&t.jsx(d.Avatar,{className:"size-8 border-2 border-white",children:t.jsxs(d.AvatarFallback,{className:"bg-gray-200 text-gray-600 text-xs",children:["+",e.length-3]})})]});const r=e.name||e.username||"User",a=r.split(" ").map(s=>s[0]).join("").toUpperCase().slice(0,2);return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(d.Avatar,{className:"size-8",children:t.jsx(d.AvatarFallback,{className:"bg-blue-500 text-white text-xs",children:a})}),t.jsx("span",{className:"truncate",children:r})]})}const W=new Map;function D(e,r){W.set(e,r)}function Kt(e){return W.has(e)?W.get(e):{text:T,textarea:T,markdown:T,html:T,number:Ge,currency:Qe,percent:We,boolean:Xe,date:He,datetime:Ze,time:T,select:z,lookup:z,master_detail:z,email:Ke,url:et,phone:tt,file:rt,image:st,formula:G,summary:G,auto_number:T,user:Q,owner:Q,password:()=>t.jsx("span",{children:"••••••"}),location:T,object:()=>t.jsx("span",{className:"text-gray-500 italic",children:"[Object]"}),vector:()=>t.jsx("span",{className:"text-gray-500 italic",children:"[Vector]"}),grid:()=>t.jsx("span",{className:"text-gray-500 italic",children:"[Grid]"})}[e]||T}D("lookup",Oe);D("master_detail",Oe);D("select",z);function er(e){return{text:"field:text",textarea:"field:textarea",markdown:"field:markdown",html:"field:html",number:"field:number",currency:"field:currency",percent:"field:percent",date:"field:date",datetime:"field:datetime",time:"field:time",boolean:"field:boolean",select:"field:select",lookup:"field:lookup",master_detail:"field:master_detail",email:"field:email",phone:"field:phone",url:"field:url",file:"field:file",image:"field:image",password:"field:password",location:"field:location",formula:"field:formula",summary:"field:summary",auto_number:"field:auto_number"}[e]||"field:text"}function tr(e){if(e<0||!Number.isFinite(e)||e===0)return"0 B";const r=["B","KB","MB","GB","TB"];let a=e,s=0;for(;a>=1024&&s<r.length-1;)a/=1024,s++;return`${a.toFixed(s>0?1:0)} ${r[s]}`}function rr(e){const r={};return e.required&&(r.required=typeof e.required_message=="string"?e.required_message:`${e.label||e.name} is required`),e.min_length&&(r.minLength={value:e.min_length,message:e.min_length_message||`Minimum length is ${e.min_length} characters`}),e.max_length&&(r.maxLength={value:e.max_length,message:e.max_length_message||`Maximum length is ${e.max_length} characters`}),e.min!==void 0&&(r.min={value:e.min,message:e.min_message||`Minimum value is ${e.min}`}),e.max!==void 0&&(r.max={value:e.max,message:e.max_message||`Maximum value is ${e.max}`}),e.pattern&&(r.pattern={value:typeof e.pattern=="string"?new RegExp(e.pattern):e.pattern,message:e.pattern_message||"Invalid format"}),e.type==="email"&&(r.pattern={value:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,message:"Please enter a valid email address"}),e.type==="url"&&(r.pattern={value:/^https?:\/\/.+/,message:"Please enter a valid URL"}),e.validate&&(r.validate=e.validate),Object.keys(r).length>0?r:void 0}function X(e,r){if(!e)return!0;if(e.field&&e.value!==void 0){const a=r[e.field];if(e.operator==="="||e.operator==="==")return a===e.value;if(e.operator==="!=")return a!==e.value;if(e.operator===">")return a>e.value;if(e.operator===">=")return a>=e.value;if(e.operator==="<")return a<e.value;if(e.operator==="<=")return a<=e.value;if(e.operator==="in")return Array.isArray(e.value)&&e.value.includes(a)}return e.and&&Array.isArray(e.and)?e.and.every(a=>X(a,r)):e.or&&Array.isArray(e.or)?e.or.some(a=>X(a,r)):!0}function y(e){const r=({schema:a,className:s,value:n,...l})=>{const[i,o]=C.useState(n??a?.value??""),c={name:a?.name||"field",label:a?.label,type:a?.type,placeholder:a?.placeholder,required:a?.required,readonly:a?.readonly||a?.readOnly,help:a?.help,description:a?.description,defaultValue:a?.defaultValue||a?.value,...a},f=C.useCallback(p=>{o(p),l.onChange&&l.onChange(p)},[l]),h=a?.readonly||a?.readOnly||!1;return t.jsxs("div",{className:"grid w-full items-center gap-1.5","data-obj-id":a?.id,"data-obj-type":a?.type,children:[a?.label&&t.jsx("label",{htmlFor:a.id,className:a.required?"after:content-['*'] after:ml-0.5 after:text-red-500":"",children:a.label}),t.jsx(e,{value:i,onChange:f,field:c,readonly:h,className:s}),a?.description&&t.jsx("p",{className:"text-sm text-gray-500",children:a.description})]})};return r.displayName=`FieldRenderer(${e.displayName||e.name||"Component"})`,r}const nt={text:()=>Promise.resolve().then(()=>bt).then(e=>({default:e.TextField})),textarea:()=>Promise.resolve().then(()=>Rt).then(e=>({default:e.TextAreaField})),number:()=>Promise.resolve().then(()=>jt).then(e=>({default:e.NumberField})),boolean:()=>Promise.resolve().then(()=>yt).then(e=>({default:e.BooleanField})),select:()=>Promise.resolve().then(()=>Nt).then(e=>({default:e.SelectField})),date:()=>Promise.resolve().then(()=>vt).then(e=>({default:e.DateField})),datetime:()=>Promise.resolve().then(()=>Tt).then(e=>({default:e.DateTimeField})),time:()=>Promise.resolve().then(()=>Ot).then(e=>({default:e.TimeField})),email:()=>Promise.resolve().then(()=>Ft).then(e=>({default:e.EmailField})),phone:()=>Promise.resolve().then(()=>_t).then(e=>({default:e.PhoneField})),url:()=>Promise.resolve().then(()=>Ct).then(e=>({default:e.UrlField})),currency:()=>Promise.resolve().then(()=>wt).then(e=>({default:e.CurrencyField})),percent:()=>Promise.resolve().then(()=>At).then(e=>({default:e.PercentField})),password:()=>Promise.resolve().then(()=>kt).then(e=>({default:e.PasswordField})),markdown:()=>Promise.resolve().then(()=>Le).then(e=>({default:e.RichTextField})),html:()=>Promise.resolve().then(()=>Le).then(e=>({default:e.RichTextField})),lookup:()=>Promise.resolve().then(()=>Pt).then(e=>({default:e.LookupField})),master_detail:()=>Promise.resolve().then(()=>Zt).then(e=>({default:e.MasterDetailField})),file:()=>Promise.resolve().then(()=>$t).then(e=>({default:e.FileField})),image:()=>Promise.resolve().then(()=>zt).then(e=>({default:e.ImageField})),location:()=>Promise.resolve().then(()=>Et).then(e=>({default:e.LocationField})),formula:()=>Promise.resolve().then(()=>Mt).then(e=>({default:e.FormulaField})),summary:()=>Promise.resolve().then(()=>It).then(e=>({default:e.SummaryField})),auto_number:()=>Promise.resolve().then(()=>Ut).then(e=>({default:e.AutoNumberField})),user:()=>Promise.resolve().then(()=>Be).then(e=>({default:e.UserField})),owner:()=>Promise.resolve().then(()=>Be).then(e=>({default:e.UserField})),object:()=>Promise.resolve().then(()=>Dt).then(e=>({default:e.ObjectField})),vector:()=>Promise.resolve().then(()=>Lt).then(e=>({default:e.VectorField})),grid:()=>Promise.resolve().then(()=>Bt).then(e=>({default:e.GridField})),color:()=>Promise.resolve().then(()=>Vt).then(e=>({default:e.ColorField})),slider:()=>Promise.resolve().then(()=>Yt).then(e=>({default:e.SliderField})),rating:()=>Promise.resolve().then(()=>qt).then(e=>({default:e.RatingField})),code:()=>Promise.resolve().then(()=>Jt).then(e=>({default:e.CodeField})),avatar:()=>Promise.resolve().then(()=>Gt).then(e=>({default:e.AvatarField})),address:()=>Promise.resolve().then(()=>Qt).then(e=>({default:e.AddressField})),geolocation:()=>Promise.resolve().then(()=>Wt).then(e=>({default:e.GeolocationField})),signature:()=>Promise.resolve().then(()=>Xt).then(e=>({default:e.SignatureField})),qrcode:()=>Promise.resolve().then(()=>Ht).then(e=>({default:e.QRCodeField}))};function at(e){const r=nt[e];if(!r){console.warn(`Unknown field type: ${e}`);return}const a=C.lazy(r);b.ComponentRegistry.register(e,a,{namespace:"field"})}function lt(){Object.keys(nt).forEach(e=>{at(e)})}function sr(){b.ComponentRegistry.register("text",y(H),{namespace:"field"}),b.ComponentRegistry.register("textarea",y(le),{namespace:"field"}),b.ComponentRegistry.register("number",y(Z),{namespace:"field"}),b.ComponentRegistry.register("boolean",y(K),{namespace:"field"}),b.ComponentRegistry.register("select",y(ee),{namespace:"field"}),b.ComponentRegistry.register("date",y(te),{namespace:"field"}),b.ComponentRegistry.register("datetime",y(oe),{namespace:"field"}),b.ComponentRegistry.register("time",y(ce),{namespace:"field"}),b.ComponentRegistry.register("email",y(re),{namespace:"field"}),b.ComponentRegistry.register("phone",y(se),{namespace:"field"}),b.ComponentRegistry.register("url",y(ne),{namespace:"field"}),b.ComponentRegistry.register("currency",y(ae),{namespace:"field"}),b.ComponentRegistry.register("percent",y(de),{namespace:"field"}),b.ComponentRegistry.register("password",y(ue),{namespace:"field"}),b.ComponentRegistry.register("markdown",y(I),{namespace:"field"}),b.ComponentRegistry.register("html",y(I),{namespace:"field"}),b.ComponentRegistry.register("lookup",y(ie),{namespace:"field"}),b.ComponentRegistry.register("master_detail",y(Te),{namespace:"field"}),b.ComponentRegistry.register("file",y(me),{namespace:"field"}),b.ComponentRegistry.register("image",y(fe),{namespace:"field"}),b.ComponentRegistry.register("location",y(xe),{namespace:"field"}),b.ComponentRegistry.register("formula",y(pe),{namespace:"field"}),b.ComponentRegistry.register("summary",y(he),{namespace:"field"}),b.ComponentRegistry.register("auto_number",y(ge),{namespace:"field"}),b.ComponentRegistry.register("user",y(U),{namespace:"field"}),b.ComponentRegistry.register("owner",y(U),{namespace:"field"}),b.ComponentRegistry.register("object",y(be),{namespace:"field"}),b.ComponentRegistry.register("vector",y(je),{namespace:"field"}),b.ComponentRegistry.register("grid",y(ye),{namespace:"field"}),b.ComponentRegistry.register("color",y(Ne),{namespace:"field"}),b.ComponentRegistry.register("slider",y(ve),{namespace:"field"}),b.ComponentRegistry.register("rating",y(Fe),{namespace:"field"}),b.ComponentRegistry.register("code",y(_e),{namespace:"field"}),b.ComponentRegistry.register("avatar",y(Ce),{namespace:"field"}),b.ComponentRegistry.register("address",y(Se),{namespace:"field"}),b.ComponentRegistry.register("geolocation",y(we),{namespace:"field"}),b.ComponentRegistry.register("signature",y(Re),{namespace:"field"}),b.ComponentRegistry.register("qrcode",y(Pe),{namespace:"field"})}lt();exports.AddressField=Se;exports.AutoNumberField=ge;exports.AvatarField=Ce;exports.BooleanCellRenderer=Xe;exports.BooleanField=K;exports.CodeField=_e;exports.ColorField=Ne;exports.CurrencyCellRenderer=Qe;exports.CurrencyField=ae;exports.DateCellRenderer=He;exports.DateField=te;exports.DateTimeCellRenderer=Ze;exports.DateTimeField=oe;exports.EmailCellRenderer=Ke;exports.EmailField=re;exports.FileCellRenderer=rt;exports.FileField=me;exports.FormulaCellRenderer=G;exports.FormulaField=pe;exports.GeolocationField=we;exports.GridField=ye;exports.ImageCellRenderer=st;exports.ImageField=fe;exports.LocationField=xe;exports.LookupCellRenderer=Oe;exports.LookupField=ie;exports.MasterDetailField=Te;exports.NumberCellRenderer=Ge;exports.NumberField=Z;exports.ObjectField=be;exports.PasswordField=ue;exports.PercentCellRenderer=We;exports.PercentField=de;exports.PhoneCellRenderer=tt;exports.PhoneField=se;exports.QRCodeField=Pe;exports.RatingField=Fe;exports.RichTextField=I;exports.SelectCellRenderer=z;exports.SelectField=ee;exports.SignatureField=Re;exports.SliderField=ve;exports.SummaryField=he;exports.TextAreaField=le;exports.TextCellRenderer=T;exports.TextField=H;exports.TimeField=ce;exports.UrlCellRenderer=et;exports.UrlField=ne;exports.UserCellRenderer=Q;exports.UserField=U;exports.VectorField=je;exports.buildValidationRules=rr;exports.evaluateCondition=X;exports.formatCurrency=Ve;exports.formatDate=qe;exports.formatDateTime=Je;exports.formatFileSize=tr;exports.formatPercent=Ye;exports.getCellRenderer=Kt;exports.mapFieldTypeToFormType=er;exports.registerAllFields=lt;exports.registerField=at;exports.registerFieldRenderer=D;exports.registerFields=sr;