@bravobit/bb-foundation 0.42.0 → 0.42.2

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 (194) hide show
  1. package/auth/lib/auth.interceptor.d.ts +3 -6
  2. package/auth/lib/auth.service.d.ts +11 -16
  3. package/dialog/lib/dialog-confirm/dialog-confirm.component.d.ts +2 -5
  4. package/dialog/lib/dialog-container/dialog-container.component.d.ts +4 -6
  5. package/dialog/lib/dialog-overlay/dialog-overlay.component.d.ts +5 -7
  6. package/esm2022/auth/lib/auth.interceptor.mjs +36 -42
  7. package/esm2022/auth/lib/auth.module.mjs +4 -4
  8. package/esm2022/auth/lib/auth.service.mjs +25 -41
  9. package/esm2022/auth/lib/auth.session.mjs +26 -22
  10. package/esm2022/auth/lib/directives/authenticated.directive.mjs +16 -12
  11. package/esm2022/auth/lib/helpers/jwt.helper.mjs +29 -31
  12. package/esm2022/auth/lib/providers/email.provider.mjs +4 -1
  13. package/esm2022/auth/lib/providers/verify.provider.mjs +4 -1
  14. package/esm2022/collections/lib/collection.mjs +17 -7
  15. package/esm2022/collections/lib/collections.module.mjs +6 -6
  16. package/esm2022/collections/lib/components/collections-actions/collections-actions.component.mjs +7 -9
  17. package/esm2022/collections/lib/components/collections-grid/collections-grid.component.mjs +11 -11
  18. package/esm2022/collections/lib/components/collections-pager/collections-pager.component.mjs +10 -10
  19. package/esm2022/collections/lib/components/collections-table/collections-table.component.mjs +16 -16
  20. package/esm2022/collections/lib/components/collections-table-label/collections-table-label.component.mjs +9 -11
  21. package/esm2022/collections/lib/components/collections-table-sorting/collections-table-sorting.component.mjs +12 -9
  22. package/esm2022/collections/lib/components/collections-viewer/collections-viewer.component.mjs +10 -7
  23. package/esm2022/collections/lib/directives/collections-data-row.directive.mjs +6 -3
  24. package/esm2022/collections/lib/directives/collections-data.directive.mjs +6 -3
  25. package/esm2022/collections/lib/directives/collections-empty.directive.mjs +6 -3
  26. package/esm2022/collections/lib/directives/collections-error.directive.mjs +6 -3
  27. package/esm2022/collections/lib/directives/collections-initial.directive.mjs +4 -3
  28. package/esm2022/collections/lib/directives/collections-item.directive.mjs +6 -3
  29. package/esm2022/collections/lib/providers/api-collection.provider.mjs +6 -4
  30. package/esm2022/collections/lib/providers/local-collection.provider.mjs +2 -2
  31. package/esm2022/combobox/combobox/combobox-container.directive.mjs +12 -7
  32. package/esm2022/combobox/combobox/combobox.component.mjs +23 -20
  33. package/esm2022/combobox/combobox-label.directive.mjs +3 -3
  34. package/esm2022/combobox/combobox-option.directive.mjs +3 -3
  35. package/esm2022/combobox/combobox-panel/combobox-panel.component.mjs +10 -6
  36. package/esm2022/dashboard/lib/dashboard/dashboard.component.mjs +13 -13
  37. package/esm2022/dashboard/lib/dashboard-header/dashboard-header.component.mjs +5 -7
  38. package/esm2022/dashboard/lib/dashboard-menu/dashboard-menu.component.mjs +8 -10
  39. package/esm2022/dashboard/lib/dashboard-menu-item/dashboard-menu-item.component.mjs +5 -7
  40. package/esm2022/dashboard/lib/dashboard-sidebar/dashboard-sidebar.component.mjs +12 -13
  41. package/esm2022/dashboard/lib/dashboard-sidebar-group/dashboard-sidebar-group.component.mjs +13 -12
  42. package/esm2022/dashboard/lib/dashboard-sidebar-item/dashboard-sidebar-item.component.mjs +7 -5
  43. package/esm2022/dashboard/lib/dashboard.module.mjs +5 -5
  44. package/esm2022/dialog/lib/dialog-actions/dialog-actions.component.mjs +3 -3
  45. package/esm2022/dialog/lib/dialog-confirm/dialog-confirm.component.mjs +21 -20
  46. package/esm2022/dialog/lib/dialog-container/dialog-container.component.mjs +19 -24
  47. package/esm2022/dialog/lib/dialog-header/dialog-header.component.mjs +5 -7
  48. package/esm2022/dialog/lib/dialog-link/dialog-link.component.mjs +3 -3
  49. package/esm2022/dialog/lib/dialog-modal/dialog-modal.component.mjs +9 -6
  50. package/esm2022/dialog/lib/dialog-overlay/dialog-overlay.component.mjs +19 -26
  51. package/esm2022/dialog/lib/dialog.insertion.mjs +4 -3
  52. package/esm2022/dialog/lib/dialog.interfaces.mjs +4 -1
  53. package/esm2022/dialog/lib/dialog.module.mjs +6 -6
  54. package/esm2022/dialog/lib/dialog.ref.mjs +4 -6
  55. package/esm2022/dialog/lib/dialog.service.mjs +5 -3
  56. package/esm2022/dialog/lib/directives/confirm.directive.mjs +12 -14
  57. package/esm2022/elements/lib/avatar/avatar.component.mjs +75 -77
  58. package/esm2022/elements/lib/button/button.component.mjs +12 -10
  59. package/esm2022/elements/lib/checkbox/checkbox.component.mjs +21 -17
  60. package/esm2022/elements/lib/checkbox-group/checkbox-group.component.mjs +8 -10
  61. package/esm2022/elements/lib/date-picker/date-picker.component.mjs +82 -76
  62. package/esm2022/elements/lib/directives/addon.directive.mjs +5 -5
  63. package/esm2022/elements/lib/directives/extra-error-controls.directive.mjs +7 -9
  64. package/esm2022/elements/lib/directives/form-submit.directive.mjs +6 -3
  65. package/esm2022/elements/lib/directives/form-submitter.directive.mjs +5 -7
  66. package/esm2022/elements/lib/directives/image-upload.directive.mjs +14 -11
  67. package/esm2022/elements/lib/directives/input.directive.mjs +6 -4
  68. package/esm2022/elements/lib/elements.module.mjs +6 -6
  69. package/esm2022/elements/lib/file-picker/file-picker.component.mjs +52 -51
  70. package/esm2022/elements/lib/form-control/form-control.component.mjs +14 -14
  71. package/esm2022/elements/lib/form-error/form-error.component.mjs +16 -8
  72. package/esm2022/elements/lib/form-group/form-group.component.mjs +5 -7
  73. package/esm2022/elements/lib/icon/icon.component.mjs +14 -13
  74. package/esm2022/elements/lib/image-picker/image-picker.component.mjs +20 -17
  75. package/esm2022/elements/lib/multi-file-control/multi-file-control.component.mjs +28 -24
  76. package/esm2022/elements/lib/pipes/date.pipe.mjs +6 -8
  77. package/esm2022/elements/lib/pipes/file-image.pipe.mjs +6 -3
  78. package/esm2022/elements/lib/pipes/file-size.pipe.mjs +13 -15
  79. package/esm2022/elements/lib/pipes/relative-time.pipe.mjs +37 -35
  80. package/esm2022/elements/lib/radio-button/radio-button.component.mjs +8 -7
  81. package/esm2022/elements/lib/radio-group/radio-group.component.mjs +21 -20
  82. package/esm2022/elements/lib/spinner/spinner.component.mjs +7 -9
  83. package/esm2022/http/lib/classes/http.config.mjs +19 -15
  84. package/esm2022/http/lib/http.interfaces.mjs +1 -1
  85. package/esm2022/http/lib/http.module.mjs +5 -4
  86. package/esm2022/http/lib/interceptors/base-url.interceptor.mjs +12 -20
  87. package/esm2022/http/lib/interceptors/error.interceptor.mjs +9 -14
  88. package/esm2022/lib/core/services/exif.service.mjs +102 -100
  89. package/esm2022/lib/core/services/file-loader.service.mjs +15 -17
  90. package/esm2022/lib/core/services/files.service.mjs +9 -17
  91. package/esm2022/lib/core/services/image-converter.service.mjs +33 -30
  92. package/esm2022/lib/core/services/languages.service.mjs +25 -24
  93. package/esm2022/lib/core/services/network.service.mjs +8 -5
  94. package/esm2022/lib/core/services/patch.service.mjs +9 -6
  95. package/esm2022/localize/lib/dictionary/dictionary.class.mjs +7 -1
  96. package/esm2022/localize/lib/dictionary/dictionary.context.mjs +2 -4
  97. package/esm2022/localize/lib/dictionary/dictionary.data.mjs +2 -1
  98. package/esm2022/localize/lib/handlers/missing.handler.mjs +2 -4
  99. package/esm2022/localize/lib/localize.module.mjs +5 -5
  100. package/esm2022/localize/lib/localize.pipe.mjs +4 -3
  101. package/esm2022/localize/lib/localize.service.mjs +36 -62
  102. package/esm2022/localize/lib/transforms/interpolate.transform.mjs +12 -22
  103. package/esm2022/localize/lib/transforms/plural.transform.mjs +9 -18
  104. package/esm2022/localize/lib/transforms/reference.transform.mjs +7 -15
  105. package/esm2022/localize/lib/views/localize-string/localize-string.component.mjs +14 -11
  106. package/esm2022/localize/lib/views/localize-template.directive.mjs +6 -5
  107. package/esm2022/masking/lib/directives/currency-mask.directive.mjs +11 -6
  108. package/esm2022/masking/lib/directives/date-mask.directive.mjs +11 -6
  109. package/esm2022/masking/lib/directives/input-mask.directive.mjs +21 -14
  110. package/esm2022/masking/lib/masking.module.mjs +5 -5
  111. package/esm2022/masking/lib/masking.service.mjs +4 -3
  112. package/esm2022/notifications/lib/notifications-item/notifications-item.component.mjs +50 -36
  113. package/esm2022/notifications/lib/notifications-list/notifications-list.component.mjs +8 -7
  114. package/esm2022/notifications/lib/notifications.interfaces.mjs +10 -1
  115. package/esm2022/notifications/lib/notifications.module.mjs +4 -4
  116. package/esm2022/notifications/lib/notifications.service.mjs +24 -10
  117. package/esm2022/permissions/lib/directives/permission.directive.mjs +20 -14
  118. package/esm2022/permissions/lib/handlers/local.handler.mjs +3 -1
  119. package/esm2022/permissions/lib/permissions.interface.mjs +4 -1
  120. package/esm2022/permissions/lib/permissions.module.mjs +4 -4
  121. package/esm2022/permissions/lib/permissions.service.mjs +8 -7
  122. package/esm2022/recaptcha/lib/recaptcha/recaptcha.component.mjs +35 -28
  123. package/esm2022/recaptcha/lib/recaptcha-loader.service.mjs +15 -15
  124. package/esm2022/recaptcha/lib/recaptcha.module.mjs +4 -4
  125. package/esm2022/select/lib/select/select.component.mjs +52 -47
  126. package/esm2022/select/lib/select-label.directive.mjs +4 -3
  127. package/esm2022/select/lib/select-multi-label.directive.mjs +4 -3
  128. package/esm2022/select/lib/select-option-group.directive.mjs +4 -3
  129. package/esm2022/select/lib/select-option.directive.mjs +4 -3
  130. package/esm2022/select/lib/select.module.mjs +5 -5
  131. package/esm2022/storage/lib/storage.service.mjs +25 -21
  132. package/esm2022/storage/lib/strategies/cookie-storage.strategy.mjs +66 -64
  133. package/esm2022/storage/lib/strategies/memory-storage.strategy.mjs +16 -18
  134. package/esm2022/storage/lib/strategies/polyfill-storage.strategy.mjs +31 -30
  135. package/esm2022/table/lib/components/table/table.component.mjs +30 -20
  136. package/esm2022/table/lib/components/table-cell/table-cell.component.mjs +3 -3
  137. package/esm2022/table/lib/components/table-header-cell/table-header-cell.component.mjs +15 -11
  138. package/esm2022/table/lib/components/table-pager/table-pager.component.mjs +18 -16
  139. package/esm2022/table/lib/data/datasource.data.mjs +4 -6
  140. package/esm2022/table/lib/data/generic.data.mjs +38 -36
  141. package/esm2022/table/lib/table.module.mjs +6 -6
  142. package/esm2022/tooltip/lib/tooltip-container/tooltip-container.component.mjs +5 -7
  143. package/esm2022/tooltip/lib/tooltip.directive.mjs +15 -15
  144. package/esm2022/tooltip/lib/tooltip.module.mjs +4 -4
  145. package/esm2022/utils/lib/directives/autosize.directive.mjs +9 -7
  146. package/esm2022/utils/lib/directives/focus-trap.directive.mjs +24 -22
  147. package/esm2022/utils/lib/directives/focus.directive.mjs +8 -5
  148. package/esm2022/utils/lib/directives/template.directive.mjs +7 -3
  149. package/esm2022/utils/lib/utils.module.mjs +5 -5
  150. package/fesm2022/bravobit-bb-foundation-auth.mjs +134 -144
  151. package/fesm2022/bravobit-bb-foundation-auth.mjs.map +1 -1
  152. package/fesm2022/bravobit-bb-foundation-collections.mjs +123 -93
  153. package/fesm2022/bravobit-bb-foundation-collections.mjs.map +1 -1
  154. package/fesm2022/bravobit-bb-foundation-combobox.mjs +46 -34
  155. package/fesm2022/bravobit-bb-foundation-combobox.mjs.map +1 -1
  156. package/fesm2022/bravobit-bb-foundation-dashboard.mjs +60 -64
  157. package/fesm2022/bravobit-bb-foundation-dashboard.mjs.map +1 -1
  158. package/fesm2022/bravobit-bb-foundation-dialog.mjs +97 -103
  159. package/fesm2022/bravobit-bb-foundation-dialog.mjs.map +1 -1
  160. package/fesm2022/bravobit-bb-foundation-elements.mjs +468 -440
  161. package/fesm2022/bravobit-bb-foundation-elements.mjs.map +1 -1
  162. package/fesm2022/bravobit-bb-foundation-http.mjs +40 -46
  163. package/fesm2022/bravobit-bb-foundation-http.mjs.map +1 -1
  164. package/fesm2022/bravobit-bb-foundation-localize.mjs +91 -130
  165. package/fesm2022/bravobit-bb-foundation-localize.mjs.map +1 -1
  166. package/fesm2022/bravobit-bb-foundation-masking.mjs +47 -29
  167. package/fesm2022/bravobit-bb-foundation-masking.mjs.map +1 -1
  168. package/fesm2022/bravobit-bb-foundation-notifications.mjs +91 -53
  169. package/fesm2022/bravobit-bb-foundation-notifications.mjs.map +1 -1
  170. package/fesm2022/bravobit-bb-foundation-permissions.mjs +34 -22
  171. package/fesm2022/bravobit-bb-foundation-permissions.mjs.map +1 -1
  172. package/fesm2022/bravobit-bb-foundation-recaptcha.mjs +51 -44
  173. package/fesm2022/bravobit-bb-foundation-recaptcha.mjs.map +1 -1
  174. package/fesm2022/bravobit-bb-foundation-select.mjs +67 -58
  175. package/fesm2022/bravobit-bb-foundation-select.mjs.map +1 -1
  176. package/fesm2022/bravobit-bb-foundation-storage.mjs +134 -129
  177. package/fesm2022/bravobit-bb-foundation-storage.mjs.map +1 -1
  178. package/fesm2022/bravobit-bb-foundation-table.mjs +107 -91
  179. package/fesm2022/bravobit-bb-foundation-table.mjs.map +1 -1
  180. package/fesm2022/bravobit-bb-foundation-tooltip.mjs +21 -23
  181. package/fesm2022/bravobit-bb-foundation-tooltip.mjs.map +1 -1
  182. package/fesm2022/bravobit-bb-foundation-utils.mjs +48 -37
  183. package/fesm2022/bravobit-bb-foundation-utils.mjs.map +1 -1
  184. package/fesm2022/bravobit-bb-foundation.mjs +194 -191
  185. package/fesm2022/bravobit-bb-foundation.mjs.map +1 -1
  186. package/http/lib/http.interfaces.d.ts +2 -1
  187. package/http/lib/interceptors/base-url.interceptor.d.ts +2 -4
  188. package/http/lib/interceptors/error.interceptor.d.ts +1 -3
  189. package/lib/core/services/files.service.d.ts +3 -7
  190. package/localize/lib/localize.service.d.ts +10 -14
  191. package/localize/lib/transforms/interpolate.transform.d.ts +4 -5
  192. package/localize/lib/transforms/plural.transform.d.ts +5 -6
  193. package/localize/lib/transforms/reference.transform.d.ts +2 -3
  194. package/package.json +39 -39
@@ -1 +1 @@
1
- {"version":3,"file":"bravobit-bb-foundation-utils.mjs","sources":["../../../projects/bb-foundation/utils/src/lib/directives/template.directive.ts","../../../projects/bb-foundation/utils/src/lib/directives/autosize.directive.ts","../../../projects/bb-foundation/utils/src/lib/directives/focus.directive.ts","../../../projects/bb-foundation/utils/src/lib/directives/focus-trap.directive.ts","../../../projects/bb-foundation/utils/src/lib/utils.module.ts","../../../projects/bb-foundation/utils/src/bravobit-bb-foundation-utils.ts"],"sourcesContent":["import {Directive, Input, TemplateRef, ViewContainerRef} from '@angular/core';\n\n@Directive({\n selector: '[bbTemplate]',\n standalone: true\n})\nexport class BbTemplate {\n\n @Input() set bbTemplate(content: string | TemplateRef<any>) {\n // Get the template.\n const template = content instanceof TemplateRef\n ? content\n : this._templateRef;\n\n // Clear the view container ref and create the view.\n this._viewContainerRef.clear();\n this._viewContainerRef.createEmbeddedView(template);\n }\n\n constructor(private _templateRef: TemplateRef<any>,\n private _viewContainerRef: ViewContainerRef) {\n }\n\n\n // Required so that the template type checker can infer the type of the coerced inputs.\n static ngAcceptInputType_bbTemplate: string | TemplateRef<any>;\n\n}\n","import {AfterViewInit, Directive, ElementRef, HostBinding, HostListener, Input, numberAttribute, Renderer2} from '@angular/core';\n\n@Directive({\n selector: 'textarea[bbAutosize]',\n standalone: true\n})\nexport class BbAutosize implements AfterViewInit {\n\n // Min/max heights for the textarea.\n @Input() @HostBinding('style.min-height') minHeight: string | null = null;\n @Input() @HostBinding('style.max-height') maxHeight: string | null = null;\n @Input({transform: numberAttribute}) @HostBinding('rows') rows: number = 1;\n\n constructor(private _renderer: Renderer2,\n private _elementRef: ElementRef) {\n }\n\n get element() {\n return this._elementRef?.nativeElement as HTMLTextAreaElement;\n }\n\n ngAfterViewInit() {\n // Update the styles after the DOM has loaded.\n this.updateStyles();\n }\n\n @HostListener('window:resize')\n onWindowResize() {\n // Update the styles when the window is resized.\n this.updateStyles();\n }\n\n @HostListener('input')\n onInputReceived() {\n // Update the styles after the textarea received input.\n this.updateStyles();\n }\n\n private updateStyles() {\n // Validate the element exists.\n if (!this.element) {\n return;\n }\n\n // Calculate border height which is not included in the scroll height.\n const borderHeight = this.element?.offsetHeight - this.element?.clientHeight;\n\n // Reset textarea height to auto that correctly calculate the new height.\n this.setHeight('auto');\n\n // Set new height.\n this.setHeight(`${this.element?.scrollHeight + borderHeight}px`);\n }\n\n private setHeight(value: string) {\n this._renderer.setStyle(this.element, 'height', value);\n }\n\n}\n","import {AfterViewInit, booleanAttribute, Directive, ElementRef, Input, NgZone} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n@Directive({\n selector: '[bbFocus]',\n standalone: true\n})\nexport class BbFocus implements AfterViewInit {\n\n // Inputs.\n @Input({transform: booleanAttribute}) bbFocusOnlyDesktop: boolean = false;\n\n constructor(private _zone: NgZone,\n private _platform: Platform,\n private _elementRef: ElementRef) {\n }\n\n private get nativeElement() {\n return this._elementRef.nativeElement;\n }\n\n ngAfterViewInit() {\n // Run the method outside the Angular zone.\n this._zone.runOutsideAngular(() => this.focus());\n }\n\n private isMobile() {\n return this._platform.IOS || this._platform.ANDROID;\n }\n\n private focus() {\n if (this.bbFocusOnlyDesktop && this.isMobile()) {\n return;\n }\n\n // Check if set timeout exists and the user is\n // using the site on desktop devices.\n if (!setTimeout) {\n return;\n }\n\n // Check if the element and the focus method exist, if so focus the element.\n if (!this.nativeElement || !this.nativeElement.focus) {\n return;\n }\n\n // Execute the focus method in a timeout.\n setTimeout(() => this.nativeElement.focus(), 0);\n }\n\n}\n","import {Directive, ElementRef, HostListener} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n@Directive({\n selector: '[bbFocusTrap]',\n standalone: true\n})\nexport class BbFocusTrap {\n\n private readonly _focusableElements = [\n 'a[href]',\n 'area[href]',\n 'input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden])',\n 'select:not([disabled]):not([aria-hidden])',\n 'textarea:not([disabled]):not([aria-hidden])',\n 'button:not([disabled]):not([aria-hidden])',\n 'iframe',\n 'object',\n 'embed',\n '[contenteditable]',\n '[tabindex]:not([tabindex^=\"-\"])'\n ];\n\n constructor(private _platform: Platform,\n private _elementRef: ElementRef) {\n }\n\n @HostListener('keydown', ['$event'])\n onKeydown(event: KeyboardEvent) {\n // Validate it is a tab event.\n if (!this.isTabEvent(event)) {\n return;\n }\n\n // Trap the focus inside the element.\n return this.trapFocus(event);\n }\n\n trapFocus(event: KeyboardEvent) {\n // Validate that the DOM is available.\n if (!this._platform.isBrowser) {\n return;\n }\n\n // Get all focusable nodes.\n const focusableNodes = this.getFocusableNodes();\n\n // Focus the first available element if the focus\n // is not in the modal.\n if (!this.element.contains(document.activeElement)) {\n return this.focus(focusableNodes[0]);\n }\n\n const focusedItemIndex = focusableNodes.indexOf(document.activeElement);\n\n if (event.shiftKey && focusedItemIndex === 0) {\n this.focus(focusableNodes[focusableNodes.length - 1]);\n return event.preventDefault();\n }\n\n if (!event.shiftKey && focusedItemIndex === focusableNodes.length - 1) {\n this.focus(focusableNodes[0]);\n return event.preventDefault();\n }\n }\n\n private get element() {\n return this._elementRef.nativeElement;\n }\n\n private getFocusableNodes() {\n const nodes = this.element.querySelectorAll(this._focusableElements);\n return Array(...nodes);\n }\n\n private focus = (element: HTMLElement) => {\n return element && element.focus && element.focus();\n };\n\n private isTabEvent = (event: KeyboardEvent) => {\n return event?.key === 'Tab' || event?.keyCode === 9;\n };\n\n}\n","import {BbFocusTrap} from './directives/focus-trap.directive';\nimport {BbTemplate} from './directives/template.directive';\nimport {BbAutosize} from './directives/autosize.directive';\nimport {BbFocus} from './directives/focus.directive';\nimport {NgModule} from '@angular/core';\n\n@NgModule({\n imports: [\n BbTemplate,\n BbAutosize,\n BbFocus,\n BbFocusTrap\n ],\n exports: [\n BbTemplate,\n BbAutosize,\n BbFocus,\n BbFocusTrap\n ]\n})\nexport class UtilsModule {\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;MAMa,UAAU,CAAA;IAEnB,IAAa,UAAU,CAAC,OAAkC,EAAA;;AAEtD,QAAA,MAAM,QAAQ,GAAG,OAAO,YAAY,WAAW;AAC3C,cAAE,OAAO;AACT,cAAE,IAAI,CAAC,YAAY,CAAC;;AAGxB,QAAA,IAAI,CAAC,iBAAiB,CAA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B,WAAW,CAAA;8GAAX,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;AAAX,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,YAZhB,UAAU;YACV,UAAU;YACV,OAAO;AACP,YAAA,WAAW,aAGX,UAAU;YACV,UAAU;YACV,OAAO;YACP,WAAW,CAAA,EAAA,CAAA,CAAA,EAAA;+GAGN,WAAW,EAAA,CAAA,CAAA,EAAA;;2FAAX,WAAW,EAAA,UAAA,EAAA,CAAA;kBAdvB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE;wBACL,UAAU;wBACV,UAAU;wBACV,OAAO;wBACP,WAAW;AACd,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACL,UAAU;wBACV,UAAU;wBACV,OAAO;wBACP,WAAW;AACd,qBAAA;AACJ,iBAAA,CAAA;;;ACnBD;;AAEG;;;;"}
1
+ {"version":3,"file":"bravobit-bb-foundation-utils.mjs","sources":["../../../projects/bb-foundation/utils/src/lib/directives/template.directive.ts","../../../projects/bb-foundation/utils/src/lib/directives/autosize.directive.ts","../../../projects/bb-foundation/utils/src/lib/directives/focus.directive.ts","../../../projects/bb-foundation/utils/src/lib/directives/focus-trap.directive.ts","../../../projects/bb-foundation/utils/src/lib/utils.module.ts","../../../projects/bb-foundation/utils/src/bravobit-bb-foundation-utils.ts"],"sourcesContent":["import {Directive, Input, TemplateRef, ViewContainerRef} from '@angular/core';\n\n@Directive({\n selector: '[bbTemplate]',\n standalone: true\n})\nexport class BbTemplate {\n\n @Input() set bbTemplate(content: string | TemplateRef<any>) {\n // Get the template.\n const template = content instanceof TemplateRef\n ? content\n : this._templateRef;\n\n // Clear the view container ref and create the view.\n this._viewContainerRef.clear();\n this._viewContainerRef.createEmbeddedView(template);\n }\n\n constructor(private _templateRef: TemplateRef<any>,\n private _viewContainerRef: ViewContainerRef) {\n }\n\n\n // Required so that the template type checker can infer the type of the coerced inputs.\n static ngAcceptInputType_bbTemplate: string | TemplateRef<any>;\n\n}\n","import {AfterViewInit, Directive, ElementRef, HostBinding, HostListener, Input, numberAttribute, Renderer2} from '@angular/core';\n\n@Directive({\n selector: 'textarea[bbAutosize]',\n standalone: true\n})\nexport class BbAutosize implements AfterViewInit {\n\n // Min/max heights for the textarea.\n @Input() @HostBinding('style.min-height') minHeight: string | null = null;\n @Input() @HostBinding('style.max-height') maxHeight: string | null = null;\n @Input({transform: numberAttribute}) @HostBinding('rows') rows: number = 1;\n\n constructor(private _renderer: Renderer2,\n private _elementRef: ElementRef) {\n }\n\n get element() {\n return this._elementRef?.nativeElement as HTMLTextAreaElement;\n }\n\n ngAfterViewInit() {\n // Update the styles after the DOM has loaded.\n this.updateStyles();\n }\n\n @HostListener('window:resize')\n onWindowResize() {\n // Update the styles when the window is resized.\n this.updateStyles();\n }\n\n @HostListener('input')\n onInputReceived() {\n // Update the styles after the textarea received input.\n this.updateStyles();\n }\n\n private updateStyles() {\n // Validate the element exists.\n if (!this.element) {\n return;\n }\n\n // Calculate border height which is not included in the scroll height.\n const borderHeight = this.element?.offsetHeight - this.element?.clientHeight;\n\n // Reset textarea height to auto that correctly calculate the new height.\n this.setHeight('auto');\n\n // Set new height.\n this.setHeight(`${this.element?.scrollHeight + borderHeight}px`);\n }\n\n private setHeight(value: string) {\n this._renderer.setStyle(this.element, 'height', value);\n }\n\n}\n","import {AfterViewInit, booleanAttribute, Directive, ElementRef, Input, NgZone} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n@Directive({\n selector: '[bbFocus]',\n standalone: true\n})\nexport class BbFocus implements AfterViewInit {\n\n // Inputs.\n @Input({transform: booleanAttribute}) bbFocusOnlyDesktop: boolean = false;\n\n constructor(private _zone: NgZone,\n private _platform: Platform,\n private _elementRef: ElementRef) {\n }\n\n private get nativeElement() {\n return this._elementRef.nativeElement;\n }\n\n ngAfterViewInit() {\n // Run the method outside the Angular zone.\n this._zone.runOutsideAngular(() => this.focus());\n }\n\n private isMobile() {\n return this._platform.IOS || this._platform.ANDROID;\n }\n\n private focus() {\n if (this.bbFocusOnlyDesktop && this.isMobile()) {\n return;\n }\n\n // Check if set timeout exists and the user is\n // using the site on desktop devices.\n if (!setTimeout) {\n return;\n }\n\n // Check if the element and the focus method exist, if so focus the element.\n if (!this.nativeElement || !this.nativeElement.focus) {\n return;\n }\n\n // Execute the focus method in a timeout.\n setTimeout(() => this.nativeElement.focus(), 0);\n }\n\n}\n","import {Directive, ElementRef, HostListener} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n@Directive({\n selector: '[bbFocusTrap]',\n standalone: true\n})\nexport class BbFocusTrap {\n\n private readonly _focusableElements = [\n 'a[href]',\n 'area[href]',\n 'input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden])',\n 'select:not([disabled]):not([aria-hidden])',\n 'textarea:not([disabled]):not([aria-hidden])',\n 'button:not([disabled]):not([aria-hidden])',\n 'iframe',\n 'object',\n 'embed',\n '[contenteditable]',\n '[tabindex]:not([tabindex^=\"-\"])'\n ];\n\n constructor(private _platform: Platform,\n private _elementRef: ElementRef) {\n }\n\n @HostListener('keydown', ['$event'])\n onKeydown(event: KeyboardEvent) {\n // Validate it is a tab event.\n if (!this.isTabEvent(event)) {\n return;\n }\n\n // Trap the focus inside the element.\n return this.trapFocus(event);\n }\n\n trapFocus(event: KeyboardEvent) {\n // Validate that the DOM is available.\n if (!this._platform.isBrowser) {\n return;\n }\n\n // Get all focusable nodes.\n const focusableNodes = this.getFocusableNodes();\n\n // Focus the first available element if the focus\n // is not in the modal.\n if (!this.element.contains(document.activeElement)) {\n return this.focus(focusableNodes[0]);\n }\n\n const focusedItemIndex = focusableNodes.indexOf(document.activeElement);\n\n if (event.shiftKey && focusedItemIndex === 0) {\n this.focus(focusableNodes[focusableNodes.length - 1]);\n return event.preventDefault();\n }\n\n if (!event.shiftKey && focusedItemIndex === focusableNodes.length - 1) {\n this.focus(focusableNodes[0]);\n return event.preventDefault();\n }\n }\n\n private get element() {\n return this._elementRef.nativeElement;\n }\n\n private getFocusableNodes() {\n const nodes = this.element.querySelectorAll(this._focusableElements);\n return Array(...nodes);\n }\n\n private focus = (element: HTMLElement) => {\n return element && element.focus && element.focus();\n };\n\n private isTabEvent = (event: KeyboardEvent) => {\n return event?.key === 'Tab' || event?.keyCode === 9;\n };\n\n}\n","import {BbFocusTrap} from './directives/focus-trap.directive';\nimport {BbTemplate} from './directives/template.directive';\nimport {BbAutosize} from './directives/autosize.directive';\nimport {BbFocus} from './directives/focus.directive';\nimport {NgModule} from '@angular/core';\n\n@NgModule({\n imports: [\n BbTemplate,\n BbAutosize,\n BbFocus,\n BbFocusTrap\n ],\n exports: [\n BbTemplate,\n BbAutosize,\n BbFocus,\n BbFocusTrap\n ]\n})\nexport class UtilsModule {\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;MAMa,UAAU,CAAA;AAaC,IAAA,YAAA,CAAA;AACA,IAAA,iBAAA,CAAA;IAZpB,IAAa,UAAU,CAAC,OAAkC,EAAA;;AAEtD,QAAA,MAAM,QAAQ,GAAG,OAAO,YAAY,WAAW;AAC3C,cAAE,OAAO;AACT,cAAE,IAAI,CAAC,YAAY,CAAC;;AAGxB,QAAA,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;AAC/B,QAAA,IAAI,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;KACvD;IAED,WAAoB,CAAA,YAA8B,EAC9B,iBAAmC,EAAA;QADnC,IAAY,CAAA,YAAA,GAAZ,YAAY,CAAkB;QAC9B,IAAiB,CAAA,iBAAA,GAAjB,iBAAiB,CAAkB;KACtD;;IAID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A,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,YAZhB,UAAU;YACV,UAAU;YACV,OAAO;AACP,YAAA,WAAW,aAGX,UAAU;YACV,UAAU;YACV,OAAO;YACP,WAAW,CAAA,EAAA,CAAA,CAAA;wGAGN,WAAW,EAAA,CAAA,CAAA;;2FAAX,WAAW,EAAA,UAAA,EAAA,CAAA;kBAdvB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE;wBACL,UAAU;wBACV,UAAU;wBACV,OAAO;wBACP,WAAW;AACd,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACL,UAAU;wBACV,UAAU;wBACV,OAAO;wBACP,WAAW;AACd,qBAAA;AACJ,iBAAA,CAAA;;;ACnBD;;AAEG;;;;"}
@@ -1,25 +1,12 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, InjectionToken, inject, Optional, Inject } from '@angular/core';
2
+ import { Injectable, InjectionToken, inject, RendererFactory2, Optional, Inject } from '@angular/core';
3
3
  import * as i1 from '@angular/cdk/platform';
4
+ import { Platform } from '@angular/cdk/platform';
4
5
  import { DOCUMENT, formatDate } from '@angular/common';
5
6
  import { map, distinctUntilChanged, shareReplay, debounceTime, startWith } from 'rxjs/operators';
6
7
  import { of, fromEvent, Observable, merge, Subscription, isObservable } from 'rxjs';
7
8
 
8
9
  class FileLoader {
9
- constructor() {
10
- this.isFile = (input) => {
11
- return 'File' in window && input instanceof File;
12
- };
13
- this.isBlob = (input) => {
14
- return 'Blob' in window && input instanceof Blob;
15
- };
16
- this.blobToFile = (blob, fileName) => {
17
- const anyBlob = blob;
18
- anyBlob.lastModifiedDate = new Date();
19
- anyBlob.name = fileName;
20
- return anyBlob;
21
- };
22
- }
23
10
  fromDataUrl(value, name = 'file') {
24
11
  if (!value) {
25
12
  return null;
@@ -73,6 +60,12 @@ class FileLoader {
73
60
  }
74
61
  });
75
62
  }
63
+ isFile = (input) => {
64
+ return 'File' in window && input instanceof File;
65
+ };
66
+ isBlob = (input) => {
67
+ return 'Blob' in window && input instanceof Blob;
68
+ };
76
69
  createFile(blob, name) {
77
70
  if (!navigator['msSaveBlob']) {
78
71
  return new File([blob], name, { lastModified: Date.now(), type: blob?.type });
@@ -80,8 +73,14 @@ class FileLoader {
80
73
  const blobFile = new Blob([blob], { type: blob?.type });
81
74
  return this.blobToFile(blobFile, name);
82
75
  }
83
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: FileLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
84
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: FileLoader, providedIn: 'root' }); }
76
+ blobToFile = (blob, fileName) => {
77
+ const anyBlob = blob;
78
+ anyBlob.lastModifiedDate = new Date();
79
+ anyBlob.name = fileName;
80
+ return anyBlob;
81
+ };
82
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: FileLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
83
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: FileLoader, providedIn: 'root' });
85
84
  }
86
85
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: FileLoader, decorators: [{
87
86
  type: Injectable,
@@ -91,106 +90,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImpor
91
90
  }] });
92
91
 
93
92
  class Exif {
93
+ _platform;
94
+ _fileLoader;
94
95
  constructor(_platform, _fileLoader) {
95
96
  this._platform = _platform;
96
97
  this._fileLoader = _fileLoader;
97
- this.transformImage = (image, type, orientation, quality = 100) => {
98
- // Create the canvas and context.
99
- const canvas = document.createElement('canvas');
100
- const context = canvas.getContext('2d');
101
- // Validate the context exists.
102
- if (!context) {
103
- return null;
104
- }
105
- // Set the canvas size based on the image.
106
- const { width, height } = image;
107
- canvas.width = width;
108
- canvas.height = height;
109
- // Validate the orientation is correct
110
- // else flip the canvas sizes.
111
- if (4 < orientation && orientation < 9) {
112
- canvas.width = height;
113
- canvas.height = width;
114
- }
115
- // Transform the context based on the orientation.
116
- switch (orientation) {
117
- case 2:
118
- context.transform(-1, 0, 0, 1, width, 0);
119
- break;
120
- case 3:
121
- context.transform(-1, 0, 0, -1, width, height);
122
- break;
123
- case 4:
124
- context.transform(1, 0, 0, -1, 0, height);
125
- break;
126
- case 5:
127
- context.transform(0, 1, 1, 0, 0, 0);
128
- break;
129
- case 6:
130
- context.transform(0, 1, -1, 0, height, 0);
131
- break;
132
- case 7:
133
- context.transform(0, -1, -1, 0, height, width);
134
- break;
135
- case 8:
136
- context.transform(0, -1, 1, 0, 0, width);
137
- break;
138
- default:
139
- break;
140
- }
141
- // Draw the image on the context and return the data URL.
142
- context.drawImage(image, 0, 0, width, height);
143
- return canvas.toDataURL(type, quality / 100);
144
- };
145
- this.getSupportedCanvasType = (fileType) => {
146
- switch (fileType) {
147
- case 'image/jpeg':
148
- case 'image/jpg':
149
- return 'image/jpeg';
150
- case 'image/x-windows-bmp':
151
- case 'image/bmp':
152
- return 'image/bmp';
153
- default:
154
- return 'image/png';
155
- }
156
- };
157
- this.getOrientation = (buffer) => {
158
- // Create a new data view.
159
- const view = new DataView(buffer);
160
- if (view.getUint16(0, false) !== 0xFFD8) {
161
- return -2;
162
- }
163
- const length = view.byteLength;
164
- let offset = 2;
165
- while (offset < length) {
166
- if (view.getUint16(offset + 2, false) <= 8) {
167
- return -1;
168
- }
169
- const marker = view.getUint16(offset, false);
170
- offset += 2;
171
- if (marker === 0xFFE1) {
172
- if (view.getUint32(offset += 2, false) !== 0x45786966) {
173
- return -1;
174
- }
175
- const little = view.getUint16(offset += 6, false) === 0x4949;
176
- offset += view.getUint32(offset + 4, little);
177
- const tags = view.getUint16(offset, little);
178
- offset += 2;
179
- for (let index = 0; index < tags; index++) {
180
- if (view.getUint16(offset + index * 12, little) === 0x0112) {
181
- return view.getUint16(offset + index * 12 + 8, little);
182
- }
183
- }
184
- }
185
- else if ((marker & 0xFF00) !== 0xFF00) {
186
- break;
187
- }
188
- else {
189
- offset += view.getUint16(offset, false);
190
- }
191
- }
192
- return -1;
193
- };
194
98
  }
195
99
  async strip(file, quality = 100) {
196
100
  // Validate we are on a browser.
@@ -239,8 +143,105 @@ class Exif {
239
143
  image.onload = () => resolve(image);
240
144
  });
241
145
  }
242
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Exif, deps: [{ token: i1.Platform }, { token: FileLoader }], target: i0.ɵɵFactoryTarget.Injectable }); }
243
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Exif, providedIn: 'root' }); }
146
+ transformImage = (image, type, orientation, quality = 100) => {
147
+ // Create the canvas and context.
148
+ const canvas = document.createElement('canvas');
149
+ const context = canvas.getContext('2d');
150
+ // Validate the context exists.
151
+ if (!context) {
152
+ return null;
153
+ }
154
+ // Set the canvas size based on the image.
155
+ const { width, height } = image;
156
+ canvas.width = width;
157
+ canvas.height = height;
158
+ // Validate the orientation is correct
159
+ // else flip the canvas sizes.
160
+ if (4 < orientation && orientation < 9) {
161
+ canvas.width = height;
162
+ canvas.height = width;
163
+ }
164
+ // Transform the context based on the orientation.
165
+ switch (orientation) {
166
+ case 2:
167
+ context.transform(-1, 0, 0, 1, width, 0);
168
+ break;
169
+ case 3:
170
+ context.transform(-1, 0, 0, -1, width, height);
171
+ break;
172
+ case 4:
173
+ context.transform(1, 0, 0, -1, 0, height);
174
+ break;
175
+ case 5:
176
+ context.transform(0, 1, 1, 0, 0, 0);
177
+ break;
178
+ case 6:
179
+ context.transform(0, 1, -1, 0, height, 0);
180
+ break;
181
+ case 7:
182
+ context.transform(0, -1, -1, 0, height, width);
183
+ break;
184
+ case 8:
185
+ context.transform(0, -1, 1, 0, 0, width);
186
+ break;
187
+ default:
188
+ break;
189
+ }
190
+ // Draw the image on the context and return the data URL.
191
+ context.drawImage(image, 0, 0, width, height);
192
+ return canvas.toDataURL(type, quality / 100);
193
+ };
194
+ getSupportedCanvasType = (fileType) => {
195
+ switch (fileType) {
196
+ case 'image/jpeg':
197
+ case 'image/jpg':
198
+ return 'image/jpeg';
199
+ case 'image/x-windows-bmp':
200
+ case 'image/bmp':
201
+ return 'image/bmp';
202
+ default:
203
+ return 'image/png';
204
+ }
205
+ };
206
+ getOrientation = (buffer) => {
207
+ // Create a new data view.
208
+ const view = new DataView(buffer);
209
+ if (view.getUint16(0, false) !== 0xFFD8) {
210
+ return -2;
211
+ }
212
+ const length = view.byteLength;
213
+ let offset = 2;
214
+ while (offset < length) {
215
+ if (view.getUint16(offset + 2, false) <= 8) {
216
+ return -1;
217
+ }
218
+ const marker = view.getUint16(offset, false);
219
+ offset += 2;
220
+ if (marker === 0xFFE1) {
221
+ if (view.getUint32(offset += 2, false) !== 0x45786966) {
222
+ return -1;
223
+ }
224
+ const little = view.getUint16(offset += 6, false) === 0x4949;
225
+ offset += view.getUint32(offset + 4, little);
226
+ const tags = view.getUint16(offset, little);
227
+ offset += 2;
228
+ for (let index = 0; index < tags; index++) {
229
+ if (view.getUint16(offset + index * 12, little) === 0x0112) {
230
+ return view.getUint16(offset + index * 12 + 8, little);
231
+ }
232
+ }
233
+ }
234
+ else if ((marker & 0xFF00) !== 0xFF00) {
235
+ break;
236
+ }
237
+ else {
238
+ offset += view.getUint16(offset, false);
239
+ }
240
+ }
241
+ return -1;
242
+ };
243
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Exif, deps: [{ token: i1.Platform }, { token: FileLoader }], target: i0.ɵɵFactoryTarget.Injectable });
244
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Exif, providedIn: 'root' });
244
245
  }
245
246
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Exif, decorators: [{
246
247
  type: Injectable,
@@ -250,37 +251,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImpor
250
251
  }], ctorParameters: () => [{ type: i1.Platform }, { type: FileLoader }] });
251
252
 
252
253
  class ImageConverter {
254
+ _exif;
255
+ _platform;
256
+ _fileLoader;
257
+ // Data.
258
+ _types = ['image/png', 'image/jpeg', 'image/webp'];
253
259
  constructor(_exif, _platform, _fileLoader) {
254
260
  this._exif = _exif;
255
261
  this._platform = _platform;
256
262
  this._fileLoader = _fileLoader;
257
- // Data.
258
- this._types = ['image/png', 'image/jpeg', 'image/webp'];
259
- this.calculateOffsetAndDimensions = (image, canvasWidth, canvasHeight) => {
260
- const originalWidth = image.width;
261
- const originalHeight = image.height;
262
- const widthRatio = canvasWidth / originalWidth;
263
- const heightRatio = canvasHeight / originalHeight;
264
- let width;
265
- let height;
266
- if (originalWidth > originalHeight) {
267
- height = originalHeight * heightRatio;
268
- width = (originalWidth / originalHeight) * height;
269
- }
270
- else {
271
- width = originalWidth * widthRatio;
272
- height = (originalHeight / originalWidth) * width;
273
- }
274
- let xOffset = 0;
275
- let yOffset = 0;
276
- if (canvasHeight === height) {
277
- xOffset = -((width - canvasWidth) / 2);
278
- }
279
- else if (canvasWidth === width) {
280
- yOffset = -((height - canvasHeight) / 2);
281
- }
282
- return { xOffset, yOffset, width, height };
283
- };
284
263
  }
285
264
  async toDataUri(contents, options = null) {
286
265
  // Check if the current platform is a browser.
@@ -357,8 +336,33 @@ class ImageConverter {
357
336
  // If the contents is a string convert it to an HTML image element.
358
337
  return this.stringToImage(contents);
359
338
  }
360
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: ImageConverter, deps: [{ token: Exif }, { token: i1.Platform }, { token: FileLoader }], target: i0.ɵɵFactoryTarget.Injectable }); }
361
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: ImageConverter, providedIn: 'root' }); }
339
+ calculateOffsetAndDimensions = (image, canvasWidth, canvasHeight) => {
340
+ const originalWidth = image.width;
341
+ const originalHeight = image.height;
342
+ const widthRatio = canvasWidth / originalWidth;
343
+ const heightRatio = canvasHeight / originalHeight;
344
+ let width;
345
+ let height;
346
+ if (originalWidth > originalHeight) {
347
+ height = originalHeight * heightRatio;
348
+ width = (originalWidth / originalHeight) * height;
349
+ }
350
+ else {
351
+ width = originalWidth * widthRatio;
352
+ height = (originalHeight / originalWidth) * width;
353
+ }
354
+ let xOffset = 0;
355
+ let yOffset = 0;
356
+ if (canvasHeight === height) {
357
+ xOffset = -((width - canvasWidth) / 2);
358
+ }
359
+ else if (canvasWidth === width) {
360
+ yOffset = -((height - canvasHeight) / 2);
361
+ }
362
+ return { xOffset, yOffset, width, height };
363
+ };
364
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: ImageConverter, deps: [{ token: Exif }, { token: i1.Platform }, { token: FileLoader }], target: i0.ɵɵFactoryTarget.Injectable });
365
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: ImageConverter, providedIn: 'root' });
362
366
  }
363
367
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: ImageConverter, decorators: [{
364
368
  type: Injectable,
@@ -378,12 +382,9 @@ const WINDOW = new InjectionToken('An abstraction over global window object', {
378
382
  });
379
383
 
380
384
  class Files {
381
- constructor(_platform, _rendererFactory, _window) {
382
- this._platform = _platform;
383
- this._rendererFactory = _rendererFactory;
384
- this._window = _window;
385
- this._renderer = this._rendererFactory.createRenderer(null, null);
386
- }
385
+ _platform = inject(Platform);
386
+ _renderer = inject(RendererFactory2).createRenderer(null, null);
387
+ _window = inject(WINDOW, { optional: true });
387
388
  download(blobOrFile, name) {
388
389
  if (!this._platform.isBrowser) {
389
390
  return;
@@ -444,47 +445,24 @@ class Files {
444
445
  anchor.click();
445
446
  }
446
447
  }
447
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Files, deps: [{ token: i1.Platform }, { token: i0.RendererFactory2 }, { token: WINDOW, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
448
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Files, providedIn: 'root' }); }
448
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Files, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
449
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Files, providedIn: 'root' });
449
450
  }
450
451
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Files, decorators: [{
451
452
  type: Injectable,
452
453
  args: [{
453
454
  providedIn: 'root'
454
455
  }]
455
- }], ctorParameters: () => [{ type: i1.Platform }, { type: i0.RendererFactory2 }, { type: Window, decorators: [{
456
- type: Optional
457
- }, {
458
- type: Inject,
459
- args: [WINDOW]
460
- }] }] });
456
+ }] });
461
457
 
462
458
  const ACCEPT_LANGUAGE = new InjectionToken('AcceptLanguage');
463
459
 
464
460
  class Languages {
461
+ _acceptLanguage;
462
+ // Data.
463
+ _data = [];
465
464
  constructor(_acceptLanguage) {
466
465
  this._acceptLanguage = _acceptLanguage;
467
- // Data.
468
- this._data = [];
469
- this.getLanguages = () => {
470
- // If defined we must be in a server environment.
471
- if (this._acceptLanguage) {
472
- return this._acceptLanguage;
473
- }
474
- // Try to get the languages from the navigator.
475
- if (typeof navigator !== 'object') {
476
- return null;
477
- }
478
- let t = 'anguage';
479
- let n = navigator;
480
- let f = n['l' + t + 's'];
481
- const data = f && f.length ? f : (t = n['l' + t] ||
482
- n['browserL' + t] ||
483
- n['userL' + t]) ? [t] : t;
484
- return typeof data === 'string'
485
- ? data
486
- : data.join(';');
487
- };
488
466
  this._data = this.initialize();
489
467
  }
490
468
  get all() {
@@ -517,8 +495,27 @@ class Languages {
517
495
  .filter(item => !!item)
518
496
  .sort((a, b) => b.quality - a.quality);
519
497
  }
520
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Languages, deps: [{ token: ACCEPT_LANGUAGE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
521
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Languages, providedIn: 'root' }); }
498
+ getLanguages = () => {
499
+ // If defined we must be in a server environment.
500
+ if (this._acceptLanguage) {
501
+ return this._acceptLanguage;
502
+ }
503
+ // Try to get the languages from the navigator.
504
+ if (typeof navigator !== 'object') {
505
+ return null;
506
+ }
507
+ let t = 'anguage';
508
+ let n = navigator;
509
+ let f = n['l' + t + 's'];
510
+ const data = f && f.length ? f : (t = n['l' + t] ||
511
+ n['browserL' + t] ||
512
+ n['userL' + t]) ? [t] : t;
513
+ return typeof data === 'string'
514
+ ? data
515
+ : data.join(';');
516
+ };
517
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Languages, deps: [{ token: ACCEPT_LANGUAGE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
518
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Languages, providedIn: 'root' });
522
519
  }
523
520
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Languages, decorators: [{
524
521
  type: Injectable,
@@ -537,12 +534,15 @@ const NAVIGATOR = new InjectionToken('An abstraction over window.navigator objec
537
534
  });
538
535
 
539
536
  class Network {
537
+ _platform;
538
+ _window;
539
+ _navigator;
540
+ // Data.
541
+ _online$ = of(true);
540
542
  constructor(_platform, _window, _navigator) {
541
543
  this._platform = _platform;
542
544
  this._window = _window;
543
545
  this._navigator = _navigator;
544
- // Data.
545
- this._online$ = of(true);
546
546
  this.getOnlineObservable();
547
547
  }
548
548
  online() {
@@ -564,8 +564,8 @@ class Network {
564
564
  // a user is online/offline.
565
565
  this._online$ = merge(now$, online$, offline$).pipe(distinctUntilChanged(), shareReplay({ refCount: true, bufferSize: 1 }));
566
566
  }
567
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Network, deps: [{ token: i1.Platform }, { token: WINDOW, optional: true }, { token: NAVIGATOR, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
568
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Network, providedIn: 'root' }); }
567
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Network, deps: [{ token: i1.Platform }, { token: WINDOW, optional: true }, { token: NAVIGATOR, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
568
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Network, providedIn: 'root' });
569
569
  }
570
570
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Network, decorators: [{
571
571
  type: Injectable,
@@ -585,13 +585,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImpor
585
585
  }] }] });
586
586
 
587
587
  class Patch {
588
+ _platform;
589
+ _window;
590
+ _document;
591
+ _hasPatchedMobileVerticalHeight = false;
592
+ // Subscriptions.
593
+ _subscription = new Subscription();
588
594
  constructor(_platform, _window, _document) {
589
595
  this._platform = _platform;
590
596
  this._window = _window;
591
597
  this._document = _document;
592
- this._hasPatchedMobileVerticalHeight = false;
593
- // Subscriptions.
594
- this._subscription = new Subscription();
595
598
  }
596
599
  mobileVerticalHeight() {
597
600
  // Check if the user has already patched
@@ -620,8 +623,8 @@ class Patch {
620
623
  // Save the subscription so we can destroy it later.
621
624
  this._subscription.add(subscription);
622
625
  }
623
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Patch, deps: [{ token: i1.Platform }, { token: WINDOW, optional: true }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
624
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Patch, providedIn: 'root' }); }
626
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Patch, deps: [{ token: i1.Platform }, { token: WINDOW, optional: true }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
627
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Patch, providedIn: 'root' });
625
628
  }
626
629
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.0", ngImport: i0, type: Patch, decorators: [{
627
630
  type: Injectable,