@cuby-ui/core 0.0.321 → 0.0.323

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 (84) hide show
  1. package/components/sidebar/sidebar-header/sidebar-header.component.d.ts +1 -1
  2. package/components/sidebar/sidebar-navigation-item/sidebar-navigation-item.component.d.ts +1 -1
  3. package/esm2022/interfaces/image.mjs +2 -0
  4. package/esm2022/interfaces/index.mjs +2 -1
  5. package/esm2022/widgets/criterion-info/criterion-info.component.mjs +137 -0
  6. package/esm2022/widgets/criterion-info/index.mjs +2 -0
  7. package/esm2022/widgets/criterion-info-form/criterion-info-form.component.mjs +147 -0
  8. package/esm2022/widgets/criterion-info-form/criterion-info-form.options.mjs +2 -0
  9. package/esm2022/widgets/criterion-info-form/index.mjs +2 -0
  10. package/esm2022/widgets/criterion-readonly-info/criterion-readonly-info.component.mjs +72 -0
  11. package/esm2022/widgets/criterion-readonly-info/index.mjs +2 -0
  12. package/esm2022/widgets/index.mjs +6 -2
  13. package/esm2022/widgets/instruction-info/index.mjs +2 -0
  14. package/esm2022/widgets/instruction-info/instruction-info.component.mjs +147 -0
  15. package/esm2022/widgets/instruction-info-form/index.mjs +2 -0
  16. package/esm2022/widgets/instruction-info-form/instruction-info-form.component.mjs +153 -0
  17. package/esm2022/widgets/instruction-info-form/instruction-info-form.options.mjs +2 -0
  18. package/esm2022/widgets/instruction-readonly-info/index.mjs +2 -0
  19. package/esm2022/widgets/instruction-readonly-info/instruction-readonly-info.component.mjs +72 -0
  20. package/esm2022/widgets/utility-modal/components/criterion-modal-create/criterion-modal-create.component.mjs +40 -0
  21. package/esm2022/widgets/utility-modal/components/criterion-modal-create/index.mjs +2 -0
  22. package/esm2022/widgets/utility-modal/components/index.mjs +5 -0
  23. package/esm2022/widgets/utility-modal/components/instruction-modal-create/index.mjs +2 -0
  24. package/esm2022/widgets/utility-modal/components/instruction-modal-create/instruction-modal-create.component.mjs +40 -0
  25. package/esm2022/widgets/utility-modal/components/readonly-criterion-modal/index.mjs +2 -0
  26. package/esm2022/widgets/utility-modal/components/readonly-criterion-modal/readonly-criterion-modal.component.mjs +40 -0
  27. package/esm2022/widgets/utility-modal/components/readonly-instruction-modal/index.mjs +2 -0
  28. package/esm2022/widgets/utility-modal/components/readonly-instruction-modal/readonly-instruction-modal.component.mjs +40 -0
  29. package/esm2022/widgets/utility-modal/components/readonly-utility-modal/index.mjs +2 -0
  30. package/esm2022/widgets/utility-modal/components/readonly-utility-modal/readonly-utility-modal.component.mjs +42 -0
  31. package/esm2022/widgets/utility-modal/components/utility-modal-create/index.mjs +2 -0
  32. package/esm2022/widgets/utility-modal/components/utility-modal-create/utility-modal-create.component.mjs +55 -0
  33. package/esm2022/widgets/utility-modal/index.mjs +4 -0
  34. package/esm2022/widgets/utility-modal/utility-modal.component.mjs +22 -0
  35. package/esm2022/widgets/utility-modal/utility-modal.options.mjs +3 -0
  36. package/esm2022/widgets/utility-readonly-thumbnail/index.mjs +2 -0
  37. package/esm2022/widgets/utility-readonly-thumbnail/utility-readonly-thumbnail.component.mjs +15 -0
  38. package/esm2022/widgets/utility-thumbnail/index.mjs +2 -0
  39. package/esm2022/widgets/utility-thumbnail/utility-thumbnail.component.mjs +94 -0
  40. package/fesm2022/cuby-ui-core.mjs +982 -235
  41. package/fesm2022/cuby-ui-core.mjs.map +1 -1
  42. package/interfaces/image.d.ts +5 -0
  43. package/interfaces/index.d.ts +1 -0
  44. package/package.json +4 -4
  45. package/widgets/categories/components/category-item/category-item.component.d.ts +2 -2
  46. package/widgets/criterion-info/criterion-info.component.d.ts +43 -0
  47. package/widgets/criterion-info/index.d.ts +1 -0
  48. package/widgets/criterion-info-form/criterion-info-form.component.d.ts +39 -0
  49. package/widgets/criterion-info-form/criterion-info-form.options.d.ts +7 -0
  50. package/widgets/criterion-info-form/index.d.ts +2 -0
  51. package/widgets/criterion-readonly-info/criterion-readonly-info.component.d.ts +26 -0
  52. package/widgets/criterion-readonly-info/index.d.ts +1 -0
  53. package/widgets/index.d.ts +5 -1
  54. package/widgets/instruction-info/index.d.ts +1 -0
  55. package/widgets/instruction-info/instruction-info.component.d.ts +45 -0
  56. package/widgets/instruction-info-form/index.d.ts +2 -0
  57. package/widgets/{utility-info/utility-info.component.d.ts → instruction-info-form/instruction-info-form.component.d.ts} +12 -23
  58. package/widgets/{utility-info/utility-info.options.d.ts → instruction-info-form/instruction-info-form.options.d.ts} +3 -3
  59. package/widgets/instruction-readonly-info/index.d.ts +1 -0
  60. package/widgets/instruction-readonly-info/instruction-readonly-info.component.d.ts +26 -0
  61. package/widgets/utility-modal/components/criterion-modal-create/criterion-modal-create.component.d.ts +18 -0
  62. package/widgets/utility-modal/components/criterion-modal-create/index.d.ts +1 -0
  63. package/widgets/utility-modal/components/index.d.ts +4 -0
  64. package/widgets/utility-modal/components/instruction-modal-create/index.d.ts +1 -0
  65. package/widgets/utility-modal/components/instruction-modal-create/instruction-modal-create.component.d.ts +18 -0
  66. package/widgets/utility-modal/components/readonly-criterion-modal/index.d.ts +1 -0
  67. package/widgets/utility-modal/components/readonly-criterion-modal/readonly-criterion-modal.component.d.ts +16 -0
  68. package/widgets/utility-modal/components/readonly-instruction-modal/index.d.ts +1 -0
  69. package/widgets/utility-modal/components/readonly-instruction-modal/readonly-instruction-modal.component.d.ts +16 -0
  70. package/widgets/utility-modal/components/readonly-utility-modal/index.d.ts +1 -0
  71. package/widgets/utility-modal/components/readonly-utility-modal/readonly-utility-modal.component.d.ts +18 -0
  72. package/widgets/utility-modal/components/utility-modal-create/index.d.ts +1 -0
  73. package/widgets/utility-modal/components/utility-modal-create/utility-modal-create.component.d.ts +25 -0
  74. package/widgets/utility-modal/index.d.ts +3 -0
  75. package/widgets/utility-modal/utility-modal.component.d.ts +10 -0
  76. package/widgets/utility-modal/utility-modal.options.d.ts +12 -0
  77. package/widgets/utility-readonly-thumbnail/index.d.ts +1 -0
  78. package/widgets/utility-readonly-thumbnail/utility-readonly-thumbnail.component.d.ts +8 -0
  79. package/widgets/utility-thumbnail/index.d.ts +1 -0
  80. package/widgets/utility-thumbnail/utility-thumbnail.component.d.ts +21 -0
  81. package/esm2022/widgets/utility-info/index.mjs +0 -2
  82. package/esm2022/widgets/utility-info/utility-info.component.mjs +0 -249
  83. package/esm2022/widgets/utility-info/utility-info.options.mjs +0 -2
  84. package/widgets/utility-info/index.d.ts +0 -2
@@ -1,15 +1,15 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ChangeDetectionStrategy, inject, Renderer2, input, model, effect, Directive, InjectionToken, Input, HostBinding, ChangeDetectorRef, ElementRef, ViewChild, EventEmitter, Output, NgModule, Injector, Injectable, SkipSelf, Optional, DestroyRef, NgZone, signal, TemplateRef, ContentChildren, HostListener, Self, INJECTOR, forwardRef, ViewContainerRef, booleanAttribute, computed, Pipe, APP_INITIALIZER, viewChild, afterRender, output, makeEnvironmentProviders } from '@angular/core';
2
+ import { Component, ChangeDetectionStrategy, inject, Renderer2, input, model, effect, Directive, InjectionToken, Input, HostBinding, ChangeDetectorRef, ElementRef, ViewChild, EventEmitter, Output, NgModule, Injector, Injectable, SkipSelf, Optional, DestroyRef, NgZone, signal, TemplateRef, ContentChildren, HostListener, Self, INJECTOR, forwardRef, ViewContainerRef, booleanAttribute, computed, Pipe, APP_INITIALIZER, viewChild, afterRender, output, makeEnvironmentProviders, untracked } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
4
  import { CommonModule, DOCUMENT, NgForOf, NgIf, NgComponentOutlet, NgTemplateOutlet, NgFor, UpperCasePipe, NgClass, Location } from '@angular/common';
5
5
  import * as i1$1 from '@cuby-ui/cdk';
6
- import { CUI_WINDOW, cuiCreateToken, cuiCreateTokenFromFactory, CuiDestroyService, CuiFilterPipe, CuiLetDirective, CuiPopoverService, cuiProvide, CUI_ANIMATION_FRAME, cuiZonefree, EMPTY_CLIENT_RECT, cuiInjectElement, CUI_LOCAL_STORAGE, CUI_IS_WEBKIT, CuiItemDirective, CuiActiveZone, CuiFocusTrapDirective, cuiGetElementObscures, CUI_IS_MOBILE, CuiHoveredService, cuiPure, cuiPointToClientRect, cuiClamp, cuiPx, cuiIfMap, cuiIsPresent, cuiTypedFromEvent, cuiZonefreeScheduler, cuiZoneOptimized, cuiIsNativeFocused, CuiClickOutsideDirective, CuiTargetDirective, cuiGetClosestFocusable, CuiTime, CuiDimensionsObserverDirective, CuiAutoResizingDirective, CuiIdService, CuiElementDirective, CuiDragPointerDirective, CuiDragDropDirective, CuiDragListDirective, CuiHandleScrollDirective } from '@cuby-ui/cdk';
6
+ import { CUI_WINDOW, cuiCreateToken, cuiCreateTokenFromFactory, CuiDestroyService, CuiFilterPipe, CuiLetDirective, CuiPopoverService, cuiProvide, CUI_ANIMATION_FRAME, cuiZonefree, EMPTY_CLIENT_RECT, cuiInjectElement, CUI_LOCAL_STORAGE, CUI_IS_WEBKIT, CuiItemDirective, CuiActiveZone, CuiFocusTrapDirective, cuiGetElementObscures, CUI_IS_MOBILE, CuiHoveredService, cuiPure, cuiPointToClientRect, cuiClamp, cuiPx, cuiIfMap, cuiIsPresent, cuiTypedFromEvent, cuiZonefreeScheduler, cuiZoneOptimized, cuiIsNativeFocused, CuiClickOutsideDirective, CuiTargetDirective, cuiGetClosestFocusable, CuiTime, CuiDimensionsObserverDirective, CuiAutoResizingDirective, CuiIdService, CuiElementDirective, CuiDragPointerDirective, CuiDragDropDirective, CuiDragListDirective, CuiHandleScrollDirective, FilesUploader, takeCaptureFromVideo } from '@cuby-ui/cdk';
7
7
  import { DomSanitizer } from '@angular/platform-browser';
8
8
  import { cuiIsIcon, CUI_ICONS } from '@cuby-ui/icons';
9
- import { BehaviorSubject, takeUntil, Observable, merge, distinctUntilChanged, startWith, map, finalize, switchMap, tap, catchError, throwError, of, from, filter, timer, Subject, delay, repeat, takeWhile, fromEvent, debounce, skip, take, forkJoin, throttleTime, concatMap, toArray, pairwise, debounceTime } from 'rxjs';
9
+ import { BehaviorSubject, takeUntil, Observable, merge, distinctUntilChanged, startWith, map, finalize, switchMap, tap, catchError, throwError, of, from, filter, timer, Subject, delay, repeat, takeWhile, fromEvent, debounce, skip, take, forkJoin, throttleTime, concatMap, toArray, debounceTime, pairwise } from 'rxjs';
10
10
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
11
11
  import { OAuthService, OAuthErrorEvent, OAuthSuccessEvent, OAuthInfoEvent, provideOAuthClient } from 'angular-oauth2-oidc';
12
- import { CuiExchangeContextApiService, CuiTreeStructNavigatorApiService, CuiFrameApiService, CuiNodeChecklistApiService, CuiTreeStructApiService } from '@cuby-ui/api';
12
+ import { CuiExchangeContextApiService, CuiTreeStructNavigatorApiService, CuiNodeChecklistApiService, CuiTreeStructApiService, CuiFrameApiService } from '@cuby-ui/api';
13
13
  import { trigger, transition, query, animateChild, style, animate, stagger } from '@angular/animations';
14
14
  import * as i2 from '@taiga-ui/polymorpheus';
15
15
  import { PolymorpheusOutlet, PolymorpheusTemplate, PolymorpheusComponent, injectContext } from '@taiga-ui/polymorpheus';
@@ -22,7 +22,7 @@ import { MaskitoDirective } from '@maskito/angular';
22
22
  import EditorJS from '@editorjs/editorjs';
23
23
  import Header from '@editorjs/header';
24
24
  import List from '@editorjs/list';
25
- import * as i2$2 from '@jsverse/transloco';
25
+ import * as i4 from '@jsverse/transloco';
26
26
  import { TranslocoDirective, TranslocoService, TranslocoModule } from '@jsverse/transloco';
27
27
  import { HttpClient, HttpErrorResponse } from '@angular/common/http';
28
28
  import { createCustomElement } from '@angular/elements';
@@ -7792,7 +7792,7 @@ class CuiDeleteModalComponent {
7792
7792
  this.context.completeWith({ canceled: true });
7793
7793
  }
7794
7794
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiDeleteModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7795
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: CuiDeleteModalComponent, isStandalone: true, selector: "cui-delete-modal", ngImport: i0, template: "<div\r\n *transloco=\"let t\"\r\n class=\"wrapper\"\r\n>\r\n <div class=\"content\">\r\n <div class=\"header\">\r\n <h3 class=\"title\">{{ t(title) }}</h3>\r\n <button\r\n type=\"button\"\r\n cuiButton\r\n icon=\"cuiIconX\"\r\n appearance=\"ghost\"\r\n [disabled]=\"isLoading()\"\r\n class=\"close-btn\"\r\n (click)=\"onCancel()\"\r\n ></button>\r\n </div>\r\n <div class=\"info\">\r\n @for (text of content; track text) {\r\n <p [innerHTML]=\"t(text)\"></p>\r\n }\r\n </div>\r\n </div>\r\n\r\n <div class=\"footer\">\r\n <button\r\n type=\"button\"\r\n cuiButton\r\n (click)=\"onCancel()\"\r\n [disabled]=\"isLoading()\"\r\n appearance=\"secondary\"\r\n >\r\n {{ t('CANCEL') }}\r\n </button>\r\n <button\r\n type=\"button\"\r\n cuiButton\r\n [isLoaderShown]=\"isLoading()\"\r\n [disabled]=\"isDisabled\"\r\n [cuiTooltip]=\"isDisabled && t('IN_DEVELOPMENT')\"\r\n appearance=\"destructive\"\r\n (click)=\"onDelete()\"\r\n >\r\n {{ t('YES_DELETE') }}\r\n </button>\r\n </div>\r\n</div>\r\n", styles: [".wrapper{display:flex;flex-direction:column;gap:24px;padding:23px;border-radius:12px;width:400px}.header{display:flex;gap:8px;justify-content:space-between}.content{display:flex;flex-direction:column;gap:12px}.title{font-weight:500;font-size:18px;line-height:28px}.info{display:flex;flex-direction:column;gap:16px;font-weight:400;font-size:14px;line-height:20px}.footer{display:flex;gap:12px;justify-content:flex-end}.close-btn{margin:-8px}\n"], dependencies: [{ kind: "ngmodule", type: CuiButtonModule }, { kind: "component", type: CuiButtonComponent, selector: "button[cuiButton], a[cuiButton]", inputs: ["shape", "disabled", "isLoaderShown", "icon", "iconRight", "appearance", "size"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "directive", type: i2$2.TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "directive", type: CuiTooltipDirective, selector: "[cuiTooltip]:not(ng-container):not(ng-template)", inputs: ["cuiTooltipContext", "cuiTooltipAppearance", "cuiTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
7795
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: CuiDeleteModalComponent, isStandalone: true, selector: "cui-delete-modal", ngImport: i0, template: "<div\r\n *transloco=\"let t\"\r\n class=\"wrapper\"\r\n>\r\n <div class=\"content\">\r\n <div class=\"header\">\r\n <h3 class=\"title\">{{ t(title) }}</h3>\r\n <button\r\n type=\"button\"\r\n cuiButton\r\n icon=\"cuiIconX\"\r\n appearance=\"ghost\"\r\n [disabled]=\"isLoading()\"\r\n class=\"close-btn\"\r\n (click)=\"onCancel()\"\r\n ></button>\r\n </div>\r\n <div class=\"info\">\r\n @for (text of content; track text) {\r\n <p [innerHTML]=\"t(text)\"></p>\r\n }\r\n </div>\r\n </div>\r\n\r\n <div class=\"footer\">\r\n <button\r\n type=\"button\"\r\n cuiButton\r\n (click)=\"onCancel()\"\r\n [disabled]=\"isLoading()\"\r\n appearance=\"secondary\"\r\n >\r\n {{ t('CANCEL') }}\r\n </button>\r\n <button\r\n type=\"button\"\r\n cuiButton\r\n [isLoaderShown]=\"isLoading()\"\r\n [disabled]=\"isDisabled\"\r\n [cuiTooltip]=\"isDisabled && t('IN_DEVELOPMENT')\"\r\n appearance=\"destructive\"\r\n (click)=\"onDelete()\"\r\n >\r\n {{ t('YES_DELETE') }}\r\n </button>\r\n </div>\r\n</div>\r\n", styles: [".wrapper{display:flex;flex-direction:column;gap:24px;padding:23px;border-radius:12px;width:400px}.header{display:flex;gap:8px;justify-content:space-between}.content{display:flex;flex-direction:column;gap:12px}.title{font-weight:500;font-size:18px;line-height:28px}.info{display:flex;flex-direction:column;gap:16px;font-weight:400;font-size:14px;line-height:20px}.footer{display:flex;gap:12px;justify-content:flex-end}.close-btn{margin:-8px}\n"], dependencies: [{ kind: "ngmodule", type: CuiButtonModule }, { kind: "component", type: CuiButtonComponent, selector: "button[cuiButton], a[cuiButton]", inputs: ["shape", "disabled", "isLoaderShown", "icon", "iconRight", "appearance", "size"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "directive", type: i4.TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "directive", type: CuiTooltipDirective, selector: "[cuiTooltip]:not(ng-container):not(ng-template)", inputs: ["cuiTooltipContext", "cuiTooltipAppearance", "cuiTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
7796
7796
  }
7797
7797
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiDeleteModalComponent, decorators: [{
7798
7798
  type: Component,
@@ -8129,234 +8129,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8129
8129
  ], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<button\r\n [attr.id]=\"buttonId()\"\r\n #dropdown=\"cuiDropdown\"\r\n [cuiDropdown]=\"dropdownContent\"\r\n orientation=\"stretch\"\r\n type=\"button\"\r\n class=\"target\"\r\n [disabled]=\"disabled()\"\r\n (click)=\"onOpenStageStorages()\"\r\n>\r\n <ng-content />\r\n</button>\r\n\r\n<ng-template #dropdownContent>\r\n <cui-dropdown-wrapper\r\n *transloco=\"let t\"\r\n [title]=\"t('SELECT_OR_CREATE_CATEGORY')\"\r\n width=\"100%\"\r\n class=\"dropdown-wrapper\"\r\n >\r\n <ng-container *cuiLet=\"stageStorages() as stageStorages\">\r\n @if (stageStorages && stageStorages?.length) {\r\n <cui-categories-list [stageStorages]=\"stageStorages\" />\r\n }\r\n @if (isCreateCategoryControlVisible()) {\r\n <cui-create-category-item\r\n class=\"create-category\"\r\n [isDisabled]=\"isCategoryCreationLoading()\"\r\n (created)=\"onCreateNewCategory($event)\"\r\n (canceled)=\"onCreatingCategoryCanceled()\"\r\n />\r\n } @else if (!stageStorages?.length) {\r\n <cui-empty-state\r\n class=\"empty\"\r\n [subtitle]=\"t('NO_CATEGORY_TO_VIEW_YET')\"\r\n />\r\n }\r\n </ng-container>\r\n <button\r\n ccDropdownFooterContent\r\n cuiButton\r\n type=\"button\"\r\n appearance=\"ghost\"\r\n size=\"xxs\"\r\n icon=\"cuiIconPlus\"\r\n (click)=\"onStartCreatingNewCategory()\"\r\n >\r\n {{ t('NEW_CATEGORY') }}\r\n </button>\r\n </cui-dropdown-wrapper>\r\n</ng-template>\r\n", styles: ["::ng-deep .dropdown-wrapper .scrollable-content{flex:1;display:flex;flex-direction:column}.target{display:block;padding:0;width:100%;border-radius:8px;border:1px solid transparent}.target:focus{box-shadow:0 0 0 2px var(--cui-focus);border:1px solid var(--cui-info)}.target:disabled{cursor:default}.create-category{margin-left:24px}.empty{margin:auto}.dropdown-wrapper{display:block;height:350px}\n"] }]
8130
8130
  }], ctorParameters: () => [] });
8131
8131
 
8132
- class CuiUtilityInfoComponent {
8133
- get controls() {
8134
- return this.form.controls;
8135
- }
8136
- get isTitleError() {
8137
- return this.controls.title.invalid && this.controls.title.dirty;
8138
- }
8139
- get isDescriptionError() {
8140
- return this.controls.description.invalid && this.controls.description.dirty;
8141
- }
8142
- constructor() {
8143
- this.destroy = inject(DestroyRef);
8144
- this.formBuilder = inject(NonNullableFormBuilder);
8145
- this.translocoService = inject(TranslocoService);
8146
- this.frameApiService = inject(CuiFrameApiService);
8147
- this.cuiAlertService = inject(CuiAlertService);
8148
- this.cuiIdService = inject(CuiIdService);
8149
- this.CONTROL_DELAY = 500;
8150
- this.MAX_FILE_SIZE = 20971520;
8151
- this.titleId = this.cuiIdService.generate();
8152
- this.descriptionId = this.cuiIdService.generate();
8153
- this.form = this.formBuilder.group({
8154
- title: this.formBuilder.control('', cuiCreateDefaultValidators({ asyncDelay: this.CONTROL_DELAY })),
8155
- description: this.formBuilder.control('', cuiCreateDefaultValidators({ asyncDelay: this.CONTROL_DELAY }))
8156
- });
8157
- this.isDescriptionModalOpen = signal(false);
8158
- this.isDescriptionEmpty = signal(false);
8159
- this.editorId = signal(null);
8160
- this.thumbnail = signal(null);
8161
- this.thumbnailUrl = computed(() => {
8162
- const thumbnail = this.thumbnail();
8163
- if (thumbnail?.resource) {
8164
- return thumbnail.resource;
8165
- }
8166
- return this.baseResourceUrl() + thumbnail.fileId;
8167
- });
8168
- this.uploadButtonName = computed(() => {
8169
- const thumbnail = this.thumbnail();
8170
- if (thumbnail?.name) {
8171
- return this.translocoService.translate('REPLACE_FILE');
8172
- }
8173
- return this.translocoService.translate('UPLOAD_FILE');
8174
- });
8175
- this.heading = null;
8176
- this.title = input.required();
8177
- this.description = input.required();
8178
- this.framerId = input.required();
8179
- this.baseResourceUrl = input.required();
8180
- this.config = input.required();
8181
- this.formChanged = output();
8182
- this.isFormValidChanged = output();
8183
- this.initUtilityEffect();
8184
- }
8185
- onSelectFile() {
8186
- const input = document.createElement('input');
8187
- input.type = 'file';
8188
- input.accept = 'image/jpg, image/jpeg, image/png, video/mp4';
8189
- input.onchange = () => {
8190
- const files = input.files;
8191
- if (!files?.length) {
8192
- return;
8193
- }
8194
- this.getFile(files);
8195
- };
8196
- input.click();
8197
- }
8198
- onEditorEmpty(isEmpty) {
8199
- this.isDescriptionEmpty.set(isEmpty);
8200
- this.isFormValidChanged.emit(this.checkFormValidation());
8201
- }
8202
- onRemoveThumbnail() {
8203
- const frameId = this.framerId();
8204
- const fragmentId = this.thumbnail()?.id;
8205
- if (!frameId || !fragmentId) {
8206
- return;
8207
- }
8208
- this.frameApiService.deleteResource(frameId, fragmentId).subscribe(() => {
8209
- this.thumbnail.update((prev) => ({ ...prev, fileId: null, name: null, resource: null }));
8210
- });
8211
- }
8212
- onToggleDescriptionModal() {
8213
- this.isDescriptionModalOpen.update((prev) => !prev);
8214
- }
8215
- initUtilityEffect() {
8216
- const effectRef = effect(() => {
8217
- const title = this.title();
8218
- if (!title) {
8219
- return;
8220
- }
8221
- this.initFormSubscriptions();
8222
- this.initFrameFragments();
8223
- effectRef.destroy();
8224
- });
8225
- }
8226
- initFormSubscriptions() {
8227
- this.form.setValue({ title: this.title(), description: this.description() }, { emitEvent: false });
8228
- this.form.statusChanges
8229
- .pipe(takeUntilDestroyed(this.destroy))
8230
- .subscribe(() => this.isFormValidChanged.emit(this.checkFormValidation()));
8231
- this.form.valueChanges
8232
- .pipe(takeUntilDestroyed(this.destroy), startWith(this.form.value), pairwise(), debounceTime(this.CONTROL_DELAY), map(([prev, current]) => this.compareFormValues([prev, current])))
8233
- .subscribe((value) => {
8234
- if (!Object.keys(value).length) {
8235
- return;
8236
- }
8237
- this.formChanged.emit(value);
8238
- });
8239
- }
8240
- initFrameFragments() {
8241
- const frameId = this.framerId();
8242
- if (!frameId) {
8243
- return;
8244
- }
8245
- this.frameApiService.getFrame(frameId).subscribe((frame) => {
8246
- frame.fragments.forEach((fragment) => {
8247
- if (fragment.type === "J_TEXT" /* FragmentType.jText */) {
8248
- this.editorId.set(fragment?.id);
8249
- }
8250
- if (fragment.type === "RESOURCE_FILE" /* FragmentType.resourceFile */) {
8251
- this.setResourceFile(fragment);
8252
- }
8253
- });
8254
- });
8255
- }
8256
- compareFormValues([prevGroup, currentGruop]) {
8257
- const keys = Object.keys(currentGruop);
8258
- const changedFields = {};
8259
- keys.forEach((key) => {
8260
- const prev = prevGroup[key];
8261
- const current = currentGruop[key];
8262
- if (prev === current || this.controls[key].invalid) {
8263
- return;
8264
- }
8265
- changedFields[key] = current;
8266
- });
8267
- return changedFields;
8268
- }
8269
- setResourceFile(resource) {
8270
- const url = this.baseResourceUrl() + resource.fileId;
8271
- this.thumbnail.set(resource);
8272
- if (!url || resource?.name?.split('.').pop() !== 'mp4') {
8273
- return;
8274
- }
8275
- this.getCaptureFromVideo(url);
8276
- }
8277
- getFile(files) {
8278
- const file = files.item(0);
8279
- if (!file) {
8280
- return;
8281
- }
8282
- if (file.size > this.MAX_FILE_SIZE) {
8283
- this.cuiAlertService
8284
- .open(this.translocoService.translate('INVALID_FILE_SIZE'), {
8285
- status: 'error'
8286
- })
8287
- .subscribe();
8288
- return;
8289
- }
8290
- const isVideo = file.name.split('.').at(-1) === 'mp4';
8291
- const url = URL.createObjectURL(file);
8292
- if (isVideo) {
8293
- this.getCaptureFromVideo(url, file);
8294
- }
8295
- else {
8296
- this.thumbnail.update((prev) => ({ ...prev, name: file.name, resource: url }));
8297
- }
8298
- this.uploadFile(file);
8299
- }
8300
- uploadFile(file) {
8301
- const frameId = this.framerId();
8302
- const fragmentId = this.thumbnail()?.id;
8303
- if (!frameId || !fragmentId) {
8304
- return;
8305
- }
8306
- const formData = new FormData();
8307
- formData.append('resource', file);
8308
- this.frameApiService.uploadResource(formData, frameId, fragmentId).subscribe();
8309
- }
8310
- getCaptureFromVideo(url, file) {
8311
- const canvas = document.createElement('canvas');
8312
- const video = document.createElement('video');
8313
- video.src = url;
8314
- video.currentTime = 1;
8315
- canvas.width = 184;
8316
- canvas.height = 120;
8317
- video.onloadeddata = () => {
8318
- const context = canvas.getContext('2d');
8319
- if (!context) {
8320
- return;
8321
- }
8322
- context.drawImage(video, 0, 0, canvas.width, canvas.height);
8323
- canvas.toBlob((blob) => {
8324
- if (!blob) {
8325
- return;
8326
- }
8327
- const videoCaptureUrl = URL.createObjectURL(blob);
8328
- this.thumbnail.update((prev) => ({
8329
- ...prev,
8330
- name: (file?.name || prev?.name),
8331
- resource: videoCaptureUrl
8332
- }));
8333
- });
8334
- };
8335
- video.load();
8336
- }
8337
- checkFormValidation() {
8338
- return !this.isDescriptionEmpty() && !this.form.invalid;
8339
- }
8340
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiUtilityInfoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8341
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: CuiUtilityInfoComponent, isStandalone: true, selector: "cui-utility-info", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: true, transformFunction: null }, framerId: { classPropertyName: "framerId", publicName: "framerId", isSignal: true, isRequired: true, transformFunction: null }, baseResourceUrl: { classPropertyName: "baseResourceUrl", publicName: "baseResourceUrl", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { formChanged: "formChanged", isFormValidChanged: "isFormValidChanged" }, ngImport: i0, template: "<ng-container *transloco=\"let t\">\r\n <section class=\"content\">\r\n <cui-form-field>\r\n <label cuiLabel [isRequired]=\"true\" [for]=\"titleId\">\r\n {{ t('TITLE') }}\r\n </label>\r\n <cui-input-text\r\n [cuiTextFieldId]=\"titleId\"\r\n [cuiTextFieldPlaceholder]=\"t('ADD_A_TITLE')\"\r\n [cuiTextFieldIsError]=\"isTitleError\"\r\n [formControl]=\"form.controls.title\"\r\n />\r\n @if (isTitleError) {\r\n <cui-general-control-error-hint [control]=\"form.controls.title\" [isVisible]=\"true\" />\r\n }\r\n </cui-form-field>\r\n <cui-form-field>\r\n <label cuiLabel [isRequired]=\"true\" [for]=\"descriptionId\">\r\n {{ t('SHORT_DESCRIPTION') }}\r\n </label>\r\n <cui-input-text\r\n [cuiTextFieldId]=\"descriptionId\"\r\n cuiTextFieldPlaceholder=\"{{t('SHORT_DESCRIPTION')}}...\"\r\n [cuiTextFieldIsError]=\"isDescriptionError\"\r\n [formControl]=\"form.controls.description\"\r\n />\r\n @if (isDescriptionError) {\r\n <cui-general-control-error-hint [control]=\"form.controls.description\" [isVisible]=\"true\" />\r\n }\r\n </cui-form-field>\r\n <section class=\"file\">\r\n <span class=\"title\">{{ t('THUMBNAIL') }}</span>\r\n <div class=\"content__upload\">\r\n <div class=\"content__upload-file\">\r\n @if (thumbnail()?.name; as fileId) {\r\n <div class=\"image\">\r\n <span class=\"image__name\">{{ thumbnail()?.name }}</span>\r\n <!-- TODO: ngSrc -->\r\n <img class=\"image__view\" [src]=\"thumbnailUrl()\" height=\"120\" width=\"184\" alt=\"Thumbnail\" />\r\n </div>\r\n }\r\n <div class=\"content__info\">\r\n <button type=\"button\" cuiButton appearance=\"outlined-gray\" size=\"xxs\" icon=\"cuiIconUpload\"\r\n (click)=\"onSelectFile()\">\r\n {{ uploadButtonName() }}\r\n </button>\r\n @if (thumbnail()?.name) {\r\n <button class=\"content__remove-button\" cuiButton appearance=\"link\" size=\"sm\" type=\"button\"\r\n (click)=\"onRemoveThumbnail()\">\r\n {{ t('REMOVE') }}\r\n </button>\r\n }\r\n\r\n <span class=\"content__accepted\">\r\n {{ t('ACCEPTED') }}: JPG, JPEG, PNG, MP4 {{ t('UP_TO') }} 20MB\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n </section>\r\n @if (editorId(); as editorId) {\r\n <cui-editor-block\r\n [title]=\"form.controls.title.value || title()\"\r\n [config]=\"config()\"\r\n [editorId]=\"editorId\"\r\n [required]=\"true\"\r\n class=\"editor\"\r\n (editorEmpty)=\"onEditorEmpty($event)\"\r\n ></cui-editor-block>\r\n }\r\n </section>\r\n</ng-container>\r\n", styles: ["::ng-deep cui-dialog:has(.instruction-description-modal){inset:0;margin:auto;transform:none!important}:host{--editor-height: 650px;display:block}:host .editor{--max-editor-height: var(--editor-height)}.title{font-weight:500;font-size:14px;line-height:20px;display:flex;gap:2px}.title_required{color:var(--cui-danger)}.content{display:flex;flex-direction:column;gap:16px;padding:16px 24px}.content__upload{padding:12px 16px;border-radius:8px;border:1px solid var(--cui-base-200);background:var(--cui-base-10)}.content__info{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.content__accepted{color:var(--cui-base-500)}.content__upload-file{display:flex;align-items:center;gap:8px}.content__upload-file input[type=file]{display:none}.content__remove-button ::ng-deep .c-content{color:var(--cui-danger)!important}.file{display:flex;flex-direction:column;gap:4px}.description_invalid{border:1px solid var(--cui-danger)}.image{position:relative;display:inline-block}.image__view{border-radius:8px;object-fit:cover}.image__name{position:absolute;top:6px;left:14px;color:var(--cui-base-0);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:170px;z-index:1}.image:after{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#0003;z-index:0;pointer-events:none;border-radius:8px}.button-save{margin-left:auto}.instruction-description-modal{text-transform:none}.empty{padding:16px;color:var(--cui-base-500);text-align:center}\n"], dependencies: [{ kind: "ngmodule", type: i0.forwardRef(() => CuiAccordionModule) }, { kind: "ngmodule", type: i0.forwardRef(() => CuiButtonModule) }, { kind: "component", type: i0.forwardRef(() => CuiButtonComponent), selector: "button[cuiButton], a[cuiButton]", inputs: ["shape", "disabled", "isLoaderShown", "icon", "iconRight", "appearance", "size"] }, { kind: "ngmodule", type: i0.forwardRef(() => CuiFormFieldModule) }, { kind: "component", type: i0.forwardRef(() => CuiFormFieldComponent), selector: "cui-form-field" }, { kind: "ngmodule", type: i0.forwardRef(() => CuiHintModule) }, { kind: "ngmodule", type: i0.forwardRef(() => CuiInputModule) }, { kind: "component", type: i0.forwardRef(() => CuiInputTextComponent), selector: "cui-input-text" }, { kind: "directive", type: i0.forwardRef(() => CuiTextFieldIdDirective), selector: "[cuiTextFieldId]", inputs: ["cuiTextFieldId"] }, { kind: "directive", type: i0.forwardRef(() => CuiTextFieldPlaceholderDirective), selector: "[cuiTextFieldPlaceholder]", inputs: ["cuiTextFieldPlaceholder"] }, { kind: "directive", type: i0.forwardRef(() => CuiTextFieldIsErrorDirective), selector: "[cuiTextFieldIsError]", inputs: ["cuiTextFieldIsError"] }, { kind: "ngmodule", type: i0.forwardRef(() => CuiLabelModule) }, { kind: "component", type: i0.forwardRef(() => CuiLabelComponent), selector: "label[cuiLabel]", inputs: ["isRequired"] }, { kind: "component", type: i0.forwardRef(() => CuiEditorBlockComponent), selector: "cui-editor-block", inputs: ["title", "editorId", "config", "required"], outputs: ["editorEmpty"] }, { kind: "component", type: i0.forwardRef(() => CuiGeneralControlErrorHintComponent), selector: "cui-general-control-error-hint", inputs: ["control", "isVisible"] }, { kind: "ngmodule", type: i0.forwardRef(() => ReactiveFormsModule) }, { kind: "directive", type: i0.forwardRef(() => i2$1.NgControlStatus), selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i0.forwardRef(() => i2$1.FormControlDirective), selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i0.forwardRef(() => TranslocoDirective), selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8342
- }
8343
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiUtilityInfoComponent, decorators: [{
8344
- type: Component,
8345
- args: [{ selector: 'cui-utility-info', imports: [
8346
- CuiAccordionModule,
8347
- CuiButtonModule,
8348
- CuiFormFieldModule,
8349
- CuiHintModule,
8350
- CuiInputModule,
8351
- CuiLabelModule,
8352
- forwardRef(() => CuiEditorBlockComponent),
8353
- CuiGeneralControlErrorHintComponent,
8354
- ReactiveFormsModule,
8355
- TranslocoDirective,
8356
- CuiTooltip
8357
- ], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t\">\r\n <section class=\"content\">\r\n <cui-form-field>\r\n <label cuiLabel [isRequired]=\"true\" [for]=\"titleId\">\r\n {{ t('TITLE') }}\r\n </label>\r\n <cui-input-text\r\n [cuiTextFieldId]=\"titleId\"\r\n [cuiTextFieldPlaceholder]=\"t('ADD_A_TITLE')\"\r\n [cuiTextFieldIsError]=\"isTitleError\"\r\n [formControl]=\"form.controls.title\"\r\n />\r\n @if (isTitleError) {\r\n <cui-general-control-error-hint [control]=\"form.controls.title\" [isVisible]=\"true\" />\r\n }\r\n </cui-form-field>\r\n <cui-form-field>\r\n <label cuiLabel [isRequired]=\"true\" [for]=\"descriptionId\">\r\n {{ t('SHORT_DESCRIPTION') }}\r\n </label>\r\n <cui-input-text\r\n [cuiTextFieldId]=\"descriptionId\"\r\n cuiTextFieldPlaceholder=\"{{t('SHORT_DESCRIPTION')}}...\"\r\n [cuiTextFieldIsError]=\"isDescriptionError\"\r\n [formControl]=\"form.controls.description\"\r\n />\r\n @if (isDescriptionError) {\r\n <cui-general-control-error-hint [control]=\"form.controls.description\" [isVisible]=\"true\" />\r\n }\r\n </cui-form-field>\r\n <section class=\"file\">\r\n <span class=\"title\">{{ t('THUMBNAIL') }}</span>\r\n <div class=\"content__upload\">\r\n <div class=\"content__upload-file\">\r\n @if (thumbnail()?.name; as fileId) {\r\n <div class=\"image\">\r\n <span class=\"image__name\">{{ thumbnail()?.name }}</span>\r\n <!-- TODO: ngSrc -->\r\n <img class=\"image__view\" [src]=\"thumbnailUrl()\" height=\"120\" width=\"184\" alt=\"Thumbnail\" />\r\n </div>\r\n }\r\n <div class=\"content__info\">\r\n <button type=\"button\" cuiButton appearance=\"outlined-gray\" size=\"xxs\" icon=\"cuiIconUpload\"\r\n (click)=\"onSelectFile()\">\r\n {{ uploadButtonName() }}\r\n </button>\r\n @if (thumbnail()?.name) {\r\n <button class=\"content__remove-button\" cuiButton appearance=\"link\" size=\"sm\" type=\"button\"\r\n (click)=\"onRemoveThumbnail()\">\r\n {{ t('REMOVE') }}\r\n </button>\r\n }\r\n\r\n <span class=\"content__accepted\">\r\n {{ t('ACCEPTED') }}: JPG, JPEG, PNG, MP4 {{ t('UP_TO') }} 20MB\r\n </span>\r\n </div>\r\n </div>\r\n </div>\r\n </section>\r\n @if (editorId(); as editorId) {\r\n <cui-editor-block\r\n [title]=\"form.controls.title.value || title()\"\r\n [config]=\"config()\"\r\n [editorId]=\"editorId\"\r\n [required]=\"true\"\r\n class=\"editor\"\r\n (editorEmpty)=\"onEditorEmpty($event)\"\r\n ></cui-editor-block>\r\n }\r\n </section>\r\n</ng-container>\r\n", styles: ["::ng-deep cui-dialog:has(.instruction-description-modal){inset:0;margin:auto;transform:none!important}:host{--editor-height: 650px;display:block}:host .editor{--max-editor-height: var(--editor-height)}.title{font-weight:500;font-size:14px;line-height:20px;display:flex;gap:2px}.title_required{color:var(--cui-danger)}.content{display:flex;flex-direction:column;gap:16px;padding:16px 24px}.content__upload{padding:12px 16px;border-radius:8px;border:1px solid var(--cui-base-200);background:var(--cui-base-10)}.content__info{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.content__accepted{color:var(--cui-base-500)}.content__upload-file{display:flex;align-items:center;gap:8px}.content__upload-file input[type=file]{display:none}.content__remove-button ::ng-deep .c-content{color:var(--cui-danger)!important}.file{display:flex;flex-direction:column;gap:4px}.description_invalid{border:1px solid var(--cui-danger)}.image{position:relative;display:inline-block}.image__view{border-radius:8px;object-fit:cover}.image__name{position:absolute;top:6px;left:14px;color:var(--cui-base-0);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:170px;z-index:1}.image:after{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#0003;z-index:0;pointer-events:none;border-radius:8px}.button-save{margin-left:auto}.instruction-description-modal{text-transform:none}.empty{padding:16px;color:var(--cui-base-500);text-align:center}\n"] }]
8358
- }], ctorParameters: () => [] });
8359
-
8360
8132
  class CuiCheckListBlockService {
8361
8133
  constructor() {
8362
8134
  this.checkListItemsSignal = signal(null);
@@ -9246,9 +9018,984 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
9246
9018
  ], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [CuiCheckListBlockService], template: "<cui-content-wrapper\n *transloco=\"let t\"\n backgroundColor=\"var(--cui-base-10)\"\n [gap]=\"16\"\n>\n <ng-container *cuiLet=\"checkListItems() as checkListItems\">\n <header class=\"header\">\n <h2 class=\"heading\">{{ t('CHECKLIST') }}</h2>\n\n @if (checkListItems) {\n <span class=\"item\">{{ checkListItems?.length }} {{ t('ITEM_VARIANT') }}</span>\n }\n </header>\n <cui-content-wrapper>\n <cui-checklist-block-list [config]=\"config()\" />\n </cui-content-wrapper>\n <div>\n <button\n #actionButton=\"elementRef\"\n cuiElement\n cuiButton\n type=\"button\"\n appearance=\"flat\"\n size=\"xxs\"\n icon=\"cuiIconPlus\"\n >\n {{ t('ADD_NEW_ITEM') }}\n </button>\n <cui-context-menu\n [items]=\"CHECKLIST_BLOCK_SELECT_OPTIONS\"\n [target]=\"actionButton.nativeElement\"\n />\n </div>\n </ng-container>\n</cui-content-wrapper>\n", styles: [".header{display:flex;gap:12px;align-items:center;justify-content:space-between}.heading{font-weight:500;font-size:16px;line-height:24px}.item{font-weight:400;font-size:12px;line-height:14px;color:var(--cui-base-500)}\n"] }]
9247
9019
  }], ctorParameters: () => [] });
9248
9020
 
9021
+ class CuiUtilityReadonlyThumbnailComponent {
9022
+ constructor() {
9023
+ this.thumbnailUrl = input.required();
9024
+ this.isVideo = input(false);
9025
+ }
9026
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiUtilityReadonlyThumbnailComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9027
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: CuiUtilityReadonlyThumbnailComponent, isStandalone: true, selector: "cui-utility-readonly-thumbnail", inputs: { thumbnailUrl: { classPropertyName: "thumbnailUrl", publicName: "thumbnailUrl", isSignal: true, isRequired: true, transformFunction: null }, isVideo: { classPropertyName: "isVideo", publicName: "isVideo", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@let url = thumbnailUrl();\n\n@if (url?.src; as src) {\n @if (isVideo()) {\n <video\n class=\"thumbnail\"\n [src]=\"src\"\n controls\n ></video>\n } @else {\n <img\n class=\"thumbnail\"\n [src]=\"src\"\n [alt]=\"url?.name\"\n />\n }\n}\n", styles: [".thumbnail{width:100%;max-height:271px;object-fit:contain}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9028
+ }
9029
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiUtilityReadonlyThumbnailComponent, decorators: [{
9030
+ type: Component,
9031
+ args: [{ selector: 'cui-utility-readonly-thumbnail', imports: [], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "@let url = thumbnailUrl();\n\n@if (url?.src; as src) {\n @if (isVideo()) {\n <video\n class=\"thumbnail\"\n [src]=\"src\"\n controls\n ></video>\n } @else {\n <img\n class=\"thumbnail\"\n [src]=\"src\"\n [alt]=\"url?.name\"\n />\n }\n}\n", styles: [".thumbnail{width:100%;max-height:271px;object-fit:contain}\n"] }]
9032
+ }] });
9033
+
9034
+ class CuiInstructionReadonlyInfoComponent {
9035
+ constructor() {
9036
+ this.hostElement = inject(ElementRef).nativeElement;
9037
+ this.frameApiService = inject(CuiFrameApiService);
9038
+ this.isVideo = false;
9039
+ this.jText = signal(null);
9040
+ this.thumbnailUrl = signal(null);
9041
+ this.isDescriptionEmpty = computed(() => !this.jText()?.notEmpty);
9042
+ this.framerId = input.required();
9043
+ this.element = input(this.hostElement);
9044
+ this.tools = input.required();
9045
+ this.editorResourceUrl = input.required();
9046
+ this.initConfigEffect();
9047
+ this.initFramerIdEffect();
9048
+ }
9049
+ initConfigEffect() {
9050
+ effect(() => {
9051
+ this.editorConfig = { readOnly: true, tools: this.tools(), element: this.element() };
9052
+ });
9053
+ }
9054
+ initFramerIdEffect() {
9055
+ effect(() => {
9056
+ const framerId = this.framerId();
9057
+ if (!framerId) {
9058
+ return;
9059
+ }
9060
+ this.subscription?.unsubscribe();
9061
+ this.initFrameFragments();
9062
+ });
9063
+ }
9064
+ initFrameFragments() {
9065
+ const frameId = this.framerId();
9066
+ this.jText.set(null);
9067
+ this.thumbnailUrl.set(null);
9068
+ if (!frameId) {
9069
+ return;
9070
+ }
9071
+ const fragmentActions = {
9072
+ ["J_TEXT" /* FragmentType.jText */]: (fragment) => {
9073
+ this.jText.set(fragment);
9074
+ },
9075
+ ["RESOURCE_FILE" /* FragmentType.resourceFile */]: (fragment) => {
9076
+ this.setResourceFile(fragment);
9077
+ }
9078
+ };
9079
+ this.subscription = this.frameApiService.getFrame(frameId).subscribe((frame) => {
9080
+ frame.fragments.forEach((fragment) => fragmentActions[fragment.type](fragment));
9081
+ });
9082
+ }
9083
+ setResourceFile(resource) {
9084
+ const url = `${this.editorResourceUrl()}${resource.fileId}`;
9085
+ this.isVideo = resource?.name?.split('.').pop() === 'mp4';
9086
+ if (!url) {
9087
+ return;
9088
+ }
9089
+ this.thumbnailUrl.set({ src: resource.fileId && url, name: resource.name || resource.type });
9090
+ }
9091
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiInstructionReadonlyInfoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9092
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: CuiInstructionReadonlyInfoComponent, isStandalone: true, selector: "cui-instruction-readonly-info", inputs: { framerId: { classPropertyName: "framerId", publicName: "framerId", isSignal: true, isRequired: true, transformFunction: null }, element: { classPropertyName: "element", publicName: "element", isSignal: true, isRequired: false, transformFunction: null }, tools: { classPropertyName: "tools", publicName: "tools", isSignal: true, isRequired: true, transformFunction: null }, editorResourceUrl: { classPropertyName: "editorResourceUrl", publicName: "editorResourceUrl", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t\">\n @if (jText()) {\n @if (!isDescriptionEmpty()) {\n @if (thumbnailUrl(); as thumbnailUrl) {\n <cui-utility-readonly-thumbnail [thumbnailUrl]=\"thumbnailUrl\" [isVideo]=\"isVideo\" />\n }\n\n @if (jText()?.id; as id) {\n <div class=\"wrapper\">\n <cui-editor\n class=\"editor\"\n [editorApiId]=\"id\"\n [config]=\"editorConfig\"\n />\n </div>\n }\n } @else {\n <cui-empty-state [subtitle]=\"t('NO_DESCRIPTION_WAS_PROVIDED')\" />\n }\n }\n</ng-container>\n", styles: [":host{padding-top:16px;padding-right:16px;padding-left:16px;display:flex;flex-direction:column;gap:12px;height:100%;overflow:auto}.wrapper{padding:12px}.editor{display:block;height:100%;overflow:auto}\n"], dependencies: [{ kind: "component", type: CuiEditorComponent, selector: "cui-editor", inputs: ["editorApiId", "config", "requestSize"], outputs: ["editorEmpty"] }, { kind: "component", type: CuiEmptyStateComponent, selector: "cui-empty-state, [cuiEmptyState]", inputs: ["title", "subtitle"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: CuiUtilityReadonlyThumbnailComponent, selector: "cui-utility-readonly-thumbnail", inputs: ["thumbnailUrl", "isVideo"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9093
+ }
9094
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiInstructionReadonlyInfoComponent, decorators: [{
9095
+ type: Component,
9096
+ args: [{ selector: 'cui-instruction-readonly-info', imports: [CuiEditorComponent, CuiEmptyStateComponent, TranslocoDirective, CuiUtilityReadonlyThumbnailComponent], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t\">\n @if (jText()) {\n @if (!isDescriptionEmpty()) {\n @if (thumbnailUrl(); as thumbnailUrl) {\n <cui-utility-readonly-thumbnail [thumbnailUrl]=\"thumbnailUrl\" [isVideo]=\"isVideo\" />\n }\n\n @if (jText()?.id; as id) {\n <div class=\"wrapper\">\n <cui-editor\n class=\"editor\"\n [editorApiId]=\"id\"\n [config]=\"editorConfig\"\n />\n </div>\n }\n } @else {\n <cui-empty-state [subtitle]=\"t('NO_DESCRIPTION_WAS_PROVIDED')\" />\n }\n }\n</ng-container>\n", styles: [":host{padding-top:16px;padding-right:16px;padding-left:16px;display:flex;flex-direction:column;gap:12px;height:100%;overflow:auto}.wrapper{padding:12px}.editor{display:block;height:100%;overflow:auto}\n"] }]
9097
+ }], ctorParameters: () => [] });
9098
+
9099
+ class CuiCriterionReadonlyInfoComponent {
9100
+ constructor() {
9101
+ this.hostElement = inject(ElementRef).nativeElement;
9102
+ this.frameApiService = inject(CuiFrameApiService);
9103
+ this.isVideo = false;
9104
+ this.jText = signal(null);
9105
+ this.thumbnailUrl = signal(null);
9106
+ this.isDescriptionEmpty = computed(() => !this.jText()?.notEmpty);
9107
+ this.framerId = input.required();
9108
+ this.element = input(this.hostElement);
9109
+ this.tools = input.required();
9110
+ this.editorResourceUrl = input.required();
9111
+ this.initConfigEffect();
9112
+ this.initFramerIdEffect();
9113
+ }
9114
+ initConfigEffect() {
9115
+ effect(() => {
9116
+ this.editorConfig = { readOnly: true, tools: this.tools(), element: this.element() };
9117
+ });
9118
+ }
9119
+ initFramerIdEffect() {
9120
+ effect(() => {
9121
+ const framerId = this.framerId();
9122
+ if (!framerId) {
9123
+ return;
9124
+ }
9125
+ this.subscription?.unsubscribe();
9126
+ this.initFrameFragments();
9127
+ });
9128
+ }
9129
+ initFrameFragments() {
9130
+ const frameId = this.framerId();
9131
+ this.jText.set(null);
9132
+ this.thumbnailUrl.set(null);
9133
+ if (!frameId) {
9134
+ return;
9135
+ }
9136
+ const fragmentActions = {
9137
+ ["J_TEXT" /* FragmentType.jText */]: (fragment) => {
9138
+ this.jText.set(fragment);
9139
+ },
9140
+ ["RESOURCE_FILE" /* FragmentType.resourceFile */]: (fragment) => {
9141
+ this.setResourceFile(fragment);
9142
+ }
9143
+ };
9144
+ this.subscription = this.frameApiService.getFrame(frameId).subscribe((frame) => {
9145
+ frame.fragments.forEach((fragment) => fragmentActions[fragment.type](fragment));
9146
+ });
9147
+ }
9148
+ setResourceFile(resource) {
9149
+ const url = `${this.editorResourceUrl()}${resource.fileId}`;
9150
+ this.isVideo = resource?.name?.split('.').pop() === 'mp4';
9151
+ if (!url) {
9152
+ return;
9153
+ }
9154
+ this.thumbnailUrl.set({ src: resource.fileId && url, name: resource.name || resource.type });
9155
+ }
9156
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiCriterionReadonlyInfoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9157
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: CuiCriterionReadonlyInfoComponent, isStandalone: true, selector: "cui-criterion-readonly-info", inputs: { framerId: { classPropertyName: "framerId", publicName: "framerId", isSignal: true, isRequired: true, transformFunction: null }, element: { classPropertyName: "element", publicName: "element", isSignal: true, isRequired: false, transformFunction: null }, tools: { classPropertyName: "tools", publicName: "tools", isSignal: true, isRequired: true, transformFunction: null }, editorResourceUrl: { classPropertyName: "editorResourceUrl", publicName: "editorResourceUrl", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t\">\n @if (jText()) {\n @if (!isDescriptionEmpty()) {\n @if (thumbnailUrl(); as thumbnailUrl) {\n <cui-utility-readonly-thumbnail [thumbnailUrl]=\"thumbnailUrl\" [isVideo]=\"isVideo\" />\n }\n\n @if (jText()?.id; as id) {\n <div class=\"wrapper\">\n <cui-editor\n class=\"editor\"\n [editorApiId]=\"id\"\n [config]=\"editorConfig\"\n />\n </div>\n }\n } @else {\n <cui-empty-state [subtitle]=\"t('NO_DESCRIPTION_WAS_PROVIDED')\" />\n }\n }\n</ng-container>\n", styles: [":host{padding-top:16px;padding-right:16px;padding-left:16px;display:flex;flex-direction:column;gap:12px;height:100%;overflow:auto}.wrapper{padding:12px}.editor{display:block;height:100%;overflow:auto}\n"], dependencies: [{ kind: "component", type: CuiEditorComponent, selector: "cui-editor", inputs: ["editorApiId", "config", "requestSize"], outputs: ["editorEmpty"] }, { kind: "component", type: CuiEmptyStateComponent, selector: "cui-empty-state, [cuiEmptyState]", inputs: ["title", "subtitle"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: CuiUtilityReadonlyThumbnailComponent, selector: "cui-utility-readonly-thumbnail", inputs: ["thumbnailUrl", "isVideo"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9158
+ }
9159
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiCriterionReadonlyInfoComponent, decorators: [{
9160
+ type: Component,
9161
+ args: [{ selector: 'cui-criterion-readonly-info', imports: [CuiEditorComponent, CuiEmptyStateComponent, TranslocoDirective, CuiUtilityReadonlyThumbnailComponent], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t\">\n @if (jText()) {\n @if (!isDescriptionEmpty()) {\n @if (thumbnailUrl(); as thumbnailUrl) {\n <cui-utility-readonly-thumbnail [thumbnailUrl]=\"thumbnailUrl\" [isVideo]=\"isVideo\" />\n }\n\n @if (jText()?.id; as id) {\n <div class=\"wrapper\">\n <cui-editor\n class=\"editor\"\n [editorApiId]=\"id\"\n [config]=\"editorConfig\"\n />\n </div>\n }\n } @else {\n <cui-empty-state [subtitle]=\"t('NO_DESCRIPTION_WAS_PROVIDED')\" />\n }\n }\n</ng-container>\n", styles: [":host{padding-top:16px;padding-right:16px;padding-left:16px;display:flex;flex-direction:column;gap:12px;height:100%;overflow:auto}.wrapper{padding:12px}.editor{display:block;height:100%;overflow:auto}\n"] }]
9162
+ }], ctorParameters: () => [] });
9163
+
9164
+ class CuiUtilityThumbnailComponent {
9165
+ constructor() {
9166
+ this.cuiAlertService = inject(CuiAlertService);
9167
+ this.translocoService = inject(TranslocoService);
9168
+ this.frameApiService = inject(CuiFrameApiService);
9169
+ this.MAX_FILE_SIZE = 20971520;
9170
+ this.thumbnailUrl = computed(() => {
9171
+ const thumbnail = this.thumbnail();
9172
+ if (thumbnail?.resource) {
9173
+ return thumbnail.resource;
9174
+ }
9175
+ return this.baseResourceUrl() + thumbnail.fileId;
9176
+ });
9177
+ this.uploadButtonName = computed(() => {
9178
+ const thumbnail = this.thumbnail();
9179
+ if (thumbnail?.name) {
9180
+ return this.translocoService.translate('REPLACE_FILE');
9181
+ }
9182
+ return this.translocoService.translate('UPLOAD_FILE');
9183
+ });
9184
+ this.thumbnail = model.required();
9185
+ this.framerId = input.required();
9186
+ this.baseResourceUrl = input.required();
9187
+ }
9188
+ onSelectFile() {
9189
+ const types = 'image/jpg, image/jpeg, image/png, video/mp4';
9190
+ FilesUploader.uploadFile(types).then((files) => this.getFile(files));
9191
+ }
9192
+ onRemoveThumbnail() {
9193
+ const frameId = this.framerId();
9194
+ const fragmentId = this.thumbnail()?.id;
9195
+ if (!frameId || !fragmentId) {
9196
+ return;
9197
+ }
9198
+ this.frameApiService.deleteResource(frameId, fragmentId).subscribe(() => {
9199
+ this.thumbnail.update((prev) => ({ ...prev, fileId: null, name: null, resource: null }));
9200
+ });
9201
+ }
9202
+ getFile(files) {
9203
+ const file = files.item(0);
9204
+ if (!file) {
9205
+ return;
9206
+ }
9207
+ if (file.size > this.MAX_FILE_SIZE) {
9208
+ this.cuiAlertService
9209
+ .open(this.translocoService.translate('INVALID_FILE_SIZE'), {
9210
+ status: 'error'
9211
+ })
9212
+ .subscribe();
9213
+ return;
9214
+ }
9215
+ const isVideo = file.name.split('.').at(-1) === 'mp4';
9216
+ const url = URL.createObjectURL(file);
9217
+ if (isVideo) {
9218
+ this.getCaptureFromVideo(url, file);
9219
+ }
9220
+ else {
9221
+ this.thumbnail.update((prev) => ({ ...prev, name: file.name, resource: url }));
9222
+ }
9223
+ this.uploadFile(file);
9224
+ }
9225
+ uploadFile(file) {
9226
+ const frameId = this.framerId();
9227
+ const fragmentId = this.thumbnail()?.id;
9228
+ if (!frameId || !fragmentId) {
9229
+ return;
9230
+ }
9231
+ const formData = new FormData();
9232
+ formData.append('resource', file);
9233
+ this.frameApiService.uploadResource(formData, frameId, fragmentId).subscribe();
9234
+ }
9235
+ getCaptureFromVideo(url, file) {
9236
+ takeCaptureFromVideo(url).then((capture) => {
9237
+ this.thumbnail.update((prev) => ({
9238
+ ...prev,
9239
+ name: (file?.name || prev?.name),
9240
+ resource: capture
9241
+ }));
9242
+ });
9243
+ }
9244
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiUtilityThumbnailComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9245
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: CuiUtilityThumbnailComponent, isStandalone: true, selector: "cui-utility-thumbnail", inputs: { thumbnail: { classPropertyName: "thumbnail", publicName: "thumbnail", isSignal: true, isRequired: true, transformFunction: null }, framerId: { classPropertyName: "framerId", publicName: "framerId", isSignal: true, isRequired: true, transformFunction: null }, baseResourceUrl: { classPropertyName: "baseResourceUrl", publicName: "baseResourceUrl", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { thumbnail: "thumbnailChange" }, ngImport: i0, template: "<section\n *transloco=\"let t\"\n class=\"file\"\n>\n <span class=\"title\">{{ t('THUMBNAIL') }}</span>\n <div class=\"upload\">\n <div class=\"upload-file\">\n @if (thumbnail()?.name; as fileId) {\n <div class=\"image\">\n <span class=\"image__name\">{{ thumbnail()?.name }}</span>\n <!-- TODO: ngSrc -->\n <img\n class=\"image__view\"\n [src]=\"thumbnailUrl()\"\n height=\"120\"\n width=\"184\"\n alt=\"Thumbnail\"\n />\n </div>\n }\n <div class=\"info\">\n <button\n type=\"button\"\n cuiButton\n appearance=\"outlined-gray\"\n size=\"xxs\"\n icon=\"cuiIconUpload\"\n (click)=\"onSelectFile()\"\n >\n {{ uploadButtonName() }}\n </button>\n @if (thumbnail()?.name) {\n <button\n class=\"remove-button\"\n cuiButton\n appearance=\"link\"\n size=\"sm\"\n type=\"button\"\n (click)=\"onRemoveThumbnail()\"\n >\n {{ t('REMOVE') }}\n </button>\n }\n\n <span class=\"accepted\">{{ t('ACCEPTED') }}: JPG, JPEG, PNG, MP4 {{ t('UP_TO') }} 20MB</span>\n </div>\n </div>\n </div>\n</section>\n", styles: [".file{display:flex;flex-direction:column;gap:4px}.title{font-weight:500;font-size:14px;line-height:20px;display:flex;gap:2px}.title_required{color:var(--cui-danger)}.upload{padding:12px 16px;border-radius:8px;border:1px solid var(--cui-base-200);background:var(--cui-base-10)}.upload-file{display:flex;align-items:center;gap:8px}.upload-file input[type=file]{display:none}.info{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.accepted{color:var(--cui-base-500)}.remove-button ::ng-deep .c-content{color:var(--cui-danger)!important}.image{position:relative;display:inline-block}.image__view{border-radius:8px;object-fit:cover}.image__name{position:absolute;top:6px;left:14px;color:var(--cui-base-0);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:170px;z-index:1}.image:after{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#0003;z-index:0;pointer-events:none;border-radius:8px}\n"], dependencies: [{ kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9246
+ }
9247
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiUtilityThumbnailComponent, decorators: [{
9248
+ type: Component,
9249
+ args: [{ selector: 'cui-utility-thumbnail', imports: [TranslocoDirective], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<section\n *transloco=\"let t\"\n class=\"file\"\n>\n <span class=\"title\">{{ t('THUMBNAIL') }}</span>\n <div class=\"upload\">\n <div class=\"upload-file\">\n @if (thumbnail()?.name; as fileId) {\n <div class=\"image\">\n <span class=\"image__name\">{{ thumbnail()?.name }}</span>\n <!-- TODO: ngSrc -->\n <img\n class=\"image__view\"\n [src]=\"thumbnailUrl()\"\n height=\"120\"\n width=\"184\"\n alt=\"Thumbnail\"\n />\n </div>\n }\n <div class=\"info\">\n <button\n type=\"button\"\n cuiButton\n appearance=\"outlined-gray\"\n size=\"xxs\"\n icon=\"cuiIconUpload\"\n (click)=\"onSelectFile()\"\n >\n {{ uploadButtonName() }}\n </button>\n @if (thumbnail()?.name) {\n <button\n class=\"remove-button\"\n cuiButton\n appearance=\"link\"\n size=\"sm\"\n type=\"button\"\n (click)=\"onRemoveThumbnail()\"\n >\n {{ t('REMOVE') }}\n </button>\n }\n\n <span class=\"accepted\">{{ t('ACCEPTED') }}: JPG, JPEG, PNG, MP4 {{ t('UP_TO') }} 20MB</span>\n </div>\n </div>\n </div>\n</section>\n", styles: [".file{display:flex;flex-direction:column;gap:4px}.title{font-weight:500;font-size:14px;line-height:20px;display:flex;gap:2px}.title_required{color:var(--cui-danger)}.upload{padding:12px 16px;border-radius:8px;border:1px solid var(--cui-base-200);background:var(--cui-base-10)}.upload-file{display:flex;align-items:center;gap:8px}.upload-file input[type=file]{display:none}.info{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.accepted{color:var(--cui-base-500)}.remove-button ::ng-deep .c-content{color:var(--cui-danger)!important}.image{position:relative;display:inline-block}.image__view{border-radius:8px;object-fit:cover}.image__name{position:absolute;top:6px;left:14px;color:var(--cui-base-0);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:170px;z-index:1}.image:after{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-color:#0003;z-index:0;pointer-events:none;border-radius:8px}\n"] }]
9250
+ }] });
9251
+
9252
+ class CuiCriterionInfoFormComponent {
9253
+ get controls() {
9254
+ return this.form.controls;
9255
+ }
9256
+ get isTitleError() {
9257
+ return this.controls.title.invalid && this.controls.title.dirty;
9258
+ }
9259
+ constructor() {
9260
+ this.destroy = inject(DestroyRef);
9261
+ this.formBuilder = inject(NonNullableFormBuilder);
9262
+ this.frameApiService = inject(CuiFrameApiService);
9263
+ this.cuiIdService = inject(CuiIdService);
9264
+ this.CONTROL_DELAY = 500;
9265
+ this.titleId = this.cuiIdService.generate();
9266
+ this.form = this.formBuilder.group({
9267
+ title: this.formBuilder.control('', cuiCreateDefaultValidators({ asyncDelay: this.CONTROL_DELAY })),
9268
+ });
9269
+ this.heading = null;
9270
+ this.isDescriptionEmpty = signal(false);
9271
+ this.editorId = signal(null);
9272
+ this.thumbnail = signal(null);
9273
+ this.title = input.required();
9274
+ this.framerId = input.required();
9275
+ this.baseResourceUrl = input.required();
9276
+ this.config = input.required();
9277
+ this.formChanged = output();
9278
+ this.isFormValidChanged = output();
9279
+ this.initUtilityEffect();
9280
+ }
9281
+ onEditorEmpty(isEmpty) {
9282
+ this.isDescriptionEmpty.set(isEmpty);
9283
+ this.isFormValidChanged.emit(this.checkFormValidation());
9284
+ }
9285
+ initUtilityEffect() {
9286
+ const effectRef = effect(() => {
9287
+ const title = this.title();
9288
+ if (!title) {
9289
+ return;
9290
+ }
9291
+ this.initFormSubscriptions();
9292
+ this.initFrameFragments();
9293
+ effectRef.destroy();
9294
+ });
9295
+ }
9296
+ initFormSubscriptions() {
9297
+ this.form.setValue({ title: this.title() }, { emitEvent: false });
9298
+ this.form.statusChanges
9299
+ .pipe(takeUntilDestroyed(this.destroy))
9300
+ .subscribe(() => this.isFormValidChanged.emit(this.checkFormValidation()));
9301
+ this.form.valueChanges
9302
+ .pipe(takeUntilDestroyed(this.destroy), startWith(this.form.value), pairwise(), debounceTime(this.CONTROL_DELAY), map(([prev, current]) => this.compareFormValues([prev, current])))
9303
+ .subscribe((value) => {
9304
+ if (!Object.keys(value).length) {
9305
+ return;
9306
+ }
9307
+ this.formChanged.emit(value);
9308
+ });
9309
+ }
9310
+ initFrameFragments() {
9311
+ const frameId = this.framerId();
9312
+ if (!frameId) {
9313
+ return;
9314
+ }
9315
+ this.frameApiService.getFrame(frameId).subscribe((frame) => {
9316
+ frame.fragments.forEach((fragment) => {
9317
+ if (fragment.type === "J_TEXT" /* FragmentType.jText */) {
9318
+ this.editorId.set(fragment?.id);
9319
+ }
9320
+ if (fragment.type === "RESOURCE_FILE" /* FragmentType.resourceFile */) {
9321
+ this.setResourceFile(fragment);
9322
+ }
9323
+ });
9324
+ });
9325
+ }
9326
+ compareFormValues([prevGroup, currentGroup]) {
9327
+ const keys = Object.keys(currentGroup);
9328
+ const changedFields = {};
9329
+ keys.forEach((key) => {
9330
+ const prev = prevGroup[key];
9331
+ const current = currentGroup[key];
9332
+ if (prev === current || this.controls[key].invalid) {
9333
+ return;
9334
+ }
9335
+ changedFields[key] = current;
9336
+ });
9337
+ return changedFields;
9338
+ }
9339
+ setResourceFile(resource) {
9340
+ const url = this.baseResourceUrl() + resource.fileId;
9341
+ this.thumbnail.set(resource);
9342
+ if (!url || resource?.name?.split('.').pop() !== 'mp4') {
9343
+ return;
9344
+ }
9345
+ this.getCaptureFromVideo(url);
9346
+ }
9347
+ getCaptureFromVideo(url, file) {
9348
+ takeCaptureFromVideo(url).then((capture) => {
9349
+ this.thumbnail.update((prev) => ({
9350
+ ...prev,
9351
+ name: (file?.name ?? prev?.name),
9352
+ resource: capture
9353
+ }));
9354
+ });
9355
+ }
9356
+ checkFormValidation() {
9357
+ return !this.isDescriptionEmpty() && !this.form.invalid;
9358
+ }
9359
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiCriterionInfoFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9360
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: CuiCriterionInfoFormComponent, isStandalone: true, selector: "cui-criterion-info-form", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, framerId: { classPropertyName: "framerId", publicName: "framerId", isSignal: true, isRequired: true, transformFunction: null }, baseResourceUrl: { classPropertyName: "baseResourceUrl", publicName: "baseResourceUrl", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { formChanged: "formChanged", isFormValidChanged: "isFormValidChanged" }, ngImport: i0, template: "<ng-container *transloco=\"let t\">\n <section class=\"content\">\n <cui-form-field>\n <label\n cuiLabel\n [isRequired]=\"true\"\n [for]=\"titleId\"\n >\n {{ t('TITLE') }}\n </label>\n\n <cui-input-text\n [cuiTextFieldId]=\"titleId\"\n [cuiTextFieldPlaceholder]=\"t('ADD_A_TITLE')\"\n [cuiTextFieldIsError]=\"isTitleError\"\n [formControl]=\"form.controls.title\"\n />\n\n @if (isTitleError) {\n <cui-general-control-error-hint\n [control]=\"form.controls.title\"\n [isVisible]=\"true\"\n />\n }\n </cui-form-field>\n\n <cui-utility-thumbnail\n [baseResourceUrl]=\"baseResourceUrl()\"\n [framerId]=\"framerId()\"\n [(thumbnail)]=\"thumbnail\"\n />\n\n @if (editorId(); as editorId) {\n <cui-editor-block\n [title]=\"form.controls.title.value || title()\"\n [config]=\"config()\"\n [editorId]=\"editorId\"\n [required]=\"true\"\n class=\"editor\"\n (editorEmpty)=\"onEditorEmpty($event)\"\n />\n }\n </section>\n</ng-container>\n", styles: ["::ng-deep cui-dialog:has(.instruction-description-modal){inset:0;margin:auto;transform:none!important}:host{--editor-height: 650px;display:block}:host .editor{--max-editor-height: var(--editor-height)}.content{display:flex;flex-direction:column;gap:16px;padding:16px 24px}\n"], dependencies: [{ kind: "ngmodule", type: CuiAccordionModule }, { kind: "ngmodule", type: CuiButtonModule }, { kind: "component", type: CuiEditorBlockComponent, selector: "cui-editor-block", inputs: ["title", "editorId", "config", "required"], outputs: ["editorEmpty"] }, { kind: "ngmodule", type: CuiFormFieldModule }, { kind: "component", type: CuiFormFieldComponent, selector: "cui-form-field" }, { kind: "component", type: CuiGeneralControlErrorHintComponent, selector: "cui-general-control-error-hint", inputs: ["control", "isVisible"] }, { kind: "ngmodule", type: CuiHintModule }, { kind: "ngmodule", type: CuiInputModule }, { kind: "component", type: CuiInputTextComponent, selector: "cui-input-text" }, { kind: "directive", type: CuiTextFieldIdDirective, selector: "[cuiTextFieldId]", inputs: ["cuiTextFieldId"] }, { kind: "directive", type: CuiTextFieldPlaceholderDirective, selector: "[cuiTextFieldPlaceholder]", inputs: ["cuiTextFieldPlaceholder"] }, { kind: "directive", type: CuiTextFieldIsErrorDirective, selector: "[cuiTextFieldIsError]", inputs: ["cuiTextFieldIsError"] }, { kind: "ngmodule", type: CuiLabelModule }, { kind: "component", type: CuiLabelComponent, selector: "label[cuiLabel]", inputs: ["isRequired"] }, { kind: "component", type: CuiUtilityThumbnailComponent, selector: "cui-utility-thumbnail", inputs: ["thumbnail", "framerId", "baseResourceUrl"], outputs: ["thumbnailChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9361
+ }
9362
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiCriterionInfoFormComponent, decorators: [{
9363
+ type: Component,
9364
+ args: [{ selector: 'cui-criterion-info-form', imports: [
9365
+ CuiAccordionModule,
9366
+ CuiButtonModule,
9367
+ CuiEditorBlockComponent,
9368
+ CuiFormFieldModule,
9369
+ CuiGeneralControlErrorHintComponent,
9370
+ CuiHintModule,
9371
+ CuiInputModule,
9372
+ CuiLabelModule,
9373
+ CuiUtilityThumbnailComponent,
9374
+ ReactiveFormsModule,
9375
+ TranslocoDirective
9376
+ ], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t\">\n <section class=\"content\">\n <cui-form-field>\n <label\n cuiLabel\n [isRequired]=\"true\"\n [for]=\"titleId\"\n >\n {{ t('TITLE') }}\n </label>\n\n <cui-input-text\n [cuiTextFieldId]=\"titleId\"\n [cuiTextFieldPlaceholder]=\"t('ADD_A_TITLE')\"\n [cuiTextFieldIsError]=\"isTitleError\"\n [formControl]=\"form.controls.title\"\n />\n\n @if (isTitleError) {\n <cui-general-control-error-hint\n [control]=\"form.controls.title\"\n [isVisible]=\"true\"\n />\n }\n </cui-form-field>\n\n <cui-utility-thumbnail\n [baseResourceUrl]=\"baseResourceUrl()\"\n [framerId]=\"framerId()\"\n [(thumbnail)]=\"thumbnail\"\n />\n\n @if (editorId(); as editorId) {\n <cui-editor-block\n [title]=\"form.controls.title.value || title()\"\n [config]=\"config()\"\n [editorId]=\"editorId\"\n [required]=\"true\"\n class=\"editor\"\n (editorEmpty)=\"onEditorEmpty($event)\"\n />\n }\n </section>\n</ng-container>\n", styles: ["::ng-deep cui-dialog:has(.instruction-description-modal){inset:0;margin:auto;transform:none!important}:host{--editor-height: 650px;display:block}:host .editor{--max-editor-height: var(--editor-height)}.content{display:flex;flex-direction:column;gap:16px;padding:16px 24px}\n"] }]
9377
+ }], ctorParameters: () => [] });
9378
+
9379
+ const UTILITY_MODAL_SERVICE_TOKEN = new InjectionToken('UTILITY_MODAL_SERVICE_TOKEN');
9380
+
9381
+ class CuiUtilityModalCreateComponent {
9382
+ constructor() {
9383
+ this.window = inject(CUI_WINDOW);
9384
+ this.cuiDialogContext = inject(CUI_DIALOG_CONTEXT);
9385
+ this.utilityModalService = inject(UTILITY_MODAL_SERVICE_TOKEN);
9386
+ this.prevUtility = this.cuiDialogContext.data.utility;
9387
+ this.editorResourceUrl = this.cuiDialogContext.data.editorResourceUrl;
9388
+ this.tools = this.cuiDialogContext.data.tools;
9389
+ this.header = this.cuiDialogContext.data.header;
9390
+ this._utility = computed(() => signal(this.initialUtility()));
9391
+ this.isFormValid = signal(false);
9392
+ this.utility = computed(() => this._utility()());
9393
+ this.initialUtility = input.required();
9394
+ }
9395
+ ngOnInit() {
9396
+ this.initWindowUnloadEvent();
9397
+ }
9398
+ ngOnDestroy() {
9399
+ this.window.onbeforeunload = null;
9400
+ }
9401
+ onSave() {
9402
+ this.cuiDialogContext.completeWith(this.initialUtility() ? { prevId: this.prevUtility.id, ...this.utility() } : this.utility());
9403
+ }
9404
+ onCancel() {
9405
+ this.destroyUtility();
9406
+ const returnedValue = this.initialUtility() ? this.utility() : null;
9407
+ this.cuiDialogContext.completeWith(returnedValue);
9408
+ }
9409
+ initWindowUnloadEvent() {
9410
+ this.window.onbeforeunload = () => this.destroyUtility();
9411
+ }
9412
+ destroyUtility() {
9413
+ const utility = this.utility();
9414
+ if (!utility || this.initialUtility()) {
9415
+ return;
9416
+ }
9417
+ this.utilityModalService.deleteUtility(utility).subscribe();
9418
+ }
9419
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiUtilityModalCreateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9420
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: CuiUtilityModalCreateComponent, isStandalone: true, selector: "cui-utility-modal-create", inputs: { initialUtility: { classPropertyName: "initialUtility", publicName: "initialUtility", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<div\n class=\"wrapper\"\n *transloco=\"let t\"\n>\n <header class=\"header\">\n <ng-container [ngTemplateOutlet]=\"header\" />\n\n <div class=\"header__content\">\n <cui-loader />\n\n <div class=\"actions\">\n @if (!initialUtility()) {\n <button\n type=\"button\"\n cuiButton\n appearance=\"secondary\"\n (click)=\"onCancel()\"\n >\n {{ t('CANCEL') }}\n </button>\n }\n\n <button\n type=\"button\"\n cuiButton\n [disabled]=\"!isFormValid()\"\n appearance=\"action-violet\"\n (click)=\"onSave()\"\n >\n {{ t('DONE') }}\n </button>\n </div>\n </div>\n </header>\n\n <ng-content />\n</div>\n", styles: [".header{display:flex;align-items:center;justify-content:space-between;padding:16px 24px}.header__content{display:flex;gap:8px}.actions{display:flex;gap:16px}\n"], dependencies: [{ kind: "ngmodule", type: CuiButtonModule }, { kind: "component", type: CuiButtonComponent, selector: "button[cuiButton], a[cuiButton]", inputs: ["shape", "disabled", "isLoaderShown", "icon", "iconRight", "appearance", "size"] }, { kind: "component", type: CuiLoaderComponent, selector: "cui-loader" }, { kind: "ngmodule", type: CuiSvgModule }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9421
+ }
9422
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiUtilityModalCreateComponent, decorators: [{
9423
+ type: Component,
9424
+ args: [{ selector: 'cui-utility-modal-create', imports: [CuiButtonModule, CuiLoaderComponent, CuiSvgModule, NgTemplateOutlet, TranslocoDirective], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"wrapper\"\n *transloco=\"let t\"\n>\n <header class=\"header\">\n <ng-container [ngTemplateOutlet]=\"header\" />\n\n <div class=\"header__content\">\n <cui-loader />\n\n <div class=\"actions\">\n @if (!initialUtility()) {\n <button\n type=\"button\"\n cuiButton\n appearance=\"secondary\"\n (click)=\"onCancel()\"\n >\n {{ t('CANCEL') }}\n </button>\n }\n\n <button\n type=\"button\"\n cuiButton\n [disabled]=\"!isFormValid()\"\n appearance=\"action-violet\"\n (click)=\"onSave()\"\n >\n {{ t('DONE') }}\n </button>\n </div>\n </div>\n </header>\n\n <ng-content />\n</div>\n", styles: [".header{display:flex;align-items:center;justify-content:space-between;padding:16px 24px}.header__content{display:flex;gap:8px}.actions{display:flex;gap:16px}\n"] }]
9425
+ }] });
9426
+
9427
+ class CuiCriterionModalCreateComponent {
9428
+ constructor() {
9429
+ this.destroyRef = inject(DestroyRef);
9430
+ this.cuiDialogContext = inject(CUI_DIALOG_CONTEXT);
9431
+ this.criterionApiService = inject(UTILITY_MODAL_SERVICE_TOKEN);
9432
+ this.isCreated = false;
9433
+ this.editorResourceUrl = this.cuiDialogContext.data.editorResourceUrl;
9434
+ this.tools = this.cuiDialogContext.data.tools;
9435
+ this.header = this.cuiDialogContext.data.header;
9436
+ this._criterion = computed(() => signal(this.initialUtility()));
9437
+ this.isFormValid = signal(false);
9438
+ this.criterion = computed(() => this._criterion()());
9439
+ this.initialUtility = input.required();
9440
+ }
9441
+ onCriterionCreated(storageNodeId) {
9442
+ if (this.isCreated || this.initialUtility()) {
9443
+ return;
9444
+ }
9445
+ this.criterionApiService.createUtility(storageNodeId)
9446
+ .pipe(takeUntilDestroyed(this.destroyRef))
9447
+ .subscribe((criterion) => {
9448
+ this.isCreated = true;
9449
+ this._criterion().set(criterion);
9450
+ });
9451
+ }
9452
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiCriterionModalCreateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9453
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: CuiCriterionModalCreateComponent, isStandalone: true, selector: "ng-component", inputs: { initialUtility: { classPropertyName: "initialUtility", publicName: "initialUtility", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<cui-utility-modal-create [initialUtility]=\"criterion()\">\n <cui-criterion-info\n [criterion]=\"criterion()\"\n [tools]=\"tools\"\n [editorResourceUrl]=\"editorResourceUrl\"\n (validationChanged)=\"isFormValid.set($event)\"\n (criterionCreated)=\"onCriterionCreated($event)\"\n />\n</cui-utility-modal-create>\n", dependencies: [{ kind: "ngmodule", type: CuiButtonModule }, { kind: "ngmodule", type: CuiSvgModule }, { kind: "component", type: CuiCriterionInfoComponent, selector: "cui-criterion-info", inputs: ["criterion", "tools", "editorResourceUrl"], outputs: ["criterionChange", "validationChanged", "criterionCreated"] }, { kind: "component", type: CuiUtilityModalCreateComponent, selector: "cui-utility-modal-create", inputs: ["initialUtility"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9454
+ }
9455
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiCriterionModalCreateComponent, decorators: [{
9456
+ type: Component,
9457
+ args: [{ imports: [CuiButtonModule, CuiSvgModule, CuiCriterionInfoComponent, CuiUtilityModalCreateComponent], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<cui-utility-modal-create [initialUtility]=\"criterion()\">\n <cui-criterion-info\n [criterion]=\"criterion()\"\n [tools]=\"tools\"\n [editorResourceUrl]=\"editorResourceUrl\"\n (validationChanged)=\"isFormValid.set($event)\"\n (criterionCreated)=\"onCriterionCreated($event)\"\n />\n</cui-utility-modal-create>\n" }]
9458
+ }] });
9459
+
9460
+ class CuiInstructionInfoFormComponent {
9461
+ get controls() {
9462
+ return this.form.controls;
9463
+ }
9464
+ get isTitleError() {
9465
+ return this.controls.title.invalid && this.controls.title.dirty;
9466
+ }
9467
+ get isDescriptionError() {
9468
+ return this.controls.description.invalid && this.controls.description.dirty;
9469
+ }
9470
+ constructor() {
9471
+ this.destroy = inject(DestroyRef);
9472
+ this.formBuilder = inject(NonNullableFormBuilder);
9473
+ this.frameApiService = inject(CuiFrameApiService);
9474
+ this.cuiIdService = inject(CuiIdService);
9475
+ this.CONTROL_DELAY = 500;
9476
+ this.titleId = this.cuiIdService.generate();
9477
+ this.descriptionId = this.cuiIdService.generate();
9478
+ this.form = this.formBuilder.group({
9479
+ title: this.formBuilder.control('', cuiCreateDefaultValidators({ asyncDelay: this.CONTROL_DELAY })),
9480
+ description: this.formBuilder.control('', cuiCreateDefaultValidators({ asyncDelay: this.CONTROL_DELAY }))
9481
+ });
9482
+ this.heading = null;
9483
+ this.isDescriptionEmpty = signal(false);
9484
+ this.editorId = signal(null);
9485
+ this.thumbnail = signal(null);
9486
+ this.title = input.required();
9487
+ this.description = input.required();
9488
+ this.framerId = input.required();
9489
+ this.baseResourceUrl = input.required();
9490
+ this.config = input.required();
9491
+ this.formChanged = output();
9492
+ this.isFormValidChanged = output();
9493
+ this.initUtilityEffect();
9494
+ }
9495
+ onEditorEmpty(isEmpty) {
9496
+ this.isDescriptionEmpty.set(isEmpty);
9497
+ this.isFormValidChanged.emit(this.checkFormValidation());
9498
+ }
9499
+ initUtilityEffect() {
9500
+ const effectRef = effect(() => {
9501
+ const title = this.title();
9502
+ if (!title) {
9503
+ return;
9504
+ }
9505
+ this.initFormSubscriptions();
9506
+ this.initFrameFragments();
9507
+ effectRef.destroy();
9508
+ });
9509
+ }
9510
+ initFormSubscriptions() {
9511
+ this.form.setValue({ title: this.title(), description: this.description() }, { emitEvent: false });
9512
+ this.form.statusChanges
9513
+ .pipe(takeUntilDestroyed(this.destroy))
9514
+ .subscribe(() => this.isFormValidChanged.emit(this.checkFormValidation()));
9515
+ this.form.valueChanges
9516
+ .pipe(takeUntilDestroyed(this.destroy), startWith(this.form.value), pairwise(), debounceTime(this.CONTROL_DELAY), map(([prev, current]) => this.compareFormValues([prev, current])))
9517
+ .subscribe((value) => {
9518
+ if (!Object.keys(value).length) {
9519
+ return;
9520
+ }
9521
+ this.formChanged.emit(value);
9522
+ });
9523
+ }
9524
+ initFrameFragments() {
9525
+ const frameId = this.framerId();
9526
+ if (!frameId) {
9527
+ return;
9528
+ }
9529
+ this.frameApiService.getFrame(frameId).subscribe((frame) => {
9530
+ frame.fragments.forEach((fragment) => {
9531
+ if (fragment.type === "J_TEXT" /* FragmentType.jText */) {
9532
+ this.editorId.set(fragment?.id);
9533
+ }
9534
+ if (fragment.type === "RESOURCE_FILE" /* FragmentType.resourceFile */) {
9535
+ this.setResourceFile(fragment);
9536
+ }
9537
+ });
9538
+ });
9539
+ }
9540
+ compareFormValues([prevGroup, currentGruop]) {
9541
+ const keys = Object.keys(currentGruop);
9542
+ const changedFields = {};
9543
+ keys.forEach((key) => {
9544
+ const prev = prevGroup[key];
9545
+ const current = currentGruop[key];
9546
+ if (prev === current || this.controls[key].invalid) {
9547
+ return;
9548
+ }
9549
+ changedFields[key] = current;
9550
+ });
9551
+ return changedFields;
9552
+ }
9553
+ setResourceFile(resource) {
9554
+ const url = this.baseResourceUrl() + resource.fileId;
9555
+ this.thumbnail.set(resource);
9556
+ if (!url || resource?.name?.split('.').pop() !== 'mp4') {
9557
+ return;
9558
+ }
9559
+ this.getCaptureFromVideo(url);
9560
+ }
9561
+ getCaptureFromVideo(url, file) {
9562
+ takeCaptureFromVideo(url).then((capture) => {
9563
+ this.thumbnail.update((prev) => ({
9564
+ ...prev,
9565
+ name: (file?.name ?? prev?.name),
9566
+ resource: capture
9567
+ }));
9568
+ });
9569
+ }
9570
+ checkFormValidation() {
9571
+ return !this.isDescriptionEmpty() && !this.form.invalid;
9572
+ }
9573
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiInstructionInfoFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9574
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: CuiInstructionInfoFormComponent, isStandalone: true, selector: "cui-instruction-info-form", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: true, transformFunction: null }, framerId: { classPropertyName: "framerId", publicName: "framerId", isSignal: true, isRequired: true, transformFunction: null }, baseResourceUrl: { classPropertyName: "baseResourceUrl", publicName: "baseResourceUrl", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { formChanged: "formChanged", isFormValidChanged: "isFormValidChanged" }, ngImport: i0, template: "<ng-container *transloco=\"let t\">\r\n <section class=\"content\">\r\n <cui-form-field>\r\n <label\r\n cuiLabel\r\n [isRequired]=\"true\"\r\n [for]=\"titleId\"\r\n >\r\n {{ t('TITLE') }}\r\n </label>\r\n\r\n <cui-input-text\r\n [cuiTextFieldId]=\"titleId\"\r\n [cuiTextFieldPlaceholder]=\"t('ADD_A_TITLE')\"\r\n [cuiTextFieldIsError]=\"isTitleError\"\r\n [formControl]=\"form.controls.title\"\r\n />\r\n\r\n @if (isTitleError) {\r\n <cui-general-control-error-hint\r\n [control]=\"form.controls.title\"\r\n [isVisible]=\"true\"\r\n />\r\n }\r\n </cui-form-field>\r\n\r\n <cui-form-field>\r\n <label\r\n cuiLabel\r\n [isRequired]=\"true\"\r\n [for]=\"descriptionId\"\r\n >\r\n {{ t('SHORT_DESCRIPTION') }}\r\n </label>\r\n\r\n <cui-input-text\r\n [cuiTextFieldId]=\"descriptionId\"\r\n cuiTextFieldPlaceholder=\"{{ t('SHORT_DESCRIPTION') }}...\"\r\n [cuiTextFieldIsError]=\"isDescriptionError\"\r\n [formControl]=\"form.controls.description\"\r\n />\r\n\r\n @if (isDescriptionError) {\r\n <cui-general-control-error-hint\r\n [control]=\"form.controls.description\"\r\n [isVisible]=\"true\"\r\n />\r\n }\r\n </cui-form-field>\r\n\r\n <cui-utility-thumbnail\r\n [baseResourceUrl]=\"baseResourceUrl()\"\r\n [framerId]=\"framerId()\"\r\n [(thumbnail)]=\"thumbnail\"\r\n />\r\n\r\n @if (editorId(); as editorId) {\r\n <cui-editor-block\r\n [title]=\"form.controls.title.value || title()\"\r\n [config]=\"config()\"\r\n [editorId]=\"editorId\"\r\n [required]=\"true\"\r\n class=\"editor\"\r\n (editorEmpty)=\"onEditorEmpty($event)\"\r\n />\r\n }\r\n </section>\r\n</ng-container>\r\n", styles: ["::ng-deep cui-dialog:has(.instruction-description-modal){inset:0;margin:auto;transform:none!important}:host{--editor-height: 650px;display:block}:host .editor{--max-editor-height: var(--editor-height)}.content{display:flex;flex-direction:column;gap:16px;padding:16px 24px}\n"], dependencies: [{ kind: "ngmodule", type: CuiAccordionModule }, { kind: "ngmodule", type: CuiButtonModule }, { kind: "component", type: CuiEditorBlockComponent, selector: "cui-editor-block", inputs: ["title", "editorId", "config", "required"], outputs: ["editorEmpty"] }, { kind: "ngmodule", type: CuiFormFieldModule }, { kind: "component", type: CuiFormFieldComponent, selector: "cui-form-field" }, { kind: "component", type: CuiGeneralControlErrorHintComponent, selector: "cui-general-control-error-hint", inputs: ["control", "isVisible"] }, { kind: "ngmodule", type: CuiHintModule }, { kind: "ngmodule", type: CuiInputModule }, { kind: "component", type: CuiInputTextComponent, selector: "cui-input-text" }, { kind: "directive", type: CuiTextFieldIdDirective, selector: "[cuiTextFieldId]", inputs: ["cuiTextFieldId"] }, { kind: "directive", type: CuiTextFieldPlaceholderDirective, selector: "[cuiTextFieldPlaceholder]", inputs: ["cuiTextFieldPlaceholder"] }, { kind: "directive", type: CuiTextFieldIsErrorDirective, selector: "[cuiTextFieldIsError]", inputs: ["cuiTextFieldIsError"] }, { kind: "ngmodule", type: CuiLabelModule }, { kind: "component", type: CuiLabelComponent, selector: "label[cuiLabel]", inputs: ["isRequired"] }, { kind: "component", type: CuiUtilityThumbnailComponent, selector: "cui-utility-thumbnail", inputs: ["thumbnail", "framerId", "baseResourceUrl"], outputs: ["thumbnailChange"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9575
+ }
9576
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiInstructionInfoFormComponent, decorators: [{
9577
+ type: Component,
9578
+ args: [{ selector: 'cui-instruction-info-form', imports: [
9579
+ CuiAccordionModule,
9580
+ CuiButtonModule,
9581
+ CuiEditorBlockComponent,
9582
+ CuiFormFieldModule,
9583
+ CuiGeneralControlErrorHintComponent,
9584
+ CuiHintModule,
9585
+ CuiInputModule,
9586
+ CuiLabelModule,
9587
+ CuiUtilityThumbnailComponent,
9588
+ ReactiveFormsModule,
9589
+ TranslocoDirective
9590
+ ], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t\">\r\n <section class=\"content\">\r\n <cui-form-field>\r\n <label\r\n cuiLabel\r\n [isRequired]=\"true\"\r\n [for]=\"titleId\"\r\n >\r\n {{ t('TITLE') }}\r\n </label>\r\n\r\n <cui-input-text\r\n [cuiTextFieldId]=\"titleId\"\r\n [cuiTextFieldPlaceholder]=\"t('ADD_A_TITLE')\"\r\n [cuiTextFieldIsError]=\"isTitleError\"\r\n [formControl]=\"form.controls.title\"\r\n />\r\n\r\n @if (isTitleError) {\r\n <cui-general-control-error-hint\r\n [control]=\"form.controls.title\"\r\n [isVisible]=\"true\"\r\n />\r\n }\r\n </cui-form-field>\r\n\r\n <cui-form-field>\r\n <label\r\n cuiLabel\r\n [isRequired]=\"true\"\r\n [for]=\"descriptionId\"\r\n >\r\n {{ t('SHORT_DESCRIPTION') }}\r\n </label>\r\n\r\n <cui-input-text\r\n [cuiTextFieldId]=\"descriptionId\"\r\n cuiTextFieldPlaceholder=\"{{ t('SHORT_DESCRIPTION') }}...\"\r\n [cuiTextFieldIsError]=\"isDescriptionError\"\r\n [formControl]=\"form.controls.description\"\r\n />\r\n\r\n @if (isDescriptionError) {\r\n <cui-general-control-error-hint\r\n [control]=\"form.controls.description\"\r\n [isVisible]=\"true\"\r\n />\r\n }\r\n </cui-form-field>\r\n\r\n <cui-utility-thumbnail\r\n [baseResourceUrl]=\"baseResourceUrl()\"\r\n [framerId]=\"framerId()\"\r\n [(thumbnail)]=\"thumbnail\"\r\n />\r\n\r\n @if (editorId(); as editorId) {\r\n <cui-editor-block\r\n [title]=\"form.controls.title.value || title()\"\r\n [config]=\"config()\"\r\n [editorId]=\"editorId\"\r\n [required]=\"true\"\r\n class=\"editor\"\r\n (editorEmpty)=\"onEditorEmpty($event)\"\r\n />\r\n }\r\n </section>\r\n</ng-container>\r\n", styles: ["::ng-deep cui-dialog:has(.instruction-description-modal){inset:0;margin:auto;transform:none!important}:host{--editor-height: 650px;display:block}:host .editor{--max-editor-height: var(--editor-height)}.content{display:flex;flex-direction:column;gap:16px;padding:16px 24px}\n"] }]
9591
+ }], ctorParameters: () => [] });
9592
+
9593
+ class CuiInstructionInfoComponent {
9594
+ constructor() {
9595
+ this.destroyRef = inject(DestroyRef);
9596
+ this.translocoService = inject(TranslocoService);
9597
+ this.cuiIdService = inject(CuiIdService);
9598
+ this.cuiCategoriesModalService = inject(CuiSelectedCategoryService);
9599
+ this.treeStructNavigatorApiService = inject(CuiTreeStructNavigatorApiService);
9600
+ this.instructionApiService = inject(UTILITY_MODAL_SERVICE_TOKEN);
9601
+ this.TYPE = "INSTRUCTION_STORAGE" /* TreeStructType.Instruction */;
9602
+ this.skipCategoryChange = false;
9603
+ this.categoryId = this.cuiIdService.generate();
9604
+ this.category = this.cuiCategoriesModalService.category;
9605
+ this.isFormValid = signal(false);
9606
+ this.prevCategoryId = signal(null);
9607
+ this.editorConfig = signal(null);
9608
+ this.labelColor = computed(() => this.category()?.title ? 'var(--cui-base-900)' : 'var(--cui-base-400)');
9609
+ this.selectTitle = computed(() => this.category()?.title || this.translocoService.translate('SELECT') + '...');
9610
+ this.element = viewChild('scrollContent');
9611
+ this.instruction = model();
9612
+ this.tools = input.required();
9613
+ this.editorResourceUrl = input.required();
9614
+ this.validationChanged = output();
9615
+ this.instructionCreated = output();
9616
+ this.initConfigEffect();
9617
+ this.initCategoryEffect();
9618
+ }
9619
+ ngOnInit() {
9620
+ this.initCategory();
9621
+ }
9622
+ onFormChanged(values, instructionId) {
9623
+ const actions = {
9624
+ title: (title) => this.changeTitle(title, instructionId),
9625
+ description: (description) => this.changeDescription(description, instructionId)
9626
+ };
9627
+ forkJoin(Object.keys(values).map((key) => actions[key](values[key] || '')))
9628
+ .pipe(takeUntilDestroyed(this.destroyRef))
9629
+ .subscribe();
9630
+ }
9631
+ onFormValidationChanged(isValid) {
9632
+ this.isFormValid.set(isValid);
9633
+ this.validationChanged.emit(isValid);
9634
+ }
9635
+ initCategoryEffect() {
9636
+ effect(() => {
9637
+ const category = this.category();
9638
+ const storageObjectInstruction = untracked(this.instruction);
9639
+ if (!category || this.skipCategoryChange) {
9640
+ this.skipCategoryChange = false;
9641
+ return;
9642
+ }
9643
+ if (storageObjectInstruction) {
9644
+ this.changeCategory(category.id, storageObjectInstruction.id);
9645
+ return;
9646
+ }
9647
+ this.createInstruction(category.id);
9648
+ });
9649
+ }
9650
+ initConfigEffect() {
9651
+ effect(() => {
9652
+ const element = this.element()?.nativeElement;
9653
+ if (!element) {
9654
+ return;
9655
+ }
9656
+ this.editorConfig.set({ tools: this.tools(), element });
9657
+ });
9658
+ }
9659
+ initCategory() {
9660
+ const storageObjectId = this.instruction()?.id;
9661
+ if (!storageObjectId) {
9662
+ return;
9663
+ }
9664
+ this.treeStructNavigatorApiService
9665
+ .getCategory(storageObjectId, "INSTRUCTION_STORAGE" /* TreeStructType.Instruction */)
9666
+ .pipe(takeUntilDestroyed(this.destroyRef))
9667
+ .subscribe((category) => {
9668
+ this.skipCategoryChange = true;
9669
+ this.prevCategoryId.set(category.id);
9670
+ this.cuiCategoriesModalService.setCurrentCategory(category);
9671
+ });
9672
+ }
9673
+ changeCategory(categoryId, targetId) {
9674
+ const prevCategoryId = untracked(this.prevCategoryId);
9675
+ if (!prevCategoryId) {
9676
+ return;
9677
+ }
9678
+ this.subscription?.unsubscribe();
9679
+ this.subscription = this.treeStructNavigatorApiService
9680
+ .moveElement({
9681
+ type: "MOVING_TARGET_TREE_STRUCT" /* MovingType.TARGET_TREE_STRUCT */,
9682
+ movableItemId: targetId,
9683
+ treeStructTargetItemId: categoryId,
9684
+ treeStructMovableItemId: prevCategoryId
9685
+ })
9686
+ .subscribe(() => this.prevCategoryId.set(categoryId));
9687
+ }
9688
+ createInstruction(categoryId) {
9689
+ this.instructionCreated.emit(categoryId);
9690
+ this.prevCategoryId.set(categoryId);
9691
+ }
9692
+ changeTitle(value, instructionId) {
9693
+ return this.instructionApiService.changeTitle(instructionId, value).pipe(finalize(() => this.instruction.update((prev) => ({
9694
+ ...prev,
9695
+ storageElement: { ...prev.storageElement, title: value }
9696
+ }))));
9697
+ }
9698
+ changeDescription(value, instructionId) {
9699
+ if (!this.instructionApiService.changeDescription) {
9700
+ throw new Error('Change description not implemented');
9701
+ }
9702
+ return this.instructionApiService.changeDescription(instructionId, value).pipe(finalize(() => this.instruction.update((prev) => ({
9703
+ ...prev,
9704
+ storageElement: { ...prev.storageElement, shortDescription: value }
9705
+ }))));
9706
+ }
9707
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiInstructionInfoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9708
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: CuiInstructionInfoComponent, isStandalone: true, selector: "cui-instruction-info", inputs: { instruction: { classPropertyName: "instruction", publicName: "instruction", isSignal: true, isRequired: false, transformFunction: null }, tools: { classPropertyName: "tools", publicName: "tools", isSignal: true, isRequired: true, transformFunction: null }, editorResourceUrl: { classPropertyName: "editorResourceUrl", publicName: "editorResourceUrl", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { instruction: "instructionChange", validationChanged: "validationChanged", instructionCreated: "instructionCreated" }, providers: [CuiSelectedCategoryService], viewQueries: [{ propertyName: "element", first: true, predicate: ["scrollContent"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\r\n class=\"wrapper\"\r\n *transloco=\"let t\"\r\n>\r\n <div\r\n #scrollContent\r\n class=\"content content_scrollable\"\r\n >\r\n <div class=\"category\">\r\n <cui-form-field>\r\n <label\r\n cuiLabel\r\n [for]=\"categoryId\"\r\n [isRequired]=\"true\"\r\n >\r\n {{ t('SELECT_CATEGORY') }}\r\n </label>\r\n <cui-categories\r\n [buttonId]=\"categoryId\"\r\n [treeStructType]=\"TYPE\"\r\n >\r\n <div class=\"select\">\r\n <span [style.color]=\"labelColor()\">\r\n {{ selectTitle() }}\r\n </span>\r\n\r\n <cui-svg icon=\"cuiIconChevronDown\" />\r\n </div>\r\n </cui-categories>\r\n </cui-form-field>\r\n </div>\r\n\r\n @let instructionData = instruction();\r\n @let editorConfigData = editorConfig();\r\n\r\n @if (editorConfigData && instructionData) {\r\n <cui-instruction-info-form\r\n [config]=\"editorConfigData\"\r\n [baseResourceUrl]=\"editorResourceUrl()\"\r\n [title]=\"instructionData.storageElement.title\"\r\n [description]=\"instructionData.storageElement.shortDescription\"\r\n [framerId]=\"instructionData.storageElement.framerInstructionId\"\r\n class=\"utility\"\r\n (isFormValidChanged)=\"onFormValidationChanged($event)\"\r\n (formChanged)=\"onFormChanged($event, instructionData.id)\"\r\n />\r\n }\r\n </div>\r\n</div>\r\n", styles: [".wrapper{display:flex;flex-direction:column;height:100%}.content{height:calc(100vh - 109px)}.content_scrollable{overflow:auto}.category{padding-top:16px;padding-right:23px;padding-left:23px}.select{padding:7px 13px;font-weight:400;font-size:14px;line-height:20px;display:flex;justify-content:space-between;height:36px;border-radius:8px;border:1px solid var(--cui-base-200);color:var(--cui-base-900);background:var(--cui-input)}.utility{--editor-height: none}\n"], dependencies: [{ kind: "ngmodule", type: CuiBadgeModule }, { kind: "ngmodule", type: CuiButtonModule }, { kind: "component", type: CuiCategoriesComponent, selector: "cui-categories", inputs: ["treeStructType", "buttonId", "disabled"] }, { kind: "ngmodule", type: CuiDialogModule }, { kind: "ngmodule", type: CuiFormFieldModule }, { kind: "component", type: CuiFormFieldComponent, selector: "cui-form-field" }, { kind: "component", type: CuiInstructionInfoFormComponent, selector: "cui-instruction-info-form", inputs: ["title", "description", "framerId", "baseResourceUrl", "config"], outputs: ["formChanged", "isFormValidChanged"] }, { kind: "ngmodule", type: CuiLabelModule }, { kind: "component", type: CuiLabelComponent, selector: "label[cuiLabel]", inputs: ["isRequired"] }, { kind: "ngmodule", type: CuiSvgModule }, { kind: "component", type: CuiSvgComponent, selector: "cui-svg[icon]", inputs: ["width", "height", "strokeWidth", "color", "icon"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "directive", type: i4.TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9709
+ }
9710
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiInstructionInfoComponent, decorators: [{
9711
+ type: Component,
9712
+ args: [{ selector: 'cui-instruction-info', imports: [
9713
+ CuiBadgeModule,
9714
+ CuiButtonModule,
9715
+ CuiCategoriesComponent,
9716
+ CuiDialogModule,
9717
+ CuiFormFieldModule,
9718
+ CuiInstructionInfoFormComponent,
9719
+ CuiLabelModule,
9720
+ CuiSvgModule,
9721
+ TranslocoModule
9722
+ ], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [CuiSelectedCategoryService], template: "<div\r\n class=\"wrapper\"\r\n *transloco=\"let t\"\r\n>\r\n <div\r\n #scrollContent\r\n class=\"content content_scrollable\"\r\n >\r\n <div class=\"category\">\r\n <cui-form-field>\r\n <label\r\n cuiLabel\r\n [for]=\"categoryId\"\r\n [isRequired]=\"true\"\r\n >\r\n {{ t('SELECT_CATEGORY') }}\r\n </label>\r\n <cui-categories\r\n [buttonId]=\"categoryId\"\r\n [treeStructType]=\"TYPE\"\r\n >\r\n <div class=\"select\">\r\n <span [style.color]=\"labelColor()\">\r\n {{ selectTitle() }}\r\n </span>\r\n\r\n <cui-svg icon=\"cuiIconChevronDown\" />\r\n </div>\r\n </cui-categories>\r\n </cui-form-field>\r\n </div>\r\n\r\n @let instructionData = instruction();\r\n @let editorConfigData = editorConfig();\r\n\r\n @if (editorConfigData && instructionData) {\r\n <cui-instruction-info-form\r\n [config]=\"editorConfigData\"\r\n [baseResourceUrl]=\"editorResourceUrl()\"\r\n [title]=\"instructionData.storageElement.title\"\r\n [description]=\"instructionData.storageElement.shortDescription\"\r\n [framerId]=\"instructionData.storageElement.framerInstructionId\"\r\n class=\"utility\"\r\n (isFormValidChanged)=\"onFormValidationChanged($event)\"\r\n (formChanged)=\"onFormChanged($event, instructionData.id)\"\r\n />\r\n }\r\n </div>\r\n</div>\r\n", styles: [".wrapper{display:flex;flex-direction:column;height:100%}.content{height:calc(100vh - 109px)}.content_scrollable{overflow:auto}.category{padding-top:16px;padding-right:23px;padding-left:23px}.select{padding:7px 13px;font-weight:400;font-size:14px;line-height:20px;display:flex;justify-content:space-between;height:36px;border-radius:8px;border:1px solid var(--cui-base-200);color:var(--cui-base-900);background:var(--cui-input)}.utility{--editor-height: none}\n"] }]
9723
+ }], ctorParameters: () => [] });
9724
+
9725
+ class CuiInstructionModalCreateComponent {
9726
+ constructor() {
9727
+ this.destroyRef = inject(DestroyRef);
9728
+ this.cuiDialogContext = inject(CUI_DIALOG_CONTEXT);
9729
+ this.instructionApiService = inject(UTILITY_MODAL_SERVICE_TOKEN);
9730
+ this.isCreated = false;
9731
+ this.editorResourceUrl = this.cuiDialogContext.data.editorResourceUrl;
9732
+ this.tools = this.cuiDialogContext.data.tools;
9733
+ this.header = this.cuiDialogContext.data.header;
9734
+ this._instruction = computed(() => signal(this.initialUtility()));
9735
+ this.isFormValid = signal(false);
9736
+ this.instruction = computed(() => this._instruction()());
9737
+ this.initialUtility = input.required();
9738
+ }
9739
+ onInstructionCreated(storageNodeId) {
9740
+ if (this.isCreated || this.initialUtility()) {
9741
+ return;
9742
+ }
9743
+ this.instructionApiService.createUtility(storageNodeId)
9744
+ .pipe(takeUntilDestroyed(this.destroyRef))
9745
+ .subscribe((instruction) => {
9746
+ this.isCreated = true;
9747
+ this._instruction().set(instruction);
9748
+ });
9749
+ }
9750
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiInstructionModalCreateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9751
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: CuiInstructionModalCreateComponent, isStandalone: true, selector: "ng-component", inputs: { initialUtility: { classPropertyName: "initialUtility", publicName: "initialUtility", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<cui-utility-modal-create [initialUtility]=\"instruction()\">\n <cui-instruction-info\n [instruction]=\"instruction()\"\n [tools]=\"tools\"\n [editorResourceUrl]=\"editorResourceUrl\"\n (validationChanged)=\"isFormValid.set($event)\"\n (instructionCreated)=\"onInstructionCreated($event)\"\n />\n</cui-utility-modal-create>\n", dependencies: [{ kind: "ngmodule", type: CuiButtonModule }, { kind: "ngmodule", type: CuiSvgModule }, { kind: "component", type: CuiUtilityModalCreateComponent, selector: "cui-utility-modal-create", inputs: ["initialUtility"] }, { kind: "component", type: CuiInstructionInfoComponent, selector: "cui-instruction-info", inputs: ["instruction", "tools", "editorResourceUrl"], outputs: ["instructionChange", "validationChanged", "instructionCreated"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9752
+ }
9753
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiInstructionModalCreateComponent, decorators: [{
9754
+ type: Component,
9755
+ args: [{ imports: [CuiButtonModule, CuiSvgModule, CuiUtilityModalCreateComponent, CuiInstructionInfoComponent], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<cui-utility-modal-create [initialUtility]=\"instruction()\">\n <cui-instruction-info\n [instruction]=\"instruction()\"\n [tools]=\"tools\"\n [editorResourceUrl]=\"editorResourceUrl\"\n (validationChanged)=\"isFormValid.set($event)\"\n (instructionCreated)=\"onInstructionCreated($event)\"\n />\n</cui-utility-modal-create>\n" }]
9756
+ }] });
9757
+
9758
+ class CuiReadonlyUtilityModalComponent {
9759
+ constructor() {
9760
+ this.destroyRef = inject(DestroyRef);
9761
+ this.cuiDialogContext = inject(CUI_DIALOG_CONTEXT);
9762
+ this.utilityModalService = inject(UTILITY_MODAL_SERVICE_TOKEN);
9763
+ this.editorResourceUrl = this.cuiDialogContext.data.editorResourceUrl;
9764
+ this.tools = this.cuiDialogContext.data.tools;
9765
+ this.header = this.cuiDialogContext.data.header;
9766
+ this.isLoading = signal(false);
9767
+ this.utility = input.required();
9768
+ this.utilityUnbinded = output();
9769
+ }
9770
+ onClose() {
9771
+ this.cuiDialogContext.completeWith();
9772
+ }
9773
+ onUnbind() {
9774
+ this.isLoading.set(true);
9775
+ this.utilityModalService.unbindUtility(this.utility().id)
9776
+ .pipe(takeUntilDestroyed(this.destroyRef), finalize(() => this.isLoading.set(false)))
9777
+ .subscribe((utility) => {
9778
+ this.utilityUnbinded.emit(utility);
9779
+ });
9780
+ }
9781
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiReadonlyUtilityModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9782
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: CuiReadonlyUtilityModalComponent, isStandalone: true, selector: "cui-readonly-utility-modal", inputs: { utility: { classPropertyName: "utility", publicName: "utility", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { utilityUnbinded: "utilityUnbinded" }, ngImport: i0, template: "<ng-container *transloco=\"let t\">\n <header class=\"header\">\n <ng-container [ngTemplateOutlet]=\"header\" />\n\n <cui-badge\n color=\"violet\"\n class=\"badge\"\n >\n <cui-svg\n class=\"icon\"\n icon=\"cuiIconVariant\"\n color=\"var(--cui-violet-400)\"\n />\n {{ t('INSERTED') }}\n </cui-badge>\n\n <button\n type=\"button\"\n cuiButton\n appearance=\"ghost\"\n icon=\"cuiIconX\"\n class=\"button\"\n (click)=\"onClose()\"\n ></button>\n </header>\n\n <ng-content />\n\n <div class=\"actions\">\n <button\n type=\"button\"\n #button\n cuiButton\n size=\"sm\"\n icon=\"cuiIconLinkBroken\"\n appearance=\"action-violet\"\n [isLoaderShown]=\"isLoading()\"\n (click)=\"onUnbind()\"\n >\n {{ t('UNBIND') }}\n </button>\n </div>\n</ng-container>\n", styles: [".header{display:flex;gap:8px;align-items:center;padding:16px 24px}.header__title{font-weight:500;font-size:16px;line-height:24px}.button{margin-left:auto}.actions{padding:16px;border-top:1px solid var(--cui-base-200)}.badge{display:flex;gap:4px;align-items:center;font-weight:500;font-size:14px;line-height:20px}\n"], dependencies: [{ kind: "ngmodule", type: CuiBadgeModule }, { kind: "component", type: CuiBadgeComponent, selector: "cui-badge", inputs: ["color", "size", "isWithDot"] }, { kind: "ngmodule", type: CuiButtonModule }, { kind: "component", type: CuiButtonComponent, selector: "button[cuiButton], a[cuiButton]", inputs: ["shape", "disabled", "isLoaderShown", "icon", "iconRight", "appearance", "size"] }, { kind: "ngmodule", type: CuiSvgModule }, { kind: "component", type: CuiSvgComponent, selector: "cui-svg[icon]", inputs: ["width", "height", "strokeWidth", "color", "icon"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9783
+ }
9784
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiReadonlyUtilityModalComponent, decorators: [{
9785
+ type: Component,
9786
+ args: [{ selector: 'cui-readonly-utility-modal', imports: [CuiBadgeModule, CuiButtonModule, CuiSvgModule, NgTemplateOutlet, TranslocoDirective], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t\">\n <header class=\"header\">\n <ng-container [ngTemplateOutlet]=\"header\" />\n\n <cui-badge\n color=\"violet\"\n class=\"badge\"\n >\n <cui-svg\n class=\"icon\"\n icon=\"cuiIconVariant\"\n color=\"var(--cui-violet-400)\"\n />\n {{ t('INSERTED') }}\n </cui-badge>\n\n <button\n type=\"button\"\n cuiButton\n appearance=\"ghost\"\n icon=\"cuiIconX\"\n class=\"button\"\n (click)=\"onClose()\"\n ></button>\n </header>\n\n <ng-content />\n\n <div class=\"actions\">\n <button\n type=\"button\"\n #button\n cuiButton\n size=\"sm\"\n icon=\"cuiIconLinkBroken\"\n appearance=\"action-violet\"\n [isLoaderShown]=\"isLoading()\"\n (click)=\"onUnbind()\"\n >\n {{ t('UNBIND') }}\n </button>\n </div>\n</ng-container>\n", styles: [".header{display:flex;gap:8px;align-items:center;padding:16px 24px}.header__title{font-weight:500;font-size:16px;line-height:24px}.button{margin-left:auto}.actions{padding:16px;border-top:1px solid var(--cui-base-200)}.badge{display:flex;gap:4px;align-items:center;font-weight:500;font-size:14px;line-height:20px}\n"] }]
9787
+ }] });
9788
+
9789
+ class CuiReadonlyCriterionModalComponent {
9790
+ constructor() {
9791
+ this.cuiDialogContext = inject(CUI_DIALOG_CONTEXT);
9792
+ this.cuiRenderDynamicComponentsService = inject(CuiRenderDynamicComponentsService);
9793
+ this.editorResourceUrl = this.cuiDialogContext.data.editorResourceUrl;
9794
+ this.tools = this.cuiDialogContext.data.tools;
9795
+ this.header = this.cuiDialogContext.data.header;
9796
+ this.isLoading = signal(false);
9797
+ this.framerId = computed(() => this.criterion().storageElement.framerCriterionId);
9798
+ this.criterion = input.required();
9799
+ }
9800
+ onUnbind(criterion) {
9801
+ this.cuiRenderDynamicComponentsService.closeAll();
9802
+ this.cuiRenderDynamicComponentsService.open({
9803
+ component: CuiCriterionModalCreateComponent,
9804
+ inputs: { criterion }
9805
+ });
9806
+ }
9807
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiReadonlyCriterionModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9808
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: CuiReadonlyCriterionModalComponent, isStandalone: true, selector: "cui-readonly-criterion-modal", inputs: { criterion: { classPropertyName: "criterion", publicName: "criterion", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<cui-readonly-utility-modal\n [utility]=\"criterion()\"\n (utilityUnbinded)=\"onUnbind($event)\"\n>\n <ng-container *transloco=\"let t\">\n <div\n #scrollContainer\n class=\"info\"\n >\n <h3 class=\"title\">{{ criterion().storageElement.title }}</h3>\n\n <cui-criterion-readonly-info\n [framerId]=\"framerId()\"\n [editorResourceUrl]=\"editorResourceUrl\"\n [tools]=\"tools\"\n [element]=\"scrollContainer\"\n class=\"info__block\"\n />\n </div>\n </ng-container>\n</cui-readonly-utility-modal>\n", styles: [".info{padding:16px 8px;display:flex;flex-direction:column;height:calc(100vh - 177px);overflow:auto}.info__block{overflow:visible}.title{padding-right:16px;padding-left:16px;font-weight:500;font-size:16px;line-height:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;overflow:visible}\n"], dependencies: [{ kind: "ngmodule", type: CuiBadgeModule }, { kind: "ngmodule", type: CuiButtonModule }, { kind: "ngmodule", type: CuiSvgModule }, { kind: "component", type: CuiCriterionReadonlyInfoComponent, selector: "cui-criterion-readonly-info", inputs: ["framerId", "element", "tools", "editorResourceUrl"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: CuiReadonlyUtilityModalComponent, selector: "cui-readonly-utility-modal", inputs: ["utility"], outputs: ["utilityUnbinded"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9809
+ }
9810
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiReadonlyCriterionModalComponent, decorators: [{
9811
+ type: Component,
9812
+ args: [{ selector: 'cui-readonly-criterion-modal', imports: [
9813
+ CuiBadgeModule,
9814
+ CuiButtonModule,
9815
+ CuiSvgModule,
9816
+ CuiCriterionReadonlyInfoComponent,
9817
+ TranslocoDirective,
9818
+ CuiReadonlyUtilityModalComponent
9819
+ ], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<cui-readonly-utility-modal\n [utility]=\"criterion()\"\n (utilityUnbinded)=\"onUnbind($event)\"\n>\n <ng-container *transloco=\"let t\">\n <div\n #scrollContainer\n class=\"info\"\n >\n <h3 class=\"title\">{{ criterion().storageElement.title }}</h3>\n\n <cui-criterion-readonly-info\n [framerId]=\"framerId()\"\n [editorResourceUrl]=\"editorResourceUrl\"\n [tools]=\"tools\"\n [element]=\"scrollContainer\"\n class=\"info__block\"\n />\n </div>\n </ng-container>\n</cui-readonly-utility-modal>\n", styles: [".info{padding:16px 8px;display:flex;flex-direction:column;height:calc(100vh - 177px);overflow:auto}.info__block{overflow:visible}.title{padding-right:16px;padding-left:16px;font-weight:500;font-size:16px;line-height:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;overflow:visible}\n"] }]
9820
+ }] });
9821
+
9822
+ class CuiReadonlyInstructionModalComponent {
9823
+ constructor() {
9824
+ this.cuiDialogContext = inject(CUI_DIALOG_CONTEXT);
9825
+ this.cuiRenderDynamicComponentsService = inject(CuiRenderDynamicComponentsService);
9826
+ this.editorResourceUrl = this.cuiDialogContext.data.editorResourceUrl;
9827
+ this.tools = this.cuiDialogContext.data.tools;
9828
+ this.header = this.cuiDialogContext.data.header;
9829
+ this.isLoading = signal(false);
9830
+ this.framerId = computed(() => this.instruction().storageElement.framerInstructionId);
9831
+ this.instruction = input.required();
9832
+ }
9833
+ onUnbind(instruction) {
9834
+ this.cuiRenderDynamicComponentsService.closeAll();
9835
+ this.cuiRenderDynamicComponentsService.open({
9836
+ component: CuiInstructionModalCreateComponent,
9837
+ inputs: { initialUtility: instruction }
9838
+ });
9839
+ }
9840
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiReadonlyInstructionModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9841
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: CuiReadonlyInstructionModalComponent, isStandalone: true, selector: "cui-readonly-instruction-modal", inputs: { instruction: { classPropertyName: "instruction", publicName: "instruction", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<ng-container *transloco=\"let t\">\n <cui-readonly-utility-modal [utility]=\"instruction()\" (utilityUnbinded)=\"onUnbind($event)\">\n <div\n #scrollContainer\n class=\"info\"\n >\n <h3 class=\"title\">{{ instruction().storageElement.title }}</h3>\n\n <cui-instruction-readonly-info\n [framerId]=\"framerId()\"\n [editorResourceUrl]=\"editorResourceUrl\"\n [tools]=\"tools\"\n [element]=\"scrollContainer\"\n class=\"info__block\"\n />\n </div>\n </cui-readonly-utility-modal>\n</ng-container>\n", styles: [".info{padding:16px 8px;display:flex;flex-direction:column;height:calc(100vh - 177px);overflow:auto}.info__block{overflow:visible}.title{padding-right:16px;padding-left:16px;font-weight:500;font-size:16px;line-height:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;overflow:visible}\n"], dependencies: [{ kind: "ngmodule", type: CuiBadgeModule }, { kind: "ngmodule", type: CuiButtonModule }, { kind: "ngmodule", type: CuiSvgModule }, { kind: "component", type: CuiInstructionReadonlyInfoComponent, selector: "cui-instruction-readonly-info", inputs: ["framerId", "element", "tools", "editorResourceUrl"] }, { kind: "directive", type: TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }, { kind: "component", type: CuiReadonlyUtilityModalComponent, selector: "cui-readonly-utility-modal", inputs: ["utility"], outputs: ["utilityUnbinded"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9842
+ }
9843
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiReadonlyInstructionModalComponent, decorators: [{
9844
+ type: Component,
9845
+ args: [{ selector: 'cui-readonly-instruction-modal', imports: [
9846
+ CuiBadgeModule,
9847
+ CuiButtonModule,
9848
+ CuiSvgModule,
9849
+ CuiInstructionReadonlyInfoComponent,
9850
+ TranslocoDirective,
9851
+ CuiReadonlyUtilityModalComponent
9852
+ ], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *transloco=\"let t\">\n <cui-readonly-utility-modal [utility]=\"instruction()\" (utilityUnbinded)=\"onUnbind($event)\">\n <div\n #scrollContainer\n class=\"info\"\n >\n <h3 class=\"title\">{{ instruction().storageElement.title }}</h3>\n\n <cui-instruction-readonly-info\n [framerId]=\"framerId()\"\n [editorResourceUrl]=\"editorResourceUrl\"\n [tools]=\"tools\"\n [element]=\"scrollContainer\"\n class=\"info__block\"\n />\n </div>\n </cui-readonly-utility-modal>\n</ng-container>\n", styles: [".info{padding:16px 8px;display:flex;flex-direction:column;height:calc(100vh - 177px);overflow:auto}.info__block{overflow:visible}.title{padding-right:16px;padding-left:16px;font-weight:500;font-size:16px;line-height:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;overflow:visible}\n"] }]
9853
+ }] });
9854
+
9855
+ class CuiUtilityModalComponent {
9856
+ constructor() {
9857
+ this.cuiDialogContext = inject(CUI_DIALOG_CONTEXT);
9858
+ this.cuiRenderDynamicComponentsService = inject(CuiRenderDynamicComponentsService);
9859
+ this.utility = this.cuiDialogContext.data.utility;
9860
+ this.initialComponent = this.cuiDialogContext.data.initialComponent;
9861
+ this.cuiRenderDynamicComponentsService.open({
9862
+ component: this.initialComponent,
9863
+ inputs: { initialUtility: this.utility }
9864
+ });
9865
+ }
9866
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiUtilityModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9867
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: CuiUtilityModalComponent, isStandalone: true, selector: "cui-utility-modal", providers: [CuiRenderDynamicComponentsService], ngImport: i0, template: "<cui-render-dynamic-components />\n", styles: [".host{display:block;height:calc(100vh - 40px)}\n"], dependencies: [{ kind: "component", type: CuiRenderDynamicComponentsComponent, selector: "cui-render-dynamic-components" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9868
+ }
9869
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiUtilityModalComponent, decorators: [{
9870
+ type: Component,
9871
+ args: [{ selector: 'cui-utility-modal', imports: [CuiRenderDynamicComponentsComponent], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [CuiRenderDynamicComponentsService], template: "<cui-render-dynamic-components />\n", styles: [".host{display:block;height:calc(100vh - 40px)}\n"] }]
9872
+ }], ctorParameters: () => [] });
9873
+
9874
+ class CuiCriterionInfoComponent {
9875
+ constructor() {
9876
+ this.destroyRef = inject(DestroyRef);
9877
+ this.translocoService = inject(TranslocoService);
9878
+ this.cuiIdService = inject(CuiIdService);
9879
+ this.cuiCategoriesModalService = inject(CuiSelectedCategoryService);
9880
+ this.treeStructNavigatorApiService = inject(CuiTreeStructNavigatorApiService);
9881
+ this.criterionApiService = inject(UTILITY_MODAL_SERVICE_TOKEN);
9882
+ this.skipCategoryChange = false;
9883
+ this.TYPE = "CRITERION_STORAGE" /* TreeStructType.Criteria */;
9884
+ this.categoryId = this.cuiIdService.generate();
9885
+ this.category = this.cuiCategoriesModalService.category;
9886
+ this.isFormValid = signal(false);
9887
+ this.prevCategoryId = signal(null);
9888
+ this.editorConfig = signal(null);
9889
+ this.labelColor = computed(() => this.category()?.title ? 'var(--cui-base-900)' : 'var(--cui-base-400)');
9890
+ this.selectTitle = computed(() => this.category()?.title ?? this.translocoService.translate('SELECT') + '...');
9891
+ this.element = viewChild('scrollContent');
9892
+ this.criterion = model();
9893
+ this.tools = input.required();
9894
+ this.editorResourceUrl = input.required();
9895
+ this.validationChanged = output();
9896
+ this.criterionCreated = output();
9897
+ this.initConfigEffect();
9898
+ this.initCategoryEffect();
9899
+ }
9900
+ ngOnInit() {
9901
+ this.initCategory();
9902
+ }
9903
+ onFormChanged(values, criterionId) {
9904
+ const actions = {
9905
+ title: (title) => this.changeTitle(title, criterionId)
9906
+ };
9907
+ forkJoin(Object.keys(values).map((key) => actions[key](values[key] || '')))
9908
+ .pipe(takeUntilDestroyed(this.destroyRef))
9909
+ .subscribe();
9910
+ }
9911
+ onFormValidationChanged(isValid) {
9912
+ this.isFormValid.set(isValid);
9913
+ this.validationChanged.emit(isValid);
9914
+ }
9915
+ initCategoryEffect() {
9916
+ effect(() => {
9917
+ const category = this.category();
9918
+ const storageObjectCriterion = untracked(this.criterion);
9919
+ if (!category || this.skipCategoryChange) {
9920
+ this.skipCategoryChange = false;
9921
+ return;
9922
+ }
9923
+ if (storageObjectCriterion) {
9924
+ this.changeCategory(category.id, storageObjectCriterion.id);
9925
+ return;
9926
+ }
9927
+ this.createCriterion(category.id);
9928
+ });
9929
+ }
9930
+ initConfigEffect() {
9931
+ effect(() => {
9932
+ const element = this.element()?.nativeElement;
9933
+ if (!element) {
9934
+ return;
9935
+ }
9936
+ this.editorConfig.set({ tools: this.tools(), element });
9937
+ });
9938
+ }
9939
+ initCategory() {
9940
+ const storageObjectId = this.criterion()?.id;
9941
+ if (!storageObjectId) {
9942
+ return;
9943
+ }
9944
+ this.treeStructNavigatorApiService
9945
+ .getCategory(storageObjectId, "CRITERION_STORAGE" /* TreeStructType.Criteria */)
9946
+ .pipe(takeUntilDestroyed(this.destroyRef))
9947
+ .subscribe((category) => {
9948
+ this.skipCategoryChange = true;
9949
+ this.prevCategoryId.set(category.id);
9950
+ this.cuiCategoriesModalService.setCurrentCategory(category);
9951
+ });
9952
+ }
9953
+ changeCategory(categoryId, targetId) {
9954
+ const prevCategoryId = untracked(this.prevCategoryId);
9955
+ if (!prevCategoryId) {
9956
+ return;
9957
+ }
9958
+ this.subscription?.unsubscribe();
9959
+ this.subscription = this.treeStructNavigatorApiService
9960
+ .moveElement({
9961
+ type: "MOVING_TARGET_TREE_STRUCT" /* MovingType.TARGET_TREE_STRUCT */,
9962
+ movableItemId: targetId,
9963
+ treeStructTargetItemId: categoryId,
9964
+ treeStructMovableItemId: prevCategoryId
9965
+ })
9966
+ .subscribe(() => this.prevCategoryId.set(categoryId));
9967
+ }
9968
+ createCriterion(categoryId) {
9969
+ this.criterionCreated.emit(categoryId);
9970
+ this.prevCategoryId.set(categoryId);
9971
+ }
9972
+ changeTitle(value, criterionId) {
9973
+ return this.criterionApiService.changeTitle(criterionId, value).pipe(finalize(() => this.criterion.update((prev) => ({
9974
+ ...prev,
9975
+ storageElement: { ...prev.storageElement, title: value }
9976
+ }))));
9977
+ }
9978
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiCriterionInfoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9979
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: CuiCriterionInfoComponent, isStandalone: true, selector: "cui-criterion-info", inputs: { criterion: { classPropertyName: "criterion", publicName: "criterion", isSignal: true, isRequired: false, transformFunction: null }, tools: { classPropertyName: "tools", publicName: "tools", isSignal: true, isRequired: true, transformFunction: null }, editorResourceUrl: { classPropertyName: "editorResourceUrl", publicName: "editorResourceUrl", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { criterion: "criterionChange", validationChanged: "validationChanged", criterionCreated: "criterionCreated" }, providers: [CuiSelectedCategoryService], viewQueries: [{ propertyName: "element", first: true, predicate: ["scrollContent"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n class=\"wrapper\"\n *transloco=\"let t\"\n>\n <div\n #scrollContent\n class=\"content content_scrollable\"\n >\n <div class=\"category\">\n <cui-form-field>\n <label\n cuiLabel\n [for]=\"categoryId\"\n [isRequired]=\"true\"\n >\n {{ t('SELECT_CATEGORY') }}\n </label>\n <cui-categories\n [buttonId]=\"categoryId\"\n [treeStructType]=\"TYPE\"\n >\n <div class=\"select\">\n <span [style.color]=\"labelColor()\">\n {{ selectTitle() }}\n </span>\n\n <cui-svg icon=\"cuiIconChevronDown\" />\n </div>\n </cui-categories>\n </cui-form-field>\n </div>\n\n @let criterionData = criterion();\n @let editorConfigData = editorConfig();\n\n @if (editorConfigData && criterionData) {\n <cui-criterion-info-form\n [config]=\"editorConfigData\"\n [baseResourceUrl]=\"editorResourceUrl()\"\n [title]=\"criterionData.storageElement.title\"\n [framerId]=\"criterionData.storageElement.framerCriterionId\"\n class=\"utility\"\n (isFormValidChanged)=\"onFormValidationChanged($event)\"\n (formChanged)=\"onFormChanged($event, criterionData.id)\"\n />\n }\n </div>\n</div>\n", styles: [".wrapper{display:flex;flex-direction:column;height:100%}.content{height:calc(100vh - 109px)}.content_scrollable{overflow:auto}.category{padding-top:16px;padding-right:23px;padding-left:23px}.select{padding:7px 13px;font-weight:400;font-size:14px;line-height:20px;display:flex;justify-content:space-between;height:36px;border-radius:8px;border:1px solid var(--cui-base-200);color:var(--cui-base-900);background:var(--cui-input)}.utility{--editor-height: none}\n"], dependencies: [{ kind: "ngmodule", type: CuiBadgeModule }, { kind: "ngmodule", type: CuiButtonModule }, { kind: "component", type: CuiCategoriesComponent, selector: "cui-categories", inputs: ["treeStructType", "buttonId", "disabled"] }, { kind: "ngmodule", type: CuiDialogModule }, { kind: "ngmodule", type: CuiFormFieldModule }, { kind: "component", type: CuiFormFieldComponent, selector: "cui-form-field" }, { kind: "component", type: CuiCriterionInfoFormComponent, selector: "cui-criterion-info-form", inputs: ["title", "framerId", "baseResourceUrl", "config"], outputs: ["formChanged", "isFormValidChanged"] }, { kind: "ngmodule", type: CuiLabelModule }, { kind: "component", type: CuiLabelComponent, selector: "label[cuiLabel]", inputs: ["isRequired"] }, { kind: "ngmodule", type: CuiSvgModule }, { kind: "component", type: CuiSvgComponent, selector: "cui-svg[icon]", inputs: ["width", "height", "strokeWidth", "color", "icon"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "directive", type: i4.TranslocoDirective, selector: "[transloco]", inputs: ["transloco", "translocoParams", "translocoScope", "translocoRead", "translocoPrefix", "translocoLang", "translocoLoadingTpl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9980
+ }
9981
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: CuiCriterionInfoComponent, decorators: [{
9982
+ type: Component,
9983
+ args: [{ selector: 'cui-criterion-info', imports: [
9984
+ CuiBadgeModule,
9985
+ CuiButtonModule,
9986
+ CuiCategoriesComponent,
9987
+ CuiDialogModule,
9988
+ CuiFormFieldModule,
9989
+ CuiCriterionInfoFormComponent,
9990
+ CuiLabelModule,
9991
+ CuiSvgModule,
9992
+ TranslocoModule
9993
+ ], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [CuiSelectedCategoryService], template: "<div\n class=\"wrapper\"\n *transloco=\"let t\"\n>\n <div\n #scrollContent\n class=\"content content_scrollable\"\n >\n <div class=\"category\">\n <cui-form-field>\n <label\n cuiLabel\n [for]=\"categoryId\"\n [isRequired]=\"true\"\n >\n {{ t('SELECT_CATEGORY') }}\n </label>\n <cui-categories\n [buttonId]=\"categoryId\"\n [treeStructType]=\"TYPE\"\n >\n <div class=\"select\">\n <span [style.color]=\"labelColor()\">\n {{ selectTitle() }}\n </span>\n\n <cui-svg icon=\"cuiIconChevronDown\" />\n </div>\n </cui-categories>\n </cui-form-field>\n </div>\n\n @let criterionData = criterion();\n @let editorConfigData = editorConfig();\n\n @if (editorConfigData && criterionData) {\n <cui-criterion-info-form\n [config]=\"editorConfigData\"\n [baseResourceUrl]=\"editorResourceUrl()\"\n [title]=\"criterionData.storageElement.title\"\n [framerId]=\"criterionData.storageElement.framerCriterionId\"\n class=\"utility\"\n (isFormValidChanged)=\"onFormValidationChanged($event)\"\n (formChanged)=\"onFormChanged($event, criterionData.id)\"\n />\n }\n </div>\n</div>\n", styles: [".wrapper{display:flex;flex-direction:column;height:100%}.content{height:calc(100vh - 109px)}.content_scrollable{overflow:auto}.category{padding-top:16px;padding-right:23px;padding-left:23px}.select{padding:7px 13px;font-weight:400;font-size:14px;line-height:20px;display:flex;justify-content:space-between;height:36px;border-radius:8px;border:1px solid var(--cui-base-200);color:var(--cui-base-900);background:var(--cui-input)}.utility{--editor-height: none}\n"] }]
9994
+ }], ctorParameters: () => [] });
9995
+
9249
9996
  /**
9250
9997
  * Generated bundle index. Do not edit.
9251
9998
  */
9252
9999
 
9253
- export { AngularOutsideLoaderService, CUI_ALERTS, CUI_ALERT_CONTEXT, CUI_ALERT_DEFAULT_OPTIONS, CUI_ALERT_OPTIONS, CUI_ANIMATIONS_DEFAULT_DURATION, CUI_BANNER_DEFAULT_OPTIONS, CUI_BANNER_OPTIONS, CUI_BUTTON_DEFAULT_OPTIONS, CUI_BUTTON_OPTIONS, CUI_DEFAULT_THEME, CUI_DIALOGS, CUI_DIALOG_CONTEXT, CUI_DIALOG_DEFAULT_OPTIONS, CUI_DIALOG_OPTIONS, CUI_INPUT_TIME_DEFAULT_OPTIONS, CUI_INPUT_TIME_OPTIONS, CUI_NOTIFICATION_DEFAULT_OPTIONS, CUI_NOTIFICATION_ICONS, CUI_NOTIFICATION_ICON_OPTIONS, CUI_NOTIFICATION_ICON_OPTIONS_DEFAULT_MODE, CUI_NOTIFICATION_ICON_OPTIONS_LIGHT_MODE, CUI_NOTIFICATION_OPTIONS, CUI_ROOT_SELECTOR, CUI_TAB_ACTIVATE, CUI_TEXT_FIELD_CONTROLLER, CUI_TEXT_FIELD_ICON_LEFT, CUI_TEXT_FIELD_ID, CUI_TEXT_FIELD_IS_ERROR, CUI_TEXT_FIELD_PLACEHOLDER, CUI_TEXT_FIELD_SIZE, CUI_TEXT_FILED_CONTROLLER_PROVIDER, CUI_THEME, CUI_THEME_STORAGE_DEFAULT_KEY, CUI_THEME_STORAGE_KEY, CUI_TOOLTIP_COMPONENT, CUI_TOOLTIP_DEFAULT_OPTIONS, CUI_TOOLTIP_DIRECTIONS, CUI_TOOLTIP_OPTIONS, CUI_TOOLTIP_PROVIDERS, CuiAccordionComponent, CuiAccordionDirective, CuiAccordionItemComponent, CuiAccordionModule, CuiAlertComponent, CuiAlertModule, CuiAlertService, CuiAlertsComponent, CuiAttachesTool, CuiAuthBase, CuiAuthService, CuiBadgeComponent, CuiBadgeModule, CuiBannerComponent, CuiBannerModule, CuiBreadcrumbComponent, CuiBreadcrumbsComponent, CuiBreadcrumbsModule, CuiButtonComponent, CuiButtonGroupComponent, CuiButtonGroupModule, CuiButtonModule, CuiCardWrapperComponent, CuiCategoriesComponent, CuiCheckboxComponent, CuiCheckboxModule, CuiChecklistBlockComponent, CuiContentWrapperComponent, CuiContextMenuComponent, CuiContextMenuModule, CuiDeleteModalComponent, CuiDialogActionsComponent, CuiDialogComponent, CuiDialogHeaderComponent, CuiDialogModule, CuiDialogService, CuiDialogsComponent, CuiDropdownDirective, CuiDropdownWrapperComponent, CuiEditorBlockComponent, CuiEditorComponent, CuiEditorModalComponent, CuiEditorReadonlyComponent, CuiEditorTranslations, CuiEmptyStateComponent, CuiFileUploaderStatus, CuiFormFieldComponent, CuiFormFieldModule, CuiGeneralControlErrorHintComponent, CuiGhostInputComponent, CuiHeaderTool, CuiHintComponent, CuiHintModule, CuiIconButtonComponent, CuiIconButtonModule, CuiImageTool, CuiInputModule, CuiInputNumberComponent, CuiInputNumberModule, CuiInputPasswordComponent, CuiInputPasswordModule, CuiInputTextComponent, CuiInputTimeComponent, CuiInputTimeModule, CuiLabelComponent, CuiLabelModule, CuiLayoutComponent, CuiLetterBoxComponent, CuiLinkMarker, CuiListTool, CuiLoaderComponent, CuiLoaderService, CuiLoadingState, CuiNotificationComponent, CuiNotificationModule, CuiPositionService, CuiRadioComponent, CuiRadioModule, CuiRenderDynamicComponentsComponent, CuiRenderDynamicComponentsService, CuiRoleMarker, CuiRootComponent, CuiRootModule, CuiSelectComponent, CuiSelectModule, CuiSelectedCategoryService, CuiSidebarContainerComponent, CuiSidebarHeaderComponent, CuiSidebarNavigationComponent, CuiSidebarNavigationContainerComponent, CuiSidebarNavigationItemComponent, CuiSidebarService, CuiSvgComponent, CuiSvgModule, CuiTabComponent, CuiTabsComponent, CuiTabsModule, CuiTextFieldController, CuiTextFieldControllerModule, CuiTextFieldIconLeftDirective, CuiTextFieldIdDirective, CuiTextFieldIsErrorDirective, CuiTextFieldPlaceholderDirective, CuiTextFieldSizeDirective, CuiTextareaComponent, CuiTextareaModule, CuiThemeService, CuiToggleComponent, CuiToggleModule, CuiToolMarker, CuiTooltip, CuiTooltipComponent, CuiTooltipDescribe, CuiTooltipDirective, CuiTooltipDriver, CuiTooltipHost, CuiTooltipHover, CuiTooltipManual, CuiTooltipOptionsDirective, CuiTooltipOverflow, CuiTooltipPointer, CuiTooltipPosition, CuiTooltipService, CuiTooltipUnstyled, CuiTooltipUnstyledComponent, CuiTooltips, CuiUtilityInfoComponent, CuiVideoTool, CuiVisualViewportService, cuiAuthInterceptor, cuiCreateDefaultValidators, cuiErrorHandlerInterceptor, cuiGetDuration, cuiIsObscured, cuiLoaderInterceptor, cuiOverrideOptions, cuiProvideEditor, cuiRemoveSpaces, cuiReplace, cuiToAnimationOptions, cuiTooltipOptionsProvider, cuiXNdjsonInterceptor, provideCuiAuth };
10000
+ export { AngularOutsideLoaderService, CUI_ALERTS, CUI_ALERT_CONTEXT, CUI_ALERT_DEFAULT_OPTIONS, CUI_ALERT_OPTIONS, CUI_ANIMATIONS_DEFAULT_DURATION, CUI_BANNER_DEFAULT_OPTIONS, CUI_BANNER_OPTIONS, CUI_BUTTON_DEFAULT_OPTIONS, CUI_BUTTON_OPTIONS, CUI_DEFAULT_THEME, CUI_DIALOGS, CUI_DIALOG_CONTEXT, CUI_DIALOG_DEFAULT_OPTIONS, CUI_DIALOG_OPTIONS, CUI_INPUT_TIME_DEFAULT_OPTIONS, CUI_INPUT_TIME_OPTIONS, CUI_NOTIFICATION_DEFAULT_OPTIONS, CUI_NOTIFICATION_ICONS, CUI_NOTIFICATION_ICON_OPTIONS, CUI_NOTIFICATION_ICON_OPTIONS_DEFAULT_MODE, CUI_NOTIFICATION_ICON_OPTIONS_LIGHT_MODE, CUI_NOTIFICATION_OPTIONS, CUI_ROOT_SELECTOR, CUI_TAB_ACTIVATE, CUI_TEXT_FIELD_CONTROLLER, CUI_TEXT_FIELD_ICON_LEFT, CUI_TEXT_FIELD_ID, CUI_TEXT_FIELD_IS_ERROR, CUI_TEXT_FIELD_PLACEHOLDER, CUI_TEXT_FIELD_SIZE, CUI_TEXT_FILED_CONTROLLER_PROVIDER, CUI_THEME, CUI_THEME_STORAGE_DEFAULT_KEY, CUI_THEME_STORAGE_KEY, CUI_TOOLTIP_COMPONENT, CUI_TOOLTIP_DEFAULT_OPTIONS, CUI_TOOLTIP_DIRECTIONS, CUI_TOOLTIP_OPTIONS, CUI_TOOLTIP_PROVIDERS, CuiAccordionComponent, CuiAccordionDirective, CuiAccordionItemComponent, CuiAccordionModule, CuiAlertComponent, CuiAlertModule, CuiAlertService, CuiAlertsComponent, CuiAttachesTool, CuiAuthBase, CuiAuthService, CuiBadgeComponent, CuiBadgeModule, CuiBannerComponent, CuiBannerModule, CuiBreadcrumbComponent, CuiBreadcrumbsComponent, CuiBreadcrumbsModule, CuiButtonComponent, CuiButtonGroupComponent, CuiButtonGroupModule, CuiButtonModule, CuiCardWrapperComponent, CuiCategoriesComponent, CuiCheckboxComponent, CuiCheckboxModule, CuiChecklistBlockComponent, CuiContentWrapperComponent, CuiContextMenuComponent, CuiContextMenuModule, CuiCriterionInfoComponent, CuiCriterionModalCreateComponent, CuiCriterionReadonlyInfoComponent, CuiDeleteModalComponent, CuiDialogActionsComponent, CuiDialogComponent, CuiDialogHeaderComponent, CuiDialogModule, CuiDialogService, CuiDialogsComponent, CuiDropdownDirective, CuiDropdownWrapperComponent, CuiEditorBlockComponent, CuiEditorComponent, CuiEditorModalComponent, CuiEditorReadonlyComponent, CuiEditorTranslations, CuiEmptyStateComponent, CuiFileUploaderStatus, CuiFormFieldComponent, CuiFormFieldModule, CuiGeneralControlErrorHintComponent, CuiGhostInputComponent, CuiHeaderTool, CuiHintComponent, CuiHintModule, CuiIconButtonComponent, CuiIconButtonModule, CuiImageTool, CuiInputModule, CuiInputNumberComponent, CuiInputNumberModule, CuiInputPasswordComponent, CuiInputPasswordModule, CuiInputTextComponent, CuiInputTimeComponent, CuiInputTimeModule, CuiInstructionInfoComponent, CuiInstructionModalCreateComponent, CuiInstructionReadonlyInfoComponent, CuiLabelComponent, CuiLabelModule, CuiLayoutComponent, CuiLetterBoxComponent, CuiLinkMarker, CuiListTool, CuiLoaderComponent, CuiLoaderService, CuiLoadingState, CuiNotificationComponent, CuiNotificationModule, CuiPositionService, CuiRadioComponent, CuiRadioModule, CuiReadonlyCriterionModalComponent, CuiReadonlyInstructionModalComponent, CuiRenderDynamicComponentsComponent, CuiRenderDynamicComponentsService, CuiRoleMarker, CuiRootComponent, CuiRootModule, CuiSelectComponent, CuiSelectModule, CuiSelectedCategoryService, CuiSidebarContainerComponent, CuiSidebarHeaderComponent, CuiSidebarNavigationComponent, CuiSidebarNavigationContainerComponent, CuiSidebarNavigationItemComponent, CuiSidebarService, CuiSvgComponent, CuiSvgModule, CuiTabComponent, CuiTabsComponent, CuiTabsModule, CuiTextFieldController, CuiTextFieldControllerModule, CuiTextFieldIconLeftDirective, CuiTextFieldIdDirective, CuiTextFieldIsErrorDirective, CuiTextFieldPlaceholderDirective, CuiTextFieldSizeDirective, CuiTextareaComponent, CuiTextareaModule, CuiThemeService, CuiToggleComponent, CuiToggleModule, CuiToolMarker, CuiTooltip, CuiTooltipComponent, CuiTooltipDescribe, CuiTooltipDirective, CuiTooltipDriver, CuiTooltipHost, CuiTooltipHover, CuiTooltipManual, CuiTooltipOptionsDirective, CuiTooltipOverflow, CuiTooltipPointer, CuiTooltipPosition, CuiTooltipService, CuiTooltipUnstyled, CuiTooltipUnstyledComponent, CuiTooltips, CuiUtilityModalComponent, CuiVideoTool, CuiVisualViewportService, UTILITY_MODAL_SERVICE_TOKEN, cuiAuthInterceptor, cuiCreateDefaultValidators, cuiErrorHandlerInterceptor, cuiGetDuration, cuiIsObscured, cuiLoaderInterceptor, cuiOverrideOptions, cuiProvideEditor, cuiRemoveSpaces, cuiReplace, cuiToAnimationOptions, cuiTooltipOptionsProvider, cuiXNdjsonInterceptor, provideCuiAuth };
9254
10001
  //# sourceMappingURL=cuby-ui-core.mjs.map