@acorex-platform/module-common-client 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +3 -0
  2. package/fesm2022/acorex-platform-module-common-client-acorex-platform-module-common-client-IHaYrZeE.mjs +6437 -0
  3. package/fesm2022/acorex-platform-module-common-client-acorex-platform-module-common-client-IHaYrZeE.mjs.map +1 -0
  4. package/fesm2022/acorex-platform-module-common-client-archive-entity.command-Dgsmx1_A.mjs +57 -0
  5. package/fesm2022/acorex-platform-module-common-client-archive-entity.command-Dgsmx1_A.mjs.map +1 -0
  6. package/fesm2022/acorex-platform-module-common-client-archive-entity.command.util-CEvlTSlo.mjs +144 -0
  7. package/fesm2022/acorex-platform-module-common-client-archive-entity.command.util-CEvlTSlo.mjs.map +1 -0
  8. package/fesm2022/acorex-platform-module-common-client-audit-info-column.component-DuZUwD31.mjs +158 -0
  9. package/fesm2022/acorex-platform-module-common-client-audit-info-column.component-DuZUwD31.mjs.map +1 -0
  10. package/fesm2022/acorex-platform-module-common-client-audit-info-edit.component-CSsCG6Dz.mjs +127 -0
  11. package/fesm2022/acorex-platform-module-common-client-audit-info-edit.component-CSsCG6Dz.mjs.map +1 -0
  12. package/fesm2022/acorex-platform-module-common-client-audit-info-view.component-WYXsZcLg.mjs +127 -0
  13. package/fesm2022/acorex-platform-module-common-client-audit-info-view.component-WYXsZcLg.mjs.map +1 -0
  14. package/fesm2022/acorex-platform-module-common-client-bulk-archive-entity.command-DZ6VL4oy.mjs +75 -0
  15. package/fesm2022/acorex-platform-module-common-client-bulk-archive-entity.command-DZ6VL4oy.mjs.map +1 -0
  16. package/fesm2022/acorex-platform-module-common-client-bulk-disable-entity.command-0J4vgsFL.mjs +75 -0
  17. package/fesm2022/acorex-platform-module-common-client-bulk-disable-entity.command-0J4vgsFL.mjs.map +1 -0
  18. package/fesm2022/acorex-platform-module-common-client-bulk-enable-entity.command-DsVuaInC.mjs +75 -0
  19. package/fesm2022/acorex-platform-module-common-client-bulk-enable-entity.command-DsVuaInC.mjs.map +1 -0
  20. package/fesm2022/acorex-platform-module-common-client-bulk-restore-archive-entity.command-C-ptvYRp.mjs +75 -0
  21. package/fesm2022/acorex-platform-module-common-client-bulk-restore-archive-entity.command-C-ptvYRp.mjs.map +1 -0
  22. package/fesm2022/acorex-platform-module-common-client-clone-entity.command-CyIAr8bc.mjs +227 -0
  23. package/fesm2022/acorex-platform-module-common-client-clone-entity.command-CyIAr8bc.mjs.map +1 -0
  24. package/fesm2022/acorex-platform-module-common-client-contracts.mjs +128 -0
  25. package/fesm2022/acorex-platform-module-common-client-contracts.mjs.map +1 -0
  26. package/fesm2022/acorex-platform-module-common-client-disable-entity.command-DWyqAAwo.mjs +57 -0
  27. package/fesm2022/acorex-platform-module-common-client-disable-entity.command-DWyqAAwo.mjs.map +1 -0
  28. package/fesm2022/acorex-platform-module-common-client-disable-entity.command.util-BBwY9Q30.mjs +146 -0
  29. package/fesm2022/acorex-platform-module-common-client-disable-entity.command.util-BBwY9Q30.mjs.map +1 -0
  30. package/fesm2022/acorex-platform-module-common-client-enable-entity.command-BP30gOku.mjs +57 -0
  31. package/fesm2022/acorex-platform-module-common-client-enable-entity.command-BP30gOku.mjs.map +1 -0
  32. package/fesm2022/acorex-platform-module-common-client-get-current-time.command-B7hJTMzT.mjs +72 -0
  33. package/fesm2022/acorex-platform-module-common-client-get-current-time.command-B7hJTMzT.mjs.map +1 -0
  34. package/fesm2022/acorex-platform-module-common-client-restore-archive-entity.command-D6ms054j.mjs +57 -0
  35. package/fesm2022/acorex-platform-module-common-client-restore-archive-entity.command-D6ms054j.mjs.map +1 -0
  36. package/fesm2022/acorex-platform-module-common-client-search-popup.component-upSRWTIO.mjs +136 -0
  37. package/fesm2022/acorex-platform-module-common-client-search-popup.component-upSRWTIO.mjs.map +1 -0
  38. package/fesm2022/acorex-platform-module-common-client-timeline-version-history-popup.component-D4lLwLpx.mjs +59 -0
  39. package/fesm2022/acorex-platform-module-common-client-timeline-version-history-popup.component-D4lLwLpx.mjs.map +1 -0
  40. package/fesm2022/acorex-platform-module-common-client.mjs +2 -0
  41. package/fesm2022/acorex-platform-module-common-client.mjs.map +1 -0
  42. package/package.json +32 -0
  43. package/types/acorex-platform-module-common-client-contracts.d.ts +111 -0
  44. package/types/acorex-platform-module-common-client.d.ts +777 -0
@@ -0,0 +1,127 @@
1
+ import { AXFormatService } from '@acorex/core/format';
2
+ import { AXPValueWidgetComponent } from '@acorex-platform/framework-client/layout/widget-core';
3
+ import * as i0 from '@angular/core';
4
+ import { inject, computed, ChangeDetectionStrategy, Component } from '@angular/core';
5
+ import * as i4 from '@acorex/core/translation';
6
+ import { AXTranslationModule } from '@acorex/core/translation';
7
+ import * as i1 from '@angular/common';
8
+ import { CommonModule } from '@angular/common';
9
+
10
+ class AXPAuditInfoViewComponent extends AXPValueWidgetComponent {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.formatService = inject(AXFormatService);
14
+ this.auditInfo = computed(() => {
15
+ let value = this.getValue();
16
+ if (!value) {
17
+ const contextData = this.contextService.data();
18
+ if (contextData && 'auditInfo' in contextData) {
19
+ value = contextData['auditInfo'];
20
+ }
21
+ }
22
+ return value && typeof value === 'object' ? value : null;
23
+ }, ...(ngDevMode ? [{ debugName: "auditInfo" }] : /* istanbul ignore next */ []));
24
+ this.hasAnyAuditInfo = computed(() => {
25
+ const info = this.auditInfo();
26
+ return !!(info?.created || info?.updated || info?.deleted);
27
+ }, ...(ngDevMode ? [{ debugName: "hasAnyAuditInfo" }] : /* istanbul ignore next */ []));
28
+ }
29
+ formatDate(date) {
30
+ if (!date) {
31
+ return '---';
32
+ }
33
+ try {
34
+ const dateObj = typeof date === 'string' ? new Date(date) : date;
35
+ return this.formatService.format(dateObj, 'datetime', {
36
+ format: 'short',
37
+ });
38
+ }
39
+ catch {
40
+ return '---';
41
+ }
42
+ }
43
+ formatUser(user) {
44
+ if (!user) {
45
+ return '---';
46
+ }
47
+ return user.fullName || user.username || user.id || '---';
48
+ }
49
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPAuditInfoViewComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
50
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXPAuditInfoViewComponent, isStandalone: true, selector: "axp-audit-info-view", usesInheritance: true, ngImport: i0, template: `
51
+ @if (auditInfo() && hasAnyAuditInfo()) {
52
+ <div class="text-xs space-y-1">
53
+ @if (auditInfo()?.created) {
54
+ <div>
55
+ <span class="text-muted">{{ '@general:terms.audit.created' | translate | async }}: </span>
56
+ <span [dir]="'ltr'">{{ formatDate(auditInfo()?.created?.at) }}</span>
57
+ @if (auditInfo()?.created?.by) {
58
+ <span class="text-muted"> • {{ formatUser(auditInfo()?.created?.by) }}</span>
59
+ }
60
+ </div>
61
+ }
62
+ @if (auditInfo()?.updated) {
63
+ <div>
64
+ <span class="text-muted">{{ '@general:terms.audit.updated' | translate | async }}: </span>
65
+ <span [dir]="'ltr'">{{ formatDate(auditInfo()?.updated?.at) }}</span>
66
+ @if (auditInfo()?.updated?.by) {
67
+ <span class="text-muted"> • {{ formatUser(auditInfo()?.updated?.by) }}</span>
68
+ }
69
+ </div>
70
+ }
71
+ @if (auditInfo()?.deleted) {
72
+ <div>
73
+ <span class="text-muted">{{ '@general:terms.audit.deleted' | translate | async }}: </span>
74
+ <span [dir]="'ltr'">{{ formatDate(auditInfo()?.deleted?.at) }}</span>
75
+ @if (auditInfo()?.deleted?.by) {
76
+ <span class="text-muted"> • {{ formatUser(auditInfo()?.deleted?.by) }}</span>
77
+ }
78
+ </div>
79
+ }
80
+ </div>
81
+ }
82
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXTranslationModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i4.AXTranslatorPipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
83
+ }
84
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPAuditInfoViewComponent, decorators: [{
85
+ type: Component,
86
+ args: [{
87
+ selector: 'axp-audit-info-view',
88
+ template: `
89
+ @if (auditInfo() && hasAnyAuditInfo()) {
90
+ <div class="text-xs space-y-1">
91
+ @if (auditInfo()?.created) {
92
+ <div>
93
+ <span class="text-muted">{{ '@general:terms.audit.created' | translate | async }}: </span>
94
+ <span [dir]="'ltr'">{{ formatDate(auditInfo()?.created?.at) }}</span>
95
+ @if (auditInfo()?.created?.by) {
96
+ <span class="text-muted"> • {{ formatUser(auditInfo()?.created?.by) }}</span>
97
+ }
98
+ </div>
99
+ }
100
+ @if (auditInfo()?.updated) {
101
+ <div>
102
+ <span class="text-muted">{{ '@general:terms.audit.updated' | translate | async }}: </span>
103
+ <span [dir]="'ltr'">{{ formatDate(auditInfo()?.updated?.at) }}</span>
104
+ @if (auditInfo()?.updated?.by) {
105
+ <span class="text-muted"> • {{ formatUser(auditInfo()?.updated?.by) }}</span>
106
+ }
107
+ </div>
108
+ }
109
+ @if (auditInfo()?.deleted) {
110
+ <div>
111
+ <span class="text-muted">{{ '@general:terms.audit.deleted' | translate | async }}: </span>
112
+ <span [dir]="'ltr'">{{ formatDate(auditInfo()?.deleted?.at) }}</span>
113
+ @if (auditInfo()?.deleted?.by) {
114
+ <span class="text-muted"> • {{ formatUser(auditInfo()?.deleted?.by) }}</span>
115
+ }
116
+ </div>
117
+ }
118
+ </div>
119
+ }
120
+ `,
121
+ changeDetection: ChangeDetectionStrategy.OnPush,
122
+ imports: [CommonModule, AXTranslationModule],
123
+ }]
124
+ }] });
125
+
126
+ export { AXPAuditInfoViewComponent };
127
+ //# sourceMappingURL=acorex-platform-module-common-client-audit-info-view.component-WYXsZcLg.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-common-client-audit-info-view.component-WYXsZcLg.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/history-plugin/components/audit-info-view.component.ts"],"sourcesContent":["import { AXPRecordAuditInfo } from '@acorex-platform/framework-shared/entity';\nimport { AXFormatService } from '@acorex/core/format';\nimport { AXPValueWidgetComponent } from '@acorex-platform/framework-client/layout/widget-core';\n\nimport { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';\nimport { AXTranslationModule } from '@acorex/core/translation';\nimport { CommonModule } from '@angular/common';\n\n@Component({\n selector: 'axp-audit-info-view',\n template: `\n @if (auditInfo() && hasAnyAuditInfo()) {\n <div class=\"text-xs space-y-1\">\n @if (auditInfo()?.created) {\n <div>\n <span class=\"text-muted\">{{ '@general:terms.audit.created' | translate | async }}: </span>\n <span [dir]=\"'ltr'\">{{ formatDate(auditInfo()?.created?.at) }}</span>\n @if (auditInfo()?.created?.by) {\n <span class=\"text-muted\"> • {{ formatUser(auditInfo()?.created?.by) }}</span>\n }\n </div>\n }\n @if (auditInfo()?.updated) {\n <div>\n <span class=\"text-muted\">{{ '@general:terms.audit.updated' | translate | async }}: </span>\n <span [dir]=\"'ltr'\">{{ formatDate(auditInfo()?.updated?.at) }}</span>\n @if (auditInfo()?.updated?.by) {\n <span class=\"text-muted\"> • {{ formatUser(auditInfo()?.updated?.by) }}</span>\n }\n </div>\n }\n @if (auditInfo()?.deleted) {\n <div>\n <span class=\"text-muted\">{{ '@general:terms.audit.deleted' | translate | async }}: </span>\n <span [dir]=\"'ltr'\">{{ formatDate(auditInfo()?.deleted?.at) }}</span>\n @if (auditInfo()?.deleted?.by) {\n <span class=\"text-muted\"> • {{ formatUser(auditInfo()?.deleted?.by) }}</span>\n }\n </div>\n }\n </div>\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [CommonModule, AXTranslationModule],\n})\nexport class AXPAuditInfoViewComponent extends AXPValueWidgetComponent<AXPRecordAuditInfo> {\n private readonly formatService = inject(AXFormatService);\n\n protected auditInfo = computed<AXPRecordAuditInfo | null>(() => {\n let value = this.getValue();\n\n if (!value) {\n const contextData = this.contextService.data() as Record<string, any>;\n if (contextData && 'auditInfo' in contextData) {\n value = contextData['auditInfo'];\n }\n }\n\n return value && typeof value === 'object' ? (value as AXPRecordAuditInfo) : null;\n });\n\n protected hasAnyAuditInfo = computed<boolean>(() => {\n const info = this.auditInfo();\n return !!(info?.created || info?.updated || info?.deleted);\n });\n\n protected formatDate(date: Date | string | undefined): string {\n if (!date) {\n return '---';\n }\n\n try {\n const dateObj = typeof date === 'string' ? new Date(date) : date;\n return this.formatService.format(dateObj, 'datetime', {\n format: 'short',\n });\n } catch {\n return '---';\n }\n }\n\n protected formatUser(user: any): string {\n if (!user) {\n return '---';\n }\n\n return user.fullName || user.username || user.id || '---';\n }\n}\n"],"names":["i2"],"mappings":";;;;;;;;;AA8CM,MAAO,yBAA0B,SAAQ,uBAA2C,CAAA;AAtC1F,IAAA,WAAA,GAAA;;AAuCmB,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC;AAE9C,QAAA,IAAA,CAAA,SAAS,GAAG,QAAQ,CAA4B,MAAK;AAC7D,YAAA,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE;YAE3B,IAAI,CAAC,KAAK,EAAE;gBACV,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,EAAyB;AACrE,gBAAA,IAAI,WAAW,IAAI,WAAW,IAAI,WAAW,EAAE;AAC7C,oBAAA,KAAK,GAAG,WAAW,CAAC,WAAW,CAAC;gBAClC;YACF;AAEA,YAAA,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,GAAI,KAA4B,GAAG,IAAI;AAClF,QAAA,CAAC,gFAAC;AAEQ,QAAA,IAAA,CAAA,eAAe,GAAG,QAAQ,CAAU,MAAK;AACjD,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE;AAC7B,YAAA,OAAO,CAAC,EAAE,IAAI,E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A,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAA,EAAA,CAAA,SAAA,EAAA,IAAA,EAAA,OAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAAA,EAAA,CAAA,gBAAA,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FAEhC,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBAtCrC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,qBAAqB;AAC/B,oBAAA,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCT,EAAA,CAAA;oBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,mBAAmB,CAAC;AAC7C,iBAAA;;;;;"}
@@ -0,0 +1,75 @@
1
+ import { AXTranslationService } from '@acorex/core/translation';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, Injectable } from '@angular/core';
4
+ import { A as AXPArchiveEntityCommandHelper, c as normalizeArchiveBulkInput, b as buildArchivePatch } from './acorex-platform-module-common-client-archive-entity.command.util-CEvlTSlo.mjs';
5
+
6
+ class AXPBulkArchiveEntityCommand {
7
+ constructor() {
8
+ this.helper = inject(AXPArchiveEntityCommandHelper);
9
+ this.translationService = inject(AXTranslationService);
10
+ }
11
+ async execute(input) {
12
+ const context = normalizeArchiveBulkInput(input);
13
+ if (!context) {
14
+ return {
15
+ success: false,
16
+ message: {
17
+ text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),
18
+ },
19
+ };
20
+ }
21
+ const confirmed = await this.helper.confirm('@general:actions.bulk-archive.confirm.title', '@general:actions.bulk-archive.confirm.message', { count: context.ids.length });
22
+ if (!confirmed) {
23
+ return { success: false };
24
+ }
25
+ const loadingDialog = this.helper.showLoading(await this.translationService.translateAsync('@general:actions.bulk-archive.confirm.processing'), `Archiving ${context.ids.length} items...`);
26
+ const processedIds = [];
27
+ const failedIds = [];
28
+ const patch = buildArchivePatch(true);
29
+ try {
30
+ for (const id of context.ids) {
31
+ try {
32
+ await this.helper.applyPatch(context.refType, id, patch);
33
+ processedIds.push(id);
34
+ }
35
+ catch (error) {
36
+ console.error(`Failed to archive entity ${id}:`, error);
37
+ failedIds.push(id);
38
+ }
39
+ }
40
+ if (processedIds.length > 0) {
41
+ this.helper.dispatchBulkArchived(context.refType, processedIds, {
42
+ failedIds,
43
+ totalProcessed: processedIds.length,
44
+ totalFailed: failedIds.length,
45
+ });
46
+ await this.helper.showSuccessToast('@general:workflow.entity-bulk-archived', '@general:workflow.entity-bulk-archived-body');
47
+ }
48
+ return {
49
+ success: processedIds.length > 0,
50
+ data: { processedIds, failedIds },
51
+ };
52
+ }
53
+ catch (error) {
54
+ console.error('Bulk archive operation failed:', error);
55
+ return {
56
+ success: false,
57
+ message: {
58
+ text: error instanceof Error ? error.message : 'Bulk archive operation failed',
59
+ },
60
+ };
61
+ }
62
+ finally {
63
+ loadingDialog.close();
64
+ }
65
+ }
66
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPBulkArchiveEntityCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
67
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPBulkArchiveEntityCommand, providedIn: 'root' }); }
68
+ }
69
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPBulkArchiveEntityCommand, decorators: [{
70
+ type: Injectable,
71
+ args: [{ providedIn: 'root' }]
72
+ }] });
73
+
74
+ export { AXPBulkArchiveEntityCommand };
75
+ //# sourceMappingURL=acorex-platform-module-common-client-bulk-archive-entity.command-DZ6VL4oy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-common-client-bulk-archive-entity.command-DZ6VL4oy.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/bulk-archive-entity.command.ts"],"sourcesContent":["import { AXPCommand } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPExecuteCommandResult, type AXPContextData } from '@acorex-platform/framework-shared/core';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPArchiveEntityCommandHelper } from './archive-entity.command.helper';\nimport { buildArchivePatch, normalizeArchiveBulkInput } from './archive-entity.command.util';\n\n@Injectable({ providedIn: 'root' })\nexport class AXPBulkArchiveEntityCommand\n implements AXPCommand<AXPContextData, { processedIds: string[]; failedIds: string[] }>\n{\n private readonly helper = inject(AXPArchiveEntityCommandHelper);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(\n input: AXPContextData,\n ): Promise<AXPExecuteCommandResult<{ processedIds: string[]; failedIds: string[] }>> {\n const context = normalizeArchiveBulkInput(input);\n if (!context) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),\n },\n };\n }\n\n const confirmed = await this.helper.confirm(\n '@general:actions.bulk-archive.confirm.title',\n '@general:actions.bulk-archive.confirm.message',\n { count: context.ids.length },\n );\n if (!confirmed) {\n return { success: false };\n }\n\n const loadingDialog = this.helper.showLoading(\n await this.translationService.translateAsync('@general:actions.bulk-archive.confirm.processing'),\n `Archiving ${context.ids.length} items...`,\n );\n\n const processedIds: string[] = [];\n const failedIds: string[] = [];\n const patch = buildArchivePatch(true);\n\n try {\n for (const id of context.ids) {\n try {\n await this.helper.applyPatch(context.refType, id, patch);\n processedIds.push(id);\n } catch (error) {\n console.error(`Failed to archive entity ${id}:`, error);\n failedIds.push(id);\n }\n }\n\n if (processedIds.length > 0) {\n this.helper.dispatchBulkArchived(context.refType, processedIds, {\n failedIds,\n totalProcessed: processedIds.length,\n totalFailed: failedIds.length,\n });\n await this.helper.showSuccessToast(\n '@general:workflow.entity-bulk-archived',\n '@general:workflow.entity-bulk-archived-body',\n );\n }\n\n return {\n success: processedIds.length > 0,\n data: { processedIds, failedIds },\n };\n } catch (error) {\n console.error('Bulk archive operation failed:', error);\n return {\n success: false,\n message: {\n text: error instanceof Error ? error.message : 'Bulk archive operation failed',\n },\n };\n } finally {\n loadingDialog.close();\n }\n }\n}\n"],"names":[],"mappings":";;;;;MASa,2BAA2B,CAAA;AADxC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAC9C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAwEnE,IAAA;IAtEC,MAAM,OAAO,CACX,KAAqB,EAAA;AAErB,QAAA,MAAM,OAAO,GAAG,yBAAyB,CAAC,KAAK,CAAC;QAChD,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,uCAAuC,CAAC;AAC5F,iBAAA;aACF;QACH;QAEA,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CACzC,6CAA6C,EAC7C,+CAA+C,EAC/C,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAC9B;QACD,IAAI,CAAC,SAAS,EAAE;AACd,YAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;QAC3B;QAEA,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAC3C,MAAM,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,kDAAkD,CAAC,EAChG,CAAA,UAAA,EAAa,OAAO,CAAC,GAAG,CAAC,MAAM,CAAA,SAAA,CAAW,CAC3C;QAED,MAAM,YAAY,GAAa,EAAE;QACjC,MAAM,SAAS,GAAa,EAAE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CAAC,KAAK,EAAE;QACvB;IACF;8GA3EW,2BAA2B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA3B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,2BAA2B,cADd,MAAM,EAAA,CAAA,CAAA;;2FACnB,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBADvC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
@@ -0,0 +1,75 @@
1
+ import { AXTranslationService } from '@acorex/core/translation';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, Injectable } from '@angular/core';
4
+ import { A as AXPDisableEntityCommandHelper, c as normalizeDisableBulkInput, b as buildDisablePatch } from './acorex-platform-module-common-client-disable-entity.command.util-BBwY9Q30.mjs';
5
+
6
+ class AXPBulkDisableEntityCommand {
7
+ constructor() {
8
+ this.helper = inject(AXPDisableEntityCommandHelper);
9
+ this.translationService = inject(AXTranslationService);
10
+ }
11
+ async execute(input) {
12
+ const context = normalizeDisableBulkInput(input);
13
+ if (!context) {
14
+ return {
15
+ success: false,
16
+ message: {
17
+ text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),
18
+ },
19
+ };
20
+ }
21
+ const confirmed = await this.helper.confirm('@general:actions.bulk-disable.confirm.title', '@general:actions.bulk-disable.confirm.message', { count: context.ids.length });
22
+ if (!confirmed) {
23
+ return { success: false };
24
+ }
25
+ const loadingDialog = this.helper.showLoading(await this.translationService.translateAsync('@general:actions.bulk-disable.confirm.processing'), 'Disabling items...');
26
+ const processedIds = [];
27
+ const failedIds = [];
28
+ const patch = buildDisablePatch(true);
29
+ try {
30
+ for (const id of context.ids) {
31
+ try {
32
+ await this.helper.applyPatch(context.refType, id, patch);
33
+ processedIds.push(id);
34
+ }
35
+ catch (error) {
36
+ console.error(`Failed to disable entity ${id}:`, error);
37
+ failedIds.push(id);
38
+ }
39
+ }
40
+ if (processedIds.length > 0) {
41
+ this.helper.dispatchBulkDisabled(context.refType, processedIds, {
42
+ failedIds,
43
+ totalProcessed: processedIds.length,
44
+ totalFailed: failedIds.length,
45
+ });
46
+ await this.helper.showSuccessToast('@general:workflow.entity-bulk-disabled', '@general:workflow.entity-bulk-disabled-body');
47
+ }
48
+ return {
49
+ success: processedIds.length > 0,
50
+ data: { processedIds, failedIds },
51
+ };
52
+ }
53
+ catch (error) {
54
+ console.error('Bulk disable operation failed:', error);
55
+ return {
56
+ success: false,
57
+ message: {
58
+ text: error instanceof Error ? error.message : 'Bulk disable operation failed',
59
+ },
60
+ };
61
+ }
62
+ finally {
63
+ loadingDialog.close();
64
+ }
65
+ }
66
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPBulkDisableEntityCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
67
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPBulkDisableEntityCommand, providedIn: 'root' }); }
68
+ }
69
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPBulkDisableEntityCommand, decorators: [{
70
+ type: Injectable,
71
+ args: [{ providedIn: 'root' }]
72
+ }] });
73
+
74
+ export { AXPBulkDisableEntityCommand };
75
+ //# sourceMappingURL=acorex-platform-module-common-client-bulk-disable-entity.command-0J4vgsFL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-common-client-bulk-disable-entity.command-0J4vgsFL.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/disable-plugin/commands/bulk-disable-entity.command.ts"],"sourcesContent":["import { AXPCommand } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPExecuteCommandResult, type AXPContextData } from '@acorex-platform/framework-shared/core';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPDisableEntityCommandHelper } from './disable-entity.command.helper';\nimport { buildDisablePatch, normalizeDisableBulkInput } from './disable-entity.command.util';\n\n@Injectable({ providedIn: 'root' })\nexport class AXPBulkDisableEntityCommand\n implements AXPCommand<AXPContextData, { processedIds: string[]; failedIds: string[] }>\n{\n private readonly helper = inject(AXPDisableEntityCommandHelper);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(\n input: AXPContextData,\n ): Promise<AXPExecuteCommandResult<{ processedIds: string[]; failedIds: string[] }>> {\n const context = normalizeDisableBulkInput(input);\n if (!context) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),\n },\n };\n }\n\n const confirmed = await this.helper.confirm(\n '@general:actions.bulk-disable.confirm.title',\n '@general:actions.bulk-disable.confirm.message',\n { count: context.ids.length },\n );\n if (!confirmed) {\n return { success: false };\n }\n\n const loadingDialog = this.helper.showLoading(\n await this.translationService.translateAsync('@general:actions.bulk-disable.confirm.processing'),\n 'Disabling items...',\n );\n\n const processedIds: string[] = [];\n const failedIds: string[] = [];\n const patch = buildDisablePatch(true);\n\n try {\n for (const id of context.ids) {\n try {\n await this.helper.applyPatch(context.refType, id, patch);\n processedIds.push(id);\n } catch (error) {\n console.error(`Failed to disable entity ${id}:`, error);\n failedIds.push(id);\n }\n }\n\n if (processedIds.length > 0) {\n this.helper.dispatchBulkDisabled(context.refType, processedIds, {\n failedIds,\n totalProcessed: processedIds.length,\n totalFailed: failedIds.length,\n });\n await this.helper.showSuccessToast(\n '@general:workflow.entity-bulk-disabled',\n '@general:workflow.entity-bulk-disabled-body',\n );\n }\n\n return {\n success: processedIds.length > 0,\n data: { processedIds, failedIds },\n };\n } catch (error) {\n console.error('Bulk disable operation failed:', error);\n return {\n success: false,\n message: {\n text: error instanceof Error ? error.message : 'Bulk disable operation failed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,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,2BAA2B,cADd,MAAM,EAAA,CAAA,CAAA;;2FACnB,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBADvC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
@@ -0,0 +1,75 @@
1
+ import { AXTranslationService } from '@acorex/core/translation';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, Injectable } from '@angular/core';
4
+ import { A as AXPDisableEntityCommandHelper, c as normalizeDisableBulkInput, b as buildDisablePatch } from './acorex-platform-module-common-client-disable-entity.command.util-BBwY9Q30.mjs';
5
+
6
+ class AXPBulkEnableEntityCommand {
7
+ constructor() {
8
+ this.helper = inject(AXPDisableEntityCommandHelper);
9
+ this.translationService = inject(AXTranslationService);
10
+ }
11
+ async execute(input) {
12
+ const context = normalizeDisableBulkInput(input);
13
+ if (!context) {
14
+ return {
15
+ success: false,
16
+ message: {
17
+ text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),
18
+ },
19
+ };
20
+ }
21
+ const confirmed = await this.helper.confirm('@general:actions.bulk-enable.confirm.title', '@general:actions.bulk-enable.confirm.message', { count: context.ids.length }, 'success');
22
+ if (!confirmed) {
23
+ return { success: false };
24
+ }
25
+ const loadingDialog = this.helper.showLoading(await this.translationService.translateAsync('@general:actions.bulk-enable.confirm.processing'), 'Enabling items...');
26
+ const processedIds = [];
27
+ const failedIds = [];
28
+ const patch = buildDisablePatch(false);
29
+ try {
30
+ for (const id of context.ids) {
31
+ try {
32
+ await this.helper.applyPatch(context.refType, id, patch);
33
+ processedIds.push(id);
34
+ }
35
+ catch (error) {
36
+ console.error(`Failed to enable entity ${id}:`, error);
37
+ failedIds.push(id);
38
+ }
39
+ }
40
+ if (processedIds.length > 0) {
41
+ this.helper.dispatchBulkEnabled(context.refType, processedIds, {
42
+ failedIds,
43
+ totalProcessed: processedIds.length,
44
+ totalFailed: failedIds.length,
45
+ });
46
+ await this.helper.showSuccessToast('@general:workflow.entity-bulk-enabled', '@general:workflow.entity-bulk-enabled-body');
47
+ }
48
+ return {
49
+ success: processedIds.length > 0,
50
+ data: { processedIds, failedIds },
51
+ };
52
+ }
53
+ catch (error) {
54
+ console.error('Bulk enable operation failed:', error);
55
+ const message = error instanceof Error ? error.message : 'Bulk enable operation failed';
56
+ await this.helper.showErrorToast(message);
57
+ return {
58
+ success: false,
59
+ message: { text: message },
60
+ };
61
+ }
62
+ finally {
63
+ loadingDialog.close();
64
+ }
65
+ }
66
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPBulkEnableEntityCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
67
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPBulkEnableEntityCommand, providedIn: 'root' }); }
68
+ }
69
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPBulkEnableEntityCommand, decorators: [{
70
+ type: Injectable,
71
+ args: [{ providedIn: 'root' }]
72
+ }] });
73
+
74
+ export { AXPBulkEnableEntityCommand };
75
+ //# sourceMappingURL=acorex-platform-module-common-client-bulk-enable-entity.command-DsVuaInC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-common-client-bulk-enable-entity.command-DsVuaInC.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/disable-plugin/commands/bulk-enable-entity.command.ts"],"sourcesContent":["import { AXPCommand } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPExecuteCommandResult, type AXPContextData } from '@acorex-platform/framework-shared/core';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPDisableEntityCommandHelper } from './disable-entity.command.helper';\nimport { buildDisablePatch, normalizeDisableBulkInput } from './disable-entity.command.util';\n\n@Injectable({ providedIn: 'root' })\nexport class AXPBulkEnableEntityCommand\n implements AXPCommand<AXPContextData, { processedIds: string[]; failedIds: string[] }>\n{\n private readonly helper = inject(AXPDisableEntityCommandHelper);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(\n input: AXPContextData,\n ): Promise<AXPExecuteCommandResult<{ processedIds: string[]; failedIds: string[] }>> {\n const context = normalizeDisableBulkInput(input);\n if (!context) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),\n },\n };\n }\n\n const confirmed = await this.helper.confirm(\n '@general:actions.bulk-enable.confirm.title',\n '@general:actions.bulk-enable.confirm.message',\n { count: context.ids.length },\n 'success',\n );\n if (!confirmed) {\n return { success: false };\n }\n\n const loadingDialog = this.helper.showLoading(\n await this.translationService.translateAsync('@general:actions.bulk-enable.confirm.processing'),\n 'Enabling items...',\n );\n\n const processedIds: string[] = [];\n const failedIds: string[] = [];\n const patch = buildDisablePatch(false);\n\n try {\n for (const id of context.ids) {\n try {\n await this.helper.applyPatch(context.refType, id, patch);\n processedIds.push(id);\n } catch (error) {\n console.error(`Failed to enable entity ${id}:`, error);\n failedIds.push(id);\n }\n }\n\n if (processedIds.length > 0) {\n this.helper.dispatchBulkEnabled(context.refType, processedIds, {\n failedIds,\n totalProcessed: processedIds.length,\n totalFailed: failedIds.length,\n });\n await this.helper.showSuccessToast(\n '@general:workflow.entity-bulk-enabled',\n '@general:workflow.entity-bulk-enabled-body',\n );\n }\n\n return {\n success: processedIds.length > 0,\n data: { processedIds, failedIds },\n };\n } catch (error) {\n console.error('Bulk enable operation failed:', error);\n const message = error instanceof Error ? error.message : 'Bulk enable operation failed';\n await this.helper.showErrorToast(message);\n return {\n success: false,\n message: { text: message },\n };\n } finally {\n loadingDialog.close();\n }\n }\n}\n"],"names":[],"mappings":";;;;;MASa,0BAA0B,CAAA;AADvC,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAC9C,QAAA,IAAA,CAAA,k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EAAA,UAAA,EAAA,CAAA;kBADtC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
@@ -0,0 +1,75 @@
1
+ import { AXTranslationService } from '@acorex/core/translation';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, Injectable } from '@angular/core';
4
+ import { A as AXPArchiveEntityCommandHelper, c as normalizeArchiveBulkInput, b as buildArchivePatch } from './acorex-platform-module-common-client-archive-entity.command.util-CEvlTSlo.mjs';
5
+
6
+ class AXPBulkRestoreArchiveEntityCommand {
7
+ constructor() {
8
+ this.helper = inject(AXPArchiveEntityCommandHelper);
9
+ this.translationService = inject(AXTranslationService);
10
+ }
11
+ async execute(input) {
12
+ const context = normalizeArchiveBulkInput(input);
13
+ if (!context) {
14
+ return {
15
+ success: false,
16
+ message: {
17
+ text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),
18
+ },
19
+ };
20
+ }
21
+ const confirmed = await this.helper.confirm('@general:actions.bulk-restore-archive.confirm.title', '@general:actions.bulk-restore-archive.confirm.message', { count: context.ids.length });
22
+ if (!confirmed) {
23
+ return { success: false };
24
+ }
25
+ const loadingDialog = this.helper.showLoading(await this.translationService.translateAsync('@general:actions.bulk-restore-archive.confirm.processing'), `Unarchiving ${context.ids.length} items...`);
26
+ const processedIds = [];
27
+ const failedIds = [];
28
+ const patch = buildArchivePatch(false);
29
+ try {
30
+ for (const id of context.ids) {
31
+ try {
32
+ await this.helper.applyPatch(context.refType, id, patch);
33
+ processedIds.push(id);
34
+ }
35
+ catch (error) {
36
+ console.error(`Failed to unarchive entity ${id}:`, error);
37
+ failedIds.push(id);
38
+ }
39
+ }
40
+ if (processedIds.length > 0) {
41
+ this.helper.dispatchBulkUnarchived(context.refType, processedIds, {
42
+ failedIds,
43
+ totalProcessed: processedIds.length,
44
+ totalFailed: failedIds.length,
45
+ });
46
+ await this.helper.showSuccessToast('@general:workflow.entity-bulk-unarchived', '@general:workflow.entity-bulk-unarchived-body');
47
+ }
48
+ return {
49
+ success: processedIds.length > 0,
50
+ data: { processedIds, failedIds },
51
+ };
52
+ }
53
+ catch (error) {
54
+ console.error('Bulk unarchive operation failed:', error);
55
+ return {
56
+ success: false,
57
+ message: {
58
+ text: error instanceof Error ? error.message : 'Bulk unarchive operation failed',
59
+ },
60
+ };
61
+ }
62
+ finally {
63
+ loadingDialog.close();
64
+ }
65
+ }
66
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPBulkRestoreArchiveEntityCommand, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
67
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPBulkRestoreArchiveEntityCommand, providedIn: 'root' }); }
68
+ }
69
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPBulkRestoreArchiveEntityCommand, decorators: [{
70
+ type: Injectable,
71
+ args: [{ providedIn: 'root' }]
72
+ }] });
73
+
74
+ export { AXPBulkRestoreArchiveEntityCommand };
75
+ //# sourceMappingURL=acorex-platform-module-common-client-bulk-restore-archive-entity.command-C-ptvYRp.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acorex-platform-module-common-client-bulk-restore-archive-entity.command-C-ptvYRp.mjs","sources":["../../../../libs/modules/common/client/src/lib/features/archive-plugin/commands/bulk-restore-archive-entity.command.ts"],"sourcesContent":["import { AXPCommand } from '@acorex-platform/framework-shared/runtime';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPExecuteCommandResult, type AXPContextData } from '@acorex-platform/framework-shared/core';\nimport { inject, Injectable } from '@angular/core';\n\nimport { AXPArchiveEntityCommandHelper } from './archive-entity.command.helper';\nimport { buildArchivePatch, normalizeArchiveBulkInput } from './archive-entity.command.util';\n\n@Injectable({ providedIn: 'root' })\nexport class AXPBulkRestoreArchiveEntityCommand\n implements AXPCommand<AXPContextData, { processedIds: string[]; failedIds: string[] }>\n{\n private readonly helper = inject(AXPArchiveEntityCommandHelper);\n private readonly translationService = inject(AXTranslationService);\n\n async execute(\n input: AXPContextData,\n ): Promise<AXPExecuteCommandResult<{ processedIds: string[]; failedIds: string[] }>> {\n const context = normalizeArchiveBulkInput(input);\n if (!context) {\n return {\n success: false,\n message: {\n text: await this.translationService.translateAsync('@general:messages.entity.invalid-data'),\n },\n };\n }\n\n const confirmed = await this.helper.confirm(\n '@general:actions.bulk-restore-archive.confirm.title',\n '@general:actions.bulk-restore-archive.confirm.message',\n { count: context.ids.length },\n );\n if (!confirmed) {\n return { success: false };\n }\n\n const loadingDialog = this.helper.showLoading(\n await this.translationService.translateAsync('@general:actions.bulk-restore-archive.confirm.processing'),\n `Unarchiving ${context.ids.length} items...`,\n );\n\n const processedIds: string[] = [];\n const failedIds: string[] = [];\n const patch = buildArchivePatch(false);\n\n try {\n for (const id of context.ids) {\n try {\n await this.helper.applyPatch(context.refType, id, patch);\n processedIds.push(id);\n } catch (error) {\n console.error(`Failed to unarchive entity ${id}:`, error);\n failedIds.push(id);\n }\n }\n\n if (processedIds.length > 0) {\n this.helper.dispatchBulkUnarchived(context.refType, processedIds, {\n failedIds,\n totalProcessed: processedIds.length,\n totalFailed: failedIds.length,\n });\n await this.helper.showSuccessToast(\n '@general:workflow.entity-bulk-unarchived',\n '@general:workflow.entity-bulk-unarchived-body',\n );\n }\n\n return {\n success: processedIds.length > 0,\n data: { processedIds, failedIds },\n };\n } catch (error) {\n console.error('Bulk unarchive operation failed:', error);\n return {\n success: false,\n message: {\n text: error instanceof Error ? error.message : 'Bulk unarchive operation failed',\n },\n };\n } finally {\n loadingDialog.close();\n }\n }\n}\n"],"names":[],"mappings":";;;;;MASa,kCAAkC,CAAA;AAD/C,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,6BAA6B,CAAC;AAC9C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,o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