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BAAgBtL,KAAKsI,cAKxFiD,MAHwD,QAAxD,EAAa,QAAb,EAAA5J,SAAS0J,YAAI,eAAEtG,cAAc,mCAA2B,eAAE2D,aAAa,aAAc,+BAA+B1I,KAAKsI,aAIzH0C,IAAKG,EACLK,KAAM,GAER,E","sources":["webpack://@dgtls-pub/wolf-sb-integration/./src/global/js/DomServices.ts","webpack://@dgtls-pub/wolf-sb-integration/./src/global/js/InputsServices.ts","webpack://@dgtls-pub/wolf-sb-integration/./src/global/js/ControllerBase.ts","webpack://@dgtls-pub/wolf-sb-integration/./src/global/js/Utils.ts","webpack://@dgtls-pub/wolf-sb-integration/./src/wolf/components/molecules/m-button-group/m-button-group.controller.ts"],"sourcesContent":["import { IDomServices } from 'global/interfaces/controller.interface';\nimport { Subject } from 'rxjs';\n\nexport class DomServices implements IDomServices {\n\tprotected $element: HTMLElement;\n\tprotected $references: Record;\n\tonDomElementChanged: Subject = new Subject();\n\n\tconstructor(element: HTMLElement, references: Record) {\n\t\tthis.$references = references;\n\t\tthis.$element = element;\n\t}\n\n\tstatic collectReferences(\n\t\telement: HTMLElement,\n\t\tignoredReferences: string[],\n\t\tincludedReferences: string[],\n\t): Partial> {\n\t\tconst refs: Partial> = {};\n\n\t\tArray.from(element.querySelectorAll('[data-ref]')).forEach((el: HTMLElement) => {\n\t\t\tlet referenceName: string = '';\n\t\t\tif (el.dataset.ref) {\n\t\t\t\treferenceName = el.dataset.ref;\n\t\t\t}\n\n\t\t\t// skip ignored references\n\t\t\tif (ignoredReferences.includes(referenceName)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (referenceName) {\n\t\t\t\t// if the included list has items, only include these references, otherwise consider all\n\t\t\t\tif (includedReferences.length > 0) {\n\t\t\t\t\tif (includedReferences.includes(referenceName)) {\n\t\t\t\t\t\trefs[referenceName] = el;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (Object.prototype.hasOwnProperty.call(refs, referenceName)) {\n\t\t\t\t\t\tif (window.location.hostname === 'localhost') {\n\t\t\t\t\t\t\tconsole.warn(`A reference called '${referenceName}' has already been registered in ${this.constructor.name}!\\n Element:`, element);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\trefs[referenceName] = el;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn refs;\n\t}\n\n\tgetRef(ref: string): T | undefined {\n\t\tif (this.$references) {\n\t\t\treturn Object.prototype.hasOwnProperty.call(this.$references, ref) ? (this.$references[ref] as T) : undefined;\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tparseStringToHtml = (htmlAsString: string): void | ChildNode => {\n\t\tconst parsedNode = new DOMParser().parseFromString(htmlAsString, 'text/html').body.firstChild;\n\t\tif (parsedNode) return parsedNode;\n\t};\n\n\trenderDomElement = (ref: string, html: string, renderOnParent: boolean = false): void => {\n\t\tconst refExists = this.$references ? Object.prototype.hasOwnProperty.call(this.$references, ref) : undefined;\n\t\tif (renderOnParent) {\n\t\t\tthis.$element.innerHTML = html;\n\t\t\tthis.domElementChanged(ref);\n\t\t} else if (this.$references && refExists) {\n\t\t\t(this.$references as any)[ref].innerHTML = html;\n\t\t\tthis.domElementChanged(ref);\n\t\t} else {\n\t\t\tconsole.warn('DOM ref does not exist!', ref);\n\t\t}\n\t};\n\n\tappendRawHtmlToDomElement = (\n\t\tnode: HTMLElement,\n\t\thtmlAsString: string,\n\t\tposition: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend' = 'afterend',\n\t): void | ChildNode => {\n\t\tconst htmlNode = this.parseStringToHtml(htmlAsString);\n\t\tnode.insertAdjacentElement(position, htmlNode as Element);\n\t\tif (htmlNode) {\n\t\t\treturn htmlNode;\n\t\t}\n\t};\n\n\treplaceLastChildElementWithRawHtml = (ref: string, htmlAsString: string): void | ChildNode => {\n\t\tconst refExists = this.$references ? Object.prototype.hasOwnProperty.call(this.$references, ref) : undefined;\n\t\tif (refExists) {\n\t\t\tconst htmlNode = this.parseStringToHtml(htmlAsString);\n\t\t\tconst lastNode = this.$references[ref].childNodes[this.$references[ref].childNodes.length - 1];\n\t\t\t(this.$references as any)[ref].replaceChild(htmlNode, lastNode);\n\t\t\tthis.domElementChanged(ref);\n\t\t\tif (htmlNode) {\n\t\t\t\treturn htmlNode;\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.warn('DOM ref does not exist!', ref);\n\t\t}\n\t};\n\n\ttoggleElementState(control: HTMLElement, newState: Array<'enable' | 'disable' | 'show' | 'hide' | 'check' | 'uncheck'>): void {\n\t\tif (!control) return;\n\t\tnewState &&\n\t\t\tnewState.forEach((state) => {\n\t\t\t\tswitch (state) {\n\t\t\t\t\tcase 'enable': {\n\t\t\t\t\t\tcontrol.removeAttribute('disabled');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'disable': {\n\t\t\t\t\t\tcontrol.setAttribute('disabled', 'true');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'show': {\n\t\t\t\t\t\tcontrol.removeAttribute('hidden');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'hide': {\n\t\t\t\t\t\tcontrol.setAttribute('hidden', 'true');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'uncheck': {\n\t\t\t\t\t\tcontrol.removeAttribute('checked');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase 'check': {\n\t\t\t\t\t\tcontrol.setAttribute('checked', 'true');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\tdomElementChanged = (reference: string): void => {\n\t\tthis.onDomElementChanged.next(reference);\n\t};\n\n\tparseDOMScriptTag = (elementId: string): TJSON => {\n\t\tconst data = document.getElementById(elementId) as HTMLScriptElement;\n\t\ttry {\n\t\t\tconst out = JSON.parse(data.innerText);\n\t\t\treturn out as TJSON;\n\t\t} catch (error) {\n\t\t\tconsole.warn('Cannot parse component form config', error);\n\t\t}\n\t\treturn {} as TJSON;\n\t};\n\n\trenderDomElementInHTMLElement(element: HTMLElement, html: string): void {\n\t\telement.innerHTML = html;\n\t}\n}\n","import { IInputServicesBase } from 'global/interfaces/controller.interface';\nimport { fromEvent, Subscription } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nexport enum InputClasses {\n\terrorClass = 'uk-form-danger',\n\thiddenClass = 'uk-hidden',\n}\nexport class InputServices implements IInputServicesBase {\n\tprivate observedInputs: Record = {};\n\n\taddFocusToInput({ element, inputName }: { element: HTMLElement; inputName: string }): void {\n\t\tconst input = element?.querySelector(`input[name='${inputName}']`);\n\t\tif (input) (input as HTMLInputElement).focus();\n\t}\n\n\tobserveElementEvents(\n\t\telement: HTMLInputElement | HTMLSelectElement | HTMLButtonElement,\n\t\tinputEvent: 'input' | 'change' | 'click',\n\t\tonChange: (value: string, event: InputEvent) => any,\n\t): void {\n\t\tconst inputToObserve$ = fromEvent(element, inputEvent);\n\n\t\tthis.observedInputs[element.name] = inputToObserve$.pipe(map(this.mapInputEvent)).subscribe(({ value, event }) =>\n\t\t\tthis.subscribeInputWithErrorRemovalOnInputChange({\n\t\t\t\tvalue,\n\t\t\t\tevent,\n\t\t\t\tonChange,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * This method is in charge of adding error classes to the correct element within an input group on a defined element\n\t * @param {HTMLElement | null} element - The element to update\n\t * @param {Record} errors - The errors to manage\n\t */\n\taddErrorsToFieldset({\n\t\telement,\n\t\terrors,\n\t\tonErrorsUpdated,\n\t}: {\n\t\telement: HTMLElement | null;\n\t\terrors: Record;\n\t\tonErrorsUpdated?: () => void;\n\t}): void {\n\t\tif (element) {\n\t\t\tObject.keys(errors).forEach((inputName) => {\n\t\t\t\tconst input = element?.querySelector(`input[name='${inputName}']`) as HTMLElement;\n\n\t\t\t\tif (input) {\n\t\t\t\t\tconst errorMessage = errors[inputName] || '';\n\t\t\t\t\tthis.addOrRemoveFormValidationError('SHOW_VALIDATION_ERROR', input, errorMessage);\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (onErrorsUpdated) onErrorsUpdated();\n\t\t\tif (errors) {\n\t\t\t\tconst inputNameToFocus = Object.keys(errors)[0];\n\t\t\t\tconst firstErrorElement = element?.querySelector(`input[name='${inputNameToFocus}']`);\n\t\t\t\tif (firstErrorElement) firstErrorElement.scrollIntoView();\n\t\t\t\tif (inputNameToFocus) this.addFocusToInput({ element, inputName: inputNameToFocus });\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error(`ADD ERRORS TO FIELDSET: Looks like the element you want to update doesn't exist`);\n\t\t}\n\t}\n\n\taddOrRemoveFormValidationError(showOrHide: 'SHOW_VALIDATION_ERROR' | 'HIDE_VALIDATION_ERROR', input: HTMLElement, errorMessage: string = ''): void {\n\t\tif (!input) return;\n\n\t\tconst label = input.previousElementSibling;\n\t\tconst errorMessageContainer = input.nextElementSibling;\n\n\t\tif (showOrHide === 'SHOW_VALIDATION_ERROR') {\n\t\t\t// add error class to label\n\t\t\tif (label && label.classList) label.classList.add(InputClasses.errorClass);\n\t\t\t// add error class to input\n\t\t\tinput.classList.add(InputClasses.errorClass);\n\t\t\t// if there's an error message, inject it, show the div and add an error class\n\t\t\tif (errorMessageContainer) {\n\t\t\t\terrorMessageContainer.classList.add(InputClasses.errorClass);\n\t\t\t\terrorMessageContainer.classList.remove(InputClasses.hiddenClass);\n\t\t\t\terrorMessageContainer.innerHTML = errorMessage;\n\t\t\t}\n\t\t} else if (showOrHide === 'HIDE_VALIDATION_ERROR') {\n\t\t\t// remove error class from label\n\t\t\tif (label && label.classList) label.classList.remove(InputClasses.errorClass);\n\t\t\t// remove error class from input\n\t\t\tinput.classList.remove(InputClasses.errorClass);\n\t\t\t// remove error message and class\n\t\t\tif (errorMessageContainer) {\n\t\t\t\terrorMessageContainer.classList.remove(InputClasses.errorClass);\n\t\t\t\terrorMessageContainer.classList.add(InputClasses.hiddenClass);\n\t\t\t\terrorMessageContainer.innerHTML = '';\n\t\t\t}\n\t\t}\n\t}\n\n\tsubscribeInputWithErrorRemovalOnInputChange = ({\n\t\tvalue,\n\t\tevent,\n\t\tonChange,\n\t}: {\n\t\tvalue: string;\n\t\tevent: InputEvent;\n\t\tonChange?: (value: string, event: InputEvent) => void;\n\t}): void => {\n\t\tconst castEvent = event.target as HTMLElement;\n\n\t\tconst label = castEvent && castEvent.previousElementSibling;\n\t\tif (label && label.classList.contains(InputClasses.errorClass)) label.classList.remove(InputClasses.errorClass);\n\n\t\tconst input = event.target as HTMLElement;\n\t\tif (input && input.classList.contains(InputClasses.errorClass)) input.classList.remove(InputClasses.errorClass);\n\n\t\tconst errorMessage = castEvent && castEvent.nextElementSibling;\n\t\tif (errorMessage) {\n\t\t\terrorMessage.classList.remove(InputClasses.errorClass);\n\t\t\terrorMessage.classList.add('uk-hidden');\n\t\t}\n\n\t\tif (onChange) onChange(value, event);\n\t};\n\n\tmapInputEvent = (event: InputEvent): { value: string; event: InputEvent } => {\n\t\treturn { value: (event.target as HTMLInputElement | HTMLSelectElement).value, event };\n\t};\n}\n","import { IControllerBase, IDomServices } from 'global/interfaces/controller.interface';\nimport { DomServices } from './DomServices';\nimport { InputServices } from './InputsServices';\nexport default class ControllerBase = Record> implements IControllerBase {\n\treadonly $element: HTMLElement;\n\treadonly $references: Record;\n\treadonly ignoredReferences: string[];\n\treadonly includedReferences: string[];\n\treadonly disableReferenceCollection: boolean;\n\t/** See {@link DomServices} */\n\treadonly domUtils: IDomServices;\n\t/** See {@link InputServices} */\n\treadonly inputUtils: InputServices;\n\n\tconstructor(element: HTMLElement, ignoredReferences?: string[], includedReferences?: string[], disableReferenceCollection?: boolean) {\n\t\tthis.$element = element;\n\t\tthis.ignoredReferences = ignoredReferences || [];\n\t\tthis.includedReferences = includedReferences || [];\n\t\tthis.disableReferenceCollection = disableReferenceCollection || false;\n\n\t\tif (!this.disableReferenceCollection) {\n\t\t\tconst references = DomServices.collectReferences(this.$element, this.ignoredReferences, this.includedReferences);\n\t\t\tif (references && Object.keys(references).length > 0) {\n\t\t\t\tthis.$references = references as Record;\n\t\t\t} else {\n\t\t\t\tthis.$references = {} as Record;\n\t\t\t}\n\t\t}\n\n\t\tthis.domUtils = new DomServices(this.$element, this.$references);\n\t\tthis.inputUtils = new InputServices();\n\t}\n\n\tdispatchCustomEvent(\n\t\tname: string,\n\t\tdetail: T,\n\t\tbubbles: boolean = false,\n\t\tdispatchOnWindow: boolean = false,\n\t\tdispatchOnSpecificElement?: HTMLElement,\n\t): void {\n\t\tconst customEvent = new CustomEvent(name, { detail: detail, bubbles: bubbles });\n\t\tif (true === dispatchOnWindow) {\n\t\t\twindow.dispatchEvent(customEvent);\n\t\t} else if (dispatchOnSpecificElement) {\n\t\t\tdispatchOnSpecificElement.dispatchEvent(customEvent);\n\t\t} else {\n\t\t\tthis.$element.dispatchEvent(customEvent);\n\t\t}\n\t}\n}\n","/**\n * @param {string} cookieName\n * @returns string\n */\nexport function getCookie(cookieName: string): string | null {\n\tconst re = new RegExp(cookieName + '=([^;]+)');\n\tconst value = re.exec(document.cookie);\n\treturn value !== null ? unescape(value[1]) : null;\n}\n\n/**\n * @todo Only for testing purposes!\n * @param {string} cookieName\n * @param {number=0} expiry\n * @param {string=''} cookieValue\n */\nexport function setCookie(cookieName: string, expiry: number = 0, cookieValue: string = ''): void {\n\tconst date = new Date();\n\tdate.setTime(date.getTime() + expiry * 24 * 60 * 60 * 1000);\n\tconst expires = 'expires=' + date.toUTCString();\n\n\tdocument.cookie = `${cookieName}=${cookieValue}; ${expires}; path=/`;\n}\n\n/**\n * Regular expression to check if a string only contains numbers\n * Usedul for video IDs (Vimeo's video ids are always numbers)\n * @param {string} string\n * @returns boolean\n */\nexport function containsNumbersOnly(string: string): boolean {\n\tconst pattern = new RegExp(/^[0-9]+$/);\n\treturn pattern.test(string);\n}\n\n/**\n * Returns an MediaQueryList which states whether the breakpoint matches or not\n * Executes a callback function (if given) whenever the media match changes\n * @param {String} breakpoint\n * @param {Function} callback\n * @return {MediaQueryList}\n */\nexport function matchBreakpoint(breakpoint: string = 'medium', callback: () => void): MediaQueryList {\n\tif (!['small', 'medium', 'large', 'xlarge'].includes(breakpoint)) {\n\t\tconsole.warn('matchBreakpoint(): undefined breakpoint ' + breakpoint);\n\t}\n\tconst breakpointValue = getComputedStyle(document.documentElement).getPropertyValue(`--breakpoint--${breakpoint}`);\n\tconst matchMedia = window.matchMedia(`(min-width: ${breakpointValue})`);\n\n\tif (typeof callback === 'function') {\n\t\tif (typeof matchMedia.addEventListener !== 'undefined') {\n\t\t\tmatchMedia.addEventListener('change', callback);\n\t\t} else {\n\t\t\t// IE11 and Edge legacy\n\t\t\tmatchMedia.addListener(callback);\n\t\t}\n\t}\n\n\treturn matchMedia;\n}\n","import { getCookie, setCookie } from 'global/js/Utils';\nimport ControllerBase from '../../../../global/js/ControllerBase';\n\n// interface ShareDataProps {\n// \ttitle?: string;\n// \ttext?: string;\n// \turl?: string;\n// \tfile?: any;\n// }\n\nexport default class ControllerButtonsGroup extends ControllerBase {\n\tprivate addToBasket;\n\tprivate assetSize;\n\tprivate apiUrl;\n\tprivate directDownload;\n\tprivate documentId;\n\tprivate share;\n\tprivate maxSize;\n\n\tconstructor(element: HTMLElement) {\n\t\tsuper(element);\n\t\tthis.init();\n\t}\n\n\tprivate setAdded(): void {\n\t\tthis.$element.classList.add('added-to-list');\n\t\tconst addedIcon = this.$element.querySelector('.js-other-icon')?.innerHTML || '';\n\t\tthis.addToBasket.querySelector('.a-button__icon-wrapper').innerHTML = addedIcon;\n\t\tconst buttonGroupsWithSameId = document.querySelectorAll(`.m-button-group[data-id=\"${this.documentId}\"]`);\n\t\tif (buttonGroupsWithSameId.length > 1) {\n\t\t\tfor (const group of buttonGroupsWithSameId) {\n\t\t\t\tgroup.classList.add('added-to-list');\n\t\t\t\tconst iconWrapper = group.querySelector('[data-download=\"add-to-downloadlist\"] .a-button__icon-wrapper') as HTMLElement;\n\t\t\t\tif (iconWrapper) {\n\t\t\t\t\ticonWrapper.innerHTML = addedIcon;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate init(): void {\n\t\tthis.apiUrl = this.$element.getAttribute('data-api-url');\n\t\tthis.maxSize = this.$element.getAttribute('data-max-size');\n\t\tthis.assetSize = parseInt(this.$element.getAttribute('data-size') || '0');\n\t\tconst assetDownloadList = JSON.parse(getCookie('assetDownloadList') || '[]');\n\t\tthis.documentId = this.$element.getAttribute('data-id');\n\t\tthis.addToBasket = this.$element.querySelector('[data-download=\"add-to-downloadlist\"]');\n\t\tthis.directDownload = this.$element.querySelector('[data-download=\"direct-download\"]');\n\t\tthis.share = this.$element.querySelector('[data-download=\"share\"]');\n\t\tif (this.addToBasket) this.addToBasket.addEventListener('click', () => this.addToAssetDownloadList());\n\t\tif (this.directDownload) this.directDownload.addEventListener('click', () => this.directDownloadHandler());\n\t\tif (this.share) this.share.addEventListener('click', () => this.shareHandler());\n\t\tassetDownloadList.indexOf(`\"${this.documentId}\"`) > -1 ? this.setAdded() : this.$element.classList.remove('added-to-list');\n\n\t\t// Do not show add to DownloadList Button if Download Basket is not mantained in page\n\t\tconst downloadList = document.querySelector('.o-download-list') as HTMLElement;\n\t\tif (downloadList) this.addToBasket?.classList.remove('d-none');\n\t}\n\n\t// Add to DownloadList\n\tprivate addToAssetDownloadList(): void {\n\t\tconst id = JSON.stringify(this.documentId);\n\t\tconst assetDownloadList = JSON.parse(getCookie('assetDownloadList') || '[]');\n\t\tlet basketSize = parseInt(getCookie('basketSize') || '0');\n\t\tif (assetDownloadList.indexOf(id) < 0) {\n\t\t\tbasketSize = basketSize + parseInt(this.assetSize);\n\t\t\tif (basketSize > parseInt(this.maxSize)) {\n\t\t\t\tconst errorMessage = document.querySelector('[data-show-message]') as HTMLElement;\n\t\t\t\tif (errorMessage) errorMessage.setAttribute('data-show-message', 'true');\n\t\t\t\telse alert('Max size reached...');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tassetDownloadList.push(id);\n\t\t\tsetCookie('basketSize', 1, `${basketSize}`);\n\t\t\tsetCookie('lastSize', 1, `${this.assetSize}`);\n\t\t\tsetCookie('assetDownloadList', 1, JSON.stringify(assetDownloadList));\n\t\t}\n\t\tthis.setAdded();\n\t}\n\n\t// Direct Download\n\tprivate async directDownloadHandler() {\n\t\tlet href = this.apiUrl;\n\t\tlet options = {};\n\t\tconst id = this.documentId;\n\t\tthis.$element.classList.add('downloaded-already');\n\t\tif (this.apiUrl) {\n\t\t\toptions = {\n\t\t\t\theaders: {\n\t\t\t\t\t'Content-Type': 'application/json',\n\t\t\t\t},\n\t\t\t\tmethod: 'POST',\n\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\taction: 'get-token',\n\t\t\t\t\tdocumentIds: [id],\n\t\t\t\t}),\n\t\t\t};\n\t\t} else {\n\t\t\thref = '/downloadAll.json';\n\t\t}\n\t\tawait fetch(href, options)\n\t\t\t.then((response) => response.json())\n\t\t\t.then((response) => {\n\t\t\t\tif (response.data?.['download-token']?.length) {\n\t\t\t\t\tconst token = response.data['download-token'];\n\t\t\t\t\tconst downloadUrl = `/download-assets-zipstream/${token}`;\n\t\t\t\t\tconst a = document.createElement('a');\n\t\t\t\t\ta.setAttribute('download', '');\n\t\t\t\t\ta.setAttribute('href', downloadUrl);\n\t\t\t\t\ta.click();\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch((err) => console.error(err));\n\t}\n\n\t// Share URL\n\tprivate shareHandler() {\n\t\tconst windowNavigator = window.navigator;\n\n\t\t// SHARING OLD FASHION WAY == copy to clipboard\n\t\t// const windowUrl = window.location.href;\n\t\t// if (windowUrl !== undefined) {\n\t\t// \talert('Successfully copied to clipboard!');\n\t\t// \twindowNavigator.clipboard.writeText(windowUrl);\n\t\t// }\n\n\t\t// SHARING DOCUMENT OBJECT WITH BROWSER SHARING API ===============\n\t\tconst shareData = this.assetFetchHandler();\n\t\tif (shareData === undefined || shareData === null) {\n\t\t\treturn;\n\t\t} else {\n\t\t\tif (windowNavigator && windowNavigator.share) {\n\t\t\t\twindowNavigator\n\t\t\t\t\t.share(shareData)\n\t\t\t\t\t.then(() => console.info('Successful share'))\n\t\t\t\t\t.catch((error) => console.error('Error sharing', error));\n\t\t\t} else {\n\t\t\t\tif (shareData?.url !== undefined) {\n\t\t\t\t\talert('Successfully copied to clipboard!');\n\t\t\t\t\twindowNavigator.clipboard.writeText(shareData?.url);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t//Browser API share function with Options, for moment not used!\n\tprivate assetFetchHandler() {\n\t\t// const sendRequest = async () => {}\n\t\tconst windowUrl = window.location.href || undefined;\n\t\tconst title = document.head?.querySelector('title')?.textContent || `Share asset: ${this.documentId}!`;\n\t\tconst text =\n\t\t\tdocument.head?.querySelector('meta[name=\"description\"]')?.getAttribute('content') || `Download asset with assetId:${this.documentId}`;\n\t\treturn {\n\t\t\ttitle,\n\t\t\ttext,\n\t\t\turl: windowUrl,\n\t\t\tfile: [],\n\t\t};\n\t}\n}\n"],"names":["DomServices","constructor","element","references","onDomElementChanged","Subject","parseStringToHtml","htmlAsString","parsedNode","DOMParser","parseFromString","body","firstChild","renderDomElement","ref","html","renderOnParent","refExists","this","$references","Object","prototype","hasOwnProperty","call","undefined","$element","innerHTML","domElementChanged","console","warn","appendRawHtmlToDomElement","node","position","htmlNode","insertAdjacentElement","replaceLastChildElementWithRawHtml","lastNode","childNodes","length","replaceChild","reference","next","parseDOMScriptTag","elementId","data","document","getElementById","JSON","parse","innerText","error","collectReferences","ignoredReferences","includedReferences","refs","Array","from","querySelectorAll","forEach","el","referenceName","dataset","includes","window","location","hostname","name","getRef","toggleElementState","control","newState","state","removeAttribute","setAttribute","renderDomElementInHTMLElement","InputClasses","InputServices","observedInputs","subscribeInputWithErrorRemovalOnInputChange","value","event","onChange","castEvent","target","label","previousElementSibling","classList","contains","errorClass","remove","input","errorMessage","nextElementSibling","add","mapInputEvent","addFocusToInput","inputName","querySelector","focus","observeElementEvents","inputEvent","inputToObserve$","fromEvent","pipe","map","subscribe","addErrorsToFieldset","errors","onErrorsUpdated","Error","keys","addOrRemoveFormValidationError","inputNameToFocus","firstErrorElement","scrollIntoView","showOrHide","errorMessageContainer","hiddenClass","ControllerBase","disableReferenceCollection","domUtils","inputUtils","dispatchCustomEvent","detail","bubbles","dispatchOnWindow","dispatchOnSpecificElement","customEvent","CustomEvent","dispatchEvent","getCookie","cookieName","RegExp","exec","cookie","unescape","setCookie","expiry","cookieValue","date","Date","setTime","getTime","expires","toUTCString","ControllerButtonsGroup","super","init","setAdded","addedIcon","addToBasket","buttonGroupsWithSameId","documentId","group","iconWrapper","apiUrl","getAttribute","maxSize","assetSize","parseInt","assetDownloadList","directDownload","share","addEventListener","addToAssetDownloadList","directDownloadHandler","shareHandler","indexOf","id","stringify","basketSize","alert","push","href","options","headers","method","action","documentIds","fetch","then","response","json","downloadUrl","a","createElement","click","catch","err","windowNavigator","navigator","shareData","assetFetchHandler","info","url","clipboard","writeText","windowUrl","title","head","textContent","text","file"],"sourceRoot":""}