{"version":3,"file":"wacom.mjs","sources":["../../../projects/wacom/src/interfaces/alert.interface.ts","../../../projects/wacom/src/interfaces/config.interface.ts","../../../projects/wacom/src/interfaces/modal.interface.ts","../../../projects/wacom/src/services/meta.service.ts","../../../projects/wacom/src/guard/meta.guard.ts","../../../projects/wacom/src/components/alert/alert/alert.component.ts","../../../projects/wacom/src/components/alert/alert/alert.component.html","../../../projects/wacom/src/components/base.component.ts","../../../projects/wacom/src/components/alert/wrapper/wrapper.component.ts","../../../projects/wacom/src/components/alert/wrapper/wrapper.component.html","../../../projects/wacom/src/services/dom.service.ts","../../../projects/wacom/src/services/alert.service.ts","../../../projects/wacom/src/services/core.service.ts","../../../projects/wacom/src/components/crud.component.ts","../../../projects/wacom/src/components/loader/loader.component.ts","../../../projects/wacom/src/components/loader/loader.component.html","../../../projects/wacom/src/components/modal/modal.component.ts","../../../projects/wacom/src/components/modal/modal.component.html","../../../projects/wacom/src/directives/click-outside.directive.ts","../../../projects/wacom/src/pipes/arr.pipe.ts","../../../projects/wacom/src/pipes/mongodate.pipe.ts","../../../projects/wacom/src/pipes/number.pipe.ts","../../../projects/wacom/src/pipes/pagination.pipe.ts","../../../projects/wacom/src/pipes/safe.pipe.ts","../../../projects/wacom/src/pipes/search.pipe.ts","../../../projects/wacom/src/pipes/splice.pipe.ts","../../../projects/wacom/src/pipes/split.pipe.ts","../../../projects/wacom/src/services/base.service.ts","../../../projects/wacom/src/services/emitter.service.ts","../../../projects/wacom/src/interfaces/http.interface.ts","../../../projects/wacom/src/services/http.service.ts","../../../projects/wacom/src/interfaces/network.interface.ts","../../../projects/wacom/src/services/network.service.ts","../../../projects/wacom/src/services/store.service.ts","../../../projects/wacom/src/services/crud.service.ts","../../../projects/wacom/src/components/files/files.component.ts","../../../projects/wacom/src/components/files/files.component.html","../../../projects/wacom/src/services/file.service.ts","../../../projects/wacom/src/interfaces/loader.interface.ts","../../../projects/wacom/src/services/loader.service.ts","../../../projects/wacom/src/services/modal.service.ts","../../../projects/wacom/src/services/rtc.service.ts","../../../projects/wacom/src/services/socket.service.ts","../../../projects/wacom/src/services/time.service.ts","../../../projects/wacom/src/services/util.service.ts","../../../projects/wacom/src/theme.ts","../../../projects/wacom/src/provide-wacom.ts","../../../projects/wacom/src/wacom.module.ts","../../../projects/wacom/public-api.ts","../../../projects/wacom/wacom.ts"],"sourcesContent":["import { Signal, Type } from '@angular/core';\r\n\r\n/**\r\n * Possible alert variants that control styling and default icons.\r\n */\r\nexport const ALERT_TYPES = ['info', 'error', 'success', 'warning', 'question'];\r\nexport type AlertType = (typeof ALERT_TYPES)[number];\r\n\r\n/**\r\n * Possible screen positions where alerts can be placed.\r\n */\r\nexport const ALERT_POSITIONS = [\r\n\t'topLeft',\r\n\t'top',\r\n\t'topRight',\r\n\t'left',\r\n\t'center',\r\n\t'right',\r\n\t'bottomLeft',\r\n\t'bottom',\r\n\t'bottomRight',\r\n];\r\nexport type AlertPosition = (typeof ALERT_POSITIONS)[number];\r\n\r\n/**\r\n * Configuration for a button rendered inside an alert.\r\n */\r\nexport interface AlertButton {\r\n\t/** Text displayed on the button. */\r\n\ttext: string;\r\n\t/** Optional click handler invoked when the button is pressed. */\r\n\tcallback?: () => void;\r\n}\r\n\r\n/**\r\n * Base options that can be supplied when showing an alert.\r\n */\r\nexport interface AlertConfig {\r\n\t/** Message text displayed to the user. */\r\n\ttext?: string;\r\n\t/** One of {@link ALERT_TYPES} determining alert style. */\r\n\ttype?: AlertType;\r\n\t/** Location on screen where the alert should appear. */\r\n\tposition?: AlertPosition;\r\n\t/** Optional action buttons displayed within the alert. */\r\n\tbuttons?: AlertButton[];\r\n\t/** Optional icon name to show with the message. */\r\n\ticon?: string;\r\n\t/** Custom CSS class applied to the alert container. */\r\n\tclass?: string;\r\n\t/** Identifier used to ensure only one alert with this key exists. */\r\n\tunique?: string;\r\n\t/** Whether to show a progress bar. */\r\n\tprogress?: boolean;\r\n\t/** Milliseconds before auto dismissal. */\r\n\ttimeout?: number;\r\n\t/** Callback executed when the alert is closed. */\r\n\tclose?: () => void;\r\n\tclosable?: boolean;\r\n}\r\n\r\nexport interface Alert extends AlertConfig {\r\n\t/** Unique identifier for the alert instance. */\r\n\tid?: number;\r\n\t/** Reactive signal tracking progress bar value. */\r\n\tprogressPercentage?: Signal<number>;\r\n\t/** Handler executed when the alert closes. */\r\n\tonClose?: () => void;\r\n\t/** Component rendered inside the alert body. */\r\n\tcomponent?: Type<unknown>;\r\n\t[x: string]: unknown;\r\n}\r\n\r\n/**\r\n * Default values applied when an alert is shown without specific options.\r\n */\r\nexport const DEFAULT_ALERT_CONFIG: Alert = {\r\n\ttext: '',\r\n\ttype: 'info',\r\n\tclass: '',\r\n\tprogress: true,\r\n\tposition: 'bottom',\r\n\ttimeout: 3000,\r\n\tclosable: true,\r\n\tbuttons: [],\r\n};\r\n","import { InjectionToken } from '@angular/core';\r\nimport { AlertConfig } from './alert.interface';\r\nimport { HttpConfig } from './http.interface';\r\nimport { LoaderConfig } from './loader.interface';\r\nimport { MetaConfig } from './meta.interface';\r\nimport { ModalConfig } from './modal.interface';\r\nimport { NetworkConfig } from './network.interface';\r\nimport { StoreConfig } from './store.interface';\r\n\r\n/**\r\n * Root configuration object used to initialize the library.\r\n * Each property allows consumers to override the default\r\n * behavior of the corresponding service.\r\n */\r\nexport interface Config {\r\n\t/** Options for the key‑value storage service. */\r\n\tstore?: StoreConfig;\r\n\t/** Defaults applied to page metadata handling. */\r\n\tmeta?: MetaConfig;\r\n\t/** Global settings for the alert service. */\r\n\talert?: AlertConfig;\r\n\t/** Default options for loader overlays. */\r\n\tloader?: LoaderConfig;\r\n\t/** Configuration for modal dialogs. */\r\n\tmodal?: ModalConfig;\r\n\t/** Base HTTP settings such as API URL and headers. */\r\n\thttp?: HttpConfig;\r\n\t/** Optional socket connection configuration. */\r\n\tsocket?: any;\r\n\t/** Raw Socket.IO client instance, if used. */\r\n\tio?: any;\r\n\ttheme?: {\r\n\t\tprimary: string;\r\n\t\tsecondary: string;\r\n\t\tinfo: string;\r\n\t\terror: string;\r\n\t\tsuccess: string;\r\n\t\twarning: string;\r\n\t\tquestion: string;\r\n\t};\r\n\tnetwork?: NetworkConfig;\r\n}\r\n\r\nexport const CONFIG_TOKEN = new InjectionToken<Config>('config');\r\n\r\nexport const DEFAULT_CONFIG: Config = {\r\n\tstore: {\r\n\t\tprefix: 'waStore',\r\n\t},\r\n\tmeta: {\r\n\t\tuseTitleSuffix: false,\r\n\t\twarnMissingGuard: false,\r\n\t\tdefaults: { links: {} },\r\n\t},\r\n\tsocket: false,\r\n\thttp: {\r\n\t\turl: '',\r\n\t\theaders: {},\r\n\t},\r\n\ttheme: {\r\n\t\tprimary: '#fff',\r\n\t\tsecondary: '#000',\r\n\t\tinfo: '#9ddeff',\r\n\t\terror: '#ffafb4',\r\n\t\tsuccess: '#a6efb8',\r\n\t\twarning: '#ffcfa5',\r\n\t\tquestion: '#fff9b2',\r\n\t},\r\n};\r\n","import { Signal, Type } from '@angular/core';\r\n\r\nexport const MODAL_SIZES = ['small', 'mid', 'big', 'full'];\r\nexport type ModalSizes = (typeof MODAL_SIZES)[number];\r\n\r\n/**\r\n * Configuration for a button rendered inside an modal.\r\n */\r\nexport interface ModalButton {\r\n\t/** Text displayed on the button. */\r\n\ttext: string;\r\n\t/** Optional click handler invoked when the button is pressed. */\r\n\tcallback?: () => void;\r\n}\r\n\r\nexport interface ModalConfig {\r\n\t/** Size of the modal window. */\r\n\tsize?: ModalSizes;\r\n\t/** Optional action buttons displayed within the Modal. */\r\n\tbuttons?: ModalButton[];\r\n\t/** Custom CSS class applied to the Modal container. */\r\n\tclass?: string;\r\n\t/** Identifier used to ensure only one Modal with this key exists. */\r\n\tunique?: string;\r\n\t/** Whether to show a progress bar. */\r\n\tprogress?: boolean;\r\n\t/** Milliseconds before auto dismissal. */\r\n\ttimeout?: number;\r\n\t/** Callback executed when the Modal is closed. */\r\n\tclose?: () => void;\r\n\t/** Allow closing the modal via UI controls. */\r\n\tclosable?: boolean;\r\n}\r\n\r\nexport interface Modal extends ModalConfig {\r\n\t/** Component used to render the modal content. */\r\n\tcomponent: Type<unknown>;\r\n\t/** Unique identifier for the modal instance. */\r\n\tid?: number;\r\n\t/** Signal emitting the current progress percentage. */\r\n\tprogressPercentage?: Signal<number>;\r\n\t/** Handler called when the user clicks outside the modal. */\r\n\tonClickOutside?: () => void;\r\n\t/** Callback executed when the modal closes. */\r\n\tonClose?: () => void;\r\n\t/** Callback executed when the modal opens. */\r\n\tonOpen?: () => void;\r\n\t[x: string]: unknown;\r\n}\r\n\r\nexport const DEFAULT_MODAL_CONFIG: ModalConfig = {\r\n\tsize: 'mid',\r\n\ttimeout: 0,\r\n\tclass: '',\r\n\tclosable: true,\r\n};\r\n","import { Inject, Injectable, Optional } from '@angular/core';\r\nimport { Meta, Title } from '@angular/platform-browser';\r\nimport { Route, Router } from '@angular/router';\r\nimport {\r\n\tCONFIG_TOKEN,\r\n\tConfig,\r\n\tDEFAULT_CONFIG,\r\n} from '../interfaces/config.interface';\r\nimport { MetaConfig, MetaDefaults } from '../interfaces/meta.interface';\r\n\r\nconst isDefined = (val: any) => typeof val !== 'undefined';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root',\r\n})\r\nexport class MetaService {\r\n\tprivate _meta: MetaConfig;\r\n\r\n\tconstructor(\r\n\t\t@Inject(CONFIG_TOKEN) @Optional() private config: Config,\r\n\t\tprivate router: Router,\r\n\t\tprivate meta: Meta,\r\n\t\tprivate titleService: Title,\r\n\t) {\r\n\t\tthis.config = this.config || DEFAULT_CONFIG;\r\n\r\n\t\tthis._meta = this.config.meta || {};\r\n\r\n\t\tthis._warnMissingGuard();\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the default meta tags.\r\n\t *\r\n\t * @param defaults - The default meta tags.\r\n\t */\r\n\tsetDefaults(defaults: MetaDefaults) {\r\n\t\tthis._meta.defaults = {\r\n\t\t\t...this._meta.defaults,\r\n\t\t\t...defaults,\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the title and optional title suffix.\r\n\t *\r\n\t * @param title - The title to set.\r\n\t * @param titleSuffix - The title suffix to append.\r\n\t * @returns The MetaService instance.\r\n\t */\r\n\tsetTitle(title?: string, titleSuffix?: string): MetaService {\r\n\t\tlet titleContent = isDefined(title)\r\n\t\t\t? title || ''\r\n\t\t\t: this._meta.defaults?.['title'] || '';\r\n\r\n\t\tif (this._meta.useTitleSuffix) {\r\n\t\t\ttitleContent += isDefined(titleSuffix)\r\n\t\t\t\t? titleSuffix\r\n\t\t\t\t: this._meta.defaults?.['titleSuffix'] || '';\r\n\t\t}\r\n\r\n\t\tthis._updateMetaTag('title', titleContent);\r\n\r\n\t\tthis._updateMetaTag('og:title', titleContent);\r\n\r\n\t\tthis._updateMetaTag('twitter:title', titleContent);\r\n\r\n\t\tthis.titleService.setTitle(titleContent);\r\n\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Sets link tags.\r\n\t *\r\n\t * @param links - The links to set.\r\n\t * @returns The MetaService instance.\r\n\t */\r\n\tsetLink(links: { [key: string]: string }): MetaService {\r\n\t\tObject.keys(links).forEach((rel) => {\r\n\t\t\tlet link: HTMLLinkElement = document.createElement('link');\r\n\r\n\t\t\tlink.setAttribute('rel', rel);\r\n\r\n\t\t\tlink.setAttribute('href', links[rel]);\r\n\r\n\t\t\tdocument.head.appendChild(link);\r\n\t\t});\r\n\r\n\t\treturn this;\r\n\t}\r\n\r\n\t/**\r\n\t * Sets a meta tag.\r\n\t *\r\n\t * @param tag - The meta tag name.\r\n\t * @param value - The meta tag value.\r\n\t * @param prop - The meta tag property.\r\n\t */\r\n\tsetTag(tag: string, value: string, prop?: string) {\r\n\t\tif (tag === 'title' || tag === 'titleSuffix') {\r\n\t\t\tthrow new Error(\r\n\t\t\t\t`Attempt to set ${tag} through 'setTag': 'title' and 'titleSuffix' are reserved. Use 'MetaService.setTitle' instead.`,\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tconst content =\r\n\t\t\t(isDefined(value)\r\n\t\t\t\t? value || ''\r\n\t\t\t\t: this._meta.defaults?.[tag] || '') + '';\r\n\r\n\t\tthis._updateMetaTag(tag, content, prop);\r\n\r\n\t\tif (tag === 'description') {\r\n\t\t\tthis._updateMetaTag('og:description', content, prop);\r\n\r\n\t\t\tthis._updateMetaTag('twitter:description', content, prop);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Updates a meta tag.\r\n\t *\r\n\t * @param tag - The meta tag name.\r\n\t * @param value - The meta tag value.\r\n\t * @param prop - The meta tag property.\r\n\t */\r\n\tprivate _updateMetaTag(tag: string, value: string, prop?: string): void {\r\n\t\tprop =\r\n\t\t\tprop ||\r\n\t\t\t(tag.startsWith('og:') || tag.startsWith('twitter:')\r\n\t\t\t\t? 'property'\r\n\t\t\t\t: 'name');\r\n\r\n\t\tthis.meta.updateTag({ [prop]: tag, content: value });\r\n\t}\r\n\r\n\t/**\r\n\t * Removes a meta tag.\r\n\t *\r\n\t * @param tag - The meta tag name.\r\n\t * @param prop - The meta tag property.\r\n\t */\r\n\tremoveTag(tag: string, prop?: string): void {\r\n\t\tprop =\r\n\t\t\tprop ||\r\n\t\t\t(tag.startsWith('og:') || tag.startsWith('twitter:')\r\n\t\t\t\t? 'property'\r\n\t\t\t\t: 'name');\r\n\r\n\t\tthis.meta.removeTag(`${prop}=\"${tag}\"`);\r\n\t}\r\n\r\n\t/**\r\n\t * Warns about missing meta guards in routes.\r\n\t */\r\n\tprivate _warnMissingGuard(): void {\r\n\t\tif (\r\n\t\t\tisDefined(this._meta.warnMissingGuard) &&\r\n\t\t\t!this._meta.warnMissingGuard\r\n\t\t) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst hasDefaultMeta = !!Object.keys(this._meta.defaults ?? {}).length;\r\n\r\n\t\tconst hasMetaGuardInArr = (it: any) =>\r\n\t\t\tit && it.IDENTIFIER === 'MetaGuard';\r\n\r\n\t\tlet hasShownWarnings = false;\r\n\r\n\t\tconst checkRoute = (route: Route) => {\r\n\t\t\tconst hasRouteMeta = route.data && route.data['meta'];\r\n\r\n\t\t\tconst showWarning =\r\n\t\t\t\t!isDefined(route.redirectTo) &&\r\n\t\t\t\t(hasDefaultMeta || hasRouteMeta) &&\r\n\t\t\t\t!(route.canActivate || []).some(hasMetaGuardInArr);\r\n\r\n\t\t\tif (showWarning) {\r\n\t\t\t\tconsole.warn(\r\n\t\t\t\t\t`Route with path \"${route.path}\" has ${\r\n\t\t\t\t\t\thasRouteMeta ? '' : 'default '\r\n\t\t\t\t\t}meta tags, but does not use MetaGuard. Please add MetaGuard to the canActivate array in your route configuration`,\r\n\t\t\t\t);\r\n\r\n\t\t\t\thasShownWarnings = true;\r\n\t\t\t}\r\n\r\n\t\t\t(route.children || []).forEach(checkRoute);\r\n\t\t};\r\n\r\n\t\tthis.router.config.forEach(checkRoute);\r\n\r\n\t\tif (hasShownWarnings) {\r\n\t\t\tconsole.warn(\r\n\t\t\t\t`To disable these warnings, set metaConfig.warnMissingGuard: false in your MetaConfig passed to MetaModule.forRoot()`,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n}\r\n","import { Inject, Injectable, Optional } from '@angular/core';\r\nimport { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';\r\nimport {\r\n\tCONFIG_TOKEN,\r\n\tConfig,\r\n\tDEFAULT_CONFIG,\r\n} from '../interfaces/config.interface';\r\nimport { MetaService } from '../services/meta.service';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class MetaGuard {\r\n\tpublic static IDENTIFIER = 'MetaGuard';\r\n\tprivate _meta: any;\r\n\tpublic constructor(\r\n\t\tprivate metaService: MetaService,\r\n\t\t@Inject(CONFIG_TOKEN) @Optional() private config: Config,\r\n\t) {\r\n\t\tif (!this.config) this.config = DEFAULT_CONFIG;\r\n\t\tthis._meta = this.config.meta || {};\r\n\t\tthis._meta.defaults = this._meta.defaults || {};\r\n\t}\r\n\tpublic canActivate(\r\n\t\troute: ActivatedRouteSnapshot,\r\n\t\tstate: RouterStateSnapshot,\r\n\t): boolean {\r\n\t\tthis._processRouteMetaTags(route.data && route.data['meta']);\r\n\t\treturn true;\r\n\t}\r\n\tprivate _processRouteMetaTags(meta: any = {}) {\r\n\t\tif (meta.disableUpdate) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif (meta.title) {\r\n\t\t\tthis.metaService.setTitle(meta.title, meta.titleSuffix);\r\n\t\t}\r\n\t\tif (meta.links && Object.keys(meta.links).length) {\r\n\t\t\tthis.metaService.setLink(meta.links);\r\n\t\t}\r\n\t\tif (\r\n\t\t\tthis._meta.defaults?.links &&\r\n\t\t\tObject.keys(this._meta.defaults.links).length\r\n\t\t) {\r\n\t\t\tthis.metaService.setLink(this._meta.defaults.links);\r\n\t\t}\r\n\t\tObject.keys(meta).forEach((prop) => {\r\n\t\t\tif (\r\n\t\t\t\tprop === 'title' ||\r\n\t\t\t\tprop === 'titleSuffix' ||\r\n\t\t\t\tprop === 'links'\r\n\t\t\t) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tObject.keys(meta[prop]).forEach((key) => {\r\n\t\t\t\tthis.metaService.setTag(key, meta[prop][key], prop);\r\n\t\t\t});\r\n\t\t});\r\n\t\tObject.keys(this._meta.defaults).forEach((key) => {\r\n\t\t\tif (\r\n\t\t\t\tkey in meta ||\r\n\t\t\t\tkey === 'title' ||\r\n\t\t\t\tkey === 'titleSuffix' ||\r\n\t\t\t\tkey === 'links'\r\n\t\t\t) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tthis.metaService.setTag(key, this._meta.defaults[key] as string);\r\n\t\t});\r\n\t}\r\n}\r\n","import { CommonModule } from '@angular/common';\r\nimport { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core';\r\nimport {\r\n\tAlertButton,\r\n\tAlertPosition,\r\n\tAlertType,\r\n} from '../../../interfaces/alert.interface';\r\n\r\n@Component({\r\n\tselector: 'alert',\r\n\ttemplateUrl: './alert.component.html',\r\n\tstyleUrls: ['./alert.component.scss'],\r\n\timports: [CommonModule],\r\n})\r\n/**\r\n * Displays an individual alert message with optional icon, actions and\r\n * auto‑dismiss behaviour. All inputs are configured by the service when the\r\n * component is created dynamically.\r\n */\r\nexport class AlertComponent implements AfterViewInit {\r\n\t/** Reference to the DOM element hosting the alert. */\r\n\t@ViewChild('alertRef') alertRef!: ElementRef<HTMLDivElement>;\r\n\r\n\t/** Callback invoked to remove the alert from the DOM. */\r\n\tclose!: () => void;\r\n\r\n\t/** Text content displayed inside the alert. */\r\n\ttext!: string;\r\n\r\n\t/** Additional CSS classes applied to the alert container. */\r\n\tclass!: string;\r\n\r\n\t/** Type of alert which determines styling and icon. */\r\n\ttype: AlertType = 'info';\r\n\r\n\t/** Position on the screen where the alert appears. */\r\n\tposition: AlertPosition = 'bottom';\r\n\r\n\t/** Whether a progress bar indicating remaining time is shown. */\r\n\tprogress!: boolean;\r\n\r\n\t/** Icon name displayed alongside the message. */\r\n\ticon!: string;\r\n\r\n\t/** Time in milliseconds before the alert auto closes. */\r\n\ttimeout!: number;\r\n\r\n\t/** Determines if a manual close button is visible. */\r\n\tclosable!: boolean;\r\n\r\n\t/** Flag used to trigger the deletion animation. */\r\n\tdelete_animation = false;\r\n\r\n\t/** Optional action buttons rendered within the alert. */\r\n\tbuttons: AlertButton[] = [];\r\n\r\n\t/**\r\n\t * Starts the auto‑dismiss timer and pauses it while the alert is\r\n\t * hovered, resuming when the mouse leaves.\r\n\t */\r\n\tngAfterViewInit(): void {\r\n\t\tif (this.timeout) {\r\n\t\t\tlet remaining = JSON.parse(JSON.stringify(this.timeout));\r\n\r\n\t\t\tlet timer: number = window.setTimeout(() => {\r\n\t\t\t\tthis.remove();\r\n\t\t\t}, remaining);\r\n\r\n\t\t\tlet start = new Date();\r\n\r\n\t\t\tthis.alertRef.nativeElement.addEventListener(\r\n\t\t\t\t'mouseenter',\r\n\t\t\t\t() => {\r\n\t\t\t\t\tclearTimeout(timer);\r\n\r\n\t\t\t\t\tremaining -= new Date().getTime() - start.getTime();\r\n\t\t\t\t},\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\r\n\t\t\tthis.alertRef.nativeElement.addEventListener(\r\n\t\t\t\t'mouseleave',\r\n\t\t\t\t() => {\r\n\t\t\t\t\tstart = new Date();\r\n\r\n\t\t\t\t\tclearTimeout(timer);\r\n\r\n\t\t\t\t\ttimer = window.setTimeout(() => {\r\n\t\t\t\t\t\tthis.remove();\r\n\t\t\t\t\t}, remaining);\r\n\t\t\t\t},\r\n\t\t\t\tfalse,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Triggers the closing animation and invokes the provided close\r\n\t * callback once finished.\r\n\t */\r\n\tremove(callback?: () => void) {\r\n\t\tif (this._removed) return;\r\n\r\n\t\tthis._removed = true;\r\n\r\n\t\tcallback?.();\r\n\r\n\t\tthis.delete_animation = true;\r\n\r\n\t\tsetTimeout(() => {\r\n\t\t\tthis.close();\r\n\r\n\t\t\tthis.delete_animation = false;\r\n\t\t}, 350);\r\n\t}\r\n\tprivate _removed = false;\r\n}\r\n","@if (text) {\r\n\t<div\r\n\t\tclass=\"wacom-alert wacom-alert--auto-height\"\r\n\t\t[class.wacom-alert--closing]=\"delete_animation\"\r\n\t\t[ngClass]=\"class\"\r\n\t>\r\n\t\t<div\r\n\t\t\t[ngClass]=\"'wacom-alert__content--color-' + type\"\r\n\t\t\tclass=\"wacom-alert__content wacom-alert__content--bounce-in-up\"\r\n\t\t\t#alertRef\r\n\t\t>\r\n\t\t\t@if (progress) {\r\n\t\t\t\t<div class=\"wacom-alert__progress\">\r\n\t\t\t\t\t<span\r\n\t\t\t\t\t\tclass=\"wacom-alert__progress-bar\"\r\n\t\t\t\t\t\t[ngClass]=\"'wacom-alert__progress-bar--' + type\"\r\n\t\t\t\t\t\t[ngStyle]=\"{\r\n\t\t\t\t\t\t\t'animation-duration': (timeout + 350) / 1000 + 's',\r\n\t\t\t\t\t\t}\"\r\n\t\t\t\t\t></span>\r\n\t\t\t\t</div>\r\n\t\t\t}\r\n\t\t\t<div class=\"wacom-alert__body\">\r\n\t\t\t\t<div class=\"wacom-alert__texts\">\r\n\t\t\t\t\t@if (icon) {\r\n\t\t\t\t\t\t<div class=\"{{ icon }}\"></div>\r\n\t\t\t\t\t}\r\n\t\t\t\t\t<div\r\n\t\t\t\t\t\tclass=\"wacom-alert__message wacom-alert__message--slide-in\"\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t{{ text }}\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t\t@if (type === \"question\") {\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\t@for (button of buttons; track button.text) {\r\n\t\t\t\t\t\t\t<button\r\n\t\t\t\t\t\t\t\t(click)=\"remove(button.callback)\"\r\n\t\t\t\t\t\t\t\tclass=\"wacom-alert__button\"\r\n\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t{{ button.text }}\r\n\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t</div>\r\n\t\t\t\t}\r\n\t\t\t\t@if (closable) {\r\n\t\t\t\t\t<div class=\"wacom-alert__close\" (click)=\"remove()\"></div>\r\n\t\t\t\t}\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n}\r\n","/**\n * BaseComponent is an abstract class that provides basic functionality for managing the current timestamp.\n */\nexport abstract class BaseComponent {\n\t/**\n\t * The current timestamp in milliseconds since the Unix epoch.\n\t */\n\tnow = new Date().getTime();\n\n\t/**\n\t * Refreshes the `now` property with the current timestamp.\n\t */\n\trefreshNow(): void {\n\t\tthis.now = new Date().getTime();\n\t}\n}\n","import { Component } from '@angular/core';\r\n\r\n@Component({\r\n\tselector: 'lib-wrapper',\r\n\ttemplateUrl: './wrapper.component.html',\r\n\tstyleUrls: ['./wrapper.component.scss'],\r\n\timports: [],\r\n})\r\n/**\r\n * Container component that provides placeholder elements for alert instances\r\n * rendered in different screen positions.\r\n */\r\nexport class WrapperComponent {}\r\n","<div class=\"wacom-wrapper\">\r\n\t<div\r\n\t\tclass=\"wacom-wrapper__alert wacom-wrapper__alert--top-left\"\r\n\t\tid=\"topLeft\"\r\n\t></div>\r\n\t<div class=\"wacom-wrapper__alert wacom-wrapper__alert--top\" id=\"top\"></div>\r\n\t<div\r\n\t\tclass=\"wacom-wrapper__alert wacom-wrapper__alert--top-right\"\r\n\t\tid=\"topRight\"\r\n\t></div>\r\n\r\n\t<div\r\n\t\tclass=\"wacom-wrapper__alert wacom-wrapper__alert--left\"\r\n\t\tid=\"left\"\r\n\t></div>\r\n\t<div\r\n\t\tclass=\"wacom-wrapper__alert wacom-wrapper__alert--center\"\r\n\t\tid=\"center\"\r\n\t></div>\r\n\t<div\r\n\t\tclass=\"wacom-wrapper__alert wacom-wrapper__alert--right\"\r\n\t\tid=\"right\"\r\n\t></div>\r\n\r\n\t<div\r\n\t\tclass=\"wacom-wrapper__alert wacom-wrapper__alert--bottom-left\"\r\n\t\tid=\"bottomLeft\"\r\n\t></div>\r\n\t<div\r\n\t\tclass=\"wacom-wrapper__alert wacom-wrapper__alert--bottom\"\r\n\t\tid=\"bottom\"\r\n\t></div>\r\n\t<div\r\n\t\tclass=\"wacom-wrapper__alert wacom-wrapper__alert--bottom-right\"\r\n\t\tid=\"bottomRight\"\r\n\t></div>\r\n</div>\r\n","import {\r\n\tApplicationRef,\r\n\tComponentRef,\r\n\tEmbeddedViewRef,\r\n\tEnvironmentInjector,\r\n\tInjectable,\r\n\tType,\r\n\tcreateComponent,\r\n\tinject,\r\n} from '@angular/core';\r\nimport { DomComponent } from '../interfaces/dom.interface';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root',\r\n})\r\n/**\r\n * Utility service for programmatically creating and interacting with Angular\r\n * components within the DOM.\r\n */\r\nexport class DomService {\r\n\t/**\r\n\t * Appends a component to a specified element by ID.\r\n\t *\r\n\t * @param component - The component to append.\r\n\t * @param options - The options to project into the component.\r\n\t * @param id - The ID of the element to append the component to.\r\n\t * @returns An object containing the native element and the component reference.\r\n\t */\r\n\tappendById<T>(\r\n\t\tcomponent: Type<T>,\r\n\t\toptions: Partial<T> = {},\r\n\t\tid: string,\r\n\t): DomComponent<T> {\r\n\t\tconst componentRef = createComponent(component, {\r\n\t\t\tenvironmentInjector: this._injector,\r\n\t\t});\r\n\r\n\t\tthis.projectComponentInputs(componentRef, options);\r\n\r\n\t\tthis._appRef.attachView(componentRef.hostView);\r\n\r\n\t\tconst domElem = (componentRef.hostView as EmbeddedViewRef<T>)\r\n\t\t\t.rootNodes[0] as HTMLElement;\r\n\r\n\t\tconst element = document.getElementById(id);\r\n\r\n\t\tif (element && typeof element.appendChild === 'function') {\r\n\t\t\telement.appendChild(domElem);\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tnativeElement: domElem,\r\n\t\t\tcomponentRef: componentRef,\r\n\t\t\tremove: () => this.removeComponent(componentRef),\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * Appends a component to a specified element or to the body.\r\n\t *\r\n\t * @param component - The component to append.\r\n\t * @param options - The options to project into the component.\r\n\t * @param element - The element to append the component to. Defaults to body.\r\n\t * @returns An object containing the native element and the component reference.\r\n\t */\r\n\tappendComponent<T>(\r\n\t\tcomponent: Type<T>,\r\n\t\toptions: Partial<T & { providedIn?: string }> = {},\r\n\t\telement: HTMLElement = document.body,\r\n\t): DomComponent<T> | void {\r\n\t\tif (options.providedIn) {\r\n\t\t\tif (this._providedIn[options.providedIn]) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tthis._providedIn[options.providedIn] = true;\r\n\t\t}\r\n\r\n\t\tconst componentRef = createComponent(component, {\r\n\t\t\tenvironmentInjector: this._injector,\r\n\t\t});\r\n\r\n\t\tthis.projectComponentInputs(componentRef, options);\r\n\r\n\t\tthis._appRef.attachView(componentRef.hostView);\r\n\r\n\t\tconst domElem = (componentRef.hostView as EmbeddedViewRef<T>)\r\n\t\t\t.rootNodes[0] as HTMLElement;\r\n\r\n\t\tif (element && typeof element.appendChild === 'function') {\r\n\t\t\telement.appendChild(domElem);\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tnativeElement: domElem,\r\n\t\t\tcomponentRef: componentRef,\r\n\t\t\tremove: () =>\r\n\t\t\t\tthis.removeComponent(componentRef, options.providedIn),\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * Gets a reference to a dynamically created component.\r\n\t *\r\n\t * @param component - The component to create.\r\n\t * @param options - The options to project into the component.\r\n\t * @returns The component reference.\r\n\t */\r\n\tgetComponentRef<T>(\r\n\t\tcomponent: Type<T>,\r\n\t\toptions: Partial<T> = {},\r\n\t): ComponentRef<T> {\r\n\t\tconst componentRef = createComponent(component, {\r\n\t\t\tenvironmentInjector: this._injector,\r\n\t\t});\r\n\r\n\t\tthis.projectComponentInputs(componentRef, options);\r\n\r\n\t\tthis._appRef.attachView(componentRef.hostView);\r\n\r\n\t\treturn componentRef;\r\n\t}\r\n\r\n\t/**\r\n\t * Projects the inputs onto the component.\r\n\t *\r\n\t * @param component - The component reference.\r\n\t * @param options - The options to project into the component.\r\n\t * @returns The component reference with the projected inputs.\r\n\t */\r\n\tprivate projectComponentInputs<T>(\r\n\t\tcomponent: ComponentRef<T>,\r\n\t\toptions: Partial<T>,\r\n\t): ComponentRef<T> {\r\n\t\tif (options) {\r\n\t\t\tconst props = Object.getOwnPropertyNames(options);\r\n\r\n\t\t\tfor (const prop of props) {\r\n\t\t\t\t(component.instance as any)[prop] = (options as any)[prop];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn component;\r\n\t}\r\n\r\n\t/**\r\n\t * Removes a previously attached component and optionally clears its\r\n\t * unique `providedIn` flag.\r\n\t *\r\n\t * @param componentRef - Reference to the component to be removed.\r\n\t * @param providedIn - Optional key used to track unique instances.\r\n\t */\r\n\tremoveComponent<T>(\r\n\t\tcomponentRef: ComponentRef<T>,\r\n\t\tprovidedIn?: string,\r\n\t): void {\r\n\t\tthis._appRef.detachView(componentRef.hostView);\r\n\r\n\t\tcomponentRef.destroy();\r\n\r\n\t\tif (providedIn) {\r\n\t\t\tdelete this._providedIn[providedIn];\r\n\t\t}\r\n\t}\r\n\r\n\t/** Reference to the root application used for view attachment. */\r\n\tprivate _appRef = inject(ApplicationRef);\r\n\r\n\t/** Injector utilized when creating dynamic components. */\r\n\tprivate _injector = inject(EnvironmentInjector);\r\n\r\n\t/**\r\n\t * Flags to ensure components with a specific `providedIn` key are only\r\n\t * instantiated once at a time.\r\n\t */\r\n\tprivate _providedIn: Record<string, boolean> = {};\r\n}\r\n","import { Inject, Injectable, Optional } from '@angular/core';\r\nimport { AlertComponent } from '../components/alert/alert/alert.component';\r\nimport { WrapperComponent } from '../components/alert/wrapper/wrapper.component';\r\nimport {\r\n\tAlert,\r\n\tAlertConfig,\r\n\tDEFAULT_ALERT_CONFIG,\r\n} from '../interfaces/alert.interface';\r\nimport { Config, CONFIG_TOKEN } from '../interfaces/config.interface';\r\nimport { DomComponent } from '../interfaces/dom.interface';\r\nimport { DomService } from './dom.service';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root',\r\n})\r\nexport class AlertService {\r\n\t/**\r\n\t * Creates a new alert service.\r\n\t *\r\n\t * @param config Optional global configuration provided via the\r\n\t * `CONFIG_TOKEN` injection token.\r\n\t * @param _dom Service responsible for DOM manipulation and dynamic\r\n\t * component creation.\r\n\t */\r\n\tconstructor(\r\n\t\t@Inject(CONFIG_TOKEN) @Optional() config: Config,\r\n\t\tprivate _dom: DomService,\r\n\t) {\r\n\t\tthis._config = {\r\n\t\t\t...DEFAULT_ALERT_CONFIG,\r\n\t\t\t...(config?.alert || {}),\r\n\t\t};\r\n\r\n\t\tthis._container = this._dom.appendComponent(WrapperComponent)!;\r\n\t}\r\n\r\n\t/**\r\n\t * Displays an alert. Accepts either an options object or a simple string\r\n\t * which will be used as the alert text.\r\n\t *\r\n\t * @returns Reference to the created alert or embedded component\r\n\t *          element.\r\n\t */\r\n\tshow(opts: Alert | string): Alert {\r\n\t\topts = this._opts(opts);\r\n\r\n\t\tif (opts.text && typeof this._translate === 'function') {\r\n\t\t\topts.text = this._translate(opts.text);\r\n\t\t}\r\n\r\n\t\tif (opts.unique && this._alerts.find((m) => m.unique === opts.unique)) {\r\n\t\t\treturn this._alerts.find((m) => m.unique === opts.unique) as Alert;\r\n\t\t}\r\n\r\n\t\tthis._alerts.push(opts);\r\n\r\n\t\topts.id ||= Math.floor(Math.random() * Date.now()) + Date.now();\r\n\r\n\t\tif (!opts.type) opts.type = 'info';\r\n\r\n\t\tif (!opts.position) opts.position = 'bottomRight';\r\n\r\n\t\tlet alertComponent: DomComponent<AlertComponent> | undefined;\r\n\r\n\t\tlet content: DomComponent<any> | undefined;\r\n\r\n\t\topts.close = () => {\r\n\t\t\tcontent?.remove();\r\n\r\n\t\t\talertComponent?.remove();\r\n\r\n\t\t\tcontent = undefined;\r\n\r\n\t\t\talertComponent = undefined;\r\n\r\n\t\t\tif (typeof (opts as Alert).onClose == 'function') {\r\n\t\t\t\t(opts as Alert).onClose?.();\r\n\t\t\t}\r\n\r\n\t\t\tthis._alerts.splice(\r\n\t\t\t\tthis._alerts.findIndex((m) => m.id === opts.id),\r\n\t\t\t\t1,\r\n\t\t\t);\r\n\t\t};\r\n\r\n\t\talertComponent = this._dom.appendById(\r\n\t\t\tAlertComponent,\r\n\t\t\topts,\r\n\t\t\topts.position,\r\n\t\t);\r\n\r\n\t\tif (typeof opts.component === 'function') {\r\n\t\t\tcontent = this._dom.appendComponent(\r\n\t\t\t\topts.component,\r\n\t\t\t\topts as Partial<{ providedIn?: string | undefined }>,\r\n\t\t\t\tthis._container.nativeElement.children[0].children[\r\n\t\t\t\t\tthis._positionNumber[opts.position] || 0\r\n\t\t\t\t] as HTMLElement,\r\n\t\t\t)!;\r\n\t\t}\r\n\r\n\t\tif (typeof opts.timeout !== 'number') {\r\n\t\t\topts.timeout = 3000;\r\n\t\t}\r\n\r\n\t\tif (opts.timeout) {\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\topts.close?.();\r\n\t\t\t}, opts.timeout);\r\n\t\t}\r\n\r\n\t\treturn opts;\r\n\t}\r\n\r\n\t/**\r\n\t * Convenience alias for `show`.\r\n\t */\r\n\topen(opts: Alert) {\r\n\t\tthis.show(opts);\r\n\t}\r\n\r\n\t/**\r\n\t * Displays an informational alert.\r\n\t */\r\n\tinfo(opts: Alert) {\r\n\t\topts = this._opts(opts);\r\n\r\n\t\topts.type = 'info';\r\n\r\n\t\tthis.show(opts);\r\n\t}\r\n\r\n\t/**\r\n\t * Displays a success alert.\r\n\t */\r\n\tsuccess(opts: Alert) {\r\n\t\topts = this._opts(opts);\r\n\r\n\t\topts.type = 'success';\r\n\r\n\t\tthis.show(opts);\r\n\t}\r\n\r\n\t/**\r\n\t * Displays a warning alert.\r\n\t */\r\n\twarning(opts: Alert) {\r\n\t\topts = this._opts(opts);\r\n\r\n\t\topts.type = 'warning';\r\n\r\n\t\tthis.show(opts);\r\n\t}\r\n\r\n\t/**\r\n\t * Displays an error alert.\r\n\t */\r\n\terror(opts: Alert) {\r\n\t\topts = this._opts(opts);\r\n\r\n\t\topts.type = 'error';\r\n\r\n\t\tthis.show(opts);\r\n\t}\r\n\r\n\t/**\r\n\t * Displays a question alert.\r\n\t */\r\n\tquestion(opts: Alert) {\r\n\t\topts = this._opts(opts);\r\n\r\n\t\topts.type = 'question';\r\n\r\n\t\tthis.show(opts);\r\n\t}\r\n\r\n\t/**\r\n\t * Removes all alert elements from the document.\r\n\t */\r\n\tdestroy() {\r\n\t\tfor (let i = this._alerts.length - 1; i >= 0; i--) {\r\n\t\t\tthis._alerts[i].close?.();\r\n\t\t}\r\n\t}\r\n\r\n\tsetTranslate(_translate: (phrase: string) => string) {\r\n\t\tthis._translate = _translate;\r\n\t}\r\n\r\n\tprivate _alerts: Alert[] = [];\r\n\r\n\t/** Merged configuration applied to new alerts. */\r\n\tprivate _config: AlertConfig;\r\n\r\n\t/** Wrapper component that contains all alert placeholders. */\r\n\tprivate _container: DomComponent<WrapperComponent>;\r\n\r\n\t/** Mapping of alert positions to wrapper child indexes. */\r\n\tprivate _positionNumber: Record<string, number> = {\r\n\t\ttopLeft: 0,\r\n\t\ttop: 1,\r\n\t\ttopRight: 2,\r\n\t\tleft: 3,\r\n\t\tcenter: 4,\r\n\t\tright: 5,\r\n\t\tbottomLeft: 6,\r\n\t\tbottom: 7,\r\n\t\tbottomRight: 8,\r\n\t};\r\n\r\n\tprivate _opts(opts: Alert | string): Alert {\r\n\t\treturn typeof opts === 'string'\r\n\t\t\t? {\r\n\t\t\t\t\t...this._config,\r\n\t\t\t\t\ttext: opts,\r\n\t\t\t\t}\r\n\t\t\t: {\r\n\t\t\t\t\t...this._config,\r\n\t\t\t\t\t...opts,\r\n\t\t\t\t};\r\n\t}\r\n\r\n\tprivate _translate = (phrase: string) => '';\r\n}\r\n","// Core utilities and helpers for the Wacom app\r\nimport { Injectable, Signal, WritableSignal, signal } from '@angular/core';\r\n\r\n// Add capitalize method to String prototype if it doesn't already exist\r\nif (!String.prototype.capitalize) {\r\n\tString.prototype.capitalize = function (): string {\r\n\t\tif (this.length > 0) {\r\n\t\t\treturn this.charAt(0).toUpperCase() + this.slice(1).toLowerCase();\r\n\t\t}\r\n\t\treturn '';\r\n\t};\r\n}\r\n\r\n// Extend the String interface to include the new method\r\ndeclare global {\r\n\tinterface String {\r\n\t\tcapitalize(): string;\r\n\t}\r\n}\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root',\r\n})\r\nexport class CoreService {\r\n\tdeviceID =\r\n\t\tlocalStorage.getItem('deviceID') ||\r\n\t\t(typeof crypto?.randomUUID === 'function'\r\n\t\t\t? crypto.randomUUID()\r\n\t\t\t: this.UUID());\r\n\r\n\tconstructor() {\r\n\t\tlocalStorage.setItem('deviceID', this.deviceID);\r\n\r\n\t\tthis.detectDevice();\r\n\t}\r\n\r\n\t/**\r\n\t * Generates a UUID (Universally Unique Identifier) version 4.\r\n\t *\r\n\t * This implementation uses `Math.random()` to generate random values,\r\n\t * making it suitable for general-purpose identifiers, but **not** for\r\n\t * cryptographic or security-sensitive use cases.\r\n\t *\r\n\t * The format follows the UUID v4 standard: `xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`\r\n\t * where:\r\n\t * - `x` is a random hexadecimal digit (0–f)\r\n\t * - `4` indicates UUID version 4\r\n\t * - `y` is one of 8, 9, A, or B\r\n\t *\r\n\t * Example: `f47ac10b-58cc-4372-a567-0e02b2c3d479`\r\n\t *\r\n\t * @returns A string containing a UUID v4.\r\n\t */\r\n\tUUID(): string {\r\n\t\treturn 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(\r\n\t\t\t/[xy]/g,\r\n\t\t\t(c: string) => {\r\n\t\t\t\tconst r = (Math.random() * 16) | 0;\r\n\t\t\t\tconst v = c === 'x' ? r : (r & 0x3) | 0x8;\r\n\t\t\t\treturn v.toString(16);\r\n\t\t\t},\r\n\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * Converts an object to an array. Optionally holds keys instead of values.\r\n\t *\r\n\t * @param {any} obj - The object to be converted.\r\n\t * @param {boolean} [holder=false] - If true, the keys will be held in the array; otherwise, the values will be held.\r\n\t * @returns {any[]} The resulting array.\r\n\t */\r\n\tota(obj: any, holder: boolean = false): any[] {\r\n\t\tif (Array.isArray(obj)) return obj;\r\n\t\tif (typeof obj !== 'object' || obj === null) return [];\r\n\t\tconst arr = [];\r\n\t\tfor (const each in obj) {\r\n\t\t\tif (\r\n\t\t\t\tobj.hasOwnProperty(each) &&\r\n\t\t\t\t(obj[each] ||\r\n\t\t\t\t\ttypeof obj[each] === 'number' ||\r\n\t\t\t\t\ttypeof obj[each] === 'boolean')\r\n\t\t\t) {\r\n\t\t\t\tif (holder) {\r\n\t\t\t\t\tarr.push(each);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tarr.push(obj[each]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn arr;\r\n\t}\r\n\r\n\t/**\r\n\t * Removes elements from `fromArray` that are present in `removeArray` based on a comparison field.\r\n\t *\r\n\t * @param {any[]} removeArray - The array of elements to remove.\r\n\t * @param {any[]} fromArray - The array from which to remove elements.\r\n\t * @param {string} [compareField='_id'] - The field to use for comparison.\r\n\t * @returns {any[]} The modified `fromArray` with elements removed.\r\n\t */\r\n\tsplice(\r\n\t\tremoveArray: any[],\r\n\t\tfromArray: any[],\r\n\t\tcompareField: string = '_id',\r\n\t): any[] {\r\n\t\tif (!Array.isArray(removeArray) || !Array.isArray(fromArray)) {\r\n\t\t\treturn fromArray;\r\n\t\t}\r\n\r\n\t\tconst removeSet = new Set(\r\n\t\t\tremoveArray.map((item) => item[compareField]),\r\n\t\t);\r\n\t\treturn fromArray.filter((item) => !removeSet.has(item[compareField]));\r\n\t}\r\n\r\n\t/**\r\n\t * Unites multiple _id values into a single unique _id.\r\n\t * The resulting _id is unique regardless of the order of the input _id values.\r\n\t *\r\n\t * @param {...string[]} args - The _id values to be united.\r\n\t * @returns {string} The unique combined _id.\r\n\t */\r\n\tids2id(...args: string[]): string {\r\n\t\targs.sort((a, b) => {\r\n\t\t\tif (\r\n\t\t\t\tNumber(a.toString().substring(0, 8)) >\r\n\t\t\t\tNumber(b.toString().substring(0, 8))\r\n\t\t\t) {\r\n\t\t\t\treturn 1;\r\n\t\t\t}\r\n\t\t\treturn -1;\r\n\t\t});\r\n\r\n\t\treturn args.join();\r\n\t}\r\n\r\n\t// After While\r\n\tprivate _afterWhile: Record<string, number> = {};\r\n\t/**\r\n\t * Delays the execution of a callback function for a specified amount of time.\r\n\t * If called again within that time, the timer resets.\r\n\t *\r\n\t * @param {string | object | (() => void)} doc - A unique identifier for the timer, an object to host the timer, or the callback function.\r\n\t * @param {() => void} [cb] - The callback function to execute after the delay.\r\n\t * @param {number} [time=1000] - The delay time in milliseconds.\r\n\t */\r\n\tafterWhile(\r\n\t\tdoc: string | object | (() => void),\r\n\t\tcb?: () => void,\r\n\t\ttime: number = 1000,\r\n\t): void {\r\n\t\tif (typeof doc === 'function') {\r\n\t\t\tcb = doc as () => void;\r\n\t\t\tdoc = 'common';\r\n\t\t}\r\n\r\n\t\tif (typeof cb === 'function' && typeof time === 'number') {\r\n\t\t\tif (typeof doc === 'string') {\r\n\t\t\t\tclearTimeout(this._afterWhile[doc]);\r\n\t\t\t\tthis._afterWhile[doc] = window.setTimeout(cb, time);\r\n\t\t\t} else if (typeof doc === 'object') {\r\n\t\t\t\tclearTimeout((doc as { __afterWhile: number }).__afterWhile);\r\n\t\t\t\t(doc as { __afterWhile: number }).__afterWhile =\r\n\t\t\t\t\twindow.setTimeout(cb, time);\r\n\t\t\t} else {\r\n\t\t\t\tconsole.warn('badly configured after while');\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Recursively copies properties from one object to another.\r\n\t * Handles nested objects, arrays, and Date instances appropriately.\r\n\t *\r\n\t * @param from - The source object from which properties are copied.\r\n\t * @param to - The target object to which properties are copied.\r\n\t */\r\n\tcopy(from: any, to: any) {\r\n\t\tfor (const each in from) {\r\n\t\t\tif (\r\n\t\t\t\ttypeof from[each] !== 'object' ||\r\n\t\t\t\tfrom[each] instanceof Date ||\r\n\t\t\t\tArray.isArray(from[each]) ||\r\n\t\t\t\tfrom[each] === null\r\n\t\t\t) {\r\n\t\t\t\tto[each] = from[each];\r\n\t\t\t} else {\r\n\t\t\t\tif (\r\n\t\t\t\t\ttypeof to[each] !== 'object' ||\r\n\t\t\t\t\tto[each] instanceof Date ||\r\n\t\t\t\t\tArray.isArray(to[each]) ||\r\n\t\t\t\t\tto[each] === null\r\n\t\t\t\t) {\r\n\t\t\t\t\tto[each] = {};\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.copy(from[each], to[each]);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Device management\r\n\tdevice = '';\r\n\t/**\r\n\t * Detects the device type based on the user agent.\r\n\t */\r\n\tdetectDevice(): void {\r\n\t\tconst userAgent =\r\n\t\t\tnavigator.userAgent || navigator.vendor || (window as any).opera;\r\n\t\tif (/windows phone/i.test(userAgent)) {\r\n\t\t\tthis.device = 'Windows Phone';\r\n\t\t} else if (/android/i.test(userAgent)) {\r\n\t\t\tthis.device = 'Android';\r\n\t\t} else if (\r\n\t\t\t/iPad|iPhone|iPod/.test(userAgent) &&\r\n\t\t\t!(window as any).MSStream\r\n\t\t) {\r\n\t\t\tthis.device = 'iOS';\r\n\t\t} else {\r\n\t\t\tthis.device = 'Web';\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Checks if the device is a mobile device.\r\n\t * @returns {boolean} - Returns true if the device is a mobile device.\r\n\t */\r\n\tisMobile(): boolean {\r\n\t\treturn (\r\n\t\t\tthis.device === 'Windows Phone' ||\r\n\t\t\tthis.device === 'Android' ||\r\n\t\t\tthis.device === 'iOS'\r\n\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * Checks if the device is a tablet.\r\n\t * @returns {boolean} - Returns true if the device is a tablet.\r\n\t */\r\n\tisTablet(): boolean {\r\n\t\treturn this.device === 'iOS' && /iPad/.test(navigator.userAgent);\r\n\t}\r\n\r\n\t/**\r\n\t * Checks if the device is a web browser.\r\n\t * @returns {boolean} - Returns true if the device is a web browser.\r\n\t */\r\n\tisWeb(): boolean {\r\n\t\treturn this.device === 'Web';\r\n\t}\r\n\r\n\t/**\r\n\t * Checks if the device is an Android device.\r\n\t * @returns {boolean} - Returns true if the device is an Android device.\r\n\t */\r\n\tisAndroid(): boolean {\r\n\t\treturn this.device === 'Android';\r\n\t}\r\n\r\n\t/**\r\n\t * Checks if the device is an iOS device.\r\n\t * @returns {boolean} - Returns true if the device is an iOS device.\r\n\t */\r\n\tisIos(): boolean {\r\n\t\treturn this.device === 'iOS';\r\n\t}\r\n\r\n\t// Version management\r\n\tversion = '1.0.0';\r\n\r\n\tappVersion = '';\r\n\r\n\tdateVersion = '';\r\n\r\n\t/**\r\n\t * Sets the combined version string based on appVersion and dateVersion.\r\n\t */\r\n\tsetVersion(): void {\r\n\t\tthis.version = this.appVersion || '';\r\n\r\n\t\tthis.version += this.version && this.dateVersion ? ' ' : '';\r\n\r\n\t\tthis.version += this.dateVersion || '';\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the app version and updates the combined version string.\r\n\t *\r\n\t * @param {string} appVersion - The application version to set.\r\n\t */\r\n\tsetAppVersion(appVersion: string): void {\r\n\t\tthis.appVersion = appVersion;\r\n\r\n\t\tthis.setVersion();\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the date version and updates the combined version string.\r\n\t *\r\n\t * @param {string} dateVersion - The date version to set.\r\n\t */\r\n\tsetDateVersion(dateVersion: string): void {\r\n\t\tthis.dateVersion = dateVersion;\r\n\r\n\t\tthis.setVersion();\r\n\t}\r\n\r\n\t// Locking management\r\n\tprivate _locked: Record<string, boolean> = {};\r\n\tprivate _unlockResolvers: Record<string, (() => void)[]> = {};\r\n\r\n\t/**\r\n\t * Locks a resource to prevent concurrent access.\r\n\t * @param which - The resource to lock, identified by a string.\r\n\t */\r\n\tlock(which: string): void {\r\n\t\tthis._locked[which] = true;\r\n\r\n\t\tif (!this._unlockResolvers[which]) {\r\n\t\t\tthis._unlockResolvers[which] = [];\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Unlocks a resource, allowing access.\r\n\t * @param which - The resource to unlock, identified by a string.\r\n\t */\r\n\tunlock(which: string): void {\r\n\t\tthis._locked[which] = false;\r\n\r\n\t\tif (this._unlockResolvers[which]) {\r\n\t\t\tthis._unlockResolvers[which].forEach((resolve) => resolve());\r\n\r\n\t\t\tthis._unlockResolvers[which] = [];\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a Promise that resolves when the specified resource is unlocked.\r\n\t * @param which - The resource to watch for unlocking, identified by a string.\r\n\t * @returns A Promise that resolves when the resource is unlocked.\r\n\t */\r\n\tonUnlock(which: string): Promise<void> {\r\n\t\tif (!this._locked[which]) {\r\n\t\t\treturn Promise.resolve();\r\n\t\t}\r\n\r\n\t\treturn new Promise((resolve) => {\r\n\t\t\tif (!this._unlockResolvers[which]) {\r\n\t\t\t\tthis._unlockResolvers[which] = [];\r\n\t\t\t}\r\n\r\n\t\t\tthis._unlockResolvers[which].push(resolve);\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Checks if a resource is locked.\r\n\t * @param which - The resource to check, identified by a string.\r\n\t * @returns True if the resource is locked, false otherwise.\r\n\t */\r\n\tlocked(which: string): boolean {\r\n\t\treturn !!this._locked[which];\r\n\t}\r\n\r\n\t// Angular Signals //\r\n\t/**\r\n\t * Converts a plain object into a signal-wrapped object.\r\n\t * Optionally wraps specific fields of the object as individual signals,\r\n\t * and merges them into the returned signal for fine-grained reactivity.\r\n\t *\r\n\t * @template Document - The type of the object being wrapped.\r\n\t * @param {Document} document - The plain object to wrap into a signal.\r\n\t * @param {Record<string, (doc: Document) => unknown>} [signalFields={}] -\r\n\t *        Optional map where each key is a field name and the value is a function\r\n\t *        to extract the initial value for that field. These fields will be wrapped\r\n\t *        as separate signals and embedded in the returned object.\r\n\t *\r\n\t * @returns {WritableSignal<Document>} A signal-wrapped object, possibly containing\r\n\t *          nested field signals for more granular control.\r\n\t *\r\n\t * @example\r\n\t * const user = { _id: '1', name: 'Alice', score: 42 };\r\n\t * const sig = toSignal(user, { score: (u) => u.score });\r\n\t * console.log(sig().name); // 'Alice'\r\n\t * console.log(sig().score()); // 42 — field is now a signal\r\n\t */\r\n\ttoSignal<Document>(\r\n\t\tdocument: Document,\r\n\t\tsignalFields: Record<string, (doc: Document) => unknown> = {},\r\n\t): WritableSignal<Document> {\r\n\t\tif (Object.keys(signalFields).length) {\r\n\t\t\tconst fields: Record<string, Signal<unknown>> = {};\r\n\r\n\t\t\tfor (const key in signalFields) {\r\n\t\t\t\tfields[key] = signal(signalFields[key](document));\r\n\t\t\t}\r\n\r\n\t\t\treturn signal({ ...document, ...fields });\r\n\t\t} else {\r\n\t\t\treturn signal(document);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Converts an array of objects into an array of Angular signals.\r\n\t * Optionally wraps specific fields of each object as individual signals.\r\n\t *\r\n\t * @template Document - The type of each object in the array.\r\n\t * @param {Document[]} arr - Array of plain objects to convert into signals.\r\n\t * @param {Record<string, (doc: Document) => unknown>} [signalFields={}] -\r\n\t *        Optional map where keys are field names and values are functions that extract the initial value\r\n\t *        from the object. These fields will be turned into separate signals.\r\n\t *\r\n\t * @returns {WritableSignal<Document>[]} An array where each item is a signal-wrapped object,\r\n\t *          optionally with individual fields also wrapped in signals.\r\n\t *\r\n\t * @example\r\n\t * toSignalsArray(users, {\r\n\t *   name: (u) => u.name,\r\n\t *   score: (u) => u.score,\r\n\t * });\r\n\t */\r\n\ttoSignalsArray<Document>(\r\n\t\tarr: Document[],\r\n\t\tsignalFields: Record<string, (doc: Document) => unknown> = {},\r\n\t): WritableSignal<Document>[] {\r\n\t\treturn arr.map((obj) => this.toSignal(obj, signalFields));\r\n\t}\r\n\r\n\t/**\r\n\t * Adds a new object to the signals array.\r\n\t * Optionally wraps specific fields of the object as individual signals before wrapping the whole object.\r\n\t *\r\n\t * @template Document - The type of the object being added.\r\n\t * @param {WritableSignal<Document>[]} signals - The signals array to append to.\r\n\t * @param {Document} item - The object to wrap and push as a signal.\r\n\t * @param {Record<string, (doc: Document) => unknown>} [signalFields={}] -\r\n\t *        Optional map of fields to be wrapped as signals within the object.\r\n\t *\r\n\t * @returns {void}\r\n\t */\r\n\tpushSignal<Document>(\r\n\t\tsignals: WritableSignal<Document>[],\r\n\t\titem: Document,\r\n\t\tsignalFields: Record<string, (doc: Document) => unknown> = {},\r\n\t): void {\r\n\t\tsignals.push(this.toSignal(item, signalFields));\r\n\t}\r\n\r\n\t/**\r\n\t * Removes the first signal from the array whose object's field matches the provided value.\r\n\t * @template Document\r\n\t * @param {WritableSignal<Document>[]} signals - The signals array to modify.\r\n\t * @param {unknown} value - The value to match.\r\n\t * @param {string} [field='_id'] - The object field to match against.\r\n\t * @returns {void}\r\n\t */\r\n\tremoveSignalByField<Document extends Record<string, unknown>>(\r\n\t\tsignals: WritableSignal<Document>[],\r\n\t\tvalue: unknown,\r\n\t\tfield: string = '_id',\r\n\t): void {\r\n\t\tconst idx = signals.findIndex((sig) => sig()[field] === value);\r\n\r\n\t\tif (idx > -1) signals.splice(idx, 1);\r\n\t}\r\n\r\n\t/**\r\n\t * Returns a generic trackBy function for *ngFor, tracking by the specified object field.\r\n\t * @template Document\r\n\t * @param {string} field - The object field to use for tracking (e.g., '_id').\r\n\t * @returns {(index: number, sig: Signal<Document>) => unknown} TrackBy function for Angular.\r\n\t */\r\n\ttrackBySignalField<Document extends Record<string, unknown>>(\r\n\t\tfield: string,\r\n\t) {\r\n\t\treturn (_: number, sig: Signal<Document>) => sig()[field];\r\n\t}\r\n\r\n\t/**\r\n\t * Finds the first signal in the array whose object's field matches the provided value.\r\n\t * @template Document\r\n\t * @param {Signal<Document>[]} signals - Array of signals to search.\r\n\t * @param {unknown} value - The value to match.\r\n\t * @param {string} [field='_id'] - The object field to match against.\r\n\t * @returns {Signal<Document> | undefined} The found signal or undefined if not found.\r\n\t */\r\n\tfindSignalByField<Document extends Record<string, unknown>>(\r\n\t\tsignals: WritableSignal<Document>[],\r\n\t\tvalue: unknown,\r\n\t\tfield = '_id',\r\n\t): WritableSignal<Document> | undefined {\r\n\t\treturn signals.find(\r\n\t\t\t(sig) => sig()[field] === value,\r\n\t\t) as WritableSignal<Document>;\r\n\t}\r\n\r\n\t/**\r\n\t * Updates the first writable signal in the array whose object's field matches the provided value.\r\n\t * @template Document\r\n\t * @param {WritableSignal<Document>[]} signals - Array of writable signals to search.\r\n\t * @param {unknown} value - The value to match.\r\n\t * @param {(val: Document) => Document} updater - Function to produce the updated object.\r\n\t * @param {string} field - The object field to match against.\r\n\t * @returns {void}\r\n\t */\r\n\tupdateSignalByField<Document extends Record<string, unknown>>(\r\n\t\tsignals: WritableSignal<Document>[],\r\n\t\tvalue: unknown,\r\n\t\tupdater: (val: Document) => Document,\r\n\t\tfield: string,\r\n\t): void {\r\n\t\tconst sig = this.findSignalByField<Document>(\r\n\t\t\tsignals,\r\n\t\t\tvalue,\r\n\t\t\tfield,\r\n\t\t) as WritableSignal<Document>;\r\n\r\n\t\tif (sig) sig.update(updater);\r\n\t}\r\n}\r\n","import {\r\n\tChangeDetectorRef,\r\n\tinject,\r\n\tSignal,\r\n\tsignal,\r\n\tWritableSignal,\r\n} from '@angular/core';\r\nimport { firstValueFrom } from 'rxjs';\r\nimport {\r\n\tCrudDocument,\r\n\tCrudOptions,\r\n\tCrudServiceInterface,\r\n\tTableConfig,\r\n} from '../interfaces/crud.interface';\r\nimport { AlertService } from '../services/alert.service';\r\nimport { CoreService } from '../services/core.service';\r\n\r\n/**\r\n * Interface representing the shape of a form service used by the CrudComponent.\r\n * The consuming app must provide a service that implements this structure.\r\n */\r\ninterface FormServiceInterface<FormInterface> {\r\n\tprepareForm: (form: FormInterface) => any;\r\n\tmodal: <T>(form: any, options?: any, doc?: T) => Promise<T>;\r\n\tmodalDocs: <T>(docs: T[]) => Promise<T[]>;\r\n\tmodalUnique: <T>(collection: string, key: string, doc: T) => void;\r\n\talert?: {\r\n\t\tquestion: (config: {\r\n\t\t\ttext: string;\r\n\t\t\tbuttons: { text: string; callback?: () => void }[];\r\n\t\t}) => void;\r\n\t};\r\n}\r\n\r\n/**\r\n * Abstract reusable base class for CRUD list views.\r\n * It encapsulates pagination, modals, and document handling logic.\r\n *\r\n * @template Service - A service implementing CrudServiceInterface for a specific document type\r\n * @template Document - The data model extending CrudDocument\r\n */\r\nexport abstract class CrudComponent<\r\n\tService extends CrudServiceInterface<Document>,\r\n\tDocument extends CrudDocument<Document>,\r\n\tFormInterface,\r\n> {\r\n\t/** Service responsible for data fetching, creating, updating, deleting */\r\n\tprotected crudService: Service;\r\n\r\n\t/** The array of documents currently loaded and shown */\r\n\tprotected documents = signal<Signal<Document>[]>([]);\r\n\r\n\t/** The reactive form instance generated from the provided config */\r\n\tprotected form: any;\r\n\r\n\t/** Current pagination page */\r\n\tprotected page = 1;\r\n\r\n\t/** CoreService handles timing and copying helpers */\r\n\tprivate __core = inject(CoreService);\r\n\r\n\t/** AlertService handles alerts */\r\n\tprivate __alert = inject(AlertService);\r\n\r\n\t/** ChangeDetectorRef handles on push strategy */\r\n\tprivate __cdr = inject(ChangeDetectorRef);\r\n\r\n\t/** Internal reference to form service matching FormServiceInterface */\r\n\tprivate __form: FormServiceInterface<FormInterface>;\r\n\r\n\t/**\r\n\t * Constructor\r\n\t *\r\n\t * @param formConfig - Object describing form title and its component structure\r\n\t * @param formService - Any service that conforms to FormServiceInterface (usually casted)\r\n\t * @param translateService - An object providing a translate() method for i18n\r\n\t * @param crudService - CRUD service implementing get/create/update/delete\r\n\t */\r\n\tconstructor(\r\n\t\tformConfig: unknown,\r\n\t\tprotected formService: unknown,\r\n\t\tprotected translateService: {\r\n\t\t\ttranslate: (key: string) => WritableSignal<string>;\r\n\t\t},\r\n\t\tcrudService: Service,\r\n\t\tmodule = '',\r\n\t) {\r\n\t\tconst form = formConfig as FormInterface;\r\n\r\n\t\tthis.__form = formService as FormServiceInterface<FormInterface>;\r\n\r\n\t\tthis.form = this.__form.prepareForm(form);\r\n\r\n\t\tthis.crudService = crudService;\r\n\r\n\t\tthis._module = module;\r\n\t}\r\n\r\n\t/**\r\n\t * Loads documents for a given page.\r\n\t */\r\n\tprotected setDocuments(page = this.page, query = ''): Promise<void> {\r\n\t\treturn new Promise((resolve) => {\r\n\t\t\tif (this.configType === 'server') {\r\n\t\t\t\tthis.page = page;\r\n\r\n\t\t\t\tthis.__core.afterWhile(\r\n\t\t\t\t\tthis,\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tthis.crudService\r\n\t\t\t\t\t\t\t.get({ page, query }, this.getOptions())\r\n\t\t\t\t\t\t\t.subscribe((docs: Document[]) => {\r\n\t\t\t\t\t\t\t\tthis.documents.update(() =>\r\n\t\t\t\t\t\t\t\t\tthis.__core.toSignalsArray(docs),\r\n\t\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t\t\tresolve();\r\n\r\n\t\t\t\t\t\t\t\tthis.__cdr.markForCheck();\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t},\r\n\t\t\t\t\t250,\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\tthis.documents.update(() =>\r\n\t\t\t\t\tthis.__core.toSignalsArray(this.crudService.getDocs()),\r\n\t\t\t\t);\r\n\r\n\t\t\t\tthis.crudService.loaded.subscribe(() => {\r\n\t\t\t\t\tresolve();\r\n\r\n\t\t\t\t\tthis.__cdr.markForCheck();\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\t/** Fields considered when performing bulk updates. */\r\n\tprotected updatableFields = ['_id', 'name', 'description', 'data'];\r\n\r\n\t/**\r\n\t * Clears temporary metadata before document creation.\r\n\t */\r\n\tprotected preCreate(doc: Document): void {\r\n\t\tdelete doc.__creating;\r\n\t}\r\n\r\n\t/**\r\n\t * Funciton which controls whether the create functionality is available.\r\n\t */\r\n\tprotected allowCreate(): boolean {\r\n\t\treturn true;\r\n\t}\r\n\r\n\t/**\r\n\t * Funciton which controls whether the update and delete functionality is available.\r\n\t */\r\n\tprotected allowMutate(): boolean {\r\n\t\treturn true;\r\n\t}\r\n\r\n\t/**\r\n\t * Funciton which controls whether the unique url functionality is available.\r\n\t */\r\n\tprotected allowUrl(): boolean {\r\n\t\treturn true;\r\n\t}\r\n\r\n\t/** Determines whether manual sorting controls are available. */\r\n\tprotected allowSort(): boolean {\r\n\t\treturn false;\r\n\t}\r\n\r\n\t/**\r\n\t * Funciton which prepare get crud options.\r\n\t */\r\n\tprotected getOptions(): CrudOptions<Document> {\r\n\t\treturn {} as CrudOptions<Document>;\r\n\t}\r\n\r\n\t/**\r\n\t * Handles bulk creation and updating of documents.\r\n\t * In creation mode, adds new documents.\r\n\t * In update mode, syncs changes and deletes removed entries.\r\n\t */\r\n\tprotected bulkManagement(create = true): () => void {\r\n\t\treturn (): void => {\r\n\t\t\tthis.__form\r\n\t\t\t\t.modalDocs<Document>(\r\n\t\t\t\t\tcreate\r\n\t\t\t\t\t\t? []\r\n\t\t\t\t\t\t: this.documents().map(\r\n\t\t\t\t\t\t\t\t(obj: any) =>\r\n\t\t\t\t\t\t\t\t\tObject.fromEntries(\r\n\t\t\t\t\t\t\t\t\t\tthis.updatableFields.map((key) => [\r\n\t\t\t\t\t\t\t\t\t\t\tkey,\r\n\t\t\t\t\t\t\t\t\t\t\tobj()[key],\r\n\t\t\t\t\t\t\t\t\t\t]),\r\n\t\t\t\t\t\t\t\t\t) as Document,\r\n\t\t\t\t\t\t\t),\r\n\t\t\t\t)\r\n\t\t\t\t.then(async (docs: Document[]) => {\r\n\t\t\t\t\tif (create) {\r\n\t\t\t\t\t\tfor (const doc of docs) {\r\n\t\t\t\t\t\t\tthis.preCreate(doc);\r\n\r\n\t\t\t\t\t\t\tawait firstValueFrom(this.crudService.create(doc));\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tfor (const document of this.documents()) {\r\n\t\t\t\t\t\t\tif (!docs.find((d) => d._id === document()._id)) {\r\n\t\t\t\t\t\t\t\tawait firstValueFrom(\r\n\t\t\t\t\t\t\t\t\tthis.crudService.delete(document()),\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tfor (const doc of docs) {\r\n\t\t\t\t\t\t\tconst local = this.documents().find(\r\n\t\t\t\t\t\t\t\t(document) => document()._id === doc._id,\r\n\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t\tif (local) {\r\n\t\t\t\t\t\t\t\t(local as WritableSignal<Document>).update(\r\n\t\t\t\t\t\t\t\t\t(document) => {\r\n\t\t\t\t\t\t\t\t\t\tthis.__core.copy(doc, document);\r\n\r\n\t\t\t\t\t\t\t\t\t\treturn document;\r\n\t\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t\t\tawait firstValueFrom(\r\n\t\t\t\t\t\t\t\t\tthis.crudService.update(local()),\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tthis.preCreate(doc);\r\n\r\n\t\t\t\t\t\t\t\tawait firstValueFrom(\r\n\t\t\t\t\t\t\t\t\tthis.crudService.create(doc),\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.setDocuments();\r\n\t\t\t\t});\r\n\t\t};\r\n\t}\r\n\r\n\t/** Opens a modal to create a new document. */\r\n\tprotected create() {\r\n\t\tthis.__form.modal<Document>(this.form, {\r\n\t\t\tlabel: 'Create',\r\n\t\t\tclick: async (created: unknown, close: () => void) => {\r\n\t\t\t\tclose();\r\n\t\t\t\tthis.preCreate(created as Document);\r\n\r\n\t\t\t\tawait firstValueFrom(\r\n\t\t\t\t\tthis.crudService.create(created as Document),\r\n\t\t\t\t);\r\n\r\n\t\t\t\tthis.setDocuments();\r\n\t\t\t},\r\n\t\t});\r\n\t}\r\n\r\n\t/** Displays a modal to edit an existing document. */\r\n\tprotected update(doc: Document) {\r\n\t\tthis.__form\r\n\t\t\t.modal<Document>(this.form, [], doc)\r\n\t\t\t.then((updated: Document) => {\r\n\t\t\t\tthis.__core.copy(updated, doc);\r\n\r\n\t\t\t\tthis.crudService.update(doc);\r\n\r\n\t\t\t\tthis.__cdr.markForCheck();\r\n\t\t\t});\r\n\t}\r\n\r\n\t/** Requests confirmation before deleting the provided document. */\r\n\tprotected delete(doc: Document) {\r\n\t\tthis.__alert.question({\r\n\t\t\ttext: `Are you sure you want to delete this${this._module ? ' ' + this._module : ''}?`,\r\n\t\t\tbuttons: [\r\n\t\t\t\t{ text: 'No' },\r\n\t\t\t\t{\r\n\t\t\t\t\ttext: 'Yes',\r\n\t\t\t\t\tcallback: async (): Promise<void> => {\r\n\t\t\t\t\t\tawait firstValueFrom(this.crudService.delete(doc));\r\n\r\n\t\t\t\t\t\tthis.setDocuments();\r\n\t\t\t\t\t},\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\t}\r\n\r\n\t/** Opens a modal to edit the document's unique URL. */\r\n\tprotected mutateUrl(doc: Document) {\r\n\t\tthis.__form.modalUnique<Document>(this._module, 'url', doc);\r\n\t}\r\n\r\n\t/** Moves the given document one position up and updates ordering. */\r\n\tprotected moveUp(doc: Document) {\r\n\t\tconst index = this.documents().findIndex(\r\n\t\t\t(document) => document()._id === doc._id,\r\n\t\t);\r\n\r\n\t\tif (index) {\r\n\t\t\tthis.documents.update((documents) => {\r\n\t\t\t\tdocuments.splice(index, 1);\r\n\r\n\t\t\t\tdocuments.splice(index - 1, 0, this.__core.toSignal(doc));\r\n\r\n\t\t\t\treturn documents;\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tfor (let i = 0; i < this.documents().length; i++) {\r\n\t\t\tif (this.documents()[i]().order !== i) {\r\n\t\t\t\tthis.documents()[i]().order = i;\r\n\r\n\t\t\t\tthis.crudService.update(this.documents()[i]());\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis.__cdr.markForCheck();\r\n\t}\r\n\r\n\t/** Data source mode used for document retrieval. */\r\n\tprotected configType: 'server' | 'local' = 'server';\r\n\r\n\t/** Number of documents fetched per page when paginating. */\r\n\tprotected perPage = 20;\r\n\r\n\t/**\r\n\t * Configuration object used by the UI for rendering table and handling actions.\r\n\t */\r\n\tprotected getConfig(): TableConfig<Document> {\r\n\t\tconst config: TableConfig<Document> = {\r\n\t\t\tcreate: this.allowCreate()\r\n\t\t\t\t? (): void => {\r\n\t\t\t\t\t\tthis.create();\r\n\t\t\t\t\t}\r\n\t\t\t\t: null,\r\n\r\n\t\t\tupdate: this.allowMutate()\r\n\t\t\t\t? (doc: Document): void => {\r\n\t\t\t\t\t\tthis.update(doc);\r\n\t\t\t\t\t}\r\n\t\t\t\t: null,\r\n\r\n\t\t\tdelete: this.allowMutate()\r\n\t\t\t\t? (doc: Document): void => {\r\n\t\t\t\t\t\tthis.delete(doc);\r\n\t\t\t\t\t}\r\n\t\t\t\t: null,\r\n\r\n\t\t\tbuttons: [],\r\n\t\t\theaderButtons: [],\r\n\t\t\tallDocs: true,\r\n\t\t};\r\n\r\n\t\tif (this.allowUrl()) {\r\n\t\t\tconfig.buttons.push({\r\n\t\t\t\ticon: 'cloud_download',\r\n\t\t\t\tclick: (doc: Document) => {\r\n\t\t\t\t\tthis.mutateUrl(doc);\r\n\t\t\t\t},\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (this.allowSort()) {\r\n\t\t\tconfig.buttons.push({\r\n\t\t\t\ticon: 'arrow_upward',\r\n\t\t\t\tclick: (doc: Document) => {\r\n\t\t\t\t\tthis.moveUp(doc);\r\n\t\t\t\t},\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (this.allowCreate()) {\r\n\t\t\tconfig.headerButtons.push({\r\n\t\t\t\ticon: 'playlist_add',\r\n\t\t\t\tclick: this.bulkManagement(),\r\n\t\t\t\tclass: 'playlist',\r\n\t\t\t});\r\n\t\t}\r\n\t\tif (this.allowMutate()) {\r\n\t\t\tconfig.headerButtons.push({\r\n\t\t\t\ticon: 'edit_note',\r\n\t\t\t\tclick: this.bulkManagement(false),\r\n\t\t\t\tclass: 'edit',\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn this.configType === 'server'\r\n\t\t\t? {\r\n\t\t\t\t\t...config,\r\n\t\t\t\t\tpaginate: this.setDocuments.bind(this),\r\n\t\t\t\t\tperPage: this.perPage,\r\n\t\t\t\t\tsetPerPage: this.crudService.setPerPage?.bind(\r\n\t\t\t\t\t\tthis.crudService,\r\n\t\t\t\t\t),\r\n\t\t\t\t\tallDocs: false,\r\n\t\t\t\t}\r\n\t\t\t: config;\r\n\t}\r\n\r\n\t/** Name of the collection or module used for contextual actions. */\r\n\tprivate _module = '';\r\n}\r\n","import { CommonModule } from '@angular/common';\r\nimport { Component, OnInit, Signal } from '@angular/core';\r\n\r\n@Component({\r\n\ttemplateUrl: './loader.component.html',\r\n\tstyleUrls: ['./loader.component.scss'],\r\n\timports: [CommonModule],\r\n})\r\nexport class LoaderComponent implements OnInit {\r\n\tclose!: () => void;\r\n\r\n\ttext!: string;\r\n\r\n\tclass!: string;\r\n\r\n\tprogress!: boolean;\r\n\r\n\tprogressPercentage?: Signal<number>;\r\n\r\n\ttimeout!: number;\r\n\r\n\tclosable!: boolean;\r\n\r\n\tngOnInit(): void {\r\n\t\tif (this.timeout) {\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis.close();\r\n\t\t\t}, this.timeout);\r\n\t\t}\r\n\t}\r\n}\r\n","<div class=\"wacom-loader\" [ngClass]=\"class\">\r\n\t@if (progressPercentage) {\r\n\t\t<div class=\"wacom-loader__progress\">\r\n\t\t\t<span\r\n\t\t\t\tclass=\"wacom-loader__progress-bar\"\r\n\t\t\t\t[style.width.%]=\"progressPercentage()\"\r\n\t\t\t\tstyle=\"animation: none\"\r\n\t\t\t></span>\r\n\t\t</div>\r\n\t} @else if (progress) {\r\n\t\t<div class=\"wacom-loader__progress\">\r\n\t\t\t<span\r\n\t\t\t\tclass=\"wacom-loader__progress-bar\"\r\n\t\t\t\t[ngStyle]=\"{\r\n\t\t\t\t\t'animation-duration': (timeout + 350) / 1000 + 's',\r\n\t\t\t\t}\"\r\n\t\t\t></span>\r\n\t\t</div>\r\n\t}\r\n\t@if (closable) {\r\n\t\t<span class=\"wacom-loader__close\" (click)=\"close()\">&times;</span>\r\n\t}\r\n\t@if (text) {\r\n\t\t<span class=\"wacom-loader__text\">\r\n\t\t\t{{ text }}\r\n\t\t</span>\r\n\t}\r\n</div>\r\n","import { CommonModule } from '@angular/common';\r\nimport { Component, OnInit } from '@angular/core';\r\n\r\n@Component({\r\n\tselector: 'lib-modal',\r\n\ttemplateUrl: './modal.component.html',\r\n\tstyleUrls: ['./modal.component.scss'],\r\n\tstandalone: true,\r\n\timports: [CommonModule],\r\n})\r\nexport class ModalComponent implements OnInit {\r\n\tclosable: boolean = true;\r\n\tclose: any;\r\n\tonOpen: any;\r\n\ttimestart: any;\r\n\ttimeout: any;\r\n\tallowClose = true;\r\n\tonClickOutside: any;\r\n\tngOnInit() {\r\n\t\tif (typeof this.onClickOutside !== 'function') {\r\n\t\t\tthis.onClickOutside = this.close;\r\n\t\t\t// this.onClickOutside = () => {\r\n\t\t\t// \tif (this.allowClose) {\r\n\t\t\t// \t\tthis.close();\r\n\t\t\t// \t}\r\n\r\n\t\t\t// \tthis.allowClose = true;\r\n\t\t\t// };\r\n\t\t}\r\n\r\n\t\tif (typeof this.onOpen == 'function') this.onOpen();\r\n\r\n\t\twindow.addEventListener('popstate', this.popStateListener.bind(this));\r\n\t}\r\n\r\n\tngOnDestroy(): void {\r\n\t\twindow.removeEventListener(\r\n\t\t\t'popstate',\r\n\t\t\tthis.popStateListener.bind(this),\r\n\t\t);\r\n\t}\r\n\r\n\tpopStateListener(e: Event) {\r\n\t\tthis.close();\r\n\t}\r\n}\r\n","<div class=\"wacom-modal\" (click)=\"onClickOutside()\">\r\n\t<div class=\"wacom-modal__content\" (click)=\"$event.stopPropagation()\">\r\n\t\t<div><!-- Content Will Drop Here --></div>\r\n\t\t<span class=\"wacom-modal__close\" (click)=\"close()\" *ngIf=\"closable\"\r\n\t\t\t>&times;</span\r\n\t\t>\r\n\t</div>\r\n</div>\r\n","import {\r\n\tChangeDetectorRef,\r\n\tDestroyRef,\r\n\tDirective,\r\n\tElementRef,\r\n\tinject,\r\n\toutput,\r\n} from '@angular/core';\r\n\r\n/**\r\n * Stand-alone “click outside” directive (zoneless-safe).\r\n *\r\n * Usage:\r\n * <div (clickOutside)=\"close()\">…</div>\r\n */\r\n@Directive({\r\n\tselector: '[clickOutside]',\r\n})\r\nexport class ClickOutsideDirective {\r\n\treadonly clickOutside = output<MouseEvent>();\r\n\r\n\tconstructor() {\r\n\t\tdocument.addEventListener('pointerdown', this.handler, true);\r\n\r\n\t\t// cleanup\r\n\t\tthis._dref.onDestroy(() =>\r\n\t\t\tdocument.removeEventListener('pointerdown', this.handler, true),\r\n\t\t);\r\n\t}\r\n\r\n\tprivate _host = inject(ElementRef<HTMLElement>);\r\n\r\n\tprivate _cdr = inject(ChangeDetectorRef);\r\n\r\n\tprivate _dref = inject(DestroyRef);\r\n\r\n\tprivate handler = (e: MouseEvent): void => {\r\n\t\tif (!this._host.nativeElement.contains(e.target as Node)) {\r\n\t\t\tthis.clickOutside.emit(e); // notify parent\r\n\t\t\tthis._cdr.markForCheck(); // trigger CD for OnPush comps\r\n\t\t}\r\n\t};\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n\tname: 'arr',\r\n})\r\nexport class ArrPipe implements PipeTransform {\r\n\ttransform(data: any, type?: any, refresh?: any): any {\r\n\t\tif (!data) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\r\n\t\tif (typeof data == 'string') return data.split(type || ' ');\r\n\r\n\t\tif (Array.isArray(data)) {\r\n\t\t\treturn data;\r\n\t\t}\r\n\r\n\t\tif (typeof data != 'object') {\r\n\t\t\treturn [];\r\n\t\t}\r\n\r\n\t\tlet arr = [];\r\n\r\n\t\tfor (let each in data) {\r\n\t\t\tif (!data[each]) continue;\r\n\r\n\t\t\tif (type == 'prop') {\r\n\t\t\t\tarr.push(each);\r\n\t\t\t} else if (type == 'value') {\r\n\t\t\t\tarr.push(data[each]);\r\n\t\t\t} else {\r\n\t\t\t\tarr.push({\r\n\t\t\t\t\tprop: each,\r\n\t\t\t\t\tvalue: data[each],\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn arr;\r\n\t}\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n\tname: 'mongodate',\r\n})\r\nexport class MongodatePipe implements PipeTransform {\r\n\ttransform(_id: any) {\r\n\t\tif (!_id) return new Date();\r\n\r\n\t\tlet timestamp = _id.toString().substring(0, 8);\r\n\r\n\t\treturn new Date(parseInt(timestamp, 16) * 1000);\r\n\t}\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n\tname: 'number',\r\n})\r\nexport class NumberPipe implements PipeTransform {\r\n\ttransform(value: unknown): number {\r\n\t\tconst result = Number(value); // Convert value to a number\r\n\r\n\t\treturn isNaN(result) ? 0 : result; // Return 0 if conversion fails\r\n\t}\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n\tname: 'page',\r\n\tpure: false,\r\n})\r\nexport class PaginationPipe implements PipeTransform {\r\n\ttransform(arr: any, config: any, sort: any, search = ''): any {\r\n\t\tif (!Array.isArray(arr)) return [];\r\n\r\n\t\tarr = arr.slice();\r\n\r\n\t\tfor (let i = 0; i < arr.length; i++) {\r\n\t\t\tarr[i].num = i + 1;\r\n\t\t}\r\n\r\n\t\tif (sort.direction) {\r\n\t\t\tarr.sort((a: any, b: any) => {\r\n\t\t\t\tif (a[sort.title] < b[sort.title]) {\r\n\t\t\t\t\treturn sort.direction == 'desc' ? 1 : -1;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (a[sort.title] > b[sort.title]) {\r\n\t\t\t\t\treturn sort.direction == 'desc' ? -1 : 1;\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn 0;\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn arr.slice(\r\n\t\t\t(config.page - 1) * config.perPage,\r\n\t\t\tconfig.page * config.perPage,\r\n\t\t);\r\n\t}\r\n}\r\n","import { inject, Pipe } from '@angular/core';\r\nimport { DomSanitizer } from '@angular/platform-browser';\r\n@Pipe({\r\n\tname: 'safe',\r\n})\r\nexport class SafePipe {\r\n\ttransform(html: any) {\r\n\t\treturn this._sanitizer.bypassSecurityTrustResourceUrl(html);\r\n\t}\r\n\r\n\tprivate _sanitizer = inject(DomSanitizer);\r\n}\r\n","import { Pipe, PipeTransform, Signal, isSignal } from '@angular/core';\r\n\r\ntype Query =\r\n\t| string\r\n\t| string[]\r\n\t| Record<string, unknown>\r\n\t| Signal<string | string[] | Record<string, unknown> | undefined>;\r\n\r\ntype Field =\r\n\t| string\r\n\t| string[]\r\n\t| number\r\n\t| Signal<string | string[] | number | undefined>;\r\n\r\n@Pipe({ name: 'search', pure: true })\r\nexport class SearchPipe implements PipeTransform {\r\n\ttransform<T>(\r\n\t\titems: T[] | Record<string, T>,\r\n\t\tquery?: Query,\r\n\t\tfields?: Field,\r\n\t\tlimit?: number,\r\n\t\tignore = false,\r\n\t\t_reload?: unknown,\r\n\t): T[] {\r\n\t\t/* unwrap signals */\r\n\t\tconst q = isSignal(query) ? query() : query;\r\n\r\n\t\tlet f = isSignal(fields) ? fields() : fields;\r\n\r\n\t\t/* allow “fields” to be a number (=limit) */\r\n\t\tif (typeof f === 'number') {\r\n\t\t\tlimit = f;\r\n\r\n\t\t\tf = undefined;\r\n\t\t}\r\n\r\n\t\tconst docs = Array.isArray(items) ? items : Object.values(items);\r\n\r\n\t\tif (ignore || !q) return limit ? docs.slice(0, limit) : docs;\r\n\r\n\t\t/* normalise fields */\r\n\t\tconst paths: string[] = !f\r\n\t\t\t? ['name']\r\n\t\t\t: Array.isArray(f)\r\n\t\t\t\t? f\r\n\t\t\t\t: f.trim().split(/\\s+/);\r\n\r\n\t\t/* normalise query */\r\n\t\tconst needles: string[] = Array.isArray(q)\r\n\t\t\t? q.map((s) => s.toLowerCase())\r\n\t\t\t: typeof q === 'object'\r\n\t\t\t\t? Object.keys(q)\r\n\t\t\t\t\t\t.filter((k) => (q as any)[k])\r\n\t\t\t\t\t\t.map((k) => k.toLowerCase())\r\n\t\t\t\t: [q.toLowerCase()];\r\n\r\n\t\tconst txtMatches = (val: any) => {\r\n\t\t\tif (val == null) return false;\r\n\r\n\t\t\tconst hay = val.toString().toLowerCase();\r\n\r\n\t\t\treturn needles.some((n) => hay.includes(n) || n.includes(hay));\r\n\t\t};\r\n\r\n\t\tconst walk = (obj: any, parts: string[]): boolean => {\r\n\t\t\tif (!obj) return false;\r\n\r\n\t\t\tconst [head, ...rest] = parts;\r\n\r\n\t\t\tconst next = obj[head];\r\n\r\n\t\t\tif (Array.isArray(next))\r\n\t\t\t\treturn next.some((v) =>\r\n\t\t\t\t\trest.length ? walk(v, rest) : txtMatches(v),\r\n\t\t\t\t);\r\n\r\n\t\t\treturn rest.length ? walk(next, rest) : txtMatches(next);\r\n\t\t};\r\n\r\n\t\tconst out: T[] = [];\r\n\r\n\t\tconst seen = new Set<number | string>();\r\n\r\n\t\tconst check = (doc: T, key: number | string) => {\r\n\t\t\tfor (const p of paths) {\r\n\t\t\t\tif (walk(doc, p.split('.'))) {\r\n\t\t\t\t\tif (!seen.has(key)) {\r\n\t\t\t\t\t\tout.push(doc);\r\n\r\n\t\t\t\t\t\tseen.add(key);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tArray.isArray(items)\r\n\t\t\t? docs.forEach((d, i) => check(d, i))\r\n\t\t\t: Object.entries(items).forEach(([k, v]) => check(v, k));\r\n\r\n\t\treturn limit ? out.slice(0, limit) : out;\r\n\t}\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n\tname: 'splice',\r\n})\r\nexport class SplicePipe implements PipeTransform {\r\n\ttransform(from: any, which: any, refresh?: number): any {\r\n\t\tif (Array.isArray(from)) from = { arr: from, prop: '_id' };\r\n\r\n\t\tlet arr = (which.keep && []) || from.arr.slice();\r\n\r\n\t\tif (Array.isArray(which)) which = { arr: which, prop: '_id' };\r\n\r\n\t\tfor (let i = from.arr.length - 1; i >= 0; i--) {\r\n\t\t\tfor (let j = 0; j < which.arr.length; j++) {\r\n\t\t\t\tif (from.prop && which.prop) {\r\n\t\t\t\t\tif (from.arr[i][from.prop] == which.arr[j][which.prop]) {\r\n\t\t\t\t\t\tif (which.keep) {\r\n\t\t\t\t\t\t\tarr.push(from.arr[i]);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tarr.splice(i, 1);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (from.prop) {\r\n\t\t\t\t\tif (from.arr[i][from.prop] == which.arr[j]) {\r\n\t\t\t\t\t\tif (which.keep) {\r\n\t\t\t\t\t\t\tarr.push(from.arr[i]);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tarr.splice(i, 1);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (which.prop) {\r\n\t\t\t\t\tif (from.arr[i] == which.arr[j][which.prop]) {\r\n\t\t\t\t\t\tif (which.keep) {\r\n\t\t\t\t\t\t\tarr.push(from.arr[i]);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tarr.splice(i, 1);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (from.arr[i] == which.arr[j]) {\r\n\t\t\t\t\tif (which.keep) {\r\n\t\t\t\t\t\tarr.push(from.arr[i]);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tarr.splice(i, 1);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn arr;\r\n\t}\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n@Pipe({\r\n\tname: 'split',\r\n})\r\nexport class SplitPipe implements PipeTransform {\r\n\ttransform(value: string, index = 0, devider = ':'): unknown {\r\n\t\tconst arr = value.split(devider);\r\n\r\n\t\treturn arr.length > index ? arr[index] : '';\r\n\t}\r\n}\r\n","import { Injectable } from '@angular/core';\r\n@Injectable({\r\n\tprovidedIn: 'root',\r\n})\r\nexport class BaseService {\r\n\tnow = new Date().getTime();\r\n\r\n\trefreshNow(): void {\r\n\t\tthis.now = new Date().getTime();\r\n\t}\r\n}\r\n","import { Injectable, WritableSignal, signal } from '@angular/core';\r\nimport { toObservable } from '@angular/core/rxjs-interop';\r\nimport {\r\n\tObservable,\r\n\tSubject,\r\n\tcombineLatest,\r\n\tfilter,\r\n\tmap,\r\n\tmerge,\r\n\tshare,\r\n\tskip,\r\n\ttake,\r\n\ttakeUntil,\r\n\ttimeout,\r\n} from 'rxjs';\r\n\r\ntype Any = unknown;\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class EmitterService {\r\n\tprivate _signals = new Map<string, WritableSignal<Any>>();\r\n\tprivate _closers = new Map<string, Subject<void>>();\r\n\tprivate _streams = new Map<string, Observable<Any>>();\r\n\r\n\tprivate _getSignal(id: string): WritableSignal<Any> {\r\n\t\tlet s = this._signals.get(id);\r\n\t\tif (!s) {\r\n\t\t\t// emit even if same payload repeats\r\n\t\t\ts = signal<Any>(undefined, { equal: () => false });\r\n\t\t\tthis._signals.set(id, s);\r\n\t\t}\r\n\t\treturn s;\r\n\t}\r\n\r\n\tprivate _getCloser(id: string): Subject<void> {\r\n\t\tlet c = this._closers.get(id);\r\n\t\tif (!c) {\r\n\t\t\tc = new Subject<void>();\r\n\t\t\tthis._closers.set(id, c);\r\n\t\t}\r\n\t\treturn c;\r\n\t}\r\n\r\n\tprivate _getStream(id: string): Observable<Any> {\r\n\t\tlet obs$ = this._streams.get(id);\r\n\t\tif (!obs$) {\r\n\t\t\tconst sig = this._getSignal(id);\r\n\t\t\tconst closed$ = this._getCloser(id);\r\n\t\t\tobs$ = toObservable(sig).pipe(\r\n\t\t\t\t// Subject-like: don't replay the current value on subscribe\r\n\t\t\t\tskip(1),\r\n\t\t\t\ttakeUntil(closed$),\r\n\t\t\t\tshare(),\r\n\t\t\t);\r\n\t\t\tthis._streams.set(id, obs$);\r\n\t\t}\r\n\t\treturn obs$;\r\n\t}\r\n\r\n\t/** Emit an event */\r\n\temit<T = Any>(id: string, data?: T): void {\r\n\t\tthis._getSignal(id).set(data as Any);\r\n\t}\r\n\r\n\t/** Listen for events (hot, completes when off(id) is called) */\r\n\ton<T = Any>(id: string): Observable<T> {\r\n\t\treturn this._getStream(id) as Observable<T>;\r\n\t}\r\n\r\n\t/** Complete and remove a channel */\r\n\toff(id: string): void {\r\n\t\tconst closer = this._closers.get(id);\r\n\t\tif (closer) {\r\n\t\t\tcloser.next();\r\n\t\t\tcloser.complete();\r\n\t\t\tthis._closers.delete(id);\r\n\t\t}\r\n\t\tthis._signals.delete(id);\r\n\t\tthis._streams.delete(id);\r\n\t}\r\n\r\n\toffAll(): void {\r\n\t\tfor (const id of Array.from(this._closers.keys())) this.off(id);\r\n\t}\r\n\r\n\thas(id: string): boolean {\r\n\t\treturn this._signals.has(id);\r\n\t}\r\n\r\n\tprivate _done = new Map<string, WritableSignal<Any | undefined>>();\r\n\r\n\tprivate _getDoneSignal(id: string): WritableSignal<Any | undefined> {\r\n\t\tlet s = this._done.get(id);\r\n\t\tif (!s) {\r\n\t\t\ts = signal<Any | undefined>(undefined);\r\n\t\t\tthis._done.set(id, s);\r\n\t\t}\r\n\t\treturn s;\r\n\t}\r\n\r\n\t/** Mark task as completed with a payload (default: true) */\r\n\tcomplete<T = Any>(task: string, value: T = true as unknown as T): void {\r\n\t\tthis._getDoneSignal(task).set(value as Any);\r\n\t}\r\n\r\n\t/** Clear completion so it can be awaited again */\r\n\tclearCompleted(task: string): void {\r\n\t\tconst s = this._done.get(task) ?? this._getDoneSignal(task);\r\n\t\ts.set(undefined);\r\n\t}\r\n\r\n\t/** Read current completion payload (undefined => not completed) */\r\n\tcompleted(task: string): Any | undefined {\r\n\t\treturn this._getDoneSignal(task)();\r\n\t}\r\n\r\n\tisCompleted(task: string): boolean {\r\n\t\treturn this._getDoneSignal(task)() !== undefined;\r\n\t}\r\n\r\n\tonComplete(\r\n\t\ttasks: string | string[],\r\n\t\topts?: {\r\n\t\t\tmode?: 'all' | 'any';\r\n\t\t\ttimeoutMs?: number;\r\n\t\t\tabort?: AbortSignal;\r\n\t\t},\r\n\t): Observable<Any | Any[]> {\r\n\t\tconst list = (Array.isArray(tasks) ? tasks : [tasks]).filter(Boolean);\r\n\t\tconst streams = list.map((id) =>\r\n\t\t\ttoObservable(this._getDoneSignal(id)).pipe(\r\n\t\t\t\tfilter((v): v is Any => v !== undefined),\r\n\t\t\t\tmap((v) => v as Any),\r\n\t\t\t),\r\n\t\t);\r\n\r\n\t\tlet source$: Observable<Any | Any[]>;\r\n\r\n\t\tif (list.length <= 1) {\r\n\t\t\t// single-task await\r\n\t\t\tsource$ = streams[0]?.pipe(take(1)) ?? new Observable<never>();\r\n\t\t} else if (opts?.mode === 'any') {\r\n\t\t\tsource$ = merge(...streams).pipe(take(1));\r\n\t\t} else {\r\n\t\t\tsource$ = combineLatest(streams).pipe(take(1));\r\n\t\t}\r\n\r\n\t\tif (opts?.timeoutMs && Number.isFinite(opts.timeoutMs)) {\r\n\t\t\tsource$ = source$.pipe(timeout({ first: opts.timeoutMs }));\r\n\t\t}\r\n\r\n\t\tif (opts?.abort) {\r\n\t\t\tconst abort$ = new Observable<void>((sub) => {\r\n\t\t\t\tconst handler = () => {\r\n\t\t\t\t\tsub.next();\r\n\t\t\t\t\tsub.complete();\r\n\t\t\t\t};\r\n\t\t\t\topts.abort!.addEventListener('abort', handler);\r\n\t\t\t\treturn () => opts.abort!.removeEventListener('abort', handler);\r\n\t\t\t});\r\n\t\t\tsource$ = source$.pipe(takeUntil(abort$));\r\n\t\t}\r\n\r\n\t\treturn source$;\r\n\t}\r\n}\r\n","export type HttpHeaderType = string | number | (string | number)[];\r\n\r\n/**\r\n * Configuration values used by the HTTP service when\r\n * issuing requests to a backend API.\r\n */\r\nexport interface HttpConfig {\r\n\t/** Map of default headers appended to each request. */\r\n\theaders?: Record<string, HttpHeaderType>;\r\n\t/** Base URL for all HTTP requests. */\r\n\turl?: string;\r\n}\r\n\r\nexport const DEFAULT_HTTP_CONFIG: HttpConfig = {\r\n\theaders: {},\r\n\turl: '',\r\n};\r\n","import {\r\n\tHttpClient,\r\n\tHttpErrorResponse,\r\n\tHttpHeaders,\r\n} from '@angular/common/http';\r\nimport { Inject, Injectable, Optional } from '@angular/core';\r\nimport { EMPTY, Observable, ReplaySubject } from 'rxjs';\r\nimport { catchError, first } from 'rxjs/operators';\r\nimport { CONFIG_TOKEN, Config } from '../interfaces/config.interface';\r\nimport {\r\n\tDEFAULT_HTTP_CONFIG,\r\n\tHttpConfig,\r\n\tHttpHeaderType,\r\n} from '../interfaces/http.interface';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root',\r\n})\r\nexport class HttpService {\r\n\t// An array of error handling callbacks\r\n\terrors: ((err: HttpErrorResponse, retry?: () => void) => {})[] = [];\r\n\r\n\t// Base URL for HTTP requests\r\n\turl = localStorage.getItem('wacom-http.url') || '';\r\n\r\n\t// Flag to lock the service to prevent multiple requests\r\n\tlocked = false;\r\n\r\n\t// Array to store setTimeout IDs for managing request locks\r\n\tawaitLocked: ReturnType<typeof setTimeout>[] = [];\r\n\r\n\t// Configuration object for HTTP settings\r\n\tprivate _config: HttpConfig;\r\n\r\n\t// Object to store HTTP headers\r\n\tprivate _headers: {\r\n\t\t[name: string]: HttpHeaderType;\r\n\t} = localStorage.getItem('wacom-http.headers')\r\n\t\t? JSON.parse(localStorage.getItem('wacom-http.headers') as string)\r\n\t\t: {};\r\n\r\n\t// Instance of HttpHeaders with current headers\r\n\tprivate _http_headers = new HttpHeaders(this._headers);\r\n\r\n\tconstructor(\r\n\t\t@Inject(CONFIG_TOKEN) @Optional() config: Config,\r\n\t\tprivate _http: HttpClient,\r\n\t) {\r\n\t\t// Initialize HTTP configuration and headers from injected config\r\n\t\tthis._config = {\r\n\t\t\t...DEFAULT_HTTP_CONFIG,\r\n\t\t\t...(config.http || {}),\r\n\t\t};\r\n\r\n\t\tif (typeof this._config.url === 'string') {\r\n\t\t\tthis.setUrl(this._config.url);\r\n\t\t}\r\n\r\n\t\tif (typeof this._config.headers === 'object') {\r\n\t\t\tfor (const header in this._config.headers) {\r\n\t\t\t\tthis._headers[header] = this._config.headers[header];\r\n\t\t\t}\r\n\r\n\t\t\tthis._http_headers = new HttpHeaders(this._headers);\r\n\t\t}\r\n\t}\r\n\r\n\t// Set a new base URL and save it in the store\r\n\tsetUrl(url: string) {\r\n\t\tthis.url = url;\r\n\r\n\t\tlocalStorage.setItem('wacom-http.url', url);\r\n\t}\r\n\r\n\t// Remove the base URL and revert to the default or stored one\r\n\tremoveUrl() {\r\n\t\tthis.url = this._config.url || '';\r\n\r\n\t\tlocalStorage.removeItem('wacom-http.url');\r\n\t}\r\n\r\n\t// Set a new HTTP header and update the stored headers\r\n\tset(key: any, value: any) {\r\n\t\tthis._headers[key] = value;\r\n\r\n\t\tlocalStorage.setItem(\r\n\t\t\t'wacom-http.headers',\r\n\t\t\tJSON.stringify(this._headers),\r\n\t\t);\r\n\r\n\t\tthis._http_headers = new HttpHeaders(this._headers);\r\n\t}\r\n\r\n\t// Get the value of a specific HTTP header\r\n\theader(key: any) {\r\n\t\treturn this._headers[key];\r\n\t}\r\n\r\n\t// Remove a specific HTTP header and update the stored headers\r\n\tremove(key: any) {\r\n\t\tdelete this._headers[key];\r\n\r\n\t\tlocalStorage.setItem(\r\n\t\t\t'wacom-http.headers',\r\n\t\t\tJSON.stringify(this._headers),\r\n\t\t);\r\n\r\n\t\tthis._http_headers = new HttpHeaders(this._headers);\r\n\t}\r\n\r\n\t// Internal method to make HTTP requests based on the method type\r\n\tprivate _httpMethod(\r\n\t\tmethod: string,\r\n\t\t_url: string,\r\n\t\tdoc: unknown,\r\n\t\theaders: any,\r\n\t): Observable<any> {\r\n\t\tif (method === 'post') {\r\n\t\t\treturn this._http.post<any>(_url, doc, headers);\r\n\t\t} else if (method === 'put') {\r\n\t\t\treturn this._http.put<any>(_url, doc, headers);\r\n\t\t} else if (method === 'patch') {\r\n\t\t\treturn this._http.patch<any>(_url, doc, headers);\r\n\t\t} else if (method === 'delete') {\r\n\t\t\treturn this._http.delete<any>(_url, headers);\r\n\t\t} else {\r\n\t\t\treturn this._http.get<any>(_url, headers);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Internal method to handle HTTP requests for various methods (POST, PUT, PATCH, DELETE, GET).\r\n\t *\r\n\t * Features:\r\n\t * - **Request Locking**: Manages request locking to prevent simultaneous requests.\r\n\t * - **Acceptance Check**: Validates the server response against a user-defined `acceptance` function.\r\n\t *   If the check fails, the response is rejected with an error.\r\n\t * - **Replace Logic**: Allows modification of specific parts of the response object, determined by a user-defined `replace` function.\r\n\t *   Can handle both objects and arrays within the response.\r\n\t * - **Field Filtering**: Supports extracting specific fields from response objects or arrays.\r\n\t * - **Legacy Support**: Compatible with callback-based usage alongside Observables.\r\n\t * - **ReplaySubject**: Ensures that the response can be shared across multiple subscribers.\r\n\t *\r\n\t * @param url - The endpoint to send the HTTP request to (relative to the base URL).\r\n\t * @param doc - The request payload for methods like POST, PUT, and PATCH.\r\n\t * @param callback - A legacy callback function to handle the response.\r\n\t * @param opts - Additional options:\r\n\t *   - `err`: Error handling callback.\r\n\t *   - `acceptance`: Function to validate the server response. Should return `true` for valid responses.\r\n\t *   - `replace`: Function to modify specific parts of the response data.\r\n\t *   - `fields`: Array of fields to extract from the response object(s).\r\n\t *   - `data`: Path in the response where the data resides for `replace` and `fields` operations.\r\n\t *   - `skipLock`: If `true`, bypasses request locking.\r\n\t *   - `url`: Overrides the base URL for this request.\r\n\t * @param method - The HTTP method (e.g., 'post', 'put', 'patch', 'delete', 'get').\r\n\t * @returns An Observable that emits the processed HTTP response or an error.\r\n\t */\r\n\tprivate _post(\r\n\t\turl: string,\r\n\t\tdoc: unknown,\r\n\t\tcallback = (resp: unknown) => {},\r\n\t\topts: any = {},\r\n\t\tmethod = 'post',\r\n\t): Observable<any> {\r\n\t\tif (typeof opts === 'function') {\r\n\t\t\topts = { err: opts };\r\n\t\t}\r\n\r\n\t\tif (!opts.err) {\r\n\t\t\topts.err = (err: HttpErrorResponse) => {};\r\n\t\t}\r\n\r\n\t\t// Handle request locking to avoid multiple simultaneous requests\r\n\t\tif (this.locked && !opts.skipLock) {\r\n\t\t\treturn new Observable((observer) => {\r\n\t\t\t\tconst wait = setTimeout(() => {\r\n\t\t\t\t\tthis._post(url, doc, callback, opts, method).subscribe(\r\n\t\t\t\t\t\tobserver,\r\n\t\t\t\t\t);\r\n\t\t\t\t}, 100);\r\n\r\n\t\t\t\tthis.awaitLocked.push(wait);\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tconst _url = (opts.url || this.url) + url;\r\n\r\n\t\tthis.prepare_handle(_url, doc);\r\n\r\n\t\t// Using ReplaySubject to allow multiple subscriptions without re-triggering the HTTP request\r\n\t\tconst responseSubject = new ReplaySubject(1);\r\n\r\n\t\tthis._httpMethod(method, _url, doc, { headers: this._http_headers })\r\n\t\t\t.pipe(\r\n\t\t\t\tfirst(),\r\n\t\t\t\tcatchError((error: HttpErrorResponse) => {\r\n\t\t\t\t\tthis.handleError(opts.err, () => {\r\n\t\t\t\t\t\tthis._post(url, doc, callback, opts, method).subscribe(\r\n\t\t\t\t\t\t\tresponseSubject,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t})(error);\r\n\r\n\t\t\t\t\tresponseSubject.error(error);\r\n\r\n\t\t\t\t\treturn EMPTY;\r\n\t\t\t\t}),\r\n\t\t\t)\r\n\t\t\t.subscribe({\r\n\t\t\t\tnext: (resp: unknown) => {\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\topts.acceptance &&\r\n\t\t\t\t\t\ttypeof opts.acceptance === 'function'\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tif (!opts.acceptance(resp)) {\r\n\t\t\t\t\t\t\tconst error = new HttpErrorResponse({\r\n\t\t\t\t\t\t\t\terror: 'Acceptance failed',\r\n\t\t\t\t\t\t\t\tstatus: 400,\r\n\t\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t\tthis.handleError(opts.err, () => {})(error);\r\n\r\n\t\t\t\t\t\t\tresponseSubject.error(error);\r\n\r\n\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (opts.replace && typeof opts.replace === 'function') {\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tArray.isArray(\r\n\t\t\t\t\t\t\t\tthis._getObjectToReplace(resp, opts.data),\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\tthis._getObjectToReplace(\r\n\t\t\t\t\t\t\t\t\tresp,\r\n\t\t\t\t\t\t\t\t\topts.data,\r\n\t\t\t\t\t\t\t\t) as Array<unknown>\r\n\t\t\t\t\t\t\t).map((item: unknown) => opts.replace(item));\r\n\t\t\t\t\t\t} else if (this._getObjectToReplace(resp, opts.data)) {\r\n\t\t\t\t\t\t\topts.replace(\r\n\t\t\t\t\t\t\t\tthis._getObjectToReplace(resp, opts.data),\r\n\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (Array.isArray(opts.fields)) {\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tArray.isArray(\r\n\t\t\t\t\t\t\t\tthis._getObjectToReplace(resp, opts.data),\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\tthis._getObjectToReplace(\r\n\t\t\t\t\t\t\t\t\tresp,\r\n\t\t\t\t\t\t\t\t\topts.data,\r\n\t\t\t\t\t\t\t\t) as Array<unknown>\r\n\t\t\t\t\t\t\t).map((item: unknown) => {\r\n\t\t\t\t\t\t\t\treturn this._newDoc(item, opts.fields);\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t} else if (this._getObjectToReplace(resp, opts.data)) {\r\n\t\t\t\t\t\t\tconst newDoc = this._newDoc(\r\n\t\t\t\t\t\t\t\tthis._getObjectToReplace(resp, opts.data),\r\n\t\t\t\t\t\t\t\topts.fields,\r\n\t\t\t\t\t\t\t);\r\n\r\n\t\t\t\t\t\t\tif (opts.data) {\r\n\t\t\t\t\t\t\t\tthis._setObjectToReplace(\r\n\t\t\t\t\t\t\t\t\tresp,\r\n\t\t\t\t\t\t\t\t\topts.data,\r\n\t\t\t\t\t\t\t\t\tnewDoc,\r\n\t\t\t\t\t\t\t\t);\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tresp = newDoc;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.response_handle(_url, resp, () => callback(resp));\r\n\r\n\t\t\t\t\tresponseSubject.next(resp);\r\n\r\n\t\t\t\t\tresponseSubject.complete();\r\n\t\t\t\t},\r\n\t\t\t\terror: (err) => responseSubject.error(err),\r\n\t\t\t\tcomplete: () => responseSubject.complete(),\r\n\t\t\t});\r\n\r\n\t\treturn responseSubject.asObservable();\r\n\t}\r\n\r\n\t/**\r\n\t * Public method to perform a POST request.\r\n\t * - Supports legacy callback usage.\r\n\t * - Returns an Observable for reactive programming.\r\n\t */\r\n\tpost(\r\n\t\turl: string,\r\n\t\tdoc: any,\r\n\t\tcallback = (resp: any) => {},\r\n\t\topts: any = {},\r\n\t): Observable<any> {\r\n\t\treturn this._post(url, doc, callback, opts);\r\n\t}\r\n\r\n\t/**\r\n\t * Public method to perform a PUT request.\r\n\t * - Supports legacy callback usage.\r\n\t * - Returns an Observable for reactive programming.\r\n\t */\r\n\tput(\r\n\t\turl: string,\r\n\t\tdoc: any,\r\n\t\tcallback = (resp: any) => {},\r\n\t\topts: any = {},\r\n\t): Observable<any> {\r\n\t\treturn this._post(url, doc, callback, opts, 'put');\r\n\t}\r\n\r\n\t/**\r\n\t * Public method to perform a PATCH request.\r\n\t * - Supports legacy callback usage.\r\n\t * - Returns an Observable for reactive programming.\r\n\t */\r\n\tpatch(\r\n\t\turl: string,\r\n\t\tdoc: any,\r\n\t\tcallback = (resp: any) => {},\r\n\t\topts: any = {},\r\n\t): Observable<any> {\r\n\t\treturn this._post(url, doc, callback, opts, 'patch');\r\n\t}\r\n\r\n\t/**\r\n\t * Public method to perform a DELETE request.\r\n\t * - Supports legacy callback usage.\r\n\t * - Returns an Observable for reactive programming.\r\n\t */\r\n\tdelete(\r\n\t\turl: string,\r\n\t\tcallback = (resp: any) => {},\r\n\t\topts: any = {},\r\n\t): Observable<any> {\r\n\t\treturn this._post(url, null, callback, opts, 'delete');\r\n\t}\r\n\r\n\t/**\r\n\t * Public method to perform a GET request.\r\n\t * - Supports legacy callback usage.\r\n\t * - Returns an Observable for reactive programming.\r\n\t */\r\n\tget(\r\n\t\turl: string,\r\n\t\tcallback = (resp: any) => {},\r\n\t\topts: any = {},\r\n\t): Observable<any> {\r\n\t\treturn this._post(url, null, callback, opts, 'get');\r\n\t}\r\n\r\n\t// Clear all pending request locks\r\n\tclearLocked() {\r\n\t\tfor (const awaitLocked of this.awaitLocked) {\r\n\t\t\tclearTimeout(awaitLocked);\r\n\t\t}\r\n\t\tthis.awaitLocked = [];\r\n\t}\r\n\r\n\t// Lock the service to prevent multiple simultaneous requests\r\n\tlock() {\r\n\t\tthis.locked = true;\r\n\t}\r\n\r\n\t// Unlock the service to allow new requests\r\n\tunlock() {\r\n\t\tthis.locked = false;\r\n\t}\r\n\r\n\t/**\r\n\t * Handles HTTP errors.\r\n\t * - Calls provided error callback and retries the request if needed.\r\n\t */\r\n\tprivate handleError(callback: any, retry: () => void) {\r\n\t\treturn (error: HttpErrorResponse): Promise<void> => {\r\n\t\t\treturn new Promise((resolve) => {\r\n\t\t\t\tthis.err_handle(error, callback, retry);\r\n\t\t\t\tresolve();\r\n\t\t\t});\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * Internal method to trigger error handling callbacks.\r\n\t */\r\n\tprivate err_handle(\r\n\t\terr: HttpErrorResponse,\r\n\t\tnext: (err: HttpErrorResponse) => void,\r\n\t\tretry: () => void,\r\n\t) {\r\n\t\tif (typeof next === 'function') {\r\n\t\t\tnext(err);\r\n\t\t}\r\n\r\n\t\tfor (const callback of this.errors) {\r\n\t\t\tif (typeof callback === 'function') {\r\n\t\t\t\tcallback(err, retry);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// Placeholder method for handling request preparation (can be customized)\r\n\tprivate prepare_handle(url: string, body: unknown) {}\r\n\r\n\t// Placeholder method for handling the response (can be customized)\r\n\tprivate response_handle(url: string, body: unknown, next: () => void) {\r\n\t\tif (typeof next === 'function') {\r\n\t\t\tnext();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Retrieves a nested object or property from the response based on a dot-separated path.\r\n\t *\r\n\t * @param resp - The response object to retrieve data from.\r\n\t * @param base - A dot-separated string indicating the path to the desired property within the response.\r\n\t *   - Example: `'data.items'` will navigate through `resp.data.items`.\r\n\t *   - If empty, the entire response is returned.\r\n\t * @returns The object or property located at the specified path within the response.\r\n\t */\r\n\tprivate _getObjectToReplace(resp: unknown, base = ''): unknown {\r\n\t\tif (base.includes('.')) {\r\n\t\t\tconst newBase = base.split('');\r\n\r\n\t\t\tconst currentBase: string = newBase.pop() || '';\r\n\r\n\t\t\treturn this._getObjectToReplace(\r\n\t\t\t\t(resp as Record<string, unknown>)[currentBase] || {},\r\n\t\t\t\tnewBase.join('.'),\r\n\t\t\t);\r\n\t\t} else if (base) {\r\n\t\t\treturn (resp as Record<string, unknown>)[base];\r\n\t\t} else {\r\n\t\t\treturn resp;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Sets or replaces a nested object or property in the response based on a dot-separated path.\r\n\t *\r\n\t * @param resp - The response object to modify.\r\n\t * @param base - A dot-separated string indicating the path to the property to replace.\r\n\t *   - Example: `'data.items'` will navigate through `resp.data.items`.\r\n\t * @param doc - The new data or object to set at the specified path.\r\n\t * @returns `void`.\r\n\t */\r\n\tprivate _setObjectToReplace(resp: unknown, base = '', doc: unknown): void {\r\n\t\twhile (base.includes('.')) {\r\n\t\t\tconst newBase = base.split('');\r\n\r\n\t\t\tconst currentBase: string = newBase.pop() || '';\r\n\r\n\t\t\tresp = (resp as Record<string, unknown>)[currentBase] || {};\r\n\r\n\t\t\tbase = newBase.join('.');\r\n\t\t}\r\n\r\n\t\t(resp as Record<string, unknown>)[base] = doc;\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a new object containing only specified fields from the input item.\r\n\t *\r\n\t * @param item - The input object to extract fields from.\r\n\t * @param fields - An array of field names to include in the new object.\r\n\t *   - Example: `['id', 'name']` will create a new object with only the `id` and `name` properties from `item`.\r\n\t * @returns A new object containing only the specified fields.\r\n\t */\r\n\tprivate _newDoc(item: unknown, fields: string[]): unknown {\r\n\t\tconst newDoc: Record<string, unknown> = {};\r\n\r\n\t\tfor (const field of fields) {\r\n\t\t\tnewDoc[field] = (item as Record<string, unknown>)[field];\r\n\t\t}\r\n\r\n\t\treturn newDoc;\r\n\t}\r\n}\r\n","import { InjectionToken } from '@angular/core';\r\n\r\nexport type NetworkStatus = 'good' | 'poor' | 'none';\r\n\r\nexport interface NetworkConfig {\r\n\t/** Ordered list of endpoints to probe (first that succeeds wins). */\r\n\tendpoints: string[];\r\n\t/** Periodic re-check interval (ms). */\r\n\tintervalMs: number;\r\n\t/** Per-request timeout (ms). */\r\n\ttimeoutMs: number;\r\n\t/** Latency threshold (ms) to classify as \"good\". */\r\n\tgoodLatencyMs: number;\r\n\t/** Consecutive failures to flip status to \"none\". */\r\n\tmaxConsecutiveFails: number;\r\n}\r\n\r\nexport const DEFAULT_NETWORK_CONFIG: NetworkConfig = {\r\n\tendpoints: [\r\n\t\t'https://api.webart.work/status',\r\n\t\t// Opaque but useful reachability fallbacks:\r\n\t\t'https://www.google.com/generate_204',\r\n\t\t'https://www.gstatic.com/generate_204',\r\n\t\t'https://www.cloudflare.com/cdn-cgi/trace',\r\n\t],\r\n\tintervalMs: 30_000,\r\n\ttimeoutMs: 2_500,\r\n\tgoodLatencyMs: 300,\r\n\tmaxConsecutiveFails: 3,\r\n};\r\n\r\nexport const NETWORK_CONFIG = new InjectionToken<NetworkConfig>(\r\n\t'NETWORK_CONFIG',\r\n\t{\r\n\t\tfactory: () => DEFAULT_NETWORK_CONFIG,\r\n\t},\r\n);\r\n","// network.service.ts — Angular 20+ (zoneless) signal-based connectivity checker\r\nimport { inject, Inject, Injectable, Optional, signal } from '@angular/core';\r\nimport { Config, CONFIG_TOKEN } from '../interfaces/config.interface';\r\nimport {\r\n\tDEFAULT_NETWORK_CONFIG,\r\n\tNetworkConfig,\r\n\tNetworkStatus,\r\n} from '../interfaces/network.interface';\r\nimport { EmitterService } from './emitter.service';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class NetworkService {\r\n\t/** Internal mutable signals. */\r\n\tprivate _status = signal<NetworkStatus>(navigator.onLine ? 'poor' : 'none');\r\n\tprivate _latencyMs = signal<number | null>(null);\r\n\tprivate _isOnline = signal<boolean>(navigator.onLine);\r\n\r\n\t/** Public read-only signals. */\r\n\treadonly status = this._status.asReadonly();\r\n\treadonly latencyMs = this._latencyMs.asReadonly();\r\n\treadonly isOnline = this._isOnline.asReadonly();\r\n\r\n\t/** Failure counter to decide \"none\". */\r\n\tprivate fails = 0;\r\n\r\n\t/**\r\n\t * Creates the network monitor, binds browser/Capacitor events,\r\n\t * performs an immediate check, and starts periodic polling.\r\n\t */\r\n\tconstructor(@Inject(CONFIG_TOKEN) @Optional() config: Config) {\r\n\t\tthis._config = {\r\n\t\t\t...DEFAULT_NETWORK_CONFIG,\r\n\t\t\t...(config.network || ({} as NetworkConfig)),\r\n\t\t};\r\n\r\n\t\tthis._bindEvents();\r\n\r\n\t\tthis.recheckNow(); // fire once on start\r\n\r\n\t\twindow.setInterval(() => this.recheckNow(), this._config.intervalMs);\r\n\t}\r\n\r\n\t/**\r\n\t * Manually trigger a connectivity check.\r\n\t * - Measures latency against the first reachable endpoint.\r\n\t * - Updates `isOnline`, `latencyMs`, and `status` accordingly.\r\n\t */\r\n\tasync recheckNow(): Promise<void> {\r\n\t\tconst res = await this._pingAny();\r\n\r\n\t\tif (res.ok && res.latency != null) {\r\n\t\t\tthis.fails = 0;\r\n\r\n\t\t\tthis._latencyMs.set(res.latency);\r\n\r\n\t\t\tthis._isOnline.set(true);\r\n\t\t} else {\r\n\t\t\tthis.fails++;\r\n\r\n\t\t\tthis._latencyMs.set(null);\r\n\t\t\t// `isOnline` may still be true per OS; we let online/offline events keep it in sync.\r\n\t\t}\r\n\r\n\t\tthis._updateClassification();\r\n\t}\r\n\r\n\t// ─────────────────────────── Internals ───────────────────────────\r\n\r\n\t/**\r\n\t * Classifies current state into 'good' | 'poor' | 'none'.\r\n\t * - 'none' if offline or too many consecutive failures.\r\n\t * - 'good' if latency ≤ goodLatencyMs.\r\n\t * - otherwise 'poor'.\r\n\t */\r\n\tprivate _updateClassification(): void {\r\n\t\tif (\r\n\t\t\t!this._isOnline() ||\r\n\t\t\tthis.fails >= this._config.maxConsecutiveFails\r\n\t\t) {\r\n\t\t\tif (this._status() !== 'none') {\r\n\t\t\t\tthis._status.set('none');\r\n\r\n\t\t\t\tthis._emitterService.emit('wacom_offline');\r\n\t\t\t}\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst l = this._latencyMs();\r\n\r\n\t\tif (l != null && l <= this._config.goodLatencyMs) {\r\n\t\t\tif (this._status() !== 'good') {\r\n\t\t\t\tthis._status.set('good');\r\n\r\n\t\t\t\tthis._emitterService.emit('wacom_online');\r\n\t\t\t}\r\n\t\t} else if (this._status() !== 'poor') {\r\n\t\t\tthis._status.set('poor');\r\n\r\n\t\t\tthis._emitterService.emit('wacom_online');\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Binds browser events that can affect connectivity:\r\n\t * - online/offline (OS connectivity)\r\n\t * - visibilitychange (recheck on focus)\r\n\t * - NetworkInformation 'change' (if supported)\r\n\t */\r\n\tprivate _bindEvents(): void {\r\n\t\twindow.addEventListener('online', () => {\r\n\t\t\tthis._isOnline.set(true);\r\n\r\n\t\t\tthis.recheckNow();\r\n\t\t});\r\n\r\n\t\twindow.addEventListener('offline', () => {\r\n\t\t\tthis._isOnline.set(false);\r\n\r\n\t\t\tthis._updateClassification();\r\n\t\t});\r\n\r\n\t\t(navigator as any).connection?.addEventListener?.('change', () =>\r\n\t\t\tthis.recheckNow(),\r\n\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * Tries endpoints in order until one responds (CORS or opaque).\r\n\t * Returns success with measured latency, or a failure result.\r\n\t */\r\n\tprivate async _pingAny(): Promise<{ ok: boolean; latency: number | null }> {\r\n\t\tfor (const url of this._config.endpoints) {\r\n\t\t\tconst noCors = !url.includes('api.webart.work'); // treat public fallbacks as opaque checks\r\n\r\n\t\t\tconst r = await this._measure(\r\n\t\t\t\turl,\r\n\t\t\t\tthis._config.timeoutMs,\r\n\t\t\t\tnoCors,\r\n\t\t\t).catch(() => null);\r\n\r\n\t\t\tif (r?.ok) return r;\r\n\t\t}\r\n\r\n\t\treturn { ok: false, latency: null };\r\n\t}\r\n\r\n\t/**\r\n\t * Measures a single fetch:\r\n\t * - Appends a timestamp to bypass caches.\r\n\t * - Uses `no-store` to avoid intermediaries caching.\r\n\t * - When `noCors` is true, uses `mode:'no-cors'` and treats a resolved fetch as reachable.\r\n\t */\r\n\tprivate async _measure(\r\n\t\turl: string,\r\n\t\ttimeoutMs: number,\r\n\t\tnoCors = false,\r\n\t): Promise<{ ok: boolean; latency: number | null }> {\r\n\t\tconst ctrl = new AbortController();\r\n\t\tconst timer = setTimeout(() => ctrl.abort(), timeoutMs);\r\n\t\tconst t0 = performance.now();\r\n\r\n\t\ttry {\r\n\t\t\tconst res = await fetch(\r\n\t\t\t\turl + (url.includes('?') ? '&' : '?') + 't=' + Date.now(),\r\n\t\t\t\t{\r\n\t\t\t\t\tmethod: 'GET',\r\n\t\t\t\t\tcache: 'no-store',\r\n\t\t\t\t\tcredentials: 'omit',\r\n\t\t\t\t\tsignal: ctrl.signal,\r\n\t\t\t\t\tmode: noCors ? 'no-cors' : 'cors',\r\n\t\t\t\t},\r\n\t\t\t);\r\n\r\n\t\t\tclearTimeout(timer);\r\n\r\n\t\t\tconst latency = Math.round(performance.now() - t0);\r\n\r\n\t\t\t// In no-cors, Response is opaque; treat as success if the fetch resolved.\r\n\t\t\tconst ok = noCors ? true : res.ok;\r\n\r\n\t\t\treturn { ok, latency };\r\n\t\t} catch {\r\n\t\t\tclearTimeout(timer);\r\n\r\n\t\t\treturn { ok: false, latency: null };\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _config: NetworkConfig;\r\n\r\n\tprivate _emitterService = inject(EmitterService);\r\n}\r\n","import { Inject, Injectable, Optional } from '@angular/core';\r\nimport {\r\n\tCONFIG_TOKEN,\r\n\tConfig,\r\n\tDEFAULT_CONFIG,\r\n} from '../interfaces/config.interface';\r\nimport { StoreConfig } from '../interfaces/store.interface';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root',\r\n})\r\nexport class StoreService {\r\n\tconstructor(@Inject(CONFIG_TOKEN) @Optional() config: Config) {\r\n\t\tthis._config = {\r\n\t\t\t...DEFAULT_CONFIG,\r\n\t\t\t...(config?.store || {}),\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the prefix for storage keys.\r\n\t *\r\n\t * @param prefix - The prefix to set.\r\n\t */\r\n\tsetPrefix(prefix: string): void {\r\n\t\tthis._prefix = prefix;\r\n\t}\r\n\r\n\t/**\r\n\t * Sets a value in storage asynchronously.\r\n\t *\r\n\t * @param key - The storage key.\r\n\t * @param value - The value to store.\r\n\t * @returns A promise that resolves to a boolean indicating success.\r\n\t */\r\n\tasync set(\r\n\t\tkey: string,\r\n\t\tvalue: string,\r\n\t\tcallback: () => void = () => {},\r\n\t\terrCallback: (err: unknown) => void = () => {},\r\n\t): Promise<boolean> {\r\n\t\tkey = this._applyPrefix(key);\r\n\r\n\t\ttry {\r\n\t\t\tif (this._config.set) {\r\n\t\t\t\tawait this._config.set(key, value, callback, errCallback);\r\n\t\t\t} else {\r\n\t\t\t\tlocalStorage.setItem(key, value);\r\n\r\n\t\t\t\tcallback();\r\n\t\t\t}\r\n\r\n\t\t\treturn true;\r\n\t\t} catch (err) {\r\n\t\t\tconsole.error(err);\r\n\r\n\t\t\terrCallback(err);\r\n\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Gets a value from storage asynchronously.\r\n\t *\r\n\t * @param key - The storage key.\r\n\t * @returns A promise that resolves to the retrieved value or `null` if the key is missing.\r\n\t */\r\n\tasync get(\r\n\t\tkey: string,\r\n\t\tcallback?: (value: string | null) => void,\r\n\t\terrCallback: (err: unknown) => void = () => {},\r\n\t): Promise<string | null> {\r\n\t\tkey = this._applyPrefix(key);\r\n\r\n\t\ttry {\r\n\t\t\tif (this._config.get) {\r\n\t\t\t\tconst value = await this._config.get(\r\n\t\t\t\t\tkey,\r\n\t\t\t\t\t(val: string) => {\r\n\t\t\t\t\t\tcallback?.(val ?? null);\r\n\t\t\t\t\t},\r\n\t\t\t\t\terrCallback,\r\n\t\t\t\t);\r\n\r\n\t\t\t\treturn value ?? null;\r\n\t\t\t} else {\r\n\t\t\t\tconst value = localStorage.getItem(key);\r\n\r\n\t\t\t\tcallback?.(value ?? null);\r\n\r\n\t\t\t\treturn value ?? null;\r\n\t\t\t}\r\n\t\t} catch (err) {\r\n\t\t\tconsole.error(err);\r\n\r\n\t\t\terrCallback(err);\r\n\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Sets a JSON value in storage asynchronously.\r\n\t *\r\n\t * @param key - The storage key.\r\n\t * @param value - The value to store.\r\n\t * @returns A promise that resolves to a boolean indicating success.\r\n\t */\r\n\tasync setJson<T>(\r\n\t\tkey: string,\r\n\t\tvalue: T,\r\n\t\tcallback: () => void = () => {},\r\n\t\terrCallback: (err: unknown) => void = () => {},\r\n\t): Promise<boolean> {\r\n\t\treturn await this.set(\r\n\t\t\tkey,\r\n\t\t\tJSON.stringify(value),\r\n\t\t\tcallback,\r\n\t\t\terrCallback,\r\n\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * Gets a JSON value from storage asynchronously.\r\n\t *\r\n\t * @param key - The storage key.\r\n\t * @returns A promise that resolves to the retrieved value.\r\n\t */\r\n\tasync getJson<T = any>(\r\n\t\tkey: string,\r\n\t\tcallback?: (value: string | null) => void,\r\n\t\terrCallback: (err: unknown) => void = () => {},\r\n\t): Promise<T | null> {\r\n\t\tconst value = await this.get(key, callback, errCallback);\r\n\r\n\t\tif (value === null) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\ttry {\r\n\t\t\treturn JSON.parse(value);\r\n\t\t} catch (err) {\r\n\t\t\tconsole.error(err);\r\n\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Removes a value from storage.\r\n\t *\r\n\t * @param key - The storage key.\r\n\t * @param callback - The callback to execute on success.\r\n\t * @param errCallback - The callback to execute on error.\r\n\t * @returns A promise that resolves to a boolean indicating success.\r\n\t */\r\n\tasync remove(\r\n\t\tkey: string,\r\n\t\tcallback: () => void = () => {},\r\n\t\terrCallback: (err: unknown) => void = () => {},\r\n\t): Promise<boolean> {\r\n\t\tkey = this._applyPrefix(key);\r\n\r\n\t\ttry {\r\n\t\t\tif (this._config.remove) {\r\n\t\t\t\treturn await this._config.remove(key, callback, errCallback);\r\n\t\t\t} else {\r\n\t\t\t\tlocalStorage.removeItem(key);\r\n\r\n\t\t\t\tcallback();\r\n\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t} catch (err) {\r\n\t\t\tconsole.error(err);\r\n\r\n\t\t\terrCallback(err);\r\n\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Clears all values from storage.\r\n\t *\r\n\t * @param callback - The callback to execute on success.\r\n\t * @param errCallback - The callback to execute on error.\r\n\t * @returns A promise that resolves to a boolean indicating success.\r\n\t */\r\n\tasync clear(\r\n\t\tcallback?: () => void,\r\n\t\terrCallback?: (err: unknown) => void,\r\n\t): Promise<boolean> {\r\n\t\ttry {\r\n\t\t\tif (this._config.clear) {\r\n\t\t\t\tawait this._config.clear();\r\n\t\t\t} else {\r\n\t\t\t\tlocalStorage.clear();\r\n\t\t\t}\r\n\r\n\t\t\tcallback?.();\r\n\r\n\t\t\treturn true;\r\n\t\t} catch (err) {\r\n\t\t\tconsole.error(err);\r\n\r\n\t\t\terrCallback?.(err);\r\n\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _prefix = '';\r\n\r\n\tprivate _config: StoreConfig;\r\n\r\n\t/**\r\n\t * Applies the configured prefix to a storage key.\r\n\t *\r\n\t * @param key - The storage key.\r\n\t * @returns The prefixed storage key.\r\n\t */\r\n\tprivate _applyPrefix(key: string): string {\r\n\t\tif (this._config.prefix) {\r\n\t\t\tkey = this._config.prefix + key;\r\n\t\t}\r\n\r\n\t\tif (this._prefix) {\r\n\t\t\tkey = this._prefix + key;\r\n\t\t}\r\n\r\n\t\treturn key;\r\n\t}\r\n}\r\n","import { inject, WritableSignal } from '@angular/core';\r\nimport { Observable } from 'rxjs';\r\nimport { CrudDocument, CrudOptions } from '../interfaces/crud.interface';\r\nimport { AlertService } from './alert.service';\r\nimport { BaseService } from './base.service';\r\nimport { CoreService } from './core.service';\r\nimport { EmitterService } from './emitter.service';\r\nimport { HttpService } from './http.service';\r\nimport { NetworkService } from './network.service';\r\nimport { StoreService } from './store.service';\r\n\r\ninterface CrudConfig<Document> {\r\n\tsignalFields?: Record<string, (doc: Document) => unknown>;\r\n\tname: string;\r\n\t_id?: string;\r\n\treplace?: (doc: Document) => void;\r\n\tunauthorized?: boolean;\r\n\tappId?: string;\r\n}\r\n\r\ninterface GetConfig {\r\n\tpage?: number;\r\n\tperPage?: number;\r\n\tquery?: string;\r\n}\r\n\r\n/**\r\n * Abstract class representing a CRUD (Create, Read, Update, Delete) service.\r\n *\r\n * This class provides methods for managing documents, interacting with an API,\r\n * and storing/retrieving data from local storage. It is designed to be extended\r\n * for specific document types.\r\n *\r\n * @template Document - The type of the document the service handles.\r\n */\r\nexport abstract class CrudService<\r\n\tDocument extends CrudDocument<Document>,\r\n> extends BaseService {\r\n\t/**\r\n\t * URL for the API.\r\n\t */\r\n\tprivate _url = '/api/';\r\n\r\n\t/**\r\n\t * Array of documents managed by this service.\r\n\t */\r\n\tprivate _docs: Document[] = [];\r\n\r\n\t/**\r\n\t * Number of documents per page.\r\n\t */\r\n\tprivate _perPage = 20;\r\n\r\n\t/**\r\n\t * Callbacks for filtering documents.\r\n\t */\r\n\tprivate _filteredDocumentsCallbacks: (() => void)[] = [];\r\n\r\n\t/**\r\n\t * Constructs a CRUD service instance.\r\n\t *\r\n\t * @param _config - Configuration options for the CRUD service.\r\n\t * @param __httpService - Service to handle HTTP requests.\r\n\t * @param __storeService - Service to manage local storage of documents.\r\n\t * @param __alertService - Service to display alerts.\r\n\t * @param __coreService - Core service for utility functions.\r\n\t */\r\n\tprotected __httpService = inject(HttpService);\r\n\r\n\tprotected __storeService = inject(StoreService);\r\n\r\n\tprotected __alertService = inject(AlertService);\r\n\r\n\tprotected __coreService = inject(CoreService);\r\n\r\n\tprotected __emitterService = inject(EmitterService);\r\n\r\n\tprotected __networkService = inject(NetworkService);\r\n\r\n\tloaded: Observable<unknown>;\r\n\r\n\tgetted: Observable<unknown>;\r\n\r\n\tconstructor(private _config: CrudConfig<Document>) {\r\n\t\tsuper();\r\n\r\n\t\tthis._config.signalFields = this._config.signalFields || {};\r\n\r\n\t\tthis._url += this._config.name;\r\n\r\n\t\tthis.loaded = this.__emitterService.onComplete(\r\n\t\t\tthis._config.name + '_loaded',\r\n\t\t);\r\n\r\n\t\tthis.getted = this.__emitterService.onComplete(\r\n\t\t\tthis._config.name + '_getted',\r\n\t\t);\r\n\r\n\t\tif (this._config.unauthorized) {\r\n\t\t\tthis.restoreDocs();\r\n\t\t} else if (localStorage.getItem('waw_user')) {\r\n\t\t\tconst user = JSON.parse(localStorage.getItem('waw_user') as string);\r\n\r\n\t\t\tif (\r\n\t\t\t\tuser._id ===\r\n\t\t\t\tlocalStorage.getItem(this._config.name + 'waw_user_id')\r\n\t\t\t) {\r\n\t\t\t\tthis.restoreDocs();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis.__emitterService.on('wipe').subscribe((): void => {\r\n\t\t\tthis.clearDocs();\r\n\r\n\t\t\tthis._filterDocuments();\r\n\t\t});\r\n\r\n\t\tthis.__emitterService.on('wacom_online').subscribe(() => {\r\n\t\t\tfor (const callback of this._onOnline) {\r\n\t\t\t\tcallback();\r\n\t\t\t}\r\n\r\n\t\t\tthis._onOnline.length = 0;\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Cache of per-document signals indexed by document _id.\r\n\t * Prevents creating multiple signals for the same document.\r\n\t */\r\n\tprivate _signals: Record<string, WritableSignal<Document>> = {};\r\n\r\n\t/**\r\n\t * Returns a WritableSignal for a document by _id, creating it if absent.\r\n\t * Caches the signal to avoid redundant instances and initializes it\r\n\t * with the current snapshot of the document.\r\n\t * Work very carefully with this and localId, better avoid such flows\r\n\t * @param _id - Document identifier.\r\n\t */\r\n\tgetSignal(_id: string) {\r\n\t\tthis._signals[_id] ||= this.__coreService.toSignal(\r\n\t\t\tthis.doc(_id) || { _id },\r\n\t\t\tthis._config.signalFields,\r\n\t\t);\r\n\r\n\t\treturn this._signals[_id];\r\n\t}\r\n\r\n\t/**\r\n\t * Clears cached document signals except those explicitly preserved.\r\n\t * Useful when changing routes or contexts to reduce memory.\r\n\t * @param exceptIds - List of ids whose signals should be kept.\r\n\t */\r\n\tremoveSignals(exceptIds: string[] = []) {\r\n\t\tfor (const _id in this._signals) {\r\n\t\t\tif (!exceptIds.includes(_id)) {\r\n\t\t\t\tdelete this._signals[_id];\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tasync restoreDocs() {\r\n\t\tconst docs = await this.__storeService.getJson<Document[]>(\r\n\t\t\t'docs_' + this._config.name,\r\n\t\t);\r\n\r\n\t\tif (docs?.length) {\r\n\t\t\tthis._docs.length = 0;\r\n\r\n\t\t\tthis._docs.push(...docs);\r\n\r\n\t\t\tthis._filterDocuments();\r\n\r\n\t\t\tfor (const doc of this._docs) {\r\n\t\t\t\tif (doc.__deleted) {\r\n\t\t\t\t\tthis.delete(doc, doc.__options?.['delete'] || {});\r\n\t\t\t\t} else if (!doc._id) {\r\n\t\t\t\t\tthis.create(doc, doc.__options?.['create'] || {});\r\n\t\t\t\t} else if (doc.__modified?.length) {\r\n\t\t\t\t\tfor (const id of doc.__modified) {\r\n\t\t\t\t\t\tif (id.startsWith('up')) {\r\n\t\t\t\t\t\t\tthis.update(doc, doc.__options?.[id] || {});\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.unique(doc, doc.__options?.[id] || {});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tthis.__emitterService.complete(\r\n\t\t\t\tthis._config.name + '_loaded',\r\n\t\t\t\tthis._docs,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Saves the current set of documents to local storage.\r\n\t */\r\n\tsetDocs(): void {\r\n\t\tthis.__storeService.setJson<Document[]>(\r\n\t\t\t'docs_' + this._config.name,\r\n\t\t\tthis._docs,\r\n\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * Retrieves the current list of documents.\r\n\t *\r\n\t * @returns The list of documents.\r\n\t */\r\n\tgetDocs(filter: (doc: Document) => boolean = () => true): Document[] {\r\n\t\treturn this._docs.filter(filter);\r\n\t}\r\n\r\n\t/**\r\n\t * Clears the current list of documents.\r\n\t *\r\n\t * Empties the internal documents array and saves the updated state to local storage.\r\n\t */\r\n\tclearDocs(): void {\r\n\t\tthis._docs.splice(0, this._docs.length);\r\n\r\n\t\tthis.setDocs();\r\n\t}\r\n\r\n\t/**\r\n\t * Adds multiple documents to the service and saves them to local storage.\r\n\t *\r\n\t * @param docs - An array of documents to add.\r\n\t */\r\n\taddDocs(docs: Document[]): void {\r\n\t\tif (Array.isArray(docs)) {\r\n\t\t\tfor (const doc of docs) {\r\n\t\t\t\tthis.addDoc(doc);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Adds a single document to the service. If it already exists, it will be updated.\r\n\t *\r\n\t * @param doc - The document to add.\r\n\t */\r\n\taddDoc(doc: Document): void {\r\n\t\tif (this._config.replace) {\r\n\t\t\tthis._config.replace(doc);\r\n\t\t}\r\n\r\n\t\tconst existingDoc = this._docs.find(\r\n\t\t\t(d) =>\r\n\t\t\t\t(this._id(doc) && this._id(d) === this._id(doc)) ||\r\n\t\t\t\t(doc._localId && d._localId === doc._localId),\r\n\t\t);\r\n\r\n\t\tif (existingDoc) {\r\n\t\t\t// Update the existing document\r\n\t\t\tthis.__coreService.copy(doc, existingDoc);\r\n\r\n\t\t\tthis.__coreService.copy(existingDoc, doc);\r\n\t\t} else {\r\n\t\t\t// Add new document\r\n\t\t\tthis._docs.push(doc);\r\n\t\t}\r\n\r\n\t\tthis.setDocs();\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a new document with a temporary ID and status flags.\r\n\t *\r\n\t * @param doc - Optional base document to use for the new document.\r\n\t * @returns A new document instance with default properties.\r\n\t */\r\n\tnew(doc: Document = {} as Document): Document {\r\n\t\treturn {\r\n\t\t\t...doc,\r\n\t\t\t_id: undefined,\r\n\t\t\t_localId: this._localId(),\r\n\t\t\t__created: false,\r\n\t\t\t__modified: false,\r\n\t\t} as Document;\r\n\t}\r\n\r\n\t/**\r\n\t * Retrieves a document by its unique ID or creates a new one if it doesn't exist.\r\n\t *\r\n\t * @param _id - The document ID to search for.\r\n\t * @returns The found document or a new document if not found.\r\n\t */\r\n\tdoc(_id: string): Document {\r\n\t\tconst doc =\r\n\t\t\tthis._docs.find(\r\n\t\t\t\t(d) =>\r\n\t\t\t\t\tthis._id(d) === _id ||\r\n\t\t\t\t\t(d._localId && d._localId === Number(_id)),\r\n\t\t\t) ||\r\n\t\t\tthis.new({\r\n\t\t\t\t_id,\r\n\t\t\t} as Document);\r\n\r\n\t\tif (\r\n\t\t\t!this._docs.find((d) => this._id(d) === _id) &&\r\n\t\t\t!this._fetchingId[_id]\r\n\t\t) {\r\n\t\t\tthis._fetchingId[_id] = true;\r\n\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis.fetch({ _id }).subscribe((_doc: Document) => {\r\n\t\t\t\t\tthis._fetchingId[_id] = false;\r\n\r\n\t\t\t\t\tif (_doc) {\r\n\t\t\t\t\t\tthis.__coreService.copy(_doc, doc);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn doc;\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the number of documents to display per page.\r\n\t *\r\n\t * @param _perPage - Number of documents per page.\r\n\t */\r\n\tsetPerPage(_perPage: number): void {\r\n\t\tthis._perPage = _perPage;\r\n\t}\r\n\r\n\t/**\r\n\t * Fetches a list of documents from the API with optional pagination.\r\n\t *\r\n\t * @param config - Optional pagination configuration.\r\n\t * @param options - Optional callback and error handling configuration.\r\n\t * @returns An observable that resolves with the list of documents.\r\n\t */\r\n\tget(\r\n\t\tconfig: GetConfig = {},\r\n\t\toptions: CrudOptions<Document> = {},\r\n\t): Observable<Document[]> {\r\n\t\tif (!this.__networkService.isOnline()) {\r\n\t\t\treturn new Observable((observer) => {\r\n\t\t\t\tthis._onOnline.push(() => {\r\n\t\t\t\t\tthis.get(config, options).subscribe(observer);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (!this._config.unauthorized && localStorage.getItem('waw_user')) {\r\n\t\t\tconst user = JSON.parse(localStorage.getItem('waw_user') as string);\r\n\r\n\t\t\tlocalStorage.setItem(this._config.name + 'waw_user_id', user._id);\r\n\t\t}\r\n\r\n\t\tconst url = `${this._url}/get${options.name || ''}`;\r\n\r\n\t\tconst params =\r\n\t\t\t(typeof config.page === 'number' || config.query ? '?' : '') +\r\n\t\t\t(config.query || '') +\r\n\t\t\t(typeof config.page === 'number'\r\n\t\t\t\t? `&skip=${this._perPage * (config.page - 1)}&limit=${this._perPage}`\r\n\t\t\t\t: '');\r\n\r\n\t\tconst obs = this.__httpService.get(`${url}${params}`);\r\n\r\n\t\tobs.subscribe({\r\n\t\t\tnext: (resp: unknown): void => {\r\n\t\t\t\tresp = resp || [];\r\n\r\n\t\t\t\tif (typeof config.page !== 'number') {\r\n\t\t\t\t\tthis.clearDocs();\r\n\t\t\t\t}\r\n\r\n\t\t\t\t(resp as Document[]).forEach((doc) => this.addDoc(doc));\r\n\r\n\t\t\t\tif (options.callback) {\r\n\t\t\t\t\toptions.callback(resp as Document[]);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (typeof config.page !== 'number') {\r\n\t\t\t\t\tthis._filterDocuments();\r\n\r\n\t\t\t\t\tthis.__emitterService.complete(\r\n\t\t\t\t\t\tthis._config.name + '_getted',\r\n\t\t\t\t\t\tthis._docs,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.__emitterService.emit(\r\n\t\t\t\t\t`${this._config.name}_get`,\r\n\t\t\t\t\tthis._docs,\r\n\t\t\t\t);\r\n\t\t\t},\r\n\t\t\terror: (err: unknown): void => {\r\n\t\t\t\tif (options.errCallback) {\r\n\t\t\t\t\toptions.errCallback(err);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t});\r\n\r\n\t\treturn obs as Observable<Document[]>;\r\n\t}\r\n\r\n\t/**\r\n\t * Sends a request to the API to create a new document.\r\n\t *\r\n\t * @param doc - The document to create.\r\n\t * @param options - Optional callback and error handling configuration.\r\n\t * @returns An observable that resolves with the created document, or emits an error if already created.\r\n\t */\r\n\tcreate(\r\n\t\tdoc: Document = {} as Document,\r\n\t\toptions: CrudOptions<Document> = {},\r\n\t): Observable<Document> {\r\n\t\tif (doc._id) {\r\n\t\t\treturn this.update(doc, options);\r\n\t\t}\r\n\r\n\t\tdoc._localId ||= this._localId();\r\n\r\n\t\tdoc.__options ||= {};\r\n\r\n\t\tdoc.__options['create'] = options;\r\n\r\n\t\tthis.addDoc(doc);\r\n\r\n\t\tthis._filterDocuments();\r\n\r\n\t\tif (!this.__networkService.isOnline()) {\r\n\t\t\treturn new Observable((observer) => {\r\n\t\t\t\tthis._onOnline.push(() => {\r\n\t\t\t\t\tthis.create(doc, options).subscribe(observer);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (doc.__creating) {\r\n\t\t\t// Emit an error observable if the document is already created\r\n\t\t\treturn new Observable<Document>((observer) => {\r\n\t\t\t\tobserver.error(\r\n\t\t\t\t\tnew Error('Document is currently already creating.'),\r\n\t\t\t\t);\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tif (this._config.appId) {\r\n\t\t\tdoc.appId = this._config.appId;\r\n\t\t}\r\n\r\n\t\tdoc.__creating = true;\r\n\r\n\t\tconst obs = this.__httpService.post(\r\n\t\t\t`${this._url}/create${options.name || ''}`,\r\n\t\t\tdoc,\r\n\t\t);\r\n\r\n\t\tobs.subscribe({\r\n\t\t\tnext: (resp: unknown) => {\r\n\t\t\t\tif (resp) {\r\n\t\t\t\t\tthis.__coreService.copy(resp, doc);\r\n\r\n\t\t\t\t\tthis.addDoc(doc);\r\n\r\n\t\t\t\t\tthis._filterDocuments();\r\n\r\n\t\t\t\t\tif (options.callback) {\r\n\t\t\t\t\t\toptions.callback(doc);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (options.alert) {\r\n\t\t\t\t\t\tthis.__alertService.show({\r\n\t\t\t\t\t\t\tunique: `${this._config.name}create`,\r\n\t\t\t\t\t\t\ttext: options.alert,\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tdoc.__creating = false;\r\n\r\n\t\t\t\t\tif (options.errCallback) {\r\n\t\t\t\t\t\toptions.errCallback(resp);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.__emitterService.emit(`${this._config.name}_create`, doc);\r\n\r\n\t\t\t\tthis.__emitterService.emit(`${this._config.name}_list`, doc);\r\n\r\n\t\t\t\tthis.__emitterService.emit(`${this._config.name}_changed`, doc);\r\n\t\t\t},\r\n\t\t\terror: (err: unknown) => {\r\n\t\t\t\tdoc.__creating = false;\r\n\r\n\t\t\t\tif (options.errCallback) options.errCallback(err);\r\n\t\t\t},\r\n\t\t});\r\n\r\n\t\treturn obs as Observable<Document>;\r\n\t}\r\n\r\n\t/**\r\n\t * Fetches a document from the API based on a query.\r\n\t *\r\n\t * @param query - The query object used to filter documents.\r\n\t * @param options - Optional callback and error handling configuration.\r\n\t * @returns An observable that resolves with the fetched document.\r\n\t */\r\n\tfetch(\r\n\t\tquery: object = {},\r\n\t\toptions: CrudOptions<Document> = {},\r\n\t): Observable<Document> {\r\n\t\tif (!this.__networkService.isOnline()) {\r\n\t\t\treturn new Observable((observer) => {\r\n\t\t\t\tthis._onOnline.push(() => {\r\n\t\t\t\t\tthis.fetch(query, options).subscribe(observer);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tconst obs = this.__httpService.post(\r\n\t\t\t`${this._url}/fetch${options.name || ''}`,\r\n\t\t\tquery,\r\n\t\t);\r\n\r\n\t\tobs.subscribe({\r\n\t\t\tnext: (doc: unknown) => {\r\n\t\t\t\tif (doc) {\r\n\t\t\t\t\tthis.addDoc(doc as Document);\r\n\r\n\t\t\t\t\tthis._filterDocuments();\r\n\r\n\t\t\t\t\tif (options.callback) options.callback(doc as Document);\r\n\r\n\t\t\t\t\tif (options.alert) {\r\n\t\t\t\t\t\tthis.__alertService.show({\r\n\t\t\t\t\t\t\tunique: `${this._config.name}create`,\r\n\t\t\t\t\t\t\ttext: options.alert,\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.__emitterService.emit(\r\n\t\t\t\t\t\t`${this._config.name}_changed`,\r\n\t\t\t\t\t\tdoc,\r\n\t\t\t\t\t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (options.errCallback) {\r\n\t\t\t\t\t\toptions.errCallback(doc as Document);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\terror: (err: unknown) => {\r\n\t\t\t\tif (options.errCallback) {\r\n\t\t\t\t\toptions.errCallback(err);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t});\r\n\r\n\t\treturn obs as Observable<Document>;\r\n\t}\r\n\r\n\t/**\r\n\t * Updates a document after a specified delay and returns an observable.\r\n\t *\r\n\t * @param doc - The document to update.\r\n\t * @param options - Optional callback and error handling configuration.\r\n\t * @returns An observable that emits the updated document.\r\n\t */\r\n\tupdateAfterWhile(\r\n\t\tdoc: Document,\r\n\t\toptions: CrudOptions<Document> = {},\r\n\t): Observable<Document> {\r\n\t\treturn new Observable<Document>((observer) => {\r\n\t\t\tthis.__coreService.afterWhile(this._id(doc), () => {\r\n\t\t\t\tthis.update(doc, options).subscribe({\r\n\t\t\t\t\tnext: (updatedDoc) => {\r\n\t\t\t\t\t\tobserver.next(updatedDoc); // Emit the updated document\r\n\t\t\t\t\t},\r\n\t\t\t\t\terror: (err) => {\r\n\t\t\t\t\t\tobserver.error(err); // Forward the error\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: () => {\r\n\t\t\t\t\t\tobserver.complete(); // Complete the observable\r\n\t\t\t\t\t},\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Updates a document in the API.\r\n\t *\r\n\t * @param doc - The document to update.\r\n\t * @param options - Optional callback and error handling configuration.\r\n\t * @returns An observable that resolves with the updated document.\r\n\t */\r\n\tupdate(\r\n\t\tdoc: Document,\r\n\t\toptions: CrudOptions<Document> = {},\r\n\t): Observable<Document> {\r\n\t\tthis._updateModified(doc, 'up' + (options.name || ''), options);\r\n\r\n\t\tif (!this.__networkService.isOnline()) {\r\n\t\t\treturn new Observable((observer) => {\r\n\t\t\t\tthis._onOnline.push(() => {\r\n\t\t\t\t\tthis.update(doc, options).subscribe(observer);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tconst obs = this.__httpService.post(\r\n\t\t\t`${this._url}/update${options.name || ''}`,\r\n\t\t\tdoc,\r\n\t\t);\r\n\r\n\t\tobs.subscribe({\r\n\t\t\tnext: (resp: unknown) => {\r\n\t\t\t\tif (resp) {\r\n\t\t\t\t\tthis._removeModified(doc, 'up' + (options.name || ''));\r\n\r\n\t\t\t\t\tconst storedDoc = this.doc(doc._id as string);\r\n\r\n\t\t\t\t\tthis.__coreService.copy(resp, storedDoc);\r\n\r\n\t\t\t\t\tthis.__coreService.copy(resp, doc);\r\n\r\n\t\t\t\t\tif (options.callback) {\r\n\t\t\t\t\t\toptions.callback(doc);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (options.alert) {\r\n\t\t\t\t\t\tthis.__alertService.show({\r\n\t\t\t\t\t\t\tunique: `${this._config.name}update`,\r\n\t\t\t\t\t\t\ttext: options.alert,\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (options.errCallback) {\r\n\t\t\t\t\t\toptions.errCallback(resp);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.__emitterService.emit(`${this._config.name}_update`, doc);\r\n\r\n\t\t\t\tthis.__emitterService.emit(`${this._config.name}_changed`, doc);\r\n\t\t\t},\r\n\t\t\terror: (err: unknown) => {\r\n\t\t\t\tif (options.errCallback) {\r\n\t\t\t\t\toptions.errCallback(err);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t});\r\n\r\n\t\treturn obs as Observable<Document>;\r\n\t}\r\n\r\n\t/**\r\n\t * Unique update a document field in the API.\r\n\t *\r\n\t * @param doc - The document to update.\r\n\t * @param options - Optional callback and error handling configuration.\r\n\t * @returns An observable that resolves with the updated document.\r\n\t */\r\n\tunique(\r\n\t\tdoc: Document,\r\n\t\toptions: CrudOptions<Document> = {},\r\n\t): Observable<Document> {\r\n\t\tthis._updateModified(doc, 'un' + (options.name || ''), options);\r\n\r\n\t\tif (!this.__networkService.isOnline()) {\r\n\t\t\treturn new Observable((observer) => {\r\n\t\t\t\tthis._onOnline.push(() => {\r\n\t\t\t\t\tthis.unique(doc, options).subscribe(observer);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tconst obs = this.__httpService.post(\r\n\t\t\t`${this._url}/unique${options.name || ''}`,\r\n\t\t\tdoc,\r\n\t\t);\r\n\r\n\t\tobs.subscribe({\r\n\t\t\tnext: (resp: unknown) => {\r\n\t\t\t\tif (resp) {\r\n\t\t\t\t\tthis._removeModified(doc, 'un' + (options.name || ''));\r\n\r\n\t\t\t\t\t(doc as any)[options.name as string] = resp;\r\n\r\n\t\t\t\t\tif (options.callback) {\r\n\t\t\t\t\t\toptions.callback(doc);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (options.alert) {\r\n\t\t\t\t\t\tthis.__alertService.show({\r\n\t\t\t\t\t\t\tunique: `${this._config.name}unique`,\r\n\t\t\t\t\t\t\ttext: options.alert,\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (options.errCallback) {\r\n\t\t\t\t\t\toptions.errCallback(resp);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.__emitterService.emit(`${this._config.name}_unique`, doc);\r\n\r\n\t\t\t\tthis.__emitterService.emit(`${this._config.name}_changed`, doc);\r\n\t\t\t},\r\n\t\t\terror: (err: unknown) => {\r\n\t\t\t\tif (options.errCallback) {\r\n\t\t\t\t\toptions.errCallback(err);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t});\r\n\r\n\t\treturn obs as Observable<Document>;\r\n\t}\r\n\r\n\t/**\r\n\t * Deletes a document from the API.\r\n\t *\r\n\t * @param doc - The document to delete.\r\n\t * @param options - Optional callback and error handling configuration.\r\n\t * @returns An observable that resolves with the deleted document.\r\n\t */\r\n\tdelete(\r\n\t\tdoc: Document,\r\n\t\toptions: CrudOptions<Document> = {},\r\n\t): Observable<Document> {\r\n\t\tdoc.__deleted = true;\r\n\r\n\t\tdoc.__options ||= {};\r\n\r\n\t\tdoc.__options['delete'] = options;\r\n\r\n\t\tthis.addDoc(doc);\r\n\r\n\t\tthis._filterDocuments();\r\n\r\n\t\tif (!this.__networkService.isOnline()) {\r\n\t\t\treturn new Observable((observer) => {\r\n\t\t\t\tthis._onOnline.push(() => {\r\n\t\t\t\t\tthis.delete(doc, options).subscribe(observer);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tconst obs = this.__httpService.post(\r\n\t\t\t`${this._url}/delete${options.name || ''}`,\r\n\t\t\tdoc,\r\n\t\t);\r\n\r\n\t\tobs.subscribe({\r\n\t\t\tnext: (resp: unknown) => {\r\n\t\t\t\tif (resp) {\r\n\t\t\t\t\tthis._docs.splice(\r\n\t\t\t\t\t\tthis._docs.findIndex(\r\n\t\t\t\t\t\t\t(d) => this._id(d) === this._id(doc),\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t\t1,\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tthis.setDocs();\r\n\r\n\t\t\t\t\tthis._filterDocuments();\r\n\r\n\t\t\t\t\tif (options.callback) {\r\n\t\t\t\t\t\toptions.callback(doc);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (options.alert) {\r\n\t\t\t\t\t\tthis.__alertService.show({\r\n\t\t\t\t\t\t\tunique: `${this._config.name}delete`,\r\n\t\t\t\t\t\t\ttext: options.alert,\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (options.errCallback) {\r\n\t\t\t\t\t\toptions.errCallback(resp);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.__emitterService.emit(`${this._config.name}_delete`, doc);\r\n\r\n\t\t\t\tthis.__emitterService.emit(`${this._config.name}_list`, doc);\r\n\r\n\t\t\t\tthis.__emitterService.emit(`${this._config.name}_changed`, doc);\r\n\t\t\t},\r\n\t\t\terror: (err: unknown) => {\r\n\t\t\t\tif (options.errCallback) {\r\n\t\t\t\t\toptions.errCallback(err);\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t});\r\n\r\n\t\treturn obs as Observable<Document>;\r\n\t}\r\n\r\n\tfilteredDocuments(\r\n\t\tstoreObjectOrArray: Record<string, Document[]> | Document[],\r\n\t\tconfig: {\r\n\t\t\tfield?: string | ((doc: Document) => string);\r\n\t\t\tvalid?: (doc: Document) => boolean;\r\n\t\t\tsort?: (a: Document, b: Document) => number;\r\n\t\t\tfiltered?: (\r\n\t\t\t\tstoreObjectOrArray: Record<string, Document[]> | Document[],\r\n\t\t\t) => void;\r\n\t\t} = {},\r\n\t) {\r\n\t\tconst callback = (): void => {\r\n\t\t\tif (Array.isArray(storeObjectOrArray)) {\r\n\t\t\t\tlet result = this._docs\r\n\t\t\t\t\t.filter((doc) => !doc.__deleted)\r\n\t\t\t\t\t.filter(config.valid ?? (() => true));\r\n\r\n\t\t\t\tstoreObjectOrArray.length = 0;\r\n\r\n\t\t\t\tif (typeof config.sort === 'function') {\r\n\t\t\t\t\tresult = result.sort(config.sort);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tstoreObjectOrArray.push(...result);\r\n\t\t\t} else {\r\n\t\t\t\tconst storeObject = storeObjectOrArray as Record<\r\n\t\t\t\t\tstring,\r\n\t\t\t\t\tDocument[]\r\n\t\t\t\t>;\r\n\r\n\t\t\t\t/* remove docs if they were removed */\r\n\t\t\t\tfor (const parentId in storeObject) {\r\n\t\t\t\t\tfor (\r\n\t\t\t\t\t\tlet i = storeObject[parentId].length - 1;\r\n\t\t\t\t\t\ti >= 0;\r\n\t\t\t\t\t\ti--\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tconst _field =\r\n\t\t\t\t\t\t\ttypeof config.field === 'function'\r\n\t\t\t\t\t\t\t\t? config.field(storeObject[parentId][i])\r\n\t\t\t\t\t\t\t\t: config.field || 'author';\r\n\t\t\t\t\t\tconst _doc: any = storeObject[parentId][i];\r\n\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t!this._docs.find((doc: any) =>\r\n\t\t\t\t\t\t\t\tArray.isArray(doc[_field])\r\n\t\t\t\t\t\t\t\t\t? doc[_field].includes(_doc[this._id(doc)])\r\n\t\t\t\t\t\t\t\t\t: doc[_field] === _doc[this._id(doc)],\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tstoreObject[parentId].splice(i, 1);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t/* add docs if they are not added */\r\n\t\t\t\tfor (const doc of this._docs) {\r\n\t\t\t\t\tif (doc.__deleted) continue;\r\n\r\n\t\t\t\t\tconst _field =\r\n\t\t\t\t\t\ttypeof config.field === 'function'\r\n\t\t\t\t\t\t\t? config.field(doc)\r\n\t\t\t\t\t\t\t: config.field || 'author';\r\n\r\n\t\t\t\t\tif (\r\n\t\t\t\t\t\ttypeof config.valid === 'function'\r\n\t\t\t\t\t\t\t? !config.valid(doc)\r\n\t\t\t\t\t\t\t: Array.isArray((doc as any)[_field])\r\n\t\t\t\t\t\t\t\t? !(doc as any)[_field]?.length\r\n\t\t\t\t\t\t\t\t: !(doc as any)[_field]\r\n\t\t\t\t\t) {\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif (typeof config.field === 'function') {\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\tconfig.field(doc) &&\r\n\t\t\t\t\t\t\t!storeObject[(doc as any)[_field]].find(\r\n\t\t\t\t\t\t\t\t(c) => c._id === doc._id,\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tstoreObject[(doc as any)[_field]].push(doc);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else if (Array.isArray((doc as any)[_field])) {\r\n\t\t\t\t\t\t(doc as any)[_field].forEach((_field: string) => {\r\n\t\t\t\t\t\t\tstoreObject[_field] = storeObject[_field] || [];\r\n\r\n\t\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t\t!storeObject[_field].find(\r\n\t\t\t\t\t\t\t\t\t(c) => c._id === doc._id,\r\n\t\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\t\tstoreObject[_field].push(doc);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tstoreObject[(doc as any)[_field]] =\r\n\t\t\t\t\t\t\tstoreObject[(doc as any)[_field]] || [];\r\n\r\n\t\t\t\t\t\tif (\r\n\t\t\t\t\t\t\t!storeObject[(doc as any)[_field]].find(\r\n\t\t\t\t\t\t\t\t(c) => c._id === doc._id,\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t) {\r\n\t\t\t\t\t\t\tstoreObject[(doc as any)[_field]].push(doc);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t/* sort the array's */\r\n\t\t\t\tif (typeof config.sort === 'function') {\r\n\t\t\t\t\tfor (const parentId in storeObject) {\r\n\t\t\t\t\t\tstoreObject[parentId].sort(config.sort);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tconfig.filtered?.(storeObjectOrArray);\r\n\t\t};\r\n\r\n\t\tthis._filteredDocumentsCallbacks.push(callback);\r\n\r\n\t\treturn callback;\r\n\t}\r\n\r\n\tprivate _fetchingId: Record<string, boolean> = {};\r\n\r\n\tprivate _onOnline: (() => void)[] = [];\r\n\r\n\tprivate _randomCount = 0;\r\n\r\n\t/**\r\n\t * Generates a unique ID for a document.\r\n\t *\r\n\t * @param doc - The document for which to generate the ID.\r\n\t * @returns The unique ID as a string.\r\n\t */\r\n\tprivate _id(doc: Document): string {\r\n\t\treturn (doc as unknown as Record<string, unknown>)[\r\n\t\t\tthis._config._id || '_id'\r\n\t\t]?.toString() as string;\r\n\t}\r\n\r\n\t/**\r\n\t * Executes all registered filter document callbacks.\r\n\t */\r\n\tprivate _filterDocuments(): void {\r\n\t\tfor (const callback of this._filteredDocumentsCallbacks) {\r\n\t\t\tcallback();\r\n\t\t}\r\n\r\n\t\tthis.__emitterService.emit(`${this._config.name}_filtered`);\r\n\t}\r\n\r\n\tprivate _updateModified(\r\n\t\tdoc: Document,\r\n\t\tid: string,\r\n\t\toptions: CrudOptions<Document>,\r\n\t) {\r\n\t\tdoc.__modified ||= [];\r\n\r\n\t\tdoc.__options ||= {};\r\n\r\n\t\tdoc.__options[id] = options;\r\n\r\n\t\tif (!doc.__modified.find((m) => m === id)) {\r\n\t\t\tdoc.__modified.push(id);\r\n\r\n\t\t\tthis.addDoc(doc);\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _removeModified(doc: Document, id: string) {\r\n\t\tdoc.__modified ||= [];\r\n\r\n\t\tif (doc.__modified.find((m) => m === id)) {\r\n\t\t\tdoc.__modified.splice(\r\n\t\t\t\tdoc.__modified.findIndex((m) => m === id),\r\n\t\t\t\t1,\r\n\t\t\t);\r\n\r\n\t\t\tthis.addDoc(doc);\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _localId() {\r\n\t\treturn Number(Date.now() + '' + this._randomCount++);\r\n\t}\r\n}\r\n","import { CommonModule } from '@angular/common';\r\nimport { Component } from '@angular/core';\r\n\r\n@Component({\r\n\tselector: 'lib-files',\r\n\ttemplateUrl: './files.component.html',\r\n\timports: [CommonModule],\r\n})\r\nexport class FilesComponent {\r\n\tfs: any;\r\n}\r\n","@for (file of fs.files; track $index) {\r\n\t<input\r\n\t\t[id]=\"file.id\"\r\n\t\ttype=\"file\"\r\n\t\tname=\"file\"\r\n\t\t(change)=\"fs.change($event, file); input.value = ''\"\r\n\t\t#input\r\n\t\t[hidden]=\"true\"\r\n\t\t[accept]=\"file.accept || (file.part && 'image/*') || ''\"\r\n\t\t[multiple]=\"(file.multiple && true) || ''\"\r\n\t/>\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { FilesComponent } from '../components/files/files.component';\r\nimport { DomComponent } from '../interfaces/dom.interface';\r\nimport { DomService } from './dom.service';\r\nimport { HttpService } from './http.service';\r\n\r\ninterface FileOptions {\r\n\tid: string;\r\n\ttype?: string;\r\n\tresize?: number | { width: number; height: number };\r\n\tmultiple?: boolean;\r\n\tmultiple_cb?: (files: { dataUrl: string; file: File }[]) => void;\r\n\tcb?: (dataUrl: string | false, file: File) => void;\r\n\tsave?: boolean;\r\n\tcomplete?: () => void;\r\n\tapi?: string;\r\n\tpart?: string;\r\n\tname?: string;\r\n\tbody?: () => object | object;\r\n\tresp?: (response: any) => void;\r\n\tappend?: (formData: FormData, files: File[]) => void;\r\n\tmultiple_files?: { dataUrl: string; file: File }[];\r\n\tmultiple_counter?: number;\r\n\turl?: string;\r\n}\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root',\r\n})\r\nexport class FileService {\r\n\tprivate added: Record<string, FileOptions> = {};\r\n\tprivate files: FileOptions[] = [];\r\n\tprivate _component: DomComponent<FilesComponent>;\r\n\r\n\tconstructor(\r\n\t\tprivate dom: DomService,\r\n\t\tprivate http: HttpService,\r\n\t) {\r\n\t\tthis._component = this.dom.appendComponent(FilesComponent, {\r\n\t\t\tfs: this,\r\n\t\t})!;\r\n\t}\r\n\r\n\t/**\r\n\t * Adds a file input configuration.\r\n\t *\r\n\t * @param opts - The file options.\r\n\t */\r\n\tadd(opts: FileOptions | string): void | (() => void) {\r\n\t\tif (typeof opts === 'string') {\r\n\t\t\topts = { id: opts };\r\n\t\t}\r\n\r\n\t\tif (!opts.id) {\r\n\t\t\tconsole.log('You have to pass ID into file object');\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\topts.type = opts.type || 'image';\r\n\r\n\t\tif (typeof opts.resize === 'number') {\r\n\t\t\topts.resize = { width: opts.resize, height: opts.resize };\r\n\t\t}\r\n\r\n\t\tif (this.added[opts.id]) {\r\n\t\t\tthis.files = this.files.filter((file) => file.id !== opts.id);\r\n\t\t}\r\n\r\n\t\tthis.files.push(opts);\r\n\t\tthis.added[opts.id] = opts;\r\n\r\n\t\tif (opts.save) {\r\n\t\t\treturn () => {\r\n\t\t\t\topts.complete?.();\r\n\t\t\t};\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Handles file input change event.\r\n\t *\r\n\t * @param event - The input change event.\r\n\t * @param info - The file options.\r\n\t */\r\n\tchange(event: Event, info: FileOptions): void {\r\n\t\tconst input = event.target as HTMLInputElement;\r\n\t\tif (!input.files) return;\r\n\r\n\t\tif (info.type === 'image') {\r\n\t\t\tif (info.multiple) {\r\n\t\t\t\tif (info.multiple_cb) {\r\n\t\t\t\t\tinfo.multiple_files = [];\r\n\t\t\t\t\tinfo.multiple_counter = input.files.length;\r\n\t\t\t\t}\r\n\t\t\t\tArray.from(input.files).forEach((file) =>\r\n\t\t\t\t\tthis.process(file, info),\r\n\t\t\t\t);\r\n\t\t\t} else {\r\n\t\t\t\tthis.process(input.files[0], info);\r\n\t\t\t}\r\n\t\t} else if (info.type === 'file') {\r\n\t\t\tif (info.multiple) {\r\n\t\t\t\tinfo.multiple_cb?.(\r\n\t\t\t\t\tArray.from(input.files).map((file) => ({\r\n\t\t\t\t\t\tdataUrl: '',\r\n\t\t\t\t\t\tfile,\r\n\t\t\t\t\t})),\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\tArray.from(input.files).forEach((file) => info.cb?.('', file));\r\n\t\t\tif (info.part || info.url) {\r\n\t\t\t\tthis.uploadFiles(info, input.files as any);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tconsole.log('Provide type `image` or `file`');\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Removes a file.\r\n\t *\r\n\t * @param part - The part of the API.\r\n\t * @param url - The URL of the file.\r\n\t * @param opts - Additional options.\r\n\t * @param cb - The callback function.\r\n\t */\r\n\tremove(\r\n\t\tpart: string,\r\n\t\turl: string,\r\n\t\topts: any = {},\r\n\t\tcb: (resp: any) => void = () => {},\r\n\t): void | (() => void) {\r\n\t\topts.url = url;\r\n\t\tif (opts.save) {\r\n\t\t\treturn () => {\r\n\t\t\t\tthis.http.post(\r\n\t\t\t\t\topts.api || `/api/${part}/file/delete`,\r\n\t\t\t\t\topts,\r\n\t\t\t\t\tcb,\r\n\t\t\t\t);\r\n\t\t\t};\r\n\t\t} else {\r\n\t\t\tthis.http.post(opts.api || `/api/${part}/file/delete`, opts, cb);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Uploads files to the server.\r\n\t *\r\n\t * @param info - The file options.\r\n\t * @param files - The files to upload.\r\n\t * @param cb - The callback function.\r\n\t */\r\n\tuploadFiles(\r\n\t\tinfo: FileOptions,\r\n\t\tfiles: File[],\r\n\t\tcb: (resp: any) => void = () => {},\r\n\t): void {\r\n\t\tconst formData = new FormData();\r\n\r\n\t\tif (info.append) {\r\n\t\t\tinfo.append(formData, files);\r\n\t\t} else {\r\n\t\t\tfiles.forEach((file, index) =>\r\n\t\t\t\tformData.append(`file[${index}]`, file),\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tconst body =\r\n\t\t\ttypeof info.body === 'function' ? info.body() : info.body || {};\r\n\t\tObject.entries(body).forEach(([key, value]) =>\r\n\t\t\tformData.append(key, value),\r\n\t\t);\r\n\r\n\t\tif (info.save) {\r\n\t\t\tinfo.complete = () => {\r\n\t\t\t\tthis.http.post(\r\n\t\t\t\t\tinfo.api ||\r\n\t\t\t\t\t\t`/api/${info.part}/file${info.name ? `/${info.name}` : ''}`,\r\n\t\t\t\t\tformData,\r\n\t\t\t\t\t(resp: any) => {\r\n\t\t\t\t\t\tinfo.resp?.(resp);\r\n\t\t\t\t\t\tcb(resp);\r\n\t\t\t\t\t},\r\n\t\t\t\t);\r\n\t\t\t};\r\n\t\t} else {\r\n\t\t\tthis.http.post(\r\n\t\t\t\tinfo.api ||\r\n\t\t\t\t\t`/api/${info.part}/file${info.name ? `/${info.name}` : ''}`,\r\n\t\t\t\tformData,\r\n\t\t\t\t(resp: any) => {\r\n\t\t\t\t\tinfo.resp?.(resp);\r\n\t\t\t\t\tcb(resp);\r\n\t\t\t\t},\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Uploads an image to the server.\r\n\t *\r\n\t * @param info - The file options.\r\n\t * @param cb - The callback function.\r\n\t */\r\n\timage(\r\n\t\tinfo: FileOptions,\r\n\t\tcb: (resp: any) => void = () => {},\r\n\t): void | (() => void) {\r\n\t\tif (info.save) {\r\n\t\t\treturn () => {\r\n\t\t\t\tthis.http.post(\r\n\t\t\t\t\tinfo.api ||\r\n\t\t\t\t\t\t`/api/${info.part}/file${info.name ? `/${info.name}` : ''}`,\r\n\t\t\t\t\tinfo,\r\n\t\t\t\t\tcb,\r\n\t\t\t\t);\r\n\t\t\t};\r\n\t\t} else {\r\n\t\t\tthis.http.post(\r\n\t\t\t\tinfo.api ||\r\n\t\t\t\t\t`/api/${info.part}/file${info.name ? `/${info.name}` : ''}`,\r\n\t\t\t\tinfo,\r\n\t\t\t\tcb,\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Updates the file information after processing.\r\n\t *\r\n\t * @param dataUrl - The data URL of the processed file.\r\n\t * @param info - The file options.\r\n\t * @param file - The file object.\r\n\t */\r\n\t// private update(dataUrl: string, info: FileOptions, file: File): void {\r\n\tprivate update(dataUrl: string, info: any, file: File): void {\r\n\t\tinfo.cb?.(dataUrl, file);\r\n\t\tif (info.multiple_cb) {\r\n\t\t\tinfo.multiple_files.push({ dataUrl, file });\r\n\t\t\tif (--info.multiple_counter === 0)\r\n\t\t\t\tinfo.multiple_cb(info.multiple_files);\r\n\t\t}\r\n\r\n\t\tif (!info.part) return;\r\n\r\n\t\tconst obj =\r\n\t\t\ttypeof info.body === 'function' ? info.body() : info.body || {};\r\n\t\tobj['dataUrl'] = dataUrl;\r\n\r\n\t\tif (info.save) {\r\n\t\t\tinfo.complete = () => {\r\n\t\t\t\tthis.http.post(\r\n\t\t\t\t\tinfo.api ||\r\n\t\t\t\t\t\t`/api/${info.part}/file${info.name ? `/${info.name}` : ''}`,\r\n\t\t\t\t\tobj,\r\n\t\t\t\t\t(resp: any) => {\r\n\t\t\t\t\t\tinfo.cb?.(resp);\r\n\t\t\t\t\t},\r\n\t\t\t\t);\r\n\t\t\t};\r\n\t\t} else {\r\n\t\t\tthis.http.post(\r\n\t\t\t\tinfo.api ||\r\n\t\t\t\t\t`/api/${info.part}/file${info.name ? `/${info.name}` : ''}`,\r\n\t\t\t\tobj,\r\n\t\t\t\t(resp: any) => {\r\n\t\t\t\t\tinfo.cb?.(resp);\r\n\t\t\t\t},\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Processes an image file for resizing.\r\n\t *\r\n\t * @param file - The file object.\r\n\t * @param info - The file options.\r\n\t */\r\n\t// private process(file: File, info: FileOptions): void {\r\n\tprocess(file: File, info: any): void {\r\n\t\tif (!file.type.startsWith('image/')) {\r\n\t\t\tinfo.cb?.(false, file);\r\n\t\t\tif (info.multiple_cb) {\r\n\t\t\t\tinfo.multiple_files.push({ dataUrl: '', file });\r\n\t\t\t\tif (--info.multiple_counter === 0)\r\n\t\t\t\t\tinfo.multiple_cb(info.multiple_files);\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (info.resize) {\r\n\t\t\tinfo.resize.width = info.resize.width || 1920;\r\n\t\t\tinfo.resize.height = info.resize.height || 1080;\r\n\t\t}\r\n\r\n\t\tconst reader = new FileReader();\r\n\t\treader.onload = (loadEvent) => {\r\n\t\t\tif (!info.resize) {\r\n\t\t\t\treturn this.update(\r\n\t\t\t\t\tloadEvent.target?.result as string,\r\n\t\t\t\t\tinfo,\r\n\t\t\t\t\tfile,\r\n\t\t\t\t);\r\n\t\t\t}\r\n\r\n\t\t\tconst canvas = document.createElement('canvas');\r\n\t\t\tconst img = document.createElement('img');\r\n\t\t\timg.onload = () => {\r\n\t\t\t\tif (\r\n\t\t\t\t\timg.width <= info.resize.width &&\r\n\t\t\t\t\timg.height <= info.resize.height\r\n\t\t\t\t) {\r\n\t\t\t\t\treturn this.update(\r\n\t\t\t\t\t\tloadEvent.target?.result as string,\r\n\t\t\t\t\t\tinfo,\r\n\t\t\t\t\t\tfile,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst infoRatio = info.resize.width / info.resize.height;\r\n\t\t\t\tconst imgRatio = img.width / img.height;\r\n\t\t\t\tlet width, height;\r\n\t\t\t\tif (imgRatio > infoRatio) {\r\n\t\t\t\t\twidth = Math.min(info.resize.width, img.width);\r\n\t\t\t\t\theight = width / imgRatio;\r\n\t\t\t\t} else {\r\n\t\t\t\t\theight = Math.min(info.resize.height, img.height);\r\n\t\t\t\t\twidth = height * imgRatio;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tcanvas.width = width;\r\n\t\t\t\tcanvas.height = height;\r\n\t\t\t\tconst context = canvas.getContext('2d');\r\n\t\t\t\tcontext?.drawImage(img, 0, 0, width, height);\r\n\t\t\t\tconst dataUrl = canvas.toDataURL('image/jpeg', 1);\r\n\t\t\t\tthis.update(dataUrl, info, file);\r\n\t\t\t};\r\n\t\t\timg.src = loadEvent.target?.result as string;\r\n\t\t};\r\n\t\treader.readAsDataURL(file);\r\n\t}\r\n\r\n\tdestroy() {\r\n\t\tthis._component.remove();\r\n\t}\r\n}\r\n","import { Signal, Type } from '@angular/core';\r\n\r\n/**\r\n * Configuration for a button rendered inside an Loader.\r\n */\r\nexport interface LoaderButton {\r\n\t/** Text displayed on the button. */\r\n\ttext: string;\r\n\t/** Optional click handler invoked when the button is pressed. */\r\n\tcallback?: () => void;\r\n}\r\n\r\n/**\r\n * Base options that can be supplied when showing an Loader.\r\n */\r\nexport interface LoaderConfig {\r\n\t/** Message text displayed to the user. */\r\n\ttext?: string;\r\n\t/** Optional action buttons displayed within the Loader. */\r\n\tbuttons?: LoaderButton[];\r\n\t/** Custom CSS class applied to the Loader container. */\r\n\tclass?: string;\r\n\t/** Identifier used to ensure only one Loader with this key exists. */\r\n\tunique?: string;\r\n\t/** Whether to show a progress bar. */\r\n\tprogress?: boolean;\r\n\t/** Milliseconds before auto dismissal. */\r\n\ttimeout?: number;\r\n\t/** Callback executed when the Loader is closed. */\r\n\tclose?: () => void;\r\n\tclosable?: boolean;\r\n}\r\n\r\nexport interface Loader extends LoaderConfig {\r\n\t/** Unique identifier for the loader instance. */\r\n\tid?: number;\r\n\t/** Signal emitting the current progress percentage. */\r\n\tprogressPercentage?: Signal<number>;\r\n\t/** Called when the loader is dismissed. */\r\n\tonClose?: () => void;\r\n\t/** Element to which the loader should be appended. */\r\n\tappend?: HTMLElement;\r\n\t/** Component used to render custom loader content. */\r\n\tcomponent?: Type<unknown>;\r\n\t[x: string]: unknown;\r\n}\r\n\r\n/**\r\n * Default values applied when an Loader is shown without specific options.\r\n */\r\nexport const DEFAULT_LOADER_CONFIG: Loader = {\r\n\ttext: '',\r\n\tclass: '',\r\n\tprogress: false,\r\n\ttimeout: 0,\r\n\tclosable: true,\r\n};\r\n","import { Inject, Injectable, Optional } from '@angular/core';\r\nimport { LoaderComponent } from '../components/loader/loader.component';\r\nimport { CONFIG_TOKEN, Config } from '../interfaces/config.interface';\r\nimport { DomComponent } from '../interfaces/dom.interface';\r\nimport {\r\n\tDEFAULT_LOADER_CONFIG,\r\n\tLoader,\r\n\tLoaderConfig,\r\n} from '../interfaces/loader.interface';\r\nimport { DomService } from './dom.service';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root',\r\n})\r\nexport class LoaderService {\r\n\tconstructor(\r\n\t\t@Inject(CONFIG_TOKEN) @Optional() config: Config,\r\n\t\tprivate _dom: DomService,\r\n\t) {\r\n\t\tthis._config = {\r\n\t\t\t...DEFAULT_LOADER_CONFIG,\r\n\t\t\t...(config?.loader || {}),\r\n\t\t};\r\n\t}\r\n\r\n\tshow(opts: Loader | string = 'Loading...'): Loader {\r\n\t\topts = {\r\n\t\t\t...this._config,\r\n\t\t\t...(typeof opts === 'object' ? opts : { text: opts }),\r\n\t\t};\r\n\r\n\t\tif (\r\n\t\t\topts.unique &&\r\n\t\t\tthis._loaders.find((m) => m.unique === opts.unique)\r\n\t\t) {\r\n\t\t\treturn this._loaders.find(\r\n\t\t\t\t(m) => m.unique === opts.unique,\r\n\t\t\t) as Loader;\r\n\t\t}\r\n\r\n\t\tthis._loaders.push(opts);\r\n\r\n\t\tlet component!: DomComponent<LoaderComponent> | undefined;\r\n\r\n\t\topts.close = () => {\r\n\t\t\tcomponent?.remove();\r\n\r\n\t\t\tcomponent = undefined;\r\n\r\n\t\t\tif (typeof opts.onClose === 'function') opts.onClose();\r\n\r\n\t\t\tthis._loaders.splice(\r\n\t\t\t\tthis._loaders.findIndex((m) => m.id === opts.id),\r\n\t\t\t\t1,\r\n\t\t\t);\r\n\t\t};\r\n\r\n\t\tif (opts.append) {\r\n\t\t\tcomponent = this._dom.appendComponent(\r\n\t\t\t\tLoaderComponent,\r\n\t\t\t\topts,\r\n\t\t\t\topts.append,\r\n\t\t\t)!;\r\n\t\t} else {\r\n\t\t\tcomponent = this._dom.appendComponent(LoaderComponent, opts)!;\r\n\t\t}\r\n\r\n\t\tif (opts.unique) {\r\n\t\t\tif (this._uniques[opts.unique]) this._uniques[opts.unique].remove();\r\n\r\n\t\t\tthis._uniques[opts.unique] = component;\r\n\t\t}\r\n\r\n\t\tthis._loaders.push(opts);\r\n\r\n\t\treturn opts;\r\n\t}\r\n\r\n\tdestroy() {\r\n\t\tfor (let i = this._loaders.length - 1; i >= 0; i--) {\r\n\t\t\tthis._loaders[i].close?.();\r\n\t\t}\r\n\t}\r\n\r\n\t/** Merged configuration applied to new alerts. */\r\n\tprivate _config: LoaderConfig;\r\n\r\n\t/** References to alerts that must remain unique by identifier. */\r\n\tprivate _uniques: Record<string, DomComponent<any>> = {};\r\n\r\n\tprivate _loaders: Loader[] = [];\r\n}\r\n","import { Inject, Injectable, Optional, Type } from '@angular/core';\r\nimport { ModalComponent } from '../components/modal/modal.component';\r\nimport { CONFIG_TOKEN, Config } from '../interfaces/config.interface';\r\nimport { DomComponent } from '../interfaces/dom.interface';\r\nimport {\r\n\tDEFAULT_MODAL_CONFIG,\r\n\tModal,\r\n\tModalConfig,\r\n} from '../interfaces/modal.interface';\r\nimport { DomService } from './dom.service';\r\n@Injectable({\r\n\tprovidedIn: 'root',\r\n})\r\nexport class ModalService {\r\n\tconstructor(\r\n\t\t@Inject(CONFIG_TOKEN) @Optional() config: Config,\r\n\t\tprivate _dom: DomService,\r\n\t) {\r\n\t\tthis._config = {\r\n\t\t\t...DEFAULT_MODAL_CONFIG,\r\n\t\t\t...(config?.modal || {}),\r\n\t\t};\r\n\t}\r\n\r\n\tshow(opts: Modal | Type<unknown>): Modal {\r\n\t\topts = this._opts(opts);\r\n\r\n\t\tif (opts.unique && this._modals.find((m) => m.unique === opts.unique)) {\r\n\t\t\treturn this._modals.find((m) => m.unique === opts.unique) as Modal;\r\n\t\t}\r\n\r\n\t\tthis._modals.push(opts);\r\n\r\n\t\topts.class ||= '';\r\n\r\n\t\topts.id ||= Math.floor(Math.random() * Date.now()) + Date.now();\r\n\r\n\t\tdocument.body.classList.add('modalOpened');\r\n\r\n\t\tlet component!: DomComponent<ModalComponent> | undefined;\r\n\r\n\t\tlet content!: DomComponent<any> | undefined;\r\n\r\n\t\topts.close = () => {\r\n\t\t\tcontent?.remove();\r\n\r\n\t\t\tcontent = undefined;\r\n\r\n\t\t\tcomponent?.remove();\r\n\r\n\t\t\tcomponent = undefined;\r\n\r\n\t\t\tif (typeof opts.onClose === 'function') opts.onClose();\r\n\r\n\t\t\tthis._modals.splice(\r\n\t\t\t\tthis._modals.findIndex((m) => m.id === opts.id),\r\n\t\t\t\t1,\r\n\t\t\t);\r\n\r\n\t\t\tif (!this._modals.length) {\r\n\t\t\t\tdocument.body.classList.remove('modalOpened');\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tif (typeof opts.timeout === 'number' && opts.timeout > 0) {\r\n\t\t\tsetTimeout(opts.close, opts.timeout);\r\n\t\t}\r\n\r\n\t\tcomponent = this._dom.appendComponent(ModalComponent, opts)!;\r\n\r\n\t\tcontent = this._dom.appendComponent(\r\n\t\t\topts.component,\r\n\t\t\topts as Partial<{ providedIn?: string | undefined }>,\r\n\t\t\tcomponent.nativeElement.children[0].children[0]\r\n\t\t\t\t.children[0] as HTMLElement,\r\n\t\t)!;\r\n\r\n\t\treturn opts;\r\n\t}\r\n\r\n\topen(opts: Modal | Type<unknown>) {\r\n\t\tthis.show(opts);\r\n\t}\r\n\r\n\tsmall(opts: Modal) {\r\n\t\topts = this._opts(opts);\r\n\r\n\t\topts.size = 'small';\r\n\r\n\t\tthis.show(opts);\r\n\t}\r\n\r\n\tmid(opts: Modal) {\r\n\t\topts = this._opts(opts);\r\n\r\n\t\topts.size = 'mid';\r\n\r\n\t\tthis.show(opts);\r\n\t}\r\n\r\n\tbig(opts: Modal) {\r\n\t\topts = this._opts(opts);\r\n\r\n\t\topts.size = 'big';\r\n\r\n\t\tthis.show(opts);\r\n\t}\r\n\r\n\tfull(opts: Modal) {\r\n\t\topts = this._opts(opts);\r\n\r\n\t\topts.size = 'full';\r\n\r\n\t\tthis.show(opts);\r\n\t}\r\n\r\n\tdestroy() {\r\n\t\tfor (let i = this._modals.length - 1; i >= 0; i--) {\r\n\t\t\tthis._modals[i].close?.();\r\n\t\t}\r\n\t}\r\n\r\n\tprivate _modals: Modal[] = [];\r\n\r\n\t/** Merged configuration applied to new alerts. */\r\n\tprivate _config: ModalConfig;\r\n\r\n\tprivate _opts(opts: Modal | Type<unknown>): Modal {\r\n\t\treturn typeof opts === 'function'\r\n\t\t\t? { ...this._config, component: opts }\r\n\t\t\t: {\r\n\t\t\t\t\t...this._config,\r\n\t\t\t\t\t...opts,\r\n\t\t\t\t\tcomponent: opts.component,\r\n\t\t\t\t};\r\n\t}\r\n}\r\n","import { Injectable } from '@angular/core';\r\n\r\n/**\r\n * RtcService handles WebRTC peer connections and local media stream setup.\r\n * It provides functionality to initialize the user's camera/microphone,\r\n * manage multiple peer connections, and handle offer/answer negotiation.\r\n */\r\n@Injectable({ providedIn: 'root' })\r\nexport class RtcService {\r\n\t/**\r\n\t * Map of peer connections, keyed by peer ID.\r\n\t */\r\n\tprivate peers = new Map<string, RTCPeerConnection>();\r\n\r\n\t/**\r\n\t * Local media stream from user's camera and microphone.\r\n\t */\r\n\tprivate localStream: MediaStream | null = null;\r\n\r\n\t/**\r\n\t * Initializes the local media stream (audio/video).\r\n\t * Requests permissions and stores the stream internally.\r\n\t */\r\n\tasync initLocalStream(): Promise<MediaStream> {\r\n\t\tif (!this.localStream) {\r\n\t\t\tthis.localStream = await navigator.mediaDevices.getUserMedia({\r\n\t\t\t\tvideo: true,\r\n\t\t\t\taudio: true,\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\treturn this.localStream;\r\n\t}\r\n\r\n\t/**\r\n\t * Creates a new RTCPeerConnection for the given ID and attaches local tracks.\r\n\t */\r\n\tasync createPeer(id: string): Promise<RTCPeerConnection> {\r\n\t\tconst peer = new RTCPeerConnection();\r\n\r\n\t\tthis.localStream\r\n\t\t\t?.getTracks()\r\n\t\t\t.forEach((track) => peer.addTrack(track, this.localStream!));\r\n\r\n\t\tthis.peers.set(id, peer);\r\n\r\n\t\treturn peer;\r\n\t}\r\n\r\n\t/**\r\n\t * Retrieves an existing peer connection by ID.\r\n\t */\r\n\tgetPeer(id: string): RTCPeerConnection | undefined {\r\n\t\treturn this.peers.get(id);\r\n\t}\r\n\r\n\t/**\r\n\t * Creates an SDP offer for the specified peer and sets it as the local description.\r\n\t */\r\n\tasync createOffer(id: string): Promise<RTCSessionDescriptionInit> {\r\n\t\tconst peer = this.peers.get(id);\r\n\r\n\t\tif (!peer) throw new Error('Peer not found');\r\n\r\n\t\tconst offer = await peer.createOffer();\r\n\r\n\t\tawait peer.setLocalDescription(offer);\r\n\r\n\t\treturn offer;\r\n\t}\r\n\r\n\t/**\r\n\t * Accepts an SDP offer, creates an answer, and sets it as the local description.\r\n\t */\r\n\tasync createAnswer(\r\n\t\tid: string,\r\n\t\toffer: RTCSessionDescriptionInit,\r\n\t): Promise<RTCSessionDescriptionInit> {\r\n\t\tconst peer = this.peers.get(id);\r\n\r\n\t\tif (!peer) throw new Error('Peer not found');\r\n\r\n\t\tawait peer.setRemoteDescription(new RTCSessionDescription(offer));\r\n\r\n\t\tconst answer = await peer.createAnswer();\r\n\r\n\t\tawait peer.setLocalDescription(answer);\r\n\r\n\t\treturn answer;\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the remote description with an SDP answer for the given peer.\r\n\t */\r\n\tasync setRemoteAnswer(id: string, answer: RTCSessionDescriptionInit) {\r\n\t\tconst peer = this.peers.get(id);\r\n\r\n\t\tif (!peer) throw new Error('Peer not found');\r\n\r\n\t\tawait peer.setRemoteDescription(new RTCSessionDescription(answer));\r\n\t}\r\n\r\n\t/**\r\n\t * Adds an ICE candidate to the specified peer connection.\r\n\t */\r\n\taddIceCandidate(id: string, candidate: RTCIceCandidateInit) {\r\n\t\tconst peer = this.peers.get(id);\r\n\r\n\t\tif (peer) peer.addIceCandidate(new RTCIceCandidate(candidate));\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the initialized local media stream.\r\n\t */\r\n\tgetLocalStream(): MediaStream | null {\r\n\t\treturn this.localStream;\r\n\t}\r\n\r\n\t/**\r\n\t * Closes a specific peer connection and removes it from the map.\r\n\t */\r\n\tclosePeer(id: string) {\r\n\t\tconst peer = this.peers.get(id);\r\n\r\n\t\tif (peer) {\r\n\t\t\tpeer.close();\r\n\r\n\t\t\tthis.peers.delete(id);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Closes all peer connections and stops the local media stream.\r\n\t */\r\n\tcloseAll() {\r\n\t\tthis.peers.forEach((peer) => peer.close());\r\n\r\n\t\tthis.peers.clear();\r\n\r\n\t\tthis.localStream?.getTracks().forEach((track) => track.stop());\r\n\r\n\t\tthis.localStream = null;\r\n\t}\r\n}\r\n","import { inject, Inject, Injectable, Optional } from '@angular/core';\r\nimport {\r\n\tConfig,\r\n\tCONFIG_TOKEN,\r\n\tDEFAULT_CONFIG,\r\n} from '../interfaces/config.interface';\r\nimport { EmitterService } from './emitter.service';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root',\r\n})\r\nexport class SocketService {\r\n\tprivate _url = '';\r\n\r\n\tprivate _io: any;\r\n\r\n\tprivate _connected = false;\r\n\r\n\tprivate _opts: any = {};\r\n\r\n\tconstructor(@Inject(CONFIG_TOKEN) @Optional() private _config: Config) {\r\n\t\tthis._config = { ...DEFAULT_CONFIG, ...(this._config || {}) };\r\n\r\n\t\tif (!this._config.io) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tconst url = new URL(window.location.origin);\r\n\r\n\t\tif (typeof this._config.socket === 'object') {\r\n\t\t\tif (this._config.socket.port) {\r\n\t\t\t\turl.port = this._config.socket.port;\r\n\t\t\t}\r\n\r\n\t\t\tif (this._config.socket.opts) {\r\n\t\t\t\tthis._opts = this._config.socket.opts;\r\n\t\t\t}\r\n\r\n\t\t\tthis._url = this._config.socket.url ?? url.origin;\r\n\t\t} else {\r\n\t\t\tthis._url = url.origin;\r\n\t\t}\r\n\r\n\t\tif (this._config.socket) {\r\n\t\t\tthis.load();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the URL for the WebSocket connection and reloads the socket.\r\n\t * @param url - The URL of the WebSocket server.\r\n\t */\r\n\tsetUrl(url: string): void {\r\n\t\tthis._url = url;\r\n\r\n\t\tif (!this._config.socket) {\r\n\t\t\tthis._config.socket = true;\r\n\t\t}\r\n\r\n\t\tthis.load();\r\n\t}\r\n\r\n\t/**\r\n\t * Loads and initializes the WebSocket connection.\r\n\t */\r\n\tprivate load(): void {\r\n\t\tif (this._config.io) {\r\n\t\t\tconst ioFunc = this._config.io.default\r\n\t\t\t\t? this._config.io.default\r\n\t\t\t\t: this._config.io;\r\n\r\n\t\t\tthis._io = ioFunc(this._url, this._opts);\r\n\r\n\t\t\tthis._io.on('connect', () => {\r\n\t\t\t\tthis._connected = true;\r\n\r\n\t\t\t\tthis._emitterService.complete('socket');\r\n\t\t\t});\r\n\r\n\t\t\tthis._io.on('disconnect', (reason: any) => {\r\n\t\t\t\tthis._connected = false;\r\n\r\n\t\t\t\tthis._emitterService.emit('socket_disconnect', reason);\r\n\r\n\t\t\t\tconsole.warn('Socket disconnected', reason);\r\n\t\t\t});\r\n\r\n\t\t\tthis._io.on('error', (err: any) => {\r\n\t\t\t\tthis._connected = false;\r\n\r\n\t\t\t\tthis._emitterService.emit('socket_error', err);\r\n\r\n\t\t\t\tconsole.warn('Socket error', err);\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Disconnects the WebSocket connection and resets the connection state.\r\n\t */\r\n\tdisconnect(): void {\r\n\t\tif (this._io) {\r\n\t\t\tthis._io.disconnect();\r\n\t\t}\r\n\r\n\t\tthis._connected = false;\r\n\t}\r\n\r\n\t/**\r\n\t * Subscribes to a WebSocket event.\r\n\t * @param to - The event to subscribe to.\r\n\t * @param cb - The callback function to execute when the event is received.\r\n\t */\r\n\ton(to: string, cb: (message: any) => void = () => {}): void {\r\n\t\tif (!this._config.socket) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!this._io) {\r\n\t\t\tconsole.warn('Socket client not loaded.');\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!this._connected) {\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis.on(to, cb);\r\n\t\t\t}, 100);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis._io.on(to, cb);\r\n\t}\r\n\r\n\t/**\r\n\t * Emits a message to a WebSocket event.\r\n\t * @param to - The event to emit the message to.\r\n\t * @param message - The message to emit.\r\n\t * @param room - Optional room to emit the message to.\r\n\t */\r\n\temit(to: string, message: any, room: any = false): void {\r\n\t\tif (!this._config.socket) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!this._io) {\r\n\t\t\tconsole.warn('Socket client not loaded.');\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (!this._connected) {\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\tthis.emit(to, message, room);\r\n\t\t\t}, 100);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tthis._io.emit(to, message, room);\r\n\t}\r\n\r\n\tprivate _emitterService = inject(EmitterService);\r\n}\r\n","import { DatePipe } from '@angular/common';\r\nimport { Injectable } from '@angular/core';\r\n\r\n@Injectable({\r\n\tprovidedIn: 'root',\r\n})\r\nexport class TimeService {\r\n\tprivate weekDays = [\r\n\t\t'Sunday',\r\n\t\t'Monday',\r\n\t\t'Tuesday',\r\n\t\t'Wednesday',\r\n\t\t'Thursday',\r\n\t\t'Friday',\r\n\t\t'Saturday',\r\n\t];\r\n\r\n\tprivate monthNames = [\r\n\t\t'January',\r\n\t\t'February',\r\n\t\t'March',\r\n\t\t'April',\r\n\t\t'May',\r\n\t\t'June',\r\n\t\t'July',\r\n\t\t'August',\r\n\t\t'September',\r\n\t\t'October',\r\n\t\t'November',\r\n\t\t'December',\r\n\t];\r\n\r\n\tconstructor(private datePipe: DatePipe) {}\r\n\r\n\t/**\r\n\t * Returns the name of the day of the week for a given date.\r\n\t *\r\n\t * @param date - The date for which to get the day of the week.\r\n\t * @param format - The format in which to return the day name. Default is 'long'.\r\n\t * @returns The name of the day of the week.\r\n\t */\r\n\tgetDayName(date: Date, format: 'short' | 'long' = 'long'): string {\r\n\t\tconst dayIndex = date.getDay();\r\n\t\treturn format === 'short'\r\n\t\t\t? this.weekDays[dayIndex].substring(0, 3)\r\n\t\t\t: this.weekDays[dayIndex];\r\n\t}\r\n\t/**\r\n\t * Returns the name of the month for a given index.\r\n\t *\r\n\t * @param monthIndex - The month index (0-11).\r\n\t * @param format - The format in which to return the month name. Default is 'long'.\r\n\t * @returns The name of the month.\r\n\t */\r\n\tgetMonthName(\r\n\t\tmonthIndex: number,\r\n\t\tformat: 'short' | 'long' = 'long',\r\n\t): string {\r\n\t\tif (\r\n\t\t\t!Number.isInteger(monthIndex) ||\r\n\t\t\tmonthIndex < 0 ||\r\n\t\t\tmonthIndex > 11\r\n\t\t) {\r\n\t\t\tthrow new RangeError(\r\n\t\t\t\t'monthIndex must be an integer between 0 and 11',\r\n\t\t\t);\r\n\t\t}\r\n\t\treturn format === 'short'\r\n\t\t\t? this.monthNames[monthIndex].substring(0, 3)\r\n\t\t\t: this.monthNames[monthIndex];\r\n\t}\r\n\r\n\t/**\r\n\t * Formats a date according to the specified format and timezone.\r\n\t *\r\n\t * @param date - The date to format.\r\n\t * @param format - The format string (see Angular DatePipe documentation for format options).\r\n\t * @param timezone - The timezone to use for formatting.\r\n\t * @returns The formatted date string.\r\n\t */\r\n\tformatDate(\r\n\t\tdate: Date,\r\n\t\tformat: string = 'mediumDate',\r\n\t\ttimezone: string = 'UTC',\r\n\t): string {\r\n\t\treturn this.datePipe.transform(date, format, timezone) || '';\r\n\t}\r\n\r\n\t/**\r\n\t * Converts a date to a different timezone.\r\n\t *\r\n\t * @param date - The date to convert.\r\n\t * @param timezone - The timezone to convert to.\r\n\t * @returns The date in the new timezone.\r\n\t */\r\n\tconvertToTimezone(date: Date, timezone: string): Date {\r\n\t\treturn new Date(date.toLocaleString('en-US', { timeZone: timezone }));\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the start of the day for a given date.\r\n\t *\r\n\t * @param date - The date for which to get the start of the day.\r\n\t * @returns The start of the day (midnight) for the given date.\r\n\t */\r\n\tstartOfDay(date: Date): Date {\r\n\t\tconst newDate = new Date(date);\r\n\t\tnewDate.setHours(0, 0, 0, 0);\r\n\t\treturn newDate;\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the end of the day for a given date.\r\n\t *\r\n\t * @param date - The date for which to get the end of the day.\r\n\t * @returns The end of the day (one millisecond before midnight) for the given date.\r\n\t */\r\n\tendOfDay(date: Date): Date {\r\n\t\tconst newDate = new Date(date);\r\n\t\tnewDate.setHours(23, 59, 59, 999);\r\n\t\treturn newDate;\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the start of the week for a given date.\r\n\t *\r\n\t * @param date - The date for which to get the start of the week.\r\n\t * @param locale - A BCP 47 language tag to determine the first day of the week. Defaults to the runtime locale.\r\n\t * @returns The start of the week adjusted for the locale.\r\n\t *\r\n\t * @example\r\n\t * const date = new Date('2024-05-15');\r\n\t * service.startOfWeek(date); // => Monday May 13 2024 00:00:00 for en-GB\r\n\t */\r\n\tstartOfWeek(date: Date, locale?: string): Date {\r\n\t\tconst newDate = this.startOfDay(date);\r\n\t\tconst dtf = new Intl.DateTimeFormat(locale);\r\n\t\tconst resolved = dtf.resolvedOptions().locale;\r\n\t\tconst region = resolved.split('-')[1]?.toUpperCase();\r\n\t\tconst sundayFirst = ['US', 'CA', 'AU', 'NZ', 'PH', 'BR'];\r\n\t\tconst firstDay = sundayFirst.includes(region) ? 0 : 1;\r\n\t\tconst day = newDate.getDay();\r\n\t\tconst diff = (day - firstDay + 7) % 7;\r\n\t\tnewDate.setDate(newDate.getDate() - diff);\r\n\t\treturn newDate;\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the end of the week for a given date.\r\n\t *\r\n\t * @param date - The date for which to get the end of the week.\r\n\t * @param locale - A BCP 47 language tag to determine the first day of the week. Defaults to the runtime locale.\r\n\t * @returns The end of the week adjusted for the locale.\r\n\t *\r\n\t * @example\r\n\t * const date = new Date('2024-05-15');\r\n\t * service.endOfWeek(date); // => Sunday May 19 2024 23:59:59.999 for en-GB\r\n\t */\r\n\tendOfWeek(date: Date, locale?: string): Date {\r\n\t\tconst start = this.startOfWeek(date, locale);\r\n\t\tconst end = this.addDays(start, 6);\r\n\t\treturn this.endOfDay(end);\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the start of the month for a given date.\r\n\t *\r\n\t * @param date - The date for which to get the start of the month.\r\n\t * @returns The start of the month.\r\n\t *\r\n\t * @example\r\n\t * const date = new Date('2024-05-15');\r\n\t * service.startOfMonth(date); // => May 1 2024 00:00:00\r\n\t */\r\n\tstartOfMonth(date: Date): Date {\r\n\t\tconst newDate = this.startOfDay(date);\r\n\t\tnewDate.setDate(1);\r\n\t\treturn newDate;\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the end of the month for a given date.\r\n\t *\r\n\t * @param date - The date for which to get the end of the month.\r\n\t * @returns The end of the month.\r\n\t *\r\n\t * @example\r\n\t * const date = new Date('2024-05-15');\r\n\t * service.endOfMonth(date); // => May 31 2024 23:59:59.999\r\n\t */\r\n\tendOfMonth(date: Date): Date {\r\n\t\tconst start = this.startOfMonth(date);\r\n\t\tconst end = new Date(start);\r\n\t\tend.setMonth(end.getMonth() + 1);\r\n\t\tend.setDate(0);\r\n\t\treturn this.endOfDay(end);\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the start of the year for a given date.\r\n\t *\r\n\t * @param date - The date for which to get the start of the year.\r\n\t * @returns The start of the year.\r\n\t *\r\n\t * @example\r\n\t * const date = new Date('2024-05-15');\r\n\t * service.startOfYear(date); // => Jan 1 2024 00:00:00\r\n\t */\r\n\tstartOfYear(date: Date): Date {\r\n\t\tconst newDate = this.startOfDay(date);\r\n\t\tnewDate.setMonth(0, 1);\r\n\t\treturn newDate;\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the end of the year for a given date.\r\n\t *\r\n\t * @param date - The date for which to get the end of the year.\r\n\t * @returns The end of the year.\r\n\t *\r\n\t * @example\r\n\t * const date = new Date('2024-05-15');\r\n\t * service.endOfYear(date); // => Dec 31 2024 23:59:59.999\r\n\t */\r\n\tendOfYear(date: Date): Date {\r\n\t\tconst end = new Date(date.getFullYear(), 11, 31);\r\n\t\treturn this.endOfDay(end);\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the number of days in a given month and year.\r\n\t *\r\n\t * @param month - The month (0-11).\r\n\t * @param year - The year.\r\n\t * @returns The number of days in the month.\r\n\t */\r\n\tgetDaysInMonth(month: number, year: number): number {\r\n\t\treturn new Date(year, month + 1, 0).getDate();\r\n\t}\r\n\r\n\t/**\r\n\t * Checks if a given year is a leap year.\r\n\t *\r\n\t * @param year - The year to check.\r\n\t * @returns True if the year is a leap year, false otherwise.\r\n\t */\r\n\tisLeapYear(year: number): boolean {\r\n\t\treturn (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\r\n\t}\r\n\r\n\t/**\r\n\t * Adds a specified number of days to a date.\r\n\t *\r\n\t * @param date - The date to which to add days.\r\n\t * @param days - The number of days to add.\r\n\t * @returns The new date with the added days.\r\n\t */\r\n\taddDays(date: Date, days: number): Date {\r\n\t\tconst newDate = new Date(date);\r\n\t\tnewDate.setDate(newDate.getDate() + days);\r\n\t\treturn newDate;\r\n\t}\r\n\r\n\t/**\r\n\t * Adds a specified number of months to a date.\r\n\t *\r\n\t * @param date - The date to which to add months.\r\n\t * @param months - The number of months to add.\r\n\t * @returns The new date with the added months.\r\n\t */\r\n\taddMonths(date: Date, months: number): Date {\r\n\t\tconst newDate = new Date(date);\r\n\t\tnewDate.setMonth(newDate.getMonth() + months);\r\n\t\treturn newDate;\r\n\t}\r\n\r\n\t/**\r\n\t * Adds a specified number of years to a date.\r\n\t *\r\n\t * @param date - The date to which to add years.\r\n\t * @param years - The number of years to add.\r\n\t * @returns The new date with the added years.\r\n\t */\r\n\taddYears(date: Date, years: number): Date {\r\n\t\tconst newDate = new Date(date);\r\n\t\tnewDate.setFullYear(newDate.getFullYear() + years);\r\n\t\treturn newDate;\r\n\t}\r\n\r\n\t/**\r\n\t * Adds a specified number of hours to a date.\r\n\t *\r\n\t * @param date - The date to which to add hours.\r\n\t * @param hours - The number of hours to add.\r\n\t * @returns The new date with the added hours.\r\n\t */\r\n\taddHours(date: Date, hours: number): Date {\r\n\t\tconst newDate = new Date(date);\r\n\t\tnewDate.setHours(newDate.getHours() + hours);\r\n\t\treturn newDate;\r\n\t}\r\n\r\n\t/**\r\n\t * Adds a specified number of minutes to a date.\r\n\t *\r\n\t * @param date - The date to which to add minutes.\r\n\t * @param minutes - The number of minutes to add.\r\n\t * @returns The new date with the added minutes.\r\n\t */\r\n\taddMinutes(date: Date, minutes: number): Date {\r\n\t\tconst newDate = new Date(date);\r\n\t\tnewDate.setMinutes(newDate.getMinutes() + minutes);\r\n\t\treturn newDate;\r\n\t}\r\n\r\n\t/**\r\n\t * Adds a specified number of seconds to a date.\r\n\t *\r\n\t * @param date - The date to which to add seconds.\r\n\t * @param seconds - The number of seconds to add.\r\n\t * @returns The new date with the added seconds.\r\n\t */\r\n\taddSeconds(date: Date, seconds: number): Date {\r\n\t\tconst newDate = new Date(date);\r\n\t\tnewDate.setSeconds(newDate.getSeconds() + seconds);\r\n\t\treturn newDate;\r\n\t}\r\n\r\n\t/**\r\n\t * Subtracts a specified number of days from a date.\r\n\t *\r\n\t * @param date - The date from which to subtract days.\r\n\t * @param days - The number of days to subtract.\r\n\t * @returns The new date with the subtracted days.\r\n\t */\r\n\tsubtractDays(date: Date, days: number): Date {\r\n\t\treturn this.addDays(date, -days);\r\n\t}\r\n\r\n\t/**\r\n\t * Subtracts a specified number of months from a date.\r\n\t *\r\n\t * @param date - The date from which to subtract months.\r\n\t * @param months - The number of months to subtract.\r\n\t * @returns The new date with the subtracted months.\r\n\t */\r\n\tsubtractMonths(date: Date, months: number): Date {\r\n\t\treturn this.addMonths(date, -months);\r\n\t}\r\n\r\n\t/**\r\n\t * Subtracts a specified number of years from a date.\r\n\t *\r\n\t * @param date - The date from which to subtract years.\r\n\t * @param years - The number of years to subtract.\r\n\t * @returns The new date with the subtracted years.\r\n\t */\r\n\tsubtractYears(date: Date, years: number): Date {\r\n\t\treturn this.addYears(date, -years);\r\n\t}\r\n\r\n\t/**\r\n\t * Subtracts a specified number of hours from a date.\r\n\t *\r\n\t * @param date - The date from which to subtract hours.\r\n\t * @param hours - The number of hours to subtract.\r\n\t * @returns The new date with the subtracted hours.\r\n\t */\r\n\tsubtractHours(date: Date, hours: number): Date {\r\n\t\treturn this.addHours(date, -hours);\r\n\t}\r\n\r\n\t/**\r\n\t * Subtracts a specified number of minutes from a date.\r\n\t *\r\n\t * @param date - The date from which to subtract minutes.\r\n\t * @param minutes - The number of minutes to subtract.\r\n\t * @returns The new date with the subtracted minutes.\r\n\t */\r\n\tsubtractMinutes(date: Date, minutes: number): Date {\r\n\t\treturn this.addMinutes(date, -minutes);\r\n\t}\r\n\r\n\t/**\r\n\t * Subtracts a specified number of seconds from a date.\r\n\t *\r\n\t * @param date - The date from which to subtract seconds.\r\n\t * @param seconds - The number of seconds to subtract.\r\n\t * @returns The new date with the subtracted seconds.\r\n\t */\r\n\tsubtractSeconds(date: Date, seconds: number): Date {\r\n\t\treturn this.addSeconds(date, -seconds);\r\n\t}\r\n\r\n\t/**\r\n\t * Calculates the difference in days between two dates.\r\n\t *\r\n\t * @param date1 - The earlier date.\r\n\t * @param date2 - The later date.\r\n\t * @returns The number of days between the two dates.\r\n\t */\r\n\tdifferenceInDays(date1: Date, date2: Date): number {\r\n\t\tconst diff = date2.getTime() - date1.getTime();\r\n\t\treturn diff / (1000 * 60 * 60 * 24);\r\n\t}\r\n\r\n\t/**\r\n\t * Calculates the difference in hours between two dates.\r\n\t *\r\n\t * @param date1 - The earlier date.\r\n\t * @param date2 - The later date.\r\n\t * @returns The number of hours between the two dates.\r\n\t */\r\n\tdifferenceInHours(date1: Date, date2: Date): number {\r\n\t\tconst diff = date2.getTime() - date1.getTime();\r\n\t\treturn diff / (1000 * 60 * 60);\r\n\t}\r\n\r\n\t/**\r\n\t * Calculates the difference in minutes between two dates.\r\n\t *\r\n\t * @param date1 - The earlier date.\r\n\t * @param date2 - The later date.\r\n\t * @returns The number of minutes between the two dates.\r\n\t */\r\n\tdifferenceInMinutes(date1: Date, date2: Date): number {\r\n\t\tconst diff = date2.getTime() - date1.getTime();\r\n\t\treturn diff / (1000 * 60);\r\n\t}\r\n\r\n\t/**\r\n\t * Checks if two dates are on the same day.\r\n\t *\r\n\t * @param date1 - The first date.\r\n\t * @param date2 - The second date.\r\n\t * @returns True if the dates are on the same day, false otherwise.\r\n\t */\r\n\tisSameDay(date1: Date, date2: Date): boolean {\r\n\t\treturn (\r\n\t\t\tdate1.getFullYear() === date2.getFullYear() &&\r\n\t\t\tdate1.getMonth() === date2.getMonth() &&\r\n\t\t\tdate1.getDate() === date2.getDate()\r\n\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the ISO week number for a given date.\r\n\t *\r\n\t * @param date - The date for which to get the week number.\r\n\t * @returns The ISO week number (1-53).\r\n\t */\r\n\tgetWeekNumber(date: Date): number {\r\n\t\tconst tempDate = new Date(date.getTime());\r\n\t\ttempDate.setHours(0, 0, 0, 0);\r\n\t\t// Set to nearest Thursday: current date + 4 - current day number, making Thursday day 4\r\n\t\ttempDate.setDate(tempDate.getDate() + 4 - (tempDate.getDay() || 7));\r\n\t\tconst yearStart = new Date(tempDate.getFullYear(), 0, 1);\r\n\t\t// Calculate full weeks to nearest Thursday\r\n\t\treturn Math.ceil(\r\n\t\t\t((tempDate.getTime() - yearStart.getTime()) / 86400000 + 1) / 7,\r\n\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * Returns the number of weeks in a month for a given month and year.\r\n\t *\r\n\t * @param month - The month (0-11).\r\n\t * @param year - The year.\r\n\t * @returns The number of weeks in the month.\r\n\t */\r\n\tgetWeeksInMonth(month: number, year: number): number {\r\n\t\tconst firstDayOfMonth = new Date(year, month, 1);\r\n\t\tconst lastDayOfMonth = new Date(year, month + 1, 0);\r\n\t\t// Get ISO week numbers for the first and last day of the month\r\n\t\tconst firstWeek = this.getWeekNumber(firstDayOfMonth);\r\n\t\tlet lastWeek = this.getWeekNumber(lastDayOfMonth);\r\n\t\t// Special case: when January 1st is in the last week of the previous year\r\n\t\tif (firstWeek > lastWeek) {\r\n\t\t\tlastWeek = this.getWeekNumber(new Date(year, 11, 31)); // Get week of the last day of the year\r\n\t\t}\r\n\t\treturn lastWeek - firstWeek + 1;\r\n\t}\r\n}\r\n","import { Injectable, WritableSignal, signal } from '@angular/core';\r\n\r\ntype Dict<T = unknown> = Record<string, T>;\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class UtilService {\r\n\t// --- CSS variables (persisted) ---\r\n\tprivate readonly _storageKey = 'css_variables';\r\n\tprivate _css: Dict<string> = {};\r\n\tprivate _cssSig = signal<Dict<string>>({});\r\n\r\n\t// --- Forms store ---\r\n\tprivate _forms = new Map<string, WritableSignal<any>>();\r\n\r\n\t// --- Global bag for design/debug ---\r\n\tvar: Dict = {};\r\n\r\n\t/**\r\n\t * Initialize service state: load persisted CSS variables from localStorage\r\n\t * and apply them to the document root. Emits the initial CSS snapshot.\r\n\t */\r\n\tconstructor() {\r\n\t\tthis._loadCss();\r\n\t\t// apply on boot\r\n\t\tfor (const k of Object.keys(this._css))\r\n\t\t\tthis._setProperty(k, this._css[k]);\r\n\t\tthis._cssSig.set({ ...this._css });\r\n\t}\r\n\r\n\t// ===== Forms Management =====\r\n\r\n\t/** Get or create a form state as a writable signal */\r\n\tformSignal<T = any>(id: string): WritableSignal<T> {\r\n\t\tlet s = this._forms.get(id);\r\n\t\tif (!s) {\r\n\t\t\ts = signal<T>({} as T);\r\n\t\t\tthis._forms.set(id, s);\r\n\t\t}\r\n\t\treturn s as WritableSignal<T>;\r\n\t}\r\n\r\n\t/** Back-compat: returns the current form object (mutable reference). Prefer formSignal(). */\r\n\tform<T = any>(id: string): T {\r\n\t\tconst s = this.formSignal<T>(id);\r\n\t\tconst v = s();\r\n\t\tif (v && typeof v === 'object') return v;\r\n\t\tconst obj = {} as T;\r\n\t\ts.set(obj);\r\n\t\treturn obj;\r\n\t}\r\n\r\n\t/**\r\n\t * Check whether a form signal has been created for the given id.\r\n\t * @param id Unique form identifier.\r\n\t * @returns True if a signal exists for the id.\r\n\t */\r\n\thasForm(id: string): boolean {\r\n\t\treturn this._forms.has(id);\r\n\t}\r\n\r\n\t/**\r\n\t * Remove form state associated with the given id.\r\n\t * @param id Unique form identifier to clear.\r\n\t */\r\n\tclearForm(id: string): void {\r\n\t\tthis._forms.delete(id);\r\n\t}\r\n\r\n\t// ===== Validation =====\r\n\r\n\t/**\r\n\t * Validate a value against a specific kind.\r\n\t * - email: RFC-light pattern check.\r\n\t * - text: typeof string.\r\n\t * - array: Array.isArray.\r\n\t * - object: non-null plain object.\r\n\t * - number: finite number.\r\n\t * - password: strength tiers (extra 0..4).\r\n\t * @param value Input to validate.\r\n\t * @param kind Validation kind.\r\n\t * @param extra Additional constraint for passwords: 0..4 increasing strength.\r\n\t * @returns True if value passes validation.\r\n\t */\r\n\tvalid(\r\n\t\tvalue: any,\r\n\t\tkind:\r\n\t\t\t| 'email'\r\n\t\t\t| 'text'\r\n\t\t\t| 'array'\r\n\t\t\t| 'object'\r\n\t\t\t| 'number'\r\n\t\t\t| 'password' = 'email',\r\n\t\textra = 0,\r\n\t): boolean {\r\n\t\tswitch (kind) {\r\n\t\t\tcase 'email':\r\n\t\t\t\treturn /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,10})+$/.test(\r\n\t\t\t\t\tvalue || '',\r\n\t\t\t\t);\r\n\t\t\tcase 'text':\r\n\t\t\t\treturn typeof value === 'string';\r\n\t\t\tcase 'array':\r\n\t\t\t\treturn Array.isArray(value);\r\n\t\t\tcase 'object':\r\n\t\t\t\treturn (\r\n\t\t\t\t\ttypeof value === 'object' &&\r\n\t\t\t\t\t!Array.isArray(value) &&\r\n\t\t\t\t\tvalue !== null\r\n\t\t\t\t);\r\n\t\t\tcase 'number':\r\n\t\t\t\treturn typeof value === 'number' && Number.isFinite(value);\r\n\t\t\tcase 'password':\r\n\t\t\t\tif (!value) return false;\r\n\t\t\t\tswitch (extra) {\r\n\t\t\t\t\tcase 1:\r\n\t\t\t\t\t\treturn /^((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9]))/.test(\r\n\t\t\t\t\t\t\tvalue,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\tcase 2:\r\n\t\t\t\t\t\treturn /^(((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{8,})/.test(\r\n\t\t\t\t\t\t\tvalue,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\tcase 3:\r\n\t\t\t\t\t\treturn /^((?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]))(?=.{8,})/.test(\r\n\t\t\t\t\t\t\tvalue,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\tcase 4:\r\n\t\t\t\t\t\treturn /^((?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[@#$%&!\\-_]))(?=.{8,})/.test(\r\n\t\t\t\t\t\t\tvalue,\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\treturn !!value;\r\n\t\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/** Password strength: 0..5 */\r\n\tlevel(value = ''): number {\r\n\t\tif (!value) return 0;\r\n\t\tlet lvl = 0;\r\n\t\tif (value.length > 8) lvl++;\r\n\t\tif (/[a-z]/.test(value)) lvl++;\r\n\t\tif (/[A-Z]/.test(value)) lvl++;\r\n\t\tif (/[0-9]/.test(value)) lvl++;\r\n\t\tif (/[`~!@#$%^&*()_\\-+=\\[\\]{};:'\",.<>/?\\\\|]/.test(value)) lvl++;\r\n\t\treturn lvl;\r\n\t}\r\n\r\n\t// ===== CSS Variables Management =====\r\n\r\n\t/** Set multiple CSS vars. opts: { local?: boolean; host?: string } */\r\n\tsetCss(\r\n\t\tvars: Dict<string>,\r\n\t\topts: { local?: boolean; host?: string } | string = {},\r\n\t): void {\r\n\t\tif (typeof opts === 'string') {\r\n\t\t\topts = opts === 'local' ? { local: true } : { host: opts };\r\n\t\t}\r\n\t\tconst { local = false, host } = opts as {\r\n\t\t\tlocal?: boolean;\r\n\t\t\thost?: string;\r\n\t\t};\r\n\t\tif (\r\n\t\t\thost &&\r\n\t\t\ttypeof window !== 'undefined' &&\r\n\t\t\twindow.location.host !== host\r\n\t\t)\r\n\t\t\treturn;\r\n\r\n\t\tfor (const k of Object.keys(vars)) {\r\n\t\t\tconst v = vars[k];\r\n\t\t\tif (local) {\r\n\t\t\t\tthis._css[k] = v;\r\n\t\t\t} else if (this._css[k]) {\r\n\t\t\t\t// keep persisted value unless explicitly local\r\n\t\t\t\tthis._setProperty(k, this._css[k]);\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tthis._setProperty(k, v);\r\n\t\t}\r\n\r\n\t\tif (local) {\r\n\t\t\tthis._saveCss();\r\n\t\t\tthis._cssSig.set({ ...this._css });\r\n\t\t}\r\n\t}\r\n\r\n\t/** Current persisted CSS vars snapshot */\r\n\tgetCss(): Dict<string> {\r\n\t\treturn { ...this._css };\r\n\t}\r\n\r\n\t/** Reactive signal with current persisted CSS vars */\r\n\tcssSignal(): WritableSignal<Dict<string>> {\r\n\t\treturn this._cssSig;\r\n\t}\r\n\r\n\t/** Remove persisted vars by key(s) and save */\r\n\tremoveCss(keys: string | string[]): void {\r\n\t\tconst list = Array.isArray(keys) ? keys : keys.split(' ');\r\n\t\tfor (const k of list) delete this._css[k];\r\n\t\tthis._saveCss();\r\n\t\tthis._cssSig.set({ ...this._css });\r\n\t}\r\n\r\n\t// ===== Generators =====\r\n\r\n\t/**\r\n\t * Generate an array of given length filled with sequential numbers (1..n),\r\n\t * random text, dates from today, or a constant value.\r\n\t * @param len Desired array length.\r\n\t * @param type 'number' | 'text' | 'date' | any other constant value to repeat.\r\n\t * @returns Generated array.\r\n\t */\r\n\tarr(len = 10, type: 'number' | 'text' | 'date' | string = 'number'): any[] {\r\n\t\tconst out: any[] = [];\r\n\t\tfor (let i = 0; i < len; i++) {\r\n\t\t\tswitch (type) {\r\n\t\t\t\tcase 'number':\r\n\t\t\t\t\tout.push(i + 1);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'text':\r\n\t\t\t\t\tout.push(this.text());\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 'date':\r\n\t\t\t\t\tout.push(new Date(Date.now() + i * 86_400_000));\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tout.push(type);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn out;\r\n\t}\r\n\r\n\t/**\r\n\t * Create a random alphanumeric string.\r\n\t * @param length Number of characters to generate.\r\n\t * @returns Random string of requested length.\r\n\t */\r\n\ttext(length = 10): string {\r\n\t\tconst chars =\r\n\t\t\t'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\r\n\t\tlet res = '';\r\n\t\tfor (let i = 0; i < length; i++)\r\n\t\t\tres += chars.charAt(Math.floor(Math.random() * chars.length));\r\n\t\treturn res;\r\n\t}\r\n\r\n\t// ===== Internals =====\r\n\r\n\t/** Persist current CSS variables to localStorage. */\r\n\tprivate _saveCss(): void {\r\n\t\ttry {\r\n\t\t\tif (typeof localStorage !== 'undefined') {\r\n\t\t\t\tlocalStorage.setItem(\r\n\t\t\t\t\tthis._storageKey,\r\n\t\t\t\t\tJSON.stringify(this._css),\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t} catch {}\r\n\t}\r\n\r\n\t/** Load CSS variables snapshot from localStorage into memory. */\r\n\tprivate _loadCss(): void {\r\n\t\ttry {\r\n\t\t\tif (typeof localStorage !== 'undefined') {\r\n\t\t\t\tconst raw = localStorage.getItem(this._storageKey);\r\n\t\t\t\tthis._css = raw ? JSON.parse(raw) : {};\r\n\t\t\t}\r\n\t\t} catch {\r\n\t\t\tthis._css = {};\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Apply a CSS variable to the :root element.\r\n\t * @param key CSS custom property name (e.g., --brand-color).\r\n\t * @param value CSS value to set.\r\n\t */\r\n\tprivate _setProperty(key: string, value: string): void {\r\n\t\ttry {\r\n\t\t\tif (typeof document !== 'undefined') {\r\n\t\t\t\tdocument.documentElement.style.setProperty(key, value);\r\n\t\t\t}\r\n\t\t} catch {}\r\n\t}\r\n}\r\n","import { DOCUMENT, inject, provideEnvironmentInitializer } from '@angular/core';\r\nimport { Config, CONFIG_TOKEN, DEFAULT_CONFIG } from '../public-api';\r\n\r\nexport const themeProvider = () => {\r\n\treturn provideEnvironmentInitializer(() => {\r\n\t\tconst doc = inject(DOCUMENT);\r\n\r\n\t\tconst config = inject<Config>(CONFIG_TOKEN);\r\n\r\n\t\tdoc?.documentElement?.style.setProperty(\r\n\t\t\t'--wacom-primary',\r\n\t\t\tconfig.theme?.primary || DEFAULT_CONFIG.theme?.primary || '',\r\n\t\t);\r\n\r\n\t\tdoc?.documentElement?.style.setProperty(\r\n\t\t\t'--wacom-secondary',\r\n\t\t\tconfig.theme?.secondary || DEFAULT_CONFIG.theme?.secondary || '',\r\n\t\t);\r\n\r\n\t\tdoc?.documentElement?.style.setProperty(\r\n\t\t\t'--wacom-info',\r\n\t\t\tconfig.theme?.info || DEFAULT_CONFIG.theme?.info || '',\r\n\t\t);\r\n\r\n\t\tdoc?.documentElement?.style.setProperty(\r\n\t\t\t'--wacom-error',\r\n\t\t\tconfig.theme?.error || DEFAULT_CONFIG.theme?.error || '',\r\n\t\t);\r\n\r\n\t\tdoc?.documentElement?.style.setProperty(\r\n\t\t\t'--wacom-success',\r\n\t\t\tconfig.theme?.success || DEFAULT_CONFIG.theme?.success || '',\r\n\t\t);\r\n\r\n\t\tdoc?.documentElement?.style.setProperty(\r\n\t\t\t'--wacom-warning',\r\n\t\t\tconfig.theme?.warning || DEFAULT_CONFIG.theme?.warning || '',\r\n\t\t);\r\n\r\n\t\tdoc?.documentElement?.style.setProperty(\r\n\t\t\t'--wacom-question',\r\n\t\t\tconfig.theme?.question || DEFAULT_CONFIG.theme?.question || '',\r\n\t\t);\r\n\t});\r\n};\r\n","import {\r\n\tprovideHttpClient,\r\n\twithInterceptorsFromDi,\r\n} from '@angular/common/http';\r\nimport { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\r\nimport {\r\n\tCONFIG_TOKEN,\r\n\tConfig,\r\n\tDEFAULT_CONFIG,\r\n} from './interfaces/config.interface';\r\nimport { themeProvider } from './theme';\r\n\r\nexport function provideWacom(\r\n\tconfig: Config = DEFAULT_CONFIG,\r\n): EnvironmentProviders {\r\n\treturn makeEnvironmentProviders([\r\n\t\t{ provide: CONFIG_TOKEN, useValue: config },\r\n\t\tprovideHttpClient(withInterceptorsFromDi()),\r\n\t\tthemeProvider(),\r\n\t]);\r\n}\r\n","/* initialize */\r\nimport { CommonModule } from '@angular/common';\r\nimport {\r\n\tprovideHttpClient,\r\n\twithInterceptorsFromDi,\r\n} from '@angular/common/http';\r\nimport { ModuleWithProviders, NgModule } from '@angular/core';\r\nimport { FormsModule } from '@angular/forms';\r\nimport {\r\n\tConfig,\r\n\tCONFIG_TOKEN,\r\n\tDEFAULT_CONFIG,\r\n} from './interfaces/config.interface';\r\n\r\n/* directives */\r\nimport { ClickOutsideDirective } from './directives/click-outside.directive';\r\nconst DIRECTIVES = [ClickOutsideDirective];\r\n\r\n/* pipes */\r\nimport { ArrPipe } from './pipes/arr.pipe';\r\nimport { MongodatePipe } from './pipes/mongodate.pipe';\r\nimport { PaginationPipe } from './pipes/pagination.pipe';\r\nimport { SafePipe } from './pipes/safe.pipe';\r\nimport { SearchPipe } from './pipes/search.pipe';\r\nimport { SplicePipe } from './pipes/splice.pipe';\r\nconst PIPES = [\r\n\tArrPipe,\r\n\tSafePipe,\r\n\tSplicePipe,\r\n\tSearchPipe,\r\n\tMongodatePipe,\r\n\tPaginationPipe,\r\n];\r\n\r\n/* components */\r\nimport { AlertComponent } from './components/alert/alert/alert.component';\r\nimport { WrapperComponent } from './components/alert/wrapper/wrapper.component';\r\nimport { FilesComponent } from './components/files/files.component';\r\nimport { LoaderComponent } from './components/loader/loader.component';\r\nimport { ModalComponent } from './components/modal/modal.component';\r\nimport { themeProvider } from './theme';\r\nconst LOCAL_COMPONENTS = [WrapperComponent, FilesComponent];\r\nconst COMPONENTS = [LoaderComponent, ModalComponent, AlertComponent];\r\n\r\n@NgModule({\r\n\timports: [\r\n\t\tCommonModule,\r\n\t\tFormsModule,\r\n\t\t...LOCAL_COMPONENTS,\r\n\t\t...PIPES,\r\n\t\t...COMPONENTS,\r\n\t\t...DIRECTIVES,\r\n\t],\r\n\texports: [...PIPES, ...COMPONENTS, ...DIRECTIVES],\r\n\tproviders: [\r\n\t\t{ provide: CONFIG_TOKEN, useValue: DEFAULT_CONFIG },\r\n\t\tprovideHttpClient(withInterceptorsFromDi()),\r\n\t],\r\n})\r\n/**\r\n * @deprecated Use provideWacom instead.\r\n */\r\nexport class WacomModule {\r\n\tstatic forRoot(\r\n\t\tconfig: Config = DEFAULT_CONFIG,\r\n\t): ModuleWithProviders<WacomModule> {\r\n\t\treturn {\r\n\t\t\tngModule: WacomModule,\r\n\t\t\tproviders: [\r\n\t\t\t\t{\r\n\t\t\t\t\tprovide: CONFIG_TOKEN,\r\n\t\t\t\t\tuseValue: config,\r\n\t\t\t\t},\r\n\t\t\t\tthemeProvider(),\r\n\t\t\t],\r\n\t\t};\r\n\t}\r\n}\r\n","/*\r\n *\tInterfaces\r\n */\r\nexport * from './src/interfaces/alert.interface';\r\nexport * from './src/interfaces/config.interface';\r\nexport * from './src/interfaces/crud.interface';\r\nexport * from './src/interfaces/modal.interface';\r\n/*\r\n *\tGuard\r\n */\r\nexport * from './src/guard/meta.guard';\r\n/*\r\n *\tComponents\r\n */\r\nexport * from './src/components/alert/alert/alert.component';\r\nexport * from './src/components/base.component';\r\nexport * from './src/components/crud.component';\r\nexport * from './src/components/loader/loader.component';\r\nexport * from './src/components/modal/modal.component';\r\n/*\r\n *\tDirectives\r\n */\r\nexport * from './src/directives/click-outside.directive';\r\n/*\r\n *\tPipes\r\n */\r\nexport * from './src/pipes/arr.pipe';\r\nexport * from './src/pipes/mongodate.pipe';\r\nexport * from './src/pipes/number.pipe';\r\nexport * from './src/pipes/pagination.pipe';\r\nexport * from './src/pipes/safe.pipe';\r\nexport * from './src/pipes/search.pipe';\r\nexport * from './src/pipes/splice.pipe';\r\nexport * from './src/pipes/split.pipe';\r\n/*\r\n *\tServices\r\n */\r\nexport * from './src/services/alert.service';\r\nexport * from './src/services/base.service';\r\nexport * from './src/services/core.service';\r\nexport * from './src/services/crud.service';\r\nexport * from './src/services/dom.service';\r\nexport * from './src/services/emitter.service';\r\nexport * from './src/services/file.service';\r\nexport * from './src/services/http.service';\r\nexport * from './src/services/loader.service';\r\nexport * from './src/services/meta.service';\r\nexport * from './src/services/modal.service';\r\nexport * from './src/services/network.service';\r\nexport * from './src/services/rtc.service';\r\nexport * from './src/services/socket.service';\r\nexport * from './src/services/store.service';\r\nexport * from './src/services/time.service';\r\nexport * from './src/services/util.service';\r\n/*\r\n *\tInitial\r\n *\r\n *\tmake different kind of modules, one which import all, other for piece by piece\r\n */\r\nexport * from './src/provide-wacom';\r\nexport * from './src/wacom.module';\r\n/*\r\n *\tEnd of Support\r\n */\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1","i1.DomService","i2.HttpService"],"mappings":";;;;;;;;;;;;;;AAEA;;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