UNPKG

microsoft-adaptivecards

Version:

Adaptive Card typescript/javascript library for Html Clients

1,716 lines (1,472 loc) 370 kB
var AdaptiveCards = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 69); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Utilities // function _class(obj) { return Object.prototype.toString.call(obj); } function isString(obj) { return _class(obj) === '[object String]'; } var _hasOwnProperty = Object.prototype.hasOwnProperty; function has(object, key) { return _hasOwnProperty.call(object, key); } // Merge objects // function assign(obj /*from1, from2, from3, ...*/) { var sources = Array.prototype.slice.call(arguments, 1); sources.forEach(function (source) { if (!source) { return; } if (typeof source !== 'object') { throw new TypeError(source + 'must be object'); } Object.keys(source).forEach(function (key) { obj[key] = source[key]; }); }); return obj; } // Remove element from array and put another array at those position. // Useful for some operations with tokens function arrayReplaceAt(src, pos, newElements) { return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1)); } //////////////////////////////////////////////////////////////////////////////// function isValidEntityCode(c) { /*eslint no-bitwise:0*/ // broken sequence if (c >= 0xD800 && c <= 0xDFFF) { return false; } // never used if (c >= 0xFDD0 && c <= 0xFDEF) { return false; } if ((c & 0xFFFF) === 0xFFFF || (c & 0xFFFF) === 0xFFFE) { return false; } // control codes if (c >= 0x00 && c <= 0x08) { return false; } if (c === 0x0B) { return false; } if (c >= 0x0E && c <= 0x1F) { return false; } if (c >= 0x7F && c <= 0x9F) { return false; } // out of range if (c > 0x10FFFF) { return false; } return true; } function fromCodePoint(c) { /*eslint no-bitwise:0*/ if (c > 0xffff) { c -= 0x10000; var surrogate1 = 0xd800 + (c >> 10), surrogate2 = 0xdc00 + (c & 0x3ff); return String.fromCharCode(surrogate1, surrogate2); } return String.fromCharCode(c); } var UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g; var ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi; var UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + '|' + ENTITY_RE.source, 'gi'); var DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i; var entities = __webpack_require__(5); function replaceEntityPattern(match, name) { var code = 0; if (has(entities, name)) { return entities[name]; } if (name.charCodeAt(0) === 0x23/* # */ && DIGITAL_ENTITY_TEST_RE.test(name)) { code = name[1].toLowerCase() === 'x' ? parseInt(name.slice(2), 16) : parseInt(name.slice(1), 10); if (isValidEntityCode(code)) { return fromCodePoint(code); } } return match; } /*function replaceEntities(str) { if (str.indexOf('&') < 0) { return str; } return str.replace(ENTITY_RE, replaceEntityPattern); }*/ function unescapeMd(str) { if (str.indexOf('\\') < 0) { return str; } return str.replace(UNESCAPE_MD_RE, '$1'); } function unescapeAll(str) { if (str.indexOf('\\') < 0 && str.indexOf('&') < 0) { return str; } return str.replace(UNESCAPE_ALL_RE, function (match, escaped, entity) { if (escaped) { return escaped; } return replaceEntityPattern(match, entity); }); } //////////////////////////////////////////////////////////////////////////////// var HTML_ESCAPE_TEST_RE = /[&<>"]/; var HTML_ESCAPE_REPLACE_RE = /[&<>"]/g; var HTML_REPLACEMENTS = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }; function replaceUnsafeChar(ch) { return HTML_REPLACEMENTS[ch]; } function escapeHtml(str) { if (HTML_ESCAPE_TEST_RE.test(str)) { return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar); } return str; } //////////////////////////////////////////////////////////////////////////////// var REGEXP_ESCAPE_RE = /[.?*+^$[\]\\(){}|-]/g; function escapeRE(str) { return str.replace(REGEXP_ESCAPE_RE, '\\$&'); } //////////////////////////////////////////////////////////////////////////////// function isSpace(code) { switch (code) { case 0x09: case 0x20: return true; } return false; } // Zs (unicode class) || [\t\f\v\r\n] function isWhiteSpace(code) { if (code >= 0x2000 && code <= 0x200A) { return true; } switch (code) { case 0x09: // \t case 0x0A: // \n case 0x0B: // \v case 0x0C: // \f case 0x0D: // \r case 0x20: case 0xA0: case 0x1680: case 0x202F: case 0x205F: case 0x3000: return true; } return false; } //////////////////////////////////////////////////////////////////////////////// /*eslint-disable max-len*/ var UNICODE_PUNCT_RE = __webpack_require__(3); // Currently without astral characters support. function isPunctChar(ch) { return UNICODE_PUNCT_RE.test(ch); } // Markdown ASCII punctuation characters. // // !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~ // http://spec.commonmark.org/0.15/#ascii-punctuation-character // // Don't confuse with unicode punctuation !!! It lacks some chars in ascii range. // function isMdAsciiPunct(ch) { switch (ch) { case 0x21/* ! */: case 0x22/* " */: case 0x23/* # */: case 0x24/* $ */: case 0x25/* % */: case 0x26/* & */: case 0x27/* ' */: case 0x28/* ( */: case 0x29/* ) */: case 0x2A/* * */: case 0x2B/* + */: case 0x2C/* , */: case 0x2D/* - */: case 0x2E/* . */: case 0x2F/* / */: case 0x3A/* : */: case 0x3B/* ; */: case 0x3C/* < */: case 0x3D/* = */: case 0x3E/* > */: case 0x3F/* ? */: case 0x40/* @ */: case 0x5B/* [ */: case 0x5C/* \ */: case 0x5D/* ] */: case 0x5E/* ^ */: case 0x5F/* _ */: case 0x60/* ` */: case 0x7B/* { */: case 0x7C/* | */: case 0x7D/* } */: case 0x7E/* ~ */: return true; default: return false; } } // Hepler to unify [reference labels]. // function normalizeReference(str) { // use .toUpperCase() instead of .toLowerCase() // here to avoid a conflict with Object.prototype // members (most notably, `__proto__`) return str.trim().replace(/\s+/g, ' ').toUpperCase(); } //////////////////////////////////////////////////////////////////////////////// // Re-export libraries commonly used in both markdown-it and its plugins, // so plugins won't have to depend on them explicitly, which reduces their // bundled size (e.g. a browser build). // exports.lib = {}; exports.lib.mdurl = __webpack_require__(9); exports.lib.ucmicro = __webpack_require__(72); exports.assign = assign; exports.isString = isString; exports.has = has; exports.unescapeMd = unescapeMd; exports.unescapeAll = unescapeAll; exports.isValidEntityCode = isValidEntityCode; exports.fromCodePoint = fromCodePoint; // exports.replaceEntities = replaceEntities; exports.escapeHtml = escapeHtml; exports.arrayReplaceAt = arrayReplaceAt; exports.isSpace = isSpace; exports.isWhiteSpace = isWhiteSpace; exports.isMdAsciiPunct = isMdAsciiPunct; exports.isPunctChar = isPunctChar; exports.escapeRE = escapeRE; exports.normalizeReference = normalizeReference; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * class Ruler * * Helper class, used by [[MarkdownIt#core]], [[MarkdownIt#block]] and * [[MarkdownIt#inline]] to manage sequences of functions (rules): * * - keep rules in defined order * - assign the name to each rule * - enable/disable rules * - add/replace rules * - allow assign rules to additional named chains (in the same) * - cacheing lists of active rules * * You will not need use this class directly until write plugins. For simple * rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and * [[MarkdownIt.use]]. **/ /** * new Ruler() **/ function Ruler() { // List of added rules. Each element is: // // { // name: XXX, // enabled: Boolean, // fn: Function(), // alt: [ name2, name3 ] // } // this.__rules__ = []; // Cached rule chains. // // First level - chain name, '' for default. // Second level - diginal anchor for fast filtering by charcodes. // this.__cache__ = null; } //////////////////////////////////////////////////////////////////////////////// // Helper methods, should not be used directly // Find rule index by name // Ruler.prototype.__find__ = function (name) { for (var i = 0; i < this.__rules__.length; i++) { if (this.__rules__[i].name === name) { return i; } } return -1; }; // Build rules lookup cache // Ruler.prototype.__compile__ = function () { var self = this; var chains = [ '' ]; // collect unique names self.__rules__.forEach(function (rule) { if (!rule.enabled) { return; } rule.alt.forEach(function (altName) { if (chains.indexOf(altName) < 0) { chains.push(altName); } }); }); self.__cache__ = {}; chains.forEach(function (chain) { self.__cache__[chain] = []; self.__rules__.forEach(function (rule) { if (!rule.enabled) { return; } if (chain && rule.alt.indexOf(chain) < 0) { return; } self.__cache__[chain].push(rule.fn); }); }); }; /** * Ruler.at(name, fn [, options]) * - name (String): rule name to replace. * - fn (Function): new rule function. * - options (Object): new rule options (not mandatory). * * Replace rule by name with new function & options. Throws error if name not * found. * * ##### Options: * * - __alt__ - array with names of "alternate" chains. * * ##### Example * * Replace existing typorgapher replacement rule with new one: * * ```javascript * var md = require('markdown-it')(); * * md.core.ruler.at('replacements', function replace(state) { * //... * }); * ``` **/ Ruler.prototype.at = function (name, fn, options) { var index = this.__find__(name); var opt = options || {}; if (index === -1) { throw new Error('Parser rule not found: ' + name); } this.__rules__[index].fn = fn; this.__rules__[index].alt = opt.alt || []; this.__cache__ = null; }; /** * Ruler.before(beforeName, ruleName, fn [, options]) * - beforeName (String): new rule will be added before this one. * - ruleName (String): name of added rule. * - fn (Function): rule function. * - options (Object): rule options (not mandatory). * * Add new rule to chain before one with given name. See also * [[Ruler.after]], [[Ruler.push]]. * * ##### Options: * * - __alt__ - array with names of "alternate" chains. * * ##### Example * * ```javascript * var md = require('markdown-it')(); * * md.block.ruler.before('paragraph', 'my_rule', function replace(state) { * //... * }); * ``` **/ Ruler.prototype.before = function (beforeName, ruleName, fn, options) { var index = this.__find__(beforeName); var opt = options || {}; if (index === -1) { throw new Error('Parser rule not found: ' + beforeName); } this.__rules__.splice(index, 0, { name: ruleName, enabled: true, fn: fn, alt: opt.alt || [] }); this.__cache__ = null; }; /** * Ruler.after(afterName, ruleName, fn [, options]) * - afterName (String): new rule will be added after this one. * - ruleName (String): name of added rule. * - fn (Function): rule function. * - options (Object): rule options (not mandatory). * * Add new rule to chain after one with given name. See also * [[Ruler.before]], [[Ruler.push]]. * * ##### Options: * * - __alt__ - array with names of "alternate" chains. * * ##### Example * * ```javascript * var md = require('markdown-it')(); * * md.inline.ruler.after('text', 'my_rule', function replace(state) { * //... * }); * ``` **/ Ruler.prototype.after = function (afterName, ruleName, fn, options) { var index = this.__find__(afterName); var opt = options || {}; if (index === -1) { throw new Error('Parser rule not found: ' + afterName); } this.__rules__.splice(index + 1, 0, { name: ruleName, enabled: true, fn: fn, alt: opt.alt || [] }); this.__cache__ = null; }; /** * Ruler.push(ruleName, fn [, options]) * - ruleName (String): name of added rule. * - fn (Function): rule function. * - options (Object): rule options (not mandatory). * * Push new rule to the end of chain. See also * [[Ruler.before]], [[Ruler.after]]. * * ##### Options: * * - __alt__ - array with names of "alternate" chains. * * ##### Example * * ```javascript * var md = require('markdown-it')(); * * md.core.ruler.push('my_rule', function replace(state) { * //... * }); * ``` **/ Ruler.prototype.push = function (ruleName, fn, options) { var opt = options || {}; this.__rules__.push({ name: ruleName, enabled: true, fn: fn, alt: opt.alt || [] }); this.__cache__ = null; }; /** * Ruler.enable(list [, ignoreInvalid]) -> Array * - list (String|Array): list of rule names to enable. * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found. * * Enable rules with given names. If any rule name not found - throw Error. * Errors can be disabled by second param. * * Returns list of found rule names (if no exception happened). * * See also [[Ruler.disable]], [[Ruler.enableOnly]]. **/ Ruler.prototype.enable = function (list, ignoreInvalid) { if (!Array.isArray(list)) { list = [ list ]; } var result = []; // Search by name and enable list.forEach(function (name) { var idx = this.__find__(name); if (idx < 0) { if (ignoreInvalid) { return; } throw new Error('Rules manager: invalid rule name ' + name); } this.__rules__[idx].enabled = true; result.push(name); }, this); this.__cache__ = null; return result; }; /** * Ruler.enableOnly(list [, ignoreInvalid]) * - list (String|Array): list of rule names to enable (whitelist). * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found. * * Enable rules with given names, and disable everything else. If any rule name * not found - throw Error. Errors can be disabled by second param. * * See also [[Ruler.disable]], [[Ruler.enable]]. **/ Ruler.prototype.enableOnly = function (list, ignoreInvalid) { if (!Array.isArray(list)) { list = [ list ]; } this.__rules__.forEach(function (rule) { rule.enabled = false; }); this.enable(list, ignoreInvalid); }; /** * Ruler.disable(list [, ignoreInvalid]) -> Array * - list (String|Array): list of rule names to disable. * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found. * * Disable rules with given names. If any rule name not found - throw Error. * Errors can be disabled by second param. * * Returns list of found rule names (if no exception happened). * * See also [[Ruler.enable]], [[Ruler.enableOnly]]. **/ Ruler.prototype.disable = function (list, ignoreInvalid) { if (!Array.isArray(list)) { list = [ list ]; } var result = []; // Search by name and disable list.forEach(function (name) { var idx = this.__find__(name); if (idx < 0) { if (ignoreInvalid) { return; } throw new Error('Rules manager: invalid rule name ' + name); } this.__rules__[idx].enabled = false; result.push(name); }, this); this.__cache__ = null; return result; }; /** * Ruler.getRules(chainName) -> Array * * Return array of active functions (rules) for given chain name. It analyzes * rules configuration, compiles caches if not exists and returns result. * * Default chain name is `''` (empty string). It can't be skipped. That's * done intentionally, to keep signature monomorphic for high speed. **/ Ruler.prototype.getRules = function (chainName) { if (this.__cache__ === null) { this.__compile__(); } // Chain can be empty, if rules disabled. But we still have to return Array. return this.__cache__[chainName] || []; }; module.exports = Ruler; /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Token class /** * class Token **/ /** * new Token(type, tag, nesting) * * Create new token and fill passed properties. **/ function Token(type, tag, nesting) { /** * Token#type -> String * * Type of the token (string, e.g. "paragraph_open") **/ this.type = type; /** * Token#tag -> String * * html tag name, e.g. "p" **/ this.tag = tag; /** * Token#attrs -> Array * * Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]` **/ this.attrs = null; /** * Token#map -> Array * * Source map info. Format: `[ line_begin, line_end ]` **/ this.map = null; /** * Token#nesting -> Number * * Level change (number in {-1, 0, 1} set), where: * * - `1` means the tag is opening * - `0` means the tag is self-closing * - `-1` means the tag is closing **/ this.nesting = nesting; /** * Token#level -> Number * * nesting level, the same as `state.level` **/ this.level = 0; /** * Token#children -> Array * * An array of child nodes (inline and img tokens) **/ this.children = null; /** * Token#content -> String * * In a case of self-closing tag (code, html, fence, etc.), * it has contents of this tag. **/ this.content = ''; /** * Token#markup -> String * * '*' or '_' for emphasis, fence string for fence, etc. **/ this.markup = ''; /** * Token#info -> String * * fence infostring **/ this.info = ''; /** * Token#meta -> Object * * A place for plugins to store an arbitrary data **/ this.meta = null; /** * Token#block -> Boolean * * True for block-level tokens, false for inline tokens. * Used in renderer to calculate line breaks **/ this.block = false; /** * Token#hidden -> Boolean * * If it's true, ignore this element when rendering. Used for tight lists * to hide paragraphs. **/ this.hidden = false; } /** * Token.attrIndex(name) -> Number * * Search attribute index by name. **/ Token.prototype.attrIndex = function attrIndex(name) { var attrs, i, len; if (!this.attrs) { return -1; } attrs = this.attrs; for (i = 0, len = attrs.length; i < len; i++) { if (attrs[i][0] === name) { return i; } } return -1; }; /** * Token.attrPush(attrData) * * Add `[ name, value ]` attribute to list. Init attrs if necessary **/ Token.prototype.attrPush = function attrPush(attrData) { if (this.attrs) { this.attrs.push(attrData); } else { this.attrs = [ attrData ]; } }; /** * Token.attrSet(name, value) * * Set `name` attribute to `value`. Override old value if exists. **/ Token.prototype.attrSet = function attrSet(name, value) { var idx = this.attrIndex(name), attrData = [ name, value ]; if (idx < 0) { this.attrPush(attrData); } else { this.attrs[idx] = attrData; } }; /** * Token.attrGet(name) * * Get the value of attribute `name`, or null if it does not exist. **/ Token.prototype.attrGet = function attrGet(name) { var idx = this.attrIndex(name), value = null; if (idx >= 0) { value = this.attrs[idx][1]; } return value; }; /** * Token.attrJoin(name, value) * * Join value to existing attribute via space. Or create new attribute if not * exists. Useful to operate with token classes. **/ Token.prototype.attrJoin = function attrJoin(name, value) { var idx = this.attrIndex(name); if (idx < 0) { this.attrPush([ name, value ]); } else { this.attrs[idx][1] = this.attrs[idx][1] + ' ' + value; } }; module.exports = Token; /***/ }), /* 3 */ /***/ (function(module, exports) { module.exports=/[!-#%-\*,-/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E44\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD807[\uDC41-\uDC45\uDC70\uDC71]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/ /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ValidationError; (function (ValidationError) { ValidationError[ValidationError["ActionTypeNotAllowed"] = 0] = "ActionTypeNotAllowed"; ValidationError[ValidationError["CollectionCantBeEmpty"] = 1] = "CollectionCantBeEmpty"; ValidationError[ValidationError["ElementTypeNotAllowed"] = 2] = "ElementTypeNotAllowed"; ValidationError[ValidationError["InteractivityNotAllowed"] = 3] = "InteractivityNotAllowed"; ValidationError[ValidationError["InvalidPropertyValue"] = 4] = "InvalidPropertyValue"; ValidationError[ValidationError["MissingCardType"] = 5] = "MissingCardType"; ValidationError[ValidationError["PropertyCantBeNull"] = 6] = "PropertyCantBeNull"; ValidationError[ValidationError["TooManyActions"] = 7] = "TooManyActions"; ValidationError[ValidationError["UnknownActionType"] = 8] = "UnknownActionType"; ValidationError[ValidationError["UnknownElementType"] = 9] = "UnknownElementType"; ValidationError[ValidationError["UnsupportedCardVersion"] = 10] = "UnsupportedCardVersion"; })(ValidationError = exports.ValidationError || (exports.ValidationError = {})); /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // HTML5 entities map: { name -> utf16string } // /*eslint quotes:0*/ module.exports = __webpack_require__(16); /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Regexps to match html elements var attr_name = '[a-zA-Z_:][a-zA-Z0-9:._-]*'; var unquoted = '[^"\'=<>`\\x00-\\x20]+'; var single_quoted = "'[^']*'"; var double_quoted = '"[^"]*"'; var attr_value = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')'; var attribute = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)'; var open_tag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>'; var close_tag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>'; var comment = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->'; var processing = '<[?].*?[?]>'; var declaration = '<![A-Z]+\\s+[^>]*>'; var cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>'; var HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment + '|' + processing + '|' + declaration + '|' + cdata + ')'); var HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + ')'); module.exports.HTML_TAG_RE = HTML_TAG_RE; module.exports.HTML_OPEN_CLOSE_TAG_RE = HTML_OPEN_CLOSE_TAG_RE; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Process *this* and _that_ // // Insert each marker as a separate text token, and add it to delimiter list // module.exports.tokenize = function emphasis(state, silent) { var i, scanned, token, start = state.pos, marker = state.src.charCodeAt(start); if (silent) { return false; } if (marker !== 0x5F /* _ */ && marker !== 0x2A /* * */) { return false; } scanned = state.scanDelims(state.pos, marker === 0x2A); for (i = 0; i < scanned.length; i++) { token = state.push('text', '', 0); token.content = String.fromCharCode(marker); state.delimiters.push({ // Char code of the starting marker (number). // marker: marker, // Total length of these series of delimiters. // length: scanned.length, // An amount of characters before this one that's equivalent to // current one. In plain English: if this delimiter does not open // an emphasis, neither do previous `jump` characters. // // Used to skip sequences like "*****" in one step, for 1st asterisk // value will be 0, for 2nd it's 1 and so on. // jump: i, // A position of the token this delimiter corresponds to. // token: state.tokens.length - 1, // Token level. // level: state.level, // If this delimiter is matched as a valid opener, `end` will be // equal to its position, otherwise it's `-1`. // end: -1, // Boolean flags that determine if this delimiter could open or close // an emphasis. // open: scanned.can_open, close: scanned.can_close }); } state.pos += scanned.length; return true; }; // Walk through delimiter list and replace text tokens with tags // module.exports.postProcess = function emphasis(state) { var i, startDelim, endDelim, token, ch, isStrong, delimiters = state.delimiters, max = state.delimiters.length; for (i = max - 1; i >= 0; i--) { startDelim = delimiters[i]; if (startDelim.marker !== 0x5F/* _ */ && startDelim.marker !== 0x2A/* * */) { continue; } // Process only opening markers if (startDelim.end === -1) { continue; } endDelim = delimiters[startDelim.end]; // If the previous delimiter has the same marker and is adjacent to this one, // merge those into one strong delimiter. // // `<em><em>whatever</em></em>` -> `<strong>whatever</strong>` // isStrong = i > 0 && delimiters[i - 1].end === startDelim.end + 1 && delimiters[i - 1].token === startDelim.token - 1 && delimiters[startDelim.end + 1].token === endDelim.token + 1 && delimiters[i - 1].marker === startDelim.marker; ch = String.fromCharCode(startDelim.marker); token = state.tokens[startDelim.token]; token.type = isStrong ? 'strong_open' : 'em_open'; token.tag = isStrong ? 'strong' : 'em'; token.nesting = 1; token.markup = isStrong ? ch + ch : ch; token.content = ''; token = state.tokens[endDelim.token]; token.type = isStrong ? 'strong_close' : 'em_close'; token.tag = isStrong ? 'strong' : 'em'; token.nesting = -1; token.markup = isStrong ? ch + ch : ch; token.content = ''; if (isStrong) { state.tokens[delimiters[i - 1].token].content = ''; state.tokens[delimiters[startDelim.end + 1].token].content = ''; i--; } } }; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // ~~strike through~~ // // Insert each marker as a separate text token, and add it to delimiter list // module.exports.tokenize = function strikethrough(state, silent) { var i, scanned, token, len, ch, start = state.pos, marker = state.src.charCodeAt(start); if (silent) { return false; } if (marker !== 0x7E/* ~ */) { return false; } scanned = state.scanDelims(state.pos, true); len = scanned.length; ch = String.fromCharCode(marker); if (len < 2) { return false; } if (len % 2) { token = state.push('text', '', 0); token.content = ch; len--; } for (i = 0; i < len; i += 2) { token = state.push('text', '', 0); token.content = ch + ch; state.delimiters.push({ marker: marker, jump: i, token: state.tokens.length - 1, level: state.level, end: -1, open: scanned.can_open, close: scanned.can_close }); } state.pos += scanned.length; return true; }; // Walk through delimiter list and replace text tokens with tags // module.exports.postProcess = function strikethrough(state) { var i, j, startDelim, endDelim, token, loneMarkers = [], delimiters = state.delimiters, max = state.delimiters.length; for (i = 0; i < max; i++) { startDelim = delimiters[i]; if (startDelim.marker !== 0x7E/* ~ */) { continue; } if (startDelim.end === -1) { continue; } endDelim = delimiters[startDelim.end]; token = state.tokens[startDelim.token]; token.type = 's_open'; token.tag = 's'; token.nesting = 1; token.markup = '~~'; token.content = ''; token = state.tokens[endDelim.token]; token.type = 's_close'; token.tag = 's'; token.nesting = -1; token.markup = '~~'; token.content = ''; if (state.tokens[endDelim.token - 1].type === 'text' && state.tokens[endDelim.token - 1].content === '~') { loneMarkers.push(endDelim.token - 1); } } // If a marker sequence has an odd number of characters, it's splitted // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the // start of the sequence. // // So, we have to move all those markers after subsequent s_close tags. // while (loneMarkers.length) { i = loneMarkers.pop(); j = i + 1; while (j < state.tokens.length && state.tokens[j].type === 's_close') { j++; } j--; if (i !== j) { token = state.tokens[j]; state.tokens[j] = state.tokens[i]; state.tokens[i] = token; } } }; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports.encode = __webpack_require__(65); module.exports.decode = __webpack_require__(64); module.exports.format = __webpack_require__(66); module.exports.parse = __webpack_require__(67); /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var markdownIt = __webpack_require__(19); var markdownProcessor = new markdownIt(); function processMarkdown(text) { return markdownProcessor.render(text); } exports.processMarkdown = processMarkdown; function getValueOrDefault(obj, defaultValue) { return obj ? obj : defaultValue; } exports.getValueOrDefault = getValueOrDefault; function isNullOrEmpty(value) { return value === undefined || value === null || value === ""; } exports.isNullOrEmpty = isNullOrEmpty; function appendChild(node, child) { if (child != null && child != undefined) { node.appendChild(child); } } exports.appendChild = appendChild; function renderSeparation(separationDefinition, orientation) { var separator = document.createElement("div"); if (orientation == "vertical") { if (separationDefinition.lineThickness) { separator.style.marginTop = (separationDefinition.spacing / 2) + "px"; separator.style.paddingTop = (separationDefinition.spacing / 2) + "px"; separator.style.borderTop = separationDefinition.lineThickness + "px solid " + stringToCssColor(separationDefinition.lineColor); } else { separator.style.height = separationDefinition.spacing + "px"; } } else { if (separationDefinition.lineThickness) { separator.style.marginLeft = (separationDefinition.spacing / 2) + "px"; separator.style.paddingLeft = (separationDefinition.spacing / 2) + "px"; separator.style.borderLeft = separationDefinition.lineThickness + "px solid " + stringToCssColor(separationDefinition.lineColor); } else { separator.style.width = separationDefinition.spacing + "px"; } } return separator; } exports.renderSeparation = renderSeparation; function stringToCssColor(color) { var regEx = /#([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})?/gi; var matches = regEx.exec(color); if (matches && matches[4]) { var a = parseInt(matches[1], 16) / 255; var r = parseInt(matches[2], 16); var g = parseInt(matches[3], 16); var b = parseInt(matches[4], 16); return "rgba(" + r + "," + g + "," + b + "," + a + ")"; } else { return color; } } exports.stringToCssColor = stringToCssColor; var StringWithSubstitutions = /** @class */ (function () { function StringWithSubstitutions() { this._isProcessed = false; this._original = null; this._processed = null; } StringWithSubstitutions.prototype.substituteInputValues = function (inputs) { this._processed = this._original; var regEx = /\{{2}([a-z0-9_$@]+).value\}{2}/gi; var matches; while ((matches = regEx.exec(this._original)) != null) { var matchedInput = null; for (var i = 0; i < inputs.length; i++) { if (inputs[i].id.toLowerCase() == matches[1].toLowerCase()) { matchedInput = inputs[i]; break; } } if (matchedInput) { this._processed = this._processed.replace(matches[0], matchedInput.value ? matchedInput.value : ""); } } ; this._isProcessed = true; }; StringWithSubstitutions.prototype.get = function () { if (!this._isProcessed) { return this._original; } else { return this._processed; } }; StringWithSubstitutions.prototype.set = function (value) { this._original = value; this._isProcessed = false; }; return StringWithSubstitutions; }()); exports.StringWithSubstitutions = StringWithSubstitutions; /***/ }), /* 11 */ /***/ (function(module, exports) { module.exports=/[\0-\x1F\x7F-\x9F]/ /***/ }), /* 12 */ /***/ (function(module, exports) { module.exports=/[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/ /***/ }), /* 13 */ /***/ (function(module, exports) { module.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/ /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var Enums = __webpack_require__(4); var Utils = __webpack_require__(10); var TextFormatters = __webpack_require__(70); function invokeSetParent(obj, parent) { // This is not super pretty, but it the closest emulation of // "internal" in TypeScript. obj["setParent"](parent); } function isActionAllowed(action, forbiddenActionTypes) { if (forbiddenActionTypes) { for (var i = 0; i < forbiddenActionTypes.length; i++) { if (action.getJsonTypeName() === forbiddenActionTypes[i]) { return false; } } } return true; } function isElementAllowed(element, forbiddenElementTypes) { if (!hostConfig.supportsInteractivity && element.isInteractive) { return false; } if (forbiddenElementTypes) { for (var i = 0; i < forbiddenElementTypes.length; i++) { if (element.getJsonTypeName() === forbiddenElementTypes[i]) { return false; } } } return true; } var CardElement = /** @class */ (function () { function CardElement() { this._parent = null; this.horizontalAlignment = "left"; this.separation = "default"; } CardElement.prototype.internalGetNonZeroPadding = function (element, padding) { if (padding.top == 0) { padding.top = element.padding.top; } if (padding.right == 0) { padding.right = element.padding.right; } if (padding.bottom == 0) { padding.bottom = element.padding.bottom; } if (padding.left == 0) { padding.left = element.padding.left; } if (element.parent) { this.internalGetNonZeroPadding(element.parent, padding); } }; CardElement.prototype.showBottomSpacer = function (requestingElement) { if (this.parent) { this.parent.showBottomSpacer(this); } }; CardElement.prototype.hideBottomSpacer = function (requestingElement) { if (this.parent) { this.parent.hideBottomSpacer(this); } }; CardElement.prototype.setParent = function (value) { this._parent = value; }; Object.defineProperty(CardElement.prototype, "useDefaultSizing", { get: function () { return true; }, enumerable: true, configurable: true }); Object.defineProperty(CardElement.prototype, "padding", { get: function () { return { top: 0, right: 0, bottom: 0, left: 0 }; }, enumerable: true, configurable: true }); CardElement.prototype.getNonZeroPadding = function () { var padding = { top: 0, right: 0, bottom: 0, left: 0 }; this.internalGetNonZeroPadding(this, padding); return padding; }; CardElement.prototype.getForbiddenElementTypes = function () { return null; }; CardElement.prototype.getForbiddenActionTypes = function () { return null; }; CardElement.prototype.parse = function (json) { this.speak = json["speak"]; this.horizontalAlignment = Utils.getValueOrDefault(json["horizontalAlignment"], "left"); this.separation = Utils.getValueOrDefault(json["separation"], "default"); }; CardElement.prototype.validate = function () { return []; }; CardElement.prototype.render = function () { var renderedElement = this.internalRender(); if (renderedElement != null) { renderedElement.style.boxSizing = "border-box"; } return renderedElement; }; CardElement.prototype.isLastItem = function (item) { return this.parent ? this.parent.isLastItem(item) : true; }; CardElement.prototype.getRootElement = function () { var rootElement = this; while (rootElement.parent) { rootElement = rootElement.parent; } return rootElement; }; CardElement.prototype.getAllInputs = function () { return []; }; Object.defineProperty(CardElement.prototype, "isInteractive", { get: function () { return false; }, enumerable: true, configurable: true }); Object.defineProperty(CardElement.prototype, "isStandalone", { get: function () { return true; }, enumerable: true, configurable: true }); Object.defineProperty(CardElement.prototype, "parent", { get: function () { return this._parent; }, enumerable: true, configurable: true }); return CardElement; }()); exports.CardElement = CardElement; var TextBlock = /** @class */ (function (_super) { __extends(TextBlock, _super); function TextBlock() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.size = "normal"; _this.weight = "normal"; _this.isSubtle = false; _this.wrap = false; return _this; } TextBlock.prototype.internalRender = function () { if (!Utils.isNullOrEmpty(this.text)) { var element = document.createElement("div"); if (hostConfig.fontFamily) { element.style.fontFamily = hostConfig.fontFamily; } switch (this.horizontalAlignment) { case "center": element.style.textAlign = "center"; break; case "right": element.style.textAlign = "right"; break; default: element.style.textAlign = "left"; break; } var cssStyle = "text "; var fontSize; switch (this.size) { case "small": fontSize = hostConfig.fontSizes.small; break; case "medium": fontSize = hostConfig.fontSizes.medium; break; case "large": fontSize = hostConfig.fontSizes.large; break; case "extraLarge": fontSize = hostConfig.fontSizes.extraLarge; break; default: fontSize = hostConfig.fontSizes.normal; break; } // Looks like 1.33 is the magic number to compute line-height // from font size. var computedLineHeight = fontSize * 1.33; element.style.fontSize = fontSize + "px"; element.style.lineHeight = computedLineHeight + "px"; var actualTextColor = this.color ? this.color : hostConfig.textBlock.color; var colorDefinition; switch (actualTextColor) { case "dark": colorDefinition = hostConfig.colors.dark; break; case "light": colorDefinition = hostConfig.colors.light; break; case "accent": colorDefinition = hostConfig.colors.accent; break; case "good": colorDefinition = hostConfig.colors.good; break; case "warning": colorDefinition = hostConfig.colors.warning; break; case "attention": colorDefinition = hostConfig.colors.attention; break; default: colorDefinition = hostConfig.colors.dark; break; } element.style.color = Utils.stringToCssColor(this.isSubtle ? colorDefinition.subtle : colorDefinition.normal); var fontWeight; switch (this.weight) { case "lighter": fontWeight = hostConfig.fontWeights.lighter; break; case "bolder": fontWeight = hostConfig.fontWeights.bolder; break; default: fontWeight = hostConfig.fontWeights.normal; break; } element.style.fontWeight = fontWeight.toString(); var formattedText = TextFormatters.formatText(this.text); element.innerHTML = Utils.processMarkdown(formattedText); if (element.firstElementChild instanceof HTMLElement) { var firstElementChild = element.firstElementChild; firstElementChild.style.marginTop = "0px"; firstElementChild.style.width = "100%"; if (!this.wrap) { firstElementChild.style.overflow = "hidden"; firstElementChild.style.textOverflow = "ellipsis"; } } if (element.lastElementChild instanceof HTMLElement) { element.lastElementChild.style.marginBottom = "0px"; } var anchors = element.getElementsByTagName("a"); for (var i = 0; i < anchors.length; i++) { anchors[i].target = "_blank"; } if (this.wrap) { element.style.wordWrap = "break-word"; if (this.maxLines > 0) { element.style.maxHeight = (computedLineHeight * this.maxLines) + "px"; element.style.overflow = "hidden"; } } else { element.style.whiteSpace = "nowrap"; } return element; } else { return null; } }; TextBlock.prototype.parse = function (json) { _super.prototype.parse.call(this, json); this.text = json["text"]; this.size = Utils.getValueOrDefault(json["size"], "normal"); this.weight = Utils.getValueOrDefault(json["weight"], "normal"); this.color = Utils.getValueOrDefault(json["color"], hostConfig.textBlock.color); this.isSubtle = json["isSubtle"]; this.wrap = json["wrap"] === undefined ? false : json["wrap"]; this.maxLines = json["maxLines"]; }; TextBlock.prototype.getJsonTypeName = function () { return "TextBlock"; }; TextBlock.prototype.getDefaultSeparationDefinition = function () { switch (this.size) { case "small": return hostConfig.textBlock.separations.small; case "medium": return hostConfig.textBlock.separations.medium; case "large": return hostConfig.textBlock.separations.large; case "extraLarge": return hostConfig.textBlock.separations.extraLarge; default: return hostConfig.textBlock.separations.normal; } }; TextBlock.prototype.renderSpeech = function () { if (this.speak != null) return this.speak + '\n'; if (this.text) return '<s>' + this.text + '</s>\n'; return null; }; return TextBlock; }(CardElement)); exports.TextBlock = TextBlock; var Fact = /** @class */ (function () { function Fact() { } Fact.prototype.renderS