('service', 'Service', errors);\r\n *\r\n * ...\r\n * throw error.create(Err.GENERIC);\r\n * ...\r\n * throw error.create(Err.FILE_NOT_FOUND, {'file': fileName});\r\n * ...\r\n * // Service: Could not file file: foo.txt (service/file-not-found).\r\n *\r\n * catch (e) {\r\n * assert(e.message === \"Could not find file: foo.txt.\");\r\n * if ((e as FirebaseError)?.code === 'service/file-not-found') {\r\n * console.log(\"Could not read file: \" + e['file']);\r\n * }\r\n * }\r\n */\nconst ERROR_NAME = 'FirebaseError';\n// Based on code from:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Custom_Error_Types\nclass FirebaseError extends Error {\n constructor( /** The error code for this error. */\n code, message, /** Custom data for this error. */\n customData) {\n super(message);\n this.code = code;\n this.customData = customData;\n /** The custom name for all FirebaseErrors. */\n this.name = ERROR_NAME;\n // Fix For ES5\n // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work\n Object.setPrototypeOf(this, FirebaseError.prototype);\n // Maintains proper stack trace for where our error was thrown.\n // Only available on V8.\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, ErrorFactory.prototype.create);\n }\n }\n}\nclass ErrorFactory {\n constructor(service, serviceName, errors) {\n this.service = service;\n this.serviceName = serviceName;\n this.errors = errors;\n }\n create(code, ...data) {\n const customData = data[0] || {};\n const fullCode = `${this.service}/${code}`;\n const template = this.errors[code];\n const message = template ? replaceTemplate(template, customData) : 'Error';\n // Service Name: Error message (service/code).\n const fullMessage = `${this.serviceName}: ${message} (${fullCode}).`;\n const error = new FirebaseError(fullCode, fullMessage, customData);\n return error;\n }\n}\nfunction replaceTemplate(template, data) {\n return template.replace(PATTERN, (_, key) => {\n const value = data[key];\n return value != null ? String(value) : `<${key}?>`;\n });\n}\nconst PATTERN = /\\{\\$([^}]+)}/g;\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Evaluates a JSON string into a javascript object.\r\n *\r\n * @param {string} str A string containing JSON.\r\n * @return {*} The javascript object representing the specified JSON.\r\n */\nfunction jsonEval(str) {\n return JSON.parse(str);\n}\n/**\r\n * Returns JSON representing a javascript object.\r\n * @param {*} data Javascript object to be stringified.\r\n * @return {string} The JSON contents of the object.\r\n */\nfunction stringify(data) {\n return JSON.stringify(data);\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Decodes a Firebase auth. token into constituent parts.\r\n *\r\n * Notes:\r\n * - May return with invalid / incomplete claims if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\nconst decode = function (token) {\n let header = {},\n claims = {},\n data = {},\n signature = '';\n try {\n const parts = token.split('.');\n header = jsonEval(base64Decode(parts[0]) || '');\n claims = jsonEval(base64Decode(parts[1]) || '');\n signature = parts[2];\n data = claims['d'] || {};\n delete claims['d'];\n } catch (e) {}\n return {\n header,\n claims,\n data,\n signature\n };\n};\n/**\r\n * Decodes a Firebase auth. token and checks the validity of its time-based claims. Will return true if the\r\n * token is within the time window authorized by the 'nbf' (not-before) and 'iat' (issued-at) claims.\r\n *\r\n * Notes:\r\n * - May return a false negative if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\nconst isValidTimestamp = function (token) {\n const claims = decode(token).claims;\n const now = Math.floor(new Date().getTime() / 1000);\n let validSince = 0,\n validUntil = 0;\n if (typeof claims === 'object') {\n if (claims.hasOwnProperty('nbf')) {\n validSince = claims['nbf'];\n } else if (claims.hasOwnProperty('iat')) {\n validSince = claims['iat'];\n }\n if (claims.hasOwnProperty('exp')) {\n validUntil = claims['exp'];\n } else {\n // token will expire after 24h by default\n validUntil = validSince + 86400;\n }\n }\n return !!now && !!validSince && !!validUntil && now >= validSince && now <= validUntil;\n};\n/**\r\n * Decodes a Firebase auth. token and returns its issued at time if valid, null otherwise.\r\n *\r\n * Notes:\r\n * - May return null if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\nconst issuedAtTime = function (token) {\n const claims = decode(token).claims;\n if (typeof claims === 'object' && claims.hasOwnProperty('iat')) {\n return claims['iat'];\n }\n return null;\n};\n/**\r\n * Decodes a Firebase auth. token and checks the validity of its format. Expects a valid issued-at time.\r\n *\r\n * Notes:\r\n * - May return a false negative if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\nconst isValidFormat = function (token) {\n const decoded = decode(token),\n claims = decoded.claims;\n return !!claims && typeof claims === 'object' && claims.hasOwnProperty('iat');\n};\n/**\r\n * Attempts to peer into an auth token and determine if it's an admin auth token by looking at the claims portion.\r\n *\r\n * Notes:\r\n * - May return a false negative if there's no native base64 decoding support.\r\n * - Doesn't check if the token is actually valid.\r\n */\nconst isAdmin = function (token) {\n const claims = decode(token).claims;\n return typeof claims === 'object' && claims['admin'] === true;\n};\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction contains(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\nfunction safeGet(obj, key) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n return obj[key];\n } else {\n return undefined;\n }\n}\nfunction isEmpty(obj) {\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n return false;\n }\n }\n return true;\n}\nfunction map(obj, fn, contextObj) {\n const res = {};\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n res[key] = fn.call(contextObj, obj[key], key, obj);\n }\n }\n return res;\n}\n/**\r\n * Deep equal two objects. Support Arrays and Objects.\r\n */\nfunction deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n for (const k of aKeys) {\n if (!bKeys.includes(k)) {\n return false;\n }\n const aProp = a[k];\n const bProp = b[k];\n if (isObject(aProp) && isObject(bProp)) {\n if (!deepEqual(aProp, bProp)) {\n return false;\n }\n } else if (aProp !== bProp) {\n return false;\n }\n }\n for (const k of bKeys) {\n if (!aKeys.includes(k)) {\n return false;\n }\n }\n return true;\n}\nfunction isObject(thing) {\n return thing !== null && typeof thing === 'object';\n}\n\n/**\r\n * @license\r\n * Copyright 2022 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Rejects if the given promise doesn't resolve in timeInMS milliseconds.\r\n * @internal\r\n */\nfunction promiseWithTimeout(promise, timeInMS = 2000) {\n const deferredPromise = new Deferred();\n setTimeout(() => deferredPromise.reject('timeout!'), timeInMS);\n promise.then(deferredPromise.resolve, deferredPromise.reject);\n return deferredPromise.promise;\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Returns a querystring-formatted string (e.g. &arg=val&arg2=val2) from a\r\n * params object (e.g. {arg: 'val', arg2: 'val2'})\r\n * Note: You must prepend it with ? when adding it to a URL.\r\n */\nfunction querystring(querystringParams) {\n const params = [];\n for (const [key, value] of Object.entries(querystringParams)) {\n if (Array.isArray(value)) {\n value.forEach(arrayVal => {\n params.push(encodeURIComponent(key) + '=' + encodeURIComponent(arrayVal));\n });\n } else {\n params.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));\n }\n }\n return params.length ? '&' + params.join('&') : '';\n}\n/**\r\n * Decodes a querystring (e.g. ?arg=val&arg2=val2) into a params object\r\n * (e.g. {arg: 'val', arg2: 'val2'})\r\n */\nfunction querystringDecode(querystring) {\n const obj = {};\n const tokens = querystring.replace(/^\\?/, '').split('&');\n tokens.forEach(token => {\n if (token) {\n const [key, value] = token.split('=');\n obj[decodeURIComponent(key)] = decodeURIComponent(value);\n }\n });\n return obj;\n}\n/**\r\n * Extract the query string part of a URL, including the leading question mark (if present).\r\n */\nfunction extractQuerystring(url) {\n const queryStart = url.indexOf('?');\n if (!queryStart) {\n return '';\n }\n const fragmentStart = url.indexOf('#', queryStart);\n return url.substring(queryStart, fragmentStart > 0 ? fragmentStart : undefined);\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * @fileoverview SHA-1 cryptographic hash.\r\n * Variable names follow the notation in FIPS PUB 180-3:\r\n * http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf.\r\n *\r\n * Usage:\r\n * var sha1 = new sha1();\r\n * sha1.update(bytes);\r\n * var hash = sha1.digest();\r\n *\r\n * Performance:\r\n * Chrome 23: ~400 Mbit/s\r\n * Firefox 16: ~250 Mbit/s\r\n *\r\n */\n/**\r\n * SHA-1 cryptographic hash constructor.\r\n *\r\n * The properties declared here are discussed in the above algorithm document.\r\n * @constructor\r\n * @final\r\n * @struct\r\n */\nclass Sha1 {\n constructor() {\n /**\r\n * Holds the previous values of accumulated variables a-e in the compress_\r\n * function.\r\n * @private\r\n */\n this.chain_ = [];\n /**\r\n * A buffer holding the partially computed hash result.\r\n * @private\r\n */\n this.buf_ = [];\n /**\r\n * An array of 80 bytes, each a part of the message to be hashed. Referred to\r\n * as the message schedule in the docs.\r\n * @private\r\n */\n this.W_ = [];\n /**\r\n * Contains data needed to pad messages less than 64 bytes.\r\n * @private\r\n */\n this.pad_ = [];\n /**\r\n * @private {number}\r\n */\n this.inbuf_ = 0;\n /**\r\n * @private {number}\r\n */\n this.total_ = 0;\n this.blockSize = 512 / 8;\n this.pad_[0] = 128;\n for (let i = 1; i < this.blockSize; ++i) {\n this.pad_[i] = 0;\n }\n this.reset();\n }\n reset() {\n this.chain_[0] = 0x67452301;\n this.chain_[1] = 0xefcdab89;\n this.chain_[2] = 0x98badcfe;\n this.chain_[3] = 0x10325476;\n this.chain_[4] = 0xc3d2e1f0;\n this.inbuf_ = 0;\n this.total_ = 0;\n }\n /**\r\n * Internal compress helper function.\r\n * @param buf Block to compress.\r\n * @param offset Offset of the block in the buffer.\r\n * @private\r\n */\n compress_(buf, offset) {\n if (!offset) {\n offset = 0;\n }\n const W = this.W_;\n // get 16 big endian words\n if (typeof buf === 'string') {\n for (let i = 0; i < 16; i++) {\n // TODO(user): [bug 8140122] Recent versions of Safari for Mac OS and iOS\n // have a bug that turns the post-increment ++ operator into pre-increment\n // during JIT compilation. We have code that depends heavily on SHA-1 for\n // correctness and which is affected by this bug, so I've removed all uses\n // of post-increment ++ in which the result value is used. We can revert\n // this change once the Safari bug\n // (https://bugs.webkit.org/show_bug.cgi?id=109036) has been fixed and\n // most clients have been updated.\n W[i] = buf.charCodeAt(offset) << 24 | buf.charCodeAt(offset + 1) << 16 | buf.charCodeAt(offset + 2) << 8 | buf.charCodeAt(offset + 3);\n offset += 4;\n }\n } else {\n for (let i = 0; i < 16; i++) {\n W[i] = buf[offset] << 24 | buf[offset + 1] << 16 | buf[offset + 2] << 8 | buf[offset + 3];\n offset += 4;\n }\n }\n // expand to 80 words\n for (let i = 16; i < 80; i++) {\n const t = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];\n W[i] = (t << 1 | t >>> 31) & 0xffffffff;\n }\n let a = this.chain_[0];\n let b = this.chain_[1];\n let c = this.chain_[2];\n let d = this.chain_[3];\n let e = this.chain_[4];\n let f, k;\n // TODO(user): Try to unroll this loop to speed up the computation.\n for (let i = 0; i < 80; i++) {\n if (i < 40) {\n if (i < 20) {\n f = d ^ b & (c ^ d);\n k = 0x5a827999;\n } else {\n f = b ^ c ^ d;\n k = 0x6ed9eba1;\n }\n } else {\n if (i < 60) {\n f = b & c | d & (b | c);\n k = 0x8f1bbcdc;\n } else {\n f = b ^ c ^ d;\n k = 0xca62c1d6;\n }\n }\n const t = (a << 5 | a >>> 27) + f + e + k + W[i] & 0xffffffff;\n e = d;\n d = c;\n c = (b << 30 | b >>> 2) & 0xffffffff;\n b = a;\n a = t;\n }\n this.chain_[0] = this.chain_[0] + a & 0xffffffff;\n this.chain_[1] = this.chain_[1] + b & 0xffffffff;\n this.chain_[2] = this.chain_[2] + c & 0xffffffff;\n this.chain_[3] = this.chain_[3] + d & 0xffffffff;\n this.chain_[4] = this.chain_[4] + e & 0xffffffff;\n }\n update(bytes, length) {\n // TODO(johnlenz): tighten the function signature and remove this check\n if (bytes == null) {\n return;\n }\n if (length === undefined) {\n length = bytes.length;\n }\n const lengthMinusBlock = length - this.blockSize;\n let n = 0;\n // Using local instead of member variables gives ~5% speedup on Firefox 16.\n const buf = this.buf_;\n let inbuf = this.inbuf_;\n // The outer while loop should execute at most twice.\n while (n < length) {\n // When we have no data in the block to top up, we can directly process the\n // input buffer (assuming it contains sufficient data). This gives ~25%\n // speedup on Chrome 23 and ~15% speedup on Firefox 16, but requires that\n // the data is provided in large chunks (or in multiples of 64 bytes).\n if (inbuf === 0) {\n while (n <= lengthMinusBlock) {\n this.compress_(bytes, n);\n n += this.blockSize;\n }\n }\n if (typeof bytes === 'string') {\n while (n < length) {\n buf[inbuf] = bytes.charCodeAt(n);\n ++inbuf;\n ++n;\n if (inbuf === this.blockSize) {\n this.compress_(buf);\n inbuf = 0;\n // Jump to the outer loop so we use the full-block optimization.\n break;\n }\n }\n } else {\n while (n < length) {\n buf[inbuf] = bytes[n];\n ++inbuf;\n ++n;\n if (inbuf === this.blockSize) {\n this.compress_(buf);\n inbuf = 0;\n // Jump to the outer loop so we use the full-block optimization.\n break;\n }\n }\n }\n }\n this.inbuf_ = inbuf;\n this.total_ += length;\n }\n /** @override */\n digest() {\n const digest = [];\n let totalBits = this.total_ * 8;\n // Add pad 0x80 0x00*.\n if (this.inbuf_ < 56) {\n this.update(this.pad_, 56 - this.inbuf_);\n } else {\n this.update(this.pad_, this.blockSize - (this.inbuf_ - 56));\n }\n // Add # bits.\n for (let i = this.blockSize - 1; i >= 56; i--) {\n this.buf_[i] = totalBits & 255;\n totalBits /= 256; // Don't use bit-shifting here!\n }\n this.compress_(this.buf_);\n let n = 0;\n for (let i = 0; i < 5; i++) {\n for (let j = 24; j >= 0; j -= 8) {\n digest[n] = this.chain_[i] >> j & 255;\n ++n;\n }\n }\n return digest;\n }\n}\n\n/**\r\n * Helper to make a Subscribe function (just like Promise helps make a\r\n * Thenable).\r\n *\r\n * @param executor Function which can make calls to a single Observer\r\n * as a proxy.\r\n * @param onNoObservers Callback when count of Observers goes to zero.\r\n */\nfunction createSubscribe(executor, onNoObservers) {\n const proxy = new ObserverProxy(executor, onNoObservers);\n return proxy.subscribe.bind(proxy);\n}\n/**\r\n * Implement fan-out for any number of Observers attached via a subscribe\r\n * function.\r\n */\nclass ObserverProxy {\n /**\r\n * @param executor Function which can make calls to a single Observer\r\n * as a proxy.\r\n * @param onNoObservers Callback when count of Observers goes to zero.\r\n */\n constructor(executor, onNoObservers) {\n this.observers = [];\n this.unsubscribes = [];\n this.observerCount = 0;\n // Micro-task scheduling by calling task.then().\n this.task = Promise.resolve();\n this.finalized = false;\n this.onNoObservers = onNoObservers;\n // Call the executor asynchronously so subscribers that are called\n // synchronously after the creation of the subscribe function\n // can still receive the very first value generated in the executor.\n this.task.then(() => {\n executor(this);\n }).catch(e => {\n this.error(e);\n });\n }\n next(value) {\n this.forEachObserver(observer => {\n observer.next(value);\n });\n }\n error(error) {\n this.forEachObserver(observer => {\n observer.error(error);\n });\n this.close(error);\n }\n complete() {\n this.forEachObserver(observer => {\n observer.complete();\n });\n this.close();\n }\n /**\r\n * Subscribe function that can be used to add an Observer to the fan-out list.\r\n *\r\n * - We require that no event is sent to a subscriber sychronously to their\r\n * call to subscribe().\r\n */\n subscribe(nextOrObserver, error, complete) {\n let observer;\n if (nextOrObserver === undefined && error === undefined && complete === undefined) {\n throw new Error('Missing Observer.');\n }\n // Assemble an Observer object when passed as callback functions.\n if (implementsAnyMethods(nextOrObserver, ['next', 'error', 'complete'])) {\n observer = nextOrObserver;\n } else {\n observer = {\n next: nextOrObserver,\n error,\n complete\n };\n }\n if (observer.next === undefined) {\n observer.next = noop;\n }\n if (observer.error === undefined) {\n observer.error = noop;\n }\n if (observer.complete === undefined) {\n observer.complete = noop;\n }\n const unsub = this.unsubscribeOne.bind(this, this.observers.length);\n // Attempt to subscribe to a terminated Observable - we\n // just respond to the Observer with the final error or complete\n // event.\n if (this.finalized) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.task.then(() => {\n try {\n if (this.finalError) {\n observer.error(this.finalError);\n } else {\n observer.complete();\n }\n } catch (e) {\n // nothing\n }\n return;\n });\n }\n this.observers.push(observer);\n return unsub;\n }\n // Unsubscribe is synchronous - we guarantee that no events are sent to\n // any unsubscribed Observer.\n unsubscribeOne(i) {\n if (this.observers === undefined || this.observers[i] === undefined) {\n return;\n }\n delete this.observers[i];\n this.observerCount -= 1;\n if (this.observerCount === 0 && this.onNoObservers !== undefined) {\n this.onNoObservers(this);\n }\n }\n forEachObserver(fn) {\n if (this.finalized) {\n // Already closed by previous event....just eat the additional values.\n return;\n }\n // Since sendOne calls asynchronously - there is no chance that\n // this.observers will become undefined.\n for (let i = 0; i < this.observers.length; i++) {\n this.sendOne(i, fn);\n }\n }\n // Call the Observer via one of it's callback function. We are careful to\n // confirm that the observe has not been unsubscribed since this asynchronous\n // function had been queued.\n sendOne(i, fn) {\n // Execute the callback asynchronously\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.task.then(() => {\n if (this.observers !== undefined && this.observers[i] !== undefined) {\n try {\n fn(this.observers[i]);\n } catch (e) {\n // Ignore exceptions raised in Observers or missing methods of an\n // Observer.\n // Log error to console. b/31404806\n if (typeof console !== 'undefined' && console.error) {\n console.error(e);\n }\n }\n }\n });\n }\n close(err) {\n if (this.finalized) {\n return;\n }\n this.finalized = true;\n if (err !== undefined) {\n this.finalError = err;\n }\n // Proxy is no longer needed - garbage collect references\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.task.then(() => {\n this.observers = undefined;\n this.onNoObservers = undefined;\n });\n }\n}\n/** Turn synchronous function into one called asynchronously. */\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction async(fn, onError) {\n return (...args) => {\n Promise.resolve(true).then(() => {\n fn(...args);\n }).catch(error => {\n if (onError) {\n onError(error);\n }\n });\n };\n}\n/**\r\n * Return true if the object passed in implements any of the named methods.\r\n */\nfunction implementsAnyMethods(obj, methods) {\n if (typeof obj !== 'object' || obj === null) {\n return false;\n }\n for (const method of methods) {\n if (method in obj && typeof obj[method] === 'function') {\n return true;\n }\n }\n return false;\n}\nfunction noop() {\n // do nothing\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Check to make sure the appropriate number of arguments are provided for a public function.\r\n * Throws an error if it fails.\r\n *\r\n * @param fnName The function name\r\n * @param minCount The minimum number of arguments to allow for the function call\r\n * @param maxCount The maximum number of argument to allow for the function call\r\n * @param argCount The actual number of arguments provided.\r\n */\nconst validateArgCount = function (fnName, minCount, maxCount, argCount) {\n let argError;\n if (argCount < minCount) {\n argError = 'at least ' + minCount;\n } else if (argCount > maxCount) {\n argError = maxCount === 0 ? 'none' : 'no more than ' + maxCount;\n }\n if (argError) {\n const error = fnName + ' failed: Was called with ' + argCount + (argCount === 1 ? ' argument.' : ' arguments.') + ' Expects ' + argError + '.';\n throw new Error(error);\n }\n};\n/**\r\n * Generates a string to prefix an error message about failed argument validation\r\n *\r\n * @param fnName The function name\r\n * @param argName The name of the argument\r\n * @return The prefix to add to the error thrown for validation.\r\n */\nfunction errorPrefix(fnName, argName) {\n return `${fnName} failed: ${argName} argument `;\n}\n/**\r\n * @param fnName\r\n * @param argumentNumber\r\n * @param namespace\r\n * @param optional\r\n */\nfunction validateNamespace(fnName, namespace, optional) {\n if (optional && !namespace) {\n return;\n }\n if (typeof namespace !== 'string') {\n //TODO: I should do more validation here. We only allow certain chars in namespaces.\n throw new Error(errorPrefix(fnName, 'namespace') + 'must be a valid firebase namespace.');\n }\n}\nfunction validateCallback(fnName, argumentName,\n// eslint-disable-next-line @typescript-eslint/ban-types\ncallback, optional) {\n if (optional && !callback) {\n return;\n }\n if (typeof callback !== 'function') {\n throw new Error(errorPrefix(fnName, argumentName) + 'must be a valid function.');\n }\n}\nfunction validateContextObject(fnName, argumentName, context, optional) {\n if (optional && !context) {\n return;\n }\n if (typeof context !== 'object' || context === null) {\n throw new Error(errorPrefix(fnName, argumentName) + 'must be a valid context object.');\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n// Code originally came from goog.crypt.stringToUtf8ByteArray, but for some reason they\n// automatically replaced '\\r\\n' with '\\n', and they didn't handle surrogate pairs,\n// so it's been modified.\n// Note that not all Unicode characters appear as single characters in JavaScript strings.\n// fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters\n// use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first\n// character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate\n// pair).\n// See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3\n/**\r\n * @param {string} str\r\n * @return {Array}\r\n */\nconst stringToByteArray = function (str) {\n const out = [];\n let p = 0;\n for (let i = 0; i < str.length; i++) {\n let c = str.charCodeAt(i);\n // Is this the lead surrogate in a surrogate pair?\n if (c >= 0xd800 && c <= 0xdbff) {\n const high = c - 0xd800; // the high 10 bits.\n i++;\n assert(i < str.length, 'Surrogate pair missing trail surrogate.');\n const low = str.charCodeAt(i) - 0xdc00; // the low 10 bits.\n c = 0x10000 + (high << 10) + low;\n }\n if (c < 128) {\n out[p++] = c;\n } else if (c < 2048) {\n out[p++] = c >> 6 | 192;\n out[p++] = c & 63 | 128;\n } else if (c < 65536) {\n out[p++] = c >> 12 | 224;\n out[p++] = c >> 6 & 63 | 128;\n out[p++] = c & 63 | 128;\n } else {\n out[p++] = c >> 18 | 240;\n out[p++] = c >> 12 & 63 | 128;\n out[p++] = c >> 6 & 63 | 128;\n out[p++] = c & 63 | 128;\n }\n }\n return out;\n};\n/**\r\n * Calculate length without actually converting; useful for doing cheaper validation.\r\n * @param {string} str\r\n * @return {number}\r\n */\nconst stringLength = function (str) {\n let p = 0;\n for (let i = 0; i < str.length; i++) {\n const c = str.charCodeAt(i);\n if (c < 128) {\n p++;\n } else if (c < 2048) {\n p += 2;\n } else if (c >= 0xd800 && c <= 0xdbff) {\n // Lead surrogate of a surrogate pair. The pair together will take 4 bytes to represent.\n p += 4;\n i++; // skip trail surrogate.\n } else {\n p += 3;\n }\n }\n return p;\n};\n\n/**\r\n * @license\r\n * Copyright 2022 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Copied from https://stackoverflow.com/a/2117523\r\n * Generates a new uuid.\r\n * @public\r\n */\nconst uuidv4 = function () {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {\n const r = Math.random() * 16 | 0,\n v = c === 'x' ? r : r & 0x3 | 0x8;\n return v.toString(16);\n });\n};\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * The amount of milliseconds to exponentially increase.\r\n */\nconst DEFAULT_INTERVAL_MILLIS = 1000;\n/**\r\n * The factor to backoff by.\r\n * Should be a number greater than 1.\r\n */\nconst DEFAULT_BACKOFF_FACTOR = 2;\n/**\r\n * The maximum milliseconds to increase to.\r\n *\r\n * Visible for testing\r\n */\nconst MAX_VALUE_MILLIS = 4 * 60 * 60 * 1000; // Four hours, like iOS and Android.\n/**\r\n * The percentage of backoff time to randomize by.\r\n * See\r\n * http://go/safe-client-behavior#step-1-determine-the-appropriate-retry-interval-to-handle-spike-traffic\r\n * for context.\r\n *\r\n *
Visible for testing\r\n */\nconst RANDOM_FACTOR = 0.5;\n/**\r\n * Based on the backoff method from\r\n * https://github.com/google/closure-library/blob/master/closure/goog/math/exponentialbackoff.js.\r\n * Extracted here so we don't need to pass metadata and a stateful ExponentialBackoff object around.\r\n */\nfunction calculateBackoffMillis(backoffCount, intervalMillis = DEFAULT_INTERVAL_MILLIS, backoffFactor = DEFAULT_BACKOFF_FACTOR) {\n // Calculates an exponentially increasing value.\n // Deviation: calculates value from count and a constant interval, so we only need to save value\n // and count to restore state.\n const currBaseValue = intervalMillis * Math.pow(backoffFactor, backoffCount);\n // A random \"fuzz\" to avoid waves of retries.\n // Deviation: randomFactor is required.\n const randomWait = Math.round(\n // A fraction of the backoff value to add/subtract.\n // Deviation: changes multiplication order to improve readability.\n RANDOM_FACTOR * currBaseValue * (\n // A random float (rounded to int by Math.round above) in the range [-1, 1]. Determines\n // if we add or subtract.\n Math.random() - 0.5) * 2);\n // Limits backoff to max to avoid effectively permanent backoff.\n return Math.min(MAX_VALUE_MILLIS, currBaseValue + randomWait);\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Provide English ordinal letters after a number\r\n */\nfunction ordinal(i) {\n if (!Number.isFinite(i)) {\n return `${i}`;\n }\n return i + indicator(i);\n}\nfunction indicator(i) {\n i = Math.abs(i);\n const cent = i % 100;\n if (cent >= 10 && cent <= 20) {\n return 'th';\n }\n const dec = i % 10;\n if (dec === 1) {\n return 'st';\n }\n if (dec === 2) {\n return 'nd';\n }\n if (dec === 3) {\n return 'rd';\n }\n return 'th';\n}\n\n/**\r\n * @license\r\n * Copyright 2021 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction getModularInstance(service) {\n if (service && service._delegate) {\n return service._delegate;\n } else {\n return service;\n }\n}\nexport { CONSTANTS, DecodeBase64StringError, Deferred, ErrorFactory, FirebaseError, MAX_VALUE_MILLIS, RANDOM_FACTOR, Sha1, areCookiesEnabled, assert, assertionError, async, base64, base64Decode, base64Encode, base64urlEncodeWithoutPadding, calculateBackoffMillis, contains, createMockUserToken, createSubscribe, decode, deepCopy, deepEqual, deepExtend, errorPrefix, extractQuerystring, getDefaultAppConfig, getDefaultEmulatorHost, getDefaultEmulatorHostnameAndPort, getDefaults, getExperimentalSetting, getGlobal, getModularInstance, getUA, isAdmin, isBrowser, isBrowserExtension, isElectron, isEmpty, isIE, isIndexedDBAvailable, isMobileCordova, isNode, isNodeSdk, isReactNative, isSafari, isUWP, isValidFormat, isValidTimestamp, isWebWorker, issuedAtTime, jsonEval, map, ordinal, promiseWithTimeout, querystring, querystringDecode, safeGet, stringLength, stringToByteArray, stringify, uuidv4, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };\n","import { Deferred } from '@firebase/util';\n\n/**\r\n * Component for service name T, e.g. `auth`, `auth-internal`\r\n */\nclass Component {\n /**\r\n *\r\n * @param name The public service name, e.g. app, auth, firestore, database\r\n * @param instanceFactory Service factory responsible for creating the public interface\r\n * @param type whether the service provided by the component is public or private\r\n */\n constructor(name, instanceFactory, type) {\n this.name = name;\n this.instanceFactory = instanceFactory;\n this.type = type;\n this.multipleInstances = false;\n /**\r\n * Properties to be added to the service namespace\r\n */\n this.serviceProps = {};\n this.instantiationMode = \"LAZY\" /* InstantiationMode.LAZY */;\n this.onInstanceCreated = null;\n }\n setInstantiationMode(mode) {\n this.instantiationMode = mode;\n return this;\n }\n setMultipleInstances(multipleInstances) {\n this.multipleInstances = multipleInstances;\n return this;\n }\n setServiceProps(props) {\n this.serviceProps = props;\n return this;\n }\n setInstanceCreatedCallback(callback) {\n this.onInstanceCreated = callback;\n return this;\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst DEFAULT_ENTRY_NAME = '[DEFAULT]';\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Provider for instance for service name T, e.g. 'auth', 'auth-internal'\r\n * NameServiceMapping[T] is an alias for the type of the instance\r\n */\nclass Provider {\n constructor(name, container) {\n this.name = name;\n this.container = container;\n this.component = null;\n this.instances = new Map();\n this.instancesDeferred = new Map();\n this.instancesOptions = new Map();\n this.onInitCallbacks = new Map();\n }\n /**\r\n * @param identifier A provider can provide mulitple instances of a service\r\n * if this.component.multipleInstances is true.\r\n */\n get(identifier) {\n // if multipleInstances is not supported, use the default name\n const normalizedIdentifier = this.normalizeInstanceIdentifier(identifier);\n if (!this.instancesDeferred.has(normalizedIdentifier)) {\n const deferred = new Deferred();\n this.instancesDeferred.set(normalizedIdentifier, deferred);\n if (this.isInitialized(normalizedIdentifier) || this.shouldAutoInitialize()) {\n // initialize the service if it can be auto-initialized\n try {\n const instance = this.getOrInitializeService({\n instanceIdentifier: normalizedIdentifier\n });\n if (instance) {\n deferred.resolve(instance);\n }\n } catch (e) {\n // when the instance factory throws an exception during get(), it should not cause\n // a fatal error. We just return the unresolved promise in this case.\n }\n }\n }\n return this.instancesDeferred.get(normalizedIdentifier).promise;\n }\n getImmediate(options) {\n var _a;\n // if multipleInstances is not supported, use the default name\n const normalizedIdentifier = this.normalizeInstanceIdentifier(options === null || options === void 0 ? void 0 : options.identifier);\n const optional = (_a = options === null || options === void 0 ? void 0 : options.optional) !== null && _a !== void 0 ? _a : false;\n if (this.isInitialized(normalizedIdentifier) || this.shouldAutoInitialize()) {\n try {\n return this.getOrInitializeService({\n instanceIdentifier: normalizedIdentifier\n });\n } catch (e) {\n if (optional) {\n return null;\n } else {\n throw e;\n }\n }\n } else {\n // In case a component is not initialized and should/can not be auto-initialized at the moment, return null if the optional flag is set, or throw\n if (optional) {\n return null;\n } else {\n throw Error(`Service ${this.name} is not available`);\n }\n }\n }\n getComponent() {\n return this.component;\n }\n setComponent(component) {\n if (component.name !== this.name) {\n throw Error(`Mismatching Component ${component.name} for Provider ${this.name}.`);\n }\n if (this.component) {\n throw Error(`Component for ${this.name} has already been provided`);\n }\n this.component = component;\n // return early without attempting to initialize the component if the component requires explicit initialization (calling `Provider.initialize()`)\n if (!this.shouldAutoInitialize()) {\n return;\n }\n // if the service is eager, initialize the default instance\n if (isComponentEager(component)) {\n try {\n this.getOrInitializeService({\n instanceIdentifier: DEFAULT_ENTRY_NAME\n });\n } catch (e) {\n // when the instance factory for an eager Component throws an exception during the eager\n // initialization, it should not cause a fatal error.\n // TODO: Investigate if we need to make it configurable, because some component may want to cause\n // a fatal error in this case?\n }\n }\n // Create service instances for the pending promises and resolve them\n // NOTE: if this.multipleInstances is false, only the default instance will be created\n // and all promises with resolve with it regardless of the identifier.\n for (const [instanceIdentifier, instanceDeferred] of this.instancesDeferred.entries()) {\n const normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier);\n try {\n // `getOrInitializeService()` should always return a valid instance since a component is guaranteed. use ! to make typescript happy.\n const instance = this.getOrInitializeService({\n instanceIdentifier: normalizedIdentifier\n });\n instanceDeferred.resolve(instance);\n } catch (e) {\n // when the instance factory throws an exception, it should not cause\n // a fatal error. We just leave the promise unresolved.\n }\n }\n }\n clearInstance(identifier = DEFAULT_ENTRY_NAME) {\n this.instancesDeferred.delete(identifier);\n this.instancesOptions.delete(identifier);\n this.instances.delete(identifier);\n }\n // app.delete() will call this method on every provider to delete the services\n // TODO: should we mark the provider as deleted?\n async delete() {\n const services = Array.from(this.instances.values());\n await Promise.all([...services.filter(service => 'INTERNAL' in service) // legacy services\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .map(service => service.INTERNAL.delete()), ...services.filter(service => '_delete' in service) // modularized services\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .map(service => service._delete())]);\n }\n isComponentSet() {\n return this.component != null;\n }\n isInitialized(identifier = DEFAULT_ENTRY_NAME) {\n return this.instances.has(identifier);\n }\n getOptions(identifier = DEFAULT_ENTRY_NAME) {\n return this.instancesOptions.get(identifier) || {};\n }\n initialize(opts = {}) {\n const {\n options = {}\n } = opts;\n const normalizedIdentifier = this.normalizeInstanceIdentifier(opts.instanceIdentifier);\n if (this.isInitialized(normalizedIdentifier)) {\n throw Error(`${this.name}(${normalizedIdentifier}) has already been initialized`);\n }\n if (!this.isComponentSet()) {\n throw Error(`Component ${this.name} has not been registered yet`);\n }\n const instance = this.getOrInitializeService({\n instanceIdentifier: normalizedIdentifier,\n options\n });\n // resolve any pending promise waiting for the service instance\n for (const [instanceIdentifier, instanceDeferred] of this.instancesDeferred.entries()) {\n const normalizedDeferredIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier);\n if (normalizedIdentifier === normalizedDeferredIdentifier) {\n instanceDeferred.resolve(instance);\n }\n }\n return instance;\n }\n /**\r\n *\r\n * @param callback - a function that will be invoked after the provider has been initialized by calling provider.initialize().\r\n * The function is invoked SYNCHRONOUSLY, so it should not execute any longrunning tasks in order to not block the program.\r\n *\r\n * @param identifier An optional instance identifier\r\n * @returns a function to unregister the callback\r\n */\n onInit(callback, identifier) {\n var _a;\n const normalizedIdentifier = this.normalizeInstanceIdentifier(identifier);\n const existingCallbacks = (_a = this.onInitCallbacks.get(normalizedIdentifier)) !== null && _a !== void 0 ? _a : new Set();\n existingCallbacks.add(callback);\n this.onInitCallbacks.set(normalizedIdentifier, existingCallbacks);\n const existingInstance = this.instances.get(normalizedIdentifier);\n if (existingInstance) {\n callback(existingInstance, normalizedIdentifier);\n }\n return () => {\n existingCallbacks.delete(callback);\n };\n }\n /**\r\n * Invoke onInit callbacks synchronously\r\n * @param instance the service instance`\r\n */\n invokeOnInitCallbacks(instance, identifier) {\n const callbacks = this.onInitCallbacks.get(identifier);\n if (!callbacks) {\n return;\n }\n for (const callback of callbacks) {\n try {\n callback(instance, identifier);\n } catch (_a) {\n // ignore errors in the onInit callback\n }\n }\n }\n getOrInitializeService({\n instanceIdentifier,\n options = {}\n }) {\n let instance = this.instances.get(instanceIdentifier);\n if (!instance && this.component) {\n instance = this.component.instanceFactory(this.container, {\n instanceIdentifier: normalizeIdentifierForFactory(instanceIdentifier),\n options\n });\n this.instances.set(instanceIdentifier, instance);\n this.instancesOptions.set(instanceIdentifier, options);\n /**\r\n * Invoke onInit listeners.\r\n * Note this.component.onInstanceCreated is different, which is used by the component creator,\r\n * while onInit listeners are registered by consumers of the provider.\r\n */\n this.invokeOnInitCallbacks(instance, instanceIdentifier);\n /**\r\n * Order is important\r\n * onInstanceCreated() should be called after this.instances.set(instanceIdentifier, instance); which\r\n * makes `isInitialized()` return true.\r\n */\n if (this.component.onInstanceCreated) {\n try {\n this.component.onInstanceCreated(this.container, instanceIdentifier, instance);\n } catch (_a) {\n // ignore errors in the onInstanceCreatedCallback\n }\n }\n }\n return instance || null;\n }\n normalizeInstanceIdentifier(identifier = DEFAULT_ENTRY_NAME) {\n if (this.component) {\n return this.component.multipleInstances ? identifier : DEFAULT_ENTRY_NAME;\n } else {\n return identifier; // assume multiple instances are supported before the component is provided.\n }\n }\n shouldAutoInitialize() {\n return !!this.component && this.component.instantiationMode !== \"EXPLICIT\" /* InstantiationMode.EXPLICIT */;\n }\n}\n// undefined should be passed to the service factory for the default instance\nfunction normalizeIdentifierForFactory(identifier) {\n return identifier === DEFAULT_ENTRY_NAME ? undefined : identifier;\n}\nfunction isComponentEager(component) {\n return component.instantiationMode === \"EAGER\" /* InstantiationMode.EAGER */;\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * ComponentContainer that provides Providers for service name T, e.g. `auth`, `auth-internal`\r\n */\nclass ComponentContainer {\n constructor(name) {\n this.name = name;\n this.providers = new Map();\n }\n /**\r\n *\r\n * @param component Component being added\r\n * @param overwrite When a component with the same name has already been registered,\r\n * if overwrite is true: overwrite the existing component with the new component and create a new\r\n * provider with the new component. It can be useful in tests where you want to use different mocks\r\n * for different tests.\r\n * if overwrite is false: throw an exception\r\n */\n addComponent(component) {\n const provider = this.getProvider(component.name);\n if (provider.isComponentSet()) {\n throw new Error(`Component ${component.name} has already been registered with ${this.name}`);\n }\n provider.setComponent(component);\n }\n addOrOverwriteComponent(component) {\n const provider = this.getProvider(component.name);\n if (provider.isComponentSet()) {\n // delete the existing provider from the container, so we can register the new component\n this.providers.delete(component.name);\n }\n this.addComponent(component);\n }\n /**\r\n * getProvider provides a type safe interface where it can only be called with a field name\r\n * present in NameServiceMapping interface.\r\n *\r\n * Firebase SDKs providing services should extend NameServiceMapping interface to register\r\n * themselves.\r\n */\n getProvider(name) {\n if (this.providers.has(name)) {\n return this.providers.get(name);\n }\n // create a Provider for a service that hasn't registered with Firebase\n const provider = new Provider(name, this);\n this.providers.set(name, provider);\n return provider;\n }\n getProviders() {\n return Array.from(this.providers.values());\n }\n}\nexport { Component, ComponentContainer, Provider };\n","/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * A container for all of the Logger instances\r\n */\nconst instances = [];\n/**\r\n * The JS SDK supports 5 log levels and also allows a user the ability to\r\n * silence the logs altogether.\r\n *\r\n * The order is a follows:\r\n * DEBUG < VERBOSE < INFO < WARN < ERROR\r\n *\r\n * All of the log types above the current log level will be captured (i.e. if\r\n * you set the log level to `INFO`, errors will still be logged, but `DEBUG` and\r\n * `VERBOSE` logs will not)\r\n */\nvar LogLevel = /*#__PURE__*/function (LogLevel) {\n LogLevel[LogLevel[\"DEBUG\"] = 0] = \"DEBUG\";\n LogLevel[LogLevel[\"VERBOSE\"] = 1] = \"VERBOSE\";\n LogLevel[LogLevel[\"INFO\"] = 2] = \"INFO\";\n LogLevel[LogLevel[\"WARN\"] = 3] = \"WARN\";\n LogLevel[LogLevel[\"ERROR\"] = 4] = \"ERROR\";\n LogLevel[LogLevel[\"SILENT\"] = 5] = \"SILENT\";\n return LogLevel;\n}(LogLevel || {});\nconst levelStringToEnum = {\n 'debug': LogLevel.DEBUG,\n 'verbose': LogLevel.VERBOSE,\n 'info': LogLevel.INFO,\n 'warn': LogLevel.WARN,\n 'error': LogLevel.ERROR,\n 'silent': LogLevel.SILENT\n};\n/**\r\n * The default log level\r\n */\nconst defaultLogLevel = LogLevel.INFO;\n/**\r\n * By default, `console.debug` is not displayed in the developer console (in\r\n * chrome). To avoid forcing users to have to opt-in to these logs twice\r\n * (i.e. once for firebase, and once in the console), we are sending `DEBUG`\r\n * logs to the `console.log` function.\r\n */\nconst ConsoleMethod = {\n [LogLevel.DEBUG]: 'log',\n [LogLevel.VERBOSE]: 'log',\n [LogLevel.INFO]: 'info',\n [LogLevel.WARN]: 'warn',\n [LogLevel.ERROR]: 'error'\n};\n/**\r\n * The default log handler will forward DEBUG, VERBOSE, INFO, WARN, and ERROR\r\n * messages on to their corresponding console counterparts (if the log method\r\n * is supported by the current log level)\r\n */\nconst defaultLogHandler = (instance, logType, ...args) => {\n if (logType < instance.logLevel) {\n return;\n }\n const now = new Date().toISOString();\n const method = ConsoleMethod[logType];\n if (method) {\n console[method](`[${now}] ${instance.name}:`, ...args);\n } else {\n throw new Error(`Attempted to log a message with an invalid logType (value: ${logType})`);\n }\n};\nclass Logger {\n /**\r\n * Gives you an instance of a Logger to capture messages according to\r\n * Firebase's logging scheme.\r\n *\r\n * @param name The name that the logs will be associated with\r\n */\n constructor(name) {\n this.name = name;\n /**\r\n * The log level of the given Logger instance.\r\n */\n this._logLevel = defaultLogLevel;\n /**\r\n * The main (internal) log handler for the Logger instance.\r\n * Can be set to a new function in internal package code but not by user.\r\n */\n this._logHandler = defaultLogHandler;\n /**\r\n * The optional, additional, user-defined log handler for the Logger instance.\r\n */\n this._userLogHandler = null;\n /**\r\n * Capture the current instance for later use\r\n */\n instances.push(this);\n }\n get logLevel() {\n return this._logLevel;\n }\n set logLevel(val) {\n if (!(val in LogLevel)) {\n throw new TypeError(`Invalid value \"${val}\" assigned to \\`logLevel\\``);\n }\n this._logLevel = val;\n }\n // Workaround for setter/getter having to be the same type.\n setLogLevel(val) {\n this._logLevel = typeof val === 'string' ? levelStringToEnum[val] : val;\n }\n get logHandler() {\n return this._logHandler;\n }\n set logHandler(val) {\n if (typeof val !== 'function') {\n throw new TypeError('Value assigned to `logHandler` must be a function');\n }\n this._logHandler = val;\n }\n get userLogHandler() {\n return this._userLogHandler;\n }\n set userLogHandler(val) {\n this._userLogHandler = val;\n }\n /**\r\n * The functions below are all based on the `console` interface\r\n */\n debug(...args) {\n this._userLogHandler && this._userLogHandler(this, LogLevel.DEBUG, ...args);\n this._logHandler(this, LogLevel.DEBUG, ...args);\n }\n log(...args) {\n this._userLogHandler && this._userLogHandler(this, LogLevel.VERBOSE, ...args);\n this._logHandler(this, LogLevel.VERBOSE, ...args);\n }\n info(...args) {\n this._userLogHandler && this._userLogHandler(this, LogLevel.INFO, ...args);\n this._logHandler(this, LogLevel.INFO, ...args);\n }\n warn(...args) {\n this._userLogHandler && this._userLogHandler(this, LogLevel.WARN, ...args);\n this._logHandler(this, LogLevel.WARN, ...args);\n }\n error(...args) {\n this._userLogHandler && this._userLogHandler(this, LogLevel.ERROR, ...args);\n this._logHandler(this, LogLevel.ERROR, ...args);\n }\n}\nfunction setLogLevel(level) {\n instances.forEach(inst => {\n inst.setLogLevel(level);\n });\n}\nfunction setUserLogHandler(logCallback, options) {\n for (const instance of instances) {\n let customLogLevel = null;\n if (options && options.level) {\n customLogLevel = levelStringToEnum[options.level];\n }\n if (logCallback === null) {\n instance.userLogHandler = null;\n } else {\n instance.userLogHandler = (instance, level, ...args) => {\n const message = args.map(arg => {\n if (arg == null) {\n return null;\n } else if (typeof arg === 'string') {\n return arg;\n } else if (typeof arg === 'number' || typeof arg === 'boolean') {\n return arg.toString();\n } else if (arg instanceof Error) {\n return arg.message;\n } else {\n try {\n return JSON.stringify(arg);\n } catch (ignored) {\n return null;\n }\n }\n }).filter(arg => arg).join(' ');\n if (level >= (customLogLevel !== null && customLogLevel !== void 0 ? customLogLevel : instance.logLevel)) {\n logCallback({\n level: LogLevel[level].toLowerCase(),\n message,\n args,\n type: instance.name\n });\n }\n };\n }\n }\n}\nexport { LogLevel, Logger, setLogLevel, setUserLogHandler };\n","const instanceOfAny = (object, constructors) => constructors.some(c => object instanceof c);\nlet idbProxyableTypes;\nlet cursorAdvanceMethods;\n// This is a function to prevent it throwing up in node environments.\nfunction getIdbProxyableTypes() {\n return idbProxyableTypes || (idbProxyableTypes = [IDBDatabase, IDBObjectStore, IDBIndex, IDBCursor, IDBTransaction]);\n}\n// This is a function to prevent it throwing up in node environments.\nfunction getCursorAdvanceMethods() {\n return cursorAdvanceMethods || (cursorAdvanceMethods = [IDBCursor.prototype.advance, IDBCursor.prototype.continue, IDBCursor.prototype.continuePrimaryKey]);\n}\nconst cursorRequestMap = new WeakMap();\nconst transactionDoneMap = new WeakMap();\nconst transactionStoreNamesMap = new WeakMap();\nconst transformCache = new WeakMap();\nconst reverseTransformCache = new WeakMap();\nfunction promisifyRequest(request) {\n const promise = new Promise((resolve, reject) => {\n const unlisten = () => {\n request.removeEventListener('success', success);\n request.removeEventListener('error', error);\n };\n const success = () => {\n resolve(wrap(request.result));\n unlisten();\n };\n const error = () => {\n reject(request.error);\n unlisten();\n };\n request.addEventListener('success', success);\n request.addEventListener('error', error);\n });\n promise.then(value => {\n // Since cursoring reuses the IDBRequest (*sigh*), we cache it for later retrieval\n // (see wrapFunction).\n if (value instanceof IDBCursor) {\n cursorRequestMap.set(value, request);\n }\n // Catching to avoid \"Uncaught Promise exceptions\"\n }).catch(() => {});\n // This mapping exists in reverseTransformCache but doesn't doesn't exist in transformCache. This\n // is because we create many promises from a single IDBRequest.\n reverseTransformCache.set(promise, request);\n return promise;\n}\nfunction cacheDonePromiseForTransaction(tx) {\n // Early bail if we've already created a done promise for this transaction.\n if (transactionDoneMap.has(tx)) return;\n const done = new Promise((resolve, reject) => {\n const unlisten = () => {\n tx.removeEventListener('complete', complete);\n tx.removeEventListener('error', error);\n tx.removeEventListener('abort', error);\n };\n const complete = () => {\n resolve();\n unlisten();\n };\n const error = () => {\n reject(tx.error || new DOMException('AbortError', 'AbortError'));\n unlisten();\n };\n tx.addEventListener('complete', complete);\n tx.addEventListener('error', error);\n tx.addEventListener('abort', error);\n });\n // Cache it for later retrieval.\n transactionDoneMap.set(tx, done);\n}\nlet idbProxyTraps = {\n get(target, prop, receiver) {\n if (target instanceof IDBTransaction) {\n // Special handling for transaction.done.\n if (prop === 'done') return transactionDoneMap.get(target);\n // Polyfill for objectStoreNames because of Edge.\n if (prop === 'objectStoreNames') {\n return target.objectStoreNames || transactionStoreNamesMap.get(target);\n }\n // Make tx.store return the only store in the transaction, or undefined if there are many.\n if (prop === 'store') {\n return receiver.objectStoreNames[1] ? undefined : receiver.objectStore(receiver.objectStoreNames[0]);\n }\n }\n // Else transform whatever we get back.\n return wrap(target[prop]);\n },\n set(target, prop, value) {\n target[prop] = value;\n return true;\n },\n has(target, prop) {\n if (target instanceof IDBTransaction && (prop === 'done' || prop === 'store')) {\n return true;\n }\n return prop in target;\n }\n};\nfunction replaceTraps(callback) {\n idbProxyTraps = callback(idbProxyTraps);\n}\nfunction wrapFunction(func) {\n // Due to expected object equality (which is enforced by the caching in `wrap`), we\n // only create one new func per func.\n // Edge doesn't support objectStoreNames (booo), so we polyfill it here.\n if (func === IDBDatabase.prototype.transaction && !('objectStoreNames' in IDBTransaction.prototype)) {\n return function (storeNames, ...args) {\n const tx = func.call(unwrap(this), storeNames, ...args);\n transactionStoreNamesMap.set(tx, storeNames.sort ? storeNames.sort() : [storeNames]);\n return wrap(tx);\n };\n }\n // Cursor methods are special, as the behaviour is a little more different to standard IDB. In\n // IDB, you advance the cursor and wait for a new 'success' on the IDBRequest that gave you the\n // cursor. It's kinda like a promise that can resolve with many values. That doesn't make sense\n // with real promises, so each advance methods returns a new promise for the cursor object, or\n // undefined if the end of the cursor has been reached.\n if (getCursorAdvanceMethods().includes(func)) {\n return function (...args) {\n // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use\n // the original object.\n func.apply(unwrap(this), args);\n return wrap(cursorRequestMap.get(this));\n };\n }\n return function (...args) {\n // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use\n // the original object.\n return wrap(func.apply(unwrap(this), args));\n };\n}\nfunction transformCachableValue(value) {\n if (typeof value === 'function') return wrapFunction(value);\n // This doesn't return, it just creates a 'done' promise for the transaction,\n // which is later returned for transaction.done (see idbObjectHandler).\n if (value instanceof IDBTransaction) cacheDonePromiseForTransaction(value);\n if (instanceOfAny(value, getIdbProxyableTypes())) return new Proxy(value, idbProxyTraps);\n // Return the same value back if we're not going to transform it.\n return value;\n}\nfunction wrap(value) {\n // We sometimes generate multiple promises from a single IDBRequest (eg when cursoring), because\n // IDB is weird and a single IDBRequest can yield many responses, so these can't be cached.\n if (value instanceof IDBRequest) return promisifyRequest(value);\n // If we've already transformed this value before, reuse the transformed value.\n // This is faster, but it also provides object equality.\n if (transformCache.has(value)) return transformCache.get(value);\n const newValue = transformCachableValue(value);\n // Not all types are transformed.\n // These may be primitive types, so they can't be WeakMap keys.\n if (newValue !== value) {\n transformCache.set(value, newValue);\n reverseTransformCache.set(newValue, value);\n }\n return newValue;\n}\nconst unwrap = value => reverseTransformCache.get(value);\nexport { reverseTransformCache as a, instanceOfAny as i, replaceTraps as r, unwrap as u, wrap as w };","import { w as wrap, r as replaceTraps } from './wrap-idb-value.js';\nexport { u as unwrap, w as wrap } from './wrap-idb-value.js';\n\n/**\n * Open a database.\n *\n * @param name Name of the database.\n * @param version Schema version.\n * @param callbacks Additional callbacks.\n */\nfunction openDB(name, version, {\n blocked,\n upgrade,\n blocking,\n terminated\n} = {}) {\n const request = indexedDB.open(name, version);\n const openPromise = wrap(request);\n if (upgrade) {\n request.addEventListener('upgradeneeded', event => {\n upgrade(wrap(request.result), event.oldVersion, event.newVersion, wrap(request.transaction), event);\n });\n }\n if (blocked) {\n request.addEventListener('blocked', event => blocked(\n // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405\n event.oldVersion, event.newVersion, event));\n }\n openPromise.then(db => {\n if (terminated) db.addEventListener('close', () => terminated());\n if (blocking) {\n db.addEventListener('versionchange', event => blocking(event.oldVersion, event.newVersion, event));\n }\n }).catch(() => {});\n return openPromise;\n}\n/**\n * Delete a database.\n *\n * @param name Name of the database.\n */\nfunction deleteDB(name, {\n blocked\n} = {}) {\n const request = indexedDB.deleteDatabase(name);\n if (blocked) {\n request.addEventListener('blocked', event => blocked(\n // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405\n event.oldVersion, event));\n }\n return wrap(request).then(() => undefined);\n}\nconst readMethods = ['get', 'getKey', 'getAll', 'getAllKeys', 'count'];\nconst writeMethods = ['put', 'add', 'delete', 'clear'];\nconst cachedMethods = new Map();\nfunction getMethod(target, prop) {\n if (!(target instanceof IDBDatabase && !(prop in target) && typeof prop === 'string')) {\n return;\n }\n if (cachedMethods.get(prop)) return cachedMethods.get(prop);\n const targetFuncName = prop.replace(/FromIndex$/, '');\n const useIndex = prop !== targetFuncName;\n const isWrite = writeMethods.includes(targetFuncName);\n if (\n // Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge.\n !(targetFuncName in (useIndex ? IDBIndex : IDBObjectStore).prototype) || !(isWrite || readMethods.includes(targetFuncName))) {\n return;\n }\n const method = async function (storeName, ...args) {\n // isWrite ? 'readwrite' : undefined gzipps better, but fails in Edge :(\n const tx = this.transaction(storeName, isWrite ? 'readwrite' : 'readonly');\n let target = tx.store;\n if (useIndex) target = target.index(args.shift());\n // Must reject if op rejects.\n // If it's a write operation, must reject if tx.done rejects.\n // Must reject with op rejection first.\n // Must resolve with op value.\n // Must handle both promises (no unhandled rejections)\n return (await Promise.all([target[targetFuncName](...args), isWrite && tx.done]))[0];\n };\n cachedMethods.set(prop, method);\n return method;\n}\nreplaceTraps(oldTraps => ({\n ...oldTraps,\n get: (target, prop, receiver) => getMethod(target, prop) || oldTraps.get(target, prop, receiver),\n has: (target, prop) => !!getMethod(target, prop) || oldTraps.has(target, prop)\n}));\nexport { deleteDB, openDB };","import { Component, ComponentContainer } from '@firebase/component';\nimport { Logger, setUserLogHandler, setLogLevel as setLogLevel$1 } from '@firebase/logger';\nimport { ErrorFactory, getDefaultAppConfig, deepEqual, isBrowser, isWebWorker, FirebaseError, base64urlEncodeWithoutPadding, isIndexedDBAvailable, validateIndexedDBOpenable } from '@firebase/util';\nexport { FirebaseError } from '@firebase/util';\nimport { openDB } from 'idb';\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nclass PlatformLoggerServiceImpl {\n constructor(container) {\n this.container = container;\n }\n // In initial implementation, this will be called by installations on\n // auth token refresh, and installations will send this string.\n getPlatformInfoString() {\n const providers = this.container.getProviders();\n // Loop through providers and get library/version pairs from any that are\n // version components.\n return providers.map(provider => {\n if (isVersionServiceProvider(provider)) {\n const service = provider.getImmediate();\n return `${service.library}/${service.version}`;\n } else {\n return null;\n }\n }).filter(logString => logString).join(' ');\n }\n}\n/**\r\n *\r\n * @param provider check if this provider provides a VersionService\r\n *\r\n * NOTE: Using Provider<'app-version'> is a hack to indicate that the provider\r\n * provides VersionService. The provider is not necessarily a 'app-version'\r\n * provider.\r\n */\nfunction isVersionServiceProvider(provider) {\n const component = provider.getComponent();\n return (component === null || component === void 0 ? void 0 : component.type) === \"VERSION\" /* ComponentType.VERSION */;\n}\nconst name$p = \"@firebase/app\";\nconst version$1 = \"0.10.8\";\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst logger = new Logger('@firebase/app');\nconst name$o = \"@firebase/app-compat\";\nconst name$n = \"@firebase/analytics-compat\";\nconst name$m = \"@firebase/analytics\";\nconst name$l = \"@firebase/app-check-compat\";\nconst name$k = \"@firebase/app-check\";\nconst name$j = \"@firebase/auth\";\nconst name$i = \"@firebase/auth-compat\";\nconst name$h = \"@firebase/database\";\nconst name$g = \"@firebase/database-compat\";\nconst name$f = \"@firebase/functions\";\nconst name$e = \"@firebase/functions-compat\";\nconst name$d = \"@firebase/installations\";\nconst name$c = \"@firebase/installations-compat\";\nconst name$b = \"@firebase/messaging\";\nconst name$a = \"@firebase/messaging-compat\";\nconst name$9 = \"@firebase/performance\";\nconst name$8 = \"@firebase/performance-compat\";\nconst name$7 = \"@firebase/remote-config\";\nconst name$6 = \"@firebase/remote-config-compat\";\nconst name$5 = \"@firebase/storage\";\nconst name$4 = \"@firebase/storage-compat\";\nconst name$3 = \"@firebase/firestore\";\nconst name$2 = \"@firebase/vertexai-preview\";\nconst name$1 = \"@firebase/firestore-compat\";\nconst name = \"firebase\";\nconst version = \"10.12.5\";\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * The default app name\r\n *\r\n * @internal\r\n */\nconst DEFAULT_ENTRY_NAME = '[DEFAULT]';\nconst PLATFORM_LOG_STRING = {\n [name$p]: 'fire-core',\n [name$o]: 'fire-core-compat',\n [name$m]: 'fire-analytics',\n [name$n]: 'fire-analytics-compat',\n [name$k]: 'fire-app-check',\n [name$l]: 'fire-app-check-compat',\n [name$j]: 'fire-auth',\n [name$i]: 'fire-auth-compat',\n [name$h]: 'fire-rtdb',\n [name$g]: 'fire-rtdb-compat',\n [name$f]: 'fire-fn',\n [name$e]: 'fire-fn-compat',\n [name$d]: 'fire-iid',\n [name$c]: 'fire-iid-compat',\n [name$b]: 'fire-fcm',\n [name$a]: 'fire-fcm-compat',\n [name$9]: 'fire-perf',\n [name$8]: 'fire-perf-compat',\n [name$7]: 'fire-rc',\n [name$6]: 'fire-rc-compat',\n [name$5]: 'fire-gcs',\n [name$4]: 'fire-gcs-compat',\n [name$3]: 'fire-fst',\n [name$1]: 'fire-fst-compat',\n [name$2]: 'fire-vertex',\n 'fire-js': 'fire-js',\n [name]: 'fire-js-all'\n};\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * @internal\r\n */\nconst _apps = new Map();\n/**\r\n * @internal\r\n */\nconst _serverApps = new Map();\n/**\r\n * Registered components.\r\n *\r\n * @internal\r\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst _components = new Map();\n/**\r\n * @param component - the component being added to this app's container\r\n *\r\n * @internal\r\n */\nfunction _addComponent(app, component) {\n try {\n app.container.addComponent(component);\n } catch (e) {\n logger.debug(`Component ${component.name} failed to register with FirebaseApp ${app.name}`, e);\n }\n}\n/**\r\n *\r\n * @internal\r\n */\nfunction _addOrOverwriteComponent(app, component) {\n app.container.addOrOverwriteComponent(component);\n}\n/**\r\n *\r\n * @param component - the component to register\r\n * @returns whether or not the component is registered successfully\r\n *\r\n * @internal\r\n */\nfunction _registerComponent(component) {\n const componentName = component.name;\n if (_components.has(componentName)) {\n logger.debug(`There were multiple attempts to register component ${componentName}.`);\n return false;\n }\n _components.set(componentName, component);\n // add the component to existing app instances\n for (const app of _apps.values()) {\n _addComponent(app, component);\n }\n for (const serverApp of _serverApps.values()) {\n _addComponent(serverApp, component);\n }\n return true;\n}\n/**\r\n *\r\n * @param app - FirebaseApp instance\r\n * @param name - service name\r\n *\r\n * @returns the provider for the service with the matching name\r\n *\r\n * @internal\r\n */\nfunction _getProvider(app, name) {\n const heartbeatController = app.container.getProvider('heartbeat').getImmediate({\n optional: true\n });\n if (heartbeatController) {\n void heartbeatController.triggerHeartbeat();\n }\n return app.container.getProvider(name);\n}\n/**\r\n *\r\n * @param app - FirebaseApp instance\r\n * @param name - service name\r\n * @param instanceIdentifier - service instance identifier in case the service supports multiple instances\r\n *\r\n * @internal\r\n */\nfunction _removeServiceInstance(app, name, instanceIdentifier = DEFAULT_ENTRY_NAME) {\n _getProvider(app, name).clearInstance(instanceIdentifier);\n}\n/**\r\n *\r\n * @param obj - an object of type FirebaseApp or FirebaseOptions.\r\n *\r\n * @returns true if the provide object is of type FirebaseApp.\r\n *\r\n * @internal\r\n */\nfunction _isFirebaseApp(obj) {\n return obj.options !== undefined;\n}\n/**\r\n *\r\n * @param obj - an object of type FirebaseApp.\r\n *\r\n * @returns true if the provided object is of type FirebaseServerAppImpl.\r\n *\r\n * @internal\r\n */\nfunction _isFirebaseServerApp(obj) {\n return obj.settings !== undefined;\n}\n/**\r\n * Test only\r\n *\r\n * @internal\r\n */\nfunction _clearComponents() {\n _components.clear();\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst ERRORS = {\n [\"no-app\" /* AppError.NO_APP */]: \"No Firebase App '{$appName}' has been created - \" + 'call initializeApp() first',\n [\"bad-app-name\" /* AppError.BAD_APP_NAME */]: \"Illegal App name: '{$appName}'\",\n [\"duplicate-app\" /* AppError.DUPLICATE_APP */]: \"Firebase App named '{$appName}' already exists with different options or config\",\n [\"app-deleted\" /* AppError.APP_DELETED */]: \"Firebase App named '{$appName}' already deleted\",\n [\"server-app-deleted\" /* AppError.SERVER_APP_DELETED */]: 'Firebase Server App has been deleted',\n [\"no-options\" /* AppError.NO_OPTIONS */]: 'Need to provide options, when not being deployed to hosting via source.',\n [\"invalid-app-argument\" /* AppError.INVALID_APP_ARGUMENT */]: 'firebase.{$appName}() takes either no argument or a ' + 'Firebase App instance.',\n [\"invalid-log-argument\" /* AppError.INVALID_LOG_ARGUMENT */]: 'First argument to `onLog` must be null or a function.',\n [\"idb-open\" /* AppError.IDB_OPEN */]: 'Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.',\n [\"idb-get\" /* AppError.IDB_GET */]: 'Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.',\n [\"idb-set\" /* AppError.IDB_WRITE */]: 'Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.',\n [\"idb-delete\" /* AppError.IDB_DELETE */]: 'Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.',\n [\"finalization-registry-not-supported\" /* AppError.FINALIZATION_REGISTRY_NOT_SUPPORTED */]: 'FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.',\n [\"invalid-server-app-environment\" /* AppError.INVALID_SERVER_APP_ENVIRONMENT */]: 'FirebaseServerApp is not for use in browser environments.'\n};\nconst ERROR_FACTORY = new ErrorFactory('app', 'Firebase', ERRORS);\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nclass FirebaseAppImpl {\n constructor(options, config, container) {\n this._isDeleted = false;\n this._options = Object.assign({}, options);\n this._config = Object.assign({}, config);\n this._name = config.name;\n this._automaticDataCollectionEnabled = config.automaticDataCollectionEnabled;\n this._container = container;\n this.container.addComponent(new Component('app', () => this, \"PUBLIC\" /* ComponentType.PUBLIC */));\n }\n get automaticDataCollectionEnabled() {\n this.checkDestroyed();\n return this._automaticDataCollectionEnabled;\n }\n set automaticDataCollectionEnabled(val) {\n this.checkDestroyed();\n this._automaticDataCollectionEnabled = val;\n }\n get name() {\n this.checkDestroyed();\n return this._name;\n }\n get options() {\n this.checkDestroyed();\n return this._options;\n }\n get config() {\n this.checkDestroyed();\n return this._config;\n }\n get container() {\n return this._container;\n }\n get isDeleted() {\n return this._isDeleted;\n }\n set isDeleted(val) {\n this._isDeleted = val;\n }\n /**\r\n * This function will throw an Error if the App has already been deleted -\r\n * use before performing API actions on the App.\r\n */\n checkDestroyed() {\n if (this.isDeleted) {\n throw ERROR_FACTORY.create(\"app-deleted\" /* AppError.APP_DELETED */, {\n appName: this._name\n });\n }\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2023 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nclass FirebaseServerAppImpl extends FirebaseAppImpl {\n constructor(options, serverConfig, name, container) {\n // Build configuration parameters for the FirebaseAppImpl base class.\n const automaticDataCollectionEnabled = serverConfig.automaticDataCollectionEnabled !== undefined ? serverConfig.automaticDataCollectionEnabled : false;\n // Create the FirebaseAppSettings object for the FirebaseAppImp constructor.\n const config = {\n name,\n automaticDataCollectionEnabled\n };\n if (options.apiKey !== undefined) {\n // Construct the parent FirebaseAppImp object.\n super(options, config, container);\n } else {\n const appImpl = options;\n super(appImpl.options, config, container);\n }\n // Now construct the data for the FirebaseServerAppImpl.\n this._serverConfig = Object.assign({\n automaticDataCollectionEnabled\n }, serverConfig);\n this._finalizationRegistry = null;\n if (typeof FinalizationRegistry !== 'undefined') {\n this._finalizationRegistry = new FinalizationRegistry(() => {\n this.automaticCleanup();\n });\n }\n this._refCount = 0;\n this.incRefCount(this._serverConfig.releaseOnDeref);\n // Do not retain a hard reference to the dref object, otherwise the FinalizationRegistry\n // will never trigger.\n this._serverConfig.releaseOnDeref = undefined;\n serverConfig.releaseOnDeref = undefined;\n registerVersion(name$p, version$1, 'serverapp');\n }\n toJSON() {\n return undefined;\n }\n get refCount() {\n return this._refCount;\n }\n // Increment the reference count of this server app. If an object is provided, register it\n // with the finalization registry.\n incRefCount(obj) {\n if (this.isDeleted) {\n return;\n }\n this._refCount++;\n if (obj !== undefined && this._finalizationRegistry !== null) {\n this._finalizationRegistry.register(obj, this);\n }\n }\n // Decrement the reference count.\n decRefCount() {\n if (this.isDeleted) {\n return 0;\n }\n return --this._refCount;\n }\n // Invoked by the FinalizationRegistry callback to note that this app should go through its\n // reference counts and delete itself if no reference count remain. The coordinating logic that\n // handles this is in deleteApp(...).\n automaticCleanup() {\n void deleteApp(this);\n }\n get settings() {\n this.checkDestroyed();\n return this._serverConfig;\n }\n /**\r\n * This function will throw an Error if the App has already been deleted -\r\n * use before performing API actions on the App.\r\n */\n checkDestroyed() {\n if (this.isDeleted) {\n throw ERROR_FACTORY.create(\"server-app-deleted\" /* AppError.SERVER_APP_DELETED */);\n }\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * The current SDK version.\r\n *\r\n * @public\r\n */\nconst SDK_VERSION = version;\nfunction initializeApp(_options, rawConfig = {}) {\n let options = _options;\n if (typeof rawConfig !== 'object') {\n const name = rawConfig;\n rawConfig = {\n name\n };\n }\n const config = Object.assign({\n name: DEFAULT_ENTRY_NAME,\n automaticDataCollectionEnabled: false\n }, rawConfig);\n const name = config.name;\n if (typeof name !== 'string' || !name) {\n throw ERROR_FACTORY.create(\"bad-app-name\" /* AppError.BAD_APP_NAME */, {\n appName: String(name)\n });\n }\n options || (options = getDefaultAppConfig());\n if (!options) {\n throw ERROR_FACTORY.create(\"no-options\" /* AppError.NO_OPTIONS */);\n }\n const existingApp = _apps.get(name);\n if (existingApp) {\n // return the existing app if options and config deep equal the ones in the existing app.\n if (deepEqual(options, existingApp.options) && deepEqual(config, existingApp.config)) {\n return existingApp;\n } else {\n throw ERROR_FACTORY.create(\"duplicate-app\" /* AppError.DUPLICATE_APP */, {\n appName: name\n });\n }\n }\n const container = new ComponentContainer(name);\n for (const component of _components.values()) {\n container.addComponent(component);\n }\n const newApp = new FirebaseAppImpl(options, config, container);\n _apps.set(name, newApp);\n return newApp;\n}\nfunction initializeServerApp(_options, _serverAppConfig) {\n if (isBrowser() && !isWebWorker()) {\n // FirebaseServerApp isn't designed to be run in browsers.\n throw ERROR_FACTORY.create(\"invalid-server-app-environment\" /* AppError.INVALID_SERVER_APP_ENVIRONMENT */);\n }\n if (_serverAppConfig.automaticDataCollectionEnabled === undefined) {\n _serverAppConfig.automaticDataCollectionEnabled = false;\n }\n let appOptions;\n if (_isFirebaseApp(_options)) {\n appOptions = _options.options;\n } else {\n appOptions = _options;\n }\n // Build an app name based on a hash of the configuration options.\n const nameObj = Object.assign(Object.assign({}, _serverAppConfig), appOptions);\n // However, Do not mangle the name based on releaseOnDeref, since it will vary between the\n // construction of FirebaseServerApp instances. For example, if the object is the request headers.\n if (nameObj.releaseOnDeref !== undefined) {\n delete nameObj.releaseOnDeref;\n }\n const hashCode = s => {\n return [...s].reduce((hash, c) => Math.imul(31, hash) + c.charCodeAt(0) | 0, 0);\n };\n if (_serverAppConfig.releaseOnDeref !== undefined) {\n if (typeof FinalizationRegistry === 'undefined') {\n throw ERROR_FACTORY.create(\"finalization-registry-not-supported\" /* AppError.FINALIZATION_REGISTRY_NOT_SUPPORTED */, {});\n }\n }\n const nameString = '' + hashCode(JSON.stringify(nameObj));\n const existingApp = _serverApps.get(nameString);\n if (existingApp) {\n existingApp.incRefCount(_serverAppConfig.releaseOnDeref);\n return existingApp;\n }\n const container = new ComponentContainer(nameString);\n for (const component of _components.values()) {\n container.addComponent(component);\n }\n const newApp = new FirebaseServerAppImpl(appOptions, _serverAppConfig, nameString, container);\n _serverApps.set(nameString, newApp);\n return newApp;\n}\n/**\r\n * Retrieves a {@link @firebase/app#FirebaseApp} instance.\r\n *\r\n * When called with no arguments, the default app is returned. When an app name\r\n * is provided, the app corresponding to that name is returned.\r\n *\r\n * An exception is thrown if the app being retrieved has not yet been\r\n * initialized.\r\n *\r\n * @example\r\n * ```javascript\r\n * // Return the default app\r\n * const app = getApp();\r\n * ```\r\n *\r\n * @example\r\n * ```javascript\r\n * // Return a named app\r\n * const otherApp = getApp(\"otherApp\");\r\n * ```\r\n *\r\n * @param name - Optional name of the app to return. If no name is\r\n * provided, the default is `\"[DEFAULT]\"`.\r\n *\r\n * @returns The app corresponding to the provided app name.\r\n * If no app name is provided, the default app is returned.\r\n *\r\n * @public\r\n */\nfunction getApp(name = DEFAULT_ENTRY_NAME) {\n const app = _apps.get(name);\n if (!app && name === DEFAULT_ENTRY_NAME && getDefaultAppConfig()) {\n return initializeApp();\n }\n if (!app) {\n throw ERROR_FACTORY.create(\"no-app\" /* AppError.NO_APP */, {\n appName: name\n });\n }\n return app;\n}\n/**\r\n * A (read-only) array of all initialized apps.\r\n * @public\r\n */\nfunction getApps() {\n return Array.from(_apps.values());\n}\n/**\r\n * Renders this app unusable and frees the resources of all associated\r\n * services.\r\n *\r\n * @example\r\n * ```javascript\r\n * deleteApp(app)\r\n * .then(function() {\r\n * console.log(\"App deleted successfully\");\r\n * })\r\n * .catch(function(error) {\r\n * console.log(\"Error deleting app:\", error);\r\n * });\r\n * ```\r\n *\r\n * @public\r\n */\nasync function deleteApp(app) {\n let cleanupProviders = false;\n const name = app.name;\n if (_apps.has(name)) {\n cleanupProviders = true;\n _apps.delete(name);\n } else if (_serverApps.has(name)) {\n const firebaseServerApp = app;\n if (firebaseServerApp.decRefCount() <= 0) {\n _serverApps.delete(name);\n cleanupProviders = true;\n }\n }\n if (cleanupProviders) {\n await Promise.all(app.container.getProviders().map(provider => provider.delete()));\n app.isDeleted = true;\n }\n}\n/**\r\n * Registers a library's name and version for platform logging purposes.\r\n * @param library - Name of 1p or 3p library (e.g. firestore, angularfire)\r\n * @param version - Current version of that library.\r\n * @param variant - Bundle variant, e.g., node, rn, etc.\r\n *\r\n * @public\r\n */\nfunction registerVersion(libraryKeyOrName, version, variant) {\n var _a;\n // TODO: We can use this check to whitelist strings when/if we set up\n // a good whitelist system.\n let library = (_a = PLATFORM_LOG_STRING[libraryKeyOrName]) !== null && _a !== void 0 ? _a : libraryKeyOrName;\n if (variant) {\n library += `-${variant}`;\n }\n const libraryMismatch = library.match(/\\s|\\//);\n const versionMismatch = version.match(/\\s|\\//);\n if (libraryMismatch || versionMismatch) {\n const warning = [`Unable to register library \"${library}\" with version \"${version}\":`];\n if (libraryMismatch) {\n warning.push(`library name \"${library}\" contains illegal characters (whitespace or \"/\")`);\n }\n if (libraryMismatch && versionMismatch) {\n warning.push('and');\n }\n if (versionMismatch) {\n warning.push(`version name \"${version}\" contains illegal characters (whitespace or \"/\")`);\n }\n logger.warn(warning.join(' '));\n return;\n }\n _registerComponent(new Component(`${library}-version`, () => ({\n library,\n version\n }), \"VERSION\" /* ComponentType.VERSION */));\n}\n/**\r\n * Sets log handler for all Firebase SDKs.\r\n * @param logCallback - An optional custom log handler that executes user code whenever\r\n * the Firebase SDK makes a logging call.\r\n *\r\n * @public\r\n */\nfunction onLog(logCallback, options) {\n if (logCallback !== null && typeof logCallback !== 'function') {\n throw ERROR_FACTORY.create(\"invalid-log-argument\" /* AppError.INVALID_LOG_ARGUMENT */);\n }\n setUserLogHandler(logCallback, options);\n}\n/**\r\n * Sets log level for all Firebase SDKs.\r\n *\r\n * All of the log types above the current log level are captured (i.e. if\r\n * you set the log level to `info`, errors are logged, but `debug` and\r\n * `verbose` logs are not).\r\n *\r\n * @public\r\n */\nfunction setLogLevel(logLevel) {\n setLogLevel$1(logLevel);\n}\n\n/**\r\n * @license\r\n * Copyright 2021 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst DB_NAME = 'firebase-heartbeat-database';\nconst DB_VERSION = 1;\nconst STORE_NAME = 'firebase-heartbeat-store';\nlet dbPromise = null;\nfunction getDbPromise() {\n if (!dbPromise) {\n dbPromise = openDB(DB_NAME, DB_VERSION, {\n upgrade: (db, oldVersion) => {\n // We don't use 'break' in this switch statement, the fall-through\n // behavior is what we want, because if there are multiple versions between\n // the old version and the current version, we want ALL the migrations\n // that correspond to those versions to run, not only the last one.\n // eslint-disable-next-line default-case\n switch (oldVersion) {\n case 0:\n try {\n db.createObjectStore(STORE_NAME);\n } catch (e) {\n // Safari/iOS browsers throw occasional exceptions on\n // db.createObjectStore() that may be a bug. Avoid blocking\n // the rest of the app functionality.\n console.warn(e);\n }\n }\n }\n }).catch(e => {\n throw ERROR_FACTORY.create(\"idb-open\" /* AppError.IDB_OPEN */, {\n originalErrorMessage: e.message\n });\n });\n }\n return dbPromise;\n}\nasync function readHeartbeatsFromIndexedDB(app) {\n try {\n const db = await getDbPromise();\n const tx = db.transaction(STORE_NAME);\n const result = await tx.objectStore(STORE_NAME).get(computeKey(app));\n // We already have the value but tx.done can throw,\n // so we need to await it here to catch errors\n await tx.done;\n return result;\n } catch (e) {\n if (e instanceof FirebaseError) {\n logger.warn(e.message);\n } else {\n const idbGetError = ERROR_FACTORY.create(\"idb-get\" /* AppError.IDB_GET */, {\n originalErrorMessage: e === null || e === void 0 ? void 0 : e.message\n });\n logger.warn(idbGetError.message);\n }\n }\n}\nasync function writeHeartbeatsToIndexedDB(app, heartbeatObject) {\n try {\n const db = await getDbPromise();\n const tx = db.transaction(STORE_NAME, 'readwrite');\n const objectStore = tx.objectStore(STORE_NAME);\n await objectStore.put(heartbeatObject, computeKey(app));\n await tx.done;\n } catch (e) {\n if (e instanceof FirebaseError) {\n logger.warn(e.message);\n } else {\n const idbGetError = ERROR_FACTORY.create(\"idb-set\" /* AppError.IDB_WRITE */, {\n originalErrorMessage: e === null || e === void 0 ? void 0 : e.message\n });\n logger.warn(idbGetError.message);\n }\n }\n}\nfunction computeKey(app) {\n return `${app.name}!${app.options.appId}`;\n}\n\n/**\r\n * @license\r\n * Copyright 2021 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst MAX_HEADER_BYTES = 1024;\n// 30 days\nconst STORED_HEARTBEAT_RETENTION_MAX_MILLIS = 30 * 24 * 60 * 60 * 1000;\nclass HeartbeatServiceImpl {\n constructor(container) {\n this.container = container;\n /**\r\n * In-memory cache for heartbeats, used by getHeartbeatsHeader() to generate\r\n * the header string.\r\n * Stores one record per date. This will be consolidated into the standard\r\n * format of one record per user agent string before being sent as a header.\r\n * Populated from indexedDB when the controller is instantiated and should\r\n * be kept in sync with indexedDB.\r\n * Leave public for easier testing.\r\n */\n this._heartbeatsCache = null;\n const app = this.container.getProvider('app').getImmediate();\n this._storage = new HeartbeatStorageImpl(app);\n this._heartbeatsCachePromise = this._storage.read().then(result => {\n this._heartbeatsCache = result;\n return result;\n });\n }\n /**\r\n * Called to report a heartbeat. The function will generate\r\n * a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it\r\n * to IndexedDB.\r\n * Note that we only store one heartbeat per day. So if a heartbeat for today is\r\n * already logged, subsequent calls to this function in the same day will be ignored.\r\n */\n async triggerHeartbeat() {\n var _a, _b;\n const platformLogger = this.container.getProvider('platform-logger').getImmediate();\n // This is the \"Firebase user agent\" string from the platform logger\n // service, not the browser user agent.\n const agent = platformLogger.getPlatformInfoString();\n const date = getUTCDateString();\n if (((_a = this._heartbeatsCache) === null || _a === void 0 ? void 0 : _a.heartbeats) == null) {\n this._heartbeatsCache = await this._heartbeatsCachePromise;\n // If we failed to construct a heartbeats cache, then return immediately.\n if (((_b = this._heartbeatsCache) === null || _b === void 0 ? void 0 : _b.heartbeats) == null) {\n return;\n }\n }\n // Do not store a heartbeat if one is already stored for this day\n // or if a header has already been sent today.\n if (this._heartbeatsCache.lastSentHeartbeatDate === date || this._heartbeatsCache.heartbeats.some(singleDateHeartbeat => singleDateHeartbeat.date === date)) {\n return;\n } else {\n // There is no entry for this date. Create one.\n this._heartbeatsCache.heartbeats.push({\n date,\n agent\n });\n }\n // Remove entries older than 30 days.\n this._heartbeatsCache.heartbeats = this._heartbeatsCache.heartbeats.filter(singleDateHeartbeat => {\n const hbTimestamp = new Date(singleDateHeartbeat.date).valueOf();\n const now = Date.now();\n return now - hbTimestamp <= STORED_HEARTBEAT_RETENTION_MAX_MILLIS;\n });\n return this._storage.overwrite(this._heartbeatsCache);\n }\n /**\r\n * Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.\r\n * It also clears all heartbeats from memory as well as in IndexedDB.\r\n *\r\n * NOTE: Consuming product SDKs should not send the header if this method\r\n * returns an empty string.\r\n */\n async getHeartbeatsHeader() {\n var _a;\n if (this._heartbeatsCache === null) {\n await this._heartbeatsCachePromise;\n }\n // If it's still null or the array is empty, there is no data to send.\n if (((_a = this._heartbeatsCache) === null || _a === void 0 ? void 0 : _a.heartbeats) == null || this._heartbeatsCache.heartbeats.length === 0) {\n return '';\n }\n const date = getUTCDateString();\n // Extract as many heartbeats from the cache as will fit under the size limit.\n const {\n heartbeatsToSend,\n unsentEntries\n } = extractHeartbeatsForHeader(this._heartbeatsCache.heartbeats);\n const headerString = base64urlEncodeWithoutPadding(JSON.stringify({\n version: 2,\n heartbeats: heartbeatsToSend\n }));\n // Store last sent date to prevent another being logged/sent for the same day.\n this._heartbeatsCache.lastSentHeartbeatDate = date;\n if (unsentEntries.length > 0) {\n // Store any unsent entries if they exist.\n this._heartbeatsCache.heartbeats = unsentEntries;\n // This seems more likely than emptying the array (below) to lead to some odd state\n // since the cache isn't empty and this will be called again on the next request,\n // and is probably safest if we await it.\n await this._storage.overwrite(this._heartbeatsCache);\n } else {\n this._heartbeatsCache.heartbeats = [];\n // Do not wait for this, to reduce latency.\n void this._storage.overwrite(this._heartbeatsCache);\n }\n return headerString;\n }\n}\nfunction getUTCDateString() {\n const today = new Date();\n // Returns date format 'YYYY-MM-DD'\n return today.toISOString().substring(0, 10);\n}\nfunction extractHeartbeatsForHeader(heartbeatsCache, maxSize = MAX_HEADER_BYTES) {\n // Heartbeats grouped by user agent in the standard format to be sent in\n // the header.\n const heartbeatsToSend = [];\n // Single date format heartbeats that are not sent.\n let unsentEntries = heartbeatsCache.slice();\n for (const singleDateHeartbeat of heartbeatsCache) {\n // Look for an existing entry with the same user agent.\n const heartbeatEntry = heartbeatsToSend.find(hb => hb.agent === singleDateHeartbeat.agent);\n if (!heartbeatEntry) {\n // If no entry for this user agent exists, create one.\n heartbeatsToSend.push({\n agent: singleDateHeartbeat.agent,\n dates: [singleDateHeartbeat.date]\n });\n if (countBytes(heartbeatsToSend) > maxSize) {\n // If the header would exceed max size, remove the added heartbeat\n // entry and stop adding to the header.\n heartbeatsToSend.pop();\n break;\n }\n } else {\n heartbeatEntry.dates.push(singleDateHeartbeat.date);\n // If the header would exceed max size, remove the added date\n // and stop adding to the header.\n if (countBytes(heartbeatsToSend) > maxSize) {\n heartbeatEntry.dates.pop();\n break;\n }\n }\n // Pop unsent entry from queue. (Skipped if adding the entry exceeded\n // quota and the loop breaks early.)\n unsentEntries = unsentEntries.slice(1);\n }\n return {\n heartbeatsToSend,\n unsentEntries\n };\n}\nclass HeartbeatStorageImpl {\n constructor(app) {\n this.app = app;\n this._canUseIndexedDBPromise = this.runIndexedDBEnvironmentCheck();\n }\n async runIndexedDBEnvironmentCheck() {\n if (!isIndexedDBAvailable()) {\n return false;\n } else {\n return validateIndexedDBOpenable().then(() => true).catch(() => false);\n }\n }\n /**\r\n * Read all heartbeats.\r\n */\n async read() {\n const canUseIndexedDB = await this._canUseIndexedDBPromise;\n if (!canUseIndexedDB) {\n return {\n heartbeats: []\n };\n } else {\n const idbHeartbeatObject = await readHeartbeatsFromIndexedDB(this.app);\n if (idbHeartbeatObject === null || idbHeartbeatObject === void 0 ? void 0 : idbHeartbeatObject.heartbeats) {\n return idbHeartbeatObject;\n } else {\n return {\n heartbeats: []\n };\n }\n }\n }\n // overwrite the storage with the provided heartbeats\n async overwrite(heartbeatsObject) {\n var _a;\n const canUseIndexedDB = await this._canUseIndexedDBPromise;\n if (!canUseIndexedDB) {\n return;\n } else {\n const existingHeartbeatsObject = await this.read();\n return writeHeartbeatsToIndexedDB(this.app, {\n lastSentHeartbeatDate: (_a = heartbeatsObject.lastSentHeartbeatDate) !== null && _a !== void 0 ? _a : existingHeartbeatsObject.lastSentHeartbeatDate,\n heartbeats: heartbeatsObject.heartbeats\n });\n }\n }\n // add heartbeats\n async add(heartbeatsObject) {\n var _a;\n const canUseIndexedDB = await this._canUseIndexedDBPromise;\n if (!canUseIndexedDB) {\n return;\n } else {\n const existingHeartbeatsObject = await this.read();\n return writeHeartbeatsToIndexedDB(this.app, {\n lastSentHeartbeatDate: (_a = heartbeatsObject.lastSentHeartbeatDate) !== null && _a !== void 0 ? _a : existingHeartbeatsObject.lastSentHeartbeatDate,\n heartbeats: [...existingHeartbeatsObject.heartbeats, ...heartbeatsObject.heartbeats]\n });\n }\n }\n}\n/**\r\n * Calculate bytes of a HeartbeatsByUserAgent array after being wrapped\r\n * in a platform logging header JSON object, stringified, and converted\r\n * to base 64.\r\n */\nfunction countBytes(heartbeatsCache) {\n // base64 has a restricted set of characters, all of which should be 1 byte.\n return base64urlEncodeWithoutPadding(\n // heartbeatsCache wrapper properties\n JSON.stringify({\n version: 2,\n heartbeats: heartbeatsCache\n })).length;\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction registerCoreComponents(variant) {\n _registerComponent(new Component('platform-logger', container => new PlatformLoggerServiceImpl(container), \"PRIVATE\" /* ComponentType.PRIVATE */));\n _registerComponent(new Component('heartbeat', container => new HeartbeatServiceImpl(container), \"PRIVATE\" /* ComponentType.PRIVATE */));\n // Register `app` package.\n registerVersion(name$p, version$1, variant);\n // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation\n registerVersion(name$p, version$1, 'esm2017');\n // Register platform SDK identifier (no version).\n registerVersion('fire-js', '');\n}\n\n/**\r\n * Firebase App\r\n *\r\n * @remarks This package coordinates the communication between the different Firebase components\r\n * @packageDocumentation\r\n */\nregisterCoreComponents('');\nexport { SDK_VERSION, DEFAULT_ENTRY_NAME as _DEFAULT_ENTRY_NAME, _addComponent, _addOrOverwriteComponent, _apps, _clearComponents, _components, _getProvider, _isFirebaseApp, _isFirebaseServerApp, _registerComponent, _removeServiceInstance, _serverApps, deleteApp, getApp, getApps, initializeApp, initializeServerApp, onLog, registerVersion, setLogLevel };\n","import { _getProvider, getApp, _registerComponent, registerVersion } from '@firebase/app';\nimport { Component } from '@firebase/component';\nimport { ErrorFactory, FirebaseError } from '@firebase/util';\nimport { openDB } from 'idb';\nconst name = \"@firebase/installations\";\nconst version = \"0.6.8\";\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst PENDING_TIMEOUT_MS = 10000;\nconst PACKAGE_VERSION = `w:${version}`;\nconst INTERNAL_AUTH_VERSION = 'FIS_v2';\nconst INSTALLATIONS_API_URL = 'https://firebaseinstallations.googleapis.com/v1';\nconst TOKEN_EXPIRATION_BUFFER = 60 * 60 * 1000; // One hour\nconst SERVICE = 'installations';\nconst SERVICE_NAME = 'Installations';\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst ERROR_DESCRIPTION_MAP = {\n [\"missing-app-config-values\" /* ErrorCode.MISSING_APP_CONFIG_VALUES */]: 'Missing App configuration value: \"{$valueName}\"',\n [\"not-registered\" /* ErrorCode.NOT_REGISTERED */]: 'Firebase Installation is not registered.',\n [\"installation-not-found\" /* ErrorCode.INSTALLATION_NOT_FOUND */]: 'Firebase Installation not found.',\n [\"request-failed\" /* ErrorCode.REQUEST_FAILED */]: '{$requestName} request failed with error \"{$serverCode} {$serverStatus}: {$serverMessage}\"',\n [\"app-offline\" /* ErrorCode.APP_OFFLINE */]: 'Could not process request. Application offline.',\n [\"delete-pending-registration\" /* ErrorCode.DELETE_PENDING_REGISTRATION */]: \"Can't delete installation while there is a pending registration request.\"\n};\nconst ERROR_FACTORY = new ErrorFactory(SERVICE, SERVICE_NAME, ERROR_DESCRIPTION_MAP);\n/** Returns true if error is a FirebaseError that is based on an error from the server. */\nfunction isServerError(error) {\n return error instanceof FirebaseError && error.code.includes(\"request-failed\" /* ErrorCode.REQUEST_FAILED */);\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction getInstallationsEndpoint({\n projectId\n}) {\n return `${INSTALLATIONS_API_URL}/projects/${projectId}/installations`;\n}\nfunction extractAuthTokenInfoFromResponse(response) {\n return {\n token: response.token,\n requestStatus: 2 /* RequestStatus.COMPLETED */,\n expiresIn: getExpiresInFromResponseExpiresIn(response.expiresIn),\n creationTime: Date.now()\n };\n}\nasync function getErrorFromResponse(requestName, response) {\n const responseJson = await response.json();\n const errorData = responseJson.error;\n return ERROR_FACTORY.create(\"request-failed\" /* ErrorCode.REQUEST_FAILED */, {\n requestName,\n serverCode: errorData.code,\n serverMessage: errorData.message,\n serverStatus: errorData.status\n });\n}\nfunction getHeaders({\n apiKey\n}) {\n return new Headers({\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n 'x-goog-api-key': apiKey\n });\n}\nfunction getHeadersWithAuth(appConfig, {\n refreshToken\n}) {\n const headers = getHeaders(appConfig);\n headers.append('Authorization', getAuthorizationHeader(refreshToken));\n return headers;\n}\n/**\r\n * Calls the passed in fetch wrapper and returns the response.\r\n * If the returned response has a status of 5xx, re-runs the function once and\r\n * returns the response.\r\n */\nasync function retryIfServerError(fn) {\n const result = await fn();\n if (result.status >= 500 && result.status < 600) {\n // Internal Server Error. Retry request.\n return fn();\n }\n return result;\n}\nfunction getExpiresInFromResponseExpiresIn(responseExpiresIn) {\n // This works because the server will never respond with fractions of a second.\n return Number(responseExpiresIn.replace('s', '000'));\n}\nfunction getAuthorizationHeader(refreshToken) {\n return `${INTERNAL_AUTH_VERSION} ${refreshToken}`;\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nasync function createInstallationRequest({\n appConfig,\n heartbeatServiceProvider\n}, {\n fid\n}) {\n const endpoint = getInstallationsEndpoint(appConfig);\n const headers = getHeaders(appConfig);\n // If heartbeat service exists, add the heartbeat string to the header.\n const heartbeatService = heartbeatServiceProvider.getImmediate({\n optional: true\n });\n if (heartbeatService) {\n const heartbeatsHeader = await heartbeatService.getHeartbeatsHeader();\n if (heartbeatsHeader) {\n headers.append('x-firebase-client', heartbeatsHeader);\n }\n }\n const body = {\n fid,\n authVersion: INTERNAL_AUTH_VERSION,\n appId: appConfig.appId,\n sdkVersion: PACKAGE_VERSION\n };\n const request = {\n method: 'POST',\n headers,\n body: JSON.stringify(body)\n };\n const response = await retryIfServerError(() => fetch(endpoint, request));\n if (response.ok) {\n const responseValue = await response.json();\n const registeredInstallationEntry = {\n fid: responseValue.fid || fid,\n registrationStatus: 2 /* RequestStatus.COMPLETED */,\n refreshToken: responseValue.refreshToken,\n authToken: extractAuthTokenInfoFromResponse(responseValue.authToken)\n };\n return registeredInstallationEntry;\n } else {\n throw await getErrorFromResponse('Create Installation', response);\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/** Returns a promise that resolves after given time passes. */\nfunction sleep(ms) {\n return new Promise(resolve => {\n setTimeout(resolve, ms);\n });\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction bufferToBase64UrlSafe(array) {\n const b64 = btoa(String.fromCharCode(...array));\n return b64.replace(/\\+/g, '-').replace(/\\//g, '_');\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst VALID_FID_PATTERN = /^[cdef][\\w-]{21}$/;\nconst INVALID_FID = '';\n/**\r\n * Generates a new FID using random values from Web Crypto API.\r\n * Returns an empty string if FID generation fails for any reason.\r\n */\nfunction generateFid() {\n try {\n // A valid FID has exactly 22 base64 characters, which is 132 bits, or 16.5\n // bytes. our implementation generates a 17 byte array instead.\n const fidByteArray = new Uint8Array(17);\n const crypto = self.crypto || self.msCrypto;\n crypto.getRandomValues(fidByteArray);\n // Replace the first 4 random bits with the constant FID header of 0b0111.\n fidByteArray[0] = 0b01110000 + fidByteArray[0] % 0b00010000;\n const fid = encode(fidByteArray);\n return VALID_FID_PATTERN.test(fid) ? fid : INVALID_FID;\n } catch (_a) {\n // FID generation errored\n return INVALID_FID;\n }\n}\n/** Converts a FID Uint8Array to a base64 string representation. */\nfunction encode(fidByteArray) {\n const b64String = bufferToBase64UrlSafe(fidByteArray);\n // Remove the 23rd character that was added because of the extra 4 bits at the\n // end of our 17 byte array, and the '=' padding.\n return b64String.substr(0, 22);\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/** Returns a string key that can be used to identify the app. */\nfunction getKey(appConfig) {\n return `${appConfig.appName}!${appConfig.appId}`;\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst fidChangeCallbacks = new Map();\n/**\r\n * Calls the onIdChange callbacks with the new FID value, and broadcasts the\r\n * change to other tabs.\r\n */\nfunction fidChanged(appConfig, fid) {\n const key = getKey(appConfig);\n callFidChangeCallbacks(key, fid);\n broadcastFidChange(key, fid);\n}\nfunction addCallback(appConfig, callback) {\n // Open the broadcast channel if it's not already open,\n // to be able to listen to change events from other tabs.\n getBroadcastChannel();\n const key = getKey(appConfig);\n let callbackSet = fidChangeCallbacks.get(key);\n if (!callbackSet) {\n callbackSet = new Set();\n fidChangeCallbacks.set(key, callbackSet);\n }\n callbackSet.add(callback);\n}\nfunction removeCallback(appConfig, callback) {\n const key = getKey(appConfig);\n const callbackSet = fidChangeCallbacks.get(key);\n if (!callbackSet) {\n return;\n }\n callbackSet.delete(callback);\n if (callbackSet.size === 0) {\n fidChangeCallbacks.delete(key);\n }\n // Close broadcast channel if there are no more callbacks.\n closeBroadcastChannel();\n}\nfunction callFidChangeCallbacks(key, fid) {\n const callbacks = fidChangeCallbacks.get(key);\n if (!callbacks) {\n return;\n }\n for (const callback of callbacks) {\n callback(fid);\n }\n}\nfunction broadcastFidChange(key, fid) {\n const channel = getBroadcastChannel();\n if (channel) {\n channel.postMessage({\n key,\n fid\n });\n }\n closeBroadcastChannel();\n}\nlet broadcastChannel = null;\n/** Opens and returns a BroadcastChannel if it is supported by the browser. */\nfunction getBroadcastChannel() {\n if (!broadcastChannel && 'BroadcastChannel' in self) {\n broadcastChannel = new BroadcastChannel('[Firebase] FID Change');\n broadcastChannel.onmessage = e => {\n callFidChangeCallbacks(e.data.key, e.data.fid);\n };\n }\n return broadcastChannel;\n}\nfunction closeBroadcastChannel() {\n if (fidChangeCallbacks.size === 0 && broadcastChannel) {\n broadcastChannel.close();\n broadcastChannel = null;\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst DATABASE_NAME = 'firebase-installations-database';\nconst DATABASE_VERSION = 1;\nconst OBJECT_STORE_NAME = 'firebase-installations-store';\nlet dbPromise = null;\nfunction getDbPromise() {\n if (!dbPromise) {\n dbPromise = openDB(DATABASE_NAME, DATABASE_VERSION, {\n upgrade: (db, oldVersion) => {\n // We don't use 'break' in this switch statement, the fall-through\n // behavior is what we want, because if there are multiple versions between\n // the old version and the current version, we want ALL the migrations\n // that correspond to those versions to run, not only the last one.\n // eslint-disable-next-line default-case\n switch (oldVersion) {\n case 0:\n db.createObjectStore(OBJECT_STORE_NAME);\n }\n }\n });\n }\n return dbPromise;\n}\n/** Assigns or overwrites the record for the given key with the given value. */\nasync function set(appConfig, value) {\n const key = getKey(appConfig);\n const db = await getDbPromise();\n const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');\n const objectStore = tx.objectStore(OBJECT_STORE_NAME);\n const oldValue = await objectStore.get(key);\n await objectStore.put(value, key);\n await tx.done;\n if (!oldValue || oldValue.fid !== value.fid) {\n fidChanged(appConfig, value.fid);\n }\n return value;\n}\n/** Removes record(s) from the objectStore that match the given key. */\nasync function remove(appConfig) {\n const key = getKey(appConfig);\n const db = await getDbPromise();\n const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');\n await tx.objectStore(OBJECT_STORE_NAME).delete(key);\n await tx.done;\n}\n/**\r\n * Atomically updates a record with the result of updateFn, which gets\r\n * called with the current value. If newValue is undefined, the record is\r\n * deleted instead.\r\n * @return Updated value\r\n */\nasync function update(appConfig, updateFn) {\n const key = getKey(appConfig);\n const db = await getDbPromise();\n const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');\n const store = tx.objectStore(OBJECT_STORE_NAME);\n const oldValue = await store.get(key);\n const newValue = updateFn(oldValue);\n if (newValue === undefined) {\n await store.delete(key);\n } else {\n await store.put(newValue, key);\n }\n await tx.done;\n if (newValue && (!oldValue || oldValue.fid !== newValue.fid)) {\n fidChanged(appConfig, newValue.fid);\n }\n return newValue;\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Updates and returns the InstallationEntry from the database.\r\n * Also triggers a registration request if it is necessary and possible.\r\n */\nasync function getInstallationEntry(installations) {\n let registrationPromise;\n const installationEntry = await update(installations.appConfig, oldEntry => {\n const installationEntry = updateOrCreateInstallationEntry(oldEntry);\n const entryWithPromise = triggerRegistrationIfNecessary(installations, installationEntry);\n registrationPromise = entryWithPromise.registrationPromise;\n return entryWithPromise.installationEntry;\n });\n if (installationEntry.fid === INVALID_FID) {\n // FID generation failed. Waiting for the FID from the server.\n return {\n installationEntry: await registrationPromise\n };\n }\n return {\n installationEntry,\n registrationPromise\n };\n}\n/**\r\n * Creates a new Installation Entry if one does not exist.\r\n * Also clears timed out pending requests.\r\n */\nfunction updateOrCreateInstallationEntry(oldEntry) {\n const entry = oldEntry || {\n fid: generateFid(),\n registrationStatus: 0 /* RequestStatus.NOT_STARTED */\n };\n return clearTimedOutRequest(entry);\n}\n/**\r\n * If the Firebase Installation is not registered yet, this will trigger the\r\n * registration and return an InProgressInstallationEntry.\r\n *\r\n * If registrationPromise does not exist, the installationEntry is guaranteed\r\n * to be registered.\r\n */\nfunction triggerRegistrationIfNecessary(installations, installationEntry) {\n if (installationEntry.registrationStatus === 0 /* RequestStatus.NOT_STARTED */) {\n if (!navigator.onLine) {\n // Registration required but app is offline.\n const registrationPromiseWithError = Promise.reject(ERROR_FACTORY.create(\"app-offline\" /* ErrorCode.APP_OFFLINE */));\n return {\n installationEntry,\n registrationPromise: registrationPromiseWithError\n };\n }\n // Try registering. Change status to IN_PROGRESS.\n const inProgressEntry = {\n fid: installationEntry.fid,\n registrationStatus: 1 /* RequestStatus.IN_PROGRESS */,\n registrationTime: Date.now()\n };\n const registrationPromise = registerInstallation(installations, inProgressEntry);\n return {\n installationEntry: inProgressEntry,\n registrationPromise\n };\n } else if (installationEntry.registrationStatus === 1 /* RequestStatus.IN_PROGRESS */) {\n return {\n installationEntry,\n registrationPromise: waitUntilFidRegistration(installations)\n };\n } else {\n return {\n installationEntry\n };\n }\n}\n/** This will be executed only once for each new Firebase Installation. */\nasync function registerInstallation(installations, installationEntry) {\n try {\n const registeredInstallationEntry = await createInstallationRequest(installations, installationEntry);\n return set(installations.appConfig, registeredInstallationEntry);\n } catch (e) {\n if (isServerError(e) && e.customData.serverCode === 409) {\n // Server returned a \"FID can not be used\" error.\n // Generate a new ID next time.\n await remove(installations.appConfig);\n } else {\n // Registration failed. Set FID as not registered.\n await set(installations.appConfig, {\n fid: installationEntry.fid,\n registrationStatus: 0 /* RequestStatus.NOT_STARTED */\n });\n }\n throw e;\n }\n}\n/** Call if FID registration is pending in another request. */\nasync function waitUntilFidRegistration(installations) {\n // Unfortunately, there is no way of reliably observing when a value in\n // IndexedDB changes (yet, see https://github.com/WICG/indexed-db-observers),\n // so we need to poll.\n let entry = await updateInstallationRequest(installations.appConfig);\n while (entry.registrationStatus === 1 /* RequestStatus.IN_PROGRESS */) {\n // createInstallation request still in progress.\n await sleep(100);\n entry = await updateInstallationRequest(installations.appConfig);\n }\n if (entry.registrationStatus === 0 /* RequestStatus.NOT_STARTED */) {\n // The request timed out or failed in a different call. Try again.\n const {\n installationEntry,\n registrationPromise\n } = await getInstallationEntry(installations);\n if (registrationPromise) {\n return registrationPromise;\n } else {\n // if there is no registrationPromise, entry is registered.\n return installationEntry;\n }\n }\n return entry;\n}\n/**\r\n * Called only if there is a CreateInstallation request in progress.\r\n *\r\n * Updates the InstallationEntry in the DB based on the status of the\r\n * CreateInstallation request.\r\n *\r\n * Returns the updated InstallationEntry.\r\n */\nfunction updateInstallationRequest(appConfig) {\n return update(appConfig, oldEntry => {\n if (!oldEntry) {\n throw ERROR_FACTORY.create(\"installation-not-found\" /* ErrorCode.INSTALLATION_NOT_FOUND */);\n }\n return clearTimedOutRequest(oldEntry);\n });\n}\nfunction clearTimedOutRequest(entry) {\n if (hasInstallationRequestTimedOut(entry)) {\n return {\n fid: entry.fid,\n registrationStatus: 0 /* RequestStatus.NOT_STARTED */\n };\n }\n return entry;\n}\nfunction hasInstallationRequestTimedOut(installationEntry) {\n return installationEntry.registrationStatus === 1 /* RequestStatus.IN_PROGRESS */ && installationEntry.registrationTime + PENDING_TIMEOUT_MS < Date.now();\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nasync function generateAuthTokenRequest({\n appConfig,\n heartbeatServiceProvider\n}, installationEntry) {\n const endpoint = getGenerateAuthTokenEndpoint(appConfig, installationEntry);\n const headers = getHeadersWithAuth(appConfig, installationEntry);\n // If heartbeat service exists, add the heartbeat string to the header.\n const heartbeatService = heartbeatServiceProvider.getImmediate({\n optional: true\n });\n if (heartbeatService) {\n const heartbeatsHeader = await heartbeatService.getHeartbeatsHeader();\n if (heartbeatsHeader) {\n headers.append('x-firebase-client', heartbeatsHeader);\n }\n }\n const body = {\n installation: {\n sdkVersion: PACKAGE_VERSION,\n appId: appConfig.appId\n }\n };\n const request = {\n method: 'POST',\n headers,\n body: JSON.stringify(body)\n };\n const response = await retryIfServerError(() => fetch(endpoint, request));\n if (response.ok) {\n const responseValue = await response.json();\n const completedAuthToken = extractAuthTokenInfoFromResponse(responseValue);\n return completedAuthToken;\n } else {\n throw await getErrorFromResponse('Generate Auth Token', response);\n }\n}\nfunction getGenerateAuthTokenEndpoint(appConfig, {\n fid\n}) {\n return `${getInstallationsEndpoint(appConfig)}/${fid}/authTokens:generate`;\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Returns a valid authentication token for the installation. Generates a new\r\n * token if one doesn't exist, is expired or about to expire.\r\n *\r\n * Should only be called if the Firebase Installation is registered.\r\n */\nasync function refreshAuthToken(installations, forceRefresh = false) {\n let tokenPromise;\n const entry = await update(installations.appConfig, oldEntry => {\n if (!isEntryRegistered(oldEntry)) {\n throw ERROR_FACTORY.create(\"not-registered\" /* ErrorCode.NOT_REGISTERED */);\n }\n const oldAuthToken = oldEntry.authToken;\n if (!forceRefresh && isAuthTokenValid(oldAuthToken)) {\n // There is a valid token in the DB.\n return oldEntry;\n } else if (oldAuthToken.requestStatus === 1 /* RequestStatus.IN_PROGRESS */) {\n // There already is a token request in progress.\n tokenPromise = waitUntilAuthTokenRequest(installations, forceRefresh);\n return oldEntry;\n } else {\n // No token or token expired.\n if (!navigator.onLine) {\n throw ERROR_FACTORY.create(\"app-offline\" /* ErrorCode.APP_OFFLINE */);\n }\n const inProgressEntry = makeAuthTokenRequestInProgressEntry(oldEntry);\n tokenPromise = fetchAuthTokenFromServer(installations, inProgressEntry);\n return inProgressEntry;\n }\n });\n const authToken = tokenPromise ? await tokenPromise : entry.authToken;\n return authToken;\n}\n/**\r\n * Call only if FID is registered and Auth Token request is in progress.\r\n *\r\n * Waits until the current pending request finishes. If the request times out,\r\n * tries once in this thread as well.\r\n */\nasync function waitUntilAuthTokenRequest(installations, forceRefresh) {\n // Unfortunately, there is no way of reliably observing when a value in\n // IndexedDB changes (yet, see https://github.com/WICG/indexed-db-observers),\n // so we need to poll.\n let entry = await updateAuthTokenRequest(installations.appConfig);\n while (entry.authToken.requestStatus === 1 /* RequestStatus.IN_PROGRESS */) {\n // generateAuthToken still in progress.\n await sleep(100);\n entry = await updateAuthTokenRequest(installations.appConfig);\n }\n const authToken = entry.authToken;\n if (authToken.requestStatus === 0 /* RequestStatus.NOT_STARTED */) {\n // The request timed out or failed in a different call. Try again.\n return refreshAuthToken(installations, forceRefresh);\n } else {\n return authToken;\n }\n}\n/**\r\n * Called only if there is a GenerateAuthToken request in progress.\r\n *\r\n * Updates the InstallationEntry in the DB based on the status of the\r\n * GenerateAuthToken request.\r\n *\r\n * Returns the updated InstallationEntry.\r\n */\nfunction updateAuthTokenRequest(appConfig) {\n return update(appConfig, oldEntry => {\n if (!isEntryRegistered(oldEntry)) {\n throw ERROR_FACTORY.create(\"not-registered\" /* ErrorCode.NOT_REGISTERED */);\n }\n const oldAuthToken = oldEntry.authToken;\n if (hasAuthTokenRequestTimedOut(oldAuthToken)) {\n return Object.assign(Object.assign({}, oldEntry), {\n authToken: {\n requestStatus: 0 /* RequestStatus.NOT_STARTED */\n }\n });\n }\n return oldEntry;\n });\n}\nasync function fetchAuthTokenFromServer(installations, installationEntry) {\n try {\n const authToken = await generateAuthTokenRequest(installations, installationEntry);\n const updatedInstallationEntry = Object.assign(Object.assign({}, installationEntry), {\n authToken\n });\n await set(installations.appConfig, updatedInstallationEntry);\n return authToken;\n } catch (e) {\n if (isServerError(e) && (e.customData.serverCode === 401 || e.customData.serverCode === 404)) {\n // Server returned a \"FID not found\" or a \"Invalid authentication\" error.\n // Generate a new ID next time.\n await remove(installations.appConfig);\n } else {\n const updatedInstallationEntry = Object.assign(Object.assign({}, installationEntry), {\n authToken: {\n requestStatus: 0 /* RequestStatus.NOT_STARTED */\n }\n });\n await set(installations.appConfig, updatedInstallationEntry);\n }\n throw e;\n }\n}\nfunction isEntryRegistered(installationEntry) {\n return installationEntry !== undefined && installationEntry.registrationStatus === 2 /* RequestStatus.COMPLETED */;\n}\nfunction isAuthTokenValid(authToken) {\n return authToken.requestStatus === 2 /* RequestStatus.COMPLETED */ && !isAuthTokenExpired(authToken);\n}\nfunction isAuthTokenExpired(authToken) {\n const now = Date.now();\n return now < authToken.creationTime || authToken.creationTime + authToken.expiresIn < now + TOKEN_EXPIRATION_BUFFER;\n}\n/** Returns an updated InstallationEntry with an InProgressAuthToken. */\nfunction makeAuthTokenRequestInProgressEntry(oldEntry) {\n const inProgressAuthToken = {\n requestStatus: 1 /* RequestStatus.IN_PROGRESS */,\n requestTime: Date.now()\n };\n return Object.assign(Object.assign({}, oldEntry), {\n authToken: inProgressAuthToken\n });\n}\nfunction hasAuthTokenRequestTimedOut(authToken) {\n return authToken.requestStatus === 1 /* RequestStatus.IN_PROGRESS */ && authToken.requestTime + PENDING_TIMEOUT_MS < Date.now();\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Creates a Firebase Installation if there isn't one for the app and\r\n * returns the Installation ID.\r\n * @param installations - The `Installations` instance.\r\n *\r\n * @public\r\n */\nasync function getId(installations) {\n const installationsImpl = installations;\n const {\n installationEntry,\n registrationPromise\n } = await getInstallationEntry(installationsImpl);\n if (registrationPromise) {\n registrationPromise.catch(console.error);\n } else {\n // If the installation is already registered, update the authentication\n // token if needed.\n refreshAuthToken(installationsImpl).catch(console.error);\n }\n return installationEntry.fid;\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Returns a Firebase Installations auth token, identifying the current\r\n * Firebase Installation.\r\n * @param installations - The `Installations` instance.\r\n * @param forceRefresh - Force refresh regardless of token expiration.\r\n *\r\n * @public\r\n */\nasync function getToken(installations, forceRefresh = false) {\n const installationsImpl = installations;\n await completeInstallationRegistration(installationsImpl);\n // At this point we either have a Registered Installation in the DB, or we've\n // already thrown an error.\n const authToken = await refreshAuthToken(installationsImpl, forceRefresh);\n return authToken.token;\n}\nasync function completeInstallationRegistration(installations) {\n const {\n registrationPromise\n } = await getInstallationEntry(installations);\n if (registrationPromise) {\n // A createInstallation request is in progress. Wait until it finishes.\n await registrationPromise;\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nasync function deleteInstallationRequest(appConfig, installationEntry) {\n const endpoint = getDeleteEndpoint(appConfig, installationEntry);\n const headers = getHeadersWithAuth(appConfig, installationEntry);\n const request = {\n method: 'DELETE',\n headers\n };\n const response = await retryIfServerError(() => fetch(endpoint, request));\n if (!response.ok) {\n throw await getErrorFromResponse('Delete Installation', response);\n }\n}\nfunction getDeleteEndpoint(appConfig, {\n fid\n}) {\n return `${getInstallationsEndpoint(appConfig)}/${fid}`;\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Deletes the Firebase Installation and all associated data.\r\n * @param installations - The `Installations` instance.\r\n *\r\n * @public\r\n */\nasync function deleteInstallations(installations) {\n const {\n appConfig\n } = installations;\n const entry = await update(appConfig, oldEntry => {\n if (oldEntry && oldEntry.registrationStatus === 0 /* RequestStatus.NOT_STARTED */) {\n // Delete the unregistered entry without sending a deleteInstallation request.\n return undefined;\n }\n return oldEntry;\n });\n if (entry) {\n if (entry.registrationStatus === 1 /* RequestStatus.IN_PROGRESS */) {\n // Can't delete while trying to register.\n throw ERROR_FACTORY.create(\"delete-pending-registration\" /* ErrorCode.DELETE_PENDING_REGISTRATION */);\n } else if (entry.registrationStatus === 2 /* RequestStatus.COMPLETED */) {\n if (!navigator.onLine) {\n throw ERROR_FACTORY.create(\"app-offline\" /* ErrorCode.APP_OFFLINE */);\n } else {\n await deleteInstallationRequest(appConfig, entry);\n await remove(appConfig);\n }\n }\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Sets a new callback that will get called when Installation ID changes.\r\n * Returns an unsubscribe function that will remove the callback when called.\r\n * @param installations - The `Installations` instance.\r\n * @param callback - The callback function that is invoked when FID changes.\r\n * @returns A function that can be called to unsubscribe.\r\n *\r\n * @public\r\n */\nfunction onIdChange(installations, callback) {\n const {\n appConfig\n } = installations;\n addCallback(appConfig, callback);\n return () => {\n removeCallback(appConfig, callback);\n };\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Returns an instance of {@link Installations} associated with the given\r\n * {@link @firebase/app#FirebaseApp} instance.\r\n * @param app - The {@link @firebase/app#FirebaseApp} instance.\r\n *\r\n * @public\r\n */\nfunction getInstallations(app = getApp()) {\n const installationsImpl = _getProvider(app, 'installations').getImmediate();\n return installationsImpl;\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction extractAppConfig(app) {\n if (!app || !app.options) {\n throw getMissingValueError('App Configuration');\n }\n if (!app.name) {\n throw getMissingValueError('App Name');\n }\n // Required app config keys\n const configKeys = ['projectId', 'apiKey', 'appId'];\n for (const keyName of configKeys) {\n if (!app.options[keyName]) {\n throw getMissingValueError(keyName);\n }\n }\n return {\n appName: app.name,\n projectId: app.options.projectId,\n apiKey: app.options.apiKey,\n appId: app.options.appId\n };\n}\nfunction getMissingValueError(valueName) {\n return ERROR_FACTORY.create(\"missing-app-config-values\" /* ErrorCode.MISSING_APP_CONFIG_VALUES */, {\n valueName\n });\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst INSTALLATIONS_NAME = 'installations';\nconst INSTALLATIONS_NAME_INTERNAL = 'installations-internal';\nconst publicFactory = container => {\n const app = container.getProvider('app').getImmediate();\n // Throws if app isn't configured properly.\n const appConfig = extractAppConfig(app);\n const heartbeatServiceProvider = _getProvider(app, 'heartbeat');\n const installationsImpl = {\n app,\n appConfig,\n heartbeatServiceProvider,\n _delete: () => Promise.resolve()\n };\n return installationsImpl;\n};\nconst internalFactory = container => {\n const app = container.getProvider('app').getImmediate();\n // Internal FIS instance relies on public FIS instance.\n const installations = _getProvider(app, INSTALLATIONS_NAME).getImmediate();\n const installationsInternal = {\n getId: () => getId(installations),\n getToken: forceRefresh => getToken(installations, forceRefresh)\n };\n return installationsInternal;\n};\nfunction registerInstallations() {\n _registerComponent(new Component(INSTALLATIONS_NAME, publicFactory, \"PUBLIC\" /* ComponentType.PUBLIC */));\n _registerComponent(new Component(INSTALLATIONS_NAME_INTERNAL, internalFactory, \"PRIVATE\" /* ComponentType.PRIVATE */));\n}\n\n/**\r\n * The Firebase Installations Web SDK.\r\n * This SDK does not work in a Node.js environment.\r\n *\r\n * @packageDocumentation\r\n */\nregisterInstallations();\nregisterVersion(name, version);\n// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation\nregisterVersion(name, version, 'esm2017');\nexport { deleteInstallations, getId, getInstallations, getToken, onIdChange };\n","import '@firebase/installations';\nimport { Component } from '@firebase/component';\nimport { openDB, deleteDB } from 'idb';\nimport { ErrorFactory, validateIndexedDBOpenable, isIndexedDBAvailable, areCookiesEnabled, getModularInstance } from '@firebase/util';\nimport { _registerComponent, registerVersion, _getProvider, getApp } from '@firebase/app';\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst DEFAULT_SW_PATH = '/firebase-messaging-sw.js';\nconst DEFAULT_SW_SCOPE = '/firebase-cloud-messaging-push-scope';\nconst DEFAULT_VAPID_KEY = 'BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4';\nconst ENDPOINT = 'https://fcmregistrations.googleapis.com/v1';\nconst CONSOLE_CAMPAIGN_ID = 'google.c.a.c_id';\nconst CONSOLE_CAMPAIGN_NAME = 'google.c.a.c_l';\nconst CONSOLE_CAMPAIGN_TIME = 'google.c.a.ts';\n/** Set to '1' if Analytics is enabled for the campaign */\nconst CONSOLE_CAMPAIGN_ANALYTICS_ENABLED = 'google.c.a.e';\nvar MessageType$1 = /*#__PURE__*/function (MessageType) {\n MessageType[MessageType[\"DATA_MESSAGE\"] = 1] = \"DATA_MESSAGE\";\n MessageType[MessageType[\"DISPLAY_NOTIFICATION\"] = 3] = \"DISPLAY_NOTIFICATION\";\n return MessageType;\n}(MessageType$1 || {});\n/**\r\n * @license\r\n * Copyright 2018 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except\r\n * in compliance with the License. You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software distributed under the License\r\n * is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r\n * or implied. See the License for the specific language governing permissions and limitations under\r\n * the License.\r\n */\nvar MessageType = /*#__PURE__*/function (MessageType) {\n MessageType[\"PUSH_RECEIVED\"] = \"push-received\";\n MessageType[\"NOTIFICATION_CLICKED\"] = \"notification-clicked\";\n return MessageType;\n}(MessageType || {});\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction arrayToBase64(array) {\n const uint8Array = new Uint8Array(array);\n const base64String = btoa(String.fromCharCode(...uint8Array));\n return base64String.replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n}\nfunction base64ToArray(base64String) {\n const padding = '='.repeat((4 - base64String.length % 4) % 4);\n const base64 = (base64String + padding).replace(/\\-/g, '+').replace(/_/g, '/');\n const rawData = atob(base64);\n const outputArray = new Uint8Array(rawData.length);\n for (let i = 0; i < rawData.length; ++i) {\n outputArray[i] = rawData.charCodeAt(i);\n }\n return outputArray;\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst OLD_DB_NAME = 'fcm_token_details_db';\n/**\r\n * The last DB version of 'fcm_token_details_db' was 4. This is one higher, so that the upgrade\r\n * callback is called for all versions of the old DB.\r\n */\nconst OLD_DB_VERSION = 5;\nconst OLD_OBJECT_STORE_NAME = 'fcm_token_object_Store';\nasync function migrateOldDatabase(senderId) {\n if ('databases' in indexedDB) {\n // indexedDb.databases() is an IndexedDB v3 API and does not exist in all browsers. TODO: Remove\n // typecast when it lands in TS types.\n const databases = await indexedDB.databases();\n const dbNames = databases.map(db => db.name);\n if (!dbNames.includes(OLD_DB_NAME)) {\n // old DB didn't exist, no need to open.\n return null;\n }\n }\n let tokenDetails = null;\n const db = await openDB(OLD_DB_NAME, OLD_DB_VERSION, {\n upgrade: async (db, oldVersion, newVersion, upgradeTransaction) => {\n var _a;\n if (oldVersion < 2) {\n // Database too old, skip migration.\n return;\n }\n if (!db.objectStoreNames.contains(OLD_OBJECT_STORE_NAME)) {\n // Database did not exist. Nothing to do.\n return;\n }\n const objectStore = upgradeTransaction.objectStore(OLD_OBJECT_STORE_NAME);\n const value = await objectStore.index('fcmSenderId').get(senderId);\n await objectStore.clear();\n if (!value) {\n // No entry in the database, nothing to migrate.\n return;\n }\n if (oldVersion === 2) {\n const oldDetails = value;\n if (!oldDetails.auth || !oldDetails.p256dh || !oldDetails.endpoint) {\n return;\n }\n tokenDetails = {\n token: oldDetails.fcmToken,\n createTime: (_a = oldDetails.createTime) !== null && _a !== void 0 ? _a : Date.now(),\n subscriptionOptions: {\n auth: oldDetails.auth,\n p256dh: oldDetails.p256dh,\n endpoint: oldDetails.endpoint,\n swScope: oldDetails.swScope,\n vapidKey: typeof oldDetails.vapidKey === 'string' ? oldDetails.vapidKey : arrayToBase64(oldDetails.vapidKey)\n }\n };\n } else if (oldVersion === 3) {\n const oldDetails = value;\n tokenDetails = {\n token: oldDetails.fcmToken,\n createTime: oldDetails.createTime,\n subscriptionOptions: {\n auth: arrayToBase64(oldDetails.auth),\n p256dh: arrayToBase64(oldDetails.p256dh),\n endpoint: oldDetails.endpoint,\n swScope: oldDetails.swScope,\n vapidKey: arrayToBase64(oldDetails.vapidKey)\n }\n };\n } else if (oldVersion === 4) {\n const oldDetails = value;\n tokenDetails = {\n token: oldDetails.fcmToken,\n createTime: oldDetails.createTime,\n subscriptionOptions: {\n auth: arrayToBase64(oldDetails.auth),\n p256dh: arrayToBase64(oldDetails.p256dh),\n endpoint: oldDetails.endpoint,\n swScope: oldDetails.swScope,\n vapidKey: arrayToBase64(oldDetails.vapidKey)\n }\n };\n }\n }\n });\n db.close();\n // Delete all old databases.\n await deleteDB(OLD_DB_NAME);\n await deleteDB('fcm_vapid_details_db');\n await deleteDB('undefined');\n return checkTokenDetails(tokenDetails) ? tokenDetails : null;\n}\nfunction checkTokenDetails(tokenDetails) {\n if (!tokenDetails || !tokenDetails.subscriptionOptions) {\n return false;\n }\n const {\n subscriptionOptions\n } = tokenDetails;\n return typeof tokenDetails.createTime === 'number' && tokenDetails.createTime > 0 && typeof tokenDetails.token === 'string' && tokenDetails.token.length > 0 && typeof subscriptionOptions.auth === 'string' && subscriptionOptions.auth.length > 0 && typeof subscriptionOptions.p256dh === 'string' && subscriptionOptions.p256dh.length > 0 && typeof subscriptionOptions.endpoint === 'string' && subscriptionOptions.endpoint.length > 0 && typeof subscriptionOptions.swScope === 'string' && subscriptionOptions.swScope.length > 0 && typeof subscriptionOptions.vapidKey === 'string' && subscriptionOptions.vapidKey.length > 0;\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n// Exported for tests.\nconst DATABASE_NAME = 'firebase-messaging-database';\nconst DATABASE_VERSION = 1;\nconst OBJECT_STORE_NAME = 'firebase-messaging-store';\nlet dbPromise = null;\nfunction getDbPromise() {\n if (!dbPromise) {\n dbPromise = openDB(DATABASE_NAME, DATABASE_VERSION, {\n upgrade: (upgradeDb, oldVersion) => {\n // We don't use 'break' in this switch statement, the fall-through behavior is what we want,\n // because if there are multiple versions between the old version and the current version, we\n // want ALL the migrations that correspond to those versions to run, not only the last one.\n // eslint-disable-next-line default-case\n switch (oldVersion) {\n case 0:\n upgradeDb.createObjectStore(OBJECT_STORE_NAME);\n }\n }\n });\n }\n return dbPromise;\n}\n/** Gets record(s) from the objectStore that match the given key. */\nasync function dbGet(firebaseDependencies) {\n const key = getKey(firebaseDependencies);\n const db = await getDbPromise();\n const tokenDetails = await db.transaction(OBJECT_STORE_NAME).objectStore(OBJECT_STORE_NAME).get(key);\n if (tokenDetails) {\n return tokenDetails;\n } else {\n // Check if there is a tokenDetails object in the old DB.\n const oldTokenDetails = await migrateOldDatabase(firebaseDependencies.appConfig.senderId);\n if (oldTokenDetails) {\n await dbSet(firebaseDependencies, oldTokenDetails);\n return oldTokenDetails;\n }\n }\n}\n/** Assigns or overwrites the record for the given key with the given value. */\nasync function dbSet(firebaseDependencies, tokenDetails) {\n const key = getKey(firebaseDependencies);\n const db = await getDbPromise();\n const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');\n await tx.objectStore(OBJECT_STORE_NAME).put(tokenDetails, key);\n await tx.done;\n return tokenDetails;\n}\n/** Removes record(s) from the objectStore that match the given key. */\nasync function dbRemove(firebaseDependencies) {\n const key = getKey(firebaseDependencies);\n const db = await getDbPromise();\n const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');\n await tx.objectStore(OBJECT_STORE_NAME).delete(key);\n await tx.done;\n}\nfunction getKey({\n appConfig\n}) {\n return appConfig.appId;\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst ERROR_MAP = {\n [\"missing-app-config-values\" /* ErrorCode.MISSING_APP_CONFIG_VALUES */]: 'Missing App configuration value: \"{$valueName}\"',\n [\"only-available-in-window\" /* ErrorCode.AVAILABLE_IN_WINDOW */]: 'This method is available in a Window context.',\n [\"only-available-in-sw\" /* ErrorCode.AVAILABLE_IN_SW */]: 'This method is available in a service worker context.',\n [\"permission-default\" /* ErrorCode.PERMISSION_DEFAULT */]: 'The notification permission was not granted and dismissed instead.',\n [\"permission-blocked\" /* ErrorCode.PERMISSION_BLOCKED */]: 'The notification permission was not granted and blocked instead.',\n [\"unsupported-browser\" /* ErrorCode.UNSUPPORTED_BROWSER */]: \"This browser doesn't support the API's required to use the Firebase SDK.\",\n [\"indexed-db-unsupported\" /* ErrorCode.INDEXED_DB_UNSUPPORTED */]: \"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)\",\n [\"failed-service-worker-registration\" /* ErrorCode.FAILED_DEFAULT_REGISTRATION */]: 'We are unable to register the default service worker. {$browserErrorMessage}',\n [\"token-subscribe-failed\" /* ErrorCode.TOKEN_SUBSCRIBE_FAILED */]: 'A problem occurred while subscribing the user to FCM: {$errorInfo}',\n [\"token-subscribe-no-token\" /* ErrorCode.TOKEN_SUBSCRIBE_NO_TOKEN */]: 'FCM returned no token when subscribing the user to push.',\n [\"token-unsubscribe-failed\" /* ErrorCode.TOKEN_UNSUBSCRIBE_FAILED */]: 'A problem occurred while unsubscribing the ' + 'user from FCM: {$errorInfo}',\n [\"token-update-failed\" /* ErrorCode.TOKEN_UPDATE_FAILED */]: 'A problem occurred while updating the user from FCM: {$errorInfo}',\n [\"token-update-no-token\" /* ErrorCode.TOKEN_UPDATE_NO_TOKEN */]: 'FCM returned no token when updating the user to push.',\n [\"use-sw-after-get-token\" /* ErrorCode.USE_SW_AFTER_GET_TOKEN */]: 'The useServiceWorker() method may only be called once and must be ' + 'called before calling getToken() to ensure your service worker is used.',\n [\"invalid-sw-registration\" /* ErrorCode.INVALID_SW_REGISTRATION */]: 'The input to useServiceWorker() must be a ServiceWorkerRegistration.',\n [\"invalid-bg-handler\" /* ErrorCode.INVALID_BG_HANDLER */]: 'The input to setBackgroundMessageHandler() must be a function.',\n [\"invalid-vapid-key\" /* ErrorCode.INVALID_VAPID_KEY */]: 'The public VAPID key must be a string.',\n [\"use-vapid-key-after-get-token\" /* ErrorCode.USE_VAPID_KEY_AFTER_GET_TOKEN */]: 'The usePublicVapidKey() method may only be called once and must be ' + 'called before calling getToken() to ensure your VAPID key is used.'\n};\nconst ERROR_FACTORY = new ErrorFactory('messaging', 'Messaging', ERROR_MAP);\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nasync function requestGetToken(firebaseDependencies, subscriptionOptions) {\n const headers = await getHeaders(firebaseDependencies);\n const body = getBody(subscriptionOptions);\n const subscribeOptions = {\n method: 'POST',\n headers,\n body: JSON.stringify(body)\n };\n let responseData;\n try {\n const response = await fetch(getEndpoint(firebaseDependencies.appConfig), subscribeOptions);\n responseData = await response.json();\n } catch (err) {\n throw ERROR_FACTORY.create(\"token-subscribe-failed\" /* ErrorCode.TOKEN_SUBSCRIBE_FAILED */, {\n errorInfo: err === null || err === void 0 ? void 0 : err.toString()\n });\n }\n if (responseData.error) {\n const message = responseData.error.message;\n throw ERROR_FACTORY.create(\"token-subscribe-failed\" /* ErrorCode.TOKEN_SUBSCRIBE_FAILED */, {\n errorInfo: message\n });\n }\n if (!responseData.token) {\n throw ERROR_FACTORY.create(\"token-subscribe-no-token\" /* ErrorCode.TOKEN_SUBSCRIBE_NO_TOKEN */);\n }\n return responseData.token;\n}\nasync function requestUpdateToken(firebaseDependencies, tokenDetails) {\n const headers = await getHeaders(firebaseDependencies);\n const body = getBody(tokenDetails.subscriptionOptions);\n const updateOptions = {\n method: 'PATCH',\n headers,\n body: JSON.stringify(body)\n };\n let responseData;\n try {\n const response = await fetch(`${getEndpoint(firebaseDependencies.appConfig)}/${tokenDetails.token}`, updateOptions);\n responseData = await response.json();\n } catch (err) {\n throw ERROR_FACTORY.create(\"token-update-failed\" /* ErrorCode.TOKEN_UPDATE_FAILED */, {\n errorInfo: err === null || err === void 0 ? void 0 : err.toString()\n });\n }\n if (responseData.error) {\n const message = responseData.error.message;\n throw ERROR_FACTORY.create(\"token-update-failed\" /* ErrorCode.TOKEN_UPDATE_FAILED */, {\n errorInfo: message\n });\n }\n if (!responseData.token) {\n throw ERROR_FACTORY.create(\"token-update-no-token\" /* ErrorCode.TOKEN_UPDATE_NO_TOKEN */);\n }\n return responseData.token;\n}\nasync function requestDeleteToken(firebaseDependencies, token) {\n const headers = await getHeaders(firebaseDependencies);\n const unsubscribeOptions = {\n method: 'DELETE',\n headers\n };\n try {\n const response = await fetch(`${getEndpoint(firebaseDependencies.appConfig)}/${token}`, unsubscribeOptions);\n const responseData = await response.json();\n if (responseData.error) {\n const message = responseData.error.message;\n throw ERROR_FACTORY.create(\"token-unsubscribe-failed\" /* ErrorCode.TOKEN_UNSUBSCRIBE_FAILED */, {\n errorInfo: message\n });\n }\n } catch (err) {\n throw ERROR_FACTORY.create(\"token-unsubscribe-failed\" /* ErrorCode.TOKEN_UNSUBSCRIBE_FAILED */, {\n errorInfo: err === null || err === void 0 ? void 0 : err.toString()\n });\n }\n}\nfunction getEndpoint({\n projectId\n}) {\n return `${ENDPOINT}/projects/${projectId}/registrations`;\n}\nasync function getHeaders({\n appConfig,\n installations\n}) {\n const authToken = await installations.getToken();\n return new Headers({\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n 'x-goog-api-key': appConfig.apiKey,\n 'x-goog-firebase-installations-auth': `FIS ${authToken}`\n });\n}\nfunction getBody({\n p256dh,\n auth,\n endpoint,\n vapidKey\n}) {\n const body = {\n web: {\n endpoint,\n auth,\n p256dh\n }\n };\n if (vapidKey !== DEFAULT_VAPID_KEY) {\n body.web.applicationPubKey = vapidKey;\n }\n return body;\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n// UpdateRegistration will be called once every week.\nconst TOKEN_EXPIRATION_MS = 7 * 24 * 60 * 60 * 1000; // 7 days\nasync function getTokenInternal(messaging) {\n const pushSubscription = await getPushSubscription(messaging.swRegistration, messaging.vapidKey);\n const subscriptionOptions = {\n vapidKey: messaging.vapidKey,\n swScope: messaging.swRegistration.scope,\n endpoint: pushSubscription.endpoint,\n auth: arrayToBase64(pushSubscription.getKey('auth')),\n p256dh: arrayToBase64(pushSubscription.getKey('p256dh'))\n };\n const tokenDetails = await dbGet(messaging.firebaseDependencies);\n if (!tokenDetails) {\n // No token, get a new one.\n return getNewToken(messaging.firebaseDependencies, subscriptionOptions);\n } else if (!isTokenValid(tokenDetails.subscriptionOptions, subscriptionOptions)) {\n // Invalid token, get a new one.\n try {\n await requestDeleteToken(messaging.firebaseDependencies, tokenDetails.token);\n } catch (e) {\n // Suppress errors because of #2364\n console.warn(e);\n }\n return getNewToken(messaging.firebaseDependencies, subscriptionOptions);\n } else if (Date.now() >= tokenDetails.createTime + TOKEN_EXPIRATION_MS) {\n // Weekly token refresh\n return updateToken(messaging, {\n token: tokenDetails.token,\n createTime: Date.now(),\n subscriptionOptions\n });\n } else {\n // Valid token, nothing to do.\n return tokenDetails.token;\n }\n}\n/**\r\n * This method deletes the token from the database, unsubscribes the token from FCM, and unregisters\r\n * the push subscription if it exists.\r\n */\nasync function deleteTokenInternal(messaging) {\n const tokenDetails = await dbGet(messaging.firebaseDependencies);\n if (tokenDetails) {\n await requestDeleteToken(messaging.firebaseDependencies, tokenDetails.token);\n await dbRemove(messaging.firebaseDependencies);\n }\n // Unsubscribe from the push subscription.\n const pushSubscription = await messaging.swRegistration.pushManager.getSubscription();\n if (pushSubscription) {\n return pushSubscription.unsubscribe();\n }\n // If there's no SW, consider it a success.\n return true;\n}\nasync function updateToken(messaging, tokenDetails) {\n try {\n const updatedToken = await requestUpdateToken(messaging.firebaseDependencies, tokenDetails);\n const updatedTokenDetails = Object.assign(Object.assign({}, tokenDetails), {\n token: updatedToken,\n createTime: Date.now()\n });\n await dbSet(messaging.firebaseDependencies, updatedTokenDetails);\n return updatedToken;\n } catch (e) {\n throw e;\n }\n}\nasync function getNewToken(firebaseDependencies, subscriptionOptions) {\n const token = await requestGetToken(firebaseDependencies, subscriptionOptions);\n const tokenDetails = {\n token,\n createTime: Date.now(),\n subscriptionOptions\n };\n await dbSet(firebaseDependencies, tokenDetails);\n return tokenDetails.token;\n}\n/**\r\n * Gets a PushSubscription for the current user.\r\n */\nasync function getPushSubscription(swRegistration, vapidKey) {\n const subscription = await swRegistration.pushManager.getSubscription();\n if (subscription) {\n return subscription;\n }\n return swRegistration.pushManager.subscribe({\n userVisibleOnly: true,\n // Chrome <= 75 doesn't support base64-encoded VAPID key. For backward compatibility, VAPID key\n // submitted to pushManager#subscribe must be of type Uint8Array.\n applicationServerKey: base64ToArray(vapidKey)\n });\n}\n/**\r\n * Checks if the saved tokenDetails object matches the configuration provided.\r\n */\nfunction isTokenValid(dbOptions, currentOptions) {\n const isVapidKeyEqual = currentOptions.vapidKey === dbOptions.vapidKey;\n const isEndpointEqual = currentOptions.endpoint === dbOptions.endpoint;\n const isAuthEqual = currentOptions.auth === dbOptions.auth;\n const isP256dhEqual = currentOptions.p256dh === dbOptions.p256dh;\n return isVapidKeyEqual && isEndpointEqual && isAuthEqual && isP256dhEqual;\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction externalizePayload(internalPayload) {\n const payload = {\n from: internalPayload.from,\n // eslint-disable-next-line camelcase\n collapseKey: internalPayload.collapse_key,\n // eslint-disable-next-line camelcase\n messageId: internalPayload.fcmMessageId\n };\n propagateNotificationPayload(payload, internalPayload);\n propagateDataPayload(payload, internalPayload);\n propagateFcmOptions(payload, internalPayload);\n return payload;\n}\nfunction propagateNotificationPayload(payload, messagePayloadInternal) {\n if (!messagePayloadInternal.notification) {\n return;\n }\n payload.notification = {};\n const title = messagePayloadInternal.notification.title;\n if (!!title) {\n payload.notification.title = title;\n }\n const body = messagePayloadInternal.notification.body;\n if (!!body) {\n payload.notification.body = body;\n }\n const image = messagePayloadInternal.notification.image;\n if (!!image) {\n payload.notification.image = image;\n }\n const icon = messagePayloadInternal.notification.icon;\n if (!!icon) {\n payload.notification.icon = icon;\n }\n}\nfunction propagateDataPayload(payload, messagePayloadInternal) {\n if (!messagePayloadInternal.data) {\n return;\n }\n payload.data = messagePayloadInternal.data;\n}\nfunction propagateFcmOptions(payload, messagePayloadInternal) {\n var _a, _b, _c, _d, _e;\n // fcmOptions.link value is written into notification.click_action. see more in b/232072111\n if (!messagePayloadInternal.fcmOptions && !((_a = messagePayloadInternal.notification) === null || _a === void 0 ? void 0 : _a.click_action)) {\n return;\n }\n payload.fcmOptions = {};\n const link = (_c = (_b = messagePayloadInternal.fcmOptions) === null || _b === void 0 ? void 0 : _b.link) !== null && _c !== void 0 ? _c : (_d = messagePayloadInternal.notification) === null || _d === void 0 ? void 0 : _d.click_action;\n if (!!link) {\n payload.fcmOptions.link = link;\n }\n // eslint-disable-next-line camelcase\n const analyticsLabel = (_e = messagePayloadInternal.fcmOptions) === null || _e === void 0 ? void 0 : _e.analytics_label;\n if (!!analyticsLabel) {\n payload.fcmOptions.analyticsLabel = analyticsLabel;\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction isConsoleMessage(data) {\n // This message has a campaign ID, meaning it was sent using the Firebase Console.\n return typeof data === 'object' && !!data && CONSOLE_CAMPAIGN_ID in data;\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n_mergeStrings('hts/frbslgigp.ogepscmv/ieo/eaylg', 'tp:/ieaeogn-agolai.o/1frlglgc/o');\n_mergeStrings('AzSCbw63g1R0nCw85jG8', 'Iaya3yLKwmgvh7cF0q4');\nfunction _mergeStrings(s1, s2) {\n const resultArray = [];\n for (let i = 0; i < s1.length; i++) {\n resultArray.push(s1.charAt(i));\n if (i < s2.length) {\n resultArray.push(s2.charAt(i));\n }\n }\n return resultArray.join('');\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction extractAppConfig(app) {\n if (!app || !app.options) {\n throw getMissingValueError('App Configuration Object');\n }\n if (!app.name) {\n throw getMissingValueError('App Name');\n }\n // Required app config keys\n const configKeys = ['projectId', 'apiKey', 'appId', 'messagingSenderId'];\n const {\n options\n } = app;\n for (const keyName of configKeys) {\n if (!options[keyName]) {\n throw getMissingValueError(keyName);\n }\n }\n return {\n appName: app.name,\n projectId: options.projectId,\n apiKey: options.apiKey,\n appId: options.appId,\n senderId: options.messagingSenderId\n };\n}\nfunction getMissingValueError(valueName) {\n return ERROR_FACTORY.create(\"missing-app-config-values\" /* ErrorCode.MISSING_APP_CONFIG_VALUES */, {\n valueName\n });\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nclass MessagingService {\n constructor(app, installations, analyticsProvider) {\n // logging is only done with end user consent. Default to false.\n this.deliveryMetricsExportedToBigQueryEnabled = false;\n this.onBackgroundMessageHandler = null;\n this.onMessageHandler = null;\n this.logEvents = [];\n this.isLogServiceStarted = false;\n const appConfig = extractAppConfig(app);\n this.firebaseDependencies = {\n app,\n appConfig,\n installations,\n analyticsProvider\n };\n }\n _delete() {\n return Promise.resolve();\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nasync function registerDefaultSw(messaging) {\n try {\n messaging.swRegistration = await navigator.serviceWorker.register(DEFAULT_SW_PATH, {\n scope: DEFAULT_SW_SCOPE\n });\n // The timing when browser updates sw when sw has an update is unreliable from experiment. It\n // leads to version conflict when the SDK upgrades to a newer version in the main page, but sw\n // is stuck with the old version. For example,\n // https://github.com/firebase/firebase-js-sdk/issues/2590 The following line reliably updates\n // sw if there was an update.\n messaging.swRegistration.update().catch(() => {\n /* it is non blocking and we don't care if it failed */\n });\n } catch (e) {\n throw ERROR_FACTORY.create(\"failed-service-worker-registration\" /* ErrorCode.FAILED_DEFAULT_REGISTRATION */, {\n browserErrorMessage: e === null || e === void 0 ? void 0 : e.message\n });\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nasync function updateSwReg(messaging, swRegistration) {\n if (!swRegistration && !messaging.swRegistration) {\n await registerDefaultSw(messaging);\n }\n if (!swRegistration && !!messaging.swRegistration) {\n return;\n }\n if (!(swRegistration instanceof ServiceWorkerRegistration)) {\n throw ERROR_FACTORY.create(\"invalid-sw-registration\" /* ErrorCode.INVALID_SW_REGISTRATION */);\n }\n messaging.swRegistration = swRegistration;\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nasync function updateVapidKey(messaging, vapidKey) {\n if (!!vapidKey) {\n messaging.vapidKey = vapidKey;\n } else if (!messaging.vapidKey) {\n messaging.vapidKey = DEFAULT_VAPID_KEY;\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nasync function getToken$1(messaging, options) {\n if (!navigator) {\n throw ERROR_FACTORY.create(\"only-available-in-window\" /* ErrorCode.AVAILABLE_IN_WINDOW */);\n }\n if (Notification.permission === 'default') {\n await Notification.requestPermission();\n }\n if (Notification.permission !== 'granted') {\n throw ERROR_FACTORY.create(\"permission-blocked\" /* ErrorCode.PERMISSION_BLOCKED */);\n }\n await updateVapidKey(messaging, options === null || options === void 0 ? void 0 : options.vapidKey);\n await updateSwReg(messaging, options === null || options === void 0 ? void 0 : options.serviceWorkerRegistration);\n return getTokenInternal(messaging);\n}\n\n/**\r\n * @license\r\n * Copyright 2019 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nasync function logToScion(messaging, messageType, data) {\n const eventType = getEventType(messageType);\n const analytics = await messaging.firebaseDependencies.analyticsProvider.get();\n analytics.logEvent(eventType, {\n /* eslint-disable camelcase */\n message_id: data[CONSOLE_CAMPAIGN_ID],\n message_name: data[CONSOLE_CAMPAIGN_NAME],\n message_time: data[CONSOLE_CAMPAIGN_TIME],\n message_device_time: Math.floor(Date.now() / 1000)\n /* eslint-enable camelcase */\n });\n}\nfunction getEventType(messageType) {\n switch (messageType) {\n case MessageType.NOTIFICATION_CLICKED:\n return 'notification_open';\n case MessageType.PUSH_RECEIVED:\n return 'notification_foreground';\n default:\n throw new Error();\n }\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nasync function messageEventListener(messaging, event) {\n const internalPayload = event.data;\n if (!internalPayload.isFirebaseMessaging) {\n return;\n }\n if (messaging.onMessageHandler && internalPayload.messageType === MessageType.PUSH_RECEIVED) {\n if (typeof messaging.onMessageHandler === 'function') {\n messaging.onMessageHandler(externalizePayload(internalPayload));\n } else {\n messaging.onMessageHandler.next(externalizePayload(internalPayload));\n }\n }\n // Log to Scion if applicable\n const dataPayload = internalPayload.data;\n if (isConsoleMessage(dataPayload) && dataPayload[CONSOLE_CAMPAIGN_ANALYTICS_ENABLED] === '1') {\n await logToScion(messaging, internalPayload.messageType, dataPayload);\n }\n}\nconst name = \"@firebase/messaging\";\nconst version = \"0.12.10\";\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nconst WindowMessagingFactory = container => {\n const messaging = new MessagingService(container.getProvider('app').getImmediate(), container.getProvider('installations-internal').getImmediate(), container.getProvider('analytics-internal'));\n navigator.serviceWorker.addEventListener('message', e => messageEventListener(messaging, e));\n return messaging;\n};\nconst WindowMessagingInternalFactory = container => {\n const messaging = container.getProvider('messaging').getImmediate();\n const messagingInternal = {\n getToken: options => getToken$1(messaging, options)\n };\n return messagingInternal;\n};\nfunction registerMessagingInWindow() {\n _registerComponent(new Component('messaging', WindowMessagingFactory, \"PUBLIC\" /* ComponentType.PUBLIC */));\n _registerComponent(new Component('messaging-internal', WindowMessagingInternalFactory, \"PRIVATE\" /* ComponentType.PRIVATE */));\n registerVersion(name, version);\n // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation\n registerVersion(name, version, 'esm2017');\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Checks if all required APIs exist in the browser.\r\n * @returns a Promise that resolves to a boolean.\r\n *\r\n * @public\r\n */\nasync function isWindowSupported() {\n try {\n // This throws if open() is unsupported, so adding it to the conditional\n // statement below can cause an uncaught error.\n await validateIndexedDBOpenable();\n } catch (e) {\n return false;\n }\n // firebase-js-sdk/issues/2393 reveals that idb#open in Safari iframe and Firefox private browsing\n // might be prohibited to run. In these contexts, an error would be thrown during the messaging\n // instantiating phase, informing the developers to import/call isSupported for special handling.\n return typeof window !== 'undefined' && isIndexedDBAvailable() && areCookiesEnabled() && 'serviceWorker' in navigator && 'PushManager' in window && 'Notification' in window && 'fetch' in window && ServiceWorkerRegistration.prototype.hasOwnProperty('showNotification') && PushSubscription.prototype.hasOwnProperty('getKey');\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nasync function deleteToken$1(messaging) {\n if (!navigator) {\n throw ERROR_FACTORY.create(\"only-available-in-window\" /* ErrorCode.AVAILABLE_IN_WINDOW */);\n }\n if (!messaging.swRegistration) {\n await registerDefaultSw(messaging);\n }\n return deleteTokenInternal(messaging);\n}\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nfunction onMessage$1(messaging, nextOrObserver) {\n if (!navigator) {\n throw ERROR_FACTORY.create(\"only-available-in-window\" /* ErrorCode.AVAILABLE_IN_WINDOW */);\n }\n messaging.onMessageHandler = nextOrObserver;\n return () => {\n messaging.onMessageHandler = null;\n };\n}\n\n/**\r\n * @license\r\n * Copyright 2017 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\n/**\r\n * Retrieves a Firebase Cloud Messaging instance.\r\n *\r\n * @returns The Firebase Cloud Messaging instance associated with the provided firebase app.\r\n *\r\n * @public\r\n */\nfunction getMessagingInWindow(app = getApp()) {\n // Conscious decision to make this async check non-blocking during the messaging instance\n // initialization phase for performance consideration. An error would be thrown latter for\n // developer's information. Developers can then choose to import and call `isSupported` for\n // special handling.\n isWindowSupported().then(isSupported => {\n // If `isWindowSupported()` resolved, but returned false.\n if (!isSupported) {\n throw ERROR_FACTORY.create(\"unsupported-browser\" /* ErrorCode.UNSUPPORTED_BROWSER */);\n }\n }, _ => {\n // If `isWindowSupported()` rejected.\n throw ERROR_FACTORY.create(\"indexed-db-unsupported\" /* ErrorCode.INDEXED_DB_UNSUPPORTED */);\n });\n return _getProvider(getModularInstance(app), 'messaging').getImmediate();\n}\n/**\r\n * Subscribes the {@link Messaging} instance to push notifications. Returns a Firebase Cloud\r\n * Messaging registration token that can be used to send push messages to that {@link Messaging}\r\n * instance.\r\n *\r\n * If notification permission isn't already granted, this method asks the user for permission. The\r\n * returned promise rejects if the user does not allow the app to show notifications.\r\n *\r\n * @param messaging - The {@link Messaging} instance.\r\n * @param options - Provides an optional vapid key and an optional service worker registration.\r\n *\r\n * @returns The promise resolves with an FCM registration token.\r\n *\r\n * @public\r\n */\nasync function getToken(messaging, options) {\n messaging = getModularInstance(messaging);\n return getToken$1(messaging, options);\n}\n/**\r\n * Deletes the registration token associated with this {@link Messaging} instance and unsubscribes\r\n * the {@link Messaging} instance from the push subscription.\r\n *\r\n * @param messaging - The {@link Messaging} instance.\r\n *\r\n * @returns The promise resolves when the token has been successfully deleted.\r\n *\r\n * @public\r\n */\nfunction deleteToken(messaging) {\n messaging = getModularInstance(messaging);\n return deleteToken$1(messaging);\n}\n/**\r\n * When a push message is received and the user is currently on a page for your origin, the\r\n * message is passed to the page and an `onMessage()` event is dispatched with the payload of\r\n * the push message.\r\n *\r\n *\r\n * @param messaging - The {@link Messaging} instance.\r\n * @param nextOrObserver - This function, or observer object with `next` defined,\r\n * is called when a message is received and the user is currently viewing your page.\r\n * @returns To stop listening for messages execute this returned function.\r\n *\r\n * @public\r\n */\nfunction onMessage(messaging, nextOrObserver) {\n messaging = getModularInstance(messaging);\n return onMessage$1(messaging, nextOrObserver);\n}\n\n/**\r\n * The Firebase Cloud Messaging Web SDK.\r\n * This SDK does not work in a Node.js environment.\r\n *\r\n * @packageDocumentation\r\n */\nregisterMessagingInWindow();\nexport { deleteToken, getMessagingInWindow as getMessaging, getToken, isWindowSupported as isSupported, onMessage };\n","export enum StorageItem {\r\n Auth = 'App/auth',\r\n RefreshToken = 'App/refreshToken',\r\n Theme = 'App/theme',\r\n }\r\n","export enum MarketPlaceStoreTypeNameEnum{\r\n Trendyol=\"Trendyol\",\r\n HepsiBurada=\"HepsiBurada\",\r\n N11=\"N11\"\r\n}\r\n","export enum SaleTableStatusTypeEnum {\r\n Yeni = 0,\r\n IslemeAlinanlar = 1,\r\n Kargoda = 2,\r\n TeslimEdildi=3,\r\n IptalEdilenler=4,\r\n TeslimEdilemeyenVeGeriDonen=5,\r\n}\r\n","// This file can be replaced during build by using the `fileReplacements` array.\r\n// `ng build` replaces `environment.ts` with `environment.prod.ts`.\r\n// The list of file replacements can be found in `angular.json`.\r\n\r\nexport const environment = {\r\n production: true,\r\n //apiUrl: 'https://localhost:7005/api',\r\n apiUrl: 'https://api.harpazar.com/api',\r\n firebase: {\r\n apiKey: 'AIzaSyD7peFuAxuP-biINCwUX4JcoBenq8ygDDY',\r\n authDomain: 'integration-70edf.firebaseapp.com',\r\n projectId: 'integration-70edf',\r\n storageBucket: 'integration-70edf.appspot.com',\r\n messagingSenderId: '310125457681',\r\n appId: '1:310125457681:web:11e9999f898f7d9048dcb0',\r\n measurementId: 'G-ZVWST57JBE',\r\n vapidKey:\r\n 'BI3y8fes_wRoBFheOHJgAnEYgaMAeB6brAbn7yYWTp8CX9AIltHDRA3rcaCp0a72upx_i36Q2ftCX0Zg-JbZLJ4',\r\n },\r\n};\r\n\r\n/*\r\n * For easier debugging in development mode, you can import the following file\r\n * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.\r\n *\r\n * This import should be commented out in production mode because it will have a negative impact\r\n * on performance if an error is thrown.\r\n */\r\n// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.\r\n","export class DeviceTypeConstant{\r\n static android:string=\"3499c9d8-21d1-4e56-9b72-6e846dc98285\";\r\n static ios: string=\"4d2c7afd-99e3-4c51-8e8e-f572934570fa\";\r\n static web:string=\"47266b4c-c6ad-453b-822f-850b732ca937\";\r\n}\r\n","export class Roles{\r\n static superAdmin:string=\"SuperAdmin\";\r\n}\r\n","import { registerVersion } from '@firebase/app';\nexport * from '@firebase/app';\nvar name = \"firebase\";\nvar version = \"10.12.5\";\n\n/**\r\n * @license\r\n * Copyright 2020 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\nregisterVersion(name, version, 'app');\n","import * as i0 from '@angular/core';\nimport { Version, Injectable } from '@angular/core';\nimport { getApps } from 'firebase/app';\nimport { queueScheduler, asyncScheduler, Observable } from 'rxjs';\nimport { tap, observeOn, subscribeOn } from 'rxjs/operators';\nconst VERSION = /*#__PURE__*/new Version('ANGULARFIRE2_VERSION');\nconst ɵisSupportedError = module => `The APP_INITIALIZER that is \"making\" isSupported() sync for the sake of convenient DI has not resolved in this\ncontext. Rather than injecting ${module} in the constructor, first ensure that ${module} is supported by calling\n\\`await isSupported()\\`, then retrieve the instance from the injector manually \\`injector.get(${module})\\`.`;\nfunction ɵgetDefaultInstanceOf(identifier, provided, defaultApp) {\n if (provided) {\n // Was provide* only called once? If so grab that\n if (provided.length === 1) {\n return provided[0];\n }\n const providedUsingDefaultApp = provided.filter(it => it.app === defaultApp);\n // Was provide* only called once, using the default app? If so use that\n if (providedUsingDefaultApp.length === 1) {\n return providedUsingDefaultApp[0];\n }\n }\n // Grab the default instance from the defaultApp\n const defaultAppWithContainer = defaultApp;\n const provider = defaultAppWithContainer.container.getProvider(identifier);\n return provider.getImmediate({\n optional: true\n });\n}\nconst ɵgetAllInstancesOf = (identifier, app) => {\n const apps = app ? [app] : getApps();\n const instances = [];\n apps.forEach(app => {\n const provider = app.container.getProvider(identifier);\n provider.instances.forEach(instance => {\n if (!instances.includes(instance)) {\n instances.push(instance);\n }\n });\n });\n return instances;\n};\nclass ɵAppCheckInstances {\n constructor() {\n return ɵgetAllInstancesOf(ɵAPP_CHECK_PROVIDER_NAME);\n }\n}\nconst ɵAPP_CHECK_PROVIDER_NAME = 'app-check';\n\n/* eslint-disable @typescript-eslint/ban-ts-comment */\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nfunction noop() {}\n/**\n * Schedules tasks so that they are invoked inside the Zone that is passed in the constructor.\n */\nclass ɵZoneScheduler {\n zone;\n delegate;\n constructor(zone, delegate = queueScheduler) {\n this.zone = zone;\n this.delegate = delegate;\n }\n now() {\n return this.delegate.now();\n }\n schedule(work, delay, state) {\n const targetZone = this.zone;\n // Wrap the specified work function to make sure that if nested scheduling takes place the\n // work is executed in the correct zone\n const workInZone = function (state) {\n targetZone.runGuarded(() => {\n work.apply(this, [state]);\n });\n };\n // Scheduling itself needs to be run in zone to ensure setInterval calls for async scheduling are done\n // inside the correct zone. This scheduler needs to schedule asynchronously always to ensure that\n // firebase emissions are never synchronous. Specifying a delay causes issues with the queueScheduler delegate.\n return this.delegate.schedule(workInZone, delay, state);\n }\n}\nclass BlockUntilFirstOperator {\n zone;\n // @ts-ignore\n task = null;\n constructor(zone) {\n this.zone = zone;\n }\n call(subscriber, source) {\n const unscheduleTask = this.unscheduleTask.bind(this);\n // @ts-ignore\n this.task = this.zone.run(() => Zone.current.scheduleMacroTask('firebaseZoneBlock', noop, {}, noop, noop));\n return source.pipe(tap({\n next: unscheduleTask,\n complete: unscheduleTask,\n error: unscheduleTask\n })).subscribe(subscriber).add(unscheduleTask);\n }\n unscheduleTask() {\n // maybe this is a race condition, invoke in a timeout\n // hold for 10ms while I try to figure out what is going on\n setTimeout(() => {\n if (this.task != null && this.task.state === 'scheduled') {\n this.task.invoke();\n this.task = null;\n }\n }, 10);\n }\n}\nlet ɵAngularFireSchedulers = /*#__PURE__*/(() => {\n class ɵAngularFireSchedulers {\n ngZone;\n outsideAngular;\n insideAngular;\n constructor(ngZone) {\n this.ngZone = ngZone;\n // @ts-ignore\n this.outsideAngular = ngZone.runOutsideAngular(() => new ɵZoneScheduler(Zone.current));\n // @ts-ignore\n this.insideAngular = ngZone.run(() => new ɵZoneScheduler(Zone.current, asyncScheduler));\n globalThis.ɵAngularFireScheduler ||= this;\n }\n static ɵfac = function ɵAngularFireSchedulers_Factory(ɵt) {\n return new (ɵt || ɵAngularFireSchedulers)(i0.ɵɵinject(i0.NgZone));\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ɵAngularFireSchedulers,\n factory: ɵAngularFireSchedulers.ɵfac,\n providedIn: 'root'\n });\n }\n return ɵAngularFireSchedulers;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction getSchedulers() {\n const schedulers = globalThis.ɵAngularFireScheduler;\n if (!schedulers) {\n throw new Error(`Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using\nprovideFirebaseApp) or you're calling an AngularFire method outside of an NgModule (which is not supported).`);\n }\n return schedulers;\n}\nfunction runOutsideAngular(fn) {\n return getSchedulers().ngZone.runOutsideAngular(() => fn());\n}\nfunction run(fn) {\n return getSchedulers().ngZone.run(() => fn());\n}\nfunction observeOutsideAngular(obs$) {\n return obs$.pipe(observeOn(getSchedulers().outsideAngular));\n}\nfunction observeInsideAngular(obs$) {\n return obs$.pipe(observeOn(getSchedulers().insideAngular));\n}\nfunction keepUnstableUntilFirst(obs$) {\n return ɵkeepUnstableUntilFirstFactory(getSchedulers())(obs$);\n}\n/**\n * Operator to block the zone until the first value has been emitted or the observable\n * has completed/errored. This is used to make sure that universal waits until the first\n * value from firebase but doesn't block the zone forever since the firebase subscription\n * is still alive.\n */\nfunction ɵkeepUnstableUntilFirstFactory(schedulers) {\n return function keepUnstableUntilFirst(obs$) {\n obs$ = obs$.lift(new BlockUntilFirstOperator(schedulers.ngZone));\n return obs$.pipe(\n // Run the subscribe body outside of Angular (e.g. calling Firebase SDK to add a listener to a change event)\n subscribeOn(schedulers.outsideAngular),\n // Run operators inside the angular zone (e.g. side effects via tap())\n observeOn(schedulers.insideAngular)\n // INVESTIGATE https://github.com/angular/angularfire/pull/2315\n // share()\n );\n };\n}\n// @ts-ignore\nconst zoneWrapFn = (it, macrotask) => {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const _this = this;\n // function() is needed for the arguments object\n return function () {\n const _arguments = arguments;\n if (macrotask) {\n setTimeout(() => {\n if (macrotask.state === 'scheduled') {\n macrotask.invoke();\n }\n }, 10);\n }\n return run(() => it.apply(_this, _arguments));\n };\n};\nconst ɵzoneWrap = (it, blockUntilFirst) => {\n // function() is needed for the arguments object\n return function () {\n // @ts-ignore\n let macrotask;\n const _arguments = arguments;\n // if this is a callback function, e.g, onSnapshot, we should create a microtask and invoke it\n // only once one of the callback functions is tripped.\n for (let i = 0; i < arguments.length; i++) {\n if (typeof _arguments[i] === 'function') {\n if (blockUntilFirst) {\n // @ts-ignore\n macrotask ||= run(() => Zone.current.scheduleMacroTask('firebaseZoneBlock', noop, {}, noop, noop));\n }\n // TODO create a microtask to track callback functions\n _arguments[i] = zoneWrapFn(_arguments[i], macrotask);\n }\n }\n const ret = runOutsideAngular(() => it.apply(this, _arguments));\n if (!blockUntilFirst) {\n if (ret instanceof Observable) {\n const schedulers = getSchedulers();\n return ret.pipe(subscribeOn(schedulers.outsideAngular), observeOn(schedulers.insideAngular));\n } else {\n return run(() => ret);\n }\n }\n if (ret instanceof Observable) {\n return ret.pipe(keepUnstableUntilFirst);\n } else if (ret instanceof Promise) {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n return run(() => new Promise((resolve, reject) => ret.then(it => run(() => resolve(it)), reason => run(() => reject(reason)))));\n } else if (typeof ret === 'function' && macrotask) {\n // Handle unsubscribe\n // function() is needed for the arguments object\n return function () {\n setTimeout(() => {\n if (macrotask && macrotask.state === 'scheduled') {\n macrotask.invoke();\n }\n }, 10);\n return ret.apply(this, arguments);\n };\n } else {\n // TODO how do we handle storage uploads in Zone? and other stuff with cancel() etc?\n return run(() => ret);\n }\n };\n};\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { VERSION, keepUnstableUntilFirst, observeInsideAngular, observeOutsideAngular, ɵAPP_CHECK_PROVIDER_NAME, ɵAngularFireSchedulers, ɵAppCheckInstances, ɵZoneScheduler, ɵgetAllInstancesOf, ɵgetDefaultInstanceOf, ɵisSupportedError, ɵkeepUnstableUntilFirstFactory, ɵzoneWrap };\n","import { getApps as getApps$1, getApp as getApp$1, registerVersion as registerVersion$1, deleteApp as deleteApp$1, initializeApp as initializeApp$1, initializeServerApp as initializeServerApp$1, onLog as onLog$1, setLogLevel as setLogLevel$1 } from 'firebase/app';\nexport * from 'firebase/app';\nimport { timer, from } from 'rxjs';\nimport { concatMap, distinct } from 'rxjs/operators';\nimport * as i0 from '@angular/core';\nimport { InjectionToken, Optional, PLATFORM_ID, VERSION as VERSION$1, NgModule, Inject, makeEnvironmentProviders, NgZone, Injector } from '@angular/core';\nimport { VERSION, ɵAngularFireSchedulers as _AngularFireSchedulers, ɵzoneWrap as _zoneWrap } from '@angular/fire';\nclass FirebaseApp {\n constructor(app) {\n return app;\n }\n}\nclass FirebaseApps {\n constructor() {\n return getApps$1();\n }\n}\nconst firebaseApp$ = /*#__PURE__*/ /*#__PURE__*/timer(0, 300).pipe( /*#__PURE__*/concatMap(() => from(getApps$1())), /*#__PURE__*/distinct());\nfunction defaultFirebaseAppFactory(provided) {\n // Use the provided app, if there is only one, otherwise fetch the default app\n if (provided && provided.length === 1) {\n return provided[0];\n }\n return new FirebaseApp(getApp$1());\n}\n// With FIREBASE_APPS I wanted to capture the default app instance, if it is initialized by\n// the reserved URL; ɵPROVIDED_FIREBASE_APPS is not for public consumption and serves to ensure that all\n// provideFirebaseApp(...) calls are satisfied before FirebaseApp$ or FirebaseApp is resolved\nconst PROVIDED_FIREBASE_APPS = /*#__PURE__*/new InjectionToken('angularfire2._apps');\n// Injecting FirebaseApp will now only inject the default Firebase App\n// this allows allows beginners to import /__/firebase/init.js to auto initialize Firebase App\n// from the reserved URL.\nconst DEFAULT_FIREBASE_APP_PROVIDER = {\n provide: FirebaseApp,\n useFactory: defaultFirebaseAppFactory,\n deps: [[/*#__PURE__*/new Optional(), PROVIDED_FIREBASE_APPS]]\n};\nconst FIREBASE_APPS_PROVIDER = {\n provide: FirebaseApps,\n deps: [[/*#__PURE__*/new Optional(), PROVIDED_FIREBASE_APPS]]\n};\nfunction firebaseAppFactory(fn) {\n return (zone, injector) => {\n const platformId = injector.get(PLATFORM_ID);\n registerVersion$1('angularfire', VERSION.full, 'core');\n registerVersion$1('angularfire', VERSION.full, 'app');\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n registerVersion$1('angular', VERSION$1.full, platformId.toString());\n const app = zone.runOutsideAngular(() => fn(injector));\n return new FirebaseApp(app);\n };\n}\nlet FirebaseAppModule = /*#__PURE__*/(() => {\n class FirebaseAppModule {\n // eslint-disable-next-line @typescript-eslint/ban-types\n constructor(platformId) {\n registerVersion$1('angularfire', VERSION.full, 'core');\n registerVersion$1('angularfire', VERSION.full, 'app');\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n registerVersion$1('angular', VERSION$1.full, platformId.toString());\n }\n static ɵfac = function FirebaseAppModule_Factory(ɵt) {\n return new (ɵt || FirebaseAppModule)(i0.ɵɵinject(PLATFORM_ID));\n };\n static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: FirebaseAppModule\n });\n static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n providers: [DEFAULT_FIREBASE_APP_PROVIDER, FIREBASE_APPS_PROVIDER]\n });\n }\n return FirebaseAppModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n// Calling initializeApp({ ... }, 'name') multiple times will add more FirebaseApps into the FIREBASE_APPS\n// injection scope. This allows developers to more easily work with multiple Firebase Applications. Downside\n// is that DI for app name and options doesn't really make sense anymore.\nfunction provideFirebaseApp(fn, ...deps) {\n return makeEnvironmentProviders([DEFAULT_FIREBASE_APP_PROVIDER, FIREBASE_APPS_PROVIDER, {\n provide: PROVIDED_FIREBASE_APPS,\n useFactory: firebaseAppFactory(fn),\n multi: true,\n deps: [NgZone, Injector, _AngularFireSchedulers, ...deps]\n }]);\n}\n\n// DO NOT MODIFY, this file is autogenerated by tools/build.ts\nconst deleteApp = /*#__PURE__*/_zoneWrap(deleteApp$1, true);\nconst getApp = /*#__PURE__*/_zoneWrap(getApp$1, true);\nconst getApps = /*#__PURE__*/_zoneWrap(getApps$1, true);\nconst initializeApp = /*#__PURE__*/_zoneWrap(initializeApp$1, true);\nconst initializeServerApp = /*#__PURE__*/_zoneWrap(initializeServerApp$1, true);\nconst onLog = /*#__PURE__*/_zoneWrap(onLog$1, true);\nconst registerVersion = /*#__PURE__*/_zoneWrap(registerVersion$1, true);\nconst setLogLevel = /*#__PURE__*/_zoneWrap(setLogLevel$1, true);\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { FirebaseApp, FirebaseAppModule, FirebaseApps, deleteApp, firebaseApp$, getApp, getApps, initializeApp, initializeServerApp, onLog, provideFirebaseApp, registerVersion, setLogLevel };\n","import { ɵgetAllInstancesOf as _getAllInstancesOf, ɵisSupportedError as _isSupportedError, ɵgetDefaultInstanceOf as _getDefaultInstanceOf, VERSION, ɵAngularFireSchedulers as _AngularFireSchedulers, ɵzoneWrap as _zoneWrap } from '@angular/fire';\nimport { timer, from } from 'rxjs';\nimport { concatMap, distinct } from 'rxjs/operators';\nimport * as i0 from '@angular/core';\nimport { InjectionToken, Optional, APP_INITIALIZER, NgModule, makeEnvironmentProviders, NgZone, Injector } from '@angular/core';\nimport { FirebaseApp, FirebaseApps } from '@angular/fire/app';\nimport { registerVersion } from 'firebase/app';\nimport { isSupported as isSupported$1, deleteToken as deleteToken$1, getMessaging as getMessaging$1, getToken as getToken$1, onMessage as onMessage$1 } from 'firebase/messaging';\nexport * from 'firebase/messaging';\nclass Messaging {\n constructor(messaging) {\n return messaging;\n }\n}\nconst MESSAGING_PROVIDER_NAME = 'messaging';\nclass MessagingInstances {\n constructor() {\n return _getAllInstancesOf(MESSAGING_PROVIDER_NAME);\n }\n}\nconst messagingInstance$ = /*#__PURE__*/ /*#__PURE__*/timer(0, 300).pipe( /*#__PURE__*/concatMap(() => from(_getAllInstancesOf(MESSAGING_PROVIDER_NAME))), /*#__PURE__*/distinct());\nconst isMessagingSupportedPromiseSymbol = '__angularfire_symbol__messagingIsSupported';\nconst isMessagingSupportedValueSymbol = '__angularfire_symbol__messagingIsSupportedValue';\nglobalThis[isMessagingSupportedPromiseSymbol] ||= /*#__PURE__*/ /*#__PURE__*/ /*#__PURE__*/isSupported$1().then(it => globalThis[isMessagingSupportedValueSymbol] = it).catch(() => globalThis[isMessagingSupportedValueSymbol] = false);\nconst isMessagingSupportedFactory = {\n async: () => globalThis[isMessagingSupportedPromiseSymbol],\n sync: () => {\n const ret = globalThis[isMessagingSupportedValueSymbol];\n if (ret === undefined) {\n throw new Error(_isSupportedError('Messaging'));\n }\n return ret;\n }\n};\nconst PROVIDED_MESSAGING_INSTANCES = /*#__PURE__*/new InjectionToken('angularfire2.messaging-instances');\nfunction defaultMessagingInstanceFactory(provided, defaultApp) {\n if (!isMessagingSupportedFactory.sync()) {\n return null;\n }\n const defaultMessaging = _getDefaultInstanceOf(MESSAGING_PROVIDER_NAME, provided, defaultApp);\n return defaultMessaging && new Messaging(defaultMessaging);\n}\nfunction messagingInstanceFactory(fn) {\n return (zone, injector) => {\n if (!isMessagingSupportedFactory.sync()) {\n return null;\n }\n const messaging = zone.runOutsideAngular(() => fn(injector));\n return new Messaging(messaging);\n };\n}\nconst MESSAGING_INSTANCES_PROVIDER = {\n provide: MessagingInstances,\n deps: [[/*#__PURE__*/new Optional(), PROVIDED_MESSAGING_INSTANCES]]\n};\nconst DEFAULT_MESSAGING_INSTANCE_PROVIDER = {\n provide: Messaging,\n useFactory: defaultMessagingInstanceFactory,\n deps: [[/*#__PURE__*/new Optional(), PROVIDED_MESSAGING_INSTANCES], FirebaseApp]\n};\nlet MessagingModule = /*#__PURE__*/(() => {\n class MessagingModule {\n constructor() {\n registerVersion('angularfire', VERSION.full, 'fcm');\n }\n static ɵfac = function MessagingModule_Factory(ɵt) {\n return new (ɵt || MessagingModule)();\n };\n static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: MessagingModule\n });\n static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n providers: [DEFAULT_MESSAGING_INSTANCE_PROVIDER, MESSAGING_INSTANCES_PROVIDER, {\n provide: APP_INITIALIZER,\n useValue: isMessagingSupportedFactory.async,\n multi: true\n }]\n });\n }\n return MessagingModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction provideMessaging(fn, ...deps) {\n registerVersion('angularfire', VERSION.full, 'fcm');\n return makeEnvironmentProviders([DEFAULT_MESSAGING_INSTANCE_PROVIDER, MESSAGING_INSTANCES_PROVIDER, {\n provide: APP_INITIALIZER,\n useValue: isMessagingSupportedFactory.async,\n multi: true\n }, {\n provide: PROVIDED_MESSAGING_INSTANCES,\n useFactory: messagingInstanceFactory(fn),\n multi: true,\n deps: [NgZone, Injector, _AngularFireSchedulers, FirebaseApps, ...deps]\n }]);\n}\nconst isSupported = isMessagingSupportedFactory.async;\n\n// DO NOT MODIFY, this file is autogenerated by tools/build.ts\nconst deleteToken = /*#__PURE__*/_zoneWrap(deleteToken$1, true);\nconst getMessaging = /*#__PURE__*/_zoneWrap(getMessaging$1, true);\nconst getToken = /*#__PURE__*/_zoneWrap(getToken$1, true);\nconst onMessage = /*#__PURE__*/_zoneWrap(onMessage$1, false);\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { Messaging, MessagingInstances, MessagingModule, deleteToken, getMessaging, getToken, isSupported, messagingInstance$, onMessage, provideMessaging };\n","import { HttpClient } from \"@angular/common/http\";\r\nimport { Injectable } from \"@angular/core\";\r\nimport { Observable } from \"rxjs\";\r\nimport { QueryParamInterface } from \"../interfaces/query-param.interface\";\r\nimport { environment } from \"../../../environments/environment\";\r\n\r\n@Injectable({\r\n providedIn: \"root\",\r\n})\r\nexport class ApiService {\r\n private readonly END_POINT: string;\r\n\r\n constructor(private http: HttpClient) {\r\n this.END_POINT = environment.apiUrl;\r\n }\r\n\r\n get(\r\n id: number | null,\r\n route: string,\r\n qp: QueryParamInterface = {}\r\n ): Observable {\r\n const cfqu = this.correctFormatForQueryUrl(qp);\r\n return this.http[\"get\"](\r\n `${this.END_POINT}/${route}${id ? \"/\" + id : \"\"}${cfqu}`\r\n ) as Observable;\r\n }\r\n\r\n post(\r\n route: string,\r\n data: unknown,\r\n id: number | null,\r\n qp: QueryParamInterface = {}\r\n ): Observable {\r\n const cfqu = this.correctFormatForQueryUrl(qp);\r\n return this.http[\"post\"](\r\n `${this.END_POINT}/${route}${id ? \"/\" + id : \"\"}${cfqu}`,\r\n data\r\n ) as Observable;\r\n }\r\n\r\n private correctFormatForQueryUrl(qp: QueryParamInterface): string {\r\n if (qp == null) {\r\n return \"\";\r\n }\r\n const qpAsStr = this.mapQueryParamsToUrl(qp);\r\n return qpAsStr.length === 0 ? \"\" : `?${qpAsStr.join(\"&\")}`;\r\n }\r\n\r\n private mapQueryParamsToUrl(qp: QueryParamInterface): Array {\r\n return Object.keys(qp).map((key: string) => {\r\n return `${key}=${qp[key]}`;\r\n });\r\n }\r\n}\r\n","/**\n * @license Angular v18.1.3\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport { DOCUMENT } from '@angular/common';\nimport * as i0 from '@angular/core';\nimport { inject, Injectable, ANIMATION_MODULE_TYPE, ViewEncapsulation, ɵRuntimeError, Inject } from '@angular/core';\n\n/**\n * @description Constants for the categories of parameters that can be defined for animations.\n *\n * A corresponding function defines a set of parameters for each category, and\n * collects them into a corresponding `AnimationMetadata` object.\n *\n * @publicApi\n */\nvar AnimationMetadataType = /*#__PURE__*/function (AnimationMetadataType) {\n /**\n * Associates a named animation state with a set of CSS styles.\n * See [`state()`](api/animations/state)\n */\n AnimationMetadataType[AnimationMetadataType[\"State\"] = 0] = \"State\";\n /**\n * Data for a transition from one animation state to another.\n * See `transition()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Transition\"] = 1] = \"Transition\";\n /**\n * Contains a set of animation steps.\n * See `sequence()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Sequence\"] = 2] = \"Sequence\";\n /**\n * Contains a set of animation steps.\n * See `{@link animations/group group()}`\n */\n AnimationMetadataType[AnimationMetadataType[\"Group\"] = 3] = \"Group\";\n /**\n * Contains an animation step.\n * See `animate()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Animate\"] = 4] = \"Animate\";\n /**\n * Contains a set of animation steps.\n * See `keyframes()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Keyframes\"] = 5] = \"Keyframes\";\n /**\n * Contains a set of CSS property-value pairs into a named style.\n * See `style()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Style\"] = 6] = \"Style\";\n /**\n * Associates an animation with an entry trigger that can be attached to an element.\n * See `trigger()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Trigger\"] = 7] = \"Trigger\";\n /**\n * Contains a re-usable animation.\n * See `animation()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Reference\"] = 8] = \"Reference\";\n /**\n * Contains data to use in executing child animations returned by a query.\n * See `animateChild()`\n */\n AnimationMetadataType[AnimationMetadataType[\"AnimateChild\"] = 9] = \"AnimateChild\";\n /**\n * Contains animation parameters for a re-usable animation.\n * See `useAnimation()`\n */\n AnimationMetadataType[AnimationMetadataType[\"AnimateRef\"] = 10] = \"AnimateRef\";\n /**\n * Contains child-animation query data.\n * See `query()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Query\"] = 11] = \"Query\";\n /**\n * Contains data for staggering an animation sequence.\n * See `stagger()`\n */\n AnimationMetadataType[AnimationMetadataType[\"Stagger\"] = 12] = \"Stagger\";\n return AnimationMetadataType;\n}(AnimationMetadataType || {});\n/**\n * Specifies automatic styling.\n *\n * @publicApi\n */\nconst AUTO_STYLE = '*';\n/**\n * Creates a named animation trigger, containing a list of [`state()`](api/animations/state)\n * and `transition()` entries to be evaluated when the expression\n * bound to the trigger changes.\n *\n * @param name An identifying string.\n * @param definitions An animation definition object, containing an array of\n * [`state()`](api/animations/state) and `transition()` declarations.\n *\n * @return An object that encapsulates the trigger data.\n *\n * @usageNotes\n * Define an animation trigger in the `animations` section of `@Component` metadata.\n * In the template, reference the trigger by name and bind it to a trigger expression that\n * evaluates to a defined animation state, using the following format:\n *\n * `[@triggerName]=\"expression\"`\n *\n * Animation trigger bindings convert all values to strings, and then match the\n * previous and current values against any linked transitions.\n * Booleans can be specified as `1` or `true` and `0` or `false`.\n *\n * ### Usage Example\n *\n * The following example creates an animation trigger reference based on the provided\n * name value.\n * The provided animation value is expected to be an array consisting of state and\n * transition declarations.\n *\n * ```typescript\n * @Component({\n * selector: \"my-component\",\n * templateUrl: \"my-component-tpl.html\",\n * animations: [\n * trigger(\"myAnimationTrigger\", [\n * state(...),\n * state(...),\n * transition(...),\n * transition(...)\n * ])\n * ]\n * })\n * class MyComponent {\n * myStatusExp = \"something\";\n * }\n * ```\n *\n * The template associated with this component makes use of the defined trigger\n * by binding to an element within its template code.\n *\n * ```html\n * \n * ...
\n * ```\n *\n * ### Using an inline function\n * The `transition` animation method also supports reading an inline function which can decide\n * if its associated animation should be run.\n *\n * ```typescript\n * // this method is run each time the `myAnimationTrigger` trigger value changes.\n * function myInlineMatcherFn(fromState: string, toState: string, element: any, params: {[key:\n string]: any}): boolean {\n * // notice that `element` and `params` are also available here\n * return toState == 'yes-please-animate';\n * }\n *\n * @Component({\n * selector: 'my-component',\n * templateUrl: 'my-component-tpl.html',\n * animations: [\n * trigger('myAnimationTrigger', [\n * transition(myInlineMatcherFn, [\n * // the animation sequence code\n * ]),\n * ])\n * ]\n * })\n * class MyComponent {\n * myStatusExp = \"yes-please-animate\";\n * }\n * ```\n *\n * ### Disabling Animations\n * When true, the special animation control binding `@.disabled` binding prevents\n * all animations from rendering.\n * Place the `@.disabled` binding on an element to disable\n * animations on the element itself, as well as any inner animation triggers\n * within the element.\n *\n * The following example shows how to use this feature:\n *\n * ```typescript\n * @Component({\n * selector: 'my-component',\n * template: `\n * \n * `,\n * animations: [\n * trigger(\"childAnimation\", [\n * // ...\n * ])\n * ]\n * })\n * class MyComponent {\n * isDisabled = true;\n * exp = '...';\n * }\n * ```\n *\n * When `@.disabled` is true, it prevents the `@childAnimation` trigger from animating,\n * along with any inner animations.\n *\n * ### Disable animations application-wide\n * When an area of the template is set to have animations disabled,\n * **all** inner components have their animations disabled as well.\n * This means that you can disable all animations for an app\n * by placing a host binding set on `@.disabled` on the topmost Angular component.\n *\n * ```typescript\n * import {Component, HostBinding} from '@angular/core';\n *\n * @Component({\n * selector: 'app-component',\n * templateUrl: 'app.component.html',\n * })\n * class AppComponent {\n * @HostBinding('@.disabled')\n * public animationsDisabled = true;\n * }\n * ```\n *\n * ### Overriding disablement of inner animations\n * Despite inner animations being disabled, a parent animation can `query()`\n * for inner elements located in disabled areas of the template and still animate\n * them if needed. This is also the case for when a sub animation is\n * queried by a parent and then later animated using `animateChild()`.\n *\n * ### Detecting when an animation is disabled\n * If a region of the DOM (or the entire application) has its animations disabled, the animation\n * trigger callbacks still fire, but for zero seconds. When the callback fires, it provides\n * an instance of an `AnimationEvent`. If animations are disabled,\n * the `.disabled` flag on the event is true.\n *\n * @publicApi\n */\nfunction trigger(name, definitions) {\n return {\n type: AnimationMetadataType.Trigger,\n name,\n definitions,\n options: {}\n };\n}\n/**\n * Defines an animation step that combines styling information with timing information.\n *\n * @param timings Sets `AnimateTimings` for the parent animation.\n * A string in the format \"duration [delay] [easing]\".\n * - Duration and delay are expressed as a number and optional time unit,\n * such as \"1s\" or \"10ms\" for one second and 10 milliseconds, respectively.\n * The default unit is milliseconds.\n * - The easing value controls how the animation accelerates and decelerates\n * during its runtime. Value is one of `ease`, `ease-in`, `ease-out`,\n * `ease-in-out`, or a `cubic-bezier()` function call.\n * If not supplied, no easing is applied.\n *\n * For example, the string \"1s 100ms ease-out\" specifies a duration of\n * 1000 milliseconds, and delay of 100 ms, and the \"ease-out\" easing style,\n * which decelerates near the end of the duration.\n * @param styles Sets AnimationStyles for the parent animation.\n * A function call to either `style()` or `keyframes()`\n * that returns a collection of CSS style entries to be applied to the parent animation.\n * When null, uses the styles from the destination state.\n * This is useful when describing an animation step that will complete an animation;\n * see \"Animating to the final state\" in `transitions()`.\n * @returns An object that encapsulates the animation step.\n *\n * @usageNotes\n * Call within an animation `sequence()`, `{@link animations/group group()}`, or\n * `transition()` call to specify an animation step\n * that applies given style data to the parent animation for a given amount of time.\n *\n * ### Syntax Examples\n * **Timing examples**\n *\n * The following examples show various `timings` specifications.\n * - `animate(500)` : Duration is 500 milliseconds.\n * - `animate(\"1s\")` : Duration is 1000 milliseconds.\n * - `animate(\"100ms 0.5s\")` : Duration is 100 milliseconds, delay is 500 milliseconds.\n * - `animate(\"5s ease-in\")` : Duration is 5000 milliseconds, easing in.\n * - `animate(\"5s 10ms cubic-bezier(.17,.67,.88,.1)\")` : Duration is 5000 milliseconds, delay is 10\n * milliseconds, easing according to a bezier curve.\n *\n * **Style examples**\n *\n * The following example calls `style()` to set a single CSS style.\n * ```typescript\n * animate(500, style({ background: \"red\" }))\n * ```\n * The following example calls `keyframes()` to set a CSS style\n * to different values for successive keyframes.\n * ```typescript\n * animate(500, keyframes(\n * [\n * style({ background: \"blue\" }),\n * style({ background: \"red\" })\n * ])\n * ```\n *\n * @publicApi\n */\nfunction animate(timings, styles = null) {\n return {\n type: AnimationMetadataType.Animate,\n styles,\n timings\n };\n}\n/**\n * @description Defines a list of animation steps to be run in parallel.\n *\n * @param steps An array of animation step objects.\n * - When steps are defined by `style()` or `animate()`\n * function calls, each call within the group is executed instantly.\n * - To specify offset styles to be applied at a later time, define steps with\n * `keyframes()`, or use `animate()` calls with a delay value.\n * For example:\n *\n * ```typescript\n * group([\n * animate(\"1s\", style({ background: \"black\" })),\n * animate(\"2s\", style({ color: \"white\" }))\n * ])\n * ```\n *\n * @param options An options object containing a delay and\n * developer-defined parameters that provide styling defaults and\n * can be overridden on invocation.\n *\n * @return An object that encapsulates the group data.\n *\n * @usageNotes\n * Grouped animations are useful when a series of styles must be\n * animated at different starting times and closed off at different ending times.\n *\n * When called within a `sequence()` or a\n * `transition()` call, does not continue to the next\n * instruction until all of the inner animation steps have completed.\n *\n * @publicApi\n */\nfunction group(steps, options = null) {\n return {\n type: AnimationMetadataType.Group,\n steps,\n options\n };\n}\n/**\n * Defines a list of animation steps to be run sequentially, one by one.\n *\n * @param steps An array of animation step objects.\n * - Steps defined by `style()` calls apply the styling data immediately.\n * - Steps defined by `animate()` calls apply the styling data over time\n * as specified by the timing data.\n *\n * ```typescript\n * sequence([\n * style({ opacity: 0 }),\n * animate(\"1s\", style({ opacity: 1 }))\n * ])\n * ```\n *\n * @param options An options object containing a delay and\n * developer-defined parameters that provide styling defaults and\n * can be overridden on invocation.\n *\n * @return An object that encapsulates the sequence data.\n *\n * @usageNotes\n * When you pass an array of steps to a\n * `transition()` call, the steps run sequentially by default.\n * Compare this to the `{@link animations/group group()}` call, which runs animation steps in\n *parallel.\n *\n * When a sequence is used within a `{@link animations/group group()}` or a `transition()` call,\n * execution continues to the next instruction only after each of the inner animation\n * steps have completed.\n *\n * @publicApi\n **/\nfunction sequence(steps, options = null) {\n return {\n type: AnimationMetadataType.Sequence,\n steps,\n options\n };\n}\n/**\n * Declares a key/value object containing CSS properties/styles that\n * can then be used for an animation [`state`](api/animations/state), within an animation\n *`sequence`, or as styling data for calls to `animate()` and `keyframes()`.\n *\n * @param tokens A set of CSS styles or HTML styles associated with an animation state.\n * The value can be any of the following:\n * - A key-value style pair associating a CSS property with a value.\n * - An array of key-value style pairs.\n * - An asterisk (*), to use auto-styling, where styles are derived from the element\n * being animated and applied to the animation when it starts.\n *\n * Auto-styling can be used to define a state that depends on layout or other\n * environmental factors.\n *\n * @return An object that encapsulates the style data.\n *\n * @usageNotes\n * The following examples create animation styles that collect a set of\n * CSS property values:\n *\n * ```typescript\n * // string values for CSS properties\n * style({ background: \"red\", color: \"blue\" })\n *\n * // numerical pixel values\n * style({ width: 100, height: 0 })\n * ```\n *\n * The following example uses auto-styling to allow an element to animate from\n * a height of 0 up to its full height:\n *\n * ```\n * style({ height: 0 }),\n * animate(\"1s\", style({ height: \"*\" }))\n * ```\n *\n * @publicApi\n **/\nfunction style(tokens) {\n return {\n type: AnimationMetadataType.Style,\n styles: tokens,\n offset: null\n };\n}\n/**\n * Declares an animation state within a trigger attached to an element.\n *\n * @param name One or more names for the defined state in a comma-separated string.\n * The following reserved state names can be supplied to define a style for specific use\n * cases:\n *\n * - `void` You can associate styles with this name to be used when\n * the element is detached from the application. For example, when an `ngIf` evaluates\n * to false, the state of the associated element is void.\n * - `*` (asterisk) Indicates the default state. You can associate styles with this name\n * to be used as the fallback when the state that is being animated is not declared\n * within the trigger.\n *\n * @param styles A set of CSS styles associated with this state, created using the\n * `style()` function.\n * This set of styles persists on the element once the state has been reached.\n * @param options Parameters that can be passed to the state when it is invoked.\n * 0 or more key-value pairs.\n * @return An object that encapsulates the new state data.\n *\n * @usageNotes\n * Use the `trigger()` function to register states to an animation trigger.\n * Use the `transition()` function to animate between states.\n * When a state is active within a component, its associated styles persist on the element,\n * even when the animation ends.\n *\n * @publicApi\n **/\nfunction state(name, styles, options) {\n return {\n type: AnimationMetadataType.State,\n name,\n styles,\n options\n };\n}\n/**\n * Defines a set of animation styles, associating each style with an optional `offset` value.\n *\n * @param steps A set of animation styles with optional offset data.\n * The optional `offset` value for a style specifies a percentage of the total animation\n * time at which that style is applied.\n * @returns An object that encapsulates the keyframes data.\n *\n * @usageNotes\n * Use with the `animate()` call. Instead of applying animations\n * from the current state\n * to the destination state, keyframes describe how each style entry is applied and at what point\n * within the animation arc.\n * Compare [CSS Keyframe Animations](https://www.w3schools.com/css/css3_animations.asp).\n *\n * ### Usage\n *\n * In the following example, the offset values describe\n * when each `backgroundColor` value is applied. The color is red at the start, and changes to\n * blue when 20% of the total time has elapsed.\n *\n * ```typescript\n * // the provided offset values\n * animate(\"5s\", keyframes([\n * style({ backgroundColor: \"red\", offset: 0 }),\n * style({ backgroundColor: \"blue\", offset: 0.2 }),\n * style({ backgroundColor: \"orange\", offset: 0.3 }),\n * style({ backgroundColor: \"black\", offset: 1 })\n * ]))\n * ```\n *\n * If there are no `offset` values specified in the style entries, the offsets\n * are calculated automatically.\n *\n * ```typescript\n * animate(\"5s\", keyframes([\n * style({ backgroundColor: \"red\" }) // offset = 0\n * style({ backgroundColor: \"blue\" }) // offset = 0.33\n * style({ backgroundColor: \"orange\" }) // offset = 0.66\n * style({ backgroundColor: \"black\" }) // offset = 1\n * ]))\n *```\n\n * @publicApi\n */\nfunction keyframes(steps) {\n return {\n type: AnimationMetadataType.Keyframes,\n steps\n };\n}\n/**\n * Declares an animation transition which is played when a certain specified condition is met.\n *\n * @param stateChangeExpr A string with a specific format or a function that specifies when the\n * animation transition should occur (see [State Change Expression](#state-change-expression)).\n *\n * @param steps One or more animation objects that represent the animation's instructions.\n *\n * @param options An options object that can be used to specify a delay for the animation or provide\n * custom parameters for it.\n *\n * @returns An object that encapsulates the transition data.\n *\n * @usageNotes\n *\n * ### State Change Expression\n *\n * The State Change Expression instructs Angular when to run the transition's animations, it can\n *either be\n * - a string with a specific syntax\n * - or a function that compares the previous and current state (value of the expression bound to\n * the element's trigger) and returns `true` if the transition should occur or `false` otherwise\n *\n * The string format can be:\n * - `fromState => toState`, which indicates that the transition's animations should occur then the\n * expression bound to the trigger's element goes from `fromState` to `toState`\n *\n * _Example:_\n * ```typescript\n * transition('open => closed', animate('.5s ease-out', style({ height: 0 }) ))\n * ```\n *\n * - `fromState <=> toState`, which indicates that the transition's animations should occur then\n * the expression bound to the trigger's element goes from `fromState` to `toState` or vice versa\n *\n * _Example:_\n * ```typescript\n * transition('enabled <=> disabled', animate('1s cubic-bezier(0.8,0.3,0,1)'))\n * ```\n *\n * - `:enter`/`:leave`, which indicates that the transition's animations should occur when the\n * element enters or exists the DOM\n *\n * _Example:_\n * ```typescript\n * transition(':enter', [\n * style({ opacity: 0 }),\n * animate('500ms', style({ opacity: 1 }))\n * ])\n * ```\n *\n * - `:increment`/`:decrement`, which indicates that the transition's animations should occur when\n * the numerical expression bound to the trigger's element has increased in value or decreased\n *\n * _Example:_\n * ```typescript\n * transition(':increment', query('@counter', animateChild()))\n * ```\n *\n * - a sequence of any of the above divided by commas, which indicates that transition's animations\n * should occur whenever one of the state change expressions matches\n *\n * _Example:_\n * ```typescript\n * transition(':increment, * => enabled, :enter', animate('1s ease', keyframes([\n * style({ transform: 'scale(1)', offset: 0}),\n * style({ transform: 'scale(1.1)', offset: 0.7}),\n * style({ transform: 'scale(1)', offset: 1})\n * ]))),\n * ```\n *\n * Also note that in such context:\n * - `void` can be used to indicate the absence of the element\n * - asterisks can be used as wildcards that match any state\n * - (as a consequence of the above, `void => *` is equivalent to `:enter` and `* => void` is\n * equivalent to `:leave`)\n * - `true` and `false` also match expression values of `1` and `0` respectively (but do not match\n * _truthy_ and _falsy_ values)\n *\n * \n *\n * Be careful about entering end leaving elements as their transitions present a common\n * pitfall for developers.\n *\n * Note that when an element with a trigger enters the DOM its `:enter` transition always\n * gets executed, but its `:leave` transition will not be executed if the element is removed\n * alongside its parent (as it will be removed \"without warning\" before its transition has\n * a chance to be executed, the only way that such transition can occur is if the element\n * is exiting the DOM on its own).\n *\n *\n *
\n *\n * ### Animating to a Final State\n *\n * If the final step in a transition is a call to `animate()` that uses a timing value\n * with no `style` data, that step is automatically considered the final animation arc,\n * for the element to reach the final state, in such case Angular automatically adds or removes\n * CSS styles to ensure that the element is in the correct final state.\n *\n *\n * ### Usage Examples\n *\n * - Transition animations applied based on\n * the trigger's expression value\n *\n * ```html\n * \n * ...\n *
\n * ```\n *\n * ```typescript\n * trigger(\"myAnimationTrigger\", [\n * ..., // states\n * transition(\"on => off, open => closed\", animate(500)),\n * transition(\"* <=> error\", query('.indicator', animateChild()))\n * ])\n * ```\n *\n * - Transition animations applied based on custom logic dependent\n * on the trigger's expression value and provided parameters\n *\n * ```html\n * \n * ...\n *
\n * ```\n *\n * ```typescript\n * trigger(\"myAnimationTrigger\", [\n * ..., // states\n * transition(\n * (fromState, toState, _element, params) =>\n * ['firststep', 'laststep'].includes(fromState.toLowerCase())\n * && toState === params?.['target'],\n * animate('1s')\n * )\n * ])\n * ```\n *\n * @publicApi\n **/\nfunction transition(stateChangeExpr, steps, options = null) {\n return {\n type: AnimationMetadataType.Transition,\n expr: stateChangeExpr,\n animation: steps,\n options\n };\n}\n/**\n * Produces a reusable animation that can be invoked in another animation or sequence,\n * by calling the `useAnimation()` function.\n *\n * @param steps One or more animation objects, as returned by the `animate()`\n * or `sequence()` function, that form a transformation from one state to another.\n * A sequence is used by default when you pass an array.\n * @param options An options object that can contain a delay value for the start of the\n * animation, and additional developer-defined parameters.\n * Provided values for additional parameters are used as defaults,\n * and override values can be passed to the caller on invocation.\n * @returns An object that encapsulates the animation data.\n *\n * @usageNotes\n * The following example defines a reusable animation, providing some default parameter\n * values.\n *\n * ```typescript\n * var fadeAnimation = animation([\n * style({ opacity: '{{ start }}' }),\n * animate('{{ time }}',\n * style({ opacity: '{{ end }}'}))\n * ],\n * { params: { time: '1000ms', start: 0, end: 1 }});\n * ```\n *\n * The following invokes the defined animation with a call to `useAnimation()`,\n * passing in override parameter values.\n *\n * ```js\n * useAnimation(fadeAnimation, {\n * params: {\n * time: '2s',\n * start: 1,\n * end: 0\n * }\n * })\n * ```\n *\n * If any of the passed-in parameter values are missing from this call,\n * the default values are used. If one or more parameter values are missing before a step is\n * animated, `useAnimation()` throws an error.\n *\n * @publicApi\n */\nfunction animation(steps, options = null) {\n return {\n type: AnimationMetadataType.Reference,\n animation: steps,\n options\n };\n}\n/**\n * Executes a queried inner animation element within an animation sequence.\n *\n * @param options An options object that can contain a delay value for the start of the\n * animation, and additional override values for developer-defined parameters.\n * @return An object that encapsulates the child animation data.\n *\n * @usageNotes\n * Each time an animation is triggered in Angular, the parent animation\n * has priority and any child animations are blocked. In order\n * for a child animation to run, the parent animation must query each of the elements\n * containing child animations, and run them using this function.\n *\n * Note that this feature is designed to be used with `query()` and it will only work\n * with animations that are assigned using the Angular animation library. CSS keyframes\n * and transitions are not handled by this API.\n *\n * @publicApi\n */\nfunction animateChild(options = null) {\n return {\n type: AnimationMetadataType.AnimateChild,\n options\n };\n}\n/**\n * Starts a reusable animation that is created using the `animation()` function.\n *\n * @param animation The reusable animation to start.\n * @param options An options object that can contain a delay value for the start of\n * the animation, and additional override values for developer-defined parameters.\n * @return An object that contains the animation parameters.\n *\n * @publicApi\n */\nfunction useAnimation(animation, options = null) {\n return {\n type: AnimationMetadataType.AnimateRef,\n animation,\n options\n };\n}\n/**\n * Finds one or more inner elements within the current element that is\n * being animated within a sequence. Use with `animate()`.\n *\n * @param selector The element to query, or a set of elements that contain Angular-specific\n * characteristics, specified with one or more of the following tokens.\n * - `query(\":enter\")` or `query(\":leave\")` : Query for newly inserted/removed elements (not\n * all elements can be queried via these tokens, see\n * [Entering and Leaving Elements](#entering-and-leaving-elements))\n * - `query(\":animating\")` : Query all currently animating elements.\n * - `query(\"@triggerName\")` : Query elements that contain an animation trigger.\n * - `query(\"@*\")` : Query all elements that contain an animation triggers.\n * - `query(\":self\")` : Include the current element into the animation sequence.\n *\n * @param animation One or more animation steps to apply to the queried element or elements.\n * An array is treated as an animation sequence.\n * @param options An options object. Use the 'limit' field to limit the total number of\n * items to collect.\n * @return An object that encapsulates the query data.\n *\n * @usageNotes\n *\n * ### Multiple Tokens\n *\n * Tokens can be merged into a combined query selector string. For example:\n *\n * ```typescript\n * query(':self, .record:enter, .record:leave, @subTrigger', [...])\n * ```\n *\n * The `query()` function collects multiple elements and works internally by using\n * `element.querySelectorAll`. Use the `limit` field of an options object to limit\n * the total number of items to be collected. For example:\n *\n * ```js\n * query('div', [\n * animate(...),\n * animate(...)\n * ], { limit: 1 })\n * ```\n *\n * By default, throws an error when zero items are found. Set the\n * `optional` flag to ignore this error. For example:\n *\n * ```js\n * query('.some-element-that-may-not-be-there', [\n * animate(...),\n * animate(...)\n * ], { optional: true })\n * ```\n *\n * ### Entering and Leaving Elements\n *\n * Not all elements can be queried via the `:enter` and `:leave` tokens, the only ones\n * that can are those that Angular assumes can enter/leave based on their own logic\n * (if their insertion/removal is simply a consequence of that of their parent they\n * should be queried via a different token in their parent's `:enter`/`:leave` transitions).\n *\n * The only elements Angular assumes can enter/leave based on their own logic (thus the only\n * ones that can be queried via the `:enter` and `:leave` tokens) are:\n * - Those inserted dynamically (via `ViewContainerRef`)\n * - Those that have a structural directive (which, under the hood, are a subset of the above ones)\n *\n * \n *\n * Note that elements will be successfully queried via `:enter`/`:leave` even if their\n * insertion/removal is not done manually via `ViewContainerRef`or caused by their structural\n * directive (e.g. they enter/exit alongside their parent).\n *\n *
\n *\n * \n *\n * There is an exception to what previously mentioned, besides elements entering/leaving based on\n * their own logic, elements with an animation trigger can always be queried via `:leave` when\n * their parent is also leaving.\n *\n *
\n *\n * ### Usage Example\n *\n * The following example queries for inner elements and animates them\n * individually using `animate()`.\n *\n * ```typescript\n * @Component({\n * selector: 'inner',\n * template: `\n * \n *
Title
\n *
\n * Blah blah blah\n *
\n *
\n * `,\n * animations: [\n * trigger('queryAnimation', [\n * transition('* => goAnimate', [\n * // hide the inner elements\n * query('h1', style({ opacity: 0 })),\n * query('.content', style({ opacity: 0 })),\n *\n * // animate the inner elements in, one by one\n * query('h1', animate(1000, style({ opacity: 1 }))),\n * query('.content', animate(1000, style({ opacity: 1 }))),\n * ])\n * ])\n * ]\n * })\n * class Cmp {\n * exp = '';\n *\n * goAnimate() {\n * this.exp = 'goAnimate';\n * }\n * }\n * ```\n *\n * @publicApi\n */\nfunction query(selector, animation, options = null) {\n return {\n type: AnimationMetadataType.Query,\n selector,\n animation,\n options\n };\n}\n/**\n * Use within an animation `query()` call to issue a timing gap after\n * each queried item is animated.\n *\n * @param timings A delay value.\n * @param animation One ore more animation steps.\n * @returns An object that encapsulates the stagger data.\n *\n * @usageNotes\n * In the following example, a container element wraps a list of items stamped out\n * by an `ngFor`. The container element contains an animation trigger that will later be set\n * to query for each of the inner items.\n *\n * Each time items are added, the opacity fade-in animation runs,\n * and each removed item is faded out.\n * When either of these animations occur, the stagger effect is\n * applied after each item's animation is started.\n *\n * ```html\n * \n * \n *
\n * \n *
\n * {{ item }}\n *
\n *
\n * ```\n *\n * Here is the component code:\n *\n * ```typescript\n * import {trigger, transition, style, animate, query, stagger} from '@angular/animations';\n * @Component({\n * templateUrl: 'list.component.html',\n * animations: [\n * trigger('listAnimation', [\n * ...\n * ])\n * ]\n * })\n * class ListComponent {\n * items = [];\n *\n * showItems() {\n * this.items = [0,1,2,3,4];\n * }\n *\n * hideItems() {\n * this.items = [];\n * }\n *\n * toggle() {\n * this.items.length ? this.hideItems() : this.showItems();\n * }\n * }\n * ```\n *\n * Here is the animation trigger code:\n *\n * ```typescript\n * trigger('listAnimation', [\n * transition('* => *', [ // each time the binding value changes\n * query(':leave', [\n * stagger(100, [\n * animate('0.5s', style({ opacity: 0 }))\n * ])\n * ]),\n * query(':enter', [\n * style({ opacity: 0 }),\n * stagger(100, [\n * animate('0.5s', style({ opacity: 1 }))\n * ])\n * ])\n * ])\n * ])\n * ```\n *\n * @publicApi\n */\nfunction stagger(timings, animation) {\n return {\n type: AnimationMetadataType.Stagger,\n timings,\n animation\n };\n}\n\n/**\n * An injectable service that produces an animation sequence programmatically within an\n * Angular component or directive.\n * Provided by the `BrowserAnimationsModule` or `NoopAnimationsModule`.\n *\n * @usageNotes\n *\n * To use this service, add it to your component or directive as a dependency.\n * The service is instantiated along with your component.\n *\n * Apps do not typically need to create their own animation players, but if you\n * do need to, follow these steps:\n *\n * 1. Use the [AnimationBuilder.build](api/animations/AnimationBuilder#build)()
method\n * to create a programmatic animation. The method returns an `AnimationFactory` instance.\n *\n * 2. Use the factory object to create an `AnimationPlayer` and attach it to a DOM element.\n *\n * 3. Use the player object to control the animation programmatically.\n *\n * For example:\n *\n * ```ts\n * // import the service from BrowserAnimationsModule\n * import {AnimationBuilder} from '@angular/animations';\n * // require the service as a dependency\n * class MyCmp {\n * constructor(private _builder: AnimationBuilder) {}\n *\n * makeAnimation(element: any) {\n * // first define a reusable animation\n * const myAnimation = this._builder.build([\n * style({ width: 0 }),\n * animate(1000, style({ width: '100px' }))\n * ]);\n *\n * // use the returned factory object to create a player\n * const player = myAnimation.create(element);\n *\n * player.play();\n * }\n * }\n * ```\n *\n * @publicApi\n */\nlet AnimationBuilder = /*#__PURE__*/(() => {\n class AnimationBuilder {\n static {\n this.ɵfac = function AnimationBuilder_Factory(ɵt) {\n return new (ɵt || AnimationBuilder)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: AnimationBuilder,\n factory: () => (() => inject(BrowserAnimationBuilder))(),\n providedIn: 'root'\n });\n }\n }\n return AnimationBuilder;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * A factory object returned from the\n * [AnimationBuilder.build](api/animations/AnimationBuilder#build)()
\n * method.\n *\n * @publicApi\n */\nclass AnimationFactory {}\nlet BrowserAnimationBuilder = /*#__PURE__*/(() => {\n class BrowserAnimationBuilder extends AnimationBuilder {\n constructor(rootRenderer, doc) {\n super();\n this.animationModuleType = inject(ANIMATION_MODULE_TYPE, {\n optional: true\n });\n this._nextAnimationId = 0;\n const typeData = {\n id: '0',\n encapsulation: ViewEncapsulation.None,\n styles: [],\n data: {\n animation: []\n }\n };\n this._renderer = rootRenderer.createRenderer(doc.body, typeData);\n if (this.animationModuleType === null && !isAnimationRenderer(this._renderer)) {\n // We only support AnimationRenderer & DynamicDelegationRenderer for this AnimationBuilder\n throw new ɵRuntimeError(3600 /* RuntimeErrorCode.BROWSER_ANIMATION_BUILDER_INJECTED_WITHOUT_ANIMATIONS */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Angular detected that the `AnimationBuilder` was injected, but animation support was not enabled. ' + 'Please make sure that you enable animations in your application by calling `provideAnimations()` or `provideAnimationsAsync()` function.');\n }\n }\n build(animation) {\n const id = this._nextAnimationId;\n this._nextAnimationId++;\n const entry = Array.isArray(animation) ? sequence(animation) : animation;\n issueAnimationCommand(this._renderer, null, id, 'register', [entry]);\n return new BrowserAnimationFactory(id, this._renderer);\n }\n static {\n this.ɵfac = function BrowserAnimationBuilder_Factory(ɵt) {\n return new (ɵt || BrowserAnimationBuilder)(i0.ɵɵinject(i0.RendererFactory2), i0.ɵɵinject(DOCUMENT));\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: BrowserAnimationBuilder,\n factory: BrowserAnimationBuilder.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return BrowserAnimationBuilder;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass BrowserAnimationFactory extends AnimationFactory {\n constructor(_id, _renderer) {\n super();\n this._id = _id;\n this._renderer = _renderer;\n }\n create(element, options) {\n return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer);\n }\n}\nclass RendererAnimationPlayer {\n constructor(id, element, options, _renderer) {\n this.id = id;\n this.element = element;\n this._renderer = _renderer;\n this.parentPlayer = null;\n this._started = false;\n this.totalTime = 0;\n this._command('create', options);\n }\n _listen(eventName, callback) {\n return this._renderer.listen(this.element, `@@${this.id}:${eventName}`, callback);\n }\n _command(command, ...args) {\n issueAnimationCommand(this._renderer, this.element, this.id, command, args);\n }\n onDone(fn) {\n this._listen('done', fn);\n }\n onStart(fn) {\n this._listen('start', fn);\n }\n onDestroy(fn) {\n this._listen('destroy', fn);\n }\n init() {\n this._command('init');\n }\n hasStarted() {\n return this._started;\n }\n play() {\n this._command('play');\n this._started = true;\n }\n pause() {\n this._command('pause');\n }\n restart() {\n this._command('restart');\n }\n finish() {\n this._command('finish');\n }\n destroy() {\n this._command('destroy');\n }\n reset() {\n this._command('reset');\n this._started = false;\n }\n setPosition(p) {\n this._command('setPosition', p);\n }\n getPosition() {\n return unwrapAnimationRenderer(this._renderer)?.engine?.players[this.id]?.getPosition() ?? 0;\n }\n}\nfunction issueAnimationCommand(renderer, element, id, command, args) {\n renderer.setProperty(element, `@@${id}:${command}`, args);\n}\n/**\n * The following 2 methods cannot reference their correct types (AnimationRenderer &\n * DynamicDelegationRenderer) since this would introduce a import cycle.\n */\nfunction unwrapAnimationRenderer(renderer) {\n const type = renderer.ɵtype;\n if (type === 0 /* AnimationRendererType.Regular */) {\n return renderer;\n } else if (type === 1 /* AnimationRendererType.Delegated */) {\n return renderer.animationRenderer;\n }\n return null;\n}\nfunction isAnimationRenderer(renderer) {\n const type = renderer.ɵtype;\n return type === 0 /* AnimationRendererType.Regular */ || type === 1 /* AnimationRendererType.Delegated */;\n}\n\n/**\n * An empty programmatic controller for reusable animations.\n * Used internally when animations are disabled, to avoid\n * checking for the null case when an animation player is expected.\n *\n * @see {@link animate}\n * @see {@link AnimationPlayer}\n *\n * @publicApi\n */\nclass NoopAnimationPlayer {\n constructor(duration = 0, delay = 0) {\n this._onDoneFns = [];\n this._onStartFns = [];\n this._onDestroyFns = [];\n this._originalOnDoneFns = [];\n this._originalOnStartFns = [];\n this._started = false;\n this._destroyed = false;\n this._finished = false;\n this._position = 0;\n this.parentPlayer = null;\n this.totalTime = duration + delay;\n }\n _onFinish() {\n if (!this._finished) {\n this._finished = true;\n this._onDoneFns.forEach(fn => fn());\n this._onDoneFns = [];\n }\n }\n onStart(fn) {\n this._originalOnStartFns.push(fn);\n this._onStartFns.push(fn);\n }\n onDone(fn) {\n this._originalOnDoneFns.push(fn);\n this._onDoneFns.push(fn);\n }\n onDestroy(fn) {\n this._onDestroyFns.push(fn);\n }\n hasStarted() {\n return this._started;\n }\n init() {}\n play() {\n if (!this.hasStarted()) {\n this._onStart();\n this.triggerMicrotask();\n }\n this._started = true;\n }\n /** @internal */\n triggerMicrotask() {\n queueMicrotask(() => this._onFinish());\n }\n _onStart() {\n this._onStartFns.forEach(fn => fn());\n this._onStartFns = [];\n }\n pause() {}\n restart() {}\n finish() {\n this._onFinish();\n }\n destroy() {\n if (!this._destroyed) {\n this._destroyed = true;\n if (!this.hasStarted()) {\n this._onStart();\n }\n this.finish();\n this._onDestroyFns.forEach(fn => fn());\n this._onDestroyFns = [];\n }\n }\n reset() {\n this._started = false;\n this._finished = false;\n this._onStartFns = this._originalOnStartFns;\n this._onDoneFns = this._originalOnDoneFns;\n }\n setPosition(position) {\n this._position = this.totalTime ? position * this.totalTime : 1;\n }\n getPosition() {\n return this.totalTime ? this._position / this.totalTime : 1;\n }\n /** @internal */\n triggerCallback(phaseName) {\n const methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;\n methods.forEach(fn => fn());\n methods.length = 0;\n }\n}\n\n/**\n * A programmatic controller for a group of reusable animations.\n * Used internally to control animations.\n *\n * @see {@link AnimationPlayer}\n * @see {@link animations/group group}\n *\n */\nclass AnimationGroupPlayer {\n constructor(_players) {\n this._onDoneFns = [];\n this._onStartFns = [];\n this._finished = false;\n this._started = false;\n this._destroyed = false;\n this._onDestroyFns = [];\n this.parentPlayer = null;\n this.totalTime = 0;\n this.players = _players;\n let doneCount = 0;\n let destroyCount = 0;\n let startCount = 0;\n const total = this.players.length;\n if (total == 0) {\n queueMicrotask(() => this._onFinish());\n } else {\n this.players.forEach(player => {\n player.onDone(() => {\n if (++doneCount == total) {\n this._onFinish();\n }\n });\n player.onDestroy(() => {\n if (++destroyCount == total) {\n this._onDestroy();\n }\n });\n player.onStart(() => {\n if (++startCount == total) {\n this._onStart();\n }\n });\n });\n }\n this.totalTime = this.players.reduce((time, player) => Math.max(time, player.totalTime), 0);\n }\n _onFinish() {\n if (!this._finished) {\n this._finished = true;\n this._onDoneFns.forEach(fn => fn());\n this._onDoneFns = [];\n }\n }\n init() {\n this.players.forEach(player => player.init());\n }\n onStart(fn) {\n this._onStartFns.push(fn);\n }\n _onStart() {\n if (!this.hasStarted()) {\n this._started = true;\n this._onStartFns.forEach(fn => fn());\n this._onStartFns = [];\n }\n }\n onDone(fn) {\n this._onDoneFns.push(fn);\n }\n onDestroy(fn) {\n this._onDestroyFns.push(fn);\n }\n hasStarted() {\n return this._started;\n }\n play() {\n if (!this.parentPlayer) {\n this.init();\n }\n this._onStart();\n this.players.forEach(player => player.play());\n }\n pause() {\n this.players.forEach(player => player.pause());\n }\n restart() {\n this.players.forEach(player => player.restart());\n }\n finish() {\n this._onFinish();\n this.players.forEach(player => player.finish());\n }\n destroy() {\n this._onDestroy();\n }\n _onDestroy() {\n if (!this._destroyed) {\n this._destroyed = true;\n this._onFinish();\n this.players.forEach(player => player.destroy());\n this._onDestroyFns.forEach(fn => fn());\n this._onDestroyFns = [];\n }\n }\n reset() {\n this.players.forEach(player => player.reset());\n this._destroyed = false;\n this._finished = false;\n this._started = false;\n }\n setPosition(p) {\n const timeAtPosition = p * this.totalTime;\n this.players.forEach(player => {\n const position = player.totalTime ? Math.min(1, timeAtPosition / player.totalTime) : 1;\n player.setPosition(position);\n });\n }\n getPosition() {\n const longestPlayer = this.players.reduce((longestSoFar, player) => {\n const newPlayerIsLongest = longestSoFar === null || player.totalTime > longestSoFar.totalTime;\n return newPlayerIsLongest ? player : longestSoFar;\n }, null);\n return longestPlayer != null ? longestPlayer.getPosition() : 0;\n }\n beforeDestroy() {\n this.players.forEach(player => {\n if (player.beforeDestroy) {\n player.beforeDestroy();\n }\n });\n }\n /** @internal */\n triggerCallback(phaseName) {\n const methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;\n methods.forEach(fn => fn());\n methods.length = 0;\n }\n}\nconst ɵPRE_STYLE = '!';\n\n/**\n * @module\n * @description\n * Entry point for all animation APIs of the animation package.\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\n\n// This file is not used to build this module. It is only used during editing\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { AUTO_STYLE, AnimationBuilder, AnimationFactory, AnimationMetadataType, NoopAnimationPlayer, animate, animateChild, animation, group, keyframes, query, sequence, stagger, state, style, transition, trigger, useAnimation, AnimationGroupPlayer as ɵAnimationGroupPlayer, BrowserAnimationBuilder as ɵBrowserAnimationBuilder, ɵPRE_STYLE };\n","import * as i0 from '@angular/core';\nimport { Directive, InjectionToken, inject, Injectable, ComponentFactoryResolver, ApplicationRef, SecurityContext, Injector, Inject, signal, Component, ChangeDetectionStrategy, HostBinding, HostListener, makeEnvironmentProviders, NgModule } from '@angular/core';\nimport { trigger, state, style, transition, animate } from '@angular/animations';\nimport { DOCUMENT, NgIf } from '@angular/common';\nimport { Subject } from 'rxjs';\nimport * as i2 from '@angular/platform-browser';\nconst _c0 = [\"toast-component\", \"\"];\nfunction Toast_button_0_Template(rf, ctx) {\n if (rf & 1) {\n const _r1 = i0.ɵɵgetCurrentView();\n i0.ɵɵelementStart(0, \"button\", 5);\n i0.ɵɵlistener(\"click\", function Toast_button_0_Template_button_click_0_listener() {\n i0.ɵɵrestoreView(_r1);\n const ctx_r1 = i0.ɵɵnextContext();\n return i0.ɵɵresetView(ctx_r1.remove());\n });\n i0.ɵɵelementStart(1, \"span\", 6);\n i0.ɵɵtext(2, \"\\xD7\");\n i0.ɵɵelementEnd()();\n }\n}\nfunction Toast_div_1_ng_container_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementContainerStart(0);\n i0.ɵɵtext(1);\n i0.ɵɵelementContainerEnd();\n }\n if (rf & 2) {\n const ctx_r1 = i0.ɵɵnextContext(2);\n i0.ɵɵadvance();\n i0.ɵɵtextInterpolate1(\"[\", ctx_r1.duplicatesCount + 1, \"]\");\n }\n}\nfunction Toast_div_1_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\");\n i0.ɵɵtext(1);\n i0.ɵɵtemplate(2, Toast_div_1_ng_container_2_Template, 2, 1, \"ng-container\", 4);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r1 = i0.ɵɵnextContext();\n i0.ɵɵclassMap(ctx_r1.options.titleClass);\n i0.ɵɵattribute(\"aria-label\", ctx_r1.title);\n i0.ɵɵadvance();\n i0.ɵɵtextInterpolate1(\" \", ctx_r1.title, \" \");\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx_r1.duplicatesCount);\n }\n}\nfunction Toast_div_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"div\", 7);\n }\n if (rf & 2) {\n const ctx_r1 = i0.ɵɵnextContext();\n i0.ɵɵclassMap(ctx_r1.options.messageClass);\n i0.ɵɵproperty(\"innerHTML\", ctx_r1.message, i0.ɵɵsanitizeHtml);\n }\n}\nfunction Toast_div_3_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 8);\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r1 = i0.ɵɵnextContext();\n i0.ɵɵclassMap(ctx_r1.options.messageClass);\n i0.ɵɵattribute(\"aria-label\", ctx_r1.message);\n i0.ɵɵadvance();\n i0.ɵɵtextInterpolate1(\" \", ctx_r1.message, \" \");\n }\n}\nfunction Toast_div_4_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\");\n i0.ɵɵelement(1, \"div\", 9);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r1 = i0.ɵɵnextContext();\n i0.ɵɵadvance();\n i0.ɵɵstyleProp(\"width\", ctx_r1.width() + \"%\");\n }\n}\nfunction ToastNoAnimation_button_0_Template(rf, ctx) {\n if (rf & 1) {\n const _r1 = i0.ɵɵgetCurrentView();\n i0.ɵɵelementStart(0, \"button\", 5);\n i0.ɵɵlistener(\"click\", function ToastNoAnimation_button_0_Template_button_click_0_listener() {\n i0.ɵɵrestoreView(_r1);\n const ctx_r1 = i0.ɵɵnextContext();\n return i0.ɵɵresetView(ctx_r1.remove());\n });\n i0.ɵɵelementStart(1, \"span\", 6);\n i0.ɵɵtext(2, \"\\xD7\");\n i0.ɵɵelementEnd()();\n }\n}\nfunction ToastNoAnimation_div_1_ng_container_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementContainerStart(0);\n i0.ɵɵtext(1);\n i0.ɵɵelementContainerEnd();\n }\n if (rf & 2) {\n const ctx_r1 = i0.ɵɵnextContext(2);\n i0.ɵɵadvance();\n i0.ɵɵtextInterpolate1(\"[\", ctx_r1.duplicatesCount + 1, \"]\");\n }\n}\nfunction ToastNoAnimation_div_1_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\");\n i0.ɵɵtext(1);\n i0.ɵɵtemplate(2, ToastNoAnimation_div_1_ng_container_2_Template, 2, 1, \"ng-container\", 4);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r1 = i0.ɵɵnextContext();\n i0.ɵɵclassMap(ctx_r1.options.titleClass);\n i0.ɵɵattribute(\"aria-label\", ctx_r1.title);\n i0.ɵɵadvance();\n i0.ɵɵtextInterpolate1(\" \", ctx_r1.title, \" \");\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx_r1.duplicatesCount);\n }\n}\nfunction ToastNoAnimation_div_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"div\", 7);\n }\n if (rf & 2) {\n const ctx_r1 = i0.ɵɵnextContext();\n i0.ɵɵclassMap(ctx_r1.options.messageClass);\n i0.ɵɵproperty(\"innerHTML\", ctx_r1.message, i0.ɵɵsanitizeHtml);\n }\n}\nfunction ToastNoAnimation_div_3_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 8);\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r1 = i0.ɵɵnextContext();\n i0.ɵɵclassMap(ctx_r1.options.messageClass);\n i0.ɵɵattribute(\"aria-label\", ctx_r1.message);\n i0.ɵɵadvance();\n i0.ɵɵtextInterpolate1(\" \", ctx_r1.message, \" \");\n }\n}\nfunction ToastNoAnimation_div_4_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\");\n i0.ɵɵelement(1, \"div\", 9);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r1 = i0.ɵɵnextContext();\n i0.ɵɵadvance();\n i0.ɵɵstyleProp(\"width\", ctx_r1.width() + \"%\");\n }\n}\nlet ToastContainerDirective = /*#__PURE__*/(() => {\n class ToastContainerDirective {\n el;\n constructor(el) {\n this.el = el;\n }\n getContainerElement() {\n return this.el.nativeElement;\n }\n static ɵfac = function ToastContainerDirective_Factory(ɵt) {\n return new (ɵt || ToastContainerDirective)(i0.ɵɵdirectiveInject(i0.ElementRef));\n };\n static ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: ToastContainerDirective,\n selectors: [[\"\", \"toastContainer\", \"\"]],\n exportAs: [\"toastContainer\"],\n standalone: true\n });\n }\n return ToastContainerDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * A `ComponentPortal` is a portal that instantiates some Component upon attachment.\n */\nclass ComponentPortal {\n _attachedHost;\n /** The type of the component that will be instantiated for attachment. */\n component;\n /**\n * [Optional] Where the attached component should live in Angular's *logical* component tree.\n * This is different from where the component *renders*, which is determined by the PortalHost.\n * The origin necessary when the host is outside of the Angular application context.\n */\n viewContainerRef;\n /** Injector used for the instantiation of the component. */\n injector;\n constructor(component, injector) {\n this.component = component;\n this.injector = injector;\n }\n /** Attach this portal to a host. */\n attach(host, newestOnTop) {\n this._attachedHost = host;\n return host.attach(this, newestOnTop);\n }\n /** Detach this portal from its host */\n detach() {\n const host = this._attachedHost;\n if (host) {\n this._attachedHost = undefined;\n return host.detach();\n }\n }\n /** Whether this portal is attached to a host. */\n get isAttached() {\n return this._attachedHost != null;\n }\n /**\n * Sets the PortalHost reference without performing `attach()`. This is used directly by\n * the PortalHost when it is performing an `attach()` or `detach()`.\n */\n setAttachedHost(host) {\n this._attachedHost = host;\n }\n}\n/**\n * Partial implementation of PortalHost that only deals with attaching a\n * ComponentPortal\n */\nclass BasePortalHost {\n /** The portal currently attached to the host. */\n _attachedPortal;\n /** A function that will permanently dispose this host. */\n _disposeFn;\n attach(portal, newestOnTop) {\n this._attachedPortal = portal;\n return this.attachComponentPortal(portal, newestOnTop);\n }\n detach() {\n if (this._attachedPortal) {\n this._attachedPortal.setAttachedHost();\n }\n this._attachedPortal = undefined;\n if (this._disposeFn) {\n this._disposeFn();\n this._disposeFn = undefined;\n }\n }\n setDisposeFn(fn) {\n this._disposeFn = fn;\n }\n}\n\n/**\n * Reference to a toast opened via the Toastr service.\n */\nclass ToastRef {\n _overlayRef;\n /** The instance of component opened into the toast. */\n componentInstance;\n /** Count of duplicates of this toast */\n duplicatesCount = 0;\n /** Subject for notifying the user that the toast has finished closing. */\n _afterClosed = new Subject();\n /** triggered when toast is activated */\n _activate = new Subject();\n /** notifies the toast that it should close before the timeout */\n _manualClose = new Subject();\n /** notifies the toast that it should reset the timeouts */\n _resetTimeout = new Subject();\n /** notifies the toast that it should count a duplicate toast */\n _countDuplicate = new Subject();\n constructor(_overlayRef) {\n this._overlayRef = _overlayRef;\n }\n manualClose() {\n this._manualClose.next();\n this._manualClose.complete();\n }\n manualClosed() {\n return this._manualClose.asObservable();\n }\n timeoutReset() {\n return this._resetTimeout.asObservable();\n }\n countDuplicate() {\n return this._countDuplicate.asObservable();\n }\n /**\n * Close the toast.\n */\n close() {\n this._overlayRef.detach();\n this._afterClosed.next();\n this._manualClose.next();\n this._afterClosed.complete();\n this._manualClose.complete();\n this._activate.complete();\n this._resetTimeout.complete();\n this._countDuplicate.complete();\n }\n /** Gets an observable that is notified when the toast is finished closing. */\n afterClosed() {\n return this._afterClosed.asObservable();\n }\n isInactive() {\n return this._activate.isStopped;\n }\n activate() {\n this._activate.next();\n this._activate.complete();\n }\n /** Gets an observable that is notified when the toast has started opening. */\n afterActivate() {\n return this._activate.asObservable();\n }\n /** Reset the toast timouts and count duplicates */\n onDuplicate(resetTimeout, countDuplicate) {\n if (resetTimeout) {\n this._resetTimeout.next();\n }\n if (countDuplicate) {\n this._countDuplicate.next(++this.duplicatesCount);\n }\n }\n}\n\n/**\n * Everything a toast needs to launch\n */\nclass ToastPackage {\n toastId;\n config;\n message;\n title;\n toastType;\n toastRef;\n _onTap = new Subject();\n _onAction = new Subject();\n constructor(toastId, config, message, title, toastType, toastRef) {\n this.toastId = toastId;\n this.config = config;\n this.message = message;\n this.title = title;\n this.toastType = toastType;\n this.toastRef = toastRef;\n this.toastRef.afterClosed().subscribe(() => {\n this._onAction.complete();\n this._onTap.complete();\n });\n }\n /** Fired on click */\n triggerTap() {\n this._onTap.next();\n if (this.config.tapToDismiss) {\n this._onTap.complete();\n }\n }\n onTap() {\n return this._onTap.asObservable();\n }\n /** available for use in custom toast */\n triggerAction(action) {\n this._onAction.next(action);\n }\n onAction() {\n return this._onAction.asObservable();\n }\n}\nconst DefaultNoComponentGlobalConfig = {\n maxOpened: 0,\n autoDismiss: false,\n newestOnTop: true,\n preventDuplicates: false,\n countDuplicates: false,\n resetTimeoutOnDuplicate: false,\n includeTitleDuplicates: false,\n iconClasses: {\n error: 'toast-error',\n info: 'toast-info',\n success: 'toast-success',\n warning: 'toast-warning'\n },\n // Individual\n closeButton: false,\n disableTimeOut: false,\n timeOut: 5000,\n extendedTimeOut: 1000,\n enableHtml: false,\n progressBar: false,\n toastClass: 'ngx-toastr',\n positionClass: 'toast-top-right',\n titleClass: 'toast-title',\n messageClass: 'toast-message',\n easing: 'ease-in',\n easeTime: 300,\n tapToDismiss: true,\n onActivateTick: false,\n progressAnimation: 'decreasing'\n};\nconst TOAST_CONFIG = new InjectionToken('ToastConfig');\n\n/**\n * A PortalHost for attaching portals to an arbitrary DOM element outside of the Angular\n * application context.\n *\n * This is the only part of the portal core that directly touches the DOM.\n */\nclass DomPortalHost extends BasePortalHost {\n _hostDomElement;\n _componentFactoryResolver;\n _appRef;\n constructor(_hostDomElement, _componentFactoryResolver, _appRef) {\n super();\n this._hostDomElement = _hostDomElement;\n this._componentFactoryResolver = _componentFactoryResolver;\n this._appRef = _appRef;\n }\n /**\n * Attach the given ComponentPortal to DOM element using the ComponentFactoryResolver.\n * @param portal Portal to be attached\n */\n attachComponentPortal(portal, newestOnTop) {\n const componentFactory = this._componentFactoryResolver.resolveComponentFactory(portal.component);\n let componentRef;\n // If the portal specifies a ViewContainerRef, we will use that as the attachment point\n // for the component (in terms of Angular's component tree, not rendering).\n // When the ViewContainerRef is missing, we use the factory to create the component directly\n // and then manually attach the ChangeDetector for that component to the application (which\n // happens automatically when using a ViewContainer).\n componentRef = componentFactory.create(portal.injector);\n // When creating a component outside of a ViewContainer, we need to manually register\n // its ChangeDetector with the application. This API is unfortunately not yet published\n // in Angular core. The change detector must also be deregistered when the component\n // is destroyed to prevent memory leaks.\n this._appRef.attachView(componentRef.hostView);\n this.setDisposeFn(() => {\n this._appRef.detachView(componentRef.hostView);\n componentRef.destroy();\n });\n // At this point the component has been instantiated, so we move it to the location in the DOM\n // where we want it to be rendered.\n if (newestOnTop) {\n this._hostDomElement.insertBefore(this._getComponentRootNode(componentRef), this._hostDomElement.firstChild);\n } else {\n this._hostDomElement.appendChild(this._getComponentRootNode(componentRef));\n }\n return componentRef;\n }\n /** Gets the root HTMLElement for an instantiated component. */\n _getComponentRootNode(componentRef) {\n return componentRef.hostView.rootNodes[0];\n }\n}\n\n/** Container inside which all toasts will render. */\nlet OverlayContainer = /*#__PURE__*/(() => {\n class OverlayContainer {\n _document = inject(DOCUMENT);\n _containerElement;\n ngOnDestroy() {\n if (this._containerElement && this._containerElement.parentNode) {\n this._containerElement.parentNode.removeChild(this._containerElement);\n }\n }\n /**\n * This method returns the overlay container element. It will lazily\n * create the element the first time it is called to facilitate using\n * the container in non-browser environments.\n * @returns the container element\n */\n getContainerElement() {\n if (!this._containerElement) {\n this._createContainer();\n }\n return this._containerElement;\n }\n /**\n * Create the overlay container element, which is simply a div\n * with the 'cdk-overlay-container' class on the document body\n * and 'aria-live=\"polite\"'\n */\n _createContainer() {\n const container = this._document.createElement('div');\n container.classList.add('overlay-container');\n container.setAttribute('aria-live', 'polite');\n this._document.body.appendChild(container);\n this._containerElement = container;\n }\n static ɵfac = function OverlayContainer_Factory(ɵt) {\n return new (ɵt || OverlayContainer)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: OverlayContainer,\n factory: OverlayContainer.ɵfac,\n providedIn: 'root'\n });\n }\n return OverlayContainer;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Reference to an overlay that has been created with the Overlay service.\n * Used to manipulate or dispose of said overlay.\n */\nclass OverlayRef {\n _portalHost;\n constructor(_portalHost) {\n this._portalHost = _portalHost;\n }\n attach(portal, newestOnTop = true) {\n return this._portalHost.attach(portal, newestOnTop);\n }\n /**\n * Detaches an overlay from a portal.\n * @returns Resolves when the overlay has been detached.\n */\n detach() {\n return this._portalHost.detach();\n }\n}\n\n/**\n * Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be\n * used as a low-level building building block for other components. Dialogs, tooltips, menus,\n * selects, etc. can all be built using overlays. The service should primarily be used by authors\n * of re-usable components rather than developers building end-user applications.\n *\n * An overlay *is* a PortalHost, so any kind of Portal can be loaded into one.\n */\nlet Overlay = /*#__PURE__*/(() => {\n class Overlay {\n _overlayContainer = inject(OverlayContainer);\n _componentFactoryResolver = inject(ComponentFactoryResolver);\n _appRef = inject(ApplicationRef);\n _document = inject(DOCUMENT);\n // Namespace panes by overlay container\n _paneElements = new Map();\n /**\n * Creates an overlay.\n * @returns A reference to the created overlay.\n */\n create(positionClass, overlayContainer) {\n // get existing pane if possible\n return this._createOverlayRef(this.getPaneElement(positionClass, overlayContainer));\n }\n getPaneElement(positionClass = '', overlayContainer) {\n if (!this._paneElements.get(overlayContainer)) {\n this._paneElements.set(overlayContainer, {});\n }\n if (!this._paneElements.get(overlayContainer)[positionClass]) {\n this._paneElements.get(overlayContainer)[positionClass] = this._createPaneElement(positionClass, overlayContainer);\n }\n return this._paneElements.get(overlayContainer)[positionClass];\n }\n /**\n * Creates the DOM element for an overlay and appends it to the overlay container.\n * @returns Newly-created pane element\n */\n _createPaneElement(positionClass, overlayContainer) {\n const pane = this._document.createElement('div');\n pane.id = 'toast-container';\n pane.classList.add(positionClass);\n pane.classList.add('toast-container');\n if (!overlayContainer) {\n this._overlayContainer.getContainerElement().appendChild(pane);\n } else {\n overlayContainer.getContainerElement().appendChild(pane);\n }\n return pane;\n }\n /**\n * Create a DomPortalHost into which the overlay content can be loaded.\n * @param pane The DOM element to turn into a portal host.\n * @returns A portal host for the given DOM element.\n */\n _createPortalHost(pane) {\n return new DomPortalHost(pane, this._componentFactoryResolver, this._appRef);\n }\n /**\n * Creates an OverlayRef for an overlay in the given DOM element.\n * @param pane DOM element for the overlay\n */\n _createOverlayRef(pane) {\n return new OverlayRef(this._createPortalHost(pane));\n }\n static ɵfac = function Overlay_Factory(ɵt) {\n return new (ɵt || Overlay)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Overlay,\n factory: Overlay.ɵfac,\n providedIn: 'root'\n });\n }\n return Overlay;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ToastrService = /*#__PURE__*/(() => {\n class ToastrService {\n overlay;\n _injector;\n sanitizer;\n ngZone;\n toastrConfig;\n currentlyActive = 0;\n toasts = [];\n overlayContainer;\n previousToastMessage;\n index = 0;\n constructor(token, overlay, _injector, sanitizer, ngZone) {\n this.overlay = overlay;\n this._injector = _injector;\n this.sanitizer = sanitizer;\n this.ngZone = ngZone;\n this.toastrConfig = {\n ...token.default,\n ...token.config\n };\n if (token.config.iconClasses) {\n this.toastrConfig.iconClasses = {\n ...token.default.iconClasses,\n ...token.config.iconClasses\n };\n }\n }\n /** show toast */\n show(message, title, override = {}, type = '') {\n return this._preBuildNotification(type, message, title, this.applyConfig(override));\n }\n /** show successful toast */\n success(message, title, override = {}) {\n const type = this.toastrConfig.iconClasses.success || '';\n return this._preBuildNotification(type, message, title, this.applyConfig(override));\n }\n /** show error toast */\n error(message, title, override = {}) {\n const type = this.toastrConfig.iconClasses.error || '';\n return this._preBuildNotification(type, message, title, this.applyConfig(override));\n }\n /** show info toast */\n info(message, title, override = {}) {\n const type = this.toastrConfig.iconClasses.info || '';\n return this._preBuildNotification(type, message, title, this.applyConfig(override));\n }\n /** show warning toast */\n warning(message, title, override = {}) {\n const type = this.toastrConfig.iconClasses.warning || '';\n return this._preBuildNotification(type, message, title, this.applyConfig(override));\n }\n /**\n * Remove all or a single toast by id\n */\n clear(toastId) {\n // Call every toastRef manualClose function\n for (const toast of this.toasts) {\n if (toastId !== undefined) {\n if (toast.toastId === toastId) {\n toast.toastRef.manualClose();\n return;\n }\n } else {\n toast.toastRef.manualClose();\n }\n }\n }\n /**\n * Remove and destroy a single toast by id\n */\n remove(toastId) {\n const found = this._findToast(toastId);\n if (!found) {\n return false;\n }\n found.activeToast.toastRef.close();\n this.toasts.splice(found.index, 1);\n this.currentlyActive = this.currentlyActive - 1;\n if (!this.toastrConfig.maxOpened || !this.toasts.length) {\n return false;\n }\n if (this.currentlyActive < this.toastrConfig.maxOpened && this.toasts[this.currentlyActive]) {\n const p = this.toasts[this.currentlyActive].toastRef;\n if (!p.isInactive()) {\n this.currentlyActive = this.currentlyActive + 1;\n p.activate();\n }\n }\n return true;\n }\n /**\n * Determines if toast message is already shown\n */\n findDuplicate(title = '', message = '', resetOnDuplicate, countDuplicates) {\n const {\n includeTitleDuplicates\n } = this.toastrConfig;\n for (const toast of this.toasts) {\n const hasDuplicateTitle = includeTitleDuplicates && toast.title === title;\n if ((!includeTitleDuplicates || hasDuplicateTitle) && toast.message === message) {\n toast.toastRef.onDuplicate(resetOnDuplicate, countDuplicates);\n return toast;\n }\n }\n return null;\n }\n /** create a clone of global config and apply individual settings */\n applyConfig(override = {}) {\n return {\n ...this.toastrConfig,\n ...override\n };\n }\n /**\n * Find toast object by id\n */\n _findToast(toastId) {\n for (let i = 0; i < this.toasts.length; i++) {\n if (this.toasts[i].toastId === toastId) {\n return {\n index: i,\n activeToast: this.toasts[i]\n };\n }\n }\n return null;\n }\n /**\n * Determines the need to run inside angular's zone then builds the toast\n */\n _preBuildNotification(toastType, message, title, config) {\n if (config.onActivateTick) {\n return this.ngZone.run(() => this._buildNotification(toastType, message, title, config));\n }\n return this._buildNotification(toastType, message, title, config);\n }\n /**\n * Creates and attaches toast data to component\n * returns the active toast, or in case preventDuplicates is enabled the original/non-duplicate active toast.\n */\n _buildNotification(toastType, message, title, config) {\n if (!config.toastComponent) {\n throw new Error('toastComponent required');\n }\n // max opened and auto dismiss = true\n // if timeout = 0 resetting it would result in setting this.hideTime = Date.now(). Hence, we only want to reset timeout if there is\n // a timeout at all\n const duplicate = this.findDuplicate(title, message, this.toastrConfig.resetTimeoutOnDuplicate && config.timeOut > 0, this.toastrConfig.countDuplicates);\n if ((this.toastrConfig.includeTitleDuplicates && title || message) && this.toastrConfig.preventDuplicates && duplicate !== null) {\n return duplicate;\n }\n this.previousToastMessage = message;\n let keepInactive = false;\n if (this.toastrConfig.maxOpened && this.currentlyActive >= this.toastrConfig.maxOpened) {\n keepInactive = true;\n if (this.toastrConfig.autoDismiss) {\n this.clear(this.toasts[0].toastId);\n }\n }\n const overlayRef = this.overlay.create(config.positionClass, this.overlayContainer);\n this.index = this.index + 1;\n let sanitizedMessage = message;\n if (message && config.enableHtml) {\n sanitizedMessage = this.sanitizer.sanitize(SecurityContext.HTML, message);\n }\n const toastRef = new ToastRef(overlayRef);\n const toastPackage = new ToastPackage(this.index, config, sanitizedMessage, title, toastType, toastRef);\n /** New injector that contains an instance of `ToastPackage`. */\n const providers = [{\n provide: ToastPackage,\n useValue: toastPackage\n }];\n const toastInjector = Injector.create({\n providers,\n parent: this._injector\n });\n const component = new ComponentPortal(config.toastComponent, toastInjector);\n const portal = overlayRef.attach(component, config.newestOnTop);\n toastRef.componentInstance = portal.instance;\n const ins = {\n toastId: this.index,\n title: title || '',\n message: message || '',\n toastRef,\n onShown: toastRef.afterActivate(),\n onHidden: toastRef.afterClosed(),\n onTap: toastPackage.onTap(),\n onAction: toastPackage.onAction(),\n portal\n };\n if (!keepInactive) {\n this.currentlyActive = this.currentlyActive + 1;\n setTimeout(() => {\n ins.toastRef.activate();\n });\n }\n this.toasts.push(ins);\n return ins;\n }\n static ɵfac = function ToastrService_Factory(ɵt) {\n return new (ɵt || ToastrService)(i0.ɵɵinject(TOAST_CONFIG), i0.ɵɵinject(Overlay), i0.ɵɵinject(i0.Injector), i0.ɵɵinject(i2.DomSanitizer), i0.ɵɵinject(i0.NgZone));\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ToastrService,\n factory: ToastrService.ɵfac,\n providedIn: 'root'\n });\n }\n return ToastrService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet Toast = /*#__PURE__*/(() => {\n class Toast {\n toastrService;\n toastPackage;\n ngZone;\n message;\n title;\n options;\n duplicatesCount;\n originalTimeout;\n /** width of progress bar */\n width = signal(-1);\n /** a combination of toast type and options.toastClass */\n toastClasses = '';\n state;\n /** controls animation */\n get _state() {\n return this.state();\n }\n /** hides component when waiting to be displayed */\n get displayStyle() {\n if (this.state().value === 'inactive') {\n return 'none';\n }\n return;\n }\n timeout;\n intervalId;\n hideTime;\n sub;\n sub1;\n sub2;\n sub3;\n constructor(toastrService, toastPackage, ngZone) {\n this.toastrService = toastrService;\n this.toastPackage = toastPackage;\n this.ngZone = ngZone;\n this.message = toastPackage.message;\n this.title = toastPackage.title;\n this.options = toastPackage.config;\n this.originalTimeout = toastPackage.config.timeOut;\n this.toastClasses = `${toastPackage.toastType} ${toastPackage.config.toastClass}`;\n this.sub = toastPackage.toastRef.afterActivate().subscribe(() => {\n this.activateToast();\n });\n this.sub1 = toastPackage.toastRef.manualClosed().subscribe(() => {\n this.remove();\n });\n this.sub2 = toastPackage.toastRef.timeoutReset().subscribe(() => {\n this.resetTimeout();\n });\n this.sub3 = toastPackage.toastRef.countDuplicate().subscribe(count => {\n this.duplicatesCount = count;\n });\n this.state = signal({\n value: 'inactive',\n params: {\n easeTime: this.toastPackage.config.easeTime,\n easing: 'ease-in'\n }\n });\n }\n ngOnDestroy() {\n this.sub.unsubscribe();\n this.sub1.unsubscribe();\n this.sub2.unsubscribe();\n this.sub3.unsubscribe();\n clearInterval(this.intervalId);\n clearTimeout(this.timeout);\n }\n /**\n * activates toast and sets timeout\n */\n activateToast() {\n this.state.update(state => ({\n ...state,\n value: 'active'\n }));\n if (!(this.options.disableTimeOut === true || this.options.disableTimeOut === 'timeOut') && this.options.timeOut) {\n this.outsideTimeout(() => this.remove(), this.options.timeOut);\n this.hideTime = new Date().getTime() + this.options.timeOut;\n if (this.options.progressBar) {\n this.outsideInterval(() => this.updateProgress(), 10);\n }\n }\n }\n /**\n * updates progress bar width\n */\n updateProgress() {\n if (this.width() === 0 || this.width() === 100 || !this.options.timeOut) {\n return;\n }\n const now = new Date().getTime();\n const remaining = this.hideTime - now;\n this.width.set(remaining / this.options.timeOut * 100);\n if (this.options.progressAnimation === 'increasing') {\n this.width.update(width => 100 - width);\n }\n if (this.width() <= 0) {\n this.width.set(0);\n }\n if (this.width() >= 100) {\n this.width.set(100);\n }\n }\n resetTimeout() {\n clearTimeout(this.timeout);\n clearInterval(this.intervalId);\n this.state.update(state => ({\n ...state,\n value: 'active'\n }));\n this.outsideTimeout(() => this.remove(), this.originalTimeout);\n this.options.timeOut = this.originalTimeout;\n this.hideTime = new Date().getTime() + (this.options.timeOut || 0);\n this.width.set(-1);\n if (this.options.progressBar) {\n this.outsideInterval(() => this.updateProgress(), 10);\n }\n }\n /**\n * tells toastrService to remove this toast after animation time\n */\n remove() {\n if (this.state().value === 'removed') {\n return;\n }\n clearTimeout(this.timeout);\n this.state.update(state => ({\n ...state,\n value: 'removed'\n }));\n this.outsideTimeout(() => this.toastrService.remove(this.toastPackage.toastId), +this.toastPackage.config.easeTime);\n }\n tapToast() {\n if (this.state().value === 'removed') {\n return;\n }\n this.toastPackage.triggerTap();\n if (this.options.tapToDismiss) {\n this.remove();\n }\n }\n stickAround() {\n if (this.state().value === 'removed') {\n return;\n }\n if (this.options.disableTimeOut !== 'extendedTimeOut') {\n clearTimeout(this.timeout);\n this.options.timeOut = 0;\n this.hideTime = 0;\n // disable progressBar\n clearInterval(this.intervalId);\n this.width.set(0);\n }\n }\n delayedHideToast() {\n if (this.options.disableTimeOut === true || this.options.disableTimeOut === 'extendedTimeOut' || this.options.extendedTimeOut === 0 || this.state().value === 'removed') {\n return;\n }\n this.outsideTimeout(() => this.remove(), this.options.extendedTimeOut);\n this.options.timeOut = this.options.extendedTimeOut;\n this.hideTime = new Date().getTime() + (this.options.timeOut || 0);\n this.width.set(-1);\n if (this.options.progressBar) {\n this.outsideInterval(() => this.updateProgress(), 10);\n }\n }\n outsideTimeout(func, timeout) {\n if (this.ngZone) {\n this.ngZone.runOutsideAngular(() => this.timeout = setTimeout(() => this.runInsideAngular(func), timeout));\n } else {\n this.timeout = setTimeout(() => func(), timeout);\n }\n }\n outsideInterval(func, timeout) {\n if (this.ngZone) {\n this.ngZone.runOutsideAngular(() => this.intervalId = setInterval(() => this.runInsideAngular(func), timeout));\n } else {\n this.intervalId = setInterval(() => func(), timeout);\n }\n }\n runInsideAngular(func) {\n if (this.ngZone) {\n this.ngZone.run(() => func());\n } else {\n func();\n }\n }\n static ɵfac = function Toast_Factory(ɵt) {\n return new (ɵt || Toast)(i0.ɵɵdirectiveInject(ToastrService), i0.ɵɵdirectiveInject(ToastPackage), i0.ɵɵdirectiveInject(i0.NgZone));\n };\n static ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: Toast,\n selectors: [[\"\", \"toast-component\", \"\"]],\n hostVars: 5,\n hostBindings: function Toast_HostBindings(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵlistener(\"click\", function Toast_click_HostBindingHandler() {\n return ctx.tapToast();\n })(\"mouseenter\", function Toast_mouseenter_HostBindingHandler() {\n return ctx.stickAround();\n })(\"mouseleave\", function Toast_mouseleave_HostBindingHandler() {\n return ctx.delayedHideToast();\n });\n }\n if (rf & 2) {\n i0.ɵɵsyntheticHostProperty(\"@flyInOut\", ctx._state);\n i0.ɵɵclassMap(ctx.toastClasses);\n i0.ɵɵstyleProp(\"display\", ctx.displayStyle);\n }\n },\n standalone: true,\n features: [i0.ɵɵStandaloneFeature],\n attrs: _c0,\n decls: 5,\n vars: 5,\n consts: [[\"type\", \"button\", \"class\", \"toast-close-button\", \"aria-label\", \"Close\", 3, \"click\", 4, \"ngIf\"], [3, \"class\", 4, \"ngIf\"], [\"role\", \"alert\", 3, \"class\", \"innerHTML\", 4, \"ngIf\"], [\"role\", \"alert\", 3, \"class\", 4, \"ngIf\"], [4, \"ngIf\"], [\"type\", \"button\", \"aria-label\", \"Close\", 1, \"toast-close-button\", 3, \"click\"], [\"aria-hidden\", \"true\"], [\"role\", \"alert\", 3, \"innerHTML\"], [\"role\", \"alert\"], [1, \"toast-progress\"]],\n template: function Toast_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵtemplate(0, Toast_button_0_Template, 3, 0, \"button\", 0)(1, Toast_div_1_Template, 3, 5, \"div\", 1)(2, Toast_div_2_Template, 1, 3, \"div\", 2)(3, Toast_div_3_Template, 2, 4, \"div\", 3)(4, Toast_div_4_Template, 2, 2, \"div\", 4);\n }\n if (rf & 2) {\n i0.ɵɵproperty(\"ngIf\", ctx.options.closeButton);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx.title);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx.message && ctx.options.enableHtml);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx.message && !ctx.options.enableHtml);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx.options.progressBar);\n }\n },\n dependencies: [NgIf],\n encapsulation: 2,\n data: {\n animation: [trigger('flyInOut', [state('inactive', style({\n opacity: 0\n })), state('active', style({\n opacity: 1\n })), state('removed', style({\n opacity: 0\n })), transition('inactive => active', animate('{{ easeTime }}ms {{ easing }}')), transition('active => removed', animate('{{ easeTime }}ms {{ easing }}'))])]\n },\n changeDetection: 0\n });\n }\n return Toast;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst DefaultGlobalConfig = {\n ...DefaultNoComponentGlobalConfig,\n toastComponent: Toast\n};\n/**\n * @description\n * Provides the `TOAST_CONFIG` token with the given config.\n *\n * @param config The config to configure toastr.\n * @returns The environment providers.\n *\n * @example\n * ```ts\n * import { provideToastr } from 'ngx-toastr';\n *\n * bootstrap(AppComponent, {\n * providers: [\n * provideToastr({\n * timeOut: 2000,\n * positionClass: 'toast-top-right',\n * }),\n * ],\n * })\n */\nconst provideToastr = (config = {}) => {\n const providers = [{\n provide: TOAST_CONFIG,\n useValue: {\n default: DefaultGlobalConfig,\n config\n }\n }];\n return makeEnvironmentProviders(providers);\n};\nlet ToastrModule = /*#__PURE__*/(() => {\n class ToastrModule {\n static forRoot(config = {}) {\n return {\n ngModule: ToastrModule,\n providers: [provideToastr(config)]\n };\n }\n static ɵfac = function ToastrModule_Factory(ɵt) {\n return new (ɵt || ToastrModule)();\n };\n static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: ToastrModule\n });\n static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n }\n return ToastrModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ToastrComponentlessModule = /*#__PURE__*/(() => {\n class ToastrComponentlessModule {\n static forRoot(config = {}) {\n return {\n ngModule: ToastrModule,\n providers: [{\n provide: TOAST_CONFIG,\n useValue: {\n default: DefaultNoComponentGlobalConfig,\n config\n }\n }]\n };\n }\n static ɵfac = function ToastrComponentlessModule_Factory(ɵt) {\n return new (ɵt || ToastrComponentlessModule)();\n };\n static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: ToastrComponentlessModule\n });\n static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n }\n return ToastrComponentlessModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ToastNoAnimation = /*#__PURE__*/(() => {\n class ToastNoAnimation {\n toastrService;\n toastPackage;\n appRef;\n message;\n title;\n options;\n duplicatesCount;\n originalTimeout;\n /** width of progress bar */\n width = signal(-1);\n /** a combination of toast type and options.toastClass */\n toastClasses = '';\n /** hides component when waiting to be displayed */\n get displayStyle() {\n if (this.state() === 'inactive') {\n return 'none';\n }\n return null;\n }\n /** controls animation */\n state = signal('inactive');\n timeout;\n intervalId;\n hideTime;\n sub;\n sub1;\n sub2;\n sub3;\n constructor(toastrService, toastPackage, appRef) {\n this.toastrService = toastrService;\n this.toastPackage = toastPackage;\n this.appRef = appRef;\n this.message = toastPackage.message;\n this.title = toastPackage.title;\n this.options = toastPackage.config;\n this.originalTimeout = toastPackage.config.timeOut;\n this.toastClasses = `${toastPackage.toastType} ${toastPackage.config.toastClass}`;\n this.sub = toastPackage.toastRef.afterActivate().subscribe(() => {\n this.activateToast();\n });\n this.sub1 = toastPackage.toastRef.manualClosed().subscribe(() => {\n this.remove();\n });\n this.sub2 = toastPackage.toastRef.timeoutReset().subscribe(() => {\n this.resetTimeout();\n });\n this.sub3 = toastPackage.toastRef.countDuplicate().subscribe(count => {\n this.duplicatesCount = count;\n });\n }\n ngOnDestroy() {\n this.sub.unsubscribe();\n this.sub1.unsubscribe();\n this.sub2.unsubscribe();\n this.sub3.unsubscribe();\n clearInterval(this.intervalId);\n clearTimeout(this.timeout);\n }\n /**\n * activates toast and sets timeout\n */\n activateToast() {\n this.state.set('active');\n if (!(this.options.disableTimeOut === true || this.options.disableTimeOut === 'timeOut') && this.options.timeOut) {\n this.timeout = setTimeout(() => {\n this.remove();\n }, this.options.timeOut);\n this.hideTime = new Date().getTime() + this.options.timeOut;\n if (this.options.progressBar) {\n this.intervalId = setInterval(() => this.updateProgress(), 10);\n }\n }\n if (this.options.onActivateTick) {\n this.appRef.tick();\n }\n }\n /**\n * updates progress bar width\n */\n updateProgress() {\n if (this.width() === 0 || this.width() === 100 || !this.options.timeOut) {\n return;\n }\n const now = new Date().getTime();\n const remaining = this.hideTime - now;\n this.width.set(remaining / this.options.timeOut * 100);\n if (this.options.progressAnimation === 'increasing') {\n this.width.update(width => 100 - width);\n }\n if (this.width() <= 0) {\n this.width.set(0);\n }\n if (this.width() >= 100) {\n this.width.set(100);\n }\n }\n resetTimeout() {\n clearTimeout(this.timeout);\n clearInterval(this.intervalId);\n this.state.set('active');\n this.options.timeOut = this.originalTimeout;\n this.timeout = setTimeout(() => this.remove(), this.originalTimeout);\n this.hideTime = new Date().getTime() + (this.originalTimeout || 0);\n this.width.set(-1);\n if (this.options.progressBar) {\n this.intervalId = setInterval(() => this.updateProgress(), 10);\n }\n }\n /**\n * tells toastrService to remove this toast after animation time\n */\n remove() {\n if (this.state() === 'removed') {\n return;\n }\n clearTimeout(this.timeout);\n this.state.set('removed');\n this.timeout = setTimeout(() => this.toastrService.remove(this.toastPackage.toastId));\n }\n tapToast() {\n if (this.state() === 'removed') {\n return;\n }\n this.toastPackage.triggerTap();\n if (this.options.tapToDismiss) {\n this.remove();\n }\n }\n stickAround() {\n if (this.state() === 'removed') {\n return;\n }\n clearTimeout(this.timeout);\n this.options.timeOut = 0;\n this.hideTime = 0;\n // disable progressBar\n clearInterval(this.intervalId);\n this.width.set(0);\n }\n delayedHideToast() {\n if (this.options.disableTimeOut === true || this.options.disableTimeOut === 'extendedTimeOut' || this.options.extendedTimeOut === 0 || this.state() === 'removed') {\n return;\n }\n this.timeout = setTimeout(() => this.remove(), this.options.extendedTimeOut);\n this.options.timeOut = this.options.extendedTimeOut;\n this.hideTime = new Date().getTime() + (this.options.timeOut || 0);\n this.width.set(-1);\n if (this.options.progressBar) {\n this.intervalId = setInterval(() => this.updateProgress(), 10);\n }\n }\n static ɵfac = function ToastNoAnimation_Factory(ɵt) {\n return new (ɵt || ToastNoAnimation)(i0.ɵɵdirectiveInject(ToastrService), i0.ɵɵdirectiveInject(ToastPackage), i0.ɵɵdirectiveInject(i0.ApplicationRef));\n };\n static ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: ToastNoAnimation,\n selectors: [[\"\", \"toast-component\", \"\"]],\n hostVars: 4,\n hostBindings: function ToastNoAnimation_HostBindings(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵlistener(\"click\", function ToastNoAnimation_click_HostBindingHandler() {\n return ctx.tapToast();\n })(\"mouseenter\", function ToastNoAnimation_mouseenter_HostBindingHandler() {\n return ctx.stickAround();\n })(\"mouseleave\", function ToastNoAnimation_mouseleave_HostBindingHandler() {\n return ctx.delayedHideToast();\n });\n }\n if (rf & 2) {\n i0.ɵɵclassMap(ctx.toastClasses);\n i0.ɵɵstyleProp(\"display\", ctx.displayStyle);\n }\n },\n standalone: true,\n features: [i0.ɵɵStandaloneFeature],\n attrs: _c0,\n decls: 5,\n vars: 5,\n consts: [[\"type\", \"button\", \"class\", \"toast-close-button\", \"aria-label\", \"Close\", 3, \"click\", 4, \"ngIf\"], [3, \"class\", 4, \"ngIf\"], [\"role\", \"alert\", 3, \"class\", \"innerHTML\", 4, \"ngIf\"], [\"role\", \"alert\", 3, \"class\", 4, \"ngIf\"], [4, \"ngIf\"], [\"type\", \"button\", \"aria-label\", \"Close\", 1, \"toast-close-button\", 3, \"click\"], [\"aria-hidden\", \"true\"], [\"role\", \"alert\", 3, \"innerHTML\"], [\"role\", \"alert\"], [1, \"toast-progress\"]],\n template: function ToastNoAnimation_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵtemplate(0, ToastNoAnimation_button_0_Template, 3, 0, \"button\", 0)(1, ToastNoAnimation_div_1_Template, 3, 5, \"div\", 1)(2, ToastNoAnimation_div_2_Template, 1, 3, \"div\", 2)(3, ToastNoAnimation_div_3_Template, 2, 4, \"div\", 3)(4, ToastNoAnimation_div_4_Template, 2, 2, \"div\", 4);\n }\n if (rf & 2) {\n i0.ɵɵproperty(\"ngIf\", ctx.options.closeButton);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx.title);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx.message && ctx.options.enableHtml);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx.message && !ctx.options.enableHtml);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngIf\", ctx.options.progressBar);\n }\n },\n dependencies: [NgIf],\n encapsulation: 2,\n changeDetection: 0\n });\n }\n return ToastNoAnimation;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst DefaultNoAnimationsGlobalConfig = {\n ...DefaultNoComponentGlobalConfig,\n toastComponent: ToastNoAnimation\n};\nlet ToastNoAnimationModule = /*#__PURE__*/(() => {\n class ToastNoAnimationModule {\n static forRoot(config = {}) {\n return {\n ngModule: ToastNoAnimationModule,\n providers: [{\n provide: TOAST_CONFIG,\n useValue: {\n default: DefaultNoAnimationsGlobalConfig,\n config\n }\n }]\n };\n }\n static ɵfac = function ToastNoAnimationModule_Factory(ɵt) {\n return new (ɵt || ToastNoAnimationModule)();\n };\n static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: ToastNoAnimationModule\n });\n static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n }\n return ToastNoAnimationModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { BasePortalHost, ComponentPortal, DefaultGlobalConfig, DefaultNoAnimationsGlobalConfig, DefaultNoComponentGlobalConfig, Overlay, OverlayContainer, OverlayRef, TOAST_CONFIG, Toast, ToastContainerDirective, ToastNoAnimation, ToastNoAnimationModule, ToastPackage, ToastRef, ToastrComponentlessModule, ToastrModule, ToastrService, provideToastr };\n","import { Injectable } from '@angular/core';\r\nimport { ToastrService } from 'ngx-toastr';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class MessageService {\r\n constructor(private toastrService: ToastrService) {}\r\n\r\n success(message: string) {\r\n this.toastrService.success(message, null, {\r\n progressBar: true,\r\n positionClass: 'toast-top-right',\r\n closeButton:true,\r\n });\r\n }\r\n\r\n warning(message: string) {\r\n this.toastrService.warning(message, null, {\r\n progressBar: true,\r\n positionClass: 'toast-top-right',\r\n closeButton:true\r\n });\r\n }\r\n\r\n error(message: string, title?:string) {\r\n this.toastrService.error(message, title, {\r\n progressBar: true,\r\n positionClass: 'toast-top-right',\r\n closeButton:true\r\n });\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { MessageService } from '../message';\r\nimport { HttpErrorResponse } from '@angular/common/http';\r\nimport { httpErrorResponseUtil } from '../../utils';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class ApiHandleService {\r\n constructor(private messageService: MessageService) {}\r\n\r\n handleError(error: HttpErrorResponse) {\r\n var errorStr = httpErrorResponseUtil(error);\r\n this.messageService.error(errorStr);\r\n }\r\n}\r\n","import * as i0 from '@angular/core';\nimport { InjectionToken, Injectable, Inject, NgModule, Optional, SkipSelf } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { map, mergeMap } from 'rxjs/operators';\nimport { defer, of } from 'rxjs';\nimport { HTTP_INTERCEPTORS } from '@angular/common/http';\nconst JWT_OPTIONS = new InjectionToken('JWT_OPTIONS');\n\n/* eslint-disable no-bitwise */\nlet JwtHelperService = /*#__PURE__*/(() => {\n class JwtHelperService {\n constructor(config = null) {\n this.tokenGetter = config && config.tokenGetter || function () {};\n }\n urlBase64Decode(str) {\n let output = str.replace(/-/g, '+').replace(/_/g, '/');\n switch (output.length % 4) {\n case 0:\n {\n break;\n }\n case 2:\n {\n output += '==';\n break;\n }\n case 3:\n {\n output += '=';\n break;\n }\n default:\n {\n throw new Error('Illegal base64url string!');\n }\n }\n return this.b64DecodeUnicode(output);\n }\n // credits for decoder goes to https://github.com/atk\n b64decode(str) {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n let output = '';\n str = String(str).replace(/=+$/, '');\n if (str.length % 4 === 1) {\n throw new Error(`'atob' failed: The string to be decoded is not correctly encoded.`);\n }\n for (\n // initialize result and counters\n let bc = 0, bs, buffer, idx = 0;\n // get next character\n buffer = str.charAt(idx++);\n // character found in table? initialize bit storage and add its ascii value;\n ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,\n // and if not first of each 4 characters,\n // convert the first 8 bits to one ascii character\n bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0) {\n // try to find character in table (0-63, not found => -1)\n buffer = chars.indexOf(buffer);\n }\n return output;\n }\n b64DecodeUnicode(str) {\n return decodeURIComponent(Array.prototype.map.call(this.b64decode(str), c => {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);\n }).join(''));\n }\n decodeToken(token = this.tokenGetter()) {\n if (token instanceof Promise) {\n return token.then(t => this._decodeToken(t));\n }\n return this._decodeToken(token);\n }\n _decodeToken(token) {\n if (!token || token === '') {\n return null;\n }\n const parts = token.split('.');\n if (parts.length !== 3) {\n throw new Error(`The inspected token doesn't appear to be a JWT. Check to make sure it has three parts and see https://jwt.io for more.`);\n }\n const decoded = this.urlBase64Decode(parts[1]);\n if (!decoded) {\n throw new Error('Cannot decode the token.');\n }\n return JSON.parse(decoded);\n }\n getTokenExpirationDate(token = this.tokenGetter()) {\n if (token instanceof Promise) {\n return token.then(t => this._getTokenExpirationDate(t));\n }\n return this._getTokenExpirationDate(token);\n }\n _getTokenExpirationDate(token) {\n let decoded;\n decoded = this.decodeToken(token);\n if (!decoded || !decoded.hasOwnProperty('exp')) {\n return null;\n }\n const date = new Date(0);\n date.setUTCSeconds(decoded.exp);\n return date;\n }\n isTokenExpired(token = this.tokenGetter(), offsetSeconds) {\n if (token instanceof Promise) {\n return token.then(t => this._isTokenExpired(t, offsetSeconds));\n }\n return this._isTokenExpired(token, offsetSeconds);\n }\n _isTokenExpired(token, offsetSeconds) {\n if (!token || token === '') {\n return true;\n }\n const date = this.getTokenExpirationDate(token);\n offsetSeconds = offsetSeconds || 0;\n if (date === null) {\n return false;\n }\n return !(date.valueOf() > new Date().valueOf() + offsetSeconds * 1000);\n }\n getAuthScheme(authScheme, request) {\n if (typeof authScheme === 'function') {\n return authScheme(request);\n }\n return authScheme;\n }\n }\n JwtHelperService.ɵfac = function JwtHelperService_Factory(ɵt) {\n return new (ɵt || JwtHelperService)(i0.ɵɵinject(JWT_OPTIONS));\n };\n JwtHelperService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: JwtHelperService,\n factory: JwtHelperService.ɵfac\n });\n return JwtHelperService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst fromPromiseOrValue = input => {\n if (input instanceof Promise) {\n return defer(() => input);\n }\n return of(input);\n};\nlet JwtInterceptor = /*#__PURE__*/(() => {\n class JwtInterceptor {\n constructor(config, jwtHelper, document) {\n this.jwtHelper = jwtHelper;\n this.document = document;\n this.standardPorts = ['80', '443'];\n this.tokenGetter = config.tokenGetter;\n this.headerName = config.headerName || 'Authorization';\n this.authScheme = config.authScheme || config.authScheme === '' ? config.authScheme : 'Bearer ';\n this.allowedDomains = config.allowedDomains || [];\n this.disallowedRoutes = config.disallowedRoutes || [];\n this.throwNoTokenError = config.throwNoTokenError || false;\n this.skipWhenExpired = config.skipWhenExpired;\n }\n isAllowedDomain(request) {\n const requestUrl = new URL(request.url, this.document.location.origin);\n // If the host equals the current window origin,\n // the domain is allowed by default\n if (requestUrl.host === this.document.location.host) {\n return true;\n }\n // If not the current domain, check the allowed list\n const hostName = `${requestUrl.hostname}${requestUrl.port && !this.standardPorts.includes(requestUrl.port) ? ':' + requestUrl.port : ''}`;\n return this.allowedDomains.findIndex(domain => typeof domain === 'string' ? domain === hostName : domain instanceof RegExp ? domain.test(hostName) : false) > -1;\n }\n isDisallowedRoute(request) {\n const requestedUrl = new URL(request.url, this.document.location.origin);\n return this.disallowedRoutes.findIndex(route => {\n if (typeof route === 'string') {\n const parsedRoute = new URL(route, this.document.location.origin);\n return parsedRoute.hostname === requestedUrl.hostname && parsedRoute.pathname === requestedUrl.pathname;\n }\n if (route instanceof RegExp) {\n return route.test(request.url);\n }\n return false;\n }) > -1;\n }\n handleInterception(token, request, next) {\n const authScheme = this.jwtHelper.getAuthScheme(this.authScheme, request);\n if (!token && this.throwNoTokenError) {\n throw new Error('Could not get token from tokenGetter function.');\n }\n let tokenIsExpired = of(false);\n if (this.skipWhenExpired) {\n tokenIsExpired = token ? fromPromiseOrValue(this.jwtHelper.isTokenExpired(token)) : of(true);\n }\n if (token) {\n return tokenIsExpired.pipe(map(isExpired => isExpired && this.skipWhenExpired ? request.clone() : request.clone({\n setHeaders: {\n [this.headerName]: `${authScheme}${token}`\n }\n })), mergeMap(innerRequest => next.handle(innerRequest)));\n }\n return next.handle(request);\n }\n intercept(request, next) {\n if (!this.isAllowedDomain(request) || this.isDisallowedRoute(request)) {\n return next.handle(request);\n }\n const token = this.tokenGetter(request);\n return fromPromiseOrValue(token).pipe(mergeMap(asyncToken => {\n return this.handleInterception(asyncToken, request, next);\n }));\n }\n }\n JwtInterceptor.ɵfac = function JwtInterceptor_Factory(ɵt) {\n return new (ɵt || JwtInterceptor)(i0.ɵɵinject(JWT_OPTIONS), i0.ɵɵinject(JwtHelperService), i0.ɵɵinject(DOCUMENT));\n };\n JwtInterceptor.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: JwtInterceptor,\n factory: JwtInterceptor.ɵfac\n });\n return JwtInterceptor;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet JwtModule = /*#__PURE__*/(() => {\n class JwtModule {\n constructor(parentModule) {\n if (parentModule) {\n throw new Error(`JwtModule is already loaded. It should only be imported in your application's main module.`);\n }\n }\n static forRoot(options) {\n return {\n ngModule: JwtModule,\n providers: [{\n provide: HTTP_INTERCEPTORS,\n useClass: JwtInterceptor,\n multi: true\n }, options.jwtOptionsProvider || {\n provide: JWT_OPTIONS,\n useValue: options.config\n }, JwtHelperService]\n };\n }\n }\n JwtModule.ɵfac = function JwtModule_Factory(ɵt) {\n return new (ɵt || JwtModule)(i0.ɵɵinject(JwtModule, 12));\n };\n JwtModule.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: JwtModule\n });\n JwtModule.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n return JwtModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/*\n * Public API Surface of angular-jwt\n */\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { JWT_OPTIONS, JwtHelperService, JwtInterceptor, JwtModule };\n","import { inject, Injectable } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport { getMessaging, getToken } from 'firebase/messaging';\r\nimport { BehaviorSubject, Observable } from 'rxjs';\r\nimport { NavService } from 'src/app/shared/services/nav.service';\r\nimport { ApiService } from '../../apis';\r\nimport {\r\n AccessTokenDto,\r\n SignInDto,\r\n SignUpDto,\r\n TrialCreationFirstDto,\r\n TrialCreationFirstResultDto,\r\n TrialCreationSecondDto,\r\n UserRoleDto,\r\n} from '../../dtos/auth';\r\nimport { StorageItem } from '../../enums';\r\nimport {\r\n API_ROUTER_UTILS,\r\n getItem,\r\n removeItem,\r\n ROUTER_UTILS,\r\n setItem,\r\n} from '../../utils';\r\nimport { ApiHandleService } from '../api-handle';\r\nimport { environment } from 'src/environments/environment';\r\nimport { DeviceTypeConstant, Roles } from '../../constants';\r\nimport { MANAGEMENT_ROUTER_UTILS } from '../../utils/management-router.util';\r\nimport { HttpErrorResponse } from '@angular/common/http';\r\nimport { JwtHelperService } from '@auth0/angular-jwt';\r\nimport { Messaging } from '@angular/fire/messaging';\r\nimport { ResultDto } from '../../dtos/api';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class AuthService {\r\n constructor(\r\n private apiService: ApiService,\r\n private router: Router,\r\n private apiHandleService: ApiHandleService,\r\n private navService: NavService,\r\n private jwtHelperService: JwtHelperService\r\n ) {}\r\n\r\n private messaging = inject(Messaging);\r\n isLoggedIn$ = new BehaviorSubject(!!getItem(StorageItem.Auth));\r\n userRole$ = new BehaviorSubject('');\r\n\r\n get isLoggedIn(): boolean {\r\n return this.isLoggedIn$.getValue();\r\n }\r\n\r\n get userRoleValue(): string {\r\n return this.userRole$.getValue();\r\n }\r\n\r\n signIn(data: SignInDto, returnUrl: string): void {\r\n getToken(this.messaging, { vapidKey: environment.firebase.vapidKey })\r\n .then((currentToken) => {\r\n if (currentToken) {\r\n data.deviceToken = currentToken;\r\n data.deviceTypeId = DeviceTypeConstant.web;\r\n this.apiService\r\n .post(\r\n API_ROUTER_UTILS.url.auth.tokens,\r\n data,\r\n null,\r\n {}\r\n )\r\n .subscribe({\r\n next: (res) => this.handleSignResponse(res, returnUrl),\r\n error: (err: HttpErrorResponse) =>\r\n this.apiHandleService.handleError(err),\r\n });\r\n } else {\r\n console.log(\r\n 'No registration token available. Request permission to generate one.'\r\n );\r\n }\r\n })\r\n .catch((err) => {\r\n console.log('An error occurred while retrieving token. ', err);\r\n });\r\n }\r\n\r\n signUp(data: SignUpDto): void {\r\n this.apiService\r\n .post(API_ROUTER_UTILS.url.auth.signUp, data, null, {})\r\n .subscribe({\r\n next: (res) => this.handleSignUpResponse(res),\r\n error: (err: HttpErrorResponse) =>\r\n this.apiHandleService.handleError(err),\r\n });\r\n }\r\n\r\n signOut(): void {\r\n removeItem(StorageItem.Auth);\r\n removeItem(StorageItem.RefreshToken);\r\n this.isLoggedIn$.next(false);\r\n this.userRole$.next('');\r\n }\r\n\r\n trialCreationFirst(\r\n request: TrialCreationFirstDto\r\n ): Observable> {\r\n return this.apiService.post>(\r\n API_ROUTER_UTILS.url.auth.trialCreationFirst,\r\n request,\r\n null\r\n );\r\n }\r\n\r\n trialCreationSecond(\r\n request: TrialCreationSecondDto\r\n ): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.auth.trialCreationSecond,\r\n request,\r\n null\r\n );\r\n }\r\n\r\n async loadUserRole() {\r\n const res = this.apiService\r\n .get(null, API_ROUTER_UTILS.url.auth.userRole)\r\n .toPromise();\r\n\r\n const res2 = await Promise.all([res]);\r\n const val = res2[0];\r\n this.navService.refreshMenu(val!.roleName);\r\n this.userRole$.next(val!.roleName);\r\n }\r\n\r\n getData(): Observable {\r\n return this.userRole$;\r\n }\r\n\r\n private handleSignResponse(data: AccessTokenDto, returnUrl: string) {\r\n setItem(StorageItem.Auth, data.token);\r\n setItem(StorageItem.RefreshToken, data.refreshToken);\r\n this.isLoggedIn$.next(true);\r\n this.userRole$.next(data.userRole);\r\n this.navService.refreshMenu(data.userRole);\r\n\r\n if (data.userRole == Roles.superAdmin) {\r\n this.router.navigateByUrl(\r\n `/${MANAGEMENT_ROUTER_UTILS.config.version.root}/${MANAGEMENT_ROUTER_UTILS.config.version.versions}`\r\n );\r\n } else {\r\n if (returnUrl === '/') {\r\n this.router.navigateByUrl(\r\n `/${ROUTER_UTILS.config.home.root}/${ROUTER_UTILS.config.home.versions}`\r\n );\r\n } else {\r\n this.router.navigate([returnUrl]);\r\n }\r\n }\r\n }\r\n\r\n private handleSignUpResponse(res: string) {\r\n this.router.navigateByUrl(\r\n `/${ROUTER_UTILS.config.auth.root}/${ROUTER_UTILS.config.auth.signIn}`\r\n );\r\n }\r\n\r\n getPermissions(): string[] {\r\n const token = localStorage.getItem(StorageItem.Auth);\r\n const decodedToken = this.jwtHelperService.decodeToken(token);\r\n\r\n var jsonPermissions = decodedToken['permission'];\r\n if (jsonPermissions == null || jsonPermissions == undefined) {\r\n return [];\r\n }\r\n\r\n return JSON.parse(jsonPermissions) as string[];\r\n }\r\n\r\n hasPermission(permission: string): boolean {\r\n const permissions = this.getPermissions();\r\n return permissions.includes(permission);\r\n }\r\n\r\n hasRole(role: string): boolean {\r\n const token = localStorage.getItem(StorageItem.Auth);\r\n const decodedToken = this.jwtHelperService.decodeToken(token);\r\n\r\n var userRole =\r\n decodedToken[\r\n 'http://schemas.microsoft.com/ws/2008/06/identity/claims/role'\r\n ];\r\n\r\n return role == userRole;\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs';\r\nimport { ApiService } from '../../apis';\r\nimport { ResultDto, SearchDto } from '../../dtos/api';\r\nimport {\r\n ChangePasswordRequestDto,\r\n CreateRolePermissionRequestDto,\r\n CreateUserRequestDto,\r\n RolePaginationResponseDto,\r\n RolePermissionPaginationResponseDto,\r\n UserDto,\r\n UserPaginationResponseDto,\r\n UserPermissionPaginationResponseDto,\r\n} from '../../dtos/user';\r\nimport { RoleClaimListFilterDto } from '../../dtos/user/role-claim-list-filter.dto';\r\nimport { UserPermissionListFilterDto } from '../../dtos/user/user-permission-list-filter.dto';\r\nimport { API_ROUTER_UTILS } from '../../utils';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class UserService {\r\n constructor(private apiService: ApiService) {}\r\n\r\n getUsers(search: SearchDto): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.users.search,\r\n search,\r\n null\r\n );\r\n }\r\n\r\n userInfo(): Observable> {\r\n return this.apiService.get>(\r\n null,\r\n API_ROUTER_UTILS.url.users.info\r\n );\r\n }\r\n\r\n superAdminCreateUser(\r\n createUser: CreateUserRequestDto\r\n ): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.users.superAdminCreateUser,\r\n createUser,\r\n null\r\n );\r\n }\r\n\r\n getRoles(search: SearchDto): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.roles.search,\r\n search,\r\n null\r\n );\r\n }\r\n\r\n getRolePermissions(\r\n searchClaimListFilter: RoleClaimListFilterDto\r\n ): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.roles.permisisons,\r\n searchClaimListFilter,\r\n null\r\n );\r\n }\r\n\r\n createRolePermission(\r\n createRolePermissionRequestDto: CreateRolePermissionRequestDto\r\n ): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.roles.createRolePermission,\r\n createRolePermissionRequestDto,\r\n null\r\n );\r\n }\r\n\r\n getUserPermissions(\r\n userPermissionListFilterDto: UserPermissionListFilterDto\r\n ): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.users.userPermissions,\r\n userPermissionListFilterDto,\r\n null\r\n );\r\n }\r\n\r\n changePassword(request: ChangePasswordRequestDto): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.users.changePassword,\r\n request,\r\n null\r\n );\r\n }\r\n}\r\n","import { HttpErrorResponse } from '@angular/common/http';\r\nimport { Component, OnInit } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport { ResultDto } from 'src/app/core/dtos/api';\r\nimport { UserDto } from 'src/app/core/dtos/user';\r\nimport { AuthService } from 'src/app/core/services/auth';\r\nimport { MessageService } from 'src/app/core/services/message';\r\nimport { UserService } from 'src/app/core/services/user';\r\nimport {\r\n PERMISSION_UTILS,\r\n ROUTER_UTILS,\r\n httpErrorResponseUtil,\r\n} from 'src/app/core/utils';\r\n\r\n@Component({\r\n selector: 'app-my-account',\r\n templateUrl: './my-account.component.html',\r\n styleUrls: ['./my-account.component.scss'],\r\n})\r\nexport class MyAccountComponent implements OnInit {\r\n userInfoModel: UserDto;\r\n permissionUtils = PERMISSION_UTILS;\r\n constructor(\r\n public authService: AuthService,\r\n private router: Router,\r\n private userService: UserService,\r\n private messageService: MessageService\r\n ) {}\r\n\r\n ngOnInit() {}\r\n\r\n ngAfterViewInit(): void {\r\n this.userInfo();\r\n }\r\n\r\n signOut() {\r\n this.authService.signOut();\r\n const { root, signIn } = ROUTER_UTILS.config.auth;\r\n this.router.navigate(['/', root, signIn]);\r\n }\r\n\r\n userInfo() {\r\n this.userService.userInfo().subscribe(\r\n (data: ResultDto) => {\r\n if (data.success) {\r\n this.userInfoModel = data.data;\r\n } else {\r\n for (let index = 0; index < data.errors.length; index++) {\r\n this.messageService.error(data.errors[index]);\r\n }\r\n }\r\n },\r\n (error: HttpErrorResponse) => {\r\n var errorStr = httpErrorResponseUtil(error);\r\n this.messageService.error(errorStr);\r\n }\r\n );\r\n }\r\n\r\n openFirmInfo() {\r\n this.router.navigateByUrl(\r\n `/${ROUTER_UTILS.config.firm.root}/${ROUTER_UTILS.config.firm.firmInfo}`\r\n );\r\n }\r\n\r\n profile() {\r\n this.router.navigateByUrl(\r\n `/${ROUTER_UTILS.config.user.root}/${ROUTER_UTILS.config.user.profile}`\r\n );\r\n }\r\n}\r\n","\r\n\r\n","import { DOCUMENT } from '@angular/common';\r\nimport { Component, Inject, OnInit } from '@angular/core';\r\nimport { LayoutService } from '../../services/layout.service';\r\nimport { NavService } from '../../services/nav.service';\r\n\r\n@Component({\r\n selector: 'app-header',\r\n templateUrl: './header.component.html',\r\n styleUrls: ['./header.component.scss'],\r\n})\r\nexport class HeaderComponent implements OnInit {\r\n public elem: any;\r\n public dark: boolean =false\r\n \r\n\r\n constructor(\r\n public layout: LayoutService,\r\n public navServices: NavService,\r\n @Inject(DOCUMENT) private document: any\r\n ) {}\r\n\r\n ngOnInit() {\r\n this.elem = document.documentElement;\r\n this.layout.config.settings.layout_version == 'dark-only' ? true : false;\r\n }\r\n\r\n sidebarToggle() {\r\n this.navServices.collapseSidebar = !this.navServices.collapseSidebar;\r\n this.navServices.megaMenu = false;\r\n this.navServices.levelMenu = false;\r\n }\r\n\r\n layoutToggle() {\r\n this.dark = !this.dark;\r\n this.layout.config.settings.layout_version = this.dark\r\n ? 'dark-only'\r\n : 'light';\r\n }\r\n\r\n searchToggle() {\r\n this.navServices.search = true;\r\n }\r\n\r\n languageToggle() {\r\n this.navServices.language = !this.navServices.language;\r\n }\r\n\r\n toggleFullScreen() {\r\n this.navServices.fullScreen = !this.navServices.fullScreen;\r\n if (this.navServices.fullScreen) {\r\n if (this.elem.requestFullscreen) {\r\n this.elem.requestFullscreen();\r\n } else if (this.elem.mozRequestFullScreen) {\r\n /* Firefox */\r\n this.elem.mozRequestFullScreen();\r\n } else if (this.elem.webkitRequestFullscreen) {\r\n /* Chrome, Safari and Opera */\r\n this.elem.webkitRequestFullscreen();\r\n } else if (this.elem.msRequestFullscreen) {\r\n /* IE/Edge */\r\n this.elem.msRequestFullscreen();\r\n }\r\n } else {\r\n if (!this.document.exitFullscreen) {\r\n this.document.exitFullscreen();\r\n } else if (this.document.mozCancelFullScreen) {\r\n /* Firefox */\r\n this.document.mozCancelFullScreen();\r\n } else if (this.document.webkitExitFullscreen) {\r\n /* Chrome, Safari and Opera */\r\n this.document.webkitExitFullscreen();\r\n } else if (this.document.msExitFullscreen) {\r\n /* IE/Edge */\r\n this.document.msExitFullscreen();\r\n }\r\n }\r\n }\r\n}\r\n","\r\n\r\n\r\n","import { Component, HostListener, OnInit } from '@angular/core';\r\nimport { NavigationEnd, Router } from '@angular/router';\r\nimport { Menu } from 'src/app/core/interfaces';\r\nimport { LayoutService } from '../../services/layout.service';\r\nimport { NavService } from '../../services/nav.service';\r\n\r\n@Component({\r\n selector: 'app-sidebar',\r\n templateUrl: './sidebar.component.html',\r\n styleUrls: ['./sidebar.component.scss'],\r\n})\r\nexport class SidebarComponent {\r\n public iconSidebar: any;\r\n menuItems: Menu[] | undefined;\r\n public url: any;\r\n public fileurl: any;\r\n\r\n // For Horizontal Menu\r\n public margin: any = 0;\r\n public width: any = window.innerWidth;\r\n public leftArrowNone: boolean = true;\r\n public rightArrowNone: boolean = false;\r\n\r\n constructor(\r\n private router: Router,\r\n public navServices: NavService,\r\n public layout: LayoutService\r\n ) {\r\n this.navServices.items.subscribe((menuItems) => {\r\n this.menuItems = menuItems;\r\n this.router.events.subscribe((event:any) => {\r\n if (event instanceof NavigationEnd) {\r\n menuItems.filter((items) => {\r\n if (items.path === event.url) {\r\n this.setNavActive(items);\r\n }\r\n if (!items.children) {\r\n return false;\r\n }\r\n items.children.filter((subItems) => {\r\n if (subItems.path === event.url) {\r\n this.setNavActive(subItems);\r\n }\r\n if (!subItems.children) {\r\n return false;\r\n }\r\n subItems.children.filter((subSubItems) => {\r\n if (subSubItems.path === event.url) {\r\n this.setNavActive(subSubItems);\r\n }\r\n });\r\n\r\n return false;\r\n });\r\n\r\n return false;\r\n });\r\n }\r\n });\r\n });\r\n }\r\n\r\n @HostListener('window:resize', ['$event'])\r\n onResize(event: any) {\r\n this.width = event.target.innerWidth - 500;\r\n }\r\n\r\n sidebarToggle() {\r\n this.navServices.collapseSidebar = !this.navServices.collapseSidebar;\r\n }\r\n\r\n // Active Nave state\r\n setNavActive(item: any) {\r\n this.menuItems?.filter((menuItem) => {\r\n if (menuItem !== item) {\r\n menuItem.active = false;\r\n }\r\n if (menuItem.children && menuItem.children.includes(item)) {\r\n menuItem.active = true;\r\n }\r\n if (menuItem.children) {\r\n menuItem.children.filter((submenuItems: any) => {\r\n if (submenuItems.children && submenuItems.children.includes(item)) {\r\n menuItem.active = true;\r\n submenuItems.active = true;\r\n }\r\n });\r\n }\r\n });\r\n }\r\n\r\n // Click Toggle menu\r\n toggletNavActive(item: any) {\r\n if (!item.active) {\r\n this.menuItems?.forEach((a) => {\r\n if (this.menuItems?.includes(item)) {\r\n a.active = false;\r\n }\r\n if (!a.children) {\r\n return false;\r\n }\r\n a.children.forEach((b: any) => {\r\n if (a.children?.includes(item)) {\r\n b.active = false;\r\n }\r\n });\r\n\r\n return false;\r\n });\r\n }\r\n item.active = !item.active;\r\n }\r\n\r\n // For Horizontal Menu\r\n scrollToLeft() {\r\n if (this.margin >= -this.width) {\r\n this.margin = 0;\r\n this.leftArrowNone = true;\r\n this.rightArrowNone = false;\r\n } else {\r\n this.margin += this.width;\r\n this.rightArrowNone = false;\r\n }\r\n }\r\n\r\n scrollToRight() {\r\n if (this.margin <= -3051) {\r\n this.margin = -3464;\r\n this.leftArrowNone = false;\r\n this.rightArrowNone = true;\r\n } else {\r\n this.margin += -this.width;\r\n this.leftArrowNone = false;\r\n }\r\n }\r\n}\r\n","\r\n\r\n\r\n\r\n\r\n","import { Component, OnInit } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'app-footer',\r\n templateUrl: './footer.component.html',\r\n styleUrls: ['./footer.component.scss']\r\n})\r\nexport class FooterComponent implements OnInit {\r\n public today: number = Date.now();\r\n constructor() { }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n}\r\n","\r\n\r\n
\r\n
\r\n
Copyright {{ today | date:'y'}} © HAR Yazılım
\r\n
\r\n
\r\n
\r\n","import { Component, OnInit } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'app-full',\r\n templateUrl: './full.component.html',\r\n styleUrls: ['./full.component.scss']\r\n})\r\nexport class FullComponent implements OnInit {\r\n\r\n constructor() { }\r\n\r\n ngOnInit(): void {\r\n }\r\n\r\n}\r\n","\r\n \r\n
\r\n","import { trigger, animate, transition, style, query, group, animateChild } from '@angular/animations';\r\n\r\n// export const fadeInAnimation = trigger('fadeInAnimation', [\r\n// transition('* => *', [\r\n// style({ position: 'relative' }),\r\n// query(':enter, :leave', [\r\n// style({\r\n// position: 'absolute',\r\n// top: 0,\r\n// left: 0,\r\n// width: '100%'\r\n// })\r\n// ]),\r\n// query(':enter', [style({ opacity: '0' })], { optional: true }),\r\n// query(':leave', animateChild(), { optional: true }),\r\n// group([\r\n// query(':leave', [animate('.2s ease-in-out', style({ opacity: '0' }))], { optional: true }),\r\n// query(':enter', [animate('.2s ease-in-out', style({ opacity: '1' }))], {\r\n// delay: 300,\r\n// optional: true,\r\n// }),\r\n// ]),\r\n// query(':enter', animateChild(), { optional: true }),\r\n// ])\r\n// ]);\r\n\r\nexport const fadeInAnimation = trigger('fadeInAnimation', [\r\n transition(':enter', [\r\n style({ opacity: 0 }),\r\n animate('0.5s', style({ opacity: 1 }))\r\n ]),\r\n transition(':leave', [\r\n animate('0.5s', style({ opacity: 0 }))\r\n ])\r\n ]);\r\n\r\n\r\n","import { Component, HostListener, OnInit } from '@angular/core';\r\nimport { NgbModal } from '@ng-bootstrap/ng-bootstrap';\r\nimport { LayoutService } from '../../services/layout.service';\r\nimport { Router } from '@angular/router';\r\nimport { ROUTER_UTILS } from 'src/app/core/utils';\r\n\r\n@Component({\r\n selector: 'app-customizer',\r\n templateUrl: './customizer.component.html',\r\n styleUrls: ['./customizer.component.scss'],\r\n})\r\nexport class CustomizerComponent implements OnInit {\r\n public screenwidth: any = window.innerWidth;\r\n public customizer: string = '';\r\n public layoutType: string = 'ltr';\r\n public sidebarType: string = 'compact-wrapper';\r\n public sidebarSetting: string = 'default-sidebar';\r\n public MIXLayout: string = 'default';\r\n\r\n public primary_color: string = '#7366ff';\r\n public secondary_color: string = '#f73164';\r\n\r\n constructor(private modalService: NgbModal, public layout: LayoutService, private router: Router) {}\r\n\r\n @HostListener('window:resize', ['$event'])\r\n onResize(event:any) {\r\n this.screenwidth = event.target.innerWidth;\r\n }\r\n\r\n ngOnInit() {}\r\n\r\n // Open Modal\r\n openModal(popup:any) {\r\n this.modalService.open(popup, {\r\n backdropClass: 'dark-modal',\r\n centered: true,\r\n });\r\n }\r\n\r\n // Open customizer\r\n Customizer(val:any) {\r\n this.customizer = val;\r\n }\r\n\r\n // Customize Layout Type\r\n customizeLayoutType(val:any) {\r\n this.layoutType = val;\r\n this.layout.config.settings.layout_type = val;\r\n if (val == 'rtl') {\r\n document.getElementsByTagName('html')[0].setAttribute('dir', val);\r\n } else {\r\n document.getElementsByTagName('html')[0].removeAttribute('dir');\r\n }\r\n }\r\n\r\n // Customize Sidebar Type\r\n customizeSidebarType(val:any) {\r\n this.sidebarType = val;\r\n }\r\n\r\n // Customize Sidebar Setting\r\n customizeSidebarSetting(val:any) {\r\n this.sidebarSetting = val;\r\n this.layout.config.settings.sidebar_type = val;\r\n }\r\n\r\n // Customize Mix Layout\r\n customizeMixLayout(val:any) {\r\n this.MIXLayout = val;\r\n this.layout.config.settings.layout_version = val;\r\n }\r\n\r\n applyColor() {\r\n document.documentElement.style.setProperty(\r\n '--theme-deafult',\r\n this.primary_color\r\n );\r\n document.documentElement.style.setProperty(\r\n '--theme-secondary',\r\n this.secondary_color\r\n );\r\n this.layout.config.color.primary_color = this.primary_color;\r\n this.layout.config.color.secondary_color = this.secondary_color;\r\n }\r\n\r\n resetColor() {\r\n document.documentElement.style.setProperty('--theme-deafult', '#7366ff');\r\n document.documentElement.style.setProperty('--theme-secondary', '#f73164');\r\n (document.getElementById('ColorPicker1')).value =\r\n '#7366ff';\r\n (document.getElementById('ColorPicker2')).value =\r\n '#f73164';\r\n this.layout.config.color.primary_color = '#7366ff';\r\n this.layout.config.color.secondary_color = '#f73164';\r\n }\r\n\r\n openRetailSale(){\r\n this.router.navigateByUrl(\r\n `/${ROUTER_UTILS.config.retailSale.root}`\r\n );\r\n }\r\n}\r\n","\r\n\r\n","import { AfterViewInit, ChangeDetectorRef, Component, OnInit } from '@angular/core';\r\nimport { ActivatedRoute } from '@angular/router';\r\nimport { fadeInAnimation } from '../../data/router-animation/router-animation';\r\nimport { LayoutService } from '../../services/layout.service';\r\nimport { NavService } from '../../services/nav.service';\r\n\r\n@Component({\r\n selector: 'app-content',\r\n templateUrl: './content.component.html',\r\n styleUrls: ['./content.component.scss'],\r\n animations: [fadeInAnimation]\r\n})\r\nexport class ContentComponent implements OnInit, AfterViewInit {\r\n constructor(\r\n private route: ActivatedRoute,\r\n public navServices: NavService,\r\n public layout: LayoutService\r\n ) {\r\n this.route.queryParams.subscribe((params) => {\r\n this.layout.config.settings.layout = params['layout']\r\n ? params['layout']\r\n : this.layout.config.settings.layout;\r\n });\r\n }\r\n\r\n ngOnInit() {}\r\n\r\n ngAfterViewInit() {}\r\n\r\n public getRouterOutletState(outlet: any) {\r\n return outlet.isActivated ? outlet.activatedRoute : '';\r\n }\r\n\r\n get layoutClass() {\r\n switch (this.layout.config.settings.layout) {\r\n case 'Dubai':\r\n return 'compact-wrapper';\r\n case 'London':\r\n return 'only-body';\r\n case 'Seoul':\r\n return 'compact-wrapper modern-type';\r\n case 'LosAngeles':\r\n return this.navServices.horizontal\r\n ? 'horizontal-wrapper material-type'\r\n : 'compact-wrapper material-type';\r\n case 'Paris':\r\n return 'compact-wrapper dark-sidebar';\r\n case 'Tokyo':\r\n return 'compact-sidebar';\r\n case 'Madrid':\r\n return 'compact-wrapper color-sidebar';\r\n case 'Moscow':\r\n return 'compact-sidebar compact-small';\r\n case 'NewYork':\r\n return 'compact-wrapper box-layout';\r\n case 'Singapore':\r\n return this.navServices.horizontal\r\n ? 'horizontal-wrapper enterprice-type'\r\n : 'compact-wrapper enterprice-type';\r\n case 'Rome':\r\n return 'compact-sidebar compact-small material-icon';\r\n case 'Barcelona':\r\n return this.navServices.horizontal\r\n ? 'horizontal-wrapper enterprice-type advance-layout'\r\n : 'compact-wrapper enterprice-type advance-layout';\r\n default:\r\n return '';\r\n }\r\n }\r\n}\r\n","\r\n
\r\n
\r\n
\r\n \r\n
\r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n\r\n\r\n","import { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs';\r\nimport { ApiService } from '../../apis';\r\nimport { PaginationResponseDto, ResultDto, SearchDto } from '../../dtos/api';\r\nimport {\r\n BrandResultDto,\r\n CreateBrandRequestDto,\r\n DeleteBrandResultDto,\r\n UpdateBrandRequestDto,\r\n UpdateBrandResultDto,\r\n} from '../../dtos/brand';\r\nimport { API_ROUTER_UTILS } from '../../utils';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class BrandService {\r\n constructor(private apiService: ApiService) {}\r\n\r\n search(\r\n searchDto: SearchDto\r\n ): Observable>> {\r\n return this.apiService.post<\r\n ResultDto>\r\n >(API_ROUTER_UTILS.url.brands.search, searchDto, null);\r\n }\r\n\r\n create(createBrandRequestDto: CreateBrandRequestDto): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.brands.create,\r\n createBrandRequestDto,\r\n null\r\n );\r\n }\r\n\r\n update(\r\n updateBrandRequestDto: UpdateBrandRequestDto\r\n ): Observable> {\r\n return this.apiService.post>(\r\n API_ROUTER_UTILS.url.brands.update,\r\n updateBrandRequestDto,\r\n null\r\n );\r\n }\r\n\r\n delete(brandId: string): Observable> {\r\n return this.apiService.post>(\r\n API_ROUTER_UTILS.url.brands.delete,\r\n null,\r\n null,\r\n { brandId: brandId }\r\n );\r\n }\r\n\r\n all(): Observable {\r\n return this.apiService.get(\r\n null,\r\n API_ROUTER_UTILS.url.brands.all\r\n );\r\n }\r\n}\r\n","import * as i0 from '@angular/core';\nimport { Directive, Input, Injectable, EventEmitter, booleanAttribute, ElementRef, Component, ChangeDetectionStrategy, ViewEncapsulation, Optional, Inject, Output, ViewChild, InjectionToken, numberAttribute, forwardRef, TemplateRef, Attribute, HostBinding, ContentChild, ContentChildren, HostListener, NgModule } from '@angular/core';\nimport { NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { takeUntil, auditTime, startWith, tap, debounceTime, filter, map } from 'rxjs/operators';\nimport { animationFrameScheduler, asapScheduler, Subject, fromEvent, merge } from 'rxjs';\nimport * as i3 from '@angular/common';\nimport { DOCUMENT, CommonModule } from '@angular/common';\nconst _c0 = [\"content\"];\nconst _c1 = [\"scroll\"];\nconst _c2 = [\"padding\"];\nconst _c3 = [\"*\"];\nconst _c4 = a0 => ({\n searchTerm: a0\n});\nfunction NgDropdownPanelComponent_Conditional_0_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 3);\n i0.ɵɵelementContainer(1, 6);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r0 = i0.ɵɵnextContext();\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngTemplateOutlet\", ctx_r0.headerTemplate)(\"ngTemplateOutletContext\", i0.ɵɵpureFunction1(2, _c4, ctx_r0.filterValue));\n }\n}\nfunction NgDropdownPanelComponent_Conditional_8_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 5);\n i0.ɵɵelementContainer(1, 6);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r0 = i0.ɵɵnextContext();\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"ngTemplateOutlet\", ctx_r0.footerTemplate)(\"ngTemplateOutletContext\", i0.ɵɵpureFunction1(2, _c4, ctx_r0.filterValue));\n }\n}\nconst _c5 = [\"searchInput\"];\nconst _c6 = [\"clearButton\"];\nconst _c7 = (a0, a1, a2) => ({\n item: a0,\n clear: a1,\n label: a2\n});\nconst _c8 = (a0, a1) => ({\n items: a0,\n clear: a1\n});\nconst _c9 = (a0, a1, a2, a3) => ({\n item: a0,\n item$: a1,\n index: a2,\n searchTerm: a3\n});\nfunction NgSelectComponent_Conditional_4_For_1_ng_template_1_Template(rf, ctx) {\n if (rf & 1) {\n const _r2 = i0.ɵɵgetCurrentView();\n i0.ɵɵelementStart(0, \"span\", 21);\n i0.ɵɵlistener(\"click\", function NgSelectComponent_Conditional_4_For_1_ng_template_1_Template_span_click_0_listener() {\n i0.ɵɵrestoreView(_r2);\n const item_r3 = i0.ɵɵnextContext().$implicit;\n const ctx_r3 = i0.ɵɵnextContext(2);\n return i0.ɵɵresetView(ctx_r3.unselect(item_r3));\n });\n i0.ɵɵtext(1, \"\\xD7\");\n i0.ɵɵelementEnd();\n i0.ɵɵelement(2, \"span\", 22);\n }\n if (rf & 2) {\n const item_r3 = i0.ɵɵnextContext().$implicit;\n const ctx_r3 = i0.ɵɵnextContext(2);\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"ngItemLabel\", item_r3.label)(\"escape\", ctx_r3.escapeHTML);\n }\n}\nfunction NgSelectComponent_Conditional_4_For_1_ng_template_3_Template(rf, ctx) {}\nfunction NgSelectComponent_Conditional_4_For_1_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 20);\n i0.ɵɵtemplate(1, NgSelectComponent_Conditional_4_For_1_ng_template_1_Template, 3, 2, \"ng-template\", null, 1, i0.ɵɵtemplateRefExtractor)(3, NgSelectComponent_Conditional_4_For_1_ng_template_3_Template, 0, 0, \"ng-template\", 12);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const item_r3 = ctx.$implicit;\n const defaultLabelTemplate_r5 = i0.ɵɵreference(2);\n const ctx_r3 = i0.ɵɵnextContext(2);\n i0.ɵɵclassProp(\"ng-value-disabled\", item_r3.disabled);\n i0.ɵɵadvance(3);\n i0.ɵɵproperty(\"ngTemplateOutlet\", ctx_r3.labelTemplate || defaultLabelTemplate_r5)(\"ngTemplateOutletContext\", i0.ɵɵpureFunction3(4, _c7, item_r3.value, ctx_r3.clearItem, item_r3.label));\n }\n}\nfunction NgSelectComponent_Conditional_4_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵrepeaterCreate(0, NgSelectComponent_Conditional_4_For_1_Template, 4, 8, \"div\", 19, i0.ɵɵcomponentInstance().trackByOption, true);\n }\n if (rf & 2) {\n const ctx_r3 = i0.ɵɵnextContext();\n i0.ɵɵrepeater(ctx_r3.selectedItems);\n }\n}\nfunction NgSelectComponent_Conditional_5_ng_template_0_Template(rf, ctx) {}\nfunction NgSelectComponent_Conditional_5_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵtemplate(0, NgSelectComponent_Conditional_5_ng_template_0_Template, 0, 0, \"ng-template\", 12);\n }\n if (rf & 2) {\n const ctx_r3 = i0.ɵɵnextContext();\n i0.ɵɵproperty(\"ngTemplateOutlet\", ctx_r3.multiLabelTemplate)(\"ngTemplateOutletContext\", i0.ɵɵpureFunction2(2, _c8, ctx_r3.selectedValues, ctx_r3.clearItem));\n }\n}\nfunction NgSelectComponent_Conditional_9_ng_template_0_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"div\", 24);\n }\n}\nfunction NgSelectComponent_Conditional_9_ng_template_2_Template(rf, ctx) {}\nfunction NgSelectComponent_Conditional_9_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵtemplate(0, NgSelectComponent_Conditional_9_ng_template_0_Template, 1, 0, \"ng-template\", null, 2, i0.ɵɵtemplateRefExtractor)(2, NgSelectComponent_Conditional_9_ng_template_2_Template, 0, 0, \"ng-template\", 23);\n }\n if (rf & 2) {\n const defaultLoadingSpinnerTemplate_r7 = i0.ɵɵreference(1);\n const ctx_r3 = i0.ɵɵnextContext();\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"ngTemplateOutlet\", ctx_r3.loadingSpinnerTemplate || defaultLoadingSpinnerTemplate_r7);\n }\n}\nfunction NgSelectComponent_Conditional_10_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"span\", 15, 3)(2, \"span\", 25);\n i0.ɵɵtext(3, \"\\xD7\");\n i0.ɵɵelementEnd()();\n }\n if (rf & 2) {\n const ctx_r3 = i0.ɵɵnextContext();\n i0.ɵɵpropertyInterpolate(\"title\", ctx_r3.clearAllText);\n }\n}\nfunction NgSelectComponent_Conditional_13_For_3_ng_template_1_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"span\", 30);\n }\n if (rf & 2) {\n const item_r10 = i0.ɵɵnextContext().$implicit;\n const ctx_r3 = i0.ɵɵnextContext(2);\n i0.ɵɵproperty(\"ngItemLabel\", item_r10.label)(\"escape\", ctx_r3.escapeHTML);\n }\n}\nfunction NgSelectComponent_Conditional_13_For_3_ng_template_3_Template(rf, ctx) {}\nfunction NgSelectComponent_Conditional_13_For_3_Template(rf, ctx) {\n if (rf & 1) {\n const _r9 = i0.ɵɵgetCurrentView();\n i0.ɵɵelementStart(0, \"div\", 29);\n i0.ɵɵlistener(\"click\", function NgSelectComponent_Conditional_13_For_3_Template_div_click_0_listener() {\n const item_r10 = i0.ɵɵrestoreView(_r9).$implicit;\n const ctx_r3 = i0.ɵɵnextContext(2);\n return i0.ɵɵresetView(ctx_r3.toggleItem(item_r10));\n })(\"mouseover\", function NgSelectComponent_Conditional_13_For_3_Template_div_mouseover_0_listener() {\n const item_r10 = i0.ɵɵrestoreView(_r9).$implicit;\n const ctx_r3 = i0.ɵɵnextContext(2);\n return i0.ɵɵresetView(ctx_r3.onItemHover(item_r10));\n });\n i0.ɵɵtemplate(1, NgSelectComponent_Conditional_13_For_3_ng_template_1_Template, 1, 2, \"ng-template\", null, 4, i0.ɵɵtemplateRefExtractor)(3, NgSelectComponent_Conditional_13_For_3_ng_template_3_Template, 0, 0, \"ng-template\", 12);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const item_r10 = ctx.$implicit;\n const defaultOptionTemplate_r11 = i0.ɵɵreference(2);\n const ctx_r3 = i0.ɵɵnextContext(2);\n i0.ɵɵclassProp(\"ng-option-disabled\", item_r10.disabled)(\"ng-option-selected\", item_r10.selected)(\"ng-optgroup\", item_r10.children)(\"ng-option\", !item_r10.children)(\"ng-option-child\", !!item_r10.parent)(\"ng-option-marked\", item_r10 === ctx_r3.itemsList.markedItem);\n i0.ɵɵattribute(\"role\", item_r10.children ? \"group\" : \"option\")(\"aria-selected\", item_r10.selected)(\"id\", item_r10 == null ? null : item_r10.htmlId);\n i0.ɵɵadvance(3);\n i0.ɵɵproperty(\"ngTemplateOutlet\", item_r10.children ? ctx_r3.optgroupTemplate || defaultOptionTemplate_r11 : ctx_r3.optionTemplate || defaultOptionTemplate_r11)(\"ngTemplateOutletContext\", i0.ɵɵpureFunction4(17, _c9, item_r10.value, item_r10, item_r10.index, ctx_r3.searchTerm));\n }\n}\nfunction NgSelectComponent_Conditional_13_Conditional_4_ng_template_1_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"span\")(1, \"span\", 32);\n i0.ɵɵtext(2);\n i0.ɵɵelementEnd();\n i0.ɵɵtext(3);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r3 = i0.ɵɵnextContext(3);\n i0.ɵɵadvance(2);\n i0.ɵɵtextInterpolate(ctx_r3.addTagText);\n i0.ɵɵadvance();\n i0.ɵɵtextInterpolate1(\"\\\"\", ctx_r3.searchTerm, \"\\\"\");\n }\n}\nfunction NgSelectComponent_Conditional_13_Conditional_4_ng_template_3_Template(rf, ctx) {}\nfunction NgSelectComponent_Conditional_13_Conditional_4_Template(rf, ctx) {\n if (rf & 1) {\n const _r12 = i0.ɵɵgetCurrentView();\n i0.ɵɵelementStart(0, \"div\", 31);\n i0.ɵɵlistener(\"mouseover\", function NgSelectComponent_Conditional_13_Conditional_4_Template_div_mouseover_0_listener() {\n i0.ɵɵrestoreView(_r12);\n const ctx_r3 = i0.ɵɵnextContext(2);\n return i0.ɵɵresetView(ctx_r3.itemsList.unmarkItem());\n })(\"click\", function NgSelectComponent_Conditional_13_Conditional_4_Template_div_click_0_listener() {\n i0.ɵɵrestoreView(_r12);\n const ctx_r3 = i0.ɵɵnextContext(2);\n return i0.ɵɵresetView(ctx_r3.selectTag());\n });\n i0.ɵɵtemplate(1, NgSelectComponent_Conditional_13_Conditional_4_ng_template_1_Template, 4, 2, \"ng-template\", null, 5, i0.ɵɵtemplateRefExtractor)(3, NgSelectComponent_Conditional_13_Conditional_4_ng_template_3_Template, 0, 0, \"ng-template\", 12);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const defaultTagTemplate_r13 = i0.ɵɵreference(2);\n const ctx_r3 = i0.ɵɵnextContext(2);\n i0.ɵɵclassProp(\"ng-option-marked\", !ctx_r3.itemsList.markedItem);\n i0.ɵɵadvance(3);\n i0.ɵɵproperty(\"ngTemplateOutlet\", ctx_r3.tagTemplate || defaultTagTemplate_r13)(\"ngTemplateOutletContext\", i0.ɵɵpureFunction1(4, _c4, ctx_r3.searchTerm));\n }\n}\nfunction NgSelectComponent_Conditional_13_Conditional_5_ng_template_0_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 33);\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r3 = i0.ɵɵnextContext(3);\n i0.ɵɵadvance();\n i0.ɵɵtextInterpolate(ctx_r3.notFoundText);\n }\n}\nfunction NgSelectComponent_Conditional_13_Conditional_5_ng_template_2_Template(rf, ctx) {}\nfunction NgSelectComponent_Conditional_13_Conditional_5_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵtemplate(0, NgSelectComponent_Conditional_13_Conditional_5_ng_template_0_Template, 2, 1, \"ng-template\", null, 6, i0.ɵɵtemplateRefExtractor)(2, NgSelectComponent_Conditional_13_Conditional_5_ng_template_2_Template, 0, 0, \"ng-template\", 12);\n }\n if (rf & 2) {\n const defaultNotFoundTemplate_r14 = i0.ɵɵreference(1);\n const ctx_r3 = i0.ɵɵnextContext(2);\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"ngTemplateOutlet\", ctx_r3.notFoundTemplate || defaultNotFoundTemplate_r14)(\"ngTemplateOutletContext\", i0.ɵɵpureFunction1(2, _c4, ctx_r3.searchTerm));\n }\n}\nfunction NgSelectComponent_Conditional_13_Conditional_6_ng_template_0_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 33);\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r3 = i0.ɵɵnextContext(3);\n i0.ɵɵadvance();\n i0.ɵɵtextInterpolate(ctx_r3.typeToSearchText);\n }\n}\nfunction NgSelectComponent_Conditional_13_Conditional_6_ng_template_2_Template(rf, ctx) {}\nfunction NgSelectComponent_Conditional_13_Conditional_6_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵtemplate(0, NgSelectComponent_Conditional_13_Conditional_6_ng_template_0_Template, 2, 1, \"ng-template\", null, 7, i0.ɵɵtemplateRefExtractor)(2, NgSelectComponent_Conditional_13_Conditional_6_ng_template_2_Template, 0, 0, \"ng-template\", 23);\n }\n if (rf & 2) {\n const defaultTypeToSearchTemplate_r15 = i0.ɵɵreference(1);\n const ctx_r3 = i0.ɵɵnextContext(2);\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"ngTemplateOutlet\", ctx_r3.typeToSearchTemplate || defaultTypeToSearchTemplate_r15);\n }\n}\nfunction NgSelectComponent_Conditional_13_Conditional_7_ng_template_0_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelementStart(0, \"div\", 33);\n i0.ɵɵtext(1);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r3 = i0.ɵɵnextContext(3);\n i0.ɵɵadvance();\n i0.ɵɵtextInterpolate(ctx_r3.loadingText);\n }\n}\nfunction NgSelectComponent_Conditional_13_Conditional_7_ng_template_2_Template(rf, ctx) {}\nfunction NgSelectComponent_Conditional_13_Conditional_7_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵtemplate(0, NgSelectComponent_Conditional_13_Conditional_7_ng_template_0_Template, 2, 1, \"ng-template\", null, 8, i0.ɵɵtemplateRefExtractor)(2, NgSelectComponent_Conditional_13_Conditional_7_ng_template_2_Template, 0, 0, \"ng-template\", 12);\n }\n if (rf & 2) {\n const defaultLoadingTextTemplate_r16 = i0.ɵɵreference(1);\n const ctx_r3 = i0.ɵɵnextContext(2);\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"ngTemplateOutlet\", ctx_r3.loadingTextTemplate || defaultLoadingTextTemplate_r16)(\"ngTemplateOutletContext\", i0.ɵɵpureFunction1(2, _c4, ctx_r3.searchTerm));\n }\n}\nfunction NgSelectComponent_Conditional_13_Template(rf, ctx) {\n if (rf & 1) {\n const _r8 = i0.ɵɵgetCurrentView();\n i0.ɵɵelementStart(0, \"ng-dropdown-panel\", 26);\n i0.ɵɵlistener(\"update\", function NgSelectComponent_Conditional_13_Template_ng_dropdown_panel_update_0_listener($event) {\n i0.ɵɵrestoreView(_r8);\n const ctx_r3 = i0.ɵɵnextContext();\n return i0.ɵɵresetView(ctx_r3.viewPortItems = $event);\n })(\"scroll\", function NgSelectComponent_Conditional_13_Template_ng_dropdown_panel_scroll_0_listener($event) {\n i0.ɵɵrestoreView(_r8);\n const ctx_r3 = i0.ɵɵnextContext();\n return i0.ɵɵresetView(ctx_r3.scroll.emit($event));\n })(\"scrollToEnd\", function NgSelectComponent_Conditional_13_Template_ng_dropdown_panel_scrollToEnd_0_listener($event) {\n i0.ɵɵrestoreView(_r8);\n const ctx_r3 = i0.ɵɵnextContext();\n return i0.ɵɵresetView(ctx_r3.scrollToEnd.emit($event));\n })(\"outsideClick\", function NgSelectComponent_Conditional_13_Template_ng_dropdown_panel_outsideClick_0_listener() {\n i0.ɵɵrestoreView(_r8);\n const ctx_r3 = i0.ɵɵnextContext();\n return i0.ɵɵresetView(ctx_r3.close());\n });\n i0.ɵɵelementContainerStart(1);\n i0.ɵɵrepeaterCreate(2, NgSelectComponent_Conditional_13_For_3_Template, 4, 22, \"div\", 27, i0.ɵɵcomponentInstance().trackByOption, true);\n i0.ɵɵtemplate(4, NgSelectComponent_Conditional_13_Conditional_4_Template, 4, 6, \"div\", 28);\n i0.ɵɵelementContainerEnd();\n i0.ɵɵtemplate(5, NgSelectComponent_Conditional_13_Conditional_5_Template, 3, 4)(6, NgSelectComponent_Conditional_13_Conditional_6_Template, 3, 1)(7, NgSelectComponent_Conditional_13_Conditional_7_Template, 3, 4);\n i0.ɵɵelementEnd();\n }\n if (rf & 2) {\n const ctx_r3 = i0.ɵɵnextContext();\n i0.ɵɵclassMap(ctx_r3.dropdownPanelStaticClasses);\n i0.ɵɵclassProp(\"ng-select-multiple\", ctx_r3.multiple);\n i0.ɵɵproperty(\"virtualScroll\", ctx_r3.virtualScroll)(\"bufferAmount\", ctx_r3.bufferAmount)(\"appendTo\", ctx_r3.appendTo)(\"position\", ctx_r3.dropdownPosition)(\"headerTemplate\", ctx_r3.headerTemplate)(\"footerTemplate\", ctx_r3.footerTemplate)(\"filterValue\", ctx_r3.searchTerm)(\"items\", ctx_r3.itemsList.filteredItems)(\"markedItem\", ctx_r3.itemsList.markedItem)(\"ngClass\", ctx_r3.appendTo ? ctx_r3.ngClass : null)(\"id\", ctx_r3.dropdownId);\n i0.ɵɵadvance(2);\n i0.ɵɵrepeater(ctx_r3.viewPortItems);\n i0.ɵɵadvance(2);\n i0.ɵɵconditional(ctx_r3.showAddTag ? 4 : -1);\n i0.ɵɵadvance();\n i0.ɵɵconditional(ctx_r3.showNoItemsFound() ? 5 : -1);\n i0.ɵɵadvance();\n i0.ɵɵconditional(ctx_r3.showTypeToSearch() ? 6 : -1);\n i0.ɵɵadvance();\n i0.ɵɵconditional(ctx_r3.loading && ctx_r3.itemsList.filteredItems.length === 0 ? 7 : -1);\n }\n}\nconst unescapedHTMLExp = /[&<>\"']/g;\nconst hasUnescapedHTMLExp = RegExp(unescapedHTMLExp.source);\nconst htmlEscapes = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": '''\n};\nfunction escapeHTML(value) {\n return value && hasUnescapedHTMLExp.test(value) ? value.replace(unescapedHTMLExp, chr => htmlEscapes[chr]) : value;\n}\nfunction isDefined(value) {\n return value !== undefined && value !== null;\n}\nfunction isObject(value) {\n return typeof value === 'object' && isDefined(value);\n}\nfunction isPromise(value) {\n return value instanceof Promise;\n}\nfunction isFunction(value) {\n return value instanceof Function;\n}\nlet NgItemLabelDirective = /*#__PURE__*/(() => {\n class NgItemLabelDirective {\n constructor(element) {\n this.element = element;\n this.escape = true;\n }\n ngOnChanges(changes) {\n this.element.nativeElement.innerHTML = this.escape ? escapeHTML(this.ngItemLabel) : this.ngItemLabel;\n }\n static {\n this.ɵfac = function NgItemLabelDirective_Factory(ɵt) {\n return new (ɵt || NgItemLabelDirective)(i0.ɵɵdirectiveInject(i0.ElementRef));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: NgItemLabelDirective,\n selectors: [[\"\", \"ngItemLabel\", \"\"]],\n inputs: {\n ngItemLabel: \"ngItemLabel\",\n escape: \"escape\"\n },\n features: [i0.ɵɵNgOnChangesFeature]\n });\n }\n }\n return NgItemLabelDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n// eslint-disable-next-line @angular-eslint/directive-selector\nlet NgOptionTemplateDirective = /*#__PURE__*/(() => {\n class NgOptionTemplateDirective {\n constructor(template) {\n this.template = template;\n }\n static {\n this.ɵfac = function NgOptionTemplateDirective_Factory(ɵt) {\n return new (ɵt || NgOptionTemplateDirective)(i0.ɵɵdirectiveInject(i0.TemplateRef));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: NgOptionTemplateDirective,\n selectors: [[\"\", \"ng-option-tmp\", \"\"]]\n });\n }\n }\n return NgOptionTemplateDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n// eslint-disable-next-line @angular-eslint/directive-selector\nlet NgOptgroupTemplateDirective = /*#__PURE__*/(() => {\n class NgOptgroupTemplateDirective {\n constructor(template) {\n this.template = template;\n }\n static {\n this.ɵfac = function NgOptgroupTemplateDirective_Factory(ɵt) {\n return new (ɵt || NgOptgroupTemplateDirective)(i0.ɵɵdirectiveInject(i0.TemplateRef));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: NgOptgroupTemplateDirective,\n selectors: [[\"\", \"ng-optgroup-tmp\", \"\"]]\n });\n }\n }\n return NgOptgroupTemplateDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n// eslint-disable-next-line @angular-eslint/directive-selector\nlet NgLabelTemplateDirective = /*#__PURE__*/(() => {\n class NgLabelTemplateDirective {\n constructor(template) {\n this.template = template;\n }\n static {\n this.ɵfac = function NgLabelTemplateDirective_Factory(ɵt) {\n return new (ɵt || NgLabelTemplateDirective)(i0.ɵɵdirectiveInject(i0.TemplateRef));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: NgLabelTemplateDirective,\n selectors: [[\"\", \"ng-label-tmp\", \"\"]]\n });\n }\n }\n return NgLabelTemplateDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n// eslint-disable-next-line @angular-eslint/directive-selector\nlet NgMultiLabelTemplateDirective = /*#__PURE__*/(() => {\n class NgMultiLabelTemplateDirective {\n constructor(template) {\n this.template = template;\n }\n static {\n this.ɵfac = function NgMultiLabelTemplateDirective_Factory(ɵt) {\n return new (ɵt || NgMultiLabelTemplateDirective)(i0.ɵɵdirectiveInject(i0.TemplateRef));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: NgMultiLabelTemplateDirective,\n selectors: [[\"\", \"ng-multi-label-tmp\", \"\"]]\n });\n }\n }\n return NgMultiLabelTemplateDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n// eslint-disable-next-line @angular-eslint/directive-selector\nlet NgHeaderTemplateDirective = /*#__PURE__*/(() => {\n class NgHeaderTemplateDirective {\n constructor(template) {\n this.template = template;\n }\n static {\n this.ɵfac = function NgHeaderTemplateDirective_Factory(ɵt) {\n return new (ɵt || NgHeaderTemplateDirective)(i0.ɵɵdirectiveInject(i0.TemplateRef));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: NgHeaderTemplateDirective,\n selectors: [[\"\", \"ng-header-tmp\", \"\"]]\n });\n }\n }\n return NgHeaderTemplateDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n// eslint-disable-next-line @angular-eslint/directive-selector\nlet NgFooterTemplateDirective = /*#__PURE__*/(() => {\n class NgFooterTemplateDirective {\n constructor(template) {\n this.template = template;\n }\n static {\n this.ɵfac = function NgFooterTemplateDirective_Factory(ɵt) {\n return new (ɵt || NgFooterTemplateDirective)(i0.ɵɵdirectiveInject(i0.TemplateRef));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: NgFooterTemplateDirective,\n selectors: [[\"\", \"ng-footer-tmp\", \"\"]]\n });\n }\n }\n return NgFooterTemplateDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n// eslint-disable-next-line @angular-eslint/directive-selector\nlet NgNotFoundTemplateDirective = /*#__PURE__*/(() => {\n class NgNotFoundTemplateDirective {\n constructor(template) {\n this.template = template;\n }\n static {\n this.ɵfac = function NgNotFoundTemplateDirective_Factory(ɵt) {\n return new (ɵt || NgNotFoundTemplateDirective)(i0.ɵɵdirectiveInject(i0.TemplateRef));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: NgNotFoundTemplateDirective,\n selectors: [[\"\", \"ng-notfound-tmp\", \"\"]]\n });\n }\n }\n return NgNotFoundTemplateDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n// eslint-disable-next-line @angular-eslint/directive-selector\nlet NgTypeToSearchTemplateDirective = /*#__PURE__*/(() => {\n class NgTypeToSearchTemplateDirective {\n constructor(template) {\n this.template = template;\n }\n static {\n this.ɵfac = function NgTypeToSearchTemplateDirective_Factory(ɵt) {\n return new (ɵt || NgTypeToSearchTemplateDirective)(i0.ɵɵdirectiveInject(i0.TemplateRef));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: NgTypeToSearchTemplateDirective,\n selectors: [[\"\", \"ng-typetosearch-tmp\", \"\"]]\n });\n }\n }\n return NgTypeToSearchTemplateDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n// eslint-disable-next-line @angular-eslint/directive-selector\nlet NgLoadingTextTemplateDirective = /*#__PURE__*/(() => {\n class NgLoadingTextTemplateDirective {\n constructor(template) {\n this.template = template;\n }\n static {\n this.ɵfac = function NgLoadingTextTemplateDirective_Factory(ɵt) {\n return new (ɵt || NgLoadingTextTemplateDirective)(i0.ɵɵdirectiveInject(i0.TemplateRef));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: NgLoadingTextTemplateDirective,\n selectors: [[\"\", \"ng-loadingtext-tmp\", \"\"]]\n });\n }\n }\n return NgLoadingTextTemplateDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n// eslint-disable-next-line @angular-eslint/directive-selector\nlet NgTagTemplateDirective = /*#__PURE__*/(() => {\n class NgTagTemplateDirective {\n constructor(template) {\n this.template = template;\n }\n static {\n this.ɵfac = function NgTagTemplateDirective_Factory(ɵt) {\n return new (ɵt || NgTagTemplateDirective)(i0.ɵɵdirectiveInject(i0.TemplateRef));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: NgTagTemplateDirective,\n selectors: [[\"\", \"ng-tag-tmp\", \"\"]]\n });\n }\n }\n return NgTagTemplateDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n// eslint-disable-next-line @angular-eslint/directive-selector\nlet NgLoadingSpinnerTemplateDirective = /*#__PURE__*/(() => {\n class NgLoadingSpinnerTemplateDirective {\n constructor(template) {\n this.template = template;\n }\n static {\n this.ɵfac = function NgLoadingSpinnerTemplateDirective_Factory(ɵt) {\n return new (ɵt || NgLoadingSpinnerTemplateDirective)(i0.ɵɵdirectiveInject(i0.TemplateRef));\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: NgLoadingSpinnerTemplateDirective,\n selectors: [[\"\", \"ng-loadingspinner-tmp\", \"\"]]\n });\n }\n }\n return NgLoadingSpinnerTemplateDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction newId() {\n // First character is an 'a', it's good practice to tag id to begin with a letter\n return 'axxxxxxxxxxx'.replace(/[x]/g, () => {\n // eslint-disable-next-line no-bitwise\n const val = Math.random() * 16 | 0;\n return val.toString(16);\n });\n}\nconst diacritics = {\n '\\u24B6': 'A',\n '\\uFF21': 'A',\n '\\u00C0': 'A',\n '\\u00C1': 'A',\n '\\u00C2': 'A',\n '\\u1EA6': 'A',\n '\\u1EA4': 'A',\n '\\u1EAA': 'A',\n '\\u1EA8': 'A',\n '\\u00C3': 'A',\n '\\u0100': 'A',\n '\\u0102': 'A',\n '\\u1EB0': 'A',\n '\\u1EAE': 'A',\n '\\u1EB4': 'A',\n '\\u1EB2': 'A',\n '\\u0226': 'A',\n '\\u01E0': 'A',\n '\\u00C4': 'A',\n '\\u01DE': 'A',\n '\\u1EA2': 'A',\n '\\u00C5': 'A',\n '\\u01FA': 'A',\n '\\u01CD': 'A',\n '\\u0200': 'A',\n '\\u0202': 'A',\n '\\u1EA0': 'A',\n '\\u1EAC': 'A',\n '\\u1EB6': 'A',\n '\\u1E00': 'A',\n '\\u0104': 'A',\n '\\u023A': 'A',\n '\\u2C6F': 'A',\n '\\uA732': 'AA',\n '\\u00C6': 'AE',\n '\\u01FC': 'AE',\n '\\u01E2': 'AE',\n '\\uA734': 'AO',\n '\\uA736': 'AU',\n '\\uA738': 'AV',\n '\\uA73A': 'AV',\n '\\uA73C': 'AY',\n '\\u24B7': 'B',\n '\\uFF22': 'B',\n '\\u1E02': 'B',\n '\\u1E04': 'B',\n '\\u1E06': 'B',\n '\\u0243': 'B',\n '\\u0182': 'B',\n '\\u0181': 'B',\n '\\u24B8': 'C',\n '\\uFF23': 'C',\n '\\u0106': 'C',\n '\\u0108': 'C',\n '\\u010A': 'C',\n '\\u010C': 'C',\n '\\u00C7': 'C',\n '\\u1E08': 'C',\n '\\u0187': 'C',\n '\\u023B': 'C',\n '\\uA73E': 'C',\n '\\u24B9': 'D',\n '\\uFF24': 'D',\n '\\u1E0A': 'D',\n '\\u010E': 'D',\n '\\u1E0C': 'D',\n '\\u1E10': 'D',\n '\\u1E12': 'D',\n '\\u1E0E': 'D',\n '\\u0110': 'D',\n '\\u018B': 'D',\n '\\u018A': 'D',\n '\\u0189': 'D',\n '\\uA779': 'D',\n '\\u01F1': 'DZ',\n '\\u01C4': 'DZ',\n '\\u01F2': 'Dz',\n '\\u01C5': 'Dz',\n '\\u24BA': 'E',\n '\\uFF25': 'E',\n '\\u00C8': 'E',\n '\\u00C9': 'E',\n '\\u00CA': 'E',\n '\\u1EC0': 'E',\n '\\u1EBE': 'E',\n '\\u1EC4': 'E',\n '\\u1EC2': 'E',\n '\\u1EBC': 'E',\n '\\u0112': 'E',\n '\\u1E14': 'E',\n '\\u1E16': 'E',\n '\\u0114': 'E',\n '\\u0116': 'E',\n '\\u00CB': 'E',\n '\\u1EBA': 'E',\n '\\u011A': 'E',\n '\\u0204': 'E',\n '\\u0206': 'E',\n '\\u1EB8': 'E',\n '\\u1EC6': 'E',\n '\\u0228': 'E',\n '\\u1E1C': 'E',\n '\\u0118': 'E',\n '\\u1E18': 'E',\n '\\u1E1A': 'E',\n '\\u0190': 'E',\n '\\u018E': 'E',\n '\\u24BB': 'F',\n '\\uFF26': 'F',\n '\\u1E1E': 'F',\n '\\u0191': 'F',\n '\\uA77B': 'F',\n '\\u24BC': 'G',\n '\\uFF27': 'G',\n '\\u01F4': 'G',\n '\\u011C': 'G',\n '\\u1E20': 'G',\n '\\u011E': 'G',\n '\\u0120': 'G',\n '\\u01E6': 'G',\n '\\u0122': 'G',\n '\\u01E4': 'G',\n '\\u0193': 'G',\n '\\uA7A0': 'G',\n '\\uA77D': 'G',\n '\\uA77E': 'G',\n '\\u24BD': 'H',\n '\\uFF28': 'H',\n '\\u0124': 'H',\n '\\u1E22': 'H',\n '\\u1E26': 'H',\n '\\u021E': 'H',\n '\\u1E24': 'H',\n '\\u1E28': 'H',\n '\\u1E2A': 'H',\n '\\u0126': 'H',\n '\\u2C67': 'H',\n '\\u2C75': 'H',\n '\\uA78D': 'H',\n '\\u24BE': 'I',\n '\\uFF29': 'I',\n '\\u00CC': 'I',\n '\\u00CD': 'I',\n '\\u00CE': 'I',\n '\\u0128': 'I',\n '\\u012A': 'I',\n '\\u012C': 'I',\n '\\u0130': 'I',\n '\\u00CF': 'I',\n '\\u1E2E': 'I',\n '\\u1EC8': 'I',\n '\\u01CF': 'I',\n '\\u0208': 'I',\n '\\u020A': 'I',\n '\\u1ECA': 'I',\n '\\u012E': 'I',\n '\\u1E2C': 'I',\n '\\u0197': 'I',\n '\\u24BF': 'J',\n '\\uFF2A': 'J',\n '\\u0134': 'J',\n '\\u0248': 'J',\n '\\u24C0': 'K',\n '\\uFF2B': 'K',\n '\\u1E30': 'K',\n '\\u01E8': 'K',\n '\\u1E32': 'K',\n '\\u0136': 'K',\n '\\u1E34': 'K',\n '\\u0198': 'K',\n '\\u2C69': 'K',\n '\\uA740': 'K',\n '\\uA742': 'K',\n '\\uA744': 'K',\n '\\uA7A2': 'K',\n '\\u24C1': 'L',\n '\\uFF2C': 'L',\n '\\u013F': 'L',\n '\\u0139': 'L',\n '\\u013D': 'L',\n '\\u1E36': 'L',\n '\\u1E38': 'L',\n '\\u013B': 'L',\n '\\u1E3C': 'L',\n '\\u1E3A': 'L',\n '\\u0141': 'L',\n '\\u023D': 'L',\n '\\u2C62': 'L',\n '\\u2C60': 'L',\n '\\uA748': 'L',\n '\\uA746': 'L',\n '\\uA780': 'L',\n '\\u01C7': 'LJ',\n '\\u01C8': 'Lj',\n '\\u24C2': 'M',\n '\\uFF2D': 'M',\n '\\u1E3E': 'M',\n '\\u1E40': 'M',\n '\\u1E42': 'M',\n '\\u2C6E': 'M',\n '\\u019C': 'M',\n '\\u24C3': 'N',\n '\\uFF2E': 'N',\n '\\u01F8': 'N',\n '\\u0143': 'N',\n '\\u00D1': 'N',\n '\\u1E44': 'N',\n '\\u0147': 'N',\n '\\u1E46': 'N',\n '\\u0145': 'N',\n '\\u1E4A': 'N',\n '\\u1E48': 'N',\n '\\u0220': 'N',\n '\\u019D': 'N',\n '\\uA790': 'N',\n '\\uA7A4': 'N',\n '\\u01CA': 'NJ',\n '\\u01CB': 'Nj',\n '\\u24C4': 'O',\n '\\uFF2F': 'O',\n '\\u00D2': 'O',\n '\\u00D3': 'O',\n '\\u00D4': 'O',\n '\\u1ED2': 'O',\n '\\u1ED0': 'O',\n '\\u1ED6': 'O',\n '\\u1ED4': 'O',\n '\\u00D5': 'O',\n '\\u1E4C': 'O',\n '\\u022C': 'O',\n '\\u1E4E': 'O',\n '\\u014C': 'O',\n '\\u1E50': 'O',\n '\\u1E52': 'O',\n '\\u014E': 'O',\n '\\u022E': 'O',\n '\\u0230': 'O',\n '\\u00D6': 'O',\n '\\u022A': 'O',\n '\\u1ECE': 'O',\n '\\u0150': 'O',\n '\\u01D1': 'O',\n '\\u020C': 'O',\n '\\u020E': 'O',\n '\\u01A0': 'O',\n '\\u1EDC': 'O',\n '\\u1EDA': 'O',\n '\\u1EE0': 'O',\n '\\u1EDE': 'O',\n '\\u1EE2': 'O',\n '\\u1ECC': 'O',\n '\\u1ED8': 'O',\n '\\u01EA': 'O',\n '\\u01EC': 'O',\n '\\u00D8': 'O',\n '\\u01FE': 'O',\n '\\u0186': 'O',\n '\\u019F': 'O',\n '\\uA74A': 'O',\n '\\uA74C': 'O',\n '\\u01A2': 'OI',\n '\\uA74E': 'OO',\n '\\u0222': 'OU',\n '\\u24C5': 'P',\n '\\uFF30': 'P',\n '\\u1E54': 'P',\n '\\u1E56': 'P',\n '\\u01A4': 'P',\n '\\u2C63': 'P',\n '\\uA750': 'P',\n '\\uA752': 'P',\n '\\uA754': 'P',\n '\\u24C6': 'Q',\n '\\uFF31': 'Q',\n '\\uA756': 'Q',\n '\\uA758': 'Q',\n '\\u024A': 'Q',\n '\\u24C7': 'R',\n '\\uFF32': 'R',\n '\\u0154': 'R',\n '\\u1E58': 'R',\n '\\u0158': 'R',\n '\\u0210': 'R',\n '\\u0212': 'R',\n '\\u1E5A': 'R',\n '\\u1E5C': 'R',\n '\\u0156': 'R',\n '\\u1E5E': 'R',\n '\\u024C': 'R',\n '\\u2C64': 'R',\n '\\uA75A': 'R',\n '\\uA7A6': 'R',\n '\\uA782': 'R',\n '\\u24C8': 'S',\n '\\uFF33': 'S',\n '\\u1E9E': 'S',\n '\\u015A': 'S',\n '\\u1E64': 'S',\n '\\u015C': 'S',\n '\\u1E60': 'S',\n '\\u0160': 'S',\n '\\u1E66': 'S',\n '\\u1E62': 'S',\n '\\u1E68': 'S',\n '\\u0218': 'S',\n '\\u015E': 'S',\n '\\u2C7E': 'S',\n '\\uA7A8': 'S',\n '\\uA784': 'S',\n '\\u24C9': 'T',\n '\\uFF34': 'T',\n '\\u1E6A': 'T',\n '\\u0164': 'T',\n '\\u1E6C': 'T',\n '\\u021A': 'T',\n '\\u0162': 'T',\n '\\u1E70': 'T',\n '\\u1E6E': 'T',\n '\\u0166': 'T',\n '\\u01AC': 'T',\n '\\u01AE': 'T',\n '\\u023E': 'T',\n '\\uA786': 'T',\n '\\uA728': 'TZ',\n '\\u24CA': 'U',\n '\\uFF35': 'U',\n '\\u00D9': 'U',\n '\\u00DA': 'U',\n '\\u00DB': 'U',\n '\\u0168': 'U',\n '\\u1E78': 'U',\n '\\u016A': 'U',\n '\\u1E7A': 'U',\n '\\u016C': 'U',\n '\\u00DC': 'U',\n '\\u01DB': 'U',\n '\\u01D7': 'U',\n '\\u01D5': 'U',\n '\\u01D9': 'U',\n '\\u1EE6': 'U',\n '\\u016E': 'U',\n '\\u0170': 'U',\n '\\u01D3': 'U',\n '\\u0214': 'U',\n '\\u0216': 'U',\n '\\u01AF': 'U',\n '\\u1EEA': 'U',\n '\\u1EE8': 'U',\n '\\u1EEE': 'U',\n '\\u1EEC': 'U',\n '\\u1EF0': 'U',\n '\\u1EE4': 'U',\n '\\u1E72': 'U',\n '\\u0172': 'U',\n '\\u1E76': 'U',\n '\\u1E74': 'U',\n '\\u0244': 'U',\n '\\u24CB': 'V',\n '\\uFF36': 'V',\n '\\u1E7C': 'V',\n '\\u1E7E': 'V',\n '\\u01B2': 'V',\n '\\uA75E': 'V',\n '\\u0245': 'V',\n '\\uA760': 'VY',\n '\\u24CC': 'W',\n '\\uFF37': 'W',\n '\\u1E80': 'W',\n '\\u1E82': 'W',\n '\\u0174': 'W',\n '\\u1E86': 'W',\n '\\u1E84': 'W',\n '\\u1E88': 'W',\n '\\u2C72': 'W',\n '\\u24CD': 'X',\n '\\uFF38': 'X',\n '\\u1E8A': 'X',\n '\\u1E8C': 'X',\n '\\u24CE': 'Y',\n '\\uFF39': 'Y',\n '\\u1EF2': 'Y',\n '\\u00DD': 'Y',\n '\\u0176': 'Y',\n '\\u1EF8': 'Y',\n '\\u0232': 'Y',\n '\\u1E8E': 'Y',\n '\\u0178': 'Y',\n '\\u1EF6': 'Y',\n '\\u1EF4': 'Y',\n '\\u01B3': 'Y',\n '\\u024E': 'Y',\n '\\u1EFE': 'Y',\n '\\u24CF': 'Z',\n '\\uFF3A': 'Z',\n '\\u0179': 'Z',\n '\\u1E90': 'Z',\n '\\u017B': 'Z',\n '\\u017D': 'Z',\n '\\u1E92': 'Z',\n '\\u1E94': 'Z',\n '\\u01B5': 'Z',\n '\\u0224': 'Z',\n '\\u2C7F': 'Z',\n '\\u2C6B': 'Z',\n '\\uA762': 'Z',\n '\\u24D0': 'a',\n '\\uFF41': 'a',\n '\\u1E9A': 'a',\n '\\u00E0': 'a',\n '\\u00E1': 'a',\n '\\u00E2': 'a',\n '\\u1EA7': 'a',\n '\\u1EA5': 'a',\n '\\u1EAB': 'a',\n '\\u1EA9': 'a',\n '\\u00E3': 'a',\n '\\u0101': 'a',\n '\\u0103': 'a',\n '\\u1EB1': 'a',\n '\\u1EAF': 'a',\n '\\u1EB5': 'a',\n '\\u1EB3': 'a',\n '\\u0227': 'a',\n '\\u01E1': 'a',\n '\\u00E4': 'a',\n '\\u01DF': 'a',\n '\\u1EA3': 'a',\n '\\u00E5': 'a',\n '\\u01FB': 'a',\n '\\u01CE': 'a',\n '\\u0201': 'a',\n '\\u0203': 'a',\n '\\u1EA1': 'a',\n '\\u1EAD': 'a',\n '\\u1EB7': 'a',\n '\\u1E01': 'a',\n '\\u0105': 'a',\n '\\u2C65': 'a',\n '\\u0250': 'a',\n '\\uA733': 'aa',\n '\\u00E6': 'ae',\n '\\u01FD': 'ae',\n '\\u01E3': 'ae',\n '\\uA735': 'ao',\n '\\uA737': 'au',\n '\\uA739': 'av',\n '\\uA73B': 'av',\n '\\uA73D': 'ay',\n '\\u24D1': 'b',\n '\\uFF42': 'b',\n '\\u1E03': 'b',\n '\\u1E05': 'b',\n '\\u1E07': 'b',\n '\\u0180': 'b',\n '\\u0183': 'b',\n '\\u0253': 'b',\n '\\u24D2': 'c',\n '\\uFF43': 'c',\n '\\u0107': 'c',\n '\\u0109': 'c',\n '\\u010B': 'c',\n '\\u010D': 'c',\n '\\u00E7': 'c',\n '\\u1E09': 'c',\n '\\u0188': 'c',\n '\\u023C': 'c',\n '\\uA73F': 'c',\n '\\u2184': 'c',\n '\\u24D3': 'd',\n '\\uFF44': 'd',\n '\\u1E0B': 'd',\n '\\u010F': 'd',\n '\\u1E0D': 'd',\n '\\u1E11': 'd',\n '\\u1E13': 'd',\n '\\u1E0F': 'd',\n '\\u0111': 'd',\n '\\u018C': 'd',\n '\\u0256': 'd',\n '\\u0257': 'd',\n '\\uA77A': 'd',\n '\\u01F3': 'dz',\n '\\u01C6': 'dz',\n '\\u24D4': 'e',\n '\\uFF45': 'e',\n '\\u00E8': 'e',\n '\\u00E9': 'e',\n '\\u00EA': 'e',\n '\\u1EC1': 'e',\n '\\u1EBF': 'e',\n '\\u1EC5': 'e',\n '\\u1EC3': 'e',\n '\\u1EBD': 'e',\n '\\u0113': 'e',\n '\\u1E15': 'e',\n '\\u1E17': 'e',\n '\\u0115': 'e',\n '\\u0117': 'e',\n '\\u00EB': 'e',\n '\\u1EBB': 'e',\n '\\u011B': 'e',\n '\\u0205': 'e',\n '\\u0207': 'e',\n '\\u1EB9': 'e',\n '\\u1EC7': 'e',\n '\\u0229': 'e',\n '\\u1E1D': 'e',\n '\\u0119': 'e',\n '\\u1E19': 'e',\n '\\u1E1B': 'e',\n '\\u0247': 'e',\n '\\u025B': 'e',\n '\\u01DD': 'e',\n '\\u24D5': 'f',\n '\\uFF46': 'f',\n '\\u1E1F': 'f',\n '\\u0192': 'f',\n '\\uA77C': 'f',\n '\\u24D6': 'g',\n '\\uFF47': 'g',\n '\\u01F5': 'g',\n '\\u011D': 'g',\n '\\u1E21': 'g',\n '\\u011F': 'g',\n '\\u0121': 'g',\n '\\u01E7': 'g',\n '\\u0123': 'g',\n '\\u01E5': 'g',\n '\\u0260': 'g',\n '\\uA7A1': 'g',\n '\\u1D79': 'g',\n '\\uA77F': 'g',\n '\\u24D7': 'h',\n '\\uFF48': 'h',\n '\\u0125': 'h',\n '\\u1E23': 'h',\n '\\u1E27': 'h',\n '\\u021F': 'h',\n '\\u1E25': 'h',\n '\\u1E29': 'h',\n '\\u1E2B': 'h',\n '\\u1E96': 'h',\n '\\u0127': 'h',\n '\\u2C68': 'h',\n '\\u2C76': 'h',\n '\\u0265': 'h',\n '\\u0195': 'hv',\n '\\u24D8': 'i',\n '\\uFF49': 'i',\n '\\u00EC': 'i',\n '\\u00ED': 'i',\n '\\u00EE': 'i',\n '\\u0129': 'i',\n '\\u012B': 'i',\n '\\u012D': 'i',\n '\\u00EF': 'i',\n '\\u1E2F': 'i',\n '\\u1EC9': 'i',\n '\\u01D0': 'i',\n '\\u0209': 'i',\n '\\u020B': 'i',\n '\\u1ECB': 'i',\n '\\u012F': 'i',\n '\\u1E2D': 'i',\n '\\u0268': 'i',\n '\\u0131': 'i',\n '\\u24D9': 'j',\n '\\uFF4A': 'j',\n '\\u0135': 'j',\n '\\u01F0': 'j',\n '\\u0249': 'j',\n '\\u24DA': 'k',\n '\\uFF4B': 'k',\n '\\u1E31': 'k',\n '\\u01E9': 'k',\n '\\u1E33': 'k',\n '\\u0137': 'k',\n '\\u1E35': 'k',\n '\\u0199': 'k',\n '\\u2C6A': 'k',\n '\\uA741': 'k',\n '\\uA743': 'k',\n '\\uA745': 'k',\n '\\uA7A3': 'k',\n '\\u24DB': 'l',\n '\\uFF4C': 'l',\n '\\u0140': 'l',\n '\\u013A': 'l',\n '\\u013E': 'l',\n '\\u1E37': 'l',\n '\\u1E39': 'l',\n '\\u013C': 'l',\n '\\u1E3D': 'l',\n '\\u1E3B': 'l',\n '\\u017F': 'l',\n '\\u0142': 'l',\n '\\u019A': 'l',\n '\\u026B': 'l',\n '\\u2C61': 'l',\n '\\uA749': 'l',\n '\\uA781': 'l',\n '\\uA747': 'l',\n '\\u01C9': 'lj',\n '\\u24DC': 'm',\n '\\uFF4D': 'm',\n '\\u1E3F': 'm',\n '\\u1E41': 'm',\n '\\u1E43': 'm',\n '\\u0271': 'm',\n '\\u026F': 'm',\n '\\u24DD': 'n',\n '\\uFF4E': 'n',\n '\\u01F9': 'n',\n '\\u0144': 'n',\n '\\u00F1': 'n',\n '\\u1E45': 'n',\n '\\u0148': 'n',\n '\\u1E47': 'n',\n '\\u0146': 'n',\n '\\u1E4B': 'n',\n '\\u1E49': 'n',\n '\\u019E': 'n',\n '\\u0272': 'n',\n '\\u0149': 'n',\n '\\uA791': 'n',\n '\\uA7A5': 'n',\n '\\u01CC': 'nj',\n '\\u24DE': 'o',\n '\\uFF4F': 'o',\n '\\u00F2': 'o',\n '\\u00F3': 'o',\n '\\u00F4': 'o',\n '\\u1ED3': 'o',\n '\\u1ED1': 'o',\n '\\u1ED7': 'o',\n '\\u1ED5': 'o',\n '\\u00F5': 'o',\n '\\u1E4D': 'o',\n '\\u022D': 'o',\n '\\u1E4F': 'o',\n '\\u014D': 'o',\n '\\u1E51': 'o',\n '\\u1E53': 'o',\n '\\u014F': 'o',\n '\\u022F': 'o',\n '\\u0231': 'o',\n '\\u00F6': 'o',\n '\\u022B': 'o',\n '\\u1ECF': 'o',\n '\\u0151': 'o',\n '\\u01D2': 'o',\n '\\u020D': 'o',\n '\\u020F': 'o',\n '\\u01A1': 'o',\n '\\u1EDD': 'o',\n '\\u1EDB': 'o',\n '\\u1EE1': 'o',\n '\\u1EDF': 'o',\n '\\u1EE3': 'o',\n '\\u1ECD': 'o',\n '\\u1ED9': 'o',\n '\\u01EB': 'o',\n '\\u01ED': 'o',\n '\\u00F8': 'o',\n '\\u01FF': 'o',\n '\\u0254': 'o',\n '\\uA74B': 'o',\n '\\uA74D': 'o',\n '\\u0275': 'o',\n '\\u01A3': 'oi',\n '\\u0223': 'ou',\n '\\uA74F': 'oo',\n '\\u24DF': 'p',\n '\\uFF50': 'p',\n '\\u1E55': 'p',\n '\\u1E57': 'p',\n '\\u01A5': 'p',\n '\\u1D7D': 'p',\n '\\uA751': 'p',\n '\\uA753': 'p',\n '\\uA755': 'p',\n '\\u24E0': 'q',\n '\\uFF51': 'q',\n '\\u024B': 'q',\n '\\uA757': 'q',\n '\\uA759': 'q',\n '\\u24E1': 'r',\n '\\uFF52': 'r',\n '\\u0155': 'r',\n '\\u1E59': 'r',\n '\\u0159': 'r',\n '\\u0211': 'r',\n '\\u0213': 'r',\n '\\u1E5B': 'r',\n '\\u1E5D': 'r',\n '\\u0157': 'r',\n '\\u1E5F': 'r',\n '\\u024D': 'r',\n '\\u027D': 'r',\n '\\uA75B': 'r',\n '\\uA7A7': 'r',\n '\\uA783': 'r',\n '\\u24E2': 's',\n '\\uFF53': 's',\n '\\u00DF': 's',\n '\\u015B': 's',\n '\\u1E65': 's',\n '\\u015D': 's',\n '\\u1E61': 's',\n '\\u0161': 's',\n '\\u1E67': 's',\n '\\u1E63': 's',\n '\\u1E69': 's',\n '\\u0219': 's',\n '\\u015F': 's',\n '\\u023F': 's',\n '\\uA7A9': 's',\n '\\uA785': 's',\n '\\u1E9B': 's',\n '\\u24E3': 't',\n '\\uFF54': 't',\n '\\u1E6B': 't',\n '\\u1E97': 't',\n '\\u0165': 't',\n '\\u1E6D': 't',\n '\\u021B': 't',\n '\\u0163': 't',\n '\\u1E71': 't',\n '\\u1E6F': 't',\n '\\u0167': 't',\n '\\u01AD': 't',\n '\\u0288': 't',\n '\\u2C66': 't',\n '\\uA787': 't',\n '\\uA729': 'tz',\n '\\u24E4': 'u',\n '\\uFF55': 'u',\n '\\u00F9': 'u',\n '\\u00FA': 'u',\n '\\u00FB': 'u',\n '\\u0169': 'u',\n '\\u1E79': 'u',\n '\\u016B': 'u',\n '\\u1E7B': 'u',\n '\\u016D': 'u',\n '\\u00FC': 'u',\n '\\u01DC': 'u',\n '\\u01D8': 'u',\n '\\u01D6': 'u',\n '\\u01DA': 'u',\n '\\u1EE7': 'u',\n '\\u016F': 'u',\n '\\u0171': 'u',\n '\\u01D4': 'u',\n '\\u0215': 'u',\n '\\u0217': 'u',\n '\\u01B0': 'u',\n '\\u1EEB': 'u',\n '\\u1EE9': 'u',\n '\\u1EEF': 'u',\n '\\u1EED': 'u',\n '\\u1EF1': 'u',\n '\\u1EE5': 'u',\n '\\u1E73': 'u',\n '\\u0173': 'u',\n '\\u1E77': 'u',\n '\\u1E75': 'u',\n '\\u0289': 'u',\n '\\u24E5': 'v',\n '\\uFF56': 'v',\n '\\u1E7D': 'v',\n '\\u1E7F': 'v',\n '\\u028B': 'v',\n '\\uA75F': 'v',\n '\\u028C': 'v',\n '\\uA761': 'vy',\n '\\u24E6': 'w',\n '\\uFF57': 'w',\n '\\u1E81': 'w',\n '\\u1E83': 'w',\n '\\u0175': 'w',\n '\\u1E87': 'w',\n '\\u1E85': 'w',\n '\\u1E98': 'w',\n '\\u1E89': 'w',\n '\\u2C73': 'w',\n '\\u24E7': 'x',\n '\\uFF58': 'x',\n '\\u1E8B': 'x',\n '\\u1E8D': 'x',\n '\\u24E8': 'y',\n '\\uFF59': 'y',\n '\\u1EF3': 'y',\n '\\u00FD': 'y',\n '\\u0177': 'y',\n '\\u1EF9': 'y',\n '\\u0233': 'y',\n '\\u1E8F': 'y',\n '\\u00FF': 'y',\n '\\u1EF7': 'y',\n '\\u1E99': 'y',\n '\\u1EF5': 'y',\n '\\u01B4': 'y',\n '\\u024F': 'y',\n '\\u1EFF': 'y',\n '\\u24E9': 'z',\n '\\uFF5A': 'z',\n '\\u017A': 'z',\n '\\u1E91': 'z',\n '\\u017C': 'z',\n '\\u017E': 'z',\n '\\u1E93': 'z',\n '\\u1E95': 'z',\n '\\u01B6': 'z',\n '\\u0225': 'z',\n '\\u0240': 'z',\n '\\u2C6C': 'z',\n '\\uA763': 'z',\n '\\u0386': '\\u0391',\n '\\u0388': '\\u0395',\n '\\u0389': '\\u0397',\n '\\u038A': '\\u0399',\n '\\u03AA': '\\u0399',\n '\\u038C': '\\u039F',\n '\\u038E': '\\u03A5',\n '\\u03AB': '\\u03A5',\n '\\u038F': '\\u03A9',\n '\\u03AC': '\\u03B1',\n '\\u03AD': '\\u03B5',\n '\\u03AE': '\\u03B7',\n '\\u03AF': '\\u03B9',\n '\\u03CA': '\\u03B9',\n '\\u0390': '\\u03B9',\n '\\u03CC': '\\u03BF',\n '\\u03CD': '\\u03C5',\n '\\u03CB': '\\u03C5',\n '\\u03B0': '\\u03C5',\n '\\u03C9': '\\u03C9',\n '\\u03C2': '\\u03C3'\n};\nfunction stripSpecialChars(text) {\n const match = a => diacritics[a] || a;\n return text.replace(/[^\\u0000-\\u007E]/g, match);\n}\nclass ItemsList {\n constructor(_ngSelect, _selectionModel) {\n this._ngSelect = _ngSelect;\n this._selectionModel = _selectionModel;\n this._items = [];\n this._filteredItems = [];\n this._markedIndex = -1;\n }\n get items() {\n return this._items;\n }\n get filteredItems() {\n return this._filteredItems;\n }\n get markedIndex() {\n return this._markedIndex;\n }\n get selectedItems() {\n return this._selectionModel.value;\n }\n get markedItem() {\n return this._filteredItems[this._markedIndex];\n }\n get noItemsToSelect() {\n return this._ngSelect.hideSelected && this._items.length === this.selectedItems.length;\n }\n get maxItemsSelected() {\n return this._ngSelect.multiple && this._ngSelect.maxSelectedItems <= this.selectedItems.length;\n }\n get lastSelectedItem() {\n let i = this.selectedItems.length - 1;\n for (; i >= 0; i--) {\n const item = this.selectedItems[i];\n if (!item.disabled) {\n return item;\n }\n }\n return null;\n }\n setItems(items) {\n this._items = items.map((item, index) => this.mapItem(item, index));\n if (this._ngSelect.groupBy) {\n this._groups = this._groupBy(this._items, this._ngSelect.groupBy);\n this._items = this._flatten(this._groups);\n } else {\n this._groups = new Map();\n this._groups.set(undefined, this._items);\n }\n this._filteredItems = [...this._items];\n }\n select(item) {\n if (item.selected || this.maxItemsSelected) {\n return;\n }\n const multiple = this._ngSelect.multiple;\n if (!multiple) {\n this.clearSelected();\n }\n this._selectionModel.select(item, multiple, this._ngSelect.selectableGroupAsModel);\n if (this._ngSelect.hideSelected) {\n this._hideSelected(item);\n }\n }\n unselect(item) {\n if (!item.selected) {\n return;\n }\n this._selectionModel.unselect(item, this._ngSelect.multiple);\n if (this._ngSelect.hideSelected && isDefined(item.index) && this._ngSelect.multiple) {\n this._showSelected(item);\n }\n }\n findItem(value) {\n let findBy;\n if (this._ngSelect.compareWith) {\n findBy = item => this._ngSelect.compareWith(item.value, value);\n } else if (this._ngSelect.bindValue) {\n findBy = item => !item.children && this.resolveNested(item.value, this._ngSelect.bindValue) === value;\n } else {\n findBy = item => item.value === value || !item.children && item.label && item.label === this.resolveNested(value, this._ngSelect.bindLabel);\n }\n return this._items.find(item => findBy(item));\n }\n addItem(item) {\n const option = this.mapItem(item, this._items.length);\n this._items.push(option);\n this._filteredItems.push(option);\n return option;\n }\n clearSelected(keepDisabled = false) {\n this._selectionModel.clear(keepDisabled);\n this._items.forEach(item => {\n item.selected = keepDisabled && item.selected && item.disabled;\n item.marked = false;\n });\n if (this._ngSelect.hideSelected) {\n this.resetFilteredItems();\n }\n }\n findByLabel(term) {\n term = stripSpecialChars(term).toLocaleLowerCase();\n return this.filteredItems.find(item => {\n const label = stripSpecialChars(item.label).toLocaleLowerCase();\n return label.substr(0, term.length) === term;\n });\n }\n filter(term) {\n if (!term) {\n this.resetFilteredItems();\n return;\n }\n this._filteredItems = [];\n term = this._ngSelect.searchFn ? term : stripSpecialChars(term).toLocaleLowerCase();\n const match = this._ngSelect.searchFn || this._defaultSearchFn;\n const hideSelected = this._ngSelect.hideSelected;\n for (const key of Array.from(this._groups.keys())) {\n const matchedItems = [];\n for (const item of this._groups.get(key)) {\n if (hideSelected && (item.parent && item.parent.selected || item.selected)) {\n continue;\n }\n const searchItem = this._ngSelect.searchFn ? item.value : item;\n if (match(term, searchItem)) {\n matchedItems.push(item);\n }\n }\n if (matchedItems.length > 0) {\n const [last] = matchedItems.slice(-1);\n if (last.parent) {\n const head = this._items.find(x => x === last.parent);\n this._filteredItems.push(head);\n }\n this._filteredItems.push(...matchedItems);\n }\n }\n }\n resetFilteredItems() {\n if (this._filteredItems.length === this._items.length) {\n return;\n }\n if (this._ngSelect.hideSelected && this.selectedItems.length > 0) {\n this._filteredItems = this._items.filter(x => !x.selected);\n } else {\n this._filteredItems = this._items;\n }\n }\n unmarkItem() {\n this._markedIndex = -1;\n }\n markNextItem() {\n this._stepToItem(+1);\n }\n markPreviousItem() {\n this._stepToItem(-1);\n }\n markItem(item) {\n this._markedIndex = this._filteredItems.indexOf(item);\n }\n markSelectedOrDefault(markDefault) {\n if (this._filteredItems.length === 0) {\n return;\n }\n const lastMarkedIndex = this._getLastMarkedIndex();\n if (lastMarkedIndex > -1) {\n this._markedIndex = lastMarkedIndex;\n } else {\n this._markedIndex = markDefault ? this.filteredItems.findIndex(x => !x.disabled) : -1;\n }\n }\n resolveNested(option, key) {\n if (!isObject(option)) {\n return option;\n }\n if (key.indexOf('.') === -1) {\n return option[key];\n } else {\n const keys = key.split('.');\n let value = option;\n for (let i = 0, len = keys.length; i < len; ++i) {\n if (value == null) {\n return null;\n }\n value = value[keys[i]];\n }\n return value;\n }\n }\n mapItem(item, index) {\n const label = isDefined(item.$ngOptionLabel) ? item.$ngOptionLabel : this.resolveNested(item, this._ngSelect.bindLabel);\n const value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item;\n return {\n index,\n label: isDefined(label) ? label.toString() : '',\n value,\n disabled: item.disabled,\n htmlId: `${this._ngSelect.dropdownId}-${index}`\n };\n }\n mapSelectedItems() {\n const multiple = this._ngSelect.multiple;\n for (const selected of this.selectedItems) {\n const value = this._ngSelect.bindValue ? this.resolveNested(selected.value, this._ngSelect.bindValue) : selected.value;\n const item = isDefined(value) ? this.findItem(value) : null;\n this._selectionModel.unselect(selected, multiple);\n this._selectionModel.select(item || selected, multiple, this._ngSelect.selectableGroupAsModel);\n }\n if (this._ngSelect.hideSelected) {\n this._filteredItems = this.filteredItems.filter(x => this.selectedItems.indexOf(x) === -1);\n }\n }\n _showSelected(item) {\n this._filteredItems.push(item);\n if (item.parent) {\n const parent = item.parent;\n const parentExists = this._filteredItems.find(x => x === parent);\n if (!parentExists) {\n this._filteredItems.push(parent);\n }\n } else if (item.children) {\n for (const child of item.children) {\n child.selected = false;\n this._filteredItems.push(child);\n }\n }\n this._filteredItems = [...this._filteredItems.sort((a, b) => a.index - b.index)];\n }\n _hideSelected(item) {\n this._filteredItems = this._filteredItems.filter(x => x !== item);\n if (item.parent) {\n const children = item.parent.children;\n if (children.every(x => x.selected)) {\n this._filteredItems = this._filteredItems.filter(x => x !== item.parent);\n }\n } else if (item.children) {\n this._filteredItems = this.filteredItems.filter(x => x.parent !== item);\n }\n }\n _defaultSearchFn(search, opt) {\n const label = stripSpecialChars(opt.label).toLocaleLowerCase();\n return label.indexOf(search) > -1;\n }\n _getNextItemIndex(steps) {\n if (steps > 0) {\n return this._markedIndex >= this._filteredItems.length - 1 ? 0 : this._markedIndex + 1;\n }\n return this._markedIndex <= 0 ? this._filteredItems.length - 1 : this._markedIndex - 1;\n }\n _stepToItem(steps) {\n if (this._filteredItems.length === 0 || this._filteredItems.every(x => x.disabled)) {\n return;\n }\n this._markedIndex = this._getNextItemIndex(steps);\n if (this.markedItem.disabled) {\n this._stepToItem(steps);\n }\n }\n _getLastMarkedIndex() {\n if (this._ngSelect.hideSelected) {\n return -1;\n }\n if (this._markedIndex > -1 && this.markedItem === undefined) {\n return -1;\n }\n const selectedIndex = this._filteredItems.indexOf(this.lastSelectedItem);\n if (this.lastSelectedItem && selectedIndex < 0) {\n return -1;\n }\n return Math.max(this.markedIndex, selectedIndex);\n }\n _groupBy(items, prop) {\n const groups = new Map();\n if (items.length === 0) {\n return groups;\n }\n // Check if items are already grouped by given key.\n if (Array.isArray(items[0].value[prop])) {\n for (const item of items) {\n const children = (item.value[prop] || []).map((x, index) => this.mapItem(x, index));\n groups.set(item, children);\n }\n return groups;\n }\n const isFnKey = isFunction(this._ngSelect.groupBy);\n const keyFn = item => {\n const key = isFnKey ? prop(item.value) : item.value[prop];\n return isDefined(key) ? key : undefined;\n };\n // Group items by key.\n for (const item of items) {\n const key = keyFn(item);\n const group = groups.get(key);\n if (group) {\n group.push(item);\n } else {\n groups.set(key, [item]);\n }\n }\n return groups;\n }\n _flatten(groups) {\n const isGroupByFn = isFunction(this._ngSelect.groupBy);\n const items = [];\n for (const key of Array.from(groups.keys())) {\n let i = items.length;\n if (key === undefined) {\n const withoutGroup = groups.get(undefined) || [];\n items.push(...withoutGroup.map(x => {\n x.index = i++;\n return x;\n }));\n continue;\n }\n const isObjectKey = isObject(key);\n const parent = {\n label: isObjectKey ? '' : String(key),\n children: undefined,\n parent: null,\n index: i++,\n disabled: !this._ngSelect.selectableGroup,\n htmlId: newId()\n };\n const groupKey = isGroupByFn ? this._ngSelect.bindLabel : this._ngSelect.groupBy;\n const groupValue = this._ngSelect.groupValue || (() => {\n if (isObjectKey) {\n return key.value;\n }\n return {\n [groupKey]: key\n };\n });\n const children = groups.get(key).map(x => {\n x.parent = parent;\n x.children = undefined;\n x.index = i++;\n return x;\n });\n parent.children = children;\n parent.value = groupValue(key, children.map(x => x.value));\n items.push(parent);\n items.push(...children);\n }\n return items;\n }\n}\nvar KeyCode = /*#__PURE__*/function (KeyCode) {\n KeyCode[KeyCode[\"Tab\"] = 9] = \"Tab\";\n KeyCode[KeyCode[\"Enter\"] = 13] = \"Enter\";\n KeyCode[KeyCode[\"Esc\"] = 27] = \"Esc\";\n KeyCode[KeyCode[\"Space\"] = 32] = \"Space\";\n KeyCode[KeyCode[\"ArrowUp\"] = 38] = \"ArrowUp\";\n KeyCode[KeyCode[\"ArrowDown\"] = 40] = \"ArrowDown\";\n KeyCode[KeyCode[\"Backspace\"] = 8] = \"Backspace\";\n return KeyCode;\n}(KeyCode || {});\nlet NgDropdownPanelService = /*#__PURE__*/(() => {\n class NgDropdownPanelService {\n constructor() {\n this._dimensions = {\n itemHeight: 0,\n panelHeight: 0,\n itemsPerViewport: 0\n };\n }\n get dimensions() {\n return this._dimensions;\n }\n calculateItems(scrollPos, itemsLength, buffer) {\n const d = this._dimensions;\n const scrollHeight = d.itemHeight * itemsLength;\n const scrollTop = Math.max(0, scrollPos);\n const indexByScrollTop = scrollTop / scrollHeight * itemsLength;\n let end = Math.min(itemsLength, Math.ceil(indexByScrollTop) + (d.itemsPerViewport + 1));\n const maxStartEnd = end;\n const maxStart = Math.max(0, maxStartEnd - d.itemsPerViewport);\n let start = Math.min(maxStart, Math.floor(indexByScrollTop));\n let topPadding = d.itemHeight * Math.ceil(start) - d.itemHeight * Math.min(start, buffer);\n topPadding = !isNaN(topPadding) ? topPadding : 0;\n start = !isNaN(start) ? start : -1;\n end = !isNaN(end) ? end : -1;\n start -= buffer;\n start = Math.max(0, start);\n end += buffer;\n end = Math.min(itemsLength, end);\n return {\n topPadding,\n scrollHeight,\n start,\n end\n };\n }\n setDimensions(itemHeight, panelHeight) {\n const itemsPerViewport = Math.max(1, Math.floor(panelHeight / itemHeight));\n this._dimensions = {\n itemHeight,\n panelHeight,\n itemsPerViewport\n };\n }\n getScrollTo(itemTop, itemHeight, lastScroll) {\n const {\n panelHeight\n } = this.dimensions;\n const itemBottom = itemTop + itemHeight;\n const top = lastScroll;\n const bottom = top + panelHeight;\n if (panelHeight >= itemBottom && lastScroll === itemTop) {\n return null;\n }\n if (itemBottom > bottom) {\n return top + itemBottom - bottom;\n } else if (itemTop <= top) {\n return itemTop;\n }\n return null;\n }\n static {\n this.ɵfac = function NgDropdownPanelService_Factory(ɵt) {\n return new (ɵt || NgDropdownPanelService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: NgDropdownPanelService,\n factory: NgDropdownPanelService.ɵfac\n });\n }\n }\n return NgDropdownPanelService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst CSS_POSITIONS = ['top', 'right', 'bottom', 'left'];\nconst SCROLL_SCHEDULER = typeof requestAnimationFrame !== 'undefined' ? animationFrameScheduler : asapScheduler;\nlet NgDropdownPanelComponent = /*#__PURE__*/(() => {\n class NgDropdownPanelComponent {\n constructor(_renderer, _zone, _panelService, _elementRef, _document) {\n this._renderer = _renderer;\n this._zone = _zone;\n this._panelService = _panelService;\n this._document = _document;\n this.items = [];\n this.position = 'auto';\n this.virtualScroll = false;\n this.filterValue = null;\n this.update = new EventEmitter();\n this.scroll = new EventEmitter();\n this.scrollToEnd = new EventEmitter();\n this.outsideClick = new EventEmitter();\n this._destroy$ = new Subject();\n this._scrollToEndFired = false;\n this._updateScrollHeight = false;\n this._lastScrollPosition = 0;\n this._dropdown = _elementRef.nativeElement;\n }\n get currentPosition() {\n return this._currentPosition;\n }\n get itemsLength() {\n return this._itemsLength;\n }\n set itemsLength(value) {\n if (value !== this._itemsLength) {\n this._itemsLength = value;\n this._onItemsLengthChanged();\n }\n }\n get _startOffset() {\n if (this.markedItem) {\n const {\n itemHeight,\n panelHeight\n } = this._panelService.dimensions;\n const offset = this.markedItem.index * itemHeight;\n return panelHeight > offset ? 0 : offset;\n }\n return 0;\n }\n ngOnInit() {\n this._select = this._dropdown.parentElement;\n this._virtualPadding = this.paddingElementRef.nativeElement;\n this._scrollablePanel = this.scrollElementRef.nativeElement;\n this._contentPanel = this.contentElementRef.nativeElement;\n this._handleScroll();\n this._handleOutsideClick();\n this._appendDropdown();\n this._setupMousedownListener();\n }\n ngOnChanges(changes) {\n if (changes.items) {\n const change = changes.items;\n this._onItemsChange(change.currentValue, change.firstChange);\n }\n }\n ngOnDestroy() {\n this._destroy$.next();\n this._destroy$.complete();\n this._destroy$.unsubscribe();\n if (this.appendTo) {\n this._renderer.removeChild(this._dropdown.parentNode, this._dropdown);\n }\n }\n scrollTo(option, startFromOption = false) {\n if (!option) {\n return;\n }\n const index = this.items.indexOf(option);\n if (index < 0 || index >= this.itemsLength) {\n return;\n }\n let scrollTo;\n if (this.virtualScroll) {\n const itemHeight = this._panelService.dimensions.itemHeight;\n scrollTo = this._panelService.getScrollTo(index * itemHeight, itemHeight, this._lastScrollPosition);\n } else {\n const item = this._dropdown.querySelector(`#${option.htmlId}`);\n const lastScroll = startFromOption ? item.offsetTop : this._lastScrollPosition;\n scrollTo = this._panelService.getScrollTo(item.offsetTop, item.clientHeight, lastScroll);\n }\n if (isDefined(scrollTo)) {\n this._scrollablePanel.scrollTop = scrollTo;\n }\n }\n scrollToTag() {\n const panel = this._scrollablePanel;\n panel.scrollTop = panel.scrollHeight - panel.clientHeight;\n }\n adjustPosition() {\n this._updateYPosition();\n }\n _handleDropdownPosition() {\n this._currentPosition = this._calculateCurrentPosition(this._dropdown);\n if (CSS_POSITIONS.includes(this._currentPosition)) {\n this._updateDropdownClass(this._currentPosition);\n } else {\n this._updateDropdownClass('bottom');\n }\n if (this.appendTo) {\n this._updateYPosition();\n }\n this._dropdown.style.opacity = '1';\n }\n _updateDropdownClass(currentPosition) {\n CSS_POSITIONS.forEach(position => {\n const REMOVE_CSS_CLASS = `ng-select-${position}`;\n this._renderer.removeClass(this._dropdown, REMOVE_CSS_CLASS);\n this._renderer.removeClass(this._select, REMOVE_CSS_CLASS);\n });\n const ADD_CSS_CLASS = `ng-select-${currentPosition}`;\n this._renderer.addClass(this._dropdown, ADD_CSS_CLASS);\n this._renderer.addClass(this._select, ADD_CSS_CLASS);\n }\n _handleScroll() {\n this._zone.runOutsideAngular(() => {\n fromEvent(this.scrollElementRef.nativeElement, 'scroll').pipe(takeUntil(this._destroy$), auditTime(0, SCROLL_SCHEDULER)).subscribe(e => {\n const path = e.path || e.composedPath && e.composedPath();\n if (!path || path.length === 0 && !e.target) {\n return;\n }\n const scrollTop = !path || path.length === 0 ? e.target.scrollTop : path[0].scrollTop;\n this._onContentScrolled(scrollTop);\n });\n });\n }\n _handleOutsideClick() {\n if (!this._document) {\n return;\n }\n this._zone.runOutsideAngular(() => {\n merge(fromEvent(this._document, 'touchstart', {\n capture: true\n }), fromEvent(this._document, 'click', {\n capture: true\n })).pipe(takeUntil(this._destroy$)).subscribe($event => this._checkToClose($event));\n });\n }\n _checkToClose($event) {\n if (this._select.contains($event.target) || this._dropdown.contains($event.target)) {\n return;\n }\n const path = $event.path || $event.composedPath && $event.composedPath();\n if ($event.target && $event.target.shadowRoot && path && path[0] && this._select.contains(path[0])) {\n return;\n }\n this._zone.run(() => this.outsideClick.emit());\n }\n _onItemsChange(items, firstChange) {\n this.items = items || [];\n this._scrollToEndFired = false;\n this.itemsLength = items.length;\n if (this.virtualScroll) {\n this._updateItemsRange(firstChange);\n } else {\n this._setVirtualHeight();\n this._updateItems(firstChange);\n }\n }\n _updateItems(firstChange) {\n this.update.emit(this.items);\n if (firstChange === false) {\n return;\n }\n this._zone.runOutsideAngular(() => {\n Promise.resolve().then(() => {\n const panelHeight = this._scrollablePanel.clientHeight;\n this._panelService.setDimensions(0, panelHeight);\n this._handleDropdownPosition();\n this.scrollTo(this.markedItem, firstChange);\n });\n });\n }\n _updateItemsRange(firstChange) {\n this._zone.runOutsideAngular(() => {\n this._measureDimensions().then(() => {\n if (firstChange) {\n this._renderItemsRange(this._startOffset);\n this._handleDropdownPosition();\n } else {\n this._renderItemsRange();\n }\n });\n });\n }\n _onContentScrolled(scrollTop) {\n if (this.virtualScroll) {\n this._renderItemsRange(scrollTop);\n }\n this._lastScrollPosition = scrollTop;\n this._fireScrollToEnd(scrollTop);\n }\n _updateVirtualHeight(height) {\n if (this._updateScrollHeight) {\n this._virtualPadding.style.height = `${height}px`;\n this._updateScrollHeight = false;\n }\n }\n _setVirtualHeight() {\n if (!this._virtualPadding) {\n return;\n }\n this._virtualPadding.style.height = `0px`;\n }\n _onItemsLengthChanged() {\n this._updateScrollHeight = true;\n }\n _renderItemsRange(scrollTop = null) {\n if (scrollTop && this._lastScrollPosition === scrollTop) {\n return;\n }\n scrollTop = scrollTop || this._scrollablePanel.scrollTop;\n const range = this._panelService.calculateItems(scrollTop, this.itemsLength, this.bufferAmount);\n this._updateVirtualHeight(range.scrollHeight);\n this._contentPanel.style.transform = `translateY(${range.topPadding}px)`;\n this._zone.run(() => {\n this.update.emit(this.items.slice(range.start, range.end));\n this.scroll.emit({\n start: range.start,\n end: range.end\n });\n });\n if (isDefined(scrollTop) && this._lastScrollPosition === 0) {\n this._scrollablePanel.scrollTop = scrollTop;\n this._lastScrollPosition = scrollTop;\n }\n }\n _measureDimensions() {\n if (this._panelService.dimensions.itemHeight > 0 || this.itemsLength === 0) {\n return Promise.resolve(this._panelService.dimensions);\n }\n const [first] = this.items;\n this.update.emit([first]);\n return Promise.resolve().then(() => {\n const option = this._dropdown.querySelector(`#${first.htmlId}`);\n const optionHeight = option.clientHeight;\n this._virtualPadding.style.height = `${optionHeight * this.itemsLength}px`;\n const panelHeight = this._scrollablePanel.clientHeight;\n this._panelService.setDimensions(optionHeight, panelHeight);\n return this._panelService.dimensions;\n });\n }\n _fireScrollToEnd(scrollTop) {\n if (this._scrollToEndFired || scrollTop === 0) {\n return;\n }\n const padding = this.virtualScroll ? this._virtualPadding : this._contentPanel;\n if (scrollTop + this._dropdown.clientHeight >= padding.clientHeight - 1) {\n this._zone.run(() => this.scrollToEnd.emit());\n this._scrollToEndFired = true;\n }\n }\n _calculateCurrentPosition(dropdownEl) {\n if (this.position !== 'auto') {\n return this.position;\n }\n const selectRect = this._select.getBoundingClientRect();\n const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;\n const offsetTop = selectRect.top + window.pageYOffset;\n const height = selectRect.height;\n const dropdownHeight = dropdownEl.getBoundingClientRect().height;\n if (offsetTop + height + dropdownHeight > scrollTop + document.documentElement.clientHeight) {\n return 'top';\n } else {\n return 'bottom';\n }\n }\n _appendDropdown() {\n if (!this.appendTo) {\n return;\n }\n this._parent = document.querySelector(this.appendTo);\n if (!this._parent) {\n throw new Error(`appendTo selector ${this.appendTo} did not found any parent element`);\n }\n this._updateXPosition();\n this._parent.appendChild(this._dropdown);\n }\n _updateXPosition() {\n const select = this._select.getBoundingClientRect();\n const parent = this._parent.getBoundingClientRect();\n const offsetLeft = select.left - parent.left;\n this._dropdown.style.left = offsetLeft + 'px';\n this._dropdown.style.width = select.width + 'px';\n this._dropdown.style.minWidth = select.width + 'px';\n }\n _updateYPosition() {\n const select = this._select.getBoundingClientRect();\n const parent = this._parent.getBoundingClientRect();\n const delta = select.height;\n if (this._currentPosition === 'top') {\n const offsetBottom = parent.bottom - select.bottom;\n this._dropdown.style.bottom = offsetBottom + delta + 'px';\n this._dropdown.style.top = 'auto';\n } else if (this._currentPosition === 'bottom') {\n const offsetTop = select.top - parent.top;\n this._dropdown.style.top = offsetTop + delta + 'px';\n this._dropdown.style.bottom = 'auto';\n }\n }\n _setupMousedownListener() {\n this._zone.runOutsideAngular(() => {\n fromEvent(this._dropdown, 'mousedown').pipe(takeUntil(this._destroy$)).subscribe(event => {\n const target = event.target;\n if (target.tagName === 'INPUT') {\n return;\n }\n event.preventDefault();\n });\n });\n }\n static {\n this.ɵfac = function NgDropdownPanelComponent_Factory(ɵt) {\n return new (ɵt || NgDropdownPanelComponent)(i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.NgZone), i0.ɵɵdirectiveInject(NgDropdownPanelService), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(DOCUMENT, 8));\n };\n }\n static {\n this.ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: NgDropdownPanelComponent,\n selectors: [[\"ng-dropdown-panel\"]],\n viewQuery: function NgDropdownPanelComponent_Query(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵviewQuery(_c0, 7, ElementRef);\n i0.ɵɵviewQuery(_c1, 7, ElementRef);\n i0.ɵɵviewQuery(_c2, 7, ElementRef);\n }\n if (rf & 2) {\n let _t;\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.contentElementRef = _t.first);\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.scrollElementRef = _t.first);\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.paddingElementRef = _t.first);\n }\n },\n inputs: {\n items: \"items\",\n markedItem: \"markedItem\",\n position: \"position\",\n appendTo: \"appendTo\",\n bufferAmount: \"bufferAmount\",\n virtualScroll: [2, \"virtualScroll\", \"virtualScroll\", booleanAttribute],\n headerTemplate: \"headerTemplate\",\n footerTemplate: \"footerTemplate\",\n filterValue: \"filterValue\"\n },\n outputs: {\n update: \"update\",\n scroll: \"scroll\",\n scrollToEnd: \"scrollToEnd\",\n outsideClick: \"outsideClick\"\n },\n features: [i0.ɵɵInputTransformsFeature, i0.ɵɵNgOnChangesFeature],\n ngContentSelectors: _c3,\n decls: 9,\n vars: 6,\n consts: [[\"scroll\", \"\"], [\"padding\", \"\"], [\"content\", \"\"], [1, \"ng-dropdown-header\"], [\"role\", \"listbox\", 1, \"ng-dropdown-panel-items\", \"scroll-host\"], [1, \"ng-dropdown-footer\"], [3, \"ngTemplateOutlet\", \"ngTemplateOutletContext\"]],\n template: function NgDropdownPanelComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵprojectionDef();\n i0.ɵɵtemplate(0, NgDropdownPanelComponent_Conditional_0_Template, 2, 4, \"div\", 3);\n i0.ɵɵelementStart(1, \"div\", 4, 0);\n i0.ɵɵelement(3, \"div\", null, 1);\n i0.ɵɵelementStart(5, \"div\", null, 2);\n i0.ɵɵprojection(7);\n i0.ɵɵelementEnd()();\n i0.ɵɵtemplate(8, NgDropdownPanelComponent_Conditional_8_Template, 2, 4, \"div\", 5);\n }\n if (rf & 2) {\n i0.ɵɵconditional(ctx.headerTemplate ? 0 : -1);\n i0.ɵɵadvance(3);\n i0.ɵɵclassProp(\"total-padding\", ctx.virtualScroll);\n i0.ɵɵadvance(2);\n i0.ɵɵclassProp(\"scrollable-content\", ctx.virtualScroll && ctx.items.length);\n i0.ɵɵadvance(3);\n i0.ɵɵconditional(ctx.footerTemplate ? 8 : -1);\n }\n },\n dependencies: [i3.NgTemplateOutlet],\n encapsulation: 2,\n changeDetection: 0\n });\n }\n }\n return NgDropdownPanelComponent;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet NgOptionComponent = /*#__PURE__*/(() => {\n class NgOptionComponent {\n constructor(elementRef) {\n this.elementRef = elementRef;\n this.disabled = false;\n this.stateChange$ = new Subject();\n }\n get label() {\n return (this.elementRef.nativeElement.textContent || '').trim();\n }\n ngOnChanges(changes) {\n if (changes.disabled) {\n this.stateChange$.next({\n value: this.value,\n disabled: this.disabled\n });\n }\n }\n ngAfterViewChecked() {\n if (this.label !== this._previousLabel) {\n this._previousLabel = this.label;\n this.stateChange$.next({\n value: this.value,\n disabled: this.disabled,\n label: this.elementRef.nativeElement.innerHTML\n });\n }\n }\n ngOnDestroy() {\n this.stateChange$.complete();\n }\n static {\n this.ɵfac = function NgOptionComponent_Factory(ɵt) {\n return new (ɵt || NgOptionComponent)(i0.ɵɵdirectiveInject(i0.ElementRef));\n };\n }\n static {\n this.ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: NgOptionComponent,\n selectors: [[\"ng-option\"]],\n inputs: {\n value: \"value\",\n disabled: [2, \"disabled\", \"disabled\", booleanAttribute]\n },\n features: [i0.ɵɵInputTransformsFeature, i0.ɵɵNgOnChangesFeature],\n ngContentSelectors: _c3,\n decls: 1,\n vars: 0,\n template: function NgOptionComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵprojectionDef();\n i0.ɵɵprojection(0);\n }\n },\n encapsulation: 2,\n changeDetection: 0\n });\n }\n }\n return NgOptionComponent;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet NgSelectConfig = /*#__PURE__*/(() => {\n class NgSelectConfig {\n constructor() {\n this.notFoundText = 'No items found';\n this.typeToSearchText = 'Type to search';\n this.addTagText = 'Add item';\n this.loadingText = 'Loading...';\n this.clearAllText = 'Clear all';\n this.disableVirtualScroll = true;\n this.openOnEnter = true;\n this.appearance = 'underline';\n }\n static {\n this.ɵfac = function NgSelectConfig_Factory(ɵt) {\n return new (ɵt || NgSelectConfig)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: NgSelectConfig,\n factory: NgSelectConfig.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return NgSelectConfig;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ConsoleService = /*#__PURE__*/(() => {\n class ConsoleService {\n warn(message) {\n console.warn(message);\n }\n static {\n this.ɵfac = function ConsoleService_Factory(ɵt) {\n return new (ɵt || ConsoleService)();\n };\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ConsoleService,\n factory: ConsoleService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return ConsoleService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst SELECTION_MODEL_FACTORY = new InjectionToken('ng-select-selection-model');\nlet NgSelectComponent = /*#__PURE__*/(() => {\n class NgSelectComponent {\n get items() {\n return this._items;\n }\n set items(value) {\n this._itemsAreUsed = true;\n this._items = value ?? [];\n }\n get compareWith() {\n return this._compareWith;\n }\n set compareWith(fn) {\n if (fn !== undefined && fn !== null && !isFunction(fn)) {\n throw Error('`compareWith` must be a function.');\n }\n this._compareWith = fn;\n }\n get clearSearchOnAdd() {\n if (isDefined(this._clearSearchOnAdd)) {\n return this._clearSearchOnAdd;\n } else if (isDefined(this.config.clearSearchOnAdd)) {\n return this.config.clearSearchOnAdd;\n }\n return this.closeOnSelect;\n }\n set clearSearchOnAdd(value) {\n this._clearSearchOnAdd = value;\n }\n get deselectOnClick() {\n if (isDefined(this._deselectOnClick)) {\n return this._deselectOnClick;\n } else if (isDefined(this.config.deselectOnClick)) {\n return this.config.deselectOnClick;\n }\n return this.multiple;\n }\n set deselectOnClick(value) {\n this._deselectOnClick = value;\n }\n get dropdownPanelStaticClasses() {\n return this.appendTo && this.classes ? `ng-dropdown-panel ${this.classes}` : 'ng-dropdown-panel';\n }\n get disabled() {\n return this.readonly || this._disabled;\n }\n get filtered() {\n return !!this.searchTerm && this.searchable || this._isComposing;\n }\n get single() {\n return !this.multiple;\n }\n get _editableSearchTerm() {\n return this.editableSearchTerm && !this.multiple;\n }\n constructor(classes, autoFocus, config, newSelectionModel, _elementRef, _cd, _console) {\n this.classes = classes;\n this.autoFocus = autoFocus;\n this.config = config;\n this._cd = _cd;\n this._console = _console;\n this.markFirst = true;\n this.preventToggleOnRightClick = false;\n this.dropdownPosition = 'auto';\n this.loading = false;\n this.closeOnSelect = true;\n this.hideSelected = false;\n this.selectOnTab = false;\n this.bufferAmount = 4;\n this.selectableGroup = false;\n this.selectableGroupAsModel = true;\n this.searchFn = null;\n this.trackByFn = null;\n this.clearOnBackspace = true;\n this.labelForId = null;\n this.inputAttrs = {};\n this.readonly = false;\n this.searchWhileComposing = true;\n this.minTermLength = 0;\n this.editableSearchTerm = false;\n this.keyDownFn = _ => true;\n this.ngClass = null;\n this.multiple = false;\n this.addTag = false;\n this.searchable = true;\n this.clearable = true;\n this.isOpen = false;\n // output events\n this.blurEvent = new EventEmitter();\n this.focusEvent = new EventEmitter();\n this.changeEvent = new EventEmitter();\n this.openEvent = new EventEmitter();\n this.closeEvent = new EventEmitter();\n this.searchEvent = new EventEmitter();\n this.clearEvent = new EventEmitter();\n this.addEvent = new EventEmitter();\n this.removeEvent = new EventEmitter();\n this.scroll = new EventEmitter();\n this.scrollToEnd = new EventEmitter();\n this.useDefaultClass = true;\n this.viewPortItems = [];\n this.searchTerm = null;\n this.dropdownId = newId();\n this.escapeHTML = true;\n this._items = [];\n this._defaultLabel = 'label';\n this._pressedKeys = [];\n this._isComposing = false;\n this._destroy$ = new Subject();\n this._keyPress$ = new Subject();\n this._onChange = _ => {};\n this._onTouched = () => {};\n this.clearItem = item => {\n const option = this.selectedItems.find(x => x.value === item);\n this.unselect(option);\n };\n this.trackByOption = (_, item) => {\n if (this.trackByFn) {\n return this.trackByFn(item.value);\n }\n return item;\n };\n this._mergeGlobalConfig(config);\n this.itemsList = new ItemsList(this, newSelectionModel());\n this.element = _elementRef.nativeElement;\n }\n get selectedItems() {\n return this.itemsList.selectedItems;\n }\n get selectedValues() {\n return this.selectedItems.map(x => x.value);\n }\n get hasValue() {\n return this.selectedItems.length > 0;\n }\n get currentPanelPosition() {\n if (this.dropdownPanel) {\n return this.dropdownPanel.currentPosition;\n }\n return undefined;\n }\n ngOnInit() {\n this._handleKeyPresses();\n this._setInputAttributes();\n }\n ngOnChanges(changes) {\n if (changes.multiple) {\n this.itemsList.clearSelected();\n }\n if (changes.items) {\n this._setItems(changes.items.currentValue || []);\n }\n if (changes.isOpen) {\n this._manualOpen = isDefined(changes.isOpen.currentValue);\n }\n }\n ngAfterViewInit() {\n if (!this._itemsAreUsed) {\n this.escapeHTML = false;\n this._setItemsFromNgOptions();\n }\n if (isDefined(this.autoFocus)) {\n this.focus();\n }\n }\n ngOnDestroy() {\n this._destroy$.next();\n this._destroy$.complete();\n }\n handleKeyDown($event) {\n const keyCode = KeyCode[$event.which];\n if (keyCode) {\n if (this.keyDownFn($event) === false) {\n return;\n }\n this.handleKeyCode($event);\n } else if ($event.key && $event.key.length === 1) {\n this._keyPress$.next($event.key.toLocaleLowerCase());\n }\n }\n handleKeyCode($event) {\n const target = $event.target;\n if (this.clearButton && this.clearButton.nativeElement === target) {\n this.handleKeyCodeClear($event);\n } else {\n this.handleKeyCodeInput($event);\n }\n }\n handleKeyCodeInput($event) {\n switch ($event.which) {\n case KeyCode.ArrowDown:\n this._handleArrowDown($event);\n break;\n case KeyCode.ArrowUp:\n this._handleArrowUp($event);\n break;\n case KeyCode.Space:\n this._handleSpace($event);\n break;\n case KeyCode.Enter:\n this._handleEnter($event);\n break;\n case KeyCode.Tab:\n this._handleTab($event);\n break;\n case KeyCode.Esc:\n this.close();\n $event.preventDefault();\n break;\n case KeyCode.Backspace:\n this._handleBackspace();\n break;\n }\n }\n handleKeyCodeClear($event) {\n switch ($event.which) {\n case KeyCode.Enter:\n this.handleClearClick();\n $event.preventDefault();\n break;\n }\n }\n handleMousedown($event) {\n if (this.preventToggleOnRightClick && $event.button === 2) {\n return false;\n }\n const target = $event.target;\n if (target.tagName !== 'INPUT') {\n $event.preventDefault();\n }\n if (target.classList.contains('ng-clear-wrapper')) {\n this.handleClearClick();\n return;\n }\n if (target.classList.contains('ng-arrow-wrapper')) {\n this.handleArrowClick();\n return;\n }\n if (target.classList.contains('ng-value-icon')) {\n return;\n }\n if (!this.focused) {\n this.focus();\n }\n if (this.searchable) {\n this.open();\n } else {\n this.toggle();\n }\n }\n handleArrowClick() {\n if (this.isOpen) {\n this.close();\n } else {\n this.open();\n }\n }\n handleClearClick() {\n if (this.hasValue) {\n this.itemsList.clearSelected(true);\n this._updateNgModel();\n }\n this._clearSearch();\n this.focus();\n this.clearEvent.emit();\n this._onSelectionChanged();\n }\n clearModel() {\n if (!this.clearable) {\n return;\n }\n this.itemsList.clearSelected();\n this._updateNgModel();\n }\n writeValue(value) {\n this.itemsList.clearSelected();\n this._handleWriteValue(value);\n this._cd.markForCheck();\n }\n registerOnChange(fn) {\n this._onChange = fn;\n }\n registerOnTouched(fn) {\n this._onTouched = fn;\n }\n setDisabledState(state) {\n this._disabled = state;\n this._cd.markForCheck();\n }\n toggle() {\n if (!this.isOpen) {\n this.open();\n } else {\n this.close();\n }\n }\n open() {\n if (this.disabled || this.isOpen || this._manualOpen) {\n return;\n }\n if (!this._isTypeahead && !this.addTag && this.itemsList.noItemsToSelect) {\n return;\n }\n this.isOpen = true;\n this.itemsList.markSelectedOrDefault(this.markFirst);\n this.openEvent.emit();\n if (!this.searchTerm) {\n this.focus();\n }\n this.detectChanges();\n }\n close() {\n if (!this.isOpen || this._manualOpen) {\n return;\n }\n this.isOpen = false;\n this._isComposing = false;\n if (!this._editableSearchTerm) {\n this._clearSearch();\n } else {\n this.itemsList.resetFilteredItems();\n }\n this.itemsList.unmarkItem();\n this._onTouched();\n this.closeEvent.emit();\n this._cd.markForCheck();\n }\n toggleItem(item) {\n if (!item || item.disabled || this.disabled) {\n return;\n }\n if (this.deselectOnClick && item.selected) {\n this.unselect(item);\n } else {\n this.select(item);\n }\n if (this._editableSearchTerm) {\n this._setSearchTermFromItems();\n }\n this._onSelectionChanged();\n }\n select(item) {\n if (!item.selected) {\n this.itemsList.select(item);\n if (this.clearSearchOnAdd && !this._editableSearchTerm) {\n this._clearSearch();\n }\n this._updateNgModel();\n if (this.multiple) {\n this.addEvent.emit(item.value);\n }\n }\n if (this.closeOnSelect || this.itemsList.noItemsToSelect) {\n this.close();\n }\n }\n focus() {\n this.searchInput.nativeElement.focus();\n }\n blur() {\n this.searchInput.nativeElement.blur();\n }\n unselect(item) {\n if (!item) {\n return;\n }\n this.itemsList.unselect(item);\n this.focus();\n this._updateNgModel();\n this.removeEvent.emit(item.value);\n }\n selectTag() {\n let tag;\n if (isFunction(this.addTag)) {\n tag = this.addTag(this.searchTerm);\n } else {\n tag = this._primitive ? this.searchTerm : {\n [this.bindLabel]: this.searchTerm\n };\n }\n const handleTag = item => this._isTypeahead || !this.isOpen ? this.itemsList.mapItem(item, null) : this.itemsList.addItem(item);\n if (isPromise(tag)) {\n tag.then(item => this.select(handleTag(item))).catch(() => {});\n } else if (tag) {\n this.select(handleTag(tag));\n }\n }\n showClear() {\n return this.clearable && (this.hasValue || this.searchTerm) && !this.disabled;\n }\n focusOnClear() {\n this.blur();\n if (this.clearButton) {\n this.clearButton.nativeElement.focus();\n }\n }\n get showAddTag() {\n if (!this._validTerm) {\n return false;\n }\n const term = this.searchTerm.toLowerCase().trim();\n return this.addTag && !this.itemsList.filteredItems.some(x => x.label.toLowerCase() === term) && (!this.hideSelected && this.isOpen || !this.selectedItems.some(x => x.label.toLowerCase() === term)) && !this.loading;\n }\n showNoItemsFound() {\n const empty = this.itemsList.filteredItems.length === 0;\n return (empty && !this._isTypeahead && !this.loading || empty && this._isTypeahead && this._validTerm && !this.loading) && !this.showAddTag;\n }\n showTypeToSearch() {\n const empty = this.itemsList.filteredItems.length === 0;\n return empty && this._isTypeahead && !this._validTerm && !this.loading;\n }\n onCompositionStart() {\n this._isComposing = true;\n }\n onCompositionEnd(term) {\n this._isComposing = false;\n if (this.searchWhileComposing) {\n return;\n }\n this.filter(term);\n }\n filter(term) {\n if (this._isComposing && !this.searchWhileComposing) {\n return;\n }\n this.searchTerm = term;\n if (this._isTypeahead && (this._validTerm || this.minTermLength === 0)) {\n this.typeahead.next(term);\n }\n if (!this._isTypeahead) {\n this.itemsList.filter(this.searchTerm);\n if (this.isOpen) {\n this.itemsList.markSelectedOrDefault(this.markFirst);\n }\n }\n this.searchEvent.emit({\n term,\n items: this.itemsList.filteredItems.map(x => x.value)\n });\n this.open();\n }\n onInputFocus($event) {\n if (this.focused) {\n return;\n }\n if (this._editableSearchTerm) {\n this._setSearchTermFromItems();\n }\n this.element.classList.add('ng-select-focused');\n this.focusEvent.emit($event);\n this.focused = true;\n }\n onInputBlur($event) {\n this.element.classList.remove('ng-select-focused');\n this.blurEvent.emit($event);\n if (!this.isOpen && !this.disabled) {\n this._onTouched();\n }\n if (this._editableSearchTerm) {\n this._setSearchTermFromItems();\n }\n this.focused = false;\n }\n onItemHover(item) {\n if (item.disabled) {\n return;\n }\n this.itemsList.markItem(item);\n }\n detectChanges() {\n if (!this._cd.destroyed) {\n this._cd.detectChanges();\n }\n }\n _setSearchTermFromItems() {\n const selected = this.selectedItems && this.selectedItems[0];\n this.searchTerm = selected && selected.label || null;\n }\n _setItems(items) {\n const firstItem = items[0];\n this.bindLabel = this.bindLabel || this._defaultLabel;\n this._primitive = isDefined(firstItem) ? !isObject(firstItem) : this._primitive || this.bindLabel === this._defaultLabel;\n this.itemsList.setItems(items);\n if (items.length > 0 && this.hasValue) {\n this.itemsList.mapSelectedItems();\n }\n if (this.isOpen && isDefined(this.searchTerm) && !this._isTypeahead) {\n this.itemsList.filter(this.searchTerm);\n }\n if (this._isTypeahead || this.isOpen) {\n this.itemsList.markSelectedOrDefault(this.markFirst);\n }\n }\n _setItemsFromNgOptions() {\n const mapNgOptions = options => {\n this.items = options.map(option => ({\n $ngOptionValue: option.value,\n $ngOptionLabel: option.elementRef.nativeElement.innerHTML,\n disabled: option.disabled\n }));\n this.itemsList.setItems(this.items);\n if (this.hasValue) {\n this.itemsList.mapSelectedItems();\n }\n this.detectChanges();\n };\n const handleOptionChange = () => {\n const changedOrDestroyed = merge(this.ngOptions.changes, this._destroy$);\n merge(...this.ngOptions.map(option => option.stateChange$)).pipe(takeUntil(changedOrDestroyed)).subscribe(option => {\n const item = this.itemsList.findItem(option.value);\n item.disabled = option.disabled;\n item.label = option.label || item.label;\n this._cd.detectChanges();\n });\n };\n this.ngOptions.changes.pipe(startWith(this.ngOptions), takeUntil(this._destroy$)).subscribe(options => {\n this.bindLabel = this._defaultLabel;\n mapNgOptions(options);\n handleOptionChange();\n });\n }\n _isValidWriteValue(value) {\n if (!isDefined(value) || this.multiple && value === '' || Array.isArray(value) && value.length === 0) {\n return false;\n }\n const validateBinding = item => {\n if (!isDefined(this.compareWith) && isObject(item) && this.bindValue) {\n this._console.warn(`Setting object(${JSON.stringify(item)}) as your model with bindValue is not allowed unless [compareWith] is used.`);\n return false;\n }\n return true;\n };\n if (this.multiple) {\n if (!Array.isArray(value)) {\n this._console.warn('Multiple select ngModel should be array.');\n return false;\n }\n return value.every(item => validateBinding(item));\n } else {\n return validateBinding(value);\n }\n }\n _handleWriteValue(ngModel) {\n if (!this._isValidWriteValue(ngModel)) {\n return;\n }\n const select = val => {\n let item = this.itemsList.findItem(val);\n if (item) {\n this.itemsList.select(item);\n } else {\n const isValObject = isObject(val);\n const isPrimitive = !isValObject && !this.bindValue;\n if (isValObject || isPrimitive) {\n this.itemsList.select(this.itemsList.mapItem(val, null));\n } else if (this.bindValue) {\n item = {\n [this.bindLabel]: null,\n [this.bindValue]: val\n };\n this.itemsList.select(this.itemsList.mapItem(item, null));\n }\n }\n };\n if (this.multiple) {\n ngModel.forEach(item => select(item));\n } else {\n select(ngModel);\n }\n }\n _handleKeyPresses() {\n if (this.searchable) {\n return;\n }\n this._keyPress$.pipe(takeUntil(this._destroy$), tap(letter => this._pressedKeys.push(letter)), debounceTime(200), filter(() => this._pressedKeys.length > 0), map(() => this._pressedKeys.join(''))).subscribe(term => {\n const item = this.itemsList.findByLabel(term);\n if (item) {\n if (this.isOpen) {\n this.itemsList.markItem(item);\n this._scrollToMarked();\n this._cd.markForCheck();\n } else {\n this.select(item);\n }\n }\n this._pressedKeys = [];\n });\n }\n _setInputAttributes() {\n const input = this.searchInput.nativeElement;\n const attributes = {\n type: 'text',\n autocorrect: 'off',\n autocapitalize: 'off',\n autocomplete: this.labelForId ? 'off' : this.dropdownId,\n ...this.inputAttrs\n };\n for (const key of Object.keys(attributes)) {\n input.setAttribute(key, attributes[key]);\n }\n }\n _updateNgModel() {\n const model = [];\n for (const item of this.selectedItems) {\n if (this.bindValue) {\n let value = null;\n if (item.children) {\n const groupKey = this.groupValue ? this.bindValue : this.groupBy;\n value = item.value[groupKey || this.groupBy];\n } else {\n value = this.itemsList.resolveNested(item.value, this.bindValue);\n }\n model.push(value);\n } else {\n model.push(item.value);\n }\n }\n const selected = this.selectedItems.map(x => x.value);\n if (this.multiple) {\n this._onChange(model);\n this.changeEvent.emit(selected);\n } else {\n this._onChange(isDefined(model[0]) ? model[0] : null);\n this.changeEvent.emit(selected[0]);\n }\n this._cd.markForCheck();\n }\n _clearSearch() {\n if (!this.searchTerm) {\n return;\n }\n this._changeSearch(null);\n this.itemsList.resetFilteredItems();\n }\n _changeSearch(searchTerm) {\n this.searchTerm = searchTerm;\n if (this._isTypeahead) {\n this.typeahead.next(searchTerm);\n }\n }\n _scrollToMarked() {\n if (!this.isOpen || !this.dropdownPanel) {\n return;\n }\n this.dropdownPanel.scrollTo(this.itemsList.markedItem);\n }\n _scrollToTag() {\n if (!this.isOpen || !this.dropdownPanel) {\n return;\n }\n this.dropdownPanel.scrollToTag();\n }\n _onSelectionChanged() {\n if (this.isOpen && this.deselectOnClick && this.appendTo) {\n // Make sure items are rendered.\n this._cd.detectChanges();\n this.dropdownPanel.adjustPosition();\n }\n }\n _handleTab($event) {\n if (this.isOpen === false) {\n if (this.showClear() && !$event.shiftKey) {\n this.focusOnClear();\n $event.preventDefault();\n } else if (!this.addTag) {\n return;\n }\n }\n if (this.selectOnTab) {\n if (this.itemsList.markedItem) {\n this.toggleItem(this.itemsList.markedItem);\n $event.preventDefault();\n } else if (this.showAddTag) {\n this.selectTag();\n $event.preventDefault();\n } else {\n this.close();\n }\n } else {\n this.close();\n }\n }\n _handleEnter($event) {\n if (this.isOpen || this._manualOpen) {\n if (this.itemsList.markedItem) {\n this.toggleItem(this.itemsList.markedItem);\n } else if (this.showAddTag) {\n this.selectTag();\n }\n } else if (this.openOnEnter) {\n this.open();\n } else {\n return;\n }\n $event.preventDefault();\n }\n _handleSpace($event) {\n if (this.isOpen || this._manualOpen) {\n return;\n }\n this.open();\n $event.preventDefault();\n }\n _handleArrowDown($event) {\n if (this._nextItemIsTag(+1)) {\n this.itemsList.unmarkItem();\n this._scrollToTag();\n } else {\n this.itemsList.markNextItem();\n this._scrollToMarked();\n }\n this.open();\n $event.preventDefault();\n }\n _handleArrowUp($event) {\n if (!this.isOpen) {\n return;\n }\n if (this._nextItemIsTag(-1)) {\n this.itemsList.unmarkItem();\n this._scrollToTag();\n } else {\n this.itemsList.markPreviousItem();\n this._scrollToMarked();\n }\n $event.preventDefault();\n }\n _nextItemIsTag(nextStep) {\n const nextIndex = this.itemsList.markedIndex + nextStep;\n return this.addTag && this.searchTerm && this.itemsList.markedItem && (nextIndex < 0 || nextIndex === this.itemsList.filteredItems.length);\n }\n _handleBackspace() {\n if (this.searchTerm || !this.clearable || !this.clearOnBackspace || !this.hasValue) {\n return;\n }\n if (this.multiple) {\n this.unselect(this.itemsList.lastSelectedItem);\n } else {\n this.clearModel();\n }\n }\n get _isTypeahead() {\n return this.typeahead && this.typeahead.observers.length > 0;\n }\n get _validTerm() {\n const term = this.searchTerm && this.searchTerm.trim();\n return term && term.length >= this.minTermLength;\n }\n _mergeGlobalConfig(config) {\n this.placeholder = this.placeholder || config.placeholder;\n this.notFoundText = this.notFoundText || config.notFoundText;\n this.typeToSearchText = this.typeToSearchText || config.typeToSearchText;\n this.addTagText = this.addTagText || config.addTagText;\n this.loadingText = this.loadingText || config.loadingText;\n this.clearAllText = this.clearAllText || config.clearAllText;\n this.virtualScroll = isDefined(this.virtualScroll) ? this.virtualScroll : isDefined(config.disableVirtualScroll) ? !config.disableVirtualScroll : false;\n this.openOnEnter = isDefined(this.openOnEnter) ? this.openOnEnter : config.openOnEnter;\n this.appendTo = this.appendTo || config.appendTo;\n this.bindValue = this.bindValue || config.bindValue;\n this.bindLabel = this.bindLabel || config.bindLabel;\n this.appearance = this.appearance || config.appearance;\n }\n static {\n this.ɵfac = function NgSelectComponent_Factory(ɵt) {\n return new (ɵt || NgSelectComponent)(i0.ɵɵinjectAttribute('class'), i0.ɵɵinjectAttribute('autofocus'), i0.ɵɵdirectiveInject(NgSelectConfig), i0.ɵɵdirectiveInject(SELECTION_MODEL_FACTORY), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(ConsoleService));\n };\n }\n static {\n this.ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: NgSelectComponent,\n selectors: [[\"ng-select\"]],\n contentQueries: function NgSelectComponent_ContentQueries(rf, ctx, dirIndex) {\n if (rf & 1) {\n i0.ɵɵcontentQuery(dirIndex, NgOptionTemplateDirective, 5, TemplateRef);\n i0.ɵɵcontentQuery(dirIndex, NgOptgroupTemplateDirective, 5, TemplateRef);\n i0.ɵɵcontentQuery(dirIndex, NgLabelTemplateDirective, 5, TemplateRef);\n i0.ɵɵcontentQuery(dirIndex, NgMultiLabelTemplateDirective, 5, TemplateRef);\n i0.ɵɵcontentQuery(dirIndex, NgHeaderTemplateDirective, 5, TemplateRef);\n i0.ɵɵcontentQuery(dirIndex, NgFooterTemplateDirective, 5, TemplateRef);\n i0.ɵɵcontentQuery(dirIndex, NgNotFoundTemplateDirective, 5, TemplateRef);\n i0.ɵɵcontentQuery(dirIndex, NgTypeToSearchTemplateDirective, 5, TemplateRef);\n i0.ɵɵcontentQuery(dirIndex, NgLoadingTextTemplateDirective, 5, TemplateRef);\n i0.ɵɵcontentQuery(dirIndex, NgTagTemplateDirective, 5, TemplateRef);\n i0.ɵɵcontentQuery(dirIndex, NgLoadingSpinnerTemplateDirective, 5, TemplateRef);\n i0.ɵɵcontentQuery(dirIndex, NgOptionComponent, 5);\n }\n if (rf & 2) {\n let _t;\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.optionTemplate = _t.first);\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.optgroupTemplate = _t.first);\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.labelTemplate = _t.first);\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.multiLabelTemplate = _t.first);\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.headerTemplate = _t.first);\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.footerTemplate = _t.first);\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.notFoundTemplate = _t.first);\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.typeToSearchTemplate = _t.first);\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.loadingTextTemplate = _t.first);\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.tagTemplate = _t.first);\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.loadingSpinnerTemplate = _t.first);\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.ngOptions = _t);\n }\n },\n viewQuery: function NgSelectComponent_Query(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵviewQuery(NgDropdownPanelComponent, 5);\n i0.ɵɵviewQuery(_c5, 7);\n i0.ɵɵviewQuery(_c6, 5);\n }\n if (rf & 2) {\n let _t;\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.dropdownPanel = _t.first);\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.searchInput = _t.first);\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.clearButton = _t.first);\n }\n },\n hostVars: 20,\n hostBindings: function NgSelectComponent_HostBindings(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵlistener(\"keydown\", function NgSelectComponent_keydown_HostBindingHandler($event) {\n return ctx.handleKeyDown($event);\n });\n }\n if (rf & 2) {\n i0.ɵɵclassProp(\"ng-select-typeahead\", ctx.typeahead)(\"ng-select-multiple\", ctx.multiple)(\"ng-select-taggable\", ctx.addTag)(\"ng-select-searchable\", ctx.searchable)(\"ng-select-clearable\", ctx.clearable)(\"ng-select-opened\", ctx.isOpen)(\"ng-select\", ctx.useDefaultClass)(\"ng-select-disabled\", ctx.disabled)(\"ng-select-filtered\", ctx.filtered)(\"ng-select-single\", ctx.single);\n }\n },\n inputs: {\n bindLabel: \"bindLabel\",\n bindValue: \"bindValue\",\n markFirst: [2, \"markFirst\", \"markFirst\", booleanAttribute],\n placeholder: \"placeholder\",\n notFoundText: \"notFoundText\",\n typeToSearchText: \"typeToSearchText\",\n preventToggleOnRightClick: \"preventToggleOnRightClick\",\n addTagText: \"addTagText\",\n loadingText: \"loadingText\",\n clearAllText: \"clearAllText\",\n appearance: \"appearance\",\n dropdownPosition: \"dropdownPosition\",\n appendTo: \"appendTo\",\n loading: [2, \"loading\", \"loading\", booleanAttribute],\n closeOnSelect: [2, \"closeOnSelect\", \"closeOnSelect\", booleanAttribute],\n hideSelected: [2, \"hideSelected\", \"hideSelected\", booleanAttribute],\n selectOnTab: [2, \"selectOnTab\", \"selectOnTab\", booleanAttribute],\n openOnEnter: [2, \"openOnEnter\", \"openOnEnter\", booleanAttribute],\n maxSelectedItems: [2, \"maxSelectedItems\", \"maxSelectedItems\", numberAttribute],\n groupBy: \"groupBy\",\n groupValue: \"groupValue\",\n bufferAmount: [2, \"bufferAmount\", \"bufferAmount\", numberAttribute],\n virtualScroll: [2, \"virtualScroll\", \"virtualScroll\", booleanAttribute],\n selectableGroup: [2, \"selectableGroup\", \"selectableGroup\", booleanAttribute],\n selectableGroupAsModel: [2, \"selectableGroupAsModel\", \"selectableGroupAsModel\", booleanAttribute],\n searchFn: \"searchFn\",\n trackByFn: \"trackByFn\",\n clearOnBackspace: [2, \"clearOnBackspace\", \"clearOnBackspace\", booleanAttribute],\n labelForId: \"labelForId\",\n inputAttrs: \"inputAttrs\",\n tabIndex: [2, \"tabIndex\", \"tabIndex\", numberAttribute],\n readonly: [2, \"readonly\", \"readonly\", booleanAttribute],\n searchWhileComposing: [2, \"searchWhileComposing\", \"searchWhileComposing\", booleanAttribute],\n minTermLength: [2, \"minTermLength\", \"minTermLength\", numberAttribute],\n editableSearchTerm: [2, \"editableSearchTerm\", \"editableSearchTerm\", booleanAttribute],\n keyDownFn: \"keyDownFn\",\n ngClass: \"ngClass\",\n typeahead: \"typeahead\",\n multiple: [2, \"multiple\", \"multiple\", booleanAttribute],\n addTag: \"addTag\",\n searchable: [2, \"searchable\", \"searchable\", booleanAttribute],\n clearable: [2, \"clearable\", \"clearable\", booleanAttribute],\n isOpen: \"isOpen\",\n items: \"items\",\n compareWith: \"compareWith\",\n clearSearchOnAdd: \"clearSearchOnAdd\",\n deselectOnClick: \"deselectOnClick\"\n },\n outputs: {\n blurEvent: \"blur\",\n focusEvent: \"focus\",\n changeEvent: \"change\",\n openEvent: \"open\",\n closeEvent: \"close\",\n searchEvent: \"search\",\n clearEvent: \"clear\",\n addEvent: \"add\",\n removeEvent: \"remove\",\n scroll: \"scroll\",\n scrollToEnd: \"scrollToEnd\"\n },\n features: [i0.ɵɵProvidersFeature([{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => NgSelectComponent),\n multi: true\n }, NgDropdownPanelService]), i0.ɵɵInputTransformsFeature, i0.ɵɵNgOnChangesFeature],\n decls: 14,\n vars: 19,\n consts: [[\"searchInput\", \"\"], [\"defaultLabelTemplate\", \"\"], [\"defaultLoadingSpinnerTemplate\", \"\"], [\"clearButton\", \"\"], [\"defaultOptionTemplate\", \"\"], [\"defaultTagTemplate\", \"\"], [\"defaultNotFoundTemplate\", \"\"], [\"defaultTypeToSearchTemplate\", \"\"], [\"defaultLoadingTextTemplate\", \"\"], [1, \"ng-select-container\", 3, \"mousedown\"], [1, \"ng-value-container\"], [1, \"ng-placeholder\"], [3, \"ngTemplateOutlet\", \"ngTemplateOutletContext\"], [\"role\", \"combobox\", \"aria-haspopup\", \"listbox\", 1, \"ng-input\"], [\"aria-autocomplete\", \"list\", 3, \"input\", \"compositionstart\", \"compositionend\", \"focus\", \"blur\", \"change\", \"readOnly\", \"disabled\", \"value\"], [\"tabindex\", \"0\", 1, \"ng-clear-wrapper\", 3, \"title\"], [1, \"ng-arrow-wrapper\"], [1, \"ng-arrow\"], [\"role\", \"listbox\", \"aria-label\", \"Options list\", 3, \"class\", \"virtualScroll\", \"bufferAmount\", \"appendTo\", \"position\", \"headerTemplate\", \"footerTemplate\", \"filterValue\", \"items\", \"markedItem\", \"ng-select-multiple\", \"ngClass\", \"id\"], [1, \"ng-value\", 3, \"ng-value-disabled\"], [1, \"ng-value\"], [\"aria-hidden\", \"true\", 1, \"ng-value-icon\", \"left\", 3, \"click\"], [1, \"ng-value-label\", 3, \"ngItemLabel\", \"escape\"], [3, \"ngTemplateOutlet\"], [1, \"ng-spinner-loader\"], [\"aria-hidden\", \"true\", 1, \"ng-clear\"], [\"role\", \"listbox\", \"aria-label\", \"Options list\", 3, \"update\", \"scroll\", \"scrollToEnd\", \"outsideClick\", \"virtualScroll\", \"bufferAmount\", \"appendTo\", \"position\", \"headerTemplate\", \"footerTemplate\", \"filterValue\", \"items\", \"markedItem\", \"ngClass\", \"id\"], [1, \"ng-option\", 3, \"ng-option-disabled\", \"ng-option-selected\", \"ng-optgroup\", \"ng-option\", \"ng-option-child\", \"ng-option-marked\"], [\"role\", \"option\", 1, \"ng-option\", 3, \"ng-option-marked\"], [1, \"ng-option\", 3, \"click\", \"mouseover\"], [1, \"ng-option-label\", 3, \"ngItemLabel\", \"escape\"], [\"role\", \"option\", 1, \"ng-option\", 3, \"mouseover\", \"click\"], [1, \"ng-tag-label\"], [1, \"ng-option\", \"ng-option-disabled\"]],\n template: function NgSelectComponent_Template(rf, ctx) {\n if (rf & 1) {\n const _r1 = i0.ɵɵgetCurrentView();\n i0.ɵɵelementStart(0, \"div\", 9);\n i0.ɵɵlistener(\"mousedown\", function NgSelectComponent_Template_div_mousedown_0_listener($event) {\n i0.ɵɵrestoreView(_r1);\n return i0.ɵɵresetView(ctx.handleMousedown($event));\n });\n i0.ɵɵelementStart(1, \"div\", 10)(2, \"div\", 11);\n i0.ɵɵtext(3);\n i0.ɵɵelementEnd();\n i0.ɵɵtemplate(4, NgSelectComponent_Conditional_4_Template, 2, 0)(5, NgSelectComponent_Conditional_5_Template, 1, 5, null, 12);\n i0.ɵɵelementStart(6, \"div\", 13)(7, \"input\", 14, 0);\n i0.ɵɵlistener(\"input\", function NgSelectComponent_Template_input_input_7_listener() {\n i0.ɵɵrestoreView(_r1);\n const searchInput_r6 = i0.ɵɵreference(8);\n return i0.ɵɵresetView(ctx.filter(searchInput_r6.value));\n })(\"compositionstart\", function NgSelectComponent_Template_input_compositionstart_7_listener() {\n i0.ɵɵrestoreView(_r1);\n return i0.ɵɵresetView(ctx.onCompositionStart());\n })(\"compositionend\", function NgSelectComponent_Template_input_compositionend_7_listener() {\n i0.ɵɵrestoreView(_r1);\n const searchInput_r6 = i0.ɵɵreference(8);\n return i0.ɵɵresetView(ctx.onCompositionEnd(searchInput_r6.value));\n })(\"focus\", function NgSelectComponent_Template_input_focus_7_listener($event) {\n i0.ɵɵrestoreView(_r1);\n return i0.ɵɵresetView(ctx.onInputFocus($event));\n })(\"blur\", function NgSelectComponent_Template_input_blur_7_listener($event) {\n i0.ɵɵrestoreView(_r1);\n return i0.ɵɵresetView(ctx.onInputBlur($event));\n })(\"change\", function NgSelectComponent_Template_input_change_7_listener($event) {\n i0.ɵɵrestoreView(_r1);\n return i0.ɵɵresetView($event.stopPropagation());\n });\n i0.ɵɵelementEnd()()();\n i0.ɵɵtemplate(9, NgSelectComponent_Conditional_9_Template, 3, 1)(10, NgSelectComponent_Conditional_10_Template, 4, 1, \"span\", 15);\n i0.ɵɵelementStart(11, \"span\", 16);\n i0.ɵɵelement(12, \"span\", 17);\n i0.ɵɵelementEnd()();\n i0.ɵɵtemplate(13, NgSelectComponent_Conditional_13_Template, 8, 19, \"ng-dropdown-panel\", 18);\n }\n if (rf & 2) {\n i0.ɵɵclassProp(\"ng-appearance-outline\", ctx.appearance === \"outline\")(\"ng-has-value\", ctx.hasValue);\n i0.ɵɵadvance(3);\n i0.ɵɵtextInterpolate(ctx.placeholder);\n i0.ɵɵadvance();\n i0.ɵɵconditional((!ctx.multiLabelTemplate || !ctx.multiple) && ctx.selectedItems.length > 0 ? 4 : -1);\n i0.ɵɵadvance();\n i0.ɵɵconditional(ctx.multiple && ctx.multiLabelTemplate && ctx.selectedValues.length > 0 ? 5 : -1);\n i0.ɵɵadvance();\n i0.ɵɵattribute(\"aria-expanded\", ctx.isOpen)(\"aria-owns\", ctx.isOpen ? ctx.dropdownId : null);\n i0.ɵɵadvance();\n i0.ɵɵproperty(\"readOnly\", !ctx.searchable || ctx.itemsList.maxItemsSelected)(\"disabled\", ctx.disabled)(\"value\", ctx.searchTerm ? ctx.searchTerm : \"\");\n i0.ɵɵattribute(\"id\", ctx.labelForId)(\"tabindex\", ctx.tabIndex)(\"aria-activedescendant\", ctx.isOpen ? ctx.itemsList == null ? null : ctx.itemsList.markedItem == null ? null : ctx.itemsList.markedItem.htmlId : null)(\"aria-controls\", ctx.isOpen ? ctx.dropdownId : null);\n i0.ɵɵadvance(2);\n i0.ɵɵconditional(ctx.loading ? 9 : -1);\n i0.ɵɵadvance();\n i0.ɵɵconditional(ctx.showClear() ? 10 : -1);\n i0.ɵɵadvance(3);\n i0.ɵɵconditional(ctx.isOpen ? 13 : -1);\n }\n },\n dependencies: [i3.NgClass, i3.NgTemplateOutlet, NgDropdownPanelComponent, NgItemLabelDirective],\n styles: [\"@charset \\\"UTF-8\\\";.ng-select{position:relative;display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.ng-select div,.ng-select input,.ng-select span{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.ng-select [hidden]{display:none}.ng-select.ng-select-searchable .ng-select-container .ng-value-container .ng-input{opacity:1}.ng-select.ng-select-opened .ng-select-container{z-index:1001}.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-placeholder,.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-value{-webkit-user-select:none;user-select:none;cursor:default}.ng-select.ng-select-disabled .ng-arrow-wrapper{cursor:default}.ng-select.ng-select-filtered .ng-placeholder{display:none}.ng-select .ng-select-container{cursor:default;display:flex;outline:none;overflow:hidden;position:relative;width:100%}.ng-select .ng-select-container .ng-value-container{display:flex;flex:1}.ng-select .ng-select-container .ng-value-container .ng-input{opacity:0}.ng-select .ng-select-container .ng-value-container .ng-input>input{box-sizing:content-box;background:none transparent;border:0 none;box-shadow:none;outline:none;padding:0;cursor:default;width:100%}.ng-select .ng-select-container .ng-value-container .ng-input>input::-ms-clear{display:none}.ng-select .ng-select-container .ng-value-container .ng-input>input[readonly]{-webkit-user-select:none;user-select:none;width:0;padding:0}.ng-select.ng-select-single.ng-select-filtered .ng-select-container .ng-value-container .ng-value{visibility:hidden}.ng-select.ng-select-single .ng-select-container .ng-value-container,.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-input{position:absolute;left:0;width:100%}.ng-select.ng-select-multiple.ng-select-disabled>.ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container{flex-wrap:wrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{position:absolute}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{white-space:nowrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value.ng-value-disabled .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon{cursor:pointer}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-input{flex:1;z-index:2}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{z-index:1}.ng-select .ng-clear-wrapper{cursor:pointer;position:relative;width:17px;-webkit-user-select:none;user-select:none}.ng-select .ng-clear-wrapper .ng-clear{display:inline-block;font-size:18px;line-height:1;pointer-events:none}.ng-select .ng-spinner-loader{border-radius:50%;width:17px;height:17px;margin-right:5px;font-size:10px;position:relative;text-indent:-9999em;border-top:2px solid rgba(66,66,66,.2);border-right:2px solid rgba(66,66,66,.2);border-bottom:2px solid rgba(66,66,66,.2);border-left:2px solid #424242;transform:translateZ(0);animation:load8 .8s infinite linear}.ng-select .ng-spinner-loader:after{border-radius:50%;width:17px;height:17px}@-webkit-keyframes load8{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes load8{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.ng-select .ng-arrow-wrapper{cursor:pointer;position:relative;text-align:center;-webkit-user-select:none;user-select:none}.ng-select .ng-arrow-wrapper .ng-arrow{pointer-events:none;display:inline-block;height:0;width:0;position:relative}.ng-dropdown-panel{box-sizing:border-box;position:absolute;opacity:0;width:100%;z-index:1050;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .ng-dropdown-panel-items{display:block;height:auto;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;max-height:240px;overflow-y:auto}.ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option{box-sizing:border-box;cursor:pointer;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option .ng-option-label:empty:before{content:\\\"\\\\200b\\\"}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option .highlighted{font-weight:700;text-decoration:underline}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option.disabled{cursor:default}.ng-dropdown-panel .scroll-host{overflow:hidden;overflow-y:auto;position:relative;display:block;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .scrollable-content{top:0;left:0;width:100%;height:100%;position:absolute}.ng-dropdown-panel .total-padding{width:1px;opacity:0}\\n\"],\n encapsulation: 2,\n changeDetection: 0\n });\n }\n }\n return NgSelectComponent;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction DefaultSelectionModelFactory() {\n return new DefaultSelectionModel();\n}\nclass DefaultSelectionModel {\n constructor() {\n this._selected = [];\n }\n get value() {\n return this._selected;\n }\n select(item, multiple, groupAsModel) {\n item.selected = true;\n if (!item.children || !multiple && groupAsModel) {\n this._selected.push(item);\n }\n if (multiple) {\n if (item.parent) {\n const childrenCount = item.parent.children.length;\n const selectedCount = item.parent.children.filter(x => x.selected).length;\n item.parent.selected = childrenCount === selectedCount;\n } else if (item.children) {\n this._setChildrenSelectedState(item.children, true);\n this._removeChildren(item);\n if (groupAsModel && this._activeChildren(item)) {\n this._selected = [...this._selected.filter(x => x.parent !== item), item];\n } else {\n this._selected = [...this._selected, ...item.children.filter(x => !x.disabled)];\n }\n }\n }\n }\n unselect(item, multiple) {\n this._selected = this._selected.filter(x => x !== item);\n item.selected = false;\n if (multiple) {\n if (item.parent && item.parent.selected) {\n const children = item.parent.children;\n this._removeParent(item.parent);\n this._removeChildren(item.parent);\n this._selected.push(...children.filter(x => x !== item && !x.disabled));\n item.parent.selected = false;\n } else if (item.children) {\n this._setChildrenSelectedState(item.children, false);\n this._removeChildren(item);\n }\n }\n }\n clear(keepDisabled) {\n this._selected = keepDisabled ? this._selected.filter(x => x.disabled) : [];\n }\n _setChildrenSelectedState(children, selected) {\n for (const child of children) {\n if (child.disabled) {\n continue;\n }\n child.selected = selected;\n }\n }\n _removeChildren(parent) {\n this._selected = [...this._selected.filter(x => x.parent !== parent), ...parent.children.filter(x => x.parent === parent && x.disabled && x.selected)];\n }\n _removeParent(parent) {\n this._selected = this._selected.filter(x => x !== parent);\n }\n _activeChildren(item) {\n return item.children.every(x => !x.disabled || x.selected);\n }\n}\nlet NgSelectModule = /*#__PURE__*/(() => {\n class NgSelectModule {\n static {\n this.ɵfac = function NgSelectModule_Factory(ɵt) {\n return new (ɵt || NgSelectModule)();\n };\n }\n static {\n this.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: NgSelectModule\n });\n }\n static {\n this.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n providers: [{\n provide: SELECTION_MODEL_FACTORY,\n useValue: DefaultSelectionModelFactory\n }],\n imports: [CommonModule]\n });\n }\n }\n return NgSelectModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/*\n * Public API Surface of ng-select\n */\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { ConsoleService, DefaultSelectionModel, DefaultSelectionModelFactory, NgDropdownPanelComponent, NgDropdownPanelService, NgFooterTemplateDirective, NgHeaderTemplateDirective, NgItemLabelDirective, NgLabelTemplateDirective, NgLoadingSpinnerTemplateDirective, NgLoadingTextTemplateDirective, NgMultiLabelTemplateDirective, NgNotFoundTemplateDirective, NgOptgroupTemplateDirective, NgOptionComponent, NgOptionTemplateDirective, NgSelectComponent, NgSelectConfig, NgSelectModule, NgTagTemplateDirective, NgTypeToSearchTemplateDirective, SELECTION_MODEL_FACTORY };\n","import { HttpErrorResponse } from '@angular/common/http';\r\nimport { Component, Input, OnInit } from '@angular/core';\r\nimport { UntypedFormGroup } from '@angular/forms';\r\nimport { BrandResultDto } from 'src/app/core/dtos/brand';\r\nimport { BrandService } from 'src/app/core/services/customer/brand.service';\r\nimport { MessageService } from 'src/app/core/services/message';\r\nimport { httpErrorResponseUtil } from 'src/app/core/utils';\r\n\r\n@Component({\r\n selector: 'app-form-select-brands',\r\n templateUrl: './form-select-brands.component.html',\r\n styleUrls: ['./form-select-brands.component.scss'],\r\n})\r\nexport class FormSelectBrandsComponent implements OnInit {\r\n @Input() brandForm!: UntypedFormGroup;\r\n @Input() required?: boolean;\r\n customerBrands: BrandResultDto[] = [];\r\n constructor(\r\n private brandService: BrandService,\r\n private messageService: MessageService\r\n ) {}\r\n\r\n ngOnInit(): void {\r\n this.getCustomerBrands();\r\n }\r\n\r\n getCustomerBrands() {\r\n this.brandService.all().subscribe(\r\n (data: BrandResultDto[]) => {\r\n this.customerBrands = data;\r\n },\r\n (error: HttpErrorResponse) => {\r\n var errorStr = httpErrorResponseUtil(error);\r\n this.messageService.error(errorStr);\r\n }\r\n );\r\n }\r\n}\r\n","\r\n\r\n\r\n\r\n","import { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs';\r\nimport { ApiService } from '../../apis';\r\nimport { ResultDto, SearchDto } from '../../dtos/api';\r\nimport {\r\n CategoryAttributeResultDto,\r\n CreateNewAdvertControlRequestDto,\r\n CreateProductRequestDto,\r\n CurrentInfoFromSiteByproductIdResultDto,\r\n InfoForTrendyolNewAdvertResultDto,\r\n ProductPaginationResponseResultDto,\r\n SearchProductResultDto,\r\n UpdateProductRequestDto,\r\n UpdateProductResultDto,\r\n} from '../../dtos/product';\r\nimport { API_ROUTER_UTILS } from '../../utils';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class ProductService {\r\n constructor(private apiService: ApiService) {}\r\n\r\n create(\r\n createProductRequestDto: CreateProductRequestDto\r\n ): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.products.create,\r\n createProductRequestDto,\r\n null\r\n );\r\n }\r\n\r\n customerProducts(\r\n search: SearchDto\r\n ): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.products.productList,\r\n search,\r\n null\r\n );\r\n }\r\n\r\n customerProductByProductId(\r\n productId: string\r\n ): Observable> {\r\n return this.apiService.get>(\r\n null,\r\n API_ROUTER_UTILS.url.products.productByProductId,\r\n { productId: productId }\r\n );\r\n }\r\n\r\n deleteAllProductAndRelation(): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.batchoperations.deleteAllProductAndRelation,\r\n null,\r\n null\r\n );\r\n }\r\n\r\n categoryAttributesByCategoryId(\r\n categoryId: string\r\n ): Observable> {\r\n return this.apiService.get>(\r\n null,\r\n API_ROUTER_UTILS.url.products.categoryAttributesByCategoryId,\r\n { categoryId: categoryId }\r\n );\r\n }\r\n\r\n createNewAdvertControl(\r\n createNewAdvertControlRequestDto: CreateNewAdvertControlRequestDto\r\n ): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.products.createNewAdvertControl,\r\n createNewAdvertControlRequestDto,\r\n null\r\n );\r\n }\r\n\r\n infoForTrendyolNewAdvertByProdoctId(\r\n productId: string,\r\n storeId: string\r\n ): Observable> {\r\n return this.apiService.get>(\r\n null,\r\n API_ROUTER_UTILS.url.products.infoForTrendyolNewAdvertByProdoctId,\r\n { productId: productId, storeId: storeId }\r\n );\r\n }\r\n\r\n currentInfoFromSiteByProductId(\r\n productId: string,\r\n storeTypeName: string\r\n ): Observable> {\r\n return this.apiService.get<\r\n ResultDto\r\n >(null, API_ROUTER_UTILS.url.products.currentInfoFromSiteByProductId, {\r\n productId: productId,\r\n storeTypeName: storeTypeName,\r\n });\r\n }\r\n\r\n allCurrentInfoFromSite(): Observable<\r\n ResultDto\r\n > {\r\n return this.apiService.get<\r\n ResultDto\r\n >(null, API_ROUTER_UTILS.url.products.allCurrentInfoFromSite);\r\n }\r\n\r\n allSearch(\r\n searchKey: string\r\n ): Observable> {\r\n return this.apiService.get>(\r\n null,\r\n API_ROUTER_UTILS.url.products.allSearch,\r\n { searchKey: searchKey }\r\n );\r\n }\r\n\r\n productByBarcodeOrStockCode(\r\n barcodeOrStockCode: string\r\n ): Observable> {\r\n return this.apiService.get>(\r\n null,\r\n API_ROUTER_UTILS.url.products.productByBarcodeOrStockCode,\r\n { barcodeOrStockCode: barcodeOrStockCode }\r\n );\r\n }\r\n\r\n\r\n updateProductStock(\r\n request: UpdateProductRequestDto\r\n ): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.products.updateProductStock,\r\n request,\r\n null\r\n );\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs';\r\nimport { ApiService } from '../../apis';\r\nimport { ResultDto } from '../../dtos/api';\r\nimport {\r\n CategoryResultDto,\r\n CreateCategoryRequestDto,\r\n CreateCategoryResultDto,\r\n DeleteCategoryResultDto,\r\n TreeCategoryResultDto,\r\n UpdateCategoryRequestDto,\r\n UpdateCategoryResultDto,\r\n} from '../../dtos/category';\r\nimport { API_ROUTER_UTILS } from '../../utils';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class CategoryService {\r\n constructor(private apiService: ApiService) {}\r\n\r\n create(\r\n createCategoryRequestDto: CreateCategoryRequestDto\r\n ): Observable> {\r\n return this.apiService.post>(\r\n API_ROUTER_UTILS.url.categories.create,\r\n createCategoryRequestDto,\r\n null\r\n );\r\n }\r\n\r\n update(\r\n updateCategoryRequestDto: UpdateCategoryRequestDto\r\n ): Observable> {\r\n return this.apiService.post>(\r\n API_ROUTER_UTILS.url.categories.update,\r\n updateCategoryRequestDto,\r\n null\r\n );\r\n }\r\n\r\n delete(categoryId: string): Observable> {\r\n return this.apiService.post>(\r\n API_ROUTER_UTILS.url.categories.delete,\r\n null,\r\n null,\r\n { id: categoryId }\r\n );\r\n }\r\n\r\n forCreateProduct(): Observable> {\r\n return this.apiService.get>(\r\n null,\r\n API_ROUTER_UTILS.url.categories.forCreateProduct\r\n );\r\n }\r\n\r\n tree(): Observable> {\r\n return this.apiService.get>(\r\n null,\r\n API_ROUTER_UTILS.url.categories.tree\r\n );\r\n }\r\n}\r\n","import { Injectable } from \"@angular/core\";\r\nimport { Observable } from \"rxjs\";\r\nimport { ApiService } from \"../../apis\";\r\nimport { PaginationResponseDto, ResultDto, SearchDto } from \"../../dtos/api\";\r\nimport { ProductStockTransactionResultDto } from \"../../dtos/product-stock-transaction\";\r\nimport { API_ROUTER_UTILS } from \"../../utils\";\r\n\r\n@Injectable({\r\n providedIn: \"root\",\r\n})\r\nexport class ProductStockTransactionService {\r\n constructor(private apiService: ApiService) {}\r\n\r\n search(searchDto: SearchDto): Observable>> {\r\n return this.apiService.post>>(\r\n API_ROUTER_UTILS.url.productStockTransactions.search,\r\n searchDto,\r\n null\r\n );\r\n }\r\n\r\n byProductId(productId: string): Observable> {\r\n return this.apiService.get>(\r\n null,\r\n API_ROUTER_UTILS.url.productStockTransactions.byProductId,\r\n { productId: productId }\r\n );\r\n }\r\n}\r\n","import { Observable } from \"rxjs\";\r\nimport { Injectable } from \"@angular/core\";\r\nimport { ApiService } from \"../../apis\";\r\nimport { ResultDto } from \"../../dtos/api\";\r\nimport { API_ROUTER_UTILS } from \"../../utils\";\r\nimport { CreateTrendyolProductRequestDto, TrendyolFilterProductsDto, TrendyolProductRequestDto } from \"../../dtos/trendyol\";\r\nimport { CreateTrendyolAcoountRequestDto } from \"../../dtos/trendyol-account\";\r\nimport { StoreImportRequestDto } from \"../../dtos/store-import\";\r\nimport { TrendyolProductInfoResultDto, TrendyolUpdateProductRequestDto } from \"../../dtos/customer-trendyol\";\r\n\r\n@Injectable({\r\n providedIn: \"root\",\r\n})\r\nexport class CustomerTrendyolService {\r\n constructor(private apiService: ApiService) {}\r\n\r\n createTrendyolStore(data: CreateTrendyolAcoountRequestDto): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.integration.createTrendyolStore,\r\n data,\r\n null,\r\n {}\r\n );\r\n }\r\n\r\n storeImportForProducts(\r\n request: TrendyolProductRequestDto\r\n ): Observable> {\r\n return this.apiService.post>(\r\n API_ROUTER_UTILS.url.batchoperations.storeProductsViewForTrendyol,\r\n request,\r\n null\r\n );\r\n }\r\n\r\n storeImport(request: StoreImportRequestDto): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.batchoperations.storeImportForTrendyol,\r\n request,\r\n null\r\n );\r\n }\r\n\r\n createProduct(\r\n createProductRequest: CreateTrendyolProductRequestDto\r\n ): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.customerTrendyol.createProduct,\r\n createProductRequest,\r\n null\r\n );\r\n }\r\n\r\n byProductId(\r\n trendyolProductId: string\r\n ): Observable> {\r\n return this.apiService.get>(\r\n null,\r\n API_ROUTER_UTILS.url.customerTrendyol.byProductId,\r\n {trendyolProductId: trendyolProductId}\r\n );\r\n }\r\n\r\n updateProduct(\r\n updateProductRequest: TrendyolUpdateProductRequestDto\r\n ): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.customerTrendyol.updateProduct,\r\n updateProductRequest,\r\n null\r\n );\r\n }\r\n\r\n}\r\n","import { Injectable } from \"@angular/core\";\r\nimport { Observable } from \"rxjs\";\r\nimport { ApiService } from \"../../apis\";\r\nimport { ResultDto, SearchDto } from \"../../dtos/api\";\r\nimport { ProductBatchCurrentStatusRequestDto, ProductBatchPaginationReponseDto } from \"../../dtos/product-batch\";\r\nimport { API_ROUTER_UTILS } from \"../../utils\";\r\n\r\n@Injectable({\r\n providedIn: \"root\",\r\n})\r\nexport class ProductBatchOperationService {\r\n constructor(private apiService: ApiService) {}\r\n\r\n postProductBatchs(\r\n search: SearchDto\r\n ): Observable> {\r\n return this.apiService.post>(\r\n API_ROUTER_UTILS.url.batchoperations.postProductBatchsSearch,\r\n search,\r\n null,\r\n {}\r\n );\r\n }\r\n\r\n currentStatus(\r\n request: ProductBatchCurrentStatusRequestDto\r\n ): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.batchoperations.currentStatus,\r\n request,\r\n null,\r\n {}\r\n );\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs';\r\nimport { ApiService } from '../../apis';\r\nimport { ResultDto } from '../../dtos/api';\r\nimport { StoreResultDto } from '../../dtos/store';\r\nimport { API_ROUTER_UTILS } from '../../utils';\r\nimport { StoreImportInfoResultDto } from '../../dtos/store-import';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class CommonStoreService {\r\n constructor(private apiService: ApiService) {}\r\n\r\n customerStores(): Observable> {\r\n return this.apiService.get>(\r\n null,\r\n API_ROUTER_UTILS.url.integration.stores\r\n );\r\n }\r\n\r\n customerStoresByCustomerId(\r\n customerId: string\r\n ): Observable> {\r\n return this.apiService.get>(\r\n null,\r\n API_ROUTER_UTILS.url.integration.storesByCustomerId,\r\n { customerId: customerId }\r\n );\r\n }\r\n\r\n storeImportInfo(): Observable> {\r\n return this.apiService.get>(\r\n null,\r\n API_ROUTER_UTILS.url.integration.storeImportInfo\r\n );\r\n }\r\n}\r\n","import { Injectable } from \"@angular/core\";\r\nimport { Observable } from \"rxjs\";\r\nimport { ApiService } from \"../../apis\";\r\nimport { ResultDto } from \"../../dtos/api\";\r\nimport { UpdatePricePreviewResultDto, UpdatePriceRequestDto, UpdateVatPreviewResultDto, UpdateVatRequestDto } from \"../../dtos/batch\";\r\nimport { API_ROUTER_UTILS } from \"../../utils\";\r\n@Injectable({\r\n providedIn: \"root\",\r\n})\r\nexport class BatchService {\r\n constructor(private apiService: ApiService) {}\r\n\r\n updatePrice(\r\n request: UpdatePriceRequestDto\r\n ): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.batchoperations.updatePrice,\r\n request,\r\n null,\r\n {}\r\n );\r\n }\r\n\r\n updatePricePreview(\r\n request: UpdatePriceRequestDto\r\n ): Observable> {\r\n return this.apiService.post>(\r\n API_ROUTER_UTILS.url.batchoperations.updatePricePreview,\r\n request,\r\n null,\r\n {}\r\n );\r\n }\r\n\r\n updateVat(\r\n request: UpdateVatRequestDto\r\n ): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.batchoperations.updateVat,\r\n request,\r\n null,\r\n {}\r\n );\r\n }\r\n\r\n updateVatPreview(\r\n request: UpdateVatRequestDto\r\n ): Observable> {\r\n return this.apiService.post>(\r\n API_ROUTER_UTILS.url.batchoperations.updateVatPreview,\r\n request,\r\n null,\r\n {}\r\n );\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs';\r\nimport { ApiService } from '../../apis';\r\nimport { PaginationResponseDto, ResultDto, SearchDto } from '../../dtos/api';\r\nimport {\r\n CreateCustomerCustomerRequestDto,\r\n CustomerCustomerResultDto,\r\n CustomerPaginationReponseDto,\r\n} from '../../dtos/customer';\r\nimport { API_ROUTER_UTILS } from '../../utils';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class CustomerService {\r\n constructor(private apiService: ApiService) {}\r\n\r\n getCustomers(search: SearchDto): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.customers.search,\r\n search,\r\n null,\r\n {}\r\n );\r\n }\r\n\r\n customerCustomers(): Observable> {\r\n return this.apiService.get>(\r\n null,\r\n API_ROUTER_UTILS.url.customers.customerCustomers,\r\n null\r\n );\r\n }\r\n\r\n customerCustomerAllSearch(\r\n searchKey: string\r\n ): Observable> {\r\n return this.apiService.get>(\r\n null,\r\n API_ROUTER_UTILS.url.customers.customerCustomerAllSearch,\r\n { searchKey: searchKey }\r\n );\r\n }\r\n\r\n customerCustomerSearch(\r\n searchDto: SearchDto\r\n ): Observable>> {\r\n return this.apiService.post<\r\n ResultDto>\r\n >(API_ROUTER_UTILS.url.customers.customerCustomerSearch, searchDto, null);\r\n }\r\n\r\n createCustomerCustomer(request: CreateCustomerCustomerRequestDto): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.customers.createCustomerCustomer,\r\n request,\r\n null,\r\n {}\r\n );\r\n }\r\n}\r\n","import { Injectable } from \"@angular/core\";\r\nimport { Observable } from \"rxjs\";\r\nimport { ApiService } from \"../../apis\";\r\nimport { ResultDto, SearchDto } from \"../../dtos/api\";\r\nimport { API_ROUTER_UTILS } from \"../../utils\";\r\n\r\n@Injectable({\r\n providedIn: \"root\",\r\n})\r\nexport class ReturnService {\r\n constructor(private apiService: ApiService) {}\r\n\r\n returns(searchDto: SearchDto): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.returns.search,\r\n searchDto,\r\n null\r\n );\r\n }\r\n}\r\n","import { Injectable } from \"@angular/core\";\r\nimport { Observable } from \"rxjs\";\r\nimport { ApiService } from \"../../apis\";\r\nimport { PaginationResponseDto, ResultDto, SearchDto } from \"../../dtos/api\";\r\nimport { AnswerQuestionRequestDto, QuestionFunctionResultDto } from \"../../dtos/question\";\r\nimport { API_ROUTER_UTILS } from \"../../utils\";\r\n\r\n@Injectable({\r\n providedIn: \"root\",\r\n})\r\nexport class QuestionService {\r\n constructor(private apiService: ApiService) {}\r\n\r\n search(searchDto: SearchDto): Observable>> {\r\n return this.apiService.post>>(\r\n API_ROUTER_UTILS.url.questions.search,\r\n searchDto,\r\n null\r\n );\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { Observable } from 'rxjs';\r\nimport { ApiService } from '../../apis';\r\nimport { ResultDto, SearchDto } from '../../dtos/api';\r\nimport { API_ROUTER_UTILS } from '../../utils';\r\nimport {\r\n ExportCargoBarcodeRequestDto,\r\n PackagesPreviewRequestDto,\r\n PackagesPreviewResultDto,\r\n PackagesResultDto,\r\n PackagesSplitPreviewRequestDto,\r\n PackagesSplitPreviewResultDto,\r\n PackagesSplitRequestDto,\r\n PackagesSplitResultDto,\r\n} from '../../dtos/sale';\r\nimport { PackagesRequestDto } from '../../dtos/sale/packages-request.dto';\r\n\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class SaleService {\r\n constructor(private apiService: ApiService) {}\r\n\r\n sales(searchDto: SearchDto): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.sales.search,\r\n searchDto,\r\n null\r\n );\r\n }\r\n\r\n exportCargoBarcode(\r\n request: ExportCargoBarcodeRequestDto[]\r\n ): Observable> {\r\n return this.apiService.post>(\r\n API_ROUTER_UTILS.url.sales.exportCargoBarcode,\r\n request,\r\n null\r\n );\r\n }\r\n\r\n packagesPreview(\r\n request: PackagesPreviewRequestDto[]\r\n ): Observable> {\r\n return this.apiService.post>(\r\n API_ROUTER_UTILS.url.sales.packagesPreview,\r\n request,\r\n null\r\n );\r\n }\r\n\r\n packages(\r\n request: PackagesRequestDto[]\r\n ): Observable> {\r\n return this.apiService.post>(\r\n API_ROUTER_UTILS.url.sales.packages,\r\n request,\r\n null\r\n );\r\n }\r\n\r\n packagesSplit(\r\n request: PackagesSplitRequestDto[]\r\n ): Observable> {\r\n return this.apiService.post>(\r\n API_ROUTER_UTILS.url.sales.packagesSplit,\r\n request,\r\n null\r\n );\r\n }\r\n\r\n packagesSplitPreview(\r\n request: PackagesSplitPreviewRequestDto[]\r\n ): Observable> {\r\n return this.apiService.post>(\r\n API_ROUTER_UTILS.url.sales.packagesSplitPreview,\r\n request,\r\n null\r\n );\r\n }\r\n}\r\n","import { Injectable } from \"@angular/core\";\r\nimport { Observable } from \"rxjs\";\r\nimport { ApiService } from \"../../apis\";\r\nimport { PaginationResponseDto, ResultDto, SearchDto } from \"../../dtos/api\";\r\nimport { CreateTagRequestDto, CreateTagResultDto, DeleteTagResultDto, TagResultDto, UpdateTagRequestDto, UpdateTagResultDto } from \"../../dtos/tag\";\r\nimport { API_ROUTER_UTILS } from \"../../utils\";\r\n\r\n@Injectable({\r\n providedIn: \"root\",\r\n})\r\nexport class TagService {\r\n constructor(private apiService: ApiService) {}\r\n\r\n search(\r\n searchDto: SearchDto\r\n ): Observable>> {\r\n return this.apiService.post<\r\n ResultDto>\r\n >(API_ROUTER_UTILS.url.tags.search, searchDto, null);\r\n }\r\n\r\n create(\r\n createTagRequestDto: CreateTagRequestDto\r\n ): Observable> {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.tags.create,\r\n createTagRequestDto,\r\n null\r\n );\r\n }\r\n\r\n update(\r\n updateTagRequestDto: UpdateTagRequestDto\r\n ): Observable> {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.tags.update,\r\n updateTagRequestDto,\r\n null\r\n );\r\n }\r\n\r\n delete(tagId: string): Observable> {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.tags.delete,\r\n null,\r\n null,\r\n { tagId: tagId }\r\n );\r\n }\r\n}\r\n","import { HttpErrorResponse } from '@angular/common/http';\r\nimport { Component, Input, OnInit } from '@angular/core';\r\nimport { FormGroup, UntypedFormGroup } from '@angular/forms';\r\nimport { ResultDto } from 'src/app/core/dtos/api';\r\nimport { CategoryResultDto } from 'src/app/core/dtos/category';\r\nimport { CategoryService } from 'src/app/core/services/customer';\r\nimport { MessageService } from 'src/app/core/services/message';\r\nimport { httpErrorResponseUtil } from 'src/app/core/utils';\r\n\r\n@Component({\r\n selector: 'app-form-select-categories',\r\n templateUrl: './form-select-categories.component.html',\r\n styleUrls: ['./form-select-categories.component.scss']\r\n})\r\nexport class FormSelectCategoriesComponent implements OnInit {\r\n @Input() categoryForm: UntypedFormGroup;\r\n @Input() required?: boolean;\r\n customerCategories: CategoryResultDto[] = [];\r\n constructor(\r\n private categoryService: CategoryService,\r\n private messageService: MessageService\r\n ) {}\r\n\r\n ngOnInit(): void {\r\n this.getCustomerCategories();\r\n }\r\n\r\n getCustomerCategories() {\r\n this.categoryService.forCreateProduct().subscribe(\r\n (data: ResultDto) => {\r\n this.customerCategories = data.data;\r\n },\r\n (error: HttpErrorResponse) => {\r\n var errorStr = httpErrorResponseUtil(error);\r\n this.messageService.error(errorStr);\r\n }\r\n );\r\n }\r\n}\r\n","\r\n","import { of } from 'rxjs';\nimport { map } from 'rxjs/operators';\nimport { FormArray, FormControl, FormGroup, NG_ASYNC_VALIDATORS, NG_VALUE_ACCESSOR, NG_VALIDATORS, AbstractControl, FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport * as i0 from '@angular/core';\nimport { Directive, Input, forwardRef, LOCALE_ID, Injectable, Inject, NgModule } from '@angular/core';\nimport * as i1 from '@angular/common';\nimport { getLocaleNumberSymbol, NumberSymbol, CommonModule, DecimalPipe } from '@angular/common';\nclass TypedForm {}\nconst ValidationAlphabetLocale = {\n 'danish': 'danish',\n 'french': 'french',\n 'german': 'german',\n 'greek': 'greek',\n 'spanish': 'spanish',\n 'russian': 'russian'\n};\nconst CONTROLS_ERROR = \"controlsError\";\nconst VALUE_CHANGED_SYNC = \"valueChangedSync\";\nconst FUNCTION_STRING = \"function\";\nconst OBJECT_STRING = \"object\";\nconst RX_WEB_VALIDATOR = \"rxwebValidator\";\nconst NUMBER = \"number\";\nconst BOOLEAN$1 = \"boolean\";\nconst CUSTOM = \"custom\";\nconst TEMPLATE_VALIDATION_CONFIG = \"template-validation-config\";\nconst CONDITIONAL_VALIDATOR = \"conditionalValidator\";\nconst VALIDATOR_CONFIG$2 = \"validatorConfig\";\nconst THIS = \"this\";\nconst RXCODE = \"-rxw-\";\nconst MODEL = \"model\";\nconst MODEL_INSTANCE = \"modelInstance\";\nconst PATCH = \"patch\";\nclass Linq {\n static functionCreator(expression) {\n var functionSetter = [];\n var match = expression.match(/^\\s*\\(?\\s*([^)]*)\\s*\\)?\\s*=>(.*)/);\n var splitSelect = match[2].split(\",\");\n for (var i = 0; i < splitSelect.length; i++) {\n var equalToOperator = splitSelect[i].match(/^\\s*\\(?\\s*([^)]*)\\s*\\)?\\s*|===|!==|==|!=|>=|>|<=|<|(.*)/);\n if (equalToOperator !== null) {\n functionSetter = new Function(match[1], \"return \" + equalToOperator.input);\n } else {\n equalToOperator = splitSelect[i].match(/^\\s*\\(?\\s*([^)]*)\\s*\\)?\\s*=(.*)/);\n if (equalToOperator === null) {\n functionSetter = new Function(match[1], \"return \" + splitSelect.input);\n } else {\n functionSetter = new Function(match[1], \"return \" + equalToOperator.input);\n }\n }\n }\n if (splitSelect.length == 0) functionSetter = {\n accessFunction: new Function(match[1], \"return \" + match[2])\n };\n return functionSetter;\n }\n static execute(jObject, config, parentObject, modelInstance, isDynamicConfig) {\n let expressionFunction = isDynamicConfig ? config.dynamicConfig : config.conditionalExpression;\n let lastParam = isDynamicConfig ? config : modelInstance;\n if (parentObject && typeof expressionFunction == \"string\") expressionFunction = Linq.functionCreator(expressionFunction);\n if (parentObject && expressionFunction) return modelInstance && modelInstance.constructor !== Object ? expressionFunction.call(modelInstance, parentObject, jObject, lastParam) : expressionFunction(parentObject, jObject, lastParam);\n return true;\n }\n static getConditionPath(texts) {\n let path = \"\";\n for (var i = 1; i < texts.length; i++) path += texts.length - 1 == i ? texts[i].trim() : `${texts[i].trim()}.`;\n return path;\n }\n static expressionParser(expression, isNonValidationExpression) {\n let splitExpressions = [];\n let columns = [];\n let expressionString = expression.toString();\n let expressionArguments = Linq.extractArguments(expressionString);\n if (expressionArguments.length > 0) {\n let splitTexts = [];\n expressionString.replace(/\\s/g, '').replace(new RegExp(/{|}/, \"g\"), \"\").split(new RegExp(/return|===|!==|==|!=|>=|>|<=|<|&&/)).forEach(t => {\n let texts = t.replace(/\\(|\\)/g, \"\").split(\"||\");\n for (let text of texts) splitTexts.push(text);\n });\n splitTexts.forEach(t => {\n expressionArguments.forEach((x, i) => {\n t = t.trim();\n if (t.startsWith(x + '.')) {\n var splitText = t.split('.');\n if (splitText.length == 2 || splitText.length >= 2 && isNonValidationExpression) {\n if (!isNonValidationExpression) columns.push({\n propName: splitText[1].trim(),\n argumentIndex: i == 3 ? 0 : i == 2 ? 1 : i == 1 ? -1 : i\n });else columns.push({\n propName: this.getConditionPath(splitText),\n argumentIndex: i == 3 ? 0 : i == 2 ? 1 : i == 1 ? -1 : i\n });\n } else {\n var arrayProp = splitText[1].split('[');\n let jObject = {\n propName: splitText[splitText.length - 1].trim(),\n objectPropName: arrayProp[0],\n arrayIndex: arrayProp.length > 1 ? arrayProp[1].replace(\"]\", \"\") : undefined,\n argumentIndex: i === 3 ? 0 : i === 2 ? 1 : i\n };\n columns.push(jObject);\n }\n }\n });\n });\n }\n return columns;\n }\n static extractArguments(splitText) {\n let expressionArguments = [THIS];\n if (splitText[0].trim() !== \"(\" && !splitText.trim().startsWith(\"function\")) {\n let text = splitText[0].split(\"=>\")[0];\n expressionArguments.push(text.trim().replace(\"(\", \"\").replace(\")\", \"\"));\n } else {\n let splitTexts = splitText.match(/\\(([^)]+)\\)/g);\n if (splitTexts && splitTexts[0]) splitTexts[0].split(\",\").forEach(t => expressionArguments.push(t.trim().replace(\"(\", \"\").replace(\")\", \"\")));\n }\n return expressionArguments;\n }\n static expressionColumns(expression, isNonValidationExpression = false) {\n var columns = [];\n let splitExpressions = [];\n if (typeof expression == \"string\") {\n expression.split(\"=>\")[1].split(\" && \").forEach(t => {\n t.split(\" || \").forEach(x => {\n splitExpressions.push(x.trim().split(' ')[0]);\n });\n });\n splitExpressions.forEach(t => {\n var splitText = t.split('.');\n if (splitText.length == 2) columns.push({\n propName: splitText[1].trim()\n });else {\n var arrayProp = splitText[1].split('[');\n let jObject = {\n propName: splitText[splitText.length - 1].trim(),\n objectPropName: arrayProp[0],\n arrayIndex: arrayProp.length > 1 ? arrayProp[1].replace(\"]\", \"\") : undefined\n };\n columns.push(jObject);\n }\n });\n } else {\n columns = Linq.expressionParser(expression, isNonValidationExpression);\n }\n return columns;\n }\n static dynamicConfigParser(expression, propName) {\n let controlNames = [];\n let expressionString = expression.toString();\n let expressionArguments = Linq.extractArguments(expressionString);\n let splitString = expressionString.replace(new RegExp(/\\r?\\n|\\r|;/g), ' ').replace(/[\"%()\\{}=\\\\?�`'#<>|,;:+-]+/g, \" \").split(/ /g);\n if (expressionArguments.length > 3) expressionArguments.splice(expressionArguments.length - 1, 1);\n expressionArguments.forEach(t => {\n splitString.filter(x => x != `${t}.${propName}` && x.startsWith(`${t}.`)).forEach(x => {\n let split = x.split('.');\n if (split.length == 2) controlNames.push({\n propName: x.replace(`${t}.`, '')\n });else {\n var arrayProp = split[1].split('[');\n let jObject = {\n propName: split[split.length - 1].trim(),\n objectPropName: arrayProp[0],\n arrayIndex: arrayProp.length > 1 ? arrayProp[1].replace(\"]\", \"\") : undefined\n };\n controlNames.push(jObject);\n }\n });\n });\n return controlNames;\n }\n}\nconst AnnotationTypes = {\n numeric: 'numeric',\n required: 'required',\n minLength: 'minLength',\n maxLength: 'maxLength',\n minNumber: 'minNumber',\n maxNumber: 'maxNumber',\n pattern: 'pattern',\n password: 'password',\n compare: 'compare',\n minDate: 'minDate',\n maxDate: 'maxDate',\n alpha: 'alpha',\n alphaNumeric: 'alphaNumeric',\n email: 'email',\n hexColor: 'hexColor',\n lowerCase: 'lowerCase',\n url: 'url',\n upperCase: 'upperCase',\n nested: 'nested',\n propArray: 'propArray',\n propObject: 'propObject',\n contains: 'contains',\n range: 'range',\n custom: 'custom',\n digit: \"digit\",\n creditCard: \"creditCard\",\n time: \"time\",\n json: \"json\",\n greaterThan: \"greaterThan\",\n greaterThanEqualTo: \"greaterThanEqualTo\",\n lessThan: \"lessThan\",\n lessThanEqualTo: \"lessThanEqualTo\",\n choice: \"choice\",\n different: \"different\",\n even: \"even\",\n odd: \"odd\",\n factor: \"factor\",\n leapYear: \"leapYear\",\n allOf: \"allOf\",\n oneOf: \"oneOf\",\n noneOf: \"noneOf\",\n mac: \"mac\",\n ascii: \"ascii\",\n dataUri: \"dataUri\",\n port: \"port\",\n latLong: \"latLong\",\n extension: \"extension\",\n fileSize: \"fileSize\",\n endsWith: \"endsWith\",\n startsWith: \"startsWith\",\n primeNumber: \"primeNumber\",\n latitude: \"latitude\",\n longitude: \"longitude\",\n compose: \"compose\",\n rule: \"rule\",\n file: \"file\",\n image: \"image\",\n unique: \"unique\",\n notEmpty: \"notEmpty\",\n ip: \"ip\",\n cusip: \"cusip\",\n grid: \"grid\",\n date: 'date',\n and: 'and',\n or: 'or',\n not: 'not',\n minTime: 'minTime',\n maxTime: 'maxTime',\n requiredTrue: 'requiredTrue',\n mask: 'mask',\n iban: 'iban',\n updateOn: 'updateOn'\n};\nconst INVALID = \"INVALID\";\nconst PROPERTY = \"property\";\nconst OBJECT_PROPERTY = \"objectProperty\";\nconst ARRAY_PROPERTY = \"arrayProperty\";\nconst STRING = \"string\";\nconst MESSAGE = \"message\";\nconst BLANK = \"\";\nconst KEYPRESS = \"onkeypress\";\nconst ONCHANGE = \"onchange\";\nconst ONCLICK = \"onclick\";\nconst ONKEYUP = \"onkeyup\";\nconst ONBLUR = \"onblur\";\nconst ONFOCUS = \"onfocus\";\nconst ELEMENT_VALUE = \"value\";\nconst BLUR = \"blur\";\nconst FOCUS = \"focus\";\nconst CHANGE = \"change\";\nconst KEY_DOWN = \"keydown\";\nconst KEY_PRESS = \"keypress\";\nconst PASTE = \"paste\";\nconst INPUT = \"INPUT\";\nconst SELECT = \"SELECT\";\nconst CHECKBOX = \"checkbox\";\nconst RADIO = \"radio\";\nconst FILE = \"file\";\nconst TEXTAREA = \"textarea\";\nconst DECORATORS = {\n disabled: 'disabled',\n error: 'error',\n trim: 'trim',\n ltrim: 'ltrim',\n rtrim: 'rtrim',\n blacklist: 'blacklist',\n stripLow: 'stripLow',\n toBoolean: 'toBoolean',\n toDate: 'toDate',\n toDouble: 'toDouble',\n toFloat: 'toFloat',\n toInt: 'toInt',\n string: 'toString',\n whitelist: 'whitelist',\n escape: 'escape',\n prefix: 'prefix',\n suffix: 'suffix',\n sanitize: 'sanitize',\n elementClass: 'elementClass',\n updateOn: 'updateOn'\n};\nconst defaultContainer = new class {\n constructor() {\n this.instances = [];\n this.modelIncrementCount = 0;\n }\n get(instanceFunc) {\n let instance = this.instances.filter(instance => instance.instance === instanceFunc)[0];\n return instance;\n }\n getInstance(target, parameterIndex, propertyKey, decoratorType) {\n let isPropertyKey = propertyKey != undefined;\n let instanceFunc = !isPropertyKey ? target : target.constructor;\n let instance = this.instances.filter(instance => instance.instance === instanceFunc)[0];\n if (!instance) instance = this.addInstanceContainer(instanceFunc);\n return instance;\n }\n addPropsConfig(target, configs) {\n let instanceContainer = this.instances.filter(instance => instance.instance == target)[0];\n if (instanceContainer) {\n for (let config of configs) {\n for (let prop of config.propNames) {\n let propertyInfo = instanceContainer.properties.filter(t => t.name == prop && t.propertyType !== OBJECT_PROPERTY && t.propertyType !== ARRAY_PROPERTY)[0];\n if (propertyInfo) {\n this.addPropConfig(target, [propertyInfo], config);\n } else if (prop === \":all:\") this.addPropConfig(target, instanceContainer.properties.filter(t => t.propertyType !== OBJECT_PROPERTY && t.propertyType !== ARRAY_PROPERTY), config);\n }\n }\n } else if (configs === undefined) this.addInstanceContainer(target);\n }\n addPropConfig(target, properties, config) {\n for (var propertyInfo of properties) {\n let excludeProp = false;\n if (config.excludePropNames) excludeProp = config.excludePropNames.filter(t => t == propertyInfo.name)[0] !== undefined;\n if (!excludeProp) {\n if (config.validationConfig) for (let typeName in config.validationConfig) {\n this.init({\n constructor: target\n }, 0, propertyInfo.name, typeName, config.validationConfig[typeName] === true ? undefined : config.validationConfig[typeName], false);\n }\n if (config.error) this.addDecoratorConfig({\n constructor: target\n }, 0, propertyInfo.name, config.error, DECORATORS.error);\n if (config.disable) this.addDecoratorConfig({\n constructor: target\n }, 0, propertyInfo.name, config.disable, DECORATORS.disabled);\n if (config.elementClass) this.addDecoratorConfig({\n constructor: target\n }, 0, propertyInfo.name, config.elementClass, DECORATORS.elementClass);\n if (config.ignore) propertyInfo.ignore = config.ignore;\n }\n }\n }\n addSanitizer(target, parameterIndex, propertyKey, decoratorType, value) {\n let instance = this.getInstance(target, parameterIndex, propertyKey, decoratorType);\n if (instance) {\n if (!instance.sanitizers[propertyKey]) instance.sanitizers[propertyKey] = [];\n instance.sanitizers[propertyKey].push({\n name: decoratorType,\n config: value\n });\n }\n }\n addDecoratorConfig(target, parameterIndex, propertyKey, config, decoratorType) {\n let isPropertyKey = propertyKey != undefined;\n let instanceFunc = !isPropertyKey ? target : target.constructor;\n let instance = this.instances.filter(instance => instance.instance === instanceFunc)[0];\n if (!instance) instance = this.addInstanceContainer(instanceFunc);\n instance.nonValidationDecorators[decoratorType].conditionalExpressions[propertyKey] = config.conditionalExpression;\n let columns = Linq.expressionColumns(config.conditionalExpression, true);\n columns.forEach(column => {\n if (column.argumentIndex !== -1) {\n let columnName = !column.objectPropName ? `${column.propName}${RXCODE}${column.argumentIndex}` : `${column.objectPropName}.${column.propName}${RXCODE}${column.argumentIndex}`;\n if (!instance.nonValidationDecorators[decoratorType].changeDetection[columnName]) instance.nonValidationDecorators[decoratorType].changeDetection[columnName] = [];\n let disabledColumns = instance.nonValidationDecorators[decoratorType].changeDetection[columnName];\n if (disabledColumns.indexOf(columnName) === -1) disabledColumns.push(propertyKey);\n } else {\n if (!instance.nonValidationDecorators[decoratorType].controlProp[propertyKey]) instance.nonValidationDecorators[decoratorType].controlProp[propertyKey] = {};\n instance.nonValidationDecorators[decoratorType].controlProp[propertyKey][column.propName.replace(\";\", \"\")] = true;\n }\n });\n }\n init(target, parameterIndex, propertyKey, annotationType, config, isAsync) {\n var decoratorConfiguration = {\n propertyIndex: parameterIndex,\n propertyName: propertyKey,\n annotationType: annotationType,\n config: config,\n isAsync: isAsync,\n isValidator: annotationType !== \"updateOn\"\n };\n let isPropertyKey = propertyKey != undefined;\n this.addAnnotation(!isPropertyKey ? target : target.constructor, decoratorConfiguration);\n }\n initPropertyObject(name, propertyType, entity, target, config) {\n var propertyInfo = {\n name: name,\n propertyType: propertyType,\n entity: entity,\n dataPropertyName: config ? config.name : undefined,\n entityProvider: config ? config.entityProvider : undefined,\n defaultValue: config ? config.defaultValue : undefined,\n objectConfig: config && config.autoCreate ? {\n autoCreate: config.autoCreate\n } : undefined\n };\n defaultContainer.addProperty(target.constructor, propertyInfo);\n }\n addInstanceContainer(instanceFunc) {\n let instanceContainer = {\n instance: instanceFunc,\n propertyAnnotations: [],\n properties: [],\n nonValidationDecorators: {\n disabled: {\n conditionalExpressions: {},\n changeDetection: {},\n controlProp: {}\n },\n error: {\n conditionalExpressions: {},\n changeDetection: {},\n controlProp: {}\n },\n elementClass: {\n conditionalExpressions: {},\n changeDetection: {},\n controlProp: {}\n }\n },\n sanitizers: {}\n };\n this.instances.push(instanceContainer);\n return instanceContainer;\n }\n addProperty(instanceFunc, propertyInfo, isFromAnnotation = false) {\n let instance = this.instances.filter(instance => instance.instance === instanceFunc)[0];\n if (instance) {\n this.addPropertyInfo(instance, propertyInfo, !isFromAnnotation);\n } else {\n instance = this.addInstanceContainer(instanceFunc);\n this.addPropertyInfo(instance, propertyInfo);\n }\n }\n addPropertyInfo(instance, propertyInfo, isAddProperty = false) {\n var property = this.getProperty(instance, propertyInfo);\n if (!property) instance.properties.push(propertyInfo);else if (isAddProperty) this.updateProperty(property, propertyInfo);\n if (property && propertyInfo.messageNexus) property.messageNexus = propertyInfo.messageNexus;\n }\n addAnnotation(instanceFunc, decoratorConfiguration) {\n this.addProperty(instanceFunc, {\n propertyType: PROPERTY,\n name: decoratorConfiguration.propertyName\n }, true);\n let instance = this.instances.filter(instance => instance.instance === instanceFunc)[0];\n if (instance) instance.propertyAnnotations.push(decoratorConfiguration);else {\n instance = this.addInstanceContainer(instanceFunc);\n instance.propertyAnnotations.push(decoratorConfiguration);\n }\n if (decoratorConfiguration.config && decoratorConfiguration.config.conditionalExpression) {\n let columns = Linq.expressionColumns(decoratorConfiguration.config.conditionalExpression);\n this.addChangeValidation(instance, decoratorConfiguration.propertyName, columns);\n }\n if (decoratorConfiguration.config && decoratorConfiguration.config.dynamicConfig) {\n let columns = Linq.dynamicConfigParser(decoratorConfiguration.config.dynamicConfig, decoratorConfiguration.propertyName);\n this.addChangeValidation(instance, decoratorConfiguration.propertyName, columns);\n }\n this.setConditionalColumns(instance, decoratorConfiguration);\n }\n setConditionalColumns(instance, decoratorConfiguration) {\n if (instance && decoratorConfiguration.config) {\n if (decoratorConfiguration.annotationType == AnnotationTypes.and || decoratorConfiguration.annotationType == AnnotationTypes.or || decoratorConfiguration.annotationType == AnnotationTypes.not) {\n Object.keys(decoratorConfiguration.config.validation).forEach(t => {\n if (typeof decoratorConfiguration.config.validation[t] !== \"boolean\") this.setLogicalConditional(instance, t, decoratorConfiguration.config.validation[t].fieldName, decoratorConfiguration.propertyName);\n });\n } else this.setLogicalConditional(instance, decoratorConfiguration.annotationType, decoratorConfiguration.config.fieldName, decoratorConfiguration.propertyName);\n }\n }\n setLogicalConditional(instance, annotationType, fieldName, propertyName) {\n if (instance && (annotationType == AnnotationTypes.compare || annotationType == AnnotationTypes.greaterThan || annotationType == AnnotationTypes.greaterThanEqualTo || annotationType == AnnotationTypes.lessThan || annotationType == AnnotationTypes.lessThanEqualTo || annotationType == AnnotationTypes.different || annotationType == AnnotationTypes.factor || annotationType == AnnotationTypes.minTime || annotationType == AnnotationTypes.maxTime || annotationType == AnnotationTypes.creditCard && fieldName || (annotationType == AnnotationTypes.minDate || annotationType == AnnotationTypes.maxDate) && fieldName)) {\n this.setConditionalValueProp(instance, fieldName, propertyName);\n }\n }\n setConditionalValueProp(instance, propName, refPropName) {\n if (propName) {\n let splitProps = propName.split ? propName.split('.') : '';\n if (splitProps.length < 2) {\n if (!instance.conditionalValidationProps) instance.conditionalValidationProps = {};\n if (!instance.conditionalValidationProps[propName]) instance.conditionalValidationProps[propName] = [];\n if (instance.conditionalValidationProps[propName].indexOf(refPropName) == -1) instance.conditionalValidationProps[propName].push(refPropName);\n } else this.addChangeValidation(instance, refPropName, [{\n argumentIndex: 1,\n objectPropName: splitProps[0],\n propName: splitProps[1],\n referencePropName: refPropName\n }]);\n }\n }\n addChangeValidation(instance, propertyName, columns) {\n if (instance) {\n if (!instance.conditionalValidationProps) instance.conditionalValidationProps = {};\n columns.forEach(t => {\n if (t.propName && !t.objectPropName) {\n if (!instance.conditionalValidationProps[t.propName]) instance.conditionalValidationProps[t.propName] = [];\n if (instance.conditionalValidationProps[t.propName].indexOf(propertyName) == -1) instance.conditionalValidationProps[t.propName].push(propertyName);\n } else {\n if (t.propName && t.objectPropName) {\n if (!instance.conditionalObjectProps) instance.conditionalObjectProps = [];\n t.referencePropName = propertyName;\n instance.conditionalObjectProps.push(t);\n }\n }\n });\n }\n }\n clearInstance(instanceFunc) {\n let instance = this.instances.filter(instance => instance.instance === instanceFunc)[0];\n if (instance) {\n let indexOf = this.instances.indexOf(instance);\n this.instances.splice(indexOf, 1);\n }\n }\n getProperty(instance, propertyInfo) {\n return instance.properties.filter(t => t.name == propertyInfo.name)[0];\n }\n updateProperty(property, currentProperty) {\n property.dataPropertyName = currentProperty.dataPropertyName;\n property.defaultValue = currentProperty.defaultValue;\n }\n}();\nfunction baseDecoratorFunction(annotationType, config, isAsync = false) {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.init(target, parameterIndex, propertyKey, annotationType, config, isAsync);\n };\n}\nconst RegExRule = {\n alpha: /^[a-zA-Z]+$/,\n alphaExits: /[a-zA-Z]/,\n alphaWithSpace: /^[a-zA-Z\\s]+$/,\n macId: /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/,\n onlyDigit: /^[0-9]+$/,\n isDigitExits: /[0-9]/,\n lowerCase: /[a-z]/,\n upperCase: /[A-Z]/,\n specialCharacter: /[`~!@#$%^&*()_|+\\-=?;:'\",.<>\\{\\}\\[\\]\\\\\\/]/gi,\n advancedEmail: /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,\n basicEmail: /^(([^<>()\\[\\]\\\\.,,:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/,\n alphaNumeric: /^[0-9a-zA-Z]+$/,\n alphaNumericWithSpace: /^[0-9a-zA-Z\\s]+$/,\n hexColor: /^#?([0-9A-F]{3}|[0-9A-F]{6})$/i,\n strictHexColor: /^#?([0-9A-F]{3}|[0-9A-F]{6})$/i,\n float: /^(?:[-+]?(?:[0-9]+))?(?:\\.[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$/,\n decimal: /^[-+]?([0-9]+|\\.[0-9]+|[0-9]+\\.[0-9]+)$/,\n hexaDecimal: /^[0-9A-F]+$/i,\n date: /^(?:(?:31(\\/|-|\\.)(?:0?[13578]|1[02]))\\1|(?:(?:29|30)(\\/|-|\\.)(?:0?[1,3-9]|1[0-2])\\2))(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$|^(?:29(\\/|-|\\.)0?2\\3(?:(?:(?:1[6-9]|[2-9]\\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\\d|2[0-8])(\\/|-|\\.)(?:(?:0?[1-9])|(?:1[0-2]))\\4(?:(?:1[6-9]|[2-9]\\d)?\\d{2})$/,\n time: /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/,\n timeWithSeconds: /^([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$/,\n url: /^(https?:\\/\\/(?:www\\.|(?!www)|(?!a-zA-Z))[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]\\.[^\\s]{2,}|www\\.[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]\\.[^\\s]{2,}|https?:\\/\\/(?:www\\.|(?!www)|(?!a-zA-Z))[a-zA-Z0-9]\\.[^\\s]{2,}|www\\.[a-zA-Z0-9]\\.[^\\s]{2,})$/,\n localhostUrl: /^(https?:\\/\\/localhost\\:([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])|localhost\\::([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])|https?:\\/\\/localhost\\::([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))$/,\n interanetUrl: /^(https?:\\/\\/[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9])$/,\n ascii: /^[\\x00-\\x7F]+$/,\n dataUri: /^data:([a-z]+\\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\\-._~:@\\/?%\\s]*?)$/i,\n lat: /^\\(?[+-]?(90(\\.0+)?|[1-8]?\\d(\\.\\d+)?)$/,\n long: /^\\s?[+-]?(180(\\.0+)?|1[0-7]\\d(\\.\\d+)?|\\d{1,2}(\\.\\d+)?)\\)?$/,\n ipV4: /^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/,\n ipV6: /^((?:[a-fA-F\\d]{1,4}:){7}(?:[a-fA-F\\d]{1,4}|:)|(?:[a-fA-F\\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|:[a-fA-F\\d]{1,4}|:)|(?:[a-fA-F\\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(:[a-fA-F\\d]{1,4}){1,2}|:)|(?:[a-fA-F\\d]{1,4}:){4}(?:(:[a-fA-F\\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(:[a-fA-F\\d]{1,4}){1,3}|:)|(?:[a-fA-F\\d]{1,4}:){3}(?:(:[a-fA-F\\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(:[a-fA-F\\d]{1,4}){1,4}|:)|(?:[a-fA-F\\d]{1,4}:){2}(?:(:[a-fA-F\\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(:[a-fA-F\\d]{1,4}){1,5}|:)|(?:[a-fA-F\\d]{1,4}:){1}(?:(:[a-fA-F\\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(:[a-fA-F\\d]{1,4}){1,6}|:)|(?::((?::[a-fA-F\\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,7}|:)))(%[0-9a-zA-Z]{1,})?$/,\n cidrV4: /^(3[0-2]|[12]?[0-9])$/,\n cidrV6: /^(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,\n cusip: /^[0-9A-Z]{9}$/,\n grid: /^[GRID:]*([0-9A-Z]{2})[-\\s]*([0-9A-Z]{5})[-\\s]*([0-9A-Z]{10})[-\\s]*([0-9A-Z]{1})$/g\n};\nconst ALPHABET = \"alphabet\";\nconst DIGIT = \"digit\";\nconst CONTAINS = \"contains\";\nconst LOWERCASE = \"lowerCase\";\nconst UPPERCASE = \"upperCase\";\nconst SPECIAL_CHARACTER = \"specialCharacter\";\nconst MIN_LENGTH = \"minLength\";\nconst MAX_LENGTH = \"maxLength\";\nclass RegexValidator {\n static isExits(value, regex) {\n return value.match(regex) != null;\n }\n static isValid(value, regex) {\n return regex.test(value);\n }\n static isNotBlank(value, isRemoveSpace = false) {\n return !isRemoveSpace ? value === 0 || value !== undefined && value !== null && value !== \"\" : value === 0 || value !== undefined && value !== null && String(value).trim() !== \"\";\n }\n static isValidPassword(passwordValidation, value) {\n let isValid = false;\n let jObject = {};\n let keyName = \"status\";\n let objectProperties = Object.getOwnPropertyNames(passwordValidation);\n for (let propertyName of objectProperties) {\n switch (propertyName) {\n case ALPHABET:\n isValid = RegexValidator.isExits(value, RegExRule.alphaExits);\n keyName = ALPHABET;\n break;\n case DIGIT:\n isValid = RegexValidator.isValid(value, RegExRule.isDigitExits);\n keyName = DIGIT;\n break;\n case CONTAINS:\n isValid = value.indexOf(passwordValidation[CONTAINS]) != -1;\n keyName = CONTAINS;\n break;\n case LOWERCASE:\n isValid = RegexValidator.isValid(value, RegExRule.lowerCase);\n keyName = LOWERCASE;\n break;\n case UPPERCASE:\n isValid = RegexValidator.isValid(value, RegExRule.upperCase);\n keyName = UPPERCASE;\n break;\n case SPECIAL_CHARACTER:\n isValid = RegexValidator.isExits(value, RegExRule.specialCharacter);\n keyName = SPECIAL_CHARACTER;\n break;\n case MIN_LENGTH:\n isValid = value.length >= passwordValidation[propertyName];\n keyName = MIN_LENGTH;\n break;\n case MAX_LENGTH:\n isValid = value.length <= passwordValidation[propertyName];\n keyName = MAX_LENGTH;\n break;\n }\n if (!isValid) break;\n }\n return {\n isValid: isValid,\n keyName: keyName\n };\n }\n static isZero(value) {\n return value == 0;\n }\n static commaRegex() {\n return new RegExp(\",\", \"g\");\n }\n}\nlet ReactiveFormConfig = /*#__PURE__*/(() => {\n class ReactiveFormConfig {\n static set(jObject) {\n if (jObject) ReactiveFormConfig.json = jObject;\n }\n static get(path) {\n let jObject;\n if (ReactiveFormConfig.json) {\n let splitPath = path.split('.');\n for (let columnName of splitPath) {\n jObject = !jObject ? ReactiveFormConfig.json[columnName] : jObject[columnName];\n if (!jObject) break;\n }\n }\n return jObject;\n }\n }\n ReactiveFormConfig.i18n = {};\n ReactiveFormConfig.number = {};\n ReactiveFormConfig.json = {};\n ReactiveFormConfig.autoInstancePush = false;\n return ReactiveFormConfig;\n})();\nlet ObjectMaker = /*#__PURE__*/(() => {\n class ObjectMaker {\n static toJson(key, config, values, additional = {}) {\n ObjectMaker.setMessage();\n let message = config ? config.message : null;\n let messageKey = undefined;\n if (!message && config && config.messageKey) messageKey = config.messageKey;\n let messageText = message ? message : ReactiveFormConfig && ReactiveFormConfig.json && ReactiveFormConfig.json.validationMessage && ReactiveFormConfig.json.validationMessage[messageKey || key] ? ReactiveFormConfig.json.validationMessage[messageKey || key] : '';\n values.forEach((t, index) => {\n if (t instanceof Date) t = this.getDateString(t);\n messageText = messageText.replace(`{{${index}}}`, t);\n });\n if (config && config.messageNexus) Object.keys(config.messageNexus).forEach(propName => {\n messageText = messageText.replace(`{{${propName}}}`, config.messageNexus[propName]);\n });\n let jObject = {};\n jObject[key] = {\n message: messageText,\n refValues: values\n };\n if (config && config.isAddMessageKey) jObject[\"messageKey\"] = messageKey;\n if (additional) {\n if (additional.min) jObject[key].min = additional.min;\n if (additional.max) jObject[key].max = additional.max;\n }\n return jObject;\n }\n static null() {\n return null;\n }\n static getPasswordMessage() {\n let messageKey = \"password\";\n return ReactiveFormConfig && ReactiveFormConfig.json && ReactiveFormConfig.json.validationMessage && ReactiveFormConfig.json.validationMessage[messageKey] ? ReactiveFormConfig.json.validationMessage[messageKey] : '';\n }\n static setMessage() {\n if (ReactiveFormConfig.i18n && ReactiveFormConfig.i18n.validationMessage && ObjectMaker.language !== ReactiveFormConfig.i18n.language) {\n if (!ReactiveFormConfig.json) ReactiveFormConfig.json = {};\n ReactiveFormConfig.json.validationMessage = ReactiveFormConfig.i18n.validationMessage();\n ObjectMaker.language = ReactiveFormConfig.i18n.language;\n }\n }\n static getDateString(value) {\n let seperator = ReactiveFormConfig && ReactiveFormConfig.json && ReactiveFormConfig.json.baseConfig && ReactiveFormConfig.json.baseConfig.seperator ? ReactiveFormConfig.json.baseConfig.seperator : \"/\";\n let dateFormat = ReactiveFormConfig && ReactiveFormConfig.json && ReactiveFormConfig.json.baseConfig && ReactiveFormConfig.json.baseConfig.dateFormat ? ReactiveFormConfig.json.baseConfig.dateFormat : \"mdy\";\n if (ReactiveFormConfig && ReactiveFormConfig.json && ReactiveFormConfig.json.internationalization && ReactiveFormConfig.json.internationalization.dateFormat && ReactiveFormConfig.json.internationalization.seperator) {\n seperator = ReactiveFormConfig.json.internationalization.seperator;\n dateFormat = ReactiveFormConfig.json.internationalization.dateFormat;\n }\n let result = '';\n let year = value.getFullYear().toString();\n let month = String(value.getMonth() + 1);\n let day = String(value.getDay());\n switch (dateFormat) {\n case 'ymd':\n result = \"\".concat(year, seperator, month, seperator, day);\n break;\n case 'dmy':\n result = \"\".concat(day, seperator, month, seperator, year);\n break;\n case 'mdy':\n result = \"\".concat(month, seperator, day, seperator, year);\n break;\n }\n return result;\n }\n }\n ObjectMaker.language = \"\";\n return ObjectMaker;\n})();\nfunction isObjectType(value) {\n return !(typeof value == \"string\" || typeof value === \"number\" || typeof value === \"boolean\" || value instanceof Date);\n}\nfunction isObject(value) {\n return Object.prototype.toString.call(value) === '[object Object]';\n}\nfunction clone(jsonObject) {\n let jObject = {};\n if (isObjectType(jsonObject)) {\n for (var columnName in jsonObject) {\n if (columnName != \"formGroup\") {\n if (Array.isArray(jsonObject[columnName])) {\n jObject[columnName] = [];\n for (let row of jsonObject[columnName]) {\n if (isObject(row)) jObject[columnName].push(clone(row));else jObject[columnName].push(row);\n }\n } else if (typeof jsonObject[columnName] == \"object\" && !(jsonObject[columnName] instanceof RegExp)) jObject[columnName] = clone(jsonObject[columnName]);else jObject[columnName] = jsonObject[columnName];\n }\n }\n return jObject;\n } else return jsonObject;\n}\nfunction merge(firstObject, secondObject) {\n for (var columnName in secondObject) {\n if (Array.isArray(secondObject[columnName])) {\n if (!firstObject[columnName]) firstObject[columnName] = [];\n for (let row of secondObject[columnName]) firstObject[columnName].push(clone(row));\n } else if (typeof firstObject[columnName] == \"object\" && !(firstObject[columnName] instanceof RegExp)) firstObject[columnName] = merge(firstObject[columnName], secondObject[columnName]);else firstObject[columnName] = secondObject[columnName];\n }\n return firstObject;\n}\nfunction isMatched(jsonObject, compareObject) {\n let isModified = false;\n for (var columnName in compareObject) {\n if (Array.isArray(jsonObject[columnName])) {\n for (var i = 0; i < jsonObject[columnName].length; i++) {\n isModified = isMatched(jsonObject[columnName][i], compareObject[columnName][i]);\n }\n } else if (typeof jsonObject[columnName] == \"object\" && !(jsonObject[columnName] instanceof RegExp)) isModified = isMatched(jsonObject[columnName], compareObject[columnName]);else isModified = !(jsonObject[columnName] == compareObject[columnName]);\n if (isModified) break;\n }\n return isModified;\n}\nconst PROP_ARRAY = \"propArray\";\nclass RxFormArray extends FormArray {\n constructor(arrayObject, controls, validatorOrOpts, asyncValidator, arrayConfig) {\n super(controls, validatorOrOpts, asyncValidator);\n this.arrayObject = arrayObject;\n this.arrayConfig = arrayConfig;\n this._isModified = false;\n this._modified = [];\n this.cloneObject(arrayObject);\n }\n get isModified() {\n return this._isModified;\n }\n push(control, options = {\n isAddedInstance: false\n }) {\n let formGroup = this.root;\n if (this.arrayObject) if (control.modelInstance) {\n if (!options.isAddedInstance) this.arrayObject.push(control.modelInstance);else this.arrayObject[this.arrayObject.length] = control.modelInstance;\n }\n super.push(control);\n if (formGroup[VALUE_CHANGED_SYNC]) formGroup.valueChangedSync();\n this.patch();\n this.checkValidation();\n }\n patch() {\n this.checkModification();\n if (this.parent) this.parent[PATCH]();\n }\n resetForm(options) {\n if (options && options.index >= 0 && options.groupOption) {\n this.controls[options.index].resetForm(options.groupOption);\n } else {\n for (var i = 0; i < this._baseValue.length; i++) {\n if (this.controls[i] !== undefined) this.controls[i].resetForm({\n value: this._baseValue[i]\n });else if (options && options.pushFunction) {\n let formGroup = options.pushFunction(this._baseValue[i]);\n this.push(formGroup);\n }\n }\n }\n }\n commit() {\n this._baseValue = [];\n for (let formGroup of this.controls) {\n formGroup.commit();\n this._baseValue.push(clone(formGroup.value));\n }\n this.patch();\n }\n removeAt(index, options = {\n isRemovedInstance: false\n }) {\n let formGroup = this.root;\n if (!options.isRemovedInstance) this.arrayObject.splice(index, 1);else {\n for (var i = index; i < this.arrayObject.length - 1; i++) this.arrayObject[i] = this.arrayObject[i + 1];\n this.arrayObject.pop();\n }\n super.removeAt(index, options);\n if (formGroup[VALUE_CHANGED_SYNC]) formGroup.valueChangedSync();\n this.patch();\n this.checkValidation();\n }\n checkValidation() {\n setTimeout(() => {\n if (this.arrayConfig != undefined && this.arrayConfig.allowMaxIndex && this.length > this.arrayConfig.allowMaxIndex) this.setErrors(ObjectMaker.toJson(PROP_ARRAY, this.arrayConfig, [this.length, this.arrayConfig.allowMaxIndex]));else if (this.errors && this.errors[PROP_ARRAY]) delete this.errors[PROP_ARRAY];\n });\n }\n checkModification() {\n this._isModified = !(this._baseValue.length == this.controls.length);\n if (!this._isModified) for (var i = 0; i < this.controls.length; i++) {\n this._isModified = isMatched(this._baseValue[i], this.controls[i].value);\n if (this._isModified) break;\n }\n }\n cloneObject(value) {\n this._baseValue = [];\n for (let row of value) {\n this._baseValue.push(clone(row));\n }\n }\n}\nvar NumericValueType = /*#__PURE__*/function (NumericValueType) {\n NumericValueType[NumericValueType[\"PositiveNumber\"] = 1] = \"PositiveNumber\";\n NumericValueType[NumericValueType[\"NegativeNumber\"] = 2] = \"NegativeNumber\";\n NumericValueType[NumericValueType[\"Both\"] = 3] = \"Both\";\n return NumericValueType;\n}(NumericValueType || {});\nvar IpVersion = /*#__PURE__*/function (IpVersion) {\n IpVersion[IpVersion[\"V4\"] = 1] = \"V4\";\n IpVersion[IpVersion[\"V6\"] = 2] = \"V6\";\n IpVersion[IpVersion[\"AnyOne\"] = 3] = \"AnyOne\";\n return IpVersion;\n}(IpVersion || {});\nvar ErrorMessageBindingStrategy = /*#__PURE__*/function (ErrorMessageBindingStrategy) {\n ErrorMessageBindingStrategy[ErrorMessageBindingStrategy[\"None\"] = 0] = \"None\";\n ErrorMessageBindingStrategy[ErrorMessageBindingStrategy[\"OnSubmit\"] = 1] = \"OnSubmit\";\n ErrorMessageBindingStrategy[ErrorMessageBindingStrategy[\"OnDirty\"] = 2] = \"OnDirty\";\n ErrorMessageBindingStrategy[ErrorMessageBindingStrategy[\"OnTouched\"] = 3] = \"OnTouched\";\n ErrorMessageBindingStrategy[ErrorMessageBindingStrategy[\"OnDirtyOrTouched\"] = 4] = \"OnDirtyOrTouched\";\n ErrorMessageBindingStrategy[ErrorMessageBindingStrategy[\"OnDirtyOrSubmit\"] = 5] = \"OnDirtyOrSubmit\";\n ErrorMessageBindingStrategy[ErrorMessageBindingStrategy[\"OnTouchedOrSubmit\"] = 6] = \"OnTouchedOrSubmit\";\n return ErrorMessageBindingStrategy;\n}(ErrorMessageBindingStrategy || {});\nvar ResetFormType = /*#__PURE__*/function (ResetFormType) {\n ResetFormType[ResetFormType[\"ControlsOnly\"] = 1] = \"ControlsOnly\";\n ResetFormType[ResetFormType[\"FormGroupsOnly\"] = 2] = \"FormGroupsOnly\";\n ResetFormType[ResetFormType[\"FormArraysOnly\"] = 3] = \"FormArraysOnly\";\n ResetFormType[ResetFormType[\"ControlsAndFormGroupsOnly\"] = 4] = \"ControlsAndFormGroupsOnly\";\n ResetFormType[ResetFormType[\"DefinedPropsOnly\"] = 5] = \"DefinedPropsOnly\";\n ResetFormType[ResetFormType[\"All\"] = 6] = \"All\";\n return ResetFormType;\n}(ResetFormType || {});\nconst MODEL_INSTANCE_VALUE = \"modelInstanceValue\";\nclass ApplicationUtil {\n static getParentObjectValue(control) {\n if (control.parent) {\n let parent = this.parentObjectValue(control.parent);\n return parent.value;\n }\n return {};\n }\n static getParentModelInstanceValue(control) {\n if (control.parent) {\n let parent = this.parentObjectValue(control.parent);\n return parent[MODEL_INSTANCE_VALUE];\n }\n return {};\n }\n static getRootFormGroup(control) {\n if (control.parent) {\n return this.getRootFormGroup(control.parent);\n }\n return control;\n }\n static getParentControl(control) {\n if (control.parent) {\n let parent = this.parentObjectValue(control.parent);\n return parent;\n }\n return control;\n }\n static getFormControlName(control) {\n let controlName = '';\n if (control.parent) {\n for (var formControlName in control.parent.controls) {\n if (control.parent.controls[formControlName] == control) {\n controlName = formControlName;\n break;\n }\n }\n }\n return controlName;\n }\n static getParentFormArray(control) {\n if (control.parent && !(control.parent instanceof FormArray || control.parent instanceof RxFormArray)) {\n let parent = this.getParentFormArray(control.parent);\n return parent;\n }\n return control.parent;\n }\n static toLower(value) {\n if (value) return String(value).toLowerCase().trim();\n return value;\n }\n static getControl(fieldName, formGroup) {\n let splitText = fieldName.split('.');\n if (splitText.length > 1) {\n var formControl = formGroup;\n splitText.forEach((name, index) => {\n formControl = formControl.controls[name];\n });\n return formControl;\n } else return formGroup.controls[fieldName];\n }\n static getFormControl(fieldName, control) {\n let splitText = fieldName.split('.');\n if (splitText.length > 1 && control.parent) {\n var formControl = this.getParentControl(control);\n splitText.forEach((name, index) => {\n formControl = formControl.controls[name];\n });\n return formControl;\n }\n return control.parent ? control.parent.get([fieldName]) : undefined;\n }\n static parentObjectValue(control) {\n if (!control.parent) return control;else control = this.parentObjectValue(control.parent);\n return control;\n }\n static isNumeric(value) {\n return value - parseFloat(value) + 1 >= 0;\n }\n static notEqualTo(primaryValue, secondaryValue) {\n let firstValue = primaryValue === undefined || primaryValue === null ? \"\" : primaryValue;\n let secondValue = secondaryValue === undefined || secondaryValue === null ? \"\" : secondaryValue;\n if (firstValue instanceof Date && secondValue instanceof Date) return +firstValue != +secondValue;\n return firstValue != secondValue;\n }\n static numericValidation(allowDecimal, acceptValue) {\n let decimalSymbol;\n if (ReactiveFormConfig && ReactiveFormConfig.number) {\n decimalSymbol = ReactiveFormConfig.json && ReactiveFormConfig.json.allowDecimalSymbol ? ReactiveFormConfig.json.allowDecimalSymbol : ReactiveFormConfig.number.decimalSymbol;\n } else {\n decimalSymbol = \".\";\n }\n acceptValue = acceptValue == undefined ? NumericValueType.PositiveNumber : acceptValue;\n let regex = /^[0-9]+$/;\n switch (acceptValue) {\n case NumericValueType.PositiveNumber:\n regex = !allowDecimal ? /^[0-9]+$/ : decimalSymbol == \".\" || decimalSymbol == undefined ? /^[0-9\\.]+$/ : /^[0-9\\,]+$/;\n break;\n case NumericValueType.NegativeNumber:\n regex = !allowDecimal ? /^[-][0-9]+$/ : decimalSymbol == \".\" || decimalSymbol == undefined ? /^[-][0-9\\.]+$/ : /^[-][0-9\\,]+$/;\n break;\n case NumericValueType.Both:\n regex = !allowDecimal ? /^[-|+]?[0-9]+$/ : decimalSymbol == \".\" || decimalSymbol == undefined ? /^[-|+]?[0-9\\.]+$/ : /^[-|+]?[0-9\\,]+$/;\n break;\n }\n return regex;\n }\n static configureControl(control, config, type) {\n if (!control.validatorConfig) {\n let jObject = {};\n jObject[type] = config;\n Object.assign(control, {\n validatorConfig: jObject\n });\n } else control.validatorConfig[type] = config;\n }\n static lowerCaseWithTrim(value) {\n return typeof value === \"string\" ? value.toLowerCase().trim() : String(value).toLowerCase().trim();\n }\n /** Check if a value is an object */\n static isObject(value) {\n return Object.prototype.toString.call(value) === '[object Object]';\n }\n /** Check if a value is an object */\n static isArray(value) {\n return Array.isArray(value);\n }\n static cloneValue(value) {\n return ApplicationUtil.isObject(value) ? ApplicationUtil.isArray(value) ? [...value] : {\n ...value\n } : value;\n }\n}\nfunction instanceProvider(instanceFunc, entityObject) {\n let instance = defaultContainer.get(instanceFunc);\n let prototype = entityObject ? entityObject.__proto__ : getInstance(instanceFunc, []).__proto__;\n if (prototype.__proto__) {\n let isLoop = false;\n do {\n isLoop = prototype.__proto__.constructor != Object;\n if (isLoop) {\n let extendClassInstance = defaultContainer.get(prototype.__proto__.constructor);\n instance = merge(clone(instance), clone(extendClassInstance));\n prototype = prototype.__proto__;\n }\n } while (isLoop);\n }\n return instance;\n}\nfunction getInstance(model, objectArguments) {\n let classInstance = Object.create(model.prototype);\n try {\n model.apply(classInstance, objectArguments);\n } catch (ex) {\n ///resolution of issue https://github.com/rxweb/rxweb/issues/188\n classInstance = Reflect.construct(model, objectArguments);\n }\n return classInstance;\n}\nclass DisableProvider {\n constructor(decoratorType, entityObject) {\n this.decoratorType = decoratorType;\n this.entityObject = entityObject;\n }\n getFormGroupName(currentFormGroup) {\n let keyName = '';\n if (currentFormGroup.parent) for (var controlName of Object.keys(currentFormGroup.parent.controls)) if (currentFormGroup.parent.controls[controlName] == currentFormGroup) {\n keyName = controlName;\n break;\n }\n return keyName;\n }\n zeroArgumentProcess(control, columnName) {\n let disabledColumns = [];\n this.getDisabledColumns(control.parent, `${columnName}${RXCODE}0`, false).forEach(t => disabledColumns.push(t));\n let path = this.topControlPath(control, columnName);\n let splitPath = path.split(\".\");\n if (splitPath.length > 1) {\n let rootFormGroup = ApplicationUtil.getRootFormGroup(control);\n this.getDisabledColumns(rootFormGroup, `${path}${RXCODE}0`, true).forEach(t => disabledColumns.push(t));\n let controlPath = '';\n for (var i = 0; i < splitPath.length - 2; i++) {\n let controlName = splitPath[i];\n controlPath = `${path.replace(`${controlName}.`, '')}${RXCODE}-0`;\n if (rootFormGroup.controls[controlName]) {\n this.getDisabledColumns(rootFormGroup.controls[controlName], controlPath, true, controlName).forEach(t => disabledColumns.push(t));\n rootFormGroup = rootFormGroup.controls[controlName];\n }\n }\n }\n return disabledColumns;\n }\n getDisabledColumns(formGroup, columnName, isRoot, pathName = \"\") {\n if (formGroup[MODEL_INSTANCE]) {\n let instanceContainer = instanceProvider(formGroup[MODEL_INSTANCE].constructor, this.entityObject);\n return this.getChangeDetectionColumns(instanceContainer, columnName, isRoot, pathName);\n }\n return [];\n }\n getChangeDetectionColumns(instanceContainer, columnName, isRoot, pathName = \"\") {\n let conditionalDisableControls = [];\n let columns = instanceContainer.nonValidationDecorators[this.decoratorType].changeDetection[columnName];\n if (columns) {\n columns.forEach(t => {\n conditionalDisableControls.push({\n controlPath: pathName ? `${pathName}.${t}` : t,\n conditionalExpression: instanceContainer.nonValidationDecorators[this.decoratorType].conditionalExpressions[t],\n isRoot: isRoot\n });\n });\n }\n return conditionalDisableControls;\n }\n topControlPath(control, columnName) {\n if (control.parent) {\n let name = this.getFormGroupName(control.parent);\n if (name) {\n columnName = `${name}.${columnName}`;\n return this.topControlPath(control.parent, columnName);\n }\n }\n return columnName;\n }\n childControlDisabledExpression(formGroup, columnName, path = \"\") {\n let disabledColumns = [];\n if (formGroup[MODEL_INSTANCE]) {\n let instanceContainer = defaultContainer.get(formGroup[MODEL_INSTANCE].constructor);\n if (instanceContainer) {\n this.getChangeDetectionColumns(instanceContainer, columnName, true, path).forEach(t => disabledColumns.push(t));\n var props = instanceContainer.properties.filter(t => t.propertyType == OBJECT_PROPERTY);\n props.forEach(t => {\n if (formGroup.controls[t.name]) {\n let columns = this.getDisabledColumns(formGroup.controls[t.name], columnName, true, path ? `${path}.${t.name}` : `${t.name}`);\n columns.forEach(x => disabledColumns.push(x));\n this.childControlDisabledExpression(formGroup.controls[t.name], columnName, path ? `${path}.${t.name}` : `${t.name}`).forEach(y => disabledColumns.push(y));\n }\n });\n }\n }\n return disabledColumns;\n }\n oneArgumentProcess(control, columnName) {\n let path = this.topControlPath(control, columnName);\n let rootFormGroup = ApplicationUtil.getRootFormGroup(control);\n let childColumns = this.childControlDisabledExpression(rootFormGroup, path);\n return childColumns;\n }\n}\nconst ISO_DATE_REGEX = /^(?:[\\+-]?\\d{4}(?!\\d{2}\\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\\1(?:[12]\\d|0[1-9]|3[01]))?|W(?:[0-4]\\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\\d|[12]\\d{2}|3(?:[0-5]\\d|6[1-6])))(?:[T\\s](?:(?:(?:[01]\\d|2[0-3])(?:(:?)[0-5]\\d)?|24\\:?00)(?:[\\.,]\\d+(?!:))?)?(?:\\2[0-5]\\d(?:[\\.,]\\d+)?)?(?:[zZ]|(?:[\\+-])(?:[01]\\d|2[0-3]):?(?:[0-5]\\d)?)?)?)?$/;\nclass DateProvider {\n isDate(value) {\n return value instanceof Date && !isNaN(value.valueOf());\n }\n getRegex(dateFormat) {\n var regExp;\n switch (dateFormat) {\n case 'ymd':\n regExp = \"^(?:[0-9]{4})-(1[0-2]|0?[1-9])-(3[01]|[12][0-9]|0?[1-9])$\";\n break;\n case 'dmy':\n regExp = \"^(3[01]|[12][0-9]|0?[1-9])-(1[0-2]|0?[1-9])-(?:[0-9]{2})?[0-9]{2}$\";\n break;\n case 'mdy':\n regExp = \"^(1[0-2]|0?[1-9])-(3[01]|[12][0-9]|0?[1-9])-(?:[0-9]{2})?[0-9]{2}$\";\n break;\n }\n return new RegExp(regExp);\n }\n regex(config) {\n var regExp;\n if (ReactiveFormConfig && ReactiveFormConfig.json && ReactiveFormConfig.json.internationalization && ReactiveFormConfig.json.internationalization.dateFormat && ReactiveFormConfig.json.internationalization.seperator) regExp = this.getRegex(config.dateFormat || ReactiveFormConfig.json.internationalization.dateFormat);else regExp = ReactiveFormConfig && ReactiveFormConfig.json && ReactiveFormConfig.json.baseConfig && ReactiveFormConfig.json.baseConfig.dateFormat ? this.getRegex(config.dateFormat || ReactiveFormConfig.json.baseConfig.dateFormat) : this.getRegex(config.dateFormat || \"mdy\");\n return regExp;\n }\n getDate(value, configDateFormat = undefined, isBaseFormat = false) {\n let year, month, day;\n if (!this.isDate(value)) {\n let seperator;\n let dateFormat;\n if (ISO_DATE_REGEX.test(value)) {\n return new Date(value);\n } else {\n seperator = ReactiveFormConfig && ReactiveFormConfig.json && ReactiveFormConfig.json.baseConfig && ReactiveFormConfig.json.baseConfig.seperator ? ReactiveFormConfig.json.baseConfig.seperator : \"/\";\n dateFormat = configDateFormat || ReactiveFormConfig && ReactiveFormConfig.json && ReactiveFormConfig.json.baseConfig && ReactiveFormConfig.json.baseConfig.dateFormat ? ReactiveFormConfig.json.baseConfig.dateFormat : \"mdy\";\n }\n if (!isBaseFormat && ReactiveFormConfig && ReactiveFormConfig.json && ReactiveFormConfig.json.internationalization && ReactiveFormConfig.json.internationalization.dateFormat && ReactiveFormConfig.json.internationalization.seperator) {\n seperator = ReactiveFormConfig.json.internationalization.seperator;\n dateFormat = configDateFormat || ReactiveFormConfig.json.internationalization.dateFormat;\n }\n switch (dateFormat) {\n case 'ymd':\n [year, month, day] = value.split(seperator).map(val => +val);\n break;\n case 'dmy':\n [day, month, year] = value.split(seperator).map(val => +val);\n break;\n case 'mdy':\n [month, day, year] = value.split(seperator).map(val => +val);\n break;\n }\n return new Date(year, month - 1, day);\n } else return value;\n }\n isValid(value, config) {\n if (config && config.isValid) return config.isValid(value);\n if (typeof value == \"string\") {\n // Fixed issue : https://github.com/rxweb/rxweb/issues/280 & feature request : https://github.com/rxweb/rxweb/issues/295\n if (config && config.allowISODate && ISO_DATE_REGEX.test(value)) return true;\n let seperator = '/';\n if (ReactiveFormConfig && ReactiveFormConfig.json && ReactiveFormConfig.json.baseConfig && ReactiveFormConfig.json.baseConfig.seperator) seperator = ReactiveFormConfig.json.baseConfig.seperator;\n if (ReactiveFormConfig.json && ReactiveFormConfig.json.internationalization && ReactiveFormConfig.json.internationalization.seperator) seperator = ReactiveFormConfig.json.internationalization.seperator;\n if (value.split(seperator).length !== 3) return false;\n value = value.replace(seperator, '-').replace(seperator, '-');\n return this.regex(config).test(value);\n } else return this.isDate(value);\n }\n getConfigDateValue(config) {\n let date = config.value;\n if (config.value && typeof config.value == \"string\") {\n date = this.getDate(config.value, config.dateFormat, true);\n }\n return date;\n }\n getCompareDate(config, control) {\n let date = this.getConfigDateValue(config);\n if (config.fieldName) {\n let checkControl = ApplicationUtil.getFormControl(config.fieldName, control);\n if (checkControl && checkControl.value) {\n date = this.getDate(checkControl.value, config.dateFormat);\n }\n }\n return date;\n }\n}\nfunction isNotBlank(value) {\n return value !== undefined && value !== null && value !== \"\";\n}\nfunction trim$1(value) {\n if (isNotBlank(value)) if (typeof value === \"string\") return value.trim();\n return value;\n}\n;\nfunction ltrim$1(value) {\n if (isNotBlank(value)) if (typeof value === \"string\") return value.replace(/^\\s+/g, '');\n return value;\n}\nfunction rtrim$1(value) {\n if (isNotBlank(value)) if (typeof value === \"string\") return value.replace(/\\s+$/g, '');\n return value;\n}\nfunction blacklist$1(value, chars) {\n if (isNotBlank(value)) if (typeof value === \"string\") return value.replace(new RegExp('[$' + chars + ']+', 'g'), '');\n return value;\n}\n;\nfunction stripLow$1(value, keepNewLines) {\n let chars = keepNewLines === true ? '\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F' : '\\x00-\\x1F\\x7F';\n return blacklist$1(value, chars);\n}\nfunction toBoolean$1(value, strict) {\n if (isNotBlank(value)) {\n if (strict) {\n return value === '1' || value === 'true';\n }\n return value !== '0' && value !== 'false' && value !== '';\n }\n return value;\n}\nfunction toFloat$1(value) {\n if (isNotBlank(value)) {\n var decimalSymbol = '.';\n if (ReactiveFormConfig && ReactiveFormConfig.number) {\n decimalSymbol = ReactiveFormConfig.json && ReactiveFormConfig.json.allowDecimalSymbol ? ReactiveFormConfig.json.allowDecimalSymbol : ReactiveFormConfig.number.decimalSymbol;\n }\n if (decimalSymbol == ',' && typeof value == \"string\") value = value.replace(',', '.');\n if (ApplicationUtil.isNumeric(value)) return parseFloat(value);\n }\n return null;\n}\nfunction toDouble$1(value) {\n return toFloat$1(value);\n}\nfunction toInt$1(value, radix) {\n if (isNotBlank(value)) if (ApplicationUtil.isNumeric(value)) return parseInt(value, radix || 10);\n return null;\n}\nfunction toString$1(value, radix) {\n if (isNotBlank(value)) return String(value);\n return value;\n}\nfunction whitelist$1(value, chars) {\n if (isNotBlank(value)) if (typeof value === \"string\") return value.replace(new RegExp(`[^${chars}]+`, 'g'), '');\n return value;\n}\nfunction toDate$1(value, config) {\n var dateProvider = new DateProvider();\n if (isNotBlank(value)) if (typeof value === \"string\" && dateProvider.isValid(value, config)) {\n value = dateProvider.getDate(value);\n return value;\n }\n return null;\n}\nfunction escape$1(value) {\n if (isNotBlank(value)) return value.replace(/&/g, '&').replace(/\"/g, '"').replace(/'/g, ''').replace(//g, '>').replace(/\\//g, '/').replace(/\\\\/g, '\').replace(/`/g, '`');\n return value;\n}\nfunction prefix$1(value, text) {\n if (isNotBlank(value)) return `${text}${value}`;\n return value;\n}\nfunction suffix$1(value, text) {\n if (isNotBlank(value)) return `${value}${text}`;\n return value;\n}\nfunction sanitize$1(value, config) {\n return config.custom(value);\n}\nconst SANITIZERS = {\n trim: trim$1,\n ltrim: ltrim$1,\n rtrim: rtrim$1,\n blacklist: blacklist$1,\n stripLow: stripLow$1,\n toBoolean: toBoolean$1,\n toDouble: toDouble$1,\n toFloat: toFloat$1,\n toInt: toInt$1,\n 'toString': toString$1,\n whitelist: whitelist$1,\n toDate: toDate$1,\n escape: escape$1,\n prefix: prefix$1,\n suffix: suffix$1,\n sanitize: sanitize$1\n};\nconst DIRTY = \"dirty\";\nconst TOUCHED = \"touched\";\nconst UNTOUCHED = \"untouched\";\nconst PRISTINE = \"pristine\";\nconst PENDING = \"pending\";\nclass RxFormControl extends FormControl {\n constructor(formState, validator, asyncValidator, entityObject, baseObject, controlName, _sanitizers) {\n super(formState, validator, asyncValidator);\n this.entityObject = entityObject;\n this.baseObject = baseObject;\n this._sanitizers = _sanitizers;\n this._errorMessages = [];\n this._childColumns = [];\n this._refDisableControls = [];\n this._refMessageControls = [];\n this._refClassNameControls = [];\n this._isPassedExpression = false;\n this._dirty = false;\n this.backEndErrors = {};\n this.defineErrorsProperty();\n this._baseValue = formState === undefined ? null : this.getFormState(formState);\n this._isModified = false;\n this.keyName = controlName;\n this._validators = validator.validators;\n this._asyncValidators = validator.asyncValidators;\n this._errorMessageBindingStrategy = ReactiveFormConfig.get(\"reactiveForm.errorMessageBindingStrategy\");\n if (this._sanitizers) {\n var floatSanitizer = this._sanitizers.filter(t => t.name == \"toFloat\")[0];\n if (floatSanitizer && this._baseValue && ReactiveFormConfig.number && ReactiveFormConfig.number.decimalSymbol == \",\") {\n let baseValue = String(this._baseValue);\n if (baseValue.indexOf('.') != -1) {\n this._baseValue = baseValue.replace(\".\", ReactiveFormConfig.number.decimalSymbol);\n super.setValue(this._baseValue);\n }\n }\n }\n }\n get errorMessages() {\n if (!this._messageExpression) {\n if (this._errorMessages.length == 0 && this.errors) this.setControlErrorMessages();\n } else if (this._messageExpression && !this._isPassedExpression) return [];\n if (!this.errors && this._errorMessages.length > 0) this.setControlErrorMessages();\n if (this._language != this.getLanguage()) this.setControlErrorMessages();\n return this._errorMessages;\n }\n get errorMessage() {\n if (!this._messageExpression) {\n if (this._errorMessage == undefined && this.errors) this.setControlErrorMessages();\n } else if (this._messageExpression && !this._isPassedExpression) return undefined;\n if (!this.errors && this._errorMessage) this.setControlErrorMessages();\n if (this._language != this.getLanguage()) this.setControlErrorMessages();\n return this._errorMessage;\n }\n defineErrorsProperty() {\n Object.defineProperty(this, \"errors\", {\n configurable: true,\n get() {\n if (this._language && this._language != this.getLanguage() && this.validator) {\n this[\"errors\"] = this.validator(this);\n }\n return this._errors;\n },\n set(value) {\n this._errors = value;\n }\n });\n }\n getFormState(value) {\n let baseValue = value;\n if (Array.isArray(value)) {\n baseValue = [];\n value.forEach(t => baseValue.push(t));\n }\n return baseValue;\n }\n get isModified() {\n return this._isModified;\n }\n getValidators() {\n return this.getValidatorSource(this._validators);\n }\n getAsyncValidators() {\n return this.getValidatorSource(this._asyncValidators);\n }\n getValidatorSource(validators) {\n if (validators) return Array.isArray(validators) ? [...validators] : [validators];\n return [];\n }\n setValidators(newValidator) {\n this._validators = newValidator;\n super.setValidators(newValidator);\n }\n setAsyncValidators(newValidator) {\n this._asyncValidators = newValidator;\n super.setAsyncValidators(newValidator);\n }\n setValue(value, options) {\n this.parent.changing = true;\n let parsedValue = this.getSanitizedValue(value);\n if (options && options.dirty) this.baseObject[this.keyName] = value;\n this.entityObject[this.keyName] = parsedValue;\n super.setValue(value, options);\n this.bindError();\n this.bindClassName();\n this.executeExpressions();\n this.callPatch();\n if (options && !options.updateChanged && this.root[VALUE_CHANGED_SYNC]) {\n this.root[VALUE_CHANGED_SYNC]();\n }\n this.parent.changing = false;\n }\n getControlValue() {\n return this.getSanitizedValue(this.value);\n }\n bindError() {\n if (this._messageExpression) this._isPassedExpression = this.executeExpression(this._messageExpression, this);\n this.setControlErrorMessages();\n var t = this;\n t[\"errors\"] = this.errors;\n }\n bindClassName() {\n if (this.updateOnElementClass && typeof this.updateOnElementClass === \"function\") {\n let className = this.executeExpression(this._classNameExpression, this);\n let updateElement = this.updateOnElementClass;\n updateElement(className);\n }\n }\n setBackEndErrors(error) {\n Object.keys(error).forEach(key => this.backEndErrors[key] = error[key]);\n this.setControlErrorMessages();\n }\n clearBackEndErrors(errors) {\n if (!errors) this.backEndErrors = {};else Object.keys(errors).forEach(t => delete this.backEndErrors[t]);\n this.setControlErrorMessages();\n }\n markAsTouched(opts) {\n let currentState = this.touched;\n super.markAsTouched(opts);\n if (currentState != this.touched) this.runControlPropChangeExpression([TOUCHED, UNTOUCHED]);\n }\n markAsUntouched(opts) {\n let currentState = this.untouched;\n super.markAsUntouched(opts);\n if (currentState != this.untouched) this.runControlPropChangeExpression([UNTOUCHED, TOUCHED]);\n }\n markAsDirty(opts) {\n let currentState = this._dirty;\n super.markAsDirty(opts);\n this._dirty = true;\n if (currentState != this._dirty) this.runControlPropChangeExpression([DIRTY]);\n }\n markAsPristine(opts) {\n let currentState = this.pristine;\n super.markAsPristine(opts);\n if (currentState != this.pristine) this.runControlPropChangeExpression([PRISTINE]);\n }\n markAsPending(opts) {\n let currentState = this.pending;\n super.markAsDirty(opts);\n if (currentState != this.pending) this.runControlPropChangeExpression([PENDING]);\n }\n runControlPropChangeExpression(propNames) {\n propNames.forEach(name => {\n if (this._controlProp && this._messageExpression && this._controlProp[name] || !this._messageExpression && this.checkErrorMessageStrategy()) this.bindError();\n if (this._classNameControlProp && this._classNameControlProp[name]) this.bindClassName();\n });\n }\n refresh() {\n this.getMessageExpression(this.parent, this.keyName);\n this.bindConditionalControls(DECORATORS.disabled, \"_refDisableControls\");\n this.bindConditionalControls(DECORATORS.error, \"_refMessageControls\");\n this.bindConditionalControls(DECORATORS.elementClass, \"_refClassNameControls\");\n this.executeExpressions();\n this.bindError();\n }\n reset(value, options = {}) {\n if (value !== undefined) this.setValue(value, options);else this.setValue(this.getFormState(this._baseValue), options);\n this._dirty = false;\n }\n commit() {\n this._baseValue = this.value;\n this.callPatch();\n }\n callPatch() {\n this._isModified = this.getValue(this._baseValue) != this.getValue(this.value);\n if (this.parent && this.parent[PATCH]) this.parent[PATCH](this.keyName);\n }\n checkErrorMessageStrategy() {\n let isBind = true;\n switch (this._errorMessageBindingStrategy) {\n case ErrorMessageBindingStrategy.OnSubmit:\n isBind = this.parent.submitted;\n break;\n case ErrorMessageBindingStrategy.OnDirty:\n isBind = this._dirty;\n break;\n case ErrorMessageBindingStrategy.OnTouched:\n isBind = this.touched;\n break;\n case ErrorMessageBindingStrategy.OnDirtyOrTouched:\n isBind = this._dirty || this.touched;\n break;\n case ErrorMessageBindingStrategy.OnDirtyOrSubmit:\n isBind = this._dirty || this.parent.submitted;\n break;\n case ErrorMessageBindingStrategy.OnTouchedOrSubmit:\n isBind = this.touched || this.parent.submitted;\n break;\n default:\n isBind = true;\n }\n return isBind;\n }\n executeExpressions() {\n this.processExpression(\"_refDisableControls\", \"disabled\");\n this.processExpression(\"_refMessageControls\", \"bindError\");\n this.processExpression(\"_refClassNameControls\", \"bindClassName\");\n }\n getMessageExpression(formGroup, keyName) {\n if (formGroup[MODEL_INSTANCE]) {\n let instanceContainer = defaultContainer.get(formGroup[MODEL_INSTANCE].constructor);\n if (instanceContainer) {\n this._messageExpression = instanceContainer.nonValidationDecorators.error.conditionalExpressions[keyName];\n this._controlProp = instanceContainer.nonValidationDecorators.error.controlProp[this.keyName];\n this._classNameExpression = instanceContainer.nonValidationDecorators.elementClass.conditionalExpressions[keyName];\n this._classNameControlProp = instanceContainer.nonValidationDecorators.elementClass.controlProp[keyName];\n if (this._classNameExpression) this.updateOnElementClass = true;\n }\n }\n }\n getSanitizedValue(value) {\n if (this._sanitizers) {\n for (let sanitizer of this._sanitizers) {\n value = SANITIZERS[sanitizer.name](value, sanitizer.config);\n }\n }\n return value;\n }\n bindConditionalControls(decoratorType, refName) {\n this._disableProvider = new DisableProvider(decoratorType, this.entityObject);\n this[refName] = this._disableProvider.zeroArgumentProcess(this, this.keyName);\n this._disableProvider.oneArgumentProcess(this, `${this.keyName}${RXCODE}1`).forEach(t => this[refName].push(t));\n }\n setControlErrorMessages() {\n if (!this._messageExpression && this.checkErrorMessageStrategy() || this._isPassedExpression) {\n this._errorMessages = [];\n if (this.errors) {\n Object.keys(this.errors).forEach(t => {\n if (this.parent) {\n this.parent[CONTROLS_ERROR][this.keyName] = this._errorMessage = this.getErrorMessage(this.errors, t);\n if (!this._errorMessage) {\n let errorObject = ObjectMaker.toJson(t, undefined, [this.errors[t][t]]);\n this.parent[CONTROLS_ERROR][this.keyName] = this._errorMessage = this.getErrorMessage(errorObject, t);\n }\n } else this._errorMessage = this.getErrorMessage(this.errors, t);\n this._errorMessages.push(this._errorMessage);\n });\n } else {\n this._errorMessage = undefined;\n if (this.parent) {\n this.parent[CONTROLS_ERROR][this.keyName] = undefined;\n delete this.parent[CONTROLS_ERROR][this.keyName];\n }\n }\n let backEndErrors = Object.keys(this.backEndErrors);\n if (backEndErrors.length > 0) backEndErrors.forEach(t => {\n this._errorMessages.push(this._errorMessage = this.backEndErrors[t]);\n });\n } else {\n this._errorMessages = [];\n this._errorMessage = undefined;\n }\n this._language = this.getLanguage();\n }\n getLanguage() {\n return ReactiveFormConfig.i18n && ReactiveFormConfig.i18n.language ? ReactiveFormConfig.i18n.language : undefined;\n }\n getErrorMessage(errorObject, keyName) {\n if (errorObject[keyName][MESSAGE]) return errorObject[keyName][MESSAGE];\n return;\n }\n processExpression(propName, operationType) {\n if (this[propName]) for (var controlInfo of this[propName]) {\n let control = controlInfo.isRoot ? ApplicationUtil.getControl(controlInfo.controlPath, ApplicationUtil.getRootFormGroup(this)) : ApplicationUtil.getFormControl(controlInfo.controlPath, this);\n if (control) {\n if (operationType == \"disabled\") {\n let result = this.executeExpression(controlInfo.conditionalExpression, control);\n if (result) control.disable();else control.enable();\n } else if (operationType == \"bindError\") control.bindError();else if (operationType == \"bindClassName\") control.bindClassName();\n }\n }\n }\n executeExpression(expression, control) {\n return expression.call(control.parent[MODEL_INSTANCE], control, ApplicationUtil.getParentModelInstanceValue(this), control.parent[MODEL_INSTANCE]);\n }\n getValue(value) {\n return value !== undefined && value !== null && value !== \"\" ? value : \"\";\n }\n}\nconst OBJECT = \"object\";\nconst BOOLEAN = \"boolean\";\nclass FormDataProvider {\n convertToFormData(jObject, options) {\n return this.convertFormData(jObject, undefined, undefined, options);\n }\n convertFormData(jObject, currentFormData, parentKey, options) {\n let formData = currentFormData || new FormData();\n let propName = '';\n for (var columnName in jObject) {\n propName = !parentKey ? columnName : `${parentKey}[${columnName}]`;\n if (Array.isArray(jObject[columnName])) {\n jObject[columnName].forEach((row, index) => {\n propName = `${columnName}[${index}]`;\n if (typeof row === OBJECT) this.convertFormData(row, formData, propName, options);else this.nonObjectValueBind(row, formData, propName, options);\n });\n } else if (jObject[columnName] !== null && !(jObject[columnName] instanceof Date) && typeof jObject[columnName] === OBJECT && !(jObject[columnName] instanceof File || jObject[columnName] instanceof FileList)) {\n this.convertFormData(jObject[columnName], formData, propName, options);\n } else {\n this.nonObjectValueBind(jObject[columnName], formData, propName, options);\n }\n }\n return formData;\n }\n nonObjectValueBind(value, formData, propName, options) {\n if (typeof value === BOOLEAN) {\n let formValue = value ? true : false;\n formData.append(propName, formValue);\n } else if (value instanceof FileList) {\n for (var i = 0; i < value.length; i++) {\n formData.append(options && options.excludeImageIndex && value.length === 1 ? propName : `${propName}[${i}]`, value.item(i));\n }\n } else {\n if (RegexValidator.isNotBlank(value)) formData.append(propName, value);\n }\n }\n}\nfunction isResetControl(controlName, control, options) {\n let isReset = true;\n if (options) {\n isReset = false;\n if (options.resetType) switch (options.resetType) {\n case ResetFormType.ControlsOnly:\n isReset = control instanceof FormControl;\n break;\n case ResetFormType.ControlsAndFormGroupsOnly:\n isReset = control instanceof FormControl || control instanceof FormGroup;\n break;\n case ResetFormType.FormGroupsOnly:\n isReset = control instanceof FormGroup;\n break;\n case ResetFormType.FormArraysOnly:\n isReset = control instanceof FormArray;\n break;\n case ResetFormType.DefinedPropsOnly:\n isReset = options.value ? Object.keys(options.value).indexOf(controlName) != -1 : false;\n break;\n default:\n isReset = true;\n break;\n }\n if (!isReset && options.with) isReset = options.with.filter(x => x.split('.')[0] == controlName.split('.')[0])[0] !== undefined;\n if (!isReset && options.value && (options.resetType === undefined || options.resetType !== ResetFormType.DefinedPropsOnly)) isReset = true;\n }\n return isReset;\n}\nfunction getNestedOptions(controlName, options) {\n if (options) {\n let jObjectOptions = {};\n if (options.resetType) jObjectOptions.resetType = options.resetType == ResetFormType.FormGroupsOnly || options.resetType == ResetFormType.FormArraysOnly ? ResetFormType.ControlsOnly : options.resetType;\n if (options.with) {\n let nestedControls = options.with.filter(t => t.split('.')[0] == controlName);\n let controlNames = nestedControls.map(x => {\n let splitControls = x.split('.');\n splitControls.splice(0, 1);\n return splitControls.join('.');\n });\n jObjectOptions.with = controlNames;\n }\n if (options.value && options.value[controlName]) jObjectOptions.value = options.value[controlName];\n jObjectOptions = Object.keys(jObjectOptions).length > 0 ? jObjectOptions : undefined;\n return jObjectOptions;\n }\n return undefined;\n}\nclass RxFormGroup extends FormGroup {\n constructor(model, entityObject, controls, validatorOrOpts, asyncValidator) {\n super(controls, validatorOrOpts, asyncValidator);\n this.model = model;\n this.entityObject = entityObject;\n this._modified = {};\n this._isModified = false;\n this.changing = false;\n this.baseObject = {};\n for (var column in this.entityObject) this.baseObject[column] = this.entityObject[column];\n this.formDataProvider = new FormDataProvider();\n }\n bindPrimaryKey(modelInstance, jObject) {\n let instanceContainer = defaultContainer.get(modelInstance.constructor);\n if (instanceContainer) {\n let primaryKeyProp = instanceContainer.properties.filter(x => x.isPrimaryKey)[0];\n if (primaryKeyProp && this.modelInstance[primaryKeyProp.name]) jObject[primaryKeyProp.name] = this.modelInstance[primaryKeyProp.name];\n }\n }\n get modifiedValue() {\n let jObject = {};\n if (Object.keys(this._modified).length > 0) {\n this.bindPrimaryKey(this.modelInstance, jObject);\n for (var columnName in this._modified) {\n if (this.controls[columnName] instanceof RxFormGroup) jObject[columnName] = this.controls[columnName].modifiedValue;else if (this.controls[columnName] instanceof FormArray) {\n let formArray = this.controls[columnName];\n jObject[columnName] = [];\n for (var i = 0; i < this._modified[columnName].length; i++) {\n let modifiedValue = formArray.controls[i].modifiedValue;\n if (Object.keys(modifiedValue).length > 0) jObject[columnName].push(modifiedValue);\n }\n if (jObject[columnName].length == 0) delete jObject[columnName];\n } else jObject[columnName] = this._modified[columnName];\n }\n return jObject;\n }\n return this._modified;\n }\n get isModified() {\n return this._isModified;\n }\n patch(controlName) {\n if (controlName) {\n let control = this.controls[controlName];\n this.processModified(controlName, control);\n } else {\n this.nestedFormsModification();\n }\n this._isModified = Object.keys(this._modified).length > 0;\n if (!this._isModified) this.nestedArrayIsModified();\n if (this.parent && this.parent.patch) this.parent.patch();\n }\n isDirty() {\n let isDirty = false;\n for (let name in this.value) {\n let currentValue = this.modelInstance[name];\n if (!(this.controls[name] instanceof FormGroup || this.controls[name] instanceof FormArray)) {\n isDirty = ApplicationUtil.notEqualTo(this.baseObject[name], currentValue);\n } else if (this.controls[name] instanceof RxFormGroup) isDirty = this.controls[name].isDirty();else if (this.controls[name] instanceof FormArray) {\n for (let formGroup of this.controls[name].controls) {\n isDirty = formGroup.isDirty();\n }\n }\n if (isDirty) break;\n }\n return isDirty;\n }\n resetForm(options) {\n for (let name in this.controls) {\n if (isResetControl(name, this.controls[name], options)) {\n if (this.controls[name] instanceof FormGroup) this.controls[name].resetForm(getNestedOptions(name, options));else if (this.controls[name] instanceof FormArray) {\n this.controls[name].resetForm(options && options.value ? options.value[name] : undefined);\n } else {\n if (options && options.value && RegexValidator.isNotBlank(options.value[name])) this.controls[name].reset(options.value[name]);else this.controls[name].reset();\n }\n }\n }\n }\n commit() {\n for (let name in this.controls) {\n if (this.controls[name] instanceof FormGroup) this.controls[name].commit();else if (this.controls[name] instanceof FormArray) {\n this.controls[name].commit();\n } else {\n this.controls[name].commit();\n }\n }\n }\n patchModelValue(value, options) {\n if (value) {\n for (let name in this.controls) {\n if (this.controls[name] instanceof RxFormGroup && value[name]) this.controls[name].patchModelValue(value[name], options);else if (this.controls[name] instanceof FormArray && Array.isArray(value[name])) {\n let index = 0;\n for (let formGroup of this.controls[name].controls) {\n if (value[name][index]) formGroup.patchModelValue(value[name][index], options);\n index = index + 1;\n }\n } else if (value[name] !== undefined) this.controls[name].patchValue(value[name], options);\n }\n }\n }\n getErrorSummary(onlyMessage) {\n let jObject = {};\n Object.keys(this.controls).forEach(columnName => {\n if (this.controls[columnName] instanceof FormGroup) {\n let error = this.controls[columnName].getErrorSummary(false);\n if (Object.keys(error).length > 0) jObject[columnName] = error;\n } else if (this.controls[columnName] instanceof FormArray) {\n let index = 0;\n for (let formGroup of this.controls[columnName].controls) {\n let error = formGroup.getErrorSummary(false);\n if (Object.keys(error).length > 0) {\n error.index = index;\n if (!jObject[columnName]) jObject[columnName] = [];\n jObject[columnName].push(error);\n }\n index++;\n }\n } else {\n if (this.controls[columnName].errors) {\n let error = this.controls[columnName].errors;\n if (onlyMessage) for (let validationName in error) jObject[columnName] = error[validationName].message;else jObject[columnName] = error;\n }\n }\n });\n return jObject;\n }\n valueChangedSync() {\n Object.keys(this.controls).forEach(columnName => {\n if (!(this.controls[columnName] instanceof FormArray || this.controls[columnName] instanceof RxFormArray) && !(this.controls[columnName] instanceof FormGroup || this.controls[columnName] instanceof RxFormGroup) && !(this.entityObject[columnName] instanceof FormControl || this.entityObject[columnName] instanceof RxFormControl) && this.controls[columnName].getControlValue && ApplicationUtil.notEqualTo(this.controls[columnName].getControlValue(), this.entityObject[columnName])) {\n this.controls[columnName].setValue(this.entityObject[columnName], {\n updateChanged: true\n });\n } else if (this.controls[columnName] instanceof FormArray || this.controls[columnName] instanceof RxFormArray) {\n for (let formGroup of this.controls[columnName].controls) {\n formGroup.valueChangedSync();\n }\n } else if (this.controls[columnName] instanceof RxFormGroup) {\n this.controls[columnName].valueChangedSync();\n }\n });\n }\n refreshDisable() {\n Object.keys(this.controls).forEach(columnName => {\n if (!(this.controls[columnName] instanceof FormArray || this.controls[columnName] instanceof RxFormArray) && !(this.controls[columnName] instanceof FormGroup || this.controls[columnName] instanceof RxFormGroup)) {\n this.controls[columnName].refresh();\n } else if (this.controls[columnName] instanceof RxFormGroup) {\n this.controls[columnName].refreshDisable();\n }\n });\n }\n bindErrorMessages() {\n Object.keys(this.controls).forEach(columnName => {\n if (!(this.controls[columnName] instanceof FormArray || this.controls[columnName] instanceof RxFormArray) && !(this.controls[columnName] instanceof FormGroup || this.controls[columnName] instanceof RxFormGroup)) {\n this.controls[columnName].bindError();\n } else if (this.controls[columnName] instanceof RxFormGroup) {\n this.controls[columnName].bindErrorMessages();\n }\n });\n }\n get submitted() {\n return this._submitted;\n }\n set submitted(value) {\n this._submitted = value;\n Object.keys(this.controls).forEach(columnName => {\n if (this.controls[columnName] instanceof FormArray) {\n let formArray = this.controls[columnName];\n for (let formGroup of formArray.controls) formGroup.submitted = value;\n } else if (this.controls[columnName] instanceof FormGroup) {\n this.controls[columnName].submitted = value;\n } else this.controls[columnName].bindError();\n });\n }\n get modelInstanceValue() {\n return clone(this.entityObject);\n }\n get modelInstance() {\n return this.entityObject;\n }\n get controlsError() {\n return this.getErrorSummary(true);\n }\n toFormData(options) {\n return this.formDataProvider.convertToFormData(this.value, options);\n }\n processModified(controlName, control) {\n if (control.isModified) this._modified[controlName] = control.value;else delete this._modified[controlName];\n this._isModified = Object.keys(this._modified).length > 0;\n }\n nestedArrayIsModified() {\n for (var controlName in this.controls) {\n if (this.controls[controlName] instanceof RxFormArray) this._isModified = this.controls[controlName].isModified;\n if (this._isModified) break;\n }\n }\n setBackEndErrors(errors) {\n Object.keys(errors).forEach(controlName => {\n if (this.controls[controlName]) {\n if (this.controls[controlName] instanceof FormGroup) this.controls[controlName].setBackEndErrors(errors[controlName]);else this.controls[controlName].setBackEndErrors(errors[controlName]);\n }\n });\n }\n clearBackEndErrors(errors) {\n let clearErrors = errors ? Object.keys(errors) : Object.keys(this.controls);\n clearErrors.forEach(controlName => {\n if (this.controls[controlName]) {\n if (this.controls[controlName] instanceof FormGroup) errors ? this.controls[controlName].clearBackEndErrors(errors[controlName]) : this.controls[controlName].clearBackEndErrors();else errors ? this.controls[controlName].clearBackEndErrors(errors[controlName]) : this.controls[controlName].clearBackEndErrors();\n }\n });\n }\n nestedFormsModification() {\n for (var controlName in this.controls) {\n if (this.controls[controlName] instanceof RxFormGroup) this.processModified(controlName, this.controls[controlName]);else if (this.controls[controlName] instanceof RxFormArray) {\n if (this.controls[controlName].isModified) {\n let formGroups = this.controls[controlName].controls;\n this._modified[controlName] = [];\n for (var formGroup of formGroups) {\n if (formGroup.isModified) {\n if (!this._modified[controlName]) this._modified[controlName] = [];\n this._modified[controlName].push(formGroup.modifiedValue);\n }\n }\n if (this._modified[controlName].length == 0) delete this._modified[controlName];\n } else if (this._modified[controlName]) delete this._modified[controlName];\n }\n }\n }\n}\nclass FormProvider {\n static ProcessRule(control, config, isDynamicConfig = false) {\n if (config && config.expressionProcessed) return true;\n const formGroupValue = ApplicationUtil.getParentObjectValue(control);\n const parentObject = control.parent ? ApplicationUtil.cloneValue(control.parent.value) : undefined;\n let modelInstance = undefined;\n if (control.parent && control.parent instanceof RxFormGroup) modelInstance = control.parent.modelInstance;\n if (parentObject) {\n this.updateFormControlValue(parentObject, control.parent.controls, control, config);\n this.forDisableUpdate(parentObject, config);\n } else if (config.conditionalExpression) return false;\n return Linq.execute(formGroupValue, config, parentObject, modelInstance, isDynamicConfig);\n }\n static updateFormControlValue(parentObject, controls, control, config) {\n for (var controlName in parentObject) {\n if (!(parentObject[controlName] instanceof Object)) if (controls[controlName] === control) {\n parentObject[controlName] = control.value;\n break;\n }\n }\n }\n static forDisableUpdate(parentObject, config) {\n if (config.disableConfig) Object.keys(config.disableConfig).forEach(column => {\n parentObject[column] = config.disableConfig[column];\n });\n }\n}\nclass ValidatorValueChecker {\n static pass(control, config) {\n if (FormProvider.ProcessRule(control, config)) return RegexValidator.isNotBlank(control.value);else return false;\n }\n static passArrayValue(control, config) {\n if (FormProvider.ProcessRule(control, config)) return typeof control.value === \"string\" ? RegexValidator.isNotBlank(control.value) : control.value instanceof Array;else return false;\n }\n}\nconst ARRAY_CONFIG = \"ArrayConfig\";\nconst FIELD_CONFIG = \"FieldConfig\";\nconst IP_CONFIG = \"IpConfig\";\nconst NUMBER_CONFIG = \"NumberConfig\";\nconst PASSWORD_CONFIG = \"PasswordConfig\";\nconst PATTERN_CONFIG = \"PatternConfig\";\nconst RANGE_CONFIG = \"RangeConfig\";\nconst RELATIONAL_OPERATOR_CONFIG = \"RelationalOperatorConfig\";\nconst CONFIG_REQUIRED_FIELDS = {\n [ARRAY_CONFIG]: [\"matchValues\"],\n [FIELD_CONFIG]: [\"fieldName\"],\n [IP_CONFIG]: [\"version\"],\n [PASSWORD_CONFIG]: [\"validation\"],\n [NUMBER_CONFIG]: [\"value\"],\n [PATTERN_CONFIG]: [\"expression\"],\n [RANGE_CONFIG]: [\"minimumNumber\", \"maximumNumber\"]\n};\nfunction getConfigObject(config, control, configName = '') {\n return config != undefined && config != true ? configProvider(control, config, configName) : {};\n}\nfunction configProvider(control, config, configName) {\n if (config.dynamicConfig) {\n let currentConfig = FormProvider.ProcessRule(control, clone(config), true);\n if (typeof currentConfig != \"boolean\") {\n currentConfig.conditionalExpression = config.conditionalExpression;\n currentConfig.dynamicConfig = config.dynamicConfig;\n Object.keys(config).forEach(t => {\n if (t != \"conditionalExpression\" && t != \"dynamicConfig\" || currentConfig[t] === undefined) {\n currentConfig[t] = config[t];\n }\n });\n return currentConfig;\n } else return config;\n }\n return checkRequiredProps(config, configName);\n}\nfunction checkRequiredProps(config, configName) {\n let props = CONFIG_REQUIRED_FIELDS[configName];\n if (configName) {\n props.forEach(prop => {\n if (config[prop] === undefined) throw new Error(`Pass the property of '${prop}' with value in the ${configName}, otherwise it won't work.`);\n });\n }\n return config;\n}\nconst alphabet = {\n 'danish': /^[A-ZÆØÅ]+$/i,\n 'french': /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,\n 'german': /^[A-ZÄÖÜß]+$/i,\n 'spanish': /^[a-zñáéíóúü]+$/i,\n 'russian': /^[А-ЯЁ]+$/i\n};\nconst alphaWithWhitespace = {\n 'danish': /^[A-ZÆØÅ\\s]+$/i,\n 'french': /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ\\s]+$/i,\n 'german': /^[A-ZÄÖÜß\\s]+$/i,\n 'spanish': /^[a-zñáéíóúü\\s]+$/i,\n 'russian': /^[А-ЯЁ\\s]+$/i\n};\nconst alphanumeric = {\n 'danish': /^[0-9A-ZÆØÅ]+$/i,\n 'french': /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,\n 'german': /^[0-9A-ZÄÖÜß]+$/i,\n 'spanish': /^[0-9a-zñáéíóúü]+$/i,\n 'russian': /^[0-9А-ЯЁ]+$/i\n};\nconst alphanumericWithWitespace = {\n 'danish': /^[0-9A-ZÆØÅ\\s]+$/i,\n 'french': /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ\\s]+$/i,\n 'german': /^[0-9A-ZÄÖÜß\\s]+$/i,\n 'spanish': /^[0-9a-zñáéíóúü\\s]+$/i,\n 'russian': /^[0-9А-ЯЁ\\s]+$/i\n};\nfunction alphaValidation(configModel, control, regExps, key) {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n regExps = getRegex(key, regExps, config);\n var isValid = !config || !config.allowWhiteSpace ? RegexValidator.isValid(control.value, regExps[0]) : RegexValidator.isValid(control.value, regExps[1]);\n if (!isValid) return ObjectMaker.toJson(key, config, [control.value]);\n }\n return ObjectMaker.null();\n}\nfunction getRegex(key, regExps, config) {\n if (config.allowCharacters) if (config.allowWhiteSpace) regExps[1] = new RegExp(`^[0-9a-zA-Z @${config.allowCharacters}]+$`, ``);else regExps[0] = new RegExp(`^[0-9a-zA-Z @${config.allowCharacters}]+$`, ``);\n switch (key) {\n case \"alpha\":\n var alphaLocale = config.locale ? config.locale : ReactiveFormConfig.json && ReactiveFormConfig.json.defaultValidationLocale && ReactiveFormConfig.json.defaultValidationLocale.alpha ? ReactiveFormConfig.json.defaultValidationLocale.alpha : \"\";\n return [alphaLocale && alphaLocale in alphabet ? alphabet[alphaLocale] : regExps[0], alphaLocale && alphaLocale in alphaWithWhitespace ? alphaWithWhitespace[alphaLocale] : regExps[1]];\n break;\n case \"alphaNumeric\":\n var alphaNumericLocale = config.locale ? config.locale : ReactiveFormConfig.json && ReactiveFormConfig.json.defaultValidationLocale && ReactiveFormConfig.json.defaultValidationLocale.alphaNumeric ? ReactiveFormConfig.json.defaultValidationLocale.alphaNumeric : \"\";\n return [alphaNumericLocale && alphaNumericLocale in alphanumeric ? alphanumeric[alphaNumericLocale] : regExps[0], alphaNumericLocale && alphaNumericLocale in alphanumericWithWitespace ? alphanumericWithWitespace[alphaNumericLocale] : regExps[1]];\n break;\n }\n}\nfunction alphaValidator(configModel) {\n return control => {\n return alphaValidation(configModel, control, [RegExRule.alpha, RegExRule.alphaWithSpace], AnnotationTypes.alpha);\n };\n}\nfunction alphaNumericValidator(configModel) {\n return control => {\n return alphaValidation(configModel, control, [RegExRule.alphaNumeric, RegExRule.alphaNumericWithSpace], AnnotationTypes.alphaNumeric);\n };\n}\nfunction compareValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control, FIELD_CONFIG);\n const compareControl = ApplicationUtil.getFormControl(config.fieldName, control);\n const controlValue = control.value;\n const compareControlValue = compareControl ? compareControl.value : '';\n if (RegexValidator.isNotBlank(controlValue) || RegexValidator.isNotBlank(compareControlValue)) {\n if (!(compareControl && compareControl.value === controlValue)) return ObjectMaker.toJson(AnnotationTypes.compare, config, [controlValue, compareControlValue]);\n }\n return ObjectMaker.null();\n };\n}\nfunction containsValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n let failed = false;\n const values = config.values ? config.values : [config.value];\n for (let value of values) {\n failed = control.value.indexOf(value) == -1;\n if (!failed) break;\n }\n if (failed) return ObjectMaker.toJson(AnnotationTypes.contains, config, [control.value, config.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction checkLength(length, checks) {\n let isPassed = false;\n for (let check of checks) {\n isPassed = check == length;\n if (isPassed) break;\n }\n return isPassed;\n}\nfunction calculate(numbers) {\n let numberSum = 0;\n for (var i = 0; i < numbers.length; i++) numberSum += parseInt(numbers.substring(i, i + 1));\n let deltas = new Array(0, 1, 2, 3, 4, -4, -3, -2, -1, 0);\n for (var i = numbers.length - 1; i >= 0; i -= 2) {\n numberSum += deltas[parseInt(numbers.substring(i, i + 1))];\n }\n let mod = numberSum % 10;\n mod = 10 - mod;\n if (mod == 10) mod = 0;\n return mod;\n}\nfunction creditCardValidator(configModel) {\n let cardDigits = {\n AmericanExpress: [15],\n DinersClub: [14, 16, 19],\n Discover: [16, 19],\n JCB: [16, 19],\n Maestro: [12, 16, 19],\n MasterCard: [16],\n Visa: [13, 16, 19]\n };\n function validate(creditCardNumber) {\n var digit = parseInt(creditCardNumber.substring(creditCardNumber.length - 1, creditCardNumber.length));\n return calculate(creditCardNumber.substring(0, creditCardNumber.length - 1)) == parseInt(String(digit)) ? !0 : !1;\n }\n function getCardProviderName(cardNumber) {\n var cardProviderName = \"\";\n return /^(5018|5020|5038|5612|5893|6304|6759|6761|6762|6763|0604|6390)\\d+$/.test(cardNumber) ? cardProviderName = \"Maestro\" : /^5[1-5]/.test(cardNumber) ? cardProviderName = \"MasterCard\" : /^4/.test(cardNumber) ? cardProviderName = \"Visa\" : /^3[47]/.test(cardNumber) ? cardProviderName = \"AmericanExpress\" : /^(?:2131|1800|35)/.test(cardNumber) ? cardProviderName = \"JCB\" : /^3(?:0[0-5]|[68])/.test(cardNumber) ? cardProviderName = \"DinersClub\" : /^6(?:011|5)/.test(cardNumber) && (cardProviderName = \"Discover\"), cardProviderName;\n }\n return control => {\n const controlValue = control.value;\n let config = getConfigObject(configModel, control);\n const parentObject = control.parent ? control.parent.value : undefined;\n if (FormProvider.ProcessRule(control, config)) {\n if (RegexValidator.isNotBlank(controlValue)) {\n let isValid = false;\n let cardTypes = config.fieldName && parentObject[config.fieldName] ? [parentObject[config.fieldName]] : config.creditCardTypes;\n let cardType = '';\n for (let creditCardType of cardTypes) {\n isValid = checkLength(controlValue.length, cardDigits[creditCardType]) && getCardProviderName(controlValue) == creditCardType && validate(controlValue);\n cardType = creditCardType;\n if (isValid) break;\n }\n if (!isValid) return ObjectMaker.toJson(AnnotationTypes.creditCard, config, [controlValue, cardType]);\n }\n }\n return ObjectMaker.null();\n };\n}\nfunction regexValidation(configModel, control, regExp, key) {\n let config = getConfigObject(configModel, control);\n return validate(config, control, regExp, key);\n}\nfunction validate(config, control, regExp, key) {\n if (ValidatorValueChecker.pass(control, config)) {\n if (!RegexValidator.isValid(control.value, regExp)) return ObjectMaker.toJson(key, config, [control.value]);\n }\n return ObjectMaker.null();\n}\nfunction digitValidator(configModel) {\n return control => {\n return regexValidation(configModel, control, RegExRule.onlyDigit, AnnotationTypes.digit);\n };\n}\nfunction emailValidator(configModel) {\n return control => {\n return regexValidation(configModel, control, RegExRule.basicEmail, AnnotationTypes.email);\n };\n}\nfunction hexColorValidator(configModel) {\n return control => {\n return regexValidation(configModel, control, RegExRule.strictHexColor, AnnotationTypes.hexColor);\n };\n}\nfunction lowercaseValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n if (!(control.value === control.value.toLowerCase())) return ObjectMaker.toJson(AnnotationTypes.lowerCase, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nconst OPERATORS = {\n lessThan: \"<\",\n greaterThan: \">\",\n lessThanEqualTo: \"<=\",\n greaterThanEqualTo: \">=\"\n};\nfunction runCondition$1(leftValue, rightValue, operator) {\n let result = false;\n switch (operator) {\n case OPERATORS.lessThan:\n case OPERATORS.greaterThan:\n result = leftValue > rightValue;\n break;\n case OPERATORS.lessThanEqualTo:\n case OPERATORS.greaterThanEqualTo:\n result = leftValue >= rightValue;\n break;\n }\n return result;\n}\nfunction dateChecker(control, config, operationType) {\n config = getConfigObject(config, control);\n var dateProvider = new DateProvider();\n if (FormProvider.ProcessRule(control, config)) {\n if (RegexValidator.isNotBlank(control.value)) {\n let checkDate = dateProvider.getCompareDate(config, control);\n if (dateProvider.isDate(control.value) || dateProvider.isValid(control.value, config)) {\n let currentControlValue = dateProvider.getDate(control.value);\n let isValid = operationType == AnnotationTypes.minDate ? runCondition$1(currentControlValue, checkDate, config.operator || OPERATORS.greaterThanEqualTo) : runCondition$1(checkDate, currentControlValue, config.operator || OPERATORS.lessThanEqualTo);\n if (!isValid) return ObjectMaker.toJson(operationType, config, [control.value, checkDate]);\n } else return ObjectMaker.toJson(operationType, config, [control.value, checkDate]);\n }\n }\n return ObjectMaker.null();\n}\nfunction validateDate(control, config, operationType) {\n config = getConfigObject(config, control);\n var dateProvider = new DateProvider();\n if (FormProvider.ProcessRule(control, config)) {\n if (RegexValidator.isNotBlank(control.value)) {\n if (!dateProvider.isDate(control.value) && !dateProvider.isValid(control.value, config)) {\n return ObjectMaker.toJson(operationType, config, [control.value]);\n }\n }\n }\n return ObjectMaker.null();\n}\nfunction maxDateValidator(configModel) {\n return control => {\n return dateChecker(control, configModel, AnnotationTypes.maxDate);\n };\n}\nfunction maxLengthValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control, NUMBER_CONFIG);\n if (ValidatorValueChecker.pass(control, config)) {\n if (!(control.value.length <= config.value)) return ObjectMaker.toJson(AnnotationTypes.maxLength, config, [control.value, config.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction maxNumberValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control, NUMBER_CONFIG);\n if (ValidatorValueChecker.pass(control, config)) {\n if (!(parseFloat(control.value) <= config.value)) return ObjectMaker.toJson(AnnotationTypes.maxNumber, config, [control.value, config.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction minDateValidator(configModel) {\n return control => {\n return dateChecker(control, configModel, AnnotationTypes.minDate);\n };\n}\nfunction minLengthValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control, NUMBER_CONFIG);\n if (ValidatorValueChecker.pass(control, config)) {\n if (!(String(control.value).length >= config.value)) return ObjectMaker.toJson(AnnotationTypes.minLength, config, [control.value, config.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction minNumberValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control, NUMBER_CONFIG);\n if (ValidatorValueChecker.pass(control, config)) {\n if (!(parseFloat(control.value) >= config.value)) return ObjectMaker.toJson(AnnotationTypes.minNumber, config, [control.value, config.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction passwordValidator(configModel) {\n function getMessageObject(jObject, keyName) {\n if (!jObject.message && !jObject.messageKey) {\n let message = ObjectMaker.getPasswordMessage();\n jObject.message = message && typeof message == \"string\" ? message : ApplicationUtil.isObject(message) ? message[keyName] : \"\";\n if (!jObject.message) jObject.message = message[\"password\"];\n jObject.messageKey = \"\";\n }\n return jObject;\n }\n return control => {\n let config = getConfigObject(configModel, control, PASSWORD_CONFIG);\n let controlValue = control.value;\n if (RegexValidator.isNotBlank(controlValue)) {\n let validation = RegexValidator.isValidPassword(config.validation, controlValue);\n let jObject = {};\n jObject.message = config.message && config.message[validation.keyName] ? config.message[validation.keyName] : typeof config.message == \"string\" ? config.message : '';\n jObject.messageKey = config.messageKey && config.messageKey[validation.keyName] ? config.messageKey[validation.keyName] : typeof config.messageKey == \"string\" ? config.messageKey : \"\";\n jObject = getMessageObject(jObject, validation.keyName);\n if (!validation.isValid) return ObjectMaker.toJson(AnnotationTypes.password, jObject, [controlValue]);\n }\n return ObjectMaker.null();\n };\n}\nfunction rangeValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control, RANGE_CONFIG);\n if (ValidatorValueChecker.pass(control, config)) {\n if (!((control.value || control.value === 0) && parseFloat(control.value) >= config.minimumNumber && parseFloat(control.value) <= config.maximumNumber)) return ObjectMaker.toJson(AnnotationTypes.range, config, [control.value, config.minimumNumber, config.maximumNumber]);\n }\n return ObjectMaker.null();\n };\n}\nfunction uppercaseValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n if (!(control.value === control.value.toUpperCase())) return ObjectMaker.toJson(AnnotationTypes.upperCase, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction requiredValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (FormProvider.ProcessRule(control, config)) {\n if (!RegexValidator.isNotBlank(control.value)) {\n return ObjectMaker.toJson(AnnotationTypes.required, config, []);\n }\n }\n return ObjectMaker.null();\n };\n}\nfunction patternValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control, PATTERN_CONFIG);\n if (ValidatorValueChecker.pass(control, config)) {\n for (var pattern in config.expression) if (!RegexValidator.isValid(control.value, config.expression[pattern])) return ObjectMaker.toJson(pattern, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction timeValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n let isValid = config.allowSeconds ? RegexValidator.isValid(control.value, RegExRule.timeWithSeconds) : RegexValidator.isValid(control.value, RegExRule.time);\n if (!isValid) return ObjectMaker.toJson(AnnotationTypes.time, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction urlValidation(configModel, control) {\n var regex = RegExRule.url;\n let config = getConfigObject(configModel, control);\n if (config && config.urlValidationType) {\n switch (config.urlValidationType) {\n case 1:\n regex = RegExRule.url;\n break;\n case 2:\n regex = RegExRule.localhostUrl;\n break;\n case 3:\n regex = RegExRule.interanetUrl;\n break;\n }\n }\n return validate(config, control, regex, AnnotationTypes.url);\n}\nfunction urlValidator(configModel) {\n return control => {\n return urlValidation(configModel, control);\n };\n}\nfunction jsonValidator(configModel) {\n function process(value) {\n var result = false;\n try {\n var json = JSON.parse(value);\n result = !!json && typeof json === 'object';\n } catch (ex) {\n result = false;\n }\n return result;\n }\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n if (!process(control.value)) return ObjectMaker.toJson(AnnotationTypes.json, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nconst operatorOpposite = {\n [AnnotationTypes.greaterThan]: AnnotationTypes.lessThan,\n [AnnotationTypes.lessThan]: AnnotationTypes.greaterThan,\n [AnnotationTypes.greaterThanEqualTo]: AnnotationTypes.lessThanEqualTo,\n [AnnotationTypes.lessThanEqualTo]: AnnotationTypes.greaterThanEqualTo\n};\nfunction relationalCheck(control, config, relationalOperatorName) {\n config = getConfigObject(config, control);\n const matchControl = config.fieldName ? ApplicationUtil.getFormControl(config.fieldName, control) : undefined;\n const matchControlValue = matchControl ? matchControl.value : config.value !== undefined ? config.value : '';\n if (FormProvider.ProcessRule(control, config)) {\n if (config.isArrayControl) return arrayControlValidation(control, config, relationalOperatorName);\n if (isValid$1(control, matchControlValue, relationalOperatorName) === false) return ObjectMaker.toJson(relationalOperatorName, config, [control.value, matchControlValue]);\n }\n return ObjectMaker.null();\n}\nfunction isValid$1(control, matchControlValue, relationalOperatorName) {\n if (RegexValidator.isNotBlank(control.value) && RegexValidator.isNotBlank(matchControlValue)) {\n let isValid = false;\n switch (relationalOperatorName) {\n case AnnotationTypes.greaterThan:\n isValid = parseFloat(control.value) > parseFloat(matchControlValue);\n break;\n case AnnotationTypes.lessThan:\n isValid = parseFloat(control.value) < parseFloat(matchControlValue);\n break;\n case AnnotationTypes.greaterThanEqualTo:\n isValid = parseFloat(control.value) >= parseFloat(matchControlValue);\n break;\n case AnnotationTypes.lessThanEqualTo:\n isValid = parseFloat(control.value) <= parseFloat(matchControlValue);\n break;\n }\n return isValid;\n }\n return null;\n}\nfunction setTimeFunc(invalidateControls) {\n let timeOut = setTimeout(() => {\n invalidateControls.forEach(t => {\n t.updateValueAndValidity();\n });\n clearTimeout(timeOut);\n }, 200);\n}\nfunction arrayControlValidation(control, config, relationalOperatorName) {\n let formArray = ApplicationUtil.getParentFormArray(control);\n let parentFormGroup = control.parent ? control.parent : undefined;\n let oppositeOperator = operatorOpposite[relationalOperatorName];\n let updateValidityControls = [];\n if (formArray && parentFormGroup && formArray.controls.length > 1) {\n let indexOf = formArray.controls.indexOf(parentFormGroup);\n let fieldName = ApplicationUtil.getFormControlName(control);\n let valid = true;\n if (indexOf > 0) valid = validateControl(formArray, control, indexOf - 1, fieldName, oppositeOperator, relationalOperatorName, updateValidityControls);\n if (valid && formArray.controls.length > indexOf + 1) valid = validateControl(formArray, control, indexOf + 1, fieldName, relationalOperatorName, relationalOperatorName, updateValidityControls);\n if (updateValidityControls.length > 0) setTimeFunc(updateValidityControls);\n if (valid === false) return ObjectMaker.toJson(relationalOperatorName, config, [control.value]);\n }\n return ObjectMaker.null();\n}\nfunction validateControl(formArray, control, indexOf, fieldName, oppositeOperator, relationalOperatorName, updateValidityControls) {\n let valid = false;\n let formGroup = formArray.controls[indexOf];\n if (formGroup && formGroup.controls) {\n let formControl = formGroup.controls[fieldName];\n valid = isValid$1(control, formControl.value, oppositeOperator);\n if (valid && formControl.errors && formControl.errors[relationalOperatorName]) updateValidityControls.push(formControl);\n }\n return valid;\n}\nfunction greaterThanValidator(configModel) {\n return control => {\n return relationalCheck(control, configModel, AnnotationTypes.greaterThan);\n };\n}\nfunction greaterThanEqualToValidator(configModel) {\n return control => {\n return relationalCheck(control, configModel, AnnotationTypes.greaterThanEqualTo);\n };\n}\nfunction lessThanEqualToValidator(configModel) {\n return control => {\n return relationalCheck(control, configModel, AnnotationTypes.lessThanEqualTo);\n };\n}\nfunction lessThanValidator(configModel) {\n return control => {\n return relationalCheck(control, configModel, AnnotationTypes.lessThan);\n };\n}\nfunction choiceValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (FormProvider.ProcessRule(control, config)) {\n if (control.value instanceof Array) {\n config.minLength = config.minLength == undefined ? 0 : config.minLength;\n config.maxLength = config.maxLength == undefined ? 0 : config.maxLength;\n if (control.value.length < config.minLength || config.maxLength !== 0 && control.value.length > config.maxLength) return ObjectMaker.toJson(AnnotationTypes.choice, config, [control.value]);\n }\n }\n return ObjectMaker.null();\n };\n}\nfunction differentValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control, FIELD_CONFIG);\n if (ValidatorValueChecker.pass(control, config)) {\n const differentControl = ApplicationUtil.getFormControl(config.fieldName, control);\n const differentControlValue = differentControl ? differentControl.value : '';\n if (!(differentControl && differentControl.value != control.value)) return ObjectMaker.toJson(AnnotationTypes.different, config, [control.value, differentControlValue]);\n }\n return ObjectMaker.null();\n };\n}\nfunction numericValidator(configModel) {\n return control => {\n if (configModel && (!control[VALIDATOR_CONFIG$2] || !control[VALIDATOR_CONFIG$2][AnnotationTypes.numeric])) ApplicationUtil.configureControl(control, configModel, AnnotationTypes.numeric);\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n if (!RegexValidator.isValid(control.value, ApplicationUtil.numericValidation(config.allowDecimal, config.acceptValue))) return ObjectMaker.toJson(AnnotationTypes.numeric, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction evenValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n if (!(control.value % 2 == 0)) return ObjectMaker.toJson(AnnotationTypes.even, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction oddValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n if (!!(control.value % 2 == 0) || !ApplicationUtil.isNumeric(control.value)) return ObjectMaker.toJson(AnnotationTypes.odd, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction factorValidator(configModel) {\n function positiveFactors(dividend, value) {\n let isPositive = false;\n for (var index = 1; index <= Math.floor(Math.sqrt(dividend)); index += 1) {\n if (dividend % index === 0) {\n if (index == value) isPositive = true;\n if (dividend / index !== index) if (dividend / index == value) isPositive = true;\n if (isPositive) break;\n }\n }\n return isPositive;\n }\n return control => {\n let config = getConfigObject(configModel, control);\n const dividendField = control.parent && config.fieldName ? ApplicationUtil.getFormControl(config.fieldName, control) : undefined;\n const dividend = config.fieldName && dividendField ? dividendField.value : config.dividend;\n if (FormProvider.ProcessRule(control, config)) {\n if (RegexValidator.isNotBlank(control.value) && dividend > 0) {\n if (!RegexValidator.isValid(control.value, RegExRule.onlyDigit) || !positiveFactors(dividend, parseInt(control.value))) return ObjectMaker.toJson(AnnotationTypes.factor, config, [control.value]);\n }\n }\n return ObjectMaker.null();\n };\n}\nfunction leapYearValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n var isValid = control.value % 100 === 0 ? control.value % 400 === 0 : control.value % 4 === 0;\n if (!isValid) return ObjectMaker.toJson(AnnotationTypes.leapYear, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction allOfValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control, ARRAY_CONFIG);\n if (ValidatorValueChecker.passArrayValue(control, config)) {\n var testResult = false;\n for (let value of config.matchValues) {\n testResult = control.value.some(y => y == value);\n if (!testResult) break;\n }\n if (!testResult) return ObjectMaker.toJson(AnnotationTypes.allOf, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction oneOfValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control, ARRAY_CONFIG);\n if (ValidatorValueChecker.passArrayValue(control, config)) {\n var testResult = false;\n for (let value of config.matchValues) {\n let matchValue = ApplicationUtil.lowerCaseWithTrim(value);\n testResult = Array.isArray(control.value) ? control.value.some(y => ApplicationUtil.lowerCaseWithTrim(y) === matchValue) : ApplicationUtil.lowerCaseWithTrim(control.value) === matchValue;\n if (testResult) break;\n }\n if (!testResult) return ObjectMaker.toJson(AnnotationTypes.oneOf, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction noneOfValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control, ARRAY_CONFIG);\n if (FormProvider.ProcessRule(control, config)) {\n var testResult = false;\n for (let value of config.matchValues) {\n let matchValue = ApplicationUtil.lowerCaseWithTrim(value);\n testResult = Array.isArray(control.value) ? control.value.some(y => ApplicationUtil.lowerCaseWithTrim(y) === matchValue) : ApplicationUtil.lowerCaseWithTrim(control.value) === matchValue;\n if (testResult) break;\n }\n if (testResult) return ObjectMaker.toJson(AnnotationTypes.noneOf, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction macValidator(configModel) {\n return control => {\n return regexValidation(configModel, control, RegExRule.macId, AnnotationTypes.mac);\n };\n}\nfunction asciiValidator(configModel) {\n return control => {\n return regexValidation(configModel, control, RegExRule.ascii, AnnotationTypes.ascii);\n };\n}\nfunction dataUriValidator(configModel) {\n return control => {\n return regexValidation(configModel, control, RegExRule.dataUri, AnnotationTypes.dataUri);\n };\n}\nfunction portValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n let isValid = RegexValidator.isValid(control.value, RegExRule.onlyDigit) && control.value >= 0 && control.value <= 65535;\n if (!isValid) return ObjectMaker.toJson(AnnotationTypes.port, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction latLongValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n let splitText = control.value.split(',');\n if (!(splitText.length > 1 && RegexValidator.isValid(splitText[0], RegExRule.lat) && RegexValidator.isValid(splitText[1], RegExRule.long))) return ObjectMaker.toJson(AnnotationTypes.latLong, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction extensionValidator(configModel) {\n return (control, files) => {\n let config = getConfigObject(configModel, control);\n if (!control[VALIDATOR_CONFIG$2] || !control[VALIDATOR_CONFIG$2][AnnotationTypes.extension]) ApplicationUtil.configureControl(control, config, AnnotationTypes.extension);\n if (files && FormProvider.ProcessRule(control, config)) {\n if (RegexValidator.isNotBlank(control.value)) {\n let testResult = true;\n let extension = '';\n for (var i = 0; i < files.length; i++) {\n let file = files.item(i);\n let splitText = file.name.split(\".\");\n extension = splitText[splitText.length - 1];\n let result = config.extensions.filter(t => {\n return extension.toLowerCase() == t.toLowerCase();\n })[0];\n if (!result && !configModel.isExcludeExtensions) {\n testResult = false;\n break;\n } else {\n if (result && configModel.isExcludeExtensions) {\n testResult = false;\n break;\n }\n }\n }\n if (!testResult) return ObjectMaker.toJson(AnnotationTypes.extension, config, [extension, config.extensions.join(\",\")]);\n }\n }\n return ObjectMaker.null();\n };\n}\nfunction fileSizeValidator(configModel) {\n return (control, files) => {\n let config = getConfigObject(configModel, control);\n if (!control[VALIDATOR_CONFIG$2] || !control[VALIDATOR_CONFIG$2][AnnotationTypes.fileSize]) ApplicationUtil.configureControl(control, config, AnnotationTypes.fileSize);\n if (files && FormProvider.ProcessRule(control, config)) {\n if (RegexValidator.isNotBlank(control.value)) {\n let minFileSize = config.minSize ? config.minSize : 0;\n let testResult = false;\n let fileSize = 0;\n for (var i = 0; i < files.length; i++) {\n let file = files.item(i);\n fileSize = file.size;\n testResult = !(fileSize >= minFileSize && fileSize <= config.maxSize);\n if (testResult) break;\n }\n if (testResult) return ObjectMaker.toJson(AnnotationTypes.fileSize, config, [fileSize, minFileSize, config.maxSize]);\n }\n }\n return ObjectMaker.null();\n };\n}\nfunction endsWithValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n let failed = false;\n let values = config.values ? config.values : [config.value];\n for (let value of values) {\n var endString = String(control.value).substr(control.value.length - value.length, value.length);\n failed = endString != value;\n if (!failed) break;\n }\n if (failed) return ObjectMaker.toJson(AnnotationTypes.endsWith, config, [control.value, config.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction startsWithValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n let failed = false;\n let values = config.values ? config.values : [config.value];\n for (let value of values) {\n let startString = String(control.value).substr(0, value.length);\n failed = config.isRestrict && String(startString).toLowerCase() == String(value).toLowerCase() || !config.isRestrict && startString != value;\n if (!failed) break;\n }\n if (failed) return ObjectMaker.toJson(AnnotationTypes.startsWith, config, [control.value, config.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction primeNumberValidator(configModel) {\n function isPrime(value) {\n let isPrimeNumber = value != 1;\n for (var i = 2; i < value; i++) {\n if (value % i == 0) {\n isPrimeNumber = false;\n break;\n }\n }\n return isPrimeNumber;\n }\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n if (!ApplicationUtil.isNumeric(control.value) || !isPrime(control.value)) return ObjectMaker.toJson(AnnotationTypes.primeNumber, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction latitudeValidator(configModel) {\n return control => {\n return regexValidation(configModel, control, RegExRule.lat, AnnotationTypes.latitude);\n };\n}\nfunction longitudeValidator(configModel) {\n return control => {\n return regexValidation(configModel, control, RegExRule.long, AnnotationTypes.longitude);\n };\n}\nfunction composeValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (FormProvider.ProcessRule(control, config)) {\n if (config.validators) {\n let result = undefined;\n for (let validator of config.validators) {\n result = validator(control);\n if (result) break;\n }\n if (result) return config.messageKey || config.message ? ObjectMaker.toJson(config.messageKey || AnnotationTypes.compose, config, [control.value]) : result;\n }\n }\n return ObjectMaker.null();\n };\n}\nfunction ruleValidator(configModel, entity) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (FormProvider.ProcessRule(control, config)) {\n let result = null;\n for (let rule of config.customRules) {\n result = rule(entity);\n if (result) break;\n }\n if (result) return result;\n }\n return ObjectMaker.null();\n };\n}\nfunction fileValidator(configModel) {\n return (control, files) => {\n let config = getConfigObject(configModel, control);\n if (!control[VALIDATOR_CONFIG$2] || !control[VALIDATOR_CONFIG$2][AnnotationTypes.file]) ApplicationUtil.configureControl(control, config, AnnotationTypes.file);\n if (files) {\n if (FormProvider.ProcessRule(control, config)) {\n if (RegexValidator.isNotBlank(control.value)) {\n let minFiles = config.minFiles ? config.minFiles : 0;\n let maxFiles = config.maxFiles ? config.maxFiles : files.length;\n if (!(files.length > 0 && files[0] instanceof File && files.length >= minFiles && files.length <= maxFiles)) return ObjectMaker.toJson(AnnotationTypes.file, config, [files.length, minFiles, maxFiles]);\n }\n }\n }\n return ObjectMaker.null();\n };\n}\nfunction customValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (FormProvider.ProcessRule(control, config)) {\n const formGroupValue = ApplicationUtil.getParentObjectValue(control);\n const parentObject = control.parent ? control.parent.value : undefined;\n let result = null;\n for (let rule of config.customRules) {\n result = rule(formGroupValue, parentObject, config.additionalValue);\n if (result) break;\n }\n if (result) return result;\n }\n return ObjectMaker.null();\n };\n}\nfunction uniqueValidator(configModel) {\n var setTimeoutFunc = (invalidateControls, controlValues) => {\n let timeOut = setTimeout(() => {\n invalidateControls.forEach(t => {\n let isMatched = controlValues.filter(x => x == t.value)[0];\n if (!isMatched) t.updateValueAndValidity();\n });\n clearTimeout(timeOut);\n }, 200);\n };\n var additionalValidation = (config, fieldName, formGroup, formArray, currentValue) => {\n let indexOf = formArray.controls.indexOf(formGroup);\n let formArrayValue = [];\n if (indexOf != -1) {\n formArray.value.forEach((t, i) => {\n if (indexOf != i) formArrayValue.push(t);\n });\n return config.additionalValidation(currentValue, indexOf, fieldName, formGroup.value, formArrayValue);\n }\n return false;\n };\n return control => {\n let config = getConfigObject(configModel, control);\n if (FormProvider.ProcessRule(control, config)) {\n if (RegexValidator.isNotBlank(control.value)) {\n let formArray = ApplicationUtil.getParentFormArray(control);\n let parentFormGroup = control.parent ? control.parent : undefined;\n let invalidateControls = [];\n let controlValues = [];\n if (formArray && parentFormGroup) {\n let currentValue = control.value;\n let fieldName = ApplicationUtil.getFormControlName(control);\n let isMatched = false;\n for (let formGroup of formArray.controls) {\n if (formGroup != parentFormGroup) {\n isMatched = ApplicationUtil.toLower(formGroup.controls[fieldName].value) == ApplicationUtil.toLower(currentValue) && !(formGroup.controls[fieldName].errors && formGroup.controls[fieldName].errors[AnnotationTypes.unique]);\n if (formGroup.controls[fieldName].errors && formGroup.controls[fieldName].errors[AnnotationTypes.unique]) {\n var matchedControl = formArray.controls.filter(t => t.controls[fieldName] != formGroup.controls[fieldName] && ApplicationUtil.toLower(t.controls[fieldName].value) == ApplicationUtil.toLower(formGroup.controls[fieldName].value))[0];\n if (!matchedControl) invalidateControls.push(formGroup.controls[fieldName]);\n } else controlValues.push(formGroup.controls[fieldName].value);\n }\n if (isMatched) break;\n }\n if (invalidateControls.length > 0) setTimeoutFunc(invalidateControls, controlValues);\n let validation = false;\n if (config.additionalValidation) {\n validation = additionalValidation(config, fieldName, parentFormGroup, formArray, currentValue);\n }\n if (isMatched && !validation) return ObjectMaker.toJson(AnnotationTypes.unique, config, [control.value]);\n }\n }\n }\n return ObjectMaker.null();\n };\n}\nfunction imageValidator(configModel) {\n return (control, files) => {\n let config = getConfigObject(configModel, control);\n if (!control[VALIDATOR_CONFIG$2] || !control[VALIDATOR_CONFIG$2][AnnotationTypes.image]) ApplicationUtil.configureControl(control, config, AnnotationTypes.image);\n if (!files) return ObjectMaker.null();\n return new Promise((resolve, reject) => {\n if (FormProvider.ProcessRule(control, config)) {\n if (RegexValidator.isNotBlank(control.value)) {\n let testResult = false;\n for (var i = 0; i < files.length; i++) {\n let file = files.item(i);\n let type = file.type ? file.type.split('/') : [];\n testResult = type.length > 1 && type[0] == \"image\";\n if (!testResult) break;\n let image = new Image();\n config.minWidth = config.minWidth ? config.minWidth : 0;\n config.minHeight = config.minHeight ? config.minHeight : 0;\n image.onload = () => {\n testResult = image.width >= config.minWidth && image.height >= config.minHeight && image.width <= config.maxWidth && image.height <= config.maxHeight;\n if (!testResult) resolve(ObjectMaker.toJson(AnnotationTypes.image, config, [image.width, image.height]));else resolve(ObjectMaker.null());\n };\n image.onerror = () => {\n resolve(ObjectMaker.toJson(AnnotationTypes.image, config, []));\n };\n image.src = URL.createObjectURL(file);\n }\n if (!testResult) resolve(ObjectMaker.toJson(AnnotationTypes.image, config, []));\n }\n }\n return ObjectMaker.null();\n });\n };\n}\nfunction notEmptyValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (FormProvider.ProcessRule(control, config)) {\n if (!RegexValidator.isNotBlank(control.value, true)) {\n return ObjectMaker.toJson(AnnotationTypes.notEmpty, config, []);\n }\n }\n return ObjectMaker.null();\n };\n}\nfunction checkIpV4(value) {\n let isValid = RegexValidator.isValid(value, RegExRule.ipV4);\n if (isValid) {\n const splitDots = value.split('.');\n for (let ipNum of splitDots) {\n isValid = ipNum <= 255;\n if (!isValid) break;\n }\n }\n return isValid;\n}\nfunction checkIpV6(value) {\n return RegexValidator.isValid(value, RegExRule.ipV6);\n}\nfunction ipValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control, IP_CONFIG);\n if (ValidatorValueChecker.pass(control, config)) {\n let values = config.isCidr ? control.value.split('/') : [control.value];\n var isValid = config.version == IpVersion.V4 ? checkIpV4(values[0]) : config.version == IpVersion.V6 ? checkIpV6(values[0]) : checkIpV4(values[0]) || checkIpV6(values[0]);\n if (config.isCidr && isValid) {\n isValid = values.length > 1 ? config.version == IpVersion.V4 ? RegexValidator.isValid(values[1], RegExRule.cidrV4) : config.version == IpVersion.V6 ? RegexValidator.isValid(values[1], RegExRule.cidrV6) : RegexValidator.isValid(values[1], RegExRule.cidrV4) || RegexValidator.isValid(values[1], RegExRule.cidrV6) : false;\n }\n if (!isValid) return ObjectMaker.toJson(AnnotationTypes.ip, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction cusipValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n var controlValue = control.value.toUpperCase();\n let isValid = RegexValidator.isValid(controlValue, RegExRule.cusip);\n if (isValid) {\n let numericValues = controlValue.split(\"\").map(value => {\n var charCode = value.charCodeAt(0);\n return charCode >= \"A\".charCodeAt(0) && charCode <= \"Z\".charCodeAt(0) ? charCode - \"A\".charCodeAt(0) + 10 : value;\n });\n let totalCount = 0;\n for (var i = 0; i < numericValues.length - 1; i++) {\n var numericValue = parseInt(numericValues[i], 10);\n if (i % 2 !== 0) {\n numericValue *= 2;\n }\n if (numericValue > 9) {\n numericValue -= 9;\n }\n totalCount += numericValue;\n }\n totalCount = (10 - totalCount % 10) % 10;\n isValid = totalCount == numericValues[numericValues.length - 1];\n }\n if (!isValid) return ObjectMaker.toJson(AnnotationTypes.cusip, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction gridValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n let controlValue = control.value.toUpperCase();\n var isValid = RegexValidator.isValid(controlValue, RegExRule.grid);\n if (isValid) {\n controlValue = controlValue.replace(/\\s/g, '').replace(/-/g, '');\n if ('GRID:' === controlValue.substr(0, 5)) {\n controlValue = controlValue.substr(5);\n }\n let alphaNums = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n var alphaNumLength = alphaNums.length,\n length = controlValue.length,\n check = Math.floor(alphaNumLength / 2);\n for (var i = 0; i < length; i++) {\n check = ((check || alphaNumLength) * 2 % (alphaNumLength + 1) + alphaNums.indexOf(controlValue.charAt(i))) % alphaNumLength;\n }\n isValid = check === 1;\n }\n if (!isValid) return ObjectMaker.toJson(AnnotationTypes.grid, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction dateValidator(configModel) {\n return control => {\n return validateDate(control, configModel, AnnotationTypes.date);\n };\n}\nfunction runCondition(leftValue, rightValue, operator) {\n let result = false;\n switch (operator) {\n case OPERATORS.lessThan:\n case OPERATORS.greaterThan:\n result = leftValue > rightValue;\n break;\n case OPERATORS.lessThanEqualTo:\n case OPERATORS.greaterThanEqualTo:\n result = leftValue >= rightValue;\n break;\n }\n return result;\n}\nfunction isValid(control, config) {\n return config.allowSeconds ? RegexValidator.isValid(control.value, RegExRule.timeWithSeconds) : RegexValidator.isValid(control.value, RegExRule.time);\n}\nfunction getTime(value) {\n let splitTime = value ? value.split(':') : [];\n return new Date(1970, 0, 1, splitTime[0] ? splitTime[0] : 0, splitTime[1] ? splitTime[1] : 0, splitTime[2] ? splitTime[2] : 0).getTime();\n}\nfunction timeChecker(control, config, operationType) {\n config = getConfigObject(config, control);\n if (FormProvider.ProcessRule(control, config)) {\n if (RegexValidator.isNotBlank(control.value)) {\n if (isValid(control, config)) {\n let crossFormControl = config.fieldName ? ApplicationUtil.getFormControl(config.fieldName, control) : undefined;\n let crossControlValue = crossFormControl ? getTime(crossFormControl.value) : getTime(config.value);\n let currentControlValue = getTime(control.value);\n let isValid = operationType == AnnotationTypes.minTime ? runCondition(currentControlValue, crossControlValue, config.operator || OPERATORS.greaterThanEqualTo) : runCondition(crossControlValue, currentControlValue, config.operator || OPERATORS.lessThanEqualTo);\n let additionalValue = {\n [operationType == AnnotationTypes.minTime ? \"min\" : \"max\"]: crossControlValue\n };\n if (!isValid) return ObjectMaker.toJson(operationType, config, [control.value], additionalValue);\n } else return ObjectMaker.toJson(operationType, config, [control.value]);\n }\n }\n return ObjectMaker.null();\n}\nfunction minTimeValidator(configModel) {\n return control => {\n return timeChecker(control, configModel, AnnotationTypes.minTime);\n };\n}\nfunction maxTimeValidator(configModel) {\n return control => {\n return timeChecker(control, configModel, AnnotationTypes.maxTime);\n };\n}\nfunction requiredTrueValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (FormProvider.ProcessRule(control, config)) {\n if (control.value !== true) {\n return ObjectMaker.toJson(AnnotationTypes.requiredTrue, config, []);\n }\n }\n return ObjectMaker.null();\n };\n}\nfunction maskValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (!control[VALIDATOR_CONFIG$2] || !control[VALIDATOR_CONFIG$2][AnnotationTypes.mask]) ApplicationUtil.configureControl(control, config, AnnotationTypes.mask);\n return null;\n };\n}\nconst IBAN_COUNTRY_CODE_REGEX = {\n AD: /^(AD[0-9]{2})\\d{8}[A-Z0-9]{12}$/,\n AE: /^(AE[0-9]{2})\\d{3}\\d{16}$/,\n AL: /^(AL[0-9]{2})\\d{8}[A-Z0-9]{16}$/,\n AT: /^(AT[0-9]{2})\\d{16}$/,\n AZ: /^(AZ[0-9]{2})[A-Z0-9]{4}\\d{20}$/,\n BA: /^(BA[0-9]{2})\\d{16}$/,\n BE: /^(BE[0-9]{2})\\d{12}$/,\n BG: /^(BG[0-9]{2})[A-Z]{4}\\d{6}[A-Z0-9]{8}$/,\n BH: /^(BH[0-9]{2})[A-Z]{4}[A-Z0-9]{14}$/,\n BR: /^(BR[0-9]{2})\\d{23}[A-Z]{1}[A-Z0-9]{1}$/,\n BY: /^(BY[0-9]{2})[A-Z0-9]{4}\\d{20}$/,\n CH: /^(CH[0-9]{2})\\d{5}[A-Z0-9]{12}$/,\n CR: /^(CR[0-9]{2})\\d{18}$/,\n CY: /^(CY[0-9]{2})\\d{8}[A-Z0-9]{16}$/,\n CZ: /^(CZ[0-9]{2})\\d{20}$/,\n DE: /^(DE[0-9]{2})\\d{18}$/,\n DK: /^(DK[0-9]{2})\\d{14}$/,\n DO: /^(DO[0-9]{2})[A-Z]{4}\\d{20}$/,\n EE: /^(EE[0-9]{2})\\d{16}$/,\n EG: /^(EG[0-9]{2})\\d{25}$/,\n ES: /^(ES[0-9]{2})\\d{20}$/,\n FI: /^(FI[0-9]{2})\\d{14}$/,\n FO: /^(FO[0-9]{2})\\d{14}$/,\n FR: /^(FR[0-9]{2})\\d{10}[A-Z0-9]{11}\\d{2}$/,\n GB: /^(GB[0-9]{2})[A-Z]{4}\\d{14}$/,\n GE: /^(GE[0-9]{2})[A-Z0-9]{2}\\d{16}$/,\n GI: /^(GI[0-9]{2})[A-Z]{4}[A-Z0-9]{15}$/,\n GL: /^(GL[0-9]{2})\\d{14}$/,\n GR: /^(GR[0-9]{2})\\d{7}[A-Z0-9]{16}$/,\n GT: /^(GT[0-9]{2})[A-Z0-9]{4}[A-Z0-9]{20}$/,\n HR: /^(HR[0-9]{2})\\d{17}$/,\n HU: /^(HU[0-9]{2})\\d{24}$/,\n IE: /^(IE[0-9]{2})[A-Z0-9]{4}\\d{14}$/,\n IL: /^(IL[0-9]{2})\\d{19}$/,\n IQ: /^(IQ[0-9]{2})[A-Z]{4}\\d{15}$/,\n IR: /^(IR[0-9]{2})0\\d{2}0\\d{18}$/,\n IS: /^(IS[0-9]{2})\\d{22}$/,\n IT: /^(IT[0-9]{2})[A-Z]{1}\\d{10}[A-Z0-9]{12}$/,\n JO: /^(JO[0-9]{2})[A-Z]{4}\\d{22}$/,\n KW: /^(KW[0-9]{2})[A-Z]{4}[A-Z0-9]{22}$/,\n KZ: /^(KZ[0-9]{2})\\d{3}[A-Z0-9]{13}$/,\n LB: /^(LB[0-9]{2})\\d{4}[A-Z0-9]{20}$/,\n LC: /^(LC[0-9]{2})[A-Z]{4}[A-Z0-9]{24}$/,\n LI: /^(LI[0-9]{2})\\d{5}[A-Z0-9]{12}$/,\n LT: /^(LT[0-9]{2})\\d{16}$/,\n LU: /^(LU[0-9]{2})\\d{3}[A-Z0-9]{13}$/,\n LV: /^(LV[0-9]{2})[A-Z]{4}[A-Z0-9]{13}$/,\n MC: /^(MC[0-9]{2})\\d{10}[A-Z0-9]{11}\\d{2}$/,\n MD: /^(MD[0-9]{2})[A-Z0-9]{20}$/,\n ME: /^(ME[0-9]{2})\\d{18}$/,\n MK: /^(MK[0-9]{2})\\d{3}[A-Z0-9]{10}\\d{2}$/,\n MR: /^(MR[0-9]{2})\\d{23}$/,\n MT: /^(MT[0-9]{2})[A-Z]{4}\\d{5}[A-Z0-9]{18}$/,\n MU: /^(MU[0-9]{2})[A-Z]{4}\\d{19}[A-Z]{3}$/,\n NL: /^(NL[0-9]{2})[A-Z]{4}\\d{10}$/,\n NO: /^(NO[0-9]{2})\\d{11}$/,\n PK: /^(PK[0-9]{2})[A-Z0-9]{4}\\d{16}$/,\n PL: /^(PL[0-9]{2})\\d{24}$/,\n PS: /^(PS[0-9]{2})[A-Z0-9]{4}\\d{21}$/,\n PT: /^(PT[0-9]{2})\\d{21}$/,\n QA: /^(QA[0-9]{2})[A-Z]{4}[A-Z0-9]{21}$/,\n RO: /^(RO[0-9]{2})[A-Z]{4}[A-Z0-9]{16}$/,\n RS: /^(RS[0-9]{2})\\d{18}$/,\n SA: /^(SA[0-9]{2})\\d{2}[A-Z0-9]{18}$/,\n SC: /^(SC[0-9]{2})[A-Z]{4}\\d{20}[A-Z]{3}$/,\n SE: /^(SE[0-9]{2})\\d{20}$/,\n SI: /^(SI[0-9]{2})\\d{15}$/,\n SK: /^(SK[0-9]{2})\\d{20}$/,\n SM: /^(SM[0-9]{2})[A-Z]{1}\\d{10}[A-Z0-9]{12}$/,\n SV: /^(SV[0-9]{2})[A-Z0-9]{4}\\d{20}$/,\n TL: /^(TL[0-9]{2})\\d{19}$/,\n TN: /^(TN[0-9]{2})\\d{20}$/,\n TR: /^(TR[0-9]{2})\\d{5}[A-Z0-9]{17}$/,\n UA: /^(UA[0-9]{2})\\d{6}[A-Z0-9]{19}$/,\n VA: /^(VA[0-9]{2})\\d{18}$/,\n VG: /^(VG[0-9]{2})[A-Z0-9]{4}\\d{16}$/,\n XK: /^(XK[0-9]{2})\\d{16}$/\n};\nfunction hasValidIbanFormat(value, countryCode) {\n const strippedStr = value.replace(/[\\s\\-]+/gi, '').toUpperCase();\n const isoCountryCode = countryCode || strippedStr.slice(0, 2).toUpperCase();\n return isoCountryCode in IBAN_COUNTRY_CODE_REGEX && IBAN_COUNTRY_CODE_REGEX[isoCountryCode].test(strippedStr);\n}\nfunction hasValidIbanChecksum(str) {\n const strippedStr = str.replace(/[^A-Z0-9]+/gi, '').toUpperCase(); // Keep only digits and A-Z latin alphabetic\n const rearranged = strippedStr.slice(4) + strippedStr.slice(0, 4);\n const alphaCapsReplacedWithDigits = rearranged.replace(/[A-Z]/g, char => char.charCodeAt(0) - 55);\n const remainder = alphaCapsReplacedWithDigits.match(/\\d{1,7}/g).reduce((acc, value) => Number(acc + value) % 97, '');\n return remainder === 1;\n}\nfunction ibanValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n if (!(hasValidIbanFormat(control.value, config.countryCode) && hasValidIbanChecksum(control.value))) return ObjectMaker.toJson(AnnotationTypes.iban, config, [control.value, config.countryCode]);\n }\n return ObjectMaker.null();\n };\n}\nconst APP_VALIDATORS = {\n \"alphaNumeric\": alphaNumericValidator,\n \"alpha\": alphaValidator,\n \"compare\": compareValidator,\n \"email\": emailValidator,\n \"hexColor\": hexColorValidator,\n \"lowerCase\": lowercaseValidator,\n \"maxDate\": maxDateValidator,\n \"maxNumber\": maxNumberValidator,\n \"minDate\": minDateValidator,\n \"minNumber\": minNumberValidator,\n \"contains\": containsValidator,\n \"upperCase\": uppercaseValidator,\n \"maxLength\": maxLengthValidator,\n \"minLength\": minLengthValidator,\n \"password\": passwordValidator,\n \"range\": rangeValidator,\n \"required\": requiredValidator,\n \"creditCard\": creditCardValidator,\n \"digit\": digitValidator,\n \"pattern\": patternValidator,\n \"time\": timeValidator,\n \"url\": urlValidator,\n \"json\": jsonValidator,\n \"greaterThan\": greaterThanValidator,\n \"greaterThanEqualTo\": greaterThanEqualToValidator,\n \"lessThan\": lessThanValidator,\n \"lessThanEqualTo\": lessThanEqualToValidator,\n \"choice\": choiceValidator,\n \"different\": differentValidator,\n \"numeric\": numericValidator,\n \"even\": evenValidator,\n \"odd\": oddValidator,\n \"factor\": factorValidator,\n \"leapYear\": leapYearValidator,\n \"allOf\": allOfValidator,\n \"oneOf\": oneOfValidator,\n \"noneOf\": noneOfValidator,\n \"mac\": macValidator,\n \"ascii\": asciiValidator,\n \"dataUri\": dataUriValidator,\n \"port\": portValidator,\n \"latLong\": latLongValidator,\n \"extension\": extensionValidator,\n \"fileSize\": fileSizeValidator,\n \"endsWith\": endsWithValidator,\n \"startsWith\": startsWithValidator,\n \"primeNumber\": primeNumberValidator,\n \"latitude\": latitudeValidator,\n \"longitude\": longitudeValidator,\n \"compose\": composeValidator,\n \"rule\": ruleValidator,\n \"file\": fileValidator,\n \"unique\": uniqueValidator,\n \"image\": imageValidator,\n \"notEmpty\": notEmptyValidator,\n \"ip\": ipValidator,\n \"cusip\": cusipValidator,\n \"grid\": gridValidator,\n \"date\": dateValidator,\n \"minTime\": minTimeValidator,\n \"maxTime\": maxTimeValidator,\n \"requiredTrue\": requiredTrueValidator,\n \"mask\": maskValidator,\n \"iban\": ibanValidator\n};\nfunction baseAsyncValidator(configModel, validatorName) {\n return control => {\n configModel = configModel || {};\n if (configModel.validatorConfig) {\n if (FormProvider.ProcessRule(control, configModel)) {\n return configModel.validatorConfig.pipe(map(resolveConfig(configModel, validatorName, control)));\n }\n return of(null);\n } else return of(resolveConfig(configModel, validatorName, control)(configModel));\n };\n}\nfunction resolveConfig(configModel, validatorName, control) {\n return config => {\n let configClone = {\n ...configModel,\n ...config,\n ...{\n expressionProcessed: true\n }\n };\n return APP_VALIDATORS[validatorName](configClone)(control);\n };\n}\nfunction alpha(config) {\n return baseDecoratorFunction(AnnotationTypes.alpha, config);\n}\nfunction alphaAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.alpha, [baseAsyncValidator(config, AnnotationTypes.alpha)], true);\n}\nfunction alphaNumeric(config) {\n return baseDecoratorFunction(AnnotationTypes.alphaNumeric, config);\n}\nfunction alphaNumericAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.alphaNumeric, [baseAsyncValidator(config, AnnotationTypes.alphaNumeric)], true);\n}\nfunction compare(config) {\n return baseDecoratorFunction(AnnotationTypes.compare, config);\n}\nfunction contains(config) {\n return baseDecoratorFunction(AnnotationTypes.contains, config);\n}\nfunction containsAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.contains, [baseAsyncValidator(config, AnnotationTypes.contains)], true);\n}\nfunction creditCard(config) {\n return baseDecoratorFunction(AnnotationTypes.creditCard, config);\n}\nfunction creditCardAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.creditCard, [baseAsyncValidator(config, AnnotationTypes.creditCard)], true);\n}\nfunction digit(config) {\n return baseDecoratorFunction(AnnotationTypes.digit, config);\n}\nfunction email(config) {\n return baseDecoratorFunction(AnnotationTypes.email, config);\n}\nfunction hexColor(config) {\n return baseDecoratorFunction(AnnotationTypes.hexColor, config);\n}\nfunction lowerCase(config) {\n return baseDecoratorFunction(AnnotationTypes.lowerCase, config);\n}\nfunction maxDate(config) {\n return baseDecoratorFunction(AnnotationTypes.maxDate, config);\n}\nfunction maxDateAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.maxDate, [baseAsyncValidator(config, AnnotationTypes.maxDate)], true);\n}\nfunction maxLength(config) {\n return baseDecoratorFunction(AnnotationTypes.maxLength, config);\n}\nfunction maxLengthAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.maxLength, [baseAsyncValidator(config, AnnotationTypes.maxLength)], true);\n}\nfunction minDate(config) {\n return baseDecoratorFunction(AnnotationTypes.minDate, config);\n}\nfunction minDateAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.minDate, [baseAsyncValidator(config, AnnotationTypes.minDate)], true);\n}\nfunction maxNumber(config) {\n return baseDecoratorFunction(AnnotationTypes.maxNumber, config);\n}\nfunction maxNumberAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.maxNumber, [baseAsyncValidator(config, AnnotationTypes.maxNumber)], true);\n}\nfunction minLength(config) {\n return baseDecoratorFunction(AnnotationTypes.minLength, config);\n}\nfunction minLengthAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.minLength, [baseAsyncValidator(config, AnnotationTypes.minLength)], true);\n}\nfunction minNumber(config) {\n return baseDecoratorFunction(AnnotationTypes.minNumber, config);\n}\nfunction minNumberAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.minNumber, [baseAsyncValidator(config, AnnotationTypes.minNumber)], true);\n}\nfunction password(config) {\n return baseDecoratorFunction(AnnotationTypes.password, config);\n}\nfunction passwordAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.password, [baseAsyncValidator(config, AnnotationTypes.password)], true);\n}\nfunction pattern(config) {\n return baseDecoratorFunction(AnnotationTypes.pattern, config);\n}\nfunction patternAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.pattern, [baseAsyncValidator(config, AnnotationTypes.pattern)], true);\n}\nfunction propArray(entity, config) {\n return function (target, propertyKey, parameterIndex) {\n var propertyInfo = {\n name: propertyKey,\n propertyType: ARRAY_PROPERTY,\n entity: entity,\n dataPropertyName: config ? config.name : undefined,\n entityProvider: config ? config.entityProvider : undefined,\n arrayConfig: config ? {\n allowMaxIndex: config.allowMaxIndex,\n messageKey: config.messageKey,\n createBlank: config.createBlank\n } : undefined\n };\n defaultContainer.addProperty(target.constructor, propertyInfo);\n };\n}\nfunction propObject(entity, config) {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.initPropertyObject(propertyKey, OBJECT_PROPERTY, entity, target, config);\n };\n}\nfunction prop(config) {\n return function (target, propertyKey, parameterIndex) {\n var propertyInfo = {\n name: propertyKey,\n propertyType: PROPERTY,\n dataPropertyName: config ? config.name : undefined,\n defaultValue: config ? config.defaultValue : undefined,\n ignore: config ? config.ignore : undefined,\n isPrimaryKey: config ? config.isPrimaryKey : undefined,\n messageNexus: config ? config.messageNexus : undefined\n };\n defaultContainer.addProperty(target.constructor, propertyInfo);\n };\n}\nfunction range(config) {\n return baseDecoratorFunction(AnnotationTypes.range, config);\n}\nfunction rangeAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.range, [baseAsyncValidator(config, AnnotationTypes.range)], true);\n}\nfunction required(config) {\n return baseDecoratorFunction(AnnotationTypes.required, config);\n}\nfunction upperCase(config) {\n return baseDecoratorFunction(AnnotationTypes.upperCase, config);\n}\nfunction time(config) {\n return baseDecoratorFunction(AnnotationTypes.time, config);\n}\nfunction timeAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.time, [baseAsyncValidator(config, AnnotationTypes.time)], true);\n}\nfunction url(config) {\n return baseDecoratorFunction(AnnotationTypes.url, config);\n}\nfunction urlAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.url, [baseAsyncValidator(config, AnnotationTypes.url)], true);\n}\nfunction json(config) {\n return baseDecoratorFunction(AnnotationTypes.json, config);\n}\nfunction greaterThan(config) {\n return baseDecoratorFunction(AnnotationTypes.greaterThan, config);\n}\nfunction greaterThanAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.greaterThan, [baseAsyncValidator(config, AnnotationTypes.greaterThan)], true);\n}\nfunction greaterThanEqualTo(config) {\n return baseDecoratorFunction(AnnotationTypes.greaterThanEqualTo, config);\n}\nfunction greaterThanEqualToAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.greaterThanEqualTo, [baseAsyncValidator(config, AnnotationTypes.greaterThanEqualTo)], true);\n}\nfunction lessThanEqualTo(config) {\n return baseDecoratorFunction(AnnotationTypes.lessThanEqualTo, config);\n}\nfunction lessThanEqualToAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.lessThanEqualTo, [baseAsyncValidator(config, AnnotationTypes.lessThanEqualTo)], true);\n}\nfunction lessThan(config) {\n return baseDecoratorFunction(AnnotationTypes.lessThan, config);\n}\nfunction lessThanAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.lessThan, [baseAsyncValidator(config, AnnotationTypes.lessThan)], true);\n}\nfunction choice(config) {\n return baseDecoratorFunction(AnnotationTypes.choice, config);\n}\nfunction choiceAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.choice, [baseAsyncValidator(config, AnnotationTypes.choice)], true);\n}\nfunction different(config) {\n return baseDecoratorFunction(AnnotationTypes.different, config);\n}\nfunction numeric(config) {\n return baseDecoratorFunction(AnnotationTypes.numeric, config);\n}\nfunction numericAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.numeric, [baseAsyncValidator(config, AnnotationTypes.numeric)], true);\n}\nfunction even(config) {\n return baseDecoratorFunction(AnnotationTypes.even, config);\n}\nfunction odd(config) {\n return baseDecoratorFunction(AnnotationTypes.odd, config);\n}\nfunction factor(config) {\n return baseDecoratorFunction(AnnotationTypes.factor, config);\n}\nfunction factorAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.factor, [baseAsyncValidator(config, AnnotationTypes.factor)], true);\n}\nfunction leapYear(config) {\n return baseDecoratorFunction(AnnotationTypes.leapYear, config);\n}\nfunction allOf(config) {\n return baseDecoratorFunction(AnnotationTypes.allOf, config);\n}\nfunction allOfAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.allOf, [baseAsyncValidator(config, AnnotationTypes.allOf)], true);\n}\nfunction oneOf(config) {\n return baseDecoratorFunction(AnnotationTypes.oneOf, config);\n}\nfunction oneOfAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.oneOf, [baseAsyncValidator(config, AnnotationTypes.oneOf)], true);\n}\nfunction noneOf(config) {\n return baseDecoratorFunction(AnnotationTypes.noneOf, config);\n}\nfunction noneOfAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.noneOf, [baseAsyncValidator(config, AnnotationTypes.noneOf)], true);\n}\nfunction mac(config) {\n return baseDecoratorFunction(AnnotationTypes.mac, config);\n}\nfunction ascii(config) {\n return baseDecoratorFunction(AnnotationTypes.ascii, config);\n}\nfunction dataUri(config) {\n return baseDecoratorFunction(AnnotationTypes.dataUri, config);\n}\nfunction port(config) {\n return baseDecoratorFunction(AnnotationTypes.port, config);\n}\nfunction latLong(config) {\n return baseDecoratorFunction(AnnotationTypes.latLong, config);\n}\nfunction extension(config) {\n return baseDecoratorFunction(AnnotationTypes.extension, config);\n}\nfunction extensionAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.extension, [baseAsyncValidator(config, AnnotationTypes.extension)], true);\n}\nfunction fileSize(config) {\n return baseDecoratorFunction(AnnotationTypes.fileSize, config);\n}\nfunction fileSizeAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.fileSize, [baseAsyncValidator(config, AnnotationTypes.fileSize)], true);\n}\nfunction endsWith(config) {\n return baseDecoratorFunction(AnnotationTypes.endsWith, config);\n}\nfunction endsWithAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.endsWith, [baseAsyncValidator(config, AnnotationTypes.endsWith)], true);\n}\nfunction startsWith(config) {\n return baseDecoratorFunction(AnnotationTypes.startsWith, config);\n}\nfunction startsWithAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.startsWith, [baseAsyncValidator(config, AnnotationTypes.startsWith)], true);\n}\nfunction primeNumber(config) {\n return baseDecoratorFunction(AnnotationTypes.primeNumber, config);\n}\nfunction latitude(config) {\n return baseDecoratorFunction(AnnotationTypes.latitude, config);\n}\nfunction longitude(config) {\n return baseDecoratorFunction(AnnotationTypes.longitude, config);\n}\nfunction rule(config) {\n return baseDecoratorFunction(AnnotationTypes.rule, config);\n}\nfunction file(config) {\n return baseDecoratorFunction(AnnotationTypes.file, config);\n}\nfunction fileAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.file, [baseAsyncValidator(config, AnnotationTypes.file)], true);\n}\nfunction custom(config) {\n return baseDecoratorFunction(AnnotationTypes.custom, config);\n}\nfunction customAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.custom, [baseAsyncValidator(config, AnnotationTypes.custom)], true);\n}\nfunction unique(config) {\n return baseDecoratorFunction(AnnotationTypes.unique, config);\n}\nfunction image(config) {\n return baseDecoratorFunction(AnnotationTypes.image, config);\n}\nfunction imageAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.image, [baseAsyncValidator(config, AnnotationTypes.image)], true);\n}\nfunction notEmpty(config) {\n return baseDecoratorFunction(AnnotationTypes.notEmpty, config);\n}\nfunction async(validators) {\n return baseDecoratorFunction(AnnotationTypes.async, validators, true);\n}\nfunction cusip(config) {\n return baseDecoratorFunction(AnnotationTypes.cusip, config);\n}\nfunction grid(config) {\n return baseDecoratorFunction(AnnotationTypes.grid, config);\n}\nfunction date(config) {\n return baseDecoratorFunction(AnnotationTypes.date, config);\n}\nfunction dateAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.date, [baseAsyncValidator(config, AnnotationTypes.date)], true);\n}\nfunction disable(config) {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addDecoratorConfig(target, parameterIndex, propertyKey, config, DECORATORS.disabled);\n };\n}\nfunction error(config) {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addDecoratorConfig(target, parameterIndex, propertyKey, config, DECORATORS.error);\n };\n}\nfunction and(config) {\n return baseDecoratorFunction(AnnotationTypes.and, config);\n}\nfunction or(config) {\n return baseDecoratorFunction(AnnotationTypes.or, config);\n}\nfunction not(config) {\n return baseDecoratorFunction(AnnotationTypes.not, config);\n}\nfunction trim() {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addSanitizer(target, parameterIndex, propertyKey, DECORATORS.trim);\n };\n}\nfunction ltrim() {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addSanitizer(target, parameterIndex, propertyKey, DECORATORS.ltrim);\n };\n}\nfunction rtrim() {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addSanitizer(target, parameterIndex, propertyKey, DECORATORS.rtrim);\n };\n}\nfunction blacklist(chars) {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addSanitizer(target, parameterIndex, propertyKey, DECORATORS.blacklist, chars);\n };\n}\nfunction stripLow(keepNewLines) {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addSanitizer(target, parameterIndex, propertyKey, DECORATORS.stripLow, keepNewLines);\n };\n}\nfunction toBoolean(strict) {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addSanitizer(target, parameterIndex, propertyKey, DECORATORS.toBoolean, strict);\n };\n}\nfunction toDouble() {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addSanitizer(target, parameterIndex, propertyKey, DECORATORS.toDouble);\n };\n}\nfunction toFloat() {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addSanitizer(target, parameterIndex, propertyKey, DECORATORS.toFloat);\n };\n}\nfunction toInt(radix) {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addSanitizer(target, parameterIndex, propertyKey, DECORATORS.toInt, radix);\n };\n}\nfunction toString() {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addSanitizer(target, parameterIndex, propertyKey, DECORATORS.string);\n };\n}\nfunction whitelist(chars) {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addSanitizer(target, parameterIndex, propertyKey, DECORATORS.whitelist, chars);\n };\n}\nfunction toDate(config) {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addSanitizer(target, parameterIndex, propertyKey, DECORATORS.toDate, config);\n };\n}\nfunction escape() {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addSanitizer(target, parameterIndex, propertyKey, DECORATORS.escape);\n };\n}\nfunction prefix(text) {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addSanitizer(target, parameterIndex, propertyKey, DECORATORS.prefix, text);\n };\n}\nfunction suffix(text) {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addSanitizer(target, parameterIndex, propertyKey, DECORATORS.suffix, text);\n };\n}\nfunction model(config) {\n return function (target) {\n defaultContainer.addPropsConfig(target, config);\n };\n}\nfunction sanitize(config) {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addSanitizer(target, parameterIndex, propertyKey, DECORATORS.sanitize, config);\n };\n}\nfunction elementClass(config) {\n return function (target, propertyKey, parameterIndex) {\n defaultContainer.addDecoratorConfig(target, parameterIndex, propertyKey, config, DECORATORS.elementClass);\n };\n}\nfunction minTime(config) {\n return baseDecoratorFunction(AnnotationTypes.minTime, config);\n}\nfunction minTimeAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.minTime, [baseAsyncValidator(config, AnnotationTypes.minTime)], true);\n}\nfunction maxTime(config) {\n return baseDecoratorFunction(AnnotationTypes.maxTime, config);\n}\nfunction maxTimeAsync(config) {\n return baseDecoratorFunction(AnnotationTypes.maxTime, [baseAsyncValidator(config, AnnotationTypes.maxTime)], true);\n}\nfunction compose(config) {\n return baseDecoratorFunction(AnnotationTypes.compose, config);\n}\nfunction requiredTrue(config) {\n return baseDecoratorFunction(AnnotationTypes.requiredTrue, config);\n}\nfunction mask(config) {\n return baseDecoratorFunction(AnnotationTypes.mask, config);\n}\nfunction updateOn(config) {\n return baseDecoratorFunction(AnnotationTypes.updateOn, config);\n}\nlet HtmlControlTemplateDirective = /*#__PURE__*/(() => {\n class HtmlControlTemplateDirective {\n constructor(templateRef) {\n this.templateRef = templateRef;\n }\n }\n HtmlControlTemplateDirective.ɵfac = function HtmlControlTemplateDirective_Factory(ɵt) {\n return new (ɵt || HtmlControlTemplateDirective)(i0.ɵɵdirectiveInject(i0.TemplateRef));\n };\n HtmlControlTemplateDirective.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: HtmlControlTemplateDirective,\n selectors: [[\"\", \"htmlControlTemplate\", \"\"]],\n inputs: {\n type: [0, \"htmlControlTemplate\", \"type\"]\n }\n });\n return HtmlControlTemplateDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet BaseDirective = /*#__PURE__*/(() => {\n class BaseDirective {\n applyValidations(controls, model = null) {\n if (this.model) {\n let modelConfig = defaultContainer.get(model || this.model.constructor);\n if (modelConfig) {\n modelConfig.properties.forEach(property => {\n if (controls[property.name]) {\n switch (property.propertyType) {\n case PROPERTY:\n this.setValidatorConfig(controls[property.name], modelConfig, property);\n break;\n case OBJECT_PROPERTY:\n this.applyValidations(controls[property.name].controls, property.entity);\n break;\n }\n }\n });\n }\n }\n }\n setValidatorConfig(control, modelConfig, property) {\n let annotations = modelConfig.propertyAnnotations.filter(t => t.propertyName == property.name);\n annotations.forEach(annotation => {\n if (!control[TEMPLATE_VALIDATION_CONFIG]) control[TEMPLATE_VALIDATION_CONFIG] = {};\n ApplicationUtil.configureControl(control, annotation.config ? annotation.config : \"\", annotation.annotationType);\n });\n }\n }\n BaseDirective.ɵfac = function BaseDirective_Factory(ɵt) {\n return new (ɵt || BaseDirective)();\n };\n BaseDirective.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: BaseDirective,\n inputs: {\n model: \"model\"\n }\n });\n return BaseDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst DISABLED_EXPRESSION = \"disableExpression\";\nfunction conditionalChangeValidator(conditionalValidationProps) {\n var timeOuts = [];\n var oldValue = undefined;\n var setTimeOut = (control, config) => {\n if (control[DISABLED_EXPRESSION]) runDisabledExpression(control, config);\n var timeOut = setTimeout(t => {\n clearTimeout(timeOut);\n control.updateValueAndValidity({\n emitEvent: false\n });\n }, 100);\n };\n return control => {\n let value = control.value;\n if (control.parent && oldValue != value) {\n const rootFormGroup = ApplicationUtil.getRootFormGroup(control);\n const parentFormGroup = control.parent;\n oldValue = value;\n timeOuts = [];\n let controlName = ApplicationUtil.getFormControlName(control);\n let disabledConfig = {\n [controlName]: value\n };\n conditionalValidationProps.forEach(t => {\n let a = control;\n if (t.indexOf(\"[]\") != -1) {\n var splitText = t.split(\"[]\");\n var formArray = rootFormGroup.get([splitText[0]]);\n if (formArray) formArray.controls.forEach(formGroup => {\n var abstractControl = formGroup.get(splitText[1]);\n if (abstractControl) {\n setTimeOut(abstractControl, disabledConfig);\n }\n });\n } else {\n let splitText = t.split('.');\n if (splitText.length > 1) {\n var control = null;\n t.split('.').forEach((name, index) => {\n control = index == 0 ? rootFormGroup.controls[name] : control.controls[name];\n });\n } else {\n control = parentFormGroup.controls[t];\n }\n if (control) {\n setTimeOut(control, disabledConfig);\n }\n }\n });\n }\n return ObjectMaker.null();\n };\n}\nfunction runDisabledExpression(control, config) {\n let isDisabled = FormProvider.ProcessRule(control, {\n conditionalExpression: control[DISABLED_EXPRESSION],\n disableConfig: config\n });\n if (isDisabled && !control.disabled) control.disable();else if (control.disabled) control.enable();\n}\nlet RxwebFormDirective = /*#__PURE__*/(() => {\n class RxwebFormDirective extends BaseDirective {\n constructor() {\n super(...arguments);\n this.clearTimeoutNumber = 0;\n this.validationRule = {};\n }\n ngAfterContentInit() {\n if (this.formGroup && !this.formGroup[MODEL] && this.formGroup.parent == null) {\n this.expressionProcessor(this.formGroup.controls);\n this.setConditionalValidator(this.formGroup.controls);\n } else if (this.formGroup && !this.formGroup[MODEL] && this.formGroup.parent instanceof FormArray) {\n this.expressionProcessor(this.formGroup.controls);\n this.setConditionalValidator(this.formGroup.controls);\n } else if (this.ngForm) {\n this.configureModelValidations();\n }\n }\n configureModelValidations() {\n this.clearTimeoutNumber = setTimeout(() => {\n clearTimeout(this.clearTimeoutNumber);\n this.applyValidations(this.ngForm.form.controls);\n this.expressionProcessor(this.ngForm.form.controls);\n this.setConditionalValidator(this.ngForm.form.controls);\n this.updateValueAndValidity(this.ngForm.form.controls);\n }, 500);\n }\n updateValueAndValidity(controls) {\n Object.keys(controls).forEach(key => {\n if (controls[key] instanceof FormGroup) this.updateValueAndValidity(controls[key].controls);else if (controls[key] instanceof FormArray) this.updateValueAndValidity(controls[key].controls);else controls[key].updateValueAndValidity();\n });\n }\n expressionProcessor(controls, rootFieldName = \"\") {\n Object.keys(controls).forEach(fieldName => {\n let formControl = controls[fieldName];\n if (formControl.validatorConfig) {\n Object.keys(AnnotationTypes).forEach(validatorName => {\n if (formControl.validatorConfig[validatorName] && formControl.validatorConfig[validatorName].disableExpression) {\n formControl[\"disableExpression\"] = formControl.validatorConfig[validatorName].disableExpression;\n let columns = Linq.expressionColumns(formControl.validatorConfig[validatorName].disableExpression);\n columns.forEach(t => {\n defaultContainer.setConditionalValueProp(this.validationRule, rootFieldName + t.propName, fieldName);\n });\n }\n if (formControl.validatorConfig[validatorName] && formControl.validatorConfig[validatorName].conditionalExpression) {\n let columns = Linq.expressionColumns(formControl.validatorConfig[validatorName].conditionalExpression);\n columns.forEach(t => {\n defaultContainer.setConditionalValueProp(this.validationRule, rootFieldName + t.propName, fieldName);\n });\n }\n if (formControl.validatorConfig[validatorName] && formControl.validatorConfig[validatorName].dynamicConfig) {\n let columns = Linq.dynamicConfigParser(formControl.validatorConfig[validatorName].dynamicConfig, fieldName);\n columns.forEach(t => {\n defaultContainer.setConditionalValueProp(this.validationRule, rootFieldName + t.propName, fieldName);\n });\n }\n if (formControl.validatorConfig[validatorName] && (validatorName == AnnotationTypes.and || validatorName == AnnotationTypes.or || validatorName == AnnotationTypes.not)) {\n Object.keys(formControl.validatorConfig[validatorName].validation).forEach(t => {\n if (typeof formControl.validatorConfig[validatorName].validation[t] !== \"boolean\") defaultContainer.setLogicalConditional(this.validationRule, t, formControl.validatorConfig[validatorName].validation[t].fieldName, fieldName);\n });\n } else if (formControl.validatorConfig[validatorName] && (validatorName == AnnotationTypes.compare || validatorName == AnnotationTypes.greaterThan || validatorName == AnnotationTypes.greaterThanEqualTo || validatorName == AnnotationTypes.lessThan || validatorName == AnnotationTypes.lessThanEqualTo || validatorName == AnnotationTypes.different || validatorName == AnnotationTypes.factor || validatorName == AnnotationTypes.minTime || validatorName == AnnotationTypes.maxTime || validatorName == AnnotationTypes.creditCard && formControl.validatorConfig[validatorName].fieldName || (validatorName == AnnotationTypes.minDate || validatorName == AnnotationTypes.maxDate) && formControl.validatorConfig[validatorName].fieldName)) {\n defaultContainer.setConditionalValueProp(this.validationRule, formControl.validatorConfig[validatorName].fieldName, fieldName);\n }\n });\n } else if (formControl instanceof FormGroup) {\n this.expressionProcessor(formControl.controls, `${fieldName}.`);\n } else if (formControl instanceof FormArray) {\n if (formControl.controls) formControl.controls.forEach((t, i) => {\n if (t.controls) this.expressionProcessor(t.controls, `${fieldName}[]`);\n });\n }\n });\n }\n setConditionalValidator(controls) {\n Object.keys(controls).forEach(fieldName => {\n if (this.validationRule.conditionalValidationProps && this.validationRule.conditionalValidationProps[fieldName]) {\n controls[fieldName][CONDITIONAL_VALIDATOR] = conditionalChangeValidator(this.validationRule.conditionalValidationProps[fieldName]);\n } else if (controls[fieldName] instanceof FormGroup && this.validationRule.conditionalObjectProps) {\n var fields = this.validationRule.conditionalObjectProps.filter(t => t.objectPropName == fieldName);\n let nestedFormGroup = controls[fieldName];\n let propWiseConditionalControls = {};\n fields.forEach(x => {\n if (!propWiseConditionalControls[x.propName]) propWiseConditionalControls[x.propName] = [];\n propWiseConditionalControls[x.propName].push(x.referencePropName);\n });\n Object.keys(propWiseConditionalControls).forEach(key => {\n nestedFormGroup.controls[key][CONDITIONAL_VALIDATOR] = conditionalChangeValidator(propWiseConditionalControls[key]);\n });\n } else if (controls[fieldName] instanceof FormArray) {\n //fix https://github.com/rxweb/rxweb/issues/274\n controls[fieldName].controls.forEach((t, i) => {\n if (t.controls == undefined) this.setConditionalValidator({\n [i]: t\n });else this.setConditionalValidator(t.controls);\n });\n }\n });\n }\n ngOnDestroy() {}\n }\n RxwebFormDirective.ɵfac = /* @__PURE__ */(() => {\n let ɵRxwebFormDirective_BaseFactory;\n return function RxwebFormDirective_Factory(ɵt) {\n return (ɵRxwebFormDirective_BaseFactory || (ɵRxwebFormDirective_BaseFactory = i0.ɵɵgetInheritedFactory(RxwebFormDirective)))(ɵt || RxwebFormDirective);\n };\n })();\n RxwebFormDirective.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: RxwebFormDirective,\n selectors: [[\"\", \"formGroup\", \"\"], [\"\", \"rxwebForm\", \"\"]],\n inputs: {\n formGroup: \"formGroup\",\n ngForm: [0, \"rxwebForm\", \"ngForm\"]\n },\n features: [i0.ɵɵInheritDefinitionFeature]\n });\n return RxwebFormDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet AsyncValidationDirective = /*#__PURE__*/(() => {\n class AsyncValidationDirective {\n validate(control) {\n if (this.async) return this.async(control);\n return of(null);\n }\n }\n AsyncValidationDirective.ɵfac = function AsyncValidationDirective_Factory(ɵt) {\n return new (ɵt || AsyncValidationDirective)();\n };\n AsyncValidationDirective.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: AsyncValidationDirective,\n selectors: [[\"\", \"ngModel\", \"\"], [\"\", \"formControlName\", \"\"], [\"\", \"formControl\", \"\"]],\n inputs: {\n async: \"async\"\n },\n features: [i0.ɵɵProvidersFeature([{\n provide: NG_ASYNC_VALIDATORS,\n useExisting: forwardRef(() => AsyncValidationDirective),\n multi: true\n }])]\n });\n return AsyncValidationDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst VALIDATOR_CONFIG$1 = \"validatorConfig\";\nconst FILE_VALIDATOR_NAMES = [\"extension\", \"fileSize\", \"file\"];\nlet FileControlDirective = /*#__PURE__*/(() => {\n class FileControlDirective {\n constructor(elementRef) {\n this.elementRef = elementRef;\n this.isProcessed = false;\n this.validators = [];\n this.onChange = _ => {};\n this.onTouched = () => {};\n this.element = elementRef.nativeElement;\n }\n onChangeCall(element) {\n let files = element.files;\n if (this.writeFile) this.onChange(files);else {\n if (files.length > 0) this.onChange(element.value);else this.onChange(undefined);\n }\n }\n writeValue(value) {}\n registerOnChange(invocation) {\n this.onChange = invocation;\n }\n registerOnTouched(invocation) {\n this.onTouched = invocation;\n }\n set extension(config) {\n this.pushValidator(FILE_VALIDATOR_NAMES[0], config);\n }\n set fileSize(config) {\n this.pushValidator(FILE_VALIDATOR_NAMES[1], config);\n }\n set file(config) {\n this.pushValidator(FILE_VALIDATOR_NAMES[2], config);\n }\n setConfig(control) {\n FILE_VALIDATOR_NAMES.forEach(t => {\n if (!this[t] && control[VALIDATOR_CONFIG$1] && control[VALIDATOR_CONFIG$1][t]) this[t] = control[VALIDATOR_CONFIG$1][t];\n });\n this.isProcessed = true;\n }\n pushValidator(validatorName, config) {\n if (config) this.validators.push(APP_VALIDATORS[validatorName](config));\n }\n validate(control) {\n if (!this.isProcessed) this.setConfig(control);\n var result = null;\n for (var validator of this.validators) {\n result = validator(control, this.element.files);\n if (result) break;\n }\n return result;\n }\n }\n FileControlDirective.ɵfac = function FileControlDirective_Factory(ɵt) {\n return new (ɵt || FileControlDirective)(i0.ɵɵdirectiveInject(i0.ElementRef));\n };\n FileControlDirective.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: FileControlDirective,\n selectors: [[\"input\", \"type\", \"file\"]],\n hostBindings: function FileControlDirective_HostBindings(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵlistener(\"change\", function FileControlDirective_change_HostBindingHandler($event) {\n return ctx.onChangeCall($event.target);\n })(\"blur\", function FileControlDirective_blur_HostBindingHandler() {\n return ctx.onTouched();\n });\n }\n },\n inputs: {\n writeFile: \"writeFile\",\n extension: \"extension\",\n fileSize: \"fileSize\",\n file: \"file\"\n },\n features: [i0.ɵɵProvidersFeature([{\n provide: NG_VALUE_ACCESSOR,\n useExisting: FileControlDirective,\n multi: true\n }, {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => FileControlDirective),\n multi: true\n }])]\n });\n return FileControlDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst VALIDATOR_CONFIG = \"validatorConfig\";\nlet ImageFileControlDirective = /*#__PURE__*/(() => {\n class ImageFileControlDirective {\n constructor(elementRef) {\n this.elementRef = elementRef;\n this.isProcessed = false;\n this.element = elementRef.nativeElement;\n }\n set image(config) {\n this.imageValidation = APP_VALIDATORS.image(config);\n }\n setConfig(control) {\n let image = \"image\";\n if (!this[image] && control[VALIDATOR_CONFIG] && control[VALIDATOR_CONFIG][image]) this[image] = control[VALIDATOR_CONFIG][image];\n this.isProcessed = true;\n }\n validate(control) {\n if (!this.isProcessed) this.setConfig(control);\n if (this.imageValidation) {\n return this.imageValidation(control, this.element.files);\n }\n return of(null);\n }\n }\n ImageFileControlDirective.ɵfac = function ImageFileControlDirective_Factory(ɵt) {\n return new (ɵt || ImageFileControlDirective)(i0.ɵɵdirectiveInject(i0.ElementRef));\n };\n ImageFileControlDirective.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: ImageFileControlDirective,\n selectors: [[\"input\", \"type\", \"file\"]],\n inputs: {\n image: \"image\"\n },\n features: [i0.ɵɵProvidersFeature([{\n provide: NG_ASYNC_VALIDATORS,\n useExisting: forwardRef(() => ImageFileControlDirective),\n multi: true\n }])]\n });\n return ImageFileControlDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ControlExpressionProcess = /*#__PURE__*/(() => {\n class ControlExpressionProcess {\n constructor() {\n this.controlConfig = {};\n this.isProcessed = false;\n }\n setModelConfig(control) {\n this.isProcessed = true;\n if (this.controlConfig && this.controlConfig.validatorConfig) {\n control[VALIDATOR_CONFIG$2] = this.controlConfig.validatorConfig;\n this.controlConfig = undefined;\n }\n }\n }\n ControlExpressionProcess.ɵfac = function ControlExpressionProcess_Factory(ɵt) {\n return new (ɵt || ControlExpressionProcess)();\n };\n ControlExpressionProcess.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: ControlExpressionProcess,\n inputs: {\n name: \"name\",\n formControlName: \"formControlName\"\n }\n });\n return ControlExpressionProcess;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet BaseValidator = /*#__PURE__*/(() => {\n class BaseValidator extends ControlExpressionProcess {\n constructor() {\n super(...arguments);\n this.validators = [];\n }\n validation(control) {\n let result = null;\n for (let validator of this.validators) {\n result = validator(control);\n if (result) break;\n }\n if (!result && this.maskProvider) result = this.maskProvider.validate();\n return result;\n }\n setEventName() {\n var eventName = '';\n switch (this.element.tagName) {\n case INPUT:\n case TEXTAREA:\n eventName = this.element.type == CHECKBOX || this.element.type == RADIO || this.element.type == FILE ? CHANGE : INPUT;\n break;\n case SELECT:\n eventName = CHANGE;\n break;\n }\n this.eventName = eventName.toLowerCase();\n }\n }\n BaseValidator.ɵfac = /* @__PURE__ */(() => {\n let ɵBaseValidator_BaseFactory;\n return function BaseValidator_Factory(ɵt) {\n return (ɵBaseValidator_BaseFactory || (ɵBaseValidator_BaseFactory = i0.ɵɵgetInheritedFactory(BaseValidator)))(ɵt || BaseValidator);\n };\n })();\n BaseValidator.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: BaseValidator,\n inputs: {\n formControl: \"formControl\"\n },\n features: [i0.ɵɵInheritDefinitionFeature]\n });\n return BaseValidator;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst SIMPLE_EMAIL_VALIDATION = \"simple-email-validation\";\nconst ADVANCED_EMAIL_VALIDATION = \"advanced-email-validation\";\nclass MaskProvider {\n constructor(input, mask, renderer, formControl, config) {\n this.input = input;\n this.mask = mask;\n this.renderer = renderer;\n this.formControl = formControl;\n this.config = config;\n this.eventListeners = [];\n this.oldValue = '';\n this.type = 'text';\n this.slotChar = '_';\n this.autoClear = false;\n this.isInvalid = false;\n this.internalProcess = false;\n this.bind();\n }\n bind() {\n if (RegexValidator.isNotBlank(this.formControl.value)) this.input.value = this.formControl.value;\n this.tests = [];\n this.partialPosition = this.mask.length;\n this.len = this.mask.length;\n this.firstNonMaskPos = null;\n this.defs = {\n '9': '[0-9]',\n 'a': '[A-Za-z]',\n '*': '[A-Za-z0-9]'\n };\n this.androidChrome = false;\n let maskTokens = this.mask.split('');\n for (let i = 0; i < maskTokens.length; i++) {\n let c = maskTokens[i];\n if (c == '?') {\n this.len--;\n this.partialPosition = i;\n } else if (this.defs[c]) {\n this.tests.push(new RegExp(this.defs[c]));\n if (this.firstNonMaskPos === null) {\n this.firstNonMaskPos = this.tests.length - 1;\n }\n if (i < this.partialPosition) {\n this.lastRequiredNonMaskPos = this.tests.length - 1;\n }\n } else {\n this.tests.push(null);\n }\n }\n this.minLength = this.config.minLength ? this.lastRequiredNonMaskPos - (this.lastRequiredNonMaskPos - this.config.minLength) : this.lastRequiredNonMaskPos;\n this.buffer = [];\n for (let i = 0; i < maskTokens.length; i++) {\n let c = maskTokens[i];\n if (c != '?') {\n if (this.defs[c]) this.buffer.push(this.getPlaceholder(i));else this.buffer.push(c);\n }\n }\n this.defaultBuffer = this.buffer.join('');\n this.focusText = this.input.value;\n this.bindEvents();\n this.checkVal();\n }\n bindEvents() {\n this.eventListeners.push(this.renderer.listen(this.input, FOCUS, this.onFocus.bind(this)));\n this.eventListeners.push(this.renderer.listen(this.input, BLUR, this.onBlur.bind(this)));\n this.eventListeners.push(this.renderer.listen(this.input, KEY_DOWN, this.onKeyDown.bind(this)));\n this.eventListeners.push(this.renderer.listen(this.input, KEY_PRESS, this.onKeyPress.bind(this)));\n this.eventListeners.push(this.renderer.listen(this.input, \"input\", this.onInput.bind(this)));\n this.eventListeners.push(this.renderer.listen(this.input, PASTE, this.handleInputChange.bind(this)));\n }\n validate() {\n if (this.input.value && this.oldValue != this.input.value) {\n this.checkVal(true);\n this.isCompleted(null, true);\n this.oldValue = this.input.value;\n }\n let config = getConfigObject(this.config, this.formControl);\n if (RegexValidator.isNotBlank(this.getUnmaskedValue()) && FormProvider.ProcessRule(this.formControl, config)) {\n if (this.isInvalid) {\n return ObjectMaker.toJson(AnnotationTypes.mask, config, [this.formControl.value]);\n }\n }\n return ObjectMaker.null();\n }\n writeValue(value) {\n this.value = value;\n if (this.input) {\n if (this.value == undefined || this.value == null) {\n this.input.value = '';\n }\n this.checkVal();\n }\n this.updateFilledState();\n }\n caret(first, last) {\n let range, begin, end;\n if (!this.input.offsetParent || this.input !== document.activeElement) {\n return;\n }\n if (typeof first == 'number') {\n begin = first;\n end = typeof last === 'number' ? last : begin;\n if (this.input.setSelectionRange) {\n this.input.setSelectionRange(begin, end);\n } else if (this.input['createTextRange']) {\n range = this.input['createTextRange']();\n range.collapse(true);\n range.moveEnd('character', end);\n range.moveStart('character', begin);\n range.select();\n }\n } else {\n if (this.input.setSelectionRange) {\n begin = this.input.selectionStart;\n end = this.input.selectionEnd;\n } else if (document['selection'] && document['selection'].createRange) {\n range = document['selection'].createRange();\n begin = 0 - range.duplicate().moveStart('character', -100000);\n end = begin + range.text.length;\n }\n return {\n begin: begin,\n end: end\n };\n }\n }\n isCompleted(lastRequiredNonMaskPos, isNotRunValidator) {\n let completed;\n lastRequiredNonMaskPos = lastRequiredNonMaskPos || this.lastRequiredNonMaskPos;\n for (let i = this.firstNonMaskPos; i <= lastRequiredNonMaskPos; i++) {\n if (this.tests[i] && this.buffer[i] === this.getPlaceholder(i)) {\n return false;\n }\n }\n this.isInvalid = false;\n if (!isNotRunValidator) this.formControl.updateValueAndValidity();\n return true;\n }\n getPlaceholder(i) {\n if (i < this.slotChar.length) {\n return this.slotChar.charAt(i);\n }\n return this.slotChar.charAt(0);\n }\n seekNext(pos) {\n while (++pos < this.len && !this.tests[pos]);\n return pos;\n }\n seekPrev(pos) {\n while (--pos >= 0 && !this.tests[pos]);\n return pos;\n }\n shiftL(begin, end) {\n let i, j;\n if (begin < 0) {\n return;\n }\n for (i = begin, j = this.seekNext(end); i < this.len; i++) {\n if (this.tests[i]) {\n if (j < this.len && this.tests[i].test(this.buffer[j])) {\n this.buffer[i] = this.buffer[j];\n this.buffer[j] = this.getPlaceholder(j);\n } else {\n break;\n }\n j = this.seekNext(j);\n }\n }\n this.writeBuffer();\n this.caret(Math.max(this.firstNonMaskPos, begin));\n }\n shiftR(pos) {\n let i, c, j, t;\n for (i = pos, c = this.getPlaceholder(pos); i < this.len; i++) {\n if (this.tests[i]) {\n j = this.seekNext(i);\n t = this.buffer[i];\n this.buffer[i] = c;\n if (j < this.len && this.tests[j].test(t)) {\n c = t;\n } else {\n break;\n }\n }\n }\n }\n handleAndroidInput(e) {\n var curVal = this.input.value;\n var pos = this.caret();\n if (this.oldVal && this.oldVal.length && this.oldVal.length > curVal.length) {\n this.checkVal(true);\n while (pos.begin > 0 && !this.tests[pos.begin - 1]) pos.begin--;\n if (pos.begin === 0) {\n while (pos.begin < this.firstNonMaskPos && !this.tests[pos.begin]) pos.begin++;\n }\n this.caret(pos.begin, pos.begin);\n } else {\n var pos2 = this.checkVal(true);\n while (pos.begin < this.len && !this.tests[pos.begin]) pos.begin++;\n this.caret(pos.begin, pos.begin);\n }\n if (this.isCompleted()) {\n this.isInvalid = false;\n } else {\n this.isInvalid = true;\n this.formControl.updateValueAndValidity();\n }\n }\n onBlur(e) {\n this.focus = false;\n this.checkVal();\n this.updateModel(e);\n this.updateFilledState();\n if (this.input.value != this.focusText) {\n let event = document.createEvent('HTMLEvents');\n event.initEvent('change', true, false);\n this.input.dispatchEvent(event);\n let maskedValue = this.input.value;\n this.formControl.setValue(this.config.valueWithMask ? maskedValue : this.getUnmaskedValue());\n this.input.value = maskedValue;\n }\n }\n onKeyDown(e) {\n let k = e.which || e.keyCode,\n pos,\n begin,\n end;\n let iPhone = false;\n this.oldVal = this.input.value;\n let controlValid = this.config.minLength ? this.isCompleted(this.minLength + 1) : false;\n if (k === 8 || k === 46 || iPhone && k === 127) {\n pos = this.caret();\n begin = pos.begin;\n end = pos.end;\n if (end - begin === 0) {\n begin = k !== 46 ? this.seekPrev(begin) : end = this.seekNext(begin - 1);\n end = k === 46 ? this.seekNext(end) : end;\n }\n this.clearBuffer(begin, end);\n this.shiftL(begin, end - 1);\n this.setControlValue(e, false, controlValid);\n this.updateModel(e);\n e.preventDefault();\n } else if (k === 13) {\n this.onBlur(e);\n this.setControlValue(e, false, controlValid);\n this.updateModel(e);\n } else if (k === 27) {\n this.input.value = this.focusText;\n this.caret(0, this.checkVal());\n this.updateModel(e);\n this.setControlValue(e, false, controlValid);\n e.preventDefault();\n }\n }\n onKeyPress(e) {\n var k = e.which || e.keyCode,\n pos = this.caret(),\n p,\n c,\n next,\n completed;\n if (e.ctrlKey || e.altKey || e.metaKey || k < 32) {\n return;\n } else if (k && k !== 13) {\n if (pos.end - pos.begin !== 0) {\n this.clearBuffer(pos.begin, pos.end);\n this.shiftL(pos.begin, pos.end - 1);\n }\n p = this.seekNext(pos.begin - 1);\n if (p < this.len) {\n c = String.fromCharCode(k);\n if (this.tests[p].test(c)) {\n this.shiftR(p);\n this.buffer[p] = c;\n this.writeBuffer();\n next = this.seekNext(p);\n this.caret(next);\n if (pos.begin <= this.lastRequiredNonMaskPos) {\n completed = this.isCompleted();\n }\n }\n }\n e.preventDefault();\n }\n this.updateModel(e);\n if (completed === undefined) completed = this.isCompleted();\n this.setControlValue(e, completed, this.config.minLength ? this.isCompleted(this.minLength) : false);\n }\n clearBuffer(start, end) {\n let i;\n for (i = start; i < end && i < this.len; i++) {\n if (this.tests[i]) {\n this.buffer[i] = this.getPlaceholder(i);\n }\n }\n }\n writeBuffer() {\n this.input.value = this.buffer.join('');\n }\n checkVal(allow) {\n let test = this.input.value,\n lastMatch = -1,\n i,\n c,\n pos;\n for (i = 0, pos = 0; i < this.len; i++) {\n if (this.tests[i]) {\n this.buffer[i] = this.getPlaceholder(i);\n while (pos++ < test.length) {\n c = test.charAt(pos - 1);\n if (this.tests[i].test(c)) {\n this.buffer[i] = c;\n lastMatch = i;\n break;\n }\n }\n if (pos > test.length) {\n this.clearBuffer(i + 1, this.len);\n break;\n }\n } else {\n if (this.buffer[i] === test.charAt(pos)) {\n pos++;\n }\n if (i < this.partialPosition) {\n lastMatch = i;\n }\n }\n }\n if (allow) {\n this.writeBuffer();\n } else if (lastMatch + 1 < this.partialPosition && (!this.config.minLength || !(lastMatch >= this.minLength))) {\n if (this.autoClear || this.buffer.join('') === this.defaultBuffer) {\n this.isInvalid = true;\n } else {\n this.isInvalid = true;\n this.writeBuffer();\n }\n } else {\n this.writeBuffer();\n this.input.value = this.input.value.substring(0, lastMatch + 1);\n }\n return this.partialPosition ? i : this.firstNonMaskPos;\n }\n onFocus(event) {\n this.focus = true;\n clearTimeout(this.caretTimeoutId);\n let pos;\n this.focusText = this.input.value;\n pos = this.checkVal();\n this.caretTimeoutId = setTimeout(() => {\n if (this.input !== document.activeElement) {\n return;\n }\n this.writeBuffer();\n if (pos == this.mask.replace(\"?\", \"\").length) {\n this.caret(0, pos);\n } else {\n this.caret(pos);\n }\n this.updateFilledState();\n }, 10);\n }\n onInput(event) {\n if (this.androidChrome) this.handleAndroidInput(event);else this.handleInputChange(event);\n }\n setControlValue(e, isValid, isValidControl) {\n this.isInvalid = isValidControl ? !isValidControl : !isValid;\n let value = this.input.value;\n let controlValue = '';\n if (!this.isInvalid) controlValue = this.config.valueWithMask ? value : this.getUnmaskedValue();\n this.formControl.setValue(controlValue);\n this.oldValue = this.input.value = value;\n if (!isValid) this.onFocus(e);\n }\n handleInputChange(event) {\n setTimeout(() => {\n var pos = this.checkVal(true);\n this.caret(pos);\n this.updateModel(event);\n this.setControlValue(event, this.isCompleted());\n }, 0);\n }\n getUnmaskedValue() {\n let unmaskedBuffer = [];\n for (let i = 0; i < this.buffer.length; i++) {\n let c = this.buffer[i];\n if (this.tests[i] && c != this.getPlaceholder(i)) {\n unmaskedBuffer.push(c);\n }\n }\n return unmaskedBuffer.join('');\n }\n updateModel(e) {}\n updateFilledState() {\n this.filled = this.input && this.input.value != '';\n }\n onDestroy() {\n let eventCount = this.eventListeners.length;\n for (var i = 0; i < eventCount; i++) {\n this.eventListeners[0]();\n this.eventListeners.splice(0, 1);\n }\n this.eventListeners = [];\n }\n}\nlet DecimalProvider = /*#__PURE__*/(() => {\n class DecimalProvider {\n constructor(decimalPipe, localeId) {\n this.decimalPipe = decimalPipe;\n this.localeId = localeId;\n this.decimalSeperator = \".\";\n this.groupSeperator = \",\";\n this.isSetConfig = false;\n this.decimalSeperator = getLocaleNumberSymbol(localeId, NumberSymbol.Decimal);\n ;\n this.groupSeperator = getLocaleNumberSymbol(localeId, NumberSymbol.Group);\n this.setSymbolInConfig();\n }\n replacer(value) {\n value = String(value);\n if (!this.isSetConfig) this.bindConfig();\n value = value.split(this.groupSeperator).join(BLANK);\n if (this.allowDecimalSymbol) value = value.replace(this.decimalSeperator, this.allowDecimalSymbol);\n var splitValue = value.split(this.decimalSeperator);\n value = splitValue.length > 1 && splitValue[1] && RegexValidator.isZero(splitValue[1]) ? splitValue[0] : value;\n return value;\n }\n transFormDecimal(value, digitsInfo, persistZero) {\n value = String(value);\n if (!value) {\n return value;\n }\n let transformedValue = this.decimalPipe.transform(value.replace(ReactiveFormConfig.number.groupSymbol, \"\").replace(this.decimalSeperator, \".\"), digitsInfo, this.localeId);\n if (persistZero && value.indexOf(this.decimalSeperator)) {\n let splitTransformed = transformedValue.split(\".\");\n let splitDigitsInfo = digitsInfo ? digitsInfo.split(\"-\") : [];\n let digits = splitDigitsInfo.length > 1 ? parseInt(splitDigitsInfo[splitDigitsInfo.length - 1]) : 0;\n if (splitTransformed.length > 1 && splitDigitsInfo.length > 0 && digits !== 0 && splitTransformed[1].length !== digits) {\n let diff = digits - splitTransformed[1].length;\n for (let i = 0; i < diff; i++) {\n transformedValue += \"0\";\n }\n }\n }\n return transformedValue;\n }\n setSymbolInConfig() {\n ReactiveFormConfig.number = {\n decimalSymbol: this.decimalSeperator,\n groupSymbol: this.groupSeperator\n };\n }\n bindConfig() {\n if (ReactiveFormConfig.json) {\n if (ReactiveFormConfig.json.localeId) this.localeId = ReactiveFormConfig.json.localeId;\n if (ReactiveFormConfig.json.allowDecimalSymbol) this.allowDecimalSymbol = ReactiveFormConfig.json.allowDecimalSymbol;\n }\n this.isSetConfig = true;\n }\n }\n DecimalProvider.ɵfac = function DecimalProvider_Factory(ɵt) {\n return new (ɵt || DecimalProvider)(i0.ɵɵinject(i1.DecimalPipe), i0.ɵɵinject(LOCALE_ID));\n };\n DecimalProvider.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DecimalProvider,\n factory: DecimalProvider.ɵfac\n });\n return DecimalProvider;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst NGMODEL_BINDING = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => RxFormControlDirective),\n multi: true\n};\nconst ALLOW_VALIDATOR_WITHOUT_CONFIG = ['required', 'notEmpty', 'alpha', 'alphaNumeric', 'ascii', 'dataUri', 'digit', 'email', 'even', 'hexColor', 'json', 'latitude', 'latLong', 'leapYear', 'longitude', 'lowerCase', 'mac', 'odd', 'port', 'primeNumber', 'time', 'upperCase', 'url', 'unique', 'cusip', 'gird'];\nconst NUMERIC = \"numeric\";\nconst IS_FORMAT = \"isFormat\";\nconst DIGITS_INFO = \"digitsInfo\";\nlet RxFormControlDirective = /*#__PURE__*/(() => {\n class RxFormControlDirective extends BaseValidator {\n constructor(elementRef, renderer, decimalProvider) {\n super();\n this.elementRef = elementRef;\n this.renderer = renderer;\n this.decimalProvider = decimalProvider;\n this.eventListeners = [];\n this.isNumericSubscribed = false;\n this.isFocusCalled = false;\n this.isMasked = false;\n this.element = elementRef.nativeElement;\n this.setEventName();\n }\n set validationControls(value) {\n this.controls = value;\n }\n get validationControls() {\n return this.controls;\n }\n ngOnInit() {\n let validators = [];\n Object.keys(APP_VALIDATORS).forEach(validatorName => {\n if (this[`rx${validatorName}`] || ALLOW_VALIDATOR_WITHOUT_CONFIG.indexOf(validatorName) != -1 && this[`rx${validatorName}`] == BLANK) {\n validators.push(APP_VALIDATORS[validatorName](this[`rx${validatorName}`]));\n if (this.name && !(this.formControlName && this.formControl)) {\n ApplicationUtil.configureControl(this.controlConfig, this[`rx${validatorName}`], validatorName);\n }\n }\n });\n if (validators.length > 0) this.validators = validators;\n if (this.rxnumeric && (this.rxnumeric.isFormat || this.rxnumeric.digitsInfo)) {\n this.bindNumericElementEvent();\n }\n }\n blurEvent() {\n if (!(this.formControl && this.formControl.errors && this.formControl.errors.numeric)) {\n if (this.formControl.value !== null && this.formControl.value !== undefined) {\n let value = this.decimalProvider.transFormDecimal(this.formControl.value, this.rxnumeric.digitsInfo, this.rxnumeric.persistZero);\n value = !this.rxnumeric.isFormat ? this.decimalProvider.replacer(value) : value;\n this.setValueOnElement(value);\n }\n this.isFocusCalled = false;\n }\n }\n bindNumericElementEvent(config) {\n if (config) this.rxnumeric = config;\n let listener = this.renderer.listen(this.element, BLUR, this.blurEvent.bind(this));\n this.eventListeners.push(listener);\n listener = this.renderer.listen(this.element, FOCUS, event => {\n this.isFocusCalled = true;\n if (!(this.formControl && this.formControl.errors && this.formControl.errors.numeric) && this.formControl.value != null) {\n let value = this.decimalProvider.replacer(this.element.value);\n this.setValueOnElement(value);\n }\n });\n this.eventListeners.push(listener);\n }\n bindValueChangeEvent() {\n if (this.eventName != BLANK) {\n let listener = this.renderer.listen(this.element, this.eventName, () => {\n Object.keys(this.validationControls).forEach(fieldName => {\n this.validationControls[fieldName].updateValueAndValidity();\n });\n });\n this.eventListeners.push(listener);\n }\n }\n subscribeNumericFormatter() {\n if (this.formControl[VALIDATOR_CONFIG$2] && this.formControl[VALIDATOR_CONFIG$2][NUMERIC] && (this.formControl[VALIDATOR_CONFIG$2][NUMERIC][IS_FORMAT] || this.formControl[VALIDATOR_CONFIG$2][NUMERIC][DIGITS_INFO])) {\n if (!this.isNumericSubscribed) {\n this.bindNumericElementEvent(this.formControl[VALIDATOR_CONFIG$2][NUMERIC]);\n this.isNumericSubscribed = true;\n }\n if (!this.isFocusCalled && RegexValidator.isNotBlank(this.formControl.value)) {\n this.blurEvent();\n }\n }\n }\n subscribeMaskValidator() {\n if (this.formControl[VALIDATOR_CONFIG$2] && this.formControl[VALIDATOR_CONFIG$2][\"mask\"] && !this.isMasked) {\n let config = this.formControl[VALIDATOR_CONFIG$2][\"mask\"];\n this.maskProvider = new MaskProvider(this.element, config.mask, this.renderer, this.formControl, config);\n this.isMasked = true;\n }\n }\n setValueOnElement(value) {\n this.renderer.setProperty(this.element, ELEMENT_VALUE, value);\n }\n setTemplateValidators(control) {\n for (let validatorName in control[VALIDATOR_CONFIG$2]) {\n this[validatorName] = control[VALIDATOR_CONFIG$2][validatorName];\n }\n delete control[TEMPLATE_VALIDATION_CONFIG];\n delete control[VALIDATOR_CONFIG$2];\n this.ngOnInit();\n }\n updateOnElementClass(element) {\n var previousClassName = '';\n return function (className) {\n if (previousClassName) element.classList.remove(previousClassName);\n if (className) element.classList.add(className);\n previousClassName = className;\n };\n }\n setValidatorConfig(control) {\n if (!this.formControl) {\n this.formControl = control;\n let rxFormControl = this.formControl;\n if (rxFormControl.updateOnElementClass) rxFormControl.updateOnElementClass = this.updateOnElementClass(this.element);\n }\n this.subscribeMaskValidator();\n this.subscribeNumericFormatter();\n if (control[TEMPLATE_VALIDATION_CONFIG]) this.setTemplateValidators(control);\n if (control[CONDITIONAL_VALIDATOR]) {\n this.conditionalValidator = control[CONDITIONAL_VALIDATOR];\n delete control[CONDITIONAL_VALIDATOR];\n }\n }\n validate(control) {\n this.setValidatorConfig(control);\n if (this.conditionalValidator) this.conditionalValidator(control);\n if (!this.isProcessed) this.setModelConfig(control);\n return this.validators && this.validators.length > 0 || this.maskProvider ? this.validation(control) : null;\n }\n ngOnDestroy() {\n this.controls = undefined;\n let eventCount = this.eventListeners.length;\n for (var i = 0; i < eventCount; i++) {\n this.eventListeners[0]();\n this.eventListeners.splice(0, 1);\n }\n this.eventListeners = [];\n if (this.maskProvider) this.maskProvider.onDestroy();\n }\n }\n RxFormControlDirective.ɵfac = function RxFormControlDirective_Factory(ɵt) {\n return new (ɵt || RxFormControlDirective)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(DecimalProvider));\n };\n RxFormControlDirective.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: RxFormControlDirective,\n selectors: [[\"\", \"ngModel\", \"\"], [\"\", \"formControlName\", \"\"], [\"\", \"formControl\", \"\"]],\n inputs: {\n rxalpha: \"rxalpha\",\n rxalphaNumeric: \"rxalphaNumeric\",\n rxascii: \"rxascii\",\n rxcompare: \"rxcompare\",\n rxcompose: \"rxcompose\",\n rxcontains: \"rxcontains\",\n rxcreditCard: \"rxcreditCard\",\n rxdataUri: \"rxdataUri\",\n rxdifferent: \"rxdifferent\",\n rxdigit: \"rxdigit\",\n rxemail: \"rxemail\",\n rxendsWith: \"rxendsWith\",\n rxeven: \"rxeven\",\n rxextension: \"rxextension\",\n rxfactor: \"rxfactor\",\n rxfileSize: \"rxfileSize\",\n rxgreaterThanEqualTo: \"rxgreaterThanEqualTo\",\n rxgreaterThan: \"rxgreaterThan\",\n rxhexColor: \"rxhexColor\",\n rxjson: \"rxjson\",\n rxlatitude: \"rxlatitude\",\n rxlatLong: \"rxlatLong\",\n rxleapYear: \"rxleapYear\",\n rxlessThan: \"rxlessThan\",\n rxlessThanEqualTo: \"rxlessThanEqualTo\",\n rxlongitude: \"rxlongitude\",\n rxlowerCase: \"rxlowerCase\",\n rxmac: \"rxmac\",\n rxmaxDate: \"rxmaxDate\",\n rxmaxLength: \"rxmaxLength\",\n rxmaxNumber: \"rxmaxNumber\",\n rxminDate: \"rxminDate\",\n rxminLength: \"rxminLength\",\n rxminNumber: \"rxminNumber\",\n rxnumeric: \"rxnumeric\",\n rxodd: \"rxodd\",\n rxpassword: \"rxpassword\",\n rxport: \"rxport\",\n rxprimeNumber: \"rxprimeNumber\",\n rxrequired: \"rxrequired\",\n rxrange: \"rxrange\",\n rxrule: \"rxrule\",\n rxstartsWith: \"rxstartsWith\",\n rxtime: \"rxtime\",\n rxupperCase: \"rxupperCase\",\n rxurl: \"rxurl\",\n rxunique: \"rxunique\",\n rxnotEmpty: \"rxnotEmpty\",\n rxcusip: \"rxcusip\",\n rxgrid: \"rxgrid\",\n rxdate: \"rxdate\"\n },\n features: [i0.ɵɵProvidersFeature([NGMODEL_BINDING]), i0.ɵɵInheritDefinitionFeature]\n });\n return RxFormControlDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nvar UrlValidationType = /*#__PURE__*/function (UrlValidationType) {\n UrlValidationType[UrlValidationType[\"FQDN\"] = 1] = \"FQDN\";\n UrlValidationType[UrlValidationType[\"LocalHost\"] = 2] = \"LocalHost\";\n UrlValidationType[UrlValidationType[\"IntranetServer\"] = 3] = \"IntranetServer\";\n return UrlValidationType;\n}(UrlValidationType || {});\nclass FormBuilderConfiguration {\n constructor(formBuilderConfiguration) {\n if (formBuilderConfiguration) for (var column in formBuilderConfiguration) this[column] = formBuilderConfiguration[column];\n }\n}\nclass IAbstractControl extends AbstractControl {}\nlet ControlHostDirective = /*#__PURE__*/(() => {\n class ControlHostDirective {\n constructor(viewContainerRef) {\n this.viewContainerRef = viewContainerRef;\n }\n set portal(context) {\n if (context.templateRef) {\n if (this.view) {\n this.view.destroy();\n this.view = undefined;\n }\n this.view = this.viewContainerRef.createEmbeddedView(context.templateRef, context);\n }\n }\n ngOnDestroy() {\n if (this.view) this.view.destroy();\n if (this.viewContainerRef) this.viewContainerRef.clear();\n }\n }\n ControlHostDirective.ɵfac = function ControlHostDirective_Factory(ɵt) {\n return new (ɵt || ControlHostDirective)(i0.ɵɵdirectiveInject(i0.ViewContainerRef));\n };\n ControlHostDirective.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: ControlHostDirective,\n selectors: [[\"\", \"controlHost\", \"\"]],\n inputs: {\n portal: [0, \"controlHost\", \"portal\"]\n }\n });\n return ControlHostDirective;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass BaseFormBuilder {\n constructor() {}\n createInstance() {\n let instance = {};\n defaultContainer.modelIncrementCount = defaultContainer.modelIncrementCount + 1;\n let modelName = `RxWebModel${defaultContainer.modelIncrementCount}`;\n instance.constructor = Function(`\"use strict\";return(function ${modelName}(){ })`)();\n return instance;\n }\n createClassObject(model, formBuilderConfiguration, classInstance) {\n let instanceContainer = defaultContainer.get(model);\n let autoInstanceConfig = formBuilderConfiguration ? formBuilderConfiguration.autoInstanceConfig : undefined;\n if (!autoInstanceConfig) {\n return classInstance && typeof classInstance != \"function\" ? classInstance : getInstance(model, []);\n } else {\n classInstance = classInstance && typeof classInstance != \"function\" ? classInstance : getInstance(model, autoInstanceConfig.arguments || []);\n if (autoInstanceConfig.objectPropInstanceConfig && autoInstanceConfig.objectPropInstanceConfig.length > 0) {\n autoInstanceConfig.objectPropInstanceConfig.forEach(t => {\n let objectProperty = instanceContainer.properties.filter(property => property.name == t.propertyName && property.propertyType == OBJECT_PROPERTY)[0];\n if (objectProperty) {\n let data = classInstance[t.propertyName];\n classInstance[t.propertyName] = getInstance(objectProperty.entity, t.arguments || []);\n if (data) this.setObjectValue(data, classInstance[t.propertyName]);\n }\n });\n }\n if (autoInstanceConfig.arrayPropInstanceConfig && autoInstanceConfig.arrayPropInstanceConfig.length > 0) {\n autoInstanceConfig.arrayPropInstanceConfig.forEach(t => {\n let property = instanceContainer.properties.filter(property => property.name == t.propertyName && property.propertyType == ARRAY_PROPERTY)[0];\n if (property) {\n let data = classInstance[t.propertyName];\n classInstance[t.propertyName] = [];\n for (var i = 0; i < t.rowItems; i++) {\n let instance = getInstance(property.entity, t.arguments || []);\n if (data && data[i]) this.setObjectValue(data[i], instance);\n classInstance[t.propertyName].push(instance);\n }\n }\n });\n }\n return classInstance;\n }\n }\n updateObject(model, entityObject, formBuilderConfiguration) {\n let instanceContainer = instanceProvider(model);\n let classInstance = getInstance(model, []);\n if (instanceContainer) {\n instanceContainer.properties.forEach(t => {\n let entity = (t.propertyType == OBJECT_PROPERTY || t.propertyType == ARRAY_PROPERTY) && t.entity ? t.entity : formBuilderConfiguration && formBuilderConfiguration.genericEntities ? formBuilderConfiguration.genericEntities[t.name] : undefined;\n if (!entity && t.entityProvider) entity = t.entityProvider.call(entityObject);\n switch (t.propertyType) {\n case PROPERTY:\n classInstance[t.name] = this.getValue(entityObject, t, formBuilderConfiguration);\n break;\n case OBJECT_PROPERTY:\n let objectValue = this.getValue(entityObject, t, formBuilderConfiguration);\n if (objectValue) classInstance[t.name] = this.updateObject(entity, objectValue, formBuilderConfiguration);\n break;\n case ARRAY_PROPERTY:\n let arrayObjectValue = this.getValue(entityObject, t, formBuilderConfiguration);\n if (arrayObjectValue && Array.isArray(arrayObjectValue)) {\n classInstance[t.name] = [];\n for (let row of arrayObjectValue) {\n let instanceObject = this.updateObject(entity, row, formBuilderConfiguration);\n classInstance[t.name].push(instanceObject);\n }\n }\n break;\n }\n });\n }\n return classInstance;\n }\n instaceProvider(instanceFunc, entityObject) {\n return instanceProvider(instanceFunc, entityObject);\n }\n getDefaultValue(propertyInfo, value, formBuilderConfiguration) {\n let defaultValue = formBuilderConfiguration && formBuilderConfiguration.propsConfig && formBuilderConfiguration.propsConfig[propertyInfo.name] && formBuilderConfiguration.propsConfig[propertyInfo.name].defaultValue && !RegexValidator.isNotBlank(value) ? formBuilderConfiguration.propsConfig[propertyInfo.name].defaultValue : propertyInfo.defaultValue != undefined && !RegexValidator.isNotBlank(value) ? propertyInfo.defaultValue : value;\n return defaultValue;\n }\n sanitizeValue(instanceContainer, propertyName, value, entityObject, baseObject) {\n if (instanceContainer.sanitizers && instanceContainer.sanitizers[propertyName]) {\n for (let sanitizer of instanceContainer.sanitizers[propertyName]) value = SANITIZERS[sanitizer.name](value, sanitizer.config);\n }\n if (entityObject[propertyName] !== undefined && entityObject[propertyName] !== value) entityObject[propertyName] = value;\n if (baseObject[propertyName] !== undefined && baseObject[propertyName] !== value) baseObject[propertyName] = value;\n return value;\n }\n getValue(entityObject, propertyInfo, formBuilderConfiguration) {\n let propValue = propertyInfo.dataPropertyName ? entityObject[propertyInfo.dataPropertyName] : entityObject[propertyInfo.name];\n return this.getDefaultValue(propertyInfo, propValue, formBuilderConfiguration);\n }\n setObjectValue(entityObject, classInstance) {\n for (var column in entityObject) {\n classInstance[column] = entityObject[column];\n }\n }\n}\nfunction andValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n let validatorNames = Object.keys(config.validation);\n let failed = false;\n for (var validatorName of validatorNames) {\n failed = typeof config.validation[validatorName] == \"boolean\" ? APP_VALIDATORS[validatorName]()(control) : APP_VALIDATORS[validatorName](config.validation[validatorName])(control);\n if (failed) break;\n }\n if (failed) return ObjectMaker.toJson(AnnotationTypes.and, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction orValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n let validatorNames = Object.keys(config.validation);\n let failed = false;\n for (var validatorName of validatorNames) {\n failed = typeof config.validation[validatorName] == \"boolean\" ? APP_VALIDATORS[validatorName]()(control) : APP_VALIDATORS[validatorName](config.validation[validatorName])(control);\n if (!failed) break;\n }\n if (failed) return ObjectMaker.toJson(AnnotationTypes.or, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nfunction notValidator(configModel) {\n return control => {\n let config = getConfigObject(configModel, control);\n if (ValidatorValueChecker.pass(control, config)) {\n let validatorNames = Object.keys(config.validation);\n let failed = false;\n for (var validatorName of validatorNames) {\n failed = typeof config.validation[validatorName] == \"boolean\" ? APP_VALIDATORS[validatorName]()(control) : APP_VALIDATORS[validatorName](config.validation[validatorName])(control);\n if (!failed) break;\n }\n if (!failed) return ObjectMaker.toJson(AnnotationTypes.not, config, [control.value]);\n }\n return ObjectMaker.null();\n };\n}\nconst LOGICAL_VALIDATORS = {\n and: andValidator,\n or: orValidator,\n not: notValidator\n};\nconst ASYNC = \"async\";\nconst ENTITY_OBJECT = \"entityObject\";\nlet RxFormBuilder = /*#__PURE__*/(() => {\n class RxFormBuilder extends BaseFormBuilder {\n constructor() {\n super();\n this.conditionalObjectProps = [];\n this.conditionalValidationInstance = {};\n this.builderConfigurationConditionalObjectProps = [];\n this.formGroupPropOtherValidator = {};\n this.currentFormGroupPropOtherValidator = {};\n this.isNested = false;\n this.isGroupCalled = false;\n this.isNestedBinding = false;\n }\n getInstanceContainer(instanceFunc, entityObject) {\n return this.instaceProvider(instanceFunc, entityObject);\n }\n setValue(formGroup, object) {\n for (var col in object) {\n var control = formGroup.get([col]);\n control.setValue(object[col]);\n control.updateValueAndValidity();\n }\n }\n extractExpressions(fomrBuilderConfiguration) {\n if (fomrBuilderConfiguration && fomrBuilderConfiguration.dynamicValidation) {\n for (var property in fomrBuilderConfiguration.dynamicValidation) {\n for (var decorator in fomrBuilderConfiguration.dynamicValidation[property]) {\n if (fomrBuilderConfiguration.dynamicValidation[property][decorator].conditionalExpression) {\n let columns = Linq.expressionColumns(fomrBuilderConfiguration.dynamicValidation[property][decorator].conditionalExpression);\n defaultContainer.addChangeValidation(this.conditionalValidationInstance, property, columns);\n }\n }\n }\n }\n return null;\n }\n addAsyncValidation(property, propertyValidators, propValidationConfig) {\n let asyncValidators = [];\n if (propertyValidators) {\n for (let propertyValidator of propertyValidators) {\n if (propertyValidator.isAsync) propertyValidator.config.forEach(t => {\n asyncValidators.push(t);\n });\n }\n }\n if (propValidationConfig && propValidationConfig[ASYNC]) {\n propValidationConfig[ASYNC].forEach(t => {\n asyncValidators.push(t);\n });\n }\n return asyncValidators;\n }\n addFormControl(property, propertyValidators, propValidationConfig, instance, entity) {\n let validators = [];\n let columns = [];\n if (instance.conditionalValidationProps && instance.conditionalValidationProps[property.name] || this.conditionalValidationInstance.conditionalValidationProps && this.conditionalValidationInstance.conditionalValidationProps[property.name]) {\n let props = [];\n if (instance.conditionalValidationProps && instance.conditionalValidationProps[property.name]) instance.conditionalValidationProps[property.name].forEach(t => props.push(t));\n if (this.conditionalValidationInstance.conditionalValidationProps && this.conditionalValidationInstance.conditionalValidationProps[property.name]) this.conditionalValidationInstance.conditionalValidationProps[property.name].forEach(t => props.push(t));\n validators.push(conditionalChangeValidator(props));\n }\n if (this.conditionalObjectProps.length > 0 || this.builderConfigurationConditionalObjectProps.length > 0) {\n let propConditions = [];\n if (this.conditionalObjectProps) propConditions = this.conditionalObjectProps.filter(t => t.propName == property.name);\n if (this.builderConfigurationConditionalObjectProps) this.builderConfigurationConditionalObjectProps.filter(t => t.propName == property.name).forEach(t => propConditions.push(t));\n propConditions.forEach(t => {\n if (t.referencePropName && columns.indexOf(t.referencePropName) == -1) columns.push(t.referencePropName);\n });\n if (columns.length > 0) validators.push(conditionalChangeValidator(columns));\n }\n for (let propertyValidator of propertyValidators) {\n if (!propertyValidator.isAsync) {\n let config = propertyValidator.config;\n if (property.messageNexus) config = config ? {\n ...{\n messageNexus: property.messageNexus\n },\n ...config\n } : {\n messageNexus: property.messageNexus\n };\n switch (propertyValidator.annotationType) {\n case AnnotationTypes.rule:\n validators.push(APP_VALIDATORS[propertyValidator.annotationType](config, entity));\n break;\n case AnnotationTypes.and:\n case AnnotationTypes.or:\n case AnnotationTypes.not:\n validators.push(LOGICAL_VALIDATORS[propertyValidator.annotationType](config));\n break;\n default:\n validators.push(APP_VALIDATORS[propertyValidator.annotationType](config));\n break;\n }\n }\n }\n if (propValidationConfig) this.additionalValidation(validators, propValidationConfig);\n if (this.currentFormGroupPropOtherValidator[property.name]) this.currentFormGroupPropOtherValidator[property.name].forEach(t => {\n validators.push(t);\n });\n return validators;\n }\n additionalValidation(validations, propValidationConfig) {\n for (var col in AnnotationTypes) {\n if (propValidationConfig[AnnotationTypes[col]] && col != \"custom\") {\n validations.push(APP_VALIDATORS[AnnotationTypes[col]](propValidationConfig[AnnotationTypes[col]]));\n } else if (col == AnnotationTypes.custom && propValidationConfig[AnnotationTypes[col]]) validations.push(propValidationConfig[col]);\n }\n }\n getEntity(object, formBuilderConfiguration, propertyName, isSameObjectConstructor = false) {\n if (formBuilderConfiguration && formBuilderConfiguration.genericEntities && formBuilderConfiguration.genericEntities[propertyName]) return formBuilderConfiguration.genericEntities[propertyName];\n return isSameObjectConstructor ? object.constructor : undefined;\n }\n getObjectPropertyInstance(object, propertyInfo, formBuilderConfiguration) {\n if (propertyInfo.propertyType == OBJECT_PROPERTY && object[propertyInfo.name]) return object[propertyInfo.name].constructor;else if (propertyInfo.propertyType == ARRAY_PROPERTY && object[propertyInfo.name] && object[propertyInfo.name].length > 0) return object[propertyInfo.name][0].constructor;\n return this.getEntity(object, formBuilderConfiguration, propertyInfo.name);\n }\n checkObjectPropAdditionalValidation(instanceContainer, object, formBuilderConfiguration) {\n var props = instanceContainer.properties.filter(t => t.propertyType == OBJECT_PROPERTY || t.propertyType == ARRAY_PROPERTY);\n props.forEach(t => {\n let entity = t.entity;\n if (!t.entity) entity = this.getObjectPropertyInstance(object, t, formBuilderConfiguration);\n if (entity) {\n let instance = this.getInstanceContainer(entity, null);\n if (instance && instance.conditionalValidationProps) {\n for (var key in instance.conditionalValidationProps) {\n var prop = instanceContainer.properties.filter(t => t.name == key)[0];\n if (prop) {\n if (!instanceContainer.conditionalValidationProps) instanceContainer.conditionalValidationProps = {};\n if (!instanceContainer.conditionalValidationProps[key]) instanceContainer.conditionalValidationProps[key] = [];\n instance.conditionalValidationProps[key].forEach(x => {\n if (t.propertyType != ARRAY_PROPERTY) instanceContainer.conditionalValidationProps[key].push([t.name, x].join('.'));else instanceContainer.conditionalValidationProps[key].push([t.name, x].join('[]'));\n });\n }\n }\n }\n }\n });\n }\n getObject(model, entityObject, formBuilderConfiguration) {\n let json = {};\n if (typeof model == FUNCTION_STRING) json.model = model;\n if (typeof model == FUNCTION_STRING && entityObject instanceof FormBuilderConfiguration) {\n json.entityObject = this.createClassObject(json.model, entityObject);\n }\n if (entityObject && !(entityObject instanceof FormBuilderConfiguration)) json.entityObject = entityObject;\n if (entityObject instanceof FormBuilderConfiguration && !formBuilderConfiguration) json.formBuilderConfiguration = entityObject;else if (!(entityObject instanceof FormBuilderConfiguration) && formBuilderConfiguration) {\n json.formBuilderConfiguration = formBuilderConfiguration;\n json.entityObject = this.createClassObject(json.model, json.formBuilderConfiguration, json.entityObject);\n }\n if (!entityObject) {\n if (typeof model == OBJECT_STRING) json.model = model.constructor;\n json.entityObject = this.createClassObject(json.model, json.formBuilderConfiguration, model);\n } else if (model && entityObject instanceof FormBuilderConfiguration && typeof model == OBJECT_STRING) {\n json[MODEL] = model.constructor;\n json[ENTITY_OBJECT] = this.createClassObject(json.model, json.formBuilderConfiguration, model);\n }\n return json;\n }\n control(value, validators, asyncValidators) {\n return new RxFormControl(value, validators, asyncValidators, {}, {}, '', []);\n }\n array(values, validatorConfig) {\n let formArray = this.group({\n temp: values\n }, validatorConfig).get(\"temp\");\n var formBuilder = new FormBuilder();\n return formBuilder.array(formArray.controls);\n }\n group(groupObject, validatorConfig) {\n let modelInstance = super.createInstance();\n let entityObject = {};\n this.formGroupPropOtherValidator = {};\n this.currentFormGroupPropOtherValidator = this.formGroupPropOtherValidator;\n this.createValidatorFormGroup(groupObject, entityObject, modelInstance, validatorConfig);\n this.currentFormGroupPropOtherValidator = this.formGroupPropOtherValidator;\n this.isGroupCalled = true;\n let formGroup = this.formGroup(modelInstance.constructor, entityObject, validatorConfig);\n this.isGroupCalled = false;\n this.formGroupPropOtherValidator = {};\n this.currentFormGroupPropOtherValidator = this.formGroupPropOtherValidator;\n this.formGroupPropOtherValidator = {};\n return formGroup;\n }\n applyAllPropValidator(propName, validatorConfig, modelInstance) {\n if (validatorConfig && validatorConfig.applyAllProps) {\n if (!(validatorConfig.excludeProps && validatorConfig.excludeProps.length > 0 && validatorConfig.excludeProps.indexOf(propName) == -1)) {\n validatorConfig.applyAllProps.forEach(t => {\n if (t.name == RX_WEB_VALIDATOR) {\n t(propName, modelInstance);\n } else {\n if (!this.currentFormGroupPropOtherValidator[propName]) this.currentFormGroupPropOtherValidator[propName] = [];\n this.currentFormGroupPropOtherValidator[propName].push(t);\n }\n });\n }\n }\n }\n dynamicValidationPropCheck(propName, validatorConfig) {\n return validatorConfig == undefined ? true : !validatorConfig.dynamicValidationConfigurationPropertyName ? true : validatorConfig.dynamicValidationConfigurationPropertyName == propName ? false : true;\n }\n isNotObject(value) {\n return value instanceof Date || value === null || typeof value != OBJECT_STRING;\n }\n createValidatorFormGroup(groupObject, entityObject, modelInstance, validatorConfig) {\n for (var propName in groupObject) {\n var prop = groupObject[propName];\n if (prop instanceof Array && prop.length > 0 && this.isNotObject(prop[0])) {\n let propValidators = prop.length > 1 && prop[1] instanceof Array ? prop[1] : prop.length == 2 ? [prop[1]] : [];\n let propertyAdded = false;\n for (var i = 0; i < propValidators.length; i++) {\n if (propValidators[i].name == RX_WEB_VALIDATOR) {\n propValidators[i](propName, modelInstance);\n propertyAdded = true;\n } else {\n if (!this.currentFormGroupPropOtherValidator[propName]) this.currentFormGroupPropOtherValidator[propName] = [];\n this.currentFormGroupPropOtherValidator[propName].push(propValidators[i]);\n }\n }\n if (!propertyAdded) defaultContainer.initPropertyObject(propName, PROPERTY, undefined, typeof modelInstance == OBJECT_STRING ? modelInstance : {\n constructor: modelInstance\n });\n this.applyAllPropValidator(propName, validatorConfig, modelInstance);\n } else if (prop === null || prop === undefined || typeof prop == STRING || typeof prop == NUMBER || typeof prop == BOOLEAN$1 || prop instanceof Date) {\n defaultContainer.initPropertyObject(propName, PROPERTY, undefined, typeof modelInstance == OBJECT_STRING ? modelInstance : {\n constructor: modelInstance\n });\n this.applyAllPropValidator(propName, validatorConfig, modelInstance);\n } else if (prop instanceof Array) {\n if (prop instanceof FormArray) {\n entityObject[propName] = prop;\n } else {\n let propModelInstance = super.createInstance();\n if (typeof modelInstance == \"function\") modelInstance.constructor = modelInstance;\n defaultContainer.initPropertyObject(propName, ARRAY_PROPERTY, propModelInstance.constructor, modelInstance);\n entityObject[propName] = [];\n for (let row of prop) {\n let jObject = {};\n entityObject[propName].push(jObject);\n this.createValidatorFormGroup(row, jObject, propModelInstance.constructor, validatorConfig);\n }\n }\n } else if (typeof prop == OBJECT_STRING && !(prop instanceof FormControl || prop instanceof RxFormControl)) {\n let formGroup = prop instanceof FormArray ? prop.controls[0] : prop;\n if (!formGroup.model && (prop instanceof FormGroup || prop instanceof RxFormGroup)) {\n formGroup = this.group(formGroup.controls);\n }\n if (prop instanceof FormGroup || prop instanceof RxFormGroup) {\n entityObject[propName] = prop;\n defaultContainer.initPropertyObject(propName, OBJECT_PROPERTY, formGroup.model, modelInstance);\n } else if (prop instanceof FormArray) {\n entityObject[propName] = prop;\n defaultContainer.initPropertyObject(propName, ARRAY_PROPERTY, formGroup.model, modelInstance);\n } else {\n if (this.dynamicValidationPropCheck(propName, validatorConfig)) {\n this.formGroupPropOtherValidator[propName] = {};\n this.currentFormGroupPropOtherValidator = this.formGroupPropOtherValidator[propName];\n let propModelInstance = super.createInstance();\n entityObject[propName] = {};\n entityObject[propName].constructor = propModelInstance.constructor;\n defaultContainer.initPropertyObject(propName, OBJECT_PROPERTY, entityObject[propName].constructor, modelInstance.constructor == Function ? {\n constructor: modelInstance\n } : modelInstance);\n let objectValidationConfig = this.getValidatorConfig(validatorConfig, groupObject, propName + \".\");\n this.createValidatorFormGroup(groupObject[propName], entityObject[propName], entityObject[propName].constructor, objectValidationConfig);\n } else entityObject[propName] = groupObject[propName];\n }\n }\n if (typeof prop == STRING || typeof prop == NUMBER || typeof prop == BOOLEAN$1 || prop instanceof Date) {\n entityObject[propName] = prop;\n } else if (prop && prop.length > 0 && this.isNotObject(prop[0]) && !(prop instanceof FormControl || prop instanceof RxFormControl) && !(prop instanceof FormArray)) {\n entityObject[propName] = prop[0];\n } else if (prop instanceof FormArray) {\n entityObject[propName] = prop;\n } else if (prop instanceof FormControl || prop instanceof RxFormControl) {\n entityObject[propName] = prop;\n defaultContainer.initPropertyObject(propName, PROPERTY, undefined, modelInstance.constructor ? modelInstance : {\n constructor: modelInstance\n });\n }\n }\n }\n getValidatorConfig(validatorConfig, entityObject, rootPropertyName, arrayPropertyName) {\n let excludeProps = [];\n let includeProps = [];\n let ignoreUndefinedProps = [];\n if (!validatorConfig) return {};\n const validationProps = this.getObjectForProperty(validatorConfig.dynamicValidation, rootPropertyName, arrayPropertyName);\n const abstractControlOptions = this.getObjectForProperty(validatorConfig.abstractControlOptions, rootPropertyName, arrayPropertyName);\n if (validatorConfig.excludeProps) excludeProps = this.getProps(validatorConfig.excludeProps, rootPropertyName);\n if (validatorConfig.includeProps) includeProps = this.getProps(validatorConfig.includeProps, rootPropertyName);\n if (validatorConfig.ignoreUndefinedProps) ignoreUndefinedProps = this.getProps(validatorConfig.ignoreUndefinedProps, rootPropertyName, true);\n if (!Object.keys(abstractControlOptions).length && rootPropertyName.endsWith('.') && validatorConfig.abstractControlOptions && validatorConfig.abstractControlOptions[rootPropertyName.substring(0, rootPropertyName.length - 1)]) abstractControlOptions['global'] = validatorConfig.abstractControlOptions[rootPropertyName.substring(0, rootPropertyName.length - 1)];\n const dynamicValidation = validatorConfig.dynamicValidationConfigurationPropertyName && entityObject[validatorConfig.dynamicValidationConfigurationPropertyName] ? entityObject[validatorConfig.dynamicValidationConfigurationPropertyName] : validationProps;\n return {\n ignoreUndefinedProps: ignoreUndefinedProps,\n includeProps: includeProps,\n dynamicValidation: dynamicValidation,\n excludeProps: excludeProps,\n abstractControlOptions: abstractControlOptions\n };\n }\n getObjectForProperty(rootObject, rootPropertyName, arrayPropertyName) {\n const result = {};\n for (let propName in rootObject) {\n if (!propName.startsWith(rootPropertyName) && (!arrayPropertyName || !propName.startsWith(arrayPropertyName))) continue;\n let splitProp = propName.split(\".\", 2)[1];\n if (!splitProp) continue;\n result[splitProp] = rootObject[propName];\n }\n return result;\n }\n getProps(properties, rootPropertyName, isIgnoreProp = false) {\n let props = [];\n for (let prop of properties) {\n if (prop.indexOf(rootPropertyName) != -1) {\n let splitProps = prop.split(\".\");\n if (splitProps.length == 2) {\n props.push(splitProps[1]);\n } else if (splitProps.length > 2) {\n splitProps.splice(0, 1);\n props.push(splitProps.join(\".\"));\n }\n }\n }\n if (isIgnoreProp && properties.filter(x => x == rootPropertyName.replace('.', '')).length == 1) props.push(':self:');\n return props;\n }\n formGroup(model, entityObject, formBuilderConfiguration) {\n let json = this.getObject(model, entityObject, formBuilderConfiguration);\n model = json.model;\n entityObject = json.entityObject;\n if (entityObject.constructor != model && !this.isGroupCalled) {\n entityObject = json.entityObject = this.updateObject(model, json.entityObject, formBuilderConfiguration);\n }\n formBuilderConfiguration = json.formBuilderConfiguration;\n if (formBuilderConfiguration) this.extractExpressions(formBuilderConfiguration);\n let instanceContainer = this.getInstanceContainer(model, entityObject);\n this.checkObjectPropAdditionalValidation(instanceContainer, entityObject, formBuilderConfiguration);\n let formGroupObject = {};\n let extendedProperties = {};\n let formChildGroup = undefined;\n let formArrayGroup = undefined;\n var additionalValidations = {};\n instanceContainer.properties.forEach(property => {\n let isIncludeProp = true;\n if (formBuilderConfiguration) {\n if (formBuilderConfiguration.excludeProps && formBuilderConfiguration.excludeProps.length > 0) isIncludeProp = formBuilderConfiguration.excludeProps.indexOf(property.name) == -1;\n if (formBuilderConfiguration.dynamicValidation) additionalValidations = formBuilderConfiguration.dynamicValidation;\n if (formBuilderConfiguration.includeProps && formBuilderConfiguration.includeProps.length > 0) isIncludeProp = formBuilderConfiguration.includeProps.indexOf(property.name) != -1;\n if (formBuilderConfiguration.ignoreUndefinedProps && formBuilderConfiguration.ignoreUndefinedProps.length > 0) {\n isIncludeProp = !(property.propertyType == PROPERTY && !RegexValidator.isNotBlank(json.entityObject[property.name]) && (formBuilderConfiguration.ignoreUndefinedProps.indexOf(property.name) !== -1 || formBuilderConfiguration.ignoreUndefinedProps.indexOf(\":self:\") !== -1));\n }\n }\n if (property.ignore) isIncludeProp = !property.ignore.call(json.entityObject, json.entityObject);\n if (isIncludeProp) {\n switch (property.propertyType) {\n case PROPERTY:\n if (!(entityObject[property.name] instanceof FormControl || entityObject[property.name] instanceof RxFormControl)) {\n let propertyValidators = instanceContainer.propertyAnnotations.filter(t => t.propertyName == property.name && t.isValidator);\n let updateOn = instanceContainer.propertyAnnotations.filter(t => t.propertyName == property.name && !t.isValidator && t.annotationType === \"updateOn\")[0];\n let sanitizeValue = super.sanitizeValue(instanceContainer, property.name, super.getDefaultValue(property, entityObject[property.name], formBuilderConfiguration), json.entityObject, Object.assign({}, json.entityObject));\n if (entityObject[property.name] === undefined && sanitizeValue) entityObject[property.name] = sanitizeValue;\n let validators = this.addFormControl(property, propertyValidators, additionalValidations[property.name], instanceContainer, entityObject);\n let abstractControlOptions = {\n validators: validators,\n asyncValidators: this.addAsyncValidation(property, propertyValidators, additionalValidations[property.name])\n };\n abstractControlOptions = this.getAbstractControlOptions(property.name, formBuilderConfiguration, abstractControlOptions);\n if (updateOn && !abstractControlOptions.updateOn) abstractControlOptions.updateOn = updateOn.config.runOn;\n formGroupObject[property.name] = new RxFormControl(sanitizeValue, abstractControlOptions, undefined, json.entityObject, Object.assign({}, json.entityObject), property.name, instanceContainer.sanitizers[property.name]);\n this.isNested = false;\n } else formGroupObject[property.name] = super.getDefaultValue(property, entityObject[property.name], formBuilderConfiguration);\n extendedProperties[property.name] = true;\n break;\n case OBJECT_PROPERTY:\n let objectValue = entityObject[property.name];\n objectValue = !objectValue && property.defaultValue ? property.defaultValue : objectValue;\n if (!objectValue && property.objectConfig && property.objectConfig.autoCreate) objectValue = this.createClassObject(property.entity, {});\n if (objectValue && objectValue instanceof Object && !(objectValue instanceof FormGroup || objectValue instanceof RxFormGroup)) {\n this.isNestedBinding = this.isNested = true;\n if (instanceContainer && instanceContainer.conditionalObjectProps) this.conditionalObjectProps = instanceContainer.conditionalObjectProps.filter(t => t.objectPropName == property.name);\n if (this.conditionalValidationInstance && this.conditionalValidationInstance.conditionalObjectProps) this.builderConfigurationConditionalObjectProps = this.conditionalValidationInstance.conditionalObjectProps.filter(t => t.objectPropName == property.name);\n if (this.formGroupPropOtherValidator[property.name]) this.currentFormGroupPropOtherValidator = this.formGroupPropOtherValidator[property.name];\n let objectValidationConfig = this.getValidatorConfig(formBuilderConfiguration, objectValue, `${property.name}.`);\n let entity = property.entityProvider ? property.entityProvider.call(entityObject) : undefined;\n formGroupObject[property.name] = this.formGroup(entity || property.entity || this.getEntity(objectValue, formBuilderConfiguration, property.name, true), objectValue, objectValidationConfig);\n this.conditionalObjectProps = [];\n this.builderConfigurationConditionalObjectProps = [];\n this.isNestedBinding = this.isNested = false;\n } else if (objectValue instanceof FormGroup || objectValue instanceof RxFormGroup) formGroupObject[property.name] = objectValue;\n break;\n case ARRAY_PROPERTY:\n let arrayObjectValue = entityObject[property.name];\n if (arrayObjectValue && arrayObjectValue instanceof Array && !(arrayObjectValue instanceof FormArray)) {\n this.isNestedBinding = this.isNested = true;\n var formArrayGroup = [];\n let index = 0;\n let entity = property.entityProvider ? property.entityProvider.call(entityObject) : undefined;\n let objectValidationConfig = null;\n for (let subObject of arrayObjectValue) {\n if (instanceContainer && instanceContainer.conditionalObjectProps) this.conditionalObjectProps = instanceContainer.conditionalObjectProps.filter(t => t.objectPropName == property.name && t.arrayIndex == index);\n if (this.conditionalValidationInstance && this.conditionalValidationInstance.conditionalObjectProps) this.builderConfigurationConditionalObjectProps = this.conditionalValidationInstance.conditionalObjectProps.filter(t => t.objectPropName == property.name && t.arrayIndex == index);\n if (this.formGroupPropOtherValidator[property.name]) this.currentFormGroupPropOtherValidator = this.formGroupPropOtherValidator[property.name];\n objectValidationConfig = this.getValidatorConfig(formBuilderConfiguration, subObject, `${property.name}.`, `${property.name}[${index}].`);\n formArrayGroup.push(this.formGroup(entity || property.entity || this.getEntity(subObject, formBuilderConfiguration, property.name, true), subObject, objectValidationConfig));\n index++;\n this.conditionalObjectProps = [];\n this.builderConfigurationConditionalObjectProps = [];\n }\n let abstractControlOptions = this.getAbstractControlOptions(property.name, formBuilderConfiguration, {});\n formGroupObject[property.name] = new RxFormArray(arrayObjectValue, formArrayGroup, abstractControlOptions, null, property.arrayConfig);\n if (ReactiveFormConfig.autoInstancePush) {\n arrayObjectValue.push = instance => {\n let formGroup = this.formGroup(instance.constructor, instance, objectValidationConfig);\n formGroupObject[property.name].push(formGroup, {\n isAddedInstance: true\n });\n return 0;\n };\n arrayObjectValue.splice = (start, deleteCount) => {\n let end = start + deleteCount - 1;\n for (var i = start; i <= end; i++) {\n formGroupObject[property.name].removeAt(i, {\n isRemovedInstance: true\n });\n }\n return [];\n };\n }\n this.isNestedBinding = this.isNested = false;\n } else if (arrayObjectValue instanceof FormArray) formGroupObject[property.name] = arrayObjectValue;else if (property.arrayConfig && property.arrayConfig.createBlank) formGroupObject[property.name] = new RxFormArray([], [], null, null, property.arrayConfig);\n break;\n }\n }\n });\n if (!this.isNested) {\n this.conditionalValidationInstance = {};\n this.builderConfigurationConditionalObjectProps = [];\n }\n let abstractControlOptions = {\n validators: [],\n asyncValidators: [],\n updateOn: formBuilderConfiguration && formBuilderConfiguration.abstractControlOptions && formBuilderConfiguration.abstractControlOptions['global'] ? formBuilderConfiguration.abstractControlOptions['global'] : undefined\n };\n abstractControlOptions = this.getAbstractControlOptions(\"global\", formBuilderConfiguration, abstractControlOptions);\n let formGroup = new RxFormGroup(json.model, json.entityObject, formGroupObject, abstractControlOptions);\n if (defaultContainer.isExperimental) {\n json.entityObject[\"formGroup\"] = formGroup;\n this.overrideProperties(formGroup, json.entityObject, extendedProperties);\n }\n if (!this.isNestedBinding && !this.isGroupCalled) formGroup.refreshDisable();\n return formGroup;\n }\n overrideProperties(formGroup, entityObject, properties) {\n Object.keys(properties).forEach(t => {\n this.overrideProp(entityObject, t, formGroup);\n });\n }\n getAbstractControlOptions(name, formBuilderConfiguration, abstractControlOptions) {\n if (formBuilderConfiguration && formBuilderConfiguration.abstractControlOptions && formBuilderConfiguration.abstractControlOptions[name]) abstractControlOptions.updateOn = formBuilderConfiguration.abstractControlOptions[name];\n const controlOptions = formBuilderConfiguration ? formBuilderConfiguration.baseAbstractControlOptions : null;\n if (controlOptions && controlOptions[name]) {\n if (controlOptions[name].updateOn) abstractControlOptions.updateOn = controlOptions[name].updateOn;\n if (controlOptions[name].validators) {\n if (Array.isArray(controlOptions[name].validators)) controlOptions[name].validators.forEach(validator => abstractControlOptions.validators.push(validator));else abstractControlOptions.validators.push(controlOptions[name].validators);\n }\n if (controlOptions[name].asyncValidators) {\n if (Array.isArray(controlOptions[name].asyncValidators)) controlOptions[name].asyncValidators.forEach(validator => abstractControlOptions.asyncValidators.push(validator));else abstractControlOptions.asyncValidators.push(controlOptions[name].validators);\n }\n }\n return abstractControlOptions;\n }\n overrideProp(entityObject, propName, formGroup) {\n let descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(entityObject), propName);\n let value = entityObject[propName];\n let oldValue = null;\n Object.defineProperty(entityObject, propName, {\n get: () => {\n return descriptor ? descriptor.get.call(entityObject) : value;\n },\n set: v => {\n value = v;\n if (oldValue != v) {\n if (descriptor) descriptor.set.call(entityObject, v);\n if (!formGroup.changing && formGroup.controls[propName]) {\n formGroup.controls[propName].setValue(v);\n }\n }\n oldValue = v;\n }\n });\n }\n }\n RxFormBuilder.ɵfac = function RxFormBuilder_Factory(ɵt) {\n return new (ɵt || RxFormBuilder)();\n };\n RxFormBuilder.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RxFormBuilder,\n factory: RxFormBuilder.ɵfac\n });\n return RxFormBuilder;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet TypedFormBuilder = /*#__PURE__*/(() => {\n class TypedFormBuilder {\n constructor() {\n this.formBuilder = new FormBuilder();\n this.rxFormBuilder = new RxFormBuilder();\n }\n group(controlsConfig, options) {\n let paramOptions = options || {};\n if (typeof controlsConfig == FUNCTION_STRING) return !(paramOptions && paramOptions.isInstance) ? this.rxFormBuilder.formGroup(controlsConfig, paramOptions.data, paramOptions.config) : this.rxFormBuilder.formGroup(controlsConfig, paramOptions.data, paramOptions.config).modelInstance;\n return this.formBuilder.group(controlsConfig, options);\n }\n }\n TypedFormBuilder.ɵfac = function TypedFormBuilder_Factory(ɵt) {\n return new (ɵt || TypedFormBuilder)();\n };\n TypedFormBuilder.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: TypedFormBuilder,\n factory: TypedFormBuilder.ɵfac\n });\n return TypedFormBuilder;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet RxReactiveFormsModule = /*#__PURE__*/(() => {\n class RxReactiveFormsModule {\n static forRoot() {\n return {\n ngModule: RxReactiveFormsModule,\n providers: []\n };\n }\n }\n RxReactiveFormsModule.ɵfac = function RxReactiveFormsModule_Factory(ɵt) {\n return new (ɵt || RxReactiveFormsModule)();\n };\n RxReactiveFormsModule.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: RxReactiveFormsModule\n });\n RxReactiveFormsModule.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n providers: [RxFormBuilder, DecimalProvider, DecimalPipe],\n imports: [CommonModule, FormsModule, ReactiveFormsModule]\n });\n return RxReactiveFormsModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n// Experimental\nlet ReactiveTypedFormsModule = /*#__PURE__*/(() => {\n class ReactiveTypedFormsModule {\n constructor() {\n defaultContainer.isExperimental = true;\n ReactiveFormConfig.autoInstancePush = true;\n }\n static forRoot() {\n return {\n ngModule: ReactiveTypedFormsModule,\n providers: []\n };\n }\n }\n ReactiveTypedFormsModule.ɵfac = function ReactiveTypedFormsModule_Factory(ɵt) {\n return new (ɵt || ReactiveTypedFormsModule)();\n };\n ReactiveTypedFormsModule.ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: ReactiveTypedFormsModule\n });\n ReactiveTypedFormsModule.ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n providers: [{\n provide: FormBuilder,\n useClass: TypedFormBuilder\n }, TypedFormBuilder],\n imports: [CommonModule, FormsModule, ReactiveFormsModule, RxReactiveFormsModule.forRoot(), ReactiveFormsModule, FormsModule, ReactiveFormsModule]\n });\n return ReactiveTypedFormsModule;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction baseValidator(config, type, validator) {\n var rxwebValidator = (control, target) => {\n if (typeof control == STRING) defaultContainer.init(target, 0, control, type, config, false);else {\n if (config && (!control.validatorConfig || !control.validatorConfig[type])) ApplicationUtil.configureControl(control, config, type);\n return validator(control);\n }\n return null;\n };\n Object.defineProperty(rxwebValidator, \"name\", {\n value: RX_WEB_VALIDATOR\n });\n return rxwebValidator;\n}\nfunction baseAsyncValidatorExtension(config, type, validator) {\n var rxwebValidator = (control, target) => {\n if (typeof control == STRING) defaultContainer.init(target, 0, control, type, config, true);else {\n if (config && (!control.validatorConfig || !control.validatorConfig[type])) ApplicationUtil.configureControl(control, config, type);\n return validator(control);\n }\n return null;\n };\n Object.defineProperty(rxwebValidator, \"name\", {\n value: RX_WEB_VALIDATOR\n });\n return rxwebValidator;\n}\nfunction alphaValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.alpha, alphaValidator(config));\n}\nfunction alphaAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.alpha, baseAsyncValidator(config, AnnotationTypes.alpha));\n}\nfunction allOfValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.allOf, allOfValidator(config));\n}\nfunction allOfAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.allOf, baseAsyncValidator(config, AnnotationTypes.allOf));\n}\nfunction alphaNumericValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.alphaNumeric, alphaNumericValidator(config));\n}\nfunction alphaNumericAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.alphaNumeric, baseAsyncValidator(config, AnnotationTypes.alphaNumeric));\n}\nfunction choiceValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.choice, choiceValidator(config));\n}\nfunction choiceAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.choice, baseAsyncValidator(config, AnnotationTypes.choice));\n}\nfunction compareValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.compare, compareValidator(config));\n}\nfunction containsValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.contains, containsValidator(config));\n}\nfunction containsAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.contains, baseAsyncValidator(config, AnnotationTypes.contains));\n}\nfunction creditCardValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.creditCard, creditCardValidator(config));\n}\nfunction creditCardAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.creditCard, baseAsyncValidator(config, AnnotationTypes.creditCard));\n}\nfunction differentValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.different, differentValidator(config));\n}\nfunction digitValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.digit, digitValidator(config));\n}\nfunction emailValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.email, emailValidator(config));\n}\nfunction evenValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.even, evenValidator(config));\n}\nfunction factorValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.factor, factorValidator(config));\n}\nfunction factorAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.factor, baseAsyncValidator(config, AnnotationTypes.factor));\n}\nfunction greaterThanEqualToValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.greaterThanEqualTo, greaterThanEqualToValidator(config));\n}\nfunction greaterThanEqualToAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.greaterThanEqualTo, baseAsyncValidator(config, AnnotationTypes.greaterThanEqualTo));\n}\nfunction greaterThanValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.greaterThan, greaterThanValidator(config));\n}\nfunction greaterThanAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.greaterThan, baseAsyncValidator(config, AnnotationTypes.greaterThan));\n}\nfunction hexColorValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.hexColor, hexColorValidator(config));\n}\nfunction jsonValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.json, jsonValidator(config));\n}\nfunction leapYearValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.leapYear, leapYearValidator(config));\n}\nfunction lessThanEqualToValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.lessThanEqualTo, lessThanEqualToValidator(config));\n}\nfunction lessThanEqualToAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.lessThanEqualTo, baseAsyncValidator(config, AnnotationTypes.lessThanEqualTo));\n}\nfunction lessThanValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.lessThan, lessThanValidator(config));\n}\nfunction lessThanAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.lessThan, baseAsyncValidator(config, AnnotationTypes.lessThan));\n}\nfunction lowerCaseValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.lowerCase, lowercaseValidator(config));\n}\nfunction macValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.mac, macValidator(config));\n}\nfunction maxDateValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.maxDate, maxDateValidator(config));\n}\nfunction maxDateAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.maxDate, baseAsyncValidator(config, AnnotationTypes.maxDate));\n}\nfunction maxLengthValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.maxLength, maxLengthValidator(config));\n}\nfunction maxLengthAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.maxLength, baseAsyncValidator(config, AnnotationTypes.maxLength));\n}\nfunction maxNumberValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.maxNumber, maxNumberValidator(config));\n}\nfunction maxNumberAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.maxNumber, baseAsyncValidator(config, AnnotationTypes.maxNumber));\n}\nfunction minDateValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.minDate, minDateValidator(config));\n}\nfunction minDateAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.minDate, baseAsyncValidator(config, AnnotationTypes.minDate));\n}\nfunction minLengthValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.minLength, minLengthValidator(config));\n}\nfunction minLengthAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.minLength, baseAsyncValidator(config, AnnotationTypes.minLength));\n}\nfunction minNumberValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.minNumber, minNumberValidator(config));\n}\nfunction minNumberAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.minNumber, baseAsyncValidator(config, AnnotationTypes.minNumber));\n}\nfunction noneOfValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.noneOf, noneOfValidator(config));\n}\nfunction noneOfAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.noneOf, baseAsyncValidator(config, AnnotationTypes.noneOf));\n}\nfunction numericValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.numeric, numericValidator(config));\n}\nfunction numericAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.numeric, baseAsyncValidator(config, AnnotationTypes.numeric));\n}\nfunction oddValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.odd, oddValidator(config));\n}\nfunction oneOfValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.oneOf, oneOfValidator(config));\n}\nfunction oneOfAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.oneOf, baseAsyncValidator(config, AnnotationTypes.oneOf));\n}\nfunction passwordcValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.password, passwordValidator(config));\n}\nfunction passwordAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.password, baseAsyncValidator(config, AnnotationTypes.password));\n}\nfunction patternValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.pattern, patternValidator(config));\n}\nfunction patternAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.pattern, baseAsyncValidator(config, AnnotationTypes.pattern));\n}\nfunction rangeValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.range, rangeValidator(config));\n}\nfunction rangeAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.range, baseAsyncValidator(config, AnnotationTypes.range));\n}\nfunction requiredValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.required, requiredValidator(config));\n}\nfunction timeValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.time, timeValidator(config));\n}\nfunction timeAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.time, baseAsyncValidator(config, AnnotationTypes.time));\n}\nfunction upperCaseValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.upperCase, uppercaseValidator(config));\n}\nfunction urlValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.url, urlValidator(config));\n}\nfunction urlAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.url, baseAsyncValidator(config, AnnotationTypes.url));\n}\nfunction asciiValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.ascii, asciiValidator(config));\n}\nfunction dataUriValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.dataUri, dataUriValidator(config));\n}\nfunction portValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.port, portValidator(config));\n}\nfunction latLongValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.latLong, latLongValidator(config));\n}\nfunction extensionValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.extension, control => {\n return null;\n });\n}\nfunction extensionAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.extension, baseAsyncValidator(config, AnnotationTypes.extension));\n}\nfunction fileSizeValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.fileSize, control => {\n return null;\n });\n}\nfunction fileSizeAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.fileSize, baseAsyncValidator(config, AnnotationTypes.fileSize));\n}\nfunction endsWithValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.endsWith, endsWithValidator(config));\n}\nfunction endsWithAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.endsWith, baseAsyncValidator(config, AnnotationTypes.endsWith));\n}\nfunction startsWithValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.startsWithWith, startsWithValidator(config));\n}\nfunction startsWithAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.startsWithWith, baseAsyncValidator(config, AnnotationTypes.startsWith));\n}\nfunction primeNumberValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.primeNumber, primeNumberValidator(config));\n}\nfunction latitudeValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.latitude, latitudeValidator(config));\n}\nfunction longitudeValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.longitude, longitudeValidator(config));\n}\nfunction composeValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.compose, composeValidator(config));\n}\nfunction fileValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.file, control => {\n return null;\n });\n}\nfunction fileAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.file, baseAsyncValidator(config, AnnotationTypes.file));\n}\nfunction customValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.custom, customValidator(config));\n}\nfunction customAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.custom, baseAsyncValidator(config, AnnotationTypes.custom));\n}\nfunction uniqueValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.unique, uniqueValidator(config));\n}\nfunction imageValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.image, control => {\n return null;\n });\n}\nfunction imageAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.image, baseAsyncValidator(config, AnnotationTypes.image));\n}\nfunction notEmptyValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.notEmpty, notEmptyValidator(config));\n}\nfunction ipValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.ip, ipValidator(config));\n}\nfunction ipAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.ip, baseAsyncValidator(config, AnnotationTypes.ip));\n}\nfunction cusipValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.cusip, cusipValidator(config));\n}\nfunction gridValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.grid, gridValidator(config));\n}\nfunction dateValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.date, dateValidator(config));\n}\nfunction dateAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.date, baseAsyncValidator(config, AnnotationTypes.date));\n}\nfunction andValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.and, andValidator(config));\n}\nfunction orValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.or, orValidator(config));\n}\nfunction notValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.not, notValidator(config));\n}\nfunction minTimeValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.minTime, minTimeValidator(config));\n}\nfunction minTimeAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.minTime, baseAsyncValidator(config, AnnotationTypes.minTime));\n}\nfunction maxTimeValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.maxTime, maxTimeValidator(config));\n}\nfunction maxTimeAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.maxTime, baseAsyncValidator(config, AnnotationTypes.maxTime));\n}\nfunction requiredTrueValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.requiredTrue, requiredTrueValidator(config));\n}\nfunction maskValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.mask, maskValidator(config));\n}\nfunction ibanValidatorExtension(config) {\n return baseValidator(config, AnnotationTypes.iban, ibanValidator(config));\n}\nfunction ibanAsyncValidatorExtension(config) {\n return baseAsyncValidatorExtension(config, AnnotationTypes.iban, baseAsyncValidator(config, AnnotationTypes.iban));\n}\nlet RxwebValidators = /*#__PURE__*/(() => {\n class RxwebValidators {}\n RxwebValidators.alpha = alphaValidatorExtension;\n RxwebValidators.allOf = allOfValidatorExtension;\n RxwebValidators.alphaNumeric = alphaNumericValidatorExtension;\n RxwebValidators.choice = choiceValidatorExtension;\n RxwebValidators.compare = compareValidatorExtension;\n RxwebValidators.contains = containsValidatorExtension;\n RxwebValidators.creditCard = creditCardValidatorExtension;\n RxwebValidators.different = differentValidatorExtension;\n RxwebValidators.digit = digitValidatorExtension;\n RxwebValidators.email = emailValidatorExtension;\n RxwebValidators.even = evenValidatorExtension;\n RxwebValidators.factor = factorValidatorExtension;\n RxwebValidators.greaterThanEqualTo = greaterThanEqualToValidatorExtension;\n RxwebValidators.greaterThan = greaterThanValidatorExtension;\n RxwebValidators.hexColor = hexColorValidatorExtension;\n RxwebValidators.json = jsonValidatorExtension;\n RxwebValidators.leapYear = leapYearValidatorExtension;\n RxwebValidators.lessThanEqualTo = lessThanEqualToValidatorExtension;\n RxwebValidators.lessThan = lessThanValidatorExtension;\n RxwebValidators.lowerCase = lowerCaseValidatorExtension;\n RxwebValidators.mac = macValidatorExtension;\n RxwebValidators.maxDate = maxDateValidatorExtension;\n RxwebValidators.maxLength = maxLengthValidatorExtension;\n RxwebValidators.maxNumber = maxNumberValidatorExtension;\n RxwebValidators.minDate = minDateValidatorExtension;\n RxwebValidators.minLength = minLengthValidatorExtension;\n RxwebValidators.minNumber = minNumberValidatorExtension;\n RxwebValidators.noneOf = noneOfValidatorExtension;\n RxwebValidators.numeric = numericValidatorExtension;\n RxwebValidators.odd = oddValidatorExtension;\n RxwebValidators.oneOf = oneOfValidatorExtension;\n RxwebValidators.password = passwordcValidatorExtension;\n RxwebValidators.pattern = patternValidatorExtension;\n RxwebValidators.range = rangeValidatorExtension;\n RxwebValidators.required = requiredValidatorExtension;\n RxwebValidators.time = timeValidatorExtension;\n RxwebValidators.upperCase = upperCaseValidatorExtension;\n RxwebValidators.url = urlValidatorExtension;\n RxwebValidators.ascii = asciiValidatorExtension;\n RxwebValidators.dataUri = dataUriValidatorExtension;\n RxwebValidators.port = portValidatorExtension;\n RxwebValidators.latLong = latLongValidatorExtension;\n RxwebValidators.extension = extensionValidatorExtension;\n RxwebValidators.fileSize = fileSizeValidatorExtension;\n RxwebValidators.endsWith = endsWithValidatorExtension;\n RxwebValidators.startsWith = startsWithValidatorExtension;\n RxwebValidators.primeNumber = primeNumberValidatorExtension;\n RxwebValidators.latitude = latitudeValidatorExtension;\n RxwebValidators.longitude = longitudeValidatorExtension;\n RxwebValidators.compose = composeValidatorExtension;\n RxwebValidators.file = fileValidatorExtension;\n RxwebValidators.custom = customValidatorExtension;\n RxwebValidators.unique = uniqueValidatorExtension;\n RxwebValidators.image = imageValidatorExtension;\n RxwebValidators.notEmpty = notEmptyValidatorExtension;\n RxwebValidators.ip = ipValidatorExtension;\n RxwebValidators.cusip = cusipValidatorExtension;\n RxwebValidators.grid = gridValidatorExtension;\n RxwebValidators.date = dateValidatorExtension;\n RxwebValidators.and = andValidatorExtension;\n RxwebValidators.or = orValidatorExtension;\n RxwebValidators.not = notValidatorExtension;\n RxwebValidators.minTime = minTimeValidatorExtension;\n RxwebValidators.maxTime = maxTimeValidatorExtension;\n RxwebValidators.requiredTrue = requiredTrueValidatorExtension;\n RxwebValidators.mask = maskValidatorExtension;\n RxwebValidators.iban = ibanValidatorExtension;\n RxwebValidators.alphaAsync = alphaAsyncValidatorExtension;\n RxwebValidators.alphaNumericAsync = alphaNumericAsyncValidatorExtension;\n RxwebValidators.allOfAsync = allOfAsyncValidatorExtension;\n RxwebValidators.choiceAsync = choiceAsyncValidatorExtension;\n RxwebValidators.containsAsync = containsAsyncValidatorExtension;\n RxwebValidators.creditCardAsync = creditCardAsyncValidatorExtension;\n RxwebValidators.customAsync = customAsyncValidatorExtension;\n RxwebValidators.dateAsync = dateAsyncValidatorExtension;\n RxwebValidators.endsWithAsync = endsWithAsyncValidatorExtension;\n RxwebValidators.extensionAsync = extensionAsyncValidatorExtension;\n RxwebValidators.factorAsync = factorAsyncValidatorExtension;\n RxwebValidators.fileSizeAsync = fileSizeAsyncValidatorExtension;\n RxwebValidators.fileAsync = fileAsyncValidatorExtension;\n RxwebValidators.greaterThanEqualToAsync = greaterThanEqualToAsyncValidatorExtension;\n RxwebValidators.greaterThanAsync = greaterThanAsyncValidatorExtension;\n RxwebValidators.imageAsync = imageAsyncValidatorExtension;\n RxwebValidators.ipAsync = ipAsyncValidatorExtension;\n RxwebValidators.lessThanEqualToAsync = lessThanEqualToAsyncValidatorExtension;\n RxwebValidators.lessThanAsync = lessThanAsyncValidatorExtension;\n RxwebValidators.maxDateAsync = maxDateAsyncValidatorExtension;\n RxwebValidators.maxLengthAsync = maxLengthAsyncValidatorExtension;\n RxwebValidators.maxNumberAsync = maxNumberAsyncValidatorExtension;\n RxwebValidators.maxTimeAsync = maxTimeAsyncValidatorExtension;\n RxwebValidators.minDateAsync = minDateAsyncValidatorExtension;\n RxwebValidators.minLengthAsync = minLengthAsyncValidatorExtension;\n RxwebValidators.minNumberAsync = minNumberAsyncValidatorExtension;\n RxwebValidators.minTimeAsync = minTimeAsyncValidatorExtension;\n RxwebValidators.noneOfAsync = noneOfAsyncValidatorExtension;\n RxwebValidators.numericAsync = numericAsyncValidatorExtension;\n RxwebValidators.oneOfAsync = oneOfAsyncValidatorExtension;\n RxwebValidators.passwordAsync = passwordAsyncValidatorExtension;\n RxwebValidators.patternAsync = patternAsyncValidatorExtension;\n RxwebValidators.rangeAsync = rangeAsyncValidatorExtension;\n RxwebValidators.startsWithAsync = startsWithAsyncValidatorExtension;\n RxwebValidators.timeAsync = timeAsyncValidatorExtension;\n RxwebValidators.urlAsync = urlAsyncValidatorExtension;\n RxwebValidators.ibanAsync = ibanAsyncValidatorExtension;\n\n /**\r\n * Generated bundle index. Do not edit.\r\n */\n return RxwebValidators;\n})();\nexport { AsyncValidationDirective, ErrorMessageBindingStrategy, FileControlDirective, FormBuilderConfiguration, HtmlControlTemplateDirective, IAbstractControl, ImageFileControlDirective, IpVersion, NumericValueType, ReactiveFormConfig, ReactiveTypedFormsModule, ResetFormType, RxFormArray, RxFormBuilder, RxFormControl, RxFormControlDirective, RxFormGroup, RxReactiveFormsModule, RxwebFormDirective, RxwebValidators, TypedForm, TypedFormBuilder, UrlValidationType, ValidationAlphabetLocale, allOf, allOfAsync, alpha, alphaAsync, alphaNumeric, alphaNumericAsync, and, ascii, async, blacklist, choice, choiceAsync, compare, compose, contains, containsAsync, creditCard, creditCardAsync, cusip, custom, customAsync, dataUri, date, dateAsync, different, digit, disable, elementClass, email, endsWith, endsWithAsync, error, escape, even, extension, extensionAsync, factor, factorAsync, file, fileAsync, fileSize, fileSizeAsync, greaterThan, greaterThanAsync, greaterThanEqualTo, greaterThanEqualToAsync, grid, hexColor, image, imageAsync, json, latLong, latitude, leapYear, lessThan, lessThanAsync, lessThanEqualTo, lessThanEqualToAsync, longitude, lowerCase, ltrim, mac, mask, maxDate, maxDateAsync, maxLength, maxLengthAsync, maxNumber, maxNumberAsync, maxTime, maxTimeAsync, minDate, minDateAsync, minLength, minLengthAsync, minNumber, minNumberAsync, minTime, minTimeAsync, model, noneOf, noneOfAsync, not, notEmpty, numeric, numericAsync, odd, oneOf, oneOfAsync, or, password, passwordAsync, pattern, patternAsync, port, prefix, primeNumber, prop, propArray, propObject, range, rangeAsync, required, requiredTrue, rtrim, rule, sanitize, startsWith, startsWithAsync, stripLow, suffix, time, timeAsync, toBoolean, toDate, toDouble, toFloat, toInt, toString, trim, unique, updateOn, upperCase, url, urlAsync, whitelist };\n","import { Injectable } from \"@angular/core\";\r\nimport { Observable } from \"rxjs\";\r\nimport { ApiService } from \"../../apis\";\r\nimport { PaginationResponseDto, ResultDto, SearchDto } from \"../../dtos/api\";\r\nimport { CreateVarianterDto, CreateVarianterValueDto, UpdateVarianterDto, UpdateVarianterValueDto, VarianterResultDto, VarianterValueFilterDto, VarianterValueMainResultDto } from \"../../dtos/varianter\";\r\nimport { API_ROUTER_UTILS } from \"../../utils\";\r\n\r\n@Injectable({\r\n providedIn: \"root\",\r\n})\r\nexport class VarianterService {\r\n constructor(private apiService: ApiService) {}\r\n\r\n search(\r\n searchDto: SearchDto\r\n ): Observable>> {\r\n return this.apiService.post<\r\n ResultDto>\r\n >(API_ROUTER_UTILS.url.varianters.search, searchDto, null);\r\n }\r\n\r\n create(createVarianterDto: CreateVarianterDto): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.varianters.create,\r\n createVarianterDto,\r\n null\r\n );\r\n }\r\n\r\n update(updateVarianterDto: UpdateVarianterDto): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.varianters.update,\r\n updateVarianterDto,\r\n null\r\n );\r\n }\r\n\r\n delete(varianterId: string): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.varianters.delete,\r\n null,\r\n null,\r\n { varianterId: varianterId }\r\n );\r\n }\r\n\r\n all(): Observable> {\r\n return this.apiService.get>(\r\n null,\r\n API_ROUTER_UTILS.url.varianters.all,\r\n null\r\n );\r\n }\r\n\r\n searchVariantValues(\r\n searchDto: VarianterValueFilterDto\r\n ): Observable> {\r\n return this.apiService.post>(\r\n API_ROUTER_UTILS.url.varianters.searchVarianterValues,\r\n searchDto,\r\n null\r\n );\r\n }\r\n\r\n createVarianterValue(\r\n createVarianterValueDto: CreateVarianterValueDto\r\n ): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.varianters.createVarianterValue,\r\n createVarianterValueDto,\r\n null\r\n );\r\n }\r\n\r\n updateVarianterValue(\r\n updateVarianterValueDto: UpdateVarianterValueDto\r\n ): Observable {\r\n return this.apiService.post(\r\n API_ROUTER_UTILS.url.varianters.updateVarianterValue,\r\n updateVarianterValueDto,\r\n null\r\n );\r\n }\r\n\r\n deleteVarianterValue(varianterValueId: string): Observable