@testgorilla/tgo-ui 8.0.0 → 8.1.0

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.
@@ -96,11 +96,11 @@ class RatingComponent {
96
96
  this.hoverIndex = index + 1;
97
97
  }
98
98
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: RatingComponent, deps: [{ token: 'CANOPYUI_DEFAULT_APPLICATION_THEME', optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
99
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: RatingComponent, isStandalone: false, selector: "ui-rating", inputs: { applicationTheme: "applicationTheme", value: "value", theme: "theme", disabled: "disabled", ariaLabel: "ariaLabel", ariaRequired: "ariaRequired", barWidth: "barWidth", canUnselect: "canUnselect", length: "length" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: "<div class=\"rating\" (mouseleave)=\"onHover(-1)\" [attr.aria-label]=\"ariaLabel\" [attr.aria-required]=\"ariaRequired\">\n @if (theme === 'block') {\n @for (item of items; track item) {\n <div\n class=\"rating-item\"\n [attr.theme]=\"applicationTheme\"\n tabindex=\"0\"\n (click)=\"select(item)\"\n (keydown.enter)=\"select(item)\"\n (mouseenter)=\"onHover(item)\"\n [ngClass]=\"{ 'rating-item-selected': item < value, 'rating-item-hover': item < hoverIndex }\"\n [ngStyle]=\"{ 'width.px': barWidth }\"\n ></div>\n }\n } @else {\n <div class=\"star-container\" [attr.theme]=\"applicationTheme\">\n @for (item of items; track item; let i = $index) {\n <div\n #star\n class=\"star\"\n tabindex=\"0\"\n [tabIndex]=\"0\"\n (mouseenter)=\"onHover(item)\"\n (mouseleave)=\"onHover(-1)\"\n [ngClass]=\"{\n filled: value > i,\n hover: item < hoverIndex && (value ? item >= value : true),\n disabled,\n 'filled-half': i + 1 | halfStar: value,\n }\"\n (click)=\"select(item); star.blur()\"\n (keydown.enter)=\"select(item); star.blur()\"\n ></div>\n }\n </div>\n }\n</div>\n", styles: [".bg-teal-60b{background:#1c443c}.bg-teal-30b{background:#31766a}.bg-teal-default{background:#46a997}.bg-teal-30w{background:#7ec3b6}.bg-teal-60w{background:#b5ddd5}.bg-teal-secondary{background:#cbd6cb}.bg-teal-90w{background:#ecf6f5}.bg-petrol-60b{background:#102930}.bg-petrol-30b{background:#1b4754}.bg-petrol-default{background:#276678}.bg-petrol-30w{background:#6894a0}.bg-petrol-60w{background:#a9c2c9}.bg-petrol-secondary{background:#c8d7de}.bg-petrol-90w{background:#e9f0f1}.bg-error-60b{background:#513131}.bg-error-30b{background:#8e5655}.bg-error-60w{background:#e3c3c6}.bg-error-secondary{background:#f0dad9}.bg-error-default{background:#cb7b7a}.bg-warning-secondary{background:#f0d6bb}.bg-warning-default{background:#cca45f}.bg-black{background:#000}.bg-dark{background:#888}.bg-medium{background:#e0e0e0}.bg-grey{background:#ededed}.bg-light{background:#f6f6f6}.bg-white{background:#fff}.bg-box-shadow{background:#00000014}.bg-navigation-subtitle{background:#528593}.bgc-teal-60b{background-color:#1c443c}.bgc-teal-30b{background-color:#31766a}.bgc-teal-default{background-color:#46a997}.bgc-teal-30w{background-color:#7ec3b6}.bgc-teal-60w{background-color:#b5ddd5}.bgc-teal-secondary{background-color:#cbd6cb}.bgc-teal-90w{background-color:#ecf6f5}.bgc-petrol-60b{background-color:#102930}.bgc-petrol-30b{background-color:#1b4754}.bgc-petrol-default{background-color:#276678}.bgc-petrol-30w{background-color:#6894a0}.bgc-petrol-60w{background-color:#a9c2c9}.bgc-petrol-secondary{background-color:#c8d7de}.bgc-petrol-90w{background-color:#e9f0f1}.bgc-error-60b{background-color:#513131}.bgc-error-30b{background-color:#8e5655}.bgc-error-60w{background-color:#e3c3c6}.bgc-error-secondary{background-color:#f0dad9}.bgc-error-default{background-color:#cb7b7a}.bgc-warning-secondary{background-color:#f0d6bb}.bgc-warning-default{background-color:#cca45f}.bgc-black{background-color:#000}.bgc-dark{background-color:#888}.bgc-medium{background-color:#e0e0e0}.bgc-grey{background-color:#ededed}.bgc-light{background-color:#f6f6f6}.bgc-white{background-color:#fff}.bgc-box-shadow{background-color:#00000014}.bgc-navigation-subtitle{background-color:#528593}.rating{display:flex;align-content:center;justify-content:flex-start;align-items:center}.rating-item{width:35px;height:16px;border:1px solid #e0e0e0;border-left:0;cursor:pointer}.rating-item-hover{border:0;background-color:#b5ddd5}.rating-item-hover[theme=dark],.rating-item-hover[theme=light]{background-color:#ffb3ee}.rating-item-hover:not(:first-child){border-left:1px solid #ffffff}.rating-item:first-child{border-radius:4px 0 0 4px}.rating-item:first-child:not(.rating-item-selected):not(.rating-item-hover){border-left:1px solid #e0e0e0}.rating-item:last-child{border-radius:0 4px 4px 0}.rating-item:first-child:last-child{border-radius:4px}.rating-item-selected{border:0;background-color:#46a997}.rating-item-selected[theme=dark],.rating-item-selected[theme=light]{background-color:#d410aa}.rating-item-selected:not(:first-child){border-left:1px solid #ffffff}.rating .star-container{display:flex;flex-direction:row;min-height:24px}.rating .star-container .star{width:24px;height:24px;background:url(/icons/rating-icons/Star-outline.svg) no-repeat center;background-size:100%;margin-right:4px}.rating .star-container .star:last-child{margin-right:0}.rating .star-container .star:focus{outline:1px dashed #888888}.rating .star-container .star:hover,.rating .star-container .star.hover,.rating .star-container .star:focus{opacity:.5}.rating .star-container .star.filled-half{background-image:url(/icons/rating-icons/Star-half.svg)!important}.rating .star-container .star.disabled{pointer-events:none;background-image:url(/icons/rating-icons/Star-filled-disabled.svg)}.rating .star-container .star:active{opacity:1}.rating .star-container .star-filled,.rating .star-container[theme=dark] .star.filled,.rating .star-container[theme=light] .star.filled,.rating .star-container[theme=dark] .star:hover,.rating .star-container[theme=dark] .star.hover,.rating .star-container[theme=dark] .star:focus,.rating .star-container[theme=light] .star:hover,.rating .star-container[theme=light] .star.hover,.rating .star-container[theme=light] .star:focus,.rating .star-container .star:hover,.rating .star-container .star.hover,.rating .star-container .star:focus,.rating .star-container .star.filled,.rating .star-container .star:active{background-image:url(/icons/rating-icons/Star-filled.svg)}.rating .star-container[theme=dark] .star,.rating .star-container[theme=light] .star{cursor:pointer;background:url(/icons/rebrand/Review-star-in-line.svg) no-repeat center}.rating .star-container[theme=dark] .star:hover,.rating .star-container[theme=dark] .star.hover,.rating .star-container[theme=dark] .star:focus,.rating .star-container[theme=light] .star:hover,.rating .star-container[theme=light] .star.hover,.rating .star-container[theme=light] .star:focus{opacity:.5}.rating .star-container[theme=dark] .star:focus,.rating .star-container[theme=light] .star:focus{outline-offset:4px}.rating .star-container[theme=dark] .star.filled-half,.rating .star-container[theme=light] .star.filled-half{background-image:url(/icons/rebrand/Review-half-star-filled.svg)!important}.rating .star-container[theme=dark] .star.disabled,.rating .star-container[theme=light] .star.disabled{background-image:url(/icons/rebrand/Review-star-filled-disabled.svg)}.rating .star-container[theme=dark] .star-filled,.rating .star-container[theme=dark] .star:hover,.rating .star-container[theme=dark] .star.hover,.rating .star-container[theme=dark] .star:focus,.rating .star-container[theme=dark] .star.filled,.rating .star-container[theme=dark] .star:active,.rating .star-container[theme=light] .star-filled,.rating .star-container[theme=light] .star:hover,.rating .star-container[theme=light] .star.hover,.rating .star-container[theme=light] .star:focus,.rating .star-container[theme=light] .star.filled,.rating .star-container[theme=light] .star:active{background-image:url(/icons/rebrand/Review-star-filled.svg)}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "pipe", type: HalfStarPipe, name: "halfStar" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
99
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.20", type: RatingComponent, isStandalone: false, selector: "ui-rating", inputs: { applicationTheme: "applicationTheme", value: "value", theme: "theme", disabled: "disabled", ariaLabel: "ariaLabel", ariaRequired: "ariaRequired", barWidth: "barWidth", canUnselect: "canUnselect", length: "length" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: "<div class=\"rating\" (mouseleave)=\"onHover(-1)\" [attr.aria-label]=\"ariaLabel\" [attr.aria-required]=\"ariaRequired\">\n @if (theme === 'block') {\n @for (item of items; track item) {\n <div\n class=\"rating-item\"\n [attr.theme]=\"applicationTheme\"\n tabindex=\"0\"\n (click)=\"select(item)\"\n (keydown.enter)=\"select(item)\"\n (mouseenter)=\"onHover(item)\"\n [ngClass]=\"{ 'rating-item-selected': item < value, 'rating-item-hover': item < hoverIndex }\"\n [ngStyle]=\"{ 'width.px': barWidth }\"\n ></div>\n }\n } @else {\n <div class=\"star-container\" [attr.theme]=\"applicationTheme\">\n @for (item of items; track item; let i = $index) {\n <div\n #star\n class=\"star\"\n tabindex=\"0\"\n [tabIndex]=\"0\"\n (mouseenter)=\"onHover(item)\"\n (mouseleave)=\"onHover(-1)\"\n [ngClass]=\"{\n filled: value > i,\n hover: item < hoverIndex && (value ? item >= value : true),\n disabled,\n 'filled-half': i + 1 | halfStar: value,\n }\"\n (click)=\"select(item); star.blur()\"\n (keydown.enter)=\"select(item); star.blur()\"\n ></div>\n }\n </div>\n }\n</div>\n", styles: [".bg-teal-60b{background:#1c443c}.bg-teal-30b{background:#31766a}.bg-teal-default{background:#46a997}.bg-teal-30w{background:#7ec3b6}.bg-teal-60w{background:#b5ddd5}.bg-teal-secondary{background:#cbd6cb}.bg-teal-90w{background:#ecf6f5}.bg-petrol-60b{background:#102930}.bg-petrol-30b{background:#1b4754}.bg-petrol-default{background:#276678}.bg-petrol-30w{background:#6894a0}.bg-petrol-60w{background:#a9c2c9}.bg-petrol-secondary{background:#c8d7de}.bg-petrol-90w{background:#e9f0f1}.bg-error-60b{background:#513131}.bg-error-30b{background:#8e5655}.bg-error-60w{background:#e3c3c6}.bg-error-secondary{background:#f0dad9}.bg-error-default{background:#cb7b7a}.bg-warning-secondary{background:#f0d6bb}.bg-warning-default{background:#cca45f}.bg-black{background:#000}.bg-dark{background:#888}.bg-medium{background:#e0e0e0}.bg-grey{background:#ededed}.bg-light{background:#f6f6f6}.bg-white{background:#fff}.bg-box-shadow{background:#00000014}.bg-navigation-subtitle{background:#528593}.bgc-teal-60b{background-color:#1c443c}.bgc-teal-30b{background-color:#31766a}.bgc-teal-default{background-color:#46a997}.bgc-teal-30w{background-color:#7ec3b6}.bgc-teal-60w{background-color:#b5ddd5}.bgc-teal-secondary{background-color:#cbd6cb}.bgc-teal-90w{background-color:#ecf6f5}.bgc-petrol-60b{background-color:#102930}.bgc-petrol-30b{background-color:#1b4754}.bgc-petrol-default{background-color:#276678}.bgc-petrol-30w{background-color:#6894a0}.bgc-petrol-60w{background-color:#a9c2c9}.bgc-petrol-secondary{background-color:#c8d7de}.bgc-petrol-90w{background-color:#e9f0f1}.bgc-error-60b{background-color:#513131}.bgc-error-30b{background-color:#8e5655}.bgc-error-60w{background-color:#e3c3c6}.bgc-error-secondary{background-color:#f0dad9}.bgc-error-default{background-color:#cb7b7a}.bgc-warning-secondary{background-color:#f0d6bb}.bgc-warning-default{background-color:#cca45f}.bgc-black{background-color:#000}.bgc-dark{background-color:#888}.bgc-medium{background-color:#e0e0e0}.bgc-grey{background-color:#ededed}.bgc-light{background-color:#f6f6f6}.bgc-white{background-color:#fff}.bgc-box-shadow{background-color:#00000014}.bgc-navigation-subtitle{background-color:#528593}.rating{display:flex;align-content:center;justify-content:flex-start;align-items:center}.rating-item{width:35px;height:16px;border:1px solid #e0e0e0;border-left:0;cursor:pointer}.rating-item-hover{border:0;background-color:#b5ddd5}.rating-item-hover[theme=dark],.rating-item-hover[theme=light]{background-color:color-mix(in srgb,var(--ui-rating-color, #d410aa) 40%,#fff)}.rating-item-hover:not(:first-child){border-left:1px solid #ffffff}.rating-item:first-child{border-radius:4px 0 0 4px}.rating-item:first-child:not(.rating-item-selected):not(.rating-item-hover){border-left:1px solid #e0e0e0}.rating-item:last-child{border-radius:0 4px 4px 0}.rating-item:first-child:last-child{border-radius:4px}.rating-item-selected{border:0;background-color:#46a997}.rating-item-selected[theme=dark],.rating-item-selected[theme=light]{background-color:var(--ui-rating-color, #d410aa)}.rating-item-selected:not(:first-child){border-left:1px solid #ffffff}.rating .star-container{display:flex;flex-direction:row;min-height:24px}.rating .star-container .star{width:24px;height:24px;background:url(/icons/rating-icons/Star-outline.svg) no-repeat center;background-size:100%;margin-right:4px}.rating .star-container .star:last-child{margin-right:0}.rating .star-container .star:focus{outline:1px dashed #888888}.rating .star-container .star:hover,.rating .star-container .star.hover,.rating .star-container .star:focus{opacity:.5}.rating .star-container .star.filled-half{background-image:none;mask:url(/icons/rating-icons/Star-half.svg) no-repeat center/100%!important;background-color:var(--ui-rating-color, #d410aa)}.rating .star-container .star.disabled{pointer-events:none;background-image:url(/icons/rating-icons/Star-filled-disabled.svg)}.rating .star-container .star:active{opacity:1}.rating .star-container .star-filled,.rating .star-container[theme=dark] .star.filled,.rating .star-container[theme=light] .star.filled,.rating .star-container[theme=dark] .star:hover,.rating .star-container[theme=dark] .star.hover,.rating .star-container[theme=dark] .star:focus,.rating .star-container[theme=light] .star:hover,.rating .star-container[theme=light] .star.hover,.rating .star-container[theme=light] .star:focus,.rating .star-container .star:hover,.rating .star-container .star.hover,.rating .star-container .star:focus,.rating .star-container .star.filled,.rating .star-container .star:active{background-image:none;mask:url(/icons/rating-icons/Star-filled.svg) no-repeat center/100%;background-color:var(--ui-rating-color, #d410aa)}.rating .star-container[theme=dark] .star,.rating .star-container[theme=light] .star{cursor:pointer;background:url(/icons/rebrand/Review-star-in-line.svg) no-repeat center}.rating .star-container[theme=dark] .star:hover,.rating .star-container[theme=dark] .star.hover,.rating .star-container[theme=dark] .star:focus,.rating .star-container[theme=light] .star:hover,.rating .star-container[theme=light] .star.hover,.rating .star-container[theme=light] .star:focus{opacity:.5}.rating .star-container[theme=dark] .star:focus,.rating .star-container[theme=light] .star:focus{outline-offset:4px}.rating .star-container[theme=dark] .star.filled-half,.rating .star-container[theme=light] .star.filled-half{background-image:none;mask:url(/icons/rebrand/Review-half-star-filled.svg) no-repeat center/100%!important;background-color:var(--ui-rating-color, #d410aa)}.rating .star-container[theme=dark] .star.disabled,.rating .star-container[theme=light] .star.disabled{background-image:url(/icons/rebrand/Review-star-filled-disabled.svg)}.rating .star-container[theme=dark] .star-filled,.rating .star-container[theme=dark] .star:hover,.rating .star-container[theme=dark] .star.hover,.rating .star-container[theme=dark] .star:focus,.rating .star-container[theme=dark] .star.filled,.rating .star-container[theme=dark] .star:active,.rating .star-container[theme=light] .star-filled,.rating .star-container[theme=light] .star:hover,.rating .star-container[theme=light] .star.hover,.rating .star-container[theme=light] .star:focus,.rating .star-container[theme=light] .star.filled,.rating .star-container[theme=light] .star:active{background-image:none;mask:url(/icons/rebrand/Review-star-filled.svg) no-repeat center/100%;background-color:var(--ui-rating-color, #d410aa)}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "pipe", type: HalfStarPipe, name: "halfStar" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
100
100
  }
101
101
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.20", ngImport: i0, type: RatingComponent, decorators: [{
102
102
  type: Component,
103
- args: [{ selector: 'ui-rating', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class=\"rating\" (mouseleave)=\"onHover(-1)\" [attr.aria-label]=\"ariaLabel\" [attr.aria-required]=\"ariaRequired\">\n @if (theme === 'block') {\n @for (item of items; track item) {\n <div\n class=\"rating-item\"\n [attr.theme]=\"applicationTheme\"\n tabindex=\"0\"\n (click)=\"select(item)\"\n (keydown.enter)=\"select(item)\"\n (mouseenter)=\"onHover(item)\"\n [ngClass]=\"{ 'rating-item-selected': item < value, 'rating-item-hover': item < hoverIndex }\"\n [ngStyle]=\"{ 'width.px': barWidth }\"\n ></div>\n }\n } @else {\n <div class=\"star-container\" [attr.theme]=\"applicationTheme\">\n @for (item of items; track item; let i = $index) {\n <div\n #star\n class=\"star\"\n tabindex=\"0\"\n [tabIndex]=\"0\"\n (mouseenter)=\"onHover(item)\"\n (mouseleave)=\"onHover(-1)\"\n [ngClass]=\"{\n filled: value > i,\n hover: item < hoverIndex && (value ? item >= value : true),\n disabled,\n 'filled-half': i + 1 | halfStar: value,\n }\"\n (click)=\"select(item); star.blur()\"\n (keydown.enter)=\"select(item); star.blur()\"\n ></div>\n }\n </div>\n }\n</div>\n", styles: [".bg-teal-60b{background:#1c443c}.bg-teal-30b{background:#31766a}.bg-teal-default{background:#46a997}.bg-teal-30w{background:#7ec3b6}.bg-teal-60w{background:#b5ddd5}.bg-teal-secondary{background:#cbd6cb}.bg-teal-90w{background:#ecf6f5}.bg-petrol-60b{background:#102930}.bg-petrol-30b{background:#1b4754}.bg-petrol-default{background:#276678}.bg-petrol-30w{background:#6894a0}.bg-petrol-60w{background:#a9c2c9}.bg-petrol-secondary{background:#c8d7de}.bg-petrol-90w{background:#e9f0f1}.bg-error-60b{background:#513131}.bg-error-30b{background:#8e5655}.bg-error-60w{background:#e3c3c6}.bg-error-secondary{background:#f0dad9}.bg-error-default{background:#cb7b7a}.bg-warning-secondary{background:#f0d6bb}.bg-warning-default{background:#cca45f}.bg-black{background:#000}.bg-dark{background:#888}.bg-medium{background:#e0e0e0}.bg-grey{background:#ededed}.bg-light{background:#f6f6f6}.bg-white{background:#fff}.bg-box-shadow{background:#00000014}.bg-navigation-subtitle{background:#528593}.bgc-teal-60b{background-color:#1c443c}.bgc-teal-30b{background-color:#31766a}.bgc-teal-default{background-color:#46a997}.bgc-teal-30w{background-color:#7ec3b6}.bgc-teal-60w{background-color:#b5ddd5}.bgc-teal-secondary{background-color:#cbd6cb}.bgc-teal-90w{background-color:#ecf6f5}.bgc-petrol-60b{background-color:#102930}.bgc-petrol-30b{background-color:#1b4754}.bgc-petrol-default{background-color:#276678}.bgc-petrol-30w{background-color:#6894a0}.bgc-petrol-60w{background-color:#a9c2c9}.bgc-petrol-secondary{background-color:#c8d7de}.bgc-petrol-90w{background-color:#e9f0f1}.bgc-error-60b{background-color:#513131}.bgc-error-30b{background-color:#8e5655}.bgc-error-60w{background-color:#e3c3c6}.bgc-error-secondary{background-color:#f0dad9}.bgc-error-default{background-color:#cb7b7a}.bgc-warning-secondary{background-color:#f0d6bb}.bgc-warning-default{background-color:#cca45f}.bgc-black{background-color:#000}.bgc-dark{background-color:#888}.bgc-medium{background-color:#e0e0e0}.bgc-grey{background-color:#ededed}.bgc-light{background-color:#f6f6f6}.bgc-white{background-color:#fff}.bgc-box-shadow{background-color:#00000014}.bgc-navigation-subtitle{background-color:#528593}.rating{display:flex;align-content:center;justify-content:flex-start;align-items:center}.rating-item{width:35px;height:16px;border:1px solid #e0e0e0;border-left:0;cursor:pointer}.rating-item-hover{border:0;background-color:#b5ddd5}.rating-item-hover[theme=dark],.rating-item-hover[theme=light]{background-color:#ffb3ee}.rating-item-hover:not(:first-child){border-left:1px solid #ffffff}.rating-item:first-child{border-radius:4px 0 0 4px}.rating-item:first-child:not(.rating-item-selected):not(.rating-item-hover){border-left:1px solid #e0e0e0}.rating-item:last-child{border-radius:0 4px 4px 0}.rating-item:first-child:last-child{border-radius:4px}.rating-item-selected{border:0;background-color:#46a997}.rating-item-selected[theme=dark],.rating-item-selected[theme=light]{background-color:#d410aa}.rating-item-selected:not(:first-child){border-left:1px solid #ffffff}.rating .star-container{display:flex;flex-direction:row;min-height:24px}.rating .star-container .star{width:24px;height:24px;background:url(/icons/rating-icons/Star-outline.svg) no-repeat center;background-size:100%;margin-right:4px}.rating .star-container .star:last-child{margin-right:0}.rating .star-container .star:focus{outline:1px dashed #888888}.rating .star-container .star:hover,.rating .star-container .star.hover,.rating .star-container .star:focus{opacity:.5}.rating .star-container .star.filled-half{background-image:url(/icons/rating-icons/Star-half.svg)!important}.rating .star-container .star.disabled{pointer-events:none;background-image:url(/icons/rating-icons/Star-filled-disabled.svg)}.rating .star-container .star:active{opacity:1}.rating .star-container .star-filled,.rating .star-container[theme=dark] .star.filled,.rating .star-container[theme=light] .star.filled,.rating .star-container[theme=dark] .star:hover,.rating .star-container[theme=dark] .star.hover,.rating .star-container[theme=dark] .star:focus,.rating .star-container[theme=light] .star:hover,.rating .star-container[theme=light] .star.hover,.rating .star-container[theme=light] .star:focus,.rating .star-container .star:hover,.rating .star-container .star.hover,.rating .star-container .star:focus,.rating .star-container .star.filled,.rating .star-container .star:active{background-image:url(/icons/rating-icons/Star-filled.svg)}.rating .star-container[theme=dark] .star,.rating .star-container[theme=light] .star{cursor:pointer;background:url(/icons/rebrand/Review-star-in-line.svg) no-repeat center}.rating .star-container[theme=dark] .star:hover,.rating .star-container[theme=dark] .star.hover,.rating .star-container[theme=dark] .star:focus,.rating .star-container[theme=light] .star:hover,.rating .star-container[theme=light] .star.hover,.rating .star-container[theme=light] .star:focus{opacity:.5}.rating .star-container[theme=dark] .star:focus,.rating .star-container[theme=light] .star:focus{outline-offset:4px}.rating .star-container[theme=dark] .star.filled-half,.rating .star-container[theme=light] .star.filled-half{background-image:url(/icons/rebrand/Review-half-star-filled.svg)!important}.rating .star-container[theme=dark] .star.disabled,.rating .star-container[theme=light] .star.disabled{background-image:url(/icons/rebrand/Review-star-filled-disabled.svg)}.rating .star-container[theme=dark] .star-filled,.rating .star-container[theme=dark] .star:hover,.rating .star-container[theme=dark] .star.hover,.rating .star-container[theme=dark] .star:focus,.rating .star-container[theme=dark] .star.filled,.rating .star-container[theme=dark] .star:active,.rating .star-container[theme=light] .star-filled,.rating .star-container[theme=light] .star:hover,.rating .star-container[theme=light] .star.hover,.rating .star-container[theme=light] .star:focus,.rating .star-container[theme=light] .star.filled,.rating .star-container[theme=light] .star:active{background-image:url(/icons/rebrand/Review-star-filled.svg)}\n"] }]
103
+ args: [{ selector: 'ui-rating', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div class=\"rating\" (mouseleave)=\"onHover(-1)\" [attr.aria-label]=\"ariaLabel\" [attr.aria-required]=\"ariaRequired\">\n @if (theme === 'block') {\n @for (item of items; track item) {\n <div\n class=\"rating-item\"\n [attr.theme]=\"applicationTheme\"\n tabindex=\"0\"\n (click)=\"select(item)\"\n (keydown.enter)=\"select(item)\"\n (mouseenter)=\"onHover(item)\"\n [ngClass]=\"{ 'rating-item-selected': item < value, 'rating-item-hover': item < hoverIndex }\"\n [ngStyle]=\"{ 'width.px': barWidth }\"\n ></div>\n }\n } @else {\n <div class=\"star-container\" [attr.theme]=\"applicationTheme\">\n @for (item of items; track item; let i = $index) {\n <div\n #star\n class=\"star\"\n tabindex=\"0\"\n [tabIndex]=\"0\"\n (mouseenter)=\"onHover(item)\"\n (mouseleave)=\"onHover(-1)\"\n [ngClass]=\"{\n filled: value > i,\n hover: item < hoverIndex && (value ? item >= value : true),\n disabled,\n 'filled-half': i + 1 | halfStar: value,\n }\"\n (click)=\"select(item); star.blur()\"\n (keydown.enter)=\"select(item); star.blur()\"\n ></div>\n }\n </div>\n }\n</div>\n", styles: [".bg-teal-60b{background:#1c443c}.bg-teal-30b{background:#31766a}.bg-teal-default{background:#46a997}.bg-teal-30w{background:#7ec3b6}.bg-teal-60w{background:#b5ddd5}.bg-teal-secondary{background:#cbd6cb}.bg-teal-90w{background:#ecf6f5}.bg-petrol-60b{background:#102930}.bg-petrol-30b{background:#1b4754}.bg-petrol-default{background:#276678}.bg-petrol-30w{background:#6894a0}.bg-petrol-60w{background:#a9c2c9}.bg-petrol-secondary{background:#c8d7de}.bg-petrol-90w{background:#e9f0f1}.bg-error-60b{background:#513131}.bg-error-30b{background:#8e5655}.bg-error-60w{background:#e3c3c6}.bg-error-secondary{background:#f0dad9}.bg-error-default{background:#cb7b7a}.bg-warning-secondary{background:#f0d6bb}.bg-warning-default{background:#cca45f}.bg-black{background:#000}.bg-dark{background:#888}.bg-medium{background:#e0e0e0}.bg-grey{background:#ededed}.bg-light{background:#f6f6f6}.bg-white{background:#fff}.bg-box-shadow{background:#00000014}.bg-navigation-subtitle{background:#528593}.bgc-teal-60b{background-color:#1c443c}.bgc-teal-30b{background-color:#31766a}.bgc-teal-default{background-color:#46a997}.bgc-teal-30w{background-color:#7ec3b6}.bgc-teal-60w{background-color:#b5ddd5}.bgc-teal-secondary{background-color:#cbd6cb}.bgc-teal-90w{background-color:#ecf6f5}.bgc-petrol-60b{background-color:#102930}.bgc-petrol-30b{background-color:#1b4754}.bgc-petrol-default{background-color:#276678}.bgc-petrol-30w{background-color:#6894a0}.bgc-petrol-60w{background-color:#a9c2c9}.bgc-petrol-secondary{background-color:#c8d7de}.bgc-petrol-90w{background-color:#e9f0f1}.bgc-error-60b{background-color:#513131}.bgc-error-30b{background-color:#8e5655}.bgc-error-60w{background-color:#e3c3c6}.bgc-error-secondary{background-color:#f0dad9}.bgc-error-default{background-color:#cb7b7a}.bgc-warning-secondary{background-color:#f0d6bb}.bgc-warning-default{background-color:#cca45f}.bgc-black{background-color:#000}.bgc-dark{background-color:#888}.bgc-medium{background-color:#e0e0e0}.bgc-grey{background-color:#ededed}.bgc-light{background-color:#f6f6f6}.bgc-white{background-color:#fff}.bgc-box-shadow{background-color:#00000014}.bgc-navigation-subtitle{background-color:#528593}.rating{display:flex;align-content:center;justify-content:flex-start;align-items:center}.rating-item{width:35px;height:16px;border:1px solid #e0e0e0;border-left:0;cursor:pointer}.rating-item-hover{border:0;background-color:#b5ddd5}.rating-item-hover[theme=dark],.rating-item-hover[theme=light]{background-color:color-mix(in srgb,var(--ui-rating-color, #d410aa) 40%,#fff)}.rating-item-hover:not(:first-child){border-left:1px solid #ffffff}.rating-item:first-child{border-radius:4px 0 0 4px}.rating-item:first-child:not(.rating-item-selected):not(.rating-item-hover){border-left:1px solid #e0e0e0}.rating-item:last-child{border-radius:0 4px 4px 0}.rating-item:first-child:last-child{border-radius:4px}.rating-item-selected{border:0;background-color:#46a997}.rating-item-selected[theme=dark],.rating-item-selected[theme=light]{background-color:var(--ui-rating-color, #d410aa)}.rating-item-selected:not(:first-child){border-left:1px solid #ffffff}.rating .star-container{display:flex;flex-direction:row;min-height:24px}.rating .star-container .star{width:24px;height:24px;background:url(/icons/rating-icons/Star-outline.svg) no-repeat center;background-size:100%;margin-right:4px}.rating .star-container .star:last-child{margin-right:0}.rating .star-container .star:focus{outline:1px dashed #888888}.rating .star-container .star:hover,.rating .star-container .star.hover,.rating .star-container .star:focus{opacity:.5}.rating .star-container .star.filled-half{background-image:none;mask:url(/icons/rating-icons/Star-half.svg) no-repeat center/100%!important;background-color:var(--ui-rating-color, #d410aa)}.rating .star-container .star.disabled{pointer-events:none;background-image:url(/icons/rating-icons/Star-filled-disabled.svg)}.rating .star-container .star:active{opacity:1}.rating .star-container .star-filled,.rating .star-container[theme=dark] .star.filled,.rating .star-container[theme=light] .star.filled,.rating .star-container[theme=dark] .star:hover,.rating .star-container[theme=dark] .star.hover,.rating .star-container[theme=dark] .star:focus,.rating .star-container[theme=light] .star:hover,.rating .star-container[theme=light] .star.hover,.rating .star-container[theme=light] .star:focus,.rating .star-container .star:hover,.rating .star-container .star.hover,.rating .star-container .star:focus,.rating .star-container .star.filled,.rating .star-container .star:active{background-image:none;mask:url(/icons/rating-icons/Star-filled.svg) no-repeat center/100%;background-color:var(--ui-rating-color, #d410aa)}.rating .star-container[theme=dark] .star,.rating .star-container[theme=light] .star{cursor:pointer;background:url(/icons/rebrand/Review-star-in-line.svg) no-repeat center}.rating .star-container[theme=dark] .star:hover,.rating .star-container[theme=dark] .star.hover,.rating .star-container[theme=dark] .star:focus,.rating .star-container[theme=light] .star:hover,.rating .star-container[theme=light] .star.hover,.rating .star-container[theme=light] .star:focus{opacity:.5}.rating .star-container[theme=dark] .star:focus,.rating .star-container[theme=light] .star:focus{outline-offset:4px}.rating .star-container[theme=dark] .star.filled-half,.rating .star-container[theme=light] .star.filled-half{background-image:none;mask:url(/icons/rebrand/Review-half-star-filled.svg) no-repeat center/100%!important;background-color:var(--ui-rating-color, #d410aa)}.rating .star-container[theme=dark] .star.disabled,.rating .star-container[theme=light] .star.disabled{background-image:url(/icons/rebrand/Review-star-filled-disabled.svg)}.rating .star-container[theme=dark] .star-filled,.rating .star-container[theme=dark] .star:hover,.rating .star-container[theme=dark] .star.hover,.rating .star-container[theme=dark] .star:focus,.rating .star-container[theme=dark] .star.filled,.rating .star-container[theme=dark] .star:active,.rating .star-container[theme=light] .star-filled,.rating .star-container[theme=light] .star:hover,.rating .star-container[theme=light] .star.hover,.rating .star-container[theme=light] .star:focus,.rating .star-container[theme=light] .star.filled,.rating .star-container[theme=light] .star:active{background-image:none;mask:url(/icons/rebrand/Review-star-filled.svg) no-repeat center/100%;background-color:var(--ui-rating-color, #d410aa)}\n"] }]
104
104
  }], ctorParameters: () => [{ type: undefined, decorators: [{
105
105
  type: Optional
106
106
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"testgorilla-tgo-ui-components-rating.mjs","sources":["../../../components/rating/half-star.pipe.ts","../../../components/rating/rating.component.ts","../../../components/rating/rating.component.html","../../../components/rating/rating.component.module.ts","../../../components/rating/testgorilla-tgo-ui-components-rating.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({\n name: 'halfStar',\n standalone: false,\n})\nexport class HalfStarPipe implements PipeTransform {\n /**\n * @description Used to indicate whether display half-star icon.\n * Returns true if the rounded value of the current element\n * is equal to it's index, and value is not integer (e.g. index = 4, value = 3.5),\n * @param index the index of the current element\n * @param value the value of the current element\n */\n transform(index: number, value: number): boolean {\n return Math.ceil(value) === index && !Number.isInteger(value);\n }\n}\n","import { ChangeDetectionStrategy, Component, EventEmitter, Inject, Input, Optional, Output } from '@angular/core';\nimport { ApplicationTheme } from '@testgorilla/tgo-ui/components/core';\n\nexport type RatingComponentTheme = 'stars' | 'block';\n\n@Component({\n selector: 'ui-rating',\n templateUrl: './rating.component.html',\n styleUrls: ['./rating.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: false,\n})\nexport class RatingComponent {\n private readonly MIN_LENGTH = 0;\n private readonly DEFAULT_LENGTH = 5;\n protected items: number[] = [];\n protected hoverIndex: number;\n\n /**\n *\n * Defines the application theme where accordion is used\n *\n * @type {ApplicationTheme}\n * @memberof AccordionComponent\n */\n @Input() applicationTheme: ApplicationTheme = 'light';\n\n /**\n * The value representing the rating.\n * @type {number}\n * @memberof RatingComponent\n */\n @Input() value: number;\n\n /**\n * The theme of the rating component. Defaults \"block\".\n * @type {RatingComponentTheme}\n * @memberof RatingComponent\n */\n @Input() theme: RatingComponentTheme = 'block';\n\n /**\n * A flag indicating whether the rating component is disabled.\n * @type {boolean}\n * @memberof RatingComponent\n */\n @Input() disabled = false;\n\n /**\n * A string representing the ARIA label for accessibility.\n * This label is used to provide an accessible name for the input element.\n * @type {string}\n * @memberof RatingComponent\n */\n @Input() ariaLabel: string;\n\n /**\n * A string representing the ARIA requirement for accessibility.\n * This attribute is used to indicate whether an input field is required for form submission.\n * @type {boolean}\n * @memberof RatingComponent\n */\n @Input() ariaRequired = false;\n\n /**\n * The width of the rating bar.\n * @type {number}\n * @memberof RatingComponent\n */\n @Input() barWidth = 35;\n\n /**\n * A flag indicating whether the rating can be unselected by clicking on the same value.\n * When false, clicking on the same value will not change the rating.\n * @type {boolean}\n * @memberof RatingComponent\n */\n @Input() canUnselect = true;\n\n @Input() set length(length: number) {\n this.items = Array(Math.max(length, this.MIN_LENGTH))\n .fill(0)\n .map((x, i) => i);\n }\n\n @Output() valueChange = new EventEmitter<number>();\n\n constructor(\n @Optional() @Inject('CANOPYUI_DEFAULT_APPLICATION_THEME') private readonly defaultAppTheme: ApplicationTheme\n ) {\n if (defaultAppTheme) {\n this.applicationTheme = defaultAppTheme;\n }\n this.length = this.DEFAULT_LENGTH;\n }\n\n protected select(index: number): void {\n const newValue = index + 1;\n\n // If canUnselect is false and we're clicking on the same value, don't change anything\n if (!this.canUnselect && this.value === newValue) {\n return;\n }\n\n this.value = this.value === newValue ? 0 : newValue;\n this.valueChange.emit(this.value);\n }\n\n protected onHover(index: number): void {\n this.hoverIndex = index + 1;\n }\n}\n","<div class=\"rating\" (mouseleave)=\"onHover(-1)\" [attr.aria-label]=\"ariaLabel\" [attr.aria-required]=\"ariaRequired\">\n @if (theme === 'block') {\n @for (item of items; track item) {\n <div\n class=\"rating-item\"\n [attr.theme]=\"applicationTheme\"\n tabindex=\"0\"\n (click)=\"select(item)\"\n (keydown.enter)=\"select(item)\"\n (mouseenter)=\"onHover(item)\"\n [ngClass]=\"{ 'rating-item-selected': item < value, 'rating-item-hover': item < hoverIndex }\"\n [ngStyle]=\"{ 'width.px': barWidth }\"\n ></div>\n }\n } @else {\n <div class=\"star-container\" [attr.theme]=\"applicationTheme\">\n @for (item of items; track item; let i = $index) {\n <div\n #star\n class=\"star\"\n tabindex=\"0\"\n [tabIndex]=\"0\"\n (mouseenter)=\"onHover(item)\"\n (mouseleave)=\"onHover(-1)\"\n [ngClass]=\"{\n filled: value > i,\n hover: item < hoverIndex && (value ? item >= value : true),\n disabled,\n 'filled-half': i + 1 | halfStar: value,\n }\"\n (click)=\"select(item); star.blur()\"\n (keydown.enter)=\"select(item); star.blur()\"\n ></div>\n }\n </div>\n }\n</div>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { RatingComponent } from './rating.component';\nimport { HalfStarPipe } from './half-star.pipe';\nimport { MatInputModule } from '@angular/material/input';\n\n@NgModule({\n declarations: [RatingComponent, HalfStarPipe],\n imports: [CommonModule, MatInputModule],\n exports: [RatingComponent],\n})\nexport class RatingComponentModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i2.HalfStarPipe"],"mappings":";;;;;;MAMa,YAAY,CAAA;AACvB;;;;;;AAMG;IACH,SAAS,CAAC,KAAa,EAAE,KAAa,EAAA;AACpC,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;IAC/D;+GAVW,YAAY,EA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["../../../components/rating/half-star.pipe.ts","../../../components/rating/rating.component.ts","../../../components/rating/rating.component.html","../../../components/rating/rating.component.module.ts","../../../components/rating/testgorilla-tgo-ui-components-rating.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({\n name: 'halfStar',\n standalone: false,\n})\nexport class HalfStarPipe implements PipeTransform {\n /**\n * @description Used to indicate whether display half-star icon.\n * Returns true if the rounded value of the current element\n * is equal to it's index, and value is not integer (e.g. index = 4, value = 3.5),\n * @param index the index of the current element\n * @param value the value of the current element\n */\n transform(index: number, value: number): boolean {\n return Math.ceil(value) === index && !Number.isInteger(value);\n }\n}\n","import { ChangeDetectionStrategy, Component, EventEmitter, Inject, Input, Optional, Output } from '@angular/core';\nimport { ApplicationTheme } from '@testgorilla/tgo-ui/components/core';\n\nexport type RatingComponentTheme = 'stars' | 'block';\n\n@Component({\n selector: 'ui-rating',\n templateUrl: './rating.component.html',\n styleUrls: ['./rating.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: false,\n})\nexport class RatingComponent {\n private readonly MIN_LENGTH = 0;\n private readonly DEFAULT_LENGTH = 5;\n protected items: number[] = [];\n protected hoverIndex: number;\n\n /**\n *\n * Defines the application theme where accordion is used\n *\n * @type {ApplicationTheme}\n * @memberof AccordionComponent\n */\n @Input() applicationTheme: ApplicationTheme = 'light';\n\n /**\n * The value representing the rating.\n * @type {number}\n * @memberof RatingComponent\n */\n @Input() value: number;\n\n /**\n * The theme of the rating component. Defaults \"block\".\n * @type {RatingComponentTheme}\n * @memberof RatingComponent\n */\n @Input() theme: RatingComponentTheme = 'block';\n\n /**\n * A flag indicating whether the rating component is disabled.\n * @type {boolean}\n * @memberof RatingComponent\n */\n @Input() disabled = false;\n\n /**\n * A string representing the ARIA label for accessibility.\n * This label is used to provide an accessible name for the input element.\n * @type {string}\n * @memberof RatingComponent\n */\n @Input() ariaLabel: string;\n\n /**\n * A string representing the ARIA requirement for accessibility.\n * This attribute is used to indicate whether an input field is required for form submission.\n * @type {boolean}\n * @memberof RatingComponent\n */\n @Input() ariaRequired = false;\n\n /**\n * The width of the rating bar.\n * @type {number}\n * @memberof RatingComponent\n */\n @Input() barWidth = 35;\n\n /**\n * A flag indicating whether the rating can be unselected by clicking on the same value.\n * When false, clicking on the same value will not change the rating.\n * @type {boolean}\n * @memberof RatingComponent\n */\n @Input() canUnselect = true;\n\n @Input() set length(length: number) {\n this.items = Array(Math.max(length, this.MIN_LENGTH))\n .fill(0)\n .map((x, i) => i);\n }\n\n @Output() valueChange = new EventEmitter<number>();\n\n constructor(\n @Optional() @Inject('CANOPYUI_DEFAULT_APPLICATION_THEME') private readonly defaultAppTheme: ApplicationTheme\n ) {\n if (defaultAppTheme) {\n this.applicationTheme = defaultAppTheme;\n }\n this.length = this.DEFAULT_LENGTH;\n }\n\n protected select(index: number): void {\n const newValue = index + 1;\n\n // If canUnselect is false and we're clicking on the same value, don't change anything\n if (!this.canUnselect && this.value === newValue) {\n return;\n }\n\n this.value = this.value === newValue ? 0 : newValue;\n this.valueChange.emit(this.value);\n }\n\n protected onHover(index: number): void {\n this.hoverIndex = index + 1;\n }\n}\n","<div class=\"rating\" (mouseleave)=\"onHover(-1)\" [attr.aria-label]=\"ariaLabel\" [attr.aria-required]=\"ariaRequired\">\n @if (theme === 'block') {\n @for (item of items; track item) {\n <div\n class=\"rating-item\"\n [attr.theme]=\"applicationTheme\"\n tabindex=\"0\"\n (click)=\"select(item)\"\n (keydown.enter)=\"select(item)\"\n (mouseenter)=\"onHover(item)\"\n [ngClass]=\"{ 'rating-item-selected': item < value, 'rating-item-hover': item < hoverIndex }\"\n [ngStyle]=\"{ 'width.px': barWidth }\"\n ></div>\n }\n } @else {\n <div class=\"star-container\" [attr.theme]=\"applicationTheme\">\n @for (item of items; track item; let i = $index) {\n <div\n #star\n class=\"star\"\n tabindex=\"0\"\n [tabIndex]=\"0\"\n (mouseenter)=\"onHover(item)\"\n (mouseleave)=\"onHover(-1)\"\n [ngClass]=\"{\n filled: value > i,\n hover: item < hoverIndex && (value ? item >= value : true),\n disabled,\n 'filled-half': i + 1 | halfStar: value,\n }\"\n (click)=\"select(item); star.blur()\"\n (keydown.enter)=\"select(item); star.blur()\"\n ></div>\n }\n </div>\n }\n</div>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { RatingComponent } from './rating.component';\nimport { HalfStarPipe } from './half-star.pipe';\nimport { MatInputModule } from '@angular/material/input';\n\n@NgModule({\n declarations: [RatingComponent, HalfStarPipe],\n imports: [CommonModule, MatInputModule],\n exports: [RatingComponent],\n})\nexport class RatingComponentModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i2.HalfStarPipe"],"mappings":";;;;;;MAMa,YAAY,CAAA;AACvB;;;;;;AAMG;IACH,SAAS,CAAC,KAAa,EAAE,KAAa,EAAA;AACpC,QAAA,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;IAC/D;+GAVW,YAAY,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAAA;6GAAZ,YAAY,EAAA,YAAA,EAAA,KAAA,EAAA,IAAA,EAAA,UAAA,EAAA,CAAA,CAAA;;4FAAZ,YAAY,EAAA,UAAA,EAAA,CAAA;kBAJxB,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,IAAI,EAAE,UAAU;AAChB,oBAAA,UAAU,EAAE,KAAK;AAClB,iBAAA;;;MCOY,eAAe,CAAA;IAmE1B,IAAa,MAAM,CAAC,MAAc,EAAA;AAChC,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;aACjD,IAAI,CAAC,CAAC;aACN,GAAG,CAAC,CAAC,CA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