@koobiq/components 19.8.6 → 19.8.7

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 (46) hide show
  1. package/app-switcher/app-switcher.d.ts +9 -2
  2. package/core/styles/common/_select.scss +4 -1
  3. package/ellipsis-center/ellipsis-center.directive.d.ts +5 -0
  4. package/fesm2022/koobiq-components-app-switcher.mjs +2 -2
  5. package/fesm2022/koobiq-components-app-switcher.mjs.map +1 -1
  6. package/fesm2022/koobiq-components-core.mjs +11 -4
  7. package/fesm2022/koobiq-components-core.mjs.map +1 -1
  8. package/fesm2022/koobiq-components-ellipsis-center.mjs +6 -1
  9. package/fesm2022/koobiq-components-ellipsis-center.mjs.map +1 -1
  10. package/fesm2022/koobiq-components-form-field.mjs +25 -4
  11. package/fesm2022/koobiq-components-form-field.mjs.map +1 -1
  12. package/fesm2022/koobiq-components-navbar.mjs +44 -12
  13. package/fesm2022/koobiq-components-navbar.mjs.map +1 -1
  14. package/fesm2022/koobiq-components-notification-center.mjs +2 -2
  15. package/fesm2022/koobiq-components-notification-center.mjs.map +1 -1
  16. package/fesm2022/koobiq-components-popover.mjs +4 -1
  17. package/fesm2022/koobiq-components-popover.mjs.map +1 -1
  18. package/fesm2022/koobiq-components-search-expandable.mjs +2 -1
  19. package/fesm2022/koobiq-components-search-expandable.mjs.map +1 -1
  20. package/fesm2022/koobiq-components-select.mjs +50 -13
  21. package/fesm2022/koobiq-components-select.mjs.map +1 -1
  22. package/fesm2022/koobiq-components-time-range.mjs +20 -2
  23. package/fesm2022/koobiq-components-time-range.mjs.map +1 -1
  24. package/fesm2022/koobiq-components-timezone.mjs +9 -4
  25. package/fesm2022/koobiq-components-timezone.mjs.map +1 -1
  26. package/fesm2022/koobiq-components-title.mjs +9 -4
  27. package/fesm2022/koobiq-components-title.mjs.map +1 -1
  28. package/fesm2022/koobiq-components-tooltip.mjs +42 -5
  29. package/fesm2022/koobiq-components-tooltip.mjs.map +1 -1
  30. package/fesm2022/koobiq-components-tree-select.mjs +22 -4
  31. package/fesm2022/koobiq-components-tree-select.mjs.map +1 -1
  32. package/form-field/form-field-control.d.ts +10 -0
  33. package/form-field/form-field.d.ts +17 -0
  34. package/navbar/navbar-brand.component.d.ts +1 -0
  35. package/navbar/navbar-brand.scss +12 -5
  36. package/navbar/navbar-item.component.d.ts +18 -1
  37. package/notification-center/notification-item.scss +4 -1
  38. package/package.json +8 -8
  39. package/schematics/ng-add/index.js +2 -2
  40. package/select/select-option.directive.d.ts +5 -0
  41. package/select/select.component.d.ts +22 -0
  42. package/time-range/time-range-title-as-form-field.d.ts +11 -0
  43. package/timezone/timezone-option.directive.d.ts +5 -0
  44. package/title/title.directive.d.ts +5 -0
  45. package/tooltip/tooltip.component.d.ts +25 -1
  46. package/tree-select/tree-select.component.d.ts +15 -0
@@ -17,6 +17,11 @@ import { debounceTime } from 'rxjs/operators';
17
17
  class KbqEllipsisCenterDirective extends KbqTooltipTrigger {
18
18
  constructor() {
19
19
  super(...arguments);
20
+ /**
21
+ * The hint spells out what the split hid, so `kbqTooltipDisabled="false"` cannot conjure one for a name
22
+ * that fits.
23
+ * @docs-private */
24
+ this.derivedDisabledWins = true;
20
25
  this.cdr = inject(ChangeDetectorRef);
21
26
  /**
22
27
  * Application-wide `ResizeObserver` shared by every consumer, as `KbqTitleDirective` uses. Unlike the
@@ -133,7 +138,7 @@ class KbqEllipsisCenterDirective extends KbqTooltipTrigger {
133
138
  }
134
139
  dataTextStart.innerText = start;
135
140
  dataTextEnd.innerText = end;
136
- this.disabled = !truncated;
141
+ this.setDerivedDisabled(!truncated);
137
142
  this.cdr.markForCheck();
138
143
  });
139
144
  this.renderer.appendChild(this.elementRef.nativeElement, dataTextStart);
@@ -1 +1 @@
1
- {"version":3,"file":"koobiq-components-ellipsis-center.mjs","sources":["../../../packages/components/ellipsis-center/ellipsis-center.directive.ts","../../../packages/components/ellipsis-center/koobiq-components-ellipsis-center.ts"],"sourcesContent":["import { SharedResizeObserver } from '@angular/cdk/observers/private';\nimport {\n AfterViewInit,\n ChangeDetectorRef,\n Directive,\n inject,\n Input,\n NgModule,\n numberAttribute,\n OnDestroy,\n OnInit\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { KbqTooltipTrigger } from '@koobiq/components/tooltip';\nimport { Subject } from 'rxjs';\nimport { debounceTime } from 'rxjs/operators';\n\n/**\n * Renders text as two spans and moves the ellipsis into the middle, so the tail — a file extension, the\n * digits that tell two reports apart — stays readable when the host is too narrow for the whole string. A\n * tooltip spells out the full text, and is enabled only while something is actually hidden.\n *\n * The host needs the layout contract the consuming component ships (see `.kbq-ellipsis-center` in\n * `file-upload.scss`): the two spans have no styles of their own.\n */\n@Directive({\n selector: '[kbqEllipsisCenter]',\n host: {\n class: 'kbq-ellipsis-center'\n }\n})\nexport class KbqEllipsisCenterDirective extends KbqTooltipTrigger implements OnInit, AfterViewInit, OnDestroy {\n private cdr: ChangeDetectorRef = inject(ChangeDetectorRef);\n\n /**\n * Application-wide `ResizeObserver` shared by every consumer, as `KbqTitleDirective` uses. Unlike the\n * `window:resize` listener this directive used to carry, it also reacts to container-only resizes — a\n * splitter drag, a sidebar collapse, or the vertical scrollbar that appears once a file list fills up —\n * none of which resize the window, all of which change where the text has to be split.\n */\n private readonly resizeObserver = inject(SharedResizeObserver);\n\n @Input() set kbqEllipsisCenter(value: string) {\n this._kbqEllipsisCenter = value;\n this.refresh();\n // check the view to properly calculate text-start and text-end on text initialized\n this.cdr.detectChanges();\n }\n\n /**\n * Shortest text worth splitting in the middle. Anything below it keeps its natural order and is cut off\n * at the end by the host's own `text-overflow`.\n *\n * Defaults to `0` — every overflowing text is split — because that is what the directive has always\n * done: the input was declared but never read, so any other default would silently end-truncate labels\n * that consumers expect to see split.\n */\n @Input() minVisibleLength: number = 0;\n\n /**\n * Lower bound, in pixels, for the average glyph width used to decide how many characters fit in the\n * tail. The rendered text is measured as well and the wider of the two wins, so an underestimate here\n * can no longer push the extension out of the tail — raising it only shortens the tail further.\n */\n @Input() charWidth = 7;\n\n /**\n * Debounce time (ms) for resize events before recalculating ellipsis position.\n * @default 50\n */\n @Input({ transform: numberAttribute }) debounceInterval: number = 50;\n\n /**\n * @deprecated No longer read. Resizes now come from the shared `ResizeObserver`, which also catches the\n * container-only ones a `window:resize` listener cannot see; the host listener that used to feed this\n * subject is gone, and nothing subscribes to it. Kept as a no-op and removed in the next major version.\n * @docs-private */\n readonly resizeStream = new Subject<Event>();\n\n private _kbqEllipsisCenter: string;\n\n // Host width the last completed `refresh()` measured, so a resize that leaves it untouched (the host is\n // clamped to its container) does not schedule work that would produce the same split.\n private lastMeasuredWidth: number | undefined;\n\n private refreshTimeoutId: ReturnType<typeof setTimeout> | undefined;\n\n override ngOnInit(): void {\n super.ngOnInit();\n this.content = this._kbqEllipsisCenter;\n this.refresh();\n }\n\n ngAfterViewInit(): void {\n super.ngAfterViewInit();\n\n this.resizeObserver\n .observe(this.elementRef.nativeElement)\n .pipe(debounceTime(this.debounceInterval), takeUntilDestroyed(this.destroyRef))\n .subscribe(() => {\n if (this.elementRef.nativeElement.clientWidth !== this.lastMeasuredWidth) {\n this.refresh();\n }\n });\n }\n\n ngOnDestroy() {\n clearTimeout(this.refreshTimeoutId);\n\n super.ngOnDestroy();\n }\n\n /**\n * Updates the displayed text with center ellipsis truncation based on container width.\n * Recreates start/end span elements, measures available space, and adjusts text accordingly.\n * @docs-private\n */\n refresh(): void {\n let start = '';\n let end = '';\n\n this.content = this._kbqEllipsisCenter;\n\n const [dataTextStart, dataTextEnd] = [\n 'kbq-ellipsis-center_data-text-start',\n 'kbq-ellipsis-center_data-text-end'\n ].map((querySelector) => {\n const element = this.elementRef.nativeElement.querySelector(`.${querySelector}`);\n\n if (element) {\n this.renderer.removeChild(this.elementRef.nativeElement, element);\n }\n\n const newElement = this.renderer.createElement('span');\n\n this.renderer.addClass(newElement, querySelector);\n\n return newElement;\n });\n\n this.renderer.appendChild(dataTextStart, this.renderer.createText(this._kbqEllipsisCenter));\n this.renderer.appendChild(dataTextEnd, this.renderer.createText(end));\n\n // A queued callback outlives both the spans it measures and the directive itself: it would measure\n // elements a newer `refresh()` has already detached (`scrollWidth === 0`, so the text reads as\n // fitting) and then call `hide()` on a torn-down trigger.\n clearTimeout(this.refreshTimeoutId);\n\n this.refreshTimeoutId = setTimeout(() => {\n const { clientWidth } = this.elementRef.nativeElement;\n // The full text is still in the start element at this point, so this is the width it needs.\n const textWidth = dataTextStart.scrollWidth;\n const truncated = clientWidth < textWidth;\n\n this.lastMeasuredWidth = clientWidth;\n\n if (truncated && this._kbqEllipsisCenter.length >= this.minVisibleLength) {\n // What the text actually rendered at, not what `charWidth` assumes: with glyphs wider than\n // the Latin-sized default (Cyrillic, CJK, uppercase) the estimate hands the tail more\n // characters than the cell can hold, and the tail does not shrink — so `overflow: hidden`\n // would swallow the extension the split exists to keep.\n const averageCharWidth = Math.max(this.charWidth, textWidth / this._kbqEllipsisCenter.length);\n const lastCharsLength = Math.round(clientWidth / 2 / averageCharWidth);\n\n // Both halves have to keep at least one character: an empty start element drops the ellipsis\n // (it is the only one carrying `text-overflow`), an empty end element drops the extension.\n const sliceIndex = Math.max(\n 1,\n Math.min(\n Math.round(this._kbqEllipsisCenter.length - lastCharsLength),\n this._kbqEllipsisCenter.length - 1\n )\n );\n\n start = this._kbqEllipsisCenter.slice(0, sliceIndex);\n end = this._kbqEllipsisCenter.slice(sliceIndex);\n } else {\n // Text that is not split goes into the start element, the only one carrying\n // `text-overflow: ellipsis` — the end element cannot shrink, so text parked there would\n // overflow the host instead of being cut off.\n start = this._kbqEllipsisCenter;\n end = '';\n }\n\n dataTextStart.innerText = start;\n dataTextEnd.innerText = end;\n\n this.disabled = !truncated;\n this.cdr.markForCheck();\n });\n\n this.renderer.appendChild(this.elementRef.nativeElement, dataTextStart);\n this.renderer.appendChild(this.elementRef.nativeElement, dataTextEnd);\n }\n}\n\n@NgModule({\n imports: [KbqEllipsisCenterDirective],\n exports: [KbqEllipsisCenterDirective]\n})\nexport class KbqEllipsisCenterModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAiBA;;;;;;;AAOG;AAOG,MAAO,0BAA2B,SAAQ,iBAAiB,CAAA;AANjE,IAAA,WAAA,GAAA;;AAOY,QAAA,IAAA,CAAA,GAAG,GAAsB,MAAM,CAAC,iBAAiB,CAAC;AAE1D;;;;;AAKG;AACc,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAS9D;;;;;;;AAOG;QACM,IAAA,CAAA,gBAAgB,GAAW,CAAC;AAErC;;;;AAIG;QACM,IAAA,CAAA,SAAS,GAAG,CAAC;AAEtB;;;AAGG;QACoC,IAAA,CAAA,gBAAgB,GAAW,EAAE;AAEpE;;;;AAImB;AACV,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,OAAO,EAAS;AAqH/C,IAAA;IAxJG,IAAa,iBAAiB,CAAC,KAAa,EAAA;AACxC,QAAA,IAAI,CAAC,kBAAkB,GAAG,KAAK;QAC/B,IAAI,CAAC,OAAO,EAAE;;AAEd,QAAA,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE;IAC5B;IAwCS,QAAQ,GAAA;QACb,KAAK,CAAC,QAAQ,EAAE;AAChB,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,kBAAkB;QACtC,IAAI,CAAC,OAAO,EAAE;IAClB;IAEA,eAAe,GAAA;QACX,KAAK,CAAC,eAAe,EAAE;AAEvB,QAAA,IAAI,CAAC;AACA,aAAA,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa;AACrC,aAAA,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC;aAC7E,SAAS,CAAC,MAAK;AACZ,YAAA,IAAI,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,KAA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,CAAA,EAAA,CAAA,CAAA;mIAyK1B,uBAAuB,EAAA,CAAA,CAAA;;4FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAJnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,0BAA0B,CAAC;oBACrC,OAAO,EAAE,CAAC,0BAA0B;AACvC,iBAAA;;;ACvMD;;AAEG;;;;"}
1
+ {"version":3,"file":"koobiq-components-ellipsis-center.mjs","sources":["../../../packages/components/ellipsis-center/ellipsis-center.directive.ts","../../../packages/components/ellipsis-center/koobiq-components-ellipsis-center.ts"],"sourcesContent":["import { SharedResizeObserver } from '@angular/cdk/observers/private';\nimport {\n AfterViewInit,\n ChangeDetectorRef,\n Directive,\n inject,\n Input,\n NgModule,\n numberAttribute,\n OnDestroy,\n OnInit\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { KbqTooltipTrigger } from '@koobiq/components/tooltip';\nimport { Subject } from 'rxjs';\nimport { debounceTime } from 'rxjs/operators';\n\n/**\n * Renders text as two spans and moves the ellipsis into the middle, so the tail — a file extension, the\n * digits that tell two reports apart — stays readable when the host is too narrow for the whole string. A\n * tooltip spells out the full text, and is enabled only while something is actually hidden.\n *\n * The host needs the layout contract the consuming component ships (see `.kbq-ellipsis-center` in\n * `file-upload.scss`): the two spans have no styles of their own.\n */\n@Directive({\n selector: '[kbqEllipsisCenter]',\n host: {\n class: 'kbq-ellipsis-center'\n }\n})\nexport class KbqEllipsisCenterDirective extends KbqTooltipTrigger implements OnInit, AfterViewInit, OnDestroy {\n /**\n * The hint spells out what the split hid, so `kbqTooltipDisabled=\"false\"` cannot conjure one for a name\n * that fits.\n * @docs-private */\n protected override readonly derivedDisabledWins = true;\n\n private cdr: ChangeDetectorRef = inject(ChangeDetectorRef);\n\n /**\n * Application-wide `ResizeObserver` shared by every consumer, as `KbqTitleDirective` uses. Unlike the\n * `window:resize` listener this directive used to carry, it also reacts to container-only resizes — a\n * splitter drag, a sidebar collapse, or the vertical scrollbar that appears once a file list fills up —\n * none of which resize the window, all of which change where the text has to be split.\n */\n private readonly resizeObserver = inject(SharedResizeObserver);\n\n @Input() set kbqEllipsisCenter(value: string) {\n this._kbqEllipsisCenter = value;\n this.refresh();\n // check the view to properly calculate text-start and text-end on text initialized\n this.cdr.detectChanges();\n }\n\n /**\n * Shortest text worth splitting in the middle. Anything below it keeps its natural order and is cut off\n * at the end by the host's own `text-overflow`.\n *\n * Defaults to `0` — every overflowing text is split — because that is what the directive has always\n * done: the input was declared but never read, so any other default would silently end-truncate labels\n * that consumers expect to see split.\n */\n @Input() minVisibleLength: number = 0;\n\n /**\n * Lower bound, in pixels, for the average glyph width used to decide how many characters fit in the\n * tail. The rendered text is measured as well and the wider of the two wins, so an underestimate here\n * can no longer push the extension out of the tail — raising it only shortens the tail further.\n */\n @Input() charWidth = 7;\n\n /**\n * Debounce time (ms) for resize events before recalculating ellipsis position.\n * @default 50\n */\n @Input({ transform: numberAttribute }) debounceInterval: number = 50;\n\n /**\n * @deprecated No longer read. Resizes now come from the shared `ResizeObserver`, which also catches the\n * container-only ones a `window:resize` listener cannot see; the host listener that used to feed this\n * subject is gone, and nothing subscribes to it. Kept as a no-op and removed in the next major version.\n * @docs-private */\n readonly resizeStream = new Subject<Event>();\n\n private _kbqEllipsisCenter: string;\n\n // Host width the last completed `refresh()` measured, so a resize that leaves it untouched (the host is\n // clamped to its container) does not schedule work that would produce the same split.\n private lastMeasuredWidth: number | undefined;\n\n private refreshTimeoutId: ReturnType<typeof setTimeout> | undefined;\n\n override ngOnInit(): void {\n super.ngOnInit();\n this.content = this._kbqEllipsisCenter;\n this.refresh();\n }\n\n ngAfterViewInit(): void {\n super.ngAfterViewInit();\n\n this.resizeObserver\n .observe(this.elementRef.nativeElement)\n .pipe(debounceTime(this.debounceInterval), takeUntilDestroyed(this.destroyRef))\n .subscribe(() => {\n if (this.elementRef.nativeElement.clientWidth !== this.lastMeasuredWidth) {\n this.refresh();\n }\n });\n }\n\n ngOnDestroy() {\n clearTimeout(this.refreshTimeoutId);\n\n super.ngOnDestroy();\n }\n\n /**\n * Updates the displayed text with center ellipsis truncation based on container width.\n * Recreates start/end span elements, measures available space, and adjusts text accordingly.\n * @docs-private\n */\n refresh(): void {\n let start = '';\n let end = '';\n\n this.content = this._kbqEllipsisCenter;\n\n const [dataTextStart, dataTextEnd] = [\n 'kbq-ellipsis-center_data-text-start',\n 'kbq-ellipsis-center_data-text-end'\n ].map((querySelector) => {\n const element = this.elementRef.nativeElement.querySelector(`.${querySelector}`);\n\n if (element) {\n this.renderer.removeChild(this.elementRef.nativeElement, element);\n }\n\n const newElement = this.renderer.createElement('span');\n\n this.renderer.addClass(newElement, querySelector);\n\n return newElement;\n });\n\n this.renderer.appendChild(dataTextStart, this.renderer.createText(this._kbqEllipsisCenter));\n this.renderer.appendChild(dataTextEnd, this.renderer.createText(end));\n\n // A queued callback outlives both the spans it measures and the directive itself: it would measure\n // elements a newer `refresh()` has already detached (`scrollWidth === 0`, so the text reads as\n // fitting) and then call `hide()` on a torn-down trigger.\n clearTimeout(this.refreshTimeoutId);\n\n this.refreshTimeoutId = setTimeout(() => {\n const { clientWidth } = this.elementRef.nativeElement;\n // The full text is still in the start element at this point, so this is the width it needs.\n const textWidth = dataTextStart.scrollWidth;\n const truncated = clientWidth < textWidth;\n\n this.lastMeasuredWidth = clientWidth;\n\n if (truncated && this._kbqEllipsisCenter.length >= this.minVisibleLength) {\n // What the text actually rendered at, not what `charWidth` assumes: with glyphs wider than\n // the Latin-sized default (Cyrillic, CJK, uppercase) the estimate hands the tail more\n // characters than the cell can hold, and the tail does not shrink — so `overflow: hidden`\n // would swallow the extension the split exists to keep.\n const averageCharWidth = Math.max(this.charWidth, textWidth / this._kbqEllipsisCenter.length);\n const lastCharsLength = Math.round(clientWidth / 2 / averageCharWidth);\n\n // Both halves have to keep at least one character: an empty start element drops the ellipsis\n // (it is the only one carrying `text-overflow`), an empty end element drops the extension.\n const sliceIndex = Math.max(\n 1,\n Math.min(\n Math.round(this._kbqEllipsisCenter.length - lastCharsLength),\n this._kbqEllipsisCenter.length - 1\n )\n );\n\n start = this._kbqEllipsisCenter.slice(0, sliceIndex);\n end = this._kbqEllipsisCenter.slice(sliceIndex);\n } else {\n // Text that is not split goes into the start element, the only one carrying\n // `text-overflow: ellipsis` — the end element cannot shrink, so text parked there would\n // overflow the host instead of being cut off.\n start = this._kbqEllipsisCenter;\n end = '';\n }\n\n dataTextStart.innerText = start;\n dataTextEnd.innerText = end;\n\n this.setDerivedDisabled(!truncated);\n this.cdr.markForCheck();\n });\n\n this.renderer.appendChild(this.elementRef.nativeElement, dataTextStart);\n this.renderer.appendChild(this.elementRef.nativeElement, dataTextEnd);\n }\n}\n\n@NgModule({\n imports: [KbqEllipsisCenterDirective],\n exports: [KbqEllipsisCenterDirective]\n})\nexport class KbqEllipsisCenterModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAiBA;;;;;;;AAOG;AAOG,MAAO,0BAA2B,SAAQ,iBAAiB,CAAA;AANjE,IAAA,WAAA,GAAA;;AAOI;;;AAGmB;QACS,IAAA,CAAA,mBAAmB,GAAG,IAAI;AAE9C,QAAA,IAAA,CAAA,GAAG,GAAsB,MAAM,CAAC,iBAAiB,CAAC;AAE1D;;;;;AAKG;AACc,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,oBAAoB,CAAC;AAS9D;;;;;;;AAOG;QACM,IAAA,CAAA,gBAAgB,GAAW,CAAC;AAErC;;;;AAIG;QACM,IAAA,CAAA,SAAS,GAAG,CAAC;AAEtB;;;AAGG;QACoC,IAAA,CAAA,gBAAgB,GAAW,EAAE;AAEpE;;;;AAImB;AACV,QAAA,IAAA,CAAA,YAAY,GAAG,IAAI,OAAO,EAAS;AAqH/C,IAAA;IAxJG,IAAa,iBAAiB,CAAC,KAAa,EAAA;AACxC,QAAA,IAAI,CAAC,kBAAk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