@telia-ace/knowledge-data-client-flamingo 1.0.23 → 1.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../core/dist/index.js","../../../node_modules/.pnpm/@telia-ace+widget-utilities@1.0.16/node_modules/@telia-ace/widget-utilities/dist/index.js","../src/create-serviceclient.ts","../src/legacy-conversion.ts","../src/data-client.ts","../src/plugin.ts"],"sourcesContent":["var Vt = Object.defineProperty, jt = Object.defineProperties;\nvar qt = Object.getOwnPropertyDescriptors;\nvar ct = Object.getOwnPropertySymbols;\nvar Ft = Object.prototype.hasOwnProperty, Ht = Object.prototype.propertyIsEnumerable;\nvar at = (n, t, e) => t in n ? Vt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, I = (n, t) => {\n for (var e in t || (t = {}))\n Ft.call(t, e) && at(n, e, t[e]);\n if (ct)\n for (var e of ct(t))\n Ht.call(t, e) && at(n, e, t[e]);\n return n;\n}, ht = (n, t) => jt(n, qt(t));\nclass He {\n constructor(t) {\n const { events: e } = t.get(\"$widget\");\n this.events = e.createChild(this);\n }\n action(t, e, s) {\n this.events.dispatch(\n \"data:action\",\n { action: e, value: s, target: t },\n { bubbles: !0 }\n );\n }\n subscribe(t, e) {\n return this.events.subscribe(\n \"data:action\",\n (s, { action: i, value: r, target: o }) => t === o && e(t, i, r)\n );\n }\n}\nconst j = (n, t, e, ...s) => {\n const i = `[${n.get(\"$environment\").name || \"webprovisions\"}] ${e}`;\n switch (t) {\n case \"info\":\n console.info(i, ...s);\n break;\n case \"warning\":\n console.warn(i, ...s);\n break;\n case \"error\":\n console.error(i, ...s);\n break;\n }\n}, $t = (n) => {\n const t = n.container || n;\n return {\n info: (e, ...s) => j(t, \"info\", e, ...s),\n warn: (e, ...s) => j(t, \"warning\", e, ...s),\n error: (e, ...s) => j(t, \"error\", e, ...s)\n };\n}, lt = (n, t) => {\n if (!t)\n return !0;\n if (typeof t == \"string\") {\n const e = t.split(\",\");\n for (let s = 0, i = e.length; s < i; s++) {\n const r = e[s].trim();\n if (r === n || r === \"*\")\n return !0;\n }\n }\n return t instanceof Array ? t.indexOf(n) > -1 : !1;\n}, Wt = (n, t) => {\n if (typeof t == \"function\")\n return t(n);\n const e = typeof t == \"string\" ? Qt(t) : t;\n return !(!lt(n.tenant || \"\", e.tenant || \"\") || !lt(n.name, e.implementation || \"\"));\n}, Bt = (n) => (t) => Wt(t, n), q = (n) => n instanceof Array && n.length === 1 ? n[0] : n, Qt = (n) => {\n const t = {}, e = n.split(\":\");\n return e.length === 1 ? t.implementation = q(e[0].split(\",\")) : (t.tenant = q(e[0].split(\",\")), t.implementation = q(e[1].split(\",\"))), t;\n};\nvar D = /* @__PURE__ */ ((n) => (n.Implementation = \"implementation\", n.Widget = \"widget\", n))(D || {}), E = /* @__PURE__ */ ((n) => (n.Pre = \"pre\", n.Post = \"post\", n))(E || {});\nconst Yt = (n, t, e, s) => {\n try {\n const i = new t(e, s);\n return {\n name: n,\n invoke: (r, o) => {\n let c;\n return i[r] && (c = i[r].call(i, o)), Promise.resolve(c);\n },\n getInstance: () => i\n };\n } catch (i) {\n if (i.message && i.message.indexOf(\"is not a constructor\") >= 0)\n return {\n name: n,\n invoke: (r) => {\n let o;\n return r === \"initialize\" && (o = t(e, s)), Promise.resolve(o);\n },\n getInstance: () => t\n };\n throw i;\n }\n};\nfunction ut(n, t) {\n return typeof n == \"undefined\" ? t : n;\n}\nlet Ut = class {\n constructor(t = {}) {\n this.part = t;\n }\n createCommand(t, e, s) {\n let i;\n typeof e == \"function\" ? i = {\n scope: D.Widget,\n stage: E.Post,\n defaultArgs: void 0,\n handlerResolver: e\n } : i = {\n scope: ut(e.scope, D.Widget),\n stage: ut(e.stage, E.Post),\n defaultArgs: e.defaultArgs,\n handlerResolver: s\n };\n let r = this.part;\n const o = t.split(\".\");\n return o.forEach((c, u) => {\n u === o.length - 1 ? r[c] || (r[c] = () => i) : r = this.part[c] = this.part[c] || {};\n }), this;\n }\n get() {\n return this.part;\n }\n};\nconst Ct = (n) => {\n const t = new Ut({});\n return n(t), t.get();\n};\nCt((n) => {\n n.createCommand(\n \"types.register\",\n { scope: D.Implementation, stage: E.Pre },\n (t) => (e, s) => {\n t.container.get(\"$types\")[e] = s;\n }\n ).createCommand(\n \"type\",\n { stage: E.Pre },\n (t) => (e) => {\n t.container.register(\"$type\", e);\n }\n ).createCommand(\n \"settings\",\n { stage: E.Pre, defaultArgs: [null] },\n (t) => (e) => {\n t.events.dispatch(\n \"settings:change\",\n e,\n { bubbles: !0 }\n ), t.container.register(\"$settings\", e);\n }\n ).createCommand(\n \"plugin\",\n { stage: E.Pre },\n (t) => (e, s, i) => {\n const { container: r } = t;\n let o = null, c = e, u = s;\n typeof e == \"string\" && (o = e, c = s, u = i);\n const h = (a) => {\n const { transformPluginSettings: l } = t.container.get(\"$environmentOptions\"), p = l ? l(\n u || {},\n o,\n t.container,\n c\n ) : s;\n try {\n const d = Yt(\n o,\n c,\n r,\n p\n );\n r.get(\"$plugins\").push(d), a && d.invoke(\"initialize\", null);\n } catch (d) {\n $t(t).warn(\"Error when initializing plugin\", d);\n }\n };\n t.container.get(\"$instance\") ? h(!0) : t.events.subscribeOnce(\"widget:instance-created\", () => h(!1));\n }\n ).createCommand(\n \"container.register\",\n (t) => (e, s) => {\n t.container.register(e, s);\n }\n ).createCommand(\n \"container.registerAsync\",\n (t) => (e, s) => {\n t.container.registerAsync(e, s);\n }\n ).createCommand(\n \"container.registerFactory\",\n (t) => (e, s) => {\n t.container.registerFactory(e, s);\n }\n ).createCommand(\n \"container.touch\",\n (t) => (e, s) => {\n t.container.touch(e, s);\n }\n ).createCommand(\n \"csp\",\n {},\n (t) => (e) => {\n t.container.register(\"csp\", e);\n }\n );\n});\nfunction Gt(n, t, e) {\n return Array.from(n.querySelectorAll(\n `div[id^=\"${t}_\"], div[id^=\"${t}:\"]`\n )).map((s) => {\n if (s.id.substr(0, 7) === `${t}_`)\n return { widgetName: s.id.substr(7), element: s };\n const { 3: i } = s.id.split(\":\");\n return { widgetName: i, element: s };\n });\n}\nconst Kt = (n) => {\n const t = n.map((e) => e.replace(/\\./g, \"\\\\.\")).join(\"|\");\n return new RegExp(\"^((http[s]?:)?//)?(\" + t + \")/([^\\\\s]+)\");\n}, Jt = (n) => n.href;\nfunction Xt(n, t) {\n const e = Kt(t), s = (i) => {\n const r = e.exec(Jt(i));\n return r ? {\n element: i,\n widget: r[4]\n } : null;\n };\n return Array.from(n.querySelectorAll(\"a\")).map((i) => s(i)).filter((i) => !!i).map((i) => ({\n element: i.element,\n widgetName: i.widget\n }));\n}\nfunction kt(n) {\n return n.filter((t, e, s) => s.indexOf(t) === e);\n}\nlet Zt = class {\n constructor(t) {\n this.container = t.container, this.events = t.events;\n }\n watch(t) {\n const e = this.container.get(\"triggerElements\") || [], s = kt(e.concat(t));\n this.container.register(\"triggerElements\", s), this.events.dispatch(\n \"bootstrap:trigger-elements-updated\",\n { triggerElements: s },\n { bubbles: !0 }\n );\n }\n};\nfunction Et(n, ...t) {\n return n.implementation.events.subscribe(\"widget:create-instance\", (e, s) => {\n if (e.target === n) {\n let i = n.container.get(\"bootstrapping.monitor\");\n i || (i = new Zt(n), n.container.register(\"bootstrapping.monitor\", i)), i.watch(t);\n }\n }), n.load();\n}\nfunction Pt(n, t = document) {\n var e;\n const s = n.bindings, i = [].concat(\n Xt(t, s),\n Gt(t, ((e = n.environment) == null ? void 0 : e.name) || \"\")\n ), r = kt(i.map(({ widgetName: o }) => o)).reduce((o, c) => {\n const u = n.widgets.get(c);\n if (!u)\n return process.env.NODE_ENV !== \"production\" && $t(n).warn(`A trigger element for \"${c}\" was found but no widget with that name is available on the implementation (\"${n.name}\"). Make sure this is not a mistake.`), o;\n const h = i.filter((a) => a.widgetName === c).map((a) => a.element);\n return o.push(Et(u, ...h)), o;\n }, []);\n return Promise.all(r);\n}\nfunction te() {\n return new Promise((n) => {\n document.readyState === \"loading\" ? document.addEventListener(\"DOMContentLoaded\", () => n()) : n();\n });\n}\nconst ee = (n, t) => {\n const e = n;\n e.scan = (i) => Pt(e, i), e.bindings = t, e.attach = (i, ...r) => Et(i, ...r);\n const { environment: s } = e;\n return typeof s.configure == \"undefined\" && (s.configure = (i, r) => {\n let o, c;\n r ? (o = i, c = r) : (o = \"*\", c = i), s.implementations.query(o).forEach((u) => u.configure(c)), s.events.subscribe(\"implementation:created\", (u, h) => {\n const { implementation: a } = h;\n Bt(o)(a) && a.configure(c);\n });\n }), e;\n};\nfunction se(n, t, e = () => [], s) {\n const i = { ready: !1 };\n n.container.register(\"bootstrapping\", i);\n const r = ee(n, t);\n return te().then(() => {\n n.configure((...o) => {\n e().forEach((c) => c(...o));\n });\n }).then(() => Pt(r, s())).then(() => (i.ready = !0, n.events.dispatch(\"bootstrap:ready\", {}), r));\n}\nconst ne = Ct((n) => {\n n.createCommand(\n \"ready\",\n { scope: D.Implementation, stage: E.Pre },\n (t) => (e) => {\n const { container: s } = t, i = s.owner;\n s.get(\"bootstrapping\").ready ? e(i) : i.events.subscribeOnce(\"bootstrap:ready\", () => {\n e(i);\n });\n }\n );\n}), F = /* @__PURE__ */ new WeakMap();\nfunction A() {\n return (n) => (F.has(n) || F.set(n, {}), F.get(n));\n}\nconst H = (n, t, e, ...s) => {\n const i = `[${n.get(\"$environment\").name || \"webprovisions\"}] ${e}`;\n switch (t) {\n case \"info\":\n console.info(i, ...s);\n break;\n case \"warning\":\n console.warn(i, ...s);\n break;\n case \"error\":\n console.error(i, ...s);\n break;\n }\n}, g = (n) => {\n const t = n.container || n;\n return {\n info: (e, ...s) => H(t, \"info\", e, ...s),\n warn: (e, ...s) => H(t, \"warning\", e, ...s),\n error: (e, ...s) => H(t, \"error\", e, ...s)\n };\n}, m = A(), U = (() => {\n let n = 0;\n return () => ++n;\n})(), G = (n, t, e) => {\n const s = m(n).touchQueue.get(t);\n s && s.forEach((i) => {\n i(e, n);\n });\n};\nclass ie {\n constructor(t, e, s, i) {\n this.key = t, this.factory = e, this.parent = s, this.container = i, this.id = U(), this.resolved = !1, this.constructed = !1, this.async = !0;\n }\n resolve() {\n if (!this.constructed) {\n const t = this.factory(this.parent, this.container);\n return this.constructed = !0, this.value = Promise.resolve(t).then((e) => (this.resolved = !0, G(this.container, this.key, e), e));\n }\n return this.value;\n }\n}\nclass re {\n constructor(t, e, s, i) {\n this.key = t, this.value = e, this.parent = s, this.container = i, this.id = U(), this.async = !1, this.resolved = !1, this.constructed = !0, this.resolve = () => (this.resolved = !0, G(this.container, this.key, this.value), this.value);\n }\n}\nclass oe {\n constructor(t, e, s, i) {\n this.key = t, this.value = e, this.parent = s, this.container = i, this.id = U(), this.async = !1, this.resolved = !1, this.constructed = !1, this.resolve = () => {\n this.resolved = !0, this.constructed = !0;\n const r = this.value(this.parent, this.container);\n return G(this.container, this.key, this.value), r;\n };\n }\n}\nclass K {\n /**\n * Creates a new instance of `Container`.\n * @param owner The object owning this inctance.\n * @param name Optional name for the container.\n * @param parent Parent container this should be a child of.\n */\n constructor(t, e, s) {\n this.owner = t, this.name = e, this.parent = s, m(this).resolvers = /* @__PURE__ */ new Map(), m(this).touchQueue = /* @__PURE__ */ new Map(), m(this).children = [];\n }\n /**\n * Deletes an existing resolver by its unique id.\n * @param id Resolver id.\n */\n delete(t) {\n const e = m(this).resolvers, s = Array.from(e.values()).find((i) => i.id === t);\n return s ? (m(this).touchQueue.delete(s.key), Promise.resolve(e.delete(s.key))) : this.parent ? this.parent.delete(t) : Promise.resolve(!1);\n }\n /**\n * Clears the `Container` and any child containers by deleteing all registered resolvers.\n */\n clear() {\n const t = m(this).resolvers, e = Array.from(t.values());\n return Promise.all(e.map((s) => {\n if (s.constructed)\n return Promise.resolve(s.resolve()).then((i) => {\n if (i !== null && typeof i == \"object\" && typeof i.dispose == \"function\")\n return i.dispose.call(i, this, s);\n });\n })).then(() => {\n e.forEach((s) => this.delete(s.id)), m(this).children.forEach((s) => s.clear());\n });\n }\n /**\n * Detaches this `Container` instance from its parent, allowing it to be garbage-collected.\n */\n detach() {\n if (this.parent) {\n const t = m(this.parent).children, e = t.indexOf(this);\n e > -1 && (t.splice(e, 1), delete this.parent);\n }\n }\n /**\n * Provides a way of touching a value in the `Container` without forcing it to be resolved.\n * @param key Key of the resolved value to touch.\n * @param handler Handler function for touching the resolved value.\n */\n touch(t, e) {\n const s = m(this).resolvers.get(t);\n if (s && s.constructed)\n Promise.resolve(s.resolve()).then((i) => {\n e(i, this);\n });\n else {\n const i = m(this).touchQueue;\n let r = i.get(t);\n r || (r = [], i.set(t, r)), r.push(e);\n }\n return this.parent && !s ? this.parent.touch(t, e) : Promise.resolve();\n }\n /**\n * Registers an asynchronous resolver.\n * @param key Key of the resolver.\n * @param factory Value factory.\n */\n registerAsync(t, e) {\n const s = m(this).resolvers.get(t);\n s && !s.async && process.env.NODE_ENV !== \"production\" && g(this).warn(`Mismatching resolver type. You are registering an async resolver with a key ('${t}') previously used by a non-async resolver.`);\n const i = new ie(t, e, s, this);\n return m(this).resolvers.set(t, i), i.id;\n }\n /**\n * Registers a factory resolver for constructing the value to be resolved.\n * @param key Key of the resolver.\n * @param factory Value factory.\n */\n registerFactory(t, e) {\n const s = m(this).resolvers.get(t);\n s && s.async && process.env.NODE_ENV !== \"production\" && g(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);\n const i = new oe(t, e, s, this);\n return m(this).resolvers.set(t, i), i.id;\n }\n /**\n * Registers an synchronous resolver.\n * @param key Key of the resolver.\n * @param value Value.\n */\n register(t, e) {\n const s = m(this).resolvers.get(t);\n s && s.async && process.env.NODE_ENV !== \"production\" && g(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);\n const i = new re(t, e, s, this);\n return m(this).resolvers.set(t, i), i.id;\n }\n /**\n * Gets the value for a synchronous resolver.\n * @param key Key of resolver to get.\n */\n get(t) {\n const e = m(this).resolvers.get(t);\n if (e)\n return e.async && process.env.NODE_ENV !== \"production\" && g(this).warn(`You are retrieving an async value (with key '${t}') by the non-async function 'container.get(key)'. This will not be supported in future versions. Use 'container.getAsync(key) instead.'`), e.resolve();\n if (this.parent)\n return this.parent.get(t);\n }\n /**\n * Gets the value for a asynchronous resolver.\n * @param key Key of resolver to get.\n */\n getAsync(t) {\n const e = m(this).resolvers.get(t);\n if (e) {\n if (!e.async)\n throw process.env.NODE_ENV !== \"production\" && g(this).warn(`You are retrieving a non-async value (with key '${t}') by the async function 'container.getAsync(key)'.Use 'container.get(key) instead.'`), \"Mismatching resolver type\";\n return e.resolve();\n }\n return this.parent ? this.parent.getAsync(t) : Promise.resolve(void 0);\n }\n getMany(...t) {\n const e = {};\n return t.forEach((s) => e[s] = this.get(s)), e;\n }\n getManyAsync(...t) {\n const e = {};\n return Promise.all(t.map((s) => this.getAsync(s).then((i) => e[s] = i))).then(() => e);\n }\n createChild(t, e) {\n const s = new K(t, e, this);\n return m(this).children.push(s), s;\n }\n}\nclass pt {\n /**\n * \n * @param type Type of event.\n * @param target The target of the event, which will handle the default behavour.\n * @param cancelable Whether the event is cancelable by calling preventDefault().\n * @param bubbles Whether the event will bubble up the parent hierarchy.\n */\n constructor(t, e, s = !1, i = !1) {\n this.type = t, this.target = e, this.cancelable = !!s, this.bubbles = !!i, this.defaultPrevented = !1;\n }\n /**\n * Cancels the default behaviour (if the event is cancelable).\n */\n preventDefault() {\n this.cancelable && (this.defaultPrevented = !0);\n }\n}\nconst b = A(), dt = (n, t) => [].concat(\n b(n).listenerLookup.get(t.toLowerCase()) || [],\n b(n).listenerLookup.get(\"*\") || []\n), mt = (n, t, e, s) => {\n let i, r;\n return t instanceof pt ? (i = t, r = t.type) : (i = new pt(t, n.target, !!e.cancelable, !!e.bubbles), r = t), { event: i, type: r, async: s };\n};\nclass J {\n /**\n * Creates a new Event Manager instance.\n * @param target The target of events dispatched from this Event Manager instance.\n * @param parent Parent Event Manager instance.\n */\n constructor(t, e) {\n this.target = t, this.parent = e, b(this).listenerLookup = /* @__PURE__ */ new Map(), b(this).children = [];\n }\n /**\n * Clears registered event listeners in this `EventManager` as well as in any children.\n */\n clear() {\n b(this).listenerLookup.clear(), b(this).children.forEach((t) => t.clear());\n }\n /**\n * Detaches this `EventManager` instance from its parent, allowing it to be garbage-collected.\n */\n detach() {\n if (this.parent) {\n const t = b(this.parent).children, e = t.indexOf(this);\n e > -1 && t.splice(e, 1);\n }\n }\n /**\n * Creates an event subscription by registering an listener for an event type.\n * @param type Event type to subscribe to.\n * @param listener Listener for the event.\n */\n subscribe(t, e, s) {\n const i = b(this).listenerLookup, r = t.toLowerCase();\n return i.has(r) || i.set(r, []), i.get(r).push(e), () => this.unsubscribe(t, e);\n }\n /**\n * Similar to `subscribe()` but immediately removes the subscription after the first call.\n * @param type Event type to subscribe to.\n * @param listener Listener for the event.\n */\n subscribeOnce(t, e) {\n const s = this.subscribe(t, (i, r) => (s(), e(i, r)));\n }\n /**\n * Removes a listener for the specified event type.\n * @param type Event type to remove subscription for.\n * @param listener Event listener to remove.\n */\n unsubscribe(t, e) {\n const s = b(this).listenerLookup.get(t.toLowerCase());\n if (s) {\n const i = s.indexOf(e);\n i > -1 && s.splice(i, 1);\n }\n }\n /**\n * Dispatches an asynchonous event to registered event listeners.\n * @param eventOrType Event type or Event object to dispatch.\n * @param data Optional data to be passed to event listeners.\n * @param options Optional event options used if first parameter is an event type.\n */\n dispatchAsync(t, e, s = {}) {\n const { event: i, type: r } = mt(this, t, s, !0), o = dt(this, r);\n let c = 0;\n const u = o.length;\n let h = Promise.resolve();\n for (c = 0; c < u; c++)\n ((a) => {\n h = h.then((l) => l ? Promise.resolve(!0) : Promise.resolve(a(i, e)).then(() => i.defaultPrevented));\n })(o[c]);\n return h.then((a) => !a && i.bubbles && this.parent ? this.parent.dispatchAsync(i, e) : a);\n }\n /**\n * Dispatches an event to registered event listeners.\n * @param eventOrType Event type or Event object to dispatch.\n * @param data Optional data to be passed to event listeners.\n * @param options Optional event options used if first parameter is an event type.\n */\n dispatch(t, e, s = {}) {\n const { event: i, type: r } = mt(this, t, s, !1), o = dt(this, r);\n let c = 0;\n const u = o.length;\n let h = !1;\n for (c = 0; c < u; c++)\n if (o[c](i, e), i.defaultPrevented) {\n h = !0;\n break;\n }\n return !h && i.bubbles && this.parent && (h = this.parent.dispatch(i, e)), h;\n }\n /**\n * Creates a child instance to the current Event manager.\n */\n createChild(t) {\n const e = new J(t, this);\n return b(this).children.push(e), e;\n }\n}\nconst L = (n, t, e) => {\n const s = n.get(\"$plugins\").map((i) => {\n try {\n return i.invoke(t, e);\n } catch (r) {\n g(n).error(\"An error occured when invoking a plugin.\", i, r);\n }\n });\n return Promise.all(s);\n};\nclass ce {\n constructor(t) {\n this.widget = t.get(\"$widget\"), this.events = this.widget.events, this.container = this.widget.container, this.initialized = null, this.activated = null, this.initialize = this.initialize.bind(this), this.activate = this.activate.bind(this), this.deactivate = this.deactivate.bind(this), this.invoke = this.invoke.bind(this), this.createInstance();\n }\n createInstance() {\n if (!this.widget.container.get(\"$instance\")) {\n const t = this.widget.container.get(\"$types\"), e = this.widget.container.get(\"$type\");\n !e && g(this).error(\"Unable to create widget. No type is specified.\");\n const s = t[e];\n !s && g(this).error(`Unable to create widget. Type '${e}' is not registered.`), this.widget.events.dispatch(\"widget:create-instance\", {}, { bubbles: !0 });\n try {\n this.widget.container.register(\n \"$instance\",\n new s(this.container)\n );\n } catch (i) {\n g(this).error(\"Unable to create widget type.\", i);\n }\n this.widget.events.dispatch(\"widget:instance-created\", {}, { bubbles: !0 });\n }\n }\n /**\n * The initialization is performed before the widget is activated but after it's configured\n * and thus all required services are available. This hook is a good place to bind events that\n * should trigger activation (e.g. click on \"trigger links\" or routing events)\n * @param {object} data Custom initialization data passed to the widget.\n */\n initialize(t) {\n return this.initialized = this.initialized || (() => {\n const e = this.container.get(\"$instance\"), s = e.initialize || (() => {\n });\n return this.initialized = Promise.resolve(s.call(e, t)).then(() => L(this.container, \"initialize\", t)).then(() => {\n });\n })();\n }\n /**\n * The activation is where the widget is actually created and rendered.\n * Activation can be initialized from the outside or from an event originated\n * in the \"initialize\" hook.\n * @param {object} data Custom activation data passed to the widget.\n */\n activate(t) {\n return (this.initialized || this.initialize()).then(() => {\n this.activated = this.activated || (() => L(this.container, \"activate\").then(() => {\n const e = this.container.get(\"$instance\");\n return this.activated = e.activate(t);\n }))();\n });\n }\n deactivate() {\n const t = this.container.get(\"$instance\"), e = t.deactivate || (() => {\n });\n return L(this.container, \"deactivate\").then(() => Promise.resolve(e.call(t))).then(() => {\n this.initialized = null, this.activated = null;\n }).then(() => {\n });\n }\n /**\n * Invokes a command on the widget component.\n * @param command Name of command\n * @param args Command arguments\n */\n invoke(t, ...e) {\n return L(this.container, \"invoke\", { command: t, args: e }).then(() => {\n const s = this.container.get(\"$instance\");\n if (s[t])\n return s[t].apply(s, e);\n const i = s.invoke;\n if (i)\n return i.call(s, t, ...e);\n });\n }\n}\nconst O = (n, t) => {\n if (!t)\n return !0;\n if (typeof t == \"string\") {\n const e = t.split(\",\");\n for (let s = 0, i = e.length; s < i; s++) {\n const r = e[s].trim();\n if (r === n || r === \"*\")\n return !0;\n }\n }\n return t instanceof Array ? t.indexOf(n) > -1 : !1;\n}, ae = (n, t) => {\n if (typeof t == \"function\")\n return t(n);\n const e = typeof t == \"string\" ? le(t) : t;\n return !(!O(n.implementation.tenant || \"\", e.tenant || \"\") || !O(n.implementation.name, e.implementation || \"\") || !O(n.name, e.widget || \"\") || !O(n.container.get(\"$type\"), e.type || \"\"));\n}, he = (n, t) => {\n if (typeof t == \"function\")\n return t(n);\n const e = typeof t == \"string\" ? ue(t) : t;\n return !(!O(n.tenant || \"\", e.tenant || \"\") || !O(n.name, e.implementation || \"\"));\n}, Ot = (n) => (t) => ae(t, n), At = (n) => (t) => he(t, n), x = (n) => n instanceof Array && n.length === 1 ? n[0] : n, le = (n) => {\n const t = {}, e = n.split(\":\");\n return e.length === 1 ? t.widget = x(e[0].split(\",\")) : e.length === 2 ? (t.implementation = x(e[0].split(\",\")), t.widget = x(e[1].split(\",\"))) : (t.tenant = x(e[0].split(\",\")), t.implementation = x(e[1].split(\",\")), t.widget = x(e[2].split(\",\"))), t;\n}, ue = (n) => {\n const t = {}, e = n.split(\":\");\n return e.length === 1 ? t.implementation = x(e[0].split(\",\")) : (t.tenant = x(e[0].split(\",\")), t.implementation = x(e[1].split(\",\"))), t;\n}, z = A(), gt = (n, t, e) => n.filter((s) => s.stage === t && Ot(s.selector)(e));\nfunction pe(n) {\n const t = n.container.get(\"$environment\");\n let e = z(t).configurationCache;\n e && (e = e.filter((s) => s[0] !== n), z(t).configurationCache = e);\n}\nvar S = /* @__PURE__ */ ((n) => (n.Implementation = \"implementation\", n.Widget = \"widget\", n))(S || {}), $ = /* @__PURE__ */ ((n) => (n.Pre = \"pre\", n.Post = \"post\", n))($ || {});\nconst Nt = (n, t, e) => (Object.keys(t).forEach((s) => {\n const i = t[s];\n if (typeof i == \"function\") {\n const r = i();\n typeof r.defaultArgs != \"undefined\" && e(r, ...r.defaultArgs), n[s] = (...o) => {\n const c = Object.assign(\n {},\n r,\n { handlerResolver: r.handlerResolver.bind({}) }\n );\n return e(c, ...o), n;\n };\n } else\n n[s] = Nt(\n {},\n i,\n e\n );\n}), n), de = (n, t) => {\n switch (t) {\n case \"implementation\":\n return n.implementation;\n case \"widget\":\n return n;\n }\n}, ft = (n, t, e, s) => (s.forEach((i) => {\n Nt(\n n,\n i,\n (r, ...o) => {\n const c = {\n selector: t,\n stage: r.stage,\n handler: (u) => {\n const h = de(u, r.scope), a = { container: h.container, events: h.events }, l = r.handlerResolver, p = l(a);\n let d = z(e.environment).configurationCache;\n return d || (d = z(e.environment).configurationCache = []), d.find((C) => C.indexOf(h) > -1 && C.indexOf(l) > -1) ? Promise.resolve() : (d.push([h, l]), Promise.resolve(p(...o)));\n }\n };\n e.instructions.push(c);\n }\n );\n}), n);\nfunction me(n, t) {\n function e(s) {\n return ft(\n {},\n s,\n n,\n t\n );\n }\n return ft(\n e,\n \"*\",\n n,\n t\n );\n}\nclass ge {\n constructor(t, e) {\n this.container = t, this.settings = e, this.widget = t.get(\"$widget\"), this.events = this.widget.events;\n }\n}\nconst fe = (n, t, e, s) => {\n try {\n const i = new t(e, s);\n return {\n name: n,\n invoke: (r, o) => {\n let c;\n return i[r] && (c = i[r].call(i, o)), Promise.resolve(c);\n },\n getInstance: () => i\n };\n } catch (i) {\n if (i.message && i.message.indexOf(\"is not a constructor\") >= 0)\n return {\n name: n,\n invoke: (r) => {\n let o;\n return r === \"initialize\" && (o = t(e, s)), Promise.resolve(o);\n },\n getInstance: () => t\n };\n throw i;\n }\n};\nfunction vt(n, t) {\n return typeof n == \"undefined\" ? t : n;\n}\nclass ve {\n constructor(t = {}) {\n this.part = t;\n }\n createCommand(t, e, s) {\n let i;\n typeof e == \"function\" ? i = {\n scope: S.Widget,\n stage: $.Post,\n defaultArgs: void 0,\n handlerResolver: e\n } : i = {\n scope: vt(e.scope, S.Widget),\n stage: vt(e.stage, $.Post),\n defaultArgs: e.defaultArgs,\n handlerResolver: s\n };\n let r = this.part;\n const o = t.split(\".\");\n return o.forEach((c, u) => {\n u === o.length - 1 ? r[c] || (r[c] = () => i) : r = this.part[c] = this.part[c] || {};\n }), this;\n }\n get() {\n return this.part;\n }\n}\nconst _t = (n) => {\n const t = new ve({});\n return n(t), t.get();\n}, be = _t((n) => {\n n.createCommand(\n \"types.register\",\n { scope: S.Implementation, stage: $.Pre },\n (t) => (e, s) => {\n t.container.get(\"$types\")[e] = s;\n }\n ).createCommand(\n \"type\",\n { stage: $.Pre },\n (t) => (e) => {\n t.container.register(\"$type\", e);\n }\n ).createCommand(\n \"settings\",\n { stage: $.Pre, defaultArgs: [null] },\n (t) => (e) => {\n t.events.dispatch(\n \"settings:change\",\n e,\n { bubbles: !0 }\n ), t.container.register(\"$settings\", e);\n }\n ).createCommand(\n \"plugin\",\n { stage: $.Pre },\n (t) => (e, s, i) => {\n const { container: r } = t;\n let o = null, c = e, u = s;\n typeof e == \"string\" && (o = e, c = s, u = i);\n const h = (a) => {\n const { transformPluginSettings: l } = t.container.get(\"$environmentOptions\"), p = l ? l(\n u || {},\n o,\n t.container,\n c\n ) : s;\n try {\n const d = fe(\n o,\n c,\n r,\n p\n );\n r.get(\"$plugins\").push(d), a && d.invoke(\"initialize\", null);\n } catch (d) {\n g(t).warn(\"Error when initializing plugin\", d);\n }\n };\n t.container.get(\"$instance\") ? h(!0) : t.events.subscribeOnce(\"widget:instance-created\", () => h(!1));\n }\n ).createCommand(\n \"container.register\",\n (t) => (e, s) => {\n t.container.register(e, s);\n }\n ).createCommand(\n \"container.registerAsync\",\n (t) => (e, s) => {\n t.container.registerAsync(e, s);\n }\n ).createCommand(\n \"container.registerFactory\",\n (t) => (e, s) => {\n t.container.registerFactory(e, s);\n }\n ).createCommand(\n \"container.touch\",\n (t) => (e, s) => {\n t.container.touch(e, s);\n }\n ).createCommand(\n \"csp\",\n {},\n (t) => (e) => {\n t.container.register(\"csp\", e);\n }\n );\n}), ye = be;\nfunction we(n, t, e = []) {\n const s = [ye].concat(e), i = me(\n t,\n s\n );\n n(i, t);\n}\nclass xe {\n constructor() {\n this.tasks = [], this.current = Promise.resolve(), this.next = this.next.bind(this);\n }\n add(t, e, s, i) {\n this.tasks.push({ task: t, resolve: e, reject: s, done: i }), this.next();\n }\n next() {\n this.current = this.current.then(() => {\n const t = this.tasks.shift();\n if (t) {\n const e = Promise.resolve(t.task());\n return Promise.resolve(e).then(this.next).then(() => e.then((s) => {\n t.done(), t.resolve(s);\n })).catch((s) => (t.done(), t.reject(s), this.next()));\n }\n return Promise.resolve();\n });\n }\n}\nconst M = /* @__PURE__ */ new WeakMap();\nfunction $e(n) {\n return M.has(n) || M.set(n, new xe()), (t) => new Promise((e, s) => {\n const i = M.get(n);\n i.add(t, e, s, () => {\n i.tasks.length || M.delete(n);\n });\n });\n}\nconst bt = (n) => typeof n != \"undefined\", _ = (n, t) => {\n n.events.dispatch(\"widget:state-change\", { state: t }, { bubbles: !0 }), n.state = t, n.events.dispatch(\"widget:state-changed\", {}, { bubbles: !0 });\n}, v = A(), Ce = (n) => {\n const { container: t, events: e } = n;\n t.get(\"$controller\") || (t.register(\"$controller\", new ce(t)), e.dispatch(\"widget:controller-created\", {}, { bubbles: !0 }));\n};\nclass ke {\n /**\n * Creates a new `Widget` instance.\n * @param name Name of widget.\n * @param implementation The implementation this instance belongs to.\n * @param configuration Configuration for the widget.\n */\n constructor(t, e, s) {\n this.state = \"deactivated\", this.name = t, this.implementation = e, this.container = e.container.createChild(this, t), this.events = e.events.createChild(this), v(this).subscriptions = [], s && e.configure((i) => {\n const r = i(t);\n bt(s.type) && r.type(s.type), bt(s.settings) && r.settings(s.settings), s.plugins && Object.keys(s.plugins).forEach((o) => {\n var c;\n const u = (c = s.plugins) == null ? void 0 : c[o];\n r.plugin(o, u);\n });\n }), this.load = this.load.bind(this), this.activate = this.activate.bind(this), this.invoke = this.invoke.bind(this), this.deactivate = this.deactivate.bind(this);\n }\n /**\n * Initializes the widget, if not already initialized, and applies any\n * pending configuration.\n */\n load() {\n return $e(this)(() => {\n v(this).deactivatedPromise = null;\n const t = this.state === \"deactivated\";\n t && (_(\n this,\n \"activating\"\n /* Activating */\n ), this.container.register(\"$widget\", this), this.container.register(\"$controller\", null), this.container.register(\"$plugins\", []), this.container.register(\"$type\", null), this.container.register(\"$instance\", null)), _(\n this,\n \"loading\"\n /* Loading */\n );\n const e = this.implementation.instructions, s = gt(e, $.Pre, this);\n return Promise.all(s.map((i) => i.handler(this))).then(() => {\n Ce(this);\n const i = gt(e, $.Post, this);\n return Promise.all(i.map((r) => r.handler(this))).then(() => {\n t && this.container.get(\"$controller\").initialize();\n });\n }).then(() => (_(\n this,\n \"activated\"\n /* Activated */\n ), this));\n });\n }\n /**\n * Activates the widget and makes it ready for receiving commands.\n * @param data Activation data\n */\n activate(t) {\n v(this).subscriptions.push(\n this.implementation.events.subscribe(\"implementation:configured\", () => {\n [\n \"activated\",\n \"activating\",\n \"loading\"\n /* Loading */\n ].indexOf(this.state) > -1 && this.load();\n })\n );\n const e = v(this).activatedPromise;\n return e ? (process.env.NODE_ENV !== \"production\" && g(this).warn(`Widget '${this.name}' has already been activated. The passed arguments for this activation will be discarded.`, t), e) : v(this).activatedPromise = this.load().then(() => this.container.get(\"$controller\").activate(t));\n }\n /**\n * Invokes a command on a widget. If the widget isn't activate the invocation \n * will be suspended until activation.\n * @param command Command to invoke.\n * @param args Command arguments.\n */\n invoke(t, ...e) {\n const s = v(this).activatedPromise, i = (r, ...o) => s.then(this.load).then(() => this.container.get(\"$controller\").invoke(r, ...o));\n return s ? i(t, ...e) : (process.env.NODE_ENV !== \"production\" && g(this).warn(\"You are invoking a command on a deactivated widget. The invocation will be queued until the widget is activated.\", this), new Promise((r) => {\n const o = this.events.subscribe(\"widget:state-changed\", () => {\n this.state === \"activated\" && (o(), r(i(t, ...e)));\n });\n }));\n }\n /**\n * Deactivates the widget by clearing the `Container` and removing any event subscriptions in the\n * `EventManager`.\n */\n deactivate() {\n return v(this).deactivatedPromise || (this.state === \"deactivated\" ? Promise.resolve() : (_(\n this,\n \"deactivating\"\n /* Deactivating */\n ), v(this).deactivatedPromise = this.container.get(\"$controller\").deactivate().then(() => (v(this).activatedPromise = null, v(this).subscriptions.forEach((e) => e()), v(this).subscriptions = [], this.container.clear().then(() => {\n this.events.clear(), pe(this), _(\n this,\n \"deactivated\"\n /* Deactivated */\n );\n })))));\n }\n}\nclass Ee {\n /**\n * Creates a new `Widget` instance.\n * @param container The `Container` instance to base the widget upon.\n */\n constructor(t) {\n this.container = t, this.widget = t.get(\"$widget\"), this.settings = t.get(\"$settings\"), this.events = this.widget.events, this.widget.events.subscribe(\"settings:change\", (e, s) => {\n this.settings = s;\n });\n }\n}\nconst yt = A();\nclass Rt {\n /**\n * Creates a new Implementation instance.\n * @param configuration Configuration for the implementation.\n * @param environment The parent environment.\n * @param configurationApiExtensions Optional configuration API extensions.\n */\n constructor(t, e, s = []) {\n this.instructions = [], this.widgets = /* @__PURE__ */ new Map(), this.name = t.name, this.tenant = t.tenant, this.environment = e, this.container = e.container.createChild(this, this.name), this.events = e.events.createChild(this), this.container.register(\"$types\", {}), yt(this).configurationApiExtensions = s;\n }\n /**\n * Loads all widgets in the implementation.\n */\n load() {\n const t = Array.from(this.widgets.values());\n return Promise.all(t.map((e) => e.load())).then(() => t);\n }\n /**\n * Configures the implementation by adding a configuration callback.\n * @param configFn Callback function for configuration.\n */\n configure(t) {\n return we(t, this, yt(this).configurationApiExtensions), this.events.dispatch(\n \"implementation:configured\",\n { implementation: this },\n { bubbles: !0 }\n ), this;\n }\n /**\n * Creates a widget on the implementation and returns its `WidgetData`.\n * @param name Widget name.\n * @param configuration Widget configuration.\n */\n createWidget(t, e) {\n const s = new ke(t, this, e);\n return this.widgets.set(s.name, s), s;\n }\n}\nfunction Pe(n, t, e) {\n const s = new Rt(n, t, e);\n return n.widgets && Object.keys(n.widgets).forEach((i) => {\n var r;\n const o = (r = n.widgets) == null ? void 0 : r[i];\n s.createWidget(i, o);\n }), s;\n}\nlet wt = class Dt {\n constructor(t, e) {\n this.selectorFactory = e, typeof t == \"function\" ? this.resolver = t : this.resolver = () => t;\n }\n append(t) {\n const e = typeof t == \"function\" ? t : () => t;\n return new Dt(\n () => this.all().concat(e()),\n this.selectorFactory\n );\n }\n all() {\n return this.resolver().concat([]);\n }\n query(t) {\n return this.all().filter(this.selectorFactory(t));\n }\n find(t) {\n const e = this.query(t);\n if (e.length)\n return e[0];\n }\n};\nconst X = \"#____version____#\", W = A(), Oe = (n) => n.tenant ? `${n.name}:${n.tenant}` : n.name, It = class {\n constructor(n, t = [], e = {}) {\n this.widgets = new wt(\n () => {\n let s = [];\n return this.implementations.all().forEach((i) => {\n s = s.concat(Array.from(i.widgets.values()));\n }), s;\n },\n Ot\n ), this.implementations = new wt([], At), this.name = n, this.container = new K(this, n), this.events = new J(this), this.container.register(\"$version\", X), this.container.register(\"$environment\", this), this.container.register(\"$environmentOptions\", e), W(this).configurationApiExtensions = t;\n }\n /**\n * Creates an implementation based on the provided configuration.\n * @param config Implementation configuration.\n */\n createImplementation(n) {\n const t = Oe(n);\n let e = this.implementations.find(t);\n if (e)\n return process.env.NODE_ENV !== \"production\" && g(e).warn(`Implementation \"${t}\" already exist on current environment.`), e;\n const s = W(this).configurationApiExtensions;\n return e = Pe(\n n,\n this,\n s\n ), this.implementations = this.implementations.append([e]), this.events.dispatch(\"implementation:created\", { implementation: e }), e;\n }\n /**\n * Patches the Environment instance configuration.\n * @param configuration Environment configuration.\n */\n patch(n = {}) {\n const { name: t, configurationApiExtensions: e } = n;\n typeof t != \"undefined\" && t !== null && (this.name = t), e && e.forEach(\n (s) => {\n W(this).configurationApiExtensions.push(s);\n }\n );\n }\n /**\n * Creates a new Environment instance based on the provided configuration.\n * @param configuration Environment configuration.\n */\n static create(n = {}) {\n return new It(\n n.name || \"\",\n n.configurationApiExtensions,\n n.options\n );\n }\n};\nlet Lt = It;\nLt.version = X;\nconst Qe = (n, t, e = {}) => se(\n n,\n n.bindings,\n () => {\n const s = n.container.get(\"$runtimecfg\").map((i) => {\n const r = i[0];\n if (typeof r == \"function\")\n return r;\n if (At(r)(n))\n return i[1];\n }).filter((i) => !!i);\n return (t ? [t] : []).concat(s);\n },\n e.rootElementResolver || (() => document.body)\n), Ae = (n) => {\n const t = [];\n return [\n (s, i) => {\n t.push(n.subscribe(s, i));\n },\n () => {\n t.forEach((s) => {\n s();\n });\n }\n ];\n};\nclass Z {\n constructor(t, e = []) {\n this.platform = t, this.rules = e;\n }\n match(t) {\n return this.rules.every((e) => !(e.id && e.id !== t.id || e.type && e.type !== t.type));\n }\n ofType(t) {\n return this.rules.push({ type: t }), this;\n }\n withId(t) {\n return this.rules.push({ id: t }), this;\n }\n select() {\n return new Ne(this.platform, this);\n }\n}\nclass Mt {\n constructor(t, e, s) {\n this.platform = t, this.node = e, this.actions = new tt(\n t,\n new Z(t).withId(e.id),\n s\n );\n const [i, r] = Ae(\n this.platform.events\n );\n this.subscribe = i, this.unsubscribe = r;\n }\n properties(t) {\n return t && this.node.touchProperties((e) => t(e)), this.node.attributes.properties;\n }\n context(t) {\n return t && this.subscribe(\"components:context-changed\", (e, { node: s }) => {\n s === this.node && t(this.node.attributes.context);\n }), this.node.attributes.context;\n }\n layout(t) {\n return t && this.subscribe(\"components:layout-changed\", (e, { node: s }) => {\n s === this.node && t(this.node.attributes.layout);\n }), this.node.attributes.layout;\n }\n writeProperties(t, e) {\n this.node.writeProperties(t, e);\n }\n writeContext(t, e) {\n this.node.writeProperties(t, e);\n }\n writeLayout(t, e) {\n this.node.writeLayout(t, e);\n }\n dispose() {\n this.unsubscribe(), this.actions.dispose();\n }\n}\nclass Ne {\n constructor(t, e, s = !0) {\n this.platform = t, this.target = e, this.clearOnDispose = s, this.removes = [], this.actions = new tt(this.platform, this.target);\n }\n writeProperties(t, e) {\n this.removes.push(\n this.platform.write({\n options: e,\n attributes: { properties: t },\n target: this.target,\n removable: this.clearOnDispose\n })\n );\n }\n writeContext(t, e) {\n this.removes.push(\n this.platform.write({\n options: e,\n attributes: { context: t },\n target: this.target,\n removable: this.clearOnDispose\n })\n );\n }\n writeLayout(t, e) {\n this.removes.push(\n this.platform.write({\n options: e,\n attributes: { layout: t },\n target: this.target,\n removable: this.clearOnDispose\n })\n );\n }\n dispose() {\n this.removes.forEach((t) => {\n t();\n }), this.actions.dispose();\n }\n}\nconst _e = (n, t, e) => {\n const s = n.concat(), i = (r, o, c) => {\n let u = !0;\n if (s.length) {\n const h = s.shift(), a = (l, p) => (u = !1, i(l, Object.assign({}, o, p), c));\n return Promise.resolve(h(r, a, c)).then((l) => ht(I({}, l), {\n cancelled: u\n }));\n }\n return Promise.resolve({ data: r, cancelled: !1, options: o });\n };\n return i(t, {}, e);\n};\nclass tt {\n constructor(t, e, s) {\n this.platform = t, this.target = e, this.ns = s, this.subscriptions = [], this.create = this.create.bind(this);\n }\n create(t, e = () => {\n }) {\n const s = {\n key: t,\n fn: e,\n target: this.target,\n ns: this.ns\n };\n this.platform.actionsState.handlers.push(s);\n const i = () => {\n const r = this.platform.actionsState.handlers.indexOf(s);\n r > -1 && this.platform.actionsState.handlers.splice(r, 1);\n };\n return this.subscriptions.push(i), i;\n }\n dispatch(t, e) {\n const s = this.platform.nodes.all.concat(\n this.platform.nodes.detached\n ), i = {}, r = this.platform.actionsState.handlers.filter(\n (o) => o.key === t && (!o.ns || !this.ns || o.ns === this.ns)\n );\n return Promise.all(\n r.map((o) => {\n const c = s.filter(\n (h) => o.target.match(h) && this.target.match(h)\n ), u = this.platform.actionsState.watchers.filter((h) => h.key === t && (!h.ns || !this.ns || h.ns === this.ns) && c.some((a) => h.target.match(a))).map((h) => h.fn);\n return Promise.all(\n c.map((h) => {\n const a = new Mt(\n this.platform,\n h,\n this.ns\n );\n return _e(u, e, a).then((l) => {\n const { data: p = {}, options: d, cancelled: C } = l;\n return Promise.resolve(\n C ? {} : o.fn(p, d, a)\n ).then((N) => {\n i[h.id] = N;\n });\n });\n })\n );\n })\n ).then(() => i);\n }\n watch(t, e) {\n let s = t, i = this.ns;\n const r = t.split(\".\");\n r.length > 1 && (i = r[0], s = r.splice(1).join(\".\"));\n const o = {\n fn: e,\n target: this.target,\n key: s,\n ns: i\n };\n this.platform.actionsState.watchers.push(o);\n const c = () => {\n const u = this.platform.actionsState.watchers.indexOf(o);\n u > -1 && this.platform.actionsState.watchers.splice(u, 1);\n };\n return this.subscriptions.push(c), c;\n }\n dispose() {\n this.subscriptions.forEach((t) => t());\n }\n}\nconst Ye = _t((n) => {\n n.createCommand(\"components\", (t) => (e) => {\n t.events.subscribeOnce(\n \"components:platform-created\",\n (s, { platform: i }) => {\n e.handlers && e.handlers.forEach(([r, o]) => {\n i.addComponentHandler(r, o);\n });\n }\n );\n });\n}), T = (n, t, ...e) => typeof t == \"string\" ? n(`[humany] ${t}`, ...e) : n(t, ...e), R = class {\n constructor() {\n this.keys = [], this.log = (n, ...t) => this.lookup(n, () => R.log(...t)), this.warn = (n, ...t) => this.lookup(n, () => R.warn(...t)), this.error = (n, ...t) => this.lookup(n, () => R.error(...t)), this.info = (n, ...t) => this.lookup(n, () => R.info(...t));\n }\n lookup(n, t) {\n this.keys.indexOf(n) === -1 && (this.keys.push(n), t());\n }\n};\nlet P = R;\nP.log = (...n) => T(console.log, ...n);\nP.warn = (...n) => T(console.warn, ...n);\nP.error = (...n) => T(console.error, ...n);\nP.info = (...n) => T(console.info, ...n);\nconst k = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);\nfunction et() {\n return k() + k() + \"-\" + k() + \"-\" + k() + \"-\" + k() + \"-\" + k() + k() + k();\n}\nclass xt {\n constructor(t, e) {\n this.events = t, this.tags = [], this.children = {}, this.changesets = [], this.mountCount = 0, this.id = et(), this.type = e, this.attributes = {\n context: {},\n properties: {},\n layout: {},\n tags: []\n }, this.writeLayout({ size: \"full\", indent: 0 });\n }\n mount(t, e) {\n let s = t.get(\"mounted-nodes\");\n return s || (s = /* @__PURE__ */ new Map(), t.register(\"mounted-nodes\", s)), s.has(this) ? (process.env.NODE_ENV !== \"production\" && P.error(\n \"Trying to mount an already mounted component node.\",\n this\n ), () => {\n }) : (this.events.dispatch(\"components:node-mounted\", { node: this }), this.mountCount === 0 && (this.mountCount = this.mountCount + 1, this.events.dispatch(\"components:node-enter\", { node: this })), () => {\n s.delete(this), this.events.dispatch(\"components:node-unmounted\", { node: this }), this.mountCount = this.mountCount - 1, this.mountCount === 0 && this.events.dispatch(\"components:node-exit\", { node: this });\n });\n }\n appendChild(t, e = \"default\") {\n if (t.parent) {\n if (t.parent === this)\n return;\n t.parent.removeChild(t);\n }\n t.parent = this, this.children[e] || (this.children[e] = []), this.children[e].push(t), this.events.dispatch(\"components:node-appended\", { node: t });\n }\n prependChild(t, e = \"default\") {\n if (t.parent) {\n if (t.parent === this)\n return;\n t.parent.removeChild(t);\n }\n t.parent = this, this.children[e] || (this.children[e] = []), this.children[e].unshift(t), this.events.dispatch(\"components:node-appended\", { node: t });\n }\n touchProperties(t, e = {}, s) {\n const r = [{ properties: t }, e];\n return this.changesets.push(r), this.events.dispatch(\"components:set-properties\", { node: this }), () => {\n if (s) {\n const o = this.changesets.indexOf(r);\n o > -1 && (this.changesets.splice(o, 1), this.events.dispatch(\"components:set-properties\", { node: this }));\n }\n };\n }\n writeProperties(t, e = {}, s) {\n const r = [{ properties: t }, e];\n return this.changesets.push(r), this.events.dispatch(\"components:set-properties\", { node: this }), () => {\n if (s) {\n const o = this.changesets.indexOf(r);\n o > -1 && (this.changesets.splice(o, 1), this.events.dispatch(\"components:set-properties\", { node: this }));\n }\n };\n }\n writeLayout(t, e = {}, s) {\n const r = [{ layout: t }, e];\n return this.changesets.push(r), this.events.dispatch(\"components:set-layout\", { node: this }), () => {\n if (!s)\n return;\n const o = this.changesets.indexOf(r);\n o > -1 && (this.changesets.splice(o, 1), this.events.dispatch(\"components:set-layout\", { node: this }));\n };\n }\n writeContext(t, e = {}, s) {\n const r = [{ context: t }, e];\n return this.changesets.push(r), this.events.dispatch(\"components:set-context\", { node: this }), () => {\n if (!s)\n return;\n const o = this.changesets.indexOf(r);\n o > -1 && (this.changesets.splice(o, 1), this.events.dispatch(\"components:set-context\", { node: this }));\n };\n }\n getChildren(t = \"default\") {\n const e = this.children[t] || [];\n return e.reduce((s, i, r) => {\n const { order: o = r } = i.attributes.layout;\n return s[o] ? s.splice(o, 0, i) : s[o] = i, s;\n }, Array(e.length));\n }\n remove() {\n this.parent && this.parent.removeChild(this);\n }\n removeChild(t) {\n Object.keys(this.children).forEach((e) => {\n const s = this.children[e], i = s.indexOf(t);\n i > -1 && (s.splice(i, 1), this.events.dispatch(\"components:node-removed\", {\n node: t,\n parentNode: this\n }));\n }), delete t.parent;\n }\n}\nconst zt = (n, t, e) => {\n for (let s = 0, i = n.length; s < i && e(n[s]) !== !0; s++) {\n const r = t[n[s].id] || \"default\", o = n[s].getChildren(r);\n zt(o, t, e);\n }\n}, st = (n, t, e) => {\n if (e(n) !== !0) {\n const s = t[n.id] || \"default\", i = n.children[s];\n zt(i, t, e);\n }\n}, B = (n, t) => {\n const e = [];\n return st(n, t, (s) => {\n e.push(s);\n }), e;\n}, Re = (n, t, e) => {\n let s;\n return st(n, t, (i) => {\n if (e(i))\n return s = i, !0;\n }), s;\n};\nclass De {\n constructor(t, e, s) {\n this.root = t, this.switches = e, this.all = [], this.visible = [], this.detached = [], s.subscribe(\n \"components:node-appended\",\n (i, r) => {\n this.all.push(r.node), this.visible = B(t, e);\n }\n ), s.subscribe(\n \"components:node-removed\",\n (i, r) => {\n let o = this.all.indexOf(r.node);\n o > -1 && this.all.splice(o, 1), o = this.visible.indexOf(r.node), o > -1 && this.visible.splice(o, 1), this.visible = B(t, e);\n }\n ), s.subscribe(\n \"components:node-switched\",\n (i, r) => {\n this.visible = B(t, e);\n }\n );\n }\n query(t = {}) {\n const e = [];\n return st(this.root, this.switches, (s) => {\n Object.keys(t).every((r) => t[r] === s[r]) && e.push(s);\n }), e;\n }\n get(t) {\n return Re(this.root, this.switches, (e) => e.id === t) || this.detached.find((e) => e.id === t);\n }\n}\nclass Ie {\n constructor() {\n this.handlers = /* @__PURE__ */ new Map();\n }\n add(t, e) {\n this.handlers.set(t, e);\n }\n get(t) {\n return this.handlers.get(t);\n }\n}\nconst Le = (n) => {\n let t = n, e = 0;\n for (; t.parent; )\n e = e + 1, t = t.parent;\n return e;\n}, Me = (n) => n.map(([e, s]) => [Le(e), e, s]).sort(([e], [s]) => e - s).map(([, e, s]) => [e, s]), Q = (n) => n instanceof Date ? !1 : n && typeof n == \"object\" && !Array.isArray(n), w = (n, ...t) => {\n if (!t.length)\n return n;\n const e = t.shift();\n if (Q(n) && Q(e))\n for (const s in e)\n Q(e[s]) ? (n[s] || Object.assign(n, { [s]: {} }), w(n[s], e[s])) : Object.assign(n, { [s]: e[s] });\n return w(n, ...t);\n}, ze = (n, t) => !n || n === \"all\" ? !0 : n.some((e) => t.indexOf(e) > -1), Se = (n, t) => {\n let e = [], s = [], i;\n const r = () => {\n process.env.NODE_ENV !== \"production\" && console.time(\"state-processor.flush\");\n const c = /* @__PURE__ */ new Map(), u = Me(e.map((a, l) => [a, s[l]])), h = (a, l) => {\n var ot;\n const p = c.get(a) || {}, d = l.context && !p.context, C = l.properties && !p.properties, N = l.layout && !p.layout;\n c.set(a, {\n context: p.context || d,\n properties: p.properties || C,\n layout: p.layout || N\n }), C && (a.attributes.properties = {}), N && (a.attributes.layout = {}), d && (a.attributes.context = w({}, (ot = a.parent) == null ? void 0 : ot.attributes.context));\n const nt = [], it = [], rt = [];\n if (a.changesets.forEach((y) => {\n const [f, V] = y;\n ze(V.breakpoints, n.breakpoints) && (C && (typeof f.properties == \"function\" ? nt.push(\n f.properties\n ) : w(a.attributes.properties, f.properties)), N && (typeof f.layout == \"function\" ? it.push(f.layout) : w(a.attributes.layout, f.layout)), d && (typeof f.context == \"function\" ? rt.push(f.context) : w(a.attributes.context, f.context)));\n }), nt.forEach((y) => {\n w(a.attributes.properties, y(a.attributes.properties));\n }), it.forEach((y) => {\n w(a.attributes.layout, y(a.attributes.layout));\n }), rt.forEach((y) => {\n w(a.attributes.context, y(a.attributes.context));\n }), d || l.recursive) {\n const y = n.getBranch(a), f = l.recursive ? l : {\n context: !!d\n };\n a.getChildren(y).forEach((V) => {\n h(V, f);\n });\n }\n };\n process.env.NODE_ENV !== \"production\" && console.timeEnd(\"state-processor.flush\"), u.forEach(([a, l]) => {\n h(a, l);\n }), e = [], s = [], t(c);\n }, o = () => {\n clearTimeout(i), i = setTimeout(r, 0);\n };\n return (c, u) => {\n const h = e.indexOf(c);\n if (h > -1) {\n const a = s[h];\n return u.context && (a.context = !0), u.properties && (a.properties = !0), u.layout && (a.layout = !0), u.recursive && (a.recursive = !0), o();\n }\n return e.push(c), s.push(u), o();\n };\n};\nclass Te {\n constructor(t, e = {}) {\n this.providers = e, this.breakpoints = [], this.actionsState = { handlers: [], watchers: [] }, this.switches = {}, this.changesets = [], this.subscriptions = [], this.customComponentHandler = new Ie(), this.events = t.events.createChild(this);\n const s = new xt(this.events, \"root\");\n s.name = `root-${t.name}`, this.nodes = new De(s, this.switches, this.events);\n const i = this.processNode = Se(\n this,\n (r) => {\n const o = Array.from(r.keys());\n process.env.NODE_ENV !== \"production\" && console.info(`STATE PROCESSOR: ${o.length} node(s) processed:\n${o.map(\n (c) => `${c.name || \"<no name>\"} (${c.id})\n`\n )}`), o.forEach((c) => {\n const u = r.get(c);\n c.parent && c.parent.type === \"root\" && this.events.dispatch(\"components:root-children-changed\", { node: c }), u != null && u.context && this.events.dispatch(\"components:context-changed\", { node: c }), u != null && u.properties && this.events.dispatch(\"components:properties-changed\", { node: c }), u != null && u.layout && this.events.dispatch(\"components:layout-changed\", { node: c });\n }), this.events.dispatch(\n \"components:component-model-initialized\",\n {},\n { bubbles: !0 }\n );\n }\n );\n Promise.all(\n Object.keys(e).map((r) => e[r].load(this))\n ), this.subscriptions.push(\n this.events.subscribe(\n \"components:node-appended\",\n (r, o) => {\n const { node: c } = o;\n this.changesets.forEach((u) => {\n const { changeset: h, target: a, removes: l } = u, [p, d] = h;\n a.match(o.node) && (p.properties && l.push(c.writeProperties(p.properties, d)), p.context && l.push(c.writeContext(p.context, d)), p.layout && l.push(c.writeLayout(p.layout, d)));\n });\n }\n )\n ), this.subscriptions.push(\n this.events.subscribe(\n \"components:node-appended\",\n (r, o) => {\n i(o.node, { properties: !0, context: !0 });\n }\n )\n ), this.subscriptions.push(\n this.events.subscribe(\n \"components:set-properties\",\n (r, o) => {\n i(o.node, { properties: !0 });\n }\n )\n ), this.subscriptions.push(\n this.events.subscribe(\n \"components:set-context\",\n (r, o) => {\n i(o.node, { properties: !0, context: !0 });\n }\n )\n ), this.subscriptions.push(\n this.events.subscribe(\n \"components:set-indent\",\n (r, o) => {\n i(o.node, { layout: !0 });\n }\n )\n ), this.subscriptions.push(\n this.events.subscribe(\n \"components:set-layout\",\n (r, o) => {\n i(o.node, { layout: !0 });\n }\n )\n ), this.subscriptions.push(\n this.events.subscribe(\n \"components:node-switched\",\n (r, { node: o, branch: c }) => {\n i(o, {\n layout: !0,\n recursive: !0,\n properties: !0,\n context: !0\n });\n }\n )\n ), this.subscriptions.push(\n this.events.subscribe(\n \"components:node-removed\",\n (r, { parentNode: o }) => {\n i(o, { properties: !0 });\n }\n )\n ), this.events.parent && this.events.parent.dispatch(\"components:platform-created\", {\n platform: this\n });\n }\n static getInstance(t) {\n return t.getAsync(\"components\");\n }\n addBreakpoint(t) {\n this.breakpoints.indexOf(t) === -1 && (this.breakpoints.push(t), this.processNode(this.nodes.root, {\n context: !0,\n properties: !0,\n layout: !0,\n recursive: !0\n }));\n }\n removeBreakpoint(t) {\n const e = this.breakpoints.indexOf(t);\n e > -1 && (this.breakpoints.splice(e, 1), this.processNode(this.nodes.root, {\n context: !0,\n properties: !0,\n layout: !0,\n recursive: !0\n }));\n }\n setSwitch(t, e) {\n this.switches[t.id] = e, this.events.dispatch(\"components:node-switched\", { node: t, branch: e });\n }\n getBranch(t) {\n return this.switches[t.id];\n }\n /**\n * Creates a `ComponentNode` of the specified type.\n * @param type Type of node.\n */\n createNode(t, e = {}) {\n const s = new xt(this.events, t);\n return e.detached && this.nodes.detached.push(s), s;\n }\n components() {\n return new Z(this);\n }\n actions(t, e) {\n return new tt(this, t, e);\n }\n write(t) {\n const {\n provider: e,\n target: s,\n attributes: i,\n options: r = {},\n removable: o\n } = t, c = t.key || et(), h = { changeset: [i, r], target: s, removes: [] };\n if (e) {\n const a = this.providers[e];\n a.write(c, s, i, r), h.removes.push(() => {\n a.remove(c);\n });\n }\n return this.changesets.push(h), this.nodes.all.forEach((a) => {\n if (s.match(a)) {\n let l = () => {\n };\n i.properties && (l = a.writeProperties(\n i.properties,\n r,\n o\n )), i.context && (l = a.writeContext(i.context, r, o)), i.layout && (l = a.writeContext(i.layout, r, o)), h.removes.push(l);\n }\n }), () => {\n if (o) {\n h.removes.forEach((l) => l());\n const a = this.changesets.indexOf(h);\n a > -1 && this.changesets.splice(a, 1);\n }\n };\n }\n addComponentHandler(t, e) {\n this.customComponentHandler.add(t, e);\n }\n getComponentHandler(t) {\n return this.customComponentHandler.get(t);\n }\n dispose() {\n this.subscriptions.forEach((t) => t());\n }\n}\nconst Ve = (n) => {\n if (Array.isArray(n)) {\n const [t, ...e] = n;\n return {\n definitionId: t,\n overrides: e\n };\n }\n return {\n definitionId: n,\n overrides: []\n };\n}, Y = (n, t, e, s, i, r) => {\n e.forEach((o) => {\n const c = Ve(o), u = s[c.definitionId];\n if (c.definitionId === \"view\") {\n const h = n.createNode(\"view\");\n h.name = \"view\", Object.keys(i).forEach((a) => {\n const l = i[a];\n Y(n, h, [l.entry], s, i, a);\n }), t.appendChild(h), c.overrides.forEach((a) => {\n a.properties && h.writeProperties(a.properties, {\n breakpoints: a.breakpoints\n }), a.context && h.writeContext(a.context, { breakpoints: a.breakpoints }), a.layout && h.writeLayout(a.layout, { breakpoints: a.breakpoints });\n });\n } else if (n.getComponentHandler(u.type)) {\n const h = n.getComponentHandler(u.type);\n h && h(c, {\n platform: n,\n node: t,\n references: e,\n definitions: s,\n views: i,\n branch: r\n });\n } else {\n const h = s[c.definitionId];\n if (process.env.NODE_ENV !== \"production\" && !h) {\n P.error(\n `No definition found for component type '${c.definitionId}'.`\n );\n return;\n }\n const a = n.createNode(h.type);\n a.name = c.definitionId, a.tags = h.tags || [], h.properties && a.writeProperties(h.properties), h.context && a.writeContext(h.context), h.layout && a.writeLayout(h.layout), t.appendChild(a, r), c.overrides.forEach((l) => {\n const p = { breakpoints: l.breakpoints };\n l.properties && a.writeProperties(l.properties, p), l.context && a.writeContext(l.context, p), l.layout && a.writeLayout(l.layout, p);\n }), h.children && Y(n, a, h.children, s, i);\n }\n });\n}, Ue = (n, t) => {\n const { entry: e, components: s, breakpoints: i, views: r } = t, o = [];\n return Object.keys(i).forEach((c) => {\n const u = i[c], h = window.matchMedia(u);\n h.matches && n.breakpoints.push(c);\n const a = (l) => {\n l.matches ? n.addBreakpoint(c) : n.removeBreakpoint(c);\n };\n h.addListener(a), o.push(() => h.removeListener(a));\n }), Y(n, n.nodes.root, [e], s, r), () => o.forEach((c) => {\n c();\n });\n}, Ge = (n, t) => ({\n id: n.id,\n type: n.type,\n name: n.name,\n branch: t || \"default\"\n}), Ke = (n, t, e, s = et(), i = {}) => n.getAsync(\"components\").then((r) => {\n let o;\n if (typeof t == \"string\") {\n const h = new Z(r);\n h.ofType(t), o = h;\n } else\n o = t;\n const c = {}, u = (h) => {\n const a = c[h.id];\n return a ? Promise.resolve(a.controller) : Te.getInstance(n).then((l) => new Mt(l, h, s));\n };\n r.events.subscribe(\n \"components:node-enter\",\n (h, { node: a }) => {\n o.match(a) && u(a).then((l) => {\n Promise.resolve(e(l)).then((p) => {\n c[a.id] = {\n dispose: p,\n controller: l\n };\n });\n });\n }\n ), r.events.subscribe(\n \"components:node-exit\",\n (h, { node: a }) => {\n const l = c[a.id];\n l && (l.dispose && l.dispose(), i.reuseController || (l.controller.dispose(), delete c[a.id]));\n }\n );\n});\nclass Je {\n constructor(t) {\n this.aliases = /* @__PURE__ */ new Map(), this.components = /* @__PURE__ */ new Map(), this.logger = new P();\n const { events: e } = t.get(\"$widget\");\n this.events = e;\n }\n getComponent(t) {\n const e = this.aliases.get(t), s = this.components.get(e || t) || null;\n return process.env.NODE_ENV !== \"production\" && (s || this.logger.warn(\n e || t,\n `Unable to resolve component: \"${e || t}\". You most likely forgot to register the required plugin for: ${e || t}.`\n )), s;\n }\n registerComponent(t, e) {\n return this.components.set(t, e), this.events.dispatch(\"component-resolver:resolve\", t), () => {\n this.components.delete(t);\n };\n }\n registerResolver(t, e) {\n return this.events.subscribe(\n \"component-resolver:resolve\",\n (s, i) => {\n if (i === t) {\n const r = this.getComponent(t);\n e(r);\n }\n }\n );\n }\n registerAlias(t, e) {\n return this.aliases.set(t, e), this.events.dispatch(\"component-resolver:resolve\", t), () => {\n this.aliases.delete(t);\n };\n }\n}\nconst je = \"#____version____#\", St = class Tt extends Lt {\n constructor(t, e = []) {\n super(t, e, {\n transformPluginSettings: (s, i, r) => {\n const o = r.get(\"$settings\"), c = o.plugins && i ? o.plugins[i] || {} : {};\n return I(I({}, c), s);\n }\n });\n }\n createImplementation(t) {\n const e = super.createImplementation(t);\n return e.bindings = t.bindings, e;\n }\n /**\n * Performs navigation for widgets matching the specified selector by invoking a\n * 'navigate' command.\n * @param selector Widget selector matching the widget(s) to perform navigation on.\n * @param route Route name.\n * @param params Route params.\n */\n navigate(t, e, s) {\n this.widgets.query(t).forEach((i) => i.invoke(\"navigate\", { route: e, params: s }));\n }\n /**\n * Creates a runtime based on provided configuration.\n * @param configuration Runtime configuration.\n */\n static create(t = {}) {\n const e = [ne].concat(\n t.configurationApiExtensions || []\n );\n return new Tt(\"humany\", e);\n }\n /**\n * Creates a widget runtime based on provided configuration and retains configuration handlers\n * registered on global context. Use this factory to fully support the default embed script.\n * Will return any existing widget runtime if available.\n * @param configuration Runtime configuration.\n * @param global Object to read configuration handlers from (default: window).\n */\n static createFromGlobal(t, e = {}) {\n if (this.isRuntime(t))\n return t.patch(e), t;\n const s = [], i = t && t._c;\n i && i.forEach(\n (o) => s.push(o)\n );\n const r = this.create(e);\n return r.container.register(\"$runtimecfg\", s), r;\n }\n /**\n * Determines whether the specified object is a valid widget runtime.\n * @param obj Object to compare.\n */\n static isRuntime(t) {\n return !!(t && typeof t == \"object\" && t.container && typeof t.container.get == \"function\" && t.container.get(\"$environment\") === t && t.container.owner === t);\n }\n};\nSt.version = `${je} (${X})`;\nlet Xe = St;\nclass Ze extends Rt {\n constructor() {\n super(...arguments), this.bindings = [];\n }\n}\nclass ts extends ge {\n constructor(t, e) {\n super(t, e);\n }\n}\nvar qe = /* @__PURE__ */ ((n) => (n.open = \"open\", n.closed = \"closed\", n.hidden = \"hidden\", n))(qe || {});\nclass es extends Ee {\n constructor(t) {\n super(t);\n }\n}\nexport {\n He as ActionResolver,\n tt as ActionsController,\n xt as ComponentNode,\n Mt as ComponentNodeController,\n Te as ComponentPlatform,\n Z as ComponentQuery,\n Je as ComponentResolver,\n Xe as Environment,\n Ze as Implementation,\n ts as Plugin,\n qe as WidgetRenderState,\n es as WidgetType,\n Ge as asDescriptor,\n Qe as bootstrap,\n Ye as componentConfigurationApi,\n Y as createChildren,\n Ue as createComponentModel,\n Ae as createEventSubscriber,\n Ke as extendComponent,\n Re as findComponent,\n B as findVisibleComponents,\n st as traverseComponents,\n je as version\n};\n//# sourceMappingURL=index.js.map\n","var O = Object.getOwnPropertySymbols;\nvar L = Object.prototype.hasOwnProperty, B = Object.prototype.propertyIsEnumerable;\nvar x = (e, t) => {\n var o = {};\n for (var r in e)\n L.call(e, r) && t.indexOf(r) < 0 && (o[r] = e[r]);\n if (e != null && O)\n for (var r of O(e))\n t.indexOf(r) < 0 && B.call(e, r) && (o[r] = e[r]);\n return o;\n};\nfunction I(e) {\n const t = [];\n return e.forEach((o) => {\n t.indexOf(o) === -1 && t.push(o);\n }), t;\n}\nfunction k(e = \"\", t = \"\") {\n const o = e.split(\" \").concat(t.split(\" \"));\n return I(o).join(\" \").trim();\n}\nfunction U(e, t) {\n if (e) {\n if (typeof t == \"string\")\n return t;\n if (Array.isArray(t)) {\n let o = \"\";\n return t.forEach((r) => o = k(o, r)), o;\n }\n }\n}\nfunction X(...e) {\n let t = \"\";\n return e.length && e.forEach((o) => {\n typeof o == \"string\" ? t = k(t, o) : Array.isArray(o) ? t = k(t, U(...o)) : typeof o != \"undefined\" && o !== null && process.env.NODE_ENV !== \"production\" && p.warn(\n \"appendClassNames: arguments either haveto be a string or [boolean, ...string[]]. Passed args:\",\n ...e\n );\n }), t;\n}\nconst z = (e, t) => {\n let o, r = [];\n return (i) => (clearTimeout(o), new Promise((n, a) => {\n r.push([i, n, a]), o = setTimeout(() => {\n let f = t();\n r.forEach(([c, g, m]) => {\n f = c(f);\n }), r = [], n(f);\n }, e);\n }));\n}, tt = z;\nfunction T(e) {\n const t = {};\n if (typeof e == \"number\" || typeof e == \"string\")\n return e;\n for (const o in e)\n if (e.hasOwnProperty(o)) {\n const r = e[o], i = o.substring(0, 1).toLowerCase() + o.substring(1);\n if (Object.prototype.toString.call(r) === \"[object Array]\") {\n t[i] = [];\n for (let n = 0, a = r.length; n < a; n++)\n t[i].push(T(r[n]));\n } else\n r !== null && typeof r == \"object\" ? t[i] = T(r) : t[i] = r;\n }\n return t;\n}\nfunction N(e = {}) {\n const $ = e, {\n phrase: t = \"\",\n category: o,\n guideCategory: r,\n contactCategory: i,\n take: n,\n connectionKey: a,\n accordion: f,\n id: c,\n uriName: g,\n sorting: m,\n tag: u,\n tagId: l,\n tagTitle: h\n } = $, P = x($, [\n \"phrase\",\n \"category\",\n \"guideCategory\",\n \"contactCategory\",\n \"take\",\n \"connectionKey\",\n \"accordion\",\n \"id\",\n \"uriName\",\n \"sorting\",\n \"tag\",\n \"tagId\",\n \"tagTitle\"\n ]), s = {};\n return Object.keys(P).forEach((A) => {\n typeof e[A] == \"string\" && (s[A] = e[A]);\n }), typeof t == \"string\" && t.length && (s.phrase = t), t === null && (s.phrase = t), typeof r == \"string\" && r !== \"0\" && (s.guideCategory = r), typeof r == \"number\" && r !== 0 && (s.guideCategory = r), typeof r == \"object\" && r !== null && (typeof r.id == \"string\" && r.id !== \"0\" && (s.guideCategory = r.id), typeof r.id == \"number\" && r.id !== 0 && (s.guideCategory = r.id)), typeof i == \"string\" && i !== \"0\" && (s.contactCategory = i), typeof i == \"number\" && i !== 0 && (s.contactCategory = i), typeof i == \"object\" && i !== null && (typeof i.id == \"string\" && i.id !== \"0\" && (s.contactCategory = i.id), typeof i.id == \"number\" && i.id !== 0 && (s.contactCategory = i.id)), typeof o == \"string\" && o !== \"0\" && (s.category = o), typeof o == \"number\" && o !== 0 && (s.category = o), typeof o == \"object\" && o !== null && (typeof o.id == \"string\" && o.id !== \"0\" && (s.category = o.id), typeof o.id == \"number\" && o.id !== 0 && (s.category = o.id)), c && (s.id = c), g && (+s.category || +s.guideCategory || +s.guide || +s.contactCategory || +s.contactMethod) && (s.uriName = g), a && (s.connectionKey = a), n && (s.take = n), m && (s.sorting = m), typeof f == \"string\" && f.length > 0 && (s.accordion = f), typeof u == \"string\" && u !== \"0\" && (s.tag = u), typeof u == \"number\" && u !== 0 && (s.tag = u), Array.isArray(u) && u.length && (s.tag = u), (typeof l == \"string\" || typeof l == \"number\") && (s.tagId = l), typeof h == \"string\" && (s.tagTitle = h), typeof s.tag == \"string\" && (s.tag = s.tag.split(\",\")), s;\n}\nfunction* q(e) {\n if (e)\n for (let t = 0; t < e.length; t++) {\n const o = e[t];\n yield o, o.items && (yield* q(o.items));\n }\n}\nconst V = (e, t) => {\n const o = q(t);\n let r = o.next(), i = null;\n for (; !r.done; )\n r.value.id === e && (i = r.value), r = o.next();\n return i;\n}, W = V, M = (e) => {\n if (!e)\n return \"\";\n const t = [\n { from: /[äæǽ]+/gi, to: \"ae\" },\n { from: /[öœ]+/gi, to: \"oe\" },\n { from: /[ü]+/gi, to: \"ue\" },\n { from: /[Ä]+/gi, to: \"Ae\" },\n { from: /[Ü]+/gi, to: \"Ue\" },\n { from: /[Ö]+/gi, to: \"Oe\" },\n { from: /[ÀÁÂÃÄÅǺĀĂĄǍΑΆẢẠẦẪẨẬẰẮẴẲẶА]+/gi, to: \"A\" },\n { from: /[àáâãåǻāăąǎªαάảạầấẫẩậằắẵẳặа]+/gi, to: \"a\" },\n { from: /[Б]+/gi, to: \"B\" },\n { from: /[б]+/gi, to: \"b\" },\n { from: /[ÇĆĈĊČ]+/gi, to: \"C\" },\n { from: /[çćĉċč]+/gi, to: \"c\" },\n { from: /[Д]+/gi, to: \"D\" },\n { from: /[д]+/gi, to: \"d\" },\n { from: /[ÐĎĐΔ]+/gi, to: \"Dj\" },\n { from: /[ðďđδ]+/gi, to: \"dj\" },\n { from: /[ÈÉÊËĒĔĖĘĚΕΈẼẺẸỀẾỄỂỆЕЭ]+/gi, to: \"E\" },\n { from: /[èéêëēĕėęěέεẽẻẹềếễểệеэ]+/gi, to: \"e\" },\n { from: /[Ф]+/gi, to: \"F\" },\n { from: /[ф]+/gi, to: \"f\" },\n { from: /[ĜĞĠĢΓГҐ]+/gi, to: \"G\" },\n { from: /[ĝğġģγгґ]+/gi, to: \"g\" },\n { from: /[ĤĦ]+/gi, to: \"H\" },\n { from: /[ĥħ]+/gi, to: \"h\" },\n { from: /[ÌÍÎÏĨĪĬǏĮİΗΉΊΙΪỈỊИЫ]+/gi, to: \"I\" },\n { from: /[ìíîïĩīĭǐįıηήίιϊỉịиыї]+/gi, to: \"i\" },\n { from: /[Ĵ]+/gi, to: \"J\" },\n { from: /[ĵ]+/gi, to: \"j\" },\n { from: /[ĶΚК]+/gi, to: \"K\" },\n { from: /[ķκк]+/gi, to: \"k\" },\n { from: /[ĹĻĽĿŁΛЛ]+/gi, to: \"L\" },\n { from: /[ĺļľŀłλл]+/gi, to: \"l\" },\n { from: /[М]+/gi, to: \"M\" },\n { from: /[м]+/gi, to: \"m\" },\n { from: /[ÑŃŅŇΝН]+/gi, to: \"N\" },\n { from: /[ñńņňʼnνн]+/gi, to: \"n\" },\n { from: /[ÒÓÔÕŌŎǑŐƠØǾΟΌΩΏỎỌỒỐỖỔỘỜỚỠỞỢО]+/gi, to: \"O\" },\n { from: /[òóôõōŏǒőơøǿºοόωώỏọồốỗổộờớỡởợо]+/gi, to: \"o\" },\n { from: /[П]+/gi, to: \"P\" },\n { from: /[п]+/gi, to: \"p\" },\n { from: /[ŔŖŘΡР]+/gi, to: \"R\" },\n { from: /[ŕŗřρр]+/gi, to: \"r\" },\n { from: /[ŚŜŞȘŠΣС]+/gi, to: \"S\" },\n { from: /[śŝşșšſσςс]+/gi, to: \"s\" },\n { from: /[ȚŢŤŦτТ]+/gi, to: \"T\" },\n { from: /[țţťŧт]+/gi, to: \"t\" },\n { from: /[ÙÚÛŨŪŬŮŰŲƯǓǕǗǙǛŨỦỤỪỨỮỬỰУ]+/gi, to: \"U\" },\n { from: /[ùúûũūŭůűųưǔǖǘǚǜυύϋủụừứữửựу]+/gi, to: \"u\" },\n { from: /[ÝŸŶΥΎΫỲỸỶỴЙ]+/gi, to: \"Y\" },\n { from: /[ýÿŷỳỹỷỵй]+/gi, to: \"y\" },\n { from: /[В]+/gi, to: \"V\" },\n { from: /[в]+/gi, to: \"v\" },\n { from: /[Ŵ]+/gi, to: \"W\" },\n { from: /[ŵ]+/gi, to: \"w\" },\n { from: /[ŹŻŽΖЗ]+/gi, to: \"Z\" },\n { from: /[źżžζз]+/gi, to: \"z\" },\n { from: /[ÆǼ]+/gi, to: \"AE\" },\n { from: /[ß]+/gi, to: \"ss\" },\n { from: /[IJ]+/gi, to: \"IJ\" },\n { from: /[ij]+/gi, to: \"ij\" },\n { from: /[Œ]+/gi, to: \"OE\" },\n { from: /[ƒ]+/gi, to: \"f\" },\n { from: /[ξ]+/gi, to: \"ks\" },\n { from: /[π]+/gi, to: \"p\" },\n { from: /[β]+/gi, to: \"v\" },\n { from: /[μ]+/gi, to: \"m\" },\n { from: /[ψ]+/gi, to: \"ps\" },\n { from: /[Ё]+/gi, to: \"Yo\" },\n { from: /[ё]+/gi, to: \"yo\" },\n { from: /[Є]+/gi, to: \"Ye\" },\n { from: /[є]+/gi, to: \"ye\" },\n { from: /[Ї]+/gi, to: \"Yi\" },\n { from: /[Ж]+/gi, to: \"Zh\" },\n { from: /[ж]+/gi, to: \"zh\" },\n { from: /[Х]+/gi, to: \"Kh\" },\n { from: /[х]+/gi, to: \"kh\" },\n { from: /[Ц]+/gi, to: \"Ts\" },\n { from: /[ц]+/gi, to: \"ts\" },\n { from: /[Ч]+/gi, to: \"Ch\" },\n { from: /[ч]+/gi, to: \"ch\" },\n { from: /[Ш]+/gi, to: \"Sh\" },\n { from: /[ш]+/gi, to: \"sh\" },\n { from: /[Щ]+/gi, to: \"Shch\" },\n { from: /[щ]+/gi, to: \"shch\" },\n { from: /[ЪъЬь]+/gi, to: \"\" },\n { from: /[Ю]+/gi, to: \"Yu\" },\n { from: /[ю]+/gi, to: \"yu\" },\n { from: /[Я]+/gi, to: \"Ya\" },\n { from: /[я]+/gi, to: \"ya\" }\n ], o = /[^a-zA-Z0-9]+/g, r = /[-]$/;\n let i = e;\n for (const n in t)\n t.hasOwnProperty(n) && t[n].from.test(e) && (i = i.replace(t[n].from, t[n].to));\n return i = i.replace(o, \"-\"), i = i.replace(r, \"\"), i = i.toLowerCase(), i || \"humany\";\n}, E = M;\nfunction S(e, t = {}, o) {\n return e.forEach((r) => {\n o && (t[+r.id] = o), r.items && S(r.items, t, r.id);\n }), t;\n}\nfunction Y(e, t, o = [e], r = S(t)) {\n const i = (a) => {\n const f = r[+a];\n f && (o.unshift(f), i(f));\n }, n = r[+e];\n return n && (o.unshift(n), i(n)), o;\n}\nconst F = (e, t) => typeof e == \"undefined\" || typeof t == \"undefined\" ? /* @__PURE__ */ new Map() : new Map(\n e.map((o) => {\n const r = W(o, t);\n return [o, r];\n })\n), et = (e, t, o, r = \"guide-categories\") => o.getAsync(\"dataClient\").then((i) => i.fetch(r, { expandCategories: \"descendants\" }).then(({ categories: n }) => {\n const a = (f) => {\n const c = Y(f, n), g = F(c, n), m = [];\n return c.forEach((u) => {\n const l = g.get(u);\n l && m.push({\n routeName: e,\n title: l.title,\n symbol: l.symbol,\n id: l.id,\n routeParams: N(r === \"contact-method-categories\" ? {\n contactCategory: l.id,\n uriName: E(l.title)\n } : {\n guideCategory: l.id,\n uriName: E(l.title)\n })\n });\n }), m;\n };\n return Array.isArray(t) ? t.reduce((f, c) => {\n const g = a(c);\n return g.length > 0 && f.push(g), f;\n }, []) : a(t);\n})), K = (e) => {\n let t, o;\n e.split(\",\")[0].indexOf(\"base64\") !== -1 ? t = atob(e.split(\",\")[1]) : t = decodeURI(e.split(\",\")[1]), o = e.split(\",\")[0].split(\":\")[1].split(\";\")[0];\n const r = [];\n for (let i = 0; i < t.length; i++)\n r[i] = t.charCodeAt(i);\n return new Blob([new Uint8Array(r)], { type: o });\n}, ot = K;\nfunction rt(...e) {\n return process.env.NODE_ENV !== \"production\" && console && console.warn(...e);\n}\nconst C = (e, t, ...o) => typeof t == \"string\" ? e(`[humany] ${t}`, ...o) : e(t, ...o), y = class {\n constructor() {\n this.keys = [], this.log = (e, ...t) => this.lookup(e, () => y.log(...t)), this.warn = (e, ...t) => this.lookup(e, () => y.warn(...t)), this.error = (e, ...t) => this.lookup(e, () => y.error(...t)), this.info = (e, ...t) => this.lookup(e, () => y.info(...t));\n }\n lookup(e, t) {\n this.keys.indexOf(e) === -1 && (this.keys.push(e), t());\n }\n};\nlet p = y;\np.log = (...e) => C(console.log, ...e);\np.warn = (...e) => C(console.warn, ...e);\np.error = (...e) => C(console.error, ...e);\np.info = (...e) => C(console.info, ...e);\nconst D = (e) => {\n let t = {}, o, r;\n if (typeof e != \"object\" || e === null)\n return e;\n t = Array.isArray(e) ? [] : {};\n for (r in e)\n o = e[r], t[r] = typeof o == \"object\" && o !== null ? D(o) : o;\n return t;\n}, j = D, it = (e) => {\n if (!e)\n return null;\n const t = localStorage.getItem(\n `humany_${_(e.tenant + e.name)}`\n );\n if (t) {\n const { activeStickyWidget: o } = JSON.parse(t);\n if (o && o.value && e.widgets.get(o.value)) {\n const i = document.createElement(\"a\");\n i.setAttribute(\n \"href\",\n `//${e.bindings[0]}/${o.value}`\n ), document.body.appendChild(i);\n }\n }\n}, nt = (e, t = !1) => {\n const o = new Date(e);\n let r = `${o.getMonth() + 1}`, i = `${o.getDate()}`;\n const n = o.getFullYear();\n if (r.length < 2 && (r = `0${r}`), i.length < 2 && (i = `0${i}`), t) {\n let a = `${o.getHours()}`, f = `${o.getMinutes()}`;\n return a.length < 2 && (a = `0${a}`), f.length < 2 && (f = `0${f}`), `${[n, r, i].join(\"-\")} ${[a, f].join(\":\")}`;\n }\n return [n, r, i].join(\"-\");\n};\nfunction st(e) {\n const t = document.cookie;\n if (t.length > 0) {\n let o = t.indexOf(`${e}=`);\n if (o !== -1) {\n o = o + e.length + 1;\n let r = t.indexOf(\";\", o);\n return r === -1 && (r = t.length), unescape(t.substring(o, r));\n }\n }\n return null;\n}\nfunction _(e) {\n let t = 0;\n if (e.length === 0)\n return t.toString();\n for (let o = 0; o < e.length; o++) {\n const r = e.charCodeAt(o);\n t = (t << 5) - t + r, t = t & t;\n }\n return t.toString();\n}\nconst ft = (e, t) => {\n if (!e || !t)\n return !0;\n let o = t.parentNode, r = !1;\n for (; o !== null; )\n o === e && (r = !0), o = o.parentNode;\n return r;\n};\nfunction at(e) {\n return e.replace(/([a-z])([A-Z])/g, \"$1-$2\").replace(/\\s+/g, \"-\").toLowerCase();\n}\nclass Z {\n constructor(t, o) {\n this.lockWarningTime = t, this.lockErrorTime = o, this.tasks = [], this.current = Promise.resolve(), this.next = this.next.bind(this);\n }\n add(t, o, r, i) {\n this.tasks.push({ task: t, resolve: o, reject: r, done: i }), this.next();\n }\n next() {\n this.current = this.current.then(() => {\n const t = this.tasks.shift();\n if (t) {\n let o;\n const r = setTimeout(() => {\n process.env.NODE_ENV !== \"production\" && p.warn(\n `A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,\n t\n ), o = setTimeout(() => {\n t.reject(\"lock timeout exceeded\");\n }, this.lockErrorTime);\n }, this.lockWarningTime), i = Promise.resolve(t.task()).then((n) => (clearTimeout(r), clearTimeout(o), n));\n return Promise.resolve(i).then(this.next).then(\n () => i.then((n) => {\n t.done(), t.resolve(n);\n })\n ).catch((n) => (t.done(), t.reject(n), this.next()));\n }\n return Promise.resolve();\n });\n }\n}\nconst b = /* @__PURE__ */ new WeakMap();\nfunction ct(e, t = 5e3, o = 1e3) {\n return b.has(e) || b.set(e, new Z(t, o)), (r) => new Promise((i, n) => {\n const a = b.get(e);\n a.add(r, i, n, () => {\n a.tasks.length || b.delete(e);\n });\n });\n}\nconst v = (e) => !!e && typeof e == \"object\" && !Array.isArray(e), J = (e, ...t) => {\n const o = j(e), r = j(t);\n return w(o, ...r);\n}, w = (e, ...t) => {\n if (!t.length)\n return e;\n const o = t.shift();\n if (v(e) && v(o))\n for (const r in o)\n v(o[r]) ? (e[r] || Object.assign(e, { [r]: {} }), w(e[r], o[r])) : Object.assign(e, { [r]: o[r] });\n return w(e, ...t);\n}, ut = J, Q = (e, t) => {\n const o = () => t.querySelectorAll(\"[data-loading=true]\").length > 0, i = (() => {\n let a = !1;\n return () => {\n if (a)\n return;\n e.get(\"$widget\").events.dispatch(\"widget:data-loaded\", {\n element: t\n }), a = !0;\n };\n })();\n if (!o())\n return i();\n new MutationObserver((a, f) => {\n a.find(\n (g) => g.type === \"attributes\" && g.attributeName === \"data-loading\"\n ) && !o() && (f.disconnect(), i());\n }).observe(t, {\n attributes: !0,\n childList: !0,\n subtree: !0\n });\n}, R = (e, t) => {\n e.get(\"$widget\").container.getAsync(\"components\").then((r) => {\n r.events.subscribeOnce(\"components:component-model-initialized\", () => {\n let i = r.nodes.visible.reduce(\n (f, c) => (!c.name || !c.type || c.type === \"view\" || c.type === \"root\" || c.attributes.layout.size === \"none\" || t.querySelector(`[data-name=\"${c.name}\"]`) || f.push(c.name), f),\n []\n ), n = !1;\n new MutationObserver((f, c) => {\n f.forEach((g) => {\n if (g.addedNodes) {\n const m = Array.from(\n g.addedNodes\n ).reduce((u, l) => {\n const h = l.getAttribute && l.getAttribute(\"data-name\");\n return h && i.indexOf(h) > -1 && u.push(h), u;\n }, []);\n i = i.filter((u) => m.indexOf(u) === -1), !n && i.length === 0 && (n = !0, Q(e, t), c.disconnect());\n }\n });\n }).observe(t, {\n attributes: !1,\n characterData: !1,\n childList: !0,\n subtree: !0,\n attributeOldValue: !1,\n characterDataOldValue: !1\n });\n });\n });\n}, lt = R, H = (e = {}) => (Object.keys(e).forEach((t) => {\n (e[t] === null || typeof e[t] == \"undefined\") && delete e[t];\n}), e), gt = H;\nfunction mt(e, t, o) {\n let r = \"\";\n if (o) {\n const i = /* @__PURE__ */ new Date();\n i.setTime(i.getTime() + o * 24 * 60 * 60 * 1e3), r = `; expires=${i.toUTCString()}`;\n }\n document.cookie = `${e}=${t}${r}; path=/`;\n}\nconst dt = (e, t) => {\n let o = !0;\n return Object.keys(e).length !== Object.keys(t).length || Object.keys(e).some((i) => !Object.keys(t).some((a) => i === a)) ? !1 : (Object.keys(e).forEach((i) => {\n if (o) {\n const n = typeof e[i] == \"undefined\" ? \"\" : e[i], a = typeof t[i] == \"undefined\" ? \"\" : t[i];\n o = n.toString() === a.toString();\n }\n }), o);\n}, d = () => Math.floor((1 + Math.random()) * 65536).toString(16).substring(1);\nfunction ht() {\n return d() + d() + \"-\" + d() + \"-\" + d() + \"-\" + d() + \"-\" + d() + d() + d();\n}\nclass pt {\n constructor(t) {\n this.queue = [], this.queueAttemptCalls = 0, this.callCount = 5, this.add = (o) => {\n this.queue.push(o), this.queueAttempt = setInterval(this.processQueue, 1e3);\n }, this.processQueue = () => {\n if (this.queue.length > 0) {\n const o = [];\n this.queue.forEach((r, i) => {\n const n = r();\n typeof n == \"function\" && (n(), o.push(i));\n }), this.queue = this.queue.filter((r, i) => !(o.indexOf(i) > -1)), this.queueAttempt && clearInterval(this.queueAttempt);\n }\n this.queueAttemptCalls > this.callCount && (clearInterval(this.queueAttempt), this.queueAttemptCalls = 0), this.queueAttemptCalls = this.queueAttemptCalls + 1;\n }, t && t.callCount && (this.callCount = t.callCount);\n }\n}\nexport {\n p as Logger,\n pt as WaitFor,\n X as appendClassNames,\n et as buildCategoryTrail,\n T as camilize,\n Y as categoryTrail,\n tt as createBatch,\n N as createParams,\n ot as dataURItoBlob,\n rt as debugLog,\n j as deepClone,\n it as findAndActivateStoredWidgets,\n W as findCategoryById,\n nt as formatDate,\n E as formatUrl,\n F as getCategoryTrailAsObjects,\n st as getCookie,\n _ as hash,\n ft as htmlParentContains,\n at as kebabCase,\n ct as lock,\n ut as mergeDeep,\n lt as notifyDataLoaded,\n gt as removeNullAndUndefinedValues,\n mt as setCookie,\n dt as shallowCompare,\n ht as uuid\n};\n//# sourceMappingURL=index.js.map\n","// import { WidgetSettings } from '@telia-ace/knowledge-widget-core';\r\nimport { Container, Widget } from '@webprovisions/platform';\r\n\r\nexport const createServiceClient = (container: Container) => {\r\n return import('@telia-ace/knowledge-serviceclient').then(\r\n ({ ServiceClient, ServiceProxy }) => {\r\n return container.get('settings').then((settings: any) => {\r\n const { name, events }: Widget = container.get('$widget');\r\n const {\r\n data: { projection = '', site = 'current', forceHttps = false },\r\n } = settings;\r\n\r\n const proxy = new ServiceProxy(projection, {\r\n credentials: 'same-origin',\r\n });\r\n\r\n // Replacing '_contact' & '_contact-method' while\r\n // still using the shadow widget concept\r\n const client = new ServiceClient(\r\n proxy,\r\n {\r\n funnel: name.replace('_contact-method', '').replace('_contact', ''),\r\n site: createSiteProvider(site, forceHttps),\r\n },\r\n null,\r\n container\r\n );\r\n\r\n events.subscribe('widget:settings-updated', (_event, { data }: any) => {\r\n if (data && data.projection !== projection) {\r\n client.proxy.setBaseUrl(data.projection);\r\n }\r\n });\r\n\r\n return client;\r\n });\r\n }\r\n );\r\n};\r\n\r\ntype SiteLocation = {\r\n host: string;\r\n pathname: string;\r\n};\r\n\r\nconst createSiteProvider = (\r\n site: 'current' | 'referrer',\r\n forceHttps: boolean\r\n): (() => string) => {\r\n return () => {\r\n const parseLocation = (href: string): SiteLocation => {\r\n const link = document.createElement('a');\r\n link.href = href;\r\n return link;\r\n };\r\n\r\n let location: SiteLocation = window.location;\r\n if (site === 'referrer' && document.referrer) {\r\n location = parseLocation(document.referrer);\r\n }\r\n return [\r\n forceHttps ? 'https:' : '',\r\n '//',\r\n location.host,\r\n location.pathname,\r\n ].join('');\r\n };\r\n};\r\n","import {\r\n CategoryApiResponse,\r\n ContactApiResponse,\r\n ContactCategoriesApiResponse,\r\n ContactMethodApiResponse,\r\n GuideApiResponse,\r\n GuideCategoriesApiResponse,\r\n GuideMatchApiResponse,\r\n GuideViewApiResponse,\r\n NoticeApiResponse,\r\n NoticeListApiResponse,\r\n TagListApiResponse,\r\n ValidationApiResult,\r\n} from '@telia-ace/knowledge-serviceclient';\r\n// import { ContactMethodType as ContactMethod } from '@telia-ace/knowledge-widget-adapters';\r\n// import {\r\n// Category,\r\n// DialogItem,\r\n// DialogItemType,\r\n// Guide,\r\n// Notification,\r\n// NotificationList,\r\n// Symbol,\r\n// Tag,\r\n// } from '@telia-ace/widget-core';\r\n// import { FormBuilder } from '@telia-ace/widget-forms';\r\nimport { DataError, ServiceClientQueryType } from './data-client';\r\n\r\ntype Category = any;\r\ntype DialogItem = any;\r\ntype Guide = any;\r\ntype Notification = any;\r\ntype NotificationList = any;\r\ntype Symbol = any;\r\ntype Tag = any;\r\n\r\ntype ContactMethod = any;\r\n\r\nenum DialogItemType {\r\n guide = 'guide',\r\n link = 'link',\r\n default = 'default',\r\n}\r\n\r\nexport type MatchResult = {\r\n guides: Guide[];\r\n matches: number;\r\n topNotifications: Notification[];\r\n middleNotifications: Notification[];\r\n bottomNotifications: Notification[];\r\n notificationLists: NotificationList[];\r\n tags: Tag[];\r\n byCategory: { id: string; guides: Guide[]; matches: number }[];\r\n};\r\n\r\nexport type TagsResult = Tag[];\r\n\r\nexport type CategoriesResult = {\r\n categories: Category[];\r\n matches: number;\r\n};\r\n\r\nexport type NotificationResults = Pick<\r\n MatchResult,\r\n | 'topNotifications'\r\n | 'middleNotifications'\r\n | 'bottomNotifications'\r\n | 'notificationLists'\r\n>;\r\n\r\nexport type GuideResult = {\r\n guide: {\r\n id: string;\r\n title: string;\r\n body: string;\r\n modified: string;\r\n modifiedBy: string | null;\r\n publishedBy: string | null;\r\n published: string;\r\n connection: string;\r\n categories: number[];\r\n hasHandover: boolean;\r\n allowFeedback: boolean;\r\n seoMetaDescription: string | null;\r\n seoAllowIndex: boolean | null;\r\n perspective: string | null;\r\n perspectives: { [key: string]: string };\r\n translations?: { [key: string]: string };\r\n };\r\n related: Guide[];\r\n dialog: DialogItem[];\r\n contactMethods: ContactMethod[];\r\n tags: Tag[];\r\n error?: DataError;\r\n};\r\n\r\nexport type ContactsResult = {\r\n categories: Category[];\r\n contactMethods: ContactMethod[];\r\n topNotifications: Notification[];\r\n middleNotifications: Notification[];\r\n bottomNotifications: Notification[];\r\n notificationLists: NotificationList[];\r\n};\r\n\r\nexport type SubmissionResult = {\r\n contactMethod?: ContactMethod;\r\n valid: boolean;\r\n};\r\n\r\nconst convertLegacySymbol = (symbol?: {\r\n Type: string;\r\n Content: string;\r\n}): Symbol | undefined => {\r\n if (symbol) {\r\n const { Type, Content } = symbol;\r\n if (Type && Content) {\r\n return { type: Type, content: Content };\r\n }\r\n }\r\n};\r\n\r\nconst mapLegacyCategoriesRecursively = (\r\n categories: CategoryApiResponse[]\r\n): Category[] => {\r\n return categories.map((c) => {\r\n const category: Category = {\r\n id: c.Id.toString(),\r\n title: c.Name,\r\n symbol: convertLegacySymbol(c.DefaultIcon),\r\n activeSymbol: c.ActiveIcon && convertLegacySymbol(c.ActiveIcon),\r\n description:\r\n c.Description || (c.Attributes && c.Attributes.description) || '',\r\n matches: c.GuidesCount,\r\n };\r\n if (c.Children && c.Children.length) {\r\n category.items = mapLegacyCategoriesRecursively(c.Children);\r\n }\r\n return category;\r\n });\r\n};\r\n\r\nconst mapNotices = (\r\n source: NoticeApiResponse[],\r\n type: string\r\n): Notification[] => {\r\n return source\r\n .filter(({ Type }) => Type === type)\r\n .map(({ Id, Title, Body }) => ({\r\n id: Id.toString(),\r\n title: Title,\r\n body: Body,\r\n }));\r\n};\r\n\r\nconst mapNotificationLists = (\r\n source: NoticeListApiResponse[]\r\n): NotificationList[] => {\r\n return source.map(({ Id, Title, DefaultIcon, ListNotices, Notices }) => ({\r\n id: Id.toString(),\r\n title: Title,\r\n symbol: convertLegacySymbol(DefaultIcon),\r\n defaultHeaderOptions: {\r\n visible: !!ListNotices.length,\r\n },\r\n notifications: (ListNotices || [])\r\n .concat(Notices || [])\r\n .map(({ Id, Title, Body, Type, Modified }) => ({\r\n id: Id.toString(),\r\n title: Title,\r\n body: Body,\r\n modified: Modified,\r\n expandable: Type === 'listNotice',\r\n })),\r\n }));\r\n};\r\n\r\nconst mapContactMethodSettings = (\r\n {\r\n Id,\r\n Title,\r\n DefaultIcon,\r\n Exits: [Exit],\r\n ExitType,\r\n ConfirmationText,\r\n Description,\r\n }: ContactApiResponse,\r\n _Validation?: ValidationApiResult\r\n): ContactMethod => {\r\n const { Adapter } = Exit || { Adapter: {} };\r\n const { ClientName = '', Settings = {}, CustomClientName = '' } = Adapter;\r\n\r\n const settings: ContactMethod = {\r\n id: Id.toString(),\r\n title: Title,\r\n description: Description,\r\n symbol: convertLegacySymbol(DefaultIcon),\r\n clientName: ClientName === 'custom.adapter' ? CustomClientName : ClientName,\r\n expanded: true,\r\n inline: true,\r\n body: {},\r\n };\r\n\r\n if (ClientName.indexOf('phone') > -1 || ClientName.indexOf('freetext') > -1) {\r\n const { displayTextBeforeClick, textBeforeClick } = Settings;\r\n if (displayTextBeforeClick === 'true') {\r\n settings.expanded = false;\r\n settings.title = textBeforeClick;\r\n }\r\n\r\n if (ClientName.indexOf('phone.text') > -1) {\r\n settings.body.phoneNumber = Settings.phoneNumber;\r\n } else {\r\n settings.body.freetext = Settings.freetext;\r\n }\r\n }\r\n\r\n if (\r\n ClientName.indexOf('chat.popup') > -1 ||\r\n ClientName.indexOf('link') > -1 ||\r\n (ClientName === 'custom.adapter' && ExitType === 'custom')\r\n ) {\r\n settings.body = Settings;\r\n settings.body.confirmationFallback = ConfirmationText;\r\n }\r\n\r\n if (ClientName.indexOf('ace') > -1) {\r\n settings.body = Settings;\r\n }\r\n\r\n // if (Form && Form.HasValueComponents) { // TODO:\r\n // if (Validation) {\r\n // settings.body.form = FormBuilder.fromLegacyForm(\r\n // Id.toString(),\r\n // Form,\r\n // Validation\r\n // ).get();\r\n // } else {\r\n // settings.body.form = FormBuilder.fromLegacyForm(\r\n // Id.toString(),\r\n // Form\r\n // ).get();\r\n // }\r\n // if (!ExpandFormAutomatically) {\r\n // settings.expanded = settings.inline = false;\r\n // }\r\n // }\r\n\r\n return settings;\r\n};\r\n\r\ntype Modify<T, R> = Omit<T, keyof R> & R;\r\ntype ExtendedGuideMatchApiResponse = Modify<\r\n GuideMatchApiResponse,\r\n {\r\n ByCategory: {\r\n Id: string;\r\n Matches: GuideApiResponse[];\r\n TotalMatches: number;\r\n }[];\r\n }\r\n>;\r\n\r\nconst mapTags = (tags: TagListApiResponse[] = []): Tag[] => {\r\n return tags.map(\r\n ({ Id, Title, TotalMatches, Symbol, DefaultIcon, ActiveIcon }) => ({\r\n id: Id.toString(),\r\n title: Title,\r\n matches: TotalMatches,\r\n symbol: convertLegacySymbol(DefaultIcon || Symbol),\r\n defaultIcon: convertLegacySymbol(DefaultIcon),\r\n activeIcon: convertLegacySymbol(ActiveIcon),\r\n })\r\n );\r\n};\r\n\r\nconst mapGuides = (guides: GuideApiResponse[]) => {\r\n return guides.map(({ Id, Title, Tags, FirstPublishedDate, Modified }) => ({\r\n id: Id.toString(),\r\n title: Title,\r\n tags: mapTags(Tags),\r\n published: FirstPublishedDate,\r\n modified: Modified,\r\n }));\r\n};\r\n\r\nexport const formatLegacyData = (type: ServiceClientQueryType, data: any) => {\r\n switch (type) {\r\n case ServiceClientQueryType.MatchByCategory:\r\n case ServiceClientQueryType.Match: {\r\n const result: MatchResult = {\r\n guides: [],\r\n matches: 0,\r\n topNotifications: [],\r\n middleNotifications: [],\r\n bottomNotifications: [],\r\n notificationLists: [],\r\n tags: [],\r\n byCategory: [],\r\n };\r\n const {\r\n Matches,\r\n TotalMatches,\r\n Notices,\r\n NoticeLists,\r\n Tags,\r\n ByCategory,\r\n }: ExtendedGuideMatchApiResponse = data;\r\n\r\n result.guides = mapGuides(Matches);\r\n\r\n result.matches = TotalMatches;\r\n\r\n result.byCategory = (ByCategory || []).map(\r\n ({ Id, Matches, TotalMatches }) => ({\r\n id: Id,\r\n guides: mapGuides(Matches),\r\n matches: TotalMatches,\r\n })\r\n );\r\n\r\n result.tags = mapTags(Tags);\r\n\r\n result.notificationLists = mapNotificationLists(NoticeLists || []);\r\n\r\n result.topNotifications = mapNotices(Notices || [], 'noticeRowTop');\r\n\r\n result.middleNotifications = mapNotices(Notices || [], 'noticeRowMiddle');\r\n\r\n result.bottomNotifications = mapNotices(Notices || [], 'footerNotice');\r\n\r\n return result;\r\n }\r\n case ServiceClientQueryType.Categories: {\r\n const { Children, GuidesCountTotal }: GuideCategoriesApiResponse = data;\r\n\r\n const result: CategoriesResult = {\r\n categories: mapLegacyCategoriesRecursively(Children || []),\r\n matches: GuidesCountTotal,\r\n };\r\n\r\n return result;\r\n }\r\n case ServiceClientQueryType.Guide: {\r\n const {\r\n Id,\r\n Title,\r\n Body,\r\n Related,\r\n Options,\r\n ConnectionId,\r\n ContactMethods,\r\n EnableFeedback,\r\n HandoverExists,\r\n FirstPublishedDate,\r\n Modified,\r\n ModifiedByDisplayName,\r\n FirstPublishedByDisplayName,\r\n Categories,\r\n Tags,\r\n SeoMetaDescription,\r\n SeoAllowIndex,\r\n Perspectives,\r\n PerspectiveKey,\r\n Translations,\r\n }: GuideViewApiResponse = data;\r\n\r\n /* \r\n PerspectiveKey is always null when on the \"top level\" of a dialog tree\r\n OR when navigating down a dialog tree in the \"Default answer version\"\r\n Note: The \"Default answer version\" is not the same as a given guides\r\n default answer version. The \"Default answer version\" is always the answer\r\n version in Perspectives with the key \"Default\".\r\n */\r\n const perspective =\r\n PerspectiveKey ||\r\n Object.values(Perspectives).find(\r\n (connection) => connection === ConnectionId\r\n ) ||\r\n Perspectives['Default'] ||\r\n null;\r\n\r\n const result: GuideResult = {\r\n guide: {\r\n id: Id.toString(),\r\n title: Title,\r\n body: Body,\r\n modified: Modified,\r\n published: FirstPublishedDate,\r\n modifiedBy: ModifiedByDisplayName,\r\n publishedBy: FirstPublishedByDisplayName,\r\n connection: ConnectionId,\r\n categories: Categories,\r\n hasHandover: HandoverExists,\r\n allowFeedback: EnableFeedback,\r\n seoMetaDescription: SeoMetaDescription,\r\n seoAllowIndex: SeoAllowIndex,\r\n perspectives: Perspectives,\r\n perspective,\r\n translations: Object.keys(Translations || {}).reduce<{\r\n [key: string]: string;\r\n }>((acc, key) => {\r\n acc[key] = Translations[key].toString();\r\n return acc;\r\n }, {}),\r\n },\r\n related: mapGuides(Related || []),\r\n dialog: [],\r\n contactMethods: (ContactMethods || []).map((cm) =>\r\n mapContactMethodSettings(cm)\r\n ),\r\n tags: mapTags(Tags),\r\n };\r\n\r\n (Options || []).forEach(\r\n ({ CanAccess, Description, ConnectionId, Properties }) => {\r\n if (!CanAccess) {\r\n return;\r\n }\r\n\r\n const item: DialogItem = {\r\n id: Id.toString(),\r\n title: Description,\r\n connection: ConnectionId,\r\n connectionKey: (Properties as any).ConnectionKey,\r\n type: DialogItemType.default,\r\n parent: {\r\n id: Id.toString(),\r\n title: Title,\r\n tags: mapTags(Tags),\r\n },\r\n };\r\n\r\n if (Properties.Type === 'Guide' || Properties.Type === 'Link') {\r\n Properties.Id && (item.id = Properties.Id.toString());\r\n Properties.Uri && (item.href = Properties.Uri);\r\n Properties.Target && (item.target = Properties.Target);\r\n switch (Properties.Type) {\r\n case 'Guide':\r\n item.type = DialogItemType.guide;\r\n break;\r\n case 'Link':\r\n item.type = DialogItemType.link;\r\n break;\r\n }\r\n }\r\n\r\n result.dialog.push(item);\r\n }\r\n );\r\n\r\n return result;\r\n }\r\n case ServiceClientQueryType.Contacts: {\r\n const {\r\n Children,\r\n Matches,\r\n Notices,\r\n NoticeLists,\r\n }: ContactCategoriesApiResponse = data;\r\n\r\n const result: ContactsResult = {\r\n contactMethods: (Matches || []).map((cm) =>\r\n mapContactMethodSettings(cm)\r\n ),\r\n categories: mapLegacyCategoriesRecursively(Children || []),\r\n topNotifications: mapNotices(Notices || [], 'noticeRowTop'),\r\n middleNotifications: mapNotices(Notices || [], 'noticeRowMiddle'),\r\n bottomNotifications: mapNotices(Notices || [], 'footerNotice'),\r\n notificationLists: mapNotificationLists(NoticeLists || []),\r\n };\r\n\r\n return result;\r\n }\r\n case ServiceClientQueryType.ContactMethod: {\r\n const { ContactMethod }: ContactMethodApiResponse = data;\r\n\r\n return mapContactMethodSettings(ContactMethod || {});\r\n }\r\n case ServiceClientQueryType.Tags:\r\n case ServiceClientQueryType.TagsOnGuides: {\r\n return mapTags(data || []);\r\n }\r\n case ServiceClientQueryType.Notifications: {\r\n const { Notices, NoticeLists } = data;\r\n\r\n return {\r\n topNotifications: mapNotices(Notices || [], 'noticeRowTop'),\r\n middleNotifications: mapNotices(Notices || [], 'noticeRowMiddle'),\r\n bottomNotifications: mapNotices(Notices || [], 'footerNotice'),\r\n notificationLists: mapNotificationLists(NoticeLists || []),\r\n };\r\n }\r\n default:\r\n return {};\r\n }\r\n};\r\n","import { ServiceClient } from '@telia-ace/knowledge-serviceclient';\r\nimport { WidgetRenderState } from '@telia-ace/widget-core-flamingo';\r\nimport {\r\n deepClone,\r\n lock,\r\n removeNullAndUndefinedValues,\r\n shallowCompare,\r\n} from '@telia-ace/widget-utilities';\r\nimport { Container, EventManager, Widget } from '@webprovisions/platform';\r\nimport { createServiceClient } from './create-serviceclient';\r\nimport { formatLegacyData } from './legacy-conversion';\r\n\r\nexport type Subscriber = (...args: any[]) => void;\r\n\r\nexport enum DataType {\r\n Guide = 'guide',\r\n Guides = 'guides',\r\n GuidesByCategory = 'guides-by-category',\r\n RowNotifications = 'row-notices',\r\n NotificationLists = 'notification-lists',\r\n GuideCategories = 'guide-categories',\r\n ContactMethodCategories = 'contact-method-categories',\r\n ContactMethod = 'contact-method',\r\n ContactMethods = 'contact-methods',\r\n Tags = 'tags',\r\n TagsOnGuides = 'tagsonguides',\r\n}\r\n\r\nexport type DataError = {\r\n status: number;\r\n message: string;\r\n};\r\n\r\nexport enum ServiceClientQueryType {\r\n Match = 'match',\r\n Categories = 'categories',\r\n Guide = 'guide',\r\n Contacts = 'contacts',\r\n ContactMethod = 'contact-method',\r\n MatchByCategory = 'match-by-category',\r\n Tags = 'tags',\r\n TagsOnGuides = 'tagsonguides',\r\n Notifications = 'notifications',\r\n}\r\n\r\nexport enum FeedbackType {\r\n Positive = 'Positive',\r\n Negative = 'Negative',\r\n}\r\n\r\nexport type QueryParameters = {\r\n guideId?: string | number;\r\n categories?: string | number | string[] | number[];\r\n tagId?: string | number;\r\n connection?: string;\r\n\r\n contactMethodCategoryId?: string | number;\r\n contactMethodId?: string | number;\r\n\r\n searchPhrase?: string | number;\r\n take?: string | number;\r\n [key: string]: any;\r\n\r\n expandCategories?: 'none' | 'children' | 'descendants';\r\n sorting?: SortingType;\r\n guideIds?: string[];\r\n};\r\n\r\nexport enum SortingType {\r\n POPULARITY_DESCENDING = 'popularity-descending',\r\n ALPHABETIC_ASCENDING = 'alphabetic-ascending',\r\n ALPHABETIC_DESCENDING = 'alphabetic-descending',\r\n MODIFIED_ASCENDING = 'modified-ascending',\r\n MODIFIED_DESCENDING = 'modified-descending',\r\n PUBLISHED_ASCENDING = 'published-ascending',\r\n PUBLISHED_DESCENDING = 'published-descending',\r\n}\r\n\r\nexport type Query = {\r\n params: QueryParameters;\r\n resolved: boolean;\r\n loading: boolean;\r\n error?: DataError;\r\n data: any;\r\n resolvers: {\r\n resolve: (data: any) => void;\r\n reject: (data: any) => void;\r\n }[];\r\n};\r\n\r\nexport const determineServiceClientQueryType = (\r\n type: DataType\r\n): ServiceClientQueryType => {\r\n switch (type) {\r\n case DataType.Guides:\r\n return ServiceClientQueryType.Match;\r\n case DataType.GuidesByCategory:\r\n return ServiceClientQueryType.MatchByCategory;\r\n case DataType.Guide:\r\n return ServiceClientQueryType.Guide;\r\n case DataType.GuideCategories:\r\n return ServiceClientQueryType.Categories;\r\n case DataType.ContactMethodCategories:\r\n case DataType.ContactMethods:\r\n return ServiceClientQueryType.Contacts;\r\n case DataType.ContactMethod:\r\n return ServiceClientQueryType.ContactMethod;\r\n case DataType.Tags:\r\n return ServiceClientQueryType.Tags;\r\n case DataType.TagsOnGuides:\r\n return ServiceClientQueryType.TagsOnGuides;\r\n case DataType.NotificationLists:\r\n case DataType.RowNotifications:\r\n return ServiceClientQueryType.Notifications;\r\n default:\r\n throw 'error';\r\n }\r\n};\r\n\r\nconst widgetIsHidden = async (container: Container) => {\r\n const { invoke } = container.get('$widget');\r\n const renderState = await invoke('renderState');\r\n return renderState === WidgetRenderState.hidden;\r\n};\r\n\r\nexport default class DataClient {\r\n private queries: Map<ServiceClientQueryType, Query[]> = new Map();\r\n // private lastTake: number = 0;\r\n public events: EventManager;\r\n constructor(\r\n private container: Container,\r\n private matchingClient: ServiceClient\r\n ) {\r\n this.events = (<Widget>container.get('$widget')).events;\r\n\r\n this.events.subscribe(\r\n 'widget:settings-updated',\r\n () => (this.queries = new Map())\r\n );\r\n\r\n this.events.subscribe(\r\n 'widget:render-state-changed',\r\n (_event, { next, previous }) => {\r\n if (\r\n previous === WidgetRenderState.hidden &&\r\n next === WidgetRenderState.open\r\n ) {\r\n this.fetchAllUnresolvedQueries();\r\n }\r\n }\r\n );\r\n }\r\n\r\n static getInstance(\r\n container: Container,\r\n key = 'dataClient'\r\n ): Promise<DataClient> {\r\n return lock(this)(() => {\r\n return container.getAsync(key).then(async (value: DataClient) => {\r\n let serviceClient = await container.getAsync('matchingClient');\r\n\r\n if (!serviceClient) {\r\n serviceClient = await createServiceClient(container);\r\n container.registerAsync('matchingClient', () => serviceClient);\r\n }\r\n\r\n let platform = value;\r\n if (!platform) {\r\n platform = new DataClient(container, serviceClient);\r\n container.registerAsync(key, () => platform);\r\n }\r\n return platform;\r\n });\r\n });\r\n }\r\n\r\n private getUnresolvedQueries = () => {\r\n let unresolvedCount = 0;\r\n this.queries.forEach((queries, _type) => {\r\n const hasUnresolved = queries.some((query: Query) => !query.resolved);\r\n if (hasUnresolved) {\r\n unresolvedCount = +1;\r\n }\r\n });\r\n return unresolvedCount;\r\n };\r\n\r\n public fetch(\r\n type: DataType,\r\n params: QueryParameters,\r\n options?: {\r\n // this is useful when something else in the environment may have changed that\r\n // could have side effects, will ensure that a fresh fetch is always initiated\r\n noCache: boolean;\r\n }\r\n ): Promise<any> {\r\n return new Promise((resolve, reject) => {\r\n if (params.take) {\r\n // this.lastTake = +(params.take || 0);\r\n }\r\n\r\n removeNullAndUndefinedValues(params);\r\n const serviceClientQueryType = determineServiceClientQueryType(type);\r\n let queries = this.queries.get(serviceClientQueryType) || [];\r\n\r\n let query: Query | null =\r\n queries.find((q) => shallowCompare(q.params, params)) || null;\r\n\r\n if (query && options?.noCache) {\r\n const index = queries.findIndex((q) =>\r\n shallowCompare(q.params, params)\r\n );\r\n queries = [...queries.slice(0, index), ...queries.slice(index + 1)];\r\n query = null;\r\n }\r\n\r\n if (query) {\r\n const index = queries.indexOf(query);\r\n if (query.resolved) {\r\n this.events.dispatch('data-client:fetched', {\r\n params,\r\n type: serviceClientQueryType,\r\n response: query.data,\r\n unresolvedQueries: this.getUnresolvedQueries(),\r\n });\r\n this.track(query.data, serviceClientQueryType, query.error);\r\n if (query.data && query.error) {\r\n reject({ error: query.error });\r\n } else {\r\n resolve(query.data);\r\n }\r\n } else {\r\n query.resolvers.push({ resolve, reject });\r\n }\r\n queries.splice(index, 1);\r\n queries.push(query);\r\n this.queries.set(serviceClientQueryType, queries);\r\n if (!query.loading && !query.resolved) {\r\n return this.runQuery(serviceClientQueryType, params);\r\n }\r\n } else {\r\n queries.push({\r\n params,\r\n resolved: false,\r\n loading: true,\r\n data: {},\r\n resolvers: [{ resolve, reject }],\r\n });\r\n this.queries.set(serviceClientQueryType, queries);\r\n\r\n return this.runQuery(serviceClientQueryType, params);\r\n }\r\n }).then((res) => deepClone(res));\r\n }\r\n\r\n // query the cached data\r\n public read(\r\n type: DataType,\r\n options: {\r\n select?: (data: any) => any; // either return all data by the DataType, or use an selector\r\n }\r\n ) {\r\n const { select } = options;\r\n const serviceClientQueryType = determineServiceClientQueryType(type);\r\n const queries = this.queries.get(serviceClientQueryType) || [];\r\n\r\n const result = queries.reduce<any[]>((acc, query) => {\r\n if (typeof select === 'function') {\r\n const match = select(query.data);\r\n if (match) {\r\n acc.push(match);\r\n }\r\n } else {\r\n acc.push(query.data);\r\n }\r\n return acc;\r\n }, []);\r\n return result;\r\n }\r\n\r\n public feedback(\r\n id: string,\r\n connection: string,\r\n feedback: FeedbackType\r\n ): Promise<any> {\r\n return this.matchingClient.giveFeedback(id, connection, feedback);\r\n }\r\n\r\n private setLoadingStatus(\r\n type: ServiceClientQueryType,\r\n params: QueryParameters,\r\n loading: boolean\r\n ) {\r\n const queries = this.queries.get(type) || [];\r\n const query = queries.find((q) => shallowCompare(q.params, params));\r\n\r\n if (query) {\r\n query.loading = loading;\r\n }\r\n this.queries.set(type, queries);\r\n }\r\n\r\n private async runQuery(\r\n type: ServiceClientQueryType,\r\n params: QueryParameters\r\n ) {\r\n const {\r\n searchPhrase = '',\r\n categories = '0',\r\n contactMethodCategoryId = '0',\r\n contactMethodId = '0',\r\n tagId = undefined,\r\n take = 5,\r\n connection = '',\r\n guideId,\r\n expandCategories = 'descendants',\r\n currentCategory,\r\n sorting = SortingType.POPULARITY_DESCENDING,\r\n guideIds = [],\r\n } = params;\r\n\r\n const trimmedPhrase = searchPhrase.toString().trim();\r\n if (await widgetIsHidden(this.container)) {\r\n return Promise.resolve();\r\n }\r\n\r\n switch (type) {\r\n case ServiceClientQueryType.Match: {\r\n const formatSortingValues = (sorting: string) => {\r\n const [type, direction] = sorting.split('-');\r\n const sortKeysMap = new Map([\r\n ['popularity', 'popularity'],\r\n ['alphabetic', 'title'],\r\n ['modified', 'lastModified'],\r\n ['published', 'firstPublished'],\r\n ]);\r\n\r\n return {\r\n type: sortKeysMap.get(type),\r\n direction: direction,\r\n };\r\n };\r\n\r\n if (guideIds.length) {\r\n return this.matchingClient\r\n .customRequest('guides', 'POST', {\r\n configuration: { ids: guideIds, take: +take },\r\n })\r\n .then(\r\n (matches) => matches && this.handleResponse(matches, type, params)\r\n );\r\n }\r\n\r\n return this.matchingClient\r\n .match(trimmedPhrase, {\r\n categories:\r\n categories === '0'\r\n ? []\r\n : Array.isArray(categories)\r\n ? categories\r\n : [+categories],\r\n take: +take,\r\n tags: tagId,\r\n sorting: formatSortingValues(sorting),\r\n ids: guideIds,\r\n })\r\n .then(\r\n (matches) => matches && this.handleResponse(matches, type, params)\r\n );\r\n }\r\n case ServiceClientQueryType.MatchByCategory: {\r\n return this.matchingClient\r\n .match(trimmedPhrase, {\r\n groupByCategory: true,\r\n categories:\r\n categories === '0'\r\n ? []\r\n : Array.isArray(categories)\r\n ? categories\r\n : [+categories],\r\n take: +take,\r\n tags: tagId,\r\n })\r\n .then(\r\n (matches) => matches && this.handleResponse(matches, type, params)\r\n );\r\n }\r\n case ServiceClientQueryType.Guide: {\r\n return this.matchingClient\r\n .getGuide(guideId, { connectionId: connection })\r\n .then((guide) => {\r\n if (guide) {\r\n this.handleResponse(guide, type, params);\r\n }\r\n })\r\n .catch((e) => {\r\n const error = {\r\n message: 'Something went wrong.',\r\n status: e.status || 400,\r\n };\r\n if (error.status === 404) {\r\n error.message = 'The guide could not be found.';\r\n }\r\n this.handleResponse({}, type, params, error);\r\n });\r\n }\r\n case ServiceClientQueryType.Categories: {\r\n return this.matchingClient\r\n .getCategories({\r\n phrase: trimmedPhrase,\r\n expand: expandCategories,\r\n tags: tagId,\r\n })\r\n .then(\r\n (categories) =>\r\n categories && this.handleResponse(categories, type, params)\r\n );\r\n }\r\n case ServiceClientQueryType.Contacts: {\r\n if (guideId) {\r\n return this.matchingClient\r\n .contactMethods(+guideId, { phrase: trimmedPhrase })\r\n .then(\r\n (result) => result && this.handleResponse(result, type, params)\r\n );\r\n }\r\n return this.matchingClient\r\n .contacts(+contactMethodCategoryId, { phrase: trimmedPhrase })\r\n .then(\r\n (result) => result && this.handleResponse(result, type, params)\r\n );\r\n }\r\n case ServiceClientQueryType.ContactMethod: {\r\n return this.matchingClient\r\n .getContactMethod(+contactMethodId, { guideId, currentCategory })\r\n .then(\r\n (result) => result && this.handleResponse(result, type, params)\r\n );\r\n }\r\n case ServiceClientQueryType.Tags: {\r\n return this.matchingClient\r\n .customRequest('tags', 'GET', {\r\n configuration: {\r\n take: 999999,\r\n phrase: trimmedPhrase,\r\n categories:\r\n categories === '0'\r\n ? []\r\n : Array.isArray(categories)\r\n ? categories\r\n : [+categories],\r\n },\r\n })\r\n .then(\r\n (result) => result && this.handleResponse(result, type, params)\r\n );\r\n }\r\n case ServiceClientQueryType.TagsOnGuides: {\r\n return this.matchingClient\r\n .customRequest('tagsonguides', 'GET', {\r\n configuration: {\r\n take: 999999,\r\n phrase: trimmedPhrase,\r\n categories:\r\n categories === '0'\r\n ? []\r\n : Array.isArray(categories)\r\n ? categories\r\n : [+categories],\r\n tags: tagId,\r\n },\r\n })\r\n .then(\r\n (result) => result && this.handleResponse(result, type, params)\r\n );\r\n }\r\n case ServiceClientQueryType.Notifications: {\r\n return this.matchingClient\r\n .customRequest('notices', 'GET', {\r\n configuration: {\r\n phrase: trimmedPhrase,\r\n categories:\r\n categories === '0'\r\n ? []\r\n : Array.isArray(categories)\r\n ? categories\r\n : [+categories],\r\n },\r\n })\r\n .then(\r\n (result) => result && this.handleResponse(result, type, params)\r\n );\r\n }\r\n }\r\n }\r\n\r\n handleResponse(\r\n data: any = {},\r\n type: ServiceClientQueryType,\r\n params: QueryParameters,\r\n error?: DataError\r\n ) {\r\n const queries = this.queries.get(type) || [];\r\n const existing = queries.find((q) => shallowCompare(q.params, params));\r\n if (existing) {\r\n const formatted = error ? error : formatLegacyData(type, data);\r\n this.track(formatted, type, error);\r\n existing.resolvers.forEach((r) => {\r\n if (error) {\r\n r.reject({ error: formatted });\r\n } else {\r\n r.resolve(formatted);\r\n }\r\n });\r\n\r\n const index = queries.indexOf(existing);\r\n if (index > -1) {\r\n queries.splice(index, 1);\r\n }\r\n queries.push({\r\n ...existing,\r\n error,\r\n resolvers: [],\r\n data: formatted,\r\n resolved: true,\r\n });\r\n this.setLoadingStatus(type, params, false);\r\n this.queries.set(type, queries);\r\n if (!error) {\r\n this.events.dispatch('data-client:fetched', {\r\n type,\r\n params,\r\n response: formatted,\r\n unresolvedQueries: this.getUnresolvedQueries(),\r\n });\r\n }\r\n }\r\n }\r\n\r\n private fetchAllUnresolvedQueries() {\r\n for (const [queryType, queries] of this.queries) {\r\n queries\r\n .filter((query: Query) => !query.resolved)\r\n .forEach((query) => {\r\n this.runQuery(queryType, query.params);\r\n });\r\n }\r\n }\r\n\r\n private track(\r\n data: any = {},\r\n type: ServiceClientQueryType,\r\n error?: DataError\r\n ) {\r\n const widget = this.container.get('$widget');\r\n if (widget && !error) {\r\n widget.events.dispatch('tracking:service-client-response', {\r\n type,\r\n data,\r\n });\r\n } else if (widget) {\r\n widget.events.dispatch('tracking:service-client-error', {\r\n type,\r\n error,\r\n });\r\n }\r\n }\r\n\r\n static create(container: Container): Promise<DataClient> {\r\n return container.getAsync('matchingClient').then(async (matchingClient) => {\r\n if (matchingClient) {\r\n return new DataClient(container, matchingClient);\r\n }\r\n\r\n const client = await createServiceClient(container);\r\n container.registerAsync('matchingClient', () => client);\r\n\r\n return new DataClient(container, client);\r\n });\r\n }\r\n\r\n getClient() {\r\n return this.matchingClient;\r\n }\r\n}\r\n","import { Container } from '@webprovisions/platform';\r\nimport DataClient from './data-client';\r\n\r\nexport const KnowledgeDataClientPlugin = async (container: Container) => {\r\n container.registerAsync('dataClient', () => {\r\n return DataClient.create(container);\r\n });\r\n};\r\n"],"names":["j","t","e","$t","D","E","Yt","r","o","c","ut","Ut","s","i","u","Ct","h","a","l","p","d","H","g","S","$","fe","vt","_t","qe","C","y","Z","n","b","ct","gt","dt","createServiceClient","container","ServiceClient","ServiceProxy","settings","name","events","projection","site","forceHttps","proxy","client","createSiteProvider","_event","data","parseLocation","href","link","location","convertLegacySymbol","symbol","Type","Content","mapLegacyCategoriesRecursively","categories","category","mapNotices","source","type","Id","Title","Body","mapNotificationLists","DefaultIcon","ListNotices","Notices","Modified","mapContactMethodSettings","Exit","ExitType","ConfirmationText","Description","_Validation","Adapter","ClientName","Settings","CustomClientName","displayTextBeforeClick","textBeforeClick","mapTags","tags","TotalMatches","Symbol","ActiveIcon","mapGuides","guides","Tags","FirstPublishedDate","formatLegacyData","ServiceClientQueryType","result","Matches","NoticeLists","ByCategory","Children","GuidesCountTotal","Related","Options","ConnectionId","ContactMethods","EnableFeedback","HandoverExists","ModifiedByDisplayName","FirstPublishedByDisplayName","Categories","SeoMetaDescription","SeoAllowIndex","Perspectives","PerspectiveKey","Translations","perspective","connection","acc","key","cm","CanAccess","Properties","item","ContactMethod","DataType","FeedbackType","SortingType","determineServiceClientQueryType","widgetIsHidden","__async","invoke","WidgetRenderState","DataClient","matchingClient","unresolvedCount","queries","_type","query","next","previous","lock","value","serviceClient","platform","params","options","resolve","reject","removeNullAndUndefinedValues","serviceClientQueryType","q","shallowCompare","index","res","deepClone","select","match","id","feedback","loading","searchPhrase","contactMethodCategoryId","contactMethodId","tagId","take","guideId","expandCategories","currentCategory","sorting","guideIds","trimmedPhrase","formatSortingValues","direction","matches","guide","error","existing","formatted","__spreadProps","__spreadValues","queryType","widget","KnowledgeDataClientPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BK,MAACA,IAAI,CAAC,GAAGC,GAAGC,MAAM,MAAM;AAC3B,QAAM,IAAI,IAAI,EAAE,IAAI,cAAc,EAAE,QAAQ,eAAe,KAAKA,CAAC;AACjE,UAAQD,GAAC;AAAA,IACP,KAAK;AACH,cAAQ,KAAK,GAAG,GAAG,CAAC;AACpB;AAAA,IACF,KAAK;AACH,cAAQ,KAAK,GAAG,GAAG,CAAC;AACpB;AAAA,IACF,KAAK;AACH,cAAQ,MAAM,GAAG,GAAG,CAAC;AACrB;AAAA,EACH;AACH,GAAGE,KAAK,CAAC,MAAM;AACb,QAAMF,IAAI,EAAE,aAAa;AACzB,SAAO;AAAA,IACL,MAAM,CAACC,MAAM,MAAMF,EAAEC,GAAG,QAAQC,GAAG,GAAG,CAAC;AAAA,IACvC,MAAM,CAACA,MAAM,MAAMF,EAAEC,GAAG,WAAWC,GAAG,GAAG,CAAC;AAAA,IAC1C,OAAO,CAACA,MAAM,MAAMF,EAAEC,GAAG,SAASC,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