@aventusjs/cli 0.0.24 → 0.0.26

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.
@@ -7,14 +7,14 @@ declare global {
7
7
  namespace Aventus{
8
8
  @Storybook({
9
9
  prefix: "Webcomponent"
10
- })
10
+ })
11
11
  interface DebuggerConfig {
12
12
  writeCompiled?: boolean;
13
13
  }
14
14
 
15
15
  @Storybook({
16
16
  prefix: "Webcomponent"
17
- })
17
+ })
18
18
  class Style {
19
19
  private static instance;
20
20
  static noAnimation: CSSStyleSheet;
@@ -38,14 +38,14 @@ class Style {
38
38
 
39
39
  @Storybook({
40
40
  prefix: "Webcomponent"
41
- })
41
+ })
42
42
  interface DefaultComponent {
43
43
  [key: string]: any;
44
44
  }
45
45
 
46
46
  /**
47
47
  * Generate a new UUID
48
- */
48
+ */
49
49
  function uuidv4(): string;
50
50
 
51
51
  type Last<T extends any[]> = T extends [...infer _, infer Last] ? Last : never;
@@ -58,10 +58,10 @@ type NotVoid = {
58
58
  * It ll wait the number provided in ms
59
59
  * Async setTimeout
60
60
  * @param {number} ms Define the time to wait in milliseconds
61
- */
61
+ */
62
62
  function sleep(ms: number): Promise<void>;
63
63
 
64
- /** Force the type to be a literal string */
64
+ /** Force the type to be a literal string */
65
65
  type StringLiteral<T> = T extends string ? string extends T ? never : T : never;
66
66
 
67
67
  type Constructor<T> = abstract new (...args: any[]) => T;
@@ -77,15 +77,15 @@ function isClass(v: any): boolean;
77
77
  * @param {string} path The path where the value should be set, using dot notation. For example, "a.b.c" for obj[a][b][c].
78
78
  * @param {*} obj The object in which to set the value.
79
79
  * @param {*} value The value to set.
80
- */
80
+ */
81
81
  function setValueToObject(path: string, obj: any, value: any): void;
82
82
 
83
83
  /**
84
84
  * Represents a mutual exclusion (mutex) mechanism for synchronizing access to a shared resource.
85
- */
85
+ */
86
86
  @Storybook({
87
87
  prefix: "Tools/Mutex"
88
- })
88
+ })
89
89
  class Mutex {
90
90
  /**
91
91
  * Array to store functions waiting for the mutex to become available.
@@ -146,10 +146,10 @@ class Mutex {
146
146
 
147
147
  /**
148
148
  * Class that manages unique execution of asynchronous actions based on specified keys.
149
- */
149
+ */
150
150
  @Storybook({
151
151
  prefix: "Tools/Mutex"
152
- })
152
+ })
153
153
  class ActionGuard {
154
154
  /**
155
155
  * Map to store actions that are currently running.
@@ -192,19 +192,19 @@ type KeysObject<Item> = {
192
192
 
193
193
  @Storybook({
194
194
  prefix: "Ram"
195
- })
195
+ })
196
196
  interface IRam {
197
197
  }
198
198
 
199
199
  @Storybook({
200
200
  prefix: "Ram"
201
- })
201
+ })
202
202
  interface IRamData {
203
203
  }
204
204
 
205
205
  /**
206
206
  * Enumeration of error codes for RAM-related errors.
207
- */
207
+ */
208
208
  enum RamErrorCode {
209
209
  /** Error code for an unknown error */
210
210
  unknow = 0,
@@ -228,7 +228,7 @@ type UriParams = {
228
228
 
229
229
  @Storybook({
230
230
  prefix: "Lib/ResourceLoader"
231
- })
231
+ })
232
232
  interface ResourceLoaderHeadOptions {
233
233
  url: string;
234
234
  type: 'js' | 'css';
@@ -237,7 +237,7 @@ interface ResourceLoaderHeadOptions {
237
237
 
238
238
  @Storybook({
239
239
  prefix: "Lib/ResourceLoader"
240
- })
240
+ })
241
241
  interface ResourceLoaderOptions {
242
242
  url: string;
243
243
  type?: 'js' | 'css' | 'img' | 'svg';
@@ -246,7 +246,7 @@ interface ResourceLoaderOptions {
246
246
 
247
247
  @Storybook({
248
248
  prefix: "Lib/ResourceLoader"
249
- })
249
+ })
250
250
  class ResourceLoader {
251
251
  private static headerLoaded;
252
252
  private static headerWaiting;
@@ -273,7 +273,7 @@ class ResourceLoader {
273
273
 
274
274
  @Storybook({
275
275
  prefix: "Lib/ResizeObserver"
276
- })
276
+ })
277
277
  interface ResizeObserverOptions {
278
278
  callback: ResizeObserverCallback;
279
279
  fps?: number;
@@ -281,7 +281,7 @@ interface ResizeObserverOptions {
281
281
 
282
282
  @Storybook({
283
283
  prefix: "Lib/PressManager"
284
- })
284
+ })
285
285
  interface Pointer {
286
286
  id: number;
287
287
  constructor(nativePointer: Touch | PointerEvent): Pointer;
@@ -301,7 +301,7 @@ const DragElementLeftTopType: readonly [any, any];
301
301
 
302
302
  @Storybook({
303
303
  prefix: "Lib/PressManager"
304
- })
304
+ })
305
305
  interface PressManagerState {
306
306
  oneActionTriggered: Aventus.PressManager | null;
307
307
  }
@@ -326,7 +326,7 @@ class NormalizedEvent {
326
326
 
327
327
  @Storybook({
328
328
  prefix: "Lib/PressManager"
329
- })
329
+ })
330
330
  interface InternalCustomFunction {
331
331
  src?: Aventus.PressManager;
332
332
  onDrag?: (e: Aventus.NormalizedEvent, self: Aventus.PressManager) => void;
@@ -336,7 +336,7 @@ interface InternalCustomFunction {
336
336
 
337
337
  @Storybook({
338
338
  prefix: "Lib/PressManager"
339
- })
339
+ })
340
340
  interface InternalPointerEvent extends Event {
341
341
  detail: {
342
342
  state: Aventus.PressManagerState;
@@ -347,10 +347,10 @@ interface InternalPointerEvent extends Event {
347
347
 
348
348
  /**
349
349
  * Options for configuring the PressManager.
350
- */
350
+ */
351
351
  @Storybook({
352
352
  prefix: "Lib/PressManager"
353
- })
353
+ })
354
354
  interface PressManagerOptions {
355
355
  /**
356
356
  * The element to be managed by PressManager.
@@ -447,7 +447,7 @@ type DragElementXY = InstanceType<typeof DragElementXYType[number]>;
447
447
 
448
448
  @Storybook({
449
449
  prefix: "Lib/Callback"
450
- })
450
+ })
451
451
  class Callback<U extends (...args: any) => T, T = void> {
452
452
  private callbacks;
453
453
  /**
@@ -470,7 +470,7 @@ class Callback<U extends (...args: any) => T, T = void> {
470
470
 
471
471
  @Storybook({
472
472
  prefix: "Lib/Callback"
473
- })
473
+ })
474
474
  class CallbackGroup<U extends (...args: any) => void> {
475
475
  private callbacks;
476
476
  /**
@@ -505,14 +505,14 @@ abstract class Request {
505
505
 
506
506
  @Storybook({
507
507
  prefix: "Http"
508
- })
508
+ })
509
509
  interface RouterOptions {
510
510
  url: string;
511
511
  }
512
512
 
513
513
  @Storybook({
514
514
  prefix: "Http"
515
- })
515
+ })
516
516
  interface HttpRouterOptions {
517
517
  url: string;
518
518
  }
@@ -522,7 +522,7 @@ interface HttpRouterOptions {
522
522
  * @param {*} obj1 The first object to compare.
523
523
  * @param {*} obj2 The second object to compare.
524
524
  * @returns {boolean} Returns true if the objects are considered equal, otherwise returns false.
525
- */
525
+ */
526
526
  function compareObject(obj1: any, obj2: any, tableOrder?: boolean): boolean;
527
527
 
528
528
  /**
@@ -530,7 +530,7 @@ function compareObject(obj1: any, obj2: any, tableOrder?: boolean): boolean;
530
530
  * @param {string} path The path to the desired value, using dot notation. For example, "a.b.c" for obj[a][b][c].
531
531
  * @param {*} obj The object from which to retrieve the value.
532
532
  * @returns {*} Returns the value at the specified path in the object. If the path is invalid or the value does not exist, returns undefined.
533
- */
533
+ */
534
534
  function getValueFromObject(path: string, obj: any): any;
535
535
 
536
536
  enum WatchAction {
@@ -547,7 +547,7 @@ function Async<T>(el: Aventus.Asyncable<T>): Promise<T>;
547
547
 
548
548
  /**
549
549
  * List of HTTP Method allowed
550
- */
550
+ */
551
551
  enum HttpMethod {
552
552
  GET = "GET",
553
553
  POST = "POST",
@@ -601,10 +601,10 @@ type ClassCopyOptions = {
601
601
 
602
602
  /**
603
603
  * Interface representing data with methods to get its unique type and to clone itself.
604
- */
604
+ */
605
605
  @Storybook({
606
606
  prefix: "Data"
607
- })
607
+ })
608
608
  interface IData {
609
609
  /**
610
610
  * Get the unique type for the data. Define it as the fullnamespace + class name
@@ -618,14 +618,14 @@ interface IData {
618
618
 
619
619
  @Storybook({
620
620
  prefix: "Tools/Conveter"
621
- })
621
+ })
622
622
  interface Schema {
623
623
  [key: string]: ___Aventus.SchemaType;
624
624
  }
625
625
 
626
626
  @Storybook({
627
627
  prefix: "Tools/Conveter"
628
- })
628
+ })
629
629
  interface IConverterTransform {
630
630
  transform<T = any>(data: any): T;
631
631
  copyValuesClass<T extends Object>(target: T, src: T, options?: Aventus.ClassCopyOptions): void;
@@ -633,10 +633,10 @@ interface IConverterTransform {
633
633
 
634
634
  /**
635
635
  * Utility class for JSON serialization and deserialization of objects.
636
- */
636
+ */
637
637
  @Storybook({
638
638
  prefix: "Tools/Json"
639
- })
639
+ })
640
640
  class Json {
641
641
  /**
642
642
  * Converts a JavaScript class instance to a JSON object.
@@ -663,7 +663,7 @@ class Json {
663
663
 
664
664
  @Storybook({
665
665
  prefix: "Tools/Conveter"
666
- })
666
+ })
667
667
  class ConverterTransform implements Aventus.IConverterTransform {
668
668
  transform<T = any>(data: any): T;
669
669
  protected createInstance(data: Record<string, any>): (Object & {
@@ -678,10 +678,10 @@ class ConverterTransform implements Aventus.IConverterTransform {
678
678
 
679
679
  /**
680
680
  * Utility class for data conversion and manipulation.
681
- */
681
+ */
682
682
  @Storybook({
683
683
  prefix: "Tools/Conveter"
684
- })
684
+ })
685
685
  class Converter {
686
686
  /**
687
687
  * Map storing information about registered types.
@@ -752,10 +752,10 @@ class HttpResponse {
752
752
 
753
753
  /**
754
754
  * Abstract class implementing IData with additional properties and methods for namespace and JSON handling.
755
- */
755
+ */
756
756
  @Storybook({
757
757
  prefix: "Data"
758
- })
758
+ })
759
759
  abstract class Data implements Aventus.IData {
760
760
  private static converter;
761
761
  /**
@@ -807,11 +807,11 @@ class HttpCache {
807
807
  /**
808
808
  * Represents a generic error with a code, message, and optional details.
809
809
  * @template T - The type of the error code, which extends either number or Enum.
810
- */
811
- @Convertible()
810
+ */
811
+ @Convertible()
812
812
  @Storybook({
813
813
  prefix: "Error"
814
- })
814
+ })
815
815
  class GenericError<T extends (number | Aventus.Enum) = any> {
816
816
  private static converter;
817
817
  static get Fullname(): string;
@@ -840,11 +840,11 @@ class GenericError<T extends (number | Aventus.Enum) = any> {
840
840
  /**
841
841
  * Represents a result of an action that may contain errors.
842
842
  * @template T - The type of error, extending GenericError.
843
- */
844
- @Convertible()
843
+ */
844
+ @Convertible()
845
845
  @Storybook({
846
846
  prefix: "Error"
847
- })
847
+ })
848
848
  class VoidWithError<T extends Aventus.GenericError = Aventus.GenericError> {
849
849
  static get Fullname(): string;
850
850
  /**
@@ -879,11 +879,11 @@ class VoidWithError<T extends Aventus.GenericError = Aventus.GenericError> {
879
879
  * Represents a result of an action that may contain errors and includes a result value.
880
880
  * @template U The type of the result value.
881
881
  * @template T The type of error, extending GenericError.
882
- */
883
- @Convertible()
882
+ */
883
+ @Convertible()
884
884
  @Storybook({
885
885
  prefix: "Error"
886
- })
886
+ })
887
887
  class ResultWithError<U, T extends Aventus.GenericError = Aventus.GenericError> extends Aventus.VoidWithError<T> {
888
888
  static get Fullname(): string;
889
889
  /**
@@ -907,12 +907,12 @@ class ResultWithError<U, T extends Aventus.GenericError = Aventus.GenericError>
907
907
  * Otherwise, it returns `T`.
908
908
  * @template T The input type to extract the error or void from.
909
909
  * @template U The default type if `T` is not a `ResultWithError`.
910
- */
910
+ */
911
911
  type ExtractFromError<T, U = any> = T extends Aventus.ResultWithError<infer U, any> ? U : T extends Aventus.VoidWithError ? boolean : T;
912
912
 
913
913
  @Storybook({
914
914
  prefix: "Http"
915
- })
915
+ })
916
916
  class HttpError extends Aventus.GenericError<Aventus.HttpErrorCode> {
917
917
  }
918
918
 
@@ -932,7 +932,7 @@ type EffectReceiver = {
932
932
  class Signal<T> implements Aventus.EffectReceiver {
933
933
  protected __subscribes: Aventus.WatcherChange[];
934
934
  private _value;
935
- @Internal()
935
+ @Internal()
936
936
  private _onChange?;
937
937
  get value(): T;
938
938
  set value(item: T);
@@ -945,12 +945,12 @@ class Signal<T> implements Aventus.EffectReceiver {
945
945
  /**
946
946
  * Effect will recomputed each time a watchable variable or effect or computed are changed
947
947
  * Each time the function is called, dependencies tree is updated. It's usefull when you have array or conditional inside
948
- */
948
+ */
949
949
  @Storybook({
950
950
  prefix: "Lib/Watcher"
951
- })
951
+ })
952
952
  class Effect {
953
- @InternalProtected()
953
+ @InternalProtected()
954
954
  protected callbacks: {
955
955
  receiver: Aventus.EffectReceiver;
956
956
  path: string;
@@ -959,20 +959,20 @@ class Effect {
959
959
  cb: Aventus.WatcherChange;
960
960
  version: number;
961
961
  }[];
962
- @InternalProtected()
962
+ @InternalProtected()
963
963
  protected isInit: boolean;
964
- @InternalProtected()
964
+ @InternalProtected()
965
965
  protected isDestroy: boolean;
966
966
  protected __subscribes: Aventus.WatcherChange[];
967
967
  protected __allowChanged: ___Aventus.WatcherAllowed[];
968
- @InternalProtected()
968
+ @InternalProtected()
969
969
  protected version: number;
970
970
  protected fct: () => void;
971
971
  constructor(fct: () => void);
972
972
  protected autoInit(): boolean;
973
973
  protected init(): void;
974
974
  protected run(): void;
975
- @InternalProtected()
975
+ @InternalProtected()
976
976
  protected register(receiver: Aventus.EffectReceiver, path: string, version: number, fullPath: string): void;
977
977
  canChange(fct: ___Aventus.WatcherAllowed): void;
978
978
  protected checkCanChange(action: Aventus.WatchAction, changePath: string, value: any, dones: any[]): boolean;
@@ -987,13 +987,13 @@ class Effect {
987
987
  * Computed will recomputed each time a watchable variable or effect or computed are changed
988
988
  * When no change occured you can get the value by calling the value property
989
989
  * Each time the function is called, dependencies tree is updated. It's usefull when you have array or conditional inside
990
- */
990
+ */
991
991
  @Storybook({
992
992
  prefix: "Lib/Watcher"
993
- })
993
+ })
994
994
  class Computed<T = any> extends Aventus.Effect implements Aventus.EffectReceiver {
995
995
  protected _value?: T;
996
- @Internal()
996
+ @Internal()
997
997
  private __path;
998
998
  get value(): T | undefined;
999
999
  protected autoInit(): boolean;
@@ -1005,15 +1005,15 @@ class Computed<T = any> extends Aventus.Effect implements Aventus.EffectReceiver
1005
1005
 
1006
1006
  @Storybook({
1007
1007
  prefix: "Lib/Watcher"
1008
- })
1008
+ })
1009
1009
  class Watcher {
1010
1010
  static isNative(obj: any): boolean;
1011
1011
  private constructor();
1012
1012
  private static __reservedName;
1013
1013
  private static __triggerForced;
1014
- @Internal()
1014
+ @Internal()
1015
1015
  private static _registering;
1016
- @Internal()
1016
+ @Internal()
1017
1017
  private static get _register();
1018
1018
  /**
1019
1019
  * Transform object into a watcher
@@ -1044,10 +1044,10 @@ class Watcher {
1044
1044
  * Computed will recomputed each time a watchable variable or effect or computed are changed
1045
1045
  * When no change occured you can get the value by calling the value property
1046
1046
  * The dependencies tree is created only during the first execution
1047
- */
1047
+ */
1048
1048
  @Storybook({
1049
1049
  prefix: "Lib/Watcher"
1050
- })
1050
+ })
1051
1051
  class ComputedNoRecomputed<T = any> extends Aventus.Computed<T> {
1052
1052
  protected init(): void;
1053
1053
  protected computedValue(): void;
@@ -1057,10 +1057,10 @@ class ComputedNoRecomputed<T = any> extends Aventus.Computed<T> {
1057
1057
  /**
1058
1058
  * Effect will recomputed each time a watchable variable or effect or computed are changed
1059
1059
  * The dependencies tree is created only during the first execution
1060
- */
1060
+ */
1061
1061
  @Storybook({
1062
1062
  prefix: "Lib/Watcher"
1063
- })
1063
+ })
1064
1064
  class EffectNoRecomputed extends Aventus.Effect {
1065
1065
  protected init(): void;
1066
1066
  protected run(): void;
@@ -1068,12 +1068,12 @@ class EffectNoRecomputed extends Aventus.Effect {
1068
1068
 
1069
1069
  @Storybook({
1070
1070
  prefix: "Http"
1071
- })
1071
+ })
1072
1072
  class HttpRouter {
1073
- @InternalProtected()
1073
+ @InternalProtected()
1074
1074
  private static options?;
1075
1075
  static configure(options: Aventus.HttpRouterOptions): void;
1076
- @InternalProtected()
1076
+ @InternalProtected()
1077
1077
  protected options: Aventus.HttpRouterOptions;
1078
1078
  constructor();
1079
1079
  private defaultOptionsValue;
@@ -1097,7 +1097,7 @@ type RouterType = (abstract new (...args: any[]) => Aventus.HttpRouter);
1097
1097
 
1098
1098
  @Storybook({
1099
1099
  prefix: "Http"
1100
- })
1100
+ })
1101
1101
  class HttpRoute {
1102
1102
  protected router: Aventus.HttpRouter;
1103
1103
  constructor(router?: Aventus.HttpRouter);
@@ -1108,7 +1108,7 @@ type RouteType = abstract new (...args: any[]) => Aventus.HttpRoute;
1108
1108
 
1109
1109
  @Storybook({
1110
1110
  prefix: "Http"
1111
- })
1111
+ })
1112
1112
  class HttpRequest {
1113
1113
  private static options?;
1114
1114
  static configure(options: Aventus.HttpRequestOptions): void;
@@ -1147,7 +1147,7 @@ class HttpRequest {
1147
1147
 
1148
1148
  @Storybook({
1149
1149
  prefix: "Http"
1150
- })
1150
+ })
1151
1151
  abstract class StorableRoute<T extends Aventus.IData> extends Aventus.HttpRoute {
1152
1152
  GetAll(): unknown;
1153
1153
  Create(body: {
@@ -1163,7 +1163,7 @@ abstract class StorableRoute<T extends Aventus.IData> extends Aventus.HttpRoute
1163
1163
 
1164
1164
  @Storybook({
1165
1165
  prefix: "Lib/Animation"
1166
- })
1166
+ })
1167
1167
  class Animation {
1168
1168
  /**
1169
1169
  * Default FPS for all Animation if not set inside options
@@ -1206,7 +1206,7 @@ type DragElement = Aventus.DragElementXY | Aventus.DragElementLeftTop;
1206
1206
 
1207
1207
  @Storybook({
1208
1208
  prefix: "Lib/DragAndDrop"
1209
- })
1209
+ })
1210
1210
  interface DragAndDropOptionsShadow {
1211
1211
  /** If set to true, the drag and drop will create a shadow element while dragging and removing it on drop. It will not move the original element anymore */
1212
1212
  enable: boolean;
@@ -1222,7 +1222,7 @@ interface DragAndDropOptionsShadow {
1222
1222
 
1223
1223
  @Storybook({
1224
1224
  prefix: "Lib/DragAndDrop"
1225
- })
1225
+ })
1226
1226
  interface DragAndDropOptions {
1227
1227
  /** If set to false, the element won't move */
1228
1228
  applyDrag?: boolean;
@@ -1274,7 +1274,7 @@ interface DragAndDropOptions {
1274
1274
 
1275
1275
  @Storybook({
1276
1276
  prefix: "Lib/PressManager"
1277
- })
1277
+ })
1278
1278
  class PressManager {
1279
1279
  private static globalConfig;
1280
1280
  static configure(options: Partial<Aventus.PressManagerOptions>): void;
@@ -1352,7 +1352,7 @@ class PressManager {
1352
1352
 
1353
1353
  @Storybook({
1354
1354
  prefix: "Lib/DragAndDrop"
1355
- })
1355
+ })
1356
1356
  class DragAndDrop {
1357
1357
  /**
1358
1358
  * Default offset before drag element
@@ -1415,7 +1415,7 @@ class DragAndDrop {
1415
1415
 
1416
1416
  @Storybook({
1417
1417
  prefix: "Lib/Instance"
1418
- })
1418
+ })
1419
1419
  class Instance {
1420
1420
  private static elements;
1421
1421
  static get<X>(type: Aventus.InstanceCst2<X>): X;
@@ -1425,7 +1425,7 @@ class Instance {
1425
1425
 
1426
1426
  @Storybook({
1427
1427
  prefix: "Lib/ResizeObserver"
1428
- })
1428
+ })
1429
1429
  class ResizeObserver {
1430
1430
  private callback;
1431
1431
  private targets;
@@ -1461,7 +1461,7 @@ type PreparedUri = {
1461
1461
 
1462
1462
  @Storybook({
1463
1463
  prefix: "Lib/Uri"
1464
- })
1464
+ })
1465
1465
  class Uri {
1466
1466
  static prepare(uri: string): Aventus.PreparedUri;
1467
1467
  static getParams(from: string | Aventus.PreparedUri, current: string): Aventus.UriParamsValue | null;
@@ -1472,20 +1472,20 @@ class Uri {
1472
1472
  /**
1473
1473
  * Class representing a specific RAM error.
1474
1474
  * Inherits from GenericError with the error code type RamErrorCode.
1475
- */
1475
+ */
1476
1476
  @Storybook({
1477
1477
  prefix: "Ram"
1478
- })
1478
+ })
1479
1479
  class RamError extends Aventus.GenericError<Aventus.RamErrorCode> {
1480
1480
  }
1481
1481
 
1482
1482
  /**
1483
1483
  * Class representing the result of an action that may contain RAM-specific errors without a result.
1484
1484
  * Inherits from VoidWithError with the error type RamError.
1485
- */
1485
+ */
1486
1486
  @Storybook({
1487
1487
  prefix: "Ram"
1488
- })
1488
+ })
1489
1489
  class VoidRamWithError extends Aventus.VoidWithError<Aventus.RamError> {
1490
1490
  }
1491
1491
 
@@ -1493,16 +1493,16 @@ class VoidRamWithError extends Aventus.VoidWithError<Aventus.RamError> {
1493
1493
  * Class representing the result of an action that may contain RAM-specific errors with a result of a generic type.
1494
1494
  * @template T - The type of the action result.
1495
1495
  * Inherits from ResultWithError with the error type RamError.
1496
- */
1496
+ */
1497
1497
  @Storybook({
1498
1498
  prefix: "Ram"
1499
- })
1499
+ })
1500
1500
  class ResultRamWithError<T> extends Aventus.ResultWithError<T, Aventus.RamError> {
1501
1501
  }
1502
1502
 
1503
1503
  @Storybook({
1504
1504
  prefix: "Ram"
1505
- })
1505
+ })
1506
1506
  interface IRamAction<Resource, Request> {
1507
1507
  update(newData: Request): Promise<this | undefined>;
1508
1508
  updateWithError(newData: Request): Promise<Aventus.ResultRamWithError<this>>;
@@ -1518,7 +1518,7 @@ type RamItem<Resource extends Aventus.IRamData, Request> = Resource & Aventus.IR
1518
1518
 
1519
1519
  @Storybook({
1520
1520
  prefix: "Ram"
1521
- })
1521
+ })
1522
1522
  abstract class GenericRam<Index, Item extends Aventus.IRamData, Request extends Aventus.Request | Item = Aventus.KeysObject<Item>, ResourceSimple extends Aventus.Resource | Item = Item, ResourceDetails extends ResourceSimple = ResourceSimple> implements Aventus.IRam {
1523
1523
  static readonly info: Map<Aventus.IRam, new () => any>;
1524
1524
  /**
@@ -1536,7 +1536,7 @@ abstract class GenericRam<Index, Item extends Aventus.IRamData, Request extends
1536
1536
  */
1537
1537
  protected records: Map<Index, Aventus.RamItem<ResourceDetails, Request>>;
1538
1538
  protected actionGuard: Aventus.ActionGuard;
1539
- @InternalProtected()
1539
+ @InternalProtected()
1540
1540
  protected ramMapping: {
1541
1541
  [key: string]: {
1542
1542
  ram: Aventus.IRam;
@@ -1552,12 +1552,12 @@ abstract class GenericRam<Index, Item extends Aventus.IRamData, Request extends
1552
1552
  /**
1553
1553
  * Get item id
1554
1554
  */
1555
- @BindThis()
1555
+ @BindThis()
1556
1556
  getIdWithError(item: Aventus.KeysObject<ResourceDetails> | ResourceDetails): Aventus.ResultRamWithError<Index>;
1557
1557
  /**
1558
1558
  * Get item id
1559
1559
  */
1560
- @BindThis()
1560
+ @BindThis()
1561
1561
  getId(item: Aventus.KeysObject<ResourceDetails> | ResourceDetails): Index;
1562
1562
  /**
1563
1563
  * Prevent adding Watch element
@@ -1579,7 +1579,7 @@ abstract class GenericRam<Index, Item extends Aventus.IRamData, Request extends
1579
1579
  /**
1580
1580
  * Define all the types you ram is capable of
1581
1581
  */
1582
- @InternalProtected()
1582
+ @InternalProtected()
1583
1583
  protected ramForTypes(): (new () => ResourceDetails)[];
1584
1584
  /**
1585
1585
  * Transform the object into the object stored inside Ram
@@ -1599,12 +1599,12 @@ abstract class GenericRam<Index, Item extends Aventus.IRamData, Request extends
1599
1599
  /**
1600
1600
  * Create or update the item
1601
1601
  */
1602
- @BindThis()
1602
+ @BindThis()
1603
1603
  save(item: Request, ...args: any[]): Promise<Aventus.RamItem<ResourceDetails, Request> | undefined>;
1604
1604
  /**
1605
1605
  * Create or update the item
1606
1606
  */
1607
- @BindThis()
1607
+ @BindThis()
1608
1608
  saveWithError(item: Request, ...args: any[]): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>>>;
1609
1609
  protected beforeRecordSet(item: Aventus.RamItem<ResourceDetails, Request>): Promise<Aventus.VoidWithError>;
1610
1610
  protected afterRecordSet(item: Aventus.RamItem<ResourceDetails, Request>): Promise<Aventus.VoidWithError>;
@@ -1616,52 +1616,52 @@ abstract class GenericRam<Index, Item extends Aventus.IRamData, Request extends
1616
1616
  /**
1617
1617
  * Add a callback that ll be triggered when a new item is stored
1618
1618
  */
1619
- @BindThis()
1619
+ @BindThis()
1620
1620
  onCreated(cb: (item: Aventus.RamItem<ResourceDetails, Request>) => void): void;
1621
1621
  /**
1622
1622
  * Remove a created callback
1623
1623
  */
1624
- @BindThis()
1624
+ @BindThis()
1625
1625
  offCreated(cb: (item: Aventus.RamItem<ResourceDetails, Request>) => void): void;
1626
1626
  /**
1627
1627
  * Add a callback that ll be triggered when an item is updated
1628
1628
  */
1629
- @BindThis()
1629
+ @BindThis()
1630
1630
  onUpdated(cb: (item: Aventus.RamItem<ResourceDetails, Request>) => void): void;
1631
1631
  /**
1632
1632
  * Remove an updated callback
1633
1633
  */
1634
- @BindThis()
1634
+ @BindThis()
1635
1635
  offUpdated(cb: (item: Aventus.RamItem<ResourceDetails, Request>) => void): void;
1636
1636
  /**
1637
1637
  * Add a callback that ll be triggered when an item is deleted
1638
1638
  */
1639
- @BindThis()
1639
+ @BindThis()
1640
1640
  onDeleted(cb: (item: Aventus.RamItem<ResourceDetails, Request>) => void): void;
1641
1641
  /**
1642
1642
  * Remove an deleted callback
1643
1643
  */
1644
- @BindThis()
1644
+ @BindThis()
1645
1645
  offDeleted(cb: (item: Aventus.RamItem<ResourceDetails, Request>) => void): void;
1646
1646
  /**
1647
1647
  * Get an item by id if exist (alias for getById)
1648
1648
  */
1649
- @BindThis()
1649
+ @BindThis()
1650
1650
  get(id: Index): Promise<Aventus.RamItem<ResourceDetails, Request> | undefined>;
1651
1651
  /**
1652
1652
  * Get an item by id if exist (alias for getById)
1653
1653
  */
1654
- @BindThis()
1654
+ @BindThis()
1655
1655
  getWithError(id: Index): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>>>;
1656
1656
  /**
1657
1657
  * Get an item by id if exist
1658
1658
  */
1659
- @BindThis()
1659
+ @BindThis()
1660
1660
  getById(id: Index): Promise<Aventus.RamItem<ResourceDetails, Request> | undefined>;
1661
1661
  /**
1662
1662
  * Get an item by id if exist
1663
1663
  */
1664
- @BindThis()
1664
+ @BindThis()
1665
1665
  getByIdWithError(id: Index): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>>>;
1666
1666
  /**
1667
1667
  * Trigger before getting an item by id
@@ -1674,12 +1674,12 @@ abstract class GenericRam<Index, Item extends Aventus.IRamData, Request extends
1674
1674
  /**
1675
1675
  * Get multiple items by ids
1676
1676
  */
1677
- @BindThis()
1677
+ @BindThis()
1678
1678
  getByIds(ids: Index[]): Promise<Aventus.RamItem<ResourceDetails, Request>[]>;
1679
1679
  /**
1680
1680
  * Get multiple items by ids
1681
1681
  */
1682
- @BindThis()
1682
+ @BindThis()
1683
1683
  getByIdsWithError(ids: Index[]): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>[]>>;
1684
1684
  /**
1685
1685
  * Trigger before getting a list of items by id
@@ -1692,12 +1692,12 @@ abstract class GenericRam<Index, Item extends Aventus.IRamData, Request extends
1692
1692
  /**
1693
1693
  * Get all elements inside the Ram
1694
1694
  */
1695
- @BindThis()
1695
+ @BindThis()
1696
1696
  getAll(): Promise<Aventus.RamItem<ResourceSimple, Request>[]>;
1697
1697
  /**
1698
1698
  * Get all elements inside the Ram
1699
1699
  */
1700
- @BindThis()
1700
+ @BindThis()
1701
1701
  getAllWithError(): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceSimple, Request>[]>>;
1702
1702
  /**
1703
1703
  * Trigger before getting all items inside Ram
@@ -1710,42 +1710,42 @@ abstract class GenericRam<Index, Item extends Aventus.IRamData, Request extends
1710
1710
  /**
1711
1711
  * Get all elements inside the Ram
1712
1712
  */
1713
- @BindThis()
1713
+ @BindThis()
1714
1714
  getList(): Promise<Aventus.RamItem<ResourceSimple, Request>[]>;
1715
1715
  /**
1716
1716
  * Get all elements inside the Ram
1717
1717
  */
1718
- @BindThis()
1718
+ @BindThis()
1719
1719
  getListWithError(): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceSimple, Request>[]>>;
1720
1720
  /**
1721
1721
  * Get all elements inside the Ram
1722
1722
  */
1723
- @BindThis()
1723
+ @BindThis()
1724
1724
  getRecords(): Promise<Map<Index, Aventus.RamItem<ResourceSimple, Request>>>;
1725
1725
  /**
1726
1726
  * Get all elements inside the Ram
1727
1727
  */
1728
- @BindThis()
1728
+ @BindThis()
1729
1729
  getRecordsWithError(): Promise<Aventus.ResultRamWithError<Map<Index, Aventus.RamItem<ResourceSimple, Request>>>>;
1730
1730
  /**
1731
1731
  * Create a list of items inside ram
1732
1732
  */
1733
- @BindThis()
1733
+ @BindThis()
1734
1734
  createList(list: Request[]): Promise<Aventus.RamItem<ResourceDetails, Request>[]>;
1735
1735
  /**
1736
1736
  * Create a list of items inside ram
1737
1737
  */
1738
- @BindThis()
1738
+ @BindThis()
1739
1739
  createListWithError(list: Request[]): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>[]>>;
1740
1740
  /**
1741
1741
  * Create an item inside ram
1742
1742
  */
1743
- @BindThis()
1743
+ @BindThis()
1744
1744
  create(item: Request, ...args: any[]): Promise<Aventus.RamItem<ResourceDetails, Request> | undefined>;
1745
1745
  /**
1746
1746
  * Create an item inside ram
1747
1747
  */
1748
- @BindThis()
1748
+ @BindThis()
1749
1749
  createWithError(item: Request, ...args: any[]): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>>>;
1750
1750
  /**
1751
1751
  * Transform request to resource item
@@ -1774,22 +1774,22 @@ abstract class GenericRam<Index, Item extends Aventus.IRamData, Request extends
1774
1774
  /**
1775
1775
  * Update a list of items inside ram
1776
1776
  */
1777
- @BindThis()
1777
+ @BindThis()
1778
1778
  updateList(list: Request[]): Promise<Aventus.RamItem<ResourceDetails, Request>[]>;
1779
1779
  /**
1780
1780
  * Update a list of items inside ram
1781
1781
  */
1782
- @BindThis()
1782
+ @BindThis()
1783
1783
  updateListWithError(list: Request[]): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>[]>>;
1784
1784
  /**
1785
1785
  * Update an item inside ram
1786
1786
  */
1787
- @BindThis()
1787
+ @BindThis()
1788
1788
  update(item: Request, ...args: any[]): Promise<Aventus.RamItem<ResourceDetails, Request> | undefined>;
1789
1789
  /**
1790
1790
  * Update an item inside ram
1791
1791
  */
1792
- @BindThis()
1792
+ @BindThis()
1793
1793
  updateWithError(item: Request, ...args: any[]): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>>>;
1794
1794
  /**
1795
1795
  * Transform request to resource item
@@ -1818,32 +1818,32 @@ abstract class GenericRam<Index, Item extends Aventus.IRamData, Request extends
1818
1818
  /**
1819
1819
  * Delete a list of items inside ram
1820
1820
  */
1821
- @BindThis()
1821
+ @BindThis()
1822
1822
  deleteList(list: ResourceDetails[]): Promise<Aventus.RamItem<ResourceDetails, Request>[]>;
1823
1823
  /**
1824
1824
  * Delete a list of items inside ram
1825
1825
  */
1826
- @BindThis()
1826
+ @BindThis()
1827
1827
  deleteListWithError(list: ResourceDetails[]): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>[]>>;
1828
1828
  /**
1829
1829
  * Delete an item inside ram
1830
1830
  */
1831
- @BindThis()
1831
+ @BindThis()
1832
1832
  delete(item: ResourceDetails, ...args: any[]): Promise<Aventus.RamItem<ResourceDetails, Request> | undefined>;
1833
1833
  /**
1834
1834
  * Delete an item inside ram
1835
1835
  */
1836
- @BindThis()
1836
+ @BindThis()
1837
1837
  deleteWithError(item: ResourceDetails, ...args: any[]): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>>>;
1838
1838
  /**
1839
1839
  * Delete an item by id inside ram
1840
1840
  */
1841
- @BindThis()
1841
+ @BindThis()
1842
1842
  deleteById(id: Index): Promise<Aventus.RamItem<ResourceDetails, Request> | undefined>;
1843
1843
  /**
1844
1844
  * Delete an item by id inside ram
1845
1845
  */
1846
- @BindThis()
1846
+ @BindThis()
1847
1847
  deleteByIdWithError(id: Index): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>>>;
1848
1848
  private _delete;
1849
1849
  /**
@@ -1866,16 +1866,16 @@ abstract class GenericRam<Index, Item extends Aventus.IRamData, Request extends
1866
1866
 
1867
1867
  /**
1868
1868
  * Default Ram with number as Index
1869
- */
1869
+ */
1870
1870
  @Storybook({
1871
1871
  prefix: "Ram"
1872
- })
1872
+ })
1873
1873
  abstract class Ram<Item extends Aventus.IRamData, Request extends Aventus.Request | Item = Item, ResourceSimple extends Aventus.Resource | Item = Item, ResourceDetails extends ResourceSimple = ResourceSimple> extends Aventus.GenericRam<number, Item, Request, ResourceSimple, ResourceDetails> {
1874
1874
  }
1875
1875
 
1876
1876
  @Storybook({
1877
1877
  prefix: "State"
1878
- })
1878
+ })
1879
1879
  interface StateAction {
1880
1880
  active?: ___Aventus.StateActivationFct | ___Aventus.StateActivationFct[];
1881
1881
  inactive?: ___Aventus.StateInactivationFct | ___Aventus.StateInactivationFct[];
@@ -1884,7 +1884,7 @@ interface StateAction {
1884
1884
 
1885
1885
  @Storybook({
1886
1886
  prefix: "State"
1887
- })
1887
+ })
1888
1888
  interface IStateManager {
1889
1889
  subscribe(statePatterns: string | string[], callbacks: Aventus.StateAction): void;
1890
1890
  unsubscribe(statePatterns: string | string[], callbacks: Aventus.StateAction): void;
@@ -1898,7 +1898,7 @@ interface IStateManager {
1898
1898
 
1899
1899
  @Storybook({
1900
1900
  prefix: "State"
1901
- })
1901
+ })
1902
1902
  abstract class StateManager implements Aventus.IStateManager {
1903
1903
  protected subscribers: {
1904
1904
  [statePattern: string]: ___Aventus.Subscriber;
@@ -1943,7 +1943,7 @@ abstract class StateManager implements Aventus.IStateManager {
1943
1943
 
1944
1944
  @Storybook({
1945
1945
  prefix: "State"
1946
- })
1946
+ })
1947
1947
  interface IState {
1948
1948
  readonly name: string;
1949
1949
  activate(manager: Aventus.StateManager): Promise<boolean>;
@@ -1954,7 +1954,7 @@ interface IState {
1954
1954
 
1955
1955
  @Storybook({
1956
1956
  prefix: "State"
1957
- })
1957
+ })
1958
1958
  abstract class State implements Aventus.IState {
1959
1959
  /**
1960
1960
  * Activate a custom state inside a specific manager
@@ -1973,7 +1973,7 @@ abstract class State implements Aventus.IState {
1973
1973
 
1974
1974
  @Storybook({
1975
1975
  prefix: "State"
1976
- })
1976
+ })
1977
1977
  class EmptyState extends Aventus.State implements Aventus.IState {
1978
1978
  private localName;
1979
1979
  constructor(stateName: string);
@@ -1985,9 +1985,9 @@ class EmptyState extends Aventus.State implements Aventus.IState {
1985
1985
 
1986
1986
  @Storybook({
1987
1987
  prefix: "Webcomponent"
1988
- })
1988
+ })
1989
1989
  class TemplateInstance {
1990
- @Internal()
1990
+ @Internal()
1991
1991
  private context;
1992
1992
  content: DocumentFragment;
1993
1993
  private actions;
@@ -2030,7 +2030,7 @@ class TemplateInstance {
2030
2030
 
2031
2031
  @Storybook({
2032
2032
  prefix: "Webcomponent"
2033
- })
2033
+ })
2034
2034
  class TemplateContext {
2035
2035
  data: {
2036
2036
  [name: string]: any;
@@ -2059,7 +2059,7 @@ class TemplateContext {
2059
2059
 
2060
2060
  @Storybook({
2061
2061
  prefix: "Webcomponent"
2062
- })
2062
+ })
2063
2063
  class Template {
2064
2064
  static validatePath(path: string, pathToCheck: string): boolean;
2065
2065
  cst: typeof Aventus.WebComponent;
@@ -2085,10 +2085,10 @@ class Template {
2085
2085
  @Dependencies([{
2086
2086
  type: WebComponentInstance,
2087
2087
  strong: true
2088
- }])
2088
+ }])
2089
2089
  @Storybook({
2090
2090
  prefix: "Webcomponent"
2091
- })
2091
+ })
2092
2092
  abstract class WebComponent extends HTMLElement implements Aventus.DefaultComponent {
2093
2093
  /**
2094
2094
  * Add attributes informations
@@ -2128,19 +2128,19 @@ abstract class WebComponent extends HTMLElement implements Aventus.DefaultCompon
2128
2128
  * Get the unique type for the data. Define it as the namespace + class name
2129
2129
  */
2130
2130
  get $type(): string;
2131
- @Internal()
2131
+ @Internal()
2132
2132
  private __onChangeFct;
2133
- @Internal()
2133
+ @Internal()
2134
2134
  private __watch;
2135
- @Internal()
2135
+ @Internal()
2136
2136
  private __watchActions;
2137
2137
  private __watchActionsCb;
2138
2138
  private __watchFunctions;
2139
2139
  private __watchFunctionsComputed;
2140
2140
  private __pressManagers;
2141
- @Internal()
2141
+ @Internal()
2142
2142
  private __signalActions;
2143
- @Internal()
2143
+ @Internal()
2144
2144
  private __signals;
2145
2145
  private __isDefaultState;
2146
2146
  private __defaultActiveState;
@@ -2297,7 +2297,7 @@ abstract class WebComponent extends HTMLElement implements Aventus.DefaultCompon
2297
2297
 
2298
2298
  @Storybook({
2299
2299
  prefix: "Webcomponent"
2300
- })
2300
+ })
2301
2301
  class WebComponentInstance {
2302
2302
  private static __allDefinitions;
2303
2303
  private static __allInstances;
@@ -2323,7 +2323,7 @@ class WebComponentInstance {
2323
2323
 
2324
2324
  @Storybook({
2325
2325
  prefix: "Webcomponent"
2326
- })
2326
+ })
2327
2327
  class ElementExtension {
2328
2328
  /**
2329
2329
  * Find a parent by custom check
@@ -2645,7 +2645,7 @@ type OnlyConstructor<T = any> = (abstract new (...args: any[]) => T);
2645
2645
 
2646
2646
  @Storybook({
2647
2647
  prefix: "Ram"
2648
- })
2648
+ })
2649
2649
  interface RamSubscribers<Item> {
2650
2650
  created: ((item: Item) => void)[];
2651
2651
  updated: ((item: Item) => void)[];
@@ -2660,7 +2660,7 @@ type WindowResizeObserver = globalThis.ResizeObserver;
2660
2660
 
2661
2661
  @Storybook({
2662
2662
  prefix: "Lib/DragAndDrop"
2663
- })
2663
+ })
2664
2664
  interface Coordinate {
2665
2665
  x: number;
2666
2666
  y: number;
@@ -2674,7 +2674,7 @@ type AnyElement = Aventus.TargetableElement | Aventus.ContainerElement;
2674
2674
 
2675
2675
  @Storybook({
2676
2676
  prefix: "Lib/Animation"
2677
- })
2677
+ })
2678
2678
  interface AnimationOptionsInternal {
2679
2679
  animate: Function;
2680
2680
  stopped: Function;
@@ -2752,7 +2752,7 @@ type Actions = {
2752
2752
  };
2753
2753
  }//#endregion js def //
2754
2754
  //#region js src //
2755
- {"namespace":"Aventus","available":[{"code":"if(!Object.hasOwn(window, \"AvInstance\")) {\r\n\tObject.defineProperty(window, \"AvInstance\", {\r\n\t\tget() {return Aventus?.Instance;}\r\n\t});\r\n\r\n\t(() => {\r\n\t\tMap.prototype._defaultHas = Map.prototype.has;\r\n\t\tMap.prototype._defaultSet = Map.prototype.set;\r\n\t\tMap.prototype._defaultGet = Map.prototype.get;\r\n\t\tMap.prototype.has = function(key) {\r\n\t\t\tif(Aventus.Watcher?.is(key)) {\r\n\t\t\t\treturn Map.prototype._defaultHas.call(this,key.getTarget())\r\n\t\t\t}\r\n\t\t\treturn Map.prototype._defaultHas.call(this,key);\r\n\t\t}\r\n\r\n\t\tMap.prototype.set = function(key, value) {\r\n\t\t\tif(Aventus.Watcher?.is(key)) {\r\n\t\t\t\treturn Map.prototype._defaultSet.call(this, key.getTarget(), value)\r\n\t\t\t}\r\n\t\t\treturn Map.prototype._defaultSet.call(this, key, value);\r\n\t\t}\r\n\t\tMap.prototype.get = function(key) {\r\n\t\t\tif(Aventus.Watcher?.is(key)) {\r\n\t\t\t\treturn Map.prototype._defaultGet.call(this, key.getTarget())\r\n\t\t\t}\r\n\t\t\treturn Map.prototype._defaultGet.call(this, key);\r\n\t\t}\r\n\t})();\r\n}","dependencies":[],"fullName":"!staticClass_d7c80a432731707ddadd54ea59a56049","required":true,"noNamespace":"before","type":0,"isExported":false,"convertibleName":""},{"code":" ","dependencies":[],"fullName":"!staticClass_b8b6866d7faef0c1b536e38915cc5583","required":true,"noNamespace":"before","type":0,"isExported":false,"convertibleName":""},{"code":"let Style=class Style {\n static instance;\n static noAnimation;\n static defaultStyleSheets = {\n \"@default\": `:host{display:inline-block;box-sizing:border-box}:host *{box-sizing:border-box}`,\n };\n static store(name, content) {\n this.getInstance().store(name, content);\n }\n static get(name) {\n return this.getInstance().get(name);\n }\n static getAsString(name) {\n return this.getInstance().getAsString(name);\n }\n static sheetToString(stylesheet) {\n return this.getInstance().sheetToString(stylesheet);\n }\n static load(name, url) {\n return this.getInstance().load(name, url);\n }\n static appendToHead(name) {\n if (!document.head.querySelector(`style[data-name=\"${name}\"]`)) {\n const styleNode = document.createElement('style');\n styleNode.setAttribute(`data-name`, name);\n styleNode.innerHTML = Style.getAsString(name);\n document.getElementsByTagName('head')[0].appendChild(styleNode);\n }\n }\n static refreshHead(name) {\n const styleNode = document.head.querySelector(`style[data-name=\"${name}\"]`);\n if (styleNode) {\n styleNode.innerHTML = Style.getAsString(name);\n }\n }\n static getInstance() {\n if (!this.instance) {\n this.instance = new Style();\n }\n return this.instance;\n }\n constructor() {\n for (let name in Style.defaultStyleSheets) {\n this.store(name, Style.defaultStyleSheets[name]);\n }\n Style.noAnimation = new CSSStyleSheet();\n Style.noAnimation.replaceSync(`:host{-webkit-transition: none !important;-moz-transition: none !important;-ms-transition: none !important;-o-transition: none !important;transition: none !important;}:host *{-webkit-transition: none !important;-moz-transition: none !important;-ms-transition: none !important;-o-transition: none !important;transition: none !important;}`);\n }\n stylesheets = new Map();\n async load(name, url) {\n try {\n let style = this.stylesheets.get(name);\n if (!style || style.cssRules.length == 0) {\n let txt = await (await fetch(url)).text();\n this.store(name, txt);\n }\n }\n catch (e) {\n }\n }\n store(name, content) {\n let style = this.stylesheets.get(name);\n if (!style) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(content);\n this.stylesheets.set(name, sheet);\n return sheet;\n }\n else {\n style.replaceSync(content);\n Style.refreshHead(name);\n return style;\n }\n }\n get(name) {\n let style = this.stylesheets.get(name);\n if (!style) {\n style = this.store(name, \"\");\n }\n return style;\n }\n getAsString(name) {\n return this.sheetToString(this.get(name));\n }\n sheetToString(stylesheet) {\n return stylesheet.cssRules\n ? Array.from(stylesheet.cssRules)\n .map(rule => rule.cssText || '')\n .join('\\n')\n : '';\n }\n}\nStyle.Namespace=`Aventus`;\r\n__as1(_, 'Style', Style);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.Style","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let uuidv4=function uuidv4() {\n let uid = '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, c => (Number(c) ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> Number(c) / 4).toString(16));\n return uid;\n}\n__as1(_, 'uuidv4', uuidv4);\r\n","dependencies":[],"fullName":"Aventus.uuidv4","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let sleep=function sleep(ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n__as1(_, 'sleep', sleep);\r\n","dependencies":[],"fullName":"Aventus.sleep","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let isSubclassOf=function isSubclassOf(subClass, superClass) {\n if (typeof subClass !== 'function' || typeof superClass !== 'function')\n return false;\n let proto = subClass.prototype;\n while (proto) {\n if (proto === superClass.prototype)\n return true;\n proto = Object.getPrototypeOf(proto);\n }\n return false;\n}\n__as1(_, 'isSubclassOf', isSubclassOf);\r\n","dependencies":[],"fullName":"Aventus.isSubclassOf","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let isClass=function isClass(v) {\n return typeof v === 'function' && /^\\s*class\\s+/.test(v.toString());\n}\n__as1(_, 'isClass', isClass);\r\n","dependencies":[],"fullName":"Aventus.isClass","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let setValueToObject=function setValueToObject(path, obj, value) {\n path = path.replace(/\\[(.*?)\\]/g, '.$1');\n const val = (key) => {\n if (obj instanceof Map) {\n return obj.get(key);\n }\n return obj[key];\n };\n let splitted = path.split(\".\");\n for (let i = 0; i < splitted.length - 1; i++) {\n let split = splitted[i];\n let value = val(split);\n if (!value) {\n obj[split] = {};\n value = obj[split];\n }\n obj = value;\n }\n if (obj instanceof Map) {\n obj.set(splitted[splitted.length - 1], value);\n }\n else {\n obj[splitted[splitted.length - 1]] = value;\n }\n}\n__as1(_, 'setValueToObject', setValueToObject);\r\n","dependencies":[],"fullName":"Aventus.setValueToObject","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let Mutex=class Mutex {\n /**\n * Array to store functions waiting for the mutex to become available.\n * @type {((run: boolean) => void)[]}\n */\n waitingList = [];\n /**\n * Indicates whether the mutex is currently locked or not.\n * @type {boolean}\n */\n isLocked = false;\n /**\n * Waits for the mutex to become available and then acquires it.\n * @returns {Promise<boolean>} A Promise that resolves to true if the mutex was acquired successfully.\n */\n waitOne() {\n return new Promise((resolve) => {\n if (this.isLocked) {\n this.waitingList.push((run) => {\n resolve(run);\n });\n }\n else {\n this.isLocked = true;\n resolve(true);\n }\n });\n }\n /**\n * Release the mutex\n */\n release() {\n let nextFct = this.waitingList.shift();\n if (nextFct) {\n nextFct(true);\n }\n else {\n this.isLocked = false;\n }\n }\n /**\n * Releases the mutex, allowing only the last function in the waiting list to acquire it.\n */\n releaseOnlyLast() {\n if (this.waitingList.length > 0) {\n let lastFct = this.waitingList.pop();\n for (let fct of this.waitingList) {\n fct(false);\n }\n this.waitingList = [];\n if (lastFct) {\n lastFct(true);\n }\n }\n else {\n this.isLocked = false;\n }\n }\n /**\n * Clears the mutex, removing all waiting functions and releasing the lock.\n */\n dispose() {\n this.waitingList = [];\n this.isLocked = false;\n }\n /**\n * Executes a callback function safely within the mutex lock and releases the lock afterward.\n * @template T - The type of the return value of the callback function.\n * @param {() => T} cb - The callback function to execute.\n * @returns {Promise<T | null>} A Promise that resolves to the result of the callback function or null if an error occurs.\n */\n async safeRun(cb) {\n let result = null;\n await this.waitOne();\n try {\n result = cb.apply(null, []);\n }\n catch (e) {\n console.error(e);\n }\n await this.release();\n return result;\n }\n /**\n * Executes an asynchronous callback function safely within the mutex lock and releases the lock afterward.\n * @template T - The type of the return value of the asynchronous callback function.\n * @param {() => Promise<T>} cb - The asynchronous callback function to execute.\n * @returns {Promise<T | null>} A Promise that resolves to the result of the asynchronous callback function or null if an error occurs.\n */\n async safeRunAsync(cb) {\n let result = null;\n await this.waitOne();\n try {\n result = await cb.apply(null, []);\n }\n catch (e) {\n console.error(e);\n }\n await this.release();\n return result;\n }\n /**\n * Executes a callback function safely within the mutex lock, allowing only the last function in the waiting list to acquire the lock, and releases the lock afterward.\n * @template T - The type of the return value of the callback function.\n * @param {() => T} cb - The callback function to execute.\n * @returns {Promise<T | null>} A Promise that resolves to the result of the callback function or null if an error occurs.\n */\n async safeRunLast(cb) {\n let result = null;\n if (await this.waitOne()) {\n try {\n result = cb.apply(null, []);\n }\n catch (e) {\n console.error(e);\n }\n await this.releaseOnlyLast();\n }\n return result;\n }\n /**\n * Executes an asynchronous callback function safely within the mutex lock, allowing only the last function in the waiting list to acquire the lock, and releases the lock afterward.\n * @template T - The type of the return value of the asynchronous callback function.\n * @param {() => Promise<T>} cb - The asynchronous callback function to execute.\n * @returns {Promise<T | undefined>} A Promise that resolves to the result of the asynchronous callback function or undefined if an error occurs.\n */\n async safeRunLastAsync(cb) {\n let result;\n if (await this.waitOne()) {\n try {\n result = await cb.apply(null, []);\n }\n catch (e) {\n console.error(e);\n }\n await this.releaseOnlyLast();\n }\n return result;\n }\n}\nMutex.Namespace=`Aventus`;\r\n__as1(_, 'Mutex', Mutex);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}],"fullName":"Aventus.Mutex","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ActionGuard=class ActionGuard {\n /**\n * Map to store actions that are currently running.\n * @type {Map<any[], ((res: any) => void)[]>}\n * @private\n */\n runningAction = new Map();\n run(keys, action) {\n return new Promise(async (resolve) => {\n if (typeof keys == 'function') {\n action = keys;\n keys = [];\n }\n if (!action) {\n throw \"No action inside the Mutex.run\";\n }\n let actions = undefined;\n let runningKeys = Array.from(this.runningAction.keys());\n for (let runningKey of runningKeys) {\n if (runningKey.length == keys.length) {\n let found = true;\n for (let i = 0; i < keys.length; i++) {\n if (runningKey[i] != keys[i]) {\n found = false;\n break;\n }\n }\n if (found) {\n actions = this.runningAction.get(runningKey);\n break;\n }\n }\n }\n if (actions) {\n actions.push((res) => {\n resolve(res);\n });\n }\n else {\n this.runningAction.set(keys, []);\n let res = await action();\n let actions = this.runningAction.get(keys);\n if (actions) {\n for (let action of actions) {\n action(res);\n }\n }\n this.runningAction.delete(keys);\n resolve(res);\n }\n });\n }\n}\nActionGuard.Namespace=`Aventus`;\r\n__as1(_, 'ActionGuard', ActionGuard);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}],"fullName":"Aventus.ActionGuard","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"var RamErrorCode;\n(function (RamErrorCode) {\n RamErrorCode[RamErrorCode[\"unknow\"] = 0] = \"unknow\";\n RamErrorCode[RamErrorCode[\"noId\"] = 1] = \"noId\";\n RamErrorCode[RamErrorCode[\"noItemInsideRam\"] = 2] = \"noItemInsideRam\";\n})(RamErrorCode || (RamErrorCode = {}));\n__as1(_, 'RamErrorCode', RamErrorCode);\r\n","dependencies":[],"fullName":"Aventus.RamErrorCode","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"let ResourceLoader=class ResourceLoader {\n static headerLoaded = {};\n static headerWaiting = {};\n /**\n * Load the resource inside the head tag\n */\n static async loadInHead(options) {\n const _options = this.prepareOptions(options);\n if (this.headerLoaded[_options.url]) {\n return true;\n }\n else if (this.headerWaiting.hasOwnProperty(_options.url)) {\n return await this.awaitFctHead(_options.url);\n }\n else {\n this.headerWaiting[_options.url] = [];\n let tagEl;\n if (_options.type == \"js\") {\n tagEl = document.createElement(\"SCRIPT\");\n }\n else if (_options.type == \"css\") {\n tagEl = document.createElement(\"LINK\");\n tagEl.setAttribute(\"rel\", \"stylesheet\");\n }\n else {\n throw \"unknow type \" + _options.type + \" to append into head\";\n }\n if (_options.nonce) {\n tagEl.setAttribute(\"nonce\", _options.nonce);\n }\n document.head.appendChild(tagEl);\n let result = await this.loadTag(tagEl, _options.url);\n this.headerLoaded[_options.url] = true;\n this.releaseAwaitFctHead(_options.url, result);\n return result;\n }\n }\n static loadTag(tagEl, url) {\n return new Promise((resolve, reject) => {\n tagEl.addEventListener(\"load\", (e) => {\n resolve(true);\n });\n tagEl.addEventListener(\"error\", (e) => {\n resolve(false);\n });\n if (tagEl instanceof HTMLLinkElement) {\n tagEl.setAttribute(\"href\", url);\n }\n else {\n tagEl.setAttribute('src', url);\n }\n });\n }\n static releaseAwaitFctHead(url, result) {\n if (this.headerWaiting[url]) {\n for (let i = 0; i < this.headerWaiting[url].length; i++) {\n this.headerWaiting[url][i](result);\n }\n delete this.headerWaiting[url];\n }\n }\n static awaitFctHead(url) {\n return new Promise((resolve) => {\n this.headerWaiting[url].push((result) => {\n resolve(result);\n });\n });\n }\n static requestLoaded = {};\n static requestWaiting = {};\n /**\n *\n */\n static async load(options) {\n options = this.prepareOptions(options);\n if (this.requestLoaded[options.url]) {\n return this.requestLoaded[options.url];\n }\n else if (this.requestWaiting.hasOwnProperty(options.url)) {\n await this.awaitFct(options.url);\n return this.requestLoaded[options.url];\n }\n else {\n this.requestWaiting[options.url] = [];\n let blob = false;\n if (options.type == \"img\") {\n blob = true;\n }\n let content = await this.fetching(options.url, blob);\n if (options.type == \"img\" && content.startsWith(\"data:text/html;\")) {\n console.error(\"Can't load img \" + options.url);\n content = \"\";\n }\n this.requestLoaded[options.url] = content;\n this.releaseAwaitFct(options.url);\n return content;\n }\n }\n static releaseAwaitFct(url) {\n if (this.requestWaiting[url]) {\n for (let i = 0; i < this.requestWaiting[url].length; i++) {\n this.requestWaiting[url][i]();\n }\n delete this.requestWaiting[url];\n }\n }\n static awaitFct(url) {\n return new Promise((resolve) => {\n this.requestWaiting[url].push(() => {\n resolve('');\n });\n });\n }\n static async fetching(url, useBlob = false) {\n if (useBlob) {\n let result = await fetch(url, {\n headers: {\n responseType: 'blob'\n }\n });\n let blob = await result.blob();\n return await this.readFile(blob);\n }\n else {\n let result = await fetch(url);\n return await result.text();\n }\n }\n static readFile(blob) {\n return new Promise((resolve) => {\n var reader = new FileReader();\n reader.onloadend = function () {\n resolve(reader.result);\n };\n reader.readAsDataURL(blob);\n });\n }\n static imgExtensions = [\"png\", \"jpg\", \"jpeg\", \"gif\"];\n static prepareOptions(options) {\n let result;\n if (typeof options === 'string' || options instanceof String) {\n result = {\n url: options,\n type: 'js'\n };\n let splittedURI = result.url.split('.');\n let extension = splittedURI[splittedURI.length - 1];\n extension = extension.split(\"?\")[0];\n if (extension == \"svg\") {\n result.type = 'svg';\n }\n else if (extension == \"js\") {\n result.type = 'js';\n }\n else if (extension == \"css\") {\n result.type = 'css';\n }\n else if (this.imgExtensions.indexOf(extension) != -1) {\n result.type = 'img';\n }\n else {\n delete result.type;\n }\n }\n else {\n result = options;\n }\n return result;\n }\n}\nResourceLoader.Namespace=`Aventus`;\r\n__as1(_, 'ResourceLoader', ResourceLoader);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ResourceLoaderHeadOptions","isStrong":false},{"fullName":"Aventus.ResourceLoaderOptions","isStrong":false}],"fullName":"Aventus.ResourceLoader","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let DragElementXYType= [SVGGElement, SVGRectElement, SVGEllipseElement, SVGTextElement];\n__as1(_, 'DragElementXYType', DragElementXYType);\r\n","dependencies":[],"fullName":"Aventus.DragElementXYType","required":false,"type":5,"isExported":true,"convertibleName":""},{"code":"let DragElementLeftTopType= [HTMLElement, SVGSVGElement];\n__as1(_, 'DragElementLeftTopType', DragElementLeftTopType);\r\n","dependencies":[],"fullName":"Aventus.DragElementLeftTopType","required":false,"type":5,"isExported":true,"convertibleName":""},{"code":"let NormalizedEvent=class NormalizedEvent {\n _event;\n get event() {\n return this._event;\n }\n constructor(event) {\n this._event = event;\n }\n getProp(prop) {\n if (prop in this.event) {\n return this.event[prop];\n }\n return undefined;\n }\n stopImmediatePropagation() {\n this.event.stopImmediatePropagation();\n }\n get clientX() {\n if ('clientX' in this.event) {\n return this.event.clientX;\n }\n else if ('touches' in this.event && this.event.touches.length > 0) {\n return this.event.touches[0].clientX;\n }\n return 0;\n }\n get clientY() {\n if ('clientY' in this.event) {\n return this.event.clientY;\n }\n else if ('touches' in this.event && this.event.touches.length > 0) {\n return this.event.touches[0].clientY;\n }\n return 0;\n }\n get pageX() {\n if ('pageX' in this.event) {\n return this.event.pageX;\n }\n else if ('touches' in this.event && this.event.touches.length > 0) {\n return this.event.touches[0].pageX;\n }\n return 0;\n }\n get pageY() {\n if ('pageY' in this.event) {\n return this.event.pageY;\n }\n else if ('touches' in this.event && this.event.touches.length > 0) {\n return this.event.touches[0].pageY;\n }\n return 0;\n }\n get type() {\n return this.event.type;\n }\n get target() {\n return this.event.target;\n }\n get timeStamp() {\n return this.event.timeStamp;\n }\n get pointerType() {\n if ('TouchEvent' in window && this._event instanceof TouchEvent)\n return \"touch\";\n return this.getProp(\"pointerType\");\n }\n get button() {\n return this.getProp(\"button\");\n }\n get isTouch() {\n if ('TouchEvent' in window && this._event instanceof TouchEvent)\n return true;\n return this._event.pointerType == \"touch\";\n }\n}\nNormalizedEvent.Namespace=`Aventus`;\r\n__as1(_, 'NormalizedEvent', NormalizedEvent);\r\n","dependencies":[{"fullName":"T","isStrong":false}],"fullName":"Aventus.NormalizedEvent","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Callback=class Callback {\n callbacks = new Map();\n /**\n * Clear all callbacks\n */\n clear() {\n this.callbacks.clear();\n }\n /**\n * Add a callback\n */\n add(cb, scope = null) {\n if (!this.callbacks.has(cb)) {\n this.callbacks.set(cb, scope);\n }\n }\n /**\n * Remove a callback\n */\n remove(cb) {\n this.callbacks.delete(cb);\n }\n /**\n * Trigger all callbacks\n */\n trigger(...args) {\n let result = [];\n let cbs = [...this.callbacks];\n for (let [cb, scope] of cbs) {\n result.push(cb.apply(scope, args));\n }\n return result;\n }\n}\nCallback.Namespace=`Aventus`;\r\n__as1(_, 'Callback', Callback);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.Callback","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let CallbackGroup=class CallbackGroup {\n callbacks = {};\n /**\n * Clear all callbacks\n */\n clearAll() {\n this.callbacks = {};\n }\n /**\n * Clear all callbacks for a specific group\n */\n clear(group) {\n delete this.callbacks[group];\n }\n /**\n * Add a callback for a group\n */\n add(group, cb, scope = null) {\n if (!this.callbacks[group]) {\n this.callbacks[group] = new Map();\n }\n if (!this.callbacks[group].has(cb)) {\n this.callbacks[group].set(cb, scope);\n }\n }\n /**\n * Remove a callback for a group\n */\n remove(group, cb) {\n if (this.callbacks[group]) {\n this.callbacks[group].delete(cb);\n }\n }\n /**\n * Trigger all callbacks inside a group\n */\n trigger(group, ...args) {\n if (this.callbacks[group]) {\n let cbs = [...this.callbacks[group]];\n for (let [cb, scope] of cbs) {\n cb.apply(scope, args);\n }\n }\n }\n}\nCallbackGroup.Namespace=`Aventus`;\r\n__as1(_, 'CallbackGroup', CallbackGroup);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.CallbackGroup","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Resource=class Resource {\n}\nResource.Namespace=`Aventus`;\r\n__as1(_, 'Resource', Resource);\r\n","dependencies":[],"fullName":"Aventus.Resource","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Request=class Request {\n}\nRequest.Namespace=`Aventus`;\r\n__as1(_, 'Request', Request);\r\n","dependencies":[],"fullName":"Aventus.Request","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let compareObject=function compareObject(obj1, obj2, tableOrder = true) {\n if (Array.isArray(obj1)) {\n if (!Array.isArray(obj2)) {\n return false;\n }\n obj2 = obj2.slice();\n if (obj1.length !== obj2.length) {\n return false;\n }\n if (tableOrder) {\n for (let i = 0; i < obj1.length; i++) {\n if (!compareObject(obj1[i], obj2[i])) {\n return false;\n }\n }\n return true;\n }\n else {\n for (let i = 0; i < obj1.length; i++) {\n let foundElement = false;\n for (let j = 0; j < obj2.length; j++) {\n if (compareObject(obj1[i], obj2[j])) {\n obj2.splice(j, 1);\n foundElement = true;\n break;\n }\n }\n if (!foundElement) {\n return false;\n }\n }\n }\n return true;\n }\n else if (typeof obj1 === 'object' && obj1 !== undefined && obj1 !== null) {\n if (typeof obj2 !== 'object' || obj2 === undefined || obj2 === null) {\n return false;\n }\n if (obj1 == obj2) {\n return true;\n }\n if (obj1 instanceof HTMLElement || obj2 instanceof HTMLElement) {\n return false;\n }\n if (obj1 instanceof Date || obj2 instanceof Date) {\n return obj1.toString() === obj2.toString();\n }\n let oneProxy = false;\n if (Watcher.is(obj1)) {\n oneProxy = true;\n obj1 = Watcher.extract(obj1, false);\n }\n if (Watcher.is(obj2)) {\n oneProxy = true;\n obj2 = Watcher.extract(obj2, false);\n }\n if (obj1 instanceof Map && obj2 instanceof Map) {\n if (obj1.size != obj2.size) {\n return false;\n }\n const keys = obj1.keys();\n for (let key in keys) {\n if (!obj2.has(key)) {\n return false;\n }\n if (!compareObject(obj1.get(key), obj2.get(key))) {\n return false;\n }\n }\n return true;\n }\n else {\n if (Object.keys(obj1).length !== Object.keys(obj2).length) {\n return false;\n }\n for (let key in obj1) {\n if (oneProxy && Watcher['__reservedName'][key]) {\n continue;\n }\n if (!(key in obj2)) {\n return false;\n }\n if (!compareObject(obj1[key], obj2[key])) {\n return false;\n }\n }\n return true;\n }\n }\n else {\n return obj1 === obj2;\n }\n}\n__as1(_, 'compareObject', compareObject);\r\n","dependencies":[{"fullName":"Aventus.Watcher","isStrong":false}],"fullName":"Aventus.compareObject","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let getValueFromObject=function getValueFromObject(path, obj) {\n if (path === undefined) {\n path = '';\n }\n path = path.replace(/\\[(.*?)\\]/g, '.$1');\n if (path == \"\") {\n return obj;\n }\n const val = (key) => {\n if (obj instanceof Map) {\n return obj.get(key);\n }\n return obj[key];\n };\n let splitted = path.split(\".\");\n for (let i = 0; i < splitted.length - 1; i++) {\n let split = splitted[i];\n let value = val(split);\n if (!value || typeof value !== 'object') {\n return undefined;\n }\n obj = value;\n }\n if (!obj || typeof obj !== 'object') {\n return undefined;\n }\n return val(splitted[splitted.length - 1]);\n}\n__as1(_, 'getValueFromObject', getValueFromObject);\r\n","dependencies":[],"fullName":"Aventus.getValueFromObject","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"var WatchAction;\n(function (WatchAction) {\n WatchAction[WatchAction[\"CREATED\"] = 0] = \"CREATED\";\n WatchAction[WatchAction[\"UPDATED\"] = 1] = \"UPDATED\";\n WatchAction[WatchAction[\"DELETED\"] = 2] = \"DELETED\";\n})(WatchAction || (WatchAction = {}));\n__as1(_, 'WatchAction', WatchAction);\r\n","dependencies":[],"fullName":"Aventus.WatchAction","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"let Async=function Async(el) {\n return new Promise((resolve) => {\n if (el instanceof Promise) {\n el.then(resolve);\n }\n else {\n resolve(el);\n }\n });\n}\n__as1(_, 'Async', Async);\r\n","dependencies":[{"fullName":"Aventus.Asyncable","isStrong":false}],"fullName":"Aventus.Async","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"var HttpMethod;\n(function (HttpMethod) {\n HttpMethod[\"GET\"] = \"GET\";\n HttpMethod[\"POST\"] = \"POST\";\n HttpMethod[\"DELETE\"] = \"DELETE\";\n HttpMethod[\"PUT\"] = \"PUT\";\n HttpMethod[\"OPTION\"] = \"OPTION\";\n})(HttpMethod || (HttpMethod = {}));\n__as1(_, 'HttpMethod', HttpMethod);\r\n","dependencies":[],"fullName":"Aventus.HttpMethod","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"var HttpErrorCode;\n(function (HttpErrorCode) {\n HttpErrorCode[HttpErrorCode[\"unknow\"] = 0] = \"unknow\";\n})(HttpErrorCode || (HttpErrorCode = {}));\n__as1(_, 'HttpErrorCode', HttpErrorCode);\r\n","dependencies":[],"fullName":"Aventus.HttpErrorCode","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"let DateConverter=class DateConverter {\n static __converter = new DateConverter();\n static get converter() {\n return this.__converter;\n }\n static set converter(value) {\n this.__converter = value;\n }\n isStringDate(txt) {\n return /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d{3,6})Z$/.exec(txt) !== null;\n }\n fromString(txt) {\n return new Date(txt);\n }\n toString(date) {\n if (date.getFullYear() < 100) {\n return \"0001-01-01T00:00:00.000Z\";\n }\n return date.toISOString();\n }\n}\nDateConverter.Namespace=`Aventus`;\r\n__as1(_, 'DateConverter', DateConverter);\r\n","dependencies":[],"fullName":"Aventus.DateConverter","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Json=class Json {\n /**\n * Converts a JavaScript class instance to a JSON object.\n * @template T - The type of the object to convert.\n * @param {T} obj - The object to convert to JSON.\n * @param {JsonToOptions} [options] - Options for JSON conversion.\n * @returns {{ [key: string | number]: any; }} Returns the JSON representation of the object.\n */\n static classToJson(obj, options) {\n const realOptions = {\n isValidKey: options?.isValidKey ?? (() => true),\n replaceKey: options?.replaceKey ?? ((key) => key),\n transformValue: options?.transformValue ?? ((key, value) => value),\n beforeEnd: options?.beforeEnd ?? ((res) => res)\n };\n return this.__classToJson(obj, realOptions);\n }\n static __classToJson(obj, options) {\n let result = {};\n let descriptors = Object.getOwnPropertyDescriptors(obj);\n for (let key in descriptors) {\n if (options.isValidKey(key))\n result[options.replaceKey(key)] = options.transformValue(key, descriptors[key].value);\n }\n let cst = obj.constructor;\n while (cst.prototype && cst != Object.prototype) {\n let descriptorsClass = Object.getOwnPropertyDescriptors(cst.prototype);\n for (let key in descriptorsClass) {\n if (options.isValidKey(key)) {\n let descriptor = descriptorsClass[key];\n if (descriptor?.get) {\n const o = obj;\n result[options.replaceKey(key)] = options.transformValue(key, o[key]);\n }\n }\n }\n cst = Object.getPrototypeOf(cst);\n }\n result = options.beforeEnd(result);\n return result;\n }\n /**\n * Converts a JSON object to a JavaScript class instance.\n * @template T - The type of the object to convert.\n * @param {T} obj - The object to populate with JSON data.\n * @param {*} data - The JSON data to populate the object with.\n * @param {JsonFromOptions} [options] - Options for JSON deserialization.\n * @returns {T} Returns the populated object.\n */\n static classFromJson(obj, data, options) {\n let realOptions = {\n transformValue: options?.transformValue ?? ((key, value) => value),\n replaceUndefined: options?.replaceUndefined ?? false,\n replaceUndefinedWithKey: options?.replaceUndefinedWithKey ?? false,\n };\n return this.__classFromJson(obj, data, realOptions);\n }\n static __classFromJson(obj, data, options) {\n let props = Object.getOwnPropertyNames(obj);\n for (let prop of props) {\n let propUpperFirst = prop[0].toUpperCase() + prop.slice(1);\n let value = data[prop] === undefined ? data[propUpperFirst] : data[prop];\n if (value !== undefined || options.replaceUndefined || (options.replaceUndefinedWithKey && (Object.hasOwn(data, prop) || Object.hasOwn(data, propUpperFirst)))) {\n let propInfo = Object.getOwnPropertyDescriptor(obj, prop);\n if (propInfo?.writable) {\n const o = obj;\n o[prop] = options.transformValue(prop, value);\n }\n }\n }\n let cstTemp = obj.constructor;\n while (cstTemp.prototype && cstTemp != Object.prototype) {\n props = Object.getOwnPropertyNames(cstTemp.prototype);\n for (let prop of props) {\n let propUpperFirst = prop[0].toUpperCase() + prop.slice(1);\n let value = data[prop] === undefined ? data[propUpperFirst] : data[prop];\n if (value !== undefined || options.replaceUndefined || (options.replaceUndefinedWithKey && (Object.hasOwn(data, prop) || Object.hasOwn(data, propUpperFirst)))) {\n let propInfo = Object.getOwnPropertyDescriptor(cstTemp.prototype, prop);\n if (propInfo?.set) {\n const o = obj;\n o[prop] = options.transformValue(prop, value);\n }\n }\n }\n cstTemp = Object.getPrototypeOf(cstTemp);\n }\n return obj;\n }\n}\nJson.Namespace=`Aventus`;\r\n__as1(_, 'Json', Json);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.JsonToOptions","isStrong":false},{"fullName":"Aventus.JsonFromOptions","isStrong":false}],"fullName":"Aventus.Json","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ConverterTransform=class ConverterTransform {\n transform(data) {\n return this.transformLoop(data);\n }\n createInstance(data) {\n if (data.$type) {\n let cst = Converter.info.get(data.$type);\n if (cst) {\n return new cst();\n }\n }\n return undefined;\n }\n beforeTransformObject(obj) {\n }\n afterTransformObject(obj) {\n }\n transformLoop(data) {\n if (data === null) {\n return data;\n }\n if (Array.isArray(data)) {\n let result = [];\n for (let element of data) {\n result.push(this.transformLoop(element));\n }\n return result;\n }\n if (data instanceof Date) {\n return data;\n }\n if (typeof data === 'object' && !/^\\s*class\\s+/.test(data.toString())) {\n let objTemp = this.createInstance(data);\n if (objTemp) {\n if (objTemp instanceof Map) {\n if (data.values) {\n for (const keyValue of data.values) {\n objTemp.set(this.transformLoop(keyValue[0]), this.transformLoop(keyValue[1]));\n }\n }\n return objTemp;\n }\n let obj = objTemp;\n this.beforeTransformObject(obj);\n if (obj.fromJSON) {\n obj = obj.fromJSON(data);\n }\n else {\n obj = Json.classFromJson(obj, data, {\n transformValue: (key, value) => {\n if (obj[key] instanceof Date) {\n return value ? new Date(value) : null;\n }\n else if (typeof value == 'string' && DateConverter.converter.isStringDate(value)) {\n return value ? DateConverter.converter.fromString(value) : null;\n }\n else if (obj[key] instanceof Map) {\n let map = new Map();\n if (\"$type\" in value && value['$type'] == \"Aventus.Map\") {\n value = value.values;\n }\n for (const keyValue of value) {\n map.set(this.transformLoop(keyValue[0]), this.transformLoop(keyValue[1]));\n }\n return map;\n }\n else if (obj instanceof Data) {\n let cst = obj.constructor;\n if (cst.$schema[key] == 'boolean') {\n return value ? true : false;\n }\n else if (cst.$schema[key] == 'number') {\n return isNaN(Number(value)) ? 0 : Number(value);\n }\n else if (cst.$schema[key] == 'number') {\n return isNaN(Number(value)) ? 0 : Number(value);\n }\n else if (cst.$schema[key] == 'Date') {\n return value ? new Date(value) : null;\n }\n }\n return this.transformLoop(value);\n }\n });\n }\n this.afterTransformObject(obj);\n return obj;\n }\n let result = {};\n for (let key in data) {\n result[key] = this.transformLoop(data[key]);\n }\n return result;\n }\n if (typeof data == 'string' && /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d{3})Z$/.exec(data)) {\n return new Date(data);\n }\n return data;\n }\n copyValuesClass(target, src, options) {\n const realOptions = {\n isValidKey: options?.isValidKey ?? (() => true),\n replaceKey: options?.replaceKey ?? ((key) => key),\n transformValue: options?.transformValue ?? ((key, value) => value),\n };\n this.__classCopyValues(target, src, realOptions);\n }\n __classCopyValues(target, src, options) {\n let props = Object.getOwnPropertyNames(target);\n for (let prop of props) {\n let propInfo = Object.getOwnPropertyDescriptor(target, prop);\n if (propInfo?.writable) {\n if (options.isValidKey(prop)) {\n const _target = target;\n const _src = src;\n _target[options.replaceKey(prop)] = options.transformValue(prop, _src[prop]);\n }\n }\n }\n let cstTemp = target.constructor;\n while (cstTemp.prototype && cstTemp != Object.prototype) {\n props = Object.getOwnPropertyNames(cstTemp.prototype);\n for (let prop of props) {\n let propInfo = Object.getOwnPropertyDescriptor(cstTemp.prototype, prop);\n if (propInfo?.set && propInfo.get) {\n if (options.isValidKey(prop)) {\n const _target = target;\n const _src = src;\n _target[options.replaceKey(prop)] = options.transformValue(prop, _src[prop]);\n }\n }\n }\n cstTemp = Object.getPrototypeOf(cstTemp);\n }\n }\n}\nConverterTransform.Namespace=`Aventus`;\r\n__as1(_, 'ConverterTransform', ConverterTransform);\r\n","dependencies":[{"fullName":"Aventus.IConverterTransform","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.Converter","isStrong":false},{"fullName":"Aventus.Json","isStrong":false},{"fullName":"Aventus.DateConverter","isStrong":false},{"fullName":"Aventus.ClassCopyOptions","isStrong":false},{"fullName":"Aventus.Data","isStrong":false}],"fullName":"Aventus.ConverterTransform","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Converter=class Converter {\n /**\n * Map storing information about registered types.\n */\n static info = new Map([[\"Aventus.Map\", Map]]);\n /**\n * Map storing schemas for registered types.\n */\n static schema = new Map();\n /**\n * Internal converter instance.\n */\n static __converter = new ConverterTransform();\n /**\n * Getter for the internal converter instance.\n */\n static get converterTransform() {\n return this.__converter;\n }\n /**\n * Sets the converter instance.\n * @param converter The converter instance to set.\n */\n static setConverter(converter) {\n this.__converter = converter;\n }\n /**\n * Registers a unique string type for any class.\n * @param $type The unique string type identifier.\n * @param cst The constructor function for the class.\n * @param schema Optional schema for the registered type.\n */\n static register($type, cst, schema) {\n this.info.set($type, cst);\n if (schema) {\n this.schema.set($type, schema);\n }\n }\n /**\n * Transforms the provided data using the current converter instance.\n * @template T\n * @param {*} data The data to transform.\n * @param {IConverterTransform} [converter] Optional converter instance to use for transformation.\n * @returns {T} Returns the transformed data.\n */\n static transform(data, converter) {\n if (!converter) {\n converter = this.converterTransform;\n }\n return converter.transform(data);\n }\n /**\n * Copies values from one class instance to another using the current converter instance.\n * @template T\n * @param {T} to The destination class instance to copy values into.\n * @param {T} from The source class instance to copy values from.\n * @param {ClassCopyOptions} [options] Optional options for the copy operation.\n * @param {IConverterTransform} [converter] Optional converter instance to use for the copy operation.\n * @returns {T} Returns the destination class instance with copied values.\n */\n static copyValuesClass(to, from, options, converter) {\n if (!converter) {\n converter = this.converterTransform;\n }\n return converter.copyValuesClass(to, from, options);\n }\n}\nConverter.Namespace=`Aventus`;\r\n__as1(_, 'Converter', Converter);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Schema","isStrong":true},{"fullName":"Aventus.IConverterTransform","isStrong":true},{"fullName":"Aventus.ConverterTransform","isStrong":true},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ClassCopyOptions","isStrong":false}],"fullName":"Aventus.Converter","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let clone=function clone(item) {\n return Converter.transform(JSON.parse(JSON.stringify(item)));\n}\n__as1(_, 'clone', clone);\r\n","dependencies":[{"fullName":"Aventus.Converter","isStrong":false}],"fullName":"Aventus.clone","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let HttpResponse=class HttpResponse {\n get status() {\n return this.response.status;\n }\n get statusText() {\n return this.response.statusText;\n }\n get redirected() {\n return this.response.redirected;\n }\n get ok() {\n return this.response.ok;\n }\n get type() {\n return this.response.type;\n }\n get url() {\n return this.response.url;\n }\n get headers() {\n return this.response.headers;\n }\n response;\n constructor(response) {\n this.response = response;\n }\n bodyUsed = false;\n bodyContent;\n async json() {\n if (!this.bodyUsed) {\n this.bodyUsed = true;\n this.bodyContent = await this.response.json();\n }\n return Converter.transform(this.bodyContent);\n }\n async blob() {\n if (!this.bodyUsed) {\n this.bodyUsed = true;\n this.bodyContent = await this.response.blob();\n }\n return this.bodyContent;\n }\n async text() {\n if (!this.bodyUsed) {\n this.bodyUsed = true;\n this.bodyContent = await this.response.text();\n }\n return this.bodyContent;\n }\n}\nHttpResponse.Namespace=`Aventus`;\r\n__as1(_, 'HttpResponse', HttpResponse);\r\n","dependencies":[{"fullName":"T","isStrong":false},{"fullName":"Aventus.Converter","isStrong":false}],"fullName":"Aventus.HttpResponse","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Data=// @Dependencies([{ type: Aventus.Converter, strong: true }, { type: Converter, strong: true }])\nclass Data {\n static converter = new Converter();\n /**\n * The schema for the class\n */\n static $schema;\n /**\n * The current namespace\n */\n static Namespace = \"\";\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n static get Fullname() { return this.Namespace + \".\" + this.name; }\n /**\n * The current namespace\n */\n get namespace() {\n return this.constructor['Namespace'];\n }\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n get $type() {\n return this.constructor['Fullname'];\n }\n /**\n * Get the name of the class\n */\n get className() {\n return this.constructor.name;\n }\n /**\n * Get a JSON for the current object\n */\n toJSON() {\n let toAvoid = ['className', 'namespace'];\n return Json.classToJson(this, {\n isValidKey: (key) => !toAvoid.includes(key)\n });\n }\n /**\n * Clone the object by transforming a parsed JSON string back into the original type\n */\n clone() {\n return Converter.transform(JSON.parse(JSON.stringify(this)));\n }\n}\nData.Namespace=`Aventus`;\r\nData.$schema={\"namespace\":\"string\",\"$type\":\"string\",\"className\":\"string\"};\r\nConverter.register(Data.Fullname, Data);\r\n__as1(_, 'Data', Data);\r\n","dependencies":[{"fullName":"Aventus.IData","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Converter","isStrong":true},{"fullName":"Aventus.Json","isStrong":false}],"fullName":"Aventus.Data","required":false,"type":2,"isExported":true,"convertibleName":""},{"code":"let HttpCache=class HttpCache {\n static cache = new Map();\n static async fetch(fullUrl, request) {\n const key = this.generateCacheKey(fullUrl, request);\n if (key) {\n const value = this.cache.get(key);\n if (value)\n return value;\n }\n const result = await fetch(fullUrl, request);\n const response = new HttpResponse(result);\n if (key)\n this.cache.set(key, response);\n return response;\n }\n static clear(fullUrl, request) {\n const key = this.generateCacheKey(fullUrl, request);\n if (key) {\n if (this.cache.has(key)) {\n this.cache.delete(key);\n }\n }\n }\n static generateCacheKey(fullUrl, request) {\n const method = request.method;\n const body = request.body;\n let bodyKey = \"\";\n if (typeof body == 'string') {\n bodyKey = this.hashStringToInt(body) + '';\n }\n else if (body instanceof FormData) {\n }\n return fullUrl + \"°\" + method + \"°\" + bodyKey;\n }\n static hashStringToInt(str) {\n let hash = 0x811c9dc5;\n for (let i = 0; i < str.length; i++) {\n hash ^= str.charCodeAt(i);\n hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24);\n }\n return hash >>> 0;\n }\n}\nHttpCache.Namespace=`Aventus`;\r\n__as1(_, 'HttpCache', HttpCache);\r\n","dependencies":[{"fullName":"Aventus.HttpResponse","isStrong":true}],"fullName":"Aventus.HttpCache","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let GenericError=// @Dependencies([{ type: Aventus.Converter, strong: true }, { type: Converter, strong: true }])\nclass GenericError {\n static converter = new Converter();\n static get Fullname() { return \"Aventus.GenericError\"; }\n /**\n * Code for the error\n */\n code;\n /**\n * Description of the error\n */\n message;\n /**\n * Additional details related to the error.\n */\n details = [];\n /**\n * Creates a new instance of GenericError.\n * @param {EnumValue<T>} code - The error code.\n * @param {string | Error | unknown} message - The error message.\n */\n constructor(code, message) {\n this.code = code;\n if (message instanceof Error) {\n this.message = message.message;\n }\n else {\n this.message = message + '';\n }\n }\n}\nGenericError.Namespace=`Aventus`;\r\nGenericError.$schema={\"code\":\"Aventus.EnumValue\",\"message\":\"string\"};\r\nConverter.register(GenericError.Fullname, GenericError);\r\n__as1(_, 'GenericError', GenericError);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Convertible","isStrong":false},{"fullName":"Aventus.Enum","isStrong":false},{"fullName":"Aventus.Converter","isStrong":true},{"fullName":"Aventus.EnumValue","isStrong":false}],"fullName":"Aventus.GenericError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let VoidWithError=class VoidWithError {\n static get Fullname() { return \"Aventus.VoidWithError\"; }\n /**\n * Determine if the action is a success\n */\n get success() {\n return this.errors.length == 0;\n }\n /**\n * List of errors\n */\n errors = [];\n /**\n * Converts the current instance to a VoidWithError object.\n * @returns {VoidWithError} A new instance of VoidWithError with the same error list.\n */\n toGeneric() {\n const result = new VoidWithError();\n result.errors = this.errors;\n return result;\n }\n /**\n * Checks if the error list contains a specific error code.\n * @template U - The type of error, extending GenericError.\n * @template T - The type of the error code, which extends either number or Enum.\n * @param {EnumValue<T>} code - The error code to check for.\n * @param {new (...args: any[]) => U} [type] - Optional constructor function of the error type.\n * @returns {boolean} True if the error list contains the specified error code, otherwise false.\n */\n containsCode(code, type) {\n if (type) {\n for (let error of this.errors) {\n if (error instanceof type) {\n if (error.code == code) {\n return true;\n }\n }\n }\n }\n else {\n for (let error of this.errors) {\n if (error.code == code) {\n return true;\n }\n }\n }\n return false;\n }\n run(fct) {\n if (this.success) {\n let result = fct();\n if (!Array.isArray(result)) {\n result = result.errors;\n }\n if (result.length > 0) {\n this.errors = [...this.errors, ...result];\n }\n }\n return this;\n }\n async runAsync(fct) {\n if (this.success) {\n let result = await fct();\n if (!Array.isArray(result)) {\n result = result.errors;\n }\n if (result.length > 0) {\n this.errors = [...this.errors, ...result];\n }\n }\n return this;\n }\n extract(fct) {\n if (this.success) {\n let result = fct();\n if (result.success && result.result) {\n return result.result;\n }\n this.errors = [...this.errors, ...result.errors];\n }\n return undefined;\n }\n async extractAsync(fct) {\n if (this.success) {\n let result = await fct();\n if (result.success && result.result) {\n return result.result;\n }\n this.errors = [...this.errors, ...result.errors];\n }\n return undefined;\n }\n}\nVoidWithError.Namespace=`Aventus`;\r\nVoidWithError.$schema={\"success\":\"boolean\",\"errors\":\"T[]\"};\r\nConverter.register(VoidWithError.Fullname, VoidWithError);\r\n__as1(_, 'VoidWithError', VoidWithError);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Convertible","isStrong":false},{"fullName":"Aventus.GenericError","isStrong":false},{"fullName":"Aventus.Enum","isStrong":false},{"fullName":"Aventus.EnumValue","isStrong":false},{"fullName":"U","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"X","isStrong":false}],"fullName":"Aventus.VoidWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let ResultWithError=class ResultWithError extends VoidWithError {\n static get Fullname() { return \"Aventus.ResultWithError\"; }\n /**\n * The result value of the action.\n * @type {U | undefined}\n */\n result;\n /**\n * Converts the current instance to a ResultWithError object.\n * @returns {ResultWithError<U>} A new instance of ResultWithError with the same error list and result value.\n */\n toGeneric() {\n const result = new ResultWithError();\n result.errors = this.errors;\n result.result = this.result;\n return result;\n }\n run(fct) {\n if (this.success) {\n let result = fct();\n if (!Array.isArray(result)) {\n result = result.errors;\n }\n if (result.length > 0) {\n this.errors = [...this.errors, ...result];\n }\n if (result instanceof ResultWithError && result.success && result.result) {\n this.result = result.result;\n }\n }\n return this;\n }\n async runAsync(fct) {\n if (this.success) {\n let result = await fct();\n if (!Array.isArray(result)) {\n result = result.errors;\n }\n if (result.length > 0) {\n this.errors = [...this.errors, ...result];\n }\n if (result instanceof ResultWithError && result.success && result.result) {\n this.result = result.result;\n }\n }\n return this;\n }\n}\nResultWithError.Namespace=`Aventus`;\r\nResultWithError.$schema={...(VoidWithError?.$schema ?? {}), };\r\nConverter.register(ResultWithError.Fullname, ResultWithError);\r\n__as1(_, 'ResultWithError', ResultWithError);\r\n","dependencies":[{"fullName":"Aventus.VoidWithError","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Convertible","isStrong":false},{"fullName":"Aventus.GenericError","isStrong":false}],"fullName":"Aventus.ResultWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let HttpError=class HttpError extends GenericError {\n}\nHttpError.Namespace=`Aventus`;\r\nHttpError.$schema={...(GenericError?.$schema ?? {}), };\r\nConverter.register(HttpError.Fullname, HttpError);\r\n__as1(_, 'HttpError', HttpError);\r\n","dependencies":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"Aventus.HttpErrorCode","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.HttpError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let Signal=class Signal {\n __subscribes = [];\n _value;\n _onChange;\n get value() {\n Watcher._register?.register(this, \"*\", Watcher._register.version, \"*\");\n return this._value;\n }\n set value(item) {\n const oldValue = this._value;\n this._value = item;\n if (oldValue != item) {\n if (this._onChange) {\n this._onChange();\n }\n for (let fct of this.__subscribes) {\n fct(WatchAction.UPDATED, \"*\", item, []);\n }\n }\n }\n constructor(item, onChange) {\n this._value = item;\n this._onChange = onChange;\n }\n subscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index == -1) {\n this.__subscribes.push(fct);\n }\n }\n unsubscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index > -1) {\n this.__subscribes.splice(index, 1);\n }\n }\n destroy() {\n this.__subscribes = [];\n }\n}\nSignal.Namespace=`Aventus`;\r\n__as1(_, 'Signal', Signal);\r\n","dependencies":[{"fullName":"Aventus.EffectReceiver","isStrong":true},{"fullName":"Aventus.WatcherChange","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}],"fullName":"Aventus.Signal","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Effect=class Effect {\n callbacks = [];\n isInit = false;\n isDestroy = false;\n __subscribes = [];\n __allowChanged = [];\n version = 0;\n fct;\n constructor(fct) {\n this.fct = fct;\n if (this.autoInit()) {\n this.init();\n }\n }\n autoInit() {\n return true;\n }\n init() {\n this.isInit = true;\n this.run();\n }\n run() {\n this.version++;\n Watcher._registering.push(this);\n let result = this.fct();\n Watcher._registering.splice(Watcher._registering.length - 1, 1);\n for (let i = 0; i < this.callbacks.length; i++) {\n if (this.callbacks[i].version != this.version) {\n this.callbacks[i].receiver.unsubscribe(this.callbacks[i].cb);\n this.callbacks.splice(i, 1);\n i--;\n }\n }\n return result;\n }\n register(receiver, path, version, fullPath) {\n for (let info of this.callbacks) {\n if (info.receiver == receiver && info.path == path && receiver.__path == info.registerPath) {\n info.version = version;\n info.fullPath = fullPath;\n return;\n }\n }\n let cb;\n if (path == \"*\") {\n cb = (action, changePath, value, dones) => { this.onChange(action, changePath, value, dones); };\n }\n else {\n cb = (action, changePath, value, dones) => {\n if (changePath == path || changePath.startsWith(path + \".\") || changePath.startsWith(path + \"[\")) {\n // if(changePath == path) {\n this.onChange(action, changePath, value, dones);\n }\n };\n }\n this.callbacks.push({\n receiver,\n path,\n registerPath: receiver.__path,\n cb,\n version,\n fullPath\n });\n receiver.subscribe(cb);\n }\n canChange(fct) {\n this.__allowChanged.push(fct);\n }\n checkCanChange(action, changePath, value, dones) {\n if (this.isDestroy) {\n return false;\n }\n for (let fct of this.__allowChanged) {\n if (!fct(action, changePath, value, dones)) {\n return false;\n }\n }\n return true;\n }\n onChange(action, changePath, value, dones) {\n if (!this.checkCanChange(action, changePath, value, dones)) {\n return;\n }\n this.run();\n for (let fct of this.__subscribes) {\n fct(action, changePath, value, dones);\n }\n }\n destroy() {\n this.isDestroy = true;\n this.clearCallbacks();\n this.isInit = false;\n }\n clearCallbacks() {\n for (let pair of this.callbacks) {\n pair.receiver.unsubscribe(pair.cb);\n }\n this.callbacks = [];\n }\n subscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index == -1) {\n this.__subscribes.push(fct);\n }\n }\n unsubscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index > -1) {\n this.__subscribes.splice(index, 1);\n }\n }\n}\nEffect.Namespace=`Aventus`;\r\n__as1(_, 'Effect', Effect);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"InternalProtected","isStrong":false},{"fullName":"Aventus.EffectReceiver","isStrong":false},{"fullName":"Aventus.WatcherChange","isStrong":false},{"fullName":"Aventus.WatcherAllowed","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}],"fullName":"Aventus.Effect","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Computed=class Computed extends Effect {\n _value;\n __path = \"*\";\n get value() {\n if (!this.isInit) {\n this.init();\n }\n Watcher._register?.register(this, \"*\", Watcher._register.version, \"*\");\n return this._value;\n }\n autoInit() {\n return false;\n }\n constructor(fct) {\n super(fct);\n }\n init() {\n this.isInit = true;\n this.computedValue();\n }\n computedValue() {\n this._value = this.run();\n }\n onChange(action, changePath, value, dones) {\n if (!this.checkCanChange(action, changePath, value, dones)) {\n return;\n }\n let oldValue = this._value;\n this.computedValue();\n if (oldValue === this._value) {\n return;\n }\n for (let fct of this.__subscribes) {\n fct(action, changePath, value, dones);\n }\n }\n}\nComputed.Namespace=`Aventus`;\r\n__as1(_, 'Computed', Computed);\r\n","dependencies":[{"fullName":"Aventus.Effect","isStrong":true},{"fullName":"Aventus.EffectReceiver","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.IsNotVoid","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}],"fullName":"Aventus.Computed","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Watcher=class Watcher {\n static isNative(obj) {\n if (obj instanceof Blob ||\n obj instanceof Element ||\n obj instanceof Window)\n return true;\n return false;\n }\n constructor() { }\n ;\n static __reservedName = {\n __path: '__path',\n };\n static __triggerForced = false;\n static _registering = [];\n static get _register() {\n return this._registering[this._registering.length - 1];\n }\n /**\n * Transform object into a watcher\n */\n static get(obj, onDataChanged) {\n if (obj == undefined) {\n console.error(\"You must define an objet / array for your proxy\");\n return;\n }\n if (obj.__isProxy) {\n if (onDataChanged)\n obj.subscribe(onDataChanged);\n return obj;\n }\n const reservedName = this.__reservedName;\n const clearReservedNames = (data) => {\n if (data instanceof Object && !data.__isProxy) {\n for (let key in reservedName) {\n delete data[key];\n }\n for (let key in data) {\n clearReservedNames(data[key]);\n }\n }\n };\n const setProxyPath = (newProxy, newPath) => {\n if (newProxy instanceof Object && newProxy.__isProxy) {\n newProxy.__path = newPath;\n }\n };\n const jsonReplacer = (key, value) => {\n if (reservedName[key])\n return undefined;\n return value;\n };\n const addAlias = (otherBaseData, name, cb) => {\n let cbs = aliases.get(otherBaseData);\n if (!cbs) {\n cbs = [];\n aliases.set(otherBaseData, cbs);\n }\n cbs.push({\n name: name,\n fct: cb\n });\n };\n const deleteAlias = (otherBaseData, name) => {\n let cbs = aliases.get(otherBaseData);\n if (!cbs)\n return;\n for (let i = 0; i < cbs.length; i++) {\n if (cbs[i].name == name) {\n cbs.splice(i, 1);\n if (cbs.length == 0) {\n aliases.delete(otherBaseData);\n }\n return;\n }\n }\n };\n const replaceByAlias = (target, element, prop, receiver, apply, out = {}) => {\n let fullInternalPath = \"\";\n if (Array.isArray(receiver)) {\n if (prop != \"length\") {\n if (target.__path) {\n fullInternalPath = target.__path;\n }\n fullInternalPath += \"[\" + prop + \"]\";\n }\n }\n else {\n if (target.__path) {\n fullInternalPath = target.__path + '.';\n }\n fullInternalPath += prop;\n }\n if (receiver && internalAliases[fullInternalPath]) {\n internalAliases[fullInternalPath].unbind();\n }\n if (element instanceof Object && element.__isProxy) {\n let root = element.__root;\n if (root != proxyData.baseData) {\n element.__validatePath();\n let oldPath = element.__path ?? '';\n let unbindElement = Watcher.extract(getValueFromObject(oldPath, root));\n if (unbindElement === undefined) {\n return element;\n }\n if (receiver == null) {\n receiver = getValueFromObject(target.__path, realProxy);\n if (internalAliases[fullInternalPath]) {\n internalAliases[fullInternalPath].unbind();\n }\n }\n if (apply) {\n let result = this.isNative(target) ? Reflect.set(target, prop, unbindElement) : Reflect.set(target, prop, unbindElement, receiver);\n }\n element.__addAlias(proxyData.baseData, oldPath, (type, target, receiver2, value, prop2, dones) => {\n let triggerPath;\n if (prop2.startsWith(\"[\") || fullInternalPath == \"\" || prop2 == \"\") {\n triggerPath = fullInternalPath + prop2;\n }\n else {\n triggerPath = fullInternalPath + \".\" + prop2;\n }\n if (type == 'DELETED' && internalAliases[triggerPath]) {\n internalAliases[triggerPath].unbind();\n }\n triggerPath = triggerPath.replace(/\\[(.*?)\\]/g, '.$1');\n let splitted = triggerPath.split(\".\");\n let newProp = splitted.pop();\n let newReceiver = getValueFromObject(splitted.join(\".\"), realProxy);\n if (newReceiver.getTarget(false) == target)\n trigger(type, target, newReceiver, value, newProp ?? '', dones);\n });\n internalAliases[fullInternalPath] = {\n unbind: () => {\n delete internalAliases[fullInternalPath];\n element.__deleteAlias(proxyData.baseData, oldPath);\n deleteAlias(root, fullInternalPath);\n }\n };\n addAlias(root, fullInternalPath, (type, target, receiver2, value, prop2, dones) => {\n const pathSave = element.__path;\n let proxy = element.__getProxy;\n let triggerPath;\n if (prop2.startsWith(\"[\") || oldPath == \"\" || prop2 == \"\") {\n triggerPath = oldPath + prop2;\n }\n else {\n triggerPath = oldPath + \".\" + prop2;\n }\n triggerPath = triggerPath.replace(/\\[(.*?)\\]/g, '.$1');\n let splitted = triggerPath.split(\".\");\n let newProp = splitted.pop();\n let newReceiver = getValueFromObject(splitted.join(\".\"), proxy);\n if (newReceiver.getTarget(false) == target)\n element.__trigger(type, target, newReceiver, value, newProp, dones);\n element.__path = pathSave;\n });\n out.otherRoot = root;\n return unbindElement;\n }\n }\n return element;\n };\n let currentTrace = new Error().stack?.split(\"\\n\") ?? [];\n currentTrace.shift();\n currentTrace.shift();\n const aliases = new Map();\n const internalAliases = {};\n let proxyData = {\n baseData: {},\n callbacks: {},\n callbacksReverse: new Map(),\n avoidUpdate: [],\n pathToRemove: [],\n injectedDones: null,\n history: [{\n object: JSON.parse(JSON.stringify(obj, jsonReplacer)),\n trace: currentTrace,\n action: 'init',\n path: ''\n }],\n useHistory: false,\n getProxyObject(target, element, prop) {\n let newProxy;\n element = replaceByAlias(target, element, prop, null, true);\n if (element instanceof Object && element.__isProxy) {\n newProxy = element;\n }\n else {\n try {\n if (element instanceof Computed) {\n return element;\n }\n if (element instanceof HTMLElement) {\n return element;\n }\n if (element instanceof Object) {\n newProxy = new Proxy(element, this);\n }\n else {\n return element;\n }\n }\n catch {\n return element;\n }\n }\n let newPath = '';\n if (Array.isArray(target)) {\n if (/^[0-9]*$/g.exec(prop)) {\n if (target.__path) {\n newPath = target.__path;\n }\n newPath += \"[\" + prop + \"]\";\n setProxyPath(newProxy, newPath);\n }\n else {\n newPath += \".\" + prop;\n setProxyPath(newProxy, newPath);\n }\n }\n else if (element instanceof Date) {\n return element;\n }\n else {\n if (target.__path) {\n newPath = target.__path + '.';\n }\n newPath += prop;\n setProxyPath(newProxy, newPath);\n }\n return newProxy;\n },\n tryCustomFunction(target, prop, receiver) {\n if (prop == \"__isProxy\") {\n return true;\n }\n else if (prop == \"__getProxy\") {\n return realProxy;\n }\n else if (prop == \"__root\") {\n return this.baseData;\n }\n else if (prop == \"__validatePath\") {\n return () => {\n if (this.baseData == target) {\n target.__path = \"\";\n }\n };\n }\n else if (prop == \"__callbacks\") {\n return this.callbacks;\n }\n else if (prop == \"subscribe\") {\n let path = receiver.__path;\n return (cb) => {\n if (!this.callbacks[path]) {\n this.callbacks[path] = [];\n }\n this.callbacks[path].push(cb);\n this.callbacksReverse.set(cb, path);\n };\n }\n else if (prop == \"unsubscribe\") {\n return (cb) => {\n let oldPath = this.callbacksReverse.get(cb);\n if (oldPath === undefined)\n return;\n if (!this.callbacks[oldPath]) {\n return;\n }\n let index = this.callbacks[oldPath].indexOf(cb);\n if (index > -1) {\n this.callbacks[oldPath].splice(index, 1);\n }\n this.callbacksReverse.delete(cb);\n };\n }\n else if (prop == \"getHistory\") {\n return () => {\n return this.history;\n };\n }\n else if (prop == \"clearHistory\") {\n this.history = [];\n }\n else if (prop == \"enableHistory\") {\n return () => {\n this.useHistory = true;\n };\n }\n else if (prop == \"disableHistory\") {\n return () => {\n this.useHistory = false;\n };\n }\n else if (prop == \"getTarget\") {\n return (clear = true) => {\n if (clear)\n clearReservedNames(target);\n return target;\n };\n }\n else if (prop == \"toJSON\") {\n if (target.toJSON) {\n return target.toJSON;\n }\n if (Array.isArray(receiver)) {\n return () => {\n let result = [];\n for (let element of target) {\n result.push(element);\n }\n return result;\n };\n }\n return () => {\n let result = {};\n for (let key of Object.keys(target)) {\n if (reservedName[key]) {\n continue;\n }\n result[key] = target[key];\n }\n return result;\n };\n }\n else if (prop == \"__addAlias\") {\n return addAlias;\n }\n else if (prop == \"__deleteAlias\") {\n return deleteAlias;\n }\n else if (prop == \"__injectedDones\") {\n return (dones) => {\n this.injectedDones = dones;\n };\n }\n else if (prop == \"__trigger\") {\n return trigger;\n }\n else if (prop == \"__static_trigger\") {\n return (type) => {\n Watcher.__triggerForced = true;\n trigger(type, target, receiver, target, '');\n Watcher.__triggerForced = false;\n };\n }\n return undefined;\n },\n get(target, prop, receiver) {\n if (typeof prop == 'symbol') {\n return Watcher.isNative(target) ? Reflect.get(target, prop) : Reflect.get(target, prop, receiver);\n }\n if (reservedName[prop]) {\n return target[prop];\n }\n let customResult = this.tryCustomFunction(target, prop, receiver);\n if (customResult !== undefined) {\n return customResult;\n }\n let element = target[prop];\n if (typeof (element) == 'function') {\n if (Array.isArray(receiver)) {\n let result;\n if (prop == 'push') {\n if (target.__isProxy) {\n result = (el) => {\n let index = target.push(el);\n return index;\n };\n }\n else {\n result = (el) => {\n let index = target.length;\n let out = {};\n el = replaceByAlias(target, el, target.length + '', receiver, false, out);\n target.push(el);\n const dones = [];\n const dones2 = [];\n if (out.otherRoot) {\n dones.push(out.otherRoot);\n dones2.push(out.otherRoot);\n }\n trigger('CREATED', target, receiver, receiver[index], \"[\" + (index) + \"]\", dones);\n trigger('UPDATED', target, receiver, target.length, \"length\", dones2);\n return index;\n };\n }\n }\n else if (prop == 'splice') {\n if (target.__isProxy) {\n result = (index, nbRemove, ...insert) => {\n let res = target.splice(index, nbRemove, ...insert);\n return res;\n };\n }\n else {\n result = (index, nbRemove, ...insert) => {\n let oldValues = [];\n const extReceiver = Watcher.extract(receiver);\n for (let i = index; i < index + nbRemove; i++) {\n oldValues.push(extReceiver[i]);\n }\n let updateLength = nbRemove != insert.length;\n for (let i = 0; i < oldValues.length; i++) {\n target.splice((index + i), 1);\n trigger('DELETED', target, receiver, oldValues[i], \"[\" + index + \"]\");\n }\n for (let i = 0; i < insert.length; i++) {\n const out = {};\n let value = replaceByAlias(target, insert[i], (index + i) + '', receiver, false, out);\n const dones = out.otherRoot ? [out.otherRoot] : [];\n target.splice((index + i), 0, value);\n trigger('CREATED', target, receiver, receiver[(index + i)], \"[\" + (index + i) + \"]\", dones);\n }\n if (updateLength)\n trigger('UPDATED', target, receiver, target.length, \"length\");\n return target;\n };\n }\n }\n else if (prop == 'pop') {\n if (target.__isProxy) {\n result = () => {\n let res = target.pop();\n return res;\n };\n }\n else {\n result = () => {\n let index = target.length - 1;\n let oldValue = receiver.length ? receiver[receiver.length] : undefined;\n let res = target.pop();\n trigger('DELETED', target, receiver, oldValue, \"[\" + index + \"]\");\n trigger('UPDATED', target, receiver, target.length, \"length\");\n return res;\n };\n }\n }\n // else if(prop == 'find') {\n else {\n result = element.bind(target);\n }\n return result;\n }\n else if (target instanceof Map) {\n let result;\n if (prop == \"set\") {\n if (target.__isProxy) {\n result = (key, value) => {\n return target.set(key, value);\n };\n }\n else {\n result = (key, value) => {\n const out = {};\n let dones = [];\n let dones2 = [];\n key = Watcher.extract(key);\n value = replaceByAlias(target, value, key + '', receiver, false, out);\n if (out.otherRoot) {\n dones.push(out.otherRoot);\n dones2.push(out.otherRoot);\n }\n let result = target.set(key, value);\n trigger('CREATED', target, receiver, receiver.get(key), key + '', dones);\n trigger('UPDATED', target, receiver, target.size, \"size\", dones2);\n return result;\n };\n }\n }\n else if (prop == \"clear\") {\n if (target.__isProxy) {\n result = () => {\n return target.clear();\n };\n }\n else {\n result = () => {\n let keys = target.keys();\n for (let key of keys) {\n let oldValue = receiver.get(key);\n target.delete(key);\n trigger('DELETED', target, receiver, oldValue, key);\n trigger('UPDATED', target, receiver, target.size, \"size\");\n }\n };\n }\n }\n else if (prop == \"delete\") {\n if (target.__isProxy) {\n result = (key) => {\n return target.delete(key);\n };\n }\n else {\n result = (key) => {\n key = Watcher.extract(key);\n let oldValue = receiver.get(key);\n let res = target.delete(key);\n trigger('DELETED', target, receiver, oldValue, key + '');\n trigger('UPDATED', target, receiver, target.size, \"size\");\n return res;\n };\n }\n }\n else {\n result = element.bind(target);\n }\n return result;\n }\n return element.bind(target);\n }\n if (element instanceof Computed) {\n return element.value;\n }\n if (Watcher._registering.length > 0) {\n let currentPath;\n let fullPath;\n let isArray = Array.isArray(receiver);\n if (isArray && /^[0-9]*$/g.exec(prop)) {\n fullPath = receiver.__path + \"[\" + prop + \"]\";\n currentPath = \"[\" + prop + \"]\";\n }\n else {\n fullPath = receiver.__path ? receiver.__path + '.' + prop : prop;\n currentPath = prop;\n }\n Watcher._register?.register(receiver, currentPath, Watcher._register.version, fullPath);\n }\n if (typeof (element) == 'object') {\n return this.getProxyObject(target, element, prop);\n }\n return Watcher.isNative(target) ? Reflect.get(target, prop) : Reflect.get(target, prop, receiver);\n },\n set(target, prop, value, receiver) {\n if (typeof prop == 'symbol') {\n if (Watcher.isNative(target))\n return Reflect.set(target, prop, value);\n return Reflect.set(target, prop, value, receiver);\n }\n let oldValue = Watcher.isNative(target) ? Reflect.get(target, prop) : Reflect.get(target, prop, receiver);\n value = replaceByAlias(target, value, prop, receiver, true);\n if (value instanceof Signal) {\n value = value.value;\n }\n let triggerChange = false;\n if (!reservedName[prop]) {\n if (Array.isArray(receiver)) {\n if (prop != \"length\") {\n triggerChange = true;\n }\n }\n else {\n if (!compareObject(value, oldValue)) {\n triggerChange = true;\n }\n }\n if (Watcher.__triggerForced) {\n triggerChange = true;\n }\n }\n let result = Watcher.isNative(target) ? Reflect.set(target, prop, value) : Reflect.set(target, prop, value, receiver);\n if (triggerChange) {\n let index = this.avoidUpdate.indexOf(prop);\n if (index == -1) {\n let dones = this.injectedDones ?? [];\n this.injectedDones = null;\n trigger('UPDATED', target, receiver, value, prop, dones);\n }\n else {\n this.avoidUpdate.splice(index, 1);\n }\n }\n return result;\n },\n deleteProperty(target, prop) {\n if (typeof prop == 'symbol') {\n return Reflect.deleteProperty(target, prop);\n }\n let triggerChange = false;\n let pathToDelete = '';\n if (!reservedName[prop]) {\n if (Array.isArray(target)) {\n if (prop != \"length\") {\n if (target.__path) {\n pathToDelete = target.__path;\n }\n pathToDelete += \"[\" + prop + \"]\";\n triggerChange = true;\n }\n }\n else {\n if (target.__path) {\n pathToDelete = target.__path + '.';\n }\n pathToDelete += prop;\n triggerChange = true;\n }\n }\n if (internalAliases[pathToDelete]) {\n internalAliases[pathToDelete].unbind();\n }\n if (target.hasOwnProperty(prop)) {\n let oldValue = target[prop];\n if (oldValue instanceof Effect || oldValue instanceof Signal) {\n oldValue.destroy();\n }\n delete target[prop];\n if (triggerChange) {\n clearReservedNames(oldValue);\n trigger('DELETED', target, null, oldValue, prop);\n }\n return true;\n }\n return false;\n },\n defineProperty(target, prop, descriptor) {\n if (typeof prop == 'symbol') {\n return Reflect.defineProperty(target, prop, descriptor);\n }\n let triggerChange = false;\n let newPath = '';\n if (!reservedName[prop]) {\n if (Array.isArray(target)) {\n if (prop != \"length\") {\n if (target.__path) {\n newPath = target.__path;\n }\n newPath += \"[\" + prop + \"]\";\n if (!target.hasOwnProperty(prop)) {\n triggerChange = true;\n }\n }\n }\n else {\n if (target.__path) {\n newPath = target.__path + '.';\n }\n newPath += prop;\n if (!target.hasOwnProperty(prop)) {\n triggerChange = true;\n }\n }\n }\n let result = Reflect.defineProperty(target, prop, descriptor);\n if (triggerChange) {\n this.avoidUpdate.push(prop);\n let proxyEl = this.getProxyObject(target, descriptor.value, prop);\n target[prop] = proxyEl;\n trigger('CREATED', target, null, proxyEl, prop);\n }\n return result;\n },\n ownKeys(target) {\n let result = Reflect.ownKeys(target);\n for (let i = 0; i < result.length; i++) {\n let key = result[i];\n if (typeof key == 'string') {\n if (reservedName[key]) {\n result.splice(i, 1);\n i--;\n }\n }\n }\n return result;\n },\n };\n if (onDataChanged) {\n proxyData.callbacks[''] = [onDataChanged];\n }\n const trigger = (type, target, receiver, value, prop, dones = []) => {\n if (dones.includes(proxyData.baseData)) {\n return;\n }\n if (target.__isProxy) {\n return;\n }\n let rootPath;\n if (receiver == null) {\n rootPath = target.__path;\n }\n else {\n rootPath = receiver.__path;\n }\n if (rootPath != \"\") {\n if (Array.isArray(receiver)) {\n if (prop && !prop.startsWith(\"[\")) {\n if (/^[0-9]*$/g.exec(prop)) {\n rootPath += \"[\" + prop + \"]\";\n }\n else {\n rootPath += \".\" + prop;\n }\n }\n else {\n rootPath += prop;\n }\n }\n else {\n if (prop && !prop.startsWith(\"[\")) {\n rootPath += \".\";\n }\n rootPath += prop;\n }\n }\n else {\n rootPath = prop;\n }\n let stacks = [];\n if (proxyData.useHistory) {\n let allStacks = new Error().stack?.split(\"\\n\") ?? [];\n for (let i = allStacks.length - 1; i >= 0; i--) {\n let current = allStacks[i].trim().replace(\"at \", \"\");\n if (current.startsWith(\"Object.set\") || current.startsWith(\"Proxy.result\")) {\n break;\n }\n stacks.push(current);\n }\n }\n dones.push(proxyData.baseData);\n let aliasesDone = [];\n const callbacks = { ...proxyData.callbacks };\n for (let name in callbacks) {\n callbacks[name] = [...callbacks[name]];\n }\n for (let name in callbacks) {\n // for(let name in proxyData.callbacks) {\n let pathToSend = rootPath;\n if (name !== \"\") {\n let regex = new RegExp(\"^\" + name.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&') + \"(\\\\.|(\\\\[)|$)\");\n if (!regex.test(rootPath)) {\n let regex2 = new RegExp(\"^\" + rootPath.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&') + \"(\\\\.|(\\\\[)|$)\");\n if (!regex2.test(name)) {\n continue;\n }\n else {\n pathToSend = \"\";\n }\n }\n else {\n pathToSend = rootPath.replace(regex, \"$2\");\n }\n }\n if (name === \"\" && proxyData.useHistory) {\n proxyData.history.push({\n object: JSON.parse(JSON.stringify(proxyData.baseData, jsonReplacer)),\n trace: stacks.reverse(),\n action: WatchAction[type],\n path: pathToSend\n });\n }\n let cbs = callbacks[name];\n for (let cb of cbs) {\n try {\n cb(WatchAction[type], pathToSend, value, dones);\n }\n catch (e) {\n if (e != 'impossible')\n console.error(e);\n }\n }\n for (let [key, infos] of aliases) {\n if (!dones.includes(key)) {\n for (let info of infos) {\n if (info.name == name) {\n aliasesDone.push(key);\n if (target.__path) {\n let oldPath = target.__path;\n info.fct(type, target, receiver, value, prop, dones);\n target.__path = oldPath;\n }\n else {\n info.fct(type, target, receiver, value, prop, dones);\n }\n }\n }\n }\n }\n }\n for (let [key, infos] of aliases) {\n if (!dones.includes(key) && !aliasesDone.includes(key)) {\n for (let info of infos) {\n let regex = new RegExp(\"^\" + info.name.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&') + \"(\\\\.|(\\\\[)|$)\");\n if (!regex.test(rootPath)) {\n continue;\n }\n let newProp = rootPath.replace(info.name, \"\");\n if (newProp.startsWith(\".\")) {\n newProp = newProp.slice(1);\n }\n if (target.__path) {\n let oldPath = target.__path;\n info.fct(type, target, receiver, value, newProp, dones);\n target.__path = oldPath;\n }\n else {\n info.fct(type, target, receiver, value, newProp, dones);\n }\n }\n }\n }\n };\n var realProxy = new Proxy(obj, proxyData);\n proxyData.baseData = obj;\n setProxyPath(realProxy, '');\n return realProxy;\n }\n static is(obj) {\n return typeof obj == 'object' && obj.__isProxy;\n }\n static extract(obj, clearPath = false) {\n if (this.is(obj)) {\n return obj.getTarget(clearPath);\n }\n else {\n if (obj instanceof Object) {\n for (let key in this.__reservedName) {\n delete obj[key];\n }\n }\n }\n return obj;\n }\n static trigger(type, target) {\n if (this.is(target)) {\n target.__static_trigger(type);\n }\n }\n /**\n * Create a computed variable that will watch any changes\n */\n static computed(fct) {\n const comp = new Computed(fct);\n return comp;\n }\n /**\n * Create an effect variable that will watch any changes\n */\n static effect(fct) {\n const comp = new Effect(fct);\n return comp;\n }\n /**\n * Create an effect variable that will watch any changes inside the fct and trigger the cb on change\n */\n static watch(fct, cb) {\n const comp = new Effect(fct);\n comp.subscribe(cb);\n return comp;\n }\n /**\n * Create a signal variable\n */\n static signal(item, onChange) {\n return new Signal(item, onChange);\n }\n}\nWatcher.Namespace=`Aventus`;\r\n__as1(_, 'Watcher', Watcher);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Internal","isStrong":true},{"fullName":"Aventus.Effect","isStrong":true},{"fullName":"Aventus.WatcherFunction","isStrong":false},{"fullName":"Aventus.getValueFromObject","isStrong":false},{"fullName":"Aventus.WatcherFunctionInternal","isStrong":false},{"fullName":"ProxyData","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false},{"fullName":"Aventus.Signal","isStrong":false},{"fullName":"Aventus.compareObject","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.IsNotVoid","isStrong":false}],"fullName":"Aventus.Watcher","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ComputedNoRecomputed=class ComputedNoRecomputed extends Computed {\n init() {\n this.isInit = true;\n Watcher._registering.push(this);\n this._value = this.fct();\n Watcher._registering.splice(Watcher._registering.length - 1, 1);\n }\n computedValue() {\n if (this.isInit)\n this._value = this.fct();\n else\n this.init();\n }\n run() { }\n}\nComputedNoRecomputed.Namespace=`Aventus`;\r\n__as1(_, 'ComputedNoRecomputed', ComputedNoRecomputed);\r\n","dependencies":[{"fullName":"Aventus.Computed","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false}],"fullName":"Aventus.ComputedNoRecomputed","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let EffectNoRecomputed=class EffectNoRecomputed extends Effect {\n init() {\n this.isInit = true;\n Watcher._registering.push(this);\n this.fct();\n Watcher._registering.splice(Watcher._registering.length - 1, 1);\n }\n run() {\n if (!this.isInit) {\n this.init();\n }\n }\n}\nEffectNoRecomputed.Namespace=`Aventus`;\r\n__as1(_, 'EffectNoRecomputed', EffectNoRecomputed);\r\n","dependencies":[{"fullName":"Aventus.Effect","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false}],"fullName":"Aventus.EffectNoRecomputed","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let HttpRouter=class HttpRouter {\n static options;\n static configure(options) {\n this.options = options;\n }\n options;\n constructor() {\n this.options = this.defineOptions(this.defaultOptionsValue());\n }\n defaultOptionsValue() {\n return HttpRouter.options ?? {\n url: location.protocol + \"//\" + location.host\n };\n }\n defineOptions(options) {\n return options;\n }\n async get(url) {\n return await new HttpRequest(url).queryJSON(this);\n }\n async post(url, data) {\n return await new HttpRequest(url, HttpMethod.POST, data).queryJSON(this);\n }\n async put(url, data) {\n return await new HttpRequest(url, HttpMethod.PUT, data).queryJSON(this);\n }\n async delete(url, data) {\n return await new HttpRequest(url, HttpMethod.DELETE, data).queryJSON(this);\n }\n async option(url, data) {\n return await new HttpRequest(url, HttpMethod.OPTION, data).queryJSON(this);\n }\n}\nHttpRouter.Namespace=`Aventus`;\r\n__as1(_, 'HttpRouter', HttpRouter);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRouterOptions","isStrong":true},{"fullName":"InternalProtected","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.HttpMethod","isStrong":false},{"fullName":"Aventus.HttpRequest","isStrong":false}],"fullName":"Aventus.HttpRouter","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let HttpRoute=class HttpRoute {\n router;\n constructor(router) {\n this.router = router ?? new HttpRouter();\n }\n getPrefix() {\n return \"\";\n }\n}\nHttpRoute.Namespace=`Aventus`;\r\n__as1(_, 'HttpRoute', HttpRoute);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRouter","isStrong":false}],"fullName":"Aventus.HttpRoute","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let HttpRequest=class HttpRequest {\n static options;\n static configure(options) {\n this.options = options;\n }\n request;\n url;\n methodSpoofing = false;\n useCache = false;\n constructor(url, method = HttpMethod.GET, body, methodSpoofing = false, useCache = false) {\n this.url = url;\n this.request = {};\n this.methodSpoofing = methodSpoofing;\n this.useCache = useCache;\n this.setMethod(method);\n this.prepareBody(body);\n }\n setUrl(url) {\n this.url = url;\n }\n toString() {\n return this.url + \" : \" + JSON.stringify(this.request);\n }\n setBody(body) {\n this.prepareBody(body);\n }\n setMethod(method) {\n this.request.method = method;\n }\n /**\n * Replace method Put/Delete by _method:\"put\" inside a form\n */\n enableMethodSpoofing() {\n this.methodSpoofing = true;\n }\n enableCache() {\n this.useCache = true;\n }\n disableCache() {\n this.useCache = false;\n }\n objectToFormData(obj, formData, parentKey) {\n formData = formData || new FormData();\n let byPass = obj;\n if (byPass.__isProxy) {\n obj = byPass.getTarget();\n }\n const keys = obj.toJSON ? Object.keys(obj.toJSON()) : Object.keys(obj);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n let value = obj[key];\n const newKey = parentKey ? `${parentKey}[${key}]` : key;\n if (value instanceof Date) {\n formData.append(newKey, DateConverter.converter.toString(value));\n }\n else if (typeof value === 'object' &&\n value !== null &&\n !(value instanceof File)) {\n if (Array.isArray(value)) {\n for (let j = 0; j < value.length; j++) {\n const arrayKey = `${newKey}[${j}]`;\n this.objectToFormData({ [arrayKey]: value[j] }, formData);\n }\n }\n else {\n this.objectToFormData(value, formData, newKey);\n }\n }\n else {\n if (value === undefined || value === null) {\n value = \"\";\n }\n else if (Watcher.is(value)) {\n value = Watcher.extract(value);\n }\n formData.append(newKey, value);\n }\n }\n return formData;\n }\n jsonReplacer(key, value) {\n const t = this;\n if (t[key] instanceof Date) {\n return DateConverter.converter.toString(t[key]);\n }\n return value;\n }\n prepareBody(data) {\n if (!data) {\n return;\n }\n else if (data instanceof FormData) {\n this.request.body = data;\n }\n else {\n let useFormData = false;\n const analyseFormData = (obj) => {\n for (let key in obj) {\n if (obj[key] instanceof File) {\n useFormData = true;\n break;\n }\n else if (Array.isArray(obj[key]) && obj[key].length > 0 && obj[key][0] instanceof File) {\n useFormData = true;\n break;\n }\n else if (typeof obj[key] == 'object' && !Array.isArray(obj[key]) && !(obj[key] instanceof Date)) {\n analyseFormData(obj[key]);\n if (useFormData) {\n break;\n }\n }\n }\n };\n analyseFormData(data);\n if (useFormData) {\n this.request.body = this.objectToFormData(data);\n }\n else {\n this.request.body = JSON.stringify(data, this.jsonReplacer);\n this.setHeader(\"Content-Type\", \"Application/json\");\n }\n }\n if (this.methodSpoofing) {\n if (this.request.method?.toUpperCase() == Aventus.HttpMethod.PUT) {\n if (this.request.body instanceof FormData) {\n this.request.body.append(\"_method\", Aventus.HttpMethod.PUT);\n this.request.method = Aventus.HttpMethod.POST;\n }\n }\n else if (this.request.method?.toUpperCase() == Aventus.HttpMethod.DELETE) {\n if (this.request.body instanceof FormData) {\n this.request.body.append(\"_method\", Aventus.HttpMethod.DELETE);\n this.request.method = Aventus.HttpMethod.POST;\n }\n }\n }\n }\n setHeader(name, value) {\n if (!this.request.headers) {\n this.request.headers = [];\n }\n this.request.headers.push([name, value]);\n }\n setCredentials(credentials) {\n this.request.credentials = credentials;\n }\n async _query(router) {\n let result = new ResultWithError();\n try {\n const isFull = this.url.match(\"https?://\");\n if (!this.url.startsWith(\"/\") && !isFull) {\n this.url = \"/\" + this.url;\n }\n if (HttpRequest.options?.beforeSend) {\n const beforeSendResult = await HttpRequest.options.beforeSend(this);\n result.errors = beforeSendResult.errors;\n }\n const fullUrl = isFull ? this.url : router ? router.options.url + this.url : this.url;\n if (this.useCache) {\n result.result = await HttpCache.fetch(fullUrl, this.request);\n }\n else {\n let response = await fetch(fullUrl, this.request);\n result.result = new HttpResponse(response);\n }\n }\n catch (e) {\n result.errors.push(new HttpError(HttpErrorCode.unknow, e));\n }\n return result;\n }\n async query(router) {\n let result = await this._query(router);\n if (HttpRequest.options?.responseMiddleware) {\n result = await HttpRequest.options.responseMiddleware(result, this);\n }\n return result;\n }\n async queryVoid(router) {\n let resultTemp = await this.query(router);\n let result = new VoidWithError();\n if (!resultTemp.success) {\n result.errors = resultTemp.errors;\n return result;\n }\n try {\n if (!resultTemp.result) {\n return result;\n }\n if (resultTemp.result.status != 204) {\n let tempResult = await resultTemp.result.json();\n if (tempResult instanceof VoidWithError) {\n for (let error of tempResult.errors) {\n result.errors.push(error);\n }\n }\n }\n }\n catch (e) {\n }\n return result;\n }\n async queryJSON(router) {\n this.setHeader(\"Accept\", \"application/json\");\n let resultTemp = await this.query(router);\n let result = new ResultWithError();\n if (!resultTemp.success) {\n result.errors = resultTemp.errors;\n return result;\n }\n try {\n if (!resultTemp.result) {\n return result;\n }\n let tempResult = await resultTemp.result.json();\n if (tempResult instanceof VoidWithError) {\n for (let error of tempResult.errors) {\n result.errors.push(error);\n }\n if (tempResult instanceof ResultWithError) {\n result.result = tempResult.result;\n }\n }\n else {\n result.result = tempResult;\n }\n }\n catch (e) {\n result.errors.push(new HttpError(HttpErrorCode.unknow, e));\n }\n return result;\n }\n async queryTxt(router) {\n this.setHeader(\"Accept\", \"text/plain\");\n let resultTemp = await this.query(router);\n let result = new ResultWithError();\n if (!resultTemp.success) {\n result.errors = resultTemp.errors;\n return result;\n }\n try {\n if (!resultTemp.result) {\n return result;\n }\n result.result = await resultTemp.result.text();\n }\n catch (e) {\n result.errors.push(new HttpError(HttpErrorCode.unknow, e));\n }\n return result;\n }\n async queryBlob(router) {\n this.setHeader(\"Accept\", \"application/octet-stream\");\n let resultTemp = await this.query(router);\n let result = new ResultWithError();\n if (!resultTemp.success) {\n result.errors = resultTemp.errors;\n return result;\n }\n try {\n if (!resultTemp.result) {\n return result;\n }\n result.result = await resultTemp.result.blob();\n }\n catch (e) {\n result.errors.push(new HttpError(HttpErrorCode.unknow, e));\n }\n return result;\n }\n clearCache(router) {\n const isFull = this.url.match(\"https?://\");\n if (!this.url.startsWith(\"/\") && !isFull) {\n this.url = \"/\" + this.url;\n }\n const fullUrl = isFull ? this.url : router ? router.options.url + this.url : this.url;\n HttpCache.clear(fullUrl, this.request);\n }\n}\nHttpRequest.Namespace=`Aventus`;\r\n__as1(_, 'HttpRequest', HttpRequest);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRequestOptions","isStrong":true},{"fullName":"Aventus.HttpMethod","isStrong":false},{"fullName":"Aventus.DateConverter","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.HttpRouter","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.HttpResponse","isStrong":false},{"fullName":"Aventus.HttpCache","isStrong":false},{"fullName":"Aventus.HttpError","isStrong":false},{"fullName":"Aventus.HttpErrorCode","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false},{"fullName":"T","isStrong":false}],"fullName":"Aventus.HttpRequest","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let StorableRoute=class StorableRoute extends HttpRoute {\n async GetAll() {\n const request = new HttpRequest(`/${this.StorableName()}`, HttpMethod.GET);\n return await request.queryJSON(this.router);\n }\n async Create(body) {\n const request = new HttpRequest(`/${this.StorableName()}`, HttpMethod.POST);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async GetById(id) {\n const request = new HttpRequest(`/${this.StorableName()}/${id}`, HttpMethod.GET);\n return await request.queryJSON(this.router);\n }\n async Update(id, body) {\n const request = new HttpRequest(`/${this.StorableName()}/${id}`, HttpMethod.PUT);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async Delete(id) {\n const request = new HttpRequest(`/${this.StorableName()}/${id}`, HttpMethod.DELETE);\n return await request.queryJSON(this.router);\n }\n}\nStorableRoute.Namespace=`Aventus`;\r\n__as1(_, 'StorableRoute', StorableRoute);\r\n","dependencies":[{"fullName":"Aventus.HttpRoute","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.IData","isStrong":false},{"fullName":"Aventus.HttpRequest","isStrong":false},{"fullName":"Aventus.HttpMethod","isStrong":false},{"fullName":"TypeResult","isStrong":false}],"fullName":"Aventus.StorableRoute","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Animation=class Animation {\n /**\n * Default FPS for all Animation if not set inside options\n */\n static FPS_DEFAULT = 60;\n options;\n nextFrame = 0;\n fpsInterval;\n continueAnimation = false;\n frame_id = 0;\n constructor(options) {\n if (!options.animate) {\n options.animate = () => { };\n }\n if (!options.stopped) {\n options.stopped = () => { };\n }\n if (!options.fps) {\n options.fps = Animation.FPS_DEFAULT;\n }\n this.options = options;\n this.fpsInterval = 1000 / options.fps;\n }\n animate() {\n let now = window.performance.now();\n let elapsed = now - this.nextFrame;\n if (elapsed <= this.fpsInterval) {\n this.frame_id = requestAnimationFrame(() => this.animate());\n return;\n }\n this.nextFrame = now - (elapsed % this.fpsInterval);\n setTimeout(() => {\n this.options.animate();\n }, 0);\n if (this.continueAnimation) {\n this.frame_id = requestAnimationFrame(() => this.animate());\n }\n else {\n this.options.stopped();\n }\n }\n /**\n * Start the of animation\n */\n start() {\n if (this.continueAnimation == false) {\n this.continueAnimation = true;\n this.nextFrame = window.performance.now();\n this.animate();\n }\n }\n /**\n * Stop the animation\n */\n stop() {\n this.continueAnimation = false;\n }\n /**\n * Stop the animation\n */\n immediateStop() {\n cancelAnimationFrame(this.frame_id);\n this.continueAnimation = false;\n this.options.stopped();\n }\n /**\n * Get the FPS\n */\n getFPS() {\n return this.options.fps;\n }\n /**\n * Set the FPS\n */\n setFPS(fps) {\n this.options.fps = fps;\n this.fpsInterval = 1000 / this.options.fps;\n }\n /**\n * Get the animation status (true if animation is running)\n */\n isStarted() {\n return this.continueAnimation;\n }\n}\nAnimation.Namespace=`Aventus`;\r\n__as1(_, 'Animation', Animation);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.AnimationOptionsInternal","isStrong":false},{"fullName":"Aventus.AnimationOptions","isStrong":false}],"fullName":"Aventus.Animation","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let PressManager=class PressManager {\n static globalConfig = {\n delayDblPress: 250,\n delayLongPress: 700,\n offsetDrag: 20\n };\n static configure(options) {\n this.globalConfig = options;\n }\n static create(options) {\n if (Array.isArray(options.element)) {\n let result = [];\n for (let el of options.element) {\n let cloneOpt = { ...options };\n cloneOpt.element = el;\n result.push(new PressManager(cloneOpt));\n }\n return result;\n }\n else {\n return new PressManager(options);\n }\n }\n static onEvent = new Callback();\n options;\n element;\n delayDblPress;\n delayLongPress;\n nbPress = 0;\n offsetDrag;\n dragDirection;\n state = {\n oneActionTriggered: null,\n };\n startPosition = { x: 0, y: 0 };\n customFcts = {};\n timeoutDblPress = 0;\n timeoutLongPress = 0;\n downEventSaved;\n useDblPress = false;\n stopPropagation = () => true;\n pointersRecord = {};\n functionsBinded = {\n downAction: (e) => { },\n downActionDelay: (e) => { },\n upAction: (e) => { },\n moveAction: (e) => { },\n childPressStart: (e) => { },\n childPressEnd: (e) => { },\n childPressMove: (e) => { }\n };\n /**\n * @param {*} options - The options\n * @param {HTMLElement | HTMLElement[]} options.element - The element to manage\n */\n constructor(options) {\n if (options.element === void 0) {\n throw 'You must provide an element';\n }\n this.offsetDrag = PressManager.globalConfig.offsetDrag !== undefined ? PressManager.globalConfig.offsetDrag : 20;\n this.dragDirection = 'XY';\n this.delayLongPress = PressManager.globalConfig.delayLongPress ?? 700;\n this.delayDblPress = PressManager.globalConfig.delayDblPress ?? 150;\n this.element = options.element;\n this.checkDragConstraint(options);\n this.assignValueOption(options);\n this.options = options;\n this.init();\n }\n /**\n * Get the current element focused by the PressManager\n */\n getElement() {\n return this.element;\n }\n checkDragConstraint(options) {\n if (options.onDrag !== void 0) {\n if (options.onDragStart === void 0) {\n options.onDragStart = (e) => { };\n }\n if (options.onDragEnd === void 0) {\n options.onDragEnd = (e) => { };\n }\n }\n if (options.onDragStart !== void 0) {\n if (options.onDrag === void 0) {\n options.onDrag = (e) => { };\n }\n if (options.onDragEnd === void 0) {\n options.onDragEnd = (e) => { };\n }\n }\n if (options.onDragEnd !== void 0) {\n if (options.onDragStart === void 0) {\n options.onDragStart = (e) => { };\n }\n if (options.onDrag === void 0) {\n options.onDrag = (e) => { };\n }\n }\n }\n assignValueOption(options) {\n if (PressManager.globalConfig.delayDblPress !== undefined) {\n this.delayDblPress = PressManager.globalConfig.delayDblPress;\n }\n if (options.delayDblPress !== undefined) {\n this.delayDblPress = options.delayDblPress;\n }\n if (PressManager.globalConfig.delayLongPress !== undefined) {\n this.delayLongPress = PressManager.globalConfig.delayLongPress;\n }\n if (options.delayLongPress !== undefined) {\n this.delayLongPress = options.delayLongPress;\n }\n if (PressManager.globalConfig.offsetDrag !== undefined) {\n this.offsetDrag = PressManager.globalConfig.offsetDrag;\n }\n if (options.offsetDrag !== undefined) {\n this.offsetDrag = options.offsetDrag;\n }\n if (options.dragDirection !== undefined) {\n this.dragDirection = options.dragDirection;\n }\n if (options.onDblPress !== undefined) {\n this.useDblPress = true;\n }\n if (PressManager.globalConfig.forceDblPress !== undefined) {\n this.useDblPress = PressManager.globalConfig.forceDblPress;\n }\n if (options.forceDblPress !== undefined) {\n this.useDblPress = options.forceDblPress;\n }\n if (typeof PressManager.globalConfig.stopPropagation == 'function') {\n this.stopPropagation = PressManager.globalConfig.stopPropagation;\n }\n else if (options.stopPropagation === false) {\n this.stopPropagation = () => false;\n }\n if (typeof options.stopPropagation == 'function') {\n this.stopPropagation = options.stopPropagation;\n }\n else if (options.stopPropagation === false) {\n this.stopPropagation = () => false;\n }\n if (!options.buttonAllowed)\n options.buttonAllowed = PressManager.globalConfig.buttonAllowed;\n if (!options.buttonAllowed)\n options.buttonAllowed = [0];\n if (!options.onEvent)\n options.onEvent = PressManager.globalConfig.onEvent;\n }\n bindAllFunction() {\n this.functionsBinded.downAction = this.downAction.bind(this);\n this.functionsBinded.downActionDelay = this.downActionDelay.bind(this);\n this.functionsBinded.moveAction = this.moveAction.bind(this);\n this.functionsBinded.upAction = this.upAction.bind(this);\n this.functionsBinded.childPressStart = this.childPressStart.bind(this);\n this.functionsBinded.childPressEnd = this.childPressEnd.bind(this);\n this.functionsBinded.childPressMove = this.childPressMove.bind(this);\n }\n init() {\n this.bindAllFunction();\n this.element.addEventListener(\"pointerdown\", this.functionsBinded.downAction);\n this.element.addEventListener(\"touchstart\", this.functionsBinded.downActionDelay);\n this.element.addEventListener(\"trigger_pointer_pressstart\", this.functionsBinded.childPressStart);\n this.element.addEventListener(\"trigger_pointer_pressend\", this.functionsBinded.childPressEnd);\n this.element.addEventListener(\"trigger_pointer_pressmove\", this.functionsBinded.childPressMove);\n }\n identifyEvent(touch) {\n if ('Touch' in window && touch instanceof Touch)\n return touch.identifier;\n return touch.pointerId;\n }\n registerEvent(ev) {\n if ('TouchEvent' in window && ev instanceof TouchEvent) {\n for (let touch of ev.targetTouches) {\n const id = this.identifyEvent(touch);\n if (this.pointersRecord[id]) {\n return false;\n }\n this.pointersRecord[id] = ev;\n }\n return true;\n }\n else {\n const id = this.identifyEvent(ev);\n if (this.pointersRecord[id]) {\n return false;\n }\n this.pointersRecord[id] = ev;\n return true;\n }\n }\n unregisterEvent(ev) {\n let result = true;\n if ('TouchEvent' in window && ev instanceof TouchEvent) {\n for (let touch of ev.changedTouches) {\n const id = this.identifyEvent(touch);\n if (!this.pointersRecord[id]) {\n result = false;\n }\n else {\n delete this.pointersRecord[id];\n }\n }\n }\n else {\n const id = this.identifyEvent(ev);\n if (!this.pointersRecord[id]) {\n result = false;\n }\n else {\n delete this.pointersRecord[id];\n }\n }\n return result;\n }\n genericDownAction(state, e) {\n this.downEventSaved = e;\n this.startPosition = { x: e.pageX, y: e.pageY };\n if (this.options.onLongPress) {\n this.timeoutLongPress = setTimeout(() => {\n if (!state.oneActionTriggered) {\n if (this.options.onLongPress) {\n if (this.options.onLongPress(e, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }, this.delayLongPress);\n }\n }\n pointerEventTriggered = false;\n downActionDelay(_ev) {\n const ev = _ev;\n if (!this.pointerEventTriggered) {\n this.downAction(ev);\n }\n else {\n ev.stopImmediatePropagation();\n }\n setTimeout(() => {\n this.pointerEventTriggered = false;\n }, 0);\n }\n downAction(_ev) {\n const ev = _ev;\n this.pointerEventTriggered = true;\n const isFirst = Object.values(this.pointersRecord).length == 0;\n if (!this.registerEvent(ev)) {\n if (this.stopPropagation()) {\n ev.stopImmediatePropagation();\n }\n return;\n }\n const e = new NormalizedEvent(ev);\n if (this.options.onEvent) {\n this.options.onEvent(e);\n }\n PressManager.onEvent.trigger(e, this);\n if (e.button != undefined && !this.options.buttonAllowed?.includes(e.button)) {\n this.unregisterEvent(ev);\n return;\n }\n if (this.stopPropagation()) {\n e.stopImmediatePropagation();\n }\n this.customFcts = {};\n if (this.nbPress == 0 && isFirst) {\n this.state.oneActionTriggered = null;\n clearTimeout(this.timeoutDblPress);\n }\n if (isFirst) {\n document.addEventListener(\"pointerup\", this.functionsBinded.upAction);\n document.addEventListener(\"pointercancel\", this.functionsBinded.upAction);\n document.addEventListener(\"touchend\", this.functionsBinded.upAction);\n document.addEventListener(\"touchcancel\", this.functionsBinded.upAction);\n document.addEventListener(\"pointermove\", this.functionsBinded.moveAction);\n }\n this.genericDownAction(this.state, e);\n if (this.options.onPressStart) {\n this.options.onPressStart(e, this);\n this.lastEmitEvent = e;\n // this.emitTriggerFunctionParent(\"pressstart\", e);\n }\n this.emitTriggerFunction(\"pressstart\", e);\n }\n genericUpAction(state, e) {\n clearTimeout(this.timeoutLongPress);\n if (state.oneActionTriggered == this) {\n if (this.options.onDragEnd) {\n this.options.onDragEnd(e, this);\n }\n else if (this.customFcts.src && this.customFcts.onDragEnd) {\n this.customFcts.onDragEnd(e, this.customFcts.src);\n }\n }\n else {\n if (this.useDblPress) {\n this.nbPress++;\n if (this.nbPress == 2) {\n if (!state.oneActionTriggered) {\n this.nbPress = 0;\n if (this.options.onDblPress) {\n if (this.options.onDblPress(e, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }\n else if (this.nbPress == 1) {\n this.timeoutDblPress = setTimeout(() => {\n this.nbPress = 0;\n if (!state.oneActionTriggered) {\n if (this.options.onPress) {\n if (this.options.onPress(e, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }, this.delayDblPress);\n }\n }\n else {\n if (!state.oneActionTriggered) {\n if (this.options.onPress) {\n if (this.options.onPress(e, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }\n }\n }\n upAction(_ev) {\n const ev = _ev;\n if (!this.unregisterEvent(ev)) {\n if (this.stopPropagation()) {\n ev.stopImmediatePropagation();\n }\n return;\n }\n const e = new NormalizedEvent(ev);\n if (this.options.onEvent) {\n this.options.onEvent(e);\n }\n PressManager.onEvent.trigger(e, this);\n if (this.stopPropagation()) {\n e.stopImmediatePropagation();\n }\n if (Object.values(this.pointersRecord).length == 0) {\n document.removeEventListener(\"pointerup\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointercancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchend\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchcancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointermove\", this.functionsBinded.moveAction);\n }\n this.genericUpAction(this.state, e);\n if (this.options.onPressEnd) {\n this.options.onPressEnd(e, this);\n this.lastEmitEvent = e;\n // this.emitTriggerFunctionParent(\"pressend\", e);\n }\n this.emitTriggerFunction(\"pressend\", e);\n }\n genericMoveAction(state, e) {\n if (!state.oneActionTriggered) {\n let xDist = e.pageX - this.startPosition.x;\n let yDist = e.pageY - this.startPosition.y;\n let distance = 0;\n if (this.dragDirection == 'XY')\n distance = Math.sqrt(xDist * xDist + yDist * yDist);\n else if (this.dragDirection == 'X')\n distance = Math.abs(xDist);\n else\n distance = Math.abs(yDist);\n if (distance > this.offsetDrag && this.downEventSaved) {\n if (this.options.onDragStart) {\n if (this.options.onDragStart(this.downEventSaved, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }\n else if (state.oneActionTriggered == this) {\n if (this.options.onDrag) {\n this.options.onDrag(e, this);\n }\n else if (this.customFcts.src && this.customFcts.onDrag) {\n this.customFcts.onDrag(e, this.customFcts.src);\n }\n }\n }\n moveAction(_ev) {\n const ev = _ev;\n const e = new NormalizedEvent(ev);\n if (this.options.onEvent) {\n this.options.onEvent(e);\n }\n PressManager.onEvent.trigger(e, this);\n if (this.stopPropagation()) {\n e.stopImmediatePropagation();\n }\n this.genericMoveAction(this.state, e);\n this.lastEmitEvent = e;\n // if(this.options.onDrag) {\n // this.emitTriggerFunctionParent(\"pressmove\", e);\n this.emitTriggerFunction(\"pressmove\", e);\n }\n childPressStart(_e) {\n const e = _e;\n if (this.lastEmitEvent == e.detail.realEvent)\n return;\n this.genericDownAction(e.detail.state, e.detail.realEvent);\n if (this.options.onPressStart) {\n this.options.onPressStart(e.detail.realEvent, this);\n }\n }\n childPressEnd(_e) {\n const e = _e;\n this.unregisterEvent(e.detail.realEvent.event);\n if (Object.values(this.pointersRecord).length == 0) {\n document.removeEventListener(\"pointerup\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointercancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchend\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchcancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointermove\", this.functionsBinded.moveAction);\n }\n if (this.lastEmitEvent == e.detail.realEvent)\n return;\n this.genericUpAction(e.detail.state, e.detail.realEvent);\n if (this.options.onPressEnd) {\n this.options.onPressEnd(e.detail.realEvent, this);\n }\n }\n childPressMove(_e) {\n const e = _e;\n if (this.lastEmitEvent == e.detail.realEvent)\n return;\n this.genericMoveAction(e.detail.state, e.detail.realEvent);\n }\n lastEmitEvent;\n emitTriggerFunction(action, e, el) {\n let ev = new CustomEvent(\"trigger_pointer_\" + action, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: {\n state: this.state,\n customFcts: this.customFcts,\n realEvent: e\n }\n });\n this.lastEmitEvent = e;\n if (!el) {\n el = this.element;\n }\n el.dispatchEvent(ev);\n }\n /**\n * Destroy the Press instance byremoving all events\n */\n destroy() {\n if (this.element) {\n this.element.removeEventListener(\"pointerdown\", this.functionsBinded.downAction);\n this.element.removeEventListener(\"touchstart\", this.functionsBinded.downActionDelay);\n this.element.removeEventListener(\"trigger_pointer_pressstart\", this.functionsBinded.childPressStart);\n this.element.removeEventListener(\"trigger_pointer_pressend\", this.functionsBinded.childPressEnd);\n this.element.removeEventListener(\"trigger_pointer_pressmove\", this.functionsBinded.childPressMove);\n document.removeEventListener(\"pointerup\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointercancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchend\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchcancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointermove\", this.functionsBinded.moveAction);\n }\n }\n}\nPressManager.Namespace=`Aventus`;\r\n__as1(_, 'PressManager', PressManager);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManagerOptions","isStrong":true},{"fullName":"Aventus.Callback","isStrong":true},{"fullName":"Aventus.NormalizedEvent","isStrong":true},{"fullName":"Aventus.PressManagerState","isStrong":false},{"fullName":"Aventus.InternalCustomFunction","isStrong":false},{"fullName":"Aventus.InternalPointerEvent","isStrong":false}],"fullName":"Aventus.PressManager","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let DragAndDrop=class DragAndDrop {\n /**\n * Default offset before drag element\n */\n static defaultOffsetDrag = 20;\n pressManager;\n options;\n startCursorPosition = { x: 0, y: 0 };\n startElementPosition = { x: 0, y: 0 };\n isEnable = true;\n draggableElement;\n constructor(options) {\n this.options = this.getDefaultOptions(options.element);\n this.mergeProperties(options);\n this.mergeFunctions(options);\n this.options.elementTrigger.style.touchAction = 'none';\n this.pressManager = new PressManager({\n element: this.options.elementTrigger,\n onPressStart: this.onPressStart.bind(this),\n onPressEnd: this.onPressEnd.bind(this),\n onDragStart: this.onDragStart.bind(this),\n onDrag: this.onDrag.bind(this),\n onDragEnd: this.onDragEnd.bind(this),\n offsetDrag: this.options.offsetDrag,\n dragDirection: this.options.dragDirection,\n stopPropagation: this.options.stopPropagation\n });\n }\n getDefaultOptions(element) {\n return {\n applyDrag: true,\n element: element,\n elementTrigger: element,\n offsetDrag: DragAndDrop.defaultOffsetDrag,\n dragDirection: 'XY',\n shadow: {\n enable: false,\n container: document.body,\n removeOnStop: true,\n transform: () => { },\n delete: (el) => {\n el.remove();\n }\n },\n strict: false,\n targets: [],\n usePercent: false,\n stopPropagation: true,\n useMouseFinalPosition: false,\n useTransform: false,\n isDragEnable: () => true,\n getZoom: () => 1,\n getOffsetX: () => 0,\n getOffsetY: () => 0,\n onPointerDown: (e) => { },\n onPointerUp: (e) => { },\n onStart: (e) => { },\n onMove: (e) => { },\n onStop: (e) => { },\n onDrop: (element, targets) => { },\n correctPosition: (position) => position\n };\n }\n mergeProperties(options) {\n if (options.element === void 0) {\n throw \"You must define the element for the drag&drop\";\n }\n this.options.element = options.element;\n if (options.elementTrigger === void 0) {\n this.options.elementTrigger = this.options.element;\n }\n else {\n this.options.elementTrigger = options.elementTrigger;\n }\n this.defaultMerge(options, \"applyDrag\");\n this.defaultMerge(options, \"offsetDrag\");\n this.defaultMerge(options, \"dragDirection\");\n this.defaultMerge(options, \"strict\");\n this.defaultMerge(options, \"targets\");\n this.defaultMerge(options, \"usePercent\");\n this.defaultMerge(options, \"stopPropagation\");\n this.defaultMerge(options, \"useMouseFinalPosition\");\n this.defaultMerge(options, \"useTransform\");\n if (options.shadow !== void 0) {\n this.options.shadow.enable = options.shadow.enable;\n if (options.shadow.container !== void 0) {\n this.options.shadow.container = options.shadow.container;\n }\n else {\n this.options.shadow.container = document.body;\n }\n if (options.shadow.removeOnStop !== void 0) {\n this.options.shadow.removeOnStop = options.shadow.removeOnStop;\n }\n if (options.shadow.transform !== void 0) {\n this.options.shadow.transform = options.shadow.transform;\n }\n if (options.shadow.delete !== void 0) {\n this.options.shadow.delete = options.shadow.delete;\n }\n }\n }\n mergeFunctions(options) {\n this.defaultMerge(options, \"isDragEnable\");\n this.defaultMerge(options, \"getZoom\");\n this.defaultMerge(options, \"getOffsetX\");\n this.defaultMerge(options, \"getOffsetY\");\n this.defaultMerge(options, \"onPointerDown\");\n this.defaultMerge(options, \"onPointerUp\");\n this.defaultMerge(options, \"onStart\");\n this.defaultMerge(options, \"onMove\");\n this.defaultMerge(options, \"onStop\");\n this.defaultMerge(options, \"onDrop\");\n this.defaultMerge(options, \"correctPosition\");\n }\n defaultMerge(options, name) {\n if (options[name] !== void 0) {\n const opts = this.options;\n opts[name] = options[name];\n }\n }\n positionShadowRelativeToElement = { x: 0, y: 0 };\n onPressStart(e) {\n this.options.onPointerDown(e);\n }\n onPressEnd(e) {\n this.options.onPointerUp(e);\n }\n onDragStart(e) {\n this.isEnable = this.options.isDragEnable();\n if (!this.isEnable) {\n return false;\n }\n let draggableElement = this.options.element;\n this.startCursorPosition = {\n x: e.pageX,\n y: e.pageY\n };\n this.startElementPosition = this.getBoundingBoxRelative(draggableElement);\n if (this.options.shadow.enable) {\n draggableElement = this.options.element.cloneNode(true);\n let elBox = this.options.element.getBoundingClientRect();\n let containerBox = this.options.shadow.container.getBoundingClientRect();\n this.positionShadowRelativeToElement = {\n x: elBox.x - containerBox.x,\n y: elBox.y - containerBox.y\n };\n if (this.options.applyDrag) {\n draggableElement.style.position = \"absolute\";\n draggableElement.style.top = this.positionShadowRelativeToElement.y + this.options.getOffsetY() + 'px';\n draggableElement.style.left = this.positionShadowRelativeToElement.x + this.options.getOffsetX() + 'px';\n this.options.shadow.transform(draggableElement);\n this.options.shadow.container.appendChild(draggableElement);\n }\n }\n this.draggableElement = draggableElement;\n const result = this.options.onStart(e);\n if (result !== false) {\n document.body.style.userSelect = 'none';\n if (window.getSelection) {\n window.getSelection()?.removeAllRanges();\n }\n }\n return result;\n }\n onDrag(e) {\n if (!this.isEnable) {\n return;\n }\n let zoom = this.options.getZoom();\n let diff = {\n x: 0,\n y: 0\n };\n if (this.options.shadow.enable) {\n diff = {\n x: (e.pageX - this.startCursorPosition.x) + this.positionShadowRelativeToElement.x + this.options.getOffsetX(),\n y: (e.pageY - this.startCursorPosition.y) + this.positionShadowRelativeToElement.y + this.options.getOffsetY(),\n };\n }\n else {\n diff = {\n x: (e.pageX - this.startCursorPosition.x) / zoom + this.startElementPosition.x + this.options.getOffsetX(),\n y: (e.pageY - this.startCursorPosition.y) / zoom + this.startElementPosition.y + this.options.getOffsetY()\n };\n }\n let newPos = this.setPosition(diff);\n this.options.onMove(e, newPos);\n }\n onDragEnd(e) {\n if (!this.isEnable) {\n return;\n }\n document.body.style.userSelect = '';\n let targets = this.options.useMouseFinalPosition ? this.getMatchingTargetsWithMousePosition({\n x: e.clientX,\n y: e.clientY\n }) : this.getMatchingTargets();\n let draggableElement = this.draggableElement;\n if (this.options.shadow.enable && this.options.shadow.removeOnStop) {\n this.options.shadow.delete(draggableElement);\n }\n if (targets.length > 0) {\n this.options.onDrop(this.options.element, targets);\n }\n this.options.onStop(e);\n }\n setPosition(position) {\n let draggableElement = this.draggableElement;\n if (this.options.usePercent) {\n let elementParent = this.getOffsetParent(draggableElement);\n if (elementParent instanceof HTMLElement) {\n let percentPosition = {\n x: (position.x / elementParent.offsetWidth) * 100,\n y: (position.y / elementParent.offsetHeight) * 100\n };\n percentPosition = this.options.correctPosition(percentPosition);\n if (this.options.applyDrag) {\n draggableElement.style.left = percentPosition.x + '%';\n draggableElement.style.top = percentPosition.y + '%';\n }\n return percentPosition;\n }\n else {\n console.error(\"Can't find parent. Contact an admin\", draggableElement);\n }\n }\n else {\n position = this.options.correctPosition(position);\n if (this.options.applyDrag) {\n if (this.isLeftTopElement(draggableElement)) {\n draggableElement.style.left = position.x + 'px';\n draggableElement.style.top = position.y + 'px';\n }\n else {\n if (this.options.useTransform) {\n draggableElement.setAttribute(\"transform\", `translate(${position.x},${position.y})`);\n }\n else {\n draggableElement.style.left = position.x + 'px';\n draggableElement.style.top = position.y + 'px';\n }\n }\n }\n }\n return position;\n }\n getTargets() {\n if (typeof this.options.targets == \"function\") {\n return this.options.targets();\n }\n else {\n return this.options.targets;\n }\n }\n /**\n * Get targets within the current element position is matching\n */\n getMatchingTargets() {\n let draggableElement = this.draggableElement;\n let matchingTargets = [];\n let srcTargets = this.getTargets();\n for (let target of srcTargets) {\n let elementCoordinates = this.getBoundingBoxAbsolute(draggableElement);\n let targetCoordinates = this.getBoundingBoxAbsolute(target);\n let offsetX = this.options.getOffsetX();\n let offsetY = this.options.getOffsetY();\n let zoom = this.options.getZoom();\n targetCoordinates.x += offsetX;\n targetCoordinates.y += offsetY;\n targetCoordinates.width *= zoom;\n targetCoordinates.height *= zoom;\n if (this.options.strict) {\n if ((elementCoordinates.x >= targetCoordinates.x && elementCoordinates.x + elementCoordinates.width <= targetCoordinates.x + targetCoordinates.width) &&\n (elementCoordinates.y >= targetCoordinates.y && elementCoordinates.y + elementCoordinates.height <= targetCoordinates.y + targetCoordinates.height)) {\n matchingTargets.push(target);\n }\n }\n else {\n let elementLeft = elementCoordinates.x;\n let elementRight = elementCoordinates.x + elementCoordinates.width;\n let elementTop = elementCoordinates.y;\n let elementBottom = elementCoordinates.y + elementCoordinates.height;\n let targetLeft = targetCoordinates.x;\n let targetRight = targetCoordinates.x + targetCoordinates.width;\n let targetTop = targetCoordinates.y;\n let targetBottom = targetCoordinates.y + targetCoordinates.height;\n if (!(elementRight < targetLeft ||\n elementLeft > targetRight ||\n elementBottom < targetTop ||\n elementTop > targetBottom)) {\n matchingTargets.push(target);\n }\n }\n }\n return matchingTargets;\n }\n /**\n * This function will return the targets that are matching with the mouse position\n * @param mouse The mouse position\n */\n getMatchingTargetsWithMousePosition(mouse) {\n let matchingTargets = [];\n if (this.options.shadow.enable == false || this.options.shadow.container == null) {\n console.warn(\"DragAndDrop : To use useMouseFinalPosition=true, you must enable shadow and set a container\");\n return matchingTargets;\n }\n const container = this.options.shadow.container;\n let xCorrected = mouse.x - container.getBoundingClientRect().left;\n let yCorrected = mouse.y - container.getBoundingClientRect().top;\n for (let target of this.getTargets()) {\n if (this.isLeftTopElement(target)) {\n if (this.matchPosition(target, { x: mouse.x, y: mouse.y })) {\n matchingTargets.push(target);\n }\n }\n else {\n if (this.matchPosition(target, { x: xCorrected, y: yCorrected })) {\n matchingTargets.push(target);\n }\n }\n }\n return matchingTargets;\n }\n matchPosition(element, point) {\n let elementCoordinates = this.getBoundingBoxAbsolute(element);\n if (point.x >= elementCoordinates.x &&\n point.x <= elementCoordinates.x + elementCoordinates.width &&\n point.y >= elementCoordinates.y &&\n point.y <= elementCoordinates.y + elementCoordinates.height) {\n return true;\n }\n return false;\n }\n /**\n * Get element currently dragging\n */\n getElementDrag() {\n return this.options.element;\n }\n /**\n * Set targets where to drop\n */\n setTargets(targets) {\n this.options.targets = targets;\n }\n /**\n * Set targets where to drop\n */\n setTargetsFct(targets) {\n this.options.targets = targets;\n }\n /**\n * Destroy the current drag&drop instance\n */\n destroy() {\n this.pressManager.destroy();\n }\n isLeftTopElement(element) {\n for (let Type of DragElementLeftTopType) {\n if (element instanceof Type) {\n return true;\n }\n }\n return false;\n }\n isXYElement(element) {\n for (let Type of DragElementXYType) {\n if (element instanceof Type) {\n return true;\n }\n }\n return false;\n }\n getCoordinateFromAttribute(element) {\n if (this.options.useTransform) {\n const transform = element.getAttribute(\"transform\");\n const tvalue = transform?.match(/translate\\(([^,]+),([^,]+)\\)/);\n const x = tvalue ? parseFloat(tvalue[1]) : 0;\n const y = tvalue ? parseFloat(tvalue[2]) : 0;\n return {\n x: x,\n y: y\n };\n }\n return {\n x: parseFloat(element.getAttribute(\"x\")),\n y: parseFloat(element.getAttribute(\"y\"))\n };\n }\n XYElementToRelativeBox(element) {\n let coordinates = this.getCoordinateFromAttribute(element);\n const width = parseFloat(element.getAttribute(\"width\"));\n const height = parseFloat(element.getAttribute(\"height\"));\n return {\n x: coordinates.x,\n y: coordinates.y,\n width: width,\n height: height,\n bottom: coordinates.y + height,\n right: coordinates.x + width,\n top: coordinates.y,\n left: coordinates.x,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n XYElementToAbsoluteBox(element) {\n let coordinates = this.getCoordinateFromAttribute(element);\n const parent = this.getOffsetParent(element);\n if (parent) {\n const box = parent.getBoundingClientRect();\n coordinates = {\n x: coordinates.x + box.x,\n y: coordinates.y + box.y\n };\n }\n const width = parseFloat(element.getAttribute(\"width\"));\n const height = parseFloat(element.getAttribute(\"height\"));\n return {\n x: coordinates.x,\n y: coordinates.y,\n width: width,\n height: height,\n bottom: coordinates.y + height,\n right: coordinates.x + width,\n top: coordinates.y,\n left: coordinates.x,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n getBoundingBoxAbsolute(element) {\n if (this.isLeftTopElement(element)) {\n if (element instanceof HTMLElement) {\n const bounds = element.getBoundingClientRect();\n return {\n x: bounds.x,\n y: bounds.y,\n width: bounds.width,\n height: bounds.height,\n bottom: bounds.bottom,\n right: bounds.right,\n top: bounds.top,\n left: bounds.left,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n }\n else if (this.isXYElement(element)) {\n return this.XYElementToAbsoluteBox(element);\n }\n const parent = this.getOffsetParent(element);\n if (parent instanceof HTMLElement) {\n const rect = element.getBoundingClientRect();\n const rectParent = parent.getBoundingClientRect();\n const x = rect.left - rectParent.left;\n const y = rect.top - rectParent.top;\n return {\n x: x,\n y: y,\n width: rect.width,\n height: rect.height,\n bottom: y + rect.height,\n right: x + rect.width,\n left: rect.left - rectParent.left,\n top: rect.top - rectParent.top,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n console.error(\"Element type not supported\");\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n bottom: 0,\n right: 0,\n top: 0,\n left: 0,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n getBoundingBoxRelative(element) {\n if (this.isLeftTopElement(element)) {\n if (element instanceof HTMLElement) {\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: element.offsetWidth,\n height: element.offsetHeight,\n bottom: element.offsetTop + element.offsetHeight,\n right: element.offsetLeft + element.offsetWidth,\n top: element.offsetTop,\n left: element.offsetLeft,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n }\n else if (this.isXYElement(element)) {\n return this.XYElementToRelativeBox(element);\n }\n const parent = this.getOffsetParent(element);\n if (parent instanceof HTMLElement) {\n const rect = element.getBoundingClientRect();\n const rectParent = parent.getBoundingClientRect();\n const x = rect.left - rectParent.left;\n const y = rect.top - rectParent.top;\n return {\n x: x,\n y: y,\n width: rect.width,\n height: rect.height,\n bottom: y + rect.height,\n right: x + rect.width,\n left: rect.left - rectParent.left,\n top: rect.top - rectParent.top,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n console.error(\"Element type not supported\");\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n bottom: 0,\n right: 0,\n top: 0,\n left: 0,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n getOffsetParent(element) {\n if (element instanceof HTMLElement) {\n return element.offsetParent;\n }\n let current = element.parentNode;\n while (current) {\n if (current instanceof Element) {\n const style = getComputedStyle(current);\n if (style.position !== 'static') {\n return current;\n }\n }\n if (current instanceof ShadowRoot) {\n current = current.host;\n }\n else {\n current = current.parentNode;\n }\n }\n return null;\n }\n}\nDragAndDrop.Namespace=`Aventus`;\r\n__as1(_, 'DragAndDrop', DragAndDrop);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.DragAndDropOptionsInternal","isStrong":false},{"fullName":"Aventus.Coordinate","isStrong":false},{"fullName":"Aventus.DragElement","isStrong":false},{"fullName":"Aventus.DragAndDropOptions","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.TargetableElement","isStrong":false},{"fullName":"Aventus.DragElementLeftTop","isStrong":false},{"fullName":"Aventus.DragElementLeftTopType","isStrong":false},{"fullName":"Aventus.DragElementXY","isStrong":false},{"fullName":"Aventus.DragElementXYType","isStrong":false},{"fullName":"Aventus.AnyElement","isStrong":false}],"fullName":"Aventus.DragAndDrop","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Instance=class Instance {\n static elements = new Map();\n static get(type) {\n let result = this.elements.get(type);\n if (!result) {\n let cst = type.prototype['constructor'];\n result = new cst();\n this.elements.set(type, result);\n }\n return result;\n }\n static set(el) {\n let cst = el.constructor;\n if (this.elements.get(cst)) {\n return false;\n }\n this.elements.set(cst, el);\n return true;\n }\n static destroy(el) {\n let cst = el.constructor;\n return this.elements.delete(cst);\n }\n}\nInstance.Namespace=`Aventus`;\r\n__as1(_, 'Instance', Instance);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.InstanceCst2","isStrong":false},{"fullName":"X","isStrong":false},{"fullName":"Aventus.InstanceCst","isStrong":false}],"fullName":"Aventus.Instance","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ResizeObserver=class ResizeObserver {\n callback;\n targets;\n fpsInterval = -1;\n nextFrame;\n entriesChangedEvent;\n willTrigger;\n static resizeObserverClassByObject = {};\n static uniqueInstance;\n static getUniqueInstance() {\n if (!ResizeObserver.uniqueInstance) {\n ResizeObserver.uniqueInstance = new window.ResizeObserver(entries => {\n let allClasses = [];\n for (let j = 0; j < entries.length; j++) {\n let entry = entries[j];\n const target = entry.target;\n let index = target['sourceIndex'];\n if (ResizeObserver.resizeObserverClassByObject[index]) {\n for (let i = 0; i < ResizeObserver.resizeObserverClassByObject[index].length; i++) {\n let classTemp = ResizeObserver.resizeObserverClassByObject[index][i];\n classTemp.entryChanged(entry);\n if (allClasses.indexOf(classTemp) == -1) {\n allClasses.push(classTemp);\n }\n }\n }\n }\n for (let i = 0; i < allClasses.length; i++) {\n allClasses[i].triggerCb();\n }\n });\n }\n return ResizeObserver.uniqueInstance;\n }\n constructor(options) {\n let realOption;\n if (options instanceof Function) {\n realOption = {\n callback: options,\n };\n }\n else {\n realOption = options;\n }\n this.callback = realOption.callback;\n this.targets = [];\n if (!realOption.fps) {\n realOption.fps = 60;\n }\n if (realOption.fps != -1) {\n this.fpsInterval = 1000 / realOption.fps;\n }\n this.nextFrame = 0;\n this.entriesChangedEvent = {};\n this.willTrigger = false;\n }\n /**\n * Observe size changing for the element\n */\n observe(target) {\n const _target = target;\n if (!_target[\"sourceIndex\"]) {\n _target[\"sourceIndex\"] = Math.random().toString(36);\n this.targets.push(_target);\n ResizeObserver.getUniqueInstance().observe(_target);\n }\n if (!ResizeObserver.resizeObserverClassByObject[_target[\"sourceIndex\"]]) {\n ResizeObserver.resizeObserverClassByObject[_target[\"sourceIndex\"]] = [];\n }\n if (ResizeObserver.resizeObserverClassByObject[_target[\"sourceIndex\"]].indexOf(this) == -1) {\n ResizeObserver.resizeObserverClassByObject[_target[\"sourceIndex\"]].push(this);\n }\n }\n /**\n * Stop observing size changing for the element\n */\n unobserve(target) {\n const _target = target;\n for (let i = 0; this.targets.length; i++) {\n let tempTarget = this.targets[i];\n if (tempTarget == _target) {\n let position = ResizeObserver.resizeObserverClassByObject[_target['sourceIndex']].indexOf(this);\n if (position != -1) {\n ResizeObserver.resizeObserverClassByObject[_target['sourceIndex']].splice(position, 1);\n }\n if (ResizeObserver.resizeObserverClassByObject[_target['sourceIndex']].length == 0) {\n delete ResizeObserver.resizeObserverClassByObject[_target['sourceIndex']];\n }\n ResizeObserver.getUniqueInstance().unobserve(_target);\n this.targets.splice(i, 1);\n return;\n }\n }\n }\n /**\n * Destroy the resize observer\n */\n disconnect() {\n for (let i = 0; this.targets.length; i++) {\n this.unobserve(this.targets[i]);\n }\n }\n entryChanged(entry) {\n const _target = entry.target;\n let index = _target.sourceIndex;\n this.entriesChangedEvent[index] = entry;\n }\n triggerCb() {\n if (!this.willTrigger) {\n this.willTrigger = true;\n this._triggerCb();\n }\n }\n _triggerCb() {\n let now = window.performance.now();\n let elapsed = now - this.nextFrame;\n if (this.fpsInterval != -1 && elapsed <= this.fpsInterval) {\n requestAnimationFrame(() => {\n this._triggerCb();\n });\n return;\n }\n this.nextFrame = now - (elapsed % this.fpsInterval);\n let changed = Object.values(this.entriesChangedEvent);\n this.entriesChangedEvent = {};\n this.willTrigger = false;\n setTimeout(() => {\n this.callback(changed, ResizeObserver.uniqueInstance);\n }, 0);\n }\n}\nResizeObserver.Namespace=`Aventus`;\r\n__as1(_, 'ResizeObserver', ResizeObserver);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WindowResizeObserver","isStrong":true},{"fullName":"Aventus.ResizeObserverOptions","isStrong":false}],"fullName":"Aventus.ResizeObserver","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Uri=class Uri {\n static prepare(uri) {\n let params = [];\n let i = 0;\n let regexState = uri.replace(/{.*?}/g, (group, position) => {\n group = group.slice(1, -1);\n let splitted = group.split(\":\");\n let name = splitted[0].trim();\n let type = \"string\";\n let result = \"([^\\\\/]+)\";\n i++;\n if (splitted.length > 1) {\n if (splitted[1].trim() == \"number\") {\n result = \"([0-9]+)\";\n type = \"number\";\n }\n }\n params.push({\n name,\n type,\n position: i\n });\n return result;\n });\n regexState = regexState.replace(/\\*/g, \".*?\").toLowerCase();\n regexState = \"^\" + regexState + '$';\n return {\n regex: new RegExp(regexState),\n params\n };\n }\n static getParams(from, current) {\n if (typeof from == \"string\") {\n from = this.prepare(from);\n }\n let matches = from.regex.exec(current.toLowerCase());\n if (matches) {\n let slugs = {};\n for (let param of from.params) {\n if (param.type == \"number\") {\n slugs[param.name] = Number(matches[param.position]);\n }\n else {\n slugs[param.name] = matches[param.position];\n }\n }\n return slugs;\n }\n return null;\n }\n static isActive(from, current) {\n if (typeof from == \"string\") {\n from = this.prepare(from);\n }\n return from.regex.test(current);\n }\n static normalize(path) {\n const isAbsolute = path.startsWith('/');\n const parts = path.split('/');\n const normalizedParts = [];\n for (let i = 0; i < parts.length; i++) {\n if (parts[i] === '..') {\n normalizedParts.pop();\n }\n else if (parts[i] !== '.' && parts[i] !== '') {\n normalizedParts.push(parts[i]);\n }\n }\n let normalizedPath = normalizedParts.join('/');\n if (isAbsolute) {\n normalizedPath = '/' + normalizedPath;\n }\n return normalizedPath;\n }\n}\nUri.Namespace=`Aventus`;\r\n__as1(_, 'Uri', Uri);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PreparedUri","isStrong":false},{"fullName":"Aventus.UriParams","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false}],"fullName":"Aventus.Uri","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let RamError=class RamError extends GenericError {\n}\nRamError.Namespace=`Aventus`;\r\nRamError.$schema={...(GenericError?.$schema ?? {}), };\r\nConverter.register(RamError.Fullname, RamError);\r\n__as1(_, 'RamError', RamError);\r\n","dependencies":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"Aventus.RamErrorCode","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.RamError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let VoidRamWithError=class VoidRamWithError extends VoidWithError {\n}\nVoidRamWithError.Namespace=`Aventus`;\r\nVoidRamWithError.$schema={...(VoidWithError?.$schema ?? {}), };\r\nConverter.register(VoidRamWithError.Fullname, VoidRamWithError);\r\n__as1(_, 'VoidRamWithError', VoidRamWithError);\r\n","dependencies":[{"fullName":"Aventus.VoidWithError","isStrong":true},{"fullName":"Aventus.RamError","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.VoidRamWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let ResultRamWithError=class ResultRamWithError extends ResultWithError {\n}\nResultRamWithError.Namespace=`Aventus`;\r\nResultRamWithError.$schema={...(ResultWithError?.$schema ?? {}), };\r\nConverter.register(ResultRamWithError.Fullname, ResultRamWithError);\r\n__as1(_, 'ResultRamWithError', ResultRamWithError);\r\n","dependencies":[{"fullName":"Aventus.ResultWithError","isStrong":true},{"fullName":"Aventus.RamError","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.ResultRamWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let GenericRam=class GenericRam {\n static info = new Map([]);\n /**\n * The current namespace\n */\n static Namespace = \"\";\n // public static get Namespace(): string { return \"\"; }\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n static get Fullname() { return this.Namespace + \".\" + this.name; }\n subscribers = {\n created: [],\n updated: [],\n deleted: [],\n };\n recordsSubscribers = new Map();\n /**\n * List of stored item by index key\n */\n records = new Map();\n actionGuard = new ActionGuard();\n ramMapping = {};\n constructor() {\n if (this.constructor == GenericRam) {\n throw \"can't instanciate an abstract class\";\n }\n // RamManager.check();\n this.getIdWithError = this.getIdWithError.bind(this);\n this.getId = this.getId.bind(this);\n this.save = this.save.bind(this);\n this.saveWithError = this.saveWithError.bind(this);\n this.onCreated = this.onCreated.bind(this);\n this.offCreated = this.offCreated.bind(this);\n this.onUpdated = this.onUpdated.bind(this);\n this.offUpdated = this.offUpdated.bind(this);\n this.onDeleted = this.onDeleted.bind(this);\n this.offDeleted = this.offDeleted.bind(this);\n this.get = this.get.bind(this);\n this.getWithError = this.getWithError.bind(this);\n this.getById = this.getById.bind(this);\n this.getByIdWithError = this.getByIdWithError.bind(this);\n this.getByIds = this.getByIds.bind(this);\n this.getByIdsWithError = this.getByIdsWithError.bind(this);\n this.getAll = this.getAll.bind(this);\n this.getAllWithError = this.getAllWithError.bind(this);\n this.getList = this.getList.bind(this);\n this.getListWithError = this.getListWithError.bind(this);\n this.getRecords = this.getRecords.bind(this);\n this.getRecordsWithError = this.getRecordsWithError.bind(this);\n this.createList = this.createList.bind(this);\n this.createListWithError = this.createListWithError.bind(this);\n this.create = this.create.bind(this);\n this.createWithError = this.createWithError.bind(this);\n this.updateList = this.updateList.bind(this);\n this.updateListWithError = this.updateListWithError.bind(this);\n this.update = this.update.bind(this);\n this.updateWithError = this.updateWithError.bind(this);\n this.deleteList = this.deleteList.bind(this);\n this.deleteListWithError = this.deleteListWithError.bind(this);\n this.delete = this.delete.bind(this);\n this.deleteWithError = this.deleteWithError.bind(this);\n this.deleteById = this.deleteById.bind(this);\n this.deleteByIdWithError = this.deleteByIdWithError.bind(this);\n }\n /**\n * Get item id\n */\n getIdWithError(item) {\n let action = new ResultRamWithError();\n let idTemp = item[this.defineIndexKey()];\n if (idTemp !== undefined) {\n action.result = idTemp;\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noId, \"no key found for item\"));\n }\n return action;\n }\n /**\n * Get item id\n */\n getId(item) {\n let result = this.getIdWithError(item);\n if (result.success) {\n return result.result;\n }\n throw 'no key found for item';\n }\n /**\n * Prevent adding Watch element\n */\n removeWatch(element) {\n let byPass = element;\n if (byPass.__isProxy) {\n return byPass.getTarget();\n }\n return element;\n }\n /**\n * Add function update, onUpdate, offUpdate, delete, onDelete, offDelete\n */\n addRamAction(Base) {\n let that = this;\n return class ActionClass extends Base {\n static get className() {\n return Base.className || Base.name;\n }\n get className() {\n return Base.className || Base.name;\n }\n async update(newData) {\n return (await that.update(newData));\n }\n async updateWithError(newData) {\n return (await that.updateWithError(newData));\n }\n onUpdate(callback) {\n let id = that.getId(this);\n if (!that.recordsSubscribers.has(id)) {\n that.recordsSubscribers.set(id, {\n created: [],\n updated: [],\n deleted: []\n });\n }\n let sub = that.recordsSubscribers.get(id);\n if (sub && !sub.updated.includes(callback)) {\n sub.updated.push(callback);\n }\n }\n offUpdate(callback) {\n let id = that.getId(this);\n let sub = that.recordsSubscribers.get(id);\n if (sub) {\n let index = sub.updated.indexOf(callback);\n if (index != -1) {\n sub.updated.splice(index, 1);\n }\n }\n }\n async delete() {\n let id = that.getId(this);\n await that.deleteById(id);\n }\n async deleteWithError() {\n const result = new VoidRamWithError();\n let queryId = that.getIdWithError(this);\n if (!queryId.success || !queryId.result) {\n result.errors = queryId.errors;\n return result;\n }\n const queryDelete = await that.deleteByIdWithError(queryId.result);\n result.errors = queryDelete.errors;\n return result;\n }\n onDelete(callback) {\n let id = that.getId(this);\n if (!that.recordsSubscribers.has(id)) {\n that.recordsSubscribers.set(id, {\n created: [],\n updated: [],\n deleted: []\n });\n }\n let sub = that.recordsSubscribers.get(id);\n if (sub && !sub.deleted.includes(callback)) {\n sub.deleted.push(callback);\n }\n }\n offDelete(callback) {\n let id = that.getId(this);\n let sub = that.recordsSubscribers.get(id);\n if (sub) {\n let index = sub.deleted.indexOf(callback);\n if (index != -1) {\n sub.deleted.splice(index, 1);\n }\n }\n }\n };\n }\n /**\n * Define all the types you ram is capable of\n */\n ramForTypes() {\n return [this.getTypeForData({})];\n }\n /**\n * Transform the object into the object stored inside Ram\n */\n getObjectForRam(objJson) {\n let Item = this.addRamAction(this.getTypeForData(objJson));\n let item = new Item();\n this.mergeObject(item, objJson);\n return item;\n }\n // onCreated: (item: any) => void;\n // onUpdated: (item: any) => void;\n // onDeleted: (item: any) => void;\n // }> = new Map();\n // private linkInfo: { [key: string | number]: { [id: string | number]: Request[]; }; } = {};\n // private linkRamItem(item: Request) {\n // for(let key in this.ramMapping) {\n // this.linkRamItemByKey(item, key);\n // private linkRamItemByKey(item: Request, key: string) {\n // if(key in item) {\n // if(mapping.asArray) {\n // if(Array.isArray(item[key])) {\n // console.error(key + \" in type \" + item + \" must be an array\");\n // const id = mapping.ram.getId(item[key]);\n // if(!this.linkFct.has(mapping.ram)) {\n // onCreated: (item) => {\n // onUpdated: (item) => {\n // onDeleted: (item) => {\n // this.linkFct.set(mapping.ram, fcts);\n // mapping.ram.onCreated(fcts.onCreated);\n // mapping.ram.onUpdated(fcts.onUpdated);\n // mapping.ram.onDeleted(fcts.onDeleted);\n // if(!this.linkInfo[key])\n // if(!this.linkInfo[key][id])\n // this.linkInfo[key][id].push(item);\n /**\n * Add element inside Ram or update it. The instance inside the ram is unique and ll never be replaced\n */\n async addOrUpdateData(item) {\n const resultTemp = new ResultWithError();\n try {\n const id = resultTemp.extract(() => this.getIdWithError(item));\n if (id === undefined)\n return resultTemp;\n if (this.records.has(id)) {\n let uniqueRecord = this.records.get(id);\n await resultTemp.runAsync(() => this.beforeRecordSet(uniqueRecord));\n // this.unlinkRamItem(uniqueRecord);\n if (resultTemp.success)\n this.mergeObject(uniqueRecord, item);\n await resultTemp.runAsync(() => this.afterRecordSet(uniqueRecord));\n // this.linkRamItem(uniqueRecord);\n resultTemp.result = {\n kind: 'updated',\n value: this.records.get(id)\n };\n }\n else {\n let realObject = this.getObjectForRam(item);\n await resultTemp.runAsync(() => this.beforeRecordSet(realObject));\n this.records.set(id, realObject);\n await resultTemp.runAsync(() => this.afterRecordSet(realObject));\n // this.linkRamItem(realObject);\n resultTemp.result = {\n kind: 'created',\n value: this.records.get(id)\n };\n }\n }\n catch (e) {\n resultTemp.errors.push(new RamError(RamErrorCode.unknow, e));\n }\n return resultTemp;\n }\n /**\n * Merge object and create real instance of class\n */\n mergeObject(item, objJson, options) {\n if (!item) {\n return;\n }\n if (!options) {\n options = {\n replaceUndefined: true\n };\n }\n Json.classFromJson(item, objJson, options);\n }\n /**\n * Create or update the item\n */\n async save(item, ...args) {\n let action = await this.saveWithError(item, ...args);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Create or update the item\n */\n async saveWithError(item, ...args) {\n let action = new ResultRamWithError();\n const id = action.extract(() => this.getIdWithError(item));\n if (id !== undefined) {\n if (id) {\n return this.updateWithError(item, ...args);\n }\n else {\n return this.createWithError(item, ...args);\n }\n }\n return action;\n }\n async beforeRecordSet(item) {\n return new VoidWithError();\n }\n async afterRecordSet(item) {\n return new VoidWithError();\n }\n async beforeRecordDelete(item) {\n return new VoidWithError();\n }\n async afterRecordDelete(item) {\n return new VoidWithError();\n }\n publish(type, data) {\n let callbacks = [...this.subscribers[type]];\n for (let callback of callbacks) {\n callback(data);\n }\n let sub = this.recordsSubscribers.get(this.getId(data));\n if (sub) {\n let localCallbacks = [...sub[type]];\n for (let localCallback of localCallbacks) {\n localCallback(data);\n }\n }\n }\n subscribe(type, cb) {\n if (!this.subscribers[type].includes(cb)) {\n this.subscribers[type].push(cb);\n }\n }\n unsubscribe(type, cb) {\n let index = this.subscribers[type].indexOf(cb);\n if (index != -1) {\n this.subscribers[type].splice(index, 1);\n }\n }\n /**\n * Add a callback that ll be triggered when a new item is stored\n */\n onCreated(cb) {\n this.subscribe('created', cb);\n }\n /**\n * Remove a created callback\n */\n offCreated(cb) {\n this.unsubscribe('created', cb);\n }\n /**\n * Add a callback that ll be triggered when an item is updated\n */\n onUpdated(cb) {\n this.subscribe('updated', cb);\n }\n /**\n * Remove an updated callback\n */\n offUpdated(cb) {\n this.unsubscribe('updated', cb);\n }\n /**\n * Add a callback that ll be triggered when an item is deleted\n */\n onDeleted(cb) {\n this.subscribe('deleted', cb);\n }\n /**\n * Remove an deleted callback\n */\n offDeleted(cb) {\n this.unsubscribe('deleted', cb);\n }\n /**\n * Get an item by id if exist (alias for getById)\n */\n async get(id) {\n return await this.getById(id);\n }\n ;\n /**\n * Get an item by id if exist (alias for getById)\n */\n async getWithError(id) {\n return await this.getByIdWithError(id);\n }\n ;\n /**\n * Get an item by id if exist\n */\n async getById(id) {\n let action = await this.getByIdWithError(id);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Get an item by id if exist\n */\n async getByIdWithError(id) {\n return this.actionGuard.run(['getByIdWithError', id], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeGetById(id));\n if (action.success) {\n if (this.records.has(id)) {\n const item = this.records.get(id);\n action.result = item;\n await action.runAsync(() => this.afterGetById(item));\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't find the item \" + id + \" inside ram\"));\n }\n }\n return action;\n });\n }\n /**\n * Trigger before getting an item by id\n */\n async beforeGetById(id) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after getting an item by id\n */\n async afterGetById(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Get multiple items by ids\n */\n async getByIds(ids) {\n let result = await this.getByIdsWithError(ids);\n if (result.success) {\n return result.result ?? [];\n }\n return [];\n }\n ;\n /**\n * Get multiple items by ids\n */\n async getByIdsWithError(ids) {\n return this.actionGuard.run(['getByIdsWithError', ids], async () => {\n const action = new ResultRamWithError();\n await action.runAsync(() => this.beforeGetByIds(ids));\n if (action.success) {\n const result = [];\n for (let id of ids) {\n let rec = this.records.get(id);\n if (rec) {\n result.push(rec);\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't find the item \" + id + \" inside ram\"));\n }\n }\n if (action.success) {\n action.result = result;\n await action.runAsync(() => this.afterGetByIds(result));\n }\n }\n return action;\n });\n }\n ;\n /**\n * Trigger before getting a list of items by id\n */\n async beforeGetByIds(ids) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after getting a list of items by id\n */\n async afterGetByIds(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getAll() {\n let result = await this.getAllWithError();\n if (result.success) {\n return result.result ?? [];\n }\n return [];\n }\n /**\n * Get all elements inside the Ram\n */\n async getAllWithError() {\n return this.actionGuard.run(['getAllWithError'], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeGetAll());\n if (action.success) {\n const result = Object.values(this.records);\n action.result = result;\n await action.runAsync(() => this.afterGetAll(result));\n }\n return action;\n });\n }\n /**\n * Trigger before getting all items inside Ram\n */\n async beforeGetAll() {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after getting all items inside Ram\n */\n async afterGetAll(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getList() {\n return await this.getAll();\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getListWithError() {\n return await this.getAllWithError();\n }\n /**\n * Get all elements inside the Ram\n */\n async getRecords() {\n const result = await this.getRecordsWithError();\n if (result.success) {\n return result.result ?? new Map();\n }\n return new Map();\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getRecordsWithError() {\n let action = new ResultRamWithError();\n action.runAsync(() => this.getAllWithError());\n if (action.success) {\n action.result = this.records;\n }\n return action;\n }\n /**\n * Create a list of items inside ram\n */\n async createList(list) {\n let result = await this.createListWithError(list);\n return result.result ?? [];\n }\n /**\n * Create a list of items inside ram\n */\n async createListWithError(list) {\n list = this.removeWatch(list);\n return this.actionGuard.run(['_createList'], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeCreateList(list));\n for (let item of list) {\n await action.runAsync(() => this.beforeCreateItem(item, true));\n }\n const resources = await action.extractAsync(() => this.transformCreateRequestListToItem(list));\n if (!resources)\n return action;\n const result = [];\n for (let item of resources) {\n const resultItem = await action.extractAsync(() => this.addOrUpdateData(item));\n if (!resultItem)\n return action;\n await action.runAsync(() => this.afterCreateItem(resultItem.value, true));\n if (action.success) {\n result.push(resultItem.value);\n this.publish('created', resultItem.value);\n }\n }\n action.result = result;\n await action.runAsync(() => this.afterCreateList(result));\n return action;\n });\n }\n /**\n * Create an item inside ram\n */\n async create(item, ...args) {\n let action = await this.createWithError(item, args);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Create an item inside ram\n */\n async createWithError(item, ...args) {\n item = this.removeWatch(item);\n return this.actionGuard.run(['_create', item], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeCreateItem(item, false));\n const resource = await action.extractAsync(() => this.transformCreateRequestToItem(item));\n if (!resource)\n return action;\n const id = await action.extract(() => this.getIdWithError(resource));\n if (id !== undefined) {\n const resultTemp = await action.extractAsync(() => this.addOrUpdateData(resource));\n if (!resultTemp)\n return action;\n await action.runAsync(() => this.afterCreateItem(resultTemp.value, false));\n if (action.success) {\n action.result = resultTemp.value;\n this.publish('created', resultTemp.value);\n }\n }\n return action;\n });\n }\n /**\n * Trigger before creating a list of items\n */\n async beforeCreateList(list) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger before creating an item\n */\n async beforeCreateItem(item, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after creating an item\n */\n async afterCreateItem(result, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after creating a list of items\n */\n async afterCreateList(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Update a list of items inside ram\n */\n async updateList(list) {\n let result = await this.updateListWithError(list);\n return result.result ?? [];\n }\n ;\n /**\n * Update a list of items inside ram\n */\n async updateListWithError(list) {\n list = this.removeWatch(list);\n return this.actionGuard.run(['_updateList'], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeUpdateList(list));\n for (let item of list) {\n await action.runAsync(() => this.beforeUpdateItem(item, true));\n }\n const resources = await action.extractAsync(() => this.transformUpdateRequestListToItem(list));\n if (!resources)\n return action;\n const result = [];\n for (let item of resources) {\n const resultItem = await action.extractAsync(() => this.addOrUpdateData(item));\n if (!resultItem)\n return action;\n await action.runAsync(() => this.afterUpdateItem(resultItem.value, true));\n if (action.success) {\n result.push(resultItem.value);\n this.publish('created', resultItem.value);\n }\n }\n action.result = result;\n await action.runAsync(() => this.afterUpdateList(result));\n return action;\n });\n }\n ;\n /**\n * Update an item inside ram\n */\n async update(item, ...args) {\n let action = await this.updateWithError(item, args);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Update an item inside ram\n */\n async updateWithError(item, ...args) {\n item = this.removeWatch(item);\n return this.actionGuard.run(['_update', item], async () => {\n let action = new ResultRamWithError();\n const id = await action.extract(() => this.getIdWithError(item));\n if (id === undefined)\n return action;\n if (this.records.has(id)) {\n const currentEl = this.records.get(id);\n if (currentEl == item) {\n console.warn(\"You are updating the same item. You should clone the object first to avoid weird effect\");\n }\n await action.runAsync(() => this.beforeUpdateItem(item, false));\n const resource = await action.extractAsync(() => this.transformUpdateRequestToItem(item));\n if (!resource)\n return action;\n const resultTemp = await action.extractAsync(() => this.addOrUpdateData(resource));\n if (!resultTemp)\n return action;\n await action.runAsync(() => this.afterUpdateItem(resultTemp.value, false));\n if (action.success) {\n action.result = resultTemp.value;\n this.publish('updated', resultTemp.value);\n }\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't update the item \" + id + \" because it wasn't found inside ram\"));\n }\n return action;\n });\n }\n /**\n * Trigger before updating a list of items\n */\n async beforeUpdateList(list) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger before updating an item\n */\n async beforeUpdateItem(item, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after updating an item\n */\n async afterUpdateItem(result, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after updating a list of items\n */\n async afterUpdateList(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Delete a list of items inside ram\n */\n async deleteList(list) {\n let result = await this.deleteListWithError(list);\n return result.result ?? [];\n }\n ;\n /**\n * Delete a list of items inside ram\n */\n async deleteListWithError(list) {\n list = this.removeWatch(list);\n let action = new ResultRamWithError();\n action.result = [];\n await action.runAsync(() => this.beforeDeleteList(list));\n const result = [];\n for (let item of list) {\n const resultItem = await action.extractAsync(() => this._delete(item, true));\n if (!resultItem)\n return action;\n result.push(resultItem);\n }\n if (action.success) {\n action.result = result;\n await action.runAsync(() => this.afterDeleteList(result));\n }\n return action;\n }\n ;\n /**\n * Delete an item inside ram\n */\n async delete(item, ...args) {\n let action = await this.deleteWithError(item, args);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n ;\n /**\n * Delete an item inside ram\n */\n async deleteWithError(item, ...args) {\n return await this._delete(item, false);\n }\n ;\n /**\n * Delete an item by id inside ram\n */\n async deleteById(id) {\n let action = await this.deleteByIdWithError(id);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Delete an item by id inside ram\n */\n async deleteByIdWithError(id) {\n let item = this.records.get(id);\n if (item) {\n return await this._delete(item, false);\n }\n let result = new ResultRamWithError();\n result.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't delete the item \" + id + \" because it wasn't found inside ram\"));\n return result;\n }\n async _delete(item, fromList) {\n item = this.removeWatch(item);\n return this.actionGuard.run(['_delete', item], async () => {\n let action = new ResultRamWithError();\n const id = action.extract(() => this.getIdWithError(item));\n if (id === undefined)\n return action;\n let oldItem = this.records.get(id);\n if (oldItem) {\n await action.runAsync(() => this.beforeDeleteItem(oldItem, fromList));\n await action.runAsync(() => this.beforeRecordDelete(oldItem));\n this.records.delete(id);\n await action.runAsync(() => this.afterRecordDelete(oldItem));\n await action.runAsync(() => this.afterDeleteItem(oldItem, fromList));\n if (action.success) {\n action.result = oldItem;\n this.publish('deleted', oldItem);\n }\n this.recordsSubscribers.delete(id);\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't delete the item \" + id + \" because it wasn't found inside ram\"));\n }\n return action;\n });\n }\n /**\n * Trigger before deleting a list of items\n */\n async beforeDeleteList(list) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger before deleting an item\n */\n async beforeDeleteItem(item, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after deleting an item\n */\n async afterDeleteItem(result, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after deleting a list of items\n */\n async afterDeleteList(result) {\n return new VoidWithError();\n }\n}\nGenericRam.Namespace=`Aventus`;\r\n__as1(_, 'GenericRam', GenericRam);\r\n","dependencies":[{"fullName":"Aventus.IRam","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.IRamData","isStrong":false},{"fullName":"Aventus.Request","isStrong":false},{"fullName":"Aventus.KeysObject","isStrong":false},{"fullName":"Aventus.Resource","isStrong":false},{"fullName":"Aventus.RamSubscribers","isStrong":false},{"fullName":"Aventus.RamItem","isStrong":false},{"fullName":"Aventus.ActionGuard","isStrong":false},{"fullName":"InternalProtected","isStrong":false},{"fullName":"BindThis","isStrong":false},{"fullName":"Aventus.ResultRamWithError","isStrong":false},{"fullName":"Aventus.RamError","isStrong":false},{"fullName":"Aventus.RamErrorCode","isStrong":false},{"fullName":"X","isStrong":false},{"fullName":"B","isStrong":false},{"fullName":"Base","isStrong":false},{"fullName":"Aventus.IRamAction","isStrong":false},{"fullName":"Aventus.VoidRamWithError","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.JsonFromOptions","isStrong":false},{"fullName":"Aventus.Json","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false}],"fullName":"Aventus.GenericRam","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Ram=class Ram extends GenericRam {\n}\nRam.Namespace=`Aventus`;\r\n__as1(_, 'Ram', Ram);\r\n","dependencies":[{"fullName":"Aventus.GenericRam","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.IRamData","isStrong":false},{"fullName":"Aventus.Request","isStrong":false},{"fullName":"Aventus.Resource","isStrong":false}],"fullName":"Aventus.Ram","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let StateManager=class StateManager {\n subscribers = {};\n static canBeActivate(statePattern, stateName) {\n let stateInfo = Uri.prepare(statePattern);\n return stateInfo.regex.test(stateName);\n }\n activeState;\n changeStateMutex = new Mutex();\n canChangeStateCbs = [];\n afterStateChanged = new Callback();\n /**\n * Subscribe actions for a state or a state list\n */\n subscribe(statePatterns, callbacks, autoActiveState = true) {\n if (!callbacks.active && !callbacks.inactive && !callbacks.askChange) {\n this._log(`Trying to subscribe to state : ${statePatterns} with no callbacks !`, \"warning\");\n return;\n }\n if (!Array.isArray(statePatterns)) {\n statePatterns = [statePatterns];\n }\n for (let statePattern of statePatterns) {\n if (!this.subscribers.hasOwnProperty(statePattern)) {\n let res = Uri.prepare(statePattern);\n let isActive = this.activeState !== undefined && res.regex.test(this.activeState.name);\n this.subscribers[statePattern] = {\n \"regex\": res.regex,\n \"params\": res.params,\n \"callbacks\": {\n \"active\": [],\n \"inactive\": [],\n \"askChange\": [],\n },\n \"isActive\": isActive,\n };\n }\n if (callbacks.active) {\n if (!Array.isArray(callbacks.active)) {\n callbacks.active = [callbacks.active];\n }\n for (let activeFct of callbacks.active) {\n this.subscribers[statePattern].callbacks.active.push(activeFct);\n if (this.subscribers[statePattern].isActive && this.activeState && autoActiveState) {\n let slugs = Uri.getParams(this.subscribers[statePattern], this.activeState.name);\n if (slugs) {\n activeFct(this.activeState, slugs);\n }\n }\n }\n }\n if (callbacks.inactive) {\n if (!Array.isArray(callbacks.inactive)) {\n callbacks.inactive = [callbacks.inactive];\n }\n for (let inactiveFct of callbacks.inactive) {\n this.subscribers[statePattern].callbacks.inactive.push(inactiveFct);\n }\n }\n if (callbacks.askChange) {\n if (!Array.isArray(callbacks.askChange)) {\n callbacks.askChange = [callbacks.askChange];\n }\n for (let askChangeFct of callbacks.askChange) {\n this.subscribers[statePattern].callbacks.askChange.push(askChangeFct);\n }\n }\n }\n }\n /**\n *\n */\n activateAfterSubscribe(statePatterns, callbacks) {\n if (!Array.isArray(statePatterns)) {\n statePatterns = [statePatterns];\n }\n for (let statePattern of statePatterns) {\n if (callbacks.active) {\n if (!Array.isArray(callbacks.active)) {\n callbacks.active = [callbacks.active];\n }\n for (let activeFct of callbacks.active) {\n if (this.subscribers[statePattern].isActive && this.activeState) {\n let slugs = Uri.getParams(this.subscribers[statePattern], this.activeState.name);\n if (slugs) {\n activeFct(this.activeState, slugs);\n }\n }\n }\n }\n }\n }\n /**\n * Unsubscribe actions for a state or a state list\n */\n unsubscribe(statePatterns, callbacks) {\n if (!callbacks.active && !callbacks.inactive && !callbacks.askChange) {\n this._log(`Trying to unsubscribe to state : ${statePatterns} with no callbacks !`, \"warning\");\n return;\n }\n if (!Array.isArray(statePatterns)) {\n statePatterns = [statePatterns];\n }\n for (let statePattern of statePatterns) {\n if (this.subscribers[statePattern]) {\n if (callbacks.active) {\n if (!Array.isArray(callbacks.active)) {\n callbacks.active = [callbacks.active];\n }\n for (let activeFct of callbacks.active) {\n let index = this.subscribers[statePattern].callbacks.active.indexOf(activeFct);\n if (index !== -1) {\n this.subscribers[statePattern].callbacks.active.splice(index, 1);\n }\n }\n }\n if (callbacks.inactive) {\n if (!Array.isArray(callbacks.inactive)) {\n callbacks.inactive = [callbacks.inactive];\n }\n for (let inactiveFct of callbacks.inactive) {\n let index = this.subscribers[statePattern].callbacks.inactive.indexOf(inactiveFct);\n if (index !== -1) {\n this.subscribers[statePattern].callbacks.inactive.splice(index, 1);\n }\n }\n }\n if (callbacks.askChange) {\n if (!Array.isArray(callbacks.askChange)) {\n callbacks.askChange = [callbacks.askChange];\n }\n for (let askChangeFct of callbacks.askChange) {\n let index = this.subscribers[statePattern].callbacks.askChange.indexOf(askChangeFct);\n if (index !== -1) {\n this.subscribers[statePattern].callbacks.askChange.splice(index, 1);\n }\n }\n }\n if (this.subscribers[statePattern].callbacks.active.length === 0 &&\n this.subscribers[statePattern].callbacks.inactive.length === 0 &&\n this.subscribers[statePattern].callbacks.askChange.length === 0) {\n delete this.subscribers[statePattern];\n }\n }\n }\n }\n onAfterStateChanged(cb) {\n this.afterStateChanged.add(cb);\n }\n offAfterStateChanged(cb) {\n this.afterStateChanged.remove(cb);\n }\n assignDefaultState(stateName) {\n return new EmptyState(stateName);\n }\n canChangeState(cb) {\n this.canChangeStateCbs.push(cb);\n }\n /**\n * Activate a current state\n */\n async setState(state) {\n let result = await this.changeStateMutex.safeRunLastAsync(async () => {\n let stateToUse;\n if (typeof state == \"string\") {\n stateToUse = this.assignDefaultState(state);\n }\n else {\n stateToUse = state;\n }\n if (!stateToUse) {\n this._log(\"state is undefined\", \"error\");\n this.changeStateMutex.release();\n return false;\n }\n for (let cb of this.canChangeStateCbs) {\n if (!(await cb(stateToUse))) {\n return false;\n }\n }\n let canChange = true;\n if (this.activeState) {\n let activeToInactive = [];\n let inactiveToActive = [];\n let triggerActive = [];\n canChange = await this.activeState.askChange(this.activeState, stateToUse);\n if (canChange) {\n for (let statePattern in this.subscribers) {\n let subscriber = this.subscribers[statePattern];\n if (subscriber.isActive) {\n let clone = [...subscriber.callbacks.askChange];\n let currentSlug = Uri.getParams(subscriber, this.activeState.name);\n if (currentSlug) {\n for (let i = 0; i < clone.length; i++) {\n let askChange = clone[i];\n if (!await askChange(this.activeState, stateToUse, currentSlug)) {\n canChange = false;\n break;\n }\n }\n }\n let slugs = Uri.getParams(subscriber, stateToUse.name);\n if (slugs === null) {\n activeToInactive.push(subscriber);\n }\n else {\n triggerActive.push({\n subscriber: subscriber,\n params: slugs\n });\n }\n }\n else {\n let slugs = Uri.getParams(subscriber, stateToUse.name);\n if (slugs) {\n inactiveToActive.push({\n subscriber,\n params: slugs\n });\n }\n }\n if (!canChange) {\n break;\n }\n }\n }\n if (canChange) {\n const oldState = this.activeState;\n this.activeState = stateToUse;\n oldState.onInactivate(stateToUse);\n for (let subscriber of activeToInactive) {\n subscriber.isActive = false;\n let oldSlug = Uri.getParams(subscriber, oldState.name);\n if (oldSlug) {\n let oldSlugNotNull = oldSlug;\n let callbacks = [...subscriber.callbacks.inactive];\n for (let callback of callbacks) {\n callback(oldState, stateToUse, oldSlugNotNull);\n }\n }\n }\n for (let trigger of triggerActive) {\n let callbacks = [...trigger.subscriber.callbacks.active];\n for (let callback of callbacks) {\n callback(stateToUse, trigger.params);\n }\n }\n for (let trigger of inactiveToActive) {\n trigger.subscriber.isActive = true;\n let callbacks = [...trigger.subscriber.callbacks.active];\n for (let callback of callbacks) {\n callback(stateToUse, trigger.params);\n }\n }\n stateToUse.onActivate();\n }\n }\n else {\n this.activeState = stateToUse;\n for (let key in this.subscribers) {\n let slugs = Uri.getParams(this.subscribers[key], stateToUse.name);\n if (slugs) {\n let slugsNotNull = slugs;\n this.subscribers[key].isActive = true;\n let callbacks = [...this.subscribers[key].callbacks.active];\n for (let callback of callbacks) {\n callback(stateToUse, slugsNotNull);\n }\n }\n }\n stateToUse.onActivate();\n }\n this.afterStateChanged.trigger();\n return true;\n });\n return result ?? false;\n }\n getState() {\n return this.activeState;\n }\n /**\n * Check if a state is in the subscribers and active, return true if it is, false otherwise\n */\n isStateActive(statePattern) {\n return Uri.isActive(statePattern, this.activeState?.name ?? '');\n }\n /**\n * Get slugs information for the current state, return null if state isn't active\n */\n getStateSlugs(statePattern) {\n return Uri.getParams(statePattern, this.activeState?.name ?? '');\n }\n // 0 = error only / 1 = errors and warning / 2 = error, warning and logs (not implemented)\n logLevel() {\n return 0;\n }\n _log(msg, type) {\n if (type === \"error\") {\n console.error(msg);\n }\n else if (type === \"warning\" && this.logLevel() > 0) {\n console.warn(msg);\n }\n else if (type === \"info\" && this.logLevel() > 1) {\n console.log(msg);\n }\n }\n}\nStateManager.Namespace=`Aventus`;\r\n__as1(_, 'StateManager', StateManager);\r\n","dependencies":[{"fullName":"Aventus.IStateManager","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Subscriber","isStrong":false},{"fullName":"Aventus.Uri","isStrong":false},{"fullName":"Aventus.Mutex","isStrong":false},{"fullName":"Aventus.Callback","isStrong":false},{"fullName":"Aventus.StateAction","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false},{"fullName":"Aventus.EmptyState","isStrong":false},{"fullName":"Aventus.State","isStrong":false}],"fullName":"Aventus.StateManager","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let State=class State {\n /**\n * Activate a custom state inside a specific manager\n * It ll be a generic state with no information inside exept name\n */\n static async activate(stateName, manager) {\n return await manager.setState(stateName);\n }\n /**\n * Activate this state inside a specific manager\n */\n async activate(manager) {\n return await manager.setState(this);\n }\n onActivate() {\n }\n onInactivate(nextState) {\n }\n async askChange(state, nextState) {\n return true;\n }\n}\nState.Namespace=`Aventus`;\r\n__as1(_, 'State', State);\r\n","dependencies":[{"fullName":"Aventus.IState","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateManager","isStrong":false},{"fullName":"Aventus.Asyncable","isStrong":false}],"fullName":"Aventus.State","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let EmptyState=class EmptyState extends State {\n localName;\n constructor(stateName) {\n super();\n this.localName = stateName;\n }\n /**\n * @inheritdoc\n */\n get name() {\n return this.localName;\n }\n}\nEmptyState.Namespace=`Aventus`;\r\n__as1(_, 'EmptyState', EmptyState);\r\n","dependencies":[{"fullName":"Aventus.State","isStrong":true},{"fullName":"Aventus.IState","isStrong":true},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.EmptyState","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let TemplateInstance=class TemplateInstance {\n context;\n content;\n actions;\n component;\n _components = {};\n firstRenderUniqueCb = {};\n firstRenderCb = [];\n firstChild;\n lastChild;\n computeds = [];\n renderingComputeds = [];\n loopRegisteries = {};\n loops = [];\n ifs = [];\n isDestroyed = false;\n constructor(component, content, actions, loops, ifs, context) {\n this.component = component;\n this.content = content;\n this.actions = actions;\n this.ifs = ifs;\n this.loops = loops;\n this.context = context ? context : new TemplateContext(component);\n this.firstChild = content.firstElementChild;\n this.lastChild = content.lastElementChild;\n this.selectElements();\n this.transformActionsListening();\n }\n render() {\n this.updateContext();\n this.bindEvents();\n for (let cb of this.firstRenderCb) {\n cb();\n }\n for (let key in this.firstRenderUniqueCb) {\n this.firstRenderUniqueCb[key]();\n }\n this.renderSubTemplate();\n }\n destructor() {\n this.isDestroyed = true;\n for (let name in this.loopRegisteries) {\n let register = this.loopRegisteries[name];\n for (let item of register.templates) {\n item.destructor();\n }\n for (let item of register.computeds) {\n item.destroy();\n }\n if (register.unsub) {\n register.unsub();\n }\n }\n this.loopRegisteries = {};\n this.context.destructor();\n for (let computed of this.computeds) {\n computed.destroy();\n }\n for (let computed of this.renderingComputeds) {\n computed.destroy();\n }\n this.computeds = [];\n this.removeFromDOM();\n }\n removeFromDOM(avoidTrigger = false) {\n if (avoidTrigger) {\n let node = this.firstChild;\n while (node && node != this.lastChild) {\n let next = node.nextElementSibling;\n node.parentNode?.removeChild(node);\n node = next;\n }\n this.lastChild?.parentNode?.removeChild(this.lastChild);\n }\n else {\n let node = this.firstChild;\n while (node && node != this.lastChild) {\n let next = node.nextElementSibling;\n node.remove();\n node = next;\n }\n this.lastChild?.remove();\n }\n }\n selectElements() {\n this._components = {};\n let idEls = Array.from(this.content.querySelectorAll('[_id]'));\n for (let idEl of idEls) {\n let id = idEl.attributes['_id'].value;\n if (!this._components[id]) {\n this._components[id] = [];\n }\n this._components[id].push(idEl);\n }\n if (this.actions.elements) {\n for (let element of this.actions.elements) {\n let components = [];\n for (let id of element.ids) {\n if (this._components[id]) {\n components = [...components, ...this._components[id]];\n }\n }\n if (element.isArray) {\n setValueToObject(element.name, this.component, components);\n }\n else if (components[0]) {\n setValueToObject(element.name, this.component, components[0]);\n }\n }\n }\n }\n updateContext() {\n if (this.actions.contextEdits) {\n for (let contextEdit of this.actions.contextEdits) {\n this.renderContextEdit(contextEdit);\n }\n }\n }\n renderContextEdit(edit) {\n let _class = edit.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n try {\n return edit.fct(this.context);\n }\n catch (e) {\n }\n return {};\n });\n computed.subscribe((action, path, value, dones) => {\n for (let key in computed.value) {\n let newValue = computed.value[key];\n this.context.updateWatch(key, newValue, dones);\n }\n });\n this.computeds.push(computed);\n for (let key in computed.value) {\n this.context.registerWatch(key, computed.value[key]);\n }\n }\n bindEvents() {\n if (this.actions.events) {\n for (let event of this.actions.events) {\n this.bindEvent(event);\n }\n }\n if (this.actions.pressEvents) {\n for (let event of this.actions.pressEvents) {\n this.bindPressEvent(event);\n }\n }\n }\n bindEvent(event) {\n if (!this._components[event.id]) {\n return;\n }\n if (event.isCallback) {\n for (let el of this._components[event.id]) {\n let cb = getValueFromObject(event.eventName, el);\n if (!cb && el.tagName.includes('-')) {\n customElements.upgrade(el);\n cb = getValueFromObject(event.eventName, el);\n }\n cb?.add((...args) => {\n try {\n return event.fct(this.context, args);\n }\n catch (e) {\n console.error(e);\n }\n });\n }\n }\n else {\n for (let el of this._components[event.id]) {\n el.addEventListener(event.eventName, (e) => {\n try {\n event.fct(e, this.context);\n }\n catch (e) {\n console.error(e);\n }\n });\n }\n }\n }\n bindPressEvent(event) {\n let id = event['id'];\n if (id && this._components[id]) {\n let clone = {};\n for (let temp in event) {\n if (temp != 'id') {\n const ev = event;\n if (ev[temp] instanceof Function) {\n clone[temp] = (e, pressInstance) => { ev[temp](e, pressInstance, this.context); };\n }\n else {\n clone[temp] = ev[temp];\n }\n }\n }\n clone.element = this._components[id];\n PressManager.create(clone);\n }\n }\n transformActionsListening() {\n if (this.actions.content) {\n for (let name in this.actions.content) {\n this.transformChangeAction(name, this.actions.content[name]);\n }\n }\n if (this.actions.injection) {\n for (let injection of this.actions.injection) {\n this.transformInjectionAction(injection);\n }\n }\n if (this.actions.bindings) {\n for (let binding of this.actions.bindings) {\n this.transformBindigAction(binding);\n }\n }\n }\n transformChangeAction(name, change) {\n const [id, attr] = name.split(\"°\");\n if (!this._components[id])\n return;\n let apply = () => { };\n if (attr == \"@HTML\") {\n apply = () => {\n let value = this.context.print(computed.value);\n for (const el of this._components[id])\n el.innerHTML = value;\n };\n }\n else {\n apply = () => {\n let value = this.context.print(computed.value);\n if (value === \"false\") {\n for (const el of this._components[id]) {\n el.removeAttribute(attr);\n }\n }\n else {\n for (const el of this._components[id]) {\n el.setAttribute(attr, value);\n }\n }\n };\n }\n let _class = change.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n try {\n return change.fct(this.context);\n }\n catch (e) {\n if (e instanceof TypeError && e.message.includes(\"undefined\")) {\n if (computed instanceof ComputedNoRecomputed) {\n computed.isInit = false;\n }\n }\n else {\n console.error(e);\n }\n }\n return \"\";\n });\n let timeout;\n computed.subscribe((action, path, value, dones) => {\n clearTimeout(timeout);\n // add timeout to group change that append on the same frame (for example index update)\n timeout = setTimeout(() => {\n if (computed.isDestroy)\n return;\n apply();\n });\n });\n this.renderingComputeds.push(computed);\n this.firstRenderUniqueCb[name] = () => {\n apply();\n };\n }\n transformInjectionAction(injection) {\n if (!this._components[injection.id])\n return;\n let _class = injection.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n try {\n return injection.inject(this.context);\n }\n catch (e) {\n if (e instanceof TypeError && e.message.includes(\"undefined\")) {\n if (computed instanceof ComputedNoRecomputed) {\n computed.isInit = false;\n }\n }\n else {\n console.error(e);\n }\n }\n });\n this.computeds.push(computed);\n computed.subscribe((action, path, value, dones) => {\n for (const el of this._components[injection.id]) {\n if (el instanceof WebComponent && el.__watch && Object.hasOwn(el.__watch, injection.injectionName)) {\n el.__watch.__injectedDones(dones);\n }\n el[injection.injectionName] = computed.value;\n }\n });\n this.firstRenderCb.push(() => {\n for (const el of this._components[injection.id]) {\n customElements.upgrade(el);\n el[injection.injectionName] = computed.value;\n }\n });\n }\n transformBindigAction(binding) {\n let isLocalChange = false;\n let _class = binding.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n try {\n return binding.inject(this.context);\n }\n catch (e) {\n if (e instanceof TypeError && e.message.includes(\"undefined\")) {\n if (computed instanceof ComputedNoRecomputed) {\n computed.isInit = false;\n }\n }\n else {\n console.error(e);\n }\n }\n });\n this.computeds.push(computed);\n computed.subscribe((action, path, value, dones) => {\n if (isLocalChange)\n return;\n for (const el of this._components[binding.id]) {\n if (el instanceof WebComponent && el.__watch && Object.hasOwn(el.__watch, binding.injectionName)) {\n el.__watch.__injectedDones(dones);\n }\n el[binding.injectionName] = computed.value;\n }\n });\n this.firstRenderCb.push(() => {\n for (const el of this._components[binding.id]) {\n customElements.upgrade(el);\n el[binding.injectionName] = computed.value;\n }\n });\n if (binding.isCallback) {\n this.firstRenderCb.push(() => {\n for (var el of this._components[binding.id]) {\n for (let fct of binding.eventNames) {\n let cb = getValueFromObject(fct, el);\n if (!cb && el.tagName.includes('-')) {\n customElements.upgrade(el);\n cb = getValueFromObject(binding.injectionName, el);\n }\n cb?.add((value) => {\n let valueToSet = getValueFromObject(binding.injectionName, el);\n isLocalChange = true;\n binding.extract(this.context, valueToSet);\n isLocalChange = false;\n });\n }\n }\n });\n }\n else {\n this.firstRenderCb.push(() => {\n for (var el of this._components[binding.id]) {\n customElements.upgrade(el);\n for (let fct of binding.eventNames) {\n el.addEventListener(fct, (e) => {\n let valueToSet = getValueFromObject(binding.injectionName, e.target);\n isLocalChange = true;\n binding.extract(this.context, valueToSet);\n isLocalChange = false;\n });\n }\n }\n });\n }\n }\n renderSubTemplate() {\n for (let loop of this.loops) {\n this.renderLoop(loop);\n }\n for (let _if of this.ifs) {\n this.renderIf(_if);\n }\n }\n renderLoop(loop) {\n if (loop.func) {\n this.renderLoopComplex(loop);\n }\n else if (loop.simple) {\n this.renderLoopSimple(loop, loop.simple);\n }\n }\n resetLoopComplex(anchorId) {\n if (this.loopRegisteries[anchorId]) {\n for (let item of this.loopRegisteries[anchorId].templates) {\n item.destructor();\n }\n for (let item of this.loopRegisteries[anchorId].computeds) {\n item.destroy();\n }\n }\n this.loopRegisteries[anchorId] = {\n templates: [],\n computeds: [],\n };\n }\n renderLoopComplex(loop) {\n if (!loop.func)\n return;\n let fctsTemp = loop.func.bind(this.component)(this.context);\n let fcts = {\n apply: fctsTemp.apply,\n condition: fctsTemp.condition,\n transform: fctsTemp.transform ?? (() => { })\n };\n this.resetLoopComplex(loop.anchorId);\n let computedsCondition = [];\n let alreadyRecreated = false;\n const createComputedCondition = () => {\n let compCondition = new Computed(() => {\n return fcts.condition();\n });\n compCondition.value;\n compCondition.subscribe((action, path, value) => {\n if (!alreadyRecreated) {\n alreadyRecreated = true;\n this.renderLoopComplex(loop);\n }\n });\n computedsCondition.push(compCondition);\n this.loopRegisteries[loop.anchorId].computeds.push(compCondition);\n return compCondition;\n };\n let result = [];\n let compCondition = createComputedCondition();\n while (compCondition.value) {\n result.push(fcts.apply());\n fcts.transform();\n compCondition = createComputedCondition();\n }\n let anchor = this._components[loop.anchorId][0];\n for (let i = 0; i < result.length; i++) {\n let context = new TemplateContext(this.component, result[i], this.context, this.loopRegisteries[loop.anchorId]);\n let content = loop.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = loop.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, loop.template.loops, loop.template.ifs, context);\n instance.render();\n anchor.parentNode?.insertBefore(instance.content, anchor);\n this.loopRegisteries[loop.anchorId].templates.push(instance);\n }\n }\n resetLoopSimple(anchorId, basePath) {\n let register = this.loopRegisteries[anchorId];\n if (register?.unsub) {\n register.unsub();\n }\n this.resetLoopComplex(anchorId);\n }\n renderLoopSimple(loop, simple) {\n let onThis = simple.data.startsWith(\"this.\");\n let basePath = this.context.normalizePath(simple.data);\n this.resetLoopSimple(loop.anchorId, basePath);\n let getElements = () => this.context.getValueFromItem(basePath);\n let elements = getElements();\n if (!elements) {\n let currentPath = basePath;\n while (currentPath != '' && !elements) {\n let splittedPath = currentPath.split(\".\");\n splittedPath.pop();\n currentPath = splittedPath.join(\".\");\n elements = this.context.getValueFromItem(currentPath);\n }\n if (!elements && onThis) {\n const splittedPath = basePath.split(\".\");\n const firstPart = splittedPath.length > 0 ? splittedPath[0] : null;\n if (firstPart && this.component.__signals[firstPart]) {\n elements = this.component.__signals[firstPart];\n }\n else {\n elements = this.component.__watch;\n }\n }\n if (!elements || !(elements.__isProxy || elements instanceof Signal)) {\n debugger;\n }\n const subTemp = (action, path, value) => {\n if (basePath.startsWith(path) || path == \"*\") {\n elements.unsubscribe(subTemp);\n this.renderLoopSimple(loop, simple);\n return;\n }\n };\n elements.subscribe(subTemp);\n return;\n }\n let indexName = this.context.registerIndex();\n let keys = Object.keys(elements);\n if (elements.__isProxy) {\n let regexArray = new RegExp(\"^\\\\[(\\\\d+?)\\\\]$\");\n let regexObject = new RegExp(\"^([^\\\\.]*)$\");\n let sub = (action, path, value) => {\n if (this.isDestroyed)\n return;\n if (path == \"\") {\n this.renderLoopSimple(loop, simple);\n return;\n }\n if (action == WatchAction.UPDATED) {\n return;\n }\n let index = undefined;\n regexArray.lastIndex = 0;\n regexObject.lastIndex = 0;\n let resultArray = regexArray.exec(path);\n if (resultArray) {\n index = Number(resultArray[1]);\n }\n else {\n let resultObject = regexObject.exec(path);\n if (resultObject) {\n let oldKey = resultObject[1];\n if (action == WatchAction.CREATED) {\n keys = Object.keys(getElements());\n index = keys.indexOf(oldKey);\n }\n else if (action == WatchAction.DELETED) {\n index = keys.indexOf(oldKey);\n keys = Object.keys(getElements());\n }\n }\n }\n if (index !== undefined) {\n let registry = this.loopRegisteries[loop.anchorId];\n if (action == WatchAction.CREATED) {\n let context = new TemplateContext(this.component, {}, this.context, registry);\n context.registerLoop(basePath, index, indexName, simple.index, simple.item, onThis);\n let content = loop.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = loop.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, loop.template.loops, loop.template.ifs, context);\n instance.render();\n let anchor;\n if (index < registry.templates.length) {\n anchor = registry.templates[index].firstChild;\n }\n else {\n anchor = this._components[loop.anchorId][0];\n }\n anchor?.parentNode?.insertBefore(instance.content, anchor);\n registry.templates.splice(index, 0, instance);\n for (let i = index + 1; i < registry.templates.length; i++) {\n registry.templates[i].context.increaseIndex(indexName);\n }\n }\n else if (action == WatchAction.DELETED) {\n registry.templates[index].destructor();\n registry.templates.splice(index, 1);\n for (let i = index; i < registry.templates.length; i++) {\n registry.templates[i].context.decreaseIndex(indexName);\n }\n }\n }\n };\n this.loopRegisteries[loop.anchorId].unsub = () => {\n elements.unsubscribe(sub);\n };\n elements.subscribe(sub);\n }\n let anchor = this._components[loop.anchorId][0];\n for (let i = 0; i < keys.length; i++) {\n let context = new TemplateContext(this.component, {}, this.context, this.loopRegisteries[loop.anchorId]);\n context.registerLoop(basePath, i, indexName, simple.index, simple.item, onThis);\n let content = loop.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = loop.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, loop.template.loops, loop.template.ifs, context);\n instance.render();\n anchor.parentNode?.insertBefore(instance.content, anchor);\n this.loopRegisteries[loop.anchorId].templates.push(instance);\n }\n }\n renderIf(_if) {\n // this.renderIfMemory(_if);\n this.renderIfRecreate(_if);\n }\n renderIfMemory(_if) {\n let computeds = [];\n let instances = [];\n if (!this._components[_if.anchorId] || this._components[_if.anchorId].length == 0)\n return;\n let anchor = this._components[_if.anchorId][0];\n let currentActive = -1;\n const calculateActive = () => {\n let newActive = -1;\n for (let i = 0; i < _if.parts.length; i++) {\n if (computeds[i].value) {\n newActive = i;\n break;\n }\n }\n if (newActive == currentActive) {\n return;\n }\n if (currentActive != -1) {\n let instance = instances[currentActive];\n let node = instance.firstChild;\n while (node && node != instance.lastChild) {\n let next = node.nextElementSibling;\n instance.content.appendChild(node);\n node = next;\n }\n if (instance.lastChild)\n instance.content.appendChild(instance.lastChild);\n }\n currentActive = newActive;\n if (instances[currentActive])\n anchor.parentNode?.insertBefore(instances[currentActive].content, anchor);\n };\n for (let i = 0; i < _if.parts.length; i++) {\n const part = _if.parts[i];\n let _class = part.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n return part.condition(this.context);\n });\n computeds.push(computed);\n computed.subscribe(() => {\n calculateActive();\n });\n this.computeds.push(computed);\n let context = new TemplateContext(this.component, {}, this.context);\n let content = part.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = part.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, part.template.loops, part.template.ifs, context);\n instances.push(instance);\n instance.render();\n }\n calculateActive();\n }\n renderIfRecreate(_if) {\n let computeds = [];\n if (!this._components[_if.anchorId] || this._components[_if.anchorId].length == 0)\n return;\n let anchor = this._components[_if.anchorId][0];\n let currentActive = undefined;\n let currentActiveNb = -1;\n const createContext = () => {\n if (currentActiveNb < 0 || currentActiveNb > _if.parts.length - 1) {\n currentActive = undefined;\n return;\n }\n const part = _if.parts[currentActiveNb];\n let context = new TemplateContext(this.component, {}, this.context);\n let content = part.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = part.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, part.template.loops, part.template.ifs, context);\n currentActive = instance;\n instance.render();\n anchor.parentNode?.insertBefore(currentActive.content, anchor);\n };\n for (let i = 0; i < _if.parts.length; i++) {\n const part = _if.parts[i];\n let _class = part.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n return part.condition(this.context);\n });\n computeds.push(computed);\n computed.subscribe(() => {\n calculateActive();\n });\n this.computeds.push(computed);\n }\n const calculateActive = () => {\n let newActive = -1;\n for (let i = 0; i < _if.parts.length; i++) {\n if (computeds[i].value) {\n newActive = i;\n break;\n }\n }\n if (newActive == currentActiveNb) {\n return;\n }\n if (currentActive) {\n currentActive.destructor();\n }\n currentActiveNb = newActive;\n createContext();\n };\n calculateActive();\n }\n}\nTemplateInstance.Namespace=`Aventus`;\r\n__as1(_, 'TemplateInstance', TemplateInstance);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false},{"fullName":"Aventus.Actions","isStrong":false},{"fullName":"Aventus.Effect","isStrong":false},{"fullName":"Aventus.LoopRegistery","isStrong":false},{"fullName":"Aventus.Loop","isStrong":false},{"fullName":"Aventus.If","isStrong":false},{"fullName":"Aventus.setValueToObject","isStrong":false},{"fullName":"Aventus.ContextEdit","isStrong":false},{"fullName":"Aventus.ComputedNoRecomputed","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false},{"fullName":"Aventus.ActionEvent","isStrong":false},{"fullName":"Aventus.getValueFromObject","isStrong":false},{"fullName":"Aventus.PressManagerOptions","isStrong":false},{"fullName":"clone","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.ActionChange","isStrong":false},{"fullName":"Aventus.ActionInjection","isStrong":false},{"fullName":"Aventus.ActionBindings","isStrong":false},{"fullName":"Aventus.LoopFct","isStrong":false},{"fullName":"Aventus.LoopSimple","isStrong":false},{"fullName":"Signal","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false},{"fullName":"Aventus.WatcherFunction","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.TemplateInstance","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let TemplateContext=class TemplateContext {\n data = {};\n comp;\n computeds = [];\n watch;\n registry;\n isDestroyed = false;\n constructor(component, data = {}, parentContext, registry) {\n this.comp = component;\n this.registry = registry;\n this.watch = Watcher.get({});\n let that = this;\n for (let key in data) {\n if (data[key].__isProxy) {\n Object.defineProperty(this.data, key, {\n get() {\n return data[key];\n }\n });\n }\n else {\n this.watch[key] = data[key];\n Object.defineProperty(this.data, key, {\n get() {\n return that.watch[key];\n }\n });\n }\n }\n if (parentContext) {\n const descriptors = Object.getOwnPropertyDescriptors(parentContext.data);\n for (let name in descriptors) {\n Object.defineProperty(this.data, name, {\n get() {\n return parentContext.data[name];\n }\n });\n }\n }\n }\n print(value) {\n return value == null ? \"\" : value + \"\";\n }\n registerIndex() {\n let name = \"index\";\n let i = 0;\n let fullName = name + i;\n while (this.watch[fullName] !== undefined) {\n i++;\n fullName = name + i;\n }\n return fullName;\n }\n registerLoop(dataName, _indexValue, _indexName, indexName, itemName, onThis) {\n this.watch[_indexName] = _indexValue;\n let getItems;\n let mustBeRecomputed = /if|switch|\\?|\\[.+?\\]/g.test(dataName);\n let _class = mustBeRecomputed ? Computed : ComputedNoRecomputed;\n if (!onThis) {\n getItems = new _class(() => {\n return getValueFromObject(dataName, this.data);\n });\n }\n else {\n dataName = dataName.replace(/^this\\./, '');\n getItems = new _class(() => {\n return getValueFromObject(dataName, this.comp);\n });\n }\n let getIndex = new ComputedNoRecomputed(() => {\n let items = getItems.value;\n if (!items)\n throw 'impossible';\n let keys = Object.keys(items);\n let index = keys[_getIndex.value];\n if (/^[0-9]+$/g.test(index))\n return Number(index);\n return index;\n });\n let getItem = new ComputedNoRecomputed(() => {\n let items = getItems.value;\n if (!items)\n throw 'impossible';\n let keys = Object.keys(items);\n let index = keys[_getIndex.value];\n let element = items[index];\n if (element === undefined && (Array.isArray(items) || !items)) {\n if (this.registry) {\n let indexNb = Number(_getIndex.value);\n if (!isNaN(indexNb)) {\n this.registry.templates[indexNb].destructor();\n this.registry.templates.splice(indexNb, 1);\n for (let i = indexNb; i < this.registry.templates.length; i++) {\n this.registry.templates[i].context.decreaseIndex(_indexName);\n }\n }\n }\n }\n return element;\n });\n let _getIndex = new ComputedNoRecomputed(() => {\n return this.watch[_indexName];\n });\n this.computeds.push(getIndex);\n this.computeds.push(getItem);\n this.computeds.push(_getIndex);\n if (itemName) {\n Object.defineProperty(this.data, itemName, {\n get() {\n return getItem.value;\n }\n });\n }\n if (indexName) {\n Object.defineProperty(this.data, indexName, {\n get() {\n return getIndex.value;\n }\n });\n }\n }\n updateIndex(newIndex, _indexName) {\n // let items: any[] | {};\n // if(!dataName.startsWith(\"this.\")) {\n // let comp = new Computed(() => {\n // return getValueFromObject(dataName, this.data);\n // });\n // fullName = dataName.replace(/^this\\./, '');\n // items = getValueFromObject(fullName, this.comp);\n // if(Array.isArray(items)) {\n // let regex = new RegExp(\"^(\" + fullName.replace(/\\./g, \"\\\\.\") + \")\\\\[(\\\\d+?)\\\\]\");\n // for(let computed of computeds) {\n // for(let cb of computed.callbacks) {\n // cb.path = cb.path.replace(regex, \"$1[\" + newIndex + \"]\");\n // let oldKey = Object.keys(items)[this.watch[_indexName]]\n // let newKey = Object.keys(items)[newIndex]\n // let regex = new RegExp(\"^(\" + fullName.replace(/\\./g, \"\\\\.\") + \"\\\\.)(\" + oldKey + \")($|\\\\.)\");\n // for (let computed of computeds) {\n // for (let cb of computed.callbacks) {\n // cb.path = cb.path.replace(regex, \"$1\" + newKey + \"$3\")\n this.watch[_indexName] = newIndex;\n }\n increaseIndex(_indexName) {\n this.updateIndex(this.watch[_indexName] + 1, _indexName);\n }\n decreaseIndex(_indexName) {\n this.updateIndex(this.watch[_indexName] - 1, _indexName);\n }\n destructor() {\n this.isDestroyed = true;\n for (let computed of this.computeds) {\n computed.destroy();\n }\n this.computeds = [];\n }\n registerWatch(name, value) {\n let that = this;\n that.watch[name] = value;\n Object.defineProperty(that.data, name, {\n get() {\n return that.watch[name];\n }\n });\n }\n updateWatch(name, value, dones) {\n if (Watcher.is(this.watch[name])) {\n this.watch[name].__injectedDones(dones);\n }\n this.watch[name] = value;\n }\n normalizePath(path) {\n path = path.replace(/^this\\./, '');\n const regex = /\\[(.*?)\\]/g;\n let m;\n while ((m = regex.exec(path)) !== null) {\n if (m.index === regex.lastIndex) {\n regex.lastIndex++;\n }\n let name = m[1];\n let result = getValueFromObject(name, this.data);\n if (result !== undefined) {\n path = path.replace(m[0], `[${result}]`);\n }\n }\n return path;\n }\n getValueFromItem(name) {\n if (!name)\n return undefined;\n let result = getValueFromObject(name, this.data);\n if (result !== undefined) {\n return result;\n }\n result = getValueFromObject(name, this.comp);\n if (result !== undefined) {\n return result;\n }\n return undefined;\n }\n setValueToItem(name, value) {\n setValueToObject(name, this.comp, value);\n }\n}\nTemplateContext.Namespace=`Aventus`;\r\n__as1(_, 'TemplateContext', TemplateContext);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false},{"fullName":"Aventus.LoopRegistery","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.ComputedNoRecomputed","isStrong":false},{"fullName":"Aventus.getValueFromObject","isStrong":false},{"fullName":"Aventus.setValueToObject","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.TemplateContext","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Template=class Template {\n static validatePath(path, pathToCheck) {\n if (pathToCheck.startsWith(path)) {\n return true;\n }\n return false;\n }\n cst;\n constructor(component) {\n this.cst = component;\n }\n htmlParts = [];\n setHTML(data) {\n this.htmlParts.push(data);\n }\n generateTemplate() {\n this.template = document.createElement('template');\n let currentHTML = \"<slot></slot>\";\n let previousSlots = {\n default: '<slot></slot>'\n };\n for (let htmlPart of this.htmlParts) {\n for (let blockName in htmlPart.blocks) {\n if (!previousSlots.hasOwnProperty(blockName)) {\n throw \"can't found slot with name \" + blockName;\n }\n currentHTML = currentHTML.replace(previousSlots[blockName], htmlPart.blocks[blockName]);\n }\n for (let slotName in htmlPart.slots) {\n previousSlots[slotName] = htmlPart.slots[slotName];\n }\n }\n this.template.innerHTML = currentHTML;\n }\n /**\n * Used by the for loop and the if\n * @param template\n */\n setTemplate(template) {\n this.template = document.createElement('template');\n this.template.innerHTML = template;\n }\n template;\n actions = {};\n setActions(actions) {\n if (!this.actions) {\n this.actions = actions;\n }\n else {\n if (actions.elements) {\n if (!this.actions.elements) {\n this.actions.elements = [];\n }\n this.actions.elements = [...actions.elements, ...this.actions.elements];\n }\n if (actions.events) {\n if (!this.actions.events) {\n this.actions.events = [];\n }\n this.actions.events = [...actions.events, ...this.actions.events];\n }\n if (actions.pressEvents) {\n if (!this.actions.pressEvents) {\n this.actions.pressEvents = [];\n }\n this.actions.pressEvents = [...actions.pressEvents, ...this.actions.pressEvents];\n }\n if (actions.content) {\n if (!this.actions.content) {\n this.actions.content = actions.content;\n }\n else {\n for (let contextProp in actions.content) {\n if (!this.actions.content[contextProp]) {\n this.actions.content[contextProp] = actions.content[contextProp];\n }\n else {\n throw 'this should be impossible';\n }\n }\n }\n }\n if (actions.injection) {\n if (!this.actions.injection) {\n this.actions.injection = actions.injection;\n }\n else {\n for (let contextProp in actions.injection) {\n if (!this.actions.injection[contextProp]) {\n this.actions.injection[contextProp] = actions.injection[contextProp];\n }\n else {\n this.actions.injection[contextProp] = { ...actions.injection[contextProp], ...this.actions.injection[contextProp] };\n }\n }\n }\n }\n if (actions.bindings) {\n if (!this.actions.bindings) {\n this.actions.bindings = actions.bindings;\n }\n else {\n for (let contextProp in actions.bindings) {\n if (!this.actions.bindings[contextProp]) {\n this.actions.bindings[contextProp] = actions.bindings[contextProp];\n }\n else {\n this.actions.bindings[contextProp] = { ...actions.bindings[contextProp], ...this.actions.bindings[contextProp] };\n }\n }\n }\n }\n if (actions.contextEdits) {\n if (!this.actions.contextEdits) {\n this.actions.contextEdits = [];\n }\n this.actions.contextEdits = [...actions.contextEdits, ...this.actions.contextEdits];\n }\n }\n }\n loops = [];\n addLoop(loop) {\n this.loops.push(loop);\n }\n ifs = [];\n addIf(_if) {\n this.ifs.push(_if);\n }\n createInstance(component) {\n let content = this.template.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n return new TemplateInstance(component, content, this.actions, this.loops, this.ifs);\n }\n}\nTemplate.Namespace=`Aventus`;\r\n__as1(_, 'Template', Template);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateHTML","isStrong":false},{"fullName":"Aventus.Actions","isStrong":false},{"fullName":"Aventus.Loop","isStrong":false},{"fullName":"Aventus.If","isStrong":false},{"fullName":"Aventus.TemplateInstance","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.Template","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let WebComponent=class WebComponent extends HTMLElement {\n /**\n * Add attributes informations\n */\n static get observedAttributes() {\n return [];\n }\n _first;\n _isReady;\n /**\n * Determine if the component is ready (postCreation done)\n */\n get isReady() {\n return this._isReady;\n }\n /**\n * The current namespace\n */\n static Namespace = \"\";\n /**\n * The current Tag / empty if abstract class\n */\n static Tag = \"\";\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n static get Fullname() { return this.Namespace + \".\" + this.name; }\n /**\n * The current namespace\n */\n get namespace() {\n return this.constructor['Namespace'];\n }\n /**\n * Get the name of the component class\n */\n getClassName() {\n return this.constructor.name;\n }\n /**\n * The current tag\n */\n get tag() {\n return this.constructor['Tag'];\n }\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n get $type() {\n return this.constructor['Fullname'];\n }\n __onChangeFct = {};\n __watch;\n __watchActions = {};\n __watchActionsCb = {};\n __watchFunctions = {};\n __watchFunctionsComputed = {};\n __pressManagers = [];\n __signalActions = {};\n __signals = {};\n __isDefaultState = true;\n __defaultActiveState = new Map();\n __defaultInactiveState = new Map();\n __statesList = {};\n constructor() {\n super();\n if (this.constructor == WebComponent) {\n throw \"can't instanciate an abstract class\";\n }\n this.__removeNoAnimations = this.__removeNoAnimations.bind(this);\n if (document.readyState === \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", this.__removeNoAnimations);\n }\n this._first = true;\n this._isReady = false;\n this.__renderTemplate();\n this.__registerWatchesActions();\n this.__registerPropertiesActions();\n this.__registerSignalsActions();\n this.__createStates();\n this.__subscribeState();\n if (this.constructor == WebComponent) {\n throw \"can't instanciate an abstract class\";\n }\n }\n /**\n * Remove all listeners\n * State + press\n */\n destructor() {\n WebComponentInstance.removeInstance(this);\n this.__unsubscribeState();\n for (let press of this.__pressManagers) {\n press.destroy();\n }\n for (let name in this.__watchFunctionsComputed) {\n this.__watchFunctionsComputed[name].destroy();\n }\n for (let name in this.__signals) {\n this.__signals[name].destroy();\n }\n // TODO add missing info for destructor();\n this.postDestruction();\n this.destructChildren();\n }\n destructChildren() {\n const recu = (el) => {\n for (let child of Array.from(el.children)) {\n if (child instanceof WebComponent) {\n child.destructor();\n }\n else if (child instanceof HTMLElement) {\n recu(child);\n }\n }\n if (el.shadowRoot) {\n for (let child of Array.from(el.shadowRoot.children)) {\n if (child instanceof WebComponent) {\n child.destructor();\n }\n else if (child instanceof HTMLElement) {\n recu(child);\n }\n }\n }\n };\n recu(this);\n }\n __addWatchesActions(name, fct) {\n if (!this.__watchActions[name]) {\n this.__watchActions[name] = [];\n this.__watchActionsCb[name] = (action, path, value) => {\n for (let fct of this.__watchActions[name]) {\n fct(this, action, path, value);\n }\n if (this.__onChangeFct[name]) {\n for (let fct of this.__onChangeFct[name]) {\n fct(path);\n }\n }\n };\n }\n if (fct) {\n this.__watchActions[name].push(fct);\n }\n }\n __addWatchesFunctions(infos) {\n for (let info of infos) {\n let realName;\n let autoInit;\n if (typeof info == \"string\") {\n realName = info;\n autoInit = false;\n }\n else {\n realName = info.name;\n autoInit = info.autoInit;\n }\n if (!this.__watchFunctions[realName]) {\n this.__watchFunctions[realName] = { autoInit };\n }\n }\n }\n __registerWatchesActions() {\n if (Object.keys(this.__watchActions).length > 0) {\n if (!this.__watch) {\n let defaultValue = {};\n this.__defaultValuesWatch(defaultValue);\n this.__watch = Watcher.get(defaultValue, (type, path, element) => {\n try {\n let action = this.__watchActionsCb[path.split(\".\")[0]] || this.__watchActionsCb[path.split(\"[\")[0]];\n action(type, path, element);\n }\n catch (e) {\n console.error(e);\n }\n });\n }\n }\n for (let name in this.__watchFunctions) {\n this.__watchFunctionsComputed[name] = Watcher.computed(this[name].bind(this));\n if (this.__watchFunctions[name].autoInit) {\n this.__watchFunctionsComputed[name].value;\n }\n }\n }\n __addSignalActions(name, fct) {\n this.__signalActions[name] = () => {\n fct(this);\n };\n }\n __registerSignalsActions() {\n if (Object.keys(this.__signals).length > 0) {\n const defaultValues = {};\n for (let name in this.__signals) {\n this.__registerSignalsAction(name);\n this.__defaultValuesSignal(defaultValues);\n }\n for (let name in defaultValues) {\n this.__signals[name].value = defaultValues[name];\n }\n }\n }\n __registerSignalsAction(name) {\n this.__signals[name] = new Signal(undefined, () => {\n if (this.__signalActions[name]) {\n this.__signalActions[name]();\n }\n });\n }\n __defaultValuesSignal(s) { }\n __addPropertyActions(name, fct) {\n if (!this.__onChangeFct[name]) {\n this.__onChangeFct[name] = [];\n }\n if (fct) {\n this.__onChangeFct[name].push(() => {\n fct(this);\n });\n }\n }\n __registerPropertiesActions() { }\n static __style = ``;\n static __template;\n __templateInstance;\n styleBefore(addStyle) {\n addStyle(\"@default\");\n }\n styleAfter(addStyle) {\n }\n __getStyle() {\n return [WebComponent.__style];\n }\n __getHtml() { }\n __getStatic() {\n return WebComponent;\n }\n static __styleSheets = {};\n __renderStyles() {\n let sheets = {};\n const addStyle = (name) => {\n let sheet = Style.get(name);\n if (sheet) {\n sheets[name] = sheet;\n }\n };\n this.styleBefore(addStyle);\n let localStyle = new CSSStyleSheet();\n let styleTxt = this.__getStyle().join(\"\\r\\n\");\n if (styleTxt.length > 0) {\n localStyle.replace(styleTxt);\n sheets['@local'] = localStyle;\n }\n this.styleAfter(addStyle);\n return sheets;\n }\n __renderTemplate() {\n let staticInstance = this.__getStatic();\n if (!staticInstance.__template || staticInstance.__template.cst != staticInstance) {\n staticInstance.__template = new Template(staticInstance);\n this.__getHtml();\n this.__registerTemplateAction();\n staticInstance.__template.generateTemplate();\n staticInstance.__styleSheets = this.__renderStyles();\n }\n this.__templateInstance = staticInstance.__template.createInstance(this);\n let shadowRoot = this.attachShadow({ mode: 'open' });\n shadowRoot.adoptedStyleSheets = [...Object.values(staticInstance.__styleSheets), Style.noAnimation];\n shadowRoot.appendChild(this.__templateInstance.content);\n // customElements.upgrade(shadowRoot);\n return shadowRoot;\n }\n __registerTemplateAction() {\n }\n connectedCallback() {\n if (this._first) {\n WebComponentInstance.addInstance(this);\n this._first = false;\n this.__defaultValues();\n this.__upgradeAttributes();\n this.__activateState();\n this.__templateInstance?.render();\n this.__removeNoAnimations();\n }\n else {\n setTimeout(() => {\n this.postConnect();\n });\n }\n }\n disconnectedCallback() {\n setTimeout(() => {\n this.postDisconnect();\n });\n }\n __onReadyCb = [];\n onReady(cb) {\n if (this._isReady) {\n cb();\n }\n else {\n this.__onReadyCb.push(cb);\n }\n }\n __setReady() {\n this._isReady = true;\n this.dispatchEvent(new CustomEvent('postCreationDone'));\n let cbs = [...this.__onReadyCb];\n for (let cb of cbs) {\n cb();\n }\n this.__onReadyCb = [];\n }\n __removeNoAnimations() {\n if (document.readyState !== \"loading\") {\n setTimeout(() => {\n this.postCreation();\n this.__setReady();\n this.shadowRoot.adoptedStyleSheets = Object.values(this.__getStatic().__styleSheets);\n document.removeEventListener(\"DOMContentLoaded\", this.__removeNoAnimations);\n this.postConnect();\n }, 50);\n }\n }\n __defaultValues() { }\n __defaultValuesWatch(w) { }\n __upgradeAttributes() { }\n __listBoolProps() {\n return [];\n }\n __upgradeProperty(prop) {\n let boolProps = this.__listBoolProps();\n const t = this;\n if (boolProps.indexOf(prop) != -1) {\n if (this.hasAttribute(prop) && (this.getAttribute(prop) === \"true\" || this.getAttribute(prop) === \"\")) {\n let value = this.getAttribute(prop);\n delete t[prop];\n t[prop] = value;\n }\n else {\n this.removeAttribute(prop);\n delete t[prop];\n t[prop] = false;\n }\n }\n else {\n if (this.hasAttribute(prop)) {\n let value = this.getAttribute(prop);\n delete t[prop];\n t[prop] = value;\n }\n else if (Object.hasOwn(this, prop)) {\n const value = t[prop];\n delete t[prop];\n t[prop] = value;\n }\n }\n }\n __correctGetter(prop) {\n if (Object.hasOwn(this, prop)) {\n const t = this;\n const value = t[prop];\n delete t[prop];\n t[prop] = value;\n }\n }\n __getStateManager(managerClass) {\n let mClass;\n if (managerClass instanceof StateManager) {\n mClass = managerClass;\n }\n else {\n mClass = Instance.get(managerClass);\n }\n return mClass;\n }\n __addActiveDefState(managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n if (!this.__defaultActiveState.has(mClass)) {\n this.__defaultActiveState.set(mClass, []);\n }\n this.__defaultActiveState.get(mClass)?.push(cb);\n }\n __addInactiveDefState(managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n if (!this.__defaultInactiveState.has(mClass)) {\n this.__defaultInactiveState.set(mClass, []);\n }\n this.__defaultInactiveState.get(mClass)?.push(cb);\n }\n __addActiveState(statePattern, managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n this.__statesList[statePattern].get(mClass)?.active.push(cb);\n }\n __addInactiveState(statePattern, managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n this.__statesList[statePattern].get(mClass)?.inactive.push(cb);\n }\n __addAskChangeState(statePattern, managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n this.__statesList[statePattern].get(mClass)?.askChange.push(cb);\n }\n __createStates() { }\n __createStatesList(statePattern, managerClass) {\n if (!this.__statesList[statePattern]) {\n this.__statesList[statePattern] = new Map();\n }\n let mClass = this.__getStateManager(managerClass);\n if (!this.__statesList[statePattern].has(mClass)) {\n this.__statesList[statePattern].set(mClass, {\n active: [],\n inactive: [],\n askChange: []\n });\n }\n }\n __inactiveDefaultState(managerClass) {\n if (this.__isDefaultState) {\n this.__isDefaultState = false;\n let mClass = this.__getStateManager(managerClass);\n if (this.__defaultInactiveState.has(mClass)) {\n let fcts = this.__defaultInactiveState.get(mClass) ?? [];\n for (let fct of fcts) {\n fct.bind(this)();\n }\n }\n }\n }\n __activeDefaultState(nextStep, managerClass) {\n if (!this.__isDefaultState) {\n for (let pattern in this.__statesList) {\n if (StateManager.canBeActivate(pattern, nextStep)) {\n let mClass = this.__getStateManager(managerClass);\n if (this.__statesList[pattern].has(mClass)) {\n return;\n }\n }\n }\n this.__isDefaultState = true;\n let mClass = this.__getStateManager(managerClass);\n if (this.__defaultActiveState.has(mClass)) {\n let fcts = this.__defaultActiveState.get(mClass) ?? [];\n for (let fct of fcts) {\n fct.bind(this)();\n }\n }\n }\n }\n __subscribeState() {\n if (!this.isReady && this.__stateCleared) {\n return;\n }\n for (let route in this.__statesList) {\n for (const managerClass of this.__statesList[route].keys()) {\n let el = this.__statesList[route].get(managerClass);\n if (el) {\n managerClass.subscribe(route, el, false);\n }\n }\n }\n }\n __activateState() {\n for (let route in this.__statesList) {\n for (const managerClass of this.__statesList[route].keys()) {\n let el = this.__statesList[route].get(managerClass);\n if (el) {\n managerClass.activateAfterSubscribe(route, el);\n }\n }\n }\n }\n __stateCleared = false;\n __unsubscribeState() {\n for (let route in this.__statesList) {\n for (const managerClass of this.__statesList[route].keys()) {\n let el = this.__statesList[route].get(managerClass);\n if (el) {\n managerClass.unsubscribe(route, el);\n }\n }\n }\n this.__stateCleared = true;\n }\n dateToString(d) {\n if (typeof d == 'string') {\n d = this.stringToDate(d);\n }\n if (d instanceof Date) {\n return new Date(d.getTime() - (d.getTimezoneOffset() * 60000)).toISOString().split(\"T\")[0];\n }\n return null;\n }\n dateTimeToString(dt) {\n if (typeof dt == 'string') {\n dt = this.stringToDate(dt);\n }\n if (dt instanceof Date) {\n return new Date(dt.getTime() - (dt.getTimezoneOffset() * 60000)).toISOString().slice(0, -1);\n }\n return null;\n }\n stringToDate(s) {\n let td = new Date(s);\n let d = new Date(td.getTime() + (td.getTimezoneOffset() * 60000));\n if (isNaN(d)) {\n return null;\n }\n return d;\n }\n stringToDateTime(s) {\n let td = new Date(s);\n let d = new Date(td.getTime() + (td.getTimezoneOffset() * 60000));\n if (isNaN(d)) {\n return null;\n }\n return d;\n }\n getBoolean(val) {\n if (val === true || val === 1 || val === 'true' || val === '') {\n return true;\n }\n else if (val === false || val === 0 || val === 'false' || val === null || val === undefined) {\n return false;\n }\n console.error(\"error parsing boolean value \" + val);\n return false;\n }\n __registerPropToWatcher(name) {\n if (Watcher._register) {\n Watcher._register.register(this.getReceiver(name), name, Watcher._register.version, name);\n }\n }\n getStringAttr(name) {\n return this.getAttribute(name)?.replace(/&avquot;/g, '\"') ?? undefined;\n }\n setStringAttr(name, val) {\n if (val === undefined || val === null) {\n this.removeAttribute(name);\n }\n else {\n this.setAttribute(name, (val + \"\").replace(/\"/g, '&avquot;'));\n }\n }\n getStringProp(name) {\n this.__registerPropToWatcher(name);\n return this.getStringAttr(name);\n }\n getNumberAttr(name) {\n return Number(this.getAttribute(name));\n }\n setNumberAttr(name, val) {\n if (val === undefined || val === null) {\n this.removeAttribute(name);\n }\n else {\n this.setAttribute(name, val);\n }\n }\n getNumberProp(name) {\n this.__registerPropToWatcher(name);\n return this.getNumberAttr(name);\n }\n getBoolAttr(name) {\n return this.hasAttribute(name);\n }\n setBoolAttr(name, val) {\n val = this.getBoolean(val);\n if (val) {\n this.setAttribute(name, 'true');\n }\n else {\n this.removeAttribute(name);\n }\n }\n getBoolProp(name) {\n this.__registerPropToWatcher(name);\n return this.getBoolAttr(name);\n }\n getDateAttr(name) {\n if (!this.hasAttribute(name)) {\n return undefined;\n }\n return this.stringToDate(this.getAttribute(name));\n }\n setDateAttr(name, val) {\n let valTxt = this.dateToString(val);\n if (valTxt === null) {\n this.removeAttribute(name);\n }\n else {\n this.setAttribute(name, valTxt);\n }\n }\n getDateProp(name) {\n this.__registerPropToWatcher(name);\n return this.getDateAttr(name);\n }\n getDateTimeAttr(name) {\n if (!this.hasAttribute(name))\n return undefined;\n return this.stringToDateTime(this.getAttribute(name));\n }\n setDateTimeAttr(name, val) {\n let valTxt = this.dateTimeToString(val);\n if (valTxt === null) {\n this.removeAttribute(name);\n }\n else {\n this.setAttribute(name, valTxt);\n }\n }\n getDateTimeProp(name) {\n this.__registerPropToWatcher(name);\n return this.getDateTimeAttr(name);\n }\n __propertyReceivers = {};\n getReceiver(name) {\n if (!this.__propertyReceivers[name]) {\n let that = this;\n let result = {\n __subscribes: [],\n subscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index == -1) {\n this.__subscribes.push(fct);\n }\n },\n unsubscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index > -1) {\n this.__subscribes.splice(index, 1);\n }\n },\n onChange() {\n for (let fct of this.__subscribes) {\n fct(WatchAction.UPDATED, name, that[name], []);\n }\n },\n __path: name\n };\n this.__propertyReceivers[name] = result;\n }\n return this.__propertyReceivers[name];\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (oldValue !== newValue || !this.isReady) {\n if (this.__propertyReceivers.hasOwnProperty(name)) {\n this.__propertyReceivers[name].onChange();\n }\n if (this.__onChangeFct.hasOwnProperty(name)) {\n for (let fct of this.__onChangeFct[name]) {\n fct('');\n }\n }\n }\n }\n /**\n * Remove a component from the dom\n * If desctruct is set to true, the component will be fully destroyed\n */\n remove(destruct = true) {\n super.remove();\n if (destruct) {\n this.destructor();\n }\n }\n /**\n * Function triggered when the component is destroyed\n */\n postDestruction() { }\n /**\n * Function triggered the first time the component is rendering inside DOM\n */\n postCreation() { }\n /**\n * Function triggered each time the component is rendering inside DOM\n */\n postConnect() { }\n /**\n * Function triggered each time the component is removed from the DOM\n */\n postDisconnect() { }\n /**\n * Find a parent by tagname if exist\n */\n findParentByTag(tagname, untilNode) {\n return ElementExtension.findParentByTag(this, tagname, untilNode);\n }\n /**\n * Find a parent by class name if exist\n */\n findParentByClass(classname, untilNode) {\n return ElementExtension.findParentByClass(this, classname, untilNode);\n }\n /**\n * Find a parent by type if exist\n */\n findParentByType(type, untilNode) {\n return ElementExtension.findParentByType(this, type, untilNode);\n }\n /**\n * Find list of parents by tagname\n */\n findParentsByTag(tagname, untilNode) {\n return ElementExtension.findParentsByTag(this, tagname, untilNode);\n }\n /**\n * Find list of parents by custom check\n */\n findParents(tagname, check, untilNode) {\n return ElementExtension.findParents(this, check, untilNode);\n }\n /**\n * Find list of parents by custom check\n */\n findParent(tagname, check, untilNode) {\n return ElementExtension.findParent(this, check, untilNode);\n }\n /**\n * Check if element contains a child\n */\n containsChild(el) {\n return ElementExtension.containsChild(this, el);\n }\n /**\n * Get elements inside slot\n */\n getElementsInSlot(slotName) {\n return ElementExtension.getElementsInSlot(this, slotName);\n }\n /**\n * Get nodes inside slot\n */\n getNodesInSlot(slotName) {\n return ElementExtension.getNodesInSlot(this, slotName);\n }\n /**\n * Get active element from the shadowroot or the document\n */\n getActiveElement(document) {\n return ElementExtension.getActiveElement(document ?? this.shadowRoot);\n }\n}\nWebComponent.Namespace=`Aventus`;\r\n__as1(_, 'WebComponent', WebComponent);\r\n","dependencies":[{"fullName":"Aventus.DefaultComponent","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Dependencies","isStrong":false},{"fullName":"Aventus.WebComponentInstance","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.Signal","isStrong":false},{"fullName":"Aventus.StateManager","isStrong":false},{"fullName":"Aventus.State","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.Template","isStrong":true},{"fullName":"Aventus.TemplateInstance","isStrong":false},{"fullName":"Aventus.Style","isStrong":false},{"fullName":"Aventus.Instance","isStrong":false},{"fullName":"Aventus.EffectReceiver","isStrong":false},{"fullName":"Aventus.WatcherChange","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ElementExtension","isStrong":false}],"fullName":"Aventus.WebComponent","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let WebComponentInstance=class WebComponentInstance {\n static __allDefinitions = [];\n static __allInstances = [];\n /**\n * Last definition insert datetime\n */\n static lastDefinition = 0;\n static registerDefinition(def) {\n WebComponentInstance.lastDefinition = Date.now();\n WebComponentInstance.__allDefinitions.push(def);\n }\n static removeDefinition(def) {\n WebComponentInstance.lastDefinition = Date.now();\n let index = WebComponentInstance.__allDefinitions.indexOf(def);\n if (index > -1) {\n WebComponentInstance.__allDefinitions.splice(index, 1);\n }\n }\n /**\n * Get all sub classes of type\n */\n static getAllClassesOf(type) {\n let result = [];\n for (let def of WebComponentInstance.__allDefinitions) {\n if (def.prototype instanceof type) {\n result.push(def);\n }\n }\n return result;\n }\n /**\n * Get all registered definitions\n */\n static getAllDefinitions() {\n return WebComponentInstance.__allDefinitions;\n }\n static addInstance(instance) {\n this.__allInstances.push(instance);\n }\n static removeInstance(instance) {\n let index = this.__allInstances.indexOf(instance);\n if (index > -1) {\n this.__allInstances.splice(index, 1);\n }\n }\n static getAllInstances(type) {\n let result = [];\n for (let instance of this.__allInstances) {\n if (instance instanceof type) {\n result.push(instance);\n }\n }\n return result;\n }\n static create(type) {\n let _class = customElements.get(type);\n if (_class) {\n return new _class();\n }\n let splitted = type.split(\".\");\n let current = window;\n for (let part of splitted) {\n current = current[part];\n }\n if (current && current.prototype instanceof WebComponent) {\n return new current();\n }\n return null;\n }\n}\nWebComponentInstance.Namespace=`Aventus`;\r\n__as1(_, 'WebComponentInstance', WebComponentInstance);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":true},{"fullName":"T","isStrong":false}],"fullName":"Aventus.WebComponentInstance","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ElementExtension=class ElementExtension {\n /**\n * Find a parent by custom check\n */\n static findParent(element, check, untilNode) {\n let el = element;\n if (el) {\n if (el instanceof ShadowRoot) {\n el = el.host;\n }\n else {\n el = el.parentNode;\n }\n }\n while (el) {\n if (check(el)) {\n return el;\n }\n if (el instanceof ShadowRoot) {\n el = el.host;\n }\n else {\n el = el.parentNode;\n }\n if (el == untilNode) {\n break;\n }\n }\n return null;\n }\n /**\n * Find a list of parent by custom check\n */\n static findParents(element, check, untilNode) {\n let result = [];\n let el = element;\n if (el) {\n if (el instanceof ShadowRoot) {\n el = el.host;\n }\n else {\n el = el.parentNode;\n }\n }\n while (el) {\n if (check(el)) {\n result.push(el);\n }\n if (el instanceof ShadowRoot) {\n el = el.host;\n }\n else {\n el = el.parentNode;\n }\n if (el == untilNode) {\n break;\n }\n }\n return result;\n }\n /**\n * Find a parent by tagname if exist Static.findParentByTag(this, \"av-img\")\n */\n static findParentByTag(element, tagname, untilNode) {\n if (Array.isArray(tagname)) {\n for (let i = 0; i < tagname.length; i++) {\n tagname[i] = tagname[i].toLowerCase();\n }\n }\n else {\n tagname = [tagname.toLowerCase()];\n }\n const checkFunc = (el) => {\n if (el instanceof Element) {\n return tagname.indexOf((el.nodeName || el.tagName).toLowerCase()) != -1;\n }\n return tagname.indexOf(el.nodeName.toLowerCase()) != -1;\n };\n return this.findParent(element, checkFunc, untilNode);\n }\n /**\n * Find a parent by class name if exist Static.findParentByClass(this, \"my-class-img\") = querySelector('.my-class-img')\n */\n static findParentByClass(element, classname, untilNode) {\n if (!Array.isArray(classname)) {\n classname = [classname];\n }\n const check = (el) => {\n for (let classnameTemp of classname) {\n if (el instanceof Element && el['classList'].contains(classnameTemp)) {\n return true;\n }\n }\n return false;\n };\n return this.findParent(element, check, untilNode);\n }\n static findParentByType(element, types, untilNode) {\n if (!Array.isArray(types)) {\n types = [types];\n }\n let isValid = true;\n for (let type of types) {\n if (typeof type == \"function\" && type['prototype']['constructor'])\n continue;\n isValid = false;\n }\n if (isValid) {\n let checkFunc = (el) => {\n for (let type of types) {\n const t = type;\n if (el instanceof t) {\n return true;\n }\n }\n return false;\n };\n return this.findParent(element, checkFunc, untilNode);\n }\n console.error(\"you must provide a class inside this function\");\n return null;\n }\n /**\n * Find list of parents by tagname\n */\n static findParentsByTag(element, tagname, untilNode) {\n let el = element;\n if (Array.isArray(tagname)) {\n for (let i = 0; i < tagname.length; i++) {\n tagname[i] = tagname[i].toLowerCase();\n }\n }\n else {\n tagname = [tagname.toLowerCase()];\n }\n let check = (el) => {\n if (el instanceof Element) {\n return tagname.indexOf((el.nodeName || el.tagName).toLowerCase()) != -1;\n }\n return tagname.indexOf(el.nodeName.toLowerCase()) != -1;\n };\n return this.findParents(element, check, untilNode);\n }\n /**\n * Check if element contains a child\n */\n static containsChild(element, child) {\n let rootScope = element.getRootNode();\n let elScope = child.getRootNode();\n while (elScope != rootScope) {\n if (!elScope['host']) {\n return false;\n }\n child = elScope['host'];\n elScope = elScope['host'].getRootNode();\n }\n return element.contains(child);\n }\n /**\n * Get element inside slot\n */\n static getElementsInSlot(element, slotName) {\n let result = [];\n if (element.shadowRoot) {\n let slotEl;\n if (slotName) {\n slotEl = element.shadowRoot.querySelector('slot[name=\"' + slotName + '\"]');\n }\n else {\n slotEl = element.shadowRoot.querySelector(\"slot:not([name])\");\n if (!slotEl) {\n slotEl = element.shadowRoot.querySelector(\"slot\");\n }\n }\n while (true) {\n if (!slotEl) {\n return result;\n }\n var listChild = Array.from(slotEl.assignedElements());\n if (!listChild) {\n return result;\n }\n let slotFound = false;\n for (let i = 0; i < listChild.length; i++) {\n let child = listChild[i];\n if (listChild[i].nodeName == \"SLOT\") {\n slotEl = listChild[i];\n slotFound = true;\n }\n else if (child instanceof HTMLElement) {\n result.push(child);\n }\n }\n if (!slotFound) {\n return result;\n }\n }\n }\n return result;\n }\n /**\n * Get element inside slot\n */\n static getNodesInSlot(element, slotName) {\n let result = [];\n if (element.shadowRoot) {\n let slotEl;\n if (slotName) {\n slotEl = element.shadowRoot.querySelector('slot[name=\"' + slotName + '\"]');\n }\n else {\n slotEl = element.shadowRoot.querySelector(\"slot:not([name])\");\n if (!slotEl) {\n slotEl = element.shadowRoot.querySelector(\"slot\");\n }\n }\n while (true) {\n if (!slotEl) {\n return result;\n }\n var listChild = Array.from(slotEl.assignedNodes());\n if (!listChild) {\n return result;\n }\n let slotFound = false;\n for (let i = 0; i < listChild.length; i++) {\n let child = listChild[i];\n if (listChild[i].nodeName == \"SLOT\") {\n slotEl = listChild[i];\n slotFound = true;\n }\n else if (child instanceof Node) {\n result.push(child);\n }\n }\n if (!slotFound) {\n return result;\n }\n }\n }\n return result;\n }\n /**\n * Get deeper element inside dom at the position X and Y\n */\n static getElementAtPosition(x, y, startFrom) {\n const _realTarget = (el, i = 0) => {\n if (i == 50) {\n debugger;\n }\n if (el.shadowRoot && x !== undefined && y !== undefined) {\n const elements = el.shadowRoot.elementsFromPoint(x, y);\n var newEl = elements.length > 0 ? elements[0] : null;\n if (newEl && newEl != el && (el.shadowRoot.contains(newEl) || el.contains(newEl))) {\n return _realTarget(newEl, i + 1);\n }\n }\n return el;\n };\n if (startFrom == null) {\n startFrom = document.body;\n }\n return _realTarget(startFrom);\n }\n /**\n * Get active element from the define root\n */\n static getActiveElement(root = document) {\n if (!root)\n return null;\n let el = root.activeElement;\n while (el instanceof WebComponent) {\n let elTemp = el.shadowRoot?.activeElement;\n if (!elTemp)\n return el;\n el = elTemp;\n }\n return el;\n }\n}\nElementExtension.Namespace=`Aventus`;\r\n__as1(_, 'ElementExtension', ElementExtension);\r\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.ElementExtension","required":false,"type":1,"isExported":true,"convertibleName":""}],"existing":[{"fullName":"Aventus.DebuggerConfig","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ActionBindings","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ActionInjection","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ActionEventCallback","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ActionEventListener","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ContextEdit","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.If","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false},{"fullName":"Aventus.Template","isStrong":false}]},{"fullName":"Aventus.LoopSimple","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.LoopFct","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.TemplateHTML","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.DefaultComponent","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.Last","dependencies":[{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.NotVoid","dependencies":[]},{"fullName":"Aventus.StringLiteral","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.Constructor","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.OnlyConstructor","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.AnyConstructor","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.OnlyConstructor","isStrong":false}]},{"fullName":"Aventus.KeysObject","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Item","isStrong":false}]},{"fullName":"Aventus.RamSubscribers","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IRam","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IRamData","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.UriParamsValue","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.StateSlug","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false}]},{"fullName":"Aventus.StateAskChangeFct","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.StateInactivationFct","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.UriParams","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ResourceLoaderHeadOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ResourceLoaderOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.WindowResizeObserver","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"globalThis.ResizeObserver","isStrong":false}]},{"fullName":"Aventus.ResizeObserverOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.Pointer","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.InstanceCst","dependencies":[]},{"fullName":"Aventus.InstanceCst2","dependencies":[{"fullName":"X","isStrong":false}]},{"fullName":"Aventus.PressManagerState","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false}]},{"fullName":"Aventus.Coordinate","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.InternalCustomFunction","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false}]},{"fullName":"Aventus.InternalPointerEvent","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManagerState","isStrong":false},{"fullName":"Aventus.InternalCustomFunction","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false}]},{"fullName":"Aventus.PressManagerOptions","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false}]},{"fullName":"Aventus.TargetableElement","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.DragElementLeftTop","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.DragElementXY","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ContainerElement","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.AnyElement","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TargetableElement","isStrong":false},{"fullName":"Aventus.ContainerElement","isStrong":false}]},{"fullName":"Aventus.AnimationOptionsInternal","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.AnimationOptions","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.AnimationOptionsInternal","isStrong":false}]},{"fullName":"Aventus.RouterOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.HttpRouterOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IsNotVoid","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.WatcherFunctionInternal","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.WatcherFunction","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.WatcherAllowed","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.Asyncable","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.Enum","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.EnumValue","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Enum","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.JsonFromOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.JsonToOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ClassCopyOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.SchemaType","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IData","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.Schema","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.SchemaType","isStrong":false}]},{"fullName":"Aventus.IConverterTransform","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ClassCopyOptions","isStrong":false}]},{"fullName":"Aventus.ExtractFromError","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"U","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false}]},{"fullName":"Aventus.HttpRequestOptions","dependencies":[{"fullName":"Aventus.HttpRequest","isStrong":false},{"fullName":"Aventus.Asyncable","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.HttpResponse","isStrong":false}]},{"fullName":"Aventus.WatcherChange","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.EffectReceiver","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatcherChange","isStrong":false}]},{"fullName":"Aventus.RouterType","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRouter","isStrong":false}]},{"fullName":"Aventus.RouteType","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRoute","isStrong":false}]},{"fullName":"Aventus.DragElement","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.DragElementXY","isStrong":false},{"fullName":"Aventus.DragElementLeftTop","isStrong":false}]},{"fullName":"Aventus.DragAndDropOptionsShadow","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ContainerElement","isStrong":false},{"fullName":"Aventus.DragElement","isStrong":false}]},{"fullName":"Aventus.DragAndDropOptions","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.DragElement","isStrong":false},{"fullName":"Aventus.DragAndDropOptionsShadow","isStrong":false},{"fullName":"Aventus.TargetableElement","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.Coordinate","isStrong":false}]},{"fullName":"Aventus.DragAndDropOptionsInternal","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.DragAndDropOptions","isStrong":false},{"fullName":"Aventus.DragAndDropOptionsShadow","isStrong":false}]},{"fullName":"Aventus.PreparedUri","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.UriParams","isStrong":false}]},{"fullName":"Aventus.IRamAction","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ResultRamWithError","isStrong":false},{"fullName":"Aventus.VoidRamWithError","isStrong":false}]},{"fullName":"Aventus.RamItem","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Resource","isStrong":false},{"fullName":"Aventus.IRamData","isStrong":false},{"fullName":"Aventus.IRamAction","isStrong":false}]},{"fullName":"Aventus.StateActivationFct","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.Subscriber","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateActivationFct","isStrong":false},{"fullName":"Aventus.StateInactivationFct","isStrong":false},{"fullName":"Aventus.StateAskChangeFct","isStrong":false}]},{"fullName":"Aventus.StateAction","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateActivationFct","isStrong":false},{"fullName":"Aventus.StateInactivationFct","isStrong":false},{"fullName":"Aventus.StateAskChangeFct","isStrong":false}]},{"fullName":"Aventus.IStateManager","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateAction","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.IState","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateManager","isStrong":false},{"fullName":"Aventus.Asyncable","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.Loop","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Template","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false},{"fullName":"Aventus.LoopFct","isStrong":false},{"fullName":"Aventus.LoopSimple","isStrong":false}]},{"fullName":"Aventus.ActionEvent","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ActionEventListener","isStrong":false},{"fullName":"Aventus.ActionEventCallback","isStrong":false}]},{"fullName":"Aventus.LoopRegistery","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateInstance","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false}]},{"fullName":"Aventus.ActionChange","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.Actions","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ActionChange","isStrong":false},{"fullName":"Aventus.ActionInjection","isStrong":false},{"fullName":"Aventus.ActionBindings","isStrong":false},{"fullName":"Aventus.ActionEvent","isStrong":false},{"fullName":"Aventus.PressManagerOptions","isStrong":false},{"fullName":"Aventus.ContextEdit","isStrong":false}]}]}
2755
+ {"namespace":"Aventus","available":[{"code":"if(!Object.hasOwn(window, \"AvInstance\")) {\r\n\tObject.defineProperty(window, \"AvInstance\", {\r\n\t\tget() {return Aventus?.Instance;}\r\n\t});\r\n\r\n\t(() => {\r\n\t\tMap.prototype._defaultHas = Map.prototype.has;\r\n\t\tMap.prototype._defaultSet = Map.prototype.set;\r\n\t\tMap.prototype._defaultGet = Map.prototype.get;\r\n\t\tMap.prototype.has = function(key) {\r\n\t\t\tif(Aventus.Watcher?.is(key)) {\r\n\t\t\t\treturn Map.prototype._defaultHas.call(this,key.getTarget())\r\n\t\t\t}\r\n\t\t\treturn Map.prototype._defaultHas.call(this,key);\r\n\t\t}\r\n\r\n\t\tMap.prototype.set = function(key, value) {\r\n\t\t\tif(Aventus.Watcher?.is(key)) {\r\n\t\t\t\treturn Map.prototype._defaultSet.call(this, key.getTarget(), value)\r\n\t\t\t}\r\n\t\t\treturn Map.prototype._defaultSet.call(this, key, value);\r\n\t\t}\r\n\t\tMap.prototype.get = function(key) {\r\n\t\t\tif(Aventus.Watcher?.is(key)) {\r\n\t\t\t\treturn Map.prototype._defaultGet.call(this, key.getTarget())\r\n\t\t\t}\r\n\t\t\treturn Map.prototype._defaultGet.call(this, key);\r\n\t\t}\r\n\t})();\r\n}","dependencies":[],"fullName":"!staticClass_d7c80a432731707ddadd54ea59a56049","required":true,"noNamespace":"before","type":0,"isExported":false,"convertibleName":""},{"code":" ","dependencies":[],"fullName":"!staticClass_b8b6866d7faef0c1b536e38915cc5583","required":true,"noNamespace":"before","type":0,"isExported":false,"convertibleName":""},{"code":"let Style=class Style {\n static instance;\n static noAnimation;\n static defaultStyleSheets = {\n \"@default\": `:host{display:inline-block;box-sizing:border-box}:host *{box-sizing:border-box}`,\n };\n static store(name, content) {\n this.getInstance().store(name, content);\n }\n static get(name) {\n return this.getInstance().get(name);\n }\n static getAsString(name) {\n return this.getInstance().getAsString(name);\n }\n static sheetToString(stylesheet) {\n return this.getInstance().sheetToString(stylesheet);\n }\n static load(name, url) {\n return this.getInstance().load(name, url);\n }\n static appendToHead(name) {\n if (!document.head.querySelector(`style[data-name=\"${name}\"]`)) {\n const styleNode = document.createElement('style');\n styleNode.setAttribute(`data-name`, name);\n styleNode.innerHTML = Style.getAsString(name);\n document.getElementsByTagName('head')[0].appendChild(styleNode);\n }\n }\n static refreshHead(name) {\n const styleNode = document.head.querySelector(`style[data-name=\"${name}\"]`);\n if (styleNode) {\n styleNode.innerHTML = Style.getAsString(name);\n }\n }\n static getInstance() {\n if (!this.instance) {\n this.instance = new Style();\n }\n return this.instance;\n }\n constructor() {\n for (let name in Style.defaultStyleSheets) {\n this.store(name, Style.defaultStyleSheets[name]);\n }\n Style.noAnimation = new CSSStyleSheet();\n Style.noAnimation.replaceSync(`:host{-webkit-transition: none !important;-moz-transition: none !important;-ms-transition: none !important;-o-transition: none !important;transition: none !important;}:host *{-webkit-transition: none !important;-moz-transition: none !important;-ms-transition: none !important;-o-transition: none !important;transition: none !important;}`);\n }\n stylesheets = new Map();\n async load(name, url) {\n try {\n let style = this.stylesheets.get(name);\n if (!style || style.cssRules.length == 0) {\n let txt = await (await fetch(url)).text();\n this.store(name, txt);\n }\n }\n catch (e) {\n }\n }\n store(name, content) {\n let style = this.stylesheets.get(name);\n if (!style) {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(content);\n this.stylesheets.set(name, sheet);\n return sheet;\n }\n else {\n style.replaceSync(content);\n Style.refreshHead(name);\n return style;\n }\n }\n get(name) {\n let style = this.stylesheets.get(name);\n if (!style) {\n style = this.store(name, \"\");\n }\n return style;\n }\n getAsString(name) {\n return this.sheetToString(this.get(name));\n }\n sheetToString(stylesheet) {\n return stylesheet.cssRules\n ? Array.from(stylesheet.cssRules)\n .map(rule => rule.cssText || '')\n .join('\\n')\n : '';\n }\n}\nStyle.Namespace=`Aventus`;\n__as1(_, 'Style', Style);\n","dependencies":[{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.Style","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let uuidv4=function uuidv4() {\n let uid = '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, c => (Number(c) ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> Number(c) / 4).toString(16));\n return uid;\n}\n__as1(_, 'uuidv4', uuidv4);\n","dependencies":[],"fullName":"Aventus.uuidv4","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let sleep=function sleep(ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n__as1(_, 'sleep', sleep);\n","dependencies":[],"fullName":"Aventus.sleep","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let isSubclassOf=function isSubclassOf(subClass, superClass) {\n if (typeof subClass !== 'function' || typeof superClass !== 'function')\n return false;\n let proto = subClass.prototype;\n while (proto) {\n if (proto === superClass.prototype)\n return true;\n proto = Object.getPrototypeOf(proto);\n }\n return false;\n}\n__as1(_, 'isSubclassOf', isSubclassOf);\n","dependencies":[],"fullName":"Aventus.isSubclassOf","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let isClass=function isClass(v) {\n return typeof v === 'function' && /^\\s*class\\s+/.test(v.toString());\n}\n__as1(_, 'isClass', isClass);\n","dependencies":[],"fullName":"Aventus.isClass","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let setValueToObject=function setValueToObject(path, obj, value) {\n path = path.replace(/\\[(.*?)\\]/g, '.$1');\n const val = (key) => {\n if (obj instanceof Map) {\n return obj.get(key);\n }\n return obj[key];\n };\n let splitted = path.split(\".\");\n for (let i = 0; i < splitted.length - 1; i++) {\n let split = splitted[i];\n let value = val(split);\n if (!value) {\n obj[split] = {};\n value = obj[split];\n }\n obj = value;\n }\n if (obj instanceof Map) {\n obj.set(splitted[splitted.length - 1], value);\n }\n else {\n obj[splitted[splitted.length - 1]] = value;\n }\n}\n__as1(_, 'setValueToObject', setValueToObject);\n","dependencies":[],"fullName":"Aventus.setValueToObject","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let Mutex=class Mutex {\n /**\n * Array to store functions waiting for the mutex to become available.\n * @type {((run: boolean) => void)[]}\n */\n waitingList = [];\n /**\n * Indicates whether the mutex is currently locked or not.\n * @type {boolean}\n */\n isLocked = false;\n /**\n * Waits for the mutex to become available and then acquires it.\n * @returns {Promise<boolean>} A Promise that resolves to true if the mutex was acquired successfully.\n */\n waitOne() {\n return new Promise((resolve) => {\n if (this.isLocked) {\n this.waitingList.push((run) => {\n resolve(run);\n });\n }\n else {\n this.isLocked = true;\n resolve(true);\n }\n });\n }\n /**\n * Release the mutex\n */\n release() {\n let nextFct = this.waitingList.shift();\n if (nextFct) {\n nextFct(true);\n }\n else {\n this.isLocked = false;\n }\n }\n /**\n * Releases the mutex, allowing only the last function in the waiting list to acquire it.\n */\n releaseOnlyLast() {\n if (this.waitingList.length > 0) {\n let lastFct = this.waitingList.pop();\n for (let fct of this.waitingList) {\n fct(false);\n }\n this.waitingList = [];\n if (lastFct) {\n lastFct(true);\n }\n }\n else {\n this.isLocked = false;\n }\n }\n /**\n * Clears the mutex, removing all waiting functions and releasing the lock.\n */\n dispose() {\n this.waitingList = [];\n this.isLocked = false;\n }\n /**\n * Executes a callback function safely within the mutex lock and releases the lock afterward.\n * @template T - The type of the return value of the callback function.\n * @param {() => T} cb - The callback function to execute.\n * @returns {Promise<T | null>} A Promise that resolves to the result of the callback function or null if an error occurs.\n */\n async safeRun(cb) {\n let result = null;\n await this.waitOne();\n try {\n result = cb.apply(null, []);\n }\n catch (e) {\n console.error(e);\n }\n await this.release();\n return result;\n }\n /**\n * Executes an asynchronous callback function safely within the mutex lock and releases the lock afterward.\n * @template T - The type of the return value of the asynchronous callback function.\n * @param {() => Promise<T>} cb - The asynchronous callback function to execute.\n * @returns {Promise<T | null>} A Promise that resolves to the result of the asynchronous callback function or null if an error occurs.\n */\n async safeRunAsync(cb) {\n let result = null;\n await this.waitOne();\n try {\n result = await cb.apply(null, []);\n }\n catch (e) {\n console.error(e);\n }\n await this.release();\n return result;\n }\n /**\n * Executes a callback function safely within the mutex lock, allowing only the last function in the waiting list to acquire the lock, and releases the lock afterward.\n * @template T - The type of the return value of the callback function.\n * @param {() => T} cb - The callback function to execute.\n * @returns {Promise<T | null>} A Promise that resolves to the result of the callback function or null if an error occurs.\n */\n async safeRunLast(cb) {\n let result = null;\n if (await this.waitOne()) {\n try {\n result = cb.apply(null, []);\n }\n catch (e) {\n console.error(e);\n }\n await this.releaseOnlyLast();\n }\n return result;\n }\n /**\n * Executes an asynchronous callback function safely within the mutex lock, allowing only the last function in the waiting list to acquire the lock, and releases the lock afterward.\n * @template T - The type of the return value of the asynchronous callback function.\n * @param {() => Promise<T>} cb - The asynchronous callback function to execute.\n * @returns {Promise<T | undefined>} A Promise that resolves to the result of the asynchronous callback function or undefined if an error occurs.\n */\n async safeRunLastAsync(cb) {\n let result;\n if (await this.waitOne()) {\n try {\n result = await cb.apply(null, []);\n }\n catch (e) {\n console.error(e);\n }\n await this.releaseOnlyLast();\n }\n return result;\n }\n}\nMutex.Namespace=`Aventus`;\n__as1(_, 'Mutex', Mutex);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}],"fullName":"Aventus.Mutex","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ActionGuard=class ActionGuard {\n /**\n * Map to store actions that are currently running.\n * @type {Map<any[], ((res: any) => void)[]>}\n * @private\n */\n runningAction = new Map();\n run(keys, action) {\n return new Promise(async (resolve) => {\n if (typeof keys == 'function') {\n action = keys;\n keys = [];\n }\n if (!action) {\n throw \"No action inside the Mutex.run\";\n }\n let actions = undefined;\n let runningKeys = Array.from(this.runningAction.keys());\n for (let runningKey of runningKeys) {\n if (runningKey.length == keys.length) {\n let found = true;\n for (let i = 0; i < keys.length; i++) {\n if (runningKey[i] != keys[i]) {\n found = false;\n break;\n }\n }\n if (found) {\n actions = this.runningAction.get(runningKey);\n break;\n }\n }\n }\n if (actions) {\n actions.push((res) => {\n resolve(res);\n });\n }\n else {\n this.runningAction.set(keys, []);\n let res = await action();\n let actions = this.runningAction.get(keys);\n if (actions) {\n for (let action of actions) {\n action(res);\n }\n }\n this.runningAction.delete(keys);\n resolve(res);\n }\n });\n }\n}\nActionGuard.Namespace=`Aventus`;\n__as1(_, 'ActionGuard', ActionGuard);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}],"fullName":"Aventus.ActionGuard","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"var RamErrorCode;\n(function (RamErrorCode) {\n RamErrorCode[RamErrorCode[\"unknow\"] = 0] = \"unknow\";\n RamErrorCode[RamErrorCode[\"noId\"] = 1] = \"noId\";\n RamErrorCode[RamErrorCode[\"noItemInsideRam\"] = 2] = \"noItemInsideRam\";\n})(RamErrorCode || (RamErrorCode = {}));\n__as1(_, 'RamErrorCode', RamErrorCode);\n","dependencies":[],"fullName":"Aventus.RamErrorCode","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"let ResourceLoader=class ResourceLoader {\n static headerLoaded = {};\n static headerWaiting = {};\n /**\n * Load the resource inside the head tag\n */\n static async loadInHead(options) {\n const _options = this.prepareOptions(options);\n if (this.headerLoaded[_options.url]) {\n return true;\n }\n else if (this.headerWaiting.hasOwnProperty(_options.url)) {\n return await this.awaitFctHead(_options.url);\n }\n else {\n this.headerWaiting[_options.url] = [];\n let tagEl;\n if (_options.type == \"js\") {\n tagEl = document.createElement(\"SCRIPT\");\n }\n else if (_options.type == \"css\") {\n tagEl = document.createElement(\"LINK\");\n tagEl.setAttribute(\"rel\", \"stylesheet\");\n }\n else {\n throw \"unknow type \" + _options.type + \" to append into head\";\n }\n if (_options.nonce) {\n tagEl.setAttribute(\"nonce\", _options.nonce);\n }\n document.head.appendChild(tagEl);\n let result = await this.loadTag(tagEl, _options.url);\n this.headerLoaded[_options.url] = true;\n this.releaseAwaitFctHead(_options.url, result);\n return result;\n }\n }\n static loadTag(tagEl, url) {\n return new Promise((resolve, reject) => {\n tagEl.addEventListener(\"load\", (e) => {\n resolve(true);\n });\n tagEl.addEventListener(\"error\", (e) => {\n resolve(false);\n });\n if (tagEl instanceof HTMLLinkElement) {\n tagEl.setAttribute(\"href\", url);\n }\n else {\n tagEl.setAttribute('src', url);\n }\n });\n }\n static releaseAwaitFctHead(url, result) {\n if (this.headerWaiting[url]) {\n for (let i = 0; i < this.headerWaiting[url].length; i++) {\n this.headerWaiting[url][i](result);\n }\n delete this.headerWaiting[url];\n }\n }\n static awaitFctHead(url) {\n return new Promise((resolve) => {\n this.headerWaiting[url].push((result) => {\n resolve(result);\n });\n });\n }\n static requestLoaded = {};\n static requestWaiting = {};\n /**\n *\n */\n static async load(options) {\n options = this.prepareOptions(options);\n if (this.requestLoaded[options.url]) {\n return this.requestLoaded[options.url];\n }\n else if (this.requestWaiting.hasOwnProperty(options.url)) {\n await this.awaitFct(options.url);\n return this.requestLoaded[options.url];\n }\n else {\n this.requestWaiting[options.url] = [];\n let blob = false;\n if (options.type == \"img\") {\n blob = true;\n }\n let content = await this.fetching(options.url, blob);\n if (options.type == \"img\" && content.startsWith(\"data:text/html;\")) {\n console.error(\"Can't load img \" + options.url);\n content = \"\";\n }\n this.requestLoaded[options.url] = content;\n this.releaseAwaitFct(options.url);\n return content;\n }\n }\n static releaseAwaitFct(url) {\n if (this.requestWaiting[url]) {\n for (let i = 0; i < this.requestWaiting[url].length; i++) {\n this.requestWaiting[url][i]();\n }\n delete this.requestWaiting[url];\n }\n }\n static awaitFct(url) {\n return new Promise((resolve) => {\n this.requestWaiting[url].push(() => {\n resolve('');\n });\n });\n }\n static async fetching(url, useBlob = false) {\n if (useBlob) {\n let result = await fetch(url, {\n headers: {\n responseType: 'blob'\n }\n });\n let blob = await result.blob();\n return await this.readFile(blob);\n }\n else {\n let result = await fetch(url);\n return await result.text();\n }\n }\n static readFile(blob) {\n return new Promise((resolve) => {\n var reader = new FileReader();\n reader.onloadend = function () {\n resolve(reader.result);\n };\n reader.readAsDataURL(blob);\n });\n }\n static imgExtensions = [\"png\", \"jpg\", \"jpeg\", \"gif\"];\n static prepareOptions(options) {\n let result;\n if (typeof options === 'string' || options instanceof String) {\n result = {\n url: options,\n type: 'js'\n };\n let splittedURI = result.url.split('.');\n let extension = splittedURI[splittedURI.length - 1];\n extension = extension.split(\"?\")[0];\n if (extension == \"svg\") {\n result.type = 'svg';\n }\n else if (extension == \"js\") {\n result.type = 'js';\n }\n else if (extension == \"css\") {\n result.type = 'css';\n }\n else if (this.imgExtensions.indexOf(extension) != -1) {\n result.type = 'img';\n }\n else {\n delete result.type;\n }\n }\n else {\n result = options;\n }\n return result;\n }\n}\nResourceLoader.Namespace=`Aventus`;\n__as1(_, 'ResourceLoader', ResourceLoader);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ResourceLoaderHeadOptions","isStrong":false},{"fullName":"Aventus.ResourceLoaderOptions","isStrong":false}],"fullName":"Aventus.ResourceLoader","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let DragElementXYType= [SVGGElement, SVGRectElement, SVGEllipseElement, SVGTextElement];\n__as1(_, 'DragElementXYType', DragElementXYType);\n","dependencies":[],"fullName":"Aventus.DragElementXYType","required":false,"type":5,"isExported":true,"convertibleName":""},{"code":"let DragElementLeftTopType= [HTMLElement, SVGSVGElement];\n__as1(_, 'DragElementLeftTopType', DragElementLeftTopType);\n","dependencies":[],"fullName":"Aventus.DragElementLeftTopType","required":false,"type":5,"isExported":true,"convertibleName":""},{"code":"let NormalizedEvent=class NormalizedEvent {\n _event;\n get event() {\n return this._event;\n }\n constructor(event) {\n this._event = event;\n }\n getProp(prop) {\n if (prop in this.event) {\n return this.event[prop];\n }\n return undefined;\n }\n stopImmediatePropagation() {\n this.event.stopImmediatePropagation();\n }\n get clientX() {\n if ('clientX' in this.event) {\n return this.event.clientX;\n }\n else if ('touches' in this.event && this.event.touches.length > 0) {\n return this.event.touches[0].clientX;\n }\n return 0;\n }\n get clientY() {\n if ('clientY' in this.event) {\n return this.event.clientY;\n }\n else if ('touches' in this.event && this.event.touches.length > 0) {\n return this.event.touches[0].clientY;\n }\n return 0;\n }\n get pageX() {\n if ('pageX' in this.event) {\n return this.event.pageX;\n }\n else if ('touches' in this.event && this.event.touches.length > 0) {\n return this.event.touches[0].pageX;\n }\n return 0;\n }\n get pageY() {\n if ('pageY' in this.event) {\n return this.event.pageY;\n }\n else if ('touches' in this.event && this.event.touches.length > 0) {\n return this.event.touches[0].pageY;\n }\n return 0;\n }\n get type() {\n return this.event.type;\n }\n get target() {\n return this.event.target;\n }\n get timeStamp() {\n return this.event.timeStamp;\n }\n get pointerType() {\n if ('TouchEvent' in window && this._event instanceof TouchEvent)\n return \"touch\";\n return this.getProp(\"pointerType\");\n }\n get button() {\n return this.getProp(\"button\");\n }\n get isTouch() {\n if ('TouchEvent' in window && this._event instanceof TouchEvent)\n return true;\n return this._event.pointerType == \"touch\";\n }\n}\nNormalizedEvent.Namespace=`Aventus`;\n__as1(_, 'NormalizedEvent', NormalizedEvent);\n","dependencies":[{"fullName":"T","isStrong":false}],"fullName":"Aventus.NormalizedEvent","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Callback=class Callback {\n callbacks = new Map();\n /**\n * Clear all callbacks\n */\n clear() {\n this.callbacks.clear();\n }\n /**\n * Add a callback\n */\n add(cb, scope = null) {\n if (!this.callbacks.has(cb)) {\n this.callbacks.set(cb, scope);\n }\n }\n /**\n * Remove a callback\n */\n remove(cb) {\n this.callbacks.delete(cb);\n }\n /**\n * Trigger all callbacks\n */\n trigger(...args) {\n let result = [];\n let cbs = [...this.callbacks];\n for (let [cb, scope] of cbs) {\n result.push(cb.apply(scope, args));\n }\n return result;\n }\n}\nCallback.Namespace=`Aventus`;\n__as1(_, 'Callback', Callback);\n","dependencies":[{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.Callback","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let CallbackGroup=class CallbackGroup {\n callbacks = {};\n /**\n * Clear all callbacks\n */\n clearAll() {\n this.callbacks = {};\n }\n /**\n * Clear all callbacks for a specific group\n */\n clear(group) {\n delete this.callbacks[group];\n }\n /**\n * Add a callback for a group\n */\n add(group, cb, scope = null) {\n if (!this.callbacks[group]) {\n this.callbacks[group] = new Map();\n }\n if (!this.callbacks[group].has(cb)) {\n this.callbacks[group].set(cb, scope);\n }\n }\n /**\n * Remove a callback for a group\n */\n remove(group, cb) {\n if (this.callbacks[group]) {\n this.callbacks[group].delete(cb);\n }\n }\n /**\n * Trigger all callbacks inside a group\n */\n trigger(group, ...args) {\n if (this.callbacks[group]) {\n let cbs = [...this.callbacks[group]];\n for (let [cb, scope] of cbs) {\n cb.apply(scope, args);\n }\n }\n }\n}\nCallbackGroup.Namespace=`Aventus`;\n__as1(_, 'CallbackGroup', CallbackGroup);\n","dependencies":[{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.CallbackGroup","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Resource=class Resource {\n}\nResource.Namespace=`Aventus`;\n__as1(_, 'Resource', Resource);\n","dependencies":[],"fullName":"Aventus.Resource","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Request=class Request {\n}\nRequest.Namespace=`Aventus`;\n__as1(_, 'Request', Request);\n","dependencies":[],"fullName":"Aventus.Request","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let compareObject=function compareObject(obj1, obj2, tableOrder = true) {\n if (Array.isArray(obj1)) {\n if (!Array.isArray(obj2)) {\n return false;\n }\n obj2 = obj2.slice();\n if (obj1.length !== obj2.length) {\n return false;\n }\n if (tableOrder) {\n for (let i = 0; i < obj1.length; i++) {\n if (!compareObject(obj1[i], obj2[i])) {\n return false;\n }\n }\n return true;\n }\n else {\n for (let i = 0; i < obj1.length; i++) {\n let foundElement = false;\n for (let j = 0; j < obj2.length; j++) {\n if (compareObject(obj1[i], obj2[j])) {\n obj2.splice(j, 1);\n foundElement = true;\n break;\n }\n }\n if (!foundElement) {\n return false;\n }\n }\n }\n return true;\n }\n else if (typeof obj1 === 'object' && obj1 !== undefined && obj1 !== null) {\n if (typeof obj2 !== 'object' || obj2 === undefined || obj2 === null) {\n return false;\n }\n if (obj1 == obj2) {\n return true;\n }\n if (obj1 instanceof HTMLElement || obj2 instanceof HTMLElement) {\n return false;\n }\n if (obj1 instanceof Date || obj2 instanceof Date) {\n return obj1.toString() === obj2.toString();\n }\n let oneProxy = false;\n if (Watcher.is(obj1)) {\n oneProxy = true;\n obj1 = Watcher.extract(obj1, false);\n }\n if (Watcher.is(obj2)) {\n oneProxy = true;\n obj2 = Watcher.extract(obj2, false);\n }\n if (obj1 instanceof Map && obj2 instanceof Map) {\n if (obj1.size != obj2.size) {\n return false;\n }\n const keys = obj1.keys();\n for (let key in keys) {\n if (!obj2.has(key)) {\n return false;\n }\n if (!compareObject(obj1.get(key), obj2.get(key))) {\n return false;\n }\n }\n return true;\n }\n else {\n if (Object.keys(obj1).length !== Object.keys(obj2).length) {\n return false;\n }\n for (let key in obj1) {\n if (oneProxy && Watcher['__reservedName'][key]) {\n continue;\n }\n if (!(key in obj2)) {\n return false;\n }\n if (!compareObject(obj1[key], obj2[key])) {\n return false;\n }\n }\n return true;\n }\n }\n else {\n return obj1 === obj2;\n }\n}\n__as1(_, 'compareObject', compareObject);\n","dependencies":[{"fullName":"Aventus.Watcher","isStrong":false}],"fullName":"Aventus.compareObject","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let getValueFromObject=function getValueFromObject(path, obj) {\n if (path === undefined) {\n path = '';\n }\n path = path.replace(/\\[(.*?)\\]/g, '.$1');\n if (path == \"\") {\n return obj;\n }\n const val = (key) => {\n if (obj instanceof Map) {\n return obj.get(key);\n }\n return obj[key];\n };\n let splitted = path.split(\".\");\n for (let i = 0; i < splitted.length - 1; i++) {\n let split = splitted[i];\n let value = val(split);\n if (!value || typeof value !== 'object') {\n return undefined;\n }\n obj = value;\n }\n if (!obj || typeof obj !== 'object') {\n return undefined;\n }\n return val(splitted[splitted.length - 1]);\n}\n__as1(_, 'getValueFromObject', getValueFromObject);\n","dependencies":[],"fullName":"Aventus.getValueFromObject","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"var WatchAction;\n(function (WatchAction) {\n WatchAction[WatchAction[\"CREATED\"] = 0] = \"CREATED\";\n WatchAction[WatchAction[\"UPDATED\"] = 1] = \"UPDATED\";\n WatchAction[WatchAction[\"DELETED\"] = 2] = \"DELETED\";\n})(WatchAction || (WatchAction = {}));\n__as1(_, 'WatchAction', WatchAction);\n","dependencies":[],"fullName":"Aventus.WatchAction","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"let Async=function Async(el) {\n return new Promise((resolve) => {\n if (el instanceof Promise) {\n el.then(resolve);\n }\n else {\n resolve(el);\n }\n });\n}\n__as1(_, 'Async', Async);\n","dependencies":[{"fullName":"Aventus.Asyncable","isStrong":false}],"fullName":"Aventus.Async","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"var HttpMethod;\n(function (HttpMethod) {\n HttpMethod[\"GET\"] = \"GET\";\n HttpMethod[\"POST\"] = \"POST\";\n HttpMethod[\"DELETE\"] = \"DELETE\";\n HttpMethod[\"PUT\"] = \"PUT\";\n HttpMethod[\"OPTION\"] = \"OPTION\";\n})(HttpMethod || (HttpMethod = {}));\n__as1(_, 'HttpMethod', HttpMethod);\n","dependencies":[],"fullName":"Aventus.HttpMethod","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"var HttpErrorCode;\n(function (HttpErrorCode) {\n HttpErrorCode[HttpErrorCode[\"unknow\"] = 0] = \"unknow\";\n})(HttpErrorCode || (HttpErrorCode = {}));\n__as1(_, 'HttpErrorCode', HttpErrorCode);\n","dependencies":[],"fullName":"Aventus.HttpErrorCode","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"let DateConverter=class DateConverter {\n static __converter = new DateConverter();\n static get converter() {\n return this.__converter;\n }\n static set converter(value) {\n this.__converter = value;\n }\n isStringDate(txt) {\n return /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d{3,6})Z$/.exec(txt) !== null;\n }\n fromString(txt) {\n return new Date(txt);\n }\n toString(date) {\n if (date.getFullYear() < 100) {\n return \"0001-01-01T00:00:00.000Z\";\n }\n return date.toISOString();\n }\n}\nDateConverter.Namespace=`Aventus`;\n__as1(_, 'DateConverter', DateConverter);\n","dependencies":[],"fullName":"Aventus.DateConverter","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Json=class Json {\n /**\n * Converts a JavaScript class instance to a JSON object.\n * @template T - The type of the object to convert.\n * @param {T} obj - The object to convert to JSON.\n * @param {JsonToOptions} [options] - Options for JSON conversion.\n * @returns {{ [key: string | number]: any; }} Returns the JSON representation of the object.\n */\n static classToJson(obj, options) {\n const realOptions = {\n isValidKey: options?.isValidKey ?? (() => true),\n replaceKey: options?.replaceKey ?? ((key) => key),\n transformValue: options?.transformValue ?? ((key, value) => value),\n beforeEnd: options?.beforeEnd ?? ((res) => res)\n };\n return this.__classToJson(obj, realOptions);\n }\n static __classToJson(obj, options) {\n let result = {};\n let descriptors = Object.getOwnPropertyDescriptors(obj);\n for (let key in descriptors) {\n if (options.isValidKey(key))\n result[options.replaceKey(key)] = options.transformValue(key, descriptors[key].value);\n }\n let cst = obj.constructor;\n while (cst.prototype && cst != Object.prototype) {\n let descriptorsClass = Object.getOwnPropertyDescriptors(cst.prototype);\n for (let key in descriptorsClass) {\n if (options.isValidKey(key)) {\n let descriptor = descriptorsClass[key];\n if (descriptor?.get) {\n const o = obj;\n result[options.replaceKey(key)] = options.transformValue(key, o[key]);\n }\n }\n }\n cst = Object.getPrototypeOf(cst);\n }\n result = options.beforeEnd(result);\n return result;\n }\n /**\n * Converts a JSON object to a JavaScript class instance.\n * @template T - The type of the object to convert.\n * @param {T} obj - The object to populate with JSON data.\n * @param {*} data - The JSON data to populate the object with.\n * @param {JsonFromOptions} [options] - Options for JSON deserialization.\n * @returns {T} Returns the populated object.\n */\n static classFromJson(obj, data, options) {\n let realOptions = {\n transformValue: options?.transformValue ?? ((key, value) => value),\n replaceUndefined: options?.replaceUndefined ?? false,\n replaceUndefinedWithKey: options?.replaceUndefinedWithKey ?? false,\n };\n return this.__classFromJson(obj, data, realOptions);\n }\n static __classFromJson(obj, data, options) {\n let props = Object.getOwnPropertyNames(obj);\n for (let prop of props) {\n let propUpperFirst = prop[0].toUpperCase() + prop.slice(1);\n let value = data[prop] === undefined ? data[propUpperFirst] : data[prop];\n if (value !== undefined || options.replaceUndefined || (options.replaceUndefinedWithKey && (Object.hasOwn(data, prop) || Object.hasOwn(data, propUpperFirst)))) {\n let propInfo = Object.getOwnPropertyDescriptor(obj, prop);\n if (propInfo?.writable) {\n const o = obj;\n o[prop] = options.transformValue(prop, value);\n }\n }\n }\n let cstTemp = obj.constructor;\n while (cstTemp.prototype && cstTemp != Object.prototype) {\n props = Object.getOwnPropertyNames(cstTemp.prototype);\n for (let prop of props) {\n let propUpperFirst = prop[0].toUpperCase() + prop.slice(1);\n let value = data[prop] === undefined ? data[propUpperFirst] : data[prop];\n if (value !== undefined || options.replaceUndefined || (options.replaceUndefinedWithKey && (Object.hasOwn(data, prop) || Object.hasOwn(data, propUpperFirst)))) {\n let propInfo = Object.getOwnPropertyDescriptor(cstTemp.prototype, prop);\n if (propInfo?.set) {\n const o = obj;\n o[prop] = options.transformValue(prop, value);\n }\n }\n }\n cstTemp = Object.getPrototypeOf(cstTemp);\n }\n return obj;\n }\n}\nJson.Namespace=`Aventus`;\n__as1(_, 'Json', Json);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.JsonToOptions","isStrong":false},{"fullName":"Aventus.JsonFromOptions","isStrong":false}],"fullName":"Aventus.Json","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ConverterTransform=class ConverterTransform {\n transform(data) {\n return this.transformLoop(data);\n }\n createInstance(data) {\n if (data.$type) {\n let cst = Converter.info.get(data.$type);\n if (cst) {\n return new cst();\n }\n }\n return undefined;\n }\n beforeTransformObject(obj) {\n }\n afterTransformObject(obj) {\n }\n transformLoop(data) {\n if (data === null) {\n return data;\n }\n if (Array.isArray(data)) {\n let result = [];\n for (let element of data) {\n result.push(this.transformLoop(element));\n }\n return result;\n }\n if (data instanceof Date) {\n return data;\n }\n if (typeof data === 'object' && !/^\\s*class\\s+/.test(data.toString())) {\n let objTemp = this.createInstance(data);\n if (objTemp) {\n if (objTemp instanceof Map) {\n if (data.values) {\n for (const keyValue of data.values) {\n objTemp.set(this.transformLoop(keyValue[0]), this.transformLoop(keyValue[1]));\n }\n }\n return objTemp;\n }\n let obj = objTemp;\n this.beforeTransformObject(obj);\n if (obj.fromJSON) {\n obj = obj.fromJSON(data);\n }\n else {\n obj = Json.classFromJson(obj, data, {\n transformValue: (key, value) => {\n if (obj[key] instanceof Date) {\n return value ? new Date(value) : null;\n }\n else if (typeof value == 'string' && DateConverter.converter.isStringDate(value)) {\n return value ? DateConverter.converter.fromString(value) : null;\n }\n else if (obj[key] instanceof Map) {\n let map = new Map();\n if (\"$type\" in value && value['$type'] == \"Aventus.Map\") {\n value = value.values;\n }\n for (const keyValue of value) {\n map.set(this.transformLoop(keyValue[0]), this.transformLoop(keyValue[1]));\n }\n return map;\n }\n else if (obj instanceof Data) {\n let cst = obj.constructor;\n if (cst.$schema[key] == 'boolean') {\n return value ? true : false;\n }\n else if (cst.$schema[key] == 'number') {\n return isNaN(Number(value)) ? 0 : Number(value);\n }\n else if (cst.$schema[key] == 'number') {\n return isNaN(Number(value)) ? 0 : Number(value);\n }\n else if (cst.$schema[key] == 'Date') {\n return value ? new Date(value) : null;\n }\n }\n return this.transformLoop(value);\n }\n });\n }\n this.afterTransformObject(obj);\n return obj;\n }\n let result = {};\n for (let key in data) {\n result[key] = this.transformLoop(data[key]);\n }\n return result;\n }\n if (typeof data == 'string' && /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d{3})Z$/.exec(data)) {\n return new Date(data);\n }\n return data;\n }\n copyValuesClass(target, src, options) {\n const realOptions = {\n isValidKey: options?.isValidKey ?? (() => true),\n replaceKey: options?.replaceKey ?? ((key) => key),\n transformValue: options?.transformValue ?? ((key, value) => value),\n };\n this.__classCopyValues(target, src, realOptions);\n }\n __classCopyValues(target, src, options) {\n let props = Object.getOwnPropertyNames(target);\n for (let prop of props) {\n let propInfo = Object.getOwnPropertyDescriptor(target, prop);\n if (propInfo?.writable) {\n if (options.isValidKey(prop)) {\n const _target = target;\n const _src = src;\n _target[options.replaceKey(prop)] = options.transformValue(prop, _src[prop]);\n }\n }\n }\n let cstTemp = target.constructor;\n while (cstTemp.prototype && cstTemp != Object.prototype) {\n props = Object.getOwnPropertyNames(cstTemp.prototype);\n for (let prop of props) {\n let propInfo = Object.getOwnPropertyDescriptor(cstTemp.prototype, prop);\n if (propInfo?.set && propInfo.get) {\n if (options.isValidKey(prop)) {\n const _target = target;\n const _src = src;\n _target[options.replaceKey(prop)] = options.transformValue(prop, _src[prop]);\n }\n }\n }\n cstTemp = Object.getPrototypeOf(cstTemp);\n }\n }\n}\nConverterTransform.Namespace=`Aventus`;\n__as1(_, 'ConverterTransform', ConverterTransform);\n","dependencies":[{"fullName":"Aventus.IConverterTransform","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.Converter","isStrong":false},{"fullName":"Aventus.Json","isStrong":false},{"fullName":"Aventus.DateConverter","isStrong":false},{"fullName":"Aventus.ClassCopyOptions","isStrong":false},{"fullName":"Aventus.Data","isStrong":false}],"fullName":"Aventus.ConverterTransform","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Converter=class Converter {\n /**\n * Map storing information about registered types.\n */\n static info = new Map([[\"Aventus.Map\", Map]]);\n /**\n * Map storing schemas for registered types.\n */\n static schema = new Map();\n /**\n * Internal converter instance.\n */\n static __converter = new ConverterTransform();\n /**\n * Getter for the internal converter instance.\n */\n static get converterTransform() {\n return this.__converter;\n }\n /**\n * Sets the converter instance.\n * @param converter The converter instance to set.\n */\n static setConverter(converter) {\n this.__converter = converter;\n }\n /**\n * Registers a unique string type for any class.\n * @param $type The unique string type identifier.\n * @param cst The constructor function for the class.\n * @param schema Optional schema for the registered type.\n */\n static register($type, cst, schema) {\n this.info.set($type, cst);\n if (schema) {\n this.schema.set($type, schema);\n }\n }\n /**\n * Transforms the provided data using the current converter instance.\n * @template T\n * @param {*} data The data to transform.\n * @param {IConverterTransform} [converter] Optional converter instance to use for transformation.\n * @returns {T} Returns the transformed data.\n */\n static transform(data, converter) {\n if (!converter) {\n converter = this.converterTransform;\n }\n return converter.transform(data);\n }\n /**\n * Copies values from one class instance to another using the current converter instance.\n * @template T\n * @param {T} to The destination class instance to copy values into.\n * @param {T} from The source class instance to copy values from.\n * @param {ClassCopyOptions} [options] Optional options for the copy operation.\n * @param {IConverterTransform} [converter] Optional converter instance to use for the copy operation.\n * @returns {T} Returns the destination class instance with copied values.\n */\n static copyValuesClass(to, from, options, converter) {\n if (!converter) {\n converter = this.converterTransform;\n }\n return converter.copyValuesClass(to, from, options);\n }\n}\nConverter.Namespace=`Aventus`;\n__as1(_, 'Converter', Converter);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Schema","isStrong":true},{"fullName":"Aventus.IConverterTransform","isStrong":true},{"fullName":"Aventus.ConverterTransform","isStrong":true},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ClassCopyOptions","isStrong":false}],"fullName":"Aventus.Converter","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let clone=function clone(item) {\n return Converter.transform(JSON.parse(JSON.stringify(item)));\n}\n__as1(_, 'clone', clone);\n","dependencies":[{"fullName":"Aventus.Converter","isStrong":false}],"fullName":"Aventus.clone","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let HttpResponse=class HttpResponse {\n get status() {\n return this.response.status;\n }\n get statusText() {\n return this.response.statusText;\n }\n get redirected() {\n return this.response.redirected;\n }\n get ok() {\n return this.response.ok;\n }\n get type() {\n return this.response.type;\n }\n get url() {\n return this.response.url;\n }\n get headers() {\n return this.response.headers;\n }\n response;\n constructor(response) {\n this.response = response;\n }\n bodyUsed = false;\n bodyContent;\n async json() {\n if (!this.bodyUsed) {\n this.bodyUsed = true;\n this.bodyContent = await this.response.json();\n }\n return Converter.transform(this.bodyContent);\n }\n async blob() {\n if (!this.bodyUsed) {\n this.bodyUsed = true;\n this.bodyContent = await this.response.blob();\n }\n return this.bodyContent;\n }\n async text() {\n if (!this.bodyUsed) {\n this.bodyUsed = true;\n this.bodyContent = await this.response.text();\n }\n return this.bodyContent;\n }\n}\nHttpResponse.Namespace=`Aventus`;\n__as1(_, 'HttpResponse', HttpResponse);\n","dependencies":[{"fullName":"T","isStrong":false},{"fullName":"Aventus.Converter","isStrong":false}],"fullName":"Aventus.HttpResponse","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Data=// @Dependencies([{ type: Aventus.Converter, strong: true }, { type: Converter, strong: true }])\nclass Data {\n static converter = new Converter();\n /**\n * The schema for the class\n */\n static $schema;\n /**\n * The current namespace\n */\n static Namespace = \"\";\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n static get Fullname() { return this.Namespace + \".\" + this.name; }\n /**\n * The current namespace\n */\n get namespace() {\n return this.constructor['Namespace'];\n }\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n get $type() {\n return this.constructor['Fullname'];\n }\n /**\n * Get the name of the class\n */\n get className() {\n return this.constructor.name;\n }\n /**\n * Get a JSON for the current object\n */\n toJSON() {\n let toAvoid = ['className', 'namespace'];\n return Json.classToJson(this, {\n isValidKey: (key) => !toAvoid.includes(key)\n });\n }\n /**\n * Clone the object by transforming a parsed JSON string back into the original type\n */\n clone() {\n return Converter.transform(JSON.parse(JSON.stringify(this)));\n }\n}\nData.Namespace=`Aventus`;\nData.$schema={\"namespace\":\"string\",\"$type\":\"string\",\"className\":\"string\"};\nConverter.register(Data.Fullname, Data);\n__as1(_, 'Data', Data);\n","dependencies":[{"fullName":"Aventus.IData","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Converter","isStrong":true},{"fullName":"Aventus.Json","isStrong":false}],"fullName":"Aventus.Data","required":false,"type":2,"isExported":true,"convertibleName":""},{"code":"let HttpCache=class HttpCache {\n static cache = new Map();\n static async fetch(fullUrl, request) {\n const key = this.generateCacheKey(fullUrl, request);\n if (key) {\n const value = this.cache.get(key);\n if (value)\n return value;\n }\n const result = await fetch(fullUrl, request);\n const response = new HttpResponse(result);\n if (key)\n this.cache.set(key, response);\n return response;\n }\n static clear(fullUrl, request) {\n const key = this.generateCacheKey(fullUrl, request);\n if (key) {\n if (this.cache.has(key)) {\n this.cache.delete(key);\n }\n }\n }\n static generateCacheKey(fullUrl, request) {\n const method = request.method;\n const body = request.body;\n let bodyKey = \"\";\n if (typeof body == 'string') {\n bodyKey = this.hashStringToInt(body) + '';\n }\n else if (body instanceof FormData) {\n }\n return fullUrl + \"°\" + method + \"°\" + bodyKey;\n }\n static hashStringToInt(str) {\n let hash = 0x811c9dc5;\n for (let i = 0; i < str.length; i++) {\n hash ^= str.charCodeAt(i);\n hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24);\n }\n return hash >>> 0;\n }\n}\nHttpCache.Namespace=`Aventus`;\n__as1(_, 'HttpCache', HttpCache);\n","dependencies":[{"fullName":"Aventus.HttpResponse","isStrong":true}],"fullName":"Aventus.HttpCache","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let GenericError=// @Dependencies([{ type: Aventus.Converter, strong: true }, { type: Converter, strong: true }])\nclass GenericError {\n static converter = new Converter();\n static get Fullname() { return \"Aventus.GenericError\"; }\n /**\n * Code for the error\n */\n code;\n /**\n * Description of the error\n */\n message;\n /**\n * Additional details related to the error.\n */\n details = [];\n /**\n * Creates a new instance of GenericError.\n * @param {EnumValue<T>} code - The error code.\n * @param {string | Error | unknown} message - The error message.\n */\n constructor(code, message) {\n this.code = code;\n if (message instanceof Error) {\n this.message = message.message;\n }\n else {\n this.message = message + '';\n }\n }\n}\nGenericError.Namespace=`Aventus`;\nGenericError.$schema={\"code\":\"Aventus.EnumValue\",\"message\":\"string\"};\nConverter.register(GenericError.Fullname, GenericError);\n__as1(_, 'GenericError', GenericError);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Convertible","isStrong":false},{"fullName":"Aventus.Enum","isStrong":false},{"fullName":"Aventus.Converter","isStrong":true},{"fullName":"Aventus.EnumValue","isStrong":false}],"fullName":"Aventus.GenericError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let VoidWithError=class VoidWithError {\n static get Fullname() { return \"Aventus.VoidWithError\"; }\n /**\n * Determine if the action is a success\n */\n get success() {\n return this.errors.length == 0;\n }\n /**\n * List of errors\n */\n errors = [];\n /**\n * Converts the current instance to a VoidWithError object.\n * @returns {VoidWithError} A new instance of VoidWithError with the same error list.\n */\n toGeneric() {\n const result = new VoidWithError();\n result.errors = this.errors;\n return result;\n }\n /**\n * Checks if the error list contains a specific error code.\n * @template U - The type of error, extending GenericError.\n * @template T - The type of the error code, which extends either number or Enum.\n * @param {EnumValue<T>} code - The error code to check for.\n * @param {new (...args: any[]) => U} [type] - Optional constructor function of the error type.\n * @returns {boolean} True if the error list contains the specified error code, otherwise false.\n */\n containsCode(code, type) {\n if (type) {\n for (let error of this.errors) {\n if (error instanceof type) {\n if (error.code == code) {\n return true;\n }\n }\n }\n }\n else {\n for (let error of this.errors) {\n if (error.code == code) {\n return true;\n }\n }\n }\n return false;\n }\n run(fct) {\n if (this.success) {\n let result = fct();\n if (!Array.isArray(result)) {\n result = result.errors;\n }\n if (result.length > 0) {\n this.errors = [...this.errors, ...result];\n }\n }\n return this;\n }\n async runAsync(fct) {\n if (this.success) {\n let result = await fct();\n if (!Array.isArray(result)) {\n result = result.errors;\n }\n if (result.length > 0) {\n this.errors = [...this.errors, ...result];\n }\n }\n return this;\n }\n extract(fct) {\n if (this.success) {\n let result = fct();\n if (result.success && result.result) {\n return result.result;\n }\n this.errors = [...this.errors, ...result.errors];\n }\n return undefined;\n }\n async extractAsync(fct) {\n if (this.success) {\n let result = await fct();\n if (result.success && result.result) {\n return result.result;\n }\n this.errors = [...this.errors, ...result.errors];\n }\n return undefined;\n }\n}\nVoidWithError.Namespace=`Aventus`;\nVoidWithError.$schema={\"success\":\"boolean\",\"errors\":\"T[]\"};\nConverter.register(VoidWithError.Fullname, VoidWithError);\n__as1(_, 'VoidWithError', VoidWithError);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Convertible","isStrong":false},{"fullName":"Aventus.GenericError","isStrong":false},{"fullName":"Aventus.Enum","isStrong":false},{"fullName":"Aventus.EnumValue","isStrong":false},{"fullName":"U","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"X","isStrong":false}],"fullName":"Aventus.VoidWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let ResultWithError=class ResultWithError extends VoidWithError {\n static get Fullname() { return \"Aventus.ResultWithError\"; }\n /**\n * The result value of the action.\n * @type {U | undefined}\n */\n result;\n /**\n * Converts the current instance to a ResultWithError object.\n * @returns {ResultWithError<U>} A new instance of ResultWithError with the same error list and result value.\n */\n toGeneric() {\n const result = new ResultWithError();\n result.errors = this.errors;\n result.result = this.result;\n return result;\n }\n run(fct) {\n if (this.success) {\n let result = fct();\n if (!Array.isArray(result)) {\n result = result.errors;\n }\n if (result.length > 0) {\n this.errors = [...this.errors, ...result];\n }\n if (result instanceof ResultWithError && result.success && result.result) {\n this.result = result.result;\n }\n }\n return this;\n }\n async runAsync(fct) {\n if (this.success) {\n let result = await fct();\n if (!Array.isArray(result)) {\n result = result.errors;\n }\n if (result.length > 0) {\n this.errors = [...this.errors, ...result];\n }\n if (result instanceof ResultWithError && result.success && result.result) {\n this.result = result.result;\n }\n }\n return this;\n }\n}\nResultWithError.Namespace=`Aventus`;\nResultWithError.$schema={...(VoidWithError?.$schema ?? {}), };\nConverter.register(ResultWithError.Fullname, ResultWithError);\n__as1(_, 'ResultWithError', ResultWithError);\n","dependencies":[{"fullName":"Aventus.VoidWithError","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Convertible","isStrong":false},{"fullName":"Aventus.GenericError","isStrong":false}],"fullName":"Aventus.ResultWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let HttpError=class HttpError extends GenericError {\n}\nHttpError.Namespace=`Aventus`;\nHttpError.$schema={...(GenericError?.$schema ?? {}), };\nConverter.register(HttpError.Fullname, HttpError);\n__as1(_, 'HttpError', HttpError);\n","dependencies":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"Aventus.HttpErrorCode","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.HttpError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let Signal=class Signal {\n __subscribes = [];\n _value;\n _onChange;\n get value() {\n Watcher._register?.register(this, \"*\", Watcher._register.version, \"*\");\n return this._value;\n }\n set value(item) {\n const oldValue = this._value;\n this._value = item;\n if (oldValue != item) {\n if (this._onChange) {\n this._onChange();\n }\n for (let fct of this.__subscribes) {\n fct(WatchAction.UPDATED, \"*\", item, []);\n }\n }\n }\n constructor(item, onChange) {\n this._value = item;\n this._onChange = onChange;\n }\n subscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index == -1) {\n this.__subscribes.push(fct);\n }\n }\n unsubscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index > -1) {\n this.__subscribes.splice(index, 1);\n }\n }\n destroy() {\n this.__subscribes = [];\n }\n}\nSignal.Namespace=`Aventus`;\n__as1(_, 'Signal', Signal);\n","dependencies":[{"fullName":"Aventus.EffectReceiver","isStrong":true},{"fullName":"Aventus.WatcherChange","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}],"fullName":"Aventus.Signal","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Effect=class Effect {\n callbacks = [];\n isInit = false;\n isDestroy = false;\n __subscribes = [];\n __allowChanged = [];\n version = 0;\n fct;\n constructor(fct) {\n this.fct = fct;\n if (this.autoInit()) {\n this.init();\n }\n }\n autoInit() {\n return true;\n }\n init() {\n this.isInit = true;\n this.run();\n }\n run() {\n this.version++;\n Watcher._registering.push(this);\n let result = this.fct();\n Watcher._registering.splice(Watcher._registering.length - 1, 1);\n for (let i = 0; i < this.callbacks.length; i++) {\n if (this.callbacks[i].version != this.version) {\n this.callbacks[i].receiver.unsubscribe(this.callbacks[i].cb);\n this.callbacks.splice(i, 1);\n i--;\n }\n }\n return result;\n }\n register(receiver, path, version, fullPath) {\n for (let info of this.callbacks) {\n if (info.receiver == receiver && info.path == path && receiver.__path == info.registerPath) {\n info.version = version;\n info.fullPath = fullPath;\n return;\n }\n }\n let cb;\n if (path == \"*\") {\n cb = (action, changePath, value, dones) => { this.onChange(action, changePath, value, dones); };\n }\n else {\n cb = (action, changePath, value, dones) => {\n if (changePath == path || changePath.startsWith(path + \".\") || changePath.startsWith(path + \"[\")) {\n // if(changePath == path) {\n this.onChange(action, changePath, value, dones);\n }\n };\n }\n this.callbacks.push({\n receiver,\n path,\n registerPath: receiver.__path,\n cb,\n version,\n fullPath\n });\n receiver.subscribe(cb);\n }\n canChange(fct) {\n this.__allowChanged.push(fct);\n }\n checkCanChange(action, changePath, value, dones) {\n if (this.isDestroy) {\n return false;\n }\n for (let fct of this.__allowChanged) {\n if (!fct(action, changePath, value, dones)) {\n return false;\n }\n }\n return true;\n }\n onChange(action, changePath, value, dones) {\n if (!this.checkCanChange(action, changePath, value, dones)) {\n return;\n }\n this.run();\n for (let fct of this.__subscribes) {\n fct(action, changePath, value, dones);\n }\n }\n destroy() {\n this.isDestroy = true;\n this.clearCallbacks();\n this.isInit = false;\n }\n clearCallbacks() {\n for (let pair of this.callbacks) {\n pair.receiver.unsubscribe(pair.cb);\n }\n this.callbacks = [];\n }\n subscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index == -1) {\n this.__subscribes.push(fct);\n }\n }\n unsubscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index > -1) {\n this.__subscribes.splice(index, 1);\n }\n }\n}\nEffect.Namespace=`Aventus`;\n__as1(_, 'Effect', Effect);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"InternalProtected","isStrong":false},{"fullName":"Aventus.EffectReceiver","isStrong":false},{"fullName":"Aventus.WatcherChange","isStrong":false},{"fullName":"Aventus.WatcherAllowed","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}],"fullName":"Aventus.Effect","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Computed=class Computed extends Effect {\n _value;\n __path = \"*\";\n get value() {\n if (!this.isInit) {\n this.init();\n }\n Watcher._register?.register(this, \"*\", Watcher._register.version, \"*\");\n return this._value;\n }\n autoInit() {\n return false;\n }\n constructor(fct) {\n super(fct);\n }\n init() {\n this.isInit = true;\n this.computedValue();\n }\n computedValue() {\n this._value = this.run();\n }\n onChange(action, changePath, value, dones) {\n if (!this.checkCanChange(action, changePath, value, dones)) {\n return;\n }\n let oldValue = this._value;\n this.computedValue();\n if (oldValue === this._value) {\n return;\n }\n for (let fct of this.__subscribes) {\n fct(action, changePath, value, dones);\n }\n }\n}\nComputed.Namespace=`Aventus`;\n__as1(_, 'Computed', Computed);\n","dependencies":[{"fullName":"Aventus.Effect","isStrong":true},{"fullName":"Aventus.EffectReceiver","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.IsNotVoid","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}],"fullName":"Aventus.Computed","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Watcher=class Watcher {\n static isNative(obj) {\n if (obj instanceof Blob ||\n obj instanceof Element ||\n obj instanceof Window)\n return true;\n return false;\n }\n constructor() { }\n ;\n static __reservedName = {\n __path: '__path',\n };\n static __triggerForced = false;\n static _registering = [];\n static get _register() {\n return this._registering[this._registering.length - 1];\n }\n /**\n * Transform object into a watcher\n */\n static get(obj, onDataChanged) {\n if (obj == undefined) {\n console.error(\"You must define an objet / array for your proxy\");\n return;\n }\n if (obj.__isProxy) {\n if (onDataChanged)\n obj.subscribe(onDataChanged);\n return obj;\n }\n const reservedName = this.__reservedName;\n const clearReservedNames = (data) => {\n if (data instanceof Object && !data.__isProxy) {\n for (let key in reservedName) {\n delete data[key];\n }\n for (let key in data) {\n clearReservedNames(data[key]);\n }\n }\n };\n const setProxyPath = (newProxy, newPath) => {\n if (newProxy instanceof Object && newProxy.__isProxy) {\n newProxy.__path = newPath;\n }\n };\n const jsonReplacer = (key, value) => {\n if (reservedName[key])\n return undefined;\n return value;\n };\n const addAlias = (otherBaseData, name, cb) => {\n let cbs = aliases.get(otherBaseData);\n if (!cbs) {\n cbs = [];\n aliases.set(otherBaseData, cbs);\n }\n cbs.push({\n name: name,\n fct: cb\n });\n };\n const deleteAlias = (otherBaseData, name) => {\n let cbs = aliases.get(otherBaseData);\n if (!cbs)\n return;\n for (let i = 0; i < cbs.length; i++) {\n if (cbs[i].name == name) {\n cbs.splice(i, 1);\n if (cbs.length == 0) {\n aliases.delete(otherBaseData);\n }\n return;\n }\n }\n };\n const replaceByAlias = (target, element, prop, receiver, apply, out = {}) => {\n let fullInternalPath = \"\";\n if (Array.isArray(receiver)) {\n if (prop != \"length\") {\n if (target.__path) {\n fullInternalPath = target.__path;\n }\n fullInternalPath += \"[\" + prop + \"]\";\n }\n }\n else {\n if (target.__path) {\n fullInternalPath = target.__path + '.';\n }\n fullInternalPath += prop;\n }\n if (receiver && internalAliases[fullInternalPath]) {\n internalAliases[fullInternalPath].unbind();\n }\n if (element instanceof Object && element.__isProxy) {\n let root = element.__root;\n if (root != proxyData.baseData) {\n element.__validatePath();\n let oldPath = element.__path ?? '';\n let unbindElement = Watcher.extract(getValueFromObject(oldPath, root));\n if (unbindElement === undefined) {\n return element;\n }\n if (receiver == null) {\n receiver = getValueFromObject(target.__path, realProxy);\n if (internalAliases[fullInternalPath]) {\n internalAliases[fullInternalPath].unbind();\n }\n }\n if (apply) {\n let result = this.isNative(target) ? Reflect.set(target, prop, unbindElement) : Reflect.set(target, prop, unbindElement, receiver);\n }\n element.__addAlias(proxyData.baseData, oldPath, (type, target, receiver2, value, prop2, dones) => {\n let triggerPath;\n if (prop2.startsWith(\"[\") || fullInternalPath == \"\" || prop2 == \"\") {\n triggerPath = fullInternalPath + prop2;\n }\n else {\n triggerPath = fullInternalPath + \".\" + prop2;\n }\n if (type == 'DELETED' && internalAliases[triggerPath]) {\n internalAliases[triggerPath].unbind();\n }\n triggerPath = triggerPath.replace(/\\[(.*?)\\]/g, '.$1');\n let splitted = triggerPath.split(\".\");\n let newProp = splitted.pop();\n let newReceiver = getValueFromObject(splitted.join(\".\"), realProxy);\n if (newReceiver.getTarget(false) == target)\n trigger(type, target, newReceiver, value, newProp ?? '', dones);\n });\n internalAliases[fullInternalPath] = {\n unbind: () => {\n delete internalAliases[fullInternalPath];\n element.__deleteAlias(proxyData.baseData, oldPath);\n deleteAlias(root, fullInternalPath);\n }\n };\n addAlias(root, fullInternalPath, (type, target, receiver2, value, prop2, dones) => {\n const pathSave = element.__path;\n let proxy = element.__getProxy;\n let triggerPath;\n if (prop2.startsWith(\"[\") || oldPath == \"\" || prop2 == \"\") {\n triggerPath = oldPath + prop2;\n }\n else {\n triggerPath = oldPath + \".\" + prop2;\n }\n triggerPath = triggerPath.replace(/\\[(.*?)\\]/g, '.$1');\n let splitted = triggerPath.split(\".\");\n let newProp = splitted.pop();\n let newReceiver = getValueFromObject(splitted.join(\".\"), proxy);\n if (newReceiver.getTarget(false) == target)\n element.__trigger(type, target, newReceiver, value, newProp, dones);\n element.__path = pathSave;\n });\n out.otherRoot = root;\n return unbindElement;\n }\n }\n return element;\n };\n let currentTrace = new Error().stack?.split(\"\\n\") ?? [];\n currentTrace.shift();\n currentTrace.shift();\n const aliases = new Map();\n const internalAliases = {};\n let proxyData = {\n baseData: {},\n callbacks: {},\n callbacksReverse: new Map(),\n avoidUpdate: [],\n pathToRemove: [],\n injectedDones: null,\n history: [{\n object: JSON.parse(JSON.stringify(obj, jsonReplacer)),\n trace: currentTrace,\n action: 'init',\n path: ''\n }],\n useHistory: false,\n getProxyObject(target, element, prop) {\n let newProxy;\n element = replaceByAlias(target, element, prop, null, true);\n if (element instanceof Object && element.__isProxy) {\n newProxy = element;\n }\n else {\n try {\n if (element instanceof Computed) {\n return element;\n }\n if (element instanceof HTMLElement) {\n return element;\n }\n if (element instanceof Object) {\n newProxy = new Proxy(element, this);\n }\n else {\n return element;\n }\n }\n catch {\n return element;\n }\n }\n let newPath = '';\n if (Array.isArray(target)) {\n if (/^[0-9]*$/g.exec(prop)) {\n if (target.__path) {\n newPath = target.__path;\n }\n newPath += \"[\" + prop + \"]\";\n setProxyPath(newProxy, newPath);\n }\n else {\n newPath += \".\" + prop;\n setProxyPath(newProxy, newPath);\n }\n }\n else if (element instanceof Date) {\n return element;\n }\n else {\n if (target.__path) {\n newPath = target.__path + '.';\n }\n newPath += prop;\n setProxyPath(newProxy, newPath);\n }\n return newProxy;\n },\n tryCustomFunction(target, prop, receiver) {\n if (prop == \"__isProxy\") {\n return true;\n }\n else if (prop == \"__getProxy\") {\n return realProxy;\n }\n else if (prop == \"__root\") {\n return this.baseData;\n }\n else if (prop == \"__validatePath\") {\n return () => {\n if (this.baseData == target) {\n target.__path = \"\";\n }\n };\n }\n else if (prop == \"__callbacks\") {\n return this.callbacks;\n }\n else if (prop == \"subscribe\") {\n let path = receiver.__path;\n return (cb) => {\n if (!this.callbacks[path]) {\n this.callbacks[path] = [];\n }\n this.callbacks[path].push(cb);\n this.callbacksReverse.set(cb, path);\n };\n }\n else if (prop == \"unsubscribe\") {\n return (cb) => {\n let oldPath = this.callbacksReverse.get(cb);\n if (oldPath === undefined)\n return;\n if (!this.callbacks[oldPath]) {\n return;\n }\n let index = this.callbacks[oldPath].indexOf(cb);\n if (index > -1) {\n this.callbacks[oldPath].splice(index, 1);\n }\n this.callbacksReverse.delete(cb);\n };\n }\n else if (prop == \"getHistory\") {\n return () => {\n return this.history;\n };\n }\n else if (prop == \"clearHistory\") {\n this.history = [];\n }\n else if (prop == \"enableHistory\") {\n return () => {\n this.useHistory = true;\n };\n }\n else if (prop == \"disableHistory\") {\n return () => {\n this.useHistory = false;\n };\n }\n else if (prop == \"getTarget\") {\n return (clear = true) => {\n if (clear)\n clearReservedNames(target);\n return target;\n };\n }\n else if (prop == \"toJSON\") {\n if (target.toJSON) {\n return target.toJSON;\n }\n if (Array.isArray(receiver)) {\n return () => {\n let result = [];\n for (let element of target) {\n result.push(element);\n }\n return result;\n };\n }\n return () => {\n let result = {};\n for (let key of Object.keys(target)) {\n if (reservedName[key]) {\n continue;\n }\n result[key] = target[key];\n }\n return result;\n };\n }\n else if (prop == \"__addAlias\") {\n return addAlias;\n }\n else if (prop == \"__deleteAlias\") {\n return deleteAlias;\n }\n else if (prop == \"__injectedDones\") {\n return (dones) => {\n this.injectedDones = dones;\n };\n }\n else if (prop == \"__trigger\") {\n return trigger;\n }\n else if (prop == \"__static_trigger\") {\n return (type) => {\n Watcher.__triggerForced = true;\n trigger(type, target, receiver, target, '');\n Watcher.__triggerForced = false;\n };\n }\n return undefined;\n },\n get(target, prop, receiver) {\n if (typeof prop == 'symbol') {\n return Watcher.isNative(target) ? Reflect.get(target, prop) : Reflect.get(target, prop, receiver);\n }\n if (reservedName[prop]) {\n return target[prop];\n }\n let customResult = this.tryCustomFunction(target, prop, receiver);\n if (customResult !== undefined) {\n return customResult;\n }\n let element = target[prop];\n if (typeof (element) == 'function') {\n if (Array.isArray(receiver)) {\n let result;\n if (prop == 'push') {\n if (target.__isProxy) {\n result = (el) => {\n let index = target.push(el);\n return index;\n };\n }\n else {\n result = (el) => {\n let index = target.length;\n let out = {};\n el = replaceByAlias(target, el, target.length + '', receiver, false, out);\n target.push(el);\n const dones = [];\n const dones2 = [];\n if (out.otherRoot) {\n dones.push(out.otherRoot);\n dones2.push(out.otherRoot);\n }\n trigger('CREATED', target, receiver, receiver[index], \"[\" + (index) + \"]\", dones);\n trigger('UPDATED', target, receiver, target.length, \"length\", dones2);\n return index;\n };\n }\n }\n else if (prop == 'splice') {\n if (target.__isProxy) {\n result = (index, nbRemove, ...insert) => {\n let res = target.splice(index, nbRemove, ...insert);\n return res;\n };\n }\n else {\n result = (index, nbRemove, ...insert) => {\n let oldValues = [];\n const extReceiver = Watcher.extract(receiver);\n for (let i = index; i < index + nbRemove; i++) {\n oldValues.push(extReceiver[i]);\n }\n let updateLength = nbRemove != insert.length;\n for (let i = 0; i < oldValues.length; i++) {\n target.splice((index + i), 1);\n trigger('DELETED', target, receiver, oldValues[i], \"[\" + index + \"]\");\n }\n for (let i = 0; i < insert.length; i++) {\n const out = {};\n let value = replaceByAlias(target, insert[i], (index + i) + '', receiver, false, out);\n const dones = out.otherRoot ? [out.otherRoot] : [];\n target.splice((index + i), 0, value);\n trigger('CREATED', target, receiver, receiver[(index + i)], \"[\" + (index + i) + \"]\", dones);\n }\n if (updateLength)\n trigger('UPDATED', target, receiver, target.length, \"length\");\n return target;\n };\n }\n }\n else if (prop == 'pop') {\n if (target.__isProxy) {\n result = () => {\n let res = target.pop();\n return res;\n };\n }\n else {\n result = () => {\n let index = target.length - 1;\n let oldValue = receiver.length ? receiver[receiver.length] : undefined;\n let res = target.pop();\n trigger('DELETED', target, receiver, oldValue, \"[\" + index + \"]\");\n trigger('UPDATED', target, receiver, target.length, \"length\");\n return res;\n };\n }\n }\n // else if(prop == 'find') {\n else {\n result = element.bind(target);\n }\n return result;\n }\n else if (target instanceof Map) {\n let result;\n if (prop == \"set\") {\n if (target.__isProxy) {\n result = (key, value) => {\n return target.set(key, value);\n };\n }\n else {\n result = (key, value) => {\n const out = {};\n let dones = [];\n let dones2 = [];\n key = Watcher.extract(key);\n value = replaceByAlias(target, value, key + '', receiver, false, out);\n if (out.otherRoot) {\n dones.push(out.otherRoot);\n dones2.push(out.otherRoot);\n }\n let result = target.set(key, value);\n trigger('CREATED', target, receiver, receiver.get(key), key + '', dones);\n trigger('UPDATED', target, receiver, target.size, \"size\", dones2);\n return result;\n };\n }\n }\n else if (prop == \"clear\") {\n if (target.__isProxy) {\n result = () => {\n return target.clear();\n };\n }\n else {\n result = () => {\n let keys = target.keys();\n for (let key of keys) {\n let oldValue = receiver.get(key);\n target.delete(key);\n trigger('DELETED', target, receiver, oldValue, key);\n trigger('UPDATED', target, receiver, target.size, \"size\");\n }\n };\n }\n }\n else if (prop == \"delete\") {\n if (target.__isProxy) {\n result = (key) => {\n return target.delete(key);\n };\n }\n else {\n result = (key) => {\n key = Watcher.extract(key);\n let oldValue = receiver.get(key);\n let res = target.delete(key);\n trigger('DELETED', target, receiver, oldValue, key + '');\n trigger('UPDATED', target, receiver, target.size, \"size\");\n return res;\n };\n }\n }\n else {\n result = element.bind(target);\n }\n return result;\n }\n return element.bind(target);\n }\n if (element instanceof Computed) {\n return element.value;\n }\n if (Watcher._registering.length > 0) {\n let currentPath;\n let fullPath;\n let isArray = Array.isArray(receiver);\n if (isArray && /^[0-9]*$/g.exec(prop)) {\n fullPath = receiver.__path + \"[\" + prop + \"]\";\n currentPath = \"[\" + prop + \"]\";\n }\n else {\n fullPath = receiver.__path ? receiver.__path + '.' + prop : prop;\n currentPath = prop;\n }\n Watcher._register?.register(receiver, currentPath, Watcher._register.version, fullPath);\n }\n if (typeof (element) == 'object') {\n return this.getProxyObject(target, element, prop);\n }\n return Watcher.isNative(target) ? Reflect.get(target, prop) : Reflect.get(target, prop, receiver);\n },\n set(target, prop, value, receiver) {\n if (typeof prop == 'symbol') {\n if (Watcher.isNative(target))\n return Reflect.set(target, prop, value);\n return Reflect.set(target, prop, value, receiver);\n }\n let oldValue = Watcher.isNative(target) ? Reflect.get(target, prop) : Reflect.get(target, prop, receiver);\n value = replaceByAlias(target, value, prop, receiver, true);\n if (value instanceof Signal) {\n value = value.value;\n }\n let triggerChange = false;\n if (!reservedName[prop]) {\n if (Array.isArray(receiver)) {\n if (prop != \"length\") {\n triggerChange = true;\n }\n }\n else {\n if (!compareObject(value, oldValue)) {\n triggerChange = true;\n }\n }\n if (Watcher.__triggerForced) {\n triggerChange = true;\n }\n }\n let result = Watcher.isNative(target) ? Reflect.set(target, prop, value) : Reflect.set(target, prop, value, receiver);\n if (triggerChange) {\n let index = this.avoidUpdate.indexOf(prop);\n if (index == -1) {\n let dones = this.injectedDones ?? [];\n this.injectedDones = null;\n trigger('UPDATED', target, receiver, value, prop, dones);\n }\n else {\n this.avoidUpdate.splice(index, 1);\n }\n }\n return result;\n },\n deleteProperty(target, prop) {\n if (typeof prop == 'symbol') {\n return Reflect.deleteProperty(target, prop);\n }\n let triggerChange = false;\n let pathToDelete = '';\n if (!reservedName[prop]) {\n if (Array.isArray(target)) {\n if (prop != \"length\") {\n if (target.__path) {\n pathToDelete = target.__path;\n }\n pathToDelete += \"[\" + prop + \"]\";\n triggerChange = true;\n }\n }\n else {\n if (target.__path) {\n pathToDelete = target.__path + '.';\n }\n pathToDelete += prop;\n triggerChange = true;\n }\n }\n if (internalAliases[pathToDelete]) {\n internalAliases[pathToDelete].unbind();\n }\n if (target.hasOwnProperty(prop)) {\n let oldValue = target[prop];\n if (oldValue instanceof Effect || oldValue instanceof Signal) {\n oldValue.destroy();\n }\n delete target[prop];\n if (triggerChange) {\n clearReservedNames(oldValue);\n trigger('DELETED', target, null, oldValue, prop);\n }\n return true;\n }\n return false;\n },\n defineProperty(target, prop, descriptor) {\n if (typeof prop == 'symbol') {\n return Reflect.defineProperty(target, prop, descriptor);\n }\n let triggerChange = false;\n let newPath = '';\n if (!reservedName[prop]) {\n if (Array.isArray(target)) {\n if (prop != \"length\") {\n if (target.__path) {\n newPath = target.__path;\n }\n newPath += \"[\" + prop + \"]\";\n if (!target.hasOwnProperty(prop)) {\n triggerChange = true;\n }\n }\n }\n else {\n if (target.__path) {\n newPath = target.__path + '.';\n }\n newPath += prop;\n if (!target.hasOwnProperty(prop)) {\n triggerChange = true;\n }\n }\n }\n let result = Reflect.defineProperty(target, prop, descriptor);\n if (triggerChange) {\n this.avoidUpdate.push(prop);\n let proxyEl = this.getProxyObject(target, descriptor.value, prop);\n target[prop] = proxyEl;\n trigger('CREATED', target, null, proxyEl, prop);\n }\n return result;\n },\n ownKeys(target) {\n let result = Reflect.ownKeys(target);\n for (let i = 0; i < result.length; i++) {\n let key = result[i];\n if (typeof key == 'string') {\n if (reservedName[key]) {\n result.splice(i, 1);\n i--;\n }\n }\n }\n return result;\n },\n };\n if (onDataChanged) {\n proxyData.callbacks[''] = [onDataChanged];\n }\n const trigger = (type, target, receiver, value, prop, dones = []) => {\n if (dones.includes(proxyData.baseData)) {\n return;\n }\n if (target.__isProxy) {\n return;\n }\n let rootPath;\n if (receiver == null) {\n rootPath = target.__path;\n }\n else {\n rootPath = receiver.__path;\n }\n if (rootPath != \"\") {\n if (Array.isArray(receiver)) {\n if (prop && !prop.startsWith(\"[\")) {\n if (/^[0-9]*$/g.exec(prop)) {\n rootPath += \"[\" + prop + \"]\";\n }\n else {\n rootPath += \".\" + prop;\n }\n }\n else {\n rootPath += prop;\n }\n }\n else {\n if (prop && !prop.startsWith(\"[\")) {\n rootPath += \".\";\n }\n rootPath += prop;\n }\n }\n else {\n rootPath = prop;\n }\n let stacks = [];\n if (proxyData.useHistory) {\n let allStacks = new Error().stack?.split(\"\\n\") ?? [];\n for (let i = allStacks.length - 1; i >= 0; i--) {\n let current = allStacks[i].trim().replace(\"at \", \"\");\n if (current.startsWith(\"Object.set\") || current.startsWith(\"Proxy.result\")) {\n break;\n }\n stacks.push(current);\n }\n }\n dones.push(proxyData.baseData);\n let aliasesDone = [];\n const callbacks = { ...proxyData.callbacks };\n for (let name in callbacks) {\n callbacks[name] = [...callbacks[name]];\n }\n for (let name in callbacks) {\n // for(let name in proxyData.callbacks) {\n let pathToSend = rootPath;\n if (name !== \"\") {\n let regex = new RegExp(\"^\" + name.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&') + \"(\\\\.|(\\\\[)|$)\");\n if (!regex.test(rootPath)) {\n let regex2 = new RegExp(\"^\" + rootPath.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&') + \"(\\\\.|(\\\\[)|$)\");\n if (!regex2.test(name)) {\n continue;\n }\n else {\n pathToSend = \"\";\n }\n }\n else {\n pathToSend = rootPath.replace(regex, \"$2\");\n }\n }\n if (name === \"\" && proxyData.useHistory) {\n proxyData.history.push({\n object: JSON.parse(JSON.stringify(proxyData.baseData, jsonReplacer)),\n trace: stacks.reverse(),\n action: WatchAction[type],\n path: pathToSend\n });\n }\n let cbs = callbacks[name];\n for (let cb of cbs) {\n try {\n cb(WatchAction[type], pathToSend, value, dones);\n }\n catch (e) {\n if (e != 'impossible')\n console.error(e);\n }\n }\n for (let [key, infos] of aliases) {\n if (!dones.includes(key)) {\n for (let info of infos) {\n if (info.name == name) {\n aliasesDone.push(key);\n if (target.__path) {\n let oldPath = target.__path;\n info.fct(type, target, receiver, value, prop, dones);\n target.__path = oldPath;\n }\n else {\n info.fct(type, target, receiver, value, prop, dones);\n }\n }\n }\n }\n }\n }\n for (let [key, infos] of aliases) {\n if (!dones.includes(key) && !aliasesDone.includes(key)) {\n for (let info of infos) {\n let regex = new RegExp(\"^\" + info.name.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '\\\\$&') + \"(\\\\.|(\\\\[)|$)\");\n if (!regex.test(rootPath)) {\n continue;\n }\n let newProp = rootPath.replace(info.name, \"\");\n if (newProp.startsWith(\".\")) {\n newProp = newProp.slice(1);\n }\n if (target.__path) {\n let oldPath = target.__path;\n info.fct(type, target, receiver, value, newProp, dones);\n target.__path = oldPath;\n }\n else {\n info.fct(type, target, receiver, value, newProp, dones);\n }\n }\n }\n }\n };\n var realProxy = new Proxy(obj, proxyData);\n proxyData.baseData = obj;\n setProxyPath(realProxy, '');\n return realProxy;\n }\n static is(obj) {\n return typeof obj == 'object' && obj.__isProxy;\n }\n static extract(obj, clearPath = false) {\n if (this.is(obj)) {\n return obj.getTarget(clearPath);\n }\n else {\n if (obj instanceof Object) {\n for (let key in this.__reservedName) {\n delete obj[key];\n }\n }\n }\n return obj;\n }\n static trigger(type, target) {\n if (this.is(target)) {\n target.__static_trigger(type);\n }\n }\n /**\n * Create a computed variable that will watch any changes\n */\n static computed(fct) {\n const comp = new Computed(fct);\n return comp;\n }\n /**\n * Create an effect variable that will watch any changes\n */\n static effect(fct) {\n const comp = new Effect(fct);\n return comp;\n }\n /**\n * Create an effect variable that will watch any changes inside the fct and trigger the cb on change\n */\n static watch(fct, cb) {\n const comp = new Effect(fct);\n comp.subscribe(cb);\n return comp;\n }\n /**\n * Create a signal variable\n */\n static signal(item, onChange) {\n return new Signal(item, onChange);\n }\n}\nWatcher.Namespace=`Aventus`;\n__as1(_, 'Watcher', Watcher);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Internal","isStrong":true},{"fullName":"Aventus.Effect","isStrong":true},{"fullName":"Aventus.WatcherFunction","isStrong":false},{"fullName":"Aventus.getValueFromObject","isStrong":false},{"fullName":"Aventus.WatcherFunctionInternal","isStrong":false},{"fullName":"ProxyData","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false},{"fullName":"Aventus.Signal","isStrong":false},{"fullName":"Aventus.compareObject","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.IsNotVoid","isStrong":false}],"fullName":"Aventus.Watcher","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ComputedNoRecomputed=class ComputedNoRecomputed extends Computed {\n init() {\n this.isInit = true;\n Watcher._registering.push(this);\n this._value = this.fct();\n Watcher._registering.splice(Watcher._registering.length - 1, 1);\n }\n computedValue() {\n if (this.isInit)\n this._value = this.fct();\n else\n this.init();\n }\n run() { }\n}\nComputedNoRecomputed.Namespace=`Aventus`;\n__as1(_, 'ComputedNoRecomputed', ComputedNoRecomputed);\n","dependencies":[{"fullName":"Aventus.Computed","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false}],"fullName":"Aventus.ComputedNoRecomputed","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let EffectNoRecomputed=class EffectNoRecomputed extends Effect {\n init() {\n this.isInit = true;\n Watcher._registering.push(this);\n this.fct();\n Watcher._registering.splice(Watcher._registering.length - 1, 1);\n }\n run() {\n if (!this.isInit) {\n this.init();\n }\n }\n}\nEffectNoRecomputed.Namespace=`Aventus`;\n__as1(_, 'EffectNoRecomputed', EffectNoRecomputed);\n","dependencies":[{"fullName":"Aventus.Effect","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false}],"fullName":"Aventus.EffectNoRecomputed","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let HttpRouter=class HttpRouter {\n static options;\n static configure(options) {\n this.options = options;\n }\n options;\n constructor() {\n this.options = this.defineOptions(this.defaultOptionsValue());\n }\n defaultOptionsValue() {\n return HttpRouter.options ?? {\n url: location.protocol + \"//\" + location.host\n };\n }\n defineOptions(options) {\n return options;\n }\n async get(url) {\n return await new HttpRequest(url).queryJSON(this);\n }\n async post(url, data) {\n return await new HttpRequest(url, HttpMethod.POST, data).queryJSON(this);\n }\n async put(url, data) {\n return await new HttpRequest(url, HttpMethod.PUT, data).queryJSON(this);\n }\n async delete(url, data) {\n return await new HttpRequest(url, HttpMethod.DELETE, data).queryJSON(this);\n }\n async option(url, data) {\n return await new HttpRequest(url, HttpMethod.OPTION, data).queryJSON(this);\n }\n}\nHttpRouter.Namespace=`Aventus`;\n__as1(_, 'HttpRouter', HttpRouter);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRouterOptions","isStrong":true},{"fullName":"InternalProtected","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.HttpMethod","isStrong":false},{"fullName":"Aventus.HttpRequest","isStrong":false}],"fullName":"Aventus.HttpRouter","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let HttpRoute=class HttpRoute {\n router;\n constructor(router) {\n this.router = router ?? new HttpRouter();\n }\n getPrefix() {\n return \"\";\n }\n}\nHttpRoute.Namespace=`Aventus`;\n__as1(_, 'HttpRoute', HttpRoute);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRouter","isStrong":false}],"fullName":"Aventus.HttpRoute","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let HttpRequest=class HttpRequest {\n static options;\n static configure(options) {\n this.options = options;\n }\n request;\n url;\n methodSpoofing = false;\n useCache = false;\n constructor(url, method = HttpMethod.GET, body, methodSpoofing = false, useCache = false) {\n this.url = url;\n this.request = {};\n this.methodSpoofing = methodSpoofing;\n this.useCache = useCache;\n this.setMethod(method);\n this.prepareBody(body);\n }\n setUrl(url) {\n this.url = url;\n }\n toString() {\n return this.url + \" : \" + JSON.stringify(this.request);\n }\n setBody(body) {\n this.prepareBody(body);\n }\n setMethod(method) {\n this.request.method = method;\n }\n /**\n * Replace method Put/Delete by _method:\"put\" inside a form\n */\n enableMethodSpoofing() {\n this.methodSpoofing = true;\n }\n enableCache() {\n this.useCache = true;\n }\n disableCache() {\n this.useCache = false;\n }\n objectToFormData(obj, formData, parentKey) {\n formData = formData || new FormData();\n let byPass = obj;\n if (byPass.__isProxy) {\n obj = byPass.getTarget();\n }\n const keys = obj.toJSON ? Object.keys(obj.toJSON()) : Object.keys(obj);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n let value = obj[key];\n const newKey = parentKey ? `${parentKey}[${key}]` : key;\n if (value instanceof Date) {\n formData.append(newKey, DateConverter.converter.toString(value));\n }\n else if (typeof value === 'object' &&\n value !== null &&\n !(value instanceof File)) {\n if (Array.isArray(value)) {\n for (let j = 0; j < value.length; j++) {\n const arrayKey = `${newKey}[${j}]`;\n this.objectToFormData({ [arrayKey]: value[j] }, formData);\n }\n }\n else {\n this.objectToFormData(value, formData, newKey);\n }\n }\n else {\n if (value === undefined || value === null) {\n value = \"\";\n }\n else if (Watcher.is(value)) {\n value = Watcher.extract(value);\n }\n formData.append(newKey, value);\n }\n }\n return formData;\n }\n jsonReplacer(key, value) {\n const t = this;\n if (t[key] instanceof Date) {\n return DateConverter.converter.toString(t[key]);\n }\n return value;\n }\n prepareBody(data) {\n if (!data) {\n return;\n }\n else if (data instanceof FormData) {\n this.request.body = data;\n }\n else {\n let useFormData = false;\n const analyseFormData = (obj) => {\n for (let key in obj) {\n if (obj[key] instanceof File) {\n useFormData = true;\n break;\n }\n else if (Array.isArray(obj[key]) && obj[key].length > 0 && obj[key][0] instanceof File) {\n useFormData = true;\n break;\n }\n else if (typeof obj[key] == 'object' && !Array.isArray(obj[key]) && !(obj[key] instanceof Date)) {\n analyseFormData(obj[key]);\n if (useFormData) {\n break;\n }\n }\n }\n };\n analyseFormData(data);\n if (useFormData) {\n this.request.body = this.objectToFormData(data);\n }\n else {\n this.request.body = JSON.stringify(data, this.jsonReplacer);\n this.setHeader(\"Content-Type\", \"Application/json\");\n }\n }\n if (this.methodSpoofing) {\n if (this.request.method?.toUpperCase() == Aventus.HttpMethod.PUT) {\n if (this.request.body instanceof FormData) {\n this.request.body.append(\"_method\", Aventus.HttpMethod.PUT);\n this.request.method = Aventus.HttpMethod.POST;\n }\n }\n else if (this.request.method?.toUpperCase() == Aventus.HttpMethod.DELETE) {\n if (this.request.body instanceof FormData) {\n this.request.body.append(\"_method\", Aventus.HttpMethod.DELETE);\n this.request.method = Aventus.HttpMethod.POST;\n }\n }\n }\n }\n setHeader(name, value) {\n if (!this.request.headers) {\n this.request.headers = [];\n }\n this.request.headers.push([name, value]);\n }\n setCredentials(credentials) {\n this.request.credentials = credentials;\n }\n async _query(router) {\n let result = new ResultWithError();\n try {\n const isFull = this.url.match(\"https?://\");\n if (!this.url.startsWith(\"/\") && !isFull) {\n this.url = \"/\" + this.url;\n }\n if (HttpRequest.options?.beforeSend) {\n const beforeSendResult = await HttpRequest.options.beforeSend(this);\n result.errors = beforeSendResult.errors;\n }\n const fullUrl = isFull ? this.url : router ? router.options.url + this.url : this.url;\n if (this.useCache) {\n result.result = await HttpCache.fetch(fullUrl, this.request);\n }\n else {\n let response = await fetch(fullUrl, this.request);\n result.result = new HttpResponse(response);\n }\n }\n catch (e) {\n result.errors.push(new HttpError(HttpErrorCode.unknow, e));\n }\n return result;\n }\n async query(router) {\n let result = await this._query(router);\n if (HttpRequest.options?.responseMiddleware) {\n result = await HttpRequest.options.responseMiddleware(result, this);\n }\n return result;\n }\n async queryVoid(router) {\n let resultTemp = await this.query(router);\n let result = new VoidWithError();\n if (!resultTemp.success) {\n result.errors = resultTemp.errors;\n return result;\n }\n try {\n if (!resultTemp.result) {\n return result;\n }\n if (resultTemp.result.status != 204) {\n let tempResult = await resultTemp.result.json();\n if (tempResult instanceof VoidWithError) {\n for (let error of tempResult.errors) {\n result.errors.push(error);\n }\n }\n }\n }\n catch (e) {\n }\n return result;\n }\n async queryJSON(router) {\n this.setHeader(\"Accept\", \"application/json\");\n let resultTemp = await this.query(router);\n let result = new ResultWithError();\n if (!resultTemp.success) {\n result.errors = resultTemp.errors;\n return result;\n }\n try {\n if (!resultTemp.result) {\n return result;\n }\n let tempResult = await resultTemp.result.json();\n if (tempResult instanceof VoidWithError) {\n for (let error of tempResult.errors) {\n result.errors.push(error);\n }\n if (tempResult instanceof ResultWithError) {\n result.result = tempResult.result;\n }\n }\n else {\n result.result = tempResult;\n }\n }\n catch (e) {\n result.errors.push(new HttpError(HttpErrorCode.unknow, e));\n }\n return result;\n }\n async queryTxt(router) {\n this.setHeader(\"Accept\", \"text/plain\");\n let resultTemp = await this.query(router);\n let result = new ResultWithError();\n if (!resultTemp.success) {\n result.errors = resultTemp.errors;\n return result;\n }\n try {\n if (!resultTemp.result) {\n return result;\n }\n result.result = await resultTemp.result.text();\n }\n catch (e) {\n result.errors.push(new HttpError(HttpErrorCode.unknow, e));\n }\n return result;\n }\n async queryBlob(router) {\n this.setHeader(\"Accept\", \"application/octet-stream\");\n let resultTemp = await this.query(router);\n let result = new ResultWithError();\n if (!resultTemp.success) {\n result.errors = resultTemp.errors;\n return result;\n }\n try {\n if (!resultTemp.result) {\n return result;\n }\n result.result = await resultTemp.result.blob();\n }\n catch (e) {\n result.errors.push(new HttpError(HttpErrorCode.unknow, e));\n }\n return result;\n }\n clearCache(router) {\n const isFull = this.url.match(\"https?://\");\n if (!this.url.startsWith(\"/\") && !isFull) {\n this.url = \"/\" + this.url;\n }\n const fullUrl = isFull ? this.url : router ? router.options.url + this.url : this.url;\n HttpCache.clear(fullUrl, this.request);\n }\n}\nHttpRequest.Namespace=`Aventus`;\n__as1(_, 'HttpRequest', HttpRequest);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRequestOptions","isStrong":true},{"fullName":"Aventus.HttpMethod","isStrong":false},{"fullName":"Aventus.DateConverter","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.HttpRouter","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.HttpResponse","isStrong":false},{"fullName":"Aventus.HttpCache","isStrong":false},{"fullName":"Aventus.HttpError","isStrong":false},{"fullName":"Aventus.HttpErrorCode","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false},{"fullName":"T","isStrong":false}],"fullName":"Aventus.HttpRequest","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let StorableRoute=class StorableRoute extends HttpRoute {\n async GetAll() {\n const request = new HttpRequest(`/${this.StorableName()}`, HttpMethod.GET);\n return await request.queryJSON(this.router);\n }\n async Create(body) {\n const request = new HttpRequest(`/${this.StorableName()}`, HttpMethod.POST);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async GetById(id) {\n const request = new HttpRequest(`/${this.StorableName()}/${id}`, HttpMethod.GET);\n return await request.queryJSON(this.router);\n }\n async Update(id, body) {\n const request = new HttpRequest(`/${this.StorableName()}/${id}`, HttpMethod.PUT);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async Delete(id) {\n const request = new HttpRequest(`/${this.StorableName()}/${id}`, HttpMethod.DELETE);\n return await request.queryJSON(this.router);\n }\n}\nStorableRoute.Namespace=`Aventus`;\n__as1(_, 'StorableRoute', StorableRoute);\n","dependencies":[{"fullName":"Aventus.HttpRoute","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.IData","isStrong":false},{"fullName":"Aventus.HttpRequest","isStrong":false},{"fullName":"Aventus.HttpMethod","isStrong":false},{"fullName":"TypeResult","isStrong":false}],"fullName":"Aventus.StorableRoute","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Animation=class Animation {\n /**\n * Default FPS for all Animation if not set inside options\n */\n static FPS_DEFAULT = 60;\n options;\n nextFrame = 0;\n fpsInterval;\n continueAnimation = false;\n frame_id = 0;\n constructor(options) {\n if (!options.animate) {\n options.animate = () => { };\n }\n if (!options.stopped) {\n options.stopped = () => { };\n }\n if (!options.fps) {\n options.fps = Animation.FPS_DEFAULT;\n }\n this.options = options;\n this.fpsInterval = 1000 / options.fps;\n }\n animate() {\n let now = window.performance.now();\n let elapsed = now - this.nextFrame;\n if (elapsed <= this.fpsInterval) {\n this.frame_id = requestAnimationFrame(() => this.animate());\n return;\n }\n this.nextFrame = now - (elapsed % this.fpsInterval);\n setTimeout(() => {\n this.options.animate();\n }, 0);\n if (this.continueAnimation) {\n this.frame_id = requestAnimationFrame(() => this.animate());\n }\n else {\n this.options.stopped();\n }\n }\n /**\n * Start the of animation\n */\n start() {\n if (this.continueAnimation == false) {\n this.continueAnimation = true;\n this.nextFrame = window.performance.now();\n this.animate();\n }\n }\n /**\n * Stop the animation\n */\n stop() {\n this.continueAnimation = false;\n }\n /**\n * Stop the animation\n */\n immediateStop() {\n cancelAnimationFrame(this.frame_id);\n this.continueAnimation = false;\n this.options.stopped();\n }\n /**\n * Get the FPS\n */\n getFPS() {\n return this.options.fps;\n }\n /**\n * Set the FPS\n */\n setFPS(fps) {\n this.options.fps = fps;\n this.fpsInterval = 1000 / this.options.fps;\n }\n /**\n * Get the animation status (true if animation is running)\n */\n isStarted() {\n return this.continueAnimation;\n }\n}\nAnimation.Namespace=`Aventus`;\n__as1(_, 'Animation', Animation);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.AnimationOptionsInternal","isStrong":false},{"fullName":"Aventus.AnimationOptions","isStrong":false}],"fullName":"Aventus.Animation","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let PressManager=class PressManager {\n static globalConfig = {\n delayDblPress: 250,\n delayLongPress: 700,\n offsetDrag: 20\n };\n static configure(options) {\n this.globalConfig = options;\n }\n static create(options) {\n if (Array.isArray(options.element)) {\n let result = [];\n for (let el of options.element) {\n let cloneOpt = { ...options };\n cloneOpt.element = el;\n result.push(new PressManager(cloneOpt));\n }\n return result;\n }\n else {\n return new PressManager(options);\n }\n }\n static onEvent = new Callback();\n options;\n element;\n delayDblPress;\n delayLongPress;\n nbPress = 0;\n offsetDrag;\n dragDirection;\n state = {\n oneActionTriggered: null,\n };\n startPosition = { x: 0, y: 0 };\n customFcts = {};\n timeoutDblPress = 0;\n timeoutLongPress = 0;\n downEventSaved;\n useDblPress = false;\n stopPropagation = () => true;\n pointersRecord = {};\n functionsBinded = {\n downAction: (e) => { },\n downActionDelay: (e) => { },\n upAction: (e) => { },\n moveAction: (e) => { },\n childPressStart: (e) => { },\n childPressEnd: (e) => { },\n childPressMove: (e) => { }\n };\n /**\n * @param {*} options - The options\n * @param {HTMLElement | HTMLElement[]} options.element - The element to manage\n */\n constructor(options) {\n if (options.element === void 0) {\n throw 'You must provide an element';\n }\n this.offsetDrag = PressManager.globalConfig.offsetDrag !== undefined ? PressManager.globalConfig.offsetDrag : 20;\n this.dragDirection = 'XY';\n this.delayLongPress = PressManager.globalConfig.delayLongPress ?? 700;\n this.delayDblPress = PressManager.globalConfig.delayDblPress ?? 150;\n this.element = options.element;\n this.checkDragConstraint(options);\n this.assignValueOption(options);\n this.options = options;\n this.init();\n }\n /**\n * Get the current element focused by the PressManager\n */\n getElement() {\n return this.element;\n }\n checkDragConstraint(options) {\n if (options.onDrag !== void 0) {\n if (options.onDragStart === void 0) {\n options.onDragStart = (e) => { };\n }\n if (options.onDragEnd === void 0) {\n options.onDragEnd = (e) => { };\n }\n }\n if (options.onDragStart !== void 0) {\n if (options.onDrag === void 0) {\n options.onDrag = (e) => { };\n }\n if (options.onDragEnd === void 0) {\n options.onDragEnd = (e) => { };\n }\n }\n if (options.onDragEnd !== void 0) {\n if (options.onDragStart === void 0) {\n options.onDragStart = (e) => { };\n }\n if (options.onDrag === void 0) {\n options.onDrag = (e) => { };\n }\n }\n }\n assignValueOption(options) {\n if (PressManager.globalConfig.delayDblPress !== undefined) {\n this.delayDblPress = PressManager.globalConfig.delayDblPress;\n }\n if (options.delayDblPress !== undefined) {\n this.delayDblPress = options.delayDblPress;\n }\n if (PressManager.globalConfig.delayLongPress !== undefined) {\n this.delayLongPress = PressManager.globalConfig.delayLongPress;\n }\n if (options.delayLongPress !== undefined) {\n this.delayLongPress = options.delayLongPress;\n }\n if (PressManager.globalConfig.offsetDrag !== undefined) {\n this.offsetDrag = PressManager.globalConfig.offsetDrag;\n }\n if (options.offsetDrag !== undefined) {\n this.offsetDrag = options.offsetDrag;\n }\n if (options.dragDirection !== undefined) {\n this.dragDirection = options.dragDirection;\n }\n if (options.onDblPress !== undefined) {\n this.useDblPress = true;\n }\n if (PressManager.globalConfig.forceDblPress !== undefined) {\n this.useDblPress = PressManager.globalConfig.forceDblPress;\n }\n if (options.forceDblPress !== undefined) {\n this.useDblPress = options.forceDblPress;\n }\n if (typeof PressManager.globalConfig.stopPropagation == 'function') {\n this.stopPropagation = PressManager.globalConfig.stopPropagation;\n }\n else if (options.stopPropagation === false) {\n this.stopPropagation = () => false;\n }\n if (typeof options.stopPropagation == 'function') {\n this.stopPropagation = options.stopPropagation;\n }\n else if (options.stopPropagation === false) {\n this.stopPropagation = () => false;\n }\n if (!options.buttonAllowed)\n options.buttonAllowed = PressManager.globalConfig.buttonAllowed;\n if (!options.buttonAllowed)\n options.buttonAllowed = [0];\n if (!options.onEvent)\n options.onEvent = PressManager.globalConfig.onEvent;\n }\n bindAllFunction() {\n this.functionsBinded.downAction = this.downAction.bind(this);\n this.functionsBinded.downActionDelay = this.downActionDelay.bind(this);\n this.functionsBinded.moveAction = this.moveAction.bind(this);\n this.functionsBinded.upAction = this.upAction.bind(this);\n this.functionsBinded.childPressStart = this.childPressStart.bind(this);\n this.functionsBinded.childPressEnd = this.childPressEnd.bind(this);\n this.functionsBinded.childPressMove = this.childPressMove.bind(this);\n }\n init() {\n this.bindAllFunction();\n this.element.addEventListener(\"pointerdown\", this.functionsBinded.downAction);\n this.element.addEventListener(\"touchstart\", this.functionsBinded.downActionDelay);\n this.element.addEventListener(\"trigger_pointer_pressstart\", this.functionsBinded.childPressStart);\n this.element.addEventListener(\"trigger_pointer_pressend\", this.functionsBinded.childPressEnd);\n this.element.addEventListener(\"trigger_pointer_pressmove\", this.functionsBinded.childPressMove);\n }\n identifyEvent(touch) {\n if ('Touch' in window && touch instanceof Touch)\n return touch.identifier;\n return touch.pointerId;\n }\n registerEvent(ev) {\n if ('TouchEvent' in window && ev instanceof TouchEvent) {\n for (let touch of ev.targetTouches) {\n const id = this.identifyEvent(touch);\n if (this.pointersRecord[id]) {\n return false;\n }\n this.pointersRecord[id] = ev;\n }\n return true;\n }\n else {\n const id = this.identifyEvent(ev);\n if (this.pointersRecord[id]) {\n return false;\n }\n this.pointersRecord[id] = ev;\n return true;\n }\n }\n unregisterEvent(ev) {\n let result = true;\n if ('TouchEvent' in window && ev instanceof TouchEvent) {\n for (let touch of ev.changedTouches) {\n const id = this.identifyEvent(touch);\n if (!this.pointersRecord[id]) {\n result = false;\n }\n else {\n delete this.pointersRecord[id];\n }\n }\n }\n else {\n const id = this.identifyEvent(ev);\n if (!this.pointersRecord[id]) {\n result = false;\n }\n else {\n delete this.pointersRecord[id];\n }\n }\n return result;\n }\n genericDownAction(state, e) {\n this.downEventSaved = e;\n this.startPosition = { x: e.pageX, y: e.pageY };\n if (this.options.onLongPress) {\n this.timeoutLongPress = setTimeout(() => {\n if (!state.oneActionTriggered) {\n if (this.options.onLongPress) {\n if (this.options.onLongPress(e, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }, this.delayLongPress);\n }\n }\n pointerEventTriggered = false;\n downActionDelay(_ev) {\n const ev = _ev;\n if (!this.pointerEventTriggered) {\n this.downAction(ev);\n }\n else {\n ev.stopImmediatePropagation();\n }\n setTimeout(() => {\n this.pointerEventTriggered = false;\n }, 0);\n }\n downAction(_ev) {\n const ev = _ev;\n this.pointerEventTriggered = true;\n const isFirst = Object.values(this.pointersRecord).length == 0;\n if (!this.registerEvent(ev)) {\n if (this.stopPropagation()) {\n ev.stopImmediatePropagation();\n }\n return;\n }\n const e = new NormalizedEvent(ev);\n if (this.options.onEvent) {\n this.options.onEvent(e);\n }\n PressManager.onEvent.trigger(e, this);\n if (e.button != undefined && !this.options.buttonAllowed?.includes(e.button)) {\n this.unregisterEvent(ev);\n return;\n }\n if (this.stopPropagation()) {\n e.stopImmediatePropagation();\n }\n this.customFcts = {};\n if (this.nbPress == 0 && isFirst) {\n this.state.oneActionTriggered = null;\n clearTimeout(this.timeoutDblPress);\n }\n if (isFirst) {\n document.addEventListener(\"pointerup\", this.functionsBinded.upAction);\n document.addEventListener(\"pointercancel\", this.functionsBinded.upAction);\n document.addEventListener(\"touchend\", this.functionsBinded.upAction);\n document.addEventListener(\"touchcancel\", this.functionsBinded.upAction);\n document.addEventListener(\"pointermove\", this.functionsBinded.moveAction);\n }\n this.genericDownAction(this.state, e);\n if (this.options.onPressStart) {\n this.options.onPressStart(e, this);\n this.lastEmitEvent = e;\n // this.emitTriggerFunctionParent(\"pressstart\", e);\n }\n this.emitTriggerFunction(\"pressstart\", e);\n }\n genericUpAction(state, e) {\n clearTimeout(this.timeoutLongPress);\n if (state.oneActionTriggered == this) {\n if (this.options.onDragEnd) {\n this.options.onDragEnd(e, this);\n }\n else if (this.customFcts.src && this.customFcts.onDragEnd) {\n this.customFcts.onDragEnd(e, this.customFcts.src);\n }\n }\n else {\n if (this.useDblPress) {\n this.nbPress++;\n if (this.nbPress == 2) {\n if (!state.oneActionTriggered) {\n this.nbPress = 0;\n if (this.options.onDblPress) {\n if (this.options.onDblPress(e, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }\n else if (this.nbPress == 1) {\n this.timeoutDblPress = setTimeout(() => {\n this.nbPress = 0;\n if (!state.oneActionTriggered) {\n if (this.options.onPress) {\n if (this.options.onPress(e, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }, this.delayDblPress);\n }\n }\n else {\n if (!state.oneActionTriggered) {\n if (this.options.onPress) {\n if (this.options.onPress(e, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }\n }\n }\n upAction(_ev) {\n const ev = _ev;\n if (!this.unregisterEvent(ev)) {\n if (this.stopPropagation()) {\n ev.stopImmediatePropagation();\n }\n return;\n }\n const e = new NormalizedEvent(ev);\n if (this.options.onEvent) {\n this.options.onEvent(e);\n }\n PressManager.onEvent.trigger(e, this);\n if (this.stopPropagation()) {\n e.stopImmediatePropagation();\n }\n if (Object.values(this.pointersRecord).length == 0) {\n document.removeEventListener(\"pointerup\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointercancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchend\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchcancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointermove\", this.functionsBinded.moveAction);\n }\n this.genericUpAction(this.state, e);\n if (this.options.onPressEnd) {\n this.options.onPressEnd(e, this);\n this.lastEmitEvent = e;\n // this.emitTriggerFunctionParent(\"pressend\", e);\n }\n this.emitTriggerFunction(\"pressend\", e);\n }\n genericMoveAction(state, e) {\n if (!state.oneActionTriggered) {\n let xDist = e.pageX - this.startPosition.x;\n let yDist = e.pageY - this.startPosition.y;\n let distance = 0;\n if (this.dragDirection == 'XY')\n distance = Math.sqrt(xDist * xDist + yDist * yDist);\n else if (this.dragDirection == 'X')\n distance = Math.abs(xDist);\n else\n distance = Math.abs(yDist);\n if (distance > this.offsetDrag && this.downEventSaved) {\n if (this.options.onDragStart) {\n if (this.options.onDragStart(this.downEventSaved, this) !== false) {\n state.oneActionTriggered = this;\n }\n }\n }\n }\n else if (state.oneActionTriggered == this) {\n if (this.options.onDrag) {\n this.options.onDrag(e, this);\n }\n else if (this.customFcts.src && this.customFcts.onDrag) {\n this.customFcts.onDrag(e, this.customFcts.src);\n }\n }\n }\n moveAction(_ev) {\n const ev = _ev;\n const e = new NormalizedEvent(ev);\n if (this.options.onEvent) {\n this.options.onEvent(e);\n }\n PressManager.onEvent.trigger(e, this);\n if (this.stopPropagation()) {\n e.stopImmediatePropagation();\n }\n this.genericMoveAction(this.state, e);\n this.lastEmitEvent = e;\n // if(this.options.onDrag) {\n // this.emitTriggerFunctionParent(\"pressmove\", e);\n this.emitTriggerFunction(\"pressmove\", e);\n }\n childPressStart(_e) {\n const e = _e;\n if (this.lastEmitEvent == e.detail.realEvent)\n return;\n this.genericDownAction(e.detail.state, e.detail.realEvent);\n if (this.options.onPressStart) {\n this.options.onPressStart(e.detail.realEvent, this);\n }\n }\n childPressEnd(_e) {\n const e = _e;\n this.unregisterEvent(e.detail.realEvent.event);\n if (Object.values(this.pointersRecord).length == 0) {\n document.removeEventListener(\"pointerup\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointercancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchend\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchcancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointermove\", this.functionsBinded.moveAction);\n }\n if (this.lastEmitEvent == e.detail.realEvent)\n return;\n this.genericUpAction(e.detail.state, e.detail.realEvent);\n if (this.options.onPressEnd) {\n this.options.onPressEnd(e.detail.realEvent, this);\n }\n }\n childPressMove(_e) {\n const e = _e;\n if (this.lastEmitEvent == e.detail.realEvent)\n return;\n this.genericMoveAction(e.detail.state, e.detail.realEvent);\n }\n lastEmitEvent;\n emitTriggerFunction(action, e, el) {\n let ev = new CustomEvent(\"trigger_pointer_\" + action, {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail: {\n state: this.state,\n customFcts: this.customFcts,\n realEvent: e\n }\n });\n this.lastEmitEvent = e;\n if (!el) {\n el = this.element;\n }\n el.dispatchEvent(ev);\n }\n /**\n * Destroy the Press instance byremoving all events\n */\n destroy() {\n if (this.element) {\n this.element.removeEventListener(\"pointerdown\", this.functionsBinded.downAction);\n this.element.removeEventListener(\"touchstart\", this.functionsBinded.downActionDelay);\n this.element.removeEventListener(\"trigger_pointer_pressstart\", this.functionsBinded.childPressStart);\n this.element.removeEventListener(\"trigger_pointer_pressend\", this.functionsBinded.childPressEnd);\n this.element.removeEventListener(\"trigger_pointer_pressmove\", this.functionsBinded.childPressMove);\n document.removeEventListener(\"pointerup\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointercancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchend\", this.functionsBinded.upAction);\n document.removeEventListener(\"touchcancel\", this.functionsBinded.upAction);\n document.removeEventListener(\"pointermove\", this.functionsBinded.moveAction);\n }\n }\n}\nPressManager.Namespace=`Aventus`;\n__as1(_, 'PressManager', PressManager);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManagerOptions","isStrong":true},{"fullName":"Aventus.Callback","isStrong":true},{"fullName":"Aventus.NormalizedEvent","isStrong":true},{"fullName":"Aventus.PressManagerState","isStrong":false},{"fullName":"Aventus.InternalCustomFunction","isStrong":false},{"fullName":"Aventus.InternalPointerEvent","isStrong":false}],"fullName":"Aventus.PressManager","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let DragAndDrop=class DragAndDrop {\n /**\n * Default offset before drag element\n */\n static defaultOffsetDrag = 20;\n pressManager;\n options;\n startCursorPosition = { x: 0, y: 0 };\n startElementPosition = { x: 0, y: 0 };\n isEnable = true;\n draggableElement;\n constructor(options) {\n this.options = this.getDefaultOptions(options.element);\n this.mergeProperties(options);\n this.mergeFunctions(options);\n this.options.elementTrigger.style.touchAction = 'none';\n this.pressManager = new PressManager({\n element: this.options.elementTrigger,\n onPressStart: this.onPressStart.bind(this),\n onPressEnd: this.onPressEnd.bind(this),\n onDragStart: this.onDragStart.bind(this),\n onDrag: this.onDrag.bind(this),\n onDragEnd: this.onDragEnd.bind(this),\n offsetDrag: this.options.offsetDrag,\n dragDirection: this.options.dragDirection,\n stopPropagation: this.options.stopPropagation\n });\n }\n getDefaultOptions(element) {\n return {\n applyDrag: true,\n element: element,\n elementTrigger: element,\n offsetDrag: DragAndDrop.defaultOffsetDrag,\n dragDirection: 'XY',\n shadow: {\n enable: false,\n container: document.body,\n removeOnStop: true,\n transform: () => { },\n delete: (el) => {\n el.remove();\n }\n },\n strict: false,\n targets: [],\n usePercent: false,\n stopPropagation: true,\n useMouseFinalPosition: false,\n useTransform: false,\n isDragEnable: () => true,\n getZoom: () => 1,\n getOffsetX: () => 0,\n getOffsetY: () => 0,\n onPointerDown: (e) => { },\n onPointerUp: (e) => { },\n onStart: (e) => { },\n onMove: (e) => { },\n onStop: (e) => { },\n onDrop: (element, targets) => { },\n correctPosition: (position) => position\n };\n }\n mergeProperties(options) {\n if (options.element === void 0) {\n throw \"You must define the element for the drag&drop\";\n }\n this.options.element = options.element;\n if (options.elementTrigger === void 0) {\n this.options.elementTrigger = this.options.element;\n }\n else {\n this.options.elementTrigger = options.elementTrigger;\n }\n this.defaultMerge(options, \"applyDrag\");\n this.defaultMerge(options, \"offsetDrag\");\n this.defaultMerge(options, \"dragDirection\");\n this.defaultMerge(options, \"strict\");\n this.defaultMerge(options, \"targets\");\n this.defaultMerge(options, \"usePercent\");\n this.defaultMerge(options, \"stopPropagation\");\n this.defaultMerge(options, \"useMouseFinalPosition\");\n this.defaultMerge(options, \"useTransform\");\n if (options.shadow !== void 0) {\n this.options.shadow.enable = options.shadow.enable;\n if (options.shadow.container !== void 0) {\n this.options.shadow.container = options.shadow.container;\n }\n else {\n this.options.shadow.container = document.body;\n }\n if (options.shadow.removeOnStop !== void 0) {\n this.options.shadow.removeOnStop = options.shadow.removeOnStop;\n }\n if (options.shadow.transform !== void 0) {\n this.options.shadow.transform = options.shadow.transform;\n }\n if (options.shadow.delete !== void 0) {\n this.options.shadow.delete = options.shadow.delete;\n }\n }\n }\n mergeFunctions(options) {\n this.defaultMerge(options, \"isDragEnable\");\n this.defaultMerge(options, \"getZoom\");\n this.defaultMerge(options, \"getOffsetX\");\n this.defaultMerge(options, \"getOffsetY\");\n this.defaultMerge(options, \"onPointerDown\");\n this.defaultMerge(options, \"onPointerUp\");\n this.defaultMerge(options, \"onStart\");\n this.defaultMerge(options, \"onMove\");\n this.defaultMerge(options, \"onStop\");\n this.defaultMerge(options, \"onDrop\");\n this.defaultMerge(options, \"correctPosition\");\n }\n defaultMerge(options, name) {\n if (options[name] !== void 0) {\n const opts = this.options;\n opts[name] = options[name];\n }\n }\n positionShadowRelativeToElement = { x: 0, y: 0 };\n onPressStart(e) {\n this.options.onPointerDown(e);\n }\n onPressEnd(e) {\n this.options.onPointerUp(e);\n }\n onDragStart(e) {\n this.isEnable = this.options.isDragEnable();\n if (!this.isEnable) {\n return false;\n }\n let draggableElement = this.options.element;\n this.startCursorPosition = {\n x: e.pageX,\n y: e.pageY\n };\n this.startElementPosition = this.getBoundingBoxRelative(draggableElement);\n if (this.options.shadow.enable) {\n draggableElement = this.options.element.cloneNode(true);\n let elBox = this.options.element.getBoundingClientRect();\n let containerBox = this.options.shadow.container.getBoundingClientRect();\n this.positionShadowRelativeToElement = {\n x: elBox.x - containerBox.x,\n y: elBox.y - containerBox.y\n };\n if (this.options.applyDrag) {\n draggableElement.style.position = \"absolute\";\n draggableElement.style.top = this.positionShadowRelativeToElement.y + this.options.getOffsetY() + 'px';\n draggableElement.style.left = this.positionShadowRelativeToElement.x + this.options.getOffsetX() + 'px';\n this.options.shadow.transform(draggableElement);\n this.options.shadow.container.appendChild(draggableElement);\n }\n }\n this.draggableElement = draggableElement;\n const result = this.options.onStart(e);\n if (result !== false) {\n document.body.style.userSelect = 'none';\n if (window.getSelection) {\n window.getSelection()?.removeAllRanges();\n }\n }\n return result;\n }\n onDrag(e) {\n if (!this.isEnable) {\n return;\n }\n let zoom = this.options.getZoom();\n let diff = {\n x: 0,\n y: 0\n };\n if (this.options.shadow.enable) {\n diff = {\n x: (e.pageX - this.startCursorPosition.x) + this.positionShadowRelativeToElement.x + this.options.getOffsetX(),\n y: (e.pageY - this.startCursorPosition.y) + this.positionShadowRelativeToElement.y + this.options.getOffsetY(),\n };\n }\n else {\n diff = {\n x: (e.pageX - this.startCursorPosition.x) / zoom + this.startElementPosition.x + this.options.getOffsetX(),\n y: (e.pageY - this.startCursorPosition.y) / zoom + this.startElementPosition.y + this.options.getOffsetY()\n };\n }\n let newPos = this.setPosition(diff);\n this.options.onMove(e, newPos);\n }\n onDragEnd(e) {\n if (!this.isEnable) {\n return;\n }\n document.body.style.userSelect = '';\n let targets = this.options.useMouseFinalPosition ? this.getMatchingTargetsWithMousePosition({\n x: e.clientX,\n y: e.clientY\n }) : this.getMatchingTargets();\n let draggableElement = this.draggableElement;\n if (this.options.shadow.enable && this.options.shadow.removeOnStop) {\n this.options.shadow.delete(draggableElement);\n }\n if (targets.length > 0) {\n this.options.onDrop(this.options.element, targets);\n }\n this.options.onStop(e);\n }\n setPosition(position) {\n let draggableElement = this.draggableElement;\n if (this.options.usePercent) {\n let elementParent = this.getOffsetParent(draggableElement);\n if (elementParent instanceof HTMLElement) {\n let percentPosition = {\n x: (position.x / elementParent.offsetWidth) * 100,\n y: (position.y / elementParent.offsetHeight) * 100\n };\n percentPosition = this.options.correctPosition(percentPosition);\n if (this.options.applyDrag) {\n draggableElement.style.left = percentPosition.x + '%';\n draggableElement.style.top = percentPosition.y + '%';\n }\n return percentPosition;\n }\n else {\n console.error(\"Can't find parent. Contact an admin\", draggableElement);\n }\n }\n else {\n position = this.options.correctPosition(position);\n if (this.options.applyDrag) {\n if (this.isLeftTopElement(draggableElement)) {\n draggableElement.style.left = position.x + 'px';\n draggableElement.style.top = position.y + 'px';\n }\n else {\n if (this.options.useTransform) {\n draggableElement.setAttribute(\"transform\", `translate(${position.x},${position.y})`);\n }\n else {\n draggableElement.style.left = position.x + 'px';\n draggableElement.style.top = position.y + 'px';\n }\n }\n }\n }\n return position;\n }\n getTargets() {\n if (typeof this.options.targets == \"function\") {\n return this.options.targets();\n }\n else {\n return this.options.targets;\n }\n }\n /**\n * Get targets within the current element position is matching\n */\n getMatchingTargets() {\n let draggableElement = this.draggableElement;\n let matchingTargets = [];\n let srcTargets = this.getTargets();\n for (let target of srcTargets) {\n let elementCoordinates = this.getBoundingBoxAbsolute(draggableElement);\n let targetCoordinates = this.getBoundingBoxAbsolute(target);\n let offsetX = this.options.getOffsetX();\n let offsetY = this.options.getOffsetY();\n let zoom = this.options.getZoom();\n targetCoordinates.x += offsetX;\n targetCoordinates.y += offsetY;\n targetCoordinates.width *= zoom;\n targetCoordinates.height *= zoom;\n if (this.options.strict) {\n if ((elementCoordinates.x >= targetCoordinates.x && elementCoordinates.x + elementCoordinates.width <= targetCoordinates.x + targetCoordinates.width) &&\n (elementCoordinates.y >= targetCoordinates.y && elementCoordinates.y + elementCoordinates.height <= targetCoordinates.y + targetCoordinates.height)) {\n matchingTargets.push(target);\n }\n }\n else {\n let elementLeft = elementCoordinates.x;\n let elementRight = elementCoordinates.x + elementCoordinates.width;\n let elementTop = elementCoordinates.y;\n let elementBottom = elementCoordinates.y + elementCoordinates.height;\n let targetLeft = targetCoordinates.x;\n let targetRight = targetCoordinates.x + targetCoordinates.width;\n let targetTop = targetCoordinates.y;\n let targetBottom = targetCoordinates.y + targetCoordinates.height;\n if (!(elementRight < targetLeft ||\n elementLeft > targetRight ||\n elementBottom < targetTop ||\n elementTop > targetBottom)) {\n matchingTargets.push(target);\n }\n }\n }\n return matchingTargets;\n }\n /**\n * This function will return the targets that are matching with the mouse position\n * @param mouse The mouse position\n */\n getMatchingTargetsWithMousePosition(mouse) {\n let matchingTargets = [];\n if (this.options.shadow.enable == false || this.options.shadow.container == null) {\n console.warn(\"DragAndDrop : To use useMouseFinalPosition=true, you must enable shadow and set a container\");\n return matchingTargets;\n }\n const container = this.options.shadow.container;\n let xCorrected = mouse.x - container.getBoundingClientRect().left;\n let yCorrected = mouse.y - container.getBoundingClientRect().top;\n for (let target of this.getTargets()) {\n if (this.isLeftTopElement(target)) {\n if (this.matchPosition(target, { x: mouse.x, y: mouse.y })) {\n matchingTargets.push(target);\n }\n }\n else {\n if (this.matchPosition(target, { x: xCorrected, y: yCorrected })) {\n matchingTargets.push(target);\n }\n }\n }\n return matchingTargets;\n }\n matchPosition(element, point) {\n let elementCoordinates = this.getBoundingBoxAbsolute(element);\n if (point.x >= elementCoordinates.x &&\n point.x <= elementCoordinates.x + elementCoordinates.width &&\n point.y >= elementCoordinates.y &&\n point.y <= elementCoordinates.y + elementCoordinates.height) {\n return true;\n }\n return false;\n }\n /**\n * Get element currently dragging\n */\n getElementDrag() {\n return this.options.element;\n }\n /**\n * Set targets where to drop\n */\n setTargets(targets) {\n this.options.targets = targets;\n }\n /**\n * Set targets where to drop\n */\n setTargetsFct(targets) {\n this.options.targets = targets;\n }\n /**\n * Destroy the current drag&drop instance\n */\n destroy() {\n this.pressManager.destroy();\n }\n isLeftTopElement(element) {\n for (let Type of DragElementLeftTopType) {\n if (element instanceof Type) {\n return true;\n }\n }\n return false;\n }\n isXYElement(element) {\n for (let Type of DragElementXYType) {\n if (element instanceof Type) {\n return true;\n }\n }\n return false;\n }\n getCoordinateFromAttribute(element) {\n if (this.options.useTransform) {\n const transform = element.getAttribute(\"transform\");\n const tvalue = transform?.match(/translate\\(([^,]+),([^,]+)\\)/);\n const x = tvalue ? parseFloat(tvalue[1]) : 0;\n const y = tvalue ? parseFloat(tvalue[2]) : 0;\n return {\n x: x,\n y: y\n };\n }\n return {\n x: parseFloat(element.getAttribute(\"x\")),\n y: parseFloat(element.getAttribute(\"y\"))\n };\n }\n XYElementToRelativeBox(element) {\n let coordinates = this.getCoordinateFromAttribute(element);\n const width = parseFloat(element.getAttribute(\"width\"));\n const height = parseFloat(element.getAttribute(\"height\"));\n return {\n x: coordinates.x,\n y: coordinates.y,\n width: width,\n height: height,\n bottom: coordinates.y + height,\n right: coordinates.x + width,\n top: coordinates.y,\n left: coordinates.x,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n XYElementToAbsoluteBox(element) {\n let coordinates = this.getCoordinateFromAttribute(element);\n const parent = this.getOffsetParent(element);\n if (parent) {\n const box = parent.getBoundingClientRect();\n coordinates = {\n x: coordinates.x + box.x,\n y: coordinates.y + box.y\n };\n }\n const width = parseFloat(element.getAttribute(\"width\"));\n const height = parseFloat(element.getAttribute(\"height\"));\n return {\n x: coordinates.x,\n y: coordinates.y,\n width: width,\n height: height,\n bottom: coordinates.y + height,\n right: coordinates.x + width,\n top: coordinates.y,\n left: coordinates.x,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n getBoundingBoxAbsolute(element) {\n if (this.isLeftTopElement(element)) {\n if (element instanceof HTMLElement) {\n const bounds = element.getBoundingClientRect();\n return {\n x: bounds.x,\n y: bounds.y,\n width: bounds.width,\n height: bounds.height,\n bottom: bounds.bottom,\n right: bounds.right,\n top: bounds.top,\n left: bounds.left,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n }\n else if (this.isXYElement(element)) {\n return this.XYElementToAbsoluteBox(element);\n }\n const parent = this.getOffsetParent(element);\n if (parent instanceof HTMLElement) {\n const rect = element.getBoundingClientRect();\n const rectParent = parent.getBoundingClientRect();\n const x = rect.left - rectParent.left;\n const y = rect.top - rectParent.top;\n return {\n x: x,\n y: y,\n width: rect.width,\n height: rect.height,\n bottom: y + rect.height,\n right: x + rect.width,\n left: rect.left - rectParent.left,\n top: rect.top - rectParent.top,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n console.error(\"Element type not supported\");\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n bottom: 0,\n right: 0,\n top: 0,\n left: 0,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n getBoundingBoxRelative(element) {\n if (this.isLeftTopElement(element)) {\n if (element instanceof HTMLElement) {\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: element.offsetWidth,\n height: element.offsetHeight,\n bottom: element.offsetTop + element.offsetHeight,\n right: element.offsetLeft + element.offsetWidth,\n top: element.offsetTop,\n left: element.offsetLeft,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n }\n else if (this.isXYElement(element)) {\n return this.XYElementToRelativeBox(element);\n }\n const parent = this.getOffsetParent(element);\n if (parent instanceof HTMLElement) {\n const rect = element.getBoundingClientRect();\n const rectParent = parent.getBoundingClientRect();\n const x = rect.left - rectParent.left;\n const y = rect.top - rectParent.top;\n return {\n x: x,\n y: y,\n width: rect.width,\n height: rect.height,\n bottom: y + rect.height,\n right: x + rect.width,\n left: rect.left - rectParent.left,\n top: rect.top - rectParent.top,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n console.error(\"Element type not supported\");\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n bottom: 0,\n right: 0,\n top: 0,\n left: 0,\n toJSON() {\n return JSON.stringify(this);\n }\n };\n }\n getOffsetParent(element) {\n if (element instanceof HTMLElement) {\n return element.offsetParent;\n }\n let current = element.parentNode;\n while (current) {\n if (current instanceof Element) {\n const style = getComputedStyle(current);\n if (style.position !== 'static') {\n return current;\n }\n }\n if (current instanceof ShadowRoot) {\n current = current.host;\n }\n else {\n current = current.parentNode;\n }\n }\n return null;\n }\n}\nDragAndDrop.Namespace=`Aventus`;\n__as1(_, 'DragAndDrop', DragAndDrop);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.DragAndDropOptionsInternal","isStrong":false},{"fullName":"Aventus.Coordinate","isStrong":false},{"fullName":"Aventus.DragElement","isStrong":false},{"fullName":"Aventus.DragAndDropOptions","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.TargetableElement","isStrong":false},{"fullName":"Aventus.DragElementLeftTop","isStrong":false},{"fullName":"Aventus.DragElementLeftTopType","isStrong":false},{"fullName":"Aventus.DragElementXY","isStrong":false},{"fullName":"Aventus.DragElementXYType","isStrong":false},{"fullName":"Aventus.AnyElement","isStrong":false}],"fullName":"Aventus.DragAndDrop","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Instance=class Instance {\n static elements = new Map();\n static get(type) {\n let result = this.elements.get(type);\n if (!result) {\n let cst = type.prototype['constructor'];\n result = new cst();\n this.elements.set(type, result);\n }\n return result;\n }\n static set(el) {\n let cst = el.constructor;\n if (this.elements.get(cst)) {\n return false;\n }\n this.elements.set(cst, el);\n return true;\n }\n static destroy(el) {\n let cst = el.constructor;\n return this.elements.delete(cst);\n }\n}\nInstance.Namespace=`Aventus`;\n__as1(_, 'Instance', Instance);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.InstanceCst2","isStrong":false},{"fullName":"X","isStrong":false},{"fullName":"Aventus.InstanceCst","isStrong":false}],"fullName":"Aventus.Instance","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ResizeObserver=class ResizeObserver {\n callback;\n targets;\n fpsInterval = -1;\n nextFrame;\n entriesChangedEvent;\n willTrigger;\n static resizeObserverClassByObject = {};\n static uniqueInstance;\n static getUniqueInstance() {\n if (!ResizeObserver.uniqueInstance) {\n ResizeObserver.uniqueInstance = new window.ResizeObserver(entries => {\n let allClasses = [];\n for (let j = 0; j < entries.length; j++) {\n let entry = entries[j];\n const target = entry.target;\n let index = target['sourceIndex'];\n if (ResizeObserver.resizeObserverClassByObject[index]) {\n for (let i = 0; i < ResizeObserver.resizeObserverClassByObject[index].length; i++) {\n let classTemp = ResizeObserver.resizeObserverClassByObject[index][i];\n classTemp.entryChanged(entry);\n if (allClasses.indexOf(classTemp) == -1) {\n allClasses.push(classTemp);\n }\n }\n }\n }\n for (let i = 0; i < allClasses.length; i++) {\n allClasses[i].triggerCb();\n }\n });\n }\n return ResizeObserver.uniqueInstance;\n }\n constructor(options) {\n let realOption;\n if (options instanceof Function) {\n realOption = {\n callback: options,\n };\n }\n else {\n realOption = options;\n }\n this.callback = realOption.callback;\n this.targets = [];\n if (!realOption.fps) {\n realOption.fps = 60;\n }\n if (realOption.fps != -1) {\n this.fpsInterval = 1000 / realOption.fps;\n }\n this.nextFrame = 0;\n this.entriesChangedEvent = {};\n this.willTrigger = false;\n }\n /**\n * Observe size changing for the element\n */\n observe(target) {\n const _target = target;\n if (!_target[\"sourceIndex\"]) {\n _target[\"sourceIndex\"] = Math.random().toString(36);\n this.targets.push(_target);\n ResizeObserver.getUniqueInstance().observe(_target);\n }\n if (!ResizeObserver.resizeObserverClassByObject[_target[\"sourceIndex\"]]) {\n ResizeObserver.resizeObserverClassByObject[_target[\"sourceIndex\"]] = [];\n }\n if (ResizeObserver.resizeObserverClassByObject[_target[\"sourceIndex\"]].indexOf(this) == -1) {\n ResizeObserver.resizeObserverClassByObject[_target[\"sourceIndex\"]].push(this);\n }\n }\n /**\n * Stop observing size changing for the element\n */\n unobserve(target) {\n const _target = target;\n for (let i = 0; this.targets.length; i++) {\n let tempTarget = this.targets[i];\n if (tempTarget == _target) {\n let position = ResizeObserver.resizeObserverClassByObject[_target['sourceIndex']].indexOf(this);\n if (position != -1) {\n ResizeObserver.resizeObserverClassByObject[_target['sourceIndex']].splice(position, 1);\n }\n if (ResizeObserver.resizeObserverClassByObject[_target['sourceIndex']].length == 0) {\n delete ResizeObserver.resizeObserverClassByObject[_target['sourceIndex']];\n }\n ResizeObserver.getUniqueInstance().unobserve(_target);\n this.targets.splice(i, 1);\n return;\n }\n }\n }\n /**\n * Destroy the resize observer\n */\n disconnect() {\n for (let i = 0; this.targets.length; i++) {\n this.unobserve(this.targets[i]);\n }\n }\n entryChanged(entry) {\n const _target = entry.target;\n let index = _target.sourceIndex;\n this.entriesChangedEvent[index] = entry;\n }\n triggerCb() {\n if (!this.willTrigger) {\n this.willTrigger = true;\n this._triggerCb();\n }\n }\n _triggerCb() {\n let now = window.performance.now();\n let elapsed = now - this.nextFrame;\n if (this.fpsInterval != -1 && elapsed <= this.fpsInterval) {\n requestAnimationFrame(() => {\n this._triggerCb();\n });\n return;\n }\n this.nextFrame = now - (elapsed % this.fpsInterval);\n let changed = Object.values(this.entriesChangedEvent);\n this.entriesChangedEvent = {};\n this.willTrigger = false;\n setTimeout(() => {\n this.callback(changed, ResizeObserver.uniqueInstance);\n }, 0);\n }\n}\nResizeObserver.Namespace=`Aventus`;\n__as1(_, 'ResizeObserver', ResizeObserver);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WindowResizeObserver","isStrong":true},{"fullName":"Aventus.ResizeObserverOptions","isStrong":false}],"fullName":"Aventus.ResizeObserver","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Uri=class Uri {\n static prepare(uri) {\n let params = [];\n let i = 0;\n let regexState = uri.replace(/{.*?}/g, (group, position) => {\n group = group.slice(1, -1);\n let splitted = group.split(\":\");\n let name = splitted[0].trim();\n let type = \"string\";\n let result = \"([^\\\\/]+)\";\n i++;\n if (splitted.length > 1) {\n if (splitted[1].trim() == \"number\") {\n result = \"([0-9]+)\";\n type = \"number\";\n }\n }\n params.push({\n name,\n type,\n position: i\n });\n return result;\n });\n regexState = regexState.replace(/\\*/g, \".*?\").toLowerCase();\n regexState = \"^\" + regexState + '$';\n return {\n regex: new RegExp(regexState),\n params\n };\n }\n static getParams(from, current) {\n if (typeof from == \"string\") {\n from = this.prepare(from);\n }\n let matches = from.regex.exec(current.toLowerCase());\n if (matches) {\n let slugs = {};\n for (let param of from.params) {\n if (param.type == \"number\") {\n slugs[param.name] = Number(matches[param.position]);\n }\n else {\n slugs[param.name] = matches[param.position];\n }\n }\n return slugs;\n }\n return null;\n }\n static isActive(from, current) {\n if (typeof from == \"string\") {\n from = this.prepare(from);\n }\n return from.regex.test(current);\n }\n static normalize(path) {\n const isAbsolute = path.startsWith('/');\n const parts = path.split('/');\n const normalizedParts = [];\n for (let i = 0; i < parts.length; i++) {\n if (parts[i] === '..') {\n normalizedParts.pop();\n }\n else if (parts[i] !== '.' && parts[i] !== '') {\n normalizedParts.push(parts[i]);\n }\n }\n let normalizedPath = normalizedParts.join('/');\n if (isAbsolute) {\n normalizedPath = '/' + normalizedPath;\n }\n return normalizedPath;\n }\n}\nUri.Namespace=`Aventus`;\n__as1(_, 'Uri', Uri);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PreparedUri","isStrong":false},{"fullName":"Aventus.UriParams","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false}],"fullName":"Aventus.Uri","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let RamError=class RamError extends GenericError {\n}\nRamError.Namespace=`Aventus`;\nRamError.$schema={...(GenericError?.$schema ?? {}), };\nConverter.register(RamError.Fullname, RamError);\n__as1(_, 'RamError', RamError);\n","dependencies":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"Aventus.RamErrorCode","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.RamError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let VoidRamWithError=class VoidRamWithError extends VoidWithError {\n}\nVoidRamWithError.Namespace=`Aventus`;\nVoidRamWithError.$schema={...(VoidWithError?.$schema ?? {}), };\nConverter.register(VoidRamWithError.Fullname, VoidRamWithError);\n__as1(_, 'VoidRamWithError', VoidRamWithError);\n","dependencies":[{"fullName":"Aventus.VoidWithError","isStrong":true},{"fullName":"Aventus.RamError","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.VoidRamWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let ResultRamWithError=class ResultRamWithError extends ResultWithError {\n}\nResultRamWithError.Namespace=`Aventus`;\nResultRamWithError.$schema={...(ResultWithError?.$schema ?? {}), };\nConverter.register(ResultRamWithError.Fullname, ResultRamWithError);\n__as1(_, 'ResultRamWithError', ResultRamWithError);\n","dependencies":[{"fullName":"Aventus.ResultWithError","isStrong":true},{"fullName":"Aventus.RamError","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.ResultRamWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"let GenericRam=class GenericRam {\n static info = new Map([]);\n /**\n * The current namespace\n */\n static Namespace = \"\";\n // public static get Namespace(): string { return \"\"; }\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n static get Fullname() { return this.Namespace + \".\" + this.name; }\n subscribers = {\n created: [],\n updated: [],\n deleted: [],\n };\n recordsSubscribers = new Map();\n /**\n * List of stored item by index key\n */\n records = new Map();\n actionGuard = new ActionGuard();\n ramMapping = {};\n constructor() {\n if (this.constructor == GenericRam) {\n throw \"can't instanciate an abstract class\";\n }\n // RamManager.check();\n this.getIdWithError = this.getIdWithError.bind(this);\n this.getId = this.getId.bind(this);\n this.save = this.save.bind(this);\n this.saveWithError = this.saveWithError.bind(this);\n this.onCreated = this.onCreated.bind(this);\n this.offCreated = this.offCreated.bind(this);\n this.onUpdated = this.onUpdated.bind(this);\n this.offUpdated = this.offUpdated.bind(this);\n this.onDeleted = this.onDeleted.bind(this);\n this.offDeleted = this.offDeleted.bind(this);\n this.get = this.get.bind(this);\n this.getWithError = this.getWithError.bind(this);\n this.getById = this.getById.bind(this);\n this.getByIdWithError = this.getByIdWithError.bind(this);\n this.getByIds = this.getByIds.bind(this);\n this.getByIdsWithError = this.getByIdsWithError.bind(this);\n this.getAll = this.getAll.bind(this);\n this.getAllWithError = this.getAllWithError.bind(this);\n this.getList = this.getList.bind(this);\n this.getListWithError = this.getListWithError.bind(this);\n this.getRecords = this.getRecords.bind(this);\n this.getRecordsWithError = this.getRecordsWithError.bind(this);\n this.createList = this.createList.bind(this);\n this.createListWithError = this.createListWithError.bind(this);\n this.create = this.create.bind(this);\n this.createWithError = this.createWithError.bind(this);\n this.updateList = this.updateList.bind(this);\n this.updateListWithError = this.updateListWithError.bind(this);\n this.update = this.update.bind(this);\n this.updateWithError = this.updateWithError.bind(this);\n this.deleteList = this.deleteList.bind(this);\n this.deleteListWithError = this.deleteListWithError.bind(this);\n this.delete = this.delete.bind(this);\n this.deleteWithError = this.deleteWithError.bind(this);\n this.deleteById = this.deleteById.bind(this);\n this.deleteByIdWithError = this.deleteByIdWithError.bind(this);\n }\n /**\n * Get item id\n */\n getIdWithError(item) {\n let action = new ResultRamWithError();\n let idTemp = item[this.defineIndexKey()];\n if (idTemp !== undefined) {\n action.result = idTemp;\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noId, \"no key found for item\"));\n }\n return action;\n }\n /**\n * Get item id\n */\n getId(item) {\n let result = this.getIdWithError(item);\n if (result.success) {\n return result.result;\n }\n throw 'no key found for item';\n }\n /**\n * Prevent adding Watch element\n */\n removeWatch(element) {\n let byPass = element;\n if (byPass.__isProxy) {\n return byPass.getTarget();\n }\n return element;\n }\n /**\n * Add function update, onUpdate, offUpdate, delete, onDelete, offDelete\n */\n addRamAction(Base) {\n let that = this;\n return class ActionClass extends Base {\n static get className() {\n return Base.className || Base.name;\n }\n get className() {\n return Base.className || Base.name;\n }\n async update(newData) {\n return (await that.update(newData));\n }\n async updateWithError(newData) {\n return (await that.updateWithError(newData));\n }\n onUpdate(callback) {\n let id = that.getId(this);\n if (!that.recordsSubscribers.has(id)) {\n that.recordsSubscribers.set(id, {\n created: [],\n updated: [],\n deleted: []\n });\n }\n let sub = that.recordsSubscribers.get(id);\n if (sub && !sub.updated.includes(callback)) {\n sub.updated.push(callback);\n }\n }\n offUpdate(callback) {\n let id = that.getId(this);\n let sub = that.recordsSubscribers.get(id);\n if (sub) {\n let index = sub.updated.indexOf(callback);\n if (index != -1) {\n sub.updated.splice(index, 1);\n }\n }\n }\n async delete() {\n let id = that.getId(this);\n await that.deleteById(id);\n }\n async deleteWithError() {\n const result = new VoidRamWithError();\n let queryId = that.getIdWithError(this);\n if (!queryId.success || !queryId.result) {\n result.errors = queryId.errors;\n return result;\n }\n const queryDelete = await that.deleteByIdWithError(queryId.result);\n result.errors = queryDelete.errors;\n return result;\n }\n onDelete(callback) {\n let id = that.getId(this);\n if (!that.recordsSubscribers.has(id)) {\n that.recordsSubscribers.set(id, {\n created: [],\n updated: [],\n deleted: []\n });\n }\n let sub = that.recordsSubscribers.get(id);\n if (sub && !sub.deleted.includes(callback)) {\n sub.deleted.push(callback);\n }\n }\n offDelete(callback) {\n let id = that.getId(this);\n let sub = that.recordsSubscribers.get(id);\n if (sub) {\n let index = sub.deleted.indexOf(callback);\n if (index != -1) {\n sub.deleted.splice(index, 1);\n }\n }\n }\n };\n }\n /**\n * Define all the types you ram is capable of\n */\n ramForTypes() {\n return [this.getTypeForData({})];\n }\n /**\n * Transform the object into the object stored inside Ram\n */\n getObjectForRam(objJson) {\n let Item = this.addRamAction(this.getTypeForData(objJson));\n let item = new Item();\n this.mergeObject(item, objJson);\n return item;\n }\n // onCreated: (item: any) => void;\n // onUpdated: (item: any) => void;\n // onDeleted: (item: any) => void;\n // }> = new Map();\n // private linkInfo: { [key: string | number]: { [id: string | number]: Request[]; }; } = {};\n // private linkRamItem(item: Request) {\n // for(let key in this.ramMapping) {\n // this.linkRamItemByKey(item, key);\n // private linkRamItemByKey(item: Request, key: string) {\n // if(key in item) {\n // if(mapping.asArray) {\n // if(Array.isArray(item[key])) {\n // console.error(key + \" in type \" + item + \" must be an array\");\n // const id = mapping.ram.getId(item[key]);\n // if(!this.linkFct.has(mapping.ram)) {\n // onCreated: (item) => {\n // onUpdated: (item) => {\n // onDeleted: (item) => {\n // this.linkFct.set(mapping.ram, fcts);\n // mapping.ram.onCreated(fcts.onCreated);\n // mapping.ram.onUpdated(fcts.onUpdated);\n // mapping.ram.onDeleted(fcts.onDeleted);\n // if(!this.linkInfo[key])\n // if(!this.linkInfo[key][id])\n // this.linkInfo[key][id].push(item);\n /**\n * Add element inside Ram or update it. The instance inside the ram is unique and ll never be replaced\n */\n async addOrUpdateData(item) {\n const resultTemp = new ResultWithError();\n try {\n const id = resultTemp.extract(() => this.getIdWithError(item));\n if (id === undefined)\n return resultTemp;\n if (this.records.has(id)) {\n let uniqueRecord = this.records.get(id);\n await resultTemp.runAsync(() => this.beforeRecordSet(uniqueRecord));\n // this.unlinkRamItem(uniqueRecord);\n if (resultTemp.success)\n this.mergeObject(uniqueRecord, item);\n await resultTemp.runAsync(() => this.afterRecordSet(uniqueRecord));\n // this.linkRamItem(uniqueRecord);\n resultTemp.result = {\n kind: 'updated',\n value: this.records.get(id)\n };\n }\n else {\n let realObject = this.getObjectForRam(item);\n await resultTemp.runAsync(() => this.beforeRecordSet(realObject));\n this.records.set(id, realObject);\n await resultTemp.runAsync(() => this.afterRecordSet(realObject));\n // this.linkRamItem(realObject);\n resultTemp.result = {\n kind: 'created',\n value: this.records.get(id)\n };\n }\n }\n catch (e) {\n resultTemp.errors.push(new RamError(RamErrorCode.unknow, e));\n }\n return resultTemp;\n }\n /**\n * Merge object and create real instance of class\n */\n mergeObject(item, objJson, options) {\n if (!item) {\n return;\n }\n if (!options) {\n options = {\n replaceUndefined: true\n };\n }\n Json.classFromJson(item, objJson, options);\n }\n /**\n * Create or update the item\n */\n async save(item, ...args) {\n let action = await this.saveWithError(item, ...args);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Create or update the item\n */\n async saveWithError(item, ...args) {\n let action = new ResultRamWithError();\n const id = action.extract(() => this.getIdWithError(item));\n if (id !== undefined) {\n if (id) {\n return this.updateWithError(item, ...args);\n }\n else {\n return this.createWithError(item, ...args);\n }\n }\n return action;\n }\n async beforeRecordSet(item) {\n return new VoidWithError();\n }\n async afterRecordSet(item) {\n return new VoidWithError();\n }\n async beforeRecordDelete(item) {\n return new VoidWithError();\n }\n async afterRecordDelete(item) {\n return new VoidWithError();\n }\n publish(type, data) {\n let callbacks = [...this.subscribers[type]];\n for (let callback of callbacks) {\n callback(data);\n }\n let sub = this.recordsSubscribers.get(this.getId(data));\n if (sub) {\n let localCallbacks = [...sub[type]];\n for (let localCallback of localCallbacks) {\n localCallback(data);\n }\n }\n }\n subscribe(type, cb) {\n if (!this.subscribers[type].includes(cb)) {\n this.subscribers[type].push(cb);\n }\n }\n unsubscribe(type, cb) {\n let index = this.subscribers[type].indexOf(cb);\n if (index != -1) {\n this.subscribers[type].splice(index, 1);\n }\n }\n /**\n * Add a callback that ll be triggered when a new item is stored\n */\n onCreated(cb) {\n this.subscribe('created', cb);\n }\n /**\n * Remove a created callback\n */\n offCreated(cb) {\n this.unsubscribe('created', cb);\n }\n /**\n * Add a callback that ll be triggered when an item is updated\n */\n onUpdated(cb) {\n this.subscribe('updated', cb);\n }\n /**\n * Remove an updated callback\n */\n offUpdated(cb) {\n this.unsubscribe('updated', cb);\n }\n /**\n * Add a callback that ll be triggered when an item is deleted\n */\n onDeleted(cb) {\n this.subscribe('deleted', cb);\n }\n /**\n * Remove an deleted callback\n */\n offDeleted(cb) {\n this.unsubscribe('deleted', cb);\n }\n /**\n * Get an item by id if exist (alias for getById)\n */\n async get(id) {\n return await this.getById(id);\n }\n ;\n /**\n * Get an item by id if exist (alias for getById)\n */\n async getWithError(id) {\n return await this.getByIdWithError(id);\n }\n ;\n /**\n * Get an item by id if exist\n */\n async getById(id) {\n let action = await this.getByIdWithError(id);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Get an item by id if exist\n */\n async getByIdWithError(id) {\n return this.actionGuard.run(['getByIdWithError', id], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeGetById(id));\n if (action.success) {\n if (this.records.has(id)) {\n const item = this.records.get(id);\n action.result = item;\n await action.runAsync(() => this.afterGetById(item));\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't find the item \" + id + \" inside ram\"));\n }\n }\n return action;\n });\n }\n /**\n * Trigger before getting an item by id\n */\n async beforeGetById(id) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after getting an item by id\n */\n async afterGetById(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Get multiple items by ids\n */\n async getByIds(ids) {\n let result = await this.getByIdsWithError(ids);\n if (result.success) {\n return result.result ?? [];\n }\n return [];\n }\n ;\n /**\n * Get multiple items by ids\n */\n async getByIdsWithError(ids) {\n return this.actionGuard.run(['getByIdsWithError', ids], async () => {\n const action = new ResultRamWithError();\n await action.runAsync(() => this.beforeGetByIds(ids));\n if (action.success) {\n const result = [];\n for (let id of ids) {\n let rec = this.records.get(id);\n if (rec) {\n result.push(rec);\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't find the item \" + id + \" inside ram\"));\n }\n }\n if (action.success) {\n action.result = result;\n await action.runAsync(() => this.afterGetByIds(result));\n }\n }\n return action;\n });\n }\n ;\n /**\n * Trigger before getting a list of items by id\n */\n async beforeGetByIds(ids) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after getting a list of items by id\n */\n async afterGetByIds(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getAll() {\n let result = await this.getAllWithError();\n if (result.success) {\n return result.result ?? [];\n }\n return [];\n }\n /**\n * Get all elements inside the Ram\n */\n async getAllWithError() {\n return this.actionGuard.run(['getAllWithError'], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeGetAll());\n if (action.success) {\n const result = Object.values(this.records);\n action.result = result;\n await action.runAsync(() => this.afterGetAll(result));\n }\n return action;\n });\n }\n /**\n * Trigger before getting all items inside Ram\n */\n async beforeGetAll() {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after getting all items inside Ram\n */\n async afterGetAll(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getList() {\n return await this.getAll();\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getListWithError() {\n return await this.getAllWithError();\n }\n /**\n * Get all elements inside the Ram\n */\n async getRecords() {\n const result = await this.getRecordsWithError();\n if (result.success) {\n return result.result ?? new Map();\n }\n return new Map();\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getRecordsWithError() {\n let action = new ResultRamWithError();\n action.runAsync(() => this.getAllWithError());\n if (action.success) {\n action.result = this.records;\n }\n return action;\n }\n /**\n * Create a list of items inside ram\n */\n async createList(list) {\n let result = await this.createListWithError(list);\n return result.result ?? [];\n }\n /**\n * Create a list of items inside ram\n */\n async createListWithError(list) {\n list = this.removeWatch(list);\n return this.actionGuard.run(['_createList'], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeCreateList(list));\n for (let item of list) {\n await action.runAsync(() => this.beforeCreateItem(item, true));\n }\n const resources = await action.extractAsync(() => this.transformCreateRequestListToItem(list));\n if (!resources)\n return action;\n const result = [];\n for (let item of resources) {\n const resultItem = await action.extractAsync(() => this.addOrUpdateData(item));\n if (!resultItem)\n return action;\n await action.runAsync(() => this.afterCreateItem(resultItem.value, true));\n if (action.success) {\n result.push(resultItem.value);\n this.publish('created', resultItem.value);\n }\n }\n action.result = result;\n await action.runAsync(() => this.afterCreateList(result));\n return action;\n });\n }\n /**\n * Create an item inside ram\n */\n async create(item, ...args) {\n let action = await this.createWithError(item, args);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Create an item inside ram\n */\n async createWithError(item, ...args) {\n item = this.removeWatch(item);\n return this.actionGuard.run(['_create', item], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeCreateItem(item, false));\n const resource = await action.extractAsync(() => this.transformCreateRequestToItem(item));\n if (!resource)\n return action;\n const id = await action.extract(() => this.getIdWithError(resource));\n if (id !== undefined) {\n const resultTemp = await action.extractAsync(() => this.addOrUpdateData(resource));\n if (!resultTemp)\n return action;\n await action.runAsync(() => this.afterCreateItem(resultTemp.value, false));\n if (action.success) {\n action.result = resultTemp.value;\n this.publish('created', resultTemp.value);\n }\n }\n return action;\n });\n }\n /**\n * Trigger before creating a list of items\n */\n async beforeCreateList(list) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger before creating an item\n */\n async beforeCreateItem(item, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after creating an item\n */\n async afterCreateItem(result, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after creating a list of items\n */\n async afterCreateList(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Update a list of items inside ram\n */\n async updateList(list) {\n let result = await this.updateListWithError(list);\n return result.result ?? [];\n }\n ;\n /**\n * Update a list of items inside ram\n */\n async updateListWithError(list) {\n list = this.removeWatch(list);\n return this.actionGuard.run(['_updateList'], async () => {\n let action = new ResultRamWithError();\n await action.runAsync(() => this.beforeUpdateList(list));\n for (let item of list) {\n await action.runAsync(() => this.beforeUpdateItem(item, true));\n }\n const resources = await action.extractAsync(() => this.transformUpdateRequestListToItem(list));\n if (!resources)\n return action;\n const result = [];\n for (let item of resources) {\n const resultItem = await action.extractAsync(() => this.addOrUpdateData(item));\n if (!resultItem)\n return action;\n await action.runAsync(() => this.afterUpdateItem(resultItem.value, true));\n if (action.success) {\n result.push(resultItem.value);\n this.publish('created', resultItem.value);\n }\n }\n action.result = result;\n await action.runAsync(() => this.afterUpdateList(result));\n return action;\n });\n }\n ;\n /**\n * Update an item inside ram\n */\n async update(item, ...args) {\n let action = await this.updateWithError(item, args);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Update an item inside ram\n */\n async updateWithError(item, ...args) {\n item = this.removeWatch(item);\n return this.actionGuard.run(['_update', item], async () => {\n let action = new ResultRamWithError();\n const id = await action.extract(() => this.getIdWithError(item));\n if (id === undefined)\n return action;\n if (this.records.has(id)) {\n const currentEl = this.records.get(id);\n if (currentEl == item) {\n console.warn(\"You are updating the same item. You should clone the object first to avoid weird effect\");\n }\n await action.runAsync(() => this.beforeUpdateItem(item, false));\n const resource = await action.extractAsync(() => this.transformUpdateRequestToItem(item));\n if (!resource)\n return action;\n const resultTemp = await action.extractAsync(() => this.addOrUpdateData(resource));\n if (!resultTemp)\n return action;\n await action.runAsync(() => this.afterUpdateItem(resultTemp.value, false));\n if (action.success) {\n action.result = resultTemp.value;\n this.publish('updated', resultTemp.value);\n }\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't update the item \" + id + \" because it wasn't found inside ram\"));\n }\n return action;\n });\n }\n /**\n * Trigger before updating a list of items\n */\n async beforeUpdateList(list) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger before updating an item\n */\n async beforeUpdateItem(item, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after updating an item\n */\n async afterUpdateItem(result, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after updating a list of items\n */\n async afterUpdateList(result) {\n return new VoidWithError();\n }\n ;\n /**\n * Delete a list of items inside ram\n */\n async deleteList(list) {\n let result = await this.deleteListWithError(list);\n return result.result ?? [];\n }\n ;\n /**\n * Delete a list of items inside ram\n */\n async deleteListWithError(list) {\n list = this.removeWatch(list);\n let action = new ResultRamWithError();\n action.result = [];\n await action.runAsync(() => this.beforeDeleteList(list));\n const result = [];\n for (let item of list) {\n const resultItem = await action.extractAsync(() => this._delete(item, true));\n if (!resultItem)\n return action;\n result.push(resultItem);\n }\n if (action.success) {\n action.result = result;\n await action.runAsync(() => this.afterDeleteList(result));\n }\n return action;\n }\n ;\n /**\n * Delete an item inside ram\n */\n async delete(item, ...args) {\n let action = await this.deleteWithError(item, args);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n ;\n /**\n * Delete an item inside ram\n */\n async deleteWithError(item, ...args) {\n return await this._delete(item, false);\n }\n ;\n /**\n * Delete an item by id inside ram\n */\n async deleteById(id) {\n let action = await this.deleteByIdWithError(id);\n if (action.success) {\n return action.result;\n }\n return undefined;\n }\n /**\n * Delete an item by id inside ram\n */\n async deleteByIdWithError(id) {\n let item = this.records.get(id);\n if (item) {\n return await this._delete(item, false);\n }\n let result = new ResultRamWithError();\n result.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't delete the item \" + id + \" because it wasn't found inside ram\"));\n return result;\n }\n async _delete(item, fromList) {\n item = this.removeWatch(item);\n return this.actionGuard.run(['_delete', item], async () => {\n let action = new ResultRamWithError();\n const id = action.extract(() => this.getIdWithError(item));\n if (id === undefined)\n return action;\n let oldItem = this.records.get(id);\n if (oldItem) {\n await action.runAsync(() => this.beforeDeleteItem(oldItem, fromList));\n await action.runAsync(() => this.beforeRecordDelete(oldItem));\n this.records.delete(id);\n await action.runAsync(() => this.afterRecordDelete(oldItem));\n await action.runAsync(() => this.afterDeleteItem(oldItem, fromList));\n if (action.success) {\n action.result = oldItem;\n this.publish('deleted', oldItem);\n }\n this.recordsSubscribers.delete(id);\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't delete the item \" + id + \" because it wasn't found inside ram\"));\n }\n return action;\n });\n }\n /**\n * Trigger before deleting a list of items\n */\n async beforeDeleteList(list) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger before deleting an item\n */\n async beforeDeleteItem(item, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after deleting an item\n */\n async afterDeleteItem(result, fromList) {\n return new VoidWithError();\n }\n ;\n /**\n * Trigger after deleting a list of items\n */\n async afterDeleteList(result) {\n return new VoidWithError();\n }\n}\nGenericRam.Namespace=`Aventus`;\n__as1(_, 'GenericRam', GenericRam);\n","dependencies":[{"fullName":"Aventus.IRam","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.IRamData","isStrong":false},{"fullName":"Aventus.Request","isStrong":false},{"fullName":"Aventus.KeysObject","isStrong":false},{"fullName":"Aventus.Resource","isStrong":false},{"fullName":"Aventus.RamSubscribers","isStrong":false},{"fullName":"Aventus.RamItem","isStrong":false},{"fullName":"Aventus.ActionGuard","isStrong":false},{"fullName":"InternalProtected","isStrong":false},{"fullName":"BindThis","isStrong":false},{"fullName":"Aventus.ResultRamWithError","isStrong":false},{"fullName":"Aventus.RamError","isStrong":false},{"fullName":"Aventus.RamErrorCode","isStrong":false},{"fullName":"X","isStrong":false},{"fullName":"B","isStrong":false},{"fullName":"Base","isStrong":false},{"fullName":"Aventus.IRamAction","isStrong":false},{"fullName":"Aventus.VoidRamWithError","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.JsonFromOptions","isStrong":false},{"fullName":"Aventus.Json","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false}],"fullName":"Aventus.GenericRam","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Ram=class Ram extends GenericRam {\n}\nRam.Namespace=`Aventus`;\n__as1(_, 'Ram', Ram);\n","dependencies":[{"fullName":"Aventus.GenericRam","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.IRamData","isStrong":false},{"fullName":"Aventus.Request","isStrong":false},{"fullName":"Aventus.Resource","isStrong":false}],"fullName":"Aventus.Ram","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let StateManager=class StateManager {\n subscribers = {};\n static canBeActivate(statePattern, stateName) {\n let stateInfo = Uri.prepare(statePattern);\n return stateInfo.regex.test(stateName);\n }\n activeState;\n changeStateMutex = new Mutex();\n canChangeStateCbs = [];\n afterStateChanged = new Callback();\n /**\n * Subscribe actions for a state or a state list\n */\n subscribe(statePatterns, callbacks, autoActiveState = true) {\n if (!callbacks.active && !callbacks.inactive && !callbacks.askChange) {\n this._log(`Trying to subscribe to state : ${statePatterns} with no callbacks !`, \"warning\");\n return;\n }\n if (!Array.isArray(statePatterns)) {\n statePatterns = [statePatterns];\n }\n for (let statePattern of statePatterns) {\n if (!this.subscribers.hasOwnProperty(statePattern)) {\n let res = Uri.prepare(statePattern);\n let isActive = this.activeState !== undefined && res.regex.test(this.activeState.name);\n this.subscribers[statePattern] = {\n \"regex\": res.regex,\n \"params\": res.params,\n \"callbacks\": {\n \"active\": [],\n \"inactive\": [],\n \"askChange\": [],\n },\n \"isActive\": isActive,\n };\n }\n if (callbacks.active) {\n if (!Array.isArray(callbacks.active)) {\n callbacks.active = [callbacks.active];\n }\n for (let activeFct of callbacks.active) {\n this.subscribers[statePattern].callbacks.active.push(activeFct);\n if (this.subscribers[statePattern].isActive && this.activeState && autoActiveState) {\n let slugs = Uri.getParams(this.subscribers[statePattern], this.activeState.name);\n if (slugs) {\n activeFct(this.activeState, slugs);\n }\n }\n }\n }\n if (callbacks.inactive) {\n if (!Array.isArray(callbacks.inactive)) {\n callbacks.inactive = [callbacks.inactive];\n }\n for (let inactiveFct of callbacks.inactive) {\n this.subscribers[statePattern].callbacks.inactive.push(inactiveFct);\n }\n }\n if (callbacks.askChange) {\n if (!Array.isArray(callbacks.askChange)) {\n callbacks.askChange = [callbacks.askChange];\n }\n for (let askChangeFct of callbacks.askChange) {\n this.subscribers[statePattern].callbacks.askChange.push(askChangeFct);\n }\n }\n }\n }\n /**\n *\n */\n activateAfterSubscribe(statePatterns, callbacks) {\n if (!Array.isArray(statePatterns)) {\n statePatterns = [statePatterns];\n }\n for (let statePattern of statePatterns) {\n if (callbacks.active) {\n if (!Array.isArray(callbacks.active)) {\n callbacks.active = [callbacks.active];\n }\n for (let activeFct of callbacks.active) {\n if (this.subscribers[statePattern].isActive && this.activeState) {\n let slugs = Uri.getParams(this.subscribers[statePattern], this.activeState.name);\n if (slugs) {\n activeFct(this.activeState, slugs);\n }\n }\n }\n }\n }\n }\n /**\n * Unsubscribe actions for a state or a state list\n */\n unsubscribe(statePatterns, callbacks) {\n if (!callbacks.active && !callbacks.inactive && !callbacks.askChange) {\n this._log(`Trying to unsubscribe to state : ${statePatterns} with no callbacks !`, \"warning\");\n return;\n }\n if (!Array.isArray(statePatterns)) {\n statePatterns = [statePatterns];\n }\n for (let statePattern of statePatterns) {\n if (this.subscribers[statePattern]) {\n if (callbacks.active) {\n if (!Array.isArray(callbacks.active)) {\n callbacks.active = [callbacks.active];\n }\n for (let activeFct of callbacks.active) {\n let index = this.subscribers[statePattern].callbacks.active.indexOf(activeFct);\n if (index !== -1) {\n this.subscribers[statePattern].callbacks.active.splice(index, 1);\n }\n }\n }\n if (callbacks.inactive) {\n if (!Array.isArray(callbacks.inactive)) {\n callbacks.inactive = [callbacks.inactive];\n }\n for (let inactiveFct of callbacks.inactive) {\n let index = this.subscribers[statePattern].callbacks.inactive.indexOf(inactiveFct);\n if (index !== -1) {\n this.subscribers[statePattern].callbacks.inactive.splice(index, 1);\n }\n }\n }\n if (callbacks.askChange) {\n if (!Array.isArray(callbacks.askChange)) {\n callbacks.askChange = [callbacks.askChange];\n }\n for (let askChangeFct of callbacks.askChange) {\n let index = this.subscribers[statePattern].callbacks.askChange.indexOf(askChangeFct);\n if (index !== -1) {\n this.subscribers[statePattern].callbacks.askChange.splice(index, 1);\n }\n }\n }\n if (this.subscribers[statePattern].callbacks.active.length === 0 &&\n this.subscribers[statePattern].callbacks.inactive.length === 0 &&\n this.subscribers[statePattern].callbacks.askChange.length === 0) {\n delete this.subscribers[statePattern];\n }\n }\n }\n }\n onAfterStateChanged(cb) {\n this.afterStateChanged.add(cb);\n }\n offAfterStateChanged(cb) {\n this.afterStateChanged.remove(cb);\n }\n assignDefaultState(stateName) {\n return new EmptyState(stateName);\n }\n canChangeState(cb) {\n this.canChangeStateCbs.push(cb);\n }\n /**\n * Activate a current state\n */\n async setState(state) {\n let result = await this.changeStateMutex.safeRunLastAsync(async () => {\n let stateToUse;\n if (typeof state == \"string\") {\n stateToUse = this.assignDefaultState(state);\n }\n else {\n stateToUse = state;\n }\n if (!stateToUse) {\n this._log(\"state is undefined\", \"error\");\n this.changeStateMutex.release();\n return false;\n }\n for (let cb of this.canChangeStateCbs) {\n if (!(await cb(stateToUse))) {\n return false;\n }\n }\n let canChange = true;\n if (this.activeState) {\n let activeToInactive = [];\n let inactiveToActive = [];\n let triggerActive = [];\n canChange = await this.activeState.askChange(this.activeState, stateToUse);\n if (canChange) {\n for (let statePattern in this.subscribers) {\n let subscriber = this.subscribers[statePattern];\n if (subscriber.isActive) {\n let clone = [...subscriber.callbacks.askChange];\n let currentSlug = Uri.getParams(subscriber, this.activeState.name);\n if (currentSlug) {\n for (let i = 0; i < clone.length; i++) {\n let askChange = clone[i];\n if (!await askChange(this.activeState, stateToUse, currentSlug)) {\n canChange = false;\n break;\n }\n }\n }\n let slugs = Uri.getParams(subscriber, stateToUse.name);\n if (slugs === null) {\n activeToInactive.push(subscriber);\n }\n else {\n triggerActive.push({\n subscriber: subscriber,\n params: slugs\n });\n }\n }\n else {\n let slugs = Uri.getParams(subscriber, stateToUse.name);\n if (slugs) {\n inactiveToActive.push({\n subscriber,\n params: slugs\n });\n }\n }\n if (!canChange) {\n break;\n }\n }\n }\n if (canChange) {\n const oldState = this.activeState;\n this.activeState = stateToUse;\n oldState.onInactivate(stateToUse);\n for (let subscriber of activeToInactive) {\n subscriber.isActive = false;\n let oldSlug = Uri.getParams(subscriber, oldState.name);\n if (oldSlug) {\n let oldSlugNotNull = oldSlug;\n let callbacks = [...subscriber.callbacks.inactive];\n for (let callback of callbacks) {\n callback(oldState, stateToUse, oldSlugNotNull);\n }\n }\n }\n for (let trigger of triggerActive) {\n let callbacks = [...trigger.subscriber.callbacks.active];\n for (let callback of callbacks) {\n callback(stateToUse, trigger.params);\n }\n }\n for (let trigger of inactiveToActive) {\n trigger.subscriber.isActive = true;\n let callbacks = [...trigger.subscriber.callbacks.active];\n for (let callback of callbacks) {\n callback(stateToUse, trigger.params);\n }\n }\n stateToUse.onActivate();\n }\n }\n else {\n this.activeState = stateToUse;\n for (let key in this.subscribers) {\n let slugs = Uri.getParams(this.subscribers[key], stateToUse.name);\n if (slugs) {\n let slugsNotNull = slugs;\n this.subscribers[key].isActive = true;\n let callbacks = [...this.subscribers[key].callbacks.active];\n for (let callback of callbacks) {\n callback(stateToUse, slugsNotNull);\n }\n }\n }\n stateToUse.onActivate();\n }\n this.afterStateChanged.trigger();\n return true;\n });\n return result ?? false;\n }\n getState() {\n return this.activeState;\n }\n /**\n * Check if a state is in the subscribers and active, return true if it is, false otherwise\n */\n isStateActive(statePattern) {\n return Uri.isActive(statePattern, this.activeState?.name ?? '');\n }\n /**\n * Get slugs information for the current state, return null if state isn't active\n */\n getStateSlugs(statePattern) {\n return Uri.getParams(statePattern, this.activeState?.name ?? '');\n }\n // 0 = error only / 1 = errors and warning / 2 = error, warning and logs (not implemented)\n logLevel() {\n return 0;\n }\n _log(msg, type) {\n if (type === \"error\") {\n console.error(msg);\n }\n else if (type === \"warning\" && this.logLevel() > 0) {\n console.warn(msg);\n }\n else if (type === \"info\" && this.logLevel() > 1) {\n console.log(msg);\n }\n }\n}\nStateManager.Namespace=`Aventus`;\n__as1(_, 'StateManager', StateManager);\n","dependencies":[{"fullName":"Aventus.IStateManager","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Subscriber","isStrong":false},{"fullName":"Aventus.Uri","isStrong":false},{"fullName":"Aventus.Mutex","isStrong":false},{"fullName":"Aventus.Callback","isStrong":false},{"fullName":"Aventus.StateAction","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false},{"fullName":"Aventus.EmptyState","isStrong":false},{"fullName":"Aventus.State","isStrong":false}],"fullName":"Aventus.StateManager","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let State=class State {\n /**\n * Activate a custom state inside a specific manager\n * It ll be a generic state with no information inside exept name\n */\n static async activate(stateName, manager) {\n return await manager.setState(stateName);\n }\n /**\n * Activate this state inside a specific manager\n */\n async activate(manager) {\n return await manager.setState(this);\n }\n onActivate() {\n }\n onInactivate(nextState) {\n }\n async askChange(state, nextState) {\n return true;\n }\n}\nState.Namespace=`Aventus`;\n__as1(_, 'State', State);\n","dependencies":[{"fullName":"Aventus.IState","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateManager","isStrong":false},{"fullName":"Aventus.Asyncable","isStrong":false}],"fullName":"Aventus.State","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let EmptyState=class EmptyState extends State {\n localName;\n constructor(stateName) {\n super();\n this.localName = stateName;\n }\n /**\n * @inheritdoc\n */\n get name() {\n return this.localName;\n }\n}\nEmptyState.Namespace=`Aventus`;\n__as1(_, 'EmptyState', EmptyState);\n","dependencies":[{"fullName":"Aventus.State","isStrong":true},{"fullName":"Aventus.IState","isStrong":true},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.EmptyState","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let TemplateInstance=class TemplateInstance {\n context;\n content;\n actions;\n component;\n _components = {};\n firstRenderUniqueCb = {};\n firstRenderCb = [];\n firstChild;\n lastChild;\n computeds = [];\n renderingComputeds = [];\n loopRegisteries = {};\n loops = [];\n ifs = [];\n isDestroyed = false;\n constructor(component, content, actions, loops, ifs, context) {\n this.component = component;\n this.content = content;\n this.actions = actions;\n this.ifs = ifs;\n this.loops = loops;\n this.context = context ? context : new TemplateContext(component);\n this.firstChild = content.firstElementChild;\n this.lastChild = content.lastElementChild;\n this.selectElements();\n this.transformActionsListening();\n }\n render() {\n this.updateContext();\n this.bindEvents();\n for (let cb of this.firstRenderCb) {\n cb();\n }\n for (let key in this.firstRenderUniqueCb) {\n this.firstRenderUniqueCb[key]();\n }\n this.renderSubTemplate();\n }\n destructor() {\n this.isDestroyed = true;\n for (let name in this.loopRegisteries) {\n let register = this.loopRegisteries[name];\n for (let item of register.templates) {\n item.destructor();\n }\n for (let item of register.computeds) {\n item.destroy();\n }\n if (register.unsub) {\n register.unsub();\n }\n }\n this.loopRegisteries = {};\n this.context.destructor();\n for (let computed of this.computeds) {\n computed.destroy();\n }\n for (let computed of this.renderingComputeds) {\n computed.destroy();\n }\n this.computeds = [];\n this.removeFromDOM();\n }\n removeFromDOM(avoidTrigger = false) {\n if (avoidTrigger) {\n let node = this.firstChild;\n while (node && node != this.lastChild) {\n let next = node.nextElementSibling;\n node.parentNode?.removeChild(node);\n node = next;\n }\n this.lastChild?.parentNode?.removeChild(this.lastChild);\n }\n else {\n let node = this.firstChild;\n while (node && node != this.lastChild) {\n let next = node.nextElementSibling;\n node.remove();\n node = next;\n }\n this.lastChild?.remove();\n }\n }\n selectElements() {\n this._components = {};\n let idEls = Array.from(this.content.querySelectorAll('[_id]'));\n for (let idEl of idEls) {\n let id = idEl.attributes['_id'].value;\n if (!this._components[id]) {\n this._components[id] = [];\n }\n this._components[id].push(idEl);\n }\n if (this.actions.elements) {\n for (let element of this.actions.elements) {\n let components = [];\n for (let id of element.ids) {\n if (this._components[id]) {\n components = [...components, ...this._components[id]];\n }\n }\n if (element.isArray) {\n setValueToObject(element.name, this.component, components);\n }\n else if (components[0]) {\n setValueToObject(element.name, this.component, components[0]);\n }\n }\n }\n }\n updateContext() {\n if (this.actions.contextEdits) {\n for (let contextEdit of this.actions.contextEdits) {\n this.renderContextEdit(contextEdit);\n }\n }\n }\n renderContextEdit(edit) {\n let _class = edit.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n try {\n return edit.fct(this.context);\n }\n catch (e) {\n }\n return {};\n });\n computed.subscribe((action, path, value, dones) => {\n for (let key in computed.value) {\n let newValue = computed.value[key];\n this.context.updateWatch(key, newValue, dones);\n }\n });\n this.computeds.push(computed);\n for (let key in computed.value) {\n this.context.registerWatch(key, computed.value[key]);\n }\n }\n bindEvents() {\n if (this.actions.events) {\n for (let event of this.actions.events) {\n this.bindEvent(event);\n }\n }\n if (this.actions.pressEvents) {\n for (let event of this.actions.pressEvents) {\n this.bindPressEvent(event);\n }\n }\n }\n bindEvent(event) {\n if (!this._components[event.id]) {\n return;\n }\n if (event.isCallback) {\n for (let el of this._components[event.id]) {\n let cb = getValueFromObject(event.eventName, el);\n if (!cb && el.tagName.includes('-')) {\n customElements.upgrade(el);\n cb = getValueFromObject(event.eventName, el);\n }\n cb?.add((...args) => {\n try {\n return event.fct(this.context, args);\n }\n catch (e) {\n console.error(e);\n }\n });\n }\n }\n else {\n for (let el of this._components[event.id]) {\n el.addEventListener(event.eventName, (e) => {\n try {\n event.fct(e, this.context);\n }\n catch (e) {\n console.error(e);\n }\n });\n }\n }\n }\n bindPressEvent(event) {\n let id = event['id'];\n if (id && this._components[id]) {\n let clone = {};\n for (let temp in event) {\n if (temp != 'id') {\n const ev = event;\n if (ev[temp] instanceof Function) {\n clone[temp] = (e, pressInstance) => { ev[temp](e, pressInstance, this.context); };\n }\n else {\n clone[temp] = ev[temp];\n }\n }\n }\n clone.element = this._components[id];\n PressManager.create(clone);\n }\n }\n transformActionsListening() {\n if (this.actions.content) {\n for (let name in this.actions.content) {\n this.transformChangeAction(name, this.actions.content[name]);\n }\n }\n if (this.actions.injection) {\n for (let injection of this.actions.injection) {\n this.transformInjectionAction(injection);\n }\n }\n if (this.actions.bindings) {\n for (let binding of this.actions.bindings) {\n this.transformBindigAction(binding);\n }\n }\n }\n transformChangeAction(name, change) {\n const [id, attr] = name.split(\"°\");\n if (!this._components[id])\n return;\n let apply = () => { };\n if (attr == \"@HTML\") {\n apply = () => {\n let value = this.context.print(computed.value);\n for (const el of this._components[id])\n el.innerHTML = value;\n };\n }\n else {\n apply = () => {\n let value = this.context.print(computed.value);\n if (value === \"false\") {\n for (const el of this._components[id]) {\n el.removeAttribute(attr);\n }\n }\n else {\n for (const el of this._components[id]) {\n el.setAttribute(attr, value);\n }\n }\n };\n }\n let _class = change.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n try {\n return change.fct(this.context);\n }\n catch (e) {\n if (e instanceof TypeError && e.message.includes(\"undefined\")) {\n if (computed instanceof ComputedNoRecomputed) {\n computed.isInit = false;\n }\n }\n else {\n console.error(e);\n }\n }\n return \"\";\n });\n let timeout;\n computed.subscribe((action, path, value, dones) => {\n clearTimeout(timeout);\n // add timeout to group change that append on the same frame (for example index update)\n timeout = setTimeout(() => {\n if (computed.isDestroy)\n return;\n apply();\n });\n });\n this.renderingComputeds.push(computed);\n this.firstRenderUniqueCb[name] = () => {\n apply();\n };\n }\n transformInjectionAction(injection) {\n if (!this._components[injection.id])\n return;\n let _class = injection.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n try {\n return injection.inject(this.context);\n }\n catch (e) {\n if (e instanceof TypeError && e.message.includes(\"undefined\")) {\n if (computed instanceof ComputedNoRecomputed) {\n computed.isInit = false;\n }\n }\n else {\n console.error(e);\n }\n }\n });\n this.computeds.push(computed);\n computed.subscribe((action, path, value, dones) => {\n for (const el of this._components[injection.id]) {\n if (el instanceof WebComponent && el.__watch && Object.hasOwn(el.__watch, injection.injectionName)) {\n el.__watch.__injectedDones(dones);\n }\n el[injection.injectionName] = computed.value;\n }\n });\n this.firstRenderCb.push(() => {\n for (const el of this._components[injection.id]) {\n customElements.upgrade(el);\n el[injection.injectionName] = computed.value;\n }\n });\n }\n transformBindigAction(binding) {\n let isLocalChange = false;\n let _class = binding.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n try {\n return binding.inject(this.context);\n }\n catch (e) {\n if (e instanceof TypeError && e.message.includes(\"undefined\")) {\n if (computed instanceof ComputedNoRecomputed) {\n computed.isInit = false;\n }\n }\n else {\n console.error(e);\n }\n }\n });\n this.computeds.push(computed);\n computed.subscribe((action, path, value, dones) => {\n if (isLocalChange)\n return;\n for (const el of this._components[binding.id]) {\n if (el instanceof WebComponent && el.__watch && Object.hasOwn(el.__watch, binding.injectionName)) {\n el.__watch.__injectedDones(dones);\n }\n el[binding.injectionName] = computed.value;\n }\n });\n this.firstRenderCb.push(() => {\n for (const el of this._components[binding.id]) {\n customElements.upgrade(el);\n el[binding.injectionName] = computed.value;\n }\n });\n if (binding.isCallback) {\n this.firstRenderCb.push(() => {\n for (var el of this._components[binding.id]) {\n for (let fct of binding.eventNames) {\n let cb = getValueFromObject(fct, el);\n if (!cb && el.tagName.includes('-')) {\n customElements.upgrade(el);\n cb = getValueFromObject(binding.injectionName, el);\n }\n cb?.add((value) => {\n let valueToSet = getValueFromObject(binding.injectionName, el);\n isLocalChange = true;\n binding.extract(this.context, valueToSet);\n isLocalChange = false;\n });\n }\n }\n });\n }\n else {\n this.firstRenderCb.push(() => {\n for (var el of this._components[binding.id]) {\n customElements.upgrade(el);\n for (let fct of binding.eventNames) {\n el.addEventListener(fct, (e) => {\n let valueToSet = getValueFromObject(binding.injectionName, e.target);\n isLocalChange = true;\n binding.extract(this.context, valueToSet);\n isLocalChange = false;\n });\n }\n }\n });\n }\n }\n renderSubTemplate() {\n for (let loop of this.loops) {\n this.renderLoop(loop);\n }\n for (let _if of this.ifs) {\n this.renderIf(_if);\n }\n }\n renderLoop(loop) {\n if (loop.func) {\n this.renderLoopComplex(loop);\n }\n else if (loop.simple) {\n this.renderLoopSimple(loop, loop.simple);\n }\n }\n resetLoopComplex(anchorId) {\n if (this.loopRegisteries[anchorId]) {\n for (let item of this.loopRegisteries[anchorId].templates) {\n item.destructor();\n }\n for (let item of this.loopRegisteries[anchorId].computeds) {\n item.destroy();\n }\n }\n this.loopRegisteries[anchorId] = {\n templates: [],\n computeds: [],\n };\n }\n renderLoopComplex(loop) {\n if (!loop.func)\n return;\n let fctsTemp = loop.func.bind(this.component)(this.context);\n let fcts = {\n apply: fctsTemp.apply,\n condition: fctsTemp.condition,\n transform: fctsTemp.transform ?? (() => { })\n };\n this.resetLoopComplex(loop.anchorId);\n let computedsCondition = [];\n let alreadyRecreated = false;\n const createComputedCondition = () => {\n let compCondition = new Computed(() => {\n return fcts.condition();\n });\n compCondition.value;\n compCondition.subscribe((action, path, value) => {\n if (!alreadyRecreated) {\n alreadyRecreated = true;\n this.renderLoopComplex(loop);\n }\n });\n computedsCondition.push(compCondition);\n this.loopRegisteries[loop.anchorId].computeds.push(compCondition);\n return compCondition;\n };\n let result = [];\n let compCondition = createComputedCondition();\n while (compCondition.value) {\n result.push(fcts.apply());\n fcts.transform();\n compCondition = createComputedCondition();\n }\n let anchor = this._components[loop.anchorId][0];\n for (let i = 0; i < result.length; i++) {\n let context = new TemplateContext(this.component, result[i], this.context, this.loopRegisteries[loop.anchorId]);\n let content = loop.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = loop.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, loop.template.loops, loop.template.ifs, context);\n instance.render();\n anchor.parentNode?.insertBefore(instance.content, anchor);\n this.loopRegisteries[loop.anchorId].templates.push(instance);\n }\n }\n resetLoopSimple(anchorId, basePath) {\n let register = this.loopRegisteries[anchorId];\n if (register?.unsub) {\n register.unsub();\n }\n this.resetLoopComplex(anchorId);\n }\n renderLoopSimple(loop, simple) {\n let onThis = simple.data.startsWith(\"this.\");\n let basePath = this.context.normalizePath(simple.data);\n this.resetLoopSimple(loop.anchorId, basePath);\n let getElements = () => this.context.getValueFromItem(basePath);\n let elements = getElements();\n if (!elements) {\n let currentPath = basePath;\n while (currentPath != '' && !elements) {\n let splittedPath = currentPath.split(\".\");\n splittedPath.pop();\n currentPath = splittedPath.join(\".\");\n elements = this.context.getValueFromItem(currentPath);\n }\n if (!elements && onThis) {\n const splittedPath = basePath.split(\".\");\n const firstPart = splittedPath.length > 0 ? splittedPath[0] : null;\n if (firstPart && this.component.__signals[firstPart]) {\n elements = this.component.__signals[firstPart];\n }\n else {\n elements = this.component.__watch;\n }\n }\n if (!elements || !(elements.__isProxy || elements instanceof Signal)) {\n debugger;\n }\n const subTemp = (action, path, value) => {\n if (basePath.startsWith(path) || path == \"*\") {\n elements.unsubscribe(subTemp);\n this.renderLoopSimple(loop, simple);\n return;\n }\n };\n elements.subscribe(subTemp);\n return;\n }\n let indexName = this.context.registerIndex();\n let keys = Object.keys(elements);\n if (elements.__isProxy) {\n let regexArray = new RegExp(\"^\\\\[(\\\\d+?)\\\\]$\");\n let regexObject = new RegExp(\"^([^\\\\.]*)$\");\n let sub = (action, path, value) => {\n if (this.isDestroyed)\n return;\n if (path == \"\") {\n this.renderLoopSimple(loop, simple);\n return;\n }\n if (action == WatchAction.UPDATED) {\n return;\n }\n let index = undefined;\n regexArray.lastIndex = 0;\n regexObject.lastIndex = 0;\n let resultArray = regexArray.exec(path);\n if (resultArray) {\n index = Number(resultArray[1]);\n }\n else {\n let resultObject = regexObject.exec(path);\n if (resultObject) {\n let oldKey = resultObject[1];\n if (action == WatchAction.CREATED) {\n keys = Object.keys(getElements());\n index = keys.indexOf(oldKey);\n }\n else if (action == WatchAction.DELETED) {\n index = keys.indexOf(oldKey);\n keys = Object.keys(getElements());\n }\n }\n }\n if (index !== undefined) {\n let registry = this.loopRegisteries[loop.anchorId];\n if (action == WatchAction.CREATED) {\n let context = new TemplateContext(this.component, {}, this.context, registry);\n context.registerLoop(basePath, index, indexName, simple.index, simple.item, onThis);\n let content = loop.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = loop.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, loop.template.loops, loop.template.ifs, context);\n instance.render();\n let anchor;\n if (index < registry.templates.length) {\n anchor = registry.templates[index].firstChild;\n }\n else {\n anchor = this._components[loop.anchorId][0];\n }\n anchor?.parentNode?.insertBefore(instance.content, anchor);\n registry.templates.splice(index, 0, instance);\n for (let i = index + 1; i < registry.templates.length; i++) {\n registry.templates[i].context.increaseIndex(indexName);\n }\n }\n else if (action == WatchAction.DELETED) {\n registry.templates[index].destructor();\n registry.templates.splice(index, 1);\n for (let i = index; i < registry.templates.length; i++) {\n registry.templates[i].context.decreaseIndex(indexName);\n }\n }\n }\n };\n this.loopRegisteries[loop.anchorId].unsub = () => {\n elements.unsubscribe(sub);\n };\n elements.subscribe(sub);\n }\n let anchor = this._components[loop.anchorId][0];\n for (let i = 0; i < keys.length; i++) {\n let context = new TemplateContext(this.component, {}, this.context, this.loopRegisteries[loop.anchorId]);\n context.registerLoop(basePath, i, indexName, simple.index, simple.item, onThis);\n let content = loop.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = loop.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, loop.template.loops, loop.template.ifs, context);\n instance.render();\n anchor.parentNode?.insertBefore(instance.content, anchor);\n this.loopRegisteries[loop.anchorId].templates.push(instance);\n }\n }\n renderIf(_if) {\n // this.renderIfMemory(_if);\n this.renderIfRecreate(_if);\n }\n renderIfMemory(_if) {\n let computeds = [];\n let instances = [];\n if (!this._components[_if.anchorId] || this._components[_if.anchorId].length == 0)\n return;\n let anchor = this._components[_if.anchorId][0];\n let currentActive = -1;\n const calculateActive = () => {\n let newActive = -1;\n for (let i = 0; i < _if.parts.length; i++) {\n if (computeds[i].value) {\n newActive = i;\n break;\n }\n }\n if (newActive == currentActive) {\n return;\n }\n if (currentActive != -1) {\n let instance = instances[currentActive];\n let node = instance.firstChild;\n while (node && node != instance.lastChild) {\n let next = node.nextElementSibling;\n instance.content.appendChild(node);\n node = next;\n }\n if (instance.lastChild)\n instance.content.appendChild(instance.lastChild);\n }\n currentActive = newActive;\n if (instances[currentActive])\n anchor.parentNode?.insertBefore(instances[currentActive].content, anchor);\n };\n for (let i = 0; i < _if.parts.length; i++) {\n const part = _if.parts[i];\n let _class = part.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n return part.condition(this.context);\n });\n computeds.push(computed);\n computed.subscribe(() => {\n calculateActive();\n });\n this.computeds.push(computed);\n let context = new TemplateContext(this.component, {}, this.context);\n let content = part.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = part.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, part.template.loops, part.template.ifs, context);\n instances.push(instance);\n instance.render();\n }\n calculateActive();\n }\n renderIfRecreate(_if) {\n let computeds = [];\n if (!this._components[_if.anchorId] || this._components[_if.anchorId].length == 0)\n return;\n let anchor = this._components[_if.anchorId][0];\n let currentActive = undefined;\n let currentActiveNb = -1;\n const createContext = () => {\n if (currentActiveNb < 0 || currentActiveNb > _if.parts.length - 1) {\n currentActive = undefined;\n return;\n }\n const part = _if.parts[currentActiveNb];\n let context = new TemplateContext(this.component, {}, this.context);\n let content = part.template.template?.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n let actions = part.template.actions;\n let instance = new TemplateInstance(this.component, content, actions, part.template.loops, part.template.ifs, context);\n currentActive = instance;\n instance.render();\n anchor.parentNode?.insertBefore(currentActive.content, anchor);\n };\n for (let i = 0; i < _if.parts.length; i++) {\n const part = _if.parts[i];\n let _class = part.once ? ComputedNoRecomputed : Computed;\n let computed = new _class(() => {\n return part.condition(this.context);\n });\n computeds.push(computed);\n computed.subscribe(() => {\n calculateActive();\n });\n this.computeds.push(computed);\n }\n const calculateActive = () => {\n let newActive = -1;\n for (let i = 0; i < _if.parts.length; i++) {\n if (computeds[i].value) {\n newActive = i;\n break;\n }\n }\n if (newActive == currentActiveNb) {\n return;\n }\n if (currentActive) {\n currentActive.destructor();\n }\n currentActiveNb = newActive;\n createContext();\n };\n calculateActive();\n }\n}\nTemplateInstance.Namespace=`Aventus`;\n__as1(_, 'TemplateInstance', TemplateInstance);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false},{"fullName":"Aventus.Actions","isStrong":false},{"fullName":"Aventus.Effect","isStrong":false},{"fullName":"Aventus.LoopRegistery","isStrong":false},{"fullName":"Aventus.Loop","isStrong":false},{"fullName":"Aventus.If","isStrong":false},{"fullName":"Aventus.setValueToObject","isStrong":false},{"fullName":"Aventus.ContextEdit","isStrong":false},{"fullName":"Aventus.ComputedNoRecomputed","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false},{"fullName":"Aventus.ActionEvent","isStrong":false},{"fullName":"Aventus.getValueFromObject","isStrong":false},{"fullName":"Aventus.PressManagerOptions","isStrong":false},{"fullName":"clone","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.ActionChange","isStrong":false},{"fullName":"Aventus.ActionInjection","isStrong":false},{"fullName":"Aventus.ActionBindings","isStrong":false},{"fullName":"Aventus.LoopFct","isStrong":false},{"fullName":"Aventus.LoopSimple","isStrong":false},{"fullName":"Signal","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false},{"fullName":"Aventus.WatcherFunction","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.TemplateInstance","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let TemplateContext=class TemplateContext {\n data = {};\n comp;\n computeds = [];\n watch;\n registry;\n isDestroyed = false;\n constructor(component, data = {}, parentContext, registry) {\n this.comp = component;\n this.registry = registry;\n this.watch = Watcher.get({});\n let that = this;\n for (let key in data) {\n if (data[key].__isProxy) {\n Object.defineProperty(this.data, key, {\n get() {\n return data[key];\n }\n });\n }\n else {\n this.watch[key] = data[key];\n Object.defineProperty(this.data, key, {\n get() {\n return that.watch[key];\n }\n });\n }\n }\n if (parentContext) {\n const descriptors = Object.getOwnPropertyDescriptors(parentContext.data);\n for (let name in descriptors) {\n Object.defineProperty(this.data, name, {\n get() {\n return parentContext.data[name];\n }\n });\n }\n }\n }\n print(value) {\n return value == null ? \"\" : value + \"\";\n }\n registerIndex() {\n let name = \"index\";\n let i = 0;\n let fullName = name + i;\n while (this.watch[fullName] !== undefined) {\n i++;\n fullName = name + i;\n }\n return fullName;\n }\n registerLoop(dataName, _indexValue, _indexName, indexName, itemName, onThis) {\n this.watch[_indexName] = _indexValue;\n let getItems;\n let mustBeRecomputed = /if|switch|\\?|\\[.+?\\]/g.test(dataName);\n let _class = mustBeRecomputed ? Computed : ComputedNoRecomputed;\n if (!onThis) {\n getItems = new _class(() => {\n return getValueFromObject(dataName, this.data);\n });\n }\n else {\n dataName = dataName.replace(/^this\\./, '');\n getItems = new _class(() => {\n return getValueFromObject(dataName, this.comp);\n });\n }\n let getIndex = new ComputedNoRecomputed(() => {\n let items = getItems.value;\n if (!items)\n throw 'impossible';\n let keys = Object.keys(items);\n let index = keys[_getIndex.value];\n if (/^[0-9]+$/g.test(index))\n return Number(index);\n return index;\n });\n let getItem = new ComputedNoRecomputed(() => {\n let items = getItems.value;\n if (!items)\n throw 'impossible';\n let keys = Object.keys(items);\n let index = keys[_getIndex.value];\n let element = items[index];\n if (element === undefined && (Array.isArray(items) || !items)) {\n if (this.registry) {\n let indexNb = Number(_getIndex.value);\n if (!isNaN(indexNb)) {\n this.registry.templates[indexNb].destructor();\n this.registry.templates.splice(indexNb, 1);\n for (let i = indexNb; i < this.registry.templates.length; i++) {\n this.registry.templates[i].context.decreaseIndex(_indexName);\n }\n }\n }\n }\n return element;\n });\n let _getIndex = new ComputedNoRecomputed(() => {\n return this.watch[_indexName];\n });\n this.computeds.push(getIndex);\n this.computeds.push(getItem);\n this.computeds.push(_getIndex);\n if (itemName) {\n Object.defineProperty(this.data, itemName, {\n get() {\n return getItem.value;\n }\n });\n }\n if (indexName) {\n Object.defineProperty(this.data, indexName, {\n get() {\n return getIndex.value;\n }\n });\n }\n }\n updateIndex(newIndex, _indexName) {\n // let items: any[] | {};\n // if(!dataName.startsWith(\"this.\")) {\n // let comp = new Computed(() => {\n // return getValueFromObject(dataName, this.data);\n // });\n // fullName = dataName.replace(/^this\\./, '');\n // items = getValueFromObject(fullName, this.comp);\n // if(Array.isArray(items)) {\n // let regex = new RegExp(\"^(\" + fullName.replace(/\\./g, \"\\\\.\") + \")\\\\[(\\\\d+?)\\\\]\");\n // for(let computed of computeds) {\n // for(let cb of computed.callbacks) {\n // cb.path = cb.path.replace(regex, \"$1[\" + newIndex + \"]\");\n // let oldKey = Object.keys(items)[this.watch[_indexName]]\n // let newKey = Object.keys(items)[newIndex]\n // let regex = new RegExp(\"^(\" + fullName.replace(/\\./g, \"\\\\.\") + \"\\\\.)(\" + oldKey + \")($|\\\\.)\");\n // for (let computed of computeds) {\n // for (let cb of computed.callbacks) {\n // cb.path = cb.path.replace(regex, \"$1\" + newKey + \"$3\")\n this.watch[_indexName] = newIndex;\n }\n increaseIndex(_indexName) {\n this.updateIndex(this.watch[_indexName] + 1, _indexName);\n }\n decreaseIndex(_indexName) {\n this.updateIndex(this.watch[_indexName] - 1, _indexName);\n }\n destructor() {\n this.isDestroyed = true;\n for (let computed of this.computeds) {\n computed.destroy();\n }\n this.computeds = [];\n }\n registerWatch(name, value) {\n let that = this;\n that.watch[name] = value;\n Object.defineProperty(that.data, name, {\n get() {\n return that.watch[name];\n }\n });\n }\n updateWatch(name, value, dones) {\n if (Watcher.is(this.watch[name])) {\n this.watch[name].__injectedDones(dones);\n }\n this.watch[name] = value;\n }\n normalizePath(path) {\n path = path.replace(/^this\\./, '');\n const regex = /\\[(.*?)\\]/g;\n let m;\n while ((m = regex.exec(path)) !== null) {\n if (m.index === regex.lastIndex) {\n regex.lastIndex++;\n }\n let name = m[1];\n let result = getValueFromObject(name, this.data);\n if (result !== undefined) {\n path = path.replace(m[0], `[${result}]`);\n }\n }\n return path;\n }\n getValueFromItem(name) {\n if (!name)\n return undefined;\n let result = getValueFromObject(name, this.data);\n if (result !== undefined) {\n return result;\n }\n result = getValueFromObject(name, this.comp);\n if (result !== undefined) {\n return result;\n }\n return undefined;\n }\n setValueToItem(name, value) {\n setValueToObject(name, this.comp, value);\n }\n}\nTemplateContext.Namespace=`Aventus`;\n__as1(_, 'TemplateContext', TemplateContext);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false},{"fullName":"Aventus.LoopRegistery","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.ComputedNoRecomputed","isStrong":false},{"fullName":"Aventus.getValueFromObject","isStrong":false},{"fullName":"Aventus.setValueToObject","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.TemplateContext","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let Template=class Template {\n static validatePath(path, pathToCheck) {\n if (pathToCheck.startsWith(path)) {\n return true;\n }\n return false;\n }\n cst;\n constructor(component) {\n this.cst = component;\n }\n htmlParts = [];\n setHTML(data) {\n this.htmlParts.push(data);\n }\n generateTemplate() {\n this.template = document.createElement('template');\n let currentHTML = \"<slot></slot>\";\n let previousSlots = {\n default: '<slot></slot>'\n };\n for (let htmlPart of this.htmlParts) {\n for (let blockName in htmlPart.blocks) {\n if (!previousSlots.hasOwnProperty(blockName)) {\n throw \"can't found slot with name \" + blockName;\n }\n currentHTML = currentHTML.replace(previousSlots[blockName], htmlPart.blocks[blockName]);\n }\n for (let slotName in htmlPart.slots) {\n previousSlots[slotName] = htmlPart.slots[slotName];\n }\n }\n this.template.innerHTML = currentHTML;\n }\n /**\n * Used by the for loop and the if\n * @param template\n */\n setTemplate(template) {\n this.template = document.createElement('template');\n this.template.innerHTML = template;\n }\n template;\n actions = {};\n setActions(actions) {\n if (!this.actions) {\n this.actions = actions;\n }\n else {\n if (actions.elements) {\n if (!this.actions.elements) {\n this.actions.elements = [];\n }\n this.actions.elements = [...actions.elements, ...this.actions.elements];\n }\n if (actions.events) {\n if (!this.actions.events) {\n this.actions.events = [];\n }\n this.actions.events = [...actions.events, ...this.actions.events];\n }\n if (actions.pressEvents) {\n if (!this.actions.pressEvents) {\n this.actions.pressEvents = [];\n }\n this.actions.pressEvents = [...actions.pressEvents, ...this.actions.pressEvents];\n }\n if (actions.content) {\n if (!this.actions.content) {\n this.actions.content = actions.content;\n }\n else {\n for (let contextProp in actions.content) {\n if (!this.actions.content[contextProp]) {\n this.actions.content[contextProp] = actions.content[contextProp];\n }\n else {\n throw 'this should be impossible';\n }\n }\n }\n }\n if (actions.injection) {\n if (!this.actions.injection) {\n this.actions.injection = actions.injection;\n }\n else {\n for (let contextProp in actions.injection) {\n if (!this.actions.injection[contextProp]) {\n this.actions.injection[contextProp] = actions.injection[contextProp];\n }\n else {\n this.actions.injection[contextProp] = { ...actions.injection[contextProp], ...this.actions.injection[contextProp] };\n }\n }\n }\n }\n if (actions.bindings) {\n if (!this.actions.bindings) {\n this.actions.bindings = actions.bindings;\n }\n else {\n for (let contextProp in actions.bindings) {\n if (!this.actions.bindings[contextProp]) {\n this.actions.bindings[contextProp] = actions.bindings[contextProp];\n }\n else {\n this.actions.bindings[contextProp] = { ...actions.bindings[contextProp], ...this.actions.bindings[contextProp] };\n }\n }\n }\n }\n if (actions.contextEdits) {\n if (!this.actions.contextEdits) {\n this.actions.contextEdits = [];\n }\n this.actions.contextEdits = [...actions.contextEdits, ...this.actions.contextEdits];\n }\n }\n }\n loops = [];\n addLoop(loop) {\n this.loops.push(loop);\n }\n ifs = [];\n addIf(_if) {\n this.ifs.push(_if);\n }\n createInstance(component) {\n let content = this.template.content.cloneNode(true);\n document.adoptNode(content);\n customElements.upgrade(content);\n return new TemplateInstance(component, content, this.actions, this.loops, this.ifs);\n }\n}\nTemplate.Namespace=`Aventus`;\n__as1(_, 'Template', Template);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateHTML","isStrong":false},{"fullName":"Aventus.Actions","isStrong":false},{"fullName":"Aventus.Loop","isStrong":false},{"fullName":"Aventus.If","isStrong":false},{"fullName":"Aventus.TemplateInstance","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.Template","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let WebComponent=class WebComponent extends HTMLElement {\n /**\n * Add attributes informations\n */\n static get observedAttributes() {\n return [];\n }\n _first;\n _isReady;\n /**\n * Determine if the component is ready (postCreation done)\n */\n get isReady() {\n return this._isReady;\n }\n /**\n * The current namespace\n */\n static Namespace = \"\";\n /**\n * The current Tag / empty if abstract class\n */\n static Tag = \"\";\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n static get Fullname() { return this.Namespace + \".\" + this.name; }\n /**\n * The current namespace\n */\n get namespace() {\n return this.constructor['Namespace'];\n }\n /**\n * Get the name of the component class\n */\n getClassName() {\n return this.constructor.name;\n }\n /**\n * The current tag\n */\n get tag() {\n return this.constructor['Tag'];\n }\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n get $type() {\n return this.constructor['Fullname'];\n }\n __onChangeFct = {};\n __watch;\n __watchActions = {};\n __watchActionsCb = {};\n __watchFunctions = {};\n __watchFunctionsComputed = {};\n __pressManagers = [];\n __signalActions = {};\n __signals = {};\n __isDefaultState = true;\n __defaultActiveState = new Map();\n __defaultInactiveState = new Map();\n __statesList = {};\n constructor() {\n super();\n if (this.constructor == WebComponent) {\n throw \"can't instanciate an abstract class\";\n }\n this.__removeNoAnimations = this.__removeNoAnimations.bind(this);\n if (document.readyState === \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", this.__removeNoAnimations);\n }\n this._first = true;\n this._isReady = false;\n this.__renderTemplate();\n this.__registerWatchesActions();\n this.__registerPropertiesActions();\n this.__registerSignalsActions();\n this.__createStates();\n this.__subscribeState();\n if (this.constructor == WebComponent) {\n throw \"can't instanciate an abstract class\";\n }\n }\n /**\n * Remove all listeners\n * State + press\n */\n destructor() {\n WebComponentInstance.removeInstance(this);\n this.__unsubscribeState();\n for (let press of this.__pressManagers) {\n press.destroy();\n }\n for (let name in this.__watchFunctionsComputed) {\n this.__watchFunctionsComputed[name].destroy();\n }\n for (let name in this.__signals) {\n this.__signals[name].destroy();\n }\n // TODO add missing info for destructor();\n this.postDestruction();\n this.destructChildren();\n }\n destructChildren() {\n const recu = (el) => {\n for (let child of Array.from(el.children)) {\n if (child instanceof WebComponent) {\n child.destructor();\n }\n else if (child instanceof HTMLElement) {\n recu(child);\n }\n }\n if (el.shadowRoot) {\n for (let child of Array.from(el.shadowRoot.children)) {\n if (child instanceof WebComponent) {\n child.destructor();\n }\n else if (child instanceof HTMLElement) {\n recu(child);\n }\n }\n }\n };\n recu(this);\n }\n __addWatchesActions(name, fct) {\n if (!this.__watchActions[name]) {\n this.__watchActions[name] = [];\n this.__watchActionsCb[name] = (action, path, value) => {\n for (let fct of this.__watchActions[name]) {\n fct(this, action, path, value);\n }\n if (this.__onChangeFct[name]) {\n for (let fct of this.__onChangeFct[name]) {\n fct(path);\n }\n }\n };\n }\n if (fct) {\n this.__watchActions[name].push(fct);\n }\n }\n __addWatchesFunctions(infos) {\n for (let info of infos) {\n let realName;\n let autoInit;\n if (typeof info == \"string\") {\n realName = info;\n autoInit = false;\n }\n else {\n realName = info.name;\n autoInit = info.autoInit;\n }\n if (!this.__watchFunctions[realName]) {\n this.__watchFunctions[realName] = { autoInit };\n }\n }\n }\n __registerWatchesActions() {\n if (Object.keys(this.__watchActions).length > 0) {\n if (!this.__watch) {\n let defaultValue = {};\n this.__defaultValuesWatch(defaultValue);\n this.__watch = Watcher.get(defaultValue, (type, path, element) => {\n try {\n let action = this.__watchActionsCb[path.split(\".\")[0]] || this.__watchActionsCb[path.split(\"[\")[0]];\n action(type, path, element);\n }\n catch (e) {\n console.error(e);\n }\n });\n }\n }\n for (let name in this.__watchFunctions) {\n this.__watchFunctionsComputed[name] = Watcher.computed(this[name].bind(this));\n if (this.__watchFunctions[name].autoInit) {\n this.__watchFunctionsComputed[name].value;\n }\n }\n }\n __addSignalActions(name, fct) {\n this.__signalActions[name] = () => {\n fct(this);\n };\n }\n __registerSignalsActions() {\n if (Object.keys(this.__signals).length > 0) {\n const defaultValues = {};\n for (let name in this.__signals) {\n this.__registerSignalsAction(name);\n this.__defaultValuesSignal(defaultValues);\n }\n for (let name in defaultValues) {\n this.__signals[name].value = defaultValues[name];\n }\n }\n }\n __registerSignalsAction(name) {\n this.__signals[name] = new Signal(undefined, () => {\n if (this.__signalActions[name]) {\n this.__signalActions[name]();\n }\n });\n }\n __defaultValuesSignal(s) { }\n __addPropertyActions(name, fct) {\n if (!this.__onChangeFct[name]) {\n this.__onChangeFct[name] = [];\n }\n if (fct) {\n this.__onChangeFct[name].push(() => {\n fct(this);\n });\n }\n }\n __registerPropertiesActions() { }\n static __style = ``;\n static __template;\n __templateInstance;\n styleBefore(addStyle) {\n addStyle(\"@default\");\n }\n styleAfter(addStyle) {\n }\n __getStyle() {\n return [WebComponent.__style];\n }\n __getHtml() { }\n __getStatic() {\n return WebComponent;\n }\n static __styleSheets = {};\n __renderStyles() {\n let sheets = {};\n const addStyle = (name) => {\n let sheet = Style.get(name);\n if (sheet) {\n sheets[name] = sheet;\n }\n };\n this.styleBefore(addStyle);\n let localStyle = new CSSStyleSheet();\n let styleTxt = this.__getStyle().join(\"\\r\\n\");\n if (styleTxt.length > 0) {\n localStyle.replace(styleTxt);\n sheets['@local'] = localStyle;\n }\n this.styleAfter(addStyle);\n return sheets;\n }\n __renderTemplate() {\n let staticInstance = this.__getStatic();\n if (!staticInstance.__template || staticInstance.__template.cst != staticInstance) {\n staticInstance.__template = new Template(staticInstance);\n this.__getHtml();\n this.__registerTemplateAction();\n staticInstance.__template.generateTemplate();\n staticInstance.__styleSheets = this.__renderStyles();\n }\n this.__templateInstance = staticInstance.__template.createInstance(this);\n let shadowRoot = this.attachShadow({ mode: 'open' });\n shadowRoot.adoptedStyleSheets = [...Object.values(staticInstance.__styleSheets), Style.noAnimation];\n shadowRoot.appendChild(this.__templateInstance.content);\n // customElements.upgrade(shadowRoot);\n return shadowRoot;\n }\n __registerTemplateAction() {\n }\n connectedCallback() {\n if (this._first) {\n WebComponentInstance.addInstance(this);\n this._first = false;\n this.__defaultValues();\n this.__upgradeAttributes();\n this.__activateState();\n this.__templateInstance?.render();\n this.__removeNoAnimations();\n }\n else {\n setTimeout(() => {\n this.postConnect();\n });\n }\n }\n disconnectedCallback() {\n setTimeout(() => {\n this.postDisconnect();\n });\n }\n __onReadyCb = [];\n onReady(cb) {\n if (this._isReady) {\n cb();\n }\n else {\n this.__onReadyCb.push(cb);\n }\n }\n __setReady() {\n this._isReady = true;\n this.dispatchEvent(new CustomEvent('postCreationDone'));\n let cbs = [...this.__onReadyCb];\n for (let cb of cbs) {\n cb();\n }\n this.__onReadyCb = [];\n }\n __removeNoAnimations() {\n if (document.readyState !== \"loading\") {\n setTimeout(() => {\n this.postCreation();\n this.__setReady();\n this.shadowRoot.adoptedStyleSheets = Object.values(this.__getStatic().__styleSheets);\n document.removeEventListener(\"DOMContentLoaded\", this.__removeNoAnimations);\n this.postConnect();\n }, 50);\n }\n }\n __defaultValues() { }\n __defaultValuesWatch(w) { }\n __upgradeAttributes() { }\n __listBoolProps() {\n return [];\n }\n __upgradeProperty(prop) {\n let boolProps = this.__listBoolProps();\n const t = this;\n if (boolProps.indexOf(prop) != -1) {\n if (this.hasAttribute(prop) && (this.getAttribute(prop) === \"true\" || this.getAttribute(prop) === \"\")) {\n let value = this.getAttribute(prop);\n delete t[prop];\n t[prop] = value;\n }\n else {\n this.removeAttribute(prop);\n delete t[prop];\n t[prop] = false;\n }\n }\n else {\n if (this.hasAttribute(prop)) {\n let value = this.getAttribute(prop);\n delete t[prop];\n t[prop] = value;\n }\n else if (Object.hasOwn(this, prop)) {\n const value = t[prop];\n delete t[prop];\n t[prop] = value;\n }\n }\n }\n __correctGetter(prop) {\n if (Object.hasOwn(this, prop)) {\n const t = this;\n const value = t[prop];\n delete t[prop];\n t[prop] = value;\n }\n }\n __getStateManager(managerClass) {\n let mClass;\n if (managerClass instanceof StateManager) {\n mClass = managerClass;\n }\n else {\n mClass = Instance.get(managerClass);\n }\n return mClass;\n }\n __addActiveDefState(managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n if (!this.__defaultActiveState.has(mClass)) {\n this.__defaultActiveState.set(mClass, []);\n }\n this.__defaultActiveState.get(mClass)?.push(cb);\n }\n __addInactiveDefState(managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n if (!this.__defaultInactiveState.has(mClass)) {\n this.__defaultInactiveState.set(mClass, []);\n }\n this.__defaultInactiveState.get(mClass)?.push(cb);\n }\n __addActiveState(statePattern, managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n this.__statesList[statePattern].get(mClass)?.active.push(cb);\n }\n __addInactiveState(statePattern, managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n this.__statesList[statePattern].get(mClass)?.inactive.push(cb);\n }\n __addAskChangeState(statePattern, managerClass, cb) {\n let mClass = this.__getStateManager(managerClass);\n this.__statesList[statePattern].get(mClass)?.askChange.push(cb);\n }\n __createStates() { }\n __createStatesList(statePattern, managerClass) {\n if (!this.__statesList[statePattern]) {\n this.__statesList[statePattern] = new Map();\n }\n let mClass = this.__getStateManager(managerClass);\n if (!this.__statesList[statePattern].has(mClass)) {\n this.__statesList[statePattern].set(mClass, {\n active: [],\n inactive: [],\n askChange: []\n });\n }\n }\n __inactiveDefaultState(managerClass) {\n if (this.__isDefaultState) {\n this.__isDefaultState = false;\n let mClass = this.__getStateManager(managerClass);\n if (this.__defaultInactiveState.has(mClass)) {\n let fcts = this.__defaultInactiveState.get(mClass) ?? [];\n for (let fct of fcts) {\n fct.bind(this)();\n }\n }\n }\n }\n __activeDefaultState(nextStep, managerClass) {\n if (!this.__isDefaultState) {\n for (let pattern in this.__statesList) {\n if (StateManager.canBeActivate(pattern, nextStep)) {\n let mClass = this.__getStateManager(managerClass);\n if (this.__statesList[pattern].has(mClass)) {\n return;\n }\n }\n }\n this.__isDefaultState = true;\n let mClass = this.__getStateManager(managerClass);\n if (this.__defaultActiveState.has(mClass)) {\n let fcts = this.__defaultActiveState.get(mClass) ?? [];\n for (let fct of fcts) {\n fct.bind(this)();\n }\n }\n }\n }\n __subscribeState() {\n if (!this.isReady && this.__stateCleared) {\n return;\n }\n for (let route in this.__statesList) {\n for (const managerClass of this.__statesList[route].keys()) {\n let el = this.__statesList[route].get(managerClass);\n if (el) {\n managerClass.subscribe(route, el, false);\n }\n }\n }\n }\n __activateState() {\n for (let route in this.__statesList) {\n for (const managerClass of this.__statesList[route].keys()) {\n let el = this.__statesList[route].get(managerClass);\n if (el) {\n managerClass.activateAfterSubscribe(route, el);\n }\n }\n }\n }\n __stateCleared = false;\n __unsubscribeState() {\n for (let route in this.__statesList) {\n for (const managerClass of this.__statesList[route].keys()) {\n let el = this.__statesList[route].get(managerClass);\n if (el) {\n managerClass.unsubscribe(route, el);\n }\n }\n }\n this.__stateCleared = true;\n }\n dateToString(d) {\n if (typeof d == 'string') {\n d = this.stringToDate(d);\n }\n if (d instanceof Date) {\n return new Date(d.getTime() - (d.getTimezoneOffset() * 60000)).toISOString().split(\"T\")[0];\n }\n return null;\n }\n dateTimeToString(dt) {\n if (typeof dt == 'string') {\n dt = this.stringToDate(dt);\n }\n if (dt instanceof Date) {\n return new Date(dt.getTime() - (dt.getTimezoneOffset() * 60000)).toISOString().slice(0, -1);\n }\n return null;\n }\n stringToDate(s) {\n let td = new Date(s);\n let d = new Date(td.getTime() + (td.getTimezoneOffset() * 60000));\n if (isNaN(d)) {\n return null;\n }\n return d;\n }\n stringToDateTime(s) {\n let td = new Date(s);\n let d = new Date(td.getTime() + (td.getTimezoneOffset() * 60000));\n if (isNaN(d)) {\n return null;\n }\n return d;\n }\n getBoolean(val) {\n if (val === true || val === 1 || val === 'true' || val === '') {\n return true;\n }\n else if (val === false || val === 0 || val === 'false' || val === null || val === undefined) {\n return false;\n }\n console.error(\"error parsing boolean value \" + val);\n return false;\n }\n __registerPropToWatcher(name) {\n if (Watcher._register) {\n Watcher._register.register(this.getReceiver(name), name, Watcher._register.version, name);\n }\n }\n getStringAttr(name) {\n return this.getAttribute(name)?.replace(/&avquot;/g, '\"') ?? undefined;\n }\n setStringAttr(name, val) {\n if (val === undefined || val === null) {\n this.removeAttribute(name);\n }\n else {\n this.setAttribute(name, (val + \"\").replace(/\"/g, '&avquot;'));\n }\n }\n getStringProp(name) {\n this.__registerPropToWatcher(name);\n return this.getStringAttr(name);\n }\n getNumberAttr(name) {\n return Number(this.getAttribute(name));\n }\n setNumberAttr(name, val) {\n if (val === undefined || val === null) {\n this.removeAttribute(name);\n }\n else {\n this.setAttribute(name, val);\n }\n }\n getNumberProp(name) {\n this.__registerPropToWatcher(name);\n return this.getNumberAttr(name);\n }\n getBoolAttr(name) {\n return this.hasAttribute(name);\n }\n setBoolAttr(name, val) {\n val = this.getBoolean(val);\n if (val) {\n this.setAttribute(name, 'true');\n }\n else {\n this.removeAttribute(name);\n }\n }\n getBoolProp(name) {\n this.__registerPropToWatcher(name);\n return this.getBoolAttr(name);\n }\n getDateAttr(name) {\n if (!this.hasAttribute(name)) {\n return undefined;\n }\n return this.stringToDate(this.getAttribute(name));\n }\n setDateAttr(name, val) {\n let valTxt = this.dateToString(val);\n if (valTxt === null) {\n this.removeAttribute(name);\n }\n else {\n this.setAttribute(name, valTxt);\n }\n }\n getDateProp(name) {\n this.__registerPropToWatcher(name);\n return this.getDateAttr(name);\n }\n getDateTimeAttr(name) {\n if (!this.hasAttribute(name))\n return undefined;\n return this.stringToDateTime(this.getAttribute(name));\n }\n setDateTimeAttr(name, val) {\n let valTxt = this.dateTimeToString(val);\n if (valTxt === null) {\n this.removeAttribute(name);\n }\n else {\n this.setAttribute(name, valTxt);\n }\n }\n getDateTimeProp(name) {\n this.__registerPropToWatcher(name);\n return this.getDateTimeAttr(name);\n }\n __propertyReceivers = {};\n getReceiver(name) {\n if (!this.__propertyReceivers[name]) {\n let that = this;\n let result = {\n __subscribes: [],\n subscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index == -1) {\n this.__subscribes.push(fct);\n }\n },\n unsubscribe(fct) {\n let index = this.__subscribes.indexOf(fct);\n if (index > -1) {\n this.__subscribes.splice(index, 1);\n }\n },\n onChange() {\n for (let fct of this.__subscribes) {\n fct(WatchAction.UPDATED, name, that[name], []);\n }\n },\n __path: name\n };\n this.__propertyReceivers[name] = result;\n }\n return this.__propertyReceivers[name];\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (oldValue !== newValue || !this.isReady) {\n if (this.__propertyReceivers.hasOwnProperty(name)) {\n this.__propertyReceivers[name].onChange();\n }\n if (this.__onChangeFct.hasOwnProperty(name)) {\n for (let fct of this.__onChangeFct[name]) {\n fct('');\n }\n }\n }\n }\n /**\n * Remove a component from the dom\n * If desctruct is set to true, the component will be fully destroyed\n */\n remove(destruct = true) {\n super.remove();\n if (destruct) {\n this.destructor();\n }\n }\n /**\n * Function triggered when the component is destroyed\n */\n postDestruction() { }\n /**\n * Function triggered the first time the component is rendering inside DOM\n */\n postCreation() { }\n /**\n * Function triggered each time the component is rendering inside DOM\n */\n postConnect() { }\n /**\n * Function triggered each time the component is removed from the DOM\n */\n postDisconnect() { }\n /**\n * Find a parent by tagname if exist\n */\n findParentByTag(tagname, untilNode) {\n return ElementExtension.findParentByTag(this, tagname, untilNode);\n }\n /**\n * Find a parent by class name if exist\n */\n findParentByClass(classname, untilNode) {\n return ElementExtension.findParentByClass(this, classname, untilNode);\n }\n /**\n * Find a parent by type if exist\n */\n findParentByType(type, untilNode) {\n return ElementExtension.findParentByType(this, type, untilNode);\n }\n /**\n * Find list of parents by tagname\n */\n findParentsByTag(tagname, untilNode) {\n return ElementExtension.findParentsByTag(this, tagname, untilNode);\n }\n /**\n * Find list of parents by custom check\n */\n findParents(tagname, check, untilNode) {\n return ElementExtension.findParents(this, check, untilNode);\n }\n /**\n * Find list of parents by custom check\n */\n findParent(tagname, check, untilNode) {\n return ElementExtension.findParent(this, check, untilNode);\n }\n /**\n * Check if element contains a child\n */\n containsChild(el) {\n return ElementExtension.containsChild(this, el);\n }\n /**\n * Get elements inside slot\n */\n getElementsInSlot(slotName) {\n return ElementExtension.getElementsInSlot(this, slotName);\n }\n /**\n * Get nodes inside slot\n */\n getNodesInSlot(slotName) {\n return ElementExtension.getNodesInSlot(this, slotName);\n }\n /**\n * Get active element from the shadowroot or the document\n */\n getActiveElement(document) {\n return ElementExtension.getActiveElement(document ?? this.shadowRoot);\n }\n}\nWebComponent.Namespace=`Aventus`;\n__as1(_, 'WebComponent', WebComponent);\n","dependencies":[{"fullName":"Aventus.DefaultComponent","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Dependencies","isStrong":false},{"fullName":"Aventus.WebComponentInstance","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.Signal","isStrong":false},{"fullName":"Aventus.StateManager","isStrong":false},{"fullName":"Aventus.State","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.Template","isStrong":true},{"fullName":"Aventus.TemplateInstance","isStrong":false},{"fullName":"Aventus.Style","isStrong":false},{"fullName":"Aventus.Instance","isStrong":false},{"fullName":"Aventus.EffectReceiver","isStrong":false},{"fullName":"Aventus.WatcherChange","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ElementExtension","isStrong":false}],"fullName":"Aventus.WebComponent","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let WebComponentInstance=class WebComponentInstance {\n static __allDefinitions = [];\n static __allInstances = [];\n /**\n * Last definition insert datetime\n */\n static lastDefinition = 0;\n static registerDefinition(def) {\n WebComponentInstance.lastDefinition = Date.now();\n WebComponentInstance.__allDefinitions.push(def);\n }\n static removeDefinition(def) {\n WebComponentInstance.lastDefinition = Date.now();\n let index = WebComponentInstance.__allDefinitions.indexOf(def);\n if (index > -1) {\n WebComponentInstance.__allDefinitions.splice(index, 1);\n }\n }\n /**\n * Get all sub classes of type\n */\n static getAllClassesOf(type) {\n let result = [];\n for (let def of WebComponentInstance.__allDefinitions) {\n if (def.prototype instanceof type) {\n result.push(def);\n }\n }\n return result;\n }\n /**\n * Get all registered definitions\n */\n static getAllDefinitions() {\n return WebComponentInstance.__allDefinitions;\n }\n static addInstance(instance) {\n this.__allInstances.push(instance);\n }\n static removeInstance(instance) {\n let index = this.__allInstances.indexOf(instance);\n if (index > -1) {\n this.__allInstances.splice(index, 1);\n }\n }\n static getAllInstances(type) {\n let result = [];\n for (let instance of this.__allInstances) {\n if (instance instanceof type) {\n result.push(instance);\n }\n }\n return result;\n }\n static create(type) {\n let _class = customElements.get(type);\n if (_class) {\n return new _class();\n }\n let splitted = type.split(\".\");\n let current = window;\n for (let part of splitted) {\n current = current[part];\n }\n if (current && current.prototype instanceof WebComponent) {\n return new current();\n }\n return null;\n }\n}\nWebComponentInstance.Namespace=`Aventus`;\n__as1(_, 'WebComponentInstance', WebComponentInstance);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":true},{"fullName":"T","isStrong":false}],"fullName":"Aventus.WebComponentInstance","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ElementExtension=class ElementExtension {\n /**\n * Find a parent by custom check\n */\n static findParent(element, check, untilNode) {\n let el = element;\n if (el) {\n if (el instanceof ShadowRoot) {\n el = el.host;\n }\n else {\n el = el.parentNode;\n }\n }\n while (el) {\n if (check(el)) {\n return el;\n }\n if (el instanceof ShadowRoot) {\n el = el.host;\n }\n else {\n el = el.parentNode;\n }\n if (el == untilNode) {\n break;\n }\n }\n return null;\n }\n /**\n * Find a list of parent by custom check\n */\n static findParents(element, check, untilNode) {\n let result = [];\n let el = element;\n if (el) {\n if (el instanceof ShadowRoot) {\n el = el.host;\n }\n else {\n el = el.parentNode;\n }\n }\n while (el) {\n if (check(el)) {\n result.push(el);\n }\n if (el instanceof ShadowRoot) {\n el = el.host;\n }\n else {\n el = el.parentNode;\n }\n if (el == untilNode) {\n break;\n }\n }\n return result;\n }\n /**\n * Find a parent by tagname if exist Static.findParentByTag(this, \"av-img\")\n */\n static findParentByTag(element, tagname, untilNode) {\n if (Array.isArray(tagname)) {\n for (let i = 0; i < tagname.length; i++) {\n tagname[i] = tagname[i].toLowerCase();\n }\n }\n else {\n tagname = [tagname.toLowerCase()];\n }\n const checkFunc = (el) => {\n if (el instanceof Element) {\n return tagname.indexOf((el.nodeName || el.tagName).toLowerCase()) != -1;\n }\n return tagname.indexOf(el.nodeName.toLowerCase()) != -1;\n };\n return this.findParent(element, checkFunc, untilNode);\n }\n /**\n * Find a parent by class name if exist Static.findParentByClass(this, \"my-class-img\") = querySelector('.my-class-img')\n */\n static findParentByClass(element, classname, untilNode) {\n if (!Array.isArray(classname)) {\n classname = [classname];\n }\n const check = (el) => {\n for (let classnameTemp of classname) {\n if (el instanceof Element && el['classList'].contains(classnameTemp)) {\n return true;\n }\n }\n return false;\n };\n return this.findParent(element, check, untilNode);\n }\n static findParentByType(element, types, untilNode) {\n if (!Array.isArray(types)) {\n types = [types];\n }\n let isValid = true;\n for (let type of types) {\n if (typeof type == \"function\" && type['prototype']['constructor'])\n continue;\n isValid = false;\n }\n if (isValid) {\n let checkFunc = (el) => {\n for (let type of types) {\n const t = type;\n if (el instanceof t) {\n return true;\n }\n }\n return false;\n };\n return this.findParent(element, checkFunc, untilNode);\n }\n console.error(\"you must provide a class inside this function\");\n return null;\n }\n /**\n * Find list of parents by tagname\n */\n static findParentsByTag(element, tagname, untilNode) {\n let el = element;\n if (Array.isArray(tagname)) {\n for (let i = 0; i < tagname.length; i++) {\n tagname[i] = tagname[i].toLowerCase();\n }\n }\n else {\n tagname = [tagname.toLowerCase()];\n }\n let check = (el) => {\n if (el instanceof Element) {\n return tagname.indexOf((el.nodeName || el.tagName).toLowerCase()) != -1;\n }\n return tagname.indexOf(el.nodeName.toLowerCase()) != -1;\n };\n return this.findParents(element, check, untilNode);\n }\n /**\n * Check if element contains a child\n */\n static containsChild(element, child) {\n let rootScope = element.getRootNode();\n let elScope = child.getRootNode();\n while (elScope != rootScope) {\n if (!elScope['host']) {\n return false;\n }\n child = elScope['host'];\n elScope = elScope['host'].getRootNode();\n }\n return element.contains(child);\n }\n /**\n * Get element inside slot\n */\n static getElementsInSlot(element, slotName) {\n let result = [];\n if (element.shadowRoot) {\n let slotEl;\n if (slotName) {\n slotEl = element.shadowRoot.querySelector('slot[name=\"' + slotName + '\"]');\n }\n else {\n slotEl = element.shadowRoot.querySelector(\"slot:not([name])\");\n if (!slotEl) {\n slotEl = element.shadowRoot.querySelector(\"slot\");\n }\n }\n while (true) {\n if (!slotEl) {\n return result;\n }\n var listChild = Array.from(slotEl.assignedElements());\n if (!listChild) {\n return result;\n }\n let slotFound = false;\n for (let i = 0; i < listChild.length; i++) {\n let child = listChild[i];\n if (listChild[i].nodeName == \"SLOT\") {\n slotEl = listChild[i];\n slotFound = true;\n }\n else if (child instanceof HTMLElement) {\n result.push(child);\n }\n }\n if (!slotFound) {\n return result;\n }\n }\n }\n return result;\n }\n /**\n * Get element inside slot\n */\n static getNodesInSlot(element, slotName) {\n let result = [];\n if (element.shadowRoot) {\n let slotEl;\n if (slotName) {\n slotEl = element.shadowRoot.querySelector('slot[name=\"' + slotName + '\"]');\n }\n else {\n slotEl = element.shadowRoot.querySelector(\"slot:not([name])\");\n if (!slotEl) {\n slotEl = element.shadowRoot.querySelector(\"slot\");\n }\n }\n while (true) {\n if (!slotEl) {\n return result;\n }\n var listChild = Array.from(slotEl.assignedNodes());\n if (!listChild) {\n return result;\n }\n let slotFound = false;\n for (let i = 0; i < listChild.length; i++) {\n let child = listChild[i];\n if (listChild[i].nodeName == \"SLOT\") {\n slotEl = listChild[i];\n slotFound = true;\n }\n else if (child instanceof Node) {\n result.push(child);\n }\n }\n if (!slotFound) {\n return result;\n }\n }\n }\n return result;\n }\n /**\n * Get deeper element inside dom at the position X and Y\n */\n static getElementAtPosition(x, y, startFrom) {\n const _realTarget = (el, i = 0) => {\n if (i == 50) {\n debugger;\n }\n if (el.shadowRoot && x !== undefined && y !== undefined) {\n const elements = el.shadowRoot.elementsFromPoint(x, y);\n var newEl = elements.length > 0 ? elements[0] : null;\n if (newEl && newEl != el && (el.shadowRoot.contains(newEl) || el.contains(newEl))) {\n return _realTarget(newEl, i + 1);\n }\n }\n return el;\n };\n if (startFrom == null) {\n startFrom = document.body;\n }\n return _realTarget(startFrom);\n }\n /**\n * Get active element from the define root\n */\n static getActiveElement(root = document) {\n if (!root)\n return null;\n let el = root.activeElement;\n while (el instanceof WebComponent) {\n let elTemp = el.shadowRoot?.activeElement;\n if (!elTemp)\n return el;\n el = elTemp;\n }\n return el;\n }\n}\nElementExtension.Namespace=`Aventus`;\n__as1(_, 'ElementExtension', ElementExtension);\n","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.ElementExtension","required":false,"type":1,"isExported":true,"convertibleName":""}],"existing":[{"fullName":"Aventus.DebuggerConfig","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ActionBindings","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ActionInjection","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ActionEventCallback","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ActionEventListener","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ContextEdit","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.If","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false},{"fullName":"Aventus.Template","isStrong":false}]},{"fullName":"Aventus.LoopSimple","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.LoopFct","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.TemplateHTML","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.DefaultComponent","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.Last","dependencies":[{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.NotVoid","dependencies":[]},{"fullName":"Aventus.StringLiteral","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.Constructor","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.OnlyConstructor","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.AnyConstructor","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.OnlyConstructor","isStrong":false}]},{"fullName":"Aventus.KeysObject","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Item","isStrong":false}]},{"fullName":"Aventus.RamSubscribers","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IRam","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IRamData","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.UriParamsValue","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.StateSlug","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false}]},{"fullName":"Aventus.StateAskChangeFct","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.StateInactivationFct","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.UriParams","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ResourceLoaderHeadOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ResourceLoaderOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.WindowResizeObserver","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"globalThis.ResizeObserver","isStrong":false}]},{"fullName":"Aventus.ResizeObserverOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.Pointer","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.InstanceCst","dependencies":[]},{"fullName":"Aventus.InstanceCst2","dependencies":[{"fullName":"X","isStrong":false}]},{"fullName":"Aventus.PressManagerState","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false}]},{"fullName":"Aventus.Coordinate","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.InternalCustomFunction","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false}]},{"fullName":"Aventus.InternalPointerEvent","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManagerState","isStrong":false},{"fullName":"Aventus.InternalCustomFunction","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false}]},{"fullName":"Aventus.PressManagerOptions","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false}]},{"fullName":"Aventus.TargetableElement","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.DragElementLeftTop","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.DragElementXY","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ContainerElement","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.AnyElement","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TargetableElement","isStrong":false},{"fullName":"Aventus.ContainerElement","isStrong":false}]},{"fullName":"Aventus.AnimationOptionsInternal","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.AnimationOptions","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.AnimationOptionsInternal","isStrong":false}]},{"fullName":"Aventus.RouterOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.HttpRouterOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IsNotVoid","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.WatcherFunctionInternal","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.WatcherFunction","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.WatcherAllowed","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.Asyncable","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.Enum","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.EnumValue","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Enum","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.JsonFromOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.JsonToOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ClassCopyOptions","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.SchemaType","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IData","dependencies":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.Schema","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.SchemaType","isStrong":false}]},{"fullName":"Aventus.IConverterTransform","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ClassCopyOptions","isStrong":false}]},{"fullName":"Aventus.ExtractFromError","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"U","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false}]},{"fullName":"Aventus.HttpRequestOptions","dependencies":[{"fullName":"Aventus.HttpRequest","isStrong":false},{"fullName":"Aventus.Asyncable","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.HttpResponse","isStrong":false}]},{"fullName":"Aventus.WatcherChange","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.EffectReceiver","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatcherChange","isStrong":false}]},{"fullName":"Aventus.RouterType","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRouter","isStrong":false}]},{"fullName":"Aventus.RouteType","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRoute","isStrong":false}]},{"fullName":"Aventus.DragElement","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.DragElementXY","isStrong":false},{"fullName":"Aventus.DragElementLeftTop","isStrong":false}]},{"fullName":"Aventus.DragAndDropOptionsShadow","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ContainerElement","isStrong":false},{"fullName":"Aventus.DragElement","isStrong":false}]},{"fullName":"Aventus.DragAndDropOptions","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.DragElement","isStrong":false},{"fullName":"Aventus.DragAndDropOptionsShadow","isStrong":false},{"fullName":"Aventus.TargetableElement","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.Coordinate","isStrong":false}]},{"fullName":"Aventus.DragAndDropOptionsInternal","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.DragAndDropOptions","isStrong":false},{"fullName":"Aventus.DragAndDropOptionsShadow","isStrong":false}]},{"fullName":"Aventus.PreparedUri","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.UriParams","isStrong":false}]},{"fullName":"Aventus.IRamAction","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ResultRamWithError","isStrong":false},{"fullName":"Aventus.VoidRamWithError","isStrong":false}]},{"fullName":"Aventus.RamItem","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Resource","isStrong":false},{"fullName":"Aventus.IRamData","isStrong":false},{"fullName":"Aventus.IRamAction","isStrong":false}]},{"fullName":"Aventus.StateActivationFct","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.Subscriber","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateActivationFct","isStrong":false},{"fullName":"Aventus.StateInactivationFct","isStrong":false},{"fullName":"Aventus.StateAskChangeFct","isStrong":false}]},{"fullName":"Aventus.StateAction","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateActivationFct","isStrong":false},{"fullName":"Aventus.StateInactivationFct","isStrong":false},{"fullName":"Aventus.StateAskChangeFct","isStrong":false}]},{"fullName":"Aventus.IStateManager","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateAction","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.IState","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateManager","isStrong":false},{"fullName":"Aventus.Asyncable","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.Loop","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Template","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false},{"fullName":"Aventus.LoopFct","isStrong":false},{"fullName":"Aventus.LoopSimple","isStrong":false}]},{"fullName":"Aventus.ActionEvent","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ActionEventListener","isStrong":false},{"fullName":"Aventus.ActionEventCallback","isStrong":false}]},{"fullName":"Aventus.LoopRegistery","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateInstance","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false}]},{"fullName":"Aventus.ActionChange","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.Actions","dependencies":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ActionChange","isStrong":false},{"fullName":"Aventus.ActionInjection","isStrong":false},{"fullName":"Aventus.ActionBindings","isStrong":false},{"fullName":"Aventus.ActionEvent","isStrong":false},{"fullName":"Aventus.PressManagerOptions","isStrong":false},{"fullName":"Aventus.ContextEdit","isStrong":false}]}]}
2756
2756
  //#endregion js src //
2757
2757
  //#region css def //
2758
2758
  {}