@aventusjs/cli 0.0.14 → 0.0.16

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.
@@ -1,5 +1,6 @@
1
1
  // Aventus@Main:1.0.4
2
2
  // npm:@aventusjs/main
3
+ /* description:Core package for AventusJs */
3
4
  //#region js def //
4
5
  declare global {
5
6
 
@@ -42,10 +43,25 @@ interface DefaultComponent {
42
43
  [key: string]: any;
43
44
  }
44
45
 
46
+ /**
47
+ * Generate a new UUID
48
+ */
45
49
  function uuidv4(): string;
46
50
 
51
+ type Last<T extends any[]> = T extends [...infer _, infer Last] ? Last : never;
52
+
53
+ type NotVoid = {
54
+ [key: string]: NotVoid;
55
+ } | object | string | boolean | symbol | number | null | undefined;
56
+
57
+ /**
58
+ * It ll wait the number provided in ms
59
+ * Async setTimeout
60
+ * @param {number} ms Define the time to wait in milliseconds
61
+ */
47
62
  function sleep(ms: number): Promise<void>;
48
63
 
64
+ /** Force the type to be a literal string */
49
65
  type StringLiteral<T> = T extends string ? string extends T ? never : T : never;
50
66
 
51
67
  type Constructor<T> = abstract new (...args: any[]) => T;
@@ -56,8 +72,17 @@ function isSubclassOf(subClass: Function, superClass: Function): boolean;
56
72
 
57
73
  function isClass(v: any): boolean;
58
74
 
75
+ /**
76
+ * Sets the value in an object based on the provided path.
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
+ * @param {*} obj The object in which to set the value.
79
+ * @param {*} value The value to set.
80
+ */
59
81
  function setValueToObject(path: string, obj: any, value: any): void;
60
82
 
83
+ /**
84
+ * Represents a mutual exclusion (mutex) mechanism for synchronizing access to a shared resource.
85
+ */
61
86
  @Storybook({
62
87
  prefix: "Tools/Mutex"
63
88
  })
@@ -119,6 +144,9 @@ class Mutex {
119
144
  safeRunLastAsync<T = void>(cb: () => Promise<T>): Promise<T | undefined>;
120
145
  }
121
146
 
147
+ /**
148
+ * Class that manages unique execution of asynchronous actions based on specified keys.
149
+ */
122
150
  @Storybook({
123
151
  prefix: "Tools/Mutex"
124
152
  })
@@ -136,21 +164,21 @@ class ActionGuard {
136
164
  * @param {() => Promise<T>} action The action to execute.
137
165
  * @returns {Promise<T>} A promise that resolves with the result of the action.
138
166
  * @example
139
- *
140
- *
167
+ * // Example usage:
168
+ * // Create an instance of ActionGuard
141
169
  * const actionGuard = new Aventus.ActionGuard();
142
170
  *
143
- *
171
+ * // Define keys for the action
144
172
  * const keys = ["key1", "key2"];
145
173
  *
146
- *
174
+ * // Define the action to execute
147
175
  * const action = async () => {
148
- *
176
+ * // Simulate an asynchronous operation
149
177
  * await new Promise(resolve => setTimeout(resolve, 1000));
150
178
  * return "Action executed";
151
179
  * };
152
180
  *
153
- *
181
+ * // Execute the action using ActionGuard
154
182
  * await actionGuard.run(keys, action)
155
183
  *
156
184
  */
@@ -158,8 +186,8 @@ class ActionGuard {
158
186
  run<T extends any>(action: () => Promise<T>): Promise<T>;
159
187
  }
160
188
 
161
- type KeysObject<T> = {
162
- [Key in keyof T]?: any;
189
+ type KeysObject<Item> = {
190
+ [Key in keyof Item]?: any;
163
191
  };
164
192
 
165
193
  @Storybook({
@@ -174,9 +202,15 @@ interface IRam {
174
202
  interface IRamData {
175
203
  }
176
204
 
205
+ /**
206
+ * Enumeration of error codes for RAM-related errors.
207
+ */
177
208
  enum RamErrorCode {
209
+ /** Error code for an unknown error */
178
210
  unknow = 0,
211
+ /** Error code for a missing identifier */
179
212
  noId = 1,
213
+ /** Error code for no item inside RAM */
180
214
  noItemInsideRam = 2
181
215
  }
182
216
 
@@ -184,7 +218,7 @@ type UriParamsValue = {
184
218
  [paramName: string]: string | number;
185
219
  };
186
220
 
187
- type StateSlug = UriParamsValue;
221
+ type StateSlug = Aventus.UriParamsValue;
188
222
 
189
223
  type UriParams = {
190
224
  name: string;
@@ -198,6 +232,7 @@ type UriParams = {
198
232
  interface ResourceLoaderHeadOptions {
199
233
  url: string;
200
234
  type: 'js' | 'css';
235
+ nonce?: string;
201
236
  }
202
237
 
203
238
  @Storybook({
@@ -206,6 +241,7 @@ interface ResourceLoaderHeadOptions {
206
241
  interface ResourceLoaderOptions {
207
242
  url: string;
208
243
  type?: 'js' | 'css' | 'img' | 'svg';
244
+ nonce?: string;
209
245
  }
210
246
 
211
247
  @Storybook({
@@ -217,7 +253,7 @@ class ResourceLoader {
217
253
  /**
218
254
  * Load the resource inside the head tag
219
255
  */
220
- static loadInHead(options: ResourceLoaderHeadOptions | string): Promise<boolean>;
256
+ static loadInHead(options: Aventus.ResourceLoaderHeadOptions | string): Promise<boolean>;
221
257
  private static loadTag;
222
258
  private static releaseAwaitFctHead;
223
259
  private static awaitFctHead;
@@ -226,7 +262,7 @@ class ResourceLoader {
226
262
  /**
227
263
  *
228
264
  */
229
- static load(options: ResourceLoaderOptions | string): Promise<string>;
265
+ static load(options: Aventus.ResourceLoaderOptions | string): Promise<string>;
230
266
  private static releaseAwaitFct;
231
267
  private static awaitFct;
232
268
  private static fetching;
@@ -239,7 +275,7 @@ class ResourceLoader {
239
275
  prefix: "Lib/ResizeObserver"
240
276
  })
241
277
  interface ResizeObserverOptions {
242
- callback: CallableFunction;
278
+ callback: ResizeObserverCallback;
243
279
  fps?: number;
244
280
  }
245
281
 
@@ -248,7 +284,7 @@ interface ResizeObserverOptions {
248
284
  })
249
285
  interface Pointer {
250
286
  id: number;
251
- constructor(nativePointer: Touch | PointerEvent): any;
287
+ constructor(nativePointer: Touch | PointerEvent): Pointer;
252
288
  }
253
289
 
254
290
  type InstanceCst = {
@@ -267,7 +303,7 @@ const DragElementLeftTopType: readonly [any, any];
267
303
  prefix: "Lib/PressManager"
268
304
  })
269
305
  interface PressManagerState {
270
- oneActionTriggered: PressManager | null;
306
+ oneActionTriggered: Aventus.PressManager | null;
271
307
  }
272
308
 
273
309
  class NormalizedEvent {
@@ -292,9 +328,9 @@ class NormalizedEvent {
292
328
  prefix: "Lib/PressManager"
293
329
  })
294
330
  interface InternalCustomFunction {
295
- src?: PressManager;
296
- onDrag?: (e: NormalizedEvent, self: PressManager) => void;
297
- onDragEnd?: (e: NormalizedEvent, self: PressManager) => void;
331
+ src?: Aventus.PressManager;
332
+ onDrag?: (e: Aventus.NormalizedEvent, self: Aventus.PressManager) => void;
333
+ onDragEnd?: (e: Aventus.NormalizedEvent, self: Aventus.PressManager) => void;
298
334
  offsetDrag?: number;
299
335
  }
300
336
 
@@ -303,12 +339,15 @@ interface InternalCustomFunction {
303
339
  })
304
340
  interface InternalPointerEvent extends Event {
305
341
  detail: {
306
- state: PressManagerState;
307
- customFcts: InternalCustomFunction;
308
- realEvent: NormalizedEvent;
342
+ state: Aventus.PressManagerState;
343
+ customFcts: Aventus.InternalCustomFunction;
344
+ realEvent: Aventus.NormalizedEvent;
309
345
  };
310
346
  }
311
347
 
348
+ /**
349
+ * Options for configuring the PressManager.
350
+ */
312
351
  @Storybook({
313
352
  prefix: "Lib/PressManager"
314
353
  })
@@ -323,56 +362,57 @@ interface PressManagerOptions {
323
362
  * @param e - The NormalizedEvent associated with the press.
324
363
  * @param self - The instance of PressManager.
325
364
  */
326
- onPress?: (e: NormalizedEvent, self: PressManager) => void | boolean;
365
+ onPress?: (e: Aventus.NormalizedEvent, self: Aventus.PressManager) => void | boolean;
327
366
  /**
328
367
  * Callback function triggered when a press starts.
329
368
  * @param e - The NormalizedEvent associated with the press start.
330
369
  * @param self - The instance of PressManager.
331
370
  */
332
- onPressStart?: (e: NormalizedEvent, self: PressManager) => void;
371
+ onPressStart?: (e: Aventus.NormalizedEvent, self: Aventus.PressManager) => void;
333
372
  /**
334
373
  * Callback function triggered when a press ends.
335
374
  * @param e - The NormalizedEvent associated with the press end.
336
375
  * @param self - The instance of PressManager.
337
376
  */
338
- onPressEnd?: (e: NormalizedEvent, self: PressManager) => void;
377
+ onPressEnd?: (e: Aventus.NormalizedEvent, self: Aventus.PressManager) => void;
339
378
  /**
340
379
  * Callback function triggered on a long press.
341
380
  * If false returns it means that no action has been triggered and this wont block others actions
342
381
  * @param e - The NormalizedEvent associated with the long press.
343
382
  * @param self - The instance of PressManager.
344
383
  */
345
- onLongPress?: (e: NormalizedEvent, self: PressManager) => void | boolean;
384
+ onLongPress?: (e: Aventus.NormalizedEvent, self: Aventus.PressManager) => void | boolean;
346
385
  /**
347
386
  * Callback function triggered on a double press.
348
387
  * If false returns it means that no action has been triggered and this wont block others actions
349
388
  * @param e - The NormalizedEvent associated with the double press.
350
389
  * @param self - The instance of PressManager.
351
390
  */
352
- onDblPress?: (e: NormalizedEvent, self: PressManager) => void | boolean;
391
+ onDblPress?: (e: Aventus.NormalizedEvent, self: Aventus.PressManager) => void | boolean;
353
392
  /**
354
393
  * Callback function triggered on a drag event.
355
394
  * @param e - The NormalizedEvent associated with the drag.
356
395
  * @param self - The instance of PressManager.
357
396
  */
358
- onDrag?: (e: NormalizedEvent, self: PressManager) => void;
397
+ onDrag?: (e: Aventus.NormalizedEvent, self: Aventus.PressManager) => void;
359
398
  /**
360
399
  * Callback function triggered when a drag starts.
361
400
  * If false returns it means that no action has been triggered and this wont block others actions
362
401
  * @param e - The NormalizedEvent associated with the drag start.
363
402
  * @param self - The instance of PressManager.
364
403
  */
365
- onDragStart?: (e: NormalizedEvent, self: PressManager) => void | boolean;
404
+ onDragStart?: (e: Aventus.NormalizedEvent, self: Aventus.PressManager) => void | boolean;
366
405
  /**
367
406
  * Callback function triggered when a drag ends.
368
407
  * @param e - The NormalizedEvent associated with the drag end.
369
408
  * @param self - The instance of PressManager.
370
409
  */
371
- onDragEnd?: (e: NormalizedEvent, self: PressManager) => void;
410
+ onDragEnd?: (e: Aventus.NormalizedEvent, self: Aventus.PressManager) => void;
372
411
  /**
373
412
  * The minimum distance in pixels required to trigger a drag event.
374
413
  */
375
414
  offsetDrag?: number;
415
+ /** Set the drag direction to watch */
376
416
  dragDirection?: 'X' | 'Y' | 'XY';
377
417
  /**
378
418
  * The delay in milliseconds to detect a double press.
@@ -382,6 +422,7 @@ interface PressManagerOptions {
382
422
  * The delay in milliseconds to detect a long press.
383
423
  */
384
424
  delayLongPress?: number;
425
+ /** Force double press to be triggered (callback or dispatch to parent) */
385
426
  forceDblPress?: boolean;
386
427
  /**
387
428
  * Determines whether to stop the propagation of the event.
@@ -397,7 +438,7 @@ interface PressManagerOptions {
397
438
  * Callback function triggered on any event.
398
439
  * @param e - The NormalizedEvent associated with the event.
399
440
  */
400
- onEvent?: (e: NormalizedEvent) => void;
441
+ onEvent?: (e: Aventus.NormalizedEvent) => void;
401
442
  }
402
443
 
403
444
  type DragElementLeftTop = InstanceType<typeof DragElementLeftTopType[number]>;
@@ -456,6 +497,12 @@ class CallbackGroup<U extends (...args: any) => void> {
456
497
 
457
498
  type AnimationOptions = Partial<___Aventus.AnimationOptionsInternal>;
458
499
 
500
+ abstract class Resource {
501
+ }
502
+
503
+ abstract class Request {
504
+ }
505
+
459
506
  @Storybook({
460
507
  prefix: "Http"
461
508
  })
@@ -470,8 +517,20 @@ interface HttpRouterOptions {
470
517
  url: string;
471
518
  }
472
519
 
473
- function compareObject(obj1: any, obj2: any): boolean;
474
-
520
+ /**
521
+ * Compare two objects for equality, recursively checking nested arrays, objects, and dates.
522
+ * @param {*} obj1 The first object to compare.
523
+ * @param {*} obj2 The second object to compare.
524
+ * @returns {boolean} Returns true if the objects are considered equal, otherwise returns false.
525
+ */
526
+ function compareObject(obj1: any, obj2: any, tableOrder?: boolean): boolean;
527
+
528
+ /**
529
+ * Retrieves the value from an object based on the provided path.
530
+ * @param {string} path The path to the desired value, using dot notation. For example, "a.b.c" for obj[a][b][c].
531
+ * @param {*} obj The object from which to retrieve the value.
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
+ */
475
534
  function getValueFromObject(path: string, obj: any): any;
476
535
 
477
536
  enum WatchAction {
@@ -480,12 +539,15 @@ enum WatchAction {
480
539
  DELETED = 2
481
540
  }
482
541
 
483
- type WatcherFunction = (action: WatchAction, path: string, value: any) => void;
542
+ type WatcherFunction = (action: Aventus.WatchAction, path: string, value: any) => void;
484
543
 
485
544
  type Asyncable<T> = T | Promise<T>;
486
545
 
487
- function Async<T>(el: Asyncable<T>): Promise<T>;
546
+ function Async<T>(el: Aventus.Asyncable<T>): Promise<T>;
488
547
 
548
+ /**
549
+ * List of HTTP Method allowed
550
+ */
489
551
  enum HttpMethod {
490
552
  GET = "GET",
491
553
  POST = "POST",
@@ -502,7 +564,7 @@ type Enum = {
502
564
  [key: string]: number | string;
503
565
  };
504
566
 
505
- type EnumValue<T extends (number | Enum)> = T extends Enum ? T[keyof T] : number;
567
+ type EnumValue<T extends (number | Aventus.Enum)> = T extends Aventus.Enum ? T[keyof T] : number;
506
568
 
507
569
  class DateConverter {
508
570
  private static __converter;
@@ -513,15 +575,10 @@ class DateConverter {
513
575
  toString(date: Date): string;
514
576
  }
515
577
 
516
- type ClassCopyOptions = {
517
- isValidKey?: (key: string) => boolean;
518
- replaceKey?: (key: string) => string;
519
- transformValue?: (key: string, value: any) => any;
520
- };
521
-
522
578
  type JsonFromOptions = {
523
579
  transformValue?: (key: string, value: any) => any;
524
580
  replaceUndefined?: boolean;
581
+ /** Define if you want to replace undefined if key:undefined */
525
582
  replaceUndefinedWithKey?: boolean;
526
583
  };
527
584
 
@@ -536,6 +593,15 @@ type JsonToOptions = {
536
593
  };
537
594
  };
538
595
 
596
+ type ClassCopyOptions = {
597
+ isValidKey?: (key: string) => boolean;
598
+ replaceKey?: (key: string) => string;
599
+ transformValue?: (key: string, value: any) => any;
600
+ };
601
+
602
+ /**
603
+ * Interface representing data with methods to get its unique type and to clone itself.
604
+ */
539
605
  @Storybook({
540
606
  prefix: "Data"
541
607
  })
@@ -550,6 +616,24 @@ interface IData {
550
616
  clone(): this;
551
617
  }
552
618
 
619
+ @Storybook({
620
+ prefix: "Tools/Conveter"
621
+ })
622
+ interface Schema {
623
+ [key: string]: ___Aventus.SchemaType;
624
+ }
625
+
626
+ @Storybook({
627
+ prefix: "Tools/Conveter"
628
+ })
629
+ interface IConverterTransform {
630
+ transform<T = any>(data: any): T;
631
+ copyValuesClass<T extends Object>(target: T, src: T, options?: Aventus.ClassCopyOptions): void;
632
+ }
633
+
634
+ /**
635
+ * Utility class for JSON serialization and deserialization of objects.
636
+ */
553
637
  @Storybook({
554
638
  prefix: "Tools/Json"
555
639
  })
@@ -561,7 +645,7 @@ class Json {
561
645
  * @param {JsonToOptions} [options] - Options for JSON conversion.
562
646
  * @returns {{ [key: string | number]: any; }} Returns the JSON representation of the object.
563
647
  */
564
- static classToJson<T extends Object>(obj: T, options?: JsonToOptions): {
648
+ static classToJson<T extends Object>(obj: T, options?: Aventus.JsonToOptions): {
565
649
  [key: string | number]: any;
566
650
  };
567
651
  private static __classToJson;
@@ -573,40 +657,28 @@ class Json {
573
657
  * @param {JsonFromOptions} [options] - Options for JSON deserialization.
574
658
  * @returns {T} Returns the populated object.
575
659
  */
576
- static classFromJson<T extends Object>(obj: T, data: any, options?: JsonFromOptions): T;
660
+ static classFromJson<T extends Object>(obj: T, data: any, options?: Aventus.JsonFromOptions): T;
577
661
  private static __classFromJson;
578
662
  }
579
663
 
580
664
  @Storybook({
581
665
  prefix: "Tools/Conveter"
582
666
  })
583
- interface Schema {
584
- [key: string]: ___Aventus.SchemaType;
585
- }
586
-
587
- @Storybook({
588
- prefix: "Tools/Conveter"
589
- })
590
- interface IConverterTransform {
667
+ class ConverterTransform implements Aventus.IConverterTransform {
591
668
  transform<T = any>(data: any): T;
592
- copyValuesClass<T extends Object>(target: T, src: T, options?: ClassCopyOptions): void;
593
- }
594
-
595
- @Storybook({
596
- prefix: "Tools/Conveter"
597
- })
598
- class ConverterTransform implements IConverterTransform {
599
- transform<T = any>(data: any): T;
600
- protected createInstance(data: any): (Object & {
669
+ protected createInstance(data: Record<string, any>): (Object & {
601
670
  fromJSON?: (data: any) => any;
602
671
  }) | undefined;
603
672
  protected beforeTransformObject(obj: Object): void;
604
673
  protected afterTransformObject(obj: Object): void;
605
674
  private transformLoop;
606
- copyValuesClass<T extends Object>(target: T, src: T, options?: ClassCopyOptions): void;
675
+ copyValuesClass<T extends Object>(target: T, src: T, options?: Aventus.ClassCopyOptions): void;
607
676
  private __classCopyValues;
608
677
  }
609
678
 
679
+ /**
680
+ * Utility class for data conversion and manipulation.
681
+ */
610
682
  @Storybook({
611
683
  prefix: "Tools/Conveter"
612
684
  })
@@ -631,14 +703,14 @@ class Converter {
631
703
  * Sets the converter instance.
632
704
  * @param converter The converter instance to set.
633
705
  */
634
- static setConverter(converter: IConverterTransform): void;
706
+ static setConverter(converter: Aventus.IConverterTransform): void;
635
707
  /**
636
708
  * Registers a unique string type for any class.
637
709
  * @param $type The unique string type identifier.
638
710
  * @param cst The constructor function for the class.
639
711
  * @param schema Optional schema for the registered type.
640
712
  */
641
- static register($type: string, cst: new () => any, schema?: Schema): void;
713
+ static register($type: string, cst: new () => any, schema?: Aventus.Schema): void;
642
714
  /**
643
715
  * Transforms the provided data using the current converter instance.
644
716
  * @template T
@@ -646,7 +718,7 @@ class Converter {
646
718
  * @param {IConverterTransform} [converter] Optional converter instance to use for transformation.
647
719
  * @returns {T} Returns the transformed data.
648
720
  */
649
- static transform<T = any>(data: any, converter?: IConverterTransform): T;
721
+ static transform<T = any>(data: any, converter?: Aventus.IConverterTransform): T;
650
722
  /**
651
723
  * Copies values from one class instance to another using the current converter instance.
652
724
  * @template T
@@ -656,15 +728,36 @@ class Converter {
656
728
  * @param {IConverterTransform} [converter] Optional converter instance to use for the copy operation.
657
729
  * @returns {T} Returns the destination class instance with copied values.
658
730
  */
659
- static copyValuesClass<T extends Object>(to: T, from: T, options?: ClassCopyOptions, converter?: IConverterTransform): any;
731
+ static copyValuesClass<T extends Object>(to: T, from: T, options?: Aventus.ClassCopyOptions, converter?: Aventus.IConverterTransform): any;
660
732
  }
661
733
 
662
734
  function clone<X>(item: X): any;
663
735
 
736
+ class HttpResponse {
737
+ get status(): number;
738
+ get statusText(): string;
739
+ get redirected(): boolean;
740
+ get ok(): boolean;
741
+ get type(): ResponseType;
742
+ get url(): string;
743
+ get headers(): Headers;
744
+ private response;
745
+ constructor(response: Response);
746
+ private bodyUsed;
747
+ private bodyContent;
748
+ json<T = any>(): Promise<T>;
749
+ blob(): Promise<Blob>;
750
+ text(): Promise<string>;
751
+ }
752
+
753
+ /**
754
+ * Abstract class implementing IData with additional properties and methods for namespace and JSON handling.
755
+ */
664
756
  @Storybook({
665
757
  prefix: "Data"
666
758
  })
667
- abstract class Data implements IData {
759
+ abstract class Data implements Aventus.IData {
760
+ private static converter;
668
761
  /**
669
762
  * The schema for the class
670
763
  */
@@ -703,14 +796,29 @@ abstract class Data implements IData {
703
796
  clone(): this;
704
797
  }
705
798
 
799
+ class HttpCache {
800
+ private static cache;
801
+ static fetch(fullUrl: string, request: RequestInit): Promise<Aventus.HttpResponse>;
802
+ static clear(fullUrl: string, request: RequestInit): void;
803
+ private static generateCacheKey;
804
+ private static hashStringToInt;
805
+ }
806
+
807
+ /**
808
+ * Represents a generic error with a code, message, and optional details.
809
+ * @template T - The type of the error code, which extends either number or Enum.
810
+ */
811
+ @Convertible()
706
812
  @Storybook({
707
813
  prefix: "Error"
708
814
  })
709
- class GenericError<T extends (number | Enum) = any> {
815
+ class GenericError<T extends (number | Aventus.Enum) = any> {
816
+ private static converter;
817
+ static get Fullname(): string;
710
818
  /**
711
819
  * Code for the error
712
820
  */
713
- code: EnumValue<T>;
821
+ code: Aventus.EnumValue<T>;
714
822
  /**
715
823
  * Description of the error
716
824
  */
@@ -724,15 +832,21 @@ class GenericError<T extends (number | Enum) = any> {
724
832
  /**
725
833
  * Creates a new instance of GenericError.
726
834
  * @param {EnumValue<T>} code - The error code.
727
- * @param {string} message - The error message.
835
+ * @param {string | Error | unknown} message - The error message.
728
836
  */
729
- constructor(code: EnumValue<T>, message: string);
837
+ constructor(code: Aventus.EnumValue<T>, message: string | Error | unknown);
730
838
  }
731
839
 
840
+ /**
841
+ * Represents a result of an action that may contain errors.
842
+ * @template T - The type of error, extending GenericError.
843
+ */
844
+ @Convertible()
732
845
  @Storybook({
733
846
  prefix: "Error"
734
847
  })
735
- class VoidWithError<T extends GenericError = GenericError> {
848
+ class VoidWithError<T extends Aventus.GenericError = Aventus.GenericError> {
849
+ static get Fullname(): string;
736
850
  /**
737
851
  * Determine if the action is a success
738
852
  */
@@ -754,13 +868,24 @@ class VoidWithError<T extends GenericError = GenericError> {
754
868
  * @param {new (...args: any[]) => U} [type] - Optional constructor function of the error type.
755
869
  * @returns {boolean} True if the error list contains the specified error code, otherwise false.
756
870
  */
757
- containsCode<U extends GenericError<any>, T extends (number | Enum)>(code: EnumValue<T>, type?: new (...args: any[]) => U): boolean;
871
+ containsCode<U extends Aventus.GenericError<any>, T extends (number | Aventus.Enum)>(code: Aventus.EnumValue<T>, type?: new (...args: any[]) => U): boolean;
872
+ run(fct: (() => T[]) | (() => VoidWithError<T>)): this;
873
+ runAsync(fct: (() => Promise<T[]>) | (() => Promise<VoidWithError<T>>)): Promise<this>;
874
+ extract<X>(fct: (() => Aventus.ResultWithError<X, T>)): X | undefined;
875
+ extractAsync<X>(fct: (() => Promise<Aventus.ResultWithError<X, T>>)): Promise<X | undefined>;
758
876
  }
759
877
 
878
+ /**
879
+ * Represents a result of an action that may contain errors and includes a result value.
880
+ * @template U The type of the result value.
881
+ * @template T The type of error, extending GenericError.
882
+ */
883
+ @Convertible()
760
884
  @Storybook({
761
885
  prefix: "Error"
762
886
  })
763
- class ResultWithError<U, T extends GenericError = GenericError> extends VoidWithError<T> {
887
+ class ResultWithError<U, T extends Aventus.GenericError = Aventus.GenericError> extends Aventus.VoidWithError<T> {
888
+ static get Fullname(): string;
764
889
  /**
765
890
  * The result value of the action.
766
891
  * @type {U | undefined}
@@ -771,60 +896,74 @@ class ResultWithError<U, T extends GenericError = GenericError> extends VoidWith
771
896
  * @returns {ResultWithError<U>} A new instance of ResultWithError with the same error list and result value.
772
897
  */
773
898
  toGeneric(): ResultWithError<U>;
899
+ run(fct: (() => T[]) | (() => Aventus.VoidWithError<T>) | (() => ResultWithError<U, T>)): this;
900
+ runAsync(fct: (() => Promise<T[]>) | (() => Promise<Aventus.VoidWithError<T>>) | (() => ResultWithError<U, T>)): Promise<this>;
774
901
  }
775
902
 
776
- type ExtractFromError<T, U = any> = T extends ResultWithError<infer U, any> ? U : T extends VoidWithError ? void : T;
903
+ /**
904
+ * Extracts the error or void type from a given result type.
905
+ * If the provided type `T` is `ResultWithError`, it extracts the error type.
906
+ * If `T` is `VoidWithError`, it returns `void`.
907
+ * Otherwise, it returns `T`.
908
+ * @template T The input type to extract the error or void from.
909
+ * @template U The default type if `T` is not a `ResultWithError`.
910
+ */
911
+ type ExtractFromError<T, U = any> = T extends Aventus.ResultWithError<infer U, any> ? U : T extends Aventus.VoidWithError ? boolean : T;
777
912
 
778
913
  @Storybook({
779
914
  prefix: "Http"
780
915
  })
781
- class HttpError extends GenericError<HttpErrorCode> {
916
+ class HttpError extends Aventus.GenericError<Aventus.HttpErrorCode> {
782
917
  }
783
918
 
784
919
  type HttpRequestOptions = {
785
- beforeSend?: (request: HttpRequest) => Asyncable<VoidWithError>;
786
- responseMiddleware?: (response: ResultWithError<Response>, request: HttpRequest) => Asyncable<ResultWithError<Response>>;
920
+ beforeSend?: (request: Aventus.HttpRequest) => Aventus.Asyncable<Aventus.VoidWithError>;
921
+ responseMiddleware?: (response: Aventus.ResultWithError<Aventus.HttpResponse>, request: Aventus.HttpRequest) => Aventus.Asyncable<Aventus.ResultWithError<Aventus.HttpResponse>>;
787
922
  };
788
923
 
789
- type WatcherChange = (action: WatchAction, changePath: string, value: any, dones: any[]) => void;
924
+ type WatcherChange = (action: Aventus.WatchAction, changePath: string, value: any, dones: any[]) => void;
790
925
 
791
926
  type EffectReceiver = {
792
- subscribe: (fct: WatcherChange) => void;
793
- unsubscribe: (fct: WatcherChange) => void;
927
+ subscribe: (fct: Aventus.WatcherChange) => void;
928
+ unsubscribe: (fct: Aventus.WatcherChange) => void;
794
929
  __path?: string;
795
930
  };
796
931
 
797
- class Signal<T> implements EffectReceiver {
798
- protected __subscribes: WatcherChange[];
932
+ class Signal<T> implements Aventus.EffectReceiver {
933
+ protected __subscribes: Aventus.WatcherChange[];
799
934
  private _value;
800
935
  @Internal()
801
936
  private _onChange?;
802
937
  get value(): T;
803
938
  set value(item: T);
804
939
  constructor(item: T, onChange?: () => void);
805
- subscribe(fct: WatcherChange): void;
806
- unsubscribe(fct: WatcherChange): void;
940
+ subscribe(fct: Aventus.WatcherChange): void;
941
+ unsubscribe(fct: Aventus.WatcherChange): void;
807
942
  destroy(): void;
808
943
  }
809
944
 
945
+ /**
946
+ * Effect will recomputed each time a watchable variable or effect or computed are changed
947
+ * Each time the function is called, dependencies tree is updated. It's usefull when you have array or conditional inside
948
+ */
810
949
  @Storybook({
811
950
  prefix: "Lib/Watcher"
812
951
  })
813
952
  class Effect {
814
953
  @InternalProtected()
815
954
  protected callbacks: {
816
- receiver: EffectReceiver;
955
+ receiver: Aventus.EffectReceiver;
817
956
  path: string;
818
957
  registerPath?: string;
819
958
  fullPath: string;
820
- cb: WatcherChange;
959
+ cb: Aventus.WatcherChange;
821
960
  version: number;
822
961
  }[];
823
962
  @InternalProtected()
824
963
  protected isInit: boolean;
825
964
  @InternalProtected()
826
965
  protected isDestroy: boolean;
827
- protected __subscribes: WatcherChange[];
966
+ protected __subscribes: Aventus.WatcherChange[];
828
967
  protected __allowChanged: ___Aventus.WatcherAllowed[];
829
968
  @InternalProtected()
830
969
  protected version: number;
@@ -834,20 +973,25 @@ class Effect {
834
973
  protected init(): void;
835
974
  protected run(): void;
836
975
  @InternalProtected()
837
- protected register(receiver: EffectReceiver, path: string, version: number, fullPath: string): void;
976
+ protected register(receiver: Aventus.EffectReceiver, path: string, version: number, fullPath: string): void;
838
977
  canChange(fct: ___Aventus.WatcherAllowed): void;
839
- protected checkCanChange(action: WatchAction, changePath: string, value: any, dones: any[]): boolean;
840
- protected onChange(action: WatchAction, changePath: string, value: any, dones: any[]): void;
978
+ protected checkCanChange(action: Aventus.WatchAction, changePath: string, value: any, dones: any[]): boolean;
979
+ protected onChange(action: Aventus.WatchAction, changePath: string, value: any, dones: any[]): void;
841
980
  destroy(): void;
842
981
  protected clearCallbacks(): void;
843
- subscribe(fct: WatcherChange): void;
844
- unsubscribe(fct: WatcherChange): void;
982
+ subscribe(fct: Aventus.WatcherChange): void;
983
+ unsubscribe(fct: Aventus.WatcherChange): void;
845
984
  }
846
985
 
986
+ /**
987
+ * Computed will recomputed each time a watchable variable or effect or computed are changed
988
+ * When no change occured you can get the value by calling the value property
989
+ * Each time the function is called, dependencies tree is updated. It's usefull when you have array or conditional inside
990
+ */
847
991
  @Storybook({
848
992
  prefix: "Lib/Watcher"
849
993
  })
850
- class Computed<T = any> extends Effect implements EffectReceiver {
994
+ class Computed<T = any> extends Aventus.Effect implements Aventus.EffectReceiver {
851
995
  protected _value?: T;
852
996
  @Internal()
853
997
  private __path;
@@ -856,13 +1000,14 @@ class Computed<T = any> extends Effect implements EffectReceiver {
856
1000
  constructor(fct: () => ___Aventus.IsNotVoid<T>);
857
1001
  protected init(): void;
858
1002
  protected computedValue(): void;
859
- protected onChange(action: WatchAction, changePath: string, value: any, dones: any[]): void;
1003
+ protected onChange(action: Aventus.WatchAction, changePath: string, value: any, dones: any[]): void;
860
1004
  }
861
1005
 
862
1006
  @Storybook({
863
1007
  prefix: "Lib/Watcher"
864
1008
  })
865
1009
  class Watcher {
1010
+ static isNative(obj: any): boolean;
866
1011
  private constructor();
867
1012
  private static __reservedName;
868
1013
  private static __triggerForced;
@@ -873,41 +1018,50 @@ class Watcher {
873
1018
  /**
874
1019
  * Transform object into a watcher
875
1020
  */
876
- static get(obj: object, onDataChanged?: WatcherFunction): any;
1021
+ static get(obj: object, onDataChanged?: Aventus.WatcherFunction): any;
877
1022
  static is(obj: any): boolean;
878
1023
  static extract<T>(obj: T, clearPath?: boolean): T;
879
1024
  static trigger<T>(type: 'CREATED' | 'UPDATED' | 'DELETED', target: T): void;
880
1025
  /**
881
1026
  * Create a computed variable that will watch any changes
882
1027
  */
883
- static computed<T>(fct: () => ___Aventus.IsNotVoid<T>): Computed<T>;
1028
+ static computed<T>(fct: () => ___Aventus.IsNotVoid<T>): Aventus.Computed<T>;
884
1029
  /**
885
1030
  * Create an effect variable that will watch any changes
886
1031
  */
887
- static effect(fct: () => void): Effect;
1032
+ static effect(fct: () => void): Aventus.Effect;
888
1033
  /**
889
1034
  * Create an effect variable that will watch any changes inside the fct and trigger the cb on change
890
1035
  */
891
- static watch(fct: () => any, cb: () => any): Effect;
1036
+ static watch(fct: () => any, cb: () => any): Aventus.Effect;
892
1037
  /**
893
1038
  * Create a signal variable
894
1039
  */
895
- static signal<T>(item: T, onChange?: () => void): Signal<T>;
1040
+ static signal<T>(item: T, onChange?: () => void): Aventus.Signal<T>;
896
1041
  }
897
1042
 
1043
+ /**
1044
+ * Computed will recomputed each time a watchable variable or effect or computed are changed
1045
+ * When no change occured you can get the value by calling the value property
1046
+ * The dependencies tree is created only during the first execution
1047
+ */
898
1048
  @Storybook({
899
1049
  prefix: "Lib/Watcher"
900
1050
  })
901
- class ComputedNoRecomputed<T = any> extends Computed<T> {
1051
+ class ComputedNoRecomputed<T = any> extends Aventus.Computed<T> {
902
1052
  protected init(): void;
903
1053
  protected computedValue(): void;
904
1054
  protected run(): void;
905
1055
  }
906
1056
 
1057
+ /**
1058
+ * Effect will recomputed each time a watchable variable or effect or computed are changed
1059
+ * The dependencies tree is created only during the first execution
1060
+ */
907
1061
  @Storybook({
908
1062
  prefix: "Lib/Watcher"
909
1063
  })
910
- class EffectNoRecomputed extends Effect {
1064
+ class EffectNoRecomputed extends Aventus.Effect {
911
1065
  protected init(): void;
912
1066
  protected run(): void;
913
1067
  }
@@ -917,77 +1071,84 @@ class EffectNoRecomputed extends Effect {
917
1071
  })
918
1072
  class HttpRouter {
919
1073
  @InternalProtected()
920
- protected options: HttpRouterOptions;
1074
+ private static options?;
1075
+ static configure(options: Aventus.HttpRouterOptions): void;
1076
+ @InternalProtected()
1077
+ protected options: Aventus.HttpRouterOptions;
921
1078
  constructor();
922
1079
  private defaultOptionsValue;
923
- protected defineOptions(options: HttpRouterOptions): HttpRouterOptions;
924
- get<T>(url: string): Promise<ResultWithError<T>>;
1080
+ protected defineOptions(options: Aventus.HttpRouterOptions): Aventus.HttpRouterOptions;
1081
+ get<T>(url: string): Promise<Aventus.ResultWithError<T>>;
925
1082
  post<T>(url: string, data?: {
926
1083
  [key: string | number]: any;
927
- } | FormData): Promise<ResultWithError<T>>;
1084
+ } | FormData): Promise<Aventus.ResultWithError<T>>;
928
1085
  put<T>(url: string, data?: {
929
1086
  [key: string | number]: any;
930
- } | FormData): Promise<ResultWithError<T>>;
1087
+ } | FormData): Promise<Aventus.ResultWithError<T>>;
931
1088
  delete<T>(url: string, data?: {
932
1089
  [key: string | number]: any;
933
- } | FormData): Promise<ResultWithError<T>>;
1090
+ } | FormData): Promise<Aventus.ResultWithError<T>>;
934
1091
  option<T>(url: string, data?: {
935
1092
  [key: string | number]: any;
936
- } | FormData): Promise<ResultWithError<T>>;
1093
+ } | FormData): Promise<Aventus.ResultWithError<T>>;
937
1094
  }
938
1095
 
939
- type RouterType = (abstract new (...args: any[]) => HttpRouter);
1096
+ type RouterType = (abstract new (...args: any[]) => Aventus.HttpRouter);
940
1097
 
941
1098
  @Storybook({
942
1099
  prefix: "Http"
943
1100
  })
944
1101
  class HttpRoute {
945
- protected router: HttpRouter;
946
- constructor(router?: HttpRouter);
1102
+ protected router: Aventus.HttpRouter;
1103
+ constructor(router?: Aventus.HttpRouter);
947
1104
  getPrefix(): string;
948
1105
  }
949
1106
 
950
- type RouteType = abstract new (...args: any[]) => HttpRoute;
1107
+ type RouteType = abstract new (...args: any[]) => Aventus.HttpRoute;
951
1108
 
952
1109
  @Storybook({
953
1110
  prefix: "Http"
954
1111
  })
955
1112
  class HttpRequest {
956
1113
  private static options?;
957
- static configure(options: HttpRequestOptions): void;
1114
+ static configure(options: Aventus.HttpRequestOptions): void;
958
1115
  private request;
959
1116
  private url;
960
1117
  private methodSpoofing;
961
- constructor(url: string, method?: HttpMethod, body?: {
1118
+ private useCache;
1119
+ constructor(url: string, method?: Aventus.HttpMethod, body?: {
962
1120
  [key: string | number]: any;
963
- } | FormData, methodSpoofing?: boolean);
1121
+ } | FormData, methodSpoofing?: boolean, useCache?: boolean);
964
1122
  setUrl(url: string): void;
965
1123
  toString(): string;
966
1124
  setBody(body: {
967
1125
  [key: string | number]: any;
968
1126
  } | FormData): void;
969
- setMethod(method: HttpMethod): void;
1127
+ setMethod(method: Aventus.HttpMethod): void;
970
1128
  /**
971
1129
  * Replace method Put/Delete by _method:"put" inside a form
972
1130
  */
973
1131
  enableMethodSpoofing(): void;
1132
+ enableCache(): void;
1133
+ disableCache(): void;
974
1134
  private objectToFormData;
975
1135
  jsonReplacer(key: string, value: any): any;
976
1136
  private prepareBody;
977
1137
  setHeader(name: string, value: string): void;
978
1138
  setCredentials(credentials: RequestCredentials): void;
979
- protected _query(router?: HttpRouter): Promise<ResultWithError<Response>>;
980
- query(router?: HttpRouter): Promise<ResultWithError<Response>>;
981
- queryVoid<T>(router?: HttpRouter): Promise<VoidWithError>;
982
- queryJSON<T>(router?: HttpRouter): Promise<ResultWithError<T>>;
983
- queryTxt(router?: HttpRouter): Promise<ResultWithError<string>>;
984
- queryBlob(router?: HttpRouter): Promise<ResultWithError<Blob>>;
1139
+ protected _query(router?: Aventus.HttpRouter): Promise<Aventus.ResultWithError<Aventus.HttpResponse>>;
1140
+ query(router?: Aventus.HttpRouter): Promise<Aventus.ResultWithError<Aventus.HttpResponse>>;
1141
+ queryVoid<T>(router?: Aventus.HttpRouter): Promise<Aventus.VoidWithError>;
1142
+ queryJSON<T>(router?: Aventus.HttpRouter): Promise<Aventus.ResultWithError<T>>;
1143
+ queryTxt(router?: Aventus.HttpRouter): Promise<Aventus.ResultWithError<string>>;
1144
+ queryBlob(router?: Aventus.HttpRouter): Promise<Aventus.ResultWithError<Blob>>;
1145
+ clearCache(router?: Aventus.HttpRouter): void;
985
1146
  }
986
1147
 
987
1148
  @Storybook({
988
1149
  prefix: "Http"
989
1150
  })
990
- abstract class StorableRoute<T extends IData> extends HttpRoute {
1151
+ abstract class StorableRoute<T extends Aventus.IData> extends Aventus.HttpRoute {
991
1152
  GetAll(): unknown;
992
1153
  Create(body: {
993
1154
  item: T;
@@ -1013,7 +1174,7 @@ class Animation {
1013
1174
  private fpsInterval;
1014
1175
  private continueAnimation;
1015
1176
  private frame_id;
1016
- constructor(options: AnimationOptions);
1177
+ constructor(options: Aventus.AnimationOptions);
1017
1178
  private animate;
1018
1179
  /**
1019
1180
  * Start the of animation
@@ -1041,45 +1202,73 @@ class Animation {
1041
1202
  isStarted(): boolean;
1042
1203
  }
1043
1204
 
1044
- type DragElement = DragElementXY | DragElementLeftTop;
1205
+ type DragElement = Aventus.DragElementXY | Aventus.DragElementLeftTop;
1045
1206
 
1046
1207
  @Storybook({
1047
1208
  prefix: "Lib/DragAndDrop"
1048
1209
  })
1049
1210
  interface DragAndDropOptionsShadow {
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 */
1050
1212
  enable: boolean;
1213
+ /** The container where the shadow element will be added, default is body */
1051
1214
  container?: ___Aventus.ContainerElement;
1215
+ /** Remove shadow from tree */
1052
1216
  removeOnStop?: boolean;
1053
- transform?: (el: DragElement) => void;
1054
- delete?: (el: DragElement) => void;
1217
+ /** Add custom transformation for the shadow element */
1218
+ transform?: (el: Aventus.DragElement) => void;
1219
+ /** Trigger to destroy the clone element, If you set the paramater you must remove the element from DOM yourself */
1220
+ delete?: (el: Aventus.DragElement) => void;
1055
1221
  }
1056
1222
 
1057
1223
  @Storybook({
1058
1224
  prefix: "Lib/DragAndDrop"
1059
1225
  })
1060
1226
  interface DragAndDropOptions {
1227
+ /** If set to false, the element won't move */
1061
1228
  applyDrag?: boolean;
1062
- element: DragElement;
1229
+ /** Element to drag and drog */
1230
+ element: Aventus.DragElement;
1231
+ /** Element that trigger the drag action; default is element */
1063
1232
  elementTrigger?: HTMLElement | SVGElement;
1233
+ /** Set the default offset for the drag trigger; default is DragAndDrop.defaultOffsetDrag */
1064
1234
  offsetDrag?: number;
1235
+ /** Set the drag direction to watch */
1065
1236
  dragDirection?: 'X' | 'Y' | 'XY';
1066
- shadow?: DragAndDropOptionsShadow;
1237
+ /** Options to create a shadow element */
1238
+ shadow?: Aventus.DragAndDropOptionsShadow;
1239
+ /** If set to false, the element will be considered as in the target if it touches it */
1067
1240
  strict?: boolean;
1241
+ /** The targets for the drop action */
1068
1242
  targets?: ___Aventus.TargetableElement[] | (() => ___Aventus.TargetableElement[]);
1243
+ /** Use percent instead of pixel */
1069
1244
  usePercent?: boolean;
1245
+ /** Stop Propagation */
1070
1246
  stopPropagation?: boolean | (() => boolean);
1247
+ /** If set to true, the drag and drop will use the mouse position to calculate drop targets */
1071
1248
  useMouseFinalPosition?: boolean;
1249
+ /** Determine if should use x,y coordinates or transform="translate(x,y)" */
1072
1250
  useTransform?: boolean;
1251
+ /** Determine if drag is active or not */
1073
1252
  isDragEnable?: () => boolean;
1253
+ /** Get current zoom */
1074
1254
  getZoom?: () => number;
1255
+ /** Get offset X in px related to element.offsetTarget */
1075
1256
  getOffsetX?: () => number;
1257
+ /** Get offset Y in px related to element.offsetTarget */
1076
1258
  getOffsetY?: () => number;
1077
- onPointerDown?: (e: NormalizedEvent) => void;
1078
- onPointerUp?: (e: NormalizedEvent) => void;
1079
- onStart?: (e: NormalizedEvent) => void | boolean;
1080
- onMove?: (e: NormalizedEvent, position: ___Aventus.Coordinate) => void;
1081
- onStop?: (e: NormalizedEvent) => void;
1082
- onDrop?: (element: DragElement, targets: ___Aventus.TargetableElement[]) => void;
1259
+ /** Trigger on pointer down*/
1260
+ onPointerDown?: (e: Aventus.NormalizedEvent) => void;
1261
+ /** Trigger on pointer up*/
1262
+ onPointerUp?: (e: Aventus.NormalizedEvent) => void;
1263
+ /** Trigger on drag start*/
1264
+ onStart?: (e: Aventus.NormalizedEvent) => void | boolean;
1265
+ /** Trigger on moving */
1266
+ onMove?: (e: Aventus.NormalizedEvent, position: ___Aventus.Coordinate) => void;
1267
+ /** Trigger after stop moving */
1268
+ onStop?: (e: Aventus.NormalizedEvent) => void;
1269
+ /** Trigger after drop if at least one target found; Element is the shadow or the target*/
1270
+ onDrop?: (element: Aventus.DragElement, targets: ___Aventus.TargetableElement[]) => void;
1271
+ /** correct the position if you need */
1083
1272
  correctPosition?: (position: ___Aventus.Coordinate) => ___Aventus.Coordinate;
1084
1273
  }
1085
1274
 
@@ -1088,73 +1277,73 @@ interface DragAndDropOptions {
1088
1277
  })
1089
1278
  class PressManager {
1090
1279
  private static globalConfig;
1091
- static configure(options: Partial<PressManagerOptions>): void;
1092
- static create(options: PressManagerOptions & {
1280
+ static configure(options: Partial<Aventus.PressManagerOptions>): void;
1281
+ static create(options: Aventus.PressManagerOptions & {
1093
1282
  element: Element;
1094
1283
  }): PressManager;
1095
- static create(options: PressManagerOptions & {
1284
+ static create(options: Aventus.PressManagerOptions & {
1096
1285
  element: Element[];
1097
1286
  }): PressManager[];
1098
- static onEvent: Callback<(e: NormalizedEvent, instance: PressManager) => void>;
1099
- protected options: PressManagerOptions;
1287
+ static onEvent: Aventus.Callback<(e: Aventus.NormalizedEvent, instance: PressManager) => void>;
1288
+ protected options: Aventus.PressManagerOptions;
1100
1289
  protected element: Element;
1101
1290
  protected delayDblPress: number;
1102
1291
  protected delayLongPress: number;
1103
1292
  protected nbPress: number;
1104
1293
  protected offsetDrag: number;
1105
1294
  protected dragDirection: 'X' | 'Y' | 'XY';
1106
- protected state: PressManagerState;
1295
+ protected state: Aventus.PressManagerState;
1107
1296
  protected startPosition: {
1108
1297
  x: number;
1109
1298
  y: number;
1110
1299
  };
1111
- protected customFcts: InternalCustomFunction;
1300
+ protected customFcts: Aventus.InternalCustomFunction;
1112
1301
  protected timeoutDblPress: number;
1113
1302
  protected timeoutLongPress: number;
1114
- protected downEventSaved?: NormalizedEvent;
1303
+ protected downEventSaved?: Aventus.NormalizedEvent;
1115
1304
  protected useDblPress: boolean;
1116
1305
  protected stopPropagation: () => boolean;
1117
1306
  protected pointersRecord: {
1118
1307
  [id: number]: Event;
1119
1308
  };
1120
1309
  protected functionsBinded: {
1121
- downAction: (e: PointerEvent) => void;
1122
- downActionDelay: (e: PointerEvent) => void;
1123
- upAction: (e: PointerEvent) => void;
1124
- moveAction: (e: PointerEvent) => void;
1125
- childPressStart: (e: InternalPointerEvent) => void;
1126
- childPressEnd: (e: InternalPointerEvent) => void;
1127
- childPressMove: (e: InternalPointerEvent) => void;
1310
+ downAction: (e: Event) => void;
1311
+ downActionDelay: (e: Event) => void;
1312
+ upAction: (e: Event) => void;
1313
+ moveAction: (e: Event) => void;
1314
+ childPressStart: (e: Event) => void;
1315
+ childPressEnd: (e: Event) => void;
1316
+ childPressMove: (e: Event) => void;
1128
1317
  };
1129
1318
  /**
1130
1319
  * @param {*} options - The options
1131
1320
  * @param {HTMLElement | HTMLElement[]} options.element - The element to manage
1132
1321
  */
1133
- constructor(options: PressManagerOptions);
1322
+ constructor(options: Aventus.PressManagerOptions);
1134
1323
  /**
1135
1324
  * Get the current element focused by the PressManager
1136
1325
  */
1137
1326
  getElement(): Element;
1138
- protected checkDragConstraint(options: PressManagerOptions): void;
1139
- protected assignValueOption(options: PressManagerOptions): void;
1327
+ protected checkDragConstraint(options: Aventus.PressManagerOptions): void;
1328
+ protected assignValueOption(options: Aventus.PressManagerOptions): void;
1140
1329
  protected bindAllFunction(): void;
1141
1330
  protected init(): void;
1142
1331
  protected identifyEvent(touch: Touch | PointerEvent): number;
1143
1332
  protected registerEvent(ev: PointerEvent | TouchEvent): boolean;
1144
1333
  protected unregisterEvent(ev: PointerEvent | TouchEvent): boolean;
1145
- protected genericDownAction(state: PressManagerState, e: NormalizedEvent): void;
1334
+ protected genericDownAction(state: Aventus.PressManagerState, e: Aventus.NormalizedEvent): void;
1146
1335
  private pointerEventTriggered;
1147
- protected downActionDelay(ev: PointerEvent | TouchEvent): void;
1148
- protected downAction(ev: PointerEvent | TouchEvent): void;
1149
- protected genericUpAction(state: PressManagerState, e: NormalizedEvent): void;
1150
- protected upAction(ev: PointerEvent | TouchEvent): void;
1151
- protected genericMoveAction(state: PressManagerState, e: NormalizedEvent): void;
1152
- protected moveAction(ev: PointerEvent): void;
1153
- protected childPressStart(e: InternalPointerEvent): void;
1154
- protected childPressEnd(e: InternalPointerEvent): void;
1155
- protected childPressMove(e: InternalPointerEvent): void;
1156
- protected lastEmitEvent?: NormalizedEvent;
1157
- protected emitTriggerFunction(action: string, e: NormalizedEvent, el?: Element | null): void;
1336
+ protected downActionDelay(_ev: Event): void;
1337
+ protected downAction(_ev: Event): void;
1338
+ protected genericUpAction(state: Aventus.PressManagerState, e: Aventus.NormalizedEvent): void;
1339
+ protected upAction(_ev: Event): void;
1340
+ protected genericMoveAction(state: Aventus.PressManagerState, e: Aventus.NormalizedEvent): void;
1341
+ protected moveAction(_ev: Event): void;
1342
+ protected childPressStart(_e: Event): void;
1343
+ protected childPressEnd(_e: Event): void;
1344
+ protected childPressMove(_e: Event): void;
1345
+ protected lastEmitEvent?: Aventus.NormalizedEvent;
1346
+ protected emitTriggerFunction(action: string, e: Aventus.NormalizedEvent, el?: Element | null): void;
1158
1347
  /**
1159
1348
  * Destroy the Press instance byremoving all events
1160
1349
  */
@@ -1175,7 +1364,7 @@ class DragAndDrop {
1175
1364
  private startElementPosition;
1176
1365
  private isEnable;
1177
1366
  private draggableElement;
1178
- constructor(options: DragAndDropOptions);
1367
+ constructor(options: Aventus.DragAndDropOptions);
1179
1368
  private getDefaultOptions;
1180
1369
  private mergeProperties;
1181
1370
  private mergeFunctions;
@@ -1201,7 +1390,7 @@ class DragAndDrop {
1201
1390
  /**
1202
1391
  * Get element currently dragging
1203
1392
  */
1204
- getElementDrag(): DragElement;
1393
+ getElementDrag(): Aventus.DragElement;
1205
1394
  /**
1206
1395
  * Set targets where to drop
1207
1396
  */
@@ -1229,9 +1418,9 @@ class DragAndDrop {
1229
1418
  })
1230
1419
  class Instance {
1231
1420
  private static elements;
1232
- static get<X>(type: InstanceCst2<X>): X;
1233
- static set<X extends InstanceCst>(el: X): boolean;
1234
- static destroy<X extends InstanceCst>(el: X): boolean;
1421
+ static get<X>(type: Aventus.InstanceCst2<X>): X;
1422
+ static set<X extends Aventus.InstanceCst>(el: X): boolean;
1423
+ static destroy<X extends Aventus.InstanceCst>(el: X): boolean;
1235
1424
  }
1236
1425
 
1237
1426
  @Storybook({
@@ -1247,7 +1436,7 @@ class ResizeObserver {
1247
1436
  private static resizeObserverClassByObject;
1248
1437
  private static uniqueInstance;
1249
1438
  private static getUniqueInstance;
1250
- constructor(options: ResizeObserverOptions | CallableFunction);
1439
+ constructor(options: Aventus.ResizeObserverOptions | ResizeObserverCallback);
1251
1440
  /**
1252
1441
  * Observe size changing for the element
1253
1442
  */
@@ -1267,58 +1456,71 @@ class ResizeObserver {
1267
1456
 
1268
1457
  type PreparedUri = {
1269
1458
  regex: RegExp;
1270
- params: UriParams[];
1459
+ params: Aventus.UriParams[];
1271
1460
  };
1272
1461
 
1273
1462
  @Storybook({
1274
1463
  prefix: "Lib/Uri"
1275
1464
  })
1276
1465
  class Uri {
1277
- static prepare(uri: string): PreparedUri;
1278
- static getParams(from: string | PreparedUri, current: string): UriParamsValue | null;
1279
- static isActive(from: string | PreparedUri, current: string): boolean;
1466
+ static prepare(uri: string): Aventus.PreparedUri;
1467
+ static getParams(from: string | Aventus.PreparedUri, current: string): Aventus.UriParamsValue | null;
1468
+ static isActive(from: string | Aventus.PreparedUri, current: string): boolean;
1280
1469
  static normalize(path: string): any;
1281
1470
  }
1282
1471
 
1472
+ /**
1473
+ * Class representing a specific RAM error.
1474
+ * Inherits from GenericError with the error code type RamErrorCode.
1475
+ */
1283
1476
  @Storybook({
1284
1477
  prefix: "Ram"
1285
1478
  })
1286
- class RamError extends GenericError<RamErrorCode> {
1479
+ class RamError extends Aventus.GenericError<Aventus.RamErrorCode> {
1287
1480
  }
1288
1481
 
1482
+ /**
1483
+ * Class representing the result of an action that may contain RAM-specific errors without a result.
1484
+ * Inherits from VoidWithError with the error type RamError.
1485
+ */
1289
1486
  @Storybook({
1290
1487
  prefix: "Ram"
1291
1488
  })
1292
- class ResultRamWithError<T> extends ResultWithError<T, RamError> {
1489
+ class VoidRamWithError extends Aventus.VoidWithError<Aventus.RamError> {
1293
1490
  }
1294
1491
 
1492
+ /**
1493
+ * Class representing the result of an action that may contain RAM-specific errors with a result of a generic type.
1494
+ * @template T - The type of the action result.
1495
+ * Inherits from ResultWithError with the error type RamError.
1496
+ */
1295
1497
  @Storybook({
1296
1498
  prefix: "Ram"
1297
1499
  })
1298
- class VoidRamWithError extends VoidWithError<RamError> {
1500
+ class ResultRamWithError<T> extends Aventus.ResultWithError<T, Aventus.RamError> {
1299
1501
  }
1300
1502
 
1301
1503
  @Storybook({
1302
1504
  prefix: "Ram"
1303
1505
  })
1304
- interface IRamAction<T> {
1305
- update(newData: KeysObject<T>): Promise<this | undefined>;
1306
- updateWithError(newData: KeysObject<T>): Promise<ResultRamWithError<this>>;
1506
+ interface IRamAction<Resource, Request> {
1507
+ update(newData: Request): Promise<this | undefined>;
1508
+ updateWithError(newData: Request): Promise<Aventus.ResultRamWithError<this>>;
1307
1509
  onUpdate(callback: (item: this) => void): void;
1308
1510
  offUpdate(callback: (item: this) => void): void;
1309
1511
  delete(): Promise<void>;
1310
- deleteWithError(): Promise<VoidRamWithError>;
1512
+ deleteWithError(): Promise<Aventus.VoidRamWithError>;
1311
1513
  onDelete(callback: (item: this) => void): void;
1312
1514
  offDelete(callback: (item: this) => void): void;
1313
1515
  }
1314
1516
 
1315
- type RamItem<T extends IRamData> = T & IRamAction<T>;
1517
+ type RamItem<Resource extends Aventus.IRamData, Request> = Resource & Aventus.IRamAction<Resource, Request>;
1316
1518
 
1317
1519
  @Storybook({
1318
1520
  prefix: "Ram"
1319
1521
  })
1320
- abstract class GenericRam<Index, T extends IRamData, U extends T = T> implements IRam {
1321
- static readonly info: Map<IRam, new () => any>;
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
+ static readonly info: Map<Aventus.IRam, new () => any>;
1322
1524
  /**
1323
1525
  * The current namespace
1324
1526
  */
@@ -1328,16 +1530,16 @@ abstract class GenericRam<Index, T extends IRamData, U extends T = T> implements
1328
1530
  */
1329
1531
  static get Fullname(): string;
1330
1532
  private subscribers;
1331
- protected recordsSubscribers: Map<Index, ___Aventus.RamSubscribers<RamItem<U>>>;
1533
+ protected recordsSubscribers: Map<Index, ___Aventus.RamSubscribers<Aventus.RamItem<ResourceDetails, Request>>>;
1332
1534
  /**
1333
1535
  * List of stored item by index key
1334
1536
  */
1335
- protected records: Map<Index, RamItem<U>>;
1336
- protected actionGuard: ActionGuard;
1537
+ protected records: Map<Index, Aventus.RamItem<ResourceDetails, Request>>;
1538
+ protected actionGuard: Aventus.ActionGuard;
1337
1539
  @InternalProtected()
1338
1540
  protected ramMapping: {
1339
1541
  [key: string]: {
1340
- ram: IRam;
1542
+ ram: Aventus.IRam;
1341
1543
  asArray: boolean;
1342
1544
  };
1343
1545
  };
@@ -1346,17 +1548,17 @@ abstract class GenericRam<Index, T extends IRamData, U extends T = T> implements
1346
1548
  * Define the field where the index key is location
1347
1549
  * Example : 'id';
1348
1550
  */
1349
- abstract defineIndexKey(): keyof T;
1551
+ abstract defineIndexKey(): keyof ResourceDetails;
1350
1552
  /**
1351
1553
  * Get item id
1352
1554
  */
1353
1555
  @BindThis()
1354
- getIdWithError(item: KeysObject<T> | T): ResultRamWithError<Index>;
1556
+ getIdWithError(item: Aventus.KeysObject<ResourceDetails> | ResourceDetails): Aventus.ResultRamWithError<Index>;
1355
1557
  /**
1356
1558
  * Get item id
1357
1559
  */
1358
1560
  @BindThis()
1359
- getId(item: KeysObject<T> | T): Index;
1561
+ getId(item: Aventus.KeysObject<ResourceDetails> | ResourceDetails): Index;
1360
1562
  /**
1361
1563
  * Prevent adding Watch element
1362
1564
  */
@@ -1364,281 +1566,311 @@ abstract class GenericRam<Index, T extends IRamData, U extends T = T> implements
1364
1566
  /**
1365
1567
  * Add function update, onUpdate, offUpdate, delete, onDelete, offDelete
1366
1568
  */
1367
- protected addRamAction<B extends (new (...args: any[]) => IRamData) & {
1569
+ protected addRamAction<B extends (new (...args: any[]) => Aventus.IRamData) & {
1368
1570
  className?: string;
1369
1571
  }>(Base: B): {
1370
- new (...args: any[]): IRamData;
1572
+ new (...args: any[]): Aventus.IRamData;
1371
1573
  get className(): string;
1372
1574
  } & B;
1373
1575
  /**
1374
1576
  * Define the right type base of the json received
1375
1577
  */
1376
- protected abstract getTypeForData(objJson: KeysObject<T> | T): new () => U;
1578
+ protected abstract getTypeForData(objJson: any): new () => ResourceDetails;
1377
1579
  /**
1378
1580
  * Define all the types you ram is capable of
1379
1581
  */
1380
1582
  @InternalProtected()
1381
- protected ramForTypes(): (new () => U)[];
1583
+ protected ramForTypes(): (new () => ResourceDetails)[];
1382
1584
  /**
1383
1585
  * Transform the object into the object stored inside Ram
1384
1586
  */
1385
- protected getObjectForRam(objJson: KeysObject<T> | T): RamItem<U>;
1587
+ protected getObjectForRam(objJson: any): Aventus.RamItem<ResourceDetails, Request>;
1386
1588
  /**
1387
1589
  * Add element inside Ram or update it. The instance inside the ram is unique and ll never be replaced
1388
1590
  */
1389
- protected addOrUpdateData(item: KeysObject<T>, result: ResultWithError<RamItem<T>>): Promise<'created' | 'updated' | null>;
1591
+ protected addOrUpdateData(item: ResourceDetails): Promise<Aventus.ResultWithError<{
1592
+ kind: 'created' | 'updated';
1593
+ value: Aventus.RamItem<ResourceDetails, Request>;
1594
+ }>>;
1390
1595
  /**
1391
1596
  * Merge object and create real instance of class
1392
1597
  */
1393
- protected mergeObject(item: T | undefined, objJson: KeysObject<T> | T, options?: JsonFromOptions): void;
1598
+ protected mergeObject(item: ResourceDetails | undefined, objJson: Aventus.KeysObject<ResourceDetails> | ResourceDetails, options?: Aventus.JsonFromOptions): void;
1394
1599
  /**
1395
1600
  * Create or update the item
1396
1601
  */
1397
1602
  @BindThis()
1398
- save(item: T, ...args: any[]): Promise<RamItem<U> | undefined>;
1603
+ save(item: Request, ...args: any[]): Promise<Aventus.RamItem<ResourceDetails, Request> | undefined>;
1399
1604
  /**
1400
1605
  * Create or update the item
1401
1606
  */
1402
1607
  @BindThis()
1403
- saveWithError(item: T, ...args: any[]): Promise<ResultRamWithError<RamItem<U>>>;
1404
- protected beforeRecordSet(item: RamItem<T>): Promise<void>;
1405
- protected afterRecordSet(item: RamItem<T>): Promise<void>;
1406
- protected beforeRecordDelete(item: RamItem<T>): Promise<void>;
1407
- protected afterRecordDelete(item: RamItem<T>): Promise<void>;
1408
- protected publish(type: 'created' | 'updated' | 'deleted', data: RamItem<U>): void;
1608
+ saveWithError(item: Request, ...args: any[]): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>>>;
1609
+ protected beforeRecordSet(item: Aventus.RamItem<ResourceDetails, Request>): Promise<Aventus.VoidWithError>;
1610
+ protected afterRecordSet(item: Aventus.RamItem<ResourceDetails, Request>): Promise<Aventus.VoidWithError>;
1611
+ protected beforeRecordDelete(item: Aventus.RamItem<ResourceDetails, Request>): Promise<Aventus.VoidWithError>;
1612
+ protected afterRecordDelete(item: Aventus.RamItem<ResourceDetails, Request>): Promise<Aventus.VoidWithError>;
1613
+ protected publish(type: 'created' | 'updated' | 'deleted', data: Aventus.RamItem<ResourceDetails, Request>): void;
1409
1614
  private subscribe;
1410
1615
  private unsubscribe;
1411
1616
  /**
1412
1617
  * Add a callback that ll be triggered when a new item is stored
1413
1618
  */
1414
1619
  @BindThis()
1415
- onCreated(cb: (item: RamItem<U>) => void): void;
1620
+ onCreated(cb: (item: Aventus.RamItem<ResourceDetails, Request>) => void): void;
1416
1621
  /**
1417
1622
  * Remove a created callback
1418
1623
  */
1419
1624
  @BindThis()
1420
- offCreated(cb: (item: RamItem<U>) => void): void;
1625
+ offCreated(cb: (item: Aventus.RamItem<ResourceDetails, Request>) => void): void;
1421
1626
  /**
1422
1627
  * Add a callback that ll be triggered when an item is updated
1423
1628
  */
1424
1629
  @BindThis()
1425
- onUpdated(cb: (item: RamItem<U>) => void): void;
1630
+ onUpdated(cb: (item: Aventus.RamItem<ResourceDetails, Request>) => void): void;
1426
1631
  /**
1427
1632
  * Remove an updated callback
1428
1633
  */
1429
1634
  @BindThis()
1430
- offUpdated(cb: (item: RamItem<U>) => void): void;
1635
+ offUpdated(cb: (item: Aventus.RamItem<ResourceDetails, Request>) => void): void;
1431
1636
  /**
1432
1637
  * Add a callback that ll be triggered when an item is deleted
1433
1638
  */
1434
1639
  @BindThis()
1435
- onDeleted(cb: (item: RamItem<U>) => void): void;
1640
+ onDeleted(cb: (item: Aventus.RamItem<ResourceDetails, Request>) => void): void;
1436
1641
  /**
1437
1642
  * Remove an deleted callback
1438
1643
  */
1439
1644
  @BindThis()
1440
- offDeleted(cb: (item: RamItem<U>) => void): void;
1645
+ offDeleted(cb: (item: Aventus.RamItem<ResourceDetails, Request>) => void): void;
1441
1646
  /**
1442
1647
  * Get an item by id if exist (alias for getById)
1443
1648
  */
1444
1649
  @BindThis()
1445
- get(id: Index): Promise<RamItem<U> | undefined>;
1650
+ get(id: Index): Promise<Aventus.RamItem<ResourceDetails, Request> | undefined>;
1446
1651
  /**
1447
1652
  * Get an item by id if exist (alias for getById)
1448
1653
  */
1449
1654
  @BindThis()
1450
- getWithError(id: Index): Promise<ResultRamWithError<RamItem<U>>>;
1655
+ getWithError(id: Index): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>>>;
1451
1656
  /**
1452
1657
  * Get an item by id if exist
1453
1658
  */
1454
1659
  @BindThis()
1455
- getById(id: Index): Promise<RamItem<U> | undefined>;
1660
+ getById(id: Index): Promise<Aventus.RamItem<ResourceDetails, Request> | undefined>;
1456
1661
  /**
1457
1662
  * Get an item by id if exist
1458
1663
  */
1459
1664
  @BindThis()
1460
- getByIdWithError(id: Index): Promise<ResultRamWithError<RamItem<U>>>;
1665
+ getByIdWithError(id: Index): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>>>;
1461
1666
  /**
1462
1667
  * Trigger before getting an item by id
1463
1668
  */
1464
- protected beforeGetById(id: Index, result: ResultRamWithError<RamItem<U>>): Promise<void>;
1669
+ protected beforeGetById(id: Index): Promise<Aventus.VoidWithError>;
1465
1670
  /**
1466
1671
  * Trigger after getting an item by id
1467
1672
  */
1468
- protected afterGetById(result: ResultRamWithError<RamItem<U>>): Promise<void>;
1673
+ protected afterGetById(result: Aventus.RamItem<ResourceDetails, Request>): Promise<Aventus.VoidWithError>;
1469
1674
  /**
1470
1675
  * Get multiple items by ids
1471
1676
  */
1472
1677
  @BindThis()
1473
- getByIds(ids: Index[]): Promise<RamItem<U>[]>;
1678
+ getByIds(ids: Index[]): Promise<Aventus.RamItem<ResourceDetails, Request>[]>;
1474
1679
  /**
1475
1680
  * Get multiple items by ids
1476
1681
  */
1477
1682
  @BindThis()
1478
- getByIdsWithError(ids: Index[]): Promise<ResultRamWithError<RamItem<U>[]>>;
1683
+ getByIdsWithError(ids: Index[]): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>[]>>;
1479
1684
  /**
1480
1685
  * Trigger before getting a list of items by id
1481
1686
  */
1482
- protected beforeGetByIds(ids: Index[], result: ResultRamWithError<RamItem<U>[]>): Promise<void>;
1687
+ protected beforeGetByIds(ids: Index[]): Promise<Aventus.VoidWithError>;
1483
1688
  /**
1484
1689
  * Trigger after getting a list of items by id
1485
1690
  */
1486
- protected afterGetByIds(result: ResultRamWithError<RamItem<U>[]>): Promise<void>;
1691
+ protected afterGetByIds(result: Aventus.RamItem<ResourceDetails, Request>[]): Promise<Aventus.VoidWithError>;
1487
1692
  /**
1488
1693
  * Get all elements inside the Ram
1489
1694
  */
1490
1695
  @BindThis()
1491
- getAll(): Promise<Map<Index, RamItem<U>>>;
1696
+ getAll(): Promise<Aventus.RamItem<ResourceSimple, Request>[]>;
1492
1697
  /**
1493
1698
  * Get all elements inside the Ram
1494
1699
  */
1495
1700
  @BindThis()
1496
- getAllWithError(): Promise<ResultRamWithError<Map<Index, RamItem<U>>>>;
1701
+ getAllWithError(): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceSimple, Request>[]>>;
1497
1702
  /**
1498
1703
  * Trigger before getting all items inside Ram
1499
1704
  */
1500
- protected beforeGetAll(result: ResultRamWithError<Map<Index, RamItem<U>>>): Promise<void>;
1705
+ protected beforeGetAll(): Promise<Aventus.VoidWithError>;
1501
1706
  /**
1502
1707
  * Trigger after getting all items inside Ram
1503
1708
  */
1504
- protected afterGetAll(result: ResultRamWithError<Map<Index, RamItem<U>>>): Promise<void>;
1709
+ protected afterGetAll(result: Aventus.RamItem<ResourceSimple, Request>[]): Promise<Aventus.VoidWithError>;
1505
1710
  /**
1506
1711
  * Get all elements inside the Ram
1507
1712
  */
1508
1713
  @BindThis()
1509
- getList(): Promise<RamItem<U>[]>;
1714
+ getList(): Promise<Aventus.RamItem<ResourceSimple, Request>[]>;
1510
1715
  /**
1511
1716
  * Get all elements inside the Ram
1512
1717
  */
1513
1718
  @BindThis()
1514
- getListWithError(): Promise<ResultRamWithError<RamItem<U>[]>>;
1719
+ getListWithError(): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceSimple, Request>[]>>;
1720
+ /**
1721
+ * Get all elements inside the Ram
1722
+ */
1723
+ @BindThis()
1724
+ getRecords(): Promise<Map<Index, Aventus.RamItem<ResourceSimple, Request>>>;
1725
+ /**
1726
+ * Get all elements inside the Ram
1727
+ */
1728
+ @BindThis()
1729
+ getRecordsWithError(): Promise<Aventus.ResultRamWithError<Map<Index, Aventus.RamItem<ResourceSimple, Request>>>>;
1515
1730
  /**
1516
1731
  * Create a list of items inside ram
1517
1732
  */
1518
1733
  @BindThis()
1519
- createList(list: T[]): Promise<RamItem<U>[]>;
1734
+ createList(list: Request[]): Promise<Aventus.RamItem<ResourceDetails, Request>[]>;
1520
1735
  /**
1521
1736
  * Create a list of items inside ram
1522
1737
  */
1523
1738
  @BindThis()
1524
- createListWithError(list: T[]): Promise<ResultRamWithError<RamItem<U>[]>>;
1739
+ createListWithError(list: Request[]): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>[]>>;
1525
1740
  /**
1526
1741
  * Create an item inside ram
1527
1742
  */
1528
1743
  @BindThis()
1529
- create(item: T, ...args: any[]): Promise<RamItem<U> | undefined>;
1744
+ create(item: Request, ...args: any[]): Promise<Aventus.RamItem<ResourceDetails, Request> | undefined>;
1530
1745
  /**
1531
1746
  * Create an item inside ram
1532
1747
  */
1533
1748
  @BindThis()
1534
- createWithError(item: T, ...args: any[]): Promise<ResultRamWithError<RamItem<U>>>;
1535
- private _create;
1749
+ createWithError(item: Request, ...args: any[]): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>>>;
1750
+ /**
1751
+ * Transform request to resource item
1752
+ */
1753
+ protected abstract transformCreateRequestToItem(item: Request): Promise<Aventus.ResultWithError<ResourceDetails>>;
1754
+ /**
1755
+ * Transform request to resource item
1756
+ */
1757
+ protected abstract transformCreateRequestListToItem(list: Request[]): Promise<Aventus.ResultWithError<ResourceDetails[]>>;
1536
1758
  /**
1537
1759
  * Trigger before creating a list of items
1538
1760
  */
1539
- protected beforeCreateList(list: T[], result: ResultRamWithError<RamItem<U>[]>): Promise<void>;
1761
+ protected beforeCreateList(list: Request[]): Promise<Aventus.VoidWithError>;
1540
1762
  /**
1541
1763
  * Trigger before creating an item
1542
1764
  */
1543
- protected beforeCreateItem(item: T, fromList: boolean, result: ResultRamWithError<RamItem<U>>): Promise<void>;
1765
+ protected beforeCreateItem(item: Request, fromList: boolean): Promise<Aventus.VoidWithError>;
1544
1766
  /**
1545
1767
  * Trigger after creating an item
1546
1768
  */
1547
- protected afterCreateItem(result: ResultRamWithError<RamItem<U>>, fromList: boolean): Promise<void>;
1769
+ protected afterCreateItem(result: Aventus.RamItem<ResourceDetails, Request>, fromList: boolean): Promise<Aventus.VoidWithError>;
1548
1770
  /**
1549
1771
  * Trigger after creating a list of items
1550
1772
  */
1551
- protected afterCreateList(result: ResultRamWithError<RamItem<U>[]>): Promise<void>;
1773
+ protected afterCreateList(result: Aventus.RamItem<ResourceDetails, Request>[]): Promise<Aventus.VoidWithError>;
1552
1774
  /**
1553
1775
  * Update a list of items inside ram
1554
1776
  */
1555
1777
  @BindThis()
1556
- updateList(list: T[]): Promise<RamItem<U>[]>;
1778
+ updateList(list: Request[]): Promise<Aventus.RamItem<ResourceDetails, Request>[]>;
1557
1779
  /**
1558
1780
  * Update a list of items inside ram
1559
1781
  */
1560
1782
  @BindThis()
1561
- updateListWithError(list: T[]): Promise<ResultRamWithError<RamItem<U>[]>>;
1783
+ updateListWithError(list: Request[]): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>[]>>;
1562
1784
  /**
1563
1785
  * Update an item inside ram
1564
1786
  */
1565
1787
  @BindThis()
1566
- update(item: T, ...args: any[]): Promise<RamItem<U> | undefined>;
1788
+ update(item: Request, ...args: any[]): Promise<Aventus.RamItem<ResourceDetails, Request> | undefined>;
1567
1789
  /**
1568
1790
  * Update an item inside ram
1569
1791
  */
1570
1792
  @BindThis()
1571
- updateWithError(item: T, ...args: any[]): Promise<ResultRamWithError<RamItem<U>>>;
1572
- private _update;
1793
+ updateWithError(item: Request, ...args: any[]): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>>>;
1794
+ /**
1795
+ * Transform request to resource item
1796
+ */
1797
+ protected abstract transformUpdateRequestToItem(item: Request): Promise<Aventus.ResultWithError<ResourceDetails>>;
1798
+ /**
1799
+ * Transform request to resource item
1800
+ */
1801
+ protected abstract transformUpdateRequestListToItem(list: Request[]): Promise<Aventus.ResultWithError<ResourceDetails[]>>;
1573
1802
  /**
1574
1803
  * Trigger before updating a list of items
1575
1804
  */
1576
- protected beforeUpdateList(list: T[], result: ResultRamWithError<RamItem<U>[]>): Promise<void>;
1805
+ protected beforeUpdateList(list: Request[]): Promise<Aventus.VoidWithError>;
1577
1806
  /**
1578
1807
  * Trigger before updating an item
1579
1808
  */
1580
- protected beforeUpdateItem(item: T, fromList: boolean, result: ResultRamWithError<RamItem<U>>): Promise<void>;
1809
+ protected beforeUpdateItem(item: Request, fromList: boolean): Promise<Aventus.VoidWithError>;
1581
1810
  /**
1582
1811
  * Trigger after updating an item
1583
1812
  */
1584
- protected afterUpdateItem(result: ResultRamWithError<RamItem<U>>, fromList: boolean): Promise<void>;
1813
+ protected afterUpdateItem(result: Aventus.RamItem<ResourceDetails, Request>, fromList: boolean): Promise<Aventus.VoidWithError>;
1585
1814
  /**
1586
1815
  * Trigger after updating a list of items
1587
1816
  */
1588
- protected afterUpdateList(result: ResultRamWithError<RamItem<U>[]>): Promise<void>;
1817
+ protected afterUpdateList(result: Aventus.RamItem<ResourceDetails, Request>[]): Promise<Aventus.VoidWithError>;
1589
1818
  /**
1590
1819
  * Delete a list of items inside ram
1591
1820
  */
1592
1821
  @BindThis()
1593
- deleteList(list: T[]): Promise<RamItem<U>[]>;
1822
+ deleteList(list: ResourceDetails[]): Promise<Aventus.RamItem<ResourceDetails, Request>[]>;
1594
1823
  /**
1595
1824
  * Delete a list of items inside ram
1596
1825
  */
1597
1826
  @BindThis()
1598
- deleteListWithError(list: T[]): Promise<ResultRamWithError<RamItem<U>[]>>;
1827
+ deleteListWithError(list: ResourceDetails[]): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>[]>>;
1599
1828
  /**
1600
1829
  * Delete an item inside ram
1601
1830
  */
1602
1831
  @BindThis()
1603
- delete(item: T, ...args: any[]): Promise<RamItem<U> | undefined>;
1832
+ delete(item: ResourceDetails, ...args: any[]): Promise<Aventus.RamItem<ResourceDetails, Request> | undefined>;
1604
1833
  /**
1605
1834
  * Delete an item inside ram
1606
1835
  */
1607
1836
  @BindThis()
1608
- deleteWithError(item: T, ...args: any[]): Promise<ResultRamWithError<RamItem<U>>>;
1837
+ deleteWithError(item: ResourceDetails, ...args: any[]): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>>>;
1609
1838
  /**
1610
1839
  * Delete an item by id inside ram
1611
1840
  */
1612
1841
  @BindThis()
1613
- deleteById(id: Index): Promise<RamItem<U> | undefined>;
1842
+ deleteById(id: Index): Promise<Aventus.RamItem<ResourceDetails, Request> | undefined>;
1614
1843
  /**
1615
1844
  * Delete an item by id inside ram
1616
1845
  */
1617
1846
  @BindThis()
1618
- deleteByIdWithError(id: Index): Promise<ResultRamWithError<RamItem<U>>>;
1847
+ deleteByIdWithError(id: Index): Promise<Aventus.ResultRamWithError<Aventus.RamItem<ResourceDetails, Request>>>;
1619
1848
  private _delete;
1620
1849
  /**
1621
1850
  * Trigger before deleting a list of items
1622
1851
  */
1623
- protected beforeDeleteList(list: T[], result: VoidWithError): Promise<void>;
1852
+ protected beforeDeleteList(list: ResourceDetails[]): Promise<Aventus.VoidWithError>;
1624
1853
  /**
1625
1854
  * Trigger before deleting an item
1626
1855
  */
1627
- protected beforeDeleteItem(item: T, fromList: boolean, result: VoidWithError): Promise<void>;
1856
+ protected beforeDeleteItem(item: ResourceDetails, fromList: boolean): Promise<Aventus.VoidWithError>;
1628
1857
  /**
1629
1858
  * Trigger after deleting an item
1630
1859
  */
1631
- protected afterDeleteItem(result: ResultRamWithError<RamItem<U>>, fromList: boolean): Promise<void>;
1860
+ protected afterDeleteItem(result: Aventus.RamItem<ResourceDetails, Request>, fromList: boolean): Promise<Aventus.VoidWithError>;
1632
1861
  /**
1633
1862
  * Trigger after deleting a list of items
1634
1863
  */
1635
- protected afterDeleteList(result: ResultRamWithError<RamItem<U>[]>): Promise<void>;
1864
+ protected afterDeleteList(result: Aventus.RamItem<ResourceDetails, Request>[]): Promise<Aventus.VoidWithError>;
1636
1865
  }
1637
1866
 
1867
+ /**
1868
+ * Default Ram with number as Index
1869
+ */
1638
1870
  @Storybook({
1639
1871
  prefix: "Ram"
1640
1872
  })
1641
- abstract class Ram<T extends IRamData, U extends T = T> extends GenericRam<number, T, U> {
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> {
1642
1874
  }
1643
1875
 
1644
1876
  @Storybook({
@@ -1654,49 +1886,49 @@ interface StateAction {
1654
1886
  prefix: "State"
1655
1887
  })
1656
1888
  interface IStateManager {
1657
- subscribe(statePatterns: string | string[], callbacks: StateAction): any;
1658
- unsubscribe(statePatterns: string | string[], callbacks: StateAction): any;
1659
- onAfterStateChanged(cb: () => void): any;
1660
- offAfterStateChanged(cb: () => void): any;
1661
- setState(state: State | string): Promise<boolean>;
1662
- getState(): State | undefined;
1889
+ subscribe(statePatterns: string | string[], callbacks: Aventus.StateAction): void;
1890
+ unsubscribe(statePatterns: string | string[], callbacks: Aventus.StateAction): void;
1891
+ onAfterStateChanged(cb: () => void): void;
1892
+ offAfterStateChanged(cb: () => void): void;
1893
+ setState(state: Aventus.State | string): Promise<boolean>;
1894
+ getState(): Aventus.State | undefined;
1663
1895
  isStateActive(statePattern: string): boolean;
1664
- getStateSlugs(statePattern: string): UriParamsValue | null;
1896
+ getStateSlugs(statePattern: string): Aventus.UriParamsValue | null;
1665
1897
  }
1666
1898
 
1667
1899
  @Storybook({
1668
1900
  prefix: "State"
1669
1901
  })
1670
- abstract class StateManager implements IStateManager {
1902
+ abstract class StateManager implements Aventus.IStateManager {
1671
1903
  protected subscribers: {
1672
1904
  [statePattern: string]: ___Aventus.Subscriber;
1673
1905
  };
1674
1906
  static canBeActivate(statePattern: string, stateName: string): boolean;
1675
- protected activeState?: State;
1676
- protected changeStateMutex: Mutex;
1677
- protected canChangeStateCbs: ((newState: State) => Promise<boolean>)[];
1907
+ protected activeState?: Aventus.State;
1908
+ protected changeStateMutex: Aventus.Mutex;
1909
+ protected canChangeStateCbs: ((newState: Aventus.State) => Promise<boolean>)[];
1678
1910
  private afterStateChanged;
1679
1911
  /**
1680
1912
  * Subscribe actions for a state or a state list
1681
1913
  */
1682
- subscribe(statePatterns: string | string[], callbacks: StateAction, autoActiveState?: boolean): void;
1914
+ subscribe(statePatterns: string | string[], callbacks: Aventus.StateAction, autoActiveState?: boolean): void;
1683
1915
  /**
1684
1916
  *
1685
1917
  */
1686
- activateAfterSubscribe(statePatterns: string | string[], callbacks: StateAction): void;
1918
+ activateAfterSubscribe(statePatterns: string | string[], callbacks: Aventus.StateAction): void;
1687
1919
  /**
1688
1920
  * Unsubscribe actions for a state or a state list
1689
1921
  */
1690
- unsubscribe(statePatterns: string | string[], callbacks: StateAction): void;
1922
+ unsubscribe(statePatterns: string | string[], callbacks: Aventus.StateAction): void;
1691
1923
  onAfterStateChanged(cb: () => void): void;
1692
1924
  offAfterStateChanged(cb: () => void): void;
1693
- protected assignDefaultState(stateName: string): State;
1694
- canChangeState(cb: (newState: State) => Promise<boolean>): void;
1925
+ protected assignDefaultState(stateName: string): Aventus.State;
1926
+ canChangeState(cb: (newState: Aventus.State) => Promise<boolean>): void;
1695
1927
  /**
1696
1928
  * Activate a current state
1697
1929
  */
1698
- setState(state: State | string): Promise<boolean>;
1699
- getState(): State | undefined;
1930
+ setState(state: Aventus.State | string): Promise<boolean>;
1931
+ getState(): Aventus.State | undefined;
1700
1932
  /**
1701
1933
  * Check if a state is in the subscribers and active, return true if it is, false otherwise
1702
1934
  */
@@ -1704,7 +1936,7 @@ abstract class StateManager implements IStateManager {
1704
1936
  /**
1705
1937
  * Get slugs information for the current state, return null if state isn't active
1706
1938
  */
1707
- getStateSlugs(statePattern: string): UriParamsValue | null;
1939
+ getStateSlugs(statePattern: string): Aventus.UriParamsValue | null;
1708
1940
  protected logLevel(): number;
1709
1941
  protected _log(msg: string, type: "error" | "warning" | "info"): void;
1710
1942
  }
@@ -1714,35 +1946,35 @@ abstract class StateManager implements IStateManager {
1714
1946
  })
1715
1947
  interface IState {
1716
1948
  readonly name: string;
1717
- activate(manager: StateManager): Promise<boolean>;
1718
- onActivate(): any;
1719
- onInactivate(nextState: State): any;
1720
- askChange(state: State, nextState: State): Promise<boolean>;
1949
+ activate(manager: Aventus.StateManager): Promise<boolean>;
1950
+ onActivate(): Aventus.Asyncable<void>;
1951
+ onInactivate(nextState: Aventus.State): Aventus.Asyncable<void>;
1952
+ askChange(state: Aventus.State, nextState: Aventus.State): Promise<boolean>;
1721
1953
  }
1722
1954
 
1723
1955
  @Storybook({
1724
1956
  prefix: "State"
1725
1957
  })
1726
- abstract class State implements IState {
1958
+ abstract class State implements Aventus.IState {
1727
1959
  /**
1728
1960
  * Activate a custom state inside a specific manager
1729
1961
  * It ll be a generic state with no information inside exept name
1730
1962
  */
1731
- static activate(stateName: string, manager: StateManager): Promise<boolean>;
1963
+ static activate(stateName: string, manager: Aventus.StateManager): Promise<boolean>;
1732
1964
  abstract get name(): string;
1733
1965
  /**
1734
1966
  * Activate this state inside a specific manager
1735
1967
  */
1736
- activate(manager: StateManager): Promise<boolean>;
1737
- onActivate(): void;
1738
- onInactivate(nextState: State): void;
1968
+ activate(manager: Aventus.StateManager): Promise<boolean>;
1969
+ onActivate(): Aventus.Asyncable<void>;
1970
+ onInactivate(nextState: State): Aventus.Asyncable<void>;
1739
1971
  askChange(state: State, nextState: State): Promise<boolean>;
1740
1972
  }
1741
1973
 
1742
1974
  @Storybook({
1743
1975
  prefix: "State"
1744
1976
  })
1745
- class EmptyState extends State implements IState {
1977
+ class EmptyState extends Aventus.State implements Aventus.IState {
1746
1978
  private localName;
1747
1979
  constructor(stateName: string);
1748
1980
  /**
@@ -1771,7 +2003,7 @@ class TemplateInstance {
1771
2003
  private loops;
1772
2004
  private ifs;
1773
2005
  private isDestroyed;
1774
- constructor(component: WebComponent, content: DocumentFragment, actions: ___Aventus.Actions, loops: ___Aventus.Loop[], ifs: ___Aventus.If[], context?: TemplateContext);
2006
+ constructor(component: Aventus.WebComponent, content: DocumentFragment, actions: ___Aventus.Actions, loops: ___Aventus.Loop[], ifs: ___Aventus.If[], context?: Aventus.TemplateContext);
1775
2007
  render(): void;
1776
2008
  destructor(): void;
1777
2009
  removeFromDOM(avoidTrigger?: boolean): void;
@@ -1803,12 +2035,12 @@ class TemplateContext {
1803
2035
  data: {
1804
2036
  [name: string]: any;
1805
2037
  };
1806
- comp: WebComponent;
2038
+ comp: Aventus.WebComponent;
1807
2039
  private computeds;
1808
2040
  private watch;
1809
2041
  private registry?;
1810
2042
  private isDestroyed;
1811
- constructor(component: WebComponent, data?: {
2043
+ constructor(component: Aventus.WebComponent, data?: {
1812
2044
  [key: string]: any;
1813
2045
  }, parentContext?: TemplateContext, registry?: ___Aventus.LoopRegistery);
1814
2046
  print(value: any): string;
@@ -1830,8 +2062,8 @@ class TemplateContext {
1830
2062
  })
1831
2063
  class Template {
1832
2064
  static validatePath(path: string, pathToCheck: string): boolean;
1833
- cst: typeof WebComponent;
1834
- constructor(component: typeof WebComponent);
2065
+ cst: typeof Aventus.WebComponent;
2066
+ constructor(component: typeof Aventus.WebComponent);
1835
2067
  private htmlParts;
1836
2068
  setHTML(data: ___Aventus.TemplateHTML): void;
1837
2069
  generateTemplate(): void;
@@ -1847,17 +2079,17 @@ class Template {
1847
2079
  addLoop(loop: ___Aventus.Loop): void;
1848
2080
  ifs: ___Aventus.If[];
1849
2081
  addIf(_if: ___Aventus.If): void;
1850
- createInstance(component: WebComponent): any;
2082
+ createInstance(component: Aventus.WebComponent): any;
1851
2083
  }
1852
2084
 
1853
- @Dependances([{
2085
+ @Dependencies([{
1854
2086
  type: WebComponentInstance,
1855
2087
  strong: true
1856
2088
  }])
1857
2089
  @Storybook({
1858
2090
  prefix: "Webcomponent"
1859
2091
  })
1860
- abstract class WebComponent extends HTMLElement implements DefaultComponent {
2092
+ abstract class WebComponent extends HTMLElement implements Aventus.DefaultComponent {
1861
2093
  /**
1862
2094
  * Add attributes informations
1863
2095
  */
@@ -2012,7 +2244,7 @@ abstract class WebComponent extends HTMLElement implements DefaultComponent {
2012
2244
  /**
2013
2245
  * Function triggered each time the component is removed from the DOM
2014
2246
  */
2015
- protected postDisonnect(): void;
2247
+ protected postDisconnect(): void;
2016
2248
  /**
2017
2249
  * Find a parent by tagname if exist
2018
2250
  */
@@ -2078,14 +2310,14 @@ class WebComponentInstance {
2078
2310
  /**
2079
2311
  * Get all sub classes of type
2080
2312
  */
2081
- static getAllClassesOf<T>(type: typeof WebComponent): (new () => WebComponent)[];
2313
+ static getAllClassesOf<T>(type: typeof Aventus.WebComponent): (new () => Aventus.WebComponent)[];
2082
2314
  /**
2083
2315
  * Get all registered definitions
2084
2316
  */
2085
- static getAllDefinitions(): (new () => WebComponent)[];
2086
- static addInstance(instance: WebComponent): void;
2087
- static removeInstance(instance: WebComponent): void;
2088
- static getAllInstances(type: new () => WebComponent): {};
2317
+ static getAllDefinitions(): (new () => Aventus.WebComponent)[];
2318
+ static addInstance(instance: Aventus.WebComponent): void;
2319
+ static removeInstance(instance: Aventus.WebComponent): void;
2320
+ static getAllInstances(type: new () => Aventus.WebComponent): {};
2089
2321
  static create<T>(type: string): T | null;
2090
2322
  }
2091
2323
 
@@ -2137,7 +2369,7 @@ class ElementExtension {
2137
2369
  /**
2138
2370
  * Get deeper element inside dom at the position X and Y
2139
2371
  */
2140
- static getElementAtPosition(x: number, y: number, startFrom?: Element): any;
2372
+ static getElementAtPosition(x: number, y: number, startFrom?: Element): Element;
2141
2373
  /**
2142
2374
  * Get active element from the define root
2143
2375
  */
@@ -2147,8 +2379,7 @@ class ElementExtension {
2147
2379
  }
2148
2380
 
2149
2381
  var AvInstance: typeof Aventus.Instance;
2150
- type NotVoid = { [key: string]: NotVoid; } | object | string | boolean | symbol | number | null | undefined;
2151
- type Last<T extends any[]> = T extends [...infer _, infer Last] ? Last : never;
2382
+
2152
2383
 
2153
2384
  declare namespace Aventus {
2154
2385
  interface WebComponent extends HTMLElement {
@@ -2159,6 +2390,43 @@ class ElementExtension {
2159
2390
 
2160
2391
  type ConstructorConstraint<T> = Function & { prototype: T; };
2161
2392
 
2393
+ type AvClassDecorator = <Class extends Function & { prototype: any; }>(
2394
+ value: Class,
2395
+ context: ClassDecoratorContext<Class>
2396
+ ) => Class | void;
2397
+
2398
+ type AvClassComponentDecorator = <Class extends ConstructorConstraint<Aventus.WebComponent>>(
2399
+ value: Class,
2400
+ context: ClassDecoratorContext<Class>
2401
+ ) => Class | void;
2402
+
2403
+ type AvGetterDecorator = <This, Return>(
2404
+ value: (this: This) => Return,
2405
+ context: ClassGetterDecoratorContext<This, Return>
2406
+ ) => ((this: This) => Return) | void;
2407
+
2408
+ type AvSetterDecorator = <This, Value>(
2409
+ value: (this: This, value: Value) => void,
2410
+ context: ClassSetterDecoratorContext<This, Value>
2411
+ ) => ((this: This, value: Value) => void) | void;
2412
+
2413
+ type AvFieldDecorator = <This, Value>(
2414
+ value: undefined,
2415
+ context: ClassFieldDecoratorContext<This, Value>
2416
+ ) => ((this: This, initialValue: Value) => Value) | void;
2417
+
2418
+ type AvPropertyDecorator = AvGetterDecorator & AvSetterDecorator & AvFieldDecorator
2419
+
2420
+ type AvAccessorDecorator = <This, Value>(
2421
+ value: ClassAccessorDecoratorTarget<This, Value>,
2422
+ context: ClassAccessorDecoratorContext<This, Value>
2423
+ ) => ClassAccessorDecoratorResult<This, Value> | void;
2424
+
2425
+ type AvMethodDecorator = <This, Args extends any[], Return>(
2426
+ target: (this: This, ...args: Args) => Return,
2427
+ context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Return>
2428
+ ) => ((this: This, ...args: Args) => Return) | void;
2429
+
2162
2430
  interface DebuggerConfig {
2163
2431
  /** Write the compiled file inside ./compiled.js */
2164
2432
  writeCompiled?: boolean,
@@ -2180,7 +2448,7 @@ class ElementExtension {
2180
2448
  useLive?: boolean;
2181
2449
  }
2182
2450
 
2183
- interface DependanceConfig {
2451
+ interface DependenciesConfig {
2184
2452
  /** The type to load */
2185
2453
  type: any,
2186
2454
  /** The type must be loaded before the current class */
@@ -2190,91 +2458,91 @@ class ElementExtension {
2190
2458
  /**
2191
2459
  * Add an attribute inside on your component
2192
2460
  */
2193
- function Attribute();
2461
+ function Attribute(): AvPropertyDecorator;
2194
2462
  /**
2195
2463
  * Add an attribute inside on your component with changes analyze
2196
2464
  */
2197
- function Property();
2465
+ function Property(): AvPropertyDecorator;
2198
2466
  /**
2199
2467
  * Add an attribute inside on your component with changes analyze
2200
2468
  */
2201
- function Property<T>(onChange: (component: T) => void);
2469
+ function Property<T>(onChange: (component: T) => void): AvPropertyDecorator;
2202
2470
  /**
2203
2471
  * Add an attribute inside on your component with changes analyze
2204
2472
  */
2205
- function Signal();
2473
+ function Signal(): AvPropertyDecorator;
2206
2474
  /**
2207
2475
  * Add an attribute inside on your component with changes analyze
2208
2476
  */
2209
- function Signal<T>(onChange: (component: T) => void);
2477
+ function Signal<T>(onChange: (component: T) => void): AvPropertyDecorator;
2210
2478
  /**
2211
2479
  * Add a property inside a watcher to be notify of changing
2212
2480
  */
2213
- function Watch();
2481
+ function Watch(): AvPropertyDecorator;
2214
2482
  /**
2215
2483
  * Add a property inside a watcher to be notify of changing
2216
2484
  */
2217
- function Watch<T>(onChange: (component: T, action: Aventus.WatchAction, path: string, value: any) => void);
2485
+ function Watch<T>(onChange: (component: T, action: Aventus.WatchAction, path: string, value: any) => void): AvPropertyDecorator;
2218
2486
  /**
2219
2487
  * Allow injection autocompletion
2220
2488
  */
2221
- function Injectable();
2489
+ function Injectable(): AvPropertyDecorator;
2222
2490
  /**
2223
2491
  * Add a function inside a watcher to be notify of changing
2224
2492
  */
2225
- function Effect(options?: { autoInit?: boolean; });
2493
+ function Effect(options?: { autoInit?: boolean; }): AvMethodDecorator;
2226
2494
  /**
2227
2495
  * Signal that this variable is a link to your shadowroot
2228
2496
  */
2229
- function ViewElement(config?: ViewElementConfig);
2497
+ function ViewElement(config?: ViewElementConfig): AvPropertyDecorator;
2230
2498
  /**
2231
2499
  * Add foreign key reference
2232
2500
  */
2233
- function ForeignKey(ref: ConstructorConstraint<Aventus.IData>);
2501
+ function ForeignKey(ref: ConstructorConstraint<Aventus.IData>): AvPropertyDecorator;
2234
2502
  /**
2235
2503
  * Define a public property that will be transformed to private once compiled
2236
2504
  */
2237
- function Internal();
2505
+ function Internal(): AvPropertyDecorator & AvMethodDecorator;
2238
2506
  /**
2239
2507
  * Define a public property that will be transformed to protected once compiled
2240
2508
  */
2241
- function InternalProtected();
2509
+ function InternalProtected(): AvPropertyDecorator & AvMethodDecorator;
2242
2510
 
2243
- function StateActive(stateName: string, manager: ConstructorConstraint<Aventus.StateManager> | Aventus.StateManager): (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<((state: Aventus.State, slugs: Aventus.StateSlug) => void)>) => void;
2244
- function DefaultStateActive(manager: ConstructorConstraint<Aventus.StateManager> | Aventus.StateManager);
2245
- function StateInactive(stateName: string, manager: ConstructorConstraint<Aventus.StateManager> | Aventus.StateManager): (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<((state: Aventus.State, nextState: Aventus.State, slugs: Aventus.StateSlug) => void)>) => void;
2246
- function DefaultStateInactive(manager: ConstructorConstraint<Aventus.StateManager> | Aventus.StateManager);
2247
- function StateChange(stateName: string, manager: ConstructorConstraint<Aventus.StateManager> | Aventus.StateManager): (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<((state: Aventus.State, nextState: Aventus.State, slugs: Aventus.StateSlug) => boolean | Promise<boolean>)>) => void;
2511
+ function StateActive(stateName: string, manager: ConstructorConstraint<Aventus.StateManager> | Aventus.StateManager): AvMethodDecorator;
2512
+ function DefaultStateActive(manager: ConstructorConstraint<Aventus.StateManager> | Aventus.StateManager): AvMethodDecorator;
2513
+ function StateInactive(stateName: string, manager: ConstructorConstraint<Aventus.StateManager> | Aventus.StateManager): AvMethodDecorator;
2514
+ function DefaultStateInactive(manager: ConstructorConstraint<Aventus.StateManager> | Aventus.StateManager): AvMethodDecorator;
2515
+ function StateChange(stateName: string, manager: ConstructorConstraint<Aventus.StateManager> | Aventus.StateManager): AvMethodDecorator;
2248
2516
 
2249
2517
  /**
2250
2518
  * Clear parent view and use your
2251
2519
  */
2252
- function OverrideView(config?: OverrideViewConfig): (<T extends ConstructorConstraint<Aventus.WebComponent>> (ConstructorConstraint: T) => T);
2520
+ function OverrideView(config?: OverrideViewConfig): AvClassComponentDecorator;
2253
2521
  /**
2254
2522
  * use a custom TagName
2255
2523
  */
2256
- function TagName(name: string): (<T extends ConstructorConstraint<Aventus.WebComponent>> (ConstructorConstraint: T) => T);
2524
+ function TagName(name: string): AvClassComponentDecorator;
2257
2525
  /**
2258
2526
  * Force to be required inside export
2259
2527
  */
2260
- function Required(): (ConstructorConstraint: Function) => void;
2528
+ function Required(): AvMethodDecorator;
2261
2529
  /**
2262
2530
  * Add debbuger action function for your component
2263
2531
  */
2264
- function Debugger(config: DebuggerConfig): (ConstructorConstraint: Function) => void;
2532
+ function Debugger(config: DebuggerConfig): AvClassComponentDecorator;
2265
2533
 
2266
2534
 
2267
- function Dependances(info: DependanceConfig[]): (ConstructorConstraint: Function) => void;
2535
+ function Dependencies(info: DependenciesConfig[]): AvClassDecorator;
2268
2536
 
2269
2537
  /**
2270
2538
  * Register the element inside the Converter instance
2271
2539
  * Your object must have a static type named as the parameter
2272
2540
  */
2273
- function Convertible(name: string = "Fullname"): (ConstructorConstraint: Function) => void;
2541
+ function Convertible(name: string = "Fullname"): AvClassDecorator;
2274
2542
 
2275
- function BindThis(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
2543
+ function BindThis(): AvMethodDecorator;
2276
2544
 
2277
- function NoCompile(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
2545
+ function NoCompile(): AvMethodDecorator;
2278
2546
 
2279
2547
  interface StorybookConfig {
2280
2548
  /** Define what must be exported to storybook */
@@ -2300,7 +2568,7 @@ class ElementExtension {
2300
2568
  /**
2301
2569
  * Export a story for this component
2302
2570
  */
2303
- function Storybook(info?: StorybookConfig);
2571
+ function Storybook(info?: StorybookConfig): AvClassDecorator;
2304
2572
 
2305
2573
  function NoStory();
2306
2574
  function AddToStory();
@@ -2378,10 +2646,10 @@ type OnlyConstructor<T = any> = (abstract new (...args: any[]) => T);
2378
2646
  @Storybook({
2379
2647
  prefix: "Ram"
2380
2648
  })
2381
- interface RamSubscribers<T> {
2382
- created: ((item: T) => void)[];
2383
- updated: ((item: T) => void)[];
2384
- deleted: ((item: T) => void)[];
2649
+ interface RamSubscribers<Item> {
2650
+ created: ((item: Item) => void)[];
2651
+ updated: ((item: Item) => void)[];
2652
+ deleted: ((item: Item) => void)[];
2385
2653
  }
2386
2654
 
2387
2655
  type StateAskChangeFct = (state: globalThis.Aventus.State, nextState: globalThis.Aventus.State, slugs: globalThis.Aventus.StateSlug) => Promise<boolean>;
@@ -2402,7 +2670,7 @@ type TargetableElement = HTMLElement | SVGElement;
2402
2670
 
2403
2671
  type ContainerElement = HTMLElement | SVGSVGElement;
2404
2672
 
2405
- type AnyElement = TargetableElement | ContainerElement;
2673
+ type AnyElement = Aventus.TargetableElement | Aventus.ContainerElement;
2406
2674
 
2407
2675
  @Storybook({
2408
2676
  prefix: "Lib/Animation"
@@ -2436,24 +2704,24 @@ type Subscriber = {
2436
2704
  }[];
2437
2705
  isActive: boolean;
2438
2706
  callbacks: {
2439
- active: StateActivationFct[];
2440
- inactive: StateInactivationFct[];
2441
- askChange: StateAskChangeFct[];
2707
+ active: Aventus.StateActivationFct[];
2708
+ inactive: Aventus.StateInactivationFct[];
2709
+ askChange: Aventus.StateAskChangeFct[];
2442
2710
  };
2443
2711
  };
2444
2712
 
2445
2713
  type Loop = {
2446
2714
  anchorId: string;
2447
2715
  template: globalThis.Aventus.Template;
2448
- func?: (c: globalThis.Aventus.TemplateContext) => LoopFct;
2449
- simple?: LoopSimple;
2716
+ func?: (c: globalThis.Aventus.TemplateContext) => Aventus.LoopFct;
2717
+ simple?: Aventus.LoopSimple;
2450
2718
  };
2451
2719
 
2452
2720
  type ActionEvent = {
2453
2721
  id: string;
2454
2722
  eventName: string;
2455
2723
  isCallback?: boolean;
2456
- fct: ActionEventListener & ActionEventCallback;
2724
+ fct: Aventus.ActionEventListener & Aventus.ActionEventCallback;
2457
2725
  };
2458
2726
 
2459
2727
  type LoopRegistery = {
@@ -2474,17 +2742,17 @@ type Actions = {
2474
2742
  isArray?: boolean;
2475
2743
  }[];
2476
2744
  content?: {
2477
- [id_attr: string]: ActionChange;
2745
+ [id_attr: string]: Aventus.ActionChange;
2478
2746
  };
2479
- injection?: ActionInjection[];
2480
- bindings?: ActionBindings[];
2481
- events?: ActionEvent[];
2747
+ injection?: Aventus.ActionInjection[];
2748
+ bindings?: Aventus.ActionBindings[];
2749
+ events?: Aventus.ActionEvent[];
2482
2750
  pressEvents?: globalThis.Aventus.PressManagerOptions[];
2483
- contextEdits?: ContextEdit[];
2751
+ contextEdits?: Aventus.ContextEdit[];
2484
2752
  };
2485
2753
  }//#endregion js def //
2486
2754
  //#region js src //
2487
- {"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}","dependances":[],"fullName":"!staticClass_a19222991f817371b18f65b47e8f5cf9","required":true,"noNamespace":"before","type":0,"isExported":false,"convertibleName":""},{"code":" ","dependances":[],"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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"CSSStyleSheet","isStrong":true},{"fullName":"Promise","isStrong":false},{"fullName":"Map","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","dependances":[],"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","dependances":[],"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","dependances":[],"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","dependances":[],"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","dependances":[],"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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Promise","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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Map","isStrong":false},{"fullName":"Promise","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","dependances":[],"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 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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ResourceLoaderHeadOptions","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"HTMLElement","isStrong":false},{"fullName":"Aventus.ResourceLoaderOptions","isStrong":false},{"fullName":"Blob","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","dependances":[],"fullName":"Aventus.DragElementXYType","required":false,"type":5,"isExported":true,"convertibleName":""},{"code":"let DragElementLeftTopType= [HTMLElement, SVGSVGElement];\n__as1(_, 'DragElementLeftTopType', DragElementLeftTopType);\r\n","dependances":[],"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","dependances":[{"fullName":"PointerEvent","isStrong":false},{"fullName":"TouchEvent","isStrong":false},{"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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Map","isStrong":false},{"fullName":"Parameters","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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Map","isStrong":false},{"fullName":"Parameters","isStrong":false}],"fullName":"Aventus.CallbackGroup","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let compareObject=function compareObject(obj1, obj2) {\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 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 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","dependances":[{"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","dependances":[],"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","dependances":[],"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","dependances":[{"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","dependances":[],"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","dependances":[],"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","dependances":[{"fullName":"Date","isStrong":false}],"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 result[options.replaceKey(key)] = options.transformValue(key, obj[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 obj[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 obj[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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Object","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.JsonToOptions","isStrong":false},{"fullName":"Required","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 target[options.replaceKey(prop)] = options.transformValue(prop, src[prop]);\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 target[options.replaceKey(prop)] = options.transformValue(prop, src[prop]);\n }\n }\n cstTemp = Object.getPrototypeOf(cstTemp);\n }\n }\n}\nConverterTransform.Namespace=`Aventus`;\r\n__as1(_, 'ConverterTransform', ConverterTransform);\r\n","dependances":[{"fullName":"Aventus.IConverterTransform","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Object","isStrong":false},{"fullName":"Aventus.Converter","isStrong":false},{"fullName":"Aventus.Json","isStrong":false},{"fullName":"Aventus.DateConverter","isStrong":false},{"fullName":"Aventus.ClassCopyOptions","isStrong":false},{"fullName":"Required","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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Map","isStrong":true},{"fullName":"Aventus.Schema","isStrong":true},{"fullName":"Aventus.IConverterTransform","isStrong":true},{"fullName":"Aventus.ConverterTransform","isStrong":true},{"fullName":"T","isStrong":false},{"fullName":"Object","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","dependances":[{"fullName":"Aventus.Converter","isStrong":false}],"fullName":"Aventus.clone","required":false,"type":4,"isExported":true,"convertibleName":""},{"code":"let Data=class Data {\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\n__as1(_, 'Data', Data);\r\n","dependances":[{"fullName":"Aventus.IData","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Json","isStrong":false},{"fullName":"Aventus.Converter","isStrong":false}],"fullName":"Aventus.Data","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let GenericError=class 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} message - The error message.\n */\n constructor(code, message) {\n this.code = code;\n this.message = message + '';\n }\n}\nGenericError.Namespace=`Aventus`;\r\n__as1(_, 'GenericError', GenericError);\r\n","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Enum","isStrong":false},{"fullName":"Aventus.EnumValue","isStrong":false}],"fullName":"Aventus.GenericError","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let VoidWithError=class 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}\nVoidWithError.Namespace=`Aventus`;\r\n__as1(_, 'VoidWithError', VoidWithError);\r\n","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.GenericError","isStrong":false},{"fullName":"Aventus.Enum","isStrong":false},{"fullName":"Aventus.EnumValue","isStrong":false},{"fullName":"U","isStrong":false}],"fullName":"Aventus.VoidWithError","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ResultWithError=class ResultWithError extends VoidWithError {\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}\nResultWithError.Namespace=`Aventus`;\r\n__as1(_, 'ResultWithError', ResultWithError);\r\n","dependances":[{"fullName":"Aventus.VoidWithError","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.GenericError","isStrong":false}],"fullName":"Aventus.ResultWithError","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let HttpError=class HttpError extends GenericError {\n}\nHttpError.Namespace=`Aventus`;\r\n__as1(_, 'HttpError', HttpError);\r\n","dependances":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"Aventus.HttpErrorCode","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.HttpError","required":false,"type":1,"isExported":true,"convertibleName":""},{"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","dependances":[{"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","dependances":[{"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","dependances":[{"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 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 = 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 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 {\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 Reflect.get(target, prop, receiver);\n },\n set(target, prop, value, receiver) {\n if (typeof prop == 'symbol') {\n return Reflect.set(target, prop, value, receiver);\n }\n let oldValue = 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 = 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 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 = [...proxyData.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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Internal","isStrong":true},{"fullName":"Aventus.Effect","isStrong":true},{"fullName":"Aventus.WatcherFunction","isStrong":false},{"fullName":"Aventus.getValueFromObject","isStrong":false},{"fullName":"Map","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","dependances":[{"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","dependances":[{"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 options;\n constructor() {\n this.options = this.defineOptions(this.defaultOptionsValue());\n }\n defaultOptionsValue() {\n return {\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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"InternalProtected","isStrong":false},{"fullName":"Aventus.HttpRouterOptions","isStrong":false},{"fullName":"Promise","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","dependances":[{"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 constructor(url, method = HttpMethod.GET, body, methodSpoofing = false) {\n this.url = url;\n this.request = {};\n this.methodSpoofing = methodSpoofing;\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 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 if (this[key] instanceof Date) {\n return DateConverter.converter.toString(this[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 result.result = await fetch(fullUrl, this.request);\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 = Converter.transform(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 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 = Converter.transform(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 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 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}\nHttpRequest.Namespace=`Aventus`;\r\n__as1(_, 'HttpRequest', HttpRequest);\r\n","dependances":[{"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":"Promise","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.HttpError","isStrong":false},{"fullName":"Aventus.HttpErrorCode","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false},{"fullName":"Aventus.Converter","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Blob","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","dependances":[{"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","dependances":[{"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 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 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 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 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 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 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 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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManagerOptions","isStrong":true},{"fullName":"Element","isStrong":false},{"fullName":"Aventus.Callback","isStrong":true},{"fullName":"Aventus.NormalizedEvent","isStrong":true},{"fullName":"Aventus.PressManagerState","isStrong":false},{"fullName":"Aventus.InternalCustomFunction","isStrong":false},{"fullName":"PointerEvent","isStrong":false},{"fullName":"Aventus.InternalPointerEvent","isStrong":false},{"fullName":"Touch","isStrong":false},{"fullName":"TouchEvent","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 this.options[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","dependances":[{"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":"DOMRect","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":"Element","isStrong":false},{"fullName":"ShadowRoot","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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Map","isStrong":true},{"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 let index = entry.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 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 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 let index = entry.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);\n }, 0);\n }\n}\nResizeObserver.Namespace=`Aventus`;\r\n__as1(_, 'ResizeObserver', ResizeObserver);\r\n","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"CallableFunction","isStrong":false},{"fullName":"Element","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","dependances":[{"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\n__as1(_, 'RamError', RamError);\r\n","dependances":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"Aventus.RamErrorCode","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.RamError","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let ResultRamWithError=class ResultRamWithError extends ResultWithError {\n}\nResultRamWithError.Namespace=`Aventus`;\r\n__as1(_, 'ResultRamWithError', ResultRamWithError);\r\n","dependances":[{"fullName":"Aventus.ResultWithError","isStrong":true},{"fullName":"Aventus.RamError","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.ResultRamWithError","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"let VoidRamWithError=class VoidRamWithError extends VoidWithError {\n}\nVoidRamWithError.Namespace=`Aventus`;\r\n__as1(_, 'VoidRamWithError', VoidRamWithError);\r\n","dependances":[{"fullName":"Aventus.VoidWithError","isStrong":true},{"fullName":"Aventus.RamError","isStrong":false},{"fullName":"Storybook","isStrong":false}],"fullName":"Aventus.VoidRamWithError","required":false,"type":1,"isExported":true,"convertibleName":""},{"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.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 let id = that.getId(this);\n let oldData = that.records.get(id);\n if (oldData) {\n that.mergeObject(oldData, newData, { replaceUndefinedWithKey: true });\n let result = await that.update(oldData);\n return result;\n }\n return undefined;\n }\n async updateWithError(newData = {}) {\n const result = new ResultRamWithError();\n let queryId = that.getIdWithError(this);\n if (!queryId.success || !queryId.result) {\n result.errors = queryId.errors;\n return result;\n }\n let oldData = that.records.get(queryId.result);\n if (oldData) {\n that.mergeObject(oldData, newData, { replaceUndefinedWithKey: true });\n let result = await that.updateWithError(oldData);\n return result;\n }\n result.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"Can't find this item inside the ram\"));\n return result;\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 T = this.addRamAction(this.getTypeForData(objJson));\n let item = new T();\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]: U[]; }; } = {};\n // private linkRamItem(item: U) {\n // for(let key in this.ramMapping) {\n // this.linkRamItemByKey(item, key);\n // private linkRamItemByKey(item: U, 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, result) {\n let resultTemp = null;\n try {\n let idWithError = this.getIdWithError(item);\n if (idWithError.success && idWithError.result !== undefined) {\n let id = idWithError.result;\n if (this.records.has(id)) {\n let uniqueRecord = this.records.get(id);\n await this.beforeRecordSet(uniqueRecord);\n // this.unlinkRamItem(uniqueRecord);\n this.mergeObject(uniqueRecord, item);\n await this.afterRecordSet(uniqueRecord);\n // this.linkRamItem(uniqueRecord);\n resultTemp = 'updated';\n }\n else {\n let realObject = this.getObjectForRam(item);\n await this.beforeRecordSet(realObject);\n this.records.set(id, realObject);\n await this.afterRecordSet(realObject);\n // this.linkRamItem(realObject);\n resultTemp = 'created';\n }\n result.result = this.records.get(id);\n }\n else {\n result.errors = [...result.errors, ...idWithError.errors];\n resultTemp = null;\n }\n }\n catch (e) {\n result.errors.push(new RamError(RamErrorCode.unknow, e));\n resultTemp = null;\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 let resultTemp = await this.getIdWithError(item);\n if (resultTemp.success && resultTemp.result !== undefined) {\n if (resultTemp.result) {\n return this.updateWithError(item, ...args);\n }\n else {\n return this.createWithError(item, ...args);\n }\n }\n else {\n action.errors = resultTemp.errors;\n }\n return action;\n }\n async beforeRecordSet(item) { }\n async afterRecordSet(item) { }\n async beforeRecordDelete(item) { }\n async afterRecordDelete(item) { }\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 this.beforeGetById(id, action);\n if (action.success) {\n if (this.records.has(id)) {\n action.result = this.records.get(id);\n await this.afterGetById(action);\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, result) { }\n ;\n /**\n * Trigger after getting an item by id\n */\n async afterGetById(result) { }\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 let action = new ResultRamWithError();\n action.result = [];\n await this.beforeGetByIds(ids, action);\n if (action.success) {\n action.result = [];\n for (let id of ids) {\n let rec = this.records.get(id);\n if (rec) {\n action.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 await this.afterGetByIds(action);\n }\n }\n return action;\n });\n }\n ;\n /**\n * Trigger before getting a list of items by id\n */\n async beforeGetByIds(ids, result) { }\n ;\n /**\n * Trigger after getting a list of items by id\n */\n async afterGetByIds(result) { }\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 ?? new Map();\n }\n return new Map();\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 action.result = new Map();\n await this.beforeGetAll(action);\n if (action.success) {\n action.result = this.records;\n await this.afterGetAll(action);\n }\n return action;\n });\n }\n /**\n * Trigger before getting all items inside Ram\n */\n async beforeGetAll(result) { }\n ;\n /**\n * Trigger after getting all items inside Ram\n */\n async afterGetAll(result) { }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getList() {\n let data = await this.getAll();\n return Array.from(data.values());\n }\n ;\n /**\n * Get all elements inside the Ram\n */\n async getListWithError() {\n let action = new ResultRamWithError();\n action.result = [];\n let result = await this.getAllWithError();\n if (result.success) {\n if (result.result) {\n action.result = Array.from(result.result.values());\n }\n else {\n action.result = [];\n }\n }\n else {\n action.errors = result.errors;\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 let action = new ResultRamWithError();\n action.result = [];\n await this.beforeCreateList(list, action);\n if (action.success) {\n if (action.result.length > 0) {\n list = action.result;\n action.result = [];\n }\n for (let item of list) {\n let resultItem = await this._create(item, true);\n if (resultItem.success && resultItem.result) {\n action.result.push(resultItem.result);\n }\n else {\n action.errors = [...action.errors, ...resultItem.errors];\n }\n }\n if (action.success) {\n await this.afterCreateList(action);\n }\n }\n return action;\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 return await this._create(item, false);\n }\n async _create(item, fromList) {\n item = this.removeWatch(item);\n return this.actionGuard.run(['_create', item], async () => {\n let action = new ResultRamWithError();\n await this.beforeCreateItem(item, fromList, action);\n if (action.success) {\n if (action.result) {\n item = action.result;\n }\n let resultTemp = this.getIdWithError(item);\n if (resultTemp.success) {\n await this.addOrUpdateData(item, action);\n if (!action.success) {\n return action;\n }\n await this.afterCreateItem(action, fromList);\n if (!action.success) {\n action.result = undefined;\n }\n else if (action.result) {\n this.publish('created', action.result);\n }\n }\n else {\n action.errors = resultTemp.errors;\n }\n }\n return action;\n });\n }\n /**\n * Trigger before creating a list of items\n */\n async beforeCreateList(list, result) {\n }\n ;\n /**\n * Trigger before creating an item\n */\n async beforeCreateItem(item, fromList, result) {\n }\n ;\n /**\n * Trigger after creating an item\n */\n async afterCreateItem(result, fromList) {\n }\n ;\n /**\n * Trigger after creating a list of items\n */\n async afterCreateList(result) {\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 let action = new ResultRamWithError();\n action.result = [];\n await this.beforeUpdateList(list, action);\n if (action.success) {\n if (action.result.length > 0) {\n list = action.result;\n action.result = [];\n }\n for (let item of list) {\n let resultItem = await this._update(item, true);\n if (resultItem.success && resultItem.result) {\n action.result.push(resultItem.result);\n }\n else {\n action.errors = [...action.errors, ...resultItem.errors];\n }\n }\n if (action.success) {\n await this.afterUpdateList(action);\n }\n }\n return action;\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 return await this._update(item, false);\n }\n async _update(item, fromList) {\n item = this.removeWatch(item);\n return this.actionGuard.run(['_update', item], async () => {\n let action = new ResultRamWithError();\n let resultTemp = await this.getIdWithError(item);\n if (resultTemp.success && resultTemp.result !== undefined) {\n let key = resultTemp.result;\n if (this.records.has(key)) {\n if (this.records.get(key) == item) {\n console.warn(\"You are updating the same item. You should clone the object first to avoid weird effect\");\n }\n await this.beforeUpdateItem(item, fromList, action);\n if (!action.success) {\n return action;\n }\n if (action.result) {\n item = action.result;\n }\n await this.addOrUpdateData(item, action);\n if (!action.success) {\n return action;\n }\n await this.afterUpdateItem(action, fromList);\n if (!action.success) {\n action.result = undefined;\n }\n else if (action.result) {\n this.publish('updated', action.result);\n }\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't update the item \" + key + \" because it wasn't found inside ram\"));\n }\n }\n else {\n action.errors = resultTemp.errors;\n }\n return action;\n });\n }\n ;\n /**\n * Trigger before updating a list of items\n */\n async beforeUpdateList(list, result) {\n }\n ;\n /**\n * Trigger before updating an item\n */\n async beforeUpdateItem(item, fromList, result) {\n }\n ;\n /**\n * Trigger after updating an item\n */\n async afterUpdateItem(result, fromList) {\n }\n ;\n /**\n * Trigger after updating a list of items\n */\n async afterUpdateList(result) {\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 let deleteResult = new VoidWithError();\n await this.beforeDeleteList(list, deleteResult);\n if (!deleteResult.success) {\n action.errors = deleteResult.errors;\n }\n for (let item of list) {\n let resultItem = await this._delete(item, true);\n if (resultItem.success && resultItem.result) {\n action.result.push(resultItem.result);\n }\n else {\n action.errors = [...action.errors, ...resultItem.errors];\n }\n }\n if (action.success) {\n await this.afterDeleteList(action);\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 let resultTemp = await this.getIdWithError(item);\n if (resultTemp.success && resultTemp.result) {\n let key = resultTemp.result;\n let oldItem = this.records.get(key);\n if (oldItem) {\n let deleteResult = new VoidWithError();\n await this.beforeDeleteItem(oldItem, fromList, deleteResult);\n if (!deleteResult.success) {\n action.errors = deleteResult.errors;\n return action;\n }\n this.beforeRecordDelete(oldItem);\n this.records.delete(key);\n this.afterRecordDelete(oldItem);\n action.result = oldItem;\n await this.afterDeleteItem(action, fromList);\n if (!action.success) {\n action.result = undefined;\n }\n else {\n this.publish('deleted', action.result);\n }\n this.recordsSubscribers.delete(key);\n }\n else {\n action.errors.push(new RamError(RamErrorCode.noItemInsideRam, \"can't delete the item \" + key + \" because it wasn't found inside ram\"));\n }\n }\n else {\n action.errors = resultTemp.errors;\n }\n return action;\n });\n }\n /**\n * Trigger before deleting a list of items\n */\n async beforeDeleteList(list, result) { }\n ;\n /**\n * Trigger before deleting an item\n */\n async beforeDeleteItem(item, fromList, result) { }\n ;\n /**\n * Trigger after deleting an item\n */\n async afterDeleteItem(result, fromList) { }\n ;\n /**\n * Trigger after deleting a list of items\n */\n async afterDeleteList(result) { }\n}\nGenericRam.Namespace=`Aventus`;\r\n__as1(_, 'GenericRam', GenericRam);\r\n","dependances":[{"fullName":"Aventus.IRam","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.IRamData","isStrong":false},{"fullName":"Map","isStrong":true},{"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.KeysObject","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":"Promise","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","dependances":[{"fullName":"Aventus.GenericRam","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.IRamData","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","dependances":[{"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":"Promise","isStrong":false},{"fullName":"Aventus.Callback","isStrong":false},{"fullName":"Aventus.StateAction","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"clone","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","dependances":[{"fullName":"Aventus.IState","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateManager","isStrong":false},{"fullName":"Promise","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","dependances":[{"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 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 if (event[temp] instanceof Function) {\n clone[temp] = (e, pressInstance) => { event[temp](e, pressInstance, this.context); };\n }\n else {\n clone[temp] = event[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 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 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 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 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 (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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Internal","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false},{"fullName":"DocumentFragment","isStrong":false},{"fullName":"Aventus.Actions","isStrong":false},{"fullName":"HTMLElement","isStrong":false},{"fullName":"Aventus.Effect","isStrong":false},{"fullName":"Aventus.LoopRegistery","isStrong":false},{"fullName":"Aventus.Loop","isStrong":false},{"fullName":"Aventus.If","isStrong":false},{"fullName":"Element","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.PressManager","isStrong":false},{"fullName":"Aventus.ActionChange","isStrong":false},{"fullName":"Aventus.ActionInjection","isStrong":false},{"fullName":"Aventus.ActionBindings","isStrong":false},{"fullName":"Required","isStrong":false},{"fullName":"Aventus.LoopFct","isStrong":false},{"fullName":"Aventus.LoopSimple","isStrong":false},{"fullName":"Signal","isStrong":false},{"fullName":"Aventus.WatcherFunction","isStrong":false},{"fullName":"Aventus.WatchAction","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","dependances":[{"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":"RegExpExecArray","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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateHTML","isStrong":false},{"fullName":"HTMLTemplateElement","isStrong":false},{"fullName":"Aventus.Actions","isStrong":false},{"fullName":"Aventus.Loop","isStrong":false},{"fullName":"Aventus.If","isStrong":false},{"fullName":"DocumentFragment","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.postDisonnect();\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 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 this[prop];\n this[prop] = value;\n }\n else {\n this.removeAttribute(prop);\n delete this[prop];\n this[prop] = false;\n }\n }\n else {\n if (this.hasAttribute(prop)) {\n let value = this.getAttribute(prop);\n delete this[prop];\n this[prop] = value;\n }\n else if (Object.hasOwn(this, prop)) {\n const value = this[prop];\n delete this[prop];\n this[prop] = value;\n }\n }\n }\n __correctGetter(prop) {\n if (Object.hasOwn(this, prop)) {\n const value = this[prop];\n delete this[prop];\n this[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 postDisonnect() { }\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","dependances":[{"fullName":"HTMLElement","isStrong":true},{"fullName":"Aventus.DefaultComponent","isStrong":true},{"fullName":"Storybook","isStrong":false},{"fullName":"Dependances","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":"Map","isStrong":false},{"fullName":"Aventus.StateManager","isStrong":false},{"fullName":"Aventus.State","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"Aventus.Watcher","isStrong":false},{"fullName":"Aventus.Template","isStrong":true},{"fullName":"Aventus.TemplateInstance","isStrong":false},{"fullName":"CSSStyleSheet","isStrong":true},{"fullName":"Aventus.Style","isStrong":false},{"fullName":"Aventus.Instance","isStrong":false},{"fullName":"Date","isStrong":false},{"fullName":"Aventus.EffectReceiver","isStrong":false},{"fullName":"Aventus.WatcherChange","isStrong":false},{"fullName":"Element","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Document","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","dependances":[{"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 return tagname.indexOf((el.nodeName || el.tagName).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['classList'] && 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 return tagname.indexOf((el.nodeName || el['tagName']).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 var rootScope = element.getRootNode();\n var 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 var _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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Element","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"ShadowRoot","isStrong":false},{"fullName":"HTMLElement","isStrong":false},{"fullName":"HTMLSlotElement","isStrong":false},{"fullName":"Document","isStrong":false},{"fullName":"Aventus.WebComponent","isStrong":false}],"fullName":"Aventus.ElementExtension","required":false,"type":1,"isExported":true,"convertibleName":""}],"existing":[{"fullName":"Aventus.DebuggerConfig","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ActionBindings","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ActionInjection","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ActionEventCallback","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ActionEventListener","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.ContextEdit","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.If","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false},{"fullName":"Aventus.Template","isStrong":false}]},{"fullName":"Aventus.LoopSimple","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.LoopFct","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.TemplateHTML","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.DefaultComponent","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.StringLiteral","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.Constructor","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.OnlyConstructor","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.AnyConstructor","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.OnlyConstructor","isStrong":false}]},{"fullName":"Aventus.RamSubscribers","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.KeysObject","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.IRam","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IRamData","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.UriParamsValue","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.StateSlug","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false}]},{"fullName":"Aventus.StateAskChangeFct","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.StateInactivationFct","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.UriParams","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ResourceLoaderHeadOptions","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.ResourceLoaderOptions","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.WindowResizeObserver","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"globalThis.ResizeObserver","isStrong":false}]},{"fullName":"Aventus.ResizeObserverOptions","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"CallableFunction","isStrong":false}]},{"fullName":"Aventus.Pointer","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Touch","isStrong":false},{"fullName":"PointerEvent","isStrong":false}]},{"fullName":"Aventus.InstanceCst","dependances":[]},{"fullName":"Aventus.InstanceCst2","dependances":[{"fullName":"X","isStrong":false}]},{"fullName":"Aventus.PressManagerState","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false}]},{"fullName":"Aventus.Coordinate","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.InternalCustomFunction","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false}]},{"fullName":"Aventus.InternalPointerEvent","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.PressManagerState","isStrong":false},{"fullName":"Aventus.InternalCustomFunction","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false}]},{"fullName":"Aventus.PressManagerOptions","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Element","isStrong":false},{"fullName":"Aventus.NormalizedEvent","isStrong":false},{"fullName":"Aventus.PressManager","isStrong":false}]},{"fullName":"Aventus.TargetableElement","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"HTMLElement","isStrong":false},{"fullName":"SVGElement","isStrong":false}]},{"fullName":"Aventus.DragElementLeftTop","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"InstanceType","isStrong":false}]},{"fullName":"Aventus.DragElementXY","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"InstanceType","isStrong":false}]},{"fullName":"Aventus.ContainerElement","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"HTMLElement","isStrong":false},{"fullName":"SVGSVGElement","isStrong":false}]},{"fullName":"Aventus.AnyElement","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TargetableElement","isStrong":false},{"fullName":"Aventus.ContainerElement","isStrong":false}]},{"fullName":"Aventus.AnimationOptionsInternal","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.AnimationOptions","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.AnimationOptionsInternal","isStrong":false}]},{"fullName":"Aventus.RouterOptions","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.HttpRouterOptions","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IsNotVoid","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.WatcherFunctionInternal","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.WatcherFunction","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.WatcherAllowed","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.Asyncable","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Promise","isStrong":false}]},{"fullName":"Aventus.Enum","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.EnumValue","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.Enum","isStrong":false},{"fullName":"T","isStrong":false}]},{"fullName":"Aventus.ClassCopyOptions","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.SchemaType","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.JsonFromOptions","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.JsonToOptions","dependances":[{"fullName":"Storybook","isStrong":false}]},{"fullName":"Aventus.IData","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"clone","isStrong":false}]},{"fullName":"Aventus.Schema","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.SchemaType","isStrong":false}]},{"fullName":"Aventus.IConverterTransform","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Object","isStrong":false},{"fullName":"Aventus.ClassCopyOptions","isStrong":false}]},{"fullName":"Aventus.ExtractFromError","dependances":[{"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","dependances":[{"fullName":"Aventus.HttpRequest","isStrong":false},{"fullName":"Aventus.Asyncable","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false}]},{"fullName":"Aventus.WatcherChange","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatchAction","isStrong":false}]},{"fullName":"Aventus.EffectReceiver","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.WatcherChange","isStrong":false}]},{"fullName":"Aventus.RouterType","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRouter","isStrong":false}]},{"fullName":"Aventus.RouteType","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.HttpRoute","isStrong":false}]},{"fullName":"Aventus.DragElement","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.DragElementXY","isStrong":false},{"fullName":"Aventus.DragElementLeftTop","isStrong":false}]},{"fullName":"Aventus.DragAndDropOptionsShadow","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ContainerElement","isStrong":false},{"fullName":"Aventus.DragElement","isStrong":false}]},{"fullName":"Aventus.DragAndDropOptions","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.DragElement","isStrong":false},{"fullName":"HTMLElement","isStrong":false},{"fullName":"SVGElement","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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Required","isStrong":false},{"fullName":"Aventus.DragAndDropOptions","isStrong":false},{"fullName":"Aventus.DragAndDropOptionsShadow","isStrong":false}]},{"fullName":"Aventus.PreparedUri","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"RegExp","isStrong":false},{"fullName":"Aventus.UriParams","isStrong":false}]},{"fullName":"Aventus.IRamAction","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.KeysObject","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"Aventus.ResultRamWithError","isStrong":false},{"fullName":"Aventus.VoidRamWithError","isStrong":false}]},{"fullName":"Aventus.RamItem","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.IRamData","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.IRamAction","isStrong":false}]},{"fullName":"Aventus.StateActivationFct","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateSlug","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.Subscriber","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"RegExp","isStrong":false},{"fullName":"Aventus.StateActivationFct","isStrong":false},{"fullName":"Aventus.StateInactivationFct","isStrong":false},{"fullName":"Aventus.StateAskChangeFct","isStrong":false}]},{"fullName":"Aventus.StateAction","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateActivationFct","isStrong":false},{"fullName":"Aventus.StateInactivationFct","isStrong":false},{"fullName":"Aventus.StateAskChangeFct","isStrong":false}]},{"fullName":"Aventus.IStateManager","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateAction","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.IState","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.StateManager","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"Aventus.State","isStrong":false}]},{"fullName":"Aventus.Loop","dependances":[{"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","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.ActionEventListener","isStrong":false},{"fullName":"Aventus.ActionEventCallback","isStrong":false}]},{"fullName":"Aventus.LoopRegistery","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateInstance","isStrong":false},{"fullName":"Aventus.Computed","isStrong":false}]},{"fullName":"Aventus.ActionChange","dependances":[{"fullName":"Storybook","isStrong":false},{"fullName":"Aventus.TemplateContext","isStrong":false}]},{"fullName":"Aventus.Actions","dependances":[{"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_b26285fb825b5385fe67409d2ff912c7","required":true,"noNamespace":"before","type":0,"isExported":false,"convertibleName":""},{"code":" ","dependencies":[],"fullName":"!staticClass_20438bcb355abb9fced09a13ce90218d","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}]}]}
2488
2756
  //#endregion js src //
2489
2757
  //#region css def //
2490
2758
  {}
@@ -2495,6 +2763,6 @@ type Actions = {
2495
2763
  //#region html //
2496
2764
  {}
2497
2765
  //#endregion html //
2498
- //#region dependances //
2766
+ //#region dependencies //
2499
2767
  {}
2500
- //#endregion dependances //
2768
+ //#endregion dependencies //