proje-react-panel 1.1.2 → 1.1.3

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 (31) hide show
  1. package/dist/components/list/CellField.d.ts +3 -2
  2. package/dist/components/list/cells/BooleanCell.d.ts +6 -0
  3. package/dist/components/list/cells/DateCell.d.ts +6 -0
  4. package/dist/components/list/cells/DefaultCell.d.ts +8 -0
  5. package/dist/components/list/cells/DownloadCell.d.ts +8 -0
  6. package/dist/components/list/cells/ImageCell.d.ts +8 -0
  7. package/dist/components/list/cells/UUIDCell.d.ts +6 -0
  8. package/dist/decorators/list/Cell.d.ts +4 -6
  9. package/dist/decorators/list/ExtendedCell.d.ts +10 -0
  10. package/dist/decorators/list/cells/DownloadCell.d.ts +9 -0
  11. package/dist/decorators/list/cells/ImageCell.d.ts +2 -2
  12. package/dist/index.cjs.js +1 -1
  13. package/dist/index.d.ts +1 -0
  14. package/dist/index.esm.js +1 -1
  15. package/dist/utils/decerators.d.ts +7 -0
  16. package/package.json +1 -1
  17. package/src/components/list/CellField.tsx +26 -42
  18. package/src/components/list/Datagrid.tsx +16 -9
  19. package/src/components/list/cells/BooleanCell.tsx +15 -0
  20. package/src/components/list/cells/DateCell.tsx +21 -0
  21. package/src/components/list/cells/DefaultCell.tsx +11 -0
  22. package/src/components/list/cells/DownloadCell.tsx +28 -0
  23. package/src/components/list/cells/ImageCell.tsx +22 -0
  24. package/src/components/list/cells/UUIDCell.tsx +11 -0
  25. package/src/decorators/list/Cell.ts +15 -33
  26. package/src/decorators/list/ExtendedCell.ts +32 -0
  27. package/src/decorators/list/cells/DownloadCell.ts +18 -0
  28. package/src/decorators/list/cells/ImageCell.ts +6 -5
  29. package/src/index.ts +1 -0
  30. package/src/styles/list.scss +1 -1
  31. package/src/utils/decerators.ts +24 -0
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
2
  import { AnyClass } from '../../types/AnyClass';
3
+ import { CellConfiguration } from '../../decorators/list/Cell';
3
4
  interface CellFieldProps<T extends AnyClass> {
4
- cellOptions: any;
5
+ configuration: CellConfiguration;
5
6
  item: T;
6
7
  value: any;
7
8
  }
8
- export declare function CellField<T extends AnyClass>({ cellOptions, item, value }: CellFieldProps<T>): React.JSX.Element;
9
+ export declare function CellField<T extends AnyClass>({ configuration, item, value, }: CellFieldProps<T>): React.ReactElement;
9
10
  export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface BooleanCellProps {
3
+ value: boolean;
4
+ }
5
+ export declare function BooleanCell({ value }: BooleanCellProps): React.JSX.Element;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface DateCellProps {
3
+ value: string | number | Date;
4
+ }
5
+ export declare function DateCell({ value }: DateCellProps): React.JSX.Element;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { CellConfiguration } from '../../../decorators/list/Cell';
3
+ interface DefaultCellProps {
4
+ value: any;
5
+ configuration: CellConfiguration;
6
+ }
7
+ export declare function DefaultCell({ value, configuration }: DefaultCellProps): React.ReactElement;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { CellConfiguration } from '../../../decorators/list/Cell';
3
+ interface DownloadCellProps {
4
+ value: string;
5
+ configuration: CellConfiguration;
6
+ }
7
+ export declare function DownloadCell({ value, configuration }: DownloadCellProps): React.ReactElement;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { CellConfiguration } from '../../../decorators/list/Cell';
3
+ interface ImageCellProps {
4
+ value: string;
5
+ configuration: CellConfiguration;
6
+ }
7
+ export declare function ImageCell({ value, configuration }: ImageCellProps): React.JSX.Element;
8
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface UUIDCellProps {
3
+ value: string;
4
+ }
5
+ export declare function UUIDCell({ value }: UUIDCellProps): React.JSX.Element;
6
+ export {};
@@ -1,6 +1,7 @@
1
1
  import 'reflect-metadata';
2
2
  import { AnyClass } from '../../types/AnyClass';
3
- export declare const CELL_KEY: unique symbol;
3
+ import { DecoratorMap } from '../../utils/decerators';
4
+ export declare const CELL_KEY: Symbol;
4
5
  interface Filter {
5
6
  type: 'string' | 'number' | 'date' | 'static-select';
6
7
  }
@@ -12,7 +13,7 @@ export interface StaticSelectFilter extends Filter {
12
13
  }[];
13
14
  }
14
15
  export type CellTypes = 'string' | 'date' | 'number' | 'boolean' | 'uuid';
15
- export type ExtendedCellTypes = CellTypes | 'image';
16
+ export type ExtendedCellTypes = CellTypes | 'image' | 'download';
16
17
  export interface CellOptions {
17
18
  name?: string;
18
19
  title?: string;
@@ -20,14 +21,11 @@ export interface CellOptions {
20
21
  placeHolder?: string;
21
22
  filter?: Filter | StaticSelectFilter;
22
23
  }
23
- export interface ExtendedCellOptions extends Omit<CellOptions, 'type'> {
24
- type?: ExtendedCellTypes;
25
- }
26
24
  export interface CellConfiguration extends Omit<CellOptions, 'type'> {
27
25
  name: string;
28
26
  type: ExtendedCellTypes;
29
27
  }
28
+ export declare const cellMap: DecoratorMap<CellOptions, CellConfiguration>;
30
29
  export declare function Cell(options?: CellOptions): PropertyDecorator;
31
- export declare function ExtendedCell(options?: ExtendedCellOptions): PropertyDecorator;
32
30
  export declare function getCellFields<T extends AnyClass>(entityClass: T): CellConfiguration[];
33
31
  export {};
@@ -0,0 +1,10 @@
1
+ import { CellConfiguration, CellOptions, ExtendedCellTypes } from './Cell';
2
+ import { DecoratorMap } from '../../utils/decerators';
3
+ export interface ExtendedCellOptions extends Omit<CellOptions, 'type'> {
4
+ type?: ExtendedCellTypes;
5
+ }
6
+ interface ExtendedCellConfiguration extends Omit<CellConfiguration, 'name'> {
7
+ name?: string;
8
+ }
9
+ export declare function ExtendedCell<T extends ExtendedCellOptions, K extends ExtendedCellConfiguration>(options?: T, map?: DecoratorMap<T, K>): PropertyDecorator;
10
+ export {};
@@ -0,0 +1,9 @@
1
+ import { CellConfiguration, CellOptions } from '../Cell';
2
+ export interface DownloadCellOptions extends Omit<CellOptions, 'type'> {
3
+ baseUrl: string;
4
+ }
5
+ export interface DownloadCellConfiguration extends CellConfiguration {
6
+ type: 'download';
7
+ baseUrl: string;
8
+ }
9
+ export declare function DownloadCell(options?: DownloadCellOptions): PropertyDecorator;
@@ -1,9 +1,9 @@
1
- import 'reflect-metadata';
2
1
  import { CellConfiguration, CellOptions } from '../Cell';
3
- export interface ImageCellOptions extends CellOptions {
2
+ export interface ImageCellOptions extends Omit<CellOptions, 'type'> {
4
3
  baseUrl: string;
5
4
  }
6
5
  export interface ImageCellConfiguration extends CellConfiguration {
7
6
  type: 'image';
7
+ baseUrl: string;
8
8
  }
9
9
  export declare function ImageCell(options?: ImageCellOptions): PropertyDecorator;
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("react-router"),t=require("react"),n=require("react-select"),r=require("react-hook-form"),a=require("zustand/middleware"),o=require("zustand/traditional"),i=require("zustand/vanilla/shallow");function s(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var c=s(t);function l({error:e}){return t.createElement("div",{className:"error-container"},t.createElement("div",{className:"error-icon"},t.createElement("i",{className:"fa fa-exclamation-circle"})),t.createElement("div",{className:"error-content"},t.createElement("h3",null,"Error Occurred"),t.createElement("p",null,(e=>{if(e instanceof Response)switch(e.status){case 400:return"Bad Request: The request was invalid or malformed.";case 401:return"Unauthorized: Please log in to access this resource.";case 404:return"Not Found: The requested resource could not be found.";case 403:return"Forbidden: You don't have permission to access this resource.";case 500:return"Internal Server Error: Something went wrong on our end.";default:return`Error ${e.status}: ${e.statusText||"Something went wrong."}`}return e?.message||"Something went wrong. Please try again later."})(e))))}var u,p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},f={};!function(){return u||(u=1,function(e){!function(){var t="object"==typeof globalThis?globalThis:"object"==typeof p?p:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(e){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(e){}}(),n=r(e);function r(e,t){return function(n,r){Object.defineProperty(e,n,{configurable:!0,writable:!0,value:r}),t&&t(n,r)}}void 0!==t.Reflect&&(n=r(t.Reflect,n)),function(e,t){var n=Object.prototype.hasOwnProperty,r="function"==typeof Symbol,a=r&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",o=r&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",i="function"==typeof Object.create,s={__proto__:[]}instanceof Array,c=!i&&!s,l={create:i?function(){return pe(Object.create(null))}:s?function(){return pe({__proto__:null})}:function(){return pe({})},has:c?function(e,t){return n.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return n.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},u=Object.getPrototypeOf(Function),p="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:ce(),f="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:le(),d="function"==typeof WeakMap?WeakMap:ue(),h=r?Symbol.for("@reflect-metadata:registry"):void 0,m=ae(),y=oe(m);function v(e,t,n,r){if(D(n)){if(!q(e))throw new TypeError;if(!G(t))throw new TypeError;return N(e,t)}if(!q(e))throw new TypeError;if(!$(t))throw new TypeError;if(!$(r)&&!D(r)&&!F(r))throw new TypeError;return F(r)&&(r=void 0),T(e,t,n=W(n),r)}function g(e,t){function n(n,r){if(!$(n))throw new TypeError;if(!D(r)&&!J(r))throw new TypeError;P(e,t,n,r)}return n}function E(e,t,n,r){if(!$(n))throw new TypeError;return D(r)||(r=W(r)),P(e,t,n,r)}function b(e,t,n){if(!$(t))throw new TypeError;return D(n)||(n=W(n)),k(e,t,n)}function w(e,t,n){if(!$(t))throw new TypeError;return D(n)||(n=W(n)),C(e,t,n)}function S(e,t,n){if(!$(t))throw new TypeError;return D(n)||(n=W(n)),A(e,t,n)}function O(e,t,n){if(!$(t))throw new TypeError;return D(n)||(n=W(n)),L(e,t,n)}function _(e,t){if(!$(e))throw new TypeError;return D(t)||(t=W(t)),I(e,t)}function M(e,t){if(!$(e))throw new TypeError;return D(t)||(t=W(t)),j(e,t)}function x(e,t,n){if(!$(t))throw new TypeError;if(D(n)||(n=W(n)),!$(t))throw new TypeError;D(n)||(n=W(n));var r=se(t,n,!1);return!D(r)&&r.OrdinaryDeleteMetadata(e,t,n)}function N(e,t){for(var n=e.length-1;n>=0;--n){var r=(0,e[n])(t);if(!D(r)&&!F(r)){if(!G(r))throw new TypeError;t=r}}return t}function T(e,t,n,r){for(var a=e.length-1;a>=0;--a){var o=(0,e[a])(t,n,r);if(!D(o)&&!F(o)){if(!$(o))throw new TypeError;r=o}}return r}function k(e,t,n){if(C(e,t,n))return!0;var r=ne(t);return!F(r)&&k(e,r,n)}function C(e,t,n){var r=se(t,n,!1);return!D(r)&&H(r.OrdinaryHasOwnMetadata(e,t,n))}function A(e,t,n){if(C(e,t,n))return L(e,t,n);var r=ne(t);return F(r)?void 0:A(e,r,n)}function L(e,t,n){var r=se(t,n,!1);if(!D(r))return r.OrdinaryGetOwnMetadata(e,t,n)}function P(e,t,n,r){se(n,r,!0).OrdinaryDefineOwnMetadata(e,t,n,r)}function I(e,t){var n=j(e,t),r=ne(e);if(null===r)return n;var a=I(r,t);if(a.length<=0)return n;if(n.length<=0)return a;for(var o=new f,i=[],s=0,c=n;s<c.length;s++){var l=c[s];o.has(l)||(o.add(l),i.push(l))}for(var u=0,p=a;u<p.length;u++){l=p[u];o.has(l)||(o.add(l),i.push(l))}return i}function j(e,t){var n=se(e,t,!1);return n?n.OrdinaryOwnMetadataKeys(e,t):[]}function V(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function D(e){return void 0===e}function F(e){return null===e}function R(e){return"symbol"==typeof e}function $(e){return"object"==typeof e?null!==e:"function"==typeof e}function z(e,t){switch(V(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var n="string",r=Q(e,a);if(void 0!==r){var o=r.call(e,n);if($(o))throw new TypeError;return o}return B(e)}function B(e,t){var n,r,a=e.toString;if(K(a)&&!$(r=a.call(e)))return r;if(K(n=e.valueOf)&&!$(r=n.call(e)))return r;throw new TypeError}function H(e){return!!e}function U(e){return""+e}function W(e){var t=z(e);return R(t)?t:U(t)}function q(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function K(e){return"function"==typeof e}function G(e){return"function"==typeof e}function J(e){switch(V(e)){case 3:case 4:return!0;default:return!1}}function Y(e,t){return e===t||e!=e&&t!=t}function Q(e,t){var n=e[t];if(null!=n){if(!K(n))throw new TypeError;return n}}function X(e){var t=Q(e,o);if(!K(t))throw new TypeError;var n=t.call(e);if(!$(n))throw new TypeError;return n}function Z(e){return e.value}function ee(e){var t=e.next();return!t.done&&t}function te(e){var t=e.return;t&&t.call(e)}function ne(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===u)return t;if(t!==u)return t;var n=e.prototype,r=n&&Object.getPrototypeOf(n);if(null==r||r===Object.prototype)return t;var a=r.constructor;return"function"!=typeof a||a===e?t:a}function re(){var e,n,r,a;D(h)||void 0===t.Reflect||h in t.Reflect||"function"!=typeof t.Reflect.defineMetadata||(e=ie(t.Reflect));var o=new d,i={registerProvider:s,getProvider:l,setProvider:m};return i;function s(t){if(!Object.isExtensible(i))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case e===t:break;case D(n):n=t;break;case n===t:break;case D(r):r=t;break;case r===t:break;default:void 0===a&&(a=new f),a.add(t)}}function c(t,o){if(!D(n)){if(n.isProviderFor(t,o))return n;if(!D(r)){if(r.isProviderFor(t,o))return n;if(!D(a))for(var i=X(a);;){var s=ee(i);if(!s)return;var c=Z(s);if(c.isProviderFor(t,o))return te(i),c}}}if(!D(e)&&e.isProviderFor(t,o))return e}function l(e,t){var n,r=o.get(e);return D(r)||(n=r.get(t)),D(n)?(D(n=c(e,t))||(D(r)&&(r=new p,o.set(e,r)),r.set(t,n)),n):n}function u(e){if(D(e))throw new TypeError;return n===e||r===e||!D(a)&&a.has(e)}function m(e,t,n){if(!u(n))throw new Error("Metadata provider not registered.");var r=l(e,t);if(r!==n){if(!D(r))return!1;var a=o.get(e);D(a)&&(a=new p,o.set(e,a)),a.set(t,n)}return!0}}function ae(){var e;return!D(h)&&$(t.Reflect)&&Object.isExtensible(t.Reflect)&&(e=t.Reflect[h]),D(e)&&(e=re()),!D(h)&&$(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,h,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}function oe(e){var t=new d,n={isProviderFor:function(e,n){var r=t.get(e);return!D(r)&&r.has(n)},OrdinaryDefineOwnMetadata:i,OrdinaryHasOwnMetadata:a,OrdinaryGetOwnMetadata:o,OrdinaryOwnMetadataKeys:s,OrdinaryDeleteMetadata:c};return m.registerProvider(n),n;function r(r,a,o){var i=t.get(r),s=!1;if(D(i)){if(!o)return;i=new p,t.set(r,i),s=!0}var c=i.get(a);if(D(c)){if(!o)return;if(c=new p,i.set(a,c),!e.setProvider(r,a,n))throw i.delete(a),s&&t.delete(r),new Error("Wrong provider for target.")}return c}function a(e,t,n){var a=r(t,n,!1);return!D(a)&&H(a.has(e))}function o(e,t,n){var a=r(t,n,!1);if(!D(a))return a.get(e)}function i(e,t,n,a){r(n,a,!0).set(e,t)}function s(e,t){var n=[],a=r(e,t,!1);if(D(a))return n;for(var o=X(a.keys()),i=0;;){var s=ee(o);if(!s)return n.length=i,n;var c=Z(s);try{n[i]=c}catch(e){try{te(o)}finally{throw e}}i++}}function c(e,n,a){var o=r(n,a,!1);if(D(o))return!1;if(!o.delete(e))return!1;if(0===o.size){var i=t.get(n);D(i)||(i.delete(a),0===i.size&&t.delete(i))}return!0}}function ie(e){var t=e.defineMetadata,n=e.hasOwnMetadata,r=e.getOwnMetadata,a=e.getOwnMetadataKeys,o=e.deleteMetadata,i=new d;return{isProviderFor:function(e,t){var n=i.get(e);return!(D(n)||!n.has(t))||!!a(e,t).length&&(D(n)&&(n=new f,i.set(e,n)),n.add(t),!0)},OrdinaryDefineOwnMetadata:t,OrdinaryHasOwnMetadata:n,OrdinaryGetOwnMetadata:r,OrdinaryOwnMetadataKeys:a,OrdinaryDeleteMetadata:o}}function se(e,t,n){var r=m.getProvider(e,t);if(!D(r))return r;if(n){if(m.setProvider(e,t,y))return y;throw new Error("Illegal state.")}}function ce(){var e={},t=[],n=function(){function e(e,t,n){this._index=0,this._keys=e,this._values=t,this._selector=n}return e.prototype["@@iterator"]=function(){return this},e.prototype[o]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var n=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:n,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}(),r=function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var n=this._find(e,!0);return this._values[n]=t,this},t.prototype.delete=function(t){var n=this._find(t,!1);if(n>=0){for(var r=this._keys.length,a=n+1;a<r;a++)this._keys[a-1]=this._keys[a],this._values[a-1]=this._values[a];return this._keys.length--,this._values.length--,Y(t,this._cacheKey)&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},t.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},t.prototype.keys=function(){return new n(this._keys,this._values,a)},t.prototype.values=function(){return new n(this._keys,this._values,i)},t.prototype.entries=function(){return new n(this._keys,this._values,s)},t.prototype["@@iterator"]=function(){return this.entries()},t.prototype[o]=function(){return this.entries()},t.prototype._find=function(e,t){if(!Y(this._cacheKey,e)){this._cacheIndex=-1;for(var n=0;n<this._keys.length;n++)if(Y(this._keys[n],e)){this._cacheIndex=n;break}}return this._cacheIndex<0&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},t}();return r;function a(e,t){return e}function i(e,t){return t}function s(e,t){return[e,t]}}function le(){return function(){function e(){this._map=new p}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.keys()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[o]=function(){return this.keys()},e}()}function ue(){var e=16,t=l.create(),r=a();return function(){function e(){this._key=a()}return e.prototype.has=function(e){var t=o(e,!1);return void 0!==t&&l.has(t,this._key)},e.prototype.get=function(e){var t=o(e,!1);return void 0!==t?l.get(t,this._key):void 0},e.prototype.set=function(e,t){return o(e,!0)[this._key]=t,this},e.prototype.delete=function(e){var t=o(e,!1);return void 0!==t&&delete t[this._key]},e.prototype.clear=function(){this._key=a()},e}();function a(){var e;do{e="@@WeakMap@@"+c()}while(l.has(t,e));return t[e]=!0,e}function o(e,t){if(!n.call(e,r)){if(!t)return;Object.defineProperty(e,r,{value:l.create()})}return e[r]}function i(e,t){for(var n=0;n<t;++n)e[n]=255*Math.random()|0;return e}function s(e){if("function"==typeof Uint8Array){var t=new Uint8Array(e);return"undefined"!=typeof crypto?crypto.getRandomValues(t):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(t):i(t,e),t}return i(new Array(e),e)}function c(){var t=s(e);t[6]=79&t[6]|64,t[8]=191&t[8]|128;for(var n="",r=0;r<e;++r){var a=t[r];4!==r&&6!==r&&8!==r||(n+="-"),a<16&&(n+="0"),n+=a.toString(16).toLowerCase()}return n}}function pe(e){return e.__=void 0,delete e.__,e}e("decorate",v),e("metadata",g),e("defineMetadata",E),e("hasMetadata",b),e("hasOwnMetadata",w),e("getMetadata",S),e("getOwnMetadata",O),e("getMetadataKeys",_),e("getOwnMetadataKeys",M),e("deleteMetadata",x)}(n,t),void 0===t.Reflect&&(t.Reflect=e)}()}(e||(e={}))),f;var e}();const d=Symbol("detailsItem");function h(e){const t=e.prototype;return(Reflect.getMetadata(d,t)||[]).map((e=>{const n=Reflect.getMetadata(`${d.toString()}:${e}:options`,t)||{};return{...n,name:n.name||e}}))}const m="DetailsMetaData";function y(e){const t=Reflect.getMetadata(m,e);if(!t)throw new Error("Details decerator should be used on class");return{...t}}function v(){return t.createElement("div",{className:"loading-screen"},t.createElement("div",{className:"loading-container"},t.createElement("div",{className:"loading-spinner"}),t.createElement("div",{className:"loading-text"},"Loading...")))}const g=()=>t.createElement("div",{className:"empty-list"},t.createElement("div",{className:"empty-list-content"},t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"64",height:"64",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t.createElement("path",{d:"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"}),t.createElement("polyline",{points:"13 2 13 9 20 9"})),t.createElement("h3",null,"No Data Found"),t.createElement("p",null,"There are no items to display at the moment.")));var E,b;function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},w.apply(null,arguments)}var S,O,_=function(e){return c.createElement("svg",w({xmlns:"http://www.w3.org/2000/svg",width:800,height:800,viewBox:"0 0 24 24"},e),E||(E=c.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),b||(b=c.createElement("path",{d:"m21 19-5.154-5.154a7 7 0 1 0-2 2L19 21zM5 10c0-2.757 2.243-5 5-5s5 2.243 5 5-2.243 5-5 5-5-2.243-5-5"})))};function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},M.apply(null,arguments)}var x,N,T=function(e){return c.createElement("svg",M({xmlns:"http://www.w3.org/2000/svg",width:800,height:800,viewBox:"0 0 24 24"},e),S||(S=c.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),O||(O=c.createElement("path",{d:"m13 6 5 5-9.507 9.507a1.765 1.765 0 0 1-.012-2.485l-.002-.003c-.69.676-1.8.673-2.485-.013a1.763 1.763 0 0 1-.036-2.455l-.008-.008c-.694.65-1.78.64-2.456-.036zm7.586-.414-2.172-2.172a2 2 0 0 0-2.828 0L14 5l5 5 1.586-1.586c.78-.78.78-2.047 0-2.828M3 18v3h3a3 3 0 0 0-3-3"})))};function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},k.apply(null,arguments)}var C,A=function(e){return c.createElement("svg",k({xmlns:"http://www.w3.org/2000/svg",width:800,height:800,viewBox:"0 0 24 24"},e),x||(x=c.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),N||(N=c.createElement("path",{d:"M6.187 8h11.625l-.695 11.125A2 2 0 0 1 15.12 21H8.88a2 2 0 0 1-1.997-1.875zM19 5v2H5V5h3V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1zm-9 0h4V4h-4z"})))};function L(){return L=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},L.apply(null,arguments)}var P,I=function(e){return c.createElement("svg",L({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",stroke:"#000"},e),C||(C=c.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 6 9 17l-5-5"})))};function j(){return j=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},j.apply(null,arguments)}var V,D,F,R=function(e){return c.createElement("svg",j({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",stroke:"#000"},e),P||(P=c.createElement("path",{strokeLinecap:"round",strokeWidth:2,d:"m8 8 8 8m-8 0 8-8"})))};function $({cellOptions:e,item:n,value:r}){let a=r??"-";switch(e.type){case"boolean":a=r?t.createElement(I,{className:"icon icon-true"}):t.createElement(R,{className:"icon icon-false"});break;case"date":if(r){const e=new Date(r);a=`${e.getDate().toString().padStart(2,"0")}/${(e.getMonth()+1).toString().padStart(2,"0")}/${e.getFullYear()} ${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}`}break;case"image":{const n=e;a=t.createElement("img",{width:100,height:100,src:n.baseUrl+r,style:{objectFit:"contain"}});break}case"uuid":r&&"string"==typeof r&&r.length>=6&&(a=`${r.slice(0,3)}...${r.slice(-3)}`);break;default:a=r?r.toString():e?.placeHolder??"-"}return t.createElement("td",{key:e.name},a)}function z({data:n,listPageMeta:r,onRemoveItem:a}){const o=r.cells,i=n?.[0]?"function"==typeof r.class.cells?r.class.cells?.(n[0]):r.class.cells:null;return t.createElement("div",{className:"datagrid"},n&&0!==n.length?t.createElement("table",{className:"datagrid-table"},t.createElement("thead",null,t.createElement("tr",null,o.map((e=>t.createElement("th",{key:e.name},e.title??e.name))),i?.details&&t.createElement("th",null,"Details"),i?.edit&&t.createElement("th",null,"Edit"),i?.delete&&t.createElement("th",null,"Delete"))),t.createElement("tbody",null,n.map(((n,i)=>{const s=n?"function"==typeof r.class.cells?r.class.cells?.(n):r.class.cells:null;return t.createElement("tr",{key:i},o.map((e=>{const r=n[e.name];return t.createElement($,{key:e.name,cellOptions:e,item:n,value:r})})),s?.details&&t.createElement("td",null,t.createElement(e.Link,{to:s.details.path,className:"util-cell-link"},t.createElement(_,{className:"icon icon-search"}),t.createElement("span",{className:"util-cell-label"},s.details.label))),s?.edit&&t.createElement("td",null,t.createElement(e.Link,{to:s.edit.path,className:"util-cell-link"},t.createElement(T,{className:"icon icon-pencil"}),t.createElement("span",{className:"util-cell-label"},s.edit.label))),s?.delete&&t.createElement("td",null,t.createElement("a",{onClick:()=>{s.delete?.onRemoveItem?.(n).then((()=>{a?.(n)}))},className:"util-cell-link util-cell-link-remove"},t.createElement(A,{className:"icon icon-trash"}),t.createElement("span",{className:"util-cell-label"},s.delete.label))))})))):t.createElement(g,null))}function B({pagination:e,onPageChange:n}){const{total:r,page:a,limit:o}=e,i=Math.floor(r/o);if(i<=1)return null;return t.createElement("div",{className:"pagination"},t.createElement("button",{onClick:()=>n(a-1),className:"pagination-item "+(1===a?"disabled":""),disabled:1===a,"aria-disabled":1===a},"Previous"),(()=>{const e=[];for(let r=1;r<=Math.min(2,i);r++)e.push(t.createElement("button",{key:r,onClick:()=>n(r),className:"pagination-item "+(a===r?"active":""),disabled:a===r},r));a-2>3&&e.push(t.createElement("span",{key:"ellipsis1",className:"pagination-ellipsis"},"..."));for(let r=Math.max(3,a-2);r<=Math.min(i-2,a+2);r++)r>2&&r<i-1&&e.push(t.createElement("button",{key:r,onClick:()=>n(r),className:"pagination-item "+(a===r?"active":""),disabled:a===r},r));a+2<i-2&&e.push(t.createElement("span",{key:"ellipsis2",className:"pagination-ellipsis"},"..."));for(let r=Math.max(i-1,3);r<=i;r++)r>2&&e.push(t.createElement("button",{key:r,onClick:()=>n(r),className:"pagination-item "+(a===r?"active":""),disabled:a===r},r));return e})(),t.createElement("button",{onClick:()=>n(a+1),className:"pagination-item "+(a===i?"disabled":""),disabled:a===i,"aria-disabled":a===i},"Next"))}function H(){return H=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},H.apply(null,arguments)}var U,W=function(e){return c.createElement("svg",H({xmlns:"http://www.w3.org/2000/svg",width:800,height:800,viewBox:"0 0 24 24"},e),V||(V=c.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),D||(D=c.createElement("path",{d:"M21 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5v2H5v14h14v-5z"})),F||(F=c.createElement("path",{d:"M21 7h-4V3h-2v4h-4v2h4v4h2V9h4"})))};function q(){return q=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},q.apply(null,arguments)}var K=function(e){return c.createElement("svg",q({xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e),U||(U=c.createElement("path",{d:"M22 3H2l8 9.46V19l4 2v-8.54z"})))};function G({listPageMeta:n,filtered:r,onFilterClick:a,customHeader:o}){const i=t.useMemo((()=>n.cells.filter((e=>!!e.filter))),[n.cells]),s=n.class.headers;return t.createElement("div",{className:"list-header"},t.createElement("div",{className:"header-title"},s?.title||"List"),o&&t.createElement("div",{className:"header-custom"},o),t.createElement("div",{className:"header-actions"},!!i.length&&t.createElement("button",{onClick:a,className:"filter-button"},t.createElement(K,{className:"icon icon-filter "+(r?"active":"")}),"Filter"),s?.create&&t.createElement(e.Link,{to:s.create.path,className:"create-button"},t.createElement(W,{className:"icon icon-create"}),s.create.label)))}function J({field:e,value:r,onChange:a}){if("static-select"===e.filter?.type){const o=e.filter;return t.createElement(n,{id:e.name,menuPortalTarget:document.body,styles:{control:(e,t)=>({...e,backgroundColor:"#1f2937",borderColor:t.isFocused?"#6366f1":"#374151",boxShadow:t.isFocused?"0 0 0 1px #6366f1":"none","&:hover":{borderColor:"#6366f1"},borderRadius:"6px",padding:"2px",color:"white"}),option:(e,t)=>({...e,backgroundColor:t.isSelected?"#6366f1":t.isFocused?"#374151":"#1f2937",color:"white","&:active":{backgroundColor:"#6366f1"},"&:hover":{backgroundColor:"#374151"},cursor:"pointer"}),input:e=>({...e,color:"white"}),placeholder:e=>({...e,color:"#9ca3af"}),singleValue:e=>({...e,color:"white"}),menuPortal:e=>({...e,zIndex:9999}),menu:e=>({...e,backgroundColor:"#1f2937",border:"1px solid #374151",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"}),menuList:e=>({...e,padding:"4px"}),dropdownIndicator:e=>({...e,color:"#9ca3af","&:hover":{color:"#6366f1"}}),clearIndicator:e=>({...e,color:"#9ca3af","&:hover":{color:"#6366f1"}})},value:r?{value:r,label:o.options.find((e=>e.value===r))?.label||r}:null,onChange:e=>a(e?.value||""),options:o.options.map((e=>({value:e.value,label:e.label}))),placeholder:`Filter by ${e.title||e.name}`,isClearable:!0})}return t.createElement("input",{type:"number"===e.type?"number":"text",id:e.name,value:r||"",onChange:e=>a(e.target.value),placeholder:`Filter by ${e.title||e.name}`})}function Y({isOpen:e,onClose:n,onApplyFilters:r,listPageMeta:a,activeFilters:o}){const[i,s]=t.useState(o??{}),c=t.useRef(null),l=t.useMemo((()=>a.cells.filter((e=>!!e.filter))),[a.cells]);if(t.useEffect((()=>{const t=e=>{c.current&&!c.current.contains(e.target)&&n()};return e&&document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}}),[e,n]),!e)return null;return t.createElement("div",{className:"filter-popup-overlay"},t.createElement("div",{ref:c,className:"filter-popup"},t.createElement("div",{className:"filter-popup-header"},t.createElement("h3",null,"Filter"),t.createElement("button",{onClick:n,className:"close-button"},"×")),t.createElement("div",{className:"filter-popup-content"},l.map((e=>t.createElement("div",{key:e.name,className:"filter-field"},t.createElement("label",{htmlFor:e.name},e.title||e.name),t.createElement(J,{field:e,value:i[e.name||""],onChange:t=>((e,t)=>{s((n=>({...n,[e]:t})))})(e.name||"",t)}))))),t.createElement("div",{className:"filter-popup-footer"},t.createElement("button",{onClick:n,className:"cancel-button"},"Cancel"),t.createElement("button",{onClick:()=>{r(i),n()},className:"apply-button"},"Apply Filters"))))}const Q=Symbol("cell");function X(e){const t=e.prototype;return(Reflect.getMetadata(Q,t)||[]).map((e=>{const n=Reflect.getMetadata(`${Q.toString()}:${e}:options`,t)||{};return{...n,name:n.name||e,type:n.type}}))}const Z="ListMetaData";function ee(e){const t=Reflect.getMetadata(Z,e);if(!t)throw new Error("List decerator should be used on class");return{...t}}function te({input:e,maxLength:n=1}){const a=r.useFormContext(),[o,i]=t.useState([]),s=e.name;t.useEffect((()=>{a.setValue(e.name+"_files",o.length>0)}),[o,a,e.name]);return t.createElement("div",{className:"uploader-container"},t.createElement("button",{type:"button",className:"uploader-button",onClick:()=>document.getElementById(s)?.click()},"Upload Files"),t.createElement("input",{id:s,hidden:!0,name:e.name,onChange:e=>{if(n>1)throw new Error("TODO: Multiple file upload is not implemented yet");const t=e.target.files;if(t){const e=Array.from(t);i((t=>[...t,...e]))}},type:"file",multiple:!0}),o.length>0&&t.createElement("div",{className:"uploader-files"},o.map(((e,n)=>t.createElement("div",{key:`${e.name}-${n}`,className:"uploader-file"},t.createElement("p",null,e.name),t.createElement("p",null,(e.size/1024/1024).toFixed(2)," MB"),t.createElement("p",null,e.type||"Unknown type"),t.createElement("button",{onClick:()=>(e=>{i((t=>t.filter(((t,n)=>n!==e))))})(n),className:"remove-file-button",type:"button"},"Remove"))))))}function ne({label:e,fieldName:n,children:r,...a}){return t.createElement("label",{...a,className:"label "+a.className},t.createElement("span",null,e?e+":":n.charAt(0).toUpperCase()+n.slice(1)+":"),r)}function re({input:e,...n}){const{label:a,name:o}=e,i=r.useFormContext(),{register:s}=i;return t.createElement(ne,{className:"checkbox-label",htmlFor:o,label:a,fieldName:o},t.createElement("input",{type:"checkbox",id:o,className:"apple-switch",...n,...s(o)}))}const ae={control:(e,t)=>({...e,backgroundColor:"#1f2937",borderColor:t.isFocused?"#6366f1":"#374151",boxShadow:t.isFocused?"0 0 0 1px #6366f1":"none","&:hover":{borderColor:"#6366f1"},borderRadius:"6px",padding:"2px",color:"white"}),option:(e,t)=>({...e,backgroundColor:t.isSelected?"#6366f1":t.isFocused?"#374151":"#1f2937",color:"white","&:active":{backgroundColor:"#6366f1"},"&:hover":{backgroundColor:"#374151"},cursor:"pointer"}),input:e=>({...e,color:"white"}),placeholder:e=>({...e,color:"#9ca3af"}),singleValue:e=>({...e,color:"white"}),menuPortal:e=>({...e,zIndex:9999}),menu:e=>({...e,backgroundColor:"#1f2937",border:"1px solid #374151",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"}),menuList:e=>({...e,padding:"4px"}),dropdownIndicator:e=>({...e,color:"#9ca3af","&:hover":{color:"#6366f1"}}),clearIndicator:e=>({...e,color:"#9ca3af","&:hover":{color:"#6366f1"}})};function oe({input:e,fieldName:a}){const o=e,{control:i}=r.useFormContext(),[s,c]=t.useState(o.defaultOptions||[]),[l,u]=t.useState(0);return t.useEffect((()=>{o.onSelectPreloader&&o.onSelectPreloader().then((e=>{c(e),u(l+1)}))}),[e]),t.createElement(r.Controller,{name:a,control:i,render:({field:e})=>t.createElement(n,{key:l,options:s,styles:ae,value:s.find((t=>t.value===e.value))||null,onChange:t=>{e.onChange(t?.value)}})})}function ie({input:e,register:n}){const a=r.useFormContext(),o=a.getValues(e.name);return t.createElement("div",null,o?.map(((r,o)=>t.createElement("div",{key:o},e.nestedFields?.map((r=>t.createElement(se,{key:r.name?.toString()??"",baseName:e.name+"["+o+"]",input:r,register:n,error:e.name?{message:a.formState.errors[e.name]?.message}:void 0})))))))}function se({input:e,register:n,error:r,baseName:a,onSelectPreloader:o}){const i=(a?a.toString()+".":"")+e.name||"";return t.createElement("div",{className:"form-field"},"checkbox"!==e.type&&t.createElement(ne,{htmlFor:i,label:e.label,fieldName:i}),(()=>{switch(e.type){case"textarea":return t.createElement("textarea",{...n(i),placeholder:e.placeholder});case"select":return t.createElement(oe,{input:e,fieldName:i});case"input":return t.createElement("input",{type:e.inputType,...n(i),placeholder:e.placeholder});case"file-upload":return t.createElement(te,{input:e});case"checkbox":return t.createElement(re,{input:e});case"hidden":return t.createElement("input",{type:"hidden",...n(i)});case"nested":return t.createElement(ie,{input:e,register:n})}})(),r&&t.createElement("span",{className:"error-message"},r.message))}function ce({inputs:n,formClass:a}){const[o,i]=t.useState(null),s=t.useRef(null),c=e.useNavigate(),l=r.useFormContext();return t.createElement("div",{className:"form-wrapper"},t.createElement("form",{ref:s,onSubmit:l.handleSubmit((async e=>{try{const t="json"===a.type?e:(()=>{const t=new FormData(s.current);for(const n in e)t.get(n)||t.append(n,e[n]);return t})();await a.onSubmit(t),i(null),a.redirectBackOnSuccess&&c(-1)}catch(e){const t=e?.response?.data?.message||(e instanceof Error?e.message:"An error occurred");i(t),console.error(e)}}),((e,t)=>{console.log("error creating creation",e,t)}))},t.createElement("div",null,o&&t.createElement("div",{className:"error-message",style:{color:"red",marginBottom:"1rem"}},o),n?.map((e=>t.createElement(se,{key:e.name||"",input:e,register:l.register,error:e.name?{message:l.formState.errors[e.name]?.message}:void 0}))),t.createElement("button",{type:"submit",className:"submit-button"},"Submit"))))}const le=Symbol("input");function ue(e){const t=e.prototype;return(Reflect.getMetadata(le,t)||[]).map((e=>{const n=Reflect.getMetadata(`${le.toString()}:${e}:options`,t)||{},r=n?.inputType??(a=e,["password"].some((e=>a.toLowerCase().includes(e)))?"password":"text");var a;return{...n,editable:n.editable??!0,sensitive:n.sensitive,name:n?.name??e,label:n?.label??e,placeholder:n?.placeholder??e,inputType:r,type:n?.type??"input",selectOptions:n?.selectOptions??[]}}))}const pe="DetailsMetaData";function fe(e){const t=Reflect.getMetadata(pe,e);if(!t)throw new Error("Form decerator should be used on class");return{...t,type:t.type??"json",redirectBackOnSuccess:t.redirectBackOnSuccess??!0}}const de=(e,t,n)=>{if(e&&"reportValidity"in e){const a=r.get(n,t);e.setCustomValidity(a&&a.message||""),e.reportValidity()}},he=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?de(r.ref,n,e):r&&r.refs&&r.refs.forEach((t=>de(t,n,e)))}},me=(e,t)=>{t.shouldUseNativeValidation&&he(e,t);const n={};for(const a in e){const o=r.get(t.fields,a),i=Object.assign(e[a]||{},{ref:o&&o.ref});if(ye(t.names||Object.keys(e),a)){const e=Object.assign({},r.get(n,a));r.set(e,"root",i),r.set(n,a,e)}else r.set(n,a,i)}return n},ye=(e,t)=>{const n=ve(t);return e.some((e=>ve(e).match(`^${n}\\.\\d+`)))};function ve(e){return e.replace(/\]|\[/g,"")}var ge;!function(e){e[e.PLAIN_TO_CLASS=0]="PLAIN_TO_CLASS",e[e.CLASS_TO_PLAIN=1]="CLASS_TO_PLAIN",e[e.CLASS_TO_CLASS=2]="CLASS_TO_CLASS"}(ge||(ge={}));var Ee=function(){function e(){this._typeMetadatas=new Map,this._transformMetadatas=new Map,this._exposeMetadatas=new Map,this._excludeMetadatas=new Map,this._ancestorsMap=new Map}return e.prototype.addTypeMetadata=function(e){this._typeMetadatas.has(e.target)||this._typeMetadatas.set(e.target,new Map),this._typeMetadatas.get(e.target).set(e.propertyName,e)},e.prototype.addTransformMetadata=function(e){this._transformMetadatas.has(e.target)||this._transformMetadatas.set(e.target,new Map),this._transformMetadatas.get(e.target).has(e.propertyName)||this._transformMetadatas.get(e.target).set(e.propertyName,[]),this._transformMetadatas.get(e.target).get(e.propertyName).push(e)},e.prototype.addExposeMetadata=function(e){this._exposeMetadatas.has(e.target)||this._exposeMetadatas.set(e.target,new Map),this._exposeMetadatas.get(e.target).set(e.propertyName,e)},e.prototype.addExcludeMetadata=function(e){this._excludeMetadatas.has(e.target)||this._excludeMetadatas.set(e.target,new Map),this._excludeMetadatas.get(e.target).set(e.propertyName,e)},e.prototype.findTransformMetadatas=function(e,t,n){return this.findMetadatas(this._transformMetadatas,e,t).filter((function(e){return!e.options||(!0===e.options.toClassOnly&&!0===e.options.toPlainOnly||(!0===e.options.toClassOnly?n===ge.CLASS_TO_CLASS||n===ge.PLAIN_TO_CLASS:!0!==e.options.toPlainOnly||n===ge.CLASS_TO_PLAIN))}))},e.prototype.findExcludeMetadata=function(e,t){return this.findMetadata(this._excludeMetadatas,e,t)},e.prototype.findExposeMetadata=function(e,t){return this.findMetadata(this._exposeMetadatas,e,t)},e.prototype.findExposeMetadataByCustomName=function(e,t){return this.getExposedMetadatas(e).find((function(e){return e.options&&e.options.name===t}))},e.prototype.findTypeMetadata=function(e,t){return this.findMetadata(this._typeMetadatas,e,t)},e.prototype.getStrategy=function(e){var t=this._excludeMetadatas.get(e),n=t&&t.get(void 0),r=this._exposeMetadatas.get(e),a=r&&r.get(void 0);return n&&a||!n&&!a?"none":n?"excludeAll":"exposeAll"},e.prototype.getExposedMetadatas=function(e){return this.getMetadata(this._exposeMetadatas,e)},e.prototype.getExcludedMetadatas=function(e){return this.getMetadata(this._excludeMetadatas,e)},e.prototype.getExposedProperties=function(e,t){return this.getExposedMetadatas(e).filter((function(e){return!e.options||(!0===e.options.toClassOnly&&!0===e.options.toPlainOnly||(!0===e.options.toClassOnly?t===ge.CLASS_TO_CLASS||t===ge.PLAIN_TO_CLASS:!0!==e.options.toPlainOnly||t===ge.CLASS_TO_PLAIN))})).map((function(e){return e.propertyName}))},e.prototype.getExcludedProperties=function(e,t){return this.getExcludedMetadatas(e).filter((function(e){return!e.options||(!0===e.options.toClassOnly&&!0===e.options.toPlainOnly||(!0===e.options.toClassOnly?t===ge.CLASS_TO_CLASS||t===ge.PLAIN_TO_CLASS:!0!==e.options.toPlainOnly||t===ge.CLASS_TO_PLAIN))})).map((function(e){return e.propertyName}))},e.prototype.clear=function(){this._typeMetadatas.clear(),this._exposeMetadatas.clear(),this._excludeMetadatas.clear(),this._ancestorsMap.clear()},e.prototype.getMetadata=function(e,t){var n,r=e.get(t);r&&(n=Array.from(r.values()).filter((function(e){return void 0!==e.propertyName})));for(var a=[],o=0,i=this.getAncestors(t);o<i.length;o++){var s=i[o],c=e.get(s);if(c){var l=Array.from(c.values()).filter((function(e){return void 0!==e.propertyName}));a.push.apply(a,l)}}return a.concat(n||[])},e.prototype.findMetadata=function(e,t,n){var r=e.get(t);if(r){var a=r.get(n);if(a)return a}for(var o=0,i=this.getAncestors(t);o<i.length;o++){var s=i[o],c=e.get(s);if(c){var l=c.get(n);if(l)return l}}},e.prototype.findMetadatas=function(e,t,n){var r,a=e.get(t);a&&(r=a.get(n));for(var o=[],i=0,s=this.getAncestors(t);i<s.length;i++){var c=s[i],l=e.get(c);l&&l.has(n)&&o.push.apply(o,l.get(n))}return o.slice().reverse().concat((r||[]).slice().reverse())},e.prototype.getAncestors=function(e){if(!e)return[];if(!this._ancestorsMap.has(e)){for(var t=[],n=Object.getPrototypeOf(e.prototype.constructor);void 0!==n.prototype;n=Object.getPrototypeOf(n.prototype.constructor))t.push(n);this._ancestorsMap.set(e,t)}return this._ancestorsMap.get(e)},e}(),be=new Ee;var we=function(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))};var Se=function(){function e(e,t){this.transformationType=e,this.options=t,this.recursionStack=new Set}return e.prototype.transform=function(e,t,n,r,a,o){var i,s=this;if(void 0===o&&(o=0),Array.isArray(t)||t instanceof Set){var c=r&&this.transformationType===ge.PLAIN_TO_CLASS?function(e){var t=new e;return t instanceof Set||"push"in t?t:[]}(r):[];return t.forEach((function(t,r){var a=e?e[r]:void 0;if(s.options.enableCircularCheck&&s.isCircular(t))s.transformationType===ge.CLASS_TO_CLASS&&(c instanceof Set?c.add(t):c.push(t));else{var i=void 0;if("function"!=typeof n&&n&&n.options&&n.options.discriminator&&n.options.discriminator.property&&n.options.discriminator.subTypes){if(s.transformationType===ge.PLAIN_TO_CLASS){i=n.options.discriminator.subTypes.find((function(e){return e.name===t[n.options.discriminator.property]}));var l={newObject:c,object:t,property:void 0},u=n.typeFunction(l);i=void 0===i?u:i.value,n.options.keepDiscriminatorProperty||delete t[n.options.discriminator.property]}s.transformationType===ge.CLASS_TO_CLASS&&(i=t.constructor),s.transformationType===ge.CLASS_TO_PLAIN&&(t[n.options.discriminator.property]=n.options.discriminator.subTypes.find((function(e){return e.value===t.constructor})).name)}else i=n;var p=s.transform(a,t,i,void 0,t instanceof Map,o+1);c instanceof Set?c.add(p):c.push(p)}})),c}if(n!==String||a){if(n!==Number||a){if(n!==Boolean||a){if((n===Date||t instanceof Date)&&!a)return t instanceof Date?new Date(t.valueOf()):null==t?t:new Date(t);if(("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0).Buffer&&(n===Buffer||t instanceof Buffer)&&!a)return null==t?t:Buffer.from(t);if(null===(i=t)||"object"!=typeof i||"function"!=typeof i.then||a){if(a||null===t||"object"!=typeof t||"function"!=typeof t.then){if("object"==typeof t&&null!==t){n||t.constructor===Object||(Array.isArray(t)||t.constructor!==Array)&&(n=t.constructor),!n&&e&&(n=e.constructor),this.options.enableCircularCheck&&this.recursionStack.add(t);var l=this.getKeys(n,t,a),u=e||{};e||this.transformationType!==ge.PLAIN_TO_CLASS&&this.transformationType!==ge.CLASS_TO_CLASS||(u=a?new Map:n?new n:{});for(var p=function(r){if("__proto__"===r||"constructor"===r)return"continue";var i=r,s=r,c=r;if(!f.options.ignoreDecorators&&n)if(f.transformationType===ge.PLAIN_TO_CLASS)(l=be.findExposeMetadataByCustomName(n,r))&&(c=l.propertyName,s=l.propertyName);else if(f.transformationType===ge.CLASS_TO_PLAIN||f.transformationType===ge.CLASS_TO_CLASS){var l;(l=be.findExposeMetadata(n,r))&&l.options&&l.options.name&&(s=l.options.name)}var p=void 0;p=f.transformationType===ge.PLAIN_TO_CLASS?t[i]:t instanceof Map?t.get(i):t[i]instanceof Function?t[i]():t[i];var d=void 0,h=p instanceof Map;if(n&&a)d=n;else if(n){var m=be.findTypeMetadata(n,c);if(m){var y={newObject:u,object:t,property:c},v=m.typeFunction?m.typeFunction(y):m.reflectedType;m.options&&m.options.discriminator&&m.options.discriminator.property&&m.options.discriminator.subTypes?t[i]instanceof Array?d=m:(f.transformationType===ge.PLAIN_TO_CLASS&&(d=void 0===(d=m.options.discriminator.subTypes.find((function(e){if(p&&p instanceof Object&&m.options.discriminator.property in p)return e.name===p[m.options.discriminator.property]})))?v:d.value,m.options.keepDiscriminatorProperty||p&&p instanceof Object&&m.options.discriminator.property in p&&delete p[m.options.discriminator.property]),f.transformationType===ge.CLASS_TO_CLASS&&(d=p.constructor),f.transformationType===ge.CLASS_TO_PLAIN&&p&&(p[m.options.discriminator.property]=m.options.discriminator.subTypes.find((function(e){return e.value===p.constructor})).name)):d=v,h=h||m.reflectedType===Map}else if(f.options.targetMaps)f.options.targetMaps.filter((function(e){return e.target===n&&!!e.properties[c]})).forEach((function(e){return d=e.properties[c]}));else if(f.options.enableImplicitConversion&&f.transformationType===ge.PLAIN_TO_CLASS){var g=Reflect.getMetadata("design:type",n.prototype,c);g&&(d=g)}}var E=Array.isArray(t[i])?f.getReflectedType(n,c):void 0,b=e?e[i]:void 0;if(u.constructor.prototype){var w=Object.getOwnPropertyDescriptor(u.constructor.prototype,s);if((f.transformationType===ge.PLAIN_TO_CLASS||f.transformationType===ge.CLASS_TO_CLASS)&&(w&&!w.set||u[s]instanceof Function))return"continue"}if(f.options.enableCircularCheck&&f.isCircular(p)){if(f.transformationType===ge.CLASS_TO_CLASS){O=p;(void 0!==(O=f.applyCustomTransformations(O,n,r,t,f.transformationType))||f.options.exposeUnsetFields)&&(u instanceof Map?u.set(s,O):u[s]=O)}}else{var S=f.transformationType===ge.PLAIN_TO_CLASS?s:r,O=void 0;f.transformationType===ge.CLASS_TO_PLAIN?(O=t[S],O=f.applyCustomTransformations(O,n,S,t,f.transformationType),O=t[S]===O?p:O,O=f.transform(b,O,d,E,h,o+1)):void 0===p&&f.options.exposeDefaultValues?O=u[s]:(O=f.transform(b,p,d,E,h,o+1),O=f.applyCustomTransformations(O,n,S,t,f.transformationType)),(void 0!==O||f.options.exposeUnsetFields)&&(u instanceof Map?u.set(s,O):u[s]=O)}},f=this,d=0,h=l;d<h.length;d++){p(h[d])}return this.options.enableCircularCheck&&this.recursionStack.delete(t),u}return t}return t}return new Promise((function(e,r){t.then((function(t){return e(s.transform(void 0,t,n,void 0,void 0,o+1))}),r)}))}return null==t?t:Boolean(t)}return null==t?t:Number(t)}return null==t?t:String(t)},e.prototype.applyCustomTransformations=function(e,t,n,r,a){var o=this,i=be.findTransformMetadatas(t,n,this.transformationType);return void 0!==this.options.version&&(i=i.filter((function(e){return!e.options||o.checkVersion(e.options.since,e.options.until)}))),(i=this.options.groups&&this.options.groups.length?i.filter((function(e){return!e.options||o.checkGroups(e.options.groups)})):i.filter((function(e){return!e.options||!e.options.groups||!e.options.groups.length}))).forEach((function(t){e=t.transformFn({value:e,key:n,obj:r,type:a,options:o.options})})),e},e.prototype.isCircular=function(e){return this.recursionStack.has(e)},e.prototype.getReflectedType=function(e,t){if(e){var n=be.findTypeMetadata(e,t);return n?n.reflectedType:void 0}},e.prototype.getKeys=function(e,t,n){var r=this,a=be.getStrategy(e);"none"===a&&(a=this.options.strategy||"exposeAll");var o=[];if(("exposeAll"===a||n)&&(o=t instanceof Map?Array.from(t.keys()):Object.keys(t)),n)return o;if(this.options.ignoreDecorators&&this.options.excludeExtraneousValues&&e){var i=be.getExposedProperties(e,this.transformationType),s=be.getExcludedProperties(e,this.transformationType);o=we(we([],i,!0),s,!0)}if(!this.options.ignoreDecorators&&e){i=be.getExposedProperties(e,this.transformationType);this.transformationType===ge.PLAIN_TO_CLASS&&(i=i.map((function(t){var n=be.findExposeMetadata(e,t);return n&&n.options&&n.options.name?n.options.name:t}))),o=this.options.excludeExtraneousValues?i:o.concat(i);var c=be.getExcludedProperties(e,this.transformationType);c.length>0&&(o=o.filter((function(e){return!c.includes(e)}))),void 0!==this.options.version&&(o=o.filter((function(t){var n=be.findExposeMetadata(e,t);return!n||!n.options||r.checkVersion(n.options.since,n.options.until)}))),o=this.options.groups&&this.options.groups.length?o.filter((function(t){var n=be.findExposeMetadata(e,t);return!n||!n.options||r.checkGroups(n.options.groups)})):o.filter((function(t){var n=be.findExposeMetadata(e,t);return!(n&&n.options&&n.options.groups&&n.options.groups.length)}))}return this.options.excludePrefixes&&this.options.excludePrefixes.length&&(o=o.filter((function(e){return r.options.excludePrefixes.every((function(t){return e.substr(0,t.length)!==t}))}))),o=o.filter((function(e,t,n){return n.indexOf(e)===t}))},e.prototype.checkVersion=function(e,t){var n=!0;return n&&e&&(n=this.options.version>=e),n&&t&&(n=this.options.version<t),n},e.prototype.checkGroups=function(e){return!e||this.options.groups.some((function(t){return e.includes(t)}))},e}(),Oe={enableCircularCheck:!1,enableImplicitConversion:!1,excludeExtraneousValues:!1,excludePrefixes:void 0,exposeDefaultValues:!1,exposeUnsetFields:!0,groups:void 0,ignoreDecorators:!1,strategy:void 0,targetMaps:void 0,version:void 0},_e=function(){return _e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},_e.apply(this,arguments)},Me=new(function(){function e(){}return e.prototype.instanceToPlain=function(e,t){return new Se(ge.CLASS_TO_PLAIN,_e(_e({},Oe),t)).transform(void 0,e,void 0,void 0,void 0,void 0)},e.prototype.classToPlainFromExist=function(e,t,n){return new Se(ge.CLASS_TO_PLAIN,_e(_e({},Oe),n)).transform(t,e,void 0,void 0,void 0,void 0)},e.prototype.plainToInstance=function(e,t,n){return new Se(ge.PLAIN_TO_CLASS,_e(_e({},Oe),n)).transform(void 0,t,e,void 0,void 0,void 0)},e.prototype.plainToClassFromExist=function(e,t,n){return new Se(ge.PLAIN_TO_CLASS,_e(_e({},Oe),n)).transform(e,t,void 0,void 0,void 0,void 0)},e.prototype.instanceToInstance=function(e,t){return new Se(ge.CLASS_TO_CLASS,_e(_e({},Oe),t)).transform(void 0,e,void 0,void 0,void 0,void 0)},e.prototype.classToClassFromExist=function(e,t,n){return new Se(ge.CLASS_TO_CLASS,_e(_e({},Oe),n)).transform(t,e,void 0,void 0,void 0,void 0)},e.prototype.serialize=function(e,t){return JSON.stringify(this.instanceToPlain(e,t))},e.prototype.deserialize=function(e,t,n){var r=JSON.parse(t);return this.plainToInstance(e,r,n)},e.prototype.deserializeArray=function(e,t,n){var r=JSON.parse(t);return this.plainToInstance(e,r,n)},e}());var xe=function(e){this.groups=[],this.each=!1,this.context=void 0,this.type=e.type,this.name=e.name,this.target=e.target,this.propertyName=e.propertyName,this.constraints=null==e?void 0:e.constraints,this.constraintCls=e.constraintCls,this.validationTypeOptions=e.validationTypeOptions,e.validationOptions&&(this.message=e.validationOptions.message,this.groups=e.validationOptions.groups,this.always=e.validationOptions.always,this.each=e.validationOptions.each,this.context=e.validationOptions.context)},Ne=function(){function e(){}return e.prototype.transform=function(e){var t=[];return Object.keys(e.properties).forEach((function(n){e.properties[n].forEach((function(r){var a={message:r.message,groups:r.groups,always:r.always,each:r.each},o={type:r.type,name:r.name,target:e.name,propertyName:n,constraints:r.constraints,validationTypeOptions:r.options,validationOptions:a};t.push(new xe(o))}))})),t},e}();function Te(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0}function ke(e){return null!==e&&"object"==typeof e&&"function"==typeof e.then}var Ce=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Ae=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,o=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i},Le=function(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))},Pe=function(){function e(){this.validationMetadatas=new Map,this.constraintMetadatas=new Map}return Object.defineProperty(e.prototype,"hasValidationMetaData",{get:function(){return!!this.validationMetadatas.size},enumerable:!1,configurable:!0}),e.prototype.addValidationSchema=function(e){var t=this;(new Ne).transform(e).forEach((function(e){return t.addValidationMetadata(e)}))},e.prototype.addValidationMetadata=function(e){var t=this.validationMetadatas.get(e.target);t?t.push(e):this.validationMetadatas.set(e.target,[e])},e.prototype.addConstraintMetadata=function(e){var t=this.constraintMetadatas.get(e.target);t?t.push(e):this.constraintMetadatas.set(e.target,[e])},e.prototype.groupByPropertyName=function(e){var t={};return e.forEach((function(e){t[e.propertyName]||(t[e.propertyName]=[]),t[e.propertyName].push(e)})),t},e.prototype.getTargetValidationMetadatas=function(e,t,n,r,a){var o,i,s=function(e){return void 0!==e.always?e.always:(!e.groups||!e.groups.length)&&n},c=function(e){return!(!r||a&&a.length||!e.groups||!e.groups.length)},l=(this.validationMetadatas.get(e)||[]).filter((function(n){return(n.target===e||n.target===t)&&(!!s(n)||!c(n)&&(!(a&&a.length>0)||n.groups&&!!n.groups.find((function(e){return-1!==a.indexOf(e)}))))})),u=[];try{for(var p=Ce(this.validationMetadatas.entries()),f=p.next();!f.done;f=p.next()){var d=Ae(f.value,2),h=d[0],m=d[1];e.prototype instanceof h&&u.push.apply(u,Le([],Ae(m),!1))}}catch(e){o={error:e}}finally{try{f&&!f.done&&(i=p.return)&&i.call(p)}finally{if(o)throw o.error}}var y=u.filter((function(t){return"string"!=typeof t.target&&(t.target!==e&&((!(t.target instanceof Function)||e.prototype instanceof t.target)&&(!!s(t)||!c(t)&&(!(a&&a.length>0)||t.groups&&!!t.groups.find((function(e){return-1!==a.indexOf(e)}))))))})).filter((function(e){return!l.find((function(t){return t.propertyName===e.propertyName&&t.type===e.type}))}));return l.concat(y)},e.prototype.getTargetValidatorConstraints=function(e){return this.constraintMetadatas.get(e)||[]},e}();var Ie=function(){function e(){}return e.prototype.toString=function(e,t,n,r){var a=this;void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===n&&(n=""),void 0===r&&(r=!1);var o=e?"":"",i=e?"":"",s=function(e){return" - property ".concat(o).concat(n).concat(e).concat(i," has failed the following constraints: ").concat(o).concat((r?Object.values:Object.keys)(null!==(t=a.constraints)&&void 0!==t?t:{}).join(", ")).concat(i," \n");var t};if(t){var c=Number.isInteger(+this.property)?"[".concat(this.property,"]"):"".concat(n?".":"").concat(this.property);return this.constraints?s(c):this.children?this.children.map((function(t){return t.toString(e,!0,"".concat(n).concat(c),r)})).join(""):""}return"An instance of ".concat(o).concat(this.target?this.target.constructor.name:"an object").concat(i," has failed the validation:\n")+(this.constraints?s(this.property):"")+(this.children?this.children.map((function(t){return t.toString(e,!0,a.property,r)})).join(""):"")},e}(),je=function(){function e(){}return e.isValid=function(e){var t=this;return"isValid"!==e&&"getMessage"!==e&&-1!==Object.keys(this).map((function(e){return t[e]})).indexOf(e)},e.CUSTOM_VALIDATION="customValidation",e.NESTED_VALIDATION="nestedValidation",e.PROMISE_VALIDATION="promiseValidation",e.CONDITIONAL_VALIDATION="conditionalValidation",e.WHITELIST="whitelistValidation",e.IS_DEFINED="isDefined",e}();var Ve=function(){function e(){}return e.replaceMessageSpecialTokens=function(e,t){var n;return e instanceof Function?n=e(t):"string"==typeof e&&(n=e),n&&Array.isArray(t.constraints)&&t.constraints.forEach((function(e,t){n=n.replace(new RegExp("\\$constraint".concat(t+1),"g"),function(e){return Array.isArray(e)?e.join(", "):("symbol"==typeof e&&(e=e.description),"".concat(e))}(e))})),n&&void 0!==t.value&&null!==t.value&&["string","boolean","number"].includes(typeof t.value)&&(n=n.replace(/\$value/g,t.value)),n&&(n=n.replace(/\$property/g,t.property)),n&&(n=n.replace(/\$target/g,t.targetName)),n},e}(),De=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,o=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i},Fe=function(){function e(e,t){this.validator=e,this.validatorOptions=t,this.awaitingPromises=[],this.ignoreAsyncValidations=!1,this.metadataStorage=function(){var e=Te();return e.classValidatorMetadataStorage||(e.classValidatorMetadataStorage=new Pe),e.classValidatorMetadataStorage}()}return e.prototype.execute=function(e,t,n){var r,a,o=this;this.metadataStorage.hasValidationMetaData||!0!==(null===(r=this.validatorOptions)||void 0===r?void 0:r.enableDebugMessages)||console.warn("No validation metadata found. No validation will be performed. There are multiple possible reasons:\n - There may be multiple class-validator versions installed. You will need to flatten your dependencies to fix the issue.\n - This validation runs before any file with validation decorator was parsed by NodeJS.");var i=this.validatorOptions?this.validatorOptions.groups:void 0,s=this.validatorOptions&&this.validatorOptions.strictGroups||!1,c=this.validatorOptions&&this.validatorOptions.always||!1,l=void 0===(null===(a=this.validatorOptions)||void 0===a?void 0:a.forbidUnknownValues)||!1!==this.validatorOptions.forbidUnknownValues,u=this.metadataStorage.getTargetValidationMetadatas(e.constructor,t,c,s,i),p=this.metadataStorage.groupByPropertyName(u);if(this.validatorOptions&&l&&!u.length){var f=new Ie;return this.validatorOptions&&this.validatorOptions.validationError&&void 0!==this.validatorOptions.validationError.target&&!0!==this.validatorOptions.validationError.target||(f.target=e),f.value=void 0,f.property=void 0,f.children=[],f.constraints={unknownValue:"an unknown value was passed to the validate function"},void n.push(f)}this.validatorOptions&&this.validatorOptions.whitelist&&this.whitelist(e,p,n),Object.keys(p).forEach((function(t){var r=e[t],a=p[t].filter((function(e){return e.type===je.IS_DEFINED})),i=p[t].filter((function(e){return e.type!==je.IS_DEFINED&&e.type!==je.WHITELIST}));r instanceof Promise&&i.find((function(e){return e.type===je.PROMISE_VALIDATION}))?o.awaitingPromises.push(r.then((function(r){o.performValidations(e,r,t,a,i,n)}))):o.performValidations(e,r,t,a,i,n)}))},e.prototype.whitelist=function(e,t,n){var r=this,a=[];Object.keys(e).forEach((function(e){t[e]&&0!==t[e].length||a.push(e)})),a.length>0&&(this.validatorOptions&&this.validatorOptions.forbidNonWhitelisted?a.forEach((function(t){var a,o=r.generateValidationError(e,e[t],t);o.constraints=((a={})[je.WHITELIST]="property ".concat(t," should not exist"),a),o.children=void 0,n.push(o)})):a.forEach((function(t){return delete e[t]})))},e.prototype.stripEmptyErrors=function(e){var t=this;return e.filter((function(e){if(e.children&&(e.children=t.stripEmptyErrors(e.children)),0===Object.keys(e.constraints).length){if(0===e.children.length)return!1;delete e.constraints}return!0}))},e.prototype.performValidations=function(e,t,n,r,a,o){var i=a.filter((function(e){return e.type===je.CUSTOM_VALIDATION})),s=a.filter((function(e){return e.type===je.NESTED_VALIDATION})),c=a.filter((function(e){return e.type===je.CONDITIONAL_VALIDATION})),l=this.generateValidationError(e,t,n);o.push(l),this.conditionalValidations(e,t,c)&&(this.customValidations(e,t,r,l),this.mapContexts(e,t,r,l),void 0===t&&this.validatorOptions&&!0===this.validatorOptions.skipUndefinedProperties||null===t&&this.validatorOptions&&!0===this.validatorOptions.skipNullProperties||null==t&&this.validatorOptions&&!0===this.validatorOptions.skipMissingProperties||(this.customValidations(e,t,i,l),this.nestedValidations(t,s,l),this.mapContexts(e,t,a,l),this.mapContexts(e,t,i,l)))},e.prototype.generateValidationError=function(e,t,n){var r=new Ie;return this.validatorOptions&&this.validatorOptions.validationError&&void 0!==this.validatorOptions.validationError.target&&!0!==this.validatorOptions.validationError.target||(r.target=e),this.validatorOptions&&this.validatorOptions.validationError&&void 0!==this.validatorOptions.validationError.value&&!0!==this.validatorOptions.validationError.value||(r.value=t),r.property=n,r.children=[],r.constraints={},r},e.prototype.conditionalValidations=function(e,t,n){return n.map((function(n){return n.constraints[0](e,t)})).reduce((function(e,t){return e&&t}),!0)},e.prototype.customValidations=function(e,t,n,r){var a=this;n.forEach((function(n){a.metadataStorage.getTargetValidatorConstraints(n.constraintCls).forEach((function(o){if(!(o.async&&a.ignoreAsyncValidations||a.validatorOptions&&a.validatorOptions.stopAtFirstError&&Object.keys(r.constraints||{}).length>0)){var i={targetName:e.constructor?e.constructor.name:void 0,property:n.propertyName,object:e,value:t,constraints:n.constraints};if(n.each&&(Array.isArray(t)||t instanceof Set||t instanceof Map)){var s,c=((s=t)instanceof Map?Array.from(s.values()):Array.isArray(s)?s:Array.from(s)).map((function(e){return o.instance.validate(e,i)}));if(c.some((function(e){return ke(e)}))){var l=c.map((function(e){return ke(e)?e:Promise.resolve(e)})),u=Promise.all(l).then((function(i){if(!i.every((function(e){return e}))){var s=De(a.createValidationError(e,t,n,o),2),c=s[0],l=s[1];r.constraints[c]=l,n.context&&(r.contexts||(r.contexts={}),r.contexts[c]=Object.assign(r.contexts[c]||{},n.context))}}));a.awaitingPromises.push(u)}else{if(!c.every((function(e){return e}))){var p=De(a.createValidationError(e,t,n,o),2);m=p[0],y=p[1];r.constraints[m]=y}}}else{var f=o.instance.validate(t,i);if(ke(f)){var d=f.then((function(i){if(!i){var s=De(a.createValidationError(e,t,n,o),2),c=s[0],l=s[1];r.constraints[c]=l,n.context&&(r.contexts||(r.contexts={}),r.contexts[c]=Object.assign(r.contexts[c]||{},n.context))}}));a.awaitingPromises.push(d)}else if(!f){var h=De(a.createValidationError(e,t,n,o),2),m=h[0],y=h[1];r.constraints[m]=y}}}}))}))},e.prototype.nestedValidations=function(e,t,n){var r=this;void 0!==e&&t.forEach((function(a){if((a.type===je.NESTED_VALIDATION||a.type===je.PROMISE_VALIDATION)&&!(r.validatorOptions&&r.validatorOptions.stopAtFirstError&&Object.keys(n.constraints||{}).length>0))if(Array.isArray(e)||e instanceof Set||e instanceof Map)(e instanceof Set?Array.from(e):e).forEach((function(a,o){r.performValidations(e,a,o.toString(),[],t,n.children)}));else if(e instanceof Object){var o="string"==typeof a.target?a.target:a.target.name;r.execute(e,o,n.children)}else{var i=De(r.createValidationError(a.target,e,a),2),s=i[0],c=i[1];n.constraints[s]=c}}))},e.prototype.mapContexts=function(e,t,n,r){var a=this;return n.forEach((function(e){if(e.context){var t=void 0;if(e.type===je.CUSTOM_VALIDATION)t=a.metadataStorage.getTargetValidatorConstraints(e.constraintCls)[0];var n=a.getConstraintType(e,t);r.constraints[n]&&(r.contexts||(r.contexts={}),r.contexts[n]=Object.assign(r.contexts[n]||{},e.context))}}))},e.prototype.createValidationError=function(e,t,n,r){var a=e.constructor?e.constructor.name:void 0,o=this.getConstraintType(n,r),i={targetName:a,property:n.propertyName,object:e,value:t,constraints:n.constraints},s=n.message||"";return n.message||this.validatorOptions&&(!this.validatorOptions||this.validatorOptions.dismissDefaultMessages)||r&&r.instance.defaultMessage instanceof Function&&(s=r.instance.defaultMessage(i)),[o,Ve.replaceMessageSpecialTokens(s,i)]},e.prototype.getConstraintType=function(e,t){return t&&t.name?t.name:e.type},e}(),Re=function(e,t,n,r){return new(n||(n=Promise))((function(a,o){function i(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}c((r=r.apply(e,t||[])).next())}))},$e=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(i=0)),i;)try{if(n=1,r&&(a=2&s[0]?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){i.label=s[1];break}if(6===s[0]&&i.label<a[1]){i.label=a[1],a=s;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(s);break}a[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],r=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},ze=function(){function e(){}return e.prototype.validate=function(e,t,n){return this.coreValidate(e,t,n)},e.prototype.validateOrReject=function(e,t,n){return Re(this,void 0,void 0,(function(){var r;return $e(this,(function(a){switch(a.label){case 0:return[4,this.coreValidate(e,t,n)];case 1:return(r=a.sent()).length?[2,Promise.reject(r)]:[2]}}))}))},e.prototype.validateSync=function(e,t,n){var r="string"==typeof e?t:e,a="string"==typeof e?e:void 0,o=new Fe(this,"string"==typeof e?n:t);o.ignoreAsyncValidations=!0;var i=[];return o.execute(r,a,i),o.stripEmptyErrors(i)},e.prototype.coreValidate=function(e,t,n){var r="string"==typeof e?t:e,a="string"==typeof e?e:void 0,o=new Fe(this,"string"==typeof e?n:t),i=[];return o.execute(r,a,i),Promise.all(o.awaitingPromises).then((function(){return o.stripEmptyErrors(i)}))},e}(),Be=new(function(){function e(){this.instances=[]}return e.prototype.get=function(e){var t=this.instances.find((function(t){return t.type===e}));return t||(t={type:e,object:new e},this.instances.push(t)),t.object},e}());function He(e){return Be.get(e)}function Ue(e,t,n){return"string"==typeof e?He(ze).validate(e,t,n):He(ze).validate(e,t)}function We(e,t,n){return"string"==typeof e?He(ze).validateSync(e,t,n):He(ze).validateSync(e,t)}function qe(e,t,n,r){return void 0===n&&(n={}),void 0===r&&(r=""),e.reduce((function(e,n){var a=r?r+"."+n.property:n.property;if(n.constraints){var o=Object.keys(n.constraints)[0];e[a]={type:o,message:n.constraints[o]};var i=e[a];t&&i&&Object.assign(i,{types:n.constraints})}return n.children&&n.children.length&&qe(n.children,t,e,a),e}),n)}function Ke(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),function(r,a,o){try{var i=t.validator,s=(c=e,l=r,u=t.transformer,Me.plainToInstance(c,l,u));return Promise.resolve(("sync"===n.mode?We:Ue)(s,i)).then((function(e){return e.length?{values:{},errors:me(qe(e,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)}:(o.shouldUseNativeValidation&&he({},o),{values:n.raw?Object.assign({},r):s,errors:{}})}))}catch(e){return Promise.reject(e)}var c,l,u}}class Ge extends t.Component{state={hasError:!1,error:null,errorInfo:null};static getDerivedStateFromError(e){return{hasError:!0,error:e,errorInfo:null}}componentDidCatch(e,t){this.setState({error:e,errorInfo:t})}render(){return this.state.hasError?t.createElement("div",{className:"error-boundary"},t.createElement("div",{className:"error-boundary__content"},t.createElement("div",{className:"error-boundary__icon"},t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},t.createElement("circle",{cx:"12",cy:"12",r:"10"}),t.createElement("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),t.createElement("line",{x1:"12",y1:"16",x2:"12",y2:"16"}))),t.createElement("h1",null,"Oops! Something went wrong"),t.createElement("p",{className:"error-boundary__message"},this.state.error?.message||"An unexpected error occurred"),t.createElement("button",{className:"error-boundary__button",onClick:()=>window.location.reload()},"Refresh Page"),"development"===process.env.NODE_ENV&&t.createElement("details",{className:"error-boundary__details"},t.createElement("summary",null,"Error Details"),t.createElement("pre",null,this.state.error?.toString()),t.createElement("pre",null,this.state.errorInfo?.componentStack)))):this.props.children}}function Je({menu:n,getIcons:r,onLogout:a}){const[o,i]=t.useState(!0),s=e.useLocation();e.useNavigate();const c=e=>{if("/"===e)return s.pathname===e;const t=e.replace(/^\/+|\/+$/g,""),n=s.pathname.replace(/^\/+|\/+$/g,"");return n===t||n.startsWith(`${t}/`)};return t.createElement("div",{className:"sidebar "+(o?"open":"closed")},t.createElement("button",{className:"toggle-button",onClick:()=>i(!o),"aria-label":o?"Collapse sidebar":"Expand sidebar","aria-expanded":o},o?"<":">"),t.createElement("nav",{className:"nav-links"},n?.().map(((n,a)=>t.createElement(e.Link,{key:a,to:n.path,className:"nav-link "+(c(n.path)?"active":""),"aria-current":c(n.path)?"page":void 0},t.createElement("span",{className:"nav-links-icon"},r?.(n.iconType)),o?t.createElement("span",null,n.name):null)))),a&&t.createElement("div",{className:"sidebar-footer"},t.createElement("button",{className:"logout-button",onClick:()=>{a&&a("logout")},"aria-label":"Logout"},t.createElement("span",{className:"nav-links-icon"},t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M6 12H2V4H6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t.createElement("path",{d:"M10 8L14 4M14 4L10 0M14 4H6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))),o?t.createElement("span",null,"Logout"):null)))}const Ye=o.createWithEqualityFn()(a.persist((e=>({user:null})),{name:"app-store-1",storage:a.createJSONStorage((()=>localStorage)),partialize:e=>({user:e.user})}),i.shallow);exports.Cell=function(e){return(t,n)=>{const r=Reflect.getMetadata(Q,t)||[];if(Reflect.defineMetadata(Q,[...r,n.toString()],t),e){const r=`${Q.toString()}:${n.toString()}:options`;Reflect.defineMetadata(r,e,t)}}},exports.Counter=function({image:e,text:n,targetNumber:r,duration:a=2e3}){const[o,i]=t.useState(0);return t.useEffect((()=>{let e,t;const n=o=>{e||(e=o);const s=o-e,c=Math.min(s/a,1);i(Math.floor(c*r)),c<1&&(t=requestAnimationFrame(n))};return t=requestAnimationFrame(n),()=>{t&&cancelAnimationFrame(t)}}),[r,a]),t.createElement("div",{className:"counter-container"},t.createElement("div",{className:"counter-image"},e),t.createElement("div",{className:"counter-text"},n),t.createElement("div",{className:"counter-value"},o))},exports.Details=function(e){return t=>{e&&Reflect.defineMetadata(m,e,t)}},exports.DetailsItem=function(e){return(t,n)=>{const r=Reflect.getMetadata(d,t)||[];if(Reflect.defineMetadata(d,[...r,n.toString()],t),e){const r=`${d.toString()}:${n.toString()}:options`;Reflect.defineMetadata(r,e,t)}}},exports.DetailsPage=function({model:n}){const{class:r,items:a}=t.useMemo((()=>{return{class:y(e=n),items:h(e)};var e}),[n]),o=e.useParams(),[i,s]=t.useState(null),[c,u]=t.useState(null),[p,f]=t.useState(!0);return t.useEffect((()=>{r.getDetailsData(o).then((e=>{s(e)})).catch(u).finally((()=>f(!1)))}),[o,r?.getDetailsData]),c?t.createElement("div",{className:"error-container"},t.createElement(l,{error:c})):p?t.createElement("div",{className:"loading-container"},t.createElement(v,null)):t.createElement("div",{className:"details-page"},a.map((e=>t.createElement("div",{key:e.name,className:"details-item"},t.createElement("div",{className:"item-label"},e.name),t.createElement("div",{className:"item-value"},i[e.name])))))},exports.Form=function(e){return t=>{e&&Reflect.defineMetadata(pe,e,t)}},exports.FormPage=function({model:n}){const{class:a,inputs:o,resolver:i}=t.useMemo((()=>{return{resolver:Ke(e=n),class:fe(e),inputs:ue(e)};var e}),[n]),s=r.useForm({resolver:i}),c=e.useParams();return t.useEffect((()=>{a.getDetailsData&&a.getDetailsData(c).then((e=>{s.reset(e)}))}),[c,s.reset,a.getDetailsData]),t.createElement(r.FormProvider,{...s},t.createElement(ce,{inputs:o,formClass:a}))},exports.ImageCell=function(e){return function(e){return(t,n)=>{const r=Reflect.getMetadata(Q,t)||[];if(Reflect.defineMetadata(Q,[...r,n.toString()],t),e){const r=`${Q.toString()}:${n.toString()}:options`;Reflect.defineMetadata(r,e,t)}}}({...e,type:"image"})},exports.Input=function(e){return(t,n)=>{const r=Reflect.getMetadata(le,t)||[];if(Reflect.defineMetadata(le,[...r,n.toString()],t),e){const r=`${le.toString()}:${n.toString()}:options`;Reflect.defineMetadata(r,e,t)}}},exports.Layout=function({children:n,menu:r,getIcons:a,logout:o}){const{user:i}=Ye((e=>({user:e.user})));return e.useNavigate(),i||o?.("redirect"),t.createElement("div",{className:"layout"},t.createElement(Je,{onLogout:o,menu:r,getIcons:a}),t.createElement("main",{className:"content"},n))},exports.List=function(e){return t=>{e&&Reflect.defineMetadata(Z,e,t)}},exports.ListPage=function({model:n,customHeader:r}){const a=t.useMemo((()=>{return{class:ee(e=n),cells:X(e)};var e}),[n]),[o,i]=t.useState(!0),[s,c]=t.useState(null),[u,p]=t.useState(null),[f,d]=t.useState({total:0,page:0,limit:0}),[h,m]=t.useState(!1),[y,g]=t.useState(),E=e.useParams(),b=e.useNavigate(),w=t.useCallback((async(e,t)=>{i(!0);try{const n=await a.class.getData({page:e,filters:t??y??{}});c(n.data),d({total:n.total,page:n.page,limit:n.limit})}catch(e){p(e),console.error(e)}finally{i(!1)}}),[y,a.class.getData]);return t.useEffect((()=>{const e=new URLSearchParams(location.search),t={};e.forEach(((e,n)=>{t[n]=e})),g(t)}),[location.search]),t.useEffect((()=>{y&&w(parseInt(E.page)||1,y)}),[w,E.page,y,a.class.getData]),o?t.createElement(v,null):u?t.createElement(l,{error:u}):t.createElement("div",{className:"list"},t.createElement(G,{listPageMeta:a,filtered:!(!y||!Object.keys(y).length),onFilterClick:()=>m(!0),customHeader:r}),t.createElement(z,{listPageMeta:a,data:s,onRemoveItem:async()=>{await w(f.page)}}),t.createElement("div",{className:"list-footer"},t.createElement(B,{pagination:f,onPageChange:w})),t.createElement(Y,{isOpen:h,activeFilters:y,onClose:()=>m(!1),onApplyFilters:e=>{g(e);const t=new URLSearchParams;Object.entries(e).forEach((([e,n])=>{null!=n&&""!==n&&t.append(e,String(n))}));const n=t.toString(),r=`${location.pathname}${n?`?${n}`:""}`;b(r),w(1,e)},listPageMeta:a}))},exports.Login=function({onLogin:n}){const{register:a,handleSubmit:o,formState:{errors:i}}=r.useForm(),s=e.useNavigate();return t.createElement("div",{className:"login-container"},t.createElement("div",{className:"login-panel"},t.createElement("div",{className:"login-header"},t.createElement("h1",null,"Welcome Back"),t.createElement("p",null,"Please sign in to continue")),t.createElement("form",{onSubmit:o((async e=>{n.login(e.username,e.password).then((e=>{const{user:t,token:n}=e;localStorage.setItem("token",n),Ye.setState({user:t}),s("/")}))})),className:"login-form"},t.createElement(se,{input:{name:"username",label:"Username",placeholder:"Enter your username",type:"input"},register:a,error:i.username}),t.createElement(se,{input:{name:"password",label:"Password",inputType:"password",placeholder:"Enter your password",type:"input"},register:a,error:i.password}),t.createElement("div",{className:"form-actions"},t.createElement("button",{type:"submit",className:"submit-button"},"Sign In")))))},exports.Panel=function({children:e}){return t.createElement(Ge,null,e)},exports.SelectInput=function(e){return function(e){return(t,n)=>{const r=Reflect.getMetadata(le,t)||[];if(Reflect.defineMetadata(le,[...r,n.toString()],t),e){const r=`${le.toString()}:${n.toString()}:options`;Reflect.defineMetadata(r,e,t)}}}({...e,type:"select"})},exports.getInputFields=ue;
1
+ "use strict";var e=require("react-router"),t=require("react"),n=require("react-select"),r=require("react-hook-form"),a=require("zustand/middleware"),o=require("zustand/traditional"),i=require("zustand/vanilla/shallow");function s(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var c=s(t);function l({error:e}){return t.createElement("div",{className:"error-container"},t.createElement("div",{className:"error-icon"},t.createElement("i",{className:"fa fa-exclamation-circle"})),t.createElement("div",{className:"error-content"},t.createElement("h3",null,"Error Occurred"),t.createElement("p",null,(e=>{if(e instanceof Response)switch(e.status){case 400:return"Bad Request: The request was invalid or malformed.";case 401:return"Unauthorized: Please log in to access this resource.";case 404:return"Not Found: The requested resource could not be found.";case 403:return"Forbidden: You don't have permission to access this resource.";case 500:return"Internal Server Error: Something went wrong on our end.";default:return`Error ${e.status}: ${e.statusText||"Something went wrong."}`}return e?.message||"Something went wrong. Please try again later."})(e))))}var u,p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},f={};!function(){return u||(u=1,function(e){!function(){var t="object"==typeof globalThis?globalThis:"object"==typeof p?p:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(e){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(e){}}(),n=r(e);function r(e,t){return function(n,r){Object.defineProperty(e,n,{configurable:!0,writable:!0,value:r}),t&&t(n,r)}}void 0!==t.Reflect&&(n=r(t.Reflect,n)),function(e,t){var n=Object.prototype.hasOwnProperty,r="function"==typeof Symbol,a=r&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",o=r&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",i="function"==typeof Object.create,s={__proto__:[]}instanceof Array,c=!i&&!s,l={create:i?function(){return pe(Object.create(null))}:s?function(){return pe({__proto__:null})}:function(){return pe({})},has:c?function(e,t){return n.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return n.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},u=Object.getPrototypeOf(Function),p="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:ce(),f="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:le(),d="function"==typeof WeakMap?WeakMap:ue(),m=r?Symbol.for("@reflect-metadata:registry"):void 0,h=ae(),v=oe(h);function y(e,t,n,r){if(D(n)){if(!W(e))throw new TypeError;if(!G(t))throw new TypeError;return N(e,t)}if(!W(e))throw new TypeError;if(!$(t))throw new TypeError;if(!$(r)&&!D(r)&&!F(r))throw new TypeError;return F(r)&&(r=void 0),T(e,t,n=K(n),r)}function g(e,t){function n(n,r){if(!$(n))throw new TypeError;if(!D(r)&&!J(r))throw new TypeError;P(e,t,n,r)}return n}function E(e,t,n,r){if(!$(n))throw new TypeError;return D(r)||(r=K(r)),P(e,t,n,r)}function b(e,t,n){if(!$(t))throw new TypeError;return D(n)||(n=K(n)),k(e,t,n)}function w(e,t,n){if(!$(t))throw new TypeError;return D(n)||(n=K(n)),C(e,t,n)}function S(e,t,n){if(!$(t))throw new TypeError;return D(n)||(n=K(n)),A(e,t,n)}function O(e,t,n){if(!$(t))throw new TypeError;return D(n)||(n=K(n)),L(e,t,n)}function _(e,t){if(!$(e))throw new TypeError;return D(t)||(t=K(t)),I(e,t)}function M(e,t){if(!$(e))throw new TypeError;return D(t)||(t=K(t)),j(e,t)}function x(e,t,n){if(!$(t))throw new TypeError;if(D(n)||(n=K(n)),!$(t))throw new TypeError;D(n)||(n=K(n));var r=se(t,n,!1);return!D(r)&&r.OrdinaryDeleteMetadata(e,t,n)}function N(e,t){for(var n=e.length-1;n>=0;--n){var r=(0,e[n])(t);if(!D(r)&&!F(r)){if(!G(r))throw new TypeError;t=r}}return t}function T(e,t,n,r){for(var a=e.length-1;a>=0;--a){var o=(0,e[a])(t,n,r);if(!D(o)&&!F(o)){if(!$(o))throw new TypeError;r=o}}return r}function k(e,t,n){if(C(e,t,n))return!0;var r=ne(t);return!F(r)&&k(e,r,n)}function C(e,t,n){var r=se(t,n,!1);return!D(r)&&H(r.OrdinaryHasOwnMetadata(e,t,n))}function A(e,t,n){if(C(e,t,n))return L(e,t,n);var r=ne(t);return F(r)?void 0:A(e,r,n)}function L(e,t,n){var r=se(t,n,!1);if(!D(r))return r.OrdinaryGetOwnMetadata(e,t,n)}function P(e,t,n,r){se(n,r,!0).OrdinaryDefineOwnMetadata(e,t,n,r)}function I(e,t){var n=j(e,t),r=ne(e);if(null===r)return n;var a=I(r,t);if(a.length<=0)return n;if(n.length<=0)return a;for(var o=new f,i=[],s=0,c=n;s<c.length;s++){var l=c[s];o.has(l)||(o.add(l),i.push(l))}for(var u=0,p=a;u<p.length;u++){l=p[u];o.has(l)||(o.add(l),i.push(l))}return i}function j(e,t){var n=se(e,t,!1);return n?n.OrdinaryOwnMetadataKeys(e,t):[]}function V(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function D(e){return void 0===e}function F(e){return null===e}function R(e){return"symbol"==typeof e}function $(e){return"object"==typeof e?null!==e:"function"==typeof e}function z(e,t){switch(V(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var n="string",r=Q(e,a);if(void 0!==r){var o=r.call(e,n);if($(o))throw new TypeError;return o}return B(e)}function B(e,t){var n,r,a=e.toString;if(q(a)&&!$(r=a.call(e)))return r;if(q(n=e.valueOf)&&!$(r=n.call(e)))return r;throw new TypeError}function H(e){return!!e}function U(e){return""+e}function K(e){var t=z(e);return R(t)?t:U(t)}function W(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function q(e){return"function"==typeof e}function G(e){return"function"==typeof e}function J(e){switch(V(e)){case 3:case 4:return!0;default:return!1}}function Y(e,t){return e===t||e!=e&&t!=t}function Q(e,t){var n=e[t];if(null!=n){if(!q(n))throw new TypeError;return n}}function X(e){var t=Q(e,o);if(!q(t))throw new TypeError;var n=t.call(e);if(!$(n))throw new TypeError;return n}function Z(e){return e.value}function ee(e){var t=e.next();return!t.done&&t}function te(e){var t=e.return;t&&t.call(e)}function ne(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===u)return t;if(t!==u)return t;var n=e.prototype,r=n&&Object.getPrototypeOf(n);if(null==r||r===Object.prototype)return t;var a=r.constructor;return"function"!=typeof a||a===e?t:a}function re(){var e,n,r,a;D(m)||void 0===t.Reflect||m in t.Reflect||"function"!=typeof t.Reflect.defineMetadata||(e=ie(t.Reflect));var o=new d,i={registerProvider:s,getProvider:l,setProvider:h};return i;function s(t){if(!Object.isExtensible(i))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case e===t:break;case D(n):n=t;break;case n===t:break;case D(r):r=t;break;case r===t:break;default:void 0===a&&(a=new f),a.add(t)}}function c(t,o){if(!D(n)){if(n.isProviderFor(t,o))return n;if(!D(r)){if(r.isProviderFor(t,o))return n;if(!D(a))for(var i=X(a);;){var s=ee(i);if(!s)return;var c=Z(s);if(c.isProviderFor(t,o))return te(i),c}}}if(!D(e)&&e.isProviderFor(t,o))return e}function l(e,t){var n,r=o.get(e);return D(r)||(n=r.get(t)),D(n)?(D(n=c(e,t))||(D(r)&&(r=new p,o.set(e,r)),r.set(t,n)),n):n}function u(e){if(D(e))throw new TypeError;return n===e||r===e||!D(a)&&a.has(e)}function h(e,t,n){if(!u(n))throw new Error("Metadata provider not registered.");var r=l(e,t);if(r!==n){if(!D(r))return!1;var a=o.get(e);D(a)&&(a=new p,o.set(e,a)),a.set(t,n)}return!0}}function ae(){var e;return!D(m)&&$(t.Reflect)&&Object.isExtensible(t.Reflect)&&(e=t.Reflect[m]),D(e)&&(e=re()),!D(m)&&$(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,m,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}function oe(e){var t=new d,n={isProviderFor:function(e,n){var r=t.get(e);return!D(r)&&r.has(n)},OrdinaryDefineOwnMetadata:i,OrdinaryHasOwnMetadata:a,OrdinaryGetOwnMetadata:o,OrdinaryOwnMetadataKeys:s,OrdinaryDeleteMetadata:c};return h.registerProvider(n),n;function r(r,a,o){var i=t.get(r),s=!1;if(D(i)){if(!o)return;i=new p,t.set(r,i),s=!0}var c=i.get(a);if(D(c)){if(!o)return;if(c=new p,i.set(a,c),!e.setProvider(r,a,n))throw i.delete(a),s&&t.delete(r),new Error("Wrong provider for target.")}return c}function a(e,t,n){var a=r(t,n,!1);return!D(a)&&H(a.has(e))}function o(e,t,n){var a=r(t,n,!1);if(!D(a))return a.get(e)}function i(e,t,n,a){r(n,a,!0).set(e,t)}function s(e,t){var n=[],a=r(e,t,!1);if(D(a))return n;for(var o=X(a.keys()),i=0;;){var s=ee(o);if(!s)return n.length=i,n;var c=Z(s);try{n[i]=c}catch(e){try{te(o)}finally{throw e}}i++}}function c(e,n,a){var o=r(n,a,!1);if(D(o))return!1;if(!o.delete(e))return!1;if(0===o.size){var i=t.get(n);D(i)||(i.delete(a),0===i.size&&t.delete(i))}return!0}}function ie(e){var t=e.defineMetadata,n=e.hasOwnMetadata,r=e.getOwnMetadata,a=e.getOwnMetadataKeys,o=e.deleteMetadata,i=new d;return{isProviderFor:function(e,t){var n=i.get(e);return!(D(n)||!n.has(t))||!!a(e,t).length&&(D(n)&&(n=new f,i.set(e,n)),n.add(t),!0)},OrdinaryDefineOwnMetadata:t,OrdinaryHasOwnMetadata:n,OrdinaryGetOwnMetadata:r,OrdinaryOwnMetadataKeys:a,OrdinaryDeleteMetadata:o}}function se(e,t,n){var r=h.getProvider(e,t);if(!D(r))return r;if(n){if(h.setProvider(e,t,v))return v;throw new Error("Illegal state.")}}function ce(){var e={},t=[],n=function(){function e(e,t,n){this._index=0,this._keys=e,this._values=t,this._selector=n}return e.prototype["@@iterator"]=function(){return this},e.prototype[o]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var n=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:n,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}(),r=function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var n=this._find(e,!0);return this._values[n]=t,this},t.prototype.delete=function(t){var n=this._find(t,!1);if(n>=0){for(var r=this._keys.length,a=n+1;a<r;a++)this._keys[a-1]=this._keys[a],this._values[a-1]=this._values[a];return this._keys.length--,this._values.length--,Y(t,this._cacheKey)&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},t.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},t.prototype.keys=function(){return new n(this._keys,this._values,a)},t.prototype.values=function(){return new n(this._keys,this._values,i)},t.prototype.entries=function(){return new n(this._keys,this._values,s)},t.prototype["@@iterator"]=function(){return this.entries()},t.prototype[o]=function(){return this.entries()},t.prototype._find=function(e,t){if(!Y(this._cacheKey,e)){this._cacheIndex=-1;for(var n=0;n<this._keys.length;n++)if(Y(this._keys[n],e)){this._cacheIndex=n;break}}return this._cacheIndex<0&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},t}();return r;function a(e,t){return e}function i(e,t){return t}function s(e,t){return[e,t]}}function le(){return function(){function e(){this._map=new p}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.keys()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[o]=function(){return this.keys()},e}()}function ue(){var e=16,t=l.create(),r=a();return function(){function e(){this._key=a()}return e.prototype.has=function(e){var t=o(e,!1);return void 0!==t&&l.has(t,this._key)},e.prototype.get=function(e){var t=o(e,!1);return void 0!==t?l.get(t,this._key):void 0},e.prototype.set=function(e,t){return o(e,!0)[this._key]=t,this},e.prototype.delete=function(e){var t=o(e,!1);return void 0!==t&&delete t[this._key]},e.prototype.clear=function(){this._key=a()},e}();function a(){var e;do{e="@@WeakMap@@"+c()}while(l.has(t,e));return t[e]=!0,e}function o(e,t){if(!n.call(e,r)){if(!t)return;Object.defineProperty(e,r,{value:l.create()})}return e[r]}function i(e,t){for(var n=0;n<t;++n)e[n]=255*Math.random()|0;return e}function s(e){if("function"==typeof Uint8Array){var t=new Uint8Array(e);return"undefined"!=typeof crypto?crypto.getRandomValues(t):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(t):i(t,e),t}return i(new Array(e),e)}function c(){var t=s(e);t[6]=79&t[6]|64,t[8]=191&t[8]|128;for(var n="",r=0;r<e;++r){var a=t[r];4!==r&&6!==r&&8!==r||(n+="-"),a<16&&(n+="0"),n+=a.toString(16).toLowerCase()}return n}}function pe(e){return e.__=void 0,delete e.__,e}e("decorate",y),e("metadata",g),e("defineMetadata",E),e("hasMetadata",b),e("hasOwnMetadata",w),e("getMetadata",S),e("getOwnMetadata",O),e("getMetadataKeys",_),e("getOwnMetadataKeys",M),e("deleteMetadata",x)}(n,t),void 0===t.Reflect&&(t.Reflect=e)}()}(e||(e={}))),f;var e}();const d=Symbol("detailsItem");function m(e){const t=e.prototype;return(Reflect.getMetadata(d,t)||[]).map((e=>{const n=Reflect.getMetadata(`${d.toString()}:${e}:options`,t)||{};return{...n,name:n.name||e}}))}const h="DetailsMetaData";function v(e){const t=Reflect.getMetadata(h,e);if(!t)throw new Error("Details decerator should be used on class");return{...t}}function y(){return t.createElement("div",{className:"loading-screen"},t.createElement("div",{className:"loading-container"},t.createElement("div",{className:"loading-spinner"}),t.createElement("div",{className:"loading-text"},"Loading...")))}const g=()=>t.createElement("div",{className:"empty-list"},t.createElement("div",{className:"empty-list-content"},t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"64",height:"64",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},t.createElement("path",{d:"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"}),t.createElement("polyline",{points:"13 2 13 9 20 9"})),t.createElement("h3",null,"No Data Found"),t.createElement("p",null,"There are no items to display at the moment.")));var E,b;function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},w.apply(null,arguments)}var S,O,_=function(e){return c.createElement("svg",w({xmlns:"http://www.w3.org/2000/svg",width:800,height:800,viewBox:"0 0 24 24"},e),E||(E=c.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),b||(b=c.createElement("path",{d:"m21 19-5.154-5.154a7 7 0 1 0-2 2L19 21zM5 10c0-2.757 2.243-5 5-5s5 2.243 5 5-2.243 5-5 5-5-2.243-5-5"})))};function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},M.apply(null,arguments)}var x,N,T=function(e){return c.createElement("svg",M({xmlns:"http://www.w3.org/2000/svg",width:800,height:800,viewBox:"0 0 24 24"},e),S||(S=c.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),O||(O=c.createElement("path",{d:"m13 6 5 5-9.507 9.507a1.765 1.765 0 0 1-.012-2.485l-.002-.003c-.69.676-1.8.673-2.485-.013a1.763 1.763 0 0 1-.036-2.455l-.008-.008c-.694.65-1.78.64-2.456-.036zm7.586-.414-2.172-2.172a2 2 0 0 0-2.828 0L14 5l5 5 1.586-1.586c.78-.78.78-2.047 0-2.828M3 18v3h3a3 3 0 0 0-3-3"})))};function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},k.apply(null,arguments)}var C,A=function(e){return c.createElement("svg",k({xmlns:"http://www.w3.org/2000/svg",width:800,height:800,viewBox:"0 0 24 24"},e),x||(x=c.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),N||(N=c.createElement("path",{d:"M6.187 8h11.625l-.695 11.125A2 2 0 0 1 15.12 21H8.88a2 2 0 0 1-1.997-1.875zM19 5v2H5V5h3V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1zm-9 0h4V4h-4z"})))};function L(){return L=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},L.apply(null,arguments)}var P,I=function(e){return c.createElement("svg",L({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",stroke:"#000"},e),C||(C=c.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 6 9 17l-5-5"})))};function j(){return j=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},j.apply(null,arguments)}var V,D,F,R=function(e){return c.createElement("svg",j({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",stroke:"#000"},e),P||(P=c.createElement("path",{strokeLinecap:"round",strokeWidth:2,d:"m8 8 8 8m-8 0 8-8"})))};function $({value:e}){return e?t.createElement(I,{className:"icon icon-true"}):t.createElement(R,{className:"icon icon-false"})}function z({value:e}){if(!e)return t.createElement(t.Fragment,null,"-");const n=new Date(e);return t.createElement(t.Fragment,null,`${n.getDate().toString().padStart(2,"0")}/${(n.getMonth()+1).toString().padStart(2,"0")}/${n.getFullYear()} ${n.getHours().toString().padStart(2,"0")}:${n.getMinutes().toString().padStart(2,"0")}`)}function B({value:e,configuration:n}){const r=n;return e?t.createElement("img",{width:100,height:100,src:r.baseUrl+e,style:{objectFit:"contain"},alt:""}):t.createElement(t.Fragment,null,"-")}function H({value:e}){return!e||"string"!=typeof e||e.length<6?t.createElement(t.Fragment,null,"-"):t.createElement(t.Fragment,null,`${e.slice(0,3)}...${e.slice(-3)}`)}function U({value:e,configuration:n}){return t.createElement(t.Fragment,null,e?e.toString():n.placeHolder)}function K({value:e,configuration:n}){if(!e)return t.createElement(t.Fragment,null,"-");const r=(n.baseUrl||"")+e;return t.createElement("a",{href:r,download:r,className:"download-link",target:"_blank",rel:"noopener noreferrer"},"Download")}function W({configuration:e,item:n,value:r}){let a;switch(e.type){case"boolean":a=t.createElement($,{value:r});break;case"date":a=t.createElement(z,{value:r});break;case"image":a=t.createElement(B,{value:r,configuration:e});break;case"uuid":a=t.createElement(H,{value:r});break;case"download":a=t.createElement(K,{value:r,configuration:e});break;default:a=t.createElement(U,{value:r,configuration:e})}return t.createElement("td",{key:e.name},a)}function q({data:n,listPageMeta:r,onRemoveItem:a}){const o=r.cells,i=n?.[0]?"function"==typeof r.class.cells?r.class.cells?.(n[0]):r.class.cells:null;return t.createElement("div",{className:"datagrid"},n&&0!==n.length?t.createElement("table",{className:"datagrid-table"},t.createElement("thead",null,t.createElement("tr",null,o.map((e=>t.createElement("th",{key:e.name},e.title??e.name))),i?.details&&t.createElement("th",null,"Details"),i?.edit&&t.createElement("th",null,"Edit"),i?.delete&&t.createElement("th",null,"Delete"))),t.createElement("tbody",null,n.map(((n,i)=>{const s=n?"function"==typeof r.class.cells?r.class.cells?.(n):r.class.cells:null;return t.createElement("tr",{key:i},o.map((e=>{const r=n[e.name];return t.createElement(W,{key:e.name,configuration:e,item:n,value:r})})),s?.details&&t.createElement("td",null,t.createElement(e.Link,{to:s.details.path,className:"util-cell-link"},t.createElement(_,{className:"icon icon-search"}),t.createElement("span",{className:"util-cell-label"},s.details.label))),s?.edit&&t.createElement("td",null,t.createElement(e.Link,{to:s.edit.path,className:"util-cell-link"},t.createElement(T,{className:"icon icon-pencil"}),t.createElement("span",{className:"util-cell-label"},s.edit.label))),s?.delete&&t.createElement("td",null,t.createElement("a",{onClick:()=>{s.delete?.onRemoveItem?.(n).then((()=>{a?.(n)})).catch((e=>{console.error(e);const t=e instanceof Error?e.message:"Error deleting item";alert(t)}))},className:"util-cell-link util-cell-link-remove"},t.createElement(A,{className:"icon icon-trash"}),t.createElement("span",{className:"util-cell-label"},s.delete.label))))})))):t.createElement(g,null))}function G({pagination:e,onPageChange:n}){const{total:r,page:a,limit:o}=e,i=Math.floor(r/o);if(i<=1)return null;return t.createElement("div",{className:"pagination"},t.createElement("button",{onClick:()=>n(a-1),className:"pagination-item "+(1===a?"disabled":""),disabled:1===a,"aria-disabled":1===a},"Previous"),(()=>{const e=[];for(let r=1;r<=Math.min(2,i);r++)e.push(t.createElement("button",{key:r,onClick:()=>n(r),className:"pagination-item "+(a===r?"active":""),disabled:a===r},r));a-2>3&&e.push(t.createElement("span",{key:"ellipsis1",className:"pagination-ellipsis"},"..."));for(let r=Math.max(3,a-2);r<=Math.min(i-2,a+2);r++)r>2&&r<i-1&&e.push(t.createElement("button",{key:r,onClick:()=>n(r),className:"pagination-item "+(a===r?"active":""),disabled:a===r},r));a+2<i-2&&e.push(t.createElement("span",{key:"ellipsis2",className:"pagination-ellipsis"},"..."));for(let r=Math.max(i-1,3);r<=i;r++)r>2&&e.push(t.createElement("button",{key:r,onClick:()=>n(r),className:"pagination-item "+(a===r?"active":""),disabled:a===r},r));return e})(),t.createElement("button",{onClick:()=>n(a+1),className:"pagination-item "+(a===i?"disabled":""),disabled:a===i,"aria-disabled":a===i},"Next"))}function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},J.apply(null,arguments)}var Y,Q=function(e){return c.createElement("svg",J({xmlns:"http://www.w3.org/2000/svg",width:800,height:800,viewBox:"0 0 24 24"},e),V||(V=c.createElement("path",{fill:"none",d:"M0 0h24v24H0z"})),D||(D=c.createElement("path",{d:"M21 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5v2H5v14h14v-5z"})),F||(F=c.createElement("path",{d:"M21 7h-4V3h-2v4h-4v2h4v4h2V9h4"})))};function X(){return X=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},X.apply(null,arguments)}var Z=function(e){return c.createElement("svg",X({xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e),Y||(Y=c.createElement("path",{d:"M22 3H2l8 9.46V19l4 2v-8.54z"})))};function ee({listPageMeta:n,filtered:r,onFilterClick:a,customHeader:o}){const i=t.useMemo((()=>n.cells.filter((e=>!!e.filter))),[n.cells]),s=n.class.headers;return t.createElement("div",{className:"list-header"},t.createElement("div",{className:"header-title"},s?.title||"List"),o&&t.createElement("div",{className:"header-custom"},o),t.createElement("div",{className:"header-actions"},!!i.length&&t.createElement("button",{onClick:a,className:"filter-button"},t.createElement(Z,{className:"icon icon-filter "+(r?"active":"")}),"Filter"),s?.create&&t.createElement(e.Link,{to:s.create.path,className:"create-button"},t.createElement(Q,{className:"icon icon-create"}),s.create.label)))}function te({field:e,value:r,onChange:a}){if("static-select"===e.filter?.type){const o=e.filter;return t.createElement(n,{id:e.name,menuPortalTarget:document.body,styles:{control:(e,t)=>({...e,backgroundColor:"#1f2937",borderColor:t.isFocused?"#6366f1":"#374151",boxShadow:t.isFocused?"0 0 0 1px #6366f1":"none","&:hover":{borderColor:"#6366f1"},borderRadius:"6px",padding:"2px",color:"white"}),option:(e,t)=>({...e,backgroundColor:t.isSelected?"#6366f1":t.isFocused?"#374151":"#1f2937",color:"white","&:active":{backgroundColor:"#6366f1"},"&:hover":{backgroundColor:"#374151"},cursor:"pointer"}),input:e=>({...e,color:"white"}),placeholder:e=>({...e,color:"#9ca3af"}),singleValue:e=>({...e,color:"white"}),menuPortal:e=>({...e,zIndex:9999}),menu:e=>({...e,backgroundColor:"#1f2937",border:"1px solid #374151",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"}),menuList:e=>({...e,padding:"4px"}),dropdownIndicator:e=>({...e,color:"#9ca3af","&:hover":{color:"#6366f1"}}),clearIndicator:e=>({...e,color:"#9ca3af","&:hover":{color:"#6366f1"}})},value:r?{value:r,label:o.options.find((e=>e.value===r))?.label||r}:null,onChange:e=>a(e?.value||""),options:o.options.map((e=>({value:e.value,label:e.label}))),placeholder:`Filter by ${e.title||e.name}`,isClearable:!0})}return t.createElement("input",{type:"number"===e.type?"number":"text",id:e.name,value:r||"",onChange:e=>a(e.target.value),placeholder:`Filter by ${e.title||e.name}`})}function ne({isOpen:e,onClose:n,onApplyFilters:r,listPageMeta:a,activeFilters:o}){const[i,s]=t.useState(o??{}),c=t.useRef(null),l=t.useMemo((()=>a.cells.filter((e=>!!e.filter))),[a.cells]);if(t.useEffect((()=>{const t=e=>{c.current&&!c.current.contains(e.target)&&n()};return e&&document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}}),[e,n]),!e)return null;return t.createElement("div",{className:"filter-popup-overlay"},t.createElement("div",{ref:c,className:"filter-popup"},t.createElement("div",{className:"filter-popup-header"},t.createElement("h3",null,"Filter"),t.createElement("button",{onClick:n,className:"close-button"},"×")),t.createElement("div",{className:"filter-popup-content"},l.map((e=>t.createElement("div",{key:e.name,className:"filter-field"},t.createElement("label",{htmlFor:e.name},e.title||e.name),t.createElement(te,{field:e,value:i[e.name||""],onChange:t=>((e,t)=>{s((n=>({...n,[e]:t})))})(e.name||"",t)}))))),t.createElement("div",{className:"filter-popup-footer"},t.createElement("button",{onClick:n,className:"cancel-button"},"Cancel"),t.createElement("button",{onClick:()=>{r(i),n()},className:"apply-button"},"Apply Filters"))))}function re(e,t,n){return(r,a)=>{const o=a.toString(),i=Reflect.getMetadata(e,r)||[];if(t){const s=`${e.toString()}:${o}:options`,c=n?n({target:r,propertyKey:a},t):t;Reflect.defineMetadata(e,[...i,o],r),Reflect.defineMetadata(s,c,r)}else Reflect.defineMetadata(e,[...i,o],r)}}const ae=Symbol("cell"),oe=({propertyKey:e},t)=>({...t,name:t.name||e.toString(),type:t.type||"string"});function ie(e){const t=e.prototype;return(Reflect.getMetadata(ae,t)||[]).map((e=>Reflect.getMetadata(`${ae.toString()}:${e}:options`,t)||{}))}const se="ListMetaData";function ce(e){const t=Reflect.getMetadata(se,e);if(!t)throw new Error("List decerator should be used on class");return{...t}}function le(e,t){return re(ae,e,(({target:e,propertyKey:n},r)=>({...oe({propertyKey:n},r),...t?t({target:e,propertyKey:n},r):void 0})))}function ue({input:e,maxLength:n=1}){const a=r.useFormContext(),[o,i]=t.useState([]),s=e.name;t.useEffect((()=>{a.setValue(e.name+"_files",o.length>0)}),[o,a,e.name]);return t.createElement("div",{className:"uploader-container"},t.createElement("button",{type:"button",className:"uploader-button",onClick:()=>document.getElementById(s)?.click()},"Upload Files"),t.createElement("input",{id:s,hidden:!0,name:e.name,onChange:e=>{if(n>1)throw new Error("TODO: Multiple file upload is not implemented yet");const t=e.target.files;if(t){const e=Array.from(t);i((t=>[...t,...e]))}},type:"file",multiple:!0}),o.length>0&&t.createElement("div",{className:"uploader-files"},o.map(((e,n)=>t.createElement("div",{key:`${e.name}-${n}`,className:"uploader-file"},t.createElement("p",null,e.name),t.createElement("p",null,(e.size/1024/1024).toFixed(2)," MB"),t.createElement("p",null,e.type||"Unknown type"),t.createElement("button",{onClick:()=>(e=>{i((t=>t.filter(((t,n)=>n!==e))))})(n),className:"remove-file-button",type:"button"},"Remove"))))))}function pe({label:e,fieldName:n,children:r,...a}){return t.createElement("label",{...a,className:"label "+a.className},t.createElement("span",null,e?e+":":n.charAt(0).toUpperCase()+n.slice(1)+":"),r)}function fe({input:e,...n}){const{label:a,name:o}=e,i=r.useFormContext(),{register:s}=i;return t.createElement(pe,{className:"checkbox-label",htmlFor:o,label:a,fieldName:o},t.createElement("input",{type:"checkbox",id:o,className:"apple-switch",...n,...s(o,{setValueAs:e=>"on"===e})}))}const de={control:(e,t)=>({...e,backgroundColor:"#1f2937",borderColor:t.isFocused?"#6366f1":"#374151",boxShadow:t.isFocused?"0 0 0 1px #6366f1":"none","&:hover":{borderColor:"#6366f1"},borderRadius:"6px",padding:"2px",color:"white"}),option:(e,t)=>({...e,backgroundColor:t.isSelected?"#6366f1":t.isFocused?"#374151":"#1f2937",color:"white","&:active":{backgroundColor:"#6366f1"},"&:hover":{backgroundColor:"#374151"},cursor:"pointer"}),input:e=>({...e,color:"white"}),placeholder:e=>({...e,color:"#9ca3af"}),singleValue:e=>({...e,color:"white"}),menuPortal:e=>({...e,zIndex:9999}),menu:e=>({...e,backgroundColor:"#1f2937",border:"1px solid #374151",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"}),menuList:e=>({...e,padding:"4px"}),dropdownIndicator:e=>({...e,color:"#9ca3af","&:hover":{color:"#6366f1"}}),clearIndicator:e=>({...e,color:"#9ca3af","&:hover":{color:"#6366f1"}})};function me({input:e,fieldName:a}){const o=e,{control:i}=r.useFormContext(),[s,c]=t.useState(o.defaultOptions||[]),[l,u]=t.useState(0);return t.useEffect((()=>{o.onSelectPreloader&&o.onSelectPreloader().then((e=>{c(e),u(l+1)}))}),[e]),t.createElement(r.Controller,{name:a,control:i,render:({field:e})=>t.createElement(n,{key:l,options:s,styles:de,value:s.find((t=>t.value===e.value))||null,onChange:t=>{e.onChange(t?.value)}})})}function he({input:e,register:n}){const a=r.useFormContext(),o=a.getValues(e.name);return t.createElement("div",null,o?.map(((r,o)=>t.createElement("div",{key:o},e.nestedFields?.map((r=>t.createElement(ve,{key:r.name?.toString()??"",baseName:e.name+"["+o+"]",input:r,register:n,error:e.name?{message:a.formState.errors[e.name]?.message}:void 0})))))))}function ve({input:e,register:n,error:r,baseName:a,onSelectPreloader:o}){const i=(a?a.toString()+".":"")+e.name||"";return t.createElement("div",{className:"form-field"},"checkbox"!==e.type&&t.createElement(pe,{htmlFor:i,label:e.label,fieldName:i}),(()=>{switch(e.type){case"textarea":return t.createElement("textarea",{...n(i),placeholder:e.placeholder});case"select":return t.createElement(me,{input:e,fieldName:i});case"input":return t.createElement("input",{type:e.inputType,...n(i),placeholder:e.placeholder});case"file-upload":return t.createElement(ue,{input:e});case"checkbox":return t.createElement(fe,{input:e});case"hidden":return t.createElement("input",{type:"hidden",...n(i)});case"nested":return t.createElement(he,{input:e,register:n})}})(),r&&t.createElement("span",{className:"error-message"},r.message))}function ye({inputs:n,formClass:a}){const[o,i]=t.useState(null),s=t.useRef(null),c=e.useNavigate(),l=r.useFormContext();return t.createElement("div",{className:"form-wrapper"},t.createElement("form",{ref:s,onSubmit:l.handleSubmit((async e=>{try{const t="json"===a.type?e:(()=>{const t=new FormData(s.current);for(const n in e)t.get(n)||t.append(n,e[n]);return t})();await a.onSubmit(t),i(null),a.redirectBackOnSuccess&&c(-1)}catch(e){const t=e?.response?.data?.message||(e instanceof Error?e.message:"An error occurred");i(t),console.error(e)}}),((e,t)=>{console.log("error creating creation",e,t)}))},t.createElement("div",null,o&&t.createElement("div",{className:"error-message",style:{color:"red",marginBottom:"1rem"}},o),n?.map((e=>t.createElement(ve,{key:e.name||"",input:e,register:l.register,error:e.name?{message:l.formState.errors[e.name]?.message}:void 0}))),t.createElement("button",{type:"submit",className:"submit-button"},"Submit"))))}const ge=Symbol("input");function Ee(e){const t=e.prototype;return(Reflect.getMetadata(ge,t)||[]).map((e=>{const n=Reflect.getMetadata(`${ge.toString()}:${e}:options`,t)||{},r=n?.inputType??(a=e,["password"].some((e=>a.toLowerCase().includes(e)))?"password":"text");var a;return{...n,editable:n.editable??!0,sensitive:n.sensitive,name:n?.name??e,label:n?.label??e,placeholder:n?.placeholder??e,inputType:r,type:n?.type??"input",selectOptions:n?.selectOptions??[]}}))}const be="DetailsMetaData";function we(e){const t=Reflect.getMetadata(be,e);if(!t)throw new Error("Form decerator should be used on class");return{...t,type:t.type??"json",redirectBackOnSuccess:t.redirectBackOnSuccess??!0}}const Se=(e,t,n)=>{if(e&&"reportValidity"in e){const a=r.get(n,t);e.setCustomValidity(a&&a.message||""),e.reportValidity()}},Oe=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Se(r.ref,n,e):r&&r.refs&&r.refs.forEach((t=>Se(t,n,e)))}},_e=(e,t)=>{t.shouldUseNativeValidation&&Oe(e,t);const n={};for(const a in e){const o=r.get(t.fields,a),i=Object.assign(e[a]||{},{ref:o&&o.ref});if(Me(t.names||Object.keys(e),a)){const e=Object.assign({},r.get(n,a));r.set(e,"root",i),r.set(n,a,e)}else r.set(n,a,i)}return n},Me=(e,t)=>{const n=xe(t);return e.some((e=>xe(e).match(`^${n}\\.\\d+`)))};function xe(e){return e.replace(/\]|\[/g,"")}var Ne;!function(e){e[e.PLAIN_TO_CLASS=0]="PLAIN_TO_CLASS",e[e.CLASS_TO_PLAIN=1]="CLASS_TO_PLAIN",e[e.CLASS_TO_CLASS=2]="CLASS_TO_CLASS"}(Ne||(Ne={}));var Te=function(){function e(){this._typeMetadatas=new Map,this._transformMetadatas=new Map,this._exposeMetadatas=new Map,this._excludeMetadatas=new Map,this._ancestorsMap=new Map}return e.prototype.addTypeMetadata=function(e){this._typeMetadatas.has(e.target)||this._typeMetadatas.set(e.target,new Map),this._typeMetadatas.get(e.target).set(e.propertyName,e)},e.prototype.addTransformMetadata=function(e){this._transformMetadatas.has(e.target)||this._transformMetadatas.set(e.target,new Map),this._transformMetadatas.get(e.target).has(e.propertyName)||this._transformMetadatas.get(e.target).set(e.propertyName,[]),this._transformMetadatas.get(e.target).get(e.propertyName).push(e)},e.prototype.addExposeMetadata=function(e){this._exposeMetadatas.has(e.target)||this._exposeMetadatas.set(e.target,new Map),this._exposeMetadatas.get(e.target).set(e.propertyName,e)},e.prototype.addExcludeMetadata=function(e){this._excludeMetadatas.has(e.target)||this._excludeMetadatas.set(e.target,new Map),this._excludeMetadatas.get(e.target).set(e.propertyName,e)},e.prototype.findTransformMetadatas=function(e,t,n){return this.findMetadatas(this._transformMetadatas,e,t).filter((function(e){return!e.options||(!0===e.options.toClassOnly&&!0===e.options.toPlainOnly||(!0===e.options.toClassOnly?n===Ne.CLASS_TO_CLASS||n===Ne.PLAIN_TO_CLASS:!0!==e.options.toPlainOnly||n===Ne.CLASS_TO_PLAIN))}))},e.prototype.findExcludeMetadata=function(e,t){return this.findMetadata(this._excludeMetadatas,e,t)},e.prototype.findExposeMetadata=function(e,t){return this.findMetadata(this._exposeMetadatas,e,t)},e.prototype.findExposeMetadataByCustomName=function(e,t){return this.getExposedMetadatas(e).find((function(e){return e.options&&e.options.name===t}))},e.prototype.findTypeMetadata=function(e,t){return this.findMetadata(this._typeMetadatas,e,t)},e.prototype.getStrategy=function(e){var t=this._excludeMetadatas.get(e),n=t&&t.get(void 0),r=this._exposeMetadatas.get(e),a=r&&r.get(void 0);return n&&a||!n&&!a?"none":n?"excludeAll":"exposeAll"},e.prototype.getExposedMetadatas=function(e){return this.getMetadata(this._exposeMetadatas,e)},e.prototype.getExcludedMetadatas=function(e){return this.getMetadata(this._excludeMetadatas,e)},e.prototype.getExposedProperties=function(e,t){return this.getExposedMetadatas(e).filter((function(e){return!e.options||(!0===e.options.toClassOnly&&!0===e.options.toPlainOnly||(!0===e.options.toClassOnly?t===Ne.CLASS_TO_CLASS||t===Ne.PLAIN_TO_CLASS:!0!==e.options.toPlainOnly||t===Ne.CLASS_TO_PLAIN))})).map((function(e){return e.propertyName}))},e.prototype.getExcludedProperties=function(e,t){return this.getExcludedMetadatas(e).filter((function(e){return!e.options||(!0===e.options.toClassOnly&&!0===e.options.toPlainOnly||(!0===e.options.toClassOnly?t===Ne.CLASS_TO_CLASS||t===Ne.PLAIN_TO_CLASS:!0!==e.options.toPlainOnly||t===Ne.CLASS_TO_PLAIN))})).map((function(e){return e.propertyName}))},e.prototype.clear=function(){this._typeMetadatas.clear(),this._exposeMetadatas.clear(),this._excludeMetadatas.clear(),this._ancestorsMap.clear()},e.prototype.getMetadata=function(e,t){var n,r=e.get(t);r&&(n=Array.from(r.values()).filter((function(e){return void 0!==e.propertyName})));for(var a=[],o=0,i=this.getAncestors(t);o<i.length;o++){var s=i[o],c=e.get(s);if(c){var l=Array.from(c.values()).filter((function(e){return void 0!==e.propertyName}));a.push.apply(a,l)}}return a.concat(n||[])},e.prototype.findMetadata=function(e,t,n){var r=e.get(t);if(r){var a=r.get(n);if(a)return a}for(var o=0,i=this.getAncestors(t);o<i.length;o++){var s=i[o],c=e.get(s);if(c){var l=c.get(n);if(l)return l}}},e.prototype.findMetadatas=function(e,t,n){var r,a=e.get(t);a&&(r=a.get(n));for(var o=[],i=0,s=this.getAncestors(t);i<s.length;i++){var c=s[i],l=e.get(c);l&&l.has(n)&&o.push.apply(o,l.get(n))}return o.slice().reverse().concat((r||[]).slice().reverse())},e.prototype.getAncestors=function(e){if(!e)return[];if(!this._ancestorsMap.has(e)){for(var t=[],n=Object.getPrototypeOf(e.prototype.constructor);void 0!==n.prototype;n=Object.getPrototypeOf(n.prototype.constructor))t.push(n);this._ancestorsMap.set(e,t)}return this._ancestorsMap.get(e)},e}(),ke=new Te;var Ce=function(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))};var Ae=function(){function e(e,t){this.transformationType=e,this.options=t,this.recursionStack=new Set}return e.prototype.transform=function(e,t,n,r,a,o){var i,s=this;if(void 0===o&&(o=0),Array.isArray(t)||t instanceof Set){var c=r&&this.transformationType===Ne.PLAIN_TO_CLASS?function(e){var t=new e;return t instanceof Set||"push"in t?t:[]}(r):[];return t.forEach((function(t,r){var a=e?e[r]:void 0;if(s.options.enableCircularCheck&&s.isCircular(t))s.transformationType===Ne.CLASS_TO_CLASS&&(c instanceof Set?c.add(t):c.push(t));else{var i=void 0;if("function"!=typeof n&&n&&n.options&&n.options.discriminator&&n.options.discriminator.property&&n.options.discriminator.subTypes){if(s.transformationType===Ne.PLAIN_TO_CLASS){i=n.options.discriminator.subTypes.find((function(e){return e.name===t[n.options.discriminator.property]}));var l={newObject:c,object:t,property:void 0},u=n.typeFunction(l);i=void 0===i?u:i.value,n.options.keepDiscriminatorProperty||delete t[n.options.discriminator.property]}s.transformationType===Ne.CLASS_TO_CLASS&&(i=t.constructor),s.transformationType===Ne.CLASS_TO_PLAIN&&(t[n.options.discriminator.property]=n.options.discriminator.subTypes.find((function(e){return e.value===t.constructor})).name)}else i=n;var p=s.transform(a,t,i,void 0,t instanceof Map,o+1);c instanceof Set?c.add(p):c.push(p)}})),c}if(n!==String||a){if(n!==Number||a){if(n!==Boolean||a){if((n===Date||t instanceof Date)&&!a)return t instanceof Date?new Date(t.valueOf()):null==t?t:new Date(t);if(("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0).Buffer&&(n===Buffer||t instanceof Buffer)&&!a)return null==t?t:Buffer.from(t);if(null===(i=t)||"object"!=typeof i||"function"!=typeof i.then||a){if(a||null===t||"object"!=typeof t||"function"!=typeof t.then){if("object"==typeof t&&null!==t){n||t.constructor===Object||(Array.isArray(t)||t.constructor!==Array)&&(n=t.constructor),!n&&e&&(n=e.constructor),this.options.enableCircularCheck&&this.recursionStack.add(t);var l=this.getKeys(n,t,a),u=e||{};e||this.transformationType!==Ne.PLAIN_TO_CLASS&&this.transformationType!==Ne.CLASS_TO_CLASS||(u=a?new Map:n?new n:{});for(var p=function(r){if("__proto__"===r||"constructor"===r)return"continue";var i=r,s=r,c=r;if(!f.options.ignoreDecorators&&n)if(f.transformationType===Ne.PLAIN_TO_CLASS)(l=ke.findExposeMetadataByCustomName(n,r))&&(c=l.propertyName,s=l.propertyName);else if(f.transformationType===Ne.CLASS_TO_PLAIN||f.transformationType===Ne.CLASS_TO_CLASS){var l;(l=ke.findExposeMetadata(n,r))&&l.options&&l.options.name&&(s=l.options.name)}var p=void 0;p=f.transformationType===Ne.PLAIN_TO_CLASS?t[i]:t instanceof Map?t.get(i):t[i]instanceof Function?t[i]():t[i];var d=void 0,m=p instanceof Map;if(n&&a)d=n;else if(n){var h=ke.findTypeMetadata(n,c);if(h){var v={newObject:u,object:t,property:c},y=h.typeFunction?h.typeFunction(v):h.reflectedType;h.options&&h.options.discriminator&&h.options.discriminator.property&&h.options.discriminator.subTypes?t[i]instanceof Array?d=h:(f.transformationType===Ne.PLAIN_TO_CLASS&&(d=void 0===(d=h.options.discriminator.subTypes.find((function(e){if(p&&p instanceof Object&&h.options.discriminator.property in p)return e.name===p[h.options.discriminator.property]})))?y:d.value,h.options.keepDiscriminatorProperty||p&&p instanceof Object&&h.options.discriminator.property in p&&delete p[h.options.discriminator.property]),f.transformationType===Ne.CLASS_TO_CLASS&&(d=p.constructor),f.transformationType===Ne.CLASS_TO_PLAIN&&p&&(p[h.options.discriminator.property]=h.options.discriminator.subTypes.find((function(e){return e.value===p.constructor})).name)):d=y,m=m||h.reflectedType===Map}else if(f.options.targetMaps)f.options.targetMaps.filter((function(e){return e.target===n&&!!e.properties[c]})).forEach((function(e){return d=e.properties[c]}));else if(f.options.enableImplicitConversion&&f.transformationType===Ne.PLAIN_TO_CLASS){var g=Reflect.getMetadata("design:type",n.prototype,c);g&&(d=g)}}var E=Array.isArray(t[i])?f.getReflectedType(n,c):void 0,b=e?e[i]:void 0;if(u.constructor.prototype){var w=Object.getOwnPropertyDescriptor(u.constructor.prototype,s);if((f.transformationType===Ne.PLAIN_TO_CLASS||f.transformationType===Ne.CLASS_TO_CLASS)&&(w&&!w.set||u[s]instanceof Function))return"continue"}if(f.options.enableCircularCheck&&f.isCircular(p)){if(f.transformationType===Ne.CLASS_TO_CLASS){O=p;(void 0!==(O=f.applyCustomTransformations(O,n,r,t,f.transformationType))||f.options.exposeUnsetFields)&&(u instanceof Map?u.set(s,O):u[s]=O)}}else{var S=f.transformationType===Ne.PLAIN_TO_CLASS?s:r,O=void 0;f.transformationType===Ne.CLASS_TO_PLAIN?(O=t[S],O=f.applyCustomTransformations(O,n,S,t,f.transformationType),O=t[S]===O?p:O,O=f.transform(b,O,d,E,m,o+1)):void 0===p&&f.options.exposeDefaultValues?O=u[s]:(O=f.transform(b,p,d,E,m,o+1),O=f.applyCustomTransformations(O,n,S,t,f.transformationType)),(void 0!==O||f.options.exposeUnsetFields)&&(u instanceof Map?u.set(s,O):u[s]=O)}},f=this,d=0,m=l;d<m.length;d++){p(m[d])}return this.options.enableCircularCheck&&this.recursionStack.delete(t),u}return t}return t}return new Promise((function(e,r){t.then((function(t){return e(s.transform(void 0,t,n,void 0,void 0,o+1))}),r)}))}return null==t?t:Boolean(t)}return null==t?t:Number(t)}return null==t?t:String(t)},e.prototype.applyCustomTransformations=function(e,t,n,r,a){var o=this,i=ke.findTransformMetadatas(t,n,this.transformationType);return void 0!==this.options.version&&(i=i.filter((function(e){return!e.options||o.checkVersion(e.options.since,e.options.until)}))),(i=this.options.groups&&this.options.groups.length?i.filter((function(e){return!e.options||o.checkGroups(e.options.groups)})):i.filter((function(e){return!e.options||!e.options.groups||!e.options.groups.length}))).forEach((function(t){e=t.transformFn({value:e,key:n,obj:r,type:a,options:o.options})})),e},e.prototype.isCircular=function(e){return this.recursionStack.has(e)},e.prototype.getReflectedType=function(e,t){if(e){var n=ke.findTypeMetadata(e,t);return n?n.reflectedType:void 0}},e.prototype.getKeys=function(e,t,n){var r=this,a=ke.getStrategy(e);"none"===a&&(a=this.options.strategy||"exposeAll");var o=[];if(("exposeAll"===a||n)&&(o=t instanceof Map?Array.from(t.keys()):Object.keys(t)),n)return o;if(this.options.ignoreDecorators&&this.options.excludeExtraneousValues&&e){var i=ke.getExposedProperties(e,this.transformationType),s=ke.getExcludedProperties(e,this.transformationType);o=Ce(Ce([],i,!0),s,!0)}if(!this.options.ignoreDecorators&&e){i=ke.getExposedProperties(e,this.transformationType);this.transformationType===Ne.PLAIN_TO_CLASS&&(i=i.map((function(t){var n=ke.findExposeMetadata(e,t);return n&&n.options&&n.options.name?n.options.name:t}))),o=this.options.excludeExtraneousValues?i:o.concat(i);var c=ke.getExcludedProperties(e,this.transformationType);c.length>0&&(o=o.filter((function(e){return!c.includes(e)}))),void 0!==this.options.version&&(o=o.filter((function(t){var n=ke.findExposeMetadata(e,t);return!n||!n.options||r.checkVersion(n.options.since,n.options.until)}))),o=this.options.groups&&this.options.groups.length?o.filter((function(t){var n=ke.findExposeMetadata(e,t);return!n||!n.options||r.checkGroups(n.options.groups)})):o.filter((function(t){var n=ke.findExposeMetadata(e,t);return!(n&&n.options&&n.options.groups&&n.options.groups.length)}))}return this.options.excludePrefixes&&this.options.excludePrefixes.length&&(o=o.filter((function(e){return r.options.excludePrefixes.every((function(t){return e.substr(0,t.length)!==t}))}))),o=o.filter((function(e,t,n){return n.indexOf(e)===t}))},e.prototype.checkVersion=function(e,t){var n=!0;return n&&e&&(n=this.options.version>=e),n&&t&&(n=this.options.version<t),n},e.prototype.checkGroups=function(e){return!e||this.options.groups.some((function(t){return e.includes(t)}))},e}(),Le={enableCircularCheck:!1,enableImplicitConversion:!1,excludeExtraneousValues:!1,excludePrefixes:void 0,exposeDefaultValues:!1,exposeUnsetFields:!0,groups:void 0,ignoreDecorators:!1,strategy:void 0,targetMaps:void 0,version:void 0},Pe=function(){return Pe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},Pe.apply(this,arguments)},Ie=new(function(){function e(){}return e.prototype.instanceToPlain=function(e,t){return new Ae(Ne.CLASS_TO_PLAIN,Pe(Pe({},Le),t)).transform(void 0,e,void 0,void 0,void 0,void 0)},e.prototype.classToPlainFromExist=function(e,t,n){return new Ae(Ne.CLASS_TO_PLAIN,Pe(Pe({},Le),n)).transform(t,e,void 0,void 0,void 0,void 0)},e.prototype.plainToInstance=function(e,t,n){return new Ae(Ne.PLAIN_TO_CLASS,Pe(Pe({},Le),n)).transform(void 0,t,e,void 0,void 0,void 0)},e.prototype.plainToClassFromExist=function(e,t,n){return new Ae(Ne.PLAIN_TO_CLASS,Pe(Pe({},Le),n)).transform(e,t,void 0,void 0,void 0,void 0)},e.prototype.instanceToInstance=function(e,t){return new Ae(Ne.CLASS_TO_CLASS,Pe(Pe({},Le),t)).transform(void 0,e,void 0,void 0,void 0,void 0)},e.prototype.classToClassFromExist=function(e,t,n){return new Ae(Ne.CLASS_TO_CLASS,Pe(Pe({},Le),n)).transform(t,e,void 0,void 0,void 0,void 0)},e.prototype.serialize=function(e,t){return JSON.stringify(this.instanceToPlain(e,t))},e.prototype.deserialize=function(e,t,n){var r=JSON.parse(t);return this.plainToInstance(e,r,n)},e.prototype.deserializeArray=function(e,t,n){var r=JSON.parse(t);return this.plainToInstance(e,r,n)},e}());var je=function(e){this.groups=[],this.each=!1,this.context=void 0,this.type=e.type,this.name=e.name,this.target=e.target,this.propertyName=e.propertyName,this.constraints=null==e?void 0:e.constraints,this.constraintCls=e.constraintCls,this.validationTypeOptions=e.validationTypeOptions,e.validationOptions&&(this.message=e.validationOptions.message,this.groups=e.validationOptions.groups,this.always=e.validationOptions.always,this.each=e.validationOptions.each,this.context=e.validationOptions.context)},Ve=function(){function e(){}return e.prototype.transform=function(e){var t=[];return Object.keys(e.properties).forEach((function(n){e.properties[n].forEach((function(r){var a={message:r.message,groups:r.groups,always:r.always,each:r.each},o={type:r.type,name:r.name,target:e.name,propertyName:n,constraints:r.constraints,validationTypeOptions:r.options,validationOptions:a};t.push(new je(o))}))})),t},e}();function De(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0}function Fe(e){return null!==e&&"object"==typeof e&&"function"==typeof e.then}var Re=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},$e=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,o=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i},ze=function(e,t,n){if(n||2===arguments.length)for(var r,a=0,o=t.length;a<o;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))},Be=function(){function e(){this.validationMetadatas=new Map,this.constraintMetadatas=new Map}return Object.defineProperty(e.prototype,"hasValidationMetaData",{get:function(){return!!this.validationMetadatas.size},enumerable:!1,configurable:!0}),e.prototype.addValidationSchema=function(e){var t=this;(new Ve).transform(e).forEach((function(e){return t.addValidationMetadata(e)}))},e.prototype.addValidationMetadata=function(e){var t=this.validationMetadatas.get(e.target);t?t.push(e):this.validationMetadatas.set(e.target,[e])},e.prototype.addConstraintMetadata=function(e){var t=this.constraintMetadatas.get(e.target);t?t.push(e):this.constraintMetadatas.set(e.target,[e])},e.prototype.groupByPropertyName=function(e){var t={};return e.forEach((function(e){t[e.propertyName]||(t[e.propertyName]=[]),t[e.propertyName].push(e)})),t},e.prototype.getTargetValidationMetadatas=function(e,t,n,r,a){var o,i,s=function(e){return void 0!==e.always?e.always:(!e.groups||!e.groups.length)&&n},c=function(e){return!(!r||a&&a.length||!e.groups||!e.groups.length)},l=(this.validationMetadatas.get(e)||[]).filter((function(n){return(n.target===e||n.target===t)&&(!!s(n)||!c(n)&&(!(a&&a.length>0)||n.groups&&!!n.groups.find((function(e){return-1!==a.indexOf(e)}))))})),u=[];try{for(var p=Re(this.validationMetadatas.entries()),f=p.next();!f.done;f=p.next()){var d=$e(f.value,2),m=d[0],h=d[1];e.prototype instanceof m&&u.push.apply(u,ze([],$e(h),!1))}}catch(e){o={error:e}}finally{try{f&&!f.done&&(i=p.return)&&i.call(p)}finally{if(o)throw o.error}}var v=u.filter((function(t){return"string"!=typeof t.target&&(t.target!==e&&((!(t.target instanceof Function)||e.prototype instanceof t.target)&&(!!s(t)||!c(t)&&(!(a&&a.length>0)||t.groups&&!!t.groups.find((function(e){return-1!==a.indexOf(e)}))))))})).filter((function(e){return!l.find((function(t){return t.propertyName===e.propertyName&&t.type===e.type}))}));return l.concat(v)},e.prototype.getTargetValidatorConstraints=function(e){return this.constraintMetadatas.get(e)||[]},e}();var He=function(){function e(){}return e.prototype.toString=function(e,t,n,r){var a=this;void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===n&&(n=""),void 0===r&&(r=!1);var o=e?"":"",i=e?"":"",s=function(e){return" - property ".concat(o).concat(n).concat(e).concat(i," has failed the following constraints: ").concat(o).concat((r?Object.values:Object.keys)(null!==(t=a.constraints)&&void 0!==t?t:{}).join(", ")).concat(i," \n");var t};if(t){var c=Number.isInteger(+this.property)?"[".concat(this.property,"]"):"".concat(n?".":"").concat(this.property);return this.constraints?s(c):this.children?this.children.map((function(t){return t.toString(e,!0,"".concat(n).concat(c),r)})).join(""):""}return"An instance of ".concat(o).concat(this.target?this.target.constructor.name:"an object").concat(i," has failed the validation:\n")+(this.constraints?s(this.property):"")+(this.children?this.children.map((function(t){return t.toString(e,!0,a.property,r)})).join(""):"")},e}(),Ue=function(){function e(){}return e.isValid=function(e){var t=this;return"isValid"!==e&&"getMessage"!==e&&-1!==Object.keys(this).map((function(e){return t[e]})).indexOf(e)},e.CUSTOM_VALIDATION="customValidation",e.NESTED_VALIDATION="nestedValidation",e.PROMISE_VALIDATION="promiseValidation",e.CONDITIONAL_VALIDATION="conditionalValidation",e.WHITELIST="whitelistValidation",e.IS_DEFINED="isDefined",e}();var Ke=function(){function e(){}return e.replaceMessageSpecialTokens=function(e,t){var n;return e instanceof Function?n=e(t):"string"==typeof e&&(n=e),n&&Array.isArray(t.constraints)&&t.constraints.forEach((function(e,t){n=n.replace(new RegExp("\\$constraint".concat(t+1),"g"),function(e){return Array.isArray(e)?e.join(", "):("symbol"==typeof e&&(e=e.description),"".concat(e))}(e))})),n&&void 0!==t.value&&null!==t.value&&["string","boolean","number"].includes(typeof t.value)&&(n=n.replace(/\$value/g,t.value)),n&&(n=n.replace(/\$property/g,t.property)),n&&(n=n.replace(/\$target/g,t.targetName)),n},e}(),We=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,o=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i},qe=function(){function e(e,t){this.validator=e,this.validatorOptions=t,this.awaitingPromises=[],this.ignoreAsyncValidations=!1,this.metadataStorage=function(){var e=De();return e.classValidatorMetadataStorage||(e.classValidatorMetadataStorage=new Be),e.classValidatorMetadataStorage}()}return e.prototype.execute=function(e,t,n){var r,a,o=this;this.metadataStorage.hasValidationMetaData||!0!==(null===(r=this.validatorOptions)||void 0===r?void 0:r.enableDebugMessages)||console.warn("No validation metadata found. No validation will be performed. There are multiple possible reasons:\n - There may be multiple class-validator versions installed. You will need to flatten your dependencies to fix the issue.\n - This validation runs before any file with validation decorator was parsed by NodeJS.");var i=this.validatorOptions?this.validatorOptions.groups:void 0,s=this.validatorOptions&&this.validatorOptions.strictGroups||!1,c=this.validatorOptions&&this.validatorOptions.always||!1,l=void 0===(null===(a=this.validatorOptions)||void 0===a?void 0:a.forbidUnknownValues)||!1!==this.validatorOptions.forbidUnknownValues,u=this.metadataStorage.getTargetValidationMetadatas(e.constructor,t,c,s,i),p=this.metadataStorage.groupByPropertyName(u);if(this.validatorOptions&&l&&!u.length){var f=new He;return this.validatorOptions&&this.validatorOptions.validationError&&void 0!==this.validatorOptions.validationError.target&&!0!==this.validatorOptions.validationError.target||(f.target=e),f.value=void 0,f.property=void 0,f.children=[],f.constraints={unknownValue:"an unknown value was passed to the validate function"},void n.push(f)}this.validatorOptions&&this.validatorOptions.whitelist&&this.whitelist(e,p,n),Object.keys(p).forEach((function(t){var r=e[t],a=p[t].filter((function(e){return e.type===Ue.IS_DEFINED})),i=p[t].filter((function(e){return e.type!==Ue.IS_DEFINED&&e.type!==Ue.WHITELIST}));r instanceof Promise&&i.find((function(e){return e.type===Ue.PROMISE_VALIDATION}))?o.awaitingPromises.push(r.then((function(r){o.performValidations(e,r,t,a,i,n)}))):o.performValidations(e,r,t,a,i,n)}))},e.prototype.whitelist=function(e,t,n){var r=this,a=[];Object.keys(e).forEach((function(e){t[e]&&0!==t[e].length||a.push(e)})),a.length>0&&(this.validatorOptions&&this.validatorOptions.forbidNonWhitelisted?a.forEach((function(t){var a,o=r.generateValidationError(e,e[t],t);o.constraints=((a={})[Ue.WHITELIST]="property ".concat(t," should not exist"),a),o.children=void 0,n.push(o)})):a.forEach((function(t){return delete e[t]})))},e.prototype.stripEmptyErrors=function(e){var t=this;return e.filter((function(e){if(e.children&&(e.children=t.stripEmptyErrors(e.children)),0===Object.keys(e.constraints).length){if(0===e.children.length)return!1;delete e.constraints}return!0}))},e.prototype.performValidations=function(e,t,n,r,a,o){var i=a.filter((function(e){return e.type===Ue.CUSTOM_VALIDATION})),s=a.filter((function(e){return e.type===Ue.NESTED_VALIDATION})),c=a.filter((function(e){return e.type===Ue.CONDITIONAL_VALIDATION})),l=this.generateValidationError(e,t,n);o.push(l),this.conditionalValidations(e,t,c)&&(this.customValidations(e,t,r,l),this.mapContexts(e,t,r,l),void 0===t&&this.validatorOptions&&!0===this.validatorOptions.skipUndefinedProperties||null===t&&this.validatorOptions&&!0===this.validatorOptions.skipNullProperties||null==t&&this.validatorOptions&&!0===this.validatorOptions.skipMissingProperties||(this.customValidations(e,t,i,l),this.nestedValidations(t,s,l),this.mapContexts(e,t,a,l),this.mapContexts(e,t,i,l)))},e.prototype.generateValidationError=function(e,t,n){var r=new He;return this.validatorOptions&&this.validatorOptions.validationError&&void 0!==this.validatorOptions.validationError.target&&!0!==this.validatorOptions.validationError.target||(r.target=e),this.validatorOptions&&this.validatorOptions.validationError&&void 0!==this.validatorOptions.validationError.value&&!0!==this.validatorOptions.validationError.value||(r.value=t),r.property=n,r.children=[],r.constraints={},r},e.prototype.conditionalValidations=function(e,t,n){return n.map((function(n){return n.constraints[0](e,t)})).reduce((function(e,t){return e&&t}),!0)},e.prototype.customValidations=function(e,t,n,r){var a=this;n.forEach((function(n){a.metadataStorage.getTargetValidatorConstraints(n.constraintCls).forEach((function(o){if(!(o.async&&a.ignoreAsyncValidations||a.validatorOptions&&a.validatorOptions.stopAtFirstError&&Object.keys(r.constraints||{}).length>0)){var i={targetName:e.constructor?e.constructor.name:void 0,property:n.propertyName,object:e,value:t,constraints:n.constraints};if(n.each&&(Array.isArray(t)||t instanceof Set||t instanceof Map)){var s,c=((s=t)instanceof Map?Array.from(s.values()):Array.isArray(s)?s:Array.from(s)).map((function(e){return o.instance.validate(e,i)}));if(c.some((function(e){return Fe(e)}))){var l=c.map((function(e){return Fe(e)?e:Promise.resolve(e)})),u=Promise.all(l).then((function(i){if(!i.every((function(e){return e}))){var s=We(a.createValidationError(e,t,n,o),2),c=s[0],l=s[1];r.constraints[c]=l,n.context&&(r.contexts||(r.contexts={}),r.contexts[c]=Object.assign(r.contexts[c]||{},n.context))}}));a.awaitingPromises.push(u)}else{if(!c.every((function(e){return e}))){var p=We(a.createValidationError(e,t,n,o),2);h=p[0],v=p[1];r.constraints[h]=v}}}else{var f=o.instance.validate(t,i);if(Fe(f)){var d=f.then((function(i){if(!i){var s=We(a.createValidationError(e,t,n,o),2),c=s[0],l=s[1];r.constraints[c]=l,n.context&&(r.contexts||(r.contexts={}),r.contexts[c]=Object.assign(r.contexts[c]||{},n.context))}}));a.awaitingPromises.push(d)}else if(!f){var m=We(a.createValidationError(e,t,n,o),2),h=m[0],v=m[1];r.constraints[h]=v}}}}))}))},e.prototype.nestedValidations=function(e,t,n){var r=this;void 0!==e&&t.forEach((function(a){if((a.type===Ue.NESTED_VALIDATION||a.type===Ue.PROMISE_VALIDATION)&&!(r.validatorOptions&&r.validatorOptions.stopAtFirstError&&Object.keys(n.constraints||{}).length>0))if(Array.isArray(e)||e instanceof Set||e instanceof Map)(e instanceof Set?Array.from(e):e).forEach((function(a,o){r.performValidations(e,a,o.toString(),[],t,n.children)}));else if(e instanceof Object){var o="string"==typeof a.target?a.target:a.target.name;r.execute(e,o,n.children)}else{var i=We(r.createValidationError(a.target,e,a),2),s=i[0],c=i[1];n.constraints[s]=c}}))},e.prototype.mapContexts=function(e,t,n,r){var a=this;return n.forEach((function(e){if(e.context){var t=void 0;if(e.type===Ue.CUSTOM_VALIDATION)t=a.metadataStorage.getTargetValidatorConstraints(e.constraintCls)[0];var n=a.getConstraintType(e,t);r.constraints[n]&&(r.contexts||(r.contexts={}),r.contexts[n]=Object.assign(r.contexts[n]||{},e.context))}}))},e.prototype.createValidationError=function(e,t,n,r){var a=e.constructor?e.constructor.name:void 0,o=this.getConstraintType(n,r),i={targetName:a,property:n.propertyName,object:e,value:t,constraints:n.constraints},s=n.message||"";return n.message||this.validatorOptions&&(!this.validatorOptions||this.validatorOptions.dismissDefaultMessages)||r&&r.instance.defaultMessage instanceof Function&&(s=r.instance.defaultMessage(i)),[o,Ke.replaceMessageSpecialTokens(s,i)]},e.prototype.getConstraintType=function(e,t){return t&&t.name?t.name:e.type},e}(),Ge=function(e,t,n,r){return new(n||(n=Promise))((function(a,o){function i(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}c((r=r.apply(e,t||[])).next())}))},Je=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(i=0)),i;)try{if(n=1,r&&(a=2&s[0]?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,r=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){i.label=s[1];break}if(6===s[0]&&i.label<a[1]){i.label=a[1],a=s;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(s);break}a[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],r=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},Ye=function(){function e(){}return e.prototype.validate=function(e,t,n){return this.coreValidate(e,t,n)},e.prototype.validateOrReject=function(e,t,n){return Ge(this,void 0,void 0,(function(){var r;return Je(this,(function(a){switch(a.label){case 0:return[4,this.coreValidate(e,t,n)];case 1:return(r=a.sent()).length?[2,Promise.reject(r)]:[2]}}))}))},e.prototype.validateSync=function(e,t,n){var r="string"==typeof e?t:e,a="string"==typeof e?e:void 0,o=new qe(this,"string"==typeof e?n:t);o.ignoreAsyncValidations=!0;var i=[];return o.execute(r,a,i),o.stripEmptyErrors(i)},e.prototype.coreValidate=function(e,t,n){var r="string"==typeof e?t:e,a="string"==typeof e?e:void 0,o=new qe(this,"string"==typeof e?n:t),i=[];return o.execute(r,a,i),Promise.all(o.awaitingPromises).then((function(){return o.stripEmptyErrors(i)}))},e}(),Qe=new(function(){function e(){this.instances=[]}return e.prototype.get=function(e){var t=this.instances.find((function(t){return t.type===e}));return t||(t={type:e,object:new e},this.instances.push(t)),t.object},e}());function Xe(e){return Qe.get(e)}function Ze(e,t,n){return"string"==typeof e?Xe(Ye).validate(e,t,n):Xe(Ye).validate(e,t)}function et(e,t,n){return"string"==typeof e?Xe(Ye).validateSync(e,t,n):Xe(Ye).validateSync(e,t)}function tt(e,t,n,r){return void 0===n&&(n={}),void 0===r&&(r=""),e.reduce((function(e,n){var a=r?r+"."+n.property:n.property;if(n.constraints){var o=Object.keys(n.constraints)[0];e[a]={type:o,message:n.constraints[o]};var i=e[a];t&&i&&Object.assign(i,{types:n.constraints})}return n.children&&n.children.length&&tt(n.children,t,e,a),e}),n)}function nt(e,t,n){return void 0===t&&(t={}),void 0===n&&(n={}),function(r,a,o){try{var i=t.validator,s=(c=e,l=r,u=t.transformer,Ie.plainToInstance(c,l,u));return Promise.resolve(("sync"===n.mode?et:Ze)(s,i)).then((function(e){return e.length?{values:{},errors:_e(tt(e,!o.shouldUseNativeValidation&&"all"===o.criteriaMode),o)}:(o.shouldUseNativeValidation&&Oe({},o),{values:n.raw?Object.assign({},r):s,errors:{}})}))}catch(e){return Promise.reject(e)}var c,l,u}}class rt extends t.Component{state={hasError:!1,error:null,errorInfo:null};static getDerivedStateFromError(e){return{hasError:!0,error:e,errorInfo:null}}componentDidCatch(e,t){this.setState({error:e,errorInfo:t})}render(){return this.state.hasError?t.createElement("div",{className:"error-boundary"},t.createElement("div",{className:"error-boundary__content"},t.createElement("div",{className:"error-boundary__icon"},t.createElement("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},t.createElement("circle",{cx:"12",cy:"12",r:"10"}),t.createElement("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),t.createElement("line",{x1:"12",y1:"16",x2:"12",y2:"16"}))),t.createElement("h1",null,"Oops! Something went wrong"),t.createElement("p",{className:"error-boundary__message"},this.state.error?.message||"An unexpected error occurred"),t.createElement("button",{className:"error-boundary__button",onClick:()=>window.location.reload()},"Refresh Page"),"development"===process.env.NODE_ENV&&t.createElement("details",{className:"error-boundary__details"},t.createElement("summary",null,"Error Details"),t.createElement("pre",null,this.state.error?.toString()),t.createElement("pre",null,this.state.errorInfo?.componentStack)))):this.props.children}}function at({menu:n,getIcons:r,onLogout:a}){const[o,i]=t.useState(!0),s=e.useLocation();e.useNavigate();const c=e=>{if("/"===e)return s.pathname===e;const t=e.replace(/^\/+|\/+$/g,""),n=s.pathname.replace(/^\/+|\/+$/g,"");return n===t||n.startsWith(`${t}/`)};return t.createElement("div",{className:"sidebar "+(o?"open":"closed")},t.createElement("button",{className:"toggle-button",onClick:()=>i(!o),"aria-label":o?"Collapse sidebar":"Expand sidebar","aria-expanded":o},o?"<":">"),t.createElement("nav",{className:"nav-links"},n?.().map(((n,a)=>t.createElement(e.Link,{key:a,to:n.path,className:"nav-link "+(c(n.path)?"active":""),"aria-current":c(n.path)?"page":void 0},t.createElement("span",{className:"nav-links-icon"},r?.(n.iconType)),o?t.createElement("span",null,n.name):null)))),a&&t.createElement("div",{className:"sidebar-footer"},t.createElement("button",{className:"logout-button",onClick:()=>{a&&a("logout")},"aria-label":"Logout"},t.createElement("span",{className:"nav-links-icon"},t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M6 12H2V4H6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t.createElement("path",{d:"M10 8L14 4M14 4L10 0M14 4H6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))),o?t.createElement("span",null,"Logout"):null)))}const ot=o.createWithEqualityFn()(a.persist((e=>({user:null})),{name:"app-store-1",storage:a.createJSONStorage((()=>localStorage)),partialize:e=>({user:e.user})}),i.shallow);exports.Cell=function(e){return re(ae,e,oe)},exports.Counter=function({image:e,text:n,targetNumber:r,duration:a=2e3}){const[o,i]=t.useState(0);return t.useEffect((()=>{let e,t;const n=o=>{e||(e=o);const s=o-e,c=Math.min(s/a,1);i(Math.floor(c*r)),c<1&&(t=requestAnimationFrame(n))};return t=requestAnimationFrame(n),()=>{t&&cancelAnimationFrame(t)}}),[r,a]),t.createElement("div",{className:"counter-container"},t.createElement("div",{className:"counter-image"},e),t.createElement("div",{className:"counter-text"},n),t.createElement("div",{className:"counter-value"},o))},exports.Details=function(e){return t=>{e&&Reflect.defineMetadata(h,e,t)}},exports.DetailsItem=function(e){return(t,n)=>{const r=Reflect.getMetadata(d,t)||[];if(Reflect.defineMetadata(d,[...r,n.toString()],t),e){const r=`${d.toString()}:${n.toString()}:options`;Reflect.defineMetadata(r,e,t)}}},exports.DetailsPage=function({model:n}){const{class:r,items:a}=t.useMemo((()=>{return{class:v(e=n),items:m(e)};var e}),[n]),o=e.useParams(),[i,s]=t.useState(null),[c,u]=t.useState(null),[p,f]=t.useState(!0);return t.useEffect((()=>{r.getDetailsData(o).then((e=>{s(e)})).catch(u).finally((()=>f(!1)))}),[o,r?.getDetailsData]),c?t.createElement("div",{className:"error-container"},t.createElement(l,{error:c})):p?t.createElement("div",{className:"loading-container"},t.createElement(y,null)):t.createElement("div",{className:"details-page"},a.map((e=>t.createElement("div",{key:e.name,className:"details-item"},t.createElement("div",{className:"item-label"},e.name),t.createElement("div",{className:"item-value"},i[e.name])))))},exports.DownloadCell=function(e){return le(e,((e,t)=>({...t,type:"download"})))},exports.Form=function(e){return t=>{e&&Reflect.defineMetadata(be,e,t)}},exports.FormPage=function({model:n}){const{class:a,inputs:o,resolver:i}=t.useMemo((()=>{return{resolver:nt(e=n),class:we(e),inputs:Ee(e)};var e}),[n]),s=r.useForm({resolver:i}),c=e.useParams();return t.useEffect((()=>{a.getDetailsData&&a.getDetailsData(c).then((e=>{s.reset(e)}))}),[c,s.reset,a.getDetailsData]),t.createElement(r.FormProvider,{...s},t.createElement(ye,{inputs:o,formClass:a}))},exports.ImageCell=function(e){return le(e,((e,t)=>({...t,type:"image"})))},exports.Input=function(e){return(t,n)=>{const r=Reflect.getMetadata(ge,t)||[];if(Reflect.defineMetadata(ge,[...r,n.toString()],t),e){const r=`${ge.toString()}:${n.toString()}:options`;Reflect.defineMetadata(r,e,t)}}},exports.Layout=function({children:n,menu:r,getIcons:a,logout:o}){const{user:i}=ot((e=>({user:e.user})));return e.useNavigate(),i||o?.("redirect"),t.createElement("div",{className:"layout"},t.createElement(at,{onLogout:o,menu:r,getIcons:a}),t.createElement("main",{className:"content"},n))},exports.List=function(e){return t=>{e&&Reflect.defineMetadata(se,e,t)}},exports.ListPage=function({model:n,customHeader:r}){const a=t.useMemo((()=>{return{class:ce(e=n),cells:ie(e)};var e}),[n]),[o,i]=t.useState(!0),[s,c]=t.useState(null),[u,p]=t.useState(null),[f,d]=t.useState({total:0,page:0,limit:0}),[m,h]=t.useState(!1),[v,g]=t.useState(),E=e.useParams(),b=e.useNavigate(),w=t.useCallback((async(e,t)=>{i(!0);try{const n=await a.class.getData({page:e,filters:t??v??{}});c(n.data),d({total:n.total,page:n.page,limit:n.limit})}catch(e){p(e),console.error(e)}finally{i(!1)}}),[v,a.class.getData]);return t.useEffect((()=>{const e=new URLSearchParams(location.search),t={};e.forEach(((e,n)=>{t[n]=e})),g(t)}),[location.search]),t.useEffect((()=>{v&&w(parseInt(E.page)||1,v)}),[w,E.page,v,a.class.getData]),o?t.createElement(y,null):u?t.createElement(l,{error:u}):t.createElement("div",{className:"list"},t.createElement(ee,{listPageMeta:a,filtered:!(!v||!Object.keys(v).length),onFilterClick:()=>h(!0),customHeader:r}),t.createElement(q,{listPageMeta:a,data:s,onRemoveItem:async()=>{await w(f.page)}}),t.createElement("div",{className:"list-footer"},t.createElement(G,{pagination:f,onPageChange:w})),t.createElement(ne,{isOpen:m,activeFilters:v,onClose:()=>h(!1),onApplyFilters:e=>{g(e);const t=new URLSearchParams;Object.entries(e).forEach((([e,n])=>{null!=n&&""!==n&&t.append(e,String(n))}));const n=t.toString(),r=`${location.pathname}${n?`?${n}`:""}`;b(r),w(1,e)},listPageMeta:a}))},exports.Login=function({onLogin:n}){const{register:a,handleSubmit:o,formState:{errors:i}}=r.useForm(),s=e.useNavigate();return t.createElement("div",{className:"login-container"},t.createElement("div",{className:"login-panel"},t.createElement("div",{className:"login-header"},t.createElement("h1",null,"Welcome Back"),t.createElement("p",null,"Please sign in to continue")),t.createElement("form",{onSubmit:o((async e=>{n.login(e.username,e.password).then((e=>{const{user:t,token:n}=e;localStorage.setItem("token",n),ot.setState({user:t}),s("/")}))})),className:"login-form"},t.createElement(ve,{input:{name:"username",label:"Username",placeholder:"Enter your username",type:"input"},register:a,error:i.username}),t.createElement(ve,{input:{name:"password",label:"Password",inputType:"password",placeholder:"Enter your password",type:"input"},register:a,error:i.password}),t.createElement("div",{className:"form-actions"},t.createElement("button",{type:"submit",className:"submit-button"},"Sign In")))))},exports.Panel=function({children:e}){return t.createElement(rt,null,e)},exports.SelectInput=function(e){return function(e){return(t,n)=>{const r=Reflect.getMetadata(ge,t)||[];if(Reflect.defineMetadata(ge,[...r,n.toString()],t),e){const r=`${ge.toString()}:${n.toString()}:options`;Reflect.defineMetadata(r,e,t)}}}({...e,type:"select"})},exports.getInputFields=Ee;
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export { FormPage } from './components/form/FormPage';
9
9
  export { Form, type OnSubmitFN } from './decorators/form/Form';
10
10
  export { Input } from './decorators/form/Input';
11
11
  export { SelectInput } from './decorators/form/inputs/SelectInput';
12
+ export { DownloadCell } from './decorators/list/cells/DownloadCell';
12
13
  export { getInputFields } from './decorators/form/Input';
13
14
  export { Panel } from './components/Panel';
14
15
  export { Counter } from './components/Counter';