@steroidsjs/nest 3.2.5 → 3.2.6
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.
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/usecases/dtos/SearchInputDto.d.ts +2 -0
- package/usecases/dtos/SearchInputDto.js +19 -3
- package/usecases/dtos/SearchInputDto.js.map +1 -1
- package/usecases/services/ReadService.d.ts +12 -1
- package/usecases/services/ReadService.js +20 -1
- package/usecases/services/ReadService.js.map +1 -1
- package/usecases/useCases/AutocompleteSearch/AutoCompleteSearchUseCase.d.ts +10 -0
- package/usecases/useCases/AutocompleteSearch/AutoCompleteSearchUseCase.js +36 -0
- package/usecases/useCases/AutocompleteSearch/AutoCompleteSearchUseCase.js.map +1 -0
- package/usecases/useCases/AutocompleteSearch/dtos/AutocompleteBaseDto.d.ts +4 -0
- package/usecases/useCases/AutocompleteSearch/dtos/AutocompleteBaseDto.js +26 -0
- package/usecases/useCases/AutocompleteSearch/dtos/AutocompleteBaseDto.js.map +1 -0
- package/usecases/useCases/AutocompleteSearch/dtos/AutocompleteBaseSchema.d.ts +9 -0
- package/usecases/useCases/AutocompleteSearch/dtos/AutocompleteBaseSchema.js +56 -0
- package/usecases/useCases/AutocompleteSearch/dtos/AutocompleteBaseSchema.js.map +1 -0
|
@@ -14,15 +14,31 @@ const fields_1 = require("../../infrastructure/decorators/fields");
|
|
|
14
14
|
class SearchInputDto {
|
|
15
15
|
}
|
|
16
16
|
__decorate([
|
|
17
|
-
(0, fields_1.IntegerField)({
|
|
17
|
+
(0, fields_1.IntegerField)({
|
|
18
|
+
label: 'Номер страницы',
|
|
19
|
+
nullable: true,
|
|
20
|
+
}),
|
|
18
21
|
__metadata("design:type", Number)
|
|
19
22
|
], SearchInputDto.prototype, "page", void 0);
|
|
20
23
|
__decorate([
|
|
21
|
-
(0, fields_1.IntegerField)({
|
|
24
|
+
(0, fields_1.IntegerField)({
|
|
25
|
+
label: 'Размер страницы',
|
|
26
|
+
nullable: true,
|
|
27
|
+
}),
|
|
22
28
|
__metadata("design:type", Number)
|
|
23
29
|
], SearchInputDto.prototype, "pageSize", void 0);
|
|
24
30
|
__decorate([
|
|
25
|
-
(0, fields_1.StringField)({
|
|
31
|
+
(0, fields_1.StringField)({
|
|
32
|
+
label: 'Поисковый запрос',
|
|
33
|
+
nullable: true,
|
|
34
|
+
}),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], SearchInputDto.prototype, "query", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, fields_1.StringField)({
|
|
39
|
+
label: 'Поле или массив полей, по которым будет выполнена сортировка',
|
|
40
|
+
nullable: true,
|
|
41
|
+
}),
|
|
26
42
|
__metadata("design:type", Object)
|
|
27
43
|
], SearchInputDto.prototype, "sort", void 0);
|
|
28
44
|
exports.SearchInputDto = SearchInputDto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInputDto.js","sourceRoot":"","sources":["../../../src/usecases/dtos/SearchInputDto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAAiF;
|
|
1
|
+
{"version":3,"file":"SearchInputDto.js","sourceRoot":"","sources":["../../../src/usecases/dtos/SearchInputDto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mEAAiF;AASjF,MAAa,cAAc;CAwB1B;AAvBG;IAAC,IAAA,qBAAY,EAAC;QACV,KAAK,EAAE,gBAAgB;QACvB,QAAQ,EAAE,IAAI;KACjB,CAAC;;4CACY;AAEd;IAAC,IAAA,qBAAY,EAAC;QACV,KAAK,EAAE,iBAAiB;QACxB,QAAQ,EAAE,IAAI;KACjB,CAAC;;gDACgB;AAElB;IAAC,IAAA,oBAAW,EAAC;QACT,KAAK,EAAE,kBAAkB;QACzB,QAAQ,EAAE,IAAI;KACjB,CAAC;;6CACa;AAEf;IAAC,IAAA,oBAAW,EAAC;QACT,KAAK,EAAE,8DAA8D;QACrE,QAAQ,EAAE,IAAI;KACjB,CAAC;;4CACuB;AAvB7B,wCAwBC"}
|
|
@@ -8,7 +8,7 @@ import { IType } from '../interfaces/IType';
|
|
|
8
8
|
/**
|
|
9
9
|
* Generic Read service (search and find)
|
|
10
10
|
*/
|
|
11
|
-
export declare class ReadService<TModel, TSearchDto = ISearchInputDto> {
|
|
11
|
+
export declare class ReadService<TModel, TSearchDto extends ISearchInputDto = ISearchInputDto> {
|
|
12
12
|
/**
|
|
13
13
|
* Model primary key
|
|
14
14
|
*/
|
|
@@ -35,6 +35,13 @@ export declare class ReadService<TModel, TSearchDto = ISearchInputDto> {
|
|
|
35
35
|
init(repository: ICrudRepository<TModel>, ModelClass: IType<TModel>): void;
|
|
36
36
|
search(dto: TSearchDto, context?: ContextDto | null): Promise<SearchResultDto<TModel>>;
|
|
37
37
|
search<TSchema>(dto: TSearchDto, context?: ContextDto | null, schemaClass?: IType<TSchema>): Promise<SearchResultDto<TSchema>>;
|
|
38
|
+
/**
|
|
39
|
+
* Для переопределения в проекте в рамках сервиса конкретной сущности, чтобы не переписывать search метод
|
|
40
|
+
* @param searchQuery
|
|
41
|
+
* @param dto
|
|
42
|
+
* @protected
|
|
43
|
+
*/
|
|
44
|
+
protected fillQueryFromSearchDto(searchQuery: SearchQuery<TModel>, dto: TSearchDto): SearchQuery<TModel>;
|
|
38
45
|
findById(id: number | string, context?: ContextDto | null): Promise<TModel>;
|
|
39
46
|
findById<TSchema>(id: number | string, context?: ContextDto | null, schemaClass?: IType<TSchema>): Promise<TSchema>;
|
|
40
47
|
/**
|
|
@@ -79,4 +86,8 @@ export declare class ReadService<TModel, TSearchDto = ISearchInputDto> {
|
|
|
79
86
|
* @protected
|
|
80
87
|
*/
|
|
81
88
|
protected isModel(obj: unknown): obj is TModel;
|
|
89
|
+
/**
|
|
90
|
+
* Get entity primary key
|
|
91
|
+
*/
|
|
92
|
+
getPrimaryKey(): string;
|
|
82
93
|
}
|
|
@@ -34,12 +34,25 @@ class ReadService {
|
|
|
34
34
|
await this.validate(dto, {
|
|
35
35
|
context,
|
|
36
36
|
});
|
|
37
|
-
const
|
|
37
|
+
const searchQuery = schemaClass
|
|
38
|
+
? SearchQuery_1.default.createFromSchema(schemaClass)
|
|
39
|
+
: new SearchQuery_1.default();
|
|
40
|
+
this.fillQueryFromSearchDto(searchQuery, dto);
|
|
41
|
+
const result = await this.repository.search(dto, searchQuery);
|
|
38
42
|
if (schemaClass) {
|
|
39
43
|
result.items = result.items.map((model) => this.modelToSchema(model, schemaClass));
|
|
40
44
|
}
|
|
41
45
|
return result;
|
|
42
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Для переопределения в проекте в рамках сервиса конкретной сущности, чтобы не переписывать search метод
|
|
49
|
+
* @param searchQuery
|
|
50
|
+
* @param dto
|
|
51
|
+
* @protected
|
|
52
|
+
*/
|
|
53
|
+
fillQueryFromSearchDto(searchQuery, dto) {
|
|
54
|
+
return searchQuery;
|
|
55
|
+
}
|
|
43
56
|
/**
|
|
44
57
|
* Find model by id
|
|
45
58
|
* @param id
|
|
@@ -108,6 +121,12 @@ class ReadService {
|
|
|
108
121
|
isModel(obj) {
|
|
109
122
|
return obj instanceof this.modelClass;
|
|
110
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Get entity primary key
|
|
126
|
+
*/
|
|
127
|
+
getPrimaryKey() {
|
|
128
|
+
return this.primaryKey;
|
|
129
|
+
}
|
|
111
130
|
}
|
|
112
131
|
exports.ReadService = ReadService;
|
|
113
132
|
//# sourceMappingURL=ReadService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadService.js","sourceRoot":"","sources":["../../../src/usecases/services/ReadService.ts"],"names":[],"mappings":";;;AAAA,mCAA+C;AAE/C,sDAAiD;AAGjD,kEAA6D;AAC7D,qDAAoE;AAKpE;;GAEG;AACH,MAAa,WAAW;IAAxB;QACI;;WAEG;QACO,eAAU,GAAW,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"ReadService.js","sourceRoot":"","s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C;IAED;;;;;OAKG;IACO,KAAK,CAAC,QAAQ,CAAC,GAAQ,EAAE,MAAyB;QACxD,MAAM,mCAAgB,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAClE,CAAC;IAED;;;;OAIG;IACO,OAAO,CAAC,GAAY;QAC1B,OAAO,GAAG,YAAY,IAAI,CAAC,UAAU,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,aAAa;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;CACJ;AArLD,kCAqLC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AutocompleteBaseDto } from './dtos/AutocompleteBaseDto';
|
|
2
|
+
import { AutocompleteBaseItemSchema, AutocompleteBaseSchema } from './dtos/AutocompleteBaseSchema';
|
|
3
|
+
import { ContextDto } from '../../dtos/ContextDto';
|
|
4
|
+
import { ReadService } from '../../services/ReadService';
|
|
5
|
+
export declare abstract class AutoCompleteSearchUseCase<TModel> {
|
|
6
|
+
protected readonly entityService: ReadService<TModel>;
|
|
7
|
+
protected constructor(entityService: ReadService<TModel>);
|
|
8
|
+
handle<TSchema extends new (...args: any[]) => AutocompleteBaseItemSchema>(dto: AutocompleteBaseDto, context: ContextDto | null, schemaClass: TSchema): Promise<AutocompleteBaseSchema<InstanceType<TSchema>>>;
|
|
9
|
+
private getSelectedItems;
|
|
10
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AutoCompleteSearchUseCase = void 0;
|
|
4
|
+
const SearchQuery_1 = require("../../base/SearchQuery");
|
|
5
|
+
const DataMapper_1 = require("../../helpers/DataMapper");
|
|
6
|
+
const ValidationHelper_1 = require("../../helpers/ValidationHelper");
|
|
7
|
+
class AutoCompleteSearchUseCase {
|
|
8
|
+
constructor(entityService) {
|
|
9
|
+
this.entityService = entityService;
|
|
10
|
+
}
|
|
11
|
+
async handle(dto, context, schemaClass) {
|
|
12
|
+
await ValidationHelper_1.ValidationHelper.validate(dto, { context });
|
|
13
|
+
const [selectedItems, searchResult] = await Promise.all([
|
|
14
|
+
this.getSelectedItems(schemaClass, dto.withIds),
|
|
15
|
+
this.entityService.search(dto, context, schemaClass),
|
|
16
|
+
]);
|
|
17
|
+
return {
|
|
18
|
+
selectedItems,
|
|
19
|
+
items: searchResult.items,
|
|
20
|
+
total: searchResult.total,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
async getSelectedItems(schemaClass, selectedIds) {
|
|
24
|
+
if (!(selectedIds === null || selectedIds === void 0 ? void 0 : selectedIds.length)) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
const primaryKey = this.entityService.getPrimaryKey();
|
|
28
|
+
const searchQuery = SearchQuery_1.default.createFromSchema(schemaClass);
|
|
29
|
+
searchQuery.where(['in', primaryKey, selectedIds]);
|
|
30
|
+
const selectedModels = await this.entityService.findMany(searchQuery);
|
|
31
|
+
// TODO разобраться с типизацией, чтобы убрать явное приведение
|
|
32
|
+
return DataMapper_1.DataMapper.create(schemaClass, selectedModels);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.AutoCompleteSearchUseCase = AutoCompleteSearchUseCase;
|
|
36
|
+
//# sourceMappingURL=AutoCompleteSearchUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoCompleteSearchUseCase.js","sourceRoot":"","sources":["../../../../src/usecases/useCases/AutocompleteSearch/AutoCompleteSearchUseCase.ts"],"names":[],"mappings":";;;AAEA,wDAAiD;AACjD,yDAAoD;AACpD,qEAAgE;AAIhE,MAAsB,yBAAyB;IAC3C,YACsB,aAAkC;QAAlC,kBAAa,GAAb,aAAa,CAAqB;IACtD,CAAC;IAEI,KAAK,CAAC,MAAM,CACf,GAAwB,EACxB,OAA0B,EAC1B,WAAoB;QAEpB,MAAM,mCAAgB,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAC,OAAO,EAAC,CAAC,CAAC;QAEhD,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACpD,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,GAAG,CAAC,OAAO,CAAC;YAC/C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,CAAC;SACvD,CAAC,CAAC;QAEH,OAAO;YACH,aAAa;YACb,KAAK,EAAE,YAAY,CAAC,KAAgC;YACpD,KAAK,EAAE,YAAY,CAAC,KAAK;SAC5B,CAAC;IACN,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAC1B,WAAoB,EACpB,WAAsB;QAEtB,IAAI,CAAC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,CAAA,EAAE;YACtB,OAAO,EAAE,CAAC;SACb;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;QAEtD,MAAM,WAAW,GAAG,qBAAW,CAAC,gBAAgB,CAAS,WAAW,CAAC,CAAC;QAEtE,WAAW,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;QAEnD,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAEtE,+DAA+D;QAC/D,OAAO,uBAAU,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAA4B,CAAC;IACrF,CAAC;CACJ;AA3CD,8DA2CC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AutocompleteBaseDto = void 0;
|
|
13
|
+
const SearchInputDto_1 = require("../../../dtos/SearchInputDto");
|
|
14
|
+
const fields_1 = require("../../../../infrastructure/decorators/fields");
|
|
15
|
+
class AutocompleteBaseDto extends SearchInputDto_1.SearchInputDto {
|
|
16
|
+
}
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, fields_1.IntegerField)({
|
|
19
|
+
label: 'ID выбранных значений. Возвращаются в поле selectedItems',
|
|
20
|
+
nullable: true,
|
|
21
|
+
isArray: true,
|
|
22
|
+
}),
|
|
23
|
+
__metadata("design:type", Array)
|
|
24
|
+
], AutocompleteBaseDto.prototype, "withIds", void 0);
|
|
25
|
+
exports.AutocompleteBaseDto = AutocompleteBaseDto;
|
|
26
|
+
//# sourceMappingURL=AutocompleteBaseDto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutocompleteBaseDto.js","sourceRoot":"","sources":["../../../../../src/usecases/useCases/AutocompleteSearch/dtos/AutocompleteBaseDto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iEAA4D;AAC5D,yEAA0E;AAE1E,MAAa,mBAAoB,SAAQ,+BAAc;CAOtD;AANG;IAAC,IAAA,qBAAY,EAAC;QACV,KAAK,EAAE,0DAA0D;QACjE,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;KAChB,CAAC;;oDACiB;AANvB,kDAOC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AutocompleteBaseSchema = exports.AutocompleteBaseItemSchema = void 0;
|
|
13
|
+
const fields_1 = require("../../../../infrastructure/decorators/fields");
|
|
14
|
+
class AutocompleteBaseItemSchema {
|
|
15
|
+
}
|
|
16
|
+
__decorate([
|
|
17
|
+
(0, fields_1.IntegerField)({
|
|
18
|
+
label: 'Ключ значения',
|
|
19
|
+
}),
|
|
20
|
+
__metadata("design:type", Number)
|
|
21
|
+
], AutocompleteBaseItemSchema.prototype, "id", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, fields_1.StringField)({
|
|
24
|
+
label: 'Название элемента',
|
|
25
|
+
}),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], AutocompleteBaseItemSchema.prototype, "label", void 0);
|
|
28
|
+
exports.AutocompleteBaseItemSchema = AutocompleteBaseItemSchema;
|
|
29
|
+
class AutocompleteBaseSchema {
|
|
30
|
+
}
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, fields_1.RelationField)({
|
|
33
|
+
label: 'Результат поиска',
|
|
34
|
+
type: 'ManyToMany',
|
|
35
|
+
isOwningSide: true,
|
|
36
|
+
relationClass: () => AutocompleteBaseItemSchema,
|
|
37
|
+
}),
|
|
38
|
+
__metadata("design:type", Array)
|
|
39
|
+
], AutocompleteBaseSchema.prototype, "items", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, fields_1.RelationField)({
|
|
42
|
+
label: 'Выбранные значения',
|
|
43
|
+
type: 'ManyToMany',
|
|
44
|
+
isOwningSide: true,
|
|
45
|
+
relationClass: () => AutocompleteBaseItemSchema,
|
|
46
|
+
}),
|
|
47
|
+
__metadata("design:type", Array)
|
|
48
|
+
], AutocompleteBaseSchema.prototype, "selectedItems", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, fields_1.IntegerField)({
|
|
51
|
+
label: 'Количество найденных элементов',
|
|
52
|
+
}),
|
|
53
|
+
__metadata("design:type", Number)
|
|
54
|
+
], AutocompleteBaseSchema.prototype, "total", void 0);
|
|
55
|
+
exports.AutocompleteBaseSchema = AutocompleteBaseSchema;
|
|
56
|
+
//# sourceMappingURL=AutocompleteBaseSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutocompleteBaseSchema.js","sourceRoot":"","sources":["../../../../../src/usecases/useCases/AutocompleteSearch/dtos/AutocompleteBaseSchema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yEAAsG;AAEtG,MAAa,0BAA0B;CAUtC;AATG;IAAC,IAAA,qBAAY,EAAC;QACV,KAAK,EAAE,eAAe;KACzB,CAAC;;sDACQ;AAEV;IAAC,IAAA,oBAAW,EAAC;QACT,KAAK,EAAE,mBAAmB;KAC7B,CAAC;;yDACY;AATlB,gEAUC;AAED,MAAa,sBAAsB;CAqBlC;AApBG;IAAC,IAAA,sBAAa,EAAC;QACX,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,YAAY;QAClB,YAAY,EAAE,IAAI;QAClB,aAAa,EAAE,GAAG,EAAE,CAAC,0BAA0B;KAClD,CAAC;;qDACkB;AAEpB;IAAC,IAAA,sBAAa,EAAC;QACX,KAAK,EAAE,oBAAoB;QAC3B,IAAI,EAAE,YAAY;QAClB,YAAY,EAAE,IAAI;QAClB,aAAa,EAAE,GAAG,EAAE,CAAC,0BAA0B;KAClD,CAAC;;6DAC0B;AAE5B;IAAC,IAAA,qBAAY,EAAC;QACV,KAAK,EAAE,gCAAgC;KAC1C,CAAC;;qDACW;AApBjB,wDAqBC"}
|