{"version":3,"sources":["node_modules/highlight.js/lib/core.js","libs/conversation/inbox/src/inbox-ai/inbox-ai-button/inbox-ai-button.component.ts","libs/conversation/inbox/src/inbox-ai/inbox-ai-button/inbox-ai-button.component.html","libs/conversation/inbox/src/inbox-ai/inbox-ai-overlay/inbox-ai-overlay.component.ts","libs/conversation/inbox/src/inbox-ai/inbox-ai-overlay/inbox-ai-overlay.component.html","libs/conversation/inbox/src/inbox-alert-banner/inbox-alert-banner.component.ts","libs/conversation/inbox/src/inbox-alert-banner/inbox-alert-banner.component.html","libs/conversation/inbox/src/inbox-button/inbox-button.component.ts","libs/conversation/inbox/src/inbox-button/inbox-button.component.html","libs/conversation/inbox/src/inbox-container/inbox-container.component.ts","libs/conversation/inbox/src/inbox-container/inbox-container.component.html","libs/conversation/inbox/src/inbox/inbox.component.ts","libs/conversation/inbox/src/inbox/inbox.component.html","libs/conversation/ui/src/pages/inbox-chat/components/inbox-info-pane/conversation-details/conversation-details.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-info-pane/conversation-details/conversation-details.component.html","libs/conversation/inbox/src/wrappers/types.ts","libs/conversation/inbox/src/wrappers/chat.component.ts","libs/conversation/inbox/src/wrappers/chat.component.html","libs/conversation/inbox/src/wrappers/create-contact.component.ts","libs/conversation/inbox/src/wrappers/new-message.component.ts","libs/conversation/inbox/src/inbox-preview/inbox-preview.component.ts","libs/conversation/inbox/src/inbox-preview/inbox-preview.component.html","libs/conversation/inbox/src/settings/email-configuration/email-forwarding-info/email-forwarding-info.component.ts","libs/conversation/inbox/src/settings/email-configuration/email-forwarding-info/email-forwarding-info.component.html","libs/conversation/inbox/src/settings/email-configuration/email-settings-card.component.ts","libs/conversation/inbox/src/settings/email-configuration/email-settings-card.component.html","libs/conversation/inbox/src/settings/facebook-messenger/facebook-messenger.service.ts","libs/conversation/core/src/lib/mobile.ts","node_modules/@capacitor/browser/dist/esm/index.js","libs/conversation/inbox/src/settings/manage-on-web/manage-on-web.component.ts","libs/conversation/inbox/src/settings/manage-on-web/manage-on-web.component.html","libs/conversation/inbox/src/settings/facebook-messenger/facebook-messenger.component.ts","libs/conversation/inbox/src/settings/facebook-messenger/facebook-messenger.component.html","libs/conversation/inbox/src/settings/google-business-communication-card/google-business-connections.service.ts","libs/conversation/inbox/src/settings/google-business-communication-card/google-business-communication-card.component.ts","libs/conversation/inbox/src/settings/google-business-communication-card/google-business-communication-card.component.html","node_modules/@vendasta/instagram/fesm2020/vendasta-instagram.mjs","libs/conversation/inbox/src/settings/instagram-messages/instagram-messages.service.ts","libs/conversation/inbox/src/settings/instagram-messages/instagram-messages.component.ts","libs/conversation/inbox/src/settings/instagram-messages/instagram-messages.component.html","libs/conversation/inbox/src/settings/webchat-configuration/webchat-learn-more/webchat-learn-more.component.ts","libs/conversation/inbox/src/settings/webchat-configuration/webchat-learn-more/webchat-learn-more.component.html","libs/conversation/inbox/src/settings/webchat-configuration/webchat-config-card/webchat-config-card.component.ts","libs/conversation/inbox/src/settings/webchat-configuration/webchat-config-card/webchat-config-card.component.html","libs/conversation/inbox/src/settings/settings.component.ts","libs/conversation/inbox/src/settings/settings.component.html","libs/conversation/ui/src/guards/settings-access.guard.ts","libs/conversation/inbox/src/components/sticky-footer/sticky-footer.component.ts","libs/conversation/inbox/src/components/sticky-footer/sticky-footer.component.html","libs/conversation/inbox/src/settings/webchat-configuration/constants.ts","node_modules/@vendasta/embeddings/fesm2020/vendasta-embeddings.mjs","libs/ai-knowledge/src/lib/tokens.ts","libs/ai-knowledge/src/lib/ai-knowledge.service.ts","libs/ai-knowledge/src/lib/assets/i18n/en_devel.json","libs/ai-knowledge/src/lib/assets/i18n/ai-knowledge-i18n.module.ts","libs/ai-knowledge/src/lib/apps-for-knowledge-source/apps-for-knowledge-source.component.ts","libs/ai-knowledge/src/lib/apps-for-knowledge-source/apps-for-knowledge-source.component.html","libs/ai-knowledge/src/lib/learn-more-business-profile/learn-more-business-profile.component.ts","libs/ai-knowledge/src/lib/learn-more-business-profile/learn-more-business-profile.component.html","libs/ai-knowledge/src/lib/knowledge-list/knowledge-list.component.ts","libs/ai-knowledge/src/lib/knowledge-list/knowledge-list.component.html","libs/ai-knowledge/src/lib/knowledge-editor/common/common-knowledge-source-editor.component.ts","libs/ai-knowledge/src/lib/knowledge-editor/custom-data/custom-data.component.ts","libs/ai-knowledge/src/lib/knowledge-editor/custom-data/custom-data.component.html","libs/ai-knowledge/src/lib/knowledge-editor/website-scrape/scraped-pages/scraped-pages.component.ts","libs/ai-knowledge/src/lib/knowledge-editor/website-scrape/scraped-pages/scraped-pages.component.html","libs/ai-knowledge/src/lib/knowledge-editor/website-scrape/website-scrape.component.ts","libs/ai-knowledge/src/lib/knowledge-editor/website-scrape/website-scrape.component.html","libs/ai-knowledge/src/lib/knowledge-editor/add-knowledge/add-knowledge.component.ts","libs/ai-knowledge/src/lib/knowledge-editor/add-knowledge/add-knowledge.component.html","libs/ai-knowledge/src/lib/knowledge-editor/knowledge-editor.component.ts","libs/ai-knowledge/src/lib/knowledge-editor/knowledge-editor.component.html","libs/ai-knowledge/src/lib/application-knowledge-control/application-knowledge.component.ts","libs/ai-knowledge/src/lib/application-knowledge-control/application-knowledge.component.html","libs/conversation/inbox/src/settings/webchat-configuration/webchat-form/webchat-form.component.ts","libs/conversation/inbox/src/settings/webchat-configuration/webchat-form/webchat-form.component.html","libs/conversation/inbox/src/settings/webchat-configuration/new-webchat/new-webchat.component.ts","libs/conversation/inbox/src/settings/webchat-configuration/new-webchat/new-webchat.component.html","libs/conversation/inbox/src/settings/webchat-configuration/web-chat-instructions/webchat-install-instructions-dialog.component.ts","libs/conversation/inbox/src/settings/webchat-configuration/web-chat-instructions/webchat-install-instructions-dialog.component.html","node_modules/highlight.js/es/core.js","node_modules/highlight.js/es/languages/javascript.js","node_modules/highlight.js/es/languages/xml.js","libs/galaxy/code-sample/src/code-sample.component.ts","libs/galaxy/code-sample/src/code-sample.component.html","node_modules/@capacitor/filesystem/dist/esm/index.js","libs/conversation/inbox/src/settings/webchat-configuration/web-chat-instructions/web-chat-instructions.component.ts","libs/conversation/inbox/src/settings/webchat-configuration/web-chat-instructions/web-chat-instructions.component.html","libs/conversation/inbox/src/settings/webchat-configuration/show-webchat/show-webchat.component.ts","libs/conversation/inbox/src/settings/webchat-configuration/show-webchat/show-webchat.component.html","libs/conversation/inbox/src/settings/webchat-configuration/edit-webchat/edit-webchat.component.ts","libs/conversation/inbox/src/settings/webchat-configuration/edit-webchat/edit-webchat.component.html","libs/conversation/inbox/src/lib.routes.ts","libs/conversation/inbox/src/settings/message-templates/list-message-templates.component.ts","libs/conversation/inbox/src/settings/message-templates/list-message-templates.component.html","libs/conversation/inbox/src/settings/sms-configuration/sms-configuration.component.ts","libs/conversation/inbox/src/settings/sms-configuration/sms-configuration.component.html"],"sourcesContent":["/* eslint-disable no-multi-assign */\n\nfunction deepFreeze(obj) {\n if (obj instanceof Map) {\n obj.clear = obj.delete = obj.set = function () {\n throw new Error('map is read-only');\n };\n } else if (obj instanceof Set) {\n obj.add = obj.clear = obj.delete = function () {\n throw new Error('set is read-only');\n };\n }\n\n // Freeze self\n Object.freeze(obj);\n Object.getOwnPropertyNames(obj).forEach(name => {\n const prop = obj[name];\n const type = typeof prop;\n\n // Freeze prop if it is an object or function and also not already frozen\n if ((type === 'object' || type === 'function') && !Object.isFrozen(prop)) {\n deepFreeze(prop);\n }\n });\n return obj;\n}\n\n/** @typedef {import('highlight.js').CallbackResponse} CallbackResponse */\n/** @typedef {import('highlight.js').CompiledMode} CompiledMode */\n/** @implements CallbackResponse */\n\nclass Response {\n /**\n * @param {CompiledMode} mode\n */\n constructor(mode) {\n // eslint-disable-next-line no-undefined\n if (mode.data === undefined) mode.data = {};\n this.data = mode.data;\n this.isMatchIgnored = false;\n }\n ignoreMatch() {\n this.isMatchIgnored = true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {string}\n */\nfunction escapeHTML(value) {\n return value.replace(/&/g, '&').replace(//g, '>').replace(/\"/g, '"').replace(/'/g, ''');\n}\n\n/**\n * performs a shallow merge of multiple objects into one\n *\n * @template T\n * @param {T} original\n * @param {Record[]} objects\n * @returns {T} a single new object\n */\nfunction inherit$1(original, ...objects) {\n /** @type Record */\n const result = Object.create(null);\n for (const key in original) {\n result[key] = original[key];\n }\n objects.forEach(function (obj) {\n for (const key in obj) {\n result[key] = obj[key];\n }\n });\n return /** @type {T} */result;\n}\n\n/**\n * @typedef {object} Renderer\n * @property {(text: string) => void} addText\n * @property {(node: Node) => void} openNode\n * @property {(node: Node) => void} closeNode\n * @property {() => string} value\n */\n\n/** @typedef {{scope?: string, language?: string, sublanguage?: boolean}} Node */\n/** @typedef {{walk: (r: Renderer) => void}} Tree */\n/** */\n\nconst SPAN_CLOSE = '';\n\n/**\n * Determines if a node needs to be wrapped in \n *\n * @param {Node} node */\nconst emitsWrappingTags = node => {\n // rarely we can have a sublanguage where language is undefined\n // TODO: track down why\n return !!node.scope;\n};\n\n/**\n *\n * @param {string} name\n * @param {{prefix:string}} options\n */\nconst scopeToCSSClass = (name, {\n prefix\n}) => {\n // sub-language\n if (name.startsWith(\"language:\")) {\n return name.replace(\"language:\", \"language-\");\n }\n // tiered scope: comment.line\n if (name.includes(\".\")) {\n const pieces = name.split(\".\");\n return [`${prefix}${pieces.shift()}`, ...pieces.map((x, i) => `${x}${\"_\".repeat(i + 1)}`)].join(\" \");\n }\n // simple scope\n return `${prefix}${name}`;\n};\n\n/** @type {Renderer} */\nclass HTMLRenderer {\n /**\n * Creates a new HTMLRenderer\n *\n * @param {Tree} parseTree - the parse tree (must support `walk` API)\n * @param {{classPrefix: string}} options\n */\n constructor(parseTree, options) {\n this.buffer = \"\";\n this.classPrefix = options.classPrefix;\n parseTree.walk(this);\n }\n\n /**\n * Adds texts to the output stream\n *\n * @param {string} text */\n addText(text) {\n this.buffer += escapeHTML(text);\n }\n\n /**\n * Adds a node open to the output stream (if needed)\n *\n * @param {Node} node */\n openNode(node) {\n if (!emitsWrappingTags(node)) return;\n const className = scopeToCSSClass(node.scope, {\n prefix: this.classPrefix\n });\n this.span(className);\n }\n\n /**\n * Adds a node close to the output stream (if needed)\n *\n * @param {Node} node */\n closeNode(node) {\n if (!emitsWrappingTags(node)) return;\n this.buffer += SPAN_CLOSE;\n }\n\n /**\n * returns the accumulated buffer\n */\n value() {\n return this.buffer;\n }\n\n // helpers\n\n /**\n * Builds a span element\n *\n * @param {string} className */\n span(className) {\n this.buffer += ``;\n }\n}\n\n/** @typedef {{scope?: string, language?: string, children: Node[]} | string} Node */\n/** @typedef {{scope?: string, language?: string, children: Node[]} } DataNode */\n/** @typedef {import('highlight.js').Emitter} Emitter */\n/** */\n\n/** @returns {DataNode} */\nconst newNode = (opts = {}) => {\n /** @type DataNode */\n const result = {\n children: []\n };\n Object.assign(result, opts);\n return result;\n};\nclass TokenTree {\n constructor() {\n /** @type DataNode */\n this.rootNode = newNode();\n this.stack = [this.rootNode];\n }\n get top() {\n return this.stack[this.stack.length - 1];\n }\n get root() {\n return this.rootNode;\n }\n\n /** @param {Node} node */\n add(node) {\n this.top.children.push(node);\n }\n\n /** @param {string} scope */\n openNode(scope) {\n /** @type Node */\n const node = newNode({\n scope\n });\n this.add(node);\n this.stack.push(node);\n }\n closeNode() {\n if (this.stack.length > 1) {\n return this.stack.pop();\n }\n // eslint-disable-next-line no-undefined\n return undefined;\n }\n closeAllNodes() {\n while (this.closeNode());\n }\n toJSON() {\n return JSON.stringify(this.rootNode, null, 4);\n }\n\n /**\n * @typedef { import(\"./html_renderer\").Renderer } Renderer\n * @param {Renderer} builder\n */\n walk(builder) {\n // this does not\n return this.constructor._walk(builder, this.rootNode);\n // this works\n // return TokenTree._walk(builder, this.rootNode);\n }\n\n /**\n * @param {Renderer} builder\n * @param {Node} node\n */\n static _walk(builder, node) {\n if (typeof node === \"string\") {\n builder.addText(node);\n } else if (node.children) {\n builder.openNode(node);\n node.children.forEach(child => this._walk(builder, child));\n builder.closeNode(node);\n }\n return builder;\n }\n\n /**\n * @param {Node} node\n */\n static _collapse(node) {\n if (typeof node === \"string\") return;\n if (!node.children) return;\n if (node.children.every(el => typeof el === \"string\")) {\n // node.text = node.children.join(\"\");\n // delete node.children;\n node.children = [node.children.join(\"\")];\n } else {\n node.children.forEach(child => {\n TokenTree._collapse(child);\n });\n }\n }\n}\n\n/**\n Currently this is all private API, but this is the minimal API necessary\n that an Emitter must implement to fully support the parser.\n\n Minimal interface:\n\n - addText(text)\n - __addSublanguage(emitter, subLanguageName)\n - startScope(scope)\n - endScope()\n - finalize()\n - toHTML()\n\n*/\n\n/**\n * @implements {Emitter}\n */\nclass TokenTreeEmitter extends TokenTree {\n /**\n * @param {*} options\n */\n constructor(options) {\n super();\n this.options = options;\n }\n\n /**\n * @param {string} text\n */\n addText(text) {\n if (text === \"\") {\n return;\n }\n this.add(text);\n }\n\n /** @param {string} scope */\n startScope(scope) {\n this.openNode(scope);\n }\n endScope() {\n this.closeNode();\n }\n\n /**\n * @param {Emitter & {root: DataNode}} emitter\n * @param {string} name\n */\n __addSublanguage(emitter, name) {\n /** @type DataNode */\n const node = emitter.root;\n if (name) node.scope = `language:${name}`;\n this.add(node);\n }\n toHTML() {\n const renderer = new HTMLRenderer(this, this.options);\n return renderer.value();\n }\n finalize() {\n this.closeAllNodes();\n return true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {RegExp}\n * */\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction source(re) {\n if (!re) return null;\n if (typeof re === \"string\") return re;\n return re.source;\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction lookahead(re) {\n return concat('(?=', re, ')');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction anyNumberOfTimes(re) {\n return concat('(?:', re, ')*');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction optional(re) {\n return concat('(?:', re, ')?');\n}\n\n/**\n * @param {...(RegExp | string) } args\n * @returns {string}\n */\nfunction concat(...args) {\n const joined = args.map(x => source(x)).join(\"\");\n return joined;\n}\n\n/**\n * @param { Array } args\n * @returns {object}\n */\nfunction stripOptionsFromArgs(args) {\n const opts = args[args.length - 1];\n if (typeof opts === 'object' && opts.constructor === Object) {\n args.splice(args.length - 1, 1);\n return opts;\n } else {\n return {};\n }\n}\n\n/** @typedef { {capture?: boolean} } RegexEitherOptions */\n\n/**\n * Any of the passed expresssions may match\n *\n * Creates a huge this | this | that | that match\n * @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args\n * @returns {string}\n */\nfunction either(...args) {\n /** @type { object & {capture?: boolean} } */\n const opts = stripOptionsFromArgs(args);\n const joined = '(' + (opts.capture ? \"\" : \"?:\") + args.map(x => source(x)).join(\"|\") + \")\";\n return joined;\n}\n\n/**\n * @param {RegExp | string} re\n * @returns {number}\n */\nfunction countMatchGroups(re) {\n return new RegExp(re.toString() + '|').exec('').length - 1;\n}\n\n/**\n * Does lexeme start with a regular expression match at the beginning\n * @param {RegExp} re\n * @param {string} lexeme\n */\nfunction startsWith(re, lexeme) {\n const match = re && re.exec(lexeme);\n return match && match.index === 0;\n}\n\n// BACKREF_RE matches an open parenthesis or backreference. To avoid\n// an incorrect parse, it additionally matches the following:\n// - [...] elements, where the meaning of parentheses and escapes change\n// - other escape sequences, so we do not misparse escape sequences as\n// interesting elements\n// - non-matching or lookahead parentheses, which do not capture. These\n// follow the '(' with a '?'.\nconst BACKREF_RE = /\\[(?:[^\\\\\\]]|\\\\.)*\\]|\\(\\??|\\\\([1-9][0-9]*)|\\\\./;\n\n// **INTERNAL** Not intended for outside usage\n// join logically computes regexps.join(separator), but fixes the\n// backreferences so they continue to match.\n// it also places each individual regular expression into it's own\n// match group, keeping track of the sequencing of those match groups\n// is currently an exercise for the caller. :-)\n/**\n * @param {(string | RegExp)[]} regexps\n * @param {{joinWith: string}} opts\n * @returns {string}\n */\nfunction _rewriteBackreferences(regexps, {\n joinWith\n}) {\n let numCaptures = 0;\n return regexps.map(regex => {\n numCaptures += 1;\n const offset = numCaptures;\n let re = source(regex);\n let out = '';\n while (re.length > 0) {\n const match = BACKREF_RE.exec(re);\n if (!match) {\n out += re;\n break;\n }\n out += re.substring(0, match.index);\n re = re.substring(match.index + match[0].length);\n if (match[0][0] === '\\\\' && match[1]) {\n // Adjust the backreference.\n out += '\\\\' + String(Number(match[1]) + offset);\n } else {\n out += match[0];\n if (match[0] === '(') {\n numCaptures++;\n }\n }\n }\n return out;\n }).map(re => `(${re})`).join(joinWith);\n}\n\n/** @typedef {import('highlight.js').Mode} Mode */\n/** @typedef {import('highlight.js').ModeCallback} ModeCallback */\n\n// Common regexps\nconst MATCH_NOTHING_RE = /\\b\\B/;\nconst IDENT_RE = '[a-zA-Z]\\\\w*';\nconst UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\\\w*';\nconst NUMBER_RE = '\\\\b\\\\d+(\\\\.\\\\d+)?';\nconst C_NUMBER_RE = '(-?)(\\\\b0[xX][a-fA-F0-9]+|(\\\\b\\\\d+(\\\\.\\\\d*)?|\\\\.\\\\d+)([eE][-+]?\\\\d+)?)'; // 0x..., 0..., decimal, float\nconst BINARY_NUMBER_RE = '\\\\b(0b[01]+)'; // 0b...\nconst RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\\\*|\\\\*=|\\\\+|\\\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\\\?|\\\\[|\\\\{|\\\\(|\\\\^|\\\\^=|\\\\||\\\\|=|\\\\|\\\\||~';\n\n/**\n* @param { Partial & {binary?: string | RegExp} } opts\n*/\nconst SHEBANG = (opts = {}) => {\n const beginShebang = /^#![ ]*\\//;\n if (opts.binary) {\n opts.begin = concat(beginShebang, /.*\\b/, opts.binary, /\\b.*/);\n }\n return inherit$1({\n scope: 'meta',\n begin: beginShebang,\n end: /$/,\n relevance: 0,\n /** @type {ModeCallback} */\n \"on:begin\": (m, resp) => {\n if (m.index !== 0) resp.ignoreMatch();\n }\n }, opts);\n};\n\n// Common modes\nconst BACKSLASH_ESCAPE = {\n begin: '\\\\\\\\[\\\\s\\\\S]',\n relevance: 0\n};\nconst APOS_STRING_MODE = {\n scope: 'string',\n begin: '\\'',\n end: '\\'',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst QUOTE_STRING_MODE = {\n scope: 'string',\n begin: '\"',\n end: '\"',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst PHRASAL_WORDS_MODE = {\n begin: /\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b/\n};\n/**\n * Creates a comment mode\n *\n * @param {string | RegExp} begin\n * @param {string | RegExp} end\n * @param {Mode | {}} [modeOptions]\n * @returns {Partial}\n */\nconst COMMENT = function (begin, end, modeOptions = {}) {\n const mode = inherit$1({\n scope: 'comment',\n begin,\n end,\n contains: []\n }, modeOptions);\n mode.contains.push({\n scope: 'doctag',\n // hack to avoid the space from being included. the space is necessary to\n // match here to prevent the plain text rule below from gobbling up doctags\n begin: '[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)',\n end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,\n excludeBegin: true,\n relevance: 0\n });\n const ENGLISH_WORD = either(\n // list of common 1 and 2 letter words in English\n \"I\", \"a\", \"is\", \"so\", \"us\", \"to\", \"at\", \"if\", \"in\", \"it\", \"on\",\n // note: this is not an exhaustive list of contractions, just popular ones\n /[A-Za-z]+['](d|ve|re|ll|t|s|n)/,\n // contractions - can't we'd they're let's, etc\n /[A-Za-z]+[-][a-z]+/,\n // `no-way`, etc.\n /[A-Za-z][a-z]{2,}/ // allow capitalized words at beginning of sentences\n );\n // looking like plain text, more likely to be a comment\n mode.contains.push({\n // TODO: how to include \", (, ) without breaking grammars that use these for\n // comment delimiters?\n // begin: /[ ]+([()\"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()\":]?([.][ ]|[ ]|\\))){3}/\n // ---\n\n // this tries to find sequences of 3 english words in a row (without any\n // \"programming\" type syntax) this gives us a strong signal that we've\n // TRULY found a comment - vs perhaps scanning with the wrong language.\n // It's possible to find something that LOOKS like the start of the\n // comment - but then if there is no readable text - good chance it is a\n // false match and not a comment.\n //\n // for a visual example please see:\n // https://github.com/highlightjs/highlight.js/issues/2827\n\n begin: concat(/[ ]+/,\n // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */\n '(', ENGLISH_WORD, /[.]?[:]?([.][ ]|[ ])/, '){3}') // look for 3 words in a row\n });\n return mode;\n};\nconst C_LINE_COMMENT_MODE = COMMENT('//', '$');\nconst C_BLOCK_COMMENT_MODE = COMMENT('/\\\\*', '\\\\*/');\nconst HASH_COMMENT_MODE = COMMENT('#', '$');\nconst NUMBER_MODE = {\n scope: 'number',\n begin: NUMBER_RE,\n relevance: 0\n};\nconst C_NUMBER_MODE = {\n scope: 'number',\n begin: C_NUMBER_RE,\n relevance: 0\n};\nconst BINARY_NUMBER_MODE = {\n scope: 'number',\n begin: BINARY_NUMBER_RE,\n relevance: 0\n};\nconst REGEXP_MODE = {\n scope: \"regexp\",\n begin: /\\/(?=[^/\\n]*\\/)/,\n end: /\\/[gimuy]*/,\n contains: [BACKSLASH_ESCAPE, {\n begin: /\\[/,\n end: /\\]/,\n relevance: 0,\n contains: [BACKSLASH_ESCAPE]\n }]\n};\nconst TITLE_MODE = {\n scope: 'title',\n begin: IDENT_RE,\n relevance: 0\n};\nconst UNDERSCORE_TITLE_MODE = {\n scope: 'title',\n begin: UNDERSCORE_IDENT_RE,\n relevance: 0\n};\nconst METHOD_GUARD = {\n // excludes method names from keyword processing\n begin: '\\\\.\\\\s*' + UNDERSCORE_IDENT_RE,\n relevance: 0\n};\n\n/**\n * Adds end same as begin mechanics to a mode\n *\n * Your mode must include at least a single () match group as that first match\n * group is what is used for comparison\n * @param {Partial} mode\n */\nconst END_SAME_AS_BEGIN = function (mode) {\n return Object.assign(mode, {\n /** @type {ModeCallback} */\n 'on:begin': (m, resp) => {\n resp.data._beginMatch = m[1];\n },\n /** @type {ModeCallback} */\n 'on:end': (m, resp) => {\n if (resp.data._beginMatch !== m[1]) resp.ignoreMatch();\n }\n });\n};\nvar MODES = /*#__PURE__*/Object.freeze({\n __proto__: null,\n APOS_STRING_MODE: APOS_STRING_MODE,\n BACKSLASH_ESCAPE: BACKSLASH_ESCAPE,\n BINARY_NUMBER_MODE: BINARY_NUMBER_MODE,\n BINARY_NUMBER_RE: BINARY_NUMBER_RE,\n COMMENT: COMMENT,\n C_BLOCK_COMMENT_MODE: C_BLOCK_COMMENT_MODE,\n C_LINE_COMMENT_MODE: C_LINE_COMMENT_MODE,\n C_NUMBER_MODE: C_NUMBER_MODE,\n C_NUMBER_RE: C_NUMBER_RE,\n END_SAME_AS_BEGIN: END_SAME_AS_BEGIN,\n HASH_COMMENT_MODE: HASH_COMMENT_MODE,\n IDENT_RE: IDENT_RE,\n MATCH_NOTHING_RE: MATCH_NOTHING_RE,\n METHOD_GUARD: METHOD_GUARD,\n NUMBER_MODE: NUMBER_MODE,\n NUMBER_RE: NUMBER_RE,\n PHRASAL_WORDS_MODE: PHRASAL_WORDS_MODE,\n QUOTE_STRING_MODE: QUOTE_STRING_MODE,\n REGEXP_MODE: REGEXP_MODE,\n RE_STARTERS_RE: RE_STARTERS_RE,\n SHEBANG: SHEBANG,\n TITLE_MODE: TITLE_MODE,\n UNDERSCORE_IDENT_RE: UNDERSCORE_IDENT_RE,\n UNDERSCORE_TITLE_MODE: UNDERSCORE_TITLE_MODE\n});\n\n/**\n@typedef {import('highlight.js').CallbackResponse} CallbackResponse\n@typedef {import('highlight.js').CompilerExt} CompilerExt\n*/\n\n// Grammar extensions / plugins\n// See: https://github.com/highlightjs/highlight.js/issues/2833\n\n// Grammar extensions allow \"syntactic sugar\" to be added to the grammar modes\n// without requiring any underlying changes to the compiler internals.\n\n// `compileMatch` being the perfect small example of now allowing a grammar\n// author to write `match` when they desire to match a single expression rather\n// than being forced to use `begin`. The extension then just moves `match` into\n// `begin` when it runs. Ie, no features have been added, but we've just made\n// the experience of writing (and reading grammars) a little bit nicer.\n\n// ------\n\n// TODO: We need negative look-behind support to do this properly\n/**\n * Skip a match if it has a preceding dot\n *\n * This is used for `beginKeywords` to prevent matching expressions such as\n * `bob.keyword.do()`. The mode compiler automatically wires this up as a\n * special _internal_ 'on:begin' callback for modes with `beginKeywords`\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\nfunction skipIfHasPrecedingDot(match, response) {\n const before = match.input[match.index - 1];\n if (before === \".\") {\n response.ignoreMatch();\n }\n}\n\n/**\n *\n * @type {CompilerExt}\n */\nfunction scopeClassName(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.className !== undefined) {\n mode.scope = mode.className;\n delete mode.className;\n }\n}\n\n/**\n * `beginKeywords` syntactic sugar\n * @type {CompilerExt}\n */\nfunction beginKeywords(mode, parent) {\n if (!parent) return;\n if (!mode.beginKeywords) return;\n\n // for languages with keywords that include non-word characters checking for\n // a word boundary is not sufficient, so instead we check for a word boundary\n // or whitespace - this does no harm in any case since our keyword engine\n // doesn't allow spaces in keywords anyways and we still check for the boundary\n // first\n mode.begin = '\\\\b(' + mode.beginKeywords.split(' ').join('|') + ')(?!\\\\.)(?=\\\\b|\\\\s)';\n mode.__beforeBegin = skipIfHasPrecedingDot;\n mode.keywords = mode.keywords || mode.beginKeywords;\n delete mode.beginKeywords;\n\n // prevents double relevance, the keywords themselves provide\n // relevance, the mode doesn't need to double it\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 0;\n}\n\n/**\n * Allow `illegal` to contain an array of illegal values\n * @type {CompilerExt}\n */\nfunction compileIllegal(mode, _parent) {\n if (!Array.isArray(mode.illegal)) return;\n mode.illegal = either(...mode.illegal);\n}\n\n/**\n * `match` to match a single expression for readability\n * @type {CompilerExt}\n */\nfunction compileMatch(mode, _parent) {\n if (!mode.match) return;\n if (mode.begin || mode.end) throw new Error(\"begin & end are not supported with match\");\n mode.begin = mode.match;\n delete mode.match;\n}\n\n/**\n * provides the default 1 relevance to all modes\n * @type {CompilerExt}\n */\nfunction compileRelevance(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 1;\n}\n\n// allow beforeMatch to act as a \"qualifier\" for the match\n// the full match begin must be [beforeMatch][begin]\nconst beforeMatchExt = (mode, parent) => {\n if (!mode.beforeMatch) return;\n // starts conflicts with endsParent which we need to make sure the child\n // rule is not matched multiple times\n if (mode.starts) throw new Error(\"beforeMatch cannot be used with starts\");\n const originalMode = Object.assign({}, mode);\n Object.keys(mode).forEach(key => {\n delete mode[key];\n });\n mode.keywords = originalMode.keywords;\n mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin));\n mode.starts = {\n relevance: 0,\n contains: [Object.assign(originalMode, {\n endsParent: true\n })]\n };\n mode.relevance = 0;\n delete originalMode.beforeMatch;\n};\n\n// keywords that should have no default relevance value\nconst COMMON_KEYWORDS = ['of', 'and', 'for', 'in', 'not', 'or', 'if', 'then', 'parent',\n// common variable name\n'list',\n// common variable name\n'value' // common variable name\n];\nconst DEFAULT_KEYWORD_SCOPE = \"keyword\";\n\n/**\n * Given raw keywords from a language definition, compile them.\n *\n * @param {string | Record | Array} rawKeywords\n * @param {boolean} caseInsensitive\n */\nfunction compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {\n /** @type {import(\"highlight.js/private\").KeywordDict} */\n const compiledKeywords = Object.create(null);\n\n // input can be a string of keywords, an array of keywords, or a object with\n // named keys representing scopeName (which can then point to a string or array)\n if (typeof rawKeywords === 'string') {\n compileList(scopeName, rawKeywords.split(\" \"));\n } else if (Array.isArray(rawKeywords)) {\n compileList(scopeName, rawKeywords);\n } else {\n Object.keys(rawKeywords).forEach(function (scopeName) {\n // collapse all our objects back into the parent object\n Object.assign(compiledKeywords, compileKeywords(rawKeywords[scopeName], caseInsensitive, scopeName));\n });\n }\n return compiledKeywords;\n\n // ---\n\n /**\n * Compiles an individual list of keywords\n *\n * Ex: \"for if when while|5\"\n *\n * @param {string} scopeName\n * @param {Array} keywordList\n */\n function compileList(scopeName, keywordList) {\n if (caseInsensitive) {\n keywordList = keywordList.map(x => x.toLowerCase());\n }\n keywordList.forEach(function (keyword) {\n const pair = keyword.split('|');\n compiledKeywords[pair[0]] = [scopeName, scoreForKeyword(pair[0], pair[1])];\n });\n }\n}\n\n/**\n * Returns the proper score for a given keyword\n *\n * Also takes into account comment keywords, which will be scored 0 UNLESS\n * another score has been manually assigned.\n * @param {string} keyword\n * @param {string} [providedScore]\n */\nfunction scoreForKeyword(keyword, providedScore) {\n // manual scores always win over common keywords\n // so you can force a score of 1 if you really insist\n if (providedScore) {\n return Number(providedScore);\n }\n return commonKeyword(keyword) ? 0 : 1;\n}\n\n/**\n * Determines if a given keyword is common or not\n *\n * @param {string} keyword */\nfunction commonKeyword(keyword) {\n return COMMON_KEYWORDS.includes(keyword.toLowerCase());\n}\n\n/*\n\nFor the reasoning behind this please see:\nhttps://github.com/highlightjs/highlight.js/issues/2880#issuecomment-747275419\n\n*/\n\n/**\n * @type {Record}\n */\nconst seenDeprecations = {};\n\n/**\n * @param {string} message\n */\nconst error = message => {\n console.error(message);\n};\n\n/**\n * @param {string} message\n * @param {any} args\n */\nconst warn = (message, ...args) => {\n console.log(`WARN: ${message}`, ...args);\n};\n\n/**\n * @param {string} version\n * @param {string} message\n */\nconst deprecated = (version, message) => {\n if (seenDeprecations[`${version}/${message}`]) return;\n console.log(`Deprecated as of ${version}. ${message}`);\n seenDeprecations[`${version}/${message}`] = true;\n};\n\n/* eslint-disable no-throw-literal */\n\n/**\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n*/\n\nconst MultiClassError = new Error();\n\n/**\n * Renumbers labeled scope names to account for additional inner match\n * groups that otherwise would break everything.\n *\n * Lets say we 3 match scopes:\n *\n * { 1 => ..., 2 => ..., 3 => ... }\n *\n * So what we need is a clean match like this:\n *\n * (a)(b)(c) => [ \"a\", \"b\", \"c\" ]\n *\n * But this falls apart with inner match groups:\n *\n * (a)(((b)))(c) => [\"a\", \"b\", \"b\", \"b\", \"c\" ]\n *\n * Our scopes are now \"out of alignment\" and we're repeating `b` 3 times.\n * What needs to happen is the numbers are remapped:\n *\n * { 1 => ..., 2 => ..., 5 => ... }\n *\n * We also need to know that the ONLY groups that should be output\n * are 1, 2, and 5. This function handles this behavior.\n *\n * @param {CompiledMode} mode\n * @param {Array} regexes\n * @param {{key: \"beginScope\"|\"endScope\"}} opts\n */\nfunction remapScopeNames(mode, regexes, {\n key\n}) {\n let offset = 0;\n const scopeNames = mode[key];\n /** @type Record */\n const emit = {};\n /** @type Record */\n const positions = {};\n for (let i = 1; i <= regexes.length; i++) {\n positions[i + offset] = scopeNames[i];\n emit[i + offset] = true;\n offset += countMatchGroups(regexes[i - 1]);\n }\n // we use _emit to keep track of which match groups are \"top-level\" to avoid double\n // output from inside match groups\n mode[key] = positions;\n mode[key]._emit = emit;\n mode[key]._multi = true;\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction beginMultiClass(mode) {\n if (!Array.isArray(mode.begin)) return;\n if (mode.skip || mode.excludeBegin || mode.returnBegin) {\n error(\"skip, excludeBegin, returnBegin not compatible with beginScope: {}\");\n throw MultiClassError;\n }\n if (typeof mode.beginScope !== \"object\" || mode.beginScope === null) {\n error(\"beginScope must be object\");\n throw MultiClassError;\n }\n remapScopeNames(mode, mode.begin, {\n key: \"beginScope\"\n });\n mode.begin = _rewriteBackreferences(mode.begin, {\n joinWith: \"\"\n });\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction endMultiClass(mode) {\n if (!Array.isArray(mode.end)) return;\n if (mode.skip || mode.excludeEnd || mode.returnEnd) {\n error(\"skip, excludeEnd, returnEnd not compatible with endScope: {}\");\n throw MultiClassError;\n }\n if (typeof mode.endScope !== \"object\" || mode.endScope === null) {\n error(\"endScope must be object\");\n throw MultiClassError;\n }\n remapScopeNames(mode, mode.end, {\n key: \"endScope\"\n });\n mode.end = _rewriteBackreferences(mode.end, {\n joinWith: \"\"\n });\n}\n\n/**\n * this exists only to allow `scope: {}` to be used beside `match:`\n * Otherwise `beginScope` would necessary and that would look weird\n\n {\n match: [ /def/, /\\w+/ ]\n scope: { 1: \"keyword\" , 2: \"title\" }\n }\n\n * @param {CompiledMode} mode\n */\nfunction scopeSugar(mode) {\n if (mode.scope && typeof mode.scope === \"object\" && mode.scope !== null) {\n mode.beginScope = mode.scope;\n delete mode.scope;\n }\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction MultiClass(mode) {\n scopeSugar(mode);\n if (typeof mode.beginScope === \"string\") {\n mode.beginScope = {\n _wrap: mode.beginScope\n };\n }\n if (typeof mode.endScope === \"string\") {\n mode.endScope = {\n _wrap: mode.endScope\n };\n }\n beginMultiClass(mode);\n endMultiClass(mode);\n}\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').CompiledLanguage} CompiledLanguage\n*/\n\n// compilation\n\n/**\n * Compiles a language definition result\n *\n * Given the raw result of a language definition (Language), compiles this so\n * that it is ready for highlighting code.\n * @param {Language} language\n * @returns {CompiledLanguage}\n */\nfunction compileLanguage(language) {\n /**\n * Builds a regex with the case sensitivity of the current language\n *\n * @param {RegExp | string} value\n * @param {boolean} [global]\n */\n function langRe(value, global) {\n return new RegExp(source(value), 'm' + (language.case_insensitive ? 'i' : '') + (language.unicodeRegex ? 'u' : '') + (global ? 'g' : ''));\n }\n\n /**\n Stores multiple regular expressions and allows you to quickly search for\n them all in a string simultaneously - returning the first match. It does\n this by creating a huge (a|b|c) regex - each individual item wrapped with ()\n and joined by `|` - using match groups to track position. When a match is\n found checking which position in the array has content allows us to figure\n out which of the original regexes / match groups triggered the match.\n The match object itself (the result of `Regex.exec`) is returned but also\n enhanced by merging in any meta-data that was registered with the regex.\n This is how we keep track of which mode matched, and what type of rule\n (`illegal`, `begin`, end, etc).\n */\n class MultiRegex {\n constructor() {\n this.matchIndexes = {};\n // @ts-ignore\n this.regexes = [];\n this.matchAt = 1;\n this.position = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n opts.position = this.position++;\n // @ts-ignore\n this.matchIndexes[this.matchAt] = opts;\n this.regexes.push([opts, re]);\n this.matchAt += countMatchGroups(re) + 1;\n }\n compile() {\n if (this.regexes.length === 0) {\n // avoids the need to check length every time exec is called\n // @ts-ignore\n this.exec = () => null;\n }\n const terminators = this.regexes.map(el => el[1]);\n this.matcherRe = langRe(_rewriteBackreferences(terminators, {\n joinWith: '|'\n }), true);\n this.lastIndex = 0;\n }\n\n /** @param {string} s */\n exec(s) {\n this.matcherRe.lastIndex = this.lastIndex;\n const match = this.matcherRe.exec(s);\n if (!match) {\n return null;\n }\n\n // eslint-disable-next-line no-undefined\n const i = match.findIndex((el, i) => i > 0 && el !== undefined);\n // @ts-ignore\n const matchData = this.matchIndexes[i];\n // trim off any earlier non-relevant match groups (ie, the other regex\n // match groups that make up the multi-matcher)\n match.splice(0, i);\n return Object.assign(match, matchData);\n }\n }\n\n /*\n Created to solve the key deficiently with MultiRegex - there is no way to\n test for multiple matches at a single location. Why would we need to do\n that? In the future a more dynamic engine will allow certain matches to be\n ignored. An example: if we matched say the 3rd regex in a large group but\n decided to ignore it - we'd need to started testing again at the 4th\n regex... but MultiRegex itself gives us no real way to do that.\n So what this class creates MultiRegexs on the fly for whatever search\n position they are needed.\n NOTE: These additional MultiRegex objects are created dynamically. For most\n grammars most of the time we will never actually need anything more than the\n first MultiRegex - so this shouldn't have too much overhead.\n Say this is our search group, and we match regex3, but wish to ignore it.\n regex1 | regex2 | regex3 | regex4 | regex5 ' ie, startAt = 0\n What we need is a new MultiRegex that only includes the remaining\n possibilities:\n regex4 | regex5 ' ie, startAt = 3\n This class wraps all that complexity up in a simple API... `startAt` decides\n where in the array of expressions to start doing the matching. It\n auto-increments, so if a match is found at position 2, then startAt will be\n set to 3. If the end is reached startAt will return to 0.\n MOST of the time the parser will be setting startAt manually to 0.\n */\n class ResumableMultiRegex {\n constructor() {\n // @ts-ignore\n this.rules = [];\n // @ts-ignore\n this.multiRegexes = [];\n this.count = 0;\n this.lastIndex = 0;\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n getMatcher(index) {\n if (this.multiRegexes[index]) return this.multiRegexes[index];\n const matcher = new MultiRegex();\n this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));\n matcher.compile();\n this.multiRegexes[index] = matcher;\n return matcher;\n }\n resumingScanAtSamePosition() {\n return this.regexIndex !== 0;\n }\n considerAll() {\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n this.rules.push([re, opts]);\n if (opts.type === \"begin\") this.count++;\n }\n\n /** @param {string} s */\n exec(s) {\n const m = this.getMatcher(this.regexIndex);\n m.lastIndex = this.lastIndex;\n let result = m.exec(s);\n\n // The following is because we have no easy way to say \"resume scanning at the\n // existing position but also skip the current rule ONLY\". What happens is\n // all prior rules are also skipped which can result in matching the wrong\n // thing. Example of matching \"booger\":\n\n // our matcher is [string, \"booger\", number]\n //\n // ....booger....\n\n // if \"booger\" is ignored then we'd really need a regex to scan from the\n // SAME position for only: [string, number] but ignoring \"booger\" (if it\n // was the first match), a simple resume would scan ahead who knows how\n // far looking only for \"number\", ignoring potential string matches (or\n // future \"booger\" matches that might be valid.)\n\n // So what we do: We execute two matchers, one resuming at the same\n // position, but the second full matcher starting at the position after:\n\n // /--- resume first regex match here (for [number])\n // |/---- full match here for [string, \"booger\", number]\n // vv\n // ....booger....\n\n // Which ever results in a match first is then used. So this 3-4 step\n // process essentially allows us to say \"match at this position, excluding\n // a prior rule that was ignored\".\n //\n // 1. Match \"booger\" first, ignore. Also proves that [string] does non match.\n // 2. Resume matching for [number]\n // 3. Match at index + 1 for [string, \"booger\", number]\n // 4. If #2 and #3 result in matches, which came first?\n if (this.resumingScanAtSamePosition()) {\n if (result && result.index === this.lastIndex) ;else {\n // use the second matcher result\n const m2 = this.getMatcher(0);\n m2.lastIndex = this.lastIndex + 1;\n result = m2.exec(s);\n }\n }\n if (result) {\n this.regexIndex += result.position + 1;\n if (this.regexIndex === this.count) {\n // wrap-around to considering all matches again\n this.considerAll();\n }\n }\n return result;\n }\n }\n\n /**\n * Given a mode, builds a huge ResumableMultiRegex that can be used to walk\n * the content and find matches.\n *\n * @param {CompiledMode} mode\n * @returns {ResumableMultiRegex}\n */\n function buildModeRegex(mode) {\n const mm = new ResumableMultiRegex();\n mode.contains.forEach(term => mm.addRule(term.begin, {\n rule: term,\n type: \"begin\"\n }));\n if (mode.terminatorEnd) {\n mm.addRule(mode.terminatorEnd, {\n type: \"end\"\n });\n }\n if (mode.illegal) {\n mm.addRule(mode.illegal, {\n type: \"illegal\"\n });\n }\n return mm;\n }\n\n /** skip vs abort vs ignore\n *\n * @skip - The mode is still entered and exited normally (and contains rules apply),\n * but all content is held and added to the parent buffer rather than being\n * output when the mode ends. Mostly used with `sublanguage` to build up\n * a single large buffer than can be parsed by sublanguage.\n *\n * - The mode begin ands ends normally.\n * - Content matched is added to the parent mode buffer.\n * - The parser cursor is moved forward normally.\n *\n * @abort - A hack placeholder until we have ignore. Aborts the mode (as if it\n * never matched) but DOES NOT continue to match subsequent `contains`\n * modes. Abort is bad/suboptimal because it can result in modes\n * farther down not getting applied because an earlier rule eats the\n * content but then aborts.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is added to the mode buffer.\n * - The parser cursor is moved forward accordingly.\n *\n * @ignore - Ignores the mode (as if it never matched) and continues to match any\n * subsequent `contains` modes. Ignore isn't technically possible with\n * the current parser implementation.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is ignored.\n * - The parser cursor is not moved forward.\n */\n\n /**\n * Compiles an individual mode\n *\n * This can raise an error if the mode contains certain detectable known logic\n * issues.\n * @param {Mode} mode\n * @param {CompiledMode | null} [parent]\n * @returns {CompiledMode | never}\n */\n function compileMode(mode, parent) {\n const cmode = /** @type CompiledMode */mode;\n if (mode.isCompiled) return cmode;\n [scopeClassName,\n // do this early so compiler extensions generally don't have to worry about\n // the distinction between match/begin\n compileMatch, MultiClass, beforeMatchExt].forEach(ext => ext(mode, parent));\n language.compilerExtensions.forEach(ext => ext(mode, parent));\n\n // __beforeBegin is considered private API, internal use only\n mode.__beforeBegin = null;\n [beginKeywords,\n // do this later so compiler extensions that come earlier have access to the\n // raw array if they wanted to perhaps manipulate it, etc.\n compileIllegal,\n // default to 1 relevance if not specified\n compileRelevance].forEach(ext => ext(mode, parent));\n mode.isCompiled = true;\n let keywordPattern = null;\n if (typeof mode.keywords === \"object\" && mode.keywords.$pattern) {\n // we need a copy because keywords might be compiled multiple times\n // so we can't go deleting $pattern from the original on the first\n // pass\n mode.keywords = Object.assign({}, mode.keywords);\n keywordPattern = mode.keywords.$pattern;\n delete mode.keywords.$pattern;\n }\n keywordPattern = keywordPattern || /\\w+/;\n if (mode.keywords) {\n mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);\n }\n cmode.keywordPatternRe = langRe(keywordPattern, true);\n if (parent) {\n if (!mode.begin) mode.begin = /\\B|\\b/;\n cmode.beginRe = langRe(cmode.begin);\n if (!mode.end && !mode.endsWithParent) mode.end = /\\B|\\b/;\n if (mode.end) cmode.endRe = langRe(cmode.end);\n cmode.terminatorEnd = source(cmode.end) || '';\n if (mode.endsWithParent && parent.terminatorEnd) {\n cmode.terminatorEnd += (mode.end ? '|' : '') + parent.terminatorEnd;\n }\n }\n if (mode.illegal) cmode.illegalRe = langRe( /** @type {RegExp | string} */mode.illegal);\n if (!mode.contains) mode.contains = [];\n mode.contains = [].concat(...mode.contains.map(function (c) {\n return expandOrCloneMode(c === 'self' ? mode : c);\n }));\n mode.contains.forEach(function (c) {\n compileMode( /** @type Mode */c, cmode);\n });\n if (mode.starts) {\n compileMode(mode.starts, parent);\n }\n cmode.matcher = buildModeRegex(cmode);\n return cmode;\n }\n if (!language.compilerExtensions) language.compilerExtensions = [];\n\n // self is not valid at the top-level\n if (language.contains && language.contains.includes('self')) {\n throw new Error(\"ERR: contains `self` is not supported at the top-level of a language. See documentation.\");\n }\n\n // we need a null object, which inherit will guarantee\n language.classNameAliases = inherit$1(language.classNameAliases || {});\n return compileMode( /** @type Mode */language);\n}\n\n/**\n * Determines if a mode has a dependency on it's parent or not\n *\n * If a mode does have a parent dependency then often we need to clone it if\n * it's used in multiple places so that each copy points to the correct parent,\n * where-as modes without a parent can often safely be re-used at the bottom of\n * a mode chain.\n *\n * @param {Mode | null} mode\n * @returns {boolean} - is there a dependency on the parent?\n * */\nfunction dependencyOnParent(mode) {\n if (!mode) return false;\n return mode.endsWithParent || dependencyOnParent(mode.starts);\n}\n\n/**\n * Expands a mode or clones it if necessary\n *\n * This is necessary for modes with parental dependenceis (see notes on\n * `dependencyOnParent`) and for nodes that have `variants` - which must then be\n * exploded into their own individual modes at compile time.\n *\n * @param {Mode} mode\n * @returns {Mode | Mode[]}\n * */\nfunction expandOrCloneMode(mode) {\n if (mode.variants && !mode.cachedVariants) {\n mode.cachedVariants = mode.variants.map(function (variant) {\n return inherit$1(mode, {\n variants: null\n }, variant);\n });\n }\n\n // EXPAND\n // if we have variants then essentially \"replace\" the mode with the variants\n // this happens in compileMode, where this function is called from\n if (mode.cachedVariants) {\n return mode.cachedVariants;\n }\n\n // CLONE\n // if we have dependencies on parents then we need a unique\n // instance of ourselves, so we can be reused with many\n // different parents without issue\n if (dependencyOnParent(mode)) {\n return inherit$1(mode, {\n starts: mode.starts ? inherit$1(mode.starts) : null\n });\n }\n if (Object.isFrozen(mode)) {\n return inherit$1(mode);\n }\n\n // no special dependency issues, just return ourselves\n return mode;\n}\nvar version = \"11.9.0\";\nclass HTMLInjectionError extends Error {\n constructor(reason, html) {\n super(reason);\n this.name = \"HTMLInjectionError\";\n this.html = html;\n }\n}\n\n/*\nSyntax highlighting with language autodetection.\nhttps://highlightjs.org/\n*/\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').CompiledScope} CompiledScope\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSApi} HLJSApi\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').PluginEvent} PluginEvent\n@typedef {import('highlight.js').HLJSOptions} HLJSOptions\n@typedef {import('highlight.js').LanguageFn} LanguageFn\n@typedef {import('highlight.js').HighlightedHTMLElement} HighlightedHTMLElement\n@typedef {import('highlight.js').BeforeHighlightContext} BeforeHighlightContext\n@typedef {import('highlight.js/private').MatchType} MatchType\n@typedef {import('highlight.js/private').KeywordData} KeywordData\n@typedef {import('highlight.js/private').EnhancedMatch} EnhancedMatch\n@typedef {import('highlight.js/private').AnnotatedError} AnnotatedError\n@typedef {import('highlight.js').AutoHighlightResult} AutoHighlightResult\n@typedef {import('highlight.js').HighlightOptions} HighlightOptions\n@typedef {import('highlight.js').HighlightResult} HighlightResult\n*/\n\nconst escape = escapeHTML;\nconst inherit = inherit$1;\nconst NO_MATCH = Symbol(\"nomatch\");\nconst MAX_KEYWORD_HITS = 7;\n\n/**\n * @param {any} hljs - object that is extended (legacy)\n * @returns {HLJSApi}\n */\nconst HLJS = function (hljs) {\n // Global internal variables used within the highlight.js library.\n /** @type {Record} */\n const languages = Object.create(null);\n /** @type {Record} */\n const aliases = Object.create(null);\n /** @type {HLJSPlugin[]} */\n const plugins = [];\n\n // safe/production mode - swallows more errors, tries to keep running\n // even if a single syntax or parse hits a fatal error\n let SAFE_MODE = true;\n const LANGUAGE_NOT_FOUND = \"Could not find the language '{}', did you forget to load/include a language module?\";\n /** @type {Language} */\n const PLAINTEXT_LANGUAGE = {\n disableAutodetect: true,\n name: 'Plain text',\n contains: []\n };\n\n // Global options used when within external APIs. This is modified when\n // calling the `hljs.configure` function.\n /** @type HLJSOptions */\n let options = {\n ignoreUnescapedHTML: false,\n throwUnescapedHTML: false,\n noHighlightRe: /^(no-?highlight)$/i,\n languageDetectRe: /\\blang(?:uage)?-([\\w-]+)\\b/i,\n classPrefix: 'hljs-',\n cssSelector: 'pre code',\n languages: null,\n // beta configuration options, subject to change, welcome to discuss\n // https://github.com/highlightjs/highlight.js/issues/1086\n __emitter: TokenTreeEmitter\n };\n\n /* Utility functions */\n\n /**\n * Tests a language name to see if highlighting should be skipped\n * @param {string} languageName\n */\n function shouldNotHighlight(languageName) {\n return options.noHighlightRe.test(languageName);\n }\n\n /**\n * @param {HighlightedHTMLElement} block - the HTML element to determine language for\n */\n function blockLanguage(block) {\n let classes = block.className + ' ';\n classes += block.parentNode ? block.parentNode.className : '';\n\n // language-* takes precedence over non-prefixed class names.\n const match = options.languageDetectRe.exec(classes);\n if (match) {\n const language = getLanguage(match[1]);\n if (!language) {\n warn(LANGUAGE_NOT_FOUND.replace(\"{}\", match[1]));\n warn(\"Falling back to no-highlight mode for this block.\", block);\n }\n return language ? match[1] : 'no-highlight';\n }\n return classes.split(/\\s+/).find(_class => shouldNotHighlight(_class) || getLanguage(_class));\n }\n\n /**\n * Core highlighting function.\n *\n * OLD API\n * highlight(lang, code, ignoreIllegals, continuation)\n *\n * NEW API\n * highlight(code, {lang, ignoreIllegals})\n *\n * @param {string} codeOrLanguageName - the language to use for highlighting\n * @param {string | HighlightOptions} optionsOrCode - the code to highlight\n * @param {boolean} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n *\n * @returns {HighlightResult} Result - an object that represents the result\n * @property {string} language - the language name\n * @property {number} relevance - the relevance score\n * @property {string} value - the highlighted HTML code\n * @property {string} code - the original raw code\n * @property {CompiledMode} top - top of the current mode stack\n * @property {boolean} illegal - indicates whether any illegal matches were found\n */\n function highlight(codeOrLanguageName, optionsOrCode, ignoreIllegals) {\n let code = \"\";\n let languageName = \"\";\n if (typeof optionsOrCode === \"object\") {\n code = codeOrLanguageName;\n ignoreIllegals = optionsOrCode.ignoreIllegals;\n languageName = optionsOrCode.language;\n } else {\n // old API\n deprecated(\"10.7.0\", \"highlight(lang, code, ...args) has been deprecated.\");\n deprecated(\"10.7.0\", \"Please use highlight(code, options) instead.\\nhttps://github.com/highlightjs/highlight.js/issues/2277\");\n languageName = codeOrLanguageName;\n code = optionsOrCode;\n }\n\n // https://github.com/highlightjs/highlight.js/issues/3149\n // eslint-disable-next-line no-undefined\n if (ignoreIllegals === undefined) {\n ignoreIllegals = true;\n }\n\n /** @type {BeforeHighlightContext} */\n const context = {\n code,\n language: languageName\n };\n // the plugin can change the desired language or the code to be highlighted\n // just be changing the object it was passed\n fire(\"before:highlight\", context);\n\n // a before plugin can usurp the result completely by providing it's own\n // in which case we don't even need to call highlight\n const result = context.result ? context.result : _highlight(context.language, context.code, ignoreIllegals);\n result.code = context.code;\n // the plugin can change anything in result to suite it\n fire(\"after:highlight\", result);\n return result;\n }\n\n /**\n * private highlight that's used internally and does not fire callbacks\n *\n * @param {string} languageName - the language to use for highlighting\n * @param {string} codeToHighlight - the code to highlight\n * @param {boolean?} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n * @param {CompiledMode?} [continuation] - current continuation mode, if any\n * @returns {HighlightResult} - result of the highlight operation\n */\n function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {\n const keywordHits = Object.create(null);\n\n /**\n * Return keyword data if a match is a keyword\n * @param {CompiledMode} mode - current mode\n * @param {string} matchText - the textual match\n * @returns {KeywordData | false}\n */\n function keywordData(mode, matchText) {\n return mode.keywords[matchText];\n }\n function processKeywords() {\n if (!top.keywords) {\n emitter.addText(modeBuffer);\n return;\n }\n let lastIndex = 0;\n top.keywordPatternRe.lastIndex = 0;\n let match = top.keywordPatternRe.exec(modeBuffer);\n let buf = \"\";\n while (match) {\n buf += modeBuffer.substring(lastIndex, match.index);\n const word = language.case_insensitive ? match[0].toLowerCase() : match[0];\n const data = keywordData(top, word);\n if (data) {\n const [kind, keywordRelevance] = data;\n emitter.addText(buf);\n buf = \"\";\n keywordHits[word] = (keywordHits[word] || 0) + 1;\n if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;\n if (kind.startsWith(\"_\")) {\n // _ implied for relevance only, do not highlight\n // by applying a class name\n buf += match[0];\n } else {\n const cssClass = language.classNameAliases[kind] || kind;\n emitKeyword(match[0], cssClass);\n }\n } else {\n buf += match[0];\n }\n lastIndex = top.keywordPatternRe.lastIndex;\n match = top.keywordPatternRe.exec(modeBuffer);\n }\n buf += modeBuffer.substring(lastIndex);\n emitter.addText(buf);\n }\n function processSubLanguage() {\n if (modeBuffer === \"\") return;\n /** @type HighlightResult */\n let result = null;\n if (typeof top.subLanguage === 'string') {\n if (!languages[top.subLanguage]) {\n emitter.addText(modeBuffer);\n return;\n }\n result = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);\n continuations[top.subLanguage] = /** @type {CompiledMode} */result._top;\n } else {\n result = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);\n }\n\n // Counting embedded language score towards the host language may be disabled\n // with zeroing the containing mode relevance. Use case in point is Markdown that\n // allows XML everywhere and makes every XML snippet to have a much larger Markdown\n // score.\n if (top.relevance > 0) {\n relevance += result.relevance;\n }\n emitter.__addSublanguage(result._emitter, result.language);\n }\n function processBuffer() {\n if (top.subLanguage != null) {\n processSubLanguage();\n } else {\n processKeywords();\n }\n modeBuffer = '';\n }\n\n /**\n * @param {string} text\n * @param {string} scope\n */\n function emitKeyword(keyword, scope) {\n if (keyword === \"\") return;\n emitter.startScope(scope);\n emitter.addText(keyword);\n emitter.endScope();\n }\n\n /**\n * @param {CompiledScope} scope\n * @param {RegExpMatchArray} match\n */\n function emitMultiClass(scope, match) {\n let i = 1;\n const max = match.length - 1;\n while (i <= max) {\n if (!scope._emit[i]) {\n i++;\n continue;\n }\n const klass = language.classNameAliases[scope[i]] || scope[i];\n const text = match[i];\n if (klass) {\n emitKeyword(text, klass);\n } else {\n modeBuffer = text;\n processKeywords();\n modeBuffer = \"\";\n }\n i++;\n }\n }\n\n /**\n * @param {CompiledMode} mode - new mode to start\n * @param {RegExpMatchArray} match\n */\n function startNewMode(mode, match) {\n if (mode.scope && typeof mode.scope === \"string\") {\n emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);\n }\n if (mode.beginScope) {\n // beginScope just wraps the begin match itself in a scope\n if (mode.beginScope._wrap) {\n emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);\n modeBuffer = \"\";\n } else if (mode.beginScope._multi) {\n // at this point modeBuffer should just be the match\n emitMultiClass(mode.beginScope, match);\n modeBuffer = \"\";\n }\n }\n top = Object.create(mode, {\n parent: {\n value: top\n }\n });\n return top;\n }\n\n /**\n * @param {CompiledMode } mode - the mode to potentially end\n * @param {RegExpMatchArray} match - the latest match\n * @param {string} matchPlusRemainder - match plus remainder of content\n * @returns {CompiledMode | void} - the next mode, or if void continue on in current mode\n */\n function endOfMode(mode, match, matchPlusRemainder) {\n let matched = startsWith(mode.endRe, matchPlusRemainder);\n if (matched) {\n if (mode[\"on:end\"]) {\n const resp = new Response(mode);\n mode[\"on:end\"](match, resp);\n if (resp.isMatchIgnored) matched = false;\n }\n if (matched) {\n while (mode.endsParent && mode.parent) {\n mode = mode.parent;\n }\n return mode;\n }\n }\n // even if on:end fires an `ignore` it's still possible\n // that we might trigger the end node because of a parent mode\n if (mode.endsWithParent) {\n return endOfMode(mode.parent, match, matchPlusRemainder);\n }\n }\n\n /**\n * Handle matching but then ignoring a sequence of text\n *\n * @param {string} lexeme - string containing full match text\n */\n function doIgnore(lexeme) {\n if (top.matcher.regexIndex === 0) {\n // no more regexes to potentially match here, so we move the cursor forward one\n // space\n modeBuffer += lexeme[0];\n return 1;\n } else {\n // no need to move the cursor, we still have additional regexes to try and\n // match at this very spot\n resumeScanAtSamePosition = true;\n return 0;\n }\n }\n\n /**\n * Handle the start of a new potential mode match\n *\n * @param {EnhancedMatch} match - the current match\n * @returns {number} how far to advance the parse cursor\n */\n function doBeginMatch(match) {\n const lexeme = match[0];\n const newMode = match.rule;\n const resp = new Response(newMode);\n // first internal before callbacks, then the public ones\n const beforeCallbacks = [newMode.__beforeBegin, newMode[\"on:begin\"]];\n for (const cb of beforeCallbacks) {\n if (!cb) continue;\n cb(match, resp);\n if (resp.isMatchIgnored) return doIgnore(lexeme);\n }\n if (newMode.skip) {\n modeBuffer += lexeme;\n } else {\n if (newMode.excludeBegin) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (!newMode.returnBegin && !newMode.excludeBegin) {\n modeBuffer = lexeme;\n }\n }\n startNewMode(newMode, match);\n return newMode.returnBegin ? 0 : lexeme.length;\n }\n\n /**\n * Handle the potential end of mode\n *\n * @param {RegExpMatchArray} match - the current match\n */\n function doEndMatch(match) {\n const lexeme = match[0];\n const matchPlusRemainder = codeToHighlight.substring(match.index);\n const endMode = endOfMode(top, match, matchPlusRemainder);\n if (!endMode) {\n return NO_MATCH;\n }\n const origin = top;\n if (top.endScope && top.endScope._wrap) {\n processBuffer();\n emitKeyword(lexeme, top.endScope._wrap);\n } else if (top.endScope && top.endScope._multi) {\n processBuffer();\n emitMultiClass(top.endScope, match);\n } else if (origin.skip) {\n modeBuffer += lexeme;\n } else {\n if (!(origin.returnEnd || origin.excludeEnd)) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (origin.excludeEnd) {\n modeBuffer = lexeme;\n }\n }\n do {\n if (top.scope) {\n emitter.closeNode();\n }\n if (!top.skip && !top.subLanguage) {\n relevance += top.relevance;\n }\n top = top.parent;\n } while (top !== endMode.parent);\n if (endMode.starts) {\n startNewMode(endMode.starts, match);\n }\n return origin.returnEnd ? 0 : lexeme.length;\n }\n function processContinuations() {\n const list = [];\n for (let current = top; current !== language; current = current.parent) {\n if (current.scope) {\n list.unshift(current.scope);\n }\n }\n list.forEach(item => emitter.openNode(item));\n }\n\n /** @type {{type?: MatchType, index?: number, rule?: Mode}}} */\n let lastMatch = {};\n\n /**\n * Process an individual match\n *\n * @param {string} textBeforeMatch - text preceding the match (since the last match)\n * @param {EnhancedMatch} [match] - the match itself\n */\n function processLexeme(textBeforeMatch, match) {\n const lexeme = match && match[0];\n\n // add non-matched text to the current mode buffer\n modeBuffer += textBeforeMatch;\n if (lexeme == null) {\n processBuffer();\n return 0;\n }\n\n // we've found a 0 width match and we're stuck, so we need to advance\n // this happens when we have badly behaved rules that have optional matchers to the degree that\n // sometimes they can end up matching nothing at all\n // Ref: https://github.com/highlightjs/highlight.js/issues/2140\n if (lastMatch.type === \"begin\" && match.type === \"end\" && lastMatch.index === match.index && lexeme === \"\") {\n // spit the \"skipped\" character that our regex choked on back into the output sequence\n modeBuffer += codeToHighlight.slice(match.index, match.index + 1);\n if (!SAFE_MODE) {\n /** @type {AnnotatedError} */\n const err = new Error(`0 width match regex (${languageName})`);\n err.languageName = languageName;\n err.badRule = lastMatch.rule;\n throw err;\n }\n return 1;\n }\n lastMatch = match;\n if (match.type === \"begin\") {\n return doBeginMatch(match);\n } else if (match.type === \"illegal\" && !ignoreIllegals) {\n // illegal match, we do not continue processing\n /** @type {AnnotatedError} */\n const err = new Error('Illegal lexeme \"' + lexeme + '\" for mode \"' + (top.scope || '') + '\"');\n err.mode = top;\n throw err;\n } else if (match.type === \"end\") {\n const processed = doEndMatch(match);\n if (processed !== NO_MATCH) {\n return processed;\n }\n }\n\n // edge case for when illegal matches $ (end of line) which is technically\n // a 0 width match but not a begin/end match so it's not caught by the\n // first handler (when ignoreIllegals is true)\n if (match.type === \"illegal\" && lexeme === \"\") {\n // advance so we aren't stuck in an infinite loop\n return 1;\n }\n\n // infinite loops are BAD, this is a last ditch catch all. if we have a\n // decent number of iterations yet our index (cursor position in our\n // parsing) still 3x behind our index then something is very wrong\n // so we bail\n if (iterations > 100000 && iterations > match.index * 3) {\n const err = new Error('potential infinite loop, way more iterations than matches');\n throw err;\n }\n\n /*\n Why might be find ourselves here? An potential end match that was\n triggered but could not be completed. IE, `doEndMatch` returned NO_MATCH.\n (this could be because a callback requests the match be ignored, etc)\n This causes no real harm other than stopping a few times too many.\n */\n\n modeBuffer += lexeme;\n return lexeme.length;\n }\n const language = getLanguage(languageName);\n if (!language) {\n error(LANGUAGE_NOT_FOUND.replace(\"{}\", languageName));\n throw new Error('Unknown language: \"' + languageName + '\"');\n }\n const md = compileLanguage(language);\n let result = '';\n /** @type {CompiledMode} */\n let top = continuation || md;\n /** @type Record */\n const continuations = {}; // keep continuations for sub-languages\n const emitter = new options.__emitter(options);\n processContinuations();\n let modeBuffer = '';\n let relevance = 0;\n let index = 0;\n let iterations = 0;\n let resumeScanAtSamePosition = false;\n try {\n if (!language.__emitTokens) {\n top.matcher.considerAll();\n for (;;) {\n iterations++;\n if (resumeScanAtSamePosition) {\n // only regexes not matched previously will now be\n // considered for a potential match\n resumeScanAtSamePosition = false;\n } else {\n top.matcher.considerAll();\n }\n top.matcher.lastIndex = index;\n const match = top.matcher.exec(codeToHighlight);\n // console.log(\"match\", match[0], match.rule && match.rule.begin)\n\n if (!match) break;\n const beforeMatch = codeToHighlight.substring(index, match.index);\n const processedCount = processLexeme(beforeMatch, match);\n index = match.index + processedCount;\n }\n processLexeme(codeToHighlight.substring(index));\n } else {\n language.__emitTokens(codeToHighlight, emitter);\n }\n emitter.finalize();\n result = emitter.toHTML();\n return {\n language: languageName,\n value: result,\n relevance,\n illegal: false,\n _emitter: emitter,\n _top: top\n };\n } catch (err) {\n if (err.message && err.message.includes('Illegal')) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: true,\n relevance: 0,\n _illegalBy: {\n message: err.message,\n index,\n context: codeToHighlight.slice(index - 100, index + 100),\n mode: err.mode,\n resultSoFar: result\n },\n _emitter: emitter\n };\n } else if (SAFE_MODE) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: false,\n relevance: 0,\n errorRaised: err,\n _emitter: emitter,\n _top: top\n };\n } else {\n throw err;\n }\n }\n }\n\n /**\n * returns a valid highlight result, without actually doing any actual work,\n * auto highlight starts with this and it's possible for small snippets that\n * auto-detection may not find a better match\n * @param {string} code\n * @returns {HighlightResult}\n */\n function justTextHighlightResult(code) {\n const result = {\n value: escape(code),\n illegal: false,\n relevance: 0,\n _top: PLAINTEXT_LANGUAGE,\n _emitter: new options.__emitter(options)\n };\n result._emitter.addText(code);\n return result;\n }\n\n /**\n Highlighting with language detection. Accepts a string with the code to\n highlight. Returns an object with the following properties:\n - language (detected language)\n - relevance (int)\n - value (an HTML string with highlighting markup)\n - secondBest (object with the same structure for second-best heuristically\n detected language, may be absent)\n @param {string} code\n @param {Array} [languageSubset]\n @returns {AutoHighlightResult}\n */\n function highlightAuto(code, languageSubset) {\n languageSubset = languageSubset || options.languages || Object.keys(languages);\n const plaintext = justTextHighlightResult(code);\n const results = languageSubset.filter(getLanguage).filter(autoDetection).map(name => _highlight(name, code, false));\n results.unshift(plaintext); // plaintext is always an option\n\n const sorted = results.sort((a, b) => {\n // sort base on relevance\n if (a.relevance !== b.relevance) return b.relevance - a.relevance;\n\n // always award the tie to the base language\n // ie if C++ and Arduino are tied, it's more likely to be C++\n if (a.language && b.language) {\n if (getLanguage(a.language).supersetOf === b.language) {\n return 1;\n } else if (getLanguage(b.language).supersetOf === a.language) {\n return -1;\n }\n }\n\n // otherwise say they are equal, which has the effect of sorting on\n // relevance while preserving the original ordering - which is how ties\n // have historically been settled, ie the language that comes first always\n // wins in the case of a tie\n return 0;\n });\n const [best, secondBest] = sorted;\n\n /** @type {AutoHighlightResult} */\n const result = best;\n result.secondBest = secondBest;\n return result;\n }\n\n /**\n * Builds new class name for block given the language name\n *\n * @param {HTMLElement} element\n * @param {string} [currentLang]\n * @param {string} [resultLang]\n */\n function updateClassName(element, currentLang, resultLang) {\n const language = currentLang && aliases[currentLang] || resultLang;\n element.classList.add(\"hljs\");\n element.classList.add(`language-${language}`);\n }\n\n /**\n * Applies highlighting to a DOM node containing code.\n *\n * @param {HighlightedHTMLElement} element - the HTML element to highlight\n */\n function highlightElement(element) {\n /** @type HTMLElement */\n let node = null;\n const language = blockLanguage(element);\n if (shouldNotHighlight(language)) return;\n fire(\"before:highlightElement\", {\n el: element,\n language\n });\n if (element.dataset.highlighted) {\n console.log(\"Element previously highlighted. To highlight again, first unset `dataset.highlighted`.\", element);\n return;\n }\n\n // we should be all text, no child nodes (unescaped HTML) - this is possibly\n // an HTML injection attack - it's likely too late if this is already in\n // production (the code has likely already done its damage by the time\n // we're seeing it)... but we yell loudly about this so that hopefully it's\n // more likely to be caught in development before making it to production\n if (element.children.length > 0) {\n if (!options.ignoreUnescapedHTML) {\n console.warn(\"One of your code blocks includes unescaped HTML. This is a potentially serious security risk.\");\n console.warn(\"https://github.com/highlightjs/highlight.js/wiki/security\");\n console.warn(\"The element with unescaped HTML:\");\n console.warn(element);\n }\n if (options.throwUnescapedHTML) {\n const err = new HTMLInjectionError(\"One of your code blocks includes unescaped HTML.\", element.innerHTML);\n throw err;\n }\n }\n node = element;\n const text = node.textContent;\n const result = language ? highlight(text, {\n language,\n ignoreIllegals: true\n }) : highlightAuto(text);\n element.innerHTML = result.value;\n element.dataset.highlighted = \"yes\";\n updateClassName(element, language, result.language);\n element.result = {\n language: result.language,\n // TODO: remove with version 11.0\n re: result.relevance,\n relevance: result.relevance\n };\n if (result.secondBest) {\n element.secondBest = {\n language: result.secondBest.language,\n relevance: result.secondBest.relevance\n };\n }\n fire(\"after:highlightElement\", {\n el: element,\n result,\n text\n });\n }\n\n /**\n * Updates highlight.js global options with the passed options\n *\n * @param {Partial} userOptions\n */\n function configure(userOptions) {\n options = inherit(options, userOptions);\n }\n\n // TODO: remove v12, deprecated\n const initHighlighting = () => {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlighting() deprecated. Use highlightAll() now.\");\n };\n\n // TODO: remove v12, deprecated\n function initHighlightingOnLoad() {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlightingOnLoad() deprecated. Use highlightAll() now.\");\n }\n let wantsHighlight = false;\n\n /**\n * auto-highlights all pre>code elements on the page\n */\n function highlightAll() {\n // if we are called too early in the loading process\n if (document.readyState === \"loading\") {\n wantsHighlight = true;\n return;\n }\n const blocks = document.querySelectorAll(options.cssSelector);\n blocks.forEach(highlightElement);\n }\n function boot() {\n // if a highlight was requested before DOM was loaded, do now\n if (wantsHighlight) highlightAll();\n }\n\n // make sure we are in the browser environment\n if (typeof window !== 'undefined' && window.addEventListener) {\n window.addEventListener('DOMContentLoaded', boot, false);\n }\n\n /**\n * Register a language grammar module\n *\n * @param {string} languageName\n * @param {LanguageFn} languageDefinition\n */\n function registerLanguage(languageName, languageDefinition) {\n let lang = null;\n try {\n lang = languageDefinition(hljs);\n } catch (error$1) {\n error(\"Language definition for '{}' could not be registered.\".replace(\"{}\", languageName));\n // hard or soft error\n if (!SAFE_MODE) {\n throw error$1;\n } else {\n error(error$1);\n }\n // languages that have serious errors are replaced with essentially a\n // \"plaintext\" stand-in so that the code blocks will still get normal\n // css classes applied to them - and one bad language won't break the\n // entire highlighter\n lang = PLAINTEXT_LANGUAGE;\n }\n // give it a temporary name if it doesn't have one in the meta-data\n if (!lang.name) lang.name = languageName;\n languages[languageName] = lang;\n lang.rawDefinition = languageDefinition.bind(null, hljs);\n if (lang.aliases) {\n registerAliases(lang.aliases, {\n languageName\n });\n }\n }\n\n /**\n * Remove a language grammar module\n *\n * @param {string} languageName\n */\n function unregisterLanguage(languageName) {\n delete languages[languageName];\n for (const alias of Object.keys(aliases)) {\n if (aliases[alias] === languageName) {\n delete aliases[alias];\n }\n }\n }\n\n /**\n * @returns {string[]} List of language internal names\n */\n function listLanguages() {\n return Object.keys(languages);\n }\n\n /**\n * @param {string} name - name of the language to retrieve\n * @returns {Language | undefined}\n */\n function getLanguage(name) {\n name = (name || '').toLowerCase();\n return languages[name] || languages[aliases[name]];\n }\n\n /**\n *\n * @param {string|string[]} aliasList - single alias or list of aliases\n * @param {{languageName: string}} opts\n */\n function registerAliases(aliasList, {\n languageName\n }) {\n if (typeof aliasList === 'string') {\n aliasList = [aliasList];\n }\n aliasList.forEach(alias => {\n aliases[alias.toLowerCase()] = languageName;\n });\n }\n\n /**\n * Determines if a given language has auto-detection enabled\n * @param {string} name - name of the language\n */\n function autoDetection(name) {\n const lang = getLanguage(name);\n return lang && !lang.disableAutodetect;\n }\n\n /**\n * Upgrades the old highlightBlock plugins to the new\n * highlightElement API\n * @param {HLJSPlugin} plugin\n */\n function upgradePluginAPI(plugin) {\n // TODO: remove with v12\n if (plugin[\"before:highlightBlock\"] && !plugin[\"before:highlightElement\"]) {\n plugin[\"before:highlightElement\"] = data => {\n plugin[\"before:highlightBlock\"](Object.assign({\n block: data.el\n }, data));\n };\n }\n if (plugin[\"after:highlightBlock\"] && !plugin[\"after:highlightElement\"]) {\n plugin[\"after:highlightElement\"] = data => {\n plugin[\"after:highlightBlock\"](Object.assign({\n block: data.el\n }, data));\n };\n }\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function addPlugin(plugin) {\n upgradePluginAPI(plugin);\n plugins.push(plugin);\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function removePlugin(plugin) {\n const index = plugins.indexOf(plugin);\n if (index !== -1) {\n plugins.splice(index, 1);\n }\n }\n\n /**\n *\n * @param {PluginEvent} event\n * @param {any} args\n */\n function fire(event, args) {\n const cb = event;\n plugins.forEach(function (plugin) {\n if (plugin[cb]) {\n plugin[cb](args);\n }\n });\n }\n\n /**\n * DEPRECATED\n * @param {HighlightedHTMLElement} el\n */\n function deprecateHighlightBlock(el) {\n deprecated(\"10.7.0\", \"highlightBlock will be removed entirely in v12.0\");\n deprecated(\"10.7.0\", \"Please use highlightElement now.\");\n return highlightElement(el);\n }\n\n /* Interface definition */\n Object.assign(hljs, {\n highlight,\n highlightAuto,\n highlightAll,\n highlightElement,\n // TODO: Remove with v12 API\n highlightBlock: deprecateHighlightBlock,\n configure,\n initHighlighting,\n initHighlightingOnLoad,\n registerLanguage,\n unregisterLanguage,\n listLanguages,\n getLanguage,\n registerAliases,\n autoDetection,\n inherit,\n addPlugin,\n removePlugin\n });\n hljs.debugMode = function () {\n SAFE_MODE = false;\n };\n hljs.safeMode = function () {\n SAFE_MODE = true;\n };\n hljs.versionString = version;\n hljs.regex = {\n concat: concat,\n lookahead: lookahead,\n either: either,\n optional: optional,\n anyNumberOfTimes: anyNumberOfTimes\n };\n for (const key in MODES) {\n // @ts-ignore\n if (typeof MODES[key] === \"object\") {\n // @ts-ignore\n deepFreeze(MODES[key]);\n }\n }\n\n // merge all the modes/regexes into our main object\n Object.assign(hljs, MODES);\n return hljs;\n};\n\n// Other names for the variable may break build script\nconst highlight = HLJS({});\n\n// returns a new instance of the highlighter to be used for extensions\n// check https://github.com/wooorm/lowlight/issues/47\nhighlight.newInstance = () => HLJS({});\nmodule.exports = highlight;\nhighlight.HighlightJS = highlight;\nhighlight.default = highlight;","import { Component, Input, inject } from '@angular/core';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { CommonModule } from '@angular/common';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { AtlasModule } from '@galaxy/atlas';\nimport { ViewModeService } from '../../../../core/src/lib/view-mode.service';\nimport { Router } from '@angular/router';\nimport { GalaxyAiIconService } from '@vendasta/galaxy/ai-icon';\nimport { map } from 'rxjs';\n\n@Component({\n selector: 'inbox-ai-button',\n standalone: true,\n templateUrl: 'inbox-ai-button.component.html',\n styleUrls: ['./inbox-ai-button.component.scss'],\n imports: [CommonModule, TranslateModule, MatIconModule, MatTooltipModule, AtlasModule],\n})\nexport class InboxAIButtonComponent {\n @Input() isMobile = false;\n private readonly router = inject(Router);\n constructor(private readonly viewModeService: ViewModeService, private _: GalaxyAiIconService) {}\n\n readonly buttonSelected$ = this.viewModeService.isAIOpen$.pipe(\n map((isOpen) => (isOpen ? 'atlas-navbar__item-selected' : '')),\n );\n\n toggle(): void {\n this.viewModeService.toggleInboxAIOpen();\n }\n}\n","\n \n \n \n {{ 'INBOX.HEADER.INBOX_AI_TITLE' | translate }}\n \n \n\n\n\n \n
\n \n
\n \n
\n","import { Component, inject } from '@angular/core';\nimport { Router, RouterModule } from '@angular/router';\nimport { ConversationUIModule } from '../../../../ui/src/conversation-ui.module';\nimport { MatIconModule } from '@angular/material/icon';\nimport { GalaxyNavLayoutModule } from '@vendasta/galaxy/nav-layout';\nimport { GalaxyPageModule } from '@vendasta/galaxy/page';\nimport { GalaxyPageNavModule } from '@vendasta/galaxy/page-nav';\nimport { MatButtonModule } from '@angular/material/button';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { GalaxyBadgeModule } from '@vendasta/galaxy/badge';\nimport { GalaxyTooltipModule } from '@vendasta/galaxy/tooltip';\nimport { CommonModule } from '@angular/common';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\n\n@Component({\n selector: 'inbox-ai-overlay',\n standalone: true,\n templateUrl: './inbox-ai-overlay.component.html',\n styleUrls: ['./inbox-ai-overlay.component.scss'],\n imports: [\n CommonModule,\n RouterModule,\n ConversationUIModule,\n MatIconModule,\n GalaxyNavLayoutModule,\n GalaxyPageModule,\n GalaxyPageNavModule,\n MatButtonModule,\n TranslateModule,\n GalaxyBadgeModule,\n GalaxyTooltipModule,\n GalaxyLoadingSpinnerModule,\n ],\n})\nexport class AIChatInboxOverlayComponent {\n private readonly router = inject(Router);\n\n closeModal(): void {\n this.close();\n }\n private close(): void {\n this.router.navigate([{ outlets: { inbox: null } }], {\n queryParamsHandling: 'merge',\n });\n }\n}\n","\n \n \n {{ 'INBOX.HEADER.INBOX_AI_TITLE' | translate }}\n \n info_outline\n \n \n {{ 'INBOX.HEADER.BETA' | translate }}\n \n \n \n \n \n \n \n\n","import { Component, Inject } from '@angular/core';\nimport { GalaxyAlertModule } from '@vendasta/galaxy/alert';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { AsyncPipe, NgIf } from '@angular/common';\nimport { RegistrationStage, SmsRegistrationService } from '@galaxy/sms';\nimport { BehaviorSubject, combineLatest, map, Observable } from 'rxjs';\nimport {\n ACCOUNT_GROUP_ID_TOKEN,\n CONVERSATION_GOOGLE_BUSINESS_MESSAGES_AVAILABLE_TOKEN,\n CONVERSATION_SMS_ENABLED_TOKEN,\n} from '../../../core/src/lib/tokens';\nimport { InboxService } from '../../../core/src/lib/inbox.service';\n@Component({\n selector: 'inbox-alert-banner',\n standalone: true,\n imports: [GalaxyAlertModule, TranslateModule, AsyncPipe, NgIf],\n templateUrl: './inbox-alert-banner.component.html',\n})\nexport class InboxAlertBannerComponent {\n readonly registrationStatus$ = this.smsRegistrationService.registrationStage$;\n readonly registrationFormRoute$ = this.accountGroupId$.pipe(\n map((id) => `/account/location/${id}/settings/inbox/sms-registration`),\n );\n\n private readonly hideInboxAlertBanner$$ = new BehaviorSubject(false);\n readonly hideInboxAlertBanner$ = this.hideInboxAlertBanner$$.asObservable();\n\n readonly showGrandfatheringBanner$ = combineLatest([\n this.smsEnabled$,\n this.googleBusinessMessagesAvailable$,\n this.hideInboxAlertBanner$,\n this.inboxService.SMSNumber$,\n ]).pipe(\n map(([smsEnabled, googleBusinessMessagesAvailable, hideInboxAlertBanner, smsNumber]) => {\n return !smsEnabled && !googleBusinessMessagesAvailable && !hideInboxAlertBanner && !!smsNumber;\n }),\n );\n\n protected readonly RegistrationStage = RegistrationStage;\n\n constructor(\n private readonly smsRegistrationService: SmsRegistrationService,\n @Inject(ACCOUNT_GROUP_ID_TOKEN) private readonly accountGroupId$: Observable,\n @Inject(CONVERSATION_SMS_ENABLED_TOKEN) private smsEnabled$: Observable,\n @Inject(CONVERSATION_GOOGLE_BUSINESS_MESSAGES_AVAILABLE_TOKEN)\n private googleBusinessMessagesAvailable$: Observable,\n private readonly inboxService: InboxService,\n ) {}\n\n onBannerClosed(): void {\n this.hideInboxAlertBanner$$.next(true);\n }\n}\n","\n \n {{ 'INBOX.BANNER.SMS_UNAVAILABLE_TITLE' | translate }}\n {{ 'INBOX.BANNER.SMS_UNAVAILABLE_DESCRIPTION' | translate }}\n \n\n\n \n {{ 'INBOX.WARNING.A2P_BANNER_TITLE' | translate }}\n {{ 'INBOX.WARNING.A2P_REJECTED_BANNER_DESCRIPTION' | translate }}\n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, OnInit } from '@angular/core';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { TranslateModule } from '@ngx-translate/core';\n\nimport { AtlasModule } from '@galaxy/atlas';\nimport { CookieService } from 'ngx-cookie-service';\nimport { combineLatest, map, take } from 'rxjs';\nimport { FOLLOWING_VIEW_ID, ConversationService } from '../../../core/src/index';\nimport { ViewModeService } from '../../../core/src/lib/view-mode.service';\nimport { ConversationPipesModule } from '../../../pipes/src/pipes.module';\n\nconst cookieKeyInboxDefaultOpen = 'inbox-default-open';\nconst inboxFollowingViewId = 'following';\n\n@Component({\n selector: 'inbox-button',\n standalone: true,\n styleUrls: ['./inbox-button.component.scss'],\n templateUrl: 'inbox-button.component.html',\n imports: [CommonModule, TranslateModule, MatIconModule, MatTooltipModule, AtlasModule, ConversationPipesModule],\n})\nexport class InboxButtonComponent implements OnInit {\n readonly defaultViewId = FOLLOWING_VIEW_ID;\n constructor(\n private readonly viewModeService: ViewModeService,\n private readonly cookieService: CookieService,\n private readonly conversationService: ConversationService,\n ) {}\n\n ngOnInit() {\n combineLatest([\n this.viewModeService.viewMode$,\n this.conversationService.getUnreadConversationsCount(inboxFollowingViewId),\n ])\n .pipe(\n map(([viewMode, unreadMessagesCount]) => {\n const defaultOpen = this.getInboxDefaultOpen();\n if (viewMode === 'sidebar' && !defaultOpen && unreadMessagesCount > 0) {\n this.toggle();\n this.setInboxDefaultOpen();\n }\n }),\n take(1),\n )\n .subscribe();\n }\n readonly buttonSelected$ = this.viewModeService.isInboxOpen$.pipe(\n map((isOpen) => (isOpen ? 'atlas-navbar__item-selected' : '')),\n );\n\n toggle(): void {\n this.viewModeService.toggleInboxOpen();\n }\n\n private setInboxDefaultOpen(): void {\n this.cookieService.set(cookieKeyInboxDefaultOpen, 'opened');\n }\n\n private getInboxDefaultOpen(): string {\n return this.cookieService.get(cookieKeyInboxDefaultOpen);\n }\n}\n","\n","import { CommonModule } from '@angular/common';\nimport { Component, Inject, OnInit, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatDialog } from '@angular/material/dialog';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { ActivatedRoute, Router, RouterModule } from '@angular/router';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { AccountGroup } from '@vendasta/account-group';\nimport { BusinessSelectorDialogComponent, BusinessSelectorDialogModule } from '@vendasta/businesses';\nimport { ConversationChannel, GlobalParticipantType, SubjectParticipant } from '@vendasta/conversation';\nimport { GalaxyNavLayoutModule } from '@vendasta/galaxy/nav-layout';\nimport { GalaxyPageModule } from '@vendasta/galaxy/page';\nimport { GalaxyPageNavModule } from '@vendasta/galaxy/page-nav';\nimport { GalaxySnackbarModule, SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { ProductAnalyticsService } from '@vendasta/product-analytics';\nimport { filter, map, switchMap, take, tap, withLatestFrom } from 'rxjs';\nimport { ConversationListService } from '../../../core/src/lib/conversation-list.service';\nimport { toFirestoreId } from '../../../core/src/lib/conversation-utils';\nimport { ConversationService } from '../../../core/src/lib/conversation.service';\nimport { InboxService } from '../../../core/src/lib/inbox.service';\nimport { ConversationConfig } from '../../../core/src/lib/interface/config.interface';\nimport { SendMessage } from '../../../core/src/lib/interface/conversation.interface';\nimport { ParticipantService } from '../../../core/src/lib/participant.service';\nimport {\n ACCOUNT_GROUP_ID_TOKEN,\n CONVERSATION_CONFIG_TOKEN,\n CONVERSATION_HOST_APP_INTERFACE_TOKEN,\n PARTNER_ID_TOKEN,\n} from '../../../core/src/lib/tokens';\nimport { ViewMode } from '../../../core/src/lib/types';\nimport { ViewModeService } from '../../../core/src/lib/view-mode.service';\nimport { ViewService } from '../../../core/src/lib/view.service';\nimport { ConversationUIModule } from '../../../ui/src/conversation-ui.module';\n@Component({\n standalone: true,\n selector: 'inbox-container',\n imports: [\n CommonModule,\n TranslateModule,\n RouterModule,\n MatButtonModule,\n MatIconModule,\n MatProgressBarModule,\n GalaxyPageModule,\n GalaxySnackbarModule,\n GalaxyPageNavModule,\n GalaxyNavLayoutModule,\n ConversationUIModule,\n BusinessSelectorDialogModule,\n ],\n templateUrl: './inbox-container.component.html',\n styleUrls: ['./inbox-container.component.scss'],\n})\nexport class InboxContainerComponent implements OnInit {\n private readonly hostAppInterface = inject(CONVERSATION_HOST_APP_INTERFACE_TOKEN);\n private readonly participantService = inject(ParticipantService);\n\n protected readonly showNewMessageButton = !this.inboxConfig.hideNewMessageButton;\n protected readonly learnMoreUrl = this.inboxConfig.learnMoreUrl || '';\n\n protected readonly showSettings$ = this.inboxService.canAccessEmbeddedSettings$;\n protected readonly showInboxViews$ = this.inboxService.showInboxViews$;\n protected readonly viewMode$ = this.viewModeService.viewMode$;\n protected readonly isModal$ = this.viewMode$.pipe(map((mode) => mode === 'modal'));\n readonly organizationHasConversations$ = this.conversationListService.organizationHasConversations$;\n\n viewingConversation$ = this.conversationService.currentFirestoreConversationId$.pipe(\n map((conversationId) => !!conversationId),\n );\n\n private readonly partnerId = toSignal(inject(PARTNER_ID_TOKEN));\n private readonly accountGroupId = toSignal(inject(ACCOUNT_GROUP_ID_TOKEN));\n\n constructor(\n private readonly conversationService: ConversationService,\n private readonly conversationListService: ConversationListService,\n private readonly dialog: MatDialog,\n private readonly router: Router,\n private readonly route: ActivatedRoute,\n private readonly snackbar: SnackbarService,\n private readonly analyticsService: ProductAnalyticsService,\n @Inject(CONVERSATION_CONFIG_TOKEN) private readonly inboxConfig: ConversationConfig,\n private readonly inboxService: InboxService,\n private readonly viewModeService: ViewModeService,\n private readonly viewService: ViewService,\n ) {}\n\n ngOnInit(): void {\n this.showInboxViews$.pipe(\n take(1),\n withLatestFrom(this.viewService.selectedViewId$),\n map(([showInboxViews, selectedViewId]) => {\n if (showInboxViews) {\n this.router.navigate([{ outlets: { inbox: ['inbox', 'views', selectedViewId, 'conversations'] } }], {\n queryParamsHandling: 'preserve',\n });\n }\n }),\n );\n }\n\n closeModal(): void {\n this.viewModeService.toggleInboxOpen();\n }\n\n protected toggleView(state: ViewMode): void {\n const isFullView = state === 'sidebar';\n this.analyticsService.trackToggle('inbox-view-mode-toggle-state', isFullView);\n this.viewModeService.toggleViewMode();\n }\n\n // This modal will need to change if button is shown in any Task Manager or Vendor Center.\n // This modal will need to change if this component is put in Business App.\n // SMBs and Vendors don't have accounts to pick from.\n // Not sure the limitation for Task Manager; I anticipate it is because digital agents can start conversations with partners and accounts.\n newMessage(): void {\n const currentIAMParticipant$ = this.participantService.buildIAMUserParticipant();\n this.dialog\n .open(BusinessSelectorDialogComponent, {\n width: '500px',\n data: {\n partnerId: this.partnerId(),\n },\n })\n .afterClosed()\n .pipe(\n filter((business: AccountGroup) => !!business),\n withLatestFrom(currentIAMParticipant$),\n switchMap(([business, currentParticipant]) => {\n return this.hostAppInterface.buildSendMessageParams(\n currentParticipant,\n [\n new SubjectParticipant({\n internalParticipantId: this.partnerId(),\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_PARTNER,\n }),\n new SubjectParticipant({\n internalParticipantId: business.accountGroupId,\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_ACCOUNT_GROUP,\n }),\n ],\n ConversationChannel.CONVERSATION_CHANNEL_INTERNAL,\n );\n }),\n switchMap((sendMessage: SendMessage) =>\n this.conversationService.createConversation(\n sendMessage.participants ?? [],\n sendMessage.channel,\n sendMessage.location,\n ),\n ),\n tap((conversationDetails) => {\n if (!conversationDetails?.conversation) return;\n this.analyticsService.trackEvent('inbox', 'send-message', 'create-conversation-success', 0, {\n accountGroupId: this.accountGroupId(),\n partnerId: this.partnerId(),\n location: this.inboxService.platformLocation,\n channel: this.conversationService.getConversationChannel(),\n });\n }),\n switchMap((conversationResp) =>\n this.conversationService.getConversationDetail(conversationResp.conversation.conversationId),\n ),\n map((conversationDetails) => toFirestoreId(conversationDetails?.conversation?.conversationId)),\n )\n .subscribe({\n next: (conversationId) =>\n this.router.navigate(['conversations', conversationId], {\n relativeTo: this.route,\n }),\n error: (err) => {\n console.warn('Error to create a conversation: ', err);\n this.snackbar.openErrorSnack(err);\n this.analyticsService.trackEvent('inbox', 'send-message', 'create-conversation-error', 0, {\n accountGroupId: this.accountGroupId(),\n partnerId: this.partnerId(),\n location: this.inboxService.platformLocation,\n channel: this.conversationService.getConversationChannel(),\n message: err?.error?.message,\n });\n },\n });\n }\n}\n","\n \n \n {{ 'INBOX.HEADER.TITLE' | translate }}\n \n \n \n \n \n \n settings\n \n \n {{ (isModal$ | async) ? 'fullscreen_exit' : 'fullscreen' }}\n \n \n \n \n\n
\n \n
\n \n
\n\n \n
\n \n
\n","import { CommonModule } from '@angular/common';\nimport { Component, Input, OnDestroy, Optional } from '@angular/core';\nimport { MatDrawerMode, MatSidenavModule } from '@angular/material/sidenav';\nimport { RouterModule } from '@angular/router';\nimport { PageService } from '@vendasta/galaxy/page/src/page.service';\nimport { ViewModeService } from '../../../core/src/lib/view-mode.service';\nimport { InboxContainerComponent } from '../inbox-container/inbox-container.component';\n\n@Component({\n selector: 'inbox-inbox',\n standalone: true,\n imports: [CommonModule, RouterModule, MatSidenavModule, InboxContainerComponent],\n styleUrls: ['./inbox.component.scss'],\n templateUrl: './inbox.component.html',\n})\nexport class InboxComponent implements OnDestroy {\n @Input() modeType: MatDrawerMode = 'over';\n\n constructor(protected readonly viewModeService: ViewModeService, @Optional() private pageService: PageService) {}\n\n ngOnDestroy(): void {\n if (this.pageService) {\n this.pageService.pop();\n }\n }\n}\n","\n \n
\n \n
\n \n
\n\n \n \n \n
\n \n
\n \n\n \n \n \n
\n
\n
\n\n\n \n\n\n\n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, EventEmitter, Input, Output, inject } from '@angular/core';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatToolbarModule } from '@angular/material/toolbar';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { ParticipantType } from '@vendasta/conversation';\nimport { CardDataType, GalaxyContactInfoCardModule } from '@vendasta/galaxy/contact-info-card';\nimport { combineLatest, map } from 'rxjs';\nimport { ConversationService } from '../../../../../../../core/src/lib/conversation.service';\nimport { PARTNER_ID_TOKEN } from '../../../../../../../core/src/lib/tokens';\n\nconst detailsParticipantTypes = [\n ParticipantType.PARTICIPANT_TYPE_ACCOUNT_GROUP,\n ParticipantType.PARTICIPANT_TYPE_PARTNER,\n ParticipantType.PARTICIPANT_TYPE_VENDOR,\n];\n\n@Component({\n selector: 'inbox-conversation-details',\n standalone: true,\n imports: [CommonModule, MatToolbarModule, MatIconModule, TranslateModule, GalaxyContactInfoCardModule],\n templateUrl: './conversation-details.component.html',\n styleUrls: ['./conversation-details.component.scss'],\n})\nexport default class ConversationDetailsComponent {\n private conversationService = inject(ConversationService);\n private conversationDetail$ = this.conversationService.currentConversationDetail$;\n\n @Input() showTickets = false;\n\n @Output() ticketsClicked = new EventEmitter();\n\n private participants$ = this.conversationDetail$.pipe(map((conversations) => conversations?.participants || []));\n\n private readonly partnerId$ = inject(PARTNER_ID_TOKEN);\n\n readonly cardData$ = combineLatest([this.participants$, this.partnerId$]).pipe(\n map(([participants, currentPartnerId]) =>\n participants\n .filter((participant) => !!participant)\n .filter(\n (participant) =>\n participant?.isSubjectParticipant || detailsParticipantTypes.includes(participant.participantType),\n )\n .filter(\n (participant) =>\n !(\n participant.participantType === ParticipantType.PARTICIPANT_TYPE_PARTNER &&\n participant.partnerId === currentPartnerId\n ),\n )\n .map((participant) => {\n const {\n name,\n participantType,\n email,\n phoneNumber,\n profileImageUrl,\n partnerId,\n accountGroupId,\n internalParticipantId,\n } = participant;\n const { firstLineAddress, secondLineAddress, city, state, country, zipCode } = participant.address || {};\n const cardType = participantType === ParticipantType.PARTICIPANT_TYPE_IAM_USER ? 'user' : 'business';\n\n return {\n type: cardType,\n id: internalParticipantId || accountGroupId || partnerId,\n email: email,\n phone: phoneNumber,\n avatar: profileImageUrl,\n businessName: name,\n businessAddress: {\n address1: firstLineAddress,\n address2: secondLineAddress,\n city: city,\n state: state,\n country: country,\n zip: zipCode,\n },\n } as CardDataType;\n }),\n ),\n );\n}\n","
\n \n
\n
\n \n
\n","export enum ActiveSideView {\n Details = 'details',\n Tickets = 'tickets',\n}\n","import { CommonModule } from '@angular/common';\nimport { Component, HostListener, OnInit, computed, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatDrawerMode, MatSidenavModule } from '@angular/material/sidenav';\nimport { MatSnackBarModule } from '@angular/material/snack-bar';\nimport { MatToolbarModule } from '@angular/material/toolbar';\nimport { ActivatedRoute } from '@angular/router';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { ReplaySubject, combineLatest, distinctUntilChanged, map, shareReplay, skipWhile, switchMap, tap } from 'rxjs';\nimport { SUPPORT_PID } from '../../../core/src/lib/conversation.constants';\nimport { ConversationService } from '../../../core/src/lib/conversation.service';\nimport { PARTNER_ID_TOKEN } from '../../../core/src/lib/tokens';\nimport { ViewModeService } from '../../../core/src/lib/view-mode.service';\nimport { ConversationUIModule } from '../../../ui/src/conversation-ui.module';\nimport ConversationDetailsComponent from '../../../ui/src/pages/inbox-chat/components/inbox-info-pane/conversation-details/conversation-details.component';\nimport { InboxInfoDrawerService } from '../../../ui/src/pages/inbox-chat/components/inbox-info-pane/inbox-info-drawer.service';\nimport { ActiveSideView } from './types';\n\n@Component({\n standalone: true,\n imports: [\n MatSnackBarModule,\n CommonModule,\n ConversationUIModule,\n MatSidenavModule,\n MatIconModule,\n MatToolbarModule,\n TranslateModule,\n ConversationDetailsComponent,\n ],\n templateUrl: './chat.component.html',\n styleUrls: ['./chat.component.scss'],\n})\nexport class ChatComponent implements OnInit {\n readonly isDrawerOpen$ = this.inboxInfoDrawerService.isOpenDrawer$;\n readonly viewMode$ = this.viewModeService.viewMode$;\n activeSideView: ActiveSideView = ActiveSideView.Details;\n\n private readonly partnerId = toSignal(inject(PARTNER_ID_TOKEN));\n readonly isTicketsEnabled = computed(() => this.partnerId() === SUPPORT_PID);\n\n private drawerMode$$ = new ReplaySubject(1);\n readonly drawerMode$ = combineLatest([this.drawerMode$$.pipe(distinctUntilChanged()), this.viewMode$]).pipe(\n tap(([drawerMode, viewMode]) => {\n this.inboxInfoDrawerService.setIsOpen(viewMode === 'modal' && drawerMode === 'side');\n }),\n map(([drawerMode, viewMode]) => (viewMode === 'sidebar' ? 'over' : drawerMode)),\n distinctUntilChanged(),\n );\n\n protected readonly details$ = this.route.paramMap.pipe(\n map((params) => params.get('id')),\n switchMap((id) => this.conversationService.getConversationDetail(id)),\n skipWhile((details) => !details),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n\n constructor(\n private readonly conversationService: ConversationService,\n private readonly route: ActivatedRoute,\n private readonly inboxInfoDrawerService: InboxInfoDrawerService,\n private readonly viewModeService: ViewModeService,\n ) {}\n\n ngOnInit(): void {\n this.drawerMode$$.next(this.drawerMode);\n }\n\n back() {\n if (this.activeSideView === ActiveSideView.Details) {\n this.inboxInfoDrawerService.toggle();\n } else {\n this.activeSideView = ActiveSideView.Details;\n }\n }\n\n openTickets() {\n this.activeSideView = ActiveSideView.Tickets;\n }\n\n @HostListener('window:resize', ['$event'])\n onResize(): void {\n this.drawerMode$$.next(this.drawerMode);\n }\n\n private get drawerMode(): MatDrawerMode {\n return window.matchMedia('(max-width: 1100px)').matches ? 'over' : 'side';\n }\n}\n","\n \n \n \n \n \n \n \n\n

\n {{ 'INBOX.TICKETS.TITLE' | translate }}\n {{ 'INBOX.DETAILS.TITLE' | translate }}\n

\n
\n
\n \n \n \n \n \n \n \n
\n","import { Component } from '@angular/core';\nimport { ConversationUIModule } from '../../../ui/src/conversation-ui.module';\n\n@Component({\n standalone: true,\n imports: [ConversationUIModule],\n template: `\n \n `,\n styles: [\n `\n :host {\n width: 100%;\n }\n `,\n ],\n})\nexport class CreateContactComponent {}\n","import { Component } from '@angular/core';\nimport { ConversationUIModule } from '../../../ui/src/conversation-ui.module';\n\n@Component({\n standalone: true,\n imports: [ConversationUIModule],\n template: `\n \n `,\n styles: [\n `\n :host {\n width: 100%;\n }\n `,\n ],\n})\nexport class NewMessageComponent {}\n","import { CommonModule } from '@angular/common';\nimport { Component, Input, booleanAttribute } from '@angular/core';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { GalaxyAlertModule } from '@vendasta/galaxy/alert';\nimport { GalaxyChatModule } from '@vendasta/galaxy/chat';\n\n@Component({\n selector: 'inbox-preview',\n standalone: true,\n imports: [CommonModule, GalaxyChatModule, MatIconModule, MatCardModule, GalaxyAlertModule, TranslateModule],\n templateUrl: './inbox-preview.component.html',\n styleUrls: ['./inbox-preview.component.scss'],\n})\nexport class InboxPreviewComponent {\n fakeText = ' '.repeat(60);\n\n @Input({ transform: booleanAttribute }) showAvailabilityMessage = false;\n @Input() availabilityMessage = '';\n}\n","\n \n
\n
\n {{ 'INBOX.SETTINGS.PREVIEW.TITLE' | translate }}\n
\n
\n more_vert\n
\n
\n
\n \n {{ availabilityMessage }}\n \n
\n
\n \n \n \n\n \n\n \n\n \n \n \n
\n","import { Component } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { MatButtonModule } from '@angular/material/button';\nimport { TranslateModule } from '@ngx-translate/core';\n\n@Component({\n standalone: true,\n imports: [CommonModule, MatDialogModule, MatButtonModule, TranslateModule],\n templateUrl: './email-forwarding-info.component.html',\n styleUrl: './email-forwarding-info.component.scss',\n})\nexport class EmailForwardingInfoComponent {}\n","
{{ 'INBOX.SETTINGS.EMAIL_SETTINGS.FORWARDING_ADDRESS_INFO_TITLE' | translate }}
\n\n
\n
\n\n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, inject, computed } from '@angular/core';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { GalaxyPopoverModule } from '@vendasta/galaxy/popover';\nimport { CdkOverlayOrigin } from '@angular/cdk/overlay';\nimport { MatButton, MatIconButton } from '@angular/material/button';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { EmailForwardingInfoComponent } from './email-forwarding-info/email-forwarding-info.component';\nimport { MatDialog } from '@angular/material/dialog';\nimport { Clipboard } from '@angular/cdk/clipboard';\nimport { MatTooltip } from '@angular/material/tooltip';\nimport { GalaxyTooltipModule } from '@vendasta/galaxy/tooltip';\nimport { InboxService, COMPANY_NAME_TOKEN, ACCOUNT_GROUP_ID_TOKEN } from '../../../../core/src';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { FormsModule } from '@angular/forms';\nimport { GlobalParticipantType, EmailApiService } from '@vendasta/conversation';\nimport { map, switchMap, catchError, shareReplay, of, Observable } from 'rxjs';\n@Component({\n standalone: true,\n selector: 'inbox-email-settings-card',\n imports: [\n CommonModule,\n MatIconModule,\n MatCardModule,\n TranslateModule,\n GalaxyPopoverModule,\n CdkOverlayOrigin,\n MatButton,\n MatIconButton,\n GalaxyFormFieldModule,\n MatTooltip,\n GalaxyTooltipModule,\n FormsModule,\n ],\n templateUrl: './email-settings-card.component.html',\n styleUrl: './email-settings-card.component.scss',\n})\nexport class EmailSettingsCardComponent {\n private readonly emailApiService = inject(EmailApiService);\n private readonly accountGroupId$ = inject(ACCOUNT_GROUP_ID_TOKEN);\n private readonly user = toSignal(inject(InboxService).iamUser$);\n private readonly companyName = toSignal(inject(COMPANY_NAME_TOKEN));\n readonly forwardingAddress = toSignal(this.getForwardingAddress());\n constructor(\n private dialog: MatDialog,\n private clipboard: Clipboard,\n ) {}\n\n protected showPopover = false;\n protected isCopied = false;\n forwardingEmailTitle = computed(() => {\n const user = this.user();\n const companyName = this.companyName();\n return {\n firstName: user?.firstName,\n companyName: companyName,\n translationKey: user?.firstName\n ? 'INBOX.SETTINGS.EMAIL_SETTINGS.USER_AT_COMPANY'\n : 'INBOX.SETTINGS.EMAIL_SETTINGS.COMPANY_ONLY',\n };\n });\n\n openLearnMoreModal(): void {\n this.dialog.open(EmailForwardingInfoComponent, { width: '600px' });\n }\n\n copyClicked() {\n this.isCopied = true;\n this.clipboard.copy(this.forwardingAddress());\n setTimeout(() => {\n this.isCopied = false;\n }, 5000);\n }\n\n getForwardingAddress(): Observable {\n return this.accountGroupId$.pipe(\n switchMap((accountGroupId) => {\n return this.emailApiService\n .getOwnerEmail({\n subjectParticipant: {\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_ACCOUNT_GROUP,\n internalParticipantId: accountGroupId,\n },\n })\n .pipe(catchError(() => of({ forwardingEmail: '' })));\n }),\n map((emailRes) => {\n return emailRes.forwardingEmail ?? '';\n }),\n catchError(() => of('')),\n shareReplay(1),\n );\n }\n}\n","\n \n \n {{ 'INBOX.SETTINGS.EMAIL_SETTINGS.TITLE' | translate }}\n \n \n
\n {{ 'INBOX.SETTINGS.EMAIL_SETTINGS.DESCRIPTION' | translate }}\n \n info_outline\n \n
\n
\n \n \n person\n {{\n forwardingEmailTitle().translationKey | translate: forwardingEmailTitle()\n }}\n <{{ this.forwardingAddress() }}>\n \n \n
\n \n {{ 'INBOX.SETTINGS.EMAIL_SETTINGS.FORWARDING_ADDRESS' | translate }}\n \n \n content_copy\n \n \n {{ 'INBOX.SETTINGS.EMAIL_SETTINGS.FORWARDING_ADDRESS_DESCRIPTION' | translate }}\n {{ 'INBOX.SETTINGS.EMAIL_SETTINGS.LEARN_MORE' | translate }}\n \n \n
\n
\n","import { HttpClient, HttpErrorResponse } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { FacebookApiService, TokenStatus } from '@vendasta/facebook';\nimport { Observable, catchError, firstValueFrom, map, of, shareReplay } from 'rxjs';\nimport {\n AuthLinksResponse,\n SocialConnectionLinks,\n SocialConnections,\n SocialPageFacebook,\n VAPIResponse,\n} from '../interfaces';\n\nexport interface FacebookPageConnectionInfo {\n name: string;\n tokenStatus: TokenStatus;\n messengerEnabled: boolean;\n isAssignedPageOwner: boolean;\n statusCheckPermissionError?: boolean;\n}\n\n@Injectable({\n providedIn: 'any',\n})\nexport class FacebookMessengerService {\n private readonly fbAPIService = inject(FacebookApiService);\n private readonly http = inject(HttpClient);\n\n connectPage(accountID: string, facebookPageData: SocialPageFacebook): Observable {\n const facebookPageID = facebookPageData.profileUrl?.split('id=')[1] ?? '';\n if (!facebookPageID) {\n return of(false);\n }\n\n return this.fbAPIService\n .assignFacebookPageOwner({\n organizationId: accountID,\n facebookPageId: facebookPageID,\n })\n .pipe(\n map(() => {\n return true;\n }),\n catchError(() => {\n return of(false);\n }),\n );\n }\n\n async redirectToFacebookAuth(accountID: string): Promise {\n const protocol = window.location.protocol;\n const host = window.location.host;\n const baseUrl = `${protocol}//${host}`;\n const newUrl: URL = new URL(baseUrl);\n newUrl.pathname = `/account/location/${accountID}/settings/connections/target/inbox`;\n\n const authUrls = await firstValueFrom(this.getAuthUrls(accountID, newUrl));\n const serviceAuthURL = authUrls.facebook;\n const serviceName = 'Facebook';\n const oauthUrl = [\n serviceAuthURL.slice(0, serviceAuthURL.indexOf('&spid')),\n `?type=${serviceName}&includeMessengerScopes=true`,\n serviceAuthURL.slice(serviceAuthURL.indexOf('&spid')),\n ].join('');\n window.location.href = oauthUrl;\n }\n\n disconnectPage(accountID: string, facebookPageData: SocialPageFacebook): Observable {\n const facebookPageID = facebookPageData.profileUrl?.split('id=')[1] ?? '';\n if (!facebookPageID) {\n return of(false);\n }\n\n return this.fbAPIService\n .disableMessengerForPage({\n organizationId: accountID,\n facebookPageId: facebookPageID,\n })\n .pipe(\n map(() => true),\n catchError(() => of(false)),\n );\n }\n\n getPagesForAccount(accountGroupId: string): Observable {\n return this.getSocialProfileConnections(accountGroupId).pipe(\n map((connections) => {\n let fbPages: SocialPageFacebook[] = [];\n const fbUsers = connections.facebook ?? [];\n for (const fbUser of fbUsers) {\n fbPages = fbPages.concat(\n fbUser.pages.map((page: SocialPageFacebook) => {\n page.facebookUserID = fbUser.ssid.split('-')[1];\n return page;\n }),\n );\n }\n return fbPages;\n }),\n );\n }\n\n getPageInfo(\n facebookPageData: SocialPageFacebook,\n partnerID: string,\n accountGroupID: string,\n ): Observable {\n const enabledForPage$ = this.fbAPIService.facebookPageMessengerState({\n organizationId: partnerID + ':' + accountGroupID,\n pageId: facebookPageData.profileUrl?.split('id=')[1],\n facebookUserId: facebookPageData.facebookUserID,\n });\n\n return enabledForPage$.pipe(\n map((enabledForPage) => {\n return {\n name: facebookPageData.name,\n tokenStatus: TokenStatus.VALID,\n messengerEnabled: !!enabledForPage.messengerEnabled,\n isAssignedPageOwner: !!enabledForPage.isPageOwner,\n };\n }),\n catchError((e: HttpErrorResponse) => {\n const statusCheckPermissionError = e.status === 403;\n return of({\n name: facebookPageData.name,\n tokenStatus: TokenStatus.UNKNOWN,\n messengerEnabled: false,\n isAssignedPageOwner: false,\n statusCheckPermissionError,\n });\n }),\n );\n }\n\n private getSocialProfileConnections(accountGroupId: string): Observable {\n return this.http\n .get('/ajax/v1/get-social-profile-connections/', {\n params: {\n accountGroupId: accountGroupId,\n },\n })\n .pipe(\n map((response) => response.data),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n }\n\n private getAuthUrls(accountGroupId: string, nextUrl: URL): Observable {\n let newUrl = nextUrl.href;\n const urlParts = nextUrl.pathname.split('/');\n urlParts.forEach((part) => {\n if (part.startsWith('AG-')) {\n newUrl = newUrl.replace(part, accountGroupId);\n }\n });\n return this.http\n .get('/ajax/v1/get-auth-urls/', {\n params: {\n accountGroupId: accountGroupId,\n nextUrl: newUrl,\n },\n })\n .pipe(\n map((response) => {\n return response.data;\n }),\n );\n }\n}\n","import { Capacitor } from '@capacitor/core';\n\nexport function isNativeApp(): boolean {\n return Capacitor.isNativePlatform();\n}\n","import { registerPlugin } from '@capacitor/core';\nconst Browser = registerPlugin('Browser', {\n web: () => import('./web').then(m => new m.BrowserWeb())\n});\nexport * from './definitions';\nexport { Browser };\n","import { CommonModule } from '@angular/common';\nimport { Component, Input, inject, signal } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { Browser } from '@capacitor/browser';\nimport { PARTNER_ID_TOKEN } from '../../../../core/src/index';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { DomainService } from '@vendasta/domain';\nimport { firstValueFrom, map, shareReplay, switchMap } from 'rxjs';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\n\n@Component({\n standalone: true,\n selector: 'inbox-manage-on-web',\n templateUrl: './manage-on-web.component.html',\n styleUrls: ['./manage-on-web.component.scss'],\n imports: [CommonModule, TranslateModule, MatButtonModule, MatProgressSpinnerModule],\n providers: [DomainService],\n})\nexport class ManageOnWebComponent {\n @Input() description?: string;\n @Input() url?: string;\n\n private readonly domainService = inject(DomainService);\n private readonly snackbarService = inject(SnackbarService);\n private readonly partnerId$ = inject(PARTNER_ID_TOKEN);\n\n private readonly currentHost$ = this.partnerId$.pipe(\n switchMap((partnerId) => this.domainService.getDomainByIdentifier(`/application/VBC/partner/${partnerId}`)),\n map((resp) => {\n const scheme = resp.primary.secure ? 'https://' : 'http://';\n return scheme + resp.primary.domain;\n }),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n\n readonly isLoading = signal(false);\n\n async openInWeb(): Promise {\n this.isLoading.set(true);\n try {\n const host = await firstValueFrom(this.currentHost$);\n await Browser.open({\n url: this.url ? this.url : host + window.location.pathname,\n presentationStyle: 'popover',\n });\n } catch (error) {\n console.error('Failed to open in web', error);\n this.snackbarService.openErrorSnack('INBOX.SETTINGS.MANAGE_ON_WEB_ERROR');\n }\n this.isLoading.set(false);\n }\n}\n","
\n {{ description }}\n
\n\n","import { CommonModule } from '@angular/common';\nimport { Component, computed, Input, OnChanges, Signal, signal, SimpleChanges } from '@angular/core';\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { GalaxyAlertModule } from '@vendasta/galaxy/alert';\nimport { GalaxyBadgeModule } from '@vendasta/galaxy/badge';\nimport { GalaxyPopoverModule } from '@vendasta/galaxy/popover';\nimport { GalaxySnackbarModule, SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { filter, firstValueFrom, switchMap } from 'rxjs';\nimport { SocialPageFacebook } from '../interfaces';\nimport { FacebookMessengerService, FacebookPageConnectionInfo } from './facebook-messenger.service';\nimport { TokenStatus } from '@vendasta/facebook';\nimport { isNativeApp } from '../../../../core/src/lib/mobile';\nimport { ManageOnWebComponent } from '../manage-on-web/manage-on-web.component';\n\ntype badgeValue = {\n color: 'red' | 'green';\n i18nKey: string;\n};\n\ntype displayedButton = 'sign-in' | 'enable' | 'disable' | null;\n\n@Component({\n selector: 'inbox-facebook-messenger',\n standalone: true,\n imports: [\n CommonModule,\n MatCardModule,\n MatIconModule,\n MatButtonModule,\n TranslateModule,\n GalaxyBadgeModule,\n MatProgressSpinnerModule,\n GalaxyAlertModule,\n GalaxyPopoverModule,\n GalaxySnackbarModule,\n ManageOnWebComponent,\n ],\n templateUrl: './facebook-messenger.component.html',\n styleUrl: './facebook-messenger.component.scss',\n})\nexport class FacebookMessengerComponent implements OnChanges {\n readonly isNativeApp = isNativeApp();\n\n readonly loading = computed(() => this.loadingAccounts() || this.loadingPage());\n private readonly loadingAccounts = signal(true);\n private readonly loadingPage = signal(false);\n\n readonly pageName: Signal;\n readonly badgeValue: Signal;\n readonly manyPages: Signal;\n readonly noPages: Signal;\n readonly buttonToDisplay: Signal;\n readonly authTokenMissingPermissions: Signal;\n readonly unknownError: Signal;\n // user does not have required auth to view connection status, connect, or disconnect\n readonly authError: Signal;\n readonly messengerEnabled: Signal;\n\n private readonly connectedPages = signal([]);\n private readonly pageInfo = signal(null);\n\n @Input({ required: true }) accountID = '';\n @Input({ required: true }) partnerID = '';\n\n constructor(\n private readonly facebookMessengerService: FacebookMessengerService,\n private readonly snackbarService: SnackbarService,\n ) {\n this.manyPages = computed(() => {\n return this.connectedPages().length > 1;\n });\n\n this.noPages = computed(() => {\n return this.connectedPages().length === 0;\n });\n\n toObservable(this.connectedPages)\n .pipe(\n takeUntilDestroyed(),\n filter((connectedPages) => connectedPages.length > 0),\n switchMap((connectedPages) =>\n this.facebookMessengerService.getPageInfo(connectedPages[0], this.partnerID, this.accountID),\n ),\n )\n .subscribe((pageInfo) => {\n this.loadingPage.set(false);\n this.pageInfo.set(pageInfo);\n });\n\n this.messengerEnabled = computed(\n () =>\n (this.pageInfo()?.messengerEnabled &&\n this.pageInfo()?.tokenStatus === TokenStatus.VALID &&\n this.pageInfo()?.isAssignedPageOwner) ??\n false,\n );\n\n this.badgeValue = computed(() => {\n return {\n color: this.messengerEnabled() ? 'green' : 'red',\n i18nKey: this.messengerEnabled() ? 'INBOX.SETTINGS.ACTIVE' : 'INBOX.SETTINGS.INACTIVE',\n };\n });\n this.pageName = computed(() => this.pageInfo()?.name ?? '');\n this.authTokenMissingPermissions = computed(() => this.pageInfo()?.tokenStatus === TokenStatus.MISSING_PERMISSIONS);\n this.unknownError = computed(() => this.pageInfo()?.tokenStatus === TokenStatus.INVALID);\n this.authError = computed(() => this.pageInfo()?.statusCheckPermissionError ?? false);\n\n this.buttonToDisplay = computed(() => {\n if (this.noPages()) {\n return 'sign-in';\n } else if (this.messengerEnabled()) {\n return 'disable';\n } else if (this.unknownError()) {\n return null;\n } else if (!this.messengerEnabled() && this.pageInfo()?.tokenStatus === TokenStatus.VALID) {\n return 'enable';\n } else {\n return null;\n }\n });\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['accountID']) {\n this.loadingAccounts.set(true);\n firstValueFrom(this.facebookMessengerService.getPagesForAccount(changes['accountID'].currentValue))\n .then((pages) => {\n if (pages.length > 0) {\n this.connectedPages.set(pages);\n this.loadingPage.set(true);\n } else {\n this.connectedPages.set([]);\n }\n })\n .catch(() => {\n this.connectedPages.set([]);\n })\n .finally(() => {\n this.loadingAccounts.set(false);\n });\n }\n }\n\n authClick() {\n this.facebookMessengerService.redirectToFacebookAuth(this.accountID);\n }\n\n async connect(): Promise {\n this.loadingAccounts.set(true);\n return firstValueFrom(this.facebookMessengerService.connectPage(this.accountID, this.connectedPages()[0]))\n .then((success) => {\n if (success) {\n this.snackbarService.openSuccessSnack('INBOX.SETTINGS.FACEBOOK_MESSENGER.SUCCESS.SUCCESSFULLY_ENABLED');\n const pages = this.connectedPages();\n this.connectedPages.update(() => []); // update only emmits if the value changes\n this.connectedPages.update(() => pages);\n } else {\n this.snackbarService.openErrorSnack('INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.FAILED_TO_ENABLE');\n }\n })\n .finally(() => this.loadingAccounts.set(false));\n }\n\n async disconnect(): Promise {\n this.loadingAccounts.set(true);\n return firstValueFrom(this.facebookMessengerService.disconnectPage(this.accountID, this.connectedPages()[0]))\n .then((success) => {\n if (success) {\n this.snackbarService.openSuccessSnack('INBOX.SETTINGS.FACEBOOK_MESSENGER.SUCCESS.SUCCESSFULLY_DISABLED');\n const pages = this.connectedPages();\n this.connectedPages.update(() => []); // update only emmits if the value changes\n this.connectedPages.update(() => pages);\n } else {\n this.snackbarService.openErrorSnack('INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.FAILED_TO_DISABLE');\n }\n })\n .finally(() => this.loadingAccounts.set(false));\n }\n}\n","\n \n \n \n {{ badgeValue()!.i18nKey | translate }}\n \n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.TITLE' | translate }}\n \n \n
\n \n
\n \n \n

\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.DESCRIPTION' | translate }}\n

\n

\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.DISCONNECTED_DESCRIPTION' | translate }}\n

\n

\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.FACEBOOK_PAGE_NAME' | translate }}: \n \n {{ pageName() }}\n \n

\n

\n \n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.TURN_ON_MESSAGING' | translate }}\n \n \n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.SIGN_IN_TO_FACEBOOK' | translate }}\n \n \n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.DISCONNECT' | translate }}\n \n

\n \n

\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.UNKNOWN_ERROR' | translate }}\n
\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.PLEASE_TRY_RECONNECTING' | translate }}\n

\n \n \n

\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.PERMISSIONS_ERROR' | translate }}\n
\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.PERMISSIONS_ERROR_DESCRIPTION' | translate }}\n

\n
\n \n

\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.PERMISSIONS_ERROR' | translate }}\n
\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.RECONNECT_TO_GRANT_PERMISSIONS' | translate }}\n

\n \n \n

\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.WARNINGS.MULTIPLE_PAGES_LINKED' | translate }}\n
\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.WARNINGS.MULTIPLE_PAGES_LINKED_DESCRIPTION' | translate }}\n \n

\n
\n
\n
\n
\n
\n\n\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.DISCONNECT_TITLE' | translate }}\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.DISCONNECT_DESCRIPTION' | translate }}\n \n \n \n \n\n\n\n \n\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable, map, shareReplay } from 'rxjs';\nimport { AuthLinksResponse, SocialConnectionLinks, SocialConnections, VAPIResponse } from '../interfaces';\n\n@Injectable()\nexport class GoogleBusinessConnectionsService {\n constructor(private readonly http: HttpClient) {}\n\n getAuthUrls(accountGroupId: string, nextUrl: URL): Observable {\n let newUrl = nextUrl.href;\n const urlParts = nextUrl.pathname.split('/');\n urlParts.forEach((part) => {\n if (part.startsWith('AG-')) {\n newUrl = newUrl.replace(part, accountGroupId);\n }\n });\n return this.http\n .get('/ajax/v1/get-auth-urls/', {\n params: {\n accountGroupId: accountGroupId,\n nextUrl: newUrl,\n },\n })\n .pipe(\n map((response) => {\n return response.data;\n }),\n );\n }\n\n getSocialProfileConnections(accountGroupId: string): Observable {\n return this.http\n .get('/ajax/v1/get-social-profile-connections/', {\n params: {\n accountGroupId: accountGroupId,\n },\n })\n .pipe(\n map((response) => response.data),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { HttpClient, HttpErrorResponse } from '@angular/common/http';\nimport { Component, Inject, InjectionToken, Signal, computed, inject, signal } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatBadgeModule } from '@angular/material/badge';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { AccountGroupService as AccountGroupSDK, ProjectionFilter } from '@galaxy/account-group';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { GalaxyAlertModule } from '@vendasta/galaxy/alert';\nimport { GalaxyBadgeModule } from '@vendasta/galaxy/badge';\nimport { GalaxyButtonLoadingIndicatorModule } from '@vendasta/galaxy/button-loading-indicator';\nimport { GalaxyPopoverModule } from '@vendasta/galaxy/popover';\nimport { GalaxyTooltipModule } from '@vendasta/galaxy/tooltip';\nimport { BusinessCommunicationsApiService } from '@vendasta/google-my-business';\nimport { Observable, firstValueFrom, lastValueFrom, map, shareReplay, switchMap } from 'rxjs';\nimport { ACCOUNT_GROUP_ID_TOKEN, PARTNER_ID_TOKEN } from '../../../../core/src/lib/tokens';\nimport { SocialConnectionLinks, SocialPageMeta } from '../interfaces';\nimport { GoogleBusinessConnectionsService } from './google-business-connections.service';\nimport { isNativeApp } from '../../../../core/src/lib/mobile';\nimport { ManageOnWebComponent } from '../manage-on-web/manage-on-web.component';\n\n// gbp = Google Business Profile\ntype alertTypes = 'no-alert' | 'auth-insufficient' | 'gbp-not-connected' | 'gbp-not-verified' | 'setup-blocked';\n\nconst googleBusinessConnectionsServiceToken = new InjectionToken(\n 'GoogleBusinessConnectionsService',\n);\n\nfunction googleBusinessConnectionsServiceFactory(): GoogleBusinessConnectionsService {\n try {\n return inject(GoogleBusinessConnectionsService);\n } catch (e) {\n return new GoogleBusinessConnectionsService(inject(HttpClient));\n }\n}\n\n@Component({\n standalone: true,\n selector: 'inbox-google-business-communication-card',\n templateUrl: './google-business-communication-card.component.html',\n styleUrls: ['./google-business-communication-card.component.scss'],\n imports: [\n CommonModule,\n GalaxyBadgeModule,\n MatButtonModule,\n MatCardModule,\n MatBadgeModule,\n FormsModule,\n GalaxyButtonLoadingIndicatorModule,\n MatProgressSpinnerModule,\n GalaxyAlertModule,\n MatIconModule,\n GalaxyTooltipModule,\n GalaxyBadgeModule,\n GalaxyPopoverModule,\n TranslateModule,\n ManageOnWebComponent,\n ],\n providers: [\n {\n provide: googleBusinessConnectionsServiceToken,\n useFactory: googleBusinessConnectionsServiceFactory,\n },\n ],\n})\nexport class GoogleBusinessCommunicationCardComponent {\n private loadingEnabledStatus = signal(true);\n private loadingCanEnable = signal(true);\n\n private readonly socialProfileId$: Observable;\n\n // this means the feature is active\n readonly googleBusinessMessagesEnabled = signal(false);\n readonly canEnable = signal(false);\n readonly setupBlocked = signal(false);\n readonly isNativeApp = isNativeApp();\n\n readonly loading: Signal;\n showAlert: Signal;\n badgeColor: Signal<'red' | 'green'>;\n\n readonly businessInfo = signal(null);\n private readonly loadingGoogleBusinessConnectionStatus = signal(true);\n private readonly googleBusinessProfileConnected = computed(() => this.businessInfo() !== null);\n private readonly googleBusinessProfileVerified = computed(() => this.businessInfo()?.isVerified ?? false);\n\n cardDescription: Signal;\n\n actionErrors = signal<{ title: string; description: string } | null>(null);\n\n private serviceName = 'googleplus';\n\n constructor(\n @Inject(PARTNER_ID_TOKEN) private readonly partnerId$: Observable,\n @Inject(ACCOUNT_GROUP_ID_TOKEN) readonly accountGroupId$: Observable,\n private readonly googleMyBusinessService: BusinessCommunicationsApiService,\n private readonly accountGroupSDK: AccountGroupSDK,\n private readonly router: Router,\n private readonly route: ActivatedRoute,\n @Inject(googleBusinessConnectionsServiceToken)\n private readonly gBizConnectionsService: GoogleBusinessConnectionsService,\n ) {\n this.socialProfileId$ = this.accountGroupId$.pipe(\n switchMap((agid) => {\n const pf = new ProjectionFilter({\n accountGroupExternalIdentifiers: true,\n });\n return this.accountGroupSDK.get(agid, pf).pipe(map((ag) => ag.externalIdentifiers.socialProfileId));\n }),\n shareReplay(1),\n );\n\n this.initGoogleBusinessMessagesEnabledStatus();\n this.initCanEnableBusinessCommunications();\n this.initGoogleBusinessProfileConnectionStatus();\n\n this.loading = computed(\n () => this.loadingEnabledStatus() || this.loadingCanEnable() || this.loadingGoogleBusinessConnectionStatus(),\n );\n\n this.showAlert = computed(() => {\n if (this.loading()) return 'no-alert';\n // User attempted to connect and an un-retryable error occurred\n if (this.setupBlocked()) return 'setup-blocked';\n if (!this.googleBusinessProfileConnected()) return 'gbp-not-connected';\n if (this.googleBusinessProfileConnected() && !this.googleBusinessProfileVerified()) return 'gbp-not-verified';\n // Checks if the Google Business Profile access token is valid and has the required scopes\n if (this.googleBusinessProfileConnected() && !this.canEnable()) return 'auth-insufficient';\n return 'no-alert';\n });\n\n this.badgeColor = computed(() => {\n return this.googleBusinessMessagesEnabled() ? 'green' : 'red';\n });\n\n this.cardDescription = computed(() => {\n if (!this.googleBusinessMessagesEnabled() && !this.loading()) {\n return 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.CONNECT_DESCRIPTION';\n }\n return '';\n });\n }\n\n private async initGoogleBusinessMessagesEnabledStatus() {\n this.loadingEnabledStatus.set(true);\n const partnerId = await firstValueFrom(this.partnerId$);\n const accountGroupId = await firstValueFrom(this.accountGroupId$);\n\n try {\n const response = await lastValueFrom(\n this.googleMyBusinessService.getBusinessLaunchStatus({ partnerId: partnerId, accountGroupId: accountGroupId }),\n );\n this.googleBusinessMessagesEnabled.set(response.isLaunched ?? false);\n } catch {\n this.googleBusinessMessagesEnabled.set(false);\n } finally {\n this.loadingEnabledStatus.set(false);\n }\n }\n\n private async initCanEnableBusinessCommunications() {\n this.loadingCanEnable.set(true);\n const socialProfileId = await firstValueFrom(this.socialProfileId$);\n\n try {\n const response = await firstValueFrom(\n this.googleMyBusinessService.canEnableBusinessCommunications({ socialProfileId }),\n );\n this.canEnable.set(response.hasRequiredAccessScopes ?? false);\n } catch (e) {\n this.canEnable.set(false);\n } finally {\n this.loadingCanEnable.set(false);\n }\n }\n\n private async initGoogleBusinessProfileConnectionStatus() {\n this.loadingGoogleBusinessConnectionStatus.set(true);\n const accountGroupId = await firstValueFrom(this.accountGroupId$);\n\n try {\n const response = await lastValueFrom(this.gBizConnectionsService.getSocialProfileConnections(accountGroupId));\n this.businessInfo.set(response.google_my_business[0] ?? null);\n } catch {\n this.businessInfo.set(null);\n } finally {\n this.loadingGoogleBusinessConnectionStatus.set(false);\n }\n }\n\n async reauthorize(): Promise {\n const accountGroupId = await firstValueFrom(this.accountGroupId$);\n\n const protocol = window.location.protocol;\n const host = window.location.host;\n const baseUrl = `${protocol}//${host}`;\n const newURL: URL = new URL(baseUrl);\n newURL.pathname = `/account/location/${accountGroupId}/settings/connections`;\n\n const authUrls = await firstValueFrom(this.gBizConnectionsService.getAuthUrls(accountGroupId, newURL));\n const serviceAuthURL = authUrls[this.serviceName as keyof SocialConnectionLinks];\n const oauthUrl = [\n serviceAuthURL.slice(0, serviceAuthURL.indexOf('&spid')),\n `?type=Google%20My%20Business`,\n serviceAuthURL.slice(serviceAuthURL.indexOf('&spid')),\n ].join('');\n window.location.href = oauthUrl;\n }\n\n redirectToConnections() {\n // This will only work if the parent app is Business Center.\n this.router.navigate(['../connections'], { relativeTo: this.route });\n }\n\n async connectGoogleBusinessCommunications() {\n this.loadingEnabledStatus.set(true);\n const accountID = await firstValueFrom(this.accountGroupId$);\n const partnerID = await firstValueFrom(this.partnerId$);\n const socialProfileID = await firstValueFrom(this.socialProfileId$);\n\n try {\n await firstValueFrom(\n this.googleMyBusinessService.connectBusinessCommunications({\n partnerId: partnerID,\n accountGroupId: accountID,\n socialProfileId: socialProfileID,\n }),\n );\n this.googleBusinessMessagesEnabled.set(true);\n } catch (e) {\n if (\n e instanceof HttpErrorResponse &&\n typeof e.error.message == 'string' &&\n e.error.message.includes('failed to launch agent due to enabled locations with same place-ids')\n ) {\n this.actionErrors.set({\n title: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.ERROR_CONNECTING',\n description: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.FAILED_TO_TURN_ON_ALREADY_CONNECTED_TO_OTHER_APP',\n });\n this.setupBlocked.set(true);\n } else {\n this.actionErrors.set({\n title: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.ERROR_CONNECTING',\n description: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.FAILED_TO_TURN_ON',\n });\n }\n } finally {\n this.loadingEnabledStatus.set(false);\n }\n }\n\n async unlaunchGoogleBusinessCommunications() {\n this.loadingEnabledStatus.set(true);\n\n const accountID = await firstValueFrom(this.accountGroupId$);\n const partnerID = await firstValueFrom(this.partnerId$);\n\n try {\n await firstValueFrom(\n this.googleMyBusinessService.unlaunchBusinessCommunicationsAgent({\n partnerId: partnerID,\n accountGroupId: accountID,\n }),\n );\n this.googleBusinessMessagesEnabled.set(false);\n } catch (e) {\n this.actionErrors.set({\n title: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.ERROR_DISCONNECTING',\n description: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.FAILED_TO_TURN_OFF',\n });\n } finally {\n this.loadingEnabledStatus.set(false);\n }\n }\n}\n","\n \n \n \n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.TITLE' | translate }}\n\n \n {{ (googleBusinessMessagesEnabled() ? 'INBOX.SETTINGS.ACTIVE' : 'INBOX.SETTINGS.INACTIVE') | translate }}\n \n \n \n
\n \n
\n \n

\n \n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.DESCRIPTION' | translate }}\n \n

\n \n

\n {{ cardDescription() | translate }}\n

\n\n

\n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.BUSINESS_NAME' | translate }}:\n \n {{ businessInfo()?.name }}\n \n \n {{ businessInfo()?.name }}\n \n

\n\n \n \n \n \n \n \n \n \n \n \n \n
\n\n \n\n

\n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.DISCLAIMER' | translate }}\n

\n \n
\n
\n\n\n\n \n

\n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.RECONNECT_GBP' | translate }}\n
\n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.RECONNECT_GBP_DETAIL' | translate }}\n

\n \n
\n\n\n\n \n\n\n\n\n \n

\n \n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.PROBLEM_WITH_CONNECTION' | translate }}\n \n
\n \n

\n \n
\n\n\n \n \n {{ actionErrors()?.title || '' | translate }}\n \n \n
\n
\n
\n
\n\n\n

\n \n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.CONNECT' | translate }}\n \n

\n
\n\n\n

{{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.GOOGLE_PROFILE_ERROR' | translate }}

\n\n

\n \n

\n
\n\n\n

\n \n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.DISCONNECT' | translate }}\n \n

\n \n \n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.CONFIRM_DISCONNECT_TITLE' | translate }}\n \n
\n \n \n \n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.DISCONNECT' | translate }}\n \n \n
\n
\n\n\n \n\n","import * as i0 from '@angular/core';\nimport { Injectable } from '@angular/core';\nimport { map } from 'rxjs/operators';\nimport * as i1 from '@angular/common/http';\nimport { HttpHeaders } from '@angular/common/http';\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar PostType = /*#__PURE__*/function (PostType) {\n PostType[PostType[\"POST_TYPE_INVALID\"] = 0] = \"POST_TYPE_INVALID\";\n PostType[PostType[\"POST_TYPE_IMAGE\"] = 1] = \"POST_TYPE_IMAGE\";\n PostType[PostType[\"POST_TYPE_VIDEO\"] = 2] = \"POST_TYPE_VIDEO\";\n PostType[PostType[\"POST_TYPE_GIF\"] = 3] = \"POST_TYPE_GIF\";\n PostType[PostType[\"POST_TYPE_REEL\"] = 4] = \"POST_TYPE_REEL\";\n PostType[PostType[\"POST_TYPE_CAROUSEL\"] = 5] = \"POST_TYPE_CAROUSEL\";\n return PostType;\n}(PostType || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar GetBusinessStatsResponseStatus = /*#__PURE__*/function (GetBusinessStatsResponseStatus) {\n GetBusinessStatsResponseStatus[GetBusinessStatsResponseStatus[\"GET_BUSINESS_STATS_RESPONSE_STATUS_IN_PROGRESS\"] = 0] = \"GET_BUSINESS_STATS_RESPONSE_STATUS_IN_PROGRESS\";\n GetBusinessStatsResponseStatus[GetBusinessStatsResponseStatus[\"GET_BUSINESS_STATS_RESPONSE_STATUS_FINISHED\"] = 1] = \"GET_BUSINESS_STATS_RESPONSE_STATUS_FINISHED\";\n return GetBusinessStatsResponseStatus;\n}(GetBusinessStatsResponseStatus || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums Index.\n// *********************************\n\nfunction enumStringToValue$8(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass BusinessStats {\n static fromProto(proto) {\n let m = new BusinessStats();\n m = Object.assign(m, proto);\n if (proto.timestamp) {\n m.timestamp = new Date(proto.timestamp);\n }\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.followersCount) {\n m.followersCount = parseInt(proto.followersCount, 10);\n }\n if (proto.mediaCount) {\n m.mediaCount = parseInt(proto.mediaCount, 10);\n }\n if (proto.stats) {\n m.stats = BusinessStatsStats.fromProto(proto.stats);\n }\n if (proto.error) {\n m.error = BusinessStatsError.fromProto(proto.error);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.username !== 'undefined') {\n toReturn['username'] = this.username;\n }\n if (typeof this.timestamp !== 'undefined' && this.timestamp !== null) {\n toReturn['timestamp'] = 'toApiJson' in this.timestamp ? this.timestamp.toApiJson() : this.timestamp;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.followersCount !== 'undefined') {\n toReturn['followersCount'] = this.followersCount;\n }\n if (typeof this.mediaCount !== 'undefined') {\n toReturn['mediaCount'] = this.mediaCount;\n }\n if (typeof this.stats !== 'undefined' && this.stats !== null) {\n toReturn['stats'] = 'toApiJson' in this.stats ? this.stats.toApiJson() : this.stats;\n }\n if (typeof this.error !== 'undefined' && this.error !== null) {\n toReturn['error'] = 'toApiJson' in this.error ? this.error.toApiJson() : this.error;\n }\n return toReturn;\n }\n}\nclass BusinessStatsError {\n static fromProto(proto) {\n let m = new BusinessStatsError();\n m = Object.assign(m, proto);\n if (proto.code) {\n m.code = parseInt(proto.code, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.message !== 'undefined') {\n toReturn['message'] = this.message;\n }\n if (typeof this.type !== 'undefined') {\n toReturn['type'] = this.type;\n }\n if (typeof this.code !== 'undefined') {\n toReturn['code'] = this.code;\n }\n return toReturn;\n }\n}\nclass BusinessStatsStats {\n static fromProto(proto) {\n let m = new BusinessStatsStats();\n m = Object.assign(m, proto);\n if (proto.followersCount) {\n m.followersCount = parseInt(proto.followersCount, 10);\n }\n if (proto.mediaCount) {\n m.mediaCount = parseInt(proto.mediaCount, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.followersCount !== 'undefined') {\n toReturn['followersCount'] = this.followersCount;\n }\n if (typeof this.mediaCount !== 'undefined') {\n toReturn['mediaCount'] = this.mediaCount;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$7(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Comment {\n static fromProto(proto) {\n let m = new Comment();\n m = Object.assign(m, proto);\n if (proto.postedOn) {\n m.postedOn = new Date(proto.postedOn);\n }\n if (proto.likeCount) {\n m.likeCount = parseInt(proto.likeCount, 10);\n }\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.modified) {\n m.modified = new Date(proto.modified);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.commentId !== 'undefined') {\n toReturn['commentId'] = this.commentId;\n }\n if (typeof this.parentId !== 'undefined') {\n toReturn['parentId'] = this.parentId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n if (typeof this.instagramCommentId !== 'undefined') {\n toReturn['instagramCommentId'] = this.instagramCommentId;\n }\n if (typeof this.text !== 'undefined') {\n toReturn['text'] = this.text;\n }\n if (typeof this.username !== 'undefined') {\n toReturn['username'] = this.username;\n }\n if (typeof this.instagramUserId !== 'undefined') {\n toReturn['instagramUserId'] = this.instagramUserId;\n }\n if (typeof this.postedOn !== 'undefined' && this.postedOn !== null) {\n toReturn['postedOn'] = 'toApiJson' in this.postedOn ? this.postedOn.toApiJson() : this.postedOn;\n }\n if (typeof this.likeCount !== 'undefined') {\n toReturn['likeCount'] = this.likeCount;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.modified !== 'undefined' && this.modified !== null) {\n toReturn['modified'] = 'toApiJson' in this.modified ? this.modified.toApiJson() : this.modified;\n }\n if (typeof this.hasReplies !== 'undefined') {\n toReturn['hasReplies'] = this.hasReplies;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$6(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass InstagramBusiness {\n static fromProto(proto) {\n let m = new InstagramBusiness();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.facebookPageId !== 'undefined') {\n toReturn['facebookPageId'] = this.facebookPageId;\n }\n if (typeof this.instagramBusinessId !== 'undefined') {\n toReturn['instagramBusinessId'] = this.instagramBusinessId;\n }\n if (typeof this.biography !== 'undefined') {\n toReturn['biography'] = this.biography;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.profilePictureUrl !== 'undefined') {\n toReturn['profilePictureUrl'] = this.profilePictureUrl;\n }\n if (typeof this.username !== 'undefined') {\n toReturn['username'] = this.username;\n }\n if (typeof this.website !== 'undefined') {\n toReturn['website'] = this.website;\n }\n if (typeof this.canPost !== 'undefined') {\n toReturn['canPost'] = this.canPost;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$5(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Media {\n static fromProto(proto) {\n let m = new Media();\n m = Object.assign(m, proto);\n if (proto.postDateTime) {\n m.postDateTime = new Date(proto.postDateTime);\n }\n if (proto.postedDateTime) {\n m.postedDateTime = new Date(proto.postedDateTime);\n }\n if (proto.commentsCount) {\n m.commentsCount = parseInt(proto.commentsCount, 10);\n }\n if (proto.likeCount) {\n m.likeCount = parseInt(proto.likeCount, 10);\n }\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.updated) {\n m.updated = new Date(proto.updated);\n }\n if (proto.reach) {\n m.reach = parseInt(proto.reach, 10);\n }\n if (proto.saves) {\n m.saves = parseInt(proto.saves, 10);\n }\n if (proto.videoViews) {\n m.videoViews = parseInt(proto.videoViews, 10);\n }\n if (proto.insightsUpdated) {\n m.insightsUpdated = new Date(proto.insightsUpdated);\n }\n if (proto.postType) {\n m.postType = enumStringToValue$5(PostType, proto.postType);\n }\n if (proto.deletedAt) {\n m.deletedAt = new Date(proto.deletedAt);\n }\n if (proto.mediaEntries) {\n m.mediaEntries = proto.mediaEntries.map(MediaEntry.fromProto);\n }\n if (proto.metaData) {\n m.metaData = proto.metaData.map(MetaData.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.instagramUserId !== 'undefined') {\n toReturn['instagramUserId'] = this.instagramUserId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n if (typeof this.instagramMediaId !== 'undefined') {\n toReturn['instagramMediaId'] = this.instagramMediaId;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.username !== 'undefined') {\n toReturn['username'] = this.username;\n }\n if (typeof this.postText !== 'undefined') {\n toReturn['postText'] = this.postText;\n }\n if (typeof this.postDateTime !== 'undefined' && this.postDateTime !== null) {\n toReturn['postDateTime'] = 'toApiJson' in this.postDateTime ? this.postDateTime.toApiJson() : this.postDateTime;\n }\n if (typeof this.imageUrl !== 'undefined') {\n toReturn['imageUrl'] = this.imageUrl;\n }\n if (typeof this.tags !== 'undefined') {\n toReturn['tags'] = this.tags;\n }\n if (typeof this.clientTags !== 'undefined') {\n toReturn['clientTags'] = this.clientTags;\n }\n if (typeof this.permalink !== 'undefined') {\n toReturn['permalink'] = this.permalink;\n }\n if (typeof this.error !== 'undefined') {\n toReturn['error'] = this.error;\n }\n if (typeof this.postedDateTime !== 'undefined' && this.postedDateTime !== null) {\n toReturn['postedDateTime'] = 'toApiJson' in this.postedDateTime ? this.postedDateTime.toApiJson() : this.postedDateTime;\n }\n if (typeof this.profilePictureUrl !== 'undefined') {\n toReturn['profilePictureUrl'] = this.profilePictureUrl;\n }\n if (typeof this.hasScheduledTask !== 'undefined') {\n toReturn['hasScheduledTask'] = this.hasScheduledTask;\n }\n if (typeof this.instagramCreationId !== 'undefined') {\n toReturn['instagramCreationId'] = this.instagramCreationId;\n }\n if (typeof this.commentsCount !== 'undefined') {\n toReturn['commentsCount'] = this.commentsCount;\n }\n if (typeof this.likeCount !== 'undefined') {\n toReturn['likeCount'] = this.likeCount;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.updated !== 'undefined' && this.updated !== null) {\n toReturn['updated'] = 'toApiJson' in this.updated ? this.updated.toApiJson() : this.updated;\n }\n if (typeof this.videoUrl !== 'undefined') {\n toReturn['videoUrl'] = this.videoUrl;\n }\n if (typeof this.postedByOwner !== 'undefined') {\n toReturn['postedByOwner'] = this.postedByOwner;\n }\n if (typeof this.linkShortcodes !== 'undefined') {\n toReturn['linkShortcodes'] = this.linkShortcodes;\n }\n if (typeof this.reach !== 'undefined') {\n toReturn['reach'] = this.reach;\n }\n if (typeof this.saves !== 'undefined') {\n toReturn['saves'] = this.saves;\n }\n if (typeof this.videoViews !== 'undefined') {\n toReturn['videoViews'] = this.videoViews;\n }\n if (typeof this.insightsUpdated !== 'undefined' && this.insightsUpdated !== null) {\n toReturn['insightsUpdated'] = 'toApiJson' in this.insightsUpdated ? this.insightsUpdated.toApiJson() : this.insightsUpdated;\n }\n if (typeof this.postType !== 'undefined') {\n toReturn['postType'] = this.postType;\n }\n if (typeof this.deletedAt !== 'undefined' && this.deletedAt !== null) {\n toReturn['deletedAt'] = 'toApiJson' in this.deletedAt ? this.deletedAt.toApiJson() : this.deletedAt;\n }\n if (typeof this.mediaEntries !== 'undefined' && this.mediaEntries !== null) {\n toReturn['mediaEntries'] = 'toApiJson' in this.mediaEntries ? this.mediaEntries.toApiJson() : this.mediaEntries;\n }\n if (typeof this.metaData !== 'undefined' && this.metaData !== null) {\n toReturn['metaData'] = 'toApiJson' in this.metaData ? this.metaData.toApiJson() : this.metaData;\n }\n if (typeof this.multilocationPostId !== 'undefined') {\n toReturn['multilocationPostId'] = this.multilocationPostId;\n }\n if (typeof this.brandId !== 'undefined') {\n toReturn['brandId'] = this.brandId;\n }\n return toReturn;\n }\n}\nclass MediaEntry {\n static fromProto(proto) {\n let m = new MediaEntry();\n m = Object.assign(m, proto);\n if (proto.metaData) {\n m.metaData = proto.metaData.map(MetaData.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.mediaEntryId !== 'undefined') {\n toReturn['mediaEntryId'] = this.mediaEntryId;\n }\n if (typeof this.mediaUrl !== 'undefined') {\n toReturn['mediaUrl'] = this.mediaUrl;\n }\n if (typeof this.mediaType !== 'undefined') {\n toReturn['mediaType'] = this.mediaType;\n }\n if (typeof this.containerId !== 'undefined') {\n toReturn['containerId'] = this.containerId;\n }\n if (typeof this.metaData !== 'undefined' && this.metaData !== null) {\n toReturn['metaData'] = 'toApiJson' in this.metaData ? this.metaData.toApiJson() : this.metaData;\n }\n return toReturn;\n }\n}\nclass MediaKeyset {\n static fromProto(proto) {\n let m = new MediaKeyset();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n return toReturn;\n }\n}\nclass MetaData {\n static fromProto(proto) {\n let m = new MetaData();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.propertyName !== 'undefined') {\n toReturn['propertyName'] = this.propertyName;\n }\n if (typeof this.propertyValue !== 'undefined') {\n toReturn['propertyValue'] = this.propertyValue;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$4(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Page {\n static fromProto(proto) {\n let m = new Page();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.pageId !== 'undefined') {\n toReturn['pageId'] = this.pageId;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.location !== 'undefined') {\n toReturn['location'] = this.location;\n }\n if (typeof this.url !== 'undefined') {\n toReturn['url'] = this.url;\n }\n if (typeof this.perms !== 'undefined') {\n toReturn['perms'] = this.perms;\n }\n if (typeof this.tasks !== 'undefined') {\n toReturn['tasks'] = this.tasks;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$3(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass User {\n static fromProto(proto) {\n let m = new User();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.instagramUserId !== 'undefined') {\n toReturn['instagramUserId'] = this.instagramUserId;\n }\n if (typeof this.username !== 'undefined') {\n toReturn['username'] = this.username;\n }\n if (typeof this.profilePicture !== 'undefined') {\n toReturn['profilePicture'] = this.profilePicture;\n }\n if (typeof this.fullName !== 'undefined') {\n toReturn['fullName'] = this.fullName;\n }\n if (typeof this.bio !== 'undefined') {\n toReturn['bio'] = this.bio;\n }\n if (typeof this.website !== 'undefined') {\n toReturn['website'] = this.website;\n }\n if (typeof this.isBusiness !== 'undefined') {\n toReturn['isBusiness'] = this.isBusiness;\n }\n if (typeof this.accessToken !== 'undefined') {\n toReturn['accessToken'] = this.accessToken;\n }\n if (typeof this.facebookUserId !== 'undefined') {\n toReturn['facebookUserId'] = this.facebookUserId;\n }\n if (typeof this.tokenBroken !== 'undefined') {\n toReturn['tokenBroken'] = this.tokenBroken;\n }\n if (typeof this.metaAppId !== 'undefined') {\n toReturn['metaAppId'] = this.metaAppId;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$2(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass BreakInstagramUserTokenRequest {\n static fromProto(proto) {\n let m = new BreakInstagramUserTokenRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n return toReturn;\n }\n}\nclass ConnectInstagramBusinessRequest {\n static fromProto(proto) {\n let m = new ConnectInstagramBusinessRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.facebookPageId !== 'undefined') {\n toReturn['facebookPageId'] = this.facebookPageId;\n }\n if (typeof this.instagramBusinessId !== 'undefined') {\n toReturn['instagramBusinessId'] = this.instagramBusinessId;\n }\n return toReturn;\n }\n}\nclass CreateCommentRequest {\n static fromProto(proto) {\n let m = new CreateCommentRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n if (typeof this.parentId !== 'undefined') {\n toReturn['parentId'] = this.parentId;\n }\n if (typeof this.text !== 'undefined') {\n toReturn['text'] = this.text;\n }\n return toReturn;\n }\n}\nclass CreateCommentResponse {\n static fromProto(proto) {\n let m = new CreateCommentResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.commentId !== 'undefined') {\n toReturn['commentId'] = this.commentId;\n }\n return toReturn;\n }\n}\nclass CreateMediaRequest {\n static fromProto(proto) {\n let m = new CreateMediaRequest();\n m = Object.assign(m, proto);\n if (proto.postDateTime) {\n m.postDateTime = new Date(proto.postDateTime);\n }\n if (proto.metaData) {\n m.metaData = proto.metaData.map(MetaData.fromProto);\n }\n if (proto.mediaEntries) {\n m.mediaEntries = proto.mediaEntries.map(MediaEntry.fromProto);\n }\n if (proto.postType) {\n m.postType = enumStringToValue$2(PostType, proto.postType);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n if (typeof this.postText !== 'undefined') {\n toReturn['postText'] = this.postText;\n }\n if (typeof this.imageUrl !== 'undefined') {\n toReturn['imageUrl'] = this.imageUrl;\n }\n if (typeof this.postDateTime !== 'undefined' && this.postDateTime !== null) {\n toReturn['postDateTime'] = 'toApiJson' in this.postDateTime ? this.postDateTime.toApiJson() : this.postDateTime;\n }\n if (typeof this.hasScheduledTask !== 'undefined') {\n toReturn['hasScheduledTask'] = this.hasScheduledTask;\n }\n if (typeof this.videoUrl !== 'undefined') {\n toReturn['videoUrl'] = this.videoUrl;\n }\n if (typeof this.postedByOwner !== 'undefined') {\n toReturn['postedByOwner'] = this.postedByOwner;\n }\n if (typeof this.linkShortcodes !== 'undefined') {\n toReturn['linkShortcodes'] = this.linkShortcodes;\n }\n if (typeof this.metaData !== 'undefined' && this.metaData !== null) {\n toReturn['metaData'] = 'toApiJson' in this.metaData ? this.metaData.toApiJson() : this.metaData;\n }\n if (typeof this.mediaEntries !== 'undefined' && this.mediaEntries !== null) {\n toReturn['mediaEntries'] = 'toApiJson' in this.mediaEntries ? this.mediaEntries.toApiJson() : this.mediaEntries;\n }\n if (typeof this.postType !== 'undefined') {\n toReturn['postType'] = this.postType;\n }\n if (typeof this.tags !== 'undefined') {\n toReturn['tags'] = this.tags;\n }\n if (typeof this.multilocationPostId !== 'undefined') {\n toReturn['multilocationPostId'] = this.multilocationPostId;\n }\n if (typeof this.brandId !== 'undefined') {\n toReturn['brandId'] = this.brandId;\n }\n return toReturn;\n }\n}\nclass CreateMediaResponse {\n static fromProto(proto) {\n let m = new CreateMediaResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n return toReturn;\n }\n}\nclass CreateUserRequest {\n static fromProto(proto) {\n let m = new CreateUserRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.instagramUserId !== 'undefined') {\n toReturn['instagramUserId'] = this.instagramUserId;\n }\n if (typeof this.username !== 'undefined') {\n toReturn['username'] = this.username;\n }\n if (typeof this.profilePicture !== 'undefined') {\n toReturn['profilePicture'] = this.profilePicture;\n }\n if (typeof this.fullName !== 'undefined') {\n toReturn['fullName'] = this.fullName;\n }\n if (typeof this.bio !== 'undefined') {\n toReturn['bio'] = this.bio;\n }\n if (typeof this.website !== 'undefined') {\n toReturn['website'] = this.website;\n }\n if (typeof this.accessToken !== 'undefined') {\n toReturn['accessToken'] = this.accessToken;\n }\n return toReturn;\n }\n}\nclass DeleteMediaRequest {\n static fromProto(proto) {\n let m = new DeleteMediaRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.instagramMediaId !== 'undefined') {\n toReturn['instagramMediaId'] = this.instagramMediaId;\n }\n return toReturn;\n }\n}\nclass DeleteUserRequest {\n static fromProto(proto) {\n let m = new DeleteUserRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n return toReturn;\n }\n}\nclass GetBusinessStatsRequest {\n static fromProto(proto) {\n let m = new GetBusinessStatsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.username !== 'undefined') {\n toReturn['username'] = this.username;\n }\n return toReturn;\n }\n}\nclass GetBusinessStatsResponse {\n static fromProto(proto) {\n let m = new GetBusinessStatsResponse();\n m = Object.assign(m, proto);\n if (proto.businessStats) {\n m.businessStats = BusinessStats.fromProto(proto.businessStats);\n }\n if (proto.status) {\n m.status = enumStringToValue$2(GetBusinessStatsResponseStatus, proto.status);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessStats !== 'undefined' && this.businessStats !== null) {\n toReturn['businessStats'] = 'toApiJson' in this.businessStats ? this.businessStats.toApiJson() : this.businessStats;\n }\n if (typeof this.status !== 'undefined') {\n toReturn['status'] = this.status;\n }\n return toReturn;\n }\n}\nclass GetInstagramBusinessRequest {\n static fromProto(proto) {\n let m = new GetInstagramBusinessRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.facebookPageId !== 'undefined') {\n toReturn['facebookPageId'] = this.facebookPageId;\n }\n return toReturn;\n }\n}\nclass GetInstagramBusinessResponse {\n static fromProto(proto) {\n let m = new GetInstagramBusinessResponse();\n m = Object.assign(m, proto);\n if (proto.instagramBusiness) {\n m.instagramBusiness = InstagramBusiness.fromProto(proto.instagramBusiness);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.instagramBusiness !== 'undefined' && this.instagramBusiness !== null) {\n toReturn['instagramBusiness'] = 'toApiJson' in this.instagramBusiness ? this.instagramBusiness.toApiJson() : this.instagramBusiness;\n }\n return toReturn;\n }\n}\nclass GetMediaRequest {\n static fromProto(proto) {\n let m = new GetMediaRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.instagramMediaId !== 'undefined') {\n toReturn['instagramMediaId'] = this.instagramMediaId;\n }\n return toReturn;\n }\n}\nclass GetMediaResponse {\n static fromProto(proto) {\n let m = new GetMediaResponse();\n m = Object.assign(m, proto);\n if (proto.media) {\n m.media = Media.fromProto(proto.media);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.media !== 'undefined' && this.media !== null) {\n toReturn['media'] = 'toApiJson' in this.media ? this.media.toApiJson() : this.media;\n }\n return toReturn;\n }\n}\nclass GetMultiMediaRequest {\n static fromProto(proto) {\n let m = new GetMultiMediaRequest();\n m = Object.assign(m, proto);\n if (proto.keysets) {\n m.keysets = proto.keysets.map(MediaKeyset.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n if (typeof this.keysets !== 'undefined' && this.keysets !== null) {\n toReturn['keysets'] = 'toApiJson' in this.keysets ? this.keysets.toApiJson() : this.keysets;\n }\n return toReturn;\n }\n}\nclass GetMultiMediaResponse {\n static fromProto(proto) {\n let m = new GetMultiMediaResponse();\n m = Object.assign(m, proto);\n if (proto.media) {\n m.media = proto.media.map(Media.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.media !== 'undefined' && this.media !== null) {\n toReturn['media'] = 'toApiJson' in this.media ? this.media.toApiJson() : this.media;\n }\n return toReturn;\n }\n}\nclass GetMultiMediaStatsRequest {\n static fromProto(proto) {\n let m = new GetMultiMediaStatsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.mediaIds !== 'undefined') {\n toReturn['mediaIds'] = this.mediaIds;\n }\n return toReturn;\n }\n}\nclass GetMultiMediaStatsResponse {\n static fromProto(proto) {\n let m = new GetMultiMediaStatsResponse();\n m = Object.assign(m, proto);\n if (proto.mediaStats) {\n m.mediaStats = Object.keys(proto.mediaStats).reduce((obj, k) => {\n obj[k] = MediaStats.fromProto(proto.mediaStats[k]);\n return obj;\n }, {});\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.mediaStats !== 'undefined' && this.mediaStats !== null) {\n toReturn['mediaStats'] = 'toApiJson' in this.mediaStats ? this.mediaStats.toApiJson() : this.mediaStats;\n }\n return toReturn;\n }\n}\nclass GetUserRequest {\n static fromProto(proto) {\n let m = new GetUserRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n return toReturn;\n }\n}\nclass GetUserResponse {\n static fromProto(proto) {\n let m = new GetUserResponse();\n m = Object.assign(m, proto);\n if (proto.user) {\n m.user = User.fromProto(proto.user);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.user !== 'undefined' && this.user !== null) {\n toReturn['user'] = 'toApiJson' in this.user ? this.user.toApiJson() : this.user;\n }\n return toReturn;\n }\n}\nclass ListCommentsRequest {\n static fromProto(proto) {\n let m = new ListCommentsRequest();\n m = Object.assign(m, proto);\n if (proto.options) {\n m.options = PagedRequestOptions.fromProto(proto.options);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.parentId !== 'undefined') {\n toReturn['parentId'] = this.parentId;\n }\n if (typeof this.options !== 'undefined' && this.options !== null) {\n toReturn['options'] = 'toApiJson' in this.options ? this.options.toApiJson() : this.options;\n }\n return toReturn;\n }\n}\nclass ListCommentsResponse {\n static fromProto(proto) {\n let m = new ListCommentsResponse();\n m = Object.assign(m, proto);\n if (proto.comments) {\n m.comments = proto.comments.map(Comment.fromProto);\n }\n if (proto.pagingMetadata) {\n m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.comments !== 'undefined' && this.comments !== null) {\n toReturn['comments'] = 'toApiJson' in this.comments ? this.comments.toApiJson() : this.comments;\n }\n if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {\n toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;\n }\n return toReturn;\n }\n}\nclass ListFacebookPagesRequest {\n static fromProto(proto) {\n let m = new ListFacebookPagesRequest();\n m = Object.assign(m, proto);\n if (proto.options) {\n m.options = PagedRequestOptions.fromProto(proto.options);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.options !== 'undefined' && this.options !== null) {\n toReturn['options'] = 'toApiJson' in this.options ? this.options.toApiJson() : this.options;\n }\n return toReturn;\n }\n}\nclass ListFacebookPagesResponse {\n static fromProto(proto) {\n let m = new ListFacebookPagesResponse();\n m = Object.assign(m, proto);\n if (proto.pages) {\n m.pages = proto.pages.map(Page.fromProto);\n }\n if (proto.pagingMetadata) {\n m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.pages !== 'undefined' && this.pages !== null) {\n toReturn['pages'] = 'toApiJson' in this.pages ? this.pages.toApiJson() : this.pages;\n }\n if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {\n toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;\n }\n return toReturn;\n }\n}\nclass ListInstagramBusinessRequest {\n static fromProto(proto) {\n let m = new ListInstagramBusinessRequest();\n m = Object.assign(m, proto);\n if (proto.options) {\n m.options = PagedRequestOptions.fromProto(proto.options);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.options !== 'undefined' && this.options !== null) {\n toReturn['options'] = 'toApiJson' in this.options ? this.options.toApiJson() : this.options;\n }\n return toReturn;\n }\n}\nclass ListInstagramBusinessResponse {\n static fromProto(proto) {\n let m = new ListInstagramBusinessResponse();\n m = Object.assign(m, proto);\n if (proto.instagramBusiness) {\n m.instagramBusiness = proto.instagramBusiness.map(InstagramBusiness.fromProto);\n }\n if (proto.pagingMetadata) {\n m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.instagramBusiness !== 'undefined' && this.instagramBusiness !== null) {\n toReturn['instagramBusiness'] = 'toApiJson' in this.instagramBusiness ? this.instagramBusiness.toApiJson() : this.instagramBusiness;\n }\n if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {\n toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;\n }\n return toReturn;\n }\n}\nclass ListMediaRequest {\n static fromProto(proto) {\n let m = new ListMediaRequest();\n m = Object.assign(m, proto);\n if (proto.options) {\n m.options = PagedRequestOptions.fromProto(proto.options);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.options !== 'undefined' && this.options !== null) {\n toReturn['options'] = 'toApiJson' in this.options ? this.options.toApiJson() : this.options;\n }\n return toReturn;\n }\n}\nclass ListMediaResponse {\n static fromProto(proto) {\n let m = new ListMediaResponse();\n m = Object.assign(m, proto);\n if (proto.media) {\n m.media = proto.media.map(Media.fromProto);\n }\n if (proto.pagingMetadata) {\n m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.media !== 'undefined' && this.media !== null) {\n toReturn['media'] = 'toApiJson' in this.media ? this.media.toApiJson() : this.media;\n }\n if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {\n toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;\n }\n return toReturn;\n }\n}\nclass ListUsersByMultiBusinessesRequest {\n static fromProto(proto) {\n let m = new ListUsersByMultiBusinessesRequest();\n m = Object.assign(m, proto);\n if (proto.options) {\n m.options = PagedRequestOptions.fromProto(proto.options);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.options !== 'undefined' && this.options !== null) {\n toReturn['options'] = 'toApiJson' in this.options ? this.options.toApiJson() : this.options;\n }\n return toReturn;\n }\n}\nclass ListUsersByMultiBusinessesResponse {\n static fromProto(proto) {\n let m = new ListUsersByMultiBusinessesResponse();\n m = Object.assign(m, proto);\n if (proto.users) {\n m.users = proto.users.map(User.fromProto);\n }\n if (proto.pagingMetadata) {\n m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.users !== 'undefined' && this.users !== null) {\n toReturn['users'] = 'toApiJson' in this.users ? this.users.toApiJson() : this.users;\n }\n if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {\n toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;\n }\n return toReturn;\n }\n}\nclass ListUsersRequest {\n static fromProto(proto) {\n let m = new ListUsersRequest();\n m = Object.assign(m, proto);\n if (proto.options) {\n m.options = PagedRequestOptions.fromProto(proto.options);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.options !== 'undefined' && this.options !== null) {\n toReturn['options'] = 'toApiJson' in this.options ? this.options.toApiJson() : this.options;\n }\n return toReturn;\n }\n}\nclass ListUsersResponse {\n static fromProto(proto) {\n let m = new ListUsersResponse();\n m = Object.assign(m, proto);\n if (proto.users) {\n m.users = proto.users.map(User.fromProto);\n }\n if (proto.pagingMetadata) {\n m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.users !== 'undefined' && this.users !== null) {\n toReturn['users'] = 'toApiJson' in this.users ? this.users.toApiJson() : this.users;\n }\n if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {\n toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;\n }\n return toReturn;\n }\n}\nclass ManageMediaTagsRequest {\n static fromProto(proto) {\n let m = new ManageMediaTagsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n if (typeof this.addTags !== 'undefined') {\n toReturn['addTags'] = this.addTags;\n }\n if (typeof this.removeTags !== 'undefined') {\n toReturn['removeTags'] = this.removeTags;\n }\n return toReturn;\n }\n}\nclass ManageMediaTagsResponse {\n static fromProto(proto) {\n let m = new ManageMediaTagsResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.tags !== 'undefined') {\n toReturn['tags'] = this.tags;\n }\n return toReturn;\n }\n}\nclass MediaStats {\n static fromProto(proto) {\n let m = new MediaStats();\n m = Object.assign(m, proto);\n if (proto.commentsCount) {\n m.commentsCount = parseInt(proto.commentsCount, 10);\n }\n if (proto.likeCount) {\n m.likeCount = parseInt(proto.likeCount, 10);\n }\n if (proto.reach) {\n m.reach = parseInt(proto.reach, 10);\n }\n if (proto.saves) {\n m.saves = parseInt(proto.saves, 10);\n }\n if (proto.videoViews) {\n m.videoViews = parseInt(proto.videoViews, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.commentsCount !== 'undefined') {\n toReturn['commentsCount'] = this.commentsCount;\n }\n if (typeof this.likeCount !== 'undefined') {\n toReturn['likeCount'] = this.likeCount;\n }\n if (typeof this.reach !== 'undefined') {\n toReturn['reach'] = this.reach;\n }\n if (typeof this.saves !== 'undefined') {\n toReturn['saves'] = this.saves;\n }\n if (typeof this.videoViews !== 'undefined') {\n toReturn['videoViews'] = this.videoViews;\n }\n return toReturn;\n }\n}\nclass GetMultiMediaStatsResponseMediaStatsEntry {\n static fromProto(proto) {\n let m = new GetMultiMediaStatsResponseMediaStatsEntry();\n m = Object.assign(m, proto);\n if (proto.value) {\n m.value = MediaStats.fromProto(proto.value);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.key !== 'undefined') {\n toReturn['key'] = this.key;\n }\n if (typeof this.value !== 'undefined' && this.value !== null) {\n toReturn['value'] = 'toApiJson' in this.value ? this.value.toApiJson() : this.value;\n }\n return toReturn;\n }\n}\nclass PagedRequestOptions {\n static fromProto(proto) {\n let m = new PagedRequestOptions();\n m = Object.assign(m, proto);\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n return toReturn;\n }\n}\nclass PagedResponseMetadata {\n static fromProto(proto) {\n let m = new PagedResponseMetadata();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.nextCursor !== 'undefined') {\n toReturn['nextCursor'] = this.nextCursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n return toReturn;\n }\n}\nclass PopulateRecentMediaRequest {\n static fromProto(proto) {\n let m = new PopulateRecentMediaRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n return toReturn;\n }\n}\nclass PostMediaRequest {\n static fromProto(proto) {\n let m = new PostMediaRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n return toReturn;\n }\n}\nclass PostMediaResponse {\n static fromProto(proto) {\n let m = new PostMediaResponse();\n m = Object.assign(m, proto);\n if (proto.media) {\n m.media = Media.fromProto(proto.media);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.media !== 'undefined' && this.media !== null) {\n toReturn['media'] = 'toApiJson' in this.media ? this.media.toApiJson() : this.media;\n }\n return toReturn;\n }\n}\nclass UpdateMediaInsightsRequest {\n static fromProto(proto) {\n let m = new UpdateMediaInsightsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n return toReturn;\n }\n}\nclass UpdateMediaRequest {\n static fromProto(proto) {\n let m = new UpdateMediaRequest();\n m = Object.assign(m, proto);\n if (proto.postDateTime) {\n m.postDateTime = new Date(proto.postDateTime);\n }\n if (proto.metaData) {\n m.metaData = proto.metaData.map(MetaData.fromProto);\n }\n if (proto.mediaEntries) {\n m.mediaEntries = proto.mediaEntries.map(MediaEntry.fromProto);\n }\n if (proto.postType) {\n m.postType = enumStringToValue$2(PostType, proto.postType);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n if (typeof this.postText !== 'undefined') {\n toReturn['postText'] = this.postText;\n }\n if (typeof this.imageUrl !== 'undefined') {\n toReturn['imageUrl'] = this.imageUrl;\n }\n if (typeof this.postDateTime !== 'undefined' && this.postDateTime !== null) {\n toReturn['postDateTime'] = 'toApiJson' in this.postDateTime ? this.postDateTime.toApiJson() : this.postDateTime;\n }\n if (typeof this.hasScheduledTask !== 'undefined') {\n toReturn['hasScheduledTask'] = this.hasScheduledTask;\n }\n if (typeof this.videoUrl !== 'undefined') {\n toReturn['videoUrl'] = this.videoUrl;\n }\n if (typeof this.linkShortcodes !== 'undefined') {\n toReturn['linkShortcodes'] = this.linkShortcodes;\n }\n if (typeof this.metaData !== 'undefined' && this.metaData !== null) {\n toReturn['metaData'] = 'toApiJson' in this.metaData ? this.metaData.toApiJson() : this.metaData;\n }\n if (typeof this.mediaEntries !== 'undefined' && this.mediaEntries !== null) {\n toReturn['mediaEntries'] = 'toApiJson' in this.mediaEntries ? this.mediaEntries.toApiJson() : this.mediaEntries;\n }\n if (typeof this.postType !== 'undefined') {\n toReturn['postType'] = this.postType;\n }\n if (typeof this.multilocationPostId !== 'undefined') {\n toReturn['multilocationPostId'] = this.multilocationPostId;\n }\n if (typeof this.brandId !== 'undefined') {\n toReturn['brandId'] = this.brandId;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$1(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass MediaStatsHistory {\n static fromProto(proto) {\n let m = new MediaStatsHistory();\n m = Object.assign(m, proto);\n if (proto.saves) {\n m.saves = parseInt(proto.saves, 10);\n }\n if (proto.videoViews) {\n m.videoViews = parseInt(proto.videoViews, 10);\n }\n if (proto.likesCount) {\n m.likesCount = parseInt(proto.likesCount, 10);\n }\n if (proto.reach) {\n m.reach = parseInt(proto.reach, 10);\n }\n if (proto.commentsCount) {\n m.commentsCount = parseInt(proto.commentsCount, 10);\n }\n if (proto.postedDateTime) {\n m.postedDateTime = new Date(proto.postedDateTime);\n }\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.updated) {\n m.updated = new Date(proto.updated);\n }\n if (proto.statsDateTime) {\n m.statsDateTime = new Date(proto.statsDateTime);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.internalPostId !== 'undefined') {\n toReturn['internalPostId'] = this.internalPostId;\n }\n if (typeof this.saves !== 'undefined') {\n toReturn['saves'] = this.saves;\n }\n if (typeof this.videoViews !== 'undefined') {\n toReturn['videoViews'] = this.videoViews;\n }\n if (typeof this.likesCount !== 'undefined') {\n toReturn['likesCount'] = this.likesCount;\n }\n if (typeof this.reach !== 'undefined') {\n toReturn['reach'] = this.reach;\n }\n if (typeof this.commentsCount !== 'undefined') {\n toReturn['commentsCount'] = this.commentsCount;\n }\n if (typeof this.postedDateTime !== 'undefined' && this.postedDateTime !== null) {\n toReturn['postedDateTime'] = 'toApiJson' in this.postedDateTime ? this.postedDateTime.toApiJson() : this.postedDateTime;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.updated !== 'undefined' && this.updated !== null) {\n toReturn['updated'] = 'toApiJson' in this.updated ? this.updated.toApiJson() : this.updated;\n }\n if (typeof this.statsDateTime !== 'undefined' && this.statsDateTime !== null) {\n toReturn['statsDateTime'] = 'toApiJson' in this.statsDateTime ? this.statsDateTime.toApiJson() : this.statsDateTime;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass PublishMediaRequest {\n static fromProto(proto) {\n let m = new PublishMediaRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n return toReturn;\n }\n}\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Objects Index.\n// *********************************\n\nconst environment = (window ? window['environment'] : 'prod') ?? 'prod';\nconst hostMap = {\n 'local': 'instagram-api.vendasta-local.com',\n 'test': '',\n 'demo': 'instagram-demo.apigateway.co',\n 'prod': 'instagram-prod.apigateway.co',\n 'production': 'instagram-prod.apigateway.co'\n};\nlet HostService = /*#__PURE__*/(() => {\n class HostService {\n get host() {\n return hostMap[environment.toLowerCase()];\n }\n get hostWithScheme() {\n return 'https://' + this.host;\n }\n }\n HostService.ɵfac = function HostService_Factory(t) {\n return new (t || HostService)();\n };\n HostService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HostService,\n factory: HostService.ɵfac,\n providedIn: 'root'\n });\n return HostService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet InstagramApiService = /*#__PURE__*/(() => {\n class InstagramApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n createUser(r) {\n const request = r.toApiJson ? r : new CreateUserRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/CreateUser\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n listUsers(r) {\n const request = r.toApiJson ? r : new ListUsersRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/ListUsers\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListUsersResponse.fromProto(resp)));\n }\n listUsersByMultiBusinesses(r) {\n const request = r.toApiJson ? r : new ListUsersByMultiBusinessesRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/ListUsersByMultiBusinesses\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListUsersByMultiBusinessesResponse.fromProto(resp)));\n }\n getUser(r) {\n const request = r.toApiJson ? r : new GetUserRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/GetUser\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetUserResponse.fromProto(resp)));\n }\n deleteUser(r) {\n const request = r.toApiJson ? r : new DeleteUserRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/DeleteUser\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n populateRecentMedia(r) {\n const request = r.toApiJson ? r : new PopulateRecentMediaRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/PopulateRecentMedia\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n createMedia(r) {\n const request = r.toApiJson ? r : new CreateMediaRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/CreateMedia\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateMediaResponse.fromProto(resp)));\n }\n listMedia(r) {\n const request = r.toApiJson ? r : new ListMediaRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/ListMedia\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListMediaResponse.fromProto(resp)));\n }\n getMedia(r) {\n const request = r.toApiJson ? r : new GetMediaRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/GetMedia\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetMediaResponse.fromProto(resp)));\n }\n deleteMedia(r) {\n const request = r.toApiJson ? r : new DeleteMediaRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/DeleteMedia\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n postMedia(r) {\n const request = r.toApiJson ? r : new PostMediaRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/PostMedia\", request.toApiJson(), this.apiOptions()).pipe(map(resp => PostMediaResponse.fromProto(resp)));\n }\n updateMedia(r) {\n const request = r.toApiJson ? r : new UpdateMediaRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/UpdateMedia\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n getMultiMediaStats(r) {\n const request = r.toApiJson ? r : new GetMultiMediaStatsRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/GetMultiMediaStats\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetMultiMediaStatsResponse.fromProto(resp)));\n }\n createComment(r) {\n const request = r.toApiJson ? r : new CreateCommentRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/CreateComment\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateCommentResponse.fromProto(resp)));\n }\n listComments(r) {\n const request = r.toApiJson ? r : new ListCommentsRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/ListComments\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListCommentsResponse.fromProto(resp)));\n }\n listFacebookPages(r) {\n const request = r.toApiJson ? r : new ListFacebookPagesRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/ListFacebookPages\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListFacebookPagesResponse.fromProto(resp)));\n }\n getInstagramBusiness(r) {\n const request = r.toApiJson ? r : new GetInstagramBusinessRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/GetInstagramBusiness\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetInstagramBusinessResponse.fromProto(resp)));\n }\n listInstagramBusiness(r) {\n const request = r.toApiJson ? r : new ListInstagramBusinessRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/ListInstagramBusiness\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListInstagramBusinessResponse.fromProto(resp)));\n }\n connectInstagramBusiness(r) {\n const request = r.toApiJson ? r : new ConnectInstagramBusinessRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/ConnectInstagramBusiness\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n manageMediaTags(r) {\n const request = r.toApiJson ? r : new ManageMediaTagsRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/ManageMediaTags\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ManageMediaTagsResponse.fromProto(resp)));\n }\n getBusinessStats(r) {\n const request = r.toApiJson ? r : new GetBusinessStatsRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/GetBusinessStats\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetBusinessStatsResponse.fromProto(resp)));\n }\n getMultiMedia(r) {\n const request = r.toApiJson ? r : new GetMultiMediaRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/GetMultiMedia\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetMultiMediaResponse.fromProto(resp)));\n }\n updateMediaInsights(r) {\n const request = r.toApiJson ? r : new UpdateMediaInsightsRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/UpdateMediaInsights\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n processBusinessStats() {\n return this.http.post(this._host + \"/instagram.v1.Instagram/ProcessBusinessStats\", {}, {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n breakInstagramUserToken(r) {\n const request = r.toApiJson ? r : new BreakInstagramUserTokenRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/BreakInstagramUserToken\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n InstagramApiService.ɵfac = function InstagramApiService_Factory(t) {\n return new (t || InstagramApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n InstagramApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: InstagramApiService,\n factory: InstagramApiService.ɵfac,\n providedIn: 'root'\n });\n return InstagramApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass InstagramPagedResponse {\n constructor(results, nextCursor, hasMore) {\n this.results = results;\n this.nextCursor = nextCursor;\n this.hasMore = hasMore;\n }\n}\nlet InstagramService = /*#__PURE__*/(() => {\n class InstagramService {\n constructor(apiService) {\n this.apiService = apiService;\n }\n listUsers(partnerId, businessId, cursor, pageSize) {\n const req = new ListUsersRequest({\n partnerId: partnerId,\n businessId: businessId,\n options: {\n cursor: cursor,\n pageSize: pageSize ? pageSize : 0\n }\n });\n return this.apiService.listUsers(req).pipe(map(resp => ({\n results: resp.users,\n nextCursor: resp.pagingMetadata ? resp.pagingMetadata.nextCursor : '',\n hasMore: resp.pagingMetadata ? resp.pagingMetadata.hasMore : false\n })));\n }\n getUser(partnerId, businessId, userId) {\n const req = new GetUserRequest({\n partnerId: partnerId,\n businessId: businessId,\n userId: userId\n });\n return this.apiService.getUser(req).pipe(map(resp => resp.user));\n }\n deleteUser(partnerId, businessId, userId) {\n const req = new DeleteUserRequest({\n partnerId: partnerId,\n businessId: businessId,\n userId: userId\n });\n return this.apiService.deleteUser(req);\n }\n listFacebookPages(partnerId, businessId, userId, cursor, pageSize) {\n const req = new ListFacebookPagesRequest({\n partnerId: partnerId,\n businessId: businessId,\n userId: userId,\n options: {\n cursor: cursor,\n pageSize: pageSize ? pageSize : 0\n }\n });\n return this.apiService.listFacebookPages(req).pipe(map(resp => ({\n results: resp.pages,\n nextCursor: resp.pagingMetadata ? resp.pagingMetadata.nextCursor : '',\n hasMore: resp.pagingMetadata ? resp.pagingMetadata.hasMore : false\n })));\n }\n listInstagramBusiness(partnerId, businessId, userId, cursor, pageSize) {\n const req = new ListInstagramBusinessRequest({\n partnerId: partnerId,\n businessId: businessId,\n userId: userId,\n options: {\n cursor: cursor,\n pageSize: pageSize ? pageSize : 0\n }\n });\n return this.apiService.listInstagramBusiness(req).pipe(map(resp => ({\n results: resp.instagramBusiness,\n nextCursor: resp.pagingMetadata ? resp.pagingMetadata.nextCursor : '',\n hasMore: resp.pagingMetadata ? resp.pagingMetadata.hasMore : false\n })));\n }\n getInstagramBusiness(partnerId, businessId, userId, facebookPageId) {\n const req = new GetInstagramBusinessRequest({\n partnerId: partnerId,\n businessId: businessId,\n userId: userId,\n facebookPageId: facebookPageId\n });\n return this.apiService.getInstagramBusiness(req).pipe(map(resp => resp.instagramBusiness));\n }\n connectInstagramBusiness(partnerId, businessId, userId, facebookPageId, instagramBusinessId) {\n const req = new ConnectInstagramBusinessRequest({\n partnerId: partnerId,\n businessId: businessId,\n userId: userId,\n facebookPageId: facebookPageId,\n instagramBusinessId: instagramBusinessId\n });\n return this.apiService.connectInstagramBusiness(req);\n }\n listUsersByMultiBusinesses(businessIds, cursor, pageSize) {\n const req = new ListUsersByMultiBusinessesRequest({\n businessId: businessIds,\n options: {\n cursor: cursor,\n pageSize: pageSize ? pageSize : 0\n }\n });\n return this.apiService.listUsersByMultiBusinesses(req).pipe(map(resp => ({\n results: resp.users,\n nextCursor: resp.pagingMetadata ? resp.pagingMetadata.nextCursor : '',\n hasMore: resp.pagingMetadata ? resp.pagingMetadata.hasMore : false\n })));\n }\n }\n InstagramService.ɵfac = function InstagramService_Factory(t) {\n return new (t || InstagramService)(i0.ɵɵinject(InstagramApiService));\n };\n InstagramService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: InstagramService,\n factory: InstagramService.ɵfac,\n providedIn: 'root'\n });\n return InstagramService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { BreakInstagramUserTokenRequest, BusinessStats, BusinessStatsError, BusinessStatsStats, Comment, ConnectInstagramBusinessRequest, CreateCommentRequest, CreateCommentResponse, CreateMediaRequest, CreateMediaResponse, CreateUserRequest, DeleteMediaRequest, DeleteUserRequest, GetBusinessStatsRequest, GetBusinessStatsResponse, GetBusinessStatsResponseStatus, GetInstagramBusinessRequest, GetInstagramBusinessResponse, GetMediaRequest, GetMediaResponse, GetMultiMediaRequest, GetMultiMediaResponse, GetMultiMediaStatsRequest, GetMultiMediaStatsResponse, GetMultiMediaStatsResponseMediaStatsEntry, GetUserRequest, GetUserResponse, InstagramApiService, InstagramBusiness, InstagramPagedResponse, InstagramService, ListCommentsRequest, ListCommentsResponse, ListFacebookPagesRequest, ListFacebookPagesResponse, ListInstagramBusinessRequest, ListInstagramBusinessResponse, ListMediaRequest, ListMediaResponse, ListUsersByMultiBusinessesRequest, ListUsersByMultiBusinessesResponse, ListUsersRequest, ListUsersResponse, ManageMediaTagsRequest, ManageMediaTagsResponse, Media, MediaEntry, MediaKeyset, MediaStats, MediaStatsHistory, MetaData, Page, PagedRequestOptions, PagedResponseMetadata, PopulateRecentMediaRequest, PostMediaRequest, PostMediaResponse, PostType, PublishMediaRequest, UpdateMediaInsightsRequest, UpdateMediaRequest, User };\n","import { inject, Injectable } from '@angular/core';\nimport { Environment, EnvironmentService } from '@galaxy/core';\nimport { TokenStatus } from '@vendasta/facebook';\nimport { InstagramApiService } from '@vendasta/instagram';\nimport { firstValueFrom, map, Observable, of, shareReplay, switchMap } from 'rxjs';\nimport { PARTNER_ID_TOKEN } from '../../../../core/src/lib/tokens';\nimport { SocialPageFacebook, SocialPageInstagram } from '../interfaces';\n\n// TODO(BREW-687): update this interface according to instagram spec\nexport interface InstagramPageConnectionInfo {\n name: string;\n profileUrl: string;\n tokenStatus: TokenStatus;\n messengerEnabled: boolean;\n isAssignedPageOwner: boolean;\n statusCheckPermissionError?: boolean;\n}\n\n@Injectable({\n providedIn: 'any',\n})\nexport class InstagramMessagesService {\n private readonly instagramAPIService = inject(InstagramApiService);\n private readonly environmentService = inject(EnvironmentService);\n private readonly partnerID$ = inject(PARTNER_ID_TOKEN);\n\n enableMessaging(_instagramPageData: SocialPageInstagram): Observable {\n // TODO: (BREW-703) Connect to Instagram enable messaging API\n return of(false);\n }\n\n async redirectToFacebookAuth(accountID: string): Promise {\n const protocol = window.location.protocol;\n const host = window.location.host;\n const baseUrl = `${protocol}//${host}`;\n const nextUrl: URL = new URL(baseUrl);\n nextUrl.pathname = `/account/location/${accountID}/settings/connections/target/inbox`;\n\n const partnerID = await firstValueFrom(this.partnerID$);\n const env = this.environmentService.getEnvironment() === Environment.PROD ? 'prod' : 'demo';\n window.location.href = `https://instagram-${env}.apigateway.co/v2/auth-user?partnerID=${partnerID}&businessID=${accountID}&nextURL=${nextUrl.href}`;\n }\n\n disableMessaging(_accountID: string, _facebookPageData: SocialPageFacebook): Observable {\n // TODO(BREW-703): Connect to Instagram disable messaging API\n return of(false);\n }\n\n getPagesForAccount(accountGroupId: string): Observable {\n return this.partnerID$.pipe(\n switchMap((partnerID) => {\n return this.instagramAPIService.listUsers({\n partnerId: partnerID,\n businessId: accountGroupId,\n options: {\n pageSize: 100,\n },\n });\n }),\n map((response) => {\n return response.users.map((user): SocialPageInstagram => {\n return {\n type: 'instagram',\n name: user.fullName,\n username: user.username,\n facebookPageId: user.facebookUserId,\n instagramBusinessId: user.instagramUserId,\n internalInstagramUserId: user.userId,\n partnerId: user.partnerId,\n businessId: user.businessId,\n profileUrl: `https://www.instagram.com/${user.username}/`,\n // TODO(BREW-687): Can we populate any of these? Are any relevant?\n isVerified: true,\n locationId: '',\n mapsUri: '',\n ssid: '',\n pages: [],\n clientTags: [],\n deleteUrl: '',\n tokenIsBroken: false,\n };\n });\n }),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n }\n\n getConnectionState(\n instagramPageData: SocialPageInstagram,\n _partnerID: string,\n _accountGroupID: string,\n ): Observable {\n // const enabledForPage$ = this.fbAPIService.facebookPageMessengerState({\n // organizationId: partnerID + ':' + accountGroupID,\n // pageId: facebookPageData.profileUrl?.split('id=')[1],\n // facebookUserId: facebookPageData.facebookUserID,\n // });\n\n // return enabledForPage$.pipe(\n // map((enabledForPage) => {\n // return {\n // name: facebookPageData.name,\n // tokenStatus: TokenStatus.VALID,\n // messengerEnabled: !!enabledForPage.messengerEnabled,\n // isAssignedPageOwner: !!enabledForPage.isPageOwner,\n // };\n // }),\n // catchError((e: HttpErrorResponse) => {\n // const statusCheckPermissionError = e.status === 403;\n // return of({\n // name: facebookPageData.name,\n // tokenStatus: TokenStatus.UNKNOWN,\n // messengerEnabled: false,\n // isAssignedPageOwner: false,\n // statusCheckPermissionError,\n // });\n // }),\n // );\n return of({\n name: instagramPageData.name,\n profileUrl: instagramPageData.profileUrl,\n tokenStatus: TokenStatus.VALID,\n messengerEnabled: false,\n isAssignedPageOwner: true,\n });\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { Component, computed, Input, OnChanges, Signal, signal, SimpleChanges } from '@angular/core';\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { TokenStatus } from '@vendasta/facebook';\nimport { GalaxyAlertModule } from '@vendasta/galaxy/alert';\nimport { GalaxyBadgeModule } from '@vendasta/galaxy/badge';\nimport { GalaxyPopoverModule } from '@vendasta/galaxy/popover';\nimport { GalaxySnackbarModule, SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { filter, firstValueFrom, switchMap } from 'rxjs';\nimport { SocialPageInstagram } from '../interfaces';\nimport { InstagramMessagesService, InstagramPageConnectionInfo } from './instagram-messages.service';\n\ntype badgeValue = {\n color: 'red' | 'green';\n i18nKey: string;\n};\n\ntype displayedButton = 'sign-in' | 'enable' | 'disable' | null;\n\n// TODO(BREW-577): This was copied from the FacebookMessengerComponent. So the\n// methods and properties of this class may need to be updated to handle\n// Instagram specifics.\n@Component({\n selector: 'inbox-instagram-messages',\n standalone: true,\n imports: [\n CommonModule,\n MatCardModule,\n MatIconModule,\n MatButtonModule,\n TranslateModule,\n GalaxyBadgeModule,\n MatProgressSpinnerModule,\n GalaxyAlertModule,\n GalaxyPopoverModule,\n GalaxySnackbarModule,\n ],\n templateUrl: './instagram-messages.component.html',\n styleUrl: './instagram-messages.component.scss',\n})\nexport class InstagramMessagesComponent implements OnChanges {\n readonly loadingAccounts = signal(true);\n readonly loadingPage = signal(false);\n\n readonly pageName: Signal;\n readonly pageUrl: Signal;\n readonly badgeValue: Signal;\n readonly manyPages: Signal;\n readonly noPages: Signal;\n readonly buttonToDisplay: Signal;\n readonly authTokenMissingPermissions: Signal;\n readonly unknownError: Signal;\n // user does not have required auth to view connection status, connect, or disconnect\n readonly authError: Signal;\n readonly messengerEnabled: Signal;\n\n private readonly connectedPages = signal([]);\n private readonly pageInfo = signal(null);\n\n @Input({ required: true }) accountID = '';\n @Input({ required: true }) partnerID = '';\n\n constructor(\n private readonly instagramMessagesService: InstagramMessagesService,\n private readonly snackbarService: SnackbarService,\n ) {\n this.manyPages = computed(() => {\n return this.connectedPages().length > 1;\n });\n\n this.noPages = computed(() => {\n return this.connectedPages().length === 0;\n });\n\n toObservable(this.connectedPages)\n .pipe(\n takeUntilDestroyed(),\n filter((connectedPages) => connectedPages.length > 0),\n switchMap((connectedPages) =>\n this.instagramMessagesService.getConnectionState(connectedPages[0], this.partnerID, this.accountID),\n ),\n )\n .subscribe((pageInfo) => {\n this.loadingPage.set(false);\n this.pageInfo.set(pageInfo);\n });\n\n this.messengerEnabled = computed(\n () =>\n (this.pageInfo()?.messengerEnabled &&\n this.pageInfo()?.tokenStatus === TokenStatus.VALID &&\n this.pageInfo()?.isAssignedPageOwner) ??\n false,\n );\n\n this.badgeValue = computed(() => {\n return {\n color: this.messengerEnabled() ? 'green' : 'red',\n i18nKey: this.messengerEnabled() ? 'INBOX.SETTINGS.ACTIVE' : 'INBOX.SETTINGS.INACTIVE',\n };\n });\n this.pageName = computed(() => this.pageInfo()?.name ?? '');\n this.pageUrl = computed(() => this.pageInfo()?.profileUrl ?? '');\n this.authTokenMissingPermissions = computed(() => this.pageInfo()?.tokenStatus === TokenStatus.MISSING_PERMISSIONS);\n this.unknownError = computed(() => this.pageInfo()?.tokenStatus === TokenStatus.INVALID);\n this.authError = computed(() => this.pageInfo()?.statusCheckPermissionError ?? false);\n\n this.buttonToDisplay = computed(() => {\n if (this.noPages()) {\n return 'sign-in';\n } else if (this.messengerEnabled()) {\n return 'disable';\n } else if (this.unknownError()) {\n return null;\n } else if (!this.messengerEnabled() && this.pageInfo()?.tokenStatus === TokenStatus.VALID) {\n return 'enable';\n } else {\n return null;\n }\n });\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['accountID']) {\n this.loadingAccounts.set(true);\n firstValueFrom(this.instagramMessagesService.getPagesForAccount(changes['accountID'].currentValue))\n .then((pages) => {\n if (pages.length > 0) {\n this.connectedPages.set(pages);\n this.loadingPage.set(true);\n } else {\n this.connectedPages.set([]);\n }\n })\n .catch(() => {\n this.connectedPages.set([]);\n })\n .finally(() => {\n this.loadingAccounts.set(false);\n });\n }\n }\n\n authClick() {\n this.instagramMessagesService.redirectToFacebookAuth(this.accountID);\n }\n\n async connect(): Promise {\n this.loadingAccounts.set(true);\n return firstValueFrom(this.instagramMessagesService.enableMessaging(this.connectedPages()[0]))\n .then((success) => {\n if (success) {\n this.snackbarService.openSuccessSnack('INBOX.SETTINGS.FACEBOOK_MESSENGER.SUCCESS.SUCCESSFULLY_ENABLED');\n const pages = this.connectedPages();\n this.connectedPages.update(() => []); // update only emmits if the value changes\n this.connectedPages.update(() => pages);\n } else {\n this.snackbarService.openErrorSnack('INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.FAILED_TO_ENABLE');\n }\n })\n .finally(() => this.loadingAccounts.set(false));\n }\n\n async disconnect(): Promise {\n this.loadingAccounts.set(true);\n return firstValueFrom(this.instagramMessagesService.disableMessaging(this.accountID, this.connectedPages()[0]))\n .then((success) => {\n if (success) {\n this.snackbarService.openSuccessSnack('INBOX.SETTINGS.FACEBOOK_MESSENGER.SUCCESS.SUCCESSFULLY_DISABLED');\n const pages = this.connectedPages();\n this.connectedPages.update(() => []); // update only emmits if the value changes\n this.connectedPages.update(() => pages);\n } else {\n this.snackbarService.openErrorSnack('INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.FAILED_TO_DISABLE');\n }\n })\n .finally(() => this.loadingAccounts.set(false));\n }\n}\n","\n\n \n \n \n {{ badgeValue()!.i18nKey | translate }}\n \n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.TITLE' | translate }}\n \n \n
\n \n
\n \n

\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.DESCRIPTION' | translate }}\n

\n

\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.DISCONNECTED_DESCRIPTION' | translate }}\n

\n

\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.INSTAGRAM_PAGE_NAME' | translate }}: \n @if (pageUrl()) {\n {{ pageName() }}\n } @else {\n {{ pageName() }}\n }\n

\n

\n \n \n \n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.DISCONNECT' | translate }}\n \n

\n \n

\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.ERRORS.UNKNOWN_ERROR' | translate }}\n
\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.ERRORS.PLEASE_TRY_RECONNECTING' | translate }}\n

\n \n \n

\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.ERRORS.PERMISSIONS_ERROR' | translate }}\n
\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.ERRORS.PERMISSIONS_ERROR_DESCRIPTION' | translate }}\n

\n
\n \n

\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.ERRORS.PERMISSIONS_ERROR' | translate }}\n
\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.ERRORS.RECONNECT_TO_GRANT_PERMISSIONS' | translate }}\n

\n \n \n

\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.WARNINGS.MULTIPLE_PAGES_LINKED' | translate }}\n
\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.WARNINGS.MULTIPLE_PAGES_LINKED_DESCRIPTION' | translate }}\n \n

\n
\n
\n
\n
\n\n\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.DISCONNECT_TITLE' | translate }}\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.DISCONNECT_DESCRIPTION' | translate }}\n \n \n \n \n\n","import { CommonModule } from '@angular/common';\nimport { Component } from '@angular/core';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { MatButtonModule } from '@angular/material/button';\nimport { TranslateModule } from '@ngx-translate/core';\n@Component({\n selector: 'inbox-webchat-learn-more',\n standalone: true,\n imports: [CommonModule, MatDialogModule, MatButtonModule, TranslateModule],\n templateUrl: './webchat-learn-more.component.html',\n styleUrls: ['./webchat-learn-more.component.scss'],\n})\nexport class WebchatLearnMoreComponent {}\n","

{{ 'INBOX.WEBCHAT.LEARN_MORE.TITLE' | translate }}

\n\n

{{ 'INBOX.WEBCHAT.LEARN_MORE.WHAT_CAN_DO_QUESTION' | translate }}

\n {{ 'INBOX.WEBCHAT.LEARN_MORE.WHAT_CAN_DO' | translate }}\n\n

{{ 'INBOX.WEBCHAT.LEARN_MORE.HOW_IT_WORKS_QUESTION' | translate }}

\n {{ 'INBOX.WEBCHAT.LEARN_MORE.HOW_IT_WORKS' | translate }}\n\n

{{ 'INBOX.WEBCHAT.LEARN_MORE.HOW_TO_GET_MOST_QUESTION' | translate }}

\n {{ 'INBOX.WEBCHAT.LEARN_MORE.HOW_TO_GET_MOST' | translate }}\n\n

{{ 'INBOX.WEBCHAT.LEARN_MORE.HOW_TEST_IT_QUESTION' | translate }}

\n {{ 'INBOX.WEBCHAT.LEARN_MORE.HOW_TEST_IT' | translate }}\n
\n\n \n\n","import { Component, inject, Input, signal } from '@angular/core';\nimport { MatCardModule } from '@angular/material/card';\nimport { GalaxyBadgeModule } from '@vendasta/galaxy/badge';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatSlideToggleModule } from '@angular/material/slide-toggle';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { WebchatLearnMoreComponent } from '../webchat-learn-more/webchat-learn-more.component';\nimport { MatDialog } from '@angular/material/dialog';\nimport { catchError, firstValueFrom, throwError } from 'rxjs';\nimport { AsyncPipe, NgIf } from '@angular/common';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { ConversationApiService } from '@vendasta/conversation';\nimport { Widget } from '../webchat-form/widget';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\n\nconst CREATE_WEBCHAT_URL = `../widgets/new`;\nconst WEBCHAT_ICON = 'https://vstatic-prod.apigateway.co/business-center-client/assets/webchat-icon.svg';\n\n@Component({\n selector: 'inbox-webchat-config-card',\n standalone: true,\n templateUrl: './webchat-config-card.component.html',\n styleUrls: ['./webchat-config-card.component.scss'],\n imports: [MatCardModule, GalaxyBadgeModule, MatButtonModule, MatSlideToggleModule, TranslateModule, AsyncPipe, NgIf],\n})\nexport class WebchatConfigCardComponent {\n @Input() set widget(value: Widget) {\n this.webchat.set(value);\n }\n @Input() created?: boolean = true;\n\n webchat = signal(null);\n protected readonly webchatIcon = WEBCHAT_ICON;\n\n private readonly dialog = inject(MatDialog);\n private readonly router = inject(Router);\n private route = inject(ActivatedRoute);\n private readonly conversationApiService = inject(ConversationApiService);\n private snackbarService = inject(SnackbarService);\n\n protected async handleToggleChange(): Promise {\n try {\n const resp = await firstValueFrom(\n this.conversationApiService\n .updateWidget({\n widgetId: this.webchat().widgetId,\n isEnabled: !this.webchat().isEnabled,\n fieldMask: {\n paths: ['is_enabled'],\n },\n })\n .pipe(catchError((err) => throwError(() => err))),\n );\n this.webchat.set(resp.widget);\n this.snackbarService.openSuccessSnack('INBOX.WEBCHAT.SETTINGS.WEBCHAT_UPDATED');\n } catch (e) {\n this.snackbarService.openErrorSnack('INBOX.WEBCHAT.SETTINGS.WEBCHAT_UPDATE_ERROR');\n }\n }\n\n protected learnMore(): void {\n this.dialog.open(WebchatLearnMoreComponent, {\n width: '660px',\n });\n }\n\n protected webChatCardRedirect(): void {\n this.router.navigate([this.created ? `../widgets/${this.webchat().widgetId}/edit` : CREATE_WEBCHAT_URL], {\n relativeTo: this.route,\n });\n }\n}\n","\n \n \"avatar\"\n \n {{ webchat()?.name ? webchat()?.name : ('INBOX.WEBCHAT.SETTINGS.TITLE' | translate) }}\n \n
\n {{ 'INBOX.SETTINGS.ACTIVE' | translate }}\n \n {{ 'INBOX.WEBCHAT.SETTINGS.NOT_ACTIVE' | translate }}\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.SETUP_REQUIRED' | translate }}\n \n
\n
\n \n
\n {{ 'INBOX.WEBCHAT.SETTINGS.DESCRIPTION' | translate }}\n {{ 'INBOX.WEBCHAT.SETTINGS.LEARN_MORE' | translate }}\n
\n
\n \n
\n {{ 'INBOX.WEBCHAT.SETTINGS.ENABLED_WEBCHAT' | translate }}\n
{{ 'INBOX.WEBCHAT.SETTINGS.ENABLED_DESCRIPTION' | translate }}
\n
\n
\n \n
\n
\n","import { CommonModule } from '@angular/common';\nimport { Component, DestroyRef, inject, Inject, OnInit } from '@angular/core';\nimport { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\nimport { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatSlideToggleModule } from '@angular/material/slide-toggle';\nimport { ActivatedRoute, Router, RouterModule } from '@angular/router';\nimport { SmsModule } from '@galaxy/sms';\nimport { TranslateModule } from '@ngx-translate/core';\nimport {\n Configuration,\n ConversationApiService,\n GlobalParticipantType,\n InboxApiService,\n Widget,\n} from '@vendasta/conversation';\nimport { GalaxyEmptyStateModule } from '@vendasta/galaxy/empty-state';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { GalaxyPageModule } from '@vendasta/galaxy/page';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { BehaviorSubject, combineLatest, firstValueFrom, map, Observable, shareReplay } from 'rxjs';\nimport { catchError, distinctUntilChanged, switchMap, tap } from 'rxjs/operators';\nimport {\n ACCOUNT_GROUP_ID_TOKEN,\n CONVERSATION_FACEBOOK_MESSENGER_AVAILABLE_TOKEN,\n CONVERSATION_GOOGLE_BUSINESS_MESSAGES_AVAILABLE_TOKEN,\n CONVERSATION_INSTAGRAM_MESSAGES_AVAILABLE_TOKEN,\n InboxService,\n PARTNER_ID_TOKEN,\n} from '../../../core/src/index';\nimport { InboxPreviewComponent } from '../inbox-preview/inbox-preview.component';\nimport { EmailSettingsCardComponent } from './email-configuration/email-settings-card.component';\nimport { FacebookMessengerComponent } from './facebook-messenger/facebook-messenger.component';\nimport { GoogleBusinessCommunicationCardComponent } from './google-business-communication-card/google-business-communication-card.component';\nimport { InstagramMessagesComponent } from './instagram-messages/instagram-messages.component';\nimport { WebchatConfigCardComponent } from './webchat-configuration/webchat-config-card/webchat-config-card.component';\n\n@Component({\n standalone: true,\n imports: [\n CommonModule,\n ReactiveFormsModule,\n RouterModule,\n TranslateModule,\n GalaxyPageModule,\n GalaxyFormFieldModule,\n MatButtonModule,\n MatCardModule,\n MatInputModule,\n MatSlideToggleModule,\n MatIconModule,\n InboxPreviewComponent,\n GalaxyEmptyStateModule,\n SmsModule,\n GoogleBusinessCommunicationCardComponent,\n FacebookMessengerComponent,\n InstagramMessagesComponent,\n WebchatConfigCardComponent,\n EmailSettingsCardComponent,\n ],\n templateUrl: './settings.component.html',\n styleUrls: ['./settings.component.scss'],\n})\nexport class SettingsComponent implements OnInit {\n private readonly loading$$ = new BehaviorSubject(true);\n protected readonly loading$ = this.loading$$.asObservable();\n protected readonly showAvailabilityMessageSettings$ = this.inboxService.showAvailabilityMessageSettings$;\n protected readonly canAccessWebChatSettingsCard$ = this.inboxService.canAccessWebChatSettings$;\n protected readonly canAccessMessageTemplateSettingsCard$ = this.inboxService.canAccessMessageTemplateSettingsCard$;\n protected readonly canAccessEmailChannel$ = this.inboxService.canAccessEmailChannel$;\n // Only show save button if there is at least one setting that requires saving.\n protected readonly showSaveButton$ = this.showAvailabilityMessageSettings$;\n\n protected readonly form = new FormGroup({\n showAvailabilityMessage: new FormControl(false),\n availabilityMessage: new FormControl(''),\n });\n\n protected readonly isPartnerCenter = this.inboxService.isPartnerCenter;\n protected readonly isBusinessApp = this.inboxService.isBusinessApp;\n protected readonly displayA2pCard$ = this.inboxService.displayA2pCard$();\n protected readonly displayGoogleBusinessCommunicationCard$: Observable;\n protected readonly displayEmptyState$: Observable;\n\n private accountGroupId = toSignal(inject(ACCOUNT_GROUP_ID_TOKEN));\n protected readonly webchats$: Observable = this.partnerId$.pipe(\n switchMap((partnerId) => {\n const namespaceID = this.isPartnerCenter ? partnerId : this.accountGroupId();\n return this.conversationApiService.listWidgets({\n namespace: namespaceID,\n });\n }),\n map((listWidgets) => listWidgets?.widgets),\n shareReplay({ bufferSize: 1, refCount: true }),\n catchError(async (err) => {\n return err;\n }),\n );\n protected readonly webchatStatus$: Observable = this.webchats$.pipe(map((webchats) => webchats?.length > 0));\n private route = inject(ActivatedRoute);\n\n readonly businessAppSettingsPageUrl$ = this.accountGroupId$.pipe(\n map((accountGroupId) => `/account/location/${accountGroupId}/settings`),\n );\n\n constructor(\n private readonly inboxApiService: InboxApiService,\n private readonly snackbarService: SnackbarService,\n private readonly inboxService: InboxService,\n private readonly router: Router,\n @Inject(ACCOUNT_GROUP_ID_TOKEN) readonly accountGroupId$: Observable,\n @Inject(PARTNER_ID_TOKEN) protected readonly partnerId$: Observable,\n @Inject(CONVERSATION_GOOGLE_BUSINESS_MESSAGES_AVAILABLE_TOKEN)\n readonly googleBusinessMessagesAvailable$: Observable,\n @Inject(CONVERSATION_FACEBOOK_MESSENGER_AVAILABLE_TOKEN) readonly facebookMessengerAvailable$: Observable,\n @Inject(CONVERSATION_INSTAGRAM_MESSAGES_AVAILABLE_TOKEN) readonly instagramMessengerAvailable$: Observable,\n private readonly destroyRef: DestroyRef,\n private readonly conversationApiService: ConversationApiService,\n ) {\n this.displayGoogleBusinessCommunicationCard$ = this.googleBusinessMessagesAvailable$;\n this.facebookMessengerAvailable$;\n this.displayEmptyState$ = combineLatest([\n this.displayA2pCard$,\n this.displayGoogleBusinessCommunicationCard$,\n this.canAccessWebChatSettingsCard$,\n this.canAccessMessageTemplateSettingsCard$,\n this.facebookMessengerAvailable$,\n ]).pipe(\n map(\n ([\n displayA2pCard,\n displayGoogleCard,\n canAccessWebChatSettings,\n canAccessTemplates,\n facebookAvailable,\n ]): boolean => {\n const flags = [\n displayA2pCard,\n displayGoogleCard,\n canAccessWebChatSettings,\n canAccessTemplates,\n this.isPartnerCenter,\n facebookAvailable,\n ];\n return !flags.some(Boolean);\n },\n ),\n );\n }\n\n ngOnInit(): void {\n const showAvailabilityMessage = this.form.get('showAvailabilityMessage');\n if (showAvailabilityMessage) {\n showAvailabilityMessage.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((enabled) => {\n const field = this.form.get('availabilityMessage');\n enabled ? field?.enable() : field?.disable();\n });\n }\n\n this.partnerId$\n .pipe(\n tap(() => this.loading$$.next(true)),\n takeUntilDestroyed(this.destroyRef),\n distinctUntilChanged(),\n switchMap((partnerId) =>\n this.inboxApiService.getConfiguration({\n subjectParticipant: {\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_PARTNER,\n internalParticipantId: partnerId,\n },\n }),\n ),\n )\n .subscribe({\n next: (config) => {\n this.loading$$.next(false);\n this.updateForm(config.configuration);\n },\n error: (err) => {\n if (err.status !== 404) {\n this.snackbarService.openErrorSnack('INBOX.SETTINGS.ERROR_LOADING_SETTINGS');\n }\n this.loading$$.next(false);\n },\n });\n }\n\n protected async onSubmit(): Promise {\n this.loading$$.next(true);\n\n const partnerId = await firstValueFrom(this.partnerId$);\n const req = this.inboxApiService.upsertConfiguration({\n configuration: {\n subjectParticipant: {\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_PARTNER,\n internalParticipantId: partnerId,\n },\n showAvailabilityMessage: this.form.getRawValue().showAvailabilityMessage ?? undefined,\n availabilityMessage: this.form.getRawValue().availabilityMessage ?? undefined,\n },\n });\n\n await firstValueFrom(req)\n .then((resp) => {\n this.snackbarService.openSuccessSnack('INBOX.SETTINGS.SAVE_SUCCESSFUL');\n this.updateForm(resp.configuration);\n })\n .catch(() => {\n this.snackbarService.openErrorSnack('INBOX.SETTINGS.ERROR_SAVING_SETTINGS');\n });\n\n this.loading$$.next(false);\n }\n\n protected goToAutomations(): void {\n this.router\n .navigate(['/automations'])\n .then(() => this.router.navigate([{ outlets: { inbox: null } }], { queryParamsHandling: 'merge' }));\n }\n\n protected goToTemplatePage(): void {\n if (this.isBusinessApp) {\n this.router.navigate([`../message-templates`], {\n relativeTo: this.route,\n });\n } else {\n this.router.navigate(['', { outlets: { inbox: 'inbox/settings/message-templates' } }], {\n queryParamsHandling: 'merge',\n });\n }\n }\n\n private updateForm(config: Configuration): void {\n this.form.patchValue({\n showAvailabilityMessage: config.showAvailabilityMessage,\n availabilityMessage: config.availabilityMessage,\n });\n }\n}\n","\n \n \n \n \n \n\n \n \n arrow_back\n \n \n {{ 'INBOX.SETTINGS.PAGE_TITLE' | translate }}\n \n \n \n \n\n \n
\n \n \n {{ 'INBOX.SETTINGS.CHAT_AVAILABILITY' | translate }}\n \n \n
\n \n
\n \n {{ 'INBOX.SETTINGS.DISPLAY_AVAILABILITY_MESSAGE' | translate }}\n \n
\n
\n {{ 'INBOX.SETTINGS.AVAILABILITY_DESCRIPTION' | translate }}\n
\n
\n\n \n {{ 'INBOX.SETTINGS.AVAILABILITY_MESSAGE' | translate }}\n \n \n
\n
\n
{{ 'INBOX.SETTINGS.PREVIEW_TITLE' | translate }}
\n
\n \n
\n
\n
\n
\n\n \n \n {{ 'INBOX.SETTINGS.AUTOMATIONS' | translate }}\n \n \n
\n {{ 'INBOX.SETTINGS.AUTOMATIONS_DESCRIPTION' | translate }}\n \n {{ 'INBOX.SETTINGS.LEARN_MORE' | translate }}\n \n
\n \n
\n
\n\n \n\n \n\n \n\n \n\n \n\n \n \n \n \n \n \n \n \n\n \n \n \n {{ 'INBOX.SETTINGS.MESSAGE_TEMPLATES.TITLE' | translate }}\n \n \n
{{ 'INBOX.SETTINGS.MESSAGE_TEMPLATES.DESCRIPTION' | translate }}
\n \n
\n
\n
\n
\n\n \n \n \n
\n\n\n \n \n
\n
\n {{ 'INBOX.SETTINGS.EMPTY_STATE.TITLE' | translate }}\n

{{ 'INBOX.SETTINGS.EMPTY_STATE.DESCRIPTION' | translate }}

\n
\n
\n","import { Injectable } from '@angular/core';\nimport { ActivatedRouteSnapshot, Router, UrlTree } from '@angular/router';\nimport { Observable } from 'rxjs';\nimport { tap } from 'rxjs/operators';\nimport { InboxService } from '../../../core/src/lib/inbox.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SettingsAccessGuard {\n constructor(readonly inboxService: InboxService, private router: Router) {}\n\n canActivate(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _: ActivatedRouteSnapshot,\n ): Observable | Promise | boolean | UrlTree {\n return this.inboxService.canAccessEmbeddedSettings$.pipe(\n tap((canAccess) => {\n if (!canAccess) {\n this.router.navigate([{ outlets: { inbox: 'inbox' } }]);\n }\n }),\n );\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { Component, EventEmitter, Input, Output } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCardModule } from '@angular/material/card';\nimport { RouterModule } from '@angular/router';\nimport { TranslateModule } from '@ngx-translate/core';\n\n@Component({\n selector: 'inbox-sticky-footer',\n standalone: true,\n imports: [CommonModule, RouterModule, MatCardModule, MatButtonModule, TranslateModule],\n templateUrl: './sticky-footer.component.html',\n styleUrls: ['./sticky-footer.component.scss'],\n})\nexport class StickyFooterComponent {\n @Output() public submitClick = new EventEmitter();\n @Input() public cancelLink: string;\n @Input() public disabled = false;\n @Input() public submitOverride?: string;\n @Input() public cancelOverride?: string;\n\n onSubmit(): void {\n this.submitClick.emit();\n }\n}\n","\n \n \n \n {{ cancelOverride || 'INBOX.CANCEL' | translate }}\n \n \n\n","const PARTNER_CENTER_SETTINGS_URL = 'settings';\nconst BUSINESS_APP_SETTINGS_URL = 'inbox';\n\nexport function getBackUrl(isBusinessApp: boolean, levelsDeep: number): string {\n const centerUrl = isBusinessApp ? BUSINESS_APP_SETTINGS_URL : PARTNER_CENTER_SETTINGS_URL;\n let url = '';\n for (let i = 0; i < levelsDeep; i++) {\n url += '../';\n }\n return `${url}${centerUrl}`;\n}\n","import * as i0 from '@angular/core';\nimport { Injectable } from '@angular/core';\nimport { map } from 'rxjs/operators';\nimport * as i1 from '@angular/common/http';\nimport { HttpHeaders } from '@angular/common/http';\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar EmbeddingSourceType = /*#__PURE__*/function (EmbeddingSourceType) {\n EmbeddingSourceType[EmbeddingSourceType[\"EMBEDDING_SOURCE_TYPE_INVALID\"] = 0] = \"EMBEDDING_SOURCE_TYPE_INVALID\";\n EmbeddingSourceType[EmbeddingSourceType[\"EMBEDDING_SOURCE_TYPE_USER_INPUT\"] = 1] = \"EMBEDDING_SOURCE_TYPE_USER_INPUT\";\n EmbeddingSourceType[EmbeddingSourceType[\"EMBEDDING_SOURCE_TYPE_WEBSITE\"] = 2] = \"EMBEDDING_SOURCE_TYPE_WEBSITE\";\n EmbeddingSourceType[EmbeddingSourceType[\"EMBEDDING_SOURCE_TYPE_BUSINESS_PROFILE\"] = 3] = \"EMBEDDING_SOURCE_TYPE_BUSINESS_PROFILE\";\n return EmbeddingSourceType;\n}(EmbeddingSourceType || {});\nvar EmbeddingVendorModel = /*#__PURE__*/function (EmbeddingVendorModel) {\n EmbeddingVendorModel[EmbeddingVendorModel[\"EMBEDDING_MODEL_INVALID\"] = 0] = \"EMBEDDING_MODEL_INVALID\";\n EmbeddingVendorModel[EmbeddingVendorModel[\"EMBEDDING_MODEL_OPENAI_ADA_V2\"] = 1] = \"EMBEDDING_MODEL_OPENAI_ADA_V2\";\n EmbeddingVendorModel[EmbeddingVendorModel[\"EMBEDDING_MODEL_GOOGLE_GECKO_V2\"] = 2] = \"EMBEDDING_MODEL_GOOGLE_GECKO_V2\";\n return EmbeddingVendorModel;\n}(EmbeddingVendorModel || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar KnowledgeSourceConfigType = /*#__PURE__*/function (KnowledgeSourceConfigType) {\n KnowledgeSourceConfigType[KnowledgeSourceConfigType[\"KNOWLEDGE_SOURCE_CONFIG_TYPE_INVALID\"] = 0] = \"KNOWLEDGE_SOURCE_CONFIG_TYPE_INVALID\";\n KnowledgeSourceConfigType[KnowledgeSourceConfigType[\"KNOWLEDGE_SOURCE_CONFIG_TYPE_BUSINESS_PROFILE\"] = 1] = \"KNOWLEDGE_SOURCE_CONFIG_TYPE_BUSINESS_PROFILE\";\n KnowledgeSourceConfigType[KnowledgeSourceConfigType[\"KNOWLEDGE_SOURCE_CONFIG_TYPE_CUSTOM_DATA\"] = 2] = \"KNOWLEDGE_SOURCE_CONFIG_TYPE_CUSTOM_DATA\";\n KnowledgeSourceConfigType[KnowledgeSourceConfigType[\"KNOWLEDGE_SOURCE_CONFIG_TYPE_WEBSITE_SCRAPE\"] = 3] = \"KNOWLEDGE_SOURCE_CONFIG_TYPE_WEBSITE_SCRAPE\";\n return KnowledgeSourceConfigType;\n}(KnowledgeSourceConfigType || {});\nvar WebsiteScrapeConfigCrawlMode = /*#__PURE__*/function (WebsiteScrapeConfigCrawlMode) {\n WebsiteScrapeConfigCrawlMode[WebsiteScrapeConfigCrawlMode[\"WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_INVALID\"] = 0] = \"WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_INVALID\";\n WebsiteScrapeConfigCrawlMode[WebsiteScrapeConfigCrawlMode[\"WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_SINGLE\"] = 1] = \"WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_SINGLE\";\n WebsiteScrapeConfigCrawlMode[WebsiteScrapeConfigCrawlMode[\"WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_RECURSIVE\"] = 2] = \"WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_RECURSIVE\";\n return WebsiteScrapeConfigCrawlMode;\n}(WebsiteScrapeConfigCrawlMode || {});\nvar WebsiteScrapeConfigProgress = /*#__PURE__*/function (WebsiteScrapeConfigProgress) {\n WebsiteScrapeConfigProgress[WebsiteScrapeConfigProgress[\"WEBSITE_SCRAPE_CONFIG_PROGRESS_INVALID\"] = 0] = \"WEBSITE_SCRAPE_CONFIG_PROGRESS_INVALID\";\n WebsiteScrapeConfigProgress[WebsiteScrapeConfigProgress[\"WEBSITE_SCRAPE_CONFIG_PROGRESS_QUEUED\"] = 1] = \"WEBSITE_SCRAPE_CONFIG_PROGRESS_QUEUED\";\n WebsiteScrapeConfigProgress[WebsiteScrapeConfigProgress[\"WEBSITE_SCRAPE_CONFIG_PROGRESS_IN_PROGRESS\"] = 2] = \"WEBSITE_SCRAPE_CONFIG_PROGRESS_IN_PROGRESS\";\n WebsiteScrapeConfigProgress[WebsiteScrapeConfigProgress[\"WEBSITE_SCRAPE_CONFIG_PROGRESS_DONE\"] = 3] = \"WEBSITE_SCRAPE_CONFIG_PROGRESS_DONE\";\n return WebsiteScrapeConfigProgress;\n}(WebsiteScrapeConfigProgress || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar RefreshAccountGroupWebsiteEmbeddingsProgress = /*#__PURE__*/function (RefreshAccountGroupWebsiteEmbeddingsProgress) {\n RefreshAccountGroupWebsiteEmbeddingsProgress[RefreshAccountGroupWebsiteEmbeddingsProgress[\"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_INVALID\"] = 0] = \"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_INVALID\";\n RefreshAccountGroupWebsiteEmbeddingsProgress[RefreshAccountGroupWebsiteEmbeddingsProgress[\"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_SCRAPE_STARTED\"] = 1] = \"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_SCRAPE_STARTED\";\n RefreshAccountGroupWebsiteEmbeddingsProgress[RefreshAccountGroupWebsiteEmbeddingsProgress[\"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_ANALYSIS_STARTED\"] = 2] = \"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_ANALYSIS_STARTED\";\n RefreshAccountGroupWebsiteEmbeddingsProgress[RefreshAccountGroupWebsiteEmbeddingsProgress[\"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_COMPLETE\"] = 3] = \"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_COMPLETE\";\n RefreshAccountGroupWebsiteEmbeddingsProgress[RefreshAccountGroupWebsiteEmbeddingsProgress[\"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_FAILED\"] = 4] = \"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_FAILED\";\n return RefreshAccountGroupWebsiteEmbeddingsProgress;\n}(RefreshAccountGroupWebsiteEmbeddingsProgress || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums Index.\n// *********************************\n\nfunction enumStringToValue$5(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Embedding {\n static fromProto(proto) {\n let m = new Embedding();\n m = Object.assign(m, proto);\n if (proto.metadata) {\n m.metadata = EmbeddingMetadata.fromProto(proto.metadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.content !== 'undefined') {\n toReturn['content'] = this.content;\n }\n if (typeof this.originalContent !== 'undefined') {\n toReturn['originalContent'] = this.originalContent;\n }\n if (typeof this.metadata !== 'undefined' && this.metadata !== null) {\n toReturn['metadata'] = 'toApiJson' in this.metadata ? this.metadata.toApiJson() : this.metadata;\n }\n return toReturn;\n }\n}\nclass EmbeddingCitation {\n static fromProto(proto) {\n let m = new EmbeddingCitation();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.link !== 'undefined') {\n toReturn['link'] = this.link;\n }\n if (typeof this.title !== 'undefined') {\n toReturn['title'] = this.title;\n }\n if (typeof this.description !== 'undefined') {\n toReturn['description'] = this.description;\n }\n return toReturn;\n }\n}\nclass EmbeddingMetadata {\n static fromProto(proto) {\n let m = new EmbeddingMetadata();\n m = Object.assign(m, proto);\n if (proto.createdAt) {\n m.createdAt = new Date(proto.createdAt);\n }\n if (proto.updatedAt) {\n m.updatedAt = new Date(proto.updatedAt);\n }\n if (proto.relationship) {\n m.relationship = EmbeddingRelationship.fromProto(proto.relationship);\n }\n if (proto.sourceType) {\n m.sourceType = enumStringToValue$5(EmbeddingSourceType, proto.sourceType);\n }\n if (proto.vendorModel) {\n m.vendorModel = enumStringToValue$5(EmbeddingVendorModel, proto.vendorModel);\n }\n if (proto.citation) {\n m.citation = EmbeddingCitation.fromProto(proto.citation);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.createdBy !== 'undefined') {\n toReturn['createdBy'] = this.createdBy;\n }\n if (typeof this.createdAt !== 'undefined' && this.createdAt !== null) {\n toReturn['createdAt'] = 'toApiJson' in this.createdAt ? this.createdAt.toApiJson() : this.createdAt;\n }\n if (typeof this.updatedAt !== 'undefined' && this.updatedAt !== null) {\n toReturn['updatedAt'] = 'toApiJson' in this.updatedAt ? this.updatedAt.toApiJson() : this.updatedAt;\n }\n if (typeof this.relationship !== 'undefined' && this.relationship !== null) {\n toReturn['relationship'] = 'toApiJson' in this.relationship ? this.relationship.toApiJson() : this.relationship;\n }\n if (typeof this.sourceType !== 'undefined') {\n toReturn['sourceType'] = this.sourceType;\n }\n if (typeof this.sourceFeature !== 'undefined') {\n toReturn['sourceFeature'] = this.sourceFeature;\n }\n if (typeof this.vendorModel !== 'undefined') {\n toReturn['vendorModel'] = this.vendorModel;\n }\n if (typeof this.citation !== 'undefined' && this.citation !== null) {\n toReturn['citation'] = 'toApiJson' in this.citation ? this.citation.toApiJson() : this.citation;\n }\n if (typeof this.disabled !== 'undefined') {\n toReturn['disabled'] = this.disabled;\n }\n return toReturn;\n }\n}\nclass EmbeddingRelationship {\n static fromProto(proto) {\n let m = new EmbeddingRelationship();\n m = Object.assign(m, proto);\n if (proto.accountGroup) {\n m.accountGroup = EmbeddingRelationshipAccountGroup.fromProto(proto.accountGroup);\n }\n if (proto.partner) {\n m.partner = EmbeddingRelationshipPartner.fromProto(proto.partner);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroup !== 'undefined' && this.accountGroup !== null) {\n toReturn['accountGroup'] = 'toApiJson' in this.accountGroup ? this.accountGroup.toApiJson() : this.accountGroup;\n }\n if (typeof this.partner !== 'undefined' && this.partner !== null) {\n toReturn['partner'] = 'toApiJson' in this.partner ? this.partner.toApiJson() : this.partner;\n }\n return toReturn;\n }\n}\nclass EmbeddingRelationshipAccountGroup {\n static fromProto(proto) {\n let m = new EmbeddingRelationshipAccountGroup();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.marketId !== 'undefined') {\n toReturn['marketId'] = this.marketId;\n }\n return toReturn;\n }\n}\nclass EmbeddingRelationshipPartner {\n static fromProto(proto) {\n let m = new EmbeddingRelationshipPartner();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$4(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass NamespaceAccountGroupNamespace {\n static fromProto(proto) {\n let m = new NamespaceAccountGroupNamespace();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.marketId !== 'undefined') {\n toReturn['marketId'] = this.marketId;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n return toReturn;\n }\n}\nclass App {\n static fromProto(proto) {\n let m = new App();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n if (proto.knowledgeBaseKeys) {\n m.knowledgeBaseKeys = proto.knowledgeBaseKeys.map(KnowledgeBaseKey.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.configurationUrl !== 'undefined') {\n toReturn['configurationUrl'] = this.configurationUrl;\n }\n if (typeof this.knowledgeBaseKeys !== 'undefined' && this.knowledgeBaseKeys !== null) {\n toReturn['knowledgeBaseKeys'] = 'toApiJson' in this.knowledgeBaseKeys ? this.knowledgeBaseKeys.toApiJson() : this.knowledgeBaseKeys;\n }\n return toReturn;\n }\n}\nclass KnowledgeSourceConfigBusinessProfileConfig {\n static fromProto(proto) {\n let m = new KnowledgeSourceConfigBusinessProfileConfig();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass KnowledgeSourceConfigCustomDataConfig {\n static fromProto(proto) {\n let m = new KnowledgeSourceConfigCustomDataConfig();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.text !== 'undefined') {\n toReturn['text'] = this.text;\n }\n if (typeof this.fileUrl !== 'undefined') {\n toReturn['fileUrl'] = this.fileUrl;\n }\n return toReturn;\n }\n}\nclass KnowledgeBase {\n static fromProto(proto) {\n let m = new KnowledgeBase();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n if (proto.knowledgeSourceKeys) {\n m.knowledgeSourceKeys = proto.knowledgeSourceKeys.map(KnowledgeSourceKey.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.description !== 'undefined') {\n toReturn['description'] = this.description;\n }\n if (typeof this.knowledgeSourceKeys !== 'undefined' && this.knowledgeSourceKeys !== null) {\n toReturn['knowledgeSourceKeys'] = 'toApiJson' in this.knowledgeSourceKeys ? this.knowledgeSourceKeys.toApiJson() : this.knowledgeSourceKeys;\n }\n return toReturn;\n }\n}\nclass KnowledgeBaseKey {\n static fromProto(proto) {\n let m = new KnowledgeBaseKey();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeBaseId !== 'undefined') {\n toReturn['knowledgeBaseId'] = this.knowledgeBaseId;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass KnowledgeSource {\n static fromProto(proto) {\n let m = new KnowledgeSource();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n if (proto.config) {\n m.config = KnowledgeSourceConfig.fromProto(proto.config);\n }\n if (proto.knowledgeBaseKeys) {\n m.knowledgeBaseKeys = proto.knowledgeBaseKeys.map(KnowledgeBaseKey.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.description !== 'undefined') {\n toReturn['description'] = this.description;\n }\n if (typeof this.config !== 'undefined' && this.config !== null) {\n toReturn['config'] = 'toApiJson' in this.config ? this.config.toApiJson() : this.config;\n }\n if (typeof this.knowledgeBaseKeys !== 'undefined' && this.knowledgeBaseKeys !== null) {\n toReturn['knowledgeBaseKeys'] = 'toApiJson' in this.knowledgeBaseKeys ? this.knowledgeBaseKeys.toApiJson() : this.knowledgeBaseKeys;\n }\n return toReturn;\n }\n}\nclass KnowledgeSourceConfig {\n static fromProto(proto) {\n let m = new KnowledgeSourceConfig();\n m = Object.assign(m, proto);\n if (proto.businessProfileConfig) {\n m.businessProfileConfig = KnowledgeSourceConfigBusinessProfileConfig.fromProto(proto.businessProfileConfig);\n }\n if (proto.customDataConfig) {\n m.customDataConfig = KnowledgeSourceConfigCustomDataConfig.fromProto(proto.customDataConfig);\n }\n if (proto.websiteScrapeConfig) {\n m.websiteScrapeConfig = KnowledgeSourceConfigWebsiteScrapeConfig.fromProto(proto.websiteScrapeConfig);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessProfileConfig !== 'undefined' && this.businessProfileConfig !== null) {\n toReturn['businessProfileConfig'] = 'toApiJson' in this.businessProfileConfig ? this.businessProfileConfig.toApiJson() : this.businessProfileConfig;\n }\n if (typeof this.customDataConfig !== 'undefined' && this.customDataConfig !== null) {\n toReturn['customDataConfig'] = 'toApiJson' in this.customDataConfig ? this.customDataConfig.toApiJson() : this.customDataConfig;\n }\n if (typeof this.websiteScrapeConfig !== 'undefined' && this.websiteScrapeConfig !== null) {\n toReturn['websiteScrapeConfig'] = 'toApiJson' in this.websiteScrapeConfig ? this.websiteScrapeConfig.toApiJson() : this.websiteScrapeConfig;\n }\n return toReturn;\n }\n}\nclass KnowledgeSourceKey {\n static fromProto(proto) {\n let m = new KnowledgeSourceKey();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeSourceId !== 'undefined') {\n toReturn['knowledgeSourceId'] = this.knowledgeSourceId;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass Namespace {\n static fromProto(proto) {\n let m = new Namespace();\n m = Object.assign(m, proto);\n if (proto.accountGroupNamespace) {\n m.accountGroupNamespace = NamespaceAccountGroupNamespace.fromProto(proto.accountGroupNamespace);\n }\n if (proto.partnerNamespace) {\n m.partnerNamespace = NamespacePartnerNamespace.fromProto(proto.partnerNamespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupNamespace !== 'undefined' && this.accountGroupNamespace !== null) {\n toReturn['accountGroupNamespace'] = 'toApiJson' in this.accountGroupNamespace ? this.accountGroupNamespace.toApiJson() : this.accountGroupNamespace;\n }\n if (typeof this.partnerNamespace !== 'undefined' && this.partnerNamespace !== null) {\n toReturn['partnerNamespace'] = 'toApiJson' in this.partnerNamespace ? this.partnerNamespace.toApiJson() : this.partnerNamespace;\n }\n return toReturn;\n }\n}\nclass NamespacePartnerNamespace {\n static fromProto(proto) {\n let m = new NamespacePartnerNamespace();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n return toReturn;\n }\n}\nclass KnowledgeSourceConfigWebsiteScrapeConfigScrapedPage {\n static fromProto(proto) {\n let m = new KnowledgeSourceConfigWebsiteScrapeConfigScrapedPage();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.url !== 'undefined') {\n toReturn['url'] = this.url;\n }\n if (typeof this.title !== 'undefined') {\n toReturn['title'] = this.title;\n }\n if (typeof this.errorMessage !== 'undefined') {\n toReturn['errorMessage'] = this.errorMessage;\n }\n if (typeof this.trainingEnabled !== 'undefined') {\n toReturn['trainingEnabled'] = this.trainingEnabled;\n }\n return toReturn;\n }\n}\nclass KnowledgeSourceConfigWebsiteScrapeConfig {\n static fromProto(proto) {\n let m = new KnowledgeSourceConfigWebsiteScrapeConfig();\n m = Object.assign(m, proto);\n if (proto.crawlMode) {\n m.crawlMode = enumStringToValue$4(WebsiteScrapeConfigCrawlMode, proto.crawlMode);\n }\n if (proto.scrapedPages) {\n m.scrapedPages = proto.scrapedPages.map(KnowledgeSourceConfigWebsiteScrapeConfigScrapedPage.fromProto);\n }\n if (proto.scrapeProgress) {\n m.scrapeProgress = enumStringToValue$4(WebsiteScrapeConfigProgress, proto.scrapeProgress);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.url !== 'undefined') {\n toReturn['url'] = this.url;\n }\n if (typeof this.crawlMode !== 'undefined') {\n toReturn['crawlMode'] = this.crawlMode;\n }\n if (typeof this.scrapeInProgress !== 'undefined') {\n toReturn['scrapeInProgress'] = this.scrapeInProgress;\n }\n if (typeof this.scrapedPages !== 'undefined' && this.scrapedPages !== null) {\n toReturn['scrapedPages'] = 'toApiJson' in this.scrapedPages ? this.scrapedPages.toApiJson() : this.scrapedPages;\n }\n if (typeof this.scrapeProgress !== 'undefined') {\n toReturn['scrapeProgress'] = this.scrapeProgress;\n }\n if (typeof this.scrapeError !== 'undefined') {\n toReturn['scrapeError'] = this.scrapeError;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$3(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass FieldMask {\n static fromProto(proto) {\n let m = new FieldMask();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.paths !== 'undefined') {\n toReturn['paths'] = this.paths;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$2(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass PagedRequestOptions {\n static fromProto(proto) {\n let m = new PagedRequestOptions();\n m = Object.assign(m, proto);\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n return toReturn;\n }\n}\nclass PagedResponseMetadata {\n static fromProto(proto) {\n let m = new PagedResponseMetadata();\n m = Object.assign(m, proto);\n if (proto.totalResults) {\n m.totalResults = parseInt(proto.totalResults, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.nextCursor !== 'undefined') {\n toReturn['nextCursor'] = this.nextCursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n if (typeof this.totalResults !== 'undefined') {\n toReturn['totalResults'] = this.totalResults;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$1(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Access {\n static fromProto(proto) {\n let m = new Access();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.scope !== 'undefined') {\n toReturn['scope'] = this.scope;\n }\n if (typeof this.public !== 'undefined') {\n toReturn['public'] = this.public;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass CreateEmbeddingRequest {\n static fromProto(proto) {\n let m = new CreateEmbeddingRequest();\n m = Object.assign(m, proto);\n if (proto.metadata) {\n m.metadata = EmbeddingMetadata.fromProto(proto.metadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.content !== 'undefined') {\n toReturn['content'] = this.content;\n }\n if (typeof this.metadata !== 'undefined' && this.metadata !== null) {\n toReturn['metadata'] = 'toApiJson' in this.metadata ? this.metadata.toApiJson() : this.metadata;\n }\n return toReturn;\n }\n}\nclass CreateEmbeddingResponse {\n static fromProto(proto) {\n let m = new CreateEmbeddingResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n return toReturn;\n }\n}\nclass CreateKnowledgeBaseRequest {\n static fromProto(proto) {\n let m = new CreateKnowledgeBaseRequest();\n m = Object.assign(m, proto);\n if (proto.knowledgeBase) {\n m.knowledgeBase = KnowledgeBase.fromProto(proto.knowledgeBase);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeBase !== 'undefined' && this.knowledgeBase !== null) {\n toReturn['knowledgeBase'] = 'toApiJson' in this.knowledgeBase ? this.knowledgeBase.toApiJson() : this.knowledgeBase;\n }\n return toReturn;\n }\n}\nclass CreateKnowledgeBaseResponse {\n static fromProto(proto) {\n let m = new CreateKnowledgeBaseResponse();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass CreateKnowledgeSourceRequest {\n static fromProto(proto) {\n let m = new CreateKnowledgeSourceRequest();\n m = Object.assign(m, proto);\n if (proto.knowledgeSource) {\n m.knowledgeSource = KnowledgeSource.fromProto(proto.knowledgeSource);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeSource !== 'undefined' && this.knowledgeSource !== null) {\n toReturn['knowledgeSource'] = 'toApiJson' in this.knowledgeSource ? this.knowledgeSource.toApiJson() : this.knowledgeSource;\n }\n return toReturn;\n }\n}\nclass CreateKnowledgeSourceResponse {\n static fromProto(proto) {\n let m = new CreateKnowledgeSourceResponse();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass DeleteAppRequest {\n static fromProto(proto) {\n let m = new DeleteAppRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass DeleteEmbeddingRequest {\n static fromProto(proto) {\n let m = new DeleteEmbeddingRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.embeddingId !== 'undefined') {\n toReturn['embeddingId'] = this.embeddingId;\n }\n return toReturn;\n }\n}\nclass DeleteKnowledgeBaseRequest {\n static fromProto(proto) {\n let m = new DeleteKnowledgeBaseRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass DeleteKnowledgeSourceRequest {\n static fromProto(proto) {\n let m = new DeleteKnowledgeSourceRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass ListKnowledgeSourcesRequestFilters {\n static fromProto(proto) {\n let m = new ListKnowledgeSourcesRequestFilters();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n if (proto.configTypes) {\n m.configTypes = proto.configTypes.map(v => enumStringToValue(KnowledgeSourceConfigType, v));\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n if (typeof this.configTypes !== 'undefined') {\n toReturn['configTypes'] = this.configTypes;\n }\n return toReturn;\n }\n}\nclass ListKnowledgeBasesRequestFilters {\n static fromProto(proto) {\n let m = new ListKnowledgeBasesRequestFilters();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass ListEmbeddingsRequestFilters {\n static fromProto(proto) {\n let m = new ListEmbeddingsRequestFilters();\n m = Object.assign(m, proto);\n if (proto.relationship) {\n m.relationship = EmbeddingRelationship.fromProto(proto.relationship);\n }\n if (proto.sourceType) {\n m.sourceType = proto.sourceType.map(v => enumStringToValue(EmbeddingSourceType, v));\n }\n if (proto.vendorModel) {\n m.vendorModel = enumStringToValue(EmbeddingVendorModel, proto.vendorModel);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.relationship !== 'undefined' && this.relationship !== null) {\n toReturn['relationship'] = 'toApiJson' in this.relationship ? this.relationship.toApiJson() : this.relationship;\n }\n if (typeof this.sourceType !== 'undefined') {\n toReturn['sourceType'] = this.sourceType;\n }\n if (typeof this.vendorModel !== 'undefined') {\n toReturn['vendorModel'] = this.vendorModel;\n }\n if (typeof this.associatedAppId !== 'undefined') {\n toReturn['associatedAppId'] = this.associatedAppId;\n }\n return toReturn;\n }\n}\nclass ListAppsRequestFilters {\n static fromProto(proto) {\n let m = new ListAppsRequestFilters();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass ListAllKnowledgeSourcesForAppRequestFilters {\n static fromProto(proto) {\n let m = new ListAllKnowledgeSourcesForAppRequestFilters();\n m = Object.assign(m, proto);\n if (proto.configTypes) {\n m.configTypes = proto.configTypes.map(v => enumStringToValue(KnowledgeSourceConfigType, v));\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.configTypes !== 'undefined') {\n toReturn['configTypes'] = this.configTypes;\n }\n return toReturn;\n }\n}\nclass FindSimilarEmbeddingsRequestFilters {\n static fromProto(proto) {\n let m = new FindSimilarEmbeddingsRequestFilters();\n m = Object.assign(m, proto);\n if (proto.relationship) {\n m.relationship = EmbeddingRelationship.fromProto(proto.relationship);\n }\n if (proto.sourceType) {\n m.sourceType = proto.sourceType.map(v => enumStringToValue(EmbeddingSourceType, v));\n }\n if (proto.vendorModel) {\n m.vendorModel = enumStringToValue(EmbeddingVendorModel, proto.vendorModel);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.relationship !== 'undefined' && this.relationship !== null) {\n toReturn['relationship'] = 'toApiJson' in this.relationship ? this.relationship.toApiJson() : this.relationship;\n }\n if (typeof this.sourceType !== 'undefined') {\n toReturn['sourceType'] = this.sourceType;\n }\n if (typeof this.vendorModel !== 'undefined') {\n toReturn['vendorModel'] = this.vendorModel;\n }\n if (typeof this.associatedAppId !== 'undefined') {\n toReturn['associatedAppId'] = this.associatedAppId;\n }\n return toReturn;\n }\n}\nclass FindSimilarEmbeddingsRequest {\n static fromProto(proto) {\n let m = new FindSimilarEmbeddingsRequest();\n m = Object.assign(m, proto);\n if (proto.filters) {\n m.filters = FindSimilarEmbeddingsRequestFilters.fromProto(proto.filters);\n }\n if (proto.limit) {\n m.limit = parseInt(proto.limit, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n if (typeof this.query !== 'undefined') {\n toReturn['query'] = this.query;\n }\n if (typeof this.limit !== 'undefined') {\n toReturn['limit'] = this.limit;\n }\n return toReturn;\n }\n}\nclass FindSimilarEmbeddingsResponse {\n static fromProto(proto) {\n let m = new FindSimilarEmbeddingsResponse();\n m = Object.assign(m, proto);\n if (proto.embeddings) {\n m.embeddings = proto.embeddings.map(FindSimilarEmbeddingsResponseMatch.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.embeddings !== 'undefined' && this.embeddings !== null) {\n toReturn['embeddings'] = 'toApiJson' in this.embeddings ? this.embeddings.toApiJson() : this.embeddings;\n }\n return toReturn;\n }\n}\nclass GetAppRequest {\n static fromProto(proto) {\n let m = new GetAppRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n if (typeof this.includeKnowledgeBaseKeys !== 'undefined') {\n toReturn['includeKnowledgeBaseKeys'] = this.includeKnowledgeBaseKeys;\n }\n return toReturn;\n }\n}\nclass GetAppResponse {\n static fromProto(proto) {\n let m = new GetAppResponse();\n m = Object.assign(m, proto);\n if (proto.app) {\n m.app = App.fromProto(proto.app);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.app !== 'undefined' && this.app !== null) {\n toReturn['app'] = 'toApiJson' in this.app ? this.app.toApiJson() : this.app;\n }\n return toReturn;\n }\n}\nclass GetEmbeddingRequest {\n static fromProto(proto) {\n let m = new GetEmbeddingRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n return toReturn;\n }\n}\nclass GetEmbeddingResponse {\n static fromProto(proto) {\n let m = new GetEmbeddingResponse();\n m = Object.assign(m, proto);\n if (proto.embedding) {\n m.embedding = Embedding.fromProto(proto.embedding);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.embedding !== 'undefined' && this.embedding !== null) {\n toReturn['embedding'] = 'toApiJson' in this.embedding ? this.embedding.toApiJson() : this.embedding;\n }\n return toReturn;\n }\n}\nclass GetKnowledgeBaseRequest {\n static fromProto(proto) {\n let m = new GetKnowledgeBaseRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n if (typeof this.includeKnowledgeSourceKeys !== 'undefined') {\n toReturn['includeKnowledgeSourceKeys'] = this.includeKnowledgeSourceKeys;\n }\n return toReturn;\n }\n}\nclass GetKnowledgeBaseResponse {\n static fromProto(proto) {\n let m = new GetKnowledgeBaseResponse();\n m = Object.assign(m, proto);\n if (proto.knowledgeBase) {\n m.knowledgeBase = KnowledgeBase.fromProto(proto.knowledgeBase);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeBase !== 'undefined' && this.knowledgeBase !== null) {\n toReturn['knowledgeBase'] = 'toApiJson' in this.knowledgeBase ? this.knowledgeBase.toApiJson() : this.knowledgeBase;\n }\n return toReturn;\n }\n}\nclass GetKnowledgeSourceRequest {\n static fromProto(proto) {\n let m = new GetKnowledgeSourceRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n if (typeof this.includeKnowledgeBaseKeys !== 'undefined') {\n toReturn['includeKnowledgeBaseKeys'] = this.includeKnowledgeBaseKeys;\n }\n return toReturn;\n }\n}\nclass GetKnowledgeSourceResponse {\n static fromProto(proto) {\n let m = new GetKnowledgeSourceResponse();\n m = Object.assign(m, proto);\n if (proto.knowledgeSource) {\n m.knowledgeSource = KnowledgeSource.fromProto(proto.knowledgeSource);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeSource !== 'undefined' && this.knowledgeSource !== null) {\n toReturn['knowledgeSource'] = 'toApiJson' in this.knowledgeSource ? this.knowledgeSource.toApiJson() : this.knowledgeSource;\n }\n return toReturn;\n }\n}\nclass ListAllAppsForKnowledgeSourceRequest {\n static fromProto(proto) {\n let m = new ListAllAppsForKnowledgeSourceRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeSourceId !== 'undefined') {\n toReturn['knowledgeSourceId'] = this.knowledgeSourceId;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass ListAllAppsForKnowledgeSourceResponse {\n static fromProto(proto) {\n let m = new ListAllAppsForKnowledgeSourceResponse();\n m = Object.assign(m, proto);\n if (proto.apps) {\n m.apps = proto.apps.map(App.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.apps !== 'undefined' && this.apps !== null) {\n toReturn['apps'] = 'toApiJson' in this.apps ? this.apps.toApiJson() : this.apps;\n }\n return toReturn;\n }\n}\nclass ListAllKnowledgeSourcesForAppRequest {\n static fromProto(proto) {\n let m = new ListAllKnowledgeSourcesForAppRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n if (proto.filters) {\n m.filters = ListAllKnowledgeSourcesForAppRequestFilters.fromProto(proto.filters);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.appId !== 'undefined') {\n toReturn['appId'] = this.appId;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n return toReturn;\n }\n}\nclass ListAllKnowledgeSourcesForAppResponse {\n static fromProto(proto) {\n let m = new ListAllKnowledgeSourcesForAppResponse();\n m = Object.assign(m, proto);\n if (proto.knowledgeSources) {\n m.knowledgeSources = proto.knowledgeSources.map(KnowledgeSource.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeSources !== 'undefined' && this.knowledgeSources !== null) {\n toReturn['knowledgeSources'] = 'toApiJson' in this.knowledgeSources ? this.knowledgeSources.toApiJson() : this.knowledgeSources;\n }\n return toReturn;\n }\n}\nclass ListAppsRequest {\n static fromProto(proto) {\n let m = new ListAppsRequest();\n m = Object.assign(m, proto);\n if (proto.filters) {\n m.filters = ListAppsRequestFilters.fromProto(proto.filters);\n }\n if (proto.pagingOptions) {\n m.pagingOptions = PagedRequestOptions.fromProto(proto.pagingOptions);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n if (typeof this.pagingOptions !== 'undefined' && this.pagingOptions !== null) {\n toReturn['pagingOptions'] = 'toApiJson' in this.pagingOptions ? this.pagingOptions.toApiJson() : this.pagingOptions;\n }\n if (typeof this.includeKnowledgeBaseKeys !== 'undefined') {\n toReturn['includeKnowledgeBaseKeys'] = this.includeKnowledgeBaseKeys;\n }\n return toReturn;\n }\n}\nclass ListAppsResponse {\n static fromProto(proto) {\n let m = new ListAppsResponse();\n m = Object.assign(m, proto);\n if (proto.apps) {\n m.apps = proto.apps.map(App.fromProto);\n }\n if (proto.metadata) {\n m.metadata = PagedResponseMetadata.fromProto(proto.metadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.apps !== 'undefined' && this.apps !== null) {\n toReturn['apps'] = 'toApiJson' in this.apps ? this.apps.toApiJson() : this.apps;\n }\n if (typeof this.metadata !== 'undefined' && this.metadata !== null) {\n toReturn['metadata'] = 'toApiJson' in this.metadata ? this.metadata.toApiJson() : this.metadata;\n }\n return toReturn;\n }\n}\nclass ListEmbeddingsRequest {\n static fromProto(proto) {\n let m = new ListEmbeddingsRequest();\n m = Object.assign(m, proto);\n if (proto.filters) {\n m.filters = ListEmbeddingsRequestFilters.fromProto(proto.filters);\n }\n if (proto.pagingOptions) {\n m.pagingOptions = PagedRequestOptions.fromProto(proto.pagingOptions);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n if (typeof this.pagingOptions !== 'undefined' && this.pagingOptions !== null) {\n toReturn['pagingOptions'] = 'toApiJson' in this.pagingOptions ? this.pagingOptions.toApiJson() : this.pagingOptions;\n }\n return toReturn;\n }\n}\nclass ListEmbeddingsResponse {\n static fromProto(proto) {\n let m = new ListEmbeddingsResponse();\n m = Object.assign(m, proto);\n if (proto.embeddings) {\n m.embeddings = proto.embeddings.map(Embedding.fromProto);\n }\n if (proto.metadata) {\n m.metadata = PagedResponseMetadata.fromProto(proto.metadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.embeddings !== 'undefined' && this.embeddings !== null) {\n toReturn['embeddings'] = 'toApiJson' in this.embeddings ? this.embeddings.toApiJson() : this.embeddings;\n }\n if (typeof this.metadata !== 'undefined' && this.metadata !== null) {\n toReturn['metadata'] = 'toApiJson' in this.metadata ? this.metadata.toApiJson() : this.metadata;\n }\n return toReturn;\n }\n}\nclass ListKnowledgeBasesRequest {\n static fromProto(proto) {\n let m = new ListKnowledgeBasesRequest();\n m = Object.assign(m, proto);\n if (proto.filters) {\n m.filters = ListKnowledgeBasesRequestFilters.fromProto(proto.filters);\n }\n if (proto.pagingOptions) {\n m.pagingOptions = PagedRequestOptions.fromProto(proto.pagingOptions);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n if (typeof this.pagingOptions !== 'undefined' && this.pagingOptions !== null) {\n toReturn['pagingOptions'] = 'toApiJson' in this.pagingOptions ? this.pagingOptions.toApiJson() : this.pagingOptions;\n }\n if (typeof this.includeKnowledgeSourceKeys !== 'undefined') {\n toReturn['includeKnowledgeSourceKeys'] = this.includeKnowledgeSourceKeys;\n }\n return toReturn;\n }\n}\nclass ListKnowledgeBasesResponse {\n static fromProto(proto) {\n let m = new ListKnowledgeBasesResponse();\n m = Object.assign(m, proto);\n if (proto.knowledgeBases) {\n m.knowledgeBases = proto.knowledgeBases.map(KnowledgeBase.fromProto);\n }\n if (proto.metadata) {\n m.metadata = PagedResponseMetadata.fromProto(proto.metadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeBases !== 'undefined' && this.knowledgeBases !== null) {\n toReturn['knowledgeBases'] = 'toApiJson' in this.knowledgeBases ? this.knowledgeBases.toApiJson() : this.knowledgeBases;\n }\n if (typeof this.metadata !== 'undefined' && this.metadata !== null) {\n toReturn['metadata'] = 'toApiJson' in this.metadata ? this.metadata.toApiJson() : this.metadata;\n }\n return toReturn;\n }\n}\nclass ListKnowledgeSourcesRequest {\n static fromProto(proto) {\n let m = new ListKnowledgeSourcesRequest();\n m = Object.assign(m, proto);\n if (proto.filters) {\n m.filters = ListKnowledgeSourcesRequestFilters.fromProto(proto.filters);\n }\n if (proto.pagingOptions) {\n m.pagingOptions = PagedRequestOptions.fromProto(proto.pagingOptions);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n if (typeof this.pagingOptions !== 'undefined' && this.pagingOptions !== null) {\n toReturn['pagingOptions'] = 'toApiJson' in this.pagingOptions ? this.pagingOptions.toApiJson() : this.pagingOptions;\n }\n if (typeof this.includeKnowledgeBaseKeys !== 'undefined') {\n toReturn['includeKnowledgeBaseKeys'] = this.includeKnowledgeBaseKeys;\n }\n return toReturn;\n }\n}\nclass ListKnowledgeSourcesResponse {\n static fromProto(proto) {\n let m = new ListKnowledgeSourcesResponse();\n m = Object.assign(m, proto);\n if (proto.knowledgeSources) {\n m.knowledgeSources = proto.knowledgeSources.map(KnowledgeSource.fromProto);\n }\n if (proto.metadata) {\n m.metadata = PagedResponseMetadata.fromProto(proto.metadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeSources !== 'undefined' && this.knowledgeSources !== null) {\n toReturn['knowledgeSources'] = 'toApiJson' in this.knowledgeSources ? this.knowledgeSources.toApiJson() : this.knowledgeSources;\n }\n if (typeof this.metadata !== 'undefined' && this.metadata !== null) {\n toReturn['metadata'] = 'toApiJson' in this.metadata ? this.metadata.toApiJson() : this.metadata;\n }\n return toReturn;\n }\n}\nclass FindSimilarEmbeddingsResponseMatch {\n static fromProto(proto) {\n let m = new FindSimilarEmbeddingsResponseMatch();\n m = Object.assign(m, proto);\n if (proto.embedding) {\n m.embedding = Embedding.fromProto(proto.embedding);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.embedding !== 'undefined' && this.embedding !== null) {\n toReturn['embedding'] = 'toApiJson' in this.embedding ? this.embedding.toApiJson() : this.embedding;\n }\n if (typeof this.similarity !== 'undefined') {\n toReturn['similarity'] = this.similarity;\n }\n return toReturn;\n }\n}\nclass RefreshBusinessProfileEmbeddingsRequest {\n static fromProto(proto) {\n let m = new RefreshBusinessProfileEmbeddingsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass ScrapeWebsiteRequest {\n static fromProto(proto) {\n let m = new ScrapeWebsiteRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeSourceId !== 'undefined') {\n toReturn['knowledgeSourceId'] = this.knowledgeSourceId;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass ScrapeWebsiteResponse {\n static fromProto(proto) {\n let m = new ScrapeWebsiteResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n return toReturn;\n }\n}\nclass UpdateEmbeddingRequest {\n static fromProto(proto) {\n let m = new UpdateEmbeddingRequest();\n m = Object.assign(m, proto);\n if (proto.embedding) {\n m.embedding = Embedding.fromProto(proto.embedding);\n }\n if (proto.fieldMask) {\n m.fieldMask = FieldMask.fromProto(proto.fieldMask);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.embedding !== 'undefined' && this.embedding !== null) {\n toReturn['embedding'] = 'toApiJson' in this.embedding ? this.embedding.toApiJson() : this.embedding;\n }\n if (typeof this.fieldMask !== 'undefined' && this.fieldMask !== null) {\n toReturn['fieldMask'] = 'toApiJson' in this.fieldMask ? this.fieldMask.toApiJson() : this.fieldMask;\n }\n return toReturn;\n }\n}\nclass UpdateKnowledgeBaseRequest {\n static fromProto(proto) {\n let m = new UpdateKnowledgeBaseRequest();\n m = Object.assign(m, proto);\n if (proto.knowledgeBase) {\n m.knowledgeBase = KnowledgeBase.fromProto(proto.knowledgeBase);\n }\n if (proto.fieldMask) {\n m.fieldMask = FieldMask.fromProto(proto.fieldMask);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeBase !== 'undefined' && this.knowledgeBase !== null) {\n toReturn['knowledgeBase'] = 'toApiJson' in this.knowledgeBase ? this.knowledgeBase.toApiJson() : this.knowledgeBase;\n }\n if (typeof this.fieldMask !== 'undefined' && this.fieldMask !== null) {\n toReturn['fieldMask'] = 'toApiJson' in this.fieldMask ? this.fieldMask.toApiJson() : this.fieldMask;\n }\n return toReturn;\n }\n}\nclass UpdateKnowledgeSourceRequest {\n static fromProto(proto) {\n let m = new UpdateKnowledgeSourceRequest();\n m = Object.assign(m, proto);\n if (proto.knowledgeSource) {\n m.knowledgeSource = KnowledgeSource.fromProto(proto.knowledgeSource);\n }\n if (proto.fieldMask) {\n m.fieldMask = FieldMask.fromProto(proto.fieldMask);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeSource !== 'undefined' && this.knowledgeSource !== null) {\n toReturn['knowledgeSource'] = 'toApiJson' in this.knowledgeSource ? this.knowledgeSource.toApiJson() : this.knowledgeSource;\n }\n if (typeof this.fieldMask !== 'undefined' && this.fieldMask !== null) {\n toReturn['fieldMask'] = 'toApiJson' in this.fieldMask ? this.fieldMask.toApiJson() : this.fieldMask;\n }\n return toReturn;\n }\n}\nclass UpsertAppRequest {\n static fromProto(proto) {\n let m = new UpsertAppRequest();\n m = Object.assign(m, proto);\n if (proto.app) {\n m.app = App.fromProto(proto.app);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.app !== 'undefined' && this.app !== null) {\n toReturn['app'] = 'toApiJson' in this.app ? this.app.toApiJson() : this.app;\n }\n return toReturn;\n }\n}\nclass UpsertKnowledgeForAppRequest {\n static fromProto(proto) {\n let m = new UpsertKnowledgeForAppRequest();\n m = Object.assign(m, proto);\n if (proto.app) {\n m.app = App.fromProto(proto.app);\n }\n if (proto.configs) {\n m.configs = proto.configs.map(KnowledgeSourceConfig.fromProto);\n }\n if (proto.knowledgeSourceKeys) {\n m.knowledgeSourceKeys = proto.knowledgeSourceKeys.map(KnowledgeSourceKey.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.app !== 'undefined' && this.app !== null) {\n toReturn['app'] = 'toApiJson' in this.app ? this.app.toApiJson() : this.app;\n }\n if (typeof this.configs !== 'undefined' && this.configs !== null) {\n toReturn['configs'] = 'toApiJson' in this.configs ? this.configs.toApiJson() : this.configs;\n }\n if (typeof this.knowledgeSourceKeys !== 'undefined' && this.knowledgeSourceKeys !== null) {\n toReturn['knowledgeSourceKeys'] = 'toApiJson' in this.knowledgeSourceKeys ? this.knowledgeSourceKeys.toApiJson() : this.knowledgeSourceKeys;\n }\n return toReturn;\n }\n}\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Objects Index.\n// *********************************\n\nconst environment = (window ? window['environment'] : 'prod') ?? 'prod';\nconst hostMap = {\n 'local': 'embeddings-api.vendasta-local.com',\n 'test': '',\n 'demo': 'embeddings-demo.apigateway.co',\n 'prod': 'embeddings-prod.apigateway.co',\n 'production': 'embeddings-prod.apigateway.co'\n};\nlet HostService = /*#__PURE__*/(() => {\n class HostService {\n get host() {\n return hostMap[environment.toLowerCase()];\n }\n get hostWithScheme() {\n return 'https://' + this.host;\n }\n }\n HostService.ɵfac = function HostService_Factory(t) {\n return new (t || HostService)();\n };\n HostService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HostService,\n factory: HostService.ɵfac,\n providedIn: 'root'\n });\n return HostService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet EmbeddingApiService = /*#__PURE__*/(() => {\n class EmbeddingApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n createEmbedding(r) {\n const request = r.toApiJson ? r : new CreateEmbeddingRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.EmbeddingService/CreateEmbedding\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateEmbeddingResponse.fromProto(resp)));\n }\n getEmbedding(r) {\n const request = r.toApiJson ? r : new GetEmbeddingRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.EmbeddingService/GetEmbedding\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetEmbeddingResponse.fromProto(resp)));\n }\n updateEmbedding(r) {\n const request = r.toApiJson ? r : new UpdateEmbeddingRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.EmbeddingService/UpdateEmbedding\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n deleteEmbedding(r) {\n const request = r.toApiJson ? r : new DeleteEmbeddingRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.EmbeddingService/DeleteEmbedding\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n listEmbeddings(r) {\n const request = r.toApiJson ? r : new ListEmbeddingsRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.EmbeddingService/ListEmbeddings\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListEmbeddingsResponse.fromProto(resp)));\n }\n findSimilarEmbeddings(r) {\n const request = r.toApiJson ? r : new FindSimilarEmbeddingsRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.EmbeddingService/FindSimilarEmbeddings\", request.toApiJson(), this.apiOptions()).pipe(map(resp => FindSimilarEmbeddingsResponse.fromProto(resp)));\n }\n }\n EmbeddingApiService.ɵfac = function EmbeddingApiService_Factory(t) {\n return new (t || EmbeddingApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n EmbeddingApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: EmbeddingApiService,\n factory: EmbeddingApiService.ɵfac,\n providedIn: 'root'\n });\n return EmbeddingApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet EmbeddingService = /*#__PURE__*/(() => {\n class EmbeddingService {\n constructor(api) {\n this.api = api;\n }\n createEmbedding(req) {\n return this.api.createEmbedding(req).pipe(map(resp => resp.id));\n }\n getEmbedding(req) {\n return this.api.getEmbedding(req).pipe(map(resp => resp.embedding));\n }\n updateEmbedding(req) {\n return this.api.updateEmbedding(req).pipe(map(() => true));\n }\n listEmbeddings(req) {\n return this.api.listEmbeddings(req);\n }\n deleteEmbedding(req) {\n return this.api.deleteEmbedding(req).pipe(map(() => true));\n }\n }\n EmbeddingService.ɵfac = function EmbeddingService_Factory(t) {\n return new (t || EmbeddingService)(i0.ɵɵinject(EmbeddingApiService));\n };\n EmbeddingService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: EmbeddingService,\n factory: EmbeddingService.ɵfac,\n providedIn: 'root'\n });\n return EmbeddingService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet AutomatedEmbeddingsApiService = /*#__PURE__*/(() => {\n class AutomatedEmbeddingsApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n scrapeWebsite(r) {\n const request = r.toApiJson ? r : new ScrapeWebsiteRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.AutomatedEmbeddingsService/ScrapeWebsite\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ScrapeWebsiteResponse.fromProto(resp)));\n }\n refreshBusinessProfileEmbeddings(r) {\n const request = r.toApiJson ? r : new RefreshBusinessProfileEmbeddingsRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.AutomatedEmbeddingsService/RefreshBusinessProfileEmbeddings\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n refreshAllBusinessProfileEmbeddings() {\n return this.http.post(this._host + \"/embeddings.v1alpha1.AutomatedEmbeddingsService/RefreshAllBusinessProfileEmbeddings\", {}, {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n AutomatedEmbeddingsApiService.ɵfac = function AutomatedEmbeddingsApiService_Factory(t) {\n return new (t || AutomatedEmbeddingsApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n AutomatedEmbeddingsApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: AutomatedEmbeddingsApiService,\n factory: AutomatedEmbeddingsApiService.ɵfac,\n providedIn: 'root'\n });\n return AutomatedEmbeddingsApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet KnowledgeBaseApiService = /*#__PURE__*/(() => {\n class KnowledgeBaseApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n createKnowledgeBase(r) {\n const request = r.toApiJson ? r : new CreateKnowledgeBaseRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/CreateKnowledgeBase\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateKnowledgeBaseResponse.fromProto(resp)));\n }\n getKnowledgeBase(r) {\n const request = r.toApiJson ? r : new GetKnowledgeBaseRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/GetKnowledgeBase\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetKnowledgeBaseResponse.fromProto(resp)));\n }\n updateKnowledgeBase(r) {\n const request = r.toApiJson ? r : new UpdateKnowledgeBaseRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/UpdateKnowledgeBase\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n deleteKnowledgeBase(r) {\n const request = r.toApiJson ? r : new DeleteKnowledgeBaseRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/DeleteKnowledgeBase\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n listKnowledgeBases(r) {\n const request = r.toApiJson ? r : new ListKnowledgeBasesRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/ListKnowledgeBases\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListKnowledgeBasesResponse.fromProto(resp)));\n }\n createKnowledgeSource(r) {\n const request = r.toApiJson ? r : new CreateKnowledgeSourceRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/CreateKnowledgeSource\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateKnowledgeSourceResponse.fromProto(resp)));\n }\n getKnowledgeSource(r) {\n const request = r.toApiJson ? r : new GetKnowledgeSourceRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/GetKnowledgeSource\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetKnowledgeSourceResponse.fromProto(resp)));\n }\n updateKnowledgeSource(r) {\n const request = r.toApiJson ? r : new UpdateKnowledgeSourceRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/UpdateKnowledgeSource\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n deleteKnowledgeSource(r) {\n const request = r.toApiJson ? r : new DeleteKnowledgeSourceRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/DeleteKnowledgeSource\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n listKnowledgeSources(r) {\n const request = r.toApiJson ? r : new ListKnowledgeSourcesRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/ListKnowledgeSources\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListKnowledgeSourcesResponse.fromProto(resp)));\n }\n upsertApp(r) {\n const request = r.toApiJson ? r : new UpsertAppRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/UpsertApp\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n getApp(r) {\n const request = r.toApiJson ? r : new GetAppRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/GetApp\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetAppResponse.fromProto(resp)));\n }\n deleteApp(r) {\n const request = r.toApiJson ? r : new DeleteAppRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/DeleteApp\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n listApps(r) {\n const request = r.toApiJson ? r : new ListAppsRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/ListApps\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListAppsResponse.fromProto(resp)));\n }\n listAllKnowledgeSourcesForApp(r) {\n const request = r.toApiJson ? r : new ListAllKnowledgeSourcesForAppRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/ListAllKnowledgeSourcesForApp\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListAllKnowledgeSourcesForAppResponse.fromProto(resp)));\n }\n listAllAppsForKnowledgeSource(r) {\n const request = r.toApiJson ? r : new ListAllAppsForKnowledgeSourceRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/ListAllAppsForKnowledgeSource\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListAllAppsForKnowledgeSourceResponse.fromProto(resp)));\n }\n upsertKnowledgeForApp(r) {\n const request = r.toApiJson ? r : new UpsertKnowledgeForAppRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/UpsertKnowledgeForApp\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n KnowledgeBaseApiService.ɵfac = function KnowledgeBaseApiService_Factory(t) {\n return new (t || KnowledgeBaseApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n KnowledgeBaseApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: KnowledgeBaseApiService,\n factory: KnowledgeBaseApiService.ɵfac,\n providedIn: 'root'\n });\n return KnowledgeBaseApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Index.\n// *********************************\nlet KnowledgeBaseService = /*#__PURE__*/(() => {\n class KnowledgeBaseService {\n constructor(api, automatedServiceApi) {\n this.api = api;\n this.automatedServiceApi = automatedServiceApi;\n }\n getApp(req) {\n return this.api.getApp(req).pipe(map(resp => resp.app));\n }\n updateKnowledgeBase(req) {\n return this.api.updateKnowledgeBase(req).pipe(map(() => true));\n }\n getKnowledgeSource(req) {\n return this.api.getKnowledgeSource(req).pipe(map(resp => resp.knowledgeSource));\n }\n createKnowledgeSource(req) {\n return this.api.createKnowledgeSource(req).pipe(map(resp => resp));\n }\n updateKnowledgeSource(req) {\n return this.api.updateKnowledgeSource(req).pipe(map(() => true));\n }\n deleteKnowledgeSource(req) {\n return this.api.deleteKnowledgeSource(req).pipe(map(() => true));\n }\n listKnowledgeSources(req) {\n return this.api.listKnowledgeSources(req).pipe(map(resp => resp));\n }\n listAllKnowledgeSourcesForApp(req) {\n return this.api.listAllKnowledgeSourcesForApp(req);\n }\n listAllAppsForKnowledgeSource(req) {\n return this.api.listAllAppsForKnowledgeSource(req);\n }\n upsertKnowledgeForApp(req) {\n return this.api.upsertKnowledgeForApp(req).pipe(map(() => true));\n }\n scrapeWebsite(req) {\n return this.automatedServiceApi.scrapeWebsite(req);\n }\n }\n KnowledgeBaseService.ɵfac = function KnowledgeBaseService_Factory(t) {\n return new (t || KnowledgeBaseService)(i0.ɵɵinject(KnowledgeBaseApiService), i0.ɵɵinject(AutomatedEmbeddingsApiService));\n };\n KnowledgeBaseService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: KnowledgeBaseService,\n factory: KnowledgeBaseService.ɵfac,\n providedIn: 'root'\n });\n return KnowledgeBaseService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { Access, App, CreateEmbeddingRequest, CreateEmbeddingResponse, CreateKnowledgeBaseRequest, CreateKnowledgeBaseResponse, CreateKnowledgeSourceRequest, CreateKnowledgeSourceResponse, DeleteAppRequest, DeleteEmbeddingRequest, DeleteKnowledgeBaseRequest, DeleteKnowledgeSourceRequest, Embedding, EmbeddingCitation, EmbeddingMetadata, EmbeddingRelationship, EmbeddingRelationshipAccountGroup, EmbeddingRelationshipPartner, EmbeddingService, EmbeddingSourceType, EmbeddingVendorModel, FieldMask, FindSimilarEmbeddingsRequest, FindSimilarEmbeddingsRequestFilters, FindSimilarEmbeddingsResponse, FindSimilarEmbeddingsResponseMatch, GetAppRequest, GetAppResponse, GetEmbeddingRequest, GetEmbeddingResponse, GetKnowledgeBaseRequest, GetKnowledgeBaseResponse, GetKnowledgeSourceRequest, GetKnowledgeSourceResponse, KnowledgeBase, KnowledgeBaseKey, KnowledgeBaseService, KnowledgeSource, KnowledgeSourceConfig, KnowledgeSourceConfigBusinessProfileConfig, KnowledgeSourceConfigCustomDataConfig, KnowledgeSourceConfigType, KnowledgeSourceConfigWebsiteScrapeConfig, KnowledgeSourceConfigWebsiteScrapeConfigScrapedPage, KnowledgeSourceKey, ListAllAppsForKnowledgeSourceRequest, ListAllAppsForKnowledgeSourceResponse, ListAllKnowledgeSourcesForAppRequest, ListAllKnowledgeSourcesForAppRequestFilters, ListAllKnowledgeSourcesForAppResponse, ListAppsRequest, ListAppsRequestFilters, ListAppsResponse, ListEmbeddingsRequest, ListEmbeddingsRequestFilters, ListEmbeddingsResponse, ListKnowledgeBasesRequest, ListKnowledgeBasesRequestFilters, ListKnowledgeBasesResponse, ListKnowledgeSourcesRequest, ListKnowledgeSourcesRequestFilters, ListKnowledgeSourcesResponse, Namespace, NamespaceAccountGroupNamespace, NamespacePartnerNamespace, PagedRequestOptions, PagedResponseMetadata, RefreshAccountGroupWebsiteEmbeddingsProgress, RefreshBusinessProfileEmbeddingsRequest, ScrapeWebsiteRequest, ScrapeWebsiteResponse, UpdateEmbeddingRequest, UpdateKnowledgeBaseRequest, UpdateKnowledgeSourceRequest, UpsertAppRequest, UpsertKnowledgeForAppRequest, WebsiteScrapeConfigCrawlMode, WebsiteScrapeConfigProgress };\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { AiKnowledgeConfig, RouteCommand } from './interface/config.interface';\n\nexport const AI_KNOWLEDGE_CONFIG_TOKEN = new InjectionToken(\n '[AiKnowledge]: token for configuration',\n);\n\nexport const ACCOUNT_GROUP_ID_TOKEN: InjectionToken> = new InjectionToken(\n '[AiKnowledge]: token for accountGroupId',\n);\n\nexport const MARKET_ID_TOKEN: InjectionToken> = new InjectionToken(\n '[AiKnowledge]: token for marketId',\n);\n\nexport const PARTNER_ID_TOKEN: InjectionToken> = new InjectionToken(\n '[AiKnowledge]: token for partnerId',\n);\n\nexport const MANAGE_KNOWLEDGE_URL_TOKEN: InjectionToken> = new InjectionToken(\n '[AiKnowledge]: token for manageKnowledgeUrl',\n);\n\nexport const BUSINESS_PROFILE_URL_TOKEN: InjectionToken> = new InjectionToken(\n '[AiKnowledge]: token for businessProfileUrl',\n);\n\nexport const SHOW_BUSINESS_PROFILE_SOURCE_TOKEN: InjectionToken> = new InjectionToken(\n '[AiKnowledge]: token for showBusinessProfileSource',\n);\n\nexport const INBOX_SETTINGS_ROUTE_TOKEN: InjectionToken> = new InjectionToken(\n '[AiKnowledge]: token for inboxSettingsRoute',\n);\n","import { inject, Injectable } from '@angular/core';\nimport {\n App,\n CreateKnowledgeSourceRequestInterface,\n DeleteKnowledgeSourceRequestInterface,\n KnowledgeBaseService,\n KnowledgeSource,\n KnowledgeSourceConfigInterface,\n KnowledgeSourceConfigType,\n ListAllAppsForKnowledgeSourceRequestInterface,\n ListAllKnowledgeSourcesForAppRequestInterface,\n ListKnowledgeSourcesRequestInterface,\n ListKnowledgeSourcesResponse,\n NamespaceInterface,\n PagedRequestOptionsInterface,\n UpdateKnowledgeSourceRequestInterface,\n UpsertKnowledgeForAppRequestInterface,\n} from '@vendasta/embeddings';\nimport { catchError, firstValueFrom, throwError } from 'rxjs';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport {\n ACCOUNT_GROUP_ID_TOKEN,\n BUSINESS_PROFILE_URL_TOKEN,\n INBOX_SETTINGS_ROUTE_TOKEN,\n MANAGE_KNOWLEDGE_URL_TOKEN,\n MARKET_ID_TOKEN,\n PARTNER_ID_TOKEN,\n} from './tokens';\nimport { TranslateService } from '@ngx-translate/core';\nimport { RouteCommand } from './interface/config.interface';\n\n@Injectable()\nexport class AiKnowledgeService {\n private readonly knowledgeBaseService = inject(KnowledgeBaseService);\n private readonly translateService = inject(TranslateService);\n\n private readonly partnerId = toSignal(inject(PARTNER_ID_TOKEN));\n private readonly marketId = toSignal(inject(MARKET_ID_TOKEN));\n private readonly accountGroupId = toSignal(inject(ACCOUNT_GROUP_ID_TOKEN));\n private readonly manageKnowledgeUrl = toSignal(inject(MANAGE_KNOWLEDGE_URL_TOKEN));\n private readonly businessProfileUrl = toSignal(inject(BUSINESS_PROFILE_URL_TOKEN));\n private readonly inboxSettingsRoute = toSignal(inject(INBOX_SETTINGS_ROUTE_TOKEN));\n\n async getKnowledgeSource(\n id: string,\n namespace: NamespaceInterface,\n includeKnowledgeBaseKeys?: boolean,\n ): Promise {\n return await firstValueFrom(\n this.knowledgeBaseService.getKnowledgeSource({\n id: id,\n namespace: namespace,\n includeKnowledgeBaseKeys: includeKnowledgeBaseKeys,\n }),\n );\n }\n\n // TODO paging\n async listKnowledgeSources(\n configTypes?: KnowledgeSourceConfigType[],\n pagingOptions?: PagedRequestOptionsInterface,\n ): Promise {\n const request: ListKnowledgeSourcesRequestInterface = {\n filters: {\n namespace: this.buildNamespaceInterface(),\n configTypes: configTypes,\n },\n pagingOptions: pagingOptions,\n };\n return await firstValueFrom(this.knowledgeBaseService.listKnowledgeSources(request));\n }\n\n async updateKnowledgeSourceNameAndConfig(source: KnowledgeSource): Promise {\n const request: UpdateKnowledgeSourceRequestInterface = {\n knowledgeSource: source,\n fieldMask: {\n paths: ['name', 'config'],\n },\n };\n await firstValueFrom(this.knowledgeBaseService.updateKnowledgeSource(request));\n }\n\n async createKnowledgeSource(name: string, config: KnowledgeSourceConfigInterface): Promise {\n const request: CreateKnowledgeSourceRequestInterface = {\n knowledgeSource: {\n namespace: this.buildNamespaceInterface(),\n name: name,\n config: config,\n },\n };\n const result = await firstValueFrom(this.knowledgeBaseService.createKnowledgeSource(request));\n return result.id;\n }\n\n async deleteKnowledgeSource(id: string): Promise {\n const request: DeleteKnowledgeSourceRequestInterface = {\n id: id,\n namespace: this.buildNamespaceInterface(),\n };\n await firstValueFrom(this.knowledgeBaseService.deleteKnowledgeSource(request));\n }\n\n async listAllAppsForKnowledgeSource(knowledgeSourceId: string): Promise {\n const request: ListAllAppsForKnowledgeSourceRequestInterface = {\n knowledgeSourceId: knowledgeSourceId,\n namespace: this.buildNamespaceInterface(),\n };\n const results = await firstValueFrom(this.knowledgeBaseService.listAllAppsForKnowledgeSource(request));\n return results.apps || [];\n }\n\n async listAllKnowledgeSourcesForApp(\n appId: string,\n configTypes?: KnowledgeSourceConfigType[],\n ): Promise {\n const request: ListAllKnowledgeSourcesForAppRequestInterface = {\n appId: appId,\n namespace: this.buildNamespaceInterface(),\n filters: {\n configTypes: configTypes,\n },\n };\n const results = await firstValueFrom(this.knowledgeBaseService.listAllKnowledgeSourcesForApp(request));\n return results.knowledgeSources || [];\n }\n\n async upsertKnowledgeForApp(\n appId: string,\n name: string,\n configurationUrl: string,\n knowledgeSources?: KnowledgeSource[],\n ): Promise {\n const configs = [];\n const knowledgeSourceKeys = [];\n\n for (const source of knowledgeSources) {\n knowledgeSourceKeys.push({\n knowledgeSourceId: source.id,\n namespace: source.namespace,\n });\n }\n\n const request: UpsertKnowledgeForAppRequestInterface = {\n app: {\n id: appId,\n namespace: this.buildNamespaceInterface(),\n name: name,\n configurationUrl: configurationUrl,\n },\n configs: configs,\n knowledgeSourceKeys: knowledgeSourceKeys,\n };\n await firstValueFrom(\n this.knowledgeBaseService.upsertKnowledgeForApp(request).pipe(catchError((err) => throwError(() => err))),\n );\n }\n\n buildNamespaceInterface(): NamespaceInterface {\n if (this.accountGroupId()) {\n return {\n accountGroupNamespace: {\n accountGroupId: this.accountGroupId(),\n marketId: this.marketId(),\n partnerId: this.partnerId(),\n },\n };\n }\n return {\n partnerNamespace: {\n partnerId: this.partnerId(),\n },\n };\n }\n\n buildManageKnowledgeUrl(): string {\n return this.manageKnowledgeUrl();\n }\n\n buildEditKnowledgeUrl(sourceId: string): string {\n return this.buildManageKnowledgeUrl() + `?editSource=${sourceId}`;\n }\n\n buildAddKnowledgeUrl(): string {\n return this.buildManageKnowledgeUrl() + `?addSource=true`;\n }\n\n buildBusinessProfileUrl(): string {\n return this.businessProfileUrl();\n }\n\n buildInboxSettingsRoute(): RouteCommand[] {\n return this.inboxSettingsRoute();\n }\n\n buildBusinessProfileKnowledgeSourceId(): string {\n if (this.accountGroupId()) {\n return `KS-business-profile-${this.accountGroupId()}`;\n }\n return '';\n }\n\n buildBusinessProfileKnowledgeSource(): KnowledgeSource | null {\n if (this.accountGroupId()) {\n return {\n id: this.buildBusinessProfileKnowledgeSourceId(),\n namespace: this.buildNamespaceInterface(),\n name: 'Business Profile', // untranslated because that is how the name is in the backend\n config: {\n businessProfileConfig: {\n accountGroupId: this.accountGroupId(),\n },\n },\n } as KnowledgeSource;\n }\n return null;\n }\n\n getKnowledgePreview(source: KnowledgeSource): string {\n if (source?.config?.businessProfileConfig?.accountGroupId) {\n return this.translateService.instant('INBOX.WEBCHAT.SETTINGS.BUSINESS_PROFILE.DESCRIPTION');\n }\n if (source?.config?.customDataConfig) {\n return source?.config?.customDataConfig?.text;\n }\n if (source?.config?.websiteScrapeConfig) {\n return source?.config?.websiteScrapeConfig?.url;\n }\n\n return '';\n }\n}\n","{\n \"COMMON\": {\n \"SAVE\": \"Save\",\n \"SAVE_AND_CONTINUE\": \"Save and continue\",\n \"NEXT\": \"Next\",\n \"BACK\": \"Back\",\n \"EDIT\": \"Edit\",\n \"CANCEL\": \"Cancel\",\n \"CLOSE\": \"Close\",\n \"DELETE\": \"Delete\",\n \"INVALID_FORM\": \"Form is invalid\",\n \"ERROR_OCCURRED\": \"An error occurred\",\n \"YES\": \"Yes\",\n \"NO\": \"No\"\n },\n \"AI_KNOWLEDGE_BASE\": \"AI knowledge base\",\n \"MANAGE_KNOWLEDGE\": \"Manage knowledge\",\n \"MANAGE_KNOWLEDGE_DESCRIPTION\": \"Provide information AI can use when creating content or answering inqueries\",\n \"REFRESH_OPTIONS\": \"Refresh options\",\n \"CHOOSE_KNOWLEDGE_SOURCES\": \"Choose the knowledge sources that the AI assistant will reference when responding to inquiries\",\n \"KNOWLEDGE_SOURCES\": \"Knowledge sources\",\n \"ADD_KNOWLEDGE\": \"Add knowledge\",\n \"SELECT_KNOWLEDGE\": \"Select knowledge\",\n \"APPLICATION_SETTINGS\": \"Settings\",\n \"APPS_WARNING\": \"This knowledge is currently being used by the following:\",\n \"NO_APPS\": \"This knowledge is not currently being used.\",\n \"NO_MATCHING_KNOWLEDGE_SOURCES\": \"No knowledge available\",\n \"EDIT_KNOWLEDGE\": {\n \"TITLE\": \"Edit knowledge\",\n \"NAME\": \"Name\",\n \"CUSTOM_DATA_CONFIG\": {\n \"TITLE\": \"Custom data\",\n \"DESCRIPTION\": \"Text content related to your business such as FAQs or information snippets\",\n \"CONTENT\": \"Content\",\n \"CONTENT_HINT\": \"Enter any text content related to your business such as FAQs, so AI can accurately answer questions and create content about your business.\"\n },\n \"WEBSITE_SCRAPE_CONFIG\": {\n \"TITLE\": \"Website scrape\",\n \"DESCRIPTION\": \"Scrape content from a website\",\n \"URL\": \"URL\",\n \"INVALID_URL\": \"Please enter a valid URL\",\n \"CRAWL_MODE\": \"Mode\",\n \"SINGLE_PAGE\": \"Single page\",\n \"FOLLOW_LINKS\": \"Follow links\",\n \"FOLLOW_LINKS_HINT\": \"Will find up to {{pageLimit}} pages by following links from this domain starting on the provided URL\",\n \"PAGES\": \"Pages\",\n \"NUMBER_OF_PAGES_TRAINED\": \"Trained on {{trainedPagesCount}} of {{scrapedPagesCount}} scraped pages\",\n \"SELECT_PAGES_TO_TRAIN\": \"Choose which pages to train on\",\n \"SELECT_ALL\": \"Select all ({{scrapedPagesCount}} pages)\",\n \"SCRAPE_QUEUED\": \"Scrape is queued\",\n \"SCRAPE_IN_PROGRESS\": \"Scrape in progress\",\n \"SCRAPE_IN_PROGRESS_CLARIFICATION\": \"Pages to train on will appear here once scraping has completed\",\n \"PAGE_TITLE\": \"Page title\"\n },\n \"REQUIRED_FIELD\": \"Required\"\n },\n \"DELETE_KNOWLEDGE\": {\n \"TITLE\": \"Delete custom knowledge?\"\n },\n \"BUSINESS_PROFILE\": {\n \"BUSINESS_PROFILE\": \"Business Profile\",\n \"ALLOW_ACCESS\": \"Allow access to your business profile\",\n \"DESCRIPTION\": \"Answer questions about your business contact information, hours, products and services you offer.\",\n \"MANAGE_BUSINESS_PROFILE\": \"Manage business profile\",\n \"LEARN_MORE\": {\n \"TITLE\": \"Learn more\",\n \"WHAT_INFORMATION_QUESTION\": \"What information is made available to your AI assistant?\",\n \"WHAT_INFORMATION\": \"These fields are shared from your business profile:\",\n \"BUSINESS_NAME\": \"Business name\",\n \"ADDRESS_SERVICE_AREAS\": \"Address and/or service areas\",\n \"WEBSITE\": \"Website\",\n \"PHONE_NUMBER\": \"Phone number\",\n \"CATEGORIES\": \"Categories\",\n \"HOURS\": \"Hours\",\n \"SERVICES_OFFERED\": \"Services offered\",\n \"SHORT_DESCRIPTION\": \"Short description\",\n \"LONG_DESCRIPTION\": \"Long description\",\n \"SOCIAL_MEDIA_URLS\": \"Social media URLs\",\n \"BOOKING_URL\": \"Booking URL\"\n }\n },\n \"INBOX_SETTINGS\": {\n \"PROMPT\": \"Add knowledge to your Web Chat widget\",\n \"DESCRIPTION\": \"This knowledge and others can be added to your Web Chat widget via the Inbox settings page\",\n \"GO_TO\": \"Go to Inbox settings\"\n },\n \"UNSAVED_CHANGES\": {\n \"TITLE\": \"Any unsaved changes will be lost\",\n \"MESSAGE\": \"Do you wish to proceed?\"\n }\n}\n","import { NgModule } from '@angular/core';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { LexiconModule } from '@galaxy/lexicon';\nimport En from './en_devel.json';\n\n@NgModule({\n imports: [\n TranslateModule,\n LexiconModule.forChild({\n componentName: 'common/ai-knowledge',\n baseTranslation: En,\n }),\n ],\n})\nexport class AiKnowledgeI18nModule {}\n","import { CommonModule } from '@angular/common';\nimport { Component, inject, Input, OnInit, signal } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { App } from '@vendasta/embeddings';\nimport { AiKnowledgeService } from '../ai-knowledge.service';\nimport { RouteCommand } from '../interface/config.interface';\nimport { MatIconModule } from '@angular/material/icon';\nimport { RouterModule } from '@angular/router';\nimport { MatListModule } from '@angular/material/list';\nimport { GalaxyEmptyStateModule } from '@vendasta/galaxy/empty-state';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\nimport { AiKnowledgeI18nModule } from '../assets/i18n/ai-knowledge-i18n.module';\n\n@Component({\n selector: 'ai-knowledge-apps-for-knowledge-source',\n standalone: true,\n imports: [\n CommonModule,\n TranslateModule,\n AiKnowledgeI18nModule,\n MatButtonModule,\n MatIconModule,\n RouterModule,\n MatListModule,\n GalaxyLoadingSpinnerModule,\n GalaxyEmptyStateModule,\n ],\n templateUrl: './apps-for-knowledge-source.component.html',\n styleUrls: ['./apps-for-knowledge-source.component.scss'],\n})\nexport class AppsForKnowledgeSourceComponent implements OnInit {\n @Input() knowledgeSourceId: string;\n @Input() showInboxSettingsLink: boolean;\n\n readonly apps = signal([]);\n private readonly knowledgeService = inject(AiKnowledgeService);\n readonly isLoading = signal(true);\n\n async ngOnInit(): Promise {\n this.apps.set(await this.knowledgeService.listAllAppsForKnowledgeSource(this.knowledgeSourceId));\n this.isLoading.set(false);\n }\n\n inboxSettingsRoute(): RouteCommand[] {\n return this.knowledgeService.buildInboxSettingsRoute();\n }\n}\n","\n \n \n \n {{ 'NO_APPS' | translate }}\n \n \n {{ 'INBOX_SETTINGS.PROMPT' | translate }}\n open_in_new\n \n \n \n\n \n {{ 'APPS_WARNING' | translate }}\n \n \n {{ app.name }}\n {{ 'APPLICATION_SETTINGS' | translate }}\n \n \n \n\n\n\n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, inject, Inject } from '@angular/core';\nimport { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';\nimport { MatButtonModule } from '@angular/material/button';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { MatIconModule } from '@angular/material/icon';\nimport { RouterModule } from '@angular/router';\nimport { AiKnowledgeService } from '../ai-knowledge.service';\nimport { AppsForKnowledgeSourceComponent } from '../apps-for-knowledge-source/apps-for-knowledge-source.component';\nimport { AiKnowledgeI18nModule } from '../assets/i18n/ai-knowledge-i18n.module';\n\nexport interface Data {\n businessProfileUrl?: string;\n readOnly?: boolean;\n}\n\n@Component({\n selector: 'ai-knowledge-learn-more-business-profile',\n standalone: true,\n imports: [\n CommonModule,\n MatDialogModule,\n MatButtonModule,\n MatIconModule,\n RouterModule,\n TranslateModule,\n AiKnowledgeI18nModule,\n AppsForKnowledgeSourceComponent,\n ],\n providers: [AiKnowledgeService],\n templateUrl: './learn-more-business-profile.component.html',\n styleUrls: ['./learn-more-business-profile.component.scss'],\n})\nexport class LearnMoreBusinessProfileComponent {\n private readonly knowledgeService = inject(AiKnowledgeService);\n\n constructor(@Inject(MAT_DIALOG_DATA) public data: Data) {}\n\n businessProfileUrl(): string {\n return this.knowledgeService.buildBusinessProfileUrl();\n }\n\n knowledgeSourceId(): string {\n return this.knowledgeService.buildBusinessProfileKnowledgeSourceId();\n }\n}\n","

{{ 'BUSINESS_PROFILE.LEARN_MORE.TITLE' | translate }}

\n\n

\n {{ 'BUSINESS_PROFILE.LEARN_MORE.WHAT_INFORMATION_QUESTION' | translate }}\n

\n
\n {{ 'BUSINESS_PROFILE.LEARN_MORE.WHAT_INFORMATION' | translate }}\n
    \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.BUSINESS_NAME' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.ADDRESS_SERVICE_AREAS' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.WEBSITE' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.PHONE_NUMBER' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.CATEGORIES' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.HOURS' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.SERVICES_OFFERED' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.SHORT_DESCRIPTION' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.LONG_DESCRIPTION' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.SOCIAL_MEDIA_URLS' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.BOOKING_URL' | translate }}
  • \n
\n
\n\n
\n \n
\n
\n\n \n \n {{ 'BUSINESS_PROFILE.MANAGE_BUSINESS_PROFILE' | translate }}\n open_in_new\n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, EventEmitter, inject, Input, Output } from '@angular/core';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { KnowledgeSource } from '@vendasta/embeddings';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatListModule } from '@angular/material/list';\nimport { AiKnowledgeService } from '../ai-knowledge.service';\nimport { AiKnowledgeI18nModule } from '../assets/i18n/ai-knowledge-i18n.module';\n\n@Component({\n selector: 'ai-knowledge-knowledge-list',\n standalone: true,\n imports: [CommonModule, TranslateModule, AiKnowledgeI18nModule, MatIconModule, MatListModule],\n templateUrl: './knowledge-list.component.html',\n styleUrls: ['./knowledge-list.component.scss'],\n})\nexport class KnowledgeListComponent {\n @Input()\n get knowledgeSources(): KnowledgeSource[] {\n return this._knowledgeSources;\n }\n set knowledgeSources(sources: KnowledgeSource[]) {\n this._knowledgeSources = (sources || []).sort((a, b) => {\n if (a?.config?.businessProfileConfig?.accountGroupId) {\n return -1;\n }\n if (b?.config?.businessProfileConfig?.accountGroupId) {\n return 1;\n }\n return a?.name?.localeCompare(b?.name) || 0;\n });\n }\n _knowledgeSources: KnowledgeSource[];\n\n @Input() allowRemoveBusinessProfile: boolean;\n @Output() titleClicked = new EventEmitter();\n @Output() removeClicked = new EventEmitter();\n\n private readonly knowledgeService = inject(AiKnowledgeService);\n\n getKnowledgePreview(source: KnowledgeSource): string {\n return this.knowledgeService.getKnowledgePreview(source);\n }\n\n clickTitle(source: KnowledgeSource): void {\n this.titleClicked.emit(source);\n }\n\n clickRemove(source: KnowledgeSource): void {\n this.removeClicked.emit(source);\n }\n\n canRemoveSource(source: KnowledgeSource): boolean {\n if (source?.config?.businessProfileConfig?.accountGroupId) {\n return this.allowRemoveBusinessProfile;\n }\n return true;\n }\n}\n","\n \n \n {{ source.name }}\n {{ getKnowledgePreview(source) }}\n
\n
\n close\n
\n
\n
\n \n
\n
\n","import { ChangeDetectorRef, Directive, inject, Type } from '@angular/core';\nimport { KnowledgeSource } from '@vendasta/embeddings';\n\n@Directive()\nexport abstract class CommonKnowledgeSourceEditorComponent {\n knowledgeSource: KnowledgeSource;\n readOnly: boolean;\n disableSubmit = false;\n cdr = inject(ChangeDetectorRef);\n\n // init is run after the component is created and data is set\n init(): void {\n return;\n }\n\n // submit will be called when the submit action in the editor is clicked\n // should return the knowledge source id if it is created or update\n // a falsy return value will not close the dialog or move to the next step\n async submit(): Promise {\n return;\n }\n\n // if nextStep is provided, the submit action will be changed from Save to Next, and the given component will be rendered\n // Note: the submit function will still be called before rendering the next step\n nextStep(): Type {\n return;\n }\n\n // if previousStep is provided, a Back button will be included in the actions that will render the given component\n previousStep(): Type {\n return;\n }\n\n // getEditOption is used to build a query param that will link to this component's step, if it is not the first step\n getEditOption(): string {\n return;\n }\n\n // if true, a warning will be shown when cancelling or going to a previous step\n hasUnsavedChanges(): boolean {\n return false;\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { Component, inject } from '@angular/core';\nimport { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\nimport { KnowledgeSourceConfig, KnowledgeSourceConfigCustomDataConfig } from '@vendasta/embeddings';\nimport { AiKnowledgeService } from '../../ai-knowledge.service';\nimport { AppsForKnowledgeSourceComponent } from '../../apps-for-knowledge-source/apps-for-knowledge-source.component';\nimport { RouterModule } from '@angular/router';\nimport { MatIconModule } from '@angular/material/icon';\nimport { AiKnowledgeI18nModule } from '../../assets/i18n/ai-knowledge-i18n.module';\nimport { MatTabsModule } from '@angular/material/tabs';\nimport { MatSelectModule } from '@angular/material/select';\nimport { MatOptionModule } from '@angular/material/core';\nimport { MatExpansionModule } from '@angular/material/expansion';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { CommonKnowledgeSourceEditorComponent } from '../common/common-knowledge-source-editor.component';\nimport { GalaxySnackbarModule, SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { MatInputModule } from '@angular/material/input';\n\n@Component({\n selector: 'ai-knowledge-custom-data',\n standalone: true,\n imports: [\n CommonModule,\n TranslateModule,\n AiKnowledgeI18nModule,\n MatButtonModule,\n MatDialogModule,\n MatIconModule,\n MatTabsModule,\n MatSelectModule,\n MatOptionModule,\n MatExpansionModule,\n MatCheckboxModule,\n ReactiveFormsModule,\n FormsModule,\n GalaxyFormFieldModule,\n GalaxyLoadingSpinnerModule,\n RouterModule,\n AppsForKnowledgeSourceComponent,\n GalaxySnackbarModule,\n MatInputModule,\n ],\n providers: [AiKnowledgeService],\n templateUrl: './custom-data.component.html',\n styleUrls: ['./custom-data.component.scss'],\n})\nexport class CustomDataComponent extends CommonKnowledgeSourceEditorComponent {\n private readonly knowledgeService = inject(AiKnowledgeService);\n customDataConfig: KnowledgeSourceConfigCustomDataConfig;\n form: FormGroup | undefined;\n private readonly snackbarService = inject(SnackbarService);\n\n init(): void {\n this.customDataConfig = this.knowledgeSource?.config?.customDataConfig;\n this.form = new FormGroup({\n name: new FormControl(this.knowledgeSource?.name || '', [Validators.required]),\n content: new FormControl(this.customDataConfig?.text || '', [Validators.required]),\n });\n }\n\n async submit(): Promise {\n if (!this.isFormValid()) {\n this.snackbarService.openErrorSnack('COMMON.INVALID_FORM');\n return;\n }\n const name = this.form.get('name').value;\n const config = {\n customDataConfig: {\n text: this.form.get('content')?.value,\n },\n } as KnowledgeSourceConfig;\n if (this.knowledgeSource) {\n const source = this.knowledgeSource;\n source.name = name;\n source.config = config;\n await this.knowledgeService.updateKnowledgeSourceNameAndConfig(source);\n return source.id;\n } else {\n return await this.knowledgeService.createKnowledgeSource(name, config);\n }\n }\n\n private isFormValid(): boolean {\n const controls = [this.form.get('name'), this.form.get('content')];\n let valid = true;\n controls.forEach((c) => {\n c?.markAsDirty();\n if (!c?.valid) {\n valid = false;\n }\n });\n return valid;\n }\n\n hasUnsavedChanges(): boolean {\n return this.form.dirty;\n }\n}\n","\n {{ customDataConfig?.text }}\n\n\n\n \n \n {{ 'EDIT_KNOWLEDGE.NAME' | translate }}\n \n \n {{ 'EDIT_KNOWLEDGE.REQUIRED_FIELD' | translate }}\n \n \n \n {{ 'EDIT_KNOWLEDGE.CUSTOM_DATA_CONFIG.CONTENT' | translate }}\n {{\n 'EDIT_KNOWLEDGE.CUSTOM_DATA_CONFIG.CONTENT_HINT' | translate\n }}\n \n \n {{ 'EDIT_KNOWLEDGE.REQUIRED_FIELD' | translate }}\n \n \n \n\n","import { Component, DestroyRef, inject, signal, Type } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { FormArray, FormControl, FormGroup, FormsModule, ReactiveFormsModule, UntypedFormArray } from '@angular/forms';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { AppsForKnowledgeSourceComponent } from '../../../apps-for-knowledge-source/apps-for-knowledge-source.component';\nimport { AiKnowledgeService } from '../../../ai-knowledge.service';\nimport {\n KnowledgeSource,\n KnowledgeSourceConfig,\n KnowledgeSourceConfigWebsiteScrapeConfig,\n WebsiteScrapeConfigProgress,\n} from '@vendasta/embeddings';\nimport { CommonKnowledgeSourceEditorComponent } from '../../common/common-knowledge-source-editor.component';\nimport { GalaxyEmptyStateModule } from '@vendasta/galaxy/empty-state';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\nimport { defer, from, map, retry, take } from 'rxjs';\nimport { AiKnowledgeI18nModule } from '../../../assets/i18n/ai-knowledge-i18n.module';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { WebsiteScrapeComponent } from '../website-scrape.component';\n\nexport const EDIT_OPTION = 'scrapedPages';\n\n@Component({\n selector: 'ai-knowledge-scraped-pages',\n standalone: true,\n imports: [\n CommonModule,\n TranslateModule,\n AiKnowledgeI18nModule,\n MatCheckboxModule,\n ReactiveFormsModule,\n FormsModule,\n GalaxyFormFieldModule,\n GalaxyEmptyStateModule,\n GalaxyLoadingSpinnerModule,\n AppsForKnowledgeSourceComponent,\n ],\n providers: [AiKnowledgeService],\n templateUrl: './scraped-pages.component.html',\n styleUrls: ['./scraped-pages.component.scss'],\n})\nexport class ScrapedPagesComponent extends CommonKnowledgeSourceEditorComponent {\n private readonly knowledgeService = inject(AiKnowledgeService);\n private readonly snackbarService = inject(SnackbarService);\n private destroyRef = inject(DestroyRef);\n websiteScrapeConfig: KnowledgeSourceConfigWebsiteScrapeConfig;\n scrapeProgressStates = WebsiteScrapeConfigProgress;\n form: FormGroup | undefined;\n readonly isLoading = signal(false);\n disabled = true;\n\n init(): void {\n this.disableSubmit = true;\n this.websiteScrapeConfig = this.knowledgeSource?.config?.websiteScrapeConfig;\n this.form = new FormGroup({\n scrapedPages: new FormArray([]),\n });\n\n if (this.knowledgeSource) {\n this.isLoading.set(true);\n defer(() =>\n from(this.knowledgeService.getKnowledgeSource(this.knowledgeSource?.id, this.knowledgeSource?.namespace)),\n )\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n map((ks) => {\n this.updateKnowledgeSource(ks);\n this.isLoading.set(false);\n if (\n this.websiteScrapeConfig?.scrapeProgress !==\n WebsiteScrapeConfigProgress.WEBSITE_SCRAPE_CONFIG_PROGRESS_DONE\n ) {\n // throw error to poll again\n throw false;\n }\n this.disableSubmit = false;\n }),\n retry({ delay: 5000 }),\n take(1),\n )\n .subscribe();\n }\n }\n\n updateKnowledgeSource(ks: KnowledgeSource): void {\n this.knowledgeSource = ks;\n this.websiteScrapeConfig = this.knowledgeSource?.config?.websiteScrapeConfig;\n if (this.websiteScrapeConfig.scrapeProgress === WebsiteScrapeConfigProgress.WEBSITE_SCRAPE_CONFIG_PROGRESS_DONE) {\n this.websiteScrapeConfig.scrapedPages.sort((a, b) =>\n a?.trainingEnabled === b?.trainingEnabled ? a?.url?.localeCompare(b?.url) : a?.trainingEnabled ? -1 : 1,\n );\n this.form.controls.scrapedPages = new FormArray(\n this.websiteScrapeConfig.scrapedPages.map((page) => new FormControl(page.trainingEnabled)),\n );\n this.form.controls.scrapedPages.valueChanges\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n map(() => this.form.markAsDirty()),\n )\n .subscribe();\n }\n }\n\n get scrapedPagesArray(): UntypedFormArray {\n return this.form.controls['scrapedPages'] as UntypedFormArray;\n }\n\n selectAll(): void {\n this.form.controls.scrapedPages = new FormArray(\n this.websiteScrapeConfig.scrapedPages.map(() => new FormControl(true)),\n );\n }\n\n getScrapedPagesCount(): number {\n return this.websiteScrapeConfig?.scrapedPages?.length || 0;\n }\n\n async submit(): Promise {\n this.scrapedPagesArray.controls.forEach((pageControl, index) => {\n this.websiteScrapeConfig.scrapedPages[index].trainingEnabled = pageControl.value;\n });\n const config = {\n websiteScrapeConfig: this.websiteScrapeConfig,\n } as KnowledgeSourceConfig;\n if (this.knowledgeSource) {\n const source = this.knowledgeSource;\n source.config = config;\n await this.knowledgeService.updateKnowledgeSourceNameAndConfig(source);\n return source.id;\n }\n this.snackbarService.openErrorSnack('COMMON.ERROR_OCCURRED');\n return;\n }\n\n getScrapeProgressTitle(): string {\n if (\n this.websiteScrapeConfig?.scrapeProgress === WebsiteScrapeConfigProgress.WEBSITE_SCRAPE_CONFIG_PROGRESS_QUEUED\n ) {\n return 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.SCRAPE_QUEUED';\n }\n return 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.SCRAPE_IN_PROGRESS';\n }\n\n previousStep(): Type {\n return WebsiteScrapeComponent;\n }\n\n hasUnsavedChanges(): boolean {\n return this.form.dirty;\n }\n\n getEditOption(): string {\n return EDIT_OPTION;\n }\n}\n","\n \n \n \n \n \n {{ getScrapeProgressTitle() | translate }}\n \n

{{ 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.SCRAPE_IN_PROGRESS_CLARIFICATION' | translate }}

\n \n\n \n \n \n {{ 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.SELECT_PAGES_TO_TRAIN' | translate }}\n

1\">\n {{\n 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.SELECT_ALL' | translate: { scrapedPagesCount: getScrapedPagesCount() }\n }}\n

\n \n \n {{ websiteScrapeConfig?.scrapedPages[i]?.title }}\n {{ websiteScrapeConfig?.scrapedPages[i]?.url }}\n {{\n websiteScrapeConfig?.scrapedPages[i]?.errorMessage\n }}\n \n \n
\n
\n
\n
\n\n\n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, DestroyRef, inject, Type } from '@angular/core';\nimport { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';\nimport { urlValidator } from '@vendasta/forms';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport {\n KnowledgeSourceConfig,\n KnowledgeSourceConfigWebsiteScrapeConfig,\n WebsiteScrapeConfigCrawlMode,\n WebsiteScrapeConfigProgress,\n} from '@vendasta/embeddings';\nimport { AiKnowledgeService } from '../../ai-knowledge.service';\nimport { MatIconModule } from '@angular/material/icon';\nimport { AiKnowledgeI18nModule } from '../../assets/i18n/ai-knowledge-i18n.module';\nimport { MatSelectModule } from '@angular/material/select';\nimport { MatOptionModule } from '@angular/material/core';\nimport { ScrapedPagesComponent } from './scraped-pages/scraped-pages.component';\nimport { CommonKnowledgeSourceEditorComponent } from '../common/common-knowledge-source-editor.component';\nimport { GalaxySnackbarModule, SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { MatInputModule } from '@angular/material/input';\nimport { defer, from, map, retry, take } from 'rxjs';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Environment, EnvironmentService } from '@galaxy/core';\n\n@Component({\n selector: 'ai-knowledge-website-scrape',\n standalone: true,\n imports: [\n CommonModule,\n TranslateModule,\n AiKnowledgeI18nModule,\n MatIconModule,\n MatSelectModule,\n MatOptionModule,\n ReactiveFormsModule,\n FormsModule,\n GalaxyFormFieldModule,\n GalaxySnackbarModule,\n MatInputModule,\n ],\n providers: [AiKnowledgeService],\n templateUrl: './website-scrape.component.html',\n styleUrls: ['./website-scrape.component.scss'],\n})\nexport class WebsiteScrapeComponent extends CommonKnowledgeSourceEditorComponent {\n private readonly knowledgeService = inject(AiKnowledgeService);\n private readonly snackbarService = inject(SnackbarService);\n private destroyRef = inject(DestroyRef);\n private environmentService = inject(EnvironmentService);\n websiteScrapeConfig: KnowledgeSourceConfigWebsiteScrapeConfig;\n form: FormGroup | undefined;\n crawlModes = WebsiteScrapeConfigCrawlMode;\n scrapeProgressStates = WebsiteScrapeConfigProgress;\n\n init(): void {\n this.websiteScrapeConfig = this.knowledgeSource?.config?.websiteScrapeConfig;\n this.form = new FormGroup({\n name: new FormControl(this.knowledgeSource?.name || '', [Validators.required]),\n url: new FormControl(this.websiteScrapeConfig?.url || '', [urlValidator, Validators.required]),\n crawlMode: new FormControl(\n this.websiteScrapeConfig?.crawlMode || WebsiteScrapeConfigCrawlMode.WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_SINGLE,\n ),\n });\n if (this.knowledgeSource) {\n defer(() =>\n from(this.knowledgeService.getKnowledgeSource(this.knowledgeSource?.id, this.knowledgeSource?.namespace)),\n )\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n map((ks) => {\n this.websiteScrapeConfig = ks?.config?.websiteScrapeConfig;\n if (\n this.websiteScrapeConfig?.scrapeProgress !==\n WebsiteScrapeConfigProgress.WEBSITE_SCRAPE_CONFIG_PROGRESS_DONE\n ) {\n // throw error to poll again\n throw false;\n }\n }),\n retry({ delay: 5000 }),\n take(1),\n )\n .subscribe();\n }\n }\n\n getCrawlModeTranslationKey(crawlMode: WebsiteScrapeConfigCrawlMode): string {\n switch (crawlMode) {\n case WebsiteScrapeConfigCrawlMode.WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_SINGLE: {\n return 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.SINGLE_PAGE';\n }\n case WebsiteScrapeConfigCrawlMode.WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_RECURSIVE: {\n return 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.FOLLOW_LINKS';\n }\n default: {\n return '';\n }\n }\n }\n\n getScrapeProgressTitle(): string {\n if (\n this.websiteScrapeConfig?.scrapeProgress === WebsiteScrapeConfigProgress.WEBSITE_SCRAPE_CONFIG_PROGRESS_QUEUED\n ) {\n return 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.SCRAPE_QUEUED';\n }\n return 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.SCRAPE_IN_PROGRESS';\n }\n\n getScrapedPagesCount(): number {\n return this.websiteScrapeConfig?.scrapedPages?.length || 0;\n }\n\n getTrainedPagesCount(): number {\n return this.websiteScrapeConfig?.scrapedPages?.filter((p) => p.trainingEnabled)?.length || 0;\n }\n\n getPageLimit(): number {\n switch (this.environmentService.getEnvironment()) {\n case Environment.LOCAL:\n case Environment.DEMO:\n return 10;\n case Environment.PROD:\n return 100;\n default:\n return 0;\n }\n }\n\n isFormValid(): boolean {\n const controls = [this.form.get('name'), this.form.get('url')];\n let valid = true;\n controls.forEach((c) => {\n c?.markAsDirty();\n if (!c?.valid) {\n valid = false;\n }\n });\n return valid;\n }\n\n async submit(): Promise {\n if (!this.isFormValid()) {\n this.snackbarService.openErrorSnack('COMMON.INVALID_FORM');\n return;\n }\n const name = this.form.get('name').value;\n const url = this.form.get('url')?.value;\n const config = {\n websiteScrapeConfig: {\n url: url,\n crawlMode: this.form.get('crawlMode')?.value,\n scrapedPages: this.websiteScrapeConfig?.scrapedPages,\n },\n } as KnowledgeSourceConfig;\n if (this.knowledgeSource) {\n const source = this.knowledgeSource;\n source.name = name;\n source.config = config;\n await this.knowledgeService.updateKnowledgeSourceNameAndConfig(source);\n return source.id;\n } else {\n return await this.knowledgeService.createKnowledgeSource(name, config);\n }\n }\n\n nextStep(): Type {\n return ScrapedPagesComponent;\n }\n\n hasUnsavedChanges(): boolean {\n return this.form.dirty;\n }\n}\n","\n
\n \n
\n {{ getCrawlModeTranslationKey(websiteScrapeConfig?.crawlMode) | translate }}\n
\n
\n \n
\n\n \n \n {{ 'EDIT_KNOWLEDGE.NAME' | translate }}\n \n \n {{ 'EDIT_KNOWLEDGE.REQUIRED_FIELD' | translate }}\n \n \n \n {{ 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.URL' | translate }}\n \n \n {{ 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.INVALID_URL' | translate }}\n \n \n \n {{ 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.CRAWL_MODE' | translate }}\n \n \n {{ getCrawlModeTranslationKey(crawlModes.WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_SINGLE) | translate }}\n \n \n {{ getCrawlModeTranslationKey(crawlModes.WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_RECURSIVE) | translate }}\n \n \n \n {{ 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.FOLLOW_LINKS_HINT' | translate: { pageLimit: getPageLimit() } }}\n \n \n \n \n\n\n\n
\n \n {{\n 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.NUMBER_OF_PAGES_TRAINED'\n | translate: { trainedPagesCount: getTrainedPagesCount(), scrapedPagesCount: getScrapedPagesCount() }\n }}\n \n \n
{{ getScrapeProgressTitle() | translate }}
\n
\n
\n
\n","import { CommonModule } from '@angular/common';\nimport { Component, EventEmitter, Output } from '@angular/core';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { AiKnowledgeService } from '../../ai-knowledge.service';\nimport { AiKnowledgeI18nModule } from '../../assets/i18n/ai-knowledge-i18n.module';\nimport { MatCardModule } from '@angular/material/card';\nimport { CustomDataComponent } from '../custom-data/custom-data.component';\nimport { WebsiteScrapeComponent } from '../website-scrape/website-scrape.component';\nimport { CommonKnowledgeSourceEditorComponent } from '../common/common-knowledge-source-editor.component';\n\ninterface Choice {\n title: string;\n description: string;\n component: any;\n}\n\n@Component({\n selector: 'ai-knowledge-add-knowledge',\n standalone: true,\n imports: [CommonModule, TranslateModule, AiKnowledgeI18nModule, MatCardModule],\n providers: [AiKnowledgeService],\n templateUrl: './add-knowledge.component.html',\n styleUrls: ['./add-knowledge.component.scss'],\n})\nexport class AddKnowledgeComponent extends CommonKnowledgeSourceEditorComponent {\n @Output() componentSelected = new EventEmitter();\n\n choices: Choice[] = [\n {\n title: 'EDIT_KNOWLEDGE.CUSTOM_DATA_CONFIG.TITLE',\n description: 'EDIT_KNOWLEDGE.CUSTOM_DATA_CONFIG.DESCRIPTION',\n component: CustomDataComponent,\n },\n {\n title: 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.TITLE',\n description: 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.DESCRIPTION',\n component: WebsiteScrapeComponent,\n },\n ];\n\n selectComponent(choice: Choice): void {\n this.componentSelected.emit(choice.component);\n }\n}\n","
\n \n \n \n

{{ choice.title | translate }}

\n

\n {{ choice.description | translate }}\n

\n
\n
\n
\n
\n","import { CommonModule } from '@angular/common';\nimport {\n ChangeDetectorRef,\n Component,\n DestroyRef,\n inject,\n Inject,\n OnInit,\n signal,\n Type,\n ViewChild,\n ViewContainerRef,\n} from '@angular/core';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\nimport { KnowledgeSource, KnowledgeSourceKey } from '@vendasta/embeddings';\nimport { AiKnowledgeService } from '../ai-knowledge.service';\nimport { AppsForKnowledgeSourceComponent } from '../apps-for-knowledge-source/apps-for-knowledge-source.component';\nimport { ActivatedRoute, Router, RouterModule } from '@angular/router';\nimport { MatIconModule } from '@angular/material/icon';\nimport { AiKnowledgeI18nModule } from '../assets/i18n/ai-knowledge-i18n.module';\nimport { MatTabsModule } from '@angular/material/tabs';\nimport { MatSelectModule } from '@angular/material/select';\nimport { MatOptionModule } from '@angular/material/core';\nimport { MatExpansionModule } from '@angular/material/expansion';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { AddKnowledgeComponent } from './add-knowledge/add-knowledge.component';\nimport { WebsiteScrapeComponent } from './website-scrape/website-scrape.component';\nimport { CustomDataComponent } from './custom-data/custom-data.component';\nimport { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\nimport { firstValueFrom } from 'rxjs';\nimport { FeatureFlagService } from '@galaxy/partner';\nimport { PARTNER_ID_TOKEN } from '../tokens';\nimport { CommonKnowledgeSourceEditorComponent } from './common/common-knowledge-source-editor.component';\nimport { OpenConfirmationModalService } from '@vendasta/galaxy/confirmation-modal';\nimport {\n EDIT_OPTION as SCRAPED_PAGES_EDIT_OPTION,\n ScrapedPagesComponent,\n} from './website-scrape/scraped-pages/scraped-pages.component';\n\n// feature flag id\nexport const WEBSITE_KNOWLEDGE = 'website_knowledge';\n\ninterface Data {\n knowledgeSourceKey?: KnowledgeSourceKey;\n readOnly?: boolean;\n editOption?: string;\n}\n\n@Component({\n selector: 'ai-knowledge-knowledge-editor-dialog',\n standalone: true,\n imports: [\n CommonModule,\n TranslateModule,\n AiKnowledgeI18nModule,\n MatButtonModule,\n MatDialogModule,\n MatIconModule,\n MatTabsModule,\n MatSelectModule,\n MatOptionModule,\n MatExpansionModule,\n MatCheckboxModule,\n ReactiveFormsModule,\n FormsModule,\n GalaxyFormFieldModule,\n GalaxyLoadingSpinnerModule,\n RouterModule,\n AppsForKnowledgeSourceComponent,\n ],\n providers: [AiKnowledgeService],\n templateUrl: './knowledge-editor.component.html',\n styleUrls: ['./knowledge-editor.component.scss'],\n})\nexport class KnowledgeEditorComponent implements OnInit {\n @ViewChild('component', { read: ViewContainerRef }) componentViewRef?: ViewContainerRef;\n componentInstance: CommonKnowledgeSourceEditorComponent;\n private readonly knowledgeService = inject(AiKnowledgeService);\n private featureFlagService = inject(FeatureFlagService);\n private cdr = inject(ChangeDetectorRef);\n private confirmationModal = inject(OpenConfirmationModalService);\n private readonly activeRoute = inject(ActivatedRoute);\n router = inject(Router);\n private readonly partnerId = toSignal(inject(PARTNER_ID_TOKEN));\n readonly isLoading = signal(true);\n component: Type;\n knowledgeSource: KnowledgeSource;\n\n constructor(\n private readonly destroyRef: DestroyRef,\n public dialogRef: MatDialogRef,\n @Inject(MAT_DIALOG_DATA) public data: Data,\n ) {}\n\n async ngOnInit(): Promise {\n this.dialogRef.disableClose = true;\n if (this.data?.knowledgeSourceKey) {\n this.knowledgeSource = await this.knowledgeService.getKnowledgeSource(\n this.data.knowledgeSourceKey.knowledgeSourceId,\n this.data.knowledgeSourceKey.namespace,\n );\n }\n await this.setInitialComponent();\n this.isLoading.set(false);\n }\n\n setEditSourceQueryParam(editSource: string | null, option?: string): void {\n if (option) {\n editSource = editSource + ':' + option;\n }\n const queryParams = { editSource: editSource };\n this.router.navigate([], {\n relativeTo: this.activeRoute,\n queryParams,\n queryParamsHandling: 'merge',\n });\n }\n\n async websiteKnowledgeFeatureEnabled(): Promise {\n const results = await firstValueFrom(\n this.featureFlagService.batchGetStatus(this.partnerId(), '', [WEBSITE_KNOWLEDGE]),\n );\n return results[WEBSITE_KNOWLEDGE];\n }\n\n close(): void {\n this.warnUnsavedChanged(() => {\n this.setEditSourceQueryParam(null);\n this.dialogRef.close();\n });\n }\n\n async setInitialComponent(): Promise {\n if (this.knowledgeSource) {\n if (this.knowledgeSource.config?.customDataConfig) {\n this.setComponent(CustomDataComponent);\n } else if (this.knowledgeSource.config?.websiteScrapeConfig) {\n if (this.data?.editOption === SCRAPED_PAGES_EDIT_OPTION) {\n this.setComponent(ScrapedPagesComponent);\n } else {\n this.setComponent(WebsiteScrapeComponent);\n }\n }\n } else if (await this.websiteKnowledgeFeatureEnabled()) {\n this.setComponent(AddKnowledgeComponent);\n } else {\n this.setComponent(CustomDataComponent);\n }\n }\n\n setComponent(c: Type): void {\n this.component = c;\n this.componentViewRef.detach();\n this.componentInstance = this.componentViewRef.createComponent(c).instance;\n this.componentInstance.knowledgeSource = this.knowledgeSource;\n this.componentInstance.readOnly = this.data?.readOnly;\n this.componentInstance.init();\n this.componentInstance.cdr.detectChanges();\n this.setEditSourceQueryParam(\n this.data?.knowledgeSourceKey?.knowledgeSourceId,\n this.componentInstance.getEditOption(),\n );\n if (c === AddKnowledgeComponent) {\n (this.componentInstance as AddKnowledgeComponent).componentSelected\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe((c) => this.setComponent(c));\n }\n }\n\n async submit(): Promise {\n if (this.componentInstance) {\n let result = this.knowledgeSource?.id;\n if (this.componentInstance.hasUnsavedChanges()) {\n result = await this.componentInstance.submit();\n }\n if (result) {\n const nextStep = this.componentInstance.nextStep();\n if (nextStep) {\n this.knowledgeSource = await this.knowledgeService.getKnowledgeSource(\n result,\n this.knowledgeService.buildNamespaceInterface(),\n );\n this.setComponent(nextStep);\n this.cdr.detectChanges();\n return;\n }\n this.setEditSourceQueryParam(null);\n this.dialogRef.close(true);\n }\n }\n }\n\n showBack(): boolean {\n return !!this.componentInstance?.previousStep();\n }\n\n back(): void {\n this.warnUnsavedChanged(() => {\n if (this.componentInstance?.previousStep()) {\n this.setComponent(this.componentInstance.previousStep());\n this.cdr.detectChanges();\n }\n });\n }\n\n warnUnsavedChanged(func: () => void): void {\n if (!this.componentInstance?.hasUnsavedChanges()) {\n func();\n return;\n }\n\n this.confirmationModal\n .openModal({\n title: 'UNSAVED_CHANGES.TITLE',\n message: 'UNSAVED_CHANGES.MESSAGE',\n confirmButtonText: 'COMMON.YES',\n cancelButtonText: 'COMMON.NO',\n })\n .subscribe((confirmed) => {\n if (confirmed) {\n func();\n }\n });\n }\n\n getTitle(): string {\n if (this.data?.readOnly && this.knowledgeSource) {\n return this.knowledgeSource.name;\n }\n if (!this.data?.knowledgeSourceKey) {\n return 'ADD_KNOWLEDGE';\n }\n return 'EDIT_KNOWLEDGE.TITLE';\n }\n\n buildEditUrl(): string {\n return this.knowledgeService.buildEditKnowledgeUrl(this.knowledgeSource?.id || '');\n }\n\n showSubmit(): boolean {\n return this.component !== AddKnowledgeComponent;\n }\n\n submitDisabled(): boolean {\n return this.componentInstance?.disableSubmit;\n }\n\n getSubmitAction(): string {\n if (this.componentInstance && this.componentInstance.nextStep()) {\n return 'COMMON.SAVE_AND_CONTINUE';\n }\n return 'COMMON.SAVE';\n }\n}\n","

{{ getTitle() | translate }}

\n
\n \n \n
\n \n
\n
\n \n
\n \n
\n
\n \n \n \n {{ getSubmitAction() | translate }}\n \n \n
\n
\n
\n\n\n\n\n \n {{ 'COMMON.EDIT' | translate }}\n open_in_new\n \n\n","import {\n Component,\n computed,\n DestroyRef,\n effect,\n ElementRef,\n EventEmitter,\n inject,\n Input,\n OnInit,\n Output,\n signal,\n ViewChild,\n} from '@angular/core';\nimport { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { MatAutocomplete, MatAutocompleteModule, MatAutocompleteTrigger } from '@angular/material/autocomplete';\nimport { KnowledgeSource, KnowledgeSourceConfigType } from '@vendasta/embeddings';\nimport { AiKnowledgeService } from '../ai-knowledge.service';\nimport { CommonModule } from '@angular/common';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\nimport { MatChipsModule } from '@angular/material/chips';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { RouterModule } from '@angular/router';\nimport { KnowledgeListComponent } from '../knowledge-list/knowledge-list.component';\nimport { KnowledgeEditorComponent } from '../knowledge-editor/knowledge-editor.component';\nimport { LearnMoreBusinessProfileComponent } from '../learn-more-business-profile/learn-more-business-profile.component';\nimport { MatDialog, MatDialogConfig, MatDialogModule } from '@angular/material/dialog';\nimport { SHOW_BUSINESS_PROFILE_SOURCE_TOKEN } from '../tokens';\nimport { AiKnowledgeI18nModule } from '../assets/i18n/ai-knowledge-i18n.module';\nimport { MatDividerModule } from '@angular/material/divider';\nimport { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';\n\n@Component({\n selector: 'ai-knowledge-application-knowledge',\n standalone: true,\n imports: [\n CommonModule,\n RouterModule,\n TranslateModule,\n AiKnowledgeI18nModule,\n MatIconModule,\n MatButtonModule,\n MatInputModule,\n MatFormFieldModule,\n MatAutocompleteModule,\n FormsModule,\n ReactiveFormsModule,\n MatProgressSpinnerModule,\n MatChipsModule,\n GalaxyLoadingSpinnerModule,\n GalaxyFormFieldModule,\n KnowledgeListComponent,\n MatDialogModule,\n MatDividerModule,\n ],\n providers: [AiKnowledgeService],\n templateUrl: './application-knowledge.component.html',\n styleUrls: ['./application-knowledge.component.scss'],\n})\nexport class ApplicationKnowledgeComponent implements OnInit {\n @Input() appId: string;\n @Input() disabled: boolean;\n\n @Output() selectedSourcesChange = new EventEmitter();\n\n DIALOG_WIDTH = '660px';\n private readonly dialog = inject(MatDialog);\n private readonly bpObserver = inject(BreakpointObserver);\n\n private readonly knowledgeService = inject(AiKnowledgeService);\n private readonly showBusinessProfileSource = toSignal(inject(SHOW_BUSINESS_PROFILE_SOURCE_TOKEN));\n sources = signal([]);\n searchValue = signal('');\n selectedSources = signal(null);\n filteredSources = computed(() =>\n this.sources().filter(\n (source) =>\n source.name.toLowerCase().indexOf(this.searchValue()) >= 0 &&\n !this.selectedSources().some((selected) => selected.id === source.id),\n ),\n );\n readonly isLoading = signal(true);\n\n selectedSourceControl = new FormControl();\n\n @ViewChild('knowledgeSourceInput') knowledgeSourceInput: ElementRef;\n @ViewChild('auto') matAutocomplete: MatAutocomplete;\n @ViewChild('trigger') matAutocompleteTrigger: MatAutocompleteTrigger;\n\n constructor(private readonly destroyRef: DestroyRef) {\n effect(() => this.selectedSourcesChange.emit(this.selectedSources()));\n }\n\n async ngOnInit(): Promise {\n await this.refreshSources();\n\n let initialSources: KnowledgeSource[] = [];\n if (this.appId) {\n initialSources = await this.knowledgeService.listAllKnowledgeSourcesForApp(this.appId);\n } else if (this.showBusinessProfileSource()) {\n const businessProfileSource = this.knowledgeService.buildBusinessProfileKnowledgeSource();\n if (businessProfileSource) {\n initialSources = [businessProfileSource];\n }\n }\n this.selectedSources.set(initialSources);\n this.isLoading.set(false);\n\n this.selectedSourceControl.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((searchValue) => {\n if (typeof searchValue === 'string') {\n this.searchValue.set(searchValue?.toLowerCase());\n }\n });\n }\n\n async refreshSources(): Promise {\n // TODO: actually page and search on value changes\n const sourcesResult = await this.knowledgeService.listKnowledgeSources(\n [\n KnowledgeSourceConfigType.KNOWLEDGE_SOURCE_CONFIG_TYPE_CUSTOM_DATA,\n KnowledgeSourceConfigType.KNOWLEDGE_SOURCE_CONFIG_TYPE_WEBSITE_SCRAPE,\n ],\n { pageSize: 100 },\n );\n const knowledgeSources = sourcesResult.knowledgeSources || [];\n if (this.showBusinessProfileSource()) {\n // manually insert business profile source because it may not exist yet\n const businessProfileSource = this.knowledgeService.buildBusinessProfileKnowledgeSource();\n if (businessProfileSource) {\n knowledgeSources.unshift(businessProfileSource);\n }\n }\n this.sources.set(knowledgeSources);\n this.clearInputFields();\n }\n\n async forceRefreshSources(): Promise {\n this.isLoading.set(true);\n await this.refreshSources();\n this.isLoading.set(false);\n }\n\n async viewSource(source: KnowledgeSource): Promise {\n if (source?.config?.businessProfileConfig?.accountGroupId) {\n this.dialog.open(LearnMoreBusinessProfileComponent, {\n width: this.DIALOG_WIDTH,\n data: { readOnly: true },\n });\n return;\n }\n const conf: MatDialogConfig = {\n width: this.DIALOG_WIDTH,\n data: { knowledgeSourceKey: { knowledgeSourceId: source?.id, namespace: source?.namespace }, readOnly: true },\n };\n\n const isSmallScreen = this.bpObserver.isMatched(Breakpoints.XSmall);\n if (isSmallScreen) {\n conf.maxWidth = '100vw';\n conf.maxHeight = '100vh';\n }\n this.dialog.open(KnowledgeEditorComponent, conf);\n }\n\n removeSource(source: KnowledgeSource): void {\n this.selectedSources.update((selectedSources) => {\n const index = selectedSources.indexOf(source);\n if (index >= 0) {\n selectedSources.splice(index, 1);\n }\n return [...selectedSources];\n });\n }\n\n addSource(source: KnowledgeSource): void {\n this.selectedSources.update((selectedSources) => {\n const sourceIds = selectedSources.map((g) => g.id);\n if (!sourceIds.includes(source.id)) {\n selectedSources.push(source);\n }\n this.clearInputFields();\n this.matAutocompleteTrigger.closePanel();\n return [...selectedSources];\n });\n }\n\n chooseMatch(event: any): void {\n event.preventDefault();\n if (this.filteredSources().length > 1) {\n // Do not select if there are multiple matches\n return;\n }\n if (this.filteredSources().length === 1) {\n const sourceToAdd = this.filteredSources()[0];\n this.addSource(sourceToAdd);\n }\n }\n\n clearInputFields(): void {\n if (this.knowledgeSourceInput?.nativeElement?.value) {\n this.knowledgeSourceInput.nativeElement.value = '';\n }\n this.selectedSourceControl.setValue('');\n }\n\n manageKnowledgeUrl(): string {\n return this.knowledgeService.buildManageKnowledgeUrl();\n }\n\n goToAddKnowledge(): void {\n window.open(this.knowledgeService.buildAddKnowledgeUrl(), '_blank');\n }\n\n getKnowledgePreview(source: KnowledgeSource): string {\n return this.knowledgeService.getKnowledgePreview(source);\n }\n}\n","
\n {{ 'CHOOSE_KNOWLEDGE_SOURCES' | translate }}\n
\n\n \n \n \n \n refresh\n \n \n \n {{ 'ADD_KNOWLEDGE' | translate }}\n open_in_new\n \n \n 0\">\n \n
{{ source.name }}
\n
{{ getKnowledgePreview(source) }}
\n
\n
\n
\n \n
\n\n\n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, DestroyRef, EventEmitter, HostListener, inject, Input, OnInit, Output } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatButtonToggleModule } from '@angular/material/button-toggle';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { MaybeAsync, RouterModule } from '@angular/router';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { Widget } from './widget';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { map } from 'rxjs';\nimport { InboxService } from '../../../../../core/src/lib/inbox.service';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\nimport { KnowledgeSource } from '@vendasta/embeddings';\nimport { ApplicationKnowledgeComponent } from '@galaxy/ai-knowledge';\nimport { OpenConfirmationModalService } from '@vendasta/galaxy/confirmation-modal';\nimport { MatDialogModule } from '@angular/material/dialog';\n\n@Component({\n selector: 'inbox-webchat-form',\n standalone: true,\n imports: [\n CommonModule,\n MatInputModule,\n MatCardModule,\n ReactiveFormsModule,\n FormsModule,\n MatButtonModule,\n GalaxyFormFieldModule,\n GalaxyLoadingSpinnerModule,\n TranslateModule,\n MatCheckboxModule,\n RouterModule,\n MatIconModule,\n MatButtonToggleModule,\n MatDialogModule,\n ApplicationKnowledgeComponent,\n ],\n templateUrl: './webchat-form.component.html',\n styleUrls: ['./webchat-form.component.scss'],\n})\nexport class WebchatFormComponent implements OnInit {\n @Input() webchat: Widget;\n\n @Input() set disabled(value: boolean) {\n if (this.widgetForm) {\n value ? this.widgetForm.disable() : this.widgetForm.enable();\n }\n }\n\n @Output() formChange = new EventEmitter();\n @Output() knowledgeSourcesChange = new EventEmitter();\n\n private destroyRef = inject(DestroyRef);\n widgetForm: FormGroup | undefined;\n customKnowledgeForm: FormGroup | undefined;\n textColorSelected = 'light';\n accentTextColorSelected = 'light';\n COLOR_REGEX = /^#[a-fA-F0-9]{6}$/;\n private inboxService = inject(InboxService);\n private readonly confirmationModal = inject(OpenConfirmationModalService);\n private hasUnsavedChanges = false;\n private initialSources: KnowledgeSource[] | null = null;\n isBusinessApp = this.inboxService.isBusinessApp;\n knowledgeAppId = '';\n\n ngOnInit(): void {\n this.widgetForm = new FormGroup({\n name: new FormControl(this.webchat?.name || ''),\n color: new FormControl(this.webchat?.color || '#555555', [\n Validators.required,\n Validators.pattern(this.COLOR_REGEX),\n ]),\n welcomeMessage: new FormControl(this.webchat?.welcomeMessage || ''),\n textColor: new FormControl(this.webchat?.textColor || 'light'),\n accentColor: new FormControl(this.webchat?.accentColor || '#1976d2', [\n Validators.required,\n Validators.pattern(this.COLOR_REGEX),\n ]),\n accentTextColor: new FormControl(this.webchat?.accentTextColor || 'light'),\n });\n this.customKnowledgeForm = new FormGroup({\n knowledgeSources: new FormControl([]),\n });\n this.textColorSelected = this.widgetForm?.get('textColor')?.value || 'light';\n this.accentTextColorSelected = this.widgetForm?.get('accentTextColor')?.value || 'light';\n\n this.widgetForm.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => {\n this.formChange.emit(value);\n this.markChanges();\n });\n\n this.customKnowledgeForm.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => {\n this.knowledgeSourcesChange.emit(value?.knowledgeSources);\n this.markChanges();\n });\n\n if (this.webchat?.widgetId) {\n this.knowledgeAppId = this.inboxService.buildAppId(this.webchat.widgetId);\n }\n }\n\n private knowledgeSourcesHaveChanged(): boolean {\n const currentSources: KnowledgeSource[] = this.customKnowledgeForm?.get('knowledgeSources')?.value;\n if (this.initialSources?.length !== currentSources?.length) {\n return true;\n }\n for (const source of this.initialSources || []) {\n if (!currentSources.some((s) => s.id === source.id)) {\n return true;\n }\n }\n return false;\n }\n\n public getContrastYIQ(color: string): string {\n const len = 2;\n const baseHex = 16;\n\n // remove hash from hexa string\n const hexColor = color.substring(1);\n\n const r = parseInt(hexColor.substr(0, len), baseHex);\n const g = parseInt(hexColor.substr(2, len), baseHex);\n const b = parseInt(hexColor.substr(4, len), baseHex);\n const yiq = (r * 299 + g * 587 + b * 114) / 1000;\n return yiq >= 128 ? 'dark' : 'light';\n }\n\n updateSelectedSources(sources: KnowledgeSource[] | null): void {\n if (this.initialSources === null && sources !== null) {\n this.initialSources = JSON.parse(JSON.stringify(sources));\n }\n this.customKnowledgeForm?.get('knowledgeSources')?.setValue(sources);\n }\n\n public setTextColor() {\n this.widgetForm\n ?.get('textColor')\n ?.setValue(this.getContrastYIQ(this.widgetForm?.get('color')?.value), { emitEvent: false });\n }\n\n public setAccentTextColor() {\n this.widgetForm\n ?.get('accentTextColor')\n ?.setValue(this.getContrastYIQ(this.widgetForm?.get('accentColor')?.value), { emitEvent: false });\n }\n\n @HostListener('window: beforeunload', ['$event'])\n onBeforeUnload(event: BeforeUnloadEvent): void {\n if (this.hasUnsavedChanges) {\n event.preventDefault();\n event.stopPropagation();\n event.returnValue = false;\n }\n }\n\n canDeactivate(): MaybeAsync {\n if (this.hasUnsavedChanges) {\n return this.confirmationModal\n .openModal({\n type: 'warn',\n title: 'INBOX.UNSAVED_CHANGES.TITLE',\n message: 'INBOX.UNSAVED_CHANGES.MESSAGE',\n confirmButtonText: 'INBOX.UNSAVED_CHANGES.CONFIRM',\n })\n .pipe(map((confirmation) => !!confirmation));\n }\n return true;\n }\n\n private markChanges(): void {\n if (this.widgetForm?.dirty || this.customKnowledgeForm?.dirty || this.knowledgeSourcesHaveChanged()) {\n this.hasUnsavedChanges = true;\n return;\n }\n this.hasUnsavedChanges = false;\n }\n\n markAsSaved() {\n this.widgetForm?.markAsPristine();\n this.customKnowledgeForm?.markAsPristine();\n this.initialSources = JSON.parse(JSON.stringify(this.customKnowledgeForm?.get('knowledgeSources')?.value));\n this.hasUnsavedChanges = false;\n }\n}\n","
\n
\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.WIDGET_NAME' | translate }}\n \n \n \n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.WIDGET_NAME_DESCRIPTION' | translate }}\n \n \n \n \n\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.WEBCHAT_ASSISTANT_TITLE' | translate }}\n \n \n \n \n \n\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.WEBCHAT_GREETING' | translate }}\n \n \n

{{ 'INBOX.WEBCHAT.SETTINGS.WEBCHAT_GREETING_DESCRIPTION' | translate }}

\n \n \n {{ welcomeMessageLimit.value?.length || 0 }}/70\n \n
\n
\n\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.APPEARANCE' | translate }}\n \n \n
\n \n {{ 'INBOX.WEBCHAT.SETTINGS.PRIMARY_COLOR' | translate }}\n \n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.INVALID_COLOR' | translate }}\n \n \n
\n \n {{ 'INBOX.WEBCHAT.SETTINGS.TEXT_COLOR' | translate }}\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.DARK' | translate }}\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.LIGHT' | translate }}\n \n \n \n\n
\n \n {{ 'INBOX.WEBCHAT.SETTINGS.ACCENT_COLOR' | translate }}\n \n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.INVALID_COLOR' | translate }}\n \n \n
\n \n {{ 'INBOX.WEBCHAT.SETTINGS.ACCENT_TEXT_COLOR' | translate }}\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.DARK' | translate }}\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.LIGHT' | translate }}\n \n \n \n
\n
\n
\n
\n","import { CommonModule } from '@angular/common';\nimport { Component, inject, signal, ViewChild } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\nimport { ActivatedRoute, MaybeAsync, Router } from '@angular/router';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { ConversationApiService } from '@vendasta/conversation';\nimport { Widget } from '../webchat-form/widget';\nimport { GalaxyPageModule } from '@vendasta/galaxy/page';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { catchError, firstValueFrom, throwError } from 'rxjs';\nimport { InboxService } from '../../../../../core/src';\nimport { ACCOUNT_GROUP_ID_TOKEN, PARTNER_ID_TOKEN } from '../../../../../core/src/lib/tokens';\nimport { StickyFooterComponent } from '../../../components/sticky-footer/sticky-footer.component';\nimport { getBackUrl } from '../constants';\nimport { WebchatFormComponent } from '../webchat-form/webchat-form.component';\nimport { AiKnowledgeService } from '@galaxy/ai-knowledge';\nimport { KnowledgeSource } from '@vendasta/embeddings';\n\n@Component({\n selector: 'inbox-new-webchat',\n standalone: true,\n imports: [\n CommonModule,\n MatCardModule,\n GalaxyPageModule,\n TranslateModule,\n MatIconModule,\n WebchatFormComponent,\n StickyFooterComponent,\n ],\n templateUrl: './new-webchat.component.html',\n styleUrls: ['./new-webchat.component.scss'],\n})\nexport class NewWebchatComponent {\n @ViewChild('webchatFormComponent') webchatFormComponent: WebchatFormComponent;\n private readonly conversationApi = inject(ConversationApiService);\n private readonly snackbarService = inject(SnackbarService);\n private readonly router = inject(Router);\n private readonly route = inject(ActivatedRoute);\n private readonly partnerId = toSignal(inject(PARTNER_ID_TOKEN));\n private readonly accountGroupId = toSignal(inject(ACCOUNT_GROUP_ID_TOKEN));\n private readonly inboxService = inject(InboxService);\n private readonly knowledgeService = inject(AiKnowledgeService);\n\n private widgetFormData: Widget;\n private knowledgeSources?: KnowledgeSource[];\n\n readonly isLoading = signal(false);\n readonly backUrl = getBackUrl(this.inboxService.isBusinessApp, 2);\n\n updateFormData(widget: Widget): void {\n this.widgetFormData = widget;\n }\n\n updateKnowledgeSources(sources: KnowledgeSource[]): void {\n this.knowledgeSources = sources;\n }\n\n async createWebchat(): Promise {\n this.isLoading.set(true);\n\n // We may need to revisit how we get namespaces for the settings page.\n // This works for now\n const namespace = this.accountGroupId() || this.partnerId();\n\n try {\n const resp = await firstValueFrom(\n this.conversationApi\n .createWidget({\n ...this.widgetFormData,\n namespace: namespace,\n })\n .pipe(catchError((err) => throwError(() => err))),\n );\n\n const widgetId = resp.widget.widgetId;\n const configurationUrl = await this.inboxService.buildAiKnowledgeAppConfigurationUrl(widgetId);\n await this.knowledgeService\n .upsertKnowledgeForApp(\n this.inboxService.buildAppId(widgetId),\n 'Web Chat: ' + resp.widget.name,\n configurationUrl,\n this.knowledgeSources,\n )\n .catch(\n // ignore error here for now because it could orphan the widget otherwise\n // TODO: handle this better in the next iteration of the UI for AI Knowledge (a different step?)\n () => console.warn('Failed to save Automated Assistant settings'),\n );\n\n this.webchatFormComponent.markAsSaved();\n this.snackbarService.openSuccessSnack('INBOX.WEBCHAT.SETTINGS.WEBCHAT_CREATED');\n this.router.navigate(['..', resp.widget.widgetId], { relativeTo: this.route });\n } catch (e) {\n this.snackbarService.openErrorSnack('INBOX.WEBCHAT.SETTINGS.WEBCHAT_CREATE_ERROR');\n } finally {\n this.isLoading.set(false);\n }\n }\n\n canDeactivate(): MaybeAsync {\n return this.webchatFormComponent.canDeactivate();\n }\n}\n","\n \n {{ 'INBOX.SETTINGS.WEBCHAT_CONFIGURATION' | translate }}\n \n \n \n\n \n \n\n","import { Component } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatDividerModule } from '@angular/material/divider';\n\n@Component({\n selector: 'inbox-webchat-install-instructions-dialog',\n standalone: true,\n imports: [CommonModule, MatButtonModule, MatDialogModule, MatDividerModule],\n templateUrl: './webchat-install-instructions-dialog.component.html',\n})\nexport class WebchatInstallInstructionsDialogComponent {}\n","

How to install Inbox Pro Web Chat widget on a website

\n\n\n

Install the WordPress web chat plugin

\n
    \n
  1. Download your custom plugin from Inbox Pro Settings > Web Chat > Installation > WordPress
  2. \n
  3. \n Go to\n your-website.com\n /wp-admin > Plugins > Add New Plugin\n
  4. \n
  5. Upload the zip file containing your plugin, and install it.
  6. \n
  7. Activate it, and you’ll see the chat appear on your site after reloading the page.
  8. \n
\n\n

Alternatively, install the website embed code

\n

\n To install your web chat widget on your website, copy and paste your install code into the\n <head>\n element of your website, typically just before the closing\n </head>\n tag.\n

\n\n

For a WordPress site with Divi theme

\n
    \n
  1. Copy your web chat installation code into your clipboard.
  2. \n
  3. \n Navigate to your WordPress backend admin, usually at\n your-website.com\n /wp-admin\n
  4. \n
  5. Go to Divi > Theme Options > Integrations
  6. \n
  7. \n Paste the code into the section titled \"Add code to the\n <head>\n of your blog.\"\n
  8. \n
  9. Save changes. Your web chat widget should now be live on your website, on all pages.
  10. \n
\n\n

For a WordPress site without Divi theme

\n

\n To save custom code to the header of your website, you’ll need to download a plugin like\n \n Header Footer Code Manager.\n \n (We are not affiliated with these plugins, use at your own risk.)\n

\n
    \n
  1. Copy your web chat installation code to your clipboard.
  2. \n
  3. \n Go to your WordPress backend admin, typically at\n your-website.com\n /wp-admin\n
  4. \n
  5. Navigate to Plugins > Add New
  6. \n
  7. Search for your plugin, Install and Activate it.
  8. \n
  9. \n Once the plugin is downloaded and activated, navigate to the area in the plugin where you can add custom content\n to the\n <head>\n element of your website, and paste your web chat code.\n
  10. \n
\n\n \n\n

Common issues

\n\n

Issue: I cannot scroll, or type the 'space' key, or a certain character into the chat widget

\n

\n Some plugin features can interfere with the ability to type in the widget because they “hijack” that key for their\n own functions. Try disabling plugins, one by one, to find the plugin that’s affecting the web chat.\n

\n\n

Issue: I don't see the web chat on my site, even though it’s installed in the right place

\n

\n If the Web chat code is installed on your website, and enabled in Inbox Settings, and you cannot see it on your\n website, the most likely next cause is usually cache or plugin issues. You can try additional steps on your website\n to clear cache or any blocking plugins to get the web chat to appear.\n

\n\n

Caching issues

\n

\n Most websites use multiple types of caches that help the site to load faster. You’ll want to reset the caches, to\n get your latest website changes to appear.\n

\n
    \n
  1. Browser cache – to tell your browser to load the website without using local device cache
  2. \n
      \n
    1. Shift+command+R (Mac)
    2. \n
    3. Ctrl + F5 (PC)
    4. \n
    \n
  3. \n Website hosting cache – clear the cache that Website product manages, by clicking the ‘Flush Cache’ button on the\n Website overview page.\n
  4. \n
  5. \n Divi CSS cache – Disable the Static CSS File Generation cache in your Divi Theme options > Builder >\n Advanced\n
  6. \n
  7. \n Other Cache plugins – Ensure there are no other cache plugins activated on your website; if so, disable them.\n
  8. \n
\n\n

Google reCAPTCHA badge is in the way

\n

\n When reCAPTCHA is being used on a website form, this badge will appear in the bottom right of a webpage – which can\n be in the way of the web chat widget.\n

\n

\n You can hide the badge completely on your website with some custom CSS; just make sure to follow Google’s required\n alternative ways to inform the user that reCAPTCHA is being used. Read more:\n \n https://developers.google.com/recaptcha/docs/faq#id-like-to-hide-the-recaptcha-badge.-what-is-allowed\n \n

\n\n

To hide the reCAPTCHA badge, go to your website CSS editor,

\n
    \n
  1. Log in to your WordPress dashboard
  2. \n
  3. \n Go to\n Appearance > Customizer\n
  4. \n
  5. \n Click\n Additional CSS\n
  6. \n
  7. \n Add the snippet below:\n
    .grecaptcha-badge {{'{'}}\n  visibility: hidden!important;\n{{'}'}}
    \n
  8. \n
  9. Save and preview your website.
  10. \n
\n
\n\n\n \n\n","// https://nodejs.org/api/packages.html#packages_writing_dual_packages_while_avoiding_or_minimizing_hazards\nimport HighlightJS from '../lib/core.js';\nexport { HighlightJS };\nexport default HighlightJS;","const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';\nconst KEYWORDS = [\"as\",\n// for exports\n\"in\", \"of\", \"if\", \"for\", \"while\", \"finally\", \"var\", \"new\", \"function\", \"do\", \"return\", \"void\", \"else\", \"break\", \"catch\", \"instanceof\", \"with\", \"throw\", \"case\", \"default\", \"try\", \"switch\", \"continue\", \"typeof\", \"delete\", \"let\", \"yield\", \"const\", \"class\",\n// JS handles these with a special rule\n// \"get\",\n// \"set\",\n\"debugger\", \"async\", \"await\", \"static\", \"import\", \"from\", \"export\", \"extends\"];\nconst LITERALS = [\"true\", \"false\", \"null\", \"undefined\", \"NaN\", \"Infinity\"];\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects\nconst TYPES = [\n// Fundamental objects\n\"Object\", \"Function\", \"Boolean\", \"Symbol\",\n// numbers and dates\n\"Math\", \"Date\", \"Number\", \"BigInt\",\n// text\n\"String\", \"RegExp\",\n// Indexed collections\n\"Array\", \"Float32Array\", \"Float64Array\", \"Int8Array\", \"Uint8Array\", \"Uint8ClampedArray\", \"Int16Array\", \"Int32Array\", \"Uint16Array\", \"Uint32Array\", \"BigInt64Array\", \"BigUint64Array\",\n// Keyed collections\n\"Set\", \"Map\", \"WeakSet\", \"WeakMap\",\n// Structured data\n\"ArrayBuffer\", \"SharedArrayBuffer\", \"Atomics\", \"DataView\", \"JSON\",\n// Control abstraction objects\n\"Promise\", \"Generator\", \"GeneratorFunction\", \"AsyncFunction\",\n// Reflection\n\"Reflect\", \"Proxy\",\n// Internationalization\n\"Intl\",\n// WebAssembly\n\"WebAssembly\"];\nconst ERROR_TYPES = [\"Error\", \"EvalError\", \"InternalError\", \"RangeError\", \"ReferenceError\", \"SyntaxError\", \"TypeError\", \"URIError\"];\nconst BUILT_IN_GLOBALS = [\"setInterval\", \"setTimeout\", \"clearInterval\", \"clearTimeout\", \"require\", \"exports\", \"eval\", \"isFinite\", \"isNaN\", \"parseFloat\", \"parseInt\", \"decodeURI\", \"decodeURIComponent\", \"encodeURI\", \"encodeURIComponent\", \"escape\", \"unescape\"];\nconst BUILT_IN_VARIABLES = [\"arguments\", \"this\", \"super\", \"console\", \"window\", \"document\", \"localStorage\", \"sessionStorage\", \"module\", \"global\" // Node.js\n];\nconst BUILT_INS = [].concat(BUILT_IN_GLOBALS, TYPES, ERROR_TYPES);\n\n/*\nLanguage: JavaScript\nDescription: JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.\nCategory: common, scripting, web\nWebsite: https://developer.mozilla.org/en-US/docs/Web/JavaScript\n*/\n\n/** @type LanguageFn */\nfunction javascript(hljs) {\n const regex = hljs.regex;\n /**\n * Takes a string like \" {\n const tag = \"',\n end: ''\n };\n // to avoid some special cases inside isTrulyOpeningTag\n const XML_SELF_CLOSING = /<[A-Za-z0-9\\\\._:-]+\\s*\\/>/;\n const XML_TAG = {\n begin: /<[A-Za-z0-9\\\\._:-]+/,\n end: /\\/[A-Za-z0-9\\\\._:-]+>|\\/>/,\n /**\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\n isTrulyOpeningTag: (match, response) => {\n const afterMatchIndex = match[0].length + match.index;\n const nextChar = match.input[afterMatchIndex];\n if (\n // HTML should not include another raw `<` inside a tag\n // nested type?\n // `>`, etc.\n nextChar === \"<\" ||\n // the , gives away that this is not HTML\n // ``\n nextChar === \",\") {\n response.ignoreMatch();\n return;\n }\n\n // ``\n // Quite possibly a tag, lets look for a matching closing tag...\n if (nextChar === \">\") {\n // if we cannot find a matching closing tag, then we\n // will ignore it\n if (!hasClosingTag(match, {\n after: afterMatchIndex\n })) {\n response.ignoreMatch();\n }\n }\n\n // `` (self-closing)\n // handled by simpleSelfClosing rule\n\n let m;\n const afterMatch = match.input.substring(afterMatchIndex);\n\n // some more template typing stuff\n // (key?: string) => Modify<\n if (m = afterMatch.match(/^\\s*=/)) {\n response.ignoreMatch();\n return;\n }\n\n // ``\n // technically this could be HTML, but it smells like a type\n // NOTE: This is ugh, but added specifically for https://github.com/highlightjs/highlight.js/issues/3276\n if (m = afterMatch.match(/^\\s+extends\\s+/)) {\n if (m.index === 0) {\n response.ignoreMatch();\n // eslint-disable-next-line no-useless-return\n return;\n }\n }\n }\n };\n const KEYWORDS$1 = {\n $pattern: IDENT_RE,\n keyword: KEYWORDS,\n literal: LITERALS,\n built_in: BUILT_INS,\n \"variable.language\": BUILT_IN_VARIABLES\n };\n\n // https://tc39.es/ecma262/#sec-literals-numeric-literals\n const decimalDigits = '[0-9](_?[0-9])*';\n const frac = `\\\\.(${decimalDigits})`;\n // DecimalIntegerLiteral, including Annex B NonOctalDecimalIntegerLiteral\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;\n const NUMBER = {\n className: 'number',\n variants: [\n // DecimalLiteral\n {\n begin: `(\\\\b(${decimalInteger})((${frac})|\\\\.)?|(${frac}))` + `[eE][+-]?(${decimalDigits})\\\\b`\n }, {\n begin: `\\\\b(${decimalInteger})\\\\b((${frac})\\\\b|\\\\.)?|(${frac})\\\\b`\n },\n // DecimalBigIntegerLiteral\n {\n begin: `\\\\b(0|[1-9](_?[0-9])*)n\\\\b`\n },\n // NonDecimalIntegerLiteral\n {\n begin: \"\\\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\\\b\"\n }, {\n begin: \"\\\\b0[bB][0-1](_?[0-1])*n?\\\\b\"\n }, {\n begin: \"\\\\b0[oO][0-7](_?[0-7])*n?\\\\b\"\n },\n // LegacyOctalIntegerLiteral (does not include underscore separators)\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n {\n begin: \"\\\\b0[0-7]+n?\\\\b\"\n }],\n relevance: 0\n };\n const SUBST = {\n className: 'subst',\n begin: '\\\\$\\\\{',\n end: '\\\\}',\n keywords: KEYWORDS$1,\n contains: [] // defined later\n };\n const HTML_TEMPLATE = {\n begin: 'html`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [hljs.BACKSLASH_ESCAPE, SUBST],\n subLanguage: 'xml'\n }\n };\n const CSS_TEMPLATE = {\n begin: 'css`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [hljs.BACKSLASH_ESCAPE, SUBST],\n subLanguage: 'css'\n }\n };\n const GRAPHQL_TEMPLATE = {\n begin: 'gql`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [hljs.BACKSLASH_ESCAPE, SUBST],\n subLanguage: 'graphql'\n }\n };\n const TEMPLATE_STRING = {\n className: 'string',\n begin: '`',\n end: '`',\n contains: [hljs.BACKSLASH_ESCAPE, SUBST]\n };\n const JSDOC_COMMENT = hljs.COMMENT(/\\/\\*\\*(?!\\/)/, '\\\\*/', {\n relevance: 0,\n contains: [{\n begin: '(?=@[A-Za-z]+)',\n relevance: 0,\n contains: [{\n className: 'doctag',\n begin: '@[A-Za-z]+'\n }, {\n className: 'type',\n begin: '\\\\{',\n end: '\\\\}',\n excludeEnd: true,\n excludeBegin: true,\n relevance: 0\n }, {\n className: 'variable',\n begin: IDENT_RE$1 + '(?=\\\\s*(-)|$)',\n endsParent: true,\n relevance: 0\n },\n // eat spaces (not newlines) so we can find\n // types or variables\n {\n begin: /(?=[^\\n])\\s/,\n relevance: 0\n }]\n }]\n });\n const COMMENT = {\n className: \"comment\",\n variants: [JSDOC_COMMENT, hljs.C_BLOCK_COMMENT_MODE, hljs.C_LINE_COMMENT_MODE]\n };\n const SUBST_INTERNALS = [hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, HTML_TEMPLATE, CSS_TEMPLATE, GRAPHQL_TEMPLATE, TEMPLATE_STRING,\n // Skip numbers when they are part of a variable name\n {\n match: /\\$\\d+/\n }, NUMBER\n // This is intentional:\n // See https://github.com/highlightjs/highlight.js/issues/3288\n // hljs.REGEXP_MODE\n ];\n SUBST.contains = SUBST_INTERNALS.concat({\n // we need to pair up {} inside our subst to prevent\n // it from ending too early by matching another }\n begin: /\\{/,\n end: /\\}/,\n keywords: KEYWORDS$1,\n contains: [\"self\"].concat(SUBST_INTERNALS)\n });\n const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);\n const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([\n // eat recursive parens in sub expressions\n {\n begin: /\\(/,\n end: /\\)/,\n keywords: KEYWORDS$1,\n contains: [\"self\"].concat(SUBST_AND_COMMENTS)\n }]);\n const PARAMS = {\n className: 'params',\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n };\n\n // ES6 classes\n const CLASS_OR_EXTENDS = {\n variants: [\n // class Car extends vehicle\n {\n match: [/class/, /\\s+/, IDENT_RE$1, /\\s+/, /extends/, /\\s+/, regex.concat(IDENT_RE$1, \"(\", regex.concat(/\\./, IDENT_RE$1), \")*\")],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\",\n 5: \"keyword\",\n 7: \"title.class.inherited\"\n }\n },\n // class Car\n {\n match: [/class/, /\\s+/, IDENT_RE$1],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\"\n }\n }]\n };\n const CLASS_REFERENCE = {\n relevance: 0,\n match: regex.either(\n // Hard coded exceptions\n /\\bJSON/,\n // Float32Array, OutT\n /\\b[A-Z][a-z]+([A-Z][a-z]*|\\d)*/,\n // CSSFactory, CSSFactoryT\n /\\b[A-Z]{2,}([A-Z][a-z]+|\\d)+([A-Z][a-z]*)*/,\n // FPs, FPsT\n /\\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\\d)*([A-Z][a-z]*)*/\n // P\n // single letters are not highlighted\n // BLAH\n // this will be flagged as a UPPER_CASE_CONSTANT instead\n ),\n className: \"title.class\",\n keywords: {\n _: [\n // se we still get relevance credit for JS library classes\n ...TYPES, ...ERROR_TYPES]\n }\n };\n const USE_STRICT = {\n label: \"use_strict\",\n className: 'meta',\n relevance: 10,\n begin: /^\\s*['\"]use (strict|asm)['\"]/\n };\n const FUNCTION_DEFINITION = {\n variants: [{\n match: [/function/, /\\s+/, IDENT_RE$1, /(?=\\s*\\()/]\n },\n // anonymous function\n {\n match: [/function/, /\\s*(?=\\()/]\n }],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n label: \"func.def\",\n contains: [PARAMS],\n illegal: /%/\n };\n const UPPER_CASE_CONSTANT = {\n relevance: 0,\n match: /\\b[A-Z][A-Z_0-9]+\\b/,\n className: \"variable.constant\"\n };\n function noneOf(list) {\n return regex.concat(\"(?!\", list.join(\"|\"), \")\");\n }\n const FUNCTION_CALL = {\n match: regex.concat(/\\b/, noneOf([...BUILT_IN_GLOBALS, \"super\", \"import\"]), IDENT_RE$1, regex.lookahead(/\\(/)),\n className: \"title.function\",\n relevance: 0\n };\n const PROPERTY_ACCESS = {\n begin: regex.concat(/\\./, regex.lookahead(regex.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/))),\n end: IDENT_RE$1,\n excludeBegin: true,\n keywords: \"prototype\",\n className: \"property\",\n relevance: 0\n };\n const GETTER_OR_SETTER = {\n match: [/get|set/, /\\s+/, IDENT_RE$1, /(?=\\()/],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [{\n // eat to avoid empty params\n begin: /\\(\\)/\n }, PARAMS]\n };\n const FUNC_LEAD_IN_RE = '(\\\\(' + '[^()]*(\\\\(' + '[^()]*(\\\\(' + '[^()]*' + '\\\\)[^()]*)*' + '\\\\)[^()]*)*' + '\\\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\\\s*=>';\n const FUNCTION_VARIABLE = {\n match: [/const|var|let/, /\\s+/, IDENT_RE$1, /\\s*/, /=\\s*/, /(async\\s*)?/,\n // async is optional\n regex.lookahead(FUNC_LEAD_IN_RE)],\n keywords: \"async\",\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [PARAMS]\n };\n return {\n name: 'JavaScript',\n aliases: ['js', 'jsx', 'mjs', 'cjs'],\n keywords: KEYWORDS$1,\n // this will be extended by TypeScript\n exports: {\n PARAMS_CONTAINS,\n CLASS_REFERENCE\n },\n illegal: /#(?![$_A-z])/,\n contains: [hljs.SHEBANG({\n label: \"shebang\",\n binary: \"node\",\n relevance: 5\n }), USE_STRICT, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, HTML_TEMPLATE, CSS_TEMPLATE, GRAPHQL_TEMPLATE, TEMPLATE_STRING, COMMENT,\n // Skip numbers when they are part of a variable name\n {\n match: /\\$\\d+/\n }, NUMBER, CLASS_REFERENCE, {\n className: 'attr',\n begin: IDENT_RE$1 + regex.lookahead(':'),\n relevance: 0\n }, FUNCTION_VARIABLE, {\n // \"value\" container\n begin: '(' + hljs.RE_STARTERS_RE + '|\\\\b(case|return|throw)\\\\b)\\\\s*',\n keywords: 'return throw case',\n relevance: 0,\n contains: [COMMENT, hljs.REGEXP_MODE, {\n className: 'function',\n // we have to count the parens to make sure we actually have the\n // correct bounding ( ) before the =>. There could be any number of\n // sub-expressions inside also surrounded by parens.\n begin: FUNC_LEAD_IN_RE,\n returnBegin: true,\n end: '\\\\s*=>',\n contains: [{\n className: 'params',\n variants: [{\n begin: hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n }, {\n className: null,\n begin: /\\(\\s*\\)/,\n skip: true\n }, {\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n }]\n }]\n }, {\n // could be a comma delimited list of params to a function call\n begin: /,/,\n relevance: 0\n }, {\n match: /\\s+/,\n relevance: 0\n }, {\n // JSX\n variants: [{\n begin: FRAGMENT.begin,\n end: FRAGMENT.end\n }, {\n match: XML_SELF_CLOSING\n }, {\n begin: XML_TAG.begin,\n // we carefully check the opening tag to see if it truly\n // is a tag and not a false positive\n 'on:begin': XML_TAG.isTrulyOpeningTag,\n end: XML_TAG.end\n }],\n subLanguage: 'xml',\n contains: [{\n begin: XML_TAG.begin,\n end: XML_TAG.end,\n skip: true,\n contains: ['self']\n }]\n }]\n }, FUNCTION_DEFINITION, {\n // prevent this from getting swallowed up by function\n // since they appear \"function like\"\n beginKeywords: \"while if switch catch for\"\n }, {\n // we have to count the parens to make sure we actually have the correct\n // bounding ( ). There could be any number of sub-expressions inside\n // also surrounded by parens.\n begin: '\\\\b(?!function)' + hljs.UNDERSCORE_IDENT_RE + '\\\\(' +\n // first parens\n '[^()]*(\\\\(' + '[^()]*(\\\\(' + '[^()]*' + '\\\\)[^()]*)*' + '\\\\)[^()]*)*' + '\\\\)\\\\s*\\\\{',\n // end parens\n returnBegin: true,\n label: \"func.def\",\n contains: [PARAMS, hljs.inherit(hljs.TITLE_MODE, {\n begin: IDENT_RE$1,\n className: \"title.function\"\n })]\n },\n // catch ... so it won't trigger the property rule below\n {\n match: /\\.\\.\\./,\n relevance: 0\n }, PROPERTY_ACCESS,\n // hack: prevents detection of keywords in some circumstances\n // .keyword()\n // $keyword = x\n {\n match: '\\\\$' + IDENT_RE$1,\n relevance: 0\n }, {\n match: [/\\bconstructor(?=\\s*\\()/],\n className: {\n 1: \"title.function\"\n },\n contains: [PARAMS]\n }, FUNCTION_CALL, UPPER_CASE_CONSTANT, CLASS_OR_EXTENDS, GETTER_OR_SETTER, {\n match: /\\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`\n }]\n };\n}\nexport { javascript as default };","/*\nLanguage: HTML, XML\nWebsite: https://www.w3.org/XML/\nCategory: common, web\nAudit: 2020\n*/\n\n/** @type LanguageFn */\nfunction xml(hljs) {\n const regex = hljs.regex;\n // XML names can have the following additional letters: https://www.w3.org/TR/xml/#NT-NameChar\n // OTHER_NAME_CHARS = /[:\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]/;\n // Element names start with NAME_START_CHAR followed by optional other Unicode letters, ASCII digits, hyphens, underscores, and periods\n // const TAG_NAME_RE = regex.concat(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/, regex.optional(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*:/), /[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*/);;\n // const XML_IDENT_RE = /[A-Z_a-z:\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]+/;\n // const TAG_NAME_RE = regex.concat(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/, regex.optional(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*:/), /[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*/);\n // however, to cater for performance and more Unicode support rely simply on the Unicode letter class\n const TAG_NAME_RE = regex.concat(/[\\p{L}_]/u, regex.optional(/[\\p{L}0-9_.-]*:/u), /[\\p{L}0-9_.-]*/u);\n const XML_IDENT_RE = /[\\p{L}0-9._:-]+/u;\n const XML_ENTITIES = {\n className: 'symbol',\n begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/\n };\n const XML_META_KEYWORDS = {\n begin: /\\s/,\n contains: [{\n className: 'keyword',\n begin: /#?[a-z_][a-z1-9_-]+/,\n illegal: /\\n/\n }]\n };\n const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {\n begin: /\\(/,\n end: /\\)/\n });\n const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, {\n className: 'string'\n });\n const QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, {\n className: 'string'\n });\n const TAG_INTERNALS = {\n endsWithParent: true,\n illegal: /`]+/\n }]\n }]\n }]\n };\n return {\n name: 'HTML, XML',\n aliases: ['html', 'xhtml', 'rss', 'atom', 'xjb', 'xsd', 'xsl', 'plist', 'wsf', 'svg'],\n case_insensitive: true,\n unicodeRegex: true,\n contains: [{\n className: 'meta',\n begin: //,\n relevance: 10,\n contains: [XML_META_KEYWORDS, QUOTE_META_STRING_MODE, APOS_META_STRING_MODE, XML_META_PAR_KEYWORDS, {\n begin: /\\[/,\n end: /\\]/,\n contains: [{\n className: 'meta',\n begin: //,\n contains: [XML_META_KEYWORDS, XML_META_PAR_KEYWORDS, QUOTE_META_STRING_MODE, APOS_META_STRING_MODE]\n }]\n }]\n }, hljs.COMMENT(//, {\n relevance: 10\n }), {\n begin: //,\n relevance: 10\n }, XML_ENTITIES,\n // xml processing instructions\n {\n className: 'meta',\n end: /\\?>/,\n variants: [{\n begin: /<\\?xml/,\n relevance: 10,\n contains: [QUOTE_META_STRING_MODE]\n }, {\n begin: /<\\?[a-z][a-z0-9]+/\n }]\n }, {\n className: 'tag',\n /*\n The lookahead pattern (?=...) ensures that 'begin' only matches\n ')/,\n end: />/,\n keywords: {\n name: 'style'\n },\n contains: [TAG_INTERNALS],\n starts: {\n end: /<\\/style>/,\n returnEnd: true,\n subLanguage: ['css', 'xml']\n }\n }, {\n className: 'tag',\n // See the comment in the